1 |
<?xml version="1.0" encoding="ISO-8859-1"?> |
<?xml version="1.0" encoding="ISO-8859-1"?> |
2 |
<!DOCTYPE form SYSTEM "gnue-forms.dtd"> |
<!DOCTYPE form SYSTEM "gnue-forms.dtd"> |
3 |
|
|
4 |
<form title="Impresion I.V.A. Ventas" height="3" width="30"> |
<form title="Impresion I.V.A. Ventas" height="7" width="30"> |
5 |
|
|
6 |
|
<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, |
214 |
|
|
215 |
<trigger type="NAMED" name="printTrigger"><![CDATA[ |
<trigger type="NAMED" name="printTrigger"><![CDATA[ |
216 |
|
|
217 |
callTrigger('startWaitingModeTrigger') |
if not str(printBlock.printBox.startDateEntry).strip() \ |
218 |
|
or not str(printBlock.printBox.startDateEntry).strip(): |
219 |
import gnue.common.GConditions as GConditions |
genericBox("Las fechas deben tener un valor",['Aceptar']) |
220 |
import string |
else: |
221 |
import hack |
callTrigger('startWaitingModeTrigger') |
222 |
|
|
223 |
table = [] |
import gnue.common.GConditions as GConditions |
224 |
line="\n\nListado de IVA Ventas\n\n\n" |
import string |
225 |
table.append(line) |
import hack |
226 |
line = "Factura".center(10)+" | "+"Fecha".center(30)+" | "+"Neto".center(14)+" | "+"I.V.A.".center(14)+" | "+"Total".center(14)+"\n" |
|
227 |
table.append(line) |
table = [] |
228 |
|
line="\n\nListado de IVA Ventas\n\n\n" |
229 |
totalNeto = 0 |
table.append(line) |
230 |
totalIVA = 0 |
line = "|"+"Factura".center(16)+"|"+"Fecha".center(27)+"|"+"Neto".center(14)+"|"+"I.V.A.".center(12)+"|"+"Total".center(14)+"\n" |
231 |
|
table.append(line) |
232 |
condProductInvoice = GConditions.GCondition() |
|
233 |
productInvoiceResultSet = productInvoiceDataSource.createResultSet(condProductInvoice) |
totalNeto = 0 |
234 |
more = productInvoiceResultSet.firstRecord() |
totalIVA = 0 |
235 |
|
|
236 |
while more: |
|
237 |
invoiceTotal = 0 |
condProductInvoice = GConditions.GCondition() |
238 |
itemTaxTotal = 0 |
tmpAnd = GConditions.GCand(condProductInvoice) |
239 |
currOwnDoc = productInvoiceResultSet.current.getField("own_document.id") |
ge = GConditions.GCge(tmpAnd) |
240 |
|
GConditions.GCField(ge,"own_document.date") |
241 |
line = string.rjust(str(productInvoiceResultSet.current.getField("own_document.number")),10) |
GConditions.GCConst(ge,str(printBlock.printBox.startDateEntry)) |
242 |
line += "|" + string.rjust(str(productInvoiceResultSet.current.getField("own_document.date")),10) |
le = GConditions.GCle(tmpAnd) |
243 |
while productInvoiceResultSet.current.getField("own_document.id") == currOwnDoc and more: |
GConditions.GCField(le,"own_document.date") |
244 |
lQty = hack.a2f(productInvoiceResultSet.current.getField("own_product_item.qty")) |
GConditions.GCConst(le,str(printBlock.printBox.endDateEntry)) |
245 |
lUnitPrice = hack.a2f(productInvoiceResultSet.current.getField("_price_data.unit_price")) |
|
246 |
lBonus = hack.a2f(productInvoiceResultSet.current.getField("own_item.bonus")) |
productInvoiceResultSet = productInvoiceDataSource.createResultSet(condProductInvoice) |
247 |
lDiscount = hack.a2f(productInvoiceResultSet.current.getField("own_item.discount")) |
more = productInvoiceResultSet.firstRecord() |
248 |
item = lQty * lUnitPrice - lBonus - lDiscount |
|
249 |
currItem = productInvoiceResultSet.current.getField("own_item.id") |
while more: |
250 |
while productInvoiceResultSet.current.getField("own_item.id") == currItem and more: |
invoiceTotal = 0 |
251 |
itemTaxTotal += hack.a2f(productInvoiceResultSet.current.getField("own_item_tax.amount")) |
itemTaxTotal = 0 |
252 |
more = productInvoiceResultSet.nextRecord() |
currOwnDoc = productInvoiceResultSet.current.getField("own_document.id") |
253 |
invoiceTotal += item |
|
254 |
odt_rs = invTaxTotDataSource.createResultSet({"own_document.id":currOwnDoc}) |
line = "|"+string.ljust(str(productInvoiceResultSet.current.getField("own_document.number")).strip(),16) |
255 |
odt_more = odt_rs.firstRecord() |
line += "|" + string.rjust(str(productInvoiceResultSet.current.getField("own_document.date")).strip(),27) |
256 |
while odt_more: |
while productInvoiceResultSet.current.getField("own_document.id") == currOwnDoc and more: |
257 |
invoiceTotal += hack.a2f(odt_rs.current.getField("own_document_tax.amount")) |
lQty = hack.a2f(productInvoiceResultSet.current.getField("own_product_item.qty")) |
258 |
odt_more = odt_rs.nextRecord() |
lUnitPrice = hack.a2f(productInvoiceResultSet.current.getField("_price_data.unit_price")) |
259 |
|
lBonus = hack.a2f(productInvoiceResultSet.current.getField("own_item.bonus")) |
260 |
line += "|" + string.rjust(str(invoiceTotal),10) |
lDiscount = hack.a2f(productInvoiceResultSet.current.getField("own_item.discount")) |
261 |
line += "|" + string.rjust(str(itemTaxTotal),10) |
item = lQty * lUnitPrice - lBonus - lDiscount |
262 |
line += "|" + string.rjust(str(invoiceTotal + itemTaxTotal),10) |
currItem = productInvoiceResultSet.current.getField("own_item.id") |
263 |
totalIVA += itemTaxTotal |
while productInvoiceResultSet.current.getField("own_item.id") == currItem and more: |
264 |
totalNeto += invoiceTotal |
itemTaxTotal += hack.a2f(productInvoiceResultSet.current.getField("own_item_tax.amount")) |
265 |
table.append(line) |
more = productInvoiceResultSet.nextRecord() |
266 |
|
invoiceTotal += item |
267 |
callTrigger('endWaitingModeTrigger') |
odt_rs = invTaxTotDataSource.createResultSet({"own_document.id":currOwnDoc}) |
268 |
|
odt_more = odt_rs.firstRecord() |
269 |
line = "Total".center(43) + string.rjust(str(totalNeto),10) + "|" |
while odt_more: |
270 |
line += string.rjust(str(totalIVA),10) + "|" + string.rjust(str(totalIVA + totalNeto),10) |
invoiceTotal += hack.a2f(odt_rs.current.getField("own_document_tax.amount")) |
271 |
table.append(line) |
odt_more = odt_rs.nextRecord() |
272 |
|
|
273 |
hack.previewPrint(table) |
line += "|" + string.rjust("%0.2f".strip() % hack.a2f(invoiceTotal),14) |
274 |
|
line += "|" + string.rjust("%0.2f".strip() % hack.a2f(itemTaxTotal),12) |
275 |
|
line += "|" + string.rjust("%0.2f".strip() % hack.a2f(invoiceTotal + itemTaxTotal),14) |
276 |
|
totalIVA += itemTaxTotal |
277 |
|
totalNeto += invoiceTotal |
278 |
|
table.append(line) |
279 |
|
|
280 |
|
callTrigger('endWaitingModeTrigger') |
281 |
|
|
282 |
|
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) |
284 |
|
table.append(line) |
285 |
|
|
286 |
|
hack.previewPrint(table) |
287 |
|
|
288 |
]]></trigger> |
]]></trigger> |
289 |
|
|
290 |
<trigger type="NAMED" name="cancelTrigger"><![CDATA[ |
<trigger type="NAMED" name="cancelTrigger"><![CDATA[ |
321 |
|
|
322 |
<page name="Impresion IVA Ventas"> |
<page name="Impresion IVA Ventas"> |
323 |
|
|
324 |
<block datasource="ownDocumentDataSource" name="printBlock"> |
<block datasource="printDataSource" name="printBlock"> |
325 |
<box height="4" label="Impresion IVA Ventas" name="printBox" width="25" x="2" 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"/> |
327 |
|
<entry name="startDateEntry" typecast="date" x="9" y="1" width="12"/> |
328 |
|
<label name="startDateLbl" text="Hasta : " x="1" y="2"/> |
329 |
|
<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="1"/> |
label="Imprimir" width="20" height="1" x="2" y="4"/> |
332 |
</box> |
</box> |
333 |
</block> |
</block> |
334 |
|
|