4 |
<datasource name="resultDataSource" database="papo" table="own_document"> |
<datasource name="resultDataSource" database="papo" table="own_document"> |
5 |
<condition> |
<condition> |
6 |
<or> |
<or> |
7 |
<eq> |
<eq> <cfield name="own_document_type"/> <cconst value="4"/> <!-- 'Factura de Productos' --> </eq> |
8 |
<cfield name="own_document_type"/> |
<eq> <cfield name="own_document_type"/> <cconst value="8"/> <!-- 'Factura de Productos' --> </eq> |
9 |
<cconst value="1"/><!-- 'Factura de Servicios' --> |
<eq> <cfield name="own_document_type"/> <cconst value="9"/> <!-- 'Factura de Productos' --> </eq> |
|
</eq> |
|
|
<eq> |
|
|
<cfield name="own_document_type"/> |
|
|
<cconst value="4"/><!-- 'Factura de Productos' --> |
|
|
</eq> |
|
10 |
</or> |
</or> |
11 |
</condition> |
</condition> |
12 |
</datasource> |
</datasource> |
13 |
|
|
14 |
<datasource name="clientDataSource" database="papo" table="_entity_data, _alien_entity_data, _persona_data, _client_data"> |
<datasource name="clientDataSource" database="papo" table="_entity_data, _alien_entity_data, _persona_data, _client_data"> |
15 |
<condition> |
<condition> |
16 |
<and> |
<and> |
41 |
</and> |
</and> |
42 |
</condition> |
</condition> |
43 |
</datasource> |
</datasource> |
44 |
|
|
45 |
<datasource name="itemDataSource" database="papo" |
<datasource name="itemDataSource" database="papo" |
46 |
table="_price_data, _product_store_data, own_document, own_item, own_product_item"> |
table="_price_data, _product_store_data, own_document, own_item, own_product_item"> |
47 |
<condition> |
<condition> |
68 |
</and> |
</and> |
69 |
</condition> |
</condition> |
70 |
</datasource> |
</datasource> |
71 |
|
|
72 |
<datasource name="levelDataSource" database="papo" |
<datasource name="levelDataSource" database="papo" |
73 |
table="_product_store_data, product_store" |
table="_product_store_data, product_store" |
74 |
historytable="_product_store_data"> |
historytable="_product_store_data"> |
85 |
</condition> |
</condition> |
86 |
</datasource> |
</datasource> |
87 |
|
|
88 |
|
<neb:Sub neb:src="wait.nebc"/> |
89 |
|
|
90 |
<trigger name="searchTrigger" type="NAMED"> |
<trigger name="searchTrigger" type="NAMED"> |
91 |
resultBlock.clear() |
callTrigger ('startWaitingModeTrigger') |
92 |
resultBlock.initQuery() |
resultBlock.clear () |
93 |
resultBlock.numberEntry = str(searchBlock.numberEntry)+'%' |
resultBlock.initQuery () |
94 |
resultBlock.processQuery() |
resultBlock.numberEntry = str (searchBlock.numberEntry)+'%' |
95 |
|
resultBlock.processQuery () |
96 |
|
callTrigger ('endWaitingModeTrigger') |
97 |
</trigger> |
</trigger> |
98 |
|
|
99 |
<trigger name="commitTrigger" type="NAMED"> |
<trigger name="commitTrigger" type="NAMED"> |
100 |
from __future__ import nested_scopes |
from __future__ import nested_scopes |
101 |
global hack |
global hack |
102 |
import hack |
import hack |
103 |
|
|
104 |
for document in filter(lambda x: (not hack.is_true(x._fields['own_document.is_void'])) != (not hack.is_true(x._initialData['own_document.is_void'])), |
callTrigger ('startWaitingModeTrigger') |
105 |
resultDataSource.getRecords()): |
for document in filter(lambda x: (not hack.is_true(x._fields['own_document.is_void'])) != (not hack.is_true(x._initialData['own_document.is_void'])), |
106 |
|
resultDataSource.getRecords()): |
107 |
if document.getField('own_document.own_document_type') == 4: |
|
108 |
# got to fix the stock |
if document.getField('own_document.own_document_type') == 4: |
109 |
if hack.a2f(document.getField('own_document.is_void')): |
# got to fix the stock |
110 |
# return the stock |
if hack.a2f(document.getField('own_document.is_void')): |
111 |
f = lambda y: lambda x: x+y |
# return the stock |
112 |
else: |
f = lambda y: lambda x: x+y |
113 |
# remove the stock |
else: |
114 |
f = lambda y: lambda x: x-y |
# remove the stock |
115 |
|
f = lambda y: lambda x: x-y |
116 |
itemBlock.clear() |
|
117 |
itemBlock.initQuery() |
itemBlock.clear() |
118 |
itemBlock.documentEntry = str(document.getField('own_document.id')) |
itemBlock.initQuery() |
119 |
itemBlock.processQuery() |
itemBlock.documentEntry = str(document.getField('own_document.id')) |
120 |
|
itemBlock.processQuery() |
121 |
for item in itemDataSource.getRecords(): |
|
122 |
levelBlock.clear() |
for item in itemDataSource.getRecords(): |
123 |
levelBlock.initQuery() |
levelBlock.clear() |
124 |
levelBlock.productEntry = str( item.getField('_product_store_data.product') ) |
levelBlock.initQuery() |
125 |
levelBlock.processQuery() |
levelBlock.productEntry = str( item.getField('_product_store_data.product') ) |
126 |
levelBlock.levelEntry.atomicModify(f(hack.a2f(item.getField('own_product_item.qty')))) |
levelBlock.processQuery() |
127 |
levelBlock.clear() |
levelBlock.levelEntry.atomicModify(f(hack.a2f(item.getField('own_product_item.qty')))) |
128 |
|
levelBlock.clear() |
129 |
searchBlock.clear() |
|
130 |
itemBlock.clear() |
searchBlock.clear() |
131 |
levelBlock.clear() |
itemBlock.clear() |
132 |
resultBlock.commit() |
levelBlock.clear() |
133 |
|
callTrigger ('endWaitingModeTrigger') |
134 |
|
|
135 |
|
from gnue.common.GDataObjects import ConnectionError as DBError |
136 |
|
|
137 |
|
try: |
138 |
|
resultBlock.postChanges () |
139 |
|
commitConnection () |
140 |
|
except DBError, err: |
141 |
|
rollbackConnection () |
142 |
|
genericBox("Hay problemas para grabar los datos \n \n"+str(err),['Aceptar']) |
143 |
|
|
144 |
</trigger> |
</trigger> |
145 |
|
|
148 |
resultBlock.reset() |
resultBlock.reset() |
149 |
</trigger> |
</trigger> |
150 |
|
|
151 |
<trigger name="abortTrigger" type="NAMED"> |
<!--trigger name="abortTrigger" type="NAMED"> |
152 |
import hack |
import hack |
153 |
resultBlock.reset() |
resultBlock.reset() |
154 |
exit() |
</trigger--> |
|
</trigger> |
|
155 |
|
|
156 |
<page name="Selección de Factura"> |
<page name="Selección de Factura"> |
157 |
<block name="searchBlock" datasource="searchDataSource" transparentBlock="" restrictInsert=""> |
<box label="Búsqueda de factura"> |
158 |
<label x="1" y="1" text="Número de la factura a buscar"/> |
<block name="searchBlock" datasource="searchDataSource" transparentBlock="" restrictInsert=""> |
159 |
<entry x="1" y="2" name="numberEntry" width="35"/> |
<lam:box lam:boxtype="h"> |
160 |
<button x="37" y="2" width="9" height="1" name="searchBtn" label="Buscar" trigger="searchTrigger"/> |
<label text="Número de la factura a buscar"/> |
161 |
</block> |
</lam:box> |
162 |
<block name="resultBlock" datasource="resultDataSource" transparentBlock="" restrictInsert=""> |
<lam:box lam:boxtype="h"> |
163 |
<entry x="0" y="0" name="idREntry" field="own_document.id" hidden="y"/> |
<entry name="numberEntry"/> |
164 |
<entry x="0" y="0" name="own_document_typeEntry" field="own_document.own_document_type" hidden="y"/> |
<button label="Buscar" trigger="searchTrigger"/> |
165 |
<label x="1" y="5" text="Número"/> |
</lam:box> |
166 |
<label x="10" y="5" text="Cliente"/> |
<lam:box lam:boxtype="h" height="1"/> |
167 |
<label x="45" y="5" text="Fecha"/> |
</block> |
168 |
<label x="68" y="4" text="Anulada"/> |
</box> |
169 |
<label x="69" y="5" text="(1=si)"/> |
|
170 |
<entry x="1" y="6" width="9" rows="10" name="numberEntry" field="own_document.number" style="label" readonly="y"/> |
<box label="Anular facturas"> |
171 |
<entry x="10" y="6" width="35" rows="10" name="clientEntry" field="own_document.recipient" style="textlookup" readonly="y" |
<block name="resultBlock" datasource="resultDataSource" transparentBlock="" restrictInsert=""> |
172 |
foreign_key="clientDataSource._entity_data._table" foreign_key_description="_entity_data.name"/> |
<lam:box> |
173 |
<entry x="45" y="6" width="25" rows="10" name="dateEntry" field="own_document.date" style="label" readonly="y"/> |
<lam:box lam:boxtype="h"> |
174 |
<entry x="70" y="6" width="2" rows="10" name="is_voidEntry" field="own_document.is_void" /> |
<entry name="idREntry" field="own_document.id" hidden="y"/> |
175 |
<scrollbar page="10" x="72" y="6" width="3" height="10"/> |
<entry name="own_document_typeEntry" field="own_document.own_document_type" hidden="y"/> |
176 |
<button x="45" y="17" width="9" height="1" name="commitBtn" label="Aceptar" trigger="commitTrigger"/> |
<lam:box> |
177 |
<button x="55" y="17" width="9" height="1" name="rollbackBtn" label="Deshacer" trigger="rollbackTrigger"/> |
<label text="Fecha"/> |
178 |
<button x="65" y="17" width="9" height="1" name="abortBtn" label="Cancelar" trigger="abortTrigger"/> |
<lam:box lam:boxtype="h" height="1"/> |
179 |
</block> |
<entry name="dateEntry" field="own_document.date" style="label" readonly="y" |
180 |
|
width="10" rows="10"/> |
181 |
|
</lam:box> |
182 |
|
<lam:box width="1"/> |
183 |
|
<lam:box> |
184 |
|
<label text="Número"/> |
185 |
|
<lam:box lam:boxtype="h" height="1"/> |
186 |
|
<entry name="numberEntry" field="own_document.number" style="label" readonly="y" |
187 |
|
width="10" rows="10"/> |
188 |
|
</lam:box> |
189 |
|
<lam:box width="1"/> |
190 |
|
<lam:box> |
191 |
|
<label text="Cliente"/> |
192 |
|
<lam:box lam:boxtype="h" height="1"/> |
193 |
|
<entry name="clientEntry" field="own_document.recipient" style="textlookup" readonly="y" |
194 |
|
foreign_key="clientDataSource._entity_data._table" foreign_key_description="_entity_data.name" |
195 |
|
rows="10"/> |
196 |
|
</lam:box> |
197 |
|
<lam:box width="1"/> |
198 |
|
<lam:box> |
199 |
|
<label text="Anulada"/> |
200 |
|
<label text="(1=si)"/> |
201 |
|
<lam:box lam:boxtype="h"> |
202 |
|
<entry name="is_voidEntry" field="own_document.is_void" |
203 |
|
width="2" rows="10"/> |
204 |
|
<scrollbar page="10"/> |
205 |
|
</lam:box> |
206 |
|
</lam:box> |
207 |
|
</lam:box> |
208 |
|
</lam:box> |
209 |
|
<lam:box height="1"/> |
210 |
|
<lam:box> |
211 |
|
<lam:box lam:boxtype="h"> |
212 |
|
<button label="Aceptar" trigger="commitTrigger"/> |
213 |
|
<button label="Deshacer" trigger="rollbackTrigger"/> |
214 |
|
<!--button label="Cancelar" trigger="abortTrigger"/--> |
215 |
|
</lam:box> |
216 |
|
</lam:box> |
217 |
|
<lam:box height="1"/> |
218 |
|
</block> |
219 |
|
</box> |
220 |
|
|
221 |
<block name="itemBlock" datasource="itemDataSource"> |
<block name="itemBlock" datasource="itemDataSource"> |
222 |
<entry x="0" y="0" field="own_document.id" name="documentEntry" hidden="y"/> |
<entry x="0" y="0" field="own_document.id" name="documentEntry" hidden="y"/> |
223 |
<entry x="0" y="0" field="_product_store_data.product" name="productEntry" hidden="y"/> |
<entry x="0" y="0" field="_product_store_data.product" name="productEntry" hidden="y"/> |