6 |
</neb:Block> |
</neb:Block> |
7 |
<datasource name="printDataSource" cache="1"/> |
<datasource name="printDataSource" cache="1"/> |
8 |
|
|
9 |
<datasource name="invTaxTotDataSource" database="papo" |
<datasource name="invTaxTotDataSource" database="papo" |
10 |
table="alien_document, alien_document_tax"> |
table="alien_document, alien_document_tax"> |
11 |
<condition> |
<condition> |
12 |
<eq> |
<eq> |
13 |
<cfield name="alien_document.id"/> |
<cfield name="alien_document.id"/> |
14 |
<cfield name="alien_document_tax.alien_document"/> |
<cfield name="alien_document_tax.alien_document"/> |
15 |
</eq> |
</eq> |
16 |
</condition> |
</condition> |
17 |
</datasource> |
</datasource> |
18 |
|
|
19 |
<datasource name="productInvoiceDataSource" database="papo" |
<datasource name="productInvoiceDataSource" database="papo" |
20 |
table="_entity_data as provider, alien_document, alien_item, alien_product_item, alien_item_tax, _entity_uid_data" |
table="_entity_data as provider, alien_document, _entity_uid_data" |
21 |
order_by="alien_document.date"> |
order_by="alien_document.date"> |
22 |
<condition> |
<condition> |
23 |
<and> |
<and> |
24 |
<eq> |
<eq> |
25 |
<cfield name="provider.id"/> |
<cfield name="provider.id"/> |
26 |
<cfield name="alien_document.sender"/> |
<cfield name="alien_document.sender"/> |
27 |
</eq> |
</eq> |
28 |
<eq> |
<eq> |
|
<cfield name="alien_document.id"/> |
|
|
<cfield name="alien_item.alien_document"/> |
|
|
</eq> |
|
|
<eq> |
|
|
<cfield name="alien_item.id"/> |
|
|
<cfield name="alien_product_item.alien_item"/> |
|
|
</eq> |
|
|
<eq> |
|
|
<cfield name="alien_item.id"/> |
|
|
<cfield name="alien_item_tax.alien_item"/> |
|
|
</eq> |
|
|
<eq> |
|
29 |
<cfield name="provider._table"/> |
<cfield name="provider._table"/> |
30 |
<cfield name="_entity_uid_data.entity"/> |
<cfield name="_entity_uid_data.entity"/> |
31 |
</eq> |
</eq> |
32 |
<eq> |
<eq> |
33 |
<cfield name="_entity_uid_data.entity_uid_type"/> |
<cfield name="_entity_uid_data.entity_uid_type"/> |
34 |
<cconst value="1"/> |
<cconst value="1"/> |
35 |
</eq> |
</eq> |
36 |
<and> |
<and> |
37 |
<le> |
<le> |
38 |
<cfield name="_entity_uid_data._start_t"/> |
<cfield name="_entity_uid_data._start_t"/> |
39 |
<cfield name="alien_document.date"/> |
<cfield name="alien_document.date"/> |
40 |
</le> |
</le> |
41 |
<or> |
<or> |
42 |
<null> |
<null> |
43 |
<cfield name="_entity_uid_data._end_t"/> |
<cfield name="_entity_uid_data._end_t"/> |
44 |
</null> |
</null> |
45 |
<le> |
<le> |
46 |
<cfield name="alien_document.date"/> |
<cfield name="alien_document.date"/> |
47 |
<cfield name="_entity_uid_data._end_t"/> |
<cfield name="_entity_uid_data._end_t"/> |
48 |
</le> |
</le> |
49 |
</or> |
</or> |
50 |
</and> |
</and> |
51 |
<or> |
<or> |
52 |
<eq> |
<eq> |
53 |
<cfield name="alien_document.alien_document_type"/> |
<cfield name="alien_document.alien_document_type"/> |
54 |
<cconst value="2"/> |
<cconst value="2"/> |
55 |
</eq> |
</eq> |
56 |
<eq> |
<eq> |
57 |
<cfield name="alien_document.alien_document_type"/> |
<cfield name="alien_document.alien_document_type"/> |
58 |
<cconst value="11"/> |
<cconst value="11"/> |
59 |
</eq> |
</eq> |
60 |
<eq> |
<eq> |
61 |
<cfield name="alien_document.alien_document_type"/> |
<cfield name="alien_document.alien_document_type"/> |
62 |
<cconst value="10"/> |
<cconst value="10"/> |
63 |
</eq> |
</eq> |
64 |
<!-- provider credit notes --> |
<!-- provider credit notes --> |
65 |
<eq> |
<eq> |
66 |
<cfield name="alien_document.alien_document_type"/> |
<cfield name="alien_document.alien_document_type"/> |
67 |
<cconst value="18"/> |
<cconst value="18"/> |
68 |
</eq> |
</eq> |
69 |
<eq> |
<eq> |
70 |
<cfield name="alien_document.alien_document_type"/> |
<cfield name="alien_document.alien_document_type"/> |
71 |
<cconst value="19"/> |
<cconst value="19"/> |
72 |
</eq> |
</eq> |
73 |
<eq> |
<eq> |
74 |
<cfield name="alien_document.alien_document_type"/> |
<cfield name="alien_document.alien_document_type"/> |
75 |
<cconst value="20"/> |
<cconst value="20"/> |
76 |
</eq> |
</eq> |
77 |
</or> |
</or> |
78 |
</and> |
</and> |
79 |
</condition> |
</condition> |
80 |
</datasource> |
</datasource> |
81 |
|
|
82 |
<datasource database="papo" name="alienDocumentDataSource" table="alien_document" |
<datasource database="papo" name="alienDocumentDataSource" table="alien_document" |
83 |
order_by="date" /> |
order_by="date" /> |
84 |
<!--para buscar branch--> |
<!--para buscar branch--> |
85 |
|
|
86 |
<neb:Sub neb:src="datasource.nebc" zot="../zot/PAPO-ER.zot" search="own_branch" |
<neb:Sub neb:src="datasource.nebc" zot="../zot/PAPO-ER.zot" search="own_branch" |
87 |
name="ownBranchSearchDataSource" database="papo"/> |
name="ownBranchSearchDataSource" database="papo"/> |
88 |
|
|
92 |
if not str(printBlock.printBox.startDateEntry).strip() \ |
if not str(printBlock.printBox.startDateEntry).strip() \ |
93 |
or not str(printBlock.printBox.startDateEntry).strip(): |
or not str(printBlock.printBox.startDateEntry).strip(): |
94 |
genericBox("Las fechas deben tener un valor",['Aceptar']) |
genericBox("Las fechas deben tener un valor",['Aceptar']) |
95 |
else: |
else: |
96 |
import gnue.common.GConditions as GConditions |
import gnue.common.GConditions as GConditions |
97 |
import string |
import string |
98 |
import hack |
import hack |
99 |
import printing |
import printing |
100 |
|
|
101 |
callTrigger('startWaitingModeTrigger') |
callTrigger('startWaitingModeTrigger') |
102 |
|
|
103 |
table = [] |
table = [] |
104 |
line="\n\nListado de IVA Compras\n\n\n" |
line="\n\nListado de IVA Compras\n\n\n" |
105 |
table.append(line) |
table.append(line) |
107 |
line = "|" + printing.printTitle("Fecha",10) + "|" + printing.printTitle("Comprobante",21) + "|" |
line = "|" + printing.printTitle("Fecha",10) + "|" + printing.printTitle("Comprobante",21) + "|" |
108 |
line += printing.printTitle("Proveedor",30) + "|" + printing.printTitle("C.U.I.T",15) + "|" |
line += printing.printTitle("Proveedor",30) + "|" + printing.printTitle("C.U.I.T",15) + "|" |
109 |
line += printing.printTitle("Neto",14) + "|" + printing.printTitle("I.V.A.",12) + "|" |
line += printing.printTitle("Neto",14) + "|" + printing.printTitle("I.V.A.",12) + "|" |
110 |
line += printing.printTitle("Total",14)+"\n" |
line += printing.printTitle("Total",10)+"\n" |
111 |
table.append(line) |
table.append(line) |
112 |
|
|
113 |
condProductInvoice = GConditions.GCondition() |
condProductInvoice = GConditions.GCondition() |
114 |
tmpAnd = GConditions.GCand(condProductInvoice) |
tmpAnd = GConditions.GCand(condProductInvoice) |
115 |
ge = GConditions.GCge(tmpAnd) |
ge = GConditions.GCge(tmpAnd) |
146 |
GConditions.GCField(null2,"_entity_relation_data._end_t") |
GConditions.GCField(null2,"_entity_relation_data._end_t") |
147 |
#/condiciones por Branch |
#/condiciones por Branch |
148 |
|
|
|
|
|
|
|
|
|
|
|
149 |
productInvoiceResultSet = productInvoiceDataSource.createResultSet(condProductInvoice) |
productInvoiceResultSet = productInvoiceDataSource.createResultSet(condProductInvoice) |
150 |
more = productInvoiceResultSet.firstRecord() |
more = productInvoiceResultSet.firstRecord() |
151 |
|
|
152 |
totalNeto = 0 |
totalNeto = 0 |
153 |
totalIVA = 0 |
totalIVA = 0 |
154 |
documentType={'2': 'FAC A', '10':'FAC C', '11':'FAC B','18':'NCR A','20':'NCR C','19':'NCR B'} |
documentType={'2': 'FAC A', '10':'FAC C', '11':'FAC B','18':'NCR A','20':'NCR C','19':'NCR B'} |
155 |
documentSign={'2': '1', '10':'1', '11':'1','18':'-1', '20':'-1', '19':'-1'} |
documentSign={'2': 1, '10':1, '11':1,'18':-1, '20':-1, '19':-1} |
156 |
|
|
157 |
|
print more |
158 |
while more: |
while more: |
159 |
|
print productInvoiceResultSet.current.getField("alien_document.id") |
160 |
invoiceTotal = 0 |
invoiceTotal = 0 |
161 |
itemTaxTotal = 0 |
itemTaxTotal = 0 |
162 |
currAlienDoc = productInvoiceResultSet.current.getField("alien_document.id") |
|
163 |
line = "|" + printing.printField(productInvoiceResultSet.current.getField("alien_document.date"),10) |
line = "|" + printing.printField(productInvoiceResultSet.current.getField("alien_document.date"),10) |
164 |
line += "|"+ printing.printField(documentType[str(productInvoiceResultSet.current.getField("alien_document.alien_document_type")).strip()],5)+" " |
line += "|"+ printing.printField(documentType[str(productInvoiceResultSet.current.getField("alien_document.alien_document_type")).strip()],5)+" " |
165 |
line += printing.printField(productInvoiceResultSet.current.getField("alien_document.number"),15) |
line += printing.printField(productInvoiceResultSet.current.getField("alien_document.number"),15) |
166 |
line += "|"+printing.printField(productInvoiceResultSet.current.getField("provider.name"),30) |
line += "|"+printing.printField(productInvoiceResultSet.current.getField("provider.name"),30) |
167 |
line += "|"+printing.printField(productInvoiceResultSet.current.getField("_entity_uid_data.uid"),15) |
line += "|"+printing.printField(productInvoiceResultSet.current.getField("_entity_uid_data.uid"),15) |
168 |
|
|
169 |
sign= documentSign[str(productInvoiceResultSet.current.getField("alien_document.alien_document_type")).strip()] |
sign= documentSign[str(productInvoiceResultSet.current.getField("alien_document.alien_document_type")).strip()] |
170 |
while productInvoiceResultSet.current.getField("alien_document.id") == currAlienDoc and more: |
# the doocument already knows its totals :) |
171 |
lQty = hack.a2f(productInvoiceResultSet.current.getField("alien_product_item.qty")) |
itemTaxTotal= hack.a2f (str(productInvoiceResultSet.current.getField("alien_document.tax_total")).strip()) |
172 |
lUnitPrice = hack.a2f(productInvoiceResultSet.current.getField("alien_product_item.unit_price")) |
invoiceTotal= hack.a2f (str(productInvoiceResultSet.current.getField("alien_document.net_total")).strip()) |
173 |
lBonus = hack.a2f(productInvoiceResultSet.current.getField("alien_item.bonus")) |
# signo del comprobante |
174 |
lDiscount = hack.a2f(productInvoiceResultSet.current.getField("alien_item.discount")) |
itemTaxTotal = itemTaxTotal * sign |
175 |
item = lQty * lUnitPrice - lBonus - lDiscount |
invoiceTotal = invoiceTotal * sign |
176 |
currItem = productInvoiceResultSet.current.getField("alien_item.id") |
# imprimo con formato account |
|
#no olvidarse de la condicion de next |
|
|
while productInvoiceResultSet.current.getField("alien_item.id") == currItem and productInvoiceResultSet.current.getField("alien_document.id") == currAlienDoc 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() |
|
|
#signo del comprobante |
|
|
itemTaxTotal = itemTaxTotal * hack.a2f(sign) |
|
|
invoiceTotal = invoiceTotal * hack.a2f(sign) |
|
|
#imprimo con formato account |
|
177 |
line += "|" + printing.printAccount(invoiceTotal,14) |
line += "|" + printing.printAccount(invoiceTotal,14) |
178 |
line += "|" + printing.printAccount(itemTaxTotal,12) |
line += "|" + printing.printAccount(itemTaxTotal,12) |
179 |
line += "|" + printing.printAccount((itemTaxTotal + invoiceTotal),14) |
line += "|" + printing.printAccount((itemTaxTotal + invoiceTotal),10) |
180 |
totalIVA += itemTaxTotal |
totalIVA += itemTaxTotal |
181 |
totalNeto += invoiceTotal |
totalNeto += invoiceTotal |
182 |
table.append(line) |
table.append(line) |
183 |
|
more = productInvoiceResultSet.nextRecord() |
184 |
|
print more |
185 |
|
|
186 |
callTrigger('endWaitingModeTrigger') |
callTrigger('endWaitingModeTrigger') |
187 |
|
|
188 |
line = "\n"+printing.printField("Total",80,'r') + "|" |
line = "\n"+printing.printField("Total",80,'r') + "|" |
189 |
line += printing.printAccount(totalNeto,14) + "|" |
line += printing.printAccount(totalNeto,14) + "|" |
190 |
line += printing.printAccount(totalIVA,12) + "|" |
line += printing.printAccount(totalIVA,12) + "|" |
191 |
line += printing.printAccount((totalIVA + totalNeto),14) |
line += printing.printAccount((totalIVA + totalNeto),14) |
192 |
table.append(line) |
table.append(line) |
193 |
|
|
194 |
printing.previewPrint(table,"xless") |
printing.previewPrint(table,"xless") |
195 |
|
|
196 |
</trigger> |
</trigger> |
197 |
|
|
198 |
<trigger name="startWaitingModeTrigger" type="NAMED"><![CDATA[ |
<trigger name="startWaitingModeTrigger" type="NAMED"><![CDATA[ |
224 |
|
|
225 |
<block datasource="printDataSource" name="printBlock" restrictInsert=""> |
<block datasource="printDataSource" name="printBlock" restrictInsert=""> |
226 |
|
|
227 |
<box height="8" label="Listado de I.V.A. Compras" |
<box height="8" label="Listado de I.V.A. Compras" |
228 |
name="printBox" width="37" x="1" y="1"> |
name="printBox" width="37" x="1" y="1"> |
229 |
<label name="startDateLbl" text="Desde : " x="1" y="1"/> |
<label name="startDateLbl" text="Desde : " x="1" y="1"/> |
230 |
<entry name="startDateEntry" typecast="date" x="9" y="1" width="12"/> |
<entry name="startDateEntry" typecast="date" x="9" y="1" width="12"/> |
231 |
<label name="startDateLbl" text="Hasta : " x="1" y="2"/> |
<label name="startDateLbl" text="Hasta : " x="1" y="2"/> |
232 |
<entry name="endDateEntry" typecast="date" x="9" y="2" width="12"/> |
<entry name="endDateEntry" typecast="date" x="9" y="2" width="12"/> |
233 |
<label text="sucursal :" x="1" y="3"/> |
<label text="sucursal :" x="1" y="3"/> |
234 |
<entry x="9" y="3" name="ownBranchIdSearch" width="25" style="dropdown" |
<entry x="9" y="3" name="ownBranchIdSearch" width="25" style="dropdown" |
235 |
foreign_key="ownBranchSearchDataSource._entity_data._table" |
foreign_key="ownBranchSearchDataSource._entity_data._table" |