IDEMPIERE-308 Performance: Replace with StringBuilder / Thanks to Richard Morales and David Peñuela
This commit is contained in:
parent
bda4e5736d
commit
d9d27e6990
|
@ -108,8 +108,8 @@ public class LanguageMaintenance extends SvrProcess
|
|||
m_language.saveEx();
|
||||
}
|
||||
}
|
||||
|
||||
return "@Deleted@=" + deleteNo + " - @Inserted@=" + insertNo;
|
||||
StringBuilder msgreturn = new StringBuilder("@Deleted@=").append(deleteNo).append(" - @Inserted@=").append(insertNo);
|
||||
return msgreturn.toString();
|
||||
} // doIt
|
||||
|
||||
|
||||
|
|
|
@ -61,21 +61,21 @@ public class AD_PrintPaper_Default extends SvrProcess
|
|||
*/
|
||||
protected String doIt() throws Exception
|
||||
{
|
||||
StringBuffer sql = new StringBuffer("");
|
||||
StringBuilder sql = new StringBuilder();
|
||||
int cnt = 0;
|
||||
|
||||
log.info("Set Print Format");
|
||||
|
||||
try
|
||||
{
|
||||
sql.append("UPDATE AD_PrintFormat pf "
|
||||
+ "SET AD_PrintPaper_ID = " + p_Record_ID + " "
|
||||
+ "WHERE EXISTS (SELECT * FROM AD_PrintPaper pp "
|
||||
+ "WHERE pf.AD_PrintPaper_ID=pp.AD_PrintPaper_ID "
|
||||
+ "AND IsLandscape = (SELECT IsLandscape FROM AD_PrintPaper "
|
||||
+ "WHERE AD_PrintPaper_ID=" + p_Record_ID + "))");
|
||||
sql.append("UPDATE AD_PrintFormat pf ")
|
||||
.append("SET AD_PrintPaper_ID = ").append(p_Record_ID).append(" ")
|
||||
.append("WHERE EXISTS (SELECT * FROM AD_PrintPaper pp ")
|
||||
.append("WHERE pf.AD_PrintPaper_ID=pp.AD_PrintPaper_ID ")
|
||||
.append("AND IsLandscape = (SELECT IsLandscape FROM AD_PrintPaper ")
|
||||
.append("WHERE AD_PrintPaper_ID=").append(p_Record_ID).append("))");
|
||||
if (p_AD_Client_ID != -1) {
|
||||
sql.append(" AND AD_Client_ID = " + p_AD_Client_ID);
|
||||
sql.append(" AND AD_Client_ID = ").append(p_AD_Client_ID);
|
||||
}
|
||||
cnt = DB.executeUpdate(sql.toString(), get_TrxName());
|
||||
log.info("Updated " + cnt + " columns");
|
||||
|
|
|
@ -76,7 +76,7 @@ public class AcctSchemaDefaultCopy extends SvrProcess
|
|||
if (acct == null || acct.get_ID() == 0)
|
||||
throw new AdempiereSystemError("Default Not Found - C_AcctSchema_ID=" + p_C_AcctSchema_ID);
|
||||
|
||||
String sql = null;
|
||||
StringBuilder sql;
|
||||
int updated = 0;
|
||||
int created = 0;
|
||||
int updatedTotal = 0;
|
||||
|
@ -85,88 +85,88 @@ public class AcctSchemaDefaultCopy extends SvrProcess
|
|||
// Update existing Product Category
|
||||
if (p_CopyOverwriteAcct)
|
||||
{
|
||||
sql = "UPDATE M_Product_Category_Acct pa "
|
||||
+ "SET P_Revenue_Acct=" + acct.getP_Revenue_Acct()
|
||||
+ ", P_Expense_Acct=" + acct.getP_Expense_Acct()
|
||||
+ ", P_CostAdjustment_Acct=" + acct.getP_CostAdjustment_Acct()
|
||||
+ ", P_InventoryClearing_Acct=" + acct.getP_InventoryClearing_Acct()
|
||||
+ ", P_Asset_Acct=" + acct.getP_Asset_Acct()
|
||||
+ ", P_COGS_Acct=" + acct.getP_COGS_Acct()
|
||||
+ ", P_PurchasePriceVariance_Acct=" + acct.getP_PurchasePriceVariance_Acct()
|
||||
+ ", P_InvoicePriceVariance_Acct=" + acct.getP_InvoicePriceVariance_Acct()
|
||||
+ ", P_AverageCostVariance_Acct=" + acct.getP_AverageCostVariance_Acct()
|
||||
+ ", P_TradeDiscountRec_Acct=" + acct.getP_TradeDiscountRec_Acct()
|
||||
+ ", P_TradeDiscountGrant_Acct=" + acct.getP_TradeDiscountGrant_Acct()
|
||||
+ ", P_WIP_Acct=" + acct.getP_WIP_Acct()
|
||||
+ ", P_FloorStock_Acct=" + acct.getP_FloorStock_Acct()
|
||||
+ ", P_MethodChangeVariance_Acct=" + acct.getP_MethodChangeVariance_Acct()
|
||||
+ ", P_UsageVariance_Acct=" + acct.getP_UsageVariance_Acct()
|
||||
+ ", P_RateVariance_Acct=" + acct.getP_RateVariance_Acct()
|
||||
+ ", P_MixVariance_Acct=" + acct.getP_MixVariance_Acct()
|
||||
+ ", P_Labor_Acct=" + acct.getP_Labor_Acct()
|
||||
+ ", P_Burden_Acct=" + acct.getP_Burden_Acct()
|
||||
+ ", P_CostOfProduction_Acct=" + acct.getP_CostOfProduction_Acct()
|
||||
+ ", P_OutsideProcessing_Acct=" + acct.getP_OutsideProcessing_Acct()
|
||||
+ ", P_Overhead_Acct=" + acct.getP_Overhead_Acct()
|
||||
+ ", P_Scrap_Acct=" + acct.getP_Scrap_Acct()
|
||||
+ ", Updated=SysDate, UpdatedBy=0 "
|
||||
+ "WHERE pa.C_AcctSchema_ID=" + p_C_AcctSchema_ID
|
||||
+ " AND EXISTS (SELECT * FROM M_Product_Category p "
|
||||
+ "WHERE p.M_Product_Category_ID=pa.M_Product_Category_ID)";
|
||||
updated = DB.executeUpdate(sql, get_TrxName());
|
||||
sql = new StringBuilder("UPDATE M_Product_Category_Acct pa ")
|
||||
.append("SET P_Revenue_Acct=").append(acct.getP_Revenue_Acct())
|
||||
.append(", P_Expense_Acct=").append(acct.getP_Expense_Acct())
|
||||
.append(", P_CostAdjustment_Acct=").append(acct.getP_CostAdjustment_Acct())
|
||||
.append(", P_InventoryClearing_Acct=").append(acct.getP_InventoryClearing_Acct())
|
||||
.append(", P_Asset_Acct=").append(acct.getP_Asset_Acct())
|
||||
.append(", P_COGS_Acct=").append(acct.getP_COGS_Acct())
|
||||
.append(", P_PurchasePriceVariance_Acct=").append(acct.getP_PurchasePriceVariance_Acct())
|
||||
.append(", P_InvoicePriceVariance_Acct=").append(acct.getP_InvoicePriceVariance_Acct())
|
||||
.append(", P_AverageCostVariance_Acct=").append(acct.getP_AverageCostVariance_Acct())
|
||||
.append(", P_TradeDiscountRec_Acct=").append(acct.getP_TradeDiscountRec_Acct())
|
||||
.append(", P_TradeDiscountGrant_Acct=").append(acct.getP_TradeDiscountGrant_Acct())
|
||||
.append(", P_WIP_Acct=").append(acct.getP_WIP_Acct())
|
||||
.append(", P_FloorStock_Acct=").append(acct.getP_FloorStock_Acct())
|
||||
.append(", P_MethodChangeVariance_Acct=").append(acct.getP_MethodChangeVariance_Acct())
|
||||
.append(", P_UsageVariance_Acct=").append(acct.getP_UsageVariance_Acct())
|
||||
.append(", P_RateVariance_Acct=").append(acct.getP_RateVariance_Acct())
|
||||
.append(", P_MixVariance_Acct=").append(acct.getP_MixVariance_Acct())
|
||||
.append(", P_Labor_Acct=").append(acct.getP_Labor_Acct())
|
||||
.append(", P_Burden_Acct=").append(acct.getP_Burden_Acct())
|
||||
.append(", P_CostOfProduction_Acct=").append(acct.getP_CostOfProduction_Acct())
|
||||
.append(", P_OutsideProcessing_Acct=").append(acct.getP_OutsideProcessing_Acct())
|
||||
.append(", P_Overhead_Acct=").append(acct.getP_Overhead_Acct())
|
||||
.append(", P_Scrap_Acct=").append(acct.getP_Scrap_Acct())
|
||||
.append(", Updated=SysDate, UpdatedBy=0 ")
|
||||
.append("WHERE pa.C_AcctSchema_ID=").append(p_C_AcctSchema_ID)
|
||||
.append(" AND EXISTS (SELECT * FROM M_Product_Category p ")
|
||||
.append("WHERE p.M_Product_Category_ID=pa.M_Product_Category_ID)");
|
||||
updated = DB.executeUpdate(sql.toString(), get_TrxName());
|
||||
addLog(0, null, new BigDecimal(updated), "@Updated@ @M_Product_Category_ID@");
|
||||
updatedTotal += updated;
|
||||
}
|
||||
// Insert new Product Category
|
||||
sql = "INSERT INTO M_Product_Category_Acct "
|
||||
+ "(M_Product_Category_ID, C_AcctSchema_ID,"
|
||||
+ " AD_Client_ID, AD_Org_ID, IsActive, Created, CreatedBy, Updated, UpdatedBy,"
|
||||
+ " P_Revenue_Acct, P_Expense_Acct, P_CostAdjustment_Acct, P_InventoryClearing_Acct, P_Asset_Acct, P_CoGs_Acct,"
|
||||
+ " P_PurchasePriceVariance_Acct, P_InvoicePriceVariance_Acct, P_AverageCostVariance_Acct,"
|
||||
+ " P_TradeDiscountRec_Acct, P_TradeDiscountGrant_Acct,"
|
||||
+ " P_WIP_Acct,P_FloorStock_Acct,P_MethodChangeVariance_Acct,P_UsageVariance_Acct,P_RateVariance_Acct,"
|
||||
+ " P_MixVariance_Acct,P_Labor_Acct,P_Burden_Acct,P_CostOfProduction_Acct,P_OutsideProcessing_Acct,P_Overhead_Acct,P_Scrap_Acct) "
|
||||
+ " SELECT p.M_Product_Category_ID, acct.C_AcctSchema_ID,"
|
||||
+ " p.AD_Client_ID, p.AD_Org_ID, 'Y', SysDate, 0, SysDate, 0,"
|
||||
+ " acct.P_Revenue_Acct, acct.P_Expense_Acct, acct.P_CostAdjustment_Acct, acct.P_InventoryClearing_Acct, acct.P_Asset_Acct, acct.P_CoGs_Acct,"
|
||||
+ " acct.P_PurchasePriceVariance_Acct, acct.P_InvoicePriceVariance_Acct, acct.P_AverageCostVariance_Acct,"
|
||||
+ " acct.P_TradeDiscountRec_Acct, acct.P_TradeDiscountGrant_Acct,"
|
||||
+ " acct.P_WIP_Acct,acct.P_FloorStock_Acct,acct.P_MethodChangeVariance_Acct,acct.P_UsageVariance_Acct,acct.P_RateVariance_Acct,"
|
||||
+ " acct.P_MixVariance_Acct,acct.P_Labor_Acct,acct.P_Burden_Acct,acct.P_CostOfProduction_Acct,acct.P_OutsideProcessing_Acct,P_Overhead_Acct,P_Scrap_Acct "
|
||||
+ "FROM M_Product_Category p"
|
||||
+ " INNER JOIN C_AcctSchema_Default acct ON (p.AD_Client_ID=acct.AD_Client_ID) "
|
||||
+ "WHERE acct.C_AcctSchema_ID=" + p_C_AcctSchema_ID
|
||||
+ " AND NOT EXISTS (SELECT * FROM M_Product_Category_Acct pa "
|
||||
+ "WHERE pa.M_Product_Category_ID=p.M_Product_Category_ID"
|
||||
+ " AND pa.C_AcctSchema_ID=acct.C_AcctSchema_ID)";
|
||||
created = DB.executeUpdate(sql, get_TrxName());
|
||||
sql = new StringBuilder("INSERT INTO M_Product_Category_Acct ")
|
||||
.append("(M_Product_Category_ID, C_AcctSchema_ID,")
|
||||
.append(" AD_Client_ID, AD_Org_ID, IsActive, Created, CreatedBy, Updated, UpdatedBy,")
|
||||
.append(" P_Revenue_Acct, P_Expense_Acct, P_CostAdjustment_Acct, P_InventoryClearing_Acct, P_Asset_Acct, P_CoGs_Acct,")
|
||||
.append(" P_PurchasePriceVariance_Acct, P_InvoicePriceVariance_Acct, P_AverageCostVariance_Acct,")
|
||||
.append(" P_TradeDiscountRec_Acct, P_TradeDiscountGrant_Acct," )
|
||||
.append(" P_WIP_Acct,P_FloorStock_Acct,P_MethodChangeVariance_Acct,P_UsageVariance_Acct,P_RateVariance_Acct,")
|
||||
.append(" P_MixVariance_Acct,P_Labor_Acct,P_Burden_Acct,P_CostOfProduction_Acct,P_OutsideProcessing_Acct,P_Overhead_Acct,P_Scrap_Acct) ")
|
||||
.append(" SELECT p.M_Product_Category_ID, acct.C_AcctSchema_ID,")
|
||||
.append(" p.AD_Client_ID, p.AD_Org_ID, 'Y', SysDate, 0, SysDate, 0,")
|
||||
.append(" acct.P_Revenue_Acct, acct.P_Expense_Acct, acct.P_CostAdjustment_Acct, acct.P_InventoryClearing_Acct, acct.P_Asset_Acct, acct.P_CoGs_Acct,")
|
||||
.append(" acct.P_PurchasePriceVariance_Acct, acct.P_InvoicePriceVariance_Acct, acct.P_AverageCostVariance_Acct,")
|
||||
.append(" acct.P_TradeDiscountRec_Acct, acct.P_TradeDiscountGrant_Acct,")
|
||||
.append(" acct.P_WIP_Acct,acct.P_FloorStock_Acct,acct.P_MethodChangeVariance_Acct,acct.P_UsageVariance_Acct,acct.P_RateVariance_Acct,")
|
||||
.append(" acct.P_MixVariance_Acct,acct.P_Labor_Acct,acct.P_Burden_Acct,acct.P_CostOfProduction_Acct,acct.P_OutsideProcessing_Acct,P_Overhead_Acct,P_Scrap_Acct ")
|
||||
.append("FROM M_Product_Category p")
|
||||
.append(" INNER JOIN C_AcctSchema_Default acct ON (p.AD_Client_ID=acct.AD_Client_ID) ")
|
||||
.append("WHERE acct.C_AcctSchema_ID=").append(p_C_AcctSchema_ID)
|
||||
.append(" AND NOT EXISTS (SELECT * FROM M_Product_Category_Acct pa ")
|
||||
.append("WHERE pa.M_Product_Category_ID=p.M_Product_Category_ID")
|
||||
.append(" AND pa.C_AcctSchema_ID=acct.C_AcctSchema_ID)");
|
||||
created = DB.executeUpdate(sql.toString(), get_TrxName());
|
||||
addLog(0, null, new BigDecimal(created), "@Created@ @M_Product_Category_ID@");
|
||||
createdTotal += created;
|
||||
if (!p_CopyOverwriteAcct) // Insert new Products
|
||||
{
|
||||
sql = "INSERT INTO M_Product_Acct "
|
||||
+ "(M_Product_ID, C_AcctSchema_ID,"
|
||||
+ " AD_Client_ID, AD_Org_ID, IsActive, Created, CreatedBy, Updated, UpdatedBy,"
|
||||
+ " P_Revenue_Acct, P_Expense_Acct, P_CostAdjustment_Acct, P_InventoryClearing_Acct, P_Asset_Acct, P_CoGs_Acct,"
|
||||
+ " P_PurchasePriceVariance_Acct, P_InvoicePriceVariance_Acct, P_AverageCostVariance_Acct,"
|
||||
+ " P_TradeDiscountRec_Acct, P_TradeDiscountGrant_Acct, "
|
||||
+ " P_WIP_Acct,P_FloorStock_Acct,P_MethodChangeVariance_Acct,P_UsageVariance_Acct,P_RateVariance_Acct,"
|
||||
+ " P_MixVariance_Acct,P_Labor_Acct,P_Burden_Acct,P_CostOfProduction_Acct,P_OutsideProcessing_Acct,P_Overhead_Acct,P_Scrap_Acct) "
|
||||
+ "SELECT p.M_Product_ID, acct.C_AcctSchema_ID,"
|
||||
+ " p.AD_Client_ID, p.AD_Org_ID, 'Y', SysDate, 0, SysDate, 0,"
|
||||
+ " acct.P_Revenue_Acct, acct.P_Expense_Acct, acct.P_CostAdjustment_Acct, acct.P_InventoryClearing_Acct, acct.P_Asset_Acct, acct.P_CoGs_Acct,"
|
||||
+ " acct.P_PurchasePriceVariance_Acct, acct.P_InvoicePriceVariance_Acct, acct.P_AverageCostVariance_Acct,"
|
||||
+ " acct.P_TradeDiscountRec_Acct, acct.P_TradeDiscountGrant_Acct,"
|
||||
+ " acct.P_WIP_Acct,acct.P_FloorStock_Acct,acct.P_MethodChangeVariance_Acct,acct.P_UsageVariance_Acct,acct.P_RateVariance_Acct,"
|
||||
+ " acct.P_MixVariance_Acct,acct.P_Labor_Acct,acct.P_Burden_Acct,acct.P_CostOfProduction_Acct,acct.P_OutsideProcessing_Acct,acct.P_Overhead_Acct,acct.P_Scrap_Acct "
|
||||
+ "FROM M_Product p"
|
||||
+ " INNER JOIN M_Product_Category_Acct acct ON (acct.M_Product_Category_ID=p.M_Product_Category_ID)"
|
||||
+ "WHERE acct.C_AcctSchema_ID=" + p_C_AcctSchema_ID
|
||||
+ " AND p.M_Product_Category_ID=acct.M_Product_Category_ID"
|
||||
+ " AND NOT EXISTS (SELECT * FROM M_Product_Acct pa "
|
||||
+ "WHERE pa.M_Product_ID=p.M_Product_ID"
|
||||
+ " AND pa.C_AcctSchema_ID=acct.C_AcctSchema_ID)";
|
||||
created = DB.executeUpdate(sql, get_TrxName());
|
||||
sql = new StringBuilder("INSERT INTO M_Product_Acct ")
|
||||
.append("(M_Product_ID, C_AcctSchema_ID,")
|
||||
.append(" AD_Client_ID, AD_Org_ID, IsActive, Created, CreatedBy, Updated, UpdatedBy,")
|
||||
.append(" P_Revenue_Acct, P_Expense_Acct, P_CostAdjustment_Acct, P_InventoryClearing_Acct, P_Asset_Acct, P_CoGs_Acct,")
|
||||
.append(" P_PurchasePriceVariance_Acct, P_InvoicePriceVariance_Acct, P_AverageCostVariance_Acct,")
|
||||
.append(" P_TradeDiscountRec_Acct, P_TradeDiscountGrant_Acct, ")
|
||||
.append(" P_WIP_Acct,P_FloorStock_Acct,P_MethodChangeVariance_Acct,P_UsageVariance_Acct,P_RateVariance_Acct,")
|
||||
.append(" P_MixVariance_Acct,P_Labor_Acct,P_Burden_Acct,P_CostOfProduction_Acct,P_OutsideProcessing_Acct,P_Overhead_Acct,P_Scrap_Acct) ")
|
||||
.append("SELECT p.M_Product_ID, acct.C_AcctSchema_ID,")
|
||||
.append(" p.AD_Client_ID, p.AD_Org_ID, 'Y', SysDate, 0, SysDate, 0,")
|
||||
.append(" acct.P_Revenue_Acct, acct.P_Expense_Acct, acct.P_CostAdjustment_Acct, acct.P_InventoryClearing_Acct, acct.P_Asset_Acct, acct.P_CoGs_Acct,")
|
||||
.append(" acct.P_PurchasePriceVariance_Acct, acct.P_InvoicePriceVariance_Acct, acct.P_AverageCostVariance_Acct,")
|
||||
.append(" acct.P_TradeDiscountRec_Acct, acct.P_TradeDiscountGrant_Acct,")
|
||||
.append(" acct.P_WIP_Acct,acct.P_FloorStock_Acct,acct.P_MethodChangeVariance_Acct,acct.P_UsageVariance_Acct,acct.P_RateVariance_Acct,")
|
||||
.append(" acct.P_MixVariance_Acct,acct.P_Labor_Acct,acct.P_Burden_Acct,acct.P_CostOfProduction_Acct,acct.P_OutsideProcessing_Acct,acct.P_Overhead_Acct,acct.P_Scrap_Acct ")
|
||||
.append("FROM M_Product p")
|
||||
.append(" INNER JOIN M_Product_Category_Acct acct ON (acct.M_Product_Category_ID=p.M_Product_Category_ID)")
|
||||
.append("WHERE acct.C_AcctSchema_ID=").append(p_C_AcctSchema_ID)
|
||||
.append(" AND p.M_Product_Category_ID=acct.M_Product_Category_ID")
|
||||
.append(" AND NOT EXISTS (SELECT * FROM M_Product_Acct pa ")
|
||||
.append("WHERE pa.M_Product_ID=p.M_Product_ID")
|
||||
.append(" AND pa.C_AcctSchema_ID=acct.C_AcctSchema_ID)");
|
||||
created = DB.executeUpdate(sql.toString(), get_TrxName());
|
||||
addLog(0, null, new BigDecimal(created), "@Created@ @M_Product_ID@");
|
||||
createdTotal += created;
|
||||
}
|
||||
|
@ -175,51 +175,51 @@ public class AcctSchemaDefaultCopy extends SvrProcess
|
|||
// Update Business Partner Group
|
||||
if (p_CopyOverwriteAcct)
|
||||
{
|
||||
sql = "UPDATE C_BP_Group_Acct a "
|
||||
+ "SET C_Receivable_Acct=" + acct.getC_Receivable_Acct()
|
||||
+ ", C_Receivable_Services_Acct=" + acct.getC_Receivable_Services_Acct()
|
||||
+ ", C_Prepayment_Acct=" + acct.getC_Prepayment_Acct()
|
||||
+ ", V_Liability_Acct=" + acct.getV_Liability_Acct()
|
||||
+ ", V_Liability_Services_Acct=" + acct.getV_Liability_Services_Acct()
|
||||
+ ", V_Prepayment_Acct=" + acct.getV_Prepayment_Acct()
|
||||
+ ", PayDiscount_Exp_Acct=" + acct.getPayDiscount_Exp_Acct()
|
||||
+ ", PayDiscount_Rev_Acct=" + acct.getPayDiscount_Rev_Acct()
|
||||
+ ", WriteOff_Acct=" + acct.getWriteOff_Acct()
|
||||
+ ", NotInvoicedReceipts_Acct=" + acct.getNotInvoicedReceipts_Acct()
|
||||
+ ", UnEarnedRevenue_Acct=" + acct.getUnEarnedRevenue_Acct()
|
||||
+ ", NotInvoicedRevenue_Acct=" + acct.getNotInvoicedRevenue_Acct()
|
||||
+ ", NotInvoicedReceivables_Acct=" + acct.getNotInvoicedReceivables_Acct()
|
||||
+ ", Updated=SysDate, UpdatedBy=0 "
|
||||
+ "WHERE a.C_AcctSchema_ID=" + p_C_AcctSchema_ID
|
||||
+ " AND EXISTS (SELECT * FROM C_BP_Group_Acct x "
|
||||
+ "WHERE x.C_BP_Group_ID=a.C_BP_Group_ID)";
|
||||
updated = DB.executeUpdate(sql, get_TrxName());
|
||||
sql = new StringBuilder("UPDATE C_BP_Group_Acct a ")
|
||||
.append("SET C_Receivable_Acct=").append(acct.getC_Receivable_Acct())
|
||||
.append(", C_Receivable_Services_Acct=").append(acct.getC_Receivable_Services_Acct())
|
||||
.append(", C_Prepayment_Acct=").append(acct.getC_Prepayment_Acct())
|
||||
.append(", V_Liability_Acct=").append(acct.getV_Liability_Acct())
|
||||
.append(", V_Liability_Services_Acct=").append(acct.getV_Liability_Services_Acct())
|
||||
.append(", V_Prepayment_Acct=").append(acct.getV_Prepayment_Acct())
|
||||
.append(", PayDiscount_Exp_Acct=").append(acct.getPayDiscount_Exp_Acct())
|
||||
.append(", PayDiscount_Rev_Acct=").append(acct.getPayDiscount_Rev_Acct())
|
||||
.append(", WriteOff_Acct=").append(acct.getWriteOff_Acct())
|
||||
.append(", NotInvoicedReceipts_Acct=").append(acct.getNotInvoicedReceipts_Acct())
|
||||
.append(", UnEarnedRevenue_Acct=").append(acct.getUnEarnedRevenue_Acct())
|
||||
.append(", NotInvoicedRevenue_Acct=").append(acct.getNotInvoicedRevenue_Acct())
|
||||
.append(", NotInvoicedReceivables_Acct=").append(acct.getNotInvoicedReceivables_Acct())
|
||||
.append(", Updated=SysDate, UpdatedBy=0 ")
|
||||
.append("WHERE a.C_AcctSchema_ID=").append(p_C_AcctSchema_ID)
|
||||
.append(" AND EXISTS (SELECT * FROM C_BP_Group_Acct x ")
|
||||
.append("WHERE x.C_BP_Group_ID=a.C_BP_Group_ID)");
|
||||
updated = DB.executeUpdate(sql.toString(), get_TrxName());
|
||||
addLog(0, null, new BigDecimal(updated), "@Updated@ @C_BP_Group_ID@");
|
||||
updatedTotal += updated;
|
||||
}
|
||||
// Insert Business Partner Group
|
||||
sql = "INSERT INTO C_BP_Group_Acct "
|
||||
+ "(C_BP_Group_ID, C_AcctSchema_ID,"
|
||||
+ " AD_Client_ID, AD_Org_ID, IsActive, Created, CreatedBy, Updated, UpdatedBy,"
|
||||
+ " C_Receivable_Acct, C_Receivable_Services_Acct, C_PrePayment_Acct,"
|
||||
+ " V_Liability_Acct, V_Liability_Services_Acct, V_PrePayment_Acct,"
|
||||
+ " PayDiscount_Exp_Acct, PayDiscount_Rev_Acct, WriteOff_Acct,"
|
||||
+ " NotInvoicedReceipts_Acct, UnEarnedRevenue_Acct,"
|
||||
+ " NotInvoicedRevenue_Acct, NotInvoicedReceivables_Acct) "
|
||||
+ "SELECT x.C_BP_Group_ID, acct.C_AcctSchema_ID,"
|
||||
+ " x.AD_Client_ID, x.AD_Org_ID, 'Y', SysDate, 0, SysDate, 0,"
|
||||
+ " acct.C_Receivable_Acct, acct.C_Receivable_Services_Acct, acct.C_PrePayment_Acct,"
|
||||
+ " acct.V_Liability_Acct, acct.V_Liability_Services_Acct, acct.V_PrePayment_Acct,"
|
||||
+ " acct.PayDiscount_Exp_Acct, acct.PayDiscount_Rev_Acct, acct.WriteOff_Acct,"
|
||||
+ " acct.NotInvoicedReceipts_Acct, acct.UnEarnedRevenue_Acct,"
|
||||
+ " acct.NotInvoicedRevenue_Acct, acct.NotInvoicedReceivables_Acct "
|
||||
+ "FROM C_BP_Group x"
|
||||
+ " INNER JOIN C_AcctSchema_Default acct ON (x.AD_Client_ID=acct.AD_Client_ID) "
|
||||
+ "WHERE acct.C_AcctSchema_ID=" + p_C_AcctSchema_ID
|
||||
+ " AND NOT EXISTS (SELECT * FROM C_BP_Group_Acct a "
|
||||
+ "WHERE a.C_BP_Group_ID=x.C_BP_Group_ID"
|
||||
+ " AND a.C_AcctSchema_ID=acct.C_AcctSchema_ID)";
|
||||
created = DB.executeUpdate(sql, get_TrxName());
|
||||
sql = new StringBuilder("INSERT INTO C_BP_Group_Acct ")
|
||||
.append("(C_BP_Group_ID, C_AcctSchema_ID,")
|
||||
.append(" AD_Client_ID, AD_Org_ID, IsActive, Created, CreatedBy, Updated, UpdatedBy,")
|
||||
.append(" C_Receivable_Acct, C_Receivable_Services_Acct, C_PrePayment_Acct,")
|
||||
.append(" V_Liability_Acct, V_Liability_Services_Acct, V_PrePayment_Acct,")
|
||||
.append(" PayDiscount_Exp_Acct, PayDiscount_Rev_Acct, WriteOff_Acct,")
|
||||
.append(" NotInvoicedReceipts_Acct, UnEarnedRevenue_Acct,")
|
||||
.append(" NotInvoicedRevenue_Acct, NotInvoicedReceivables_Acct) ")
|
||||
.append("SELECT x.C_BP_Group_ID, acct.C_AcctSchema_ID,")
|
||||
.append(" x.AD_Client_ID, x.AD_Org_ID, 'Y', SysDate, 0, SysDate, 0,")
|
||||
.append(" acct.C_Receivable_Acct, acct.C_Receivable_Services_Acct, acct.C_PrePayment_Acct,")
|
||||
.append(" acct.V_Liability_Acct, acct.V_Liability_Services_Acct, acct.V_PrePayment_Acct,")
|
||||
.append(" acct.PayDiscount_Exp_Acct, acct.PayDiscount_Rev_Acct, acct.WriteOff_Acct,")
|
||||
.append(" acct.NotInvoicedReceipts_Acct, acct.UnEarnedRevenue_Acct,")
|
||||
.append(" acct.NotInvoicedRevenue_Acct, acct.NotInvoicedReceivables_Acct ")
|
||||
.append("FROM C_BP_Group x")
|
||||
.append(" INNER JOIN C_AcctSchema_Default acct ON (x.AD_Client_ID=acct.AD_Client_ID) ")
|
||||
.append("WHERE acct.C_AcctSchema_ID=").append(p_C_AcctSchema_ID)
|
||||
.append(" AND NOT EXISTS (SELECT * FROM C_BP_Group_Acct a ")
|
||||
.append("WHERE a.C_BP_Group_ID=x.C_BP_Group_ID")
|
||||
.append(" AND a.C_AcctSchema_ID=acct.C_AcctSchema_ID)");
|
||||
created = DB.executeUpdate(sql.toString(), get_TrxName());
|
||||
addLog(0, null, new BigDecimal(created), "@Created@ @C_BP_Group_ID@");
|
||||
createdTotal += created;
|
||||
|
||||
|
@ -227,69 +227,69 @@ public class AcctSchemaDefaultCopy extends SvrProcess
|
|||
// Update Business Partner - Employee
|
||||
if (p_CopyOverwriteAcct)
|
||||
{
|
||||
sql = "UPDATE C_BP_Employee_Acct a "
|
||||
+ "SET E_Expense_Acct=" + acct.getE_Expense_Acct()
|
||||
+ ", E_Prepayment_Acct=" + acct.getE_Prepayment_Acct()
|
||||
+ ", Updated=SysDate, UpdatedBy=0 "
|
||||
+ "WHERE a.C_AcctSchema_ID=" + p_C_AcctSchema_ID
|
||||
+ " AND EXISTS (SELECT * FROM C_BP_Employee_Acct x "
|
||||
+ "WHERE x.C_BPartner_ID=a.C_BPartner_ID)";
|
||||
updated = DB.executeUpdate(sql, get_TrxName());
|
||||
sql = new StringBuilder("UPDATE C_BP_Employee_Acct a ")
|
||||
.append("SET E_Expense_Acct=").append(acct.getE_Expense_Acct())
|
||||
.append(", E_Prepayment_Acct=").append(acct.getE_Prepayment_Acct())
|
||||
.append(", Updated=SysDate, UpdatedBy=0 ")
|
||||
.append("WHERE a.C_AcctSchema_ID=").append(p_C_AcctSchema_ID)
|
||||
.append(" AND EXISTS (SELECT * FROM C_BP_Employee_Acct x ")
|
||||
.append("WHERE x.C_BPartner_ID=a.C_BPartner_ID)");
|
||||
updated = DB.executeUpdate(sql.toString(), get_TrxName());
|
||||
addLog(0, null, new BigDecimal(updated), "@Updated@ @C_BPartner_ID@ @IsEmployee@");
|
||||
updatedTotal += updated;
|
||||
}
|
||||
// Insert new Business Partner - Employee
|
||||
sql = "INSERT INTO C_BP_Employee_Acct "
|
||||
+ "(C_BPartner_ID, C_AcctSchema_ID,"
|
||||
+ " AD_Client_ID, AD_Org_ID, IsActive, Created, CreatedBy, Updated, UpdatedBy,"
|
||||
+ " E_Expense_Acct, E_Prepayment_Acct) "
|
||||
+ "SELECT x.C_BPartner_ID, acct.C_AcctSchema_ID,"
|
||||
+ " x.AD_Client_ID, x.AD_Org_ID, 'Y', SysDate, 0, SysDate, 0,"
|
||||
+ " acct.E_Expense_Acct, acct.E_Prepayment_Acct "
|
||||
+ "FROM C_BPartner x"
|
||||
+ " INNER JOIN C_AcctSchema_Default acct ON (x.AD_Client_ID=acct.AD_Client_ID) "
|
||||
+ "WHERE acct.C_AcctSchema_ID=" + p_C_AcctSchema_ID
|
||||
+ " AND NOT EXISTS (SELECT * FROM C_BP_Employee_Acct a "
|
||||
+ "WHERE a.C_BPartner_ID=x.C_BPartner_ID"
|
||||
+ " AND a.C_AcctSchema_ID=acct.C_AcctSchema_ID)";
|
||||
created = DB.executeUpdate(sql, get_TrxName());
|
||||
sql = new StringBuilder("INSERT INTO C_BP_Employee_Acct ")
|
||||
.append("(C_BPartner_ID, C_AcctSchema_ID,")
|
||||
.append(" AD_Client_ID, AD_Org_ID, IsActive, Created, CreatedBy, Updated, UpdatedBy,")
|
||||
.append(" E_Expense_Acct, E_Prepayment_Acct) ")
|
||||
.append("SELECT x.C_BPartner_ID, acct.C_AcctSchema_ID,")
|
||||
.append(" x.AD_Client_ID, x.AD_Org_ID, 'Y', SysDate, 0, SysDate, 0,")
|
||||
.append(" acct.E_Expense_Acct, acct.E_Prepayment_Acct ")
|
||||
.append("FROM C_BPartner x")
|
||||
.append(" INNER JOIN C_AcctSchema_Default acct ON (x.AD_Client_ID=acct.AD_Client_ID) ")
|
||||
.append("WHERE acct.C_AcctSchema_ID=").append(p_C_AcctSchema_ID)
|
||||
.append(" AND NOT EXISTS (SELECT * FROM C_BP_Employee_Acct a ")
|
||||
.append("WHERE a.C_BPartner_ID=x.C_BPartner_ID")
|
||||
.append(" AND a.C_AcctSchema_ID=acct.C_AcctSchema_ID)");
|
||||
created = DB.executeUpdate(sql.toString(), get_TrxName());
|
||||
addLog(0, null, new BigDecimal(created), "@Created@ @C_BPartner_ID@ @IsEmployee@");
|
||||
createdTotal += created;
|
||||
//
|
||||
if (!p_CopyOverwriteAcct)
|
||||
{
|
||||
sql = "INSERT INTO C_BP_Customer_Acct "
|
||||
+ "(C_BPartner_ID, C_AcctSchema_ID,"
|
||||
+ " AD_Client_ID, AD_Org_ID, IsActive, Created, CreatedBy, Updated, UpdatedBy,"
|
||||
+ " C_Receivable_Acct, C_Receivable_Services_Acct, C_PrePayment_Acct) "
|
||||
+ "SELECT p.C_BPartner_ID, acct.C_AcctSchema_ID,"
|
||||
+ " p.AD_Client_ID, p.AD_Org_ID, 'Y', SysDate, 0, SysDate, 0,"
|
||||
+ " acct.C_Receivable_Acct, acct.C_Receivable_Services_Acct, acct.C_PrePayment_Acct "
|
||||
+ "FROM C_BPartner p"
|
||||
+ " INNER JOIN C_BP_Group_Acct acct ON (acct.C_BP_Group_ID=p.C_BP_Group_ID)"
|
||||
+ "WHERE acct.C_AcctSchema_ID=" + p_C_AcctSchema_ID // #
|
||||
+ " AND p.C_BP_Group_ID=acct.C_BP_Group_ID"
|
||||
+ " AND NOT EXISTS (SELECT * FROM C_BP_Customer_Acct ca "
|
||||
+ "WHERE ca.C_BPartner_ID=p.C_BPartner_ID"
|
||||
+ " AND ca.C_AcctSchema_ID=acct.C_AcctSchema_ID)";
|
||||
created = DB.executeUpdate(sql, get_TrxName());
|
||||
sql = new StringBuilder("INSERT INTO C_BP_Customer_Acct ")
|
||||
.append("(C_BPartner_ID, C_AcctSchema_ID,")
|
||||
.append(" AD_Client_ID, AD_Org_ID, IsActive, Created, CreatedBy, Updated, UpdatedBy,")
|
||||
.append(" C_Receivable_Acct, C_Receivable_Services_Acct, C_PrePayment_Acct) ")
|
||||
.append("SELECT p.C_BPartner_ID, acct.C_AcctSchema_ID,")
|
||||
.append(" p.AD_Client_ID, p.AD_Org_ID, 'Y', SysDate, 0, SysDate, 0,")
|
||||
.append(" acct.C_Receivable_Acct, acct.C_Receivable_Services_Acct, acct.C_PrePayment_Acct ")
|
||||
.append("FROM C_BPartner p")
|
||||
.append(" INNER JOIN C_BP_Group_Acct acct ON (acct.C_BP_Group_ID=p.C_BP_Group_ID)")
|
||||
.append("WHERE acct.C_AcctSchema_ID=").append(p_C_AcctSchema_ID) // #
|
||||
.append(" AND p.C_BP_Group_ID=acct.C_BP_Group_ID")
|
||||
.append(" AND NOT EXISTS (SELECT * FROM C_BP_Customer_Acct ca ")
|
||||
.append("WHERE ca.C_BPartner_ID=p.C_BPartner_ID")
|
||||
.append(" AND ca.C_AcctSchema_ID=acct.C_AcctSchema_ID)");
|
||||
created = DB.executeUpdate(sql.toString(), get_TrxName());
|
||||
addLog(0, null, new BigDecimal(created), "@Created@ @C_BPartner_ID@ @IsCustomer@");
|
||||
createdTotal += created;
|
||||
//
|
||||
sql = "INSERT INTO C_BP_Vendor_Acct "
|
||||
+ "(C_BPartner_ID, C_AcctSchema_ID,"
|
||||
+ " AD_Client_ID, AD_Org_ID, IsActive, Created, CreatedBy, Updated, UpdatedBy,"
|
||||
+ " V_Liability_Acct, V_Liability_Services_Acct, V_PrePayment_Acct) "
|
||||
+ "SELECT p.C_BPartner_ID, acct.C_AcctSchema_ID,"
|
||||
+ " p.AD_Client_ID, p.AD_Org_ID, 'Y', SysDate, 0, SysDate, 0,"
|
||||
+ " acct.V_Liability_Acct, acct.V_Liability_Services_Acct, acct.V_PrePayment_Acct "
|
||||
+ "FROM C_BPartner p"
|
||||
+ " INNER JOIN C_BP_Group_Acct acct ON (acct.C_BP_Group_ID=p.C_BP_Group_ID)"
|
||||
+ "WHERE acct.C_AcctSchema_ID=" + p_C_AcctSchema_ID // #
|
||||
+ " AND p.C_BP_Group_ID=acct.C_BP_Group_ID"
|
||||
+ " AND NOT EXISTS (SELECT * FROM C_BP_Vendor_Acct va "
|
||||
+ "WHERE va.C_BPartner_ID=p.C_BPartner_ID AND va.C_AcctSchema_ID=acct.C_AcctSchema_ID)";
|
||||
created = DB.executeUpdate(sql, get_TrxName());
|
||||
sql = new StringBuilder("INSERT INTO C_BP_Vendor_Acct ")
|
||||
.append("(C_BPartner_ID, C_AcctSchema_ID,")
|
||||
.append(" AD_Client_ID, AD_Org_ID, IsActive, Created, CreatedBy, Updated, UpdatedBy,")
|
||||
.append(" V_Liability_Acct, V_Liability_Services_Acct, V_PrePayment_Acct) ")
|
||||
.append("SELECT p.C_BPartner_ID, acct.C_AcctSchema_ID,")
|
||||
.append(" p.AD_Client_ID, p.AD_Org_ID, 'Y', SysDate, 0, SysDate, 0,")
|
||||
.append(" acct.V_Liability_Acct, acct.V_Liability_Services_Acct, acct.V_PrePayment_Acct ")
|
||||
.append("FROM C_BPartner p")
|
||||
.append(" INNER JOIN C_BP_Group_Acct acct ON (acct.C_BP_Group_ID=p.C_BP_Group_ID)")
|
||||
.append("WHERE acct.C_AcctSchema_ID=").append(p_C_AcctSchema_ID) // #
|
||||
.append(" AND p.C_BP_Group_ID=acct.C_BP_Group_ID")
|
||||
.append(" AND NOT EXISTS (SELECT * FROM C_BP_Vendor_Acct va ")
|
||||
.append("WHERE va.C_BPartner_ID=p.C_BPartner_ID AND va.C_AcctSchema_ID=acct.C_AcctSchema_ID)");
|
||||
created = DB.executeUpdate(sql.toString(), get_TrxName());
|
||||
addLog(0, null, new BigDecimal(created), "@Created@ @C_BPartner_ID@ @IsVendor@");
|
||||
createdTotal += created;
|
||||
}
|
||||
|
@ -297,34 +297,34 @@ public class AcctSchemaDefaultCopy extends SvrProcess
|
|||
// Update Warehouse
|
||||
if (p_CopyOverwriteAcct)
|
||||
{
|
||||
sql = "UPDATE M_Warehouse_Acct a "
|
||||
+ "SET W_Inventory_Acct=" + acct.getW_Inventory_Acct()
|
||||
+ ", W_Differences_Acct=" + acct.getW_Differences_Acct()
|
||||
+ ", W_Revaluation_Acct=" + acct.getW_Revaluation_Acct()
|
||||
+ ", W_InvActualAdjust_Acct=" + acct.getW_InvActualAdjust_Acct()
|
||||
+ ", Updated=SysDate, UpdatedBy=0 "
|
||||
+ "WHERE a.C_AcctSchema_ID=" + p_C_AcctSchema_ID
|
||||
+ " AND EXISTS (SELECT * FROM M_Warehouse_Acct x "
|
||||
+ "WHERE x.M_Warehouse_ID=a.M_Warehouse_ID)";
|
||||
updated = DB.executeUpdate(sql, get_TrxName());
|
||||
sql = new StringBuilder("UPDATE M_Warehouse_Acct a ")
|
||||
.append("SET W_Inventory_Acct=").append(acct.getW_Inventory_Acct())
|
||||
.append(", W_Differences_Acct=").append(acct.getW_Differences_Acct())
|
||||
.append(", W_Revaluation_Acct=").append(acct.getW_Revaluation_Acct())
|
||||
.append(", W_InvActualAdjust_Acct=").append(acct.getW_InvActualAdjust_Acct())
|
||||
.append(", Updated=SysDate, UpdatedBy=0 ")
|
||||
.append("WHERE a.C_AcctSchema_ID=").append(p_C_AcctSchema_ID)
|
||||
.append(" AND EXISTS (SELECT * FROM M_Warehouse_Acct x ")
|
||||
.append("WHERE x.M_Warehouse_ID=a.M_Warehouse_ID)");
|
||||
updated = DB.executeUpdate(sql.toString(), get_TrxName());
|
||||
addLog(0, null, new BigDecimal(updated), "@Updated@ @M_Warehouse_ID@");
|
||||
updatedTotal += updated;
|
||||
}
|
||||
// Insert new Warehouse
|
||||
sql = "INSERT INTO M_Warehouse_Acct "
|
||||
+ "(M_Warehouse_ID, C_AcctSchema_ID,"
|
||||
+ " AD_Client_ID, AD_Org_ID, IsActive, Created, CreatedBy, Updated, UpdatedBy,"
|
||||
+ " W_Inventory_Acct, W_Differences_Acct, W_Revaluation_Acct, W_InvActualAdjust_Acct) "
|
||||
+ "SELECT x.M_Warehouse_ID, acct.C_AcctSchema_ID,"
|
||||
+ " x.AD_Client_ID, x.AD_Org_ID, 'Y', SysDate, 0, SysDate, 0,"
|
||||
+ " acct.W_Inventory_Acct, acct.W_Differences_Acct, acct.W_Revaluation_Acct, acct.W_InvActualAdjust_Acct "
|
||||
+ "FROM M_Warehouse x"
|
||||
+ " INNER JOIN C_AcctSchema_Default acct ON (x.AD_Client_ID=acct.AD_Client_ID) "
|
||||
+ "WHERE acct.C_AcctSchema_ID=" + p_C_AcctSchema_ID
|
||||
+ " AND NOT EXISTS (SELECT * FROM M_Warehouse_Acct a "
|
||||
+ "WHERE a.M_Warehouse_ID=x.M_Warehouse_ID"
|
||||
+ " AND a.C_AcctSchema_ID=acct.C_AcctSchema_ID)";
|
||||
created = DB.executeUpdate(sql, get_TrxName());
|
||||
sql = new StringBuilder("INSERT INTO M_Warehouse_Acct ")
|
||||
.append("(M_Warehouse_ID, C_AcctSchema_ID,")
|
||||
.append(" AD_Client_ID, AD_Org_ID, IsActive, Created, CreatedBy, Updated, UpdatedBy,")
|
||||
.append(" W_Inventory_Acct, W_Differences_Acct, W_Revaluation_Acct, W_InvActualAdjust_Acct) ")
|
||||
.append("SELECT x.M_Warehouse_ID, acct.C_AcctSchema_ID,")
|
||||
.append(" x.AD_Client_ID, x.AD_Org_ID, 'Y', SysDate, 0, SysDate, 0,")
|
||||
.append(" acct.W_Inventory_Acct, acct.W_Differences_Acct, acct.W_Revaluation_Acct, acct.W_InvActualAdjust_Acct ")
|
||||
.append("FROM M_Warehouse x")
|
||||
.append(" INNER JOIN C_AcctSchema_Default acct ON (x.AD_Client_ID=acct.AD_Client_ID) ")
|
||||
.append("WHERE acct.C_AcctSchema_ID=").append(p_C_AcctSchema_ID)
|
||||
.append(" AND NOT EXISTS (SELECT * FROM M_Warehouse_Acct a ")
|
||||
.append("WHERE a.M_Warehouse_ID=x.M_Warehouse_ID")
|
||||
.append(" AND a.C_AcctSchema_ID=acct.C_AcctSchema_ID)");
|
||||
created = DB.executeUpdate(sql.toString(), get_TrxName());
|
||||
addLog(0, null, new BigDecimal(created), "@Created@ @M_Warehouse_ID@");
|
||||
createdTotal += created;
|
||||
|
||||
|
@ -332,32 +332,32 @@ public class AcctSchemaDefaultCopy extends SvrProcess
|
|||
// Update Project
|
||||
if (p_CopyOverwriteAcct)
|
||||
{
|
||||
sql = "UPDATE C_Project_Acct a "
|
||||
+ "SET PJ_Asset_Acct=" + acct.getPJ_Asset_Acct()
|
||||
+ ", PJ_WIP_Acct=" + acct.getPJ_Asset_Acct()
|
||||
+ ", Updated=SysDate, UpdatedBy=0 "
|
||||
+ "WHERE a.C_AcctSchema_ID=" + p_C_AcctSchema_ID
|
||||
+ " AND EXISTS (SELECT * FROM C_Project_Acct x "
|
||||
+ "WHERE x.C_Project_ID=a.C_Project_ID)";
|
||||
updated = DB.executeUpdate(sql, get_TrxName());
|
||||
sql = new StringBuilder("UPDATE C_Project_Acct a ")
|
||||
.append("SET PJ_Asset_Acct=").append(acct.getPJ_Asset_Acct())
|
||||
.append(", PJ_WIP_Acct=").append(acct.getPJ_Asset_Acct())
|
||||
.append(", Updated=SysDate, UpdatedBy=0 ")
|
||||
.append("WHERE a.C_AcctSchema_ID=").append(p_C_AcctSchema_ID)
|
||||
.append(" AND EXISTS (SELECT * FROM C_Project_Acct x ")
|
||||
.append("WHERE x.C_Project_ID=a.C_Project_ID)");
|
||||
updated = DB.executeUpdate(sql.toString(), get_TrxName());
|
||||
addLog(0, null, new BigDecimal(updated), "@Updated@ @C_Project_ID@");
|
||||
updatedTotal += updated;
|
||||
}
|
||||
// Insert new Projects
|
||||
sql = "INSERT INTO C_Project_Acct "
|
||||
+ "(C_Project_ID, C_AcctSchema_ID,"
|
||||
+ " AD_Client_ID, AD_Org_ID, IsActive, Created, CreatedBy, Updated, UpdatedBy,"
|
||||
+ " PJ_Asset_Acct, PJ_WIP_Acct) "
|
||||
+ "SELECT x.C_Project_ID, acct.C_AcctSchema_ID,"
|
||||
+ " x.AD_Client_ID, x.AD_Org_ID, 'Y', SysDate, 0, SysDate, 0,"
|
||||
+ " acct.PJ_Asset_Acct, acct.PJ_WIP_Acct "
|
||||
+ "FROM C_Project x"
|
||||
+ " INNER JOIN C_AcctSchema_Default acct ON (x.AD_Client_ID=acct.AD_Client_ID) "
|
||||
+ "WHERE acct.C_AcctSchema_ID=" + p_C_AcctSchema_ID
|
||||
+ " AND NOT EXISTS (SELECT * FROM C_Project_Acct a "
|
||||
+ "WHERE a.C_Project_ID=x.C_Project_ID"
|
||||
+ " AND a.C_AcctSchema_ID=acct.C_AcctSchema_ID)";
|
||||
created = DB.executeUpdate(sql, get_TrxName());
|
||||
sql = new StringBuilder("INSERT INTO C_Project_Acct ")
|
||||
.append("(C_Project_ID, C_AcctSchema_ID,")
|
||||
.append(" AD_Client_ID, AD_Org_ID, IsActive, Created, CreatedBy, Updated, UpdatedBy,")
|
||||
.append(" PJ_Asset_Acct, PJ_WIP_Acct) ")
|
||||
.append("SELECT x.C_Project_ID, acct.C_AcctSchema_ID,")
|
||||
.append(" x.AD_Client_ID, x.AD_Org_ID, 'Y', SysDate, 0, SysDate, 0,")
|
||||
.append(" acct.PJ_Asset_Acct, acct.PJ_WIP_Acct ")
|
||||
.append("FROM C_Project x")
|
||||
.append(" INNER JOIN C_AcctSchema_Default acct ON (x.AD_Client_ID=acct.AD_Client_ID) ")
|
||||
.append("WHERE acct.C_AcctSchema_ID=").append(p_C_AcctSchema_ID)
|
||||
.append(" AND NOT EXISTS (SELECT * FROM C_Project_Acct a ")
|
||||
.append("WHERE a.C_Project_ID=x.C_Project_ID")
|
||||
.append(" AND a.C_AcctSchema_ID=acct.C_AcctSchema_ID)");
|
||||
created = DB.executeUpdate(sql.toString(), get_TrxName());
|
||||
addLog(0, null, new BigDecimal(created), "@Created@ @C_Project_ID@");
|
||||
createdTotal += created;
|
||||
|
||||
|
@ -365,35 +365,35 @@ public class AcctSchemaDefaultCopy extends SvrProcess
|
|||
// Update Tax
|
||||
if (p_CopyOverwriteAcct)
|
||||
{
|
||||
sql = "UPDATE C_Tax_Acct a "
|
||||
+ "SET T_Due_Acct=" + acct.getT_Due_Acct()
|
||||
+ ", T_Liability_Acct=" + acct.getT_Liability_Acct()
|
||||
+ ", T_Credit_Acct=" + acct.getT_Credit_Acct()
|
||||
+ ", T_Receivables_Acct=" + acct.getT_Receivables_Acct()
|
||||
+ ", T_Expense_Acct=" + acct.getT_Expense_Acct()
|
||||
+ ", Updated=SysDate, UpdatedBy=0 "
|
||||
+ "WHERE a.C_AcctSchema_ID=" + p_C_AcctSchema_ID
|
||||
+ " AND EXISTS (SELECT * FROM C_Tax_Acct x "
|
||||
+ "WHERE x.C_Tax_ID=a.C_Tax_ID)";
|
||||
updated = DB.executeUpdate(sql, get_TrxName());
|
||||
sql = new StringBuilder("UPDATE C_Tax_Acct a ")
|
||||
.append("SET T_Due_Acct=").append(acct.getT_Due_Acct())
|
||||
.append(", T_Liability_Acct=").append(acct.getT_Liability_Acct())
|
||||
.append(", T_Credit_Acct=").append(acct.getT_Credit_Acct())
|
||||
.append(", T_Receivables_Acct=").append(acct.getT_Receivables_Acct())
|
||||
.append(", T_Expense_Acct=").append(acct.getT_Expense_Acct())
|
||||
.append(", Updated=SysDate, UpdatedBy=0 ")
|
||||
.append("WHERE a.C_AcctSchema_ID=").append(p_C_AcctSchema_ID)
|
||||
.append(" AND EXISTS (SELECT * FROM C_Tax_Acct x ")
|
||||
.append("WHERE x.C_Tax_ID=a.C_Tax_ID)");
|
||||
updated = DB.executeUpdate(sql.toString(), get_TrxName());
|
||||
addLog(0, null, new BigDecimal(updated), "@Updated@ @C_Tax_ID@");
|
||||
updatedTotal += updated;
|
||||
}
|
||||
// Insert new Tax
|
||||
sql = "INSERT INTO C_Tax_Acct "
|
||||
+ "(C_Tax_ID, C_AcctSchema_ID,"
|
||||
+ " AD_Client_ID, AD_Org_ID, IsActive, Created, CreatedBy, Updated, UpdatedBy,"
|
||||
+ " T_Due_Acct, T_Liability_Acct, T_Credit_Acct, T_Receivables_Acct, T_Expense_Acct) "
|
||||
+ "SELECT x.C_Tax_ID, acct.C_AcctSchema_ID,"
|
||||
+ " x.AD_Client_ID, x.AD_Org_ID, 'Y', SysDate, 0, SysDate, 0,"
|
||||
+ " acct.T_Due_Acct, acct.T_Liability_Acct, acct.T_Credit_Acct, acct.T_Receivables_Acct, acct.T_Expense_Acct "
|
||||
+ "FROM C_Tax x"
|
||||
+ " INNER JOIN C_AcctSchema_Default acct ON (x.AD_Client_ID=acct.AD_Client_ID) "
|
||||
+ "WHERE acct.C_AcctSchema_ID=" + p_C_AcctSchema_ID
|
||||
+ " AND NOT EXISTS (SELECT * FROM C_Tax_Acct a "
|
||||
+ "WHERE a.C_Tax_ID=x.C_Tax_ID"
|
||||
+ " AND a.C_AcctSchema_ID=acct.C_AcctSchema_ID)";
|
||||
created = DB.executeUpdate(sql, get_TrxName());
|
||||
sql = new StringBuilder("INSERT INTO C_Tax_Acct ")
|
||||
.append("(C_Tax_ID, C_AcctSchema_ID,")
|
||||
.append(" AD_Client_ID, AD_Org_ID, IsActive, Created, CreatedBy, Updated, UpdatedBy,")
|
||||
.append(" T_Due_Acct, T_Liability_Acct, T_Credit_Acct, T_Receivables_Acct, T_Expense_Acct) ")
|
||||
.append("SELECT x.C_Tax_ID, acct.C_AcctSchema_ID,")
|
||||
.append(" x.AD_Client_ID, x.AD_Org_ID, 'Y', SysDate, 0, SysDate, 0,")
|
||||
.append(" acct.T_Due_Acct, acct.T_Liability_Acct, acct.T_Credit_Acct, acct.T_Receivables_Acct, acct.T_Expense_Acct ")
|
||||
.append("FROM C_Tax x")
|
||||
.append(" INNER JOIN C_AcctSchema_Default acct ON (x.AD_Client_ID=acct.AD_Client_ID) ")
|
||||
.append("WHERE acct.C_AcctSchema_ID=").append(p_C_AcctSchema_ID)
|
||||
.append(" AND NOT EXISTS (SELECT * FROM C_Tax_Acct a ")
|
||||
.append("WHERE a.C_Tax_ID=x.C_Tax_ID")
|
||||
.append(" AND a.C_AcctSchema_ID=acct.C_AcctSchema_ID)");
|
||||
created = DB.executeUpdate(sql.toString(), get_TrxName());
|
||||
addLog(0, null, new BigDecimal(created), "@Created@ @C_Tax_ID@");
|
||||
createdTotal += created;
|
||||
|
||||
|
@ -401,48 +401,48 @@ public class AcctSchemaDefaultCopy extends SvrProcess
|
|||
// Update BankAccount
|
||||
if (p_CopyOverwriteAcct)
|
||||
{
|
||||
sql = "UPDATE C_BankAccount_Acct a "
|
||||
+ "SET B_InTransit_Acct=" + acct.getB_InTransit_Acct()
|
||||
+ ", B_Asset_Acct=" + acct.getB_Asset_Acct()
|
||||
+ ", B_Expense_Acct=" + acct.getB_Expense_Acct()
|
||||
+ ", B_InterestRev_Acct=" + acct.getB_InterestRev_Acct()
|
||||
+ ", B_InterestExp_Acct=" + acct.getB_InterestExp_Acct()
|
||||
+ ", B_Unidentified_Acct=" + acct.getB_Unidentified_Acct()
|
||||
+ ", B_UnallocatedCash_Acct=" + acct.getB_UnallocatedCash_Acct()
|
||||
+ ", B_PaymentSelect_Acct=" + acct.getB_PaymentSelect_Acct()
|
||||
+ ", B_SettlementGain_Acct=" + acct.getB_SettlementGain_Acct()
|
||||
+ ", B_SettlementLoss_Acct=" + acct.getB_SettlementLoss_Acct()
|
||||
+ ", B_RevaluationGain_Acct=" + acct.getB_RevaluationGain_Acct()
|
||||
+ ", B_RevaluationLoss_Acct=" + acct.getB_RevaluationLoss_Acct()
|
||||
+ ", Updated=SysDate, UpdatedBy=0 "
|
||||
+ "WHERE a.C_AcctSchema_ID=" + p_C_AcctSchema_ID
|
||||
+ " AND EXISTS (SELECT * FROM C_BankAccount_Acct x "
|
||||
+ "WHERE x.C_BankAccount_ID=a.C_BankAccount_ID)";
|
||||
updated = DB.executeUpdate(sql, get_TrxName());
|
||||
sql = new StringBuilder("UPDATE C_BankAccount_Acct a ")
|
||||
.append("SET B_InTransit_Acct=").append(acct.getB_InTransit_Acct())
|
||||
.append(", B_Asset_Acct=").append(acct.getB_Asset_Acct())
|
||||
.append(", B_Expense_Acct=").append(acct.getB_Expense_Acct())
|
||||
.append(", B_InterestRev_Acct=").append(acct.getB_InterestRev_Acct())
|
||||
.append(", B_InterestExp_Acct=").append(acct.getB_InterestExp_Acct())
|
||||
.append(", B_Unidentified_Acct=").append(acct.getB_Unidentified_Acct())
|
||||
.append(", B_UnallocatedCash_Acct=").append(acct.getB_UnallocatedCash_Acct())
|
||||
.append(", B_PaymentSelect_Acct=").append(acct.getB_PaymentSelect_Acct())
|
||||
.append(", B_SettlementGain_Acct=").append(acct.getB_SettlementGain_Acct())
|
||||
.append(", B_SettlementLoss_Acct=").append(acct.getB_SettlementLoss_Acct())
|
||||
.append(", B_RevaluationGain_Acct=").append(acct.getB_RevaluationGain_Acct())
|
||||
.append(", B_RevaluationLoss_Acct=").append(acct.getB_RevaluationLoss_Acct())
|
||||
.append(", Updated=SysDate, UpdatedBy=0 ")
|
||||
.append("WHERE a.C_AcctSchema_ID=").append(p_C_AcctSchema_ID)
|
||||
.append(" AND EXISTS (SELECT * FROM C_BankAccount_Acct x ")
|
||||
.append("WHERE x.C_BankAccount_ID=a.C_BankAccount_ID)");
|
||||
updated = DB.executeUpdate(sql.toString(), get_TrxName());
|
||||
addLog(0, null, new BigDecimal(updated), "@Updated@ @C_BankAccount_ID@");
|
||||
updatedTotal += updated;
|
||||
}
|
||||
// Insert new BankAccount
|
||||
sql = "INSERT INTO C_BankAccount_Acct "
|
||||
+ "(C_BankAccount_ID, C_AcctSchema_ID,"
|
||||
+ " AD_Client_ID, AD_Org_ID, IsActive, Created, CreatedBy, Updated, UpdatedBy,"
|
||||
+ " B_InTransit_Acct, B_Asset_Acct, B_Expense_Acct, B_InterestRev_Acct, B_InterestExp_Acct,"
|
||||
+ " B_Unidentified_Acct, B_UnallocatedCash_Acct, B_PaymentSelect_Acct,"
|
||||
+ " B_SettlementGain_Acct, B_SettlementLoss_Acct,"
|
||||
+ " B_RevaluationGain_Acct, B_RevaluationLoss_Acct) "
|
||||
+ "SELECT x.C_BankAccount_ID, acct.C_AcctSchema_ID,"
|
||||
+ " x.AD_Client_ID, x.AD_Org_ID, 'Y', SysDate, 0, SysDate, 0,"
|
||||
+ " acct.B_InTransit_Acct, acct.B_Asset_Acct, acct.B_Expense_Acct, acct.B_InterestRev_Acct, acct.B_InterestExp_Acct,"
|
||||
+ " acct.B_Unidentified_Acct, acct.B_UnallocatedCash_Acct, acct.B_PaymentSelect_Acct,"
|
||||
+ " acct.B_SettlementGain_Acct, acct.B_SettlementLoss_Acct,"
|
||||
+ " acct.B_RevaluationGain_Acct, acct.B_RevaluationLoss_Acct "
|
||||
+ "FROM C_BankAccount x"
|
||||
+ " INNER JOIN C_AcctSchema_Default acct ON (x.AD_Client_ID=acct.AD_Client_ID) "
|
||||
+ "WHERE acct.C_AcctSchema_ID=" + p_C_AcctSchema_ID
|
||||
+ " AND NOT EXISTS (SELECT * FROM C_BankAccount_Acct a "
|
||||
+ "WHERE a.C_BankAccount_ID=x.C_BankAccount_ID"
|
||||
+ " AND a.C_AcctSchema_ID=acct.C_AcctSchema_ID)";
|
||||
created = DB.executeUpdate(sql, get_TrxName());
|
||||
sql = new StringBuilder("INSERT INTO C_BankAccount_Acct ")
|
||||
.append("(C_BankAccount_ID, C_AcctSchema_ID,")
|
||||
.append(" AD_Client_ID, AD_Org_ID, IsActive, Created, CreatedBy, Updated, UpdatedBy,")
|
||||
.append(" B_InTransit_Acct, B_Asset_Acct, B_Expense_Acct, B_InterestRev_Acct, B_InterestExp_Acct,")
|
||||
.append(" B_Unidentified_Acct, B_UnallocatedCash_Acct, B_PaymentSelect_Acct,")
|
||||
.append(" B_SettlementGain_Acct, B_SettlementLoss_Acct,")
|
||||
.append(" B_RevaluationGain_Acct, B_RevaluationLoss_Acct) ")
|
||||
.append("SELECT x.C_BankAccount_ID, acct.C_AcctSchema_ID,")
|
||||
.append(" x.AD_Client_ID, x.AD_Org_ID, 'Y', SysDate, 0, SysDate, 0,")
|
||||
.append(" acct.B_InTransit_Acct, acct.B_Asset_Acct, acct.B_Expense_Acct, acct.B_InterestRev_Acct, acct.B_InterestExp_Acct,")
|
||||
.append(" acct.B_Unidentified_Acct, acct.B_UnallocatedCash_Acct, acct.B_PaymentSelect_Acct,")
|
||||
.append(" acct.B_SettlementGain_Acct, acct.B_SettlementLoss_Acct,")
|
||||
.append(" acct.B_RevaluationGain_Acct, acct.B_RevaluationLoss_Acct ")
|
||||
.append("FROM C_BankAccount x")
|
||||
.append(" INNER JOIN C_AcctSchema_Default acct ON (x.AD_Client_ID=acct.AD_Client_ID) ")
|
||||
.append("WHERE acct.C_AcctSchema_ID=").append(p_C_AcctSchema_ID)
|
||||
.append(" AND NOT EXISTS (SELECT * FROM C_BankAccount_Acct a ")
|
||||
.append("WHERE a.C_BankAccount_ID=x.C_BankAccount_ID")
|
||||
.append(" AND a.C_AcctSchema_ID=acct.C_AcctSchema_ID)");
|
||||
created = DB.executeUpdate(sql.toString(), get_TrxName());
|
||||
addLog(0, null, new BigDecimal(created), "@Created@ @C_BankAccount_ID@");
|
||||
createdTotal += created;
|
||||
|
||||
|
@ -450,31 +450,31 @@ public class AcctSchemaDefaultCopy extends SvrProcess
|
|||
// Update Withholding
|
||||
if (p_CopyOverwriteAcct)
|
||||
{
|
||||
sql = "UPDATE C_Withholding_Acct a "
|
||||
+ "SET Withholding_Acct=" + acct.getWithholding_Acct()
|
||||
+ ", Updated=SysDate, UpdatedBy=0 "
|
||||
+ "WHERE a.C_AcctSchema_ID=" + p_C_AcctSchema_ID
|
||||
+ " AND EXISTS (SELECT * FROM C_Withholding_Acct x "
|
||||
+ "WHERE x.C_Withholding_ID=a.C_Withholding_ID)";
|
||||
updated = DB.executeUpdate(sql, get_TrxName());
|
||||
sql = new StringBuilder("UPDATE C_Withholding_Acct a ")
|
||||
.append("SET Withholding_Acct=").append(acct.getWithholding_Acct())
|
||||
.append(", Updated=SysDate, UpdatedBy=0 ")
|
||||
.append("WHERE a.C_AcctSchema_ID=").append(p_C_AcctSchema_ID)
|
||||
.append(" AND EXISTS (SELECT * FROM C_Withholding_Acct x ")
|
||||
.append("WHERE x.C_Withholding_ID=a.C_Withholding_ID)");
|
||||
updated = DB.executeUpdate(sql.toString(), get_TrxName());
|
||||
addLog(0, null, new BigDecimal(updated), "@Updated@ @C_Withholding_ID@");
|
||||
updatedTotal += updated;
|
||||
}
|
||||
// Insert new Withholding
|
||||
sql = "INSERT INTO C_Withholding_Acct "
|
||||
+ "(C_Withholding_ID, C_AcctSchema_ID,"
|
||||
+ " AD_Client_ID, AD_Org_ID, IsActive, Created, CreatedBy, Updated, UpdatedBy,"
|
||||
+ " Withholding_Acct) "
|
||||
+ "SELECT x.C_Withholding_ID, acct.C_AcctSchema_ID,"
|
||||
+ " x.AD_Client_ID, x.AD_Org_ID, 'Y', SysDate, 0, SysDate, 0,"
|
||||
+ " acct.Withholding_Acct "
|
||||
+ "FROM C_Withholding x"
|
||||
+ " INNER JOIN C_AcctSchema_Default acct ON (x.AD_Client_ID=acct.AD_Client_ID) "
|
||||
+ "WHERE acct.C_AcctSchema_ID=" + p_C_AcctSchema_ID
|
||||
+ " AND NOT EXISTS (SELECT * FROM C_Withholding_Acct a "
|
||||
+ "WHERE a.C_Withholding_ID=x.C_Withholding_ID"
|
||||
+ " AND a.C_AcctSchema_ID=acct.C_AcctSchema_ID)";
|
||||
created = DB.executeUpdate(sql, get_TrxName());
|
||||
sql = new StringBuilder("INSERT INTO C_Withholding_Acct ")
|
||||
.append("(C_Withholding_ID, C_AcctSchema_ID,")
|
||||
.append(" AD_Client_ID, AD_Org_ID, IsActive, Created, CreatedBy, Updated, UpdatedBy,")
|
||||
.append(" Withholding_Acct) ")
|
||||
.append("SELECT x.C_Withholding_ID, acct.C_AcctSchema_ID,")
|
||||
.append(" x.AD_Client_ID, x.AD_Org_ID, 'Y', SysDate, 0, SysDate, 0,")
|
||||
.append(" acct.Withholding_Acct ")
|
||||
.append("FROM C_Withholding x")
|
||||
.append(" INNER JOIN C_AcctSchema_Default acct ON (x.AD_Client_ID=acct.AD_Client_ID) ")
|
||||
.append("WHERE acct.C_AcctSchema_ID=").append(p_C_AcctSchema_ID)
|
||||
.append(" AND NOT EXISTS (SELECT * FROM C_Withholding_Acct a ")
|
||||
.append("WHERE a.C_Withholding_ID=x.C_Withholding_ID")
|
||||
.append(" AND a.C_AcctSchema_ID=acct.C_AcctSchema_ID)");
|
||||
created = DB.executeUpdate(sql.toString(), get_TrxName());
|
||||
addLog(0, null, new BigDecimal(created), "@Created@ @C_Withholding_ID@");
|
||||
createdTotal += created;
|
||||
|
||||
|
@ -482,31 +482,31 @@ public class AcctSchemaDefaultCopy extends SvrProcess
|
|||
// Update Charge
|
||||
if (p_CopyOverwriteAcct)
|
||||
{
|
||||
sql = "UPDATE C_Charge_Acct a "
|
||||
+ "SET Ch_Expense_Acct=" + acct.getCh_Expense_Acct()
|
||||
+ ", Updated=SysDate, UpdatedBy=0 "
|
||||
+ "WHERE a.C_AcctSchema_ID=" + p_C_AcctSchema_ID
|
||||
+ " AND EXISTS (SELECT * FROM C_Charge_Acct x "
|
||||
+ "WHERE x.C_Charge_ID=a.C_Charge_ID)";
|
||||
updated = DB.executeUpdate(sql, get_TrxName());
|
||||
sql = new StringBuilder("UPDATE C_Charge_Acct a ")
|
||||
.append("SET Ch_Expense_Acct=").append(acct.getCh_Expense_Acct())
|
||||
.append(", Updated=SysDate, UpdatedBy=0 ")
|
||||
.append("WHERE a.C_AcctSchema_ID=").append(p_C_AcctSchema_ID)
|
||||
.append(" AND EXISTS (SELECT * FROM C_Charge_Acct x ")
|
||||
.append("WHERE x.C_Charge_ID=a.C_Charge_ID)");
|
||||
updated = DB.executeUpdate(sql.toString(), get_TrxName());
|
||||
addLog(0, null, new BigDecimal(updated), "@Updated@ @C_Charge_ID@");
|
||||
updatedTotal += updated;
|
||||
}
|
||||
// Insert new Charge
|
||||
sql = "INSERT INTO C_Charge_Acct "
|
||||
+ "(C_Charge_ID, C_AcctSchema_ID,"
|
||||
+ " AD_Client_ID, AD_Org_ID, IsActive, Created, CreatedBy, Updated, UpdatedBy,"
|
||||
+ " Ch_Expense_Acct) "
|
||||
+ "SELECT x.C_Charge_ID, acct.C_AcctSchema_ID,"
|
||||
+ " x.AD_Client_ID, x.AD_Org_ID, 'Y', SysDate, 0, SysDate, 0,"
|
||||
+ " acct.Ch_Expense_Acct "
|
||||
+ "FROM C_Charge x"
|
||||
+ " INNER JOIN C_AcctSchema_Default acct ON (x.AD_Client_ID=acct.AD_Client_ID) "
|
||||
+ "WHERE acct.C_AcctSchema_ID=" + p_C_AcctSchema_ID
|
||||
+ " AND NOT EXISTS (SELECT * FROM C_Charge_Acct a "
|
||||
+ "WHERE a.C_Charge_ID=x.C_Charge_ID"
|
||||
+ " AND a.C_AcctSchema_ID=acct.C_AcctSchema_ID)";
|
||||
created = DB.executeUpdate(sql, get_TrxName());
|
||||
sql = new StringBuilder("INSERT INTO C_Charge_Acct ")
|
||||
.append("(C_Charge_ID, C_AcctSchema_ID,")
|
||||
.append(" AD_Client_ID, AD_Org_ID, IsActive, Created, CreatedBy, Updated, UpdatedBy,")
|
||||
.append(" Ch_Expense_Acct) ")
|
||||
.append("SELECT x.C_Charge_ID, acct.C_AcctSchema_ID,")
|
||||
.append(" x.AD_Client_ID, x.AD_Org_ID, 'Y', SysDate, 0, SysDate, 0,")
|
||||
.append(" acct.Ch_Expense_Acct ")
|
||||
.append("FROM C_Charge x")
|
||||
.append(" INNER JOIN C_AcctSchema_Default acct ON (x.AD_Client_ID=acct.AD_Client_ID) ")
|
||||
.append("WHERE acct.C_AcctSchema_ID=").append(p_C_AcctSchema_ID)
|
||||
.append(" AND NOT EXISTS (SELECT * FROM C_Charge_Acct a ")
|
||||
.append("WHERE a.C_Charge_ID=x.C_Charge_ID")
|
||||
.append(" AND a.C_AcctSchema_ID=acct.C_AcctSchema_ID)");
|
||||
created = DB.executeUpdate(sql.toString(), get_TrxName());
|
||||
addLog(0, null, new BigDecimal(created), "@Created@ @C_Charge_ID@");
|
||||
createdTotal += created;
|
||||
|
||||
|
@ -514,41 +514,42 @@ public class AcctSchemaDefaultCopy extends SvrProcess
|
|||
// Update Cashbook
|
||||
if (p_CopyOverwriteAcct)
|
||||
{
|
||||
sql = "UPDATE C_Cashbook_Acct a "
|
||||
+ "SET CB_Asset_Acct=" + acct.getCB_Asset_Acct()
|
||||
+ ", CB_Differences_Acct=" + acct.getCB_Differences_Acct()
|
||||
+ ", CB_CashTransfer_Acct=" + acct.getCB_CashTransfer_Acct()
|
||||
+ ", CB_Expense_Acct=" + acct.getCB_Expense_Acct()
|
||||
+ ", CB_Receipt_Acct=" + acct.getCB_Receipt_Acct()
|
||||
+ ", Updated=SysDate, UpdatedBy=0 "
|
||||
+ "WHERE a.C_AcctSchema_ID=" + p_C_AcctSchema_ID
|
||||
+ " AND EXISTS (SELECT * FROM C_Cashbook_Acct x "
|
||||
+ "WHERE x.C_Cashbook_ID=a.C_Cashbook_ID)";
|
||||
updated = DB.executeUpdate(sql, get_TrxName());
|
||||
sql = new StringBuilder("UPDATE C_Cashbook_Acct a ")
|
||||
.append("SET CB_Asset_Acct=").append(acct.getCB_Asset_Acct())
|
||||
.append(", CB_Differences_Acct=").append(acct.getCB_Differences_Acct())
|
||||
.append(", CB_CashTransfer_Acct=").append(acct.getCB_CashTransfer_Acct())
|
||||
.append(", CB_Expense_Acct=").append(acct.getCB_Expense_Acct())
|
||||
.append(", CB_Receipt_Acct=").append(acct.getCB_Receipt_Acct())
|
||||
.append(", Updated=SysDate, UpdatedBy=0 ")
|
||||
.append("WHERE a.C_AcctSchema_ID=").append(p_C_AcctSchema_ID)
|
||||
.append(" AND EXISTS (SELECT * FROM C_Cashbook_Acct x ")
|
||||
.append("WHERE x.C_Cashbook_ID=a.C_Cashbook_ID)");
|
||||
updated = DB.executeUpdate(sql.toString(), get_TrxName());
|
||||
addLog(0, null, new BigDecimal(updated), "@Updated@ @C_Cashbook_ID@");
|
||||
updatedTotal += updated;
|
||||
}
|
||||
// Insert new Cashbook
|
||||
sql = "INSERT INTO C_Cashbook_Acct "
|
||||
+ "(C_Cashbook_ID, C_AcctSchema_ID,"
|
||||
+ " AD_Client_ID, AD_Org_ID, IsActive, Created, CreatedBy, Updated, UpdatedBy,"
|
||||
+ " CB_Asset_Acct, CB_Differences_Acct, CB_CashTransfer_Acct,"
|
||||
+ " CB_Expense_Acct, CB_Receipt_Acct) "
|
||||
+ "SELECT x.C_Cashbook_ID, acct.C_AcctSchema_ID,"
|
||||
+ " x.AD_Client_ID, x.AD_Org_ID, 'Y', SysDate, 0, SysDate, 0,"
|
||||
+ " acct.CB_Asset_Acct, acct.CB_Differences_Acct, acct.CB_CashTransfer_Acct,"
|
||||
+ " acct.CB_Expense_Acct, acct.CB_Receipt_Acct "
|
||||
+ "FROM C_Cashbook x"
|
||||
+ " INNER JOIN C_AcctSchema_Default acct ON (x.AD_Client_ID=acct.AD_Client_ID) "
|
||||
+ "WHERE acct.C_AcctSchema_ID=" + p_C_AcctSchema_ID
|
||||
+ " AND NOT EXISTS (SELECT * FROM C_Cashbook_Acct a "
|
||||
+ "WHERE a.C_Cashbook_ID=x.C_Cashbook_ID"
|
||||
+ " AND a.C_AcctSchema_ID=acct.C_AcctSchema_ID)";
|
||||
created = DB.executeUpdate(sql, get_TrxName());
|
||||
sql = new StringBuilder("INSERT INTO C_Cashbook_Acct ")
|
||||
.append("(C_Cashbook_ID, C_AcctSchema_ID,")
|
||||
.append(" AD_Client_ID, AD_Org_ID, IsActive, Created, CreatedBy, Updated, UpdatedBy,")
|
||||
.append(" CB_Asset_Acct, CB_Differences_Acct, CB_CashTransfer_Acct,")
|
||||
.append(" CB_Expense_Acct, CB_Receipt_Acct) ")
|
||||
.append("SELECT x.C_Cashbook_ID, acct.C_AcctSchema_ID,")
|
||||
.append(" x.AD_Client_ID, x.AD_Org_ID, 'Y', SysDate, 0, SysDate, 0,")
|
||||
.append(" acct.CB_Asset_Acct, acct.CB_Differences_Acct, acct.CB_CashTransfer_Acct,")
|
||||
.append(" acct.CB_Expense_Acct, acct.CB_Receipt_Acct ")
|
||||
.append("FROM C_Cashbook x")
|
||||
.append(" INNER JOIN C_AcctSchema_Default acct ON (x.AD_Client_ID=acct.AD_Client_ID) ")
|
||||
.append("WHERE acct.C_AcctSchema_ID=").append(p_C_AcctSchema_ID)
|
||||
.append(" AND NOT EXISTS (SELECT * FROM C_Cashbook_Acct a ")
|
||||
.append("WHERE a.C_Cashbook_ID=x.C_Cashbook_ID")
|
||||
.append(" AND a.C_AcctSchema_ID=acct.C_AcctSchema_ID)");
|
||||
created = DB.executeUpdate(sql.toString(), get_TrxName());
|
||||
addLog(0, null, new BigDecimal(created), "@Created@ @C_Cashbook_ID@");
|
||||
createdTotal += created;
|
||||
|
||||
return "@Created@=" + createdTotal + ", @Updated@=" + updatedTotal;
|
||||
StringBuilder msgreturn = new StringBuilder("@Created@=").append(createdTotal).append(", @Updated@=").append(updatedTotal);
|
||||
return msgreturn.toString();
|
||||
} // doIt
|
||||
|
||||
} // AcctSchemaDefaultCopy
|
||||
|
|
|
@ -170,7 +170,8 @@ public class AllocationAuto extends SvrProcess
|
|||
}
|
||||
}
|
||||
//
|
||||
return "@Created@ #" + countBP + "/" + countAlloc;
|
||||
StringBuilder msgreturn = new StringBuilder("@Created@ #").append(countBP).append("/").append(countAlloc);
|
||||
return msgreturn.toString();
|
||||
} // doIt
|
||||
|
||||
/**
|
||||
|
@ -258,19 +259,19 @@ public class AllocationAuto extends SvrProcess
|
|||
private MPayment[] getPayments (int C_BPartner_ID)
|
||||
{
|
||||
ArrayList<MPayment> list = new ArrayList<MPayment>();
|
||||
String sql = "SELECT * FROM C_Payment "
|
||||
+ "WHERE IsAllocated='N' AND Processed='Y' AND C_BPartner_ID=?"
|
||||
+ " AND IsPrepayment='N' AND C_Charge_ID IS NULL ";
|
||||
StringBuilder sql = new StringBuilder("SELECT * FROM C_Payment ")
|
||||
.append("WHERE IsAllocated='N' AND Processed='Y' AND C_BPartner_ID=?")
|
||||
.append(" AND IsPrepayment='N' AND C_Charge_ID IS NULL ");
|
||||
if (ONLY_AP.equals(p_APAR))
|
||||
sql += "AND IsReceipt='N' ";
|
||||
sql.append("AND IsReceipt='N' ");
|
||||
else if (ONLY_AR.equals(p_APAR))
|
||||
sql += "AND IsReceipt='Y' ";
|
||||
sql += "ORDER BY DateTrx";
|
||||
sql.append("AND IsReceipt='Y' ");
|
||||
sql.append("ORDER BY DateTrx");
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
try
|
||||
{
|
||||
pstmt = DB.prepareStatement (sql, get_TrxName());
|
||||
pstmt = DB.prepareStatement (sql.toString(), get_TrxName());
|
||||
pstmt.setInt (1, C_BPartner_ID);
|
||||
rs = pstmt.executeQuery ();
|
||||
while (rs.next ())
|
||||
|
@ -288,7 +289,7 @@ public class AllocationAuto extends SvrProcess
|
|||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.log(Level.SEVERE, sql, e);
|
||||
log.log(Level.SEVERE, sql.toString(), e);
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
@ -308,18 +309,18 @@ public class AllocationAuto extends SvrProcess
|
|||
private MInvoice[] getInvoices (int C_BPartner_ID)
|
||||
{
|
||||
ArrayList<MInvoice> list = new ArrayList<MInvoice>();
|
||||
String sql = "SELECT * FROM C_Invoice "
|
||||
+ "WHERE IsPaid='N' AND Processed='Y' AND C_BPartner_ID=? ";
|
||||
StringBuilder sql = new StringBuilder("SELECT * FROM C_Invoice ")
|
||||
.append("WHERE IsPaid='N' AND Processed='Y' AND C_BPartner_ID=? ");
|
||||
if (ONLY_AP.equals(p_APAR))
|
||||
sql += "AND IsSOTrx='N' ";
|
||||
sql.append("AND IsSOTrx='N' ");
|
||||
else if (ONLY_AR.equals(p_APAR))
|
||||
sql += "AND IsSOTrx='Y' ";
|
||||
sql += "ORDER BY DateInvoiced";
|
||||
sql.append("AND IsSOTrx='Y' ");
|
||||
sql.append("ORDER BY DateInvoiced");
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
try
|
||||
{
|
||||
pstmt = DB.prepareStatement (sql, get_TrxName());
|
||||
pstmt = DB.prepareStatement (sql.toString(), get_TrxName());
|
||||
pstmt.setInt (1, C_BPartner_ID);
|
||||
rs = pstmt.executeQuery ();
|
||||
while (rs.next ())
|
||||
|
@ -336,7 +337,7 @@ public class AllocationAuto extends SvrProcess
|
|||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.log(Level.SEVERE, sql, e);
|
||||
log.log(Level.SEVERE, sql.toString(), e);
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
@ -768,8 +769,9 @@ public class AllocationAuto extends SvrProcess
|
|||
|
||||
if (allocatedPayments.compareTo(allocatedInvoices) != 0)
|
||||
{
|
||||
throw new AdempiereSystemError("Allocated Payments=" + allocatedPayments
|
||||
+ " <> Invoices=" + allocatedInvoices);
|
||||
StringBuilder msg = new StringBuilder("Allocated Payments=").append(allocatedPayments)
|
||||
.append(" <> Invoices=").append(allocatedInvoices);
|
||||
throw new AdempiereSystemError(msg.toString());
|
||||
}
|
||||
processAllocation();
|
||||
return 1;
|
||||
|
@ -828,9 +830,11 @@ public class AllocationAuto extends SvrProcess
|
|||
if (m_allocation == null)
|
||||
return true;
|
||||
boolean success = m_allocation.processIt(MAllocationHdr.DOCACTION_Complete);
|
||||
if (!success)
|
||||
throw new IllegalStateException("Allocation Process Failed "+ m_allocation.getDocumentNo() +
|
||||
" " + m_allocation.getProcessMsg());
|
||||
if (!success){
|
||||
StringBuilder msg = new StringBuilder("Allocation Process Failed ").append(m_allocation.getDocumentNo())
|
||||
.append(" ").append( m_allocation.getProcessMsg());
|
||||
throw new IllegalStateException(msg.toString());
|
||||
}
|
||||
else
|
||||
m_allocation.saveEx();
|
||||
addLog(0, m_allocation.getDateAcct(), null, m_allocation.getDescription());
|
||||
|
|
|
@ -115,14 +115,14 @@ public class AllocationReset extends SvrProcess
|
|||
}
|
||||
|
||||
// Selection
|
||||
StringBuffer sql = new StringBuffer("SELECT * FROM C_AllocationHdr ah "
|
||||
+ "WHERE EXISTS (SELECT * FROM C_AllocationLine al "
|
||||
+ "WHERE ah.C_AllocationHdr_ID=al.C_AllocationHdr_ID");
|
||||
StringBuilder sql = new StringBuilder("SELECT * FROM C_AllocationHdr ah ")
|
||||
.append("WHERE EXISTS (SELECT * FROM C_AllocationLine al ")
|
||||
.append("WHERE ah.C_AllocationHdr_ID=al.C_AllocationHdr_ID");
|
||||
if (p_C_BPartner_ID != 0)
|
||||
sql.append(" AND al.C_BPartner_ID=?");
|
||||
else if (p_C_BP_Group_ID != 0)
|
||||
sql.append(" AND EXISTS (SELECT * FROM C_BPartner bp "
|
||||
+ "WHERE bp.C_BPartner_ID=al.C_BPartner_ID AND bp.C_BP_Group_ID=?)");
|
||||
sql.append(" AND EXISTS (SELECT * FROM C_BPartner bp ")
|
||||
.append("WHERE bp.C_BPartner_ID=al.C_BPartner_ID AND bp.C_BP_Group_ID=?)");
|
||||
else
|
||||
sql.append(" AND AD_Client_ID=?");
|
||||
if (p_DateAcct_From != null)
|
||||
|
@ -132,9 +132,9 @@ public class AllocationReset extends SvrProcess
|
|||
// Do not delete Cash Trx
|
||||
sql.append(" AND al.C_CashLine_ID IS NULL)");
|
||||
// Open Period
|
||||
sql.append(" AND EXISTS (SELECT * FROM C_Period p"
|
||||
+ " INNER JOIN C_PeriodControl pc ON (p.C_Period_ID=pc.C_Period_ID AND pc.DocBaseType='CMA') "
|
||||
+ "WHERE ah.DateAcct BETWEEN p.StartDate AND p.EndDate)");
|
||||
sql.append(" AND EXISTS (SELECT * FROM C_Period p")
|
||||
.append(" INNER JOIN C_PeriodControl pc ON (p.C_Period_ID=pc.C_Period_ID AND pc.DocBaseType='CMA') ")
|
||||
.append("WHERE ah.DateAcct BETWEEN p.StartDate AND p.EndDate)");
|
||||
//
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
|
|
|
@ -112,10 +112,10 @@ public class AssetDelivery extends SvrProcess
|
|||
return msg;
|
||||
}
|
||||
//
|
||||
StringBuffer sql = new StringBuffer ("SELECT A_Asset_ID, GuaranteeDate "
|
||||
+ "FROM A_Asset a"
|
||||
+ " INNER JOIN M_Product p ON (a.M_Product_ID=p.M_Product_ID) "
|
||||
+ "WHERE ");
|
||||
StringBuilder sql = new StringBuilder("SELECT A_Asset_ID, GuaranteeDate ")
|
||||
.append("FROM A_Asset a")
|
||||
.append(" INNER JOIN M_Product p ON (a.M_Product_ID=p.M_Product_ID) ")
|
||||
.append("WHERE ");
|
||||
if (m_A_Asset_Group_ID != 0)
|
||||
sql.append("a.A_Asset_Group_ID=").append(m_A_Asset_Group_ID).append(" AND ");
|
||||
if (m_M_Product_ID != 0)
|
||||
|
|
|
@ -44,17 +44,17 @@ public class BOMFlagValidate extends SvrProcess {
|
|||
{
|
||||
|
||||
//Select Products where there's a BOM, and there are no lines
|
||||
String sql = "SELECT Name, M_Product_ID FROM M_Product WHERE IsBOM = 'Y' AND " +
|
||||
"M_Product_ID NOT IN (SELECT M_Product_ID FROM M_Product_BOM ) AND ";
|
||||
StringBuilder sql = new StringBuilder("SELECT Name, M_Product_ID FROM M_Product WHERE IsBOM = 'Y' AND ")
|
||||
.append("M_Product_ID NOT IN (SELECT M_Product_ID FROM M_Product_BOM ) AND ");
|
||||
if (p_M_Product_Category_ID == 0)
|
||||
sql += "AD_Client_ID= ?";
|
||||
sql.append("AD_Client_ID= ?");
|
||||
|
||||
else
|
||||
sql += "M_Product_Category_ID= ?";
|
||||
sql.append("M_Product_Category_ID= ?");
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
try {
|
||||
pstmt = DB.prepareStatement (sql, get_TrxName());
|
||||
pstmt = DB.prepareStatement (sql.toString(), get_TrxName());
|
||||
if (p_M_Product_Category_ID == 0)
|
||||
pstmt.setInt (1, Env.getAD_Client_ID(getCtx()));
|
||||
else
|
||||
|
@ -63,7 +63,8 @@ public class BOMFlagValidate extends SvrProcess {
|
|||
|
||||
while (rs.next())
|
||||
{
|
||||
addLog(0, null, null, rs.getString(1) + " BOM without BOM lines", MProduct.Table_ID, rs.getInt(2));
|
||||
StringBuilder msglog=new StringBuilder(rs.getString(1)).append(" BOM without BOM lines");
|
||||
addLog(0, null, null, msglog.toString(), MProduct.Table_ID, rs.getInt(2));
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
throw e;
|
||||
|
@ -74,13 +75,13 @@ public class BOMFlagValidate extends SvrProcess {
|
|||
|
||||
PreparedStatement upstmt = null;
|
||||
try {
|
||||
String update = "UPDATE M_Product SET IsBOM = 'N' WHERE IsBOM = 'Y' AND M_Product_ID NOT IN " +
|
||||
"(SELECT M_Product_ID FROM M_Product_BOM ) AND ";
|
||||
StringBuilder update = new StringBuilder("UPDATE M_Product SET IsBOM = 'N' WHERE IsBOM = 'Y' AND M_Product_ID NOT IN ")
|
||||
.append("(SELECT M_Product_ID FROM M_Product_BOM ) AND ");
|
||||
if (p_M_Product_Category_ID == 0)
|
||||
update += "AD_Client_ID= ?";
|
||||
update.append("AD_Client_ID= ?");
|
||||
else
|
||||
update += "M_Product_Category_ID= ?";
|
||||
upstmt = DB.prepareStatement (update, get_TrxName());
|
||||
update.append("M_Product_Category_ID= ?");
|
||||
upstmt = DB.prepareStatement (update.toString(), get_TrxName());
|
||||
if (p_M_Product_Category_ID == 0)
|
||||
upstmt.setInt (1, Env.getAD_Client_ID(getCtx()));
|
||||
else
|
||||
|
@ -99,17 +100,17 @@ public class BOMFlagValidate extends SvrProcess {
|
|||
{
|
||||
|
||||
//Select Products where there's a BOM, and there are no lines
|
||||
String sql = "SELECT Name, M_Product_ID FROM M_Product WHERE IsBOM = 'N' AND " +
|
||||
"M_Product_ID IN (SELECT M_Product_ID FROM M_Product_BOM ) AND ";
|
||||
StringBuilder sql = new StringBuilder("SELECT Name, M_Product_ID FROM M_Product WHERE IsBOM = 'N' AND ")
|
||||
.append("M_Product_ID IN (SELECT M_Product_ID FROM M_Product_BOM ) AND ");
|
||||
if (p_M_Product_Category_ID == 0)
|
||||
sql += "AD_Client_ID= ?";
|
||||
sql.append("AD_Client_ID= ?");
|
||||
|
||||
else
|
||||
sql += "M_Product_Category_ID= ?";
|
||||
sql.append("M_Product_Category_ID= ?");
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
try {
|
||||
pstmt = DB.prepareStatement (sql, get_TrxName());
|
||||
pstmt = DB.prepareStatement (sql.toString(), get_TrxName());
|
||||
if (p_M_Product_Category_ID == 0)
|
||||
pstmt.setInt (1, Env.getAD_Client_ID(getCtx()));
|
||||
else
|
||||
|
@ -118,7 +119,8 @@ public class BOMFlagValidate extends SvrProcess {
|
|||
|
||||
while (rs.next())
|
||||
{
|
||||
addLog(0, null, null, rs.getString(1) + " not BOM with BOM lines", MProduct.Table_ID, rs.getInt(2));
|
||||
StringBuilder msglog = new StringBuilder(rs.getString(1)).append(" not BOM with BOM lines");
|
||||
addLog(0, null, null, msglog.toString(), MProduct.Table_ID, rs.getInt(2));
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
throw e;
|
||||
|
@ -127,15 +129,15 @@ public class BOMFlagValidate extends SvrProcess {
|
|||
rs = null; pstmt = null;
|
||||
}
|
||||
|
||||
String update = "UPDATE M_Product SET ISBOM = 'Y' WHERE IsBOM = 'N' AND M_Product_ID IN " +
|
||||
"(SELECT M_Product_ID FROM M_Product_BOM ) AND ";
|
||||
StringBuilder update = new StringBuilder("UPDATE M_Product SET ISBOM = 'Y' WHERE IsBOM = 'N' AND M_Product_ID IN ")
|
||||
.append("(SELECT M_Product_ID FROM M_Product_BOM ) AND ");
|
||||
if (p_M_Product_Category_ID == 0)
|
||||
update += "AD_Client_ID= ?";
|
||||
update.append("AD_Client_ID= ?");
|
||||
else
|
||||
update += "M_Product_Category_ID= ?";
|
||||
update.append("M_Product_Category_ID= ?");
|
||||
PreparedStatement upstmt = null;
|
||||
try {
|
||||
upstmt = DB.prepareStatement (update, get_TrxName());
|
||||
upstmt = DB.prepareStatement (update.toString(), get_TrxName());
|
||||
if (p_M_Product_Category_ID == 0)
|
||||
upstmt.setInt (1, Env.getAD_Client_ID(getCtx()));
|
||||
else
|
||||
|
|
|
@ -101,10 +101,10 @@ public class BankStatementPayment extends SvrProcess
|
|||
ibs.setTrxAmt(payment.getPayAmt(true));
|
||||
ibs.saveEx();
|
||||
//
|
||||
String retString = "@C_Payment_ID@ = " + payment.getDocumentNo();
|
||||
StringBuilder retString = new StringBuilder("@C_Payment_ID@ = ").append(payment.getDocumentNo());
|
||||
if (payment.getOverUnderAmt().signum() != 0)
|
||||
retString += " - @OverUnderAmt@=" + payment.getOverUnderAmt();
|
||||
return retString;
|
||||
retString.append(" - @OverUnderAmt@=").append(payment.getOverUnderAmt());
|
||||
return retString.toString();
|
||||
} // createPayment - Import
|
||||
|
||||
/**
|
||||
|
@ -133,10 +133,10 @@ public class BankStatementPayment extends SvrProcess
|
|||
bsl.setPayment(payment);
|
||||
bsl.saveEx();
|
||||
//
|
||||
String retString = "@C_Payment_ID@ = " + payment.getDocumentNo();
|
||||
StringBuilder retString = new StringBuilder("@C_Payment_ID@ = ").append(payment.getDocumentNo());
|
||||
if (payment.getOverUnderAmt().signum() != 0)
|
||||
retString += " - @OverUnderAmt@=" + payment.getOverUnderAmt();
|
||||
return retString;
|
||||
retString.append(" - @OverUnderAmt@=").append(payment.getOverUnderAmt());
|
||||
return retString.toString();
|
||||
} // createPayment
|
||||
|
||||
|
||||
|
|
|
@ -146,8 +146,8 @@ public class ChangeLogProcess extends SvrProcess
|
|||
}
|
||||
// final call
|
||||
executeStatement();
|
||||
|
||||
return "@OK@: " + m_ok + " - @Errors@: " + m_errors + " - @Failed@: " + m_checkFailed;
|
||||
StringBuilder msgreturn = new StringBuilder("@OK@: ").append(m_ok).append(" - @Errors@: ").append(m_errors).append(" - @Failed@: ").append(m_checkFailed);
|
||||
return msgreturn.toString();
|
||||
} // doIt
|
||||
|
||||
|
||||
|
@ -369,7 +369,7 @@ public class ChangeLogProcess extends SvrProcess
|
|||
// Changed Tables
|
||||
+ " AND EXISTS (SELECT * FROM AD_ChangeLog l "
|
||||
+ "WHERE t.AD_Table_ID=l.AD_Table_ID)";
|
||||
StringBuffer update = null;
|
||||
StringBuilder update = null;
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
try
|
||||
|
@ -384,14 +384,15 @@ public class ChangeLogProcess extends SvrProcess
|
|||
String columnName = tableName + "_ID";
|
||||
if (tableName.equals("AD_Ref_Table"))
|
||||
columnName = "AD_Reference_ID";
|
||||
update = new StringBuffer ("UPDATE AD_ChangeLog SET IsCustomization='Y' "
|
||||
+ "WHERE AD_Table_ID=").append(table.getAD_Table_ID());
|
||||
update = new StringBuilder ("UPDATE AD_ChangeLog SET IsCustomization='Y' ")
|
||||
.append("WHERE AD_Table_ID=").append(table.getAD_Table_ID());
|
||||
update.append (" AND Record_ID IN (SELECT ")
|
||||
.append (columnName)
|
||||
.append (" FROM ").append(tableName)
|
||||
.append (" WHERE EntityType IN ('D','C'))");
|
||||
int no = DB.executeUpdate(update.toString(), get_TrxName());
|
||||
log.config(table.getTableName() + " = " + no);
|
||||
StringBuilder msglog = new StringBuilder(table.getTableName()).append(" = ").append(no);
|
||||
log.config(msglog.toString());
|
||||
updateNo += no;
|
||||
|
||||
}
|
||||
|
|
|
@ -129,33 +129,42 @@ public class ColumnEncryption extends SvrProcess {
|
|||
}
|
||||
|
||||
// Start
|
||||
addLog(0, null, null, "Encryption Class = "
|
||||
+ SecureEngine.getClassName());
|
||||
StringBuilder msglog = new StringBuilder("Encryption Class = ")
|
||||
.append(SecureEngine.getClassName());
|
||||
addLog(0, null, null, msglog.toString());
|
||||
boolean error = false;
|
||||
|
||||
// Test Value
|
||||
if (p_TestValue != null && p_TestValue.length() > 0) {
|
||||
String encString = SecureEngine.encrypt(p_TestValue);
|
||||
addLog(0, null, null, "Encrypted Test Value=" + encString);
|
||||
msglog = new StringBuilder("Encrypted Test Value=").append(encString);
|
||||
addLog(0, null, null, msglog.toString());
|
||||
String clearString = SecureEngine.decrypt(encString);
|
||||
if (p_TestValue.equals(clearString))
|
||||
addLog(0, null, null, "Decrypted=" + clearString
|
||||
+ " (same as test value)");
|
||||
if (p_TestValue.equals(clearString)){
|
||||
msglog = new StringBuilder("Decrypted=").append(clearString)
|
||||
.append(" (same as test value)");
|
||||
addLog(0, null, null, msglog.toString());
|
||||
}
|
||||
else {
|
||||
addLog(0, null, null, "Decrypted=" + clearString
|
||||
+ " (NOT the same as test value - check algorithm)");
|
||||
msglog = new StringBuilder("Decrypted=").append(clearString)
|
||||
.append(" (NOT the same as test value - check algorithm)");
|
||||
addLog(0, null, null, msglog.toString());
|
||||
error = true;
|
||||
}
|
||||
int encLength = encString.length();
|
||||
addLog(0, null, null, "Test Length=" + p_TestValue.length()
|
||||
+ " -> " + encLength);
|
||||
if (encLength <= column.getFieldLength())
|
||||
addLog(0, null, null, "Encrypted Length (" + encLength
|
||||
+ ") fits into field (" + column.getFieldLength() + ")");
|
||||
msglog = new StringBuilder("Test Length=").append(p_TestValue.length())
|
||||
.append(" -> ").append(encLength);
|
||||
addLog(0, null, null, msglog.toString());
|
||||
if (encLength <= column.getFieldLength()){
|
||||
msglog = new StringBuilder("Encrypted Length (").append(encLength)
|
||||
.append(") fits into field (").append(column.getFieldLength()).append(")");
|
||||
addLog(0, null, null, msglog.toString());
|
||||
}
|
||||
else {
|
||||
addLog(0, null, null, "Encrypted Length (" + encLength
|
||||
+ ") does NOT fit into field ("
|
||||
+ column.getFieldLength() + ") - resize field");
|
||||
msglog = new StringBuilder("Encrypted Length (").append(encLength)
|
||||
.append(") does NOT fit into field (")
|
||||
.append(column.getFieldLength()).append(") - resize field");
|
||||
addLog(0, null, null, msglog.toString());
|
||||
error = true;
|
||||
}
|
||||
}
|
||||
|
@ -167,22 +176,25 @@ public class ColumnEncryption extends SvrProcess {
|
|||
while (testClear.length() < p_MaxLength)
|
||||
testClear.append(testClear);
|
||||
testClear.delete(p_MaxLength,testClear.length());
|
||||
StringBuilder msglog = new StringBuilder()
|
||||
msglog = new StringBuilder()
|
||||
.append("Test=").append(testClear.toString()).append(" (").append(p_MaxLength).append(")");
|
||||
log.config(msglog.toString());
|
||||
//
|
||||
String encString = SecureEngine.encrypt(testClear.toString());
|
||||
int encLength = encString.length();
|
||||
|
||||
addLog(0, null, null, "Test Max Length=" + testClear.length()
|
||||
+ " -> " + encLength);
|
||||
if (encLength <= column.getFieldLength())
|
||||
addLog(0, null, null, "Encrypted Max Length (" + encLength
|
||||
+ ") fits into field (" + column.getFieldLength() + ")");
|
||||
msglog = new StringBuilder("Test Max Length=").append(testClear.length())
|
||||
.append(" -> ").append(encLength);
|
||||
addLog(0, null, null, msglog.toString());
|
||||
if (encLength <= column.getFieldLength()){
|
||||
msglog = new StringBuilder("Encrypted Max Length (").append(encLength)
|
||||
.append(") fits into field (").append(column.getFieldLength()).append(")");
|
||||
addLog(0, null, null, msglog.toString());
|
||||
}
|
||||
else {
|
||||
addLog(0, null, null, "Encrypted Max Length (" + encLength
|
||||
+ ") does NOT fit into field ("
|
||||
+ column.getFieldLength() + ") - resize field");
|
||||
msglog = new StringBuilder("Encrypted Max Length (").append(encLength)
|
||||
.append(") does NOT fit into field (")
|
||||
.append(column.getFieldLength()).append(") - resize field");
|
||||
addLog(0, null, null, msglog.toString());
|
||||
error = true;
|
||||
}
|
||||
}
|
||||
|
@ -227,14 +239,18 @@ public class ColumnEncryption extends SvrProcess {
|
|||
}
|
||||
|
||||
if (p_IsEncrypted != column.isEncrypted()) {
|
||||
if (error || !p_ChangeSetting)
|
||||
addLog(0, null, null, "Encryption NOT changed - Encryption="
|
||||
+ column.isEncrypted());
|
||||
if (error || !p_ChangeSetting){
|
||||
msglog = new StringBuilder("Encryption NOT changed - Encryption=")
|
||||
.append(column.isEncrypted());
|
||||
addLog(0, null, null, msglog.toString());
|
||||
}
|
||||
else {
|
||||
column.setIsEncrypted(p_IsEncrypted);
|
||||
if (column.save())
|
||||
addLog(0, null, null, "Encryption CHANGED - Encryption="
|
||||
+ column.isEncrypted());
|
||||
if (column.save()){
|
||||
msglog = new StringBuilder("Encryption CHANGED - Encryption=")
|
||||
.append(column.isEncrypted());
|
||||
addLog(0, null, null, msglog.toString());
|
||||
}
|
||||
else
|
||||
addLog(0, null, null, "Save Error");
|
||||
}
|
||||
|
@ -274,17 +290,17 @@ public class ColumnEncryption extends SvrProcess {
|
|||
private int encryptColumnContents(String columnName, String tableName)
|
||||
throws Exception {
|
||||
int recordsEncrypted = 0;
|
||||
String idColumnName = tableName + "_ID";
|
||||
StringBuilder idColumnName = new StringBuilder(tableName).append("_ID");
|
||||
|
||||
StringBuilder selectSql = new StringBuilder();
|
||||
selectSql.append("SELECT " + idColumnName + "," + columnName);
|
||||
selectSql.append(" FROM " + tableName);
|
||||
selectSql.append(" ORDER BY " + idColumnName);
|
||||
selectSql.append("SELECT ").append(idColumnName).append(",").append(columnName);
|
||||
selectSql.append(" FROM ").append(tableName);
|
||||
selectSql.append(" ORDER BY ").append(idColumnName);
|
||||
|
||||
StringBuilder updateSql = new StringBuilder();
|
||||
updateSql.append("UPDATE " + tableName);
|
||||
updateSql.append(" SET " + columnName + "=?");
|
||||
updateSql.append(" WHERE " + idColumnName + "=?");
|
||||
updateSql.append("UPDATE ").append(tableName);
|
||||
updateSql.append(" SET ").append(columnName).append("=?");
|
||||
updateSql.append(" WHERE ").append(idColumnName).append("=?");
|
||||
|
||||
PreparedStatement selectStmt = null;
|
||||
PreparedStatement updateStmt = null;
|
||||
|
@ -357,16 +373,16 @@ public class ColumnEncryption extends SvrProcess {
|
|||
|
||||
// Alter SQL
|
||||
StringBuffer alterSql = new StringBuffer();
|
||||
alterSql.append("ALTER TABLE " + tableName);
|
||||
alterSql.append(" MODIFY " + columnName);
|
||||
alterSql.append("ALTER TABLE ").append(tableName);
|
||||
alterSql.append(" MODIFY ").append(columnName);
|
||||
alterSql.append(" NVARCHAR2(");
|
||||
alterSql.append(length + ") ");
|
||||
alterSql.append(length).append(") ");
|
||||
|
||||
// Update SQL
|
||||
StringBuffer updateSql = new StringBuffer();
|
||||
updateSql.append("UPDATE AD_Column");
|
||||
updateSql.append(" SET FieldLength=" + length);
|
||||
updateSql.append(" WHERE AD_Column_ID=" + columnID);
|
||||
updateSql.append(" SET FieldLength=").append(length);
|
||||
updateSql.append(" WHERE AD_Column_ID=").append(columnID);
|
||||
|
||||
PreparedStatement selectStmt = null;
|
||||
|
||||
|
|
|
@ -140,12 +140,12 @@ public class ColumnSync extends SvrProcess
|
|||
|
||||
if (no == -1)
|
||||
{
|
||||
String msg = "@Error@ ";
|
||||
StringBuilder msg = new StringBuilder("@Error@ ");
|
||||
ValueNamePair pp = CLogger.retrieveError();
|
||||
if (pp != null)
|
||||
msg = pp.getName() + " - ";
|
||||
msg += sql;
|
||||
throw new AdempiereUserError (msg);
|
||||
msg = new StringBuilder(pp.getName()).append(" - ");
|
||||
msg.append(sql);
|
||||
throw new AdempiereUserError (msg.toString());
|
||||
}
|
||||
return sql;
|
||||
} finally {
|
||||
|
|
|
@ -89,10 +89,10 @@ public class CommissionCalc extends SvrProcess
|
|||
comRun.setStartDate(p_StartDate);
|
||||
// 01-Jan-2000 - 31-Jan-2001 - USD
|
||||
SimpleDateFormat format = DisplayType.getDateFormat(DisplayType.Date);
|
||||
String description = format.format(p_StartDate)
|
||||
+ " - " + format.format(m_EndDate)
|
||||
+ " - " + MCurrency.getISO_Code(getCtx(), m_com.getC_Currency_ID());
|
||||
comRun.setDescription(description);
|
||||
StringBuilder description = new StringBuilder(format.format(p_StartDate))
|
||||
.append(" - ").append(format.format(m_EndDate))
|
||||
.append(" - ").append(MCurrency.getISO_Code(getCtx(), m_com.getC_Currency_ID()));
|
||||
comRun.setDescription(description.toString());
|
||||
if (!comRun.save())
|
||||
throw new AdempiereSystemError ("Could not save Commission Run");
|
||||
|
||||
|
@ -104,94 +104,94 @@ public class CommissionCalc extends SvrProcess
|
|||
if (!comAmt.save())
|
||||
throw new AdempiereSystemError ("Could not save Commission Amt");
|
||||
//
|
||||
StringBuffer sql = new StringBuffer();
|
||||
StringBuilder sql = new StringBuilder();
|
||||
if (MCommission.DOCBASISTYPE_Receipt.equals(m_com.getDocBasisType()))
|
||||
{
|
||||
if (m_com.isListDetails())
|
||||
{
|
||||
sql.append("SELECT h.C_Currency_ID, (l.LineNetAmt*al.Amount/h.GrandTotal) AS Amt,"
|
||||
+ " (l.QtyInvoiced*al.Amount/h.GrandTotal) AS Qty,"
|
||||
+ " NULL, l.C_InvoiceLine_ID, p.DocumentNo||'_'||h.DocumentNo,"
|
||||
+ " COALESCE(prd.Value,l.Description), h.DateInvoiced "
|
||||
+ "FROM C_Payment p"
|
||||
+ " INNER JOIN C_AllocationLine al ON (p.C_Payment_ID=al.C_Payment_ID)"
|
||||
+ " INNER JOIN C_Invoice h ON (al.C_Invoice_ID = h.C_Invoice_ID)"
|
||||
+ " INNER JOIN C_InvoiceLine l ON (h.C_Invoice_ID = l.C_Invoice_ID) "
|
||||
+ " LEFT OUTER JOIN M_Product prd ON (l.M_Product_ID = prd.M_Product_ID) "
|
||||
+ "WHERE p.DocStatus IN ('CL','CO','RE')"
|
||||
+ " AND h.IsSOTrx='Y'"
|
||||
+ " AND p.AD_Client_ID = ?"
|
||||
+ " AND p.DateTrx BETWEEN ? AND ?");
|
||||
sql.append("SELECT h.C_Currency_ID, (l.LineNetAmt*al.Amount/h.GrandTotal) AS Amt,")
|
||||
.append(" (l.QtyInvoiced*al.Amount/h.GrandTotal) AS Qty,")
|
||||
.append(" NULL, l.C_InvoiceLine_ID, p.DocumentNo||'_'||h.DocumentNo,")
|
||||
.append(" COALESCE(prd.Value,l.Description), h.DateInvoiced ")
|
||||
.append("FROM C_Payment p")
|
||||
.append(" INNER JOIN C_AllocationLine al ON (p.C_Payment_ID=al.C_Payment_ID)")
|
||||
.append(" INNER JOIN C_Invoice h ON (al.C_Invoice_ID = h.C_Invoice_ID)")
|
||||
.append(" INNER JOIN C_InvoiceLine l ON (h.C_Invoice_ID = l.C_Invoice_ID) ")
|
||||
.append(" LEFT OUTER JOIN M_Product prd ON (l.M_Product_ID = prd.M_Product_ID) ")
|
||||
.append("WHERE p.DocStatus IN ('CL','CO','RE')")
|
||||
.append(" AND h.IsSOTrx='Y'")
|
||||
.append(" AND p.AD_Client_ID = ?")
|
||||
.append(" AND p.DateTrx BETWEEN ? AND ?");
|
||||
}
|
||||
else
|
||||
{
|
||||
sql.append("SELECT h.C_Currency_ID, SUM(l.LineNetAmt*al.Amount/h.GrandTotal) AS Amt,"
|
||||
+ " SUM(l.QtyInvoiced*al.Amount/h.GrandTotal) AS Qty,"
|
||||
+ " NULL, NULL, NULL, NULL, MAX(h.DateInvoiced) "
|
||||
+ "FROM C_Payment p"
|
||||
+ " INNER JOIN C_AllocationLine al ON (p.C_Payment_ID=al.C_Payment_ID)"
|
||||
+ " INNER JOIN C_Invoice h ON (al.C_Invoice_ID = h.C_Invoice_ID)"
|
||||
+ " INNER JOIN C_InvoiceLine l ON (h.C_Invoice_ID = l.C_Invoice_ID) "
|
||||
+ "WHERE p.DocStatus IN ('CL','CO','RE')"
|
||||
+ " AND h.IsSOTrx='Y'"
|
||||
+ " AND p.AD_Client_ID = ?"
|
||||
+ " AND p.DateTrx BETWEEN ? AND ?");
|
||||
sql.append("SELECT h.C_Currency_ID, SUM(l.LineNetAmt*al.Amount/h.GrandTotal) AS Amt,")
|
||||
.append(" SUM(l.QtyInvoiced*al.Amount/h.GrandTotal) AS Qty,")
|
||||
.append(" NULL, NULL, NULL, NULL, MAX(h.DateInvoiced) ")
|
||||
.append("FROM C_Payment p")
|
||||
.append(" INNER JOIN C_AllocationLine al ON (p.C_Payment_ID=al.C_Payment_ID)")
|
||||
.append(" INNER JOIN C_Invoice h ON (al.C_Invoice_ID = h.C_Invoice_ID)")
|
||||
.append(" INNER JOIN C_InvoiceLine l ON (h.C_Invoice_ID = l.C_Invoice_ID) ")
|
||||
.append("WHERE p.DocStatus IN ('CL','CO','RE')")
|
||||
.append(" AND h.IsSOTrx='Y'")
|
||||
.append(" AND p.AD_Client_ID = ?")
|
||||
.append(" AND p.DateTrx BETWEEN ? AND ?");
|
||||
}
|
||||
}
|
||||
else if (MCommission.DOCBASISTYPE_Order.equals(m_com.getDocBasisType()))
|
||||
{
|
||||
if (m_com.isListDetails())
|
||||
{
|
||||
sql.append("SELECT h.C_Currency_ID, l.LineNetAmt, l.QtyOrdered, "
|
||||
+ "l.C_OrderLine_ID, NULL, h.DocumentNo,"
|
||||
+ " COALESCE(prd.Value,l.Description),h.DateOrdered "
|
||||
+ "FROM C_Order h"
|
||||
+ " INNER JOIN C_OrderLine l ON (h.C_Order_ID = l.C_Order_ID)"
|
||||
+ " LEFT OUTER JOIN M_Product prd ON (l.M_Product_ID = prd.M_Product_ID) "
|
||||
+ "WHERE h.DocStatus IN ('CL','CO')"
|
||||
+ " AND h.IsSOTrx='Y'"
|
||||
+ " AND h.AD_Client_ID = ?"
|
||||
+ " AND h.DateOrdered BETWEEN ? AND ?");
|
||||
sql.append("SELECT h.C_Currency_ID, l.LineNetAmt, l.QtyOrdered, ")
|
||||
.append("l.C_OrderLine_ID, NULL, h.DocumentNo,")
|
||||
.append(" COALESCE(prd.Value,l.Description),h.DateOrdered ")
|
||||
.append("FROM C_Order h")
|
||||
.append(" INNER JOIN C_OrderLine l ON (h.C_Order_ID = l.C_Order_ID)")
|
||||
.append(" LEFT OUTER JOIN M_Product prd ON (l.M_Product_ID = prd.M_Product_ID) ")
|
||||
.append("WHERE h.DocStatus IN ('CL','CO')")
|
||||
.append(" AND h.IsSOTrx='Y'")
|
||||
.append(" AND h.AD_Client_ID = ?")
|
||||
.append(" AND h.DateOrdered BETWEEN ? AND ?");
|
||||
}
|
||||
else
|
||||
{
|
||||
sql.append("SELECT h.C_Currency_ID, SUM(l.LineNetAmt) AS Amt,"
|
||||
+ " SUM(l.QtyOrdered) AS Qty, "
|
||||
+ "NULL, NULL, NULL, NULL, MAX(h.DateOrdered) "
|
||||
+ "FROM C_Order h"
|
||||
+ " INNER JOIN C_OrderLine l ON (h.C_Order_ID = l.C_Order_ID) "
|
||||
+ "WHERE h.DocStatus IN ('CL','CO')"
|
||||
+ " AND h.IsSOTrx='Y'"
|
||||
+ " AND h.AD_Client_ID = ?"
|
||||
+ " AND h.DateOrdered BETWEEN ? AND ?");
|
||||
sql.append("SELECT h.C_Currency_ID, SUM(l.LineNetAmt) AS Amt,")
|
||||
.append(" SUM(l.QtyOrdered) AS Qty, ")
|
||||
.append("NULL, NULL, NULL, NULL, MAX(h.DateOrdered) ")
|
||||
.append("FROM C_Order h")
|
||||
.append(" INNER JOIN C_OrderLine l ON (h.C_Order_ID = l.C_Order_ID) ")
|
||||
.append("WHERE h.DocStatus IN ('CL','CO')")
|
||||
.append(" AND h.IsSOTrx='Y'")
|
||||
.append(" AND h.AD_Client_ID = ?")
|
||||
.append(" AND h.DateOrdered BETWEEN ? AND ?");
|
||||
}
|
||||
}
|
||||
else // Invoice Basis
|
||||
{
|
||||
if (m_com.isListDetails())
|
||||
{
|
||||
sql.append("SELECT h.C_Currency_ID, l.LineNetAmt, l.QtyInvoiced, "
|
||||
+ "NULL, l.C_InvoiceLine_ID, h.DocumentNo,"
|
||||
+ " COALESCE(prd.Value,l.Description),h.DateInvoiced "
|
||||
+ "FROM C_Invoice h"
|
||||
+ " INNER JOIN C_InvoiceLine l ON (h.C_Invoice_ID = l.C_Invoice_ID)"
|
||||
+ " LEFT OUTER JOIN M_Product prd ON (l.M_Product_ID = prd.M_Product_ID) "
|
||||
+ "WHERE h.DocStatus IN ('CL','CO','RE')"
|
||||
+ " AND h.IsSOTrx='Y'"
|
||||
+ " AND h.AD_Client_ID = ?"
|
||||
+ " AND h.DateInvoiced BETWEEN ? AND ?");
|
||||
sql.append("SELECT h.C_Currency_ID, l.LineNetAmt, l.QtyInvoiced, ")
|
||||
.append("NULL, l.C_InvoiceLine_ID, h.DocumentNo,")
|
||||
.append(" COALESCE(prd.Value,l.Description),h.DateInvoiced ")
|
||||
.append("FROM C_Invoice h")
|
||||
.append(" INNER JOIN C_InvoiceLine l ON (h.C_Invoice_ID = l.C_Invoice_ID)")
|
||||
.append(" LEFT OUTER JOIN M_Product prd ON (l.M_Product_ID = prd.M_Product_ID) ")
|
||||
.append("WHERE h.DocStatus IN ('CL','CO','RE')")
|
||||
.append(" AND h.IsSOTrx='Y'")
|
||||
.append(" AND h.AD_Client_ID = ?")
|
||||
.append(" AND h.DateInvoiced BETWEEN ? AND ?");
|
||||
}
|
||||
else
|
||||
{
|
||||
sql.append("SELECT h.C_Currency_ID, SUM(l.LineNetAmt) AS Amt,"
|
||||
+ " SUM(l.QtyInvoiced) AS Qty, "
|
||||
+ "NULL, NULL, NULL, NULL, MAX(h.DateInvoiced) "
|
||||
+ "FROM C_Invoice h"
|
||||
+ " INNER JOIN C_InvoiceLine l ON (h.C_Invoice_ID = l.C_Invoice_ID) "
|
||||
+ "WHERE h.DocStatus IN ('CL','CO','RE')"
|
||||
+ " AND h.IsSOTrx='Y'"
|
||||
+ " AND h.AD_Client_ID = ?"
|
||||
+ " AND h.DateInvoiced BETWEEN ? AND ?");
|
||||
sql.append("SELECT h.C_Currency_ID, SUM(l.LineNetAmt) AS Amt,")
|
||||
.append(" SUM(l.QtyInvoiced) AS Qty, ")
|
||||
.append("NULL, NULL, NULL, NULL, MAX(h.DateInvoiced) ")
|
||||
.append("FROM C_Invoice h")
|
||||
.append(" INNER JOIN C_InvoiceLine l ON (h.C_Invoice_ID = l.C_Invoice_ID) ")
|
||||
.append("WHERE h.DocStatus IN ('CL','CO','RE')")
|
||||
.append(" AND h.IsSOTrx='Y'")
|
||||
.append(" AND h.AD_Client_ID = ?")
|
||||
.append(" AND h.DateInvoiced BETWEEN ? AND ?");
|
||||
}
|
||||
}
|
||||
// CommissionOrders/Invoices
|
||||
|
@ -221,19 +221,19 @@ public class CommissionCalc extends SvrProcess
|
|||
sql.append(" AND h.C_BPartner_ID=").append(lines[i].getC_BPartner_ID());
|
||||
// BPartner Group
|
||||
if (lines[i].getC_BP_Group_ID() != 0)
|
||||
sql.append(" AND h.C_BPartner_ID IN "
|
||||
+ "(SELECT C_BPartner_ID FROM C_BPartner WHERE C_BP_Group_ID=").append(lines[i].getC_BP_Group_ID()).append(")");
|
||||
sql.append(" AND h.C_BPartner_ID IN ")
|
||||
.append("(SELECT C_BPartner_ID FROM C_BPartner WHERE C_BP_Group_ID=").append(lines[i].getC_BP_Group_ID()).append(")");
|
||||
// Sales Region
|
||||
if (lines[i].getC_SalesRegion_ID() != 0)
|
||||
sql.append(" AND h.C_BPartner_Location_ID IN "
|
||||
+ "(SELECT C_BPartner_Location_ID FROM C_BPartner_Location WHERE C_SalesRegion_ID=").append(lines[i].getC_SalesRegion_ID()).append(")");
|
||||
sql.append(" AND h.C_BPartner_Location_ID IN ")
|
||||
.append("(SELECT C_BPartner_Location_ID FROM C_BPartner_Location WHERE C_SalesRegion_ID=").append(lines[i].getC_SalesRegion_ID()).append(")");
|
||||
// Product
|
||||
if (lines[i].getM_Product_ID() != 0)
|
||||
sql.append(" AND l.M_Product_ID=").append(lines[i].getM_Product_ID());
|
||||
// Product Category
|
||||
if (lines[i].getM_Product_Category_ID() != 0)
|
||||
sql.append(" AND l.M_Product_ID IN "
|
||||
+ "(SELECT M_Product_ID FROM M_Product WHERE M_Product_Category_ID=").append(lines[i].getM_Product_Category_ID()).append(")");
|
||||
sql.append(" AND l.M_Product_ID IN ")
|
||||
.append("(SELECT M_Product_ID FROM M_Product WHERE M_Product_Category_ID=").append(lines[i].getM_Product_Category_ID()).append(")");
|
||||
// Payment Rule
|
||||
if (lines[i].getPaymentRule() != null)
|
||||
sql.append(" AND h.PaymentRule='").append(lines[i].getPaymentRule()).append("'");
|
||||
|
@ -254,9 +254,9 @@ public class CommissionCalc extends SvrProcess
|
|||
// Save Last Run
|
||||
m_com.setDateLastRun (p_StartDate);
|
||||
m_com.saveEx();
|
||||
|
||||
return "@C_CommissionRun_ID@ = " + comRun.getDocumentNo()
|
||||
+ " - " + comRun.getDescription();
|
||||
StringBuilder msgreturn = new StringBuilder("@C_CommissionRun_ID@ = ").append(comRun.getDocumentNo())
|
||||
.append(" - ").append(comRun.getDescription());
|
||||
return msgreturn.toString();
|
||||
} // doIt
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue