1428 lines
75 KiB
Plaintext
1428 lines
75 KiB
Plaintext
|
Starting run
|
||
|
|
||
|
DROP VIEW M_InOut_Line_v
|
||
|
AS
|
||
|
SELECT iol.AD_Client_ID, iol.AD_Org_ID, iol.IsActive, iol.Created, iol.CreatedBy, iol.Updated, iol.UpdatedBy,
|
||
|
'en_US' AS AD_Language,
|
||
|
iol.M_InOut_ID, iol.M_InOutLine_ID,
|
||
|
iol.Line,
|
||
|
CASE WHEN iol.MovementQty<>0 OR iol.M_Product_ID IS NOT NULL THEN iol.MovementQty END AS MovementQty,
|
||
|
CASE WHEN iol.QtyEntered<>0 OR iol.M_Product_ID IS NOT NULL THEN iol.QtyEntered END AS QtyEntered,
|
||
|
CASE WHEN iol.MovementQty<>0 OR iol.M_Product_ID IS NOT NULL THEN uom.UOMSymbol END AS UOMSymbol,
|
||
|
ol.QtyOrdered, ol.QtyDelivered,
|
||
|
CASE WHEN iol.MovementQty<>0 OR iol.M_Product_ID IS NOT NULL THEN ol.QtyOrdered-ol.QtyDelivered END AS QtyBackOrdered,
|
||
|
COALESCE(p.Name||productAttribute(iol.M_AttributeSetInstance_ID), c.Name, iol.Description) AS Name, CASE WHEN COALESCE(c.Name,p.Name) IS NOT NULL THEN iol.Description END AS Description, p.DocumentNote, p.UPC, p.SKU, p.Value AS ProductValue,
|
||
|
iol.M_Locator_ID, l.M_Warehouse_ID, l.X, l.Y, l.Z,
|
||
|
iol.M_AttributeSetInstance_ID, asi.M_AttributeSet_ID, asi.SerNo, asi.Lot, asi.M_Lot_ID,asi.GuaranteeDate,
|
||
|
p.Description AS ProductDescription, p.ImageURL,
|
||
|
iol.C_Campaign_ID, iol.C_Project_ID, iol.C_Activity_ID, iol.C_ProjectPhase_ID, iol.C_ProjectTask_ID
|
||
|
FROM M_InOutLine iol
|
||
|
INNER JOIN C_UOM uom ON (iol.C_UOM_ID=uom.C_UOM_ID)
|
||
|
LEFT OUTER JOIN M_Product p ON (iol.M_Product_ID=p.M_Product_ID)
|
||
|
LEFT OUTER JOIN M_AttributeSetInstance asi ON (iol.M_AttributeSetInstance_ID=asi.M_AttributeSetInstance_ID)
|
||
|
LEFT OUTER JOIN M_Locator l ON (iol.M_Locator_ID=l.M_Locator_ID)
|
||
|
LEFT OUTER JOIN C_OrderLine ol ON (iol.C_OrderLine_ID=ol.C_OrderLine_ID)
|
||
|
LEFT OUTER JOIN C_Charge c ON (iol.C_Charge_ID=c.C_Charge_ID)
|
||
|
UNION SELECT iol.AD_Client_ID, iol.AD_Org_ID, iol.IsActive, iol.Created, iol.CreatedBy, iol.Updated, iol.UpdatedBy,
|
||
|
'en_US' AS AD_Language,
|
||
|
iol.M_InOut_ID, iol.M_InOutLine_ID,
|
||
|
iol.Line+(b.Line/100) AS Line,
|
||
|
iol.MovementQty*b.BOMQty AS QtyInvoiced, iol.QtyEntered*b.BOMQty AS QtyEntered, uom.UOMSymbol,
|
||
|
null, null, null,
|
||
|
p.Name, b.Description, p.DocumentNote, p.UPC, p.SKU, p.Value AS ProductValue,
|
||
|
iol.M_Locator_ID, l.M_Warehouse_ID, l.X, l.Y, l.Z,
|
||
|
iol.M_AttributeSetInstance_ID, asi.M_AttributeSet_ID, asi.SerNo, asi.Lot, asi.M_Lot_ID,asi.GuaranteeDate,
|
||
|
p.Description AS ProductDescription, p.ImageURL,
|
||
|
iol.C_Campaign_ID, iol.C_Project_ID, iol.C_Activity_ID, iol.C_ProjectPhase_ID, iol.C_ProjectTask_ID
|
||
|
FROM M_Product_BOM b INNER JOIN M_InOutLine iol ON (b.M_Product_ID=iol.M_Product_ID)
|
||
|
INNER JOIN M_Product bp ON (bp.M_Product_ID=iol.M_Product_ID AND bp.IsBOM='Y' AND bp.IsVerified='Y' AND bp.IsPickListPrintDetails='Y')
|
||
|
INNER JOIN M_Product p ON (b.M_ProductBOM_ID=p.M_Product_ID) INNER JOIN C_UOM uom ON (p.C_UOM_ID=uom.C_UOM_ID)
|
||
|
LEFT OUTER JOIN M_AttributeSetInstance asi ON (iol.M_AttributeSetInstance_ID=asi.M_AttributeSetInstance_ID)
|
||
|
LEFT OUTER JOIN M_Locator l ON (iol.M_Locator_ID=l.M_Locator_ID)
|
||
|
|
||
|
SQL Exception: Syntax error: Encountered "AS" at line 2, column 1.
|
||
|
|
||
|
|
||
|
null
|
||
|
|
||
|
SQL Exception: 'ROUND' is not recognized as a function or procedure.
|
||
|
|
||
|
|
||
|
|
||
|
drop VIEW RV_C_Invoice_Day ;
|
||
|
CREATE VIEW RV_C_Invoice_Day
|
||
|
AS
|
||
|
SELECT AD_Client_ID, AD_Org_ID, SalesRep_ID,
|
||
|
firstOf(DateInvoiced, 'DD') AS DateInvoiced, SUM(LineNetAmt) AS LineNetAmt,
|
||
|
SUM(LineListAmt) AS LineListAmt,
|
||
|
SUM(LineLimitAmt) AS LineLimitAmt,
|
||
|
SUM(LineDiscountAmt) AS LineDiscountAmt,
|
||
|
CASE WHEN SUM(LineListAmt)=0 THEN 0 ELSE
|
||
|
ROUND((SUM(LineListAmt)-SUM(LineNetAmt))/SUM(LineListAmt)*100,2) END AS LineDiscount,
|
||
|
SUM(LineOverLimitAmt) AS LineOverLimitAmt,
|
||
|
CASE WHEN SUM(LineNetAmt)=0 THEN 0 ELSE
|
||
|
100-ROUND((SUM(LineNetAmt)-SUM(LineOverLimitAmt))/SUM(LineNetAmt)*100,2) END AS LineOverLimit,
|
||
|
IsSOTrx
|
||
|
FROM RV_C_InvoiceLine
|
||
|
GROUP BY AD_Client_ID, AD_Org_ID, SalesRep_ID,
|
||
|
firstOf(DateInvoiced, 'DD'), IsSOTrx;
|
||
|
|
||
|
SQL Exception: Syntax error: Encountered "(" at line 16, column 16.
|
||
|
|
||
|
|
||
|
CREATE VIEW RV_C_Invoice_Week
|
||
|
AS
|
||
|
SELECT AD_Client_ID, AD_Org_ID, SalesRep_ID,
|
||
|
firstOf(DateInvoiced, 'DY') AS DateInvoiced, SUM(LineNetAmt) AS LineNetAmt,
|
||
|
SUM(LineListAmt) AS LineListAmt,
|
||
|
SUM(LineLimitAmt) AS LineLimitAmt,
|
||
|
SUM(LineDiscountAmt) AS LineDiscountAmt,
|
||
|
CASE WHEN SUM(LineListAmt)=0 THEN 0 ELSE
|
||
|
ROUND((SUM(LineListAmt)-SUM(LineNetAmt))/SUM(LineListAmt)*100,2) END AS LineDiscount,
|
||
|
SUM(LineOverLimitAmt) AS LineOverLimitAmt,
|
||
|
CASE WHEN SUM(LineNetAmt)=0 THEN 0 ELSE
|
||
|
100-ROUND((SUM(LineNetAmt)-SUM(LineOverLimitAmt))/SUM(LineNetAmt)*100,2) END AS LineOverLimit,
|
||
|
IsSOTrx
|
||
|
FROM RV_C_InvoiceLine
|
||
|
GROUP BY AD_Client_ID, AD_Org_ID, SalesRep_ID,
|
||
|
firstOf(DateInvoiced, 'DY'), IsSOTrx
|
||
|
|
||
|
SQL Exception: Syntax error: Encountered "(" at line 16, column 16.
|
||
|
|
||
|
|
||
|
|
||
|
CREATE VIEW RV_C_Invoice_ProdMonth
|
||
|
AS
|
||
|
SELECT il.AD_Client_ID, il.AD_Org_ID, il.M_Product_Category_ID,
|
||
|
firstOf(il.DateInvoiced, 'MM') AS DateInvoiced,
|
||
|
SUM(il.LineNetAmt) AS LineNetAmt,
|
||
|
SUM(il.LineListAmt) AS LineListAmt,
|
||
|
SUM(il.LineLimitAmt) AS LineLimitAmt,
|
||
|
SUM(il.LineDiscountAmt) AS LineDiscountAmt,
|
||
|
CASE WHEN SUM(LineListAmt)=0 THEN 0 ELSE
|
||
|
ROUND((SUM(LineListAmt)-SUM(LineNetAmt))/SUM(LineListAmt)*100,2) END AS LineDiscount,
|
||
|
SUM(LineOverLimitAmt) AS LineOverLimitAmt,
|
||
|
CASE WHEN SUM(LineNetAmt)=0 THEN 0 ELSE
|
||
|
100-ROUND((SUM(LineNetAmt)-SUM(LineOverLimitAmt))/SUM(LineNetAmt)*100,2) END AS LineOverLimit,
|
||
|
SUM(QtyInvoiced) AS QtyInvoiced, IsSOTrx
|
||
|
FROM RV_C_InvoiceLine il
|
||
|
GROUP BY il.AD_Client_ID, il.AD_Org_ID, il.M_Product_Category_ID,
|
||
|
firstOf(il.DateInvoiced, 'MM'), IsSOTrx
|
||
|
|
||
|
SQL Exception: Syntax error: Encountered "(" at line 17, column 16.
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
CREATE VIEW RV_Cash_Detail
|
||
|
AS
|
||
|
SELECT cl.C_Cash_ID, cl.C_CashLine_ID,
|
||
|
c.AD_Client_ID, c.AD_Org_ID, cl.IsActive, cl.Created, cl.CreatedBy, cl.Updated, cl.UpdatedBy,
|
||
|
c.C_CashBook_ID, c.Name, c.StatementDate, c.DateAcct, c.Processed, c.Posted,
|
||
|
cl.Line, cl.Description, cl.CashType, cl.C_Currency_ID, cl.Amount,
|
||
|
currencyConvert(cl.Amount,cl.C_Currency_ID,cb.C_Currency_ID,c.StatementDate,0, c.AD_Client_ID, c.AD_Org_ID) AS ConvertedAmt,
|
||
|
cl.C_BankAccount_ID, cl.C_Invoice_ID, cl.C_Charge_ID
|
||
|
FROM C_Cash c
|
||
|
INNER JOIN C_CashLine cl ON (c.C_Cash_ID=cl.C_Cash_ID)
|
||
|
INNER JOIN C_CashBook cb ON (c.C_CashBook_ID=cb.C_CashBook_ID)
|
||
|
|
||
|
SQL Exception: No method was found that matched the method call org.compiere.sqlj.Currency.convert(double, int, int, java.sql.Timestamp, int, int, int), tried all combinations of object and primitive types and any possible type conversion for any parameters the method call may have. The method might exist but it is not public and/or static, or the parameter types are not method invocation convertible.
|
||
|
CREATE FUNCTION CURRENCYCONVERT(AMOUNT DOUBLE,C_CURRENCYFROM_ID INTEGER,C_CURRENCYTO_ID INTEGER,CONVERSIONDATE TIMESTAMP,C_CONVERSIONTYPE_ID INTEGER,AD_CLIENT_ID INTEGER,AD_ORG_ID INTEGER) RETURNS DOUBLE LANGUAGE JAVA PARAMETER STYLE JAVA READS SQL DATA CALLED ON NULL INPUT
|
||
|
EXTERNAL NAME 'org.compiere.sqlj.Currency.convert';
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
CREATE VIEW RV_CostSummary
|
||
|
AS
|
||
|
SELECT c.AD_Client_ID, c.AD_Org_ID, c.IsActive, 0 AS CreatedBy,SysDate AS Created,0 AS UpdatedBy,SysDate AS Updated,
|
||
|
p.M_Product_ID, p.Value, p.Name, p.UPC, p.IsBOM, p.ProductType, p.M_Product_Category_ID,
|
||
|
c.M_CostType_ID,
|
||
|
acct.C_AcctSchema_ID, acct.C_Currency_ID,
|
||
|
SUM(c.CurrentCostPrice) AS CurrentCostPrice, SUM(c.FutureCostPrice) AS FutureCostPrice
|
||
|
FROM M_Cost c
|
||
|
INNER JOIN M_Product p ON (c.M_Product_ID=p.M_Product_ID)
|
||
|
INNER JOIN C_AcctSchema acct ON (c.C_AcctSchema_ID=acct.C_AcctSchema_ID)
|
||
|
WHERE acct.M_CostType_ID=c.M_CostType_ID
|
||
|
GROUP BY c.AD_Client_ID, c.AD_Org_ID, c.IsActive,
|
||
|
p.M_Product_ID, p.Value, p.Name, p.UPC, p.IsBOM, p.ProductType, p.M_Product_Category_ID,
|
||
|
c.M_CostType_ID, acct.C_AcctSchema_ID, acct.C_Currency_ID
|
||
|
|
||
|
SQL Exception: Column 'SYSDATE' is either not in any table in the FROM list or appears within a join specification and is outside the scope of the join specification or appears in a HAVING clause and is not in the GROUP BY list. If this is a CREATE or ALTER TABLE statement then 'SYSDATE' is not a column in the target table.
|
||
|
|
||
|
CREATE VIEW RV_ProjectCycle
|
||
|
AS
|
||
|
SELECT p.AD_Client_ID, p.AD_Org_ID, p.IsActive, p.Created,p.CreatedBy, p.Updated,p.UpdatedBy,
|
||
|
c.C_Cycle_ID, c.Name AS CycleName, c.C_Currency_ID,
|
||
|
cs.C_CycleStep_ID, cs.Name AS CycleStepName, cs.SeqNo, cs.RelativeWeight,
|
||
|
pp.C_Phase_ID, pp.Name AS ProjectPhaseName,
|
||
|
pt.C_ProjectType_ID, pt.Name AS ProjectTypeName,
|
||
|
p.Value AS ProjectValue, p.Name AS ProjectName, p.Description, p.Note,
|
||
|
p.C_BPartner_ID, p.C_BPartner_Location_ID, p.AD_User_ID, p.POReference,
|
||
|
p.SalesRep_ID, p.M_Warehouse_ID, p.ProjectCategory,
|
||
|
p.DateContract, p.DateFinish,
|
||
|
p.IsCommitment, p.IsCommitCeiling,
|
||
|
p.CommittedQty*cs.RelativeWeight AS CommittedQty,
|
||
|
currencyConvert (p.CommittedAmt, p.C_Currency_ID, c.C_Currency_ID, getdate(),0, p.AD_Client_ID, p.AD_Org_ID)*cs.RelativeWeight AS CommittedAmt,
|
||
|
p.PlannedQty*cs.RelativeWeight AS PlannedQty,
|
||
|
currencyConvert (p.PlannedAmt, p.C_Currency_ID, c.C_Currency_ID, getdate(),0, p.AD_Client_ID, p.AD_Org_ID)*cs.RelativeWeight AS PlannedAmt,
|
||
|
currencyConvert (p.PlannedMarginAmt, p.C_Currency_ID, c.C_Currency_ID, getdate(),0, p.AD_Client_ID, p.AD_Org_ID)*cs.RelativeWeight AS PlannedMarginAmt,
|
||
|
currencyConvert (p.InvoicedAmt, p.C_Currency_ID, c.C_Currency_ID, getdate(),0, p.AD_Client_ID, p.AD_Org_ID)*cs.RelativeWeight AS InvoicedAmt,
|
||
|
p.InvoicedQty*cs.RelativeWeight AS InvoicedQty,
|
||
|
currencyConvert (p.ProjectBalanceAmt, p.C_Currency_ID, c.C_Currency_ID, getdate(),0, p.AD_Client_ID, p.AD_Org_ID)*cs.RelativeWeight AS ProjectBalanceAmt
|
||
|
FROM C_Cycle c
|
||
|
INNER JOIN C_CycleStep cs ON (c.C_Cycle_ID=cs.C_Cycle_ID)
|
||
|
INNER JOIN C_CyclePhase cp ON (cs.C_CycleStep_ID=cp.C_CycleStep_ID)
|
||
|
INNER JOIN C_Phase pp ON (cp.C_Phase_ID=pp.C_Phase_ID)
|
||
|
INNER JOIN C_Project p ON (cp.C_Phase_ID=p.C_Phase_ID)
|
||
|
INNER JOIN C_ProjectType pt ON (p.C_ProjectType_ID=pt.C_ProjectType_ID)
|
||
|
|
||
|
SQL Exception: No method was found that matched the method call org.compiere.sqlj.Currency.convert(double, int, int, java.sql.Timestamp, int, int, int), tried all combinations of object and primitive types and any possible type conversion for any parameters the method call may have. The method might exist but it is not public and/or static, or the parameter types are not method invocation convertible
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
CREATE VIEW RV_ProjectLineIssue
|
||
|
AS
|
||
|
SELECT COALESCE(l.AD_Client_ID,i.AD_Client_ID) AS AD_Client_ID,COALESCE(l.AD_Org_ID,i.AD_Org_ID) AS AD_Org_ID,
|
||
|
COALESCE(l.IsActive,i.IsActive) AS IsActive,
|
||
|
COALESCE(l.Created,i.Created) AS Created,COALESCE(l.CreatedBy,i.CreatedBy) AS CreatedBy,
|
||
|
COALESCE(l.Updated,i.Updated) AS Updated,COALESCE(l.UpdatedBy,i.UpdatedBy) AS UpdatedBy,
|
||
|
COALESCE(l.C_Project_ID,i.C_Project_ID) AS C_Project_ID,
|
||
|
COALESCE(l.M_Product_ID,i.M_Product_ID) AS M_Product_ID,
|
||
|
l.C_ProjectLine_ID, l.Line, l.Description, l.PlannedQty, l.PlannedPrice, l.PlannedAmt,
|
||
|
l.PlannedMarginAmt, l.CommittedQty,
|
||
|
i.C_ProjectIssue_ID, i.M_Locator_ID, i.MovementQty, i.MovementDate,
|
||
|
i.Line AS IssueLine, i.Description AS IssueDescription,
|
||
|
i.M_InOutLine_ID, i.S_TimeExpenseLine_ID,
|
||
|
fa.C_AcctSchema_ID, fa.Account_ID,
|
||
|
fa.AmtSourceDr, fa.AmtSourceCr, fa.AmtAcctDr, fa.AmtAcctCr,
|
||
|
l.PlannedAmt-fa.AmtSourceDr+fa.AmtSourceCr AS LineMargin
|
||
|
FROM C_ProjectLine l
|
||
|
FULL JOIN C_ProjectIssue i ON (i.C_Project_ID=l.C_Project_ID AND i.C_ProjectIssue_ID=l.C_ProjectIssue_ID)
|
||
|
LEFT OUTER JOIN Fact_Acct fa ON (fa.AD_Table_ID=623 AND fa.Record_ID=i.C_ProjectIssue_ID AND fa.M_Locator_ID IS NULL)
|
||
|
|
||
|
SQL Exception: Syntax error: Encountered "FULL" at line 18, column 5.
|
||
|
|
||
|
|
||
|
CREATE VIEW RV_UnPosted
|
||
|
AS
|
||
|
SELECT AD_Client_ID, AD_Org_ID, Created, CreatedBy, Updated, UpdatedBy, IsActive,
|
||
|
DocumentNo, DateDoc, DateAcct, 224 AS AD_Table_ID, GL_Journal_ID AS Record_ID, 'N' AS IsSOTrx
|
||
|
FROM GL_Journal WHERE Posted<>'Y' AND DocStatus<>'VO'
|
||
|
UNION
|
||
|
SELECT pi.AD_Client_ID, pi.AD_Org_ID, pi.Created, pi.CreatedBy, pi.Updated, pi.UpdatedBy, pi. IsActive,
|
||
|
p.Name || '_' || pi.Line, pi.MovementDate, pi.MovementDate, 623, pi.C_ProjectIssue_ID, 'N'
|
||
|
FROM C_ProjectIssue pi INNER JOIN C_Project p ON (pi.C_Project_ID=p.C_Project_ID)
|
||
|
WHERE Posted<>'Y' UNION
|
||
|
SELECT AD_Client_ID, AD_Org_ID, Created, CreatedBy, Updated, UpdatedBy, IsActive,
|
||
|
DocumentNo, DateInvoiced, DateAcct, 318, C_Invoice_ID, IsSOTrx
|
||
|
FROM C_Invoice WHERE Posted<>'Y' AND DocStatus<>'VO'
|
||
|
UNION
|
||
|
SELECT AD_Client_ID, AD_Org_ID, Created, CreatedBy, Updated, UpdatedBy, IsActive,
|
||
|
DocumentNo, MovementDate, DateAcct, 319, M_InOut_ID, IsSOTrx
|
||
|
FROM M_InOut WHERE Posted<>'Y' AND DocStatus<>'VO'
|
||
|
UNION
|
||
|
SELECT AD_Client_ID, AD_Org_ID, Created, CreatedBy, Updated, UpdatedBy, IsActive,
|
||
|
DocumentNo, MovementDate, MovementDate, 321, M_Inventory_ID, 'N'
|
||
|
FROM M_Inventory WHERE Posted<>'Y' AND DocStatus<>'VO'
|
||
|
UNION
|
||
|
SELECT AD_Client_ID, AD_Org_ID, Created, CreatedBy, Updated, UpdatedBy, IsActive,
|
||
|
DocumentNo, MovementDate, MovementDate, 323, M_Movement_ID, 'N'
|
||
|
FROM M_Movement WHERE Posted<>'Y' AND DocStatus<>'VO'
|
||
|
UNION
|
||
|
SELECT AD_Client_ID, AD_Org_ID, Created, CreatedBy, Updated, UpdatedBy, IsActive,
|
||
|
Name, MovementDate, MovementDate, 325, M_Production_ID, 'N'
|
||
|
FROM M_Production WHERE Posted<>'Y' UNION
|
||
|
SELECT AD_Client_ID, AD_Org_ID, Created, CreatedBy, Updated, UpdatedBy, IsActive,
|
||
|
Name, StatementDate, DateAcct, 407, C_Cash_ID, 'N'
|
||
|
FROM C_Cash WHERE Posted<>'Y' AND DocStatus<>'VO'
|
||
|
UNION
|
||
|
SELECT AD_Client_ID, AD_Org_ID, Created, CreatedBy, Updated, UpdatedBy, IsActive,
|
||
|
DocumentNo, DateTrx, DateTrx, 335, C_Payment_ID, 'N'
|
||
|
FROM C_Payment WHERE Posted<>'Y' AND DocStatus<>'VO'
|
||
|
UNION
|
||
|
SELECT AD_Client_ID, AD_Org_ID, Created, CreatedBy, Updated, UpdatedBy, IsActive,
|
||
|
DocumentNo, DateTrx, DateTrx, 735, C_AllocationHdr_ID, 'N'
|
||
|
FROM C_AllocationHdr WHERE Posted<>'Y' AND DocStatus<>'VO'
|
||
|
UNION
|
||
|
SELECT AD_Client_ID, AD_Org_ID, Created, CreatedBy, Updated, UpdatedBy, IsActive,
|
||
|
Name, StatementDate, StatementDate, 392, C_BankStatement_ID, 'N'
|
||
|
FROM C_BankStatement WHERE Posted<>'Y' AND DocStatus<>'VO'
|
||
|
UNION
|
||
|
SELECT AD_Client_ID, AD_Org_ID, Created, CreatedBy, Updated, UpdatedBy, IsActive,
|
||
|
DocumentNo, DateTrx, DateTrx, 472, M_MatchInv_ID, 'N'
|
||
|
FROM M_MatchInv WHERE Posted<>'Y' UNION
|
||
|
SELECT AD_Client_ID, AD_Org_ID, Created, CreatedBy, Updated, UpdatedBy, IsActive,
|
||
|
DocumentNo, DateTrx, DateTrx, 473, M_MatchPO_ID, 'N'
|
||
|
FROM M_MatchPO WHERE Posted<>'Y' UNION
|
||
|
SELECT AD_Client_ID, AD_Org_ID, Created, CreatedBy, Updated, UpdatedBy, IsActive,
|
||
|
DocumentNo, DateOrdered, DateAcct, 259, C_Order_ID, IsSOTrx
|
||
|
FROM C_Order WHERE Posted<>'Y' AND DocStatus<>'VO'
|
||
|
UNION
|
||
|
SELECT AD_Client_ID, AD_Org_ID, Created, CreatedBy, Updated, UpdatedBy, IsActive,
|
||
|
DocumentNo, DateRequired, DateRequired, 702, M_Requisition_ID, 'N'
|
||
|
FROM M_Requisition WHERE Posted<>'Y' AND DocStatus<>'VO'
|
||
|
|
||
|
SQL Exception: Cannot convert types 'DECIMAL' to 'VARCHAR'.
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
CREATE VIEW RV_WarehousePrice
|
||
|
AS
|
||
|
SELECT w.AD_Client_ID, w.AD_Org_ID,
|
||
|
CASE WHEN p.Discontinued='N' THEN 'Y' ELSE 'N' END AS IsActive,
|
||
|
pr.Created, pr.CreatedBy, pr.Updated, pr.UpdatedBy,
|
||
|
p.M_Product_ID, pr.M_PriceList_Version_ID, w.M_Warehouse_ID,
|
||
|
p.Value, p.Name, p.UPC, p.SKU,
|
||
|
uom.C_UOM_ID, uom.UOMSymbol,
|
||
|
bomPriceList(p.M_Product_ID, pr.M_PriceList_Version_ID) AS PriceList,
|
||
|
bomPriceStd(p.M_Product_ID, pr.M_PriceList_Version_ID) AS PriceStd,
|
||
|
bomPriceStd(p.M_Product_ID, pr.M_PriceList_Version_ID)-bomPriceLimit(p.M_Product_ID, pr.M_PriceList_Version_ID) AS Margin,
|
||
|
bomPriceLimit(p.M_Product_ID, pr.M_PriceList_Version_ID) AS PriceLimit,
|
||
|
w.Name AS WarehouseName,
|
||
|
bomQtyAvailable(p.M_Product_ID,w.M_Warehouse_ID,0) AS QtyAvailable,
|
||
|
bomQtyOnHand(p.M_Product_ID,w.M_Warehouse_ID,0) AS QtyOnHand,
|
||
|
bomQtyReserved(p.M_Product_ID,w.M_Warehouse_ID,0) AS QtyReserved,
|
||
|
bomQtyOrdered(p.M_Product_ID,w.M_Warehouse_ID,0) AS QtyOrdered,
|
||
|
COALESCE (pa.IsInstanceAttribute, 'N') AS IsInstanceAttribute
|
||
|
FROM M_Product p
|
||
|
INNER JOIN M_ProductPrice pr ON (p.M_Product_ID=pr.M_Product_ID)
|
||
|
INNER JOIN C_UOM uom ON (p.C_UOM_ID=uom.C_UOM_ID)
|
||
|
LEFT OUTER JOIN M_AttributeSet pa ON (p.M_AttributeSet_ID=pa.M_AttributeSet_ID)
|
||
|
INNER JOIN M_Warehouse w ON (p.AD_Client_ID=w.AD_Client_ID)
|
||
|
WHERE p.IsSummary='N' AND p.IsActive='Y' AND pr.IsActive='Y' AND w.IsActive='Y'
|
||
|
|
||
|
SQL Exception: No method was found that matched the method call double org.compiere.sqlj.Product.bomPriceList(int, int), tried all combinations of object and primitive types and any possible type conversion for any parameters the method call may have. The method might exist but it is not public and/or static, or the parameter types are not method invocation convertible.
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
CREATE VIEW C_Invoice_Candidate_v
|
||
|
AS
|
||
|
SELECT
|
||
|
o.AD_Client_ID, o.AD_Org_ID, o.C_BPartner_ID, o.C_Order_ID,
|
||
|
o.DocumentNo, o.DateOrdered, o.C_DocType_ID,
|
||
|
SUM((l.QtyOrdered-l.QtyInvoiced)*l.PriceActual) AS TotalLines
|
||
|
FROM C_Order o
|
||
|
INNER JOIN C_OrderLine l ON (o.C_Order_ID=l.C_Order_ID)
|
||
|
INNER JOIN C_BPartner bp ON (o.C_BPartner_ID=bp.C_BPartner_ID)
|
||
|
LEFT OUTER JOIN C_InvoiceSchedule si ON (bp.C_InvoiceSchedule_ID=si.C_InvoiceSchedule_ID)
|
||
|
WHERE o.DocStatus IN ('CO','CL','IP') AND o.C_DocType_ID IN (SELECT C_DocType_ID FROM C_DocType
|
||
|
WHERE DocBaseType='SOO' AND DocSubTypeSO NOT IN ('ON','OB','WR'))
|
||
|
AND l.QtyOrdered <> l.QtyInvoiced
|
||
|
AND (
|
||
|
o.InvoiceRule='I'
|
||
|
OR o.InvoiceRule='O'
|
||
|
OR (o.InvoiceRule='D' AND l.QtyInvoiced<>l.QtyDelivered)
|
||
|
OR (o.InvoiceRule='S' AND bp.C_InvoiceSchedule_ID IS NULL)
|
||
|
OR (o.InvoiceRule='S' AND bp.C_InvoiceSchedule_ID IS NOT NULL AND
|
||
|
(
|
||
|
(si.InvoiceFrequency IS NULL OR si.InvoiceFrequency='D')
|
||
|
OR (si.InvoiceFrequency='W')
|
||
|
OR (si.InvoiceFrequency='T'
|
||
|
AND ((TRUNC(o.DateOrdered) <= firstOf(getdate(),'MM')+si.InvoiceDayCutoff-1
|
||
|
AND TRUNC(getdate()) >= firstOf(o.DateOrdered,'MM')+si.InvoiceDay-1)
|
||
|
OR (TRUNC(o.DateOrdered) <= firstOf(getdate(),'MM')+si.InvoiceDayCutoff+14
|
||
|
AND TRUNC(getdate()) >= firstOf(o.DateOrdered,'MM')+si.InvoiceDay+14))
|
||
|
)
|
||
|
OR (si.InvoiceFrequency='M'
|
||
|
AND TRUNC(o.DateOrdered) <= firstOf(getdate(),'MM')+si.InvoiceDayCutoff-1 AND TRUNC(getdate()) >= firstOf(o.DateOrdered,'MM')+si.InvoiceDay-1) )
|
||
|
)
|
||
|
)
|
||
|
GROUP BY o.AD_Client_ID, o.AD_Org_ID, o.C_BPartner_ID, o.C_Order_ID,
|
||
|
o.DocumentNo, o.DateOrdered, o.C_DocType_ID
|
||
|
|
||
|
SQL Exception: 'TRUNC' is not recognized as a function or procedure.
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
CREATE VIEW C_Payment_v
|
||
|
AS
|
||
|
SELECT C_Payment_ID, AD_Client_ID, AD_Org_ID, IsActive, Created, CreatedBy, Updated, UpdatedBy,
|
||
|
DocumentNo, DateTrx, IsReceipt, C_DocType_ID, TrxType,
|
||
|
C_BankAccount_ID, C_BPartner_ID, C_Invoice_ID, C_BP_BankAccount_ID, C_PaymentBatch_ID,
|
||
|
TenderType, CreditCardType, CreditCardNumber, CreditCardVV, CreditCardExpMM, CreditCardExpYY,
|
||
|
Micr, RoutingNo, AccountNo, CheckNo,
|
||
|
A_Name, A_Street, A_City, A_State, A_Zip, A_Ident_DL, A_Ident_SSN, A_EMail,
|
||
|
VoiceAuthCode, Orig_TrxID, PONum,
|
||
|
C_Currency_ID, C_ConversionType_ID,
|
||
|
CASE IsReceipt WHEN 'Y' THEN PayAmt ELSE PayAmt*-1 END AS PayAmt,
|
||
|
CASE IsReceipt WHEN 'Y' THEN DiscountAmt ELSE DiscountAmt*-1 END AS DiscountAmt,
|
||
|
CASE IsReceipt WHEN 'Y' THEN WriteOffAmt ELSE WriteOffAmt*-1 END AS WriteOffAmt,
|
||
|
CASE IsReceipt WHEN 'Y' THEN TaxAmt ELSE TaxAmt*-1 END AS TaxAmt,
|
||
|
CASE IsReceipt WHEN 'Y' THEN OverUnderAmt ELSE OverUnderAmt*-1 END AS OverUnderAmt,
|
||
|
CASE IsReceipt WHEN 'Y' THEN 1 ELSE -1 END AS MultiplierAP,
|
||
|
IsOverUnderPayment, IsApproved,
|
||
|
R_PnRef, R_Result, R_RespMsg, R_AuthCode, R_AvsAddr, R_AvsZip, R_Info,
|
||
|
Processing, OProcessing, DocStatus, DocAction,
|
||
|
IsPrepayment, C_Charge_ID,
|
||
|
IsReconciled, IsAllocated, IsOnline, Processed, Posted,
|
||
|
C_Campaign_ID, C_Project_ID, C_Activity_ID
|
||
|
FROM C_Payment
|
||
|
|
||
|
SQL Exception: Syntax error: Encountered "IsReceipt" at line 11, column 10.
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
CREATE VIEW AD_ChangeLog_v
|
||
|
AS
|
||
|
SELECT l.AD_Session_ID, l.AD_ChangeLog_ID,
|
||
|
t.TableName, l.Record_ID, c.ColumnName,
|
||
|
l.OldValue, l.NewValue,
|
||
|
u.Name, l.Created
|
||
|
FROM AD_ChangeLog l
|
||
|
INNER JOIN AD_Table t ON (l.AD_Table_ID=t.AD_Table_ID)
|
||
|
INNER JOIN AD_Column c ON (l.AD_Column_ID=c.AD_Column_ID)
|
||
|
INNER JOIN AD_User u ON (l.CreatedBy=u.AD_User_ID)
|
||
|
ORDER BY l.AD_Session_ID, l.AD_ChangeLog_ID, t.TableName, l.Record_ID, c.ColumnName
|
||
|
|
||
|
SQL Exception: Syntax error: Encountered "ORDER" at line 11, column 1.
|
||
|
|
||
|
|
||
|
|
||
|
CREATE VIEW RV_Storage
|
||
|
AS
|
||
|
SELECT s.AD_Client_ID, s.AD_Org_ID,
|
||
|
s.M_Product_ID,p.Value,p.Name,p.Description,p.UPC,p.SKU,
|
||
|
p.C_UOM_ID,p.M_Product_Category_ID,p.Classification, p.Weight,p.Volume,p.VersionNo,
|
||
|
p.GuaranteeDays,p.GuaranteeDaysMin,
|
||
|
s.M_Locator_ID, l.M_Warehouse_ID, l.X, l.Y, l.Z,
|
||
|
s.QtyOnHand, s.QtyReserved, s.QtyOnHand-s.QtyReserved AS QtyAvailable,
|
||
|
s.QtyOrdered, s.DateLastInventory,
|
||
|
s.M_AttributeSetInstance_ID, asi.M_AttributeSet_ID, asi.SerNo, asi.Lot, asi.M_Lot_ID,
|
||
|
asi.GuaranteeDate, daysBetween(asi.GuaranteeDate,getdate()) AS ShelfLifeDays,
|
||
|
daysBetween(asi.GuaranteeDate,getdate())-p.GuaranteeDaysMin AS GoodForDays,
|
||
|
CAST((daysBetween(asi.GuaranteeDate,getdate())/p.GuaranteeDays)*100,0) AS ShelfLifeRemainingPct
|
||
|
FROM M_Storage s
|
||
|
INNER JOIN M_Locator l ON (s.M_Locator_ID=l.M_Locator_ID)
|
||
|
INNER JOIN M_Product p ON (s.M_Product_ID=p.M_Product_ID)
|
||
|
LEFT OUTER JOIN M_AttributeSetInstance asi ON (s.M_AttributeSetInstance_ID=asi.M_AttributeSetInstance_ID)
|
||
|
|
||
|
SQL Exception: Syntax error: Encountered "," at line 13, column 72.
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
CREATE VIEW C_Invoice_v
|
||
|
AS
|
||
|
SELECT i.C_Invoice_ID, i.AD_Client_ID, i.AD_Org_ID, i.IsActive, i.Created, i.CreatedBy, i.Updated, i.UpdatedBy,
|
||
|
i.IsSOTrx, i.DocumentNo, i.DocStatus, i.DocAction, i.Processing, i.Processed, i.C_DocType_ID,
|
||
|
i.C_DocTypeTarget_ID, i.C_Order_ID, i.Description, i.IsApproved, i.IsTransferred,
|
||
|
i.SalesRep_ID, i.DateInvoiced, i.DatePrinted, i.DateAcct, i.C_BPartner_ID, i.C_BPartner_Location_ID,
|
||
|
i.AD_User_ID, i.POReference, i.DateOrdered, i.C_Currency_ID, i.C_ConversionType_ID, i.PaymentRule,
|
||
|
i.C_PaymentTerm_ID, i.C_Charge_ID, i.M_PriceList_ID, i.C_Campaign_ID, i.C_Project_ID,
|
||
|
i.C_Activity_ID, i.IsPrinted, i.IsDiscountPrinted, i.IsPaid, i.IsInDispute,
|
||
|
i.IsPayScheduleValid, nullif(1,1) AS C_InvoicePaySchedule_ID,
|
||
|
CASE WHEN charAt(d.DocBaseType,3)='C' THEN i.ChargeAmt*-1 ELSE i.ChargeAmt END AS ChargeAmt,
|
||
|
CASE WHEN charAt(d.DocBaseType,3)='C' THEN i.TotalLines*-1 ELSE i.TotalLines END AS TotalLines,
|
||
|
CASE WHEN charAt(d.DocBaseType,3)='C' THEN i.GrandTotal*-1 ELSE i.GrandTotal END AS GrandTotal,
|
||
|
CASE WHEN charAt(d.DocBaseType,3)='C' THEN -1 ELSE 1 END AS Multiplier,
|
||
|
CASE WHEN charAt(d.DocBaseType AS DECIMAL(15,5))='P' THEN -1 ELSE 1 END AS MultiplierAP,
|
||
|
d.DocBaseType
|
||
|
FROM C_Invoice i
|
||
|
INNER JOIN C_DocType d ON (i.C_DocType_ID=d.C_DocType_ID)
|
||
|
WHERE i.IsPayScheduleValid<>'Y'
|
||
|
UNION
|
||
|
SELECT i.C_Invoice_ID, i.AD_Client_ID, i.AD_Org_ID, i.IsActive, i.Created, i.CreatedBy, i.Updated, i.UpdatedBy,
|
||
|
i.IsSOTrx, i.DocumentNo, i.DocStatus, i.DocAction, i.Processing, i.Processed, i.C_DocType_ID,
|
||
|
i.C_DocTypeTarget_ID, i.C_Order_ID, i.Description, i.IsApproved, i.IsTransferred,
|
||
|
i.SalesRep_ID, i.DateInvoiced, i.DatePrinted, i.DateAcct, i.C_BPartner_ID, i.C_BPartner_Location_ID,
|
||
|
i.AD_User_ID, i.POReference, i.DateOrdered, i.C_Currency_ID, i.C_ConversionType_ID, i.PaymentRule,
|
||
|
i.C_PaymentTerm_ID, i.C_Charge_ID, i.M_PriceList_ID, i.C_Campaign_ID, i.C_Project_ID,
|
||
|
i.C_Activity_ID, i.IsPrinted, i.IsDiscountPrinted, i.IsPaid, i.IsInDispute,
|
||
|
i.IsPayScheduleValid, ips.C_InvoicePaySchedule_ID,
|
||
|
nullif(1,1) AS ChargeAmt,
|
||
|
nullif(1,1) AS TotalLines,
|
||
|
CASE WHEN charAt(d.DocBaseType,3)='C' THEN ips.DueAmt*-1 ELSE ips.DueAmt END AS GrandTotal,
|
||
|
CASE WHEN charAt(d.DocBaseType,3)='C' THEN -1 ELSE 1 END AS Multiplier,
|
||
|
CASE WHEN charAt(d.DocBaseType,2)='P' THEN -1 ELSE 1 END AS MultiplierAP,
|
||
|
d.DocBaseType
|
||
|
FROM C_Invoice i
|
||
|
INNER JOIN C_DocType d ON (i.C_DocType_ID=d.C_DocType_ID)
|
||
|
INNER JOIN C_InvoicePaySchedule ips ON (i.C_Invoice_ID=ips.C_Invoice_ID)
|
||
|
WHERE i.IsPayScheduleValid='Y'
|
||
|
AND ips.IsValid='Y'
|
||
|
|
||
|
SQL Exception: Syntax error: Encountered "AS" at line 15, column 36.
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
CREATE VIEW RV_Payment
|
||
|
AS
|
||
|
SELECT C_Payment_ID, AD_Client_ID, AD_Org_ID, IsActive, Created, CreatedBy, Updated, UpdatedBy,
|
||
|
DocumentNo, DateTrx, IsReceipt, C_DocType_ID, TrxType,
|
||
|
C_BankAccount_ID, C_BPartner_ID, C_Invoice_ID, C_BP_BankAccount_ID, C_PaymentBatch_ID,
|
||
|
TenderType, CreditCardType, CreditCardNumber, CreditCardVV, CreditCardExpMM, CreditCardExpYY,
|
||
|
Micr, RoutingNo, AccountNo, CheckNo,
|
||
|
A_Name, A_Street, A_City, A_State, A_Zip, A_Ident_DL, A_Ident_SSN, A_EMail,
|
||
|
VoiceAuthCode, Orig_TrxID, PONum,
|
||
|
C_Currency_ID, C_ConversionType_ID,
|
||
|
CASE WHEN IsReceipt ='Y' THEN PayAmt ELSE PayAmt*-1 END AS PayAmt,
|
||
|
CASE WHEN IsReceipt ='Y' THEN DiscountAmt ELSE DiscountAmt*-1 END AS DiscountAmt,
|
||
|
CASE WHEN IsReceipt ='Y' THEN WriteOffAmt ELSE WriteOffAmt*-1 END AS WriteOffAmt,
|
||
|
CASE WHEN IsReceipt ='Y' THEN TaxAmt ELSE TaxAmt*-1 END AS TaxAmt,
|
||
|
CASE WHEN IsReceipt ='Y' THEN OverUnderAmt ELSE OverUnderAmt*-1 END AS OverUnderAmt,
|
||
|
CASE WHEN IsReceipt ='Y' THEN 1 ELSE -1 END AS MultiplierAP,
|
||
|
paymentAllocated(C_Payment_ID, C_Currency_ID) AS AllocatedAmt,
|
||
|
paymentAvailable(C_Payment_ID) AS AvailableAmt,
|
||
|
IsOverUnderPayment, IsApproved,
|
||
|
R_PnRef, R_Result, R_RespMsg, R_AuthCode, R_AvsAddr, R_AvsZip, R_Info,
|
||
|
Processing, OProcessing, DocStatus, DocAction,
|
||
|
IsPrepayment, C_Charge_ID,
|
||
|
IsReconciled, IsAllocated, IsOnline, Processed, Posted,
|
||
|
C_Campaign_ID, C_Project_ID, C_Activity_ID
|
||
|
FROM C_Payment
|
||
|
|
||
|
SQL Exception: No method was found that matched the method call double org.compiere.sqlj.Payment.allocated(int, int), tried all combinations of object and primitive types and any possible type conversion for any parameters the method call may have. The method might exist but it is not public and/or static, or the parameter types are not method invocation convertible.
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
Starting run
|
||
|
|
||
|
CREATE VIEW RV_RequestUpdates
|
||
|
AS
|
||
|
SELECT AD_Client_ID, AD_Org_ID, IsActive, Created, CreatedBy, Updated, UpdatedBy,
|
||
|
R_Request_ID, AD_User_ID, IsSelfService,
|
||
|
nullif(1,1) AS R_Group_ID, nullif(1,1) AS R_RequestType_ID, nullif(1,1) AS R_Category_ID
|
||
|
FROM R_RequestUpdates
|
||
|
UNION
|
||
|
SELECT u.AD_Client_ID, u.AD_Org_ID, u.IsActive, u.Created, u.CreatedBy, u.Updated, u.UpdatedBy,
|
||
|
r.R_Request_ID, u.AD_User_ID, u.IsSelfService,
|
||
|
r.R_Group_ID, nullif(1,1), nullif(1,1)
|
||
|
FROM R_GroupUpdates u
|
||
|
INNER JOIN R_Request r ON (u.R_Group_ID=r.R_Group_ID)
|
||
|
UNION
|
||
|
SELECT u.AD_Client_ID, u.AD_Org_ID, u.IsActive, u.Created, u.CreatedBy, u.Updated, u.UpdatedBy,
|
||
|
r.R_Request_ID, u.AD_User_ID, u.IsSelfService,
|
||
|
nullif(1,1), r.R_RequestType_ID, nullif(1,1)
|
||
|
FROM R_RequestTypeUpdates u
|
||
|
INNER JOIN R_Request r ON (u.R_RequestType_ID=r.R_RequestType_ID)
|
||
|
UNION
|
||
|
SELECT u.AD_Client_ID, u.AD_Org_ID, u.IsActive, u.Created, u.CreatedBy, u.Updated, u.UpdatedBy,
|
||
|
r.R_Request_ID, u.AD_User_ID, u.IsSelfService,
|
||
|
nullif(1,1), nullif(1,1), r.R_Category_ID
|
||
|
FROM R_CategoryUpdates u
|
||
|
INNER JOIN R_Request r ON (u.R_Category_ID=r.R_Category_ID)
|
||
|
UNION SELECT AD_Client_ID, AD_Org_ID, IsActive, Created, CreatedBy, Updated, UpdatedBy,
|
||
|
R_Request_ID, AD_User_ID, IsSelfService,
|
||
|
nullif(1,1), nullif(1,1), nullif(1,1)
|
||
|
FROM R_Request
|
||
|
WHERE AD_User_ID IS NOT NULL
|
||
|
UNION SELECT u.AD_Client_ID, u.AD_Org_ID, u.IsActive, u.Created, u.CreatedBy, u.Updated, u.UpdatedBy,
|
||
|
r.R_Request_ID, u.AD_User_ID, nullif(1,1),
|
||
|
nullif(1,1), nullif(1,1), r.R_Category_ID
|
||
|
FROM AD_User u
|
||
|
INNER JOIN R_Request r ON (u.AD_User_ID=r.SalesRep_ID)
|
||
|
UNION SELECT r.AD_Client_ID, r.AD_Org_ID, u.IsActive, r.Created, r.CreatedBy, r.Updated, r.UpdatedBy,
|
||
|
r.R_Request_ID, u.AD_User_ID, nullif(1,1),
|
||
|
nullif(1,1), nullif(1,1), nullif(1,1)
|
||
|
FROM R_Request r
|
||
|
INNER JOIN AD_User_Roles u ON (u.AD_Role_ID=r.AD_Role_ID)
|
||
|
|
||
|
SQL Exception: Types 'CHAR' and 'INTEGER' are not UNION compatible.
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
CREATE VIEW C_Invoice_LineTax_v
|
||
|
AS
|
||
|
SELECT il.AD_Client_ID, il.AD_Org_ID, il.IsActive, il.Created, il.CreatedBy, il.Updated, il.UpdatedBy,
|
||
|
'en_US' AS AD_Language,
|
||
|
il.C_Invoice_ID, il.C_InvoiceLine_ID,
|
||
|
il.C_Tax_ID, il.TaxAmt, il.LineTotalAmt, t.TaxIndicator,
|
||
|
il.Line,
|
||
|
CASE WHEN il.QtyInvoiced<>0 OR il.M_Product_ID IS NOT NULL THEN il.QtyInvoiced END AS QtyInvoiced,
|
||
|
CASE WHEN il.QtyEntered<>0 OR il.M_Product_ID IS NOT NULL THEN il.QtyEntered END AS QtyEntered,
|
||
|
CASE WHEN il.QtyEntered<>0 OR il.M_Product_ID IS NOT NULL THEN uom.UOMSymbol END AS UOMSymbol,
|
||
|
COALESCE(c.Name,p.Name||productAttribute(il.M_AttributeSetInstance_ID), il.Description) AS Name, CASE WHEN COALESCE(c.Name,p.Name) IS NOT NULL THEN il.Description END AS Description, p.DocumentNote, p.UPC, p.SKU, COALESCE(pp.VendorProductNo,p.Value) AS ProductValue,
|
||
|
ra.Description AS ResourceDescription, CASE WHEN i.IsDiscountPrinted='Y' AND il.PriceList<>0
|
||
|
THEN il.PriceList END AS PriceList,
|
||
|
CASE WHEN i.IsDiscountPrinted='Y' AND il.PriceList<>0 AND il.QtyEntered<>0
|
||
|
THEN il.PriceList*il.QtyInvoiced/il.QtyEntered END AS PriceEnteredList,
|
||
|
CASE WHEN i.IsDiscountPrinted='Y' AND il.PriceList>il.PriceActual AND il.PriceList<>0
|
||
|
THEN (il.PriceList-il.PriceActual)/il.PriceList*100 END AS Discount,
|
||
|
CASE WHEN il.PriceActual<>0 OR il.M_Product_ID IS NOT NULL THEN il.PriceActual END AS PriceActual,
|
||
|
CASE WHEN il.PriceEntered<>0 OR il.M_Product_ID IS NOT NULL THEN il.PriceEntered END AS PriceEntered,
|
||
|
CASE WHEN il.LineNetAmt<>0 OR il.M_Product_ID IS NOT NULL THEN il.LineNetAmt END AS LineNetAmt,
|
||
|
il.M_AttributeSetInstance_ID, asi.M_AttributeSet_ID,
|
||
|
asi.SerNo, asi.Lot, asi.M_Lot_ID,asi.GuaranteeDate,
|
||
|
p.Description as ProductDescription, p.ImageURL,
|
||
|
il.C_Campaign_ID, il.C_Project_ID, il.C_Activity_ID, il.C_ProjectPhase_ID, il.C_ProjectTask_ID
|
||
|
FROM C_InvoiceLine il
|
||
|
INNER JOIN C_UOM uom ON (il.C_UOM_ID=uom.C_UOM_ID)
|
||
|
INNER JOIN C_Invoice i ON (il.C_Invoice_ID=i.C_Invoice_ID)
|
||
|
LEFT OUTER JOIN C_Tax t ON (il.C_Tax_ID=t.C_Tax_ID)
|
||
|
LEFT OUTER JOIN M_Product p ON (il.M_Product_ID=p.M_Product_ID)
|
||
|
LEFT OUTER JOIN C_Charge c ON (il.C_Charge_ID=c.C_Charge_ID)
|
||
|
LEFT OUTER JOIN C_BPartner_Product pp ON (il.M_Product_ID=pp.M_Product_ID AND i.C_BPartner_ID=pp.C_BPartner_ID)
|
||
|
LEFT OUTER JOIN S_ResourceAssignment ra ON (il.S_ResourceAssignment_ID=ra.S_ResourceAssignment_ID)
|
||
|
LEFT OUTER JOIN M_AttributeSetInstance asi ON (il.M_AttributeSetInstance_ID=asi.M_AttributeSetInstance_ID)
|
||
|
UNION SELECT il.AD_Client_ID, il.AD_Org_ID, il.IsActive, il.Created, il.CreatedBy, il.Updated, il.UpdatedBy,
|
||
|
'en_US' AS AD_Language,
|
||
|
il.C_Invoice_ID, il.C_InvoiceLine_ID,
|
||
|
il.C_Tax_ID, il.TaxAmt, il.LineTotalAmt, t.TaxIndicator,
|
||
|
il.Line+(b.Line/100) AS Line,
|
||
|
il.QtyInvoiced*b.BOMQty AS QtyInvoiced,
|
||
|
il.QtyEntered*b.BOMQty AS QtyEntered,
|
||
|
uom.UOMSymbol,
|
||
|
p.Name, b.Description,
|
||
|
p.DocumentNote, p.UPC, p.SKU, p.Value AS ProductValue,
|
||
|
nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1),
|
||
|
il.M_AttributeSetInstance_ID, asi.M_AttributeSet_ID, asi.SerNo, asi.Lot, asi.M_Lot_ID,asi.GuaranteeDate,
|
||
|
p.Description as ProductDescription, p.ImageURL,
|
||
|
il.C_Campaign_ID, il.C_Project_ID, il.C_Activity_ID, il.C_ProjectPhase_ID, il.C_ProjectTask_ID
|
||
|
FROM M_Product_BOM b INNER JOIN C_InvoiceLine il ON (b.M_Product_ID=il.M_Product_ID)
|
||
|
INNER JOIN M_Product bp ON (bp.M_Product_ID=il.M_Product_ID AND bp.IsBOM='Y' AND bp.IsVerified='Y' AND bp.IsInvoicePrintDetails='Y')
|
||
|
INNER JOIN M_Product p ON (b.M_ProductBOM_ID=p.M_Product_ID) INNER JOIN C_UOM uom ON (p.C_UOM_ID=uom.C_UOM_ID)
|
||
|
LEFT OUTER JOIN C_Tax t ON (il.C_Tax_ID=t.C_Tax_ID)
|
||
|
LEFT OUTER JOIN M_AttributeSetInstance asi ON (il.M_AttributeSetInstance_ID=asi.M_AttributeSetInstance_ID)
|
||
|
UNION SELECT il.AD_Client_ID, il.AD_Org_ID, il.IsActive, il.Created, il.CreatedBy, il.Updated, il.UpdatedBy,
|
||
|
'en_US', il.C_Invoice_ID, il.C_InvoiceLine_ID,
|
||
|
nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1),
|
||
|
il.Line,
|
||
|
nullif(1,1), nullif(1,1), nullif(1,1),
|
||
|
il.Description,
|
||
|
nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1),
|
||
|
nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1),
|
||
|
nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1),
|
||
|
nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1)
|
||
|
FROM C_InvoiceLine il
|
||
|
WHERE il.C_UOM_ID IS NULL
|
||
|
UNION SELECT AD_Client_ID, AD_Org_ID, IsActive, Created, CreatedBy, Updated, UpdatedBy,
|
||
|
'en_US', C_Invoice_ID, nullif(1,1),
|
||
|
nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1),
|
||
|
9998,
|
||
|
nullif(1,1), nullif(1,1), nullif(1,1),
|
||
|
nullif(1,1),
|
||
|
nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1),
|
||
|
nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1),
|
||
|
nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1),
|
||
|
nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1)
|
||
|
FROM C_Invoice
|
||
|
UNION SELECT it.AD_Client_ID, it.AD_Org_ID, it.IsActive, it.Created, it.CreatedBy, it.Updated, it.UpdatedBy,
|
||
|
'en_US', it.C_Invoice_ID, nullif(1,1),
|
||
|
it.C_Tax_ID, nullif(1,1), nullif(1,1), t.TaxIndicator,
|
||
|
9999,
|
||
|
nullif(1,1), nullif(1,1), nullif(1,1),
|
||
|
t.Name,
|
||
|
nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1),
|
||
|
nullif(1,1), nullif(1,1), nullif(1,1),
|
||
|
CASE WHEN it.IsTaxIncluded='Y' THEN it.TaxAmt ELSE it.TaxBaseAmt END,
|
||
|
CASE WHEN it.IsTaxIncluded='Y' THEN it.TaxAmt ELSE it.TaxBaseAmt END,
|
||
|
CASE WHEN it.IsTaxIncluded='Y' THEN NULL ELSE it.TaxAmt END,
|
||
|
nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1),
|
||
|
nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1)
|
||
|
FROM C_InvoiceTax it
|
||
|
INNER JOIN C_Tax t ON (it.C_Tax_ID=t.C_Tax_ID)
|
||
|
|
||
|
SQL Exception: Types 'DECIMAL' and 'CHAR' are not type compatible. Neither type is assignable to the other type.
|
||
|
CREATE VIEW C_Invoice_LineTax_vt
|
||
|
CREATE VIEW C_Order_LineTax_v
|
||
|
CREATE VIEW C_Order_LineTax_vt
|
||
|
create VIEW M_InOut_Line_v
|
||
|
CREATE VIEW M_InOut_Line_vt
|
||
|
CASE WHEN expression missed "ELSE" part, add "ELSE 0"????????????
|
||
|
|
||
|
|
||
|
---------------------------------------
|
||
|
|
||
|
CREATE VIEW C_Invoice_LineTax_v
|
||
|
AS
|
||
|
SELECT il.AD_Client_ID, il.AD_Org_ID, il.IsActive, il.Created, il.CreatedBy, il.Updated, il.UpdatedBy,
|
||
|
'en_US' AS AD_Language,
|
||
|
il.C_Invoice_ID, il.C_InvoiceLine_ID,
|
||
|
il.C_Tax_ID, il.TaxAmt, il.LineTotalAmt, t.TaxIndicator,
|
||
|
il.Line,
|
||
|
CASE WHEN il.QtyInvoiced<>0 OR il.M_Product_ID IS NOT NULL THEN il.QtyInvoiced else 0 END AS QtyInvoiced,
|
||
|
CASE WHEN il.QtyEntered<>0 OR il.M_Product_ID IS NOT NULL THEN il.QtyEntered else 0 END AS QtyEntered,
|
||
|
CASE WHEN il.QtyEntered<>0 OR il.M_Product_ID IS NOT NULL THEN uom.UOMSymbol else 0 END AS UOMSymbol,
|
||
|
COALESCE(c.Name,p.Name||productAttribute(il.M_AttributeSetInstance_ID), il.Description) AS Name, CASE WHEN COALESCE(c.Name,p.Name) IS NOT NULL THEN il.Description END AS Description, p.DocumentNote, p.UPC, p.SKU, COALESCE(pp.VendorProductNo,p.Value) AS ProductValue,
|
||
|
ra.Description AS ResourceDescription, CASE WHEN i.IsDiscountPrinted='Y' AND il.PriceList<>0
|
||
|
THEN il.PriceList else 0 END AS PriceList,
|
||
|
CASE WHEN i.IsDiscountPrinted='Y' AND il.PriceList<>0 AND il.QtyEntered<>0
|
||
|
THEN il.PriceList*il.QtyInvoiced/il.QtyEntered else 0 END AS PriceEnteredList,
|
||
|
CASE WHEN i.IsDiscountPrinted='Y' AND il.PriceList>il.PriceActual AND il.PriceList<>0
|
||
|
THEN (il.PriceList-il.PriceActual)/il.PriceList*100 else 0 END AS Discount,
|
||
|
CASE WHEN il.PriceActual<>0 OR il.M_Product_ID IS NOT NULL THEN il.PriceActual else 0 END AS PriceActual,
|
||
|
CASE WHEN il.PriceEntered<>0 OR il.M_Product_ID IS NOT NULL THEN il.PriceEntered else 0 END AS PriceEntered,
|
||
|
CASE WHEN il.LineNetAmt<>0 OR il.M_Product_ID IS NOT NULL THEN il.LineNetAmt else 0 END AS LineNetAmt,
|
||
|
il.M_AttributeSetInstance_ID, asi.M_AttributeSet_ID,
|
||
|
asi.SerNo, asi.Lot, asi.M_Lot_ID,asi.GuaranteeDate,
|
||
|
p.Description as ProductDescription, p.ImageURL,
|
||
|
il.C_Campaign_ID, il.C_Project_ID, il.C_Activity_ID, il.C_ProjectPhase_ID, il.C_ProjectTask_ID
|
||
|
FROM C_InvoiceLine il
|
||
|
INNER JOIN C_UOM uom ON (il.C_UOM_ID=uom.C_UOM_ID)
|
||
|
INNER JOIN C_Invoice i ON (il.C_Invoice_ID=i.C_Invoice_ID)
|
||
|
LEFT OUTER JOIN C_Tax t ON (il.C_Tax_ID=t.C_Tax_ID)
|
||
|
LEFT OUTER JOIN M_Product p ON (il.M_Product_ID=p.M_Product_ID)
|
||
|
LEFT OUTER JOIN C_Charge c ON (il.C_Charge_ID=c.C_Charge_ID)
|
||
|
LEFT OUTER JOIN C_BPartner_Product pp ON (il.M_Product_ID=pp.M_Product_ID AND i.C_BPartner_ID=pp.C_BPartner_ID)
|
||
|
LEFT OUTER JOIN S_ResourceAssignment ra ON (il.S_ResourceAssignment_ID=ra.S_ResourceAssignment_ID)
|
||
|
LEFT OUTER JOIN M_AttributeSetInstance asi ON (il.M_AttributeSetInstance_ID=asi.M_AttributeSetInstance_ID)
|
||
|
UNION SELECT il.AD_Client_ID, il.AD_Org_ID, il.IsActive, il.Created, il.CreatedBy, il.Updated, il.UpdatedBy,
|
||
|
'en_US' AS AD_Language,
|
||
|
il.C_Invoice_ID, il.C_InvoiceLine_ID,
|
||
|
il.C_Tax_ID, il.TaxAmt, il.LineTotalAmt, t.TaxIndicator,
|
||
|
il.Line+(b.Line/100) AS Line,
|
||
|
il.QtyInvoiced*b.BOMQty AS QtyInvoiced,
|
||
|
il.QtyEntered*b.BOMQty AS QtyEntered,
|
||
|
uom.UOMSymbol,
|
||
|
p.Name, b.Description,
|
||
|
p.DocumentNote, p.UPC, p.SKU, p.Value AS ProductValue,
|
||
|
nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1),
|
||
|
il.M_AttributeSetInstance_ID, asi.M_AttributeSet_ID, asi.SerNo, asi.Lot, asi.M_Lot_ID,asi.GuaranteeDate,
|
||
|
p.Description as ProductDescription, p.ImageURL,
|
||
|
il.C_Campaign_ID, il.C_Project_ID, il.C_Activity_ID, il.C_ProjectPhase_ID, il.C_ProjectTask_ID
|
||
|
FROM M_Product_BOM b INNER JOIN C_InvoiceLine il ON (b.M_Product_ID=il.M_Product_ID)
|
||
|
INNER JOIN M_Product bp ON (bp.M_Product_ID=il.M_Product_ID AND bp.IsBOM='Y' AND bp.IsVerified='Y' AND bp.IsInvoicePrintDetails='Y')
|
||
|
INNER JOIN M_Product p ON (b.M_ProductBOM_ID=p.M_Product_ID) INNER JOIN C_UOM uom ON (p.C_UOM_ID=uom.C_UOM_ID)
|
||
|
LEFT OUTER JOIN C_Tax t ON (il.C_Tax_ID=t.C_Tax_ID)
|
||
|
LEFT OUTER JOIN M_AttributeSetInstance asi ON (il.M_AttributeSetInstance_ID=asi.M_AttributeSetInstance_ID)
|
||
|
UNION SELECT il.AD_Client_ID, il.AD_Org_ID, il.IsActive, il.Created, il.CreatedBy, il.Updated, il.UpdatedBy,
|
||
|
'en_US', il.C_Invoice_ID, il.C_InvoiceLine_ID,
|
||
|
nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1),
|
||
|
il.Line,
|
||
|
nullif(1,1), nullif(1,1), nullif(1,1),
|
||
|
il.Description,
|
||
|
nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1),
|
||
|
nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1),
|
||
|
nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1),
|
||
|
nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1)
|
||
|
FROM C_InvoiceLine il
|
||
|
WHERE il.C_UOM_ID IS NULL
|
||
|
UNION SELECT AD_Client_ID, AD_Org_ID, IsActive, Created, CreatedBy, Updated, UpdatedBy,
|
||
|
'en_US', C_Invoice_ID, nullif(1,1),
|
||
|
nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1),
|
||
|
9998,
|
||
|
nullif(1,1), nullif(1,1), nullif(1,1),
|
||
|
nullif(1,1),
|
||
|
nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1),
|
||
|
nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1),
|
||
|
nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1),
|
||
|
nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1)
|
||
|
FROM C_Invoice
|
||
|
UNION SELECT it.AD_Client_ID, it.AD_Org_ID, it.IsActive, it.Created, it.CreatedBy, it.Updated, it.UpdatedBy,
|
||
|
'en_US', it.C_Invoice_ID, nullif(1,1),
|
||
|
it.C_Tax_ID, nullif(1,1), nullif(1,1), t.TaxIndicator,
|
||
|
9999,
|
||
|
nullif(1,1), nullif(1,1), nullif(1,1),
|
||
|
t.Name,
|
||
|
nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1),
|
||
|
nullif(1,1), nullif(1,1), nullif(1,1),
|
||
|
CASE WHEN it.IsTaxIncluded='Y' THEN it.TaxAmt ELSE it.TaxBaseAmt END,
|
||
|
CASE WHEN it.IsTaxIncluded='Y' THEN it.TaxAmt ELSE it.TaxBaseAmt END,
|
||
|
CASE WHEN it.IsTaxIncluded='Y' THEN NULL ELSE it.TaxAmt END,
|
||
|
nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1),
|
||
|
nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1)
|
||
|
FROM C_InvoiceTax it
|
||
|
INNER JOIN C_Tax t ON (it.C_Tax_ID=t.C_Tax_ID)
|
||
|
|
||
|
SQL Exception: Types 'VARCHAR' and 'INTEGER' are not type compatible. Neither type is assignable to the other type.
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
(AD_Client_ID, AD_Org_ID, IsActive, Created, CreatedBy, Updated, UpdatedBy,
|
||
|
AD_Language,
|
||
|
M_InOut_ID, M_InOutLine_ID,
|
||
|
Line,
|
||
|
MovementQty,
|
||
|
QtyEntered,
|
||
|
UOMSymbol,
|
||
|
QtyOrdered, QtyDelivered,
|
||
|
QtyBackOrdered,
|
||
|
Name, -- main line
|
||
|
Description, -- second line
|
||
|
DocumentNote, -- third line
|
||
|
UPC, SKU, ProductValue,
|
||
|
M_Locator_ID, M_Warehouse_ID, X, Y, Z,
|
||
|
M_AttributeSetInstance_ID, M_AttributeSet_ID, SerNo, Lot, M_Lot_ID,GuaranteeDate,
|
||
|
ProductDescription, ImageURL,
|
||
|
C_Campaign_ID, C_Project_ID, C_Activity_ID, C_ProjectPhase_ID, C_ProjectTask_ID
|
||
|
)
|
||
|
|
||
|
|
||
|
CREATE VIEW C_Invoice_LineTax_vt
|
||
|
AS
|
||
|
SELECT il.AD_Client_ID, il.AD_Org_ID, il.IsActive, il.Created, il.CreatedBy, il.Updated, il.UpdatedBy,
|
||
|
uom.AD_Language,
|
||
|
il.C_Invoice_ID, il.C_InvoiceLine_ID,
|
||
|
il.C_Tax_ID, il.TaxAmt, il.LineTotalAmt, t.TaxIndicator,
|
||
|
il.Line,
|
||
|
CASE WHEN il.QtyInvoiced<>0 OR il.M_Product_ID IS NOT NULL THEN il.QtyInvoiced else 0 END AS QtyInvoiced,
|
||
|
CASE WHEN il.QtyEntered<>0 OR il.M_Product_ID IS NOT NULL THEN il.QtyEntered else 0 END AS QtyEntered,
|
||
|
CASE WHEN il.QtyEntered<>0 OR il.M_Product_ID IS NOT NULL THEN uom.UOMSymbol END AS UOMSymbol,
|
||
|
COALESCE(c.Name,COALESCE(pt.Name,p.Name)||productAttribute(il.M_AttributeSetInstance_ID), il.Description) AS Name, CASE WHEN COALESCE(c.Name,pt.Name,p.Name) IS NOT NULL THEN il.Description END AS Description, COALESCE(pt.DocumentNote,p.DocumentNote) AS DocumentNote, p.UPC, p.SKU, COALESCE(pp.VendorProductNo,p.Value) AS ProductValue,
|
||
|
ra.Description AS ResourceDescription, CASE WHEN i.IsDiscountPrinted='Y' AND il.PriceList<>0
|
||
|
THEN il.PriceList else 0 END AS PriceList,
|
||
|
CASE WHEN i.IsDiscountPrinted='Y' AND il.PriceList<>0 AND il.QtyEntered<>0
|
||
|
THEN il.PriceList*il.QtyInvoiced/il.QtyEntered else 0 END AS PriceEnteredList,
|
||
|
CASE WHEN i.IsDiscountPrinted='Y' AND il.PriceList>il.PriceActual AND il.PriceList<>0
|
||
|
THEN (il.PriceList-il.PriceActual)/il.PriceList*100 else 0 END AS Discount,
|
||
|
CASE WHEN il.PriceActual<>0 OR il.M_Product_ID IS NOT NULL THEN il.PriceActual else 0 END AS PriceActual,
|
||
|
CASE WHEN il.PriceEntered<>0 OR il.M_Product_ID IS NOT NULL THEN il.PriceEntered else 0 END AS PriceEntered,
|
||
|
CASE WHEN il.LineNetAmt<>0 OR il.M_Product_ID IS NOT NULL THEN il.LineNetAmt else 0 END AS LineNetAmt,
|
||
|
il.M_AttributeSetInstance_ID, asi.M_AttributeSet_ID, asi.SerNo, asi.Lot, asi.M_Lot_ID,asi.GuaranteeDate,
|
||
|
pt.Description as ProductDescription, p.ImageURL,
|
||
|
il.C_Campaign_ID, il.C_Project_ID, il.C_Activity_ID, il.C_ProjectPhase_ID, il.C_ProjectTask_ID
|
||
|
FROM C_InvoiceLine il
|
||
|
INNER JOIN C_UOM_Trl uom ON (il.C_UOM_ID=uom.C_UOM_ID)
|
||
|
INNER JOIN C_Invoice i ON (il.C_Invoice_ID=i.C_Invoice_ID)
|
||
|
LEFT OUTER JOIN C_Tax_Trl t ON (il.C_Tax_ID=t.C_Tax_ID AND uom.AD_Language=t.AD_Language)
|
||
|
LEFT OUTER JOIN M_Product p ON (il.M_Product_ID=p.M_Product_ID)
|
||
|
LEFT OUTER JOIN C_Charge c ON (il.C_Charge_ID=c.C_Charge_ID)
|
||
|
LEFT OUTER JOIN C_BPartner_Product pp ON (il.M_Product_ID=pp.M_Product_ID AND i.C_BPartner_ID=pp.C_BPartner_ID)
|
||
|
LEFT OUTER JOIN M_Product_Trl pt ON (il.M_Product_ID=pt.M_Product_ID AND uom.AD_Language=pt.AD_Language)
|
||
|
LEFT OUTER JOIN S_ResourceAssignment ra ON (il.S_ResourceAssignment_ID=ra.S_ResourceAssignment_ID)
|
||
|
LEFT OUTER JOIN M_AttributeSetInstance asi ON (il.M_AttributeSetInstance_ID=asi.M_AttributeSetInstance_ID)
|
||
|
UNION SELECT il.AD_Client_ID, il.AD_Org_ID, il.IsActive, il.Created, il.CreatedBy, il.Updated, il.UpdatedBy,
|
||
|
uom.AD_Language,
|
||
|
il.C_Invoice_ID, il.C_InvoiceLine_ID,
|
||
|
il.C_Tax_ID, il.TaxAmt, il.LineTotalAmt, t.TaxIndicator,
|
||
|
il.Line+(b.Line/100) AS Line,
|
||
|
il.QtyInvoiced*b.BOMQty AS QtyInvoiced,
|
||
|
il.QtyEntered*b.BOMQty AS QtyEntered,
|
||
|
uom.UOMSymbol,
|
||
|
COALESCE(pt.Name,p.Name) AS Name, b.Description,
|
||
|
COALESCE(pt.DocumentNote,p.DocumentNote) AS DocumentNote, p.UPC, p.SKU, p.Value AS ProductValue,
|
||
|
nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1),
|
||
|
il.M_AttributeSetInstance_ID, asi.M_AttributeSet_ID, asi.SerNo, asi.Lot, asi.M_Lot_ID,asi.GuaranteeDate,
|
||
|
pt.Description as ProductDescription, p.ImageURL,
|
||
|
il.C_Campaign_ID, il.C_Project_ID, il.C_Activity_ID, il.C_ProjectPhase_ID, il.C_ProjectTask_ID
|
||
|
FROM M_Product_BOM b INNER JOIN C_InvoiceLine il ON (b.M_Product_ID=il.M_Product_ID)
|
||
|
INNER JOIN M_Product bp ON (bp.M_Product_ID=il.M_Product_ID AND bp.IsBOM='Y' AND bp.IsVerified='Y' AND bp.IsInvoicePrintDetails='Y')
|
||
|
INNER JOIN M_Product p ON (b.M_ProductBOM_ID=p.M_Product_ID) INNER JOIN C_UOM_Trl uom ON (p.C_UOM_ID=uom.C_UOM_ID)
|
||
|
INNER JOIN M_Product_Trl pt ON (b.M_ProductBOM_ID=pt.M_Product_ID AND uom.AD_Language=pt.AD_Language)
|
||
|
LEFT OUTER JOIN C_Tax t ON (il.C_Tax_ID=t.C_Tax_ID)
|
||
|
LEFT OUTER JOIN M_AttributeSetInstance asi ON (il.M_AttributeSetInstance_ID=asi.M_AttributeSetInstance_ID)
|
||
|
UNION SELECT il.AD_Client_ID, il.AD_Org_ID, il.IsActive, il.Created, il.CreatedBy, il.Updated, il.UpdatedBy,
|
||
|
l.AD_Language, il.C_Invoice_ID, il.C_InvoiceLine_ID,
|
||
|
nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1),
|
||
|
il.Line,
|
||
|
nullif(1,1), nullif(1,1), nullif(1,1),
|
||
|
il.Description,
|
||
|
nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1),
|
||
|
nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1),
|
||
|
nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1),
|
||
|
nullif(1,1),nullif(1,1),nullif(1,1),nullif(1,1),nullif(1,1)
|
||
|
FROM C_InvoiceLine il, AD_Language l
|
||
|
WHERE il.C_UOM_ID IS NULL
|
||
|
AND l.IsBaseLanguage='N' AND l.IsSystemLanguage='Y'
|
||
|
UNION SELECT i.AD_Client_ID, i.AD_Org_ID, i.IsActive, i.Created, i.CreatedBy, i.Updated, i.UpdatedBy,
|
||
|
AD_Language, i.C_Invoice_ID, nullif(1,1),
|
||
|
nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1),
|
||
|
9998,
|
||
|
nullif(1,1), nullif(1,1), nullif(1,1),
|
||
|
nullif(1,1),
|
||
|
nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1),
|
||
|
nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1),
|
||
|
nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1),
|
||
|
nullif(1,1),nullif(1,1),nullif(1,1),nullif(1,1),nullif(1,1)
|
||
|
FROM C_Invoice i, AD_Language l
|
||
|
WHERE l.IsBaseLanguage='N' AND l.IsSystemLanguage='Y'
|
||
|
UNION SELECT it.AD_Client_ID, it.AD_Org_ID, it.IsActive, it.Created, it.CreatedBy, it.Updated, it.UpdatedBy,
|
||
|
t.AD_Language, it.C_Invoice_ID, nullif(1,1),
|
||
|
it.C_Tax_ID, nullif(1,1), nullif(1,1), t.TaxIndicator,
|
||
|
9999,
|
||
|
nullif(1,1), nullif(1,1), nullif(1,1),
|
||
|
t.Name,
|
||
|
nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1),
|
||
|
nullif(1,1), nullif(1,1), nullif(1,1),
|
||
|
CASE WHEN it.IsTaxIncluded='Y' THEN it.TaxAmt ELSE it.TaxBaseAmt END,
|
||
|
CASE WHEN it.IsTaxIncluded='Y' THEN it.TaxAmt ELSE it.TaxBaseAmt END,
|
||
|
CASE WHEN it.IsTaxIncluded='Y' THEN NULL ELSE it.TaxAmt END,
|
||
|
nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1),
|
||
|
nullif(1,1),nullif(1,1),nullif(1,1),nullif(1,1),nullif(1,1)
|
||
|
FROM C_InvoiceTax it
|
||
|
INNER JOIN C_Tax_Trl t ON (it.C_Tax_ID=t.C_Tax_ID)
|
||
|
|
||
|
SQL Exception: Types 'CHAR' and 'DECIMAL' are not type compatible. Neither type is assignable to the other type.
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
CREATE VIEW C_Order_LineTax_v
|
||
|
AS
|
||
|
SELECT ol.AD_Client_ID, ol.AD_Org_ID, ol.IsActive, ol.Created, ol.CreatedBy, ol.Updated, ol.UpdatedBy,
|
||
|
'en_US' AS AD_Language,
|
||
|
ol.C_Order_ID, ol.C_OrderLine_ID, ol.C_Tax_ID, t.TaxIndicator,
|
||
|
ol.C_BPartner_ID, ol.C_BPartner_Location_ID, bp.Name AS BPName, bpl.C_Location_ID,
|
||
|
ol.Line,
|
||
|
CASE WHEN ol.QtyOrdered<>0 OR ol.M_Product_ID IS NOT NULL THEN ol.QtyOrdered else 0 END AS QtyOrdered,
|
||
|
CASE WHEN ol.QtyEntered<>0 OR ol.M_Product_ID IS NOT NULL THEN ol.QtyEntered else 0 END AS QtyEntered,
|
||
|
CASE WHEN ol.QtyEntered<>0 OR ol.M_Product_ID IS NOT NULL THEN uom.UOMSymbol END AS UOMSymbol,
|
||
|
COALESCE(c.Name,p.Name||productAttribute(ol.M_AttributeSetInstance_ID), ol.Description) AS Name, CASE WHEN COALESCE(c.Name,p.Name) IS NOT NULL THEN ol.Description END AS Description, p.DocumentNote, p.UPC, p.SKU, COALESCE(pp.VendorProductNo,p.Value) AS ProductValue,
|
||
|
ra.Description AS ResourceDescription, CASE WHEN i.IsDiscountPrinted='Y' AND ol.PriceList<>0
|
||
|
THEN ol.PriceList else 0 END AS PriceList,
|
||
|
CASE WHEN i.IsDiscountPrinted='Y' AND ol.PriceList<>0 AND ol.QtyEntered<>0
|
||
|
THEN ol.PriceList*ol.QtyOrdered/ol.QtyEntered else 0 END AS PriceEnteredList,
|
||
|
CASE WHEN i.IsDiscountPrinted='Y' AND ol.PriceList>ol.PriceActual AND ol.PriceList<>0
|
||
|
THEN (ol.PriceList-ol.PriceActual)/ol.PriceList*100 else 0 END AS Discount,
|
||
|
CASE WHEN ol.PriceActual<>0 OR ol.M_Product_ID IS NOT nullif(1,1) THEN ol.PriceActual else 0 END AS PriceActual,
|
||
|
CASE WHEN ol.PriceEntered<>0 OR ol.M_Product_ID IS NOT nullif(1,1) THEN ol.PriceEntered else 0 END AS PriceEntered,
|
||
|
CASE WHEN ol.LineNetAmt<>0 OR ol.M_Product_ID IS NOT nullif(1,1) THEN ol.LineNetAmt else 0 END AS LineNetAmt,
|
||
|
p.Description as ProductDescription, p.ImageURL,
|
||
|
ol.C_Campaign_ID, ol.C_Project_ID, ol.C_Activity_ID, ol.C_ProjectPhase_ID, ol.C_ProjectTask_ID
|
||
|
FROM C_OrderLine ol
|
||
|
INNER JOIN C_UOM uom ON (ol.C_UOM_ID=uom.C_UOM_ID)
|
||
|
INNER JOIN C_Order i ON (ol.C_Order_ID=i.C_Order_ID)
|
||
|
LEFT OUTER JOIN M_Product p ON (ol.M_Product_ID=p.M_Product_ID)
|
||
|
LEFT OUTER JOIN S_ResourceAssignment ra ON (ol.S_ResourceAssignment_ID=ra.S_ResourceAssignment_ID)
|
||
|
LEFT OUTER JOIN C_Charge c ON (ol.C_Charge_ID=c.C_Charge_ID)
|
||
|
LEFT OUTER JOIN C_BPartner_Product pp ON (ol.M_Product_ID=pp.M_Product_ID AND i.C_BPartner_ID=pp.C_BPartner_ID)
|
||
|
INNER JOIN C_BPartner bp ON (ol.C_BPartner_ID=bp.C_BPartner_ID)
|
||
|
INNER JOIN C_BPartner_Location bpl ON (ol.C_BPartner_Location_ID=bpl.C_BPartner_Location_ID)
|
||
|
LEFT OUTER JOIN C_Tax t ON (ol.C_Tax_ID=t.C_Tax_ID)
|
||
|
UNION
|
||
|
SELECT ol.AD_Client_ID, ol.AD_Org_ID, ol.IsActive, ol.Created, ol.CreatedBy, ol.Updated, ol.UpdatedBy,
|
||
|
'en_US' AS AD_Language,
|
||
|
ol.C_Order_ID, ol.C_OrderLine_ID, ol.C_Tax_ID, nullif(1,1),
|
||
|
nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1),
|
||
|
ol.Line+(b.Line/100) AS Line,
|
||
|
ol.QtyOrdered*b.BOMQty AS QtyInvoiced, ol.QtyEntered*b.BOMQty AS QtyEntered, uom.UOMSymbol,
|
||
|
p.Name, b.Description,
|
||
|
p.DocumentNote, p.UPC, p.SKU, p.Value AS ProductValue,
|
||
|
nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1), p.Description as ProductDescription, p.ImageURL,
|
||
|
ol.C_Campaign_ID, ol.C_Project_ID, ol.C_Activity_ID, ol.C_ProjectPhase_ID, ol.C_ProjectTask_ID
|
||
|
FROM M_Product_BOM b INNER JOIN C_OrderLine ol ON (b.M_Product_ID=ol.M_Product_ID)
|
||
|
INNER JOIN M_Product bp ON (bp.M_Product_ID=ol.M_Product_ID AND bp.IsBOM='Y' AND bp.IsVerified='Y' AND bp.IsInvoicePrintDetails='Y')
|
||
|
INNER JOIN M_Product p ON (b.M_ProductBOM_ID=p.M_Product_ID) INNER JOIN C_UOM uom ON (p.C_UOM_ID=uom.C_UOM_ID)
|
||
|
UNION
|
||
|
SELECT AD_Client_ID, AD_Org_ID, IsActive, Created, CreatedBy, Updated, UpdatedBy,
|
||
|
'en_US', C_Order_ID, nullif(1,1), nullif(1,1), nullif(1,1),
|
||
|
nullif(1,1),
|
||
|
nullif(1,1), nullif(1,1), nullif(1,1),
|
||
|
nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1),
|
||
|
nullif(1,1),
|
||
|
nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1),
|
||
|
nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1),
|
||
|
nullif(1,1),nullif(1,1),nullif(1,1),nullif(1,1),nullif(1,1)
|
||
|
FROM C_Order
|
||
|
UNION
|
||
|
SELECT ot.AD_Client_ID, ot.AD_Org_ID, ot.IsActive, ot.Created, ot.CreatedBy, ot.Updated, ot.UpdatedBy,
|
||
|
'en_US', ot.C_Order_ID, nullif(1,1), ot.C_Tax_ID, t.TaxIndicator,
|
||
|
nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1),
|
||
|
nullif(1,1),
|
||
|
nullif(1,1), nullif(1,1), nullif(1,1),
|
||
|
t.Name,
|
||
|
nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1), nullif(1,1),
|
||
|
nullif(1,1), nullif(1,1), nullif(1,1),
|
||
|
CASE WHEN ot.IsTaxIncluded='Y' THEN ot.TaxAmt ELSE ot.TaxBaseAmt END,
|
||
|
CASE WHEN ot.IsTaxIncluded='Y' THEN ot.TaxAmt ELSE ot.TaxBaseAmt END,
|
||
|
CASE WHEN ot.IsTaxIncluded='Y' THEN nullif(1,1) ELSE ot.TaxAmt END,
|
||
|
nullif(1,1), nullif(1,1),
|
||
|
nullif(1,1),nullif(1,1),nullif(1,1),nullif(1,1),nullif(1,1)
|
||
|
FROM C_OrderTax ot
|
||
|
INNER JOIN C_Tax t ON (ot.C_Tax_ID=t.C_Tax_ID)
|
||
|
|
||
|
SQL Exception: Types 'CHAR' and 'DECIMAL' are not type compatible. Neither type is assignable to the other type.
|
||
|
CREATE VIEW C_Order_LineTax_vt
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
reate VIEW M_InOut_Line_v
|
||
|
AS
|
||
|
SELECT iol.AD_Client_ID, iol.AD_Org_ID, iol.IsActive, iol.Created, iol.CreatedBy, iol.Updated, iol.UpdatedBy,
|
||
|
'en_US' AS AD_Language,
|
||
|
iol.M_InOut_ID, iol.M_InOutLine_ID,
|
||
|
iol.Line,
|
||
|
CASE WHEN iol.MovementQty<>0 OR iol.M_Product_ID IS NOT NULL THEN iol.MovementQty else 0 END AS MovementQty,
|
||
|
CASE WHEN iol.QtyEntered<>0 OR iol.M_Product_ID IS NOT NULL THEN iol.QtyEntered else 0 END AS QtyEntered,
|
||
|
CASE WHEN iol.MovementQty<>0 OR iol.M_Product_ID IS NOT NULL THEN uom.UOMSymbol END AS UOMSymbol,
|
||
|
ol.QtyOrdered, ol.QtyDelivered,
|
||
|
CASE WHEN iol.MovementQty<>0 OR iol.M_Product_ID IS NOT NULL THEN ol.QtyOrdered-ol.QtyDelivered else 0 END AS QtyBackOrdered,
|
||
|
COALESCE(p.Name||productAttribute(iol.M_AttributeSetInstance_ID), c.Name, iol.Description) AS Name, CASE WHEN COALESCE(c.Name,p.Name) IS NOT NULL THEN iol.Description END AS Description, p.DocumentNote, p.UPC, p.SKU, p.Value AS ProductValue,
|
||
|
iol.M_Locator_ID, l.M_Warehouse_ID, l.X, l.Y, l.Z,
|
||
|
iol.M_AttributeSetInstance_ID, asi.M_AttributeSet_ID, asi.SerNo, asi.Lot, asi.M_Lot_ID,asi.GuaranteeDate,
|
||
|
p.Description AS ProductDescription, p.ImageURL,
|
||
|
iol.C_Campaign_ID, iol.C_Project_ID, iol.C_Activity_ID, iol.C_ProjectPhase_ID, iol.C_ProjectTask_ID
|
||
|
FROM M_InOutLine iol
|
||
|
INNER JOIN C_UOM uom ON (iol.C_UOM_ID=uom.C_UOM_ID)
|
||
|
LEFT OUTER JOIN M_Product p ON (iol.M_Product_ID=p.M_Product_ID)
|
||
|
LEFT OUTER JOIN M_AttributeSetInstance asi ON (iol.M_AttributeSetInstance_ID=asi.M_AttributeSetInstance_ID)
|
||
|
LEFT OUTER JOIN M_Locator l ON (iol.M_Locator_ID=l.M_Locator_ID)
|
||
|
LEFT OUTER JOIN C_OrderLine ol ON (iol.C_OrderLine_ID=ol.C_OrderLine_ID)
|
||
|
LEFT OUTER JOIN C_Charge c ON (iol.C_Charge_ID=c.C_Charge_ID)
|
||
|
UNION SELECT iol.AD_Client_ID, iol.AD_Org_ID, iol.IsActive, iol.Created, iol.CreatedBy, iol.Updated, iol.UpdatedBy,
|
||
|
'en_US' AS AD_Language,
|
||
|
iol.M_InOut_ID, iol.M_InOutLine_ID,
|
||
|
iol.Line+(b.Line/100) AS Line,
|
||
|
iol.MovementQty*b.BOMQty AS QtyInvoiced, iol.QtyEntered*b.BOMQty AS QtyEntered, uom.UOMSymbol,
|
||
|
nullif(1,1), nullif(1,1), nullif(1,1),
|
||
|
p.Name, b.Description, p.DocumentNote, p.UPC, p.SKU, p.Value AS ProductValue,
|
||
|
iol.M_Locator_ID, l.M_Warehouse_ID, l.X, l.Y, l.Z,
|
||
|
iol.M_AttributeSetInstance_ID, asi.M_AttributeSet_ID, asi.SerNo, asi.Lot, asi.M_Lot_ID,asi.GuaranteeDate,
|
||
|
p.Description AS ProductDescription, p.ImageURL,
|
||
|
iol.C_Campaign_ID, iol.C_Project_ID, iol.C_Activity_ID, iol.C_ProjectPhase_ID, iol.C_ProjectTask_ID
|
||
|
FROM M_Product_BOM b INNER JOIN M_InOutLine iol ON (b.M_Product_ID=iol.M_Product_ID)
|
||
|
INNER JOIN M_Product bp ON (bp.M_Product_ID=iol.M_Product_ID AND bp.IsBOM='Y' AND bp.IsVerified='Y' AND bp.IsPickListPrintDetails='Y')
|
||
|
INNER JOIN M_Product p ON (b.M_ProductBOM_ID=p.M_Product_ID) INNER JOIN C_UOM uom ON (p.C_UOM_ID=uom.C_UOM_ID)
|
||
|
LEFT OUTER JOIN M_AttributeSetInstance asi ON (iol.M_AttributeSetInstance_ID=asi.M_AttributeSetInstance_ID)
|
||
|
LEFT OUTER JOIN M_Locator l ON (iol.M_Locator_ID=l.M_Locator_ID)
|
||
|
|
||
|
SQL Exception: The CREATE VIEW statement does not include a column list.
|
||
|
REATE VIEW M_InOut_Line_vt
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
CREATE VIEW RV_C_Invoice_CustomerVendQtr
|
||
|
AS
|
||
|
SELECT il.AD_Client_ID, il.AD_Org_ID,
|
||
|
il.C_BPartner_ID, po.C_BPartner_ID AS Vendor_ID,
|
||
|
il.Q_DateInvoiced AS DateInvoiced, SUM(LineNetAmt) AS LineNetAmt,
|
||
|
SUM(LineListAmt) AS LineListAmt,
|
||
|
SUM(LineLimitAmt) AS LineLimitAmt,
|
||
|
SUM(LineDiscountAmt) AS LineDiscountAmt,
|
||
|
CASE WHEN SUM(LineListAmt)=0 THEN 0 ELSE
|
||
|
CAST((SUM(LineListAmt)-SUM(LineNetAmt))/SUM(LineListAmt)*100 AS DECIMAL(15,5)) END AS LineDiscount,
|
||
|
SUM(LineOverLimitAmt) AS LineOverLimitAmt,
|
||
|
CASE WHEN SUM(LineNetAmt)=0 THEN 0 ELSE
|
||
|
100-CAST((SUM(LineNetAmt)-SUM(LineOverLimitAmt))/SUM(LineNetAmt)*100 AS DECIMAL(15,5)) END AS LineOverLimit,
|
||
|
SUM(QtyInvoiced) AS QtyInvoiced
|
||
|
FROM Temp_RV_C_Invoice_Day il
|
||
|
INNER JOIN M_Product_PO po ON (il.M_Product_ID=po.M_Product_ID)
|
||
|
WHERE il.IsSOTrx='Y'
|
||
|
GROUP BY il.AD_Client_ID, il.AD_Org_ID, il.C_BPartner_ID, po.C_BPartner_ID,
|
||
|
il.Q_DateInvoiced
|
||
|
|
||
|
SQL Exception: Column 'IL.M_PRODUCT_ID' is either not in any table in the FROM list or appears within a join specification and is outside the scope of the join specification or appears in a HAVING clause and is not in the GROUP BY list. If this is a CREATE or ALTER TABLE statement then 'IL.M_PRODUCT_ID' is not a column in the target table.
|
||
|
|
||
|
|
||
|
CREATE VIEW RV_C_Invoice_ProductMonth
|
||
|
AS
|
||
|
SELECT il.AD_Client_ID, il.AD_Org_ID, il.M_Product_ID,
|
||
|
il.MM_DateInvoiced AS DateInvoiced,
|
||
|
SUM(il.LineNetAmt) AS LineNetAmt,
|
||
|
SUM(il.LineListAmt) AS LineListAmt,
|
||
|
SUM(il.LineLimitAmt) AS LineLimitAmt,
|
||
|
SUM(il.LineDiscountAmt) AS LineDiscountAmt,
|
||
|
CASE WHEN SUM(LineListAmt)=0 THEN 0 ELSE
|
||
|
CAST((SUM(LineListAmt)-SUM(LineNetAmt))/SUM(LineListAmt)*100 AS DECIMAL(15,5)) END AS LineDiscount,
|
||
|
SUM(LineOverLimitAmt) AS LineOverLimitAmt,
|
||
|
CASE WHEN SUM(LineNetAmt)=0 THEN 0 ELSE
|
||
|
100-CAST((SUM(LineNetAmt)-SUM(LineOverLimitAmt))/SUM(LineNetAmt)*100 AS DECIMAL(15,5)) END AS LineOverLimit,
|
||
|
SUM(QtyInvoiced) AS QtyInvoiced, IsSOTrx
|
||
|
FROM Temp_RV_C_Invoice_Day il
|
||
|
GROUP BY il.AD_Client_ID, il.AD_Org_ID, il.M_Product_ID,
|
||
|
il.MM_DateInvoiced, IsSOTrx
|
||
|
|
||
|
SQL Exception: Column 'IL.M_PRODUCT_ID' is either not in any table in the FROM list or appears within a join specification and is outside the scope of the join specification or appears in a HAVING clause and is not in the GROUP BY list. If this is a CREATE or ALTER TABLE statement then 'IL.M_PRODUCT_ID' is not a column in the target table.
|
||
|
|
||
|
|
||
|
|
||
|
CREATE VIEW RV_C_Invoice_ProductQtr
|
||
|
AS
|
||
|
SELECT il.AD_Client_ID, il.AD_Org_ID, il.M_Product_ID,
|
||
|
il.Q_DateInvoiced AS DateInvoiced,
|
||
|
SUM(il.LineNetAmt) AS LineNetAmt,
|
||
|
SUM(il.LineListAmt) AS LineListAmt,
|
||
|
SUM(il.LineLimitAmt) AS LineLimitAmt,
|
||
|
SUM(il.LineDiscountAmt) AS LineDiscountAmt,
|
||
|
CASE WHEN SUM(LineListAmt)=0 THEN 0 ELSE
|
||
|
CAST((SUM(LineListAmt)-SUM(LineNetAmt))/SUM(LineListAmt)*100 AS DECIMAL(15,5)) END AS LineDiscount,
|
||
|
SUM(LineOverLimitAmt) AS LineOverLimitAmt,
|
||
|
CASE WHEN SUM(LineNetAmt)=0 THEN 0 ELSE
|
||
|
100-CAST((SUM(LineNetAmt)-SUM(LineOverLimitAmt))/SUM(LineNetAmt)*100 AS DECIMAL(15,5)) END AS LineOverLimit,
|
||
|
SUM(QtyInvoiced) AS QtyInvoiced, IsSOTrx
|
||
|
FROM Temp_RV_C_Invoice_Day il
|
||
|
GROUP BY il.AD_Client_ID, il.AD_Org_ID, il.M_Product_ID,
|
||
|
il.Q_DateInvoiced, IsSOTrx
|
||
|
|
||
|
SQL Exception: Column 'IL.M_PRODUCT_ID' is either not in any table in the FROM list or appears within a join specification and is outside the scope of the join specification or appears in a HAVING clause and is not in the GROUP BY list. If this is a CREATE or ALTER TABLE statement then 'IL.M_PRODUCT_ID' is not a column in the target table.
|
||
|
|
||
|
|
||
|
CREATE VIEW RV_C_Invoice_VendorMonth
|
||
|
AS
|
||
|
SELECT il.AD_Client_ID, il.AD_Org_ID,
|
||
|
po.C_BPartner_ID, il.M_Product_Category_ID,
|
||
|
il.MM_DateInvoiced AS DateInvoiced, SUM(LineNetAmt) AS LineNetAmt,
|
||
|
SUM(LineListAmt) AS LineListAmt,
|
||
|
SUM(LineLimitAmt) AS LineLimitAmt,
|
||
|
SUM(LineDiscountAmt) AS LineDiscountAmt,
|
||
|
CASE WHEN SUM(LineListAmt)=0 THEN 0 ELSE
|
||
|
CAST((SUM(LineListAmt)-SUM(LineNetAmt))/SUM(LineListAmt)*100 AS DECIMAL(15,5)) END AS LineDiscount,
|
||
|
SUM(LineOverLimitAmt) AS LineOverLimitAmt,
|
||
|
CASE WHEN SUM(LineNetAmt)=0 THEN 0 ELSE
|
||
|
100-CAST((SUM(LineNetAmt)-SUM(LineOverLimitAmt))/SUM(LineNetAmt)*100 AS DECIMAL(15,5)) END AS LineOverLimit,
|
||
|
SUM(QtyInvoiced) AS QtyInvoiced
|
||
|
FROM Temp_RV_C_Invoice_Day il
|
||
|
INNER JOIN M_Product_PO po ON (il.M_Product_ID=po.M_Product_ID)
|
||
|
WHERE il.IsSOTrx='Y'
|
||
|
GROUP BY il.AD_Client_ID, il.AD_Org_ID, po.C_BPartner_ID, il.M_Product_Category_ID,
|
||
|
il.MM_DateInvoiced
|
||
|
|
||
|
SQL Exception: Column 'IL.M_PRODUCT_ID' is either not in any table in the FROM list or appears within a join specification and is outside the scope of the join specification or appears in a HAVING clause and is not in the GROUP BY list. If this is a CREATE or ALTER TABLE statement then 'IL.M_PRODUCT_ID' is not a column in the target table.
|
||
|
|
||
|
|
||
|
|
||
|
CREATE VIEW RV_OpenItem
|
||
|
AS
|
||
|
SELECT i.AD_Org_ID, i.AD_Client_ID,
|
||
|
i.DocumentNo, i.C_Invoice_ID, i.C_Order_ID, i.C_BPartner_ID, i.IsSOTrx,
|
||
|
i.DateInvoiced,
|
||
|
p.NetDays,
|
||
|
paymentTermDueDate(i.C_PaymentTerm_ID, i.DateInvoiced) AS DueDate,
|
||
|
paymentTermDueDays(i.C_PaymentTerm_ID, i.DateInvoiced, getdate()) AS DaysDue,
|
||
|
addDays(i.DateInvoiced,p.DiscountDays) AS DiscountDate,
|
||
|
CAST(i.GrandTotal*p.Discount/100 AS DECIMAL(15,5)) 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, nullif(1,1) AS C_InvoicePaySchedule_ID,
|
||
|
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 invoiceOpen(i.C_Invoice_ID,0) <> 0
|
||
|
AND i.IsPayScheduleValid<>'Y'
|
||
|
AND i.DocStatus<>'DR'
|
||
|
UNION
|
||
|
SELECT i.AD_Org_ID, i.AD_Client_ID,
|
||
|
i.DocumentNo, i.C_Invoice_ID, i.C_Order_ID, i.C_BPartner_ID, i.IsSOTrx,
|
||
|
i.DateInvoiced,
|
||
|
daysBetween(ips.DueDate,i.DateInvoiced) AS NetDays,
|
||
|
ips.DueDate,
|
||
|
daysBetween(getdate(),ips.DueDate) AS DaysDue,
|
||
|
ips.DiscountDate,
|
||
|
ips.DiscountAmt,
|
||
|
ips.DueAmt AS GrandTotal,
|
||
|
invoicePaid(i.C_Invoice_ID, i.C_Currency_ID, 1) AS PaidAmt,
|
||
|
invoiceOpen(i.C_Invoice_ID, ips.C_InvoicePaySchedule_ID) AS OpenAmt,
|
||
|
i.C_Currency_ID, i.C_ConversionType_ID,
|
||
|
i.C_PaymentTerm_ID,
|
||
|
i.IsPayScheduleValid, ips.C_InvoicePaySchedule_ID,
|
||
|
i.C_Campaign_ID, i.C_Project_ID, i.C_Activity_ID
|
||
|
FROM RV_C_Invoice i
|
||
|
INNER JOIN C_InvoicePaySchedule ips ON (i.C_Invoice_ID=ips.C_Invoice_ID)
|
||
|
WHERE invoiceOpen(i.C_Invoice_ID,ips.C_InvoicePaySchedule_ID) <> 0
|
||
|
AND i.IsPayScheduleValid='Y'
|
||
|
AND i.DocStatus<>'DR'
|
||
|
AND ips.IsValid='Y'
|
||
|
|
||
|
SQL Exception: No method was found that matched the method call double org.compiere.sqlj.Invoice.paid(int, int, int), tried all combinations of object and primitive types and any possible type conversion for any parameters the method call may have. The method might exist but it is not public and/or static, or the parameter types are not method invocation convertible.
|
||
|
|
||
|
|
||
|
|
||
|
CREATE VIEW RV_Asset_SumMonth
|
||
|
AS
|
||
|
SELECT a.AD_Client_ID, a.AD_Org_ID, a.IsActive, a.Created, a.CreatedBy, a.Updated, a.UpdatedBy,
|
||
|
a.A_Asset_ID, a.A_Asset_Group_ID, a.M_Product_ID,
|
||
|
a.Value, a.Name, a.Description, a.Help,
|
||
|
a.GuaranteeDate, a.AssetServiceDate,
|
||
|
a.C_BPartner_ID, a.AD_User_ID, a.SerNo, a.Lot, a.VersionNo,
|
||
|
firstOf(ad.MovementDate, 'MM') AS MovementDate,
|
||
|
COUNT(A_ASSET_DELIVERY_ID) AS DeliveryCount
|
||
|
FROM temp_RV_Asset_SumMonth a
|
||
|
GROUP BY a.AD_Client_ID, a.AD_Org_ID, a.IsActive, a.Created, a.CreatedBy, a.Updated, a.UpdatedBy,
|
||
|
a.A_Asset_ID, a.A_Asset_Group_ID, a.M_Product_ID,
|
||
|
a.Value, a.Name, a.Description, a.Help,
|
||
|
a.GuaranteeDate, a.AssetServiceDate,
|
||
|
a.C_BPartner_ID, a.AD_User_ID, a.SerNo, a.Lot, a.VersionNo,
|
||
|
a.MovementDate
|
||
|
|
||
|
SQL Exception: Column 'AD.MOVEMENTDATE' is either not in any table in the FROM list or appears within a join specification and is outside the scope of the join specification or appears in a HAVING clause and is not in the GROUP BY list. If this is a CREATE or ALTER TABLE statement then 'AD.MOVEMENTDATE' is not a column in the target table.
|
||
|
|
||
|
|
||
|
CREATE VIEW RV_UnPosted
|
||
|
AS
|
||
|
SELECT AD_Client_ID, AD_Org_ID, Created, CreatedBy, Updated, UpdatedBy, IsActive,
|
||
|
DocumentNo, DateDoc, DateAcct, 224 AS AD_Table_ID, GL_Journal_ID AS Record_ID, 'N' AS IsSOTrx
|
||
|
FROM GL_Journal WHERE Posted<>'Y' AND DocStatus<>'VO'
|
||
|
UNION
|
||
|
SELECT pi.AD_Client_ID, pi.AD_Org_ID, pi.Created, pi.CreatedBy, pi.Updated, pi.UpdatedBy, pi. IsActive,
|
||
|
p.Name || '_' || getChars(pi.Line), pi.MovementDate, pi.MovementDate, 623, pi.C_ProjectIssue_ID, 'N'
|
||
|
FROM C_ProjectIssue pi INNER JOIN C_Project p ON (pi.C_Project_ID=p.C_Project_ID)
|
||
|
WHERE Posted<>'Y' UNION
|
||
|
SELECT AD_Client_ID, AD_Org_ID, Created, CreatedBy, Updated, UpdatedBy, IsActive,
|
||
|
DocumentNo, DateInvoiced, DateAcct, 318, C_Invoice_ID, IsSOTrx
|
||
|
FROM C_Invoice WHERE Posted<>'Y' AND DocStatus<>'VO'
|
||
|
UNION
|
||
|
SELECT AD_Client_ID, AD_Org_ID, Created, CreatedBy, Updated, UpdatedBy, IsActive,
|
||
|
DocumentNo, MovementDate, DateAcct, 319, M_InOut_ID, IsSOTrx
|
||
|
FROM M_InOut WHERE Posted<>'Y' AND DocStatus<>'VO'
|
||
|
UNION
|
||
|
SELECT AD_Client_ID, AD_Org_ID, Created, CreatedBy, Updated, UpdatedBy, IsActive,
|
||
|
DocumentNo, MovementDate, MovementDate, 321, M_Inventory_ID, 'N'
|
||
|
FROM M_Inventory WHERE Posted<>'Y' AND DocStatus<>'VO'
|
||
|
UNION
|
||
|
SELECT AD_Client_ID, AD_Org_ID, Created, CreatedBy, Updated, UpdatedBy, IsActive,
|
||
|
DocumentNo, MovementDate, MovementDate, 323, M_Movement_ID, 'N'
|
||
|
FROM M_Movement WHERE Posted<>'Y' AND DocStatus<>'VO'
|
||
|
UNION
|
||
|
SELECT AD_Client_ID, AD_Org_ID, Created, CreatedBy, Updated, UpdatedBy, IsActive,
|
||
|
Name, MovementDate, MovementDate, 325, M_Production_ID, 'N'
|
||
|
FROM M_Production WHERE Posted<>'Y' UNION
|
||
|
SELECT AD_Client_ID, AD_Org_ID, Created, CreatedBy, Updated, UpdatedBy, IsActive,
|
||
|
Name, StatementDate, DateAcct, 407, C_Cash_ID, 'N'
|
||
|
FROM C_Cash WHERE Posted<>'Y' AND DocStatus<>'VO'
|
||
|
UNION
|
||
|
SELECT AD_Client_ID, AD_Org_ID, Created, CreatedBy, Updated, UpdatedBy, IsActive,
|
||
|
DocumentNo, DateTrx, DateTrx, 335, C_Payment_ID, 'N'
|
||
|
FROM C_Payment WHERE Posted<>'Y' AND DocStatus<>'VO'
|
||
|
UNION
|
||
|
SELECT AD_Client_ID, AD_Org_ID, Created, CreatedBy, Updated, UpdatedBy, IsActive,
|
||
|
DocumentNo, DateTrx, DateTrx, 735, C_AllocationHdr_ID, 'N'
|
||
|
FROM C_AllocationHdr WHERE Posted<>'Y' AND DocStatus<>'VO'
|
||
|
UNION
|
||
|
SELECT AD_Client_ID, AD_Org_ID, Created, CreatedBy, Updated, UpdatedBy, IsActive,
|
||
|
Name, StatementDate, StatementDate, 392, C_BankStatement_ID, 'N'
|
||
|
FROM C_BankStatement WHERE Posted<>'Y' AND DocStatus<>'VO'
|
||
|
UNION
|
||
|
SELECT AD_Client_ID, AD_Org_ID, Created, CreatedBy, Updated, UpdatedBy, IsActive,
|
||
|
DocumentNo, DateTrx, DateTrx, 472, M_MatchInv_ID, 'N'
|
||
|
FROM M_MatchInv WHERE Posted<>'Y' UNION
|
||
|
SELECT AD_Client_ID, AD_Org_ID, Created, CreatedBy, Updated, UpdatedBy, IsActive,
|
||
|
DocumentNo, DateTrx, DateTrx, 473, M_MatchPO_ID, 'N'
|
||
|
FROM M_MatchPO WHERE Posted<>'Y' UNION
|
||
|
SELECT AD_Client_ID, AD_Org_ID, Created, CreatedBy, Updated, UpdatedBy, IsActive,
|
||
|
DocumentNo, DateOrdered, DateAcct, 259, C_Order_ID, IsSOTrx
|
||
|
FROM C_Order WHERE Posted<>'Y' AND DocStatus<>'VO'
|
||
|
UNION
|
||
|
SELECT AD_Client_ID, AD_Org_ID, Created, CreatedBy, Updated, UpdatedBy, IsActive,
|
||
|
DocumentNo, DateRequired, DateRequired, 702, M_Requisition_ID, 'N'
|
||
|
FROM M_Requisition WHERE Posted<>'Y' AND DocStatus<>'VO'
|
||
|
|
||
|
SQL Exception: No method was found that matched the method call org.compiere.sqlj.Adempiere.getChars(double), tried all combinations of object and primitive types and any possible type conversion for any parameters the method call may have. The method might exist but it is not public and/or static, or the parameter types are not method invocation convertible.
|
||
|
|
||
|
|
||
|
SQL Exception: No method was found that matched the method call double org.compiere.sqlj.Product.bomPriceList(int, int), tried all combinations of object and primitive types and any possible type conversion for any parameters the method call may have. The method might exist but it is not public and/or static, or the parameter types are not method invocation convertible.
|
||
|
|
||
|
|
||
|
CREATE VIEW RV_Storage
|
||
|
AS
|
||
|
SELECT s.AD_Client_ID, s.AD_Org_ID,
|
||
|
s.M_Product_ID,p.Value,p.Name,p.Description,p.UPC,p.SKU,
|
||
|
p.C_UOM_ID,p.M_Product_Category_ID,p.Classification, p.Weight,p.Volume,p.VersionNo,
|
||
|
p.GuaranteeDays,p.GuaranteeDaysMin,
|
||
|
s.M_Locator_ID, l.M_Warehouse_ID, l.X, l.Y, l.Z,
|
||
|
s.QtyOnHand, s.QtyReserved, s.QtyOnHand-s.QtyReserved AS QtyAvailable,
|
||
|
s.QtyOrdered, s.DateLastInventory,
|
||
|
s.M_AttributeSetInstance_ID, asi.M_AttributeSet_ID, asi.SerNo, asi.Lot, asi.M_Lot_ID,
|
||
|
asi.GuaranteeDate, daysBetween(asi.GuaranteeDate,getdate()) AS ShelfLifeDays,
|
||
|
daysBetween(asi.GuaranteeDate,getdate())-p.GuaranteeDaysMin AS GoodForDays,
|
||
|
CAST((daysBetween(asi.GuaranteeDate,getdate())/p.GuaranteeDays)*100,0) AS ShelfLifeRemainingPct
|
||
|
FROM M_Storage s
|
||
|
INNER JOIN M_Locator l ON (s.M_Locator_ID=l.M_Locator_ID)
|
||
|
INNER JOIN M_Product p ON (s.M_Product_ID=p.M_Product_ID)
|
||
|
LEFT OUTER JOIN M_AttributeSetInstance asi ON (s.M_AttributeSetInstance_ID=asi.M_AttributeSetInstance_ID)
|
||
|
|
||
|
SQL Exception: Syntax error: Encountered "," at line 13, column 72.
|
||
|
|
||
|
|
||
|
CREATE VIEW RV_Click_Month
|
||
|
AS
|
||
|
SELECT cc.AD_Client_ID, cc.AD_Org_ID,
|
||
|
cc.Name, cc.Description, cc.TargetURL, cc.C_BPartner_ID,
|
||
|
firstOf(c.Created,'MM') AS Created,
|
||
|
COUNT(w_click_id) AS Counter
|
||
|
FROM temp_RV_Click_Month cc
|
||
|
GROUP BY cc.AD_Client_ID, cc.AD_Org_ID,
|
||
|
cc.Name, cc.Description, cc.TargetURL, cc.C_BPartner_ID,
|
||
|
cc.created
|
||
|
|
||
|
SQL Exception: Column 'C.CREATED' is either not in any table in the FROM list or appears within a join specification and is outside the scope of the join specification or appears in a HAVING clause and is not in the GROUP BY list. If this is a CREATE or ALTER TABLE statement then 'C.CREATED' is not a column in the target table.
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
CREATE VIEW C_Invoice_Candidate_v
|
||
|
AS
|
||
|
SELECT
|
||
|
o.AD_Client_ID, o.AD_Org_ID, o.C_BPartner_ID, o.C_Order_ID,
|
||
|
o.DocumentNo, o.DateOrdered, o.C_DocType_ID,
|
||
|
SUM((l.QtyOrdered-l.QtyInvoiced)*l.PriceActual) AS TotalLines
|
||
|
FROM C_Order o
|
||
|
INNER JOIN C_OrderLine l ON (o.C_Order_ID=l.C_Order_ID)
|
||
|
INNER JOIN C_BPartner bp ON (o.C_BPartner_ID=bp.C_BPartner_ID)
|
||
|
LEFT OUTER JOIN C_InvoiceSchedule si ON (bp.C_InvoiceSchedule_ID=si.C_InvoiceSchedule_ID)
|
||
|
WHERE o.DocStatus IN ('CO','CL','IP') AND o.C_DocType_ID IN (SELECT C_DocType_ID FROM C_DocType
|
||
|
WHERE DocBaseType='SOO' AND DocSubTypeSO NOT IN ('ON','OB','WR'))
|
||
|
AND l.QtyOrdered <> l.QtyInvoiced
|
||
|
AND (
|
||
|
o.InvoiceRule='I'
|
||
|
OR o.InvoiceRule='O'
|
||
|
OR (o.InvoiceRule='D' AND l.QtyInvoiced<>l.QtyDelivered)
|
||
|
OR (o.InvoiceRule='S' AND bp.C_InvoiceSchedule_ID IS NULL)
|
||
|
OR (o.InvoiceRule='S' AND bp.C_InvoiceSchedule_ID IS NOT NULL AND
|
||
|
(
|
||
|
(si.InvoiceFrequency IS NULL OR si.InvoiceFrequency='D')
|
||
|
OR (si.InvoiceFrequency='W')
|
||
|
OR (si.InvoiceFrequency='T'
|
||
|
AND ((TRUNC(o.DateOrdered) <= firstOf(getdate(),'MM')+si.InvoiceDayCutoff-1
|
||
|
AND TRUNC(getdate()) >= firstOf(o.DateOrdered,'MM')+si.InvoiceDay-1)
|
||
|
OR (TRUNC(o.DateOrdered) <= firstOf(getdate(),'MM')+si.InvoiceDayCutoff+14
|
||
|
AND TRUNC(getdate()) >= firstOf(o.DateOrdered,'MM')+si.InvoiceDay+14))
|
||
|
)
|
||
|
OR (si.InvoiceFrequency='M'
|
||
|
AND TRUNC(o.DateOrdered) <= firstOf(getdate(),'MM')+si.InvoiceDayCutoff-1 AND TRUNC(getdate()) >= firstOf(o.DateOrdered,'MM')+si.InvoiceDay-1) )
|
||
|
)
|
||
|
)
|
||
|
GROUP BY o.AD_Client_ID, o.AD_Org_ID, o.C_BPartner_ID, o.C_Order_ID,
|
||
|
o.DocumentNo, o.DateOrdered, o.C_DocType_ID
|
||
|
|
||
|
SQL Exception: The '+' operator with a left operand type of 'TIMESTAMP' and a right operand type of 'DECIMAL' is not supported.
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
SQL Exception: No method was found that matched the method call double org.compiere.sqlj.Payment.allocated(int, int), tried all combinations of object and primitive types and any possible type conversion for any parameters the method call may have. The method might exist but it is not public and/or static, or the parameter types are not method invocation convertible.
|
||
|
|
||
|
|
||
|
CREATE VIEW temp_RV_Fact_Acct_Day
|
||
|
AS
|
||
|
SELECT AD_Client_ID, AD_Org_ID,
|
||
|
C_AcctSchema_ID, Account_ID, firstOf(DD_DateAcct, 'DD') AS DateAcct, C_Period_ID,
|
||
|
GL_Category_ID, GL_Budget_ID, C_Tax_ID, M_Locator_ID,
|
||
|
PostingType, C_Currency_ID,
|
||
|
AmtSourceDr, AmtSourceCr,
|
||
|
AmtAcctDr, AmtAcctCr,
|
||
|
M_Product_ID, C_BPartner_ID, AD_OrgTrx_ID, C_LocFrom_ID, C_LocTo_ID, C_SalesRegion_ID,
|
||
|
C_Project_ID, C_Campaign_ID, C_Activity_ID, User1_ID, User2_ID, A_Asset_ID
|
||
|
FROM Fact_Acct
|
||
|
|
||
|
SQL Exception: Column 'DD_DATEACCT' is either not in any table in the FROM list or appears within a join specification and is outside the scope of the join specification or appears in a HAVING clause and is not in the GROUP BY list. If this is a CREATE or ALTER TABLE statement then 'DD_DATEACCT' is not a column in the target table.
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
CREATE VIEW RV_Fact_Acct_Day
|
||
|
AS
|
||
|
SELECT AD_Client_ID, AD_Org_ID,
|
||
|
C_AcctSchema_ID, Account_ID, DateAcct, C_Period_ID,
|
||
|
GL_Category_ID, GL_Budget_ID, C_Tax_ID, M_Locator_ID,
|
||
|
PostingType, C_Currency_ID,
|
||
|
SUM(AmtSourceDr) AS AmtSourceDr, SUM(AmtSourceCr) AS AmtSourceCr, SUM(AmtSourceDr - AmtSourceCr) AS AmtSource,
|
||
|
SUM(AmtAcctDr) AS AmtAcctDr, SUM(AmtAcctCr) AS AmtAcctCr, SUM(AmtAcctDr - AmtAcctCr) AS AmtAcct,
|
||
|
CASE WHEN SUM(AmtSourceDr - AmtSourceCr) = 0 THEN 0 ELSE
|
||
|
SUM(AmtAcctDr - AmtAcctCr) / SUM(AmtSourceDr - AmtSourceCr) END AS Rate,
|
||
|
M_Product_ID, C_BPartner_ID, AD_OrgTrx_ID, C_LocFrom_ID, C_LocTo_ID, C_SalesRegion_ID,
|
||
|
C_Project_ID, C_Campaign_ID, C_Activity_ID, User1_ID, User2_ID, A_Asset_ID
|
||
|
FROM temp_Fact_Acct
|
||
|
GROUP BY AD_Client_ID, AD_Org_ID,
|
||
|
C_AcctSchema_ID, Account_ID, DateAcct, C_Period_ID,
|
||
|
GL_Category_ID, GL_Budget_ID, C_Tax_ID, M_Locator_ID,
|
||
|
PostingType, C_Currency_ID,
|
||
|
M_Product_ID, C_BPartner_ID, AD_OrgTrx_ID, C_LocFrom_ID, C_LocTo_ID, C_SalesRegion_ID,
|
||
|
C_Project_ID, C_Campaign_ID, C_Activity_ID, User1_ID, User2_ID, A_Asset_ID
|
||
|
|
||
|
SQL Exception: Table 'TEMP_FACT_ACCT' does not exist.
|
||
|
|
||
|
|
||
|
|
||
|
SQL Exception: No method was found that matched the method call double org.compiere.sqlj.Invoice.open(int, int), tried all combinations of object and primitive types and any possible type conversion for any parameters the method call may have. The method might exist but it is not public and/or static, or the parameter types are not method invocation convertible.
|
||
|
|
||
|
|
||
|
|
||
|
CREATE VIEW RV_RequestUpdates
|
||
|
AS
|
||
|
SELECT
|
||
|
IsSelfService,
|
||
|
nullif(1,1) AS R_Group_ID, nullif(1,1) AS R_RequestType_ID, nullif(1,1) AS R_Category_ID
|
||
|
FROM R_RequestUpdates
|
||
|
UNION
|
||
|
SELECT
|
||
|
u.IsSelfService,
|
||
|
r.R_Group_ID, nullif(1,1), nullif(1,1)
|
||
|
FROM R_GroupUpdates u
|
||
|
INNER JOIN R_Request r ON (u.R_Group_ID=r.R_Group_ID)
|
||
|
UNION
|
||
|
SELECT
|
||
|
u.IsSelfService,
|
||
|
nullif(1,1), r.R_RequestType_ID, nullif(1,1)
|
||
|
FROM R_RequestTypeUpdates u
|
||
|
INNER JOIN R_Request r ON (u.R_RequestType_ID=r.R_RequestType_ID)
|
||
|
UNION
|
||
|
SELECT
|
||
|
u.IsSelfService,
|
||
|
nullif(1,1), nullif(1,1), r.R_Category_ID
|
||
|
FROM R_CategoryUpdates u
|
||
|
INNER JOIN R_Request r ON (u.R_Category_ID=r.R_Category_ID)
|
||
|
UNION
|
||
|
SELECT
|
||
|
IsSelfService,
|
||
|
nullif(1,1), nullif(1,1), nullif(1,1)
|
||
|
FROM R_Request
|
||
|
WHERE AD_User_ID IS NOT NULL
|
||
|
UNION
|
||
|
SELECT
|
||
|
nullif('a','a'),
|
||
|
nullif(1,1), nullif(1,1), r.R_Category_ID
|
||
|
FROM AD_User u
|
||
|
INNER JOIN R_Request r ON (u.AD_User_ID=r.SalesRep_ID)
|
||
|
UNION
|
||
|
SELECT
|
||
|
nullif('a','a'),
|
||
|
nullif(1,1), nullif(1,1), nullif(1,1)
|
||
|
FROM R_Request r
|
||
|
INNER JOIN AD_User_Roles u ON (u.AD_Role_ID=r.AD_Role_ID)
|
||
|
|
||
|
SQL Exception: Types 'CHAR' and 'INTEGER' are not UNION compatible.
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|