5 |
use PAPO; |
use PAPO; |
6 |
my $uniqed=0; |
my $uniqed=0; |
7 |
</neb:Block> |
</neb:Block> |
8 |
|
<!-- busqueda --> |
9 |
|
<!-- datasources --> |
10 |
|
<neb:Sub neb:src="datasource.nebc" zot="../zot/PAPO-ER.zot" search="own_branch" |
11 |
|
name="ownBranchSearchDataSource" database="papo"/> |
12 |
|
<datasource name="searchDataSource" cache="1"/> |
13 |
|
<datasource name="posDataSource" database="papo" table="_entity_data as branch,_own_pos_data,_own_entity_data,_entity_data" > |
14 |
|
<condition> |
15 |
|
<and> |
16 |
|
<eq> |
17 |
|
<cfield name="_own_pos_data.own_entity"/> |
18 |
|
<cfield name="_own_entity_data._table"/> |
19 |
|
</eq> |
20 |
|
<eq> |
21 |
|
<cfield name="_own_entity_data.entity"/> |
22 |
|
<cfield name="_entity_data._table"/> |
23 |
|
</eq> |
24 |
|
<!-- relaciones --> |
25 |
|
<!-- relation type -> pos_of --> |
26 |
|
<!-- entity relation from -> caja1 --> |
27 |
|
<!-- entity relation to -> sucursal --> |
28 |
|
<eq> |
29 |
|
<cfield name="_entity_relation_data.entity_from"/> |
30 |
|
<cfield name="_entity_data._table"/> |
31 |
|
</eq> |
32 |
|
<eq> |
33 |
|
<cfield name="_entity_relation_data.entity_to"/> |
34 |
|
<cfield name="branch._table"/> |
35 |
|
</eq> |
36 |
|
<eq> |
37 |
|
<cfield name="_entity_relation_data._table"/> |
38 |
|
<cfield name="_relation_types_data.entity_relation"/> |
39 |
|
</eq> |
40 |
|
<eq> |
41 |
|
<cfield name="_relation_types_data.relation_type"/> |
42 |
|
<cfield name="neb:PAPO::posOfType"/> |
43 |
|
</eq> |
44 |
|
<null> |
45 |
|
<cfield name="_relation_types_data._end_t"/> |
46 |
|
</null> |
47 |
|
<null> |
48 |
|
<cfield name="_entity_relation_data._end_t"/> |
49 |
|
</null> |
50 |
|
<!-- /relaciones --> |
51 |
|
<null> |
52 |
|
<cfield name="branch._end_t"/> |
53 |
|
</null> |
54 |
|
<null> |
55 |
|
<cfield name="_own_pos_data._end_t"/> |
56 |
|
</null> |
57 |
|
<null> |
58 |
|
<cfield name="_own_entity_data._end_t"/> |
59 |
|
</null> |
60 |
|
<null> |
61 |
|
<cfield name="_entity_data._end_t"/> |
62 |
|
</null> |
63 |
|
</and> |
64 |
|
</condition> |
65 |
|
</datasource> |
66 |
|
|
67 |
|
<!-- forms --> |
68 |
|
<page name="search"> |
69 |
|
<!-- <trigger type="Pre-Focusout" src="askForChangesTrigger"/> --> |
70 |
|
<!--identificador--> |
71 |
|
<!-- muestra --> |
72 |
|
<trigger type="Pre-Focusout"> |
73 |
|
print "salgo y voy a la proxima page" |
74 |
|
if posBlock.getRecordCount() > 0 and not posBlock.getCurrentRecord().isEmpty(): |
75 |
|
ownPosBlock.initQuery() |
76 |
|
ownPosBlock.ownPosEntityIdEntry = str(posBlock.posEntityIdEntry) |
77 |
|
ownPosBlock.processQuery() |
78 |
|
ownPosBlock.ownBranchIdEntry = str(posBlock.branchEntityIdEntry) |
79 |
|
|
80 |
|
</trigger> |
81 |
|
<block name="searchBlock" datasource="searchDataSource" restrictInsert=""> |
82 |
|
<label text="Datos a buscar:" x="1" y="1"/> |
83 |
|
<label text="Nombre" x="1" y="2" /> |
84 |
|
<label text="Número" x="1" y="3"/> |
85 |
|
<label text="sucursal" x="1" y="4"/> |
86 |
|
<entry name="searchNameEntry" x="22" y="2" width="55"/> |
87 |
|
<entry name="searchNumberEntry" x="22" y="3" width="35"/> |
88 |
|
<entry x="22" y="4" name="ownBranchIdSearch" width="25" style="dropdown" |
89 |
|
foreign_key="ownBranchSearchDataSource._entity_data._table" |
90 |
|
foreign_key_description="_entity_data.name" /> |
91 |
|
<entry style="label" name="notificationEntry" x="1" y="20" |
92 |
|
width="67"/> |
93 |
|
<button x="59" y="3" trigger="searchTrigger" width="9" label="Buscar" name="searchBtn" height="1"/> |
94 |
|
</block> |
95 |
|
|
96 |
|
<box label="Puntos de venta" x="0" y="5" height="15" width="84"> |
97 |
|
<block name="posBlock" datasource="posDataSource"> |
98 |
|
<label text="sucursal" x="1" y="1"/> |
99 |
|
<label text="número" x="30" y="1"/> |
100 |
|
<label text="nombre" x="60" y="1"/> |
101 |
|
<entry name="posEntityIdEntry" field="_entity_data._table" rows="8" |
102 |
|
x="1" y="2" width="2" hidden="" /> |
103 |
|
<entry name="branchEntityIdEntry" field="branch._table" rows="8" |
104 |
|
x="1" y="2" width="2" hidden="" /> |
105 |
|
<entry name="branchNameEntry" field="branch.name" rows="8" |
106 |
|
x="1" y="2" width="30"/> |
107 |
|
<entry name="posNumberEntry" field="_own_pos_data.number" rows="8" |
108 |
|
x="30" y="2" width="10"/> |
109 |
|
<entry name="posNameEntry" field="_entity_data.name" rows="8" |
110 |
|
x="40" y="2" width="30"/> |
111 |
|
<scrollbar page="8" x="81" y="2" width="1" height="8"/> |
112 |
|
</block> |
113 |
|
</box> |
114 |
|
</page> |
115 |
|
|
116 |
|
<!-- /busqueda --> |
117 |
|
|
118 |
|
|
119 |
|
|
120 |
<!-- organization search --> |
<!-- organization search --> |
121 |
|
|
260 |
|
|
261 |
<!-- triggers --> |
<!-- triggers --> |
262 |
|
|
263 |
<trigger type="ON-STARTUP"> |
<!-- <trigger type="ON-STARTUP"> --> |
264 |
masterBlock = getParameter ('master') |
<!-- masterBlock = getParameter ('master') --> |
265 |
editBlock = getParameter ('edit') |
<!-- editBlock = getParameter ('edit') --> |
266 |
if editBlock: |
<!-- if editBlock: --> |
267 |
# busco el punto de venta |
<!-- # busco el punto de venta --> |
268 |
ownPosBlock.initQuery() |
<!-- ownPosBlock.initQuery() --> |
269 |
ownPosBlock.ownPosEntityIdEntry = str(editBlock.posEntityIdEntry) |
<!-- ownPosBlock.ownPosEntityIdEntry = str(editBlock.posEntityIdEntry) --> |
270 |
ownPosBlock.processQuery() |
<!-- ownPosBlock.processQuery() --> |
271 |
|
|
272 |
# busco entity_relation |
<!-- # busco entity_relation --> |
273 |
entityRelationBlock.initQuery() |
<!-- entityRelationBlock.initQuery() --> |
274 |
entityRelationBlock.entityRelationToEntry = str(masterBlock.branchIdEntry) |
<!-- #entityRelationBlock.entityRelationToEntry = str( ) --> |
275 |
entityRelationBlock.entityRelationFromEntry = str(ownPosBlock.ownPosEntityIdEntry) |
<!-- entityRelationBlock.entityRelationFromEntry = str(ownPosBlock.ownPosEntityIdEntry) --> |
276 |
entityRelationBlock.processQuery() |
<!-- entityRelationBlock.processQuery() --> |
277 |
|
|
278 |
# busco relation_types |
<!-- # busco relation_types --> |
279 |
relationTypesBlock.initQuery() |
<!-- relationTypesBlock.initQuery() --> |
280 |
relationTypesBlock.entityRelationEntry = str(entityRelationBlock.entityRelationIdEntry) |
<!-- relationTypesBlock.entityRelationEntry = str(entityRelationBlock.entityRelationIdEntry) --> |
281 |
relationTypesBlock.relationTypeEntry = <neb:Inline>'"'.PAPO::posOfType.'"'</neb:Inline> |
<!-- relationTypesBlock.relationTypeEntry = <neb:Inline>'"'.PAPO::posOfType.'"'</neb:Inline> --> |
282 |
relationTypesBlock.processQuery() |
<!-- relationTypesBlock.processQuery() --> |
283 |
else : |
<!-- else : --> |
284 |
# busco el storehouse |
<!-- # busco el storehouse --> |
285 |
ownStorehouseBlock.initQuery() |
<!-- ownStorehouseBlock.initQuery() --> |
286 |
ownStorehouseBlock.ownBranchIdEntry =str(masterBlock.branchIdEntry) |
<!-- #ownStorehouseBlock.ownBranchIdEntry =str(masterBlock.branchIdEntry) --> |
287 |
ownStorehouseBlock.processQuery() |
<!-- ownStorehouseBlock.processQuery() --> |
288 |
print "storehouse:" |
<!-- print "storehouse:" --> |
289 |
print str(ownStorehouseBlock.ownStorehouseIdEntry) |
<!-- print str(ownStorehouseBlock.ownStorehouseIdEntry) --> |
290 |
print "branch:" |
<!-- print "branch:" --> |
291 |
print str(masterBlock.branchIdEntry) |
<!-- #print str(masterBlock.branchIdEntry) --> |
292 |
# le cargo el nombre de branch y de organization |
<!-- # le cargo el nombre de branch y de organization --> |
293 |
docOrgBlock.ownBranchNameEntry = str(masterBlock.branchNameEntry) |
<!-- #docOrgBlock.ownBranchNameEntry = str(masterBlock.branchNameEntry) --> |
294 |
orgDataSource.createResultSet() |
<!-- orgDataSource.createResultSet() --> |
295 |
ownBranchBlock.ownBranchNameEntry = str(masterBlock.branchNameEntry) |
<!-- #ownBranchBlock.ownBranchNameEntry = str(masterBlock.branchNameEntry) --> |
296 |
docOrgBlock.organizationNameEntry =str(ownBranchBlock.organizationNameEntry) |
<!-- docOrgBlock.organizationNameEntry =str(ownBranchBlock.organizationNameEntry) --> |
297 |
</trigger> |
<!-- </trigger> --> |
298 |
|
|
299 |
|
<trigger name="searchTrigger" type="NAMED"> |
300 |
|
try: |
301 |
|
from gnue.forms.GFEvent import GFEvent |
302 |
|
except ImportError: |
303 |
|
from gnue.common.events.Event import Event as GFEvent |
304 |
|
setStatusText('buscando...') |
305 |
|
self._object.dispatchEvent(GFEvent('beginWAIT')) |
306 |
|
#busqueda |
307 |
|
posBlock.clear() |
308 |
|
posBlock.initQuery() |
309 |
|
posBlock.nameListEntry = str(searchBlock.searchNameEntry)+'%' |
310 |
|
posBlock.numberListEntry = str(searchBlock.searchNumberEntry) |
311 |
|
if str(searchBlock.ownBranchIdSearch): |
312 |
|
posBlock.branchEntityIdEntry =str(searchBlock.ownBranchIdSearch) |
313 |
|
posBlock.processQuery() |
314 |
|
setStatusText('Aceptar') |
315 |
|
self._object.dispatchEvent(GFEvent('endWAIT')) |
316 |
|
if posBlock.isEmpty(): |
317 |
|
searchBlock.notificationEntry = ' no se encontraron registros' |
318 |
|
else: |
319 |
|
searchBlock.notificationEntry ='%6d registros encontrados' % posBlock.getRecordCount() |
320 |
|
</trigger> |
321 |
|
|
322 |
<trigger name="commitTrigger" type="NAMED"> |
<trigger name="commitTrigger" type="NAMED"> |
323 |
from gnue.common.GDataObjects import ConnectionError as DBError |
from gnue.common.GDataObjects import ConnectionError as DBError |
324 |
|
if not str(ownPosBlock.ownBranchIdEntry): |
325 |
|
genericBox("Debe seleccionar la sucursal",['Aceptar']) |
326 |
|
else: |
327 |
try: |
try: |
328 |
commitState= 0 |
commitState= 0 |
329 |
if ownPosBlock.getCurrentRecord().isInserted(): |
if ownPosBlock.getCurrentRecord().isInserted(): |
340 |
commitState= 2 |
commitState= 2 |
341 |
# cargo la entity_relation y el id del branch al que pertenece |
# cargo la entity_relation y el id del branch al que pertenece |
342 |
entityRelationBlock.entityRelationFromEntry = str(ownPosBlock.ownPosEntityIdEntry) |
entityRelationBlock.entityRelationFromEntry = str(ownPosBlock.ownPosEntityIdEntry) |
343 |
entityRelationBlock.entityRelationToEntry = str(masterBlock.branchIdEntry) |
entityRelationBlock.entityRelationToEntry = str(ownPosBlock.ownBranchIdEntry) |
344 |
entityRelationBlock.postChanges() |
entityRelationBlock.postChanges() |
345 |
#print "numero de entity relation:" |
#print "numero de entity relation:" |
346 |
#print str(entityRelationBlock.entityRelationIdEntry) |
#print str(entityRelationBlock.entityRelationIdEntry) |
349 |
relationTypesBlock.entityRelationEntry = str(entityRelationBlock.entityRelationIdEntry) |
relationTypesBlock.entityRelationEntry = str(entityRelationBlock.entityRelationIdEntry) |
350 |
relationTypesBlock.relationTypeEntry = <neb:Inline>'"'.PAPO::posOfType.'"'</neb:Inline> |
relationTypesBlock.relationTypeEntry = <neb:Inline>'"'.PAPO::posOfType.'"'</neb:Inline> |
351 |
relationTypesBlock.postChanges () |
relationTypesBlock.postChanges () |
352 |
|
# busco el id del storehouse asociado al own_branch !!!!ownPosBlock.ownBranchIdEntry |
353 |
|
ownStorehouseBlock.initQuery() |
354 |
|
ownStorehouseBlock.ownBranchIdEntry =str(ownPosBlock.ownBranchIdEntry) |
355 |
|
ownStorehouseBlock.processQuery() |
356 |
|
print "storehouse:",str(ownStorehouseBlock.ownStorehouseIdEntry) |
357 |
# cargo la entity_relation y el id del storehouse asociado |
# cargo la entity_relation y el id del storehouse asociado |
358 |
entityRelationBlock.newRecord() |
entityRelationBlock.newRecord() |
359 |
entityRelationBlock.entityRelationFromEntry = str(ownPosBlock.ownPosEntityIdEntry) |
entityRelationBlock.entityRelationFromEntry = str(ownPosBlock.ownPosEntityIdEntry) |
387 |
rollbackConnection() |
rollbackConnection() |
388 |
mesage = "Hay problemas para grabar "+mesgs[commitState] |
mesage = "Hay problemas para grabar "+mesgs[commitState] |
389 |
genericBox(mesage+"\n"+str(err),['Aceptar']) |
genericBox(mesage+"\n"+str(err),['Aceptar']) |
390 |
docOrgBlock.clear() |
|
391 |
</trigger> |
</trigger> |
392 |
<trigger name="ownPosRollbackTrigger" type="NAMED"> |
<trigger name="ownPosRollbackTrigger" type="NAMED"> |
393 |
ownPosBlock.reset() |
ownPosBlock.reset() |
396 |
ownPosBlock.reset() |
ownPosBlock.reset() |
397 |
posDocBlock.reset() |
posDocBlock.reset() |
398 |
</trigger> |
</trigger> |
399 |
|
<trigger name="newTrigger" type="NAMED"><![CDATA[ |
400 |
|
from hack import confirmRollback |
401 |
|
confirmRollback (self, ownPosBlock , 'commitTrigger', ownPosBlock.nameEntry) |
402 |
|
]]></trigger> |
403 |
|
|
404 |
|
|
405 |
<trigger name="askForChangesTrigger" type="NAMED"> |
<trigger name="askForChangesTrigger" type="NAMED"> |
406 |
import hack |
import hack |
411 |
</trigger> |
</trigger> |
412 |
|
|
413 |
|
|
|
<trigger type="ON-EXIT"> |
|
|
# quick: what's this for? |
|
|
# this is for refresh The pos list in ownBranch.gfd |
|
|
func= getParameter('callback') |
|
|
func() |
|
|
</trigger> |
|
414 |
<!-- Gestión --> |
<!-- Gestión --> |
415 |
<page name="Gestión"> |
<page name="Gestión"> |
416 |
<trigger type="Pre-Focusout" src="askForChangesTrigger"/> |
<trigger type="Pre-Focusout" src="askForChangesTrigger"/> |
417 |
<!--identificador--> |
<!--identificador--> |
418 |
<box label="Sucursal" x="0" y="0" height="5" width="84"> |
<!-- <box label="Sucursal" x="0" y="0" height="5" width="84"> --> |
419 |
<block name="ownBranchBlock" datasource="orgDataSource"> |
<!-- <block name="ownBranchBlock" datasource="orgDataSource"> --> |
420 |
<label text="Organización:" x="1" y="1" /> |
<!-- <label text="Organización:" x="1" y="1" /> --> |
421 |
<label text="Sucursal:" x="40" y="1" /> |
<!-- <label text="Sucursal:" x="40" y="1" /> --> |
422 |
<entry name="organizationNameEntry" x="1" y="2" field="_entity_data.name" width="40" |
<!-- <entry name="organizationNameEntry" x="1" y="2" field="_entity_data.name" width="40" --> |
423 |
style="label" /> |
<!-- style="label" /> --> |
424 |
<entry name="ownBranchNameEntry" x="40" y="2" width="40" style="label"/> |
<!-- <entry name="ownBranchNameEntry" x="40" y="2" width="40" style="label"/> --> |
425 |
</block> |
<!-- </block> --> |
426 |
</box> |
<!-- </box> --> |
427 |
<!--abm--> |
<!--abm--> |
428 |
<box label="Punto de venta" x="0" y="4" height="18" width="84"> |
<box label="Punto de venta" x="0" y="1" height="18" width="84"> |
429 |
<block name="ownPosBlock" datasource="ownPosDataSource" restrictInsert="y" transparentBlock="y"> |
<block name="ownPosBlock" datasource="ownPosDataSource" restrictInsert="y" transparentBlock="y"> |
430 |
<entry name="ownPosEntityIdEntry" field="entity.id" x="70" y="9" width="10" hidden="" /> |
<entry name="ownPosEntityIdEntry" field="entity.id" x="70" y="9" width="10" hidden="" /> |
431 |
<label text="Nombre:" x="1" y="1"/> |
<label text="Sucursal:" x="1" y="1"/> |
432 |
|
<label text="Nombre:" x="1" y="2"/> |
433 |
<label text="Número:" x="1" y="3"/> |
<label text="Número:" x="1" y="3"/> |
434 |
<label text="Llevar stock por factura? (Sí=1, No=0)" x="1" y="6"/> |
<label text="Llevar stock por factura?" x="1" y="6"/> |
435 |
<entry name="numberEntry" field="_own_pos_data.number" x="1" y="4" width="10"/> |
<entry x="22" y="1" name="ownBranchIdEntry" width="25" style="dropdown" |
436 |
<entry name="nameEntry" field="_entity_data.name" x="1" y="2" width="40"/> |
foreign_key="ownBranchSearchDataSource._entity_data._table" |
437 |
|
foreign_key_description="_entity_data.name" /> |
438 |
|
<entry name="nameEntry" field="_entity_data.name" x="22" y="2" width="40"/> |
439 |
|
<entry name="numberEntry" field="_own_pos_data.number" x="22" y="3" /> |
440 |
<entry name="StockByInvoiceEntry" field="_own_pos_data.stock_by_invoice" x="40" width="2" max_length="1" y="6" default="1"/> |
<entry name="StockByInvoiceEntry" field="_own_pos_data.stock_by_invoice" x="40" width="2" max_length="1" y="6" default="1"/> |
441 |
<label text="Observaciones:" x="1" y="7"/> |
<label text="Observaciones:" x="1" y="7"/> |
442 |
<entry name="obs" field="_entity_data.observations" x="1" y="8" width="25" height="7"/> |
<entry name="obs" field="_entity_data.observations" x="1" y="8" width="25" height="7"/> |
443 |
|
<button name="newButton" label="Nuevo" trigger="newTrigger" x="33" y="3" width="9" height="1"/> |
444 |
<button x="1" y="15" trigger="commitTrigger" width="9" label="Aceptar" name="ownPosCommitBtn" height="1"/> |
<button x="1" y="15" trigger="commitTrigger" width="9" label="Aceptar" name="ownPosCommitBtn" height="1"/> |
445 |
<button x="21" y="15" trigger="ownPosRollbackTrigger" width="9" label="Cancelar" name="ownPosRollbackBtn" height="1"/> |
<button x="21" y="15" trigger="ownPosRollbackTrigger" width="9" label="Cancelar" name="ownPosRollbackBtn" height="1"/> |
446 |
</block> |
</block> |
501 |
</condition> |
</condition> |
502 |
</datasource> |
</datasource> |
503 |
<!--identificador--> |
<!--identificador--> |
504 |
<box label="punto de venta" |
<box label="punto de venta" x="0" y="0" height="5" width="84"> |
505 |
x="0" y="0" height="7" width="84"> |
<block name="documentsPosBlock" datasource="ownPosDataSource"> |
506 |
<datasource name="docOrgDataSource" cache="1"/> |
<!-- <label text="sucursal:" x="40" y="1" /> --> |
507 |
<block name="docOrgBlock" datasource="docOrgDataSource"> |
<label text="punto de venta:" x="1" y="1" /> |
508 |
<entry name="organizationNameEntry" x="1" y="2" width="40" style="label"/> |
<label text="número:" x="40" y="1" /> |
509 |
<entry name="ownBranchNameEntry" x="40" y="2" width="40" style="label"/> |
<entry name="ownPosNameEntry" x="1" y="2" width="40" field="_entity_data.name" /> |
510 |
</block> |
<entry name="ownPosIdEntry" x="40" y="2" width="10" field="_own_pos_data.number"/> |
|
<block name="documentsPosBlock" datasource="ownPosDataSource"> |
|
|
<label text="organización:" x="1" y="1" /> |
|
|
<label text="sucursal:" x="40" y="1" /> |
|
|
<label text="punto de venta:" x="1" y="3" /> |
|
|
<label text="número:" x="40" y="3" /> |
|
|
<entry name="ownPosNameEntry" x="1" y="4" width="40" field="_entity_data.name" style="label" /> |
|
|
<entry name="ownPosIdEntry" x="40" y="4" width="10" field="_own_pos_data.number" style="label"/> |
|
511 |
</block> |
</block> |
512 |
</box> |
</box> |
513 |
<box label="" x="0" y="6" height="16" width="84"> |
<box label="" x="0" y="4" height="16" width="84"> |
514 |
<!-- ponerle el datasource correcto --> |
<!-- ponerle el datasource correcto --> |
515 |
<block name="posDocBlock" datasource="posDocDataSource"> |
<block name="posDocBlock" datasource="posDocDataSource"> |
516 |
<label text="Cod." x="1" y="1" /> |
<label text="Cod." x="1" y="1" /> |