1 |
<?xml version="1.0"?> |
<?xml version="1.0" encoding="ISO-8859-1"?> |
|
<!DOCTYPE form SYSTEM "gnue-forms.dtd"> |
|
2 |
|
|
3 |
<!-- GNUe Designer (0.2.0a) |
<form width="84" height="25" title="Facturacion de Servicios"> |
4 |
Saved on: 2002-05-15 13:24:40 --> |
<!-- datatsources --> |
5 |
|
<datasource name="clientDataSource" database="papo" |
6 |
|
table="entity, _entity_data, alien_entity, _alien_entity_data, persona, _persona_data, client, _client_data"> |
7 |
|
<condition> |
8 |
|
<and> |
9 |
|
<!-- 'obvious' join --> |
10 |
|
<eq> |
11 |
|
<cfield name="entity.id"/> |
12 |
|
<cfield name="_entity_data._table"/> |
13 |
|
</eq> |
14 |
|
<eq> |
15 |
|
<cfield name="alien_entity.id"/> |
16 |
|
<cfield name="_alien_entity_data._table"/> |
17 |
|
</eq> |
18 |
|
<eq> |
19 |
|
<cfield name="persona.id"/> |
20 |
|
<cfield name="_persona_data._table"/> |
21 |
|
</eq> |
22 |
|
<eq> |
23 |
|
<cfield name="client.id"/> |
24 |
|
<cfield name="_client_data._table"/> |
25 |
|
</eq> |
26 |
|
<!-- 'real' join --> |
27 |
|
<eq> |
28 |
|
<cfield name="entity.id"/> |
29 |
|
<cfield name="_alien_entity_data.entity"/> |
30 |
|
</eq> |
31 |
|
<eq> |
32 |
|
<cfield name="alien_entity.id"/> |
33 |
|
<cfield name="_persona_data.alien_entity"/> |
34 |
|
</eq> |
35 |
|
<eq> |
36 |
|
<cfield name="persona.id"/> |
37 |
|
<cfield name="_client_data.persona"/> |
38 |
|
</eq> |
39 |
|
<null> |
40 |
|
<cfield name="_entity_data._end_t"/> |
41 |
|
</null> |
42 |
|
<null> |
43 |
|
<cfield name="_alien_entity_data._end_t"/> |
44 |
|
</null> |
45 |
|
<null> |
46 |
|
<cfield name="_persona_data._end_t"/> |
47 |
|
</null> |
48 |
|
<null> |
49 |
|
<cfield name="_client_data._end_t"/> |
50 |
|
</null> |
51 |
|
</and> |
52 |
|
</condition> |
53 |
|
</datasource> |
54 |
|
|
55 |
<form width="84" height="17" title="Facturacion de Servicios"> |
<!-- Origen de datos para obtener el total facturado a este cliente (para el calculo del balance de la cta cte) --> |
56 |
<datasource name="nil" cache="1"/> |
<datasource name="invoiceTotalDataSource" database="papo" |
57 |
<datasource database="papo" name="ownDocumentDataSource" order_by="date" |
table="_entity_data, own_document, own_item, own_serv_item, own_item_tax" |
58 |
table="owndocument"/> |
order_by="own_proditem.id"> |
59 |
<datasource database="papo" detaillink="own_document" |
<condition> |
60 |
master="ownDocumentDataSource" masterlink="id" name="ownItemDataSource" |
<and> |
61 |
table="ownservitemvw"/> |
<eq> |
62 |
|
<!-- Aqui se refiere al cliente --> |
63 |
<trigger name="totalCalcTrigger" type="NAMED"> |
<cfield name="_entity_data._table"/> |
64 |
sum = 0 |
<cfield name="own_document.recipient"/> |
65 |
lCachedRecords = ownItemDataSource._object._currentResultSet._cachedRecords |
</eq> |
66 |
for index in range(len(lCachedRecords)): |
<eq> |
67 |
lAmount = eval("%s" % lCachedRecords[index].getField("amount")) |
<cfield name="own_document.id"/> |
68 |
lBonus = eval("%s" % lCachedRecords[index].getField("bonus")) |
<cfield name="own_item.own_document"/> |
69 |
lDiscount = eval("%s" % lCachedRecords[index].getField("discount")) |
</eq> |
70 |
if (lAmount == None): |
<eq> |
71 |
lAmount = 0 |
<cfield name="own_item.id"/> |
72 |
if (lBonus == None): |
<cfield name="own_serv_item.own_item"/> |
73 |
lBonus = 0 |
</eq> |
74 |
if (lDiscount == None): |
<eq> |
75 |
lDiscount = 0 |
<cfield name="own_item.id"/> |
76 |
sum = sum + lAmount - lBonus - lDiscount |
<cfield name="own_item_tax.own_item"/> |
77 |
lHBonus = eval("%s" % ownDocumentDataSource._object._currentResultSet.current.getField("bonus")) |
</eq> |
78 |
if (lHBonus == None): |
</and> |
79 |
lHBonus = 0 |
</condition> |
80 |
sum = sum - lHBonus |
</datasource> |
|
totalBlock.total = "%s" % sum |
|
|
</trigger> |
|
81 |
|
|
82 |
|
<!-- Origen de datos que sirve para calcular el total adeudado --> |
83 |
|
<datasource name="paidTotalDataSource" database="papo" table="_entity_data, own_document, own_document_proceeding"> |
84 |
|
<condition> |
85 |
|
<and> |
86 |
|
<eq> |
87 |
|
<!-- Aqui se refiere al cliente --> |
88 |
|
<cfield name="_entity_data._table"/> |
89 |
|
<cfield name="own_document.recipient"/> |
90 |
|
</eq> |
91 |
|
<eq> |
92 |
|
<cfield name="own_document.id"/> |
93 |
|
<cfield name="own_document_proceeding.own_document"/> |
94 |
|
</eq> |
95 |
|
</and> |
96 |
|
</condition> |
97 |
|
</datasource> |
98 |
|
|
99 |
|
<!-- Origen de datos que contiene el encabezado de la factura --> |
100 |
|
<datasource name="ownDocumentDataSource" database="papo" table="own_document" |
101 |
|
order_by="date" /> |
102 |
|
|
103 |
|
<!-- Origen de datos que sirve para consultar el limite de crédito --> |
104 |
|
<!-- asignado al cliente que se le factura --> |
105 |
|
<!-- el primero es para el text lookup de los datos del cliente --> |
106 |
|
<datasource name="textLookUpCreditLimitDataSource" database="papo" table="_credit_limit_data"> |
107 |
|
<condition> |
108 |
|
<and> |
109 |
|
<eq> |
110 |
|
<cfield name="_credit_limit_data.movement_type"/> |
111 |
|
<cconst value="1"/> |
112 |
|
</eq> |
113 |
|
<null> |
114 |
|
<cfield name="_credit_limit_data._end_t"/> |
115 |
|
</null> |
116 |
|
</and> |
117 |
|
</condition> |
118 |
|
</datasource> |
119 |
|
|
120 |
|
<!-- y el segundo para el calculo del balance en si --> |
121 |
|
<datasource name="creditLimitDataSource" database="papo" table="_credit_limit_data"> |
122 |
|
<condition> |
123 |
|
<and> |
124 |
|
<eq> |
125 |
|
<cfield name="_credit_limit_data.movement_type"/> |
126 |
|
<cconst value="1"/> |
127 |
|
</eq> |
128 |
|
<null> |
129 |
|
<cfield name="_credit_limit_data._end_t"/> |
130 |
|
</null> |
131 |
|
</and> |
132 |
|
</condition> |
133 |
|
</datasource> |
134 |
|
|
135 |
|
<!-- Origen de datos que contiene los items de la factura --> |
136 |
|
<datasource name="ownItemDataSource" database="papo" table="own_item, own_serv_item, own_item_tax" |
137 |
|
master="ownDocumentDataSource" masterlink="id" detaillink="own_item.own_document"> |
138 |
|
<condition> |
139 |
|
<and> |
140 |
|
<eq> |
141 |
|
<cfield name="own_item.id"/> |
142 |
|
<cfield name="own_serv_item.own_item"/> |
143 |
|
</eq> |
144 |
|
<eq> |
145 |
|
<cfield name="own_item.id"/> |
146 |
|
<cfield name="own_item_tax.own_item"/> |
147 |
|
</eq> |
148 |
|
<eq> |
149 |
|
<cfield name="own_item_tax.tax"/> |
150 |
|
<cconst value="1"/> |
151 |
|
</eq> |
152 |
|
</and> |
153 |
|
</condition> |
154 |
|
</datasource> |
155 |
|
|
156 |
|
<!-- Origen de datos que sirve para dar de alta procedimientos de pago (en este caso de la factura) --> |
157 |
|
<datasource name="proceedingDataSource" database="papo" table="proceeding"/> |
158 |
|
|
159 |
|
<!-- Origen de datos que sirve para dar de alta pagos con algun tipo de currency --> |
160 |
|
<datasource name="ownDocumentProceedingDataSource" database="papo" table="own_document_proceeding"/> |
161 |
|
|
162 |
|
<!-- 'Origen' de datos para mantener los valores calculables --> |
163 |
|
<datasource name="calculatedValuesDataSource" cache="1"/> |
164 |
|
|
165 |
|
<datasource name="paymentDataSource" cache="1"/> |
166 |
|
|
167 |
|
<!-- Origen de datos que sirve para dar de alta pagos con algun tipo de currency --> |
168 |
|
<datasource name="currencyMovementDataSource" database="papo" table="movement, currency_movement"> |
169 |
|
<condition> |
170 |
|
<eq> |
171 |
|
<cfield name="movement.id"/> |
172 |
|
<cfield name="currency_movement.movement"/> |
173 |
|
</eq> |
174 |
|
</condition> |
175 |
|
</datasource> |
176 |
|
|
177 |
|
<!-- Origen de datos que sirve para dar de alta pagos con cta. cte. --> |
178 |
|
<datasource name="movementDataSource" database="papo" table="movement"/> |
179 |
|
|
180 |
|
<!-- Origen de datos que sirve para dar de alta procedimientos de pago (en este caso de la factura) --> |
181 |
|
<datasource name="proceedingDataSource" database="papo" table="proceeding"/> |
182 |
|
|
183 |
|
<!-- Origen de datos que sirve para dar de alta pagos con algun tipo de currency --> |
184 |
|
<datasource name="ownDocumentProceedingDataSource" database="papo" table="own_document_proceeding"/> |
185 |
|
|
186 |
|
<!-- global triggers --> |
187 |
|
<!-- Valor final del servicio, con impuesto y todo --> |
188 |
|
<trigger name="calculateEndPriceTrigger" type="NAMED"><![CDATA[ |
189 |
|
from hack import a2f |
190 |
|
|
191 |
|
itemPrice= a2f (ownItemBlock.priceEntry) |
192 |
|
itemTax= a2f (ownItemBlock.taxEntry) |
193 |
|
ownItemBlock.endPriceEntry= str (round (itemPrice*(1 + itemTax/100), 2)) |
194 |
|
|
195 |
|
# update total |
196 |
|
callTrigger ('calculateTotalTrigger') |
197 |
|
]]></trigger> |
198 |
|
|
199 |
|
<!-- Este trigger calcula el total facturado --> |
200 |
|
<trigger name="calculateTotalTrigger" type="NAMED"><![CDATA[ |
201 |
|
from hack import a2f |
202 |
|
|
203 |
|
netTotal= 0 |
204 |
|
|
205 |
|
itemNumber= ownItemBlock.getRecordCount () |
206 |
|
for i in range (itemNumber): |
207 |
|
ownItemBlock.jumpRecord (i) |
208 |
|
netTotal= netTotal+a2f (ownItemBlock.endPriceEntry) |
209 |
|
|
210 |
|
totalBlock.totalEntry = str (netTotal) |
211 |
|
paymentBlock.cashEntry = str (netTotal) |
212 |
|
paymentBlock.ctaCteEntry = "0.0" |
213 |
|
]]></trigger> |
214 |
|
|
215 |
|
<trigger type="On-Startup"><![CDATA[ |
216 |
|
ownDocumentBlock.dateEntry= ownDocumentDataSource.getTimeStamp () |
217 |
|
]]></trigger> |
218 |
|
|
219 |
|
<!-- buttons triggers --> |
220 |
|
<trigger name="quitTrigger" type="NAMED"><![CDATA[ |
221 |
|
callTrigger ('rollbackTrigger') |
222 |
|
ownDocumentBlock.processRollback () |
223 |
|
# this will (should?) be close |
224 |
|
exit () |
225 |
|
]]></trigger> |
226 |
|
|
227 |
|
<trigger name="rollbackTrigger" type="NAMED"><![CDATA[ |
228 |
|
for block in form._object._blockList: |
229 |
|
block.processRollback () |
230 |
|
|
231 |
|
ownDocumentBlock.dateEntry= ownDocumentDataSource.getTimeStamp () |
232 |
|
totalBlock.totalEntry= "" |
233 |
|
paymentBlock.cashEntry= "" |
234 |
|
paymentBlock.ctaCteEntry= "" |
235 |
|
]]></trigger> |
236 |
|
|
237 |
|
<trigger name="commitTrigger" type="NAMED"><![CDATA[ |
238 |
|
from hack import a2f |
239 |
|
|
240 |
|
# print "here 1!" |
241 |
|
currentCredit= a2f (calculatedValuesDataSource.creditLimitAmount) - \ |
242 |
|
a2f (ownDocumentBlock.clientRecipientBox.debtEntry) |
243 |
|
|
244 |
|
if a2f (totalBlock.totalEntry)>currentCredit: |
245 |
|
genericBox ("Está excedido el Límite de Crédito",["Ok"]) |
246 |
|
else: |
247 |
|
# print "here 2!" |
248 |
|
if ownItemBlock.getRecordCount ()>0 and len (ownItemBlock.serviceEntry)>0: |
249 |
|
# print "here 3!" |
250 |
|
# el form no esta vacio |
251 |
|
if len(ownDocumentBlock.dateEntry)==0: |
252 |
|
ownDocumentBlock.dateEntry= ownDocumentDataSource.getTimeStamp () |
253 |
|
|
254 |
|
proceedingBlock.processRollback () |
255 |
|
proceedingBlock.idEntry.autofillBySequence ('proceeding_id_seq') |
256 |
|
proceedingBlock.dateEntry= proceedingDataSource.getTimeStamp () |
257 |
|
|
258 |
|
ownDocumentBlock.idEntry.autofillBySequence ('own_document_id_seq') |
259 |
|
ownDocumentBlock.typeEntry= "1" |
260 |
|
|
261 |
|
ownDocumentProceedingBlock.processRollback () |
262 |
|
ownDocumentProceedingBlock.proceedingEntry= str (proceedingBlock.idEntry) |
263 |
|
ownDocumentProceedingBlock.ownDocumentEntry= str (ownDocumentBlock.idEntry) |
264 |
|
ownDocumentProceedingBlock.amountEntry= str (paymentBlock.cashEntry) |
265 |
|
|
266 |
|
# movimiento en pesos |
267 |
|
currencyMovementBlock.processRollback () |
268 |
|
currencyMovementBlock.proceedingEntry= str (proceedingBlock.idEntry) |
269 |
|
currencyMovementBlock.movementTypeEntry= "" # Revisar como queda esto |
270 |
|
currencyMovementBlock.currencyTypeEntry= "1" |
271 |
|
currencyMovementBlock.amountEntry= str (paymentBlock.cashEntry) |
272 |
|
|
273 |
|
# movimiento por cuenta corriente |
274 |
|
movementBlock.processRollback () |
275 |
|
if a2f (paymentBlock.ctaCteEntry)>0: |
276 |
|
movementBlock.proceedingEntry= str (proceedingBlock.idEntry) |
277 |
|
movementBlock.movementTypeEntry= "1" # Revisar com queda esto |
278 |
|
movementBlock.amountEntry= str (paymentBlock.ctaCteEntry) |
279 |
|
|
280 |
|
ownDocumentBlock.commit () |
281 |
|
|
282 |
|
setFocus(ownDocumentBlock.clientRecipientBox.clientEntry) |
283 |
|
|
284 |
|
# print "here 4!" |
285 |
|
callTrigger('rollbackTrigger') |
286 |
|
ownDocumentBlock.newRecord () |
287 |
|
ownDocumentBlock.dateEntry= ownDocumentDataSource.getTimeStamp() |
288 |
|
totalBlock.totalEntry= "" |
289 |
|
paymentBlock.cashEntry= "" |
290 |
|
paymentBlock.ctaCteEntry= "" |
291 |
|
]]></trigger> |
292 |
|
|
293 |
|
<!-- the form --> |
294 |
<page name="Factura de Servicios"> |
<page name="Factura de Servicios"> |
295 |
<block datasource="ownDocumentDataSource" name="headerBlock"> |
<box name="invoiceHeaderBox" label="Factura de servicios" |
296 |
<entry field="id" hidden="" name="pkEntry" x="1" y="1"/> |
x="0" y="0" width="82" height="8"> |
297 |
<box height="7" label="Factura de servicios" name="invoiceHeaderBox" width="74" |
|
298 |
x="0" y="0"> |
<block name="ownDocumentBlock" datasource="ownDocumentDataSource"> |
299 |
<label name="dateLbl" rows="1" text="Fecha" x="1" y="1"/> |
<!-- hidden fields --> |
300 |
<entry field="date" name="dateEntry" readonly="" typecast="date" rows="1" width="24" x="1" y="2"/> |
<entry name="idEntry" field="id" hidden="" |
301 |
<label name="bonusLbl" rows="1" text="Bonificacion" x="33" y="1"/> |
x="1" y="1"/> |
302 |
<entry field="bonus" name="hBonusEntry" rows="1" width="10" x="33" y="2" typecast="number" > |
<entry name="typeEntry" field="own_document_type" hidden="" |
303 |
<trigger type="PRE-FOCUSOUT" name="reCalcTrigger" src="totalCalcTrigger" /> |
x="1" y="1"/> |
304 |
</entry> |
|
305 |
<button x="58" y="2" trigger="commitTrigger" width="14" label="Nueva" |
<!-- Datos del cliente --> |
306 |
name="commitBtn" height="1"/> |
<box name="clientRecipientBox" label="Datos del Cliente" |
307 |
<button x="58" y="3" trigger="rollbackTrigger" width="14" label="Blanquea" |
x="0" y="1" width="65" height="6"> |
308 |
name="rollbackBtn" height="1"/> |
<!-- form things --> |
309 |
|
<label name="clientLabel" text="Cliente" |
310 |
<button x="58" y="4" trigger="quitTrigger" width="14" label="Salir" |
x="1" y="1"/> |
311 |
name="quitBtn" height="1"/> |
<!-- foreign_key y foreign_key_description estan deprecados --> |
312 |
|
<!-- se van a llamar fk_source y fk_description respectivamente --> |
313 |
<trigger name="t" type="Pre-Insert"> |
<entry name="clientEntry" field="recipient" style="dropdown" |
314 |
if (headerBlock.pkEntry == ""): |
foreign_key="clientDataSource._entity_data._table" foreign_key_description="_entity_data.name" |
315 |
headerBlock.pkEntry.autofillBySequence('owndocument_id_seq') |
x="1" y="2" width="30"> |
316 |
</trigger> |
<trigger type="PRE-FOCUSOUT" name="showClientDataTrigger"><![CDATA[ |
317 |
|
if str (ownDocumentBlock.clientRecipientBox.clientEntry): |
318 |
<trigger name="commitTrigger" type="NAMED"> |
import gnue.common.GConditions as GConditions |
319 |
from gnue.forms.GFEvent import * |
from hack import a2f |
320 |
setFocus(headerBlock.dateEntry) |
|
321 |
self._object.dispatchEvent(GFEvent('requestCOMMIT')) |
# Actualiza el puntaje |
322 |
setFocus(itemsBlock.bonusEntry) |
ownDocumentBlock.clientRecipientBox.scoreEntry= str (ownDocumentBlock.clientRecipientBox.clientEntry) |
323 |
self._object.dispatchEvent(GFEvent('requestCOMMIT')) |
# Actualiza el limite de credito |
324 |
setFocus(headerBlock.dateEntry) |
ownDocumentBlock.clientRecipientBox.creditLimitEntry= str (ownDocumentBlock.clientRecipientBox.clientEntry) |
325 |
self._object.dispatchEvent(GFEvent('requestNEWRECORD')) |
# Aca si existe un balance, calcula la deuda desde ese balance en adelante sino |
326 |
totalBlock.total = "" |
# calcula la deuda desde el primer documento vinculado al cliente actual |
327 |
</trigger> |
creditLimitBlock.processRollback () |
328 |
|
creditLimitBlock.initQuery () |
329 |
<trigger name="rollbackTrigger" type="NAMED"> |
creditLimitBlock.entityEntry= str (ownDocumentBlock.clientRecipientBox.clientEntry) |
330 |
from gnue.forms.GFEvent import * |
creditLimitBlock.processQuery () |
331 |
import mx.DateTime |
calculatedValuesDataSource.creditLimitAmount= str (creditLimitBlock.creditLimitAmountEntry) |
|
setFocus(headerBlock.hBonusEntry) |
|
|
self._object.dispatchEvent(GFEvent('requestROLLBACK')) |
|
|
headerBlock.dateEntry = mx.DateTime.localtime() |
|
|
totalBlock.total = "" |
|
|
</trigger> |
|
|
|
|
|
<trigger name="quitTrigger" type="NAMED"> |
|
|
from gnue.forms.GFEvent import * |
|
|
self._object.dispatchEvent(GFEvent('requestROLLBACK')) |
|
|
self._object._app._ui.mainWindow.Close() |
|
|
</trigger> |
|
|
</box> |
|
332 |
|
|
333 |
|
cond = GConditions.GCondition () |
334 |
|
|
335 |
</block> |
# print "calc 1" |
336 |
|
balance = 0 |
337 |
|
if str (creditLimitBlock.balanceEntry): |
338 |
|
# print "calc 2" |
339 |
|
tmpAnd= GConditions.GCand (cond) |
340 |
|
gt= GConditions.GCgt (tmpAnd) |
341 |
|
GConditions.GCField (gt, "own_document.date") |
342 |
|
GConditions.GCConst (gt, str (creditLimitBlock.timeStampEntry)) |
343 |
|
eq= GConditions.GCeq (tmpAnd) |
344 |
|
GConditions.GCField (eq, "own_document.recipient") |
345 |
|
GConditions.GCConst (eq, str (ownDocumentBlock.clientRecipientBox.clientEntry)) |
346 |
|
balance= a2f (creditLimitBlock.balance) |
347 |
|
else: |
348 |
|
# print "calc 3" |
349 |
|
eq= GConditions.GCeq (cond) |
350 |
|
GConditions.GCField (eq, "own_document.recipient") |
351 |
|
GConditions.GCConst (eq, str (ownDocumentBlock.clientRecipientBox.clientEntry)) |
352 |
|
|
353 |
<box height="11" label="Servicios a facturar" name="invoiceItemBox" width="82" |
# Calculo del total facturado |
354 |
x="0" y="6"> |
invoiceResultSet= invoiceTotalDataSource.createResultSet (cond) |
355 |
<block datasource="ownItemDataSource" name="itemsBlock"> |
more= invoiceResultSet.firstRecord () |
356 |
<trigger name="t_items" type="Pre-Insert"> |
spentTotal= 0 |
357 |
itemsBlock.ownDocumentEntry = headerBlock.pkEntry |
|
358 |
itemsBlock.oi_idEntry.autofillBySequence('ownitem_id_seq') |
# por todos los documentos post-checkpoint (si no hay, desde el principio) |
359 |
itemsBlock.osi_idEntry.autofillBySequence('ownservitem_id_seq') |
# print "calc 4" |
360 |
</trigger> |
while more: |
361 |
|
invoiceTotal= 0 |
362 |
|
currentOwnDocument= invoiceResultSet.current.getField ("own_document.id") |
363 |
<button x="74" y="2" trigger="insertItemTrigger" width="6" label="ins." |
|
364 |
name="addItemBtn" height="1"> |
# por todos los items del documento |
365 |
<options> |
# print "calc 5: [%s] %d" % (currentOwnDocument, spentTotal) |
366 |
<option name="tip" value="insertar"/> |
while invoiceResultSet.current.getField ("own_document.id")==currentOwnDocument and more: |
367 |
</options> |
itemTotal= a2f (invoiceResultSet.current.getField ("own_serv_item.amount")) |
368 |
</button> |
currentItem= invoiceResultSet.current.getField ("own_item.id") |
369 |
|
|
370 |
<trigger name="insertItemTrigger" type="NAMED"> |
# por todos los impuestos del item |
371 |
from gnue.forms.GFEvent import * |
# print "calc 6: [%s:%s] %d" % (currentOwnDocument, currentItem, invoiceTotal) |
372 |
setFocus(itemsBlock.bonusEntry) |
while invoiceResultSet.current.getField ("own_item.id")==currentItem and more: |
373 |
self._object.dispatchEvent(GFEvent('requestNEWRECORD')) |
# calculate the item price exactly as I do in the other trigger |
374 |
</trigger> |
# not revised yet, but I think it was like this |
375 |
|
itemTaxTotal= round (itemTotal*(a2f (invoiceResultSet.current.getField ("own_item_tax.amount"))/100), 2) |
376 |
<button x="74" y="3" trigger="firstItemTrigger" width="6" label="|<" |
more= invoiceResultSet.nextRecord () |
377 |
name="topItemBtn" height="1"> |
# print "calc 7: %d:%d" % (itemTotal, itemTaxTotal) |
378 |
<trigger name="firstItemTrigger" type="NAMED"> |
|
379 |
from gnue.forms.GFEvent import * |
invoiceTotal+= itemTotal+itemTaxTotal |
380 |
setFocus(itemsBlock.bonusEntry) |
|
381 |
self._object.dispatchEvent(GFEvent('requestFIRSTRECORD')) |
spentTotal+= invoiceTotal |
382 |
</trigger> |
|
383 |
</button> |
# Calculo del total cobrado |
384 |
<button x="74" y="4" trigger="prevItemTrigger" width="6" label="<" |
paidResultSet= paidTotalDataSource.createResultSet (cond) |
385 |
name="prevItemBtn" height="1"> |
|
386 |
<trigger name="prevItemTrigger" type="NAMED"> |
more= paidResultSet.firstRecord () |
387 |
from gnue.forms.GFEvent import * |
paidTotal= 0 |
388 |
setFocus(itemsBlock.bonusEntry) |
|
389 |
self._object.dispatchEvent(GFEvent('requestPREVRECORD')) |
# por todos los pagos |
390 |
</trigger> |
# print "calc 8" |
391 |
</button> |
while more: |
392 |
<button x="74" y="5" trigger="nextItemTrigger" width="6" label=">" |
paidTotal+= a2f (paidResultSet.current.getField ("own_document_proceeding.amount")) |
393 |
name="nextItemBtn" height="1"> |
more= paidResultSet.nextRecord () |
394 |
<trigger name="nextItemTrigger" type="NAMED"> |
# print "calc 9" |
395 |
from gnue.forms.GFEvent import * |
|
396 |
setFocus(itemsBlock.bonusEntry) |
# Calculo del total adeudado |
397 |
self._object.dispatchEvent(GFEvent('requestNEXTRECORD')) |
# print "--> %d %d %d" % (spentTotal, balance, paidTotal) |
398 |
</trigger> |
debt= spentTotal - balance - paidTotal |
399 |
</button> |
ownDocumentBlock.clientRecipientBox.debtEntry= debt |
400 |
<button x="74" y="6" trigger="lastItemTrigger" width="6" label=">|" |
|
401 |
name="lastItemBtn" height="1"> |
### FALTA GRABAR EL BALANCE ### |
402 |
<trigger name="lastItemTrigger" type="NAMED"> |
]]></trigger> |
403 |
from gnue.forms.GFEvent import * |
|
404 |
setFocus(itemsBlock.bonusEntry) |
<trigger type="PRE-FOCUSIN" name="showScoreTrigger"><![CDATA[ |
405 |
self._object.dispatchEvent(GFEvent('requestLASTRECORD')) |
ownDocumentBlock.clientRecipientBox.scoreEntry= "" |
406 |
</trigger> |
ownDocumentBlock.clientRecipientBox.creditLimitEntry= "" |
407 |
</button> |
ownDocumentBlock.clientRecipientBox.priceTypeEntry= "" |
408 |
|
ownDocumentBlock.clientRecipientBox.debtEntry= "" |
409 |
<entry field="oi_id" name="oi_idEntry" hidden="" x="7" y="7" width="5"/> |
]]></trigger> |
410 |
<entry field="osi_id" name="osi_idEntry" hidden="" x="14" y="7" width="5"/> |
</entry> |
411 |
<entry field="own_document" name="ownDocumentEntry" hidden="" x="21" y="0"/> |
<label name="scoreLabel" text="Puntaje" |
412 |
<label name="bonusLbl" text="Bonificacion" x="2" y="1"/> |
x="32" y="1" /> |
413 |
<entry field="bonus" name="bonusEntry" rows="5" width="12" x="2" typecast="number" y="2"> |
<!-- foreign_key y foreign_key_description estan deprecados --> |
414 |
<trigger type="PRE-FOCUSOUT" src="totalCalcTrigger" /> |
<!-- se van a llamar fk_source y fk_description respectivamente --> |
415 |
</entry> |
<entry name="scoreEntry" field="recipient" style="textlookup" readonly="" |
416 |
<label name="discountLbl" text="Descuento" x="15" y="1"/> |
foreign_key="clientDataSource._entity_data._table" foreign_key_description="_client_data.score" |
417 |
<entry field="discount" name="discountEntry" rows="5" width="12" x="15" typecast="number" |
x="32" y="2" width="10"/> |
418 |
y="2"> |
<label name="ctaCteLabel" text="Cta. Cte." |
419 |
<trigger type="PRE-FOCUSOUT" src="totalCalcTrigger" /> |
x="43" y="1"/> |
420 |
|
<!-- foreign_key y foreign_key_description estan deprecados --> |
421 |
|
<!-- se van a llamar fk_source y fk_description respectivamente --> |
422 |
|
<entry name="creditLimitEntry" field="recipient" style="textlookup" readonly="" |
423 |
|
foreign_key="textLookUpCreditLimitDataSource.entity" foreign_key_description="credit_limit" |
424 |
|
x="43" y="2" width="8"/> |
425 |
|
<label name="debtLabel" text="Deuda" |
426 |
|
x="55" y="2"/> |
427 |
|
<entry name="debtEntry" style="label" |
428 |
|
x="55" y="3" width="12"/> |
429 |
|
</box> |
430 |
|
|
431 |
|
<!-- Datos de la factura --> |
432 |
|
<entry name="dateEntry" field="date" style="label" readonly="" typecast="date" |
433 |
|
x="7" y="7" width="24"/> |
434 |
|
|
435 |
|
<!-- buttons --> |
436 |
|
<button name="commitButton" label="Aceptar" trigger="commitTrigger" |
437 |
|
x="65" y="3" width="14" height="1"/> |
438 |
|
<button name="rollbackButton" label="Deshacer" trigger="rollbackTrigger" |
439 |
|
x="65" y="4" width="14" height="1"/> |
440 |
|
<button name="quitButton" label="Salir" trigger="quitTrigger" |
441 |
|
x="65" y="5" width="14" height="1"/> |
442 |
|
</block> |
443 |
|
|
444 |
|
<!-- Limites de credito del cliente --> |
445 |
|
<block datasource="creditLimitDataSource" name="creditLimitBlock"> |
446 |
|
<entry name="entityEntry" field="_credit_limit_data.entity" hidden="" |
447 |
|
x="1" y="1" width="10"/> |
448 |
|
<entry name="movementTypeEntry" field="_credit_limit_data.movement_type" hidden="" |
449 |
|
x="1" y="1" width="10"/> |
450 |
|
<entry name="balanceEntry" field="_credit_limit_data.balance" hidden="" |
451 |
|
x="1" y="1" width="10"/> |
452 |
|
<entry name="timeStampEntry" field="_credit_limit_data.time_stamp" hidden="" |
453 |
|
x="1" y="1" width="10"/> |
454 |
|
</block> |
455 |
|
</box> |
456 |
|
|
457 |
|
<!-- Servicios facturados --> |
458 |
|
<box name="invoiceItemBox" label="Servicios a facturar" |
459 |
|
x="0" y="7" width="82" height="16"> |
460 |
|
<block name="ownItemBlock" datasource="ownItemDataSource"> |
461 |
|
<!-- hidden entries --> |
462 |
|
<entry name="ownDocumentEntry" field="own_item.own_document" hidden="" |
463 |
|
x="1" y="1"/> |
464 |
|
|
465 |
|
<!-- Datos del servicio --> |
466 |
|
<label name="serviceLabel" text="Servicio" |
467 |
|
x="1" y="1"/> |
468 |
|
<entry name="serviceEntry" field="own_serv_item.description" |
469 |
|
x="1" y="2" width="40" height="2" rows="5" rowSpacer="1"/> |
470 |
|
<label name="priceLabel" text="Precio" |
471 |
|
x="42" y="1"/> |
472 |
|
<!-- falta agregar los impuestos al servicio --> |
473 |
|
<!-- idea: un boton 'Impuestos' que abra una ventana con dos textlist (que no hay) --> |
474 |
|
<!-- uno con todos los impuestos posibles y el otro con los que se le van a aplicar al servicio --> |
475 |
|
<!-- lo cual me lleva a pensar que se puede devolver cosas de ventanas a traves de tablas --> |
476 |
|
<entry name="priceEntry" field="own_serv_item.amount" |
477 |
|
x="42" y="2" width="10" rows="5" rowSpacer="1"> |
478 |
|
<trigger type="PRE-FOCUSOUT" src="calculateEndPriceTrigger"/> |
479 |
</entry> |
</entry> |
480 |
<label name="descriptionLbl" text="Descripcion" x="29" y="1"/> |
<label name="taxLabel" text="IVA (%)" |
481 |
<entry field="description" name="descriptionEntry" rows="5" width="30" x="29" |
x="53" y="1"/> |
482 |
y="2"/> |
<entry name="taxEntry" field="own_item_tax.amount" value="0" typecast="number" |
483 |
<label name="amountLbl" text="Monto" x="60" y="1"/> |
x="53" y="2" width="10" rows="5" rowSpacer="1"> |
484 |
<entry field="amount" value="0" name="unitPriceEntry" rows="5" typecast="number" |
<trigger type="PRE-FOCUSOUT" src="calculateEndPriceTrigger"/> |
|
width="12" x="60" y="2"> |
|
|
<trigger type="PRE-FOCUSOUT" src="totalCalcTrigger" /> |
|
485 |
</entry> |
</entry> |
486 |
|
<label name="endPriceLabel" text="Precio final" |
487 |
|
x="64" y="1"/> |
488 |
|
<entry name="endPriceEntry" style="label" |
489 |
|
x="64" y="2" width="10" rows="5" rowSpacer="1"/> |
490 |
|
<scrollbar page="5" |
491 |
|
x="76" y="2" width="1" height="10"/> |
492 |
|
</block> |
493 |
|
|
494 |
|
<!-- Valores calculados --> |
495 |
|
<!-- notar que dicen read-only, pero se pueden cambiar por 'soft' --> |
496 |
|
<block name="totalBlock" datasource="calculatedValuesDataSource"> |
497 |
|
<label text="Total" |
498 |
|
x="53" y="13"/> |
499 |
|
<entry name="totalEntry" style="label" |
500 |
|
x="64" y="13" width="12"/> |
501 |
</block> |
</block> |
502 |
<block datasource="nil" name="totalBlock"> |
</box> |
503 |
<label name="totalLbl" text="Total" x="29" y="8"/> |
<box name="paymentBox" label="Cobro de la factura" |
504 |
<entry name="total" readonly="" x="60" y="8" width="12"/> |
x="0" y="22" width="82" height="4"> |
505 |
|
<block name="paymentBlock" datasource="paymentDataSource"> |
506 |
|
<label text="Efectivo :" |
507 |
|
x="1" y="1"/> |
508 |
|
<entry name="cashEntry" |
509 |
|
x="11" y="1" width="12"> |
510 |
|
<trigger type="Pre-Focusout"><![CDATA[ |
511 |
|
from hack import a2f |
512 |
|
|
513 |
|
paymentBlock.ctaCteEntry= str (a2f (totalBlock.totalEntry) - a2f (paymentBlock.cashEntry)) |
514 |
|
]]></trigger> |
515 |
|
</entry> |
516 |
|
<label text="Cta. Cte. :" |
517 |
|
x="24" y="1"/> |
518 |
|
<entry name="ctaCteEntry" |
519 |
|
x="36" y="1" width="12"> |
520 |
|
<trigger type="Pre-Focusout"><![CDATA[ |
521 |
|
from hack import a2f |
522 |
|
|
523 |
|
paymentBlock.cashEntry= str (a2f (totalBlock.totalEntry) - a2f (paymentBlock.ctaCteEntry)) |
524 |
|
]]></trigger> |
525 |
|
</entry> |
526 |
</block> |
</block> |
527 |
</box> |
</box> |
528 |
|
<!-- blocks needed due to broken functionality --> |
529 |
|
<!-- the order is important. e.g., prceedingBlock should be before ownDocumentProceedingBlock --> |
530 |
|
<block name="creditLimitBlock" datasource="creditLimitDataSource"> |
531 |
|
<entry name="entityEntry" field="_credit_limit_data.entity" hidden="" |
532 |
|
x="11" y="109" width="10"/> |
533 |
|
<entry name="movementTypeEntry" field="_credit_limit_data.movement_type" hidden="" |
534 |
|
x="1" y="109" width="10"/> |
535 |
|
<entry name="creditLimitAmountEntry" field="_credit_limit_data.credit_limit" hidden="" |
536 |
|
x="1" y="109" width="10"/> |
537 |
|
<entry name="balanceEntry" field="_credit_limit_data.balance" hidden="" |
538 |
|
x="22" y="109" width="10"/> |
539 |
|
<entry name="timeStampEntry" field="_credit_limit_data.time_stamp" hidden="" |
540 |
|
x="33" y="109" width="10"/> |
541 |
|
</block> |
542 |
|
<block name="proceedingBlock" datasource="proceedingDataSource"> |
543 |
|
<entry name="idEntry" field="id" hidden="" |
544 |
|
x="1" y="1" width="12"/> |
545 |
|
<entry name="dateEntry" field="date" hidden="" |
546 |
|
x="1" y="1" width="12"/> |
547 |
|
</block> |
548 |
|
<block name="ownDocumentProceedingBlock" datasource="ownDocumentProceedingDataSource"> |
549 |
|
<entry name="proceedingEntry" field="proceeding" hidden="" |
550 |
|
x="1" y="1" width="12"/> |
551 |
|
<entry name="ownDocumentEntry" field="own_document" hidden="" |
552 |
|
x="1" y="1" width="12"/> |
553 |
|
<entry name="amountEntry" field="amount" hidden="" |
554 |
|
x="1" y="1" width="12"/> |
555 |
|
</block> |
556 |
|
<block name="currencyMovementBlock" datasource="currencyMovementDataSource"> |
557 |
|
<entry name="proceedingEntry" field="movement.proceeding" hidden="" |
558 |
|
x="1" y="1" width="12"/> |
559 |
|
<entry name="movementTypeEntry" field="movement.movement_type" hidden="" |
560 |
|
x="1" y="1" width="12"/> |
561 |
|
<entry name="amountEntry" field="movement.amount" hidden="" |
562 |
|
x="1" y="1" width="12"/> |
563 |
|
<entry name="currencyTypeEntry" field="currency_movement.currency_type" hidden="" |
564 |
|
x="1" y="1" width="12"/> |
565 |
|
</block> |
566 |
|
<block name="movementBlock" datasource="movementDataSource"> |
567 |
|
<entry name="proceedingEntry" field="movement.proceeding" hidden="" |
568 |
|
x="1" y="1" width="12"/> |
569 |
|
<entry name="movementTypeEntry" field="movement.movement_type" hidden="" |
570 |
|
x="1" y="1" width="12"/> |
571 |
|
<entry name="amountEntry" field="movement.amount" hidden="" |
572 |
|
x="1" y="1" width="12"/> |
573 |
|
</block> |
574 |
</page> |
</page> |
575 |
</form> |
</form> |