hr_timesheet_invoice: fix report cost ledger to match the new one from account
bzr revid: ced-965143b8e6953cd2f6f2322fc096b75c3325d667
This commit is contained in:
@@ -30,69 +30,144 @@ import pooler
|
||||
import time
|
||||
from report import report_sxw
|
||||
|
||||
SUMS = ('credit','debit','balance','quantity','revenue')
|
||||
|
||||
class account_analytic_cost_ledger(report_sxw.rml_parse):
|
||||
def __init__(self, cr, uid, name, context):
|
||||
super(account_analytic_cost_ledger, self).__init__(cr, uid, name, context)
|
||||
self.sum_revenue={}
|
||||
self.account_sum_revenue={}
|
||||
self.localcontext.update( {
|
||||
'time': time,
|
||||
'lines': self._lines_all,
|
||||
'totals': dict.fromkeys(SUMS, 0.0)
|
||||
'lines_g': self._lines_g,
|
||||
'lines_a': self._lines_a,
|
||||
'account_sum_debit': self._account_sum_debit,
|
||||
'account_sum_credit': self._account_sum_credit,
|
||||
'account_sum_balance': self._account_sum_balance,
|
||||
'account_sum_qty': self._account_sum_qty,
|
||||
'account_sum_revenue': self._account_sum_revenue,
|
||||
'account_g_sum_revenue': self._account_g_sum_revenue,
|
||||
'sum_debit': self._sum_debit,
|
||||
'sum_credit': self._sum_credit,
|
||||
'sum_balance': self._sum_balance,
|
||||
'sum_qty': self._sum_qty,
|
||||
'sum_revenue': self._sum_revenue,
|
||||
})
|
||||
|
||||
def _lines_all(self, accounts, date1, date2):
|
||||
result = []
|
||||
for account in accounts:
|
||||
accs = self._lines(account.id, date1, date2).values()
|
||||
result.append( {
|
||||
'code': account.code,
|
||||
'name': account.complete_name,
|
||||
'accounts': accs,
|
||||
'qty_max': account.quantity_max or '/',
|
||||
'debit_max': account.amount_max or '/'
|
||||
})
|
||||
for word in SUMS:
|
||||
s=reduce(lambda x,y:x+y[word], accs, 0.0)
|
||||
result[-1][word] = s
|
||||
self.localcontext['totals'][word] += s
|
||||
return result
|
||||
def _lines_g(self, account_id, date1, date2):
|
||||
self.cr.execute("SELECT sum(aal.amount) AS balance, aa.code AS code, aa.name AS name, aa.id AS id, sum(aal.unit_amount) AS quantity \
|
||||
FROM account_account AS aa, account_analytic_line AS aal \
|
||||
WHERE (aal.account_id=%d) AND (aal.date>=%s) AND (aal.date<=%s) AND (aal.general_account_id=aa.id) \
|
||||
GROUP BY aa.code, aa.name, aa.id ORDER BY aa.code", (account_id, date1, date2))
|
||||
res = self.cr.dictfetchall()
|
||||
|
||||
def _lines(self, account_id, date1, date2):
|
||||
lineobj = self.pool.get('account.analytic.line')
|
||||
line_ids = lineobj.search(self.cr, self.uid, [('account_id','=',account_id), ('date','>=',date1), ('date','<=',date2)])
|
||||
result = {}
|
||||
for line in lineobj.browse(self.cr, self.uid, line_ids):
|
||||
if line.general_account_id.id not in result:
|
||||
result[line.general_account_id.id] = {
|
||||
'code': line.general_account_id.code,
|
||||
'name': line.general_account_id.name,
|
||||
'lines': []
|
||||
}
|
||||
result[line.general_account_id.id].update(dict.fromkeys(SUMS, 0.0))
|
||||
for r in res:
|
||||
if r['balance'] > 0:
|
||||
r['debit'] = r['balance']
|
||||
r['credit'] = 0.0
|
||||
elif r['balance'] < 0:
|
||||
r['debit'] = 0.0
|
||||
r['credit'] = -r['balance']
|
||||
else:
|
||||
r['debit'] = 0.0
|
||||
r['credit'] = 0.0
|
||||
return res
|
||||
|
||||
def _lines_a(self, general_account_id, account_id, date1, date2):
|
||||
self.cr.execute("SELECT aal.id AS id, aal.name AS name, aal.code AS code, aal.amount AS balance, aal.date AS date, aaj.code AS cj, aal.unit_amount AS quantity \
|
||||
FROM account_analytic_line AS aal, account_analytic_journal AS aaj \
|
||||
WHERE (aal.general_account_id=%d) AND (aal.account_id=%d) AND (aal.date>=%s) AND (aal.date<=%s) \
|
||||
AND (aal.journal_id=aaj.id) \
|
||||
ORDER BY aal.date, aaj.code, aal.code", (general_account_id, account_id, date1, date2))
|
||||
res = self.cr.dictfetchall()
|
||||
|
||||
line_obj = self.pool.get('account.analytic.line')
|
||||
price_obj = self.pool.get('product.pricelist')
|
||||
lines = {}
|
||||
for l in line_obj.browse(self.cr, self.uid, [ x['id'] for x in res]):
|
||||
lines[l.id] = l
|
||||
if not account_id in self.sum_revenue:
|
||||
self.sum_revenue[account_id] = 0.0
|
||||
if not general_account_id in self.account_sum_revenue:
|
||||
self.account_sum_revenue[general_account_id] = 0.0
|
||||
for r in res:
|
||||
id = r['id']
|
||||
revenue = 0.0
|
||||
if line.amount<0 and line.product_id and line.product_uom_id and line.account_id.pricelist_id:
|
||||
c = {
|
||||
'uom': line.product_uom_id.id
|
||||
}
|
||||
id = line.account_id.pricelist_id.id
|
||||
price = self.pool.get('product.pricelist').price_get(self.cr, self.uid, [id],
|
||||
line.product_id.id, line.unit_amount, c)[id]
|
||||
revenue = round(price * line.unit_amount, 2)
|
||||
result[line.general_account_id.id]['lines'].append( {
|
||||
'date':line.date,
|
||||
'cj':line.journal_id.code,
|
||||
'name': line.name,
|
||||
'quantity': line.unit_amount,
|
||||
'credit': line.amount <0 and -line.amount or 0,
|
||||
'debit': line.amount >0 and line.amount or 0,
|
||||
'balance': line.amount,
|
||||
'revenue': revenue
|
||||
} )
|
||||
for word in SUMS:
|
||||
result[line.general_account_id.id][word] += (result[line.general_account_id.id]['lines'][-1][word] or 0.0)
|
||||
return result
|
||||
if lines[id].amount < 0 and lines[id].product_id and lines[id].product_uom_id and lines[id].account_id.pricelist_id:
|
||||
ctx = {'uom': lines[id].product_uom_id.id}
|
||||
price = price_obj.price_get(self.cr, self.uid, [lines[id].pricelist_id.id], lines[id].product_id.id, lines[id].unit_amount, ctx)[lines[id].pricelist_id.id]
|
||||
revenue = round(price * lines[id].unit_amount, 2)
|
||||
r['revenue'] = revenue
|
||||
self.sum_revenue[account_id] += revenue
|
||||
self.account_sum_revenue[general_account_id] += revenue
|
||||
if r['balance'] > 0:
|
||||
r['debit'] = r['balance']
|
||||
r['credit'] = 0.0
|
||||
elif r['balance'] < 0:
|
||||
r['debit'] = 0.0
|
||||
r['credit'] = -r['balance']
|
||||
else:
|
||||
r['debit'] = 0.0
|
||||
r['credit'] = 0.0
|
||||
return res
|
||||
|
||||
report_sxw.report_sxw('report.hr.timesheet.invoice.account.analytic.account.cost_ledger', 'account.analytic.account', 'addons/hr_timesheet_invoice/report/cost_ledger.rml',parser=account_analytic_cost_ledger)
|
||||
def _account_sum_debit(self, account_id, date1, date2):
|
||||
self.cr.execute("SELECT sum(amount) FROM account_analytic_line WHERE account_id=%d AND date>=%s AND date<=%s AND amount>0", (account_id, date1, date2))
|
||||
return self.cr.fetchone()[0] or 0.0
|
||||
|
||||
def _account_sum_credit(self, account_id, date1, date2):
|
||||
self.cr.execute("SELECT -sum(amount) FROM account_analytic_line WHERE account_id=%d AND date>=%s AND date<=%s AND amount<0", (account_id, date1, date2))
|
||||
return self.cr.fetchone()[0] or 0.0
|
||||
|
||||
def _account_sum_balance(self, account_id, date1, date2):
|
||||
debit = self._account_sum_debit(account_id, date1, date2)
|
||||
credit = self._account_sum_credit(account_id, date1, date2)
|
||||
return (debit-credit)
|
||||
|
||||
def _account_sum_qty(self, account_id, date1, date2):
|
||||
self.cr.execute("SELECT sum(unit_amount) FROM account_analytic_line WHERE account_id=%d AND date>=%s AND date<=%s", (account_id, date1, date2))
|
||||
return self.cr.fetchone()[0] or 0.0
|
||||
|
||||
def _account_sum_revenue(self, account_id):
|
||||
return self.sum_revenue.get(account_id, 0.0)
|
||||
|
||||
def _account_g_sum_revenue(self, general_account_id):
|
||||
return self.account_sum_revenue.get(general_account_id, 0.0)
|
||||
|
||||
def _sum_debit(self, accounts, date1, date2):
|
||||
ids = map(lambda x: x.id, accounts)
|
||||
if not len(ids):
|
||||
return 0.0
|
||||
self.cr.execute("SELECT sum(amount) FROM account_analytic_line WHERE account_id IN ("+','.join(map(str, ids))+") AND date>=%s AND date<=%s AND amount>0", (date1, date2))
|
||||
return self.cr.fetchone()[0] or 0.0
|
||||
|
||||
def _sum_credit(self, accounts, date1, date2):
|
||||
ids = map(lambda x: x.id, accounts)
|
||||
if not len(ids):
|
||||
return 0.0
|
||||
ids = map(lambda x: x.id, accounts)
|
||||
self.cr.execute("SELECT -sum(amount) FROM account_analytic_line WHERE account_id IN ("+','.join(map(str, ids))+") AND date>=%s AND date<=%s AND amount<0", (date1, date2))
|
||||
return self.cr.fetchone()[0] or 0.0
|
||||
|
||||
def _sum_balance(self, accounts, date1, date2):
|
||||
debit = self._sum_debit(accounts, date1, date2) or 0.0
|
||||
credit = self._sum_credit(accounts, date1, date2) or 0.0
|
||||
return (debit-credit)
|
||||
|
||||
def _sum_qty(self, accounts, date1, date2):
|
||||
ids = map(lambda x: x.id, accounts)
|
||||
if not len(ids):
|
||||
return 0.0
|
||||
ids = map(lambda x: x.id, accounts)
|
||||
self.cr.execute("SELECT sum(unit_amount) FROM account_analytic_line WHERE account_id IN ("+','.join(map(str, ids))+") AND date>=%s AND date<=%s", (date1, date2))
|
||||
return self.cr.fetchone()[0] or 0.0
|
||||
|
||||
def _sum_revenue(self, accounts):
|
||||
ids = map(lambda x: x.id, accounts)
|
||||
if not len(ids):
|
||||
return 0.0
|
||||
res = 0.0
|
||||
for id in ids:
|
||||
res += self.sum_revenue.get(id, 0.0)
|
||||
return res
|
||||
|
||||
report_sxw.report_sxw('report.hr.timesheet.invoice.account.analytic.account.cost_ledger', 'account.analytic.account', 'addons/hr_timesheet_invoice/report/cost_ledger.rml',parser=account_analytic_cost_ledger, header=False)
|
||||
|
||||
|
||||
@@ -16,6 +16,9 @@
|
||||
<blockBackground colorName="#e6e6e6" start="0,0" stop="0,0"/>
|
||||
<blockBackground colorName="#e6e6e6" start="1,0" stop="1,0"/>
|
||||
<blockBackground colorName="#e6e6e6" start="2,0" stop="2,0"/>
|
||||
<blockBackground colorName="#e6e6e6" start="0,1" stop="0,1"/>
|
||||
<blockBackground colorName="#e6e6e6" start="1,1" stop="1,1"/>
|
||||
<blockBackground colorName="#e6e6e6" start="2,1" stop="2,1"/>
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="Tableau3">
|
||||
<blockAlignment value="LEFT"/>
|
||||
@@ -26,8 +29,6 @@
|
||||
<blockAlignment value="LEFT"/>
|
||||
<blockValign value="TOP"/>
|
||||
<blockBackground colorName="#e6e6e6" start="0,0" stop="0,0"/>
|
||||
<blockBackground colorName="#e6e6e6" start="1,0" stop="1,0"/>
|
||||
<blockBackground colorName="#e6e6e6" start="2,0" stop="2,0"/>
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="Tableau4">
|
||||
<blockAlignment value="LEFT"/>
|
||||
@@ -44,6 +45,12 @@
|
||||
<blockTableStyle id="Tableau5">
|
||||
<blockAlignment value="LEFT"/>
|
||||
<blockValign value="TOP"/>
|
||||
<blockBackground colorName="#e6e6e6" start="0,0" stop="0,0"/>
|
||||
<blockBackground colorName="#e6e6e6" start="1,0" stop="1,0"/>
|
||||
<blockBackground colorName="#e6e6e6" start="2,0" stop="2,0"/>
|
||||
<blockBackground colorName="#e6e6e6" start="3,0" stop="3,0"/>
|
||||
<blockBackground colorName="#e6e6e6" start="4,0" stop="4,0"/>
|
||||
<blockBackground colorName="#e6e6e6" start="5,0" stop="5,0"/>
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="Tableau10">
|
||||
<blockAlignment value="LEFT"/>
|
||||
@@ -56,28 +63,27 @@
|
||||
<paraStyle name="P1" fontName="Times-Roman" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
|
||||
<paraStyle name="P2" fontName="Times-Bold" fontSize="20.0" leading="25" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
|
||||
<paraStyle name="P3" fontName="Times-Bold" fontSize="10.0" leading="13" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
|
||||
<paraStyle name="P4" fontName="Times-Roman" fontSize="10.0" leading="13" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
|
||||
<paraStyle name="P5" fontName="Times-Roman"/>
|
||||
<paraStyle name="P6" fontName="Times-Roman" fontSize="9.0" leading="11" alignment="CENTER"/>
|
||||
<paraStyle name="P7" fontName="Times-Bold" fontSize="10.0" leading="13" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
|
||||
<paraStyle name="P8" fontName="Times-Roman" fontSize="3.0" leading="4" alignment="LEFT"/>
|
||||
<paraStyle name="P9" fontName="Times-Roman" fontSize="8.0" leading="10" alignment="LEFT"/>
|
||||
<paraStyle name="P10" fontName="Times-Roman" fontSize="6.0" leading="8" alignment="LEFT"/>
|
||||
<paraStyle name="P11" fontName="Times-Roman" fontSize="8.0" leading="10" alignment="LEFT"/>
|
||||
<paraStyle name="P12" fontName="Times-Roman" fontSize="8.0" leading="10" alignment="RIGHT"/>
|
||||
<paraStyle name="P13" fontName="Times-Bold" fontSize="10.0" leading="13" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
|
||||
<paraStyle name="P14" fontName="Times-Roman" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
|
||||
<paraStyle name="P15" fontName="Times-Roman" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
|
||||
<paraStyle name="P16" fontName="Times-BoldItalic" fontSize="10.0" leading="13" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
|
||||
<paraStyle name="P17" fontName="Times-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
|
||||
<paraStyle name="P18" fontName="Times-Bold" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
|
||||
<paraStyle name="P19" fontName="Times-Roman" fontSize="6.0" leading="8" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
|
||||
<paraStyle name="P20" fontName="Times-Bold" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
|
||||
<paraStyle name="P21" fontName="Times-Bold" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
|
||||
<paraStyle name="P22" fontName="Times-Roman" fontSize="12.0" leading="15" alignment="CENTER"/>
|
||||
<paraStyle name="P4" fontName="Times-Bold" fontSize="10.0" leading="13" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
|
||||
<paraStyle name="P5" fontName="Times-Bold" fontSize="10.0" leading="13" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
|
||||
<paraStyle name="P6" fontName="Times-Roman" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
|
||||
<paraStyle name="P7" fontName="Times-Roman" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
|
||||
<paraStyle name="P8" fontName="Times-Bold" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
|
||||
<paraStyle name="P9" fontName="Times-Bold" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
|
||||
<paraStyle name="P10" fontName="Times-Bold" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
|
||||
<paraStyle name="P11" fontName="Times-Roman"/>
|
||||
<paraStyle name="P12" fontName="Times-Roman" fontSize="9.0" leading="11" alignment="CENTER"/>
|
||||
<paraStyle name="P13" fontName="Times-Roman" fontSize="3.0" leading="4" alignment="LEFT"/>
|
||||
<paraStyle name="P14" fontName="Times-Roman" fontSize="8.0" leading="10" alignment="LEFT"/>
|
||||
<paraStyle name="P15" fontName="Times-Roman" fontSize="6.0" leading="8" alignment="LEFT"/>
|
||||
<paraStyle name="P16" fontName="Times-Roman" fontSize="12.0" leading="15" alignment="CENTER"/>
|
||||
<paraStyle name="P17" fontName="Times-Roman" fontSize="8.0" leading="10" alignment="LEFT"/>
|
||||
<paraStyle name="P18" fontName="Times-Roman" fontSize="10.0" leading="13" alignment="LEFT"/>
|
||||
<paraStyle name="P19" fontName="Times-Roman" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
|
||||
<paraStyle name="P20" fontName="Times-Bold" fontSize="10.0" leading="13" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
|
||||
<paraStyle name="P21" fontName="Times-Roman" fontSize="10.0" leading="13" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
|
||||
<paraStyle name="P22" fontName="Times-Roman" fontSize="10.0" leading="13" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
|
||||
<paraStyle name="P23" fontName="Times-Bold" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
|
||||
<paraStyle name="P24" fontName="Times-Roman" fontSize="10.0" leading="13" alignment="LEFT"/>
|
||||
<paraStyle name="P25" fontName="Times-Roman" fontSize="10.0" leading="13" alignment="LEFT"/>
|
||||
<paraStyle name="P24" fontName="Times-Bold" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
|
||||
<paraStyle name="Standard" fontName="Times-Roman"/>
|
||||
<paraStyle name="Text body" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="List" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
@@ -87,107 +93,97 @@
|
||||
<paraStyle name="Index" fontName="Times-Roman"/>
|
||||
</stylesheet>
|
||||
<story>
|
||||
<blockTable colWidths="180.0,180.0,180.0" repeatRows="1" style="Tableau1">
|
||||
<blockTable colWidths="179.0,179.0,179.0" repeatRows="1" style="Tableau1">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="P1">[[ company.name ]]</para>
|
||||
<para style="P1">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P2">Cost Ledger</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P3">Period from [[ data['form']['date1'] ]]</para>
|
||||
<para style="P3">to [[ data['form']['date2'] ]]</para>
|
||||
<para style="P4">Currency: [[ company.currency_id.name ]]</para>
|
||||
<para style="P21">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<para style="P5">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<para style="P6">Printing date: [[ time.strftime('%Y-%m-%d') ]] at [[ time.strftime('%H:%M:%S') ]]</para>
|
||||
<para style="P6">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<blockTable colWidths="63.0,46.0,139.0,54.0,110.0,63.0,63.0" style="Tableau3">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="P7">Date</para>
|
||||
<para style="P1">[[ company.name ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P7">J.C.</para>
|
||||
<para style="P22">Period from [[ data['form']['date1'] ]]</para>
|
||||
<para style="P22">to [[ data['form']['date2'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P7">Entry name</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P7">Qty</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P7">Entries</para>
|
||||
<para style="P7">Debit Credit</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P7">Balance</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P7">Theorical Revenue</para>
|
||||
<para style="P21">Currency: [[ company.currency_id.name ]]</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<para style="P8">
|
||||
<para style="P11">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<para style="P12">Printing date: [[ time.strftime('%Y-%m-%d') ]] at [[ time.strftime('%H:%M:%S') ]]</para>
|
||||
<para style="P12">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<blockTable colWidths="63.0,46.0,139.0,54.0,55.0,55.0,63.0,63.0" style="Tableau3">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="P4">Date</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P4">J.C.</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P4">Move name</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P4">Qty</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P4">Debit </para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P4">Credit</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P4">Balance</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P4">Theorical Revenue</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<para style="P13">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<section>
|
||||
<para style="P9">[[ repeatIn(lines(objects,data['form']['date1'],data['form']['date2']),'o') ]]</para>
|
||||
<para style="P10">
|
||||
<para style="P14">[[ repeatIn(objects, 'o') ]]</para>
|
||||
<para style="P15">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<blockTable colWidths="82.0,228.0,228.0" style="Tableau2">
|
||||
<blockTable colWidths="539.0" style="Tableau2">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="P11">[[ o['code'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P11">[[ o['name'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P12">
|
||||
<font face="Times-Roman">max qty: [[ o['qty_max'] ]], max debit: [[ o['debit_max'] ]]</font>
|
||||
</para>
|
||||
<para style="P17"><font face="Times-Roman" size="8.0">[[ o.code ]] [[ o.name ]]: </font>max qty: [[ o.quantity_max or '-' ]], max amount: [[ o.amount_max or '-']]</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<para style="P8">
|
||||
<para style="P13">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<section>
|
||||
<para style="P10">[[ repeatIn(o['accounts'],'move_g') ]]</para>
|
||||
<para style="P8">
|
||||
<para style="P15">[[ repeatIn(lines_g(o.id, data['form']['date1'], data['form']['date2']), 'move_g') ]]</para>
|
||||
<para style="P13">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<blockTable colWidths="32.0,111.0,206.0,63.0,63.0,63.0" style="Tableau4">
|
||||
<blockTable colWidths="475.0,63.0" style="Tableau4">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="P13">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P13">[[ move_g['code'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P13">[[ move_g['name'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P3">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P3">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<para style="P5">[[ move_g['code'] ]] <font face="Times-Bold" size="10.0">[[ move_g['name'] ]]</font></para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P3">
|
||||
@@ -199,126 +195,110 @@
|
||||
<blockTable colWidths="63.0,46.0,139.0,55.0,53.0,57.0,63.0,63.0" style="Tableau7">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="P14">[[ repeatIn(move_g['lines'],'move_a') ]]</para>
|
||||
<para style="P14">[[ move_a['date'] ]]</para>
|
||||
<para style="P6">[[ repeatIn(lines_a(move_g['id'], o.id, data['form']['date1'], data['form']['date2']), 'move_a') ]]</para>
|
||||
<para style="P6">[[ move_a['date'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P15">[[ move_a['cj'] ]]</para>
|
||||
<para style="P7">[[ move_a['cj'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P14">[[ move_a['name'] ]]</para>
|
||||
<para style="P6">[[ move_a['name'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P15">[[ move_a['quantity'] ]]</para>
|
||||
<para style="P7">[[ '%.2f' % move_a['quantity'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P15">[[ move_a['debit'] ]]</para>
|
||||
<para style="P7">[[ '%.2f' % move_a['debit'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P15">[[ move_a['credit'] ]]</para>
|
||||
<para style="P7">[[ '%.2f' % move_a['credit'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P15">[[ '%.2f' % move_a['balance'] ]]</para>
|
||||
<para style="P7">[[ '%.2f' % move_a['balance'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P15">[[ '%.2f' % move_a['revenue'] ]]</para>
|
||||
<para style="P7">[[ '%.2f' % move_a['revenue'] ]]</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<blockTable colWidths="82.0,165.0,55.0,53.0,57.0,63.0,63.0" style="Tableau6">
|
||||
<blockTable colWidths="247.0,55.0,53.0,57.0,63.0,63.0" style="Tableau6">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="P16">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<para style="P8">Total ([[ move_g['name'] ]])</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P17">Sum of account [[ move_g['name'] ]]</para>
|
||||
<para style="P8">[[ '%.2f' % move_g['quantity'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P18">[[ move_g['quantity'] ]]</para>
|
||||
<para style="P8">[[ '%.2f' % move_g['debit'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P18">[[ move_g['debit'] ]]</para>
|
||||
<para style="P8">[[ '%.2f' % move_g['credit'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P18">[[ move_g['credit'] ]]</para>
|
||||
<para style="P8">[[ '%.2f' % move_g['balance'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P18">[[ move_g['balance'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P18">[[ move_g['revenue'] ]]</para>
|
||||
<para style="P8">[[ '%.2f' % (account_g_sum_revenue(move_g['id']) or 0.0) ]]</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<para style="P8">
|
||||
<para style="P13">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
</section>
|
||||
<blockTable colWidths="17.0,77.0,153.0,55.0,53.0,56.0,63.0,63.0" style="Tableau5">
|
||||
<blockTable colWidths="247.0,55.0,53.0,56.0,63.0,63.0" style="Tableau5">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="P19">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<para style="P24">Total ([[ o['code'] ]])</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P20">sum [[ o['code'] ]]</para>
|
||||
<para style="P10">[[ '%.2f' % (account_sum_qty(o.id, data['form']['date1'], data['form']['date2']) or 0.0) ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P20">[[ o['name'] ]]</para>
|
||||
<para style="P10">[[ '%.2f' % (account_sum_debit(o.id, data['form']['date1'], data['form']['date2']) or 0.0) ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P21">[[ o['quantity'] ]]</para>
|
||||
<para style="P10">[[ '%.2f' % (account_sum_credit(o.id, data['form']['date1'], data['form']['date2']) or 0.0) ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P21">[[ o['debit'] ]]</para>
|
||||
<para style="P10">[[ '%.2f' % (account_sum_balance(o.id, data['form']['date1'], data['form']['date2']) or 0.0) ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P21">[[ o['credit'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P21">[[ o['balance'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P21">[[ o['revenue'] ]]</para>
|
||||
<para style="P10">[[ '%.2f' % (account_sum_revenue(o.id) or 0.0) ]]</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<para style="P10">
|
||||
<para style="P15">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
</section>
|
||||
<para style="P22">
|
||||
<para style="P16">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<blockTable colWidths="247.0,55.0,53.0,56.0,63.0,64.0" style="Tableau10">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="P23">Sum</para>
|
||||
<para style="P9">Total</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P23">[[ totals['quantity'] ]]</para>
|
||||
<para style="P9">[[ '%.2f' % (sum_qty(objects, data['form']['date1'], data['form']['date2']) or 0.0) ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P23">[[ totals['debit'] ]]</para>
|
||||
<para style="P9">[[ '%.2f' % (sum_debit(objects, data['form']['date1'], data['form']['date2']) or 0.0) ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P23">[[ totals['credit'] ]]</para>
|
||||
<para style="P9">[[ '%.2f' % (sum_credit(objects, data['form']['date1'], data['form']['date2']) or 0.0) ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P23">[[ totals['balance'] ]]</para>
|
||||
<para style="P9">[[ '%.2f' % (sum_balance(objects, data['form']['date1'], data['form']['date2']) or 0.0) ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P23">[[ totals['revenue'] ]]</para>
|
||||
<para style="P9">[[ '%.2f' % (sum_revenue(objects) or 0.0) ]]</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<para style="P24">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<para style="P25">
|
||||
<para style="P18">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
</story>
|
||||
|
||||
Reference in New Issue
Block a user