1 |
<?xml version="1.0"?> |
<?xml version="1.0"?> |
2 |
<report> |
<report> |
3 |
<parameters/> |
<parameters> |
4 |
|
<parameter name="id" description="nothing"/> |
5 |
|
</parameters> |
6 |
<sortoptions/> |
<sortoptions/> |
7 |
|
|
8 |
<sources> |
<sources> |
9 |
<datasource database="papo" name="ownDocumentDataSource" table="owndocument"/> |
<datasource name="serviceInvoicesDataSource" database="papo" |
10 |
<datasource database="papo" detaillink="own_document" |
table="own_document, _entity_data, _alien_entity_data, _persona_data, _client_data"> |
11 |
master="ownDocumentDataSource" masterlink="id" name="ownItemDataSource" |
<!-- WARNING: before you see these conditions, please be calm --> |
12 |
table="ownservitemvw"/> |
<condition> |
13 |
|
<and> |
14 |
|
<!-- only service invoices --> |
15 |
|
<eq> |
16 |
|
<cfield name="own_document.id"/> |
17 |
|
<cparam name="id"/> |
18 |
|
</eq> |
19 |
|
<eq> |
20 |
|
<cfield name="own_document_type"/> |
21 |
|
<cconst value="1"/> |
22 |
|
</eq> |
23 |
|
|
24 |
|
<!-- 'real' join --> |
25 |
|
<eq> |
26 |
|
<cfield name="own_document.recipient"/> |
27 |
|
<cfield name="_entity_data.id"/> |
28 |
|
</eq> |
29 |
|
<eq> |
30 |
|
<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_item, own_service_item, own_item_tax" |
122 |
|
master="serviceInvoicesDataSource" masterlink="own_document.id" detaillink="own_item.own_document"> |
123 |
|
<condition> |
124 |
|
<and> |
125 |
|
<eq> |
126 |
|
<cfield name="own_item.id"/> |
127 |
|
<cfield name="own_service_item.own_item"/> |
128 |
|
</eq> |
129 |
|
<eq> |
130 |
|
<cfield name="own_item.id"/> |
131 |
|
<cfield name="own_item_tax.own_item"/> |
132 |
|
</eq> |
133 |
|
</and> |
134 |
|
</condition> |
135 |
|
</datasource> |
136 |
</sources> |
</sources> |
137 |
|
|
138 |
|
|
139 |
|
|
140 |
<layout xmlns:out="GNUe:Reports:SimpleTabulation"> |
<layout xmlns:out="GNUe:Reports:SimpleTabulation"> |
141 |
<out:report> |
<out:report> |
142 |
<out:reportTitle>Facturas</out:reportTitle> |
<out:reportTitle>Facturas</out:reportTitle> |
143 |
<out:section break="page"> |
<out:section break="page"> |
144 |
<out:table width="100%"> |
<out:table width="100%"> |
145 |
<out:tablehead> |
<out:tablehead> |
146 |
<out:colhead width="50">Numero</out:colhead> |
<out:colhead width="20">Numero</out:colhead> |
147 |
<out:colhead width="50">Fecha</out:colhead> |
<out:colhead width="30">Fecha</out:colhead> |
148 |
<out:colhead width="50">Bonificacion</out:colhead> |
<out:colhead width="40">Cliente</out:colhead> |
149 |
</out:tablehead> |
<out:colhead width="10"/> |
150 |
<section name="cabeceras" source="ownDocumentDataSource"> |
</out:tablehead> |
151 |
<out:row> |
<section name="cabeceras" source="serviceInvoicesDataSource"> |
152 |
<out:col><field name="number" section="cabeceras"/></out:col> |
<out:row> |
153 |
<out:col><field name="date" section="cabeceras"/></out:col> |
<out:col><field name="own_document.number" section="cabeceras"/></out:col> |
154 |
<out:col><field name="bonus" section="cabeceras"/></out:col> |
<out:col align="center"><field name="own_document.date" section="cabeceras"/></out:col> |
155 |
</out:row> |
<out:col><field name="_entity_data.name" section="cabeceras"/></out:col> |
156 |
<section name="detalles" source="ownItemDataSource"> |
</out:row> |
157 |
<out:row> |
<out:row> |
158 |
<out:col/> |
<out:col align="left">Servicio</out:col> |
159 |
<out:col align="center"><field name="description" section="detalles"/></out:col> |
<out:col align="right">Precio</out:col> |
160 |
<out:col align="right"><field name="amount" section="detalles"/></out:col> |
<out:col align="right">IVA</out:col> |
161 |
</out:row> |
<out:col align="right">Precio Final</out:col> |
162 |
</section> |
</out:row> |
163 |
<out:row type="subtotal" level="1"> |
<section name="detalles" source="invoiceItemsDataSource"> |
164 |
<out:col/> |
<out:row> |
165 |
<out:col align="center">Total: </out:col> |
<out:col align="left"><field name="own_service_item.description" section="detalles"/></out:col> |
166 |
<out:col align="right"> |
<out:col align="right"><field name="own_service_item.amount" section="detalles"/></out:col> |
167 |
<summ function="sum" section="detalles" field="amount"/></out:col> |
<out:col align="right"><field name="own_item_tax.amount" section="detalles"/>%</out:col> |
168 |
</out:row> |
<out:col align="right"><field name="round (own_service_item.amount*(1+own_item_tax.amount/100), 2)" |
169 |
<out:row/> |
section="detalles"/></out:col> |
170 |
</section> |
</out:row> |
171 |
</out:table> |
</section> |
172 |
|
<out:row type="subtotal" level="2"> |
173 |
|
<out:col/> |
174 |
|
<out:col/> |
175 |
|
<out:col align="center">Total:</out:col> |
176 |
|
<out:col align="right"> |
177 |
|
<summ function="sum" section="detalles" field="round (own_service_item.amount*(1+own_item_tax.amount/100), 2)"/> |
178 |
|
</out:col> |
179 |
|
</out:row> |
180 |
|
</section> |
181 |
|
</out:table> |
182 |
</out:section> |
</out:section> |
183 |
|
<out:row type="subtotal" level="1"> |
184 |
|
<out:col/> |
185 |
|
<out:col/> |
186 |
|
<out:col align="center">Total:</out:col> |
187 |
|
<out:col align="right"><!--summ function="sum" section="cabeceras" field="own_service_item.amount"/--></out:col> |
188 |
|
</out:row> |
189 |
</out:report> |
</out:report> |
190 |
</layout> |
</layout> |
191 |
</report> |
</report> |