72 |
<cfield name="alien_document.alien_document_type"/> |
<cfield name="alien_document.alien_document_type"/> |
73 |
<cconst value="10"/> |
<cconst value="10"/> |
74 |
</eq> |
</eq> |
75 |
|
<!-- provider credit notes --> |
76 |
|
<eq> |
77 |
|
<cfield name="alien_document.alien_document_type"/> |
78 |
|
<cconst value="18"/> |
79 |
|
</eq> |
80 |
|
<eq> |
81 |
|
<cfield name="alien_document.alien_document_type"/> |
82 |
|
<cconst value="19"/> |
83 |
|
</eq> |
84 |
|
<eq> |
85 |
|
<cfield name="alien_document.alien_document_type"/> |
86 |
|
<cconst value="20"/> |
87 |
|
</eq> |
88 |
</or> |
</or> |
89 |
</and> |
</and> |
90 |
</condition> |
</condition> |
110 |
line="\n\nListado de IVA Compras\n\n\n" |
line="\n\nListado de IVA Compras\n\n\n" |
111 |
table.append(line) |
table.append(line) |
112 |
|
|
113 |
line = "|" + printing.printTitle("Fecha",10) + "|" + printing.printTitle("Factura",18) + "|" |
line = "|" + printing.printTitle("Fecha",10) + "|" + printing.printTitle("Comprobante",21) + "|" |
114 |
line += printing.printTitle("Proveedor",30) + "|" + printing.printTitle("C.U.I.T",15) + "|" |
line += printing.printTitle("Proveedor",30) + "|" + printing.printTitle("C.U.I.T",15) + "|" |
115 |
line += printing.printTitle("Neto",14) + "|" + printing.printTitle("I.V.A.",12) + "|" |
line += printing.printTitle("Neto",14) + "|" + printing.printTitle("I.V.A.",12) + "|" |
116 |
line += printing.printTitle("Total",14)+"\n" |
line += printing.printTitle("Total",14)+"\n" |
130 |
|
|
131 |
totalNeto = 0 |
totalNeto = 0 |
132 |
totalIVA = 0 |
totalIVA = 0 |
133 |
documentType={'2': 'A', '10':'C', '11':'B'} |
documentType={'2': 'FAC A', '10':'FAC C', '11':'FAC B','18':'NCR A','20':'NCR C','19':'NCR B'} |
134 |
|
documentSign={'2': '1', '10':'1', '11':'1','18':'-1', '20':'-1', '19':'-1'} |
135 |
|
|
136 |
while more: |
while more: |
137 |
invoiceTotal = 0 |
invoiceTotal = 0 |
138 |
itemTaxTotal = 0 |
itemTaxTotal = 0 |
139 |
currAlienDoc = productInvoiceResultSet.current.getField("alien_document.id") |
currAlienDoc = productInvoiceResultSet.current.getField("alien_document.id") |
140 |
line = "|" + printing.printField(productInvoiceResultSet.current.getField("alien_document.date"),10) |
line = "|" + printing.printField(productInvoiceResultSet.current.getField("alien_document.date"),10) |
141 |
line += "|"+ printing.printField(documentType[str(productInvoiceResultSet.current.getField("alien_document.alien_document_type")).strip()],1)+"-" |
line += "|"+ printing.printField(documentType[str(productInvoiceResultSet.current.getField("alien_document.alien_document_type")).strip()],5)+" " |
142 |
line += printing.printField(productInvoiceResultSet.current.getField("alien_document.number"),16) |
line += printing.printField(productInvoiceResultSet.current.getField("alien_document.number"),15) |
143 |
line += "|"+printing.printField(productInvoiceResultSet.current.getField("_entity_data.name"),30) |
line += "|"+printing.printField(productInvoiceResultSet.current.getField("_entity_data.name"),30) |
144 |
line += "|"+printing.printField(productInvoiceResultSet.current.getField("_entity_uid_data.uid"),15) |
line += "|"+printing.printField(productInvoiceResultSet.current.getField("_entity_uid_data.uid"),15) |
145 |
|
sign= documentSign[str(productInvoiceResultSet.current.getField("alien_document.alien_document_type")).strip()] |
146 |
while productInvoiceResultSet.current.getField("alien_document.id") == currAlienDoc and more: |
while productInvoiceResultSet.current.getField("alien_document.id") == currAlienDoc and more: |
147 |
lQty = hack.a2f(productInvoiceResultSet.current.getField("alien_product_item.qty")) |
lQty = hack.a2f(productInvoiceResultSet.current.getField("alien_product_item.qty")) |
148 |
lUnitPrice = hack.a2f(productInvoiceResultSet.current.getField("alien_product_item.unit_price")) |
lUnitPrice = hack.a2f(productInvoiceResultSet.current.getField("alien_product_item.unit_price")) |
150 |
lDiscount = hack.a2f(productInvoiceResultSet.current.getField("alien_item.discount")) |
lDiscount = hack.a2f(productInvoiceResultSet.current.getField("alien_item.discount")) |
151 |
item = lQty * lUnitPrice - lBonus - lDiscount |
item = lQty * lUnitPrice - lBonus - lDiscount |
152 |
currItem = productInvoiceResultSet.current.getField("alien_item.id") |
currItem = productInvoiceResultSet.current.getField("alien_item.id") |
153 |
while productInvoiceResultSet.current.getField("alien_item.id") == currItem and more: |
#no olvidarse de la condicion de next |
154 |
|
while productInvoiceResultSet.current.getField("alien_item.id") == currItem and productInvoiceResultSet.current.getField("alien_document.id") == currAlienDoc and more: |
155 |
itemTaxTotal += hack.a2f(productInvoiceResultSet.current.getField("alien_item_tax.amount")) |
itemTaxTotal += hack.a2f(productInvoiceResultSet.current.getField("alien_item_tax.amount")) |
156 |
more = productInvoiceResultSet.nextRecord() |
more = productInvoiceResultSet.nextRecord() |
157 |
invoiceTotal += item |
invoiceTotal += item |
160 |
while odt_more: |
while odt_more: |
161 |
invoiceTotal += hack.a2f(odt_rs.current.getField("alien_document_tax.amount")) |
invoiceTotal += hack.a2f(odt_rs.current.getField("alien_document_tax.amount")) |
162 |
odt_more = odt_rs.nextRecord() |
odt_more = odt_rs.nextRecord() |
163 |
|
#signo del comprobante |
164 |
line += "|" + printing.printField("%0.2f".strip() % hack.a2f(invoiceTotal),14,'r') |
itemTaxTotal = itemTaxTotal * hack.a2f(sign) |
165 |
line += "|" + printing.printField("%0.2f".strip() % hack.a2f(itemTaxTotal),12,'r') |
invoiceTotal = invoiceTotal * hack.a2f(sign) |
166 |
line += "|" + printing.printField("%0.2f".strip() % hack.a2f(itemTaxTotal + invoiceTotal),14,'r') |
#imprimo con formato account |
167 |
|
line += "|" + printing.printAccount(invoiceTotal,14) |
168 |
|
line += "|" + printing.printAccount(itemTaxTotal,12) |
169 |
|
line += "|" + printing.printAccount((itemTaxTotal + invoiceTotal),14) |
170 |
totalIVA += itemTaxTotal |
totalIVA += itemTaxTotal |
171 |
totalNeto += invoiceTotal |
totalNeto += invoiceTotal |
172 |
table.append(line) |
table.append(line) |
173 |
|
|
174 |
callTrigger('endWaitingModeTrigger') |
callTrigger('endWaitingModeTrigger') |
175 |
|
|
176 |
line = "\n"+printing.printField("Total",77,'r') + "|" |
line = "\n"+printing.printField("Total",80,'r') + "|" |
177 |
line += printing.printField("%0.2f".strip() % hack.a2f(totalNeto),14,'r') + "|" |
line += printing.printAccount(totalNeto,14) + "|" |
178 |
line += printing.printField("%0.2f".strip() % hack.a2f(totalIVA),12,'r') + "|" |
line += printing.printAccount(totalIVA,12) + "|" |
179 |
line += printing.printField("%0.2f".strip() % hack.a2f(totalIVA + totalNeto),14,'r') |
line += printing.printAccount((totalIVA + totalNeto),14) |
180 |
table.append(line) |
table.append(line) |
181 |
|
|
182 |
printing.previewPrint(table,"xless") |
printing.previewPrint(table,"xless") |