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

Diff of /papo/forms/productInvoice.neb

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

revision 1.19 by mhepp, Mon Jun 2 20:19:25 2003 UTC revision 1.20 by styxman, Mon Jun 2 23:06:06 2003 UTC
# Line 172  Line 172 
172      </condition>      </condition>
173    </datasource>    </datasource>
174    
   <!-- Origen de datos para obtener el total facturado a este cliente (para el calculo del balance de la cta cte) -->  
 <!--   <datasource name="serviceInvoiceTotalDataSource" database="papo" -->  
 <!--     table="_entity_data, own_document, own_item, own_service_item, own_item_tax" -->  
 <!--     order_by="own_service_item.id"> -->  
 <!--     <condition> -->  
 <!--       <and> -->  
 <!--         <eq> -->  
           <!-- Aqui se refiere al cliente  -->  
 <!--           <cfield name="_entity_data.id"/> -->  
 <!--           <cfield name="own_document.recipient"/> -->  
 <!--         </eq> -->  
 <!--         <eq> -->  
 <!--           <cfield name="own_document.id"/> -->  
 <!--           <cfield name="own_item.own_document"/> -->  
 <!--         </eq> -->  
 <!--         <eq> -->  
 <!--           <cfield name="own_item.id"/> -->  
 <!--           <cfield name="own_service_item.own_item"/> -->  
 <!--         </eq> -->  
 <!--         <eq> -->  
 <!--           <cfield name="own_item.id"/> -->  
 <!--           <cfield name="own_item_tax.own_item"/> -->  
 <!--         </eq> -->  
 <!--         <eq> -->  
 <!--           <cfield name="own_document.own_document_type"/> -->  
 <!--      <cconst value="1"/>  -->  
 <!--         </eq> -->  
 <!--      </and> -->  
 <!--     </condition> -->  
 <!--   </datasource> -->  
   
175    <!-- Origen de datos que srive para calcular el total facturado -->    <!-- Origen de datos que srive para calcular el total facturado -->
   
176    <datasource name="productInvoiceTotalDataSource" database="papo"    <datasource name="productInvoiceTotalDataSource" database="papo"
177                table="_entity_data, own_document, own_item, own_product_item, own_item_tax"                table="_entity_data, own_document, own_item, own_product_item, own_item_tax"
178                order_by="own_product_item.id">                order_by="own_product_item.id">
# Line 246  Line 214 
214    </datasource>    </datasource>
215    
216    <!-- Origen de datos que srive para calcular los impuestos del la factura -->    <!-- Origen de datos que srive para calcular los impuestos del la factura -->
   
217    <datasource name="ownDocumentTaxTotDataSource" database="papo"    <datasource name="ownDocumentTaxTotDataSource" database="papo"
218                table="own_document, own_document_tax">                table="own_document, own_document_tax">
219      <condition>      <condition>
# Line 258  Line 225 
225    </datasource>    </datasource>
226    
227    <!-- Origen de datos que srive para calcular el total facturado -->    <!-- Origen de datos que srive para calcular el total facturado -->
   
228    <datasource name="productCreditNoteTotalDataSource" database="papo"    <datasource name="productCreditNoteTotalDataSource" database="papo"
229                table="_entity_data, own_document, own_item, own_product_item, own_item_tax"                table="_entity_data, own_document, own_item, own_product_item, own_item_tax"
230                order_by="own_product_item.id">                order_by="own_product_item.id">
# Line 300  Line 266 
266    </datasource>    </datasource>
267    
268    <!-- Origen de datos que srive para calcular el total adeudado -->    <!-- Origen de datos que srive para calcular el total adeudado -->
   
269    <datasource name="paidTotalDataSource" database="papo" table="_entity_data, own_document, own_document_proceeding">    <datasource name="paidTotalDataSource" database="papo" table="_entity_data, own_document, own_document_proceeding">
270      <condition>      <condition>
271        <and>        <and>
# Line 336  Line 301 
301    <datasource name="priceDataSource" database="papo" table="_price_data" />    <datasource name="priceDataSource" database="papo" table="_price_data" />
302    
303    <!--   Origen de datos que contiene el encabezado de la factura   -->    <!--   Origen de datos que contiene el encabezado de la factura   -->
   
304    <datasource database="papo" name="ownDocumentDataSource" table="own_document"    <datasource database="papo" name="ownDocumentDataSource" table="own_document"
305      order_by="date" />      order_by="date" />
306    
# Line 378  Line 342 
342    </datasource>    </datasource>
343    
344    <!--   Origen de datos que contiene los items de la factura -->    <!--   Origen de datos que contiene los items de la factura -->
345      <datasource  name="ownItemDataSource" database="papo" detaillink="own_item.own_document"
    <datasource  name="ownItemDataSource" database="papo" detaillink="own_item.own_document"  
346       master="ownDocumentDataSource" masterlink="id"       master="ownDocumentDataSource" masterlink="id"
347       table="own_item, own_product_item, own_item_tax">       table="own_item, own_product_item, own_item_tax">
348      <condition>      <condition>
# Line 399  Line 362 
362        </and>        </and>
363      </condition>      </condition>
364    </datasource>    </datasource>
 <!-- se va a stockMaintenance.nebc -->  
 <!--   Origen de datos que sirve para consultar y asi actualizar el stock -->  
   
 <!--   <datasource database="papo" name="ownItemToUpdDataSource" -->  
 <!--     table="own_item, own_product_item, _price_data, _product_store_data"> -->  
 <!--     <condition> -->  
 <!--       <and> -->  
 <!--         <eq> -->  
 <!--           <cfield name="product_store.id"/> -->  
 <!--           <cfield name="_product_store_data._table"/> -->  
 <!--         </eq> -->  
 <!--         <eq> -->  
 <!--           <cfield name="own_item.id"/> -->  
 <!--           <cfield name="own_product_item.own_item"/> -->  
 <!--         </eq> -->  
 <!--         <eq> -->  
 <!--           <cfield name="_price_data.id"/> -->  
 <!--           <cfield name="own_product_item.price"/> -->  
 <!--         </eq> -->  
 <!--         <eq> -->  
 <!--           <cfield name="_price_data.product"/> -->  
 <!--           <cfield name="_product_store_data.product"/> -->  
 <!--         </eq> -->  
 <!--         <null> -->  
 <!--           <cfield name="_product_store_data._end_t"/> -->  
 <!--         </null> -->  
 <!--       </and> -->  
 <!--     </condition> -->  
 <!--   </datasource> -->  
 <!-- /se va a stockMaintenance.nebc -->  
365    
366    <neb:Sub neb:src="datasource.nebc" zot="../zot/PAPO-ER.zot"    <neb:Sub neb:src="datasource.nebc" zot="../zot/PAPO-ER.zot"
367      search="currency_type" database="papo" name="currencyTypeDataSource" />      search="currency_type" database="papo" name="currencyTypeDataSource" />
# Line 453  Line 386 
386    <!-- Origen de datos que sirve para dar de alta pagos con algun tipo de currency -->    <!-- Origen de datos que sirve para dar de alta pagos con algun tipo de currency -->
387    <datasource name="ownDocumentProceedingDataSource" database="papo" table="own_document_proceeding"/>    <datasource name="ownDocumentProceedingDataSource" database="papo" table="own_document_proceeding"/>
388    
389    
390      <!--=== TRIGGERS ===-->
391    <trigger name="clientCallFormTrigger" type="NAMED"><![CDATA[    <trigger name="clientCallFormTrigger" type="NAMED"><![CDATA[
392      runForm('client.gfd')      runForm('client.gfd')
393    ]]></trigger>    ]]></trigger>
# Line 461  Line 396 
396      runForm('product.gfd')      runForm('product.gfd')
397    ]]></trigger>    ]]></trigger>
398    
   <!-- nebulized -->  
 <!-- <trigger name="searchOwnPosData" type="NAMED"> -->  
 <!--  import os -->  
 <!--  try: -->  
 <!--    pos = os.environ['PAPO_POS'] -->  
 <!--  except KeyError: -->  
 <!--    pos = 1 -->  
 <!--  print pos -->  
 <!--  ownPosBlock.initQuery() -->  
 <!--  ownPosBlock.ownPosIdEntry = str(pos) -->  
 <!--  ownPosBlock.processQuery() -->  
 <!-- </trigger> -->  
 <!-- /pos -->  
   
   
 <!--   <trigger name="searchNextInvoiceNumber" type="NAMED"><![CDATA[ -->  
 <!--     import gnue.common.GConditions as GConditions -->  
     
 <!--     condInvoiceNumber = GConditions.GCondition() -->  
   
 <!--     tmpAnd = GConditions.GCand(condInvoiceNumber) -->  
 <!--     eq = GConditions.GCeq(tmpAnd) -->  
 <!--     GConditions.GCField(eq,"_own_pos_document_data.document_type") -->  
 <!--     GConditions.GCConst(eq,str(ownDocumentBlock.typeEntry)) -->  
 <!--     #pos -->  
 <!--     eq1 = GConditions.GCeq(tmpAnd) -->  
 <!--     GConditions.GCField(eq1,"_own_pos_document_data.own_pos") -->  
 <!--     GConditions.GCConst(eq1,str(ownPosBlock.ownPosEntityIdEntry)) -->  
 <!--     #/pos -->  
 <!--     ownPosDocumentDataSource.createResultSet(condInvoiceNumber) -->  
   
 <!--   ]]></trigger> -->  
   <!-- /nebulized -->  
399    <trigger name="setInvoiceType" type="NAMED"><![CDATA[    <trigger name="setInvoiceType" type="NAMED"><![CDATA[
400      invoiceType = str(ownDocumentBlock.invoiceTypeEntry).strip().lower()      invoiceType = str(ownDocumentBlock.invoiceTypeEntry).strip().lower()
401      if invoiceType == 'a':      if invoiceType == 'a':
# Line 512  Line 414 
414        ownDocumentBlock.invoiceTypeEntry = ""        ownDocumentBlock.invoiceTypeEntry = ""
415      else:      else:
416        ownDocumentBlock.invoiceTypeEntry = str(ownDocumentBlock.invoiceTypeEntry).strip().upper()        ownDocumentBlock.invoiceTypeEntry = str(ownDocumentBlock.invoiceTypeEntry).strip().upper()
417      
418      callTrigger('setInvoiceType')      callTrigger('setInvoiceType')
419      callTrigger('searchNextInvoiceNumber')      callTrigger('searchNextInvoiceNumber')
420    ]]></trigger>    ]]></trigger>
# Line 520  Line 422 
422    <neb:Sub neb:src="wait.nebc"/>    <neb:Sub neb:src="wait.nebc"/>
423    
424    <trigger name="invoiceOkTrigger" type="NAMED"><![CDATA[    <trigger name="invoiceOkTrigger" type="NAMED"><![CDATA[
425      
426    # print "Cantidad de Registros: ", ownItemBlock.getRecordCount()      # print "Cantidad de Registros: ", ownItemBlock.getRecordCount()
427    # print "Leng Product Name: ", len(ownItemBlock.prodNameSEntry)      # print "Leng Product Name: ", len(ownItemBlock.prodNameSEntry)
428    if ownItemBlock.getRecordCount() > 0 and len(ownItemBlock.prodNameSEntry) > 0:      if ownItemBlock.getRecordCount() > 0 and len(ownItemBlock.prodNameSEntry) > 0:
429        import hack          import hack
430        lCurrentCredit = round(hack.a2f(tmpValuesDataSource.creditLimitAmount,2) - \          lCurrentCredit = round(hack.a2f(tmpValuesDataSource.creditLimitAmount,2) - \
431                         hack.a2f(ownDocumentBlock.clientRecipientBox.deudaEntry,2),2)                           hack.a2f(ownDocumentBlock.clientRecipientBox.deudaEntry,2),2)
432    
433        if hack.a2f(payBlock.ctaCteEntry,2) > lCurrentCredit:          if hack.a2f(payBlock.ctaCteEntry,2) > lCurrentCredit:
434            genericBox("Esta excedido el Límite de Crédito",["Aceptar"])              genericBox("Esta excedido el Límite de Crédito",["Aceptar"])
435        elif not str(ownDocumentBlock.invoiceTypeEntry):          elif not str(ownDocumentBlock.invoiceTypeEntry):
436            genericBox("Falta el tipo de factura",["Aceptar"])              genericBox("Falta el tipo de factura",["Aceptar"])
437        else:          else:
438            setFocus(currencyTypeBlock.currencyBox.payEntry)              setFocus(currencyTypeBlock.currencyBox.payEntry)
439            callTrigger('currencyWorkTrigger')              callTrigger('currencyWorkTrigger')
440    
441    ]]></trigger>    ]]></trigger>
442    
443    <trigger name="commitTrigger" type="NAMED">    <trigger name="commitTrigger" type="NAMED">
444    import hack      import hack
445      
446    ownDocumentBlock.numberEntry = str(ownPosDocumentBlock.documentNumberEntry)      ownDocumentBlock.numberEntry = str(ownPosDocumentBlock.documentNumberEntry)
447    #cargo pos      #cargo pos
448    ownDocumentBlock.ownPosEntityIdEntry =   str(ownPosBlock.ownPosEntityIdEntry)      ownDocumentBlock.ownPosEntityIdEntry =   str(ownPosBlock.ownPosEntityIdEntry)
449    #/cargo pos      #/cargo pos
450    ownDocumentBlock.dueDateEntry = str(payBlock.dateEntry)      ownDocumentBlock.dueDateEntry = str(payBlock.dateEntry)
451    ownDocumentBlock.dateEntry = str(tmpBlock.tmpDateEntry)      ownDocumentBlock.dateEntry = str(tmpBlock.tmpDateEntry)
452    if len(ownDocumentBlock.dateEntry) == 0:      if len(ownDocumentBlock.dateEntry) == 0:
453        ownDocumentBlock.dateEntry = ownDocumentDataSource.getTimeStamp()          ownDocumentBlock.dateEntry = ownDocumentDataSource.getTimeStamp()
454    
455    proceedingBlock.clear()      proceedingBlock.clear()
456    proceedingBlock.dateEntry = proceedingDataSource.getTimeStamp()      proceedingBlock.dateEntry = proceedingDataSource.getTimeStamp()
457    
458    from gnue.common.GDataObjects import ConnectionError as DBError      from gnue.common.GDataObjects import ConnectionError as DBError
459    try:      try:
460        postChangeAdvance = 0          postChangeAdvance = 0
461        ownDocumentBlock.postChanges()          ownDocumentBlock.postChanges()
462        postChangeAdvance = 1          postChangeAdvance = 1
463        ownPosDocumentBlock.documentNumberEntry.postAtomicModify (lambda x: int(x)+1)          ownPosDocumentBlock.documentNumberEntry.postAtomicModify (lambda x: int(x)+1)
464        postChangeAdvance = 2          postChangeAdvance = 2
465        proceedingBlock.postChanges()          proceedingBlock.postChanges()
466    
467        ownDocumentProceedingBlock.clear()          ownDocumentProceedingBlock.clear()
468        ownDocumentProceedingBlock.proceedingEntry = str(proceedingBlock.idEntry)          ownDocumentProceedingBlock.proceedingEntry = str(proceedingBlock.idEntry)
469        ownDocumentProceedingBlock.ownDocumentEntry = str(ownDocumentBlock.idEntry)          ownDocumentProceedingBlock.ownDocumentEntry = str(ownDocumentBlock.idEntry)
470        ownDocumentProceedingBlock.amountEntry = str(payBlock.cashEntry)          ownDocumentProceedingBlock.amountEntry = str(payBlock.cashEntry)
471        
472        rc = currencyTypeBlock.getRecordCount()          rc = currencyTypeBlock.getRecordCount()
473        for recNum in range(rc):          for recNum in range(rc):
474            currencyTypeBlock.jumpRecord(recNum)              currencyTypeBlock.jumpRecord(recNum)
475            if hack.a2f(currencyTypeBlock.currencyBox.payEntry,2) > 0:              if hack.a2f(currencyTypeBlock.currencyBox.payEntry,2) > 0:
476                if not currencyMovementBlock.getCurrentRecord().isEmpty():                  if not currencyMovementBlock.getCurrentRecord().isEmpty():
477                    currencyMovementBlock.newRecord()                      currencyMovementBlock.newRecord()
478                currencyMovementBlock.proceedingEntry = str(proceedingBlock.idEntry)                  currencyMovementBlock.proceedingEntry = str(proceedingBlock.idEntry)
479                currencyMovementBlock.movementTypeEntry = "" # Revisar com queda esto                  currencyMovementBlock.movementTypeEntry = "" # Revisar com queda esto
480                currencyMovementBlock.currencyTypeEntry = str(currencyTypeBlock.currencyBox.idEntry)                  currencyMovementBlock.currencyTypeEntry = str(currencyTypeBlock.currencyBox.idEntry)
481                currencyMovementBlock.amountEntry = str(round(hack.a2f(currencyTypeBlock.currencyBox.payEntry,2) * hack.a2f(currencyTypeBlock.currencyBox.rateEntry,2),2))                  currencyMovementBlock.amountEntry = str(round(hack.a2f(currencyTypeBlock.currencyBox.payEntry,2) * hack.a2f(currencyTypeBlock.currencyBox.rateEntry,2),2))
482        
483        # Antes de Multimoneda          # Antes de Multimoneda
484        #currencyMovementBlock.clear()          #currencyMovementBlock.clear()
485        #currencyMovementBlock.proceedingEntry = str(proceedingBlock.idEntry)          #currencyMovementBlock.proceedingEntry = str(proceedingBlock.idEntry)
486        #currencyMovementBlock.movementTypeEntry = "" # Revisar com queda esto          #currencyMovementBlock.movementTypeEntry = "" # Revisar com queda esto
487        #currencyMovementBlock.currencyTypeEntry = "1"          #currencyMovementBlock.currencyTypeEntry = "1"
488        #currencyMovementBlock.amountEntry = str(payBlock.cashEntry)          #currencyMovementBlock.amountEntry = str(payBlock.cashEntry)
489    
490        postChangeAdvance = 3          postChangeAdvance = 3
491        ownDocumentProceedingBlock.postChanges()          ownDocumentProceedingBlock.postChanges()
492        postChangeAdvance = 4          postChangeAdvance = 4
493        currencyMovementBlock.postChanges()          currencyMovementBlock.postChanges()
494        postChangeAdvance = 5          postChangeAdvance = 5
495        lOwnDocId = str(ownDocumentBlock.idEntry)          lOwnDocId = str(ownDocumentBlock.idEntry)
496        #if stock by invoice          #if stock by invoice
497          
498        if  str(ownPosBlock.stockByInvoice) == "1":          if  str(ownPosBlock.stockByInvoice) == "1":
499            print "llamado al trigger"              print "llamado al trigger"
500            callTrigger('stockSubstractTrigger')              callTrigger('stockSubstractTrigger')
501            #se va al stockmaintenance.nebc              #se va al stockmaintenance.nebc
502            #ownItemToUpdBlock.initQuery()              #ownItemToUpdBlock.initQuery()
503            #ownItemToUpdBlock.ownDocumentEntry = lOwnDocId              #ownItemToUpdBlock.ownDocumentEntry = lOwnDocId
504            #print "document number",lOwnDocId              #print "document number",lOwnDocId
505            #storehouse              #storehouse
506            #ownItemToUpdBlock.storehouseEntry = str(ownStorehouseBlock.ownStorehouseIdEntry)              #ownItemToUpdBlock.storehouseEntry = str(ownStorehouseBlock.ownStorehouseIdEntry)
507            #/storehouse              #/storehouse
508            #ownItemToUpdBlock.processQuery()              #ownItemToUpdBlock.processQuery()
509            #lRecordCount = ownItemToUpdBlock.getRecordCount()              #lRecordCount = ownItemToUpdBlock.getRecordCount()
510            #for recNum in range(lRecordCount):              #for recNum in range(lRecordCount):
511            #    ownItemToUpdBlock.jumpRecord(recNum)              #    ownItemToUpdBlock.jumpRecord(recNum)
512            #    ownItemToUpdBlock.levelEntry.postAtomicModify(lambda x:x-round(float(str(ownItemToUpdBlock.qtyEntry)),4))              #    ownItemToUpdBlock.levelEntry.postAtomicModify(lambda x:x-round(float(str(ownItemToUpdBlock.qtyEntry)),4))
513            #ownItemToUpdBlock.clear()              #ownItemToUpdBlock.clear()
514            #/if stock by invoice              #/if stock by invoice
515            #/se va al stockmaintenance.nebc              #/se va al stockmaintenance.nebc
516        commitConnection()          commitConnection()
517    except DBError, err:      except DBError, err:
518        rollbackConnection()          rollbackConnection()
519        message = ["la Factura","el número de la Factura","el procedimiento General",          message = ["la Factura","el número de la Factura","el procedimiento General",
520                   "el procedimiento de la Factura","las monedas de pago de la Factura",                    "el procedimiento de la Factura","las monedas de pago de la Factura",
521                   "el stock" ]                    "el stock" ]
522        genericBox("Hay problemas para grabar "+message[postChangeAdvance]+"\n"+str(err),['Aceptar'])          genericBox("Hay problemas para grabar "+message[postChangeAdvance]+"\n"+str(err),['Aceptar'])
523          
524    setFocus(ownItemBlock.prodCodeSEntry)      setFocus(ownItemBlock.prodCodeSEntry)
         
525    </trigger>    </trigger>
526    
527    <trigger name="rollbackTrigger" type="NAMED">    <trigger name="rollbackTrigger" type="NAMED">
528    tmpValuesDataSource.priceTypeId = None      tmpValuesDataSource.priceTypeId = None
529    
530    clear()      clear()
531    
532    tmpBlock.tmpDateEntry = ownDocumentDataSource.getTimeStamp()      tmpBlock.tmpDateEntry = ownDocumentDataSource.getTimeStamp()
533    #setFocus(ownDocumentBlock.clientCodeEntry)      #setFocus(ownDocumentBlock.clientCodeEntry)
534    </trigger>    </trigger>
535    
536    <trigger name="startUp" type="On-Startup">    <trigger name="startUp" type="On-Startup">
537    tmpValuesDataSource.priceTypeId = None      tmpValuesDataSource.priceTypeId = None
538    tmpValuesDataSource.onSwitch = "0"      tmpValuesDataSource.onSwitch = "0"
539    ownOrganizationBlock.clear()      ownOrganizationBlock.clear()
540    ownOrganizationBlock.initQuery()      ownOrganizationBlock.initQuery()
541    ownOrganizationBlock.processQuery()      ownOrganizationBlock.processQuery()
542    tmpValuesDataSource.ownIVACond = str(ownOrganizationBlock.condIVAEntry)      tmpValuesDataSource.ownIVACond = str(ownOrganizationBlock.condIVAEntry)
543    tmpBlock.tmpDateEntry = ownDocumentDataSource.getTimeStamp()      tmpBlock.tmpDateEntry = ownDocumentDataSource.getTimeStamp()
544    </trigger>    </trigger>
545    
546    <trigger name="quitTrigger" type="NAMED">    <trigger name="quitTrigger" type="NAMED">
547    callTrigger('rollbackTrigger')      callTrigger('rollbackTrigger')
548    ownDocumentBlock.clear()      ownDocumentBlock.clear()
549    exit()      exit()
550    </trigger>    </trigger>
551    
552    <!--  Este trigger clacula el total facturado -->    <!--  Este trigger clacula el total facturado -->
# Line 694  Line 595 
595    
596      ownDocumentBlock.netTotalEntry = str(round(lTNeto,2))      ownDocumentBlock.netTotalEntry = str(round(lTNeto,2))
597      totalBlock.netoEntry = str(round(lTNeto,2))      totalBlock.netoEntry = str(round(lTNeto,2))
598      ownDocumentBlock.taxTotalEntry = str(round(lTTax,2))      ownDocumentBlock.taxTotalEntry = str(round(lTTax,2))
599      totalBlock.ivaEntry = str(round(lTTax,2))      totalBlock.ivaEntry = str(round(lTTax,2))
600      totalBlock.totalEntry = str(round(lTNeto+lTTax,2))      totalBlock.totalEntry = str(round(lTNeto+lTTax,2))
601      payBlock.cashEntry = str(round(lTNeto+lTTax,2))      payBlock.cashEntry = str(round(lTNeto+lTTax,2))
# Line 702  Line 603 
603    </trigger>    </trigger>
604    
605    <trigger type="NAMED" name="currencyWorkTrigger"><![CDATA[    <trigger type="NAMED" name="currencyWorkTrigger"><![CDATA[
606  import hack      import hack
607    
608        if hack.a2f(payBlock.cashEntry,2) > 0:
609            currencyTypeBlock.clear()
610            currencyDataBlock.clear()
611    
612            rs = currencyTypeDataSource.createResultSet()
613            client = 0
614            more = rs.firstRecord()
615            while more:
616                if not currencyTypeBlock.getCurrentRecord().isEmpty():
617                    currencyTypeBlock.newRecord()
618                currencyTypeBlock.currencyBox.idEntry = rs.current.getField("_table")
619                currencyTypeBlock.currencyBox.nameEntry = rs.current.getField("name")
620                currencyTypeBlock.currencyBox.rateEntry = hack.a2f(rs.current.getField("rate"),2)
621                monto = round(hack.a2f(payBlock.cashEntry,2) / hack.a2f(rs.current.getField("rate"),2),2)
622                currencyTypeBlock.currencyBox.formatEntry = rs.current.getField("format")
623                currencyTypeBlock.currencyBox.amountEntry = str(currencyTypeBlock.currencyBox.formatEntry) % monto
624                currencyTypeBlock.currencyBox.payEntry = 0.0
625                more = rs.nextRecord()
626    
627            currencyDataBlock.recipientBox.dateEntry = str(tmpBlock.tmpDateEntry)
628            currencyDataBlock.recipientBox.numberEntry = str(ownPosDocumentBlock.documentNumberEntry)
629    
630            currencyDataBlock.clientRecipientBox.clientCodeEntry = str(ownDocumentBlock.clientRecipientBox.clientCodeEntry)
631            currencyDataBlock.clientRecipientBox.clientNameEntry = str(ownDocumentBlock.clientRecipientBox.clientNameEntry)
632            payBlock.dateEntry = str(tmpBlock.tmpDateEntry)
633            currencyDataBlock.clientRecipientBox.totalEntry = str(hack.a2f(payBlock.cashEntry,2))
634    
 if hack.a2f(payBlock.cashEntry,2) > 0:  
     currencyTypeBlock.clear()  
     currencyDataBlock.clear()  
   
     rs = currencyTypeDataSource.createResultSet()  
     client = 0  
     more = rs.firstRecord()  
     while more:  
         if not currencyTypeBlock.getCurrentRecord().isEmpty():  
             currencyTypeBlock.newRecord()  
         currencyTypeBlock.currencyBox.idEntry = rs.current.getField("_table")  
         currencyTypeBlock.currencyBox.nameEntry = rs.current.getField("name")  
         currencyTypeBlock.currencyBox.rateEntry = hack.a2f(rs.current.getField("rate"),2)  
         monto = round(hack.a2f(payBlock.cashEntry,2) / hack.a2f(rs.current.getField("rate"),2),2)  
         currencyTypeBlock.currencyBox.formatEntry = rs.current.getField("format")  
         currencyTypeBlock.currencyBox.amountEntry = str(currencyTypeBlock.currencyBox.formatEntry) % monto  
         currencyTypeBlock.currencyBox.payEntry = 0.0  
         more = rs.nextRecord()  
   
     currencyDataBlock.recipientBox.dateEntry = str(tmpBlock.tmpDateEntry)  
     currencyDataBlock.recipientBox.numberEntry = str(ownPosDocumentBlock.documentNumberEntry)  
       
     currencyDataBlock.clientRecipientBox.clientCodeEntry = str(ownDocumentBlock.clientRecipientBox.clientCodeEntry)  
     currencyDataBlock.clientRecipientBox.clientNameEntry = str(ownDocumentBlock.clientRecipientBox.clientNameEntry)  
     payBlock.dateEntry = str(tmpBlock.tmpDateEntry)  
     currencyDataBlock.clientRecipientBox.totalEntry = str(hack.a2f(payBlock.cashEntry,2))  
       
635      ]]></trigger>      ]]></trigger>
636    
637    <trigger type="NAMED" name="currencyTypeTrigger"><![CDATA[    <trigger type="NAMED" name="currencyTypeTrigger"><![CDATA[
638        import hack
639    
640  import hack      rn= currencyTypeBlock.getCurrentRecordNumber()
641        
642  total = hack.a2f(payBlock.cashEntry,2)      total = hack.a2f(payBlock.cashEntry,2)
643  rc = currencyTypeBlock.getRecordCount()      rc = currencyTypeBlock.getRecordCount()
644  for recNum in range(rc):      for recNum in range(rc):
645      currencyTypeBlock.jumpRecord(recNum)          currencyTypeBlock.jumpRecord(recNum)
646      if hack.a2f(currencyTypeBlock.currencyBox.payEntry,2) > 0:          if hack.a2f(currencyTypeBlock.currencyBox.payEntry,2) > 0:
647          total -= round(hack.a2f(currencyTypeBlock.currencyBox.payEntry,2) * hack.a2f(currencyTypeBlock.currencyBox.rateEntry),2)              total -= round(hack.a2f(currencyTypeBlock.currencyBox.payEntry,2) * hack.a2f(currencyTypeBlock.currencyBox.rateEntry),2)
648    
649  rc = currencyTypeBlock.getRecordCount()      rc = currencyTypeBlock.getRecordCount()
650  for recNum in range(rc):      for recNum in range(rc):
651      currencyTypeBlock.jumpRecord(recNum)          currencyTypeBlock.jumpRecord(recNum)
652      if hack.a2f(currencyTypeBlock.currencyBox.rateEntry,2) > 0:          if hack.a2f(currencyTypeBlock.currencyBox.rateEntry,2) > 0:
653          monto = round(total / hack.a2f(currencyTypeBlock.currencyBox.rateEntry,2),2)              monto = round(total / hack.a2f(currencyTypeBlock.currencyBox.rateEntry,2),2)
654          currencyTypeBlock.currencyBox.amountEntry = str(currencyTypeBlock.currencyBox.formatEntry) % monto              currencyTypeBlock.currencyBox.amountEntry = str(currencyTypeBlock.currencyBox.formatEntry) % monto
655            currencyTypeBlock.jumpRecord(rn)
656          ]]></trigger>    ]]></trigger>
657    
658    <trigger type="NAMED" name="endTypeCurrencyTrigger">    <trigger type="NAMED" name="endTypeCurrencyTrigger"><![CDATA[
659      <![CDATA[  
660        import hack
661  import hack  
662            callTrigger('currencyTypeTrigger')
663  callTrigger('currencyTypeTrigger')  
664        total = hack.a2f(payBlock.cashEntry,2)
665  total = hack.a2f(payBlock.cashEntry,2)      rc = currencyTypeBlock.getRecordCount()
666  rc = currencyTypeBlock.getRecordCount()      for recNum in range(rc):
667  for recNum in range(rc):          currencyTypeBlock.jumpRecord(recNum)
668      currencyTypeBlock.jumpRecord(recNum)          if hack.a2f(currencyTypeBlock.currencyBox.rateEntry,2) > 0:
669      if hack.a2f(currencyTypeBlock.currencyBox.rateEntry,2) > 0:              total -= round(hack.a2f(currencyTypeBlock.currencyBox.payEntry,2) * hack.a2f(currencyTypeBlock.currencyBox.rateEntry,2),2)
670          total -= round(hack.a2f(currencyTypeBlock.currencyBox.payEntry,2) * hack.a2f(currencyTypeBlock.currencyBox.rateEntry,2),2)  
671        if total > 0:
672  if total > 0:          genericBox("El los montos no completan el total del documento\n",['Aceptar'])
673      genericBox("El los montos no completan el total del documento\n",['Aceptar'])      else:
674  else:          from gnue.common.GDataObjects import ConnectionError as DBError
675      callTrigger('startWaitingModeTrigger')          callTrigger('startWaitingModeTrigger')
676      callTrigger ('commitTrigger')          try:
677      # it's _such_ a pitty            callTrigger ('commitTrigger')
678      # pleasePrint ('serviceInvoice', { 'id': str(ownDocumentBlock.idEntry) })            # it's _such_ a pitty
679      report='productInvoice-%s' % str(ownDocumentBlock.typeEntry)            # pleasePrint ('serviceInvoice', { 'id': str(ownDocumentBlock.idEntry) })
680      hack.pleasePrint (self, str(ownDocumentBlock.typeEntry), report, [ 'id='+str(ownDocumentBlock.idEntry) ],str(ownPosDocumentBlock.documentPrintCommand))            report='productInvoice-%s' % str(ownDocumentBlock.typeEntry)
681      callTrigger('rollbackTrigger')            hack.pleasePrint (self, str(ownDocumentBlock.typeEntry), report, [ 'id='+str(ownDocumentBlock.idEntry) ],str(ownPosDocumentBlock.documentPrintCommand))
682      callTrigger('endWaitingModeTrigger')            callTrigger('rollbackTrigger')
683                except DBError:
684        ]]>            # just ignore, as the commit trigger already reports the error to the user
685    </trigger>            pass
686            callTrigger('endWaitingModeTrigger')
687      ]]></trigger>
688    
689    <trigger name="cashEntryPreFocusout" type="NAMED">    <trigger name="cashEntryPreFocusout" type="NAMED">
690    
691      import hack      import hack
692      payBlock.ctaCteEntry = str(round(hack.a2f(totalBlock.totalEntry,2) - hack.a2f(payBlock.cashEntry,2),2))      payBlock.ctaCteEntry = str(round(hack.a2f(totalBlock.totalEntry,2) - hack.a2f(payBlock.cashEntry,2),2))
693      callTrigger('currencyTypeTrigger')      callTrigger('currencyTypeTrigger')
694                
695    </trigger>    </trigger>
696    
697    <trigger name="cashEntryPreFocusout" type="NAMED">    <trigger name="cashEntryPreFocusout" type="NAMED">
698                
699      import hack      import hack
700      payBlock.cashEntry = str(round(hack.a2f(totalBlock.totalEntry,2) - hack.a2f(payBlock.ctaCteEntry,2),2))      payBlock.cashEntry = str(round(hack.a2f(totalBlock.totalEntry,2) - hack.a2f(payBlock.ctaCteEntry,2),2))
701      callTrigger('currencyTypeTrigger')      callTrigger('currencyTypeTrigger')
702                
703    </trigger>    </trigger>
704    
705    <trigger type="NAMED" name="cancelCurrencyTrigger"><![CDATA[    <trigger type="NAMED" name="cancelCurrencyTrigger"><![CDATA[
706    
707      setFocus(ownItemBlock.prodCodeSEntry)      setFocus(ownItemBlock.prodCodeSEntry)
708    
709      ]]></trigger>    ]]></trigger>
710    
711    
712      <!--=== ah, and here comes the dinner.... er, form! ===-->
713    <page name="Factura a Clientes">    <page name="Factura a Clientes">
714      <box height="9" label="Factura de Productos a Clientes"      <box height="9" label="Factura de Productos a Clientes"
715        name="invoiceHeaderBox" width="105" x="0" y="0">        name="invoiceHeaderBox" width="105" x="0" y="0">
# Line 1087  else: Line 993  else:
993          <entry name="tmpDateEntry" typecast="date"          <entry name="tmpDateEntry" typecast="date"
994            width="14" x="7" y="1"/>            width="14" x="7" y="1"/>
995        </block>        </block>
996         <neb:Sub neb:src="posDocument.nebc" documentType="ownDocumentBlock.typeEntry"         <neb:Sub neb:src="posDocument.nebc" documentType="ownDocumentBlock.typeEntry"
997          ownPosBlock="ownPosBlock" stockByInvoice="stockByInvoice"          ownPosBlock="ownPosBlock" stockByInvoice="stockByInvoice"
998          ownPosEntityIdEntry="ownPosEntityIdEntry"  ownPosDocumentBlock="ownPosDocumentBlock"          ownPosEntityIdEntry="ownPosEntityIdEntry"  ownPosDocumentBlock="ownPosDocumentBlock"
999          documentNumberEntry="documentNumberEntry" documentNumberEntryX="55" documentNumberEntryY="1"          documentNumberEntry="documentNumberEntry" documentNumberEntryX="55" documentNumberEntryY="1"
1000          searchNextDocumentNumber="searchNextInvoiceNumber"          searchNextDocumentNumber="searchNextInvoiceNumber"
1001          ownStorehouseBlock ="ownStorehouseBlock" ownStorehouseIdEntry="ownStorehouseIdEntry"  >          ownStorehouseBlock ="ownStorehouseBlock" ownStorehouseIdEntry="ownStorehouseIdEntry"  >
1002        </neb:Sub>        </neb:Sub>
1003    
1004      </box>      </box>
1005    
# Line 1321  else: Line 1227  else:
1227      <entry field="own_item.own_document" name="ownDocumentEntry" hidden="" x="1" y="1"/>      <entry field="own_item.own_document" name="ownDocumentEntry" hidden="" x="1" y="1"/>
1228    
1229      <label name="qtyLbl" text="Cantidad" x="45" y="10"/>      <label name="qtyLbl" text="Cantidad" x="45" y="10"/>
     <!-- mdione's bookmark -->  
1230      <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.3f" width="11" x="45" y="11">
1231      <trigger name="qtyEntryPreFocusout" type="PRE-FOCUSOUT" src="totalCalcTrigger" />      <trigger name="qtyEntryPreFocusout" type="PRE-FOCUSOUT" src="totalCalcTrigger" />
1232      </entry>      </entry>
# Line 1371  else: Line 1276  else:
1276          <entry name="currencyTypeEntry" field="currency_movement.currency_type" hidden="" x="1" y="1" width="12"/>          <entry name="currencyTypeEntry" field="currency_movement.currency_type" hidden="" x="1" y="1" width="12"/>
1277      </block>      </block>
1278      <!--     Datasource que sirve para almacenar el resultado de la búsqueda -->      <!--     Datasource que sirve para almacenar el resultado de la búsqueda -->
1279        <block datasource="tmpValuesDataSource" name="totalBlock" restrictInsert="">      <block datasource="tmpValuesDataSource" name="totalBlock" restrictInsert="">
1280          <label text="Neto " x="55" y="21"/>        <label text="Neto " x="55" y="21"/>
1281          <entry name="netoEntry" style="label" readonly="" x="55" y="22" width="12" typecast="number" displaymask="%0.2f"        <entry name="netoEntry" style="label" readonly="" x="55" y="22" width="12" typecast="number" displaymask="%0.2f"
1282            default="0.00"/>          default="0.00"/>
1283          <label text="IVA " x="66" y="21"/>        <label text="IVA " x="66" y="21"/>
1284          <entry name="ivaEntry" style="label" readonly="" x="66" y="22" width="12" typecast="number" displaymask="%0.2f"        <entry name="ivaEntry" style="label" readonly="" x="66" y="22" width="12" typecast="number" displaymask="%0.2f"
1285            default="0.00"/>          default="0.00"/>
1286          <label text="Total " x="82" y="21"/>        <label text="Total " x="82" y="21"/>
1287          <entry name="totalEntry" style="label" readonly="" x="82" y="22" width="12" typecast="number" displaymask="%0.2f"        <entry name="totalEntry" style="label" readonly="" x="82" y="22" width="12" typecast="number" displaymask="%0.2f"
1288            default="0.00"/>          default="0.00"/>
1289        </block>      </block>
1290      <neb:Sub neb:src="setStock.nebc"   ownDocumentId="ownDocumentBlock.idEntry" storehouseEntityId="ownStorehouseBlock.ownStorehouseIdEntry"      <neb:Sub neb:src="setStock.nebc"   ownDocumentId="ownDocumentBlock.idEntry" storehouseEntityId="ownStorehouseBlock.ownStorehouseIdEntry"
1291   stockAddTrigger="stockAddTrigger" stockSubstractTrigger="stockSubstractTrigger"/>        stockAddTrigger="stockAddTrigger" stockSubstractTrigger="stockSubstractTrigger"/>
1292          
1293  <!-- se va a stockMaintenance.neb  -->  <!-- se va a stockMaintenance.neb  -->
1294   <!--      <block datasource="ownItemToUpdDataSource" name="ownItemToUpdBlock"> -->   <!--      <block datasource="ownItemToUpdDataSource" name="ownItemToUpdBlock"> -->
1295  <!--         <entry name="ownDocumentEntry" field="own_item.own_document" hidden="" x="1" y="109" width="10"/> -->  <!--         <entry name="ownDocumentEntry" field="own_item.own_document" hidden="" x="1" y="109" width="10"/> -->
# Line 1405  else: Line 1310  else:
1310          <entry name="balanceEntry" field="_credit_limit_data.balance" hidden="" x="22" y="109" width="10"/>          <entry name="balanceEntry" field="_credit_limit_data.balance" hidden="" x="22" y="109" width="10"/>
1311          <entry name="timeStampEntry" field="_credit_limit_data.time_stamp" hidden="" x="33" y="109" width="10"/>          <entry name="timeStampEntry" field="_credit_limit_data.time_stamp" hidden="" x="33" y="109" width="10"/>
1312    
1313        <!--     Estos 2 botones estaba antes en el box cobro de facura  -->          <!--     Estos 2 botones estaba antes en el box cobro de facura  -->
1314          <button name="printButton" label="Doc. Terminado" trigger="invoiceOkTrigger"          <button name="printButton" label="Doc. Terminado" trigger="invoiceOkTrigger"
1315            x="1" y="22" width="16" height="1"/>            x="1" y="22" width="16" height="1"/>
1316          <button x="18" y="22" trigger="rollbackTrigger" width="18" label="Cancelar"          <button x="18" y="22" trigger="rollbackTrigger" width="18" label="Cancelar"
1317            name="rollbackBtn" height="1"/>            name="rollbackBtn" height="1"/>
1318        <!--     Estos 2 botones estaba antes en el box cobro de facura  -->          <!--     Estos 2 botones estaba antes en el box cobro de facura  -->
1319    
1320        </block>        </block>
1321    
# Line 1418  else: Line 1323  else:
1323        <entry name="condIVAEntry" field="_tax_profile_data._table" hidden="" x="1" y="1" width="10"/>        <entry name="condIVAEntry" field="_tax_profile_data._table" hidden="" x="1" y="1" width="10"/>
1324      </block>      </block>
1325    </page>    </page>
1326    
1327      <!--=== SECOND PAGE ===-->
1328    <page name="Determinacion de Monedas">    <page name="Determinacion de Monedas">
1329      <block name="currencyDataBlock" datasource="dataCurrencyDataSource">      <block name="currencyDataBlock" datasource="dataCurrencyDataSource">
1330        <box height="4" label="Factura de Productos a Clientes"        <box height="4" label="Factura de Productos a Clientes"
1331            name="recipientBox" width="105" x="0" y="0">          name="recipientBox" width="105" x="0" y="0">
1332          <label  text="Fecha:" x="1" y="1" />          <label  text="Fecha:" x="1" y="1" />
1333          <label  text="Tipo:" x="25" y="1"/>          <label  text="Tipo:" x="25" y="1"/>
1334          <label  text="Número:" x="35" y="1"/>          <label  text="Número:" x="35" y="1"/>
# Line 1430  else: Line 1337  else:
1337          <entry name="numberEntry" style="label" typecast="number" displaymask="%10d" width="11" x="43" y="1"/>          <entry name="numberEntry" style="label" typecast="number" displaymask="%10d" width="11" x="43" y="1"/>
1338        </box>        </box>
1339        <box height="5" label="Datos del Cliente" name="clientRecipientBox" width="105" x="0" y="3">        <box height="5" label="Datos del Cliente" name="clientRecipientBox" width="105" x="0" y="3">
1340          <label name="codeLbl" text="Codigo" x="1" y="1"/>          <label name="codeLbl" text="Codigo" x="1" y="1"/>
1341          <label name="nameLbl" text="Nombre" x="21" y="1"/>          <label name="nameLbl" text="Nombre" x="21" y="1"/>
1342          <entry x="1" y="2" name="clientCodeEntry" style="label" width="20"/>          <entry x="1" y="2" name="clientCodeEntry" style="label" width="20"/>
1343          <entry x="21" y="2" name="clientNameEntry" style="label" width="35"/>          <entry x="21" y="2" name="clientNameEntry" style="label" width="35"/>
1344          <label name="totalLbl" text="Total a Pagar:" x="26" y="3"/>          <label name="totalLbl" text="Total a Pagar:" x="26" y="3"/>
1345          <entry name="totalEntry" field="total" x="41" y="3" width="10" style="label"          <entry name="totalEntry" field="total" x="41" y="3" width="10" style="label"
1346            typecast="number" displaymask="%10.2f"/>            typecast="number" displaymask="%10.2f"/>
1347        </box>        </box>
1348      </block>      </block>
# Line 1443  else: Line 1350  else:
1350        <box label="Monedas de Pago" name="currencyBox"        <box label="Monedas de Pago" name="currencyBox"
1351          height="13" width="105" x="0" y="10">          height="13" width="105" x="0" y="10">
1352    
1353          <label name="nameLbl" text="Moneda" x="1" y="1"/>          <label name="nameLbl" text="Moneda" x="1" y="1"/>
1354          <label name="rateLbl" text="Cotización" x="10" y="1"/>          <label name="rateLbl" text="Cotización" x="10" y="1"/>
1355          <label name="montoLbl" text="Monto" x="21" y="1"/>          <label name="montoLbl" text="Monto" x="21" y="1"/>
1356          <label name="pagoLbl" text="Pago" x="31" y="1"/>          <label name="pagoLbl" text="Pago" x="31" y="1"/>
1357    
1358          <entry name="idEntry" field="id" rows="6" x="1" y="1" hidden=""/>          <entry name="idEntry" field="id" rows="6" x="1" y="1" hidden=""/>
1359          <entry name="formatEntry" field="format" rows="6" x="1" y="1" hidden=""/>          <entry name="formatEntry" field="format" rows="6" x="1" y="1" hidden=""/>
1360          <entry name="nameEntry" field="name" style="label" rows="6"          <entry name="nameEntry" field="name" style="label" rows="6"
1361            x="1" y="2" width="6" readonly=""/>            x="1" y="2" width="6" readonly=""/>
1362          <entry name="rateEntry" field="rate" style="label" rows="6" typecast="number"          <entry name="rateEntry" field="rate" style="label" rows="6" typecast="number"
1363            displaymask="%4.2f" x="10" y="2" width="10" readonly=""/>            displaymask="%4.2f" x="10" y="2" width="10" readonly=""/>
1364          <entry name="amountEntry" field="amount" style="label" rows="6"          <entry name="amountEntry" field="amount" style="label" rows="6"
1365            x="21" y="2" width="20" readonly=""/>            x="21" y="2" width="20" readonly=""/>
1366          <entry name="payEntry" field="pay" rows="6" x="38" y="2" width="20"          <entry name="payEntry" field="pay" rows="6" x="38" y="2" width="20"
1367            typecast="number" displaymask="%10.2f">            typecast="number" displaymask="%10.2f">
1368            <trigger type="PRE-FOCUSOUT" src="currencyTypeTrigger"/>            <trigger type="PRE-FOCUSOUT" src="currencyTypeTrigger"/>
1369          </entry>          </entry>
1370          <scrollbar page="2" x="68" y="2" width="1" height="6"/>          <scrollbar page="6" x="68" y="2" width="1" height="6"/>
1371          <button name="acceptButton" trigger="endTypeCurrencyTrigger" label="Aceptar"          <button name="acceptButton" trigger="endTypeCurrencyTrigger" label="Aceptar"
1372            width="10" height="1" x="10" y="10"/>            width="10" height="1" x="10" y="10"/>
1373          <button name="cancelButton" trigger="cancelCurrencyTrigger" label="Cancelar"          <button name="cancelButton" trigger="cancelCurrencyTrigger" label="Cancelar"
1374            width="10" height="1" x="20" y="10"/>            width="10" height="1" x="20" y="10"/>
1375        </box>        </box>
1376        <box height="4" label="Cobro de la factura" name="payBox"        <box height="4" label="Cobro de la factura" name="payBox"
1377          width="105" x="0" y="7">          width="105" x="0" y="7">

Legend:
Removed from v.1.19  
changed lines
  Added in v.1.20

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