/[papo]/papo/forms/cashFlow.neb
ViewVC logotype

Diff of /papo/forms/cashFlow.neb

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

revision 1.5 by fheinz, Sat Nov 22 00:11:50 2003 UTC revision 1.6 by apronotti, Mon Nov 24 19:22:50 2003 UTC
# Line 49  Foundation, Inc., 59 Temple Place, Suite Line 49  Foundation, Inc., 59 Temple Place, Suite
49        sys.path.append('../ruff')        sys.path.append('../ruff')
50        import hack        import hack
51        import mx.DateTime        import mx.DateTime
52        import informe        from ruff import Report
53        import printing            import printing    
54        
55        meses = ['enero','febrero','marzo','abril','mayo','junio','julio','agosto','setiembre','octubre','noviembre','diciembre']        meses = ['enero','febrero','marzo','abril','mayo','junio','julio','agosto','setiembre','octubre','noviembre','diciembre']
56        resultStateInf = informe.new('ruff/cashFlow.xml')        resultStateInf = Report('ruff/cashFlow.xml')
57        resultStateInf.page_header(fecha=str(mx.DateTime.now().strftime('%Y-%m-%d')))        resultStateInf.header(fecha=str(mx.DateTime.now().strftime('%Y-%m-%d')))
58        resultStateInf.page_header.year= str(printBlock.printBox.yearEntry)        resultStateInf.header(year= str(printBlock.printBox.yearEntry))
59      
60        # inicialización        # inicialización
61        ingresos = {}        ingresos = {}
62        impuestos_ingresos = {}        impuestos_ingresos = {}
# Line 168  Foundation, Inc., 59 Temple Place, Suite Line 168  Foundation, Inc., 59 Temple Place, Suite
168                    
169        ### Construcción del informe        ### Construcción del informe
170        ## Ingresos        ## Ingresos
171          resultStateInf.add_detail('income')
172        totalXmes = 0        totalXmes = 0
173        row_aux = {}        row_aux = {}
174        ingresos_aux = ingresos.keys()        ingresos_aux = ingresos.keys()
# Line 180  Foundation, Inc., 59 Temple Place, Suite Line 181  Foundation, Inc., 59 Temple Place, Suite
181            row_aux[mes] = amount_aux            row_aux[mes] = amount_aux
182          row_aux['total'] = ('%10.0f' % hack.a2f(totalXmes)).strip().rjust(6)          row_aux['total'] = ('%10.0f' % hack.a2f(totalXmes)).strip().rjust(6)
183          totalXmes = 0          totalXmes = 0
184          resultStateInf.income.income_item.add_row(**row_aux)          resultStateInf.add_dentry('income_item',**row_aux)
185          row_aux = {}          row_aux = {}
186            
187        row_aux = {}        row_aux = {}
188        ingresos_aux = impuestos_ingresos.keys()        ingresos_aux = impuestos_ingresos.keys()
189        ingresos_aux.sort()        ingresos_aux.sort()
# Line 194  Foundation, Inc., 59 Temple Place, Suite Line 195  Foundation, Inc., 59 Temple Place, Suite
195            row_aux[mes] = amount_aux            row_aux[mes] = amount_aux
196          row_aux['total'] = ('%10.0f' % hack.a2f(totalXmes)).strip().rjust(6)          row_aux['total'] = ('%10.0f' % hack.a2f(totalXmes)).strip().rjust(6)
197          totalXmes = 0          totalXmes = 0
198          resultStateInf.income.income_item.add_row(**row_aux)          resultStateInf.add_dentry('income_item',**row_aux)
199          row_aux = {}          row_aux = {}
200              
201          resultStateInf.close_detail()
202          
203        ## Cierre de totales de ingreso        ## Cierre de totales de ingreso
204                
205        resultSetTotalNeto = ownDocumentDataSource.createRawResultSet('select sum(od.net_total * CASE dt.sign WHEN true THEN -1 ELSE 1 END) as amount from own_document od, _document_type_data dt where od.own_document_type = dt.id and od.own_document_type in (4,8,9,14,15,16,30,31,32) and (not od.is_void or od.is_void is null) and (od.date >= \'%s\' and od.date < \'%s\') ' % (global_begin_date, global_end_date))        resultSetTotalNeto = ownDocumentDataSource.createRawResultSet('select sum(od.net_total * CASE dt.sign WHEN true THEN -1 ELSE 1 END) as amount from own_document od, _document_type_data dt where od.own_document_type = dt.id and od.own_document_type in (4,8,9,14,15,16,30,31,32) and (not od.is_void or od.is_void is null) and (od.date >= \'%s\' and od.date < \'%s\') ' % (global_begin_date, global_end_date))
# Line 209  Foundation, Inc., 59 Temple Place, Suite Line 212  Foundation, Inc., 59 Temple Place, Suite
212        resultSetTotalImpuestos.firstRecord()        resultSetTotalImpuestos.firstRecord()
213        total += hack.a2f(resultSetTotalImpuestos.current.getField('amount'),4)        total += hack.a2f(resultSetTotalImpuestos.current.getField('amount'),4)
214                
215        resultStateInf.totales.page_header(total=('%6.0f' % total).strip().rjust(6))        resultStateInf.add_detail('totales')
216          resultStateInf.header(total=('%6.0f' % total).strip().rjust(6))
217                
218        resultSetTotalCobrado = ownDocumentDataSource.createRawResultSet("select sum(odp.amount * CASE dt.sign WHEN true THEN -1 ELSE 1 END) as amount from own_document_proceeding odp, own_document od, _document_type_data dt where od.id = odp.own_document and od.own_document_type = dt.id and od.own_document_type in (4,8,9,14,15,16,30,31,32) and (not od.is_void or od.is_void is null) and (od.date >= \'%s\' and od.date < \'%s\') " % (global_begin_date, global_end_date))        resultSetTotalCobrado = ownDocumentDataSource.createRawResultSet("select sum(odp.amount * CASE dt.sign WHEN true THEN -1 ELSE 1 END) as amount from own_document_proceeding odp, own_document od, _document_type_data dt where od.id = odp.own_document and od.own_document_type = dt.id and od.own_document_type in (4,8,9,14,15,16,30,31,32) and (not od.is_void or od.is_void is null) and (od.date >= \'%s\' and od.date < \'%s\') " % (global_begin_date, global_end_date))
219                
220        more = resultSetTotalCobrado.firstRecord()        more = resultSetTotalCobrado.firstRecord()
221        resultStateInf.totales.page_header(total_cobrado=('%6.0f' % hack.a2f(resultSetTotalCobrado.current.getField('amount'),4)).strip().rjust(6))  
222          resultStateInf.header(total_cobrado=('%6.0f' % hack.a2f(resultSetTotalCobrado.current.getField('amount'),4)).strip().rjust(6))
223                
224        resultStateInf.totales.page_header(total_adeudado=('%6.0f' % (total - hack.a2f(resultSetTotalCobrado.current.getField('amount'),4))).strip().rjust(6))        resultStateInf.header(total_adeudado=('%6.0f' % (total - hack.a2f(resultSetTotalCobrado.current.getField('amount'),4))).strip().rjust(6))
225            resultStateInf.close_detail()
226                    
227        ## Egresos        ## Egresos
228          resultStateInf.add_detail('egreso')
229        row_aux = {}        row_aux = {}
230        egresos_aux = egresos.keys()        egresos_aux = egresos.keys()
231        egresos_aux.sort()        egresos_aux.sort()
# Line 231  Foundation, Inc., 59 Temple Place, Suite Line 237  Foundation, Inc., 59 Temple Place, Suite
237            row_aux[mes] = amount_aux            row_aux[mes] = amount_aux
238          row_aux['total'] = ('%10.0f' % hack.a2f(totalXmes)).strip().rjust(6)          row_aux['total'] = ('%10.0f' % hack.a2f(totalXmes)).strip().rjust(6)
239          totalXmes = 0          totalXmes = 0
240          resultStateInf.egreso.egreso_item.add_row(**row_aux)          resultStateInf.add_dentry('egreso_item',**row_aux)
241          row_aux = {}          row_aux = {}
242        
243        row_aux = {}        row_aux = {}
# Line 245  Foundation, Inc., 59 Temple Place, Suite Line 251  Foundation, Inc., 59 Temple Place, Suite
251            row_aux[mes] = amount_aux            row_aux[mes] = amount_aux
252          row_aux['total'] = ('%10.0f' % hack.a2f(totalXmes)).strip().rjust(6)          row_aux['total'] = ('%10.0f' % hack.a2f(totalXmes)).strip().rjust(6)
253          totalXmes = 0          totalXmes = 0
254          resultStateInf.egreso.egreso_item.add_row(**row_aux)          resultStateInf.add_dentry('egreso_item',**row_aux)
255          row_aux = {}          row_aux = {}
256      
257          resultStateInf.close_detail()
258          
259        ## Cierre de totales de egreso        ## Cierre de totales de egreso
260        begin_date = str(printBlock.printBox.yearEntry).strip()+"-01-01"        begin_date = str(printBlock.printBox.yearEntry).strip()+"-01-01"
261        end_date = str(hack.a2f(printBlock.printBox.yearEntry,0)+1).strip()+"-01-01"        end_date = str(hack.a2f(printBlock.printBox.yearEntry,0)+1).strip()+"-01-01"
# Line 261  Foundation, Inc., 59 Temple Place, Suite Line 269  Foundation, Inc., 59 Temple Place, Suite
269                
270        resultSetTotalImpuestos.firstRecord()        resultSetTotalImpuestos.firstRecord()
271        total += hack.a2f(resultSetTotalImpuestos.current.getField('amount'),4)        total += hack.a2f(resultSetTotalImpuestos.current.getField('amount'),4)
272          
273        resultStateInf.totales_egr.page_header(total=('%6.0f' % total).strip().rjust(6))        resultStateInf.add_detail('totales_egr')
274          resultStateInf.header(total=('%6.0f' % total).strip().rjust(6))
275                
276        resultSetTotalCobrado = alienDocumentDataSource.createRawResultSet('select sum(adp.amount * CASE dt.sign WHEN true THEN 1 ELSE -1 END) as amount from alien_document_proceeding adp, alien_document ad, _document_type_data dt where ad.id = adp.alien_document   and ad.alien_document_type = dt.id and ad.alien_document_type in (2,10,11,18,19,20,33,34,35) and (not ad.is_void or ad.is_void is null) and (ad.date >= \'%s\' and ad.date < \'%s\') ' % (global_begin_date, global_end_date))        resultSetTotalCobrado = alienDocumentDataSource.createRawResultSet('select sum(adp.amount * CASE dt.sign WHEN true THEN 1 ELSE -1 END) as amount from alien_document_proceeding adp, alien_document ad, _document_type_data dt where ad.id = adp.alien_document   and ad.alien_document_type = dt.id and ad.alien_document_type in (2,10,11,18,19,20,33,34,35) and (not ad.is_void or ad.is_void is null) and (ad.date >= \'%s\' and ad.date < \'%s\') ' % (global_begin_date, global_end_date))
277                
278        more = resultSetTotalCobrado.firstRecord()        more = resultSetTotalCobrado.firstRecord()
279        resultStateInf.totales_egr.page_header(total_pagado=('%6.0f' % hack.a2f(resultSetTotalCobrado.current.getField('amount'),4)).strip().rjust(6))        resultStateInf.header(total_pagado=('%6.0f' % hack.a2f(resultSetTotalCobrado.current.getField('amount'),4)).strip().rjust(6))
280                
281        resultStateInf.totales_egr.page_header(total_adeudado=('%6.0f' % (total - hack.a2f(resultSetTotalCobrado.current.getField('amount'),4))).strip().rjust(6))        resultStateInf.header(total_adeudado=('%6.0f' % (total - hack.a2f(resultSetTotalCobrado.current.getField('amount'),4))).strip().rjust(6))
282        
283        callTrigger('endWaitingModeTrigger')        callTrigger('endWaitingModeTrigger')
284    
285        from gnue.common.GParser import GContent        from gnue.common.GParser import GContent
286                    
287        printing.previewPrint([resultStateInf.render()],gConfig('printcommand'))        printing.previewPrint([str(resultStateInf)],gConfig('printcommand'))
288    ]]></trigger>    ]]></trigger>
289    
290    <neb:Sub neb:src="wait.nebc"/>    <neb:Sub neb:src="wait.nebc"/>

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