301 |
tmpInvToPayedBlock.numberEntry = str(productInvoiceResultSet.current.getField("own_document.number")) |
tmpInvToPayedBlock.numberEntry = str(productInvoiceResultSet.current.getField("own_document.number")) |
302 |
tmpInvToPayedBlock.dateEntry = str(productInvoiceResultSet.current.getField("own_document.date")) |
tmpInvToPayedBlock.dateEntry = str(productInvoiceResultSet.current.getField("own_document.date")) |
303 |
while productInvoiceResultSet.current.getField("own_document.id") == currOwnDoc and more: |
while productInvoiceResultSet.current.getField("own_document.id") == currOwnDoc and more: |
304 |
lQty = hack.a2f(productInvoiceResultSet.current.getField("own_product_item.qty")) |
lQty = hack.a2f(productInvoiceResultSet.current.getField("own_product_item.qty"),2) |
305 |
lUnitPrice = hack.a2f(productInvoiceResultSet.current.getField("own_product_item.unit_price")) |
lUnitPrice = hack.a2f(productInvoiceResultSet.current.getField("own_product_item.unit_price"),2) |
306 |
lBonus = hack.a2f(productInvoiceResultSet.current.getField("own_item.bonus")) |
lBonus = hack.a2f(productInvoiceResultSet.current.getField("own_item.bonus"),2) |
307 |
lDiscount = hack.a2f(productInvoiceResultSet.current.getField("own_item.discount")) |
lDiscount = hack.a2f(productInvoiceResultSet.current.getField("own_item.discount"),2) |
308 |
item = lQty * lUnitPrice - lBonus - lDiscount |
item = round(lQty * lUnitPrice - lBonus - lDiscount,2) |
309 |
#print "qty %d * unit_price %d - bonus %d - discount %d = %d " % (lQty, lUnitPrice, lBonus, lDiscount, lQty * lUnitPrice - lBonus - lDiscount) |
#print "qty %d * unit_price %d - bonus %d - discount %d = %d " % (lQty, lUnitPrice, lBonus, lDiscount, lQty * lUnitPrice - lBonus - lDiscount) |
310 |
itemTaxTotal = 0 |
itemTaxTotal = 0 |
311 |
currItem = productInvoiceResultSet.current.getField("own_item.id") |
currItem = productInvoiceResultSet.current.getField("own_item.id") |
312 |
while productInvoiceResultSet.current.getField("own_item.id") == currItem and more: |
while productInvoiceResultSet.current.getField("own_item.id") == currItem and more: |
313 |
itemTaxTotal += hack.a2f(productInvoiceResultSet.current.getField("own_item_tax.amount")) |
itemTaxTotal += hack.a2f(productInvoiceResultSet.current.getField("own_item_tax.amount"),2) |
314 |
more = productInvoiceResultSet.nextRecord() |
more = productInvoiceResultSet.nextRecord() |
315 |
invoiceTotal += item + itemTaxTotal |
invoiceTotal += round(item + itemTaxTotal,2) |
316 |
# Calcula los impuestos del documento en si |
# Calcula los impuestos del documento en si |
317 |
odt_rs = ownDocumentTaxTotDataSource.createResultSet({"own_document.id":currOwnDoc}) |
odt_rs = ownDocumentTaxTotDataSource.createResultSet({"own_document.id":currOwnDoc}) |
318 |
odt_more = odt_rs.firstRecord() |
odt_more = odt_rs.firstRecord() |
319 |
while odt_more: |
while odt_more: |
320 |
invoiceTotal += hack.a2f(odt_rs.current.getField("own_document_tax.amount")) |
invoiceTotal += hack.a2f(odt_rs.current.getField("own_document_tax.amount"),2) |
321 |
odt_more = odt_rs.nextRecord() |
odt_more = odt_rs.nextRecord() |
322 |
|
|
323 |
tmpInvToPayedBlock.amountEntry = str(invoiceTotal) |
tmpInvToPayedBlock.amountEntry = str(invoiceTotal) |
329 |
rc = tmpInvToPayedBlock.getRecordCount() |
rc = tmpInvToPayedBlock.getRecordCount() |
330 |
for recNum in range(rc): |
for recNum in range(rc): |
331 |
tmpInvToPayedBlock.jumpRecord(recNum) |
tmpInvToPayedBlock.jumpRecord(recNum) |
332 |
if hack.a2f(tmpInvToPayedBlock.idEntry) == hack.a2f(rs.current.getField("own_document_proceeding.own_document")): |
if hack.a2f(tmpInvToPayedBlock.idEntry,2) == hack.a2f(rs.current.getField("own_document_proceeding.own_document"),2): |
333 |
tmpInvToPayedBlock.payedEntry = str( |
tmpInvToPayedBlock.payedEntry = str(round( |
334 |
hack.a2f(tmpInvToPayedBlock.payedEntry) + \ |
hack.a2f(tmpInvToPayedBlock.payedEntry,2) + \ |
335 |
hack.a2f(rs.current.getField("own_document_proceeding.amount") ) ) |
hack.a2f(rs.current.getField("own_document_proceeding.amount"),2),2)) |
336 |
more = rs.nextRecord() |
more = rs.nextRecord() |
337 |
|
|
338 |
# Busco las que ya han sido pagadas y lleno el block de pedido |
# Busco las que ya han sido pagadas y lleno el block de pedido |
339 |
rc = tmpInvToPayedBlock.getRecordCount() |
rc = tmpInvToPayedBlock.getRecordCount() |
340 |
for recNum in range(rc): |
for recNum in range(rc): |
341 |
tmpInvToPayedBlock.jumpRecord(recNum) |
tmpInvToPayedBlock.jumpRecord(recNum) |
342 |
if hack.a2f(tmpInvToPayedBlock.payedEntry) < hack.a2f(tmpInvToPayedBlock.amountEntry): |
if hack.a2f(tmpInvToPayedBlock.payedEntry,2) < hack.a2f(tmpInvToPayedBlock.amountEntry,2): |
343 |
if not invoiceToPayedBlock.getCurrentRecord().isEmpty(): |
if not invoiceToPayedBlock.getCurrentRecord().isEmpty(): |
344 |
invoiceToPayedBlock.newRecord() |
invoiceToPayedBlock.newRecord() |
345 |
invoiceToPayedBlock.invoiceBox.idEntry = str(tmpInvToPayedBlock.idEntry) |
invoiceToPayedBlock.invoiceBox.idEntry = str(tmpInvToPayedBlock.idEntry) |
347 |
invoiceToPayedBlock.invoiceBox.dateEntry = str(tmpInvToPayedBlock.dateEntry) |
invoiceToPayedBlock.invoiceBox.dateEntry = str(tmpInvToPayedBlock.dateEntry) |
348 |
invoiceToPayedBlock.invoiceBox.amountEntry = str(tmpInvToPayedBlock.amountEntry) |
invoiceToPayedBlock.invoiceBox.amountEntry = str(tmpInvToPayedBlock.amountEntry) |
349 |
invoiceToPayedBlock.invoiceBox.payedEntry = str(tmpInvToPayedBlock.payedEntry) |
invoiceToPayedBlock.invoiceBox.payedEntry = str(tmpInvToPayedBlock.payedEntry) |
350 |
invoiceToPayedBlock.invoiceBox.payEntry = str( |
invoiceToPayedBlock.invoiceBox.payEntry = str(round( |
351 |
hack.a2f(tmpInvToPayedBlock.amountEntry) - \ |
hack.a2f(tmpInvToPayedBlock.amountEntry,2) - \ |
352 |
hack.a2f(tmpInvToPayedBlock.payedEntry)) |
hack.a2f(tmpInvToPayedBlock.payedEntry,2),2)) |
353 |
total += hack.a2f(invoiceToPayedBlock.invoiceBox.payEntry) |
total += hack.a2f(invoiceToPayedBlock.invoiceBox.payEntry,2) |
354 |
|
|
355 |
invoiceToPayedBlock.invoiceBox.totalEntry = str(total) |
invoiceToPayedBlock.invoiceBox.totalEntry = str(round(total,2)) |
356 |
callTrigger('endWaitingModeTrigger') |
callTrigger('endWaitingModeTrigger') |
357 |
|
|
358 |
]]></trigger> |
]]></trigger> |
410 |
rc = invoiceToPayedBlock.getRecordCount() |
rc = invoiceToPayedBlock.getRecordCount() |
411 |
for recNum in range(rc): |
for recNum in range(rc): |
412 |
invoiceToPayedBlock.jumpRecord(recNum) |
invoiceToPayedBlock.jumpRecord(recNum) |
413 |
if hack.a2f(invoiceToPayedBlock.invoiceBox.payEntry) > 0: |
if hack.a2f(invoiceToPayedBlock.invoiceBox.payEntry,2) > 0: |
414 |
line = "| " |
line = "| " |
415 |
line += printing.printField(invoiceToPayedBlock.invoiceBox.numberEntry,14,'r') + " | " |
line += printing.printField(invoiceToPayedBlock.invoiceBox.numberEntry,14,'r') + " | " |
416 |
line += printing.printField(invoiceToPayedBlock.invoiceBox.dateEntry,20,'r') + " | " |
line += printing.printField(invoiceToPayedBlock.invoiceBox.dateEntry,20,'r') + " | " |
438 |
rc = currencyTypeBlock.getRecordCount() |
rc = currencyTypeBlock.getRecordCount() |
439 |
for recNum in range(rc): |
for recNum in range(rc): |
440 |
currencyTypeBlock.jumpRecord(recNum) |
currencyTypeBlock.jumpRecord(recNum) |
441 |
if hack.a2f(currencyTypeBlock.currencyBox.payEntry) > 0: |
if hack.a2f(currencyTypeBlock.currencyBox.payEntry,2) > 0: |
442 |
if not currencyMovementBlock.getCurrentRecord().isEmpty(): |
if not currencyMovementBlock.getCurrentRecord().isEmpty(): |
443 |
currencyMovementBlock.newRecord() |
currencyMovementBlock.newRecord() |
444 |
currencyMovementBlock.proceedingEntry = str(proceedingBlock.idEntry) |
currencyMovementBlock.proceedingEntry = str(proceedingBlock.idEntry) |
445 |
currencyMovementBlock.movementTypeEntry = "" # Revisar com queda esto |
currencyMovementBlock.movementTypeEntry = "" # Revisar com queda esto |
446 |
currencyMovementBlock.currencyTypeEntry = str(currencyTypeBlock.currencyBox.idEntry) |
currencyMovementBlock.currencyTypeEntry = str(currencyTypeBlock.currencyBox.idEntry) |
447 |
currencyMovementBlock.amountEntry = str(hack.a2f(currencyTypeBlock.currencyBox.payEntry) * hack.a2f(currencyTypeBlock.currencyBox.rateEntry)) |
currencyMovementBlock.amountEntry = str(round(hack.a2f(currencyTypeBlock.currencyBox.payEntry,2) * hack.a2f(currencyTypeBlock.currencyBox.rateEntry,2),2)) |
448 |
currencyMovementBlock.postChanges() |
currencyMovementBlock.postChanges() |
449 |
error += 1 |
error += 1 |
450 |
rc = invoiceToPayedBlock.getRecordCount() |
rc = invoiceToPayedBlock.getRecordCount() |
451 |
for recNum in range(rc): |
for recNum in range(rc): |
452 |
invoiceToPayedBlock.jumpRecord(recNum) |
invoiceToPayedBlock.jumpRecord(recNum) |
453 |
if hack.a2f(invoiceToPayedBlock.invoiceBox.payEntry) > 0: |
if hack.a2f(invoiceToPayedBlock.invoiceBox.payEntry,2) > 0: |
454 |
if not ownDocumentProceedingBlock.getCurrentRecord().isEmpty(): |
if not ownDocumentProceedingBlock.getCurrentRecord().isEmpty(): |
455 |
ownDocumentProceedingBlock.newRecord() |
ownDocumentProceedingBlock.newRecord() |
456 |
ownDocumentProceedingBlock.proceedingEntry = str(proceedingBlock.idEntry) |
ownDocumentProceedingBlock.proceedingEntry = str(proceedingBlock.idEntry) |
478 |
|
|
479 |
for recNum in range(rc): |
for recNum in range(rc): |
480 |
invoiceToPayedBlock.jumpRecord(recNum) |
invoiceToPayedBlock.jumpRecord(recNum) |
481 |
total += hack.a2f(invoiceToPayedBlock.invoiceBox.payEntry) |
total += hack.a2f(invoiceToPayedBlock.invoiceBox.payEntry,2) |
482 |
|
|
483 |
invoiceToPayedBlock.invoiceBox.totalEntry = str(total) |
invoiceToPayedBlock.invoiceBox.totalEntry = str(round(total,2)) |
484 |
|
|
485 |
]]></trigger> |
]]></trigger> |
486 |
|
|
488 |
import hack |
import hack |
489 |
|
|
490 |
callTrigger('totalTrigger') |
callTrigger('totalTrigger') |
491 |
if hack.a2f(invoiceToPayedBlock.invoiceBox.totalEntry) > 0: |
if hack.a2f(invoiceToPayedBlock.invoiceBox.totalEntry,2) > 0: |
492 |
currencyTypeBlock.clear() |
currencyTypeBlock.clear() |
493 |
currencyDataBlock.clear() |
currencyDataBlock.clear() |
494 |
|
|
500 |
currencyTypeBlock.newRecord() |
currencyTypeBlock.newRecord() |
501 |
currencyTypeBlock.currencyBox.idEntry = rs.current.getField("_table") |
currencyTypeBlock.currencyBox.idEntry = rs.current.getField("_table") |
502 |
currencyTypeBlock.currencyBox.nameEntry = rs.current.getField("name") |
currencyTypeBlock.currencyBox.nameEntry = rs.current.getField("name") |
503 |
currencyTypeBlock.currencyBox.rateEntry = hack.a2f(rs.current.getField("rate")) |
currencyTypeBlock.currencyBox.rateEntry = hack.a2f(rs.current.getField("rate"),2) |
504 |
monto = hack.a2f(hack.a2f(invoiceToPayedBlock.invoiceBox.totalEntry) / hack.a2f(rs.current.getField("rate")),2) |
monto = round(hack.a2f(invoiceToPayedBlock.invoiceBox.totalEntry,2) / hack.a2f(rs.current.getField("rate"),2),2) |
505 |
currencyTypeBlock.currencyBox.formatEntry = rs.current.getField("format") |
currencyTypeBlock.currencyBox.formatEntry = rs.current.getField("format") |
506 |
currencyTypeBlock.currencyBox.amountEntry = str(currencyTypeBlock.currencyBox.formatEntry) % monto |
currencyTypeBlock.currencyBox.amountEntry = str(currencyTypeBlock.currencyBox.formatEntry) % monto |
507 |
currencyTypeBlock.currencyBox.payEntry = 0.0 |
currencyTypeBlock.currencyBox.payEntry = 0.0 |
523 |
<![CDATA[ |
<![CDATA[ |
524 |
import hack |
import hack |
525 |
|
|
526 |
total = hack.a2f(invoiceToPayedBlock.invoiceBox.totalEntry) |
total = hack.a2f(invoiceToPayedBlock.invoiceBox.totalEntry,2) |
527 |
rc = currencyTypeBlock.getRecordCount() |
rc = currencyTypeBlock.getRecordCount() |
528 |
for recNum in range(rc): |
for recNum in range(rc): |
529 |
currencyTypeBlock.jumpRecord(recNum) |
currencyTypeBlock.jumpRecord(recNum) |
530 |
if hack.a2f(currencyTypeBlock.currencyBox.payEntry) > 0: |
if hack.a2f(currencyTypeBlock.currencyBox.payEntry,2) > 0: |
531 |
total -= hack.a2f(hack.a2f(currencyTypeBlock.currencyBox.payEntry) * hack.a2f(currencyTypeBlock.currencyBox.rateEntry),2) |
total -= round(hack.a2f(currencyTypeBlock.currencyBox.payEntry,2) * hack.a2f(currencyTypeBlock.currencyBox.rateEntry,2),2) |
532 |
|
|
533 |
rc = currencyTypeBlock.getRecordCount() |
rc = currencyTypeBlock.getRecordCount() |
534 |
for recNum in range(rc): |
for recNum in range(rc): |
535 |
currencyTypeBlock.jumpRecord(recNum) |
currencyTypeBlock.jumpRecord(recNum) |
536 |
if hack.a2f(currencyTypeBlock.currencyBox.rateEntry) > 0: |
if hack.a2f(currencyTypeBlock.currencyBox.rateEntry,2) > 0: |
537 |
monto = hack.a2f(total / hack.a2f(currencyTypeBlock.currencyBox.rateEntry),2) |
monto = round(total / hack.a2f(currencyTypeBlock.currencyBox.rateEntry,2),2) |
538 |
currencyTypeBlock.currencyBox.amountEntry = str(currencyTypeBlock.currencyBox.formatEntry) % monto |
currencyTypeBlock.currencyBox.amountEntry = str(currencyTypeBlock.currencyBox.formatEntry) % monto |
539 |
|
|
540 |
]]> |
]]> |
547 |
|
|
548 |
callTrigger('currencyTypeTrigger') |
callTrigger('currencyTypeTrigger') |
549 |
|
|
550 |
total = hack.a2f(invoiceToPayedBlock.invoiceBox.totalEntry) |
total = hack.a2f(invoiceToPayedBlock.invoiceBox.totalEntry,2) |
551 |
rc = currencyTypeBlock.getRecordCount() |
rc = currencyTypeBlock.getRecordCount() |
552 |
for recNum in range(rc): |
for recNum in range(rc): |
553 |
currencyTypeBlock.jumpRecord(recNum) |
currencyTypeBlock.jumpRecord(recNum) |
554 |
if hack.a2f(currencyTypeBlock.currencyBox.rateEntry) > 0: |
if hack.a2f(currencyTypeBlock.currencyBox.rateEntry,2) > 0: |
555 |
total -= hack.a2f(hack.a2f(currencyTypeBlock.currencyBox.payEntry) * hack.a2f(currencyTypeBlock.currencyBox.rateEntry),2) |
total -= round(hack.a2f(currencyTypeBlock.currencyBox.payEntry,2) * hack.a2f(currencyTypeBlock.currencyBox.rateEntry,2),2) |
556 |
|
|
557 |
if total != 0: |
if total != 0: |
558 |
genericBox("El recibo no esta totalmente pagado\n",['Aceptar']) |
genericBox("El recibo no esta totalmente pagado\n",['Aceptar']) |