details: /erp/devel/pi/rev/576f08896087 changeset: 8984:576f08896087 user: David Alsasua <david.alsasua <at> openbravo.com> date: Tue Nov 23 12:14:08 2010 +0100 summary: Formatted DocBank file. No code change
details: /erp/devel/pi/rev/45126bfbff28 changeset: 8985:45126bfbff28 user: David Alsasua <david.alsasua <at> openbravo.com> date: Tue Nov 23 12:32:53 2010 +0100 summary: Fixes issue 14992: PDF format in general ledger journal does not group by date Issue is not in Journal report, but in DocBank servlet. When posting a bank statement, if the lines do not have all the same accounting date, it should assign a new FactAcctGroupId, so different entries are created. One only entry cannot have different dates for it's lines. Solution is to: 1- Sort the lines by accounting date 2- Each time the date of a bank statement lines is different from the one in the previous line, assign a new FactAcctGroupID diffstat: src/org/openbravo/erpCommon/ad_forms/DocBank.java | 44 +++++++------ src/org/openbravo/erpCommon/ad_forms/DocLineBank_data.xsql | 2 +- 2 files changed, 26 insertions(+), 20 deletions(-) diffs (141 lines): diff -r 19271f33c4b5 -r 45126bfbff28 src/org/openbravo/erpCommon/ad_forms/DocBank.java --- a/src/org/openbravo/erpCommon/ad_forms/DocBank.java Mon Nov 22 13:06:33 2010 +0100 +++ b/src/org/openbravo/erpCommon/ad_forms/DocBank.java Tue Nov 23 12:32:53 2010 +0100 @@ -73,7 +73,7 @@ /** * Constructor - * + * * @param AD_Client_ID * AD_Client_ID */ @@ -88,7 +88,7 @@ /** * Load Specific Document Details - * + * * @return true if loadDocumentType was set */ public boolean loadDocumentDetails(FieldProvider[] data, ConnectionProvider conn) { @@ -137,7 +137,7 @@ /** * Load Invoice Line. 4 amounts AMTTYPE_Payment AMTTYPE_Statement2 AMTTYPE_Charge AMTTYPE_Interest - * + * * @return DocLine Array */ private DocLine[] loadLines(ConnectionProvider conn) { @@ -176,7 +176,7 @@ /** * Get Source Currency Balance - subtracts line amounts from total - no rounding - * + * * @return positive amount, if total is bigger than lines */ public BigDecimal getBalance() { @@ -199,14 +199,14 @@ /** * Create Facts (the accounting logic) for CMB. - * + * * <pre> * BankAsset DR CR (Statement) * BankInTransit DR CR (Payment) * Charge DR (Charge) * Interest DR CR (Interest) * </pre> - * + * * @param as * accounting schema * @return Fact @@ -235,11 +235,19 @@ BigDecimal TrxAmt = null; BigDecimal ChargeAmt = null; BigDecimal ConvertChargeAmt = null; + String strDateAcct = "FirstIteration"; // BigDecimal InterestAmt = null; // Lines fact = new Fact(this, as, Fact.POST_Actual); for (int i = 0; p_lines != null && i < p_lines.length; i++) { DocLine_Bank line = (DocLine_Bank) p_lines[i]; + if (strDateAcct.equals("FirstIteration")) + strDateAcct = line.m_DateAcct; + else if (!strDateAcct.equals(line.m_DateAcct)) { + strDateAcct = line.m_DateAcct; + Fact_Acct_Group_ID = SequenceIdData.getUUID(); + } + // setC_Period_ID(line.m_DateAcct); // BankAsset DR CR (Statement) TrxAmt = new BigDecimal(line.m_TrxAmt); @@ -278,10 +286,9 @@ line.m_C_Currency_ID, TrxAmt.negate().toString(), Fact_Acct_Group_ID, nextSeqNo(SeqNo), DocumentType, conn); // Charge DR (Charge) - fact.createLine(lineAux, new Account( - conn, DocLineBankData.selectChargeAccount(conn, C_BankAccount_ID, as.m_C_AcctSchema_ID)), - line.m_C_Currency_ID, ChargeAmt.toString(), "", Fact_Acct_Group_ID, nextSeqNo(SeqNo), - DocumentType, conn); + fact.createLine(lineAux, new Account(conn, DocLineBankData.selectChargeAccount(conn, + C_BankAccount_ID, as.m_C_AcctSchema_ID)), line.m_C_Currency_ID, ChargeAmt.toString(), "", + Fact_Acct_Group_ID, nextSeqNo(SeqNo), DocumentType, conn); // Interest DR CR (Interest) /* * if (InterestAmt.signum() < 0) @@ -294,14 +301,13 @@ */ // if (ConvertChargeAmt.signum() > 0) // >0 loss - fact.createLine(lineAux, getAccount( - AcctServer.ACCTTYPE_ConvertChargeLossAmt, as, conn), line.m_C_Currency_ID, - line.convertChargeAmt, "", Fact_Acct_Group_ID, nextSeqNo(SeqNo), DocumentType, conn); + fact.createLine(lineAux, getAccount(AcctServer.ACCTTYPE_ConvertChargeLossAmt, as, conn), + line.m_C_Currency_ID, line.convertChargeAmt, "", Fact_Acct_Group_ID, nextSeqNo(SeqNo), + DocumentType, conn); else - fact.createLine(lineAux, getAccount( - AcctServer.ACCTTYPE_ConvertChargeGainAmt, as, conn), line.m_C_Currency_ID, "", - ConvertChargeAmt.negate().toString(), Fact_Acct_Group_ID, nextSeqNo(SeqNo), - DocumentType, conn); + fact.createLine(lineAux, getAccount(AcctServer.ACCTTYPE_ConvertChargeGainAmt, as, conn), + line.m_C_Currency_ID, "", ConvertChargeAmt.negate().toString(), Fact_Acct_Group_ID, + nextSeqNo(SeqNo), DocumentType, conn); log4jDocBank.debug("createTaxCorrection - (NIY)"); } @@ -311,7 +317,7 @@ /** * Get the account for Accounting Schema - * + * * @param strcBankstatementlineId * @param as * accounting schema @@ -358,7 +364,7 @@ /** * Get Document Confirmation - * + * * not used */ public boolean getDocumentConfirmation(ConnectionProvider conn, String strRecordId) { diff -r 19271f33c4b5 -r 45126bfbff28 src/org/openbravo/erpCommon/ad_forms/DocLineBank_data.xsql --- a/src/org/openbravo/erpCommon/ad_forms/DocLineBank_data.xsql Mon Nov 22 13:06:33 2010 +0100 +++ b/src/org/openbravo/erpCommon/ad_forms/DocLineBank_data.xsql Tue Nov 23 12:32:53 2010 +0100 @@ -33,7 +33,7 @@ DP.C_Project_ID AS C_Project_ID FROM C_BANKSTATEMENTLINE BL left join C_DEBT_PAYMENT DP on BL.C_DEBT_PAYMENT_ID = DP.C_DEBT_PAYMENT_ID WHERE C_BANKSTATEMENT_ID = ? - ORDER BY LINE + ORDER BY BL.DATEACCT, LINE ]]> </Sql> <Parameter name="C_BANKSTATEMENT_ID"/> ------------------------------------------------------------------------------ Increase Visibility of Your 3D Game App & Earn a Chance To Win $500! Tap into the largest installed PC base & get more eyes on your game by optimizing for Intel(R) Graphics Technology. Get started today with the Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs. http://p.sf.net/sfu/intelisp-dev2dev _______________________________________________ Openbravo-commits mailing list Openbravo-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openbravo-commits