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

Diff of /papo/forms/receipt.neb

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

revision 1.18 by mhepp, Fri Jun 13 15:42:39 2003 UTC revision 1.19 by mhepp, Fri Jun 13 21:35:34 2003 UTC
# Line 93  Line 93 
93    <!-- Origen de datos que srive para calcular el total facturado -->    <!-- Origen de datos que srive para calcular el total facturado -->
94    
95    <datasource name="productInvoiceDataSource" database="papo"    <datasource name="productInvoiceDataSource" database="papo"
96      table="_entity_data, own_document " >      table="_entity_data, own_document, _document_type_data " >
97      <condition>      <condition>
98        <and>        <and>
99          <eq>          <eq>
# Line 114  Line 114 
114              <cfield name="own_document.own_document_type"/>              <cfield name="own_document.own_document_type"/>
115              <cconst value="9"/> <!-- Factura tipo C -->              <cconst value="9"/> <!-- Factura tipo C -->
116            </eq>            </eq>
117     <!--show credit notes-->
118              <eq>
119                <cfield name="own_document.own_document_type"/>
120                <cconst value="14"/>
121              </eq>
122              <eq>
123                <cfield name="own_document.own_document_type"/>
124                <cconst value="15"/>
125              </eq>
126              <eq>
127                <cfield name="own_document.own_document_type"/>
128                <cconst value="16"/>
129              </eq>
130              <!--/show credit notes-->
131          </or>          </or>
132            <eq>
133              <cfield name="own_document.own_document_type"/>
134              <cfield name="_document_type_data._table"/>
135            </eq>
136          <or>          <or>
137            <null>            <null>
138              <cfield name="own_document.is_void"/>              <cfield name="own_document.is_void"/>
# Line 158  Line 176 
176      </condition>      </condition>
177    </datasource>    </datasource>
178    
   <datasource name="ownDocumentTaxTotDataSource" database="papo"  
     table="own_document, own_document_tax">  
     <condition>  
       <eq>  
         <cfield name="own_document.id"/>  
         <cfield name="own_document_tax.own_document"/>  
       </eq>  
     </condition>  
   </datasource>  
179    
180    <datasource name="payTotDataSource" database="papo"    <datasource name="cancelledDocumentDataSource" database="papo" table="own_document_proceeding">
     table="_entity_data, own_document, own_document_proceeding">  
     <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_document_proceeding.own_document"/>  
         </eq>  
         <and>  
           <or>  
             <eq>  
               <cfield name="own_document.own_document_type"/>  
               <cconst value="4"/>  
             </eq>  
             <eq>  
               <cfield name="own_document.own_document_type"/>  
               <cconst value="8"/>  
             </eq>  
             <eq>  
               <cfield name="own_document.own_document_type"/>  
               <cconst value="9"/>  
             </eq>  
           </or>  
         </and>  
       </and>  
     </condition>  
181    </datasource>    </datasource>
182    
183    <datasource database="papo" name="ownDocumentDataSource" table="own_document"    <datasource database="papo" name="ownDocumentDataSource" table="own_document" order_by="date" />
     order_by="date" />  
184    
185     <datasource  name="ownItemDataSource" database="papo" detaillink="own_item.own_document"     <datasource  name="ownItemDataSource" database="papo" detaillink="own_item.own_document"
186       master="ownDocumentDataSource" masterlink="id"       master="ownDocumentDataSource" masterlink="id"
# Line 243  Line 221 
221      </condition>      </condition>
222    </datasource>    </datasource>
223    
224    <datasource name="tmpInvToPayedDataSource" cache="1"/>  
225    <datasource name="tmpCurrencyDataSource" cache="1"/>    <datasource name="tmpCurrencyDataSource" cache="1"/>
226    <datasource name="dataCurrencyDataSource" cache="1"/>    <datasource name="dataCurrencyDataSource" cache="1"/>
227    <datasource name="invoiceToPayedDataSource" cache="1"/>    <datasource name="invoiceToPayedDataSource" cache="1"/>
# Line 253  Line 231 
231    </trigger>    </trigger>
232    
233    <trigger type="NAMED" name="showInvoiceToPayTrigger"><![CDATA[    <trigger type="NAMED" name="showInvoiceToPayTrigger"><![CDATA[
234    import printing
235    documentSign={'4':1, '9':1, '8':1,'14':-1, '16':-1, '15':-1}
236  callTrigger('startWaitingModeTrigger')  callTrigger('startWaitingModeTrigger')
237  tmpInvToPayedBlock.clear()  #tmpInvToPayedBlock.clear()
238  invoiceToPayedBlock.clear()  invoiceToPayedBlock.clear()
239  proceedingBlock.clear()  proceedingBlock.clear()
240  currencyMovementBlock.clear()  currencyMovementBlock.clear()
# Line 290  if client: Line 269  if client:
269      while more:      while more:
270          invoiceTotal = 0          invoiceTotal = 0
271          currOwnDoc = productInvoiceResultSet.current.getField("own_document.id")          currOwnDoc = productInvoiceResultSet.current.getField("own_document.id")
272          if not tmpInvToPayedBlock.getCurrentRecord().isEmpty():          if not invoiceToPayedBlock.getCurrentRecord().isEmpty():
273              tmpInvToPayedBlock.newRecord()              invoiceToPayedBlock.newRecord()
274            #calculo el total del documento  
275          tmpInvToPayedBlock.idEntry = str(productInvoiceResultSet.current.getField("own_document.id"))          documentTotal = hack.a2f(productInvoiceResultSet.current.getField("own_document.tax_total")) + hack.a2f(productInvoiceResultSet.current.getField("own_document.net_total"))
276          tmpInvToPayedBlock.numberEntry = str(productInvoiceResultSet.current.getField("own_document.number"))          #busco lo pagado del documento
277          tmpInvToPayedBlock.dateEntry = str(productInvoiceResultSet.current.getField("own_document.date"))          condPay = GConditions.GCondition()
278          # while productInvoiceResultSet.current.getField("own_document.id") == currOwnDoc and more:          eqPay = GConditions.GCeq(condPay)
279          #             lQty = hack.a2f(productInvoiceResultSet.current.getField("own_product_item.qty"),2)          GConditions.GCField(eqPay,"own_document_proceeding.own_document")
280          #             lUnitPrice = hack.a2f(productInvoiceResultSet.current.getField("own_product_item.unit_price"),2)          GConditions.GCConst(eqPay,str(currOwnDoc))
281          #             lBonus = hack.a2f(productInvoiceResultSet.current.getField("own_item.bonus"),2)          cancelledDocumentResultSet = cancelledDocumentDataSource.createResultSet(condPay)
282          #             lDiscount = hack.a2f(productInvoiceResultSet.current.getField("own_item.discount"),2)          cancelledMore= cancelledDocumentResultSet.firstRecord()
283          #             item = round(lQty * lUnitPrice - lBonus - lDiscount,2)          cancelledAmount = 0.0
284          #             #print "qty %d * unit_price %d - bonus %d - discount %d = %d " % (lQty, lUnitPrice, lBonus, lDiscount, lQty * lUnitPrice - lBonus - lDiscount)          while cancelledMore :
285          #             itemTaxTotal = 0              cancelledAmount += hack.a2f(cancelledDocumentResultSet.current.getField("amount"),2)
286          #             currItem = productInvoiceResultSet.current.getField("own_item.id")              print "el monto cancelado es de", cancelledAmount ,"\n"
287          #             while productInvoiceResultSet.current.getField("own_item.id") == currItem and more:              print "el id es",str(cancelledDocumentResultSet.current.getField("id")) ,"\n"
288          #                 itemTaxTotal += hack.a2f(productInvoiceResultSet.current.getField("own_item_tax.amount"),2)              cancelledMore = cancelledDocumentResultSet.nextRecord()
289          #                 more = productInvoiceResultSet.nextRecord()          #/busco lo pagado del documento
290          #             invoiceTotal += round(item + itemTaxTotal,2)          #si se adeuda algun monto muestro el documento adeudado
291          #         # Calcula los impuestos del documento en si          print 'documentTotal',documentTotal,'cancelledAmount',cancelledAmount
292          #         odt_rs = ownDocumentTaxTotDataSource.createResultSet({"own_document.id":currOwnDoc})          if round(documentTotal,2) > round(cancelledAmount,2) :
293          #         odt_more = odt_rs.firstRecord()            print "No está cancelado"
294          #         while odt_more:            docType=str(productInvoiceResultSet.current.getField("own_document.own_document_type")).strip()
295          #             invoiceTotal += hack.a2f(odt_rs.current.getField("own_document_tax.amount"),2)            invoiceToPayedBlock.invoiceBox.typeEntry = str(productInvoiceResultSet.current.getField("_document_type_data.code"))
296          #             odt_more = odt_rs.nextRecord()            invoiceToPayedBlock.invoiceBox.signEntry =  str(documentSign[docType])
297          invoiceTotal = hack.a2f(productInvoiceResultSet.current.getField("own_document.tax_total")) + hack.a2f(productInvoiceResultSet.current.getField("own_document.net_total"))      
298          tmpInvToPayedBlock.amountEntry = str(invoiceTotal)            invoiceToPayedBlock.invoiceBox.idEntry = str(productInvoiceResultSet.current.getField("own_document.id"))
299          tmpInvToPayedBlock.payedEntry = "0.0"            invoiceToPayedBlock.invoiceBox.numberEntry = str(productInvoiceResultSet.current.getField("own_document.number"))
300              invoiceToPayedBlock.invoiceBox.dateEntry = str(productInvoiceResultSet.current.getField("own_document.date"))
301              invoiceToPayedBlock.invoiceBox.toPayEntry =printing.printAccount(((documentTotal - cancelledAmount) * documentSign[docType]),10)
302              invoiceToPayedBlock.invoiceBox.amountEntry = printing.printAccount((documentTotal * documentSign[docType]),10)
303              invoiceToPayedBlock.invoiceBox.payedEntry = "0.0"
304          more = productInvoiceResultSet.nextRecord()          more = productInvoiceResultSet.nextRecord()
305      rs = payTotDataSource.createResultSet(condPay)          #invoiceToPayedBlock.invoiceBox.totalEntry = str(round(total,2))
     more = rs.firstRecord()  
     while more:  
         rc = tmpInvToPayedBlock.getRecordCount()  
         for recNum in range(rc):  
             tmpInvToPayedBlock.jumpRecord(recNum)  
             if hack.a2f(tmpInvToPayedBlock.idEntry,2) == hack.a2f(rs.current.getField("own_document_proceeding.own_document"),2):  
                 tmpInvToPayedBlock.payedEntry = str(round(  
                     hack.a2f(tmpInvToPayedBlock.payedEntry,2) + \  
                     hack.a2f(rs.current.getField("own_document_proceeding.amount"),2),2))  
         more = rs.nextRecord()  
   
     # Busco las que ya han sido pagadas y lleno el block de pedido  
     rc = tmpInvToPayedBlock.getRecordCount()  
     for recNum in range(rc):  
         tmpInvToPayedBlock.jumpRecord(recNum)  
         if hack.a2f(tmpInvToPayedBlock.payedEntry,2) < hack.a2f(tmpInvToPayedBlock.amountEntry,2):  
             if not invoiceToPayedBlock.getCurrentRecord().isEmpty():  
                 invoiceToPayedBlock.newRecord()  
             invoiceToPayedBlock.invoiceBox.idEntry = str(tmpInvToPayedBlock.idEntry)  
             invoiceToPayedBlock.invoiceBox.numberEntry = str(tmpInvToPayedBlock.numberEntry)  
             invoiceToPayedBlock.invoiceBox.dateEntry = str(tmpInvToPayedBlock.dateEntry)  
             invoiceToPayedBlock.invoiceBox.amountEntry = str(tmpInvToPayedBlock.amountEntry)  
             invoiceToPayedBlock.invoiceBox.payedEntry = str(tmpInvToPayedBlock.payedEntry)  
             invoiceToPayedBlock.invoiceBox.payEntry = str(round(  
                 hack.a2f(tmpInvToPayedBlock.amountEntry,2) - \  
                 hack.a2f(tmpInvToPayedBlock.payedEntry,2),2))  
             total += hack.a2f(invoiceToPayedBlock.invoiceBox.payEntry,2)  
   
 invoiceToPayedBlock.invoiceBox.totalEntry = str(round(total,2))  
306  callTrigger('endWaitingModeTrigger')  callTrigger('endWaitingModeTrigger')
307    
308      ]]></trigger>      ]]></trigger>
# Line 357  callTrigger('endWaitingModeTrigger') Line 311  callTrigger('endWaitingModeTrigger')
311  import hack  import hack
312    
313  ownDocumentBlock.clear()  ownDocumentBlock.clear()
314  tmpInvToPayedBlock.clear()  #tmpInvToPayedBlock.clear()
315  invoiceToPayedBlock.clear()  invoiceToPayedBlock.clear()
316  proceedingBlock.clear()  proceedingBlock.clear()
317  currencyMovementBlock.clear()  currencyMovementBlock.clear()
# Line 391  line += "  Codigo : " + printing.printFi Line 345  line += "  Codigo : " + printing.printFi
345  line += "  Nombre : " + printing.printField(ownDocumentBlock.clientRecipientBox.clientNameEntry,30)  line += "  Nombre : " + printing.printField(ownDocumentBlock.clientRecipientBox.clientNameEntry,30)
346  table.append(line)  table.append(line)
347    
348  line = "| " + printing.printTitle("Numero",14) + " | "  line = "| " + printing.printTitle("tipo",4) + " | "
349    line += printing.printTitle("Numero",14) + " | "
350  line += printing.printTitle("Fecha",20) + " | "  line += printing.printTitle("Fecha",20) + " | "
351  line += printing.printTitle("Monto",20) + " | "  line += printing.printTitle("Monto",20) + " | "
352  line += printing.printTitle("Pagado",20) + " |"  line += printing.printTitle("Por cancelar",20) + " | "
353    line += printing.printTitle("Cancelado",20) + " |"
354  lineLen = len(line)  lineLen = len(line)
355  table.append(line)  table.append(line)
356    
# Line 408  for recNum in range(rc): Line 364  for recNum in range(rc):
364      invoiceToPayedBlock.jumpRecord(recNum)      invoiceToPayedBlock.jumpRecord(recNum)
365      if hack.a2f(invoiceToPayedBlock.invoiceBox.payEntry,2) > 0:      if hack.a2f(invoiceToPayedBlock.invoiceBox.payEntry,2) > 0:
366          line = "| "          line = "| "
367            line += printing.printField(invoiceToPayedBlock.invoiceBox.typeEntry,4,'r') + " | "
368          line += printing.printField(invoiceToPayedBlock.invoiceBox.numberEntry,14,'r') + " | "          line += printing.printField(invoiceToPayedBlock.invoiceBox.numberEntry,14,'r') + " | "
369          line += printing.printDate(invoiceToPayedBlock.invoiceBox.dateEntry,20,'r') + " | "          line += printing.printField(invoiceToPayedBlock.invoiceBox.dateEntry,20,'r') + " | "
370          line += printing.printField(invoiceToPayedBlock.invoiceBox.amountEntry,20,'r') + " | "          line += printing.printField(invoiceToPayedBlock.invoiceBox.amountEntry,20,'r') + " | "
371          line += printing.printField(invoiceToPayedBlock.invoiceBox.payEntry,20,'r') + " |"          line += printing.printField(invoiceToPayedBlock.invoiceBox.toPayEntry,20,'r') + " | "
372            if invoiceToPayedBlock.invoiceBox.signEntry > 0 :
373                line += printing.printField(invoiceToPayedBlock.invoiceBox.payEntry,20,'r') + " |"
374            else:
375                line += printing.printField("("+str(invoiceToPayedBlock.invoiceBox.payEntry)+")",20,'r') + " |"
376          table.append(line)          table.append(line)
377    
378  line = "  "  
379  line += printing.printField(" ",14) + "   "  line = printing.printField(" ",72)
380  line += printing.printField(" ",20) + "   "  line += printing.printTitle("Pagado ",20) + " | "
 line += printing.printTitle(" ",20) + " | "  
381  line += printing.printField(invoiceToPayedBlock.invoiceBox.totalEntry,20,'r') + " | "  line += printing.printField(invoiceToPayedBlock.invoiceBox.totalEntry,20,'r') + " | "
382  table.append(line)  table.append(line)
383    
# Line 474  total = 0.0 Line 434  total = 0.0
434    
435  for recNum in range(rc):  for recNum in range(rc):
436      invoiceToPayedBlock.jumpRecord(recNum)      invoiceToPayedBlock.jumpRecord(recNum)
437      total += hack.a2f(invoiceToPayedBlock.invoiceBox.payEntry,2)      total += hack.a2f(invoiceToPayedBlock.invoiceBox.payEntry,2) * hack.a2f(invoiceToPayedBlock.invoiceBox.signEntry)
438        print hack.a2f(invoiceToPayedBlock.invoiceBox.payEntry,2),str(invoiceToPayedBlock.invoiceBox.signEntry)
439  invoiceToPayedBlock.invoiceBox.totalEntry = str(round(total,2))  invoiceToPayedBlock.invoiceBox.totalEntry = str(round(total,2))
440    
441      ]]></trigger>      ]]></trigger>
# Line 484  invoiceToPayedBlock.invoiceBox.totalEntr Line 444  invoiceToPayedBlock.invoiceBox.totalEntr
444  import hack  import hack
445    
446  callTrigger('totalTrigger')  callTrigger('totalTrigger')
447  if hack.a2f(invoiceToPayedBlock.invoiceBox.totalEntry,2) > 0:  if hack.a2f(invoiceToPayedBlock.invoiceBox.totalEntry,2) >= 0:
448      currencyTypeBlock.clear()      currencyTypeBlock.clear()
449      currencyDataBlock.clear()      currencyDataBlock.clear()
450    
# Line 645  else: Line 605  else:
605        </box>        </box>
606      </block>      </block>
607    
608      <block name="tmpInvToPayedBlock" datasource="tmpInvToPayedDataSource">  
       <entry name="idEntry" field="id" hidden="" x="1" y="1" width="1" />  
       <entry name="numberEntry" field="number" hidden="" x="1" y="1" width="1" />  
       <entry name="dateEntry" field="date" hidden="" x="1" y="1" width="1"/>  
       <entry name="amountEntry" field="amount" hidden="" x="1" y="1" width="1"/>  
       <entry name="payedEntry" field="payed" hidden="" x="1" y="1" width="1"/>  
     </block>  
609    
610      <block name="invoiceToPayedBlock" datasource="invoiceToPayedDataSource">      <block name="invoiceToPayedBlock" datasource="invoiceToPayedDataSource">
611        <box height="13" label="Facturas Pendientes de Pago" name="invoiceBox"        <box height="13" label="Facturas Pendientes de Pago" name="invoiceBox"
612          width="72" x="0" y="7">          width="72" x="0" y="7">
613          <label name="numberLbl" text="Numero" x="1" y="1"/>          <label  text="Tipo" x="1" y="1"/>
614          <label name="dateLbl" text="Fecha" x="20" y="1"/>          <label  text="Numero" x="6" y="1"/>
615          <label name="amountLbl" text="Monto" x="33" y="1"/>          <label  text="Fecha" x="20" y="1"/>
616          <label name="payedLbl" text="Pagado" x="45" y="1"/>          <label  text="Monto" x="33" y="1"/>
617          <label name="payLbl" text="A Pagar" x="57" y="1"/>          <label  text="Por cancelar" x="45" y="1"/>
618            <label  text="A cancelar" x="58" y="1"/>
619          <entry name="idEntry" field="id" style="label" hidden="" rows="8" x="1" y="2" width="1" />  
620          <entry name="numberEntry" field="number" style="label" rows="8"          <entry name="idEntry"  style="label" hidden="" rows="8" x="1" y="2" width="1" />
621            x="1" y="2" width="10" readonly=""/>          <entry name="numberEntry"  style="label" rows="8"
622          <entry name="dateEntry" field="date" style="label" rows="8"            x="5" y="2" width="10" readonly=""/>
623            <entry name="signEntry"  style="label" hidden="" rows="8" x="1" y="2" width="1" />
624            <entry name="typeEntry"  style="label" rows="8"
625              x="1" y="2" width="19" />
626            <entry name="dateEntry"  style="label" rows="8"
627            x="20" y="2" width="11" readonly=""/>            x="20" y="2" width="11" readonly=""/>
628          <entry name="amountEntry" field="amount" style="label" rows="8"  typecast="number" displaymask="%6.2f"          <entry name="amountEntry"  style="label" rows="8" x="33" y="2" width="10"/>
629            x="33" y="2" width="10" readonly=""/>          <entry name="toPayEntry" style="label" rows="8"  x="45" y="2" width="10" />
630          <entry name="payedEntry" field="payed" style="label" rows="8"  typecast="number" displaymask="%6.2f"          <entry name="payEntry" rows="8" x="57" y="2" width="10" typecast="number" displaymask="%8.2f">
           x="45" y="2" width="10" readonly=""/>  
         <entry name="payEntry" field="pay"  rows="8" x="57" y="2" width="10" typecast="number" displaymask="%8.2f">  
631            <trigger type="PRE-FOCUSOUT" src="totalTrigger"/>            <trigger type="PRE-FOCUSOUT" src="totalTrigger"/>
632          </entry>          </entry>
633          <scrollbar page="2" x="68" y="2" width="1" height="8"/>          <scrollbar page="2" x="68" y="2" width="1" height="8"/>

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

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