/[papo]/papo/report/productInvoice.grd
ViewVC logotype

Diff of /papo/report/productInvoice.grd

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

revision 1.5 by styxman, Sat Dec 7 06:22:45 2002 UTC revision 1.6 by apronotti, Wed Dec 18 19:40:45 2002 UTC
# Line 6  Line 6 
6    <sortoptions/>    <sortoptions/>
7        
8    <sources>    <sources>
9      <datasource database="papo" name="invoiceDataSource"      <datasource name="productInvoicesDataSource" database="papo"
10        table="own_document, own_item, own_product_item, price, product">        table="own_document, _entity_data, _alien_entity_data, _persona_data, _client_data">
11          <!-- WARNING: before you see these conditions, please be calm -->
12        <condition>        <condition>
13          <and>          <and>
14            <eq>            <!-- only service invoices -->
15              <cfield name="own_document.id"/>            <eq>
16              <cfield name="own_item.id"/>              <cfield name="own_document.id"/>
17            </eq>              <cparam name="id"/>
18            <eq>            </eq>
19              <cfield name="own_item.id"/>            <eq>
20              <cfield name="own_product_item.own_item"/>              <cfield name="own_document_type"/>
21            </eq>              <cconst value="4"/>
22            <eq>            </eq>
23              <cfield name="own_product_item.price"/>            
24              <cfield name="price.id"/>            <!-- 'real' join -->
25            </eq>            <eq>
26            <eq>              <cfield name="own_document.recipient"/>
27              <cfield name="price.product"/>              <cfield name="_entity_data.id"/>
28              <cfield name="product.id"/>            </eq>
29            </eq>            <eq>
30          </and>              <cfield name="_entity_data._table"/>
31                <cfield name="_alien_entity_data.entity"/>
32              </eq>
33              <eq>
34                <cfield name="_alien_entity_data._table"/>
35                <cfield name="_persona_data.alien_entity"/>
36              </eq>
37              <eq>
38                <cfield name="_persona_data._table"/>
39                <cfield name="_client_data.persona"/>
40              </eq>
41              <!-- the following conditions try to locate the client data in the time the invoice was issued -->
42              <!-- it resumes to: -->
43              <!-- ( own_document.date IS BETWEEN [*._start_t AND *._ent_t] ) OR -->
44              <!-- ( own_document.date >= *._start_t AND *._end_t IS NULL ) -->
45              <or>
46                <!-- find the client state in that time -->
47                <between>
48                  <cfield name="own_document.date"/>
49                  <cfield name="_entity_data._start_t"/>
50                  <cfield name="_entity_data._end_t"/>
51                </between>
52                <!-- or is it the current one? -->
53                <and>
54                  <ge>
55                    <cfield name="own_document.date"/>
56                    <cfield name="_entity_data._start_t"/>
57                  </ge>
58                  <null>
59                    <cfield name="_entity_data._end_t"/>
60                  </null>
61                </and>
62              </or>
63              <or>
64                <!-- find the client state in that time -->
65                <between>
66                  <cfield name="own_document.date"/>
67                  <cfield name="_alien_entity_data._start_t"/>
68                  <cfield name="_alien_entity_data._end_t"/>
69                </between>
70                <!-- or is it the current one? -->
71                <and>
72                  <ge>
73                    <cfield name="own_document.date"/>
74                    <cfield name="_alien_entity_data._start_t"/>
75                  </ge>
76                  <null>
77                    <cfield name="_alien_entity_data._end_t"/>
78                  </null>
79                </and>
80              </or>
81              <or>
82                <!-- find the client state in that time -->
83                <between>
84                  <cfield name="own_document.date"/>
85                  <cfield name="_persona_data._start_t"/>
86                  <cfield name="_persona_data._end_t"/>
87                </between>
88                <!-- or is it the current one? -->
89                <and>
90                  <ge>
91                    <cfield name="own_document.date"/>
92                    <cfield name="_persona_data._start_t"/>
93                  </ge>
94                  <null>
95                    <cfield name="_persona_data._end_t"/>
96                  </null>
97                </and>
98              </or>
99              <or>
100                <!-- find the client state in that time -->
101                <between>
102                  <cfield name="own_document.date"/>
103                  <cfield name="_client_data._start_t"/>
104                  <cfield name="_client_data._end_t"/>
105                </between>
106                <!-- or is it the current one? -->
107                <and>
108                  <ge>
109                    <cfield name="own_document.date"/>
110                    <cfield name="_client_data._start_t"/>
111                  </ge>
112                  <null>
113                    <cfield name="_client_data._end_t"/>
114                  </null>
115                </and>
116              </or>
117            </and>
118          </condition>
119        </datasource>
120    
121        <datasource name="invoiceItemsDataSource" database="papo" table="own_document, own_item, own_product_item, own_item_tax,
122                                                                         _price_data, _product_data"
123          master="productInvoicesDataSource" masterlink="own_document.id" detaillink="own_item.own_document">
124          <condition>
125            <and>
126              <eq>
127                <cfield name="own_document.id"/>
128                <cparam name="id"/>
129              </eq>
130              <eq>
131                <cfield name="own_item.id"/>
132                <cfield name="own_product_item.own_item"/>
133              </eq>
134              <eq>
135                <cfield name="own_item.id"/>
136                <cfield name="own_item_tax.own_item"/>
137              </eq>
138              <eq>
139                <cfield name="_price_data.id"/>
140                <cfield name="own_product_item.price"/>
141              </eq>
142              <eq>
143                <cfield name="_product_data._table"/>
144                <cfield name="_price_data.product"/>
145              </eq>
146              <or>
147                <!-- find the client state in that time -->
148                <between>
149                  <cfield name="own_document.date"/>
150                  <cfield name="_product_data._start_t"/>
151                  <cfield name="_product_data._end_t"/>
152                </between>
153                <!-- or is it the current one? -->
154                  <and>
155                  <ge>
156                    <cfield name="own_document.date"/>
157                    <cfield name="_product_data._start_t"/>
158                  </ge>
159                  <null>
160                    <cfield name="_product_data._end_t"/>
161                  </null>
162                </and>
163              </or>
164            </and>
165        </condition>        </condition>
166      </datasource>      </datasource>
167    </sources>    </sources>
# Line 36  Line 171 
171        <out:section break="page">        <out:section break="page">
172          <out:table width="100%">          <out:table width="100%">
173    
174            <section name="cabeceras" source="invoiceDataSource">            <section name="cabeceras" source="productInvoicesDataSource">
175              <out:row>              <out:row>
176                <out:col align="center"><field name="own_document.date" section="cabeceras"/></out:col>                <out:col align="center"><field name="own_document.date" section="cabeceras"/></out:col>
177                <out:col><field name="_entity_data.name" section="cabeceras"/></out:col>                <out:col><field name="_entity_data.name" section="cabeceras"/></out:col>
# Line 44  Line 179 
179                <out:col align="right"></out:col>                <out:col align="right"></out:col>
180              </out:row>              </out:row>
181                            
182              <section name="detalles">              <section name="detalles" source="invoiceItemsDataSource">
183                <out:row>                <out:row>
184                  <out:col><field name="own_product_item.qty"/></out:col>                  <out:col><field name="own_product_item.qty"/></out:col>
185                  <out:col><field name="product.name"/></out:col>                  <out:col><field name="_product_data.canonical_name"/></out:col>
186                  <out:col><field name="price.unit_price"/></out:col>                  <out:col><field name="_price_data.unit_price"/></out:col>
187                  <out:col><!--field name="ownproditem.qty*price.unit_price"/--></out:col>                  <out:col><!--field name="ownproditem.qty*price.unit_price"/--></out:col>
188                  <out:col><!--field name="own_item_tax.amount"/--></out:col>                  <out:col><!--field name="own_item_tax.amount"/--></out:col>
189                  <out:col><field name="round (own_product_item.amount*ownproditem.qty*(1+own_item_tax.amount/100), 2)"/></out:col>                  <out:col><field name="round (_price_data.unit_price*own_product_item.qty+own_item_tax.amount, 2)"/></out:col>
190                </out:row>                </out:row>
191              </section>              </section>
192    
# Line 60  Line 195 
195                <out:col align="right"></out:col>                <out:col align="right"></out:col>
196                <out:col align="right"></out:col>                <out:col align="right"></out:col>
197                <!-- do _not_ 'fix' this veeeery long line -->                <!-- do _not_ 'fix' this veeeery long line -->
198                <out:col align="right"><summ function="sum" section="detalles" field="round (own_product_item.amount*ownproditem.qty*(1+own_item_tax.amount/100), 2)"/></out:col>                <out:col align="right"><summ function="sum"
199                  section="detalles" field="round (_price_data.unit_price * own_product_item.qty + own_item_tax.amount, 2)"/></out:col>
200              </out:row>              </out:row>
201            </section>            </section>
202          </out:table>          </out:table>
# Line 68  Line 204 
204      </out:report>      </out:report>
205    </layout>    </layout>
206  </report>  </report>
207    

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.6

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