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 width="84" height="24" title="Facturación a Clientes"> |
<form width="107" height="24" title="Facturación a Clientes"> |
5 |
<datasource name="tmpValuesDataSource" cache="1"/> |
<datasource name="tmpValuesDataSource" cache="1"/> |
6 |
<datasource name="payDataSource" cache="1"/> |
<datasource name="payDataSource" cache="1"/> |
7 |
<datasource name="prodSearchDataSource" cache="1"/> |
<datasource name="prodSearchDataSource" cache="1"/> |
8 |
<datasource name="prodResultDataSource" cache="1"/> |
<datasource name="prodResultDataSource" cache="1"/> |
9 |
|
<datasource name="clientSearchDataSource" cache="1"/> |
10 |
|
|
|
<!-- Origen de datos que sirve para seleccionar el cleinte al que se le --> |
|
|
<!-- va a facturar --> |
|
11 |
|
|
12 |
|
<!-- Origen de datos que sirve para seleccionar el cleinte al que se le --> |
13 |
|
<!-- va a facturar --> |
14 |
<datasource name="clientDataSource" database="papo" |
<datasource name="clientDataSource" database="papo" |
15 |
table="entity, _entity_data, alien_entity, _alien_entity_data, persona, _persona_data, client, _client_data, |
table="entity, _entity_data, alien_entity, _alien_entity_data, persona, _persona_data, client, _client_data, |
16 |
_price_type_data"> |
_price_type_data"> |
67 |
</condition> |
</condition> |
68 |
</datasource> |
</datasource> |
69 |
|
|
70 |
|
<datasource name="clientSearchDataSource" database="papo" |
71 |
|
table="_entity_data, _alien_entity_data, _persona_data, _client_data, |
72 |
|
_price_type_data, entity_type_uid_conf, _entity_uid_type_data, |
73 |
|
_entity_uid_data" order_by="_entity_data.name"> |
74 |
|
<condition> |
75 |
|
<and> |
76 |
|
<eq> |
77 |
|
<cfield name="_entity_data._table"/> |
78 |
|
<cfield name="_alien_entity_data.entity"/> |
79 |
|
</eq> |
80 |
|
<eq> |
81 |
|
<cfield name="_alien_entity_data._table"/> |
82 |
|
<cfield name="_persona_data.alien_entity"/> |
83 |
|
</eq> |
84 |
|
<eq> |
85 |
|
<cfield name="_persona_data._table"/> |
86 |
|
<cfield name="_client_data.persona"/> |
87 |
|
</eq> |
88 |
|
<eq> |
89 |
|
<cfield name="_price_type_data._table"/> |
90 |
|
<cfield name="_client_data.price_type"/> |
91 |
|
</eq> |
92 |
|
<eq> |
93 |
|
<cfield name="_entity_data._table"/> |
94 |
|
<cfield name="_entity_uid_data.entity"/> |
95 |
|
</eq> |
96 |
|
<eq> |
97 |
|
<cfield name="_entity_uid_data.entity_uid_type"/> |
98 |
|
<cfield name="_entity_uid_type_data.id"/> |
99 |
|
</eq> |
100 |
|
<eq> |
101 |
|
<cfield name="_entity_type_data._table"/> |
102 |
|
<cfield name="entity_type_uid_conf.entity_type"/> |
103 |
|
</eq> |
104 |
|
<eq> |
105 |
|
<cfield name="_entity_uid_type_data._table"/> |
106 |
|
<cfield name="entity_type_uid_conf.entity_uid_type"/> |
107 |
|
</eq> |
108 |
|
<null> |
109 |
|
<cfield name="_entity_data._end_t"/> |
110 |
|
</null> |
111 |
|
<null> |
112 |
|
<cfield name="_alien_entity_data._end_t"/> |
113 |
|
</null> |
114 |
|
<null> |
115 |
|
<cfield name="_persona_data._end_t"/> |
116 |
|
</null> |
117 |
|
<null> |
118 |
|
<cfield name="_client_data._end_t"/> |
119 |
|
</null> |
120 |
|
<null> |
121 |
|
<cfield name="_price_type_data._end_t"/> |
122 |
|
</null> |
123 |
|
<null> |
124 |
|
<cfield name="_entity_uid_data._end_t"/> |
125 |
|
</null> |
126 |
|
<null> |
127 |
|
<cfield name="_entity_type_data._end_t"/> |
128 |
|
</null> |
129 |
|
</and> |
130 |
|
</condition> |
131 |
|
</datasource> |
132 |
|
|
133 |
<!-- Origen de datos para obtener el total facturado a este cliente (para el calculo del balance de la cta cte) --> |
<!-- Origen de datos para obtener el total facturado a este cliente (para el calculo del balance de la cta cte) --> |
134 |
<datasource name="serviceInvoiceTotalDataSource" database="papo" |
<datasource name="serviceInvoiceTotalDataSource" database="papo" |
135 |
table="_entity_data, own_document, own_item, own_service_item, own_item_tax" |
table="_entity_data, own_document, own_item, own_service_item, own_item_tax" |
377 |
<!-- Origen de datos que sirve para dar de alta pagos con algun tipo de currency --> |
<!-- Origen de datos que sirve para dar de alta pagos con algun tipo de currency --> |
378 |
<datasource name="ownDocumentProceedingDataSource" database="papo" table="own_document_proceeding"/> |
<datasource name="ownDocumentProceedingDataSource" database="papo" table="own_document_proceeding"/> |
379 |
|
|
380 |
|
<trigger name="startWaitingModeTrigger" type="NAMED"><![CDATA[ |
381 |
|
setStatusText("Procesando ...") |
382 |
|
try: |
383 |
|
# gnue version <= 0.4 |
384 |
|
from gnue.forms.GFEvent import GFEvent |
385 |
|
except ImportError: |
386 |
|
# gnue version >= 0.5 |
387 |
|
from gnue.common.events.Event import Event as GFEvent |
388 |
|
|
389 |
|
# busy clock |
390 |
|
self._object.dispatchEvent(GFEvent('beginWAIT')) |
391 |
|
]]></trigger> |
392 |
|
|
393 |
|
<trigger name="endWaitingModeTrigger" type="NAMED"><![CDATA[ |
394 |
|
try: |
395 |
|
# gnue version <= 0.4 |
396 |
|
from gnue.forms.GFEvent import GFEvent |
397 |
|
except ImportError: |
398 |
|
# gnue version >= 0.5 |
399 |
|
from gnue.common.events.Event import Event as GFEvent |
400 |
|
|
401 |
|
self._object.dispatchEvent(GFEvent('endWAIT')) |
402 |
|
setStatusText("Listo") |
403 |
|
]]></trigger> |
404 |
|
|
405 |
<trigger name="printTrigger" type="NAMED"><![CDATA[ |
<trigger name="printTrigger" type="NAMED"><![CDATA[ |
406 |
import hack |
import hack |
407 |
lCurrentCredit = hack.a2f(tmpValuesDataSource.creditLimitAmount) - \ |
lCurrentCredit = hack.a2f(tmpValuesDataSource.creditLimitAmount) - \ |
410 |
if hack.a2f(payBlock.ctaCteEntry) > lCurrentCredit: |
if hack.a2f(payBlock.ctaCteEntry) > lCurrentCredit: |
411 |
genericBox("Esta excedido el Límite de Crédito",["Ok"]) |
genericBox("Esta excedido el Límite de Crédito",["Ok"]) |
412 |
else: |
else: |
413 |
if ownItemBlock.getRecordCount() > 0 and len(ownItemBlock.productCNameEntry) > 0: |
if ownItemBlock.getRecordCount() > 0 and len(ownItemBlock.prodNameSEntry) > 0: |
414 |
callTrigger ('commitTrigger') |
callTrigger ('commitTrigger') |
415 |
# it's _such_ a pitty |
# it's _such_ a pitty |
416 |
# pleasePrint ('serviceInvoice', { 'id': str(ownDocumentBlock.idEntry) }) |
# pleasePrint ('serviceInvoice', { 'id': str(ownDocumentBlock.idEntry) }) |
475 |
tmpBlock.tmpDateEntry = ownDocumentDataSource.getTimeStamp() |
tmpBlock.tmpDateEntry = ownDocumentDataSource.getTimeStamp() |
476 |
</trigger> |
</trigger> |
477 |
<trigger name="startUp" type="On-Startup"> |
<trigger name="startUp" type="On-Startup"> |
478 |
|
|
479 |
tmpBlock.tmpDateEntry = ownDocumentDataSource.getTimeStamp() |
tmpBlock.tmpDateEntry = ownDocumentDataSource.getTimeStamp() |
480 |
</trigger> |
</trigger> |
481 |
|
|
487 |
|
|
488 |
<!-- Este trigger clacula el total facturado --> |
<!-- Este trigger clacula el total facturado --> |
489 |
<trigger name="totalCalcTrigger" type="NAMED"> |
<trigger name="totalCalcTrigger" type="NAMED"> |
490 |
|
if len(str(ownItemBlock.priceEntry)): |
491 |
import hack |
import hack |
492 |
|
|
493 |
|
lQty = hack.a2f(ownItemBlock.qtyEntry) |
494 |
|
lBonus = hack.a2f(ownItemBlock.bonusEntry) |
495 |
|
lDiscount = hack.a2f(ownItemBlock.discountEntry) |
496 |
|
lUnitPrice = hack.a2f(ownItemBlock.unitPriceEntry) |
497 |
|
|
498 |
|
lItemPrice = (lQty * lUnitPrice) - lBonus - lDiscount |
499 |
|
ownItemBlock.taxAmountEntry = lItemPrice * hack.a2f(ownItemBlock.ivaEntry)/100 |
500 |
|
|
501 |
lTNeto = 0 |
lTNeto = 0 |
502 |
lTTax = 0 |
lTTax = 0 |
503 |
|
|
514 |
else: |
else: |
515 |
lUnitPrice = 0 |
lUnitPrice = 0 |
516 |
#print "lUnitPrice = ",lUnitPrice |
#print "lUnitPrice = ",lUnitPrice |
517 |
|
|
518 |
lItemPrice = (lQty * lUnitPrice) - lBonus - lDiscount |
lItemPrice = (lQty * lUnitPrice) - lBonus - lDiscount |
519 |
lTNeto = lTNeto + lItemPrice |
lTNeto += lItemPrice |
520 |
lTTax += hack.a2f(lRecord.getField("own_item_tax.amount")) |
lTTax += hack.a2f(lRecord.getField("own_item_tax.amount")) |
521 |
|
ownItemBlock.itemTotalEntry = lItemPrice +lTTax |
522 |
|
|
523 |
totalBlock.netoEntry = str(lTNeto) |
totalBlock.netoEntry = str(lTNeto) |
524 |
totalBlock.ivaEntry = str(lTTax) |
totalBlock.ivaEntry = str(lTTax) |
529 |
|
|
530 |
|
|
531 |
<page name="Factura a Clientes"> |
<page name="Factura a Clientes"> |
532 |
<box height="10" label="Factura de Productos a Clientes" |
<box height="9" label="Factura de Productos a Clientes" |
533 |
name="invoiceHeaderBox" width="82" x="0" y="0"> |
name="invoiceHeaderBox" width="105" x="0" y="0"> |
534 |
<!-- Estos bloques son para la gestion del pago de la factura --> |
<!-- Estos bloques son para la gestion del pago de la factura --> |
535 |
<block name="proceedingBlock" datasource="proceedingDataSource" transparentBlock=""> |
<block name="proceedingBlock" datasource="proceedingDataSource" transparentBlock=""> |
536 |
<entry name="idEntry" field="id" hidden="" x="1" y="1" width="12"/> |
<entry name="idEntry" field="id" hidden="" x="1" y="1" width="12"/> |
537 |
<entry name="dateEntry" field="date" hidden="" x="1" y="1" width="12"/> |
<entry name="dateEntry" field="date" hidden="" x="1" y="1" width="12"/> |
538 |
</block> |
</block> |
539 |
|
|
540 |
|
|
541 |
|
<!-- Actualiza los datos del cliente --> |
542 |
|
<trigger type="NAMED" name="bringClientDataTrigger"><![CDATA[ |
543 |
|
|
544 |
|
rs = clientDataSource.createResultSet({'_entity_data.id':str(ownDocumentBlock.clientRecipientBox.clientEntry)}) |
545 |
|
if rs.firstRecord(): |
546 |
|
ownDocumentBlock.clientRecipientBox.currentClientEntry = rs.current.getField('_entity_data._table') |
547 |
|
if str(ownDocumentBlock.clientRecipientBox.currentClientEntry): |
548 |
|
# Actualiza el puntaje |
549 |
|
ownDocumentBlock.clientRecipientBox.scoreEntry = str(ownDocumentBlock.clientRecipientBox.clientEntry) |
550 |
|
# Actualiza el limite de credito |
551 |
|
ownDocumentBlock.clientRecipientBox.creditLimit1Entry = str(ownDocumentBlock.clientRecipientBox.clientEntry) |
552 |
|
# Actualiza la Lista de precios asignada al cliente |
553 |
|
ownDocumentBlock.clientRecipientBox.priceTypeEntry = str(ownDocumentBlock.clientRecipientBox.clientEntry) |
554 |
|
# Aca si existe un balance, calcula la deuda desde ese balance en adelante sino |
555 |
|
# calcula la deuda desde el primer documento vinculado al cliente actual |
556 |
|
creditLimit1Block.processRollback() |
557 |
|
creditLimit1Block.initQuery() |
558 |
|
creditLimit1Block.entityEntry = str(ownDocumentBlock.clientRecipientBox.currentClientEntry) |
559 |
|
creditLimit1Block.processQuery() |
560 |
|
tmpValuesDataSource.creditLimitAmount = str(creditLimit1Block.creditLimitAmountEntry) |
561 |
|
|
562 |
|
import gnue.common.GConditions as GConditions |
563 |
|
import hack |
564 |
|
|
565 |
|
condProductInvoice = GConditions.GCondition() |
566 |
|
condServiceInvoice = GConditions.GCondition() |
567 |
|
condPay = GConditions.GCondition() |
568 |
|
|
569 |
|
balance = 0 |
570 |
|
if str(creditLimit1Block.balanceEntry): |
571 |
|
tmpAnd = GConditions.GCand(condProductInvoice) |
572 |
|
gt = GConditions.GCgt(tmpAnd) |
573 |
|
GConditions.GCField(gt,"own_document.date") |
574 |
|
GConditions.GCConst(gt,str(creditLimit1Block.timeStampEntry)) |
575 |
|
eq = GConditions.GCeq(tmpAnd) |
576 |
|
GConditions.GCField(eq,"_entity_data._table") |
577 |
|
GConditions.GCConst(eq,str(ownDocumentBlock.clientRecipientBox.currentClientEntry)) |
578 |
|
tmpAnd = GConditions.GCand(condServiceInvoice) |
579 |
|
gt = GConditions.GCgt(tmpAnd) |
580 |
|
GConditions.GCField(gt,"own_document.date") |
581 |
|
GConditions.GCConst(gt,str(creditLimit1Block.timeStampEntry)) |
582 |
|
eq = GConditions.GCeq(tmpAnd) |
583 |
|
GConditions.GCField(eq,"_entity_data._table") |
584 |
|
GConditions.GCConst(eq,str(ownDocumentBlock.clientRecipientBox.currentClientEntry)) |
585 |
|
tmpAnd = GConditions.GCand(condPay) |
586 |
|
gt = GConditions.GCgt(tmpAnd) |
587 |
|
GConditions.GCField(gt,"own_document.date") |
588 |
|
GConditions.GCConst(gt,str(creditLimit1Block.timeStampEntry)) |
589 |
|
eq = GConditions.GCeq(tmpAnd) |
590 |
|
GConditions.GCField(eq,"_entity_data._table") |
591 |
|
GConditions.GCConst(eq,str(ownDocumentBlock.clientRecipientBox.currentClientEntry)) |
592 |
|
balance = hack.a2f(creditLimit1Block.balance) |
593 |
|
else: |
594 |
|
eq = GConditions.GCeq(condProductInvoice) |
595 |
|
GConditions.GCField(eq,"_entity_data._table") |
596 |
|
GConditions.GCConst(eq,str(ownDocumentBlock.clientRecipientBox.currentClientEntry)) |
597 |
|
eq = GConditions.GCeq(condServiceInvoice) |
598 |
|
GConditions.GCField(eq,"_entity_data._table") |
599 |
|
GConditions.GCConst(eq,str(ownDocumentBlock.clientRecipientBox.currentClientEntry)) |
600 |
|
eq = GConditions.GCeq(condPay) |
601 |
|
GConditions.GCField(eq,"_entity_data._table") |
602 |
|
GConditions.GCConst(eq,str(ownDocumentBlock.clientRecipientBox.currentClientEntry)) |
603 |
|
|
604 |
|
# Calculo del total facturado |
605 |
|
## Factura de productos |
606 |
|
productInvoiceResultSet = productInvoiceTotalDataSource.createResultSet(condProductInvoice) |
607 |
|
more = productInvoiceResultSet.firstRecord() |
608 |
|
spentTotal = 0 |
609 |
|
|
610 |
|
while more: |
611 |
|
invoiceTotal = 0 |
612 |
|
currOwnDoc = productInvoiceResultSet.current.getField("own_document.id") |
613 |
|
while productInvoiceResultSet.current.getField("own_document.id") == currOwnDoc and more: |
614 |
|
lQty = hack.a2f(productInvoiceResultSet.current.getField("own_product_item.qty")) |
615 |
|
lUnitPrice = hack.a2f(productInvoiceResultSet.current.getField("_price_data.unit_price")) |
616 |
|
lBonus = hack.a2f(productInvoiceResultSet.current.getField("own_item.bonus")) |
617 |
|
lDiscount = hack.a2f(productInvoiceResultSet.current.getField("own_item.discount")) |
618 |
|
item = lQty * lUnitPrice - lBonus - lDiscount |
619 |
|
#print "qty %d * unit_price %d - bonus %d - discount %d = %d " % (lQty, lUnitPrice, lBonus, lDiscount, lQty * lUnitPrice - lBonus - lDiscount) |
620 |
|
itemTaxTotal = 0 |
621 |
|
currItem = productInvoiceResultSet.current.getField("own_item.id") |
622 |
|
while productInvoiceResultSet.current.getField("own_item.id") == currItem and more: |
623 |
|
itemTaxTotal += hack.a2f(productInvoiceResultSet.current.getField("own_item_tax.amount")) |
624 |
|
more = productInvoiceResultSet.nextRecord() |
625 |
|
invoiceTotal += item + itemTaxTotal |
626 |
|
# Calcula los impuestos del documento en si |
627 |
|
odt_rs = invTaxTotDataSource.createResultSet({"own_document.id":currOwnDoc}) |
628 |
|
odt_more = odt_rs.firstRecord() |
629 |
|
while odt_more: |
630 |
|
invoiceTotal += hack.a2f(odt_rs.current.getField("own_document_tax.amount")) |
631 |
|
odt_more = odt_rs.nextRecord() |
632 |
|
spentTotal += invoiceTotal |
633 |
|
|
634 |
|
# Calculo del total facturado |
635 |
|
## Factura de servicios |
636 |
|
serviceInvoiceResultSet= serviceInvoiceTotalDataSource.createResultSet (condServiceInvoice) |
637 |
|
more= serviceInvoiceResultSet.firstRecord () |
638 |
|
|
639 |
|
# por todos los documentos post-checkpoint (si no hay, desde el principio) |
640 |
|
# print "calc 4" |
641 |
|
while more: |
642 |
|
invoiceTotal = 0 |
643 |
|
currentOwnDocument= serviceInvoiceResultSet.current.getField ("own_document.id") |
644 |
|
|
645 |
|
# por todos los items del documento |
646 |
|
# print "calc 5: [%s] %d" % (currentOwnDocument, spentTotal) |
647 |
|
while serviceInvoiceResultSet.current.getField ("own_document.id")==currentOwnDocument and more: |
648 |
|
item = hack.a2f(serviceInvoiceResultSet.current.getField ("own_service_item.amount")) |
649 |
|
currentItem= serviceInvoiceResultSet.current.getField ("own_item.id") |
650 |
|
itemTaxTotal = 0 |
651 |
|
# por todos los impuestos del item |
652 |
|
# print "calc 6: [%s:%s] %d" % (currentOwnDocument, currentItem, invoiceTotal) |
653 |
|
while serviceInvoiceResultSet.current.getField ("own_item.id")==currentItem and more: |
654 |
|
# calculate the item price exactly as I do in the other trigger |
655 |
|
# not revised yet, but I think it was like this |
656 |
|
itemTaxTotal += hack.a2f(serviceInvoiceResultSet.current.getField ("own_item_tax.amount")) |
657 |
|
more= serviceInvoiceResultSet.nextRecord () |
658 |
|
# print "calc 7: %d:%d" % (item, itemTaxTotal) |
659 |
|
|
660 |
|
invoiceTotal+= item + itemTaxTotal |
661 |
|
|
662 |
|
spentTotal+= invoiceTotal |
663 |
|
|
664 |
|
|
665 |
|
# Calculo del total cobrado |
666 |
|
paidResultSet = paidTotalDataSource.createResultSet(condPay) |
667 |
|
|
668 |
|
more = paidResultSet.firstRecord() |
669 |
|
import hack |
670 |
|
payTotal = 0 |
671 |
|
|
672 |
|
while more: |
673 |
|
payTotal += hack.a2f(paidResultSet.current.getField("own_document_proceeding.amount")) |
674 |
|
more = paidResultSet.nextRecord() |
675 |
|
|
676 |
|
#print "invoiceTotal ", invoiceTotal |
677 |
|
#print "balance ", balance |
678 |
|
#print "payTotal ", payTotal |
679 |
|
# Calculo del total adeudado |
680 |
|
deudaTotal = spentTotal - balance - payTotal |
681 |
|
ownDocumentBlock.clientRecipientBox.deudaEntry = deudaTotal |
682 |
|
|
683 |
|
# ******** FALTA GRABAR EL BALANCE ************** |
684 |
|
|
685 |
|
# Obtiene el id de la lista de precios para poder buscar y lo coloca |
686 |
|
# en una variable temporaria colgada del tmpValuesDataSource (un invento que parece que sirve no se si es prolijo) |
687 |
|
clientResultSet = clientDataSource.createResultSet({"_entity_data._table": \ |
688 |
|
str(ownDocumentBlock.clientRecipientBox.currentClientEntry)}) |
689 |
|
clientResultSet.firstRecord() |
690 |
|
tmpValuesDataSource.priceTypeId = clientResultSet.current.getField("_price_type_data._table") |
691 |
|
]]></trigger> |
692 |
|
|
693 |
|
<!-- Bloque para la búsqueda de clientes --> |
694 |
|
<block name="clientResultBlock" datasource="clientSearchDataSource"> |
695 |
|
<entry name="idEntry" field="_entity_data.id" hidden="" x="1" y="1" width="12"/> |
696 |
|
<entry name="uidTypeEntry" field="_entity_uid_data.entity_uid_type" hidden="" x="1" y="1" width="12"/> |
697 |
|
<entry name="uidEntry" field="_entity_uid_data.uid" hidden="" x="1" y="1" width="12"/> |
698 |
|
<entry name="nameEntry" field="_entity_data.name" hidden="" x="1" y="1" width="20"/> |
699 |
|
</block> |
700 |
|
<trigger name="clientSearchTrigger" type="NAMED"><![CDATA[ |
701 |
|
codeToSearch = str(ownDocumentBlock.clientRecipientBox.clientCodeEntry) |
702 |
|
nameToSearch = str(ownDocumentBlock.clientRecipientBox.clientNameEntry) |
703 |
|
|
704 |
|
callTrigger('rollbackTrigger') |
705 |
|
|
706 |
|
ownDocumentBlock.clientRecipientBox.clientCodeEntry = codeToSearch |
707 |
|
ownDocumentBlock.clientRecipientBox.clientNameEntry = nameToSearch |
708 |
|
|
709 |
|
callTrigger('startWaitingModeTrigger') |
710 |
|
clientResultBlock.initQuery() |
711 |
|
clientResultBlock.uidEntry = codeToSearch+"%" |
712 |
|
clientResultBlock.nameEntry = nameToSearch+"%" |
713 |
|
clientResultBlock.processQuery() |
714 |
|
callTrigger('endWaitingModeTrigger') |
715 |
|
recordCount = clientResultBlock.getRecordCount() |
716 |
|
if recordCount > 1: |
717 |
|
def callback (returnValue): |
718 |
|
global block |
719 |
|
if returnValue >= 0: |
720 |
|
clientResultBlock.jumpRecord(returnValue) |
721 |
|
ownDocumentBlock.clientRecipientBox.clientCodeEntry = str(clientResultBlock.uidEntry) |
722 |
|
ownDocumentBlock.clientRecipientBox.clientNameEntry = str(clientResultBlock.nameEntry) |
723 |
|
ownDocumentBlock.clientRecipientBox.clientEntry = str(clientResultBlock.idEntry) |
724 |
|
callTrigger('startWaitingModeTrigger') |
725 |
|
callTrigger('bringClientDataTrigger') |
726 |
|
callTrigger('endWaitingModeTrigger') |
727 |
|
|
728 |
|
runForm ('clientSelect.gfd', {'data': clientResultBlock, 'callback': callback}) |
729 |
|
elif recordCount == 1: |
730 |
|
clientResultBlock.jumpRecord(0) |
731 |
|
ownDocumentBlock.clientRecipientBox.clientCodeEntry = str(clientResultBlock.uidEntry) |
732 |
|
ownDocumentBlock.clientRecipientBox.clientNameEntry = str(clientResultBlock.nameEntry) |
733 |
|
ownDocumentBlock.clientRecipientBox.clientEntry = str(clientResultBlock.idEntry) |
734 |
|
callTrigger('startWaitingModeTrigger') |
735 |
|
callTrigger('bringClientDataTrigger') |
736 |
|
callTrigger('endWaitingModeTrigger') |
737 |
|
|
738 |
|
]]></trigger> |
739 |
|
|
740 |
<!-- Fin de bloques destinados a la gestion del pago de la factura --> |
<!-- Fin de bloques destinados a la gestion del pago de la factura --> |
741 |
<block datasource="ownDocumentDataSource" name="ownDocumentBlock" restrictInsert="" transparentBlock=""> |
<block datasource="ownDocumentDataSource" name="ownDocumentBlock" restrictInsert=""> |
742 |
<entry field="id" hidden="" name="idEntry" x="1" y="1"/> |
<entry field="id" hidden="" name="idEntry" x="1" y="1"/> |
743 |
<entry field="own_document_type" hidden="" name="typeEntry" x="1" y="1"/> |
<entry field="own_document_type" hidden="" name="typeEntry" x="1" y="1"/> |
744 |
<box height="6" label="Datos del Cliente" |
<box height="6" label="Datos del Cliente" name="clientRecipientBox" width="103" x="0" y="2"> |
|
name="clientRecipientBox" width="65" x="0" y="2"> |
|
745 |
|
|
746 |
<label name="clientLbl" text="Cliente" x="1" y="1" /> |
<label name="clientLbl" text="Cliente" x="1" y="1" /> |
747 |
|
|
748 |
<entry x="1" y="1" width="30" name="currentClientEntry" hidden="" /> |
<entry x="1" y="1" width="30" name="currentClientEntry" hidden="" /> |
749 |
<entry x="1" y="2" field="recipient" name="clientEntry" |
<entry x="1" y="2" field="recipient" name="clientEntry" width="30" hidden=""/> |
750 |
width="30" style="dropdown" foreign_key="clientDataSource._entity_data.id" |
<entry x="1" y="2" name="clientCodeEntry" width="20"/> |
751 |
foreign_key_description="_entity_data.name" > |
<entry x="21" y="2" name="clientNameEntry" width="35"/> |
752 |
|
<button name="clientSearchButton" trigger="clientSearchTrigger" label="Buscar" width="7" height="1" x="56" y="2"/> |
|
<trigger type="PRE-FOCUSOUT" name="showClientDataTrigger"> |
|
|
rs = clientDataSource.createResultSet({'_entity_data.id':str(ownDocumentBlock.clientRecipientBox.clientEntry)}) |
|
|
if rs.firstRecord(): |
|
|
ownDocumentBlock.clientRecipientBox.currentClientEntry = rs.current.getField('_entity_data._table') |
|
|
if str(ownDocumentBlock.clientRecipientBox.currentClientEntry): |
|
|
# Actualiza el puntaje |
|
|
ownDocumentBlock.clientRecipientBox.scoreEntry = str(ownDocumentBlock.clientRecipientBox.clientEntry) |
|
|
# Actualiza el limite de credito |
|
|
ownDocumentBlock.clientRecipientBox.creditLimit1Entry = str(ownDocumentBlock.clientRecipientBox.clientEntry) |
|
|
# Actualiza la Lista de precios asignada al cliente |
|
|
ownDocumentBlock.clientRecipientBox.priceTypeEntry = str(ownDocumentBlock.clientRecipientBox.clientEntry) |
|
|
# Aca si existe un balance, calcula la deuda desde ese balance en adelante sino |
|
|
# calcula la deuda desde el primer documento vinculado al cliente actual |
|
|
creditLimit1Block.processRollback() |
|
|
creditLimit1Block.initQuery() |
|
|
creditLimit1Block.entityEntry = str(ownDocumentBlock.clientRecipientBox.currentClientEntry) |
|
|
creditLimit1Block.processQuery() |
|
|
tmpValuesDataSource.creditLimitAmount = str(creditLimit1Block.creditLimitAmountEntry) |
|
|
|
|
|
import gnue.common.GConditions as GConditions |
|
|
import hack |
|
|
|
|
|
condProductInvoice = GConditions.GCondition() |
|
|
condServiceInvoice = GConditions.GCondition() |
|
|
condPay = GConditions.GCondition() |
|
|
|
|
|
balance = 0 |
|
|
if str(creditLimit1Block.balanceEntry): |
|
|
tmpAnd = GConditions.GCand(condProductInvoice) |
|
|
gt = GConditions.GCgt(tmpAnd) |
|
|
GConditions.GCField(gt,"own_document.date") |
|
|
GConditions.GCConst(gt,str(creditLimit1Block.timeStampEntry)) |
|
|
eq = GConditions.GCeq(tmpAnd) |
|
|
GConditions.GCField(eq,"_entity_data._table") |
|
|
GConditions.GCConst(eq,str(ownDocumentBlock.clientRecipientBox.currentClientEntry)) |
|
|
tmpAnd = GConditions.GCand(condServiceInvoice) |
|
|
gt = GConditions.GCgt(tmpAnd) |
|
|
GConditions.GCField(gt,"own_document.date") |
|
|
GConditions.GCConst(gt,str(creditLimit1Block.timeStampEntry)) |
|
|
eq = GConditions.GCeq(tmpAnd) |
|
|
GConditions.GCField(eq,"_entity_data._table") |
|
|
GConditions.GCConst(eq,str(ownDocumentBlock.clientRecipientBox.currentClientEntry)) |
|
|
tmpAnd = GConditions.GCand(condPay) |
|
|
gt = GConditions.GCgt(tmpAnd) |
|
|
GConditions.GCField(gt,"own_document.date") |
|
|
GConditions.GCConst(gt,str(creditLimit1Block.timeStampEntry)) |
|
|
eq = GConditions.GCeq(tmpAnd) |
|
|
GConditions.GCField(eq,"_entity_data._table") |
|
|
GConditions.GCConst(eq,str(ownDocumentBlock.clientRecipientBox.currentClientEntry)) |
|
|
balance = hack.a2f(creditLimit1Block.balance) |
|
|
else: |
|
|
eq = GConditions.GCeq(condProductInvoice) |
|
|
GConditions.GCField(eq,"_entity_data._table") |
|
|
GConditions.GCConst(eq,str(ownDocumentBlock.clientRecipientBox.currentClientEntry)) |
|
|
eq = GConditions.GCeq(condServiceInvoice) |
|
|
GConditions.GCField(eq,"_entity_data._table") |
|
|
GConditions.GCConst(eq,str(ownDocumentBlock.clientRecipientBox.currentClientEntry)) |
|
|
eq = GConditions.GCeq(condPay) |
|
|
GConditions.GCField(eq,"_entity_data._table") |
|
|
GConditions.GCConst(eq,str(ownDocumentBlock.clientRecipientBox.currentClientEntry)) |
|
|
|
|
|
# Calculo del total facturado |
|
|
## Factura de productos |
|
|
productInvoiceResultSet = productInvoiceTotalDataSource.createResultSet(condProductInvoice) |
|
|
more = productInvoiceResultSet.firstRecord() |
|
|
spentTotal = 0 |
|
|
|
|
|
while more: |
|
|
invoiceTotal = 0 |
|
|
currOwnDoc = productInvoiceResultSet.current.getField("own_document.id") |
|
|
while productInvoiceResultSet.current.getField("own_document.id") == currOwnDoc and more: |
|
|
lQty = hack.a2f(productInvoiceResultSet.current.getField("own_product_item.qty")) |
|
|
lUnitPrice = hack.a2f(productInvoiceResultSet.current.getField("_price_data.unit_price")) |
|
|
lBonus = hack.a2f(productInvoiceResultSet.current.getField("own_item.bonus")) |
|
|
lDiscount = hack.a2f(productInvoiceResultSet.current.getField("own_item.discount")) |
|
|
item = lQty * lUnitPrice - lBonus - lDiscount |
|
|
#print "qty %d * unit_price %d - bonus %d - discount %d = %d " % (lQty, lUnitPrice, lBonus, lDiscount, lQty * lUnitPrice - lBonus - lDiscount) |
|
|
itemTaxTotal = 0 |
|
|
currItem = productInvoiceResultSet.current.getField("own_item.id") |
|
|
while productInvoiceResultSet.current.getField("own_item.id") == currItem and more: |
|
|
itemTaxTotal += hack.a2f(productInvoiceResultSet.current.getField("own_item_tax.amount")) |
|
|
more = productInvoiceResultSet.nextRecord() |
|
|
invoiceTotal += item + itemTaxTotal |
|
|
# Calcula los impuestos del documento en si |
|
|
odt_rs = invTaxTotDataSource.createResultSet({"own_document.id":currOwnDoc}) |
|
|
odt_more = odt_rs.firstRecord() |
|
|
while odt_more: |
|
|
invoiceTotal += hack.a2f(odt_rs.current.getField("own_document_tax.amount")) |
|
|
odt_more = odt_rs.nextRecord() |
|
|
spentTotal += invoiceTotal |
|
|
|
|
|
# Calculo del total facturado |
|
|
## Factura de servicios |
|
|
serviceInvoiceResultSet= serviceInvoiceTotalDataSource.createResultSet (condServiceInvoice) |
|
|
more= serviceInvoiceResultSet.firstRecord () |
|
|
|
|
|
# por todos los documentos post-checkpoint (si no hay, desde el principio) |
|
|
# print "calc 4" |
|
|
while more: |
|
|
invoiceTotal = 0 |
|
|
currentOwnDocument= serviceInvoiceResultSet.current.getField ("own_document.id") |
|
|
|
|
|
# por todos los items del documento |
|
|
# print "calc 5: [%s] %d" % (currentOwnDocument, spentTotal) |
|
|
while serviceInvoiceResultSet.current.getField ("own_document.id")==currentOwnDocument and more: |
|
|
item = hack.a2f(serviceInvoiceResultSet.current.getField ("own_service_item.amount")) |
|
|
currentItem= serviceInvoiceResultSet.current.getField ("own_item.id") |
|
|
itemTaxTotal = 0 |
|
|
# por todos los impuestos del item |
|
|
# print "calc 6: [%s:%s] %d" % (currentOwnDocument, currentItem, invoiceTotal) |
|
|
while serviceInvoiceResultSet.current.getField ("own_item.id")==currentItem and more: |
|
|
# calculate the item price exactly as I do in the other trigger |
|
|
# not revised yet, but I think it was like this |
|
|
itemTaxTotal += hack.a2f(serviceInvoiceResultSet.current.getField ("own_item_tax.amount")) |
|
|
more= serviceInvoiceResultSet.nextRecord () |
|
|
# print "calc 7: %d:%d" % (item, itemTaxTotal) |
|
|
|
|
|
invoiceTotal+= item + itemTaxTotal |
|
|
|
|
|
spentTotal+= invoiceTotal |
|
|
|
|
|
|
|
|
# Calculo del total cobrado |
|
|
paidResultSet = paidTotalDataSource.createResultSet(condPay) |
|
|
|
|
|
more = paidResultSet.firstRecord() |
|
|
import hack |
|
|
payTotal = 0 |
|
|
|
|
|
while more: |
|
|
payTotal += hack.a2f(paidResultSet.current.getField("own_document_proceeding.amount")) |
|
|
more = paidResultSet.nextRecord() |
|
|
|
|
|
#print "invoiceTotal ", invoiceTotal |
|
|
#print "balance ", balance |
|
|
#print "payTotal ", payTotal |
|
|
# Calculo del total adeudado |
|
|
deudaTotal = spentTotal - balance - payTotal |
|
|
ownDocumentBlock.clientRecipientBox.deudaEntry = deudaTotal |
|
|
|
|
|
# ******** FALTA GRABAR EL BALANCE ************** |
|
|
|
|
|
# Obtiene el id de la lista de precios para poder buscar y lo coloca |
|
|
# en una variable temporaria colgada del tmpValuesDataSource (un invento que parece que sirve no se si es prolijo) |
|
|
clientResultSet = clientDataSource.createResultSet({"_entity_data._table": \ |
|
|
str(ownDocumentBlock.clientRecipientBox.currentClientEntry)}) |
|
|
clientResultSet.firstRecord() |
|
|
tmpValuesDataSource.priceTypeId = clientResultSet.current.getField("_price_type_data._table") |
|
|
</trigger> |
|
|
<trigger type="PRE-FOCUSIN" name="showScoreTrigger" src="rollbackTrigger"> |
|
|
#===================================================================# |
|
|
# ownDocumentBlock.clientRecipientBox.scoreEntry = "" # |
|
|
# ownDocumentBlock.clientRecipientBox.creditLimit1Entry = "" # |
|
|
# ownDocumentBlock.clientRecipientBox.priceTypeEntry = "" # |
|
|
# ownDocumentBlock.clientRecipientBox.deudaEntry = "" # |
|
|
#===================================================================# |
|
|
</trigger> |
|
|
</entry> |
|
753 |
|
|
754 |
<label name="clientLbl" text="Lista de precios:" x="1" y="3" /> |
<label name="clientLbl" text="Lista de precios:" x="1" y="4" /> |
755 |
|
|
756 |
<entry x="19" y="3" field="recipient" name="priceTypeEntry" readonly="" |
<entry x="19" y="4" field="recipient" name="priceTypeEntry" readonly="" |
757 |
width="20" style="textlookup" foreign_key="clientDataSource._entity_data.id" |
width="20" style="textlookup" foreign_key="clientDataSource._entity_data.id" |
758 |
foreign_key_description="_price_type_data.name" /> |
foreign_key_description="_price_type_data.name" /> |
759 |
|
|
760 |
<label name="scoreLbl" text="Puntaje" x="32" y="1" /> |
<label name="scoreLbl" text="Puntaje" x="64" y="1" /> |
761 |
<entry x="32" y="2" readonly="" field="recipient" name="scoreEntry" |
<entry x="64" y="2" readonly="" field="recipient" name="scoreEntry" |
762 |
width="10" style="textlookup" foreign_key="clientDataSource._entity_data.id" |
width="10" style="textlookup" foreign_key="clientDataSource._entity_data.id" |
763 |
foreign_key_description="_client_data.score"/> |
foreign_key_description="_client_data.score"/> |
764 |
|
|
765 |
<label name="nameMVType1Label" text="Cta. Cte." x="43" y="1"/> |
<label name="nameMVType1Label" text="Cta. Cte." x="75" y="1"/> |
766 |
|
|
767 |
<entry x="43" y="2" readonly="" field="recipient" name="creditLimit1Entry" |
<entry x="75" y="2" readonly="" field="recipient" name="creditLimit1Entry" |
768 |
width="8" style="textlookup" foreign_key="tlCreditLimit1DataSource._entity_data.id" |
width="10" style="textlookup" foreign_key="tlCreditLimit1DataSource._entity_data.id" |
769 |
foreign_key_description="_credit_limit_data.credit_limit"/> |
foreign_key_description="_credit_limit_data.credit_limit"/> |
770 |
|
|
771 |
<label name="deudaLbl" text="| Deuda : " x="40" y="3"/> |
<label name="deudaLbl" text="| Deuda : " x="40" y="4"/> |
772 |
<entry name="deudaEntry" style="label" x="52" y="3" width="12" typecast="number" displaymask="%0.2f"/> |
<entry name="deudaEntry" style="label" x="52" y="4" width="12" typecast="number" displaymask="%0.2f"/> |
773 |
|
|
774 |
</box> |
</box> |
775 |
<entry field="date" name="dateEntry" style="label" hidden="" typecast="date" |
<entry field="date" name="dateEntry" style="label" hidden="" typecast="date" |
776 |
rows="1" width="24" x="7" y="7"/> |
rows="10" width="24" x="7" y="7"/> |
777 |
<entry field="number" name="numberEntry" style="label" hidden="" rows="1" width="24" x="7" y="7"/> |
<entry field="number" name="numberEntry" style="label" hidden="" rows="10" width="24" x="7" y="7"/> |
778 |
|
|
779 |
</block> |
</block> |
780 |
|
|
781 |
|
<!-- Fecha de la factura --> |
782 |
<block name="tmpBlock" datasource="tmpValuesDataSource" transparentBlock=""> |
<block name="tmpBlock" datasource="tmpValuesDataSource" transparentBlock=""> |
783 |
<label name="dateLbl" rows="1" text="Fecha" x="1" y="8" /> |
<label name="dateLbl" text="Fecha" x="1" y="1" /> |
784 |
<entry name="tmpDateEntry" style="label" typecast="date" |
<entry name="tmpDateEntry" style="label" typecast="date" |
785 |
rows="1" width="24" x="7" y="8"/> |
rows="10" width="24" x="7" y="1"/> |
786 |
</block> |
</block> |
787 |
|
|
788 |
<!-- # de factura --> |
<!-- # de factura --> |
795 |
x="50" y="1" width="15"/> |
x="50" y="1" width="15"/> |
796 |
<entry name="branchEntry" field="_branch_document_data.branch" hidden="" |
<entry name="branchEntry" field="_branch_document_data.branch" hidden="" |
797 |
x="50" y="1" width="15"/> |
x="50" y="1" width="15"/> |
|
|
|
|
<!-- <button name="fixInvoiceNoButton" label="Corregir" trigger="fixInvoiceNoTrigger" --> |
|
|
<!-- x="66" y="1" width="10" height="1"/> --> |
|
798 |
</block> |
</block> |
799 |
|
|
800 |
</box> |
</box> |
881 |
<entry name="prodIVATaxEntry" field="_product_tax_data.amount" x="50" y="1" width="20" rows="2" hidden=""/> |
<entry name="prodIVATaxEntry" field="_product_tax_data.amount" x="50" y="1" width="20" rows="2" hidden=""/> |
882 |
</block> |
</block> |
883 |
|
|
884 |
|
<trigger name="prodDeleteTrigger" type="NAMED"> |
885 |
|
ownItemBlock.prodCodeSEntry = "" |
886 |
|
ownItemBlock.prodNameSEntry = "" |
887 |
|
ownItemBlock.qtyEntry = 0.00 |
888 |
|
ownItemBlock.unitPriceEntry = 0.00 |
889 |
|
ownItemBlock.priceEntry = "" |
890 |
|
ownItemBlock.taxAmountEntry = 0 |
891 |
|
ownItemBlock.ivaEntry = 0 |
892 |
|
ownItemBlock.discountEntry = 0.00 |
893 |
|
ownItemBlock.bonusEntry = 0.00 |
894 |
|
ownItemBlock.itemTotalEntry = 0.00 |
895 |
|
</trigger> |
896 |
|
|
897 |
<trigger name="prodSearchTrigger" type="NAMED"> |
<trigger name="prodSearchTrigger" type="NAMED"> |
898 |
#armado de la lista de recorrido del arbol |
#armado de la lista de recorrido del arbol |
899 |
search_id = str(tmpValuesDataSource.priceTypeId) |
search_id = str(tmpValuesDataSource.priceTypeId) |
906 |
priceListsChain.append("%s" % priceTypeBlock.priceTypeId) |
priceListsChain.append("%s" % priceTypeBlock.priceTypeId) |
907 |
tmpProdResultBlock.processRollback() |
tmpProdResultBlock.processRollback() |
908 |
tmpProdResultBlock.initQuery() |
tmpProdResultBlock.initQuery() |
909 |
tmpProdResultBlock.prodNameEntry = ("%s" % prodSearchBlock.prodNameSEntry)+"%" |
tmpProdResultBlock.prodNameEntry = ("%s" % ownItemBlock.prodNameSEntry)+"%" |
910 |
tmpProdResultBlock.prodCodeEntry = ("%s" % prodSearchBlock.prodCodeSEntry)+"%" |
tmpProdResultBlock.prodCodeEntry = ("%s" % ownItemBlock.prodCodeSEntry)+"%" |
911 |
tmpProdResultBlock.prodCodeTypeEntry = "1" |
tmpProdResultBlock.prodCodeTypeEntry = "1" # Ver como elegimos el código adecuado |
912 |
tmpProdResultBlock.processQuery() |
tmpProdResultBlock.processQuery() |
913 |
# cargar la parte visible de modificacion de precios |
# cargar la parte visible de modificacion de precios |
914 |
tmpProdResultBlock.firstRecord() |
tmpProdResultBlock.firstRecord() |
919 |
if product_id != product_id_anterior: |
if product_id != product_id_anterior: |
920 |
for pricetype in priceListsChain: |
for pricetype in priceListsChain: |
921 |
if pricetype == ("%s" %tmpProdResultBlock.prodPriceTypeIdEntry): |
if pricetype == ("%s" %tmpProdResultBlock.prodPriceTypeIdEntry): |
922 |
|
if len(str(prodResultBlock.prodNameEntry)): |
923 |
|
prodResultBlock.newRecord() |
924 |
prodResultBlock.prodNameEntry= ("%s" %tmpProdResultBlock.prodNameEntry) |
prodResultBlock.prodNameEntry= ("%s" %tmpProdResultBlock.prodNameEntry) |
925 |
prodResultBlock.prodCodeEntry= ("%s" %tmpProdResultBlock.prodCodeEntry) |
prodResultBlock.prodCodeEntry= ("%s" %tmpProdResultBlock.prodCodeEntry) |
926 |
prodResultBlock.prodPriceTypeEntry= ("%s" %tmpProdResultBlock.prodPriceTypeEntry) |
prodResultBlock.prodPriceTypeEntry= ("%s" %tmpProdResultBlock.prodPriceTypeEntry) |
930 |
prodResultBlock.prodProductIdEntry= ("%s" %tmpProdResultBlock.prodIdEntry) |
prodResultBlock.prodProductIdEntry= ("%s" %tmpProdResultBlock.prodIdEntry) |
931 |
prodResultBlock.prodPriceListIdEntry= ("%s" %tmpProdResultBlock.prodPriceTypeIdEntry) |
prodResultBlock.prodPriceListIdEntry= ("%s" %tmpProdResultBlock.prodPriceTypeIdEntry) |
932 |
prodResultBlock.prodIVATaxEntry= ("%s" %tmpProdResultBlock.prodIVATaxEntry) |
prodResultBlock.prodIVATaxEntry= ("%s" %tmpProdResultBlock.prodIVATaxEntry) |
|
prodResultBlock.newRecord() |
|
933 |
product_id_anterior=product_id |
product_id_anterior=product_id |
934 |
break |
break |
935 |
tmpProdResultBlock.nextRecord() |
tmpProdResultBlock.nextRecord() |
936 |
|
prodResultBlock.jumpRecord(0) |
937 |
|
recordCount = prodResultBlock.getRecordCount() |
938 |
|
if recordCount > 1: |
939 |
|
def callback (returnValue): |
940 |
|
global block |
941 |
|
if returnValue >= 0: |
942 |
|
prodResultBlock.jumpRecord(returnValue) |
943 |
|
callTrigger('prodInsertTrigger') |
944 |
|
|
945 |
|
runForm ('productSelect.gfd', {'data': prodResultBlock, 'callback': callback}) |
946 |
|
elif recordCount == 1: |
947 |
|
clientResultBlock.jumpRecord(0) |
948 |
|
callTrigger('prodInsertTrigger') |
949 |
|
|
950 |
</trigger> |
</trigger> |
951 |
<!-- Este bloque sirve para capturar lo valores de la búsqueda --> |
|
|
<block name="prodSearchBlock" datasource="prodSearchDataSource" transparentBlock=""> |
|
|
<label text="Búsqueda de productos a facturar" x="1" y="10"/> |
|
|
<label text="Código" x="1" y="11"/> |
|
|
<entry name="prodCodeSEntry" width="20" x="8" y="11" /> |
|
|
<label text="Nombre" x="1" y="12"/> |
|
|
<entry name="prodNameSEntry" width="20" x="8" y="12" /> |
|
|
<button name="prodSearchButton" trigger="prodSearchTrigger" label="Buscar" width="8" height="1" x="29" y="12"/> |
|
|
</block> |
|
952 |
<!-- En este bloque se almacena el reultado final/real de la búsqueda para seleccion el correcto --> |
<!-- En este bloque se almacena el reultado final/real de la búsqueda para seleccion el correcto --> |
953 |
<block name="prodResultBlock" datasource="prodResultDataSource" restrictInsert="" transparentBlock=""> |
<block name="prodResultBlock" datasource="prodResultDataSource" restrictInsert="" transparentBlock=""> |
954 |
<label text="Código" x="38" y="10"/> |
<entry name="prodCodeEntry" width="10" x="37" y="10" rows="2" hidden=""/> |
955 |
<label text="Producto" x="49" y="10"/> |
<entry name="prodNameEntry" width="22" x="47" y="10" rows="2" hidden=""/> |
|
<entry name="prodCodeEntry" width="10" x="38" y="11" rows="2" /> |
|
|
<entry name="prodNameEntry" width="22" x="48" y="11" rows="2" /> |
|
956 |
<entry name="prodPriceTypeEntry" x="1 " y="1" width="10" rows="8" hidden=""/> |
<entry name="prodPriceTypeEntry" x="1 " y="1" width="10" rows="8" hidden=""/> |
957 |
<entry name="prodUnitPriceEntry" x="1" y="1" width="10" rows="8" hidden=""/> |
<entry name="prodUnitPriceEntry" x="1" y="1" width="10" rows="8" hidden=""/> |
958 |
<entry name="prodPriceEntry" x="1" y="1" width="20" rows="2" hidden=""/> |
<entry name="prodPriceEntry" x="1" y="1" width="20" rows="2" hidden=""/> |
960 |
<entry name="prodProductIdEntry" x="1" y="1" width="5" rows="8" hidden=""/> |
<entry name="prodProductIdEntry" x="1" y="1" width="5" rows="8" hidden=""/> |
961 |
<entry name="prodPriceListIdEntry" x="1" y="1" width="5" rows="8" hidden=""/> |
<entry name="prodPriceListIdEntry" x="1" y="1" width="5" rows="8" hidden=""/> |
962 |
<entry name="prodIVATaxEntry" x="1" y="1" width="5" rows="8" hidden=""/> |
<entry name="prodIVATaxEntry" x="1" y="1" width="5" rows="8" hidden=""/> |
|
<scrollbar page="2" x="71" y="11" width="1" height="2"/> |
|
|
|
|
|
<button name="prodInsertButton" trigger="prodInsertTrigger" label="Insertar" width="9" height="1" x="73" y="12"/> |
|
963 |
</block> |
</block> |
964 |
<!-- Insertar el producto seleccionado --> |
<!-- Insertar el producto seleccionado --> |
965 |
<trigger name="prodInsertTrigger" type="NAMED"> |
<trigger name="prodInsertTrigger" type="NAMED"> |
966 |
import hack |
import hack |
967 |
|
|
968 |
if not str(prodResultBlock.prodNameEntry): |
ownItemBlock.prodCodeSEntry = str(prodResultBlock.prodCodeEntry) |
969 |
print prodResultBlock.getRecordCount() |
ownItemBlock.prodNameSEntry = str(prodResultBlock.prodNameEntry) |
970 |
prodResultBlock.jumpRecord(prodResultBlock.getRecordCount()-2) |
ownItemBlock.priceEntry = str(prodResultBlock.prodPriceEntry) |
971 |
if str(prodResultBlock.prodNameEntry): |
|
972 |
recCount = ownItemBlock.getRecordCount() |
lItemPrice = hack.a2f(prodResultBlock.prodUnitPriceEntry)*hack.a2f(ownItemBlock.qtyEntry) |
973 |
ownItemBlock.jumpRecord(recCount) |
ownItemBlock.taxAmountEntry = (hack.a2f(prodResultBlock.prodIVATaxEntry)/100) * lItemPrice |
974 |
if ownItemBlock.getCurrentRecord().getField("own_product_item.price"): |
ownItemBlock.ivaEntry = hack.a2f(prodResultBlock.prodIVATaxEntry) |
975 |
ownItemBlock.newRecord() |
ownItemBlock.unitPriceEntry = str(prodResultBlock.prodUnitPriceEntry) |
|
ownItemBlock.qtyEntry = "1" |
|
|
ownItemBlock.productCNameEntry = str(prodResultBlock.prodNameEntry) |
|
|
ownItemBlock.priceEntry = str(prodResultBlock.prodPriceEntry) |
|
|
# *************** Esto del taxAmount hay que verlo ************************ |
|
|
lItemPrice = hack.a2f(prodResultBlock.prodUnitPriceEntry)*hack.a2f(ownItemBlock.qtyEntry) |
|
|
ownItemBlock.taxAmountEntry = (hack.a2f(prodResultBlock.prodIVATaxEntry)/100) * lItemPrice |
|
|
ownItemBlock.priceWTaxEntry = lItemPrice + hack.a2f(ownItemBlock.taxAmountEntry) |
|
976 |
|
|
977 |
callTrigger('totalCalcTrigger') |
callTrigger('totalCalcTrigger') |
978 |
</trigger> |
</trigger> |
979 |
<!-- ****** Fin búsqueda ************ --> |
<!-- ****** Fin búsqueda ************ --> |
980 |
|
|
981 |
<!-- Productos facturados --> |
<!-- Productos facturados --> |
982 |
<box height="11" label="Productos a facturar" name="invoiceItemBox" |
<block datasource="ownItemDataSource" name="ownItemBlock"> |
983 |
width="82" x="0" y="13"> |
<!-- <trigger name="ownItemONSwitch" type="ON-SWITCH" src="totalCalcTrigger" /> --> |
984 |
<block datasource="ownItemDataSource" name="ownItemBlock" restrictInsert=""> |
<label text="Productos a facturar" x="1" y="9"/> |
985 |
|
<label text="Código" x="1" y="10"/> |
986 |
<entry field="own_item.own_document" name="ownDocumentEntry" hidden="" x="1" y="1"/> |
<entry name="prodCodeSEntry" width="14" x="1" y="11" rows="10"/> |
987 |
|
<label text="Nombre" x="15" y="10"/> |
988 |
<label name="qtyLbl" text="Cantidad" x="2" y="1"/> |
<entry name="prodNameSEntry" width="20" x="15" y="11" rows="10"/> |
989 |
<!-- mdione's bookmark --> |
<button name="prodSearchButton" trigger="prodSearchTrigger" label="Buscar" width="7" height="10" x="35" y="11"/> |
990 |
<entry field="own_product_item.qty" value="0" name="qtyEntry" rows="5" typecast="number" displaymask="%0.3f" width="12" x="2" y="2"> |
|
991 |
<trigger name="qtyEntryPreFocusout" type="PRE-FOCUSOUT" src="totalCalcTrigger" /> |
<entry field="own_item.own_document" name="ownDocumentEntry" hidden="" x="1" y="1"/> |
992 |
|
|
993 |
|
<label name="qtyLbl" text="Cantidad" x="42" y="10"/> |
994 |
|
<!-- mdione's bookmark --> |
995 |
|
<entry field="own_product_item.qty" name="qtyEntry" rows="10" typecast="number" displaymask="%0.3f" width="12" x="42" y="11"> |
996 |
|
<trigger name="qtyEntryPreFocusout" type="PRE-FOCUSOUT" src="totalCalcTrigger" /> |
997 |
|
</entry> |
998 |
|
|
999 |
|
<label name="priceLbl" text="Precio" x="55" y="10"/> |
1000 |
|
<entry x="55" y="11" readonly="" name="unitPriceEntry" width="10" rows="10" style="label" typecast="number" displaymask="%0.2f"/> |
1001 |
|
|
1002 |
|
<entry x="1" y="14" readonly="" field="own_product_item.price" name="priceEntry" width="10" rows="5" hidden=""/> |
1003 |
|
<entry x="1" y="14" readonly="" field="own_item_tax.tax" name="taxTypeEntry" width="10" rows="5" default="1" hidden="" typecast="number" displaymask="%0.2f"/> |
1004 |
|
<entry x="1" y="14" readonly="" field="own_item_tax.amount" name="taxAmountEntry" width="10" rows="5" hidden="" typecast="number" displaymask="%0.2f"/> |
1005 |
|
|
1006 |
|
|
1007 |
|
<label name="ivaLbl" text="IVA" x="66" y="10"/> |
1008 |
|
<entry name="ivaEntry" style="label" displaymask="%0.0f" |
1009 |
|
rows="10" width="2" x="66" y="11" default="0"> |
1010 |
</entry> |
</entry> |
1011 |
<label name="productLbl" text="Producto" x="15" y="1"/> |
<label name="discountLbl" text="Descuento" x="71" y="10"/> |
1012 |
<entry x="15" y="2" name="productCNameEntry" width="20" rows="5" style="label"/> |
<entry field="own_item.discount" name="discountEntry" default="0.00" typecast="number" displaymask="%0.2f" |
1013 |
|
rows="10" width="10" x="71" y="11"> |
|
<label name="priceLbl" text="Precio" x="42" y="1"/> |
|
|
<entry x="42" y="2" readonly="" name="priceWTaxEntry" width="10" rows="5" style="label" typecast="number" displaymask="%0.2f"/> |
|
|
|
|
|
<entry x="1" y="1" readonly="" field="own_product_item.price" name="priceEntry" width="10" rows="5" hidden="" typecast="number" displaymask="%0.2f"/> |
|
|
<entry x="1" y="1" readonly="" field="own_item_tax.tax" name="taxTypeEntry" width="10" rows="5" default="1" hidden="" typecast="number" displaymask="%0.2f"/> |
|
|
<entry x="1" y="1" readonly="" field="own_item_tax.amount" name="taxAmountEntry" width="10" rows="5" hidden="" typecast="number" displaymask="%0.2f"/> |
|
|
|
|
|
|
|
|
<label name="discountLbl" text="Descuento" x="55" y="1"/> |
|
|
<entry field="own_item.discount" name="discountEntry" value="0" typecast="number" displaymask="%0.2f" |
|
|
rows="5" width="10" x="55" y="2"> |
|
1014 |
<trigger name="discountEntryPreFocusout" type="PRE-FOCUSOUT" src="totalCalcTrigger" /> |
<trigger name="discountEntryPreFocusout" type="PRE-FOCUSOUT" src="totalCalcTrigger" /> |
1015 |
</entry> |
</entry> |
1016 |
<label name="bonusLbl" text="Bonificación" x="66" y="1"/> |
<!-- <label name="bonusLbl" text="Bonif." x="79" y="10"/> --> |
1017 |
<entry field="own_item.bonus" name="bonusEntry" value="0" typecast="number" displaymask="%0.2f" |
<entry field="own_item.bonus" name="bonusEntry" style="label" default="0.00" typecast="number" displaymask="%0.2f" |
1018 |
rows="5" width="10" x="66" y="2"> |
rows="10" width="10" x="79" y="11" hidden=""/> |
1019 |
<trigger name="bonusEntryPreFocusout" type="PRE-FOCUSOUT" src="totalCalcTrigger" /> |
<label name="itemTotalLbl" text="Total" x="82" y="10"/> |
1020 |
|
<entry name="itemTotalEntry" style="label" default="0.00" typecast="number" displaymask="%0.2f" |
1021 |
|
rows="10" width="10" x="82" y="11"> |
1022 |
</entry> |
</entry> |
1023 |
<scrollbar page="5" |
<button name="prodDeleteButton" trigger="prodDeleteTrigger" label="Borrar" width="7" height="10" x="93" y="11"/> |
1024 |
x="79" y="2" width="1" height="5"/> |
<scrollbar page="5" x="103" y="11" width="1" height="10"/> |
1025 |
</block> |
</block> |
1026 |
<!-- Bloques que sirven para el pago --> |
<!-- Bloques que sirven para el pago --> |
1027 |
<block name="ownDocumentProceedingBlock" datasource="ownDocumentProceedingDataSource" transparentBlock=""> |
<block name="ownDocumentProceedingBlock" datasource="ownDocumentProceedingDataSource" transparentBlock=""> |
1037 |
</block> |
</block> |
1038 |
<!-- Datasource que sirve para almacenar el resultado de la búsqueda --> |
<!-- Datasource que sirve para almacenar el resultado de la búsqueda --> |
1039 |
<block datasource="tmpValuesDataSource" name="totalBlock" restrictInsert=""> |
<block datasource="tmpValuesDataSource" name="totalBlock" restrictInsert=""> |
1040 |
<label text="Neto " x="1" y="8"/> |
<label text="Neto " x="50" y="22"/> |
1041 |
<entry name="netoEntry" style="label" readonly="" x="6" y="8" width="12" typecast="number" displaymask="%0.2f" |
<entry name="netoEntry" style="label" readonly="" x="55" y="22" width="12" typecast="number" displaymask="%0.2f" |
1042 |
default="0.00"/> |
default="0.00"/> |
1043 |
<label text="IVA " x="19" y="8"/> |
<label text="IVA " x="62" y="22"/> |
1044 |
<entry name="ivaEntry" style="label" readonly="" x="23" y="8" width="12" typecast="number" displaymask="%0.2f" |
<entry name="ivaEntry" style="label" readonly="" x="66" y="22" width="12" typecast="number" displaymask="%0.2f" |
1045 |
default="0.00"/> |
default="0.00"/> |
1046 |
<label text="Total " x="36" y="8"/> |
<label text="Total " x="76" y="22"/> |
1047 |
<entry name="totalEntry" style="label" readonly="" x="42" y="8" width="12" typecast="number" displaymask="%0.2f" |
<entry name="totalEntry" style="label" readonly="" x="82" y="22" width="12" typecast="number" displaymask="%0.2f" |
1048 |
default="0.00"/> |
default="0.00"/> |
1049 |
</block> |
</block> |
1050 |
<block datasource="ownItemToUpdDataSource" name="ownItemToUpdBlock"> |
<block datasource="ownItemToUpdDataSource" name="ownItemToUpdBlock"> |
1065 |
<entry name="balanceEntry" field="_credit_limit_data.balance" hidden="" x="22" y="109" width="10"/> |
<entry name="balanceEntry" field="_credit_limit_data.balance" hidden="" x="22" y="109" width="10"/> |
1066 |
<entry name="timeStampEntry" field="_credit_limit_data.time_stamp" hidden="" x="33" y="109" width="10"/> |
<entry name="timeStampEntry" field="_credit_limit_data.time_stamp" hidden="" x="33" y="109" width="10"/> |
1067 |
</block> |
</block> |
1068 |
</box> |
<!-- </box> --> |
1069 |
<box height="4" label="Cobro de la factura" name="payBox" |
<box height="4" label="Cobro de la factura" name="payBox" |
1070 |
width="82" x="0" y="23"> |
width="82" x="0" y="23"> |
1071 |
<block datasource="payDataSource" name="payBlock"> |
<block datasource="payDataSource" name="payBlock"> |