8 |
datasource usado para la búsqueda (primer pantaia) |
datasource usado para la búsqueda (primer pantaia) |
9 |
--> |
--> |
10 |
<datasource name="productResultDataSource" database="papo" |
<datasource name="productResultDataSource" database="papo" |
11 |
table="product, _product_data, price, _price_data, product_code, _product_code_data, product_tax, _product_tax_data, product_store, _product_store_data" |
table="_product_data, _product_code_data" |
|
historytable="_product_data, _price_data, _product_code_data, _product_tax_data, _product_store_data" |
|
12 |
cache="15" order_by="_product_data.canonical_name"> |
cache="15" order_by="_product_data.canonical_name"> |
13 |
<condition> |
<condition> |
14 |
<and> |
<and> |
|
<!-- pega product con su _data --> |
|
|
<eq> |
|
|
<cfield name="product.id"/> |
|
|
<cfield name="_product_data._table"/> |
|
|
</eq> |
|
|
<!-- descarta productos muertos --> |
|
|
<null> |
|
|
<cfield name="_product_data._end_t"/> |
|
|
</null> |
|
|
<!-- pega product con price --> |
|
|
<eq> |
|
|
<cfield name="product.id"/> |
|
|
<cfield name="_price_data.product"/> |
|
|
</eq> |
|
|
<!-- pega price con su _data --> |
|
|
<eq> |
|
|
<cfield name="price.id"/> |
|
|
<cfield name="_price_data._table"/> |
|
|
</eq> |
|
|
<!-- solamente lista 1 --> |
|
|
<eq> |
|
|
<cfield name="_price_data.price_type"/> |
|
|
<cconst value="1"/> |
|
|
</eq> |
|
|
<!-- descarta precios muertos --> |
|
|
<null> |
|
|
<cfield name="_price_data._end_t"/> |
|
|
</null> |
|
15 |
<!-- pega product con product_code --> |
<!-- pega product con product_code --> |
16 |
<eq> |
<eq> |
17 |
<cfield name="product.id"/> |
<cfield name="_product_data._table"/> |
18 |
<cfield name="_product_code_data.product"/> |
<cfield name="_product_code_data.product"/> |
19 |
</eq> |
</eq> |
|
<!-- pega product_code con su _data --> |
|
|
<eq> |
|
|
<cfield name="product_code.id"/> |
|
|
<cfield name="_product_code_data._table"/> |
|
|
</eq> |
|
20 |
<!-- solamente códigos internos (id 1) --> |
<!-- solamente códigos internos (id 1) --> |
21 |
<eq> |
<eq> |
22 |
<cfield name="_product_code_data.product_code_type"/> |
<cfield name="_product_code_data.product_code_type"/> |
23 |
<cconst value="1"/> |
<cconst value="1"/> |
24 |
</eq> |
</eq> |
25 |
|
<!-- descarta productos muertos --> |
26 |
|
<null> |
27 |
|
<cfield name="_product_data._end_t"/> |
28 |
|
</null> |
29 |
<!-- descarta códigos de producto muertos --> |
<!-- descarta códigos de producto muertos --> |
30 |
<null> |
<null> |
31 |
<cfield name="_product_code_data._end_t"/> |
<cfield name="_product_code_data._end_t"/> |
32 |
</null> |
</null> |
33 |
<!-- pega product con product_tax --> |
</and> |
34 |
<eq> |
</condition> |
35 |
<cfield name="product.id"/> |
</datasource> |
36 |
<cfield name="_product_tax_data.product"/> |
|
37 |
</eq> |
<!-- Data source para la impresion --> |
38 |
<!-- pega product_tax con su _data --> |
<datasource name="printProductDataSource" database="papo" |
39 |
|
table="_product_data, _product_code_data, _product_store_data" |
40 |
|
cache="15" order_by="_product_data.canonical_name"> |
41 |
|
<condition> |
42 |
|
<and> |
43 |
|
<!-- pega product con price --> |
44 |
|
<!-- <eq> --> |
45 |
|
<!-- <cfield name="_product_data._table"/> --> |
46 |
|
<!-- <cfield name="_price_data.product"/> --> |
47 |
|
<!-- </eq> --> |
48 |
|
<!-- solamente lista 1 --> |
49 |
|
<!-- <eq> --> |
50 |
|
<!-- <cfield name="_price_data.price_type"/> --> |
51 |
|
<!-- <cconst value="1"/> --> |
52 |
|
<!-- </eq> --> |
53 |
|
<!-- pega product con product_code --> |
54 |
<eq> |
<eq> |
55 |
<cfield name="product_tax.id"/> |
<cfield name="_product_data._table"/> |
56 |
<cfield name="_product_tax_data._table"/> |
<cfield name="_product_code_data.product"/> |
57 |
</eq> |
</eq> |
58 |
<!-- descarta product_taxes muertos --> |
<!-- solamente códigos internos (id 1) --> |
|
<null> |
|
|
<cfield name="_product_tax_data._end_t"/> |
|
|
</null> |
|
|
<!-- solamente 'IVA' (id 1) --> |
|
59 |
<eq> |
<eq> |
60 |
<cfield name="_product_tax_data.tax"/> |
<cfield name="_product_code_data.product_code_type"/> |
61 |
<cconst value="1"/> |
<cconst value="1"/> |
62 |
</eq> |
</eq> |
63 |
<!-- pega product con product_store --> |
<!-- pega product con product_store --> |
64 |
<eq> |
<eq> |
65 |
<cfield name="product.id"/> |
<cfield name="_product_data._table"/> |
66 |
<cfield name="_product_store_data.product"/> |
<cfield name="_product_store_data.product"/> |
67 |
</eq> |
</eq> |
68 |
<!-- pega product_store con su _data --> |
<!-- descarta productos muertos --> |
69 |
<eq> |
<null> |
70 |
<cfield name="product_store.id"/> |
<cfield name="_product_data._end_t"/> |
71 |
<cfield name="_product_store_data._table"/> |
</null> |
72 |
</eq> |
<!-- descarta precios muertos --> |
73 |
|
<!-- <null> --> |
74 |
|
<!-- <cfield name="_price_data._end_t"/> --> |
75 |
|
<!-- </null> --> |
76 |
|
<!-- descarta códigos de producto muertos --> |
77 |
|
<null> |
78 |
|
<cfield name="_product_code_data._end_t"/> |
79 |
|
</null> |
80 |
<!-- descarta product_stores muertos --> |
<!-- descarta product_stores muertos --> |
81 |
<null> |
<null> |
82 |
<cfield name="_product_store_data._end_t"/> |
<cfield name="_product_store_data._end_t"/> |
218 |
</condition> |
</condition> |
219 |
</datasource> |
</datasource> |
220 |
|
|
221 |
<trigger name="printTrigger" type="NAMED"><![CDATA[ |
<trigger name="startWaitingModeTrigger" type="NAMED"><![CDATA[ |
222 |
import tempfile |
setStatusText("Procesando ...") |
223 |
import os |
try: |
224 |
|
# gnue version <= 0.4 |
225 |
|
from gnue.forms.GFEvent import GFEvent |
226 |
|
except ImportError: |
227 |
|
# gnue version >= 0.5 |
228 |
|
from gnue.common.events.Event import Event as GFEvent |
229 |
|
|
230 |
try: |
# busy clock |
231 |
|
self._object.dispatchEvent(GFEvent('beginWAIT')) |
232 |
|
]]></trigger> |
233 |
|
|
234 |
|
<trigger name="endWaitingModeTrigger" type="NAMED"><![CDATA[ |
235 |
|
try: |
236 |
# gnue version <= 0.4 |
# gnue version <= 0.4 |
237 |
from gnue.forms.GFEvent import GFEvent |
from gnue.forms.GFEvent import GFEvent |
238 |
except ImportError: |
except ImportError: |
239 |
# gnue version >= 0.5 |
# gnue version >= 0.5 |
240 |
from gnue.common.events.Event import Event as GFEvent |
from gnue.common.events.Event import Event as GFEvent |
241 |
|
|
242 |
# busy clock |
self._object.dispatchEvent(GFEvent('endWAIT')) |
243 |
self._object.dispatchEvent(GFEvent('beginWAIT')) |
setStatusText("Listo") |
244 |
file = tempfile.mktemp('.product.html') |
]]></trigger> |
|
os.system("grcvs -D file -d %s --filter html ../report/product.grd" % file) |
|
|
os.system(gConfig('PrintCommand') % (file)) |
|
|
os.unlink(file) |
|
245 |
|
|
246 |
self._object.dispatchEvent(GFEvent('endWAIT')) |
<trigger name="printTrigger" type="NAMED"><![CDATA[ |
247 |
|
callTrigger('startWaitingModeTrigger') |
248 |
|
import gnue.common.GConditions as GConditions |
249 |
|
import string |
250 |
|
import hack |
251 |
|
|
252 |
|
def printField (field,size,justif='l'): |
253 |
|
if str(field).strip() == "None": |
254 |
|
field = "" |
255 |
|
if justif.lower() == 'l': |
256 |
|
return str(field).ljust(size) |
257 |
|
elif justif.lower() == 'r': |
258 |
|
return str(field).rjust(size) |
259 |
|
else: |
260 |
|
return str(field).center(size) |
261 |
|
|
262 |
|
def printTitle (field,size): |
263 |
|
return str(field).center(size) |
264 |
|
|
265 |
|
|
266 |
|
table = [] |
267 |
|
line = "\n\nListado de Productos\n\n\n" |
268 |
|
table.append(line) |
269 |
|
|
270 |
|
line = " | "+printTitle("Código",15)+" | " |
271 |
|
line += printTitle("Nombre",40)+" | " |
272 |
|
line += printTitle("Stock",15)+" | " |
273 |
|
lineLen = len(line) |
274 |
|
table.append(line) |
275 |
|
line = "" |
276 |
|
for idx in range(lineLen): |
277 |
|
line += "-" |
278 |
|
table.append(line) |
279 |
|
|
280 |
|
productResulSet = printProductDataSource.createResultSet() |
281 |
|
more = productResulSet.firstRecord(); |
282 |
|
|
283 |
|
while more: |
284 |
|
line = " | "+printField(productResulSet.current.getField("_product_code_data.code"),15,'r')+" | " |
285 |
|
line += printField(productResulSet.current.getField("_product_data.canonical_name"),40,'l')+" | " |
286 |
|
line += printField(productResulSet.current.getField("_product_store_data.level"),15,'r')+" | " |
287 |
|
table.append(line) |
288 |
|
|
289 |
|
more = productResulSet.nextRecord() |
290 |
|
|
291 |
|
callTrigger('endWaitingModeTrigger') |
292 |
|
|
293 |
|
hack.previewPrint(table) |
294 |
|
|
295 |
]]></trigger> |
]]></trigger> |
296 |
|
|
380 |
<entry name="funnyLabel" width="40" x="40" y="4" style="label"/> |
<entry name="funnyLabel" width="40" x="40" y="4" style="label"/> |
381 |
</block> |
</block> |
382 |
<block name="productResultBlock" datasource="productResultDataSource" transparentBlock="y"> |
<block name="productResultBlock" datasource="productResultDataSource" transparentBlock="y"> |
383 |
<entry name="productIdREntry" field="product.id" hidden="y" x="1" y="1" width="20" /> |
<entry name="productIdREntry" field="_product_data._table" hidden="y" x="1" y="1" width="20" /> |
384 |
<label text="Resultado" x="1" y="4"/> |
<label text="Resultado" x="1" y="4"/> |
385 |
<entry name="codeListEntry" field="_product_code_data.code" |
<entry name="codeListEntry" field="_product_code_data.code" |
386 |
x="1" y="5" width="16" rows="15"/> |
x="1" y="5" width="16" rows="15"/> |