Hi Hans,
I remember that you already explained some of the requirements behind this work... but I am still wondering if this stuff should really go in the official svn. It seems problematic to me to update/convert the invoice items to the currency of a payment... I guess there are other solutions to match a payment with an invoice in a different currency. Jacopo On Sep 28, 2008, at 3:39 PM, [hidden email] wrote: > Author: hansbak > Date: Sun Sep 28 06:39:56 2008 > New Revision: 699817 > > URL: http://svn.apache.org/viewvc?rev=699817&view=rev > Log: > it is now possible to apply 'home' currency payments to foreign > curency invoices, converting the foreign invoice to the 'home' > currency in the process and making an entry in the currency exchange > table so it is still possble to display the invoice in the customer > currency. To make this work, it is however required that the > preferred currency of the parties are specified in the party entity. > This will not affect the system if the payment and the invoice are > in the same currency > > Modified: > ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml > ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/ > invoice/InvoiceServices.xml > ofbiz/trunk/applications/accounting/servicedef/services_invoice.xml > ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/ > invoice/InvoiceServices.java > ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/ > actions/payment/ListNotAppliedInvoices.groovy > ofbiz/trunk/applications/accounting/webapp/accounting/payment/ > PaymentForms.xml > ofbiz/trunk/applications/accounting/widget/PaymentScreens.xml > > Modified: ofbiz/trunk/applications/accounting/config/ > AccountingUiLabels.xml > URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml?rev=699817&r1=699816&r2=699817&view=diff > = > = > = > = > = > = > = > = > ====================================================================== > --- ofbiz/trunk/applications/accounting/config/ > AccountingUiLabels.xml (original) > +++ ofbiz/trunk/applications/accounting/config/ > AccountingUiLabels.xml Sun Sep 28 06:39:56 2008 > @@ -3276,7 +3276,7 @@ > <value xml:lang="zh">å·²ä»</value> > </property> > <property key="AccountingInvoicePaymentCurrencyProblem"> > - <value xml:lang="en">Payment currency [$ > {paymentCurrencyId}] and invoice currency [${invoiceCurrency}] not > the same > + <value xml:lang="en">Payment currency [${paymentCurrency}] > and invoice currency [${invoiceCurrency}] not the same > </value> > <value xml:lang="es">Moneda de pago [${paymentCurrencyId}] y > moneda de factura [${invoiceCurrency}] no son iguales > </value> > > Modified: ofbiz/trunk/applications/accounting/script/org/ofbiz/ > accounting/invoice/InvoiceServices.xml > URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/invoice/InvoiceServices.xml?rev=699817&r1=699816&r2=699817&view=diff > = > = > = > = > = > = > = > = > ====================================================================== > --- ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/ > invoice/InvoiceServices.xml (original) > +++ ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/ > invoice/InvoiceServices.xml Sun Sep 28 06:39:56 2008 > @@ -506,6 +506,57 @@ > <call-simple-method method-name="copyInvoice"/> > </simple-method> > > + <simple-method method-name="convertInvoiceToOtherCurrency" > short-description="service to convert an invoice to another currency > having the original currency still there using the exchange rate > table."> > + <entity-one entity-name="Invoice" value-name="invoice"/> > + <if-empty field="invoice"> > + <add-error><fail-message message="Invoice not found"/></ > add-error> > + </if-empty> > + <entity-one entity-name="Uom" value-name="newCurrencyUom"> > + <field-map field-name="uomId" env- > name="parameters.newCurrencyUomId"/> > + </entity-one> > + <if-empty field="newCurrencyUom"> > + <add-error><fail-message message="New Currency Code not > found"/></add-error> > + </if-empty> > + <if-compare-field field="parameters.newCurrencyUomId" > operator="equals" to-field="invoice.currencyUomId"> > + <add-error><fail-message message="Invoice already has > the requested currency"/></add-error> > + </if-compare-field> > + <check-errors/> > + > + <get-related value-name="invoice" relation- > name="InvoiceItem" list-name="invoiceItems"/> > + <iterate list-name="invoiceItems" entry-name="invoiceItem"> > + <calculate field-name="invoiceItem.amount" > type="Double" decimal-scale="15"> > + <calcop operator="divide"> > + <calcop operator="get" field- > name="invoiceItem.amount"/> > + <calcop operator="get" field- > name="parameters.exchangeRate"/> > + </calcop> > + </calculate> > + <store-value value-name="invoiceItem"/> > + </iterate> > + > + <entity-one entity-name="UomConversionDated" value- > name="uomValue"> > + <field-map field-name="uomId" env- > name="parameters.newCurrencyUomId"/> > + <field-map field-name="uomIdTo" env- > name="invoice.currencyUomId"/> > + <field-map field-name="fromDate" env- > name="invoice.invoiceDate"/> > + </entity-one> > + > + <make-value entity-name="UomConversionDated" value- > name="uomConversionDated"/> > + <set field="uomConversionDated.uomId" from- > field="parameters.newCurrencyUomId"/> > + <set field="uomConversionDated.uomIdTo" from- > field="invoice.currencyUomId"/> > + <set field="uomConversionDated.fromDate" from- > field="invoice.invoiceDate"/> > + <set field="uomConversionDated.thruDate" from- > field="invoice.invoiceDate"/> > + <set field="uomConversionDated.conversionFactor" from- > field="parameters.exchangeRate"/> > + <if-empty field="uomValue"> > + <create-value value-name="uomConversionDated"/> > + <else> > + <store-value value-name="uomConversionDated"/> > + </else> > + </if-empty> > + > + <set field="invoice.currencyUomId" from- > field="parameters.newCurrencyUomId"/> > + <store-value value-name="invoice"/> > + <field-to-result field-name="parameters.invoiceId" result- > name="invoiceId"/> > + </simple-method> > + > <!-- ===============subroutine services =================--> > <simple-method method-name="InvoiceStatusInProgress" short- > description="Check if the invoiceStatus is in progress"> > <!-- find the current header record --> > > Modified: ofbiz/trunk/applications/accounting/servicedef/ > services_invoice.xml > URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/servicedef/services_invoice.xml?rev=699817&r1=699816&r2=699817&view=diff > = > = > = > = > = > = > = > = > ====================================================================== > --- ofbiz/trunk/applications/accounting/servicedef/ > services_invoice.xml (original) > +++ ofbiz/trunk/applications/accounting/servicedef/ > services_invoice.xml Sun Sep 28 06:39:56 2008 > @@ -274,11 +274,17 @@ > <description>Accounting Invoice Permission Checking Logic</ > description> > <implements service="permissionInterface"/> > </service> > - <!-- Update InvoiceItemType --> > <service name="updateInvoiceItemType" engine="simple" default- > entity-name="InvoiceItemType" > location="org/ofbiz/accounting/invoice/InvoiceServices.xml" > invoke="updateInvoiceItemType"> > <description>Update Invoice Item Type Record</description> > <auto-attributes mode="IN" include="pk" optional="false"/> > <auto-attributes mode="IN" include="nonpk" optional="true"/> > </service> > + <service name="convertInvoiceToOtherCurrency" engine="simple" > + location="org/ofbiz/accounting/invoice/InvoiceServices.xml" > invoke="convertInvoiceToOtherCurrency"> > + <description>service to convert an invoice to another > currency having the original currency still there using the exchange > rate table.</description> > + <attribute name="invoiceId" mode="INOUT" type="String"/> > + <attribute name="newCurrencyUomId" mode="IN" type="String"/> > + <attribute name="exchangeRate" mode="IN" type="Double"/> > + </service> > </services> > \ No newline at end of file > > Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/ > accounting/invoice/InvoiceServices.java > URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java?rev=699817&r1=699816&r2=699817&view=diff > = > = > = > = > = > = > = > = > ====================================================================== > --- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/ > invoice/InvoiceServices.java (original) > +++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/ > invoice/InvoiceServices.java Sun Sep 28 06:39:56 2008 > @@ -2256,7 +2256,9 @@ > private static String successMessage = null; > public static Map updatePaymentApplicationDefBd(DispatchContext > dctx, Map context) { > GenericDelegator delegator = dctx.getDelegator(); > + LocalDispatcher dispatcher = dctx.getDispatcher(); > Locale locale = (Locale) context.get("locale"); > + GenericValue userLogin = (GenericValue) > context.get("userLogin"); > > if (decimals == -1 || rounding == -1) { > return > ServiceUtil > .returnError > (UtilProperties > .getMessage > (resource,"AccountingAritmeticPropertiesNotConfigured",locale)); > @@ -2500,6 +2502,38 @@ > > errorMessageList > .add > (UtilProperties > .getMessage > (resource > ,"AccountingInvoiceCancelledCannotApplyTo > ",UtilMisc.toMap("invoiceId",invoiceId),locale)); > } > > + // check the currency > + if (payment.get("currencyUomId") != null && > invoice.get("currencyUomId") != null && > + ! > payment > .getString > ("currencyUomId").equals(invoice.getString("currencyUomId"))) { > + > Debug.logInfo(UtilProperties.getMessage(resource, > "AccountingInvoicePaymentCurrencyProblem", > + UtilMisc.toMap("invoiceCurrency", > invoice.getString("currencyUomId"), "paymentCurrency", > payment.getString("currencyUomId")),locale), module); > + Debug.logInfo("will convert invoice currency > according original currency amount on payment", module); > + > + if (payment.get("actualCurrencyAmount") == null > || payment.get("actualCurrencyUomId") == null) { > + errorMessageList.add("in order to properly > convert the Invoice we need the actual currency and actual amount on > the payment"); > + } else { > + if (! > payment > .get("actualCurrencyUomId").equals(invoice.get("currencyUomId"))) { > + errorMessageList.add("actual currency > on payment not the same as original invoice currency"); > + } else { > + // calculate exchange rate, convert/retrieve > invoice > + try { > + Double exchangeRate = new > Double( payment.getDouble("actualCurrencyAmount").doubleValue() / > payment.getDouble("amount").doubleValue()); > + Map inMap = UtilMisc.toMap("userLogin", > userLogin, "invoiceId", invoiceId, "newCurrencyUomId", > payment.getString("currencyUomId")); > + inMap.put("exchangeRate", exchangeRate); > + > dispatcher.runSync("convertInvoiceToOtherCurrency", inMap); > + invoice = > delegator.findByPrimaryKey("Invoice", UtilMisc.toMap("invoiceId", > invoiceId)); > + } catch (GenericServiceException se) { > + Debug.logError(se, se.getMessage(), > module); > + return > ServiceUtil.returnError(se.getMessage()); > + } catch (GenericEntityException e) { > + > ServiceUtil.returnError(e.getMessage()); > + } > + } > + } > + > + > + } > + > // check if the invoice already covered by payments > BigDecimal invoiceTotal = > InvoiceWorker.getInvoiceTotalBd(invoice); > invoiceApplyAvailable = > InvoiceWorker.getInvoiceNotApplied(invoice); > @@ -3082,4 +3116,5 @@ > return ServiceUtil.returnError(ee.getMessage()); > } > } > + > } > > Modified: ofbiz/trunk/applications/accounting/webapp/accounting/WEB- > INF/actions/payment/ListNotAppliedInvoices.groovy > URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/payment/ListNotAppliedInvoices.groovy?rev=699817&r1=699816&r2=699817&view=diff > = > = > = > = > = > = > = > = > ====================================================================== > --- ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/ > actions/payment/ListNotAppliedInvoices.groovy (original) > +++ ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/ > actions/payment/ListNotAppliedInvoices.groovy Sun Sep 28 06:39:56 2008 > @@ -33,9 +33,8 @@ > decimals = UtilNumber.getBigDecimalScale("invoice.decimals"); > rounding = UtilNumber.getBigDecimalRoundingMode("invoice.rounding"); > > -// retrieve invoices for the related parties which have not been > (fully) applied yet > -List invoices = delegator.findByAnd("Invoice", [partyId : > payment.partyIdFrom, partyIdFrom : payment.partyIdTo], > ["invoiceDate"]); > - > +//retrieve invoices for the related parties which have not been > (fully) applied yet and which have the same currency. > +List invoices = delegator.findByAnd("Invoice", [partyId : > payment.partyIdFrom, partyIdFrom : payment.partyIdTo, > currencyUomId : payment.currencyUomId], ["invoiceDate"]); > if (invoices) { > invoicesList = []; // to pass back to the screeen list of > unapplied invoices > paymentApplied = PaymentWorker.getPaymentAppliedBd(payment); > @@ -65,3 +64,36 @@ > } > context.invoices = invoicesList; > } > + > +//retrieve invoices for the related parties which have not been > (fully) applied yet and which have another currency > +invoices = delegator.findByAnd("Invoice", [partyId : > payment.partyIdFrom, partyIdFrom : payment.partyIdTo], > ["invoiceDate"]); > +// remove same currencies > +for (int ind=0; ind < invoices.size(); ind++ ) { > + if (invoices[ind].currencyUomId.equals(payment.currencyUomId)) { > + invoices.remove(ind); > + } > +} > +if (invoices) { > + invoicesList = []; // to pass back to the screeen list of > unapplied invoices > + paymentApplied = PaymentWorker.getPaymentAppliedBd(payment); > + paymentToApply = > payment > .getBigDecimal > ("amount").setScale(decimals,rounding).subtract(paymentApplied); > + invoices.each { invoice -> > + invoiceAmount = > InvoiceWorker.getInvoiceTotalBd(invoice).setScale(decimals,rounding); > + invoiceApplied = > InvoiceWorker > .getInvoiceAppliedBd(invoice).setScale(decimals,rounding); > + if (!invoiceAmount.equals(invoiceApplied) && > + !invoice.statusId.equals("INVOICE_CANCELLED") && > + !invoice.statusId.equals("INVOICE_IN_PROCESS")) { > + // put in the map > + invoiceToApply = invoiceAmount.subtract(invoiceApplied); > + invoiceMap = [:]; > + invoiceMap.invoiceId = invoice.invoiceId; > + invoiceMap.currencyUomId = invoice.currencyUomId; > + invoiceMap.amount = invoiceAmount; > + invoiceMap.description = invoice.description; > + invoiceMap.invoiceDate = > invoice.invoiceDate.toString().substring(0,10); // display only YYYY- > MM-DD > + invoiceMap.amountApplied = invoiceApplied; > + invoicesList.add(invoiceMap); > + } > + } > + context.invoicesOtherCurrency = invoicesList; > +} > > Modified: ofbiz/trunk/applications/accounting/webapp/accounting/ > payment/PaymentForms.xml > URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/accounting/payment/PaymentForms.xml?rev=699817&r1=699816&r2=699817&view=diff > = > = > = > = > = > = > = > = > ====================================================================== > --- ofbiz/trunk/applications/accounting/webapp/accounting/payment/ > PaymentForms.xml (original) > +++ ofbiz/trunk/applications/accounting/webapp/accounting/payment/ > PaymentForms.xml Sun Sep 28 06:39:56 2008 > @@ -321,6 +321,21 @@ > </field> > </form> > > + <form name="listInvoicesNotAppliedOtherCurrency" type="list" > list-name="invoicesOtherCurrency" target="updatePaymentApplication" > title="" > + odd-row-style="alternate-row" default-table-style="basic- > table hover-bar"> > + <field name="paymentId"><hidden/></field> > + <field name="invoiceId" widget- > style="buttontext"><hyperlink target="invoiceOverview?invoiceId=$ > {invoiceId}" description="${invoiceId}"/></field> > + <field name="description"><display/></field> > + <field name="invoiceDate"><display/></field> > + <field name="amount"><display type="currency" currency="$ > {currencyUomId}"/></field> > + <field name="amountApplied" parameter- > name="dummy"><display type="currency" currency="${currencyUomId}"/ > ></field> > + <field name="invoiceProcessing" use-when=""$ > {uiConfigMap.invoiceProcessing}".equals("Y")"><check/ > ></field> > + <field name="invoiceProcessing" use-when=""$ > {uiConfigMap.invoiceProcessing}".equals("N")"><check/ > ></field> > + <field name="applyButton" widget-style="smallSubmit" > title="Convert Invoice to Payment currency and save rate"> > + <submit button-type="button"/> > + </field> > + </form> > + > <form name="listPaymentsNotApplied" type="list" list- > name="payments" target="updatePaymentApplication" title="" > odd-row-style="alternate-row" default-table-style="basic- > table hover-bar"> > <field name="paymentId"><hidden/></field> > > Modified: ofbiz/trunk/applications/accounting/widget/ > PaymentScreens.xml > URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/widget/PaymentScreens.xml?rev=699817&r1=699816&r2=699817&view=diff > = > = > = > = > = > = > = > = > ====================================================================== > --- ofbiz/trunk/applications/accounting/widget/PaymentScreens.xml > (original) > +++ ofbiz/trunk/applications/accounting/widget/PaymentScreens.xml > Sun Sep 28 06:39:56 2008 > @@ -197,56 +197,53 @@ > <container><label style="h3" text="$ > {uiLabelMap.AccountingNoPaymentsApplicationsfound}"></label></ > container> > </widgets> > <fail-widgets> > - <container style="screenlet"> > - <container style="screenlet- > title-bar"> > - <container style="h3"> > - <label text="$ > {uiLabelMap.AccountingPayment} ${uiLabelMap.AccountingApplications}"/> > - </container> > - </container> > - <container style="screenlet- > body"> > - <section> > - <condition> > - <not><if-empty > field-name="paymentApplicationsInv"/></not> > - </condition> > - <widgets> > - <include-form > name="editPaymentApplicationsInv" location="component://accounting/ > webapp/accounting/payment/PaymentForms.xml"/> > - </widgets> > - </section> > - </container> > - </container> > - <container style="screenlet"> > - <container style="screenlet- > title-bar"> > - <container style="h3"> > - <label text="11$ > {uiLabelMap.CommonAmount} ${uiLabelMap.CommonTotal} ${payment.amount? > currency(${payment.currencyUomId})} $ > {uiLabelMap.AccountingAmountNotApplied} ${notAppliedAmount?currency($ > {payment.currencyUomId})}"/> > - </container> > - </container> > - <container style="screenlet- > body"> > - <section> > - <condition> > - <not><if-empty > field-name="paymentApplicationsPay"/></not> > - </condition> > - <widgets> > - <include-form > name="editPaymentApplicationsPay" location="component://accounting/ > webapp/accounting/payment/PaymentForms.xml"/> > - </widgets> > - </section> > - <section> > - <condition> > - <not><if-empty > field-name="paymentApplicationsBil"/></not> > - </condition> > - <widgets> > - <include-form > name="editPaymentApplicationsBil" location="component://accounting/ > webapp/accounting/payment/PaymentForms.xml"/> > - </widgets> > - </section> > - <section> > - <condition> > - <not><if-empty > field-name="paymentApplicationsTax"/></not> > - </condition> > - <widgets> > - <include-form > name="editPaymentApplicationsTax" location="component://accounting/ > webapp/accounting/payment/PaymentForms.xml"/> > - </widgets> > - </section> > - </container> > - </container> > + <section> > + <condition> > + <not><if-empty field- > name="paymentApplicationsInv"/></not> > + </condition> > + <widgets> > + <screenlet title="$ > {uiLabelMap.AccountingPayment} ${uiLabelMap.AccountingApplications}"> > + <include-form > name="editPaymentApplicationsInv" location="component://accounting/ > webapp/accounting/payment/PaymentForms.xml"/> > + </screenlet> > + </widgets> > + </section> > + <section> > + <condition> > + <or> > + <not><if-empty field- > name="paymentApplicationsPay"/></not> > + <not><if-empty field- > name="paymentApplicationsBil"/></not> > + <not><if-empty field- > name="paymentApplicationsTax"/></not> > + </or> > + </condition> > + <widgets> > + <screenlet title="$ > {uiLabelMap.CommonAmount} ${uiLabelMap.CommonTotal} ${payment.amount? > currency(${payment.currencyUomId})} $ > {uiLabelMap.AccountingAmountNotApplied} ${notAppliedAmount?currency($ > {payment.currencyUomId})}"> > + <section> > + <condition> > + <not><if-empty > field-name="paymentApplicationsPay"/></not> > + </condition> > + <widgets> > + <include-form > name="editPaymentApplicationsPay" location="component://accounting/ > webapp/accounting/payment/PaymentForms.xml"/> > + </widgets> > + </section> > + <section> > + <condition> > + <not><if-empty > field-name="paymentApplicationsBil"/></not> > + </condition> > + <widgets> > + <include-form > name="editPaymentApplicationsBil" location="component://accounting/ > webapp/accounting/payment/PaymentForms.xml"/> > + </widgets> > + </section> > + <section> > + <condition> > + <not><if-empty > field-name="paymentApplicationsTax"/></not> > + </condition> > + <widgets> > + <include-form > name="editPaymentApplicationsTax" location="component://accounting/ > webapp/accounting/payment/PaymentForms.xml"/> > + </widgets> > + </section> > + </screenlet> > + </widgets> > + </section> > </fail-widgets> > </section> > <section> > @@ -259,24 +256,30 @@ > <not><if-empty field- > name="invoices"/></not> > </condition> > <widgets> > - <container style="screenlet"> > - <container > style="screenlet-title-bar"> > - <container > style="h3"> > - <label text="$ > {uiLabelMap.AccountingListInvoicesNotYetApplied}"/> > - </container> > + <screenlet title="$ > {uiLabelMap.AccountingListInvoicesNotYetApplied}"> > + <container> > + <label style="h2" > text="${uiLabelMap.CommonFrom} ${partyNameViewTo.groupName}$ > {partyNameViewTo.lastName},${partyNameViewTo.firstName} $ > {partyNameViewTo.middleName}[${payment.partyIdTo}]"/> > + <label style="h2" > text="${uiLabelMap.CommonTo} ${partyNameViewFrom.groupName}$ > {partyNameViewFrom.lastName},${partyNameViewFrom.firstName} $ > {partyNameViewFrom.middleName} [${payment.partyIdFrom}]"/> > </container> > - <container > style="screenlet-body"> > - <section> > - <widgets> > - <container> > - <label > style="h2" text="${uiLabelMap.CommonFrom} $ > {partyNameViewTo.groupName}${partyNameViewTo.lastName},$ > {partyNameViewTo.firstName} ${partyNameViewTo.middleName}[$ > {payment.partyIdTo}]"/> > - <label > style="h2" text="${uiLabelMap.CommonTo} $ > {partyNameViewFrom.groupName}${partyNameViewFrom.lastName},$ > {partyNameViewFrom.firstName} ${partyNameViewFrom.middleName} [$ > {payment.partyIdFrom}]"/> > - </container> > - <include- > form name="listInvoicesNotApplied" location="component://accounting/ > webapp/accounting/payment/PaymentForms.xml"/> > - </widgets> > - </section> > + <include-form > name="listInvoicesNotApplied" location="component://accounting/ > webapp/accounting/payment/PaymentForms.xml"/> > + </screenlet> > + </widgets> > + </section> > + <section> > + <condition> > + <not><if-empty field- > name="invoicesOtherCurrency"/></not> > + </condition> > + <widgets> > + <screenlet title="$ > {uiLabelMap.AccountingListInvoicesNotYetApplied}"> > + <container> > + <label style="h1" > text="Othercurrency invoices"/> > </container> > - </container> > + <container> > + <label style="h2" > text="${uiLabelMap.CommonFrom} ${partyNameViewTo.groupName}$ > {partyNameViewTo.lastName},${partyNameViewTo.firstName} $ > {partyNameViewTo.middleName}[${payment.partyIdTo}]"/> > + <label style="h2" > text="${uiLabelMap.CommonTo} ${partyNameViewFrom.groupName}$ > {partyNameViewFrom.lastName},${partyNameViewFrom.firstName} $ > {partyNameViewFrom.middleName} [${payment.partyIdFrom}]"/> > + </container> > + <include-form > name="listInvoicesNotAppliedOtherCurrency" location="component:// > accounting/webapp/accounting/payment/PaymentForms.xml"/> > + </screenlet> > </widgets> > </section> > <section> > @@ -284,42 +287,18 @@ > <not><if-empty field- > name="payments"/></not> > </condition> > <widgets> > - <container style="screenlet"> > - <container > style="screenlet-title-bar"> > - <container > style="h3"> > - <label text="$ > {uiLabelMap.AccountingListPaymentsNotYetApplied}"/> > - </container> > - </container> > - <container > style="screenlet-body"> > - <section> > - <widgets> > - <container> > - <label > style="h2" text="${uiLabelMap.CommonFrom}: $ > {partyNameViewTo.groupName}${partyNameViewTo.lastName},$ > {partyNameViewTo.firstName} ${partyNameViewTo.middleName}[$ > {payment.partyIdTo}]"/> > - <label > style="h2" text="${uiLabelMap.CommonTo}: $ > {partyNameViewFrom.groupName}${partyNameViewFrom.lastName},$ > {partyNameViewFrom.firstName} ${partyNameViewFrom.middleName} [$ > {payment.partyIdFrom}]"/> > - </container> > - <include- > form name="listPaymentsNotApplied" location="component://accounting/ > webapp/accounting/payment/PaymentForms.xml"/> > - </widgets> > - </section> > + <screenlet title="$ > {uiLabelMap.AccountingListPaymentsNotYetApplied}"> > + <container> > + <label style="h2" > text="${uiLabelMap.CommonFrom}: ${partyNameViewTo.groupName}$ > {partyNameViewTo.lastName},${partyNameViewTo.firstName} $ > {partyNameViewTo.middleName}[${payment.partyIdTo}]"/> > + <label style="h2" > text="${uiLabelMap.CommonTo}: ${partyNameViewFrom.groupName}$ > {partyNameViewFrom.lastName},${partyNameViewFrom.firstName} $ > {partyNameViewFrom.middleName} [${payment.partyIdFrom}]"/> > </container> > - </container> > + <include-form > name="listPaymentsNotApplied" location="component://accounting/ > webapp/accounting/payment/PaymentForms.xml"/> > + </screenlet> > </widgets> > </section> > - <container style="screenlet"> > - <container style="screenlet- > title-bar"> > - <container style="h3"> > - <label text="$ > {uiLabelMap.AccountingApplyPaymentoTo}"/> > - </container> > - </container> > - <container style="screenlet- > body"> > - <section> > - <widgets> > - <container> > - <include-form > name="addPaymentApplication" location="component://accounting/webapp/ > accounting/payment/PaymentForms.xml"/> > - </container> > - </widgets> > - </section> > - </container> > - </container> > + <screenlet title="$ > {uiLabelMap.AccountingApplyPaymentoTo}"> > + <include-form > name="addPaymentApplication" location="component://accounting/webapp/ > accounting/payment/PaymentForms.xml"/> > + </screenlet> > </widgets> > </section> > </decorator-section> > > smime.p7s (6K) Download Attachment |
Hi Jacopo,
this method avoids having to convert the invoice which is requested by the customer in their own currency manually. This is now completely automatic using the actual exchange rate which was used when the money was transferred. It is however still possible, after the conversion, to show the invoice in the currency of the customer. For users who do not have foreign currency invoices, it is completely hidden. Regards, Hans On Sun, 2008-09-28 at 17:32 +0200, Jacopo Cappellato wrote: > Hi Hans, > > I remember that you already explained some of the requirements behind > this work... but I am still wondering if this stuff should really go > in the official svn. > It seems problematic to me to update/convert the invoice items to the > currency of a payment... I guess there are other solutions to match a > payment with an invoice in a different currency. > > Jacopo > > > On Sep 28, 2008, at 3:39 PM, [hidden email] wrote: > > > Author: hansbak > > Date: Sun Sep 28 06:39:56 2008 > > New Revision: 699817 > > > > URL: http://svn.apache.org/viewvc?rev=699817&view=rev > > Log: > > it is now possible to apply 'home' currency payments to foreign > > curency invoices, converting the foreign invoice to the 'home' > > currency in the process and making an entry in the currency exchange > > table so it is still possble to display the invoice in the customer > > currency. To make this work, it is however required that the > > preferred currency of the parties are specified in the party entity. > > This will not affect the system if the payment and the invoice are > > in the same currency > > > > Modified: > > ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml > > ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/ > > invoice/InvoiceServices.xml > > ofbiz/trunk/applications/accounting/servicedef/services_invoice.xml > > ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/ > > invoice/InvoiceServices.java > > ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/ > > actions/payment/ListNotAppliedInvoices.groovy > > ofbiz/trunk/applications/accounting/webapp/accounting/payment/ > > PaymentForms.xml > > ofbiz/trunk/applications/accounting/widget/PaymentScreens.xml > > > > Modified: ofbiz/trunk/applications/accounting/config/ > > AccountingUiLabels.xml > > URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml?rev=699817&r1=699816&r2=699817&view=diff > > = > > = > > = > > = > > = > > = > > = > > = > > ====================================================================== > > --- ofbiz/trunk/applications/accounting/config/ > > AccountingUiLabels.xml (original) > > +++ ofbiz/trunk/applications/accounting/config/ > > AccountingUiLabels.xml Sun Sep 28 06:39:56 2008 > > @@ -3276,7 +3276,7 @@ > > <value xml:lang="zh">已付</value> > > </property> > > <property key="AccountingInvoicePaymentCurrencyProblem"> > > - <value xml:lang="en">Payment currency [$ > > {paymentCurrencyId}] and invoice currency [${invoiceCurrency}] not > > the same > > + <value xml:lang="en">Payment currency [${paymentCurrency}] > > and invoice currency [${invoiceCurrency}] not the same > > </value> > > <value xml:lang="es">Moneda de pago [${paymentCurrencyId}] y > > moneda de factura [${invoiceCurrency}] no son iguales > > </value> > > > > Modified: ofbiz/trunk/applications/accounting/script/org/ofbiz/ > > accounting/invoice/InvoiceServices.xml > > URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/invoice/InvoiceServices.xml?rev=699817&r1=699816&r2=699817&view=diff > > = > > = > > = > > = > > = > > = > > = > > = > > ====================================================================== > > --- ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/ > > invoice/InvoiceServices.xml (original) > > +++ ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/ > > invoice/InvoiceServices.xml Sun Sep 28 06:39:56 2008 > > @@ -506,6 +506,57 @@ > > <call-simple-method method-name="copyInvoice"/> > > </simple-method> > > > > + <simple-method method-name="convertInvoiceToOtherCurrency" > > short-description="service to convert an invoice to another currency > > having the original currency still there using the exchange rate > > table."> > > + <entity-one entity-name="Invoice" value-name="invoice"/> > > + <if-empty field="invoice"> > > + <add-error><fail-message message="Invoice not found"/></ > > add-error> > > + </if-empty> > > + <entity-one entity-name="Uom" value-name="newCurrencyUom"> > > + <field-map field-name="uomId" env- > > name="parameters.newCurrencyUomId"/> > > + </entity-one> > > + <if-empty field="newCurrencyUom"> > > + <add-error><fail-message message="New Currency Code not > > found"/></add-error> > > + </if-empty> > > + <if-compare-field field="parameters.newCurrencyUomId" > > operator="equals" to-field="invoice.currencyUomId"> > > + <add-error><fail-message message="Invoice already has > > the requested currency"/></add-error> > > + </if-compare-field> > > + <check-errors/> > > + > > + <get-related value-name="invoice" relation- > > name="InvoiceItem" list-name="invoiceItems"/> > > + <iterate list-name="invoiceItems" entry-name="invoiceItem"> > > + <calculate field-name="invoiceItem.amount" > > type="Double" decimal-scale="15"> > > + <calcop operator="divide"> > > + <calcop operator="get" field- > > name="invoiceItem.amount"/> > > + <calcop operator="get" field- > > name="parameters.exchangeRate"/> > > + </calcop> > > + </calculate> > > + <store-value value-name="invoiceItem"/> > > + </iterate> > > + > > + <entity-one entity-name="UomConversionDated" value- > > name="uomValue"> > > + <field-map field-name="uomId" env- > > name="parameters.newCurrencyUomId"/> > > + <field-map field-name="uomIdTo" env- > > name="invoice.currencyUomId"/> > > + <field-map field-name="fromDate" env- > > name="invoice.invoiceDate"/> > > + </entity-one> > > + > > + <make-value entity-name="UomConversionDated" value- > > name="uomConversionDated"/> > > + <set field="uomConversionDated.uomId" from- > > field="parameters.newCurrencyUomId"/> > > + <set field="uomConversionDated.uomIdTo" from- > > field="invoice.currencyUomId"/> > > + <set field="uomConversionDated.fromDate" from- > > field="invoice.invoiceDate"/> > > + <set field="uomConversionDated.thruDate" from- > > field="invoice.invoiceDate"/> > > + <set field="uomConversionDated.conversionFactor" from- > > field="parameters.exchangeRate"/> > > + <if-empty field="uomValue"> > > + <create-value value-name="uomConversionDated"/> > > + <else> > > + <store-value value-name="uomConversionDated"/> > > + </else> > > + </if-empty> > > + > > + <set field="invoice.currencyUomId" from- > > field="parameters.newCurrencyUomId"/> > > + <store-value value-name="invoice"/> > > + <field-to-result field-name="parameters.invoiceId" result- > > name="invoiceId"/> > > + </simple-method> > > + > > <!-- ===============subroutine services =================--> > > <simple-method method-name="InvoiceStatusInProgress" short- > > description="Check if the invoiceStatus is in progress"> > > <!-- find the current header record --> > > > > Modified: ofbiz/trunk/applications/accounting/servicedef/ > > services_invoice.xml > > URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/servicedef/services_invoice.xml?rev=699817&r1=699816&r2=699817&view=diff > > = > > = > > = > > = > > = > > = > > = > > = > > ====================================================================== > > --- ofbiz/trunk/applications/accounting/servicedef/ > > services_invoice.xml (original) > > +++ ofbiz/trunk/applications/accounting/servicedef/ > > services_invoice.xml Sun Sep 28 06:39:56 2008 > > @@ -274,11 +274,17 @@ > > <description>Accounting Invoice Permission Checking Logic</ > > description> > > <implements service="permissionInterface"/> > > </service> > > - <!-- Update InvoiceItemType --> > > <service name="updateInvoiceItemType" engine="simple" default- > > entity-name="InvoiceItemType" > > location="org/ofbiz/accounting/invoice/InvoiceServices.xml" > > invoke="updateInvoiceItemType"> > > <description>Update Invoice Item Type Record</description> > > <auto-attributes mode="IN" include="pk" optional="false"/> > > <auto-attributes mode="IN" include="nonpk" optional="true"/> > > </service> > > + <service name="convertInvoiceToOtherCurrency" engine="simple" > > + location="org/ofbiz/accounting/invoice/InvoiceServices.xml" > > invoke="convertInvoiceToOtherCurrency"> > > + <description>service to convert an invoice to another > > currency having the original currency still there using the exchange > > rate table.</description> > > + <attribute name="invoiceId" mode="INOUT" type="String"/> > > + <attribute name="newCurrencyUomId" mode="IN" type="String"/> > > + <attribute name="exchangeRate" mode="IN" type="Double"/> > > + </service> > > </services> > > \ No newline at end of file > > > > Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/ > > accounting/invoice/InvoiceServices.java > > URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java?rev=699817&r1=699816&r2=699817&view=diff > > = > > = > > = > > = > > = > > = > > = > > = > > ====================================================================== > > --- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/ > > invoice/InvoiceServices.java (original) > > +++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/ > > invoice/InvoiceServices.java Sun Sep 28 06:39:56 2008 > > @@ -2256,7 +2256,9 @@ > > private static String successMessage = null; > > public static Map updatePaymentApplicationDefBd(DispatchContext > > dctx, Map context) { > > GenericDelegator delegator = dctx.getDelegator(); > > + LocalDispatcher dispatcher = dctx.getDispatcher(); > > Locale locale = (Locale) context.get("locale"); > > + GenericValue userLogin = (GenericValue) > > context.get("userLogin"); > > > > if (decimals == -1 || rounding == -1) { > > return > > ServiceUtil > > .returnError > > (UtilProperties > > .getMessage > > (resource,"AccountingAritmeticPropertiesNotConfigured",locale)); > > @@ -2500,6 +2502,38 @@ > > > > errorMessageList > > .add > > (UtilProperties > > .getMessage > > (resource > > ,"AccountingInvoiceCancelledCannotApplyTo > > ",UtilMisc.toMap("invoiceId",invoiceId),locale)); > > } > > > > + // check the currency > > + if (payment.get("currencyUomId") != null && > > invoice.get("currencyUomId") != null && > > + ! > > payment > > .getString > > ("currencyUomId").equals(invoice.getString("currencyUomId"))) { > > + > > Debug.logInfo(UtilProperties.getMessage(resource, > > "AccountingInvoicePaymentCurrencyProblem", > > + UtilMisc.toMap("invoiceCurrency", > > invoice.getString("currencyUomId"), "paymentCurrency", > > payment.getString("currencyUomId")),locale), module); > > + Debug.logInfo("will convert invoice currency > > according original currency amount on payment", module); > > + > > + if (payment.get("actualCurrencyAmount") == null > > || payment.get("actualCurrencyUomId") == null) { > > + errorMessageList.add("in order to properly > > convert the Invoice we need the actual currency and actual amount on > > the payment"); > > + } else { > > + if (! > > payment > > .get("actualCurrencyUomId").equals(invoice.get("currencyUomId"))) { > > + errorMessageList.add("actual currency > > on payment not the same as original invoice currency"); > > + } else { > > + // calculate exchange rate, convert/retrieve > > invoice > > + try { > > + Double exchangeRate = new > > Double( payment.getDouble("actualCurrencyAmount").doubleValue() / > > payment.getDouble("amount").doubleValue()); > > + Map inMap = UtilMisc.toMap("userLogin", > > userLogin, "invoiceId", invoiceId, "newCurrencyUomId", > > payment.getString("currencyUomId")); > > + inMap.put("exchangeRate", exchangeRate); > > + > > dispatcher.runSync("convertInvoiceToOtherCurrency", inMap); > > + invoice = > > delegator.findByPrimaryKey("Invoice", UtilMisc.toMap("invoiceId", > > invoiceId)); > > + } catch (GenericServiceException se) { > > + Debug.logError(se, se.getMessage(), > > module); > > + return > > ServiceUtil.returnError(se.getMessage()); > > + } catch (GenericEntityException e) { > > + > > ServiceUtil.returnError(e.getMessage()); > > + } > > + } > > + } > > + > > + > > + } > > + > > // check if the invoice already covered by payments > > BigDecimal invoiceTotal = > > InvoiceWorker.getInvoiceTotalBd(invoice); > > invoiceApplyAvailable = > > InvoiceWorker.getInvoiceNotApplied(invoice); > > @@ -3082,4 +3116,5 @@ > > return ServiceUtil.returnError(ee.getMessage()); > > } > > } > > + > > } > > > > Modified: ofbiz/trunk/applications/accounting/webapp/accounting/WEB- > > INF/actions/payment/ListNotAppliedInvoices.groovy > > URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/payment/ListNotAppliedInvoices.groovy?rev=699817&r1=699816&r2=699817&view=diff > > = > > = > > = > > = > > = > > = > > = > > = > > ====================================================================== > > --- ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/ > > actions/payment/ListNotAppliedInvoices.groovy (original) > > +++ ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/ > > actions/payment/ListNotAppliedInvoices.groovy Sun Sep 28 06:39:56 2008 > > @@ -33,9 +33,8 @@ > > decimals = UtilNumber.getBigDecimalScale("invoice.decimals"); > > rounding = UtilNumber.getBigDecimalRoundingMode("invoice.rounding"); > > > > -// retrieve invoices for the related parties which have not been > > (fully) applied yet > > -List invoices = delegator.findByAnd("Invoice", [partyId : > > payment.partyIdFrom, partyIdFrom : payment.partyIdTo], > > ["invoiceDate"]); > > - > > +//retrieve invoices for the related parties which have not been > > (fully) applied yet and which have the same currency. > > +List invoices = delegator.findByAnd("Invoice", [partyId : > > payment.partyIdFrom, partyIdFrom : payment.partyIdTo, > > currencyUomId : payment.currencyUomId], ["invoiceDate"]); > > if (invoices) { > > invoicesList = []; // to pass back to the screeen list of > > unapplied invoices > > paymentApplied = PaymentWorker.getPaymentAppliedBd(payment); > > @@ -65,3 +64,36 @@ > > } > > context.invoices = invoicesList; > > } > > + > > +//retrieve invoices for the related parties which have not been > > (fully) applied yet and which have another currency > > +invoices = delegator.findByAnd("Invoice", [partyId : > > payment.partyIdFrom, partyIdFrom : payment.partyIdTo], > > ["invoiceDate"]); > > +// remove same currencies > > +for (int ind=0; ind < invoices.size(); ind++ ) { > > + if (invoices[ind].currencyUomId.equals(payment.currencyUomId)) { > > + invoices.remove(ind); > > + } > > +} > > +if (invoices) { > > + invoicesList = []; // to pass back to the screeen list of > > unapplied invoices > > + paymentApplied = PaymentWorker.getPaymentAppliedBd(payment); > > + paymentToApply = > > payment > > .getBigDecimal > > ("amount").setScale(decimals,rounding).subtract(paymentApplied); > > + invoices.each { invoice -> > > + invoiceAmount = > > InvoiceWorker.getInvoiceTotalBd(invoice).setScale(decimals,rounding); > > + invoiceApplied = > > InvoiceWorker > > .getInvoiceAppliedBd(invoice).setScale(decimals,rounding); > > + if (!invoiceAmount.equals(invoiceApplied) && > > + !invoice.statusId.equals("INVOICE_CANCELLED") && > > + !invoice.statusId.equals("INVOICE_IN_PROCESS")) { > > + // put in the map > > + invoiceToApply = invoiceAmount.subtract(invoiceApplied); > > + invoiceMap = [:]; > > + invoiceMap.invoiceId = invoice.invoiceId; > > + invoiceMap.currencyUomId = invoice.currencyUomId; > > + invoiceMap.amount = invoiceAmount; > > + invoiceMap.description = invoice.description; > > + invoiceMap.invoiceDate = > > invoice.invoiceDate.toString().substring(0,10); // display only YYYY- > > MM-DD > > + invoiceMap.amountApplied = invoiceApplied; > > + invoicesList.add(invoiceMap); > > + } > > + } > > + context.invoicesOtherCurrency = invoicesList; > > +} > > > > Modified: ofbiz/trunk/applications/accounting/webapp/accounting/ > > payment/PaymentForms.xml > > URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/accounting/payment/PaymentForms.xml?rev=699817&r1=699816&r2=699817&view=diff > > = > > = > > = > > = > > = > > = > > = > > = > > ====================================================================== > > --- ofbiz/trunk/applications/accounting/webapp/accounting/payment/ > > PaymentForms.xml (original) > > +++ ofbiz/trunk/applications/accounting/webapp/accounting/payment/ > > PaymentForms.xml Sun Sep 28 06:39:56 2008 > > @@ -321,6 +321,21 @@ > > </field> > > </form> > > > > + <form name="listInvoicesNotAppliedOtherCurrency" type="list" > > list-name="invoicesOtherCurrency" target="updatePaymentApplication" > > title="" > > + odd-row-style="alternate-row" default-table-style="basic- > > table hover-bar"> > > + <field name="paymentId"><hidden/></field> > > + <field name="invoiceId" widget- > > style="buttontext"><hyperlink target="invoiceOverview?invoiceId=$ > > {invoiceId}" description="${invoiceId}"/></field> > > + <field name="description"><display/></field> > > + <field name="invoiceDate"><display/></field> > > + <field name="amount"><display type="currency" currency="$ > > {currencyUomId}"/></field> > > + <field name="amountApplied" parameter- > > name="dummy"><display type="currency" currency="${currencyUomId}"/ > > ></field> > > + <field name="invoiceProcessing" use-when=""$ > > {uiConfigMap.invoiceProcessing}".equals("Y")"><check/ > > ></field> > > + <field name="invoiceProcessing" use-when=""$ > > {uiConfigMap.invoiceProcessing}".equals("N")"><check/ > > ></field> > > + <field name="applyButton" widget-style="smallSubmit" > > title="Convert Invoice to Payment currency and save rate"> > > + <submit button-type="button"/> > > + </field> > > + </form> > > + > > <form name="listPaymentsNotApplied" type="list" list- > > name="payments" target="updatePaymentApplication" title="" > > odd-row-style="alternate-row" default-table-style="basic- > > table hover-bar"> > > <field name="paymentId"><hidden/></field> > > > > Modified: ofbiz/trunk/applications/accounting/widget/ > > PaymentScreens.xml > > URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/widget/PaymentScreens.xml?rev=699817&r1=699816&r2=699817&view=diff > > = > > = > > = > > = > > = > > = > > = > > = > > ====================================================================== > > --- ofbiz/trunk/applications/accounting/widget/PaymentScreens.xml > > (original) > > +++ ofbiz/trunk/applications/accounting/widget/PaymentScreens.xml > > Sun Sep 28 06:39:56 2008 > > @@ -197,56 +197,53 @@ > > <container><label style="h3" text="$ > > {uiLabelMap.AccountingNoPaymentsApplicationsfound}"></label></ > > container> > > </widgets> > > <fail-widgets> > > - <container style="screenlet"> > > - <container style="screenlet- > > title-bar"> > > - <container style="h3"> > > - <label text="$ > > {uiLabelMap.AccountingPayment} ${uiLabelMap.AccountingApplications}"/> > > - </container> > > - </container> > > - <container style="screenlet- > > body"> > > - <section> > > - <condition> > > - <not><if-empty > > field-name="paymentApplicationsInv"/></not> > > - </condition> > > - <widgets> > > - <include-form > > name="editPaymentApplicationsInv" location="component://accounting/ > > webapp/accounting/payment/PaymentForms.xml"/> > > - </widgets> > > - </section> > > - </container> > > - </container> > > - <container style="screenlet"> > > - <container style="screenlet- > > title-bar"> > > - <container style="h3"> > > - <label text="11$ > > {uiLabelMap.CommonAmount} ${uiLabelMap.CommonTotal} ${payment.amount? > > currency(${payment.currencyUomId})} $ > > {uiLabelMap.AccountingAmountNotApplied} ${notAppliedAmount?currency($ > > {payment.currencyUomId})}"/> > > - </container> > > - </container> > > - <container style="screenlet- > > body"> > > - <section> > > - <condition> > > - <not><if-empty > > field-name="paymentApplicationsPay"/></not> > > - </condition> > > - <widgets> > > - <include-form > > name="editPaymentApplicationsPay" location="component://accounting/ > > webapp/accounting/payment/PaymentForms.xml"/> > > - </widgets> > > - </section> > > - <section> > > - <condition> > > - <not><if-empty > > field-name="paymentApplicationsBil"/></not> > > - </condition> > > - <widgets> > > - <include-form > > name="editPaymentApplicationsBil" location="component://accounting/ > > webapp/accounting/payment/PaymentForms.xml"/> > > - </widgets> > > - </section> > > - <section> > > - <condition> > > - <not><if-empty > > field-name="paymentApplicationsTax"/></not> > > - </condition> > > - <widgets> > > - <include-form > > name="editPaymentApplicationsTax" location="component://accounting/ > > webapp/accounting/payment/PaymentForms.xml"/> > > - </widgets> > > - </section> > > - </container> > > - </container> > > + <section> > > + <condition> > > + <not><if-empty field- > > name="paymentApplicationsInv"/></not> > > + </condition> > > + <widgets> > > + <screenlet title="$ > > {uiLabelMap.AccountingPayment} ${uiLabelMap.AccountingApplications}"> > > + <include-form > > name="editPaymentApplicationsInv" location="component://accounting/ > > webapp/accounting/payment/PaymentForms.xml"/> > > + </screenlet> > > + </widgets> > > + </section> > > + <section> > > + <condition> > > + <or> > > + <not><if-empty field- > > name="paymentApplicationsPay"/></not> > > + <not><if-empty field- > > name="paymentApplicationsBil"/></not> > > + <not><if-empty field- > > name="paymentApplicationsTax"/></not> > > + </or> > > + </condition> > > + <widgets> > > + <screenlet title="$ > > {uiLabelMap.CommonAmount} ${uiLabelMap.CommonTotal} ${payment.amount? > > currency(${payment.currencyUomId})} $ > > {uiLabelMap.AccountingAmountNotApplied} ${notAppliedAmount?currency($ > > {payment.currencyUomId})}"> > > + <section> > > + <condition> > > + <not><if-empty > > field-name="paymentApplicationsPay"/></not> > > + </condition> > > + <widgets> > > + <include-form > > name="editPaymentApplicationsPay" location="component://accounting/ > > webapp/accounting/payment/PaymentForms.xml"/> > > + </widgets> > > + </section> > > + <section> > > + <condition> > > + <not><if-empty > > field-name="paymentApplicationsBil"/></not> > > + </condition> > > + <widgets> > > + <include-form > > name="editPaymentApplicationsBil" location="component://accounting/ > > webapp/accounting/payment/PaymentForms.xml"/> > > + </widgets> > > + </section> > > + <section> > > + <condition> > > + <not><if-empty > > field-name="paymentApplicationsTax"/></not> > > + </condition> > > + <widgets> > > + <include-form > > name="editPaymentApplicationsTax" location="component://accounting/ > > webapp/accounting/payment/PaymentForms.xml"/> > > + </widgets> > > + </section> > > + </screenlet> > > + </widgets> > > + </section> > > </fail-widgets> > > </section> > > <section> > > @@ -259,24 +256,30 @@ > > <not><if-empty field- > > name="invoices"/></not> > > </condition> > > <widgets> > > - <container style="screenlet"> > > - <container > > style="screenlet-title-bar"> > > - <container > > style="h3"> > > - <label text="$ > > {uiLabelMap.AccountingListInvoicesNotYetApplied}"/> > > - </container> > > + <screenlet title="$ > > {uiLabelMap.AccountingListInvoicesNotYetApplied}"> > > + <container> > > + <label style="h2" > > text="${uiLabelMap.CommonFrom} ${partyNameViewTo.groupName}$ > > {partyNameViewTo.lastName},${partyNameViewTo.firstName} $ > > {partyNameViewTo.middleName}[${payment.partyIdTo}]"/> > > + <label style="h2" > > text="${uiLabelMap.CommonTo} ${partyNameViewFrom.groupName}$ > > {partyNameViewFrom.lastName},${partyNameViewFrom.firstName} $ > > {partyNameViewFrom.middleName} [${payment.partyIdFrom}]"/> > > </container> > > - <container > > style="screenlet-body"> > > - <section> > > - <widgets> > > - <container> > > - <label > > style="h2" text="${uiLabelMap.CommonFrom} $ > > {partyNameViewTo.groupName}${partyNameViewTo.lastName},$ > > {partyNameViewTo.firstName} ${partyNameViewTo.middleName}[$ > > {payment.partyIdTo}]"/> > > - <label > > style="h2" text="${uiLabelMap.CommonTo} $ > > {partyNameViewFrom.groupName}${partyNameViewFrom.lastName},$ > > {partyNameViewFrom.firstName} ${partyNameViewFrom.middleName} [$ > > {payment.partyIdFrom}]"/> > > - </container> > > - <include- > > form name="listInvoicesNotApplied" location="component://accounting/ > > webapp/accounting/payment/PaymentForms.xml"/> > > - </widgets> > > - </section> > > + <include-form > > name="listInvoicesNotApplied" location="component://accounting/ > > webapp/accounting/payment/PaymentForms.xml"/> > > + </screenlet> > > + </widgets> > > + </section> > > + <section> > > + <condition> > > + <not><if-empty field- > > name="invoicesOtherCurrency"/></not> > > + </condition> > > + <widgets> > > + <screenlet title="$ > > {uiLabelMap.AccountingListInvoicesNotYetApplied}"> > > + <container> > > + <label style="h1" > > text="Othercurrency invoices"/> > > </container> > > - </container> > > + <container> > > + <label style="h2" > > text="${uiLabelMap.CommonFrom} ${partyNameViewTo.groupName}$ > > {partyNameViewTo.lastName},${partyNameViewTo.firstName} $ > > {partyNameViewTo.middleName}[${payment.partyIdTo}]"/> > > + <label style="h2" > > text="${uiLabelMap.CommonTo} ${partyNameViewFrom.groupName}$ > > {partyNameViewFrom.lastName},${partyNameViewFrom.firstName} $ > > {partyNameViewFrom.middleName} [${payment.partyIdFrom}]"/> > > + </container> > > + <include-form > > name="listInvoicesNotAppliedOtherCurrency" location="component:// > > accounting/webapp/accounting/payment/PaymentForms.xml"/> > > + </screenlet> > > </widgets> > > </section> > > <section> > > @@ -284,42 +287,18 @@ > > <not><if-empty field- > > name="payments"/></not> > > </condition> > > <widgets> > > - <container style="screenlet"> > > - <container > > style="screenlet-title-bar"> > > - <container > > style="h3"> > > - <label text="$ > > {uiLabelMap.AccountingListPaymentsNotYetApplied}"/> > > - </container> > > - </container> > > - <container > > style="screenlet-body"> > > - <section> > > - <widgets> > > - <container> > > - <label > > style="h2" text="${uiLabelMap.CommonFrom}: $ > > {partyNameViewTo.groupName}${partyNameViewTo.lastName},$ > > {partyNameViewTo.firstName} ${partyNameViewTo.middleName}[$ > > {payment.partyIdTo}]"/> > > - <label > > style="h2" text="${uiLabelMap.CommonTo}: $ > > {partyNameViewFrom.groupName}${partyNameViewFrom.lastName},$ > > {partyNameViewFrom.firstName} ${partyNameViewFrom.middleName} [$ > > {payment.partyIdFrom}]"/> > > - </container> > > - <include- > > form name="listPaymentsNotApplied" location="component://accounting/ > > webapp/accounting/payment/PaymentForms.xml"/> > > - </widgets> > > - </section> > > + <screenlet title="$ > > {uiLabelMap.AccountingListPaymentsNotYetApplied}"> > > + <container> > > + <label style="h2" > > text="${uiLabelMap.CommonFrom}: ${partyNameViewTo.groupName}$ > > {partyNameViewTo.lastName},${partyNameViewTo.firstName} $ > > {partyNameViewTo.middleName}[${payment.partyIdTo}]"/> > > + <label style="h2" > > text="${uiLabelMap.CommonTo}: ${partyNameViewFrom.groupName}$ > > {partyNameViewFrom.lastName},${partyNameViewFrom.firstName} $ > > {partyNameViewFrom.middleName} [${payment.partyIdFrom}]"/> > > </container> > > - </container> > > + <include-form > > name="listPaymentsNotApplied" location="component://accounting/ > > webapp/accounting/payment/PaymentForms.xml"/> > > + </screenlet> > > </widgets> > > </section> > > - <container style="screenlet"> > > - <container style="screenlet- > > title-bar"> > > - <container style="h3"> > > - <label text="$ > > {uiLabelMap.AccountingApplyPaymentoTo}"/> > > - </container> > > - </container> > > - <container style="screenlet- > > body"> > > - <section> > > - <widgets> > > - <container> > > - <include-form > > name="addPaymentApplication" location="component://accounting/webapp/ > > accounting/payment/PaymentForms.xml"/> > > - </container> > > - </widgets> > > - </section> > > - </container> > > - </container> > > + <screenlet title="$ > > {uiLabelMap.AccountingApplyPaymentoTo}"> > > + <include-form > > name="addPaymentApplication" location="component://accounting/webapp/ > > accounting/payment/PaymentForms.xml"/> > > + </screenlet> > > </widgets> > > </section> > > </decorator-section> > > > > > Antwebsystems.com: Quality OFBiz services for competitive prices |
Hello Hans, Jacopo
I am not familiar with Ofbiz accounting rules yet, but from what I understood I would have to agree with Jacopo in that an invoice (document) shouldn't have to be converted to a different currency in order for a payment in that currency to be applied to. From previous knowledge I can tell you, it is a general practice in ERP systems that the base currency is pretty much tied to an initial setup or accounting schema, it doesn't depend on a specific party's currency or anything else, rather an accounting gain/loss transaction should be set up in order to keep track of such payments when the currencies are different from the original document. Regards, -Enrique Ruibal |
Yes,
I'd really suggest at least the following in order to make the process more canonical: 1) the invoice should be created in the currency that the customer expects, the same of the order 2) after that an invoice is generated in one currency, don't convert it 3) if the point #1 is not possible (why?) and the customer really wants to see the invoice in a different currency, then you can provide a PDF version of the invoice in a different currency; the conversion is done on the fly (not stored in the db) for the report, but the conversion rate is dated so that you will get the same numbers even if the conversion rate changes over time 4) if we receive a payment in a currency different from the one of the invoice: I'll have to think more about the proper solution, but one could be to convert the payment in the invoice currency and then apply it to the invoice Invoices are official documents, and I would be very surprised if there are countries that require you to modify an invoice if you receive a payment in a different currency: this could cause confusion and, as Enrique suggested, GL issues and we should try to implement in OFBiz the most standard processes, especially in areas like invoicing and accounting. Jacopo On Sep 29, 2008, at 5:19 AM, Enrique Ruibal wrote: > > Hello Hans, Jacopo > > I am not familiar with Ofbiz accounting rules yet, but from what I > understood I would have to agree with Jacopo in that an invoice > (document) > shouldn't have to be converted to a different currency in order for a > payment in that currency to be applied to. > > From previous knowledge I can tell you, it is a general practice in > ERP > systems that the base currency is pretty much tied to an initial > setup or > accounting schema, it doesn't depend on a specific party's currency or > anything else, rather an accounting gain/loss transaction should be > set up > in order to keep track of such payments when the currencies are > different > from the original document. > > Regards, > > -Enrique Ruibal > -- > View this message in context: http://www.nabble.com/Re%3A-svn-commit%3A-r699817---in--ofbiz-trunk-applications-accounting%3A-config--script-org-ofbiz-accounting-invoice--servicedef--src-org-ofbiz-accounting-invoice--webapp-accounting-WEB-INF-actions-payment--webapp-accounting-payment--widget--tp19712499p19717891.html > Sent from the OFBiz - Dev mailing list archive at Nabble.com. > smime.p7s (6K) Download Attachment |
hi Jacopo,
please see my comments below.... On Mon, 2008-09-29 at 09:22 +0200, Jacopo Cappellato wrote: > Yes, > > I'd really suggest at least the following in order to make the process > more canonical: > > 1) the invoice should be created in the currency that the customer > expects, the same of the order This is required from a commercial point of view and that is how we do it here. > 2) after that an invoice is generated in one currency, don't convert it .... > 3) if the point #1 is not possible (why?) and the customer really > wants to see the invoice in a different currency, then you can provide > a PDF version of the invoice in a different currency; the conversion > is done on the fly (not stored in the db) for the report, but the > conversion rate is dated so that you will get the same numbers even if > the conversion rate changes over time Point #1 is fine and required. The Thai government however requires that all currency in the company is in the Thai currency also the foreign invoices. We also only book into the ledger if the payment is received so we do not have any ledger problems. > 4) if we receive a payment in a currency different from the one of the > invoice: I'll have to think more about the proper solution, but one > could be to convert the payment in the invoice currency and then apply > it to the invoice I cannot convert the payment because everything in the books should be in the Thai currency. > > Invoices are official documents, and I would be very surprised if > there are countries that require you to modify an invoice if you > receive a payment in a different currency: this could cause confusion > and, as Enrique suggested, GL issues and we should try to implement in > OFBiz the most standard processes, especially in areas like invoicing > and accounting. we actually do not change the invoice because it can still be printed in the foreign currency, we only change the internal representation.... let me also emphasize that this is a facility which is optional and does not have to be used..... Regards, Hans > > Jacopo > > On Sep 29, 2008, at 5:19 AM, Enrique Ruibal wrote: > > > > > Hello Hans, Jacopo > > > > I am not familiar with Ofbiz accounting rules yet, but from what I > > understood I would have to agree with Jacopo in that an invoice > > (document) > > shouldn't have to be converted to a different currency in order for a > > payment in that currency to be applied to. > > > > From previous knowledge I can tell you, it is a general practice in > > ERP > > systems that the base currency is pretty much tied to an initial > > setup or > > accounting schema, it doesn't depend on a specific party's currency or > > anything else, rather an accounting gain/loss transaction should be > > set up > > in order to keep track of such payments when the currencies are > > different > > from the original document. > > > > Regards, > > > > -Enrique Ruibal > > -- > > View this message in context: http://www.nabble.com/Re%3A-svn-commit%3A-r699817---in--ofbiz-trunk-applications-accounting%3A-config--script-org-ofbiz-accounting-invoice--servicedef--src-org-ofbiz-accounting-invoice--webapp-accounting-WEB-INF-actions-payment--webapp-accounting-payment--widget--tp19712499p19717891.html > > Sent from the OFBiz - Dev mailing list archive at Nabble.com. > > > Antwebsystems.com: Quality OFBiz services for competitive prices |
Hi Hans,
On Sep 29, 2008, at 1:08 PM, Hans Bakker wrote: > hi Jacopo, > > please see my comments below.... > > On Mon, 2008-09-29 at 09:22 +0200, Jacopo Cappellato wrote: >> Yes, >> >> I'd really suggest at least the following in order to make the >> process >> more canonical: >> >> 1) the invoice should be created in the currency that the customer >> expects, the same of the order > > This is required from a commercial point of view and that is how we do > it here. > >> 2) after that an invoice is generated in one currency, don't >> convert it > > .... > >> 3) if the point #1 is not possible (why?) and the customer really >> wants to see the invoice in a different currency, then you can >> provide >> a PDF version of the invoice in a different currency; the conversion >> is done on the fly (not stored in the db) for the report, but the >> conversion rate is dated so that you will get the same numbers even >> if >> the conversion rate changes over time > > Point #1 is fine and required. The Thai government however requires > that > all currency in the company is in the Thai currency also the foreign > invoices. We also only book into the ledger if the payment is received > so we do not have any ledger problems. is very common requirement, not just in Thailand). There is already support for this in OFBiz: accounting transactions originated by events in different currencies from the one of GL are automatically converted using the currency exchange rate of the date of the transaction. > > >> 4) if we receive a payment in a currency different from the one of >> the >> invoice: I'll have to think more about the proper solution, but one >> could be to convert the payment in the invoice currency and then >> apply >> it to the invoice > > I cannot convert the payment because everything in the books should be > in the Thai currency. > applied after conversion to the invoice (but there could be many other options). >> >> Invoices are official documents, and I would be very surprised if >> there are countries that require you to modify an invoice if you >> receive a payment in a different currency: this could cause confusion >> and, as Enrique suggested, GL issues and we should try to implement >> in >> OFBiz the most standard processes, especially in areas like invoicing >> and accounting. > > we actually do not change the invoice because it can still be > printed in > the foreign currency, we only change the internal representation.... > > let me also emphasize that this is a facility which is optional and > does > not have to be used..... > Yes, but this is, in my opinion, a common process implemented in a very customer specific way, and I am not sure it is a good idea to have it in the trunk. By the way, maybe I am the only one that is worried... let's see if there are other opinions. Kind Regards, Jacopo > Regards, > Hans > >> >> Jacopo >> >> On Sep 29, 2008, at 5:19 AM, Enrique Ruibal wrote: >> >>> >>> Hello Hans, Jacopo >>> >>> I am not familiar with Ofbiz accounting rules yet, but from what I >>> understood I would have to agree with Jacopo in that an invoice >>> (document) >>> shouldn't have to be converted to a different currency in order >>> for a >>> payment in that currency to be applied to. >>> >>> From previous knowledge I can tell you, it is a general practice in >>> ERP >>> systems that the base currency is pretty much tied to an initial >>> setup or >>> accounting schema, it doesn't depend on a specific party's >>> currency or >>> anything else, rather an accounting gain/loss transaction should be >>> set up >>> in order to keep track of such payments when the currencies are >>> different >>> from the original document. >>> >>> Regards, >>> >>> -Enrique Ruibal >>> -- >>> View this message in context: http://www.nabble.com/Re%3A-svn-commit%3A-r699817---in--ofbiz-trunk-applications-accounting%3A-config--script-org-ofbiz-accounting-invoice--servicedef--src-org-ofbiz-accounting-invoice--webapp-accounting-WEB-INF-actions-payment--webapp-accounting-payment--widget--tp19712499p19717891.html >>> Sent from the OFBiz - Dev mailing list archive at Nabble.com. >>> >> > -- > Antwebsystems.com: Quality OFBiz services for competitive prices > smime.p7s (6K) Download Attachment |
Administrator
|
From: "Jacopo Cappellato" <[hidden email]>
> Hi Hans, > > On Sep 29, 2008, at 1:08 PM, Hans Bakker wrote: > >> hi Jacopo, >> >> please see my comments below.... >> >> On Mon, 2008-09-29 at 09:22 +0200, Jacopo Cappellato wrote: >>> Yes, >>> >>> I'd really suggest at least the following in order to make the process >>> more canonical: >>> >>> 1) the invoice should be created in the currency that the customer >>> expects, the same of the order >> >> This is required from a commercial point of view and that is how we do >> it here. >> >>> 2) after that an invoice is generated in one currency, don't convert it >> >> .... >> >>> 3) if the point #1 is not possible (why?) and the customer really >>> wants to see the invoice in a different currency, then you can provide >>> a PDF version of the invoice in a different currency; the conversion >>> is done on the fly (not stored in the db) for the report, but the >>> conversion rate is dated so that you will get the same numbers even if >>> the conversion rate changes over time >> >> Point #1 is fine and required. The Thai government however requires that >> all currency in the company is in the Thai currency also the foreign >> invoices. We also only book into the ledger if the payment is received >> so we do not have any ledger problems. > > Ah, this is an important point: the GL is done in Thai currency (this is very common requirement, not just in Thailand). > There is already support for this in OFBiz: accounting transactions originated by events in different currencies from the one of > GL are automatically converted using the currency exchange rate of the date of the transaction. Please, which source is used for the rate ? I suppose there is a parameter somewhere ? >> >> >>> 4) if we receive a payment in a currency different from the one of the >>> invoice: I'll have to think more about the proper solution, but one >>> could be to convert the payment in the invoice currency and then apply >>> it to the invoice >> >> I cannot convert the payment because everything in the books should be >> in the Thai currency. >> > > The payment will be posted in the Thai language; howevet it can be applied after conversion to the invoice (but there could be > many other options). > >>> >>> Invoices are official documents, and I would be very surprised if >>> there are countries that require you to modify an invoice if you >>> receive a payment in a different currency: this could cause confusion >>> and, as Enrique suggested, GL issues and we should try to implement in >>> OFBiz the most standard processes, especially in areas like invoicing >>> and accounting. >> >> we actually do not change the invoice because it can still be printed in >> the foreign currency, we only change the internal representation.... >> > > Well, you actually change the invoice! In case of audit I also think it would be considered a change in accounting... >> let me also emphasize that this is a facility which is optional and does >> not have to be used..... >> How is this parameterized ? Jacques > Yes, but this is, in my opinion, a common process implemented in a very customer specific way, and I am not sure it is a good > idea to have it in the trunk. > By the way, maybe I am the only one that is worried... let's see if there are other opinions. > > Kind Regards, > > Jacopo > > > > >> Regards, >> Hans >> >>> >>> Jacopo >>> >>> On Sep 29, 2008, at 5:19 AM, Enrique Ruibal wrote: >>> >>>> >>>> Hello Hans, Jacopo >>>> >>>> I am not familiar with Ofbiz accounting rules yet, but from what I >>>> understood I would have to agree with Jacopo in that an invoice >>>> (document) >>>> shouldn't have to be converted to a different currency in order for a >>>> payment in that currency to be applied to. >>>> >>>> From previous knowledge I can tell you, it is a general practice in >>>> ERP >>>> systems that the base currency is pretty much tied to an initial >>>> setup or >>>> accounting schema, it doesn't depend on a specific party's currency or >>>> anything else, rather an accounting gain/loss transaction should be >>>> set up >>>> in order to keep track of such payments when the currencies are >>>> different >>>> from the original document. >>>> >>>> Regards, >>>> >>>> -Enrique Ruibal >>>> -- >>>> View this message in context: >>>> http://www.nabble.com/Re%3A-svn-commit%3A-r699817---in--ofbiz-trunk-applications-accounting%3A-config--script-org-ofbiz-accounting-invoice--servicedef--src-org-ofbiz-accounting-invoice--webapp-accounting-WEB-INF-actions-payment--webapp-accounting-payment--widget--tp19712499p19717891.html >>>> Sent from the OFBiz - Dev mailing list archive at Nabble.com. >>>> >>> >> -- >> Antwebsystems.com: Quality OFBiz services for competitive prices >> > > |
On Sep 29, 2008, at 6:56 PM, Jacques Le Roux wrote:
>> >> Ah, this is an important point: the GL is done in Thai currency >> (this is very common requirement, not just in Thailand). >> There is already support for this in OFBiz: accounting >> transactions originated by events in different currencies from the >> one of GL are automatically converted using the currency exchange >> rate of the date of the transaction. > > Please, which source is used for the rate ? I suppose there is a > parameter somewhere ? Jacopo smime.p7s (6K) Download Attachment |
Administrator
|
From: "Jacopo Cappellato" <[hidden email]>
> On Sep 29, 2008, at 6:56 PM, Jacques Le Roux wrote: > >>> >>> Ah, this is an important point: the GL is done in Thai currency (this is very common requirement, not just in Thailand). >>> There is already support for this in OFBiz: accounting transactions originated by events in different currencies from the one >>> of GL are automatically converted using the currency exchange rate of the date of the transaction. >> >> Please, which source is used for the rate ? I suppose there is a parameter somewhere ? > > The coefficient in the UomConversion* entity is used. > > Jacopo Thanks Jacopo, OK I see so here UomConversionDated is used I guee. So people use it with any source they want (I guess you must update it daily or even instantaneously online depending on applications) ? Jacques |
In reply to this post by Jacopo Cappellato-4
Hi Jacopo,
the point below is very important, does it mean the ledger posting is checking the company base currency against the invoices and payments and convert where required? On the payment we have the payment amount/currency fields for both the incoming and original payment of which we can extract the exchange rate used. In this case no conversion of any document is required, no entry in the exchange table is required and we keep all amounts in the ledger obviously in the companies base currency.... let me know if i am right on this. Regards, Hans On Mon, 2008-09-29 at 14:28 +0200, Jacopo Cappellato wrote: > ..... > > There is already support for this in OFBiz: accounting transactions > originated by events in different currencies from the one of GL are > automatically converted using the currency exchange rate of the date > of the transaction. -- Antwebsystems.com: Quality OFBiz services for competitive prices |
In reply to this post by Jacques Le Roux
On Sep 29, 2008, at 10:12 PM, Jacques Le Roux wrote: > From: "Jacopo Cappellato" <[hidden email]> >> On Sep 29, 2008, at 6:56 PM, Jacques Le Roux wrote: >> >>>> >>>> Ah, this is an important point: the GL is done in Thai currency >>>> (this is very common requirement, not just in Thailand). >>>> There is already support for this in OFBiz: accounting >>>> transactions originated by events in different currencies from >>>> the one of GL are automatically converted using the currency >>>> exchange rate of the date of the transaction. >>> >>> Please, which source is used for the rate ? I suppose there is a >>> parameter somewhere ? >> >> The coefficient in the UomConversion* entity is used. >> >> Jacopo > > Thanks Jacopo, > > OK I see so here UomConversionDated is used I guee. So people use it > with any source they want (I guess you must update it daily or even > instantaneously online depending on applications) ? > right now you have to set it up manually. Jacopo > Jacques smime.p7s (6K) Download Attachment |
In reply to this post by hans_bakker
On Sep 30, 2008, at 5:28 AM, Hans Bakker wrote: > Hi Jacopo, > > the point below is very important, does it mean the ledger posting is > checking the company base currency against the invoices and payments > and > convert where required? Yes, the "company base currency" is set in the PartyAccountingPref (sorry, I don't remember the name exactly) and you have to enter a record in the CurrencyUomDated entity. If this information is available then you'll notice that the AcctgTransEntry will have two different amounts in the fields: amount/currencyUomId and origAmount/origCurrencyUomId You can also test it creating a manual transaction. Hope it helps, Jacopo > > > On the payment we have the payment amount/currency fields for both the > incoming and original payment of which we can extract the exchange > rate > used. > > In this case no conversion of any document is required, no entry in > the > exchange table is required and we keep all amounts in the ledger > obviously in the companies base currency.... > > let me know if i am right on this. > > Regards, > Hans > > > On Mon, 2008-09-29 at 14:28 +0200, Jacopo Cappellato wrote: >> ..... >> >> There is already support for this in OFBiz: accounting transactions >> originated by events in different currencies from the one of GL are >> automatically converted using the currency exchange rate of the date >> of the transaction. > > -- > Antwebsystems.com: Quality OFBiz services for competitive prices > smime.p7s (6K) Download Attachment |
Administrator
|
Thanks Jacopo,
I think I will make a FAQ for that... Jacques From: "Jacopo Cappellato" <[hidden email]> > > On Sep 30, 2008, at 5:28 AM, Hans Bakker wrote: > >> Hi Jacopo, >> >> the point below is very important, does it mean the ledger posting is >> checking the company base currency against the invoices and payments >> and >> convert where required? > > Yes, > > the "company base currency" is set in the PartyAccountingPref (sorry, > I don't remember the name exactly) and you have to enter a record in > the CurrencyUomDated entity. > If this information is available then you'll notice that the > AcctgTransEntry will have two different amounts in the fields: > amount/currencyUomId > and > origAmount/origCurrencyUomId > > You can also test it creating a manual transaction. > > Hope it helps, > > Jacopo > >> >> >> On the payment we have the payment amount/currency fields for both the >> incoming and original payment of which we can extract the exchange >> rate >> used. >> >> In this case no conversion of any document is required, no entry in >> the >> exchange table is required and we keep all amounts in the ledger >> obviously in the companies base currency.... >> >> let me know if i am right on this. >> >> Regards, >> Hans >> >> >> On Mon, 2008-09-29 at 14:28 +0200, Jacopo Cappellato wrote: >>> ..... >>> >>> There is already support for this in OFBiz: accounting transactions >>> originated by events in different currencies from the one of GL are >>> automatically converted using the currency exchange rate of the date >>> of the transaction. >> >> -- >> Antwebsystems.com: Quality OFBiz services for competitive prices >> > > |
In reply to this post by Jacopo Cappellato-4
Ok Jacopo,
i will remove the invoice conversion service and will adapt the payment application screens and programs so it will be possible to apply a payment on another currency...however this 'other' currency should be available on the payment as an 'original' currency. In order to be able to display as much as possible in the home currency the invoices will be shown (not converted) as using the exchange rate table but when available on the payment (original/actual amount) using that exchange rate (better a configurable option?) I will test then the ledger posting programs if i can get this to work. Thanks for your comments on this subject, surely this is a much better solution. Regards, Hans On Tue, 2008-09-30 at 06:51 +0200, Jacopo Cappellato wrote: > On Sep 30, 2008, at 5:28 AM, Hans Bakker wrote: > > > Hi Jacopo, > > > > the point below is very important, does it mean the ledger posting is > > checking the company base currency against the invoices and payments > > and > > convert where required? > > Yes, > > the "company base currency" is set in the PartyAccountingPref (sorry, > I don't remember the name exactly) and you have to enter a record in > the CurrencyUomDated entity. > If this information is available then you'll notice that the > AcctgTransEntry will have two different amounts in the fields: > amount/currencyUomId > and > origAmount/origCurrencyUomId > > You can also test it creating a manual transaction. > > Hope it helps, > > Jacopo > > > > > > > On the payment we have the payment amount/currency fields for both the > > incoming and original payment of which we can extract the exchange > > rate > > used. > > > > In this case no conversion of any document is required, no entry in > > the > > exchange table is required and we keep all amounts in the ledger > > obviously in the companies base currency.... > > > > let me know if i am right on this. > > > > Regards, > > Hans > > > > > > On Mon, 2008-09-29 at 14:28 +0200, Jacopo Cappellato wrote: > >> ..... > >> > >> There is already support for this in OFBiz: accounting transactions > >> originated by events in different currencies from the one of GL are > >> automatically converted using the currency exchange rate of the date > >> of the transaction. > > > > -- > > Antwebsystems.com: Quality OFBiz services for competitive prices > > > Antwebsystems.com: Quality OFBiz services for competitive prices |
Administrator
|
In reply to this post by Jacques Le Roux
Done
Jacques From: "Jacques Le Roux" <[hidden email]> > Thanks Jacopo, > > I think I will make a FAQ for that... > > Jacques > > From: "Jacopo Cappellato" <[hidden email]> >> >> On Sep 30, 2008, at 5:28 AM, Hans Bakker wrote: >> >>> Hi Jacopo, >>> >>> the point below is very important, does it mean the ledger posting is >>> checking the company base currency against the invoices and payments and >>> convert where required? >> >> Yes, >> >> the "company base currency" is set in the PartyAccountingPref (sorry, I don't remember the name exactly) and you have to enter a >> record in the CurrencyUomDated entity. >> If this information is available then you'll notice that the AcctgTransEntry will have two different amounts in the fields: >> amount/currencyUomId >> and >> origAmount/origCurrencyUomId >> >> You can also test it creating a manual transaction. >> >> Hope it helps, >> >> Jacopo >> >>> >>> >>> On the payment we have the payment amount/currency fields for both the >>> incoming and original payment of which we can extract the exchange rate >>> used. >>> >>> In this case no conversion of any document is required, no entry in the >>> exchange table is required and we keep all amounts in the ledger >>> obviously in the companies base currency.... >>> >>> let me know if i am right on this. >>> >>> Regards, >>> Hans >>> >>> >>> On Mon, 2008-09-29 at 14:28 +0200, Jacopo Cappellato wrote: >>>> ..... >>>> >>>> There is already support for this in OFBiz: accounting transactions >>>> originated by events in different currencies from the one of GL are >>>> automatically converted using the currency exchange rate of the date >>>> of the transaction. >>> >>> -- >>> Antwebsystems.com: Quality OFBiz services for competitive prices >>> >> > |
Free forum by Nabble | Edit this page |