diff --git a/base/src/org/adempiere/engine/AverageInvoiceCostingMethod.java b/base/src/org/adempiere/engine/AverageInvoiceCostingMethod.java index 780aee890c..55541cb9f1 100644 --- a/base/src/org/adempiere/engine/AverageInvoiceCostingMethod.java +++ b/base/src/org/adempiere/engine/AverageInvoiceCostingMethod.java @@ -426,9 +426,9 @@ public void createCostAdjustment() { } } - @Override + /*@Override public void processCostDetail(MCostDetail costDetail) { - } + }*/ @Override protected List getCalculatedCosts() { diff --git a/base/src/org/adempiere/engine/AveragePOCostingMethod.java b/base/src/org/adempiere/engine/AveragePOCostingMethod.java index 71f415132e..cb4992d2c7 100644 --- a/base/src/org/adempiere/engine/AveragePOCostingMethod.java +++ b/base/src/org/adempiere/engine/AveragePOCostingMethod.java @@ -370,9 +370,9 @@ public void createCostAdjustment() { } } - @Override + /*@Override public void processCostDetail(MCostDetail costDetail) { - } + }*/ @Override protected List getCalculatedCosts() { diff --git a/base/src/org/adempiere/engine/ICostingMethod.java b/base/src/org/adempiere/engine/ICostingMethod.java index 87cb96f6b3..4b2bc478d8 100644 --- a/base/src/org/adempiere/engine/ICostingMethod.java +++ b/base/src/org/adempiere/engine/ICostingMethod.java @@ -43,5 +43,5 @@ public interface ICostingMethod public void setCostingMethod(MAcctSchema accountSchema, MTransaction transaction, IDocumentLine model, MCost dimension, BigDecimal costThisLevel, BigDecimal costLowLevel, Boolean isSalesTransaction); public MCostDetail process(); - public void processCostDetail(MCostDetail costDetail); + //public void processCostDetail(MCostDetail costDetail); } diff --git a/base/src/org/adempiere/engine/LastInvoiceCostingMethod.java b/base/src/org/adempiere/engine/LastInvoiceCostingMethod.java index 0eb2595288..fa88ffa48a 100644 --- a/base/src/org/adempiere/engine/LastInvoiceCostingMethod.java +++ b/base/src/org/adempiere/engine/LastInvoiceCostingMethod.java @@ -85,11 +85,11 @@ public MCostDetail process() { return costDetail; } - @Override + /*@Override public void processCostDetail(MCostDetail mCostdetail) { // TODO Auto-generated method stub - } + }*/ @Override protected List getCalculatedCosts() { diff --git a/base/src/org/adempiere/engine/LastPOPriceCostingMethod.java b/base/src/org/adempiere/engine/LastPOPriceCostingMethod.java index 6fde084927..58036af0a3 100644 --- a/base/src/org/adempiere/engine/LastPOPriceCostingMethod.java +++ b/base/src/org/adempiere/engine/LastPOPriceCostingMethod.java @@ -88,11 +88,11 @@ else if ( costDetail.getM_InOutLine_ID() != 0 // AR Shipment Detail Record return costDetail; } - @Override + /*@Override public void processCostDetail(MCostDetail mCostdetail) { // TODO Auto-generated method stub - } + }*/ @Override protected List getCalculatedCosts() { diff --git a/base/src/org/adempiere/engine/StandardCostingMethod.java b/base/src/org/adempiere/engine/StandardCostingMethod.java index c2ad43ea25..cb84ecb28b 100644 --- a/base/src/org/adempiere/engine/StandardCostingMethod.java +++ b/base/src/org/adempiere/engine/StandardCostingMethod.java @@ -310,7 +310,7 @@ public BigDecimal getNewAccumulatedQuantity(MCostDetail cd) { return cd.getCumulatedQty().add(cd.getQty()); } - public void processCostDetail(MCostDetail costDetail) { + /*public void processCostDetail(MCostDetail costDetail) { if (!costDetail.isProcessed()) { MAcctSchema as = MAcctSchema.get(costDetail.getCtx(), costDetail.getC_AcctSchema_ID()); @@ -318,7 +318,7 @@ public void processCostDetail(MCostDetail costDetail) { if (client.isCostImmediate()) costDetail.process(); } - } + }*/ @Override protected List getCalculatedCosts() { @@ -660,7 +660,7 @@ public MCostDetail createVarianceCostDetail(MPPCostCollector costCollector, costDetailVariance.setQty(quantity); costDetailVariance.setDateAcct(costCollector.getDateAcct()); costDetailVariance.saveEx(); - processCostDetail(costDetailVariance); + //processCostDetail(costDetailVariance); return costDetailVariance; } @@ -708,7 +708,7 @@ public void createActivityControl(MPPCostCollector costCollector) { costDetail.setDateAcct(costCollector.getDateAcct()); costDetail.setCostAmt(costs.negate()); costDetail.saveEx(); - processCostDetail(costDetail); + //processCostDetail(costDetail); } } } diff --git a/base/src/org/compiere/acct/Doc_Invoice.java b/base/src/org/compiere/acct/Doc_Invoice.java index 29fe4b4142..7ac18d805e 100644 --- a/base/src/org/compiere/acct/Doc_Invoice.java +++ b/base/src/org/compiere/acct/Doc_Invoice.java @@ -539,13 +539,13 @@ else if (getDocumentType().equals(DOCTYPE_APInvoice)) serviceAmt = serviceAmt.add(amt); } // - if (line.getM_Product_ID() != 0 + /*if (line.getM_Product_ID() != 0 && line.getProduct().isService()) // otherwise Inv Matching MCostDetail.createInvoice(as, line.getAD_Org_ID(), line.getM_Product_ID(), line.getM_AttributeSetInstance_ID(), line.get_ID(), 0, // No Cost Element line.getAmtSource(), line.getQty(), - line.getDescription(), getTrxName()); + line.getDescription(), getTrxName());*/ } } // Set Locations @@ -645,13 +645,13 @@ else if (getDocumentType().equals(DOCTYPE_APCredit)) serviceAmt = serviceAmt.add(amt); } // - if (line.getM_Product_ID() != 0 + /*if (line.getM_Product_ID() != 0 && line.getProduct().isService()) // otherwise Inv Matching MCostDetail.createInvoice(as, line.getAD_Org_ID(), line.getM_Product_ID(), line.getM_AttributeSetInstance_ID(), line.get_ID(), 0, // No Cost Element line.getAmtSource().negate(), line.getQty(), - line.getDescription(), getTrxName()); + line.getDescription(), getTrxName());*/ } } // Set Locations @@ -914,11 +914,11 @@ private boolean landedCost (MAcctSchema as, Fact fact, DocLine line, boolean dr) allocationAmt = allocationAmt.negate(); // AZ Goodwill // use createInvoice to create/update non Material Cost Detail - MCostDetail.createInvoice(as, lca.getAD_Org_ID(), + /*MCostDetail.createInvoice(as, lca.getAD_Org_ID(), lca.getM_Product_ID(), lca.getM_AttributeSetInstance_ID(), C_InvoiceLine_ID, lca.getM_CostElement_ID(), allocationAmt, lca.getQty(), - desc, getTrxName()); + desc, getTrxName());*/ // end AZ } diff --git a/base/src/org/compiere/model/MCost.java b/base/src/org/compiere/model/MCost.java index c4ab9e06e2..ba0ecdf447 100644 --- a/base/src/org/compiere/model/MCost.java +++ b/base/src/org/compiere/model/MCost.java @@ -447,7 +447,7 @@ else if (MAcctSchema.COSTINGLEVEL_BatchLot.equals(CostingLevel)) * @return current cost price or null * @deprecated */ - public static BigDecimal getCurrentCost (MProduct product, + /*public static BigDecimal getCurrentCost (MProduct product, int M_AttributeSetInstance_ID, MAcctSchema as, int AD_Org_ID, int M_Warehouse_ID, String costingMethod, BigDecimal qty, int C_OrderLine_ID, @@ -481,6 +481,7 @@ else if (MAcctSchema.COSTINGLEVEL_BatchLot.equals(CostingLevel)) as, AD_Org_ID, M_Warehouse_ID, as.getM_CostType_ID(), costingMethod, qty, C_OrderLine_ID, zeroCostsOK, trxName); } // getCurrentCost + */ /** * Get Current Cost Price for Costing Level @@ -1000,7 +1001,7 @@ public static BigDecimal getPOPrice (MProduct product, int C_OrderLine_ID, int C * @param client client */ @Deprecated - public static void create (MClient client) + /*public static void create (MClient client) { MAcctSchema[] ass = MAcctSchema.getClientAcctSchema(client.getCtx(), client.getAD_Client_ID()); String trxName = client.get_TrxName(); @@ -1062,6 +1063,7 @@ public static void create (MClient client) trx.close(); } } // create + */ /** @@ -2025,7 +2027,7 @@ WHERE EXISTS (SELECT * FROM M_CostElement ce Adempiere.startup(true); MClient client = MClient.get(Env.getCtx(), 11); // GardenWorld - create(client); + //create(client); } // main diff --git a/base/src/org/compiere/model/MCostDetail.java b/base/src/org/compiere/model/MCostDetail.java index 9afc4475b6..6b405643aa 100644 --- a/base/src/org/compiere/model/MCostDetail.java +++ b/base/src/org/compiere/model/MCostDetail.java @@ -517,7 +517,7 @@ public static List getAfterDate (MCostDetail cd, String costingLeve * @param trxName transaction * @return true if created */ - public static boolean createOrder (MAcctSchema as, int AD_Org_ID, + /*public static boolean createOrder (MAcctSchema as, int AD_Org_ID, int M_Product_ID, int M_AttributeSetInstance_ID, int C_OrderLine_ID, int M_CostElement_ID, BigDecimal Amt, BigDecimal Qty, @@ -569,6 +569,7 @@ public static boolean createOrder (MAcctSchema as, int AD_Org_ID, s_log.config("(" + ok + ") " + cd); return ok; } // createOrder + */ /** @@ -586,7 +587,7 @@ public static boolean createOrder (MAcctSchema as, int AD_Org_ID, * @param trxName transaction * @return true if created */ - public static boolean createInvoice (MAcctSchema as, int AD_Org_ID, + /*public static boolean createInvoice (MAcctSchema as, int AD_Org_ID, int M_Product_ID, int M_AttributeSetInstance_ID, int C_InvoiceLine_ID, int M_CostElement_ID, BigDecimal Amt, BigDecimal Qty, @@ -638,6 +639,7 @@ public static boolean createInvoice (MAcctSchema as, int AD_Org_ID, s_log.config("(" + ok + ") " + cd); return ok; } // createInvoice + */ /** * Create New Shipment Cost Detail for SO Shipments. @@ -655,7 +657,7 @@ public static boolean createInvoice (MAcctSchema as, int AD_Org_ID, * @param trxName transaction * @return true if no error */ - public static boolean createShipment (MAcctSchema as, int AD_Org_ID, + /*public static boolean createShipment (MAcctSchema as, int AD_Org_ID, int M_Product_ID, int M_AttributeSetInstance_ID, int M_InOutLine_ID, int M_CostElement_ID, BigDecimal Amt, BigDecimal Qty, @@ -708,6 +710,7 @@ public static boolean createShipment (MAcctSchema as, int AD_Org_ID, s_log.config("(" + ok + ") " + cd); return ok; } // createShipment + */ /** * Create New Order Cost Detail for Physical Inventory. @@ -724,6 +727,7 @@ public static boolean createShipment (MAcctSchema as, int AD_Org_ID, * @param trxName transaction * @return true if no error */ + /* public static boolean createInventory (MAcctSchema as, int AD_Org_ID, int M_Product_ID, int M_AttributeSetInstance_ID, int M_InventoryLine_ID, int M_CostElement_ID, @@ -776,6 +780,7 @@ public static boolean createInventory (MAcctSchema as, int AD_Org_ID, s_log.config("(" + ok + ") " + cd); return ok; } // createInventory + */ /** * Create New Order Cost Detail for Movements. @@ -793,7 +798,7 @@ public static boolean createInventory (MAcctSchema as, int AD_Org_ID, * @param trxName transaction * @return true if no error */ - public static boolean createMovement (MAcctSchema as, int AD_Org_ID, + /*public static boolean createMovement (MAcctSchema as, int AD_Org_ID, int M_Product_ID, int M_AttributeSetInstance_ID, int M_MovementLine_ID, int M_CostElement_ID, BigDecimal Amt, BigDecimal Qty, boolean from, @@ -848,6 +853,7 @@ public static boolean createMovement (MAcctSchema as, int AD_Org_ID, s_log.config("(" + ok + ") " + cd); return ok; } // createMovement + */ /** * Create New Order Cost Detail for Production. @@ -864,7 +870,7 @@ public static boolean createMovement (MAcctSchema as, int AD_Org_ID, * @param trxName transaction * @return true if no error */ - public static boolean createProduction (MAcctSchema as, int AD_Org_ID, + /*public static boolean createProduction (MAcctSchema as, int AD_Org_ID, int M_Product_ID, int M_AttributeSetInstance_ID, int M_ProductionLine_ID, int M_CostElement_ID, BigDecimal Amt, BigDecimal Qty, @@ -916,6 +922,7 @@ public static boolean createProduction (MAcctSchema as, int AD_Org_ID, s_log.config("(" + ok + ") " + cd); return ok; } // createProduction + */ /************************************************************************** * Get Cost Detail @@ -993,7 +1000,7 @@ public static MCostDetail get (Properties ctx, String whereClause, * @param trxName transaction * @return true if no error */ - public static boolean processProduct (MProduct product, String trxName) + /*public static boolean processProduct (MProduct product, String trxName) { final String whereClause = I_M_CostDetail.COLUMNNAME_M_Product_ID+"=?" + " AND "+I_M_CostDetail.COLUMNNAME_Processed+"=?"; @@ -1012,6 +1019,7 @@ public static boolean processProduct (MProduct product, String trxName) s_log.config("OK=" + counterOK + ", Errors=" + counterError); return counterError == 0; } // processProduct + */ /** Logger */ private static CLogger s_log = CLogger.getCLogger (MCostDetail.class); @@ -1296,6 +1304,7 @@ public String toString () * The record is saved if processed. * @return true if processed */ + /* public synchronized boolean process() { if (isProcessed()) @@ -1355,6 +1364,7 @@ else if (MAcctSchema.COSTINGLEVEL_BatchLot.equals(CostingLevel)) { log.info(ok + " - " + toString()); return ok; } // process + */ /** @@ -1629,6 +1639,7 @@ public static BigDecimal getByDocLineMatchInv(MInvoiceLine invoiceLine, MInOutLi invoiceLine.getAD_Client_ID(), acctSchemaId, invoiceLine.getM_Product_ID(), + invoiceLine.getM_AttributeSetInstance_ID(), costTypeId, invoiceLine.getC_InvoiceLine_ID(), inOutLine.getM_InOutLine_ID()) diff --git a/base/src/org/compiere/model/MInventory.java b/base/src/org/compiere/model/MInventory.java index 5e237554a9..d67880dcc3 100644 --- a/base/src/org/compiere/model/MInventory.java +++ b/base/src/org/compiere/model/MInventory.java @@ -996,7 +996,7 @@ else if (MAcctSchema.COSTINGLEVEL_BatchLot.equals(CostingLevel) && M_AttributeSe //if isReversal CostDetail is created from CostDetail of original document // is made a new CostDetail where Amt and Qty are negate - private void createCostDetail(MTransaction trx, int reversalLine_ID) { + /*private void createCostDetail(MTransaction trx, int reversalLine_ID) { String whereClause = MCostDetail.COLUMNNAME_M_InventoryLine_ID+"=?" +" AND "+MCostDetail.COLUMNNAME_M_AttributeSetInstance_ID+"=?"; @@ -1019,7 +1019,7 @@ private void createCostDetail(MTransaction trx, int reversalLine_ID) { cdnew.process(); } - } + }*/ /** * Document Status is Complete or Closed diff --git a/base/src/org/compiere/model/MMatchInv.java b/base/src/org/compiere/model/MMatchInv.java index 655389c542..c45e7fb2e6 100644 --- a/base/src/org/compiere/model/MMatchInv.java +++ b/base/src/org/compiere/model/MMatchInv.java @@ -468,7 +468,7 @@ else if (MAcctSchema.COSTINGLEVEL_BatchLot.equals(CostingLevel)) { final ICostingMethod method = CostingMethodFactory.get().getCostingMethod(ct.getCostingMethod()); method.setCostingMethod(as, trx, this, dimension, Env.ZERO, Env.ZERO, false); - method.processCostDetail(cd); + //method.processCostDetail(cd); } } } diff --git a/base/src/org/compiere/model/ProductCost.java b/base/src/org/compiere/model/ProductCost.java index 76c63a3899..befbc3d9b4 100644 --- a/base/src/org/compiere/model/ProductCost.java +++ b/base/src/org/compiere/model/ProductCost.java @@ -382,7 +382,7 @@ public MAccount getAccountDefault (int AcctType, MAcctSchema as, int AD_Org_ID) * @return cost or null, if qty or costs cannot be determined * @deprecated */ - public BigDecimal getProductCosts (MAcctSchema as, int AD_Org_ID, int M_Warehouse_ID, + /*public BigDecimal getProductCosts (MAcctSchema as, int AD_Org_ID, int M_Warehouse_ID, String costingMethod, int C_OrderLine_ID, boolean zeroCostsOK) { if (m_qty == null) @@ -390,7 +390,7 @@ public BigDecimal getProductCosts (MAcctSchema as, int AD_Org_ID, int M_Warehous log.fine("No Qty"); return null; } - /** Old Costing + *//** Old Costing MClient client = MClient.get(as.getCtx(), as.getAD_Client_ID()); if (!client.isUseBetaFunctions()) { @@ -400,7 +400,7 @@ public BigDecimal getProductCosts (MAcctSchema as, int AD_Org_ID, int M_Warehous log.fine("Qty(" + m_qty + ") * Cost(" + itemCost + ") = " + cost); return cost; } - **/ + **//* // No Product if (m_product == null) @@ -417,7 +417,8 @@ public BigDecimal getProductCosts (MAcctSchema as, int AD_Org_ID, int M_Warehous return null; } return cost; - } // getProductCosts + } // getProductCosts*/ + /** diff --git a/base/src/org/compiere/process/CostCreate.java b/base/src/org/compiere/process/CostCreate.java index 058491092a..80932f10df 100644 --- a/base/src/org/compiere/process/CostCreate.java +++ b/base/src/org/compiere/process/CostCreate.java @@ -66,9 +66,9 @@ protected String doIt() throws Exception if (product.get_ID() != p_M_Product_ID) throw new AdempiereUserError("@NotFound@: @M_Product_ID@ = " + p_M_Product_ID); // - if (MCostDetail.processProduct(product, get_TrxName())) + //if (MCostDetail.processProduct(product, get_TrxName())) return "@OK@"; - return "@Error@"; + //return "@Error@"; } // doIt } // CostCreate diff --git a/base/src/org/eevolution/model/I_HR_Concept.java b/base/src/org/eevolution/model/I_HR_Concept.java index 9a32ee125c..57f18c6ddf 100644 --- a/base/src/org/eevolution/model/I_HR_Concept.java +++ b/base/src/org/eevolution/model/I_HR_Concept.java @@ -42,6 +42,19 @@ public interface I_HR_Concept /** Load Meta Data */ + /** Column name AccountSign */ + public static final String COLUMNNAME_AccountSign = "AccountSign"; + + /** Set Account Sign. + * Indicates the Natural Sign of the Account as a Debit or Credit + */ + public void setAccountSign (String AccountSign); + + /** Get Account Sign. + * Indicates the Natural Sign of the Account as a Debit or Credit + */ + public String getAccountSign(); + /** Column name AD_Client_ID */ public static final String COLUMNNAME_AD_Client_ID = "AD_Client_ID"; @@ -78,19 +91,6 @@ public interface I_HR_Concept public org.compiere.model.I_AD_Reference getAD_Reference() throws RuntimeException; - /** Column name AccountSign */ - public static final String COLUMNNAME_AccountSign = "AccountSign"; - - /** Set Account Sign. - * Indicates the Natural Sign of the Account as a Debit or Credit - */ - public void setAccountSign (String AccountSign); - - /** Get Account Sign. - * Indicates the Natural Sign of the Account as a Debit or Credit - */ - public String getAccountSign(); - /** Column name ColumnType */ public static final String COLUMNNAME_ColumnType = "ColumnType"; @@ -291,6 +291,19 @@ public interface I_HR_Concept */ public boolean isPaid(); + /** Column name IsPrepayment */ + public static final String COLUMNNAME_IsPrepayment = "IsPrepayment"; + + /** Set Prepayment. + * The Payment/Receipt is a Prepayment + */ + public void setIsPrepayment (boolean IsPrepayment); + + /** Get Prepayment. + * The Payment/Receipt is a Prepayment + */ + public boolean isPrepayment(); + /** Column name IsPrinted */ public static final String COLUMNNAME_IsPrinted = "IsPrinted"; diff --git a/base/src/org/eevolution/model/X_HR_Concept.java b/base/src/org/eevolution/model/X_HR_Concept.java index 64f0c815b0..27890e3e59 100644 --- a/base/src/org/eevolution/model/X_HR_Concept.java +++ b/base/src/org/eevolution/model/X_HR_Concept.java @@ -32,7 +32,7 @@ public class X_HR_Concept extends PO implements I_HR_Concept, I_Persistent /** * */ - private static final long serialVersionUID = 20150707L; + private static final long serialVersionUID = 20151117L; /** Standard Constructor */ public X_HR_Concept (Properties ctx, int HR_Concept_ID, String trxName) @@ -75,6 +75,32 @@ public String toString() return sb.toString(); } + /** AccountSign AD_Reference_ID=118 */ + public static final int ACCOUNTSIGN_AD_Reference_ID=118; + /** Natural = N */ + public static final String ACCOUNTSIGN_Natural = "N"; + /** Debit = D */ + public static final String ACCOUNTSIGN_Debit = "D"; + /** Credit = C */ + public static final String ACCOUNTSIGN_Credit = "C"; + /** Set Account Sign. + @param AccountSign + Indicates the Natural Sign of the Account as a Debit or Credit + */ + public void setAccountSign (String AccountSign) + { + + set_Value (COLUMNNAME_AccountSign, AccountSign); + } + + /** Get Account Sign. + @return Indicates the Natural Sign of the Account as a Debit or Credit + */ + public String getAccountSign () + { + return (String)get_Value(COLUMNNAME_AccountSign); + } + public org.compiere.model.I_AD_Reference getAD_Reference() throws RuntimeException { return (org.compiere.model.I_AD_Reference)MTable.get(getCtx(), org.compiere.model.I_AD_Reference.Table_Name) @@ -103,32 +129,6 @@ public int getAD_Reference_ID () return ii.intValue(); } - /** AccountSign AD_Reference_ID=118 */ - public static final int ACCOUNTSIGN_AD_Reference_ID=118; - /** Natural = N */ - public static final String ACCOUNTSIGN_Natural = "N"; - /** Debit = D */ - public static final String ACCOUNTSIGN_Debit = "D"; - /** Credit = C */ - public static final String ACCOUNTSIGN_Credit = "C"; - /** Set Account Sign. - @param AccountSign - Indicates the Natural Sign of the Account as a Debit or Credit - */ - public void setAccountSign (String AccountSign) - { - - set_Value (COLUMNNAME_AccountSign, AccountSign); - } - - /** Get Account Sign. - @return Indicates the Natural Sign of the Account as a Debit or Credit - */ - public String getAccountSign () - { - return (String)get_Value(COLUMNNAME_AccountSign); - } - /** ColumnType AD_Reference_ID=53243 */ public static final int COLUMNTYPE_AD_Reference_ID=53243; /** Amount = A */ @@ -451,6 +451,30 @@ public boolean isPaid () return false; } + /** Set Prepayment. + @param IsPrepayment + The Payment/Receipt is a Prepayment + */ + public void setIsPrepayment (boolean IsPrepayment) + { + set_Value (COLUMNNAME_IsPrepayment, Boolean.valueOf(IsPrepayment)); + } + + /** Get Prepayment. + @return The Payment/Receipt is a Prepayment + */ + public boolean isPrepayment () + { + Object oo = get_Value(COLUMNNAME_IsPrepayment); + if (oo != null) + { + if (oo instanceof Boolean) + return ((Boolean)oo).booleanValue(); + return "Y".equals(oo); + } + return false; + } + /** Set Printed. @param IsPrinted Indicates if this document / line is printed diff --git a/client/src/org/compiere/apps/ProcessParameterPanel.java b/client/src/org/compiere/apps/ProcessParameterPanel.java index 9ba1588277..24c8d94639 100644 --- a/client/src/org/compiere/apps/ProcessParameterPanel.java +++ b/client/src/org/compiere/apps/ProcessParameterPanel.java @@ -15,6 +15,7 @@ import java.awt.BorderLayout; import java.awt.Component; +import java.awt.Dimension; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Insets; @@ -130,9 +131,7 @@ void jbInit() throws Exception { setMode(MODE_VERTICAL); this.setLayout(mainLayout); - centerPanel.setLayout(centerLayout); centerScroll.getViewport().add(centerPanel); - //centerScroll.add(centerPanel); this.add(centerScroll, BorderLayout.CENTER); } // jbInit @@ -158,9 +157,12 @@ public boolean init() if(MODE == MODE_HORIZONTAL) { centerPanel.setLayout(new ALayout()); + centerPanel.setPreferredSize(new Dimension(800,150)); + centerScroll.createVerticalScrollBar(); } if(MODE == MODE_VERTICAL) { + centerPanel.setLayout(centerLayout); // Prepare panel gbc.anchor = GridBagConstraints.NORTHWEST; gbc.weightx = 0; diff --git a/client/src/org/compiere/apps/form/Allocation.java b/client/src/org/compiere/apps/form/Allocation.java index 3808daa9f5..da3fc8089d 100644 --- a/client/src/org/compiere/apps/form/Allocation.java +++ b/client/src/org/compiere/apps/form/Allocation.java @@ -190,7 +190,7 @@ public Vector getPaymentColumnNames(boolean isMultiCurrency) { // Header Info Vector columnNames = new Vector(); - columnNames.add(Msg.getMsg(Env.getCtx(), "Select")); + columnNames.add(" "); columnNames.add(Msg.translate(Env.getCtx(), "Date")); columnNames.add(Util.cleanAmp(Msg.translate(Env.getCtx(), "DocumentNo"))); if (isMultiCurrency) @@ -326,7 +326,7 @@ public Vector getInvoiceColumnNames(boolean isMultiCurrency) { // Header Info Vector columnNames = new Vector(); - columnNames.add(Msg.getMsg(Env.getCtx(), "Select")); + columnNames.add(" "); columnNames.add(Msg.translate(Env.getCtx(), "Date")); columnNames.add(Util.cleanAmp(Msg.translate(Env.getCtx(), "DocumentNo"))); if (isMultiCurrency) @@ -529,7 +529,7 @@ public String writeOff(int row, int col, boolean isInvoice, IMiniTable payment, invoice.setValueAt(writeOff, row, invoice.convertColumnIndexToView(i_writeOff)); invoice.setValueAt(overUnder, row, invoice.convertColumnIndexToView(i_overUnder)); - invoice.repaint(); // update r/o + //invoice.repaint(); // update r/o } m_calculating = false; diff --git a/client/src/org/compiere/grid/ed/VLookup.java b/client/src/org/compiere/grid/ed/VLookup.java index c05376aab3..3167d66bfa 100644 --- a/client/src/org/compiere/grid/ed/VLookup.java +++ b/client/src/org/compiere/grid/ed/VLookup.java @@ -918,14 +918,14 @@ protected void actionCombo (Object value) Object updatedValue = value; - if (updatedValue instanceof Object[] && ((Object[])updatedValue).length > 0) + if (updatedValue != null && updatedValue instanceof Object[] && ((Object[])updatedValue).length > 0) { updatedValue = ((Object[])updatedValue)[0]; } if (updatedValue == null && m_value == null) updated = true; - else if (updatedValue != null && value.equals(m_value)) + else if (updatedValue != null && updatedValue.equals(m_value)) updated = true; if (!updated) { diff --git a/extend/src/test/functional/MCostDetailTest.java b/extend/src/test/functional/MCostDetailTest.java index 608b14d021..d9fec8e361 100644 --- a/extend/src/test/functional/MCostDetailTest.java +++ b/extend/src/test/functional/MCostDetailTest.java @@ -36,7 +36,7 @@ public void testQuery() throws Exception MCostDetail cd = MCostDetail.get(getCtx(), "C_InvoiceLine_ID=?", 1000003, 1000001, 1000001, getTrxName()); assertTrue("Such Cost Detail record exists", cd.get_ID() > 0); MProduct prod = new MProduct(getCtx(),1000002,getTrxName()); - assertTrue("must have true result", MCostDetail.processProduct(prod, getTrxName())); //red1 test mock falce recs in MCostDetail + //assertTrue("must have true result", MCostDetail.processProduct(prod, getTrxName())); //red1 test mock falce recs in MCostDetail } } diff --git a/migration/380lts-release/0085_Add_field_employee_type.xml b/migration/380lts-release/0085_Add_field_employee_type.xml new file mode 100644 index 0000000000..88d785a8b1 --- /dev/null +++ b/migration/380lts-release/0085_Add_field_employee_type.xml @@ -0,0 +1,39 @@ + + + + + + 0 + 56679 + 0 + 53190 + 55326 + 19 + + + HR_EmployeeType_ID + 2015-11-04 17:31:26.61 + 100 + + + Employee Type + + EE02 + 22 + + true + true + false + false + Employee Type + + 16 + 2015-11-04 17:31:26.61 + 100 + + + + + + + diff --git a/migration/380lts-release/0087_SmartBrowserSalasOrdertoPickingNotShouldMandatory.xml b/migration/380lts-release/0087_SmartBrowserSalasOrdertoPickingNotShouldMandatory.xml new file mode 100644 index 0000000000..4da9fad286 --- /dev/null +++ b/migration/380lts-release/0087_SmartBrowserSalasOrdertoPickingNotShouldMandatory.xml @@ -0,0 +1,100 @@ + + + + + + false + + + + + false + + + + + false + + + + + false + + + + + false + + + + + false + + + + + false + + + + + false + + + + + false + + + + + false + + + + + false + + + + + false + + + + + false + + + + + false + + + + + false + + + + + false + + + + + false + + + + + false + + + + + 19 + + + + diff --git a/migration/380lts-release/0088_Add_prepayment_payroll_concept.xml b/migration/380lts-release/0088_Add_prepayment_payroll_concept.xml new file mode 100644 index 0000000000..71355339cd --- /dev/null +++ b/migration/380lts-release/0088_Add_prepayment_payroll_concept.xml @@ -0,0 +1,148 @@ + + + + + + + EE02 + 0 + The Payment/Receipt is a Prepayment + 78182 + 0 + + + true + 53090 + Prepayment + false + false + N + IsPrepayment + + 2015-11-17 12:02:42.058 + + 100 + false + Payments not allocated to an invoice with a charge are posted to Unallocated Payments. When setting this flag, the payment is posted to the Customer or Vendor Prepayment account. + 2015-11-17 12:02:42.058 + 1 + false + 20 + + 0 + 0 + true + false + N + false + + 100 + + + false + N + + + true + + false + + 2663 + false + + + + + 0 + 78182 + + 77726 + 0 + + + 53111 + + 2015-11-17 12:03:52.518 + 100 + + The Payment/Receipt is a Prepayment + 1 + + EE02 + Payments not allocated to an invoice with a charge are posted to Unallocated Payments. When setting this flag, the payment is posted to the Customer or Vendor Prepayment account. + + + true + true + true + true + true + false + false + false + false + + false + false + Prepayment + + + 10 + 10 + + 2015-11-17 12:03:52.518 + 100 + + + + + 160 + + + + + 170 + + + + + 180 + + + + + 190 + + + + + 200 + + + + + true + + + + + 170 + + + + + 180 + + + + + 190 + + + + + 200 + + + + diff --git a/org.eevolution.hr_and_payroll/src/main/java/base/org/eevolution/model/MHRPaySelection.java b/org.eevolution.hr_and_payroll/src/main/java/base/org/eevolution/model/MHRPaySelection.java index 4600c3e17d..4e5b89aa23 100755 --- a/org.eevolution.hr_and_payroll/src/main/java/base/org/eevolution/model/MHRPaySelection.java +++ b/org.eevolution.hr_and_payroll/src/main/java/base/org/eevolution/model/MHRPaySelection.java @@ -22,6 +22,8 @@ import java.util.Properties; import java.util.logging.Level; +import org.adempiere.exceptions.AdempiereException; +import org.compiere.Adempiere; import org.compiere.util.DB; import org.compiere.util.Env; @@ -145,6 +147,29 @@ public String toString() return sb.toString(); } // toString - + + /************************************************************************** + * Before Save + * @param newRecord new + * @return save + */ + protected boolean beforeSave (boolean newRecord) + { + + // Client/Org Check + if (getAD_Org_ID() == 0) + { + int context_AD_Org_ID = Env.getAD_Org_ID(getCtx()); + if (context_AD_Org_ID != 0) + { + setAD_Org_ID(context_AD_Org_ID); + log.warning("Changed Org to Context=" + context_AD_Org_ID); + } + } + + return true; + } + + } // MHRPaySelection diff --git a/org.eevolution.hr_and_payroll/src/main/java/base/org/eevolution/model/MHRPaySelectionCheck.java b/org.eevolution.hr_and_payroll/src/main/java/base/org/eevolution/model/MHRPaySelectionCheck.java index 9751569243..2bb71adac0 100755 --- a/org.eevolution.hr_and_payroll/src/main/java/base/org/eevolution/model/MHRPaySelectionCheck.java +++ b/org.eevolution.hr_and_payroll/src/main/java/base/org/eevolution/model/MHRPaySelectionCheck.java @@ -105,7 +105,7 @@ static public List get (Properties ctx, int HR_PaySelectio List pscs = new Query(ctx, I_HR_PaySelectionCheck.Table_Name, where , trxName) .setClient_ID() - .setParameters(new Object[]{HR_PaySelection_ID, PaymentRule}) + .setParameters(HR_PaySelection_ID, PaymentRule) .list(); int docNo = startDocumentNo; @@ -346,6 +346,8 @@ else if (check.getPaymentRule().equals(PAYMENTRULE_DirectDeposit) continue; } payment.setTrxType(X_C_Payment.TRXTYPE_CreditPayment); + payment.setDescription(check.getHR_PaySelection().getDescription()); + payment.setIsReceipt(check.isReceipt()); payment.setAmount(check.getParent().getC_Currency_ID(), check.getPayAmt()); payment.setDiscountAmt(check.getDiscountAmt()); payment.setDateTrx(check.getParent().getPayDate()); @@ -361,12 +363,17 @@ else if (check.getPaymentRule().equals(PAYMENTRULE_DirectDeposit) payment.setC_PaymentBatch_ID(batch.getC_PaymentBatch_ID()); } */ - int C_Charge_ID = DB.getSQLValue(check.get_TrxName(), - "SELECT MAX(C_Charge_ID) FROM HR_Attribute WHERE IsActive='Y' AND HR_Concept_ID="+HR_Concept_ID); - if(C_Charge_ID <= 0) // modify e-Evolution 25May2010 if(C_Charge_ID < 0) - payment.setC_Charge_ID(payroll.getC_Charge_ID()); - else - payment.setC_Charge_ID(C_Charge_ID); + if (concept.isPrepayment()) { + payment.setIsPrepayment(true); + } + else { + int C_Charge_ID = DB.getSQLValue(check.get_TrxName(), + "SELECT MAX(C_Charge_ID) FROM HR_Attribute WHERE IsActive='Y' AND HR_Concept_ID=" + HR_Concept_ID); + if (C_Charge_ID <= 0) // modify e-Evolution 25May2010 if(C_Charge_ID < 0) + payment.setC_Charge_ID(payroll.getC_Charge_ID()); + else + payment.setC_Charge_ID(C_Charge_ID); + } payment.setC_BankAccount_ID(check.getParent().getC_BankAccount_ID()); payment.setWriteOffAmt(Env.ZERO); @@ -412,7 +419,7 @@ else if (check.getPaymentRule().equals(PAYMENTRULE_DirectDeposit) } // confirmPrint /** Logger */ - static private CLogger s_log = CLogger.getCLogger (MHRPaySelectionCheck.class); + static private CLogger s_log = CLogger.getCLogger(MHRPaySelectionCheck.class); /** BPartner Info Index for Value */ private static final int BP_VALUE = 0; /** BPartner Info Index for Name */ @@ -440,7 +447,7 @@ else if (check.getPaymentRule().equals(PAYMENTRULE_DirectDeposit) * @param HR_PaySelectionCheck_ID HR_PaySelectionCheck_ID * @param trxName transaction */ - public MHRPaySelectionCheck (Properties ctx, int HR_PaySelectionCheck_ID, String trxName) + public MHRPaySelectionCheck(Properties ctx, int HR_PaySelectionCheck_ID, String trxName) { super(ctx, HR_PaySelectionCheck_ID, trxName); if (HR_PaySelectionCheck_ID == 0) @@ -469,7 +476,7 @@ public MHRPaySelectionCheck(Properties ctx, ResultSet rs, String trxName) * @param line payment selection * @param PaymentRule payment rule */ - public MHRPaySelectionCheck (MHRPaySelectionLine line, String PaymentRule) + public MHRPaySelectionCheck(MHRPaySelectionLine line, String PaymentRule) { this (line.getCtx(), 0, line.get_TrxName()); setClientOrg(line); @@ -480,7 +487,7 @@ public MHRPaySelectionCheck (MHRPaySelectionLine line, String PaymentRule) // if (X_C_Order.PAYMENTRULE_DirectDebit.equals(PaymentRule)) { - MBPBankAccount[] bas = MBPBankAccount.getOfBPartner (line.getCtx(), C_BPartner_ID); + MBPBankAccount[] bas = MBPBankAccount.getOfBPartner(line.getCtx(), C_BPartner_ID); for (int i = 0; i < bas.length; i++) { MBPBankAccount account = bas[i]; @@ -493,7 +500,7 @@ public MHRPaySelectionCheck (MHRPaySelectionLine line, String PaymentRule) } else if (X_C_Order.PAYMENTRULE_DirectDeposit.equals(PaymentRule)) { - MBPBankAccount[] bas = MBPBankAccount.getOfBPartner (line.getCtx(), C_BPartner_ID); + MBPBankAccount[] bas = MBPBankAccount.getOfBPartner(line.getCtx(), C_BPartner_ID); for (int i = 0; i < bas.length; i++) { MBPBankAccount account = bas[i]; @@ -517,7 +524,7 @@ else if (X_C_Order.PAYMENTRULE_DirectDeposit.equals(PaymentRule)) * @param ps payment selection * @param PaymentRule payment rule */ - public MHRPaySelectionCheck (MHRPaySelection ps, String PaymentRule) + public MHRPaySelectionCheck(MHRPaySelection ps, String PaymentRule) { this (ps.getCtx(), 0, ps.get_TrxName()); setClientOrg(ps); @@ -527,9 +534,9 @@ public MHRPaySelectionCheck (MHRPaySelection ps, String PaymentRule) /** Parent */ - private MHRPaySelection m_parent = null; + private MHRPaySelection m_parent = null; /** Payment Selection lines of this check */ - private List m_lines = null; + private List m_lines = null; /** @@ -561,7 +568,7 @@ public void addLine (MHRPaySelectionLine line) public MHRPaySelection getParent() { if (m_parent == null) - m_parent = new MHRPaySelection (getCtx(), getHR_PaySelection_ID(), get_TrxName()); + m_parent = new MHRPaySelection(getCtx(), getHR_PaySelection_ID(), get_TrxName()); return m_parent; } // getParent @@ -632,7 +639,7 @@ public List getPaySelectionLines (boolean requery) public static boolean deleteGeneratedDraft(Properties ctx, int C_Payment_ID, String trxName) { - MHRPaySelectionCheck mpsc = MHRPaySelectionCheck.getOfPayment (ctx, C_Payment_ID, trxName); + MHRPaySelectionCheck mpsc = MHRPaySelectionCheck.getOfPayment(ctx, C_Payment_ID, trxName); if (mpsc != null && mpsc.isGeneratedDraft()) { diff --git a/org.eevolution.hr_and_payroll/src/main/java/base/org/eevolution/process/HRPaySelectionCreateCheck.java b/org.eevolution.hr_and_payroll/src/main/java/base/org/eevolution/process/HRPaySelectionCreateCheck.java index cc3e44e8eb..7bd38d5382 100755 --- a/org.eevolution.hr_and_payroll/src/main/java/base/org/eevolution/process/HRPaySelectionCreateCheck.java +++ b/org.eevolution.hr_and_payroll/src/main/java/base/org/eevolution/process/HRPaySelectionCreateCheck.java @@ -126,6 +126,7 @@ private void createCheck (MHRPaySelectionLine line) throws Exception PaymentRule = p_PaymentRule; } MHRPaySelectionCheck check = new MHRPaySelectionCheck(line, PaymentRule); + check.setAD_Org_ID(line.getHR_PaySelection().getAD_Org_ID()); /* if (!check.isValid()) { diff --git a/org.eevolution.hr_and_payroll/src/main/java/base/org/eevolution/process/HRPaySelectionCreateFrom.java b/org.eevolution.hr_and_payroll/src/main/java/base/org/eevolution/process/HRPaySelectionCreateFrom.java index ecb48c4929..20221c84a4 100644 --- a/org.eevolution.hr_and_payroll/src/main/java/base/org/eevolution/process/HRPaySelectionCreateFrom.java +++ b/org.eevolution.hr_and_payroll/src/main/java/base/org/eevolution/process/HRPaySelectionCreateFrom.java @@ -20,8 +20,6 @@ import java.util.List; import java.util.logging.Level; -import org.adempiere.exceptions.AdempiereException; -import org.compiere.model.I_C_BPartner; import org.compiere.model.MBPartner; import org.compiere.model.Query; import org.compiere.process.ProcessInfoParameter; @@ -44,55 +42,58 @@ public class HRPaySelectionCreateFrom extends SvrProcess { /** Payroll Process */ - private int p_HR_Process_ID = 0; + private int processId = 0; /** Payroll */ - private int p_HR_Payroll_ID = 0; + private int payrollId = 0; /** BPartner */ - private int p_C_BPartner_ID = 0; + private int partnerId = 0; /** BPartner Group */ - private int p_C_BP_Group_ID = 0; + private int employeeTypeId = 0; + /** Employee Type */ + private int partnerGroupId = 0; /** Payment Rule */ - private String p_PaymentRule = null; + private String paymentRule = null; /** Payroll Concept */ - private int p_HR_Concept_ID = 0; + private int payrollConceptId = 0; /** Payroll Department */ - private int p_HR_Department_ID = 0; + private int departmentId = 0; /** Payroll Job */ - private int p_HR_Job_ID = 0; + private int jobId = 0; /** Payroll Payment Selection */ - private int p_HR_PaySelection_ID = 0; + private int paySelectionId = 0; /** * Prepare - e.g., get Parameters. */ protected void prepare() { - ProcessInfoParameter[] para = getParameter(); - for (int i = 0; i < para.length; i++) + for (ProcessInfoParameter para : getParameter()) { - String name = para[i].getParameterName(); - if (para[i].getParameter() == null) + String name = para.getParameterName(); + if (para.getParameter() == null) ; - else if (name.equals("HR_Process_ID")) - p_HR_Process_ID = para[i].getParameterAsInt(); - else if (name.equals("HR_Payroll_ID")) - p_HR_Payroll_ID = para[i].getParameterAsInt(); - else if (name.equals("C_BPartner_ID")) - p_C_BPartner_ID = para[i].getParameterAsInt(); - else if (name.equals("C_BP_Group_ID")) - p_C_BP_Group_ID = para[i].getParameterAsInt(); - else if (name.equals("PaymentRule")) - p_PaymentRule = (String)para[i].getParameter(); - else if (name.equals("HR_Concept_ID")) - p_HR_Concept_ID = para[i].getParameterAsInt(); - else if (name.equals("HR_Department_ID")) - p_HR_Department_ID = para[i].getParameterAsInt(); - else if (name.equals("HR_Job_ID")) - p_HR_Job_ID = para[i].getParameterAsInt(); + else if (I_HR_Movement.COLUMNNAME_HR_Process_ID.equals(name)) + processId = para.getParameterAsInt(); + else if (I_HR_Movement.COLUMNNAME_HR_Payroll_ID.equals(name)) + payrollId = para.getParameterAsInt(); + else if (I_HR_Movement.COLUMNNAME_C_BPartner_ID.equals(name)) + partnerId = para.getParameterAsInt(); + else if (I_HR_Movement.COLUMNNAME_C_BP_Group_ID.equals(name)) + partnerGroupId = para.getParameterAsInt(); + else if (I_HR_Movement.COLUMNNAME_HR_EmployeeType_ID.equals(name)) + employeeTypeId = para.getParameterAsInt(); + else if (I_HR_Movement.COLUMNNAME_PaymentRule.equals(name)) + paymentRule = (String)para.getParameter(); + else if (I_HR_Movement.COLUMNNAME_HR_Concept_ID.equals(name)) + payrollConceptId = para.getParameterAsInt(); + else if (I_HR_Movement.COLUMNNAME_HR_Department_ID.equals(name)) + departmentId = para.getParameterAsInt(); + else if (I_HR_Movement.COLUMNNAME_HR_Job_ID.equals(name)) + jobId = para.getParameterAsInt(); else log.log(Level.SEVERE, "Unknown Parameter: " + name); } - p_HR_PaySelection_ID = getRecord_ID(); + paySelectionId = getRecord_ID(); } // prepare /** @@ -102,68 +103,73 @@ else if (name.equals("HR_Job_ID")) */ protected String doIt() throws Exception { - log.info ("C_PaySelection_ID=" + p_HR_PaySelection_ID - + ", Process=" + p_HR_Process_ID - + ", Payroll=" + p_HR_Payroll_ID - + ", BP Group=" + p_C_BP_Group_ID - + ", PaymentRule=" + p_PaymentRule - + ", Concept=" + p_HR_Concept_ID - + ", Depatment="+ p_HR_Department_ID - + ", Job=" + p_HR_Job_ID); + log.info ("C_PaySelection_ID=" + paySelectionId + + ", Process=" + processId + + ", Payroll=" + payrollId + + ", BP Group=" + partnerGroupId + + ", PaymentRule=" + paymentRule + + ", Concept=" + payrollConceptId + + ", Depatment="+ departmentId + + ", Job=" + jobId); - MHRPaySelection psel = new MHRPaySelection (getCtx(), p_HR_PaySelection_ID, get_TrxName()); - psel.setHR_Process_ID(p_HR_Process_ID); + MHRPaySelection psel = new MHRPaySelection (getCtx(), paySelectionId, get_TrxName()); + psel.setHR_Process_ID(processId); psel.saveEx(); - MHRProcess process = new MHRProcess(getCtx(),p_HR_Process_ID,get_TrxName()); + MHRProcess process = new MHRProcess(getCtx(), processId,get_TrxName()); MHRPayroll payroll = new MHRPayroll(getCtx(),process.getHR_Payroll_ID(),get_TrxName()); ArrayList parameters = new ArrayList(); if (psel.get_ID() == 0) - throw new IllegalArgumentException("Not found HR_PaySelection_ID=" + p_HR_PaySelection_ID); + throw new IllegalArgumentException("Not found HR_PaySelection_ID=" + paySelectionId); if (psel.isProcessed()) throw new IllegalArgumentException("@Processed@"); - parameters.add(p_HR_Process_ID); + parameters.add(processId); parameters.add(true); - parameters.add(p_HR_PaySelection_ID); - + parameters.add(paySelectionId); + StringBuffer where = new StringBuffer("HR_Process_ID=?"); where.append(" AND HR_Concept_ID IN(SELECT HR_Concept_ID FROM HR_Concept WHERE IsPaid=?)"); // Only Concept isPaid where.append(" AND HR_Movement_ID NOT IN(SELECT HR_Movement_ID " + // Not Exist in PaySelection Process or PaySelection Actual " FROM HR_PaySelectionLine " + " WHERE HR_PaySelectionCheck_ID > 0 OR HR_PaySelection_ID=?)"); - if(p_C_BP_Group_ID > 0) + if(partnerGroupId > 0) { - where.append(" AND C_BPartner_ID IN(SELECT C_BPartner_ID FROM C_BPartner WHERE C_BP_Group_ID=? )"); - parameters.add(p_C_BP_Group_ID); - } - if(p_C_BPartner_ID > 0) + where.append(" AND C_BP_Group_ID=?"); + parameters.add(partnerGroupId); + } + if(employeeTypeId > 0) + { + where.append(" AND HR_EmployeeType_ID=?"); + parameters.add(employeeTypeId); + } + if(partnerId > 0) { where.append(" AND C_BPartner_ID=?"); - parameters.add(p_C_BPartner_ID); + parameters.add(partnerId); } - if(p_PaymentRule != null) + if(paymentRule != null) { - where.append(" AND C_BPartner_ID IN(SELECT C_BPartner_ID FROM C_BPartner WHERE PaymentRulePO=? )"); - parameters.add(p_PaymentRule); - } - if(p_HR_Concept_ID > 0) + where.append(" AND PaymentRule=?"); + parameters.add(paymentRule); + } + if(payrollConceptId > 0) { - where.append(" AND HR_Concept_ID=? "); - parameters.add(p_HR_Concept_ID); + where.append(" AND HR_Concept_ID=?"); + parameters.add(payrollConceptId); } - if(p_HR_Department_ID > 0) + if(departmentId > 0) { where.append(" AND HR_Department_ID=?"); - parameters.add(p_HR_Department_ID); + parameters.add(departmentId); } - if(p_HR_Job_ID > 0) + if(jobId > 0) { where.append(" AND HR_Job_ID=?"); - parameters.add(p_HR_Job_ID); + parameters.add(jobId); } int lines = 0; @@ -174,16 +180,16 @@ protected String doIt() throws Exception for(MHRMovement movement : movements) { - MBPartner bp = new MBPartner(getCtx(),movement.getC_BPartner_ID(),get_TrxName()); + MBPartner partner = new MBPartner(getCtx(),movement.getC_BPartner_ID(),get_TrxName()); String paymentRule = null; - MHREmployee employee = MHREmployee.getActiveEmployee(bp.getCtx(), bp.getC_BPartner_ID(), movement.get_TrxName()); + MHREmployee employee = MHREmployee.getActiveEmployee(partner.getCtx(), partner.getC_BPartner_ID(), movement.get_TrxName()); if (employee != null) paymentRule = employee.getPaymentRule(); if (paymentRule == null) { - if (bp.getPaymentRule() != null) - paymentRule = bp.getPaymentRule(); + if (partner.getPaymentRule() != null) + paymentRule = partner.getPaymentRule(); else paymentRule = payroll.getPaymentRule(); } @@ -191,21 +197,21 @@ protected String doIt() throws Exception if(paymentRule == null) paymentRule = "T"; - MHRPaySelectionLine psl = new MHRPaySelectionLine(getCtx(),0,get_TrxName()); - psl.setHR_PaySelection_ID(p_HR_PaySelection_ID); - psl.setHR_Movement_ID(movement.getHR_Movement_ID()); - psl.setPaymentRule(paymentRule); - psl.setAD_Org_ID(psel.getAD_Org_ID()); - psl.setLine((lines+1)*10); - psl.setOpenAmt(movement.getAmount().setScale(2, BigDecimal.ROUND_HALF_DOWN)); - psl.setPayAmt(movement.getAmount().setScale(2, BigDecimal.ROUND_HALF_DOWN)); - psl.setDescription(bp.getName() +" "+ bp.getName2()); - psl.setDifferenceAmt(Env.ZERO); - psl.setDiscountAmt(Env.ZERO); - psl.setIsManual(false); - psl.setIsSOTrx(false); - psl.setIsActive(true); - psl.saveEx(); + MHRPaySelectionLine paySelectionLine = new MHRPaySelectionLine(getCtx(),0,get_TrxName()); + paySelectionLine.setHR_PaySelection_ID(paySelectionId); + paySelectionLine.setHR_Movement_ID(movement.getHR_Movement_ID()); + paySelectionLine.setPaymentRule(paymentRule); + paySelectionLine.setAD_Org_ID(psel.getAD_Org_ID()); + paySelectionLine.setLine((lines + 1) * 10); + paySelectionLine.setOpenAmt(movement.getAmount().setScale(2, BigDecimal.ROUND_HALF_DOWN)); + paySelectionLine.setPayAmt(movement.getAmount().setScale(2, BigDecimal.ROUND_HALF_DOWN)); + paySelectionLine.setDescription(partner.getName() + " " + partner.getName2()); + paySelectionLine.setDifferenceAmt(Env.ZERO); + paySelectionLine.setDiscountAmt(Env.ZERO); + paySelectionLine.setIsManual(false); + paySelectionLine.setIsSOTrx(false); + paySelectionLine.setIsActive(true); + paySelectionLine.saveEx(); lines++; } return "@C_PaySelectionLine_ID@ - #" + lines; diff --git a/zkwebui/WEB-INF/src/org/adempiere/webui/apps/form/WAllocation.java b/zkwebui/WEB-INF/src/org/adempiere/webui/apps/form/WAllocation.java index aff0d93f7d..9245a6380a 100755 --- a/zkwebui/WEB-INF/src/org/adempiere/webui/apps/form/WAllocation.java +++ b/zkwebui/WEB-INF/src/org/adempiere/webui/apps/form/WAllocation.java @@ -54,6 +54,7 @@ import org.compiere.util.TrxRunnable; import org.zkoss.zk.ui.event.Event; import org.zkoss.zk.ui.event.EventListener; +import org.zkoss.zk.ui.util.Clients; import org.zkoss.zkex.zul.Borderlayout; import org.zkoss.zkex.zul.Center; import org.zkoss.zkex.zul.North; @@ -77,6 +78,7 @@ public class WAllocation extends Allocation /** * */ + @SuppressWarnings("unused") private static final long serialVersionUID = 7806119329546820204L; private CustomForm form = new CustomForm(); @@ -141,6 +143,8 @@ public WAllocation() private Panel southPanel = new Panel(); + private boolean m_isCalculating; + /** * Static Init * @throws Exception @@ -185,7 +189,7 @@ private void zkInit() throws Exception Rows rows = null; Row row = null; - parameterLayout.setWidth("800px"); + parameterLayout.setWidth("100%"); rows = parameterLayout.newRows(); row = rows.newRow(); row.appendChild(bpartnerLabel.rightAlign()); @@ -217,7 +221,7 @@ private void zkInit() throws Exception south.appendChild(southPanel); southPanel.appendChild(allocationPanel); allocationPanel.appendChild(allocationLayout); - allocationLayout.setWidth("600px"); + allocationLayout.setWidth("100%"); rows = allocationLayout.newRows(); row = rows.newRow(); row.appendChild(differenceLabel.rightAlign()); @@ -257,6 +261,7 @@ private void zkInit() throws Exception center.appendChild(paymentTable); paymentTable.setWidth("99%"); paymentTable.setHeight("99%"); + paymentTable.setMultiSelection(true); center.setStyle("border: none"); north = new North(); @@ -272,6 +277,7 @@ private void zkInit() throws Exception center.appendChild(invoiceTable); invoiceTable.setWidth("99%"); invoiceTable.setHeight("99%"); + invoiceTable.setMultiSelection(true); center.setStyle("border: none"); // center = new Center(); @@ -372,6 +378,12 @@ public void tableChanged(WTableModelEvent e) calculate(); return; } + + // The writeoff() function causes additional tableChanged events which can be ignored. + if(m_isCalculating) + return; + m_isCalculating = true; + Clients.showBusy(null,true); int row = e.getFirstRow(); int col = e.getColumn(); @@ -381,10 +393,13 @@ public void tableChanged(WTableModelEvent e) String msg = writeOff(row, col, isInvoice, paymentTable, invoiceTable, isAutoWriteOff); if(msg != null && msg.length() > 0) FDialog.warn(form.getWindowNo(), "AllocationWriteOffWarn"); - + calculate(); + + Clients.showBusy(null,false); + m_isCalculating = false; } // tableChanged - + /** * Vetoable Change Listener. * - Business Partner @@ -397,8 +412,6 @@ public void valueChange (ValueChangeEvent e) String name = e.getPropertyName(); Object value = e.getNewValue(); log.config(name + "=" + value); - if (value == null) - return; // Organization if (name.equals("AD_Org_ID")) @@ -407,15 +420,24 @@ public void valueChange (ValueChangeEvent e) m_AD_Org_ID = 0; else m_AD_Org_ID = ((Integer) value).intValue(); - loadBPartner(); } // BPartner if (name.equals("C_BPartner_ID")) { - bpartnerSearch.setValue(value); - m_C_BPartner_ID = ((Integer)value).intValue(); + if (value == null) + { + m_C_BPartner_ID = 0; + bpartnerSearch.setValue(null); + } + else + { + m_C_BPartner_ID = ((Integer)value).intValue(); + bpartnerSearch.setValue(m_C_BPartner_ID); + } + + checkBPartner(); loadBPartner(); } else if (name.equals("C_Charge_ID")) @@ -429,18 +451,26 @@ else if (name.equals("C_Charge_ID")) m_C_Charge_ID = ((Integer) value).intValue(); } setAllocateButton(); - } // Currency else if (name.equals("C_Currency_ID")) { - m_C_Currency_ID = ((Integer)value).intValue(); + if (value == null) + { + m_C_Currency_ID = 0; + } + else + { + m_C_Currency_ID = ((Integer) value).intValue(); + } loadBPartner(); } // Date for Multi-Currency else if (name.equals("Date") && multiCurrency.isSelected()) + { loadBPartner(); + } } // vetoableChange private void setAllocateButton() { @@ -468,10 +498,11 @@ private void setAllocateButton() { * - Payments * - Invoices */ - private void loadBPartner () + private void loadBPartner() { - checkBPartner(); + Clients.showBusy(null,true); + //checkBPartner(); Vector> data = getPaymentData(multiCurrency.isSelected(), dateField.getValue(), paymentTable); Vector columnNames = getPaymentColumnNames(multiCurrency.isSelected()); @@ -485,6 +516,7 @@ private void loadBPartner () modelP.addTableModelListener(this); paymentTable.setData(modelP, columnNames); setPaymentColumnClass(paymentTable, multiCurrency.isSelected()); + paymentTable.recreateListHead(); // data = getInvoiceData(multiCurrency.isSelected(), dateField.getValue(), invoiceTable); @@ -500,12 +532,14 @@ private void loadBPartner () modelI.addTableModelListener(this); invoiceTable.setData(modelI, columnNames); setInvoiceColumnClass(invoiceTable, multiCurrency.isSelected()); + invoiceTable.recreateListHead(); // calculate(multiCurrency.isSelected()); // Calculate Totals calculate(); + Clients.showBusy(null,false); } // loadBPartner public void calculate() @@ -562,4 +596,4 @@ public ADForm getForm() { return form; } -} // VAllocation +} // WAllocation diff --git a/zkwebui/WEB-INF/src/org/adempiere/webui/component/WListItemRenderer.java b/zkwebui/WEB-INF/src/org/adempiere/webui/component/WListItemRenderer.java index 8c983952a0..155e8dc7a4 100644 --- a/zkwebui/WEB-INF/src/org/adempiere/webui/component/WListItemRenderer.java +++ b/zkwebui/WEB-INF/src/org/adempiere/webui/component/WListItemRenderer.java @@ -473,71 +473,62 @@ private Component getListHeaderComponent(Object headerValue, int headerIndex, Cl ListHeader header = null; String headerText = headerValue.toString(); + + // If the header doesn't exist, add it to the end of the list if (m_headers.size() <= headerIndex || m_headers.get(headerIndex) == null) { - if (!isColumnVisible(getColumn(headerIndex))) - { - header = new ListHeader(""); - header.setWidth("0px"); - header.setStyle("width: 0px"); - } - else if (classType != null && classType.isAssignableFrom(IDColumn.class)) - { - header = new ListHeader(""); - header.setWidth("35px"); - } - else - { - Comparator ascComparator = getColumnComparator(true, headerIndex); - Comparator dscComparator = getColumnComparator(false, headerIndex); - - header = new ListHeader(headerText); - - header.setSort("auto"); - header.setSortAscending(ascComparator); - header.setSortDescending(dscComparator); - - int width = headerText.trim().length() * 9; - if (width > 300) - width = 300; - else if (classType != null) - { - if (classType.equals(String.class)) - { - if (width > 0 && width < 180) - width = 180; - } - else if (classType.equals(IDColumn.class)) - { - header.setSort("none"); - if (width == 0) - width = 30; - } - else if (width > 0 && width < 100 && (classType == null || !classType.isAssignableFrom(Boolean.class))) - width = 100; - } - else if (width > 0 && width < 100) - width = 100; - - header.setWidth(width + "px"); - } - m_headers.add(header); + header = new ListHeader(""); + m_headers.add(headerIndex, header); } - else - { - header = m_headers.get(headerIndex); - - if (!isColumnVisible(getColumn(headerIndex))) - { - header.setLabel(""); - header.setWidth("0px"); - header.setStyle("width: 0px"); - } - else if (!header.getLabel().equals(headerText)) + + header = m_headers.get(headerIndex); + + if (!isColumnVisible(getColumn(headerIndex))) + { + header.setLabel(""); + header.setWidth("0px"); + header.setStyle("width: 0px"); + } + else if (classType != null && classType.isAssignableFrom(IDColumn.class)) + { + header.setLabel(""); + header.setWidth("35px"); + } + else + { + Comparator ascComparator = getColumnComparator(true, headerIndex); + Comparator dscComparator = getColumnComparator(false, headerIndex); + + header.setLabel(headerText); + + header.setSort("auto"); + header.setSortAscending(ascComparator); + header.setSortDescending(dscComparator); + + int width = headerText.trim().length() * 9; + if (width > 300) + width = 300; + else if (classType != null) { - header.setLabel(headerText); + if (classType.equals(String.class)) + { + if (width > 0 && width < 180) + width = 180; + } + else if (classType.equals(IDColumn.class)) + { + header.setSort("none"); + if (width == 0) + width = 30; + } + else if (width > 0 && width < 100 && (classType == null || !classType.isAssignableFrom(Boolean.class))) + width = 100; } - } + else if (width > 0 && width < 100) + width = 100; + + header.setWidth(width + "px"); + } header.setAttribute("zk_component_ID", "ListItem_Header_C" + headerIndex); diff --git a/zkwebui/WEB-INF/src/org/adempiere/webui/component/WListbox.java b/zkwebui/WEB-INF/src/org/adempiere/webui/component/WListbox.java index 88e526b0f7..876e314ee6 100644 --- a/zkwebui/WEB-INF/src/org/adempiere/webui/component/WListbox.java +++ b/zkwebui/WEB-INF/src/org/adempiere/webui/component/WListbox.java @@ -1438,4 +1438,20 @@ else if (data instanceof Boolean) } + /** + * Recreate the list header, especially after column classes have been changed. + */ + public void recreateListHead() { + + WListItemRenderer rowRenderer = null; + + rowRenderer = (WListItemRenderer) this.getItemRenderer(); + + ListHead head = super.getListHead(); + if (head != null && rowRenderer != null) + { + head.getChildren().clear(); + rowRenderer.renderListHead(head); + } + } } diff --git a/zkwebui/WEB-INF/src/org/adempiere/webui/editor/WSearchEditor.java b/zkwebui/WEB-INF/src/org/adempiere/webui/editor/WSearchEditor.java index eafc59a7d9..a827f58fee 100644 --- a/zkwebui/WEB-INF/src/org/adempiere/webui/editor/WSearchEditor.java +++ b/zkwebui/WEB-INF/src/org/adempiere/webui/editor/WSearchEditor.java @@ -494,22 +494,27 @@ private void actionCombo (Object value) // is the value updated ? boolean updated = false; - if (value instanceof Object[] && ((Object[])value).length > 0) + + Object updatedValue = value; + + if (updatedValue != null && updatedValue instanceof Object[] && ((Object[])updatedValue).length > 0) { - value = ((Object[])value)[0]; + updatedValue = ((Object[])updatedValue)[0]; } - if (value == null && getValue() == null) + // Avoid events if the value hasn't changed. + if (updatedValue == null && getValue() == null) updated = true; - else if (value != null && value.equals(getValue()) && !m_needsUpdate) + else if (updatedValue != null && updatedValue.equals(getValue()) && !m_needsUpdate) updated = true; if (!updated) { - setValue(value); + setValue(updatedValue); } // Fire the change event after the change so listeners can react in the same thread. - ValueChangeEvent evt = new ValueChangeEvent(this, this.getColumnName(), oldValue, getValue()); + // Pass value as it may be an array for multiple selection. updatedValue will be a single value. + ValueChangeEvent evt = new ValueChangeEvent(this, this.getColumnName(), oldValue, value); // -> ADTabpanel - valuechange fireValueChange(evt);