From 800f38e55a74bfec7c5a471382fc840c682fdc00 Mon Sep 17 00:00:00 2001 From: Heng Sin Low Date: Mon, 12 Feb 2007 02:20:14 +0000 Subject: [PATCH] * [ 1656840 ] Problem on invoice amounts that are not integers --- db/ddlutils/adempiere-model.xml | 21722 ++++++++++++++++ db/ddlutils/oracle/build.xml | 4 +- .../{ => oracle}/views/AD_CHANGELOG_V.sql | 0 db/ddlutils/{ => oracle}/views/AD_FIELD_V.sql | 0 .../{ => oracle}/views/AD_FIELD_VT.sql | 0 db/ddlutils/{ => oracle}/views/AD_ORG_V.sql | 0 db/ddlutils/{ => oracle}/views/AD_TAB_V.sql | 0 db/ddlutils/{ => oracle}/views/AD_TAB_VT.sql | 0 .../{ => oracle}/views/AD_USER_ROLES_V.sql | 0 .../{ => oracle}/views/AD_WINDOW_VT.sql | 0 .../{ => oracle}/views/C_DUNNING_HEADER_V.sql | 0 .../views/C_DUNNING_HEADER_VT.sql | 0 .../{ => oracle}/views/C_DUNNING_LINE_V.sql | 0 .../{ => oracle}/views/C_DUNNING_LINE_VT.sql | 0 .../{ => oracle}/views/C_INVOICELINE_V.sql | 0 .../views/C_INVOICE_CANDIDATE_V.sql | 0 .../{ => oracle}/views/C_INVOICE_HEADER_V.sql | 0 .../views/C_INVOICE_HEADER_VT.sql | 0 .../views/C_INVOICE_LINETAX_V.sql | 0 .../views/C_INVOICE_LINETAX_VT.sql | 0 db/ddlutils/oracle/views/C_INVOICE_V.sql | 53 + db/ddlutils/oracle/views/C_INVOICE_V1.sql | 32 + .../{ => oracle}/views/C_ORDER_HEADER_V.sql | 0 .../{ => oracle}/views/C_ORDER_HEADER_VT.sql | 0 .../{ => oracle}/views/C_ORDER_LINETAX_V.sql | 0 .../{ => oracle}/views/C_ORDER_LINETAX_VT.sql | 0 .../{ => oracle}/views/C_PAYMENT_V.sql | 0 .../views/C_PAYSELECTION_CHECK_V.sql | 0 .../views/C_PAYSELECTION_CHECK_VT.sql | 0 .../views/C_PAYSELECTION_REMITTANCE_V.sql | 0 .../views/C_PAYSELECTION_REMITTANCE_VT.sql | 0 .../views/C_PROJECT_DETAILS_V.sql | 0 .../views/C_PROJECT_DETAILS_VT.sql | 0 .../{ => oracle}/views/C_PROJECT_HEADER_V.sql | 0 .../views/C_PROJECT_HEADER_VT.sql | 0 .../views/C_RFQRESPONSELINEQTY_V.sql | 0 .../views/C_RFQRESPONSELINEQTY_VT.sql | 0 .../views/C_RFQRESPONSELINE_V.sql | 0 .../views/C_RFQRESPONSELINE_VT.sql | 0 .../{ => oracle}/views/C_RFQRESPONSE_V.sql | 0 .../{ => oracle}/views/C_RFQRESPONSE_VT.sql | 0 .../views/GL_JOURNALLINE_ACCT_V.sql | 0 .../{ => oracle}/views/M_INOUTCONFIRM_V.sql | 0 .../{ => oracle}/views/M_INOUTCONFIRM_VT.sql | 0 .../{ => oracle}/views/M_INOUTLINEMA_V.sql | 0 .../{ => oracle}/views/M_INOUTLINEMA_VT.sql | 0 .../views/M_INOUT_CANDIDATE_V.sql | 0 .../{ => oracle}/views/M_INOUT_HEADER_V.sql | 0 .../{ => oracle}/views/M_INOUT_HEADER_VT.sql | 0 .../views/M_INOUT_LINECONFIRM_V.sql | 0 .../views/M_INOUT_LINECONFIRM_VT.sql | 0 .../{ => oracle}/views/M_INOUT_LINE_V.sql | 0 .../{ => oracle}/views/M_INOUT_LINE_VT.sql | 0 .../{ => oracle}/views/M_MOVEMENTLINEMA_V.sql | 0 .../views/M_MOVEMENTLINEMA_VT.sql | 0 .../{ => oracle}/views/M_TRANSACTION_V.sql | 0 .../{ => oracle}/views/RV_ALLOCATION.sql | 0 .../{ => oracle}/views/RV_ASSET_CUSTOMER.sql | 0 .../{ => oracle}/views/RV_ASSET_DELIVERY.sql | 0 .../{ => oracle}/views/RV_ASSET_SUMMONTH.sql | 0 .../{ => oracle}/views/RV_BPARTNER.sql | 0 .../{ => oracle}/views/RV_BPARTNEROPEN.sql | 0 .../{ => oracle}/views/RV_CASH_DETAIL.sql | 0 .../{ => oracle}/views/RV_CLICK_MONTH.sql | 0 .../views/RV_CLICK_UNPROCESSED.sql | 0 .../views/RV_COMMISSIONRUNDETAIL.sql | 0 db/ddlutils/{ => oracle}/views/RV_COST.sql | 0 .../{ => oracle}/views/RV_COSTDETAIL.sql | 0 .../{ => oracle}/views/RV_COSTSUMMARY.sql | 0 .../{ => oracle}/views/RV_C_INVOICE.sql | 0 .../{ => oracle}/views/RV_C_INVOICELINE.sql | 0 .../{ => oracle}/views/RV_C_INVOICETAX.sql | 0 .../views/RV_C_INVOICE_CUSTOMERPRODQTR.sql | 0 .../views/RV_C_INVOICE_CUSTOMERVENDQTR.sql | 0 .../{ => oracle}/views/RV_C_INVOICE_DAY.sql | 0 .../{ => oracle}/views/RV_C_INVOICE_MONTH.sql | 0 .../views/RV_C_INVOICE_PRODMONTH.sql | 0 .../views/RV_C_INVOICE_PRODUCTMONTH.sql | 0 .../views/RV_C_INVOICE_PRODUCTQTR.sql | 0 .../views/RV_C_INVOICE_PRODWEEK.sql | 0 .../views/RV_C_INVOICE_VENDORMONTH.sql | 0 .../{ => oracle}/views/RV_C_INVOICE_WEEK.sql | 0 .../{ => oracle}/views/RV_C_RFQRESPONSE.sql | 0 .../views/RV_C_RFQ_UNANSWERED.sql | 0 .../{ => oracle}/views/RV_FACT_ACCT.sql | 0 .../{ => oracle}/views/RV_FACT_ACCT_DAY.sql | 0 .../views/RV_FACT_ACCT_PERIOD.sql | 0 .../{ => oracle}/views/RV_INOUTCONFIRM.sql | 0 .../{ => oracle}/views/RV_INOUTDETAILS.sql | 0 .../views/RV_INOUTLINECONFIRM.sql | 0 .../{ => oracle}/views/RV_M_REQUISITION.sql | 0 .../{ => oracle}/views/RV_M_TRANSACTION.sql | 0 .../views/RV_M_TRANSACTION_SUM.sql | 0 db/ddlutils/oracle/views/RV_OPENITEM.sql | 55 + .../{ => oracle}/views/RV_ORDERDETAIL.sql | 0 db/ddlutils/{ => oracle}/views/RV_PAYMENT.sql | 0 .../views/RV_PRINTFORMATDETAIL.sql | 0 .../{ => oracle}/views/RV_PRODUCT_COSTING.sql | 0 .../{ => oracle}/views/RV_PROJECTCYCLE.sql | 0 .../views/RV_PROJECTLINEISSUE.sql | 0 .../oracle/views/RV_REQUESTUPDATES.sql | 46 + .../views/RV_REQUESTUPDATES_ONLY.sql | 0 .../views/RV_REQUESTUPDATES_V.sql | 0 db/ddlutils/{ => oracle}/views/RV_STORAGE.sql | 0 .../{ => oracle}/views/RV_TRANSACTION.sql | 0 .../{ => oracle}/views/RV_UNPOSTED.sql | 0 .../{ => oracle}/views/RV_WAREHOUSEPRICE.sql | 0 .../{ => oracle}/views/R_REQUEST_V.sql | 0 .../{ => oracle}/views/T_INVOICEGL_V.sql | 0 .../{ => oracle}/views/T_INVOICEGL_VT.sql | 0 db/ddlutils/postgresql/aliasfunction.sql | 79 - db/ddlutils/postgresql/build.xml | 4 +- .../postgresql/views/AD_CHANGELOG_V.sql | 16 + db/ddlutils/postgresql/views/AD_FIELD_V.sql | 36 + db/ddlutils/postgresql/views/AD_FIELD_VT.sql | 37 + db/ddlutils/postgresql/views/AD_ORG_V.sql | 19 + db/ddlutils/postgresql/views/AD_TAB_V.sql | 24 + db/ddlutils/postgresql/views/AD_TAB_VT.sql | 26 + .../postgresql/views/AD_USER_ROLES_V.sql | 10 + db/ddlutils/postgresql/views/AD_WINDOW_VT.sql | 15 + .../postgresql/views/C_DUNNING_HEADER_V.sql | 37 + .../postgresql/views/C_DUNNING_HEADER_VT.sql | 40 + .../postgresql/views/C_DUNNING_LINE_V.sql | 50 + .../postgresql/views/C_DUNNING_LINE_VT.sql | 52 + .../postgresql/views/C_INVOICELINE_V.sql | 28 + .../views/C_INVOICE_CANDIDATE_V.sql | 54 + .../postgresql/views/C_INVOICE_HEADER_V.sql | 56 + .../postgresql/views/C_INVOICE_HEADER_VT.sql | 56 + .../postgresql/views/C_INVOICE_LINETAX_V.sql | 114 + .../postgresql/views/C_INVOICE_LINETAX_VT.sql | 117 + .../{ => postgresql}/views/C_INVOICE_V.sql | 0 .../{ => postgresql}/views/C_INVOICE_V1.sql | 0 .../postgresql/views/C_ORDER_HEADER_V.sql | 70 + .../postgresql/views/C_ORDER_HEADER_VT.sql | 70 + .../postgresql/views/C_ORDER_LINETAX_V.sql | 93 + .../postgresql/views/C_ORDER_LINETAX_VT.sql | 96 + db/ddlutils/postgresql/views/C_PAYMENT_V.sql | 42 + .../views/C_PAYSELECTION_CHECK_V.sql | 27 + .../views/C_PAYSELECTION_CHECK_VT.sql | 28 + .../views/C_PAYSELECTION_REMITTANCE_V.sql | 17 + .../views/C_PAYSELECTION_REMITTANCE_VT.sql | 18 + .../postgresql/views/C_PROJECT_DETAILS_V.sql | 28 + .../postgresql/views/C_PROJECT_DETAILS_VT.sql | 29 + .../postgresql/views/C_PROJECT_HEADER_V.sql | 50 + .../postgresql/views/C_PROJECT_HEADER_VT.sql | 50 + .../views/C_RFQRESPONSELINEQTY_V.sql | 18 + .../views/C_RFQRESPONSELINEQTY_VT.sql | 19 + .../postgresql/views/C_RFQRESPONSELINE_V.sql | 34 + .../postgresql/views/C_RFQRESPONSELINE_VT.sql | 34 + .../postgresql/views/C_RFQRESPONSE_V.sql | 29 + .../postgresql/views/C_RFQRESPONSE_VT.sql | 30 + .../views/GL_JOURNALLINE_ACCT_V.sql | 26 + .../postgresql/views/M_INOUTCONFIRM_V.sql | 29 + .../postgresql/views/M_INOUTCONFIRM_VT.sql | 29 + .../postgresql/views/M_INOUTLINEMA_V.sql | 17 + .../postgresql/views/M_INOUTLINEMA_VT.sql | 17 + .../postgresql/views/M_INOUT_CANDIDATE_V.sql | 37 + .../postgresql/views/M_INOUT_HEADER_V.sql | 45 + .../postgresql/views/M_INOUT_HEADER_VT.sql | 45 + .../views/M_INOUT_LINECONFIRM_V.sql | 34 + .../views/M_INOUT_LINECONFIRM_VT.sql | 35 + .../postgresql/views/M_INOUT_LINE_V.sql | 61 + .../postgresql/views/M_INOUT_LINE_VT.sql | 63 + .../postgresql/views/M_MOVEMENTLINEMA_V.sql | 17 + .../postgresql/views/M_MOVEMENTLINEMA_VT.sql | 17 + .../postgresql/views/M_TRANSACTION_V.sql | 26 + .../postgresql/views/RV_ALLOCATION.sql | 20 + .../postgresql/views/RV_ASSET_CUSTOMER.sql | 17 + .../postgresql/views/RV_ASSET_DELIVERY.sql | 22 + .../postgresql/views/RV_ASSET_SUMMONTH.sql | 25 + db/ddlutils/postgresql/views/RV_BPARTNER.sql | 59 + .../postgresql/views/RV_BPARTNEROPEN.sql | 31 + .../postgresql/views/RV_CASH_DETAIL.sql | 19 + .../postgresql/views/RV_CLICK_MONTH.sql | 17 + .../postgresql/views/RV_CLICK_UNPROCESSED.sql | 14 + .../views/RV_COMMISSIONRUNDETAIL.sql | 46 + db/ddlutils/postgresql/views/RV_COST.sql | 20 + .../postgresql/views/RV_COSTDETAIL.sql | 21 + .../postgresql/views/RV_COSTSUMMARY.sql | 21 + db/ddlutils/postgresql/views/RV_C_INVOICE.sql | 38 + .../postgresql/views/RV_C_INVOICELINE.sql | 48 + .../postgresql/views/RV_C_INVOICETAX.sql | 23 + .../views/RV_C_INVOICE_CUSTOMERPRODQTR.sql | 24 + .../views/RV_C_INVOICE_CUSTOMERVENDQTR.sql | 26 + .../postgresql/views/RV_C_INVOICE_DAY.sql | 23 + .../postgresql/views/RV_C_INVOICE_MONTH.sql | 23 + .../views/RV_C_INVOICE_PRODMONTH.sql | 23 + .../views/RV_C_INVOICE_PRODUCTMONTH.sql | 23 + .../views/RV_C_INVOICE_PRODUCTQTR.sql | 23 + .../views/RV_C_INVOICE_PRODWEEK.sql | 23 + .../views/RV_C_INVOICE_VENDORMONTH.sql | 26 + .../postgresql/views/RV_C_INVOICE_WEEK.sql | 23 + .../postgresql/views/RV_C_RFQRESPONSE.sql | 35 + .../postgresql/views/RV_C_RFQ_UNANSWERED.sql | 17 + db/ddlutils/postgresql/views/RV_FACT_ACCT.sql | 42 + .../postgresql/views/RV_FACT_ACCT_DAY.sql | 29 + .../postgresql/views/RV_FACT_ACCT_PERIOD.sql | 28 + .../postgresql/views/RV_INOUTCONFIRM.sql | 17 + .../postgresql/views/RV_INOUTDETAILS.sql | 47 + .../postgresql/views/RV_INOUTLINECONFIRM.sql | 22 + .../postgresql/views/RV_M_REQUISITION.sql | 22 + .../postgresql/views/RV_M_TRANSACTION.sql | 16 + .../postgresql/views/RV_M_TRANSACTION_SUM.sql | 14 + .../{ => postgresql}/views/RV_OPENITEM.sql | 0 .../postgresql/views/RV_ORDERDETAIL.sql | 43 + db/ddlutils/postgresql/views/RV_PAYMENT.sql | 45 + .../postgresql/views/RV_PRINTFORMATDETAIL.sql | 45 + .../postgresql/views/RV_PRODUCT_COSTING.sql | 29 + .../postgresql/views/RV_PROJECTCYCLE.sql | 38 + .../postgresql/views/RV_PROJECTLINEISSUE.sql | 33 + .../views/RV_REQUESTUPDATES.sql | 0 .../views/RV_REQUESTUPDATES_ONLY.sql | 14 + .../postgresql/views/RV_REQUESTUPDATES_V.sql | 14 + db/ddlutils/postgresql/views/RV_STORAGE.sql | 32 + .../postgresql/views/RV_TRANSACTION.sql | 44 + db/ddlutils/postgresql/views/RV_UNPOSTED.sql | 68 + .../postgresql/views/RV_WAREHOUSEPRICE.sql | 39 + db/ddlutils/postgresql/views/R_REQUEST_V.sql | 30 + .../postgresql/views/T_INVOICEGL_V.sql | 45 + .../postgresql/views/T_INVOICEGL_VT.sql | 45 + 220 files changed, 25510 insertions(+), 83 deletions(-) create mode 100644 db/ddlutils/adempiere-model.xml rename db/ddlutils/{ => oracle}/views/AD_CHANGELOG_V.sql (100%) rename db/ddlutils/{ => oracle}/views/AD_FIELD_V.sql (100%) rename db/ddlutils/{ => oracle}/views/AD_FIELD_VT.sql (100%) rename db/ddlutils/{ => oracle}/views/AD_ORG_V.sql (100%) rename db/ddlutils/{ => oracle}/views/AD_TAB_V.sql (100%) rename db/ddlutils/{ => oracle}/views/AD_TAB_VT.sql (100%) rename db/ddlutils/{ => oracle}/views/AD_USER_ROLES_V.sql (100%) rename db/ddlutils/{ => oracle}/views/AD_WINDOW_VT.sql (100%) rename db/ddlutils/{ => oracle}/views/C_DUNNING_HEADER_V.sql (100%) rename db/ddlutils/{ => oracle}/views/C_DUNNING_HEADER_VT.sql (100%) rename db/ddlutils/{ => oracle}/views/C_DUNNING_LINE_V.sql (100%) rename db/ddlutils/{ => oracle}/views/C_DUNNING_LINE_VT.sql (100%) rename db/ddlutils/{ => oracle}/views/C_INVOICELINE_V.sql (100%) rename db/ddlutils/{ => oracle}/views/C_INVOICE_CANDIDATE_V.sql (100%) rename db/ddlutils/{ => oracle}/views/C_INVOICE_HEADER_V.sql (100%) rename db/ddlutils/{ => oracle}/views/C_INVOICE_HEADER_VT.sql (100%) rename db/ddlutils/{ => oracle}/views/C_INVOICE_LINETAX_V.sql (100%) rename db/ddlutils/{ => oracle}/views/C_INVOICE_LINETAX_VT.sql (100%) create mode 100644 db/ddlutils/oracle/views/C_INVOICE_V.sql create mode 100644 db/ddlutils/oracle/views/C_INVOICE_V1.sql rename db/ddlutils/{ => oracle}/views/C_ORDER_HEADER_V.sql (100%) rename db/ddlutils/{ => oracle}/views/C_ORDER_HEADER_VT.sql (100%) rename db/ddlutils/{ => oracle}/views/C_ORDER_LINETAX_V.sql (100%) rename db/ddlutils/{ => oracle}/views/C_ORDER_LINETAX_VT.sql (100%) rename db/ddlutils/{ => oracle}/views/C_PAYMENT_V.sql (100%) rename db/ddlutils/{ => oracle}/views/C_PAYSELECTION_CHECK_V.sql (100%) rename db/ddlutils/{ => oracle}/views/C_PAYSELECTION_CHECK_VT.sql (100%) rename db/ddlutils/{ => oracle}/views/C_PAYSELECTION_REMITTANCE_V.sql (100%) rename db/ddlutils/{ => oracle}/views/C_PAYSELECTION_REMITTANCE_VT.sql (100%) rename db/ddlutils/{ => oracle}/views/C_PROJECT_DETAILS_V.sql (100%) rename db/ddlutils/{ => oracle}/views/C_PROJECT_DETAILS_VT.sql (100%) rename db/ddlutils/{ => oracle}/views/C_PROJECT_HEADER_V.sql (100%) rename db/ddlutils/{ => oracle}/views/C_PROJECT_HEADER_VT.sql (100%) rename db/ddlutils/{ => oracle}/views/C_RFQRESPONSELINEQTY_V.sql (100%) rename db/ddlutils/{ => oracle}/views/C_RFQRESPONSELINEQTY_VT.sql (100%) rename db/ddlutils/{ => oracle}/views/C_RFQRESPONSELINE_V.sql (100%) rename db/ddlutils/{ => oracle}/views/C_RFQRESPONSELINE_VT.sql (100%) rename db/ddlutils/{ => oracle}/views/C_RFQRESPONSE_V.sql (100%) rename db/ddlutils/{ => oracle}/views/C_RFQRESPONSE_VT.sql (100%) rename db/ddlutils/{ => oracle}/views/GL_JOURNALLINE_ACCT_V.sql (100%) rename db/ddlutils/{ => oracle}/views/M_INOUTCONFIRM_V.sql (100%) rename db/ddlutils/{ => oracle}/views/M_INOUTCONFIRM_VT.sql (100%) rename db/ddlutils/{ => oracle}/views/M_INOUTLINEMA_V.sql (100%) rename db/ddlutils/{ => oracle}/views/M_INOUTLINEMA_VT.sql (100%) rename db/ddlutils/{ => oracle}/views/M_INOUT_CANDIDATE_V.sql (100%) rename db/ddlutils/{ => oracle}/views/M_INOUT_HEADER_V.sql (100%) rename db/ddlutils/{ => oracle}/views/M_INOUT_HEADER_VT.sql (100%) rename db/ddlutils/{ => oracle}/views/M_INOUT_LINECONFIRM_V.sql (100%) rename db/ddlutils/{ => oracle}/views/M_INOUT_LINECONFIRM_VT.sql (100%) rename db/ddlutils/{ => oracle}/views/M_INOUT_LINE_V.sql (100%) rename db/ddlutils/{ => oracle}/views/M_INOUT_LINE_VT.sql (100%) rename db/ddlutils/{ => oracle}/views/M_MOVEMENTLINEMA_V.sql (100%) rename db/ddlutils/{ => oracle}/views/M_MOVEMENTLINEMA_VT.sql (100%) rename db/ddlutils/{ => oracle}/views/M_TRANSACTION_V.sql (100%) rename db/ddlutils/{ => oracle}/views/RV_ALLOCATION.sql (100%) rename db/ddlutils/{ => oracle}/views/RV_ASSET_CUSTOMER.sql (100%) rename db/ddlutils/{ => oracle}/views/RV_ASSET_DELIVERY.sql (100%) rename db/ddlutils/{ => oracle}/views/RV_ASSET_SUMMONTH.sql (100%) rename db/ddlutils/{ => oracle}/views/RV_BPARTNER.sql (100%) rename db/ddlutils/{ => oracle}/views/RV_BPARTNEROPEN.sql (100%) rename db/ddlutils/{ => oracle}/views/RV_CASH_DETAIL.sql (100%) rename db/ddlutils/{ => oracle}/views/RV_CLICK_MONTH.sql (100%) rename db/ddlutils/{ => oracle}/views/RV_CLICK_UNPROCESSED.sql (100%) rename db/ddlutils/{ => oracle}/views/RV_COMMISSIONRUNDETAIL.sql (100%) rename db/ddlutils/{ => oracle}/views/RV_COST.sql (100%) rename db/ddlutils/{ => oracle}/views/RV_COSTDETAIL.sql (100%) rename db/ddlutils/{ => oracle}/views/RV_COSTSUMMARY.sql (100%) rename db/ddlutils/{ => oracle}/views/RV_C_INVOICE.sql (100%) rename db/ddlutils/{ => oracle}/views/RV_C_INVOICELINE.sql (100%) rename db/ddlutils/{ => oracle}/views/RV_C_INVOICETAX.sql (100%) rename db/ddlutils/{ => oracle}/views/RV_C_INVOICE_CUSTOMERPRODQTR.sql (100%) rename db/ddlutils/{ => oracle}/views/RV_C_INVOICE_CUSTOMERVENDQTR.sql (100%) rename db/ddlutils/{ => oracle}/views/RV_C_INVOICE_DAY.sql (100%) rename db/ddlutils/{ => oracle}/views/RV_C_INVOICE_MONTH.sql (100%) rename db/ddlutils/{ => oracle}/views/RV_C_INVOICE_PRODMONTH.sql (100%) rename db/ddlutils/{ => oracle}/views/RV_C_INVOICE_PRODUCTMONTH.sql (100%) rename db/ddlutils/{ => oracle}/views/RV_C_INVOICE_PRODUCTQTR.sql (100%) rename db/ddlutils/{ => oracle}/views/RV_C_INVOICE_PRODWEEK.sql (100%) rename db/ddlutils/{ => oracle}/views/RV_C_INVOICE_VENDORMONTH.sql (100%) rename db/ddlutils/{ => oracle}/views/RV_C_INVOICE_WEEK.sql (100%) rename db/ddlutils/{ => oracle}/views/RV_C_RFQRESPONSE.sql (100%) rename db/ddlutils/{ => oracle}/views/RV_C_RFQ_UNANSWERED.sql (100%) rename db/ddlutils/{ => oracle}/views/RV_FACT_ACCT.sql (100%) rename db/ddlutils/{ => oracle}/views/RV_FACT_ACCT_DAY.sql (100%) rename db/ddlutils/{ => oracle}/views/RV_FACT_ACCT_PERIOD.sql (100%) rename db/ddlutils/{ => oracle}/views/RV_INOUTCONFIRM.sql (100%) rename db/ddlutils/{ => oracle}/views/RV_INOUTDETAILS.sql (100%) rename db/ddlutils/{ => oracle}/views/RV_INOUTLINECONFIRM.sql (100%) rename db/ddlutils/{ => oracle}/views/RV_M_REQUISITION.sql (100%) rename db/ddlutils/{ => oracle}/views/RV_M_TRANSACTION.sql (100%) rename db/ddlutils/{ => oracle}/views/RV_M_TRANSACTION_SUM.sql (100%) create mode 100644 db/ddlutils/oracle/views/RV_OPENITEM.sql rename db/ddlutils/{ => oracle}/views/RV_ORDERDETAIL.sql (100%) rename db/ddlutils/{ => oracle}/views/RV_PAYMENT.sql (100%) rename db/ddlutils/{ => oracle}/views/RV_PRINTFORMATDETAIL.sql (100%) rename db/ddlutils/{ => oracle}/views/RV_PRODUCT_COSTING.sql (100%) rename db/ddlutils/{ => oracle}/views/RV_PROJECTCYCLE.sql (100%) rename db/ddlutils/{ => oracle}/views/RV_PROJECTLINEISSUE.sql (100%) create mode 100644 db/ddlutils/oracle/views/RV_REQUESTUPDATES.sql rename db/ddlutils/{ => oracle}/views/RV_REQUESTUPDATES_ONLY.sql (100%) rename db/ddlutils/{ => oracle}/views/RV_REQUESTUPDATES_V.sql (100%) rename db/ddlutils/{ => oracle}/views/RV_STORAGE.sql (100%) rename db/ddlutils/{ => oracle}/views/RV_TRANSACTION.sql (100%) rename db/ddlutils/{ => oracle}/views/RV_UNPOSTED.sql (100%) rename db/ddlutils/{ => oracle}/views/RV_WAREHOUSEPRICE.sql (100%) rename db/ddlutils/{ => oracle}/views/R_REQUEST_V.sql (100%) rename db/ddlutils/{ => oracle}/views/T_INVOICEGL_V.sql (100%) rename db/ddlutils/{ => oracle}/views/T_INVOICEGL_VT.sql (100%) delete mode 100644 db/ddlutils/postgresql/aliasfunction.sql create mode 100644 db/ddlutils/postgresql/views/AD_CHANGELOG_V.sql create mode 100644 db/ddlutils/postgresql/views/AD_FIELD_V.sql create mode 100644 db/ddlutils/postgresql/views/AD_FIELD_VT.sql create mode 100644 db/ddlutils/postgresql/views/AD_ORG_V.sql create mode 100644 db/ddlutils/postgresql/views/AD_TAB_V.sql create mode 100644 db/ddlutils/postgresql/views/AD_TAB_VT.sql create mode 100644 db/ddlutils/postgresql/views/AD_USER_ROLES_V.sql create mode 100644 db/ddlutils/postgresql/views/AD_WINDOW_VT.sql create mode 100644 db/ddlutils/postgresql/views/C_DUNNING_HEADER_V.sql create mode 100644 db/ddlutils/postgresql/views/C_DUNNING_HEADER_VT.sql create mode 100644 db/ddlutils/postgresql/views/C_DUNNING_LINE_V.sql create mode 100644 db/ddlutils/postgresql/views/C_DUNNING_LINE_VT.sql create mode 100644 db/ddlutils/postgresql/views/C_INVOICELINE_V.sql create mode 100644 db/ddlutils/postgresql/views/C_INVOICE_CANDIDATE_V.sql create mode 100644 db/ddlutils/postgresql/views/C_INVOICE_HEADER_V.sql create mode 100644 db/ddlutils/postgresql/views/C_INVOICE_HEADER_VT.sql create mode 100644 db/ddlutils/postgresql/views/C_INVOICE_LINETAX_V.sql create mode 100644 db/ddlutils/postgresql/views/C_INVOICE_LINETAX_VT.sql rename db/ddlutils/{ => postgresql}/views/C_INVOICE_V.sql (100%) rename db/ddlutils/{ => postgresql}/views/C_INVOICE_V1.sql (100%) create mode 100644 db/ddlutils/postgresql/views/C_ORDER_HEADER_V.sql create mode 100644 db/ddlutils/postgresql/views/C_ORDER_HEADER_VT.sql create mode 100644 db/ddlutils/postgresql/views/C_ORDER_LINETAX_V.sql create mode 100644 db/ddlutils/postgresql/views/C_ORDER_LINETAX_VT.sql create mode 100644 db/ddlutils/postgresql/views/C_PAYMENT_V.sql create mode 100644 db/ddlutils/postgresql/views/C_PAYSELECTION_CHECK_V.sql create mode 100644 db/ddlutils/postgresql/views/C_PAYSELECTION_CHECK_VT.sql create mode 100644 db/ddlutils/postgresql/views/C_PAYSELECTION_REMITTANCE_V.sql create mode 100644 db/ddlutils/postgresql/views/C_PAYSELECTION_REMITTANCE_VT.sql create mode 100644 db/ddlutils/postgresql/views/C_PROJECT_DETAILS_V.sql create mode 100644 db/ddlutils/postgresql/views/C_PROJECT_DETAILS_VT.sql create mode 100644 db/ddlutils/postgresql/views/C_PROJECT_HEADER_V.sql create mode 100644 db/ddlutils/postgresql/views/C_PROJECT_HEADER_VT.sql create mode 100644 db/ddlutils/postgresql/views/C_RFQRESPONSELINEQTY_V.sql create mode 100644 db/ddlutils/postgresql/views/C_RFQRESPONSELINEQTY_VT.sql create mode 100644 db/ddlutils/postgresql/views/C_RFQRESPONSELINE_V.sql create mode 100644 db/ddlutils/postgresql/views/C_RFQRESPONSELINE_VT.sql create mode 100644 db/ddlutils/postgresql/views/C_RFQRESPONSE_V.sql create mode 100644 db/ddlutils/postgresql/views/C_RFQRESPONSE_VT.sql create mode 100644 db/ddlutils/postgresql/views/GL_JOURNALLINE_ACCT_V.sql create mode 100644 db/ddlutils/postgresql/views/M_INOUTCONFIRM_V.sql create mode 100644 db/ddlutils/postgresql/views/M_INOUTCONFIRM_VT.sql create mode 100644 db/ddlutils/postgresql/views/M_INOUTLINEMA_V.sql create mode 100644 db/ddlutils/postgresql/views/M_INOUTLINEMA_VT.sql create mode 100644 db/ddlutils/postgresql/views/M_INOUT_CANDIDATE_V.sql create mode 100644 db/ddlutils/postgresql/views/M_INOUT_HEADER_V.sql create mode 100644 db/ddlutils/postgresql/views/M_INOUT_HEADER_VT.sql create mode 100644 db/ddlutils/postgresql/views/M_INOUT_LINECONFIRM_V.sql create mode 100644 db/ddlutils/postgresql/views/M_INOUT_LINECONFIRM_VT.sql create mode 100644 db/ddlutils/postgresql/views/M_INOUT_LINE_V.sql create mode 100644 db/ddlutils/postgresql/views/M_INOUT_LINE_VT.sql create mode 100644 db/ddlutils/postgresql/views/M_MOVEMENTLINEMA_V.sql create mode 100644 db/ddlutils/postgresql/views/M_MOVEMENTLINEMA_VT.sql create mode 100644 db/ddlutils/postgresql/views/M_TRANSACTION_V.sql create mode 100644 db/ddlutils/postgresql/views/RV_ALLOCATION.sql create mode 100644 db/ddlutils/postgresql/views/RV_ASSET_CUSTOMER.sql create mode 100644 db/ddlutils/postgresql/views/RV_ASSET_DELIVERY.sql create mode 100644 db/ddlutils/postgresql/views/RV_ASSET_SUMMONTH.sql create mode 100644 db/ddlutils/postgresql/views/RV_BPARTNER.sql create mode 100644 db/ddlutils/postgresql/views/RV_BPARTNEROPEN.sql create mode 100644 db/ddlutils/postgresql/views/RV_CASH_DETAIL.sql create mode 100644 db/ddlutils/postgresql/views/RV_CLICK_MONTH.sql create mode 100644 db/ddlutils/postgresql/views/RV_CLICK_UNPROCESSED.sql create mode 100644 db/ddlutils/postgresql/views/RV_COMMISSIONRUNDETAIL.sql create mode 100644 db/ddlutils/postgresql/views/RV_COST.sql create mode 100644 db/ddlutils/postgresql/views/RV_COSTDETAIL.sql create mode 100644 db/ddlutils/postgresql/views/RV_COSTSUMMARY.sql create mode 100644 db/ddlutils/postgresql/views/RV_C_INVOICE.sql create mode 100644 db/ddlutils/postgresql/views/RV_C_INVOICELINE.sql create mode 100644 db/ddlutils/postgresql/views/RV_C_INVOICETAX.sql create mode 100644 db/ddlutils/postgresql/views/RV_C_INVOICE_CUSTOMERPRODQTR.sql create mode 100644 db/ddlutils/postgresql/views/RV_C_INVOICE_CUSTOMERVENDQTR.sql create mode 100644 db/ddlutils/postgresql/views/RV_C_INVOICE_DAY.sql create mode 100644 db/ddlutils/postgresql/views/RV_C_INVOICE_MONTH.sql create mode 100644 db/ddlutils/postgresql/views/RV_C_INVOICE_PRODMONTH.sql create mode 100644 db/ddlutils/postgresql/views/RV_C_INVOICE_PRODUCTMONTH.sql create mode 100644 db/ddlutils/postgresql/views/RV_C_INVOICE_PRODUCTQTR.sql create mode 100644 db/ddlutils/postgresql/views/RV_C_INVOICE_PRODWEEK.sql create mode 100644 db/ddlutils/postgresql/views/RV_C_INVOICE_VENDORMONTH.sql create mode 100644 db/ddlutils/postgresql/views/RV_C_INVOICE_WEEK.sql create mode 100644 db/ddlutils/postgresql/views/RV_C_RFQRESPONSE.sql create mode 100644 db/ddlutils/postgresql/views/RV_C_RFQ_UNANSWERED.sql create mode 100644 db/ddlutils/postgresql/views/RV_FACT_ACCT.sql create mode 100644 db/ddlutils/postgresql/views/RV_FACT_ACCT_DAY.sql create mode 100644 db/ddlutils/postgresql/views/RV_FACT_ACCT_PERIOD.sql create mode 100644 db/ddlutils/postgresql/views/RV_INOUTCONFIRM.sql create mode 100644 db/ddlutils/postgresql/views/RV_INOUTDETAILS.sql create mode 100644 db/ddlutils/postgresql/views/RV_INOUTLINECONFIRM.sql create mode 100644 db/ddlutils/postgresql/views/RV_M_REQUISITION.sql create mode 100644 db/ddlutils/postgresql/views/RV_M_TRANSACTION.sql create mode 100644 db/ddlutils/postgresql/views/RV_M_TRANSACTION_SUM.sql rename db/ddlutils/{ => postgresql}/views/RV_OPENITEM.sql (100%) create mode 100644 db/ddlutils/postgresql/views/RV_ORDERDETAIL.sql create mode 100644 db/ddlutils/postgresql/views/RV_PAYMENT.sql create mode 100644 db/ddlutils/postgresql/views/RV_PRINTFORMATDETAIL.sql create mode 100644 db/ddlutils/postgresql/views/RV_PRODUCT_COSTING.sql create mode 100644 db/ddlutils/postgresql/views/RV_PROJECTCYCLE.sql create mode 100644 db/ddlutils/postgresql/views/RV_PROJECTLINEISSUE.sql rename db/ddlutils/{ => postgresql}/views/RV_REQUESTUPDATES.sql (100%) create mode 100644 db/ddlutils/postgresql/views/RV_REQUESTUPDATES_ONLY.sql create mode 100644 db/ddlutils/postgresql/views/RV_REQUESTUPDATES_V.sql create mode 100644 db/ddlutils/postgresql/views/RV_STORAGE.sql create mode 100644 db/ddlutils/postgresql/views/RV_TRANSACTION.sql create mode 100644 db/ddlutils/postgresql/views/RV_UNPOSTED.sql create mode 100644 db/ddlutils/postgresql/views/RV_WAREHOUSEPRICE.sql create mode 100644 db/ddlutils/postgresql/views/R_REQUEST_V.sql create mode 100644 db/ddlutils/postgresql/views/T_INVOICEGL_V.sql create mode 100644 db/ddlutils/postgresql/views/T_INVOICEGL_VT.sql diff --git a/db/ddlutils/adempiere-model.xml b/db/ddlutils/adempiere-model.xml new file mode 100644 index 0000000000..44a2126f93 --- /dev/null +++ b/db/ddlutils/adempiere-model.xml @@ -0,0 +1,21722 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +
+ + + +
+ + + + +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
diff --git a/db/ddlutils/oracle/build.xml b/db/ddlutils/oracle/build.xml index 122c2f1a7f..5cd0c68d55 100644 --- a/db/ddlutils/oracle/build.xml +++ b/db/ddlutils/oracle/build.xml @@ -60,7 +60,7 @@ - + @@ -69,7 +69,7 @@ - + diff --git a/db/ddlutils/views/AD_CHANGELOG_V.sql b/db/ddlutils/oracle/views/AD_CHANGELOG_V.sql similarity index 100% rename from db/ddlutils/views/AD_CHANGELOG_V.sql rename to db/ddlutils/oracle/views/AD_CHANGELOG_V.sql diff --git a/db/ddlutils/views/AD_FIELD_V.sql b/db/ddlutils/oracle/views/AD_FIELD_V.sql similarity index 100% rename from db/ddlutils/views/AD_FIELD_V.sql rename to db/ddlutils/oracle/views/AD_FIELD_V.sql diff --git a/db/ddlutils/views/AD_FIELD_VT.sql b/db/ddlutils/oracle/views/AD_FIELD_VT.sql similarity index 100% rename from db/ddlutils/views/AD_FIELD_VT.sql rename to db/ddlutils/oracle/views/AD_FIELD_VT.sql diff --git a/db/ddlutils/views/AD_ORG_V.sql b/db/ddlutils/oracle/views/AD_ORG_V.sql similarity index 100% rename from db/ddlutils/views/AD_ORG_V.sql rename to db/ddlutils/oracle/views/AD_ORG_V.sql diff --git a/db/ddlutils/views/AD_TAB_V.sql b/db/ddlutils/oracle/views/AD_TAB_V.sql similarity index 100% rename from db/ddlutils/views/AD_TAB_V.sql rename to db/ddlutils/oracle/views/AD_TAB_V.sql diff --git a/db/ddlutils/views/AD_TAB_VT.sql b/db/ddlutils/oracle/views/AD_TAB_VT.sql similarity index 100% rename from db/ddlutils/views/AD_TAB_VT.sql rename to db/ddlutils/oracle/views/AD_TAB_VT.sql diff --git a/db/ddlutils/views/AD_USER_ROLES_V.sql b/db/ddlutils/oracle/views/AD_USER_ROLES_V.sql similarity index 100% rename from db/ddlutils/views/AD_USER_ROLES_V.sql rename to db/ddlutils/oracle/views/AD_USER_ROLES_V.sql diff --git a/db/ddlutils/views/AD_WINDOW_VT.sql b/db/ddlutils/oracle/views/AD_WINDOW_VT.sql similarity index 100% rename from db/ddlutils/views/AD_WINDOW_VT.sql rename to db/ddlutils/oracle/views/AD_WINDOW_VT.sql diff --git a/db/ddlutils/views/C_DUNNING_HEADER_V.sql b/db/ddlutils/oracle/views/C_DUNNING_HEADER_V.sql similarity index 100% rename from db/ddlutils/views/C_DUNNING_HEADER_V.sql rename to db/ddlutils/oracle/views/C_DUNNING_HEADER_V.sql diff --git a/db/ddlutils/views/C_DUNNING_HEADER_VT.sql b/db/ddlutils/oracle/views/C_DUNNING_HEADER_VT.sql similarity index 100% rename from db/ddlutils/views/C_DUNNING_HEADER_VT.sql rename to db/ddlutils/oracle/views/C_DUNNING_HEADER_VT.sql diff --git a/db/ddlutils/views/C_DUNNING_LINE_V.sql b/db/ddlutils/oracle/views/C_DUNNING_LINE_V.sql similarity index 100% rename from db/ddlutils/views/C_DUNNING_LINE_V.sql rename to db/ddlutils/oracle/views/C_DUNNING_LINE_V.sql diff --git a/db/ddlutils/views/C_DUNNING_LINE_VT.sql b/db/ddlutils/oracle/views/C_DUNNING_LINE_VT.sql similarity index 100% rename from db/ddlutils/views/C_DUNNING_LINE_VT.sql rename to db/ddlutils/oracle/views/C_DUNNING_LINE_VT.sql diff --git a/db/ddlutils/views/C_INVOICELINE_V.sql b/db/ddlutils/oracle/views/C_INVOICELINE_V.sql similarity index 100% rename from db/ddlutils/views/C_INVOICELINE_V.sql rename to db/ddlutils/oracle/views/C_INVOICELINE_V.sql diff --git a/db/ddlutils/views/C_INVOICE_CANDIDATE_V.sql b/db/ddlutils/oracle/views/C_INVOICE_CANDIDATE_V.sql similarity index 100% rename from db/ddlutils/views/C_INVOICE_CANDIDATE_V.sql rename to db/ddlutils/oracle/views/C_INVOICE_CANDIDATE_V.sql diff --git a/db/ddlutils/views/C_INVOICE_HEADER_V.sql b/db/ddlutils/oracle/views/C_INVOICE_HEADER_V.sql similarity index 100% rename from db/ddlutils/views/C_INVOICE_HEADER_V.sql rename to db/ddlutils/oracle/views/C_INVOICE_HEADER_V.sql diff --git a/db/ddlutils/views/C_INVOICE_HEADER_VT.sql b/db/ddlutils/oracle/views/C_INVOICE_HEADER_VT.sql similarity index 100% rename from db/ddlutils/views/C_INVOICE_HEADER_VT.sql rename to db/ddlutils/oracle/views/C_INVOICE_HEADER_VT.sql diff --git a/db/ddlutils/views/C_INVOICE_LINETAX_V.sql b/db/ddlutils/oracle/views/C_INVOICE_LINETAX_V.sql similarity index 100% rename from db/ddlutils/views/C_INVOICE_LINETAX_V.sql rename to db/ddlutils/oracle/views/C_INVOICE_LINETAX_V.sql diff --git a/db/ddlutils/views/C_INVOICE_LINETAX_VT.sql b/db/ddlutils/oracle/views/C_INVOICE_LINETAX_VT.sql similarity index 100% rename from db/ddlutils/views/C_INVOICE_LINETAX_VT.sql rename to db/ddlutils/oracle/views/C_INVOICE_LINETAX_VT.sql diff --git a/db/ddlutils/oracle/views/C_INVOICE_V.sql b/db/ddlutils/oracle/views/C_INVOICE_V.sql new file mode 100644 index 0000000000..c338cb6709 --- /dev/null +++ b/db/ddlutils/oracle/views/C_INVOICE_V.sql @@ -0,0 +1,53 @@ +CREATE OR REPLACE VIEW C_INVOICE_V +(C_INVOICE_ID, AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, + CREATEDBY, UPDATED, UPDATEDBY, ISSOTRX, DOCUMENTNO, + DOCSTATUS, DOCACTION, PROCESSING, PROCESSED, C_DOCTYPE_ID, + C_DOCTYPETARGET_ID, C_ORDER_ID, DESCRIPTION, ISAPPROVED, ISTRANSFERRED, + SALESREP_ID, DATEINVOICED, DATEPRINTED, DATEACCT, C_BPARTNER_ID, + C_BPARTNER_LOCATION_ID, AD_USER_ID, POREFERENCE, DATEORDERED, C_CURRENCY_ID, + C_CONVERSIONTYPE_ID, PAYMENTRULE, C_PAYMENTTERM_ID, C_CHARGE_ID, M_PRICELIST_ID, + C_CAMPAIGN_ID, C_PROJECT_ID, C_ACTIVITY_ID, ISPRINTED, ISDISCOUNTPRINTED, + ISPAID, ISINDISPUTE, ISPAYSCHEDULEVALID, C_INVOICEPAYSCHEDULE_ID, INVOICECOLLECTIONTYPE, + CHARGEAMT, TOTALLINES, GRANDTOTAL, MULTIPLIER, MULTIPLIERAP, + DOCBASETYPE) +AS +SELECT i.C_Invoice_ID, i.AD_Client_ID, i.AD_Org_ID, i.IsActive, i.Created, i.CreatedBy, i.Updated, i.UpdatedBy, + i.IsSOTrx, i.DocumentNo, i.DocStatus, i.DocAction, i.Processing, i.Processed, i.C_DocType_ID, + i.C_DocTypeTarget_ID, i.C_Order_ID, i.Description, i.IsApproved, i.IsTransferred, + i.SalesRep_ID, i.DateInvoiced, i.DatePrinted, i.DateAcct, i.C_BPartner_ID, i.C_BPartner_Location_ID, + i.AD_User_ID, i.POReference, i.DateOrdered, i.C_Currency_ID, i.C_ConversionType_ID, i.PaymentRule, + i.C_PaymentTerm_ID, i.C_Charge_ID, i.M_PriceList_ID, i.C_Campaign_ID, i.C_Project_ID, + i.C_Activity_ID, i.IsPrinted, i.IsDiscountPrinted, i.IsPaid, i.IsInDispute, + i.IsPayScheduleValid, cast(null as number) AS C_InvoicePaySchedule_ID, i.InvoiceCollectionType, + cast(CASE WHEN charAt(d.DocBaseType,3)='C' THEN i.ChargeAmt*-1 ELSE i.ChargeAmt END as number) AS ChargeAmt, + cast(CASE WHEN charAt(d.DocBaseType,3)='C' THEN i.TotalLines*-1 ELSE i.TotalLines END as number) AS TotalLines, + cast(CASE WHEN charAt(d.DocBaseType,3)='C' THEN i.GrandTotal*-1 ELSE i.GrandTotal END as number) AS GrandTotal, + cast(CASE WHEN charAt(d.DocBaseType,3)='C' THEN -1 ELSE 1 END as number) AS Multiplier, + cast(CASE WHEN charAt(d.DocBaseType,2)='P' THEN -1 ELSE 1 END AS number) as MultiplierAP, + d.DocBaseType +FROM C_Invoice i + INNER JOIN C_DocType d ON (i.C_DocType_ID=d.C_DocType_ID) +WHERE i.IsPayScheduleValid<>'Y' +UNION +SELECT i.C_Invoice_ID, i.AD_Client_ID, i.AD_Org_ID, i.IsActive, i.Created, i.CreatedBy, i.Updated, i.UpdatedBy, + i.IsSOTrx, i.DocumentNo, i.DocStatus, i.DocAction, i.Processing, i.Processed, i.C_DocType_ID, + i.C_DocTypeTarget_ID, i.C_Order_ID, i.Description, i.IsApproved, i.IsTransferred, + i.SalesRep_ID, i.DateInvoiced, i.DatePrinted, i.DateAcct, i.C_BPartner_ID, i.C_BPartner_Location_ID, + i.AD_User_ID, i.POReference, i.DateOrdered, i.C_Currency_ID, i.C_ConversionType_ID, i.PaymentRule, + i.C_PaymentTerm_ID, i.C_Charge_ID, i.M_PriceList_ID, i.C_Campaign_ID, i.C_Project_ID, + i.C_Activity_ID, i.IsPrinted, i.IsDiscountPrinted, i.IsPaid, i.IsInDispute, + i.IsPayScheduleValid, ips.C_InvoicePaySchedule_ID, i.InvoiceCollectionType, + null AS ChargeAmt, + null AS TotalLines, + CASE WHEN charAt(d.DocBaseType,3)='C' THEN ips.DueAmt*-1 ELSE ips.DueAmt END AS GrandTotal, + CASE WHEN charAt(d.DocBaseType,3)='C' THEN -1 ELSE 1 END AS Multiplier, + CASE WHEN charAt(d.DocBaseType,2)='P' THEN -1 ELSE 1 END AS MultiplierAP, + d.DocBaseType +FROM C_Invoice i + INNER JOIN C_DocType d ON (i.C_DocType_ID=d.C_DocType_ID) + INNER JOIN C_InvoicePaySchedule ips ON (i.C_Invoice_ID=ips.C_Invoice_ID) +WHERE i.IsPayScheduleValid='Y' + AND ips.IsValid='Y'; + + + diff --git a/db/ddlutils/oracle/views/C_INVOICE_V1.sql b/db/ddlutils/oracle/views/C_INVOICE_V1.sql new file mode 100644 index 0000000000..f455467774 --- /dev/null +++ b/db/ddlutils/oracle/views/C_INVOICE_V1.sql @@ -0,0 +1,32 @@ +CREATE OR REPLACE VIEW C_INVOICE_V1 +(C_INVOICE_ID, AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, + CREATEDBY, UPDATED, UPDATEDBY, ISSOTRX, DOCUMENTNO, + DOCSTATUS, DOCACTION, PROCESSING, PROCESSED, C_DOCTYPE_ID, + C_DOCTYPETARGET_ID, C_ORDER_ID, DESCRIPTION, ISAPPROVED, ISTRANSFERRED, + SALESREP_ID, DATEINVOICED, DATEPRINTED, DATEACCT, C_BPARTNER_ID, + C_BPARTNER_LOCATION_ID, AD_USER_ID, POREFERENCE, DATEORDERED, C_CURRENCY_ID, + C_CONVERSIONTYPE_ID, PAYMENTRULE, C_PAYMENTTERM_ID, C_CHARGE_ID, M_PRICELIST_ID, + C_CAMPAIGN_ID, C_PROJECT_ID, C_ACTIVITY_ID, ISPRINTED, ISDISCOUNTPRINTED, + ISPAID, ISINDISPUTE, ISPAYSCHEDULEVALID, C_INVOICEPAYSCHEDULE_ID, INVOICECOLLECTIONTYPE, + CHARGEAMT, TOTALLINES, GRANDTOTAL, MULTIPLIER, MULTIPLIERAP, + DOCBASETYPE) +AS +SELECT i.C_Invoice_ID, i.AD_Client_ID, i.AD_Org_ID, i.IsActive, i.Created, i.CreatedBy, i.Updated, i.UpdatedBy, + i.IsSOTrx, i.DocumentNo, i.DocStatus, i.DocAction, i.Processing, i.Processed, i.C_DocType_ID, + i.C_DocTypeTarget_ID, i.C_Order_ID, i.Description, i.IsApproved, i.IsTransferred, + i.SalesRep_ID, i.DateInvoiced, i.DatePrinted, i.DateAcct, i.C_BPartner_ID, i.C_BPartner_Location_ID, + i.AD_User_ID, i.POReference, i.DateOrdered, i.C_Currency_ID, i.C_ConversionType_ID, i.PaymentRule, + i.C_PaymentTerm_ID, i.C_Charge_ID, i.M_PriceList_ID, i.C_Campaign_ID, i.C_Project_ID, + i.C_Activity_ID, i.IsPrinted, i.IsDiscountPrinted, i.IsPaid, i.IsInDispute, + i.IsPayScheduleValid, cast(null as number) AS C_InvoicePaySchedule_ID, i.InvoiceCollectionType, + CASE WHEN charAt(d.DocBaseType,3)='C' THEN i.ChargeAmt*-1 ELSE i.ChargeAmt END AS ChargeAmt, + CASE WHEN charAt(d.DocBaseType,3)='C' THEN i.TotalLines*-1 ELSE i.TotalLines END AS TotalLines, + CASE WHEN charAt(d.DocBaseType,3)='C' THEN i.GrandTotal*-1 ELSE i.GrandTotal END AS GrandTotal, + CASE WHEN charAt(d.DocBaseType,3)='C' THEN -1 ELSE 1 END AS Multiplier, + CASE WHEN charAt(d.DocBaseType,2)='P' THEN -1 ELSE 1 END AS MultiplierAP, + d.DocBaseType +FROM C_Invoice i + INNER JOIN C_DocType d ON (i.C_DocType_ID=d.C_DocType_ID); + + + diff --git a/db/ddlutils/views/C_ORDER_HEADER_V.sql b/db/ddlutils/oracle/views/C_ORDER_HEADER_V.sql similarity index 100% rename from db/ddlutils/views/C_ORDER_HEADER_V.sql rename to db/ddlutils/oracle/views/C_ORDER_HEADER_V.sql diff --git a/db/ddlutils/views/C_ORDER_HEADER_VT.sql b/db/ddlutils/oracle/views/C_ORDER_HEADER_VT.sql similarity index 100% rename from db/ddlutils/views/C_ORDER_HEADER_VT.sql rename to db/ddlutils/oracle/views/C_ORDER_HEADER_VT.sql diff --git a/db/ddlutils/views/C_ORDER_LINETAX_V.sql b/db/ddlutils/oracle/views/C_ORDER_LINETAX_V.sql similarity index 100% rename from db/ddlutils/views/C_ORDER_LINETAX_V.sql rename to db/ddlutils/oracle/views/C_ORDER_LINETAX_V.sql diff --git a/db/ddlutils/views/C_ORDER_LINETAX_VT.sql b/db/ddlutils/oracle/views/C_ORDER_LINETAX_VT.sql similarity index 100% rename from db/ddlutils/views/C_ORDER_LINETAX_VT.sql rename to db/ddlutils/oracle/views/C_ORDER_LINETAX_VT.sql diff --git a/db/ddlutils/views/C_PAYMENT_V.sql b/db/ddlutils/oracle/views/C_PAYMENT_V.sql similarity index 100% rename from db/ddlutils/views/C_PAYMENT_V.sql rename to db/ddlutils/oracle/views/C_PAYMENT_V.sql diff --git a/db/ddlutils/views/C_PAYSELECTION_CHECK_V.sql b/db/ddlutils/oracle/views/C_PAYSELECTION_CHECK_V.sql similarity index 100% rename from db/ddlutils/views/C_PAYSELECTION_CHECK_V.sql rename to db/ddlutils/oracle/views/C_PAYSELECTION_CHECK_V.sql diff --git a/db/ddlutils/views/C_PAYSELECTION_CHECK_VT.sql b/db/ddlutils/oracle/views/C_PAYSELECTION_CHECK_VT.sql similarity index 100% rename from db/ddlutils/views/C_PAYSELECTION_CHECK_VT.sql rename to db/ddlutils/oracle/views/C_PAYSELECTION_CHECK_VT.sql diff --git a/db/ddlutils/views/C_PAYSELECTION_REMITTANCE_V.sql b/db/ddlutils/oracle/views/C_PAYSELECTION_REMITTANCE_V.sql similarity index 100% rename from db/ddlutils/views/C_PAYSELECTION_REMITTANCE_V.sql rename to db/ddlutils/oracle/views/C_PAYSELECTION_REMITTANCE_V.sql diff --git a/db/ddlutils/views/C_PAYSELECTION_REMITTANCE_VT.sql b/db/ddlutils/oracle/views/C_PAYSELECTION_REMITTANCE_VT.sql similarity index 100% rename from db/ddlutils/views/C_PAYSELECTION_REMITTANCE_VT.sql rename to db/ddlutils/oracle/views/C_PAYSELECTION_REMITTANCE_VT.sql diff --git a/db/ddlutils/views/C_PROJECT_DETAILS_V.sql b/db/ddlutils/oracle/views/C_PROJECT_DETAILS_V.sql similarity index 100% rename from db/ddlutils/views/C_PROJECT_DETAILS_V.sql rename to db/ddlutils/oracle/views/C_PROJECT_DETAILS_V.sql diff --git a/db/ddlutils/views/C_PROJECT_DETAILS_VT.sql b/db/ddlutils/oracle/views/C_PROJECT_DETAILS_VT.sql similarity index 100% rename from db/ddlutils/views/C_PROJECT_DETAILS_VT.sql rename to db/ddlutils/oracle/views/C_PROJECT_DETAILS_VT.sql diff --git a/db/ddlutils/views/C_PROJECT_HEADER_V.sql b/db/ddlutils/oracle/views/C_PROJECT_HEADER_V.sql similarity index 100% rename from db/ddlutils/views/C_PROJECT_HEADER_V.sql rename to db/ddlutils/oracle/views/C_PROJECT_HEADER_V.sql diff --git a/db/ddlutils/views/C_PROJECT_HEADER_VT.sql b/db/ddlutils/oracle/views/C_PROJECT_HEADER_VT.sql similarity index 100% rename from db/ddlutils/views/C_PROJECT_HEADER_VT.sql rename to db/ddlutils/oracle/views/C_PROJECT_HEADER_VT.sql diff --git a/db/ddlutils/views/C_RFQRESPONSELINEQTY_V.sql b/db/ddlutils/oracle/views/C_RFQRESPONSELINEQTY_V.sql similarity index 100% rename from db/ddlutils/views/C_RFQRESPONSELINEQTY_V.sql rename to db/ddlutils/oracle/views/C_RFQRESPONSELINEQTY_V.sql diff --git a/db/ddlutils/views/C_RFQRESPONSELINEQTY_VT.sql b/db/ddlutils/oracle/views/C_RFQRESPONSELINEQTY_VT.sql similarity index 100% rename from db/ddlutils/views/C_RFQRESPONSELINEQTY_VT.sql rename to db/ddlutils/oracle/views/C_RFQRESPONSELINEQTY_VT.sql diff --git a/db/ddlutils/views/C_RFQRESPONSELINE_V.sql b/db/ddlutils/oracle/views/C_RFQRESPONSELINE_V.sql similarity index 100% rename from db/ddlutils/views/C_RFQRESPONSELINE_V.sql rename to db/ddlutils/oracle/views/C_RFQRESPONSELINE_V.sql diff --git a/db/ddlutils/views/C_RFQRESPONSELINE_VT.sql b/db/ddlutils/oracle/views/C_RFQRESPONSELINE_VT.sql similarity index 100% rename from db/ddlutils/views/C_RFQRESPONSELINE_VT.sql rename to db/ddlutils/oracle/views/C_RFQRESPONSELINE_VT.sql diff --git a/db/ddlutils/views/C_RFQRESPONSE_V.sql b/db/ddlutils/oracle/views/C_RFQRESPONSE_V.sql similarity index 100% rename from db/ddlutils/views/C_RFQRESPONSE_V.sql rename to db/ddlutils/oracle/views/C_RFQRESPONSE_V.sql diff --git a/db/ddlutils/views/C_RFQRESPONSE_VT.sql b/db/ddlutils/oracle/views/C_RFQRESPONSE_VT.sql similarity index 100% rename from db/ddlutils/views/C_RFQRESPONSE_VT.sql rename to db/ddlutils/oracle/views/C_RFQRESPONSE_VT.sql diff --git a/db/ddlutils/views/GL_JOURNALLINE_ACCT_V.sql b/db/ddlutils/oracle/views/GL_JOURNALLINE_ACCT_V.sql similarity index 100% rename from db/ddlutils/views/GL_JOURNALLINE_ACCT_V.sql rename to db/ddlutils/oracle/views/GL_JOURNALLINE_ACCT_V.sql diff --git a/db/ddlutils/views/M_INOUTCONFIRM_V.sql b/db/ddlutils/oracle/views/M_INOUTCONFIRM_V.sql similarity index 100% rename from db/ddlutils/views/M_INOUTCONFIRM_V.sql rename to db/ddlutils/oracle/views/M_INOUTCONFIRM_V.sql diff --git a/db/ddlutils/views/M_INOUTCONFIRM_VT.sql b/db/ddlutils/oracle/views/M_INOUTCONFIRM_VT.sql similarity index 100% rename from db/ddlutils/views/M_INOUTCONFIRM_VT.sql rename to db/ddlutils/oracle/views/M_INOUTCONFIRM_VT.sql diff --git a/db/ddlutils/views/M_INOUTLINEMA_V.sql b/db/ddlutils/oracle/views/M_INOUTLINEMA_V.sql similarity index 100% rename from db/ddlutils/views/M_INOUTLINEMA_V.sql rename to db/ddlutils/oracle/views/M_INOUTLINEMA_V.sql diff --git a/db/ddlutils/views/M_INOUTLINEMA_VT.sql b/db/ddlutils/oracle/views/M_INOUTLINEMA_VT.sql similarity index 100% rename from db/ddlutils/views/M_INOUTLINEMA_VT.sql rename to db/ddlutils/oracle/views/M_INOUTLINEMA_VT.sql diff --git a/db/ddlutils/views/M_INOUT_CANDIDATE_V.sql b/db/ddlutils/oracle/views/M_INOUT_CANDIDATE_V.sql similarity index 100% rename from db/ddlutils/views/M_INOUT_CANDIDATE_V.sql rename to db/ddlutils/oracle/views/M_INOUT_CANDIDATE_V.sql diff --git a/db/ddlutils/views/M_INOUT_HEADER_V.sql b/db/ddlutils/oracle/views/M_INOUT_HEADER_V.sql similarity index 100% rename from db/ddlutils/views/M_INOUT_HEADER_V.sql rename to db/ddlutils/oracle/views/M_INOUT_HEADER_V.sql diff --git a/db/ddlutils/views/M_INOUT_HEADER_VT.sql b/db/ddlutils/oracle/views/M_INOUT_HEADER_VT.sql similarity index 100% rename from db/ddlutils/views/M_INOUT_HEADER_VT.sql rename to db/ddlutils/oracle/views/M_INOUT_HEADER_VT.sql diff --git a/db/ddlutils/views/M_INOUT_LINECONFIRM_V.sql b/db/ddlutils/oracle/views/M_INOUT_LINECONFIRM_V.sql similarity index 100% rename from db/ddlutils/views/M_INOUT_LINECONFIRM_V.sql rename to db/ddlutils/oracle/views/M_INOUT_LINECONFIRM_V.sql diff --git a/db/ddlutils/views/M_INOUT_LINECONFIRM_VT.sql b/db/ddlutils/oracle/views/M_INOUT_LINECONFIRM_VT.sql similarity index 100% rename from db/ddlutils/views/M_INOUT_LINECONFIRM_VT.sql rename to db/ddlutils/oracle/views/M_INOUT_LINECONFIRM_VT.sql diff --git a/db/ddlutils/views/M_INOUT_LINE_V.sql b/db/ddlutils/oracle/views/M_INOUT_LINE_V.sql similarity index 100% rename from db/ddlutils/views/M_INOUT_LINE_V.sql rename to db/ddlutils/oracle/views/M_INOUT_LINE_V.sql diff --git a/db/ddlutils/views/M_INOUT_LINE_VT.sql b/db/ddlutils/oracle/views/M_INOUT_LINE_VT.sql similarity index 100% rename from db/ddlutils/views/M_INOUT_LINE_VT.sql rename to db/ddlutils/oracle/views/M_INOUT_LINE_VT.sql diff --git a/db/ddlutils/views/M_MOVEMENTLINEMA_V.sql b/db/ddlutils/oracle/views/M_MOVEMENTLINEMA_V.sql similarity index 100% rename from db/ddlutils/views/M_MOVEMENTLINEMA_V.sql rename to db/ddlutils/oracle/views/M_MOVEMENTLINEMA_V.sql diff --git a/db/ddlutils/views/M_MOVEMENTLINEMA_VT.sql b/db/ddlutils/oracle/views/M_MOVEMENTLINEMA_VT.sql similarity index 100% rename from db/ddlutils/views/M_MOVEMENTLINEMA_VT.sql rename to db/ddlutils/oracle/views/M_MOVEMENTLINEMA_VT.sql diff --git a/db/ddlutils/views/M_TRANSACTION_V.sql b/db/ddlutils/oracle/views/M_TRANSACTION_V.sql similarity index 100% rename from db/ddlutils/views/M_TRANSACTION_V.sql rename to db/ddlutils/oracle/views/M_TRANSACTION_V.sql diff --git a/db/ddlutils/views/RV_ALLOCATION.sql b/db/ddlutils/oracle/views/RV_ALLOCATION.sql similarity index 100% rename from db/ddlutils/views/RV_ALLOCATION.sql rename to db/ddlutils/oracle/views/RV_ALLOCATION.sql diff --git a/db/ddlutils/views/RV_ASSET_CUSTOMER.sql b/db/ddlutils/oracle/views/RV_ASSET_CUSTOMER.sql similarity index 100% rename from db/ddlutils/views/RV_ASSET_CUSTOMER.sql rename to db/ddlutils/oracle/views/RV_ASSET_CUSTOMER.sql diff --git a/db/ddlutils/views/RV_ASSET_DELIVERY.sql b/db/ddlutils/oracle/views/RV_ASSET_DELIVERY.sql similarity index 100% rename from db/ddlutils/views/RV_ASSET_DELIVERY.sql rename to db/ddlutils/oracle/views/RV_ASSET_DELIVERY.sql diff --git a/db/ddlutils/views/RV_ASSET_SUMMONTH.sql b/db/ddlutils/oracle/views/RV_ASSET_SUMMONTH.sql similarity index 100% rename from db/ddlutils/views/RV_ASSET_SUMMONTH.sql rename to db/ddlutils/oracle/views/RV_ASSET_SUMMONTH.sql diff --git a/db/ddlutils/views/RV_BPARTNER.sql b/db/ddlutils/oracle/views/RV_BPARTNER.sql similarity index 100% rename from db/ddlutils/views/RV_BPARTNER.sql rename to db/ddlutils/oracle/views/RV_BPARTNER.sql diff --git a/db/ddlutils/views/RV_BPARTNEROPEN.sql b/db/ddlutils/oracle/views/RV_BPARTNEROPEN.sql similarity index 100% rename from db/ddlutils/views/RV_BPARTNEROPEN.sql rename to db/ddlutils/oracle/views/RV_BPARTNEROPEN.sql diff --git a/db/ddlutils/views/RV_CASH_DETAIL.sql b/db/ddlutils/oracle/views/RV_CASH_DETAIL.sql similarity index 100% rename from db/ddlutils/views/RV_CASH_DETAIL.sql rename to db/ddlutils/oracle/views/RV_CASH_DETAIL.sql diff --git a/db/ddlutils/views/RV_CLICK_MONTH.sql b/db/ddlutils/oracle/views/RV_CLICK_MONTH.sql similarity index 100% rename from db/ddlutils/views/RV_CLICK_MONTH.sql rename to db/ddlutils/oracle/views/RV_CLICK_MONTH.sql diff --git a/db/ddlutils/views/RV_CLICK_UNPROCESSED.sql b/db/ddlutils/oracle/views/RV_CLICK_UNPROCESSED.sql similarity index 100% rename from db/ddlutils/views/RV_CLICK_UNPROCESSED.sql rename to db/ddlutils/oracle/views/RV_CLICK_UNPROCESSED.sql diff --git a/db/ddlutils/views/RV_COMMISSIONRUNDETAIL.sql b/db/ddlutils/oracle/views/RV_COMMISSIONRUNDETAIL.sql similarity index 100% rename from db/ddlutils/views/RV_COMMISSIONRUNDETAIL.sql rename to db/ddlutils/oracle/views/RV_COMMISSIONRUNDETAIL.sql diff --git a/db/ddlutils/views/RV_COST.sql b/db/ddlutils/oracle/views/RV_COST.sql similarity index 100% rename from db/ddlutils/views/RV_COST.sql rename to db/ddlutils/oracle/views/RV_COST.sql diff --git a/db/ddlutils/views/RV_COSTDETAIL.sql b/db/ddlutils/oracle/views/RV_COSTDETAIL.sql similarity index 100% rename from db/ddlutils/views/RV_COSTDETAIL.sql rename to db/ddlutils/oracle/views/RV_COSTDETAIL.sql diff --git a/db/ddlutils/views/RV_COSTSUMMARY.sql b/db/ddlutils/oracle/views/RV_COSTSUMMARY.sql similarity index 100% rename from db/ddlutils/views/RV_COSTSUMMARY.sql rename to db/ddlutils/oracle/views/RV_COSTSUMMARY.sql diff --git a/db/ddlutils/views/RV_C_INVOICE.sql b/db/ddlutils/oracle/views/RV_C_INVOICE.sql similarity index 100% rename from db/ddlutils/views/RV_C_INVOICE.sql rename to db/ddlutils/oracle/views/RV_C_INVOICE.sql diff --git a/db/ddlutils/views/RV_C_INVOICELINE.sql b/db/ddlutils/oracle/views/RV_C_INVOICELINE.sql similarity index 100% rename from db/ddlutils/views/RV_C_INVOICELINE.sql rename to db/ddlutils/oracle/views/RV_C_INVOICELINE.sql diff --git a/db/ddlutils/views/RV_C_INVOICETAX.sql b/db/ddlutils/oracle/views/RV_C_INVOICETAX.sql similarity index 100% rename from db/ddlutils/views/RV_C_INVOICETAX.sql rename to db/ddlutils/oracle/views/RV_C_INVOICETAX.sql diff --git a/db/ddlutils/views/RV_C_INVOICE_CUSTOMERPRODQTR.sql b/db/ddlutils/oracle/views/RV_C_INVOICE_CUSTOMERPRODQTR.sql similarity index 100% rename from db/ddlutils/views/RV_C_INVOICE_CUSTOMERPRODQTR.sql rename to db/ddlutils/oracle/views/RV_C_INVOICE_CUSTOMERPRODQTR.sql diff --git a/db/ddlutils/views/RV_C_INVOICE_CUSTOMERVENDQTR.sql b/db/ddlutils/oracle/views/RV_C_INVOICE_CUSTOMERVENDQTR.sql similarity index 100% rename from db/ddlutils/views/RV_C_INVOICE_CUSTOMERVENDQTR.sql rename to db/ddlutils/oracle/views/RV_C_INVOICE_CUSTOMERVENDQTR.sql diff --git a/db/ddlutils/views/RV_C_INVOICE_DAY.sql b/db/ddlutils/oracle/views/RV_C_INVOICE_DAY.sql similarity index 100% rename from db/ddlutils/views/RV_C_INVOICE_DAY.sql rename to db/ddlutils/oracle/views/RV_C_INVOICE_DAY.sql diff --git a/db/ddlutils/views/RV_C_INVOICE_MONTH.sql b/db/ddlutils/oracle/views/RV_C_INVOICE_MONTH.sql similarity index 100% rename from db/ddlutils/views/RV_C_INVOICE_MONTH.sql rename to db/ddlutils/oracle/views/RV_C_INVOICE_MONTH.sql diff --git a/db/ddlutils/views/RV_C_INVOICE_PRODMONTH.sql b/db/ddlutils/oracle/views/RV_C_INVOICE_PRODMONTH.sql similarity index 100% rename from db/ddlutils/views/RV_C_INVOICE_PRODMONTH.sql rename to db/ddlutils/oracle/views/RV_C_INVOICE_PRODMONTH.sql diff --git a/db/ddlutils/views/RV_C_INVOICE_PRODUCTMONTH.sql b/db/ddlutils/oracle/views/RV_C_INVOICE_PRODUCTMONTH.sql similarity index 100% rename from db/ddlutils/views/RV_C_INVOICE_PRODUCTMONTH.sql rename to db/ddlutils/oracle/views/RV_C_INVOICE_PRODUCTMONTH.sql diff --git a/db/ddlutils/views/RV_C_INVOICE_PRODUCTQTR.sql b/db/ddlutils/oracle/views/RV_C_INVOICE_PRODUCTQTR.sql similarity index 100% rename from db/ddlutils/views/RV_C_INVOICE_PRODUCTQTR.sql rename to db/ddlutils/oracle/views/RV_C_INVOICE_PRODUCTQTR.sql diff --git a/db/ddlutils/views/RV_C_INVOICE_PRODWEEK.sql b/db/ddlutils/oracle/views/RV_C_INVOICE_PRODWEEK.sql similarity index 100% rename from db/ddlutils/views/RV_C_INVOICE_PRODWEEK.sql rename to db/ddlutils/oracle/views/RV_C_INVOICE_PRODWEEK.sql diff --git a/db/ddlutils/views/RV_C_INVOICE_VENDORMONTH.sql b/db/ddlutils/oracle/views/RV_C_INVOICE_VENDORMONTH.sql similarity index 100% rename from db/ddlutils/views/RV_C_INVOICE_VENDORMONTH.sql rename to db/ddlutils/oracle/views/RV_C_INVOICE_VENDORMONTH.sql diff --git a/db/ddlutils/views/RV_C_INVOICE_WEEK.sql b/db/ddlutils/oracle/views/RV_C_INVOICE_WEEK.sql similarity index 100% rename from db/ddlutils/views/RV_C_INVOICE_WEEK.sql rename to db/ddlutils/oracle/views/RV_C_INVOICE_WEEK.sql diff --git a/db/ddlutils/views/RV_C_RFQRESPONSE.sql b/db/ddlutils/oracle/views/RV_C_RFQRESPONSE.sql similarity index 100% rename from db/ddlutils/views/RV_C_RFQRESPONSE.sql rename to db/ddlutils/oracle/views/RV_C_RFQRESPONSE.sql diff --git a/db/ddlutils/views/RV_C_RFQ_UNANSWERED.sql b/db/ddlutils/oracle/views/RV_C_RFQ_UNANSWERED.sql similarity index 100% rename from db/ddlutils/views/RV_C_RFQ_UNANSWERED.sql rename to db/ddlutils/oracle/views/RV_C_RFQ_UNANSWERED.sql diff --git a/db/ddlutils/views/RV_FACT_ACCT.sql b/db/ddlutils/oracle/views/RV_FACT_ACCT.sql similarity index 100% rename from db/ddlutils/views/RV_FACT_ACCT.sql rename to db/ddlutils/oracle/views/RV_FACT_ACCT.sql diff --git a/db/ddlutils/views/RV_FACT_ACCT_DAY.sql b/db/ddlutils/oracle/views/RV_FACT_ACCT_DAY.sql similarity index 100% rename from db/ddlutils/views/RV_FACT_ACCT_DAY.sql rename to db/ddlutils/oracle/views/RV_FACT_ACCT_DAY.sql diff --git a/db/ddlutils/views/RV_FACT_ACCT_PERIOD.sql b/db/ddlutils/oracle/views/RV_FACT_ACCT_PERIOD.sql similarity index 100% rename from db/ddlutils/views/RV_FACT_ACCT_PERIOD.sql rename to db/ddlutils/oracle/views/RV_FACT_ACCT_PERIOD.sql diff --git a/db/ddlutils/views/RV_INOUTCONFIRM.sql b/db/ddlutils/oracle/views/RV_INOUTCONFIRM.sql similarity index 100% rename from db/ddlutils/views/RV_INOUTCONFIRM.sql rename to db/ddlutils/oracle/views/RV_INOUTCONFIRM.sql diff --git a/db/ddlutils/views/RV_INOUTDETAILS.sql b/db/ddlutils/oracle/views/RV_INOUTDETAILS.sql similarity index 100% rename from db/ddlutils/views/RV_INOUTDETAILS.sql rename to db/ddlutils/oracle/views/RV_INOUTDETAILS.sql diff --git a/db/ddlutils/views/RV_INOUTLINECONFIRM.sql b/db/ddlutils/oracle/views/RV_INOUTLINECONFIRM.sql similarity index 100% rename from db/ddlutils/views/RV_INOUTLINECONFIRM.sql rename to db/ddlutils/oracle/views/RV_INOUTLINECONFIRM.sql diff --git a/db/ddlutils/views/RV_M_REQUISITION.sql b/db/ddlutils/oracle/views/RV_M_REQUISITION.sql similarity index 100% rename from db/ddlutils/views/RV_M_REQUISITION.sql rename to db/ddlutils/oracle/views/RV_M_REQUISITION.sql diff --git a/db/ddlutils/views/RV_M_TRANSACTION.sql b/db/ddlutils/oracle/views/RV_M_TRANSACTION.sql similarity index 100% rename from db/ddlutils/views/RV_M_TRANSACTION.sql rename to db/ddlutils/oracle/views/RV_M_TRANSACTION.sql diff --git a/db/ddlutils/views/RV_M_TRANSACTION_SUM.sql b/db/ddlutils/oracle/views/RV_M_TRANSACTION_SUM.sql similarity index 100% rename from db/ddlutils/views/RV_M_TRANSACTION_SUM.sql rename to db/ddlutils/oracle/views/RV_M_TRANSACTION_SUM.sql diff --git a/db/ddlutils/oracle/views/RV_OPENITEM.sql b/db/ddlutils/oracle/views/RV_OPENITEM.sql new file mode 100644 index 0000000000..337e1da732 --- /dev/null +++ b/db/ddlutils/oracle/views/RV_OPENITEM.sql @@ -0,0 +1,55 @@ +CREATE OR REPLACE VIEW RV_OPENITEM +(AD_ORG_ID, AD_CLIENT_ID, DOCUMENTNO, C_INVOICE_ID, C_ORDER_ID, + C_BPARTNER_ID, ISSOTRX, DATEINVOICED, DATEACCT, NETDAYS, + DUEDATE, DAYSDUE, DISCOUNTDATE, DISCOUNTAMT, GRANDTOTAL, + PAIDAMT, OPENAMT, C_CURRENCY_ID, C_CONVERSIONTYPE_ID, C_PAYMENTTERM_ID, + ISPAYSCHEDULEVALID, C_INVOICEPAYSCHEDULE_ID, INVOICECOLLECTIONTYPE, C_CAMPAIGN_ID, C_PROJECT_ID, + C_ACTIVITY_ID) +AS +SELECT i.AD_Org_ID, i.AD_Client_ID, + i.DocumentNo, i.C_Invoice_ID, i.C_Order_ID, i.C_BPartner_ID, i.IsSOTrx, + i.DateInvoiced, i.DateAcct, + p.NetDays, + paymentTermDueDate(i.C_PaymentTerm_ID, i.DateInvoiced) AS DueDate, + paymentTermDueDays(i.C_PaymentTerm_ID, i.DateInvoiced, getdate()) AS DaysDue, + addDays(i.DateInvoiced,p.DiscountDays) AS DiscountDate, + ROUND(i.GrandTotal*p.Discount/100,2) AS DiscountAmt, + i.GrandTotal, + invoicePaid(i.C_Invoice_ID, i.C_Currency_ID, 1) AS PaidAmt, + invoiceOpen(i.C_Invoice_ID,0) AS OpenAmt, + i.C_Currency_ID, i.C_ConversionType_ID, + i.C_PaymentTerm_ID, + i.IsPayScheduleValid, cast(null as number) AS C_InvoicePaySchedule_ID, i.InvoiceCollectionType, + i.C_Campaign_ID, i.C_Project_ID, i.C_Activity_ID +FROM RV_C_Invoice i + INNER JOIN C_PaymentTerm p ON (i.C_PaymentTerm_ID=p.C_PaymentTerm_ID) +WHERE -- i.IsPaid='N' + invoiceOpen(i.C_Invoice_ID,0) <> 0 + AND i.IsPayScheduleValid<>'Y' + AND i.DocStatus<>'DR' +UNION +SELECT i.AD_Org_ID, i.AD_Client_ID, + i.DocumentNo, i.C_Invoice_ID, i.C_Order_ID, i.C_BPartner_ID, i.IsSOTrx, + i.DateInvoiced, i.DateAcct, + daysBetween(ips.DueDate,i.DateInvoiced) AS NetDays, + ips.DueDate, + daysBetween(getdate(),ips.DueDate) AS DaysDue, + ips.DiscountDate, + ips.DiscountAmt, + ips.DueAmt AS GrandTotal, + invoicePaid(i.C_Invoice_ID, i.C_Currency_ID, 1) AS PaidAmt, + invoiceOpen(i.C_Invoice_ID, ips.C_InvoicePaySchedule_ID) AS OpenAmt, + i.C_Currency_ID, i.C_ConversionType_ID, + i.C_PaymentTerm_ID, + i.IsPayScheduleValid, ips.C_InvoicePaySchedule_ID, i.InvoiceCollectionType, + i.C_Campaign_ID, i.C_Project_ID, i.C_Activity_ID +FROM RV_C_Invoice i + INNER JOIN C_InvoicePaySchedule ips ON (i.C_Invoice_ID=ips.C_Invoice_ID) +WHERE -- i.IsPaid='N' + invoiceOpen(i.C_Invoice_ID,ips.C_InvoicePaySchedule_ID) <> 0 + AND i.IsPayScheduleValid='Y' + AND i.DocStatus<>'DR' + AND ips.IsValid='Y'; + + + diff --git a/db/ddlutils/views/RV_ORDERDETAIL.sql b/db/ddlutils/oracle/views/RV_ORDERDETAIL.sql similarity index 100% rename from db/ddlutils/views/RV_ORDERDETAIL.sql rename to db/ddlutils/oracle/views/RV_ORDERDETAIL.sql diff --git a/db/ddlutils/views/RV_PAYMENT.sql b/db/ddlutils/oracle/views/RV_PAYMENT.sql similarity index 100% rename from db/ddlutils/views/RV_PAYMENT.sql rename to db/ddlutils/oracle/views/RV_PAYMENT.sql diff --git a/db/ddlutils/views/RV_PRINTFORMATDETAIL.sql b/db/ddlutils/oracle/views/RV_PRINTFORMATDETAIL.sql similarity index 100% rename from db/ddlutils/views/RV_PRINTFORMATDETAIL.sql rename to db/ddlutils/oracle/views/RV_PRINTFORMATDETAIL.sql diff --git a/db/ddlutils/views/RV_PRODUCT_COSTING.sql b/db/ddlutils/oracle/views/RV_PRODUCT_COSTING.sql similarity index 100% rename from db/ddlutils/views/RV_PRODUCT_COSTING.sql rename to db/ddlutils/oracle/views/RV_PRODUCT_COSTING.sql diff --git a/db/ddlutils/views/RV_PROJECTCYCLE.sql b/db/ddlutils/oracle/views/RV_PROJECTCYCLE.sql similarity index 100% rename from db/ddlutils/views/RV_PROJECTCYCLE.sql rename to db/ddlutils/oracle/views/RV_PROJECTCYCLE.sql diff --git a/db/ddlutils/views/RV_PROJECTLINEISSUE.sql b/db/ddlutils/oracle/views/RV_PROJECTLINEISSUE.sql similarity index 100% rename from db/ddlutils/views/RV_PROJECTLINEISSUE.sql rename to db/ddlutils/oracle/views/RV_PROJECTLINEISSUE.sql diff --git a/db/ddlutils/oracle/views/RV_REQUESTUPDATES.sql b/db/ddlutils/oracle/views/RV_REQUESTUPDATES.sql new file mode 100644 index 0000000000..307b9aa93c --- /dev/null +++ b/db/ddlutils/oracle/views/RV_REQUESTUPDATES.sql @@ -0,0 +1,46 @@ +CREATE OR REPLACE VIEW RV_REQUESTUPDATES +(AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, + UPDATED, UPDATEDBY, R_REQUEST_ID, AD_USER_ID, ISSELFSERVICE, + R_GROUP_ID, R_REQUESTTYPE_ID, R_CATEGORY_ID) +AS +SELECT AD_Client_ID, AD_Org_ID, IsActive, Created, CreatedBy, Updated, UpdatedBy, + R_Request_ID, AD_User_ID, IsSelfService, + cast(NULL as number) AS R_Group_ID, cast(NULL as number) AS R_RequestType_ID, + cast(NULL as number) AS R_Category_ID +FROM R_RequestUpdates +UNION +SELECT u.AD_Client_ID, u.AD_Org_ID, u.IsActive, u.Created, u.CreatedBy, u.Updated, u.UpdatedBy, + r.R_Request_ID, u.AD_User_ID, u.IsSelfService, + r.R_Group_ID, NULL, NULL +FROM R_GroupUpdates u + INNER JOIN R_Request r ON (u.R_Group_ID=r.R_Group_ID) +UNION +SELECT u.AD_Client_ID, u.AD_Org_ID, u.IsActive, u.Created, u.CreatedBy, u.Updated, u.UpdatedBy, + r.R_Request_ID, u.AD_User_ID, u.IsSelfService, + NULL, r.R_RequestType_ID, NULL +FROM R_RequestTypeUpdates u + INNER JOIN R_Request r ON (u.R_RequestType_ID=r.R_RequestType_ID) +UNION +SELECT u.AD_Client_ID, u.AD_Org_ID, u.IsActive, u.Created, u.CreatedBy, u.Updated, u.UpdatedBy, + r.R_Request_ID, u.AD_User_ID, u.IsSelfService, + NULL, NULL, r.R_Category_ID +FROM R_CategoryUpdates u + INNER JOIN R_Request r ON (u.R_Category_ID=r.R_Category_ID) +UNION -- BP User +SELECT AD_Client_ID, AD_Org_ID, IsActive, Created, CreatedBy, Updated, UpdatedBy, + R_Request_ID, AD_User_ID, IsSelfService, + NULL, NULL, NULL +FROM R_Request +WHERE AD_User_ID IS NOT NULL +UNION -- SalesRep +SELECT u.AD_Client_ID, u.AD_Org_ID, u.IsActive, u.Created, u.CreatedBy, u.Updated, u.UpdatedBy, + r.R_Request_ID, u.AD_User_ID, NULL, + NULL, NULL, r.R_Category_ID +FROM AD_User u + INNER JOIN R_Request r ON (u.AD_User_ID=r.SalesRep_ID) +UNION -- Role +SELECT r.AD_Client_ID, r.AD_Org_ID, u.IsActive, r.Created, r.CreatedBy, r.Updated, r.UpdatedBy, + r.R_Request_ID, u.AD_User_ID, NULL, + NULL, NULL, NULL +FROM R_Request r + INNER JOIN AD_User_Roles u ON (u.AD_Role_ID=r.AD_Role_ID); diff --git a/db/ddlutils/views/RV_REQUESTUPDATES_ONLY.sql b/db/ddlutils/oracle/views/RV_REQUESTUPDATES_ONLY.sql similarity index 100% rename from db/ddlutils/views/RV_REQUESTUPDATES_ONLY.sql rename to db/ddlutils/oracle/views/RV_REQUESTUPDATES_ONLY.sql diff --git a/db/ddlutils/views/RV_REQUESTUPDATES_V.sql b/db/ddlutils/oracle/views/RV_REQUESTUPDATES_V.sql similarity index 100% rename from db/ddlutils/views/RV_REQUESTUPDATES_V.sql rename to db/ddlutils/oracle/views/RV_REQUESTUPDATES_V.sql diff --git a/db/ddlutils/views/RV_STORAGE.sql b/db/ddlutils/oracle/views/RV_STORAGE.sql similarity index 100% rename from db/ddlutils/views/RV_STORAGE.sql rename to db/ddlutils/oracle/views/RV_STORAGE.sql diff --git a/db/ddlutils/views/RV_TRANSACTION.sql b/db/ddlutils/oracle/views/RV_TRANSACTION.sql similarity index 100% rename from db/ddlutils/views/RV_TRANSACTION.sql rename to db/ddlutils/oracle/views/RV_TRANSACTION.sql diff --git a/db/ddlutils/views/RV_UNPOSTED.sql b/db/ddlutils/oracle/views/RV_UNPOSTED.sql similarity index 100% rename from db/ddlutils/views/RV_UNPOSTED.sql rename to db/ddlutils/oracle/views/RV_UNPOSTED.sql diff --git a/db/ddlutils/views/RV_WAREHOUSEPRICE.sql b/db/ddlutils/oracle/views/RV_WAREHOUSEPRICE.sql similarity index 100% rename from db/ddlutils/views/RV_WAREHOUSEPRICE.sql rename to db/ddlutils/oracle/views/RV_WAREHOUSEPRICE.sql diff --git a/db/ddlutils/views/R_REQUEST_V.sql b/db/ddlutils/oracle/views/R_REQUEST_V.sql similarity index 100% rename from db/ddlutils/views/R_REQUEST_V.sql rename to db/ddlutils/oracle/views/R_REQUEST_V.sql diff --git a/db/ddlutils/views/T_INVOICEGL_V.sql b/db/ddlutils/oracle/views/T_INVOICEGL_V.sql similarity index 100% rename from db/ddlutils/views/T_INVOICEGL_V.sql rename to db/ddlutils/oracle/views/T_INVOICEGL_V.sql diff --git a/db/ddlutils/views/T_INVOICEGL_VT.sql b/db/ddlutils/oracle/views/T_INVOICEGL_VT.sql similarity index 100% rename from db/ddlutils/views/T_INVOICEGL_VT.sql rename to db/ddlutils/oracle/views/T_INVOICEGL_VT.sql diff --git a/db/ddlutils/postgresql/aliasfunction.sql b/db/ddlutils/postgresql/aliasfunction.sql deleted file mode 100644 index 9c6d384e28..0000000000 --- a/db/ddlutils/postgresql/aliasfunction.sql +++ /dev/null @@ -1,79 +0,0 @@ -/************* bomPriceLimit Alias *******************/ -CREATE OR REPLACE FUNCTION bomPriceLimit (M_Product_ID NUMERIC, M_PriceList_Version_ID INTEGER) -RETURNS NUMERIC AS $$ -BEGIN - RETURN bomPriceLimit(ID(M_Product_ID),M_PriceList_Version_ID); -END; -$$ LANGUAGE plpgsql VOLATILE; - -CREATE OR REPLACE FUNCTION bomPriceLimit (M_Product_ID NUMERIC, M_PriceList_Version_ID NUMERIC) -RETURNS NUMERIC AS $$ -BEGIN - RETURN bomPriceLimit(ID(M_Product_ID),ID(M_PriceList_Version_ID)); -END; -$$ LANGUAGE plpgsql VOLATILE; - -/************* bomPriceList *******************/ -CREATE OR REPLACE FUNCTION bomPriceList (M_Product_ID NUMERIC, M_PriceList_Version_ID INTEGER) -RETURNS NUMERIC AS $$ -BEGIN - RETURN bomPriceList(ID(M_Product_ID),M_PriceList_Version_ID); -END; -$$ LANGUAGE plpgsql VOLATILE; - -CREATE OR REPLACE FUNCTION bomPriceList (M_Product_ID NUMERIC, M_PriceList_Version_ID NUMERIC) -RETURNS NUMERIC AS $$ -BEGIN - RETURN bomPriceList(ID(M_Product_ID),ID(M_PriceList_Version_ID)); -END; -$$ LANGUAGE plpgsql VOLATILE; - -/************* bomPriceStd *******************/ -CREATE OR REPLACE FUNCTION bomPriceStd (M_Product_ID NUMERIC, M_PriceList_Version_ID INTEGER) -RETURNS NUMERIC AS $$ -BEGIN - RETURN bomPriceStd(ID(M_Product_ID),M_PriceList_Version_ID); -END; -$$ LANGUAGE plpgsql VOLATILE; - -CREATE OR REPLACE FUNCTION bomPriceStd (M_Product_ID NUMERIC, M_PriceList_Version_ID NUMERIC) -RETURNS NUMERIC AS $$ -BEGIN - RETURN bomPriceStd(ID(M_Product_ID),ID(M_PriceList_Version_ID)); -END; -$$ LANGUAGE plpgsql VOLATILE; - -/************* bomQtyAvailable *******************/ -CREATE OR REPLACE FUNCTION bomQtyAvailable (M_Product_ID NUMERIC, M_Warehouse_ID INTEGER, M_Locator_ID INTEGER) -RETURNS NUMERIC AS $$ -BEGIN - RETURN bomQtyAvailable(ID(M_Product_ID),M_Warehouse_ID,M_Locator_ID); -END; -$$ LANGUAGE plpgsql VOLATILE; - - -/************* bomQtyOnHand *******************/ -CREATE OR REPLACE FUNCTION bomQtyOnHand (M_Product_ID NUMERIC, M_Warehouse_ID INTEGER, M_Locator_ID INTEGER) -RETURNS NUMERIC AS $$ -BEGIN - RETURN bomQtyOnHand(ID(M_Product_ID),M_Warehouse_ID,M_Locator_ID); -END; -$$ LANGUAGE plpgsql VOLATILE; - - -/************* bomQtyOrdered *******************/ -CREATE OR REPLACE FUNCTION bomQtyOrdered (M_Product_ID NUMERIC, M_Warehouse_ID INTEGER, M_Locator_ID INTEGER) -RETURNS NUMERIC AS $$ -BEGIN - RETURN bomQtyOrdered(ID(M_Product_ID),M_Warehouse_ID,M_Locator_ID); -END; -$$ LANGUAGE plpgsql VOLATILE; - - -/************* bomQtyReserved *******************/ -CREATE OR REPLACE FUNCTION bomQtyReserved (M_Product_ID NUMERIC, M_Warehouse_ID INTEGER, M_Locator_ID INTEGER) -RETURNS NUMERIC AS $$ -BEGIN - RETURN bomQtyReserved(ID(M_Product_ID),M_Warehouse_ID,M_Locator_ID); -END; -$$ LANGUAGE plpgsql VOLATILE; \ No newline at end of file diff --git a/db/ddlutils/postgresql/build.xml b/db/ddlutils/postgresql/build.xml index 886c37e527..50aa28fb3e 100644 --- a/db/ddlutils/postgresql/build.xml +++ b/db/ddlutils/postgresql/build.xml @@ -102,7 +102,7 @@ - + @@ -111,7 +111,7 @@ - + diff --git a/db/ddlutils/postgresql/views/AD_CHANGELOG_V.sql b/db/ddlutils/postgresql/views/AD_CHANGELOG_V.sql new file mode 100644 index 0000000000..cfe4845bfe --- /dev/null +++ b/db/ddlutils/postgresql/views/AD_CHANGELOG_V.sql @@ -0,0 +1,16 @@ +CREATE OR REPLACE VIEW AD_CHANGELOG_V +(AD_SESSION_ID, AD_CHANGELOG_ID, TABLENAME, RECORD_ID, COLUMNNAME, + OLDVALUE, NEWVALUE, NAME, CREATED) +AS +SELECT l.AD_Session_ID, l.AD_ChangeLog_ID, + t.TableName, l.Record_ID, c.ColumnName, + l.OldValue, l.NewValue, + u.Name, l.Created +FROM AD_ChangeLog l + INNER JOIN AD_Table t ON (l.AD_Table_ID=t.AD_Table_ID) + INNER JOIN AD_Column c ON (l.AD_Column_ID=c.AD_Column_ID) + INNER JOIN AD_User u ON (l.CreatedBy=u.AD_User_ID) +ORDER BY l.AD_Session_ID, l.AD_ChangeLog_ID, t.TableName, l.Record_ID, c.ColumnName; + + + diff --git a/db/ddlutils/postgresql/views/AD_FIELD_V.sql b/db/ddlutils/postgresql/views/AD_FIELD_V.sql new file mode 100644 index 0000000000..f3525c141d --- /dev/null +++ b/db/ddlutils/postgresql/views/AD_FIELD_V.sql @@ -0,0 +1,36 @@ +CREATE OR REPLACE VIEW AD_FIELD_V +(AD_WINDOW_ID, AD_TAB_ID, AD_FIELD_ID, AD_TABLE_ID, AD_COLUMN_ID, + NAME, DESCRIPTION, HELP, ISDISPLAYED, DISPLAYLOGIC, + DISPLAYLENGTH, SEQNO, SORTNO, ISSAMELINE, ISHEADING, + ISFIELDONLY, ISREADONLY, ISENCRYPTEDFIELD, OBSCURETYPE, COLUMNNAME, + COLUMNSQL, FIELDLENGTH, VFORMAT, DEFAULTVALUE, ISKEY, + ISPARENT, ISMANDATORY, ISIDENTIFIER, ISTRANSLATED, AD_REFERENCE_VALUE_ID, + CALLOUT, AD_REFERENCE_ID, AD_VAL_RULE_ID, AD_PROCESS_ID, ISALWAYSUPDATEABLE, + READONLYLOGIC, ISUPDATEABLE, ISENCRYPTEDCOLUMN, ISSELECTIONCOLUMN, TABLENAME, + VALUEMIN, VALUEMAX, FIELDGROUP, VALIDATIONCODE) +AS +SELECT t.AD_Window_ID, f.AD_Tab_ID, f.AD_Field_ID, tbl.AD_Table_ID, f.AD_Column_ID, + f.Name, f.Description, f.Help, f.IsDisplayed, f.DisplayLogic, f.DisplayLength, + f.SeqNo, f.SortNo, f.IsSameLine, f.IsHeading, f.IsFieldOnly, f.IsReadOnly, + f.IsEncrypted AS IsEncryptedField, f.ObscureType, + c.ColumnName, c.ColumnSQL, c.FieldLength, c.VFormat, c.DefaultValue, c.IsKey, c.IsParent, + COALESCE(f.IsMandatory, c.IsMandatory) AS IsMandatory, + c.IsIdentifier, c.IsTranslated, c.AD_Reference_Value_ID, + c.Callout, COALESCE(f.AD_Reference_ID, c.AD_Reference_ID) AS AD_Reference_ID, + c.AD_Val_Rule_ID, c.AD_Process_ID, c.IsAlwaysUpdateable, + c.ReadOnlyLogic, c.IsUpdateable, c.IsEncrypted AS IsEncryptedColumn, + c.IsSelectionColumn, + tbl.TableName, c.ValueMin, c.ValueMax, + fg.Name AS FieldGroup, vr.Code AS ValidationCode +FROM AD_Field f + INNER JOIN AD_Tab t ON (f.AD_Tab_ID = t.AD_Tab_ID) + LEFT OUTER JOIN AD_FieldGroup fg ON (f.AD_FieldGroup_ID = fg.AD_FieldGroup_ID) + LEFT OUTER JOIN AD_Column c ON (f.AD_Column_ID = c.AD_Column_ID) + INNER JOIN AD_Table tbl ON (c.AD_Table_ID = tbl.AD_Table_ID) + INNER JOIN AD_Reference r ON (c.AD_Reference_ID = r.AD_Reference_ID) + LEFT OUTER JOIN AD_Val_Rule vr ON (c.AD_Val_Rule_ID=vr.AD_Val_Rule_ID) +WHERE f.IsActive = 'Y' + AND c.IsActive = 'Y'; + + + diff --git a/db/ddlutils/postgresql/views/AD_FIELD_VT.sql b/db/ddlutils/postgresql/views/AD_FIELD_VT.sql new file mode 100644 index 0000000000..f89aea7114 --- /dev/null +++ b/db/ddlutils/postgresql/views/AD_FIELD_VT.sql @@ -0,0 +1,37 @@ +CREATE OR REPLACE VIEW AD_FIELD_VT +(AD_LANGUAGE, AD_WINDOW_ID, AD_TAB_ID, AD_FIELD_ID, AD_TABLE_ID, + AD_COLUMN_ID, NAME, DESCRIPTION, HELP, ISDISPLAYED, + DISPLAYLOGIC, DISPLAYLENGTH, SEQNO, SORTNO, ISSAMELINE, + ISHEADING, ISFIELDONLY, ISREADONLY, ISENCRYPTEDFIELD, OBSCURETYPE, + COLUMNNAME, COLUMNSQL, FIELDLENGTH, VFORMAT, DEFAULTVALUE, + ISKEY, ISPARENT, ISMANDATORY, ISIDENTIFIER, ISTRANSLATED, + AD_REFERENCE_VALUE_ID, CALLOUT, AD_REFERENCE_ID, AD_VAL_RULE_ID, AD_PROCESS_ID, + ISALWAYSUPDATEABLE, READONLYLOGIC, ISUPDATEABLE, ISENCRYPTEDCOLUMN, ISSELECTIONCOLUMN, + TABLENAME, VALUEMIN, VALUEMAX, FIELDGROUP, VALIDATIONCODE) +AS +SELECT trl.AD_Language, t.AD_Window_ID, f.AD_Tab_ID, f.AD_Field_ID, tbl.AD_Table_ID, f.AD_Column_ID, + trl.Name, trl.Description, trl.Help, f.IsDisplayed, f.DisplayLogic, f.DisplayLength, + f.SeqNo, f.SortNo, f.IsSameLine, f.IsHeading, f.IsFieldOnly, f.IsReadOnly, + f.IsEncrypted AS IsEncryptedField, f.ObscureType, + c.ColumnName, c.ColumnSQL, c.FieldLength, c.VFormat, c.DefaultValue, c.IsKey, c.IsParent, + COALESCE(f.IsMandatory, c.IsMandatory) AS IsMandatory, + c.IsIdentifier, c.IsTranslated, c.AD_Reference_Value_ID, + c.Callout, COALESCE(f.AD_Reference_ID, c.AD_Reference_ID) AS AD_Reference_ID, + c.AD_Val_Rule_ID, c.AD_Process_ID, c.IsAlwaysUpdateable, + c.ReadOnlyLogic, c.IsUpdateable, c.IsEncrypted AS IsEncryptedColumn, c.IsSelectionColumn, + tbl.TableName, c.ValueMin, c.ValueMax, + fgt.Name AS FieldGroup, vr.Code AS ValidationCode +FROM AD_Field f + INNER JOIN AD_Field_Trl trl ON (f.AD_Field_ID = trl.AD_Field_ID) + INNER JOIN AD_Tab t ON (f.AD_Tab_ID = t.AD_Tab_ID) + LEFT OUTER JOIN AD_FieldGroup_Trl fgt ON + (f.AD_FieldGroup_ID = fgt.AD_FieldGroup_ID AND trl.AD_Language=fgt.AD_Language) + LEFT OUTER JOIN AD_Column c ON (f.AD_Column_ID = c.AD_Column_ID) + INNER JOIN AD_Table tbl ON (c.AD_Table_ID = tbl.AD_Table_ID) + INNER JOIN AD_Reference r ON (c.AD_Reference_ID = r.AD_Reference_ID) + LEFT OUTER JOIN AD_Val_Rule vr ON (c.AD_Val_Rule_ID=vr.AD_Val_Rule_ID) +WHERE f.IsActive = 'Y' + AND c.IsActive = 'Y'; + + + diff --git a/db/ddlutils/postgresql/views/AD_ORG_V.sql b/db/ddlutils/postgresql/views/AD_ORG_V.sql new file mode 100644 index 0000000000..912f011378 --- /dev/null +++ b/db/ddlutils/postgresql/views/AD_ORG_V.sql @@ -0,0 +1,19 @@ +CREATE OR REPLACE VIEW AD_ORG_V +(AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, + UPDATED, UPDATEDBY, VALUE, NAME, DESCRIPTION, + ISSUMMARY, C_LOCATION_ID, DUNS, TAXID, SUPERVISOR_ID, + PARENT_ORG_ID, AD_ORGTYPE_ID, M_WAREHOUSE_ID, C_BPARTNER_ID) +AS +SELECT o.AD_Client_ID, o.AD_Org_ID, + o.IsActive, o.Created, o.CreatedBy, o.Updated, o.UpdatedBy, + o.Value, o.Name, o.Description, o.IsSummary, + i.C_Location_ID, i.DUNS, i.TaxID, + i.Supervisor_ID, i.Parent_Org_ID, + i.AD_OrgType_ID, i.M_Warehouse_ID, + bp.C_BPartner_ID +FROM AD_Org o + INNER JOIN AD_OrgInfo i ON (o.AD_Org_ID=i.AD_Org_ID) + LEFT OUTER JOIN C_BPartner bp ON (o.AD_Org_ID=bp.AD_OrgBP_ID); + + + diff --git a/db/ddlutils/postgresql/views/AD_TAB_V.sql b/db/ddlutils/postgresql/views/AD_TAB_V.sql new file mode 100644 index 0000000000..741e51fa60 --- /dev/null +++ b/db/ddlutils/postgresql/views/AD_TAB_V.sql @@ -0,0 +1,24 @@ +CREATE OR REPLACE VIEW AD_TAB_V +(AD_TAB_ID, AD_WINDOW_ID, AD_TABLE_ID, NAME, DESCRIPTION, + HELP, SEQNO, ISSINGLEROW, HASTREE, ISINFOTAB, + REPLICATIONTYPE, TABLENAME, ACCESSLEVEL, ISSECURITYENABLED, ISDELETEABLE, + ISHIGHVOLUME, ISVIEW, HASASSOCIATION, ISTRANSLATIONTAB, ISREADONLY, + AD_IMAGE_ID, TABLEVEL, WHERECLAUSE, ORDERBYCLAUSE, COMMITWARNING, + READONLYLOGIC, DISPLAYLOGIC, AD_COLUMN_ID, AD_PROCESS_ID, ISSORTTAB, + ISINSERTRECORD, ISADVANCEDTAB, AD_COLUMNSORTORDER_ID, AD_COLUMNSORTYESNO_ID, INCLUDED_TAB_ID) +AS +SELECT t.AD_Tab_ID, t.AD_Window_ID, t.AD_Table_ID, t.Name, t.Description, + t.Help, t.SeqNo, t.IsSingleRow, t.HasTree, t.IsInfoTab, tbl.ReplicationType, + tbl.TableName, tbl.AccessLevel, tbl.IsSecurityEnabled, tbl.IsDeleteable, + tbl.IsHighVolume, tbl.IsView, cast('N' as char) AS HasAssociation, -- compatibility + t.IsTranslationTab, t.IsReadOnly, t.AD_Image_ID, t.TabLevel, + t.WhereClause, t.OrderByClause, t.CommitWarning, t.ReadOnlyLogic, t.DisplayLogic, + t.AD_Column_ID, t.AD_Process_ID, t.IsSortTab, t.IsInsertRecord, t.IsAdvancedTab, + t.AD_ColumnSortOrder_ID, t.AD_ColumnSortYesNo_ID, t.Included_Tab_ID +FROM AD_Tab t + INNER JOIN AD_Table tbl ON (t.AD_Table_ID = tbl.AD_Table_ID) +WHERE t.IsActive='Y' + AND tbl.IsActive='Y'; + + + diff --git a/db/ddlutils/postgresql/views/AD_TAB_VT.sql b/db/ddlutils/postgresql/views/AD_TAB_VT.sql new file mode 100644 index 0000000000..5268ca1d45 --- /dev/null +++ b/db/ddlutils/postgresql/views/AD_TAB_VT.sql @@ -0,0 +1,26 @@ +CREATE OR REPLACE VIEW AD_TAB_VT +(AD_LANGUAGE, AD_TAB_ID, AD_WINDOW_ID, AD_TABLE_ID, NAME, + DESCRIPTION, HELP, SEQNO, ISSINGLEROW, HASTREE, + ISINFOTAB, REPLICATIONTYPE, TABLENAME, ACCESSLEVEL, ISSECURITYENABLED, + ISDELETEABLE, ISHIGHVOLUME, ISVIEW, HASASSOCIATION, ISTRANSLATIONTAB, + ISREADONLY, AD_IMAGE_ID, TABLEVEL, WHERECLAUSE, ORDERBYCLAUSE, + COMMITWARNING, READONLYLOGIC, DISPLAYLOGIC, AD_COLUMN_ID, AD_PROCESS_ID, + ISSORTTAB, ISINSERTRECORD, ISADVANCEDTAB, AD_COLUMNSORTORDER_ID, AD_COLUMNSORTYESNO_ID, + INCLUDED_TAB_ID) +AS +SELECT trl.AD_Language, t.AD_Tab_ID, t.AD_Window_ID, t.AD_Table_ID, trl.Name, trl.Description, + trl.Help, t.SeqNo, t.IsSingleRow, t.HasTree, t.IsInfoTab, tbl.ReplicationType, + tbl.TableName, tbl.AccessLevel, tbl.IsSecurityEnabled, tbl.IsDeleteable, + tbl.IsHighVolume, tbl.IsView, cast('N' as char) AS HasAssociation, -- compatibility + t.IsTranslationTab, t.IsReadOnly, t.AD_Image_ID, t.TabLevel, + t.WhereClause, t.OrderByClause, trl.CommitWarning, t.ReadOnlyLogic, t.DisplayLogic, + t.AD_Column_ID, t.AD_Process_ID, t.IsSortTab, t.IsInsertRecord, t.IsAdvancedTab, + t.AD_ColumnSortOrder_ID, t.AD_ColumnSortYesNo_ID, t.Included_Tab_ID +FROM AD_Tab t + INNER JOIN AD_Table tbl ON (t.AD_Table_ID = tbl.AD_Table_ID) + INNER JOIN AD_Tab_Trl trl ON (t.AD_Tab_ID = trl.AD_Tab_ID) +WHERE t.IsActive='Y' + AND tbl.IsActive='Y'; + + + diff --git a/db/ddlutils/postgresql/views/AD_USER_ROLES_V.sql b/db/ddlutils/postgresql/views/AD_USER_ROLES_V.sql new file mode 100644 index 0000000000..b6a8fb4833 --- /dev/null +++ b/db/ddlutils/postgresql/views/AD_USER_ROLES_V.sql @@ -0,0 +1,10 @@ +CREATE OR REPLACE VIEW AD_USER_ROLES_V +(NAME, ROLENAME) +AS +SELECT u.Name, r.Name AS RoleName +FROM AD_User_Roles ur + INNER JOIN AD_User u ON (ur.AD_User_ID=u.AD_User_ID) + INNER JOIN AD_Role r ON (ur.AD_Role_ID=r.AD_Role_ID); + + + diff --git a/db/ddlutils/postgresql/views/AD_WINDOW_VT.sql b/db/ddlutils/postgresql/views/AD_WINDOW_VT.sql new file mode 100644 index 0000000000..401b718808 --- /dev/null +++ b/db/ddlutils/postgresql/views/AD_WINDOW_VT.sql @@ -0,0 +1,15 @@ +CREATE OR REPLACE VIEW AD_WINDOW_VT +(AD_LANGUAGE, AD_WINDOW_ID, NAME, DESCRIPTION, HELP, + WINDOWTYPE, AD_COLOR_ID, AD_IMAGE_ID, ISACTIVE, WINWIDTH, + WINHEIGHT, ISSOTRX) +AS +SELECT trl.AD_Language, + bt.AD_Window_ID, trl.Name, trl.Description, trl.Help, bt.WindowType, + bt.AD_Color_ID, bt.AD_Image_ID, bt.IsActive, bt.WinWidth, bt.WinHeight, + bt.IsSOTrx +FROM AD_Window bt + INNER JOIN AD_Window_Trl trl ON (bt.AD_Window_ID=trl.AD_Window_ID) +WHERE bt.IsActive='Y'; + + + diff --git a/db/ddlutils/postgresql/views/C_DUNNING_HEADER_V.sql b/db/ddlutils/postgresql/views/C_DUNNING_HEADER_V.sql new file mode 100644 index 0000000000..4240a72582 --- /dev/null +++ b/db/ddlutils/postgresql/views/C_DUNNING_HEADER_V.sql @@ -0,0 +1,37 @@ +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); + + + diff --git a/db/ddlutils/postgresql/views/C_DUNNING_HEADER_VT.sql b/db/ddlutils/postgresql/views/C_DUNNING_HEADER_VT.sql new file mode 100644 index 0000000000..9fb90735b6 --- /dev/null +++ b/db/ddlutils/postgresql/views/C_DUNNING_HEADER_VT.sql @@ -0,0 +1,40 @@ +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); + + + diff --git a/db/ddlutils/postgresql/views/C_DUNNING_LINE_V.sql b/db/ddlutils/postgresql/views/C_DUNNING_LINE_V.sql new file mode 100644 index 0000000000..f7895c0e0d --- /dev/null +++ b/db/ddlutils/postgresql/views/C_DUNNING_LINE_V.sql @@ -0,0 +1,50 @@ +CREATE OR REPLACE VIEW C_DUNNING_LINE_V +(AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, + UPDATED, UPDATEDBY, AD_LANGUAGE, C_DUNNINGRUNLINE_ID, C_DUNNINGRUNENTRY_ID, + AMT, CONVERTEDAMT, DAYSDUE, TIMESDUNNED, INTERESTAMT, + FEEAMT, TOTALAMT, C_INVOICE_ID, ISSOTRX, DOCUMENTNO, + DOCSTATUS, DATETRX, C_DOCTYPE_ID, DOCUMENTTYPE, DESCRIPTION, + C_CURRENCY_ID, C_CAMPAIGN_ID, C_PROJECT_ID, C_ACTIVITY_ID, USER1_ID, + USER2_ID, DATEACCT, C_CONVERSIONTYPE_ID, AD_ORGTRX_ID, POREFERENCE, + DATEORDERED, DATEINVOICED, ISINDISPUTE, PAYMENTTERM, C_CHARGE_ID, + CHARGEAMT, TOTALLINES, GRANDTOTAL, AMTINWORDS, M_PRICELIST_ID, + ISPAID, ISALLOCATED, TENDERTYPE, DISCOUNTAMT) +AS +SELECT drl.AD_Client_ID, drl.AD_Org_ID, drl.IsActive, drl.Created, drl.CreatedBy, drl.Updated, drl.UpdatedBy, + cast('en_US' as varchar) AS AD_Language, + drl.C_DunningRunLine_ID, drl.C_DunningRunEntry_ID, + drl.Amt, drl.ConvertedAmt, drl.DaysDue, drl.TimesDunned, + drl.InterestAmt, drl.FeeAmt, drl.TotalAmt, + drl.C_Invoice_ID, + COALESCE(i.IsSOTrx,p.IsReceipt) AS IsSOTrx, + COALESCE(i.DocumentNo,p.DocumentNo) AS DocumentNo, + COALESCE(i.DocStatus,p.DocStatus) AS DocStatus, + COALESCE(i.DateInvoiced, p.DateTrx) AS DateTrx, + COALESCE(i.C_DocType_ID,p.C_DocType_ID) AS C_DocType_ID, + COALESCE(dt.PrintName,dtp.PrintName) AS DocumentType, + COALESCE(i.Description,p.Description) AS Description, + COALESCE(i.C_Currency_ID,p.C_Currency_ID) AS C_Currency_ID, + COALESCE(i.C_Campaign_ID,p.C_Campaign_ID) AS C_Campaign_ID, + COALESCE(i.C_Project_ID,p.C_Project_ID) AS C_Project_ID, + COALESCE(i.C_Activity_ID,p.C_Activity_ID) AS C_Activity_ID, + COALESCE(i.User1_ID,p.User1_ID) AS User1_ID, + COALESCE(i.User2_ID,p.User2_ID) AS User2_ID, + COALESCE(i.DateAcct,p.DateAcct) AS DateAcct, + COALESCE(i.C_ConversionType_ID,i.C_ConversionType_ID) AS C_ConversionType_ID, + COALESCE(i.AD_OrgTrx_ID,p.AD_OrgTrx_ID) AS AD_OrgTrx_ID, + i.POReference, i.DateOrdered, + i.DateInvoiced, i.IsInDispute, + pt.Name AS PaymentTerm, + i.C_Charge_ID, i.ChargeAmt, + i.TotalLines, i.GrandTotal, i.GrandTotal AS AmtInWords, + i.M_PriceList_ID, i.IsPaid, + p.IsAllocated, p.TenderType, p.DiscountAmt +FROM C_DunningRunLine drl + LEFT OUTER JOIN C_Invoice i ON (drl.C_Invoice_ID=i.C_Invoice_ID) + LEFT OUTER JOIN C_DocType dt ON (i.C_DocType_ID=dt.C_DocType_ID) + LEFT OUTER JOIN C_PaymentTerm pt ON (i.C_PaymentTerm_ID=pt.C_PaymentTerm_ID) + LEFT OUTER JOIN C_Payment p ON (drl.C_Payment_ID=p.C_Payment_ID) + LEFT OUTER JOIN C_DocType dtp ON (p.C_DocType_ID=dtp.C_DocType_ID); + + + diff --git a/db/ddlutils/postgresql/views/C_DUNNING_LINE_VT.sql b/db/ddlutils/postgresql/views/C_DUNNING_LINE_VT.sql new file mode 100644 index 0000000000..d88f116904 --- /dev/null +++ b/db/ddlutils/postgresql/views/C_DUNNING_LINE_VT.sql @@ -0,0 +1,52 @@ +CREATE OR REPLACE VIEW C_DUNNING_LINE_VT +(AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, + UPDATED, UPDATEDBY, AD_LANGUAGE, C_DUNNINGRUNLINE_ID, C_DUNNINGRUNENTRY_ID, + AMT, CONVERTEDAMT, DAYSDUE, TIMESDUNNED, INTERESTAMT, + FEEAMT, TOTALAMT, C_INVOICE_ID, ISSOTRX, DOCUMENTNO, + DOCSTATUS, DATETRX, C_DOCTYPE_ID, DOCUMENTTYPE, DESCRIPTION, + C_CURRENCY_ID, C_CAMPAIGN_ID, C_PROJECT_ID, C_ACTIVITY_ID, USER1_ID, + USER2_ID, DATEACCT, C_CONVERSIONTYPE_ID, AD_ORGTRX_ID, POREFERENCE, + DATEORDERED, DATEINVOICED, ISINDISPUTE, PAYMENTTERM, C_CHARGE_ID, + CHARGEAMT, TOTALLINES, GRANDTOTAL, AMTINWORDS, M_PRICELIST_ID, + ISPAID, ISALLOCATED, TENDERTYPE, DISCOUNTAMT) +AS +SELECT drl.AD_Client_ID, drl.AD_Org_ID, drl.IsActive, drl.Created, drl.CreatedBy, drl.Updated, drl.UpdatedBy, + COALESCE(dt.AD_Language,dtp.AD_Language) AS AD_Language, + drl.C_DunningRunLine_ID, drl.C_DunningRunEntry_ID, + drl.Amt, drl.ConvertedAmt, drl.DaysDue, drl.TimesDunned, + drl.InterestAmt, drl.FeeAmt, drl.TotalAmt, + drl.C_Invoice_ID, + COALESCE(i.IsSOTrx,p.IsReceipt) AS IsSOTrx, + COALESCE(i.DocumentNo,p.DocumentNo) AS DocumentNo, + COALESCE(i.DocStatus,p.DocStatus) AS DocStatus, + COALESCE(i.DateInvoiced, p.DateTrx) AS DateTrx, + COALESCE(i.C_DocType_ID,p.C_DocType_ID) AS C_DocType_ID, + COALESCE(dt.PrintName,dtp.PrintName) AS DocumentType, + COALESCE(i.Description,p.Description) AS Description, + COALESCE(i.C_Currency_ID,p.C_Currency_ID) AS C_Currency_ID, + COALESCE(i.C_Campaign_ID,p.C_Campaign_ID) AS C_Campaign_ID, + COALESCE(i.C_Project_ID,p.C_Project_ID) AS C_Project_ID, + COALESCE(i.C_Activity_ID,p.C_Activity_ID) AS C_Activity_ID, + COALESCE(i.User1_ID,p.User1_ID) AS User1_ID, + COALESCE(i.User2_ID,p.User2_ID) AS User2_ID, + COALESCE(i.DateAcct,p.DateAcct) AS DateAcct, + COALESCE(i.C_ConversionType_ID,i.C_ConversionType_ID) AS C_ConversionType_ID, + COALESCE(i.AD_OrgTrx_ID,p.AD_OrgTrx_ID) AS AD_OrgTrx_ID, + i.POReference, i.DateOrdered, + i.DateInvoiced, i.IsInDispute, + pt.Name AS PaymentTerm, + i.C_Charge_ID, i.ChargeAmt, + i.TotalLines, i.GrandTotal, i.GrandTotal AS AmtInWords, + i.M_PriceList_ID, i.IsPaid, + p.IsAllocated, p.TenderType, p.DiscountAmt +FROM C_DunningRunLine drl + LEFT OUTER JOIN C_Invoice i ON (drl.C_Invoice_ID=i.C_Invoice_ID) + LEFT OUTER JOIN C_DocType_Trl dt ON (i.C_DocType_ID=dt.C_DocType_ID) + LEFT OUTER JOIN C_PaymentTerm_Trl pt ON (i.C_PaymentTerm_ID=pt.C_PaymentTerm_ID + AND pt.AD_Language=dt.AD_Language) + LEFT OUTER JOIN C_Payment p ON (drl.C_Payment_ID=p.C_Payment_ID) + LEFT OUTER JOIN C_DocType_Trl dtp ON (p.C_DocType_ID=dtp.C_DocType_ID) +WHERE COALESCE(dt.AD_Language,dtp.AD_Language)=COALESCE(dtp.AD_Language,dt.AD_Language); + + + diff --git a/db/ddlutils/postgresql/views/C_INVOICELINE_V.sql b/db/ddlutils/postgresql/views/C_INVOICELINE_V.sql new file mode 100644 index 0000000000..926cd2cdf5 --- /dev/null +++ b/db/ddlutils/postgresql/views/C_INVOICELINE_V.sql @@ -0,0 +1,28 @@ +CREATE OR REPLACE VIEW C_INVOICELINE_V +(AD_CLIENT_ID, AD_ORG_ID, C_INVOICELINE_ID, C_INVOICE_ID, SALESREP_ID, + C_BPARTNER_ID, M_PRODUCT_ID, DOCUMENTNO, DATEINVOICED, DATEACCT, + ISSOTRX, DOCSTATUS, LINENETAMT, LINELISTAMT, LINELIMITAMT, + LINEDISCOUNTAMT, LINEOVERLIMITAMT, QTYINVOICED, QTYENTERED, LINE, + C_ORDERLINE_ID, C_UOM_ID, C_CAMPAIGN_ID, C_PROJECT_ID, C_ACTIVITY_ID, + C_PROJECTPHASE_ID, C_PROJECTTASK_ID) +AS +SELECT il.AD_Client_ID, il.AD_Org_ID, + il.C_InvoiceLine_ID, i.C_Invoice_ID, i.SalesRep_ID, + i.C_BPartner_ID, il.M_Product_ID, + i.DocumentNo, i.DateInvoiced, i.DateAcct, + i.IsSOTrx, i.DocStatus, + ROUND(i.Multiplier*LineNetAmt, 2) AS LineNetAmt, + ROUND(i.Multiplier*PriceList*QtyInvoiced, 2) AS LineListAmt, + CASE WHEN COALESCE(il.PriceLimit, 0)=0 THEN ROUND(i.Multiplier*LineNetAmt,2) ELSE ROUND(i.Multiplier*PriceLimit*QtyInvoiced,2) END AS LineLimitAmt, + ROUND(i.Multiplier*PriceList*QtyInvoiced-LineNetAmt,2) AS LineDiscountAmt, + CASE WHEN COALESCE(il.PriceLimit,0)=0 THEN 0 ELSE ROUND(i.Multiplier*LineNetAmt-PriceLimit*QtyInvoiced,2) END AS LineOverLimitAmt, + il.QtyInvoiced, il.QtyEntered, + il.Line, il.C_OrderLine_ID, il.C_UOM_ID, + il.C_Campaign_ID, il.C_Project_ID, il.C_Activity_ID, il.C_ProjectPhase_ID, il.C_ProjectTask_ID +FROM C_Invoice_v i, C_InvoiceLine il +WHERE i.C_Invoice_ID=il.C_Invoice_ID; + +--COMMENT ON TABLE C_INVOICELINE_V IS 'Invoice Line Summary for Reporting Views - Corrected for Credit Memos'; + + + diff --git a/db/ddlutils/postgresql/views/C_INVOICE_CANDIDATE_V.sql b/db/ddlutils/postgresql/views/C_INVOICE_CANDIDATE_V.sql new file mode 100644 index 0000000000..d78996cad4 --- /dev/null +++ b/db/ddlutils/postgresql/views/C_INVOICE_CANDIDATE_V.sql @@ -0,0 +1,54 @@ +CREATE OR REPLACE VIEW C_INVOICE_CANDIDATE_V +(AD_CLIENT_ID, AD_ORG_ID, C_BPARTNER_ID, C_ORDER_ID, DOCUMENTNO, + DATEORDERED, C_DOCTYPE_ID, TOTALLINES) +AS +SELECT + o.AD_Client_ID, o.AD_Org_ID, o.C_BPartner_ID, o.C_Order_ID, + o.DocumentNo, o.DateOrdered, o.C_DocType_ID, + SUM((l.QtyOrdered-l.QtyInvoiced)*l.PriceActual) AS TotalLines +FROM C_Order o + INNER JOIN C_OrderLine l ON (o.C_Order_ID=l.C_Order_ID) + INNER JOIN C_BPartner bp ON (o.C_BPartner_ID=bp.C_BPartner_ID) + LEFT OUTER JOIN C_InvoiceSchedule si ON (bp.C_InvoiceSchedule_ID=si.C_InvoiceSchedule_ID) +WHERE o.DocStatus IN ('CO','CL','IP') -- Standard Orders are IP + -- not Offers and open Walkin-Receipts + AND o.C_DocType_ID IN (SELECT C_DocType_ID FROM C_DocType + WHERE DocBaseType='SOO' AND DocSubTypeSO NOT IN ('ON','OB','WR')) + -- we need to invoice + AND l.QtyOrdered <> l.QtyInvoiced + -- + AND ( + -- Immediate + o.InvoiceRule='I' + -- Order compete ** not supported ** + OR o.InvoiceRule='O' + -- Delivery + OR (o.InvoiceRule='D' AND l.QtyInvoiced<>l.QtyDelivered) + -- Order Schedule, but none defined on Business Partner level + OR (o.InvoiceRule='S' AND bp.C_InvoiceSchedule_ID IS NULL) + -- Schedule defined at BP + OR (o.InvoiceRule='S' AND bp.C_InvoiceSchedule_ID IS NOT NULL AND + ( + -- Daily or none + (si.InvoiceFrequency IS NULL OR si.InvoiceFrequency='D') + -- Weekly + OR (si.InvoiceFrequency='W') + -- Bi-Monthly + OR (si.InvoiceFrequency='T' + AND ((TRUNC(o.DateOrdered) <= firstOf(getdate(),'MM')+si.InvoiceDayCutoff-1 + AND TRUNC(getdate()) >= firstOf(o.DateOrdered,'MM')+si.InvoiceDay-1) + OR (TRUNC(o.DateOrdered) <= firstOf(getdate(),'MM')+si.InvoiceDayCutoff+14 + AND TRUNC(getdate()) >= firstOf(o.DateOrdered,'MM')+si.InvoiceDay+14)) + ) + -- Monthly + OR (si.InvoiceFrequency='M' + AND TRUNC(o.DateOrdered) <= firstOf(getdate(),'MM')+si.InvoiceDayCutoff-1 -- after cutoff + AND TRUNC(getdate()) >= firstOf(o.DateOrdered,'MM')+si.InvoiceDay-1) -- after invoice day + ) + ) + ) +GROUP BY o.AD_Client_ID, o.AD_Org_ID, o.C_BPartner_ID, o.C_Order_ID, + o.DocumentNo, o.DateOrdered, o.C_DocType_ID; + + + diff --git a/db/ddlutils/postgresql/views/C_INVOICE_HEADER_V.sql b/db/ddlutils/postgresql/views/C_INVOICE_HEADER_V.sql new file mode 100644 index 0000000000..4abf5e9b6b --- /dev/null +++ b/db/ddlutils/postgresql/views/C_INVOICE_HEADER_V.sql @@ -0,0 +1,56 @@ +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); + + + diff --git a/db/ddlutils/postgresql/views/C_INVOICE_HEADER_VT.sql b/db/ddlutils/postgresql/views/C_INVOICE_HEADER_VT.sql new file mode 100644 index 0000000000..8ebbd047a0 --- /dev/null +++ b/db/ddlutils/postgresql/views/C_INVOICE_HEADER_VT.sql @@ -0,0 +1,56 @@ +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); + + + diff --git a/db/ddlutils/postgresql/views/C_INVOICE_LINETAX_V.sql b/db/ddlutils/postgresql/views/C_INVOICE_LINETAX_V.sql new file mode 100644 index 0000000000..39ee90ec30 --- /dev/null +++ b/db/ddlutils/postgresql/views/C_INVOICE_LINETAX_V.sql @@ -0,0 +1,114 @@ +CREATE OR REPLACE VIEW C_INVOICE_LINETAX_V +(AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, + UPDATED, UPDATEDBY, AD_LANGUAGE, C_INVOICE_ID, C_INVOICELINE_ID, + C_TAX_ID, TAXAMT, LINETOTALAMT, TAXINDICATOR, LINE, + M_PRODUCT_ID, QTYINVOICED, QTYENTERED, UOMSYMBOL, NAME, + DESCRIPTION, DOCUMENTNOTE, UPC, SKU, PRODUCTVALUE, + RESOURCEDESCRIPTION, PRICELIST, PRICEENTEREDLIST, DISCOUNT, PRICEACTUAL, + PRICEENTERED, LINENETAMT, M_ATTRIBUTESETINSTANCE_ID, M_ATTRIBUTESET_ID, SERNO, + LOT, M_LOT_ID, GUARANTEEDATE, PRODUCTDESCRIPTION, IMAGEURL, + C_CAMPAIGN_ID, C_PROJECT_ID, C_ACTIVITY_ID, C_PROJECTPHASE_ID, C_PROJECTTASK_ID) +AS +SELECT il.AD_Client_ID, il.AD_Org_ID, il.IsActive, il.Created, il.CreatedBy, il.Updated, il.UpdatedBy, + 'en_US' AS AD_Language, + il.C_Invoice_ID, il.C_InvoiceLine_ID, + il.C_Tax_ID, il.TaxAmt, il.LineTotalAmt, t.TaxIndicator, + il.Line, p.M_Product_ID, + CASE WHEN il.QtyInvoiced<>0 OR il.M_Product_ID IS NOT NULL THEN il.QtyInvoiced END AS QtyInvoiced, + CASE WHEN il.QtyEntered<>0 OR il.M_Product_ID IS NOT NULL THEN il.QtyEntered END AS QtyEntered, + CASE WHEN il.QtyEntered<>0 OR il.M_Product_ID IS NOT NULL THEN uom.UOMSymbol END AS UOMSymbol, + COALESCE(c.Name,p.Name||productAttribute(il.M_AttributeSetInstance_ID), il.Description) AS Name, -- main line + CASE WHEN COALESCE(c.Name,p.Name) IS NOT NULL THEN il.Description END AS Description, -- second line + p.DocumentNote, -- third line + p.UPC, p.SKU, COALESCE(pp.VendorProductNo,p.Value) AS ProductValue, + ra.Description AS ResourceDescription, -- forth line + CASE WHEN i.IsDiscountPrinted='Y' AND il.PriceList<>0 + THEN il.PriceList END AS PriceList, + CASE WHEN i.IsDiscountPrinted='Y' AND il.PriceList<>0 AND il.QtyEntered<>0 + THEN il.PriceList*il.QtyInvoiced/il.QtyEntered END AS PriceEnteredList, + CASE WHEN i.IsDiscountPrinted='Y' AND il.PriceList>il.PriceActual AND il.PriceList<>0 + THEN (il.PriceList-il.PriceActual)/il.PriceList*100 END AS Discount, + CASE WHEN il.PriceActual<>0 OR il.M_Product_ID IS NOT NULL THEN il.PriceActual END AS PriceActual, + CASE WHEN il.PriceEntered<>0 OR il.M_Product_ID IS NOT NULL THEN il.PriceEntered END AS PriceEntered, + CASE WHEN il.LineNetAmt<>0 OR il.M_Product_ID IS NOT NULL THEN il.LineNetAmt END AS LineNetAmt, + il.M_AttributeSetInstance_ID, asi.M_AttributeSet_ID, + asi.SerNo, asi.Lot, asi.M_Lot_ID,asi.GuaranteeDate, + p.Description as ProductDescription, p.ImageURL, + il.C_Campaign_ID, il.C_Project_ID, il.C_Activity_ID, il.C_ProjectPhase_ID, il.C_ProjectTask_ID +FROM C_InvoiceLine il + INNER JOIN C_UOM uom ON (il.C_UOM_ID=uom.C_UOM_ID) + INNER JOIN C_Invoice i ON (il.C_Invoice_ID=i.C_Invoice_ID) + LEFT OUTER JOIN C_Tax t ON (il.C_Tax_ID=t.C_Tax_ID) + LEFT OUTER JOIN M_Product p ON (il.M_Product_ID=p.M_Product_ID) + LEFT OUTER JOIN C_Charge c ON (il.C_Charge_ID=c.C_Charge_ID) + LEFT OUTER JOIN C_BPartner_Product pp ON (il.M_Product_ID=pp.M_Product_ID AND i.C_BPartner_ID=pp.C_BPartner_ID) + LEFT OUTER JOIN S_ResourceAssignment ra ON (il.S_ResourceAssignment_ID=ra.S_ResourceAssignment_ID) + LEFT OUTER JOIN M_AttributeSetInstance asi ON (il.M_AttributeSetInstance_ID=asi.M_AttributeSetInstance_ID) +UNION -- bom lines +SELECT il.AD_Client_ID, il.AD_Org_ID, il.IsActive, il.Created, il.CreatedBy, il.Updated, il.UpdatedBy, + 'en_US' AS AD_Language, + il.C_Invoice_ID, il.C_InvoiceLine_ID, + il.C_Tax_ID, il.TaxAmt, il.LineTotalAmt, t.TaxIndicator, + il.Line+(b.Line/100) AS Line, p.M_Product_ID, + il.QtyInvoiced*b.BOMQty AS QtyInvoiced, + il.QtyEntered*b.BOMQty AS QtyEntered, + uom.UOMSymbol, + p.Name, -- main + b.Description, + p.DocumentNote, p.UPC, p.SKU, p.Value AS ProductValue, + null, null, null, null, null, null, null, + il.M_AttributeSetInstance_ID, asi.M_AttributeSet_ID, asi.SerNo, asi.Lot, asi.M_Lot_ID,asi.GuaranteeDate, + p.Description as ProductDescription, p.ImageURL, + il.C_Campaign_ID, il.C_Project_ID, il.C_Activity_ID, il.C_ProjectPhase_ID, il.C_ProjectTask_ID +FROM M_Product_BOM b -- BOM lines + INNER JOIN C_InvoiceLine il ON (b.M_Product_ID=il.M_Product_ID) + INNER JOIN M_Product bp ON (bp.M_Product_ID=il.M_Product_ID -- BOM Product + AND bp.IsBOM='Y' AND bp.IsVerified='Y' AND bp.IsInvoicePrintDetails='Y') + INNER JOIN M_Product p ON (b.M_ProductBOM_ID=p.M_Product_ID) -- BOM line product + INNER JOIN C_UOM uom ON (p.C_UOM_ID=uom.C_UOM_ID) + LEFT OUTER JOIN C_Tax t ON (il.C_Tax_ID=t.C_Tax_ID) + LEFT OUTER JOIN M_AttributeSetInstance asi ON (il.M_AttributeSetInstance_ID=asi.M_AttributeSetInstance_ID) +UNION -- comment lines +SELECT il.AD_Client_ID, il.AD_Org_ID, il.IsActive, il.Created, il.CreatedBy, il.Updated, il.UpdatedBy, + 'en_US', il.C_Invoice_ID, il.C_InvoiceLine_ID, + null, null, null, null, + il.Line, null, + null, null, null, + il.Description, + null, null, null, null, null, null, + null, null, null, null, null, null, + null, null, null, null, null, null, null, null, + null, null, null, null, null +FROM C_InvoiceLine il +WHERE il.C_UOM_ID IS NULL +UNION -- empty line +SELECT AD_Client_ID, AD_Org_ID, IsActive, Created, CreatedBy, Updated, UpdatedBy, + 'en_US', C_Invoice_ID, null, + null, null, null, null, + 9998, null, + null, null, null, + null, + null, null, null, null, null, null, + null, null, null, null, null, null, + null, null, null, null, null, null, null, null, + null, null, null, null, null +FROM C_Invoice +UNION -- tax lines +SELECT it.AD_Client_ID, it.AD_Org_ID, it.IsActive, it.Created, it.CreatedBy, it.Updated, it.UpdatedBy, + 'en_US', it.C_Invoice_ID, null, + it.C_Tax_ID, null, null, t.TaxIndicator, + 9999, null, + null, null, null, + t.Name, + null, null, null, null, null, null, + null, null, null, + CASE WHEN it.IsTaxIncluded='Y' THEN it.TaxAmt ELSE it.TaxBaseAmt END, + CASE WHEN it.IsTaxIncluded='Y' THEN it.TaxAmt ELSE it.TaxBaseAmt END, + CASE WHEN it.IsTaxIncluded='Y' THEN NULL ELSE it.TaxAmt END, + null, null, null, null, null, null, null, null, + null, null, null, null, null +FROM C_InvoiceTax it + INNER JOIN C_Tax t ON (it.C_Tax_ID=t.C_Tax_ID); + + + diff --git a/db/ddlutils/postgresql/views/C_INVOICE_LINETAX_VT.sql b/db/ddlutils/postgresql/views/C_INVOICE_LINETAX_VT.sql new file mode 100644 index 0000000000..84790d1450 --- /dev/null +++ b/db/ddlutils/postgresql/views/C_INVOICE_LINETAX_VT.sql @@ -0,0 +1,117 @@ +CREATE OR REPLACE VIEW C_INVOICE_LINETAX_VT +(AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, + UPDATED, UPDATEDBY, AD_LANGUAGE, C_INVOICE_ID, C_INVOICELINE_ID, + C_TAX_ID, TAXAMT, LINETOTALAMT, TAXINDICATOR, LINE, + M_PRODUCT_ID, QTYINVOICED, QTYENTERED, UOMSYMBOL, NAME, + DESCRIPTION, DOCUMENTNOTE, UPC, SKU, PRODUCTVALUE, + RESOURCEDESCRIPTION, PRICELIST, PRICEENTEREDLIST, DISCOUNT, PRICEACTUAL, + PRICEENTERED, LINENETAMT, M_ATTRIBUTESETINSTANCE_ID, M_ATTRIBUTESET_ID, SERNO, + LOT, M_LOT_ID, GUARANTEEDATE, PRODUCTDESCRIPTION, IMAGEURL, + C_CAMPAIGN_ID, C_PROJECT_ID, C_ACTIVITY_ID, C_PROJECTPHASE_ID, C_PROJECTTASK_ID) +AS +SELECT il.AD_Client_ID, il.AD_Org_ID, il.IsActive, il.Created, il.CreatedBy, il.Updated, il.UpdatedBy, + uom.AD_Language, + il.C_Invoice_ID, il.C_InvoiceLine_ID, + il.C_Tax_ID, il.TaxAmt, il.LineTotalAmt, t.TaxIndicator, + il.Line, p.M_Product_ID, + CASE WHEN il.QtyInvoiced<>0 OR il.M_Product_ID IS NOT NULL THEN il.QtyInvoiced END AS QtyInvoiced, + CASE WHEN il.QtyEntered<>0 OR il.M_Product_ID IS NOT NULL THEN il.QtyEntered END AS QtyEntered, + CASE WHEN il.QtyEntered<>0 OR il.M_Product_ID IS NOT NULL THEN uom.UOMSymbol END AS UOMSymbol, + COALESCE(c.Name,COALESCE(pt.Name,p.Name)||productAttribute(il.M_AttributeSetInstance_ID), il.Description) AS Name, -- main line + CASE WHEN COALESCE(c.Name,pt.Name,p.Name) IS NOT NULL THEN il.Description END AS Description, -- second line + COALESCE(pt.DocumentNote,p.DocumentNote) AS DocumentNote, -- third line + p.UPC, p.SKU, COALESCE(pp.VendorProductNo,p.Value) AS ProductValue, + ra.Description AS ResourceDescription, -- forth line + CASE WHEN i.IsDiscountPrinted='Y' AND il.PriceList<>0 + THEN il.PriceList END AS PriceList, + CASE WHEN i.IsDiscountPrinted='Y' AND il.PriceList<>0 AND il.QtyEntered<>0 + THEN il.PriceList*il.QtyInvoiced/il.QtyEntered END AS PriceEnteredList, + CASE WHEN i.IsDiscountPrinted='Y' AND il.PriceList>il.PriceActual AND il.PriceList<>0 + THEN (il.PriceList-il.PriceActual)/il.PriceList*100 END AS Discount, + CASE WHEN il.PriceActual<>0 OR il.M_Product_ID IS NOT NULL THEN il.PriceActual END AS PriceActual, + CASE WHEN il.PriceEntered<>0 OR il.M_Product_ID IS NOT NULL THEN il.PriceEntered END AS PriceEntered, + CASE WHEN il.LineNetAmt<>0 OR il.M_Product_ID IS NOT NULL THEN il.LineNetAmt END AS LineNetAmt, + il.M_AttributeSetInstance_ID, asi.M_AttributeSet_ID, asi.SerNo, asi.Lot, asi.M_Lot_ID,asi.GuaranteeDate, + pt.Description as ProductDescription, p.ImageURL, + il.C_Campaign_ID, il.C_Project_ID, il.C_Activity_ID, il.C_ProjectPhase_ID, il.C_ProjectTask_ID +FROM C_InvoiceLine il + INNER JOIN C_UOM_Trl uom ON (il.C_UOM_ID=uom.C_UOM_ID) + INNER JOIN C_Invoice i ON (il.C_Invoice_ID=i.C_Invoice_ID) + LEFT OUTER JOIN C_Tax_Trl t ON (il.C_Tax_ID=t.C_Tax_ID AND uom.AD_Language=t.AD_Language) + LEFT OUTER JOIN M_Product p ON (il.M_Product_ID=p.M_Product_ID) + LEFT OUTER JOIN C_Charge c ON (il.C_Charge_ID=c.C_Charge_ID) + LEFT OUTER JOIN C_BPartner_Product pp ON (il.M_Product_ID=pp.M_Product_ID AND i.C_BPartner_ID=pp.C_BPartner_ID) + LEFT OUTER JOIN M_Product_Trl pt ON (il.M_Product_ID=pt.M_Product_ID AND uom.AD_Language=pt.AD_Language) + LEFT OUTER JOIN S_ResourceAssignment ra ON (il.S_ResourceAssignment_ID=ra.S_ResourceAssignment_ID) + LEFT OUTER JOIN M_AttributeSetInstance asi ON (il.M_AttributeSetInstance_ID=asi.M_AttributeSetInstance_ID) +UNION -- bom lines +SELECT il.AD_Client_ID, il.AD_Org_ID, il.IsActive, il.Created, il.CreatedBy, il.Updated, il.UpdatedBy, + uom.AD_Language, + il.C_Invoice_ID, il.C_InvoiceLine_ID, + il.C_Tax_ID, il.TaxAmt, il.LineTotalAmt, t.TaxIndicator, + il.Line+(b.Line/100) AS Line, p.M_Product_ID, + il.QtyInvoiced*b.BOMQty AS QtyInvoiced, + il.QtyEntered*b.BOMQty AS QtyEntered, + uom.UOMSymbol, + COALESCE(pt.Name,p.Name) AS Name, -- main + b.Description, + COALESCE(pt.DocumentNote,p.DocumentNote) AS DocumentNote, p.UPC, p.SKU, p.Value AS ProductValue, + null, null, null, null, null, null, null, + il.M_AttributeSetInstance_ID, asi.M_AttributeSet_ID, asi.SerNo, asi.Lot, asi.M_Lot_ID,asi.GuaranteeDate, + pt.Description as ProductDescription, p.ImageURL, + il.C_Campaign_ID, il.C_Project_ID, il.C_Activity_ID, il.C_ProjectPhase_ID, il.C_ProjectTask_ID +FROM M_Product_BOM b -- BOM lines + INNER JOIN C_InvoiceLine il ON (b.M_Product_ID=il.M_Product_ID) + INNER JOIN M_Product bp ON (bp.M_Product_ID=il.M_Product_ID -- BOM Product + AND bp.IsBOM='Y' AND bp.IsVerified='Y' AND bp.IsInvoicePrintDetails='Y') + INNER JOIN M_Product p ON (b.M_ProductBOM_ID=p.M_Product_ID) -- BOM line product + INNER JOIN C_UOM_Trl uom ON (p.C_UOM_ID=uom.C_UOM_ID) + INNER JOIN M_Product_Trl pt ON (b.M_ProductBOM_ID=pt.M_Product_ID AND uom.AD_Language=pt.AD_Language) + LEFT OUTER JOIN C_Tax t ON (il.C_Tax_ID=t.C_Tax_ID) + LEFT OUTER JOIN M_AttributeSetInstance asi ON (il.M_AttributeSetInstance_ID=asi.M_AttributeSetInstance_ID) +UNION -- comment line +SELECT il.AD_Client_ID, il.AD_Org_ID, il.IsActive, il.Created, il.CreatedBy, il.Updated, il.UpdatedBy, + l.AD_Language, il.C_Invoice_ID, il.C_InvoiceLine_ID, + null, null, null, null, + il.Line, null, + null, null, null, + il.Description, + null, null, null, null, null, null, + null, null, null, null, null, null, + null, null, null, null, null, null, null, null, + null,null,null,null,null +FROM C_InvoiceLine il, AD_Language l +WHERE il.C_UOM_ID IS NULL + AND l.IsBaseLanguage='N' AND l.IsSystemLanguage='Y' +UNION -- empty line +SELECT i.AD_Client_ID, i.AD_Org_ID, i.IsActive, i.Created, i.CreatedBy, i.Updated, i.UpdatedBy, + AD_Language, i.C_Invoice_ID, null, + null, null, null, null, + 9998, null, + null, null, null, + null, + null, null, null, null, null, null, + null, null, null, null, null, null, + null, null, null, null, null, null, null, null, + null,null,null,null,null +FROM C_Invoice i, AD_Language l +WHERE l.IsBaseLanguage='N' AND l.IsSystemLanguage='Y' +UNION -- tax lines +SELECT it.AD_Client_ID, it.AD_Org_ID, it.IsActive, it.Created, it.CreatedBy, it.Updated, it.UpdatedBy, + t.AD_Language, it.C_Invoice_ID, null, + it.C_Tax_ID, null, null, t.TaxIndicator, + 9999, null, + null, null, null, + t.Name, + null, null, null, null, null, null, + null, null, null, + CASE WHEN it.IsTaxIncluded='Y' THEN it.TaxAmt ELSE it.TaxBaseAmt END, + CASE WHEN it.IsTaxIncluded='Y' THEN it.TaxAmt ELSE it.TaxBaseAmt END, + CASE WHEN it.IsTaxIncluded='Y' THEN NULL ELSE it.TaxAmt END, + null, null, null, null, null, null, null, null, + null,null,null,null,null +FROM C_InvoiceTax it + INNER JOIN C_Tax_Trl t ON (it.C_Tax_ID=t.C_Tax_ID); + + + diff --git a/db/ddlutils/views/C_INVOICE_V.sql b/db/ddlutils/postgresql/views/C_INVOICE_V.sql similarity index 100% rename from db/ddlutils/views/C_INVOICE_V.sql rename to db/ddlutils/postgresql/views/C_INVOICE_V.sql diff --git a/db/ddlutils/views/C_INVOICE_V1.sql b/db/ddlutils/postgresql/views/C_INVOICE_V1.sql similarity index 100% rename from db/ddlutils/views/C_INVOICE_V1.sql rename to db/ddlutils/postgresql/views/C_INVOICE_V1.sql diff --git a/db/ddlutils/postgresql/views/C_ORDER_HEADER_V.sql b/db/ddlutils/postgresql/views/C_ORDER_HEADER_V.sql new file mode 100644 index 0000000000..e81ccaf45d --- /dev/null +++ b/db/ddlutils/postgresql/views/C_ORDER_HEADER_V.sql @@ -0,0 +1,70 @@ +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); + + + diff --git a/db/ddlutils/postgresql/views/C_ORDER_HEADER_VT.sql b/db/ddlutils/postgresql/views/C_ORDER_HEADER_VT.sql new file mode 100644 index 0000000000..b4c1fa7ebc --- /dev/null +++ b/db/ddlutils/postgresql/views/C_ORDER_HEADER_VT.sql @@ -0,0 +1,70 @@ +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); + + + diff --git a/db/ddlutils/postgresql/views/C_ORDER_LINETAX_V.sql b/db/ddlutils/postgresql/views/C_ORDER_LINETAX_V.sql new file mode 100644 index 0000000000..2dbe7f8464 --- /dev/null +++ b/db/ddlutils/postgresql/views/C_ORDER_LINETAX_V.sql @@ -0,0 +1,93 @@ +CREATE OR REPLACE VIEW C_ORDER_LINETAX_V +(AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, + UPDATED, UPDATEDBY, AD_LANGUAGE, C_ORDER_ID, C_ORDERLINE_ID, + C_TAX_ID, TAXINDICATOR, C_BPARTNER_ID, C_BPARTNER_LOCATION_ID, BPNAME, + C_LOCATION_ID, LINE, M_PRODUCT_ID, QTYORDERED, QTYENTERED, + UOMSYMBOL, NAME, DESCRIPTION, DOCUMENTNOTE, UPC, + SKU, PRODUCTVALUE, RESOURCEDESCRIPTION, PRICELIST, PRICEENTEREDLIST, + DISCOUNT, PRICEACTUAL, PRICEENTERED, LINENETAMT, PRODUCTDESCRIPTION, + IMAGEURL, C_CAMPAIGN_ID, C_PROJECT_ID, C_ACTIVITY_ID, C_PROJECTPHASE_ID, + C_PROJECTTASK_ID) +AS +SELECT ol.AD_Client_ID, ol.AD_Org_ID, ol.IsActive, ol.Created, ol.CreatedBy, ol.Updated, ol.UpdatedBy, + 'en_US' AS AD_Language, + ol.C_Order_ID, ol.C_OrderLine_ID, ol.C_Tax_ID, t.TaxIndicator, + ol.C_BPartner_ID, ol.C_BPartner_Location_ID, bp.Name AS BPName, bpl.C_Location_ID, + ol.Line, p.M_Product_ID, + CASE WHEN ol.QtyOrdered<>0 OR ol.M_Product_ID IS NOT NULL THEN ol.QtyOrdered END AS QtyOrdered, + CASE WHEN ol.QtyEntered<>0 OR ol.M_Product_ID IS NOT NULL THEN ol.QtyEntered END AS QtyEntered, + CASE WHEN ol.QtyEntered<>0 OR ol.M_Product_ID IS NOT NULL THEN uom.UOMSymbol END AS UOMSymbol, + COALESCE(c.Name,p.Name||productAttribute(ol.M_AttributeSetInstance_ID), ol.Description) AS Name, -- main line + CASE WHEN COALESCE(c.Name,p.Name) IS NOT NULL THEN ol.Description END AS Description, -- second line + p.DocumentNote, -- third line + p.UPC, p.SKU, COALESCE(pp.VendorProductNo,p.Value) AS ProductValue, + ra.Description AS ResourceDescription, -- forth line + CASE WHEN i.IsDiscountPrinted='Y' AND ol.PriceList<>0 + THEN ol.PriceList END AS PriceList, + CASE WHEN i.IsDiscountPrinted='Y' AND ol.PriceList<>0 AND ol.QtyEntered<>0 + THEN ol.PriceList*ol.QtyOrdered/ol.QtyEntered END AS PriceEnteredList, + CASE WHEN i.IsDiscountPrinted='Y' AND ol.PriceList>ol.PriceActual AND ol.PriceList<>0 + THEN (ol.PriceList-ol.PriceActual)/ol.PriceList*100 END AS Discount, + CASE WHEN ol.PriceActual<>0 OR ol.M_Product_ID IS NOT NULL THEN ol.PriceActual END AS PriceActual, + CASE WHEN ol.PriceEntered<>0 OR ol.M_Product_ID IS NOT NULL THEN ol.PriceEntered END AS PriceEntered, + CASE WHEN ol.LineNetAmt<>0 OR ol.M_Product_ID IS NOT NULL THEN ol.LineNetAmt END AS LineNetAmt, + p.Description as ProductDescription, p.ImageURL, + ol.C_Campaign_ID, ol.C_Project_ID, ol.C_Activity_ID, ol.C_ProjectPhase_ID, ol.C_ProjectTask_ID +FROM C_OrderLine ol + INNER JOIN C_UOM uom ON (ol.C_UOM_ID=uom.C_UOM_ID) + INNER JOIN C_Order i ON (ol.C_Order_ID=i.C_Order_ID) + LEFT OUTER JOIN M_Product p ON (ol.M_Product_ID=p.M_Product_ID) + LEFT OUTER JOIN S_ResourceAssignment ra ON (ol.S_ResourceAssignment_ID=ra.S_ResourceAssignment_ID) + LEFT OUTER JOIN C_Charge c ON (ol.C_Charge_ID=c.C_Charge_ID) + LEFT OUTER JOIN C_BPartner_Product pp ON (ol.M_Product_ID=pp.M_Product_ID AND i.C_BPartner_ID=pp.C_BPartner_ID) + INNER JOIN C_BPartner bp ON (ol.C_BPartner_ID=bp.C_BPartner_ID) + INNER JOIN C_BPartner_Location bpl ON (ol.C_BPartner_Location_ID=bpl.C_BPartner_Location_ID) + LEFT OUTER JOIN C_Tax t ON (ol.C_Tax_ID=t.C_Tax_ID) +UNION +SELECT ol.AD_Client_ID, ol.AD_Org_ID, ol.IsActive, ol.Created, ol.CreatedBy, ol.Updated, ol.UpdatedBy, + 'en_US' AS AD_Language, + ol.C_Order_ID, ol.C_OrderLine_ID, ol.C_Tax_ID, null, + null, null, null, null, + ol.Line+(b.Line/100) AS Line, p.M_Product_ID, + ol.QtyOrdered*b.BOMQty AS QtyInvoiced, ol.QtyEntered*b.BOMQty AS QtyEntered, uom.UOMSymbol, + p.Name, -- main + b.Description, + p.DocumentNote, p.UPC, p.SKU, p.Value AS ProductValue, + null, null, null, null, null, null, null, p.Description as ProductDescription, p.ImageURL, + ol.C_Campaign_ID, ol.C_Project_ID, ol.C_Activity_ID, ol.C_ProjectPhase_ID, ol.C_ProjectTask_ID +FROM M_Product_BOM b -- BOM lines + INNER JOIN C_OrderLine ol ON (b.M_Product_ID=ol.M_Product_ID) + INNER JOIN M_Product bp ON (bp.M_Product_ID=ol.M_Product_ID -- BOM Product + AND bp.IsBOM='Y' AND bp.IsVerified='Y' AND bp.IsInvoicePrintDetails='Y') + INNER JOIN M_Product p ON (b.M_ProductBOM_ID=p.M_Product_ID) -- BOM line product + INNER JOIN C_UOM uom ON (p.C_UOM_ID=uom.C_UOM_ID) +UNION +SELECT AD_Client_ID, AD_Org_ID, IsActive, Created, CreatedBy, Updated, UpdatedBy, + 'en_US', C_Order_ID, null, null, null, + null, + null, null, null, + null, null, null, null, + null, null, + null, null, null, null, null, null, + null, null, null, null, null, null, null, null, + null,null,null,null,null +FROM C_Order +UNION +SELECT ot.AD_Client_ID, ot.AD_Org_ID, ot.IsActive, ot.Created, ot.CreatedBy, ot.Updated, ot.UpdatedBy, + 'en_US', ot.C_Order_ID, null, ot.C_Tax_ID, t.TaxIndicator, + null, null, null, null, + null, null, + null, null, null, + t.Name, + null, null, null, null, null, null, + null, null, null, + CASE WHEN ot.IsTaxIncluded='Y' THEN ot.TaxAmt ELSE ot.TaxBaseAmt END, + CASE WHEN ot.IsTaxIncluded='Y' THEN ot.TaxAmt ELSE ot.TaxBaseAmt END, + CASE WHEN ot.IsTaxIncluded='Y' THEN NULL ELSE ot.TaxAmt END, + null, null, + null,null,null,null,null +FROM C_OrderTax ot + INNER JOIN C_Tax t ON (ot.C_Tax_ID=t.C_Tax_ID); + + + diff --git a/db/ddlutils/postgresql/views/C_ORDER_LINETAX_VT.sql b/db/ddlutils/postgresql/views/C_ORDER_LINETAX_VT.sql new file mode 100644 index 0000000000..2d3a781c33 --- /dev/null +++ b/db/ddlutils/postgresql/views/C_ORDER_LINETAX_VT.sql @@ -0,0 +1,96 @@ +CREATE OR REPLACE VIEW C_ORDER_LINETAX_VT +(AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, + UPDATED, UPDATEDBY, AD_LANGUAGE, C_ORDER_ID, C_ORDERLINE_ID, + C_TAX_ID, TAXINDICATOR, C_BPARTNER_ID, C_BPARTNER_LOCATION_ID, BPNAME, + C_LOCATION_ID, LINE, M_PRODUCT_ID, QTYORDERED, QTYENTERED, + UOMSYMBOL, NAME, DESCRIPTION, DOCUMENTNOTE, UPC, + SKU, PRODUCTVALUE, RESOURCEDESCRIPTION, PRICELIST, PRICEENTEREDLIST, + DISCOUNT, PRICEACTUAL, PRICEENTERED, LINENETAMT, PRODUCTDESCRIPTION, + IMAGEURL, C_CAMPAIGN_ID, C_PROJECT_ID, C_ACTIVITY_ID, C_PROJECTPHASE_ID, + C_PROJECTTASK_ID) +AS +SELECT ol.AD_Client_ID, ol.AD_Org_ID, ol.IsActive, ol.Created, ol.CreatedBy, ol.Updated, ol.UpdatedBy, + uom.AD_Language, + ol.C_Order_ID, ol.C_OrderLine_ID, ol.C_Tax_ID, t.TaxIndicator, + ol.C_BPartner_ID, ol.C_BPartner_Location_ID, bp.Name AS BPName, bpl.C_Location_ID, + ol.Line, p.M_Product_ID, + CASE WHEN ol.QtyOrdered<>0 OR ol.M_Product_ID IS NOT NULL THEN ol.QtyOrdered END AS QtyOrdered, + CASE WHEN ol.QtyEntered<>0 OR ol.M_Product_ID IS NOT NULL THEN ol.QtyEntered END AS QtyEntered, + CASE WHEN ol.QtyEntered<>0 OR ol.M_Product_ID IS NOT NULL THEN uom.UOMSymbol END AS UOMSymbol, + COALESCE(c.Name,p.Name||productAttribute(ol.M_AttributeSetInstance_ID), ol.Description) AS Name, -- main line + CASE WHEN COALESCE(c.Name,pt.Name, p.Name) IS NOT NULL THEN ol.Description END AS Description, -- second line + COALESCE(pt.DocumentNote, p.DocumentNote) AS DocumentNote, -- third line + p.UPC, p.SKU, COALESCE(pp.VendorProductNo,p.Value) AS ProductValue, + ra.Description AS ResourceDescription, -- forth line + CASE WHEN i.IsDiscountPrinted='Y' AND ol.PriceList<>0 + THEN ol.PriceList END AS PriceList, + CASE WHEN i.IsDiscountPrinted='Y' AND ol.PriceList<>0 AND ol.QtyEntered<>0 + THEN ol.PriceList*ol.QtyOrdered/ol.QtyEntered END AS PriceEnteredList, + CASE WHEN i.IsDiscountPrinted='Y' AND ol.PriceList>ol.PriceActual AND ol.PriceList<>0 + THEN (ol.PriceList-ol.PriceActual)/ol.PriceList*100 END AS Discount, + CASE WHEN ol.PriceActual<>0 OR ol.M_Product_ID IS NOT NULL THEN ol.PriceActual END AS PriceActual, + CASE WHEN ol.PriceEntered<>0 OR ol.M_Product_ID IS NOT NULL THEN ol.PriceEntered END AS PriceEntered, + CASE WHEN ol.LineNetAmt<>0 OR ol.M_Product_ID IS NOT NULL THEN ol.LineNetAmt END AS LineNetAmt, + pt.Description as ProductDescription, p.ImageURL, + ol.C_Campaign_ID, ol.C_Project_ID, ol.C_Activity_ID, ol.C_ProjectPhase_ID, ol.C_ProjectTask_ID +FROM C_OrderLine ol + INNER JOIN C_UOM_Trl uom ON (ol.C_UOM_ID=uom.C_UOM_ID) + INNER JOIN C_Order i ON (ol.C_Order_ID=i.C_Order_ID) + LEFT OUTER JOIN M_Product p ON (ol.M_Product_ID=p.M_Product_ID) + LEFT OUTER JOIN M_Product_Trl pt ON (ol.M_Product_ID=pt.M_Product_ID AND uom.AD_Language=pt.AD_Language) + LEFT OUTER JOIN S_ResourceAssignment ra ON (ol.S_ResourceAssignment_ID=ra.S_ResourceAssignment_ID) + LEFT OUTER JOIN C_Charge c ON (ol.C_Charge_ID=c.C_Charge_ID) + LEFT OUTER JOIN C_BPartner_Product pp ON (ol.M_Product_ID=pp.M_Product_ID AND i.C_BPartner_ID=pp.C_BPartner_ID) + INNER JOIN C_BPartner bp ON (ol.C_BPartner_ID=bp.C_BPartner_ID) + INNER JOIN C_BPartner_Location bpl ON (ol.C_BPartner_Location_ID=bpl.C_BPartner_Location_ID) + LEFT OUTER JOIN C_Tax_Trl t ON (ol.C_Tax_ID=t.C_Tax_ID AND uom.AD_Language=t.AD_Language) +UNION +SELECT ol.AD_Client_ID, ol.AD_Org_ID, ol.IsActive, ol.Created, ol.CreatedBy, ol.Updated, ol.UpdatedBy, + uom.AD_Language, + ol.C_Order_ID, ol.C_OrderLine_ID, ol.C_Tax_ID, null, + null, null, null, null, + ol.Line+(b.Line/100) AS Line, p.M_Product_ID, + ol.QtyOrdered*b.BOMQty AS QtyInvoiced, ol.QtyEntered*b.BOMQty AS QtyEntered, uom.UOMSymbol, + COALESCE(pt.Name, p.Name) AS Name, -- main + b.Description, + COALESCE(pt.DocumentNote, p.DocumentNote) AS DocumentNote, p.UPC, p.SKU, p.Value AS ProductValue, + null, null, null, null, null, null, null, pt.Description AS ProductDescription, p.ImageURL, + ol.C_Campaign_ID, ol.C_Project_ID, ol.C_Activity_ID, ol.C_ProjectPhase_ID, ol.C_ProjectTask_ID +FROM M_Product_BOM b -- BOM lines + INNER JOIN C_OrderLine ol ON (b.M_Product_ID=ol.M_Product_ID) + INNER JOIN M_Product bp ON (bp.M_Product_ID=ol.M_Product_ID -- BOM Product + AND bp.IsBOM='Y' AND bp.IsVerified='Y' AND bp.IsInvoicePrintDetails='Y') + INNER JOIN M_Product p ON (b.M_ProductBOM_ID=p.M_Product_ID) -- BOM line product + INNER JOIN C_UOM_Trl uom ON (p.C_UOM_ID=uom.C_UOM_ID) + INNER JOIN M_Product_Trl pt ON (b.M_ProductBOM_ID=pt.M_Product_ID AND uom.AD_Language=pt.AD_Language) +UNION +SELECT o.AD_Client_ID, o.AD_Org_ID, o.IsActive, o.Created, o.CreatedBy, o.Updated, o.UpdatedBy, + l.AD_Language, o.C_Order_ID, null, null, null, + null, + null, null, null, + null, null, null, null, + null, null, + null, null, null, null, null, null, + null, null, null, null, null, null, null, null, + null,null,null,null,null +FROM C_Order o, AD_Language l +WHERE l.IsBaseLanguage='N' AND l.IsSystemLanguage='Y' +UNION +SELECT ot.AD_Client_ID, ot.AD_Org_ID, ot.IsActive, ot.Created, ot.CreatedBy, ot.Updated, ot.UpdatedBy, + t.AD_Language, ot.C_Order_ID, null, ot.C_Tax_ID, t.TaxIndicator, + null, null, null, null, + null, null, + null, null, null, + t.Name, + null, null, null, null, null, null, + null, null, null, + CASE WHEN ot.IsTaxIncluded='Y' THEN ot.TaxAmt ELSE ot.TaxBaseAmt END, + CASE WHEN ot.IsTaxIncluded='Y' THEN ot.TaxAmt ELSE ot.TaxBaseAmt END, + CASE WHEN ot.IsTaxIncluded='Y' THEN NULL ELSE ot.TaxAmt END, + null, null, + null,null,null,null,null +FROM C_OrderTax ot + INNER JOIN C_Tax_Trl t ON (ot.C_Tax_ID=t.C_Tax_ID); + + + diff --git a/db/ddlutils/postgresql/views/C_PAYMENT_V.sql b/db/ddlutils/postgresql/views/C_PAYMENT_V.sql new file mode 100644 index 0000000000..88f9bffbeb --- /dev/null +++ b/db/ddlutils/postgresql/views/C_PAYMENT_V.sql @@ -0,0 +1,42 @@ +CREATE OR REPLACE VIEW C_PAYMENT_V +(C_PAYMENT_ID, AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, + CREATEDBY, UPDATED, UPDATEDBY, DOCUMENTNO, DATETRX, + ISRECEIPT, C_DOCTYPE_ID, TRXTYPE, C_BANKACCOUNT_ID, C_BPARTNER_ID, + C_INVOICE_ID, C_BP_BANKACCOUNT_ID, C_PAYMENTBATCH_ID, TENDERTYPE, CREDITCARDTYPE, + CREDITCARDNUMBER, CREDITCARDVV, CREDITCARDEXPMM, CREDITCARDEXPYY, MICR, + ROUTINGNO, ACCOUNTNO, CHECKNO, A_NAME, A_STREET, + A_CITY, A_STATE, A_ZIP, A_IDENT_DL, A_IDENT_SSN, + A_EMAIL, VOICEAUTHCODE, ORIG_TRXID, PONUM, C_CURRENCY_ID, + C_CONVERSIONTYPE_ID, PAYAMT, DISCOUNTAMT, WRITEOFFAMT, TAXAMT, + OVERUNDERAMT, MULTIPLIERAP, ISOVERUNDERPAYMENT, ISAPPROVED, R_PNREF, + R_RESULT, R_RESPMSG, R_AUTHCODE, R_AVSADDR, R_AVSZIP, + R_INFO, PROCESSING, OPROCESSING, DOCSTATUS, DOCACTION, + ISPREPAYMENT, C_CHARGE_ID, ISRECONCILED, ISALLOCATED, ISONLINE, + PROCESSED, POSTED, C_CAMPAIGN_ID, C_PROJECT_ID, C_ACTIVITY_ID) +AS +SELECT C_Payment_ID, AD_Client_ID, AD_Org_ID, IsActive, Created, CreatedBy, Updated, UpdatedBy, + DocumentNo, DateTrx, IsReceipt, C_DocType_ID, TrxType, + C_BankAccount_ID, C_BPartner_ID, C_Invoice_ID, C_BP_BankAccount_ID, C_PaymentBatch_ID, + TenderType, CreditCardType, CreditCardNumber, CreditCardVV, CreditCardExpMM, CreditCardExpYY, + Micr, RoutingNo, AccountNo, CheckNo, + A_Name, A_Street, A_City, A_State, A_Zip, A_Ident_DL, A_Ident_SSN, A_EMail, + VoiceAuthCode, Orig_TrxID, PONum, + C_Currency_ID, C_ConversionType_ID, + CASE IsReceipt WHEN 'Y' THEN PayAmt ELSE PayAmt*-1 END AS PayAmt, + CASE IsReceipt WHEN 'Y' THEN DiscountAmt ELSE DiscountAmt*-1 END AS DiscountAmt, + CASE IsReceipt WHEN 'Y' THEN WriteOffAmt ELSE WriteOffAmt*-1 END AS WriteOffAmt, + CASE IsReceipt WHEN 'Y' THEN TaxAmt ELSE TaxAmt*-1 END AS TaxAmt, + CASE IsReceipt WHEN 'Y' THEN OverUnderAmt ELSE OverUnderAmt*-1 END AS OverUnderAmt, + CASE IsReceipt WHEN 'Y' THEN 1 ELSE -1 END AS MultiplierAP, + IsOverUnderPayment, IsApproved, + R_PnRef, R_Result, R_RespMsg, R_AuthCode, R_AvsAddr, R_AvsZip, R_Info, + Processing, OProcessing, DocStatus, DocAction, + IsPrepayment, C_Charge_ID, + IsReconciled, IsAllocated, IsOnline, Processed, Posted, + C_Campaign_ID, C_Project_ID, C_Activity_ID +FROM C_Payment; + +--COMMENT ON TABLE C_PAYMENT_V IS 'Payment Information corrected for AP/AR'; + + + diff --git a/db/ddlutils/postgresql/views/C_PAYSELECTION_CHECK_V.sql b/db/ddlutils/postgresql/views/C_PAYSELECTION_CHECK_V.sql new file mode 100644 index 0000000000..579cc474bb --- /dev/null +++ b/db/ddlutils/postgresql/views/C_PAYSELECTION_CHECK_V.sql @@ -0,0 +1,27 @@ +CREATE OR REPLACE VIEW C_PAYSELECTION_CHECK_V +(AD_CLIENT_ID, AD_ORG_ID, AD_LANGUAGE, C_PAYSELECTION_ID, C_PAYSELECTIONCHECK_ID, + ORG_LOCATION_ID, TAXID, C_DOCTYPE_ID, C_BPARTNER_ID, BPVALUE, + BPTAXID, NAICS, DUNS, BPGREETING, NAME, + NAME2, C_LOCATION_ID, REFERENCENO, POREFERENCE, PAYDATE, + PAYAMT, AMTINWORDS, QTY, PAYMENTRULE, DOCUMENTNO) +AS +SELECT psc.AD_Client_ID, psc.AD_Org_ID, + cast('en_US' as varchar) AS AD_Language, + psc.C_PaySelection_ID, psc.C_PaySelectionCheck_ID, + oi.C_Location_ID AS Org_Location_ID, oi.TaxID, 0 AS C_DocType_ID, + bp.C_BPartner_ID, bp.Value AS BPValue, bp.TaxID AS BPTaxID, bp.NAICS, bp.DUNS, + bpg.Greeting AS BPGreeting, + bp.Name, bp.Name2, + bpartnerRemitLocation(bp.C_BPartner_ID) AS C_Location_ID, + bp.ReferenceNo, bp.POReference, + ps.PayDate, + psc.PayAmt, psc.PayAmt AS AmtInWords, + psc.Qty, psc.PaymentRule, psc.DocumentNo +FROM C_PaySelectionCheck psc + INNER JOIN C_PaySelection ps ON (psc.C_PaySelection_ID=ps.C_PaySelection_ID) + INNER JOIN C_BPartner bp ON (psc.C_BPartner_ID=bp.C_BPartner_ID) + LEFT OUTER JOIN C_Greeting bpg on (bp.C_Greeting_ID=bpg.C_Greeting_ID) + INNER JOIN AD_OrgInfo oi ON (psc.AD_Org_ID=oi.AD_Org_ID); + + + diff --git a/db/ddlutils/postgresql/views/C_PAYSELECTION_CHECK_VT.sql b/db/ddlutils/postgresql/views/C_PAYSELECTION_CHECK_VT.sql new file mode 100644 index 0000000000..e4963630cd --- /dev/null +++ b/db/ddlutils/postgresql/views/C_PAYSELECTION_CHECK_VT.sql @@ -0,0 +1,28 @@ +CREATE OR REPLACE VIEW C_PAYSELECTION_CHECK_VT +(AD_CLIENT_ID, AD_ORG_ID, AD_LANGUAGE, C_PAYSELECTION_ID, C_PAYSELECTIONCHECK_ID, + ORG_LOCATION_ID, TAXID, C_DOCTYPE_ID, C_BPARTNER_ID, BPVALUE, + BPTAXID, NAICS, DUNS, BPGREETING, NAME, + NAME2, C_LOCATION_ID, REFERENCENO, POREFERENCE, PAYDATE, + PAYAMT, AMTINWORDS, QTY, PAYMENTRULE, DOCUMENTNO) +AS +SELECT psc.AD_Client_ID, psc.AD_Org_ID, + l.AD_Language, + psc.C_PaySelection_ID, psc.C_PaySelectionCheck_ID, + oi.C_Location_ID AS Org_Location_ID, oi.TaxID, 0 AS C_DocType_ID, + bp.C_BPartner_ID, bp.Value AS BPValue, bp.TaxID AS BPTaxID, bp.NAICS, bp.DUNS, + bpg.Greeting AS BPGreeting, + bp.Name, bp.Name2, + bpartnerRemitLocation(bp.C_BPartner_ID) AS C_Location_ID, + bp.ReferenceNo, bp.POReference, + ps.PayDate, + psc.PayAmt, psc.PayAmt AS AmtInWords, + psc.Qty, psc.PaymentRule, psc.DocumentNo +FROM C_PaySelectionCheck psc + INNER JOIN C_PaySelection ps ON (psc.C_PaySelection_ID=ps.C_PaySelection_ID) + INNER JOIN C_BPartner bp ON (psc.C_BPartner_ID=bp.C_BPartner_ID) + INNER JOIN AD_OrgInfo oi ON (psc.AD_Org_ID=oi.AD_Org_ID) + LEFT OUTER JOIN AD_Language l ON (l.IsSystemLanguage='Y') + LEFT OUTER JOIN C_Greeting_Trl bpg on (bp.C_Greeting_ID=bpg.C_Greeting_ID AND bpg.AD_Language=l.AD_Language); + + + diff --git a/db/ddlutils/postgresql/views/C_PAYSELECTION_REMITTANCE_V.sql b/db/ddlutils/postgresql/views/C_PAYSELECTION_REMITTANCE_V.sql new file mode 100644 index 0000000000..9b24a11f31 --- /dev/null +++ b/db/ddlutils/postgresql/views/C_PAYSELECTION_REMITTANCE_V.sql @@ -0,0 +1,17 @@ +CREATE OR REPLACE VIEW C_PAYSELECTION_REMITTANCE_V +(AD_CLIENT_ID, AD_ORG_ID, AD_LANGUAGE, C_PAYSELECTION_ID, C_PAYSELECTIONLINE_ID, + C_PAYSELECTIONCHECK_ID, PAYMENTRULE, LINE, OPENAMT, PAYAMT, + DISCOUNTAMT, DIFFERENCEAMT, C_BPARTNER_ID, DOCUMENTNO, DATEINVOICED, + GRANDTOTAL, AMTINWORDS) +AS +SELECT psl.AD_Client_ID, psl.AD_Org_ID, + cast('en_US' as varchar) AS AD_Language, + psl.C_PaySelection_ID, psl.C_PaySelectionLine_ID, + psl.C_PaySelectionCheck_ID, + psl.PaymentRule, psl.Line, psl.OpenAmt, psl.PayAmt, psl.DiscountAmt, psl.DifferenceAmt, + i.C_BPartner_ID, i.DocumentNo, i.DateInvoiced, i.GrandTotal, i.GrandTotal AS AmtInWords +FROM C_PaySelectionLine psl + INNER JOIN C_Invoice i ON (psl.C_Invoice_ID=i.C_Invoice_ID); + + + diff --git a/db/ddlutils/postgresql/views/C_PAYSELECTION_REMITTANCE_VT.sql b/db/ddlutils/postgresql/views/C_PAYSELECTION_REMITTANCE_VT.sql new file mode 100644 index 0000000000..ddfdae5af0 --- /dev/null +++ b/db/ddlutils/postgresql/views/C_PAYSELECTION_REMITTANCE_VT.sql @@ -0,0 +1,18 @@ +CREATE OR REPLACE VIEW C_PAYSELECTION_REMITTANCE_VT +(AD_CLIENT_ID, AD_ORG_ID, AD_LANGUAGE, C_PAYSELECTION_ID, C_PAYSELECTIONLINE_ID, + C_PAYSELECTIONCHECK_ID, PAYMENTRULE, LINE, OPENAMT, PAYAMT, + DISCOUNTAMT, DIFFERENCEAMT, C_BPARTNER_ID, DOCUMENTNO, DATEINVOICED, + GRANDTOTAL, AMTINWORDS) +AS +SELECT psl.AD_Client_ID, psl.AD_Org_ID, + l.AD_Language, + psl.C_PaySelection_ID, psl.C_PaySelectionLine_ID, + psl.C_PaySelectionCheck_ID, + psl.PaymentRule, psl.Line, psl.OpenAmt, psl.PayAmt, psl.DiscountAmt, psl.DifferenceAmt, + i.C_BPartner_ID, i.DocumentNo, i.DateInvoiced, i.GrandTotal, i.GrandTotal AS AmtInWords +FROM C_PaySelectionLine psl + INNER JOIN C_Invoice i ON (psl.C_Invoice_ID=i.C_Invoice_ID) + INNER JOIN AD_Language l ON (l.IsSystemLanguage='Y'); + + + diff --git a/db/ddlutils/postgresql/views/C_PROJECT_DETAILS_V.sql b/db/ddlutils/postgresql/views/C_PROJECT_DETAILS_V.sql new file mode 100644 index 0000000000..b1ec85306e --- /dev/null +++ b/db/ddlutils/postgresql/views/C_PROJECT_DETAILS_V.sql @@ -0,0 +1,28 @@ +CREATE OR REPLACE VIEW C_PROJECT_DETAILS_V +(AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, + UPDATED, UPDATEDBY, AD_LANGUAGE, C_PROJECT_ID, C_PROJECTLINE_ID, + LINE, PLANNEDQTY, PLANNEDPRICE, PLANNEDAMT, PLANNEDMARGINAMT, + COMMITTEDAMT, M_PRODUCT_ID, NAME, DESCRIPTION, DOCUMENTNOTE, + UPC, SKU, PRODUCTVALUE, M_PRODUCT_CATEGORY_ID, INVOICEDAMT, + INVOICEDQTY, COMMITTEDQTY) +AS +SELECT pl.AD_Client_ID, pl.AD_Org_ID, pl.IsActive, pl.Created, pl.CreatedBy, pl.Updated, pl.UpdatedBy, + cast('en_US' as varchar) AS AD_Language, + pj.C_Project_ID, pl.C_ProjectLine_ID, + pl.Line, + pl.PlannedQty, pl.PlannedPrice, pl.PlannedAmt, pl.PlannedMarginAmt, + pl.CommittedAmt, + pl.M_Product_ID, + COALESCE(p.Name, pl.Description) AS Name, -- main line + CASE WHEN p.Name IS NOT NULL THEN pl.Description END AS Description, -- second line + p.DocumentNote, -- third line + p.UPC, p.SKU, p.Value AS ProductValue, + pl.M_Product_Category_ID, + pl.InvoicedAmt, pl.InvoicedQty, pl.CommittedQty +FROM C_ProjectLine pl + INNER JOIN C_Project pj ON (pl.C_Project_ID=pj.C_Project_ID) + LEFT OUTER JOIN M_Product p ON (pl.M_Product_ID=p.M_Product_ID) +WHERE pl.IsPrinted='Y'; + + + diff --git a/db/ddlutils/postgresql/views/C_PROJECT_DETAILS_VT.sql b/db/ddlutils/postgresql/views/C_PROJECT_DETAILS_VT.sql new file mode 100644 index 0000000000..a86b58285b --- /dev/null +++ b/db/ddlutils/postgresql/views/C_PROJECT_DETAILS_VT.sql @@ -0,0 +1,29 @@ +CREATE OR REPLACE VIEW C_PROJECT_DETAILS_VT +(AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, + UPDATED, UPDATEDBY, AD_LANGUAGE, C_PROJECT_ID, C_PROJECTLINE_ID, + LINE, PLANNEDQTY, PLANNEDPRICE, PLANNEDAMT, PLANNEDMARGINAMT, + COMMITTEDAMT, M_PRODUCT_ID, NAME, DESCRIPTION, DOCUMENTNOTE, + UPC, SKU, PRODUCTVALUE, M_PRODUCT_CATEGORY_ID, INVOICEDAMT, + INVOICEDQTY, COMMITTEDQTY) +AS +SELECT pl.AD_Client_ID, pl.AD_Org_ID, pl.IsActive, pl.Created, pl.CreatedBy, pl.Updated, pl.UpdatedBy, + l.AD_Language, + pj.C_Project_ID, pl.C_ProjectLine_ID, + pl.Line, + pl.PlannedQty, pl.PlannedPrice, pl.PlannedAmt, pl.PlannedMarginAmt, + pl.CommittedAmt, + pl.M_Product_ID, + COALESCE(p.Name, pl.Description) AS Name, -- main line + CASE WHEN p.Name IS NOT NULL THEN pl.Description END AS Description, -- second line + p.DocumentNote, -- third line + p.UPC, p.SKU, p.Value AS ProductValue, + pl.M_Product_Category_ID, + pl.InvoicedAmt, pl.InvoicedQty, pl.CommittedQty +FROM C_ProjectLine pl + INNER JOIN C_Project pj ON (pl.C_Project_ID=pj.C_Project_ID) + LEFT OUTER JOIN M_Product p ON (pl.M_Product_ID=p.M_Product_ID) + INNER JOIN AD_Language l ON (l.IsSystemLanguage='Y') +WHERE pl.IsPrinted='Y'; + + + diff --git a/db/ddlutils/postgresql/views/C_PROJECT_HEADER_V.sql b/db/ddlutils/postgresql/views/C_PROJECT_HEADER_V.sql new file mode 100644 index 0000000000..563d1c7ae0 --- /dev/null +++ b/db/ddlutils/postgresql/views/C_PROJECT_HEADER_V.sql @@ -0,0 +1,50 @@ +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); + + + diff --git a/db/ddlutils/postgresql/views/C_PROJECT_HEADER_VT.sql b/db/ddlutils/postgresql/views/C_PROJECT_HEADER_VT.sql new file mode 100644 index 0000000000..676c6cfd17 --- /dev/null +++ b/db/ddlutils/postgresql/views/C_PROJECT_HEADER_VT.sql @@ -0,0 +1,50 @@ +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); + + + diff --git a/db/ddlutils/postgresql/views/C_RFQRESPONSELINEQTY_V.sql b/db/ddlutils/postgresql/views/C_RFQRESPONSELINEQTY_V.sql new file mode 100644 index 0000000000..e60f9000e6 --- /dev/null +++ b/db/ddlutils/postgresql/views/C_RFQRESPONSELINEQTY_V.sql @@ -0,0 +1,18 @@ +CREATE OR REPLACE VIEW C_RFQRESPONSELINEQTY_V +(C_RFQRESPONSELINE_ID, C_RFQRESPONSELINEQTY_ID, C_RFQLINEQTY_ID, AD_CLIENT_ID, AD_ORG_ID, + ISACTIVE, CREATED, CREATEDBY, UPDATED, UPDATEDBY, + AD_LANGUAGE, C_UOM_ID, UOMSYMBOL, QTY, PRICE, + DISCOUNT) +AS +SELECT rq.C_RfQResponseLine_ID, rq.C_RfQResponseLineQty_ID, rq.C_RfQLineQty_ID, + rq.AD_Client_ID, rq.AD_Org_ID, rq.IsActive, rq.Created, rq.CreatedBy, rq.Updated, rq.UpdatedBy, + cast('en_US' as varchar) AS AD_Language, + q.C_UOM_ID, uom.UOMSymbol, + q.Qty, rq.Price, rq.Discount +FROM C_RfQResponseLineQty rq + INNER JOIN C_RfQLineQty q ON (rq.C_RfQLineQty_ID=q.C_RfQLineQty_ID) + INNER JOIN C_UOM uom ON (q.C_UOM_ID=uom.C_UOM_ID) +WHERE rq.IsActive='Y' AND q.IsActive='Y'; + + + diff --git a/db/ddlutils/postgresql/views/C_RFQRESPONSELINEQTY_VT.sql b/db/ddlutils/postgresql/views/C_RFQRESPONSELINEQTY_VT.sql new file mode 100644 index 0000000000..b1e3bbc390 --- /dev/null +++ b/db/ddlutils/postgresql/views/C_RFQRESPONSELINEQTY_VT.sql @@ -0,0 +1,19 @@ +CREATE OR REPLACE VIEW C_RFQRESPONSELINEQTY_VT +(C_RFQRESPONSELINE_ID, C_RFQRESPONSELINEQTY_ID, C_RFQLINEQTY_ID, AD_CLIENT_ID, AD_ORG_ID, + ISACTIVE, CREATED, CREATEDBY, UPDATED, UPDATEDBY, + AD_LANGUAGE, C_UOM_ID, UOMSYMBOL, QTY, PRICE, + DISCOUNT) +AS +SELECT rq.C_RfQResponseLine_ID, rq.C_RfQResponseLineQty_ID, rq.C_RfQLineQty_ID, + rq.AD_Client_ID, rq.AD_Org_ID, rq.IsActive, rq.Created, rq.CreatedBy, rq.Updated, rq.UpdatedBy, + l.AD_Language, + q.C_UOM_ID, uom.UOMSymbol, + q.Qty, rq.Price, rq.Discount +FROM C_RfQResponseLineQty rq + INNER JOIN C_RfQLineQty q ON (rq.C_RfQLineQty_ID=q.C_RfQLineQty_ID) + INNER JOIN C_UOM uom ON (q.C_UOM_ID=uom.C_UOM_ID) + INNER JOIN AD_Language l ON (l.IsSystemLanguage='Y') +WHERE rq.IsActive='Y' AND q.IsActive='Y'; + + + diff --git a/db/ddlutils/postgresql/views/C_RFQRESPONSELINE_V.sql b/db/ddlutils/postgresql/views/C_RFQRESPONSELINE_V.sql new file mode 100644 index 0000000000..0b3b3fb332 --- /dev/null +++ b/db/ddlutils/postgresql/views/C_RFQRESPONSELINE_V.sql @@ -0,0 +1,34 @@ +CREATE OR REPLACE VIEW C_RFQRESPONSELINE_V +(C_RFQRESPONSE_ID, C_RFQRESPONSELINE_ID, C_RFQLINE_ID, C_RFQRESPONSELINEQTY_ID, C_RFQLINEQTY_ID, + AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, + UPDATED, UPDATEDBY, AD_LANGUAGE, LINE, M_PRODUCT_ID, + M_ATTRIBUTESETINSTANCE_ID, NAME, DESCRIPTION, DOCUMENTNOTE, UPC, + SKU, PRODUCTVALUE, HELP, DATEWORKSTART, DELIVERYDAYS, + C_UOM_ID, UOMSYMBOL, BENCHMARKPRICE, QTY, PRICE, + DISCOUNT) +AS +SELECT rrl.C_RfQResponse_ID, rrl.C_RfQResponseLine_ID, rrl.C_RfQLine_ID, + rq.C_RfQResponseLineQty_ID, rq.C_RfQLineQty_ID, + rrl.AD_Client_ID, rrl.AD_Org_ID, rrl.IsActive, rrl.Created, rrl.CreatedBy, rrl.Updated, rrl.UpdatedBy, + cast('en_US' as varchar) AS AD_Language, + rl.Line, + rl.M_Product_ID, rl.M_AttributeSetInstance_ID, + COALESCE(p.Name||productAttribute(rl.M_AttributeSetInstance_ID), rl.Description) AS Name, -- main line + CASE WHEN p.Name IS NOT NULL THEN rl.Description END AS Description, -- second line + p.DocumentNote, -- third line + p.UPC, p.SKU, p.Value AS ProductValue, + rl.Help, + rl.DateWorkStart, rl.DeliveryDays, + q.C_UOM_ID, uom.UOMSymbol, q.BenchmarkPrice, + q.Qty, rq.Price, rq.Discount +FROM C_RfQResponseLineQty rq + INNER JOIN C_RfQLineQty q ON (rq.C_RfQLineQty_ID=q.C_RfQLineQty_ID) + INNER JOIN C_UOM uom ON (q.C_UOM_ID=uom.C_UOM_ID) + INNER JOIN C_RfQResponseLine rrl ON (rq.C_RfQResponseLine_ID=rrl.C_RfQResponseLine_ID) + INNER JOIN C_RfQLine rl ON (rrl.C_RfQLine_ID=rl.C_RfQLine_ID) + LEFT OUTER JOIN M_Product p ON (rl.M_Product_ID=p.M_Product_ID) +WHERE rq.IsActive='Y' AND q.IsActive='Y' + AND rrl.IsActive='Y' AND rl.IsActive='Y'; + + + diff --git a/db/ddlutils/postgresql/views/C_RFQRESPONSELINE_VT.sql b/db/ddlutils/postgresql/views/C_RFQRESPONSELINE_VT.sql new file mode 100644 index 0000000000..32848e3228 --- /dev/null +++ b/db/ddlutils/postgresql/views/C_RFQRESPONSELINE_VT.sql @@ -0,0 +1,34 @@ +CREATE OR REPLACE VIEW C_RFQRESPONSELINE_VT +(C_RFQRESPONSE_ID, C_RFQRESPONSELINE_ID, C_RFQLINE_ID, C_RFQRESPONSELINEQTY_ID, C_RFQLINEQTY_ID, + AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, + UPDATED, UPDATEDBY, AD_LANGUAGE, LINE, M_PRODUCT_ID, + M_ATTRIBUTESETINSTANCE_ID, NAME, DESCRIPTION, DOCUMENTNOTE, UPC, + SKU, PRODUCTVALUE, HELP, DATEWORKSTART, DELIVERYDAYS, + C_UOM_ID, UOMSYMBOL, QTY, PRICE, DISCOUNT) +AS +SELECT rrl.C_RfQResponse_ID, rrl.C_RfQResponseLine_ID, rrl.C_RfQLine_ID, + rq.C_RfQResponseLineQty_ID, rq.C_RfQLineQty_ID, + rrl.AD_Client_ID, rrl.AD_Org_ID, rrl.IsActive, rrl.Created, rrl.CreatedBy, rrl.Updated, rrl.UpdatedBy, + l.AD_Language, + rl.Line, + rl.M_Product_ID, rl.M_AttributeSetInstance_ID, + COALESCE(p.Name||productAttribute(rl.M_AttributeSetInstance_ID), rl.Description) AS Name, -- main line + CASE WHEN p.Name IS NOT NULL THEN rl.Description END AS Description, -- second line + p.DocumentNote, -- third line + p.UPC, p.SKU, p.Value AS ProductValue, + rl.Help, + rl.DateWorkStart, rl.DeliveryDays, + q.C_UOM_ID, uom.UOMSymbol, + q.Qty, rq.Price, rq.Discount +FROM C_RfQResponseLineQty rq + INNER JOIN C_RfQLineQty q ON (rq.C_RfQLineQty_ID=q.C_RfQLineQty_ID) + INNER JOIN C_UOM uom ON (q.C_UOM_ID=uom.C_UOM_ID) + INNER JOIN C_RfQResponseLine rrl ON (rq.C_RfQResponseLine_ID=rrl.C_RfQResponseLine_ID) + INNER JOIN C_RfQLine rl ON (rrl.C_RfQLine_ID=rl.C_RfQLine_ID) + LEFT OUTER JOIN M_Product p ON (rl.M_Product_ID=p.M_Product_ID) + INNER JOIN AD_Language l ON (l.IsSystemLanguage='Y') +WHERE rq.IsActive='Y' AND q.IsActive='Y' + AND rrl.IsActive='Y' AND rl.IsActive='Y'; + + + diff --git a/db/ddlutils/postgresql/views/C_RFQRESPONSE_V.sql b/db/ddlutils/postgresql/views/C_RFQRESPONSE_V.sql new file mode 100644 index 0000000000..8e7c9106cf --- /dev/null +++ b/db/ddlutils/postgresql/views/C_RFQRESPONSE_V.sql @@ -0,0 +1,29 @@ +CREATE OR REPLACE VIEW C_RFQRESPONSE_V +(C_RFQRESPONSE_ID, C_RFQ_ID, AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, + CREATED, CREATEDBY, UPDATED, UPDATEDBY, AD_LANGUAGE, + ORG_LOCATION_ID, TAXID, NAME, DESCRIPTION, HELP, + C_CURRENCY_ID, ISO_CODE, DATERESPONSE, DATEWORKSTART, DELIVERYDAYS, + C_BPARTNER_ID, BPNAME, BPNAME2, C_BPARTNER_LOCATION_ID, C_LOCATION_ID, + AD_USER_ID, TITLE, PHONE, CONTACTNAME) +AS +SELECT rr.C_RfQResponse_ID, rr.C_RfQ_ID, + rr.AD_Client_ID, rr.AD_Org_ID, rr.IsActive, rr.Created, rr.CreatedBy, rr.Updated, rr.UpdatedBy, + cast('en_US' as varchar) AS AD_Language, + oi.C_Location_ID AS Org_Location_ID, oi.TaxID, + r.Name, r.Description, r.Help, + r.C_Currency_ID, c.ISO_Code, + r.DateResponse, r.DateWorkStart, r.DeliveryDays, + rr.C_BPartner_ID, bp.Name AS BPName, bp.Name2 AS BPName2, + rr.C_BPartner_Location_ID, bpl.C_Location_ID, + rr.AD_User_ID, bpc.Title, bpc.Phone, + NULLIF (bpc.Name, bp.Name) AS ContactName +FROM C_RfQResponse rr + INNER JOIN C_RfQ r ON (rr.C_RfQ_ID=r.C_RfQ_ID) + INNER JOIN AD_OrgInfo oi ON (rr.AD_Org_ID=oi.AD_Org_ID) + INNER JOIN C_Currency c ON (r.C_Currency_ID=c.C_Currency_ID) + INNER JOIN C_BPartner bp ON (rr.C_BPartner_ID=bp.C_BPartner_ID) + INNER JOIN C_BPartner_Location bpl ON (rr.C_BPartner_Location_ID=bpl.C_BPartner_Location_ID) + LEFT OUTER JOIN AD_User bpc ON (rr.AD_User_ID=bpc.AD_User_ID); + + + diff --git a/db/ddlutils/postgresql/views/C_RFQRESPONSE_VT.sql b/db/ddlutils/postgresql/views/C_RFQRESPONSE_VT.sql new file mode 100644 index 0000000000..baf3e6b937 --- /dev/null +++ b/db/ddlutils/postgresql/views/C_RFQRESPONSE_VT.sql @@ -0,0 +1,30 @@ +CREATE OR REPLACE VIEW C_RFQRESPONSE_VT +(C_RFQRESPONSE_ID, C_RFQ_ID, AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, + CREATED, CREATEDBY, UPDATED, UPDATEDBY, AD_LANGUAGE, + ORG_LOCATION_ID, TAXID, NAME, DESCRIPTION, HELP, + C_CURRENCY_ID, ISO_CODE, DATERESPONSE, DATEWORKSTART, DELIVERYDAYS, + C_BPARTNER_ID, BPNAME, BPNAME2, C_BPARTNER_LOCATION_ID, C_LOCATION_ID, + AD_USER_ID, TITLE, PHONE, CONTACTNAME) +AS +SELECT rr.C_RfQResponse_ID, rr.C_RfQ_ID, + rr.AD_Client_ID, rr.AD_Org_ID, rr.IsActive, rr.Created, rr.CreatedBy, rr.Updated, rr.UpdatedBy, + l.AD_Language, + oi.C_Location_ID AS Org_Location_ID, oi.TaxID, + r.Name, r.Description, r.Help, + r.C_Currency_ID, c.ISO_Code, + r.DateResponse, r.DateWorkStart, r.DeliveryDays, + rr.C_BPartner_ID, bp.Name AS BPName, bp.Name2 AS BPName2, + rr.C_BPartner_Location_ID, bpl.C_Location_ID, + rr.AD_User_ID, bpc.Title, bpc.Phone, + NULLIF (bpc.Name, bp.Name) AS ContactName +FROM C_RfQResponse rr + INNER JOIN C_RfQ r ON (rr.C_RfQ_ID=r.C_RfQ_ID) + INNER JOIN AD_OrgInfo oi ON (rr.AD_Org_ID=oi.AD_Org_ID) + INNER JOIN C_Currency c ON (r.C_Currency_ID=c.C_Currency_ID) + INNER JOIN C_BPartner bp ON (rr.C_BPartner_ID=bp.C_BPartner_ID) + INNER JOIN C_BPartner_Location bpl ON (rr.C_BPartner_Location_ID=bpl.C_BPartner_Location_ID) + LEFT OUTER JOIN AD_User bpc ON (rr.AD_User_ID=bpc.AD_User_ID) + INNER JOIN AD_Language l ON (l.IsSystemLanguage='Y'); + + + diff --git a/db/ddlutils/postgresql/views/GL_JOURNALLINE_ACCT_V.sql b/db/ddlutils/postgresql/views/GL_JOURNALLINE_ACCT_V.sql new file mode 100644 index 0000000000..5a8cdff810 --- /dev/null +++ b/db/ddlutils/postgresql/views/GL_JOURNALLINE_ACCT_V.sql @@ -0,0 +1,26 @@ +CREATE OR REPLACE VIEW GL_JOURNALLINE_ACCT_V +(GL_JOURNALLINE_ID, AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, + CREATEDBY, UPDATED, UPDATEDBY, GL_JOURNAL_ID, LINE, + ISGENERATED, DESCRIPTION, AMTSOURCEDR, AMTSOURCECR, C_CURRENCY_ID, + C_CONVERSIONTYPE_ID, CURRENCYRATE, DATEACCT, AMTACCTDR, AMTACCTCR, + C_UOM_ID, QTY, C_VALIDCOMBINATION_ID, C_ACCTSCHEMA_ID, ACCOUNT_ID, + M_PRODUCT_ID, C_BPARTNER_ID, AD_ORGTRX_ID, C_LOCFROM_ID, C_LOCTO_ID, + C_SALESREGION_ID, C_PROJECT_ID, C_CAMPAIGN_ID, USER1_ID, USER2_ID, + ISFULLYQUALIFIED, C_ACTIVITY_ID) +AS +SELECT + gl.GL_JournalLine_ID, gl.AD_Client_ID, gl.AD_Org_ID, gl.IsActive, + gl.Created, gl.CreatedBy, gl.Updated, gl.UpdatedBy, gl.GL_Journal_ID, + gl.Line, gl.IsGenerated, gl.Description, + gl.AmtSourceDr, gl.AmtSourceCr, gl.C_Currency_ID, + gl.C_ConversionType_ID, gl.CurrencyRate, gl.DateAcct, + gl.AmtAcctDr, gl.AmtAcctCr, gl.C_UOM_ID, gl.Qty, gl.C_ValidCombination_ID, + vc.C_AcctSchema_ID, vc.Account_ID, vc.M_Product_ID, vc.C_BPartner_ID, + vc.AD_OrgTrx_ID, vc.C_LocFrom_ID, vc.C_LocTo_ID, vc.C_SalesRegion_ID, + vc.C_Project_ID, vc.C_Campaign_ID, vc.User1_ID, vc.User2_ID, + vc.IsFullyQualified, vc.C_Activity_ID +FROM GL_JournalLine gl, C_ValidCombination vc +WHERE gl.C_ValidCombination_ID = vc.C_ValidCombination_ID; + + + diff --git a/db/ddlutils/postgresql/views/M_INOUTCONFIRM_V.sql b/db/ddlutils/postgresql/views/M_INOUTCONFIRM_V.sql new file mode 100644 index 0000000000..d98bc1b3f2 --- /dev/null +++ b/db/ddlutils/postgresql/views/M_INOUTCONFIRM_V.sql @@ -0,0 +1,29 @@ +CREATE OR REPLACE VIEW M_INOUTCONFIRM_V +(AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, + UPDATED, UPDATEDBY, AD_LANGUAGE, M_INOUTCONFIRM_ID, DOCUMENTNO, + CONFIRMTYPE, ISAPPROVED, ISCANCELLED, DESCRIPTION, M_INOUT_ID, + SHIPDESCRIPTION, C_BPARTNER_ID, C_BPARTNER_LOCATION_ID, AD_USER_ID, SALESREP_ID, + C_DOCTYPE_ID, DOCUMENTTYPE, C_ORDER_ID, DATEORDERED, MOVEMENTDATE, + MOVEMENTTYPE, M_WAREHOUSE_ID, POREFERENCE, DELIVERYRULE, FREIGHTCOSTRULE, + DELIVERYVIARULE, M_SHIPPER_ID, PRIORITYRULE, PROCESSED) +AS +SELECT ioc.AD_Client_ID, ioc.AD_Org_ID, ioc.IsActive, ioc.Created, ioc.CreatedBy, ioc.Updated, ioc.UpdatedBy, + cast('en_US' as varchar) AS AD_Language, + ioc.M_InOutConfirm_ID, + ioc.DocumentNo, ioc.ConfirmType, + ioc.IsApproved, ioc.IsCancelled, ioc.Description, + -- + io.M_InOut_ID, io.Description AS ShipDescription, + io.C_BPartner_ID, io.C_BPartner_Location_ID, io.AD_User_ID, + io.SalesRep_ID, io.C_DocType_ID, dt.PrintName AS DocumentType, + io.C_Order_ID, io.DateOrdered, io.MovementDate, io.MovementType, + io.M_Warehouse_ID, io.POReference, + io.DeliveryRule, io.FreightCostRule, + io.DeliveryViaRule, io.M_Shipper_ID, PriorityRule, + ioc.Processed +FROM M_InOutConfirm ioc + INNER JOIN M_InOut io ON (ioc.M_InOut_ID=io.M_InOut_ID) + INNER JOIN C_DocType dt ON (io.C_DocType_ID=dt.C_DocType_ID); + + + diff --git a/db/ddlutils/postgresql/views/M_INOUTCONFIRM_VT.sql b/db/ddlutils/postgresql/views/M_INOUTCONFIRM_VT.sql new file mode 100644 index 0000000000..7cb32029ce --- /dev/null +++ b/db/ddlutils/postgresql/views/M_INOUTCONFIRM_VT.sql @@ -0,0 +1,29 @@ +CREATE OR REPLACE VIEW M_INOUTCONFIRM_VT +(AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, + UPDATED, UPDATEDBY, AD_LANGUAGE, M_INOUTCONFIRM_ID, DOCUMENTNO, + CONFIRMTYPE, ISAPPROVED, ISCANCELLED, DESCRIPTION, M_INOUT_ID, + SHIPDESCRIPTION, C_BPARTNER_ID, C_BPARTNER_LOCATION_ID, AD_USER_ID, SALESREP_ID, + C_DOCTYPE_ID, DOCUMENTTYPE, C_ORDER_ID, DATEORDERED, MOVEMENTDATE, + MOVEMENTTYPE, M_WAREHOUSE_ID, POREFERENCE, DELIVERYRULE, FREIGHTCOSTRULE, + DELIVERYVIARULE, M_SHIPPER_ID, PRIORITYRULE, PROCESSED) +AS +SELECT ioc.AD_Client_ID, ioc.AD_Org_ID, ioc.IsActive, ioc.Created, ioc.CreatedBy, ioc.Updated, ioc.UpdatedBy, + dt.AD_Language, + ioc.M_InOutConfirm_ID, + ioc.DocumentNo, ioc.ConfirmType, + ioc.IsApproved, ioc.IsCancelled, ioc.Description, + -- + io.M_InOut_ID, io.Description AS ShipDescription, + io.C_BPartner_ID, io.C_BPartner_Location_ID, io.AD_User_ID, + io.SalesRep_ID, io.C_DocType_ID, dt.PrintName AS DocumentType, + io.C_Order_ID, io.DateOrdered, io.MovementDate, io.MovementType, + io.M_Warehouse_ID, io.POReference, + io.DeliveryRule, io.FreightCostRule, + io.DeliveryViaRule, io.M_Shipper_ID, PriorityRule, + ioc.Processed +FROM M_InOutConfirm ioc + INNER JOIN M_InOut io ON (ioc.M_InOut_ID=io.M_InOut_ID) + INNER JOIN C_DocType_Trl dt ON (io.C_DocType_ID=dt.C_DocType_ID); + + + diff --git a/db/ddlutils/postgresql/views/M_INOUTLINEMA_V.sql b/db/ddlutils/postgresql/views/M_INOUTLINEMA_V.sql new file mode 100644 index 0000000000..34363d1c30 --- /dev/null +++ b/db/ddlutils/postgresql/views/M_INOUTLINEMA_V.sql @@ -0,0 +1,17 @@ +CREATE OR REPLACE VIEW M_INOUTLINEMA_V +(AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, + UPDATED, UPDATEDBY, M_INOUT_ID, M_INOUTLINE_ID, LINE, + M_PRODUCT_ID, M_ATTRIBUTESETINSTANCE_ID, MOVEMENTQTY, M_LOCATOR_ID) +AS +SELECT m.AD_Client_ID, m.AD_Org_ID, m.IsActive, m.Created, m.CreatedBy, m.Updated, m.UpdatedBy, + l.M_InOut_ID, m.M_InOutLine_ID, l.Line, l.M_Product_ID, + m.M_AttributeSetInstance_ID, m.MovementQty, l.M_Locator_ID +FROM M_InOutLineMA m INNER JOIN M_InOutLine l ON (m.M_InOutLine_ID=l.M_InOutLine_ID) +UNION +SELECT AD_Client_ID, AD_Org_ID, IsActive, Created, CreatedBy, Updated, UpdatedBy, + M_InOut_ID, M_InOutLine_ID, Line, M_Product_ID, + M_AttributeSetInstance_ID, MovementQty, M_Locator_ID +FROM M_InOutLine; + + + diff --git a/db/ddlutils/postgresql/views/M_INOUTLINEMA_VT.sql b/db/ddlutils/postgresql/views/M_INOUTLINEMA_VT.sql new file mode 100644 index 0000000000..d2489bedf0 --- /dev/null +++ b/db/ddlutils/postgresql/views/M_INOUTLINEMA_VT.sql @@ -0,0 +1,17 @@ +CREATE OR REPLACE VIEW M_INOUTLINEMA_VT +(AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, + UPDATED, UPDATEDBY, M_INOUT_ID, M_INOUTLINE_ID, LINE, + M_PRODUCT_ID, M_ATTRIBUTESETINSTANCE_ID, MOVEMENTQTY, M_LOCATOR_ID) +AS +SELECT m.AD_Client_ID, m.AD_Org_ID, m.IsActive, m.Created, m.CreatedBy, m.Updated, m.UpdatedBy, + l.M_InOut_ID, m.M_InOutLine_ID, l.Line, l.M_Product_ID, + m.M_AttributeSetInstance_ID, m.MovementQty, l.M_Locator_ID +FROM M_InOutLineMA m INNER JOIN M_InOutLine l ON (m.M_InOutLine_ID=l.M_InOutLine_ID) +UNION +SELECT AD_Client_ID, AD_Org_ID, IsActive, Created, CreatedBy, Updated, UpdatedBy, + M_InOut_ID, M_InOutLine_ID, Line, M_Product_ID, + M_AttributeSetInstance_ID, MovementQty, M_Locator_ID +FROM M_InOutLine; + + + diff --git a/db/ddlutils/postgresql/views/M_INOUT_CANDIDATE_V.sql b/db/ddlutils/postgresql/views/M_INOUT_CANDIDATE_V.sql new file mode 100644 index 0000000000..501c6d4a50 --- /dev/null +++ b/db/ddlutils/postgresql/views/M_INOUT_CANDIDATE_V.sql @@ -0,0 +1,37 @@ +CREATE OR REPLACE VIEW M_INOUT_CANDIDATE_V +(AD_CLIENT_ID, AD_ORG_ID, C_BPARTNER_ID, C_ORDER_ID, DOCUMENTNO, + DATEORDERED, C_DOCTYPE_ID, POREFERENCE, DESCRIPTION, SALESREP_ID, + M_WAREHOUSE_ID, TOTALLINES) +AS +SELECT + o.AD_Client_ID, o.AD_Org_ID, o.C_BPartner_ID, o.C_Order_ID, + o.DocumentNo, o.DateOrdered, o.C_DocType_ID, + o.POReference, o.Description, o.SalesRep_ID, + l.M_Warehouse_ID, + SUM((l.QtyOrdered-l.QtyDelivered)*l.PriceActual) AS TotalLines +FROM C_Order o + INNER JOIN C_OrderLine l ON (o.C_Order_ID=l.C_Order_ID) +WHERE (o.DocStatus = 'CO' AND o.IsDelivered='N') -- Status must be CO - not CL/RE + -- not Offers and open Walkin-Receipts + AND o.C_DocType_ID IN (SELECT C_DocType_ID FROM C_DocType + WHERE DocBaseType='SOO' AND DocSubTypeSO NOT IN ('ON','OB','WR')) + -- Delivery Rule - not manual + AND o.DeliveryRule<>'M' + AND (l.M_Product_ID IS NULL OR EXISTS + (SELECT * FROM M_Product p + WHERE l.M_Product_ID=p.M_Product_ID AND p.IsExcludeAutoDelivery='N')) + -- we need to ship + AND l.QtyOrdered <> l.QtyDelivered + AND o.IsDropShip='N' + AND (l.M_Product_ID IS NOT NULL OR l.C_Charge_ID IS NOT NULL) + -- Not confirmed shipment + AND NOT EXISTS (SELECT * FROM M_InOutLine iol + INNER JOIN M_InOut io ON (iol.M_InOut_ID=io.M_InOut_ID) + WHERE iol.C_OrderLine_ID=l.C_OrderLine_ID AND io.DocStatus IN ('IP','WC')) + -- +GROUP BY o.AD_Client_ID, o.AD_Org_ID, o.C_BPartner_ID, o.C_Order_ID, + o.DocumentNo, o.DateOrdered, o.C_DocType_ID, + o.POReference, o.Description, o.SalesRep_ID, l.M_Warehouse_ID; + + + diff --git a/db/ddlutils/postgresql/views/M_INOUT_HEADER_V.sql b/db/ddlutils/postgresql/views/M_INOUT_HEADER_V.sql new file mode 100644 index 0000000000..9d36135127 --- /dev/null +++ b/db/ddlutils/postgresql/views/M_INOUT_HEADER_V.sql @@ -0,0 +1,45 @@ +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); + + + diff --git a/db/ddlutils/postgresql/views/M_INOUT_HEADER_VT.sql b/db/ddlutils/postgresql/views/M_INOUT_HEADER_VT.sql new file mode 100644 index 0000000000..c34d7a02bb --- /dev/null +++ b/db/ddlutils/postgresql/views/M_INOUT_HEADER_VT.sql @@ -0,0 +1,45 @@ +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); + + + diff --git a/db/ddlutils/postgresql/views/M_INOUT_LINECONFIRM_V.sql b/db/ddlutils/postgresql/views/M_INOUT_LINECONFIRM_V.sql new file mode 100644 index 0000000000..8b0a3d06da --- /dev/null +++ b/db/ddlutils/postgresql/views/M_INOUT_LINECONFIRM_V.sql @@ -0,0 +1,34 @@ +CREATE OR REPLACE VIEW M_INOUT_LINECONFIRM_V +(AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, + UPDATED, UPDATEDBY, AD_LANGUAGE, M_INOUTLINECONFIRM_ID, M_INOUTCONFIRM_ID, + TARGETQTY, CONFIRMEDQTY, DIFFERENCEQTY, SCRAPPEDQTY, DESCRIPTION, + PROCESSED, M_INOUT_ID, M_INOUTLINE_ID, LINE, M_PRODUCT_ID, + MOVEMENTQTY, UOMSYMBOL, QTYBACKORDERED, NAME, SHIPDESCRIPTION, + DOCUMENTNOTE, UPC, SKU, PRODUCTVALUE, M_LOCATOR_ID, + M_WAREHOUSE_ID, X, Y, Z, M_ATTRIBUTESETINSTANCE_ID, + M_ATTRIBUTESET_ID, SERNO, LOT, M_LOT_ID, GUARANTEEDATE) +AS +SELECT iolc.AD_Client_ID, iolc.AD_Org_ID, iolc.IsActive, iolc.Created, iolc.CreatedBy, iolc.Updated, iolc.UpdatedBy, + cast('en_US' as varchar) AS AD_Language, + iolc.M_InOutLineConfirm_ID, iolc.M_InOutConfirm_ID, + iolc.TargetQty, iolc.ConfirmedQty, iolc.DifferenceQty, iolc.ScrappedQty, + iolc.Description, iolc.Processed, + iol.M_InOut_ID, iol.M_InOutLine_ID, + iol.Line, p.M_Product_ID, + iol.MovementQty, uom.UOMSymbol, ol.QtyOrdered-ol.QtyDelivered AS QtyBackOrdered, + COALESCE(p.Name, iol.Description) AS Name, -- main line + CASE WHEN p.Name IS NOT NULL THEN iol.Description END AS ShipDescription, -- second line + p.DocumentNote, -- third line + p.UPC, p.SKU, p.Value AS ProductValue, + iol.M_Locator_ID, l.M_Warehouse_ID, l.X, l.Y, l.Z, + iol.M_AttributeSetInstance_ID, asi.M_AttributeSet_ID, asi.SerNo, asi.Lot, asi.M_Lot_ID,asi.GuaranteeDate +FROM M_InOutLineConfirm iolc + INNER JOIN M_InOutLine iol ON (iolc.M_InOutLine_ID=iol.M_InOutLine_ID) + INNER JOIN C_UOM uom ON (iol.C_UOM_ID=uom.C_UOM_ID) + LEFT OUTER JOIN M_Product p ON (iol.M_Product_ID=p.M_Product_ID) + LEFT OUTER JOIN M_AttributeSetInstance asi ON (iol.M_AttributeSetInstance_ID=asi.M_AttributeSetInstance_ID) + LEFT OUTER JOIN M_Locator l ON (iol.M_Locator_ID=l.M_Locator_ID) + LEFT OUTER JOIN C_OrderLine ol ON (iol.C_OrderLine_ID=ol.C_OrderLine_ID); + + + diff --git a/db/ddlutils/postgresql/views/M_INOUT_LINECONFIRM_VT.sql b/db/ddlutils/postgresql/views/M_INOUT_LINECONFIRM_VT.sql new file mode 100644 index 0000000000..e1b0060784 --- /dev/null +++ b/db/ddlutils/postgresql/views/M_INOUT_LINECONFIRM_VT.sql @@ -0,0 +1,35 @@ +CREATE OR REPLACE VIEW M_INOUT_LINECONFIRM_VT +(AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, + UPDATED, UPDATEDBY, AD_LANGUAGE, M_INOUTLINECONFIRM_ID, M_INOUTCONFIRM_ID, + TARGETQTY, CONFIRMEDQTY, DIFFERENCEQTY, SCRAPPEDQTY, DESCRIPTION, + PROCESSED, M_INOUT_ID, M_INOUTLINE_ID, LINE, M_PRODUCT_ID, + MOVEMENTQTY, UOMSYMBOL, QTYBACKORDERED, NAME, SHIPDESCRIPTION, + DOCUMENTNOTE, UPC, SKU, PRODUCTVALUE, M_LOCATOR_ID, + M_WAREHOUSE_ID, X, Y, Z, M_ATTRIBUTESETINSTANCE_ID, + M_ATTRIBUTESET_ID, SERNO, LOT, M_LOT_ID, GUARANTEEDATE) +AS +SELECT iolc.AD_Client_ID, iolc.AD_Org_ID, iolc.IsActive, iolc.Created, iolc.CreatedBy, iolc.Updated, iolc.UpdatedBy, + uom.AD_Language, + iolc.M_InOutLineConfirm_ID, iolc.M_InOutConfirm_ID, + iolc.TargetQty, iolc.ConfirmedQty, iolc.DifferenceQty, iolc.ScrappedQty, + iolc.Description, iolc.Processed, + iol.M_InOut_ID, iol.M_InOutLine_ID, + iol.Line, p.M_Product_ID, + iol.MovementQty, uom.UOMSymbol, ol.QtyOrdered-ol.QtyDelivered AS QtyBackOrdered, + COALESCE(COALESCE(pt.Name,p.Name), iol.Description) AS Name, -- main line + CASE WHEN COALESCE(pt.Name,p.Name) IS NOT NULL THEN iol.Description END AS ShipDescription, -- second line + COALESCE(pt.DocumentNote, p.DocumentNote) AS DocumentNote, -- third line + p.UPC, p.SKU, p.Value AS ProductValue, + iol.M_Locator_ID, l.M_Warehouse_ID, l.X, l.Y, l.Z, + iol.M_AttributeSetInstance_ID, asi.M_AttributeSet_ID, asi.SerNo, asi.Lot, asi.M_Lot_ID,asi.GuaranteeDate +FROM M_InOutLineConfirm iolc + INNER JOIN M_InOutLine iol ON (iolc.M_InOutLine_ID=iol.M_InOutLine_ID) + INNER JOIN C_UOM_Trl uom ON (iol.C_UOM_ID=uom.C_UOM_ID) + LEFT OUTER JOIN M_Product p ON (iol.M_Product_ID=p.M_Product_ID) + LEFT OUTER JOIN M_Product_Trl pt ON (iol.M_Product_ID=pt.M_Product_ID AND uom.AD_Language=pt.AD_Language) + LEFT OUTER JOIN M_AttributeSetInstance asi ON (iol.M_AttributeSetInstance_ID=asi.M_AttributeSetInstance_ID) + LEFT OUTER JOIN M_Locator l ON (iol.M_Locator_ID=l.M_Locator_ID) + LEFT OUTER JOIN C_OrderLine ol ON (iol.C_OrderLine_ID=ol.C_OrderLine_ID); + + + diff --git a/db/ddlutils/postgresql/views/M_INOUT_LINE_V.sql b/db/ddlutils/postgresql/views/M_INOUT_LINE_V.sql new file mode 100644 index 0000000000..f17173e114 --- /dev/null +++ b/db/ddlutils/postgresql/views/M_INOUT_LINE_V.sql @@ -0,0 +1,61 @@ +CREATE OR REPLACE VIEW M_INOUT_LINE_V +(AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, + UPDATED, UPDATEDBY, AD_LANGUAGE, M_INOUT_ID, M_INOUTLINE_ID, + LINE, M_PRODUCT_ID, MOVEMENTQTY, QTYENTERED, UOMSYMBOL, + QTYORDERED, QTYDELIVERED, QTYBACKORDERED, NAME, DESCRIPTION, + DOCUMENTNOTE, UPC, SKU, PRODUCTVALUE, M_LOCATOR_ID, + M_WAREHOUSE_ID, X, Y, Z, M_ATTRIBUTESETINSTANCE_ID, + M_ATTRIBUTESET_ID, SERNO, LOT, M_LOT_ID, GUARANTEEDATE, + PRODUCTDESCRIPTION, IMAGEURL, C_CAMPAIGN_ID, C_PROJECT_ID, C_ACTIVITY_ID, + C_PROJECTPHASE_ID, C_PROJECTTASK_ID) +AS +SELECT iol.AD_Client_ID, iol.AD_Org_ID, iol.IsActive, iol.Created, iol.CreatedBy, iol.Updated, iol.UpdatedBy, + 'en_US' AS AD_Language, + iol.M_InOut_ID, iol.M_InOutLine_ID, + iol.Line, p.M_Product_ID, + CASE WHEN iol.MovementQty<>0 OR iol.M_Product_ID IS NOT NULL THEN iol.MovementQty END AS MovementQty, + CASE WHEN iol.QtyEntered<>0 OR iol.M_Product_ID IS NOT NULL THEN iol.QtyEntered END AS QtyEntered, + CASE WHEN iol.MovementQty<>0 OR iol.M_Product_ID IS NOT NULL THEN uom.UOMSymbol END AS UOMSymbol, + ol.QtyOrdered, ol.QtyDelivered, + CASE WHEN iol.MovementQty<>0 OR iol.M_Product_ID IS NOT NULL THEN ol.QtyOrdered-ol.QtyDelivered END AS QtyBackOrdered, + COALESCE(p.Name||productAttribute(iol.M_AttributeSetInstance_ID), c.Name, iol.Description) AS Name, -- main line + CASE WHEN COALESCE(c.Name,p.Name) IS NOT NULL THEN iol.Description END AS Description, -- second line + p.DocumentNote, -- third line + p.UPC, p.SKU, p.Value AS ProductValue, + iol.M_Locator_ID, l.M_Warehouse_ID, l.X, l.Y, l.Z, + iol.M_AttributeSetInstance_ID, asi.M_AttributeSet_ID, asi.SerNo, asi.Lot, asi.M_Lot_ID,asi.GuaranteeDate, + p.Description AS ProductDescription, p.ImageURL, + iol.C_Campaign_ID, iol.C_Project_ID, iol.C_Activity_ID, iol.C_ProjectPhase_ID, iol.C_ProjectTask_ID +FROM M_InOutLine iol + INNER JOIN C_UOM uom ON (iol.C_UOM_ID=uom.C_UOM_ID) + LEFT OUTER JOIN M_Product p ON (iol.M_Product_ID=p.M_Product_ID) + LEFT OUTER JOIN M_AttributeSetInstance asi ON (iol.M_AttributeSetInstance_ID=asi.M_AttributeSetInstance_ID) + LEFT OUTER JOIN M_Locator l ON (iol.M_Locator_ID=l.M_Locator_ID) + LEFT OUTER JOIN C_OrderLine ol ON (iol.C_OrderLine_ID=ol.C_OrderLine_ID) + LEFT OUTER JOIN C_Charge c ON (iol.C_Charge_ID=c.C_Charge_ID) +UNION -- BOM lines +SELECT iol.AD_Client_ID, iol.AD_Org_ID, iol.IsActive, iol.Created, iol.CreatedBy, iol.Updated, iol.UpdatedBy, + 'en_US' AS AD_Language, + iol.M_InOut_ID, iol.M_InOutLine_ID, + iol.Line+(b.Line/100) AS Line, p.M_Product_ID, + iol.MovementQty*b.BOMQty AS QtyInvoiced, iol.QtyEntered*b.BOMQty AS QtyEntered, uom.UOMSymbol, + null, null, null, + p.Name, -- main line + b.Description, -- second line + p.DocumentNote, -- third line + p.UPC, p.SKU, p.Value AS ProductValue, + iol.M_Locator_ID, l.M_Warehouse_ID, l.X, l.Y, l.Z, + iol.M_AttributeSetInstance_ID, asi.M_AttributeSet_ID, asi.SerNo, asi.Lot, asi.M_Lot_ID,asi.GuaranteeDate, + p.Description AS ProductDescription, p.ImageURL, + iol.C_Campaign_ID, iol.C_Project_ID, iol.C_Activity_ID, iol.C_ProjectPhase_ID, iol.C_ProjectTask_ID +FROM M_Product_BOM b -- BOM lines + INNER JOIN M_InOutLine iol ON (b.M_Product_ID=iol.M_Product_ID) + INNER JOIN M_Product bp ON (bp.M_Product_ID=iol.M_Product_ID -- BOM Product + AND bp.IsBOM='Y' AND bp.IsVerified='Y' AND bp.IsPickListPrintDetails='Y') + INNER JOIN M_Product p ON (b.M_ProductBOM_ID=p.M_Product_ID) -- BOM line product + INNER JOIN C_UOM uom ON (p.C_UOM_ID=uom.C_UOM_ID) + LEFT OUTER JOIN M_AttributeSetInstance asi ON (iol.M_AttributeSetInstance_ID=asi.M_AttributeSetInstance_ID) + LEFT OUTER JOIN M_Locator l ON (iol.M_Locator_ID=l.M_Locator_ID); + + + diff --git a/db/ddlutils/postgresql/views/M_INOUT_LINE_VT.sql b/db/ddlutils/postgresql/views/M_INOUT_LINE_VT.sql new file mode 100644 index 0000000000..672c7e89d5 --- /dev/null +++ b/db/ddlutils/postgresql/views/M_INOUT_LINE_VT.sql @@ -0,0 +1,63 @@ +CREATE OR REPLACE VIEW M_INOUT_LINE_VT +(AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, + UPDATED, UPDATEDBY, AD_LANGUAGE, M_INOUT_ID, M_INOUTLINE_ID, + LINE, M_PRODUCT_ID, MOVEMENTQTY, QTYENTERED, UOMSYMBOL, + QTYORDERED, QTYDELIVERED, QTYBACKORDERED, NAME, DESCRIPTION, + DOCUMENTNOTE, UPC, SKU, PRODUCTVALUE, M_LOCATOR_ID, + M_WAREHOUSE_ID, X, Y, Z, M_ATTRIBUTESETINSTANCE_ID, + M_ATTRIBUTESET_ID, SERNO, LOT, M_LOT_ID, GUARANTEEDATE, + PRODUCTDESCRIPTION, IMAGEURL, C_CAMPAIGN_ID, C_PROJECT_ID, C_ACTIVITY_ID, + C_PROJECTPHASE_ID, C_PROJECTTASK_ID) +AS +SELECT iol.AD_Client_ID, iol.AD_Org_ID, iol.IsActive, iol.Created, iol.CreatedBy, iol.Updated, iol.UpdatedBy, + uom.AD_Language, + iol.M_InOut_ID, iol.M_InOutLine_ID, + iol.Line, p.M_Product_ID, + CASE WHEN iol.MovementQty<>0 OR iol.M_Product_ID IS NOT NULL THEN iol.MovementQty END AS MovementQty, + CASE WHEN iol.QtyEntered<>0 OR iol.M_Product_ID IS NOT NULL THEN iol.QtyEntered END AS QtyEntered, + CASE WHEN iol.MovementQty<>0 OR iol.M_Product_ID IS NOT NULL THEN uom.UOMSymbol END AS UOMSymbol, + ol.QtyOrdered, ol.QtyDelivered, + CASE WHEN iol.MovementQty<>0 OR iol.M_Product_ID IS NOT NULL THEN ol.QtyOrdered-ol.QtyDelivered END AS QtyBackOrdered, + COALESCE(COALESCE(pt.Name,p.Name)||productAttribute(iol.M_AttributeSetInstance_ID), c.Name, iol.Description) AS Name, -- main line + CASE WHEN COALESCE(pt.Name,p.Name,c.Name) IS NOT NULL THEN iol.Description END AS Description, -- second line + COALESCE(pt.DocumentNote, p.DocumentNote) AS DocumentNote, -- third line + p.UPC, p.SKU, p.Value AS ProductValue, + iol.M_Locator_ID, l.M_Warehouse_ID, l.X, l.Y, l.Z, + iol.M_AttributeSetInstance_ID, asi.M_AttributeSet_ID, asi.SerNo, asi.Lot, asi.M_Lot_ID,asi.GuaranteeDate, + pt.Description AS ProductDescription, p.ImageURL, + iol.C_Campaign_ID, iol.C_Project_ID, iol.C_Activity_ID, iol.C_ProjectPhase_ID, iol.C_ProjectTask_ID +FROM M_InOutLine iol + INNER JOIN C_UOM_Trl uom ON (iol.C_UOM_ID=uom.C_UOM_ID) + LEFT OUTER JOIN M_Product p ON (iol.M_Product_ID=p.M_Product_ID) + LEFT OUTER JOIN M_Product_Trl pt ON (iol.M_Product_ID=pt.M_Product_ID AND uom.AD_Language=pt.AD_Language) + LEFT OUTER JOIN M_AttributeSetInstance asi ON (iol.M_AttributeSetInstance_ID=asi.M_AttributeSetInstance_ID) + LEFT OUTER JOIN M_Locator l ON (iol.M_Locator_ID=l.M_Locator_ID) + LEFT OUTER JOIN C_OrderLine ol ON (iol.C_OrderLine_ID=ol.C_OrderLine_ID) + LEFT OUTER JOIN C_Charge c ON (iol.C_Charge_ID=c.C_Charge_ID) +UNION +SELECT iol.AD_Client_ID, iol.AD_Org_ID, iol.IsActive, iol.Created, iol.CreatedBy, iol.Updated, iol.UpdatedBy, + uom.AD_Language, + iol.M_InOut_ID, iol.M_InOutLine_ID, + iol.Line+(b.Line/100) AS Line, p.M_Product_ID, + iol.MovementQty*b.BOMQty AS QtyInvoiced, iol.QtyEntered*b.BOMQty AS QtyEntered, uom.UOMSymbol, + null, null, null, + COALESCE (pt.Name, p.Name) AS Name, -- main line + b.Description, -- second line + COALESCE (pt.DocumentNote, p.DocumentNote) AS DocumentNote, -- third line + p.UPC, p.SKU, p.Value AS ProductValue, + iol.M_Locator_ID, l.M_Warehouse_ID, l.X, l.Y, l.Z, + iol.M_AttributeSetInstance_ID, asi.M_AttributeSet_ID, asi.SerNo, asi.Lot, asi.M_Lot_ID,asi.GuaranteeDate, + pt.Description AS ProductDescription, p.ImageURL, + iol.C_Campaign_ID, iol.C_Project_ID, iol.C_Activity_ID, iol.C_ProjectPhase_ID, iol.C_ProjectTask_ID +FROM M_Product_BOM b -- BOM lines + INNER JOIN M_InOutLine iol ON (b.M_Product_ID=iol.M_Product_ID) + INNER JOIN M_Product bp ON (bp.M_Product_ID=iol.M_Product_ID -- BOM Product + AND bp.IsBOM='Y' AND bp.IsVerified='Y' AND bp.IsPickListPrintDetails='Y') + INNER JOIN M_Product p ON (b.M_ProductBOM_ID=p.M_Product_ID) -- BOM line product + INNER JOIN C_UOM_Trl uom ON (p.C_UOM_ID=uom.C_UOM_ID) + INNER JOIN M_Product_Trl pt ON (iol.M_Product_ID=pt.M_Product_ID AND uom.AD_Language=pt.AD_Language) + LEFT OUTER JOIN M_AttributeSetInstance asi ON (iol.M_AttributeSetInstance_ID=asi.M_AttributeSetInstance_ID) + LEFT OUTER JOIN M_Locator l ON (iol.M_Locator_ID=l.M_Locator_ID); + + + diff --git a/db/ddlutils/postgresql/views/M_MOVEMENTLINEMA_V.sql b/db/ddlutils/postgresql/views/M_MOVEMENTLINEMA_V.sql new file mode 100644 index 0000000000..bcb84e3996 --- /dev/null +++ b/db/ddlutils/postgresql/views/M_MOVEMENTLINEMA_V.sql @@ -0,0 +1,17 @@ +CREATE OR REPLACE VIEW M_MOVEMENTLINEMA_V +(AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, + UPDATED, UPDATEDBY, M_MOVEMENT_ID, M_MOVEMENTLINE_ID, LINE, + M_PRODUCT_ID, M_ATTRIBUTESETINSTANCE_ID, MOVEMENTQTY, M_LOCATOR_ID, M_LOCATORTO_ID) +AS +SELECT m.AD_Client_ID, m.AD_Org_ID, m.IsActive, m.Created, m.CreatedBy, m.Updated, m.UpdatedBy, + l.M_Movement_ID, m.M_MovementLine_ID, l.Line, l.M_Product_ID, + m.M_AttributeSetInstance_ID, m.MovementQty, l.M_Locator_ID, l.M_LocatorTo_ID +FROM M_MovementLineMA m INNER JOIN M_MovementLine l ON (m.M_MovementLine_ID=l.M_MovementLine_ID) +UNION +SELECT AD_Client_ID, AD_Org_ID, IsActive, Created, CreatedBy, Updated, UpdatedBy, + M_Movement_ID, M_MovementLine_ID, Line, M_Product_ID, + M_AttributeSetInstance_ID, MovementQty, M_Locator_ID, M_LocatorTo_ID +FROM M_MovementLine; + + + diff --git a/db/ddlutils/postgresql/views/M_MOVEMENTLINEMA_VT.sql b/db/ddlutils/postgresql/views/M_MOVEMENTLINEMA_VT.sql new file mode 100644 index 0000000000..52e25d9825 --- /dev/null +++ b/db/ddlutils/postgresql/views/M_MOVEMENTLINEMA_VT.sql @@ -0,0 +1,17 @@ +CREATE OR REPLACE VIEW M_MOVEMENTLINEMA_VT +(AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, + UPDATED, UPDATEDBY, M_MOVEMENT_ID, M_MOVEMENTLINE_ID, LINE, + M_PRODUCT_ID, M_ATTRIBUTESETINSTANCE_ID, MOVEMENTQTY, M_LOCATOR_ID, M_LOCATORTO_ID) +AS +SELECT m.AD_Client_ID, m.AD_Org_ID, m.IsActive, m.Created, m.CreatedBy, m.Updated, m.UpdatedBy, + l.M_Movement_ID, m.M_MovementLine_ID, l.Line, l.M_Product_ID, + m.M_AttributeSetInstance_ID, m.MovementQty, l.M_Locator_ID, l.M_LocatorTo_ID +FROM M_MovementLineMA m INNER JOIN M_MovementLine l ON (m.M_MovementLine_ID=l.M_MovementLine_ID) +UNION +SELECT AD_Client_ID, AD_Org_ID, IsActive, Created, CreatedBy, Updated, UpdatedBy, + M_Movement_ID, M_MovementLine_ID, Line, M_Product_ID, + M_AttributeSetInstance_ID, MovementQty, M_Locator_ID, M_LocatorTo_ID +FROM M_MovementLine; + + + diff --git a/db/ddlutils/postgresql/views/M_TRANSACTION_V.sql b/db/ddlutils/postgresql/views/M_TRANSACTION_V.sql new file mode 100644 index 0000000000..18d8de6960 --- /dev/null +++ b/db/ddlutils/postgresql/views/M_TRANSACTION_V.sql @@ -0,0 +1,26 @@ +CREATE OR REPLACE VIEW M_TRANSACTION_V +(M_TRANSACTION_ID, AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, + CREATEDBY, UPDATED, UPDATEDBY, MOVEMENTTYPE, M_LOCATOR_ID, + M_PRODUCT_ID, MOVEMENTDATE, MOVEMENTQTY, M_INVENTORYLINE_ID, M_INVENTORY_ID, + M_MOVEMENTLINE_ID, M_MOVEMENT_ID, M_INOUTLINE_ID, M_INOUT_ID, M_PRODUCTIONLINE_ID, + M_PRODUCTION_ID, C_PROJECTISSUE_ID, C_PROJECT_ID, M_ATTRIBUTESETINSTANCE_ID) +AS +SELECT M_Transaction_ID, + t.AD_Client_ID, t.AD_Org_ID, t.IsActive, t.Created,t.CreatedBy, t.Updated,t.UpdatedBy, + t.MovementType, t.M_Locator_ID, t.M_Product_ID, t.MovementDate, t.MovementQty, + t.M_InventoryLine_ID, i.M_Inventory_ID, + t.M_MovementLine_ID, m.M_Movement_ID, + t.M_InOutLine_ID, io.M_InOut_ID, + t.M_ProductionLine_ID, pp.M_Production_ID, + t.C_ProjectIssue_ID, pi.C_Project_ID, + t.M_AttributeSetInstance_ID +FROM M_Transaction t + LEFT OUTER JOIN M_InOutLine io ON (t.M_InOutLine_ID=io.M_InOutLine_ID AND t.M_AttributeSetInstance_ID=io.M_AttributeSetInstance_ID) + LEFT OUTER JOIN M_MovementLine m ON (t.M_MovementLine_ID=m.M_MovementLine_ID AND t.M_AttributeSetInstance_ID=m.M_AttributeSetInstance_ID) + LEFT OUTER JOIN M_InventoryLine i ON (t.M_InventoryLine_ID=i.M_InventoryLine_ID AND t.M_AttributeSetInstance_ID=i.M_AttributeSetInstance_ID) + LEFT OUTER JOIN C_ProjectIssue pi ON (t.C_ProjectIssue_ID=pi.C_ProjectIssue_ID AND t.M_AttributeSetInstance_ID=pi.M_AttributeSetInstance_ID) + LEFT OUTER JOIN M_ProductionLine pl ON (t.M_ProductionLine_ID=pl.M_ProductionLine_ID AND t.M_AttributeSetInstance_ID=pl.M_AttributeSetInstance_ID) + LEFT OUTER JOIN M_ProductionPlan pp ON (pl.M_ProductionPlan_ID=pp.M_ProductionPlan_ID); + + + diff --git a/db/ddlutils/postgresql/views/RV_ALLOCATION.sql b/db/ddlutils/postgresql/views/RV_ALLOCATION.sql new file mode 100644 index 0000000000..d81f630e0a --- /dev/null +++ b/db/ddlutils/postgresql/views/RV_ALLOCATION.sql @@ -0,0 +1,20 @@ +CREATE OR REPLACE VIEW RV_ALLOCATION +(C_ALLOCATIONHDR_ID, AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, + CREATEDBY, UPDATED, UPDATEDBY, DOCUMENTNO, DESCRIPTION, + DATETRX, DATEACCT, C_CURRENCY_ID, APPROVALAMT, ISMANUAL, + DOCSTATUS, DOCACTION, PROCESSED, C_ALLOCATIONLINE_ID, C_INVOICE_ID, + C_BPARTNER_ID, C_ORDER_ID, C_PAYMENT_ID, C_CASHLINE_ID, AMOUNT, + DISCOUNTAMT, WRITEOFFAMT, OVERUNDERAMT) +AS +SELECT h.C_AllocationHdr_ID, h.AD_Client_ID, h.AD_Org_ID, + h.IsActive, h.Created, h.CreatedBy, h.Updated, h.UpdatedBy, + h.DocumentNo, h.Description, h.DateTrx, h.DateAcct, + h.C_Currency_ID, h.ApprovalAmt, h.IsManual, h.DocStatus, h.DocAction, h.Processed, + l.C_AllocationLine_ID, + l.C_Invoice_ID, l.C_BPartner_ID, l.C_Order_ID, l.C_Payment_ID, l.C_CashLine_ID, + l.Amount, l.DiscountAmt, l.WriteOffAmt, l.OverUnderAmt +FROM C_AllocationHdr h + INNER JOIN C_AllocationLine l ON (h.C_AllocationHdr_ID=l.C_AllocationHdr_ID); + + + diff --git a/db/ddlutils/postgresql/views/RV_ASSET_CUSTOMER.sql b/db/ddlutils/postgresql/views/RV_ASSET_CUSTOMER.sql new file mode 100644 index 0000000000..d4741ed942 --- /dev/null +++ b/db/ddlutils/postgresql/views/RV_ASSET_CUSTOMER.sql @@ -0,0 +1,17 @@ +CREATE OR REPLACE VIEW RV_ASSET_CUSTOMER +(A_ASSET_ID, AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, + CREATEDBY, UPDATED, UPDATEDBY, VALUE, NAME, + DESCRIPTION, HELP, A_ASSET_GROUP_ID, M_PRODUCT_ID, SERNO, + LOT, VERSIONNO, GUARANTEEDATE, ASSETSERVICEDATE, C_BPARTNER_ID, + C_BPARTNER_LOCATION_ID, AD_USER_ID, DELIVERYCOUNT) +AS +SELECT A_Asset_ID, AD_Client_ID, AD_Org_ID, IsActive, Created, CreatedBy, Updated, UpdatedBy, + Value, Name, Description, Help, A_Asset_Group_ID, M_Product_ID, SerNo, Lot, VersionNo, + GuaranteeDate, AssetServiceDate, + C_BPartner_ID, C_BPartner_Location_ID, AD_User_ID, + (SELECT COUNT(*) FROM A_Asset_Delivery ad WHERE a.A_Asset_ID=ad.A_Asset_ID) AS DeliveryCount +FROM A_Asset a +WHERE C_BPartner_ID IS NOT NULL; + + + diff --git a/db/ddlutils/postgresql/views/RV_ASSET_DELIVERY.sql b/db/ddlutils/postgresql/views/RV_ASSET_DELIVERY.sql new file mode 100644 index 0000000000..6a6f3a4b10 --- /dev/null +++ b/db/ddlutils/postgresql/views/RV_ASSET_DELIVERY.sql @@ -0,0 +1,22 @@ +CREATE OR REPLACE VIEW RV_ASSET_DELIVERY +(A_ASSET_DELIVERY_ID, AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, + CREATEDBY, UPDATED, UPDATEDBY, A_ASSET_ID, A_ASSET_GROUP_ID, + M_PRODUCT_ID, GUARANTEEDATE, ASSETSERVICEDATE, C_BPARTNER_ID, AD_USER_ID, + MOVEMENTDATE, SERNO, LOT, VERSIONNO, M_INOUTLINE_ID, + EMAIL, MESSAGEID, DELIVERYCONFIRMATION, URL, REMOTE_ADDR, + REMOTE_HOST, REFERRER, DESCRIPTION) +AS +SELECT ad.A_Asset_Delivery_ID, ad.AD_Client_ID, ad.AD_Org_ID, ad.IsActive, ad.Created, ad.CreatedBy, ad.Updated, ad.UpdatedBy, + a.A_Asset_ID, a.A_Asset_Group_ID, a.M_Product_ID, + a.GuaranteeDate, a.AssetServiceDate, + a.C_BPartner_ID, ad.AD_User_ID, + ad.MovementDate, ad.SerNo, ad.Lot, ad.VersionNo, + ad.M_InOutLine_ID, + ad.Email, ad.MessageID, ad.DeliveryConfirmation, + ad.URL, ad.Remote_Addr, ad.Remote_Host, ad.Referrer, + ad.Description +FROM A_Asset_Delivery ad + INNER JOIN A_Asset a ON (a.A_Asset_ID=ad.A_Asset_ID); + + + diff --git a/db/ddlutils/postgresql/views/RV_ASSET_SUMMONTH.sql b/db/ddlutils/postgresql/views/RV_ASSET_SUMMONTH.sql new file mode 100644 index 0000000000..cd2dce6878 --- /dev/null +++ b/db/ddlutils/postgresql/views/RV_ASSET_SUMMONTH.sql @@ -0,0 +1,25 @@ +CREATE OR REPLACE VIEW RV_ASSET_SUMMONTH +(AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, + UPDATED, UPDATEDBY, A_ASSET_ID, A_ASSET_GROUP_ID, M_PRODUCT_ID, + VALUE, NAME, DESCRIPTION, HELP, GUARANTEEDATE, + ASSETSERVICEDATE, C_BPARTNER_ID, AD_USER_ID, SERNO, LOT, + VERSIONNO, MOVEMENTDATE, DELIVERYCOUNT) +AS +SELECT a.AD_Client_ID, a.AD_Org_ID, a.IsActive, a.Created, a.CreatedBy, a.Updated, a.UpdatedBy, + a.A_Asset_ID, a.A_Asset_Group_ID, a.M_Product_ID, + a.Value, a.Name, a.Description, a.Help, + a.GuaranteeDate, a.AssetServiceDate, + a.C_BPartner_ID, a.AD_User_ID, a.SerNo, a.Lot, a.VersionNo, + firstOf(ad.MovementDate, 'MM') AS MovementDate, + COUNT(*) AS DeliveryCount +FROM A_Asset a + INNER JOIN A_Asset_Delivery ad ON (a.A_Asset_ID=ad.A_Asset_ID) +GROUP BY a.AD_Client_ID, a.AD_Org_ID, a.IsActive, a.Created, a.CreatedBy, a.Updated, a.UpdatedBy, + a.A_Asset_ID, a.A_Asset_Group_ID, a.M_Product_ID, + a.Value, a.Name, a.Description, a.Help, + a.GuaranteeDate, a.AssetServiceDate, + a.C_BPartner_ID, a.AD_User_ID, a.SerNo, a.Lot, a.VersionNo, + firstOf(ad.MovementDate, 'MM'); + + + diff --git a/db/ddlutils/postgresql/views/RV_BPARTNER.sql b/db/ddlutils/postgresql/views/RV_BPARTNER.sql new file mode 100644 index 0000000000..19720289aa --- /dev/null +++ b/db/ddlutils/postgresql/views/RV_BPARTNER.sql @@ -0,0 +1,59 @@ +CREATE OR REPLACE VIEW RV_BPARTNER +(AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, + UPDATED, UPDATEDBY, C_BPARTNER_ID, VALUE, NAME, + NAME2, DESCRIPTION, ISSUMMARY, C_BP_GROUP_ID, ISONETIME, + ISPROSPECT, ISVENDOR, ISCUSTOMER, ISEMPLOYEE, ISSALESREP, + REFERENCENO, DUNS, URL, AD_LANGUAGE, TAXID, + ISTAXEXEMPT, C_INVOICESCHEDULE_ID, RATING, SALESVOLUME, NUMBEREMPLOYEES, + NAICS, FIRSTSALE, ACQUSITIONCOST, POTENTIALLIFETIMEVALUE, ACTUALLIFETIMEVALUE, + SHAREOFCUSTOMER, PAYMENTRULE, SO_CREDITLIMIT, SO_CREDITUSED, SO_CREDITAVAILABLE, + C_PAYMENTTERM_ID, M_PRICELIST_ID, M_DISCOUNTSCHEMA_ID, C_DUNNING_ID, ISDISCOUNTPRINTED, + SO_DESCRIPTION, POREFERENCE, PAYMENTRULEPO, PO_PRICELIST_ID, PO_DISCOUNTSCHEMA_ID, + PO_PAYMENTTERM_ID, DOCUMENTCOPIES, C_GREETING_ID, INVOICERULE, DELIVERYRULE, + FREIGHTCOSTRULE, DELIVERYVIARULE, SALESREP_ID, SENDEMAIL, BPARTNER_PARENT_ID, + INVOICE_PRINTFORMAT_ID, SOCREDITSTATUS, SHELFLIFEMINPCT, AD_ORGBP_ID, FLATDISCOUNT, + TOTALOPENBALANCE, AD_USER_ID, CONTACTNAME, CONTACTDESCRIPTION, EMAIL, + SUPERVISOR_ID, EMAILUSER, BPCONTACTGREETING, TITLE, COMMENTS, + PHONE, PHONE2, FAX, LASTCONTACT, LASTRESULT, + BIRTHDAY, AD_ORGTRX_ID, EMAILVERIFY, LDAPUSER, EMAILVERIFYDATE, + NOTIFICATIONTYPE, C_BPARTNER_LOCATION_ID, POSTAL, CITY, ADDRESS1, + ADDRESS2, ADDRESS3, C_REGION_ID, REGIONNAME, C_COUNTRY_ID, + COUNTRYNAME) +AS +SELECT bp.AD_Client_ID, bp.AD_Org_ID, + bp.IsActive, bp.Created, bp.CreatedBy, bp.Updated, bp.UpdatedBy, + bp.C_BPartner_ID, bp.Value, bp.Name, bp.Name2, bp.Description, bp.IsSummary, + bp.C_BP_Group_ID, bp.IsOneTime, bp.IsProspect, bp.IsVendor, bp.IsCustomer, bp.IsEmployee, bp.IsSalesRep, + bp.ReferenceNo, bp.Duns, bp.URL, bp.AD_Language, bp.TaxID, bp.IsTaxExempt, + bp.C_InvoiceSchedule_ID, bp.Rating, bp.SalesVolume, bp.NumberEmployees, bp.NAICS, + bp.FirstSale, bp.AcqusitionCost, bp.PotentialLifeTimeValue, bp.ActualLifeTimeValue, + bp.ShareOfCustomer, bp.PaymentRule, + bp.SO_CreditLimit, bp.SO_CreditUsed, bp.SO_CreditUsed-bp.SO_CreditLimit AS SO_CreditAvailable, + bp.C_PaymentTerm_ID, bp.M_PriceList_ID, bp.M_DiscountSchema_ID, bp.C_Dunning_ID, + bp.IsDiscountPrinted, bp.SO_Description, bp.POReference, PaymentRulePO, + bp.PO_PriceList_ID, bp.PO_DiscountSchema_ID, bp.PO_PaymentTerm_ID, + bp.DocumentCopies, bp.C_Greeting_ID, bp.InvoiceRule, bp.DeliveryRule, + bp.FreightCostRule, bp.DeliveryViaRule, bp.SalesRep_ID, + bp.SendEMail, bp.BPartner_Parent_ID, bp.Invoice_PrintFormat_ID, + bp.SOCreditStatus, bp.ShelfLifeMinPct, bp.AD_OrgBP_ID, + bp.FlatDiscount, bp.TotalOpenBalance, + -- Contact + c.AD_User_ID, c.Name AS ContactName, c.Description AS ContactDescription, + c.EMail, c.Supervisor_ID, + c.EMailUser, c.C_Greeting_ID AS BPContactGreeting, + c.Title, c.Comments, c.Phone, c.Phone2, c.Fax, + c.LastContact, c.LastResult, c.BirthDay, c.AD_OrgTrx_ID, + c.EMailVerify, c.LDAPUser, c.EMailVerifyDate, c.NotificationType, + -- Location + l.C_BPartner_Location_ID, a.Postal, a.City, a.Address1, a.Address2, a.Address3, + a.C_Region_ID, COALESCE(r.Name,a.RegionName) AS RegionName, + a.C_Country_ID, cc.Name AS CountryName +FROM C_BPartner bp + LEFT OUTER JOIN C_BPartner_Location l ON (bp.C_BPartner_ID=l.C_BPartner_ID AND l.IsActive='Y') + LEFT OUTER JOIN AD_User c ON (bp.C_BPartner_ID=c.C_BPartner_ID AND (c.C_BPartner_Location_ID IS NULL OR c.C_BPartner_Location_ID=l.C_BPartner_Location_ID) AND c.IsActive='Y') + LEFT OUTER JOIN C_Location a ON (l.C_Location_ID=a.C_Location_ID) + LEFT OUTER JOIN C_Region r ON (a.C_Region_ID=r.C_Region_ID) + INNER JOIN C_Country cc ON (a.C_Country_ID=cc.C_Country_ID); + + + diff --git a/db/ddlutils/postgresql/views/RV_BPARTNEROPEN.sql b/db/ddlutils/postgresql/views/RV_BPARTNEROPEN.sql new file mode 100644 index 0000000000..5a8f04d326 --- /dev/null +++ b/db/ddlutils/postgresql/views/RV_BPARTNEROPEN.sql @@ -0,0 +1,31 @@ +CREATE OR REPLACE VIEW RV_BPARTNEROPEN +(AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, + UPDATED, UPDATEDBY, C_BPARTNER_ID, C_CURRENCY_ID, AMT, + OPENAMT, DATEDOC, DAYSDUE, C_CAMPAIGN_ID, C_PROJECT_ID, + C_ACTIVITY_ID) +AS +SELECT i.AD_Client_ID,i.AD_Org_ID, i.IsActive, i.Created,i.CreatedBy,i.Updated,i.UpdatedBy, + i.C_BPartner_ID, i.C_Currency_ID, + i.GrandTotal*i.MultiplierAP AS Amt, + invoiceOpen (i.C_Invoice_ID, i.C_InvoicePaySchedule_ID)*MultiplierAP AS OpenAmt, + i.DateInvoiced AS DateDoc, + COALESCE(daysBetween(getdate(),ips.DueDate), paymentTermDueDays(C_PaymentTerm_ID,DateInvoiced,getdate())) AS DaysDue, + i.C_Campaign_ID, i.C_Project_ID, i.C_Activity_ID +FROM C_Invoice_v i + LEFT OUTER JOIN C_InvoicePaySchedule ips ON (i.C_InvoicePaySchedule_ID=ips.C_InvoicePaySchedule_ID) +WHERE IsPaid='N' + AND DocStatus IN ('CO','CL') +UNION +SELECT p.AD_Client_ID,p.AD_Org_ID, p.IsActive, p.Created,p.CreatedBy,p.Updated,p.UpdatedBy, + p.C_BPartner_ID, p.C_Currency_ID, + p.PayAmt*MultiplierAP*-1 AS Amt, + paymentAvailable(p.C_Payment_ID)*p.MultiplierAP*-1 AS OpenAmt, + p.DateTrx AS DateDoc, + null, + p.C_Campaign_ID, p.C_Project_ID, p.C_Activity_ID +FROM C_Payment_v p +WHERE p.IsAllocated='N' AND p.C_BPartner_ID IS NOT NULL + AND p.DocStatus IN ('CO','CL'); + + + diff --git a/db/ddlutils/postgresql/views/RV_CASH_DETAIL.sql b/db/ddlutils/postgresql/views/RV_CASH_DETAIL.sql new file mode 100644 index 0000000000..2ea507b6b0 --- /dev/null +++ b/db/ddlutils/postgresql/views/RV_CASH_DETAIL.sql @@ -0,0 +1,19 @@ +CREATE OR REPLACE VIEW RV_CASH_DETAIL +(C_CASH_ID, C_CASHLINE_ID, AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, + CREATED, CREATEDBY, UPDATED, UPDATEDBY, C_CASHBOOK_ID, + NAME, STATEMENTDATE, DATEACCT, PROCESSED, POSTED, + LINE, DESCRIPTION, CASHTYPE, C_CURRENCY_ID, AMOUNT, + CONVERTEDAMT, C_BANKACCOUNT_ID, C_INVOICE_ID, C_CHARGE_ID) +AS +SELECT cl.C_Cash_ID, cl.C_CashLine_ID, + c.AD_Client_ID, c.AD_Org_ID, cl.IsActive, cl.Created, cl.CreatedBy, cl.Updated, cl.UpdatedBy, + c.C_CashBook_ID, c.Name, c.StatementDate, c.DateAcct, c.Processed, c.Posted, + cl.Line, cl.Description, cl.CashType, cl.C_Currency_ID, cl.Amount, + currencyConvert(cl.Amount,cl.C_Currency_ID,cb.C_Currency_ID,c.StatementDate,0, c.AD_Client_ID, c.AD_Org_ID) AS ConvertedAmt, + cl.C_BankAccount_ID, cl.C_Invoice_ID, cl.C_Charge_ID +FROM C_Cash c + INNER JOIN C_CashLine cl ON (c.C_Cash_ID=cl.C_Cash_ID) + INNER JOIN C_CashBook cb ON (c.C_CashBook_ID=cb.C_CashBook_ID); + + + diff --git a/db/ddlutils/postgresql/views/RV_CLICK_MONTH.sql b/db/ddlutils/postgresql/views/RV_CLICK_MONTH.sql new file mode 100644 index 0000000000..f130f06c40 --- /dev/null +++ b/db/ddlutils/postgresql/views/RV_CLICK_MONTH.sql @@ -0,0 +1,17 @@ +CREATE OR REPLACE VIEW RV_CLICK_MONTH +(AD_CLIENT_ID, AD_ORG_ID, NAME, DESCRIPTION, TARGETURL, + C_BPARTNER_ID, CREATED, COUNTER) +AS +SELECT cc.AD_Client_ID, cc.AD_Org_ID, + cc.Name, cc.Description, cc.TargetURL, cc.C_BPartner_ID, + firstOf(c.Created,'MM') AS Created, + COUNT(*) AS Counter +FROM W_ClickCount cc + INNER JOIN W_Click c ON (cc.W_ClickCount_ID=c.W_ClickCount_ID) +WHERE cc.IsActive='Y' +GROUP BY cc.AD_Client_ID, cc.AD_Org_ID, + cc.Name, cc.Description, cc.TargetURL, cc.C_BPartner_ID, + firstOf(c.Created,'MM'); + + + diff --git a/db/ddlutils/postgresql/views/RV_CLICK_UNPROCESSED.sql b/db/ddlutils/postgresql/views/RV_CLICK_UNPROCESSED.sql new file mode 100644 index 0000000000..8219c65666 --- /dev/null +++ b/db/ddlutils/postgresql/views/RV_CLICK_UNPROCESSED.sql @@ -0,0 +1,14 @@ +CREATE OR REPLACE VIEW RV_CLICK_UNPROCESSED +(W_CLICK_ID, AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, + CREATEDBY, UPDATED, UPDATEDBY, TARGETURL, REFERRER, + REMOTE_HOST, REMOTE_ADDR, USERAGENT, ACCEPTLANGUAGE, PROCESSED, + W_CLICKCOUNT_ID, AD_USER_ID, EMAIL) +AS +SELECT W_CLICK_ID,AD_CLIENT_ID,AD_ORG_ID,ISACTIVE,CREATED,CREATEDBY,UPDATED, +UPDATEDBY,TARGETURL,REFERRER,REMOTE_HOST,REMOTE_ADDR,USERAGENT,ACCEPTLANGUAGE, +PROCESSED,W_CLICKCOUNT_ID,AD_USER_ID,EMAIL +FROM W_Click +WHERE W_ClickCount_ID IS NULL OR Processed='N'; + + + diff --git a/db/ddlutils/postgresql/views/RV_COMMISSIONRUNDETAIL.sql b/db/ddlutils/postgresql/views/RV_COMMISSIONRUNDETAIL.sql new file mode 100644 index 0000000000..651a6212f0 --- /dev/null +++ b/db/ddlutils/postgresql/views/RV_COMMISSIONRUNDETAIL.sql @@ -0,0 +1,46 @@ +CREATE OR REPLACE VIEW RV_COMMISSIONRUNDETAIL +(AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, + UPDATED, UPDATEDBY, C_COMMISSIONRUN_ID, DOCUMENTNO, DESCRIPTION, + STARTDATE, GRANDTOTAL, PROCESSED, C_COMMISSION_ID, COMMISSION_BPARTNER_ID, + C_COMMISSIONAMT_ID, COMMISSIONCONVERTEDAMT, COMMISSIONQTY, COMMISSIONAMT, C_COMMISSIONDETAIL_ID, + REFERENCE, C_ORDERLINE_ID, C_INVOICELINE_ID, INFO, C_CURRENCY_ID, + ACTUALAMT, CONVERTEDAMT, ACTUALQTY, INVOICEDOCUMENTNO, DATEDOC, + M_PRODUCT_ID, C_BPARTNER_ID, C_BPARTNER_LOCATION_ID, AD_USER_ID, C_DOCTYPE_ID) +AS +SELECT cr.AD_Client_ID, cr.AD_Org_ID, cr.IsActive, cr.Created,cr.CreatedBy, cr.Updated,cr.UpdatedBy, + -- Run + cr.C_CommissionRun_ID, cr.DocumentNo, cr.Description, + cr.StartDate, cr.GrandTotal, cr.Processed, + -- Commission + c.C_Commission_ID, c.C_BPartner_ID AS Commission_BPartner_ID, + -- Commission Amount + ca.C_CommissionAmt_ID, + ca.ConvertedAmt AS CommissionConvertedAmt, ca.ActualQty AS CommissionQty, + ca.CommissionAmt, + -- Commission Detail + cd.C_CommissionDetail_ID, + cd.Reference, + cd.C_OrderLine_ID, + cd.C_InvoiceLine_ID, + cd.Info, + cd.C_Currency_ID, cd.ActualAmt, cd.ConvertedAmt, + cd.ActualQty, + -- Invoice/Order + i.DocumentNo AS InvoiceDocumentNo, + COALESCE (i.DateInvoiced, o.DateOrdered) AS DateDoc, + COALESCE (il.M_Product_ID,ol.M_Product_ID) AS M_Product_ID, + COALESCE (i.C_BPartner_ID,o.C_BPartner_ID) AS C_BPartner_ID, + COALESCE (i.C_BPartner_Location_ID,o.C_BPartner_Location_ID) AS C_BPartner_Location_ID, + COALESCE (i.AD_User_ID,o.AD_User_ID) AS AD_User_ID, + COALESCE (i.C_DocType_ID,o.C_DocType_ID) AS C_DocType_ID +FROM C_CommissionRun cr + INNER JOIN C_Commission c ON (cr.C_Commission_ID=c.C_Commission_ID) + INNER JOIN C_CommissionAmt ca ON (cr.C_CommissionRun_ID=ca.C_CommissionRun_ID) + INNER JOIN C_CommissionDetail cd ON (ca.C_CommissionAmt_ID=cd.C_CommissionAmt_ID) + LEFT OUTER JOIN C_OrderLine ol ON (cd.C_OrderLine_ID=ol.C_OrderLine_ID) + LEFT OUTER JOIN C_InvoiceLine il ON (cd.C_InvoiceLine_ID=il.C_InvoiceLine_ID) + LEFT OUTER JOIN C_Order o ON (ol.C_Order_ID=o.C_Order_ID) + LEFT OUTER JOIN C_Invoice i ON (il.C_Invoice_ID=i.C_Invoice_ID); + + + diff --git a/db/ddlutils/postgresql/views/RV_COST.sql b/db/ddlutils/postgresql/views/RV_COST.sql new file mode 100644 index 0000000000..117a9fe76c --- /dev/null +++ b/db/ddlutils/postgresql/views/RV_COST.sql @@ -0,0 +1,20 @@ +CREATE OR REPLACE VIEW RV_COST +(AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, + UPDATED, UPDATEDBY, M_PRODUCT_ID, VALUE, NAME, + UPC, ISBOM, PRODUCTTYPE, M_PRODUCT_CATEGORY_ID, M_COSTTYPE_ID, + M_COSTELEMENT_ID, COSTELEMENTTYPE, COSTINGMETHOD, ISCALCULATED, C_ACCTSCHEMA_ID, + C_CURRENCY_ID, CURRENTCOSTPRICE, FUTURECOSTPRICE, DESCRIPTION) +AS +SELECT c.AD_Client_ID, c.AD_Org_ID, c.IsActive, c.Created,c.CreatedBy,c.Updated,c.UpdatedBy, + p.M_Product_ID, p.Value, p.Name, p.UPC, p.IsBOM, p.ProductType, p.M_Product_Category_ID, + c.M_CostType_ID, + ce.M_CostElement_ID, ce.CostElementType, ce.CostingMethod, ce.IsCalculated, + acct.C_AcctSchema_ID, acct.C_Currency_ID, + c.CurrentCostPrice, c.FutureCostPrice, c.Description +FROM M_Cost c + INNER JOIN M_Product p ON (c.M_Product_ID=p.M_Product_ID) + INNER JOIN M_CostElement ce ON (c.M_CostElement_ID=ce.M_CostElement_ID) + INNER JOIN C_AcctSchema acct ON (c.C_AcctSchema_ID=acct.C_AcctSchema_ID); + + + diff --git a/db/ddlutils/postgresql/views/RV_COSTDETAIL.sql b/db/ddlutils/postgresql/views/RV_COSTDETAIL.sql new file mode 100644 index 0000000000..e491605b98 --- /dev/null +++ b/db/ddlutils/postgresql/views/RV_COSTDETAIL.sql @@ -0,0 +1,21 @@ +CREATE OR REPLACE VIEW RV_COSTDETAIL +(AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, + UPDATED, UPDATEDBY, M_PRODUCT_ID, VALUE, NAME, + UPC, ISBOM, PRODUCTTYPE, M_PRODUCT_CATEGORY_ID, M_INOUTLINE_ID, + C_INVOICELINE_ID, M_ATTRIBUTESETINSTANCE_ID, M_ATTRIBUTESET_ID, LOT, SERNO, + C_ACCTSCHEMA_ID, C_CURRENCY_ID, AMT, QTY, DESCRIPTION, + PROCESSED) +AS +SELECT c.AD_Client_ID, c.AD_Org_ID, c.IsActive, c.Created,c.CreatedBy,c.Updated,c.UpdatedBy, + p.M_Product_ID, p.Value, p.Name, p.UPC, p.IsBOM, p.ProductType, p.M_Product_Category_ID, + c.M_InOutLine_ID, c.C_InvoiceLine_ID, + asi.M_AttributeSetInstance_ID, asi.M_AttributeSet_ID, asi.Lot, asi.SerNo, + acct.C_AcctSchema_ID, acct.C_Currency_ID, + c.Amt, c.Qty, c.Description, Processed +FROM M_CostDetail c + INNER JOIN M_Product p ON (c.M_Product_ID=p.M_Product_ID) + INNER JOIN C_AcctSchema acct ON (c.C_AcctSchema_ID=acct.C_AcctSchema_ID) + INNER JOIN M_AttributeSetInstance asi ON (c.M_AttributeSetInstance_ID=asi.M_AttributeSetInstance_ID); + + + diff --git a/db/ddlutils/postgresql/views/RV_COSTSUMMARY.sql b/db/ddlutils/postgresql/views/RV_COSTSUMMARY.sql new file mode 100644 index 0000000000..93671a2271 --- /dev/null +++ b/db/ddlutils/postgresql/views/RV_COSTSUMMARY.sql @@ -0,0 +1,21 @@ +CREATE OR REPLACE VIEW RV_COSTSUMMARY +(AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATEDBY, CREATED, + UPDATEDBY, UPDATED, M_PRODUCT_ID, VALUE, NAME, + UPC, ISBOM, PRODUCTTYPE, M_PRODUCT_CATEGORY_ID, M_COSTTYPE_ID, + C_ACCTSCHEMA_ID, C_CURRENCY_ID, CURRENTCOSTPRICE, FUTURECOSTPRICE) +AS +SELECT c.AD_Client_ID, c.AD_Org_ID, c.IsActive, 0 AS CreatedBy,getdate() AS Created,0 AS UpdatedBy,getdate() AS Updated, + p.M_Product_ID, p.Value, p.Name, p.UPC, p.IsBOM, p.ProductType, p.M_Product_Category_ID, + c.M_CostType_ID, + acct.C_AcctSchema_ID, acct.C_Currency_ID, + SUM(c.CurrentCostPrice) AS CurrentCostPrice, SUM(c.FutureCostPrice) AS FutureCostPrice +FROM M_Cost c + INNER JOIN M_Product p ON (c.M_Product_ID=p.M_Product_ID) + INNER JOIN C_AcctSchema acct ON (c.C_AcctSchema_ID=acct.C_AcctSchema_ID) +WHERE acct.M_CostType_ID=c.M_CostType_ID +GROUP BY c.AD_Client_ID, c.AD_Org_ID, c.IsActive, + p.M_Product_ID, p.Value, p.Name, p.UPC, p.IsBOM, p.ProductType, p.M_Product_Category_ID, + c.M_CostType_ID, acct.C_AcctSchema_ID, acct.C_Currency_ID; + + + diff --git a/db/ddlutils/postgresql/views/RV_C_INVOICE.sql b/db/ddlutils/postgresql/views/RV_C_INVOICE.sql new file mode 100644 index 0000000000..8b1bf85407 --- /dev/null +++ b/db/ddlutils/postgresql/views/RV_C_INVOICE.sql @@ -0,0 +1,38 @@ +CREATE OR REPLACE VIEW RV_C_INVOICE +(C_INVOICE_ID, AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, + CREATEDBY, UPDATED, UPDATEDBY, ISSOTRX, DOCUMENTNO, + DOCSTATUS, DOCACTION, ISPRINTED, ISDISCOUNTPRINTED, PROCESSING, + PROCESSED, ISTRANSFERRED, ISPAID, C_DOCTYPE_ID, C_DOCTYPETARGET_ID, + C_ORDER_ID, DESCRIPTION, ISAPPROVED, SALESREP_ID, DATEINVOICED, + DATEPRINTED, DATEACCT, C_BPARTNER_ID, C_BPARTNER_LOCATION_ID, AD_USER_ID, + C_BP_GROUP_ID, POREFERENCE, DATEORDERED, C_CURRENCY_ID, C_CONVERSIONTYPE_ID, + PAYMENTRULE, C_PAYMENTTERM_ID, M_PRICELIST_ID, C_CAMPAIGN_ID, C_PROJECT_ID, + C_ACTIVITY_ID, ISPAYSCHEDULEVALID, INVOICECOLLECTIONTYPE, C_COUNTRY_ID, C_REGION_ID, + POSTAL, CITY, C_CHARGE_ID, CHARGEAMT, TOTALLINES, + GRANDTOTAL, MULTIPLIER) +AS +SELECT i.C_Invoice_ID, + i.AD_Client_ID,i.AD_Org_ID,i.IsActive,i.Created,i.CreatedBy,i.Updated,i.UpdatedBy, + i.IsSOTrx, i.DocumentNo, i.DocStatus, i.DocAction, + i.IsPrinted, i.IsDiscountPrinted, i.Processing, i.Processed, i.IsTransferred, i.IsPaid, + i.C_DocType_ID, i.C_DocTypeTarget_ID, i.C_Order_ID, i.Description, i.IsApproved, + i.SalesRep_ID, i.DateInvoiced, i.DatePrinted, i.DateAcct, + i.C_BPartner_ID, i.C_BPartner_Location_ID, i.AD_User_ID, b.C_BP_Group_ID, + i.POReference, i.DateOrdered, i.C_Currency_ID, C_ConversionType_ID, i.PaymentRule, i.C_PaymentTerm_ID, + i.M_PriceList_ID, i.C_Campaign_ID, i.C_Project_ID, i.C_Activity_ID, + i.IsPayScheduleValid, i.InvoiceCollectionType, + loc.C_Country_ID, loc.C_Region_ID, loc.Postal, loc.City, + -- Amounts + i.C_Charge_ID, + CASE WHEN charAt(d.DocBaseType,3)='C' THEN i.ChargeAmt*-1 ELSE i.ChargeAmt END AS ChargeAmt, + CASE WHEN charAt(d.DocBaseType,3)='C' THEN i.TotalLines*-1 ELSE i.TotalLines END AS TotalLines, + CASE WHEN charAt(d.DocBaseType,3)='C' THEN i.GrandTotal*-1 ELSE i.GrandTotal END AS GrandTotal, + CASE WHEN charAt(d.DocBaseType,3)='C' THEN -1 ELSE 1 END AS Multiplier +FROM C_Invoice i + INNER JOIN C_DocType d ON (i.C_DocType_ID=d.C_DocType_ID) + INNER JOIN C_BPartner b ON (i.C_BPartner_ID=b.C_BPartner_ID) + INNER JOIN C_BPartner_Location bpl ON (i.C_BPartner_Location_ID=bpl.C_BPartner_Location_ID) + INNER JOIN C_Location loc ON (bpl.C_Location_ID=loc.C_Location_ID); + + + diff --git a/db/ddlutils/postgresql/views/RV_C_INVOICELINE.sql b/db/ddlutils/postgresql/views/RV_C_INVOICELINE.sql new file mode 100644 index 0000000000..62dacc2e32 --- /dev/null +++ b/db/ddlutils/postgresql/views/RV_C_INVOICELINE.sql @@ -0,0 +1,48 @@ +CREATE OR REPLACE VIEW RV_C_INVOICELINE +(AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, + UPDATED, UPDATEDBY, C_INVOICELINE_ID, C_INVOICE_ID, SALESREP_ID, + C_BPARTNER_ID, C_BP_GROUP_ID, M_PRODUCT_ID, M_PRODUCT_CATEGORY_ID, DATEINVOICED, + DATEACCT, ISSOTRX, C_DOCTYPE_ID, DOCSTATUS, ISPAID, + C_CAMPAIGN_ID, C_PROJECT_ID, C_ACTIVITY_ID, C_PROJECTPHASE_ID, C_PROJECTTASK_ID, + QTYINVOICED, QTYENTERED, M_ATTRIBUTESETINSTANCE_ID, PRODUCTATTRIBUTE, M_ATTRIBUTESET_ID, + M_LOT_ID, GUARANTEEDATE, LOT, SERNO, PRICELIST, + PRICEACTUAL, PRICELIMIT, PRICEENTERED, DISCOUNT, MARGIN, + MARGINAMT, LINENETAMT, LINELISTAMT, LINELIMITAMT, LINEDISCOUNTAMT, + LINEOVERLIMITAMT) +AS +SELECT + il.AD_Client_ID, il.AD_Org_ID, il.IsActive, il.Created, il.CreatedBy, il.Updated, il.UpdatedBy, + il.C_InvoiceLine_ID, i.C_Invoice_ID, i.SalesRep_ID, + i.C_BPartner_ID, i.C_BP_Group_ID, + il.M_Product_ID, p.M_Product_Category_ID, + i.DateInvoiced, i.DateAcct, i.IsSOTrx, i.C_DocType_ID, i.DocStatus, i.IsPaid, + il.C_Campaign_ID, il.C_Project_ID, il.C_Activity_ID, il.C_ProjectPhase_ID, il.C_ProjectTask_ID, + -- Qty + il.QtyInvoiced*i.Multiplier AS QtyInvoiced, + il.QtyEntered*i.Multiplier AS QtyEntered, + -- Attributes + il.M_AttributeSetInstance_ID, productAttribute(il.M_AttributeSetInstance_ID) AS ProductAttribute, + pasi.M_AttributeSet_ID, pasi.M_Lot_ID, pasi.GuaranteeDate, pasi.Lot, pasi.SerNo, + -- Item Amounts + il.PriceList, il.PriceActual, il.PriceLimit, il.PriceEntered, + CASE WHEN PriceList=0 THEN 0 ELSE + ROUND((PriceList-PriceActual)/PriceList*100,2) END AS Discount, + CASE WHEN PriceLimit=0 THEN 0 ELSE + ROUND((PriceActual-PriceLimit)/PriceLimit*100,2) END AS Margin, + CASE WHEN PriceLimit=0 THEN 0 ELSE + (PriceActual-PriceLimit)*QtyInvoiced END AS MarginAmt, + -- Line Amounts + ROUND(i.Multiplier*LineNetAmt, 2) AS LineNetAmt, + ROUND(i.Multiplier*PriceList*QtyInvoiced, 2) AS LineListAmt, + CASE WHEN COALESCE(il.PriceLimit, 0)=0 THEN ROUND(i.Multiplier*LineNetAmt,2) ELSE + ROUND(i.Multiplier*PriceLimit*QtyInvoiced,2) END AS LineLimitAmt, + ROUND(i.Multiplier*PriceList*QtyInvoiced-LineNetAmt,2) AS LineDiscountAmt, + CASE WHEN COALESCE(il.PriceLimit,0)=0 THEN 0 ELSE + ROUND(i.Multiplier*LineNetAmt-PriceLimit*QtyInvoiced,2) END AS LineOverLimitAmt +FROM RV_C_Invoice i + INNER JOIN C_InvoiceLine il ON (i.C_Invoice_ID=il.C_Invoice_ID) + LEFT OUTER JOIN M_Product p ON (il.M_Product_ID=p.M_Product_ID) + LEFT OUTER JOIN M_AttributeSetInstance pasi ON (il.M_AttributeSetInstance_ID=pasi.M_AttributeSetInstance_ID); + + + diff --git a/db/ddlutils/postgresql/views/RV_C_INVOICETAX.sql b/db/ddlutils/postgresql/views/RV_C_INVOICETAX.sql new file mode 100644 index 0000000000..6ee7f6f319 --- /dev/null +++ b/db/ddlutils/postgresql/views/RV_C_INVOICETAX.sql @@ -0,0 +1,23 @@ +CREATE OR REPLACE VIEW RV_C_INVOICETAX +(AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, + UPDATED, UPDATEDBY, C_TAX_ID, C_INVOICE_ID, C_DOCTYPE_ID, + C_BPARTNER_ID, TAXID, ISTAXEXEMPT, DATEACCT, DATEINVOICED, + ISSOTRX, DOCUMENTNO, ISPAID, C_CURRENCY_ID, TAXBASEAMT, + TAXAMT, TAXLINETOTAL, MULTIPLIER) +AS +SELECT + i.AD_Client_ID, i.AD_Org_ID, i.IsActive, t.Created, t.CreatedBy, t.Updated, t.UpdatedBy, + t.C_Tax_ID, i.C_Invoice_ID, i.C_DocType_ID, + i.C_BPartner_ID, bp.TaxID, bp.IsTaxExempt, + i.DateAcct, i.DateInvoiced, i.IsSOTrx, i.DocumentNo, i.IsPaid, i.C_Currency_ID, + CASE WHEN charAt(d.DocBaseType,3)='C' THEN t.TaxBaseAmt*-1 ELSE t.TaxBaseAmt END AS TaxBaseAmt, + CASE WHEN charAt(d.DocBaseType,3)='C' THEN t.TaxAmt*-1 ELSE t.TaxAmt END AS TaxAmt, + CASE WHEN charAt(d.DocBaseType,3)='C' THEN (t.TaxBaseAmt + t.TaxAmt)*-1 ELSE (t.TaxBaseAmt + t.TaxAmt) END AS TaxLineTotal, + CASE WHEN charAt(d.DocBaseType,3)='C' THEN -1 ELSE 1 END AS Multiplier +FROM C_InvoiceTax t + INNER JOIN C_Invoice i ON (t.C_Invoice_ID=i.C_Invoice_ID) + INNER JOIN C_DocType d ON (i.C_DocType_ID=d.C_DocType_ID) + INNER JOIN C_BPartner bp ON (i.C_BPartner_ID=bp.C_BPartner_ID); + + + diff --git a/db/ddlutils/postgresql/views/RV_C_INVOICE_CUSTOMERPRODQTR.sql b/db/ddlutils/postgresql/views/RV_C_INVOICE_CUSTOMERPRODQTR.sql new file mode 100644 index 0000000000..0d490499db --- /dev/null +++ b/db/ddlutils/postgresql/views/RV_C_INVOICE_CUSTOMERPRODQTR.sql @@ -0,0 +1,24 @@ +CREATE OR REPLACE VIEW RV_C_INVOICE_CUSTOMERPRODQTR +(AD_CLIENT_ID, AD_ORG_ID, C_BPARTNER_ID, M_PRODUCT_CATEGORY_ID, DATEINVOICED, + LINENETAMT, LINELISTAMT, LINELIMITAMT, LINEDISCOUNTAMT, LINEDISCOUNT, + LINEOVERLIMITAMT, LINEOVERLIMIT, QTYINVOICED, ISSOTRX) +AS +SELECT il.AD_Client_ID, il.AD_Org_ID, + il.C_BPartner_ID, il.M_Product_Category_ID, + firstOf(il.DateInvoiced, 'Q') AS DateInvoiced, -- DD Day, DY Week, MM Month + SUM(LineNetAmt) AS LineNetAmt, + SUM(LineListAmt) AS LineListAmt, + SUM(LineLimitAmt) AS LineLimitAmt, + SUM(LineDiscountAmt) AS LineDiscountAmt, + CASE WHEN SUM(LineListAmt)=0 THEN 0 ELSE + ROUND((SUM(LineListAmt)-SUM(LineNetAmt))/SUM(LineListAmt)*100,2) END AS LineDiscount, + SUM(LineOverLimitAmt) AS LineOverLimitAmt, + CASE WHEN SUM(LineNetAmt)=0 THEN 0 ELSE + 100-ROUND((SUM(LineNetAmt)-SUM(LineOverLimitAmt))/SUM(LineNetAmt)*100,2) END AS LineOverLimit, + SUM(QtyInvoiced) AS QtyInvoiced, IsSOTrx +FROM RV_C_InvoiceLine il +GROUP BY il.AD_Client_ID, il.AD_Org_ID, il.C_BPartner_ID, il.M_Product_Category_ID, + firstOf(il.DateInvoiced, 'Q'), IsSOTrx; + + + diff --git a/db/ddlutils/postgresql/views/RV_C_INVOICE_CUSTOMERVENDQTR.sql b/db/ddlutils/postgresql/views/RV_C_INVOICE_CUSTOMERVENDQTR.sql new file mode 100644 index 0000000000..0afecf2025 --- /dev/null +++ b/db/ddlutils/postgresql/views/RV_C_INVOICE_CUSTOMERVENDQTR.sql @@ -0,0 +1,26 @@ +CREATE OR REPLACE VIEW RV_C_INVOICE_CUSTOMERVENDQTR +(AD_CLIENT_ID, AD_ORG_ID, C_BPARTNER_ID, VENDOR_ID, DATEINVOICED, + LINENETAMT, LINELISTAMT, LINELIMITAMT, LINEDISCOUNTAMT, LINEDISCOUNT, + LINEOVERLIMITAMT, LINEOVERLIMIT, QTYINVOICED) +AS +SELECT il.AD_Client_ID, il.AD_Org_ID, + il.C_BPartner_ID, po.C_BPartner_ID AS Vendor_ID, + firstOf(il.DateInvoiced, 'Q') AS DateInvoiced, -- DD Day, DY Week, MM Month + SUM(LineNetAmt) AS LineNetAmt, + SUM(LineListAmt) AS LineListAmt, + SUM(LineLimitAmt) AS LineLimitAmt, + SUM(LineDiscountAmt) AS LineDiscountAmt, + CASE WHEN SUM(LineListAmt)=0 THEN 0 ELSE + ROUND((SUM(LineListAmt)-SUM(LineNetAmt))/SUM(LineListAmt)*100,2) END AS LineDiscount, + SUM(LineOverLimitAmt) AS LineOverLimitAmt, + CASE WHEN SUM(LineNetAmt)=0 THEN 0 ELSE + 100-ROUND((SUM(LineNetAmt)-SUM(LineOverLimitAmt))/SUM(LineNetAmt)*100,2) END AS LineOverLimit, + SUM(QtyInvoiced) AS QtyInvoiced +FROM RV_C_InvoiceLine il + INNER JOIN M_Product_PO po ON (il.M_Product_ID=po.M_Product_ID) +WHERE il.IsSOTrx='Y' +GROUP BY il.AD_Client_ID, il.AD_Org_ID, il.C_BPartner_ID, po.C_BPartner_ID, + firstOf(il.DateInvoiced, 'Q'); + + + diff --git a/db/ddlutils/postgresql/views/RV_C_INVOICE_DAY.sql b/db/ddlutils/postgresql/views/RV_C_INVOICE_DAY.sql new file mode 100644 index 0000000000..683c924d02 --- /dev/null +++ b/db/ddlutils/postgresql/views/RV_C_INVOICE_DAY.sql @@ -0,0 +1,23 @@ +CREATE OR REPLACE VIEW RV_C_INVOICE_DAY +(AD_CLIENT_ID, AD_ORG_ID, SALESREP_ID, DATEINVOICED, LINENETAMT, + LINELISTAMT, LINELIMITAMT, LINEDISCOUNTAMT, LINEDISCOUNT, LINEOVERLIMITAMT, + LINEOVERLIMIT, ISSOTRX) +AS +SELECT AD_Client_ID, AD_Org_ID, SalesRep_ID, + firstOf(DateInvoiced, 'DD') AS DateInvoiced, -- DD Day, DY Week, MM Month + SUM(LineNetAmt) AS LineNetAmt, + SUM(LineListAmt) AS LineListAmt, + SUM(LineLimitAmt) AS LineLimitAmt, + SUM(LineDiscountAmt) AS LineDiscountAmt, + CASE WHEN SUM(LineListAmt)=0 THEN 0 ELSE + ROUND((SUM(LineListAmt)-SUM(LineNetAmt))/SUM(LineListAmt)*100,2) END AS LineDiscount, + SUM(LineOverLimitAmt) AS LineOverLimitAmt, + CASE WHEN SUM(LineNetAmt)=0 THEN 0 ELSE + 100-ROUND((SUM(LineNetAmt)-SUM(LineOverLimitAmt))/SUM(LineNetAmt)*100,2) END AS LineOverLimit, + IsSOTrx +FROM RV_C_InvoiceLine +GROUP BY AD_Client_ID, AD_Org_ID, SalesRep_ID, + firstOf(DateInvoiced, 'DD'), IsSOTrx; + + + diff --git a/db/ddlutils/postgresql/views/RV_C_INVOICE_MONTH.sql b/db/ddlutils/postgresql/views/RV_C_INVOICE_MONTH.sql new file mode 100644 index 0000000000..aa41f7c3e3 --- /dev/null +++ b/db/ddlutils/postgresql/views/RV_C_INVOICE_MONTH.sql @@ -0,0 +1,23 @@ +CREATE OR REPLACE VIEW RV_C_INVOICE_MONTH +(AD_CLIENT_ID, AD_ORG_ID, SALESREP_ID, DATEINVOICED, LINENETAMT, + LINELISTAMT, LINELIMITAMT, LINEDISCOUNTAMT, LINEDISCOUNT, LINEOVERLIMITAMT, + LINEOVERLIMIT, ISSOTRX) +AS +SELECT AD_Client_ID, AD_Org_ID, SalesRep_ID, + firstOf(DateInvoiced, 'MM') AS DateInvoiced, -- DD Day, DY Week, MM Month + SUM(LineNetAmt) AS LineNetAmt, + SUM(LineListAmt) AS LineListAmt, + SUM(LineLimitAmt) AS LineLimitAmt, + SUM(LineDiscountAmt) AS LineDiscountAmt, + CASE WHEN SUM(LineListAmt)=0 THEN 0 ELSE + ROUND((SUM(LineListAmt)-SUM(LineNetAmt))/SUM(LineListAmt)*100,2) END AS LineDiscount, + SUM(LineOverLimitAmt) AS LineOverLimitAmt, + CASE WHEN SUM(LineNetAmt)=0 THEN 0 ELSE + 100-ROUND((SUM(LineNetAmt)-SUM(LineOverLimitAmt))/SUM(LineNetAmt)*100,2) END AS LineOverLimit, + IsSOTrx +FROM RV_C_InvoiceLine +GROUP BY AD_Client_ID, AD_Org_ID, SalesRep_ID, + firstOf(DateInvoiced, 'MM'), IsSOTrx; + + + diff --git a/db/ddlutils/postgresql/views/RV_C_INVOICE_PRODMONTH.sql b/db/ddlutils/postgresql/views/RV_C_INVOICE_PRODMONTH.sql new file mode 100644 index 0000000000..50b33b4b4d --- /dev/null +++ b/db/ddlutils/postgresql/views/RV_C_INVOICE_PRODMONTH.sql @@ -0,0 +1,23 @@ +CREATE OR REPLACE VIEW RV_C_INVOICE_PRODMONTH +(AD_CLIENT_ID, AD_ORG_ID, M_PRODUCT_CATEGORY_ID, DATEINVOICED, LINENETAMT, + LINELISTAMT, LINELIMITAMT, LINEDISCOUNTAMT, LINEDISCOUNT, LINEOVERLIMITAMT, + LINEOVERLIMIT, QTYINVOICED, ISSOTRX) +AS +SELECT il.AD_Client_ID, il.AD_Org_ID, il.M_Product_Category_ID, + firstOf(il.DateInvoiced, 'MM') AS DateInvoiced, + SUM(il.LineNetAmt) AS LineNetAmt, + SUM(il.LineListAmt) AS LineListAmt, + SUM(il.LineLimitAmt) AS LineLimitAmt, + SUM(il.LineDiscountAmt) AS LineDiscountAmt, + CASE WHEN SUM(LineListAmt)=0 THEN 0 ELSE + ROUND((SUM(LineListAmt)-SUM(LineNetAmt))/SUM(LineListAmt)*100,2) END AS LineDiscount, + SUM(LineOverLimitAmt) AS LineOverLimitAmt, + CASE WHEN SUM(LineNetAmt)=0 THEN 0 ELSE + 100-ROUND((SUM(LineNetAmt)-SUM(LineOverLimitAmt))/SUM(LineNetAmt)*100,2) END AS LineOverLimit, + SUM(QtyInvoiced) AS QtyInvoiced, IsSOTrx +FROM RV_C_InvoiceLine il +GROUP BY il.AD_Client_ID, il.AD_Org_ID, il.M_Product_Category_ID, + firstOf(il.DateInvoiced, 'MM'), IsSOTrx; + + + diff --git a/db/ddlutils/postgresql/views/RV_C_INVOICE_PRODUCTMONTH.sql b/db/ddlutils/postgresql/views/RV_C_INVOICE_PRODUCTMONTH.sql new file mode 100644 index 0000000000..559c9bfa9e --- /dev/null +++ b/db/ddlutils/postgresql/views/RV_C_INVOICE_PRODUCTMONTH.sql @@ -0,0 +1,23 @@ +CREATE OR REPLACE VIEW RV_C_INVOICE_PRODUCTMONTH +(AD_CLIENT_ID, AD_ORG_ID, M_PRODUCT_ID, DATEINVOICED, LINENETAMT, + LINELISTAMT, LINELIMITAMT, LINEDISCOUNTAMT, LINEDISCOUNT, LINEOVERLIMITAMT, + LINEOVERLIMIT, QTYINVOICED, ISSOTRX) +AS +SELECT il.AD_Client_ID, il.AD_Org_ID, il.M_Product_ID, + firstOf(il.DateInvoiced, 'MM') AS DateInvoiced, + SUM(il.LineNetAmt) AS LineNetAmt, + SUM(il.LineListAmt) AS LineListAmt, + SUM(il.LineLimitAmt) AS LineLimitAmt, + SUM(il.LineDiscountAmt) AS LineDiscountAmt, + CASE WHEN SUM(LineListAmt)=0 THEN 0 ELSE + ROUND((SUM(LineListAmt)-SUM(LineNetAmt))/SUM(LineListAmt)*100,2) END AS LineDiscount, + SUM(LineOverLimitAmt) AS LineOverLimitAmt, + CASE WHEN SUM(LineNetAmt)=0 THEN 0 ELSE + 100-ROUND((SUM(LineNetAmt)-SUM(LineOverLimitAmt))/SUM(LineNetAmt)*100,2) END AS LineOverLimit, + SUM(QtyInvoiced) AS QtyInvoiced, IsSOTrx +FROM RV_C_InvoiceLine il +GROUP BY il.AD_Client_ID, il.AD_Org_ID, il.M_Product_ID, + firstOf(il.DateInvoiced, 'MM'), IsSOTrx; + + + diff --git a/db/ddlutils/postgresql/views/RV_C_INVOICE_PRODUCTQTR.sql b/db/ddlutils/postgresql/views/RV_C_INVOICE_PRODUCTQTR.sql new file mode 100644 index 0000000000..8782b5757b --- /dev/null +++ b/db/ddlutils/postgresql/views/RV_C_INVOICE_PRODUCTQTR.sql @@ -0,0 +1,23 @@ +CREATE OR REPLACE VIEW RV_C_INVOICE_PRODUCTQTR +(AD_CLIENT_ID, AD_ORG_ID, M_PRODUCT_ID, DATEINVOICED, LINENETAMT, + LINELISTAMT, LINELIMITAMT, LINEDISCOUNTAMT, LINEDISCOUNT, LINEOVERLIMITAMT, + LINEOVERLIMIT, QTYINVOICED, ISSOTRX) +AS +SELECT il.AD_Client_ID, il.AD_Org_ID, il.M_Product_ID, + firstOf(il.DateInvoiced, 'Q') AS DateInvoiced, + SUM(il.LineNetAmt) AS LineNetAmt, + SUM(il.LineListAmt) AS LineListAmt, + SUM(il.LineLimitAmt) AS LineLimitAmt, + SUM(il.LineDiscountAmt) AS LineDiscountAmt, + CASE WHEN SUM(LineListAmt)=0 THEN 0 ELSE + ROUND((SUM(LineListAmt)-SUM(LineNetAmt))/SUM(LineListAmt)*100,2) END AS LineDiscount, + SUM(LineOverLimitAmt) AS LineOverLimitAmt, + CASE WHEN SUM(LineNetAmt)=0 THEN 0 ELSE + 100-ROUND((SUM(LineNetAmt)-SUM(LineOverLimitAmt))/SUM(LineNetAmt)*100,2) END AS LineOverLimit, + SUM(QtyInvoiced) AS QtyInvoiced, IsSOTrx +FROM RV_C_InvoiceLine il +GROUP BY il.AD_Client_ID, il.AD_Org_ID, il.M_Product_ID, + firstOf(il.DateInvoiced, 'Q'), IsSOTrx; + + + diff --git a/db/ddlutils/postgresql/views/RV_C_INVOICE_PRODWEEK.sql b/db/ddlutils/postgresql/views/RV_C_INVOICE_PRODWEEK.sql new file mode 100644 index 0000000000..f742108c40 --- /dev/null +++ b/db/ddlutils/postgresql/views/RV_C_INVOICE_PRODWEEK.sql @@ -0,0 +1,23 @@ +CREATE OR REPLACE VIEW RV_C_INVOICE_PRODWEEK +(AD_CLIENT_ID, AD_ORG_ID, M_PRODUCT_CATEGORY_ID, DATEINVOICED, LINENETAMT, + LINELISTAMT, LINELIMITAMT, LINEDISCOUNTAMT, LINEDISCOUNT, LINEOVERLIMITAMT, + LINEOVERLIMIT, QTYINVOICED, ISSOTRX) +AS +SELECT il.AD_Client_ID, il.AD_Org_ID, il.M_Product_Category_ID, + firstOf(il.DateInvoiced, 'DY') AS DateInvoiced, + SUM(il.LineNetAmt) AS LineNetAmt, + SUM(il.LineListAmt) AS LineListAmt, + SUM(il.LineLimitAmt) AS LineLimitAmt, + SUM(il.LineDiscountAmt) AS LineDiscountAmt, + CASE WHEN SUM(LineListAmt)=0 THEN 0 ELSE + ROUND((SUM(LineListAmt)-SUM(LineNetAmt))/SUM(LineListAmt)*100,2) END AS LineDiscount, + SUM(LineOverLimitAmt) AS LineOverLimitAmt, + CASE WHEN SUM(LineNetAmt)=0 THEN 0 ELSE + 100-ROUND((SUM(LineNetAmt)-SUM(LineOverLimitAmt))/SUM(LineNetAmt)*100,2) END AS LineOverLimit, + SUM(QtyInvoiced) AS QtyInvoiced, IsSOTrx +FROM RV_C_InvoiceLine il +GROUP BY il.AD_Client_ID, il.AD_Org_ID, il.M_Product_Category_ID, + firstOf(il.DateInvoiced, 'DY'), IsSOTrx; + + + diff --git a/db/ddlutils/postgresql/views/RV_C_INVOICE_VENDORMONTH.sql b/db/ddlutils/postgresql/views/RV_C_INVOICE_VENDORMONTH.sql new file mode 100644 index 0000000000..43a6f22c19 --- /dev/null +++ b/db/ddlutils/postgresql/views/RV_C_INVOICE_VENDORMONTH.sql @@ -0,0 +1,26 @@ +CREATE OR REPLACE VIEW RV_C_INVOICE_VENDORMONTH +(AD_CLIENT_ID, AD_ORG_ID, C_BPARTNER_ID, M_PRODUCT_CATEGORY_ID, DATEINVOICED, + LINENETAMT, LINELISTAMT, LINELIMITAMT, LINEDISCOUNTAMT, LINEDISCOUNT, + LINEOVERLIMITAMT, LINEOVERLIMIT, QTYINVOICED) +AS +SELECT il.AD_Client_ID, il.AD_Org_ID, + po.C_BPartner_ID, il.M_Product_Category_ID, + firstOf(il.DateInvoiced, 'MM') AS DateInvoiced, -- DD Day, DY Week, MM Month + SUM(LineNetAmt) AS LineNetAmt, + SUM(LineListAmt) AS LineListAmt, + SUM(LineLimitAmt) AS LineLimitAmt, + SUM(LineDiscountAmt) AS LineDiscountAmt, + CASE WHEN SUM(LineListAmt)=0 THEN 0 ELSE + ROUND((SUM(LineListAmt)-SUM(LineNetAmt))/SUM(LineListAmt)*100,2) END AS LineDiscount, + SUM(LineOverLimitAmt) AS LineOverLimitAmt, + CASE WHEN SUM(LineNetAmt)=0 THEN 0 ELSE + 100-ROUND((SUM(LineNetAmt)-SUM(LineOverLimitAmt))/SUM(LineNetAmt)*100,2) END AS LineOverLimit, + SUM(QtyInvoiced) AS QtyInvoiced +FROM RV_C_InvoiceLine il + INNER JOIN M_Product_PO po ON (il.M_Product_ID=po.M_Product_ID) +WHERE il.IsSOTrx='Y' +GROUP BY il.AD_Client_ID, il.AD_Org_ID, po.C_BPartner_ID, il.M_Product_Category_ID, + firstOf(il.DateInvoiced, 'MM'); + + + diff --git a/db/ddlutils/postgresql/views/RV_C_INVOICE_WEEK.sql b/db/ddlutils/postgresql/views/RV_C_INVOICE_WEEK.sql new file mode 100644 index 0000000000..a9c28f316c --- /dev/null +++ b/db/ddlutils/postgresql/views/RV_C_INVOICE_WEEK.sql @@ -0,0 +1,23 @@ +CREATE OR REPLACE VIEW RV_C_INVOICE_WEEK +(AD_CLIENT_ID, AD_ORG_ID, SALESREP_ID, DATEINVOICED, LINENETAMT, + LINELISTAMT, LINELIMITAMT, LINEDISCOUNTAMT, LINEDISCOUNT, LINEOVERLIMITAMT, + LINEOVERLIMIT, ISSOTRX) +AS +SELECT AD_Client_ID, AD_Org_ID, SalesRep_ID, + firstOf(DateInvoiced, 'DY') AS DateInvoiced, -- DD Day, DY Week, MM Month + SUM(LineNetAmt) AS LineNetAmt, + SUM(LineListAmt) AS LineListAmt, + SUM(LineLimitAmt) AS LineLimitAmt, + SUM(LineDiscountAmt) AS LineDiscountAmt, + CASE WHEN SUM(LineListAmt)=0 THEN 0 ELSE + ROUND((SUM(LineListAmt)-SUM(LineNetAmt))/SUM(LineListAmt)*100,2) END AS LineDiscount, + SUM(LineOverLimitAmt) AS LineOverLimitAmt, + CASE WHEN SUM(LineNetAmt)=0 THEN 0 ELSE + 100-ROUND((SUM(LineNetAmt)-SUM(LineOverLimitAmt))/SUM(LineNetAmt)*100,2) END AS LineOverLimit, + IsSOTrx +FROM RV_C_InvoiceLine +GROUP BY AD_Client_ID, AD_Org_ID, SalesRep_ID, + firstOf(DateInvoiced, 'DY'), IsSOTrx; + + + diff --git a/db/ddlutils/postgresql/views/RV_C_RFQRESPONSE.sql b/db/ddlutils/postgresql/views/RV_C_RFQRESPONSE.sql new file mode 100644 index 0000000000..8666d5676e --- /dev/null +++ b/db/ddlutils/postgresql/views/RV_C_RFQRESPONSE.sql @@ -0,0 +1,35 @@ +CREATE OR REPLACE VIEW RV_C_RFQRESPONSE +(AD_CLIENT_ID, AD_ORG_ID, C_RFQ_ID, C_RFQ_TOPIC_ID, C_BPARTNER_ID, + C_BPARTNER_LOCATION_ID, AD_USER_ID, C_RFQRESPONSE_ID, C_CURRENCY_ID, DATERESPONSE, + DATEWORKSTART, DELIVERYDAYS, DATEWORKCOMPLETE, PRICE, RANKING, + ISSELFSERVICE, DESCRIPTION, HELP, M_PRODUCT_ID, M_ATTRIBUTESETINSTANCE_ID, + LINE, LINEDATEWORKSTART, LINEDELIVERYDAYS, LINEDATEWORKCOMPLETE, LINEDESCRIPTION, + LINEHELP, C_UOM_ID, QTY, BENCHMARKPRICE, BENCHMARKDIFFERENCE, + QTYPRICE, DISCOUNT, QTYRANKING) +AS +SELECT q.AD_Client_ID, q.AD_Org_ID, q.C_RfQ_ID, q.C_RfQ_Topic_ID, + r.C_BPartner_ID, r.C_BPartner_Location_ID, r.AD_User_ID, + r.C_RfQResponse_ID, + r.C_Currency_ID, r.DateResponse, r.DateWorkStart, r.DeliveryDays, r.DateWorkComplete, + r.Price, r.Ranking, r.IsSelfService, + r.Description, r.Help, + -- Line + ql.M_Product_ID, ql.M_AttributeSetInstance_ID, + ql.Line, rl.DateWorkStart AS LineDateWorkStart, rl.DeliveryDays AS LineDeliveryDays, rl.DateWorkComplete AS LineDateworkComplete, + rl.Description AS LineDescription, rl.Help AS LineHelp, + -- Qty + qlq.C_UOM_ID, qlq.Qty, qlq.BenchmarkPrice, rlq.Price-qlq.BenchmarkPrice AS BenchmarkDifference, + rlq.Price AS QtyPrice, rlq.Discount, rlq.Ranking AS QtyRanking +FROM C_RfQ q + INNER JOIN C_RfQLine ql ON (q.C_RfQ_ID = ql.C_RfQ_ID) + INNER JOIN C_RfQLineQty qlq ON (ql.C_RfQLine_ID = qlq.C_RfQLine_ID) + INNER JOIN C_RfQResponse r ON (q.C_RfQ_ID = r.C_RfQ_ID) + INNER JOIN C_RfQResponseLine rl ON + (r.C_RfQResponse_ID = rl.C_RfQResponse_ID AND ql.C_RfQLine_ID = rl.C_RfQLine_ID) + INNER JOIN C_RfQResponseLineQty rlq ON + (rl.C_RfQResponseLine_ID = rlq.C_RfQResponseLine_ID AND qlq.C_RfQLineQty_ID = rlq.C_RfQLineQty_ID) +WHERE r.IsComplete='Y' + AND q.Processed='N'; + + + diff --git a/db/ddlutils/postgresql/views/RV_C_RFQ_UNANSWERED.sql b/db/ddlutils/postgresql/views/RV_C_RFQ_UNANSWERED.sql new file mode 100644 index 0000000000..4de4424cd2 --- /dev/null +++ b/db/ddlutils/postgresql/views/RV_C_RFQ_UNANSWERED.sql @@ -0,0 +1,17 @@ +CREATE OR REPLACE VIEW RV_C_RFQ_UNANSWERED +(AD_CLIENT_ID, AD_ORG_ID, C_RFQ_ID, NAME, DESCRIPTION, + HELP, SALESREP_ID, C_RFQ_TOPIC_ID, QUOTETYPE, ISQUOTETOTALAMT, + ISQUOTEALLQTY, C_CURRENCY_ID, DATERESPONSE, ISRFQRESPONSEACCEPTED, DATEWORKSTART, + DELIVERYDAYS, DATEWORKCOMPLETE, C_BPARTNER_ID, C_BPARTNER_LOCATION_ID, AD_USER_ID) +AS +SELECT q.AD_Client_ID, q.AD_Org_ID, q.C_RfQ_ID, q.Name, q.Description, q.Help, q.SalesRep_ID, + q.C_RfQ_Topic_ID, q.QuoteType, q.IsQuoteTotalAmt, q.IsQuoteAllQty, q.C_Currency_ID, + q.DateResponse, q.IsRfQResponseAccepted, q.DateWorkStart, q.DeliveryDays, q.DateWorkComplete, + r.C_BPartner_ID, r.C_BPartner_Location_ID, r.AD_User_ID +FROM C_RfQ q + INNER JOIN C_RfQResponse r ON (q.C_RfQ_ID=r.C_RfQ_ID) +WHERE r.IsComplete='N' + AND q.Processed='N'; + + + diff --git a/db/ddlutils/postgresql/views/RV_FACT_ACCT.sql b/db/ddlutils/postgresql/views/RV_FACT_ACCT.sql new file mode 100644 index 0000000000..08a092be92 --- /dev/null +++ b/db/ddlutils/postgresql/views/RV_FACT_ACCT.sql @@ -0,0 +1,42 @@ +CREATE OR REPLACE VIEW RV_FACT_ACCT +(AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, + UPDATED, UPDATEDBY, FACT_ACCT_ID, C_ACCTSCHEMA_ID, ACCOUNT_ID, + DATETRX, DATEACCT, C_PERIOD_ID, AD_TABLE_ID, RECORD_ID, + LINE_ID, GL_CATEGORY_ID, GL_BUDGET_ID, C_TAX_ID, M_LOCATOR_ID, + POSTINGTYPE, C_CURRENCY_ID, AMTSOURCEDR, AMTSOURCECR, AMTSOURCE, + AMTACCTDR, AMTACCTCR, AMTACCT, RATE, C_UOM_ID, + QTY, M_PRODUCT_ID, C_BPARTNER_ID, AD_ORGTRX_ID, C_LOCFROM_ID, + C_LOCTO_ID, C_SALESREGION_ID, C_PROJECT_ID, C_CAMPAIGN_ID, C_ACTIVITY_ID, + USER1_ID, USER2_ID, A_ASSET_ID, DESCRIPTION, ORGVALUE, + ORGNAME, ACCOUNTVALUE, NAME, ACCOUNTTYPE, BPARTNERVALUE, + BPNAME, C_BP_GROUP_ID, PRODUCTVALUE, PRODUCTNAME, UPC, + M_PRODUCT_CATEGORY_ID) +AS +SELECT f.AD_Client_ID, f.AD_Org_ID, f.IsActive,f.Created,f.CreatedBy,f.Updated,f.UpdatedBy, + f.Fact_Acct_ID, + f.C_AcctSchema_ID, f.Account_ID, f.DateTrx, f.DateAcct, f.C_Period_ID, + f.AD_Table_ID, f.Record_ID, f.Line_ID, + f.GL_Category_ID, f.GL_Budget_ID, f.C_Tax_ID, f.M_Locator_ID, + f.PostingType, f.C_Currency_ID, + f.AmtSourceDr, f.AmtSourceCr, (f.AmtSourceDr - f.AmtSourceCr) AS AmtSource, + f.AmtAcctDr, f.AmtAcctCr, (f.AmtAcctDr - f.AmtAcctCr) AS AmtAcct, + CASE WHEN (f.AmtSourceDr - f.AmtSourceCr) = 0 THEN 0 ELSE + (f.AmtAcctDr - f.AmtAcctCr) / (f.AmtSourceDr - f.AmtSourceCr) END AS Rate, + f.C_UOM_ID, f.Qty, + f.M_Product_ID, f.C_BPartner_ID, f.AD_OrgTrx_ID, + f.C_LocFrom_ID, f.C_LocTo_ID, f.C_SalesRegion_ID, + f.C_Project_ID, f.C_Campaign_ID, f.C_Activity_ID, + f.User1_ID, f.User2_ID, f.A_Asset_ID, + f.Description, + o.Value AS OrgValue, o.Name AS OrgName, + ev.Value AS AccountValue, ev.Name, ev.AccountType, + bp.Value AS BPartnerValue, bp.Name AS BPName, bp.C_BP_Group_ID, + p.Value AS ProductValue, p.Name AS ProductName, p.UPC, p.M_Product_Category_ID +FROM Fact_Acct f + INNER JOIN AD_Org o ON (f.AD_Org_ID=o.AD_Org_ID) + INNER JOIN C_ElementValue ev ON (f.Account_ID=ev.C_ElementValue_ID) + LEFT OUTER JOIN C_BPartner bp ON (f.C_BPartner_ID=bp.C_BPartner_ID) + LEFT OUTER JOIN M_Product p ON (f.M_Product_ID=p.M_Product_ID); + + + diff --git a/db/ddlutils/postgresql/views/RV_FACT_ACCT_DAY.sql b/db/ddlutils/postgresql/views/RV_FACT_ACCT_DAY.sql new file mode 100644 index 0000000000..c246b0fcbf --- /dev/null +++ b/db/ddlutils/postgresql/views/RV_FACT_ACCT_DAY.sql @@ -0,0 +1,29 @@ +CREATE OR REPLACE VIEW RV_FACT_ACCT_DAY +(AD_CLIENT_ID, AD_ORG_ID, C_ACCTSCHEMA_ID, ACCOUNT_ID, DATEACCT, + C_PERIOD_ID, GL_CATEGORY_ID, GL_BUDGET_ID, C_TAX_ID, M_LOCATOR_ID, + POSTINGTYPE, C_CURRENCY_ID, AMTSOURCEDR, AMTSOURCECR, AMTSOURCE, + AMTACCTDR, AMTACCTCR, AMTACCT, RATE, M_PRODUCT_ID, + C_BPARTNER_ID, AD_ORGTRX_ID, C_LOCFROM_ID, C_LOCTO_ID, C_SALESREGION_ID, + C_PROJECT_ID, C_CAMPAIGN_ID, C_ACTIVITY_ID, USER1_ID, USER2_ID, + A_ASSET_ID) +AS +SELECT AD_Client_ID, AD_Org_ID, + C_AcctSchema_ID, Account_ID, firstOf(DateAcct, 'DD') AS DateAcct, C_Period_ID, + GL_Category_ID, GL_Budget_ID, C_Tax_ID, M_Locator_ID, + PostingType, C_Currency_ID, + SUM(AmtSourceDr) AS AmtSourceDr, SUM(AmtSourceCr) AS AmtSourceCr, SUM(AmtSourceDr - AmtSourceCr) AS AmtSource, + SUM(AmtAcctDr) AS AmtAcctDr, SUM(AmtAcctCr) AS AmtAcctCr, SUM(AmtAcctDr - AmtAcctCr) AS AmtAcct, + CASE WHEN SUM(AmtSourceDr - AmtSourceCr) = 0 THEN 0 ELSE + SUM(AmtAcctDr - AmtAcctCr) / SUM(AmtSourceDr - AmtSourceCr) END AS Rate, + M_Product_ID, C_BPartner_ID, AD_OrgTrx_ID, C_LocFrom_ID, C_LocTo_ID, C_SalesRegion_ID, + C_Project_ID, C_Campaign_ID, C_Activity_ID, User1_ID, User2_ID, A_Asset_ID +FROM Fact_Acct +GROUP BY AD_Client_ID, AD_Org_ID, + C_AcctSchema_ID, Account_ID, firstOf(DateAcct, 'DD'), C_Period_ID, + GL_Category_ID, GL_Budget_ID, C_Tax_ID, M_Locator_ID, + PostingType, C_Currency_ID, + M_Product_ID, C_BPartner_ID, AD_OrgTrx_ID, C_LocFrom_ID, C_LocTo_ID, C_SalesRegion_ID, + C_Project_ID, C_Campaign_ID, C_Activity_ID, User1_ID, User2_ID, A_Asset_ID; + + + diff --git a/db/ddlutils/postgresql/views/RV_FACT_ACCT_PERIOD.sql b/db/ddlutils/postgresql/views/RV_FACT_ACCT_PERIOD.sql new file mode 100644 index 0000000000..8c40426420 --- /dev/null +++ b/db/ddlutils/postgresql/views/RV_FACT_ACCT_PERIOD.sql @@ -0,0 +1,28 @@ +CREATE OR REPLACE VIEW RV_FACT_ACCT_PERIOD +(AD_CLIENT_ID, AD_ORG_ID, C_ACCTSCHEMA_ID, ACCOUNT_ID, C_PERIOD_ID, + GL_CATEGORY_ID, GL_BUDGET_ID, C_TAX_ID, M_LOCATOR_ID, POSTINGTYPE, + C_CURRENCY_ID, AMTSOURCEDR, AMTSOURCECR, AMTSOURCE, AMTACCTDR, + AMTACCTCR, AMTACCT, RATE, M_PRODUCT_ID, C_BPARTNER_ID, + AD_ORGTRX_ID, C_LOCFROM_ID, C_LOCTO_ID, C_SALESREGION_ID, C_PROJECT_ID, + C_CAMPAIGN_ID, C_ACTIVITY_ID, USER1_ID, USER2_ID, A_ASSET_ID) +AS +SELECT AD_Client_ID, AD_Org_ID, + C_AcctSchema_ID, Account_ID, C_Period_ID, + GL_Category_ID, GL_Budget_ID, C_Tax_ID, M_Locator_ID, + PostingType, C_Currency_ID, + SUM(AmtSourceDr) AS AmtSourceDr, SUM(AmtSourceCr) AS AmtSourceCr, SUM(AmtSourceDr - AmtSourceCr) AS AmtSource, + SUM(AmtAcctDr) AS AmtAcctDr, SUM(AmtAcctCr) AS AmtAcctCr, SUM(AmtAcctDr - AmtAcctCr) AS AmtAcct, + CASE WHEN SUM(AmtSourceDr - AmtSourceCr) = 0 THEN 0 ELSE + SUM(AmtAcctDr - AmtAcctCr) / SUM(AmtSourceDr - AmtSourceCr) END AS Rate, + M_Product_ID, C_BPartner_ID, AD_OrgTrx_ID, C_LocFrom_ID, C_LocTo_ID, C_SalesRegion_ID, + C_Project_ID, C_Campaign_ID, C_Activity_ID, User1_ID, User2_ID, A_Asset_ID +FROM Fact_Acct +GROUP BY AD_Client_ID, AD_Org_ID, + C_AcctSchema_ID, Account_ID, C_Period_ID, + GL_Category_ID, GL_Budget_ID, C_Tax_ID, M_Locator_ID, + PostingType, C_Currency_ID, + M_Product_ID, C_BPartner_ID, AD_OrgTrx_ID, C_LocFrom_ID, C_LocTo_ID, C_SalesRegion_ID, + C_Project_ID, C_Campaign_ID, C_Activity_ID, User1_ID, User2_ID, A_Asset_ID; + + + diff --git a/db/ddlutils/postgresql/views/RV_INOUTCONFIRM.sql b/db/ddlutils/postgresql/views/RV_INOUTCONFIRM.sql new file mode 100644 index 0000000000..9fbd866f1a --- /dev/null +++ b/db/ddlutils/postgresql/views/RV_INOUTCONFIRM.sql @@ -0,0 +1,17 @@ +CREATE OR REPLACE VIEW RV_INOUTCONFIRM +(M_INOUTCONFIRM_ID, AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, + CREATEDBY, UPDATED, UPDATEDBY, M_INOUT_ID, DOCUMENTNO, + CONFIRMTYPE, ISAPPROVED, ISCANCELLED, DESCRIPTION, PROCESSING, + PROCESSED, C_BPARTNER_ID, C_BPARTNER_LOCATION_ID, M_WAREHOUSE_ID, C_ORDER_ID, + ISSOTRX) +AS +SELECT c.M_InOutConfirm_ID, + c.AD_Client_ID, c.AD_Org_ID, c.IsActive, c.Created, c.CreatedBy, c.Updated, c.UpdatedBy, + c.M_InOut_ID, c.DocumentNo, c.ConfirmType, c.IsApproved, c.IsCancelled, + c.Description, c.Processing, c.Processed, + i.C_BPartner_ID, i.C_BPartner_Location_ID, i.M_Warehouse_ID, i.C_Order_ID, i.IsSOTrx +FROM M_InOutConfirm c + INNER JOIN M_InOut i ON (c.M_InOut_ID=i.M_InOut_ID); + + + diff --git a/db/ddlutils/postgresql/views/RV_INOUTDETAILS.sql b/db/ddlutils/postgresql/views/RV_INOUTDETAILS.sql new file mode 100644 index 0000000000..019056def6 --- /dev/null +++ b/db/ddlutils/postgresql/views/RV_INOUTDETAILS.sql @@ -0,0 +1,47 @@ +CREATE OR REPLACE VIEW RV_INOUTDETAILS +(AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, + UPDATED, UPDATEDBY, M_INOUT_ID, ISSOTRX, DOCUMENTNO, + DOCACTION, DOCSTATUS, POSTED, PROCESSED, C_DOCTYPE_ID, + DESCRIPTION, C_ORDER_ID, DATEORDERED, MOVEMENTTYPE, MOVEMENTDATE, + DATEACCT, C_BPARTNER_ID, C_BPARTNER_LOCATION_ID, AD_USER_ID, SALESREP_ID, + M_WAREHOUSE_ID, POREFERENCE, DELIVERYRULE, FREIGHTCOSTRULE, FREIGHTAMT, + DELIVERYVIARULE, M_SHIPPER_ID, PRIORITYRULE, DATEPRINTED, NOPACKAGES, + PICKDATE, SHIPDATE, TRACKINGNO, AD_ORGTRX_ID, C_PROJECT_ID, + C_CAMPAIGN_ID, C_ACTIVITY_ID, USER1_ID, USER2_ID, DATERECEIVED, + ISAPPROVED, ISINDISPUTE, M_INOUTLINE_ID, LINE, LINEDESCRIPTION, + C_ORDERLINE_ID, M_LOCATOR_ID, M_PRODUCT_ID, C_UOM_ID, M_ATTRIBUTESETINSTANCE_ID, + PRODUCTATTRIBUTE, M_ATTRIBUTESET_ID, M_LOT_ID, GUARANTEEDATE, LOT, + SERNO, MOVEMENTQTY, QTYENTERED, ISDESCRIPTION, CONFIRMEDQTY, + PICKEDQTY, SCRAPPEDQTY, TARGETQTY, LOCATORVALUE, X, + Y, Z) +AS +SELECT h.AD_Client_ID, h.AD_Org_ID, l.IsActive, l.Created, l.CreatedBy, l.Updated, l.UpdatedBy, + h.M_InOut_ID, + h.IsSOTrx, h.DocumentNo, h.DocAction, h.DocStatus, h.Posted, h.Processed, + h.C_DocType_ID, h.Description, h.C_Order_ID, h.DateOrdered, + h.MovementType, h.MovementDate, h.DateAcct, + h.C_BPartner_ID, h.C_BPartner_Location_ID, h.AD_User_ID, + h.SalesRep_ID, + h.M_Warehouse_ID, + h.POReference, h.DeliveryRule, h.FreightCostRule, h.FreightAmt, + h.DeliveryViaRule, h.M_Shipper_ID, -- h.C_CHARGE_ID, h.CHARGEAmt, + h.PriorityRule, h.DatePrinted, + h.NoPackages, h.PickDate, h.ShipDate, h.TrackingNo, + h.AD_OrgTrx_ID, h.C_Project_ID, h.C_Campaign_ID, h.C_Activity_ID, h.User1_ID, h.User2_ID, + h.DateReceived, h.IsApproved, h.IsInDispute, + l.M_InOutLine_ID, l.Line, l.Description AS LineDescription, + l.C_OrderLine_ID, l.M_Locator_ID, + l.M_Product_ID, l.C_UOM_ID, + l.M_AttributeSetInstance_ID, productAttribute(l.M_AttributeSetInstance_ID) AS ProductAttribute, + pasi.M_AttributeSet_ID, pasi.M_Lot_ID, pasi.GuaranteeDate, pasi.Lot, pasi.SerNo, + l.MovementQty, l.QtyEntered, + l.IsDescription, + l.ConfirmedQty, l.PickedQty, l.ScrappedQty, l.TargetQty, + loc.Value AS LocatorValue, loc.X, loc.Y, loc.Z +FROM M_InOut h + INNER JOIN M_InOutLine l ON (h.M_InOut_ID=l.M_InOut_ID) + LEFT OUTER JOIN M_Locator loc ON (l.M_Locator_ID=loc.M_Locator_ID) + LEFT OUTER JOIN M_AttributeSetInstance pasi ON (l.M_AttributeSetInstance_ID=pasi.M_AttributeSetInstance_ID); + + + diff --git a/db/ddlutils/postgresql/views/RV_INOUTLINECONFIRM.sql b/db/ddlutils/postgresql/views/RV_INOUTLINECONFIRM.sql new file mode 100644 index 0000000000..4a6075e127 --- /dev/null +++ b/db/ddlutils/postgresql/views/RV_INOUTLINECONFIRM.sql @@ -0,0 +1,22 @@ +CREATE OR REPLACE VIEW RV_INOUTLINECONFIRM +(M_INOUTCONFIRM_ID, M_INOUTLINECONFIRM_ID, AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, + CREATED, CREATEDBY, UPDATED, UPDATEDBY, TARGETQTY, + CONFIRMEDQTY, DIFFERENCEQTY, SCRAPPEDQTY, DESCRIPTION, PROCESSED, + M_INOUT_ID, DOCUMENTNO, CONFIRMTYPE, ISAPPROVED, ISCANCELLED, + C_BPARTNER_ID, C_BPARTNER_LOCATION_ID, M_WAREHOUSE_ID, C_ORDER_ID, ISSOTRX, + M_INOUTLINE_ID, M_PRODUCT_ID, M_ATTRIBUTESETINSTANCE_ID, M_LOCATOR_ID) +AS +SELECT cl.M_InOutConfirm_ID, cl.M_InOutLineConfirm_ID, + cl.AD_Client_ID, cl.AD_Org_ID, cl.IsActive, cl.Created, cl.CreatedBy, cl.Updated, cl.UpdatedBy, + cl.TargetQty, cl.ConfirmedQty, cl.DifferenceQty, cl.ScrappedQty, + cl.Description, cl.Processed, + c.M_InOut_ID, c.DocumentNo, c.ConfirmType, c.IsApproved, c.IsCancelled, + i.C_BPartner_ID, i.C_BPartner_Location_ID, i.M_Warehouse_ID, i.C_Order_ID, i.IsSOTrx, + cl.M_InOutLine_ID, il.M_Product_ID, il.M_AttributeSetInstance_ID, il.M_Locator_ID +FROM M_InOutLineConfirm cl + INNER JOIN M_InOutConfirm c ON (cl.M_InOutConfirm_ID=c.M_InOutConfirm_ID) + INNER JOIN M_InOut i ON (c.M_InOut_ID=i.M_InOut_ID) + INNER JOIN M_InOutLine il ON (cl.M_InOutLine_ID=il.M_InOutLine_ID); + + + diff --git a/db/ddlutils/postgresql/views/RV_M_REQUISITION.sql b/db/ddlutils/postgresql/views/RV_M_REQUISITION.sql new file mode 100644 index 0000000000..6baa98a918 --- /dev/null +++ b/db/ddlutils/postgresql/views/RV_M_REQUISITION.sql @@ -0,0 +1,22 @@ +CREATE OR REPLACE VIEW RV_M_REQUISITION +(M_REQUISITION_ID, AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, + CREATEDBY, UPDATED, UPDATEDBY, DOCUMENTNO, DESCRIPTION, + HELP, AD_USER_ID, M_PRICELIST_ID, M_WAREHOUSE_ID, ISAPPROVED, + PRIORITYRULE, DATEREQUIRED, TOTALLINES, DOCACTION, DOCSTATUS, + PROCESSED, M_REQUISITIONLINE_ID, LINE, QTY, M_PRODUCT_ID, + LINEDESCRIPTION, PRICEACTUAL, LINENETAMT) +AS +SELECT r.M_Requisition_ID, + r.AD_Client_ID, r.AD_Org_ID, r.IsActive, r.Created, r.CreatedBy, r.Updated, r.UpdatedBy, + r.DocumentNo, r.Description, r.Help, + r.AD_User_ID, r.M_PriceList_ID, r.M_Warehouse_ID, r.IsApproved, r.PriorityRule, + r.DateRequired, r.TotalLines, r.DocAction, r.DocStatus, r.Processed, + l.M_RequisitionLine_ID, l.Line, + l.Qty, l.M_Product_ID, + l.Description AS LineDescription, + l.PriceActual, l.LineNetAmt +FROM M_Requisition r + INNER JOIN M_RequisitionLine l ON (r.M_Requisition_ID=l.M_Requisition_ID); + + + diff --git a/db/ddlutils/postgresql/views/RV_M_TRANSACTION.sql b/db/ddlutils/postgresql/views/RV_M_TRANSACTION.sql new file mode 100644 index 0000000000..b4cffa7d80 --- /dev/null +++ b/db/ddlutils/postgresql/views/RV_M_TRANSACTION.sql @@ -0,0 +1,16 @@ +CREATE OR REPLACE VIEW RV_M_TRANSACTION +(AD_CLIENT_ID, AD_ORG_ID, MOVEMENTDATE, MOVEMENTQTY, M_PRODUCT_ID, + M_LOCATOR_ID, M_ATTRIBUTESETINSTANCE_ID, M_PRODUCT_CATEGORY_ID, VALUE, C_BPARTNER_ID, + PRICEPO, PRICELASTPO, PRICELIST) +AS +SELECT t.AD_Client_ID,t.AD_Org_ID, t.MovementDate, t.MovementQty, + t.M_Product_ID, t.M_Locator_ID, t.M_AttributeSetInstance_ID, + p.M_Product_Category_ID, p.Value, + po.C_BPartner_ID, po.PricePO, po.PriceLastPO, po.PriceList +FROM M_Transaction t + INNER JOIN M_Product p ON (t.M_Product_ID=p.M_Product_ID) + INNER JOIN M_Product_PO po ON (t.M_Product_ID=po.M_Product_ID) +WHERE po.IsCurrentVendor='Y'; + + + diff --git a/db/ddlutils/postgresql/views/RV_M_TRANSACTION_SUM.sql b/db/ddlutils/postgresql/views/RV_M_TRANSACTION_SUM.sql new file mode 100644 index 0000000000..75962ccf3b --- /dev/null +++ b/db/ddlutils/postgresql/views/RV_M_TRANSACTION_SUM.sql @@ -0,0 +1,14 @@ +CREATE OR REPLACE VIEW RV_M_TRANSACTION_SUM +(AD_CLIENT_ID, AD_ORG_ID, MOVEMENTTYPE, M_WAREHOUSE_ID, M_LOCATOR_ID, + M_PRODUCT_ID, MOVEMENTDATE, MOVEMENTQTY) +AS +SELECT t.AD_Client_ID, t.AD_Org_ID, + t.MovementType, l.M_Warehouse_ID, t.M_Locator_ID, t.M_Product_ID, t.MovementDate, + SUM(t.MovementQty) AS MovementQty +FROM M_Transaction t, M_Locator l +WHERE t.M_Locator_ID=l.M_Locator_ID +GROUP BY t.AD_Client_ID, t.AD_Org_ID, + t.MovementType, l.M_Warehouse_ID, t.M_Locator_ID, t.M_Product_ID, t.MovementDate; + + + diff --git a/db/ddlutils/views/RV_OPENITEM.sql b/db/ddlutils/postgresql/views/RV_OPENITEM.sql similarity index 100% rename from db/ddlutils/views/RV_OPENITEM.sql rename to db/ddlutils/postgresql/views/RV_OPENITEM.sql diff --git a/db/ddlutils/postgresql/views/RV_ORDERDETAIL.sql b/db/ddlutils/postgresql/views/RV_ORDERDETAIL.sql new file mode 100644 index 0000000000..a8d312f5a6 --- /dev/null +++ b/db/ddlutils/postgresql/views/RV_ORDERDETAIL.sql @@ -0,0 +1,43 @@ +CREATE OR REPLACE VIEW RV_ORDERDETAIL +(AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, + UPDATED, UPDATEDBY, C_ORDER_ID, DOCSTATUS, DOCACTION, + C_DOCTYPE_ID, ISAPPROVED, ISCREDITAPPROVED, SALESREP_ID, BILL_BPARTNER_ID, + BILL_LOCATION_ID, BILL_USER_ID, ISDROPSHIP, C_BPARTNER_ID, C_BPARTNER_LOCATION_ID, + AD_USER_ID, POREFERENCE, C_CURRENCY_ID, ISSOTRX, C_CAMPAIGN_ID, + C_PROJECT_ID, C_ACTIVITY_ID, C_PROJECTPHASE_ID, C_PROJECTTASK_ID, C_ORDERLINE_ID, + DATEORDERED, DATEPROMISED, M_PRODUCT_ID, M_WAREHOUSE_ID, M_ATTRIBUTESETINSTANCE_ID, + PRODUCTATTRIBUTE, M_ATTRIBUTESET_ID, M_LOT_ID, GUARANTEEDATE, LOT, + SERNO, C_UOM_ID, QTYENTERED, QTYORDERED, QTYRESERVED, + QTYDELIVERED, QTYINVOICED, PRICEACTUAL, PRICEENTERED, QTYTODELIVER, + QTYTOINVOICE, NETAMTTOINVOICE, QTYLOSTSALES, AMTLOSTSALES, DISCOUNT, + MARGIN, MARGINAMT) +AS +SELECT l.AD_Client_ID, l.AD_Org_ID, + l.IsActive, l.Created, l.CreatedBy, l.Updated, l.UpdatedBy, + o.C_Order_ID, o.DocStatus, o.DocAction, o.C_DocType_ID, o.IsApproved, o.IsCreditApproved, + o.SalesRep_ID, + o.Bill_BPartner_ID, o.Bill_Location_ID, o.Bill_User_ID, o.IsDropShip, + l.C_BPartner_ID, l.C_BPartner_Location_ID, o.AD_User_ID, + o.POReference, o.C_Currency_ID, o.IsSOTrx, + l.C_Campaign_ID, l.C_Project_ID, l.C_Activity_ID, l.C_ProjectPhase_ID, l.C_ProjectTask_ID, + l.C_OrderLine_ID, l.DateOrdered, l.DatePromised, l.M_Product_ID, l.M_Warehouse_ID, + l.M_AttributeSetInstance_ID, productAttribute(l.M_AttributeSetInstance_ID) AS ProductAttribute, + pasi.M_AttributeSet_ID, pasi.M_Lot_ID, pasi.GuaranteeDate, pasi.Lot, pasi.SerNo, + l.C_UOM_ID, l.QtyEntered, l.QtyOrdered, l.QtyReserved, l.QtyDelivered, l.QtyInvoiced, + l.PriceActual, l.PriceEntered, + l.QtyOrdered-l.QtyDelivered AS QtyToDeliver, + l.QtyOrdered-l.QtyInvoiced AS QtyToInvoice, + (l.QtyOrdered-l.QtyInvoiced)*l.PriceActual AS NetAmtToInvoice, + l.QtyLostSales, l.QtyLostSales*l.PriceActual AS AmtLostSales, + CASE WHEN PriceList=0 THEN 0 ELSE + ROUND((PriceList-PriceActual)/PriceList*100,2) END AS Discount, + CASE WHEN PriceLimit=0 THEN 0 ELSE + ROUND((PriceActual-PriceLimit)/PriceLimit*100,2) END AS Margin, + CASE WHEN PriceLimit=0 THEN 0 ELSE + (PriceActual-PriceLimit)*QtyDelivered END AS MarginAmt +FROM C_Order o + INNER JOIN C_OrderLine l ON (o.C_Order_ID=l.C_Order_ID) + LEFT OUTER JOIN M_AttributeSetInstance pasi ON (l.M_AttributeSetInstance_ID=pasi.M_AttributeSetInstance_ID); + + + diff --git a/db/ddlutils/postgresql/views/RV_PAYMENT.sql b/db/ddlutils/postgresql/views/RV_PAYMENT.sql new file mode 100644 index 0000000000..175ee97043 --- /dev/null +++ b/db/ddlutils/postgresql/views/RV_PAYMENT.sql @@ -0,0 +1,45 @@ +CREATE OR REPLACE VIEW RV_PAYMENT +(C_PAYMENT_ID, AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, + CREATEDBY, UPDATED, UPDATEDBY, DOCUMENTNO, DATETRX, + ISRECEIPT, C_DOCTYPE_ID, TRXTYPE, C_BANKACCOUNT_ID, C_BPARTNER_ID, + C_INVOICE_ID, C_BP_BANKACCOUNT_ID, C_PAYMENTBATCH_ID, TENDERTYPE, CREDITCARDTYPE, + CREDITCARDNUMBER, CREDITCARDVV, CREDITCARDEXPMM, CREDITCARDEXPYY, MICR, + ROUTINGNO, ACCOUNTNO, CHECKNO, A_NAME, A_STREET, + A_CITY, A_STATE, A_ZIP, A_IDENT_DL, A_IDENT_SSN, + A_EMAIL, VOICEAUTHCODE, ORIG_TRXID, PONUM, C_CURRENCY_ID, + C_CONVERSIONTYPE_ID, PAYAMT, DISCOUNTAMT, WRITEOFFAMT, TAXAMT, + OVERUNDERAMT, MULTIPLIERAP, ALLOCATEDAMT, AVAILABLEAMT, ISOVERUNDERPAYMENT, + ISAPPROVED, R_PNREF, R_RESULT, R_RESPMSG, R_AUTHCODE, + R_AVSADDR, R_AVSZIP, R_INFO, PROCESSING, OPROCESSING, + DOCSTATUS, DOCACTION, ISPREPAYMENT, C_CHARGE_ID, ISRECONCILED, + ISALLOCATED, ISONLINE, PROCESSED, POSTED, C_CAMPAIGN_ID, + C_PROJECT_ID, C_ACTIVITY_ID) +AS +SELECT C_Payment_ID, AD_Client_ID, AD_Org_ID, IsActive, Created, CreatedBy, Updated, UpdatedBy, + DocumentNo, DateTrx, IsReceipt, C_DocType_ID, TrxType, + C_BankAccount_ID, C_BPartner_ID, C_Invoice_ID, C_BP_BankAccount_ID, C_PaymentBatch_ID, + TenderType, CreditCardType, CreditCardNumber, CreditCardVV, CreditCardExpMM, CreditCardExpYY, + Micr, RoutingNo, AccountNo, CheckNo, + A_Name, A_Street, A_City, A_State, A_Zip, A_Ident_DL, A_Ident_SSN, A_EMail, + VoiceAuthCode, Orig_TrxID, PONum, + C_Currency_ID, C_ConversionType_ID, + CASE IsReceipt WHEN 'Y' THEN PayAmt ELSE PayAmt*-1 END AS PayAmt, + CASE IsReceipt WHEN 'Y' THEN DiscountAmt ELSE DiscountAmt*-1 END AS DiscountAmt, + CASE IsReceipt WHEN 'Y' THEN WriteOffAmt ELSE WriteOffAmt*-1 END AS WriteOffAmt, + CASE IsReceipt WHEN 'Y' THEN TaxAmt ELSE TaxAmt*-1 END AS TaxAmt, + CASE IsReceipt WHEN 'Y' THEN OverUnderAmt ELSE OverUnderAmt*-1 END AS OverUnderAmt, + CASE IsReceipt WHEN 'Y' THEN 1 ELSE -1 END AS MultiplierAP, + paymentAllocated(C_Payment_ID, C_Currency_ID) AS AllocatedAmt, + paymentAvailable(C_Payment_ID) AS AvailableAmt, + IsOverUnderPayment, IsApproved, + R_PnRef, R_Result, R_RespMsg, R_AuthCode, R_AvsAddr, R_AvsZip, R_Info, + Processing, OProcessing, DocStatus, DocAction, + IsPrepayment, C_Charge_ID, + IsReconciled, IsAllocated, IsOnline, Processed, Posted, + C_Campaign_ID, C_Project_ID, C_Activity_ID +FROM C_Payment; + +--COMMENT ON TABLE RV_PAYMENT IS 'Payment Information corrected for AP/AR'; + + + diff --git a/db/ddlutils/postgresql/views/RV_PRINTFORMATDETAIL.sql b/db/ddlutils/postgresql/views/RV_PRINTFORMATDETAIL.sql new file mode 100644 index 0000000000..e1a3b61a2a --- /dev/null +++ b/db/ddlutils/postgresql/views/RV_PRINTFORMATDETAIL.sql @@ -0,0 +1,45 @@ +CREATE OR REPLACE VIEW RV_PRINTFORMATDETAIL +(AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, + UPDATED, UPDATEDBY, AD_PRINTFORMAT_ID, NAME, DESCRIPTION, + ISTABLEBASED, ISFORM, AD_TABLE_ID, AD_REPORTVIEW_ID, AD_PRINTPAPER_ID, + DEFAULT_AD_PRINTCOLOR_ID, DEFAULT_AD_PRINTFONT_ID, ISSTANDARDHEADERFOOTER, AD_PRINTTABLEFORMAT_ID, HEADERMARGIN, + FOOTERMARGIN, PRINTERNAME, ISDEFAULT, AD_PRINTFORMATITEM_ID, ITEMNAME, + PRINTNAME, PRINTNAMESUFFIX, ISPRINTED, PRINTAREATYPE, SEQNO, + PRINTFORMATTYPE, AD_COLUMN_ID, AD_PRINTFORMATCHILD_ID, IMAGEISATTACHED, IMAGEURL, + ISRELATIVEPOSITION, ISNEXTLINE, XSPACE, YSPACE, XPOSITION, + YPOSITION, MAXWIDTH, ISHEIGHTONELINE, MAXHEIGHT, ISFIXEDWIDTH, + ISSETNLPOSITION, ISSUPPRESSNULL, BELOWCOLUMN, FIELDALIGNMENTTYPE, LINEALIGNMENTTYPE, + AD_PRINTCOLOR_ID, AD_PRINTFONT_ID, ISORDERBY, SORTNO, ISGROUPBY, + ISPAGEBREAK, ISNEXTPAGE, ISSUMMARIZED, ISAVERAGED, ISCOUNTED, + ISMINCALC, ISMAXCALC, ISVARIANCECALC, ISDEVIATIONCALC, ISRUNNINGTOTAL, + RUNNINGTOTALLINES, AD_PRINTGRAPH_ID) +AS +SELECT f.AD_Client_ID, f.AD_Org_ID, i.IsActive, i.Created,i.CreatedBy,i.Updated,i.UpdatedBy, + f.AD_PrintFormat_ID, + f.Name, f.Description, + f.IsTableBased,f.IsForm,f.AD_Table_ID,f.AD_ReportView_ID, + f.AD_PrintPaper_ID, + f.AD_PrintColor_ID AS Default_AD_PrintColor_ID, + f.AD_PrintFont_ID AS Default_AD_PrintFont_ID, + f.IsStandardHeaderFooter, + f.AD_PrintTableFormat_ID, + f.HeaderMargin,f.FooterMargin, + f.PrinterName,f.IsDefault, + i.AD_PrintFormatItem_ID, + i.Name AS ItemName, i.PrintName, i.PrintNameSuffix, i.IsPrinted, i.PrintAreaType, i.SeqNo, + i.PrintFormatType, i.AD_Column_ID, i.AD_PrintFormatChild_ID, i.ImageIsAttached,i.ImageURL, + i.IsRelativePosition, i.IsNextLine, XSpace,YSpace, XPosition,YPosition, + i.MaxWidth, IsHeightOneLine, MaxHeight, i.IsFixedWidth, + i.IsSetNLPosition,i.IsSuppressNull, i.BelowColumn, + i.FieldAlignmentType,i.LineAlignmentType, + i.AD_PrintColor_ID,i.AD_PrintFont_ID, + i.IsOrderBy,i.SortNo, i.IsGroupBy,i.IsPageBreak,i.IsNextPage, + i.IsSummarized,i.IsAveraged,i.IsCounted,i.IsMinCalc,i.IsMaxCalc, + i.IsVarianceCalc,i.IsDeviationCalc, + i.IsRunningTotal,i.RunningTotalLines, + i.AD_PrintGraph_ID +FROM AD_PrintFormat f + INNER JOIN AD_PrintFormatItem i ON (f.AD_PrintFormat_ID=i.AD_PrintFormat_ID); + + + diff --git a/db/ddlutils/postgresql/views/RV_PRODUCT_COSTING.sql b/db/ddlutils/postgresql/views/RV_PRODUCT_COSTING.sql new file mode 100644 index 0000000000..54d51b1596 --- /dev/null +++ b/db/ddlutils/postgresql/views/RV_PRODUCT_COSTING.sql @@ -0,0 +1,29 @@ +CREATE OR REPLACE VIEW RV_PRODUCT_COSTING +(M_PRODUCT_ID, C_ACCTSCHEMA_ID, VALUE, NAME, M_PRODUCT_CATEGORY_ID, + AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, + UPDATED, UPDATEDBY, CURRENTCOSTPRICE, FUTURECOSTPRICE, COSTSTANDARD, + COSTSTANDARDPOQTY, COSTSTANDARDPOAMT, COSTSTANDARDPODIFF, COSTSTANDARDCUMQTY, COSTSTANDARDCUMAMT, + COSTSTANDARDINVDIFF, COSTAVERAGE, COSTAVERAGECUMQTY, COSTAVERAGECUMAMT, TOTALINVQTY, + TOTALINVAMT, TOTALINVCOST, PRICELASTPO, PRICELASTINV) +AS +SELECT pc.M_Product_ID, pc.C_AcctSchema_ID, p.Value, p.Name, p.M_Product_Category_ID, + pc.AD_Client_ID, pc.AD_Org_ID, pc.IsActive, pc.Created,pc.CreatedBy,pc.Updated,pc.UpdatedBy, + pc.CurrentCostPrice, + -- Standard Costing + pc.FutureCostPrice, pc.CostStandard, + pc.CostStandardPOQty, pc.CostStandardPOAmt, + CASE WHEN pc.CostStandardPOQty=0 THEN 0 ELSE pc.CostStandardPOAmt/pc.CostStandardPOQty END AS CostStandardPODiff, + pc.CostStandardCumQty, pc.CostStandardCumAmt, + CASE WHEN pc.CostStandardCumQty=0 THEN 0 ELSE pc.CostStandardCumAmt/pc.CostStandardCumQty END AS CostStandardInvDiff, + -- Average Costing + pc.CostAverage, + pc.CostAverageCumQty, pc.CostAverageCumAmt, + pc.TotalInvQty, pc.TotalInvAmt, + CASE WHEN pc.TotalInvQty=0 THEN 0 ELSE pc.TotalInvAmt/pc.TotalInvQty END AS TotalInvCost, + -- LastPrice + pc.PriceLastPO, pc.PriceLastInv +FROM M_Product_Costing pc + INNER JOIN M_Product p ON (pc.M_Product_ID=p.M_Product_ID); + + + diff --git a/db/ddlutils/postgresql/views/RV_PROJECTCYCLE.sql b/db/ddlutils/postgresql/views/RV_PROJECTCYCLE.sql new file mode 100644 index 0000000000..715d542d7d --- /dev/null +++ b/db/ddlutils/postgresql/views/RV_PROJECTCYCLE.sql @@ -0,0 +1,38 @@ +CREATE OR REPLACE VIEW RV_PROJECTCYCLE +(AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, + UPDATED, UPDATEDBY, C_CYCLE_ID, CYCLENAME, C_CURRENCY_ID, + C_CYCLESTEP_ID, CYCLESTEPNAME, SEQNO, RELATIVEWEIGHT, C_PHASE_ID, + PROJECTPHASENAME, C_PROJECTTYPE_ID, PROJECTTYPENAME, PROJECTVALUE, PROJECTNAME, + DESCRIPTION, NOTE, C_BPARTNER_ID, C_BPARTNER_LOCATION_ID, AD_USER_ID, + POREFERENCE, SALESREP_ID, M_WAREHOUSE_ID, PROJECTCATEGORY, DATECONTRACT, + DATEFINISH, ISCOMMITMENT, ISCOMMITCEILING, COMMITTEDQTY, COMMITTEDAMT, + PLANNEDQTY, PLANNEDAMT, PLANNEDMARGINAMT, INVOICEDAMT, INVOICEDQTY, + PROJECTBALANCEAMT) +AS +SELECT p.AD_Client_ID, p.AD_Org_ID, p.IsActive, p.Created,p.CreatedBy, p.Updated,p.UpdatedBy, + c.C_Cycle_ID, c.Name AS CycleName, c.C_Currency_ID, + cs.C_CycleStep_ID, cs.Name AS CycleStepName, cs.SeqNo, cs.RelativeWeight, + pp.C_Phase_ID, pp.Name AS ProjectPhaseName, + pt.C_ProjectType_ID, pt.Name AS ProjectTypeName, + p.Value AS ProjectValue, p.Name AS ProjectName, p.Description, p.Note, + p.C_BPartner_ID, p.C_BPartner_Location_ID, p.AD_User_ID, p.POReference, + p.SalesRep_ID, p.M_Warehouse_ID, p.ProjectCategory, + p.DateContract, p.DateFinish, + p.IsCommitment, p.IsCommitCeiling, + p.CommittedQty*cs.RelativeWeight AS CommittedQty, + currencyConvert (p.CommittedAmt, p.C_Currency_ID, c.C_Currency_ID, getdate(),0, p.AD_Client_ID, p.AD_Org_ID)*cs.RelativeWeight AS CommittedAmt, + p.PlannedQty*cs.RelativeWeight AS PlannedQty, + currencyConvert (p.PlannedAmt, p.C_Currency_ID, c.C_Currency_ID, getdate(),0, p.AD_Client_ID, p.AD_Org_ID)*cs.RelativeWeight AS PlannedAmt, + currencyConvert (p.PlannedMarginAmt, p.C_Currency_ID, c.C_Currency_ID, getdate(),0, p.AD_Client_ID, p.AD_Org_ID)*cs.RelativeWeight AS PlannedMarginAmt, + currencyConvert (p.InvoicedAmt, p.C_Currency_ID, c.C_Currency_ID, getdate(),0, p.AD_Client_ID, p.AD_Org_ID)*cs.RelativeWeight AS InvoicedAmt, + p.InvoicedQty*cs.RelativeWeight AS InvoicedQty, + currencyConvert (p.ProjectBalanceAmt, p.C_Currency_ID, c.C_Currency_ID, getdate(),0, p.AD_Client_ID, p.AD_Org_ID)*cs.RelativeWeight AS ProjectBalanceAmt +FROM C_Cycle c + INNER JOIN C_CycleStep cs ON (c.C_Cycle_ID=cs.C_Cycle_ID) + INNER JOIN C_CyclePhase cp ON (cs.C_CycleStep_ID=cp.C_CycleStep_ID) + INNER JOIN C_Phase pp ON (cp.C_Phase_ID=pp.C_Phase_ID) + INNER JOIN C_Project p ON (cp.C_Phase_ID=p.C_Phase_ID) + INNER JOIN C_ProjectType pt ON (p.C_ProjectType_ID=pt.C_ProjectType_ID); + + + diff --git a/db/ddlutils/postgresql/views/RV_PROJECTLINEISSUE.sql b/db/ddlutils/postgresql/views/RV_PROJECTLINEISSUE.sql new file mode 100644 index 0000000000..86d431bd2b --- /dev/null +++ b/db/ddlutils/postgresql/views/RV_PROJECTLINEISSUE.sql @@ -0,0 +1,33 @@ +CREATE OR REPLACE VIEW RV_PROJECTLINEISSUE +(AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, + UPDATED, UPDATEDBY, C_PROJECT_ID, M_PRODUCT_ID, C_PROJECTLINE_ID, + LINE, DESCRIPTION, PLANNEDQTY, PLANNEDPRICE, PLANNEDAMT, + PLANNEDMARGINAMT, COMMITTEDQTY, C_PROJECTISSUE_ID, M_LOCATOR_ID, MOVEMENTQTY, + MOVEMENTDATE, ISSUELINE, ISSUEDESCRIPTION, M_INOUTLINE_ID, S_TIMEEXPENSELINE_ID, + C_ACCTSCHEMA_ID, ACCOUNT_ID, AMTSOURCEDR, AMTSOURCECR, AMTACCTDR, + AMTACCTCR, LINEMARGIN) +AS +SELECT COALESCE(l.AD_Client_ID,i.AD_Client_ID) AS AD_Client_ID,COALESCE(l.AD_Org_ID,i.AD_Org_ID) AS AD_Org_ID, + COALESCE(l.IsActive,i.IsActive) AS IsActive, + COALESCE(l.Created,i.Created) AS Created,COALESCE(l.CreatedBy,i.CreatedBy) AS CreatedBy, + COALESCE(l.Updated,i.Updated) AS Updated,COALESCE(l.UpdatedBy,i.UpdatedBy) AS UpdatedBy, + COALESCE(l.C_Project_ID,i.C_Project_ID) AS C_Project_ID, + COALESCE(l.M_Product_ID,i.M_Product_ID) AS M_Product_ID, + -- + l.C_ProjectLine_ID, l.Line, l.Description, l.PlannedQty, l.PlannedPrice, l.PlannedAmt, + l.PlannedMarginAmt, l.CommittedQty, + -- + i.C_ProjectIssue_ID, i.M_Locator_ID, i.MovementQty, i.MovementDate, + i.Line AS IssueLine, i.Description AS IssueDescription, + i.M_InOutLine_ID, i.S_TimeExpenseLine_ID, + -- + fa.C_AcctSchema_ID, fa.Account_ID, + fa.AmtSourceDr, fa.AmtSourceCr, fa.AmtAcctDr, fa.AmtAcctCr, + -- + l.PlannedAmt-fa.AmtSourceDr+fa.AmtSourceCr AS LineMargin +FROM C_ProjectLine l + FULL JOIN C_ProjectIssue i ON (i.C_Project_ID=l.C_Project_ID AND i.C_ProjectIssue_ID=l.C_ProjectIssue_ID) + LEFT OUTER JOIN Fact_Acct fa ON (fa.AD_Table_ID=623 AND fa.Record_ID=i.C_ProjectIssue_ID AND fa.M_Locator_ID IS NULL); + + + diff --git a/db/ddlutils/views/RV_REQUESTUPDATES.sql b/db/ddlutils/postgresql/views/RV_REQUESTUPDATES.sql similarity index 100% rename from db/ddlutils/views/RV_REQUESTUPDATES.sql rename to db/ddlutils/postgresql/views/RV_REQUESTUPDATES.sql diff --git a/db/ddlutils/postgresql/views/RV_REQUESTUPDATES_ONLY.sql b/db/ddlutils/postgresql/views/RV_REQUESTUPDATES_ONLY.sql new file mode 100644 index 0000000000..48877be000 --- /dev/null +++ b/db/ddlutils/postgresql/views/RV_REQUESTUPDATES_ONLY.sql @@ -0,0 +1,14 @@ +CREATE OR REPLACE VIEW RV_REQUESTUPDATES_ONLY +(AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, + UPDATED, UPDATEDBY, R_REQUEST_ID, AD_USER_ID) +AS +SELECT MIN(AD_Client_ID) AS AD_Client_ID, MIN(AD_Org_ID) AS AD_ORG_ID, + cast('Y' as char) AS IsActive, + getdate() AS Created, 0 AS CreatedBy, getdate() AS Updated, 0 AS UpdatedBy, + R_Request_ID, AD_User_ID +FROM RV_RequestUpdates +WHERE IsActive='Y' +GROUP BY R_Request_ID, AD_User_ID; + + + diff --git a/db/ddlutils/postgresql/views/RV_REQUESTUPDATES_V.sql b/db/ddlutils/postgresql/views/RV_REQUESTUPDATES_V.sql new file mode 100644 index 0000000000..7853b2f5a4 --- /dev/null +++ b/db/ddlutils/postgresql/views/RV_REQUESTUPDATES_V.sql @@ -0,0 +1,14 @@ +CREATE OR REPLACE VIEW RV_REQUESTUPDATES_V +(AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, + UPDATED, UPDATEDBY, R_REQUEST_ID, AD_USER_ID) +AS +SELECT MIN(AD_Client_ID) AS AD_Client_ID, MIN(AD_Org_ID) AS AD_ORG_ID, + cast('Y' as char) AS IsActive, + getdate() AS Created, 0 AS CreatedBy, getdate() AS Updated, 0 AS UpdatedBy, + R_Request_ID, AD_User_ID +FROM RV_RequestUpdates +WHERE IsActive='Y' +GROUP BY R_Request_ID, AD_User_ID; + + + diff --git a/db/ddlutils/postgresql/views/RV_STORAGE.sql b/db/ddlutils/postgresql/views/RV_STORAGE.sql new file mode 100644 index 0000000000..33d6c33ec0 --- /dev/null +++ b/db/ddlutils/postgresql/views/RV_STORAGE.sql @@ -0,0 +1,32 @@ +CREATE OR REPLACE VIEW RV_STORAGE +(AD_CLIENT_ID, AD_ORG_ID, M_PRODUCT_ID, VALUE, NAME, + DESCRIPTION, UPC, SKU, C_UOM_ID, M_PRODUCT_CATEGORY_ID, + CLASSIFICATION, WEIGHT, VOLUME, VERSIONNO, GUARANTEEDAYS, + GUARANTEEDAYSMIN, M_LOCATOR_ID, M_WAREHOUSE_ID, X, Y, + Z, QTYONHAND, QTYRESERVED, QTYAVAILABLE, QTYORDERED, + DATELASTINVENTORY, M_ATTRIBUTESETINSTANCE_ID, M_ATTRIBUTESET_ID, SERNO, LOT, + M_LOT_ID, GUARANTEEDATE, SHELFLIFEDAYS, GOODFORDAYS, SHELFLIFEREMAININGPCT) +AS +SELECT s.AD_Client_ID, s.AD_Org_ID, + -- Product + s.M_Product_ID,p.Value,p.Name,p.Description,p.UPC,p.SKU, + p.C_UOM_ID,p.M_Product_Category_ID,p.Classification, p.Weight,p.Volume,p.VersionNo, + p.GuaranteeDays,p.GuaranteeDaysMin, + -- Locator + s.M_Locator_ID, l.M_Warehouse_ID, l.X, l.Y, l.Z, + -- Storage + s.QtyOnHand, s.QtyReserved, s.QtyOnHand-s.QtyReserved AS QtyAvailable, + s.QtyOrdered, s.DateLastInventory, + -- Instance + s.M_AttributeSetInstance_ID, asi.M_AttributeSet_ID, asi.SerNo, asi.Lot, asi.M_Lot_ID, + asi.GuaranteeDate, -- see PAttributeInstance.java + daysBetween(asi.GuaranteeDate,getdate()) AS ShelfLifeDays, + daysBetween(asi.GuaranteeDate,getdate())-p.GuaranteeDaysMin AS GoodForDays, + ROUND((daysBetween(asi.GuaranteeDate,getdate())/p.GuaranteeDays)*100,0) AS ShelfLifeRemainingPct +FROM M_Storage s + INNER JOIN M_Locator l ON (s.M_Locator_ID=l.M_Locator_ID) + INNER JOIN M_Product p ON (s.M_Product_ID=p.M_Product_ID) + LEFT OUTER JOIN M_AttributeSetInstance asi ON (s.M_AttributeSetInstance_ID=asi.M_AttributeSetInstance_ID); + + + diff --git a/db/ddlutils/postgresql/views/RV_TRANSACTION.sql b/db/ddlutils/postgresql/views/RV_TRANSACTION.sql new file mode 100644 index 0000000000..6720db2265 --- /dev/null +++ b/db/ddlutils/postgresql/views/RV_TRANSACTION.sql @@ -0,0 +1,44 @@ +CREATE OR REPLACE VIEW RV_TRANSACTION +(M_TRANSACTION_ID, AD_CLIENT_ID, AD_ORG_ID, MOVEMENTTYPE, MOVEMENTDATE, + MOVEMENTQTY, M_ATTRIBUTESETINSTANCE_ID, M_ATTRIBUTESET_ID, SERNO, LOT, + M_LOT_ID, GUARANTEEDATE, M_PRODUCT_ID, VALUE, NAME, + DESCRIPTION, UPC, SKU, C_UOM_ID, M_PRODUCT_CATEGORY_ID, + CLASSIFICATION, WEIGHT, VOLUME, VERSIONNO, M_LOCATOR_ID, + M_WAREHOUSE_ID, X, Y, Z, M_INVENTORYLINE_ID, + M_INVENTORY_ID, M_MOVEMENTLINE_ID, M_MOVEMENT_ID, M_INOUTLINE_ID, M_INOUT_ID, + M_PRODUCTIONLINE_ID, M_PRODUCTIONPLAN_ID, M_PRODUCTION_ID, C_PROJECTISSUE_ID, C_PROJECT_ID, + LINE) +AS +SELECT t.M_Transaction_ID, t.AD_Client_ID,t.AD_Org_ID, + t.MovementType,t.MovementDate,t.MovementQty, + -- Instance + t.M_AttributeSetInstance_ID, asi.M_AttributeSet_ID, asi.SerNo, asi.Lot, asi.M_Lot_ID,asi.GuaranteeDate, + -- Product + t.M_Product_ID,p.Value,p.Name,p.Description,p.UPC,p.SKU, + p.C_UOM_ID,p.M_Product_Category_ID,p.Classification, p.Weight,p.Volume,p.VersionNo, + -- Locator + t.M_Locator_ID, l.M_Warehouse_ID, l.X, l.Y, l.Z, + -- Inventory + t.M_InventoryLine_ID,il.M_Inventory_ID, + -- Movement + t.M_MovementLine_ID,ml.M_Movement_ID, + -- In/Out + t.M_InOutLine_ID,iol.M_InOut_ID, + -- Production + t.M_ProductionLine_ID,prdl.M_ProductionPlan_ID,prdp.M_Production_ID, + -- ProjectIssue + t.C_ProjectIssue_ID,pjl.C_Project_ID, + COALESCE(il.Line,ml.Line,iol.Line,prdl.Line,pjl.Line) AS Line +FROM M_Transaction t + INNER JOIN M_Locator l ON (t.M_Locator_ID=l.M_Locator_ID) + INNER JOIN M_Product p ON (t.M_Product_ID=p.M_Product_ID) + LEFT OUTER JOIN M_AttributeSetInstance asi ON (t.M_AttributeSetInstance_ID=asi.M_AttributeSetInstance_ID) + LEFT OUTER JOIN M_InventoryLine il ON (t.M_InventoryLine_ID=il.M_InventoryLine_ID) + LEFT OUTER JOIN M_MovementLine ml ON (t.M_MovementLine_ID=ml.M_MovementLine_ID) + LEFT OUTER JOIN M_InOutLine iol ON (t.M_InOutLine_ID=iol.M_InOutLine_ID) + LEFT OUTER JOIN M_ProductionLine prdl ON (t.M_ProductionLine_ID=prdl.M_ProductionLine_ID) + LEFT OUTER JOIN M_ProductionPlan prdp ON (prdl.M_ProductionPlan_ID=prdp.M_ProductionPlan_ID) + LEFT OUTER JOIN C_ProjectIssue pjl ON (t.C_ProjectIssue_ID=pjl.C_ProjectIssue_ID); + + + diff --git a/db/ddlutils/postgresql/views/RV_UNPOSTED.sql b/db/ddlutils/postgresql/views/RV_UNPOSTED.sql new file mode 100644 index 0000000000..ea12da8afe --- /dev/null +++ b/db/ddlutils/postgresql/views/RV_UNPOSTED.sql @@ -0,0 +1,68 @@ +CREATE OR REPLACE VIEW RV_UNPOSTED +(AD_CLIENT_ID, AD_ORG_ID, CREATED, CREATEDBY, UPDATED, + UPDATEDBY, ISACTIVE, DOCUMENTNO, DATEDOC, DATEACCT, + AD_TABLE_ID, RECORD_ID, ISSOTRX) +AS +SELECT AD_Client_ID, AD_Org_ID, Created, CreatedBy, Updated, UpdatedBy, IsActive, + DocumentNo, DateDoc, DateAcct, 224 AS AD_Table_ID, GL_Journal_ID AS Record_ID, 'N' AS IsSOTrx +FROM GL_Journal WHERE Posted<>'Y' AND DocStatus<>'VO' +UNION +SELECT pi.AD_Client_ID, pi.AD_Org_ID, pi.Created, pi.CreatedBy, pi.Updated, pi.UpdatedBy, pi. IsActive, + p.Name || '_' || pi.Line, pi.MovementDate, pi.MovementDate, 623, pi.C_ProjectIssue_ID, 'N' +FROM C_ProjectIssue pi INNER JOIN C_Project p ON (pi.C_Project_ID=p.C_Project_ID) +WHERE Posted<>'Y' --AND DocStatus<>'VO' +UNION +SELECT AD_Client_ID, AD_Org_ID, Created, CreatedBy, Updated, UpdatedBy, IsActive, + DocumentNo, DateInvoiced, DateAcct, 318, C_Invoice_ID, IsSOTrx +FROM C_Invoice WHERE Posted<>'Y' AND DocStatus<>'VO' +UNION +SELECT AD_Client_ID, AD_Org_ID, Created, CreatedBy, Updated, UpdatedBy, IsActive, + DocumentNo, MovementDate, DateAcct, 319, M_InOut_ID, IsSOTrx +FROM M_InOut WHERE Posted<>'Y' AND DocStatus<>'VO' +UNION +SELECT AD_Client_ID, AD_Org_ID, Created, CreatedBy, Updated, UpdatedBy, IsActive, + DocumentNo, MovementDate, MovementDate, 321, M_Inventory_ID, 'N' +FROM M_Inventory WHERE Posted<>'Y' AND DocStatus<>'VO' +UNION +SELECT AD_Client_ID, AD_Org_ID, Created, CreatedBy, Updated, UpdatedBy, IsActive, + DocumentNo, MovementDate, MovementDate, 323, M_Movement_ID, 'N' +FROM M_Movement WHERE Posted<>'Y' AND DocStatus<>'VO' +UNION +SELECT AD_Client_ID, AD_Org_ID, Created, CreatedBy, Updated, UpdatedBy, IsActive, + Name, MovementDate, MovementDate, 325, M_Production_ID, 'N' +FROM M_Production WHERE Posted<>'Y' -- AND DocStatus<>'VO' +UNION +SELECT AD_Client_ID, AD_Org_ID, Created, CreatedBy, Updated, UpdatedBy, IsActive, + Name, StatementDate, DateAcct, 407, C_Cash_ID, 'N' +FROM C_Cash WHERE Posted<>'Y' AND DocStatus<>'VO' +UNION +SELECT AD_Client_ID, AD_Org_ID, Created, CreatedBy, Updated, UpdatedBy, IsActive, + DocumentNo, DateTrx, DateTrx, 335, C_Payment_ID, 'N' +FROM C_Payment WHERE Posted<>'Y' AND DocStatus<>'VO' +UNION +SELECT AD_Client_ID, AD_Org_ID, Created, CreatedBy, Updated, UpdatedBy, IsActive, + DocumentNo, DateTrx, DateTrx, 735, C_AllocationHdr_ID, 'N' +FROM C_AllocationHdr WHERE Posted<>'Y' AND DocStatus<>'VO' +UNION +SELECT AD_Client_ID, AD_Org_ID, Created, CreatedBy, Updated, UpdatedBy, IsActive, + Name, StatementDate, StatementDate, 392, C_BankStatement_ID, 'N' +FROM C_BankStatement WHERE Posted<>'Y' AND DocStatus<>'VO' +UNION +SELECT AD_Client_ID, AD_Org_ID, Created, CreatedBy, Updated, UpdatedBy, IsActive, + DocumentNo, DateTrx, DateTrx, 472, M_MatchInv_ID, 'N' +FROM M_MatchInv WHERE Posted<>'Y' --AND DocStatus<>'VO' +UNION +SELECT AD_Client_ID, AD_Org_ID, Created, CreatedBy, Updated, UpdatedBy, IsActive, + DocumentNo, DateTrx, DateTrx, 473, M_MatchPO_ID, 'N' +FROM M_MatchPO WHERE Posted<>'Y' --AND DocStatus<>'VO' +UNION +SELECT AD_Client_ID, AD_Org_ID, Created, CreatedBy, Updated, UpdatedBy, IsActive, + DocumentNo, DateOrdered, DateAcct, 259, C_Order_ID, IsSOTrx +FROM C_Order WHERE Posted<>'Y' AND DocStatus<>'VO' +UNION +SELECT AD_Client_ID, AD_Org_ID, Created, CreatedBy, Updated, UpdatedBy, IsActive, + DocumentNo, DateRequired, DateRequired, 702, M_Requisition_ID, 'N' +FROM M_Requisition WHERE Posted<>'Y' AND DocStatus<>'VO'; + + + diff --git a/db/ddlutils/postgresql/views/RV_WAREHOUSEPRICE.sql b/db/ddlutils/postgresql/views/RV_WAREHOUSEPRICE.sql new file mode 100644 index 0000000000..e8bee47bc6 --- /dev/null +++ b/db/ddlutils/postgresql/views/RV_WAREHOUSEPRICE.sql @@ -0,0 +1,39 @@ +CREATE OR REPLACE VIEW RV_WAREHOUSEPRICE +(AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, + UPDATED, UPDATEDBY, M_PRODUCT_ID, M_PRICELIST_VERSION_ID, M_WAREHOUSE_ID, + VALUE, NAME, UPC, SKU, C_UOM_ID, + UOMSYMBOL, PRICELIST, PRICESTD, MARGIN, PRICELIMIT, + WAREHOUSENAME, QTYAVAILABLE, QTYONHAND, QTYRESERVED, QTYORDERED, + ISINSTANCEATTRIBUTE) +AS +SELECT w.AD_Client_ID, w.AD_Org_ID, + CASE WHEN p.Discontinued='N' THEN 'Y' ELSE 'N' END AS IsActive, + pr.Created, pr.CreatedBy, pr.Updated, pr.UpdatedBy, + p.M_Product_ID, pr.M_PriceList_Version_ID, w.M_Warehouse_ID, + p.Value, p.Name, p.UPC, p.SKU, + uom.C_UOM_ID, uom.UOMSymbol, + bomPriceList(p.M_Product_ID, pr.M_PriceList_Version_ID) AS PriceList, + bomPriceStd(p.M_Product_ID, pr.M_PriceList_Version_ID) AS PriceStd, + bomPriceStd(p.M_Product_ID, pr.M_PriceList_Version_ID)-bomPriceLimit(p.M_Product_ID, pr.M_PriceList_Version_ID) AS Margin, + bomPriceLimit(p.M_Product_ID, pr.M_PriceList_Version_ID) AS PriceLimit, + w.Name AS WarehouseName, + bomQtyAvailable(p.M_Product_ID,w.M_Warehouse_ID,0) AS QtyAvailable, + bomQtyOnHand(p.M_Product_ID,w.M_Warehouse_ID,0) AS QtyOnHand, + bomQtyReserved(p.M_Product_ID,w.M_Warehouse_ID,0) AS QtyReserved, + bomQtyOrdered(p.M_Product_ID,w.M_Warehouse_ID,0) AS QtyOrdered, + COALESCE (pa.IsInstanceAttribute, 'N') AS IsInstanceAttribute +FROM M_Product p + INNER JOIN M_ProductPrice pr ON (p.M_Product_ID=pr.M_Product_ID) + INNER JOIN C_UOM uom ON (p.C_UOM_ID=uom.C_UOM_ID) + LEFT OUTER JOIN M_AttributeSet pa ON (p.M_AttributeSet_ID=pa.M_AttributeSet_ID) + INNER JOIN M_Warehouse w ON (p.AD_Client_ID=w.AD_Client_ID) +WHERE p.IsSummary='N' AND p.IsActive='Y' AND pr.IsActive='Y' AND w.IsActive='Y'; + +--AND pr.M_PriceList_Version_ID=? +--AND w.M_Warehouse_ID=? +--AND UPPER(p.Value) LIKE ? AND UPPER(p.Name) LIKE ? +--AND UPPER(p.UPC) LIKE ? AND UPPER(p.SKU) LIKE ? +--ORDER BY QtyAvailable DESC, Margin DESC; + + + diff --git a/db/ddlutils/postgresql/views/R_REQUEST_V.sql b/db/ddlutils/postgresql/views/R_REQUEST_V.sql new file mode 100644 index 0000000000..ccff15ed1d --- /dev/null +++ b/db/ddlutils/postgresql/views/R_REQUEST_V.sql @@ -0,0 +1,30 @@ +CREATE OR REPLACE VIEW R_REQUEST_V +(R_REQUEST_ID, AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, + CREATEDBY, UPDATED, UPDATEDBY, DOCUMENTNO, R_REQUESTTYPE_ID, + R_GROUP_ID, R_CATEGORY_ID, R_STATUS_ID, R_RESOLUTION_ID, R_REQUESTRELATED_ID, + PRIORITY, PRIORITYUSER, DUETYPE, SUMMARY, CONFIDENTIALTYPE, + ISESCALATED, ISSELFSERVICE, SALESREP_ID, AD_ROLE_ID, DATELASTACTION, + DATELASTALERT, LASTRESULT, PROCESSED, ISINVOICED, C_BPARTNER_ID, + AD_USER_ID, C_CAMPAIGN_ID, C_ORDER_ID, C_INVOICE_ID, C_PAYMENT_ID, + M_PRODUCT_ID, C_PROJECT_ID, A_ASSET_ID, M_INOUT_ID, M_RMA_ID, + AD_TABLE_ID, RECORD_ID, REQUESTAMT, R_MAILTEXT_ID, RESULT, + CONFIDENTIALTYPEENTRY, R_STANDARDRESPONSE_ID, NEXTACTION, DATENEXTACTION, STARTTIME, + ENDTIME, QTYSPENT, QTYINVOICED, M_PRODUCTSPENT_ID, C_ACTIVITY_ID, + STARTDATE, CLOSEDATE, C_INVOICEREQUEST_ID, M_CHANGEREQUEST_ID, TASKSTATUS, + QTYPLAN, DATECOMPLETEPLAN, DATESTARTPLAN, M_FIXCHANGENOTICE_ID) +AS +SELECT R_REQUEST_ID,AD_CLIENT_ID,AD_ORG_ID,ISACTIVE,CREATED,CREATEDBY,UPDATED,UPDATEDBY, +DOCUMENTNO,R_REQUESTTYPE_ID,R_GROUP_ID,R_CATEGORY_ID,R_STATUS_ID,R_RESOLUTION_ID, +R_REQUESTRELATED_ID,PRIORITY,PRIORITYUSER,DUETYPE,SUMMARY,CONFIDENTIALTYPE,ISESCALATED, +ISSELFSERVICE,SALESREP_ID,AD_ROLE_ID,DATELASTACTION,DATELASTALERT,LASTRESULT,PROCESSED, +ISINVOICED,C_BPARTNER_ID,AD_USER_ID,C_CAMPAIGN_ID,C_ORDER_ID,C_INVOICE_ID,C_PAYMENT_ID, +M_PRODUCT_ID,C_PROJECT_ID,A_ASSET_ID,M_INOUT_ID,M_RMA_ID,AD_TABLE_ID,RECORD_ID,REQUESTAMT, +R_MAILTEXT_ID,RESULT,CONFIDENTIALTYPEENTRY,R_STANDARDRESPONSE_ID,NEXTACTION,DATENEXTACTION, +STARTTIME,ENDTIME,QTYSPENT,QTYINVOICED,M_PRODUCTSPENT_ID,C_ACTIVITY_ID,STARTDATE,CLOSEDATE, +C_INVOICEREQUEST_ID,M_CHANGEREQUEST_ID,TASKSTATUS,QTYPLAN,DATECOMPLETEPLAN,DATESTARTPLAN,M_FIXCHANGENOTICE_ID +FROM R_Request +WHERE IsActive='Y' AND Processed='N' + AND getdate() > DateNextAction; + + + diff --git a/db/ddlutils/postgresql/views/T_INVOICEGL_V.sql b/db/ddlutils/postgresql/views/T_INVOICEGL_V.sql new file mode 100644 index 0000000000..3767f23707 --- /dev/null +++ b/db/ddlutils/postgresql/views/T_INVOICEGL_V.sql @@ -0,0 +1,45 @@ +CREATE OR REPLACE VIEW T_INVOICEGL_V +(AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, + UPDATED, UPDATEDBY, C_INVOICE_ID, ISSOTRX, DOCUMENTNO, + DOCSTATUS, C_DOCTYPE_ID, C_ORDER_ID, DESCRIPTION, SALESREP_ID, + DATEINVOICED, DATEACCT, C_PAYMENTTERM_ID, C_BPARTNER_ID, C_BPARTNER_LOCATION_ID, + AD_USER_ID, ISSELFSERVICE, C_CURRENCY_ID, C_CONVERSIONTYPE_ID, GRANDTOTAL, + ISTAXINCLUDED, C_CAMPAIGN_ID, C_PROJECT_ID, C_ACTIVITY_ID, AD_ORGTRX_ID, + USER1_ID, USER2_ID, C_LOCFROM_ID, C_LOCTO_ID, C_SALESREGION_ID, + FACT_ACCT_ID, C_ACCTSCHEMA_ID, ACCOUNT_ID, C_PERIOD_ID, GL_CATEGORY_ID, + GL_BUDGET_ID, C_TAX_ID, M_LOCATOR_ID, POSTINGTYPE, AMTSOURCEDR, + AMTSOURCECR, AMTACCTDR, AMTACCTCR, C_UOM_ID, QTY, + AD_PINSTANCE_ID, APAR, OPENAMT, PERCENT, AMTREVALDR, + AMTREVALCR, DATEREVAL, C_CONVERSIONTYPEREVAL_ID, AMTSOURCEBALANCE, AMTACCTBALANCE, + C_DOCTYPEREVAL_ID, AMTREVALDRDIFF, AMTREVALCRDIFF, ISALLCURRENCIES, AMTACCTOPENDR, + AMTACCTOPENCR, AMTACCTOPENBALANCE) +AS +SELECT i.AD_Client_ID, i.AD_Org_ID, i.IsActive, i.Created,i.CreatedBy, i.Updated,i.UpdatedBy, + i.C_Invoice_ID, i.IsSOTrx, i.DocumentNo, i.DocStatus, i.C_DocType_ID, i.C_Order_ID, + i.Description, i.SalesRep_ID, i.DateInvoiced, i.DateAcct, i.C_PaymentTerm_ID, + i.C_BPartner_ID, i.C_BPartner_Location_ID, i.AD_User_ID, i.IsSelfService, + i.C_Currency_ID, i.C_ConversionType_ID, i.GrandTotal, i.IsTaxIncluded, +-- References + i.C_Campaign_ID, i.C_Project_ID, i.C_Activity_ID, + i.AD_OrgTrx_ID, i.User1_ID, i.User2_ID, + fa.C_LocFrom_ID, fa.C_LocTo_ID, fa.C_SalesRegion_ID, +-- Accounting + fa.Fact_Acct_ID, fa.C_AcctSchema_ID, fa.Account_ID, fa.C_Period_ID, fa.GL_Category_ID, fa.GL_Budget_ID, + fa.C_Tax_ID, fa.M_Locator_ID, + fa.PostingType, fa.AmtSourceDr, fa.AmtSourceCr, + fa.AmtAcctDr, fa.AmtAcctCr, + fa.C_UOM_ID, fa.Qty, +-- Gain/Loss + gl.AD_PInstance_ID, gl.APAR, gl.OpenAmt, gl.Percent, + gl.AmtRevalDr, gl.AmtRevalCr, gl.DateReval, gl.C_ConversionTypeReval_ID, + gl.AmtSourceBalance, gl.AmtAcctBalance, + gl.C_DocTypeReval_ID, + gl.AmtRevalDrDiff, gl.AmtRevalCrDiff, gl.IsAllCurrencies, + (fa.AmtAcctDr*gl.Percent/100) AS AmtAcctOpenDr, (fa.AmtAcctCr*gl.Percent/100) AS AmtAcctOpenCr, + ((fa.AmtAcctDr-fa.AmtAcctCr)*gl.Percent/100) AS AmtAcctOpenBalance +FROM T_InvoiceGL gl + INNER JOIN C_Invoice i ON (gl.C_Invoice_ID=i.C_Invoice_ID) + INNER JOIN Fact_Acct fa ON (gl.Fact_Acct_ID=fa.Fact_Acct_ID); + + + diff --git a/db/ddlutils/postgresql/views/T_INVOICEGL_VT.sql b/db/ddlutils/postgresql/views/T_INVOICEGL_VT.sql new file mode 100644 index 0000000000..4bafe5d55a --- /dev/null +++ b/db/ddlutils/postgresql/views/T_INVOICEGL_VT.sql @@ -0,0 +1,45 @@ +CREATE OR REPLACE VIEW T_INVOICEGL_VT +(AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY, + UPDATED, UPDATEDBY, C_INVOICE_ID, ISSOTRX, DOCUMENTNO, + DOCSTATUS, C_DOCTYPE_ID, C_ORDER_ID, DESCRIPTION, SALESREP_ID, + DATEINVOICED, DATEACCT, C_PAYMENTTERM_ID, C_BPARTNER_ID, C_BPARTNER_LOCATION_ID, + AD_USER_ID, ISSELFSERVICE, C_CURRENCY_ID, C_CONVERSIONTYPE_ID, GRANDTOTAL, + ISTAXINCLUDED, C_CAMPAIGN_ID, C_PROJECT_ID, C_ACTIVITY_ID, AD_ORGTRX_ID, + USER1_ID, USER2_ID, C_LOCFROM_ID, C_LOCTO_ID, C_SALESREGION_ID, + FACT_ACCT_ID, C_ACCTSCHEMA_ID, ACCOUNT_ID, C_PERIOD_ID, GL_CATEGORY_ID, + GL_BUDGET_ID, C_TAX_ID, M_LOCATOR_ID, POSTINGTYPE, AMTSOURCEDR, + AMTSOURCECR, AMTACCTDR, AMTACCTCR, C_UOM_ID, QTY, + AD_PINSTANCE_ID, APAR, OPENAMT, PERCENT, AMTREVALDR, + AMTREVALCR, DATEREVAL, C_CONVERSIONTYPEREVAL_ID, AMTSOURCEBALANCE, AMTACCTBALANCE, + C_DOCTYPEREVAL_ID, AMTREVALDRDIFF, AMTREVALCRDIFF, ISALLCURRENCIES, AMTACCTOPENDR, + AMTACCTOPENCR, AMTACCTOPENBALANCE) +AS +SELECT i.AD_Client_ID, i.AD_Org_ID, i.IsActive, i.Created,i.CreatedBy, i.Updated,i.UpdatedBy, + i.C_Invoice_ID, i.IsSOTrx, i.DocumentNo, i.DocStatus, i.C_DocType_ID, i.C_Order_ID, + i.Description, i.SalesRep_ID, i.DateInvoiced, i.DateAcct, i.C_PaymentTerm_ID, + i.C_BPartner_ID, i.C_BPartner_Location_ID, i.AD_User_ID, i.IsSelfService, + i.C_Currency_ID, i.C_ConversionType_ID, i.GrandTotal, i.IsTaxIncluded, +-- References + i.C_Campaign_ID, i.C_Project_ID, i.C_Activity_ID, + i.AD_OrgTrx_ID, i.User1_ID, i.User2_ID, + fa.C_LocFrom_ID, fa.C_LocTo_ID, fa.C_SalesRegion_ID, +-- Accounting + fa.Fact_Acct_ID, fa.C_AcctSchema_ID, fa.Account_ID, fa.C_Period_ID, fa.GL_Category_ID, fa.GL_Budget_ID, + fa.C_Tax_ID, fa.M_Locator_ID, + fa.PostingType, fa.AmtSourceDr, fa.AmtSourceCr, + fa.AmtAcctDr, fa.AmtAcctCr, + fa.C_UOM_ID, fa.Qty, +-- Gain/Loss + gl.AD_PInstance_ID, gl.APAR, gl.OpenAmt, gl.Percent, + gl.AmtRevalDr, gl.AmtRevalCr, gl.DateReval, gl.C_ConversionTypeReval_ID, + gl.AmtSourceBalance, gl.AmtAcctBalance, + gl.C_DocTypeReval_ID, + gl.AmtRevalDrDiff, gl.AmtRevalCrDiff, gl.IsAllCurrencies, + (fa.AmtAcctDr*gl.Percent/100) AS AmtAcctOpenDr, (fa.AmtAcctCr*gl.Percent/100) AS AmtAcctOpenCr, + ((fa.AmtAcctDr-fa.AmtAcctCr)*gl.Percent/100) AS AmtAcctOpenBalance +FROM T_InvoiceGL gl + INNER JOIN C_Invoice i ON (gl.C_Invoice_ID=i.C_Invoice_ID) + INNER JOIN Fact_Acct fa ON (gl.Fact_Acct_ID=fa.Fact_Acct_ID); + + +