Example #1
0
def print_body(month,year):
    start = datetime.datetime(year,month,1)
    if month != 12:
        end = datetime.datetime(year,month+1,1)
    else:
        end = datetime.datetime(year+1,1,1)

    sales,payments,cash = db.get_accounts('daily',start,end)
    
    print '''
<table border='1'> <caption>Total Sales</caption>
 <thead>
 <tr>
  <th>Date</th>
  <th>Cash</th>
  <th>Check</th>
  <th>Credit</th>
  <th>Tab</th>
  <th>LINK</th>
  <th>total</th>
 </tr>
</thead>

<tbody>'''
    print_results(sales, ['cash','check','debit/credit','tab','link','total'])
    print '''
</tbody>

</table>
'''
    print '''
<table border='1'> <caption>Tab Payments</caption>
<thead>
 <tr>
  <th>Date</th>
  <th>Cash</th>
  <th>Check</th>
  <th>Credit</th>
  <th>LINK</th>
 </tr>
</thead>

<tbody>'''
    print_results(payments, ['cash','check','debit/credit','link'])
    
    print '''
</tbody>

</table>'''

    print '''
<table border='1'> <caption>Total Cash In (including tab payments)</caption>
<thead>
 <tr>
  <th>Date</th>
  <th>Cash In</th>
 </tr>
</thead>

<tbody>'''
    print_results(cash)
    print '''
Example #2
0
                    print '<td>%s</td>' % (row[o])
                else:
                    print '<td>0</td>'
        else:
            print '<td>%s</td>' % (row)
        print '</tr>'

print 'Content-Type: text/html\n'
print '''<html>
 <head>
    <title>OP Monthly Accounts</title>

</head>
 <body>'''

sales,payments,cash = db.get_accounts('monthly')

print '''
<table border='1'> <caption>Total Sales</caption>
 <thead>
 <tr>
  <th>Date</th>
  <th>cash</th>
  <th>check</th>
  <th>credit</th>
  <th>tab</th>
  <th>LINK</th>
  <th>total</th>
 </tr>
</thead>