2 |
|
|
3 |
<form title="Ajuste de Stock" |
<form title="Ajuste de Stock" |
4 |
height="20" width="80" tabbed="top"> |
height="20" width="80" tabbed="top"> |
5 |
|
<!-- I think this one's not used yet --> |
6 |
<datasource name="storehouseDataSource" database="papo" |
<datasource name="storehouseDataSource" database="papo" |
7 |
table="entity, _entity_data, own_entity, _own_entity_data, own_storehouse, _own_storehouse_data"> |
table="entity, _entity_data, own_entity, _own_entity_data, own_storehouse, _own_storehouse_data"> |
8 |
<condition> |
<condition> |
26 |
</condition> |
</condition> |
27 |
</datasource> |
</datasource> |
28 |
|
|
29 |
|
<!-- the main data source --> |
30 |
<datasource name="storeProductLevelDataSource" database="papo" |
<datasource name="storeProductLevelDataSource" database="papo" |
31 |
table="product_store, _product_store_data, product, _product_data, product_code, _product_code_data" |
table="product_store, _product_store_data, product, _product_data, product_code, _product_code_data" |
32 |
historytable="_product_store_data"> |
historytable="_product_store_data"> |
90 |
</condition> |
</condition> |
91 |
</datasource> |
</datasource> |
92 |
|
|
93 |
|
<!-- this one will re-query for certain doc --> |
94 |
|
<!-- note the ugly repetition of the header --> |
95 |
|
<datasource name="printingDocDataSource" database="papo" |
96 |
|
table="own_document, own_item, own_product_stock_item, _product_data, _product_code_data"> |
97 |
|
<condition> |
98 |
|
<and> |
99 |
|
<eq> <cfield name="own_document.id"/> <cfield name="own_item.own_document"/> </eq> |
100 |
|
<!-- no need, we use the doc id anyways --> |
101 |
|
<!-- eq> <cfield name="own_document.document_type"/> </> </eq --> |
102 |
|
<eq> <cfield name="own_item.id"/> <cfield name="own_product_stock_item.own_item"/> </eq> |
103 |
|
<!-- remember: per se hitoric tables (such as own_document, own_item, etc) saves the id of the historic tables it relates --> |
104 |
|
<!-- e.g., o_p_s_i.prod points to _prod_data.id and not prod.id --> |
105 |
|
<eq> <cfield name="own_product_stock_item.product"/> <cfield name="_product_data.id"/> </eq> |
106 |
|
<!-- the prod code in the time the doc was produced: prod.end_t==NULL or prod.start_t<=doc.date and doc.date<=prod.end_t --> |
107 |
|
<or> |
108 |
|
<null> <cfield name="_product_code_data._end_t"/> </null> |
109 |
|
<and> |
110 |
|
<le> <cfield name="_product_code_data._start_t"/> <cfield name="own_document.date"/> </le> |
111 |
|
<le> <cfield name="own_document.date"/> <cfield name="_product_code_data._end_t"/> </le> |
112 |
|
</and> |
113 |
|
</or> |
114 |
|
<eq> <cfield name="_product_code_data.product"/> <cfield name="_product_data._table"/> </eq> |
115 |
|
</and> |
116 |
|
</condition> |
117 |
|
</datasource> |
118 |
|
|
119 |
<!-- Triggers --> |
<!-- Triggers --> |
120 |
<trigger name="searchTrigger" type="NAMED"><![CDATA[ |
<trigger name="searchTrigger" type="NAMED"><![CDATA[ |
121 |
storeProductLevelBlock.processRollback () |
storeProductLevelBlock.processRollback () |
133 |
<trigger name="printTrigger" type="NAMED"><![CDATA[ |
<trigger name="printTrigger" type="NAMED"><![CDATA[ |
134 |
import printing |
import printing |
135 |
|
|
136 |
|
# go fetch the doc |
137 |
|
printingDocBlock.initQuery () |
138 |
|
printingDocBlock.docIdEntry= str(ownDocumentBlock.idEntry) |
139 |
|
printingDocBlock.processQuery () |
140 |
|
|
141 |
# the printing is embedded here. |
# the printing is embedded here. |
142 |
lines= [] |
lines= [] |
143 |
|
|
144 |
# print the header |
# print the header |
145 |
lines.append (printing.printDate ()) |
lines.append (printing.printField ('Fecha: %s' % printingDocBlock.dateEntry, 80, 'r')) |
146 |
lines.append (printing.printTitle ('Ajuste de Stock', 80)) |
lines.append (printing.printTitle ('Ajuste de Stock', 80)) |
147 |
lines.append ('') |
lines.append ('') |
148 |
lines.append ('') |
lines.append ('') |
149 |
# ancho: 64 y contando |
# ancho: 80 |
150 |
lines.append ('|'+printing.printTitle ('Código', 10)+'|'+printing.printTitle ('Producto', 40)+'|'+printing.printTitle ('Diferencia', 10)+'|') |
# largo? |
151 |
|
lines.append ('|'+printing.printTitle ('Código', 10)+'|'+printing.printTitle ('Producto', 40)+'|'+printing.printTitle ('Dif.', 6)+'|'+printing.printTitle ('Observaciones', 19)+'|') |
152 |
|
# for each thingie |
153 |
|
printingDocBlock.firstRecord () |
154 |
|
for i in range (printingDocBlock.getRecordCount ()): |
155 |
|
lines.append ('|'+printing.printField (printingDocBlock.productCodeEntry, 10)+'|'+ |
156 |
|
printing.printField (printingDocBlock.productNameEntry, 40)+'|'+ |
157 |
|
printing.printField (printingDocBlock.diffEntry, 6, 'r')+'|'+ |
158 |
|
printing.printField (printingDocBlock.obsEntry, 19)+'|') |
159 |
|
printingDocBlock.nextRecord () |
160 |
|
|
161 |
|
printing.previewPrint (lines) |
162 |
]]></trigger> |
]]></trigger> |
163 |
|
|
164 |
<trigger name="commitTrigger" type="NAMED"><![CDATA[ |
<trigger name="commitTrigger" type="NAMED"><![CDATA[ |
201 |
storeProductLevelBlock.nextRecord () |
storeProductLevelBlock.nextRecord () |
202 |
|
|
203 |
searchBlock.processRollback () |
searchBlock.processRollback () |
204 |
storeProductLevelBlock.processRollback () |
# uncomment if you want an empty |
205 |
|
# storeProductLevelBlock.processRollback () |
206 |
ownDocumentBlock.commit() |
ownDocumentBlock.commit() |
207 |
|
|
208 |
callTrigger('printTrigger') |
callTrigger('printTrigger') |
292 |
<block name="branchDocumentBlock" datasource="branchDocumentdataSource"> |
<block name="branchDocumentBlock" datasource="branchDocumentdataSource"> |
293 |
<entry name="documentNumberEntry" field="_branch_document_data.number" hidden="y" x="1" y="1"/> |
<entry name="documentNumberEntry" field="_branch_document_data.number" hidden="y" x="1" y="1"/> |
294 |
</block> |
</block> |
295 |
|
|
296 |
|
<block name="printingDocBlock" datasource="printingDocDataSource"> |
297 |
|
<entry name="docIdEntry" field="own_document.id" hidden="y" x="1" y="1"/> |
298 |
|
<entry name="dateEntry" field="own_document.date" hidden="y" x="1" y="1"/> |
299 |
|
<entry name="productCodeEntry" field="_product_code_data.code" hidden="y" x="1" y="1"/> |
300 |
|
<entry name="productNameEntry" field="_product_data.canonical_name" hidden="y" x="1" y="1"/> |
301 |
|
<entry name="diffEntry" field="own_product_stock_item.difference" hidden="y" x="1" y="1"/> |
302 |
|
<entry name="obsEntry" field="own_product_stock_item.observations" hidden="y" x="1" y="1"/> |
303 |
|
</block> |
304 |
</page> |
</page> |
305 |
</form> |
</form> |