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

Diff of /papo/forms/ivaSales.gfd

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

revision 1.3 by apronotti, Wed Mar 12 22:41:48 2003 UTC revision 1.4 by styxman, Tue Apr 15 20:19:09 2003 UTC
# Line 4  Line 4 
4  <form title="Impresion I.V.A. Ventas" height="7" width="30">  <form title="Impresion I.V.A. Ventas" height="7" width="30">
5    
6    <datasource name="printDataSource" cache="1"/>    <datasource name="printDataSource" cache="1"/>
7    <datasource name="clientSearchDataSource" database="papo"    <datasource name="clientSearchDataSource" database="papo"
8                table="_entity_data, _alien_entity_data, _persona_data, _client_data,                table="_entity_data, _alien_entity_data, _persona_data, _client_data,
9                       _price_type_data, entity_type_uid_conf, _entity_uid_type_data,                       _price_type_data, entity_type_uid_conf, _entity_uid_type_data,
10                       _entity_uid_data" order_by="_entity_data.name">                       _entity_uid_data" order_by="_entity_data.name">
11      <condition>      <condition>
12        <and>        <and>
# Line 77  Line 77 
77    
78    <!-- Origen de datos que srive para calcular el total facturado -->    <!-- Origen de datos que srive para calcular el total facturado -->
79    
80    <datasource name="productInvoiceDataSource" database="papo"    <datasource name="productInvoiceDataSource" database="papo"
81                table="_entity_data, own_document, own_item, own_product_item, _price_data, own_item_tax"                table="_entity_data, own_document, own_item, own_product_invoice_item, _price_data, own_item_tax"
82                order_by="own_document.date">                order_by="own_document.date">
83      <condition>      <condition>
84        <and>        <and>
85          <eq>          <eq>
86            <!-- Aqui se refiere al cliente  -->            <!-- Aqui se refiere al cliente  -->
# Line 93  Line 93 
93          </eq>          </eq>
94          <eq>          <eq>
95            <cfield name="own_item.id"/>            <cfield name="own_item.id"/>
96            <cfield name="own_product_item.own_item"/>            <cfield name="own_product_invoice_item.own_item"/>
97          </eq>          </eq>
98          <eq>          <eq>
99            <cfield name="own_product_item.price"/>            <cfield name="own_product_invoice_item.price"/>
100            <cfield name="_price_data.id"/>            <cfield name="_price_data.id"/>
101          </eq>          </eq>
102          <eq>          <eq>
# Line 105  Line 105 
105          </eq>          </eq>
106          <eq>          <eq>
107            <cfield name="own_document.own_document_type"/>            <cfield name="own_document.own_document_type"/>
108            <cconst value="4"/>            <cconst value="4"/>
109          </eq>          </eq>
110       </and>       </and>
111      </condition>      </condition>
112    </datasource>    </datasource>
113    
114    <datasource name="recipientInvoiceDataSource" database="papo"    <datasource name="recipientInvoiceDataSource" database="papo"
115                table="_entity_data, own_document, own_document_proceeding">                table="_entity_data, own_document, own_document_proceeding">
116      <condition>      <condition>
117        <and>        <and>
118          <eq>          <eq>
119            <!-- Aqui se refiere al cliente  -->            <!-- Aqui se refiere al cliente  -->
# Line 126  Line 126 
126          </eq>          </eq>
127          <eq>          <eq>
128            <cfield name="own_document.own_document_type"/>            <cfield name="own_document.own_document_type"/>
129            <cconst value="3"/>            <cconst value="3"/>
130          </eq>          </eq>
131       </and>       </and>
132      </condition>      </condition>
133    </datasource>    </datasource>
134    
135    <datasource name="invTaxTotDataSource" database="papo"    <datasource name="invTaxTotDataSource" database="papo"
136                table="own_document, own_document_tax">                table="own_document, own_document_tax">
137      <condition>      <condition>
138        <eq>        <eq>
139          <cfield name="own_document.id"/>          <cfield name="own_document.id"/>
140          <cfield name="own_document_tax.own_document"/>          <cfield name="own_document_tax.own_document"/>
141        </eq>        </eq>
142      </condition>      </condition>
143    </datasource>    </datasource>
144    
145    
146    <datasource name="payTotDataSource" database="papo" table="_entity_data, own_document, own_document_proceeding">    <datasource name="payTotDataSource" database="papo" table="_entity_data, own_document, own_document_proceeding">
147      <condition>      <condition>
148        <and>        <and>
149          <eq>          <eq>
150            <!-- Aqui se refiere al cliente  -->            <!-- Aqui se refiere al cliente  -->
151            <cfield name="_entity_data._table"/>            <cfield name="_entity_data._table"/>
152            <cfield name="own_document.recipient"/>            <cfield name="own_document.recipient"/>
153          </eq>          </eq>
154          <eq>          <eq>
# Line 159  Line 159 
159            <or>            <or>
160              <eq>              <eq>
161                <cfield name="own_document.own_document_type"/>                <cfield name="own_document.own_document_type"/>
162                <cconst value="1"/>                <cconst value="1"/>
163              </eq>              </eq>
164              <eq>              <eq>
165                <cfield name="own_document.own_document_type"/>                <cfield name="own_document.own_document_type"/>
166                <cconst value="4"/>                <cconst value="4"/>
167              </eq>              </eq>
168            </or>            </or>
169          </and>          </and>
170        </and>        </and>
171      </condition>      </condition>
172    </datasource>    </datasource>
173    
174    <datasource database="papo" name="ownDocumentDataSource" table="own_document"    <datasource database="papo" name="ownDocumentDataSource" table="own_document"
175      order_by="date" />      order_by="date" />
176    
177     <datasource  name="ownItemDataSource" database="papo" detaillink="own_item.own_document"       <datasource  name="ownItemDataSource" database="papo" detaillink="own_item.own_document"
178       master="ownDocumentDataSource" masterlink="id"         master="ownDocumentDataSource" masterlink="id"
179       table="own_item, own_product_item, own_item_tax">       table="own_item, own_product_invoice_item, own_item_tax">
180      <condition>      <condition>
181        <and>        <and>
182          <eq>          <eq>
183            <cfield name="own_item.id"/>            <cfield name="own_item.id"/>
184            <cfield name="own_product_item.own_item"/>            <cfield name="own_product_invoice_item.own_item"/>
185          </eq>          </eq>
186           <eq>           <eq>
187             <cfield name="own_item.id"/>             <cfield name="own_item.id"/>
188             <cfield name="own_item_tax.own_item"/>             <cfield name="own_item_tax.own_item"/>
189          </eq>            </eq>
190          <eq>          <eq>
191             <cfield name="own_item_tax.tax"/>             <cfield name="own_item_tax.tax"/>
192             <cconst value="1"/>             <cconst value="1"/>
193           </eq>             </eq>
194        </and>        </and>
195      </condition>      </condition>
196    </datasource>    </datasource>
# Line 217  Line 217 
217  if not str(printBlock.printBox.startDateEntry).strip() \  if not str(printBlock.printBox.startDateEntry).strip() \
218     or not str(printBlock.printBox.startDateEntry).strip():     or not str(printBlock.printBox.startDateEntry).strip():
219    genericBox("Las fechas deben tener un valor",['Aceptar'])    genericBox("Las fechas deben tener un valor",['Aceptar'])
220  else:    else:
221    callTrigger('startWaitingModeTrigger')    callTrigger('startWaitingModeTrigger')
222      
223    import gnue.common.GConditions as GConditions    import gnue.common.GConditions as GConditions
224    import string    import string
225    import hack    import hack
226      
227    table = []    table = []
228    line="\n\nListado de IVA Ventas\n\n\n"    line="\n\nListado de IVA Ventas\n\n\n"
229    table.append(line)    table.append(line)
230    line = "|"+"Factura".center(16)+"|"+"Fecha".center(27)+"|"+"Neto".center(14)+"|"+"I.V.A.".center(12)+"|"+"Total".center(14)+"\n"    line = "|"+"Factura".center(16)+"|"+"Fecha".center(27)+"|"+"Neto".center(14)+"|"+"I.V.A.".center(12)+"|"+"Total".center(14)+"\n"
231    table.append(line)    table.append(line)
232      
233    totalNeto = 0    totalNeto = 0
234    totalIVA = 0    totalIVA = 0
235      
236      
237    condProductInvoice = GConditions.GCondition()    condProductInvoice = GConditions.GCondition()
238    tmpAnd = GConditions.GCand(condProductInvoice)    tmpAnd = GConditions.GCand(condProductInvoice)
239    ge = GConditions.GCge(tmpAnd)    ge = GConditions.GCge(tmpAnd)
# Line 242  else: Line 242  else:
242    le = GConditions.GCle(tmpAnd)    le = GConditions.GCle(tmpAnd)
243    GConditions.GCField(le,"own_document.date")    GConditions.GCField(le,"own_document.date")
244    GConditions.GCConst(le,str(printBlock.printBox.endDateEntry))    GConditions.GCConst(le,str(printBlock.printBox.endDateEntry))
245      
246    productInvoiceResultSet = productInvoiceDataSource.createResultSet(condProductInvoice)    productInvoiceResultSet = productInvoiceDataSource.createResultSet(condProductInvoice)
247    more = productInvoiceResultSet.firstRecord()    more = productInvoiceResultSet.firstRecord()
248      
249    while more:    while more:
250        invoiceTotal = 0        invoiceTotal = 0
251        itemTaxTotal = 0                itemTaxTotal = 0
252        currOwnDoc = productInvoiceResultSet.current.getField("own_document.id")        currOwnDoc = productInvoiceResultSet.current.getField("own_document.id")
253      
254        line = "|"+string.ljust(str(productInvoiceResultSet.current.getField("own_document.number")).strip(),16)        line = "|"+string.ljust(str(productInvoiceResultSet.current.getField("own_document.number")).strip(),16)
255        line += "|" + string.rjust(str(productInvoiceResultSet.current.getField("own_document.date")).strip(),27)        line += "|" + string.rjust(str(productInvoiceResultSet.current.getField("own_document.date")).strip(),27)
256        while productInvoiceResultSet.current.getField("own_document.id") == currOwnDoc and more:        while productInvoiceResultSet.current.getField("own_document.id") == currOwnDoc and more:
257          lQty = hack.a2f(productInvoiceResultSet.current.getField("own_product_item.qty"))          lQty = hack.a2f(productInvoiceResultSet.current.getField("own_product_invoice_item.qty"))
258          lUnitPrice = hack.a2f(productInvoiceResultSet.current.getField("_price_data.unit_price"))          lUnitPrice = hack.a2f(productInvoiceResultSet.current.getField("_price_data.unit_price"))
259          lBonus = hack.a2f(productInvoiceResultSet.current.getField("own_item.bonus"))          lBonus = hack.a2f(productInvoiceResultSet.current.getField("own_item.bonus"))
260          lDiscount = hack.a2f(productInvoiceResultSet.current.getField("own_item.discount"))          lDiscount = hack.a2f(productInvoiceResultSet.current.getField("own_item.discount"))
# Line 269  else: Line 269  else:
269        while odt_more:        while odt_more:
270          invoiceTotal += hack.a2f(odt_rs.current.getField("own_document_tax.amount"))          invoiceTotal += hack.a2f(odt_rs.current.getField("own_document_tax.amount"))
271          odt_more = odt_rs.nextRecord()          odt_more = odt_rs.nextRecord()
272                      
273        line += "|" + string.rjust("%0.2f".strip() % hack.a2f(invoiceTotal),14)        line += "|" + string.rjust("%0.2f".strip() % hack.a2f(invoiceTotal),14)
274        line += "|" + string.rjust("%0.2f".strip() % hack.a2f(itemTaxTotal),12)        line += "|" + string.rjust("%0.2f".strip() % hack.a2f(itemTaxTotal),12)
275        line += "|" + string.rjust("%0.2f".strip() % hack.a2f(invoiceTotal + itemTaxTotal),14)        line += "|" + string.rjust("%0.2f".strip() % hack.a2f(invoiceTotal + itemTaxTotal),14)
276        totalIVA += itemTaxTotal        totalIVA += itemTaxTotal
277        totalNeto += invoiceTotal        totalNeto += invoiceTotal
278        table.append(line)        table.append(line)
279      
280    callTrigger('endWaitingModeTrigger')    callTrigger('endWaitingModeTrigger')
281      
282    line = "\n"+"Total".center(46) + string.rjust("%0.2f".strip() % hack.a2f(totalNeto),14) + "|"    line = "\n"+"Total".center(46) + string.rjust("%0.2f".strip() % hack.a2f(totalNeto),14) + "|"
283    line += string.rjust("%0.2f".strip() % hack.a2f(totalIVA),12) + "|" + string.rjust("%0.2f".strip() % hack.a2f(totalIVA + totalNeto),14)    line += string.rjust("%0.2f".strip() % hack.a2f(totalIVA),12) + "|" + string.rjust("%0.2f".strip() % hack.a2f(totalIVA + totalNeto),14)
284    table.append(line)    table.append(line)
285      
286    hack.previewPrint(table)    hack.previewPrint(table)
287      
288      ]]></trigger>      ]]></trigger>
289    
290    <trigger type="NAMED" name="cancelTrigger"><![CDATA[    <trigger type="NAMED" name="cancelTrigger"><![CDATA[
# Line 293  import hack Line 293  import hack
293  ownDocumentBlock.processRollback()  ownDocumentBlock.processRollback()
294    
295      ]]></trigger>      ]]></trigger>
296      
297    <trigger name="startWaitingModeTrigger" type="NAMED"><![CDATA[    <trigger name="startWaitingModeTrigger" type="NAMED"><![CDATA[
298      setStatusText("Procesando ...")      setStatusText("Procesando ...")
299      try:      try:
# Line 324  ownDocumentBlock.processRollback() Line 324  ownDocumentBlock.processRollback()
324      <block datasource="printDataSource" name="printBlock">      <block datasource="printDataSource" name="printBlock">
325        <box height="8" label="Impresion IVA Ventas" name="printBox" width="25" x="1" y="1">        <box height="8" label="Impresion IVA Ventas" name="printBox" width="25" x="1" y="1">
326          <label name="startDateLbl" text="Desde : " x="1" y="1"/>          <label name="startDateLbl" text="Desde : " x="1" y="1"/>
327          <entry name="startDateEntry" typecast="date" x="9" y="1" width="12"/>              <entry name="startDateEntry" typecast="date" x="9" y="1" width="12"/>
328          <label name="startDateLbl" text="Hasta : " x="1" y="2"/>          <label name="startDateLbl" text="Hasta : " x="1" y="2"/>
329          <entry name="endDateEntry" typecast="date" x="9" y="2" width="12"/>              <entry name="endDateEntry" typecast="date" x="9" y="2" width="12"/>
330          <button name="printButton" trigger="printTrigger"          <button name="printButton" trigger="printTrigger"
331            label="Imprimir" width="20" height="1" x="2" y="4"/>            label="Imprimir" width="20" height="1" x="2" y="4"/>
332        </box>        </box>
333      </block>      </block>

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4

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