/[papo]/papo/forms/productInvoice.gfd
ViewVC logotype

Diff of /papo/forms/productInvoice.gfd

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.44 by apronotti, Fri Mar 14 21:09:00 2003 UTC revision 1.44.2.1 by anthonyl, Fri Mar 14 22:45:25 2003 UTC
# Line 1  Line 1 
1  <?xml version="1.0" encoding="ISO-8859-1"?>  <?xml version="1.0" encoding="ISO-8859-1"?>
 <!DOCTYPE form SYSTEM "gnue-forms.dtd">  
   
 <form width="107" height="24" title="Facturación a Clientes">  
   <datasource name="tmpValuesDataSource" cache="1"/>  
   <datasource name="payDataSource" cache="1"/>  
   <datasource name="prodSearchDataSource" cache="1"/>  
   <datasource name="prodResultDataSource" cache="1"/>  
2    
3    <!--  GNUe Forms 0.5.0 Migration Tool
4          Saved on: 2003-02-11 17:42:14  -->
5    
6    <!--   Origen de datos que sirve para seleccionar el cleinte al que se le -->  <form title="Facturación a Clientes">
7    <!--   va a facturar   -->    <datasource name="productResultDataSource" connection="papo"
8    <datasource name="clientDataSource" database="papo"                order_by="_product_data.canonical_name, _price_type_data._table desc"
9                table="_entity_data, _alien_entity_data, _persona_data, _client_data,                table="_product_code_type_data, _product_code_data, _product_data, _product_tax_data, _price_data, _price_type_data">
                      _price_type_data, _persona_tax_profile_data, _tax_profile_data, _tax_data">  
10      <condition>      <condition>
11        <and>        <and>
12            <null>
13              <cfield name="_product_code_type_data._end_t"/>
14            </null>
15            <null>
16              <cfield name="_product_code_data._end_t"/>
17            </null>
18            <null>
19              <cfield name="_product_data._end_t"/>
20            </null>
21            <null>
22              <cfield name="_product_tax_data._end_t"/>
23            </null>
24            <null>
25              <cfield name="_price_data._end_t"/>
26            </null>
27            <null>
28              <cfield name="_price_type_data._end_t"/>
29            </null>
30          <eq>          <eq>
31            <cfield name="_entity_data._table"/>            <cfield name="_product_code_type_data._table"/>
32            <cfield name="_alien_entity_data.entity"/>            <cfield name="_product_code_data.product_code_type"/>
33          </eq>          </eq>
34          <eq>          <eq>
35            <cfield name="_alien_entity_data._table"/>            <cfield name="_product_data._table"/>
36            <cfield name="_persona_data.alien_entity"/>            <cfield name="_product_code_data.product"/>
37          </eq>          </eq>
38          <eq>          <eq>
39            <cfield name="_persona_data._table"/>            <cfield name="_product_data._table"/>
40            <cfield name="_client_data.persona"/>            <cfield name="_product_tax_data.product"/>
41          </eq>          </eq>
42          <eq>          <eq>
43           <cfield name="_price_type_data._table"/>            <cfield name="_product_tax_data.tax"/>
44            <cfield name="_client_data.price_type"/>            <cconst value="1"/>
45          </eq>          </eq>
46          <eq>          <eq>
47           <cfield name="_entity_data._table"/>            <cfield name="_product_data._table"/>
48           <cfield name="_persona_tax_profile_data.persona"/>            <cfield name="_price_data.product"/>
49          </eq>          </eq>
50          <eq>          <eq>
51            <cfield name="_tax_profile_data._table"/>            <cfield name="_price_type_data._table"/>
52           <cfield name="_persona_tax_profile_data.tax_profile"/>            <cfield name="_price_data.price_type"/>
53          </eq>          </eq>
54          </and>
55        </condition>
56      </datasource>
57      <datasource name="priceTypeDataSource" connection="papo"
58                  table="_price_type_data">
59        <condition>
60          <null>
61            <cfield name="_price_type_data._end_t"/>
62          </null>
63        </condition>
64      </datasource>
65      <datasource name="ownDocumentProceedingDataSource" connection="papo"
66                  table="own_document_proceeding"/>
67      <datasource name="proceedingDataSource" connection="papo" table="proceeding"/>
68      <datasource name="movementDataSource" connection="papo" table="movement"/>
69      <datasource name="currencyMovementDataSource" connection="papo"
70                  table="movement, currency_movement">
71        <condition>
72          <eq>
73            <cfield name="movement.id"/>
74            <cfield name="currency_movement.movement"/>
75          </eq>
76        </condition>
77      </datasource>
78      <datasource name="ownItemToUpdDataSource" connection="papo"
79                  table="own_item, own_product_item, _price_data, _product_store_data">
80        <condition>
81          <and>
82          <eq>          <eq>
83           <cfield name="_tax_data._table"/>            <cfield name="product_store.id"/>
84            <cfield name="_tax_profile_data.tax"/>            <cfield name="_product_store_data._table"/>
85          </eq>          </eq>
86          <eq>          <eq>
87           <cfield name="_tax_data._table"/>            <cfield name="own_item.id"/>
88           <cconst value="1"/>            <cfield name="own_product_item.own_item"/>
89            </eq>
90            <eq>
91              <cfield name="_price_data.id"/>
92              <cfield name="own_product_item.price"/>
93            </eq>
94            <eq>
95              <cfield name="_price_data.product"/>
96              <cfield name="_product_store_data.product"/>
97          </eq>          </eq>
98          <null>          <null>
99            <cfield name="_entity_data._end_t"/>            <cfield name="_product_store_data._end_t"/>
         </null>  
         <null>  
           <cfield name="_alien_entity_data._end_t"/>  
         </null>  
         <null>  
           <cfield name="_persona_data._end_t"/>  
         </null>  
         <null>  
           <cfield name="_client_data._end_t"/>  
         </null>  
         <null>  
           <cfield name="_price_type_data._end_t"/>  
         </null>  
         <null>  
           <cfield name="_persona_tax_profile_data._end_t"/>  
         </null>  
         <null>  
           <cfield name="_tax_profile_data._end_t"/>  
         </null>  
         <null>  
           <cfield name="_tax_data._end_t"/>  
100          </null>          </null>
101        </and>        </and>
102      </condition>      </condition>
103    </datasource>    </datasource>
104      <datasource name="ownItemDataSource" connection="papo"
105    <datasource name="clientSearchDataSource" database="papo"                detaillink="own_item.own_document" master="ownDocumentDataSource" masterlink="id"
106                table="_entity_data, _alien_entity_data, _persona_data, _client_data, entity_type_uid_conf,                  table="own_item, own_product_item, own_item_tax">
                      _entity_uid_data" order_by="_entity_data.name">  
107      <condition>      <condition>
108        <and>        <and>
109          <eq>          <eq>
110            <cfield name="_entity_data._table"/>            <cfield name="own_item.id"/>
111            <cfield name="_alien_entity_data.entity"/>            <cfield name="own_product_item.own_item"/>
112          </eq>          </eq>
113          <eq>          <eq>
114            <cfield name="_alien_entity_data._table"/>            <cfield name="own_item.id"/>
115            <cfield name="_persona_data.alien_entity"/>            <cfield name="own_item_tax.own_item"/>
116          </eq>          </eq>
117          <eq>          <eq>
118            <cfield name="_persona_data._table"/>            <cfield name="own_item_tax.tax"/>
119            <cfield name="_client_data.persona"/>            <cconst value="1"/>
120          </eq>          </eq>
121          </and>
122        </condition>
123      </datasource>
124      <datasource name="creditLimit1DataSource" connection="papo"
125                  table="_credit_limit_data">
126        <condition>
127          <and>
128          <eq>          <eq>
129           <cfield name="_entity_data._table"/>            <cfield name="_credit_limit_data.movement_type"/>
130            <cfield name="_entity_uid_data.entity"/>            <cconst value="1"/>
131          </eq>          </eq>
132            <null>
133              <cfield name="_credit_limit_data._end_t"/>
134            </null>
135          </and>
136        </condition>
137      </datasource>
138      <datasource name="tlCreditLimit1DataSource" connection="papo"
139                  table="_entity_data, _credit_limit_data">
140        <condition>
141          <and>
142          <eq>          <eq>
143           <cfield name="_entity_data.entity_type"/>            <cfield name="_entity_data._table"/>
144           <cfield name="entity_type_uid_conf.entity_type"/>            <cfield name="_credit_limit_data.entity"/>
145          </eq>          </eq>
146          <eq>          <eq>
147           <cfield name="_entity_uid_data.entity_uid_type"/>            <cfield name="_credit_limit_data.movement_type"/>
148           <cfield name="entity_type_uid_conf.entity_uid_type"/>            <cconst value="1"/>
149          </eq>          </eq>
150          <null>          <null>
151            <cfield name="_entity_data._end_t"/>            <cfield name="_credit_limit_data._end_t"/>
         </null>  
         <null>  
           <cfield name="_alien_entity_data._end_t"/>  
         </null>  
         <null>  
           <cfield name="_persona_data._end_t"/>  
         </null>  
         <null>  
           <cfield name="_client_data._end_t"/>  
152          </null>          </null>
153          </and>
154        </condition>
155      </datasource>
156      <datasource name="branchDocumentDataSource" connection="papo"
157                  historytable="_branch_document_data" prequery="" table="branch_document, _branch_document_data">
158        <condition>
159          <and>
160            <eq>
161              <cfield name="branch_document.id"/>
162              <cfield name="_branch_document_data._table"/>
163            </eq>
164            <eq>
165              <cfield name="_branch_document_data.document_type"/>
166              <cconst value="4"/>
167            </eq>
168          <null>          <null>
169            <cfield name="_entity_uid_data._end_t"/>            <cfield name="_branch_document_data._end_t"/>
170          </null>          </null>
171        </and>        </and>
172      </condition>      </condition>
173    </datasource>    </datasource>
174      <datasource name="ownDocumentDataSource" connection="papo" order_by="date"
175    <!-- Origen de datos para obtener el total facturado a este cliente (para el calculo del balance de la cta cte) -->                table="own_document"/>
176  <!--   <datasource name="serviceInvoiceTotalDataSource" database="papo" -->    <datasource name="priceDataSource" connection="papo" table="_price_data"/>
177  <!--     table="_entity_data, own_document, own_item, own_service_item, own_item_tax" -->    <datasource name="paidTotalDataSource" connection="papo"
178  <!--     order_by="own_service_item.id"> -->                table="_entity_data, own_document, own_document_proceeding">
179  <!--     <condition> -->      <condition>
180  <!--       <and> -->        <and>
181  <!--         <eq> -->          <eq>
182            <!-- Aqui se refiere al cliente  -->            <cfield name="_entity_data.id"/>
183  <!--           <cfield name="_entity_data.id"/> -->            <cfield name="own_document.recipient"/>
184  <!--           <cfield name="own_document.recipient"/> -->          </eq>
185  <!--         </eq> -->          <eq>
186  <!--         <eq> -->            <cfield name="own_document.id"/>
187  <!--           <cfield name="own_document.id"/> -->            <cfield name="own_document_proceeding.own_document"/>
188  <!--           <cfield name="own_item.own_document"/> -->          </eq>
189  <!--         </eq> -->          <and>
190  <!--         <eq> -->            <or>
191  <!--           <cfield name="own_item.id"/> -->              <eq>
192  <!--           <cfield name="own_service_item.own_item"/> -->                <cfield name="own_document.own_document_type"/>
193  <!--         </eq> -->                <cconst value="1"/>
194  <!--         <eq> -->              </eq>
195  <!--           <cfield name="own_item.id"/> -->              <eq>
196  <!--           <cfield name="own_item_tax.own_item"/> -->                <cfield name="own_document.own_document_type"/>
197  <!--         </eq> -->                <cconst value="4"/>
198  <!--         <eq> -->              </eq>
199  <!--           <cfield name="own_document.own_document_type"/> -->            </or>
200  <!--      <cconst value="1"/>  -->          </and>
201  <!--         </eq> -->        </and>
202  <!--      </and> -->      </condition>
203  <!--     </condition> -->    </datasource>
204  <!--   </datasource> -->    <datasource name="invTaxTotDataSource" connection="papo"
205                  table="own_document, own_document_tax">
206    <!-- Origen de datos que srive para calcular el total facturado -->      <condition>
207          <eq>
208    <datasource name="productInvoiceTotalDataSource" database="papo"          <cfield name="own_document.id"/>
209                table="_entity_data, own_document, own_item, own_product_item, own_item_tax"          <cfield name="own_document_tax.own_document"/>
210                order_by="own_product_item.id">        </eq>
211      <condition>      </condition>
212      </datasource>
213      <datasource name="productInvoiceTotalDataSource" connection="papo"
214                  order_by="own_product_item.id"
215                  table="_entity_data, own_document, own_item, own_product_item, _price_data, own_item_tax">
216        <condition>
217        <and>        <and>
218          <eq>          <eq>
           <!-- Aqui se refiere al cliente  -->  
219            <cfield name="_entity_data.id"/>            <cfield name="_entity_data.id"/>
220            <cfield name="own_document.recipient"/>            <cfield name="own_document.recipient"/>
221          </eq>          </eq>
# Line 175  Line 228 
228            <cfield name="own_product_item.own_item"/>            <cfield name="own_product_item.own_item"/>
229          </eq>          </eq>
230          <eq>          <eq>
231              <cfield name="own_product_item.price"/>
232              <cfield name="_price_data.id"/>
233            </eq>
234            <eq>
235            <cfield name="own_item.id"/>            <cfield name="own_item.id"/>
236            <cfield name="own_item_tax.own_item"/>            <cfield name="own_item_tax.own_item"/>
237          </eq>          </eq>
238          <eq>          <eq>
239            <cfield name="own_document.own_document_type"/>            <cfield name="own_document.own_document_type"/>
240            <cconst value="4"/>            <cconst value="4"/>
241          </eq>          </eq>
242       </and>        </and>
243      </condition>      </condition>
   </datasource>  
   
   <!-- Origen de datos que srive para calcular los impuestos del la factura -->  
   
   <datasource name="invTaxTotDataSource" database="papo"  
               table="own_document, own_document_tax">  
     <condition>  
       <eq>  
         <cfield name="own_document.id"/>  
         <cfield name="own_document_tax.own_document"/>  
       </eq>  
     </condition>  
244    </datasource>    </datasource>
245      <datasource name="serviceInvoiceTotalDataSource" connection="papo"
246    <!-- Origen de datos que srive para calcular el total adeudado -->                order_by="own_service_item.id"
247                  table="_entity_data, own_document, own_item, own_service_item, own_item_tax">
248    <datasource name="paidTotalDataSource" database="papo" table="_entity_data, own_document, own_document_proceeding">      <condition>
     <condition>  
249        <and>        <and>
250          <eq>          <eq>
251            <!-- Aqui se refiere al cliente  -->            <cfield name="_entity_data.id"/>
           <cfield name="_entity_data.id"/>  
252            <cfield name="own_document.recipient"/>            <cfield name="own_document.recipient"/>
253          </eq>          </eq>
254          <eq>          <eq>
255            <cfield name="own_document.id"/>            <cfield name="own_document.id"/>
256            <cfield name="own_document_proceeding.own_document"/>            <cfield name="own_item.own_document"/>
257            </eq>
258            <eq>
259              <cfield name="own_item.id"/>
260              <cfield name="own_service_item.own_item"/>
261            </eq>
262            <eq>
263              <cfield name="own_item.id"/>
264              <cfield name="own_item_tax.own_item"/>
265            </eq>
266            <eq>
267              <cfield name="own_document.own_document_type"/>
268              <cconst value="1"/>
269          </eq>          </eq>
         <and>  
           <or>  
             <eq>  
               <cfield name="own_document.own_document_type"/>  
               <cconst value="1"/>  
             </eq>  
             <eq>  
               <cfield name="own_document.own_document_type"/>  
               <cconst value="4"/>  
             </eq>  
           </or>  
         </and>  
270        </and>        </and>
271      </condition>      </condition>
272    </datasource>    </datasource>
273      <datasource name="clientSearchDataSource" connection="papo"
274    <datasource name="priceDataSource" database="papo" table="_price_data" />                order_by="_entity_data.name"
275                  table="_entity_data, _alien_entity_data, _persona_data, _client_data,                       _price_type_data, entity_type_uid_conf, _entity_uid_type_data,                       _entity_uid_data">
   <!--   Origen de datos que contiene el encabezado de la factura   -->  
   
   <datasource database="papo" name="ownDocumentDataSource" table="own_document"  
     order_by="date" />  
   
   <!-- Este lo uso para tomar los datos de al sucursal actual en futuro debera ser compañando por un archide configuración -->  
   <datasource database="papo" name="ownBranchDataSource"  
               table="_entity_data, _own_entity_data, _own_branch_data, _persona_tax_profile_data, _tax_profile_data" prequery="">  
276      <condition>      <condition>
277        <and>        <and>
278          <eq>          <eq>
279            <cfield name="_entity_data._table"/>            <cfield name="_entity_data._table"/>
280            <cfield name="_own_entity_data.entity"/>            <cfield name="_alien_entity_data.entity"/>
281            </eq>
282            <eq>
283              <cfield name="_alien_entity_data._table"/>
284              <cfield name="_persona_data.alien_entity"/>
285          </eq>          </eq>
286          <eq>          <eq>
287            <cfield name="_own_entity_data._table"/>            <cfield name="_persona_data._table"/>
288            <cfield name="_own_branch_data.own_entity"/>            <cfield name="_client_data.persona"/>
289            </eq>
290            <eq>
291              <cfield name="_price_type_data._table"/>
292              <cfield name="_client_data.price_type"/>
293          </eq>          </eq>
294          <eq>          <eq>
295            <cfield name="_entity_data._table"/>            <cfield name="_entity_data._table"/>
296            <cfield name="_persona_tax_profile_data.persona"/>            <cfield name="_entity_uid_data.entity"/>
297            </eq>
298            <eq>
299              <cfield name="_entity_uid_data.entity_uid_type"/>
300              <cfield name="_entity_uid_type_data._table"/>
301          </eq>          </eq>
302          <eq>          <eq>
303            <cfield name="_tax_profile_data._table"/>            <cfield name="_entity_type_data._table"/>
304            <cfield name="_persona_tax_profile_data.tax_profile"/>            <cfield name="entity_type_uid_conf.entity_type"/>
305          </eq>          </eq>
306          <eq>          <eq>
307            <cfield name="_tax_profile_data.tax"/>            <cfield name="entity_type_uid_conf.entity_type"/>
308            <cconst value="1"/> <!-- Esto va para indicar que es IVA y no otro impuesto-->            <cconst value="8"/>
309            </eq>
310            <eq>
311              <cfield name="_entity_uid_type_data._table"/>
312              <cfield name="entity_type_uid_conf.entity_uid_type"/>
313          </eq>          </eq>
314          <null>          <null>
315            <cfield name="_entity_data._end_t"/>            <cfield name="_entity_data._end_t"/>
316          </null>          </null>
317          <null>          <null>
318            <cfield name="_own_entity_data._end_t"/>            <cfield name="_alien_entity_data._end_t"/>
319            </null>
320            <null>
321              <cfield name="_persona_data._end_t"/>
322          </null>          </null>
323          <null>          <null>
324            <cfield name="_own_branch_data._end_t"/>            <cfield name="_client_data._end_t"/>
325          </null>          </null>
326          <null>          <null>
327            <cfield name="_persona_tax_profile_data._end_t"/>            <cfield name="_price_type_data._end_t"/>
328          </null>          </null>
329          <null>          <null>
330            <cfield name="_tax_profile_data._end_t"/>            <cfield name="_entity_uid_data._end_t"/>
331            </null>
332            <null>
333              <cfield name="_entity_type_data._end_t"/>
334            </null>
335            <null>
336              <cfield name="_entity_uid_type_data._end_t"/>
337          </null>          </null>
338        </and>        </and>
339      </condition>      </condition>
340    </datasource>    </datasource>
341      <datasource name="clientDataSource" connection="papo"
342    <!-- Origen de datos que contiene el numero de la proxima factura -->                table="entity, _entity_data, alien_entity, _alien_entity_data, persona, _persona_data, client, _client_data,                       _price_type_data">
   <datasource name="branchDocumentDataSource" database="papo"  
     table="branch_document, _branch_document_data" historytable="_branch_document_data" prequery="">  
343      <condition>      <condition>
344        <and>        <and>
345          <eq>          <eq>
346            <cfield name="branch_document.id"/>            <cfield name="entity.id"/>
347            <cfield name="_branch_document_data._table"/>            <cfield name="_entity_data._table"/>
348          </eq>          </eq>
         <!-- numero para las facturas de servicios -->  
349          <eq>          <eq>
350            <cfield name="_branch_document_data.document_type"/>            <cfield name="alien_entity.id"/>
351            <cconst value="4"/>            <cfield name="_alien_entity_data._table"/>
352            </eq>
353            <eq>
354              <cfield name="persona.id"/>
355              <cfield name="_persona_data._table"/>
356            </eq>
357            <eq>
358              <cfield name="client.id"/>
359              <cfield name="_client_data._table"/>
360            </eq>
361            <eq>
362              <cfield name="entity.id"/>
363              <cfield name="_alien_entity_data.entity"/>
364            </eq>
365            <eq>
366              <cfield name="alien_entity.id"/>
367              <cfield name="_persona_data.alien_entity"/>
368            </eq>
369            <eq>
370              <cfield name="persona.id"/>
371              <cfield name="_client_data.persona"/>
372            </eq>
373            <eq>
374              <cfield name="_price_type_data._table"/>
375              <cfield name="_client_data.price_type"/>
376          </eq>          </eq>
         <!-- que este activo -->  
377          <null>          <null>
378            <cfield name="_branch_document_data._end_t"/>            <cfield name="_entity_data._end_t"/>
379            </null>
380            <null>
381              <cfield name="_alien_entity_data._end_t"/>
382            </null>
383            <null>
384              <cfield name="_persona_data._end_t"/>
385            </null>
386            <null>
387              <cfield name="_client_data._end_t"/>
388            </null>
389            <null>
390              <cfield name="_price_type_data._end_t"/>
391          </null>          </null>
392        </and>        </and>
393      </condition>      </condition>
394    </datasource>    </datasource>
395    
396  <!--   Origen de datos que sirve para consultar el limite de crédito -->    <datasource name="anotherClientDataSource" connection="papo"
397  <!--   asignado al cliente que se le factura -->                table="entity, _entity_data, alien_entity, _alien_entity_data, persona, _persona_data, client, _client_data,                       _price_type_data">
   
   <datasource name="tlCreditLimit1DataSource" database="papo"  
     table="_entity_data, _credit_limit_data">  
     <condition>  
     <and>  
       <eq>  
         <cfield name="_entity_data._table"/>  
         <cfield name="_credit_limit_data.entity"/>  
       </eq>  
       <eq>  
         <cfield name="_credit_limit_data.movement_type"/>  
         <cconst value="1"/>  
       </eq>  
       <null>  
          <cfield name="_credit_limit_data._end_t"/>  
       </null>  
     </and>  
     </condition>  
   </datasource>  
   
   <datasource name="creditLimit1DataSource" database="papo"  
     table="_credit_limit_data">  
     <condition>  
     <and>  
       <eq>  
         <cfield name="_credit_limit_data.movement_type"/>  
         <cconst value="1"/>  
       </eq>  
       <null>  
          <cfield name="_credit_limit_data._end_t"/>  
       </null>  
     </and>  
     </condition>  
   </datasource>  
   
   <!--   Origen de datos que contiene los items de la factura -->  
   
    <datasource  name="ownItemDataSource" database="papo" detaillink="own_item.own_document"    
      master="ownDocumentDataSource" masterlink="id"    
      table="own_item, own_product_item, own_item_tax">  
398      <condition>      <condition>
399        <and>        <and>
400          <eq>          <eq>
401            <cfield name="own_item.id"/>            <cfield name="entity.id"/>
402            <cfield name="own_product_item.own_item"/>            <cfield name="_entity_data._table"/>
403          </eq>          </eq>
          <eq>  
            <cfield name="own_item.id"/>  
            <cfield name="own_item_tax.own_item"/>  
         </eq>    
         <eq>  
            <cfield name="own_item_tax.tax"/>  
            <cconst value="1"/>  
          </eq>    
       </and>  
     </condition>  
   </datasource>  
   
 <!--   Origen de datos que sirve para consultar y asi actualizar el stock -->  
   
   <datasource database="papo" name="ownItemToUpdDataSource"  
     table="own_item, own_product_item, _price_data, _product_store_data">  
     <condition>  
       <and>  
404          <eq>          <eq>
405            <cfield name="product_store.id"/>            <cfield name="alien_entity.id"/>
406            <cfield name="_product_store_data._table"/>            <cfield name="_alien_entity_data._table"/>
407          </eq>          </eq>
408          <eq>          <eq>
409            <cfield name="own_item.id"/>            <cfield name="persona.id"/>
410            <cfield name="own_product_item.own_item"/>            <cfield name="_persona_data._table"/>
411          </eq>          </eq>
412          <eq>          <eq>
413            <cfield name="_price_data.id"/>            <cfield name="client.id"/>
414            <cfield name="own_product_item.price"/>            <cfield name="_client_data._table"/>
415          </eq>          </eq>
416          <eq>          <eq>
417            <cfield name="_price_data.product"/>            <cfield name="entity.id"/>
418            <cfield name="_product_store_data.product"/>            <cfield name="_alien_entity_data.entity"/>
419            </eq>
420            <eq>
421              <cfield name="alien_entity.id"/>
422              <cfield name="_persona_data.alien_entity"/>
423            </eq>
424            <eq>
425              <cfield name="persona.id"/>
426              <cfield name="_client_data.persona"/>
427            </eq>
428            <eq>
429              <cfield name="_price_type_data._table"/>
430              <cfield name="_client_data.price_type"/>
431          </eq>          </eq>
432          <null>          <null>
433            <cfield name="_product_store_data._end_t"/>            <cfield name="_entity_data._end_t"/>
434            </null>
435            <null>
436              <cfield name="_alien_entity_data._end_t"/>
437            </null>
438            <null>
439              <cfield name="_persona_data._end_t"/>
440            </null>
441            <null>
442              <cfield name="_client_data._end_t"/>
443            </null>
444            <null>
445              <cfield name="_price_type_data._end_t"/>
446          </null>          </null>
447        </and>        </and>
448      </condition>      </condition>
449    </datasource>    </datasource>
     
   <!-- Origen de datos que sirve para dar de alta pagos con algun tipo de currency -->  
   <datasource name="currencyMovementDataSource" database="papo"  
               table="movement, currency_movement">  
     <condition>  
       <eq>  
         <cfield name="movement.id"/>  
         <cfield name="currency_movement.movement"/>  
       </eq>  
     </condition>  
   </datasource>  
   
   <!-- Origen de datos que sirve para dar de alta pagos con cta. cte. -->  
   <datasource name="movementDataSource" database="papo" table="movement"/>  
   
   <!-- Origen de datos que sirve para dar de alta procedimientos de pago (en este caso de la factura) -->  
   <datasource name="proceedingDataSource" database="papo" table="proceeding"/>  
   
   <!-- Origen de datos que sirve para dar de alta pagos con algun tipo de currency -->  
   <datasource name="ownDocumentProceedingDataSource" database="papo" table="own_document_proceeding"/>  
450    
451      <datasource name="prodResultDataSource" cache="1"/>
452      <datasource name="prodSearchDataSource" cache="1"/>
453      <datasource name="payDataSource" cache="1"/>
454      <datasource name="tmpValuesDataSource" cache="1"/>
455    <trigger name="startWaitingModeTrigger" type="NAMED"><![CDATA[    <trigger name="startWaitingModeTrigger" type="NAMED"><![CDATA[
456      setStatusText("Procesando ...")      setStatusText("Procesando ...")
457      try:      try:
# Line 422  Line 464 
464      # busy clock      # busy clock
465      self._object.dispatchEvent(GFEvent('beginWAIT'))      self._object.dispatchEvent(GFEvent('beginWAIT'))
466    ]]></trigger>    ]]></trigger>
   
467    <trigger name="endWaitingModeTrigger" type="NAMED"><![CDATA[    <trigger name="endWaitingModeTrigger" type="NAMED"><![CDATA[
468      try:      try:
469        # gnue version <= 0.4        # gnue version <= 0.4
# Line 434  Line 475 
475      self._object.dispatchEvent(GFEvent('endWAIT'))      self._object.dispatchEvent(GFEvent('endWAIT'))
476      setStatusText("Listo")      setStatusText("Listo")
477    ]]></trigger>    ]]></trigger>
   
478    <trigger name="printTrigger" type="NAMED"><![CDATA[    <trigger name="printTrigger" type="NAMED"><![CDATA[
479      import hack      import hack
480      lCurrentCredit = hack.a2f(tmpValuesDataSource.creditLimitAmount) - \      lCurrentCredit = hack.a2f(tmpValuesDataSource.creditLimitAmount) - \
481                       hack.a2f(ownDocumentBlock.clientRecipientBox.deudaEntry)                       hack.a2f(ownDocumentBlock.deudaEntry)
482    
483      if hack.a2f(payBlock.ctaCteEntry) > lCurrentCredit:      if hack.a2f(payBlock.ctaCteEntry) > lCurrentCredit:
484        genericBox("Esta excedido el Límite de Crédito",["Ok"])        genericBox("Esta excedido el Límite de Crédito",["Ok"])
# Line 447  Line 487 
487          callTrigger('startWaitingModeTrigger')          callTrigger('startWaitingModeTrigger')
488          callTrigger ('commitTrigger')          callTrigger ('commitTrigger')
489          # it's _such_ a pitty          # it's _such_ a pitty
490          # pleasePrint ('serviceInvoice', { 'id': str(ownDocumentBlock.idEntry) })          # pleasePrint ('serviceInvoice', { 'id': str(ownDocumentBlock.idEntry2) })
491          # BUG: select the correct type of invoice?          # BUG: select the correct type of invoice?
492          # pleasePrint (self, 'p1', '1', 'serviceInvoice-discriminated', [ 'id='+str(ownDocumentBlock.idEntry) ])          # pleasePrint (self, 'p1', '1', 'serviceInvoice-discriminated', [ 'id='+str(ownDocumentBlock.idEntry2) ])
493          hack.pleasePrint (self, 'p1', '1', 'productInvoice', [ 'id='+str(ownDocumentBlock.idEntry) ])          hack.pleasePrint (self, 'p1', '1', 'productInvoice', [ 'id='+str(ownDocumentBlock.idEntry2) ])
494          callTrigger('rollbackTrigger')          callTrigger('rollbackTrigger')
495          callTrigger('endWaitingModeTrigger')                  callTrigger('endWaitingModeTrigger')        
496    ]]></trigger>    ]]></trigger>
497        <trigger name="commitTrigger" type="NAMED"><![CDATA[
   <trigger name="commitTrigger" type="NAMED">  
498       ownDocumentBlock.numberEntry= str(branchDocumentBlock.documentNumberEntry)       ownDocumentBlock.numberEntry= str(branchDocumentBlock.documentNumberEntry)
499       branchDocumentBlock.documentNumberEntry.atomicModify (lambda x: int(x)+1)       branchDocumentBlock.documentNumberEntry.atomicModify (lambda x: int(x)+1)
500    
501       ownDocumentBlock.dateEntry = str(tmpBlock.tmpDateEntry )       ownDocumentBlock.dateEntry1 = str(tmpBlock.tmpDateEntry )
502       if len(ownDocumentBlock.dateEntry) == 0:       if len(ownDocumentBlock.dateEntry1) == 0:
503           ownDocumentBlock.dateEntry = ownDocumentDataSource.getTimeStamp()           ownDocumentBlock.dateEntry1 = ownDocumentDataSource.getTimeStamp()
504    
505       proceedingBlock.processRollback()       proceedingBlock.rollback()
506       proceedingBlock.idEntry.autofillBySequence('proceeding_id_seq')       proceedingBlock.idEntry1.autofillBySequence('proceeding_id_seq')
507       proceedingBlock.dateEntry = proceedingDataSource.getTimeStamp()       proceedingBlock.dateEntry = proceedingDataSource.getTimeStamp()
508            
509       ownDocumentBlock.idEntry.autofillBySequence('own_document_id_seq')       ownDocumentBlock.idEntry2.autofillBySequence('own_document_id_seq')
510       ownDocumentBlock.typeEntry = "4"       ownDocumentBlock.typeEntry = "4"
511            
512       ownDocumentProceedingBlock.processRollback()       ownDocumentProceedingBlock.rollback()
513       ownDocumentProceedingBlock.proceedingEntry = str(proceedingBlock.idEntry)       ownDocumentProceedingBlock.proceedingEntry = str(proceedingBlock.idEntry1)
514       ownDocumentProceedingBlock.ownDocumentEntry = str(ownDocumentBlock.idEntry)       ownDocumentProceedingBlock.ownDocumentEntry1 = str(ownDocumentBlock.idEntry2)
515       ownDocumentProceedingBlock.amountEntry = str(payBlock.cashEntry)       ownDocumentProceedingBlock.amountEntry = str(payBlock.cashEntry)
516            
517       currencyMovementBlock.processRollback()       currencyMovementBlock.rollback()
518       currencyMovementBlock.proceedingEntry = str(proceedingBlock.idEntry)       currencyMovementBlock.proceedingEntry1 = str(proceedingBlock.idEntry1)
519       currencyMovementBlock.movementTypeEntry = "" # Revisar com queda esto       currencyMovementBlock.movementTypeEntry = "" # Revisar com queda esto
520       currencyMovementBlock.currencyTypeEntry = "1"       currencyMovementBlock.currencyTypeEntry = "1"
521       currencyMovementBlock.amountEntry = str(payBlock.cashEntry)       currencyMovementBlock.amountEntry1 = str(payBlock.cashEntry)
522    
523       ownDocumentBlock.commit()       ownDocumentBlock.commit()
524       lOwnDocId = str(ownDocumentBlock.idEntry)       lOwnDocId = str(ownDocumentBlock.idEntry2)
525    
526       ownItemToUpdBlock.initQuery()       ownItemToUpdBlock.initQuery()
527       ownItemToUpdBlock.ownDocumentEntry = lOwnDocId       ownItemToUpdBlock.ownDocumentEntry2 = lOwnDocId
528       ownItemToUpdBlock.processQuery()       ownItemToUpdBlock.executeQuery()
529       lRecordCount = ownItemToUpdBlock.getRecordCount()       lRecordCount = ownItemToUpdBlock.getRecordCount()
530       for recNum in range(lRecordCount):       for recNum in range(lRecordCount):
531          ownItemToUpdBlock.jumpRecord(recNum)          ownItemToUpdBlock.gotoRecord(recNum)
532          ownItemToUpdBlock.levelEntry.atomicModify(lambda x:x-round(float(str(ownItemToUpdBlock.qtyEntry)),4))          ownItemToUpdBlock.levelEntry.atomicModify(lambda x:x-round(float(str(ownItemToUpdBlock.qtyEntry1)),4))
533       ownItemToUpdBlock.processRollback()       ownItemToUpdBlock.rollback()
534    
535       #setFocus(ownDocumentBlock.clientRecipientBox.clientEntry)       #setFocus(ownDocumentBlock.clientEntry)
536    </trigger>    ]]></trigger>
537          <trigger name="clientSearchTrigger" type="NAMED"><![CDATA[
538    <trigger name="rollbackTrigger" type="NAMED">        tmpBlock.priceTypeId1 = None
539    tmpValuesDataSource.priceTypeId = None        codeToSearch = str(ownDocumentBlock.clientCodeEntry)
540    for block in form._object._blockList:        nameToSearch = str(ownDocumentBlock.clientNameEntry)
541    
542          callTrigger('rollbackTrigger')
543    
544          ownDocumentBlock.clientCodeEntry = codeToSearch
545          ownDocumentBlock.clientNameEntry = nameToSearch
546    
547          callTrigger('startWaitingModeTrigger')
548          clientResultBlock.initQuery()
549          clientResultBlock.uidEntry = codeToSearch+"%"
550          clientResultBlock.nameEntry = nameToSearch+"%"
551          clientResultBlock.executeQuery()
552          callTrigger('endWaitingModeTrigger')
553          recordCount = clientResultBlock.getRecordCount()
554          if recordCount > 1:
555            global block1, block2, call
556            block1 = clientResultBlock
557            block2 = ownDocumentBlock
558            call = callTrigger
559            def callback (returnValue):
560              global block1, block2, call
561              clientResultBlock = block1
562              ownDocumentBlock = block2
563              callTrigger = call
564              if returnValue >= 0:
565                clientResultBlock.gotoRecord(returnValue)
566                ownDocumentBlock.clientCodeEntry = str(clientResultBlock.uidEntry)
567                ownDocumentBlock.clientNameEntry = str(clientResultBlock.nameEntry)
568                ownDocumentBlock.clientEntry = str(clientResultBlock.idEntry)
569                callTrigger('startWaitingModeTrigger')
570                callTrigger('bringClientDataTrigger')
571                callTrigger('endWaitingModeTrigger')
572                
573            runForm ('clientSelect.gfd', {'data': clientResultBlock, 'callback': callback})
574          elif recordCount == 1:
575            clientResultBlock.gotoRecord(0)
576            ownDocumentBlock.clientCodeEntry = str(clientResultBlock.uidEntry)
577            ownDocumentBlock.clientNameEntry = str(clientResultBlock.nameEntry)
578            ownDocumentBlock.clientEntry = str(clientResultBlock.idEntry)
579            callTrigger('startWaitingModeTrigger')
580            callTrigger('bringClientDataTrigger')
581            callTrigger('endWaitingModeTrigger')
582    
583      ]]></trigger>
584      <trigger name="rollbackTrigger" type="NAMED"><![CDATA[
585      tmpBlock.priceTypeId1 = None
586      for block in form._object._logic._blockList:
587      block.processRollback ()      block.processRollback ()
588    
589    ownDocumentBlock.newRecord()    ownDocumentBlock.newRecord()
590    branchDocumentBlock.initQuery()    branchDocumentBlock.initQuery()
591    branchDocumentBlock.processQuery()    branchDocumentBlock.executeQuery()
592    
593        
594    tmpBlock.tmpDateEntry = ownDocumentDataSource.getTimeStamp()    tmpBlock.tmpDateEntry = ownDocumentDataSource.getTimeStamp()
595    #setFocus(ownDocumentBlock.clientCodeEntry)    #setFocus(ownDocumentBlock.clientCodeEntry)
596    </trigger>    ]]></trigger>
597    <trigger name="startUp" type="On-Startup">    <trigger name="startUp" type="On-Startup"><![CDATA[
598    tmpValuesDataSource.priceTypeId = None    tmpBlock.priceTypeId1 = None
599    tmpValuesDataSource.onSwitch = "0"    tmpValuesDataSource.onSwitch = "0"
   ownBranchBlock.processRollback()  
   ownBranchBlock.initQuery()  
   ownBranchBlock.processQuery()  
   tmpValuesDataSource.ourIVACond = str(ownBranchBlock.condIVAEntry)  
600    tmpBlock.tmpDateEntry = ownDocumentDataSource.getTimeStamp()    tmpBlock.tmpDateEntry = ownDocumentDataSource.getTimeStamp()
601    </trigger>    ]]></trigger>
602      <trigger name="quitTrigger" type="NAMED"><![CDATA[
   <trigger name="quitTrigger" type="NAMED">  
603    callTrigger('rollbackTrigger')    callTrigger('rollbackTrigger')
604    ownDocumentBlock.processRollback()    ownDocumentBlock.rollback()
605    exit()    exit()
606    </trigger>    ]]></trigger>
607      <trigger name="totalCalcTrigger" type="NAMED"><![CDATA[
608    <!--  Este trigger clacula el total facturado -->           import hack
609    <trigger name="totalCalcTrigger" type="NAMED">          
610      import hack           lQty = hack.a2f(ownItemBlock.qtyEntry)
611                 lBonus = hack.a2f(ownItemBlock.bonusEntry)
612      lQty = hack.a2f(ownItemBlock.qtyEntry)           lDiscount = hack.a2f(ownItemBlock.discountEntry)
613      lBonus = hack.a2f(ownItemBlock.bonusEntry)           lUnitPrice = hack.a2f(ownItemBlock.unitPriceEntry)
614      lDiscount = hack.a2f(ownItemBlock.discountEntry)  
615      lUnitPrice = hack.a2f(ownItemBlock.unitPriceEntry)           lItemPrice = (lQty * lUnitPrice) - lBonus - lDiscount
616    
617      lItemPrice = (lQty * lUnitPrice) - lBonus - lDiscount           ownItemBlock.taxAmountEntry = lItemPrice * hack.a2f(ownItemBlock.ivaEntry)/100
618             ownItemBlock.itemTotalEntry = lItemPrice + hack.a2f(ownItemBlock.taxAmountEntry)
619      sourceCode = str(tmpValuesDataSource.taxSourceCode)  
620      ourIVACond = hack.a2f(tmpValuesDataSource.ourIVACond)           lTNeto = 0
621      alienIVACond = hack.a2f(tmpValuesDataSource.alienIVACond)           lTTax = 0
622      amount = lItemPrice          
623      taxPercent = hack.a2f(ownItemBlock.ivaEntry)           lRecords = ownItemDataSource.getRecords()
624             for index in range(len(lRecords)):
625      exec(sourceCode)             lRecord = lRecords[index]
626      ownItemBlock.taxAmountEntry = hack.a2f(graft(ourIVACond,alienIVACond,amount,taxPercent))             lQty = hack.a2f(lRecord.getField("own_product_item.qty"))
627      ownItemBlock.itemNetoEntry = lItemPrice             #print "cantidad: ",lQty
628      ownItemBlock.itemTotalEntry = lItemPrice + hack.a2f(ownItemBlock.taxAmountEntry)             lBonus = hack.a2f(lRecord.getField("own_item.bonus"))
629               lDiscount = hack.a2f(lRecord.getField("own_item.discount"))
630      lTNeto = 0             lResultSet = priceDataSource.createResultSet({"id":lRecord.getField("own_product_item.price")})
631      lTTax = 0             if (lResultSet.firstRecord()):
632                     lUnitPrice = hack.a2f(lResultSet.current.getField("unit_price"))
633      lRecords = ownItemDataSource.getRecords()             else:
634      for index in range(len(lRecords)):               lUnitPrice = 0
635        lRecord = lRecords[index]               #print "lUnitPrice = ",lUnitPrice
636        lQty = hack.a2f(lRecord.getField("own_product_item.qty"))            
637        #print "cantidad: ",lQty             lItemPrice = (lQty * lUnitPrice) - lBonus - lDiscount
638        lBonus = hack.a2f(lRecord.getField("own_item.bonus"))             lTNeto += lItemPrice
639        lDiscount = hack.a2f(lRecord.getField("own_item.discount"))             lTTax += hack.a2f(lRecord.getField("own_item_tax.amount"))
640        lUnitPrice = hack.a2f(lRecord.getField("own_product_item.unit_price"))  
641        #lResultSet = priceDataSource.createResultSet({"id":lRecord.getField("own_product_item.price")})           totalBlock.netoEntry = str(lTNeto)
642        #if (lResultSet.firstRecord()):           totalBlock.ivaEntry1 = str(lTTax)
643        #lUnitPrice = hack.a2f(lResultSet.current.getField("unit_price"))           totalBlock.totalEntry = str(lTNeto+lTTax)
644        #else:           payBlock.cashEntry = str(lTNeto+lTTax)
645        #  lUnitPrice = 0           payBlock.ctaCteEntry = "0.0"
646        #print "lUnitPrice = ",lUnitPrice    ]]></trigger>
647            <logic>
648        lItemPrice = (lQty * lUnitPrice) - lBonus - lDiscount      <block name="proceedingBlock" datasource="proceedingDataSource">
649        lTNeto += lItemPrice        <field name="idEntry1" field="id"/>
650        lTTax += hack.a2f(lRecord.getField("own_item_tax.amount"))        <field name="dateEntry" field="date"/>
   
     totalBlock.netoEntry = str(lTNeto)  
     totalBlock.ivaEntry = str(lTTax)  
     totalBlock.totalEntry = str(lTNeto+lTTax)  
     payBlock.cashEntry = str(lTNeto+lTTax)  
     payBlock.ctaCteEntry = "0.0"  
   </trigger>  
   
       
   <page name="Factura a Clientes">  
     <box height="9" label="Factura de Productos a Clientes"  
       name="invoiceHeaderBox" width="105" x="0" y="0">  
     <!--     Estos bloques son para la gestion del pago de la factura -->  
     <block name="proceedingBlock" datasource="proceedingDataSource" transparentBlock="">  
         <entry name="idEntry" field="id" hidden="" x="1" y="1" width="12"/>      
         <entry name="dateEntry" field="date" hidden="" x="1" y="1" width="12"/>      
651      </block>      </block>
652        <block name="clientResultBlock" datasource="clientSearchDataSource">
653          <field name="idEntry" field="_entity_data.id"/>
654          <field name="uidEntry" field="_entity_uid_data.uid"/>
655          <field name="nameEntry" field="_entity_data.name"/>
656        </block>
657        <block name="ownDocumentBlock" datasource="ownDocumentDataSource"
658               restrictInsert="">
659          <field name="idEntry2" field="id"/>
660          <field name="typeEntry" field="own_document_type"/>
661          <field name="currentClientEntry"/>
662          <field name="clientEntry" field="recipient"/>
663          <field name="clientCodeEntry">
664            <options>
665              <option name="tip" value="Insertar el Código"/>
666            </options>
667          </field>
668          <field name="clientNameEntry">
669            <options>
670              <option name="tip" value="Insertar el nombre o descripción"/>
671            </options>
672          </field>
673          <field name="priceTypeEntry" field="recipient"
674                 fk_description="_price_type_data.name" fk_key="_entity_data.id" fk_source="clientDataSource" readonly=""/>
675          <field name="scoreEntry" field="recipient"
676                 fk_description="_client_data.score" fk_key="_entity_data.id" fk_source="clientDataSource" readonly=""/>
677          <field name="creditLimit1Entry" field="recipient"
678                 fk_description="_credit_limit_data.credit_limit" fk_key="_entity_data.id" fk_source="tlCreditLimit1DataSource"
679                 readonly=""/>
680          <field name="deudaEntry" displaymask="%0.2f" typecast="number"/>
681          <field name="dateEntry1" field="date" typecast="date"/>
682          <field name="numberEntry" field="number"/>
683        </block>
684        <block name="tmpBlock" datasource="tmpValuesDataSource">
685          <field name="tmpDateEntry" typecast="date"/>
686          <field name="priceTypeId1" />
687        </block>
688        <block name="branchDocumentBlock" datasource="branchDocumentDataSource">
689          <field name="documentNumberEntry" field="_branch_document_data.number"/>
690          <field name="documentTypeEntry"
691                 field="_branch_document_data.document_type"/>
692          <field name="branchEntry" field="_branch_document_data.branch"/>
693        </block>
694        <block name="priceTypeBlock" datasource="priceTypeDataSource">
695          <field name="priceTypeParentId" field="parent"/>
696          <field name="priceTypeId" field="_table"/>
697        </block>
698        <block name="tmpProdResultBlock" datasource="productResultDataSource">
699          <field name="prodNameEntry" field="_product_data.canonical_name"/>
700          <field name="prodIdEntry" field="_product_data._table"/>
701          <field name="prodCodeEntry" field="_product_code_data.code"/>
702          <field name="prodCodeTypeEntry"
703                 field="_product_code_data.product_code_type"/>
704          <field name="prodPriceTypeEntry" field="_price_type_data.name"/>
705          <field name="prodPriceTypeIdEntry" field="_price_type_data._table"/>
706          <field name="prodUnitPriceEntry" field="_price_data.unit_price"/>
707          <field name="prodPriceEntry" field="_price_data.id"/>
708          <field name="prodIVATaxEntry" field="_product_tax_data.amount"/>
709        </block>
710        <block name="prodResultBlock" datasource="prodResultDataSource"
711               restrictInsert="">
712          <field name="prodCodeEntry1"/>
713          <field name="prodNameEntry1"/>
714          <field name="prodPriceTypeEntry1"/>
715          <field name="prodUnitPriceEntry1"/>
716          <field name="prodPriceEntry1"/>
717          <field name="prodPricePreviousEntry"/>
718          <field name="prodProductIdEntry"/>
719          <field name="prodPriceListIdEntry"/>
720          <field name="prodIVATaxEntry1"/>
721        </block>
722        <block name="ownItemBlock" datasource="ownItemDataSource">
723          <field name="prodCodeSEntry">
724            <options>
725              <option name="tip" value="Insertar el código"/>
726            </options>
727          </field>
728          <field name="prodNameSEntry">
729            <options>
730              <option name="tip"
731                      value="Insertar el nombre o descripción del producto"/>
732            </options>
733          </field>
734          <field name="ownDocumentEntry" field="own_item.own_document"/>
735          <field name="qtyEntry" displaymask="%0.3f" field="own_product_item.qty"
736                 typecast="number">
737            <trigger name="qtyEntryPreFocusout" src="totalCalcTrigger"
738                     type="PRE-FOCUSOUT"/>
739          </field>
740          <field name="unitPriceEntry" displaymask="%0.2f" readonly=""
741                 typecast="number"/>
742          <field name="priceEntry" field="own_product_item.price" readonly=""/>
743          <field name="taxTypeEntry" default="1" displaymask="%0.2f"
744                 field="own_item_tax.tax" readonly="" typecast="number"/>
745          <field name="taxAmountEntry" displaymask="%0.2f"
746                 field="own_item_tax.amount" readonly="" typecast="number"/>
747          <field name="ivaEntry" default="0" displaymask="%0.0f"/>
748          <field name="discountEntry" default="0.00" displaymask="%0.2f"
749                 field="own_item.discount" typecast="number">
750            <trigger name="discountEntryPreFocusout" src="totalCalcTrigger"
751                     type="PRE-FOCUSOUT"/>
752          </field>
753          <field name="bonusEntry" default="0.00" displaymask="%0.2f"
754                 field="own_item.bonus" typecast="number"/>
755          <field name="itemTotalEntry" default="0.00" displaymask="%0.2f"
756                 typecast="number"/>
757        </block>
758        <block name="ownDocumentProceedingBlock"
759               datasource="ownDocumentProceedingDataSource">
760          <field name="proceedingEntry" field="proceeding"/>
761          <field name="ownDocumentEntry1" field="own_document"/>
762          <field name="amountEntry" field="amount"/>
763        </block>
764        <block name="currencyMovementBlock"
765               datasource="currencyMovementDataSource">
766          <field name="proceedingEntry1" field="movement.proceeding"/>
767          <field name="movementTypeEntry" field="movement.movement_type"/>
768          <field name="amountEntry1" field="movement.amount"/>
769          <field name="currencyTypeEntry" field="currency_movement.currency_type"/>
770        </block>
771        <block name="totalBlock" datasource="tmpValuesDataSource"
772               restrictInsert="">
773          <field name="netoEntry" default="0.00" displaymask="%0.2f" readonly=""
774                 typecast="number"/>
775          <field name="ivaEntry1" default="0.00" displaymask="%0.2f" readonly=""
776                 typecast="number"/>
777          <field name="totalEntry" default="0.00" displaymask="%0.2f" readonly=""
778                 typecast="number"/>
779        </block>
780        <block name="ownItemToUpdBlock" datasource="ownItemToUpdDataSource">
781          <field name="ownDocumentEntry2" field="own_item.own_document"/>
782          <field name="prodIdEntry1" field="_price_data.product"/>
783          <field name="qtyEntry1" field="own_product_item.qty"/>
784          <field name="levelEntry" field="_product_store_data.level"/>
785          <field name="productEntry" field="_product_store_data.product"/>
786          <field name="storehouseEntry" field="_product_store_data.storehouse"/>
787          <field name="hiwaterEntry" field="_product_store_data.hiwater"/>
788          <field name="lowaterEntry" field="_product_store_data.lowater"/>
789          <field name="tableEntry" field="_product_store_data._table"/>
790        </block>
791        <block name="creditLimit1Block" datasource="creditLimit1DataSource">
792          <field name="entityEntry" field="_credit_limit_data.entity"/>
793          <field name="movementTypeEntry1"
794                 field="_credit_limit_data.movement_type"/>
795          <field name="creditLimitAmountEntry"
796                 field="_credit_limit_data.credit_limit"/>
797          <field name="balanceEntry" field="_credit_limit_data.balance"/>
798          <field name="timeStampEntry" field="_credit_limit_data.time_stamp"/>
799        </block>
800        <block name="payBlock" datasource="payDataSource">
801          <field name="cashEntry" default="0.00" displaymask="%0.2f"
802                 typecast="number">
803            <trigger name="cashEntryPreFocusout" type="Pre-Focusout"><![CDATA[
804               import hack
805               payBlock.ctaCteEntry = str(hack.a2f(totalBlock.totalEntry) - hack.a2f(payBlock.cashEntry))
806            ]]></trigger>
807          </field>
808          <field name="ctaCteEntry" default="0.00" displaymask="%0.2f"
809                 typecast="number">
810            <trigger name="ctaCteEntryPreFocusOut" type="Pre-Focusout"><![CDATA[
811               import hack
812               payBlock.cashEntry = str(hack.a2f(totalBlock.totalEntry) - hack.a2f(payBlock.ctaCteEntry))
813            ]]></trigger>
814          </field>
815        </block>
816      </logic>
817      <layout xmlns:c="GNUe:Layout:Char" c:height="27" c:width="107">
818        <page name="Factura a Clientes">
819          <trigger name="prodDeleteTrigger" type="NAMED"><![CDATA[
820          ownItemBlock.prodCodeSEntry = ""
821          ownItemBlock.prodNameSEntry = ""
822          ownItemBlock.qtyEntry = 0.00
823          ownItemBlock.unitPriceEntry = 0.00
824          ownItemBlock.priceEntry = "0"
825          ownItemBlock.taxAmountEntry = 0
826          ownItemBlock.ivaEntry = 0
827          ownItemBlock.discountEntry = 0.00
828          ownItemBlock.bonusEntry = 0.00
829          ownItemBlock.itemTotalEntry = 0.00
830        ]]></trigger>
831          <trigger name="prodSearchTrigger" type="NAMED"><![CDATA[
832          #armado de la lista de recorrido del arbol
833          search_id = str(tmpBlock.priceTypeId1)
834          priceListsChain=[]
835          while search_id != "" :
836              priceTypeBlock.initQuery()
837              priceTypeBlock.priceTypeId = search_id                        
838              priceTypeBlock.executeQuery()
839              search_id = str(priceTypeBlock.priceTypeParentId)
840              priceListsChain.append("%s" % priceTypeBlock.priceTypeId)
841          tmpProdResultBlock.rollback()
842          tmpProdResultBlock.initQuery()
843          tmpProdResultBlock.prodNameEntry = ("%s" % ownItemBlock.prodNameSEntry)+"%"
844          tmpProdResultBlock.prodCodeEntry = ("%s" % ownItemBlock.prodCodeSEntry)+"%"
845          tmpProdResultBlock.prodCodeTypeEntry = "1" # Ver como elegimos el código adecuado
846          tmpProdResultBlock.executeQuery()
847          # cargar la parte visible de modificacion de precios
848          tmpProdResultBlock.firstRecord()
849          product_id_anterior = None
850          prodResultBlock.rollback()
851          someProd = 0
852          for index in range(tmpProdResultBlock.getRecordCount()):
853              product_id=("%s" %tmpProdResultBlock.prodIdEntry)
854              if product_id != product_id_anterior:
855                  for pricetype in priceListsChain:
856                      if pricetype == ("%s" %tmpProdResultBlock.prodPriceTypeIdEntry):
857                          someProd = 1
858                          if len(str(prodResultBlock.prodNameEntry1)):
859                            prodResultBlock.newRecord()
860                          prodResultBlock.prodNameEntry1= ("%s" %tmpProdResultBlock.prodNameEntry)
861                          prodResultBlock.prodCodeEntry1= ("%s" %tmpProdResultBlock.prodCodeEntry)
862                          prodResultBlock.prodPriceTypeEntry1=  ("%s" %tmpProdResultBlock.prodPriceTypeEntry)
863                          prodResultBlock.prodUnitPriceEntry1= ("%s" %tmpProdResultBlock.prodUnitPriceEntry)
864                          prodResultBlock.prodPriceEntry1 = ("%s" %tmpProdResultBlock.prodPriceEntry)
865                          prodResultBlock.prodPricePreviousEntry= ("%s" %tmpProdResultBlock.prodUnitPriceEntry)
866                          prodResultBlock.prodProductIdEntry= ("%s" %tmpProdResultBlock.prodIdEntry)
867                          prodResultBlock.prodPriceListIdEntry= ("%s" %tmpProdResultBlock.prodPriceTypeIdEntry)
868                          prodResultBlock.prodIVATaxEntry1= ("%s" %tmpProdResultBlock.prodIVATaxEntry)
869                          product_id_anterior=product_id
870                          break
871              tmpProdResultBlock.nextRecord()
872          prodResultBlock.gotoRecord(0)
873          recordCount = prodResultBlock.getRecordCount()
874          if recordCount > 1:
875            global block1, call
876            block1 = prodResultBlock
877            call = callTrigger
878            def callback (returnValue):
879              global block1, call
880              prodResultBlock = block1
881              callTrigger = call
882              if returnValue >= 0:
883                prodResultBlock.gotoRecord(returnValue)
884                callTrigger('prodInsertTrigger')
885                
886            runForm ('productSelect.gfd', {'data': prodResultBlock, 'callback': callback})
887          elif recordCount == 1:
888            prodResultBlock.gotoRecord(0)
889            if someProd:
890              callTrigger('prodInsertTrigger')
891      ]]></trigger>
892          <trigger name="prodInsertTrigger" type="NAMED"><![CDATA[
893        import hack
894    
895        ownItemBlock.prodCodeSEntry = str(prodResultBlock.prodCodeEntry1)
896        ownItemBlock.prodNameSEntry = str(prodResultBlock.prodNameEntry1)
897        ownItemBlock.priceEntry = str(prodResultBlock.prodPriceEntry1)
898    
899        lItemPrice = hack.a2f(prodResultBlock.prodUnitPriceEntry1)*hack.a2f(ownItemBlock.qtyEntry)
900        ownItemBlock.taxAmountEntry = (hack.a2f(prodResultBlock.prodIVATaxEntry1)/100) * lItemPrice
901        ownItemBlock.ivaEntry = hack.a2f(prodResultBlock.prodIVATaxEntry1)
902        ownItemBlock.unitPriceEntry = str(prodResultBlock.prodUnitPriceEntry1)
903                                      
904        callTrigger('totalCalcTrigger')
905      ]]></trigger>
906          <box name="invoiceHeaderBox" c:height="9"
907               label="Factura de Productos a Clientes" c:width="105" c:x="0" c:y="0">
908            <button name="clientSearchButton" c:height="1" label="Buscar"
909                    c:width="7" c:x="59" c:y="6">
910              <trigger src="clientSearchTrigger" type="On-Action"/>
911            </button>
912          </box>
913          <entry block="proceedingBlock" field="idEntry1" hidden="" c:width="12"
914                 c:x="2" c:y="2"/>
915          <entry block="proceedingBlock" field="dateEntry" hidden="" c:width="12"
916                 c:x="2" c:y="2"/>
917          <trigger name="bringClientDataTrigger" type="NAMED"><![CDATA[
918    
919      <!-- Actualiza los datos del cliente -->      rs = anotherClientDataSource.createResultSet({'_entity_data.id':str(ownDocumentBlock.clientEntry)})
     <trigger type="NAMED" name="bringClientDataTrigger"><![CDATA[  
   
     rs = clientDataSource.createResultSet({'_entity_data.id':str(ownDocumentBlock.clientRecipientBox.clientEntry)})  
920      if rs.firstRecord():      if rs.firstRecord():
921          ownDocumentBlock.clientRecipientBox.currentClientEntry = rs.current.getField('_entity_data._table')          print "Inside"
922          tmpValuesDataSource.taxSourceCode = rs.current.getField('_tax_data.graft')          ownDocumentBlock.currentClientEntry = rs.current.getField('_entity_data._table')
923          tmpValuesDataSource.alienIVACond = rs.current.getField('_tax_profile_data._table')      print "Here"
924                if str(ownDocumentBlock.currentClientEntry):
925      if str(ownDocumentBlock.clientRecipientBox.currentClientEntry):          print "Inside again"
926          # Actualiza el puntaje          # Actualiza el puntaje
927          ownDocumentBlock.clientRecipientBox.scoreEntry = str(ownDocumentBlock.clientRecipientBox.clientEntry)          ownDocumentBlock.scoreEntry = str(ownDocumentBlock.clientEntry)
928          # Actualiza el limite de credito          # Actualiza el limite de credito
929          ownDocumentBlock.clientRecipientBox.creditLimit1Entry = str(ownDocumentBlock.clientRecipientBox.clientEntry)          ownDocumentBlock.creditLimit1Entry = str(ownDocumentBlock.clientEntry)
930          # Actualiza la Lista de precios asignada al cliente          # Actualiza la Lista de precios asignada al cliente
931          ownDocumentBlock.clientRecipientBox.priceTypeEntry = str(ownDocumentBlock.clientRecipientBox.clientEntry)          ownDocumentBlock.priceTypeEntry = str(ownDocumentBlock.clientEntry)
932          # Aca si existe un balance, calcula la deuda desde ese balance en adelante sino          # Aca si existe un balance, calcula la deuda desde ese balance en adelante sino
933          # calcula la deuda desde el primer documento vinculado al cliente actual          # calcula la deuda desde el primer documento vinculado al cliente actual
934          creditLimit1Block.processRollback()          creditLimit1Block.rollback()
935          creditLimit1Block.initQuery()          creditLimit1Block.initQuery()
936          creditLimit1Block.entityEntry = str(ownDocumentBlock.clientRecipientBox.currentClientEntry)          creditLimit1Block.entityEntry = str(ownDocumentBlock.currentClientEntry)
937          creditLimit1Block.processQuery()          creditLimit1Block.executeQuery()
938          tmpValuesDataSource.creditLimitAmount = str(creditLimit1Block.creditLimitAmountEntry)          tmpValuesDataSource.creditLimitAmount = str(creditLimit1Block.creditLimitAmountEntry)
939            
940          import gnue.common.GConditions as GConditions          import gnue.common.GConditions as GConditions
941          import hack          import hack
942            
943          condProductInvoice = GConditions.GCondition()          condProductInvoice = GConditions.GCondition()
944          #condServiceInvoice = GConditions.GCondition()          condServiceInvoice = GConditions.GCondition()
945          condPay = GConditions.GCondition()          condPay = GConditions.GCondition()
946                    
947          balance = 0          balance = 0
# Line 626  Line 952 
952              GConditions.GCConst(gt,str(creditLimit1Block.timeStampEntry))              GConditions.GCConst(gt,str(creditLimit1Block.timeStampEntry))
953              eq = GConditions.GCeq(tmpAnd)              eq = GConditions.GCeq(tmpAnd)
954              GConditions.GCField(eq,"_entity_data._table")              GConditions.GCField(eq,"_entity_data._table")
955              GConditions.GCConst(eq,str(ownDocumentBlock.clientRecipientBox.currentClientEntry))              GConditions.GCConst(eq,str(ownDocumentBlock.currentClientEntry))
956              #tmpAnd = GConditions.GCand(condServiceInvoice)              tmpAnd = GConditions.GCand(condServiceInvoice)
957              #gt = GConditions.GCgt(tmpAnd)              gt = GConditions.GCgt(tmpAnd)
958              #GConditions.GCField(gt,"own_document.date")              GConditions.GCField(gt,"own_document.date")
959              #GConditions.GCConst(gt,str(creditLimit1Block.timeStampEntry))              GConditions.GCConst(gt,str(creditLimit1Block.timeStampEntry))
960              #eq = GConditions.GCeq(tmpAnd)              eq = GConditions.GCeq(tmpAnd)
961              #GConditions.GCField(eq,"_entity_data._table")              GConditions.GCField(eq,"_entity_data._table")
962              #GConditions.GCConst(eq,str(ownDocumentBlock.clientRecipientBox.currentClientEntry))              GConditions.GCConst(eq,str(ownDocumentBlock.currentClientEntry))
963              tmpAnd = GConditions.GCand(condPay)              tmpAnd = GConditions.GCand(condPay)
964              gt = GConditions.GCgt(tmpAnd)              gt = GConditions.GCgt(tmpAnd)
965              GConditions.GCField(gt,"own_document.date")              GConditions.GCField(gt,"own_document.date")
966              GConditions.GCConst(gt,str(creditLimit1Block.timeStampEntry))              GConditions.GCConst(gt,str(creditLimit1Block.timeStampEntry))
967              eq = GConditions.GCeq(tmpAnd)              eq = GConditions.GCeq(tmpAnd)
968              GConditions.GCField(eq,"_entity_data._table")              GConditions.GCField(eq,"_entity_data._table")
969              GConditions.GCConst(eq,str(ownDocumentBlock.clientRecipientBox.currentClientEntry))              GConditions.GCConst(eq,str(ownDocumentBlock.currentClientEntry))
970              balance = hack.a2f(creditLimit1Block.balance)              balance = hack.a2f(creditLimit1Block.balance)
971          else:          else:
972              eq = GConditions.GCeq(condProductInvoice)              eq = GConditions.GCeq(condProductInvoice)
973              GConditions.GCField(eq,"_entity_data._table")              GConditions.GCField(eq,"_entity_data._table")
974              GConditions.GCConst(eq,str(ownDocumentBlock.clientRecipientBox.currentClientEntry))              GConditions.GCConst(eq,str(ownDocumentBlock.currentClientEntry))
975              #eq = GConditions.GCeq(condServiceInvoice)              eq = GConditions.GCeq(condServiceInvoice)
976              #GConditions.GCField(eq,"_entity_data._table")              GConditions.GCField(eq,"_entity_data._table")
977              #GConditions.GCConst(eq,str(ownDocumentBlock.clientRecipientBox.currentClientEntry))              GConditions.GCConst(eq,str(ownDocumentBlock.currentClientEntry))
978              eq = GConditions.GCeq(condPay)              eq = GConditions.GCeq(condPay)
979              GConditions.GCField(eq,"_entity_data._table")              GConditions.GCField(eq,"_entity_data._table")
980              GConditions.GCConst(eq,str(ownDocumentBlock.clientRecipientBox.currentClientEntry))              GConditions.GCConst(eq,str(ownDocumentBlock.currentClientEntry))
981    
982          # Calculo del total facturado          # Calculo del total facturado
983          ## Factura de productos          ## Factura de productos
# Line 664  Line 990 
990              currOwnDoc = productInvoiceResultSet.current.getField("own_document.id")              currOwnDoc = productInvoiceResultSet.current.getField("own_document.id")
991              while productInvoiceResultSet.current.getField("own_document.id") == currOwnDoc and more:              while productInvoiceResultSet.current.getField("own_document.id") == currOwnDoc and more:
992                  lQty = hack.a2f(productInvoiceResultSet.current.getField("own_product_item.qty"))                  lQty = hack.a2f(productInvoiceResultSet.current.getField("own_product_item.qty"))
993                  lUnitPrice = hack.a2f(productInvoiceResultSet.current.getField("own_product_item.unit_price"))                  lUnitPrice = hack.a2f(productInvoiceResultSet.current.getField("_price_data.unit_price"))
994                  lBonus = hack.a2f(productInvoiceResultSet.current.getField("own_item.bonus"))                  lBonus = hack.a2f(productInvoiceResultSet.current.getField("own_item.bonus"))
995                  lDiscount = hack.a2f(productInvoiceResultSet.current.getField("own_item.discount"))                  lDiscount = hack.a2f(productInvoiceResultSet.current.getField("own_item.discount"))
996                  item = lQty * lUnitPrice - lBonus - lDiscount                  item = lQty * lUnitPrice - lBonus - lDiscount
# Line 685  Line 1011 
1011                            
1012          # Calculo del total facturado          # Calculo del total facturado
1013          ## Factura de servicios          ## Factura de servicios
1014          #serviceInvoiceResultSet= serviceInvoiceTotalDataSource.createResultSet (condServiceInvoice)          serviceInvoiceResultSet= serviceInvoiceTotalDataSource.createResultSet (condServiceInvoice)
1015          #more= serviceInvoiceResultSet.firstRecord ()          more= serviceInvoiceResultSet.firstRecord ()
1016    
1017          # por todos los documentos post-checkpoint (si no hay, desde el principio)          # por todos los documentos post-checkpoint (si no hay, desde el principio)
1018          # print "calc 4"          # print "calc 4"
1019          #while more:          while more:
1020          #   invoiceTotal = 0              invoiceTotal = 0
1021          #   currentOwnDocument= serviceInvoiceResultSet.current.getField ("own_document.id")              currentOwnDocument= serviceInvoiceResultSet.current.getField ("own_document.id")
1022          #  
1023          #   # por todos los items del documento              # por todos los items del documento
1024          #   # print "calc 5: [%s] %d" % (currentOwnDocument, spentTotal)              # print "calc 5: [%s] %d" % (currentOwnDocument, spentTotal)
1025          #   while serviceInvoiceResultSet.current.getField ("own_document.id")==currentOwnDocument and more:              while serviceInvoiceResultSet.current.getField ("own_document.id")==currentOwnDocument and more:
1026          #       item = hack.a2f(serviceInvoiceResultSet.current.getField ("own_service_item.amount"))                  item = hack.a2f(serviceInvoiceResultSet.current.getField ("own_service_item.amount"))
1027          #       currentItem= serviceInvoiceResultSet.current.getField ("own_item.id")                  currentItem= serviceInvoiceResultSet.current.getField ("own_item.id")
1028          #       itemTaxTotal = 0                  itemTaxTotal = 0
1029          #       # por todos los impuestos del item                  # por todos los impuestos del item
1030          #       # print "calc 6: [%s:%s] %d" % (currentOwnDocument, currentItem, invoiceTotal)                  # print "calc 6: [%s:%s] %d" % (currentOwnDocument, currentItem, invoiceTotal)
1031          #       while serviceInvoiceResultSet.current.getField ("own_item.id")==currentItem and more:                  while serviceInvoiceResultSet.current.getField ("own_item.id")==currentItem and more:
1032          #           # calculate the item price exactly as I do in the other trigger                      # calculate the item price exactly as I do in the other trigger
1033          #           # not revised yet, but I think it was like this                      # not revised yet, but I think it was like this
1034          #           itemTaxTotal += hack.a2f(serviceInvoiceResultSet.current.getField ("own_item_tax.amount"))                      itemTaxTotal += hack.a2f(serviceInvoiceResultSet.current.getField ("own_item_tax.amount"))
1035          #           more= serviceInvoiceResultSet.nextRecord ()                      more= serviceInvoiceResultSet.nextRecord ()
1036          #           # print "calc 7: %d:%d" % (item, itemTaxTotal)                      # print "calc 7: %d:%d" % (item, itemTaxTotal)
1037          #  
1038          #       invoiceTotal+= item + itemTaxTotal                  invoiceTotal+= item + itemTaxTotal
1039          #                        
1040          #   spentTotal+= invoiceTotal              spentTotal+= invoiceTotal
1041    
1042    
1043          # Calculo del total cobrado          # Calculo del total cobrado
# Line 730  Line 1056 
1056          #print "payTotal ", payTotal          #print "payTotal ", payTotal
1057          # Calculo del total adeudado          # Calculo del total adeudado
1058          deudaTotal = spentTotal - balance - payTotal          deudaTotal = spentTotal - balance - payTotal
1059          ownDocumentBlock.clientRecipientBox.deudaEntry = deudaTotal          ownDocumentBlock.deudaEntry = deudaTotal
1060    
1061          # ******** FALTA GRABAR EL BALANCE **************          # ******** FALTA GRABAR EL BALANCE **************
1062    
1063          # Obtiene el id de la lista de precios para poder buscar y lo coloca          # Obtiene el id de la lista de precios para poder buscar y lo coloca
1064          # en una variable temporaria colgada del tmpValuesDataSource (un invento que parece que sirve no se si es prolijo)          # en una variable temporaria colgada del tmpBlock (un invento que parece que sirve no se si es prolijo)
1065          clientResultSet = clientDataSource.createResultSet({"_entity_data._table": \          clientResultSet = anotherClientDataSource.createResultSet({"_entity_data._table": \
1066                                                              str(ownDocumentBlock.clientRecipientBox.currentClientEntry)})                                                              str(ownDocumentBlock.currentClientEntry)})
1067          clientResultSet.firstRecord()          clientResultSet.firstRecord()
1068          tmpValuesDataSource.priceTypeId = clientResultSet.current.getField("_price_type_data._table")          tmpBlock.priceTypeId1 = clientResultSet.current.getField("_price_type_data._table")
1069    ]]></trigger>          print "PriceTypeID1: ", clientResultSet.current.getField("_price_type_data._table")
   
     <!-- Bloque para la búsqueda de clientes -->  
     <block name="clientResultBlock" datasource="clientSearchDataSource">  
         <entry name="idEntry" field="_entity_data.id" hidden="" x="1" y="1" width="12"/>      
 <!--         <entry name="uidTypeEntry" field="_entity_uid_data.entity_uid_type" hidden="" x="1" y="1" width="12"/>             -->  
         <entry name="uidEntry" field="_entity_uid_data.uid" hidden="" x="1" y="1" width="12"/>              
         <entry name="nameEntry" field="_entity_data.name" hidden="" x="1" y="1" width="20"/>      
     </block>  
     <trigger name="clientSearchTrigger" type="NAMED"><![CDATA[  
       tmpValuesDataSource.priceTypeId = None  
   
       codeToSearch = str(ownDocumentBlock.clientRecipientBox.clientCodeEntry)  
       nameToSearch = str(ownDocumentBlock.clientRecipientBox.clientNameEntry)  
   
       callTrigger('rollbackTrigger')  
   
       ownDocumentBlock.clientRecipientBox.clientCodeEntry = codeToSearch  
       ownDocumentBlock.clientRecipientBox.clientNameEntry = nameToSearch  
   
       callTrigger('startWaitingModeTrigger')  
       clientResultBlock.initQuery()  
       if codeToSearch:  
         clientResultBlock.uidEntry = codeToSearch+"%"  
       if nameToSearch:  
         clientResultBlock.nameEntry = nameToSearch+"%"  
       clientResultBlock.processQuery()  
       callTrigger('endWaitingModeTrigger')  
       recordCount = clientResultBlock.getRecordCount()  
       if recordCount > 1:  
         def callback (returnValue):  
           global block  
           if returnValue >= 0:  
             clientResultBlock.jumpRecord(returnValue)  
             ownDocumentBlock.clientRecipientBox.clientCodeEntry = str(clientResultBlock.uidEntry)  
             ownDocumentBlock.clientRecipientBox.clientNameEntry = str(clientResultBlock.nameEntry)  
             ownDocumentBlock.clientRecipientBox.clientEntry = str(clientResultBlock.idEntry)  
             callTrigger('startWaitingModeTrigger')  
             callTrigger('bringClientDataTrigger')  
             callTrigger('endWaitingModeTrigger')  
               
         runForm ('clientSelect.gfd', {'data': clientResultBlock, 'callback': callback})  
       elif recordCount == 1:  
         clientResultBlock.jumpRecord(0)  
         ownDocumentBlock.clientRecipientBox.clientCodeEntry = str(clientResultBlock.uidEntry)  
         ownDocumentBlock.clientRecipientBox.clientNameEntry = str(clientResultBlock.nameEntry)  
         ownDocumentBlock.clientRecipientBox.clientEntry = str(clientResultBlock.idEntry)  
         callTrigger('startWaitingModeTrigger')  
         callTrigger('bringClientDataTrigger')  
         callTrigger('endWaitingModeTrigger')  
   
1070    ]]></trigger>    ]]></trigger>
1071          <entry block="clientResultBlock" field="idEntry" hidden="" c:width="12"
1072      <!--     Fin de bloques destinados a la gestion del pago de la factura -->               c:x="2" c:y="2"/>
1073      <block datasource="ownDocumentDataSource" name="ownDocumentBlock" restrictInsert="">        <entry block="clientResultBlock" field="uidEntry" hidden="" c:width="12"
1074          <entry field="id" hidden="" name="idEntry" x="1" y="1"/>               c:x="2" c:y="2"/>
1075          <entry field="own_document_type" hidden="" name="typeEntry" x="1" y="1"/>        <entry block="clientResultBlock" field="nameEntry" hidden=""
1076          <box height="6" label="Datos del Cliente" name="clientRecipientBox" width="103" x="0" y="2">               c:width="20" c:x="2" c:y="2"/>
1077          <entry block="ownDocumentBlock" field="idEntry2" hidden="" c:x="2"
1078          <label name="clientLbl" text="Cliente" x="1" y="1" />               c:y="2"/>
1079          <entry block="ownDocumentBlock" field="typeEntry" hidden="" c:x="2"
1080          <entry x="1" y="1" width="30" name="currentClientEntry" hidden="" />               c:y="2"/>
1081          <entry x="1" y="2" field="recipient" name="clientEntry" width="30" hidden=""/>        <box name="clientRecipientBox" c:height="6" label="Datos del Cliente"
1082          <entry x="1" y="2" name="clientCodeEntry" width="20">             c:width="103" c:x="1" c:y="3"/>
1083            <options>        <label name="clientLbl" text="Cliente" c:x="4" c:y="5"/>
1084              <option name="tip" value="Insertar el Código"/>        <entry block="ownDocumentBlock" field="currentClientEntry" hidden=""
1085            </options>               c:width="30" c:x="4" c:y="5"/>
1086          </entry>        <entry block="ownDocumentBlock" field="clientEntry" hidden=""
1087          <entry x="21" y="2" name="clientNameEntry" width="35">               c:width="30" c:x="4" c:y="6"/>
1088            <options>        <entry block="ownDocumentBlock" field="clientCodeEntry" c:width="20"
1089              <option name="tip" value="Insertar el nombre o descripción"/>               c:x="4" c:y="6"/>
1090            </options>        <entry block="ownDocumentBlock" field="clientNameEntry" c:width="35"
1091          </entry>               c:x="24" c:y="6"/>
1092          <label name="clientLbl" text="Lista de precios:" c:x="4" c:y="8"/>
1093          <button name="clientSearchButton" trigger="clientSearchTrigger" label="Buscar" width="7" height="1" x="56" y="2"/>        <entry block="ownDocumentBlock" field="priceTypeEntry"
1094                 style="textlookup" c:width="20" c:x="22" c:y="8"/>
1095          <label name="clientLbl" text="Lista de precios:" x="1" y="4" />        <label name="scoreLbl" text="Puntaje" c:x="67" c:y="5"/>
1096          <entry block="ownDocumentBlock" field="scoreEntry" style="textlookup"
1097          <entry x="19" y="4" field="recipient" name="priceTypeEntry" readonly=""               c:width="10" c:x="67" c:y="6"/>
1098             width="20" style="textlookup" foreign_key="clientDataSource._entity_data.id"        <label name="nameMVType1Label" text="Límite de Cta. Cte." c:x="78"
1099             foreign_key_description="_price_type_data.name" />               c:y="5"/>
1100          <entry block="ownDocumentBlock" field="creditLimit1Entry"
1101          <label name="scoreLbl" text="Puntaje" x="64" y="1" />               style="textlookup" c:width="10" c:x="78" c:y="6"/>
1102          <entry x="64" y="2" readonly="" field="recipient" name="scoreEntry"        <label name="deudaLbl" text="|   Deuda : " c:x="43" c:y="8"/>
1103                 width="10" style="textlookup" foreign_key="clientDataSource._entity_data.id"        <entry block="ownDocumentBlock" field="deudaEntry" style="label"
1104                 foreign_key_description="_client_data.score"/>               c:width="12" c:x="55" c:y="8"/>
1105          <entry block="ownDocumentBlock" field="dateEntry1" hidden="" rows="10"
1106          <label name="nameMVType1Label" text="Límite de Cta. Cte." x="75" y="1"/>               style="label" c:width="24" c:x="8" c:y="8"/>
1107          <entry block="ownDocumentBlock" field="numberEntry" hidden="" rows="10"
1108          <entry x="75" y="2" readonly="" field="recipient" name="creditLimit1Entry"               style="label" c:width="24" c:x="8" c:y="8"/>
1109                 width="10" style="textlookup" foreign_key="tlCreditLimit1DataSource._entity_data.id"        <label name="dateLbl" text="Fecha" c:x="2" c:y="2"/>
1110                 foreign_key_description="_credit_limit_data.credit_limit"/>        <entry block="tmpBlock" field="tmpDateEntry" rows="10" style="label"
1111                 c:width="24" c:x="8" c:y="2"/>
1112          <label name="deudaLbl" text="|   Deuda : " x="40" y="4"/>        <label name="dateLabel" text="Número de Factura:" c:x="33" c:y="2"/>
1113          <entry name="deudaEntry" style="label" x="52" y="4" width="12" typecast="number" displaymask="%0.2f"/>        <entry block="branchDocumentBlock" field="documentNumberEntry"
1114                 style="label" c:width="15" c:x="56" c:y="2"/>
1115          </box>        <entry block="branchDocumentBlock" field="documentTypeEntry" hidden=""
1116          <entry field="date" name="dateEntry" style="label" hidden="" typecast="date"               c:width="15" c:x="51" c:y="2"/>
1117            rows="10" width="24" x="7" y="7"/>        <entry block="branchDocumentBlock" field="branchEntry" hidden=""
1118          <entry field="number" name="numberEntry" style="label" hidden="" rows="10" width="24" x="7" y="7"/>               c:width="15" c:x="51" c:y="2"/>
1119          <entry block="priceTypeBlock" field="priceTypeParentId" hidden=""
1120        </block>               c:width="40" c:x="1" c:y="2"/>
1121                <entry block="priceTypeBlock" field="priceTypeId" hidden="" c:width="10"
1122        <!-- Fecha de la factura -->               c:x="40" c:y="2"/>
1123        <block name="tmpBlock" datasource="tmpValuesDataSource" transparentBlock="">        <entry block="tmpProdResultBlock" field="prodNameEntry" hidden=""
1124          <label name="dateLbl" text="Fecha" x="1" y="1" />               rows="2" c:width="15" c:x="1" c:y="1"/>
1125          <entry name="tmpDateEntry" typecast="date"        <entry block="tmpProdResultBlock" field="prodIdEntry" hidden="" rows="2"
1126            width="14" x="7" y="1"/>               c:width="5" c:x="15" c:y="1"/>
1127        </block>        <entry block="tmpProdResultBlock" field="prodCodeEntry" hidden=""
1128                 rows="2" c:width="10" c:x="20" c:y="1"/>
1129        <!-- # de factura -->        <entry block="tmpProdResultBlock" field="prodCodeTypeEntry" hidden=""
1130        <block name="branchDocumentBlock" datasource="branchDocumentDataSource">               rows="2" c:width="5" c:x="30" c:y="1"/>
1131          <label name="dateLabel" text="Número de Factura:"        <entry block="tmpProdResultBlock" field="prodPriceTypeEntry" hidden=""
1132            x="32" y="1"/>               rows="2" c:width="10" c:x="35 " c:y="1"/>
1133          <entry name="documentNumberEntry" field="_branch_document_data.number" style="label"        <entry block="tmpProdResultBlock" field="prodPriceTypeIdEntry" hidden=""
1134            x="55" y="1" width="15"/>               rows="2" c:width="5" c:x="45" c:y="1"/>
1135          <entry name="documentTypeEntry" field="_branch_document_data.document_type" hidden=""        <entry block="tmpProdResultBlock" field="prodUnitPriceEntry" hidden=""
1136            x="50" y="1" width="15"/>               rows="2" c:width="20" c:x="50" c:y="1"/>
1137          <entry name="branchEntry" field="_branch_document_data.branch" hidden=""        <entry block="tmpProdResultBlock" field="prodPriceEntry" hidden=""
1138            x="50" y="1" width="15"/>               rows="2" c:width="20" c:x="50" c:y="1"/>
1139        </block>        <entry block="tmpProdResultBlock" field="prodIVATaxEntry" hidden=""
1140                 rows="2" c:width="20" c:x="50" c:y="1"/>
1141      </box>        <entry block="prodResultBlock" field="prodCodeEntry1" hidden="" rows="2"
1142                 c:width="10" c:x="37" c:y="10"/>
1143      <!--     ******************************** -->        <entry block="prodResultBlock" field="prodNameEntry1" hidden="" rows="2"
1144      <!--     Busqueda del producto a facturar -->               c:width="22" c:x="47" c:y="10"/>
1145      <!--     ******************************** -->        <entry block="prodResultBlock" field="prodPriceTypeEntry1" hidden=""
1146                 rows="8" c:width="10" c:x="1 " c:y="1"/>
1147      <!--     Datasource que sirve para la búsqueda del producto  -->        <entry block="prodResultBlock" field="prodUnitPriceEntry1" hidden=""
1148      <datasource database="papo" name="priceTypeDataSource" table="_price_type_data">               rows="8" c:width="10" c:x="1" c:y="1"/>
1149      <condition>        <entry block="prodResultBlock" field="prodPriceEntry1" hidden=""
1150        <null>                 rows="2" c:width="20" c:x="1" c:y="1"/>
1151          <cfield name="_price_type_data._end_t"/>        <entry block="prodResultBlock" field="prodPricePreviousEntry" hidden=""
1152        </null>               rows="8" c:width="10" c:x="1" c:y="1"/>
1153      </condition>        <entry block="prodResultBlock" field="prodProductIdEntry" hidden=""
1154      </datasource>               rows="8" c:width="5" c:x="1" c:y="1"/>
1155      <!--     Bloque que sirve para la búsqueda del producto respetando lista de precios -->        <entry block="prodResultBlock" field="prodPriceListIdEntry" hidden=""
1156      <block name="priceTypeBlock" datasource="priceTypeDataSource" transparentBlock="">               rows="8" c:width="5" c:x="1" c:y="1"/>
1157        <entry name="priceTypeParentId"  field="parent" x="1"        <entry block="prodResultBlock" field="prodIVATaxEntry1" hidden=""
1158          y="2" width="40"  hidden=""/>               rows="8" c:width="5" c:x="1" c:y="1"/>
1159        <entry name="priceTypeId" field="_table"  x="40" y="2" width="10" hidden="" />        <label text="Productos a facturar" c:x="1" c:y="9"/>
1160      </block>        <label text="Código" c:x="1" c:y="10"/>
1161      <!--     Datasource que sirve para almacenar el resultado de la búsqueda -->        <entry block="ownItemBlock" field="prodCodeSEntry" rows="10"
1162      <datasource database="papo" name="productResultDataSource"               c:width="14" c:x="1" c:y="11"/>
1163        table="_product_code_type_data, _product_code_data, _product_data, _product_tax_data, _price_data, _price_type_data"        <label text="Nombre" c:x="15" c:y="10"/>
1164        order_by = "_product_data.canonical_name, _price_type_data._table desc" >        <entry block="ownItemBlock" field="prodNameSEntry" rows="10"
1165        <condition>               c:width="20" c:x="15" c:y="11"/>
1166        <and>        <button name="prodSearchButton" c:height="10" label="Buscar" c:width="7"
1167            <null>                  c:x="35" c:y="11">
1168             <cfield name="_product_code_type_data._end_t"/>          <trigger src="prodSearchTrigger" type="On-Action"/>
1169            </null>        </button>
1170            <null>          <entry block="ownItemBlock" field="ownDocumentEntry" hidden="" c:x="1"
1171              <cfield name="_product_code_data._end_t"/>               c:y="1"/>
1172            </null>        <label name="qtyLbl" text="Cantidad" c:x="42" c:y="10"/>
1173            <null>          <entry block="ownItemBlock" field="qtyEntry" rows="10" c:width="12"
1174             <cfield name="_product_data._end_t"/>               c:x="42" c:y="11"/>
1175            </null>        <label name="priceLbl" text="Precio" c:x="55" c:y="10"/>
1176            <null>          <entry block="ownItemBlock" field="unitPriceEntry" rows="10"
1177             <cfield name="_product_tax_data._end_t"/>               style="label" c:width="10" c:x="55" c:y="11"/>
1178            </null>        <entry block="ownItemBlock" field="priceEntry" hidden="" rows="5"
1179            <null>                 c:width="10" c:x="1" c:y="14"/>
1180              <cfield name="_price_data._end_t"/>        <entry block="ownItemBlock" field="taxTypeEntry" hidden="" rows="5"
1181            </null>               c:width="10" c:x="1" c:y="14"/>
1182            <null>          <entry block="ownItemBlock" field="taxAmountEntry" hidden="" rows="5"
1183              <cfield name="_price_type_data._end_t"/>               c:width="10" c:x="1" c:y="14"/>
1184            </null>        <label name="ivaLbl" text="IVA" c:x="66" c:y="10"/>
1185            <eq>        <entry block="ownItemBlock" field="ivaEntry" rows="10" style="label"
1186              <cfield name="_product_code_type_data._table"/>               c:width="2" c:x="66" c:y="11"/>
1187              <cfield name="_product_code_data.product_code_type"/>        <label name="discountLbl" text="Descuento" c:x="71" c:y="10"/>
1188            </eq>        <entry block="ownItemBlock" field="discountEntry" rows="10" c:width="10"
1189            <eq>               c:x="71" c:y="11"/>
1190              <cfield name="_product_data._table"/>        <entry block="ownItemBlock" field="bonusEntry" hidden="" rows="10"
1191              <cfield name="_product_code_data.product"/>               style="label" c:width="10" c:x="79" c:y="11"/>
1192            </eq>        <label name="itemTotalLbl" text="Total" c:x="82" c:y="10"/>
1193            <eq>        <entry block="ownItemBlock" field="itemTotalEntry" rows="10"
1194              <cfield name="_product_data._table"/>               style="label" c:width="10" c:x="82" c:y="11"/>
1195              <cfield name="_product_tax_data.product"/>        <button name="prodDeleteButton" c:height="10" label="Borrar" c:width="7"
1196            </eq>                c:x="93" c:y="11">
1197            <eq>          <trigger src="prodDeleteTrigger" type="On-Action"/>
1198              <cfield name="_product_tax_data.tax"/>        </button>
1199              <cconst value="1"/> <!-- IVA -->        <scrollbar block="ownItemBlock" c:height="10" page="5" c:width="1"
1200            </eq>                   c:x="103" c:y="11"/>
1201            <eq>        <entry block="ownDocumentProceedingBlock" field="proceedingEntry"
1202              <cfield name="_product_data._table"/>               hidden="" c:width="12" c:x="1" c:y="1"/>
1203              <cfield name="_price_data.product"/>        <entry block="ownDocumentProceedingBlock" field="ownDocumentEntry1"
1204            </eq>               hidden="" c:width="12" c:x="1" c:y="1"/>
1205            <eq>        <entry block="ownDocumentProceedingBlock" field="amountEntry" hidden=""
1206              <cfield name="_price_type_data._table"/>               c:width="12" c:x="1" c:y="1"/>
1207              <cfield name="_price_data.price_type"/>        <entry block="currencyMovementBlock" field="proceedingEntry1" hidden=""
1208            </eq>               c:width="12" c:x="1" c:y="1"/>
1209          </and>        <entry block="currencyMovementBlock" field="movementTypeEntry" hidden=""
1210        </condition>               c:width="12" c:x="1" c:y="1"/>
1211      </datasource>        <entry block="currencyMovementBlock" field="amountEntry1" hidden=""
1212      <!--     Bloque que sirve para almacenar el resultado intermedio de la búsqueda -->               c:width="12" c:x="1" c:y="1"/>
1213      <block  name="tmpProdResultBlock" datasource="productResultDataSource" transparentBlock="">        <entry block="currencyMovementBlock" field="currencyTypeEntry" hidden=""
1214        <entry name="prodNameEntry" field="_product_data.canonical_name" x="1" y="1" width="15" rows="2" hidden=""/>               c:width="12" c:x="1" c:y="1"/>
1215        <entry name="prodIdEntry" field="_product_data._table" x="15" y="1" width="5" rows="2" hidden=""/>        <label text="Neto " c:x="50" c:y="22"/>
1216        <entry name="prodCodeEntry" field="_product_code_data.code" x="20" y="1" width="10" rows="2" hidden=""/>        <entry block="totalBlock" field="netoEntry" style="label" c:width="12"
1217        <entry name="prodCodeTypeEntry" field="_product_code_data.product_code_type" x="30" y="1" width="5" rows="2" hidden=""/>               c:x="55" c:y="22"/>
1218        <entry name="prodPriceTypeEntry" field="_price_type_data.name" x="35 " y="1" width="10" rows="2" hidden=""/>        <label text="IVA " c:x="62" c:y="22"/>
1219        <entry name="prodPriceTypeIdEntry" field="_price_type_data._table" x="45" y="1" width="5" rows="2" hidden=""/>        <entry block="totalBlock" field="ivaEntry1" style="label" c:width="12"
1220        <entry name="prodUnitPriceEntry" field="_price_data.unit_price" x="50" y="1" width="20" rows="2" hidden=""/>               c:x="66" c:y="22"/>
1221        <entry name="prodPriceEntry" field="_price_data.id" x="50" y="1" width="20" rows="2" hidden=""/>        <label text="Total " c:x="76" c:y="22"/>
1222        <entry name="prodIVATaxEntry" field="_product_tax_data.amount" x="50" y="1" width="20" rows="2" hidden=""/>        <entry block="totalBlock" field="totalEntry" style="label" c:width="12"
1223      </block>               c:x="82" c:y="22"/>
1224          <entry block="ownItemToUpdBlock" field="ownDocumentEntry2" hidden=""
1225      <trigger name="prodDeleteTrigger" type="NAMED">               c:width="10" c:x="1" c:y="109"/>
1226        ownItemBlock.prodCodeSEntry = ""        <entry block="ownItemToUpdBlock" field="prodIdEntry1" hidden=""
1227        ownItemBlock.prodNameSEntry = ""               c:width="10" c:x="11" c:y="109"/>
1228        ownItemBlock.qtyEntry = 0.00        <entry block="ownItemToUpdBlock" field="qtyEntry1" hidden=""
1229        ownItemBlock.unitPriceEntry = 0.00               c:width="10" c:x="22" c:y="109"/>
1230        ownItemBlock.priceEntry = "0"        <entry block="ownItemToUpdBlock" field="levelEntry" hidden=""
1231        ownItemBlock.taxAmountEntry = 0               c:width="10" c:x="33" c:y="109"/>
1232        ownItemBlock.ivaEntry = 0        <entry block="ownItemToUpdBlock" field="productEntry" hidden=""
1233        ownItemBlock.discountEntry = 0.00               c:width="10" c:x="33" c:y="109"/>
1234        ownItemBlock.bonusEntry = 0.00        <entry block="ownItemToUpdBlock" field="storehouseEntry" hidden=""
1235        ownItemBlock.itemTotalEntry = 0.00               c:width="10" c:x="33" c:y="109"/>
1236          <entry block="ownItemToUpdBlock" field="hiwaterEntry" hidden=""
1237        callTrigger('totalCalcTrigger')               c:width="10" c:x="33" c:y="109"/>
1238      </trigger>        <entry block="ownItemToUpdBlock" field="lowaterEntry" hidden=""
1239                 c:width="10" c:x="33" c:y="109"/>
1240      <trigger name="prodSearchTrigger" type="NAMED">        <entry block="ownItemToUpdBlock" field="tableEntry" hidden=""
1241      #armado de la lista de recorrido del arbol               c:width="10" c:x="33" c:y="109"/>
1242      if tmpValuesDataSource.priceTypeId:        <entry block="creditLimit1Block" field="entityEntry" hidden=""
1243        search_id = str(tmpValuesDataSource.priceTypeId)               c:width="10" c:x="11" c:y="109"/>
1244        priceListsChain=[]        <entry block="creditLimit1Block" field="movementTypeEntry1" hidden=""
1245        while search_id != "" :               c:width="10" c:x="1" c:y="109"/>
1246            priceTypeBlock.initQuery()        <entry block="creditLimit1Block" field="creditLimitAmountEntry"
1247            priceTypeBlock.priceTypeId = search_id                                       hidden="" c:width="10" c:x="1" c:y="109"/>
1248            priceTypeBlock.processQuery()        <entry block="creditLimit1Block" field="balanceEntry" hidden=""
1249            search_id = str(priceTypeBlock.priceTypeParentId)               c:width="10" c:x="22" c:y="109"/>
1250            priceListsChain.append("%s" % priceTypeBlock.priceTypeId)        <entry block="creditLimit1Block" field="timeStampEntry" hidden=""
1251        tmpProdResultBlock.processRollback()               c:width="10" c:x="33" c:y="109"/>
1252        tmpProdResultBlock.initQuery()        <box name="payBox" c:height="4" label="Cobro de la factura" c:width="82"
1253        tmpProdResultBlock.prodNameEntry = ("%s" % ownItemBlock.prodNameSEntry)+"%"             c:x="0" c:y="23"/>
1254        tmpProdResultBlock.prodCodeEntry = ("%s" % ownItemBlock.prodCodeSEntry)+"%"        <label text="Efectivo : " c:x="2" c:y="25"/>
1255        tmpProdResultBlock.prodCodeTypeEntry = "1" # Ver como elegimos el código adecuado        <entry block="payBlock" field="cashEntry" c:width="12" c:x="12" c:y="25"/>
1256        tmpProdResultBlock.processQuery()        <label text="Cta. Cte. : " c:x="25" c:y="25"/>
1257        # cargar la parte visible de modificacion de precios        <entry block="payBlock" field="ctaCteEntry" c:width="12" c:x="37"
1258        tmpProdResultBlock.firstRecord()               c:y="25"/>
1259        product_id_anterior = None        <button name="rollbackBtn" c:height="1" label="Deshacer" c:width="14"
1260        prodResultBlock.processRollback()                c:x="66" c:y="25">
1261        for index in range(tmpProdResultBlock.getRecordCount()):          <trigger src="rollbackTrigger" type="On-Action"/>
1262            product_id=("%s" %tmpProdResultBlock.prodIdEntry)        </button>
1263            if product_id != product_id_anterior:        <button name="printButton" c:height="1" label="Imprimir" c:width="14"
1264                for pricetype in priceListsChain:                c:x="51" c:y="25">
1265                    if pricetype == ("%s" %tmpProdResultBlock.prodPriceTypeIdEntry):                    <trigger src="printTrigger" type="On-Action"/>
1266                        if len(str(prodResultBlock.prodNameEntry)):        </button>
1267                          prodResultBlock.newRecord()      </page>
1268                        prodResultBlock.prodNameEntry= ("%s" %tmpProdResultBlock.prodNameEntry)    </layout>
                       prodResultBlock.prodCodeEntry= ("%s" %tmpProdResultBlock.prodCodeEntry)  
                       prodResultBlock.prodPriceTypeEntry=  ("%s" %tmpProdResultBlock.prodPriceTypeEntry)  
                       prodResultBlock.prodUnitPriceEntry= ("%s" %tmpProdResultBlock.prodUnitPriceEntry)  
                       prodResultBlock.prodPriceEntry = ("%s" %tmpProdResultBlock.prodPriceEntry)  
                       prodResultBlock.prodPricePreviousEntry= ("%s" %tmpProdResultBlock.prodUnitPriceEntry)  
                       prodResultBlock.prodProductIdEntry= ("%s" %tmpProdResultBlock.prodIdEntry)  
                       prodResultBlock.prodPriceListIdEntry= ("%s" %tmpProdResultBlock.prodPriceTypeIdEntry)  
                       prodResultBlock.prodIVATaxEntry= ("%s" %tmpProdResultBlock.prodIVATaxEntry)  
                       product_id_anterior=product_id  
                       break  
           tmpProdResultBlock.nextRecord()  
       prodResultBlock.jumpRecord(0)  
       recordCount = prodResultBlock.getRecordCount()  
       if recordCount > 1:  
         def callback (returnValue):  
           global block  
           if returnValue >= 0:  
             prodResultBlock.jumpRecord(returnValue)  
             callTrigger('prodInsertTrigger')  
               
         runForm ('productSelect.gfd', {'data': prodResultBlock, 'callback': callback})  
       elif recordCount == 1:  
         prodResultBlock.jumpRecord(0)  
         if not prodResultBlock.isEmpty():  
           callTrigger('prodInsertTrigger')  
     else:  
       genericBox("Debe elegir un cliente para poder cargar productos",["Ok"])  
   </trigger>  
   
   <!--   En este bloque se almacena el reultado final/real de la búsqueda para seleccion el correcto -->  
   <block name="prodResultBlock" datasource="prodResultDataSource" restrictInsert="" transparentBlock="">  
     <entry name="prodCodeEntry" width="10" x="37" y="10" rows="2" hidden=""/>  
     <entry name="prodNameEntry" width="22" x="47" y="10" rows="2" hidden=""/>  
     <entry name="prodPriceTypeEntry"  x="1 " y="1" width="10" rows="8" hidden=""/>  
     <entry name="prodUnitPriceEntry"  x="1" y="1" width="10" rows="8" hidden=""/>  
     <entry name="prodPriceEntry" x="1" y="1" width="20" rows="2" hidden=""/>  
     <entry name="prodPricePreviousEntry"  x="1" y="1" width="10" rows="8" hidden=""/>  
     <entry name="prodProductIdEntry"  x="1" y="1" width="5" rows="8" hidden=""/>  
     <entry name="prodPriceListIdEntry"  x="1" y="1" width="5" rows="8" hidden=""/>  
     <entry name="prodIVATaxEntry"  x="1" y="1" width="5" rows="8" hidden=""/>  
   </block>  
   <!--   Insertar el producto seleccionado -->  
   <trigger name="prodInsertTrigger" type="NAMED">  
     import hack  
   
     ownItemBlock.prodCodeSEntry = str(prodResultBlock.prodCodeEntry)  
     ownItemBlock.prodNameSEntry = str(prodResultBlock.prodNameEntry)  
     ownItemBlock.priceEntry = str(prodResultBlock.prodPriceEntry)  
       
     lItemPrice = hack.a2f(prodResultBlock.prodUnitPriceEntry)*hack.a2f(ownItemBlock.qtyEntry)  
     ownItemBlock.taxAmountEntry = (hack.a2f(prodResultBlock.prodIVATaxEntry)/100) * lItemPrice  
     ownItemBlock.ivaEntry = hack.a2f(prodResultBlock.prodIVATaxEntry)  
     ownItemBlock.unitPriceEntry = str(prodResultBlock.prodUnitPriceEntry)  
                                     
     callTrigger('totalCalcTrigger')  
   </trigger>  
   <!--     ****** Fin búsqueda ************ -->  
   
     <!-- Productos facturados -->  
   <block datasource="ownItemDataSource" name="ownItemBlock">  
 <!--     <trigger name="ownItemFocusOut" type="PRE-FOCUSOUT" src="totalCalcTrigger" /> -->  
     <label text="Productos a facturar" x="1" y="9"/>  
     <label text="Código" x="1" y="10"/>  
     <entry name="prodCodeSEntry" width="14" x="1" y="11" rows="10">  
         <options>  
           <option name="tip" value="Insertar el código"/>  
         </options>  
     </entry>  
     <label text="Nombre" x="15" y="10"/>  
     <entry name="prodNameSEntry" width="20" x="15" y="11" rows="10">  
         <options>  
           <option name="tip" value="Insertar el nombre o descripción del producto"/>  
         </options>  
     </entry>  
     <button name="prodSearchButton" trigger="prodSearchTrigger" label="Buscar" width="7" height="10" x="35" y="11"/>  
   
     <entry field="own_item.own_document" name="ownDocumentEntry" hidden="" x="1" y="1"/>    
   
     <label name="qtyLbl" text="Cantidad" x="42" y="10"/>  
     <!-- mdione's bookmark -->  
     <entry field="own_product_item.qty" name="qtyEntry" rows="10" typecast="number" displaymask="%0.3f" width="12" x="42" y="11">  
     <trigger name="qtyEntryPreFocusout" type="PRE-FOCUSOUT" src="totalCalcTrigger" />  
     </entry>  
   
         <label name="priceLbl" text="Precio" x="55" y="10"/>  
         <entry x="55" y="11" name="unitPriceEntry" field="own_product_item.unit_price" width="10" rows="10" typecast="number" displaymask="%0.2f">  
           <trigger name="unitPriceEntryPreFocusout" type="PRE-FOCUSOUT" src="totalCalcTrigger" />  
         </entry>  
         <entry x="1" y="14" readonly="" field="own_product_item.price" name="priceEntry" width="10" rows="5" hidden=""/>  
         <entry x="1" y="14" readonly="" field="own_item_tax.tax" name="taxTypeEntry" width="10" rows="5" default="1" hidden="" typecast="number" displaymask="%0.2f"/>  
         <entry x="1" y="14" readonly="" field="own_item_tax.amount" name="taxAmountEntry" width="10" rows="5" hidden="" typecast="number" displaymask="%0.2f"/>  
   
   
         <label name="ivaLbl" text="IVA" x="66" y="10"/>  
         <entry name="ivaEntry" displaymask="%0.0f"  
           rows="10" width="3" x="66" y="11" default="0">  
           <trigger name="ivaEntryPreFocusout" type="PRE-FOCUSOUT" src="totalCalcTrigger" />  
         </entry>  
         <label name="discountLbl" text="Dto." x="70" y="10"/>  
         <entry field="own_item.discount" name="discountEntry" default="0.00" typecast="number" displaymask="%0.2f"  
           rows="10" width="6" x="69" y="11">  
           <trigger name="discountEntryPreFocusout" type="PRE-FOCUSOUT" src="totalCalcTrigger" />  
          </entry>  
 <!--         <label name="bonusLbl" text="Bonif." x="79" y="10"/> -->  
         <entry field="own_item.bonus" name="bonusEntry" style="label" default="0.00" typecast="number" displaymask="%0.2f"  
           rows="10" width="10" x="79" y="11" hidden=""/>  
         <label name="itemNetolLbl" text="Neto" x="76" y="10"/>  
         <entry name="itemNetoEntry" style="label" default="0.00" typecast="number" displaymask="%0.2f"  
           rows="10" width="10" x="76" y="11"/>  
         <label name="itemTotalLbl" text="Total" x="85" y="10"/>  
         <entry name="itemTotalEntry" style="label" default="0.00" typecast="number" displaymask="%0.2f"  
           rows="10" width="10" x="85" y="11">  
         </entry>  
         <button name="prodDeleteButton" trigger="prodDeleteTrigger" label="Borrar" width="7" height="10" x="95" y="11"/>  
         <scrollbar page="5" x="103" y="11" width="1" height="10"/>  
       </block>  
     <!--     Bloques que sirven para el pago -->      
     <block name="ownDocumentProceedingBlock" datasource="ownDocumentProceedingDataSource" transparentBlock="">  
         <entry name="proceedingEntry" field="proceeding" hidden="" x="1" y="1" width="12"/>      
         <entry name="ownDocumentEntry" field="own_document" hidden="" x="1" y="1" width="12"/>      
         <entry name="amountEntry" field="amount" hidden="" x="1" y="1" width="12"/>      
     </block>  
     <block name="currencyMovementBlock" datasource="currencyMovementDataSource" transparentBlock="">  
         <entry name="proceedingEntry" field="movement.proceeding" hidden="" x="1" y="1" width="12"/>      
         <entry name="movementTypeEntry" field="movement.movement_type" hidden="" x="1" y="1" width="12"/>      
         <entry name="amountEntry" field="movement.amount" hidden="" x="1" y="1" width="12"/>      
         <entry name="currencyTypeEntry" field="currency_movement.currency_type" hidden="" x="1" y="1" width="12"/>      
     </block>  
     <!--     Datasource que sirve para almacenar el resultado de la búsqueda -->  
       <block datasource="tmpValuesDataSource" name="totalBlock" restrictInsert="">  
         <label text="Neto " x="55" y="21"/>  
         <entry name="netoEntry" style="label" readonly="" x="55" y="22" width="12" typecast="number" displaymask="%0.2f"  
           default="0.00"/>  
         <label text="IVA " x="66" y="21"/>  
         <entry name="ivaEntry" style="label" readonly="" x="66" y="22" width="12" typecast="number" displaymask="%0.2f"  
           default="0.00"/>  
         <label text="Total " x="82" y="21"/>  
         <entry name="totalEntry" style="label" readonly="" x="82" y="22" width="12" typecast="number" displaymask="%0.2f"  
           default="0.00"/>  
       </block>  
       <block datasource="ownItemToUpdDataSource" name="ownItemToUpdBlock">  
         <entry name="ownDocumentEntry" field="own_item.own_document" hidden="" x="1" y="109" width="10"/>      
         <entry name="prodIdEntry" field="_price_data.product" hidden="" x="11" y="109" width="10"/>          
         <entry name="qtyEntry" field="own_product_item.qty" hidden="" x="22" y="109" width="10"/>          
         <entry name="levelEntry" field="_product_store_data.level" hidden="" x="33" y="109" width="10"/>      
         <entry name="productEntry" field="_product_store_data.product" hidden="" x="33" y="109" width="10"/>      
         <entry name="storehouseEntry" field="_product_store_data.storehouse" hidden="" x="33" y="109" width="10"/>      
         <entry name="hiwaterEntry" field="_product_store_data.hiwater" hidden="" x="33" y="109" width="10"/>      
         <entry name="lowaterEntry" field="_product_store_data.lowater" hidden="" x="33" y="109" width="10"/>      
         <entry name="tableEntry" field="_product_store_data._table" hidden="" x="33" y="109" width="10"/>      
       </block>  
       <block datasource="creditLimit1DataSource" name="creditLimit1Block">  
         <entry name="entityEntry" field="_credit_limit_data.entity" hidden="" x="11" y="109" width="10"/>          
         <entry name="movementTypeEntry" field="_credit_limit_data.movement_type" hidden="" x="1" y="109" width="10"/>      
         <entry name="creditLimitAmountEntry" field="_credit_limit_data.credit_limit" hidden="" x="1" y="109" width="10"/>      
         <entry name="balanceEntry" field="_credit_limit_data.balance" hidden="" x="22" y="109" width="10"/>          
         <entry name="timeStampEntry" field="_credit_limit_data.time_stamp" hidden="" x="33" y="109" width="10"/>      
       </block>  
 <!--     </box> -->  
     <box height="4" label="Cobro de la factura" name="payBox"  
       width="82" x="0" y="23">  
       <block datasource="payDataSource" name="payBlock">  
       <label text="Efectivo : " x="1" y="1"/>  
       <entry name="cashEntry" typecast="number" displaymask="%0.2f" default="0.00"  
         x="11" y="1" width="12">      
         <trigger name="cashEntryPreFocusout" type="Pre-Focusout">  
            import hack  
            payBlock.ctaCteEntry = str(hack.a2f(totalBlock.totalEntry) - hack.a2f(payBlock.cashEntry))  
         </trigger>  
       </entry>  
       <label text="Cta. Cte. : " x="24" y="1"/>  
       <entry name="ctaCteEntry" typecast="number" displaymask="%0.2f" default="0.00"  
         x="36" y="1" width="12">      
         <trigger name="ctaCteEntryPreFocusOut" type="Pre-Focusout">  
            import hack  
            payBlock.cashEntry = str(hack.a2f(totalBlock.totalEntry) - hack.a2f(payBlock.ctaCteEntry))  
         </trigger>  
       </entry>  
         <button x="65" y="1" trigger="rollbackTrigger" width="14" label="Cancelar"  
           name="rollbackBtn" height="1"/>  
         <button name="printButton" label="Imprimir" trigger="printTrigger"  
           x="50" y="1" width="14" height="1"/>  
   
       </block>  
     </box>  
   <block name="ownBranchBlock" datasource="ownBranchDataSource">  
     <entry name="condIVAEntry" field="_tax_profile_data.tax" hidden="" x="1" y="1" width="10"/>              
   </block>  
   </page>  
1269  </form>  </form>

Legend:
Removed from v.1.44  
changed lines
  Added in v.1.44.2.1

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26