/[papo]/papo/forms/productInvoice.gfd
ViewVC logotype

Diff of /papo/forms/productInvoice.gfd

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

revision 1.27 by apronotti, Mon Dec 9 18:01:45 2002 UTC revision 1.28 by apronotti, Wed Dec 11 22:14:43 2002 UTC
# Line 379  Line 379 
379    payBlock.cashEntry = ""    payBlock.cashEntry = ""
380    payBlock.ctaCteEntry = ""    payBlock.ctaCteEntry = ""
381    </trigger>    </trigger>
382    <trigger type="On-Startup">    <trigger name="startUp" type="On-Startup">
383    tmpBlock.tmpDateEntry = ownDocumentDataSource.getTimeStamp()    tmpBlock.tmpDateEntry = ownDocumentDataSource.getTimeStamp()
384    </trigger>    </trigger>
385    
# Line 409  Line 409 
409             else:             else:
410               lUnitPrice = 0               lUnitPrice = 0
411               #print "lUnitPrice = ",lUnitPrice               #print "lUnitPrice = ",lUnitPrice
            lTax = hack.a2f(lRecord.getField("own_item_tax.amount"))  
412    
413             lItemPrice = (lQty * lUnitPrice) - lBonus - lDiscount             lItemPrice = (lQty * lUnitPrice) - lBonus - lDiscount
414             lTNeto = lTNeto + lItemPrice             lTNeto = lTNeto + lItemPrice
415             lTTax = lTTax + lItemPrice * (hack.a2f(lTax)/100)             lTTax += hack.a2f(lRecord.getField("own_item_tax.amount"))
416    
417           totalBlock.netoEntry = str(lTNeto)           totalBlock.netoEntry = str(lTNeto)
418           totalBlock.ivaEntry = str(lTTax)           totalBlock.ivaEntry = str(lTTax)
# Line 525  Line 524 
524                      itemTaxTotal = 0                              itemTaxTotal = 0        
525                      currItem = productInvoiceResultSet.current.getField("own_item.id")                      currItem = productInvoiceResultSet.current.getField("own_item.id")
526                      while productInvoiceResultSet.current.getField("own_item.id") == currItem and more:                      while productInvoiceResultSet.current.getField("own_item.id") == currItem and more:
527                          itemTaxTotal += item * (hack.a2f(productInvoiceResultSet.current.getField("own_item_tax.amount"))/100)                          itemTaxTotal += hack.a2f(productInvoiceResultSet.current.getField("own_item_tax.amount"))
528                          more = productInvoiceResultSet.nextRecord()                          more = productInvoiceResultSet.nextRecord()
529                      invoiceTotal += item + itemTaxTotal                      invoiceTotal += item + itemTaxTotal
530                  # Calcula los impuestos del documento en si                  # Calcula los impuestos del documento en si
# Line 558  Line 557 
557                      while serviceInvoiceResultSet.current.getField ("own_item.id")==currentItem and more:                      while serviceInvoiceResultSet.current.getField ("own_item.id")==currentItem and more:
558                          # calculate the item price exactly as I do in the other trigger                          # calculate the item price exactly as I do in the other trigger
559                          # not revised yet, but I think it was like this                          # not revised yet, but I think it was like this
560                          taxAmount = hack.a2f(serviceInvoiceResultSet.current.getField ("own_item_tax.amount"))                          itemTaxTotal += hack.a2f(serviceInvoiceResultSet.current.getField ("own_item_tax.amount"))
                         itemTaxTotal += round(item * (taxAmount/100), 2)  
561                          more= serviceInvoiceResultSet.nextRecord ()                          more= serviceInvoiceResultSet.nextRecord ()
562                          # print "calc 7: %d:%d" % (item, itemTaxTotal)                          # print "calc 7: %d:%d" % (item, itemTaxTotal)
563    
# Line 665  Line 663 
663      </block>      </block>
664      <!--     Datasource que sirve para almacenar el resultado de la búsqueda -->      <!--     Datasource que sirve para almacenar el resultado de la búsqueda -->
665      <datasource database="papo" name="productResultDataSource"      <datasource database="papo" name="productResultDataSource"
666        table="product_code_type, _product_code_type_data, product_code, _product_code_data, product, _product_data, price, _price_data, price_type, _price_type_data"        table="_product_code_type_data, _product_code_data, _product_data, _product_tax_data, _price_data, _price_type_data"
667        historytable="_product_code_type_data, _product_code_data, _product_data , _price_data, _price_type_data"        order_by = "_product_data.canonical_name, _price_type_data._table desc" >
       order_by = "_product_data.canonical_name,price_type.id desc" >  
668        <condition>        <condition>
669        <and>        <and>
           <eq>  
             <cfield name="product_code_type.id"/>  
             <cfield name="_product_code_type_data._table"/>  
           </eq>  
670            <null>              <null>  
671             <cfield name="_product_code_type_data._end_t"/>             <cfield name="_product_code_type_data._end_t"/>
672            </null>            </null>
           <eq>  
             <cfield name="product_code.id"/>  
             <cfield name="_product_code_data._table"/>  
           </eq>  
673            <null>              <null>  
674              <cfield name="_product_code_data._end_t"/>              <cfield name="_product_code_data._end_t"/>
675            </null>            </null>
           <eq>  
             <cfield name="product.id"/>  
             <cfield name="_product_data._table"/>  
           </eq>  
676            <null>              <null>  
677             <cfield name="_product_data._end_t"/>             <cfield name="_product_data._end_t"/>
678            </null>            </null>
679            <eq>            <null>  
680              <cfield name="price.id"/>             <cfield name="_product_tax_data._end_t"/>
681              <cfield name="_price_data._table"/>            </null>
           </eq>  
682            <null>              <null>  
683              <cfield name="_price_data._end_t"/>              <cfield name="_price_data._end_t"/>
684            </null>            </null>
           <eq>  
             <cfield name="price_type.id"/>  
             <cfield name="_price_type_data._table"/>  
           </eq>  
685            <null>              <null>  
686              <cfield name="_price_type_data._end_t"/>              <cfield name="_price_type_data._end_t"/>
687            </null>            </null>
688            <eq>            <eq>
689              <cfield name="product_code_type.id"/>              <cfield name="_product_code_type_data._table"/>
690              <cfield name="_product_code_data.product_code_type"/>              <cfield name="_product_code_data.product_code_type"/>
691            </eq>            </eq>
692            <eq>            <eq>
693              <cfield name="product.id"/>              <cfield name="_product_data._table"/>
694              <cfield name="_product_code_data.product"/>              <cfield name="_product_code_data.product"/>
695            </eq>            </eq>
696            <eq>            <eq>
697              <cfield name="product.id"/>              <cfield name="_product_data._table"/>
698                <cfield name="_product_tax_data.product"/>
699              </eq>
700              <eq>
701                <cfield name="_product_tax_data.tax"/>
702                <cconst value="1"/> <!-- IVA -->
703              </eq>
704              <eq>
705                <cfield name="_product_data._table"/>
706              <cfield name="_price_data.product"/>              <cfield name="_price_data.product"/>
707            </eq>            </eq>
708            <eq>            <eq>
709              <cfield name="price_type.id"/>              <cfield name="_price_type_data._table"/>
710              <cfield name="_price_data.price_type"/>              <cfield name="_price_data.price_type"/>
711            </eq>            </eq>
712          </and>          </and>
# Line 734  Line 722 
722        <entry name="prodPriceTypeIdEntry" field="_price_type_data._table" x="45" y="1" width="5" rows="2" hidden=""/>        <entry name="prodPriceTypeIdEntry" field="_price_type_data._table" x="45" y="1" width="5" rows="2" hidden=""/>
723        <entry name="prodUnitPriceEntry" field="_price_data.unit_price" x="50" y="1" width="20" rows="2" hidden=""/>        <entry name="prodUnitPriceEntry" field="_price_data.unit_price" x="50" y="1" width="20" rows="2" hidden=""/>
724        <entry name="prodPriceEntry" field="_price_data.id" x="50" y="1" width="20" rows="2" hidden=""/>        <entry name="prodPriceEntry" field="_price_data.id" x="50" y="1" width="20" rows="2" hidden=""/>
725          <entry name="prodIVATaxEntry" field="_product_tax_data.amount" x="50" y="1" width="20" rows="2" hidden=""/>
726      </block>      </block>
727    
728      <trigger name="prodSearchTrigger" type="NAMED">      <trigger name="prodSearchTrigger" type="NAMED">
# Line 769  Line 758 
758                        prodResultBlock.prodPricePreviousEntry= ("%s" %tmpProdResultBlock.prodUnitPriceEntry)                        prodResultBlock.prodPricePreviousEntry= ("%s" %tmpProdResultBlock.prodUnitPriceEntry)
759                        prodResultBlock.prodProductIdEntry= ("%s" %tmpProdResultBlock.prodIdEntry)                        prodResultBlock.prodProductIdEntry= ("%s" %tmpProdResultBlock.prodIdEntry)
760                        prodResultBlock.prodPriceListIdEntry= ("%s" %tmpProdResultBlock.prodPriceTypeIdEntry)                        prodResultBlock.prodPriceListIdEntry= ("%s" %tmpProdResultBlock.prodPriceTypeIdEntry)
761                          prodResultBlock.prodIVATaxEntry= ("%s" %tmpProdResultBlock.prodIVATaxEntry)
762                        prodResultBlock.newRecord()                        prodResultBlock.newRecord()
763                        product_id_anterior=product_id                        product_id_anterior=product_id
764                        break                        break
# Line 795  Line 785 
785      <entry name="prodPricePreviousEntry"  x="1" y="1" width="10" rows="8" hidden=""/>      <entry name="prodPricePreviousEntry"  x="1" y="1" width="10" rows="8" hidden=""/>
786      <entry name="prodProductIdEntry"  x="1" y="1" width="5" rows="8" hidden=""/>      <entry name="prodProductIdEntry"  x="1" y="1" width="5" rows="8" hidden=""/>
787      <entry name="prodPriceListIdEntry"  x="1" y="1" width="5" rows="8" hidden=""/>      <entry name="prodPriceListIdEntry"  x="1" y="1" width="5" rows="8" hidden=""/>
788        <entry name="prodIVATaxEntry"  x="1" y="1" width="5" rows="8" hidden=""/>
789      <scrollbar page="2" x="71" y="11" width="1" height="2"/>      <scrollbar page="2" x="71" y="11" width="1" height="2"/>
790                        
791      <button name="prodInsertButton" trigger="prodInsertTrigger" label="Insertar" width="9" height="1" x="73" y="12"/>      <button name="prodInsertButton" trigger="prodInsertTrigger" label="Insertar" width="9" height="1" x="73" y="12"/>
# Line 815  Line 806 
806        ownItemBlock.productCNameEntry = str(prodResultBlock.prodNameEntry)        ownItemBlock.productCNameEntry = str(prodResultBlock.prodNameEntry)
807        ownItemBlock.priceEntry = str(prodResultBlock.prodPriceEntry)        ownItemBlock.priceEntry = str(prodResultBlock.prodPriceEntry)
808        # *************** Esto del taxAmount hay que verlo ************************        # *************** Esto del taxAmount hay que verlo ************************
809        ownItemBlock.taxAmountEntry = "21"        lItemPrice = hack.a2f(prodResultBlock.prodUnitPriceEntry)*hack.a2f(ownItemBlock.qtyEntry)
810        ownItemBlock.priceWTaxEntry = hack.a2f(prodResultBlock.prodUnitPriceEntry)*hack.a2f(ownItemBlock.qtyEntry)* \        ownItemBlock.taxAmountEntry = (hack.a2f(prodResultBlock.prodIVATaxEntry)/100) * lItemPrice
811                                     (1+hack.a2f(ownItemBlock.taxAmountEntry)/100)        ownItemBlock.priceWTaxEntry = lItemPrice + hack.a2f(ownItemBlock.taxAmountEntry)
812                                      
813        callTrigger('totalCalcTrigger')        callTrigger('totalCalcTrigger')
814    </trigger>    </trigger>
815    <!--     ****** Fin búsqueda ************ -->    <!--     ****** Fin búsqueda ************ -->
# Line 831  Line 823 
823    
824          <label name="qtyLbl" text="Cantidad" x="2" y="1"/>          <label name="qtyLbl" text="Cantidad" x="2" y="1"/>
825          <entry field="own_product_item.qty" value="0" name="qtyEntry" rows="5" typecast="number" width="12" x="2" y="2">          <entry field="own_product_item.qty" value="0" name="qtyEntry" rows="5" typecast="number" width="12" x="2" y="2">
826            <trigger type="PRE-FOCUSOUT" src="totalCalcTrigger" />            <trigger name="qtyEntryPreFocusout" type="PRE-FOCUSOUT" src="totalCalcTrigger" />
827          </entry>          </entry>
828         <label name="productLbl" text="Producto" x="15" y="1"/>         <label name="productLbl" text="Producto" x="15" y="1"/>
829         <entry x="15" y="2" name="productCNameEntry" width="20" rows="5" style="label"/>         <entry x="15" y="2" name="productCNameEntry" width="20" rows="5" style="label"/>
# Line 847  Line 839 
839          <label name="discountLbl" text="Descuento" x="55" y="1"/>          <label name="discountLbl" text="Descuento" x="55" y="1"/>
840          <entry field="own_item.discount" name="discountEntry" value="0" typecast="number"          <entry field="own_item.discount" name="discountEntry" value="0" typecast="number"
841            rows="5" width="10" x="55" y="2">            rows="5" width="10" x="55" y="2">
842            <trigger type="PRE-FOCUSOUT" src="totalCalcTrigger" />            <trigger name="discountEntryPreFocusout" type="PRE-FOCUSOUT" src="totalCalcTrigger" />
843          </entry>          </entry>
844          <label name="bonusLbl" text="Bonificación" x="66" y="1"/>          <label name="bonusLbl" text="Bonificación" x="66" y="1"/>
845          <entry field="own_item.bonus" name="bonusEntry" value="0" typecast="number"          <entry field="own_item.bonus" name="bonusEntry" value="0" typecast="number"
846            rows="5" width="10" x="66" y="2">            rows="5" width="10" x="66" y="2">
847            <trigger type="PRE-FOCUSOUT" src="totalCalcTrigger" />            <trigger name="bonusEntryPreFocusout" type="PRE-FOCUSOUT" src="totalCalcTrigger" />
848          </entry>          </entry>
849          <scrollbar page="5"          <scrollbar page="5"
850            x="79" y="2" width="1" height="5"/>            x="79" y="2" width="1" height="5"/>
# Line 902  Line 894 
894        <block datasource="payDataSource" name="payBlock">        <block datasource="payDataSource" name="payBlock">
895        <label text="Efectivo : " x="1" y="1"/>        <label text="Efectivo : " x="1" y="1"/>
896        <entry name="cashEntry" x="11" y="1" width="12">            <entry name="cashEntry" x="11" y="1" width="12">    
897          <trigger type="Pre-Focusout">          <trigger name="cashEntryPreFocusout" type="Pre-Focusout">
898             import hack             import hack
899             payBlock.ctaCteEntry = str(hack.a2f(totalBlock.totalEntry) - hack.a2f(payBlock.cashEntry))             payBlock.ctaCteEntry = str(hack.a2f(totalBlock.totalEntry) - hack.a2f(payBlock.cashEntry))
900          </trigger>          </trigger>
901        </entry>        </entry>
902        <label text="Cta. Cte. : " x="24" y="1"/>        <label text="Cta. Cte. : " x="24" y="1"/>
903        <entry name="ctaCteEntry" x="36" y="1" width="12">            <entry name="ctaCteEntry" x="36" y="1" width="12">    
904          <trigger type="Pre-Focusout">          <trigger name="ctaCteEntryPreFocusOut" type="Pre-Focusout">
905             import hack             import hack
906             payBlock.cashEntry = str(hack.a2f(totalBlock.totalEntry) - hack.a2f(payBlock.ctaCteEntry))             payBlock.cashEntry = str(hack.a2f(totalBlock.totalEntry) - hack.a2f(payBlock.ctaCteEntry))
907          </trigger>          </trigger>

Legend:
Removed from v.1.27  
changed lines
  Added in v.1.28

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