/[papo]/papo/forms/creditNote.neb
ViewVC logotype

Diff of /papo/forms/creditNote.neb

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.14 by apronotti, Mon Jul 14 18:09:33 2003 UTC revision 1.15 by apronotti, Mon Jul 14 19:06:12 2003 UTC
# Line 367  Line 367 
367    <trigger name="totalCalcTrigger" type="NAMED">    <trigger name="totalCalcTrigger" type="NAMED">
368      import hack      import hack
369    
370      lQty = hack.a2f(ownItemBlock.qtyEntry)      lQty = hack.a2f(ownItemBlock.qtyEntry,4)
371      lBonus = hack.a2f(ownItemBlock.bonusEntry)      lBonus = hack.a2f(ownItemBlock.bonusEntry,4)
372      lDiscount = hack.a2f(ownItemBlock.discountEntry)      lDiscount = hack.a2f(ownItemBlock.discountEntry,4)
373      lUnitPrice = hack.a2f(ownItemBlock.unitPriceEntry)      lUnitPrice = hack.a2f(ownItemBlock.unitPriceEntry,4)
374    
375      lItemPrice = (lQty * lUnitPrice) - lBonus - lDiscount      lItemPrice = round((lQty * lUnitPrice) - lBonus - lDiscount,2)
376    
377      sourceCode = str(tmpValuesDataSource.taxSourceCode)      sourceCode = str(tmpValuesDataSource.taxSourceCode)
378      ownIVACond = hack.a2f(tmpValuesDataSource.ownIVACond)      ownIVACond = hack.a2f(tmpValuesDataSource.ownIVACond)
379      alienIVACond = hack.a2f(tmpValuesDataSource.alienIVACond)      alienIVACond = hack.a2f(tmpValuesDataSource.alienIVACond)
380      amount = lItemPrice      amount = lItemPrice
381      taxPercent = hack.a2f(ownItemBlock.ivaEntry)      taxPercent = hack.a2f(ownItemBlock.ivaEntry,4)
382    
383      exec(sourceCode)      exec(sourceCode)
384      ownItemBlock.taxAmountEntry = hack.a2f(graft(ownIVACond,alienIVACond,amount,taxPercent))      ownItemBlock.taxAmountEntry = hack.a2f(graft(ownIVACond,alienIVACond,amount,taxPercent),4)
385      ownItemBlock.itemNetoEntry = lItemPrice      ownItemBlock.itemNetoEntry = lItemPrice
386      ownItemBlock.itemTotalEntry = lItemPrice + hack.a2f(ownItemBlock.taxAmountEntry)      ownItemBlock.itemTotalEntry = round(lItemPrice + hack.a2f(ownItemBlock.taxAmountEntry,4),2)
387    
388      lTNeto = 0      lTNeto = 0
389      lTTax = 0      lTTax = 0
# Line 391  Line 391 
391      lRecords = ownItemDataSource.getRecords()      lRecords = ownItemDataSource.getRecords()
392      for index in range(len(lRecords)):      for index in range(len(lRecords)):
393        lRecord = lRecords[index]        lRecord = lRecords[index]
394        lQty = hack.a2f(lRecord.getField("own_product_item.qty"))        lQty = hack.a2f(lRecord.getField("own_product_item.qty"),4)
395        #print "cantidad: ",lQty        #print "cantidad: ",lQty
396        lBonus = hack.a2f(lRecord.getField("own_item.bonus"))        lBonus = hack.a2f(lRecord.getField("own_item.bonus"),4)
397        lDiscount = hack.a2f(lRecord.getField("own_item.discount"))        lDiscount = hack.a2f(lRecord.getField("own_item.discount"),4)
398        lUnitPrice = hack.a2f(lRecord.getField("own_product_item.unit_price"))        lUnitPrice = hack.a2f(lRecord.getField("own_product_item.unit_price"),4)
399        #lResultSet = priceDataSource.createResultSet({"id":lRecord.getField("own_product_item.price")})        #lResultSet = priceDataSource.createResultSet({"id":lRecord.getField("own_product_item.price")})
400        #if (lResultSet.firstRecord()):        #if (lResultSet.firstRecord()):
401        #lUnitPrice = hack.a2f(lResultSet.current.getField("unit_price"))        #lUnitPrice = hack.a2f(lResultSet.current.getField("unit_price"))
# Line 403  Line 403 
403        #  lUnitPrice = 0        #  lUnitPrice = 0
404        #print "lUnitPrice = ",lUnitPrice        #print "lUnitPrice = ",lUnitPrice
405    
406        lItemPrice = (lQty * lUnitPrice) - lBonus - lDiscount        lItemPrice = round((lQty * lUnitPrice) - lBonus - lDiscount,2)
407        lTNeto += lItemPrice        lTNeto += lItemPrice
408        lTTax += hack.a2f(lRecord.getField("own_item_tax.amount"))        lTTax += hack.a2f(lRecord.getField("own_item_tax.amount"),4)
409    
410        lTTax = round(lTTax,2)
411      ownDocumentBlock.netTotalEntry = str(lTNeto)      ownDocumentBlock.netTotalEntry = str(lTNeto)
412      totalBlock.netoEntry = str(lTNeto)      totalBlock.netoEntry = str(lTNeto)
413      ownDocumentBlock.taxTotalEntry = str(lTTax)      ownDocumentBlock.taxTotalEntry = str(lTTax)
# Line 758  Line 759 
759      ownItemBlock.prodNameSEntry = str(prodResultBlock.prodNameEntry)      ownItemBlock.prodNameSEntry = str(prodResultBlock.prodNameEntry)
760      ownItemBlock.priceEntry = str(prodResultBlock.prodPriceEntry)      ownItemBlock.priceEntry = str(prodResultBlock.prodPriceEntry)
761    
762      prodResultBlock.prodUnitPriceEntry = hack.a2f(prodResultBlock.prodUnitPriceEntry) * \      prodResultBlock.prodUnitPriceEntry = hack.a2f(prodResultBlock.prodUnitPriceEntry,4) * \
763                                           hack.a2f(prodResultBlock.prodCurrencyRateEntry)                                           hack.a2f(prodResultBlock.prodCurrencyRateEntry,4)
764      lItemPrice = hack.a2f(prodResultBlock.prodUnitPriceEntry)*hack.a2f(ownItemBlock.qtyEntry)      lItemPrice = hack.a2f(prodResultBlock.prodUnitPriceEntry)*hack.a2f(ownItemBlock.qtyEntry,2)
765      ownItemBlock.taxAmountEntry = (hack.a2f(prodResultBlock.prodIVATaxEntry)/100) * lItemPrice      ownItemBlock.taxAmountEntry = (hack.a2f(prodResultBlock.prodIVATaxEntry,4)/100) * lItemPrice
766      ownItemBlock.ivaEntry = hack.a2f(prodResultBlock.prodIVATaxEntry)      ownItemBlock.ivaEntry = hack.a2f(prodResultBlock.prodIVATaxEntry,4)
767      ownItemBlock.unitPriceEntry = str(prodResultBlock.prodUnitPriceEntry)      ownItemBlock.unitPriceEntry = hack.a2f(prodResultBlock.prodUnitPriceEntry,4)
768    
769      callTrigger('totalCalcTrigger')      callTrigger('totalCalcTrigger')
770    </trigger>    </trigger>
# Line 792  Line 793 
793    
794      <label name="qtyLbl" text="Cantidad" x="45" y="10"/>      <label name="qtyLbl" text="Cantidad" x="45" y="10"/>
795      <!-- mdione's bookmark -->      <!-- mdione's bookmark -->
796      <entry field="own_product_item.qty" name="qtyEntry" rows="10" typecast="number" displaymask="%0.3f" width="11" x="45" y="11">      <entry field="own_product_item.qty" name="qtyEntry" rows="10" typecast="number" displaymask="%0.4f" width="11" x="45" y="11">
797      <trigger name="qtyEntryPreFocusout" type="PRE-FOCUSOUT" src="totalCalcTrigger" />      <trigger name="qtyEntryPreFocusout" type="PRE-FOCUSOUT" src="totalCalcTrigger" />
798      </entry>      </entry>
799    
800          <label name="priceLbl" text="Precio" x="56" y="10"/>          <label name="priceLbl" text="Precio" x="56" y="10"/>
801          <entry x="56" y="11" name="unitPriceEntry" field="own_product_item.unit_price" width="10" rows="10" typecast="number" displaymask="%0.2f">          <entry x="56" y="11" name="unitPriceEntry" field="own_product_item.unit_price" width="10" rows="10" typecast="number" displaymask="%0.4f">
802            <trigger name="unitPriceEntryPreFocusout" type="PRE-FOCUSOUT" src="totalCalcTrigger" />            <trigger name="unitPriceEntryPreFocusout" type="PRE-FOCUSOUT" src="totalCalcTrigger" />
803          </entry>          </entry>
804          <entry x="1" y="14" readonly="" field="own_product_item.price" name="priceEntry" width="10" rows="5" hidden=""/>          <entry x="1" y="14" readonly="" field="own_product_item.price" name="priceEntry" width="10" rows="5" hidden=""/>

Legend:
Removed from v.1.14  
changed lines
  Added in v.1.15

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26