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 2014/07/30 08:59:17 UTC

svn commit: r1614562 - in /ofbiz/trunk/applications/accounting/webapp/accounting: WEB-INF/actions/invoice/ invoice/

Author: jleroux
Date: Wed Jul 30 06:59:17 2014
New Revision: 1614562

URL: http://svn.apache.org/r1614562
Log:
In accounting, replaces billingParty by billToParty which is more clear (actually billingParty was a wrong name)
Introduces a billToPartyTaxId, this is now mandatory in at least France for VAT (http://vosdroits.service-public.fr/professionnels-entreprises/F31808.xhtml), and might exist in other countries as well

Modified:
    ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/EditInvoice.groovy
    ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/PrintInvoices.groovy
    ofbiz/trunk/applications/accounting/webapp/accounting/invoice/PrintInvoices.fo.ftl
    ofbiz/trunk/applications/accounting/webapp/accounting/invoice/invoiceReportContactMechs.fo.ftl
    ofbiz/trunk/applications/accounting/webapp/accounting/invoice/invoiceReportHeaderInfo.fo.ftl

Modified: ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/EditInvoice.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/EditInvoice.groovy?rev=1614562&r1=1614561&r2=1614562&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/EditInvoice.groovy (original)
+++ ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/EditInvoice.groovy Wed Jul 30 06:59:17 2014
@@ -56,8 +56,8 @@ if (invoice) {
     if (billingAddress) {
         context.billingAddress = billingAddress;
     }
-    billingParty = InvoiceWorker.getBillToParty(invoice);
-    context.billingParty = billingParty;
+    billToParty = InvoiceWorker.getBillToParty(invoice);
+    context.billToParty = billToParty;
     sendingParty = InvoiceWorker.getSendFromParty(invoice);
     context.sendingParty = sendingParty;
 
@@ -77,10 +77,15 @@ if (invoice) {
         // also create a map with tax grand total amount by VAT tax: it is also required in invoices by UE
         taxRate = invoiceItem.getRelatedOne("TaxAuthorityRateProduct", false);
         if (taxRate && "VAT_TAX".equals(taxRate.taxAuthorityRateTypeId)) {
-            taxInfos = EntityUtil.filterByDate(delegator.findByAnd("PartyTaxAuthInfo", [partyId : billingParty.partyId, taxAuthGeoId : taxRate.taxAuthGeoId, taxAuthPartyId : taxRate.taxAuthPartyId], null, false), invoice.invoiceDate);
+            taxInfos = EntityUtil.filterByDate(delegator.findByAnd("PartyTaxAuthInfo", [partyId : billToParty.partyId, taxAuthGeoId : taxRate.taxAuthGeoId, taxAuthPartyId : taxRate.taxAuthPartyId], null, false), invoice.invoiceDate);
             taxInfo = EntityUtil.getFirst(taxInfos);
             if (taxInfo) {
-                context.billingPartyTaxId = taxInfo.partyTaxId;
+                context.billToPartyTaxId = taxInfo.partyTaxId;
+            }
+            taxInfos = EntityUtil.filterByDate(delegator.findByAnd("PartyTaxAuthInfo", [partyId : sendingParty.partyId, taxAuthGeoId : taxRate.taxAuthGeoId, taxAuthPartyId : taxRate.taxAuthPartyId], null, false), invoice.invoiceDate);
+            taxInfo = EntityUtil.getFirst(taxInfos);
+            if (taxInfo) {
+                context.sendingPartyTaxId = taxInfo.partyTaxId;
             }
             vatTaxesByTypeAmount = vatTaxesByType[taxRate.taxAuthorityRateSeqId];
             if (!vatTaxesByTypeAmount) {
@@ -102,9 +107,9 @@ if (invoice) {
                 //*________________this snippet was added for adding Tax ID in invoice header if needed _________________
 
                sendingTaxInfos = sendingParty.getRelated("PartyTaxAuthInfo", null, null, false);
-               billingTaxInfos = billingParty.getRelated("PartyTaxAuthInfo", null, null, false);
+               billingTaxInfos = billToParty.getRelated("PartyTaxAuthInfo", null, null, false);
                sendingPartyTaxId = null;
-               billingPartyTaxId = null;
+               billToPartyTaxId = null;
 
                if (billingAddress) {
                    sendingTaxInfos.eachWithIndex { sendingTaxInfo, i ->
@@ -114,15 +119,15 @@ if (invoice) {
                    }
                    billingTaxInfos.eachWithIndex { billingTaxInfo, i ->
                        if (billingTaxInfo.taxAuthGeoId.equals(billingAddress.countryGeoId)) {
-                            billingPartyTaxId = billingTaxInfos[i-1].partyTaxId;
+                            billToPartyTaxId = billingTaxInfos[i-1].partyTaxId;
                        }
                    }
                }
                if (sendingPartyTaxId) {
                    context.sendingPartyTaxId = sendingPartyTaxId;
                }
-               if (billingPartyTaxId && !context.billingPartyTaxId) {
-                   context.billingPartyTaxId = billingPartyTaxId;
+               if (billToPartyTaxId && !context.billToPartyTaxId) {
+                   context.billToPartyTaxId = billToPartyTaxId;
                }
                //________________this snippet was added for adding Tax ID in invoice header if needed _________________*/
 

Modified: ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/PrintInvoices.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/PrintInvoices.groovy?rev=1614562&r1=1614561&r2=1614562&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/PrintInvoices.groovy (original)
+++ ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/PrintInvoices.groovy Wed Jul 30 06:59:17 2014
@@ -65,16 +65,16 @@ invoiceIds.each { invoiceId ->
         if (billingAddress) {
             invoicesMap.billingAddress = billingAddress;
         }
-        billingParty = InvoiceWorker.getBillToParty(invoice);
-        invoicesMap.billingParty = billingParty;
+        billToParty = InvoiceWorker.getBillToParty(invoice);
+        invoicesMap.billToParty = billToParty;
         sendingParty = InvoiceWorker.getSendFromParty(invoice);
         invoicesMap.sendingParty = sendingParty;
 
         // This snippet was added for adding Tax ID in invoice header if needed 
         sendingTaxInfos = sendingParty.getRelated("PartyTaxAuthInfo", null, null, false);
-        billingTaxInfos = billingParty.getRelated("PartyTaxAuthInfo", null, null, false);
+        billingTaxInfos = billToParty.getRelated("PartyTaxAuthInfo", null, null, false);
         sendingPartyTaxId = null;
-        billingPartyTaxId = null;
+        billToPartyTaxId = null;
 
         if (billingAddress) {
             sendingTaxInfos.eachWithIndex { sendingTaxInfo, i ->
@@ -84,15 +84,15 @@ invoiceIds.each { invoiceId ->
             }
             billingTaxInfos.eachWithIndex { billingTaxInfo, i ->
                 if (billingTaxInfo.taxAuthGeoId.equals(billingAddress.countryGeoId)) {
-                     billingPartyTaxId = billingTaxInfos[i-1].partyTaxId;
+                     billToPartyTaxId = billingTaxInfos[i-1].partyTaxId;
                 }
             }
         }
         if (sendingPartyTaxId) {
             invoicesMap.sendingPartyTaxId = sendingPartyTaxId;
         }
-        if (billingPartyTaxId) {
-            invoicesMap.billingPartyTaxId = billingPartyTaxId;
+        if (billToPartyTaxId) {
+            invoicesMap.billToPartyTaxId = billToPartyTaxId;
         }
     
         terms = invoice.getRelated("InvoiceTerm", null, null, false);

Modified: ofbiz/trunk/applications/accounting/webapp/accounting/invoice/PrintInvoices.fo.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/accounting/invoice/PrintInvoices.fo.ftl?rev=1614562&r1=1614561&r2=1614562&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/webapp/accounting/invoice/PrintInvoices.fo.ftl (original)
+++ ofbiz/trunk/applications/accounting/webapp/accounting/invoice/PrintInvoices.fo.ftl Wed Jul 30 06:59:17 2014
@@ -30,9 +30,9 @@ under the License.
     <#if invoiceDetailList?has_content>
       <#list invoiceDetailList as invoiceDetail>
         <#assign invoice = invoiceDetail.invoice />
-        <#if invoiceDetail.billingParty?has_content>
-          <#assign billingParty = invoiceDetail.billingParty />
-          <#assign partyName = delegator.findOne("PartyNameView", {"partyId" : billingParty.partyId}, true)>
+        <#if invoiceDetail.billToParty?has_content>
+          <#assign billToParty = invoiceDetail.billToParty />
+          <#assign partyName = delegator.findOne("PartyNameView", {"partyId" : billToParty.partyId}, true)>
         </#if>
         <fo:page-sequence master-reference="main">
           <fo:flow flow-name="xsl-region-body" font-family="Helvetica">
@@ -70,10 +70,10 @@ under the License.
                                 </fo:block>
                               </fo:table-cell>
                             </fo:table-row>
-                            <#if invoiceDetail.billingPartyTaxId?has_content>
+                            <#if invoiceDetail.billToPartyTaxId?has_content>
                               <fo:table-row>
                                 <fo:table-cell><fo:block>${uiLabelMap.PartyTaxId}:</fo:block></fo:table-cell>
-                                <fo:table-cell><fo:block> ${invoiceDetail.billingPartyTaxId}</fo:block></fo:table-cell>
+                                <fo:table-cell><fo:block> ${invoiceDetail.billToPartyTaxId}</fo:block></fo:table-cell>
                               </fo:table-row>
                             </#if>
                             <fo:table-row>
@@ -95,7 +95,7 @@ under the License.
               </fo:table>
             </fo:block>
               
-            <#if billingParty?has_content>
+            <#if billToParty?has_content>
               <fo:block>
                 <fo:table width="100%" table-layout="fixed" space-after="0.3in">
                   <fo:table-column column-width="3.5in"/>
@@ -105,8 +105,8 @@ under the License.
                         <fo:block>${uiLabelMap.CommonTo}: </fo:block>
                         <#if invoiceDetail.billingAddress?has_content>
                           <#assign billingAddress = invoiceDetail.billingAddress />
-                          <#assign billingPartyNameResult = dispatcher.runSync("getPartyNameForDate", Static["org.ofbiz.base.util.UtilMisc"].toMap("partyId", billingParty.partyId, "compareDate", invoice.invoiceDate, "userLogin", userLogin))/>
-                          <fo:block>${billingPartyNameResult.fullName?default(billingAddress.toName)?default("Billing Name Not Found")}</fo:block>
+                          <#assign billToPartyNameResult = dispatcher.runSync("getPartyNameForDate", Static["org.ofbiz.base.util.UtilMisc"].toMap("partyId", billToParty.partyId, "compareDate", invoice.invoiceDate, "userLogin", userLogin))/>
+                          <fo:block>${billToPartyNameResult.fullName?default(billingAddress.toName)?default("Billing Name Not Found")}</fo:block>
                           <#if billingAddress.attnName?exists>
                             <fo:block>${billingAddress.attnName}</fo:block>
                           </#if>

Modified: ofbiz/trunk/applications/accounting/webapp/accounting/invoice/invoiceReportContactMechs.fo.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/accounting/invoice/invoiceReportContactMechs.fo.ftl?rev=1614562&r1=1614561&r2=1614562&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/webapp/accounting/invoice/invoiceReportContactMechs.fo.ftl (original)
+++ ofbiz/trunk/applications/accounting/webapp/accounting/invoice/invoiceReportContactMechs.fo.ftl Wed Jul 30 06:59:17 2014
@@ -24,8 +24,8 @@ under the License.
         <fo:table-cell>
                <fo:block>${uiLabelMap.CommonTo}: </fo:block>
        <#if billingAddress?has_content>
-        <#assign billingPartyNameResult = dispatcher.runSync("getPartyNameForDate", Static["org.ofbiz.base.util.UtilMisc"].toMap("partyId", billingParty.partyId, "compareDate", invoice.invoiceDate, "userLogin", userLogin))/>
-        <fo:block>${billingPartyNameResult.fullName?default(billingAddress.toName)?default("Billing Name Not Found")}</fo:block>
+        <#assign billToPartyNameResult = dispatcher.runSync("getPartyNameForDate", Static["org.ofbiz.base.util.UtilMisc"].toMap("partyId", billToParty.partyId, "compareDate", invoice.invoiceDate, "userLogin", userLogin))/>
+        <fo:block>${billToPartyNameResult.fullName?default(billingAddress.toName)?default("Billing Name Not Found")}</fo:block>
         <#if billingAddress.attnName?exists>
             <fo:block>${billingAddress.attnName}</fo:block>
         </#if>
@@ -35,7 +35,7 @@ under the License.
         </#if>
         <fo:block>${billingAddress.city?if_exists} ${billingAddress.stateProvinceGeoId?if_exists} ${billingAddress.postalCode?if_exists}</fo:block>
     <#else>
-        <fo:block>${uiLabelMap.AccountingNoGenBilAddressFound}${billingParty.partyId}</fo:block>
+        <fo:block>${uiLabelMap.AccountingNoGenBilAddressFound}${billToParty.partyId}</fo:block>
     </#if>
         </fo:table-cell>
     </fo:table-row>

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=1614562&r1=1614561&r2=1614562&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/webapp/accounting/invoice/invoiceReportHeaderInfo.fo.ftl (original)
+++ ofbiz/trunk/applications/accounting/webapp/accounting/invoice/invoiceReportHeaderInfo.fo.ftl Wed Jul 30 06:59:17 2014
@@ -18,7 +18,7 @@ under the License.
 -->
 <#escape x as x?xml>
 <fo:table table-layout="fixed" width="100%">
-<fo:table-column column-width="1in"/>
+<fo:table-column column-width="1.5in"/>
 <fo:table-column column-width="2.5in"/>
 <fo:table-body>
 <fo:table-row>
@@ -34,13 +34,20 @@ under the License.
 
 <fo:table-row>
   <fo:table-cell><fo:block>${uiLabelMap.AccountingCustNr}:</fo:block></fo:table-cell>
-  <fo:table-cell><fo:block><#if billingParty?has_content>${billingParty.partyId}</#if></fo:block></fo:table-cell>
+  <fo:table-cell><fo:block><#if billToParty?has_content>${billToParty.partyId}</#if></fo:block></fo:table-cell>
 </fo:table-row>
 
-<#if billingPartyTaxId?has_content>
+<#if sendingPartyTaxId?has_content>
   <fo:table-row>
     <fo:table-cell><fo:block>${uiLabelMap.PartyTaxId}:</fo:block></fo:table-cell>
-    <fo:table-cell><fo:block> ${billingPartyTaxId}</fo:block></fo:table-cell>
+    <fo:table-cell><fo:block> ${billToPartyTaxId}</fo:block></fo:table-cell>
+  </fo:table-row>
+</#if>
+
+<#if billToPartyTaxId?has_content>
+  <fo:table-row>
+    <fo:table-cell><fo:block>${uiLabelMap.PartyClientTaxId}:</fo:block></fo:table-cell>
+    <fo:table-cell><fo:block> ${billToPartyTaxId}</fo:block></fo:table-cell>
   </fo:table-row>
 </#if>