You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by jl...@apache.org on 2008/01/05 00:06:29 UTC

svn commit: r609049 - in /ofbiz/trunk/applications/accounting/webapp/accounting: WEB-INF/actions/invoice/editInvoice.bsh invoice/invoiceReportHeaderInfo.fo.ftl invoice/invoiceReportItems.fo.ftl

Author: jleroux
Date: Fri Jan  4 15:06:28 2008
New Revision: 609049

URL: http://svn.apache.org/viewvc?rev=609049&view=rev
Log:
Adapted from an old patch from Eriks Dobelis "Adding Tax ID in invoice header" (https://issues.apache.org/jira/browse/OFBIZ-362) - OFBIZ-362
I transposed the line from viewInvoice.fo.ftl into invoiceReportHeaderInfo.fo.ftl

Modified:
    ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/editInvoice.bsh
    ofbiz/trunk/applications/accounting/webapp/accounting/invoice/invoiceReportHeaderInfo.fo.ftl
    ofbiz/trunk/applications/accounting/webapp/accounting/invoice/invoiceReportItems.fo.ftl

Modified: ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/editInvoice.bsh
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/editInvoice.bsh?rev=609049&r1=609048&r2=609049&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/editInvoice.bsh (original)
+++ ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/editInvoice.bsh Fri Jan  4 15:06:28 2008
@@ -41,25 +41,25 @@
 private static int decimals = UtilNumber.getBigDecimalScale("invoice.decimals");
 private static int rounding = UtilNumber.getBigDecimalRoundingMode("invoice.rounding");
 if (other != null && other.equalsIgnoreCase("y")) {
-	otherCurrency = null;
-	if ((invoice.getRelatedOne("InvoiceType")).getString("parentTypeId").equals("SALES_INVOICE")) 
-		otherCurrency = invoice.getRelatedOne("Party").getString("preferredCurrencyUomId");
-	else
-		otherCurrency = invoice.getRelatedOne("FromParty").getString("preferredCurrencyUomId");
-	
-	result = null;
-	if (otherCurrency != null && invoice.get("currencyUomId") != null && !otherCurrency.equals(invoice.getString("currencyUomId"))) {
-		result = dispatcher.runSync("convertUom", UtilMisc.toMap("uomId", invoice.getString("currencyUomId"), "uomIdTo", otherCurrency, "originalValue", 1.00, "asOfDate", invoice.getTimestamp("invoiceDate")));
-		
-		if (result.get("convertedValue") != null) {
-			conversionRate = new BigDecimal(result.get("convertedValue").doubleValue());		
-			invoice.put("invoiceMessage",
-				invoice.get("invoiceMessage") != null? 
-					invoice.getString("invoiceMessage").concat(" Converted from " + invoice.getString("currencyUomId") + " Rate: " + conversionRate.setScale(6, rounding).toString()) :
-					  "Converted from " + invoice.getString("currencyUomId") + " Rate: " + conversionRate.setScale(6, rounding).toString());
-			invoice.put("currencyUomId", otherCurrency);
-		}
-	}
+  otherCurrency = null;
+  if ((invoice.getRelatedOne("InvoiceType")).getString("parentTypeId").equals("SALES_INVOICE")) 
+    otherCurrency = invoice.getRelatedOne("Party").getString("preferredCurrencyUomId");
+  else
+    otherCurrency = invoice.getRelatedOne("FromParty").getString("preferredCurrencyUomId");
+  
+  result = null;
+  if (otherCurrency != null && invoice.get("currencyUomId") != null && !otherCurrency.equals(invoice.getString("currencyUomId"))) {
+    result = dispatcher.runSync("convertUom", UtilMisc.toMap("uomId", invoice.getString("currencyUomId"), "uomIdTo", otherCurrency, "originalValue", 1.00, "asOfDate", invoice.getTimestamp("invoiceDate")));
+    
+    if (result.get("convertedValue") != null) {
+      conversionRate = new BigDecimal(result.get("convertedValue").doubleValue());		
+      invoice.put("invoiceMessage",
+        invoice.get("invoiceMessage") != null? 
+          invoice.getString("invoiceMessage").concat(" Converted from " + invoice.getString("currencyUomId") + " Rate: " + conversionRate.setScale(6, rounding).toString()) :
+            "Converted from " + invoice.getString("currencyUomId") + " Rate: " + conversionRate.setScale(6, rounding).toString());
+      invoice.put("currencyUomId", otherCurrency);
+    }
+  }
 
 }
 
@@ -68,9 +68,9 @@
     invoiceItemsConv = FastList.newInstance();
     Iterator it = invoiceItems.iterator();
     while (it.hasNext()) {
-    	invoiceItem = it.next();
-    	invoiceItem.put("amount", new Double((invoiceItem.getBigDecimal("amount").multiply(conversionRate).setScale(decimals, rounding)).doubleValue()));
-    	invoiceItemsConv.add(invoiceItem);
+      invoiceItem = it.next();
+      invoiceItem.put("amount", new Double((invoiceItem.getBigDecimal("amount").multiply(conversionRate).setScale(decimals, rounding)).doubleValue()));
+      invoiceItemsConv.add(invoiceItem);
     }
     
 
@@ -98,7 +98,7 @@
     sendingParty = InvoiceWorker.getSendFromParty(invoice);
     context.put("sendingParty", sendingParty);
 
-                /*________________this snippet was added for adding Tax ID in invoice header if needed _________________
+                //*________________this snippet was added for adding Tax ID in invoice header if needed _________________
                 
                sendingTaxInfos=sendingParty.getRelated("PartyTaxAuthInfo");
                billingTaxInfos=billingParty.getRelated("PartyTaxAuthInfo");
@@ -123,7 +123,7 @@
                if (billingPartyTaxId != null ) {
                    context.put("billingPartyTaxId",billingPartyTaxId);
                }
-               ________________this snippet was added for adding Tax ID in invoice header if needed _________________*/
+               //________________this snippet was added for adding Tax ID in invoice header if needed _________________*/
    
 
     terms = invoice.getRelated("InvoiceTerm");

Modified: ofbiz/trunk/applications/accounting/webapp/accounting/invoice/invoiceReportHeaderInfo.fo.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/accounting/invoice/invoiceReportHeaderInfo.fo.ftl?rev=609049&r1=609048&r2=609049&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/webapp/accounting/invoice/invoiceReportHeaderInfo.fo.ftl (original)
+++ ofbiz/trunk/applications/accounting/webapp/accounting/invoice/invoiceReportHeaderInfo.fo.ftl Fri Jan  4 15:06:28 2008
@@ -36,6 +36,13 @@
   <fo:table-cell><fo:block>${uiLabelMap.AccountingCustNr}:</fo:block></fo:table-cell>
   <fo:table-cell><fo:block><#if invoice?has_content>${billingParty.partyId}</#if></fo:block></fo:table-cell>
 </fo:table-row>
+
+<#if billingPartyTaxId?has_content>
+  <fo:table-row>
+    <fo:table-cell><fo:block>Tax ID: ${billingPartyTaxId}</fo:block></fo:table-cell>
+  </fo:table-row>
+</#if>
+
 <fo:table-row>
   <fo:table-cell><fo:block>${uiLabelMap.AccountingInvNr}:</fo:block></fo:table-cell>
   <fo:table-cell><fo:block><#if invoice?has_content>${invoice.invoiceId}</#if></fo:block></fo:table-cell>

Modified: ofbiz/trunk/applications/accounting/webapp/accounting/invoice/invoiceReportItems.fo.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/accounting/invoice/invoiceReportItems.fo.ftl?rev=609049&r1=609048&r2=609049&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/webapp/accounting/invoice/invoiceReportItems.fo.ftl (original)
+++ ofbiz/trunk/applications/accounting/webapp/accounting/invoice/invoiceReportItems.fo.ftl Fri Jan  4 15:06:28 2008
@@ -120,10 +120,10 @@
                         <fo:block> ${invoiceItem.invoiceItemSeqId} </fo:block>               
                     </fo:table-cell>    
                     <fo:table-cell>
-                        <fo:block text-align="center">${invoiceItem.productId?if_exists} </fo:block>               
+                        <fo:block text-align="left">${invoiceItem.productId?if_exists} </fo:block>               
                     </fo:table-cell>    
                     <fo:table-cell>
-                        <fo:block>${description?if_exists}</fo:block>               
+                        <fo:block text-align="right">${description?if_exists}</fo:block>               
                     </fo:table-cell>       
                       <fo:table-cell>
                         <fo:block text-align="center"> <#if invoiceItem.quantity?exists>${invoiceItem.quantity?string.number}</#if> </fo:block>