Author: hansbak
Date: Thu Sep  4 22:41:52 2008
New Revision: 692339

URL: http://svn.apache.org/viewvc?rev=692339&view=rev
Log:
show invoice in foreign currency properly

Modified:
    
ofbiz/trunk/specialpurpose/mypage/webapp/mypage/WEB-INF/actions/ConvertInvoiceCurrency.groovy
    ofbiz/trunk/specialpurpose/mypage/widget/MyPageScreens.xml

Modified: 
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=692339&r1=692338&r2=692339&view=diff
==============================================================================
--- 
ofbiz/trunk/specialpurpose/mypage/webapp/mypage/WEB-INF/actions/ConvertInvoiceCurrency.groovy
 (original)
+++ 
ofbiz/trunk/specialpurpose/mypage/webapp/mypage/WEB-INF/actions/ConvertInvoiceCurrency.groovy
 Thu Sep  4 22:41:52 2008
@@ -38,7 +38,8 @@
   } else {
     otherCurrency = delegator.findByPrimaryKey("Party", ["partyId" : 
fromPartyId]).preferredCurrencyUomId;
   }
-  if (otherCurrency && currencyUomId && !otherCurrency.equals(currencyUomId)) {
+  // check if conversion required
+  if (currencyUomId && otherCurrency != currencyUomId && 
!otherCurrency.equals(currencyUomId)) {
     result = dispatcher.runSync("convertUom", [uomId : currencyUomId, 
                                                uomIdTo : otherCurrency, 
                                                originalValue : new 
Double("1.00"), 
@@ -49,4 +50,7 @@
         context.amountToApply = 
org.ofbiz.accounting.invoice.InvoiceWorker.getInvoiceNotApplied(delegator,invoiceId).multiply(new
 BigDecimal(result.convertedValue.toString())).setScale(decimals, rounding);
         context.currencyUomId = otherCurrency;
     }
+  } else {
+      context.total = 
(org.ofbiz.accounting.invoice.InvoiceWorker.getInvoiceTotalBd(delegator,invoiceId));
 
+      context.amountToApply = 
org.ofbiz.accounting.invoice.InvoiceWorker.getInvoiceNotApplied(delegator,invoiceId);
   }

Modified: ofbiz/trunk/specialpurpose/mypage/widget/MyPageScreens.xml
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/mypage/widget/MyPageScreens.xml?rev=692339&r1=692338&r2=692339&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/mypage/widget/MyPageScreens.xml (original)
+++ ofbiz/trunk/specialpurpose/mypage/widget/MyPageScreens.xml Thu Sep  4 
22:41:52 2008
@@ -468,12 +468,13 @@
                     <condition-list combine="and">
                         <condition-expr field-name="partyId" operator="equals" 
env-name="myCompanyId"/>
                         <condition-list combine="or">
-                            <condition-expr field-name="statusId" 
operator="equals" value="APPROVED"/>
-                            <condition-expr field-name="statusId" 
operator="equals" value="SEND"/>
-                            <condition-expr field-name="statusId" 
operator="equals" value="READY"/>
-                            <condition-expr field-name="statusId" 
operator="equals" value="PAID"/>
+                            <condition-expr field-name="statusId" 
operator="equals" value="INVOICE_APPROVED"/>
+                            <condition-expr field-name="statusId" 
operator="equals" value="INVOICE_SEND"/>
+                            <condition-expr field-name="statusId" 
operator="equals" value="INVOICE_READY"/>
+                            <condition-expr field-name="statusId" 
operator="equals" value="INVOICE_PAID"/>
                         </condition-list>
                     </condition-list>
+                    <order-by field-name="invoiceDate DESC"/>
                 </entity-condition>
             </actions>
             <widgets>


Reply via email to