details: https://code.openbravo.com/erp/devel/pi/rev/c305b1980e66 changeset: 19905:c305b1980e66 user: Naiara Martinez <naiara.martinez <at> openbravo.com> date: Mon Jan 14 10:24:20 2013 +0100 summary: fixed bug 22694: wrong amount with accruals & deferrals post invoice
details: https://code.openbravo.com/erp/devel/pi/rev/0d05ea51105e changeset: 19906:0d05ea51105e user: Naiara Martinez <naiara.martinez <at> openbravo.com> date: Mon Jan 14 09:40:42 2013 +0100 summary: fixed bug 22784: Payment info isn't copied when creating a G/L Journal using a template details: https://code.openbravo.com/erp/devel/pi/rev/5e9e8f9445d8 changeset: 19907:5e9e8f9445d8 user: David Miguelez <david.miguelez <at> openbravo.com> date: Wed Mar 06 19:49:24 2013 +0100 summary: Fixes Issue 22986. Change Column reference so it is possible to use more than two decimals. diffstat: src-db/database/sourcedata/AD_COLUMN.xml | 2 +- src/org/openbravo/erpCommon/ad_forms/DocInvoice.java | 10 ++++- src/org/openbravo/erpCommon/ad_process/CopyFromGLJournal.java | 10 +++-- src/org/openbravo/erpCommon/ad_process/CopyFromGLJournal_data.xsql | 20 +++++++-- 4 files changed, 30 insertions(+), 12 deletions(-) diffs (143 lines): diff -r e4bb3b8195b4 -r 5e9e8f9445d8 src-db/database/sourcedata/AD_COLUMN.xml --- a/src-db/database/sourcedata/AD_COLUMN.xml Thu Mar 14 11:42:06 2013 +0530 +++ b/src-db/database/sourcedata/AD_COLUMN.xml Wed Mar 06 19:49:24 2013 +0100 @@ -25022,7 +25022,7 @@ <!--1792--> <HELP><![CDATA[The Currency Conversion Rate indicates the rate to use when converting the source currency to the accounting currency]]></HELP> <!--1792--> <COLUMNNAME><![CDATA[CurrencyRate]]></COLUMNNAME> <!--1792--> <AD_TABLE_ID><![CDATA[224]]></AD_TABLE_ID> -<!--1792--> <AD_REFERENCE_ID><![CDATA[22]]></AD_REFERENCE_ID> +<!--1792--> <AD_REFERENCE_ID><![CDATA[800019]]></AD_REFERENCE_ID> <!--1792--> <FIELDLENGTH><![CDATA[22]]></FIELDLENGTH> <!--1792--> <DEFAULTVALUE><![CDATA[1]]></DEFAULTVALUE> <!--1792--> <ISKEY><![CDATA[N]]></ISKEY> diff -r e4bb3b8195b4 -r 5e9e8f9445d8 src/org/openbravo/erpCommon/ad_forms/DocInvoice.java --- a/src/org/openbravo/erpCommon/ad_forms/DocInvoice.java Thu Mar 14 11:42:06 2013 +0530 +++ b/src/org/openbravo/erpCommon/ad_forms/DocInvoice.java Wed Mar 06 19:49:24 2013 +0100 @@ -11,12 +11,14 @@ * Portions created by Jorg Janke are Copyright (C) 1999-2001 Jorg Janke, parts * created by ComPiere are Copyright (C) ComPiere, Inc.; All Rights Reserved. * Contributor(s): Openbravo SLU - * Contributions are Copyright (C) 2001-2012 Openbravo S.L.U. + * Contributions are Copyright (C) 2001-2013 Openbravo S.L.U. ****************************************************************************** */ package org.openbravo.erpCommon.ad_forms; import java.math.BigDecimal; +import java.math.MathContext; +import java.math.RoundingMode; import java.sql.Connection; import java.util.ArrayList; import java.util.Date; @@ -32,6 +34,7 @@ import org.openbravo.erpCommon.utility.AccDefUtility; import org.openbravo.erpCommon.utility.OBDateUtils; import org.openbravo.erpCommon.utility.SequenceIdData; +import org.openbravo.model.common.currency.Currency; import org.openbravo.model.financialmgmt.calendar.Period; public class DocInvoice extends AcctServer { @@ -804,7 +807,10 @@ ArrayList<HashMap<String, String>> plan = new ArrayList<HashMap<String, String>>(); int i = 1; BigDecimal total = BigDecimal.ZERO; - BigDecimal periodAmount = amount.divide(new BigDecimal(periodNumber), BigDecimal.ROUND_HALF_UP); + int stdPrecision = OBDal.getInstance().get(Currency.class, this.C_Currency_ID) + .getStandardPrecision().intValue(); + BigDecimal periodAmount = amount.divide(new BigDecimal(periodNumber), + new MathContext(32, RoundingMode.HALF_UP)).setScale(stdPrecision, BigDecimal.ROUND_HALF_UP); while (i <= periodNumber) { if (!OBDateUtils.formatDate(date).equals(DateAcct)) { HashMap<String, String> hm = new HashMap<String, String>(); diff -r e4bb3b8195b4 -r 5e9e8f9445d8 src/org/openbravo/erpCommon/ad_process/CopyFromGLJournal.java --- a/src/org/openbravo/erpCommon/ad_process/CopyFromGLJournal.java Thu Mar 14 11:42:06 2013 +0530 +++ b/src/org/openbravo/erpCommon/ad_process/CopyFromGLJournal.java Wed Mar 06 19:49:24 2013 +0100 @@ -11,7 +11,7 @@ * under the License. * The Original Code is Openbravo ERP. * The Initial Developer of the Original Code is Openbravo SLU - * All portions are Copyright (C) 2001-2010 Openbravo SLU + * All portions are Copyright (C) 2001-2013 Openbravo SLU * All Rights Reserved. * Contributor(s): ______________________________________. ************************************************************************ @@ -106,8 +106,8 @@ data[i].postingtype, data[i].glCategoryId, data[i].datedoc, data[i].dateacct, data[i].cPeriodId, data[i].cCurrencyId, data[i].currencyratetype, data[i].currencyrate, strKey, data[i].controlamt, strDocumentNo, "N", "N", "N", - data[i].user1Id,data[i].user2Id, data[i].cCampaignId, data[i].cProjectId, - data[i].aAssetId, data[i].cCostcenterId, data[i].cBpartnerId , data[i].mProductId ) == 0) + data[i].user1Id, data[i].user2Id, data[i].cCampaignId, data[i].cProjectId, + data[i].aAssetId, data[i].cCostcenterId, data[i].cBpartnerId, data[i].mProductId) == 0) log4j.warn("Save: GLJournal record " + i + " not inserted. Sequence = " + strSequence); } catch (ServletException ex) { myError = Utility.translateError(this, vars, vars.getLanguage(), ex.getMessage()); @@ -128,7 +128,9 @@ dataLines[j].cValidcombinationId, dataLines[j].user1Id, dataLines[j].user2Id, dataLines[j].cCampaignId, dataLines[j].cProjectId, dataLines[j].cActivityId, dataLines[j].cSalesregionId, dataLines[j].mProductId, dataLines[j].cBpartnerId, - dataLines[j].aAssetId,dataLines[j].cCostcenterId) == 0) + dataLines[j].aAssetId, dataLines[j].cCostcenterId, dataLines[j].openItems, + dataLines[j].finFinancialAccountId, dataLines[j].finPaymentmethodId, + dataLines[j].cGlitemId, dataLines[j].paymentdate, dataLines[j].finPaymentId) == 0) log4j.warn("Save: GLJournalLine record " + j + " not inserted. Sequence = " + strLineSequence); } catch (ServletException ex) { diff -r e4bb3b8195b4 -r 5e9e8f9445d8 src/org/openbravo/erpCommon/ad_process/CopyFromGLJournal_data.xsql --- a/src/org/openbravo/erpCommon/ad_process/CopyFromGLJournal_data.xsql Thu Mar 14 11:42:06 2013 +0530 +++ b/src/org/openbravo/erpCommon/ad_process/CopyFromGLJournal_data.xsql Wed Mar 06 19:49:24 2013 +0100 @@ -12,7 +12,7 @@ * under the License. * The Original Code is Openbravo ERP. * The Initial Developer of the Original Code is Openbravo SLU - * All portions are Copyright (C) 2001-2010 Openbravo SLU + * All portions are Copyright (C) 2001-2013 Openbravo SLU * All Rights Reserved. * Contributor(s): ______________________________________. ************************************************************************ @@ -39,7 +39,8 @@ '' AS TOTALDR, '' AS TOTALCR, '' AS PROCESSING, '' AS PROCESSED, '' AS POSTED, (SELECT GL2.AD_ORG_ID FROM GL_JOURNALBATCH GL2 WHERE GL2.GL_JOURNALBATCH_ID = ?) AS AD_ORG_ID, USER1_ID, USER2_ID, C_CAMPAIGN_ID, C_PROJECT_ID, '' AS C_ACTIVITY_ID, '' AS C_SALESREGION_ID, M_PRODUCT_ID, C_BPARTNER_ID, - A_ASSET_ID, C_COSTCENTER_ID + A_ASSET_ID, C_COSTCENTER_ID, + '' as OPEN_ITEMS, '' as FIN_FINANCIAL_ACCOUNT_ID, '' as FIN_PAYMENTMETHOD_ID, '' as C_GLITEM_ID, '' as PAYMENTDATE, '' as FIN_PAYMENT_ID FROM GL_JOURNAL GL WHERE GL.GL_JOURNALBATCH_ID = ? ]]> @@ -60,7 +61,8 @@ coalesce(gll.C_CAMPAIGN_ID, gl.C_CAMPAIGN_ID) as C_CAMPAIGN_ID , coalesce(gll.C_PROJECT_ID,gl.C_PROJECT_ID) as C_PROJECT_ID, gll.C_ACTIVITY_ID , gll.C_SALESREGION_ID , coalesce(gll.M_PRODUCT_ID,gl.M_PRODUCT_ID) as M_PRODUCT_ID, coalesce(gll.C_BPARTNER_ID,gl.C_BPARTNER_ID) as C_BPARTNER_ID, - gll.AD_ORG_ID, coalesce(gll.A_ASSET_ID,gl.A_ASSET_ID) as A_ASSET_ID, coalesce(gll.C_COSTCENTER_ID,gl.C_COSTCENTER_ID) as C_COSTCENTER_ID + gll.AD_ORG_ID, coalesce(gll.A_ASSET_ID,gl.A_ASSET_ID) as A_ASSET_ID, coalesce(gll.C_COSTCENTER_ID,gl.C_COSTCENTER_ID) as C_COSTCENTER_ID, + gll.OPEN_ITEMS, gll.FIN_FINANCIAL_ACCOUNT_ID, gll.FIN_PAYMENTMETHOD_ID, gll.C_GLITEM_ID, gll.PAYMENTDATE, gll.FIN_PAYMENT_ID FROM GL_JOURNALLINE gll, GL_JOURNAL gl WHERE gl.gl_journal_id=gll.gl_journal_id AND gll.GL_JOURNAL_ID = ? @@ -152,9 +154,11 @@ INSERT INTO GL_JOURNALLINE (GL_JOURNALLINE_ID, AD_CLIENT_ID, AD_ORG_ID, CREATED, CREATEDBY, UPDATED, UPDATEDBY, GL_JOURNAL_ID,LINE, ISGENERATED, DESCRIPTION,AMTSOURCEDR, AMTSOURCECR, C_CURRENCY_ID, CURRENCYRATETYPE, CURRENCYRATE, DATEACCT,AMTACCTDR, AMTACCTCR, C_UOM_ID,QTY, C_VALIDCOMBINATION_ID, - USER1_ID, USER2_ID, C_CAMPAIGN_ID, C_PROJECT_ID, C_ACTIVITY_ID, C_SALESREGION_ID, M_PRODUCT_ID, C_BPARTNER_ID, A_ASSET_ID, C_COSTCENTER_ID) + USER1_ID, USER2_ID, C_CAMPAIGN_ID, C_PROJECT_ID, C_ACTIVITY_ID, C_SALESREGION_ID, M_PRODUCT_ID, C_BPARTNER_ID, A_ASSET_ID, C_COSTCENTER_ID, + OPEN_ITEMS, FIN_FINANCIAL_ACCOUNT_ID, FIN_PAYMENTMETHOD_ID, C_GLITEM_ID, PAYMENTDATE, FIN_PAYMENT_ID) VALUES (?,?,?,now(),?,now(),?,?,TO_NUMBER(?),?,?,TO_NUMBER(?),TO_NUMBER(?),?,?,TO_NUMBER(?),now(),TO_NUMBER(?), - TO_NUMBER(?),?,TO_NUMBER(?), ?, ?, ?, ?, ?, ?, ?, ?, ?,?,?) + TO_NUMBER(?),?,TO_NUMBER(?), ?, ?, ?, ?, ?, ?, ?, ?, ?,?,?, + ?,?,?,?,TO_DATE(?), ?) ]]> </Sql> <Parameter name="gl_journalline_id"/> @@ -186,5 +190,11 @@ <Parameter name="c_bpartner_id"/> <Parameter name="a_asset_id"/> <Parameter name="c_costcenter_id"/> + <Parameter name="Open_Items"/> + <Parameter name="FIN_Financial_Account_ID"/> + <Parameter name="fin_Paymentmethod_ID"/> + <Parameter name="C_Glitem_ID"/> + <Parameter name="Paymentdate"/> + <Parameter name="FIN_Payment_ID"/> </SqlMethod> </SqlClass> ------------------------------------------------------------------------------ Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_d2d_mar _______________________________________________ Openbravo-commits mailing list Openbravo-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openbravo-commits