Author: apatel
Date: Mon Sep 27 23:27:47 2010
New Revision: 1001962

URL: http://svn.apache.org/viewvc?rev=1001962&view=rev
Log:
Bug fix in GL posting of purchase invoice. Don't add add entry for tax that was 
not on invoice.

Modified:
    
ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/ledger/GeneralLedgerServices.xml

Modified: 
ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/ledger/GeneralLedgerServices.xml
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/ledger/GeneralLedgerServices.xml?rev=1001962&r1=1001961&r2=1001962&view=diff
==============================================================================
--- 
ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/ledger/GeneralLedgerServices.xml
 (original)
+++ 
ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/ledger/GeneralLedgerServices.xml
 Mon Sep 27 23:27:47 2010
@@ -2127,18 +2127,26 @@ under the License.
                 </iterate>
             </iterate-map>
             <!-- Another entry for tax not attributed to a taxAuthPartyId -->
-            <clear-field field="debitEntry"/>
-            <make-value entity-name="AcctgTransEntry" 
value-field="debitEntry"/>
-            <set field="debitEntry.debitCreditFlag" value="D"/>
-            <set field="debitEntry.organizationPartyId" 
from-field="invoice.partyId"/>
             <call-class-method method-name="getInvoiceUnattributedTaxTotal" 
class-name="org.ofbiz.accounting.invoice.InvoiceWorker"
                     ret-field="taxAmount">
                 <field field="invoice" type="GenericValue"/>
             </call-class-method>
-            <set field="debitEntry.origAmount" from-field="taxAmount"/>
-            <set field="debitEntry.origCurrencyUomId" 
from-field="invoice.currencyUomId"/>
-            <set field="acctgTransEntries[]" from-field="debitEntry" 
type="Object"/>
-
+            <if>
+                <condition>
+                    <and>
+                        <if-compare field="taxAmount" operator="greater" 
value="0" type="BigDecimal"/>
+                    </and>
+                </condition>
+                <then>
+                    <clear-field field="debitEntry"/>
+                    <make-value entity-name="AcctgTransEntry" 
value-field="debitEntry"/>
+                    <set field="debitEntry.debitCreditFlag" value="D"/>
+                    <set field="debitEntry.organizationPartyId" 
from-field="invoice.partyId"/>
+                    <set field="debitEntry.origAmount" from-field="taxAmount"/>
+                    <set field="debitEntry.origCurrencyUomId" 
from-field="invoice.currencyUomId"/>
+                    <set field="acctgTransEntries[]" from-field="debitEntry" 
type="Object"/>
+                </then>
+            </if>               
             <!-- Credit -->
             <make-value entity-name="AcctgTransEntry" 
value-field="creditEntry"/>
             <set field="creditEntry.debitCreditFlag" value="C"/>


Reply via email to