Ejemplo n.º 1
0
 def run(self):
     self.tmpl = resource_filename("illiquids.reports","cashbalances.html")
     args = {
         'cols' : ['deal', 'entity', 'bank', 'account_type', 'account', 'iban', 'currency', 'balance', 'collateral', 'fx', 'bal_usd', 'subtotal', 'total', 'balance_date', 'age'],
         'headers' : { 
             'deal' : {'name' : 'Deal', 
                       'class':'text', 
                       '_fmt' : fmtdata1},
             'entity' : {'name' : 'Entity', 
                         'class':'text', 
                         '_fmt' : fmtdata1},
             'bank' : {'name' : 'Bank', 
                       'class':'text', 
                       '_fmt' : fmtdata1},
             'account' : {'name' : 'Account#', 
                          'class':'text', 
                          '_fmt' : fmtdata1},
             'account_type' : {'name' : 'Account Type', 
                          'class':'text', 
                          '_fmt' : fmtdata1},
             'iban' : {'name' : 'IBAN', 
                          'class':'text', 
                          '_fmt' : fmtdata1},
             'currency' : {'name' : 'CCY', 
                           'class':'text', 
                           '_fmt' : fmtdata1},
             'collateral' : {'name' : 'Collateral', 
                          'class':'number',
                          '_fmt' : lambda a: fmtdata1(a, 0)},                
             'balance' : {'name' : 'Balance', 
                          'class':'number',
                          '_fmt' : lambda a: fmtdata1(a, 0)},
             'fx' : {'name' : 'FX Rate', 
                     'class':'number', 
                     '_fmt' : lambda a: fmtdata1(a, 4)},
             'bal_usd' : {'name' : 'USD Equiv. Total', 
                          'class':'number', 
                          '_fmt' : lambda a: fmtdata1(a, 0, '$')},
             'subtotal' : {'name' : 'Sub Total', 
                          'class':'number',
                          '_fmt' : lambda a : fmtdata1(a, 0, '$')},
             'total' : {'name' : 'Total', 
                          'class':'number',
                          '_fmt' : lambda a : fmtdata1(a, 0, '$')},
             'balance_date' : {'name' : 'Balance Date', 
                      'class':'text', 
                      '_fmt' : fmtdata1},
             'age' : {'name' : 'Aged', 
                      'class':'number', 
                      '_fmt' : lambda a: fmtdata1(a, 0)},
         },
         'asof' : self._asof.strftime('%A, %d %B %Y') ,
         'rows'  : [],
     }
     control = Control(file_archive=None,db_url=self._dburl)
     args['rows'] = control.fetch_report_data()      
     
     self._gen_report_(args) 
     
     # Now convert it to a pdf file
     pdf_output = self.outputfile.replace('.html', '.pdf')
     pdfargs = ['--username','corp\\reportingdb', '--password','&AdRekAd'] 
     htmltopdf([os.path.abspath(self.outputfile)], os.path.abspath(pdf_output), orientation='landscape', pdfargs=pdfargs)        
Ejemplo n.º 2
0
    def run(self):
        self.tmpl = resource_filename("illiquids.reports","exceptions.html")
        args = {
            'cols' : ['deal', 'entity', 'bank', 'account_type', 'account', 'iban', 'currency', 'balance', 'collateral', 'fx', 'bal_usd', 'subtotal', 'total', 'balance_date', 'age'],
            'headers' : { 
                'deal' : {'name' : 'Deal', 
                          'class':'text', 
                          '_fmt' : fmtdata1},
                'entity' : {'name' : 'Entity', 
                            'class':'text', 
                            '_fmt' : fmtdata1},
                'bank' : {'name' : 'Bank', 
                          'class':'text', 
                          '_fmt' : fmtdata1},
                'account' : {'name' : 'Account#',
                             'class':'text', 
                             '_fmt' : fmtdata1},
                'account_type' : {'name' : 'Account Type', 
                             'class':'text', 
                             '_fmt' : fmtdata1},
                'iban' : {'name' : 'IBAN',
                             'class':'text', 
                             '_fmt' : fmtdata1},
                'currency' : {'name' : 'CCY', 
                              'class':'text', 
                              '_fmt' : fmtdata1},
                'balance' : {'name' : 'Balance', 
                             'class':'number',
                             '_fmt' : lambda a: fmtdata1(a, 0)},
                'collateral' : {'name' : 'Collateral', 
                             'class':'number',
                             '_fmt' : lambda a: fmtdata1(a, 0)},                   
                'fx' : {'name' : 'FX Rate', 
                        'class':'number', 
                        '_fmt' : lambda a: fmtdata1(a, 4)},
                'bal_usd' : {'name' : 'USD Equiv.', 
                             'class':'number', 
                             '_fmt' : lambda a: fmtdata1(a, 0, '$')},
                'subtotal' : {'name' : 'Sub Total', 
                             'class':'number',
                             '_fmt' : lambda a : fmtdata1(a, 0, '$')},
                'total' : {'name' : 'Total', 
                             'class':'number',
                             '_fmt' : lambda a : fmtdata1(a, 0, '$')},
                'balance_date' : {'name' : 'Balance Date', 
                         'class':'text', 
                         '_fmt' : fmtdata1},
                'age' : {'name' : 'Aged', 
                         'class':'number', 
                         '_fmt' : lambda a: fmtdata1(a, 0)},
            },
            'asof' : self._asof.strftime('%A, %d %B %Y') ,
            'acc_info': []

        }
        # Note - CRM url is hard coded!
        control = Control(file_archive=None,self._dburl)
        aged, no_data, dropped, age_limit = control.fetch_exception_data()
        args['acc_info'] = ((aged, "Aged Accounts (Balances older than %s days)" % age_limit, "No old balances to report"),
                            (no_data, "Accounts that have never had a balance", "All accounts have a balance."),
                            (dropped, "Automatic accounts not loading automatically (Balance >1 day old)", "No old balances to report")
                            )
        self._gen_report_(args)
        
        # Now convert it to a pdf file
        pdf_output = self.outputfile.replace('.html', '.pdf')
        pdfargs = ['--username','corp\\reportingdb', '--password','&AdRekAd'] 
        htmltopdf([os.path.abspath(self.outputfile)], os.path.abspath(pdf_output), orientation='landscape', pdfargs=pdfargs)