diff --git a/db/ddlutils/views/C_INVOICE_V.sql b/db/ddlutils/views/C_INVOICE_V.sql index 990da34c72..b01f894f20 100644 --- a/db/ddlutils/views/C_INVOICE_V.sql +++ b/db/ddlutils/views/C_INVOICE_V.sql @@ -18,12 +18,12 @@ SELECT i.C_Invoice_ID, i.AD_Client_ID, i.AD_Org_ID, i.IsActive, i.Created, i.Cre 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, null 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, + i.IsPayScheduleValid, cast(null as integer) AS C_InvoicePaySchedule_ID, i.InvoiceCollectionType, + cast(CASE WHEN charAt(d.DocBaseType,3)='C' THEN i.ChargeAmt*-1 ELSE i.ChargeAmt END as numeric) AS ChargeAmt, + cast(CASE WHEN charAt(d.DocBaseType,3)='C' THEN i.TotalLines*-1 ELSE i.TotalLines END as numeric) AS TotalLines, + cast(CASE WHEN charAt(d.DocBaseType,3)='C' THEN i.GrandTotal*-1 ELSE i.GrandTotal END as numeric) AS GrandTotal, + cast(CASE WHEN charAt(d.DocBaseType,3)='C' THEN -1 ELSE 1 END as numeric) AS Multiplier, + cast(CASE WHEN charAt(d.DocBaseType,2)='P' THEN -1 ELSE 1 END AS numeric) 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_INVOICE_V1.sql b/db/ddlutils/views/C_INVOICE_V1.sql index 76f1023649..1a332a3eb5 100644 --- a/db/ddlutils/views/C_INVOICE_V1.sql +++ b/db/ddlutils/views/C_INVOICE_V1.sql @@ -18,7 +18,7 @@ SELECT i.C_Invoice_ID, i.AD_Client_ID, i.AD_Org_ID, i.IsActive, i.Created, i.Cre 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 numeric(10)) AS C_InvoicePaySchedule_ID, i.InvoiceCollectionType, + i.IsPayScheduleValid, cast(null as integer) 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, diff --git a/db/ddlutils/views/RV_OPENITEM.sql b/db/ddlutils/views/RV_OPENITEM.sql index 346e3555df..b17a549231 100644 --- a/db/ddlutils/views/RV_OPENITEM.sql +++ b/db/ddlutils/views/RV_OPENITEM.sql @@ -19,7 +19,7 @@ SELECT i.AD_Org_ID, i.AD_Client_ID, invoiceOpen(i.C_Invoice_ID,0) AS OpenAmt, i.C_Currency_ID, i.C_ConversionType_ID, i.C_PaymentTerm_ID, - i.IsPayScheduleValid, null AS C_InvoicePaySchedule_ID, i.InvoiceCollectionType, + i.IsPayScheduleValid, cast(null as integer) 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)