Merge development ( 10289 ) into zk7 ( 10252 ) branch

This commit is contained in:
Heng Sin Low 2014-04-03 09:17:58 +08:00
commit fa6541ff10
92 changed files with 10495 additions and 883 deletions

View File

@ -33,6 +33,8 @@ SELECT C_InvoicePaySchedule_ID, DueAmt FROM C_InvoicePaySchedule WHERE C_Invoice
************************************************************************/
AS
v_Currency_ID NUMBER(10);
v_Precision NUMBER := 0;
v_Min NUMBER := 0;
v_TotalOpenAmt NUMBER := 0;
v_PaidAmt NUMBER := 0;
v_Remaining NUMBER := 0;
@ -70,6 +72,13 @@ BEGIN
END;
-- DBMS_OUTPUT.PUT_LINE('== C_Invoice_ID=' || p_C_Invoice_ID || ', Total=' || v_TotalOpenAmt || ', AP=' || v_MultiplierAP || ', CM=' || v_MultiplierCM);
SELECT StdPrecision
INTO v_Precision
FROM C_Currency
WHERE C_Currency_ID = v_Currency_ID;
SELECT POWER(1/10,v_Precision) INTO v_Min FROM DUAL;
-- Calculate Allocated Amount
FOR a IN Cur_Alloc LOOP
v_Temp := a.Amount + a.DisCountAmt + a.WriteOffAmt;
@ -104,12 +113,13 @@ BEGIN
-- DBMS_OUTPUT.PUT_LINE('== Total=' || v_TotalOpenAmt);
-- Ignore Rounding
IF (v_TotalOpenAmt BETWEEN -0.00999 AND 0.00999) THEN
IF (v_TotalOpenAmt > -v_Min AND v_TotalOpenAmt < v_Min) THEN
v_TotalOpenAmt := 0;
END IF;
-- Round to penny
v_TotalOpenAmt := ROUND(COALESCE(v_TotalOpenAmt,0), 2);
-- Round to currency precision
v_TotalOpenAmt := ROUND(COALESCE(v_TotalOpenAmt,0), v_Precision);
RETURN v_TotalOpenAmt;
END invoiceOpen;
/

View File

@ -34,6 +34,8 @@ SELECT C_InvoicePaySchedule_ID, DueAmt FROM C_InvoicePaySchedule WHERE C_Invoice
************************************************************************/
AS
v_Currency_ID NUMBER(10);
v_Precision NUMBER := 0;
v_Min NUMBER := 0;
v_TotalOpenAmt NUMBER := 0;
v_PaidAmt NUMBER := 0;
v_Remaining NUMBER := 0;
@ -73,6 +75,13 @@ BEGIN
END;
-- DBMS_OUTPUT.PUT_LINE('== C_Invoice_ID=' || p_C_Invoice_ID || ', Total=' || v_TotalOpenAmt || ', AP=' || v_MultiplierAP || ', CM=' || v_MultiplierCM);
SELECT StdPrecision
INTO v_Precision
FROM C_Currency
WHERE C_Currency_ID = v_Currency_ID;
SELECT POWER(1/10,v_Precision) INTO v_Min FROM DUAL;
-- Calculate Allocated Amount
FOR a IN Cur_Alloc LOOP
v_Temp := a.Amount + a.DisCountAmt + a.WriteOffAmt;
@ -107,12 +116,13 @@ BEGIN
-- DBMS_OUTPUT.PUT_LINE('== Total=' || v_TotalOpenAmt);
-- Ignore Rounding
IF (v_TotalOpenAmt BETWEEN -0.00999 AND 0.00999) THEN
IF (v_TotalOpenAmt > -v_Min AND v_TotalOpenAmt < v_Min) THEN
v_TotalOpenAmt := 0;
END IF;
-- Round to penny
v_TotalOpenAmt := ROUND(COALESCE(v_TotalOpenAmt,0), 2);
-- Round to currency precision
v_TotalOpenAmt := ROUND(COALESCE(v_TotalOpenAmt,0), v_Precision);
RETURN v_TotalOpenAmt;
END InvoiceopenToDate;
/

View File

@ -33,6 +33,8 @@ RETURN NUMBER
*
************************************************************************/
AS
v_Precision NUMBER := 0;
v_Min NUMBER := 0;
v_MultiplierAP NUMBER := 1;
v_PaymentAmt NUMBER := 0;
CURSOR Cur_Alloc IS
@ -44,6 +46,13 @@ AS
WHERE al.C_Invoice_ID = p_C_Invoice_ID
AND a.IsActive='Y';
BEGIN
SELECT StdPrecision
INTO v_Precision
FROM C_Currency
WHERE C_Currency_ID = p_C_Currency_ID;
SELECT POWER(1/10,v_Precision) INTO v_Min FROM DUAL;
-- Default
IF (p_MultiplierAP IS NOT NULL) THEN
v_MultiplierAP := p_MultiplierAP;
@ -54,7 +63,15 @@ BEGIN
+ currencyConvert(a.Amount + a.DisCountAmt + a.WriteOffAmt,
a.C_Currency_ID, p_C_Currency_ID, a.DateTrx, null, a.AD_Client_ID, a.AD_Org_ID);
END LOOP;
--
RETURN ROUND(NVL(v_PaymentAmt,0), 2) * v_MultiplierAP;
-- Ignore Rounding
IF (v_PaymentAmt > -v_Min AND v_PaymentAmt < v_Min) THEN
v_PaymentAmt := 0;
END IF;
-- Round to currency precision
v_PaymentAmt := ROUND(COALESCE(v_PaymentAmt,0), v_Precision);
RETURN v_PaymentAmt * v_MultiplierAP;
END invoicePaid;
/

View File

@ -34,6 +34,8 @@ RETURN NUMBER
*
************************************************************************/
AS
v_Precision NUMBER := 0;
v_Min NUMBER := 0;
v_MultiplierAP NUMBER := 1;
v_PaymentAmt NUMBER := 0;
CURSOR Cur_Alloc IS
@ -46,6 +48,13 @@ AS
AND a.IsActive='Y'
AND a.DateAcct <= p_DateAcct;
BEGIN
SELECT StdPrecision
INTO v_Precision
FROM C_Currency
WHERE C_Currency_ID = p_C_Currency_ID;
SELECT POWER(1/10,v_Precision) INTO v_Min FROM DUAL;
-- Default
IF (p_MultiplierAP IS NOT NULL) THEN
v_MultiplierAP := p_MultiplierAP;
@ -56,7 +65,15 @@ BEGIN
+ Currencyconvert(a.Amount + a.DisCountAmt + a.WriteOffAmt,
a.C_Currency_ID, p_C_Currency_ID, a.DateTrx, NULL, a.AD_Client_ID, a.AD_Org_ID);
END LOOP;
--
RETURN ROUND(NVL(v_PaymentAmt,0), 2) * v_MultiplierAP;
-- Ignore Rounding
IF (v_PaymentAmt > -v_Min AND v_PaymentAmt < v_Min) THEN
v_PaymentAmt := 0;
END IF;
-- Round to currency precision
v_PaymentAmt := ROUND(COALESCE(v_PaymentAmt,0), v_Precision);
RETURN v_PaymentAmt * v_MultiplierAP;
END InvoicepaidToDate;
/

View File

@ -24,6 +24,8 @@ RETURN NUMBER
************************************************************************/
AS
v_Precision NUMBER := 0;
v_Min NUMBER := 0;
Discount NUMBER := 0;
CURSOR Cur_PT IS
SELECT *
@ -34,6 +36,13 @@ AS
Add1Date NUMBER := 0;
Add2Date NUMBER := 0;
BEGIN
SELECT StdPrecision
INTO v_Precision
FROM C_Currency
WHERE C_Currency_ID = Currency_ID;
SELECT POWER(1/10,v_Precision) INTO v_Min FROM DUAL;
-- No Data - No Discount
IF (Amount IS NULL OR PaymentTerm_ID IS NULL OR DocDate IS NULL) THEN
RETURN 0;
@ -60,7 +69,15 @@ BEGIN
Discount := Amount * p.Discount2 / 100;
END IF;
END LOOP;
--
RETURN ROUND(NVL(Discount,0), 2); -- fixed rounding
-- Ignore Rounding
IF (Discount > -v_Min AND Discount < v_Min) THEN
Discount := 0;
END IF;
-- Round to currency precision
Discount := ROUND(COALESCE(Discount,0), v_Precision);
RETURN Discount;
END paymentTermDiscount;
/

View File

@ -26,6 +26,8 @@ RETURN NUMBER
************************************************************************/
AS
v_Precision NUMBER := 0;
v_Min NUMBER := 0;
v_AllocatedAmt NUMBER := 0;
v_PayAmt NUMBER;
CURSOR Cur_Alloc IS
@ -36,6 +38,13 @@ AS
AND a.IsActive='Y';
-- AND al.C_Invoice_ID IS NOT NULL;
BEGIN
SELECT StdPrecision
INTO v_Precision
FROM C_Currency
WHERE C_Currency_ID = p_C_Currency_ID;
SELECT POWER(1/10,v_Precision) INTO v_Min FROM DUAL;
-- Charge - nothing available
SELECT MAX(PayAmt)
INTO v_PayAmt
@ -50,8 +59,15 @@ BEGIN
v_AllocatedAmt := v_AllocatedAmt
+ currencyConvert(a.Amount, a.C_Currency_ID, p_C_Currency_ID, a.DateTrx, null, a.AD_Client_ID, a.AD_Org_ID);
END LOOP;
-- Round to penny
v_AllocatedAmt := ROUND(NVL(v_AllocatedAmt,0), 2);
-- Ignore Rounding
IF (v_AllocatedAmt > -v_Min AND v_AllocatedAmt < v_Min) THEN
v_AllocatedAmt := 0;
END IF;
-- Round to currency precision
v_AllocatedAmt := ROUND(COALESCE(v_AllocatedAmt,0), v_Precision);
RETURN v_AllocatedAmt;
END paymentAllocated;
/

View File

@ -18,6 +18,8 @@ RETURN NUMBER
************************************************************************/
AS
v_Currency_ID NUMBER(10);
v_Precision NUMBER := 0;
v_Min NUMBER := 0;
v_AvailableAmt NUMBER := 0;
v_IsReceipt C_Payment.IsReceipt%TYPE;
v_Amt NUMBER := 0;
@ -45,18 +47,28 @@ BEGIN
WHERE C_Payment_ID = p_C_Payment_ID;
-- DBMS_OUTPUT.PUT_LINE('== C_Payment_ID=' || p_C_Payment_ID || ', PayAmt=' || v_AvailableAmt || ', Receipt=' || v_IsReceipt);
SELECT StdPrecision
INTO v_Precision
FROM C_Currency
WHERE C_Currency_ID = v_Currency_ID;
SELECT POWER(1/10,v_Precision) INTO v_Min FROM DUAL;
-- Calculate Allocated Amount
FOR a IN Cur_Alloc LOOP
v_Amt := currencyConvert(a.Amount, a.C_Currency_ID, v_Currency_ID, a.DateTrx, null, a.AD_Client_ID, a.AD_Org_ID);
v_AvailableAmt := v_AvailableAmt - v_Amt;
-- DBMS_OUTPUT.PUT_LINE(' Allocation=' || a.Amount || ' - Available=' || v_AvailableAmt);
END LOOP;
-- Ignore Rounding
IF (v_AvailableAmt BETWEEN -0.00999 AND 0.00999) THEN
IF (v_AvailableAmt > -v_Min AND v_AvailableAmt < v_Min) THEN
v_AvailableAmt := 0;
END IF;
-- Round to penny
v_AvailableAmt := ROUND(NVL(v_AvailableAmt,0), 2);
-- Round to currency precision
v_AvailableAmt := ROUND(COALESCE(v_AvailableAmt,0), v_Precision);
RETURN v_AvailableAmt;
END paymentAvailable;
/

View File

@ -11,11 +11,11 @@ SELECT il.AD_Client_ID, il.AD_Org_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,
currencyRound(i.Multiplier*LineNetAmt,i.C_Currency_ID,'N') AS LineNetAmt,
currencyRound(i.Multiplier*PriceList*QtyInvoiced,i.C_Currency_ID,'N') AS LineListAmt,
CASE WHEN COALESCE(il.PriceLimit, 0)=0 THEN currencyRound(i.Multiplier*LineNetAmt,i.C_Currency_ID,'N') ELSE currencyRound(i.Multiplier*il.PriceLimit*il.QtyInvoiced,i.C_Currency_ID,'N') END AS LineLimitAmt,
currencyRound(i.Multiplier*il.PriceList*il.QtyInvoiced-il.LineNetAmt,i.C_Currency_ID,'N') AS LineDiscountAmt,
CASE WHEN COALESCE(il.PriceLimit,0)=0 THEN 0 ELSE currencyRound(i.Multiplier*il.LineNetAmt-il.PriceLimit*il.QtyInvoiced,i.C_Currency_ID,'N') 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

View File

@ -13,7 +13,7 @@ SELECT s.ad_client_id,
sum(ms.qtyonhand - ms.qtyreserved) AS qtyavailable,
sum(ms.qtyonhand) AS qtyonhand,
sum(ms.qtyreserved) AS qtyreserved,
ROUND(MAX(mpr.pricestd),0) AS pricestd,
currencyRound(MAX(mpr.pricestd),mpl.C_Currency_ID,'N') AS pricestd,
mpr.m_pricelist_version_id,
mw.m_warehouse_id,
org.name AS orgname
@ -23,6 +23,8 @@ SELECT s.ad_client_id,
JOIN m_locator ml ON ms.m_locator_id = ml.m_locator_id
JOIN m_warehouse mw ON ml.m_warehouse_id = mw.m_warehouse_id
JOIN m_productprice mpr ON ms.m_product_id = mpr.m_product_id
JOIN m_pricelist_version mplv ON mplv.m_pricelist_version_id = mpr.m_pricelist_version_id
JOIN m_pricelist mpl ON mplv.m_pricelist_id = mpl.m_pricelist_id
JOIN ad_org org ON org.ad_org_id = mw.ad_org_id
GROUP BY s.ad_client_id,
s.ad_org_id,
@ -36,7 +38,8 @@ SELECT s.ad_client_id,
mw.m_warehouse_id,
mpr.m_pricelist_version_id,
org.name,
mp.name
mp.name,
mpl.C_Currency_ID
UNION
SELECT r.ad_client_id,
r.ad_org_id,
@ -52,7 +55,7 @@ SELECT s.ad_client_id,
sum(ms.qtyonhand - ms.qtyreserved) AS qtyavailable,
sum(ms.qtyonhand) AS qtyonhand,
sum(ms.qtyreserved) AS qtyreserved,
ROUND(MAX(mpr.pricestd),0) AS pricestd,
currencyRound(MAX(mpr.pricestd),mpl.C_Currency_ID,'N') AS pricestd,
mpr.m_pricelist_version_id,
mw.m_warehouse_id,
org.name AS orgname
@ -62,6 +65,8 @@ SELECT s.ad_client_id,
JOIN m_locator ml ON ms.m_locator_id = ml.m_locator_id
JOIN m_warehouse mw ON ml.m_warehouse_id = mw.m_warehouse_id
JOIN m_productprice mpr ON ms.m_product_id = mpr.m_product_id
JOIN m_pricelist_version mplv ON mplv.m_pricelist_version_id = mpr.m_pricelist_version_id
JOIN m_pricelist mpl ON mplv.m_pricelist_id = mpl.m_pricelist_id
JOIN ad_org org ON org.ad_org_id = mw.ad_org_id
GROUP BY r.ad_client_id,
r.ad_org_id,
@ -75,4 +80,5 @@ SELECT s.ad_client_id,
mw.m_warehouse_id,
mpr.m_pricelist_version_id,
org.name,
mp.name;
mp.name,
mpl.C_Currency_ID;

View File

@ -1,6 +1,5 @@
CREATE OR REPLACE VIEW rv_c_invoiceline
AS
SELECT il.ad_client_id,
CREATE OR REPLACE VIEW rv_c_invoiceline AS
SELECT il.ad_client_id,
il.ad_org_id,
il.isactive,
il.created,
@ -38,29 +37,16 @@ AS
il.priceactual,
il.pricelimit,
il.priceentered,
CASE
WHEN il.pricelist = 0 THEN 0
ELSE round(( il.pricelist - il.priceactual ) / il.pricelist * 100, 2)
END AS discount,
CASE
WHEN il.pricelimit = 0 THEN 0
ELSE round(( il.priceactual - il.pricelimit ) / il.pricelimit * 100, 2)
END AS margin,
CASE
WHEN il.pricelimit = 0 THEN 0
ELSE ( il.priceactual - il.pricelimit ) * il.qtyinvoiced
END AS marginamt,
round(i.multiplier * il.linenetamt, 2) AS linenetamt,
round(i.multiplier * il.pricelist * il.qtyinvoiced, 2) AS linelistamt,
CASE
WHEN COALESCE(il.pricelimit, 0) = 0 THEN round(i.multiplier * il.linenetamt, 2)
ELSE round(i.multiplier * il.pricelimit * il.qtyinvoiced, 2)
END AS linelimitamt,
round(i.multiplier * il.pricelist * il.qtyinvoiced - il.linenetamt, 2) AS linediscountamt,
CASE
WHEN COALESCE(il.pricelimit, 0) = 0 THEN 0
ELSE round(i.multiplier * il.linenetamt - il.pricelimit * il.qtyinvoiced, 2)
END AS lineoverlimitamt,
CASE WHEN il.pricelist = 0 THEN 0 ELSE currencyRound((il.pricelist - il.priceactual) / il.pricelist * 100,i.C_Currency_ID,'N') END AS discount,
CASE WHEN il.pricelimit = 0 THEN 0 ELSE currencyRound((il.priceactual - il.pricelimit) / il.pricelimit * 100,i.C_Currency_ID,'N') END AS margin,
CASE WHEN il.pricelimit = 0 THEN 0 ELSE (il.priceactual - il.pricelimit) * il.qtyinvoiced END AS marginamt,
currencyRound(i.multiplier * il.linenetamt,i.C_Currency_ID,'N') AS linenetamt,
currencyRound(i.multiplier * il.pricelist * il.qtyinvoiced,i.C_Currency_ID,'N') AS linelistamt,
CASE WHEN COALESCE(il.pricelimit, 0) = 0 THEN currencyRound(i.multiplier * il.linenetamt,i.C_Currency_ID,'N') ELSE currencyRound(i.multiplier * il.pricelimit * il.qtyinvoiced,i.C_Currency_ID,'N') END
AS linelimitamt,
currencyRound(i.multiplier * il.pricelist * il.qtyinvoiced - il.linenetamt,i.C_Currency_ID,'N') AS linediscountamt,
CASE WHEN COALESCE(il.pricelimit, 0) = 0 THEN 0 ELSE currencyRound(i.multiplier * il.linenetamt - il.pricelimit * il.qtyinvoiced,i.C_Currency_ID,'N') END AS
lineoverlimitamt,
il.ad_orgtrx_id,
il.a_processed,
il.c_charge_id,
@ -145,7 +131,7 @@ AS
pasi.serno AS m_attributesetinstance_serno,
pasi.updated AS m_attributesetinstance_updated,
pasi.updatedby AS m_asi_updatedby
FROM rv_c_invoice i
FROM rv_c_invoice i
JOIN c_invoiceline il
ON i.c_invoice_id = il.c_invoice_id
LEFT JOIN m_product p
@ -153,4 +139,3 @@ AS
LEFT JOIN m_attributesetinstance pasi
ON il.m_attributesetinstance_id = pasi.m_attributesetinstance_id
;

View File

@ -11,14 +11,15 @@ SELECT il.AD_Client_ID, il.AD_Org_ID,
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,
currencyRound((SUM(LineListAmt)-SUM(LineNetAmt))/SUM(LineListAmt)*100,i.C_Currency_ID,'N') 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
100-currencyRound((SUM(LineNetAmt)-SUM(LineOverLimitAmt))/SUM(LineNetAmt)*100,i.C_Currency_ID,'N') END AS LineOverLimit,
SUM(QtyInvoiced) AS QtyInvoiced, il.IsSOTrx
FROM RV_C_InvoiceLine il
INNER JOIN C_Invoice i ON (i.C_Invoice_ID=il.C_Invoice_ID)
GROUP BY il.AD_Client_ID, il.AD_Org_ID, il.C_BPartner_ID, il.M_Product_Category_ID,
firstOf(il.DateInvoiced, 'Q'), IsSOTrx;
firstOf(il.DateInvoiced, 'Q'), il.IsSOTrx, i.C_Currency_ID;

View File

@ -11,16 +11,17 @@ SELECT il.AD_Client_ID, il.AD_Org_ID,
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,
currencyRound((SUM(LineListAmt)-SUM(LineNetAmt))/SUM(LineListAmt)*100,i.C_Currency_ID,'N') 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,
100-currencyRound((SUM(LineNetAmt)-SUM(LineOverLimitAmt))/SUM(LineNetAmt)*100,i.C_Currency_ID,'N') END AS LineOverLimit,
SUM(QtyInvoiced) AS QtyInvoiced
FROM RV_C_InvoiceLine il
INNER JOIN C_Invoice i ON (i.C_Invoice_ID=il.C_Invoice_ID)
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');
firstOf(il.DateInvoiced, 'Q'), i.C_Currency_ID;

View File

@ -3,21 +3,22 @@ CREATE OR REPLACE VIEW RV_C_INVOICE_DAY
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
SELECT il.AD_Client_ID, il.AD_Org_ID, il.SalesRep_ID,
firstOf(il.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,
currencyRound((SUM(LineListAmt)-SUM(LineNetAmt))/SUM(LineListAmt)*100,i.C_Currency_ID,'N') 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;
100-currencyRound((SUM(LineNetAmt)-SUM(LineOverLimitAmt))/SUM(LineNetAmt)*100,i.C_Currency_ID,'N') END AS LineOverLimit,
il.IsSOTrx
FROM RV_C_InvoiceLine il
INNER JOIN C_Invoice i ON (i.C_Invoice_ID=il.C_Invoice_ID)
GROUP BY il.AD_Client_ID, il.AD_Org_ID, il.SalesRep_ID,
firstOf(il.DateInvoiced, 'DD'), il.IsSOTrx, i.C_Currency_ID;

View File

@ -3,21 +3,22 @@ CREATE OR REPLACE VIEW RV_C_INVOICE_MONTH
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
SELECT il.AD_Client_ID, il.AD_Org_ID, il.SalesRep_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,
currencyRound((SUM(LineListAmt)-SUM(LineNetAmt))/SUM(LineListAmt)*100,i.C_Currency_ID,'N') 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;
100-currencyRound((SUM(LineNetAmt)-SUM(LineOverLimitAmt))/SUM(LineNetAmt)*100,i.C_Currency_ID,'N') END AS LineOverLimit,
il.IsSOTrx
FROM RV_C_InvoiceLine il
INNER JOIN C_Invoice i ON (i.C_Invoice_ID=il.C_Invoice_ID)
GROUP BY il.AD_Client_ID, il.AD_Org_ID, il.SalesRep_ID,
firstOf(il.DateInvoiced, 'MM'), il.IsSOTrx, i.C_Currency_ID;

View File

@ -10,14 +10,15 @@ SELECT il.AD_Client_ID, il.AD_Org_ID, il.M_Product_Category_ID,
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,
currencyRound((SUM(LineListAmt)-SUM(LineNetAmt))/SUM(LineListAmt)*100,i.C_Currency_ID,'N') 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
100-currencyRound((SUM(LineNetAmt)-SUM(LineOverLimitAmt))/SUM(LineNetAmt)*100,i.C_Currency_ID,'N') END AS LineOverLimit,
SUM(QtyInvoiced) AS QtyInvoiced, il.IsSOTrx
FROM RV_C_InvoiceLine il
INNER JOIN C_Invoice i ON (i.C_Invoice_ID=il.C_Invoice_ID)
GROUP BY il.AD_Client_ID, il.AD_Org_ID, il.M_Product_Category_ID,
firstOf(il.DateInvoiced, 'MM'), IsSOTrx;
firstOf(il.DateInvoiced, 'MM'), il.IsSOTrx, i.C_Currency_ID;

View File

@ -10,14 +10,15 @@ SELECT il.AD_Client_ID, il.AD_Org_ID, il.M_Product_ID,
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,
currencyRound((SUM(LineListAmt)-SUM(LineNetAmt))/SUM(LineListAmt)*100,i.C_Currency_ID,'N') 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
100-currencyRound((SUM(LineNetAmt)-SUM(LineOverLimitAmt))/SUM(LineNetAmt)*100,i.C_Currency_ID,'N') END AS LineOverLimit,
SUM(QtyInvoiced) AS QtyInvoiced, il.IsSOTrx
FROM RV_C_InvoiceLine il
INNER JOIN C_Invoice i ON (i.C_Invoice_ID=il.C_Invoice_ID)
GROUP BY il.AD_Client_ID, il.AD_Org_ID, il.M_Product_ID,
firstOf(il.DateInvoiced, 'MM'), IsSOTrx;
firstOf(il.DateInvoiced, 'MM'), il.IsSOTrx, i.C_Currency_ID;

View File

@ -10,14 +10,15 @@ SELECT il.AD_Client_ID, il.AD_Org_ID, il.M_Product_ID,
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,
currencyRound((SUM(LineListAmt)-SUM(LineNetAmt))/SUM(LineListAmt)*100,i.C_Currency_ID,'N') 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
100-currencyRound((SUM(LineNetAmt)-SUM(LineOverLimitAmt))/SUM(LineNetAmt)*100,i.C_Currency_ID,'N') END AS LineOverLimit,
SUM(QtyInvoiced) AS QtyInvoiced, il.IsSOTrx
FROM RV_C_InvoiceLine il
INNER JOIN C_Invoice i ON (i.C_Invoice_ID=il.C_Invoice_ID)
GROUP BY il.AD_Client_ID, il.AD_Org_ID, il.M_Product_ID,
firstOf(il.DateInvoiced, 'Q'), IsSOTrx;
firstOf(il.DateInvoiced, 'Q'), il.IsSOTrx, i.C_Currency_ID;

View File

@ -10,14 +10,15 @@ SELECT il.AD_Client_ID, il.AD_Org_ID, il.M_Product_Category_ID,
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,
currencyRound((SUM(LineListAmt)-SUM(LineNetAmt))/SUM(LineListAmt)*100,i.C_Currency_ID,'N') 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
100-currencyRound((SUM(LineNetAmt)-SUM(LineOverLimitAmt))/SUM(LineNetAmt)*100,i.C_Currency_ID,'N') END AS LineOverLimit,
SUM(QtyInvoiced) AS QtyInvoiced, il.IsSOTrx
FROM RV_C_InvoiceLine il
INNER JOIN C_Invoice i ON (i.C_Invoice_ID=il.C_Invoice_ID)
GROUP BY il.AD_Client_ID, il.AD_Org_ID, il.M_Product_Category_ID,
firstOf(il.DateInvoiced, 'DY'), IsSOTrx;
firstOf(il.DateInvoiced, 'DY'), il.IsSOTrx, i.C_Currency_ID;

View File

@ -6,21 +6,22 @@ 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(il.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,
currencyRound((SUM(LineListAmt)-SUM(LineNetAmt))/SUM(LineListAmt)*100,i.C_Currency_ID,'N') 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,
100-currencyRound((SUM(LineNetAmt)-SUM(LineOverLimitAmt))/SUM(LineNetAmt)*100,i.C_Currency_ID,'N') END AS LineOverLimit,
SUM(QtyInvoiced) AS QtyInvoiced
FROM RV_C_InvoiceLine il
INNER JOIN C_Invoice i ON (i.C_Invoice_ID=il.C_Invoice_ID)
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');
firstOf(il.DateInvoiced, 'MM'), i.C_Currency_ID;

View File

@ -3,21 +3,22 @@ CREATE OR REPLACE VIEW RV_C_INVOICE_WEEK
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
SELECT il.AD_Client_ID, il.AD_Org_ID, il.SalesRep_ID,
firstOf(il.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,
currencyRound((SUM(LineListAmt)-SUM(LineNetAmt))/SUM(LineListAmt)*100,i.C_Currency_ID,'N') 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;
100-currencyRound((SUM(LineNetAmt)-SUM(LineOverLimitAmt))/SUM(LineNetAmt)*100,i.C_Currency_ID,'N') END AS LineOverLimit,
il.IsSOTrx
FROM RV_C_InvoiceLine il
INNER JOIN C_Invoice i ON (i.C_Invoice_ID=il.C_Invoice_ID)
GROUP BY il.AD_Client_ID, il.AD_Org_ID, il.SalesRep_ID,
firstOf(il.DateInvoiced, 'DY'), il.IsSOTrx, i.C_Currency_ID;

View File

@ -1,8 +1,7 @@
DROP VIEW rv_openitem;
CREATE OR REPLACE VIEW rv_openitem
AS
SELECT i.ad_org_id,
CREATE OR REPLACE VIEW rv_openitem AS
SELECT i.ad_org_id,
i.ad_client_id,
i.documentno,
i.c_invoice_id,
@ -15,7 +14,7 @@ AS
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,
currencyRound(i.grandtotal * p.discount / 100,i.C_Currency_ID,'N') AS discountamt,
i.grandtotal,
invoicepaid(i.c_invoice_id, i.c_currency_id, 1) AS paidamt,
invoiceopen(i.c_invoice_id, 0) AS openamt,
@ -71,14 +70,13 @@ AS
i.updatedby,
i.user1_id,
i.user2_id
FROM rv_c_invoice i
FROM rv_c_invoice i
JOIN c_paymentterm p
ON i.c_paymentterm_id = p.c_paymentterm_id
WHERE invoiceopen(i.c_invoice_id, 0) <> 0
AND i.ispayschedulevalid <> 'Y'
AND i.docstatus IN ( 'CO', 'CL' )
UNION
SELECT i.ad_org_id,
WHERE invoiceopen(i.c_invoice_id, 0) <> 0 AND i.ispayschedulevalid <> 'Y' AND i.docstatus IN ('CO',
'CL')
UNION
SELECT i.ad_org_id,
i.ad_client_id,
i.documentno,
i.c_invoice_id,
@ -147,12 +145,9 @@ AS
i.updatedby,
i.user1_id,
i.user2_id
FROM rv_c_invoice i
FROM rv_c_invoice i
JOIN c_invoicepayschedule ips
ON i.c_invoice_id = ips.c_invoice_id
WHERE invoiceopen(i.c_invoice_id, ips.c_invoicepayschedule_id) <> 0
AND i.ispayschedulevalid = 'Y'
AND i.docstatus IN ( 'CO', 'CL' )
AND ips.isvalid = 'Y'
WHERE invoiceopen(i.c_invoice_id, ips.c_invoicepayschedule_id) <> 0 AND i.ispayschedulevalid = 'Y' AND i.docstatus IN ('CO',
'CL') AND ips.isvalid = 'Y'
;

View File

@ -14,20 +14,19 @@ SELECT i.AD_Org_ID, i.AD_Client_ID,
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,
currencyRound(i.GrandTotal*p.Discount/100,i.C_Currency_ID,'N') 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.IsPayScheduleValid, cast(null as numeric) 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'
AND i.DocStatus IN ('CO','CL')
UNION
SELECT i.AD_Org_ID, i.AD_Client_ID,
@ -39,8 +38,8 @@ SELECT i.AD_Org_ID, i.AD_Client_ID,
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,
--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,
@ -50,7 +49,6 @@ FROM RV_C_Invoice i
WHERE -- i.IsPaid='N'
--invoiceOpen(i.C_Invoice_ID,ips.C_InvoicePaySchedule_ID) <> 0 AND
i.IsPayScheduleValid='Y'
AND i.DocStatus<>'DR'
AND i.DocStatus IN ('CO','CL')
AND ips.IsValid='Y';

View File

@ -1,8 +1,7 @@
DROP VIEW rv_orderdetail;
CREATE OR REPLACE VIEW rv_orderdetail
AS
SELECT l.ad_client_id,
CREATE OR REPLACE VIEW rv_orderdetail AS
SELECT l.ad_client_id,
l.ad_org_id,
l.isactive,
l.created,
@ -53,21 +52,12 @@ AS
l.priceentered,
l.qtyordered - l.qtydelivered AS qtytodeliver,
l.qtyordered - l.qtyinvoiced AS qtytoinvoice,
( l.qtyordered - l.qtyinvoiced ) * l.priceactual AS netamttoinvoice,
(l.qtyordered - l.qtyinvoiced) * l.priceactual AS netamttoinvoice,
l.qtylostsales,
l.qtylostsales * l.priceactual AS amtlostsales,
CASE
WHEN l.pricelist = 0 THEN 0
ELSE round(( l.pricelist - l.priceactual ) / l.pricelist * 100, 2)
END AS discount,
CASE
WHEN l.pricelimit = 0 THEN 0
ELSE round(( l.priceactual - l.pricelimit ) / l.pricelimit * 100, 2)
END AS margin,
CASE
WHEN l.pricelimit = 0 THEN 0
ELSE ( l.priceactual - l.pricelimit ) * l.qtydelivered
END AS marginamt,
CASE WHEN l.pricelist = 0 THEN 0 ELSE currencyRound((l.pricelist - l.priceactual) / l.pricelist * 100,o.C_Currency_ID,'N') END AS discount,
CASE WHEN l.pricelimit = 0 THEN 0 ELSE currencyRound((l.priceactual - l.pricelimit) / l.pricelimit * 100,o.C_Currency_ID,'N') END AS margin,
CASE WHEN l.pricelimit = 0 THEN 0 ELSE (l.priceactual - l.pricelimit) * l.qtydelivered END AS marginamt,
o.ad_org_id AS c_order_ad_org_id,
o.ad_orgtrx_id AS c_order_ad_orgtrx_id,
o.amountrefunded,
@ -169,10 +159,9 @@ AS
pasi.isactive AS m_asi_isactive,
pasi.updated AS m_asi_updated,
pasi.updatedby AS m_asi_updatedby
FROM c_order o
FROM c_order o
JOIN c_orderline l
ON o.c_order_id = l.c_order_id
LEFT JOIN m_attributesetinstance pasi
ON l.m_attributesetinstance_id = pasi.m_attributesetinstance_id
;

View File

@ -44,6 +44,8 @@ AS
$BODY$
DECLARE
v_Currency_ID numeric(10);
v_Precision NUMERIC := 0;
v_Min NUMERIC := 0;
v_TotalOpenAmt numeric := 0;
v_PaidAmt numeric := 0;
v_Remaining numeric := 0;
@ -67,6 +69,13 @@ BEGIN
END;
-- DBMS_OUTPUT.PUT_LINE('== C_Invoice_ID=' || p_C_Invoice_ID || ', Total=' || v_TotalOpenAmt || ', AP=' || v_MultiplierAP || ', CM=' || v_MultiplierCM);
SELECT StdPrecision
INTO v_Precision
FROM C_Currency
WHERE C_Currency_ID = v_Currency_ID;
SELECT 1/10^v_Precision INTO v_Min;
-- Calculate Allocated Amount
FOR allocationline IN
SELECT a.AD_Client_ID, a.AD_Org_ID,
@ -113,12 +122,114 @@ BEGIN
-- DBMS_OUTPUT.PUT_LINE('== Total=' || v_TotalOpenAmt);
-- Ignore Rounding
IF (v_TotalOpenAmt BETWEEN -0.00999 AND 0.00999) THEN
IF (v_TotalOpenAmt > -v_Min AND v_TotalOpenAmt < v_Min) THEN
v_TotalOpenAmt := 0;
END IF;
-- Round to penny
v_TotalOpenAmt := ROUND(COALESCE(v_TotalOpenAmt,0), 2);
-- Round to currency precision
v_TotalOpenAmt := ROUND(COALESCE(v_TotalOpenAmt,0), v_Precision);
RETURN v_TotalOpenAmt;
END;
$BODY$
LANGUAGE 'plpgsql' ;
CREATE OR REPLACE FUNCTION InvoiceopenToDate
(
p_C_Invoice_ID IN numeric,
p_C_InvoicePaySchedule_ID IN numeric,
p_DateAcct IN date
)
RETURNS numeric
AS
$BODY$
DECLARE
v_Currency_ID numeric(10);
v_Precision NUMERIC := 0;
v_Min NUMERIC := 0;
v_TotalOpenAmt numeric := 0;
v_PaidAmt numeric := 0;
v_Remaining numeric := 0;
v_MultiplierAP numeric := 0;
v_MultiplierCM numeric := 0;
v_Temp numeric := 0;
allocationline record;
invoiceschedule record;
BEGIN
-- Get Currency
BEGIN
SELECT MAX(C_Currency_ID), SUM(GrandTotal), MAX(MultiplierAP), MAX(Multiplier)
INTO v_Currency_ID, v_TotalOpenAmt, v_MultiplierAP, v_MultiplierCM
FROM C_Invoice_v -- corrected for CM / Split Payment
WHERE C_Invoice_ID = p_C_Invoice_ID
AND DateAcct <= p_DateAcct;
EXCEPTION -- Invoice in draft form
WHEN OTHERS THEN
--DBMS_OUTPUT.PUT_LINE('InvoiceOpen - ' || SQLERRM);
RETURN NULL;
END;
-- DBMS_OUTPUT.PUT_LINE('== C_Invoice_ID=' || p_C_Invoice_ID || ', Total=' || v_TotalOpenAmt || ', AP=' || v_MultiplierAP || ', CM=' || v_MultiplierCM);
SELECT StdPrecision
INTO v_Precision
FROM C_Currency
WHERE C_Currency_ID = v_Currency_ID;
SELECT 1/10^v_Precision INTO v_Min;
-- Calculate Allocated Amount
FOR allocationline IN
SELECT a.AD_Client_ID, a.AD_Org_ID,
al.Amount, al.DiscountAmt, al.WriteOffAmt,
a.C_Currency_ID, a.DateTrx
FROM C_ALLOCATIONLINE al
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.DateAcct <= p_DateAcct
AND a.IsActive='Y'
LOOP
v_Temp := allocationline.Amount + allocationline.DisCountAmt + allocationline.WriteOffAmt;
v_PaidAmt := v_PaidAmt
-- Allocation
+ Currencyconvert(v_Temp * v_MultiplierAP,
allocationline.C_Currency_ID, v_Currency_ID, allocationline.DateTrx, NULL, allocationline.AD_Client_ID, allocationline.AD_Org_ID);
--DBMS_OUTPUT.PUT_LINE(' PaidAmt=' || v_PaidAmt || ', Allocation=' || v_Temp || ' * ' || v_MultiplierAP);
END LOOP;
-- Do we have a Payment Schedule ?
IF (p_C_InvoicePaySchedule_ID > 0) THEN -- if not valid = lists invoice amount
v_Remaining := v_PaidAmt;
FOR invoiceschedule IN
SELECT C_InvoicePaySchedule_ID, DueAmt FROM C_INVOICEPAYSCHEDULE WHERE C_Invoice_ID = p_C_Invoice_ID AND IsValid='Y'
ORDER BY DueDate
LOOP
IF (invoiceschedule.C_InvoicePaySchedule_ID = p_C_InvoicePaySchedule_ID) THEN
v_TotalOpenAmt := (invoiceschedule.DueAmt*v_MultiplierCM) - v_Remaining;
IF (invoiceschedule.DueAmt - v_Remaining < 0) THEN
v_TotalOpenAmt := 0;
END IF;
-- DBMS_OUTPUT.PUT_LINE('Sched Total=' || v_TotalOpenAmt || ', Due=' || s.DueAmt || ',Remaining=' || v_Remaining || ',CM=' || v_MultiplierCM);
ELSE -- calculate amount, which can be allocated to next schedule
v_Remaining := v_Remaining - invoiceschedule.DueAmt;
IF (v_Remaining < 0) THEN
v_Remaining := 0;
END IF;
-- DBMS_OUTPUT.PUT_LINE('Remaining=' || v_Remaining);
END IF;
END LOOP;
ELSE
v_TotalOpenAmt := v_TotalOpenAmt - v_PaidAmt;
END IF;
-- DBMS_OUTPUT.PUT_LINE('== Total=' || v_TotalOpenAmt);
-- Ignore Rounding
IF (v_TotalOpenAmt > -v_Min AND v_TotalOpenAmt < v_Min) THEN
v_TotalOpenAmt := 0;
END IF;
-- Round to currency precision
v_TotalOpenAmt := ROUND(COALESCE(v_TotalOpenAmt,0), v_Precision);
RETURN v_TotalOpenAmt;
END;
$BODY$

View File

@ -33,11 +33,20 @@ RETURNS numeric AS $body$
*
************************************************************************/
DECLARE
v_Precision NUMERIC := 0;
v_Min NUMERIC := 0;
v_MultiplierAP NUMERIC := 1;
v_PaymentAmt NUMERIC := 0;
ar RECORD;
BEGIN
SELECT StdPrecision
INTO v_Precision
FROM C_Currency
WHERE C_Currency_ID = p_C_Currency_ID;
SELECT 1/10^v_Precision INTO v_Min;
-- Default
IF (p_MultiplierAP IS NOT NULL) THEN
v_MultiplierAP := p_MultiplierAP;
@ -56,8 +65,16 @@ BEGIN
+ currencyConvert(ar.Amount + ar.DisCountAmt + ar.WriteOffAmt,
ar.C_Currency_ID, p_C_Currency_ID, ar.DateTrx, null, ar.AD_Client_ID, ar.AD_Org_ID);
END LOOP;
--
RETURN ROUND(COALESCE(v_PaymentAmt,0), 2) * v_MultiplierAP;
-- Ignore Rounding
IF (v_PaymentAmt > -v_Min AND v_PaymentAmt < v_Min) THEN
v_PaymentAmt := 0;
END IF;
-- Round to currency precision
v_PaymentAmt := ROUND(COALESCE(v_PaymentAmt,0), v_Precision);
RETURN v_PaymentAmt * v_MultiplierAP;
END;
$body$ LANGUAGE plpgsql;

View File

@ -45,10 +45,19 @@ RETURNS numeric
AS
$BODY$
DECLARE
v_Precision NUMERIC := 0;
v_Min NUMERIC := 0;
v_MultiplierAP numeric := 1;
v_PaymentAmt numeric := 0;
allocation record;
BEGIN
SELECT StdPrecision
INTO v_Precision
FROM C_Currency
WHERE C_Currency_ID = p_C_Currency_ID;
SELECT 1/10^v_Precision INTO v_Min;
-- Default
IF (p_MultiplierAP IS NOT NULL) THEN
v_MultiplierAP := p_MultiplierAP;
@ -64,8 +73,16 @@ BEGIN
+ Currencyconvert(allocation.Amount + allocation.DisCountAmt + allocation.WriteOffAmt,
allocation.C_Currency_ID, p_C_Currency_ID, allocation.DateTrx, NULL, allocation.AD_Client_ID, allocation.AD_Org_ID);
END LOOP;
--
RETURN ROUND(COALESCE(v_PaymentAmt,0), 2) * v_MultiplierAP;
-- Ignore Rounding
IF (v_PaymentAmt > -v_Min AND v_PaymentAmt < v_Min) THEN
v_PaymentAmt := 0;
END IF;
-- Round to currency precision
v_PaymentAmt := ROUND(COALESCE(v_PaymentAmt,0), v_Precision);
RETURN v_PaymentAmt * v_MultiplierAP;
END;
$BODY$
LANGUAGE 'plpgsql' ;

View File

@ -25,6 +25,8 @@ RETURNS NUMERIC AS $body$
************************************************************************/
DECLARE
v_Precision NUMERIC := 0;
v_Min NUMERIC := 0;
Discount NUMERIC := 0;
Discount1Date timestamp with time zone;
Discount2Date timestamp with time zone;
@ -32,6 +34,13 @@ DECLARE
Add2Date NUMERIC := 0;
p RECORD;
BEGIN
SELECT StdPrecision
INTO v_Precision
FROM C_Currency
WHERE C_Currency_ID = Currency_ID;
SELECT 1/10^v_Precision INTO v_Min;
-- No Data - No Discount
IF (Amount IS NULL OR PaymentTerm_ID IS NULL OR DocDate IS NULL) THEN
RETURN 0;
@ -59,8 +68,16 @@ BEGIN
Discount := Amount * p.Discount2 / 100;
END IF;
END LOOP;
--
RETURN ROUND(COALESCE(Discount,0), 2); -- fixed rounding
-- Ignore Rounding
IF (Discount > -v_Min AND Discount < v_Min) THEN
Discount := 0;
END IF;
-- Round to currency precision
Discount := ROUND(COALESCE(Discount,0), v_Precision);
RETURN Discount;
END;
$body$ LANGUAGE plpgsql;

View File

@ -28,10 +28,19 @@ RETURNS NUMERIC AS $body$
************************************************************************/
DECLARE
v_Precision NUMERIC := 0;
v_Min NUMERIC := 0;
v_AllocatedAmt NUMERIC := 0;
v_PayAmt NUMERIC;
r RECORD;
BEGIN
SELECT StdPrecision
INTO v_Precision
FROM C_Currency
WHERE C_Currency_ID = p_C_Currency_ID;
SELECT 1/10^v_Precision INTO v_Min;
-- Charge - nothing available
SELECT
INTO v_PayAmt MAX(PayAmt)
@ -53,8 +62,15 @@ BEGIN
v_AllocatedAmt := v_AllocatedAmt
+ currencyConvert(r.Amount, r.C_Currency_ID, p_C_Currency_ID, r.DateTrx, null, r.AD_Client_ID, r.AD_Org_ID);
END LOOP;
-- Round to penny
v_AllocatedAmt := ROUND(COALESCE(v_AllocatedAmt,0), 2);
-- Ignore Rounding
IF (v_AllocatedAmt > -v_Min AND v_AllocatedAmt < v_Min) THEN
v_AllocatedAmt := 0;
END IF;
-- Round to currency precision
v_AllocatedAmt := ROUND(COALESCE(v_AllocatedAmt,0), v_Precision);
RETURN v_AllocatedAmt;
END;

View File

@ -19,6 +19,8 @@ RETURNS NUMERIC AS $body$
************************************************************************/
DECLARE
v_Currency_ID NUMERIC(10);
v_Precision NUMERIC := 0;
v_Min NUMERIC := 0;
v_AvailableAmt NUMERIC := 0;
v_IsReceipt C_Payment.IsReceipt%TYPE;
v_Amt NUMERIC := 0;
@ -41,6 +43,13 @@ BEGIN
WHERE C_Payment_ID = p_C_Payment_ID;
-- DBMS_OUTPUT.PUT_LINE('== C_Payment_ID=' || p_C_Payment_ID || ', PayAmt=' || v_AvailableAmt || ', Receipt=' || v_IsReceipt);
SELECT StdPrecision
INTO v_Precision
FROM C_Currency
WHERE C_Currency_ID = v_Currency_ID;
SELECT 1/10^v_Precision INTO v_Min;
-- Calculate Allocated Amount
FOR r IN
SELECT a.AD_Client_ID, a.AD_Org_ID, al.Amount, a.C_Currency_ID, a.DateTrx
@ -53,12 +62,15 @@ BEGIN
v_AvailableAmt := v_AvailableAmt - v_Amt;
-- DBMS_OUTPUT.PUT_LINE(' Allocation=' || a.Amount || ' - Available=' || v_AvailableAmt);
END LOOP;
-- Ignore Rounding
IF (v_AvailableAmt BETWEEN -0.00999 AND 0.00999) THEN
IF (v_AvailableAmt > -v_Min AND v_AvailableAmt < v_Min) THEN
v_AvailableAmt := 0;
END IF;
-- Round to penny
v_AvailableAmt := ROUND(COALESCE(v_AvailableAmt,0), 2);
-- Round to currency precision
v_AvailableAmt := ROUND(COALESCE(v_AvailableAmt,0), v_Precision);
RETURN v_AvailableAmt;
END;

View File

@ -11,11 +11,11 @@ SELECT il.AD_Client_ID, il.AD_Org_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*il.PriceLimit*il.QtyInvoiced,2) END AS LineLimitAmt,
ROUND(i.Multiplier*il.PriceList*il.QtyInvoiced-il.LineNetAmt,2) AS LineDiscountAmt,
CASE WHEN COALESCE(il.PriceLimit,0)=0 THEN 0 ELSE ROUND(i.Multiplier*il.LineNetAmt-il.PriceLimit*il.QtyInvoiced,2) END AS LineOverLimitAmt,
currencyRound(i.Multiplier*LineNetAmt,i.C_Currency_ID,'N') AS LineNetAmt,
currencyRound(i.Multiplier*PriceList*QtyInvoiced,i.C_Currency_ID,'N') AS LineListAmt,
CASE WHEN COALESCE(il.PriceLimit, 0)=0 THEN currencyRound(i.Multiplier*LineNetAmt,i.C_Currency_ID,'N') ELSE currencyRound(i.Multiplier*il.PriceLimit*il.QtyInvoiced,i.C_Currency_ID,'N') END AS LineLimitAmt,
currencyRound(i.Multiplier*il.PriceList*il.QtyInvoiced-il.LineNetAmt,i.C_Currency_ID,'N') AS LineDiscountAmt,
CASE WHEN COALESCE(il.PriceLimit,0)=0 THEN 0 ELSE currencyRound(i.Multiplier*il.LineNetAmt-il.PriceLimit*il.QtyInvoiced,i.C_Currency_ID,'N') 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

View File

@ -13,7 +13,7 @@ SELECT s.ad_client_id,
sum(ms.qtyonhand - ms.qtyreserved) AS qtyavailable,
sum(ms.qtyonhand) AS qtyonhand,
sum(ms.qtyreserved) AS qtyreserved,
ROUND(MAX(mpr.pricestd),0) AS pricestd,
currencyRound(MAX(mpr.pricestd),mpl.C_Currency_ID,'N') AS pricestd,
mpr.m_pricelist_version_id,
mw.m_warehouse_id,
org.name AS orgname
@ -23,6 +23,8 @@ SELECT s.ad_client_id,
JOIN m_locator ml ON ms.m_locator_id = ml.m_locator_id
JOIN m_warehouse mw ON ml.m_warehouse_id = mw.m_warehouse_id
JOIN m_productprice mpr ON ms.m_product_id = mpr.m_product_id
JOIN m_pricelist_version mplv ON mplv.m_pricelist_version_id = mpr.m_pricelist_version_id
JOIN m_pricelist mpl ON mplv.m_pricelist_id = mpl.m_pricelist_id
JOIN ad_org org ON org.ad_org_id = mw.ad_org_id
GROUP BY s.ad_client_id,
s.ad_org_id,
@ -36,7 +38,8 @@ SELECT s.ad_client_id,
mw.m_warehouse_id,
mpr.m_pricelist_version_id,
org.name,
mp.name
mp.name,
mpl.C_Currency_ID
UNION
SELECT r.ad_client_id,
r.ad_org_id,
@ -52,7 +55,7 @@ SELECT s.ad_client_id,
sum(ms.qtyonhand - ms.qtyreserved) AS qtyavailable,
sum(ms.qtyonhand) AS qtyonhand,
sum(ms.qtyreserved) AS qtyreserved,
ROUND(MAX(mpr.pricestd),0) AS pricestd,
currencyRound(MAX(mpr.pricestd),mpl.C_Currency_ID,'N') AS pricestd,
mpr.m_pricelist_version_id,
mw.m_warehouse_id,
org.name AS orgname
@ -62,6 +65,8 @@ SELECT s.ad_client_id,
JOIN m_locator ml ON ms.m_locator_id = ml.m_locator_id
JOIN m_warehouse mw ON ml.m_warehouse_id = mw.m_warehouse_id
JOIN m_productprice mpr ON ms.m_product_id = mpr.m_product_id
JOIN m_pricelist_version mplv ON mplv.m_pricelist_version_id = mpr.m_pricelist_version_id
JOIN m_pricelist mpl ON mplv.m_pricelist_id = mpl.m_pricelist_id
JOIN ad_org org ON org.ad_org_id = mw.ad_org_id
GROUP BY r.ad_client_id,
r.ad_org_id,
@ -75,4 +80,5 @@ SELECT s.ad_client_id,
mw.m_warehouse_id,
mpr.m_pricelist_version_id,
org.name,
mp.name;
mp.name,
mpl.C_Currency_ID;

View File

@ -37,15 +37,15 @@ SELECT il.ad_client_id,
il.priceactual,
il.pricelimit,
il.priceentered,
CASE WHEN il.pricelist = 0 THEN 0 ELSE round((il.pricelist - il.priceactual) / il.pricelist * 100, 2) END AS discount,
CASE WHEN il.pricelimit = 0 THEN 0 ELSE round((il.priceactual - il.pricelimit) / il.pricelimit * 100, 2) END AS margin,
CASE WHEN il.pricelist = 0 THEN 0 ELSE currencyRound((il.pricelist - il.priceactual) / il.pricelist * 100,i.C_Currency_ID,'N') END AS discount,
CASE WHEN il.pricelimit = 0 THEN 0 ELSE currencyRound((il.priceactual - il.pricelimit) / il.pricelimit * 100,i.C_Currency_ID,'N') END AS margin,
CASE WHEN il.pricelimit = 0 THEN 0 ELSE (il.priceactual - il.pricelimit) * il.qtyinvoiced END AS marginamt,
round(i.multiplier * il.linenetamt, 2) AS linenetamt,
round(i.multiplier * il.pricelist * il.qtyinvoiced, 2) AS linelistamt,
CASE WHEN COALESCE(il.pricelimit, 0) = 0 THEN round(i.multiplier * il.linenetamt, 2) ELSE round(i.multiplier * il.pricelimit * il.qtyinvoiced, 2) END
currencyRound(i.multiplier * il.linenetamt,i.C_Currency_ID,'N') AS linenetamt,
currencyRound(i.multiplier * il.pricelist * il.qtyinvoiced,i.C_Currency_ID,'N') AS linelistamt,
CASE WHEN COALESCE(il.pricelimit, 0) = 0 THEN currencyRound(i.multiplier * il.linenetamt,i.C_Currency_ID,'N') ELSE currencyRound(i.multiplier * il.pricelimit * il.qtyinvoiced,i.C_Currency_ID,'N') END
AS linelimitamt,
round(i.multiplier * il.pricelist * il.qtyinvoiced - il.linenetamt, 2) AS linediscountamt,
CASE WHEN COALESCE(il.pricelimit, 0) = 0 THEN 0 ELSE round(i.multiplier * il.linenetamt - il.pricelimit * il.qtyinvoiced, 2) END AS
currencyRound(i.multiplier * il.pricelist * il.qtyinvoiced - il.linenetamt,i.C_Currency_ID,'N') AS linediscountamt,
CASE WHEN COALESCE(il.pricelimit, 0) = 0 THEN 0 ELSE currencyRound(i.multiplier * il.linenetamt - il.pricelimit * il.qtyinvoiced,i.C_Currency_ID,'N') END AS
lineoverlimitamt,
il.ad_orgtrx_id,
il.a_processed,

View File

@ -11,14 +11,15 @@ SELECT il.AD_Client_ID, il.AD_Org_ID,
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,
currencyRound((SUM(LineListAmt)-SUM(LineNetAmt))/SUM(LineListAmt)*100,i.C_Currency_ID,'N') 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
100-currencyRound((SUM(LineNetAmt)-SUM(LineOverLimitAmt))/SUM(LineNetAmt)*100,i.C_Currency_ID,'N') END AS LineOverLimit,
SUM(QtyInvoiced) AS QtyInvoiced, il.IsSOTrx
FROM RV_C_InvoiceLine il
INNER JOIN C_Invoice i ON (i.C_Invoice_ID=il.C_Invoice_ID)
GROUP BY il.AD_Client_ID, il.AD_Org_ID, il.C_BPartner_ID, il.M_Product_Category_ID,
firstOf(il.DateInvoiced, 'Q'), IsSOTrx;
firstOf(il.DateInvoiced, 'Q'), il.IsSOTrx, i.C_Currency_ID;

View File

@ -11,16 +11,17 @@ SELECT il.AD_Client_ID, il.AD_Org_ID,
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,
currencyRound((SUM(LineListAmt)-SUM(LineNetAmt))/SUM(LineListAmt)*100,i.C_Currency_ID,'N') 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,
100-currencyRound((SUM(LineNetAmt)-SUM(LineOverLimitAmt))/SUM(LineNetAmt)*100,i.C_Currency_ID,'N') END AS LineOverLimit,
SUM(QtyInvoiced) AS QtyInvoiced
FROM RV_C_InvoiceLine il
INNER JOIN C_Invoice i ON (i.C_Invoice_ID=il.C_Invoice_ID)
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');
firstOf(il.DateInvoiced, 'Q'), i.C_Currency_ID;

View File

@ -3,21 +3,22 @@ CREATE OR REPLACE VIEW RV_C_INVOICE_DAY
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
SELECT il.AD_Client_ID, il.AD_Org_ID, il.SalesRep_ID,
firstOf(il.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,
currencyRound((SUM(LineListAmt)-SUM(LineNetAmt))/SUM(LineListAmt)*100,i.C_Currency_ID,'N') 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;
100-currencyRound((SUM(LineNetAmt)-SUM(LineOverLimitAmt))/SUM(LineNetAmt)*100,i.C_Currency_ID,'N') END AS LineOverLimit,
il.IsSOTrx
FROM RV_C_InvoiceLine il
INNER JOIN C_Invoice i ON (i.C_Invoice_ID=il.C_Invoice_ID)
GROUP BY il.AD_Client_ID, il.AD_Org_ID, il.SalesRep_ID,
firstOf(il.DateInvoiced, 'DD'), il.IsSOTrx, i.C_Currency_ID;

View File

@ -3,21 +3,22 @@ CREATE OR REPLACE VIEW RV_C_INVOICE_MONTH
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
SELECT il.AD_Client_ID, il.AD_Org_ID, il.SalesRep_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,
currencyRound((SUM(LineListAmt)-SUM(LineNetAmt))/SUM(LineListAmt)*100,i.C_Currency_ID,'N') 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;
100-currencyRound((SUM(LineNetAmt)-SUM(LineOverLimitAmt))/SUM(LineNetAmt)*100,i.C_Currency_ID,'N') END AS LineOverLimit,
il.IsSOTrx
FROM RV_C_InvoiceLine il
INNER JOIN C_Invoice i ON (i.C_Invoice_ID=il.C_Invoice_ID)
GROUP BY il.AD_Client_ID, il.AD_Org_ID, il.SalesRep_ID,
firstOf(il.DateInvoiced, 'MM'), il.IsSOTrx, i.C_Currency_ID;

View File

@ -10,14 +10,15 @@ SELECT il.AD_Client_ID, il.AD_Org_ID, il.M_Product_Category_ID,
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,
currencyRound((SUM(LineListAmt)-SUM(LineNetAmt))/SUM(LineListAmt)*100,i.C_Currency_ID,'N') 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
100-currencyRound((SUM(LineNetAmt)-SUM(LineOverLimitAmt))/SUM(LineNetAmt)*100,i.C_Currency_ID,'N') END AS LineOverLimit,
SUM(QtyInvoiced) AS QtyInvoiced, il.IsSOTrx
FROM RV_C_InvoiceLine il
INNER JOIN C_Invoice i ON (i.C_Invoice_ID=il.C_Invoice_ID)
GROUP BY il.AD_Client_ID, il.AD_Org_ID, il.M_Product_Category_ID,
firstOf(il.DateInvoiced, 'MM'), IsSOTrx;
firstOf(il.DateInvoiced, 'MM'), il.IsSOTrx, i.C_Currency_ID;

View File

@ -10,14 +10,15 @@ SELECT il.AD_Client_ID, il.AD_Org_ID, il.M_Product_ID,
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,
currencyRound((SUM(LineListAmt)-SUM(LineNetAmt))/SUM(LineListAmt)*100,i.C_Currency_ID,'N') 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
100-currencyRound((SUM(LineNetAmt)-SUM(LineOverLimitAmt))/SUM(LineNetAmt)*100,i.C_Currency_ID,'N') END AS LineOverLimit,
SUM(QtyInvoiced) AS QtyInvoiced, il.IsSOTrx
FROM RV_C_InvoiceLine il
INNER JOIN C_Invoice i ON (i.C_Invoice_ID=il.C_Invoice_ID)
GROUP BY il.AD_Client_ID, il.AD_Org_ID, il.M_Product_ID,
firstOf(il.DateInvoiced, 'MM'), IsSOTrx;
firstOf(il.DateInvoiced, 'MM'), il.IsSOTrx, i.C_Currency_ID;

View File

@ -10,14 +10,15 @@ SELECT il.AD_Client_ID, il.AD_Org_ID, il.M_Product_ID,
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,
currencyRound((SUM(LineListAmt)-SUM(LineNetAmt))/SUM(LineListAmt)*100,i.C_Currency_ID,'N') 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
100-currencyRound((SUM(LineNetAmt)-SUM(LineOverLimitAmt))/SUM(LineNetAmt)*100,i.C_Currency_ID,'N') END AS LineOverLimit,
SUM(QtyInvoiced) AS QtyInvoiced, il.IsSOTrx
FROM RV_C_InvoiceLine il
INNER JOIN C_Invoice i ON (i.C_Invoice_ID=il.C_Invoice_ID)
GROUP BY il.AD_Client_ID, il.AD_Org_ID, il.M_Product_ID,
firstOf(il.DateInvoiced, 'Q'), IsSOTrx;
firstOf(il.DateInvoiced, 'Q'), il.IsSOTrx, i.C_Currency_ID;

View File

@ -10,14 +10,15 @@ SELECT il.AD_Client_ID, il.AD_Org_ID, il.M_Product_Category_ID,
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,
currencyRound((SUM(LineListAmt)-SUM(LineNetAmt))/SUM(LineListAmt)*100,i.C_Currency_ID,'N') 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
100-currencyRound((SUM(LineNetAmt)-SUM(LineOverLimitAmt))/SUM(LineNetAmt)*100,i.C_Currency_ID,'N') END AS LineOverLimit,
SUM(QtyInvoiced) AS QtyInvoiced, il.IsSOTrx
FROM RV_C_InvoiceLine il
INNER JOIN C_Invoice i ON (i.C_Invoice_ID=il.C_Invoice_ID)
GROUP BY il.AD_Client_ID, il.AD_Org_ID, il.M_Product_Category_ID,
firstOf(il.DateInvoiced, 'DY'), IsSOTrx;
firstOf(il.DateInvoiced, 'DY'), il.IsSOTrx, i.C_Currency_ID;

View File

@ -6,21 +6,22 @@ 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(il.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,
currencyRound((SUM(LineListAmt)-SUM(LineNetAmt))/SUM(LineListAmt)*100,i.C_Currency_ID,'N') 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,
100-currencyRound((SUM(LineNetAmt)-SUM(LineOverLimitAmt))/SUM(LineNetAmt)*100,i.C_Currency_ID,'N') END AS LineOverLimit,
SUM(QtyInvoiced) AS QtyInvoiced
FROM RV_C_InvoiceLine il
INNER JOIN C_Invoice i ON (i.C_Invoice_ID=il.C_Invoice_ID)
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');
firstOf(il.DateInvoiced, 'MM'), i.C_Currency_ID;

View File

@ -3,21 +3,22 @@ CREATE OR REPLACE VIEW RV_C_INVOICE_WEEK
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
SELECT il.AD_Client_ID, il.AD_Org_ID, il.SalesRep_ID,
firstOf(il.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,
currencyRound((SUM(LineListAmt)-SUM(LineNetAmt))/SUM(LineListAmt)*100,i.C_Currency_ID,'N') 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;
100-currencyRound((SUM(LineNetAmt)-SUM(LineOverLimitAmt))/SUM(LineNetAmt)*100,i.C_Currency_ID,'N') END AS LineOverLimit,
il.IsSOTrx
FROM RV_C_InvoiceLine il
INNER JOIN C_Invoice i ON (i.C_Invoice_ID=il.C_Invoice_ID)
GROUP BY il.AD_Client_ID, il.AD_Org_ID, il.SalesRep_ID,
firstOf(il.DateInvoiced, 'DY'), il.IsSOTrx, i.C_Currency_ID;

View File

@ -14,7 +14,7 @@ SELECT i.ad_org_id,
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,
currencyRound(i.grandtotal * p.discount / 100,i.C_Currency_ID,'N') AS discountamt,
i.grandtotal,
invoicepaid(i.c_invoice_id, i.c_currency_id, 1) AS paidamt,
invoiceopen(i.c_invoice_id, 0) AS openamt,

View File

@ -14,7 +14,7 @@ SELECT i.AD_Org_ID, i.AD_Client_ID,
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,
currencyRound(i.GrandTotal*p.Discount/100,i.C_Currency_ID,'N') AS DiscountAmt,
i.GrandTotal,
--invoicePaid(i.C_Invoice_ID, i.C_Currency_ID, 1) AS PaidAmt,
--invoiceOpen(i.C_Invoice_ID,0) AS OpenAmt,

View File

@ -55,8 +55,8 @@ SELECT l.ad_client_id,
(l.qtyordered - l.qtyinvoiced) * l.priceactual AS netamttoinvoice,
l.qtylostsales,
l.qtylostsales * l.priceactual AS amtlostsales,
CASE WHEN l.pricelist = 0 THEN 0 ELSE round((l.pricelist - l.priceactual) / l.pricelist * 100, 2) END AS discount,
CASE WHEN l.pricelimit = 0 THEN 0 ELSE round((l.priceactual - l.pricelimit) / l.pricelimit * 100, 2) END AS margin,
CASE WHEN l.pricelist = 0 THEN 0 ELSE currencyRound((l.pricelist - l.priceactual) / l.pricelist * 100,o.C_Currency_ID,'N') END AS discount,
CASE WHEN l.pricelimit = 0 THEN 0 ELSE currencyRound((l.priceactual - l.pricelimit) / l.pricelimit * 100,o.C_Currency_ID,'N') END AS margin,
CASE WHEN l.pricelimit = 0 THEN 0 ELSE (l.priceactual - l.pricelimit) * l.qtydelivered END AS marginamt,
o.ad_org_id AS c_order_ad_org_id,
o.ad_orgtrx_id AS c_order_ad_orgtrx_id,

View File

@ -0,0 +1,8 @@
SET SQLBLANKLINES ON
SET DEFINE OFF
-- Mar 13, 2014 3:37:35 AM ICT
UPDATE AD_Field SET DisplayLogic='@Processed@=Y & @M_Product_ID.IsBOM@=Y',Updated=TO_DATE('2014-03-13 03:37:35','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200271
;
SELECT register_migration_script('201403131604_IDEMPIERE-1742.sql') FROM dual
;

View File

@ -0,0 +1,17 @@
SET SQLBLANKLINES ON
SET DEFINE OFF
-- Mar 16, 2014 1:24:36 PM ICT
-- IDEMPIERE-1619 Link on third tab pointing to field on first tab instead of second
UPDATE AD_Column SET IsUpdateable='N', DefaultValue='@1|AD_WF_Node_ID@',Updated=TO_DATE('2014-03-16 13:24:36','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=10426
;
-- Mar 16, 2014 1:25:39 PM ICT
UPDATE AD_Column SET IsUpdateable='N', DefaultValue='@1|AD_WF_Node_ID@',Updated=TO_DATE('2014-03-16 13:25:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=304
;
UPDATE AD_Column SET IsUpdateable='N', DefaultValue='@4|AD_WF_NodeNext_ID@',Updated=TO_DATE('2014-03-20 02:22:55','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=11571
;
SELECT register_migration_script('201403161604_IDEMPIERE-1619.sql') FROM dual
;

View File

@ -0,0 +1,19 @@
SET SQLBLANKLINES ON
SET DEFINE OFF
-- Mar 24, 2014 8:09:18 PM COT
-- IDEMPIERE-1852 Translation: Accounting Fact Reconcilation (manual)
INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,Created,AD_Client_ID,AD_Org_ID) VALUES ('I','DR',200260,'D','40c2b5df-fe62-4d94-9376-fa82bfe99969','DR','Y',TO_DATE('2014-03-24 20:09:17','YYYY-MM-DD HH24:MI:SS'),100,100,TO_DATE('2014-03-24 20:09:17','YYYY-MM-DD HH24:MI:SS'),0,0)
;
-- Mar 24, 2014 8:09:35 PM COT
INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,Created,AD_Client_ID,AD_Org_ID) VALUES ('I','CR',200261,'D','c4c434ec-7516-46c0-ad29-122c2b871b04','CR','Y',TO_DATE('2014-03-24 20:09:35','YYYY-MM-DD HH24:MI:SS'),100,100,TO_DATE('2014-03-24 20:09:35','YYYY-MM-DD HH24:MI:SS'),0,0)
;
-- Mar 24, 2014 8:10:25 PM COT
INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,Created,AD_Client_ID,AD_Org_ID) VALUES ('I','DR/CR',200262,'D','41ceddd4-a1d0-4387-8d64-f10391a9badf','DR/CR','Y',TO_DATE('2014-03-24 20:10:24','YYYY-MM-DD HH24:MI:SS'),100,100,TO_DATE('2014-03-24 20:10:24','YYYY-MM-DD HH24:MI:SS'),0,0)
;
SELECT register_migration_script('201403242011_IDEMPIERE-1852.sql') FROM dual
;

View File

@ -0,0 +1,5 @@
-- Mar 13, 2014 3:37:35 AM ICT
UPDATE AD_Field SET DisplayLogic='@Processed@=Y & @M_Product_ID.IsBOM@=Y',Updated=TO_TIMESTAMP('2014-03-13 03:37:35','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200271
;
SELECT register_migration_script('201403131604_IDEMPIERE-1742.sql') FROM dual
;

View File

@ -0,0 +1,14 @@
-- Mar 16, 2014 1:24:36 PM ICT
-- IDEMPIERE-1619 Link on third tab pointing to field on first tab instead of second
UPDATE AD_Column SET IsUpdateable='N', DefaultValue='@1|AD_WF_Node_ID@',Updated=TO_TIMESTAMP('2014-03-16 13:24:36','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=10426
;
-- Mar 16, 2014 1:25:39 PM ICT
UPDATE AD_Column SET IsUpdateable='N', DefaultValue='@1|AD_WF_Node_ID@',Updated=TO_TIMESTAMP('2014-03-16 13:25:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=304
;
UPDATE AD_Column SET IsUpdateable='N', DefaultValue='@4|AD_WF_NodeNext_ID@',Updated=TO_TIMESTAMP('2014-03-20 02:22:55','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=11571
;
SELECT register_migration_script('201403161604_IDEMPIERE-1619.sql') FROM dual
;

View File

@ -0,0 +1,16 @@
-- Mar 24, 2014 8:09:18 PM COT
-- IDEMPIERE-1852 Translation: Accounting Fact Reconcilation (manual)
INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,Created,AD_Client_ID,AD_Org_ID) VALUES ('I','DR',200260,'D','40c2b5df-fe62-4d94-9376-fa82bfe99969','DR','Y',TO_TIMESTAMP('2014-03-24 20:09:17','YYYY-MM-DD HH24:MI:SS'),100,100,TO_TIMESTAMP('2014-03-24 20:09:17','YYYY-MM-DD HH24:MI:SS'),0,0)
;
-- Mar 24, 2014 8:09:35 PM COT
INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,Created,AD_Client_ID,AD_Org_ID) VALUES ('I','CR',200261,'D','c4c434ec-7516-46c0-ad29-122c2b871b04','CR','Y',TO_TIMESTAMP('2014-03-24 20:09:35','YYYY-MM-DD HH24:MI:SS'),100,100,TO_TIMESTAMP('2014-03-24 20:09:35','YYYY-MM-DD HH24:MI:SS'),0,0)
;
-- Mar 24, 2014 8:10:25 PM COT
INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,Created,AD_Client_ID,AD_Org_ID) VALUES ('I','DR/CR',200262,'D','41ceddd4-a1d0-4387-8d64-f10391a9badf','DR/CR','Y',TO_TIMESTAMP('2014-03-24 20:10:24','YYYY-MM-DD HH24:MI:SS'),100,100,TO_TIMESTAMP('2014-03-24 20:10:24','YYYY-MM-DD HH24:MI:SS'),0,0)
;
SELECT register_migration_script('201403242011_IDEMPIERE-1852.sql') FROM dual
;

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -397,10 +397,10 @@ public class ChartBuilder {
private JFreeChart createXYBarChart() {
JFreeChart chart = ChartFactory.createXYBarChart(
chartModel.getName(), // chart title
chartModel.getDomainLabel(), // domain axis label
chartModel.get_Translation(MChart.COLUMNNAME_Name), // chart title
chartModel.get_Translation(MChart.COLUMNNAME_DomainLabel), // domain axis label
true,
chartModel.getRangeLabel(), // range axis label
chartModel.get_Translation(MChart.COLUMNNAME_RangeLabel), // range axis label
getXYDataset(), // data
X_AD_Chart.CHARTORIENTATION_Horizontal.equals(chartModel.getChartOrientation())
? PlotOrientation.HORIZONTAL : PlotOrientation.VERTICAL, // orientation
@ -415,9 +415,9 @@ public class ChartBuilder {
private JFreeChart createTimeSeriesChart() {
JFreeChart chart = ChartFactory.createTimeSeriesChart(
chartModel.getName(), // chart title
chartModel.getDomainLabel(), // domain axis label
chartModel.getRangeLabel(), // range axis label
chartModel.get_Translation(MChart.COLUMNNAME_Name), // chart title
chartModel.get_Translation(MChart.COLUMNNAME_DomainLabel), // domain axis label
chartModel.get_Translation(MChart.COLUMNNAME_RangeLabel), // range axis label
getXYDataset(), // data
chartModel.isDisplayLegend(), // include legend
true, // tooltips?
@ -430,9 +430,9 @@ public class ChartBuilder {
private JFreeChart createWaterfallChart() {
JFreeChart chart = ChartFactory.createWaterfallChart(
chartModel.getName(), // chart title
chartModel.getDomainLabel(), // domain axis label
chartModel.getRangeLabel(), // range axis label
chartModel.get_Translation(MChart.COLUMNNAME_Name), // chart title
chartModel.get_Translation(MChart.COLUMNNAME_DomainLabel), // domain axis label
chartModel.get_Translation(MChart.COLUMNNAME_RangeLabel), // range axis label
getCategoryDataset(), // data
X_AD_Chart.CHARTORIENTATION_Horizontal.equals(chartModel.getChartOrientation())
? PlotOrientation.HORIZONTAL : PlotOrientation.VERTICAL, // orientation
@ -446,21 +446,21 @@ public class ChartBuilder {
}
private JFreeChart createRingChart() {
final JFreeChart chart = ChartFactory.createRingChart(chartModel.getName(),
final JFreeChart chart = ChartFactory.createRingChart(chartModel.get_Translation(MChart.COLUMNNAME_Name),
getPieDataset(), chartModel.isDisplayLegend(), true, true);
return chart;
}
private JFreeChart createPieChart() {
final JFreeChart chart = ChartFactory.createPieChart(chartModel.getName(),
final JFreeChart chart = ChartFactory.createPieChart(chartModel.get_Translation(MChart.COLUMNNAME_Name),
getPieDataset(), false, true, true);
return chart;
}
private JFreeChart create3DPieChart() {
final JFreeChart chart = ChartFactory.createPieChart3D(chartModel.getName(),
final JFreeChart chart = ChartFactory.createPieChart3D(chartModel.get_Translation(MChart.COLUMNNAME_Name),
getPieDataset(), false, true, true);
return chart;
@ -468,9 +468,9 @@ public class ChartBuilder {
private JFreeChart createBarChart() {
JFreeChart chart = ChartFactory.createBarChart(
chartModel.getName(), // chart title
chartModel.getDomainLabel(), // domain axis label
chartModel.getRangeLabel(), // range axis label
chartModel.get_Translation(MChart.COLUMNNAME_Name), // chart title
chartModel.get_Translation(MChart.COLUMNNAME_DomainLabel), // domain axis label
chartModel.get_Translation(MChart.COLUMNNAME_RangeLabel), // range axis label
getCategoryDataset(), // data
X_AD_Chart.CHARTORIENTATION_Horizontal.equals(chartModel.getChartOrientation())
? PlotOrientation.HORIZONTAL : PlotOrientation.VERTICAL, // orientation
@ -491,9 +491,9 @@ public class ChartBuilder {
private JFreeChart create3DBarChart() {
JFreeChart chart = ChartFactory.createBarChart3D(
chartModel.getName(), // chart title
chartModel.getDomainLabel(), // domain axis label
chartModel.getRangeLabel(), // range axis label
chartModel.get_Translation(MChart.COLUMNNAME_Name), // chart title
chartModel.get_Translation(MChart.COLUMNNAME_DomainLabel), // domain axis label
chartModel.get_Translation(MChart.COLUMNNAME_RangeLabel), // range axis label
getCategoryDataset(), // data
X_AD_Chart.CHARTORIENTATION_Horizontal.equals(chartModel.getChartOrientation())
? PlotOrientation.HORIZONTAL : PlotOrientation.VERTICAL, // orientation
@ -508,9 +508,9 @@ public class ChartBuilder {
private JFreeChart createStackedBarChart() {
JFreeChart chart = ChartFactory.createStackedBarChart(
chartModel.getName(), // chart title
chartModel.getDomainLabel(), // domain axis label
chartModel.getRangeLabel(), // range axis label
chartModel.get_Translation(MChart.COLUMNNAME_Name), // chart title
chartModel.get_Translation(MChart.COLUMNNAME_DomainLabel), // domain axis label
chartModel.get_Translation(MChart.COLUMNNAME_RangeLabel), // range axis label
getCategoryDataset(), // data
X_AD_Chart.CHARTORIENTATION_Horizontal.equals(chartModel.getChartOrientation())
? PlotOrientation.HORIZONTAL : PlotOrientation.VERTICAL, // orientation
@ -532,9 +532,9 @@ public class ChartBuilder {
private JFreeChart create3DStackedBarChart() {
JFreeChart chart = ChartFactory.createStackedBarChart3D(
chartModel.getName(), // chart title
chartModel.getDomainLabel(), // domain axis label
chartModel.getRangeLabel(), // range axis label
chartModel.get_Translation(MChart.COLUMNNAME_Name), // chart title
chartModel.get_Translation(MChart.COLUMNNAME_DomainLabel), // domain axis label
chartModel.get_Translation(MChart.COLUMNNAME_RangeLabel), // range axis label
getCategoryDataset(), // data
X_AD_Chart.CHARTORIENTATION_Horizontal.equals(chartModel.getChartOrientation())
? PlotOrientation.HORIZONTAL : PlotOrientation.VERTICAL, // orientation
@ -550,9 +550,9 @@ public class ChartBuilder {
private JFreeChart createAreaChart() {
// create the chart...
JFreeChart chart = ChartFactory.createAreaChart(
chartModel.getName(), // chart title
chartModel.getDomainLabel(), // domain axis label
chartModel.getRangeLabel(), // range axis label
chartModel.get_Translation(MChart.COLUMNNAME_Name), // chart title
chartModel.get_Translation(MChart.COLUMNNAME_DomainLabel), // domain axis label
chartModel.get_Translation(MChart.COLUMNNAME_RangeLabel), // range axis label
getCategoryDataset(), // data
X_AD_Chart.CHARTORIENTATION_Horizontal.equals(chartModel.getChartOrientation())
? PlotOrientation.HORIZONTAL : PlotOrientation.VERTICAL, // orientation
@ -568,9 +568,9 @@ public class ChartBuilder {
private JFreeChart createStackedAreaChart() {
// create the chart...
JFreeChart chart = ChartFactory.createStackedAreaChart(
chartModel.getName(), // chart title
chartModel.getDomainLabel(), // domain axis label
chartModel.getRangeLabel(), // range axis label
chartModel.get_Translation(MChart.COLUMNNAME_Name), // chart title
chartModel.get_Translation(MChart.COLUMNNAME_DomainLabel), // domain axis label
chartModel.get_Translation(MChart.COLUMNNAME_RangeLabel), // range axis label
getCategoryDataset(), // data
X_AD_Chart.CHARTORIENTATION_Horizontal.equals(chartModel.getChartOrientation())
? PlotOrientation.HORIZONTAL : PlotOrientation.VERTICAL, // orientation
@ -586,9 +586,9 @@ public class ChartBuilder {
private JFreeChart createLineChart() {
// create the chart...
JFreeChart chart = ChartFactory.createLineChart(
chartModel.getName(), // chart title
chartModel.getDomainLabel(), // domain axis label
chartModel.getRangeLabel(), // range axis label
chartModel.get_Translation(MChart.COLUMNNAME_Name), // chart title
chartModel.get_Translation(MChart.COLUMNNAME_DomainLabel), // domain axis label
chartModel.get_Translation(MChart.COLUMNNAME_RangeLabel), // range axis label
getCategoryDataset(), // data
X_AD_Chart.CHARTORIENTATION_Horizontal.equals(chartModel.getChartOrientation())
? PlotOrientation.HORIZONTAL : PlotOrientation.VERTICAL, // orientation
@ -605,9 +605,9 @@ public class ChartBuilder {
private JFreeChart create3DLineChart() {
// create the chart...
JFreeChart chart = ChartFactory.createLineChart3D(
chartModel.getName(), // chart title
chartModel.getDomainLabel(), // domain axis label
chartModel.getRangeLabel(), // range axis label
chartModel.get_Translation(MChart.COLUMNNAME_Name), // chart title
chartModel.get_Translation(MChart.COLUMNNAME_DomainLabel), // domain axis label
chartModel.get_Translation(MChart.COLUMNNAME_RangeLabel), // range axis label
getCategoryDataset(), // data
X_AD_Chart.CHARTORIENTATION_Horizontal.equals(chartModel.getChartOrientation())
? PlotOrientation.HORIZONTAL : PlotOrientation.VERTICAL, // orientation

View File

@ -54,7 +54,7 @@ public class DefaultLookupFactory implements ILookupFactory{
}
else if (gridFieldVO.displayType == Payment)
{
lookup = new MPaymentLookup (gridFieldVO.ctx, gridFieldVO.WindowNo, gridFieldVO.AD_Column_ID);
lookup = new MPaymentLookup (gridFieldVO.ctx, gridFieldVO.WindowNo, gridFieldVO.ValidationCode);
}
else if (DisplayType.isLookup(gridFieldVO.displayType) && gridFieldVO.lookupInfo != null)
{

View File

@ -13,13 +13,18 @@
*****************************************************************************/
package org.adempiere.base;
import java.util.Map;
import org.adempiere.util.ModelClassGenerator;
import org.adempiere.util.ModelGeneratorDialog;
import org.adempiere.util.ModelInterfaceGenerator;
import org.compiere.Adempiere;
import org.eclipse.equinox.app.IApplication;
import org.eclipse.equinox.app.IApplicationContext;
/**
* @author hengsin
* @author tbayen - command line start
*
*/
public class ModelGeneratorApplication implements IApplication {
@ -30,11 +35,25 @@ public class ModelGeneratorApplication implements IApplication {
@Override
public Object start(IApplicationContext context) throws Exception {
Adempiere.startup(false);
Map<?, ?> args = context.getArguments();
// IDEMPIERE-1686 - GenerateModel does not take commandline arguments
String commandlineArgs[] = (String[]) args.get("application.args");
if (commandlineArgs.length == 4) {
String folder = commandlineArgs[0];
String packageName = commandlineArgs[1];
String entityType = commandlineArgs[2];
String tableName = commandlineArgs[3];
ModelInterfaceGenerator.generateSource(folder, packageName, entityType, tableName);
ModelClassGenerator.generateSource(folder, packageName, entityType, tableName);
} else if (commandlineArgs.length != 0) {
System.out.println("usage: ModelGenerator folder packageName entityType tableName");
} else {
ModelGeneratorDialog dialog = new ModelGeneratorDialog();
dialog.setModal(true);
dialog.pack();
dialog.setLocationRelativeTo(null);
dialog.setVisible(true);
}
return IApplication.EXIT_OK;
}

View File

@ -104,6 +104,8 @@ public class GridTabCSVExporter implements IGridTabExporter
if(DisplayType.Location == field.getDisplayType()){
specialHDispayType = DisplayType.Location;
continue;
} else if (! (field.isDisplayed() || field.isDisplayedGrid())) {
continue;
}
String headName = resolveColumnName(table, column);
headArray.add(headName);
@ -525,7 +527,10 @@ public class GridTabCSVExporter implements IGridTabExporter
int AD_Field_ID = Integer.parseInt(fieldIdStr);
for (GridField gridField : tmpFields)
{
if(gridField.isVirtualColumn() || gridField.isEncrypted() || gridField.isEncryptedColumn())
if ( gridField.isVirtualColumn()
|| gridField.isEncrypted()
|| gridField.isEncryptedColumn()
|| !(gridField.isDisplayed() || gridField.isDisplayedGrid()))
continue;
if (gridField.getAD_Field_ID() == AD_Field_ID)
@ -549,7 +554,10 @@ public class GridTabCSVExporter implements IGridTabExporter
continue;
if (DisplayType.Button == MColumn.get(Env.getCtx(),field.getAD_Column_ID()).getAD_Reference_ID())
continue;
if (field.isVirtualColumn() || field.isEncrypted() || field.isEncryptedColumn())
if ( field.isVirtualColumn()
|| field.isEncrypted()
|| field.isEncryptedColumn()
|| !(field.isDisplayed() || field.isDisplayedGrid()))
continue;
if (field.isParentValue() || (!field.isReadOnly() && field.isDisplayedGrid()))
gridFieldList.add(field);

View File

@ -810,9 +810,8 @@ public class GridTabCSVImporter implements IGridTabImporter
if (header.get(i).contains(MTable.getTableName(Env.getCtx(),MLocation.Table_ID)))
{
//without Region or Country any address would be invalid
//without Country any address would be invalid
boolean thereIsCountry = false ;
boolean thereIsRegion = false;
boolean isEmptyRow = true;
for(int j= i;j< header.size();j++){
if(!header.get(j).contains(MTable.getTableName(Env.getCtx(),MLocation.Table_ID)))
@ -826,8 +825,6 @@ public class GridTabCSVImporter implements IGridTabImporter
String columnName = header.get(j);
Object value = tmpRow.get(j);
if(value!=null){
if(columnName.contains("RegionName")||columnName.contains("C_Region_ID"))
thereIsRegion = true;
if(columnName.contains("C_Country_ID"))
thereIsCountry= true;
}else
@ -849,8 +846,8 @@ public class GridTabCSVImporter implements IGridTabImporter
isEmptyRow=false;
}
MColumn column = MColumn.get(Env.getCtx(), field.getAD_Column_ID());
if((field.isMandatory(true) || column.isMandatory()) && !isEmptyRow && (!thereIsRegion || !thereIsCountry))
return new StringBuilder(Msg.getMsg(Env.getCtx(), "FillMandatory")+" "+field.getColumnName()+"["+(thereIsRegion==true?"Region":"C_Country_ID")+"]");
if((field.isMandatory(true) || column.isMandatory()) && !isEmptyRow && !thereIsCountry)
return new StringBuilder(Msg.getMsg(Env.getCtx(), "FillMandatory")+" "+field.getColumnName()+"["+"C_Country_ID]");
}
return null;
}

View File

@ -901,7 +901,11 @@ public class ModelClassGenerator
.append("WHERE (TableName IN ('RV_WarehousePrice','RV_BPartner')") // special views
.append(" OR IsView='N')")
.append(" AND IsActive = 'Y' AND TableName NOT LIKE '%_Trl' ");
// Autodetect if we need to use IN or LIKE clause - teo_sarca [ 3020640 ]
if (tableLike.indexOf(",") == -1)
sql.append(" AND TableName LIKE ").append(tableLike);
else
sql.append(" AND TableName IN (").append(tableLike).append(")"); // only specific tables
sql.append(" AND ").append(entityTypeFilter.toString());
sql.append(" ORDER BY TableName");

View File

@ -823,7 +823,11 @@ public class ModelInterfaceGenerator
.append("WHERE (TableName IN ('RV_WarehousePrice','RV_BPartner')") // special views
.append(" OR IsView='N')")
.append(" AND IsActive = 'Y' AND TableName NOT LIKE '%_Trl' ");
// Autodetect if we need to use IN or LIKE clause - teo_sarca [ 3020640 ]
if (tableLike.indexOf(",") == -1)
sql.append(" AND TableName LIKE ").append(tableLike);
else
sql.append(" AND TableName IN (").append(tableLike).append(")"); // only specific tables
sql.append(" AND ").append(entityTypeFilter.toString());
sql.append(" ORDER BY TableName");

View File

@ -1402,7 +1402,7 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
if (!isDetail())
return true;
// Same link column value
String value = Env.getContext(m_vo.ctx, m_vo.WindowNo, getLinkColumnName());
String value = Env.getContext(m_vo.ctx, m_vo.WindowNo, this.getParentTabNo(), getLinkColumnName());
return m_linkValue.equals(value);
} // isCurrent

View File

@ -437,6 +437,20 @@ public class MAllocationHdr extends X_C_AllocationHdr implements DocAction
m_processMsg = "No Business Partner";
return DocAction.STATUS_Invalid;
}
// IDEMPIERE-1850 - validate date against related docs
if (line.getC_Invoice_ID() > 0) {
if (line.getC_Invoice().getDateAcct().after(getDateAcct())) {
m_processMsg = "Wrong allocation date";
return DocAction.STATUS_Invalid;
}
}
if (line.getC_Payment_ID() > 0) {
if (line.getC_Payment().getDateAcct().after(getDateAcct())) {
m_processMsg = "Wrong allocation date";
return DocAction.STATUS_Invalid;
}
}
}
setApprovalAmt(approval);
//

View File

@ -27,6 +27,7 @@ import org.compiere.util.DB;
import org.compiere.util.DisplayType;
import org.compiere.util.Env;
import org.compiere.util.Msg;
import org.compiere.util.Util;
/**
* Request Mail Template Model.
@ -39,7 +40,7 @@ public class MMailText extends X_R_MailText
/**
*
*/
private static final long serialVersionUID = -9121875595478208460L;
private static final long serialVersionUID = -3278575461023934790L;
/**
* Standard Constructor
@ -79,6 +80,7 @@ public class MMailText extends X_R_MailText
private String m_MailText3 = null;
/** Translation Cache */
private static CCache<String,MMailTextTrl> s_cacheTrl = new CCache<String,MMailTextTrl> (Table_Name, 20);
private String m_language = null;
/**
* Get parsed/translated Mail Text
@ -323,13 +325,19 @@ public class MMailText extends X_R_MailText
*/
private void translate()
{
if (m_bpartner != null && m_bpartner.getAD_Language() != null)
// Default if no Translation
m_MailHeader = super.getMailHeader();
m_MailText = super.getMailText();
m_MailText2 = super.getMailText2();
m_MailText3 = super.getMailText3();
if ((m_bpartner != null && m_bpartner.getAD_Language() != null) || !Util.isEmpty(m_language))
{
StringBuilder key = new StringBuilder().append(m_bpartner.getAD_Language()).append(get_ID());
String adLanguage = m_bpartner != null ? m_bpartner.getAD_Language() : m_language;
StringBuilder key = new StringBuilder().append(adLanguage).append(get_ID());
MMailTextTrl trl = s_cacheTrl.get(key.toString());
if (trl == null)
{
trl = getTranslation(m_bpartner.getAD_Language());
trl = getTranslation(adLanguage);
if (trl != null)
s_cacheTrl.put(key.toString(), trl);
}
@ -341,11 +349,6 @@ public class MMailText extends X_R_MailText
m_MailText3 = trl.MailText3;
}
}
// No Translation
m_MailHeader = super.getMailHeader();
m_MailText = super.getMailText();
m_MailText2 = super.getMailText2();
m_MailText3 = super.getMailText3();
} // translate
/**
@ -406,4 +409,9 @@ public class MMailText extends X_R_MailText
String MailText3 = null;
} // MMailTextTrl
public void setLanguage(String language)
{
m_language = language;
}
} // MMailText

View File

@ -27,6 +27,7 @@ import org.compiere.util.DB;
import org.compiere.util.DisplayType;
import org.compiere.util.Env;
import org.compiere.util.NamePair;
import org.compiere.util.Util;
import org.compiere.util.ValueNamePair;
/**
@ -35,24 +36,23 @@ import org.compiere.util.ValueNamePair;
*
*/
public class MPaymentLookup extends Lookup implements Serializable {
/**
*
*/
private static final long serialVersionUID = -6863672221350217533L;
private static final long serialVersionUID = 6505672741140583659L;
/** Context */
private Properties m_ctx;
/** IsSOTrx */
private boolean m_isSOTrx = false;
/** AD_Column_ID */
private int m_AD_Column_ID;
/** Validation Code */
private String m_validationCode;
public MPaymentLookup(Properties ctx, int windowNo, int columnID) {
public MPaymentLookup(Properties ctx, int windowNo, String validationCode) {
super(DisplayType.TableDir, windowNo);
m_ctx = ctx;
m_AD_Column_ID = columnID;
m_isSOTrx = "Y".equals(Env.getContext(Env.getCtx(), windowNo, "IsSOTrx"));
m_validationCode = validationCode;
}
@Override
@ -159,15 +159,9 @@ public class MPaymentLookup extends Lookup implements Serializable {
public String getValidation()
{
StringBuilder sb = new StringBuilder();
sb.append("SELECT vr.Code ");
sb.append("FROM AD_Column c");
sb.append(" LEFT OUTER JOIN AD_Val_Rule vr ON (c.AD_Val_Rule_ID=vr.AD_Val_Rule_ID) ");
sb.append("WHERE c.AD_Column_ID=?");
String validation = DB.getSQLValueString(null, sb.toString(), m_AD_Column_ID);
if (validation == null)
if (Util.isEmpty(m_validationCode, true))
return "";
return validation.trim();
return m_validationCode.trim();
}
private String getWhereClause()

View File

@ -25,6 +25,7 @@ import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Properties;
import java.util.UUID;
import java.util.logging.Level;
import org.adempiere.exceptions.AdempiereException;
@ -345,20 +346,20 @@ public final class MSetup
* Create User-Role
*/
// ClientUser - Admin & User
sql = "INSERT INTO AD_User_Roles(" + m_stdColumns + ",AD_User_ID,AD_Role_ID)"
+ " VALUES (" + m_stdValues + "," + AD_User_ID + "," + admin.getAD_Role_ID() + ")";
no = DB.executeUpdate(sql, m_trx.getTrxName());
sql = "INSERT INTO AD_User_Roles(" + m_stdColumns + ",AD_User_ID,AD_Role_ID,AD_User_Roles_UU)"
+ " VALUES (" + m_stdValues + "," + AD_User_ID + "," + admin.getAD_Role_ID() + "," + DB.TO_STRING(UUID.randomUUID().toString()) + ")";
no = DB.executeUpdateEx(sql, m_trx.getTrxName());
if (no != 1)
log.log(Level.SEVERE, "UserRole ClientUser+Admin NOT inserted");
sql = "INSERT INTO AD_User_Roles(" + m_stdColumns + ",AD_User_ID,AD_Role_ID)"
+ " VALUES (" + m_stdValues + "," + AD_User_ID + "," + user.getAD_Role_ID() + ")";
no = DB.executeUpdate(sql, m_trx.getTrxName());
sql = "INSERT INTO AD_User_Roles(" + m_stdColumns + ",AD_User_ID,AD_Role_ID,AD_User_Roles_UU)"
+ " VALUES (" + m_stdValues + "," + AD_User_ID + "," + user.getAD_Role_ID() + "," + DB.TO_STRING(UUID.randomUUID().toString()) + ")";
no = DB.executeUpdateEx(sql, m_trx.getTrxName());
if (no != 1)
log.log(Level.SEVERE, "UserRole ClientUser+User NOT inserted");
// OrgUser - User
sql = "INSERT INTO AD_User_Roles(" + m_stdColumns + ",AD_User_ID,AD_Role_ID)"
+ " VALUES (" + m_stdValues + "," + AD_User_U_ID + "," + user.getAD_Role_ID() + ")";
no = DB.executeUpdate(sql, m_trx.getTrxName());
sql = "INSERT INTO AD_User_Roles(" + m_stdColumns + ",AD_User_ID,AD_Role_ID,AD_User_Roles_UU)"
+ " VALUES (" + m_stdValues + "," + AD_User_U_ID + "," + user.getAD_Role_ID() + "," + DB.TO_STRING(UUID.randomUUID().toString()) + ")";
no = DB.executeUpdateEx(sql, m_trx.getTrxName());
if (no != 1)
log.log(Level.SEVERE, "UserRole OrgUser+Org NOT inserted");
@ -564,11 +565,11 @@ public final class MSetup
{
sqlCmd = new StringBuffer ("INSERT INTO C_AcctSchema_Element(");
sqlCmd.append(m_stdColumns).append(",C_AcctSchema_Element_ID,C_AcctSchema_ID,")
.append("ElementType,Name,SeqNo,IsMandatory,IsBalanced) VALUES (");
.append("ElementType,Name,SeqNo,IsMandatory,IsBalanced,C_AcctSchema_Element_UU) VALUES (");
sqlCmd.append(m_stdValues).append(",").append(C_AcctSchema_Element_ID).append(",").append(m_as.getC_AcctSchema_ID()).append(",")
.append("'").append(ElementType).append("','").append(name).append("',").append(SeqNo).append(",'")
.append(IsMandatory).append("','").append(IsBalanced).append("')");
no = DB.executeUpdate(sqlCmd.toString(), m_trx.getTrxName());
.append(IsMandatory).append("','").append(IsBalanced).append("',").append(DB.TO_STRING(UUID.randomUUID().toString())).append(")");
no = DB.executeUpdateEx(sqlCmd.toString(), m_trx.getTrxName());
if (no == 1)
m_info.append(Msg.translate(m_lang, "C_AcctSchema_Element_ID")).append("=").append(name).append("\n");
@ -577,7 +578,7 @@ public final class MSetup
{
sqlCmd = new StringBuffer ("UPDATE C_AcctSchema_Element SET Org_ID=");
sqlCmd.append(getAD_Org_ID()).append(" WHERE C_AcctSchema_Element_ID=").append(C_AcctSchema_Element_ID);
no = DB.executeUpdate(sqlCmd.toString(), m_trx.getTrxName());
no = DB.executeUpdateEx(sqlCmd.toString(), m_trx.getTrxName());
if (no != 1)
log.log(Level.SEVERE, "Default Org in AcctSchemaElement NOT updated");
}
@ -586,7 +587,7 @@ public final class MSetup
sqlCmd = new StringBuffer ("UPDATE C_AcctSchema_Element SET C_ElementValue_ID=");
sqlCmd.append(C_ElementValue_ID).append(", C_Element_ID=").append(C_Element_ID);
sqlCmd.append(" WHERE C_AcctSchema_Element_ID=").append(C_AcctSchema_Element_ID);
no = DB.executeUpdate(sqlCmd.toString(), m_trx.getTrxName());
no = DB.executeUpdateEx(sqlCmd.toString(), m_trx.getTrxName());
if (no != 1)
log.log(Level.SEVERE, "Default Account in AcctSchemaElement NOT updated");
}
@ -769,7 +770,7 @@ public final class MSetup
sqlCmd.append("C_AcctSchema1_ID=").append(m_as.getC_AcctSchema_ID())
.append(", C_Calendar_ID=").append(m_calendar.getC_Calendar_ID())
.append(" WHERE AD_Client_ID=").append(m_client.getAD_Client_ID());
no = DB.executeUpdate(sqlCmd.toString(), m_trx.getTrxName());
no = DB.executeUpdateEx(sqlCmd.toString(), m_trx.getTrxName());
if (no != 1)
{
String err = "ClientInfo not updated";
@ -986,19 +987,19 @@ public final class MSetup
int C_Channel_ID = getNextID(getAD_Client_ID(), "C_Channel");
sqlCmd = new StringBuffer("INSERT INTO C_Channel ");
sqlCmd.append("(C_Channel_ID,Name,");
sqlCmd.append(m_stdColumns).append(") VALUES (");
sqlCmd.append(m_stdColumns).append(",C_Channel_UU) VALUES (");
sqlCmd.append(C_Channel_ID).append(",").append(defaultEntry);
sqlCmd.append(m_stdValues).append(")");
no = DB.executeUpdate(sqlCmd.toString(), m_trx.getTrxName());
sqlCmd.append(m_stdValues).append(",").append(DB.TO_STRING(UUID.randomUUID().toString())).append(")");
no = DB.executeUpdateEx(sqlCmd.toString(), m_trx.getTrxName());
if (no != 1)
log.log(Level.SEVERE, "Channel NOT inserted");
int C_Campaign_ID = getNextID(getAD_Client_ID(), "C_Campaign");
sqlCmd = new StringBuffer("INSERT INTO C_Campaign ");
sqlCmd.append("(C_Campaign_ID,C_Channel_ID,").append(m_stdColumns).append(",");
sqlCmd.append(" Value,Name,Costs) VALUES (");
sqlCmd.append(" Value,Name,Costs,C_Campaign_UU) VALUES (");
sqlCmd.append(C_Campaign_ID).append(",").append(C_Channel_ID).append(",").append(m_stdValues).append(",");
sqlCmd.append(defaultEntry).append(defaultEntry).append("0)");
no = DB.executeUpdate(sqlCmd.toString(), m_trx.getTrxName());
sqlCmd.append(defaultEntry).append(defaultEntry).append("0").append(",").append(DB.TO_STRING(UUID.randomUUID().toString())).append(")");
no = DB.executeUpdateEx(sqlCmd.toString(), m_trx.getTrxName());
if (no == 1)
m_info.append(Msg.translate(m_lang, "C_Campaign_ID")).append("=").append(defaultName).append("\n");
else
@ -1010,7 +1011,7 @@ public final class MSetup
sqlCmd.append("C_Campaign_ID=").append(C_Campaign_ID);
sqlCmd.append(" WHERE C_AcctSchema_ID=").append(m_as.getC_AcctSchema_ID());
sqlCmd.append(" AND ElementType='MC'");
no = DB.executeUpdate(sqlCmd.toString(), m_trx.getTrxName());
no = DB.executeUpdateEx(sqlCmd.toString(), m_trx.getTrxName());
if (no != 1)
log.log(Level.SEVERE, "AcctSchema ELement Campaign NOT updated");
}
@ -1019,10 +1020,10 @@ public final class MSetup
int C_SalesRegion_ID = getNextID(getAD_Client_ID(), "C_SalesRegion");
sqlCmd = new StringBuffer ("INSERT INTO C_SalesRegion ");
sqlCmd.append("(C_SalesRegion_ID,").append(m_stdColumns).append(",");
sqlCmd.append(" Value,Name,IsSummary) VALUES (");
sqlCmd.append(" Value,Name,IsSummary,C_SalesRegion_UU) VALUES (");
sqlCmd.append(C_SalesRegion_ID).append(",").append(m_stdValues).append(", ");
sqlCmd.append(defaultEntry).append(defaultEntry).append("'N')");
no = DB.executeUpdate(sqlCmd.toString(), m_trx.getTrxName());
sqlCmd.append(defaultEntry).append(defaultEntry).append("'N'").append(",").append(DB.TO_STRING(UUID.randomUUID().toString())).append(")");
no = DB.executeUpdateEx(sqlCmd.toString(), m_trx.getTrxName());
if (no == 1)
m_info.append(Msg.translate(m_lang, "C_SalesRegion_ID")).append("=").append(defaultName).append("\n");
else
@ -1034,7 +1035,7 @@ public final class MSetup
sqlCmd.append("C_SalesRegion_ID=").append(C_SalesRegion_ID);
sqlCmd.append(" WHERE C_AcctSchema_ID=").append(m_as.getC_AcctSchema_ID());
sqlCmd.append(" AND ElementType='SR'");
no = DB.executeUpdate(sqlCmd.toString(), m_trx.getTrxName());
no = DB.executeUpdateEx(sqlCmd.toString(), m_trx.getTrxName());
if (no != 1)
log.log(Level.SEVERE, "AcctSchema ELement SalesRegion NOT updated");
}
@ -1073,7 +1074,7 @@ public final class MSetup
sqlCmd.append("C_BPartner_ID=").append(bp.getC_BPartner_ID());
sqlCmd.append(" WHERE C_AcctSchema_ID=").append(m_as.getC_AcctSchema_ID());
sqlCmd.append(" AND ElementType='BP'");
no = DB.executeUpdate(sqlCmd.toString(), m_trx.getTrxName());
no = DB.executeUpdateEx(sqlCmd.toString(), m_trx.getTrxName());
if (no != 1)
log.log(Level.SEVERE, "AcctSchema Element BPartner NOT updated");
createPreference("C_BPartner_ID", String.valueOf(bp.getC_BPartner_ID()), 143);
@ -1098,13 +1099,14 @@ public final class MSetup
int C_TaxCategory_ID = getNextID(getAD_Client_ID(), "C_TaxCategory");
sqlCmd = new StringBuffer ("INSERT INTO C_TaxCategory ");
sqlCmd.append("(C_TaxCategory_ID,").append(m_stdColumns).append(",");
sqlCmd.append(" Name,IsDefault) VALUES (");
sqlCmd.append(" Name,IsDefault,C_TaxCategory_UU) VALUES (");
sqlCmd.append(C_TaxCategory_ID).append(",").append(m_stdValues).append(", ");
if (C_Country_ID == COUNTRY_US) // US
sqlCmd.append("'Sales Tax','Y')");
sqlCmd.append("'Sales Tax','Y',");
else
sqlCmd.append(defaultEntry).append("'Y')");
no = DB.executeUpdate(sqlCmd.toString(), m_trx.getTrxName());
sqlCmd.append(defaultEntry).append("'Y',");
sqlCmd.append(DB.TO_STRING(UUID.randomUUID().toString())).append(")");
no = DB.executeUpdateEx(sqlCmd.toString(), m_trx.getTrxName());
if (no != 1)
log.log(Level.SEVERE, "TaxCategory NOT inserted");
@ -1112,7 +1114,7 @@ public final class MSetup
sqlCmd.append(" SELECT l.AD_Language,t.C_TaxCategory_ID, t.Description,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, C_TaxCategory t");
sqlCmd.append(" WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.C_TaxCategory_ID=").append(C_TaxCategory_ID);
sqlCmd.append(" AND NOT EXISTS (SELECT * FROM C_TaxCategory_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.C_TaxCategory_ID=t.C_TaxCategory_ID)");
no = DB.executeUpdate(sqlCmd.toString(), m_trx.getTrxName());
no = DB.executeUpdateEx(sqlCmd.toString(), m_trx.getTrxName());
if (no < 0)
log.log(Level.SEVERE, "TaxCategory Translation NOT inserted");
@ -1141,7 +1143,7 @@ public final class MSetup
sqlCmd.append("M_Product_ID=").append(product.getM_Product_ID());
sqlCmd.append(" WHERE C_AcctSchema_ID=").append(m_as.getC_AcctSchema_ID());
sqlCmd.append(" AND ElementType='PR'");
no = DB.executeUpdate(sqlCmd.toString(), m_trx.getTrxName());
no = DB.executeUpdateEx(sqlCmd.toString(), m_trx.getTrxName());
if (no != 1)
log.log(Level.SEVERE, "AcctSchema Element Product NOT updated");
@ -1155,7 +1157,7 @@ public final class MSetup
loc.saveEx();
sqlCmd = new StringBuffer ("UPDATE AD_OrgInfo SET C_Location_ID=");
sqlCmd.append(loc.getC_Location_ID()).append(" WHERE AD_Org_ID=").append(getAD_Org_ID());
no = DB.executeUpdate(sqlCmd.toString(), m_trx.getTrxName());
no = DB.executeUpdateEx(sqlCmd.toString(), m_trx.getTrxName());
if (no != 1)
log.log(Level.SEVERE, "Location NOT inserted");
createPreference("C_Country_ID", String.valueOf(C_Country_ID), 0);
@ -1187,7 +1189,7 @@ public final class MSetup
// sqlCmd.append(",C_UOM_Length_ID=");
// sqlCmd.append(",C_UOM_Time_ID=");
sqlCmd.append(" WHERE AD_Client_ID=").append(getAD_Client_ID());
no = DB.executeUpdate(sqlCmd.toString(), m_trx.getTrxName());
no = DB.executeUpdateEx(sqlCmd.toString(), m_trx.getTrxName());
if (no != 1)
{
String err = "ClientInfo not updated";
@ -1246,7 +1248,7 @@ public final class MSetup
// Update User
sqlCmd = new StringBuffer ("UPDATE AD_User SET C_BPartner_ID=");
sqlCmd.append(bpCU.getC_BPartner_ID()).append(" WHERE AD_User_ID=").append(AD_User_U_ID);
no = DB.executeUpdate(sqlCmd.toString(), m_trx.getTrxName());
no = DB.executeUpdateEx(sqlCmd.toString(), m_trx.getTrxName());
if (no != 1)
log.log(Level.SEVERE, "User of SalesRep (User) NOT updated");
@ -1272,7 +1274,7 @@ public final class MSetup
// Update User
sqlCmd = new StringBuffer ("UPDATE AD_User SET C_BPartner_ID=");
sqlCmd.append(bpCA.getC_BPartner_ID()).append(" WHERE AD_User_ID=").append(AD_User_ID);
no = DB.executeUpdate(sqlCmd.toString(), m_trx.getTrxName());
no = DB.executeUpdateEx(sqlCmd.toString(), m_trx.getTrxName());
if (no != 1)
log.log(Level.SEVERE, "User of SalesRep (Admin) NOT updated");
@ -1281,10 +1283,10 @@ public final class MSetup
int C_PaymentTerm_ID = getNextID(getAD_Client_ID(), "C_PaymentTerm");
sqlCmd = new StringBuffer ("INSERT INTO C_PaymentTerm ");
sqlCmd.append("(C_PaymentTerm_ID,").append(m_stdColumns).append(",");
sqlCmd.append("Value,Name,NetDays,GraceDays,DiscountDays,Discount,DiscountDays2,Discount2,IsDefault) VALUES (");
sqlCmd.append("Value,Name,NetDays,GraceDays,DiscountDays,Discount,DiscountDays2,Discount2,IsDefault,C_PaymentTerm_UU) VALUES (");
sqlCmd.append(C_PaymentTerm_ID).append(",").append(m_stdValues).append(",");
sqlCmd.append("'Immediate','Immediate',0,0,0,0,0,0,'Y')");
no = DB.executeUpdate(sqlCmd.toString(), m_trx.getTrxName());
sqlCmd.append("'Immediate','Immediate',0,0,0,0,0,0,'Y'").append(",").append(DB.TO_STRING(UUID.randomUUID().toString())).append(")");
no = DB.executeUpdateEx(sqlCmd.toString(), m_trx.getTrxName());
if (no != 1)
log.log(Level.SEVERE, "PaymentTerm NOT inserted");
@ -1292,10 +1294,10 @@ public final class MSetup
C_Cycle_ID = getNextID(getAD_Client_ID(), "C_Cycle");
sqlCmd = new StringBuffer ("INSERT INTO C_Cycle ");
sqlCmd.append("(C_Cycle_ID,").append(m_stdColumns).append(",");
sqlCmd.append(" Name,C_Currency_ID) VALUES (");
sqlCmd.append(" Name,C_Currency_ID,C_Cycle_UU) VALUES (");
sqlCmd.append(C_Cycle_ID).append(",").append(m_stdValues).append(", ");
sqlCmd.append(defaultEntry).append(C_Currency_ID).append(")");
no = DB.executeUpdate(sqlCmd.toString(), m_trx.getTrxName());
sqlCmd.append(defaultEntry).append(C_Currency_ID).append(",").append(DB.TO_STRING(UUID.randomUUID().toString())).append(")");
no = DB.executeUpdateEx(sqlCmd.toString(), m_trx.getTrxName());
if (no != 1)
log.log(Level.SEVERE, "Cycle NOT inserted");
@ -1307,10 +1309,10 @@ public final class MSetup
int C_Project_ID = getNextID(getAD_Client_ID(), "C_Project");
sqlCmd = new StringBuffer ("INSERT INTO C_Project ");
sqlCmd.append("(C_Project_ID,").append(m_stdColumns).append(",");
sqlCmd.append(" Value,Name,C_Currency_ID,IsSummary) VALUES (");
sqlCmd.append(" Value,Name,C_Currency_ID,IsSummary,C_Project_UU) VALUES (");
sqlCmd.append(C_Project_ID).append(",").append(m_stdValuesOrg).append(", ");
sqlCmd.append(defaultEntry).append(defaultEntry).append(C_Currency_ID).append(",'N')");
no = DB.executeUpdate(sqlCmd.toString(), m_trx.getTrxName());
sqlCmd.append(defaultEntry).append(defaultEntry).append(C_Currency_ID).append(",'N'").append(",").append(DB.TO_STRING(UUID.randomUUID().toString())).append(")");
no = DB.executeUpdateEx(sqlCmd.toString(), m_trx.getTrxName());
if (no == 1)
m_info.append(Msg.translate(m_lang, "C_Project_ID")).append("=").append(defaultName).append("\n");
else
@ -1322,7 +1324,7 @@ public final class MSetup
sqlCmd.append("C_Project_ID=").append(C_Project_ID);
sqlCmd.append(" WHERE C_AcctSchema_ID=").append(m_as.getC_AcctSchema_ID());
sqlCmd.append(" AND ElementType='PJ'");
no = DB.executeUpdate(sqlCmd.toString(), m_trx.getTrxName());
no = DB.executeUpdateEx(sqlCmd.toString(), m_trx.getTrxName());
if (no != 1)
log.log(Level.SEVERE, "AcctSchema ELement Project NOT updated");
}
@ -1352,15 +1354,15 @@ public final class MSetup
{
int AD_Preference_ID = getNextID(getAD_Client_ID(), "AD_Preference");
StringBuilder sqlCmd = new StringBuilder ("INSERT INTO AD_Preference ");
sqlCmd.append("(AD_Preference_ID,").append(m_stdColumns).append(",");
sqlCmd.append("(AD_Preference_ID,").append("AD_Preference_UU,").append(m_stdColumns).append(",");
sqlCmd.append("Attribute,Value,AD_Window_ID) VALUES (");
sqlCmd.append(AD_Preference_ID).append(",").append(m_stdValues).append(",");
sqlCmd.append(AD_Preference_ID).append(",").append(DB.TO_STRING(UUID.randomUUID().toString())).append(",").append(m_stdValues).append(",");
sqlCmd.append("'").append(Attribute).append("','").append(Value).append("',");
if (AD_Window_ID == 0)
sqlCmd.append("NULL)");
else
sqlCmd.append(AD_Window_ID).append(")");
int no = DB.executeUpdate(sqlCmd.toString(), m_trx.getTrxName());
int no = DB.executeUpdateEx(sqlCmd.toString(), m_trx.getTrxName());
if (no != 1)
log.log(Level.SEVERE, "Preference NOT inserted - " + Attribute);
} // createPreference

View File

@ -51,6 +51,7 @@ import org.adempiere.exceptions.DBException;
import org.adempiere.process.UUIDGenerator;
import org.compiere.Adempiere;
import org.compiere.acct.Doc;
import org.compiere.util.CCache;
import org.compiere.util.CLogMgt;
import org.compiere.util.CLogger;
import org.compiere.util.CacheMgt;
@ -1876,6 +1877,9 @@ public abstract class PO
set_ValueNoCheck ("UpdatedBy", new Integer(AD_User_ID));
} // setAD_User_ID
/** Cache */
private static CCache<String,String> trl_cache = new CCache<String,String>("po_trl", 5);
/**
* Get Translation of column (if needed).
* It checks if the base language is used or the column is not translated.
@ -1899,7 +1903,13 @@ public abstract class PO
+ ", ID=" + m_IDs[0]);
}
String key = get_TableName() + "." + columnName + "|" + get_ID() + "|" + AD_Language;
String retValue = null;
if (trl_cache.containsKey(key)) {
retValue = trl_cache.get(key);
return retValue;
} else {
//
// Check if NOT base language and column is translated => load trl from db
if (!Env.isBaseLanguage(AD_Language, get_TableName())
@ -1914,12 +1924,14 @@ public abstract class PO
.append(" AND AD_Language=?");
retValue = DB.getSQLValueString(get_TrxName(), sql.toString(), ID, AD_Language);
}
}
//
// If no translation found or not translated, fallback to original:
if (retValue == null) {
Object val = get_Value(columnName);
retValue = (val != null ? val.toString() : null);
}
trl_cache.put(key, retValue);
//
return retValue;
} // get_Translation

View File

@ -625,9 +625,6 @@ public class MPrintFormatItem extends X_AD_PrintFormatItem
*/
protected boolean beforeSave (boolean newRecord)
{
if (!isPrinted()) {
setIsOrderBy(false);
}
// Order
if (!isOrderBy())
{

View File

@ -78,7 +78,6 @@ public class BroadcastMsgUtil
if (! user.isActive())
continue;
MNote note = new MNote(Env.getCtx(), 0, trxName);
if (MBroadcastMessage.TARGET_Everybody.equals(mbMessage.getTarget()))
note.setClientOrg(user.getAD_Client_ID(), 0);
note.setAD_BroadcastMessage_ID(messageID);
note.setAD_User_ID(userID);

View File

@ -190,12 +190,13 @@ public class WindowElementHandler extends AbstractElementHandler {
}
// Preference Tag
sql = "SELECT AD_Preference_ID FROM AD_PREFERENCE WHERE AD_WINDOW_ID = ?";
sql = "SELECT AD_Preference_ID FROM AD_PREFERENCE WHERE AD_WINDOW_ID = ? AND AD_CLIENT_ID = ?";
pstmt = null;
rs = null;
try {
pstmt = DB.prepareStatement(sql, getTrxName(ctx));
pstmt.setInt(1, AD_Window_ID);
pstmt.setInt(2, Env.getAD_Client_ID(ctx.ctx));
rs = pstmt.executeQuery();
while (rs.next()) {
createPreference(ctx, document, rs.getInt("AD_Preference_ID"));

View File

@ -195,7 +195,6 @@
58600,"Rate Variance","Account for Rate Variance","Expense",,"Yes","No","",58,,,,,,,,,,
58700,"Mix Variance","Account for Mix Variance","Expense",,"Yes","No","",58,,,,,,,,,,
58800,"Average Cost Variance","Account for Average Cost Variance","Expense",,"Yes","No","P_AVERAGECOSTVARIANCE_ACCT",58,,,,,,,,,,
58900,"Landed Cost Clearing","Account for Landed Cost Clearing","Expense",,"Yes","No","P_LANDEDCOSTCLEARING_ACCT",58,,,,,,,,,,
59,"CoGs Discounts",,"Expense",,,"Yes",,5,,,,,59,"CoGS Discounts",2,,,
59100,"Trade discounts received","Received Trade Discounts (corrects Product expense)","Expense",,"Yes","No","P_TRADEDISCOUNTREC_ACCT",59,,,,,,,,,,
59200,"Payment discount revenue","Granted early payment discount from vendors","Expense",,"Yes","No","PAYDISCOUNT_REV_ACCT",59,,,,,,,,,,

1 [Account_Value] [Account_Name] [Account_Description] [Account_Type] [Account_Sign] [Account_Document] [Account_Summary] [Default_Account] [Account_Parent] [Balance Sheet] [Balance Sheet_Name] [US 1120 Balance Sheet] US 1120 Balance Sheet_Name [Profit & Loss] [Profit & Loss_Name] [US 1120 Income Statement] [US 1120 Income Statement_Name] [Cash Flow] [Cash Flow_Name]
195 58600 Rate Variance Account for Rate Variance Expense Yes No 58
196 58700 Mix Variance Account for Mix Variance Expense Yes No 58
197 58800 Average Cost Variance Account for Average Cost Variance Expense Yes No P_AVERAGECOSTVARIANCE_ACCT 58
58900 Landed Cost Clearing Account for Landed Cost Clearing Expense Yes No P_LANDEDCOSTCLEARING_ACCT 58
198 59 CoGs Discounts Expense Yes 5 59 CoGS Discounts 2
199 59100 Trade discounts received Received Trade Discounts (corrects Product expense) Expense Yes No P_TRADEDISCOUNTREC_ACCT 59
200 59200 Payment discount revenue Granted early payment discount from vendors Expense Yes No PAYDISCOUNT_REV_ACCT 59

View File

@ -10,7 +10,7 @@ echo Export idempiere Database - $IDEMPIERE_HOME \($ADEMPIERE_DB_NAME\)
# Parameter: <adempiereDBuser>/<adempiereDBpassword>
sh $ADEMPIERE_DB_PATH/DBExport.sh $ADEMPIERE_DB_USER $ADEMPIERE_DB_PASSWORD
sh $ADEMPIERE_DB_PATH/DBExport.sh "$ADEMPIERE_DB_USER" "$ADEMPIERE_DB_PASSWORD"
# sh $ADEMPIERE_DB_PATH/DBExportFull.sh system/$ADEMPIERE_DB_SYSTEM

View File

@ -16,4 +16,4 @@ read in
# Parameter: <systemAccount> <adempiereID> <adempierePwd>
# globalqss - cruiz - 2007-10-09 - added fourth parameter for postgres(ignored in oracle)
$ADEMPIERE_DB_PATH/DBRestore.sh system/$ADEMPIERE_DB_SYSTEM $ADEMPIERE_DB_USER $ADEMPIERE_DB_PASSWORD $ADEMPIERE_DB_SYSTEM
$ADEMPIERE_DB_PATH/DBRestore.sh "system/$ADEMPIERE_DB_SYSTEM" "$ADEMPIERE_DB_USER" "$ADEMPIERE_DB_PASSWORD" "$ADEMPIERE_DB_SYSTEM"

View File

@ -38,4 +38,4 @@ read in
# Parameter: <systemAccount> <AdempiereID> <AdempierePwd>
# globalqss - cruiz - 2007-10-09 - added fourth parameter for postgres(ignored in oracle)
$ADEMPIERE_DB_PATH/ImportIdempiere.sh $SYSUSER/$ADEMPIERE_DB_SYSTEM $ADEMPIERE_DB_USER $ADEMPIERE_DB_PASSWORD $ADEMPIERE_DB_SYSTEM $SUFFIX
$ADEMPIERE_DB_PATH/ImportIdempiere.sh "$SYSUSER/$ADEMPIERE_DB_SYSTEM" "$ADEMPIERE_DB_USER" "$ADEMPIERE_DB_PASSWORD" "$ADEMPIERE_DB_SYSTEM" "$SUFFIX"

View File

@ -18,7 +18,7 @@
# initialization
# adjust these variables to your environment
IDEMPIERE_HOME=/home/idempiere/idempiere-server
IDEMPIERE_HOME=/opt/idempiere-server
IDEMPIEREUSER=idempiere
# Instead of using ENVFILE you can set JAVA_HOME, IDEMPIERE_HOME and add JAVA_HOME/bin to PATH
# in this case you can comment the source lines for ENVFILE below
@ -141,9 +141,6 @@ case "$1" in
stop)
stop
;;
reload)
restart
;;
restart)
restart
;;
@ -154,7 +151,7 @@ case "$1" in
status
;;
*)
echo $"Usage: $0 {start|stop|reload|restart|condrestart|status}"
echo $"Usage: $0 {start|stop|restart|condrestart|status}"
exit 1
esac

View File

@ -17,7 +17,7 @@
# initialization
# adjust these variables to your environment
IDEMPIERE_HOME=/home/idempiere/idempiere-server
IDEMPIERE_HOME=/opt/idempiere-server
ENVFILE=$IDEMPIERE_HOME/utils/myEnvironment.sh
IDEMPIEREUSER=idempiere
@ -136,9 +136,6 @@ case "$1" in
stop)
stop
;;
reload)
restart
;;
restart)
restart
;;
@ -149,7 +146,7 @@ case "$1" in
status
;;
*)
echo $"Usage: $0 {start|stop|reload|restart|condrestart|status}"
echo $"Usage: $0 {start|stop|restart|condrestart|status}"
exit 1
esac

View File

@ -0,0 +1,196 @@
#!/bin/sh
# Copyright (c) 2014 Carlos Ruiz - GlobalQSS
# All rights reserved.
#
# System startup script for iDempiere
#
# LSB compatible service control script; see http://www.linuxbase.org/spec/
#
### BEGIN INIT INFO
# Provides: idempiere
# Required-Start:
# Required-Stop:
# Default-Start: 3 5
# Default-Stop:
# Description: Start the iDempiere server
### END INIT INFO
# initialization
# adjust these variables to your environment
IDEMPIERE_HOME=/opt/idempiere-server
IDEMPIEREUSER=idempiere
# Instead of using ENVFILE you can set JAVA_HOME, IDEMPIERE_HOME and add JAVA_HOME/bin to PATH
# in this case you can comment the source lines for ENVFILE below
# detected some problems with Hardy Heron ubuntu using the bash source command
ENVFILE=$IDEMPIERE_HOME/utils/myEnvironment.sh
# Shell functions sourced from /etc/rc.status:
# rc_check check and set local and overall rc status
# rc_status check and set local and overall rc status
# rc_status -v ditto but be verbose in local rc status
# rc_status -v -r ditto and clear the local rc status
# rc_failed set local and overall rc status to failed
# rc_reset clear local rc status (overall remains)
# rc_exit exit appropriate to overall rc status
. /etc/rc.status
# The echo return value for success (defined in /etc/rc.config).
rc_reset
# Return values acc. to LSB for all commands but status:
# 0 - success
# 1 - generic or unspecified error
# 2 - invalid or excess argument(s)
# 3 - unimplemented feature (e.g. "reload")
# 4 - insufficient privilege
# 5 - program is not installed
# 6 - program is not configured
# 7 - program is not running
#
# Note that starting an already running service, stopping
# or restarting a not-running service as well as the restart
# with force-reload (in case signalling is not supported) are
# considered a success.
#
IDEMPIERESTATUS=
MAXITERATIONS=60
getidempierestatus() {
IDEMPIERESTATUSSTRING=$(ps ax | grep -v grep | grep $IDEMPIERE_HOME)
echo $IDEMPIERESTATUSSTRING | grep -q $IDEMPIERE_HOME
IDEMPIERESTATUS=$?
}
start () {
getidempierestatus
if [ $IDEMPIERESTATUS -eq 0 ] ; then
echo "iDempiere is already running"
rc_failed 0
return
fi
echo -n "Starting iDempiere ERP: "
cd $IDEMPIERE_HOME/utils
. $ENVFILE
export LOGFILE=$IDEMPIERE_HOME/log/idempiere_`date +%Y%m%d%H%M%S`.log
su $IDEMPIEREUSER -c "mkdir -p IDEMPIERE_HOME/log"
su $IDEMPIEREUSER -c "cd $IDEMPIERE_HOME;$IDEMPIERE_HOME/idempiere-server.sh &> $LOGFILE &"
RETVAL=$?
if [ $RETVAL -eq 0 ] ; then
# wait for server to be confirmed as started in logfile
STATUSTEST=0
ITERATIONS=0
while [ $STATUSTEST -eq 0 ] ; do
sleep 2
tail -n 9 $LOGFILE | grep -q '.*WebUIServlet.*started successfully.*' && STATUSTEST=1
echo -n "."
ITERATIONS=`expr $ITERATIONS + 1`
if [ $ITERATIONS -gt $MAXITERATIONS ]
then
break
fi
done
if [ $STATUSTEST -eq 0 ]
then
echo "Service hasn't started within the timeout allowed, please review file $LOGFILE to see the status of the service"
rc_failed 1
else
echo "Service started"
fi
echo
else
echo "Service not started"
rc_failed 1
fi
rc_status -v
}
stop () {
getidempierestatus
if [ $IDEMPIERESTATUS -ne 0 ] ; then
echo "iDempiere is already stopped"
rc_failed 0
return
fi
echo -n "Stopping iDempiere ERP: "
cd $IDEMPIERE_HOME/utils
. $ENVFILE
echo "Trying direct kill with signal -15"
# try direct kill with signal 15, then signal 9
kill -15 -`ps ax o pgid,command | grep -v grep | grep $IDEMPIERE_HOME | sed -e 's/^ *//g' | cut -f 1 -d " " | sort -u`
sleep 5
getidempierestatus
if [ $IDEMPIERESTATUS -ne 0 ] ; then
echo "Service stopped with kill -15"
else
echo "Trying direct kill with signal -9"
kill -9 -`ps ax o pgid,command | grep -v grep | grep $IDEMPIERE_HOME | sed -e 's/^ *//g' | cut -f 1 -d " " | sort -u`
sleep 5
getidempierestatus
if [ $IDEMPIERESTATUS -ne 0 ] ; then
echo "Service stopped with kill -9"
else
echo "Service hasn't stopped"
rc_failed 1
fi
fi
rc_status -v
}
restart () {
stop
sleep 1
start
rc_status
}
condrestart () {
getidempierestatus
if [ $IDEMPIERESTATUS -eq 0 ] ; then
restart
else
rc_reset # Not running is not a failure.
fi
rc_status
}
status () {
getidempierestatus
if [ $IDEMPIERESTATUS -eq 0 ] ; then
echo
echo "iDempiere is running:"
ps ax | grep -v grep | grep $IDEMPIERE_HOME | sed 's/^[[:space:]]*\([[:digit:]]*\).*:[[:digit:]][[:digit:]][[:space:]]\(.*\)/\1 \2/'
echo
else
echo "iDempiere is stopped"
rc_failed 3
fi
rc_status -v
}
case "$1" in
start)
start
;;
stop)
stop
;;
reload)
restart
;;
restart)
restart
;;
condrestart)
condrestart
;;
status)
status
;;
*)
echo $"Usage: $0 {start|stop|reload|restart|condrestart|status}"
exit 1
esac
# Inform the caller not only verbosely and set an exit status.
rc_exit

View File

@ -28,11 +28,11 @@ import org.jfree.data.time.TimeSeriesCollection;
import org.jfree.data.time.TimeSeriesDataItem;
public class VChart extends CPanel implements ChartMouseListener, VEditor {
/**
*
*/
private static final long serialVersionUID = 1L;
private static final long serialVersionUID = 4089566607789995074L;
ChartPanel chartPanel;
MChart chartModel;
private ChartBuilder chartBuilder;
@ -80,7 +80,7 @@ public class VChart extends CPanel implements ChartMouseListener, VEditor {
public void dispose() {}
@Override
public String getName() {return chartModel.getName();}
public String getName() {return chartModel.get_Translation(MChart.COLUMNNAME_Name);}
@Override
public void removeVetoableChangeListener(VetoableChangeListener listener) {}

View File

@ -25,6 +25,7 @@ import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Properties;
import java.util.UUID;
import java.util.logging.Level;
import javax.swing.BorderFactory;
@ -494,9 +495,9 @@ public class ValuePreference extends CDialog
int AD_Preference_ID = DB.getNextID(m_ctx, "AD_Preference", null);
//
StringBuilder sql = new StringBuilder ("INSERT INTO AD_Preference ("
+ "AD_Preference_ID, AD_Client_ID, AD_Org_ID, IsActive, Created,CreatedBy,Updated,UpdatedBy,"
+ "AD_Preference_ID, AD_Preference_UU, AD_Client_ID, AD_Org_ID, IsActive, Created,CreatedBy,Updated,UpdatedBy,"
+ "AD_Window_ID, AD_User_ID, Attribute, Value) VALUES (");
sql.append(AD_Preference_ID).append(",").append(Client_ID).append(",").append(Org_ID)
sql.append(AD_Preference_ID).append(",").append(DB.TO_STRING(UUID.randomUUID().toString())).append(",").append(Client_ID).append(",").append(Org_ID)
.append(", 'Y',SysDate,").append(m_AD_User_ID).append(",SysDate,").append(m_AD_User_ID).append(", ");
if (cbWindow.isSelected())
sql.append(m_AD_Window_ID).append(",");

View File

@ -17,6 +17,7 @@
package org.adempiere.webui;
import java.util.Properties;
import java.util.UUID;
import java.util.logging.Level;
import org.adempiere.webui.adwindow.ADWindow;
@ -65,7 +66,7 @@ public class ValuePreference extends Window implements EventListener<Event>
/**
*
*/
private static final long serialVersionUID = -8490929927886340040L;
private static final long serialVersionUID = 471820722501563271L;
/**
* Factory
@ -533,9 +534,9 @@ public class ValuePreference extends Window implements EventListener<Event>
int AD_Preference_ID = DB.getNextID(m_ctx, "AD_Preference", null);
//
StringBuilder sql = new StringBuilder ("INSERT INTO AD_Preference ("
+ "AD_Preference_ID, AD_Client_ID, AD_Org_ID, IsActive, Created,CreatedBy,Updated,UpdatedBy,"
+ "AD_Preference_ID, AD_Preference_UU, AD_Client_ID, AD_Org_ID, IsActive, Created,CreatedBy,Updated,UpdatedBy,"
+ "AD_Window_ID, AD_User_ID, Attribute, Value) VALUES (");
sql.append(AD_Preference_ID).append(",").append(Client_ID).append(",").append(Org_ID)
sql.append(AD_Preference_ID).append(",").append(DB.TO_STRING(UUID.randomUUID().toString())).append(",").append(Client_ID).append(",").append(Org_ID)
.append(", 'Y',SysDate,").append(m_AD_User_ID).append(",SysDate,").append(m_AD_User_ID).append(", ");
if (cbWindow.isChecked())
sql.append(m_AD_Window_ID).append(",");

View File

@ -505,7 +505,9 @@ public class ProcessModalDialog extends Window implements EventListener<Event>,
if (log.isLoggable(Level.INFO))log.log(Level.INFO, "Process Info="+m_pi+" AD_Client_ID="+Env.getAD_Client_ID(Env.getCtx()));
WProcessCtl.process(ProcessModalDialog.this, m_WindowNo, parameterPanel, m_pi, null);
} catch (Exception ex) {
FDialog.error(m_WindowNo, ex.getLocalizedMessage());
m_pi.setError(true);
m_pi.setSummary(ex.getLocalizedMessage());
log.log(Level.SEVERE, ex.getLocalizedMessage(), ex);
} finally {
Executions.schedule(getDesktop(), ProcessModalDialog.this, new Event(ON_COMPLETE, ProcessModalDialog.this, null));
}

View File

@ -83,7 +83,7 @@ public class WChartEditor extends WEditor
@Override
public String getDisplay()
{
return chartModel.getName();
return chartModel.get_Translation(MChart.COLUMNNAME_Name);
}
@Override

View File

@ -52,11 +52,11 @@ import org.zkoss.zul.South;
*
*/
public class BroadcastMessageWindow extends Window implements IBroadcastMsgPopup,EventListener<Event>{
/**
*
*/
private static final long serialVersionUID = 5990080817061314383L;
private static final long serialVersionUID = 1849434312706721390L;
private static CLogger log = CLogger.getCLogger(BroadcastMessageWindow.class);
public static final int PRESSED_PREV = 1;
public static final int PRESSED_NEXT = 2;
@ -112,7 +112,7 @@ public class BroadcastMessageWindow extends Window implements IBroadcastMsgPopup
Div htmlDiv = new Div();
//textMsgContent = new Label();
htmlDiv.appendChild(textMsgContent);
textMsgContent.setContent(mbMessages.get(0).getBroadcastMessage());
textMsgContent.setContent(mbMessages.get(0).get_Translation(MBroadcastMessage.COLUMNNAME_BroadcastMessage));
htmlDiv.setFocus(true);
htmlDiv.setStyle("display: table-cell; vertical-align: middle; text-align: center;");
Div divAlign = new Div();
@ -292,7 +292,7 @@ public class BroadcastMessageWindow extends Window implements IBroadcastMsgPopup
}
textMsgNo.setValue((currMsg+1)+"/"+noOfMsgs);
textMsgContent.setContent(mbMessage.getBroadcastMessage());
textMsgContent.setContent(mbMessage.get_Translation(MBroadcastMessage.COLUMNNAME_BroadcastMessage));
if (!isTest && mbMessage.isLogAcknowledge()) {
boolean ack = hashMessages.get(mbMessage.get_ID());

View File

@ -190,6 +190,8 @@ public class LoginPanel extends Window implements EventListener<Event>
});
// Make the default language the language of client System
// TODO: possible improvement to check if the first default browser language is supported and default to it
// Executions.getCurrent().getHeader("accept-language");
String defaultLanguage = MClient.get(ctx, 0).getAD_Language();
for(int i = 0; i < lstLanguage.getItemCount(); i++)
{
@ -414,6 +416,7 @@ public class LoginPanel extends Window implements EventListener<Event>
{
btnResetPasswordClicked();
}
/* code below commented per security issue IDEMPIERE-1797 reported
// Elaine 2009/02/06 - initial language
else if (event.getName().equals(Events.ON_CHANGE))
{
@ -422,6 +425,7 @@ public class LoginPanel extends Window implements EventListener<Event>
onUserIdChange(-1);
}
}
*/
else if (event.getName().equals(ON_LOAD_TOKEN))
{
BrowserToken.load(txtUserId);

View File

@ -506,6 +506,7 @@ public class ResetPasswordPanel extends Window implements EventListener<Event>
return false;
MMailText mailText = new MMailText(m_ctx, R_MailText_ID, null);
mailText.setLanguage(Env.getContext(m_ctx, "#AD_Language"));
to.set_ValueOfColumn("Password", newPassword); // will be hashed and validate on saveEx
mailText.setUser(to);
String message = mailText.getMailText(true);

View File

@ -55,8 +55,8 @@ public class FactReconcile {
Vector<String> columnNames = new Vector<String>();
columnNames.add(Msg.translate(Env.getCtx(), "Amt"));
//columnNames.add(Msg.translate(Env.getCtx(), "AmtAcct"));
columnNames.add("DR/CR");
columnNames.add("Fact Acct");
columnNames.add(Msg.translate(Env.getCtx(), "DR/CR"));
columnNames.add(Msg.translate(Env.getCtx(), "Selected"));
columnNames.add(Msg.translate(Env.getCtx(), "C_BPartner_ID"));
columnNames.add(Msg.translate(Env.getCtx(), "DateAcct"));
columnNames.add(Msg.translate(Env.getCtx(), "GL_Category_ID"));
@ -74,16 +74,20 @@ public class FactReconcile {
Vector<Vector<Object>> data = new Vector<Vector<Object>>();
StringBuilder sql = new StringBuilder("SELECT abs(fa.amtacctdr-fa.amtacctcr), (fa.amtacctdr-fa.amtacctcr)," // 1-2
+ " (CASE WHEN (fa.amtacctdr-fa.amtacctcr) < 0 THEN 'CR' ELSE 'DR' END), fa.Fact_Acct_ID, bp.name, DateAcct,"
+ " glc.name, p.name, Qty, fa.Description, r.MatchCode, fa.DateTrx, o.value"
+ " FROM Fact_Acct fa"
+ " LEFT OUTER JOIN Fact_Reconciliation r ON (fa.Fact_Acct_ID=r.Fact_Acct_ID)"
+ " LEFT OUTER JOIN C_BPartner bp ON (fa.C_BPartner_ID=bp.C_BPartner_ID)"
+ " LEFT OUTER JOIN AD_Org o ON (o.AD_Org_ID=fa.AD_Org_ID)"
+ " LEFT OUTER JOIN M_Product p ON (p.M_Product_ID=fa.M_Product_ID)"
+ " LEFT OUTER JOIN GL_Category glc ON (fa.GL_Category_ID=glc.GL_Category_ID)"
+ " WHERE fa.AD_Client_ID=?");
StringBuilder sql = new StringBuilder("SELECT abs(fa.amtacctdr-fa.amtacctcr), (fa.amtacctdr-fa.amtacctcr),") // 1-2
.append(" (CASE WHEN (fa.amtacctdr-fa.amtacctcr) < 0 THEN ")
.append(DB.TO_STRING(Msg.translate(Env.getCtx(), "CR")))
.append(" ELSE ")
.append(DB.TO_STRING(Msg.translate(Env.getCtx(), "DR")))
.append(" END), fa.Fact_Acct_ID, bp.name, DateAcct,")
.append(" glc.name, p.name, Qty, fa.Description, r.MatchCode, fa.DateTrx, o.value")
.append(" FROM Fact_Acct fa")
.append(" LEFT OUTER JOIN Fact_Reconciliation r ON (fa.Fact_Acct_ID=r.Fact_Acct_ID)")
.append(" LEFT OUTER JOIN C_BPartner bp ON (fa.C_BPartner_ID=bp.C_BPartner_ID)")
.append(" LEFT OUTER JOIN AD_Org o ON (o.AD_Org_ID=fa.AD_Org_ID)")
.append(" LEFT OUTER JOIN M_Product p ON (p.M_Product_ID=fa.M_Product_ID)")
.append(" LEFT OUTER JOIN GL_Category glc ON (fa.GL_Category_ID=glc.GL_Category_ID)")
.append(" WHERE fa.AD_Client_ID=?");
// role security
sql = new StringBuilder( MRole.getDefault(Env.getCtx(), false).addAccessSQL( sql.toString(), "fa", MRole.SQL_FULLYQUALIFIED, MRole.SQL_RO ) );

View File

@ -20,6 +20,11 @@
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ds.core.builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>

View File

@ -5,6 +5,7 @@ Bundle-SymbolicName: org.idempiere.webservices;singleton:=true
Bundle-Version: 2.0.0.qualifier
Bundle-Activator: org.idempiere.webservices.Activator
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Service-Component: OSGI-INF/ws_modelfactory.xml
Import-Package: javax.activation;version="1.1.1",
javax.mail.internet;version="1.5",
javax.servlet;version="3.0.0",

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.compiere.model.WS_ModelFactory">
<implementation class="org.compiere.model.WS_ModelFactory"/>
<property name="service.ranking" type="Integer" value="5"/>
<service>
<provide interface="org.adempiere.base.IModelFactory"/>
</service>
</scr:component>

View File

@ -0,0 +1,85 @@
/***********************************************************************
* This file is part of iDempiere ERP Bazaar *
* http://www.idempiere.org *
* *
* Copyright (C) Carlos Ruiz - globalqss *
* Copyright (C) Contributors *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
* as published by the Free Software Foundation; either version 2 *
* of the License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the Free Software *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, *
* MA 02110-1301, USA. *
* *
* Contributors: *
* - Carlos Ruiz (globalqss@users.sourceforge.net) *
* *
* Sponsors: *
* - GlobalQSS (http://www.globalqss.com) *
***********************************************************************/
package org.compiere.model;
import java.sql.ResultSet;
import java.util.Properties;
/**
* Web Services Parameters Model
*
* @author Carlos Ruiz
*/
public class MWebServicePara extends X_WS_WebService_Para
{
/**
*
*/
private static final long serialVersionUID = 3561409141850981248L;
/**************************************************************************
* Standard Constructor
* @param ctx context
* @param WS_WebService_Para_ID
* @param trxName transaction
*/
public MWebServicePara (Properties ctx, int WS_WebService_Para_ID, String trxName)
{
super (ctx, WS_WebService_Para_ID, trxName);
/** if (WS_WebService_Para_ID == 0)
{
setName (null);
setValue (null);
WS_WebService_Para_ID (0);
} */
} // MWebServicePara
/**
* Load Constructor
* @param ctx context
* @param rs result set
* @param trxName transaction
*/
public MWebServicePara (Properties ctx, ResultSet rs, String trxName)
{
super(ctx, rs, trxName);
} // MWebServicePara
@Override
protected boolean beforeSave(boolean newRecord) {
if ( "Filter".equalsIgnoreCase(getParameterName())
&& PARAMETERTYPE_Free.equals(getParameterType())) {
log.saveError("Error", "Type Free not allowed for parameter Filter (security issue)"); // IDEMPIERE-1784
return false;
}
return true;
}
} // MWebServicePara

View File

@ -0,0 +1,69 @@
/**********************************************************************
* This file is part of iDempiere ERP Open Source *
* http://www.idempiere.org *
* *
* Copyright (C) Contributors *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
* as published by the Free Software Foundation; either version 2 *
* of the License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the Free Software *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, *
* MA 02110-1301, USA. *
* *
* Contributors: *
* - Carlos Ruiz - globalqss *
**********************************************************************/
package org.compiere.model;
import java.sql.ResultSet;
import org.adempiere.base.IModelFactory;
import org.compiere.model.PO;
import org.compiere.util.Env;
public class WS_ModelFactory implements IModelFactory {
@Override
public Class<?> getClass(String tableName) {
if (X_WS_WebService_Para.Table_Name.equals(tableName))
return MWebServicePara.class;
if (X_WS_WebServiceType.Table_Name.equals(tableName))
return MWebServiceType.class;
if (X_WS_WebService.Table_Name.equals(tableName))
return MWebService.class;
return null;
}
@Override
public PO getPO(String tableName, int Record_ID, String trxName) {
if (X_WS_WebService_Para.Table_Name.equals(tableName))
return new MWebServicePara(Env.getCtx(), Record_ID, trxName);
if (X_WS_WebServiceType.Table_Name.equals(tableName))
return new MWebServiceType(Env.getCtx(), Record_ID, trxName);
if (X_WS_WebService.Table_Name.equals(tableName))
return new MWebService(Env.getCtx(), Record_ID, trxName);
return null;
}
@Override
public PO getPO(String tableName, ResultSet rs, String trxName) {
if (X_WS_WebService_Para.Table_Name.equals(tableName))
return new MWebServicePara(Env.getCtx(), rs, trxName);
if (X_WS_WebServiceType.Table_Name.equals(tableName))
return new MWebServiceType(Env.getCtx(), rs, trxName);
if (X_WS_WebService.Table_Name.equals(tableName))
return new MWebService(Env.getCtx(), rs, trxName);
return null;
}
}