diff --git a/db/ddlutils/postgresql/functions/C_Invoice_OpenToDate.sql b/db/ddlutils/postgresql/functions/C_Invoice_OpenToDate.sql index 7e324f68c0..2e5b98c5c3 100644 --- a/db/ddlutils/postgresql/functions/C_Invoice_OpenToDate.sql +++ b/db/ddlutils/postgresql/functions/C_Invoice_OpenToDate.sql @@ -37,7 +37,7 @@ CREATE OR REPLACE FUNCTION InvoiceopenToDate ( p_C_Invoice_ID IN numeric, p_C_InvoicePaySchedule_ID IN numeric, - p_DateAcct IN DATE + p_DateAcct IN timestamp with time zone ) RETURNS numeric AS diff --git a/db/ddlutils/postgresql/functions/C_Invoice_PaidToDate.sql b/db/ddlutils/postgresql/functions/C_Invoice_PaidToDate.sql index 32046fd89e..50b0c4cb5c 100644 --- a/db/ddlutils/postgresql/functions/C_Invoice_PaidToDate.sql +++ b/db/ddlutils/postgresql/functions/C_Invoice_PaidToDate.sql @@ -55,9 +55,10 @@ BEGIN END IF; -- Calculate Allocated Amount FOR allocation IN - SELECT allocation.AD_Client_ID, allocation.AD_Org_ID,al.Amount, al.DiscountAmt, al.WriteOffAmt,allocation.C_Currency_ID, allocation.DateTrx + SELECT al.AD_Client_ID, al.AD_Org_ID,al.Amount, al.DiscountAmt, al.WriteOffAmt,a.C_Currency_ID, a.DateTrx FROM C_ALLOCATIONLINE al - WHERE al.C_Invoice_ID = p_C_Invoice_ID AND allocation.IsActive='Y' AND allocation.DateAcct <= p_DateAcct + INNER JOIN C_ALLOCATIONHDR a ON (al.C_AllocationHdr_ID=a.C_AllocationHdr_ID) + WHERE al.C_Invoice_ID = p_C_Invoice_ID AND a.IsActive='Y' AND a.DateAcct <= p_DateAcct LOOP v_PaymentAmt := v_PaymentAmt + Currencyconvert(allocation.Amount + allocation.DisCountAmt + allocation.WriteOffAmt,