diff --git a/db/ddlutils/oracle/views/C_DUNNING_HEADER_V.sql b/db/ddlutils/oracle/views/C_DUNNING_HEADER_V.sql index 899c363ed5..3478a588ee 100644 --- a/db/ddlutils/oracle/views/C_DUNNING_HEADER_V.sql +++ b/db/ddlutils/oracle/views/C_DUNNING_HEADER_V.sql @@ -1,37 +1,38 @@ -CREATE OR REPLACE VIEW C_DUNNING_HEADER_V -(AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, - UPDATED, UPDATEDBY, AD_LANGUAGE, C_DUNNINGRUN_ID, C_DUNNINGRUNENTRY_ID, - DUNNINGDATE, PRINTNAME, DOCUMENTNOTE, C_BPARTNER_ID, BPVALUE, - BPTAXID, NAICS, DUNS, ORG_LOCATION_ID, TAXID, - SALESREP_ID, SALESREP_NAME, BPGREETING, NAME, NAME2, - BPCONTACTGREETING, TITLE, PHONE, CONTACTNAME, C_LOCATION_ID, - REFERENCENO, POSTAL, AMT, QTY, NOTE) -AS -SELECT dr.AD_Client_ID, dr.AD_Org_ID, dr.IsActive, dr.Created, dr.CreatedBy, dr.Updated, dr.UpdatedBy, - cast('en_US' as varchar2(6)) AS AD_Language, dr.C_DunningRun_ID, C_DunningRunEntry_ID, - dr.DunningDate, dl.PrintName, dl.Note AS DocumentNote, - dre.C_BPartner_ID, bp.Value AS BPValue, bp.TaxID AS BPTaxID, bp.NAICS, bp.DUNS, - oi.C_Location_ID AS Org_Location_ID, oi.TaxID, - dre.SalesRep_ID, COALESCE(ubp.Name, u.Name) AS SalesRep_Name, - bpg.Greeting AS BPGreeting, - bp.Name, bp.Name2, - bpcg.Greeting AS BPContactGreeting, - bpc.Title, bpc.Phone, - NULLIF (bpc.Name, bp.Name) AS ContactName, - bpl.C_Location_ID, bp.ReferenceNo, l.Postal || l.Postal_Add AS Postal, - dre.Amt, dre.Qty, dre.Note -FROM C_DunningRun dr - INNER JOIN C_DunningLevel dl ON (dr.C_DunningLevel_ID=dl.C_DunningLevel_ID) - INNER JOIN C_DunningRunEntry dre ON (dr.C_DunningRun_ID=dre.C_DunningRun_ID) - INNER JOIN C_BPartner bp ON (dre.C_BPartner_ID=bp.C_BPartner_ID) - LEFT OUTER JOIN C_Greeting bpg on (bp.C_Greeting_ID=bpg.C_Greeting_ID) - INNER JOIN C_BPartner_Location bpl ON (dre.C_BPartner_Location_ID=bpl.C_BPartner_Location_ID) - INNER JOIN C_Location l ON (bpl.C_Location_ID=l.C_Location_ID) - LEFT OUTER JOIN AD_User bpc ON (dre.AD_User_ID=bpc.AD_User_ID) - LEFT OUTER JOIN C_Greeting bpcg on (bpc.C_Greeting_ID=bpcg.C_Greeting_ID) - INNER JOIN AD_OrgInfo oi ON (dr.AD_Org_ID=oi.AD_Org_ID) - LEFT OUTER JOIN AD_User u ON (dre.SalesRep_ID=u.AD_User_ID) - LEFT OUTER JOIN C_BPartner ubp ON (u.C_BPartner_ID=ubp.C_BPartner_ID); - - - +CREATE OR REPLACE VIEW C_DUNNING_HEADER_V +(AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, + UPDATED, UPDATEDBY, AD_LANGUAGE, C_DUNNINGRUN_ID, C_DUNNINGRUNENTRY_ID, + DUNNINGDATE, PRINTNAME, DOCUMENTNOTE, C_BPARTNER_ID, BPVALUE, + BPTAXID, NAICS, DUNS, ORG_LOCATION_ID, TAXID, + SALESREP_ID, SALESREP_NAME, BPGREETING, NAME, NAME2, + BPCONTACTGREETING, TITLE, PHONE, CONTACTNAME, C_LOCATION_ID, + REFERENCENO, POSTAL, AMT, QTY, NOTE, LOGO_ID) +AS +SELECT dr.AD_Client_ID, dr.AD_Org_ID, dr.IsActive, dr.Created, dr.CreatedBy, dr.Updated, dr.UpdatedBy, + cast('en_US' as varchar2(6)) AS AD_Language, dr.C_DunningRun_ID, C_DunningRunEntry_ID, + dr.DunningDate, dl.PrintName, dl.Note AS DocumentNote, + dre.C_BPartner_ID, bp.Value AS BPValue, bp.TaxID AS BPTaxID, bp.NAICS, bp.DUNS, + oi.C_Location_ID AS Org_Location_ID, oi.TaxID, + dre.SalesRep_ID, COALESCE(ubp.Name, u.Name) AS SalesRep_Name, + bpg.Greeting AS BPGreeting, + bp.Name, bp.Name2, + bpcg.Greeting AS BPContactGreeting, + bpc.Title, bpc.Phone, + NULLIF (bpc.Name, bp.Name) AS ContactName, + bpl.C_Location_ID, bp.ReferenceNo, l.Postal || l.Postal_Add AS Postal, + dre.Amt, dre.Qty, dre.Note, COALESCE(oi.Logo_ID, ci.Logo_ID) AS Logo_ID +FROM C_DunningRun dr + INNER JOIN C_DunningLevel dl ON (dr.C_DunningLevel_ID=dl.C_DunningLevel_ID) + INNER JOIN C_DunningRunEntry dre ON (dr.C_DunningRun_ID=dre.C_DunningRun_ID) + INNER JOIN C_BPartner bp ON (dre.C_BPartner_ID=bp.C_BPartner_ID) + LEFT OUTER JOIN C_Greeting bpg on (bp.C_Greeting_ID=bpg.C_Greeting_ID) + INNER JOIN C_BPartner_Location bpl ON (dre.C_BPartner_Location_ID=bpl.C_BPartner_Location_ID) + INNER JOIN C_Location l ON (bpl.C_Location_ID=l.C_Location_ID) + LEFT OUTER JOIN AD_User bpc ON (dre.AD_User_ID=bpc.AD_User_ID) + LEFT OUTER JOIN C_Greeting bpcg on (bpc.C_Greeting_ID=bpcg.C_Greeting_ID) + INNER JOIN AD_OrgInfo oi ON (dr.AD_Org_ID=oi.AD_Org_ID) + INNER JOIN AD_ClientInfo ci ON (dr.AD_Client_ID=ci.AD_Client_ID) + LEFT OUTER JOIN AD_User u ON (dre.SalesRep_ID=u.AD_User_ID) + LEFT OUTER JOIN C_BPartner ubp ON (u.C_BPartner_ID=ubp.C_BPartner_ID); + + + diff --git a/db/ddlutils/oracle/views/C_DUNNING_HEADER_VT.sql b/db/ddlutils/oracle/views/C_DUNNING_HEADER_VT.sql index 9fb90735b6..835a16d648 100644 --- a/db/ddlutils/oracle/views/C_DUNNING_HEADER_VT.sql +++ b/db/ddlutils/oracle/views/C_DUNNING_HEADER_VT.sql @@ -1,40 +1,41 @@ -CREATE OR REPLACE VIEW C_DUNNING_HEADER_VT -(AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, - UPDATED, UPDATEDBY, AD_LANGUAGE, C_DUNNINGRUN_ID, C_DUNNINGRUNENTRY_ID, - DUNNINGDATE, PRINTNAME, DOCUMENTNOTE, C_BPARTNER_ID, BPVALUE, - BPTAXID, NAICS, DUNS, ORG_LOCATION_ID, TAXID, - SALESREP_ID, SALESREP_NAME, BPGREETING, NAME, NAME2, - BPCONTACTGREETING, TITLE, PHONE, CONTACTNAME, C_LOCATION_ID, - REFERENCENO, POSTAL, AMT, QTY, NOTE) -AS -SELECT dr.AD_Client_ID, dr.AD_Org_ID, dr.IsActive, dr.Created, dr.CreatedBy, dr.Updated, dr.UpdatedBy, - dlt.AD_Language, dr.C_DunningRun_ID, C_DunningRunEntry_ID, - dr.DunningDate, dlt.PrintName, dlt.Note AS DocumentNote, - dre.C_BPartner_ID, bp.Value AS BPValue, bp.TaxID AS BPTaxID, bp.NAICS, bp.DUNS, - oi.C_Location_ID AS Org_Location_ID, oi.TaxID, - dre.SalesRep_ID, COALESCE(ubp.Name, u.Name) AS SalesRep_Name, - bpg.Greeting AS BPGreeting, - bp.Name, bp.Name2, - bpcg.Greeting AS BPContactGreeting, - bpc.Title, bpc.Phone, - NULLIF (bpc.Name, bp.Name) AS ContactName, - bpl.C_Location_ID, bp.ReferenceNo, l.Postal || l.Postal_Add AS Postal, - dre.Amt, dre.Qty, dre.Note -FROM C_DunningRun dr - INNER JOIN C_DunningLevel dl ON (dr.C_DunningLevel_ID=dl.C_DunningLevel_ID) - INNER JOIN C_DunningLevel_Trl dlt ON (dl.C_DunningLevel_ID=dlt.C_DunningLevel_ID) - INNER JOIN C_DunningRunEntry dre ON (dr.C_DunningRun_ID=dre.C_DunningRun_ID) - INNER JOIN C_BPartner bp ON (dre.C_BPartner_ID=bp.C_BPartner_ID) - LEFT OUTER JOIN C_Greeting_Trl bpg on (bp.C_Greeting_ID=bpg.C_Greeting_ID - AND dlt.AD_Language=bpg.AD_Language) - INNER JOIN C_BPartner_Location bpl ON (dre.C_BPartner_Location_ID=bpl.C_BPartner_Location_ID) - INNER JOIN C_Location l ON (bpl.C_Location_ID=l.C_Location_ID) - LEFT OUTER JOIN AD_User bpc ON (dre.AD_User_ID=bpc.AD_User_ID) - LEFT OUTER JOIN C_Greeting_Trl bpcg on (bpc.C_Greeting_ID=bpcg.C_Greeting_ID - AND dlt.AD_Language=bpcg.AD_Language) - INNER JOIN AD_OrgInfo oi ON (dr.AD_Org_ID=oi.AD_Org_ID) - LEFT OUTER JOIN AD_User u ON (dre.SalesRep_ID=u.AD_User_ID) - LEFT OUTER JOIN C_BPartner ubp ON (u.C_BPartner_ID=ubp.C_BPartner_ID); - - - +CREATE OR REPLACE VIEW C_DUNNING_HEADER_VT +(AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, + UPDATED, UPDATEDBY, AD_LANGUAGE, C_DUNNINGRUN_ID, C_DUNNINGRUNENTRY_ID, + DUNNINGDATE, PRINTNAME, DOCUMENTNOTE, C_BPARTNER_ID, BPVALUE, + BPTAXID, NAICS, DUNS, ORG_LOCATION_ID, TAXID, + SALESREP_ID, SALESREP_NAME, BPGREETING, NAME, NAME2, + BPCONTACTGREETING, TITLE, PHONE, CONTACTNAME, C_LOCATION_ID, + REFERENCENO, POSTAL, AMT, QTY, NOTE, LOGO_ID) +AS +SELECT dr.AD_Client_ID, dr.AD_Org_ID, dr.IsActive, dr.Created, dr.CreatedBy, dr.Updated, dr.UpdatedBy, + dlt.AD_Language, dr.C_DunningRun_ID, C_DunningRunEntry_ID, + dr.DunningDate, dlt.PrintName, dlt.Note AS DocumentNote, + dre.C_BPartner_ID, bp.Value AS BPValue, bp.TaxID AS BPTaxID, bp.NAICS, bp.DUNS, + oi.C_Location_ID AS Org_Location_ID, oi.TaxID, + dre.SalesRep_ID, COALESCE(ubp.Name, u.Name) AS SalesRep_Name, + bpg.Greeting AS BPGreeting, + bp.Name, bp.Name2, + bpcg.Greeting AS BPContactGreeting, + bpc.Title, bpc.Phone, + NULLIF (bpc.Name, bp.Name) AS ContactName, + bpl.C_Location_ID, bp.ReferenceNo, l.Postal || l.Postal_Add AS Postal, + dre.Amt, dre.Qty, dre.Note, COALESCE(oi.Logo_ID, ci.Logo_ID) AS Logo_ID +FROM C_DunningRun dr + INNER JOIN C_DunningLevel dl ON (dr.C_DunningLevel_ID=dl.C_DunningLevel_ID) + INNER JOIN C_DunningLevel_Trl dlt ON (dl.C_DunningLevel_ID=dlt.C_DunningLevel_ID) + INNER JOIN C_DunningRunEntry dre ON (dr.C_DunningRun_ID=dre.C_DunningRun_ID) + INNER JOIN C_BPartner bp ON (dre.C_BPartner_ID=bp.C_BPartner_ID) + LEFT OUTER JOIN C_Greeting_Trl bpg on (bp.C_Greeting_ID=bpg.C_Greeting_ID + AND dlt.AD_Language=bpg.AD_Language) + INNER JOIN C_BPartner_Location bpl ON (dre.C_BPartner_Location_ID=bpl.C_BPartner_Location_ID) + INNER JOIN C_Location l ON (bpl.C_Location_ID=l.C_Location_ID) + LEFT OUTER JOIN AD_User bpc ON (dre.AD_User_ID=bpc.AD_User_ID) + LEFT OUTER JOIN C_Greeting_Trl bpcg on (bpc.C_Greeting_ID=bpcg.C_Greeting_ID + AND dlt.AD_Language=bpcg.AD_Language) + INNER JOIN AD_OrgInfo oi ON (dr.AD_Org_ID=oi.AD_Org_ID) + INNER JOIN AD_ClientInfo ci ON (dr.AD_Client_ID=ci.AD_Client_ID) + LEFT OUTER JOIN AD_User u ON (dre.SalesRep_ID=u.AD_User_ID) + LEFT OUTER JOIN C_BPartner ubp ON (u.C_BPartner_ID=ubp.C_BPartner_ID); + + + diff --git a/db/ddlutils/oracle/views/C_INVOICE_HEADER_V.sql b/db/ddlutils/oracle/views/C_INVOICE_HEADER_V.sql index 8f5c7dea18..71d940cb3a 100644 --- a/db/ddlutils/oracle/views/C_INVOICE_HEADER_V.sql +++ b/db/ddlutils/oracle/views/C_INVOICE_HEADER_V.sql @@ -1,56 +1,57 @@ -CREATE OR REPLACE VIEW C_INVOICE_HEADER_V -(AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, - UPDATED, UPDATEDBY, AD_LANGUAGE, C_INVOICE_ID, ISSOTRX, - DOCUMENTNO, DOCSTATUS, C_DOCTYPE_ID, C_BPARTNER_ID, BPVALUE, - BPTAXID, NAICS, DUNS, ORG_LOCATION_ID, TAXID, - DOCUMENTTYPE, DOCUMENTTYPENOTE, C_ORDER_ID, SALESREP_ID, SALESREP_NAME, - DATEINVOICED, BPGREETING, NAME, NAME2, BPCONTACTGREETING, - TITLE, PHONE, CONTACTNAME, C_LOCATION_ID, REFERENCENO, - POSTAL, DESCRIPTION, POREFERENCE, DATEORDERED, C_CURRENCY_ID, - PAYMENTTERM, PAYMENTTERMNOTE, C_CHARGE_ID, CHARGEAMT, TOTALLINES, - GRANDTOTAL, AMTINWORDS, M_PRICELIST_ID, ISTAXINCLUDED, C_CAMPAIGN_ID, - C_PROJECT_ID, C_ACTIVITY_ID, ISPAID) -AS -SELECT i.AD_Client_ID, i.AD_Org_ID, i.IsActive, i.Created, i.CreatedBy, i.Updated, i.UpdatedBy, - cast('en_US' as varchar2(6)) AS AD_Language, - i.C_Invoice_ID, i.IsSOTrx, i.DocumentNo, i.DocStatus, i.C_DocType_ID, - i.C_BPartner_ID, bp.Value AS BPValue, bp.TaxID AS BPTaxID, bp.NAICS, bp.DUNS, - oi.C_Location_ID AS Org_Location_ID, oi.TaxID, - dt.PrintName AS DocumentType, dt.DocumentNote AS DocumentTypeNote, - i.C_Order_ID, i.SalesRep_ID, COALESCE(ubp.Name, u.Name) AS SalesRep_Name, - i.DateInvoiced, - bpg.Greeting AS BPGreeting, - bp.Name, bp.Name2, - bpcg.Greeting AS BPContactGreeting, - bpc.Title, bpc.Phone, - NULLIF (bpc.Name, bp.Name) AS ContactName, - bpl.C_Location_ID, bp.ReferenceNo, l.Postal || l.Postal_Add AS Postal, - i.Description, - i.POReference, - i.DateOrdered, - i.C_Currency_ID, - pt.Name AS PaymentTerm, pt.DocumentNote AS PaymentTermNote, - i.C_Charge_ID, i.ChargeAmt, - i.TotalLines, - i.GrandTotal, i.GrandTotal AS AmtInWords, - i.M_PriceList_ID, - i.IsTaxIncluded, - i.C_Campaign_ID, - i.C_Project_ID, - i.C_Activity_ID, - i.IsPaid -FROM C_Invoice i - INNER JOIN C_DocType dt ON (i.C_DocType_ID=dt.C_DocType_ID) - INNER JOIN C_PaymentTerm pt ON (i.C_PaymentTerm_ID=pt.C_PaymentTerm_ID) - INNER JOIN C_BPartner bp ON (i.C_BPartner_ID=bp.C_BPartner_ID) - LEFT OUTER JOIN C_Greeting bpg on (bp.C_Greeting_ID=bpg.C_Greeting_ID) - INNER JOIN C_BPartner_Location bpl ON (i.C_BPartner_Location_ID=bpl.C_BPartner_Location_ID) - INNER JOIN C_Location l ON (bpl.C_Location_ID=l.C_Location_ID) - LEFT OUTER JOIN AD_User bpc ON (i.AD_User_ID=bpc.AD_User_ID) - LEFT OUTER JOIN C_Greeting bpcg on (bpc.C_Greeting_ID=bpcg.C_Greeting_ID) - INNER JOIN AD_OrgInfo oi ON (i.AD_Org_ID=oi.AD_Org_ID) - LEFT OUTER JOIN AD_User u ON (i.SalesRep_ID=u.AD_User_ID) - LEFT OUTER JOIN C_BPartner ubp ON (u.C_BPartner_ID=ubp.C_BPartner_ID); - - - +CREATE OR REPLACE VIEW C_INVOICE_HEADER_V +(AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, + UPDATED, UPDATEDBY, AD_LANGUAGE, C_INVOICE_ID, ISSOTRX, + DOCUMENTNO, DOCSTATUS, C_DOCTYPE_ID, C_BPARTNER_ID, BPVALUE, + BPTAXID, NAICS, DUNS, ORG_LOCATION_ID, TAXID, + DOCUMENTTYPE, DOCUMENTTYPENOTE, C_ORDER_ID, SALESREP_ID, SALESREP_NAME, + DATEINVOICED, BPGREETING, NAME, NAME2, BPCONTACTGREETING, + TITLE, PHONE, CONTACTNAME, C_LOCATION_ID, REFERENCENO, + POSTAL, DESCRIPTION, POREFERENCE, DATEORDERED, C_CURRENCY_ID, + PAYMENTTERM, PAYMENTTERMNOTE, C_CHARGE_ID, CHARGEAMT, TOTALLINES, + GRANDTOTAL, AMTINWORDS, M_PRICELIST_ID, ISTAXINCLUDED, C_CAMPAIGN_ID, + C_PROJECT_ID, C_ACTIVITY_ID, ISPAID, LOGO_ID) +AS +SELECT i.AD_Client_ID, i.AD_Org_ID, i.IsActive, i.Created, i.CreatedBy, i.Updated, i.UpdatedBy, + cast('en_US' as varchar2(6)) AS AD_Language, + i.C_Invoice_ID, i.IsSOTrx, i.DocumentNo, i.DocStatus, i.C_DocType_ID, + i.C_BPartner_ID, bp.Value AS BPValue, bp.TaxID AS BPTaxID, bp.NAICS, bp.DUNS, + oi.C_Location_ID AS Org_Location_ID, oi.TaxID, + dt.PrintName AS DocumentType, dt.DocumentNote AS DocumentTypeNote, + i.C_Order_ID, i.SalesRep_ID, COALESCE(ubp.Name, u.Name) AS SalesRep_Name, + i.DateInvoiced, + bpg.Greeting AS BPGreeting, + bp.Name, bp.Name2, + bpcg.Greeting AS BPContactGreeting, + bpc.Title, bpc.Phone, + NULLIF (bpc.Name, bp.Name) AS ContactName, + bpl.C_Location_ID, bp.ReferenceNo, l.Postal || l.Postal_Add AS Postal, + i.Description, + i.POReference, + i.DateOrdered, + i.C_Currency_ID, + pt.Name AS PaymentTerm, pt.DocumentNote AS PaymentTermNote, + i.C_Charge_ID, i.ChargeAmt, + i.TotalLines, + i.GrandTotal, i.GrandTotal AS AmtInWords, + i.M_PriceList_ID, + i.IsTaxIncluded, + i.C_Campaign_ID, + i.C_Project_ID, + i.C_Activity_ID, + i.IsPaid, COALESCE(oi.Logo_ID, ci.Logo_ID) AS Logo_ID +FROM C_Invoice i + INNER JOIN C_DocType dt ON (i.C_DocType_ID=dt.C_DocType_ID) + INNER JOIN C_PaymentTerm pt ON (i.C_PaymentTerm_ID=pt.C_PaymentTerm_ID) + INNER JOIN C_BPartner bp ON (i.C_BPartner_ID=bp.C_BPartner_ID) + LEFT OUTER JOIN C_Greeting bpg on (bp.C_Greeting_ID=bpg.C_Greeting_ID) + INNER JOIN C_BPartner_Location bpl ON (i.C_BPartner_Location_ID=bpl.C_BPartner_Location_ID) + INNER JOIN C_Location l ON (bpl.C_Location_ID=l.C_Location_ID) + LEFT OUTER JOIN AD_User bpc ON (i.AD_User_ID=bpc.AD_User_ID) + LEFT OUTER JOIN C_Greeting bpcg on (bpc.C_Greeting_ID=bpcg.C_Greeting_ID) + INNER JOIN AD_OrgInfo oi ON (i.AD_Org_ID=oi.AD_Org_ID) + INNER JOIN AD_ClientInfo ci ON (i.AD_Client_ID=ci.AD_Client_ID) + LEFT OUTER JOIN AD_User u ON (i.SalesRep_ID=u.AD_User_ID) + LEFT OUTER JOIN C_BPartner ubp ON (u.C_BPartner_ID=ubp.C_BPartner_ID); + + + diff --git a/db/ddlutils/oracle/views/C_INVOICE_HEADER_VT.sql b/db/ddlutils/oracle/views/C_INVOICE_HEADER_VT.sql index 8ebbd047a0..1d15fdac6e 100644 --- a/db/ddlutils/oracle/views/C_INVOICE_HEADER_VT.sql +++ b/db/ddlutils/oracle/views/C_INVOICE_HEADER_VT.sql @@ -1,56 +1,57 @@ -CREATE OR REPLACE VIEW C_INVOICE_HEADER_VT -(AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, - UPDATED, UPDATEDBY, AD_LANGUAGE, C_INVOICE_ID, ISSOTRX, - DOCUMENTNO, DOCSTATUS, C_DOCTYPE_ID, C_BPARTNER_ID, BPVALUE, - BPTAXID, NAICS, DUNS, ORG_LOCATION_ID, TAXID, - DOCUMENTTYPE, DOCUMENTTYPENOTE, C_ORDER_ID, SALESREP_ID, SALESREP_NAME, - DATEINVOICED, BPGREETING, NAME, NAME2, BPCONTACTGREETING, - TITLE, PHONE, CONTACTNAME, C_LOCATION_ID, REFERENCENO, - POSTAL, DESCRIPTION, POREFERENCE, DATEORDERED, C_CURRENCY_ID, - PAYMENTTERM, PAYMENTTERMNOTE, C_CHARGE_ID, CHARGEAMT, TOTALLINES, - GRANDTOTAL, AMTINWORDS, M_PRICELIST_ID, ISTAXINCLUDED, C_CAMPAIGN_ID, - C_PROJECT_ID, C_ACTIVITY_ID, ISPAID) -AS -SELECT i.AD_Client_ID, i.AD_Org_ID, i.IsActive, i.Created, i.CreatedBy, i.Updated, i.UpdatedBy, - dt.AD_Language, - i.C_Invoice_ID, i.IsSOTrx, i.DocumentNo, i.DocStatus, i.C_DocType_ID, - i.C_BPartner_ID, bp.Value AS BPValue, bp.TaxID AS BPTaxID, bp.NAICS, bp.DUNS, - oi.C_Location_ID AS Org_Location_ID, oi.TaxID, - dt.PrintName AS DocumentType, dt.DocumentNote AS DocumentTypeNote, - i.C_Order_ID, i.SalesRep_ID, COALESCE(ubp.Name, u.Name) AS SalesRep_Name, - i.DateInvoiced, - bpg.Greeting AS BPGreeting, - bp.Name, bp.Name2, - bpcg.Greeting AS BPContactGreeting, - bpc.Title, bpc.Phone, - NULLIF (bpc.Name, bp.Name) AS ContactName, - bpl.C_Location_ID, bp.ReferenceNo, l.Postal || l.Postal_Add AS Postal, - i.Description, - i.POReference, - i.DateOrdered, - i.C_Currency_ID, - pt.Name AS PaymentTerm, pt.DocumentNote AS PaymentTermNote, - i.C_Charge_ID, i.ChargeAmt, - i.TotalLines, - i.GrandTotal, i.GrandTotal AS AmtInWords, - i.M_PriceList_ID, - i.IsTaxIncluded, - i.C_Campaign_ID, - i.C_Project_ID, - i.C_Activity_ID, - i.IsPaid -FROM C_Invoice i - INNER JOIN C_DocType_Trl dt ON (i.C_DocType_ID=dt.C_DocType_ID) - INNER JOIN C_PaymentTerm_Trl pt ON (i.C_PaymentTerm_ID=pt.C_PaymentTerm_ID AND dt.AD_Language=pt.AD_Language) - INNER JOIN C_BPartner bp ON (i.C_BPartner_ID=bp.C_BPartner_ID) - LEFT OUTER JOIN C_Greeting_Trl bpg on (bp.C_Greeting_ID=bpg.C_Greeting_ID AND dt.AD_Language=bpg.AD_Language) - INNER JOIN C_BPartner_Location bpl ON (i.C_BPartner_Location_ID=bpl.C_BPartner_Location_ID) - INNER JOIN C_Location l ON (bpl.C_Location_ID=l.C_Location_ID) - LEFT OUTER JOIN AD_User bpc ON (i.AD_User_ID=bpc.AD_User_ID) - LEFT OUTER JOIN C_Greeting_Trl bpcg on (bpc.C_Greeting_ID=bpcg.C_Greeting_ID AND dt.AD_Language=bpcg.AD_Language) - INNER JOIN AD_OrgInfo oi ON (i.AD_Org_ID=oi.AD_Org_ID) - LEFT OUTER JOIN AD_User u ON (i.SalesRep_ID=u.AD_User_ID) - LEFT OUTER JOIN C_BPartner ubp ON (u.C_BPartner_ID=ubp.C_BPartner_ID); - - - +CREATE OR REPLACE VIEW C_INVOICE_HEADER_VT +(AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, + UPDATED, UPDATEDBY, AD_LANGUAGE, C_INVOICE_ID, ISSOTRX, + DOCUMENTNO, DOCSTATUS, C_DOCTYPE_ID, C_BPARTNER_ID, BPVALUE, + BPTAXID, NAICS, DUNS, ORG_LOCATION_ID, TAXID, + DOCUMENTTYPE, DOCUMENTTYPENOTE, C_ORDER_ID, SALESREP_ID, SALESREP_NAME, + DATEINVOICED, BPGREETING, NAME, NAME2, BPCONTACTGREETING, + TITLE, PHONE, CONTACTNAME, C_LOCATION_ID, REFERENCENO, + POSTAL, DESCRIPTION, POREFERENCE, DATEORDERED, C_CURRENCY_ID, + PAYMENTTERM, PAYMENTTERMNOTE, C_CHARGE_ID, CHARGEAMT, TOTALLINES, + GRANDTOTAL, AMTINWORDS, M_PRICELIST_ID, ISTAXINCLUDED, C_CAMPAIGN_ID, + C_PROJECT_ID, C_ACTIVITY_ID, ISPAID, LOGO_ID) +AS +SELECT i.AD_Client_ID, i.AD_Org_ID, i.IsActive, i.Created, i.CreatedBy, i.Updated, i.UpdatedBy, + dt.AD_Language, + i.C_Invoice_ID, i.IsSOTrx, i.DocumentNo, i.DocStatus, i.C_DocType_ID, + i.C_BPartner_ID, bp.Value AS BPValue, bp.TaxID AS BPTaxID, bp.NAICS, bp.DUNS, + oi.C_Location_ID AS Org_Location_ID, oi.TaxID, + dt.PrintName AS DocumentType, dt.DocumentNote AS DocumentTypeNote, + i.C_Order_ID, i.SalesRep_ID, COALESCE(ubp.Name, u.Name) AS SalesRep_Name, + i.DateInvoiced, + bpg.Greeting AS BPGreeting, + bp.Name, bp.Name2, + bpcg.Greeting AS BPContactGreeting, + bpc.Title, bpc.Phone, + NULLIF (bpc.Name, bp.Name) AS ContactName, + bpl.C_Location_ID, bp.ReferenceNo, l.Postal || l.Postal_Add AS Postal, + i.Description, + i.POReference, + i.DateOrdered, + i.C_Currency_ID, + pt.Name AS PaymentTerm, pt.DocumentNote AS PaymentTermNote, + i.C_Charge_ID, i.ChargeAmt, + i.TotalLines, + i.GrandTotal, i.GrandTotal AS AmtInWords, + i.M_PriceList_ID, + i.IsTaxIncluded, + i.C_Campaign_ID, + i.C_Project_ID, + i.C_Activity_ID, + i.IsPaid, COALESCE(oi.Logo_ID, ci.Logo_ID) AS Logo_ID +FROM C_Invoice i + INNER JOIN C_DocType_Trl dt ON (i.C_DocType_ID=dt.C_DocType_ID) + INNER JOIN C_PaymentTerm_Trl pt ON (i.C_PaymentTerm_ID=pt.C_PaymentTerm_ID AND dt.AD_Language=pt.AD_Language) + INNER JOIN C_BPartner bp ON (i.C_BPartner_ID=bp.C_BPartner_ID) + LEFT OUTER JOIN C_Greeting_Trl bpg on (bp.C_Greeting_ID=bpg.C_Greeting_ID AND dt.AD_Language=bpg.AD_Language) + INNER JOIN C_BPartner_Location bpl ON (i.C_BPartner_Location_ID=bpl.C_BPartner_Location_ID) + INNER JOIN C_Location l ON (bpl.C_Location_ID=l.C_Location_ID) + LEFT OUTER JOIN AD_User bpc ON (i.AD_User_ID=bpc.AD_User_ID) + LEFT OUTER JOIN C_Greeting_Trl bpcg on (bpc.C_Greeting_ID=bpcg.C_Greeting_ID AND dt.AD_Language=bpcg.AD_Language) + INNER JOIN AD_OrgInfo oi ON (i.AD_Org_ID=oi.AD_Org_ID) + INNER JOIN AD_ClientInfo ci ON (i.AD_Client_ID=ci.AD_Client_ID) + LEFT OUTER JOIN AD_User u ON (i.SalesRep_ID=u.AD_User_ID) + LEFT OUTER JOIN C_BPartner ubp ON (u.C_BPartner_ID=ubp.C_BPartner_ID); + + + diff --git a/db/ddlutils/oracle/views/C_ORDER_HEADER_V.sql b/db/ddlutils/oracle/views/C_ORDER_HEADER_V.sql index 57af057993..328bca9392 100644 --- a/db/ddlutils/oracle/views/C_ORDER_HEADER_V.sql +++ b/db/ddlutils/oracle/views/C_ORDER_HEADER_V.sql @@ -1,70 +1,71 @@ -CREATE OR REPLACE VIEW C_ORDER_HEADER_V -(AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, - UPDATED, UPDATEDBY, AD_LANGUAGE, C_ORDER_ID, ISSOTRX, - DOCUMENTNO, DOCSTATUS, C_DOCTYPE_ID, C_BPARTNER_ID, BPVALUE, - BPTAXID, NAICS, DUNS, ORG_LOCATION_ID, TAXID, - M_WAREHOUSE_ID, WAREHOUSE_LOCATION_ID, DOCUMENTTYPE, DOCUMENTTYPENOTE, SALESREP_ID, - SALESREP_NAME, DATEORDERED, DATEPROMISED, BPGREETING, NAME, - NAME2, BPCONTACTGREETING, TITLE, PHONE, CONTACTNAME, - C_LOCATION_ID, POSTAL, REFERENCENO, BILL_BPARTNER_ID, BILL_LOCATION_ID, - BILL_USER_ID, BILL_BPVALUE, BILL_BPTAXID, BILL_NAME, BILL_NAME2, - BILL_TITLE, BILL_PHONE, BILL_CONTACTNAME, BILL_C_LOCATION_ID, DESCRIPTION, - POREFERENCE, C_CURRENCY_ID, PAYMENTTERM, PAYMENTTERMNOTE, C_CHARGE_ID, - CHARGEAMT, TOTALLINES, GRANDTOTAL, AMTINWORDS, M_PRICELIST_ID, - ISTAXINCLUDED, VOLUME, WEIGHT, C_CAMPAIGN_ID, C_PROJECT_ID, - C_ACTIVITY_ID, M_SHIPPER_ID, DELIVERYRULE, DELIVERYVIARULE, PRIORITYRULE, - INVOICERULE) -AS -SELECT o.AD_Client_ID, o.AD_Org_ID, o.IsActive, o.Created, o.CreatedBy, o.Updated, o.UpdatedBy, - cast('en_US' as varchar2(6)) AS AD_Language, - o.C_Order_ID, o.IsSOTrx, o.DocumentNo, o.DocStatus, o.C_DocType_ID, - o.C_BPartner_ID, bp.Value AS BPValue, bp.TaxID AS BPTaxID, bp.NAICS, bp.DUNS, - oi.C_Location_ID AS Org_Location_ID, oi.TaxID, - o.M_Warehouse_ID, wh.C_Location_ID AS Warehouse_Location_ID, - dt.PrintName AS DocumentType, dt.DocumentNote AS DocumentTypeNote, - o.SalesRep_ID, COALESCE(ubp.Name, u.Name) AS SalesRep_Name, - o.DateOrdered, o.DatePromised, - bpg.Greeting AS BPGreeting, - bp.Name, bp.Name2, - bpcg.Greeting AS BPContactGreeting, - bpc.Title, bpc.Phone, - NULLIF (bpc.Name, bp.Name) AS ContactName, - bpl.C_Location_ID, l.Postal || l.Postal_Add AS Postal, - bp.ReferenceNo, - -- Bill to - o.Bill_BPartner_ID, o.Bill_Location_ID, o.Bill_User_ID, - bbp.Value AS Bill_BPValue, bbp.TaxID AS Bill_BPTaxID, - bbp.Name AS Bill_Name, bbp.Name2 AS Bill_Name2, - bbpc.Title AS Bill_Title, bbpc.Phone AS Bill_Phone, - NULLIF (bbpc.Name, bbp.Name) AS Bill_ContactName, - bbpl.C_Location_ID AS Bill_C_Location_ID, - o.Description, - o.POReference, - o.C_Currency_ID, - pt.Name AS PaymentTerm, pt.DocumentNote AS PaymentTermNote, - o.C_Charge_ID, o.ChargeAmt, - o.TotalLines, - o.GrandTotal, o.GrandTotal AS AmtInWords, - o.M_PriceList_ID, - o.IsTaxIncluded, o.Volume, o.Weight, - o.C_Campaign_ID, o.C_Project_ID, o.C_Activity_ID, - o.M_Shipper_ID, o.DeliveryRule, o.DeliveryViaRule, o.PriorityRule, o.InvoiceRule -FROM C_Order o - INNER JOIN C_DocType dt ON (o.C_DocType_ID=dt.C_DocType_ID) - INNER JOIN M_Warehouse wh ON (o.M_Warehouse_ID=wh.M_Warehouse_ID) - INNER JOIN C_PaymentTerm pt ON (o.C_PaymentTerm_ID=pt.C_PaymentTerm_ID) - INNER JOIN C_BPartner bp ON (o.C_BPartner_ID=bp.C_BPartner_ID) - LEFT OUTER JOIN C_Greeting bpg ON (bp.C_Greeting_ID=bpg.C_Greeting_ID) - INNER JOIN C_BPartner_Location bpl ON (o.C_BPartner_Location_ID=bpl.C_BPartner_Location_ID) - INNER JOIN C_Location l ON (bpl.C_Location_ID=l.C_Location_ID) - LEFT OUTER JOIN AD_User bpc ON (o.AD_User_ID=bpc.AD_User_ID) - LEFT OUTER JOIN C_Greeting bpcg ON (bpc.C_Greeting_ID=bpcg.C_Greeting_ID) - INNER JOIN AD_OrgInfo oi ON (o.AD_Org_ID=oi.AD_Org_ID) - LEFT OUTER JOIN AD_User u ON (o.SalesRep_ID=u.AD_User_ID) - LEFT OUTER JOIN C_BPartner ubp ON (u.C_BPartner_ID=ubp.C_BPartner_ID) - INNER JOIN C_BPartner bbp ON (o.Bill_BPartner_ID=bbp.C_BPartner_ID) - INNER JOIN C_BPartner_Location bbpl ON (o.Bill_Location_ID=bbpl.C_BPartner_Location_ID) - LEFT OUTER JOIN AD_User bbpc ON (o.Bill_User_ID=bbpc.AD_User_ID); - - - +CREATE OR REPLACE VIEW C_ORDER_HEADER_V +(AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, + UPDATED, UPDATEDBY, AD_LANGUAGE, C_ORDER_ID, ISSOTRX, + DOCUMENTNO, DOCSTATUS, C_DOCTYPE_ID, C_BPARTNER_ID, BPVALUE, + BPTAXID, NAICS, DUNS, ORG_LOCATION_ID, TAXID, + M_WAREHOUSE_ID, WAREHOUSE_LOCATION_ID, DOCUMENTTYPE, DOCUMENTTYPENOTE, SALESREP_ID, + SALESREP_NAME, DATEORDERED, DATEPROMISED, BPGREETING, NAME, + NAME2, BPCONTACTGREETING, TITLE, PHONE, CONTACTNAME, + C_LOCATION_ID, POSTAL, REFERENCENO, BILL_BPARTNER_ID, BILL_LOCATION_ID, + BILL_USER_ID, BILL_BPVALUE, BILL_BPTAXID, BILL_NAME, BILL_NAME2, + BILL_TITLE, BILL_PHONE, BILL_CONTACTNAME, BILL_C_LOCATION_ID, DESCRIPTION, + POREFERENCE, C_CURRENCY_ID, PAYMENTTERM, PAYMENTTERMNOTE, C_CHARGE_ID, + CHARGEAMT, TOTALLINES, GRANDTOTAL, AMTINWORDS, M_PRICELIST_ID, + ISTAXINCLUDED, VOLUME, WEIGHT, C_CAMPAIGN_ID, C_PROJECT_ID, + C_ACTIVITY_ID, M_SHIPPER_ID, DELIVERYRULE, DELIVERYVIARULE, PRIORITYRULE, + INVOICERULE, LOGO_ID) +AS +SELECT o.AD_Client_ID, o.AD_Org_ID, o.IsActive, o.Created, o.CreatedBy, o.Updated, o.UpdatedBy, + cast('en_US' as varchar2(6)) AS AD_Language, + o.C_Order_ID, o.IsSOTrx, o.DocumentNo, o.DocStatus, o.C_DocType_ID, + o.C_BPartner_ID, bp.Value AS BPValue, bp.TaxID AS BPTaxID, bp.NAICS, bp.DUNS, + oi.C_Location_ID AS Org_Location_ID, oi.TaxID, + o.M_Warehouse_ID, wh.C_Location_ID AS Warehouse_Location_ID, + dt.PrintName AS DocumentType, dt.DocumentNote AS DocumentTypeNote, + o.SalesRep_ID, COALESCE(ubp.Name, u.Name) AS SalesRep_Name, + o.DateOrdered, o.DatePromised, + bpg.Greeting AS BPGreeting, + bp.Name, bp.Name2, + bpcg.Greeting AS BPContactGreeting, + bpc.Title, bpc.Phone, + NULLIF (bpc.Name, bp.Name) AS ContactName, + bpl.C_Location_ID, l.Postal || l.Postal_Add AS Postal, + bp.ReferenceNo, + -- Bill to + o.Bill_BPartner_ID, o.Bill_Location_ID, o.Bill_User_ID, + bbp.Value AS Bill_BPValue, bbp.TaxID AS Bill_BPTaxID, + bbp.Name AS Bill_Name, bbp.Name2 AS Bill_Name2, + bbpc.Title AS Bill_Title, bbpc.Phone AS Bill_Phone, + NULLIF (bbpc.Name, bbp.Name) AS Bill_ContactName, + bbpl.C_Location_ID AS Bill_C_Location_ID, + o.Description, + o.POReference, + o.C_Currency_ID, + pt.Name AS PaymentTerm, pt.DocumentNote AS PaymentTermNote, + o.C_Charge_ID, o.ChargeAmt, + o.TotalLines, + o.GrandTotal, o.GrandTotal AS AmtInWords, + o.M_PriceList_ID, + o.IsTaxIncluded, o.Volume, o.Weight, + o.C_Campaign_ID, o.C_Project_ID, o.C_Activity_ID, + o.M_Shipper_ID, o.DeliveryRule, o.DeliveryViaRule, o.PriorityRule, o.InvoiceRule, COALESCE(oi.Logo_ID, ci.Logo_ID) AS Logo_ID +FROM C_Order o + INNER JOIN C_DocType dt ON (o.C_DocType_ID=dt.C_DocType_ID) + INNER JOIN M_Warehouse wh ON (o.M_Warehouse_ID=wh.M_Warehouse_ID) + INNER JOIN C_PaymentTerm pt ON (o.C_PaymentTerm_ID=pt.C_PaymentTerm_ID) + INNER JOIN C_BPartner bp ON (o.C_BPartner_ID=bp.C_BPartner_ID) + LEFT OUTER JOIN C_Greeting bpg ON (bp.C_Greeting_ID=bpg.C_Greeting_ID) + INNER JOIN C_BPartner_Location bpl ON (o.C_BPartner_Location_ID=bpl.C_BPartner_Location_ID) + INNER JOIN C_Location l ON (bpl.C_Location_ID=l.C_Location_ID) + LEFT OUTER JOIN AD_User bpc ON (o.AD_User_ID=bpc.AD_User_ID) + LEFT OUTER JOIN C_Greeting bpcg ON (bpc.C_Greeting_ID=bpcg.C_Greeting_ID) + INNER JOIN AD_OrgInfo oi ON (o.AD_Org_ID=oi.AD_Org_ID) + INNER JOIN AD_ClientInfo ci ON (o.AD_Client_ID=ci.AD_Client_ID) + LEFT OUTER JOIN AD_User u ON (o.SalesRep_ID=u.AD_User_ID) + LEFT OUTER JOIN C_BPartner ubp ON (u.C_BPartner_ID=ubp.C_BPartner_ID) + INNER JOIN C_BPartner bbp ON (o.Bill_BPartner_ID=bbp.C_BPartner_ID) + INNER JOIN C_BPartner_Location bbpl ON (o.Bill_Location_ID=bbpl.C_BPartner_Location_ID) + LEFT OUTER JOIN AD_User bbpc ON (o.Bill_User_ID=bbpc.AD_User_ID); + + + diff --git a/db/ddlutils/oracle/views/C_ORDER_HEADER_VT.sql b/db/ddlutils/oracle/views/C_ORDER_HEADER_VT.sql index b4c1fa7ebc..9ecfea4b6e 100644 --- a/db/ddlutils/oracle/views/C_ORDER_HEADER_VT.sql +++ b/db/ddlutils/oracle/views/C_ORDER_HEADER_VT.sql @@ -1,70 +1,71 @@ -CREATE OR REPLACE VIEW C_ORDER_HEADER_VT -(AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, - UPDATED, UPDATEDBY, AD_LANGUAGE, C_ORDER_ID, ISSOTRX, - DOCUMENTNO, DOCSTATUS, C_DOCTYPE_ID, C_BPARTNER_ID, BPVALUE, - BPTAXID, NAICS, DUNS, ORG_LOCATION_ID, TAXID, - M_WAREHOUSE_ID, WAREHOUSE_LOCATION_ID, DOCUMENTTYPE, DOCUMENTTYPENOTE, SALESREP_ID, - SALESREP_NAME, DATEORDERED, DATEPROMISED, BPGREETING, NAME, - NAME2, BPCONTACTGREETING, TITLE, PHONE, CONTACTNAME, - C_LOCATION_ID, POSTAL, REFERENCENO, BILL_BPARTNER_ID, BILL_LOCATION_ID, - BILL_USER_ID, BILL_BPVALUE, BILL_BPTAXID, BILL_NAME, BILL_NAME2, - BILL_TITLE, BILL_PHONE, BILL_CONTACTNAME, BILL_C_LOCATION_ID, DESCRIPTION, - POREFERENCE, C_CURRENCY_ID, PAYMENTTERM, PAYMENTTERMNOTE, C_CHARGE_ID, - CHARGEAMT, TOTALLINES, GRANDTOTAL, AMTINWORDS, M_PRICELIST_ID, - ISTAXINCLUDED, VOLUME, WEIGHT, C_CAMPAIGN_ID, C_PROJECT_ID, - C_ACTIVITY_ID, M_SHIPPER_ID, DELIVERYRULE, DELIVERYVIARULE, PRIORITYRULE, - INVOICERULE) -AS -SELECT o.AD_Client_ID, o.AD_Org_ID, o.IsActive, o.Created, o.CreatedBy, o.Updated, o.UpdatedBy, - dt.AD_Language, - o.C_Order_ID, o.IsSOTrx, o.DocumentNo, o.DocStatus, o.C_DocType_ID, - o.C_BPartner_ID, bp.Value AS BPValue, bp.TaxID AS BPTaxID, bp.NAICS, bp.DUNS, - oi.C_Location_ID AS Org_Location_ID, oi.TaxID, - o.M_Warehouse_ID, wh.C_Location_ID AS Warehouse_Location_ID, - dt.PrintName AS DocumentType, dt.DocumentNote AS DocumentTypeNote, - o.SalesRep_ID, COALESCE(ubp.Name, u.Name) AS SalesRep_Name, - o.DateOrdered, o.DatePromised, - bpg.Greeting AS BPGreeting, - bp.Name, bp.Name2, - bpcg.Greeting AS BPContactGreeting, - bpc.Title, bpc.Phone, - NULLIF (bpc.Name, bp.Name) AS ContactName, - bpl.C_Location_ID, l.Postal || l.Postal_Add AS Postal, - bp.ReferenceNo, - -- Bill to - o.Bill_BPartner_ID, o.Bill_Location_ID, o.Bill_User_ID, - bbp.Value AS Bill_BPValue, bbp.TaxID AS Bill_BPTaxID, - bbp.Name AS Bill_Name, bbp.Name2 AS Bill_Name2, - bbpc.Title AS Bill_Title, bbpc.Phone AS Bill_Phone, - NULLIF (bbpc.Name, bbp.Name) AS Bill_ContactName, - bbpl.C_Location_ID AS Bill_C_Location_ID, - o.Description, - o.POReference, - o.C_Currency_ID, - pt.Name AS PaymentTerm, pt.DocumentNote AS PaymentTermNote, - o.C_Charge_ID, o.ChargeAmt, - o.TotalLines, - o.GrandTotal, o.GrandTotal AS AmtInWords, - o.M_PriceList_ID, - o.IsTaxIncluded, o.Volume, o.Weight, - o.C_Campaign_ID, o.C_Project_ID, o.C_Activity_ID, - o.M_Shipper_ID, o.DeliveryRule, o.DeliveryViaRule, o.PriorityRule, o.InvoiceRule -FROM C_Order o - INNER JOIN C_DocType_Trl dt ON (o.C_DocType_ID=dt.C_DocType_ID) - INNER JOIN M_Warehouse wh ON (o.M_Warehouse_ID=wh.M_Warehouse_ID) - INNER JOIN C_PaymentTerm_Trl pt ON (o.C_PaymentTerm_ID=pt.C_PaymentTerm_ID AND dt.AD_Language=pt.AD_Language) - INNER JOIN C_BPartner bp ON (o.C_BPartner_ID=bp.C_BPartner_ID) - LEFT OUTER JOIN C_Greeting_Trl bpg ON (bp.C_Greeting_ID=bpg.C_Greeting_ID AND dt.AD_Language=bpg.AD_Language) - INNER JOIN C_BPartner_Location bpl ON (o.C_BPartner_Location_ID=bpl.C_BPartner_Location_ID) - INNER JOIN C_Location l ON (bpl.C_Location_ID=l.C_Location_ID) - LEFT OUTER JOIN AD_User bpc ON (o.AD_User_ID=bpc.AD_User_ID) - LEFT OUTER JOIN C_Greeting_Trl bpcg ON (bpc.C_Greeting_ID=bpcg.C_Greeting_ID AND dt.AD_Language=bpcg.AD_Language) - INNER JOIN AD_OrgInfo oi ON (o.AD_Org_ID=oi.AD_Org_ID) - LEFT OUTER JOIN AD_User u ON (o.SalesRep_ID=u.AD_User_ID) - LEFT OUTER JOIN C_BPartner ubp ON (u.C_BPartner_ID=ubp.C_BPartner_ID) - INNER JOIN C_BPartner bbp ON (o.Bill_BPartner_ID=bbp.C_BPartner_ID) - INNER JOIN C_BPartner_Location bbpl ON (o.Bill_Location_ID=bbpl.C_BPartner_Location_ID) - LEFT OUTER JOIN AD_User bbpc ON (o.Bill_User_ID=bbpc.AD_User_ID); - - - +CREATE OR REPLACE VIEW C_ORDER_HEADER_VT +(AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, + UPDATED, UPDATEDBY, AD_LANGUAGE, C_ORDER_ID, ISSOTRX, + DOCUMENTNO, DOCSTATUS, C_DOCTYPE_ID, C_BPARTNER_ID, BPVALUE, + BPTAXID, NAICS, DUNS, ORG_LOCATION_ID, TAXID, + M_WAREHOUSE_ID, WAREHOUSE_LOCATION_ID, DOCUMENTTYPE, DOCUMENTTYPENOTE, SALESREP_ID, + SALESREP_NAME, DATEORDERED, DATEPROMISED, BPGREETING, NAME, + NAME2, BPCONTACTGREETING, TITLE, PHONE, CONTACTNAME, + C_LOCATION_ID, POSTAL, REFERENCENO, BILL_BPARTNER_ID, BILL_LOCATION_ID, + BILL_USER_ID, BILL_BPVALUE, BILL_BPTAXID, BILL_NAME, BILL_NAME2, + BILL_TITLE, BILL_PHONE, BILL_CONTACTNAME, BILL_C_LOCATION_ID, DESCRIPTION, + POREFERENCE, C_CURRENCY_ID, PAYMENTTERM, PAYMENTTERMNOTE, C_CHARGE_ID, + CHARGEAMT, TOTALLINES, GRANDTOTAL, AMTINWORDS, M_PRICELIST_ID, + ISTAXINCLUDED, VOLUME, WEIGHT, C_CAMPAIGN_ID, C_PROJECT_ID, + C_ACTIVITY_ID, M_SHIPPER_ID, DELIVERYRULE, DELIVERYVIARULE, PRIORITYRULE, + INVOICERULE, LOGO_ID) +AS +SELECT o.AD_Client_ID, o.AD_Org_ID, o.IsActive, o.Created, o.CreatedBy, o.Updated, o.UpdatedBy, + dt.AD_Language, + o.C_Order_ID, o.IsSOTrx, o.DocumentNo, o.DocStatus, o.C_DocType_ID, + o.C_BPartner_ID, bp.Value AS BPValue, bp.TaxID AS BPTaxID, bp.NAICS, bp.DUNS, + oi.C_Location_ID AS Org_Location_ID, oi.TaxID, + o.M_Warehouse_ID, wh.C_Location_ID AS Warehouse_Location_ID, + dt.PrintName AS DocumentType, dt.DocumentNote AS DocumentTypeNote, + o.SalesRep_ID, COALESCE(ubp.Name, u.Name) AS SalesRep_Name, + o.DateOrdered, o.DatePromised, + bpg.Greeting AS BPGreeting, + bp.Name, bp.Name2, + bpcg.Greeting AS BPContactGreeting, + bpc.Title, bpc.Phone, + NULLIF (bpc.Name, bp.Name) AS ContactName, + bpl.C_Location_ID, l.Postal || l.Postal_Add AS Postal, + bp.ReferenceNo, + -- Bill to + o.Bill_BPartner_ID, o.Bill_Location_ID, o.Bill_User_ID, + bbp.Value AS Bill_BPValue, bbp.TaxID AS Bill_BPTaxID, + bbp.Name AS Bill_Name, bbp.Name2 AS Bill_Name2, + bbpc.Title AS Bill_Title, bbpc.Phone AS Bill_Phone, + NULLIF (bbpc.Name, bbp.Name) AS Bill_ContactName, + bbpl.C_Location_ID AS Bill_C_Location_ID, + o.Description, + o.POReference, + o.C_Currency_ID, + pt.Name AS PaymentTerm, pt.DocumentNote AS PaymentTermNote, + o.C_Charge_ID, o.ChargeAmt, + o.TotalLines, + o.GrandTotal, o.GrandTotal AS AmtInWords, + o.M_PriceList_ID, + o.IsTaxIncluded, o.Volume, o.Weight, + o.C_Campaign_ID, o.C_Project_ID, o.C_Activity_ID, + o.M_Shipper_ID, o.DeliveryRule, o.DeliveryViaRule, o.PriorityRule, o.InvoiceRule, COALESCE(oi.Logo_ID, ci.Logo_ID) AS Logo_ID +FROM C_Order o + INNER JOIN C_DocType_Trl dt ON (o.C_DocType_ID=dt.C_DocType_ID) + INNER JOIN M_Warehouse wh ON (o.M_Warehouse_ID=wh.M_Warehouse_ID) + INNER JOIN C_PaymentTerm_Trl pt ON (o.C_PaymentTerm_ID=pt.C_PaymentTerm_ID AND dt.AD_Language=pt.AD_Language) + INNER JOIN C_BPartner bp ON (o.C_BPartner_ID=bp.C_BPartner_ID) + LEFT OUTER JOIN C_Greeting_Trl bpg ON (bp.C_Greeting_ID=bpg.C_Greeting_ID AND dt.AD_Language=bpg.AD_Language) + INNER JOIN C_BPartner_Location bpl ON (o.C_BPartner_Location_ID=bpl.C_BPartner_Location_ID) + INNER JOIN C_Location l ON (bpl.C_Location_ID=l.C_Location_ID) + LEFT OUTER JOIN AD_User bpc ON (o.AD_User_ID=bpc.AD_User_ID) + LEFT OUTER JOIN C_Greeting_Trl bpcg ON (bpc.C_Greeting_ID=bpcg.C_Greeting_ID AND dt.AD_Language=bpcg.AD_Language) + INNER JOIN AD_OrgInfo oi ON (o.AD_Org_ID=oi.AD_Org_ID) + INNER JOIN AD_ClientInfo ci ON (o.AD_Client_ID=ci.AD_Client_ID) + LEFT OUTER JOIN AD_User u ON (o.SalesRep_ID=u.AD_User_ID) + LEFT OUTER JOIN C_BPartner ubp ON (u.C_BPartner_ID=ubp.C_BPartner_ID) + INNER JOIN C_BPartner bbp ON (o.Bill_BPartner_ID=bbp.C_BPartner_ID) + INNER JOIN C_BPartner_Location bbpl ON (o.Bill_Location_ID=bbpl.C_BPartner_Location_ID) + LEFT OUTER JOIN AD_User bbpc ON (o.Bill_User_ID=bbpc.AD_User_ID); + + + diff --git a/db/ddlutils/oracle/views/C_PROJECT_HEADER_V.sql b/db/ddlutils/oracle/views/C_PROJECT_HEADER_V.sql index 773f83e148..d38a8386e5 100644 --- a/db/ddlutils/oracle/views/C_PROJECT_HEADER_V.sql +++ b/db/ddlutils/oracle/views/C_PROJECT_HEADER_V.sql @@ -1,50 +1,51 @@ -CREATE OR REPLACE VIEW C_PROJECT_HEADER_V -(AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, - UPDATED, UPDATEDBY, AD_LANGUAGE, C_PROJECT_ID, VALUE, - PROJECTNAME, DESCRIPTION, NOTE, ISSUMMARY, PROJECTCATEGORY, - ORG_LOCATION_ID, TAXID, C_PROJECTTYPE_ID, PROJECTTYPENAME, C_PHASE_ID, - PROJECTPHASENAME, SALESREP_ID, SALESREP_NAME, C_BPARTNER_ID, BPVALUE, - BPTAXID, NAICS, DUNS, BPGREETING, NAME, - NAME2, BPCONTACTGREETING, TITLE, PHONE, CONTACTNAME, - C_LOCATION_ID, REFERENCENO, PAYMENTTERM, PAYMENTTERMNOTE, POREFERENCE, - C_CURRENCY_ID, M_PRICELIST_VERSION_ID, C_CAMPAIGN_ID, PLANNEDAMT, PLANNEDQTY, - PLANNEDMARGINAMT, INVOICEDAMT, INVOICEDQTY, PROJECTBALANCEAMT, ISCOMMITMENT, - COMMITTEDAMT, COMMITTEDQTY, DATECONTRACT, DATEFINISH, ISCOMMITCEILING, - M_WAREHOUSE_ID) -AS -SELECT p.AD_Client_ID, p.AD_Org_ID, p.IsActive, p.Created, p.CreatedBy, p.Updated, p.UpdatedBy, - cast('en_US' as varchar2(6)) AS AD_Language, p.C_Project_ID, - p.Value, p.Name AS ProjectName, p.Description, p.Note, p.IsSummary, p.ProjectCategory, - oi.C_Location_ID AS Org_Location_ID, oi.TaxID, - p.C_ProjectType_ID, pjt.Name AS ProjectTypeName, p.C_Phase_ID, pjp.Name AS ProjectPhaseName, - p.SalesRep_ID, COALESCE(ubp.Name, u.Name) AS SalesRep_Name, - p.C_BPartner_ID, bp.Value AS BPValue, bp.TaxID AS BPTaxID, bp.NAICS, bp.DUNS, - bpg.Greeting AS BPGreeting, - bp.Name, bp.Name2, - bpcg.Greeting AS BPContactGreeting, - bpc.Title, bpc.Phone, - NULLIF (bpc.Name, bp.Name) AS ContactName, - bpl.C_Location_ID, - bp.ReferenceNo, - pt.Name AS PaymentTerm, pt.DocumentNote AS PaymentTermNote, - p.POReference, - p.C_Currency_ID, p.M_PriceList_Version_ID, - p.C_Campaign_ID, - p.PlannedAmt, p.PlannedQty, p.PlannedMarginAmt, p.InvoicedAmt, p.InvoicedQty, p.ProjectBalanceAmt, - p.IsCommitment, p.CommittedAmt, p.CommittedQty, p.DateContract, p.DateFinish, p.IsCommitCeiling, - p.M_Warehouse_ID -FROM C_Project p - LEFT OUTER JOIN C_BPartner bp ON (p.C_BPartner_ID=bp.C_BPartner_ID) - INNER JOIN AD_OrgInfo oi ON (p.AD_Org_ID=oi.AD_Org_ID) - LEFT OUTER JOIN C_ProjectType pjt ON (p.C_ProjectType_ID=pjt.C_ProjectType_ID) - LEFT OUTER JOIN C_Phase pjp ON (p.C_Phase_ID=pjp.C_Phase_ID) - LEFT OUTER JOIN AD_User u ON (p.SalesRep_ID=u.AD_User_ID) - LEFT OUTER JOIN C_BPartner ubp ON (u.C_BPartner_ID=ubp.C_BPartner_ID) - LEFT OUTER JOIN C_Greeting bpg on (bp.C_Greeting_ID=bpg.C_Greeting_ID) - LEFT OUTER JOIN AD_User bpc ON (p.AD_User_ID=bpc.AD_User_ID) - LEFT OUTER JOIN C_Greeting bpcg on (bpc.C_Greeting_ID=bpcg.C_Greeting_ID) - LEFT OUTER JOIN C_BPartner_Location bpl ON (p.C_BPartner_Location_ID=bpl.C_BPartner_Location_ID) - LEFT OUTER JOIN C_PaymentTerm pt ON (p.C_PaymentTerm_ID=pt.C_PaymentTerm_ID); - - - +CREATE OR REPLACE VIEW C_PROJECT_HEADER_V +(AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, + UPDATED, UPDATEDBY, AD_LANGUAGE, C_PROJECT_ID, VALUE, + PROJECTNAME, DESCRIPTION, NOTE, ISSUMMARY, PROJECTCATEGORY, + ORG_LOCATION_ID, TAXID, C_PROJECTTYPE_ID, PROJECTTYPENAME, C_PHASE_ID, + PROJECTPHASENAME, SALESREP_ID, SALESREP_NAME, C_BPARTNER_ID, BPVALUE, + BPTAXID, NAICS, DUNS, BPGREETING, NAME, + NAME2, BPCONTACTGREETING, TITLE, PHONE, CONTACTNAME, + C_LOCATION_ID, REFERENCENO, PAYMENTTERM, PAYMENTTERMNOTE, POREFERENCE, + C_CURRENCY_ID, M_PRICELIST_VERSION_ID, C_CAMPAIGN_ID, PLANNEDAMT, PLANNEDQTY, + PLANNEDMARGINAMT, INVOICEDAMT, INVOICEDQTY, PROJECTBALANCEAMT, ISCOMMITMENT, + COMMITTEDAMT, COMMITTEDQTY, DATECONTRACT, DATEFINISH, ISCOMMITCEILING, + M_WAREHOUSE_ID, LOGO_ID) +AS +SELECT p.AD_Client_ID, p.AD_Org_ID, p.IsActive, p.Created, p.CreatedBy, p.Updated, p.UpdatedBy, + cast('en_US' as varchar2(6)) AS AD_Language, p.C_Project_ID, + p.Value, p.Name AS ProjectName, p.Description, p.Note, p.IsSummary, p.ProjectCategory, + oi.C_Location_ID AS Org_Location_ID, oi.TaxID, + p.C_ProjectType_ID, pjt.Name AS ProjectTypeName, p.C_Phase_ID, pjp.Name AS ProjectPhaseName, + p.SalesRep_ID, COALESCE(ubp.Name, u.Name) AS SalesRep_Name, + p.C_BPartner_ID, bp.Value AS BPValue, bp.TaxID AS BPTaxID, bp.NAICS, bp.DUNS, + bpg.Greeting AS BPGreeting, + bp.Name, bp.Name2, + bpcg.Greeting AS BPContactGreeting, + bpc.Title, bpc.Phone, + NULLIF (bpc.Name, bp.Name) AS ContactName, + bpl.C_Location_ID, + bp.ReferenceNo, + pt.Name AS PaymentTerm, pt.DocumentNote AS PaymentTermNote, + p.POReference, + p.C_Currency_ID, p.M_PriceList_Version_ID, + p.C_Campaign_ID, + p.PlannedAmt, p.PlannedQty, p.PlannedMarginAmt, p.InvoicedAmt, p.InvoicedQty, p.ProjectBalanceAmt, + p.IsCommitment, p.CommittedAmt, p.CommittedQty, p.DateContract, p.DateFinish, p.IsCommitCeiling, + p.M_Warehouse_ID, COALESCE(oi.Logo_ID, ci.Logo_ID) AS Logo_ID +FROM C_Project p + LEFT OUTER JOIN C_BPartner bp ON (p.C_BPartner_ID=bp.C_BPartner_ID) + INNER JOIN AD_OrgInfo oi ON (p.AD_Org_ID=oi.AD_Org_ID) + INNER JOIN AD_ClientInfo ci ON (p.AD_Client_ID=ci.AD_Client_ID) + LEFT OUTER JOIN C_ProjectType pjt ON (p.C_ProjectType_ID=pjt.C_ProjectType_ID) + LEFT OUTER JOIN C_Phase pjp ON (p.C_Phase_ID=pjp.C_Phase_ID) + LEFT OUTER JOIN AD_User u ON (p.SalesRep_ID=u.AD_User_ID) + LEFT OUTER JOIN C_BPartner ubp ON (u.C_BPartner_ID=ubp.C_BPartner_ID) + LEFT OUTER JOIN C_Greeting bpg on (bp.C_Greeting_ID=bpg.C_Greeting_ID) + LEFT OUTER JOIN AD_User bpc ON (p.AD_User_ID=bpc.AD_User_ID) + LEFT OUTER JOIN C_Greeting bpcg on (bpc.C_Greeting_ID=bpcg.C_Greeting_ID) + LEFT OUTER JOIN C_BPartner_Location bpl ON (p.C_BPartner_Location_ID=bpl.C_BPartner_Location_ID) + LEFT OUTER JOIN C_PaymentTerm pt ON (p.C_PaymentTerm_ID=pt.C_PaymentTerm_ID); + + + diff --git a/db/ddlutils/oracle/views/C_PROJECT_HEADER_VT.sql b/db/ddlutils/oracle/views/C_PROJECT_HEADER_VT.sql index 676c6cfd17..f46e5dd4e9 100644 --- a/db/ddlutils/oracle/views/C_PROJECT_HEADER_VT.sql +++ b/db/ddlutils/oracle/views/C_PROJECT_HEADER_VT.sql @@ -1,50 +1,51 @@ -CREATE OR REPLACE VIEW C_PROJECT_HEADER_VT -(AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, - UPDATED, UPDATEDBY, AD_LANGUAGE, C_PROJECT_ID, VALUE, - PROJECTNAME, DESCRIPTION, NOTE, ISSUMMARY, PROJECTCATEGORY, - ORG_LOCATION_ID, TAXID, C_PROJECTTYPE_ID, PROJECTTYPENAME, C_PHASE_ID, - PROJECTPHASENAME, SALESREP_ID, SALESREP_NAME, C_BPARTNER_ID, BPVALUE, - BPTAXID, NAICS, DUNS, BPGREETING, NAME, - NAME2, BPCONTACTGREETING, TITLE, PHONE, CONTACTNAME, - C_LOCATION_ID, REFERENCENO, PAYMENTTERM, PAYMENTTERMNOTE, POREFERENCE, - C_CURRENCY_ID, M_PRICELIST_VERSION_ID, C_CAMPAIGN_ID, PLANNEDAMT, PLANNEDQTY, - PLANNEDMARGINAMT, INVOICEDAMT, INVOICEDQTY, PROJECTBALANCEAMT, ISCOMMITMENT, - COMMITTEDAMT, COMMITTEDQTY, DATECONTRACT, DATEFINISH, ISCOMMITCEILING, - M_WAREHOUSE_ID) -AS -SELECT p.AD_Client_ID, p.AD_Org_ID, p.IsActive, p.Created, p.CreatedBy, p.Updated, p.UpdatedBy, - pt.AD_Language, p.C_Project_ID, - p.Value, p.Name AS ProjectName, p.Description, p.Note, p.IsSummary, p.ProjectCategory, - oi.C_Location_ID AS Org_Location_ID, oi.TaxID, - p.C_ProjectType_ID, pjt.Name AS ProjectTypeName, p.C_Phase_ID, pjp.Name AS ProjectPhaseName, - p.SalesRep_ID, COALESCE(ubp.Name, u.Name) AS SalesRep_Name, - p.C_BPartner_ID, bp.Value AS BPValue, bp.TaxID AS BPTaxID, bp.NAICS, bp.DUNS, - bpg.Greeting AS BPGreeting, - bp.Name, bp.Name2, - bpcg.Greeting AS BPContactGreeting, - bpc.Title, bpc.Phone, - NULLIF (bpc.Name, bp.Name) AS ContactName, - bpl.C_Location_ID, - bp.ReferenceNo, - pt.Name AS PaymentTerm, pt.DocumentNote AS PaymentTermNote, - p.POReference, - p.C_Currency_ID, p.M_PriceList_Version_ID, - p.C_Campaign_ID, - p.PlannedAmt, p.PlannedQty, p.PlannedMarginAmt, p.InvoicedAmt, p.InvoicedQty, p.ProjectBalanceAmt, - p.IsCommitment, p.CommittedAmt, p.CommittedQty, p.DateContract, p.DateFinish, p.IsCommitCeiling, - p.M_Warehouse_ID -FROM C_Project p - LEFT OUTER JOIN C_BPartner bp ON (p.C_BPartner_ID=bp.C_BPartner_ID) - INNER JOIN AD_OrgInfo oi ON (p.AD_Org_ID=oi.AD_Org_ID) - LEFT OUTER JOIN C_PaymentTerm_Trl pt ON (p.C_PaymentTerm_ID=pt.C_PaymentTerm_ID) - LEFT OUTER JOIN C_ProjectType pjt ON (p.C_ProjectType_ID=pjt.C_ProjectType_ID) - LEFT OUTER JOIN C_Phase pjp ON (p.C_Phase_ID=pjp.C_Phase_ID) - LEFT OUTER JOIN AD_User u ON (p.SalesRep_ID=u.AD_User_ID) - LEFT OUTER JOIN C_BPartner ubp ON (u.C_BPartner_ID=ubp.C_BPartner_ID) - LEFT OUTER JOIN C_Greeting bpg on (bp.C_Greeting_ID=bpg.C_Greeting_ID) - LEFT OUTER JOIN AD_User bpc ON (p.AD_User_ID=bpc.AD_User_ID) - LEFT OUTER JOIN C_Greeting bpcg on (bpc.C_Greeting_ID=bpcg.C_Greeting_ID) - LEFT OUTER JOIN C_BPartner_Location bpl ON (p.C_BPartner_Location_ID=bpl.C_BPartner_Location_ID); - - - +CREATE OR REPLACE VIEW C_PROJECT_HEADER_VT +(AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, + UPDATED, UPDATEDBY, AD_LANGUAGE, C_PROJECT_ID, VALUE, + PROJECTNAME, DESCRIPTION, NOTE, ISSUMMARY, PROJECTCATEGORY, + ORG_LOCATION_ID, TAXID, C_PROJECTTYPE_ID, PROJECTTYPENAME, C_PHASE_ID, + PROJECTPHASENAME, SALESREP_ID, SALESREP_NAME, C_BPARTNER_ID, BPVALUE, + BPTAXID, NAICS, DUNS, BPGREETING, NAME, + NAME2, BPCONTACTGREETING, TITLE, PHONE, CONTACTNAME, + C_LOCATION_ID, REFERENCENO, PAYMENTTERM, PAYMENTTERMNOTE, POREFERENCE, + C_CURRENCY_ID, M_PRICELIST_VERSION_ID, C_CAMPAIGN_ID, PLANNEDAMT, PLANNEDQTY, + PLANNEDMARGINAMT, INVOICEDAMT, INVOICEDQTY, PROJECTBALANCEAMT, ISCOMMITMENT, + COMMITTEDAMT, COMMITTEDQTY, DATECONTRACT, DATEFINISH, ISCOMMITCEILING, + M_WAREHOUSE_ID, LOGO_ID) +AS +SELECT p.AD_Client_ID, p.AD_Org_ID, p.IsActive, p.Created, p.CreatedBy, p.Updated, p.UpdatedBy, + pt.AD_Language, p.C_Project_ID, + p.Value, p.Name AS ProjectName, p.Description, p.Note, p.IsSummary, p.ProjectCategory, + oi.C_Location_ID AS Org_Location_ID, oi.TaxID, + p.C_ProjectType_ID, pjt.Name AS ProjectTypeName, p.C_Phase_ID, pjp.Name AS ProjectPhaseName, + p.SalesRep_ID, COALESCE(ubp.Name, u.Name) AS SalesRep_Name, + p.C_BPartner_ID, bp.Value AS BPValue, bp.TaxID AS BPTaxID, bp.NAICS, bp.DUNS, + bpg.Greeting AS BPGreeting, + bp.Name, bp.Name2, + bpcg.Greeting AS BPContactGreeting, + bpc.Title, bpc.Phone, + NULLIF (bpc.Name, bp.Name) AS ContactName, + bpl.C_Location_ID, + bp.ReferenceNo, + pt.Name AS PaymentTerm, pt.DocumentNote AS PaymentTermNote, + p.POReference, + p.C_Currency_ID, p.M_PriceList_Version_ID, + p.C_Campaign_ID, + p.PlannedAmt, p.PlannedQty, p.PlannedMarginAmt, p.InvoicedAmt, p.InvoicedQty, p.ProjectBalanceAmt, + p.IsCommitment, p.CommittedAmt, p.CommittedQty, p.DateContract, p.DateFinish, p.IsCommitCeiling, + p.M_Warehouse_ID, COALESCE(oi.Logo_ID, ci.Logo_ID) AS Logo_ID +FROM C_Project p + LEFT OUTER JOIN C_BPartner bp ON (p.C_BPartner_ID=bp.C_BPartner_ID) + INNER JOIN AD_OrgInfo oi ON (p.AD_Org_ID=oi.AD_Org_ID) + INNER JOIN AD_ClientInfo ci ON (p.AD_Client_ID=ci.AD_Client_ID) + LEFT OUTER JOIN C_PaymentTerm_Trl pt ON (p.C_PaymentTerm_ID=pt.C_PaymentTerm_ID) + LEFT OUTER JOIN C_ProjectType pjt ON (p.C_ProjectType_ID=pjt.C_ProjectType_ID) + LEFT OUTER JOIN C_Phase pjp ON (p.C_Phase_ID=pjp.C_Phase_ID) + LEFT OUTER JOIN AD_User u ON (p.SalesRep_ID=u.AD_User_ID) + LEFT OUTER JOIN C_BPartner ubp ON (u.C_BPartner_ID=ubp.C_BPartner_ID) + LEFT OUTER JOIN C_Greeting bpg on (bp.C_Greeting_ID=bpg.C_Greeting_ID) + LEFT OUTER JOIN AD_User bpc ON (p.AD_User_ID=bpc.AD_User_ID) + LEFT OUTER JOIN C_Greeting bpcg on (bpc.C_Greeting_ID=bpcg.C_Greeting_ID) + LEFT OUTER JOIN C_BPartner_Location bpl ON (p.C_BPartner_Location_ID=bpl.C_BPartner_Location_ID); + + + diff --git a/db/ddlutils/oracle/views/DD_ORDER_HEADER_V.sql b/db/ddlutils/oracle/views/DD_ORDER_HEADER_V.sql index 1d0acc0075..82274d5183 100644 --- a/db/ddlutils/oracle/views/DD_ORDER_HEADER_V.sql +++ b/db/ddlutils/oracle/views/DD_ORDER_HEADER_V.sql @@ -1,36 +1,37 @@ -CREATE OR REPLACE VIEW DD_ORDER_HEADER_V -AS -SELECT o.AD_Client_ID, o.AD_Org_ID, o.IsActive, o.Created, o.CreatedBy, o.Updated, o.UpdatedBy, - cast('en_US' as varchar2(6)) AS AD_Language, - o.DD_Order_ID,o.C_Order_ID, o.IsSOTrx, o.DocumentNo, o.DocStatus, o.C_DocType_ID, - o.C_BPartner_ID, bp.Value AS BPValue, bp.TaxID AS BPTaxID, bp.NAICS, bp.DUNS, - oi.C_Location_ID AS Org_Location_ID, oi.TaxID, - o.M_Warehouse_ID, wh.C_Location_ID AS Warehouse_Location_ID, - dt.PrintName AS DocumentType, dt.DocumentNote AS DocumentTypeNote, - o.SalesRep_ID, COALESCE(ubp.Name, u.Name) AS SalesRep_Name, - o.DateOrdered, o.DatePromised, - bpg.Greeting AS BPGreeting, - bp.Name, bp.Name2, - bpcg.Greeting AS BPContactGreeting, - bpc.Title, bpc.Phone, - NULLIF (bpc.Name, bp.Name) AS ContactName, - bpl.C_Location_ID, l.Postal || l.Postal_Add AS Postal, - bp.ReferenceNo, - o.Description, - o.POReference, +CREATE OR REPLACE VIEW DD_ORDER_HEADER_V +AS +SELECT o.AD_Client_ID, o.AD_Org_ID, o.IsActive, o.Created, o.CreatedBy, o.Updated, o.UpdatedBy, + cast('en_US' as varchar2(6)) AS AD_Language, + o.DD_Order_ID,o.C_Order_ID, o.IsSOTrx, o.DocumentNo, o.DocStatus, o.C_DocType_ID, + o.C_BPartner_ID, bp.Value AS BPValue, bp.TaxID AS BPTaxID, bp.NAICS, bp.DUNS, + oi.C_Location_ID AS Org_Location_ID, oi.TaxID, + o.M_Warehouse_ID, wh.C_Location_ID AS Warehouse_Location_ID, + dt.PrintName AS DocumentType, dt.DocumentNote AS DocumentTypeNote, + o.SalesRep_ID, COALESCE(ubp.Name, u.Name) AS SalesRep_Name, + o.DateOrdered, o.DatePromised, + bpg.Greeting AS BPGreeting, + bp.Name, bp.Name2, + bpcg.Greeting AS BPContactGreeting, + bpc.Title, bpc.Phone, + NULLIF (bpc.Name, bp.Name) AS ContactName, + bpl.C_Location_ID, l.Postal || l.Postal_Add AS Postal, + bp.ReferenceNo, + o.Description, + o.POReference, o.C_Charge_ID, o.ChargeAmt, - o.Volume, o.Weight, - o.C_Campaign_ID, o.C_Project_ID, o.C_Activity_ID, - o.M_Shipper_ID, o.DeliveryRule, o.DeliveryViaRule, o.PriorityRule -FROM DD_Order o - INNER JOIN C_DocType dt ON (o.C_DocType_ID=dt.C_DocType_ID) - INNER JOIN M_Warehouse wh ON (o.M_Warehouse_ID=wh.M_Warehouse_ID) - INNER JOIN C_BPartner bp ON (o.C_BPartner_ID=bp.C_BPartner_ID) - LEFT OUTER JOIN C_Greeting bpg ON (bp.C_Greeting_ID=bpg.C_Greeting_ID) - INNER JOIN C_BPartner_Location bpl ON (o.C_BPartner_Location_ID=bpl.C_BPartner_Location_ID) - INNER JOIN C_Location l ON (bpl.C_Location_ID=l.C_Location_ID) - LEFT OUTER JOIN AD_User bpc ON (o.AD_User_ID=bpc.AD_User_ID) - LEFT OUTER JOIN C_Greeting bpcg ON (bpc.C_Greeting_ID=bpcg.C_Greeting_ID) - INNER JOIN AD_OrgInfo oi ON (o.AD_Org_ID=oi.AD_Org_ID) - LEFT OUTER JOIN AD_User u ON (o.SalesRep_ID=u.AD_User_ID) - LEFT OUTER JOIN C_BPartner ubp ON (u.C_BPartner_ID=ubp.C_BPartner_ID); + o.Volume, o.Weight, + o.C_Campaign_ID, o.C_Project_ID, o.C_Activity_ID, + o.M_Shipper_ID, o.DeliveryRule, o.DeliveryViaRule, o.PriorityRule, COALESCE(oi.Logo_ID, ci.Logo_ID) AS Logo_ID +FROM DD_Order o + INNER JOIN C_DocType dt ON (o.C_DocType_ID=dt.C_DocType_ID) + INNER JOIN M_Warehouse wh ON (o.M_Warehouse_ID=wh.M_Warehouse_ID) + INNER JOIN C_BPartner bp ON (o.C_BPartner_ID=bp.C_BPartner_ID) + LEFT OUTER JOIN C_Greeting bpg ON (bp.C_Greeting_ID=bpg.C_Greeting_ID) + INNER JOIN C_BPartner_Location bpl ON (o.C_BPartner_Location_ID=bpl.C_BPartner_Location_ID) + INNER JOIN C_Location l ON (bpl.C_Location_ID=l.C_Location_ID) + LEFT OUTER JOIN AD_User bpc ON (o.AD_User_ID=bpc.AD_User_ID) + LEFT OUTER JOIN C_Greeting bpcg ON (bpc.C_Greeting_ID=bpcg.C_Greeting_ID) + INNER JOIN AD_OrgInfo oi ON (o.AD_Org_ID=oi.AD_Org_ID) + INNER JOIN AD_ClientInfo ci ON (o.AD_Client_ID=ci.AD_Client_ID) + LEFT OUTER JOIN AD_User u ON (o.SalesRep_ID=u.AD_User_ID) + LEFT OUTER JOIN C_BPartner ubp ON (u.C_BPartner_ID=ubp.C_BPartner_ID); diff --git a/db/ddlutils/oracle/views/DD_ORDER_HEADER_VT.sql b/db/ddlutils/oracle/views/DD_ORDER_HEADER_VT.sql index 7b33eba02b..6a9169df49 100644 --- a/db/ddlutils/oracle/views/DD_ORDER_HEADER_VT.sql +++ b/db/ddlutils/oracle/views/DD_ORDER_HEADER_VT.sql @@ -1,40 +1,41 @@ -CREATE OR REPLACE VIEW DD_ORDER_HEADER_VT -AS -SELECT o.AD_Client_ID, o.AD_Org_ID, o.IsActive, o.Created, o.CreatedBy, o.Updated, o.UpdatedBy, - dt.AD_Language,o.DD_Order_ID, - o.C_Order_ID, o.IsSOTrx, o.DocumentNo, o.DocStatus, o.C_DocType_ID, - o.C_BPartner_ID, bp.Value AS BPValue, bp.TaxID AS BPTaxID, bp.NAICS, bp.DUNS, - oi.C_Location_ID AS Org_Location_ID, oi.TaxID, - o.M_Warehouse_ID, wh.C_Location_ID AS Warehouse_Location_ID, - dt.PrintName AS DocumentType, dt.DocumentNote AS DocumentTypeNote, - o.SalesRep_ID, COALESCE(ubp.Name, u.Name) AS SalesRep_Name, - o.DateOrdered, o.DatePromised, - bpg.Greeting AS BPGreeting, - bp.Name, bp.Name2, - bpcg.Greeting AS BPContactGreeting, - bpc.Title, bpc.Phone, - NULLIF (bpc.Name, bp.Name) AS ContactName, - bpl.C_Location_ID, l.Postal || l.Postal_Add AS Postal, - bp.ReferenceNo, - o.Description, - o.POReference, - o.C_Charge_ID, o.ChargeAmt, - o.Volume, o.Weight, - o.C_Campaign_ID, o.C_Project_ID, o.C_Activity_ID, - o.M_Shipper_ID, o.DeliveryRule, o.DeliveryViaRule, o.PriorityRule -FROM DD_Order o - INNER JOIN C_DocType_Trl dt ON (o.C_DocType_ID=dt.C_DocType_ID) - INNER JOIN M_Warehouse wh ON (o.M_Warehouse_ID=wh.M_Warehouse_ID) - INNER JOIN C_BPartner bp ON (o.C_BPartner_ID=bp.C_BPartner_ID) - LEFT OUTER JOIN C_Greeting_Trl bpg ON (bp.C_Greeting_ID=bpg.C_Greeting_ID AND dt.AD_Language=bpg.AD_Language) - INNER JOIN C_BPartner_Location bpl ON (o.C_BPartner_Location_ID=bpl.C_BPartner_Location_ID) - INNER JOIN C_Location l ON (bpl.C_Location_ID=l.C_Location_ID) - LEFT OUTER JOIN AD_User bpc ON (o.AD_User_ID=bpc.AD_User_ID) - LEFT OUTER JOIN C_Greeting_Trl bpcg ON (bpc.C_Greeting_ID=bpcg.C_Greeting_ID AND dt.AD_Language=bpcg.AD_Language) - INNER JOIN AD_OrgInfo oi ON (o.AD_Org_ID=oi.AD_Org_ID) - LEFT OUTER JOIN AD_User u ON (o.SalesRep_ID=u.AD_User_ID) - LEFT OUTER JOIN C_BPartner ubp ON (u.C_BPartner_ID=ubp.C_BPartner_ID); - - - - +CREATE OR REPLACE VIEW DD_ORDER_HEADER_VT +AS +SELECT o.AD_Client_ID, o.AD_Org_ID, o.IsActive, o.Created, o.CreatedBy, o.Updated, o.UpdatedBy, + dt.AD_Language,o.DD_Order_ID, + o.C_Order_ID, o.IsSOTrx, o.DocumentNo, o.DocStatus, o.C_DocType_ID, + o.C_BPartner_ID, bp.Value AS BPValue, bp.TaxID AS BPTaxID, bp.NAICS, bp.DUNS, + oi.C_Location_ID AS Org_Location_ID, oi.TaxID, + o.M_Warehouse_ID, wh.C_Location_ID AS Warehouse_Location_ID, + dt.PrintName AS DocumentType, dt.DocumentNote AS DocumentTypeNote, + o.SalesRep_ID, COALESCE(ubp.Name, u.Name) AS SalesRep_Name, + o.DateOrdered, o.DatePromised, + bpg.Greeting AS BPGreeting, + bp.Name, bp.Name2, + bpcg.Greeting AS BPContactGreeting, + bpc.Title, bpc.Phone, + NULLIF (bpc.Name, bp.Name) AS ContactName, + bpl.C_Location_ID, l.Postal || l.Postal_Add AS Postal, + bp.ReferenceNo, + o.Description, + o.POReference, + o.C_Charge_ID, o.ChargeAmt, + o.Volume, o.Weight, + o.C_Campaign_ID, o.C_Project_ID, o.C_Activity_ID, + o.M_Shipper_ID, o.DeliveryRule, o.DeliveryViaRule, o.PriorityRule, COALESCE(oi.Logo_ID, ci.Logo_ID) AS Logo_ID +FROM DD_Order o + INNER JOIN C_DocType_Trl dt ON (o.C_DocType_ID=dt.C_DocType_ID) + INNER JOIN M_Warehouse wh ON (o.M_Warehouse_ID=wh.M_Warehouse_ID) + INNER JOIN C_BPartner bp ON (o.C_BPartner_ID=bp.C_BPartner_ID) + LEFT OUTER JOIN C_Greeting_Trl bpg ON (bp.C_Greeting_ID=bpg.C_Greeting_ID AND dt.AD_Language=bpg.AD_Language) + INNER JOIN C_BPartner_Location bpl ON (o.C_BPartner_Location_ID=bpl.C_BPartner_Location_ID) + INNER JOIN C_Location l ON (bpl.C_Location_ID=l.C_Location_ID) + LEFT OUTER JOIN AD_User bpc ON (o.AD_User_ID=bpc.AD_User_ID) + LEFT OUTER JOIN C_Greeting_Trl bpcg ON (bpc.C_Greeting_ID=bpcg.C_Greeting_ID AND dt.AD_Language=bpcg.AD_Language) + INNER JOIN AD_OrgInfo oi ON (o.AD_Org_ID=oi.AD_Org_ID) + INNER JOIN AD_ClientInfo ci ON (o.AD_Client_ID=ci.AD_Client_ID) + LEFT OUTER JOIN AD_User u ON (o.SalesRep_ID=u.AD_User_ID) + LEFT OUTER JOIN C_BPartner ubp ON (u.C_BPartner_ID=ubp.C_BPartner_ID); + + + + diff --git a/db/ddlutils/oracle/views/M_INOUT_HEADER_V.sql b/db/ddlutils/oracle/views/M_INOUT_HEADER_V.sql index 8a5a36d5fa..68c5fc3e5b 100644 --- a/db/ddlutils/oracle/views/M_INOUT_HEADER_V.sql +++ b/db/ddlutils/oracle/views/M_INOUT_HEADER_V.sql @@ -1,45 +1,46 @@ -CREATE OR REPLACE VIEW M_INOUT_HEADER_V -(AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, - UPDATED, UPDATEDBY, AD_LANGUAGE, M_INOUT_ID, ISSOTRX, - DOCUMENTNO, DOCSTATUS, C_DOCTYPE_ID, C_BPARTNER_ID, BPVALUE, - BPTAXID, NAICS, DUNS, ORG_LOCATION_ID, TAXID, - M_WAREHOUSE_ID, WAREHOUSE_LOCATION_ID, DOCUMENTTYPE, DOCUMENTTYPENOTE, C_ORDER_ID, - MOVEMENTDATE, MOVEMENTTYPE, BPGREETING, NAME, NAME2, - BPCONTACTGREETING, TITLE, PHONE, CONTACTNAME, C_LOCATION_ID, - POSTAL, REFERENCENO, DESCRIPTION, POREFERENCE, DATEORDERED, - VOLUME, WEIGHT, M_SHIPPER_ID, DELIVERYRULE, DELIVERYVIARULE, - PRIORITYRULE) -AS -SELECT io.AD_Client_ID, io.AD_Org_ID, io.IsActive, io.Created, io.CreatedBy, io.Updated, io.UpdatedBy, - cast('en_US' as varchar2(6)) AS AD_Language, - io.M_InOut_ID, io.IsSOTrx, io.DocumentNo, io.DocStatus, io.C_DocType_ID, - io.C_BPartner_ID, bp.Value AS BPValue, bp.TaxID AS BPTaxID, bp.NAICS, bp.DUNS, - oi.C_Location_ID AS Org_Location_ID, oi.TaxID, - io.M_Warehouse_ID, wh.C_Location_ID AS Warehouse_Location_ID, - dt.PrintName AS DocumentType, dt.DocumentNote AS DocumentTypeNote, - io.C_Order_ID, - io.MovementDate, io.MovementType, - bpg.Greeting AS BPGreeting, - bp.Name, bp.Name2, - bpcg.Greeting AS BPContactGreeting, - bpc.Title, bpc.Phone, - NULLIF (bpc.Name, bp.Name) AS ContactName, - bpl.C_Location_ID, l.Postal || l.Postal_Add AS Postal, - bp.ReferenceNo, - io.Description, - io.POReference, - io.DateOrdered, io.Volume, io.Weight, - io.M_Shipper_ID, io.DeliveryRule, io.DeliveryViaRule, io.PriorityRule -FROM M_InOut io - INNER JOIN C_DocType dt ON (io.C_DocType_ID=dt.C_DocType_ID) - INNER JOIN C_BPartner bp ON (io.C_BPartner_ID=bp.C_BPartner_ID) - LEFT OUTER JOIN C_Greeting bpg ON (bp.C_Greeting_ID=bpg.C_Greeting_ID) - INNER JOIN C_BPartner_Location bpl ON (io.C_BPartner_Location_ID=bpl.C_BPartner_Location_ID) - INNER JOIN C_Location l ON (bpl.C_Location_ID=l.C_Location_ID) - LEFT OUTER JOIN AD_User bpc ON (io.AD_User_ID=bpc.AD_User_ID) - LEFT OUTER JOIN C_Greeting bpcg ON (bpc.C_Greeting_ID=bpcg.C_Greeting_ID) - INNER JOIN AD_OrgInfo oi ON (io.AD_Org_ID=oi.AD_Org_ID) - INNER JOIN M_Warehouse wh ON (io.M_Warehouse_ID=wh.M_Warehouse_ID); - - - +CREATE OR REPLACE VIEW M_INOUT_HEADER_V +(AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, + UPDATED, UPDATEDBY, AD_LANGUAGE, M_INOUT_ID, ISSOTRX, + DOCUMENTNO, DOCSTATUS, C_DOCTYPE_ID, C_BPARTNER_ID, BPVALUE, + BPTAXID, NAICS, DUNS, ORG_LOCATION_ID, TAXID, + M_WAREHOUSE_ID, WAREHOUSE_LOCATION_ID, DOCUMENTTYPE, DOCUMENTTYPENOTE, C_ORDER_ID, + MOVEMENTDATE, MOVEMENTTYPE, BPGREETING, NAME, NAME2, + BPCONTACTGREETING, TITLE, PHONE, CONTACTNAME, C_LOCATION_ID, + POSTAL, REFERENCENO, DESCRIPTION, POREFERENCE, DATEORDERED, + VOLUME, WEIGHT, M_SHIPPER_ID, DELIVERYRULE, DELIVERYVIARULE, + PRIORITYRULE, LOGO_ID) +AS +SELECT io.AD_Client_ID, io.AD_Org_ID, io.IsActive, io.Created, io.CreatedBy, io.Updated, io.UpdatedBy, + cast('en_US' as varchar2(6)) AS AD_Language, + io.M_InOut_ID, io.IsSOTrx, io.DocumentNo, io.DocStatus, io.C_DocType_ID, + io.C_BPartner_ID, bp.Value AS BPValue, bp.TaxID AS BPTaxID, bp.NAICS, bp.DUNS, + oi.C_Location_ID AS Org_Location_ID, oi.TaxID, + io.M_Warehouse_ID, wh.C_Location_ID AS Warehouse_Location_ID, + dt.PrintName AS DocumentType, dt.DocumentNote AS DocumentTypeNote, + io.C_Order_ID, + io.MovementDate, io.MovementType, + bpg.Greeting AS BPGreeting, + bp.Name, bp.Name2, + bpcg.Greeting AS BPContactGreeting, + bpc.Title, bpc.Phone, + NULLIF (bpc.Name, bp.Name) AS ContactName, + bpl.C_Location_ID, l.Postal || l.Postal_Add AS Postal, + bp.ReferenceNo, + io.Description, + io.POReference, + io.DateOrdered, io.Volume, io.Weight, + io.M_Shipper_ID, io.DeliveryRule, io.DeliveryViaRule, io.PriorityRule, COALESCE(oi.Logo_ID, ci.Logo_ID) AS Logo_ID +FROM M_InOut io + INNER JOIN C_DocType dt ON (io.C_DocType_ID=dt.C_DocType_ID) + INNER JOIN C_BPartner bp ON (io.C_BPartner_ID=bp.C_BPartner_ID) + LEFT OUTER JOIN C_Greeting bpg ON (bp.C_Greeting_ID=bpg.C_Greeting_ID) + INNER JOIN C_BPartner_Location bpl ON (io.C_BPartner_Location_ID=bpl.C_BPartner_Location_ID) + INNER JOIN C_Location l ON (bpl.C_Location_ID=l.C_Location_ID) + LEFT OUTER JOIN AD_User bpc ON (io.AD_User_ID=bpc.AD_User_ID) + LEFT OUTER JOIN C_Greeting bpcg ON (bpc.C_Greeting_ID=bpcg.C_Greeting_ID) + INNER JOIN AD_OrgInfo oi ON (io.AD_Org_ID=oi.AD_Org_ID) + INNER JOIN AD_ClientInfo ci ON (io.AD_Client_ID=ci.AD_Client_ID) + INNER JOIN M_Warehouse wh ON (io.M_Warehouse_ID=wh.M_Warehouse_ID); + + + diff --git a/db/ddlutils/oracle/views/M_INOUT_HEADER_VT.sql b/db/ddlutils/oracle/views/M_INOUT_HEADER_VT.sql index c34d7a02bb..8c4b79dad5 100644 --- a/db/ddlutils/oracle/views/M_INOUT_HEADER_VT.sql +++ b/db/ddlutils/oracle/views/M_INOUT_HEADER_VT.sql @@ -1,45 +1,46 @@ -CREATE OR REPLACE VIEW M_INOUT_HEADER_VT -(AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, - UPDATED, UPDATEDBY, AD_LANGUAGE, M_INOUT_ID, ISSOTRX, - DOCUMENTNO, DOCSTATUS, C_DOCTYPE_ID, C_BPARTNER_ID, BPVALUE, - BPTAXID, NAICS, DUNS, ORG_LOCATION_ID, TAXID, - M_WAREHOUSE_ID, WAREHOUSE_LOCATION_ID, DOCUMENTTYPE, DOCUMENTTYPENOTE, C_ORDER_ID, - PHONE, MOVEMENTDATE, MOVEMENTTYPE, BPGREETING, NAME, - NAME2, BPCONTACTGREETING, TITLE, CONTACTNAME, C_LOCATION_ID, - POSTAL, REFERENCENO, DESCRIPTION, POREFERENCE, DATEORDERED, - VOLUME, WEIGHT, M_SHIPPER_ID, DELIVERYRULE, DELIVERYVIARULE, - PRIORITYRULE) -AS -SELECT io.AD_Client_ID, io.AD_Org_ID, io.IsActive, io.Created, io.CreatedBy, io.Updated, io.UpdatedBy, - dt.AD_Language, - io.M_InOut_ID, io.IsSOTrx, io.DocumentNo, io.DocStatus, io.C_DocType_ID, - io.C_BPartner_ID, bp.Value AS BPValue, bp.TaxID AS BPTaxID, bp.NAICS, bp.DUNS, - oi.C_Location_ID AS Org_Location_ID, oi.TaxID, - io.M_Warehouse_ID, wh.C_Location_ID AS Warehouse_Location_ID, - dt.PrintName AS DocumentType, dt.DocumentNote AS DocumentTypeNote, - io.C_Order_ID, bpc.Phone, - io.MovementDate, io.MovementType, - bpg.Greeting AS BPGreeting, - bp.Name, bp.Name2, - bpcg.Greeting AS BPContactGreeting, - bpc.Title, - NULLIF (bpc.Name, bp.Name) AS ContactName, - bpl.C_Location_ID, l.Postal || l.Postal_Add AS Postal, - bp.ReferenceNo, - io.Description, - io.POReference, - io.DateOrdered, io.Volume, io.Weight, - io.M_Shipper_ID, io.DeliveryRule, io.DeliveryViaRule, io.PriorityRule -FROM M_InOut io - INNER JOIN C_DocType_Trl dt ON (io.C_DocType_ID=dt.C_DocType_ID) - INNER JOIN C_BPartner bp ON (io.C_BPartner_ID=bp.C_BPartner_ID) - LEFT OUTER JOIN C_Greeting_Trl bpg ON (bp.C_Greeting_ID=bpg.C_Greeting_ID AND dt.AD_Language=bpg.AD_Language) - INNER JOIN C_BPartner_Location bpl ON (io.C_BPartner_Location_ID=bpl.C_BPartner_Location_ID) - INNER JOIN C_Location l ON (bpl.C_Location_ID=l.C_Location_ID) - LEFT OUTER JOIN AD_User bpc ON (io.AD_User_ID=bpc.AD_User_ID) - LEFT OUTER JOIN C_Greeting_Trl bpcg ON (bpc.C_Greeting_ID=bpcg.C_Greeting_ID AND dt.AD_Language=bpcg.AD_Language) - INNER JOIN AD_OrgInfo oi ON (io.AD_Org_ID=oi.AD_Org_ID) - INNER JOIN M_Warehouse wh ON (io.M_Warehouse_ID=wh.M_Warehouse_ID); - - - +CREATE OR REPLACE VIEW M_INOUT_HEADER_VT +(AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, + UPDATED, UPDATEDBY, AD_LANGUAGE, M_INOUT_ID, ISSOTRX, + DOCUMENTNO, DOCSTATUS, C_DOCTYPE_ID, C_BPARTNER_ID, BPVALUE, + BPTAXID, NAICS, DUNS, ORG_LOCATION_ID, TAXID, + M_WAREHOUSE_ID, WAREHOUSE_LOCATION_ID, DOCUMENTTYPE, DOCUMENTTYPENOTE, C_ORDER_ID, + PHONE, MOVEMENTDATE, MOVEMENTTYPE, BPGREETING, NAME, + NAME2, BPCONTACTGREETING, TITLE, CONTACTNAME, C_LOCATION_ID, + POSTAL, REFERENCENO, DESCRIPTION, POREFERENCE, DATEORDERED, + VOLUME, WEIGHT, M_SHIPPER_ID, DELIVERYRULE, DELIVERYVIARULE, + PRIORITYRULE, LOGO_ID) +AS +SELECT io.AD_Client_ID, io.AD_Org_ID, io.IsActive, io.Created, io.CreatedBy, io.Updated, io.UpdatedBy, + dt.AD_Language, + io.M_InOut_ID, io.IsSOTrx, io.DocumentNo, io.DocStatus, io.C_DocType_ID, + io.C_BPartner_ID, bp.Value AS BPValue, bp.TaxID AS BPTaxID, bp.NAICS, bp.DUNS, + oi.C_Location_ID AS Org_Location_ID, oi.TaxID, + io.M_Warehouse_ID, wh.C_Location_ID AS Warehouse_Location_ID, + dt.PrintName AS DocumentType, dt.DocumentNote AS DocumentTypeNote, + io.C_Order_ID, bpc.Phone, + io.MovementDate, io.MovementType, + bpg.Greeting AS BPGreeting, + bp.Name, bp.Name2, + bpcg.Greeting AS BPContactGreeting, + bpc.Title, + NULLIF (bpc.Name, bp.Name) AS ContactName, + bpl.C_Location_ID, l.Postal || l.Postal_Add AS Postal, + bp.ReferenceNo, + io.Description, + io.POReference, + io.DateOrdered, io.Volume, io.Weight, + io.M_Shipper_ID, io.DeliveryRule, io.DeliveryViaRule, io.PriorityRule, COALESCE(oi.Logo_ID, ci.Logo_ID) AS Logo_ID +FROM M_InOut io + INNER JOIN C_DocType_Trl dt ON (io.C_DocType_ID=dt.C_DocType_ID) + INNER JOIN C_BPartner bp ON (io.C_BPartner_ID=bp.C_BPartner_ID) + LEFT OUTER JOIN C_Greeting_Trl bpg ON (bp.C_Greeting_ID=bpg.C_Greeting_ID AND dt.AD_Language=bpg.AD_Language) + INNER JOIN C_BPartner_Location bpl ON (io.C_BPartner_Location_ID=bpl.C_BPartner_Location_ID) + INNER JOIN C_Location l ON (bpl.C_Location_ID=l.C_Location_ID) + LEFT OUTER JOIN AD_User bpc ON (io.AD_User_ID=bpc.AD_User_ID) + LEFT OUTER JOIN C_Greeting_Trl bpcg ON (bpc.C_Greeting_ID=bpcg.C_Greeting_ID AND dt.AD_Language=bpcg.AD_Language) + INNER JOIN AD_OrgInfo oi ON (io.AD_Org_ID=oi.AD_Org_ID) + INNER JOIN AD_ClientInfo ci ON (io.AD_Client_ID=ci.AD_Client_ID) + INNER JOIN M_Warehouse wh ON (io.M_Warehouse_ID=wh.M_Warehouse_ID); + + + diff --git a/db/ddlutils/oracle/views/PP_ORDER_BOM_HEADER_V.sql b/db/ddlutils/oracle/views/PP_ORDER_BOM_HEADER_V.sql index adf23d5b56..35a2ad49f7 100644 --- a/db/ddlutils/oracle/views/PP_ORDER_BOM_HEADER_V.sql +++ b/db/ddlutils/oracle/views/PP_ORDER_BOM_HEADER_V.sql @@ -14,10 +14,12 @@ SELECT o.AD_Client_ID, o.AD_Org_ID, o.IsActive, o.Created, o.CreatedBy, o.Update o.DateConfirm,o.DateDelivered,o.DateFinish, o.DateFinishSchedule,o.DateOrdered, o.DatePromised,o.QtyReject, o.QtyReserved , o.QtyScrap , o.Yield , o.C_Campaign_ID, o.C_Project_ID, o.C_Activity_ID, --ob.PP_Product_BOM_ID, - ob.BOMType,ob.BOMUse, ob.Description , ob.Help , ob.M_AttributeSetInstance_ID , ob.M_Product_ID, ob.Name , ob.Revision, ob.ValidFrom , ob.ValidTo + ob.BOMType,ob.BOMUse, ob.Description , ob.Help , ob.M_AttributeSetInstance_ID , ob.M_Product_ID, ob.Name , ob.Revision, ob.ValidFrom , ob.ValidTo, + COALESCE(oi.Logo_ID, ci.Logo_ID) AS Logo_ID FROM PP_Order o INNER JOIN C_DocType d ON (o.C_DocType_ID=d.C_DocType_ID) INNER JOIN PP_Order_BOM ob ON (ob.PP_Order_ID=o.PP_Order_ID) INNER JOIN M_Warehouse wh ON (o.M_Warehouse_ID=wh.M_Warehouse_ID) INNER JOIN AD_OrgInfo oi ON (o.AD_Org_ID=oi.AD_Org_ID) - LEFT OUTER JOIN AD_User u ON (o.Planner_ID=u.AD_User_ID); \ No newline at end of file + INNER JOIN AD_ClientInfo ci ON (o.AD_Client_ID=ci.AD_Client_ID) + LEFT OUTER JOIN AD_User u ON (o.Planner_ID=u.AD_User_ID); diff --git a/db/ddlutils/oracle/views/PP_ORDER_BOM_HEADER_VT.sql b/db/ddlutils/oracle/views/PP_ORDER_BOM_HEADER_VT.sql index 6d43e8f7a7..03e669e2c4 100644 --- a/db/ddlutils/oracle/views/PP_ORDER_BOM_HEADER_VT.sql +++ b/db/ddlutils/oracle/views/PP_ORDER_BOM_HEADER_VT.sql @@ -14,11 +14,13 @@ SELECT o.AD_Client_ID, o.AD_Org_ID, o.IsActive, o.Created, o.CreatedBy, o.Update o.DateConfirm,o.DateDelivered,o.DateFinish, o.DateFinishSchedule,o.DateOrdered, o.DatePromised,o.QtyReject, o.QtyReserved , o.QtyScrap , o.Yield , o.C_Campaign_ID, o.C_Project_ID, o.C_Activity_ID, --ob.PP_Product_BOM_ID, - ob.BOMType,ob.BOMUse, obt.Description , obt.Help , ob.M_AttributeSetInstance_ID , ob.M_Product_ID, obt.Name , ob.Revision, ob.ValidFrom , ob.ValidTo + ob.BOMType,ob.BOMUse, obt.Description , obt.Help , ob.M_AttributeSetInstance_ID , ob.M_Product_ID, obt.Name , ob.Revision, ob.ValidFrom , ob.ValidTo, + COALESCE(oi.Logo_ID, ci.Logo_ID) AS Logo_ID FROM PP_Order o INNER JOIN C_DocType_Trl dt ON (o.C_DocType_ID=dt.C_DocType_ID) INNER JOIN PP_Order_BOM ob ON (ob.PP_Order_ID=o.PP_Order_ID) INNER JOIN PP_Order_BOM_Trl obt ON (obt.PP_Order_BOM_ID=ob.PP_Order_BOM_ID) INNER JOIN M_Warehouse wh ON (o.M_Warehouse_ID=wh.M_Warehouse_ID) INNER JOIN AD_OrgInfo oi ON (o.AD_Org_ID=oi.AD_Org_ID) - LEFT OUTER JOIN AD_User u ON (o.Planner_ID=u.AD_User_ID); \ No newline at end of file + INNER JOIN AD_ClientInfo ci ON (o.AD_Client_ID=ci.AD_Client_ID) + LEFT OUTER JOIN AD_User u ON (o.Planner_ID=u.AD_User_ID); diff --git a/db/ddlutils/oracle/views/PP_ORDER_HEADER_V.sql b/db/ddlutils/oracle/views/PP_ORDER_HEADER_V.sql index baa15caa58..f56d96b39c 100755 --- a/db/ddlutils/oracle/views/PP_ORDER_HEADER_V.sql +++ b/db/ddlutils/oracle/views/PP_ORDER_HEADER_V.sql @@ -11,12 +11,14 @@ SELECT o.AD_Client_ID, o.AD_Org_ID, o.IsActive, o.Created, o.CreatedBy, o.Update o.M_Product_ID,o.M_AttributeSetInstance_ID,o.C_UOM_ID,o.S_Resource_ID,o.PP_Product_BOM_ID,o.AD_Workflow_ID, o.Assay, o.C_OrderLine_ID, o.PriorityRule , o.QtyBatchSize , o.QtyBatchs, o.QtyDelivered, o.QtyEntered, o.QtyOrdered, o.DateConfirm,o.DateDelivered,o.DateFinish, o.DateFinishSchedule,o.DateOrdered, o.DatePromised,o.QtyReject, o.QtyReserved , o.QtyScrap , o.Yield , - o.C_Campaign_ID, o.C_Project_ID, o.C_Activity_ID, o.User1_ID , o.User2_ID , o.AD_OrgTrx_ID ,o.C_DocTypeTarget_ID,o.ScheduleType , o.IsApproved , o.DocAction , o.Posted , o.IsPrinted, o.OrderType + o.C_Campaign_ID, o.C_Project_ID, o.C_Activity_ID, o.User1_ID , o.User2_ID , o.AD_OrgTrx_ID ,o.C_DocTypeTarget_ID,o.ScheduleType , o.IsApproved , o.DocAction , o.Posted , o.IsPrinted, o.OrderType, + COALESCE(oi.Logo_ID, ci.Logo_ID) AS Logo_ID FROM PP_Order o INNER JOIN C_DocType dt ON (o.C_DocType_ID=dt.C_DocType_ID) INNER JOIN M_Warehouse wh ON (o.M_Warehouse_ID=wh.M_Warehouse_ID) INNER JOIN AD_OrgInfo oi ON (o.AD_Org_ID=oi.AD_Org_ID) + INNER JOIN AD_ClientInfo ci ON (o.AD_Client_ID=ci.AD_Client_ID) LEFT OUTER JOIN AD_User u ON (o.Planner_ID=u.AD_User_ID); - \ No newline at end of file + diff --git a/db/ddlutils/oracle/views/PP_ORDER_HEADER_VT.sql b/db/ddlutils/oracle/views/PP_ORDER_HEADER_VT.sql index 0ead4bfa4c..ec4e7017b5 100644 --- a/db/ddlutils/oracle/views/PP_ORDER_HEADER_VT.sql +++ b/db/ddlutils/oracle/views/PP_ORDER_HEADER_VT.sql @@ -11,12 +11,14 @@ SELECT o.AD_Client_ID, o.AD_Org_ID, o.IsActive, o.Created, o.CreatedBy, o.Update o.M_Product_ID,o.M_AttributeSetInstance_ID,o.C_UOM_ID,o.S_Resource_ID,o.PP_Product_BOM_ID,o.AD_Workflow_ID, o.Assay, o.C_OrderLine_ID, o.PriorityRule , o.QtyBatchSize , o.QtyBatchs, o.QtyDelivered, o.QtyEntered, o.QtyOrdered, o.DateConfirm,o.DateDelivered,o.DateFinish, o.DateFinishSchedule,o.DateOrdered, o.DatePromised,o.QtyReject, o.QtyReserved , o.QtyScrap , o.Yield , - o.C_Campaign_ID, o.C_Project_ID, o.C_Activity_ID, o.User1_ID , o.User2_ID , o.AD_OrgTrx_ID ,o.C_DocTypeTarget_ID,o.ScheduleType , o.IsApproved , o.DocAction , o.Posted , o.IsPrinted, o.OrderType + o.C_Campaign_ID, o.C_Project_ID, o.C_Activity_ID, o.User1_ID , o.User2_ID , o.AD_OrgTrx_ID ,o.C_DocTypeTarget_ID,o.ScheduleType , o.IsApproved , o.DocAction , o.Posted , o.IsPrinted, o.OrderType, + COALESCE(oi.Logo_ID, ci.Logo_ID) AS Logo_ID FROM PP_Order o INNER JOIN C_DocType_trl dt ON (o.C_DocType_ID=dt.C_DocType_ID) INNER JOIN M_Warehouse wh ON (o.M_Warehouse_ID=wh.M_Warehouse_ID) INNER JOIN AD_OrgInfo oi ON (o.AD_Org_ID=oi.AD_Org_ID) + INNER JOIN AD_ClientInfo ci ON (o.AD_Client_ID=ci.AD_Client_ID) LEFT OUTER JOIN AD_User u ON (o.Planner_ID=u.AD_User_ID); - \ No newline at end of file + diff --git a/db/ddlutils/oracle/views/PP_ORDER_WORKFLOW_HEADER_V.sql b/db/ddlutils/oracle/views/PP_ORDER_WORKFLOW_HEADER_V.sql index 7c2493bc19..67c65aee8f 100644 --- a/db/ddlutils/oracle/views/PP_ORDER_WORKFLOW_HEADER_V.sql +++ b/db/ddlutils/oracle/views/PP_ORDER_WORKFLOW_HEADER_V.sql @@ -20,10 +20,11 @@ SELECT o.AD_Client_ID, o.AD_Org_ID, o.IsActive, o.Created, o.CreatedBy, o.Update ow.Name ,ow.Description ,ow.Help, ow.Author, ow.Cost, ow.DocumentNo , ow.Duration, ow.DurationUnit , ow.Version, ow.ValidFrom , ow.ValidTo , ow.MovingTime, ow.OverlapUnits , ow.PublishStatus , ow.QueuingTime , ow.SetupTime , ow.UnitsCycles, - ow.WaitingTime , ow.WorkflowType, ow.WorkingTime , ow.Yield + ow.WaitingTime , ow.WorkflowType, ow.WorkingTime , ow.Yield, COALESCE(oi.Logo_ID, ci.Logo_ID) AS Logo_ID FROM PP_Order o INNER JOIN PP_Order_Workflow ow ON (ow.PP_Order_ID=o.PP_Order_ID) INNER JOIN C_DocType d ON (o.C_DocType_ID=d.C_DocType_ID) INNER JOIN M_Warehouse wh ON (o.M_Warehouse_ID=wh.M_Warehouse_ID) INNER JOIN AD_OrgInfo oi ON (o.AD_Org_ID=oi.AD_Org_ID) - LEFT OUTER JOIN AD_User u ON (o.Planner_ID=u.AD_User_ID); \ No newline at end of file + INNER JOIN AD_ClientInfo ci ON (o.AD_Client_ID=ci.AD_Client_ID) + LEFT OUTER JOIN AD_User u ON (o.Planner_ID=u.AD_User_ID); diff --git a/db/ddlutils/oracle/views/PP_ORDER_WORKFLOW_HEADER_VT.sql b/db/ddlutils/oracle/views/PP_ORDER_WORKFLOW_HEADER_VT.sql index cde9b71c8d..bf01f45ca5 100644 --- a/db/ddlutils/oracle/views/PP_ORDER_WORKFLOW_HEADER_VT.sql +++ b/db/ddlutils/oracle/views/PP_ORDER_WORKFLOW_HEADER_VT.sql @@ -19,11 +19,12 @@ SELECT o.AD_Client_ID, o.AD_Org_ID, o.IsActive, o.Created, o.CreatedBy, o.Update -- Order Workflow Field ow.Author, ow.Cost, ow.DocumentNo , ow.Duration, ow.DurationUnit, ow.Version, ow.ValidFrom , ow.ValidTo , ow.MovingTime, ow.OverlapUnits, ow.AD_Workflow_ID, ow.PublishStatus , ow.QueuingTime , ow.SetupTime , ow.UnitsCycles, - ow.WaitingTime , ow.WorkflowType , ow.WorkingTime , ow.Yield + ow.WaitingTime , ow.WorkflowType , ow.WorkingTime , ow.Yield, COALESCE(oi.Logo_ID, ci.Logo_ID) AS Logo_ID FROM PP_Order o INNER JOIN PP_Order_Workflow ow ON (ow.PP_Order_ID=o.PP_Order_ID) INNER JOIN PP_Order_Workflow_Trl owt ON (owt.PP_Order_Workflow_ID=ow.PP_Order_Workflow_ID) INNER JOIN C_DocType dt ON (o.C_DocType_ID=dt.C_DocType_ID) INNER JOIN M_Warehouse wh ON (o.M_Warehouse_ID=wh.M_Warehouse_ID) INNER JOIN AD_OrgInfo oi ON (o.AD_Org_ID=oi.AD_Org_ID) - LEFT OUTER JOIN AD_User u ON (o.Planner_ID=u.AD_User_ID); \ No newline at end of file + INNER JOIN AD_ClientInfo ci ON (o.AD_Client_ID=ci.AD_Client_ID) + LEFT OUTER JOIN AD_User u ON (o.Planner_ID=u.AD_User_ID); diff --git a/db/ddlutils/oracle/views/PP_PRODUCT_BOM_HEADER_V.sql b/db/ddlutils/oracle/views/PP_PRODUCT_BOM_HEADER_V.sql index f9783ef8e9..5d8016af72 100644 --- a/db/ddlutils/oracle/views/PP_PRODUCT_BOM_HEADER_V.sql +++ b/db/ddlutils/oracle/views/PP_PRODUCT_BOM_HEADER_V.sql @@ -5,6 +5,7 @@ SELECT b.AD_Client_ID, b.AD_Org_ID, b.IsActive, b.Created, b.CreatedBy, b.Update b.DocumentNo,b.name,b.help, oi.C_Location_ID AS Org_Location_ID, oi.TaxID, b.Description,processing, validfrom, validto, bomtype, bomuse, m_changenotice_id, - b.M_Product_ID,b.M_AttributeSetInstance_ID,b.C_UOM_ID,b.PP_Product_BOM_ID + b.M_Product_ID,b.M_AttributeSetInstance_ID,b.C_UOM_ID,b.PP_Product_BOM_ID, COALESCE(oi.Logo_ID, ci.Logo_ID) AS Logo_ID FROM PP_Product_BOM b - INNER JOIN AD_OrgInfo oi ON (oi.AD_Org_ID=b.AD_Org_ID); \ No newline at end of file + INNER JOIN AD_OrgInfo oi ON (oi.AD_Org_ID=b.AD_Org_ID) + INNER JOIN AD_ClientInfo ci ON (b.AD_Client_ID=ci.AD_Client_ID); diff --git a/db/ddlutils/oracle/views/PP_PRODUCT_BOM_HEADER_VT.sql b/db/ddlutils/oracle/views/PP_PRODUCT_BOM_HEADER_VT.sql index 2c2b987315..80a807309e 100644 --- a/db/ddlutils/oracle/views/PP_PRODUCT_BOM_HEADER_VT.sql +++ b/db/ddlutils/oracle/views/PP_PRODUCT_BOM_HEADER_VT.sql @@ -5,7 +5,8 @@ SELECT b.AD_Client_ID, b.AD_Org_ID, b.IsActive, b.Created, b.CreatedBy, b.Update b.DocumentNo,bt.Name,bt.help, oi.C_Location_ID AS Org_Location_ID, oi.TaxID, bt.Description,processing, validfrom, validto, bomtype, bomuse, m_changenotice_id, - b.M_Product_ID,b.M_AttributeSetInstance_ID,b.C_UOM_ID,b.PP_Product_BOM_ID + b.M_Product_ID,b.M_AttributeSetInstance_ID,b.C_UOM_ID,b.PP_Product_BOM_ID, COALESCE(oi.Logo_ID, ci.Logo_ID) AS Logo_ID FROM PP_Product_BOM b LEFT JOIN PP_Product_BOM_Trl bt ON (bt.PP_Product_BOM_ID=b.PP_Product_BOM_ID) - INNER JOIN AD_OrgInfo oi ON (oi.AD_Org_ID=b.AD_Org_ID); \ No newline at end of file + INNER JOIN AD_OrgInfo oi ON (oi.AD_Org_ID=b.AD_Org_ID) + INNER JOIN AD_ClientInfo ci ON (b.AD_Client_ID=ci.AD_Client_ID); diff --git a/db/ddlutils/postgresql/views/C_DUNNING_HEADER_V.sql b/db/ddlutils/postgresql/views/C_DUNNING_HEADER_V.sql index 4240a72582..e8677523d9 100644 --- a/db/ddlutils/postgresql/views/C_DUNNING_HEADER_V.sql +++ b/db/ddlutils/postgresql/views/C_DUNNING_HEADER_V.sql @@ -1,37 +1,40 @@ -CREATE OR REPLACE VIEW C_DUNNING_HEADER_V -(AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, - UPDATED, UPDATEDBY, AD_LANGUAGE, C_DUNNINGRUN_ID, C_DUNNINGRUNENTRY_ID, - DUNNINGDATE, PRINTNAME, DOCUMENTNOTE, C_BPARTNER_ID, BPVALUE, - BPTAXID, NAICS, DUNS, ORG_LOCATION_ID, TAXID, - SALESREP_ID, SALESREP_NAME, BPGREETING, NAME, NAME2, - BPCONTACTGREETING, TITLE, PHONE, CONTACTNAME, C_LOCATION_ID, - REFERENCENO, POSTAL, AMT, QTY, NOTE) -AS -SELECT dr.AD_Client_ID, dr.AD_Org_ID, dr.IsActive, dr.Created, dr.CreatedBy, dr.Updated, dr.UpdatedBy, - cast('en_US' as varchar) AS AD_Language, dr.C_DunningRun_ID, C_DunningRunEntry_ID, - dr.DunningDate, dl.PrintName, dl.Note AS DocumentNote, - dre.C_BPartner_ID, bp.Value AS BPValue, bp.TaxID AS BPTaxID, bp.NAICS, bp.DUNS, - oi.C_Location_ID AS Org_Location_ID, oi.TaxID, - dre.SalesRep_ID, COALESCE(ubp.Name, u.Name) AS SalesRep_Name, - bpg.Greeting AS BPGreeting, - bp.Name, bp.Name2, - bpcg.Greeting AS BPContactGreeting, - bpc.Title, bpc.Phone, - NULLIF (bpc.Name, bp.Name) AS ContactName, - bpl.C_Location_ID, bp.ReferenceNo, l.Postal || l.Postal_Add AS Postal, - dre.Amt, dre.Qty, dre.Note -FROM C_DunningRun dr - INNER JOIN C_DunningLevel dl ON (dr.C_DunningLevel_ID=dl.C_DunningLevel_ID) - INNER JOIN C_DunningRunEntry dre ON (dr.C_DunningRun_ID=dre.C_DunningRun_ID) - INNER JOIN C_BPartner bp ON (dre.C_BPartner_ID=bp.C_BPartner_ID) - LEFT OUTER JOIN C_Greeting bpg on (bp.C_Greeting_ID=bpg.C_Greeting_ID) - INNER JOIN C_BPartner_Location bpl ON (dre.C_BPartner_Location_ID=bpl.C_BPartner_Location_ID) - INNER JOIN C_Location l ON (bpl.C_Location_ID=l.C_Location_ID) - LEFT OUTER JOIN AD_User bpc ON (dre.AD_User_ID=bpc.AD_User_ID) - LEFT OUTER JOIN C_Greeting bpcg on (bpc.C_Greeting_ID=bpcg.C_Greeting_ID) - INNER JOIN AD_OrgInfo oi ON (dr.AD_Org_ID=oi.AD_Org_ID) - LEFT OUTER JOIN AD_User u ON (dre.SalesRep_ID=u.AD_User_ID) - LEFT OUTER JOIN C_BPartner ubp ON (u.C_BPartner_ID=ubp.C_BPartner_ID); - - - +DROP VIEW C_DUNNING_HEADER_V; + +CREATE OR REPLACE VIEW C_DUNNING_HEADER_V +(AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, + UPDATED, UPDATEDBY, AD_LANGUAGE, C_DUNNINGRUN_ID, C_DUNNINGRUNENTRY_ID, + DUNNINGDATE, PRINTNAME, DOCUMENTNOTE, C_BPARTNER_ID, BPVALUE, + BPTAXID, NAICS, DUNS, ORG_LOCATION_ID, TAXID, + SALESREP_ID, SALESREP_NAME, BPGREETING, NAME, NAME2, + BPCONTACTGREETING, TITLE, PHONE, CONTACTNAME, C_LOCATION_ID, + REFERENCENO, POSTAL, AMT, QTY, NOTE, LOGO_ID) +AS +SELECT dr.AD_Client_ID, dr.AD_Org_ID, dr.IsActive, dr.Created, dr.CreatedBy, dr.Updated, dr.UpdatedBy, + cast('en_US' as varchar) AS AD_Language, dr.C_DunningRun_ID, C_DunningRunEntry_ID, + dr.DunningDate, dl.PrintName, dl.Note AS DocumentNote, + dre.C_BPartner_ID, bp.Value AS BPValue, bp.TaxID AS BPTaxID, bp.NAICS, bp.DUNS, + oi.C_Location_ID AS Org_Location_ID, oi.TaxID, + dre.SalesRep_ID, COALESCE(ubp.Name, u.Name) AS SalesRep_Name, + bpg.Greeting AS BPGreeting, + bp.Name, bp.Name2, + bpcg.Greeting AS BPContactGreeting, + bpc.Title, bpc.Phone, + NULLIF (bpc.Name, bp.Name) AS ContactName, + bpl.C_Location_ID, bp.ReferenceNo, l.Postal || l.Postal_Add AS Postal, + dre.Amt, dre.Qty, dre.Note, COALESCE(oi.Logo_ID, ci.Logo_ID) AS Logo_ID +FROM C_DunningRun dr + INNER JOIN C_DunningLevel dl ON (dr.C_DunningLevel_ID=dl.C_DunningLevel_ID) + INNER JOIN C_DunningRunEntry dre ON (dr.C_DunningRun_ID=dre.C_DunningRun_ID) + INNER JOIN C_BPartner bp ON (dre.C_BPartner_ID=bp.C_BPartner_ID) + LEFT OUTER JOIN C_Greeting bpg on (bp.C_Greeting_ID=bpg.C_Greeting_ID) + INNER JOIN C_BPartner_Location bpl ON (dre.C_BPartner_Location_ID=bpl.C_BPartner_Location_ID) + INNER JOIN C_Location l ON (bpl.C_Location_ID=l.C_Location_ID) + LEFT OUTER JOIN AD_User bpc ON (dre.AD_User_ID=bpc.AD_User_ID) + LEFT OUTER JOIN C_Greeting bpcg on (bpc.C_Greeting_ID=bpcg.C_Greeting_ID) + INNER JOIN AD_OrgInfo oi ON (dr.AD_Org_ID=oi.AD_Org_ID) + INNER JOIN AD_ClientInfo ci ON (dr.AD_Client_ID=oi.AD_Client_ID) + LEFT OUTER JOIN AD_User u ON (dre.SalesRep_ID=u.AD_User_ID) + LEFT OUTER JOIN C_BPartner ubp ON (u.C_BPartner_ID=ubp.C_BPartner_ID); + + + diff --git a/db/ddlutils/postgresql/views/C_DUNNING_HEADER_VT.sql b/db/ddlutils/postgresql/views/C_DUNNING_HEADER_VT.sql index 9fb90735b6..e2b0bb0303 100644 --- a/db/ddlutils/postgresql/views/C_DUNNING_HEADER_VT.sql +++ b/db/ddlutils/postgresql/views/C_DUNNING_HEADER_VT.sql @@ -1,40 +1,43 @@ -CREATE OR REPLACE VIEW C_DUNNING_HEADER_VT -(AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, - UPDATED, UPDATEDBY, AD_LANGUAGE, C_DUNNINGRUN_ID, C_DUNNINGRUNENTRY_ID, - DUNNINGDATE, PRINTNAME, DOCUMENTNOTE, C_BPARTNER_ID, BPVALUE, - BPTAXID, NAICS, DUNS, ORG_LOCATION_ID, TAXID, - SALESREP_ID, SALESREP_NAME, BPGREETING, NAME, NAME2, - BPCONTACTGREETING, TITLE, PHONE, CONTACTNAME, C_LOCATION_ID, - REFERENCENO, POSTAL, AMT, QTY, NOTE) -AS -SELECT dr.AD_Client_ID, dr.AD_Org_ID, dr.IsActive, dr.Created, dr.CreatedBy, dr.Updated, dr.UpdatedBy, - dlt.AD_Language, dr.C_DunningRun_ID, C_DunningRunEntry_ID, - dr.DunningDate, dlt.PrintName, dlt.Note AS DocumentNote, - dre.C_BPartner_ID, bp.Value AS BPValue, bp.TaxID AS BPTaxID, bp.NAICS, bp.DUNS, - oi.C_Location_ID AS Org_Location_ID, oi.TaxID, - dre.SalesRep_ID, COALESCE(ubp.Name, u.Name) AS SalesRep_Name, - bpg.Greeting AS BPGreeting, - bp.Name, bp.Name2, - bpcg.Greeting AS BPContactGreeting, - bpc.Title, bpc.Phone, - NULLIF (bpc.Name, bp.Name) AS ContactName, - bpl.C_Location_ID, bp.ReferenceNo, l.Postal || l.Postal_Add AS Postal, - dre.Amt, dre.Qty, dre.Note -FROM C_DunningRun dr - INNER JOIN C_DunningLevel dl ON (dr.C_DunningLevel_ID=dl.C_DunningLevel_ID) - INNER JOIN C_DunningLevel_Trl dlt ON (dl.C_DunningLevel_ID=dlt.C_DunningLevel_ID) - INNER JOIN C_DunningRunEntry dre ON (dr.C_DunningRun_ID=dre.C_DunningRun_ID) - INNER JOIN C_BPartner bp ON (dre.C_BPartner_ID=bp.C_BPartner_ID) - LEFT OUTER JOIN C_Greeting_Trl bpg on (bp.C_Greeting_ID=bpg.C_Greeting_ID - AND dlt.AD_Language=bpg.AD_Language) - INNER JOIN C_BPartner_Location bpl ON (dre.C_BPartner_Location_ID=bpl.C_BPartner_Location_ID) - INNER JOIN C_Location l ON (bpl.C_Location_ID=l.C_Location_ID) - LEFT OUTER JOIN AD_User bpc ON (dre.AD_User_ID=bpc.AD_User_ID) - LEFT OUTER JOIN C_Greeting_Trl bpcg on (bpc.C_Greeting_ID=bpcg.C_Greeting_ID - AND dlt.AD_Language=bpcg.AD_Language) - INNER JOIN AD_OrgInfo oi ON (dr.AD_Org_ID=oi.AD_Org_ID) - LEFT OUTER JOIN AD_User u ON (dre.SalesRep_ID=u.AD_User_ID) - LEFT OUTER JOIN C_BPartner ubp ON (u.C_BPartner_ID=ubp.C_BPartner_ID); - - - +DROP VIEW C_DUNNING_HEADER_VT; + +CREATE OR REPLACE VIEW C_DUNNING_HEADER_VT +(AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, + UPDATED, UPDATEDBY, AD_LANGUAGE, C_DUNNINGRUN_ID, C_DUNNINGRUNENTRY_ID, + DUNNINGDATE, PRINTNAME, DOCUMENTNOTE, C_BPARTNER_ID, BPVALUE, + BPTAXID, NAICS, DUNS, ORG_LOCATION_ID, TAXID, + SALESREP_ID, SALESREP_NAME, BPGREETING, NAME, NAME2, + BPCONTACTGREETING, TITLE, PHONE, CONTACTNAME, C_LOCATION_ID, + REFERENCENO, POSTAL, AMT, QTY, NOTE, LOGO_ID) +AS +SELECT dr.AD_Client_ID, dr.AD_Org_ID, dr.IsActive, dr.Created, dr.CreatedBy, dr.Updated, dr.UpdatedBy, + dlt.AD_Language, dr.C_DunningRun_ID, C_DunningRunEntry_ID, + dr.DunningDate, dlt.PrintName, dlt.Note AS DocumentNote, + dre.C_BPartner_ID, bp.Value AS BPValue, bp.TaxID AS BPTaxID, bp.NAICS, bp.DUNS, + oi.C_Location_ID AS Org_Location_ID, oi.TaxID, + dre.SalesRep_ID, COALESCE(ubp.Name, u.Name) AS SalesRep_Name, + bpg.Greeting AS BPGreeting, + bp.Name, bp.Name2, + bpcg.Greeting AS BPContactGreeting, + bpc.Title, bpc.Phone, + NULLIF (bpc.Name, bp.Name) AS ContactName, + bpl.C_Location_ID, bp.ReferenceNo, l.Postal || l.Postal_Add AS Postal, + dre.Amt, dre.Qty, dre.Note, COALESCE(oi.Logo_ID, ci.Logo_ID) AS Logo_ID +FROM C_DunningRun dr + INNER JOIN C_DunningLevel dl ON (dr.C_DunningLevel_ID=dl.C_DunningLevel_ID) + INNER JOIN C_DunningLevel_Trl dlt ON (dl.C_DunningLevel_ID=dlt.C_DunningLevel_ID) + INNER JOIN C_DunningRunEntry dre ON (dr.C_DunningRun_ID=dre.C_DunningRun_ID) + INNER JOIN C_BPartner bp ON (dre.C_BPartner_ID=bp.C_BPartner_ID) + LEFT OUTER JOIN C_Greeting_Trl bpg on (bp.C_Greeting_ID=bpg.C_Greeting_ID + AND dlt.AD_Language=bpg.AD_Language) + INNER JOIN C_BPartner_Location bpl ON (dre.C_BPartner_Location_ID=bpl.C_BPartner_Location_ID) + INNER JOIN C_Location l ON (bpl.C_Location_ID=l.C_Location_ID) + LEFT OUTER JOIN AD_User bpc ON (dre.AD_User_ID=bpc.AD_User_ID) + LEFT OUTER JOIN C_Greeting_Trl bpcg on (bpc.C_Greeting_ID=bpcg.C_Greeting_ID + AND dlt.AD_Language=bpcg.AD_Language) + INNER JOIN AD_OrgInfo oi ON (dr.AD_Org_ID=oi.AD_Org_ID) + INNER JOIN AD_ClientInfo ci ON (dr.AD_Client_ID=oi.AD_Client_ID) + LEFT OUTER JOIN AD_User u ON (dre.SalesRep_ID=u.AD_User_ID) + LEFT OUTER JOIN C_BPartner ubp ON (u.C_BPartner_ID=ubp.C_BPartner_ID); + + + diff --git a/db/ddlutils/postgresql/views/C_INVOICE_HEADER_V.sql b/db/ddlutils/postgresql/views/C_INVOICE_HEADER_V.sql index 4abf5e9b6b..9297200c26 100644 --- a/db/ddlutils/postgresql/views/C_INVOICE_HEADER_V.sql +++ b/db/ddlutils/postgresql/views/C_INVOICE_HEADER_V.sql @@ -1,56 +1,59 @@ -CREATE OR REPLACE VIEW C_INVOICE_HEADER_V -(AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, - UPDATED, UPDATEDBY, AD_LANGUAGE, C_INVOICE_ID, ISSOTRX, - DOCUMENTNO, DOCSTATUS, C_DOCTYPE_ID, C_BPARTNER_ID, BPVALUE, - BPTAXID, NAICS, DUNS, ORG_LOCATION_ID, TAXID, - DOCUMENTTYPE, DOCUMENTTYPENOTE, C_ORDER_ID, SALESREP_ID, SALESREP_NAME, - DATEINVOICED, BPGREETING, NAME, NAME2, BPCONTACTGREETING, - TITLE, PHONE, CONTACTNAME, C_LOCATION_ID, REFERENCENO, - POSTAL, DESCRIPTION, POREFERENCE, DATEORDERED, C_CURRENCY_ID, - PAYMENTTERM, PAYMENTTERMNOTE, C_CHARGE_ID, CHARGEAMT, TOTALLINES, - GRANDTOTAL, AMTINWORDS, M_PRICELIST_ID, ISTAXINCLUDED, C_CAMPAIGN_ID, - C_PROJECT_ID, C_ACTIVITY_ID, ISPAID) -AS -SELECT i.AD_Client_ID, i.AD_Org_ID, i.IsActive, i.Created, i.CreatedBy, i.Updated, i.UpdatedBy, - cast('en_US' as varchar) AS AD_Language, - i.C_Invoice_ID, i.IsSOTrx, i.DocumentNo, i.DocStatus, i.C_DocType_ID, - i.C_BPartner_ID, bp.Value AS BPValue, bp.TaxID AS BPTaxID, bp.NAICS, bp.DUNS, - oi.C_Location_ID AS Org_Location_ID, oi.TaxID, - dt.PrintName AS DocumentType, dt.DocumentNote AS DocumentTypeNote, - i.C_Order_ID, i.SalesRep_ID, COALESCE(ubp.Name, u.Name) AS SalesRep_Name, - i.DateInvoiced, - bpg.Greeting AS BPGreeting, - bp.Name, bp.Name2, - bpcg.Greeting AS BPContactGreeting, - bpc.Title, bpc.Phone, - NULLIF (bpc.Name, bp.Name) AS ContactName, - bpl.C_Location_ID, bp.ReferenceNo, l.Postal || l.Postal_Add AS Postal, - i.Description, - i.POReference, - i.DateOrdered, - i.C_Currency_ID, - pt.Name AS PaymentTerm, pt.DocumentNote AS PaymentTermNote, - i.C_Charge_ID, i.ChargeAmt, - i.TotalLines, - i.GrandTotal, i.GrandTotal AS AmtInWords, - i.M_PriceList_ID, - i.IsTaxIncluded, - i.C_Campaign_ID, - i.C_Project_ID, - i.C_Activity_ID, - i.IsPaid -FROM C_Invoice i - INNER JOIN C_DocType dt ON (i.C_DocType_ID=dt.C_DocType_ID) - INNER JOIN C_PaymentTerm pt ON (i.C_PaymentTerm_ID=pt.C_PaymentTerm_ID) - INNER JOIN C_BPartner bp ON (i.C_BPartner_ID=bp.C_BPartner_ID) - LEFT OUTER JOIN C_Greeting bpg on (bp.C_Greeting_ID=bpg.C_Greeting_ID) - INNER JOIN C_BPartner_Location bpl ON (i.C_BPartner_Location_ID=bpl.C_BPartner_Location_ID) - INNER JOIN C_Location l ON (bpl.C_Location_ID=l.C_Location_ID) - LEFT OUTER JOIN AD_User bpc ON (i.AD_User_ID=bpc.AD_User_ID) - LEFT OUTER JOIN C_Greeting bpcg on (bpc.C_Greeting_ID=bpcg.C_Greeting_ID) - INNER JOIN AD_OrgInfo oi ON (i.AD_Org_ID=oi.AD_Org_ID) - LEFT OUTER JOIN AD_User u ON (i.SalesRep_ID=u.AD_User_ID) - LEFT OUTER JOIN C_BPartner ubp ON (u.C_BPartner_ID=ubp.C_BPartner_ID); - - - +DROP VIEW C_INVOICE_HEADER_V; + +CREATE OR REPLACE VIEW C_INVOICE_HEADER_V +(AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, + UPDATED, UPDATEDBY, AD_LANGUAGE, C_INVOICE_ID, ISSOTRX, + DOCUMENTNO, DOCSTATUS, C_DOCTYPE_ID, C_BPARTNER_ID, BPVALUE, + BPTAXID, NAICS, DUNS, ORG_LOCATION_ID, TAXID, + DOCUMENTTYPE, DOCUMENTTYPENOTE, C_ORDER_ID, SALESREP_ID, SALESREP_NAME, + DATEINVOICED, BPGREETING, NAME, NAME2, BPCONTACTGREETING, + TITLE, PHONE, CONTACTNAME, C_LOCATION_ID, REFERENCENO, + POSTAL, DESCRIPTION, POREFERENCE, DATEORDERED, C_CURRENCY_ID, + PAYMENTTERM, PAYMENTTERMNOTE, C_CHARGE_ID, CHARGEAMT, TOTALLINES, + GRANDTOTAL, AMTINWORDS, M_PRICELIST_ID, ISTAXINCLUDED, C_CAMPAIGN_ID, + C_PROJECT_ID, C_ACTIVITY_ID, ISPAID, LOGO_ID) +AS +SELECT i.AD_Client_ID, i.AD_Org_ID, i.IsActive, i.Created, i.CreatedBy, i.Updated, i.UpdatedBy, + cast('en_US' as varchar) AS AD_Language, + i.C_Invoice_ID, i.IsSOTrx, i.DocumentNo, i.DocStatus, i.C_DocType_ID, + i.C_BPartner_ID, bp.Value AS BPValue, bp.TaxID AS BPTaxID, bp.NAICS, bp.DUNS, + oi.C_Location_ID AS Org_Location_ID, oi.TaxID, + dt.PrintName AS DocumentType, dt.DocumentNote AS DocumentTypeNote, + i.C_Order_ID, i.SalesRep_ID, COALESCE(ubp.Name, u.Name) AS SalesRep_Name, + i.DateInvoiced, + bpg.Greeting AS BPGreeting, + bp.Name, bp.Name2, + bpcg.Greeting AS BPContactGreeting, + bpc.Title, bpc.Phone, + NULLIF (bpc.Name, bp.Name) AS ContactName, + bpl.C_Location_ID, bp.ReferenceNo, l.Postal || l.Postal_Add AS Postal, + i.Description, + i.POReference, + i.DateOrdered, + i.C_Currency_ID, + pt.Name AS PaymentTerm, pt.DocumentNote AS PaymentTermNote, + i.C_Charge_ID, i.ChargeAmt, + i.TotalLines, + i.GrandTotal, i.GrandTotal AS AmtInWords, + i.M_PriceList_ID, + i.IsTaxIncluded, + i.C_Campaign_ID, + i.C_Project_ID, + i.C_Activity_ID, + i.IsPaid, COALESCE(oi.Logo_ID, ci.Logo_ID) AS Logo_ID +FROM C_Invoice i + INNER JOIN C_DocType dt ON (i.C_DocType_ID=dt.C_DocType_ID) + INNER JOIN C_PaymentTerm pt ON (i.C_PaymentTerm_ID=pt.C_PaymentTerm_ID) + INNER JOIN C_BPartner bp ON (i.C_BPartner_ID=bp.C_BPartner_ID) + LEFT OUTER JOIN C_Greeting bpg on (bp.C_Greeting_ID=bpg.C_Greeting_ID) + INNER JOIN C_BPartner_Location bpl ON (i.C_BPartner_Location_ID=bpl.C_BPartner_Location_ID) + INNER JOIN C_Location l ON (bpl.C_Location_ID=l.C_Location_ID) + LEFT OUTER JOIN AD_User bpc ON (i.AD_User_ID=bpc.AD_User_ID) + LEFT OUTER JOIN C_Greeting bpcg on (bpc.C_Greeting_ID=bpcg.C_Greeting_ID) + INNER JOIN AD_OrgInfo oi ON (i.AD_Org_ID=oi.AD_Org_ID) + INNER JOIN AD_ClientInfo ci ON (i.AD_Client_ID=oi.AD_Client_ID) + LEFT OUTER JOIN AD_User u ON (i.SalesRep_ID=u.AD_User_ID) + LEFT OUTER JOIN C_BPartner ubp ON (u.C_BPartner_ID=ubp.C_BPartner_ID); + + + diff --git a/db/ddlutils/postgresql/views/C_INVOICE_HEADER_VT.sql b/db/ddlutils/postgresql/views/C_INVOICE_HEADER_VT.sql index 8ebbd047a0..a67ae9f088 100644 --- a/db/ddlutils/postgresql/views/C_INVOICE_HEADER_VT.sql +++ b/db/ddlutils/postgresql/views/C_INVOICE_HEADER_VT.sql @@ -1,56 +1,59 @@ -CREATE OR REPLACE VIEW C_INVOICE_HEADER_VT -(AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, - UPDATED, UPDATEDBY, AD_LANGUAGE, C_INVOICE_ID, ISSOTRX, - DOCUMENTNO, DOCSTATUS, C_DOCTYPE_ID, C_BPARTNER_ID, BPVALUE, - BPTAXID, NAICS, DUNS, ORG_LOCATION_ID, TAXID, - DOCUMENTTYPE, DOCUMENTTYPENOTE, C_ORDER_ID, SALESREP_ID, SALESREP_NAME, - DATEINVOICED, BPGREETING, NAME, NAME2, BPCONTACTGREETING, - TITLE, PHONE, CONTACTNAME, C_LOCATION_ID, REFERENCENO, - POSTAL, DESCRIPTION, POREFERENCE, DATEORDERED, C_CURRENCY_ID, - PAYMENTTERM, PAYMENTTERMNOTE, C_CHARGE_ID, CHARGEAMT, TOTALLINES, - GRANDTOTAL, AMTINWORDS, M_PRICELIST_ID, ISTAXINCLUDED, C_CAMPAIGN_ID, - C_PROJECT_ID, C_ACTIVITY_ID, ISPAID) -AS -SELECT i.AD_Client_ID, i.AD_Org_ID, i.IsActive, i.Created, i.CreatedBy, i.Updated, i.UpdatedBy, - dt.AD_Language, - i.C_Invoice_ID, i.IsSOTrx, i.DocumentNo, i.DocStatus, i.C_DocType_ID, - i.C_BPartner_ID, bp.Value AS BPValue, bp.TaxID AS BPTaxID, bp.NAICS, bp.DUNS, - oi.C_Location_ID AS Org_Location_ID, oi.TaxID, - dt.PrintName AS DocumentType, dt.DocumentNote AS DocumentTypeNote, - i.C_Order_ID, i.SalesRep_ID, COALESCE(ubp.Name, u.Name) AS SalesRep_Name, - i.DateInvoiced, - bpg.Greeting AS BPGreeting, - bp.Name, bp.Name2, - bpcg.Greeting AS BPContactGreeting, - bpc.Title, bpc.Phone, - NULLIF (bpc.Name, bp.Name) AS ContactName, - bpl.C_Location_ID, bp.ReferenceNo, l.Postal || l.Postal_Add AS Postal, - i.Description, - i.POReference, - i.DateOrdered, - i.C_Currency_ID, - pt.Name AS PaymentTerm, pt.DocumentNote AS PaymentTermNote, - i.C_Charge_ID, i.ChargeAmt, - i.TotalLines, - i.GrandTotal, i.GrandTotal AS AmtInWords, - i.M_PriceList_ID, - i.IsTaxIncluded, - i.C_Campaign_ID, - i.C_Project_ID, - i.C_Activity_ID, - i.IsPaid -FROM C_Invoice i - INNER JOIN C_DocType_Trl dt ON (i.C_DocType_ID=dt.C_DocType_ID) - INNER JOIN C_PaymentTerm_Trl pt ON (i.C_PaymentTerm_ID=pt.C_PaymentTerm_ID AND dt.AD_Language=pt.AD_Language) - INNER JOIN C_BPartner bp ON (i.C_BPartner_ID=bp.C_BPartner_ID) - LEFT OUTER JOIN C_Greeting_Trl bpg on (bp.C_Greeting_ID=bpg.C_Greeting_ID AND dt.AD_Language=bpg.AD_Language) - INNER JOIN C_BPartner_Location bpl ON (i.C_BPartner_Location_ID=bpl.C_BPartner_Location_ID) - INNER JOIN C_Location l ON (bpl.C_Location_ID=l.C_Location_ID) - LEFT OUTER JOIN AD_User bpc ON (i.AD_User_ID=bpc.AD_User_ID) - LEFT OUTER JOIN C_Greeting_Trl bpcg on (bpc.C_Greeting_ID=bpcg.C_Greeting_ID AND dt.AD_Language=bpcg.AD_Language) - INNER JOIN AD_OrgInfo oi ON (i.AD_Org_ID=oi.AD_Org_ID) - LEFT OUTER JOIN AD_User u ON (i.SalesRep_ID=u.AD_User_ID) - LEFT OUTER JOIN C_BPartner ubp ON (u.C_BPartner_ID=ubp.C_BPartner_ID); - - - +DROP VIEW C_INVOICE_HEADER_VT; + +CREATE OR REPLACE VIEW C_INVOICE_HEADER_VT +(AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, + UPDATED, UPDATEDBY, AD_LANGUAGE, C_INVOICE_ID, ISSOTRX, + DOCUMENTNO, DOCSTATUS, C_DOCTYPE_ID, C_BPARTNER_ID, BPVALUE, + BPTAXID, NAICS, DUNS, ORG_LOCATION_ID, TAXID, + DOCUMENTTYPE, DOCUMENTTYPENOTE, C_ORDER_ID, SALESREP_ID, SALESREP_NAME, + DATEINVOICED, BPGREETING, NAME, NAME2, BPCONTACTGREETING, + TITLE, PHONE, CONTACTNAME, C_LOCATION_ID, REFERENCENO, + POSTAL, DESCRIPTION, POREFERENCE, DATEORDERED, C_CURRENCY_ID, + PAYMENTTERM, PAYMENTTERMNOTE, C_CHARGE_ID, CHARGEAMT, TOTALLINES, + GRANDTOTAL, AMTINWORDS, M_PRICELIST_ID, ISTAXINCLUDED, C_CAMPAIGN_ID, + C_PROJECT_ID, C_ACTIVITY_ID, ISPAID, LOGO_ID) +AS +SELECT i.AD_Client_ID, i.AD_Org_ID, i.IsActive, i.Created, i.CreatedBy, i.Updated, i.UpdatedBy, + dt.AD_Language, + i.C_Invoice_ID, i.IsSOTrx, i.DocumentNo, i.DocStatus, i.C_DocType_ID, + i.C_BPartner_ID, bp.Value AS BPValue, bp.TaxID AS BPTaxID, bp.NAICS, bp.DUNS, + oi.C_Location_ID AS Org_Location_ID, oi.TaxID, + dt.PrintName AS DocumentType, dt.DocumentNote AS DocumentTypeNote, + i.C_Order_ID, i.SalesRep_ID, COALESCE(ubp.Name, u.Name) AS SalesRep_Name, + i.DateInvoiced, + bpg.Greeting AS BPGreeting, + bp.Name, bp.Name2, + bpcg.Greeting AS BPContactGreeting, + bpc.Title, bpc.Phone, + NULLIF (bpc.Name, bp.Name) AS ContactName, + bpl.C_Location_ID, bp.ReferenceNo, l.Postal || l.Postal_Add AS Postal, + i.Description, + i.POReference, + i.DateOrdered, + i.C_Currency_ID, + pt.Name AS PaymentTerm, pt.DocumentNote AS PaymentTermNote, + i.C_Charge_ID, i.ChargeAmt, + i.TotalLines, + i.GrandTotal, i.GrandTotal AS AmtInWords, + i.M_PriceList_ID, + i.IsTaxIncluded, + i.C_Campaign_ID, + i.C_Project_ID, + i.C_Activity_ID, + i.IsPaid, COALESCE(oi.Logo_ID, ci.Logo_ID) AS Logo_ID +FROM C_Invoice i + INNER JOIN C_DocType_Trl dt ON (i.C_DocType_ID=dt.C_DocType_ID) + INNER JOIN C_PaymentTerm_Trl pt ON (i.C_PaymentTerm_ID=pt.C_PaymentTerm_ID AND dt.AD_Language=pt.AD_Language) + INNER JOIN C_BPartner bp ON (i.C_BPartner_ID=bp.C_BPartner_ID) + LEFT OUTER JOIN C_Greeting_Trl bpg on (bp.C_Greeting_ID=bpg.C_Greeting_ID AND dt.AD_Language=bpg.AD_Language) + INNER JOIN C_BPartner_Location bpl ON (i.C_BPartner_Location_ID=bpl.C_BPartner_Location_ID) + INNER JOIN C_Location l ON (bpl.C_Location_ID=l.C_Location_ID) + LEFT OUTER JOIN AD_User bpc ON (i.AD_User_ID=bpc.AD_User_ID) + LEFT OUTER JOIN C_Greeting_Trl bpcg on (bpc.C_Greeting_ID=bpcg.C_Greeting_ID AND dt.AD_Language=bpcg.AD_Language) + INNER JOIN AD_OrgInfo oi ON (i.AD_Org_ID=oi.AD_Org_ID) + INNER JOIN AD_ClientInfo ci ON (i.AD_Client_ID=oi.AD_Client_ID) + LEFT OUTER JOIN AD_User u ON (i.SalesRep_ID=u.AD_User_ID) + LEFT OUTER JOIN C_BPartner ubp ON (u.C_BPartner_ID=ubp.C_BPartner_ID); + + + diff --git a/db/ddlutils/postgresql/views/C_ORDER_HEADER_V.sql b/db/ddlutils/postgresql/views/C_ORDER_HEADER_V.sql index e81ccaf45d..e85dd62e12 100644 --- a/db/ddlutils/postgresql/views/C_ORDER_HEADER_V.sql +++ b/db/ddlutils/postgresql/views/C_ORDER_HEADER_V.sql @@ -1,70 +1,73 @@ -CREATE OR REPLACE VIEW C_ORDER_HEADER_V -(AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, - UPDATED, UPDATEDBY, AD_LANGUAGE, C_ORDER_ID, ISSOTRX, - DOCUMENTNO, DOCSTATUS, C_DOCTYPE_ID, C_BPARTNER_ID, BPVALUE, - BPTAXID, NAICS, DUNS, ORG_LOCATION_ID, TAXID, - M_WAREHOUSE_ID, WAREHOUSE_LOCATION_ID, DOCUMENTTYPE, DOCUMENTTYPENOTE, SALESREP_ID, - SALESREP_NAME, DATEORDERED, DATEPROMISED, BPGREETING, NAME, - NAME2, BPCONTACTGREETING, TITLE, PHONE, CONTACTNAME, - C_LOCATION_ID, POSTAL, REFERENCENO, BILL_BPARTNER_ID, BILL_LOCATION_ID, - BILL_USER_ID, BILL_BPVALUE, BILL_BPTAXID, BILL_NAME, BILL_NAME2, - BILL_TITLE, BILL_PHONE, BILL_CONTACTNAME, BILL_C_LOCATION_ID, DESCRIPTION, - POREFERENCE, C_CURRENCY_ID, PAYMENTTERM, PAYMENTTERMNOTE, C_CHARGE_ID, - CHARGEAMT, TOTALLINES, GRANDTOTAL, AMTINWORDS, M_PRICELIST_ID, - ISTAXINCLUDED, VOLUME, WEIGHT, C_CAMPAIGN_ID, C_PROJECT_ID, - C_ACTIVITY_ID, M_SHIPPER_ID, DELIVERYRULE, DELIVERYVIARULE, PRIORITYRULE, - INVOICERULE) -AS -SELECT o.AD_Client_ID, o.AD_Org_ID, o.IsActive, o.Created, o.CreatedBy, o.Updated, o.UpdatedBy, - cast('en_US' as varchar) AS AD_Language, - o.C_Order_ID, o.IsSOTrx, o.DocumentNo, o.DocStatus, o.C_DocType_ID, - o.C_BPartner_ID, bp.Value AS BPValue, bp.TaxID AS BPTaxID, bp.NAICS, bp.DUNS, - oi.C_Location_ID AS Org_Location_ID, oi.TaxID, - o.M_Warehouse_ID, wh.C_Location_ID AS Warehouse_Location_ID, - dt.PrintName AS DocumentType, dt.DocumentNote AS DocumentTypeNote, - o.SalesRep_ID, COALESCE(ubp.Name, u.Name) AS SalesRep_Name, - o.DateOrdered, o.DatePromised, - bpg.Greeting AS BPGreeting, - bp.Name, bp.Name2, - bpcg.Greeting AS BPContactGreeting, - bpc.Title, bpc.Phone, - NULLIF (bpc.Name, bp.Name) AS ContactName, - bpl.C_Location_ID, l.Postal || l.Postal_Add AS Postal, - bp.ReferenceNo, - -- Bill to - o.Bill_BPartner_ID, o.Bill_Location_ID, o.Bill_User_ID, - bbp.Value AS Bill_BPValue, bbp.TaxID AS Bill_BPTaxID, - bbp.Name AS Bill_Name, bbp.Name2 AS Bill_Name2, - bbpc.Title AS Bill_Title, bbpc.Phone AS Bill_Phone, - NULLIF (bbpc.Name, bbp.Name) AS Bill_ContactName, - bbpl.C_Location_ID AS Bill_C_Location_ID, - o.Description, - o.POReference, - o.C_Currency_ID, - pt.Name AS PaymentTerm, pt.DocumentNote AS PaymentTermNote, - o.C_Charge_ID, o.ChargeAmt, - o.TotalLines, - o.GrandTotal, o.GrandTotal AS AmtInWords, - o.M_PriceList_ID, - o.IsTaxIncluded, o.Volume, o.Weight, - o.C_Campaign_ID, o.C_Project_ID, o.C_Activity_ID, - o.M_Shipper_ID, o.DeliveryRule, o.DeliveryViaRule, o.PriorityRule, o.InvoiceRule -FROM C_Order o - INNER JOIN C_DocType dt ON (o.C_DocType_ID=dt.C_DocType_ID) - INNER JOIN M_Warehouse wh ON (o.M_Warehouse_ID=wh.M_Warehouse_ID) - INNER JOIN C_PaymentTerm pt ON (o.C_PaymentTerm_ID=pt.C_PaymentTerm_ID) - INNER JOIN C_BPartner bp ON (o.C_BPartner_ID=bp.C_BPartner_ID) - LEFT OUTER JOIN C_Greeting bpg ON (bp.C_Greeting_ID=bpg.C_Greeting_ID) - INNER JOIN C_BPartner_Location bpl ON (o.C_BPartner_Location_ID=bpl.C_BPartner_Location_ID) - INNER JOIN C_Location l ON (bpl.C_Location_ID=l.C_Location_ID) - LEFT OUTER JOIN AD_User bpc ON (o.AD_User_ID=bpc.AD_User_ID) - LEFT OUTER JOIN C_Greeting bpcg ON (bpc.C_Greeting_ID=bpcg.C_Greeting_ID) - INNER JOIN AD_OrgInfo oi ON (o.AD_Org_ID=oi.AD_Org_ID) - LEFT OUTER JOIN AD_User u ON (o.SalesRep_ID=u.AD_User_ID) - LEFT OUTER JOIN C_BPartner ubp ON (u.C_BPartner_ID=ubp.C_BPartner_ID) - INNER JOIN C_BPartner bbp ON (o.Bill_BPartner_ID=bbp.C_BPartner_ID) - INNER JOIN C_BPartner_Location bbpl ON (o.Bill_Location_ID=bbpl.C_BPartner_Location_ID) - LEFT OUTER JOIN AD_User bbpc ON (o.Bill_User_ID=bbpc.AD_User_ID); - - - +DROP VIEW C_ORDER_HEADER_V; + +CREATE OR REPLACE VIEW C_ORDER_HEADER_V +(AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, + UPDATED, UPDATEDBY, AD_LANGUAGE, C_ORDER_ID, ISSOTRX, + DOCUMENTNO, DOCSTATUS, C_DOCTYPE_ID, C_BPARTNER_ID, BPVALUE, + BPTAXID, NAICS, DUNS, ORG_LOCATION_ID, TAXID, + M_WAREHOUSE_ID, WAREHOUSE_LOCATION_ID, DOCUMENTTYPE, DOCUMENTTYPENOTE, SALESREP_ID, + SALESREP_NAME, DATEORDERED, DATEPROMISED, BPGREETING, NAME, + NAME2, BPCONTACTGREETING, TITLE, PHONE, CONTACTNAME, + C_LOCATION_ID, POSTAL, REFERENCENO, BILL_BPARTNER_ID, BILL_LOCATION_ID, + BILL_USER_ID, BILL_BPVALUE, BILL_BPTAXID, BILL_NAME, BILL_NAME2, + BILL_TITLE, BILL_PHONE, BILL_CONTACTNAME, BILL_C_LOCATION_ID, DESCRIPTION, + POREFERENCE, C_CURRENCY_ID, PAYMENTTERM, PAYMENTTERMNOTE, C_CHARGE_ID, + CHARGEAMT, TOTALLINES, GRANDTOTAL, AMTINWORDS, M_PRICELIST_ID, + ISTAXINCLUDED, VOLUME, WEIGHT, C_CAMPAIGN_ID, C_PROJECT_ID, + C_ACTIVITY_ID, M_SHIPPER_ID, DELIVERYRULE, DELIVERYVIARULE, PRIORITYRULE, + INVOICERULE, LOGO_ID) +AS +SELECT o.AD_Client_ID, o.AD_Org_ID, o.IsActive, o.Created, o.CreatedBy, o.Updated, o.UpdatedBy, + cast('en_US' as varchar) AS AD_Language, + o.C_Order_ID, o.IsSOTrx, o.DocumentNo, o.DocStatus, o.C_DocType_ID, + o.C_BPartner_ID, bp.Value AS BPValue, bp.TaxID AS BPTaxID, bp.NAICS, bp.DUNS, + oi.C_Location_ID AS Org_Location_ID, oi.TaxID, + o.M_Warehouse_ID, wh.C_Location_ID AS Warehouse_Location_ID, + dt.PrintName AS DocumentType, dt.DocumentNote AS DocumentTypeNote, + o.SalesRep_ID, COALESCE(ubp.Name, u.Name) AS SalesRep_Name, + o.DateOrdered, o.DatePromised, + bpg.Greeting AS BPGreeting, + bp.Name, bp.Name2, + bpcg.Greeting AS BPContactGreeting, + bpc.Title, bpc.Phone, + NULLIF (bpc.Name, bp.Name) AS ContactName, + bpl.C_Location_ID, l.Postal || l.Postal_Add AS Postal, + bp.ReferenceNo, + -- Bill to + o.Bill_BPartner_ID, o.Bill_Location_ID, o.Bill_User_ID, + bbp.Value AS Bill_BPValue, bbp.TaxID AS Bill_BPTaxID, + bbp.Name AS Bill_Name, bbp.Name2 AS Bill_Name2, + bbpc.Title AS Bill_Title, bbpc.Phone AS Bill_Phone, + NULLIF (bbpc.Name, bbp.Name) AS Bill_ContactName, + bbpl.C_Location_ID AS Bill_C_Location_ID, + o.Description, + o.POReference, + o.C_Currency_ID, + pt.Name AS PaymentTerm, pt.DocumentNote AS PaymentTermNote, + o.C_Charge_ID, o.ChargeAmt, + o.TotalLines, + o.GrandTotal, o.GrandTotal AS AmtInWords, + o.M_PriceList_ID, + o.IsTaxIncluded, o.Volume, o.Weight, + o.C_Campaign_ID, o.C_Project_ID, o.C_Activity_ID, + o.M_Shipper_ID, o.DeliveryRule, o.DeliveryViaRule, o.PriorityRule, o.InvoiceRule, COALESCE(oi.Logo_ID, ci.Logo_ID) AS Logo_ID +FROM C_Order o + INNER JOIN C_DocType dt ON (o.C_DocType_ID=dt.C_DocType_ID) + INNER JOIN M_Warehouse wh ON (o.M_Warehouse_ID=wh.M_Warehouse_ID) + INNER JOIN C_PaymentTerm pt ON (o.C_PaymentTerm_ID=pt.C_PaymentTerm_ID) + INNER JOIN C_BPartner bp ON (o.C_BPartner_ID=bp.C_BPartner_ID) + LEFT OUTER JOIN C_Greeting bpg ON (bp.C_Greeting_ID=bpg.C_Greeting_ID) + INNER JOIN C_BPartner_Location bpl ON (o.C_BPartner_Location_ID=bpl.C_BPartner_Location_ID) + INNER JOIN C_Location l ON (bpl.C_Location_ID=l.C_Location_ID) + LEFT OUTER JOIN AD_User bpc ON (o.AD_User_ID=bpc.AD_User_ID) + LEFT OUTER JOIN C_Greeting bpcg ON (bpc.C_Greeting_ID=bpcg.C_Greeting_ID) + INNER JOIN AD_OrgInfo oi ON (o.AD_Org_ID=oi.AD_Org_ID) + INNER JOIN AD_ClientInfo ci ON (o.AD_Client_ID=oi.AD_Client_ID) + LEFT OUTER JOIN AD_User u ON (o.SalesRep_ID=u.AD_User_ID) + LEFT OUTER JOIN C_BPartner ubp ON (u.C_BPartner_ID=ubp.C_BPartner_ID) + INNER JOIN C_BPartner bbp ON (o.Bill_BPartner_ID=bbp.C_BPartner_ID) + INNER JOIN C_BPartner_Location bbpl ON (o.Bill_Location_ID=bbpl.C_BPartner_Location_ID) + LEFT OUTER JOIN AD_User bbpc ON (o.Bill_User_ID=bbpc.AD_User_ID); + + + diff --git a/db/ddlutils/postgresql/views/C_ORDER_HEADER_VT.sql b/db/ddlutils/postgresql/views/C_ORDER_HEADER_VT.sql index b4c1fa7ebc..c0372b4a63 100644 --- a/db/ddlutils/postgresql/views/C_ORDER_HEADER_VT.sql +++ b/db/ddlutils/postgresql/views/C_ORDER_HEADER_VT.sql @@ -1,70 +1,73 @@ -CREATE OR REPLACE VIEW C_ORDER_HEADER_VT -(AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, - UPDATED, UPDATEDBY, AD_LANGUAGE, C_ORDER_ID, ISSOTRX, - DOCUMENTNO, DOCSTATUS, C_DOCTYPE_ID, C_BPARTNER_ID, BPVALUE, - BPTAXID, NAICS, DUNS, ORG_LOCATION_ID, TAXID, - M_WAREHOUSE_ID, WAREHOUSE_LOCATION_ID, DOCUMENTTYPE, DOCUMENTTYPENOTE, SALESREP_ID, - SALESREP_NAME, DATEORDERED, DATEPROMISED, BPGREETING, NAME, - NAME2, BPCONTACTGREETING, TITLE, PHONE, CONTACTNAME, - C_LOCATION_ID, POSTAL, REFERENCENO, BILL_BPARTNER_ID, BILL_LOCATION_ID, - BILL_USER_ID, BILL_BPVALUE, BILL_BPTAXID, BILL_NAME, BILL_NAME2, - BILL_TITLE, BILL_PHONE, BILL_CONTACTNAME, BILL_C_LOCATION_ID, DESCRIPTION, - POREFERENCE, C_CURRENCY_ID, PAYMENTTERM, PAYMENTTERMNOTE, C_CHARGE_ID, - CHARGEAMT, TOTALLINES, GRANDTOTAL, AMTINWORDS, M_PRICELIST_ID, - ISTAXINCLUDED, VOLUME, WEIGHT, C_CAMPAIGN_ID, C_PROJECT_ID, - C_ACTIVITY_ID, M_SHIPPER_ID, DELIVERYRULE, DELIVERYVIARULE, PRIORITYRULE, - INVOICERULE) -AS -SELECT o.AD_Client_ID, o.AD_Org_ID, o.IsActive, o.Created, o.CreatedBy, o.Updated, o.UpdatedBy, - dt.AD_Language, - o.C_Order_ID, o.IsSOTrx, o.DocumentNo, o.DocStatus, o.C_DocType_ID, - o.C_BPartner_ID, bp.Value AS BPValue, bp.TaxID AS BPTaxID, bp.NAICS, bp.DUNS, - oi.C_Location_ID AS Org_Location_ID, oi.TaxID, - o.M_Warehouse_ID, wh.C_Location_ID AS Warehouse_Location_ID, - dt.PrintName AS DocumentType, dt.DocumentNote AS DocumentTypeNote, - o.SalesRep_ID, COALESCE(ubp.Name, u.Name) AS SalesRep_Name, - o.DateOrdered, o.DatePromised, - bpg.Greeting AS BPGreeting, - bp.Name, bp.Name2, - bpcg.Greeting AS BPContactGreeting, - bpc.Title, bpc.Phone, - NULLIF (bpc.Name, bp.Name) AS ContactName, - bpl.C_Location_ID, l.Postal || l.Postal_Add AS Postal, - bp.ReferenceNo, - -- Bill to - o.Bill_BPartner_ID, o.Bill_Location_ID, o.Bill_User_ID, - bbp.Value AS Bill_BPValue, bbp.TaxID AS Bill_BPTaxID, - bbp.Name AS Bill_Name, bbp.Name2 AS Bill_Name2, - bbpc.Title AS Bill_Title, bbpc.Phone AS Bill_Phone, - NULLIF (bbpc.Name, bbp.Name) AS Bill_ContactName, - bbpl.C_Location_ID AS Bill_C_Location_ID, - o.Description, - o.POReference, - o.C_Currency_ID, - pt.Name AS PaymentTerm, pt.DocumentNote AS PaymentTermNote, - o.C_Charge_ID, o.ChargeAmt, - o.TotalLines, - o.GrandTotal, o.GrandTotal AS AmtInWords, - o.M_PriceList_ID, - o.IsTaxIncluded, o.Volume, o.Weight, - o.C_Campaign_ID, o.C_Project_ID, o.C_Activity_ID, - o.M_Shipper_ID, o.DeliveryRule, o.DeliveryViaRule, o.PriorityRule, o.InvoiceRule -FROM C_Order o - INNER JOIN C_DocType_Trl dt ON (o.C_DocType_ID=dt.C_DocType_ID) - INNER JOIN M_Warehouse wh ON (o.M_Warehouse_ID=wh.M_Warehouse_ID) - INNER JOIN C_PaymentTerm_Trl pt ON (o.C_PaymentTerm_ID=pt.C_PaymentTerm_ID AND dt.AD_Language=pt.AD_Language) - INNER JOIN C_BPartner bp ON (o.C_BPartner_ID=bp.C_BPartner_ID) - LEFT OUTER JOIN C_Greeting_Trl bpg ON (bp.C_Greeting_ID=bpg.C_Greeting_ID AND dt.AD_Language=bpg.AD_Language) - INNER JOIN C_BPartner_Location bpl ON (o.C_BPartner_Location_ID=bpl.C_BPartner_Location_ID) - INNER JOIN C_Location l ON (bpl.C_Location_ID=l.C_Location_ID) - LEFT OUTER JOIN AD_User bpc ON (o.AD_User_ID=bpc.AD_User_ID) - LEFT OUTER JOIN C_Greeting_Trl bpcg ON (bpc.C_Greeting_ID=bpcg.C_Greeting_ID AND dt.AD_Language=bpcg.AD_Language) - INNER JOIN AD_OrgInfo oi ON (o.AD_Org_ID=oi.AD_Org_ID) - LEFT OUTER JOIN AD_User u ON (o.SalesRep_ID=u.AD_User_ID) - LEFT OUTER JOIN C_BPartner ubp ON (u.C_BPartner_ID=ubp.C_BPartner_ID) - INNER JOIN C_BPartner bbp ON (o.Bill_BPartner_ID=bbp.C_BPartner_ID) - INNER JOIN C_BPartner_Location bbpl ON (o.Bill_Location_ID=bbpl.C_BPartner_Location_ID) - LEFT OUTER JOIN AD_User bbpc ON (o.Bill_User_ID=bbpc.AD_User_ID); - - - +DROP VIEW C_ORDER_HEADER_VT; + +CREATE OR REPLACE VIEW C_ORDER_HEADER_VT +(AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, + UPDATED, UPDATEDBY, AD_LANGUAGE, C_ORDER_ID, ISSOTRX, + DOCUMENTNO, DOCSTATUS, C_DOCTYPE_ID, C_BPARTNER_ID, BPVALUE, + BPTAXID, NAICS, DUNS, ORG_LOCATION_ID, TAXID, + M_WAREHOUSE_ID, WAREHOUSE_LOCATION_ID, DOCUMENTTYPE, DOCUMENTTYPENOTE, SALESREP_ID, + SALESREP_NAME, DATEORDERED, DATEPROMISED, BPGREETING, NAME, + NAME2, BPCONTACTGREETING, TITLE, PHONE, CONTACTNAME, + C_LOCATION_ID, POSTAL, REFERENCENO, BILL_BPARTNER_ID, BILL_LOCATION_ID, + BILL_USER_ID, BILL_BPVALUE, BILL_BPTAXID, BILL_NAME, BILL_NAME2, + BILL_TITLE, BILL_PHONE, BILL_CONTACTNAME, BILL_C_LOCATION_ID, DESCRIPTION, + POREFERENCE, C_CURRENCY_ID, PAYMENTTERM, PAYMENTTERMNOTE, C_CHARGE_ID, + CHARGEAMT, TOTALLINES, GRANDTOTAL, AMTINWORDS, M_PRICELIST_ID, + ISTAXINCLUDED, VOLUME, WEIGHT, C_CAMPAIGN_ID, C_PROJECT_ID, + C_ACTIVITY_ID, M_SHIPPER_ID, DELIVERYRULE, DELIVERYVIARULE, PRIORITYRULE, + INVOICERULE, LOGO_ID) +AS +SELECT o.AD_Client_ID, o.AD_Org_ID, o.IsActive, o.Created, o.CreatedBy, o.Updated, o.UpdatedBy, + dt.AD_Language, + o.C_Order_ID, o.IsSOTrx, o.DocumentNo, o.DocStatus, o.C_DocType_ID, + o.C_BPartner_ID, bp.Value AS BPValue, bp.TaxID AS BPTaxID, bp.NAICS, bp.DUNS, + oi.C_Location_ID AS Org_Location_ID, oi.TaxID, + o.M_Warehouse_ID, wh.C_Location_ID AS Warehouse_Location_ID, + dt.PrintName AS DocumentType, dt.DocumentNote AS DocumentTypeNote, + o.SalesRep_ID, COALESCE(ubp.Name, u.Name) AS SalesRep_Name, + o.DateOrdered, o.DatePromised, + bpg.Greeting AS BPGreeting, + bp.Name, bp.Name2, + bpcg.Greeting AS BPContactGreeting, + bpc.Title, bpc.Phone, + NULLIF (bpc.Name, bp.Name) AS ContactName, + bpl.C_Location_ID, l.Postal || l.Postal_Add AS Postal, + bp.ReferenceNo, + -- Bill to + o.Bill_BPartner_ID, o.Bill_Location_ID, o.Bill_User_ID, + bbp.Value AS Bill_BPValue, bbp.TaxID AS Bill_BPTaxID, + bbp.Name AS Bill_Name, bbp.Name2 AS Bill_Name2, + bbpc.Title AS Bill_Title, bbpc.Phone AS Bill_Phone, + NULLIF (bbpc.Name, bbp.Name) AS Bill_ContactName, + bbpl.C_Location_ID AS Bill_C_Location_ID, + o.Description, + o.POReference, + o.C_Currency_ID, + pt.Name AS PaymentTerm, pt.DocumentNote AS PaymentTermNote, + o.C_Charge_ID, o.ChargeAmt, + o.TotalLines, + o.GrandTotal, o.GrandTotal AS AmtInWords, + o.M_PriceList_ID, + o.IsTaxIncluded, o.Volume, o.Weight, + o.C_Campaign_ID, o.C_Project_ID, o.C_Activity_ID, + o.M_Shipper_ID, o.DeliveryRule, o.DeliveryViaRule, o.PriorityRule, o.InvoiceRule, COALESCE(oi.Logo_ID, ci.Logo_ID) AS Logo_ID +FROM C_Order o + INNER JOIN C_DocType_Trl dt ON (o.C_DocType_ID=dt.C_DocType_ID) + INNER JOIN M_Warehouse wh ON (o.M_Warehouse_ID=wh.M_Warehouse_ID) + INNER JOIN C_PaymentTerm_Trl pt ON (o.C_PaymentTerm_ID=pt.C_PaymentTerm_ID AND dt.AD_Language=pt.AD_Language) + INNER JOIN C_BPartner bp ON (o.C_BPartner_ID=bp.C_BPartner_ID) + LEFT OUTER JOIN C_Greeting_Trl bpg ON (bp.C_Greeting_ID=bpg.C_Greeting_ID AND dt.AD_Language=bpg.AD_Language) + INNER JOIN C_BPartner_Location bpl ON (o.C_BPartner_Location_ID=bpl.C_BPartner_Location_ID) + INNER JOIN C_Location l ON (bpl.C_Location_ID=l.C_Location_ID) + LEFT OUTER JOIN AD_User bpc ON (o.AD_User_ID=bpc.AD_User_ID) + LEFT OUTER JOIN C_Greeting_Trl bpcg ON (bpc.C_Greeting_ID=bpcg.C_Greeting_ID AND dt.AD_Language=bpcg.AD_Language) + INNER JOIN AD_OrgInfo oi ON (o.AD_Org_ID=oi.AD_Org_ID) + INNER JOIN AD_ClientInfo ci ON (o.AD_Client_ID=oi.AD_Client_ID) + LEFT OUTER JOIN AD_User u ON (o.SalesRep_ID=u.AD_User_ID) + LEFT OUTER JOIN C_BPartner ubp ON (u.C_BPartner_ID=ubp.C_BPartner_ID) + INNER JOIN C_BPartner bbp ON (o.Bill_BPartner_ID=bbp.C_BPartner_ID) + INNER JOIN C_BPartner_Location bbpl ON (o.Bill_Location_ID=bbpl.C_BPartner_Location_ID) + LEFT OUTER JOIN AD_User bbpc ON (o.Bill_User_ID=bbpc.AD_User_ID); + + + diff --git a/db/ddlutils/postgresql/views/C_PROJECT_HEADER_V.sql b/db/ddlutils/postgresql/views/C_PROJECT_HEADER_V.sql index 563d1c7ae0..b9822951dc 100644 --- a/db/ddlutils/postgresql/views/C_PROJECT_HEADER_V.sql +++ b/db/ddlutils/postgresql/views/C_PROJECT_HEADER_V.sql @@ -1,50 +1,53 @@ -CREATE OR REPLACE VIEW C_PROJECT_HEADER_V -(AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, - UPDATED, UPDATEDBY, AD_LANGUAGE, C_PROJECT_ID, VALUE, - PROJECTNAME, DESCRIPTION, NOTE, ISSUMMARY, PROJECTCATEGORY, - ORG_LOCATION_ID, TAXID, C_PROJECTTYPE_ID, PROJECTTYPENAME, C_PHASE_ID, - PROJECTPHASENAME, SALESREP_ID, SALESREP_NAME, C_BPARTNER_ID, BPVALUE, - BPTAXID, NAICS, DUNS, BPGREETING, NAME, - NAME2, BPCONTACTGREETING, TITLE, PHONE, CONTACTNAME, - C_LOCATION_ID, REFERENCENO, PAYMENTTERM, PAYMENTTERMNOTE, POREFERENCE, - C_CURRENCY_ID, M_PRICELIST_VERSION_ID, C_CAMPAIGN_ID, PLANNEDAMT, PLANNEDQTY, - PLANNEDMARGINAMT, INVOICEDAMT, INVOICEDQTY, PROJECTBALANCEAMT, ISCOMMITMENT, - COMMITTEDAMT, COMMITTEDQTY, DATECONTRACT, DATEFINISH, ISCOMMITCEILING, - M_WAREHOUSE_ID) -AS -SELECT p.AD_Client_ID, p.AD_Org_ID, p.IsActive, p.Created, p.CreatedBy, p.Updated, p.UpdatedBy, - cast('en_US' as varchar) AS AD_Language, p.C_Project_ID, - p.Value, p.Name AS ProjectName, p.Description, p.Note, p.IsSummary, p.ProjectCategory, - oi.C_Location_ID AS Org_Location_ID, oi.TaxID, - p.C_ProjectType_ID, pjt.Name AS ProjectTypeName, p.C_Phase_ID, pjp.Name AS ProjectPhaseName, - p.SalesRep_ID, COALESCE(ubp.Name, u.Name) AS SalesRep_Name, - p.C_BPartner_ID, bp.Value AS BPValue, bp.TaxID AS BPTaxID, bp.NAICS, bp.DUNS, - bpg.Greeting AS BPGreeting, - bp.Name, bp.Name2, - bpcg.Greeting AS BPContactGreeting, - bpc.Title, bpc.Phone, - NULLIF (bpc.Name, bp.Name) AS ContactName, - bpl.C_Location_ID, - bp.ReferenceNo, - pt.Name AS PaymentTerm, pt.DocumentNote AS PaymentTermNote, - p.POReference, - p.C_Currency_ID, p.M_PriceList_Version_ID, - p.C_Campaign_ID, - p.PlannedAmt, p.PlannedQty, p.PlannedMarginAmt, p.InvoicedAmt, p.InvoicedQty, p.ProjectBalanceAmt, - p.IsCommitment, p.CommittedAmt, p.CommittedQty, p.DateContract, p.DateFinish, p.IsCommitCeiling, - p.M_Warehouse_ID -FROM C_Project p - LEFT OUTER JOIN C_BPartner bp ON (p.C_BPartner_ID=bp.C_BPartner_ID) - INNER JOIN AD_OrgInfo oi ON (p.AD_Org_ID=oi.AD_Org_ID) - LEFT OUTER JOIN C_ProjectType pjt ON (p.C_ProjectType_ID=pjt.C_ProjectType_ID) - LEFT OUTER JOIN C_Phase pjp ON (p.C_Phase_ID=pjp.C_Phase_ID) - LEFT OUTER JOIN AD_User u ON (p.SalesRep_ID=u.AD_User_ID) - LEFT OUTER JOIN C_BPartner ubp ON (u.C_BPartner_ID=ubp.C_BPartner_ID) - LEFT OUTER JOIN C_Greeting bpg on (bp.C_Greeting_ID=bpg.C_Greeting_ID) - LEFT OUTER JOIN AD_User bpc ON (p.AD_User_ID=bpc.AD_User_ID) - LEFT OUTER JOIN C_Greeting bpcg on (bpc.C_Greeting_ID=bpcg.C_Greeting_ID) - LEFT OUTER JOIN C_BPartner_Location bpl ON (p.C_BPartner_Location_ID=bpl.C_BPartner_Location_ID) - LEFT OUTER JOIN C_PaymentTerm pt ON (p.C_PaymentTerm_ID=pt.C_PaymentTerm_ID); - - - +DROP VIEW C_PROJECT_HEADER_V; + +CREATE OR REPLACE VIEW C_PROJECT_HEADER_V +(AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, + UPDATED, UPDATEDBY, AD_LANGUAGE, C_PROJECT_ID, VALUE, + PROJECTNAME, DESCRIPTION, NOTE, ISSUMMARY, PROJECTCATEGORY, + ORG_LOCATION_ID, TAXID, C_PROJECTTYPE_ID, PROJECTTYPENAME, C_PHASE_ID, + PROJECTPHASENAME, SALESREP_ID, SALESREP_NAME, C_BPARTNER_ID, BPVALUE, + BPTAXID, NAICS, DUNS, BPGREETING, NAME, + NAME2, BPCONTACTGREETING, TITLE, PHONE, CONTACTNAME, + C_LOCATION_ID, REFERENCENO, PAYMENTTERM, PAYMENTTERMNOTE, POREFERENCE, + C_CURRENCY_ID, M_PRICELIST_VERSION_ID, C_CAMPAIGN_ID, PLANNEDAMT, PLANNEDQTY, + PLANNEDMARGINAMT, INVOICEDAMT, INVOICEDQTY, PROJECTBALANCEAMT, ISCOMMITMENT, + COMMITTEDAMT, COMMITTEDQTY, DATECONTRACT, DATEFINISH, ISCOMMITCEILING, + M_WAREHOUSE_ID, LOGO_ID) +AS +SELECT p.AD_Client_ID, p.AD_Org_ID, p.IsActive, p.Created, p.CreatedBy, p.Updated, p.UpdatedBy, + cast('en_US' as varchar) AS AD_Language, p.C_Project_ID, + p.Value, p.Name AS ProjectName, p.Description, p.Note, p.IsSummary, p.ProjectCategory, + oi.C_Location_ID AS Org_Location_ID, oi.TaxID, + p.C_ProjectType_ID, pjt.Name AS ProjectTypeName, p.C_Phase_ID, pjp.Name AS ProjectPhaseName, + p.SalesRep_ID, COALESCE(ubp.Name, u.Name) AS SalesRep_Name, + p.C_BPartner_ID, bp.Value AS BPValue, bp.TaxID AS BPTaxID, bp.NAICS, bp.DUNS, + bpg.Greeting AS BPGreeting, + bp.Name, bp.Name2, + bpcg.Greeting AS BPContactGreeting, + bpc.Title, bpc.Phone, + NULLIF (bpc.Name, bp.Name) AS ContactName, + bpl.C_Location_ID, + bp.ReferenceNo, + pt.Name AS PaymentTerm, pt.DocumentNote AS PaymentTermNote, + p.POReference, + p.C_Currency_ID, p.M_PriceList_Version_ID, + p.C_Campaign_ID, + p.PlannedAmt, p.PlannedQty, p.PlannedMarginAmt, p.InvoicedAmt, p.InvoicedQty, p.ProjectBalanceAmt, + p.IsCommitment, p.CommittedAmt, p.CommittedQty, p.DateContract, p.DateFinish, p.IsCommitCeiling, + p.M_Warehouse_ID, COALESCE(oi.Logo_ID, ci.Logo_ID) AS Logo_ID +FROM C_Project p + LEFT OUTER JOIN C_BPartner bp ON (p.C_BPartner_ID=bp.C_BPartner_ID) + INNER JOIN AD_OrgInfo oi ON (p.AD_Org_ID=oi.AD_Org_ID) + INNER JOIN AD_ClientInfo ci ON (p.AD_Client_ID=oi.AD_Client_ID) + LEFT OUTER JOIN C_ProjectType pjt ON (p.C_ProjectType_ID=pjt.C_ProjectType_ID) + LEFT OUTER JOIN C_Phase pjp ON (p.C_Phase_ID=pjp.C_Phase_ID) + LEFT OUTER JOIN AD_User u ON (p.SalesRep_ID=u.AD_User_ID) + LEFT OUTER JOIN C_BPartner ubp ON (u.C_BPartner_ID=ubp.C_BPartner_ID) + LEFT OUTER JOIN C_Greeting bpg on (bp.C_Greeting_ID=bpg.C_Greeting_ID) + LEFT OUTER JOIN AD_User bpc ON (p.AD_User_ID=bpc.AD_User_ID) + LEFT OUTER JOIN C_Greeting bpcg on (bpc.C_Greeting_ID=bpcg.C_Greeting_ID) + LEFT OUTER JOIN C_BPartner_Location bpl ON (p.C_BPartner_Location_ID=bpl.C_BPartner_Location_ID) + LEFT OUTER JOIN C_PaymentTerm pt ON (p.C_PaymentTerm_ID=pt.C_PaymentTerm_ID); + + + diff --git a/db/ddlutils/postgresql/views/C_PROJECT_HEADER_VT.sql b/db/ddlutils/postgresql/views/C_PROJECT_HEADER_VT.sql index 676c6cfd17..b12f0ba847 100644 --- a/db/ddlutils/postgresql/views/C_PROJECT_HEADER_VT.sql +++ b/db/ddlutils/postgresql/views/C_PROJECT_HEADER_VT.sql @@ -1,50 +1,53 @@ -CREATE OR REPLACE VIEW C_PROJECT_HEADER_VT -(AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, - UPDATED, UPDATEDBY, AD_LANGUAGE, C_PROJECT_ID, VALUE, - PROJECTNAME, DESCRIPTION, NOTE, ISSUMMARY, PROJECTCATEGORY, - ORG_LOCATION_ID, TAXID, C_PROJECTTYPE_ID, PROJECTTYPENAME, C_PHASE_ID, - PROJECTPHASENAME, SALESREP_ID, SALESREP_NAME, C_BPARTNER_ID, BPVALUE, - BPTAXID, NAICS, DUNS, BPGREETING, NAME, - NAME2, BPCONTACTGREETING, TITLE, PHONE, CONTACTNAME, - C_LOCATION_ID, REFERENCENO, PAYMENTTERM, PAYMENTTERMNOTE, POREFERENCE, - C_CURRENCY_ID, M_PRICELIST_VERSION_ID, C_CAMPAIGN_ID, PLANNEDAMT, PLANNEDQTY, - PLANNEDMARGINAMT, INVOICEDAMT, INVOICEDQTY, PROJECTBALANCEAMT, ISCOMMITMENT, - COMMITTEDAMT, COMMITTEDQTY, DATECONTRACT, DATEFINISH, ISCOMMITCEILING, - M_WAREHOUSE_ID) -AS -SELECT p.AD_Client_ID, p.AD_Org_ID, p.IsActive, p.Created, p.CreatedBy, p.Updated, p.UpdatedBy, - pt.AD_Language, p.C_Project_ID, - p.Value, p.Name AS ProjectName, p.Description, p.Note, p.IsSummary, p.ProjectCategory, - oi.C_Location_ID AS Org_Location_ID, oi.TaxID, - p.C_ProjectType_ID, pjt.Name AS ProjectTypeName, p.C_Phase_ID, pjp.Name AS ProjectPhaseName, - p.SalesRep_ID, COALESCE(ubp.Name, u.Name) AS SalesRep_Name, - p.C_BPartner_ID, bp.Value AS BPValue, bp.TaxID AS BPTaxID, bp.NAICS, bp.DUNS, - bpg.Greeting AS BPGreeting, - bp.Name, bp.Name2, - bpcg.Greeting AS BPContactGreeting, - bpc.Title, bpc.Phone, - NULLIF (bpc.Name, bp.Name) AS ContactName, - bpl.C_Location_ID, - bp.ReferenceNo, - pt.Name AS PaymentTerm, pt.DocumentNote AS PaymentTermNote, - p.POReference, - p.C_Currency_ID, p.M_PriceList_Version_ID, - p.C_Campaign_ID, - p.PlannedAmt, p.PlannedQty, p.PlannedMarginAmt, p.InvoicedAmt, p.InvoicedQty, p.ProjectBalanceAmt, - p.IsCommitment, p.CommittedAmt, p.CommittedQty, p.DateContract, p.DateFinish, p.IsCommitCeiling, - p.M_Warehouse_ID -FROM C_Project p - LEFT OUTER JOIN C_BPartner bp ON (p.C_BPartner_ID=bp.C_BPartner_ID) - INNER JOIN AD_OrgInfo oi ON (p.AD_Org_ID=oi.AD_Org_ID) - LEFT OUTER JOIN C_PaymentTerm_Trl pt ON (p.C_PaymentTerm_ID=pt.C_PaymentTerm_ID) - LEFT OUTER JOIN C_ProjectType pjt ON (p.C_ProjectType_ID=pjt.C_ProjectType_ID) - LEFT OUTER JOIN C_Phase pjp ON (p.C_Phase_ID=pjp.C_Phase_ID) - LEFT OUTER JOIN AD_User u ON (p.SalesRep_ID=u.AD_User_ID) - LEFT OUTER JOIN C_BPartner ubp ON (u.C_BPartner_ID=ubp.C_BPartner_ID) - LEFT OUTER JOIN C_Greeting bpg on (bp.C_Greeting_ID=bpg.C_Greeting_ID) - LEFT OUTER JOIN AD_User bpc ON (p.AD_User_ID=bpc.AD_User_ID) - LEFT OUTER JOIN C_Greeting bpcg on (bpc.C_Greeting_ID=bpcg.C_Greeting_ID) - LEFT OUTER JOIN C_BPartner_Location bpl ON (p.C_BPartner_Location_ID=bpl.C_BPartner_Location_ID); - - - +DROP VIEW C_PROJECT_HEADER_VT; + +CREATE OR REPLACE VIEW C_PROJECT_HEADER_VT +(AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, + UPDATED, UPDATEDBY, AD_LANGUAGE, C_PROJECT_ID, VALUE, + PROJECTNAME, DESCRIPTION, NOTE, ISSUMMARY, PROJECTCATEGORY, + ORG_LOCATION_ID, TAXID, C_PROJECTTYPE_ID, PROJECTTYPENAME, C_PHASE_ID, + PROJECTPHASENAME, SALESREP_ID, SALESREP_NAME, C_BPARTNER_ID, BPVALUE, + BPTAXID, NAICS, DUNS, BPGREETING, NAME, + NAME2, BPCONTACTGREETING, TITLE, PHONE, CONTACTNAME, + C_LOCATION_ID, REFERENCENO, PAYMENTTERM, PAYMENTTERMNOTE, POREFERENCE, + C_CURRENCY_ID, M_PRICELIST_VERSION_ID, C_CAMPAIGN_ID, PLANNEDAMT, PLANNEDQTY, + PLANNEDMARGINAMT, INVOICEDAMT, INVOICEDQTY, PROJECTBALANCEAMT, ISCOMMITMENT, + COMMITTEDAMT, COMMITTEDQTY, DATECONTRACT, DATEFINISH, ISCOMMITCEILING, + M_WAREHOUSE_ID, LOGO_ID) +AS +SELECT p.AD_Client_ID, p.AD_Org_ID, p.IsActive, p.Created, p.CreatedBy, p.Updated, p.UpdatedBy, + pt.AD_Language, p.C_Project_ID, + p.Value, p.Name AS ProjectName, p.Description, p.Note, p.IsSummary, p.ProjectCategory, + oi.C_Location_ID AS Org_Location_ID, oi.TaxID, + p.C_ProjectType_ID, pjt.Name AS ProjectTypeName, p.C_Phase_ID, pjp.Name AS ProjectPhaseName, + p.SalesRep_ID, COALESCE(ubp.Name, u.Name) AS SalesRep_Name, + p.C_BPartner_ID, bp.Value AS BPValue, bp.TaxID AS BPTaxID, bp.NAICS, bp.DUNS, + bpg.Greeting AS BPGreeting, + bp.Name, bp.Name2, + bpcg.Greeting AS BPContactGreeting, + bpc.Title, bpc.Phone, + NULLIF (bpc.Name, bp.Name) AS ContactName, + bpl.C_Location_ID, + bp.ReferenceNo, + pt.Name AS PaymentTerm, pt.DocumentNote AS PaymentTermNote, + p.POReference, + p.C_Currency_ID, p.M_PriceList_Version_ID, + p.C_Campaign_ID, + p.PlannedAmt, p.PlannedQty, p.PlannedMarginAmt, p.InvoicedAmt, p.InvoicedQty, p.ProjectBalanceAmt, + p.IsCommitment, p.CommittedAmt, p.CommittedQty, p.DateContract, p.DateFinish, p.IsCommitCeiling, + p.M_Warehouse_ID, COALESCE(oi.Logo_ID, ci.Logo_ID) AS Logo_ID +FROM C_Project p + LEFT OUTER JOIN C_BPartner bp ON (p.C_BPartner_ID=bp.C_BPartner_ID) + INNER JOIN AD_OrgInfo oi ON (p.AD_Org_ID=oi.AD_Org_ID) + INNER JOIN AD_ClientInfo ci ON (p.AD_Client_ID=oi.AD_Client_ID) + LEFT OUTER JOIN C_PaymentTerm_Trl pt ON (p.C_PaymentTerm_ID=pt.C_PaymentTerm_ID) + LEFT OUTER JOIN C_ProjectType pjt ON (p.C_ProjectType_ID=pjt.C_ProjectType_ID) + LEFT OUTER JOIN C_Phase pjp ON (p.C_Phase_ID=pjp.C_Phase_ID) + LEFT OUTER JOIN AD_User u ON (p.SalesRep_ID=u.AD_User_ID) + LEFT OUTER JOIN C_BPartner ubp ON (u.C_BPartner_ID=ubp.C_BPartner_ID) + LEFT OUTER JOIN C_Greeting bpg on (bp.C_Greeting_ID=bpg.C_Greeting_ID) + LEFT OUTER JOIN AD_User bpc ON (p.AD_User_ID=bpc.AD_User_ID) + LEFT OUTER JOIN C_Greeting bpcg on (bpc.C_Greeting_ID=bpcg.C_Greeting_ID) + LEFT OUTER JOIN C_BPartner_Location bpl ON (p.C_BPartner_Location_ID=bpl.C_BPartner_Location_ID); + + + diff --git a/db/ddlutils/postgresql/views/DD_ORDER_HEADER_V.sql b/db/ddlutils/postgresql/views/DD_ORDER_HEADER_V.sql index 491a942066..6a85baa98e 100644 --- a/db/ddlutils/postgresql/views/DD_ORDER_HEADER_V.sql +++ b/db/ddlutils/postgresql/views/DD_ORDER_HEADER_V.sql @@ -1,41 +1,43 @@ DROP VIEW DD_ORDER_HEADER_V; -CREATE OR REPLACE VIEW DD_ORDER_HEADER_V -AS -SELECT o.AD_Client_ID, o.AD_Org_ID, o.IsActive, o.Created, o.CreatedBy, o.Updated, o.UpdatedBy, - cast('en_US' as varchar) AS AD_Language, - o.DD_Order_ID,o.C_Order_ID, o.IsSOTrx, o.DocumentNo, o.DocStatus, o.C_DocType_ID, - o.C_BPartner_ID, bp.Value AS BPValue, bp.TaxID AS BPTaxID, bp.NAICS, bp.DUNS, - oi.C_Location_ID AS Org_Location_ID, oi.TaxID, - o.M_Warehouse_ID, wh.C_Location_ID AS Warehouse_Location_ID, - dt.PrintName AS DocumentType, dt.DocumentNote AS DocumentTypeNote, - o.SalesRep_ID, COALESCE(ubp.Name, u.Name) AS SalesRep_Name, - o.DateOrdered, o.DatePromised, - bpg.Greeting AS BPGreeting, - bp.Name, bp.Name2, - bpcg.Greeting AS BPContactGreeting, - bpc.Title, bpc.Phone, - NULLIF (bpc.Name, bp.Name) AS ContactName, - bpl.C_Location_ID, l.Postal || l.Postal_Add AS Postal, - bp.ReferenceNo, - o.Description, - o.POReference, + +CREATE OR REPLACE VIEW DD_ORDER_HEADER_V +AS +SELECT o.AD_Client_ID, o.AD_Org_ID, o.IsActive, o.Created, o.CreatedBy, o.Updated, o.UpdatedBy, + cast('en_US' as varchar) AS AD_Language, + o.DD_Order_ID,o.C_Order_ID, o.IsSOTrx, o.DocumentNo, o.DocStatus, o.C_DocType_ID, + o.C_BPartner_ID, bp.Value AS BPValue, bp.TaxID AS BPTaxID, bp.NAICS, bp.DUNS, + oi.C_Location_ID AS Org_Location_ID, oi.TaxID, + o.M_Warehouse_ID, wh.C_Location_ID AS Warehouse_Location_ID, + dt.PrintName AS DocumentType, dt.DocumentNote AS DocumentTypeNote, + o.SalesRep_ID, COALESCE(ubp.Name, u.Name) AS SalesRep_Name, + o.DateOrdered, o.DatePromised, + bpg.Greeting AS BPGreeting, + bp.Name, bp.Name2, + bpcg.Greeting AS BPContactGreeting, + bpc.Title, bpc.Phone, + NULLIF (bpc.Name, bp.Name) AS ContactName, + bpl.C_Location_ID, l.Postal || l.Postal_Add AS Postal, + bp.ReferenceNo, + o.Description, + o.POReference, o.C_Charge_ID, o.ChargeAmt, - o.Volume, o.Weight, - o.C_Campaign_ID, o.C_Project_ID, o.C_Activity_ID, - o.M_Shipper_ID, o.DeliveryRule, o.DeliveryViaRule, o.PriorityRule -FROM DD_Order o - INNER JOIN C_DocType dt ON (o.C_DocType_ID=dt.C_DocType_ID) - INNER JOIN M_Warehouse wh ON (o.M_Warehouse_ID=wh.M_Warehouse_ID) - INNER JOIN C_BPartner bp ON (o.C_BPartner_ID=bp.C_BPartner_ID) - LEFT OUTER JOIN C_Greeting bpg ON (bp.C_Greeting_ID=bpg.C_Greeting_ID) - INNER JOIN C_BPartner_Location bpl ON (o.C_BPartner_Location_ID=bpl.C_BPartner_Location_ID) - INNER JOIN C_Location l ON (bpl.C_Location_ID=l.C_Location_ID) - LEFT OUTER JOIN AD_User bpc ON (o.AD_User_ID=bpc.AD_User_ID) - LEFT OUTER JOIN C_Greeting bpcg ON (bpc.C_Greeting_ID=bpcg.C_Greeting_ID) - INNER JOIN AD_OrgInfo oi ON (o.AD_Org_ID=oi.AD_Org_ID) - LEFT OUTER JOIN AD_User u ON (o.SalesRep_ID=u.AD_User_ID) - LEFT OUTER JOIN C_BPartner ubp ON (u.C_BPartner_ID=ubp.C_BPartner_ID); - - - - + o.Volume, o.Weight, + o.C_Campaign_ID, o.C_Project_ID, o.C_Activity_ID, + o.M_Shipper_ID, o.DeliveryRule, o.DeliveryViaRule, o.PriorityRule, COALESCE(oi.Logo_ID, ci.Logo_ID) AS Logo_ID +FROM DD_Order o + INNER JOIN C_DocType dt ON (o.C_DocType_ID=dt.C_DocType_ID) + INNER JOIN M_Warehouse wh ON (o.M_Warehouse_ID=wh.M_Warehouse_ID) + INNER JOIN C_BPartner bp ON (o.C_BPartner_ID=bp.C_BPartner_ID) + LEFT OUTER JOIN C_Greeting bpg ON (bp.C_Greeting_ID=bpg.C_Greeting_ID) + INNER JOIN C_BPartner_Location bpl ON (o.C_BPartner_Location_ID=bpl.C_BPartner_Location_ID) + INNER JOIN C_Location l ON (bpl.C_Location_ID=l.C_Location_ID) + LEFT OUTER JOIN AD_User bpc ON (o.AD_User_ID=bpc.AD_User_ID) + LEFT OUTER JOIN C_Greeting bpcg ON (bpc.C_Greeting_ID=bpcg.C_Greeting_ID) + INNER JOIN AD_OrgInfo oi ON (o.AD_Org_ID=oi.AD_Org_ID) + INNER JOIN AD_ClientInfo ci ON (o.AD_Client_ID=oi.AD_Client_ID) + LEFT OUTER JOIN AD_User u ON (o.SalesRep_ID=u.AD_User_ID) + LEFT OUTER JOIN C_BPartner ubp ON (u.C_BPartner_ID=ubp.C_BPartner_ID); + + + + diff --git a/db/ddlutils/postgresql/views/DD_ORDER_HEADER_VT.sql b/db/ddlutils/postgresql/views/DD_ORDER_HEADER_VT.sql index 37f6a02fa3..2228e6be2f 100644 --- a/db/ddlutils/postgresql/views/DD_ORDER_HEADER_VT.sql +++ b/db/ddlutils/postgresql/views/DD_ORDER_HEADER_VT.sql @@ -1,41 +1,43 @@ DROP VIEW DD_ORDER_HEADER_VT; -CREATE OR REPLACE VIEW DD_ORDER_HEADER_VT -AS -SELECT o.AD_Client_ID, o.AD_Org_ID, o.IsActive, o.Created, o.CreatedBy, o.Updated, o.UpdatedBy, - dt.AD_Language,o.DD_Order_ID, - o.C_Order_ID, o.IsSOTrx, o.DocumentNo, o.DocStatus, o.C_DocType_ID, - o.C_BPartner_ID, bp.Value AS BPValue, bp.TaxID AS BPTaxID, bp.NAICS, bp.DUNS, - oi.C_Location_ID AS Org_Location_ID, oi.TaxID, - o.M_Warehouse_ID, wh.C_Location_ID AS Warehouse_Location_ID, - dt.PrintName AS DocumentType, dt.DocumentNote AS DocumentTypeNote, - o.SalesRep_ID, COALESCE(ubp.Name, u.Name) AS SalesRep_Name, - o.DateOrdered, o.DatePromised, - bpg.Greeting AS BPGreeting, - bp.Name, bp.Name2, - bpcg.Greeting AS BPContactGreeting, - bpc.Title, bpc.Phone, - NULLIF (bpc.Name, bp.Name) AS ContactName, - bpl.C_Location_ID, l.Postal || l.Postal_Add AS Postal, - bp.ReferenceNo, - o.Description, - o.POReference, - o.C_Charge_ID, o.ChargeAmt, - o.Volume, o.Weight, - o.C_Campaign_ID, o.C_Project_ID, o.C_Activity_ID, - o.M_Shipper_ID, o.DeliveryRule, o.DeliveryViaRule, o.PriorityRule -FROM DD_Order o - INNER JOIN C_DocType_Trl dt ON (o.C_DocType_ID=dt.C_DocType_ID) - INNER JOIN M_Warehouse wh ON (o.M_Warehouse_ID=wh.M_Warehouse_ID) - INNER JOIN C_BPartner bp ON (o.C_BPartner_ID=bp.C_BPartner_ID) - LEFT OUTER JOIN C_Greeting_Trl bpg ON (bp.C_Greeting_ID=bpg.C_Greeting_ID AND dt.AD_Language=bpg.AD_Language) - INNER JOIN C_BPartner_Location bpl ON (o.C_BPartner_Location_ID=bpl.C_BPartner_Location_ID) - INNER JOIN C_Location l ON (bpl.C_Location_ID=l.C_Location_ID) - LEFT OUTER JOIN AD_User bpc ON (o.AD_User_ID=bpc.AD_User_ID) - LEFT OUTER JOIN C_Greeting_Trl bpcg ON (bpc.C_Greeting_ID=bpcg.C_Greeting_ID AND dt.AD_Language=bpcg.AD_Language) - INNER JOIN AD_OrgInfo oi ON (o.AD_Org_ID=oi.AD_Org_ID) - LEFT OUTER JOIN AD_User u ON (o.SalesRep_ID=u.AD_User_ID) - LEFT OUTER JOIN C_BPartner ubp ON (u.C_BPartner_ID=ubp.C_BPartner_ID); - - - - + +CREATE OR REPLACE VIEW DD_ORDER_HEADER_VT +AS +SELECT o.AD_Client_ID, o.AD_Org_ID, o.IsActive, o.Created, o.CreatedBy, o.Updated, o.UpdatedBy, + dt.AD_Language,o.DD_Order_ID, + o.C_Order_ID, o.IsSOTrx, o.DocumentNo, o.DocStatus, o.C_DocType_ID, + o.C_BPartner_ID, bp.Value AS BPValue, bp.TaxID AS BPTaxID, bp.NAICS, bp.DUNS, + oi.C_Location_ID AS Org_Location_ID, oi.TaxID, + o.M_Warehouse_ID, wh.C_Location_ID AS Warehouse_Location_ID, + dt.PrintName AS DocumentType, dt.DocumentNote AS DocumentTypeNote, + o.SalesRep_ID, COALESCE(ubp.Name, u.Name) AS SalesRep_Name, + o.DateOrdered, o.DatePromised, + bpg.Greeting AS BPGreeting, + bp.Name, bp.Name2, + bpcg.Greeting AS BPContactGreeting, + bpc.Title, bpc.Phone, + NULLIF (bpc.Name, bp.Name) AS ContactName, + bpl.C_Location_ID, l.Postal || l.Postal_Add AS Postal, + bp.ReferenceNo, + o.Description, + o.POReference, + o.C_Charge_ID, o.ChargeAmt, + o.Volume, o.Weight, + o.C_Campaign_ID, o.C_Project_ID, o.C_Activity_ID, + o.M_Shipper_ID, o.DeliveryRule, o.DeliveryViaRule, o.PriorityRule, COALESCE(oi.Logo_ID, ci.Logo_ID) AS Logo_ID +FROM DD_Order o + INNER JOIN C_DocType_Trl dt ON (o.C_DocType_ID=dt.C_DocType_ID) + INNER JOIN M_Warehouse wh ON (o.M_Warehouse_ID=wh.M_Warehouse_ID) + INNER JOIN C_BPartner bp ON (o.C_BPartner_ID=bp.C_BPartner_ID) + LEFT OUTER JOIN C_Greeting_Trl bpg ON (bp.C_Greeting_ID=bpg.C_Greeting_ID AND dt.AD_Language=bpg.AD_Language) + INNER JOIN C_BPartner_Location bpl ON (o.C_BPartner_Location_ID=bpl.C_BPartner_Location_ID) + INNER JOIN C_Location l ON (bpl.C_Location_ID=l.C_Location_ID) + LEFT OUTER JOIN AD_User bpc ON (o.AD_User_ID=bpc.AD_User_ID) + LEFT OUTER JOIN C_Greeting_Trl bpcg ON (bpc.C_Greeting_ID=bpcg.C_Greeting_ID AND dt.AD_Language=bpcg.AD_Language) + INNER JOIN AD_OrgInfo oi ON (o.AD_Org_ID=oi.AD_Org_ID) + INNER JOIN AD_ClientInfo ci ON (o.AD_Client_ID=oi.AD_Client_ID) + LEFT OUTER JOIN AD_User u ON (o.SalesRep_ID=u.AD_User_ID) + LEFT OUTER JOIN C_BPartner ubp ON (u.C_BPartner_ID=ubp.C_BPartner_ID); + + + + diff --git a/db/ddlutils/postgresql/views/M_INOUT_HEADER_V.sql b/db/ddlutils/postgresql/views/M_INOUT_HEADER_V.sql index 9d36135127..c93f4dea42 100644 --- a/db/ddlutils/postgresql/views/M_INOUT_HEADER_V.sql +++ b/db/ddlutils/postgresql/views/M_INOUT_HEADER_V.sql @@ -1,45 +1,48 @@ -CREATE OR REPLACE VIEW M_INOUT_HEADER_V -(AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, - UPDATED, UPDATEDBY, AD_LANGUAGE, M_INOUT_ID, ISSOTRX, - DOCUMENTNO, DOCSTATUS, C_DOCTYPE_ID, C_BPARTNER_ID, BPVALUE, - BPTAXID, NAICS, DUNS, ORG_LOCATION_ID, TAXID, - M_WAREHOUSE_ID, WAREHOUSE_LOCATION_ID, DOCUMENTTYPE, DOCUMENTTYPENOTE, C_ORDER_ID, - MOVEMENTDATE, MOVEMENTTYPE, BPGREETING, NAME, NAME2, - BPCONTACTGREETING, TITLE, PHONE, CONTACTNAME, C_LOCATION_ID, - POSTAL, REFERENCENO, DESCRIPTION, POREFERENCE, DATEORDERED, - VOLUME, WEIGHT, M_SHIPPER_ID, DELIVERYRULE, DELIVERYVIARULE, - PRIORITYRULE) -AS -SELECT io.AD_Client_ID, io.AD_Org_ID, io.IsActive, io.Created, io.CreatedBy, io.Updated, io.UpdatedBy, - cast('en_US' as varchar) AS AD_Language, - io.M_InOut_ID, io.IsSOTrx, io.DocumentNo, io.DocStatus, io.C_DocType_ID, - io.C_BPartner_ID, bp.Value AS BPValue, bp.TaxID AS BPTaxID, bp.NAICS, bp.DUNS, - oi.C_Location_ID AS Org_Location_ID, oi.TaxID, - io.M_Warehouse_ID, wh.C_Location_ID AS Warehouse_Location_ID, - dt.PrintName AS DocumentType, dt.DocumentNote AS DocumentTypeNote, - io.C_Order_ID, - io.MovementDate, io.MovementType, - bpg.Greeting AS BPGreeting, - bp.Name, bp.Name2, - bpcg.Greeting AS BPContactGreeting, - bpc.Title, bpc.Phone, - NULLIF (bpc.Name, bp.Name) AS ContactName, - bpl.C_Location_ID, l.Postal || l.Postal_Add AS Postal, - bp.ReferenceNo, - io.Description, - io.POReference, - io.DateOrdered, io.Volume, io.Weight, - io.M_Shipper_ID, io.DeliveryRule, io.DeliveryViaRule, io.PriorityRule -FROM M_InOut io - INNER JOIN C_DocType dt ON (io.C_DocType_ID=dt.C_DocType_ID) - INNER JOIN C_BPartner bp ON (io.C_BPartner_ID=bp.C_BPartner_ID) - LEFT OUTER JOIN C_Greeting bpg ON (bp.C_Greeting_ID=bpg.C_Greeting_ID) - INNER JOIN C_BPartner_Location bpl ON (io.C_BPartner_Location_ID=bpl.C_BPartner_Location_ID) - INNER JOIN C_Location l ON (bpl.C_Location_ID=l.C_Location_ID) - LEFT OUTER JOIN AD_User bpc ON (io.AD_User_ID=bpc.AD_User_ID) - LEFT OUTER JOIN C_Greeting bpcg ON (bpc.C_Greeting_ID=bpcg.C_Greeting_ID) - INNER JOIN AD_OrgInfo oi ON (io.AD_Org_ID=oi.AD_Org_ID) - INNER JOIN M_Warehouse wh ON (io.M_Warehouse_ID=wh.M_Warehouse_ID); - - - +DROP VIEW M_INOUT_HEADER_V; + +CREATE OR REPLACE VIEW M_INOUT_HEADER_V +(AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, + UPDATED, UPDATEDBY, AD_LANGUAGE, M_INOUT_ID, ISSOTRX, + DOCUMENTNO, DOCSTATUS, C_DOCTYPE_ID, C_BPARTNER_ID, BPVALUE, + BPTAXID, NAICS, DUNS, ORG_LOCATION_ID, TAXID, + M_WAREHOUSE_ID, WAREHOUSE_LOCATION_ID, DOCUMENTTYPE, DOCUMENTTYPENOTE, C_ORDER_ID, + MOVEMENTDATE, MOVEMENTTYPE, BPGREETING, NAME, NAME2, + BPCONTACTGREETING, TITLE, PHONE, CONTACTNAME, C_LOCATION_ID, + POSTAL, REFERENCENO, DESCRIPTION, POREFERENCE, DATEORDERED, + VOLUME, WEIGHT, M_SHIPPER_ID, DELIVERYRULE, DELIVERYVIARULE, + PRIORITYRULE, LOGO_ID) +AS +SELECT io.AD_Client_ID, io.AD_Org_ID, io.IsActive, io.Created, io.CreatedBy, io.Updated, io.UpdatedBy, + cast('en_US' as varchar) AS AD_Language, + io.M_InOut_ID, io.IsSOTrx, io.DocumentNo, io.DocStatus, io.C_DocType_ID, + io.C_BPartner_ID, bp.Value AS BPValue, bp.TaxID AS BPTaxID, bp.NAICS, bp.DUNS, + oi.C_Location_ID AS Org_Location_ID, oi.TaxID, + io.M_Warehouse_ID, wh.C_Location_ID AS Warehouse_Location_ID, + dt.PrintName AS DocumentType, dt.DocumentNote AS DocumentTypeNote, + io.C_Order_ID, + io.MovementDate, io.MovementType, + bpg.Greeting AS BPGreeting, + bp.Name, bp.Name2, + bpcg.Greeting AS BPContactGreeting, + bpc.Title, bpc.Phone, + NULLIF (bpc.Name, bp.Name) AS ContactName, + bpl.C_Location_ID, l.Postal || l.Postal_Add AS Postal, + bp.ReferenceNo, + io.Description, + io.POReference, + io.DateOrdered, io.Volume, io.Weight, + io.M_Shipper_ID, io.DeliveryRule, io.DeliveryViaRule, io.PriorityRule, COALESCE(oi.Logo_ID, ci.Logo_ID) AS Logo_ID +FROM M_InOut io + INNER JOIN C_DocType dt ON (io.C_DocType_ID=dt.C_DocType_ID) + INNER JOIN C_BPartner bp ON (io.C_BPartner_ID=bp.C_BPartner_ID) + LEFT OUTER JOIN C_Greeting bpg ON (bp.C_Greeting_ID=bpg.C_Greeting_ID) + INNER JOIN C_BPartner_Location bpl ON (io.C_BPartner_Location_ID=bpl.C_BPartner_Location_ID) + INNER JOIN C_Location l ON (bpl.C_Location_ID=l.C_Location_ID) + LEFT OUTER JOIN AD_User bpc ON (io.AD_User_ID=bpc.AD_User_ID) + LEFT OUTER JOIN C_Greeting bpcg ON (bpc.C_Greeting_ID=bpcg.C_Greeting_ID) + INNER JOIN AD_OrgInfo oi ON (io.AD_Org_ID=oi.AD_Org_ID) + INNER JOIN AD_ClientInfo ci ON (io.AD_Client_ID=oi.AD_Client_ID) + INNER JOIN M_Warehouse wh ON (io.M_Warehouse_ID=wh.M_Warehouse_ID); + + + diff --git a/db/ddlutils/postgresql/views/M_INOUT_HEADER_VT.sql b/db/ddlutils/postgresql/views/M_INOUT_HEADER_VT.sql index c34d7a02bb..544f28e734 100644 --- a/db/ddlutils/postgresql/views/M_INOUT_HEADER_VT.sql +++ b/db/ddlutils/postgresql/views/M_INOUT_HEADER_VT.sql @@ -1,45 +1,48 @@ -CREATE OR REPLACE VIEW M_INOUT_HEADER_VT -(AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, - UPDATED, UPDATEDBY, AD_LANGUAGE, M_INOUT_ID, ISSOTRX, - DOCUMENTNO, DOCSTATUS, C_DOCTYPE_ID, C_BPARTNER_ID, BPVALUE, - BPTAXID, NAICS, DUNS, ORG_LOCATION_ID, TAXID, - M_WAREHOUSE_ID, WAREHOUSE_LOCATION_ID, DOCUMENTTYPE, DOCUMENTTYPENOTE, C_ORDER_ID, - PHONE, MOVEMENTDATE, MOVEMENTTYPE, BPGREETING, NAME, - NAME2, BPCONTACTGREETING, TITLE, CONTACTNAME, C_LOCATION_ID, - POSTAL, REFERENCENO, DESCRIPTION, POREFERENCE, DATEORDERED, - VOLUME, WEIGHT, M_SHIPPER_ID, DELIVERYRULE, DELIVERYVIARULE, - PRIORITYRULE) -AS -SELECT io.AD_Client_ID, io.AD_Org_ID, io.IsActive, io.Created, io.CreatedBy, io.Updated, io.UpdatedBy, - dt.AD_Language, - io.M_InOut_ID, io.IsSOTrx, io.DocumentNo, io.DocStatus, io.C_DocType_ID, - io.C_BPartner_ID, bp.Value AS BPValue, bp.TaxID AS BPTaxID, bp.NAICS, bp.DUNS, - oi.C_Location_ID AS Org_Location_ID, oi.TaxID, - io.M_Warehouse_ID, wh.C_Location_ID AS Warehouse_Location_ID, - dt.PrintName AS DocumentType, dt.DocumentNote AS DocumentTypeNote, - io.C_Order_ID, bpc.Phone, - io.MovementDate, io.MovementType, - bpg.Greeting AS BPGreeting, - bp.Name, bp.Name2, - bpcg.Greeting AS BPContactGreeting, - bpc.Title, - NULLIF (bpc.Name, bp.Name) AS ContactName, - bpl.C_Location_ID, l.Postal || l.Postal_Add AS Postal, - bp.ReferenceNo, - io.Description, - io.POReference, - io.DateOrdered, io.Volume, io.Weight, - io.M_Shipper_ID, io.DeliveryRule, io.DeliveryViaRule, io.PriorityRule -FROM M_InOut io - INNER JOIN C_DocType_Trl dt ON (io.C_DocType_ID=dt.C_DocType_ID) - INNER JOIN C_BPartner bp ON (io.C_BPartner_ID=bp.C_BPartner_ID) - LEFT OUTER JOIN C_Greeting_Trl bpg ON (bp.C_Greeting_ID=bpg.C_Greeting_ID AND dt.AD_Language=bpg.AD_Language) - INNER JOIN C_BPartner_Location bpl ON (io.C_BPartner_Location_ID=bpl.C_BPartner_Location_ID) - INNER JOIN C_Location l ON (bpl.C_Location_ID=l.C_Location_ID) - LEFT OUTER JOIN AD_User bpc ON (io.AD_User_ID=bpc.AD_User_ID) - LEFT OUTER JOIN C_Greeting_Trl bpcg ON (bpc.C_Greeting_ID=bpcg.C_Greeting_ID AND dt.AD_Language=bpcg.AD_Language) - INNER JOIN AD_OrgInfo oi ON (io.AD_Org_ID=oi.AD_Org_ID) - INNER JOIN M_Warehouse wh ON (io.M_Warehouse_ID=wh.M_Warehouse_ID); - - - +DROP VIEW M_INOUT_HEADER_VT; + +CREATE OR REPLACE VIEW M_INOUT_HEADER_VT +(AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, + UPDATED, UPDATEDBY, AD_LANGUAGE, M_INOUT_ID, ISSOTRX, + DOCUMENTNO, DOCSTATUS, C_DOCTYPE_ID, C_BPARTNER_ID, BPVALUE, + BPTAXID, NAICS, DUNS, ORG_LOCATION_ID, TAXID, + M_WAREHOUSE_ID, WAREHOUSE_LOCATION_ID, DOCUMENTTYPE, DOCUMENTTYPENOTE, C_ORDER_ID, + PHONE, MOVEMENTDATE, MOVEMENTTYPE, BPGREETING, NAME, + NAME2, BPCONTACTGREETING, TITLE, CONTACTNAME, C_LOCATION_ID, + POSTAL, REFERENCENO, DESCRIPTION, POREFERENCE, DATEORDERED, + VOLUME, WEIGHT, M_SHIPPER_ID, DELIVERYRULE, DELIVERYVIARULE, + PRIORITYRULE, LOGO_ID) +AS +SELECT io.AD_Client_ID, io.AD_Org_ID, io.IsActive, io.Created, io.CreatedBy, io.Updated, io.UpdatedBy, + dt.AD_Language, + io.M_InOut_ID, io.IsSOTrx, io.DocumentNo, io.DocStatus, io.C_DocType_ID, + io.C_BPartner_ID, bp.Value AS BPValue, bp.TaxID AS BPTaxID, bp.NAICS, bp.DUNS, + oi.C_Location_ID AS Org_Location_ID, oi.TaxID, + io.M_Warehouse_ID, wh.C_Location_ID AS Warehouse_Location_ID, + dt.PrintName AS DocumentType, dt.DocumentNote AS DocumentTypeNote, + io.C_Order_ID, bpc.Phone, + io.MovementDate, io.MovementType, + bpg.Greeting AS BPGreeting, + bp.Name, bp.Name2, + bpcg.Greeting AS BPContactGreeting, + bpc.Title, + NULLIF (bpc.Name, bp.Name) AS ContactName, + bpl.C_Location_ID, l.Postal || l.Postal_Add AS Postal, + bp.ReferenceNo, + io.Description, + io.POReference, + io.DateOrdered, io.Volume, io.Weight, + io.M_Shipper_ID, io.DeliveryRule, io.DeliveryViaRule, io.PriorityRule, COALESCE(oi.Logo_ID, ci.Logo_ID) AS Logo_ID +FROM M_InOut io + INNER JOIN C_DocType_Trl dt ON (io.C_DocType_ID=dt.C_DocType_ID) + INNER JOIN C_BPartner bp ON (io.C_BPartner_ID=bp.C_BPartner_ID) + LEFT OUTER JOIN C_Greeting_Trl bpg ON (bp.C_Greeting_ID=bpg.C_Greeting_ID AND dt.AD_Language=bpg.AD_Language) + INNER JOIN C_BPartner_Location bpl ON (io.C_BPartner_Location_ID=bpl.C_BPartner_Location_ID) + INNER JOIN C_Location l ON (bpl.C_Location_ID=l.C_Location_ID) + LEFT OUTER JOIN AD_User bpc ON (io.AD_User_ID=bpc.AD_User_ID) + LEFT OUTER JOIN C_Greeting_Trl bpcg ON (bpc.C_Greeting_ID=bpcg.C_Greeting_ID AND dt.AD_Language=bpcg.AD_Language) + INNER JOIN AD_OrgInfo oi ON (io.AD_Org_ID=oi.AD_Org_ID) + INNER JOIN AD_ClientInfo ci ON (io.AD_Client_ID=oi.AD_Client_ID) + INNER JOIN M_Warehouse wh ON (io.M_Warehouse_ID=wh.M_Warehouse_ID); + + + diff --git a/db/ddlutils/postgresql/views/PP_ORDER_BOM_HEADER_V.sql b/db/ddlutils/postgresql/views/PP_ORDER_BOM_HEADER_V.sql index 7f4518c470..31b7f6dc8a 100644 --- a/db/ddlutils/postgresql/views/PP_ORDER_BOM_HEADER_V.sql +++ b/db/ddlutils/postgresql/views/PP_ORDER_BOM_HEADER_V.sql @@ -1,4 +1,5 @@ DROP VIEW PP_Order_BOM_Header_v; + CREATE OR REPLACE VIEW PP_Order_BOM_Header_v AS SELECT o.AD_Client_ID, o.AD_Org_ID, o.IsActive, o.Created, o.CreatedBy, o.Updated, o.UpdatedBy, @@ -15,10 +16,12 @@ SELECT o.AD_Client_ID, o.AD_Org_ID, o.IsActive, o.Created, o.CreatedBy, o.Update o.DateConfirm,o.DateDelivered,o.DateFinish, o.DateFinishSchedule,o.DateOrdered, o.DatePromised,o.QtyReject, o.QtyReserved , o.QtyScrap , o.Yield , o.C_Campaign_ID, o.C_Project_ID, o.C_Activity_ID, --ob.PP_Product_BOM_ID, - ob.BOMType,ob.BOMUse, ob.Description , ob.Help , ob.M_AttributeSetInstance_ID , ob.M_Product_ID, ob.Name , ob.Revision, ob.ValidFrom , ob.ValidTo + ob.BOMType,ob.BOMUse, ob.Description , ob.Help , ob.M_AttributeSetInstance_ID , ob.M_Product_ID, ob.Name , ob.Revision, ob.ValidFrom , ob.ValidTo, + COALESCE(oi.Logo_ID, ci.Logo_ID) AS Logo_ID FROM PP_Order o INNER JOIN C_DocType d ON (o.C_DocType_ID=d.C_DocType_ID) INNER JOIN PP_Order_BOM ob ON (ob.PP_Order_ID=o.PP_Order_ID) INNER JOIN M_Warehouse wh ON (o.M_Warehouse_ID=wh.M_Warehouse_ID) INNER JOIN AD_OrgInfo oi ON (o.AD_Org_ID=oi.AD_Org_ID) - LEFT OUTER JOIN AD_User u ON (o.Planner_ID=u.AD_User_ID); \ No newline at end of file + INNER JOIN AD_ClientInfo ci ON (o.AD_Client_ID=oi.AD_Client_ID) + LEFT OUTER JOIN AD_User u ON (o.Planner_ID=u.AD_User_ID); diff --git a/db/ddlutils/postgresql/views/PP_ORDER_BOM_HEADER_VT.sql b/db/ddlutils/postgresql/views/PP_ORDER_BOM_HEADER_VT.sql index fc9cb8c554..300eac6c0a 100644 --- a/db/ddlutils/postgresql/views/PP_ORDER_BOM_HEADER_VT.sql +++ b/db/ddlutils/postgresql/views/PP_ORDER_BOM_HEADER_VT.sql @@ -1,4 +1,5 @@ DROP VIEW PP_Order_BOM_Header_vt; + CREATE OR REPLACE VIEW PP_Order_BOM_Header_vt AS SELECT o.AD_Client_ID, o.AD_Org_ID, o.IsActive, o.Created, o.CreatedBy, o.Updated, o.UpdatedBy, @@ -15,11 +16,13 @@ SELECT o.AD_Client_ID, o.AD_Org_ID, o.IsActive, o.Created, o.CreatedBy, o.Update o.DateConfirm,o.DateDelivered,o.DateFinish, o.DateFinishSchedule,o.DateOrdered, o.DatePromised,o.QtyReject, o.QtyReserved , o.QtyScrap , o.Yield , o.C_Campaign_ID, o.C_Project_ID, o.C_Activity_ID, --ob.PP_Product_BOM_ID, - ob.BOMType,ob.BOMUse, obt.Description , obt.Help , ob.M_AttributeSetInstance_ID , ob.M_Product_ID, obt.Name , ob.Revision, ob.ValidFrom , ob.ValidTo + ob.BOMType,ob.BOMUse, obt.Description , obt.Help , ob.M_AttributeSetInstance_ID , ob.M_Product_ID, obt.Name , ob.Revision, ob.ValidFrom , ob.ValidTo, + COALESCE(oi.Logo_ID, ci.Logo_ID) AS Logo_ID FROM PP_Order o INNER JOIN C_DocType_Trl dt ON (o.C_DocType_ID=dt.C_DocType_ID) INNER JOIN PP_Order_BOM ob ON (ob.PP_Order_ID=o.PP_Order_ID) INNER JOIN PP_Order_BOM_Trl obt ON (obt.PP_Order_BOM_ID=ob.PP_Order_BOM_ID) INNER JOIN M_Warehouse wh ON (o.M_Warehouse_ID=wh.M_Warehouse_ID) INNER JOIN AD_OrgInfo oi ON (o.AD_Org_ID=oi.AD_Org_ID) - LEFT OUTER JOIN AD_User u ON (o.Planner_ID=u.AD_User_ID); \ No newline at end of file + INNER JOIN AD_ClientInfo ci ON (o.AD_Client_ID=oi.AD_Client_ID) + LEFT OUTER JOIN AD_User u ON (o.Planner_ID=u.AD_User_ID); diff --git a/db/ddlutils/postgresql/views/PP_ORDER_HEADER_V.sql b/db/ddlutils/postgresql/views/PP_ORDER_HEADER_V.sql index 4a552f26fb..67f9d72213 100755 --- a/db/ddlutils/postgresql/views/PP_ORDER_HEADER_V.sql +++ b/db/ddlutils/postgresql/views/PP_ORDER_HEADER_V.sql @@ -1,4 +1,5 @@ DROP VIEW PP_Order_Header_v; + CREATE OR REPLACE VIEW PP_Order_Header_v AS SELECT o.AD_Client_ID, o.AD_Org_ID, o.IsActive, o.Created, o.CreatedBy, o.Updated, o.UpdatedBy, @@ -12,12 +13,14 @@ SELECT o.AD_Client_ID, o.AD_Org_ID, o.IsActive, o.Created, o.CreatedBy, o.Update o.M_Product_ID,o.M_AttributeSetInstance_ID,o.C_UOM_ID,o.S_Resource_ID,o.PP_Product_BOM_ID,o.AD_Workflow_ID, o.Assay, o.C_OrderLine_ID, o.PriorityRule , o.QtyBatchSize , o.QtyBatchs, o.QtyDelivered, o.QtyEntered, o.QtyOrdered, o.DateConfirm,o.DateDelivered,o.DateFinish, o.DateFinishSchedule,o.DateOrdered, o.DatePromised,o.QtyReject, o.QtyReserved , o.QtyScrap , o.Yield , - o.C_Campaign_ID, o.C_Project_ID, o.C_Activity_ID, o.User1_ID , o.User2_ID , o.AD_OrgTrx_ID ,o.C_DocTypeTarget_ID,o.ScheduleType , o.IsApproved , o.DocAction , o.Posted , o.IsPrinted, o.OrderType + o.C_Campaign_ID, o.C_Project_ID, o.C_Activity_ID, o.User1_ID , o.User2_ID , o.AD_OrgTrx_ID ,o.C_DocTypeTarget_ID,o.ScheduleType , o.IsApproved , o.DocAction , o.Posted , o.IsPrinted, o.OrderType, + COALESCE(oi.Logo_ID, ci.Logo_ID) AS Logo_ID FROM PP_Order o INNER JOIN C_DocType dt ON (o.C_DocType_ID=dt.C_DocType_ID) INNER JOIN M_Warehouse wh ON (o.M_Warehouse_ID=wh.M_Warehouse_ID) INNER JOIN AD_OrgInfo oi ON (o.AD_Org_ID=oi.AD_Org_ID) + INNER JOIN AD_ClientInfo ci ON (o.AD_Client_ID=oi.AD_Client_ID) LEFT OUTER JOIN AD_User u ON (o.Planner_ID=u.AD_User_ID); - \ No newline at end of file + diff --git a/db/ddlutils/postgresql/views/PP_ORDER_HEADER_VT.sql b/db/ddlutils/postgresql/views/PP_ORDER_HEADER_VT.sql index 2fd992f380..c9c0e6240b 100755 --- a/db/ddlutils/postgresql/views/PP_ORDER_HEADER_VT.sql +++ b/db/ddlutils/postgresql/views/PP_ORDER_HEADER_VT.sql @@ -1,4 +1,5 @@ DROP VIEW PP_Order_Header_vt; + CREATE OR REPLACE VIEW PP_Order_Header_vt AS SELECT o.AD_Client_ID, o.AD_Org_ID, o.IsActive, o.Created, o.CreatedBy, o.Updated, o.UpdatedBy, @@ -12,12 +13,14 @@ SELECT o.AD_Client_ID, o.AD_Org_ID, o.IsActive, o.Created, o.CreatedBy, o.Update o.M_Product_ID,o.M_AttributeSetInstance_ID,o.C_UOM_ID,o.S_Resource_ID,o.PP_Product_BOM_ID,o.AD_Workflow_ID, o.Assay, o.C_OrderLine_ID, o.PriorityRule , o.QtyBatchSize , o.QtyBatchs, o.QtyDelivered, o.QtyEntered, o.QtyOrdered, o.DateConfirm,o.DateDelivered,o.DateFinish, o.DateFinishSchedule,o.DateOrdered, o.DatePromised,o.QtyReject, o.QtyReserved , o.QtyScrap , o.Yield , - o.C_Campaign_ID, o.C_Project_ID, o.C_Activity_ID, o.User1_ID , o.User2_ID , o.AD_OrgTrx_ID ,o.C_DocTypeTarget_ID,o.ScheduleType , o.IsApproved , o.DocAction , o.Posted , o.IsPrinted, o.OrderType + o.C_Campaign_ID, o.C_Project_ID, o.C_Activity_ID, o.User1_ID , o.User2_ID , o.AD_OrgTrx_ID ,o.C_DocTypeTarget_ID,o.ScheduleType , o.IsApproved , o.DocAction , o.Posted , o.IsPrinted, o.OrderType, + COALESCE(oi.Logo_ID, ci.Logo_ID) AS Logo_ID FROM PP_Order o INNER JOIN C_DocType_trl dt ON (o.C_DocType_ID=dt.C_DocType_ID) INNER JOIN M_Warehouse wh ON (o.M_Warehouse_ID=wh.M_Warehouse_ID) INNER JOIN AD_OrgInfo oi ON (o.AD_Org_ID=oi.AD_Org_ID) + INNER JOIN AD_ClientInfo ci ON (o.AD_Client_ID=oi.AD_Client_ID) LEFT OUTER JOIN AD_User u ON (o.Planner_ID=u.AD_User_ID); - \ No newline at end of file + diff --git a/db/ddlutils/postgresql/views/PP_ORDER_WORKFLOW_HEADER_V.sql b/db/ddlutils/postgresql/views/PP_ORDER_WORKFLOW_HEADER_V.sql index aeb7a9c675..f3fd75fefb 100644 --- a/db/ddlutils/postgresql/views/PP_ORDER_WORKFLOW_HEADER_V.sql +++ b/db/ddlutils/postgresql/views/PP_ORDER_WORKFLOW_HEADER_V.sql @@ -1,4 +1,5 @@ DROP VIEW PP_Order_Workflow_Header_v; + CREATE OR REPLACE VIEW PP_Order_Workflow_Header_v AS SELECT o.AD_Client_ID, o.AD_Org_ID, o.IsActive, o.Created, o.CreatedBy, o.Updated, o.UpdatedBy, @@ -21,10 +22,11 @@ SELECT o.AD_Client_ID, o.AD_Org_ID, o.IsActive, o.Created, o.CreatedBy, o.Update ow.Name ,ow.Description ,ow.Help, ow.Author, ow.Cost, ow.DocumentNo , ow.Duration, ow.DurationUnit , ow.Version, ow.ValidFrom , ow.ValidTo , ow.MovingTime, ow.OverlapUnits , ow.PublishStatus , ow.QueuingTime , ow.SetupTime , ow.UnitsCycles, - ow.WaitingTime , ow.WorkflowType, ow.WorkingTime , ow.Yield + ow.WaitingTime , ow.WorkflowType, ow.WorkingTime , ow.Yield, COALESCE(oi.Logo_ID, ci.Logo_ID) AS Logo_ID FROM PP_Order o INNER JOIN PP_Order_Workflow ow ON (ow.PP_Order_ID=o.PP_Order_ID) INNER JOIN C_DocType d ON (o.C_DocType_ID=d.C_DocType_ID) INNER JOIN M_Warehouse wh ON (o.M_Warehouse_ID=wh.M_Warehouse_ID) INNER JOIN AD_OrgInfo oi ON (o.AD_Org_ID=oi.AD_Org_ID) - LEFT OUTER JOIN AD_User u ON (o.Planner_ID=u.AD_User_ID); \ No newline at end of file + INNER JOIN AD_ClientInfo ci ON (o.AD_Client_ID=oi.AD_Client_ID) + LEFT OUTER JOIN AD_User u ON (o.Planner_ID=u.AD_User_ID); diff --git a/db/ddlutils/postgresql/views/PP_ORDER_WORKFLOW_HEADER_VT.sql b/db/ddlutils/postgresql/views/PP_ORDER_WORKFLOW_HEADER_VT.sql index e133b37f30..a8dbe6b0dd 100644 --- a/db/ddlutils/postgresql/views/PP_ORDER_WORKFLOW_HEADER_VT.sql +++ b/db/ddlutils/postgresql/views/PP_ORDER_WORKFLOW_HEADER_VT.sql @@ -1,4 +1,5 @@ DROP VIEW PP_Order_Workflow_Header_vt; + CREATE OR REPLACE VIEW PP_Order_Workflow_Header_vt AS SELECT o.AD_Client_ID, o.AD_Org_ID, o.IsActive, o.Created, o.CreatedBy, o.Updated, o.UpdatedBy, @@ -20,11 +21,12 @@ SELECT o.AD_Client_ID, o.AD_Org_ID, o.IsActive, o.Created, o.CreatedBy, o.Update -- Order Workflow Field ow.Author, ow.Cost, ow.DocumentNo , ow.Duration, ow.DurationUnit, ow.Version, ow.ValidFrom , ow.ValidTo , ow.MovingTime, ow.OverlapUnits, ow.AD_Workflow_ID, ow.PublishStatus , ow.QueuingTime , ow.SetupTime , ow.UnitsCycles, - ow.WaitingTime , ow.WorkflowType , ow.WorkingTime , ow.Yield + ow.WaitingTime , ow.WorkflowType , ow.WorkingTime , ow.Yield, COALESCE(oi.Logo_ID, ci.Logo_ID) AS Logo_ID FROM PP_Order o INNER JOIN PP_Order_Workflow ow ON (ow.PP_Order_ID=o.PP_Order_ID) INNER JOIN PP_Order_Workflow_Trl owt ON (owt.PP_Order_Workflow_ID=ow.PP_Order_Workflow_ID) INNER JOIN C_DocType dt ON (o.C_DocType_ID=dt.C_DocType_ID) INNER JOIN M_Warehouse wh ON (o.M_Warehouse_ID=wh.M_Warehouse_ID) INNER JOIN AD_OrgInfo oi ON (o.AD_Org_ID=oi.AD_Org_ID) - LEFT OUTER JOIN AD_User u ON (o.Planner_ID=u.AD_User_ID); \ No newline at end of file + INNER JOIN AD_ClientInfo ci ON (o.AD_Client_ID=oi.AD_Client_ID) + LEFT OUTER JOIN AD_User u ON (o.Planner_ID=u.AD_User_ID); diff --git a/migration/353a-trunk/oracle/559_FR2851987LogoInHeaderViews.sql b/migration/353a-trunk/oracle/559_FR2851987LogoInHeaderViews.sql new file mode 100644 index 0000000000..a750d05898 --- /dev/null +++ b/migration/353a-trunk/oracle/559_FR2851987LogoInHeaderViews.sql @@ -0,0 +1,829 @@ +CREATE OR REPLACE VIEW C_DUNNING_HEADER_V +(AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, + UPDATED, UPDATEDBY, AD_LANGUAGE, C_DUNNINGRUN_ID, C_DUNNINGRUNENTRY_ID, + DUNNINGDATE, PRINTNAME, DOCUMENTNOTE, C_BPARTNER_ID, BPVALUE, + BPTAXID, NAICS, DUNS, ORG_LOCATION_ID, TAXID, + SALESREP_ID, SALESREP_NAME, BPGREETING, NAME, NAME2, + BPCONTACTGREETING, TITLE, PHONE, CONTACTNAME, C_LOCATION_ID, + REFERENCENO, POSTAL, AMT, QTY, NOTE, LOGO_ID) +AS +SELECT dr.AD_Client_ID, dr.AD_Org_ID, dr.IsActive, dr.Created, dr.CreatedBy, dr.Updated, dr.UpdatedBy, + cast('en_US' as varchar2(6)) AS AD_Language, dr.C_DunningRun_ID, C_DunningRunEntry_ID, + dr.DunningDate, dl.PrintName, dl.Note AS DocumentNote, + dre.C_BPartner_ID, bp.Value AS BPValue, bp.TaxID AS BPTaxID, bp.NAICS, bp.DUNS, + oi.C_Location_ID AS Org_Location_ID, oi.TaxID, + dre.SalesRep_ID, COALESCE(ubp.Name, u.Name) AS SalesRep_Name, + bpg.Greeting AS BPGreeting, + bp.Name, bp.Name2, + bpcg.Greeting AS BPContactGreeting, + bpc.Title, bpc.Phone, + NULLIF (bpc.Name, bp.Name) AS ContactName, + bpl.C_Location_ID, bp.ReferenceNo, l.Postal || l.Postal_Add AS Postal, + dre.Amt, dre.Qty, dre.Note, COALESCE(oi.Logo_ID, ci.Logo_ID) AS Logo_ID +FROM C_DunningRun dr + INNER JOIN C_DunningLevel dl ON (dr.C_DunningLevel_ID=dl.C_DunningLevel_ID) + INNER JOIN C_DunningRunEntry dre ON (dr.C_DunningRun_ID=dre.C_DunningRun_ID) + INNER JOIN C_BPartner bp ON (dre.C_BPartner_ID=bp.C_BPartner_ID) + LEFT OUTER JOIN C_Greeting bpg on (bp.C_Greeting_ID=bpg.C_Greeting_ID) + INNER JOIN C_BPartner_Location bpl ON (dre.C_BPartner_Location_ID=bpl.C_BPartner_Location_ID) + INNER JOIN C_Location l ON (bpl.C_Location_ID=l.C_Location_ID) + LEFT OUTER JOIN AD_User bpc ON (dre.AD_User_ID=bpc.AD_User_ID) + LEFT OUTER JOIN C_Greeting bpcg on (bpc.C_Greeting_ID=bpcg.C_Greeting_ID) + INNER JOIN AD_OrgInfo oi ON (dr.AD_Org_ID=oi.AD_Org_ID) + INNER JOIN AD_ClientInfo ci ON (dr.AD_Client_ID=ci.AD_Client_ID) + LEFT OUTER JOIN AD_User u ON (dre.SalesRep_ID=u.AD_User_ID) + LEFT OUTER JOIN C_BPartner ubp ON (u.C_BPartner_ID=ubp.C_BPartner_ID); + + + + + +CREATE OR REPLACE VIEW C_DUNNING_HEADER_VT +(AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, + UPDATED, UPDATEDBY, AD_LANGUAGE, C_DUNNINGRUN_ID, C_DUNNINGRUNENTRY_ID, + DUNNINGDATE, PRINTNAME, DOCUMENTNOTE, C_BPARTNER_ID, BPVALUE, + BPTAXID, NAICS, DUNS, ORG_LOCATION_ID, TAXID, + SALESREP_ID, SALESREP_NAME, BPGREETING, NAME, NAME2, + BPCONTACTGREETING, TITLE, PHONE, CONTACTNAME, C_LOCATION_ID, + REFERENCENO, POSTAL, AMT, QTY, NOTE, LOGO_ID) +AS +SELECT dr.AD_Client_ID, dr.AD_Org_ID, dr.IsActive, dr.Created, dr.CreatedBy, dr.Updated, dr.UpdatedBy, + dlt.AD_Language, dr.C_DunningRun_ID, C_DunningRunEntry_ID, + dr.DunningDate, dlt.PrintName, dlt.Note AS DocumentNote, + dre.C_BPartner_ID, bp.Value AS BPValue, bp.TaxID AS BPTaxID, bp.NAICS, bp.DUNS, + oi.C_Location_ID AS Org_Location_ID, oi.TaxID, + dre.SalesRep_ID, COALESCE(ubp.Name, u.Name) AS SalesRep_Name, + bpg.Greeting AS BPGreeting, + bp.Name, bp.Name2, + bpcg.Greeting AS BPContactGreeting, + bpc.Title, bpc.Phone, + NULLIF (bpc.Name, bp.Name) AS ContactName, + bpl.C_Location_ID, bp.ReferenceNo, l.Postal || l.Postal_Add AS Postal, + dre.Amt, dre.Qty, dre.Note, COALESCE(oi.Logo_ID, ci.Logo_ID) AS Logo_ID +FROM C_DunningRun dr + INNER JOIN C_DunningLevel dl ON (dr.C_DunningLevel_ID=dl.C_DunningLevel_ID) + INNER JOIN C_DunningLevel_Trl dlt ON (dl.C_DunningLevel_ID=dlt.C_DunningLevel_ID) + INNER JOIN C_DunningRunEntry dre ON (dr.C_DunningRun_ID=dre.C_DunningRun_ID) + INNER JOIN C_BPartner bp ON (dre.C_BPartner_ID=bp.C_BPartner_ID) + LEFT OUTER JOIN C_Greeting_Trl bpg on (bp.C_Greeting_ID=bpg.C_Greeting_ID + AND dlt.AD_Language=bpg.AD_Language) + INNER JOIN C_BPartner_Location bpl ON (dre.C_BPartner_Location_ID=bpl.C_BPartner_Location_ID) + INNER JOIN C_Location l ON (bpl.C_Location_ID=l.C_Location_ID) + LEFT OUTER JOIN AD_User bpc ON (dre.AD_User_ID=bpc.AD_User_ID) + LEFT OUTER JOIN C_Greeting_Trl bpcg on (bpc.C_Greeting_ID=bpcg.C_Greeting_ID + AND dlt.AD_Language=bpcg.AD_Language) + INNER JOIN AD_OrgInfo oi ON (dr.AD_Org_ID=oi.AD_Org_ID) + INNER JOIN AD_ClientInfo ci ON (dr.AD_Client_ID=ci.AD_Client_ID) + LEFT OUTER JOIN AD_User u ON (dre.SalesRep_ID=u.AD_User_ID) + LEFT OUTER JOIN C_BPartner ubp ON (u.C_BPartner_ID=ubp.C_BPartner_ID); + + + + + +CREATE OR REPLACE VIEW C_INVOICE_HEADER_V +(AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, + UPDATED, UPDATEDBY, AD_LANGUAGE, C_INVOICE_ID, ISSOTRX, + DOCUMENTNO, DOCSTATUS, C_DOCTYPE_ID, C_BPARTNER_ID, BPVALUE, + BPTAXID, NAICS, DUNS, ORG_LOCATION_ID, TAXID, + DOCUMENTTYPE, DOCUMENTTYPENOTE, C_ORDER_ID, SALESREP_ID, SALESREP_NAME, + DATEINVOICED, BPGREETING, NAME, NAME2, BPCONTACTGREETING, + TITLE, PHONE, CONTACTNAME, C_LOCATION_ID, REFERENCENO, + POSTAL, DESCRIPTION, POREFERENCE, DATEORDERED, C_CURRENCY_ID, + PAYMENTTERM, PAYMENTTERMNOTE, C_CHARGE_ID, CHARGEAMT, TOTALLINES, + GRANDTOTAL, AMTINWORDS, M_PRICELIST_ID, ISTAXINCLUDED, C_CAMPAIGN_ID, + C_PROJECT_ID, C_ACTIVITY_ID, ISPAID, LOGO_ID) +AS +SELECT i.AD_Client_ID, i.AD_Org_ID, i.IsActive, i.Created, i.CreatedBy, i.Updated, i.UpdatedBy, + cast('en_US' as varchar2(6)) AS AD_Language, + i.C_Invoice_ID, i.IsSOTrx, i.DocumentNo, i.DocStatus, i.C_DocType_ID, + i.C_BPartner_ID, bp.Value AS BPValue, bp.TaxID AS BPTaxID, bp.NAICS, bp.DUNS, + oi.C_Location_ID AS Org_Location_ID, oi.TaxID, + dt.PrintName AS DocumentType, dt.DocumentNote AS DocumentTypeNote, + i.C_Order_ID, i.SalesRep_ID, COALESCE(ubp.Name, u.Name) AS SalesRep_Name, + i.DateInvoiced, + bpg.Greeting AS BPGreeting, + bp.Name, bp.Name2, + bpcg.Greeting AS BPContactGreeting, + bpc.Title, bpc.Phone, + NULLIF (bpc.Name, bp.Name) AS ContactName, + bpl.C_Location_ID, bp.ReferenceNo, l.Postal || l.Postal_Add AS Postal, + i.Description, + i.POReference, + i.DateOrdered, + i.C_Currency_ID, + pt.Name AS PaymentTerm, pt.DocumentNote AS PaymentTermNote, + i.C_Charge_ID, i.ChargeAmt, + i.TotalLines, + i.GrandTotal, i.GrandTotal AS AmtInWords, + i.M_PriceList_ID, + i.IsTaxIncluded, + i.C_Campaign_ID, + i.C_Project_ID, + i.C_Activity_ID, + i.IsPaid, COALESCE(oi.Logo_ID, ci.Logo_ID) AS Logo_ID +FROM C_Invoice i + INNER JOIN C_DocType dt ON (i.C_DocType_ID=dt.C_DocType_ID) + INNER JOIN C_PaymentTerm pt ON (i.C_PaymentTerm_ID=pt.C_PaymentTerm_ID) + INNER JOIN C_BPartner bp ON (i.C_BPartner_ID=bp.C_BPartner_ID) + LEFT OUTER JOIN C_Greeting bpg on (bp.C_Greeting_ID=bpg.C_Greeting_ID) + INNER JOIN C_BPartner_Location bpl ON (i.C_BPartner_Location_ID=bpl.C_BPartner_Location_ID) + INNER JOIN C_Location l ON (bpl.C_Location_ID=l.C_Location_ID) + LEFT OUTER JOIN AD_User bpc ON (i.AD_User_ID=bpc.AD_User_ID) + LEFT OUTER JOIN C_Greeting bpcg on (bpc.C_Greeting_ID=bpcg.C_Greeting_ID) + INNER JOIN AD_OrgInfo oi ON (i.AD_Org_ID=oi.AD_Org_ID) + INNER JOIN AD_ClientInfo ci ON (i.AD_Client_ID=ci.AD_Client_ID) + LEFT OUTER JOIN AD_User u ON (i.SalesRep_ID=u.AD_User_ID) + LEFT OUTER JOIN C_BPartner ubp ON (u.C_BPartner_ID=ubp.C_BPartner_ID); + + + + + +CREATE OR REPLACE VIEW C_INVOICE_HEADER_VT +(AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, + UPDATED, UPDATEDBY, AD_LANGUAGE, C_INVOICE_ID, ISSOTRX, + DOCUMENTNO, DOCSTATUS, C_DOCTYPE_ID, C_BPARTNER_ID, BPVALUE, + BPTAXID, NAICS, DUNS, ORG_LOCATION_ID, TAXID, + DOCUMENTTYPE, DOCUMENTTYPENOTE, C_ORDER_ID, SALESREP_ID, SALESREP_NAME, + DATEINVOICED, BPGREETING, NAME, NAME2, BPCONTACTGREETING, + TITLE, PHONE, CONTACTNAME, C_LOCATION_ID, REFERENCENO, + POSTAL, DESCRIPTION, POREFERENCE, DATEORDERED, C_CURRENCY_ID, + PAYMENTTERM, PAYMENTTERMNOTE, C_CHARGE_ID, CHARGEAMT, TOTALLINES, + GRANDTOTAL, AMTINWORDS, M_PRICELIST_ID, ISTAXINCLUDED, C_CAMPAIGN_ID, + C_PROJECT_ID, C_ACTIVITY_ID, ISPAID, LOGO_ID) +AS +SELECT i.AD_Client_ID, i.AD_Org_ID, i.IsActive, i.Created, i.CreatedBy, i.Updated, i.UpdatedBy, + dt.AD_Language, + i.C_Invoice_ID, i.IsSOTrx, i.DocumentNo, i.DocStatus, i.C_DocType_ID, + i.C_BPartner_ID, bp.Value AS BPValue, bp.TaxID AS BPTaxID, bp.NAICS, bp.DUNS, + oi.C_Location_ID AS Org_Location_ID, oi.TaxID, + dt.PrintName AS DocumentType, dt.DocumentNote AS DocumentTypeNote, + i.C_Order_ID, i.SalesRep_ID, COALESCE(ubp.Name, u.Name) AS SalesRep_Name, + i.DateInvoiced, + bpg.Greeting AS BPGreeting, + bp.Name, bp.Name2, + bpcg.Greeting AS BPContactGreeting, + bpc.Title, bpc.Phone, + NULLIF (bpc.Name, bp.Name) AS ContactName, + bpl.C_Location_ID, bp.ReferenceNo, l.Postal || l.Postal_Add AS Postal, + i.Description, + i.POReference, + i.DateOrdered, + i.C_Currency_ID, + pt.Name AS PaymentTerm, pt.DocumentNote AS PaymentTermNote, + i.C_Charge_ID, i.ChargeAmt, + i.TotalLines, + i.GrandTotal, i.GrandTotal AS AmtInWords, + i.M_PriceList_ID, + i.IsTaxIncluded, + i.C_Campaign_ID, + i.C_Project_ID, + i.C_Activity_ID, + i.IsPaid, COALESCE(oi.Logo_ID, ci.Logo_ID) AS Logo_ID +FROM C_Invoice i + INNER JOIN C_DocType_Trl dt ON (i.C_DocType_ID=dt.C_DocType_ID) + INNER JOIN C_PaymentTerm_Trl pt ON (i.C_PaymentTerm_ID=pt.C_PaymentTerm_ID AND dt.AD_Language=pt.AD_Language) + INNER JOIN C_BPartner bp ON (i.C_BPartner_ID=bp.C_BPartner_ID) + LEFT OUTER JOIN C_Greeting_Trl bpg on (bp.C_Greeting_ID=bpg.C_Greeting_ID AND dt.AD_Language=bpg.AD_Language) + INNER JOIN C_BPartner_Location bpl ON (i.C_BPartner_Location_ID=bpl.C_BPartner_Location_ID) + INNER JOIN C_Location l ON (bpl.C_Location_ID=l.C_Location_ID) + LEFT OUTER JOIN AD_User bpc ON (i.AD_User_ID=bpc.AD_User_ID) + LEFT OUTER JOIN C_Greeting_Trl bpcg on (bpc.C_Greeting_ID=bpcg.C_Greeting_ID AND dt.AD_Language=bpcg.AD_Language) + INNER JOIN AD_OrgInfo oi ON (i.AD_Org_ID=oi.AD_Org_ID) + INNER JOIN AD_ClientInfo ci ON (i.AD_Client_ID=ci.AD_Client_ID) + LEFT OUTER JOIN AD_User u ON (i.SalesRep_ID=u.AD_User_ID) + LEFT OUTER JOIN C_BPartner ubp ON (u.C_BPartner_ID=ubp.C_BPartner_ID); + + + + + +CREATE OR REPLACE VIEW C_ORDER_HEADER_V +(AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, + UPDATED, UPDATEDBY, AD_LANGUAGE, C_ORDER_ID, ISSOTRX, + DOCUMENTNO, DOCSTATUS, C_DOCTYPE_ID, C_BPARTNER_ID, BPVALUE, + BPTAXID, NAICS, DUNS, ORG_LOCATION_ID, TAXID, + M_WAREHOUSE_ID, WAREHOUSE_LOCATION_ID, DOCUMENTTYPE, DOCUMENTTYPENOTE, SALESREP_ID, + SALESREP_NAME, DATEORDERED, DATEPROMISED, BPGREETING, NAME, + NAME2, BPCONTACTGREETING, TITLE, PHONE, CONTACTNAME, + C_LOCATION_ID, POSTAL, REFERENCENO, BILL_BPARTNER_ID, BILL_LOCATION_ID, + BILL_USER_ID, BILL_BPVALUE, BILL_BPTAXID, BILL_NAME, BILL_NAME2, + BILL_TITLE, BILL_PHONE, BILL_CONTACTNAME, BILL_C_LOCATION_ID, DESCRIPTION, + POREFERENCE, C_CURRENCY_ID, PAYMENTTERM, PAYMENTTERMNOTE, C_CHARGE_ID, + CHARGEAMT, TOTALLINES, GRANDTOTAL, AMTINWORDS, M_PRICELIST_ID, + ISTAXINCLUDED, VOLUME, WEIGHT, C_CAMPAIGN_ID, C_PROJECT_ID, + C_ACTIVITY_ID, M_SHIPPER_ID, DELIVERYRULE, DELIVERYVIARULE, PRIORITYRULE, + INVOICERULE, LOGO_ID) +AS +SELECT o.AD_Client_ID, o.AD_Org_ID, o.IsActive, o.Created, o.CreatedBy, o.Updated, o.UpdatedBy, + cast('en_US' as varchar2(6)) AS AD_Language, + o.C_Order_ID, o.IsSOTrx, o.DocumentNo, o.DocStatus, o.C_DocType_ID, + o.C_BPartner_ID, bp.Value AS BPValue, bp.TaxID AS BPTaxID, bp.NAICS, bp.DUNS, + oi.C_Location_ID AS Org_Location_ID, oi.TaxID, + o.M_Warehouse_ID, wh.C_Location_ID AS Warehouse_Location_ID, + dt.PrintName AS DocumentType, dt.DocumentNote AS DocumentTypeNote, + o.SalesRep_ID, COALESCE(ubp.Name, u.Name) AS SalesRep_Name, + o.DateOrdered, o.DatePromised, + bpg.Greeting AS BPGreeting, + bp.Name, bp.Name2, + bpcg.Greeting AS BPContactGreeting, + bpc.Title, bpc.Phone, + NULLIF (bpc.Name, bp.Name) AS ContactName, + bpl.C_Location_ID, l.Postal || l.Postal_Add AS Postal, + bp.ReferenceNo, + -- Bill to + o.Bill_BPartner_ID, o.Bill_Location_ID, o.Bill_User_ID, + bbp.Value AS Bill_BPValue, bbp.TaxID AS Bill_BPTaxID, + bbp.Name AS Bill_Name, bbp.Name2 AS Bill_Name2, + bbpc.Title AS Bill_Title, bbpc.Phone AS Bill_Phone, + NULLIF (bbpc.Name, bbp.Name) AS Bill_ContactName, + bbpl.C_Location_ID AS Bill_C_Location_ID, + o.Description, + o.POReference, + o.C_Currency_ID, + pt.Name AS PaymentTerm, pt.DocumentNote AS PaymentTermNote, + o.C_Charge_ID, o.ChargeAmt, + o.TotalLines, + o.GrandTotal, o.GrandTotal AS AmtInWords, + o.M_PriceList_ID, + o.IsTaxIncluded, o.Volume, o.Weight, + o.C_Campaign_ID, o.C_Project_ID, o.C_Activity_ID, + o.M_Shipper_ID, o.DeliveryRule, o.DeliveryViaRule, o.PriorityRule, o.InvoiceRule, COALESCE(oi.Logo_ID, ci.Logo_ID) AS Logo_ID +FROM C_Order o + INNER JOIN C_DocType dt ON (o.C_DocType_ID=dt.C_DocType_ID) + INNER JOIN M_Warehouse wh ON (o.M_Warehouse_ID=wh.M_Warehouse_ID) + INNER JOIN C_PaymentTerm pt ON (o.C_PaymentTerm_ID=pt.C_PaymentTerm_ID) + INNER JOIN C_BPartner bp ON (o.C_BPartner_ID=bp.C_BPartner_ID) + LEFT OUTER JOIN C_Greeting bpg ON (bp.C_Greeting_ID=bpg.C_Greeting_ID) + INNER JOIN C_BPartner_Location bpl ON (o.C_BPartner_Location_ID=bpl.C_BPartner_Location_ID) + INNER JOIN C_Location l ON (bpl.C_Location_ID=l.C_Location_ID) + LEFT OUTER JOIN AD_User bpc ON (o.AD_User_ID=bpc.AD_User_ID) + LEFT OUTER JOIN C_Greeting bpcg ON (bpc.C_Greeting_ID=bpcg.C_Greeting_ID) + INNER JOIN AD_OrgInfo oi ON (o.AD_Org_ID=oi.AD_Org_ID) + INNER JOIN AD_ClientInfo ci ON (o.AD_Client_ID=ci.AD_Client_ID) + LEFT OUTER JOIN AD_User u ON (o.SalesRep_ID=u.AD_User_ID) + LEFT OUTER JOIN C_BPartner ubp ON (u.C_BPartner_ID=ubp.C_BPartner_ID) + INNER JOIN C_BPartner bbp ON (o.Bill_BPartner_ID=bbp.C_BPartner_ID) + INNER JOIN C_BPartner_Location bbpl ON (o.Bill_Location_ID=bbpl.C_BPartner_Location_ID) + LEFT OUTER JOIN AD_User bbpc ON (o.Bill_User_ID=bbpc.AD_User_ID); + + + + + +CREATE OR REPLACE VIEW C_ORDER_HEADER_VT +(AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, + UPDATED, UPDATEDBY, AD_LANGUAGE, C_ORDER_ID, ISSOTRX, + DOCUMENTNO, DOCSTATUS, C_DOCTYPE_ID, C_BPARTNER_ID, BPVALUE, + BPTAXID, NAICS, DUNS, ORG_LOCATION_ID, TAXID, + M_WAREHOUSE_ID, WAREHOUSE_LOCATION_ID, DOCUMENTTYPE, DOCUMENTTYPENOTE, SALESREP_ID, + SALESREP_NAME, DATEORDERED, DATEPROMISED, BPGREETING, NAME, + NAME2, BPCONTACTGREETING, TITLE, PHONE, CONTACTNAME, + C_LOCATION_ID, POSTAL, REFERENCENO, BILL_BPARTNER_ID, BILL_LOCATION_ID, + BILL_USER_ID, BILL_BPVALUE, BILL_BPTAXID, BILL_NAME, BILL_NAME2, + BILL_TITLE, BILL_PHONE, BILL_CONTACTNAME, BILL_C_LOCATION_ID, DESCRIPTION, + POREFERENCE, C_CURRENCY_ID, PAYMENTTERM, PAYMENTTERMNOTE, C_CHARGE_ID, + CHARGEAMT, TOTALLINES, GRANDTOTAL, AMTINWORDS, M_PRICELIST_ID, + ISTAXINCLUDED, VOLUME, WEIGHT, C_CAMPAIGN_ID, C_PROJECT_ID, + C_ACTIVITY_ID, M_SHIPPER_ID, DELIVERYRULE, DELIVERYVIARULE, PRIORITYRULE, + INVOICERULE, LOGO_ID) +AS +SELECT o.AD_Client_ID, o.AD_Org_ID, o.IsActive, o.Created, o.CreatedBy, o.Updated, o.UpdatedBy, + dt.AD_Language, + o.C_Order_ID, o.IsSOTrx, o.DocumentNo, o.DocStatus, o.C_DocType_ID, + o.C_BPartner_ID, bp.Value AS BPValue, bp.TaxID AS BPTaxID, bp.NAICS, bp.DUNS, + oi.C_Location_ID AS Org_Location_ID, oi.TaxID, + o.M_Warehouse_ID, wh.C_Location_ID AS Warehouse_Location_ID, + dt.PrintName AS DocumentType, dt.DocumentNote AS DocumentTypeNote, + o.SalesRep_ID, COALESCE(ubp.Name, u.Name) AS SalesRep_Name, + o.DateOrdered, o.DatePromised, + bpg.Greeting AS BPGreeting, + bp.Name, bp.Name2, + bpcg.Greeting AS BPContactGreeting, + bpc.Title, bpc.Phone, + NULLIF (bpc.Name, bp.Name) AS ContactName, + bpl.C_Location_ID, l.Postal || l.Postal_Add AS Postal, + bp.ReferenceNo, + -- Bill to + o.Bill_BPartner_ID, o.Bill_Location_ID, o.Bill_User_ID, + bbp.Value AS Bill_BPValue, bbp.TaxID AS Bill_BPTaxID, + bbp.Name AS Bill_Name, bbp.Name2 AS Bill_Name2, + bbpc.Title AS Bill_Title, bbpc.Phone AS Bill_Phone, + NULLIF (bbpc.Name, bbp.Name) AS Bill_ContactName, + bbpl.C_Location_ID AS Bill_C_Location_ID, + o.Description, + o.POReference, + o.C_Currency_ID, + pt.Name AS PaymentTerm, pt.DocumentNote AS PaymentTermNote, + o.C_Charge_ID, o.ChargeAmt, + o.TotalLines, + o.GrandTotal, o.GrandTotal AS AmtInWords, + o.M_PriceList_ID, + o.IsTaxIncluded, o.Volume, o.Weight, + o.C_Campaign_ID, o.C_Project_ID, o.C_Activity_ID, + o.M_Shipper_ID, o.DeliveryRule, o.DeliveryViaRule, o.PriorityRule, o.InvoiceRule, COALESCE(oi.Logo_ID, ci.Logo_ID) AS Logo_ID +FROM C_Order o + INNER JOIN C_DocType_Trl dt ON (o.C_DocType_ID=dt.C_DocType_ID) + INNER JOIN M_Warehouse wh ON (o.M_Warehouse_ID=wh.M_Warehouse_ID) + INNER JOIN C_PaymentTerm_Trl pt ON (o.C_PaymentTerm_ID=pt.C_PaymentTerm_ID AND dt.AD_Language=pt.AD_Language) + INNER JOIN C_BPartner bp ON (o.C_BPartner_ID=bp.C_BPartner_ID) + LEFT OUTER JOIN C_Greeting_Trl bpg ON (bp.C_Greeting_ID=bpg.C_Greeting_ID AND dt.AD_Language=bpg.AD_Language) + INNER JOIN C_BPartner_Location bpl ON (o.C_BPartner_Location_ID=bpl.C_BPartner_Location_ID) + INNER JOIN C_Location l ON (bpl.C_Location_ID=l.C_Location_ID) + LEFT OUTER JOIN AD_User bpc ON (o.AD_User_ID=bpc.AD_User_ID) + LEFT OUTER JOIN C_Greeting_Trl bpcg ON (bpc.C_Greeting_ID=bpcg.C_Greeting_ID AND dt.AD_Language=bpcg.AD_Language) + INNER JOIN AD_OrgInfo oi ON (o.AD_Org_ID=oi.AD_Org_ID) + INNER JOIN AD_ClientInfo ci ON (o.AD_Client_ID=ci.AD_Client_ID) + LEFT OUTER JOIN AD_User u ON (o.SalesRep_ID=u.AD_User_ID) + LEFT OUTER JOIN C_BPartner ubp ON (u.C_BPartner_ID=ubp.C_BPartner_ID) + INNER JOIN C_BPartner bbp ON (o.Bill_BPartner_ID=bbp.C_BPartner_ID) + INNER JOIN C_BPartner_Location bbpl ON (o.Bill_Location_ID=bbpl.C_BPartner_Location_ID) + LEFT OUTER JOIN AD_User bbpc ON (o.Bill_User_ID=bbpc.AD_User_ID); + + + + + +CREATE OR REPLACE VIEW C_PROJECT_HEADER_V +(AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, + UPDATED, UPDATEDBY, AD_LANGUAGE, C_PROJECT_ID, VALUE, + PROJECTNAME, DESCRIPTION, NOTE, ISSUMMARY, PROJECTCATEGORY, + ORG_LOCATION_ID, TAXID, C_PROJECTTYPE_ID, PROJECTTYPENAME, C_PHASE_ID, + PROJECTPHASENAME, SALESREP_ID, SALESREP_NAME, C_BPARTNER_ID, BPVALUE, + BPTAXID, NAICS, DUNS, BPGREETING, NAME, + NAME2, BPCONTACTGREETING, TITLE, PHONE, CONTACTNAME, + C_LOCATION_ID, REFERENCENO, PAYMENTTERM, PAYMENTTERMNOTE, POREFERENCE, + C_CURRENCY_ID, M_PRICELIST_VERSION_ID, C_CAMPAIGN_ID, PLANNEDAMT, PLANNEDQTY, + PLANNEDMARGINAMT, INVOICEDAMT, INVOICEDQTY, PROJECTBALANCEAMT, ISCOMMITMENT, + COMMITTEDAMT, COMMITTEDQTY, DATECONTRACT, DATEFINISH, ISCOMMITCEILING, + M_WAREHOUSE_ID, LOGO_ID) +AS +SELECT p.AD_Client_ID, p.AD_Org_ID, p.IsActive, p.Created, p.CreatedBy, p.Updated, p.UpdatedBy, + cast('en_US' as varchar2(6)) AS AD_Language, p.C_Project_ID, + p.Value, p.Name AS ProjectName, p.Description, p.Note, p.IsSummary, p.ProjectCategory, + oi.C_Location_ID AS Org_Location_ID, oi.TaxID, + p.C_ProjectType_ID, pjt.Name AS ProjectTypeName, p.C_Phase_ID, pjp.Name AS ProjectPhaseName, + p.SalesRep_ID, COALESCE(ubp.Name, u.Name) AS SalesRep_Name, + p.C_BPartner_ID, bp.Value AS BPValue, bp.TaxID AS BPTaxID, bp.NAICS, bp.DUNS, + bpg.Greeting AS BPGreeting, + bp.Name, bp.Name2, + bpcg.Greeting AS BPContactGreeting, + bpc.Title, bpc.Phone, + NULLIF (bpc.Name, bp.Name) AS ContactName, + bpl.C_Location_ID, + bp.ReferenceNo, + pt.Name AS PaymentTerm, pt.DocumentNote AS PaymentTermNote, + p.POReference, + p.C_Currency_ID, p.M_PriceList_Version_ID, + p.C_Campaign_ID, + p.PlannedAmt, p.PlannedQty, p.PlannedMarginAmt, p.InvoicedAmt, p.InvoicedQty, p.ProjectBalanceAmt, + p.IsCommitment, p.CommittedAmt, p.CommittedQty, p.DateContract, p.DateFinish, p.IsCommitCeiling, + p.M_Warehouse_ID, COALESCE(oi.Logo_ID, ci.Logo_ID) AS Logo_ID +FROM C_Project p + LEFT OUTER JOIN C_BPartner bp ON (p.C_BPartner_ID=bp.C_BPartner_ID) + INNER JOIN AD_OrgInfo oi ON (p.AD_Org_ID=oi.AD_Org_ID) + INNER JOIN AD_ClientInfo ci ON (p.AD_Client_ID=ci.AD_Client_ID) + LEFT OUTER JOIN C_ProjectType pjt ON (p.C_ProjectType_ID=pjt.C_ProjectType_ID) + LEFT OUTER JOIN C_Phase pjp ON (p.C_Phase_ID=pjp.C_Phase_ID) + LEFT OUTER JOIN AD_User u ON (p.SalesRep_ID=u.AD_User_ID) + LEFT OUTER JOIN C_BPartner ubp ON (u.C_BPartner_ID=ubp.C_BPartner_ID) + LEFT OUTER JOIN C_Greeting bpg on (bp.C_Greeting_ID=bpg.C_Greeting_ID) + LEFT OUTER JOIN AD_User bpc ON (p.AD_User_ID=bpc.AD_User_ID) + LEFT OUTER JOIN C_Greeting bpcg on (bpc.C_Greeting_ID=bpcg.C_Greeting_ID) + LEFT OUTER JOIN C_BPartner_Location bpl ON (p.C_BPartner_Location_ID=bpl.C_BPartner_Location_ID) + LEFT OUTER JOIN C_PaymentTerm pt ON (p.C_PaymentTerm_ID=pt.C_PaymentTerm_ID); + + + + + +CREATE OR REPLACE VIEW C_PROJECT_HEADER_VT +(AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, + UPDATED, UPDATEDBY, AD_LANGUAGE, C_PROJECT_ID, VALUE, + PROJECTNAME, DESCRIPTION, NOTE, ISSUMMARY, PROJECTCATEGORY, + ORG_LOCATION_ID, TAXID, C_PROJECTTYPE_ID, PROJECTTYPENAME, C_PHASE_ID, + PROJECTPHASENAME, SALESREP_ID, SALESREP_NAME, C_BPARTNER_ID, BPVALUE, + BPTAXID, NAICS, DUNS, BPGREETING, NAME, + NAME2, BPCONTACTGREETING, TITLE, PHONE, CONTACTNAME, + C_LOCATION_ID, REFERENCENO, PAYMENTTERM, PAYMENTTERMNOTE, POREFERENCE, + C_CURRENCY_ID, M_PRICELIST_VERSION_ID, C_CAMPAIGN_ID, PLANNEDAMT, PLANNEDQTY, + PLANNEDMARGINAMT, INVOICEDAMT, INVOICEDQTY, PROJECTBALANCEAMT, ISCOMMITMENT, + COMMITTEDAMT, COMMITTEDQTY, DATECONTRACT, DATEFINISH, ISCOMMITCEILING, + M_WAREHOUSE_ID, LOGO_ID) +AS +SELECT p.AD_Client_ID, p.AD_Org_ID, p.IsActive, p.Created, p.CreatedBy, p.Updated, p.UpdatedBy, + pt.AD_Language, p.C_Project_ID, + p.Value, p.Name AS ProjectName, p.Description, p.Note, p.IsSummary, p.ProjectCategory, + oi.C_Location_ID AS Org_Location_ID, oi.TaxID, + p.C_ProjectType_ID, pjt.Name AS ProjectTypeName, p.C_Phase_ID, pjp.Name AS ProjectPhaseName, + p.SalesRep_ID, COALESCE(ubp.Name, u.Name) AS SalesRep_Name, + p.C_BPartner_ID, bp.Value AS BPValue, bp.TaxID AS BPTaxID, bp.NAICS, bp.DUNS, + bpg.Greeting AS BPGreeting, + bp.Name, bp.Name2, + bpcg.Greeting AS BPContactGreeting, + bpc.Title, bpc.Phone, + NULLIF (bpc.Name, bp.Name) AS ContactName, + bpl.C_Location_ID, + bp.ReferenceNo, + pt.Name AS PaymentTerm, pt.DocumentNote AS PaymentTermNote, + p.POReference, + p.C_Currency_ID, p.M_PriceList_Version_ID, + p.C_Campaign_ID, + p.PlannedAmt, p.PlannedQty, p.PlannedMarginAmt, p.InvoicedAmt, p.InvoicedQty, p.ProjectBalanceAmt, + p.IsCommitment, p.CommittedAmt, p.CommittedQty, p.DateContract, p.DateFinish, p.IsCommitCeiling, + p.M_Warehouse_ID, COALESCE(oi.Logo_ID, ci.Logo_ID) AS Logo_ID +FROM C_Project p + LEFT OUTER JOIN C_BPartner bp ON (p.C_BPartner_ID=bp.C_BPartner_ID) + INNER JOIN AD_OrgInfo oi ON (p.AD_Org_ID=oi.AD_Org_ID) + INNER JOIN AD_ClientInfo ci ON (p.AD_Client_ID=ci.AD_Client_ID) + LEFT OUTER JOIN C_PaymentTerm_Trl pt ON (p.C_PaymentTerm_ID=pt.C_PaymentTerm_ID) + LEFT OUTER JOIN C_ProjectType pjt ON (p.C_ProjectType_ID=pjt.C_ProjectType_ID) + LEFT OUTER JOIN C_Phase pjp ON (p.C_Phase_ID=pjp.C_Phase_ID) + LEFT OUTER JOIN AD_User u ON (p.SalesRep_ID=u.AD_User_ID) + LEFT OUTER JOIN C_BPartner ubp ON (u.C_BPartner_ID=ubp.C_BPartner_ID) + LEFT OUTER JOIN C_Greeting bpg on (bp.C_Greeting_ID=bpg.C_Greeting_ID) + LEFT OUTER JOIN AD_User bpc ON (p.AD_User_ID=bpc.AD_User_ID) + LEFT OUTER JOIN C_Greeting bpcg on (bpc.C_Greeting_ID=bpcg.C_Greeting_ID) + LEFT OUTER JOIN C_BPartner_Location bpl ON (p.C_BPartner_Location_ID=bpl.C_BPartner_Location_ID); + + + + + +CREATE OR REPLACE VIEW DD_ORDER_HEADER_V +AS +SELECT o.AD_Client_ID, o.AD_Org_ID, o.IsActive, o.Created, o.CreatedBy, o.Updated, o.UpdatedBy, + cast('en_US' as varchar2(6)) AS AD_Language, + o.DD_Order_ID,o.C_Order_ID, o.IsSOTrx, o.DocumentNo, o.DocStatus, o.C_DocType_ID, + o.C_BPartner_ID, bp.Value AS BPValue, bp.TaxID AS BPTaxID, bp.NAICS, bp.DUNS, + oi.C_Location_ID AS Org_Location_ID, oi.TaxID, + o.M_Warehouse_ID, wh.C_Location_ID AS Warehouse_Location_ID, + dt.PrintName AS DocumentType, dt.DocumentNote AS DocumentTypeNote, + o.SalesRep_ID, COALESCE(ubp.Name, u.Name) AS SalesRep_Name, + o.DateOrdered, o.DatePromised, + bpg.Greeting AS BPGreeting, + bp.Name, bp.Name2, + bpcg.Greeting AS BPContactGreeting, + bpc.Title, bpc.Phone, + NULLIF (bpc.Name, bp.Name) AS ContactName, + bpl.C_Location_ID, l.Postal || l.Postal_Add AS Postal, + bp.ReferenceNo, + o.Description, + o.POReference, + o.C_Charge_ID, o.ChargeAmt, + o.Volume, o.Weight, + o.C_Campaign_ID, o.C_Project_ID, o.C_Activity_ID, + o.M_Shipper_ID, o.DeliveryRule, o.DeliveryViaRule, o.PriorityRule, COALESCE(oi.Logo_ID, ci.Logo_ID) AS Logo_ID +FROM DD_Order o + INNER JOIN C_DocType dt ON (o.C_DocType_ID=dt.C_DocType_ID) + INNER JOIN M_Warehouse wh ON (o.M_Warehouse_ID=wh.M_Warehouse_ID) + INNER JOIN C_BPartner bp ON (o.C_BPartner_ID=bp.C_BPartner_ID) + LEFT OUTER JOIN C_Greeting bpg ON (bp.C_Greeting_ID=bpg.C_Greeting_ID) + INNER JOIN C_BPartner_Location bpl ON (o.C_BPartner_Location_ID=bpl.C_BPartner_Location_ID) + INNER JOIN C_Location l ON (bpl.C_Location_ID=l.C_Location_ID) + LEFT OUTER JOIN AD_User bpc ON (o.AD_User_ID=bpc.AD_User_ID) + LEFT OUTER JOIN C_Greeting bpcg ON (bpc.C_Greeting_ID=bpcg.C_Greeting_ID) + INNER JOIN AD_OrgInfo oi ON (o.AD_Org_ID=oi.AD_Org_ID) + INNER JOIN AD_ClientInfo ci ON (o.AD_Client_ID=ci.AD_Client_ID) + LEFT OUTER JOIN AD_User u ON (o.SalesRep_ID=u.AD_User_ID) + LEFT OUTER JOIN C_BPartner ubp ON (u.C_BPartner_ID=ubp.C_BPartner_ID); + + +CREATE OR REPLACE VIEW DD_ORDER_HEADER_VT +AS +SELECT o.AD_Client_ID, o.AD_Org_ID, o.IsActive, o.Created, o.CreatedBy, o.Updated, o.UpdatedBy, + dt.AD_Language,o.DD_Order_ID, + o.C_Order_ID, o.IsSOTrx, o.DocumentNo, o.DocStatus, o.C_DocType_ID, + o.C_BPartner_ID, bp.Value AS BPValue, bp.TaxID AS BPTaxID, bp.NAICS, bp.DUNS, + oi.C_Location_ID AS Org_Location_ID, oi.TaxID, + o.M_Warehouse_ID, wh.C_Location_ID AS Warehouse_Location_ID, + dt.PrintName AS DocumentType, dt.DocumentNote AS DocumentTypeNote, + o.SalesRep_ID, COALESCE(ubp.Name, u.Name) AS SalesRep_Name, + o.DateOrdered, o.DatePromised, + bpg.Greeting AS BPGreeting, + bp.Name, bp.Name2, + bpcg.Greeting AS BPContactGreeting, + bpc.Title, bpc.Phone, + NULLIF (bpc.Name, bp.Name) AS ContactName, + bpl.C_Location_ID, l.Postal || l.Postal_Add AS Postal, + bp.ReferenceNo, + o.Description, + o.POReference, + o.C_Charge_ID, o.ChargeAmt, + o.Volume, o.Weight, + o.C_Campaign_ID, o.C_Project_ID, o.C_Activity_ID, + o.M_Shipper_ID, o.DeliveryRule, o.DeliveryViaRule, o.PriorityRule, COALESCE(oi.Logo_ID, ci.Logo_ID) AS Logo_ID +FROM DD_Order o + INNER JOIN C_DocType_Trl dt ON (o.C_DocType_ID=dt.C_DocType_ID) + INNER JOIN M_Warehouse wh ON (o.M_Warehouse_ID=wh.M_Warehouse_ID) + INNER JOIN C_BPartner bp ON (o.C_BPartner_ID=bp.C_BPartner_ID) + LEFT OUTER JOIN C_Greeting_Trl bpg ON (bp.C_Greeting_ID=bpg.C_Greeting_ID AND dt.AD_Language=bpg.AD_Language) + INNER JOIN C_BPartner_Location bpl ON (o.C_BPartner_Location_ID=bpl.C_BPartner_Location_ID) + INNER JOIN C_Location l ON (bpl.C_Location_ID=l.C_Location_ID) + LEFT OUTER JOIN AD_User bpc ON (o.AD_User_ID=bpc.AD_User_ID) + LEFT OUTER JOIN C_Greeting_Trl bpcg ON (bpc.C_Greeting_ID=bpcg.C_Greeting_ID AND dt.AD_Language=bpcg.AD_Language) + INNER JOIN AD_OrgInfo oi ON (o.AD_Org_ID=oi.AD_Org_ID) + INNER JOIN AD_ClientInfo ci ON (o.AD_Client_ID=ci.AD_Client_ID) + LEFT OUTER JOIN AD_User u ON (o.SalesRep_ID=u.AD_User_ID) + LEFT OUTER JOIN C_BPartner ubp ON (u.C_BPartner_ID=ubp.C_BPartner_ID); + + + + + + +CREATE OR REPLACE VIEW M_INOUT_HEADER_V +(AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, + UPDATED, UPDATEDBY, AD_LANGUAGE, M_INOUT_ID, ISSOTRX, + DOCUMENTNO, DOCSTATUS, C_DOCTYPE_ID, C_BPARTNER_ID, BPVALUE, + BPTAXID, NAICS, DUNS, ORG_LOCATION_ID, TAXID, + M_WAREHOUSE_ID, WAREHOUSE_LOCATION_ID, DOCUMENTTYPE, DOCUMENTTYPENOTE, C_ORDER_ID, + MOVEMENTDATE, MOVEMENTTYPE, BPGREETING, NAME, NAME2, + BPCONTACTGREETING, TITLE, PHONE, CONTACTNAME, C_LOCATION_ID, + POSTAL, REFERENCENO, DESCRIPTION, POREFERENCE, DATEORDERED, + VOLUME, WEIGHT, M_SHIPPER_ID, DELIVERYRULE, DELIVERYVIARULE, + PRIORITYRULE, LOGO_ID) +AS +SELECT io.AD_Client_ID, io.AD_Org_ID, io.IsActive, io.Created, io.CreatedBy, io.Updated, io.UpdatedBy, + cast('en_US' as varchar2(6)) AS AD_Language, + io.M_InOut_ID, io.IsSOTrx, io.DocumentNo, io.DocStatus, io.C_DocType_ID, + io.C_BPartner_ID, bp.Value AS BPValue, bp.TaxID AS BPTaxID, bp.NAICS, bp.DUNS, + oi.C_Location_ID AS Org_Location_ID, oi.TaxID, + io.M_Warehouse_ID, wh.C_Location_ID AS Warehouse_Location_ID, + dt.PrintName AS DocumentType, dt.DocumentNote AS DocumentTypeNote, + io.C_Order_ID, + io.MovementDate, io.MovementType, + bpg.Greeting AS BPGreeting, + bp.Name, bp.Name2, + bpcg.Greeting AS BPContactGreeting, + bpc.Title, bpc.Phone, + NULLIF (bpc.Name, bp.Name) AS ContactName, + bpl.C_Location_ID, l.Postal || l.Postal_Add AS Postal, + bp.ReferenceNo, + io.Description, + io.POReference, + io.DateOrdered, io.Volume, io.Weight, + io.M_Shipper_ID, io.DeliveryRule, io.DeliveryViaRule, io.PriorityRule, COALESCE(oi.Logo_ID, ci.Logo_ID) AS Logo_ID +FROM M_InOut io + INNER JOIN C_DocType dt ON (io.C_DocType_ID=dt.C_DocType_ID) + INNER JOIN C_BPartner bp ON (io.C_BPartner_ID=bp.C_BPartner_ID) + LEFT OUTER JOIN C_Greeting bpg ON (bp.C_Greeting_ID=bpg.C_Greeting_ID) + INNER JOIN C_BPartner_Location bpl ON (io.C_BPartner_Location_ID=bpl.C_BPartner_Location_ID) + INNER JOIN C_Location l ON (bpl.C_Location_ID=l.C_Location_ID) + LEFT OUTER JOIN AD_User bpc ON (io.AD_User_ID=bpc.AD_User_ID) + LEFT OUTER JOIN C_Greeting bpcg ON (bpc.C_Greeting_ID=bpcg.C_Greeting_ID) + INNER JOIN AD_OrgInfo oi ON (io.AD_Org_ID=oi.AD_Org_ID) + INNER JOIN AD_ClientInfo ci ON (io.AD_Client_ID=ci.AD_Client_ID) + INNER JOIN M_Warehouse wh ON (io.M_Warehouse_ID=wh.M_Warehouse_ID); + + + + + +CREATE OR REPLACE VIEW M_INOUT_HEADER_VT +(AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, + UPDATED, UPDATEDBY, AD_LANGUAGE, M_INOUT_ID, ISSOTRX, + DOCUMENTNO, DOCSTATUS, C_DOCTYPE_ID, C_BPARTNER_ID, BPVALUE, + BPTAXID, NAICS, DUNS, ORG_LOCATION_ID, TAXID, + M_WAREHOUSE_ID, WAREHOUSE_LOCATION_ID, DOCUMENTTYPE, DOCUMENTTYPENOTE, C_ORDER_ID, + PHONE, MOVEMENTDATE, MOVEMENTTYPE, BPGREETING, NAME, + NAME2, BPCONTACTGREETING, TITLE, CONTACTNAME, C_LOCATION_ID, + POSTAL, REFERENCENO, DESCRIPTION, POREFERENCE, DATEORDERED, + VOLUME, WEIGHT, M_SHIPPER_ID, DELIVERYRULE, DELIVERYVIARULE, + PRIORITYRULE, LOGO_ID) +AS +SELECT io.AD_Client_ID, io.AD_Org_ID, io.IsActive, io.Created, io.CreatedBy, io.Updated, io.UpdatedBy, + dt.AD_Language, + io.M_InOut_ID, io.IsSOTrx, io.DocumentNo, io.DocStatus, io.C_DocType_ID, + io.C_BPartner_ID, bp.Value AS BPValue, bp.TaxID AS BPTaxID, bp.NAICS, bp.DUNS, + oi.C_Location_ID AS Org_Location_ID, oi.TaxID, + io.M_Warehouse_ID, wh.C_Location_ID AS Warehouse_Location_ID, + dt.PrintName AS DocumentType, dt.DocumentNote AS DocumentTypeNote, + io.C_Order_ID, bpc.Phone, + io.MovementDate, io.MovementType, + bpg.Greeting AS BPGreeting, + bp.Name, bp.Name2, + bpcg.Greeting AS BPContactGreeting, + bpc.Title, + NULLIF (bpc.Name, bp.Name) AS ContactName, + bpl.C_Location_ID, l.Postal || l.Postal_Add AS Postal, + bp.ReferenceNo, + io.Description, + io.POReference, + io.DateOrdered, io.Volume, io.Weight, + io.M_Shipper_ID, io.DeliveryRule, io.DeliveryViaRule, io.PriorityRule, COALESCE(oi.Logo_ID, ci.Logo_ID) AS Logo_ID +FROM M_InOut io + INNER JOIN C_DocType_Trl dt ON (io.C_DocType_ID=dt.C_DocType_ID) + INNER JOIN C_BPartner bp ON (io.C_BPartner_ID=bp.C_BPartner_ID) + LEFT OUTER JOIN C_Greeting_Trl bpg ON (bp.C_Greeting_ID=bpg.C_Greeting_ID AND dt.AD_Language=bpg.AD_Language) + INNER JOIN C_BPartner_Location bpl ON (io.C_BPartner_Location_ID=bpl.C_BPartner_Location_ID) + INNER JOIN C_Location l ON (bpl.C_Location_ID=l.C_Location_ID) + LEFT OUTER JOIN AD_User bpc ON (io.AD_User_ID=bpc.AD_User_ID) + LEFT OUTER JOIN C_Greeting_Trl bpcg ON (bpc.C_Greeting_ID=bpcg.C_Greeting_ID AND dt.AD_Language=bpcg.AD_Language) + INNER JOIN AD_OrgInfo oi ON (io.AD_Org_ID=oi.AD_Org_ID) + INNER JOIN AD_ClientInfo ci ON (io.AD_Client_ID=ci.AD_Client_ID) + INNER JOIN M_Warehouse wh ON (io.M_Warehouse_ID=wh.M_Warehouse_ID); + + + + + +CREATE OR REPLACE VIEW PP_Order_BOM_Header_v +AS +SELECT o.AD_Client_ID, o.AD_Org_ID, o.IsActive, o.Created, o.CreatedBy, o.Updated, o.UpdatedBy, + cast('en_US' as varchar2(6)) AS AD_Language, + o.PP_Order_ID, o.DocumentNo, o.DocStatus,o.C_DocType_ID, + oi.C_Location_ID AS Org_Location_ID, oi.TaxID, + o.M_Warehouse_ID, wh.C_Location_ID AS Warehouse_Location_ID, + d.PrintName AS DocumentType, d.DocumentNote AS DocumentTypeNote, + o.Planner_ID, u.Name AS SalesRep_Name,o.DateStart, o.DateStartSchedule,o.FloatAfter, o.FloatBefored, o.Line, o.Lot, o.SerNo, + --o.M_Product_ID, + --o.M_AttributeSetInstance_ID, + o.C_UOM_ID,o.S_Resource_ID,o.PP_Product_BOM_ID,o.AD_Workflow_ID, o.Assay, o.C_OrderLine_ID, o.PriorityRule , + o.QtyBatchSize , o.QtyBatchs, o.QtyDelivered, o.QtyEntered, o.QtyOrdered, + o.DateConfirm,o.DateDelivered,o.DateFinish, o.DateFinishSchedule,o.DateOrdered, o.DatePromised,o.QtyReject, o.QtyReserved , o.QtyScrap , o.Yield , + o.C_Campaign_ID, o.C_Project_ID, o.C_Activity_ID, + --ob.PP_Product_BOM_ID, + ob.BOMType,ob.BOMUse, ob.Description , ob.Help , ob.M_AttributeSetInstance_ID , ob.M_Product_ID, ob.Name , ob.Revision, ob.ValidFrom , ob.ValidTo, + COALESCE(oi.Logo_ID, ci.Logo_ID) AS Logo_ID +FROM PP_Order o + INNER JOIN C_DocType d ON (o.C_DocType_ID=d.C_DocType_ID) + INNER JOIN PP_Order_BOM ob ON (ob.PP_Order_ID=o.PP_Order_ID) + INNER JOIN M_Warehouse wh ON (o.M_Warehouse_ID=wh.M_Warehouse_ID) + INNER JOIN AD_OrgInfo oi ON (o.AD_Org_ID=oi.AD_Org_ID) + INNER JOIN AD_ClientInfo ci ON (o.AD_Client_ID=ci.AD_Client_ID) + LEFT OUTER JOIN AD_User u ON (o.Planner_ID=u.AD_User_ID); + + +CREATE OR REPLACE VIEW PP_Order_BOM_Header_vt +AS +SELECT o.AD_Client_ID, o.AD_Org_ID, o.IsActive, o.Created, o.CreatedBy, o.Updated, o.UpdatedBy, + obt.AD_Language, + o.PP_Order_ID, o.DocumentNo, o.DocStatus,o.C_DocType_ID, + oi.C_Location_ID AS Org_Location_ID, oi.TaxID, + o.M_Warehouse_ID, wh.C_Location_ID AS Warehouse_Location_ID, + dt.PrintName AS DocumentType, dt.DocumentNote AS DocumentTypeNote, + o.Planner_ID, u.Name AS SalesRep_Name,o.DateStart, o.DateStartSchedule,o.FloatAfter, o.FloatBefored, o.Line, o.Lot, o.SerNo, + --o.M_Product_ID, + --o.M_AttributeSetInstance_ID, + o.C_UOM_ID,o.S_Resource_ID,o.PP_Product_BOM_ID,o.AD_Workflow_ID, o.Assay, o.C_OrderLine_ID, o.PriorityRule , + o.QtyBatchSize , o.QtyBatchs, o.QtyDelivered, o.QtyEntered, o.QtyOrdered, + o.DateConfirm,o.DateDelivered,o.DateFinish, o.DateFinishSchedule,o.DateOrdered, o.DatePromised,o.QtyReject, o.QtyReserved , o.QtyScrap , o.Yield , + o.C_Campaign_ID, o.C_Project_ID, o.C_Activity_ID, + --ob.PP_Product_BOM_ID, + ob.BOMType,ob.BOMUse, obt.Description , obt.Help , ob.M_AttributeSetInstance_ID , ob.M_Product_ID, obt.Name , ob.Revision, ob.ValidFrom , ob.ValidTo, + COALESCE(oi.Logo_ID, ci.Logo_ID) AS Logo_ID +FROM PP_Order o + INNER JOIN C_DocType_Trl dt ON (o.C_DocType_ID=dt.C_DocType_ID) + INNER JOIN PP_Order_BOM ob ON (ob.PP_Order_ID=o.PP_Order_ID) + INNER JOIN PP_Order_BOM_Trl obt ON (obt.PP_Order_BOM_ID=ob.PP_Order_BOM_ID) + INNER JOIN M_Warehouse wh ON (o.M_Warehouse_ID=wh.M_Warehouse_ID) + INNER JOIN AD_OrgInfo oi ON (o.AD_Org_ID=oi.AD_Org_ID) + INNER JOIN AD_ClientInfo ci ON (o.AD_Client_ID=ci.AD_Client_ID) + LEFT OUTER JOIN AD_User u ON (o.Planner_ID=u.AD_User_ID); + + +CREATE OR REPLACE VIEW PP_Order_Header_v +AS +SELECT o.AD_Client_ID, o.AD_Org_ID, o.IsActive, o.Created, o.CreatedBy, o.Updated, o.UpdatedBy, + cast('en_US' as varchar2(6)) AS AD_Language, + o.PP_Order_ID, o.DocumentNo, o.DocStatus,o.C_DocType_ID, + oi.C_Location_ID AS Org_Location_ID, oi.TaxID, + o.M_Warehouse_ID, wh.C_Location_ID AS Warehouse_Location_ID, + dt.PrintName AS DocumentType, dt.DocumentNote AS DocumentTypeNote, + o.Planner_ID, u.Name AS SalesRep_Name,o.DateStart, o.DateStartSchedule,o.FloatAfter, o.FloatBefored, o.Line, o.Lot, o.SerNo, + o.Description, + o.M_Product_ID,o.M_AttributeSetInstance_ID,o.C_UOM_ID,o.S_Resource_ID,o.PP_Product_BOM_ID,o.AD_Workflow_ID, o.Assay, o.C_OrderLine_ID, o.PriorityRule , + o.QtyBatchSize , o.QtyBatchs, o.QtyDelivered, o.QtyEntered, o.QtyOrdered, + o.DateConfirm,o.DateDelivered,o.DateFinish, o.DateFinishSchedule,o.DateOrdered, o.DatePromised,o.QtyReject, o.QtyReserved , o.QtyScrap , o.Yield , + o.C_Campaign_ID, o.C_Project_ID, o.C_Activity_ID, o.User1_ID , o.User2_ID , o.AD_OrgTrx_ID ,o.C_DocTypeTarget_ID,o.ScheduleType , o.IsApproved , o.DocAction , o.Posted , o.IsPrinted, o.OrderType, + COALESCE(oi.Logo_ID, ci.Logo_ID) AS Logo_ID +FROM PP_Order o + INNER JOIN C_DocType dt ON (o.C_DocType_ID=dt.C_DocType_ID) + INNER JOIN M_Warehouse wh ON (o.M_Warehouse_ID=wh.M_Warehouse_ID) + INNER JOIN AD_OrgInfo oi ON (o.AD_Org_ID=oi.AD_Org_ID) + INNER JOIN AD_ClientInfo ci ON (o.AD_Client_ID=ci.AD_Client_ID) + LEFT OUTER JOIN AD_User u ON (o.Planner_ID=u.AD_User_ID); + + + + + +CREATE OR REPLACE VIEW PP_Order_Header_VT +AS +SELECT o.AD_Client_ID, o.AD_Org_ID, o.IsActive, o.Created, o.CreatedBy, o.Updated, o.UpdatedBy, + dt.AD_Language, + o.PP_Order_ID, o.DocumentNo, o.DocStatus,o.C_DocType_ID, + oi.C_Location_ID AS Org_Location_ID, oi.TaxID, + o.M_Warehouse_ID, wh.C_Location_ID AS Warehouse_Location_ID, + dt.PrintName AS DocumentType, dt.DocumentNote AS DocumentTypeNote, + o.Planner_ID, u.Name AS SalesRep_Name,o.DateStart, o.DateStartSchedule,o.FloatAfter, o.FloatBefored, o.Line, o.Lot, o.SerNo, + o.Description, + o.M_Product_ID,o.M_AttributeSetInstance_ID,o.C_UOM_ID,o.S_Resource_ID,o.PP_Product_BOM_ID,o.AD_Workflow_ID, o.Assay, o.C_OrderLine_ID, o.PriorityRule , + o.QtyBatchSize , o.QtyBatchs, o.QtyDelivered, o.QtyEntered, o.QtyOrdered, + o.DateConfirm,o.DateDelivered,o.DateFinish, o.DateFinishSchedule,o.DateOrdered, o.DatePromised,o.QtyReject, o.QtyReserved , o.QtyScrap , o.Yield , + o.C_Campaign_ID, o.C_Project_ID, o.C_Activity_ID, o.User1_ID , o.User2_ID , o.AD_OrgTrx_ID ,o.C_DocTypeTarget_ID,o.ScheduleType , o.IsApproved , o.DocAction , o.Posted , o.IsPrinted, o.OrderType, + COALESCE(oi.Logo_ID, ci.Logo_ID) AS Logo_ID +FROM PP_Order o + INNER JOIN C_DocType_trl dt ON (o.C_DocType_ID=dt.C_DocType_ID) + INNER JOIN M_Warehouse wh ON (o.M_Warehouse_ID=wh.M_Warehouse_ID) + INNER JOIN AD_OrgInfo oi ON (o.AD_Org_ID=oi.AD_Org_ID) + INNER JOIN AD_ClientInfo ci ON (o.AD_Client_ID=ci.AD_Client_ID) + LEFT OUTER JOIN AD_User u ON (o.Planner_ID=u.AD_User_ID); + + + + + +CREATE OR REPLACE VIEW PP_Order_Workflow_Header_v +AS +SELECT o.AD_Client_ID, o.AD_Org_ID, o.IsActive, o.Created, o.CreatedBy, o.Updated, o.UpdatedBy, + cast('en_US' as varchar2(6)) AS AD_Language, + o.PP_Order_ID, + --o.DocumentNo, + o.DocStatus, + o.C_DocType_ID, + oi.C_Location_ID AS Org_Location_ID, oi.TaxID, + o.M_Warehouse_ID, wh.C_Location_ID AS Warehouse_Location_ID, + d.PrintName AS DocumentType, d.DocumentNote AS DocumentTypeNote, + o.Planner_ID, u.Name AS SalesRep_Name,o.DateStart, o.DateStartSchedule,o.FloatAfter, o.FloatBefored, o.Line, o.Lot, o.SerNo, + --o.M_Product_ID, + --o.M_AttributeSetInstance_ID, + o.C_UOM_ID,o.S_Resource_ID,o.PP_Product_BOM_ID,o.AD_Workflow_ID, o.Assay, o.C_OrderLine_ID, o.PriorityRule , + o.QtyBatchs, o.QtyDelivered, o.QtyEntered, o.QtyOrdered, + o.DateConfirm,o.DateDelivered,o.DateFinish, o.DateFinishSchedule,o.DateOrdered, o.DatePromised,o.QtyReject, o.QtyReserved , o.QtyScrap , + o.C_Campaign_ID, o.C_Project_ID, o.C_Activity_ID, + -- Order Workflow Field + ow.Name ,ow.Description ,ow.Help, + ow.Author, ow.Cost, ow.DocumentNo , ow.Duration, ow.DurationUnit , ow.Version, ow.ValidFrom , ow.ValidTo , + ow.MovingTime, ow.OverlapUnits , ow.PublishStatus , ow.QueuingTime , ow.SetupTime , ow.UnitsCycles, + ow.WaitingTime , ow.WorkflowType, ow.WorkingTime , ow.Yield, COALESCE(oi.Logo_ID, ci.Logo_ID) AS Logo_ID +FROM PP_Order o + INNER JOIN PP_Order_Workflow ow ON (ow.PP_Order_ID=o.PP_Order_ID) + INNER JOIN C_DocType d ON (o.C_DocType_ID=d.C_DocType_ID) + INNER JOIN M_Warehouse wh ON (o.M_Warehouse_ID=wh.M_Warehouse_ID) + INNER JOIN AD_OrgInfo oi ON (o.AD_Org_ID=oi.AD_Org_ID) + INNER JOIN AD_ClientInfo ci ON (o.AD_Client_ID=ci.AD_Client_ID) + LEFT OUTER JOIN AD_User u ON (o.Planner_ID=u.AD_User_ID); + + +CREATE OR REPLACE VIEW PP_Order_Workflow_Header_vt +AS +SELECT o.AD_Client_ID, o.AD_Org_ID, o.IsActive, o.Created, o.CreatedBy, o.Updated, o.UpdatedBy, + owt.AD_Language, + o.PP_Order_ID, + --o.DocumentNo, + o.DocStatus, + o.C_DocType_ID, + oi.C_Location_ID AS Org_Location_ID, oi.TaxID, + o.M_Warehouse_ID, wh.C_Location_ID AS Warehouse_Location_ID, + dt.PrintName AS DocumentType, dt.DocumentNote AS DocumentTypeNote, + o.Planner_ID, u.Name AS SalesRep_Name,o.DateStart, o.DateStartSchedule,o.FloatAfter, o.FloatBefored, o.Line, o.Lot, o.SerNo, + o.C_UOM_ID,o.PP_Product_BOM_ID, o.Assay, o.C_OrderLine_ID, o.PriorityRule , + o.QtyBatchSize , o.QtyBatchs, o.QtyDelivered, o.QtyEntered, o.QtyOrdered, + o.DateConfirm,o.DateDelivered,o.DateFinish, o.DateFinishSchedule,o.DateOrdered, o.DatePromised,o.QtyReject, o.QtyReserved , o.QtyScrap , o.S_Resource_ID , + o.C_Campaign_ID, o.C_Project_ID, o.C_Activity_ID, + --Trl Field + owt.Name , owt.Description, owt.Help, + -- Order Workflow Field + ow.Author, ow.Cost, ow.DocumentNo , ow.Duration, ow.DurationUnit, ow.Version, ow.ValidFrom , ow.ValidTo , + ow.MovingTime, ow.OverlapUnits, ow.AD_Workflow_ID, ow.PublishStatus , ow.QueuingTime , ow.SetupTime , ow.UnitsCycles, + ow.WaitingTime , ow.WorkflowType , ow.WorkingTime , ow.Yield, COALESCE(oi.Logo_ID, ci.Logo_ID) AS Logo_ID +FROM PP_Order o + INNER JOIN PP_Order_Workflow ow ON (ow.PP_Order_ID=o.PP_Order_ID) + INNER JOIN PP_Order_Workflow_Trl owt ON (owt.PP_Order_Workflow_ID=ow.PP_Order_Workflow_ID) + INNER JOIN C_DocType dt ON (o.C_DocType_ID=dt.C_DocType_ID) + INNER JOIN M_Warehouse wh ON (o.M_Warehouse_ID=wh.M_Warehouse_ID) + INNER JOIN AD_OrgInfo oi ON (o.AD_Org_ID=oi.AD_Org_ID) + INNER JOIN AD_ClientInfo ci ON (o.AD_Client_ID=ci.AD_Client_ID) + LEFT OUTER JOIN AD_User u ON (o.Planner_ID=u.AD_User_ID); + + +CREATE OR REPLACE VIEW PP_Product_BOM_Header_v +AS +SELECT b.AD_Client_ID, b.AD_Org_ID, b.IsActive, b.Created, b.CreatedBy, b.Updated, b.UpdatedBy, + cast('en_US' as varchar2(6)) AS AD_Language, + b.DocumentNo,b.name,b.help, + oi.C_Location_ID AS Org_Location_ID, oi.TaxID, + b.Description,processing, validfrom, validto, bomtype, bomuse, m_changenotice_id, + b.M_Product_ID,b.M_AttributeSetInstance_ID,b.C_UOM_ID,b.PP_Product_BOM_ID, COALESCE(oi.Logo_ID, ci.Logo_ID) AS Logo_ID +FROM PP_Product_BOM b + INNER JOIN AD_OrgInfo oi ON (oi.AD_Org_ID=b.AD_Org_ID) + INNER JOIN AD_ClientInfo ci ON (b.AD_Client_ID=ci.AD_Client_ID); + + +CREATE OR REPLACE VIEW PP_Product_BOM_Header_vt +AS +SELECT b.AD_Client_ID, b.AD_Org_ID, b.IsActive, b.Created, b.CreatedBy, b.Updated, b.UpdatedBy, + '' AS AD_Language, + b.DocumentNo,bt.Name,bt.help, + oi.C_Location_ID AS Org_Location_ID, oi.TaxID, + bt.Description,processing, validfrom, validto, bomtype, bomuse, m_changenotice_id, + b.M_Product_ID,b.M_AttributeSetInstance_ID,b.C_UOM_ID,b.PP_Product_BOM_ID, COALESCE(oi.Logo_ID, ci.Logo_ID) AS Logo_ID +FROM PP_Product_BOM b + LEFT JOIN PP_Product_BOM_Trl bt ON (bt.PP_Product_BOM_ID=b.PP_Product_BOM_ID) + INNER JOIN AD_OrgInfo oi ON (oi.AD_Org_ID=b.AD_Org_ID) + INNER JOIN AD_ClientInfo ci ON (b.AD_Client_ID=ci.AD_Client_ID); + + diff --git a/migration/353a-trunk/postgresql/559_FR2851987LogoInHeaderViews.sql b/migration/353a-trunk/postgresql/559_FR2851987LogoInHeaderViews.sql new file mode 100644 index 0000000000..9e628e31fe --- /dev/null +++ b/migration/353a-trunk/postgresql/559_FR2851987LogoInHeaderViews.sql @@ -0,0 +1,842 @@ +DROP VIEW C_DUNNING_HEADER_V; + +CREATE OR REPLACE VIEW C_DUNNING_HEADER_V +(AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, + UPDATED, UPDATEDBY, AD_LANGUAGE, C_DUNNINGRUN_ID, C_DUNNINGRUNENTRY_ID, + DUNNINGDATE, PRINTNAME, DOCUMENTNOTE, C_BPARTNER_ID, BPVALUE, + BPTAXID, NAICS, DUNS, ORG_LOCATION_ID, TAXID, + SALESREP_ID, SALESREP_NAME, BPGREETING, NAME, NAME2, + BPCONTACTGREETING, TITLE, PHONE, CONTACTNAME, C_LOCATION_ID, + REFERENCENO, POSTAL, AMT, QTY, NOTE, LOGO_ID) +AS +SELECT dr.AD_Client_ID, dr.AD_Org_ID, dr.IsActive, dr.Created, dr.CreatedBy, dr.Updated, dr.UpdatedBy, + cast('en_US' as varchar) AS AD_Language, dr.C_DunningRun_ID, C_DunningRunEntry_ID, + dr.DunningDate, dl.PrintName, dl.Note AS DocumentNote, + dre.C_BPartner_ID, bp.Value AS BPValue, bp.TaxID AS BPTaxID, bp.NAICS, bp.DUNS, + oi.C_Location_ID AS Org_Location_ID, oi.TaxID, + dre.SalesRep_ID, COALESCE(ubp.Name, u.Name) AS SalesRep_Name, + bpg.Greeting AS BPGreeting, + bp.Name, bp.Name2, + bpcg.Greeting AS BPContactGreeting, + bpc.Title, bpc.Phone, + NULLIF (bpc.Name, bp.Name) AS ContactName, + bpl.C_Location_ID, bp.ReferenceNo, l.Postal || l.Postal_Add AS Postal, + dre.Amt, dre.Qty, dre.Note, COALESCE(oi.Logo_ID, ci.Logo_ID) AS Logo_ID +FROM C_DunningRun dr + INNER JOIN C_DunningLevel dl ON (dr.C_DunningLevel_ID=dl.C_DunningLevel_ID) + INNER JOIN C_DunningRunEntry dre ON (dr.C_DunningRun_ID=dre.C_DunningRun_ID) + INNER JOIN C_BPartner bp ON (dre.C_BPartner_ID=bp.C_BPartner_ID) + LEFT OUTER JOIN C_Greeting bpg on (bp.C_Greeting_ID=bpg.C_Greeting_ID) + INNER JOIN C_BPartner_Location bpl ON (dre.C_BPartner_Location_ID=bpl.C_BPartner_Location_ID) + INNER JOIN C_Location l ON (bpl.C_Location_ID=l.C_Location_ID) + LEFT OUTER JOIN AD_User bpc ON (dre.AD_User_ID=bpc.AD_User_ID) + LEFT OUTER JOIN C_Greeting bpcg on (bpc.C_Greeting_ID=bpcg.C_Greeting_ID) + INNER JOIN AD_OrgInfo oi ON (dr.AD_Org_ID=oi.AD_Org_ID) + INNER JOIN AD_ClientInfo ci ON (dr.AD_Client_ID=oi.AD_Client_ID) + LEFT OUTER JOIN AD_User u ON (dre.SalesRep_ID=u.AD_User_ID) + LEFT OUTER JOIN C_BPartner ubp ON (u.C_BPartner_ID=ubp.C_BPartner_ID); + + + + + +DROP VIEW C_DUNNING_HEADER_VT; + +CREATE OR REPLACE VIEW C_DUNNING_HEADER_VT +(AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, + UPDATED, UPDATEDBY, AD_LANGUAGE, C_DUNNINGRUN_ID, C_DUNNINGRUNENTRY_ID, + DUNNINGDATE, PRINTNAME, DOCUMENTNOTE, C_BPARTNER_ID, BPVALUE, + BPTAXID, NAICS, DUNS, ORG_LOCATION_ID, TAXID, + SALESREP_ID, SALESREP_NAME, BPGREETING, NAME, NAME2, + BPCONTACTGREETING, TITLE, PHONE, CONTACTNAME, C_LOCATION_ID, + REFERENCENO, POSTAL, AMT, QTY, NOTE, LOGO_ID) +AS +SELECT dr.AD_Client_ID, dr.AD_Org_ID, dr.IsActive, dr.Created, dr.CreatedBy, dr.Updated, dr.UpdatedBy, + dlt.AD_Language, dr.C_DunningRun_ID, C_DunningRunEntry_ID, + dr.DunningDate, dlt.PrintName, dlt.Note AS DocumentNote, + dre.C_BPartner_ID, bp.Value AS BPValue, bp.TaxID AS BPTaxID, bp.NAICS, bp.DUNS, + oi.C_Location_ID AS Org_Location_ID, oi.TaxID, + dre.SalesRep_ID, COALESCE(ubp.Name, u.Name) AS SalesRep_Name, + bpg.Greeting AS BPGreeting, + bp.Name, bp.Name2, + bpcg.Greeting AS BPContactGreeting, + bpc.Title, bpc.Phone, + NULLIF (bpc.Name, bp.Name) AS ContactName, + bpl.C_Location_ID, bp.ReferenceNo, l.Postal || l.Postal_Add AS Postal, + dre.Amt, dre.Qty, dre.Note, COALESCE(oi.Logo_ID, ci.Logo_ID) AS Logo_ID +FROM C_DunningRun dr + INNER JOIN C_DunningLevel dl ON (dr.C_DunningLevel_ID=dl.C_DunningLevel_ID) + INNER JOIN C_DunningLevel_Trl dlt ON (dl.C_DunningLevel_ID=dlt.C_DunningLevel_ID) + INNER JOIN C_DunningRunEntry dre ON (dr.C_DunningRun_ID=dre.C_DunningRun_ID) + INNER JOIN C_BPartner bp ON (dre.C_BPartner_ID=bp.C_BPartner_ID) + LEFT OUTER JOIN C_Greeting_Trl bpg on (bp.C_Greeting_ID=bpg.C_Greeting_ID + AND dlt.AD_Language=bpg.AD_Language) + INNER JOIN C_BPartner_Location bpl ON (dre.C_BPartner_Location_ID=bpl.C_BPartner_Location_ID) + INNER JOIN C_Location l ON (bpl.C_Location_ID=l.C_Location_ID) + LEFT OUTER JOIN AD_User bpc ON (dre.AD_User_ID=bpc.AD_User_ID) + LEFT OUTER JOIN C_Greeting_Trl bpcg on (bpc.C_Greeting_ID=bpcg.C_Greeting_ID + AND dlt.AD_Language=bpcg.AD_Language) + INNER JOIN AD_OrgInfo oi ON (dr.AD_Org_ID=oi.AD_Org_ID) + INNER JOIN AD_ClientInfo ci ON (dr.AD_Client_ID=oi.AD_Client_ID) + LEFT OUTER JOIN AD_User u ON (dre.SalesRep_ID=u.AD_User_ID) + LEFT OUTER JOIN C_BPartner ubp ON (u.C_BPartner_ID=ubp.C_BPartner_ID); + + + + + +DROP VIEW C_INVOICE_HEADER_V; + +CREATE OR REPLACE VIEW C_INVOICE_HEADER_V +(AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, + UPDATED, UPDATEDBY, AD_LANGUAGE, C_INVOICE_ID, ISSOTRX, + DOCUMENTNO, DOCSTATUS, C_DOCTYPE_ID, C_BPARTNER_ID, BPVALUE, + BPTAXID, NAICS, DUNS, ORG_LOCATION_ID, TAXID, + DOCUMENTTYPE, DOCUMENTTYPENOTE, C_ORDER_ID, SALESREP_ID, SALESREP_NAME, + DATEINVOICED, BPGREETING, NAME, NAME2, BPCONTACTGREETING, + TITLE, PHONE, CONTACTNAME, C_LOCATION_ID, REFERENCENO, + POSTAL, DESCRIPTION, POREFERENCE, DATEORDERED, C_CURRENCY_ID, + PAYMENTTERM, PAYMENTTERMNOTE, C_CHARGE_ID, CHARGEAMT, TOTALLINES, + GRANDTOTAL, AMTINWORDS, M_PRICELIST_ID, ISTAXINCLUDED, C_CAMPAIGN_ID, + C_PROJECT_ID, C_ACTIVITY_ID, ISPAID, LOGO_ID) +AS +SELECT i.AD_Client_ID, i.AD_Org_ID, i.IsActive, i.Created, i.CreatedBy, i.Updated, i.UpdatedBy, + cast('en_US' as varchar) AS AD_Language, + i.C_Invoice_ID, i.IsSOTrx, i.DocumentNo, i.DocStatus, i.C_DocType_ID, + i.C_BPartner_ID, bp.Value AS BPValue, bp.TaxID AS BPTaxID, bp.NAICS, bp.DUNS, + oi.C_Location_ID AS Org_Location_ID, oi.TaxID, + dt.PrintName AS DocumentType, dt.DocumentNote AS DocumentTypeNote, + i.C_Order_ID, i.SalesRep_ID, COALESCE(ubp.Name, u.Name) AS SalesRep_Name, + i.DateInvoiced, + bpg.Greeting AS BPGreeting, + bp.Name, bp.Name2, + bpcg.Greeting AS BPContactGreeting, + bpc.Title, bpc.Phone, + NULLIF (bpc.Name, bp.Name) AS ContactName, + bpl.C_Location_ID, bp.ReferenceNo, l.Postal || l.Postal_Add AS Postal, + i.Description, + i.POReference, + i.DateOrdered, + i.C_Currency_ID, + pt.Name AS PaymentTerm, pt.DocumentNote AS PaymentTermNote, + i.C_Charge_ID, i.ChargeAmt, + i.TotalLines, + i.GrandTotal, i.GrandTotal AS AmtInWords, + i.M_PriceList_ID, + i.IsTaxIncluded, + i.C_Campaign_ID, + i.C_Project_ID, + i.C_Activity_ID, + i.IsPaid, COALESCE(oi.Logo_ID, ci.Logo_ID) AS Logo_ID +FROM C_Invoice i + INNER JOIN C_DocType dt ON (i.C_DocType_ID=dt.C_DocType_ID) + INNER JOIN C_PaymentTerm pt ON (i.C_PaymentTerm_ID=pt.C_PaymentTerm_ID) + INNER JOIN C_BPartner bp ON (i.C_BPartner_ID=bp.C_BPartner_ID) + LEFT OUTER JOIN C_Greeting bpg on (bp.C_Greeting_ID=bpg.C_Greeting_ID) + INNER JOIN C_BPartner_Location bpl ON (i.C_BPartner_Location_ID=bpl.C_BPartner_Location_ID) + INNER JOIN C_Location l ON (bpl.C_Location_ID=l.C_Location_ID) + LEFT OUTER JOIN AD_User bpc ON (i.AD_User_ID=bpc.AD_User_ID) + LEFT OUTER JOIN C_Greeting bpcg on (bpc.C_Greeting_ID=bpcg.C_Greeting_ID) + INNER JOIN AD_OrgInfo oi ON (i.AD_Org_ID=oi.AD_Org_ID) + INNER JOIN AD_ClientInfo ci ON (i.AD_Client_ID=oi.AD_Client_ID) + LEFT OUTER JOIN AD_User u ON (i.SalesRep_ID=u.AD_User_ID) + LEFT OUTER JOIN C_BPartner ubp ON (u.C_BPartner_ID=ubp.C_BPartner_ID); + + + + + +DROP VIEW C_INVOICE_HEADER_VT; + +CREATE OR REPLACE VIEW C_INVOICE_HEADER_VT +(AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, + UPDATED, UPDATEDBY, AD_LANGUAGE, C_INVOICE_ID, ISSOTRX, + DOCUMENTNO, DOCSTATUS, C_DOCTYPE_ID, C_BPARTNER_ID, BPVALUE, + BPTAXID, NAICS, DUNS, ORG_LOCATION_ID, TAXID, + DOCUMENTTYPE, DOCUMENTTYPENOTE, C_ORDER_ID, SALESREP_ID, SALESREP_NAME, + DATEINVOICED, BPGREETING, NAME, NAME2, BPCONTACTGREETING, + TITLE, PHONE, CONTACTNAME, C_LOCATION_ID, REFERENCENO, + POSTAL, DESCRIPTION, POREFERENCE, DATEORDERED, C_CURRENCY_ID, + PAYMENTTERM, PAYMENTTERMNOTE, C_CHARGE_ID, CHARGEAMT, TOTALLINES, + GRANDTOTAL, AMTINWORDS, M_PRICELIST_ID, ISTAXINCLUDED, C_CAMPAIGN_ID, + C_PROJECT_ID, C_ACTIVITY_ID, ISPAID, LOGO_ID) +AS +SELECT i.AD_Client_ID, i.AD_Org_ID, i.IsActive, i.Created, i.CreatedBy, i.Updated, i.UpdatedBy, + dt.AD_Language, + i.C_Invoice_ID, i.IsSOTrx, i.DocumentNo, i.DocStatus, i.C_DocType_ID, + i.C_BPartner_ID, bp.Value AS BPValue, bp.TaxID AS BPTaxID, bp.NAICS, bp.DUNS, + oi.C_Location_ID AS Org_Location_ID, oi.TaxID, + dt.PrintName AS DocumentType, dt.DocumentNote AS DocumentTypeNote, + i.C_Order_ID, i.SalesRep_ID, COALESCE(ubp.Name, u.Name) AS SalesRep_Name, + i.DateInvoiced, + bpg.Greeting AS BPGreeting, + bp.Name, bp.Name2, + bpcg.Greeting AS BPContactGreeting, + bpc.Title, bpc.Phone, + NULLIF (bpc.Name, bp.Name) AS ContactName, + bpl.C_Location_ID, bp.ReferenceNo, l.Postal || l.Postal_Add AS Postal, + i.Description, + i.POReference, + i.DateOrdered, + i.C_Currency_ID, + pt.Name AS PaymentTerm, pt.DocumentNote AS PaymentTermNote, + i.C_Charge_ID, i.ChargeAmt, + i.TotalLines, + i.GrandTotal, i.GrandTotal AS AmtInWords, + i.M_PriceList_ID, + i.IsTaxIncluded, + i.C_Campaign_ID, + i.C_Project_ID, + i.C_Activity_ID, + i.IsPaid, COALESCE(oi.Logo_ID, ci.Logo_ID) AS Logo_ID +FROM C_Invoice i + INNER JOIN C_DocType_Trl dt ON (i.C_DocType_ID=dt.C_DocType_ID) + INNER JOIN C_PaymentTerm_Trl pt ON (i.C_PaymentTerm_ID=pt.C_PaymentTerm_ID AND dt.AD_Language=pt.AD_Language) + INNER JOIN C_BPartner bp ON (i.C_BPartner_ID=bp.C_BPartner_ID) + LEFT OUTER JOIN C_Greeting_Trl bpg on (bp.C_Greeting_ID=bpg.C_Greeting_ID AND dt.AD_Language=bpg.AD_Language) + INNER JOIN C_BPartner_Location bpl ON (i.C_BPartner_Location_ID=bpl.C_BPartner_Location_ID) + INNER JOIN C_Location l ON (bpl.C_Location_ID=l.C_Location_ID) + LEFT OUTER JOIN AD_User bpc ON (i.AD_User_ID=bpc.AD_User_ID) + LEFT OUTER JOIN C_Greeting_Trl bpcg on (bpc.C_Greeting_ID=bpcg.C_Greeting_ID AND dt.AD_Language=bpcg.AD_Language) + INNER JOIN AD_OrgInfo oi ON (i.AD_Org_ID=oi.AD_Org_ID) + INNER JOIN AD_ClientInfo ci ON (i.AD_Client_ID=oi.AD_Client_ID) + LEFT OUTER JOIN AD_User u ON (i.SalesRep_ID=u.AD_User_ID) + LEFT OUTER JOIN C_BPartner ubp ON (u.C_BPartner_ID=ubp.C_BPartner_ID); + + + + + +DROP VIEW C_ORDER_HEADER_V; + +CREATE OR REPLACE VIEW C_ORDER_HEADER_V +(AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, + UPDATED, UPDATEDBY, AD_LANGUAGE, C_ORDER_ID, ISSOTRX, + DOCUMENTNO, DOCSTATUS, C_DOCTYPE_ID, C_BPARTNER_ID, BPVALUE, + BPTAXID, NAICS, DUNS, ORG_LOCATION_ID, TAXID, + M_WAREHOUSE_ID, WAREHOUSE_LOCATION_ID, DOCUMENTTYPE, DOCUMENTTYPENOTE, SALESREP_ID, + SALESREP_NAME, DATEORDERED, DATEPROMISED, BPGREETING, NAME, + NAME2, BPCONTACTGREETING, TITLE, PHONE, CONTACTNAME, + C_LOCATION_ID, POSTAL, REFERENCENO, BILL_BPARTNER_ID, BILL_LOCATION_ID, + BILL_USER_ID, BILL_BPVALUE, BILL_BPTAXID, BILL_NAME, BILL_NAME2, + BILL_TITLE, BILL_PHONE, BILL_CONTACTNAME, BILL_C_LOCATION_ID, DESCRIPTION, + POREFERENCE, C_CURRENCY_ID, PAYMENTTERM, PAYMENTTERMNOTE, C_CHARGE_ID, + CHARGEAMT, TOTALLINES, GRANDTOTAL, AMTINWORDS, M_PRICELIST_ID, + ISTAXINCLUDED, VOLUME, WEIGHT, C_CAMPAIGN_ID, C_PROJECT_ID, + C_ACTIVITY_ID, M_SHIPPER_ID, DELIVERYRULE, DELIVERYVIARULE, PRIORITYRULE, + INVOICERULE, LOGO_ID) +AS +SELECT o.AD_Client_ID, o.AD_Org_ID, o.IsActive, o.Created, o.CreatedBy, o.Updated, o.UpdatedBy, + cast('en_US' as varchar) AS AD_Language, + o.C_Order_ID, o.IsSOTrx, o.DocumentNo, o.DocStatus, o.C_DocType_ID, + o.C_BPartner_ID, bp.Value AS BPValue, bp.TaxID AS BPTaxID, bp.NAICS, bp.DUNS, + oi.C_Location_ID AS Org_Location_ID, oi.TaxID, + o.M_Warehouse_ID, wh.C_Location_ID AS Warehouse_Location_ID, + dt.PrintName AS DocumentType, dt.DocumentNote AS DocumentTypeNote, + o.SalesRep_ID, COALESCE(ubp.Name, u.Name) AS SalesRep_Name, + o.DateOrdered, o.DatePromised, + bpg.Greeting AS BPGreeting, + bp.Name, bp.Name2, + bpcg.Greeting AS BPContactGreeting, + bpc.Title, bpc.Phone, + NULLIF (bpc.Name, bp.Name) AS ContactName, + bpl.C_Location_ID, l.Postal || l.Postal_Add AS Postal, + bp.ReferenceNo, + -- Bill to + o.Bill_BPartner_ID, o.Bill_Location_ID, o.Bill_User_ID, + bbp.Value AS Bill_BPValue, bbp.TaxID AS Bill_BPTaxID, + bbp.Name AS Bill_Name, bbp.Name2 AS Bill_Name2, + bbpc.Title AS Bill_Title, bbpc.Phone AS Bill_Phone, + NULLIF (bbpc.Name, bbp.Name) AS Bill_ContactName, + bbpl.C_Location_ID AS Bill_C_Location_ID, + o.Description, + o.POReference, + o.C_Currency_ID, + pt.Name AS PaymentTerm, pt.DocumentNote AS PaymentTermNote, + o.C_Charge_ID, o.ChargeAmt, + o.TotalLines, + o.GrandTotal, o.GrandTotal AS AmtInWords, + o.M_PriceList_ID, + o.IsTaxIncluded, o.Volume, o.Weight, + o.C_Campaign_ID, o.C_Project_ID, o.C_Activity_ID, + o.M_Shipper_ID, o.DeliveryRule, o.DeliveryViaRule, o.PriorityRule, o.InvoiceRule, COALESCE(oi.Logo_ID, ci.Logo_ID) AS Logo_ID +FROM C_Order o + INNER JOIN C_DocType dt ON (o.C_DocType_ID=dt.C_DocType_ID) + INNER JOIN M_Warehouse wh ON (o.M_Warehouse_ID=wh.M_Warehouse_ID) + INNER JOIN C_PaymentTerm pt ON (o.C_PaymentTerm_ID=pt.C_PaymentTerm_ID) + INNER JOIN C_BPartner bp ON (o.C_BPartner_ID=bp.C_BPartner_ID) + LEFT OUTER JOIN C_Greeting bpg ON (bp.C_Greeting_ID=bpg.C_Greeting_ID) + INNER JOIN C_BPartner_Location bpl ON (o.C_BPartner_Location_ID=bpl.C_BPartner_Location_ID) + INNER JOIN C_Location l ON (bpl.C_Location_ID=l.C_Location_ID) + LEFT OUTER JOIN AD_User bpc ON (o.AD_User_ID=bpc.AD_User_ID) + LEFT OUTER JOIN C_Greeting bpcg ON (bpc.C_Greeting_ID=bpcg.C_Greeting_ID) + INNER JOIN AD_OrgInfo oi ON (o.AD_Org_ID=oi.AD_Org_ID) + INNER JOIN AD_ClientInfo ci ON (o.AD_Client_ID=oi.AD_Client_ID) + LEFT OUTER JOIN AD_User u ON (o.SalesRep_ID=u.AD_User_ID) + LEFT OUTER JOIN C_BPartner ubp ON (u.C_BPartner_ID=ubp.C_BPartner_ID) + INNER JOIN C_BPartner bbp ON (o.Bill_BPartner_ID=bbp.C_BPartner_ID) + INNER JOIN C_BPartner_Location bbpl ON (o.Bill_Location_ID=bbpl.C_BPartner_Location_ID) + LEFT OUTER JOIN AD_User bbpc ON (o.Bill_User_ID=bbpc.AD_User_ID); + + + + + +DROP VIEW C_ORDER_HEADER_VT; + +CREATE OR REPLACE VIEW C_ORDER_HEADER_VT +(AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, + UPDATED, UPDATEDBY, AD_LANGUAGE, C_ORDER_ID, ISSOTRX, + DOCUMENTNO, DOCSTATUS, C_DOCTYPE_ID, C_BPARTNER_ID, BPVALUE, + BPTAXID, NAICS, DUNS, ORG_LOCATION_ID, TAXID, + M_WAREHOUSE_ID, WAREHOUSE_LOCATION_ID, DOCUMENTTYPE, DOCUMENTTYPENOTE, SALESREP_ID, + SALESREP_NAME, DATEORDERED, DATEPROMISED, BPGREETING, NAME, + NAME2, BPCONTACTGREETING, TITLE, PHONE, CONTACTNAME, + C_LOCATION_ID, POSTAL, REFERENCENO, BILL_BPARTNER_ID, BILL_LOCATION_ID, + BILL_USER_ID, BILL_BPVALUE, BILL_BPTAXID, BILL_NAME, BILL_NAME2, + BILL_TITLE, BILL_PHONE, BILL_CONTACTNAME, BILL_C_LOCATION_ID, DESCRIPTION, + POREFERENCE, C_CURRENCY_ID, PAYMENTTERM, PAYMENTTERMNOTE, C_CHARGE_ID, + CHARGEAMT, TOTALLINES, GRANDTOTAL, AMTINWORDS, M_PRICELIST_ID, + ISTAXINCLUDED, VOLUME, WEIGHT, C_CAMPAIGN_ID, C_PROJECT_ID, + C_ACTIVITY_ID, M_SHIPPER_ID, DELIVERYRULE, DELIVERYVIARULE, PRIORITYRULE, + INVOICERULE, LOGO_ID) +AS +SELECT o.AD_Client_ID, o.AD_Org_ID, o.IsActive, o.Created, o.CreatedBy, o.Updated, o.UpdatedBy, + dt.AD_Language, + o.C_Order_ID, o.IsSOTrx, o.DocumentNo, o.DocStatus, o.C_DocType_ID, + o.C_BPartner_ID, bp.Value AS BPValue, bp.TaxID AS BPTaxID, bp.NAICS, bp.DUNS, + oi.C_Location_ID AS Org_Location_ID, oi.TaxID, + o.M_Warehouse_ID, wh.C_Location_ID AS Warehouse_Location_ID, + dt.PrintName AS DocumentType, dt.DocumentNote AS DocumentTypeNote, + o.SalesRep_ID, COALESCE(ubp.Name, u.Name) AS SalesRep_Name, + o.DateOrdered, o.DatePromised, + bpg.Greeting AS BPGreeting, + bp.Name, bp.Name2, + bpcg.Greeting AS BPContactGreeting, + bpc.Title, bpc.Phone, + NULLIF (bpc.Name, bp.Name) AS ContactName, + bpl.C_Location_ID, l.Postal || l.Postal_Add AS Postal, + bp.ReferenceNo, + -- Bill to + o.Bill_BPartner_ID, o.Bill_Location_ID, o.Bill_User_ID, + bbp.Value AS Bill_BPValue, bbp.TaxID AS Bill_BPTaxID, + bbp.Name AS Bill_Name, bbp.Name2 AS Bill_Name2, + bbpc.Title AS Bill_Title, bbpc.Phone AS Bill_Phone, + NULLIF (bbpc.Name, bbp.Name) AS Bill_ContactName, + bbpl.C_Location_ID AS Bill_C_Location_ID, + o.Description, + o.POReference, + o.C_Currency_ID, + pt.Name AS PaymentTerm, pt.DocumentNote AS PaymentTermNote, + o.C_Charge_ID, o.ChargeAmt, + o.TotalLines, + o.GrandTotal, o.GrandTotal AS AmtInWords, + o.M_PriceList_ID, + o.IsTaxIncluded, o.Volume, o.Weight, + o.C_Campaign_ID, o.C_Project_ID, o.C_Activity_ID, + o.M_Shipper_ID, o.DeliveryRule, o.DeliveryViaRule, o.PriorityRule, o.InvoiceRule, COALESCE(oi.Logo_ID, ci.Logo_ID) AS Logo_ID +FROM C_Order o + INNER JOIN C_DocType_Trl dt ON (o.C_DocType_ID=dt.C_DocType_ID) + INNER JOIN M_Warehouse wh ON (o.M_Warehouse_ID=wh.M_Warehouse_ID) + INNER JOIN C_PaymentTerm_Trl pt ON (o.C_PaymentTerm_ID=pt.C_PaymentTerm_ID AND dt.AD_Language=pt.AD_Language) + INNER JOIN C_BPartner bp ON (o.C_BPartner_ID=bp.C_BPartner_ID) + LEFT OUTER JOIN C_Greeting_Trl bpg ON (bp.C_Greeting_ID=bpg.C_Greeting_ID AND dt.AD_Language=bpg.AD_Language) + INNER JOIN C_BPartner_Location bpl ON (o.C_BPartner_Location_ID=bpl.C_BPartner_Location_ID) + INNER JOIN C_Location l ON (bpl.C_Location_ID=l.C_Location_ID) + LEFT OUTER JOIN AD_User bpc ON (o.AD_User_ID=bpc.AD_User_ID) + LEFT OUTER JOIN C_Greeting_Trl bpcg ON (bpc.C_Greeting_ID=bpcg.C_Greeting_ID AND dt.AD_Language=bpcg.AD_Language) + INNER JOIN AD_OrgInfo oi ON (o.AD_Org_ID=oi.AD_Org_ID) + INNER JOIN AD_ClientInfo ci ON (o.AD_Client_ID=oi.AD_Client_ID) + LEFT OUTER JOIN AD_User u ON (o.SalesRep_ID=u.AD_User_ID) + LEFT OUTER JOIN C_BPartner ubp ON (u.C_BPartner_ID=ubp.C_BPartner_ID) + INNER JOIN C_BPartner bbp ON (o.Bill_BPartner_ID=bbp.C_BPartner_ID) + INNER JOIN C_BPartner_Location bbpl ON (o.Bill_Location_ID=bbpl.C_BPartner_Location_ID) + LEFT OUTER JOIN AD_User bbpc ON (o.Bill_User_ID=bbpc.AD_User_ID); + + + + + +DROP VIEW C_PROJECT_HEADER_V; + +CREATE OR REPLACE VIEW C_PROJECT_HEADER_V +(AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, + UPDATED, UPDATEDBY, AD_LANGUAGE, C_PROJECT_ID, VALUE, + PROJECTNAME, DESCRIPTION, NOTE, ISSUMMARY, PROJECTCATEGORY, + ORG_LOCATION_ID, TAXID, C_PROJECTTYPE_ID, PROJECTTYPENAME, C_PHASE_ID, + PROJECTPHASENAME, SALESREP_ID, SALESREP_NAME, C_BPARTNER_ID, BPVALUE, + BPTAXID, NAICS, DUNS, BPGREETING, NAME, + NAME2, BPCONTACTGREETING, TITLE, PHONE, CONTACTNAME, + C_LOCATION_ID, REFERENCENO, PAYMENTTERM, PAYMENTTERMNOTE, POREFERENCE, + C_CURRENCY_ID, M_PRICELIST_VERSION_ID, C_CAMPAIGN_ID, PLANNEDAMT, PLANNEDQTY, + PLANNEDMARGINAMT, INVOICEDAMT, INVOICEDQTY, PROJECTBALANCEAMT, ISCOMMITMENT, + COMMITTEDAMT, COMMITTEDQTY, DATECONTRACT, DATEFINISH, ISCOMMITCEILING, + M_WAREHOUSE_ID, LOGO_ID) +AS +SELECT p.AD_Client_ID, p.AD_Org_ID, p.IsActive, p.Created, p.CreatedBy, p.Updated, p.UpdatedBy, + cast('en_US' as varchar) AS AD_Language, p.C_Project_ID, + p.Value, p.Name AS ProjectName, p.Description, p.Note, p.IsSummary, p.ProjectCategory, + oi.C_Location_ID AS Org_Location_ID, oi.TaxID, + p.C_ProjectType_ID, pjt.Name AS ProjectTypeName, p.C_Phase_ID, pjp.Name AS ProjectPhaseName, + p.SalesRep_ID, COALESCE(ubp.Name, u.Name) AS SalesRep_Name, + p.C_BPartner_ID, bp.Value AS BPValue, bp.TaxID AS BPTaxID, bp.NAICS, bp.DUNS, + bpg.Greeting AS BPGreeting, + bp.Name, bp.Name2, + bpcg.Greeting AS BPContactGreeting, + bpc.Title, bpc.Phone, + NULLIF (bpc.Name, bp.Name) AS ContactName, + bpl.C_Location_ID, + bp.ReferenceNo, + pt.Name AS PaymentTerm, pt.DocumentNote AS PaymentTermNote, + p.POReference, + p.C_Currency_ID, p.M_PriceList_Version_ID, + p.C_Campaign_ID, + p.PlannedAmt, p.PlannedQty, p.PlannedMarginAmt, p.InvoicedAmt, p.InvoicedQty, p.ProjectBalanceAmt, + p.IsCommitment, p.CommittedAmt, p.CommittedQty, p.DateContract, p.DateFinish, p.IsCommitCeiling, + p.M_Warehouse_ID, COALESCE(oi.Logo_ID, ci.Logo_ID) AS Logo_ID +FROM C_Project p + LEFT OUTER JOIN C_BPartner bp ON (p.C_BPartner_ID=bp.C_BPartner_ID) + INNER JOIN AD_OrgInfo oi ON (p.AD_Org_ID=oi.AD_Org_ID) + INNER JOIN AD_ClientInfo ci ON (p.AD_Client_ID=oi.AD_Client_ID) + LEFT OUTER JOIN C_ProjectType pjt ON (p.C_ProjectType_ID=pjt.C_ProjectType_ID) + LEFT OUTER JOIN C_Phase pjp ON (p.C_Phase_ID=pjp.C_Phase_ID) + LEFT OUTER JOIN AD_User u ON (p.SalesRep_ID=u.AD_User_ID) + LEFT OUTER JOIN C_BPartner ubp ON (u.C_BPartner_ID=ubp.C_BPartner_ID) + LEFT OUTER JOIN C_Greeting bpg on (bp.C_Greeting_ID=bpg.C_Greeting_ID) + LEFT OUTER JOIN AD_User bpc ON (p.AD_User_ID=bpc.AD_User_ID) + LEFT OUTER JOIN C_Greeting bpcg on (bpc.C_Greeting_ID=bpcg.C_Greeting_ID) + LEFT OUTER JOIN C_BPartner_Location bpl ON (p.C_BPartner_Location_ID=bpl.C_BPartner_Location_ID) + LEFT OUTER JOIN C_PaymentTerm pt ON (p.C_PaymentTerm_ID=pt.C_PaymentTerm_ID); + + + + + +DROP VIEW C_PROJECT_HEADER_VT; + +CREATE OR REPLACE VIEW C_PROJECT_HEADER_VT +(AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, + UPDATED, UPDATEDBY, AD_LANGUAGE, C_PROJECT_ID, VALUE, + PROJECTNAME, DESCRIPTION, NOTE, ISSUMMARY, PROJECTCATEGORY, + ORG_LOCATION_ID, TAXID, C_PROJECTTYPE_ID, PROJECTTYPENAME, C_PHASE_ID, + PROJECTPHASENAME, SALESREP_ID, SALESREP_NAME, C_BPARTNER_ID, BPVALUE, + BPTAXID, NAICS, DUNS, BPGREETING, NAME, + NAME2, BPCONTACTGREETING, TITLE, PHONE, CONTACTNAME, + C_LOCATION_ID, REFERENCENO, PAYMENTTERM, PAYMENTTERMNOTE, POREFERENCE, + C_CURRENCY_ID, M_PRICELIST_VERSION_ID, C_CAMPAIGN_ID, PLANNEDAMT, PLANNEDQTY, + PLANNEDMARGINAMT, INVOICEDAMT, INVOICEDQTY, PROJECTBALANCEAMT, ISCOMMITMENT, + COMMITTEDAMT, COMMITTEDQTY, DATECONTRACT, DATEFINISH, ISCOMMITCEILING, + M_WAREHOUSE_ID, LOGO_ID) +AS +SELECT p.AD_Client_ID, p.AD_Org_ID, p.IsActive, p.Created, p.CreatedBy, p.Updated, p.UpdatedBy, + pt.AD_Language, p.C_Project_ID, + p.Value, p.Name AS ProjectName, p.Description, p.Note, p.IsSummary, p.ProjectCategory, + oi.C_Location_ID AS Org_Location_ID, oi.TaxID, + p.C_ProjectType_ID, pjt.Name AS ProjectTypeName, p.C_Phase_ID, pjp.Name AS ProjectPhaseName, + p.SalesRep_ID, COALESCE(ubp.Name, u.Name) AS SalesRep_Name, + p.C_BPartner_ID, bp.Value AS BPValue, bp.TaxID AS BPTaxID, bp.NAICS, bp.DUNS, + bpg.Greeting AS BPGreeting, + bp.Name, bp.Name2, + bpcg.Greeting AS BPContactGreeting, + bpc.Title, bpc.Phone, + NULLIF (bpc.Name, bp.Name) AS ContactName, + bpl.C_Location_ID, + bp.ReferenceNo, + pt.Name AS PaymentTerm, pt.DocumentNote AS PaymentTermNote, + p.POReference, + p.C_Currency_ID, p.M_PriceList_Version_ID, + p.C_Campaign_ID, + p.PlannedAmt, p.PlannedQty, p.PlannedMarginAmt, p.InvoicedAmt, p.InvoicedQty, p.ProjectBalanceAmt, + p.IsCommitment, p.CommittedAmt, p.CommittedQty, p.DateContract, p.DateFinish, p.IsCommitCeiling, + p.M_Warehouse_ID, COALESCE(oi.Logo_ID, ci.Logo_ID) AS Logo_ID +FROM C_Project p + LEFT OUTER JOIN C_BPartner bp ON (p.C_BPartner_ID=bp.C_BPartner_ID) + INNER JOIN AD_OrgInfo oi ON (p.AD_Org_ID=oi.AD_Org_ID) + INNER JOIN AD_ClientInfo ci ON (p.AD_Client_ID=oi.AD_Client_ID) + LEFT OUTER JOIN C_PaymentTerm_Trl pt ON (p.C_PaymentTerm_ID=pt.C_PaymentTerm_ID) + LEFT OUTER JOIN C_ProjectType pjt ON (p.C_ProjectType_ID=pjt.C_ProjectType_ID) + LEFT OUTER JOIN C_Phase pjp ON (p.C_Phase_ID=pjp.C_Phase_ID) + LEFT OUTER JOIN AD_User u ON (p.SalesRep_ID=u.AD_User_ID) + LEFT OUTER JOIN C_BPartner ubp ON (u.C_BPartner_ID=ubp.C_BPartner_ID) + LEFT OUTER JOIN C_Greeting bpg on (bp.C_Greeting_ID=bpg.C_Greeting_ID) + LEFT OUTER JOIN AD_User bpc ON (p.AD_User_ID=bpc.AD_User_ID) + LEFT OUTER JOIN C_Greeting bpcg on (bpc.C_Greeting_ID=bpcg.C_Greeting_ID) + LEFT OUTER JOIN C_BPartner_Location bpl ON (p.C_BPartner_Location_ID=bpl.C_BPartner_Location_ID); + + + + + +DROP VIEW DD_ORDER_HEADER_V; + +CREATE OR REPLACE VIEW DD_ORDER_HEADER_V +AS +SELECT o.AD_Client_ID, o.AD_Org_ID, o.IsActive, o.Created, o.CreatedBy, o.Updated, o.UpdatedBy, + cast('en_US' as varchar) AS AD_Language, + o.DD_Order_ID,o.C_Order_ID, o.IsSOTrx, o.DocumentNo, o.DocStatus, o.C_DocType_ID, + o.C_BPartner_ID, bp.Value AS BPValue, bp.TaxID AS BPTaxID, bp.NAICS, bp.DUNS, + oi.C_Location_ID AS Org_Location_ID, oi.TaxID, + o.M_Warehouse_ID, wh.C_Location_ID AS Warehouse_Location_ID, + dt.PrintName AS DocumentType, dt.DocumentNote AS DocumentTypeNote, + o.SalesRep_ID, COALESCE(ubp.Name, u.Name) AS SalesRep_Name, + o.DateOrdered, o.DatePromised, + bpg.Greeting AS BPGreeting, + bp.Name, bp.Name2, + bpcg.Greeting AS BPContactGreeting, + bpc.Title, bpc.Phone, + NULLIF (bpc.Name, bp.Name) AS ContactName, + bpl.C_Location_ID, l.Postal || l.Postal_Add AS Postal, + bp.ReferenceNo, + o.Description, + o.POReference, + o.C_Charge_ID, o.ChargeAmt, + o.Volume, o.Weight, + o.C_Campaign_ID, o.C_Project_ID, o.C_Activity_ID, + o.M_Shipper_ID, o.DeliveryRule, o.DeliveryViaRule, o.PriorityRule, COALESCE(oi.Logo_ID, ci.Logo_ID) AS Logo_ID +FROM DD_Order o + INNER JOIN C_DocType dt ON (o.C_DocType_ID=dt.C_DocType_ID) + INNER JOIN M_Warehouse wh ON (o.M_Warehouse_ID=wh.M_Warehouse_ID) + INNER JOIN C_BPartner bp ON (o.C_BPartner_ID=bp.C_BPartner_ID) + LEFT OUTER JOIN C_Greeting bpg ON (bp.C_Greeting_ID=bpg.C_Greeting_ID) + INNER JOIN C_BPartner_Location bpl ON (o.C_BPartner_Location_ID=bpl.C_BPartner_Location_ID) + INNER JOIN C_Location l ON (bpl.C_Location_ID=l.C_Location_ID) + LEFT OUTER JOIN AD_User bpc ON (o.AD_User_ID=bpc.AD_User_ID) + LEFT OUTER JOIN C_Greeting bpcg ON (bpc.C_Greeting_ID=bpcg.C_Greeting_ID) + INNER JOIN AD_OrgInfo oi ON (o.AD_Org_ID=oi.AD_Org_ID) + INNER JOIN AD_ClientInfo ci ON (o.AD_Client_ID=oi.AD_Client_ID) + LEFT OUTER JOIN AD_User u ON (o.SalesRep_ID=u.AD_User_ID) + LEFT OUTER JOIN C_BPartner ubp ON (u.C_BPartner_ID=ubp.C_BPartner_ID); + + + + + + +DROP VIEW DD_ORDER_HEADER_VT; + +CREATE OR REPLACE VIEW DD_ORDER_HEADER_VT +AS +SELECT o.AD_Client_ID, o.AD_Org_ID, o.IsActive, o.Created, o.CreatedBy, o.Updated, o.UpdatedBy, + dt.AD_Language,o.DD_Order_ID, + o.C_Order_ID, o.IsSOTrx, o.DocumentNo, o.DocStatus, o.C_DocType_ID, + o.C_BPartner_ID, bp.Value AS BPValue, bp.TaxID AS BPTaxID, bp.NAICS, bp.DUNS, + oi.C_Location_ID AS Org_Location_ID, oi.TaxID, + o.M_Warehouse_ID, wh.C_Location_ID AS Warehouse_Location_ID, + dt.PrintName AS DocumentType, dt.DocumentNote AS DocumentTypeNote, + o.SalesRep_ID, COALESCE(ubp.Name, u.Name) AS SalesRep_Name, + o.DateOrdered, o.DatePromised, + bpg.Greeting AS BPGreeting, + bp.Name, bp.Name2, + bpcg.Greeting AS BPContactGreeting, + bpc.Title, bpc.Phone, + NULLIF (bpc.Name, bp.Name) AS ContactName, + bpl.C_Location_ID, l.Postal || l.Postal_Add AS Postal, + bp.ReferenceNo, + o.Description, + o.POReference, + o.C_Charge_ID, o.ChargeAmt, + o.Volume, o.Weight, + o.C_Campaign_ID, o.C_Project_ID, o.C_Activity_ID, + o.M_Shipper_ID, o.DeliveryRule, o.DeliveryViaRule, o.PriorityRule, COALESCE(oi.Logo_ID, ci.Logo_ID) AS Logo_ID +FROM DD_Order o + INNER JOIN C_DocType_Trl dt ON (o.C_DocType_ID=dt.C_DocType_ID) + INNER JOIN M_Warehouse wh ON (o.M_Warehouse_ID=wh.M_Warehouse_ID) + INNER JOIN C_BPartner bp ON (o.C_BPartner_ID=bp.C_BPartner_ID) + LEFT OUTER JOIN C_Greeting_Trl bpg ON (bp.C_Greeting_ID=bpg.C_Greeting_ID AND dt.AD_Language=bpg.AD_Language) + INNER JOIN C_BPartner_Location bpl ON (o.C_BPartner_Location_ID=bpl.C_BPartner_Location_ID) + INNER JOIN C_Location l ON (bpl.C_Location_ID=l.C_Location_ID) + LEFT OUTER JOIN AD_User bpc ON (o.AD_User_ID=bpc.AD_User_ID) + LEFT OUTER JOIN C_Greeting_Trl bpcg ON (bpc.C_Greeting_ID=bpcg.C_Greeting_ID AND dt.AD_Language=bpcg.AD_Language) + INNER JOIN AD_OrgInfo oi ON (o.AD_Org_ID=oi.AD_Org_ID) + INNER JOIN AD_ClientInfo ci ON (o.AD_Client_ID=oi.AD_Client_ID) + LEFT OUTER JOIN AD_User u ON (o.SalesRep_ID=u.AD_User_ID) + LEFT OUTER JOIN C_BPartner ubp ON (u.C_BPartner_ID=ubp.C_BPartner_ID); + + + + + + +DROP VIEW M_INOUT_HEADER_V; + +CREATE OR REPLACE VIEW M_INOUT_HEADER_V +(AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, + UPDATED, UPDATEDBY, AD_LANGUAGE, M_INOUT_ID, ISSOTRX, + DOCUMENTNO, DOCSTATUS, C_DOCTYPE_ID, C_BPARTNER_ID, BPVALUE, + BPTAXID, NAICS, DUNS, ORG_LOCATION_ID, TAXID, + M_WAREHOUSE_ID, WAREHOUSE_LOCATION_ID, DOCUMENTTYPE, DOCUMENTTYPENOTE, C_ORDER_ID, + MOVEMENTDATE, MOVEMENTTYPE, BPGREETING, NAME, NAME2, + BPCONTACTGREETING, TITLE, PHONE, CONTACTNAME, C_LOCATION_ID, + POSTAL, REFERENCENO, DESCRIPTION, POREFERENCE, DATEORDERED, + VOLUME, WEIGHT, M_SHIPPER_ID, DELIVERYRULE, DELIVERYVIARULE, + PRIORITYRULE, LOGO_ID) +AS +SELECT io.AD_Client_ID, io.AD_Org_ID, io.IsActive, io.Created, io.CreatedBy, io.Updated, io.UpdatedBy, + cast('en_US' as varchar) AS AD_Language, + io.M_InOut_ID, io.IsSOTrx, io.DocumentNo, io.DocStatus, io.C_DocType_ID, + io.C_BPartner_ID, bp.Value AS BPValue, bp.TaxID AS BPTaxID, bp.NAICS, bp.DUNS, + oi.C_Location_ID AS Org_Location_ID, oi.TaxID, + io.M_Warehouse_ID, wh.C_Location_ID AS Warehouse_Location_ID, + dt.PrintName AS DocumentType, dt.DocumentNote AS DocumentTypeNote, + io.C_Order_ID, + io.MovementDate, io.MovementType, + bpg.Greeting AS BPGreeting, + bp.Name, bp.Name2, + bpcg.Greeting AS BPContactGreeting, + bpc.Title, bpc.Phone, + NULLIF (bpc.Name, bp.Name) AS ContactName, + bpl.C_Location_ID, l.Postal || l.Postal_Add AS Postal, + bp.ReferenceNo, + io.Description, + io.POReference, + io.DateOrdered, io.Volume, io.Weight, + io.M_Shipper_ID, io.DeliveryRule, io.DeliveryViaRule, io.PriorityRule, COALESCE(oi.Logo_ID, ci.Logo_ID) AS Logo_ID +FROM M_InOut io + INNER JOIN C_DocType dt ON (io.C_DocType_ID=dt.C_DocType_ID) + INNER JOIN C_BPartner bp ON (io.C_BPartner_ID=bp.C_BPartner_ID) + LEFT OUTER JOIN C_Greeting bpg ON (bp.C_Greeting_ID=bpg.C_Greeting_ID) + INNER JOIN C_BPartner_Location bpl ON (io.C_BPartner_Location_ID=bpl.C_BPartner_Location_ID) + INNER JOIN C_Location l ON (bpl.C_Location_ID=l.C_Location_ID) + LEFT OUTER JOIN AD_User bpc ON (io.AD_User_ID=bpc.AD_User_ID) + LEFT OUTER JOIN C_Greeting bpcg ON (bpc.C_Greeting_ID=bpcg.C_Greeting_ID) + INNER JOIN AD_OrgInfo oi ON (io.AD_Org_ID=oi.AD_Org_ID) + INNER JOIN AD_ClientInfo ci ON (io.AD_Client_ID=oi.AD_Client_ID) + INNER JOIN M_Warehouse wh ON (io.M_Warehouse_ID=wh.M_Warehouse_ID); + + + + + +DROP VIEW M_INOUT_HEADER_VT; + +CREATE OR REPLACE VIEW M_INOUT_HEADER_VT +(AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, + UPDATED, UPDATEDBY, AD_LANGUAGE, M_INOUT_ID, ISSOTRX, + DOCUMENTNO, DOCSTATUS, C_DOCTYPE_ID, C_BPARTNER_ID, BPVALUE, + BPTAXID, NAICS, DUNS, ORG_LOCATION_ID, TAXID, + M_WAREHOUSE_ID, WAREHOUSE_LOCATION_ID, DOCUMENTTYPE, DOCUMENTTYPENOTE, C_ORDER_ID, + PHONE, MOVEMENTDATE, MOVEMENTTYPE, BPGREETING, NAME, + NAME2, BPCONTACTGREETING, TITLE, CONTACTNAME, C_LOCATION_ID, + POSTAL, REFERENCENO, DESCRIPTION, POREFERENCE, DATEORDERED, + VOLUME, WEIGHT, M_SHIPPER_ID, DELIVERYRULE, DELIVERYVIARULE, + PRIORITYRULE, LOGO_ID) +AS +SELECT io.AD_Client_ID, io.AD_Org_ID, io.IsActive, io.Created, io.CreatedBy, io.Updated, io.UpdatedBy, + dt.AD_Language, + io.M_InOut_ID, io.IsSOTrx, io.DocumentNo, io.DocStatus, io.C_DocType_ID, + io.C_BPartner_ID, bp.Value AS BPValue, bp.TaxID AS BPTaxID, bp.NAICS, bp.DUNS, + oi.C_Location_ID AS Org_Location_ID, oi.TaxID, + io.M_Warehouse_ID, wh.C_Location_ID AS Warehouse_Location_ID, + dt.PrintName AS DocumentType, dt.DocumentNote AS DocumentTypeNote, + io.C_Order_ID, bpc.Phone, + io.MovementDate, io.MovementType, + bpg.Greeting AS BPGreeting, + bp.Name, bp.Name2, + bpcg.Greeting AS BPContactGreeting, + bpc.Title, + NULLIF (bpc.Name, bp.Name) AS ContactName, + bpl.C_Location_ID, l.Postal || l.Postal_Add AS Postal, + bp.ReferenceNo, + io.Description, + io.POReference, + io.DateOrdered, io.Volume, io.Weight, + io.M_Shipper_ID, io.DeliveryRule, io.DeliveryViaRule, io.PriorityRule, COALESCE(oi.Logo_ID, ci.Logo_ID) AS Logo_ID +FROM M_InOut io + INNER JOIN C_DocType_Trl dt ON (io.C_DocType_ID=dt.C_DocType_ID) + INNER JOIN C_BPartner bp ON (io.C_BPartner_ID=bp.C_BPartner_ID) + LEFT OUTER JOIN C_Greeting_Trl bpg ON (bp.C_Greeting_ID=bpg.C_Greeting_ID AND dt.AD_Language=bpg.AD_Language) + INNER JOIN C_BPartner_Location bpl ON (io.C_BPartner_Location_ID=bpl.C_BPartner_Location_ID) + INNER JOIN C_Location l ON (bpl.C_Location_ID=l.C_Location_ID) + LEFT OUTER JOIN AD_User bpc ON (io.AD_User_ID=bpc.AD_User_ID) + LEFT OUTER JOIN C_Greeting_Trl bpcg ON (bpc.C_Greeting_ID=bpcg.C_Greeting_ID AND dt.AD_Language=bpcg.AD_Language) + INNER JOIN AD_OrgInfo oi ON (io.AD_Org_ID=oi.AD_Org_ID) + INNER JOIN AD_ClientInfo ci ON (io.AD_Client_ID=oi.AD_Client_ID) + INNER JOIN M_Warehouse wh ON (io.M_Warehouse_ID=wh.M_Warehouse_ID); + + + + + +DROP VIEW PP_Order_BOM_Header_v; + +CREATE OR REPLACE VIEW PP_Order_BOM_Header_v +AS +SELECT o.AD_Client_ID, o.AD_Org_ID, o.IsActive, o.Created, o.CreatedBy, o.Updated, o.UpdatedBy, + cast('en_US' as varchar) AS AD_Language, + o.PP_Order_ID, o.DocumentNo, o.DocStatus,o.C_DocType_ID, + oi.C_Location_ID AS Org_Location_ID, oi.TaxID, + o.M_Warehouse_ID, wh.C_Location_ID AS Warehouse_Location_ID, + d.PrintName AS DocumentType, d.DocumentNote AS DocumentTypeNote, + o.Planner_ID, u.Name AS SalesRep_Name,o.DateStart, o.DateStartSchedule,o.FloatAfter, o.FloatBefored, o.Line, o.Lot, o.SerNo, + --o.M_Product_ID, + --o.M_AttributeSetInstance_ID, + o.C_UOM_ID,o.S_Resource_ID,o.PP_Product_BOM_ID,o.AD_Workflow_ID, o.Assay, o.C_OrderLine_ID, o.PriorityRule , + o.QtyBatchSize , o.QtyBatchs, o.QtyDelivered, o.QtyEntered, o.QtyOrdered, + o.DateConfirm,o.DateDelivered,o.DateFinish, o.DateFinishSchedule,o.DateOrdered, o.DatePromised,o.QtyReject, o.QtyReserved , o.QtyScrap , o.Yield , + o.C_Campaign_ID, o.C_Project_ID, o.C_Activity_ID, + --ob.PP_Product_BOM_ID, + ob.BOMType,ob.BOMUse, ob.Description , ob.Help , ob.M_AttributeSetInstance_ID , ob.M_Product_ID, ob.Name , ob.Revision, ob.ValidFrom , ob.ValidTo, + COALESCE(oi.Logo_ID, ci.Logo_ID) AS Logo_ID +FROM PP_Order o + INNER JOIN C_DocType d ON (o.C_DocType_ID=d.C_DocType_ID) + INNER JOIN PP_Order_BOM ob ON (ob.PP_Order_ID=o.PP_Order_ID) + INNER JOIN M_Warehouse wh ON (o.M_Warehouse_ID=wh.M_Warehouse_ID) + INNER JOIN AD_OrgInfo oi ON (o.AD_Org_ID=oi.AD_Org_ID) + INNER JOIN AD_ClientInfo ci ON (o.AD_Client_ID=oi.AD_Client_ID) + LEFT OUTER JOIN AD_User u ON (o.Planner_ID=u.AD_User_ID); + + +DROP VIEW PP_Order_BOM_Header_vt; + +CREATE OR REPLACE VIEW PP_Order_BOM_Header_vt +AS +SELECT o.AD_Client_ID, o.AD_Org_ID, o.IsActive, o.Created, o.CreatedBy, o.Updated, o.UpdatedBy, + obt.AD_Language, + o.PP_Order_ID, o.DocumentNo, o.DocStatus,o.C_DocType_ID, + oi.C_Location_ID AS Org_Location_ID, oi.TaxID, + o.M_Warehouse_ID, wh.C_Location_ID AS Warehouse_Location_ID, + dt.PrintName AS DocumentType, dt.DocumentNote AS DocumentTypeNote, + o.Planner_ID, u.Name AS SalesRep_Name,o.DateStart, o.DateStartSchedule,o.FloatAfter, o.FloatBefored, o.Line, o.Lot, o.SerNo, + --o.M_Product_ID, + --o.M_AttributeSetInstance_ID, + o.C_UOM_ID,o.S_Resource_ID,o.PP_Product_BOM_ID,o.AD_Workflow_ID, o.Assay, o.C_OrderLine_ID, o.PriorityRule , + o.QtyBatchSize , o.QtyBatchs, o.QtyDelivered, o.QtyEntered, o.QtyOrdered, + o.DateConfirm,o.DateDelivered,o.DateFinish, o.DateFinishSchedule,o.DateOrdered, o.DatePromised,o.QtyReject, o.QtyReserved , o.QtyScrap , o.Yield , + o.C_Campaign_ID, o.C_Project_ID, o.C_Activity_ID, + --ob.PP_Product_BOM_ID, + ob.BOMType,ob.BOMUse, obt.Description , obt.Help , ob.M_AttributeSetInstance_ID , ob.M_Product_ID, obt.Name , ob.Revision, ob.ValidFrom , ob.ValidTo, + COALESCE(oi.Logo_ID, ci.Logo_ID) AS Logo_ID +FROM PP_Order o + INNER JOIN C_DocType_Trl dt ON (o.C_DocType_ID=dt.C_DocType_ID) + INNER JOIN PP_Order_BOM ob ON (ob.PP_Order_ID=o.PP_Order_ID) + INNER JOIN PP_Order_BOM_Trl obt ON (obt.PP_Order_BOM_ID=ob.PP_Order_BOM_ID) + INNER JOIN M_Warehouse wh ON (o.M_Warehouse_ID=wh.M_Warehouse_ID) + INNER JOIN AD_OrgInfo oi ON (o.AD_Org_ID=oi.AD_Org_ID) + INNER JOIN AD_ClientInfo ci ON (o.AD_Client_ID=oi.AD_Client_ID) + LEFT OUTER JOIN AD_User u ON (o.Planner_ID=u.AD_User_ID); + + +DROP VIEW PP_Order_Header_v; + +CREATE OR REPLACE VIEW PP_Order_Header_v +AS +SELECT o.AD_Client_ID, o.AD_Org_ID, o.IsActive, o.Created, o.CreatedBy, o.Updated, o.UpdatedBy, + cast('en_US' as varchar) AS AD_Language, + o.PP_Order_ID, o.DocumentNo, o.DocStatus,o.C_DocType_ID, + oi.C_Location_ID AS Org_Location_ID, oi.TaxID, + o.M_Warehouse_ID, wh.C_Location_ID AS Warehouse_Location_ID, + dt.PrintName AS DocumentType, dt.DocumentNote AS DocumentTypeNote, + o.Planner_ID, u.Name AS SalesRep_Name,o.DateStart, o.DateStartSchedule,o.FloatAfter, o.FloatBefored, o.Line, o.Lot, o.SerNo, + o.Description, + o.M_Product_ID,o.M_AttributeSetInstance_ID,o.C_UOM_ID,o.S_Resource_ID,o.PP_Product_BOM_ID,o.AD_Workflow_ID, o.Assay, o.C_OrderLine_ID, o.PriorityRule , + o.QtyBatchSize , o.QtyBatchs, o.QtyDelivered, o.QtyEntered, o.QtyOrdered, + o.DateConfirm,o.DateDelivered,o.DateFinish, o.DateFinishSchedule,o.DateOrdered, o.DatePromised,o.QtyReject, o.QtyReserved , o.QtyScrap , o.Yield , + o.C_Campaign_ID, o.C_Project_ID, o.C_Activity_ID, o.User1_ID , o.User2_ID , o.AD_OrgTrx_ID ,o.C_DocTypeTarget_ID,o.ScheduleType , o.IsApproved , o.DocAction , o.Posted , o.IsPrinted, o.OrderType, + COALESCE(oi.Logo_ID, ci.Logo_ID) AS Logo_ID +FROM PP_Order o + INNER JOIN C_DocType dt ON (o.C_DocType_ID=dt.C_DocType_ID) + INNER JOIN M_Warehouse wh ON (o.M_Warehouse_ID=wh.M_Warehouse_ID) + INNER JOIN AD_OrgInfo oi ON (o.AD_Org_ID=oi.AD_Org_ID) + INNER JOIN AD_ClientInfo ci ON (o.AD_Client_ID=oi.AD_Client_ID) + LEFT OUTER JOIN AD_User u ON (o.Planner_ID=u.AD_User_ID); + + + + + +DROP VIEW PP_Order_Header_vt; + +CREATE OR REPLACE VIEW PP_Order_Header_vt +AS +SELECT o.AD_Client_ID, o.AD_Org_ID, o.IsActive, o.Created, o.CreatedBy, o.Updated, o.UpdatedBy, + dt.AD_Language, + o.PP_Order_ID, o.DocumentNo, o.DocStatus,o.C_DocType_ID, + oi.C_Location_ID AS Org_Location_ID, oi.TaxID, + o.M_Warehouse_ID, wh.C_Location_ID AS Warehouse_Location_ID, + dt.PrintName AS DocumentType, dt.DocumentNote AS DocumentTypeNote, + o.Planner_ID, u.Name AS SalesRep_Name,o.DateStart, o.DateStartSchedule,o.FloatAfter, o.FloatBefored, o.Line, o.Lot, o.SerNo, + o.Description, + o.M_Product_ID,o.M_AttributeSetInstance_ID,o.C_UOM_ID,o.S_Resource_ID,o.PP_Product_BOM_ID,o.AD_Workflow_ID, o.Assay, o.C_OrderLine_ID, o.PriorityRule , + o.QtyBatchSize , o.QtyBatchs, o.QtyDelivered, o.QtyEntered, o.QtyOrdered, + o.DateConfirm,o.DateDelivered,o.DateFinish, o.DateFinishSchedule,o.DateOrdered, o.DatePromised,o.QtyReject, o.QtyReserved , o.QtyScrap , o.Yield , + o.C_Campaign_ID, o.C_Project_ID, o.C_Activity_ID, o.User1_ID , o.User2_ID , o.AD_OrgTrx_ID ,o.C_DocTypeTarget_ID,o.ScheduleType , o.IsApproved , o.DocAction , o.Posted , o.IsPrinted, o.OrderType, + COALESCE(oi.Logo_ID, ci.Logo_ID) AS Logo_ID +FROM PP_Order o + INNER JOIN C_DocType_trl dt ON (o.C_DocType_ID=dt.C_DocType_ID) + INNER JOIN M_Warehouse wh ON (o.M_Warehouse_ID=wh.M_Warehouse_ID) + INNER JOIN AD_OrgInfo oi ON (o.AD_Org_ID=oi.AD_Org_ID) + INNER JOIN AD_ClientInfo ci ON (o.AD_Client_ID=oi.AD_Client_ID) + LEFT OUTER JOIN AD_User u ON (o.Planner_ID=u.AD_User_ID); + + + + + +DROP VIEW PP_Order_Workflow_Header_v; + +CREATE OR REPLACE VIEW PP_Order_Workflow_Header_v +AS +SELECT o.AD_Client_ID, o.AD_Org_ID, o.IsActive, o.Created, o.CreatedBy, o.Updated, o.UpdatedBy, + cast('en_US' as varchar) AS AD_Language, + o.PP_Order_ID, + --o.DocumentNo, + o.DocStatus, + o.C_DocType_ID, + oi.C_Location_ID AS Org_Location_ID, oi.TaxID, + o.M_Warehouse_ID, wh.C_Location_ID AS Warehouse_Location_ID, + d.PrintName AS DocumentType, d.DocumentNote AS DocumentTypeNote, + o.Planner_ID, u.Name AS SalesRep_Name,o.DateStart, o.DateStartSchedule,o.FloatAfter, o.FloatBefored, o.Line, o.Lot, o.SerNo, + --o.M_Product_ID, + --o.M_AttributeSetInstance_ID, + o.C_UOM_ID,o.S_Resource_ID,o.PP_Product_BOM_ID,o.AD_Workflow_ID, o.Assay, o.C_OrderLine_ID, o.PriorityRule , + o.QtyBatchs, o.QtyDelivered, o.QtyEntered, o.QtyOrdered, + o.DateConfirm,o.DateDelivered,o.DateFinish, o.DateFinishSchedule,o.DateOrdered, o.DatePromised,o.QtyReject, o.QtyReserved , o.QtyScrap , + o.C_Campaign_ID, o.C_Project_ID, o.C_Activity_ID, + -- Order Workflow Field + ow.Name ,ow.Description ,ow.Help, + ow.Author, ow.Cost, ow.DocumentNo , ow.Duration, ow.DurationUnit , ow.Version, ow.ValidFrom , ow.ValidTo , + ow.MovingTime, ow.OverlapUnits , ow.PublishStatus , ow.QueuingTime , ow.SetupTime , ow.UnitsCycles, + ow.WaitingTime , ow.WorkflowType, ow.WorkingTime , ow.Yield, COALESCE(oi.Logo_ID, ci.Logo_ID) AS Logo_ID +FROM PP_Order o + INNER JOIN PP_Order_Workflow ow ON (ow.PP_Order_ID=o.PP_Order_ID) + INNER JOIN C_DocType d ON (o.C_DocType_ID=d.C_DocType_ID) + INNER JOIN M_Warehouse wh ON (o.M_Warehouse_ID=wh.M_Warehouse_ID) + INNER JOIN AD_OrgInfo oi ON (o.AD_Org_ID=oi.AD_Org_ID) + INNER JOIN AD_ClientInfo ci ON (o.AD_Client_ID=oi.AD_Client_ID) + LEFT OUTER JOIN AD_User u ON (o.Planner_ID=u.AD_User_ID); + + +DROP VIEW PP_Order_Workflow_Header_vt; + +CREATE OR REPLACE VIEW PP_Order_Workflow_Header_vt +AS +SELECT o.AD_Client_ID, o.AD_Org_ID, o.IsActive, o.Created, o.CreatedBy, o.Updated, o.UpdatedBy, + owt.AD_Language, + o.PP_Order_ID, + --o.DocumentNo, + o.DocStatus, + o.C_DocType_ID, + oi.C_Location_ID AS Org_Location_ID, oi.TaxID, + o.M_Warehouse_ID, wh.C_Location_ID AS Warehouse_Location_ID, + dt.PrintName AS DocumentType, dt.DocumentNote AS DocumentTypeNote, + o.Planner_ID, u.Name AS SalesRep_Name,o.DateStart, o.DateStartSchedule,o.FloatAfter, o.FloatBefored, o.Line, o.Lot, o.SerNo, + o.C_UOM_ID,o.PP_Product_BOM_ID, o.Assay, o.C_OrderLine_ID, o.PriorityRule , + o.QtyBatchSize , o.QtyBatchs, o.QtyDelivered, o.QtyEntered, o.QtyOrdered, + o.DateConfirm,o.DateDelivered,o.DateFinish, o.DateFinishSchedule,o.DateOrdered, o.DatePromised,o.QtyReject, o.QtyReserved , o.QtyScrap , o.S_Resource_ID , + o.C_Campaign_ID, o.C_Project_ID, o.C_Activity_ID, + --Trl Field + owt.Name , owt.Description, owt.Help, + -- Order Workflow Field + ow.Author, ow.Cost, ow.DocumentNo , ow.Duration, ow.DurationUnit, ow.Version, ow.ValidFrom , ow.ValidTo , + ow.MovingTime, ow.OverlapUnits, ow.AD_Workflow_ID, ow.PublishStatus , ow.QueuingTime , ow.SetupTime , ow.UnitsCycles, + ow.WaitingTime , ow.WorkflowType , ow.WorkingTime , ow.Yield, COALESCE(oi.Logo_ID, ci.Logo_ID) AS Logo_ID +FROM PP_Order o + INNER JOIN PP_Order_Workflow ow ON (ow.PP_Order_ID=o.PP_Order_ID) + INNER JOIN PP_Order_Workflow_Trl owt ON (owt.PP_Order_Workflow_ID=ow.PP_Order_Workflow_ID) + INNER JOIN C_DocType dt ON (o.C_DocType_ID=dt.C_DocType_ID) + INNER JOIN M_Warehouse wh ON (o.M_Warehouse_ID=wh.M_Warehouse_ID) + INNER JOIN AD_OrgInfo oi ON (o.AD_Org_ID=oi.AD_Org_ID) + INNER JOIN AD_ClientInfo ci ON (o.AD_Client_ID=oi.AD_Client_ID) + LEFT OUTER JOIN AD_User u ON (o.Planner_ID=u.AD_User_ID); + +