The best practice says to put only those import statements that are
required. -- Ashish Vijaywargiya Indore (M.P), India http://en.wikipedia.org/wiki/Indore On Thu, Aug 28, 2008 at 3:38 PM, <[hidden email]> wrote: > Author: hansbak > Date: Thu Aug 28 03:08:44 2008 > New Revision: 689774 > > URL: http://svn.apache.org/viewvc?rev=689774&view=rev > Log: > show invoices to the customer in local currency > > Added: > > ofbiz/trunk/specialpurpose/mypage/webapp/mypage/WEB-INF/actions/ConvertInvoiceCurrency.groovy > (with props) > Modified: > ofbiz/trunk/specialpurpose/mypage/widget/MyPageForms.xml > ofbiz/trunk/specialpurpose/mypage/widget/MyPageScreens.xml > > Added: > ofbiz/trunk/specialpurpose/mypage/webapp/mypage/WEB-INF/actions/ConvertInvoiceCurrency.groovy > URL: > http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/mypage/webapp/mypage/WEB-INF/actions/ConvertInvoiceCurrency.groovy?rev=689774&view=auto > > ============================================================================== > --- > ofbiz/trunk/specialpurpose/mypage/webapp/mypage/WEB-INF/actions/ConvertInvoiceCurrency.groovy > (added) > +++ > ofbiz/trunk/specialpurpose/mypage/webapp/mypage/WEB-INF/actions/ConvertInvoiceCurrency.groovy > Thu Aug 28 03:08:44 2008 > @@ -0,0 +1,52 @@ > +/* > + * Licensed to the Apache Software Foundation (ASF) under one > + * or more contributor license agreements. See the NOTICE file > + * distributed with this work for additional information > + * regarding copyright ownership. The ASF licenses this file > + * to you under the Apache License, Version 2.0 (the > + * "License"); you may not use this file except in compliance > + * with the License. You may obtain a copy of the License at > + * > + * http://www.apache.org/licenses/LICENSE-2.0 > + * > + * Unless required by applicable law or agreed to in writing, > + * software distributed under the License is distributed on an > + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY > + * KIND, either express or implied. See the License for the > + * specific language governing permissions and limitations > + * under the License. > + */ > + > +import java.util.*; > +import org.ofbiz.entity.*; > +import org.ofbiz.base.util.*; > +import org.ofbiz.base.util.collections.*; > +import org.ofbiz.accounting.invoice.*; > +import java.text.DateFormat; > +import java.text.SimpleDateFormat; > +import java.math.BigDecimal; > +import org.ofbiz.base.util.UtilNumber; > +import javolution.util.FastList; > + > +conversionRate = BigDecimal.ONE; > +ZERO = BigDecimal.ZERO; > +int decimals = UtilNumber.getBigDecimalScale("invoice.decimals"); > +int rounding = UtilNumber.getBigDecimalRoundingMode("invoice.rounding"); > +invoiceType = delegator.findByPrimaryKey("InvoiceType", ["invoiceTypeId" : > invoiceTypeId]); > + if (invoiceType.parentTypeId.equals("SALES_INVOICE")) { > + otherCurrency = delegator.findByPrimaryKey("Party", ["partyId" : > partyId]).preferredCurrencyUomId; > + } else { > + otherCurrency = delegator.findByPrimaryKey("Party", ["partyId" : > fromPartyId]).preferredCurrencyUomId; > + } > + if (otherCurrency && currencyUomId && > !otherCurrency.equals(currencyUomId)) { > + result = dispatcher.runSync("convertUom", [uomId : currencyUomId, > + uomIdTo : otherCurrency, > + originalValue : new > Double("1.00"), > + asOfDate : invoiceDate]); > + > + if (result.convertedValue != null) { > + context.total = > (org.ofbiz.accounting.invoice.InvoiceWorker.getInvoiceTotalBd(delegator,invoiceId)).multiply(new > BigDecimal(result.convertedValue.toString())).setScale(decimals, rounding); > + context.amountToApply = > org.ofbiz.accounting.invoice.InvoiceWorker.getInvoiceNotApplied(delegator,invoiceId).multiply(new > BigDecimal(result.convertedValue.toString())).setScale(decimals, rounding); > + context.currencyUomId = otherCurrency; > + } > + } > > Propchange: > ofbiz/trunk/specialpurpose/mypage/webapp/mypage/WEB-INF/actions/ConvertInvoiceCurrency.groovy > > ------------------------------------------------------------------------------ > svn:eol-style = native > > Propchange: > ofbiz/trunk/specialpurpose/mypage/webapp/mypage/WEB-INF/actions/ConvertInvoiceCurrency.groovy > > ------------------------------------------------------------------------------ > svn:keywords = "Date Rev Author URL Id" > > Propchange: > ofbiz/trunk/specialpurpose/mypage/webapp/mypage/WEB-INF/actions/ConvertInvoiceCurrency.groovy > > ------------------------------------------------------------------------------ > svn:mime-type = text/plain > > Modified: ofbiz/trunk/specialpurpose/mypage/widget/MyPageForms.xml > URL: > http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/mypage/widget/MyPageForms.xml?rev=689774&r1=689773&r2=689774&view=diff > > ============================================================================== > --- ofbiz/trunk/specialpurpose/mypage/widget/MyPageForms.xml (original) > +++ ofbiz/trunk/specialpurpose/mypage/widget/MyPageForms.xml Thu Aug 28 > 03:08:44 2008 > @@ -177,4 +177,13 @@ > <field name="custRequestDate"><ignored/></field> > </form> > > + <form name="ListInvoices" extends="ListInvoices" > extends-resource="component://accounting/webapp/accounting/invoice/InvoiceForms.xml"> > + <row-actions> > + <script > location="component://mypage/webapp/mypage/WEB-INF/actions/ConvertInvoiceCurrency.groovy"/> > + </row-actions> > + <field name="invoiceId" widget-style="buttontext"> > + <hyperlink description="${invoiceId}" > target="invoice.pdf?invoiceId=${invoiceId}&other=Y"/> > + </field> > + </form> > + > </forms> > \ No newline at end of file > > Modified: ofbiz/trunk/specialpurpose/mypage/widget/MyPageScreens.xml > URL: > http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/mypage/widget/MyPageScreens.xml?rev=689774&r1=689773&r2=689774&view=diff > > ============================================================================== > --- ofbiz/trunk/specialpurpose/mypage/widget/MyPageScreens.xml (original) > +++ ofbiz/trunk/specialpurpose/mypage/widget/MyPageScreens.xml Thu Aug 28 > 03:08:44 2008 > @@ -472,7 +472,7 @@ > <decorator-screen name="main-decorator" > location="${parameters.mainDecoratorLocation}"> > <decorator-section name="body"> > <screenlet > title="${uiLabelMap.PageTitleListInvoices}" > navigation-form-name="ListInvoices"> > - <include-form name="ListInvoices" > location="component://accounting/webapp/accounting/invoice/InvoiceForms.xml"/> > + <include-form name="ListInvoices" > location="component://mypage/widget/MyPageForms.xml"/> > </screenlet> > </decorator-section> > </decorator-screen> > > > |
Free forum by Nabble | Edit this page |