Author: jleroux Date: Fri Oct 6 09:30:40 2006 New Revision: 453663 URL: http://svn.apache.org/viewvc?view=rev&rev=453663 Log: A patch from Eriks Dobelis : "Adding Tax ID in invoice header" (https://issues.apache.org/jira/browse/OFBIZ-362).
Tested in simple case, works well. Thanks Eriks Modified: incubator/ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/editInvoice.bsh incubator/ofbiz/trunk/applications/accounting/webapp/accounting/invoice/viewInvoice.fo.ftl incubator/ofbiz/trunk/applications/order/webapp/ordermgr/order/companyHeader.fo.ftl Modified: incubator/ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/editInvoice.bsh URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/editInvoice.bsh?view=diff&rev=453663&r1=453662&r2=453663 ============================================================================== --- incubator/ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/editInvoice.bsh (original) +++ incubator/ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/editInvoice.bsh Fri Oct 6 09:30:40 2006 @@ -20,6 +20,7 @@ import org.ofbiz.base.util.collections.*; import org.ofbiz.accounting.invoice.*; import java.text.DateFormat; +import java.text.SimpleDateFormat; // delegator = parameters.get("delegator"); invoiceId = parameters.get("invoiceId"); @@ -51,7 +52,30 @@ context.put("billingParty", billingParty); sendingParty = InvoiceWorker.getSendFromParty(invoice); context.put("sendingParty", sendingParty); - + + sendingTaxInfos=sendingParty.getRelated("PartyTaxAuthInfo"); + billingTaxInfos=billingParty.getRelated("PartyTaxAuthInfo"); + sendingPartyTaxId=null; + billingPartyTaxId=null; + + if (billingAddress != null) { + for (Iterator i=sendingTaxInfos.iterator();i.hasNext();) { + if (i.next().get("taxAuthGeoId").equals(billingAddress.get("countryGeoId"))) { + sendingPartyTaxId=sendingTaxInfos.get(i.previousIndex()).get("partyTaxId"); + } + } + for (i=billingTaxInfos.iterator(); i.hasNext(); ) { + if (i.next().get("taxAuthGeoId").equals(billingAddress.get("countryGeoId"))) { + billingPartyTaxId=billingTaxInfos.get(i.previousIndex()).get("partyTaxId"); + } + } + } + if (sendingPartyTaxId != null ) { + context.put("sendingPartyTaxId",sendingPartyTaxId); + } + if (billingPartyTaxId != null ) { + context.put("billingPartyTaxId",billingPartyTaxId); + } terms = invoice.getRelated("InvoiceTerm"); context.put("terms", terms); Modified: incubator/ofbiz/trunk/applications/accounting/webapp/accounting/invoice/viewInvoice.fo.ftl URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/accounting/webapp/accounting/invoice/viewInvoice.fo.ftl?view=diff&rev=453663&r1=453662&r2=453663 ============================================================================== --- incubator/ofbiz/trunk/applications/accounting/webapp/accounting/invoice/viewInvoice.fo.ftl (original) +++ incubator/ofbiz/trunk/applications/accounting/webapp/accounting/invoice/viewInvoice.fo.ftl Fri Oct 6 09:30:40 2006 @@ -60,6 +60,9 @@ <#else> <fo:block>${uiLabelMap.AccountingNoGenBilAddressFound}${billingParty.partyId}</fo:block> </#if> + <#if billingPartyTaxId?has_content> + <fo:block>Tax ID: ${billingPartyTaxId}</fo:block> + </#if> </fo:table-cell> <fo:table-cell> <fo:table> Modified: incubator/ofbiz/trunk/applications/order/webapp/ordermgr/order/companyHeader.fo.ftl URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/order/webapp/ordermgr/order/companyHeader.fo.ftl?view=diff&rev=453663&r1=453662&r2=453663 ============================================================================== --- incubator/ofbiz/trunk/applications/order/webapp/ordermgr/order/companyHeader.fo.ftl (original) +++ incubator/ofbiz/trunk/applications/order/webapp/ordermgr/order/companyHeader.fo.ftl Fri Oct 6 09:30:40 2006 @@ -45,6 +45,13 @@ <fo:table-column column-width="15mm"/> <fo:table-column column-width="25mm"/> <fo:table-body> + + <#if sendingPartyTaxId?exists> + <fo:table-row> + <fo:table-cell><fo:block>Tax ID:</fo:block></fo:table-cell> + <fo:table-cell><fo:block>${sendingPartyTaxId}</fo:block></fo:table-cell> + </fo:table-row> + </#if> <#if phone?exists> <fo:table-row>