434 |
eq = GConditions.GCeq(cond) |
eq = GConditions.GCeq(cond) |
435 |
GConditions.GCField(eq,"_entity_data._table") |
GConditions.GCField(eq,"_entity_data._table") |
436 |
GConditions.GCConst(eq,str(ownDocumentBlock.clientRecipientBox.currentClientEntry)) |
GConditions.GCConst(eq,str(ownDocumentBlock.clientRecipientBox.currentClientEntry)) |
|
print "currentClientEntry",ownDocumentBlock.clientRecipientBox.currentClientEntry |
|
437 |
|
|
438 |
# Calculo del total facturado |
# Calculo del total facturado |
439 |
#rs = invTotDataSource.createResultSet(cond) |
#rs = invTotDataSource.createResultSet(cond) |
444 |
while more: |
while more: |
445 |
itemTot = 0 |
itemTot = 0 |
446 |
currOwnDoc = rs.current.getField("own_document.id") |
currOwnDoc = rs.current.getField("own_document.id") |
|
print currOwnDoc |
|
447 |
while rs.current.getField("own_document.id") == currOwnDoc and more: |
while rs.current.getField("own_document.id") == currOwnDoc and more: |
448 |
lQty = hack.a2f(rs.current.getField("own_product_item.qty")) |
lQty = hack.a2f(rs.current.getField("own_product_item.qty")) |
449 |
lUnitPrice = hack.a2f(rs.current.getField("_price_data.unit_price")) |
lUnitPrice = hack.a2f(rs.current.getField("_price_data.unit_price")) |
450 |
lBonus = hack.a2f(rs.current.getField("own_item.bonus")) |
lBonus = hack.a2f(rs.current.getField("own_item.bonus")) |
451 |
lDiscount = hack.a2f(rs.current.getField("own_item.discount")) |
lDiscount = hack.a2f(rs.current.getField("own_item.discount")) |
452 |
itemTot += lQty * lUnitPrice - lBonus - lDiscount |
lItem = lQty * lUnitPrice - lBonus - lDiscount |
453 |
print "qty %d * unit_price %d - bonus %d - discount %d = %d " % (lQty, lUnitPrice, lBonus, lDiscount, lQty * lUnitPrice - lBonus - lDiscount) |
itemTot += lItem |
454 |
|
#print "qty %d * unit_price %d - bonus %d - discount %d = %d " % (lQty, lUnitPrice, lBonus, lDiscount, lQty * lUnitPrice - lBonus - lDiscount) |
455 |
taxTot = 0 |
taxTot = 0 |
456 |
currItem = rs.current.getField("own_item.id") |
currItem = rs.current.getField("own_item.id") |
457 |
while rs.current.getField("own_item.id") == currItem and more: |
while rs.current.getField("own_item.id") == currItem and more: |
458 |
taxTot += itemTot * (hack.a2f(rs.current.getField("own_item_tax.amount"))/100) |
taxTot += lItem * (hack.a2f(rs.current.getField("own_item_tax.amount"))/100) |
459 |
more = rs.nextRecord() |
more = rs.nextRecord() |
460 |
invTotal += taxTot |
invTotal += taxTot |
|
print invTotal |
|
461 |
invTotal += itemTot #- hack.a2f(rs.current.getField("own_document.bonus")) |
invTotal += itemTot #- hack.a2f(rs.current.getField("own_document.bonus")) |
462 |
# Calcula los impuestos del documento en si |
# Calcula los impuestos del documento en si |
463 |
odt_rs = invTaxTotDataSource.createResultSet({"own_document.id":currOwnDoc}) |
odt_rs = invTaxTotDataSource.createResultSet({"own_document.id":currOwnDoc}) |
475 |
payTotal = 0 |
payTotal = 0 |
476 |
|
|
477 |
while more: |
while more: |
|
print "proceeding ",hack.a2f(rs.current.getField("own_document_proceeding.amount")) |
|
478 |
payTotal += hack.a2f(rs.current.getField("own_document_proceeding.amount")) |
payTotal += hack.a2f(rs.current.getField("own_document_proceeding.amount")) |
479 |
more = rs.nextRecord() |
more = rs.nextRecord() |
480 |
|
|
481 |
print "invTotal ", invTotal |
#print "invTotal ", invTotal |
482 |
print "balance ", balance |
#print "balance ", balance |
483 |
print "payTotal ", payTotal |
#print "payTotal ", payTotal |
484 |
# Calculo del total adeudado |
# Calculo del total adeudado |
485 |
deudaTotal = invTotal - balance - payTotal |
deudaTotal = invTotal - balance - payTotal |
486 |
ownDocumentBlock.clientRecipientBox.deudaEntry = deudaTotal |
ownDocumentBlock.clientRecipientBox.deudaEntry = deudaTotal |