* [ 1656840 ] Problem on invoice amounts that are not integers
This commit is contained in:
parent
4455acc4b0
commit
800f38e55a
File diff suppressed because it is too large
Load Diff
|
@ -60,7 +60,7 @@
|
|||
<echo file="log/sqlplus.log" append="true" message="${line.separator}#Create Views [1st Pass]:${line.separator}${line.separator}" />
|
||||
<foreach param="file.name" target="load">
|
||||
<path>
|
||||
<fileset dir="../views">
|
||||
<fileset dir="views">
|
||||
<include name="**" />
|
||||
</fileset>
|
||||
</path>
|
||||
|
@ -69,7 +69,7 @@
|
|||
<echo file="log/sqlplus.log" append="true" message="${line.separator}#Create Views [2nd Pass]:${line.separator}${line.separator}" />
|
||||
<foreach param="file.name" target="load">
|
||||
<path>
|
||||
<fileset dir="../views">
|
||||
<fileset dir="views">
|
||||
<include name="**" />
|
||||
</fileset>
|
||||
</path>
|
||||
|
|
|
@ -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';
|
||||
|
||||
|
||||
|
|
@ -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);
|
||||
|
||||
|
||||
|
|
@ -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';
|
||||
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue