1 |
<?xml version="1.0" encoding="ISO-8859-1"?> |
<?xml version="1.0" encoding="ISO-8859-1"?> |
2 |
<!DOCTYPE form SYSTEM "gnue-forms.dtd"> |
<!DOCTYPE form SYSTEM "gnue-forms.dtd"> |
3 |
|
|
4 |
<form width="30" height="4" title="Listado I.V.A. Compras"> |
<form width="30" height="7" title="Listado I.V.A. Compras"> |
5 |
|
|
6 |
|
<datasource name="printDataSource" cache="1"/> |
7 |
<datasource name="providerSearchDataSource" database="papo" |
<datasource name="providerSearchDataSource" database="papo" |
8 |
table="entity, _entity_data, alien_entity, _alien_entity_data, persona, |
table="entity, _entity_data, alien_entity, _alien_entity_data, persona, |
9 |
_persona_data, provider, _provider_data, entity_type_uid_conf, |
_persona_data, provider, _provider_data, entity_type_uid_conf, |
125 |
order_by="date" /> |
order_by="date" /> |
126 |
|
|
127 |
<trigger name="printTrigger" type="NAMED"><![CDATA[ |
<trigger name="printTrigger" type="NAMED"><![CDATA[ |
128 |
|
|
129 |
|
if not str(printBlock.printBox.startDateEntry).strip() \ |
130 |
|
or not str(printBlock.printBox.startDateEntry).strip(): |
131 |
|
genericBox("Las fechas deben tener un valor",['Aceptar']) |
132 |
|
else: |
133 |
|
import gnue.common.GConditions as GConditions |
134 |
|
import string |
135 |
|
import hack |
136 |
|
|
137 |
|
callTrigger('startWaitingModeTrigger') |
138 |
|
|
139 |
|
table = [] |
140 |
|
line="\n\nListado de IVA Compras\n\n\n" |
141 |
|
table.append(line) |
142 |
|
line = "|"+"Factura".center(16)+"|"+"Fecha".center(27)+"|"+"Neto".center(14)+"|"+"I.V.A.".center(12)+" | "+"Total".center(14)+"\n" |
143 |
|
table.append(line) |
144 |
|
|
145 |
|
condProductInvoice = GConditions.GCondition() |
146 |
|
tmpAnd = GConditions.GCand(condProductInvoice) |
147 |
|
ge = GConditions.GCge(tmpAnd) |
148 |
|
GConditions.GCField(ge,"alien_document.date") |
149 |
|
GConditions.GCConst(ge,str(printBlock.printBox.startDateEntry)) |
150 |
|
le = GConditions.GCle(tmpAnd) |
151 |
|
GConditions.GCField(le,"alien_document.date") |
152 |
|
GConditions.GCConst(le,str(printBlock.printBox.endDateEntry)) |
153 |
|
|
154 |
|
productInvoiceResultSet = productInvoiceDataSource.createResultSet(condProductInvoice) |
155 |
|
more = productInvoiceResultSet.firstRecord() |
156 |
|
|
157 |
|
totalNeto = 0 |
158 |
|
totalIVA = 0 |
159 |
|
|
160 |
|
while more: |
161 |
|
invoiceTotal = 0 |
162 |
|
itemTaxTotal = 0 |
163 |
|
currAlienDoc = productInvoiceResultSet.current.getField("alien_document.id") |
164 |
|
line = "|"+string.ljust(str(productInvoiceResultSet.current.getField("alien_document.number")).strip(),16) |
165 |
|
line += "|" + string.ljust(str(productInvoiceResultSet.current.getField("alien_document.date")).strip(),27) |
166 |
|
while productInvoiceResultSet.current.getField("alien_document.id") == currAlienDoc and more: |
167 |
|
lQty = hack.a2f(productInvoiceResultSet.current.getField("alien_product_item.qty")) |
168 |
|
lUnitPrice = hack.a2f(productInvoiceResultSet.current.getField("alien_product_item.unit_price")) |
169 |
|
lBonus = hack.a2f(productInvoiceResultSet.current.getField("alien_item.bonus")) |
170 |
|
lDiscount = hack.a2f(productInvoiceResultSet.current.getField("alien_item.discount")) |
171 |
|
item = lQty * lUnitPrice - lBonus - lDiscount |
172 |
|
currItem = productInvoiceResultSet.current.getField("alien_item.id") |
173 |
|
while productInvoiceResultSet.current.getField("alien_item.id") == currItem and more: |
174 |
|
itemTaxTotal += hack.a2f(productInvoiceResultSet.current.getField("alien_item_tax.amount")) |
175 |
|
more = productInvoiceResultSet.nextRecord() |
176 |
|
invoiceTotal += item |
177 |
|
odt_rs = invTaxTotDataSource.createResultSet({"alien_document.id":currAlienDoc}) |
178 |
|
odt_more = odt_rs.firstRecord() |
179 |
|
while odt_more: |
180 |
|
invoiceTotal += hack.a2f(odt_rs.current.getField("alien_document_tax.amount")) |
181 |
|
odt_more = odt_rs.nextRecord() |
182 |
|
|
183 |
|
line += "|" + string.rjust("%0.2f".strip() % hack.a2f(invoiceTotal),14) |
184 |
|
line += "|" + string.rjust("%0.2f".strip() % hack.a2f(itemTaxTotal),12) |
185 |
|
line += "|" + string.rjust("%0.2f".strip() % hack.a2f(itemTaxTotal + invoiceTotal),14) |
186 |
|
totalIVA += itemTaxTotal |
187 |
|
totalNeto += invoiceTotal |
188 |
|
table.append(line) |
189 |
|
|
190 |
import gnue.common.GConditions as GConditions |
callTrigger('endWaitingModeTrigger') |
191 |
import string |
|
192 |
import hack |
line = "\n"+"Total".center(46) + string.rjust("%0.2f".strip() % hack.a2f(totalNeto),14) + "|" |
193 |
|
line += string.rjust("%0.2f".strip() % hack.a2f(totalIVA),12) + "|" + string.rjust("%0.2f".strip() % hack.a2f(totalIVA + totalNeto),14) |
194 |
callTrigger('startWaitingModeTrigger') |
table.append(line) |
195 |
|
|
196 |
table = [] |
hack.previewPrint(table) |
|
line="\n\nListado de IVA Compras\n\n\n" |
|
|
table.append(line) |
|
|
line = "Factura".center(10)+" | "+"Fecha".center(30)+" | "+"Neto".center(10)+" | "+"I.V.A.".center(10)+" | "+"Total".center(10)+"\n" |
|
|
table.append(line) |
|
|
|
|
|
condProductInvoice = GConditions.GCondition() |
|
|
|
|
|
productInvoiceResultSet = productInvoiceDataSource.createResultSet(condProductInvoice) |
|
|
more = productInvoiceResultSet.firstRecord() |
|
|
|
|
|
totalNeto = 0 |
|
|
totalIVA = 0 |
|
|
|
|
|
while more: |
|
|
invoiceTotal = 0 |
|
|
itemTaxTotal = 0 |
|
|
currAlienDoc = productInvoiceResultSet.current.getField("alien_document.id") |
|
|
line = string.ljust(str(productInvoiceResultSet.current.getField("alien_document.number")),10) |
|
|
line += "|" + string.ljust(str(productInvoiceResultSet.current.getField("alien_document.date")),10) |
|
|
while productInvoiceResultSet.current.getField("alien_document.id") == currAlienDoc and more: |
|
|
lQty = hack.a2f(productInvoiceResultSet.current.getField("alien_product_item.qty")) |
|
|
lUnitPrice = hack.a2f(productInvoiceResultSet.current.getField("alien_product_item.unit_price")) |
|
|
lBonus = hack.a2f(productInvoiceResultSet.current.getField("alien_item.bonus")) |
|
|
lDiscount = hack.a2f(productInvoiceResultSet.current.getField("alien_item.discount")) |
|
|
item = lQty * lUnitPrice - lBonus - lDiscount |
|
|
currItem = productInvoiceResultSet.current.getField("alien_item.id") |
|
|
while productInvoiceResultSet.current.getField("alien_item.id") == currItem and more: |
|
|
itemTaxTotal += hack.a2f(productInvoiceResultSet.current.getField("alien_item_tax.amount")) |
|
|
more = productInvoiceResultSet.nextRecord() |
|
|
invoiceTotal += item |
|
|
odt_rs = invTaxTotDataSource.createResultSet({"alien_document.id":currAlienDoc}) |
|
|
odt_more = odt_rs.firstRecord() |
|
|
while odt_more: |
|
|
invoiceTotal += hack.a2f(odt_rs.current.getField("alien_document_tax.amount")) |
|
|
odt_more = odt_rs.nextRecord() |
|
|
|
|
|
line += "|" + string.rjust(str(invoiceTotal),10) |
|
|
line += "|" + string.rjust(str(itemTaxTotal),10) |
|
|
line += "|" + string.rjust(str(itemTaxTotal + invoiceTotal),10) |
|
|
totalIVA += itemTaxTotal |
|
|
totalNeto += invoiceTotal |
|
|
table.append(line) |
|
197 |
|
|
|
callTrigger('endWaitingModeTrigger') |
|
|
|
|
|
line = "Total".center(43) + string.rjust(str(totalNeto),10) + "|" |
|
|
line += string.rjust(str(totalIVA),10) + "|" + string.rjust(str(totalIVA + totalNeto),10) |
|
|
table.append(line) |
|
|
|
|
|
hack.previewPrint(table) |
|
|
|
|
198 |
]]></trigger> |
]]></trigger> |
199 |
|
|
200 |
<trigger name="startWaitingModeTrigger" type="NAMED"><![CDATA[ |
<trigger name="startWaitingModeTrigger" type="NAMED"><![CDATA[ |
224 |
|
|
225 |
<page name="Listado IVA Compras"> |
<page name="Listado IVA Compras"> |
226 |
|
|
227 |
<block datasource="alienDocumentDataSource" name="alienDocumentSearchBlock" restrictInsert=""> |
<block datasource="printDataSource" name="printBlock" restrictInsert=""> |
228 |
|
|
229 |
<box height="4" label="Listado de I.V.A. Compras" |
<box height="8" label="Listado de I.V.A. Compras" |
230 |
name="printBox" width="25" x="1" y="1"> |
name="printBox" width="25" x="1" y="1"> |
231 |
|
<label name="startDateLbl" text="Desde : " x="1" y="1"/> |
232 |
<button x="2" y="1" trigger="printTrigger" width="20" label="Imprimir" |
<entry name="startDateEntry" typecast="date" x="9" y="1" width="12"/> |
233 |
|
<label name="startDateLbl" text="Hasta : " x="1" y="2"/> |
234 |
|
<entry name="endDateEntry" typecast="date" x="9" y="2" width="12"/> |
235 |
|
<button x="2" y="4" trigger="printTrigger" width="20" label="Imprimir" |
236 |
name="printBotton" height="1"/> |
name="printBotton" height="1"/> |
237 |
|
|
238 |
</box> |
</box> |