/[papo]/papo/forms/components/own_document.nebc
ViewVC logotype

Diff of /papo/forms/components/own_document.nebc

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

revision 1.1 by apronotti, Thu Sep 25 20:19:21 2003 UTC revision 1.2 by apronotti, Wed Oct 1 22:10:24 2003 UTC
# Line 5  $document_type_B => '' Line 5  $document_type_B => ''
5  $document_type_C => ''  $document_type_C => ''
6  $stock_alta => ''  $stock_alta => ''
7  $stock_borrado => ''  $stock_borrado => ''
8    $descriptive_item => ''
9  </neb:Vars>  </neb:Vars>
10    
11    <datasource name="tmpValuesDataSource" cache="1"/>    <datasource name="tmpValuesDataSource" cache="1"/>
# Line 320  $stock_borrado => '' Line 321  $stock_borrado => ''
321      </condition>      </condition>
322    </datasource>    </datasource>
323    
324    <neb:Block>if ($descriptive_item) {</neb:Block>
325    <!-- Origen de datos que contiene los items del comprobante -->    <!-- Origen de datos que contiene los items del comprobante -->
326    <datasource  name="ownItemDataSource" database="papo" detaillink="own_item.own_document"    <datasource  name="ownItemDataSource" database="papo" detaillink="own_item.own_document"
327       master="ownDocumentDataSource" masterlink="id"      master="ownDocumentDataSource" masterlink="id"
328       table="own_item, own_product_item">      table="own_item, own_descriptive_item">
329      <condition>    <condition>
330        <and>      <eq>
331          <eq>        <cfield name="own_item.id"/>
332            <cfield name="own_item.id"/>        <cfield name="own_descriptive_item.own_item"/>
333            <cfield name="own_product_item.own_item"/>      </eq>
334          </eq>    </condition>
         <!--  <eq> -->  
         <!--    <cfield name="own_item.id"/> -->  
         <!--    <cfield name="own_item_tax.own_item"/> -->  
         <!--  </eq> -->  
         <!--  <eq> -->  
         <!--            <cfield name="own_item_tax.tax"/> -->  
         <!--            <cconst value="1"/> -->  
         <!--          </eq> -->  
       </and>  
     </condition>  
335    </datasource>    </datasource>
336    <neb:Block>} else {</neb:Block>
337      <!-- Origen de datos que contiene los items descriptivos del comprobante -->
338      <datasource  name="ownItemDataSource" database="papo" detaillink="own_item.own_document"
339        master="ownDocumentDataSource" masterlink="id"
340        table="own_item, own_product_item">
341      <condition>
342        <eq>
343          <cfield name="own_item.id"/>
344          <cfield name="own_product_item.own_item"/>
345        </eq>
346      </condition>
347      </datasource>
348    <neb:Block>}</neb:Block>
349    
350    <!--=== TRIGGERS ===-->    <!--=== TRIGGERS ===-->
351    <trigger name="startUp" type="On-Startup">    <trigger name="startUp" type="On-Startup">
# Line 375  $stock_borrado => '' Line 379  $stock_borrado => ''
379      tmpValuesDataSource.priceWithIva = int(str(ownDocAuxBlock.withIvaEntry))      tmpValuesDataSource.priceWithIva = int(str(ownDocAuxBlock.withIvaEntry))
380    ]]></trigger>    ]]></trigger>
381    
382    
383    <trigger name="setUnitPriceTrigger" type="NAMED">    <trigger name="setUnitPriceTrigger" type="NAMED">
384      import hack      import hack
385    
# Line 382  $stock_borrado => '' Line 387  $stock_borrado => ''
387         len(str(ownItemBlock.unitPriceAuxEntry)) and \         len(str(ownItemBlock.unitPriceAuxEntry)) and \
388         len(str(ownItemBlock.ivaEntry)):         len(str(ownItemBlock.ivaEntry)):
389        if int(str(ownDocAuxBlock.withIvaEntry)):        if int(str(ownDocAuxBlock.withIvaEntry)):
390    <neb:Block>if ($descriptive_item) {</neb:Block>        
391            ownItemBlock.amountEntry = hack.a2f(ownItemBlock.unitPriceAuxEntry,4)/ round(1+hack.a2f(ownItemBlock.ivaEntry,4)/100,4)
392          else:
393            ownItemBlock.amountEntry = str(ownItemBlock.unitPriceAuxEntry)
394    <neb:Block>} else {</neb:Block>
395          ownItemBlock.unitPriceEntry = hack.a2f(ownItemBlock.unitPriceAuxEntry,4)/ round(1+hack.a2f(ownItemBlock.ivaEntry,4)/100,4)          ownItemBlock.unitPriceEntry = hack.a2f(ownItemBlock.unitPriceAuxEntry,4)/ round(1+hack.a2f(ownItemBlock.ivaEntry,4)/100,4)
396        else:        else:
397          ownItemBlock.unitPriceEntry = str(ownItemBlock.unitPriceAuxEntry)          ownItemBlock.unitPriceEntry = str(ownItemBlock.unitPriceAuxEntry)
398    <neb:Block>}</neb:Block>
399    </trigger>    </trigger>
400    
401    <trigger name="recalcTotalTrigger" type="NAMED"><![CDATA[    <trigger name="recalcTotalTrigger" type="NAMED"><![CDATA[
# Line 397  $stock_borrado => '' Line 408  $stock_borrado => ''
408      runForm('client.gfd')      runForm('client.gfd')
409    ]]></trigger>    ]]></trigger>
410    
411    <neb:Block>if (!$descriptive_item) {</neb:Block>
412    <trigger name="prodCallFormTrigger" type="NAMED"><![CDATA[    <trigger name="prodCallFormTrigger" type="NAMED"><![CDATA[
413      runForm('product.gfd')      runForm('product.gfd')
414    ]]></trigger>    ]]></trigger>
415    <neb:Block>}</neb:Block>
416    
417    <trigger name="setInvoiceType" type="NAMED">    <trigger name="setInvoiceType" type="NAMED">
418      invoiceType = str(ownDocumentBlock.invoiceTypeEntry).strip().lower()      invoiceType = str(ownDocumentBlock.invoiceTypeEntry).strip().lower()
# Line 426  $stock_borrado => '' Line 439  $stock_borrado => ''
439    
440    <neb:Sub neb:src="wait.nebc"/>    <neb:Sub neb:src="wait.nebc"/>
441    
442    <trigger name="invoiceOkTrigger" type="NAMED"><![CDATA[    <trigger name="invoiceOkTrigger" type="NAMED">
443    
444      # print "Cantidad de Registros: ", ownItemBlock.getRecordCount()      # print "Cantidad de Registros: ", ownItemBlock.getRecordCount()
445      # print "Leng Product Name: ", len(ownItemBlock.prodNameSEntry)      # print "Leng Product Name: ", len(ownItemBlock.prodNameSEntry)
446    <neb:Block>if ($descriptive_item) {</neb:Block>
447        if ownItemBlock.getRecordCount() > 0 and len(ownItemBlock.descriptiveEntry) > 0:                                  
448    <neb:Block>} else {</neb:Block>
449      if ownItemBlock.getRecordCount() > 0 and len(ownItemBlock.prodNameSEntry) > 0:      if ownItemBlock.getRecordCount() > 0 and len(ownItemBlock.prodNameSEntry) > 0:
450    <neb:Block>}</neb:Block>                                  
451          if not str(ownDocumentBlock.invoiceTypeEntry):          if not str(ownDocumentBlock.invoiceTypeEntry):
452              genericBox("Falta el tipo de comprobante",["Aceptar"])              genericBox("Falta el tipo de comprobante",["Aceptar"])
453          else:          else:
454              setFocus(currencyTypeBlock.currencyBox.payEntry)              setFocus(currencyTypeBlock.currencyBox.payEntry)
455              callTrigger('currencyWorkTrigger')              callTrigger('currencyWorkTrigger')
456    
457    ]]></trigger>    </trigger>
458    
459    <trigger name="commitTrigger" type="NAMED">    <trigger name="commitTrigger" type="NAMED">
460      import hack      import hack
# Line 468  $stock_borrado => '' Line 485  $stock_borrado => ''
485          #lOwnDocId = str(ownDocumentBlock.idEntry)          #lOwnDocId = str(ownDocumentBlock.idEntry)
486          #if stock by invoice          #if stock by invoice
487    
488    <neb:Block>if (!$descriptive_item) {</neb:Block>
489          if  str(ownPosBlock.stockByInvoice) == "1":          if  str(ownPosBlock.stockByInvoice) == "1":
490              print "llamado al trigger"              print "llamado al trigger"
491              callTrigger('<neb:Inline>$stock_alta</neb:Inline>')              callTrigger('<neb:Inline>$stock_alta</neb:Inline>')
492    <neb:Block>}</neb:Block>
493          callTrigger('taxFillTrigger')          callTrigger('taxFillTrigger')
494          ownItemTaxBlock.postChanges()          ownItemTaxBlock.postChanges()
495          ownDocumentTaxTotalBlock.postChanges()          ownDocumentTaxTotalBlock.postChanges()
# Line 486  $stock_borrado => '' Line 505  $stock_borrado => ''
505          raise          raise
506    
507      tmpValuesDataSource.priceWithIva = 0      tmpValuesDataSource.priceWithIva = 0
508      setFocus(ownItemBlock.prodCodeSEntry)      setFocus(ownDocumentBlock.clientRecipientBox.clientCodeEntry)
509    </trigger>    </trigger>
510    
511    <trigger name="rollbackTrigger" type="NAMED">    <trigger name="rollbackTrigger" type="NAMED">
# Line 495  $stock_borrado => '' Line 514  $stock_borrado => ''
514      clear()      clear()
515    
516      tmpBlock.tmpDateEntry = ownDocumentDataSource.getTimeStamp()      tmpBlock.tmpDateEntry = ownDocumentDataSource.getTimeStamp()
517      #setFocus(ownDocumentBlock.clientCodeEntry)      #setFocus(ownDocumentBlock.clientRecipientBox.clientCodeEntry)
518    </trigger>    </trigger>
519    
520    <trigger name="quitTrigger" type="NAMED">    <trigger name="quitTrigger" type="NAMED">
# Line 508  $stock_borrado => '' Line 527  $stock_borrado => ''
527    <trigger name="totalCalcTrigger" type="NAMED">    <trigger name="totalCalcTrigger" type="NAMED">
528      import hack      import hack
529    
530    <neb:Block>if (!$descriptive_item) {</neb:Block>        
531      lQty = hack.a2f(ownItemBlock.qtyEntry,4)      lQty = hack.a2f(ownItemBlock.qtyEntry,4)
532    <neb:Block>}</neb:Block>                                          
533      lBonus = hack.a2f(ownItemBlock.bonusEntry,4)      lBonus = hack.a2f(ownItemBlock.bonusEntry,4)
534      lDiscount = hack.a2f(ownItemBlock.discountEntry,4)      lDiscount = hack.a2f(ownItemBlock.discountEntry,4)
535    <neb:Block>if (!$descriptive_item) {</neb:Block>        
536      lUnitPrice = hack.a2f(ownItemBlock.unitPriceEntry,4)      lUnitPrice = hack.a2f(ownItemBlock.unitPriceEntry,4)
537    <neb:Block>} else {</neb:Block>
538        lUnitPrice = hack.a2f(ownItemBlock.amountEntry,4)
539    <neb:Block>}</neb:Block>
540    
541    <neb:Block>if (!$descriptive_item) {</neb:Block>        
542      lItemPrice = round((lQty * lUnitPrice) - lBonus - lDiscount,2)      lItemPrice = round((lQty * lUnitPrice) - lBonus - lDiscount,2)
543    <neb:Block>} else {</neb:Block>
544        lItemPrice = round(lUnitPrice - lBonus - lDiscount,2)
545    <neb:Block>}</neb:Block>        
546      # lo traigo de tax_formula      # lo traigo de tax_formula
547      #ivaSourceCode = str(tmpValuesDataSource.IVAGraft)      #ivaSourceCode = str(tmpValuesDataSource.IVAGraft)
548    
# Line 556  $stock_borrado => '' Line 584  $stock_borrado => ''
584      lRecords = ownItemDataSource.getRecords()      lRecords = ownItemDataSource.getRecords()
585      for index in range(len(lRecords)):      for index in range(len(lRecords)):
586        lRecord = lRecords[index]        lRecord = lRecords[index]
587    <neb:Block>if (!$descriptive_item) {</neb:Block>        
588        lQty = hack.a2f(lRecord.getField("own_product_item.qty"),4)        lQty = hack.a2f(lRecord.getField("own_product_item.qty"),4)
589    <neb:Block>}</neb:Block>                                              
590        #print "cantidad: ",lQty        #print "cantidad: ",lQty
591        lBonus = hack.a2f(lRecord.getField("own_item.bonus"),4)        lBonus = hack.a2f(lRecord.getField("own_item.bonus"),4)
592        lDiscount = hack.a2f(lRecord.getField("own_item.discount"),4)        lDiscount = hack.a2f(lRecord.getField("own_item.discount"),4)
593        lUnitPrice = hack.a2f(lRecord.getField("own_product_item.unit_price"),4)        lUnitPrice = hack.a2f(lRecord.getField(
594            "<neb:Inline>($descriptive_item) ? 'own_descriptive_item.amount':'own_product_item.unit_price'</neb:Inline>"),4)
595    <neb:Block>if (!$descriptive_item) {</neb:Block>              
596        lItemPrice = round((lQty * lUnitPrice) - lBonus - lDiscount,2)        lItemPrice = round((lQty * lUnitPrice) - lBonus - lDiscount,2)
597    <neb:Block>} else {</neb:Block>
598          lItemPrice = round(lUnitPrice - lBonus - lDiscount,2)
599    <neb:Block>}</neb:Block>
600        lTNeto += lItemPrice        lTNeto += lItemPrice
601        #lTTax += hack.a2f(lRecord.getField("own_item_tax.amount"),4)        #lTTax += hack.a2f(lRecord.getField("own_item_tax.amount"),4)
602    
# Line 899  $stock_borrado => '' Line 934  $stock_borrado => ''
934  <neb:Block>}</neb:Block>      <neb:Block>}</neb:Block>    
935      </box>      </box>
936    
937    <neb:Block>if (!$descriptive_item) {</neb:Block>
938      <!--     ******************************** -->      <!--     ******************************** -->
939      <!--     Búsqueda del producto            -->      <!--     Búsqueda del producto            -->
940      <!--     ******************************** -->      <!--     ******************************** -->
# Line 1102  $stock_borrado => '' Line 1138  $stock_borrado => ''
1138      callTrigger('totalCalcTrigger')      callTrigger('totalCalcTrigger')
1139    </trigger>    </trigger>
1140    <!--     ****** Fin búsqueda ************ -->    <!--     ****** Fin búsqueda ************ -->
1141    <neb:Block>}</neb:Block>
1142    
1143    <block datasource="ownDocumentDataSource" name="ownDocAuxBlock">    <block datasource="ownDocumentDataSource" name="ownDocAuxBlock">
1144          <entry x="62" y="10" name="withIvaEntry" style="checkbox" width="1" default="0">          <entry x="62" y="10" name="withIvaEntry" style="checkbox" width="1" default="0">
1145            <trigger name="withIvaEntryPreFocusout" type="PRE-FOCUSOUT" src="changePriceWithIvaTrigger" />            <trigger name="withIvaEntryPreFocusout" type="PRE-FOCUSOUT" src="changePriceWithIvaTrigger" />
1146          </entry>          </entry>
1147    </block>    </block>
1148                                                                                    
1149    <!--    Esta parte difiere si es un documento con items decriptivos o de a un renglon  -->
1150    <neb:Block>if ($descriptive_item) {</neb:Block>
1151      <block datasource="ownItemDataSource" name="ownItemBlock" restrictInsert="y">
1152          <entry name="ivaRNIAmountEntry" x="1" y ="1" hidden=""/>
1153          <entry name="ivaAmountEntry" x="1" y ="1" hidden=""/>
1154          <entry name="ownItemId" x="1" y ="1" hidden="" field="own_item.id"/>
1155          <label text="Descripción del comprobante" x="1" y="9"/>
1156          <label text="Descripción" x="1" y="10"/>
1157          <entry name="descriptiveEntry" field="own_descriptive_item.description" width="55" x="1" y="11" height="10"/>
1158    
1159            <label name="priceLbl" text="Precio" x="56" y="9"/>
1160            <label name="priceLbl" text="c/iva" x="56" y="10"/>
1161            <entry x="56" y="18" name="unitPriceAuxEntry" width="10"
1162            typecast="number" displaymask="%0.4f">
1163              <trigger name="setUnitPriceAuxEntryPreFocusout" type="PRE-FOCUSOUT" src="setUnitPriceTrigger" />
1164              <trigger name="ivaEntryPreFocusout" type="PRE-FOCUSOUT" src="totalCalcTrigger" />
1165            </entry>
1166            <entry x="56" y="11" name="amountEntry" field="own_descriptive_item.amount" width="10"
1167            typecast="number" displaymask="%0.4f" hidden=""/>
1168            <label name="ivaLbl" text="IVA" x="66" y="10"/>
1169            <entry name="ivaEntry" displaymask="%0.0f"
1170              width="3" x="66" y="18" default="0">
1171              <trigger name="setUnitPriceAuxEntryPreFocusout" type="PRE-FOCUSOUT" src="setUnitPriceTrigger" />
1172              <trigger name="ivaEntryPreFocusout" type="PRE-FOCUSOUT" src="totalCalcTrigger" />
1173            </entry>
1174            <label name="discountLbl" text="Dto." x="70" y="10"/>
1175            <entry field="own_item.discount" name="discountEntry" default="0.00" typecast="number" displaymask="%0.2f"
1176              width="6" x="69" y="18">
1177              <trigger name="discountEntryPreFocusout" type="PRE-FOCUSOUT" src="totalCalcTrigger" />
1178             </entry>
1179            <entry field="own_item.bonus" name="bonusEntry" style="label" default="0.00" typecast="number" displaymask="%0.2f"
1180              width="10" x="79" y="18" hidden=""/>
1181            <label name="itemNetolLbl" text="Neto" x="76" y="10"/>
1182            <entry name="itemNetoEntry" style="label" default="0.00" typecast="number" displaymask="%0.2f"
1183              width="10" x="76" y="18"/>
1184            <label name="itemTotalLbl" text="Total" x="85" y="10"/>
1185            <entry name="itemTotalEntry" style="label" default="0.00" typecast="number" displaymask="%0.2f"
1186              width="10" x="85" y="18">
1187            </entry>
1188    <!--         <button name="prodDeleteButton" trigger="prodDeleteTrigger" label="Borrar" width="7" height="9" x="95" y="11"/> -->
1189            <scrollbar page="5" x="103" y="11" width="1" height="10"/>
1190           </block>
1191    <neb:Block>} else {</neb:Block>
1192    <block datasource="ownItemDataSource" name="ownItemBlock">    <block datasource="ownItemDataSource" name="ownItemBlock">
1193        <entry name="ivaRNIAmountEntry" x="1" y ="1" hidden=""/>        <entry name="ivaRNIAmountEntry" x="1" y ="1" hidden=""/>
1194        <entry name="ivaAmountEntry" x="1" y ="1" hidden=""/>        <entry name="ivaAmountEntry" x="1" y ="1" hidden=""/>
1195        <entry name="ownItemId" x="1" y ="1" hidden="" field="own_item.id"/>        <entry name="ownItemId" x="1" y ="1" hidden="" field="own_item.id"/>
1196        <label text="Productos del comprobante" x="1" y="9"/>        <label text="Productos a facturar" x="1" y="9"/>
1197        <label text="Código" x="1" y="10"/>        <label text="Código" x="1" y="10"/>
1198        <entry name="prodCodeSEntry" width="14" x="1" y="11" rows="9">        <entry name="prodCodeSEntry" width="14" x="1" y="11" rows="9">
1199          <options>          <options>
# Line 1168  $stock_borrado => '' Line 1250  $stock_borrado => ''
1250          <button name="prodDeleteButton" trigger="prodDeleteTrigger" label="Borrar" width="7" height="9" x="95" y="11"/>          <button name="prodDeleteButton" trigger="prodDeleteTrigger" label="Borrar" width="7" height="9" x="95" y="11"/>
1251          <scrollbar page="5" x="103" y="11" width="1" height="10"/>          <scrollbar page="5" x="103" y="11" width="1" height="10"/>
1252         </block>         </block>
1253    <neb:Block>}</neb:Block>
1254    
1255      <neb:Sub neb:src="ownItemTax.nebc"/>    <neb:Sub neb:src="ownItemTax.nebc"/>
1256    
1257        
1258      <!--     Datasource que sirve para almacenar el resultado de la búsqueda -->      <!--     Datasource que sirve para almacenar el resultado de la búsqueda -->
# Line 1269  $stock_borrado => '' Line 1352  $stock_borrado => ''
1352              monto = round(hack.a2f(payBlock.cashEntry,4) / hack.a2f(rs.current.getField("rate"),4),4)              monto = round(hack.a2f(payBlock.cashEntry,4) / hack.a2f(rs.current.getField("rate"),4),4)
1353              currencyTypeBlock.currencyBox.formatEntry = rs.current.getField("format")              currencyTypeBlock.currencyBox.formatEntry = rs.current.getField("format")
1354              currencyTypeBlock.currencyBox.amountEntry = str(currencyTypeBlock.currencyBox.formatEntry) % monto              currencyTypeBlock.currencyBox.amountEntry = str(currencyTypeBlock.currencyBox.formatEntry) % monto
1355              currencyTypeBlock.currencyBox.payEntry = 0.0              currencyTypeBlock.currencyBox.payEntry = ''
1356              more = rs.nextRecord()              more = rs.nextRecord()
1357    
1358          currencyTypeBlock.firstRecord ()          currencyTypeBlock.firstRecord ()
# Line 1392  $stock_borrado => '' Line 1475  $stock_borrado => ''
1475    
1476    <trigger type="NAMED" name="cancelCurrencyTrigger"><![CDATA[    <trigger type="NAMED" name="cancelCurrencyTrigger"><![CDATA[
1477    
1478      setFocus(ownItemBlock.prodCodeSEntry)      setFocus(ownDocumentBlock.clientRecipientBox.clientCodeEntry)
1479    
1480    ]]></trigger>    ]]></trigger>
1481  <!-- recoleccion de datos dispersos -->  <!-- recoleccion de datos dispersos -->
# Line 1414  $stock_borrado => '' Line 1497  $stock_borrado => ''
1497      </block>      </block>
1498    
1499    <!-- pages -->    <!-- pages -->
1500    <page name="Determinación de Monedas">    <page name="Gestión de pago/cobro">
1501    <block name="currencyDataBlock" datasource="dataCurrencyDataSource">    <block name="currencyDataBlock" datasource="dataCurrencyDataSource">
1502      <box height="4" label="Factura de Productos a Clientes"      <box height="4" label="neb:$document_name"
1503        name="recipientBox" width="105" x="0" y="0">        name="recipientBox" width="105" x="0" y="0">
1504        <label  text="Fecha:" x="1" y="1" />        <label  text="Fecha:" x="1" y="1" />
1505        <label  text="Tipo:" x="25" y="1"/>        <label  text="Tipo:" x="25" y="1"/>
# Line 1454  $stock_borrado => '' Line 1537  $stock_borrado => ''
1537          if (recNum > 0):            if (recNum > 0):  
1538                alienDocumentProceedingBlock.nextRecord()                alienDocumentProceedingBlock.nextRecord()
1539          retentionBlock.jumpRecord(recNum)          retentionBlock.jumpRecord(recNum)
1540          print "tipo",type(retentionBlock.idEntry)          #print "tipo",type(retentionBlock.idEntry)
1541          if  str(retentionBlock.idEntry):          if  str(retentionBlock.idEntry):
1542              alienDocumentProceedingBlock.proceedingEntry = str(proceedingBlock.idEntry)              alienDocumentProceedingBlock.proceedingEntry = str(proceedingBlock.idEntry)
1543              alienDocumentProceedingBlock.alienDocumentEntry = str(retentionBlock.idEntry)              alienDocumentProceedingBlock.alienDocumentEntry = str(retentionBlock.idEntry)

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

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