482 |
import sys |
import sys |
483 |
if "../ruff" not in sys.path: |
if "../ruff" not in sys.path: |
484 |
sys.path.append("../ruff") |
sys.path.append("../ruff") |
485 |
import informe |
from ruff import Report |
486 |
x = informe.new("ruff/own_document.xml") |
from errors import * |
487 |
|
x = Report("ruff/own_document.xml") |
488 |
#encabezado |
#encabezado |
489 |
print "encabezado" |
print "encabezado" |
490 |
x.header(fecha=printing.printField(tmpBlock.tmpDateEntry,10)) |
x.header(fecha=printing.printField(tmpBlock.tmpDateEntry,10)) |
494 |
|
|
495 |
#seleccion del tipo de comprobante (A,B,C o proximamente M) |
#seleccion del tipo de comprobante (A,B,C o proximamente M) |
496 |
if str(ownDocumentBlock.typeEntry) == <neb:Inline>'"'.$document_type_A.'"'</neb:Inline>: |
if str(ownDocumentBlock.typeEntry) == <neb:Inline>'"'.$document_type_A.'"'</neb:Inline>: |
497 |
detail_to_print = 'a_document_items' |
x.add_detail('a_document_items') |
498 |
elif str(ownDocumentBlock.typeEntry) == <neb:Inline>'"'.$document_type_B.'"'</neb:Inline>: |
elif str(ownDocumentBlock.typeEntry) == <neb:Inline>'"'.$document_type_B.'"'</neb:Inline>: |
499 |
detail_to_print = 'b_document_items' |
x.add_detail('b_document_items') |
500 |
elif str(ownDocumentBlock.typeEntry) == <neb:Inline>'"'.$document_type_C.'"'</neb:Inline>: |
elif str(ownDocumentBlock.typeEntry) == <neb:Inline>'"'.$document_type_C.'"'</neb:Inline>: |
501 |
detail_to_print = 'c_document_items' |
x.add_detail('c_document_items') |
502 |
|
|
503 |
#carga de items |
#carga de items |
504 |
try: |
|
505 |
ownItemBlock.firstRecord() |
ownItemBlock.firstRecord() |
506 |
iva_amount= 0.00 |
iva_amount= 0.00 |
507 |
iva_rni_amount= 0.00 |
iva_rni_amount= 0.00 |
508 |
for index in range(ownItemBlock.getRecordCount()): |
for index in range(ownItemBlock.getRecordCount()): |
509 |
if (index > 0) and ( not ownItemBlock.isEmpty()): |
if (index > 0) and ( not ownItemBlock.isEmpty()): |
510 |
ownItemBlock.nextRecord() |
ownItemBlock.nextRecord() |
511 |
iva_amount += hack.a2f(ownItemBlock.ivaAmountEntry) |
iva_amount += hack.a2f(ownItemBlock.ivaAmountEntry) |
512 |
iva_rni_amount += hack.a2f(ownItemBlock.ivaRNIAmountEntry) |
iva_rni_amount += hack.a2f(ownItemBlock.ivaRNIAmountEntry) |
513 |
|
document_item = {} |
514 |
<neb:Block>if (!$descriptive_item) {</neb:Block> |
<neb:Block>if (!$descriptive_item) {</neb:Block> |
515 |
document_item = { "descriptive": str(ownItemBlock.productNameEntry), |
document_item['descriptive'] = str(ownItemBlock.productNameEntry) |
516 |
"qtty": str(ownItemBlock.qtyEntry), |
document_item['qtty'] = str(ownItemBlock.qtyEntry) |
|
"unit_price": str(ownItemBlock.unitPriceEntry), |
|
|
"qtty_price": str(ownItemBlock.itemNetoEntry), |
|
|
"iva": str(ownItemBlock.ivaAmountEntry), |
|
|
"iva_rni": str(ownItemBlock.ivaRNIAmountEntry), |
|
|
"total": str(ownItemBlock.itemTotalEntry), |
|
|
} |
|
517 |
<neb:Block>}else{</neb:Block> |
<neb:Block>}else{</neb:Block> |
518 |
document_item = { "descriptive": str(ownItemBlock.descriptiveEntry), |
document_item['descriptive'] = str(ownItemBlock.descriptiveEntry) |
|
"unit_price": str(ownItemBlock.itemNetoEntry), |
|
|
"qtty_price": str(ownItemBlock.itemNetoEntry), |
|
|
"iva": str(ownItemBlock.ivaAmountEntry), |
|
|
"iva_rni": str(ownItemBlock.ivaRNIAmountEntry), |
|
|
"total": str(ownItemBlock.itemTotalEntry), |
|
|
} |
|
519 |
<neb:Block>}</neb:Block> |
<neb:Block>}</neb:Block> |
520 |
|
#comunes a ABC |
521 |
|
document_item['unit_price'] = str(ownItemBlock.unitPriceEntry) |
522 |
|
document_item['qtty_price'] = str(ownItemBlock.itemNetoEntry) |
523 |
|
document_item['total'] = str(ownItemBlock.itemTotalEntry) |
524 |
|
#if A |
525 |
|
if str(ownDocumentBlock.typeEntry) == <neb:Inline>'"'.$document_type_A.'"'</neb:Inline>: |
526 |
|
document_item['iva'] = str(ownItemBlock.ivaAmountEntry) |
527 |
|
document_item['iva_rni'] = str(ownItemBlock.ivaRNIAmountEntry) |
528 |
|
#if B |
529 |
|
elif str(ownDocumentBlock.typeEntry) == <neb:Inline>'"'.$document_type_B.'"'</neb:Inline>: |
530 |
|
document_item['iva'] = str(ownItemBlock.ivaAmountEntry) |
531 |
|
|
532 |
print document_item |
print document_item |
533 |
eval('x.'+detail_to_print+'.item.add_row(**document_item)') |
try: |
534 |
#carga de footer |
x.add_dentry('item', **document_item) |
535 |
eval('x.'+detail_to_print+'.footer(tot_qtty_price=str(ownDocumentBlock.netTotalEntry))') |
except UnknownFieldError : |
536 |
eval('x.'+detail_to_print+'.footer(tot_iva=str(iva_amount))') |
pass |
537 |
eval('x.'+detail_to_print+'.footer(tot_iva_rni=str(iva_rni_amount))') |
except ReportOverflowError : |
538 |
eval('x.'+detail_to_print+'.footer(tot_amount=str(totalBlock.totalEntry))') |
genericBox("ha excedido el numero de renglones disponibles para la impresión del comprobante" +str(msg),['Aceptar']) |
539 |
tmpValuesDataSource.printing_document=x |
|
540 |
except Exception, msg: |
#carga de footer |
541 |
raise |
x.footer(tot_qtty_price=str(ownDocumentBlock.netTotalEntry), |
542 |
genericBox("ha excedido el numero de renglones disponibles para la impresión del comprobante" +str(msg),['Aceptar']) |
tot_amount=str(totalBlock.totalEntry)) |
543 |
|
if str(ownDocumentBlock.typeEntry) == <neb:Inline>'"'.$document_type_A.'"'</neb:Inline>: |
544 |
|
x.footer(tot_iva=str(iva_amount)) |
545 |
|
x.footer(tot_iva_rni=str(iva_rni_amount)) |
546 |
|
elif str(ownDocumentBlock.typeEntry) == <neb:Inline>'"'.$document_type_B.'"'</neb:Inline>: |
547 |
|
x.footer(tot_iva=str(iva_amount)) |
548 |
|
tmpValuesDataSource.printing_document=x |
549 |
|
|
550 |
</trigger> |
</trigger> |
551 |
|
|
552 |
<trigger name="printTrigger" type="NAMED"> |
<trigger name="printTrigger" type="NAMED"> |
555 |
import sys |
import sys |
556 |
if "../ruff" not in sys.path: |
if "../ruff" not in sys.path: |
557 |
sys.path.append("../ruff") |
sys.path.append("../ruff") |
558 |
import informe |
#import informe |
559 |
|
from ruff import Report |
560 |
x = tmpValuesDataSource.printing_document |
x = tmpValuesDataSource.printing_document |
561 |
printing.previewPrint([x.render()],'xless -fn vga') |
#printing.previewPrint(reduce(lambda a, b: a+b, [i.render() for i in x.pages]),'xless -fn vga') |
562 |
|
printing.previewPrint([str(x)],gConfig('printcommand')) |
563 |
</trigger> |
</trigger> |
564 |
|
|
565 |
<!-- Este trigger clacula el total del comprobante --> |
<!-- Este trigger clacula el total del comprobante --> |