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"/> |
|
<datasource name="clientSearchDataSource" database="papo" |
|
|
table="_entity_data, _alien_entity_data, _persona_data, _client_data, |
|
|
_price_type_data, entity_type_uid_conf, _entity_uid_type_data, |
|
|
_entity_uid_data" order_by="_entity_data.name"> |
|
|
<condition> |
|
|
<and> |
|
|
<eq> |
|
|
<cfield name="_entity_data._table"/> |
|
|
<cfield name="_alien_entity_data.entity"/> |
|
|
</eq> |
|
|
<eq> |
|
|
<cfield name="_alien_entity_data._table"/> |
|
|
<cfield name="_persona_data.alien_entity"/> |
|
|
</eq> |
|
|
<eq> |
|
|
<cfield name="_persona_data._table"/> |
|
|
<cfield name="_client_data.persona"/> |
|
|
</eq> |
|
|
<eq> |
|
|
<cfield name="_price_type_data._table"/> |
|
|
<cfield name="_client_data.price_type"/> |
|
|
</eq> |
|
|
<eq> |
|
|
<cfield name="_entity_data._table"/> |
|
|
<cfield name="_entity_uid_data.entity"/> |
|
|
</eq> |
|
|
<eq> |
|
|
<cfield name="_entity_uid_data.entity_uid_type"/> |
|
|
<cfield name="_entity_uid_type_data._table"/> |
|
|
</eq> |
|
|
<eq> |
|
|
<cfield name="_entity_type_data._table"/> |
|
|
<cfield name="entity_type_uid_conf.entity_type"/> |
|
|
</eq> |
|
|
<eq> |
|
|
<cfield name="entity_type_uid_conf.entity_type"/> |
|
|
<cconst value="8"/> <!-- Es el id del entity_type correspondiente a cliente --> |
|
|
</eq> |
|
|
<eq> |
|
|
<cfield name="_entity_uid_type_data._table"/> |
|
|
<cfield name="entity_type_uid_conf.entity_uid_type"/> |
|
|
</eq> |
|
|
<null> |
|
|
<cfield name="_entity_data._end_t"/> |
|
|
</null> |
|
|
<null> |
|
|
<cfield name="_alien_entity_data._end_t"/> |
|
|
</null> |
|
|
<null> |
|
|
<cfield name="_persona_data._end_t"/> |
|
|
</null> |
|
|
<null> |
|
|
<cfield name="_client_data._end_t"/> |
|
|
</null> |
|
|
<null> |
|
|
<cfield name="_price_type_data._end_t"/> |
|
|
</null> |
|
|
<null> |
|
|
<cfield name="_entity_uid_data._end_t"/> |
|
|
</null> |
|
|
<null> |
|
|
<cfield name="_entity_type_data._end_t"/> |
|
|
</null> |
|
|
<null> |
|
|
<cfield name="_entity_uid_type_data._end_t"/> |
|
|
</null> |
|
|
</and> |
|
|
</condition> |
|
|
</datasource> |
|
|
|
|
7 |
|
|
8 |
<!-- Origen de datos que srive para calcular el total facturado --> |
<!-- Origen de datos que srive para calcular el total facturado --> |
9 |
|
|
10 |
<datasource name="productInvoiceDataSource" database="papo" |
<datasource name="productInvoiceDataSource" database="papo" |
11 |
table="_entity_data, own_document, own_item, own_product_invoice_item, _price_data, own_item_tax" |
table="_entity_data, own_document, own_item, own_product_invoice_item, _price_data, own_item_tax, _entity_uid_data" |
12 |
order_by="own_document.date"> |
order_by="own_document.date"> |
13 |
<condition> |
<condition> |
14 |
<and> |
<and> |
34 |
<cfield name="own_item_tax.own_item"/> |
<cfield name="own_item_tax.own_item"/> |
35 |
</eq> |
</eq> |
36 |
<eq> |
<eq> |
37 |
<cfield name="own_document.own_document_type"/> |
<cfield name="_entity_data._table"/> |
38 |
<cconst value="4"/> |
<cfield name="_entity_uid_data.entity"/> |
39 |
|
</eq> |
40 |
|
<eq> |
41 |
|
<cfield name="_entity_uid_data.entity_uid_type"/> |
42 |
|
<cconst value="1"/> |
43 |
</eq> |
</eq> |
44 |
|
<or> |
45 |
|
<null> |
46 |
|
<cfield name="_entity_uid_data._end_t"/> |
47 |
|
</null> |
48 |
|
<and> |
49 |
|
<le> |
50 |
|
<cfield name="_entity_uid_data._start_t"/> |
51 |
|
<cfield name="own_document.date"/> |
52 |
|
</le> |
53 |
|
<le> |
54 |
|
<cfield name="own_document.date"/> |
55 |
|
<cfield name="_entity_uid_data._end_t"/> |
56 |
|
</le> |
57 |
|
</and> |
58 |
|
</or> |
59 |
|
<or> |
60 |
|
<eq> |
61 |
|
<cfield name="own_document.own_document_type"/> |
62 |
|
<cconst value="8"/> |
63 |
|
</eq> |
64 |
|
<eq> |
65 |
|
<cfield name="own_document.own_document_type"/> |
66 |
|
<cconst value="9"/> |
67 |
|
</eq> |
68 |
|
<eq> |
69 |
|
<cfield name="own_document.own_document_type"/> |
70 |
|
<cconst value="4"/> |
71 |
|
</eq> |
72 |
|
</or> |
73 |
</and> |
</and> |
74 |
</condition> |
</condition> |
75 |
</datasource> |
</datasource> |
186 |
import gnue.common.GConditions as GConditions |
import gnue.common.GConditions as GConditions |
187 |
import string |
import string |
188 |
import hack |
import hack |
189 |
|
import printing |
190 |
|
|
191 |
table = [] |
table = [] |
192 |
line="\n\nListado de IVA Ventas\n\n\n" |
line="\n\nListado de IVA Ventas\n\n\n" |
193 |
table.append(line) |
table.append(line) |
|
line = "|"+"Factura".center(16)+"|"+"Fecha".center(27)+"|"+"Neto".center(14)+"|"+"I.V.A.".center(12)+"|"+"Total".center(14)+"\n" |
|
|
table.append(line) |
|
194 |
|
|
195 |
|
line = "|" + printing.printTitle("Fecha",10) + "|" + printing.printTitle("Factura",18) + "|" |
196 |
|
line += printing.printTitle("Cliente",30) + "|" + printing.printTitle("C.U.I.T",15) + "|" |
197 |
|
line += printing.printTitle("Neto",14) + "|" + printing.printTitle("I.V.A.",12) + "|" |
198 |
|
line += printing.printTitle("Total",14)+"\n" |
199 |
|
table.append(line) |
200 |
|
|
201 |
totalNeto = 0 |
totalNeto = 0 |
202 |
totalIVA = 0 |
totalIVA = 0 |
203 |
|
documentType={'4': 'A', '9':'C', '8':'B'} |
204 |
|
|
205 |
condProductInvoice = GConditions.GCondition() |
condProductInvoice = GConditions.GCondition() |
206 |
tmpAnd = GConditions.GCand(condProductInvoice) |
tmpAnd = GConditions.GCand(condProductInvoice) |
207 |
ge = GConditions.GCge(tmpAnd) |
ge = GConditions.GCge(tmpAnd) |
219 |
itemTaxTotal = 0 |
itemTaxTotal = 0 |
220 |
currOwnDoc = productInvoiceResultSet.current.getField("own_document.id") |
currOwnDoc = productInvoiceResultSet.current.getField("own_document.id") |
221 |
|
|
222 |
line = "|"+string.ljust(str(productInvoiceResultSet.current.getField("own_document.number")).strip(),16) |
line = "|" + printing.printField(productInvoiceResultSet.current.getField("own_document.date"),10) |
223 |
line += "|" + string.rjust(str(productInvoiceResultSet.current.getField("own_document.date")).strip(),27) |
line += "|"+ printing.printField(documentType[str(productInvoiceResultSet.current.getField("own_document.own_document_type")).strip()],1)+"-" |
224 |
|
line += printing.printField(productInvoiceResultSet.current.getField("own_document.number"),16) |
225 |
|
line += "|"+printing.printField(productInvoiceResultSet.current.getField("_entity_data.name"),30) |
226 |
|
line += "|"+printing.printField(productInvoiceResultSet.current.getField("_entity_uid_data.uid"),15) |
227 |
while productInvoiceResultSet.current.getField("own_document.id") == currOwnDoc and more: |
while productInvoiceResultSet.current.getField("own_document.id") == currOwnDoc and more: |
228 |
lQty = hack.a2f(productInvoiceResultSet.current.getField("own_product_invoice_item.qty")) |
lQty = hack.a2f(productInvoiceResultSet.current.getField("own_product_invoice_item.qty")) |
229 |
lUnitPrice = hack.a2f(productInvoiceResultSet.current.getField("_price_data.unit_price")) |
lUnitPrice = hack.a2f(productInvoiceResultSet.current.getField("_price_data.unit_price")) |
241 |
invoiceTotal += hack.a2f(odt_rs.current.getField("own_document_tax.amount")) |
invoiceTotal += hack.a2f(odt_rs.current.getField("own_document_tax.amount")) |
242 |
odt_more = odt_rs.nextRecord() |
odt_more = odt_rs.nextRecord() |
243 |
|
|
244 |
line += "|" + string.rjust("%0.2f".strip() % hack.a2f(invoiceTotal),14) |
line += "|" + printing.printField("%0.2f".strip() % hack.a2f(invoiceTotal),14,'r') |
245 |
line += "|" + string.rjust("%0.2f".strip() % hack.a2f(itemTaxTotal),12) |
line += "|" + printing.printField("%0.2f".strip() % hack.a2f(itemTaxTotal),12,'r') |
246 |
line += "|" + string.rjust("%0.2f".strip() % hack.a2f(invoiceTotal + itemTaxTotal),14) |
line += "|" + printing.printField("%0.2f".strip() % hack.a2f(itemTaxTotal + invoiceTotal),14,'r') |
247 |
totalIVA += itemTaxTotal |
totalIVA += itemTaxTotal |
248 |
totalNeto += invoiceTotal |
totalNeto += invoiceTotal |
249 |
table.append(line) |
table.append(line) |
250 |
|
|
251 |
callTrigger('endWaitingModeTrigger') |
callTrigger('endWaitingModeTrigger') |
252 |
|
|
253 |
line = "\n"+"Total".center(46) + string.rjust("%0.2f".strip() % hack.a2f(totalNeto),14) + "|" |
line = "\n"+printing.printField("Total",77,'r') + "|" |
254 |
line += string.rjust("%0.2f".strip() % hack.a2f(totalIVA),12) + "|" + string.rjust("%0.2f".strip() % hack.a2f(totalIVA + totalNeto),14) |
line += printing.printField("%0.2f".strip() % hack.a2f(totalNeto),14,'r') + "|" |
255 |
|
line += printing.printField("%0.2f".strip() % hack.a2f(totalIVA),12,'r') + "|" |
256 |
|
line += printing.printField("%0.2f".strip() % hack.a2f(totalIVA + totalNeto),14,'r') |
257 |
table.append(line) |
table.append(line) |
258 |
|
|
259 |
hack.previewPrint(table) |
hack.previewPrint(table) |