From 5091739cecbebc672b401de0ac973ef2071001f2 Mon Sep 17 00:00:00 2001 From: "watcha.h" Date: Fri, 24 Apr 2015 15:35:57 +0700 Subject: [PATCH] fix account report --- .../models/report_account_hd_case_summary.py | 91 +++++++++--------- .../report_account_hd_case_summary.xlsx | Bin 5846 -> 7474 bytes .../report_account_hd_case_summary.hbs | 16 ++- 3 files changed, 59 insertions(+), 48 deletions(-) diff --git a/netforce_clinic/models/report_account_hd_case_summary.py b/netforce_clinic/models/report_account_hd_case_summary.py index bfab66b..0a2c9e2 100644 --- a/netforce_clinic/models/report_account_hd_case_summary.py +++ b/netforce_clinic/models/report_account_hd_case_summary.py @@ -110,27 +110,28 @@ class ReportAccountHDCaseSummary(Model): records={} cycles={} context['reimbursable']=reimbursable + categ_prods=[] + for cat_prod in get_model("product.categ").search_read([],['code']): + code=(cat_prod['code'] or "").lower() + categ_prods.append(code) for line in get_model("clinic.hd.case.line").search_browse(dom,context=context): hdcase=line.hd_case_id - items={} - amt=line.amount or 0 - categ=line.product_categ_id - code=(categ.code or "").lower() - if not code in items.keys(): - items[code]=[] - items[code].append({ - 'amount': amt, - }) - pm_number=','.join([pm.number for pm in hdcase.payments if pm.number]) + pm_numbers=[] + pm_id=None + for pm in hdcase.payments: + if pm.number: + pm_numbers.append(pm.number) + pm_id=pm.id #XXX + pm_number=','.join([pnum for pnum in pm_numbers]) prods={ 'yes': [], 'no': [], '': [], } #get the right invoice - for line in hdcase.lines: - prod=line.product_id - reim=line.reimbursable + for hline in hdcase.lines: + prod=hline.product_id + reim=hline.reimbursable if prod: prods[reim].append(prod.id) inv_number="" @@ -138,8 +139,8 @@ class ReportAccountHDCaseSummary(Model): inv_id=None for inv in hdcase.invoices: inv_prods=[] - for line in inv.lines: - prod=line.product_id + for inv_line in inv.lines: + prod=inv_line.product_id if prod: if prod.id in prods[reimbursable]: inv_prods.append(prod.id) @@ -158,15 +159,15 @@ class ReportAccountHDCaseSummary(Model): cycle_item=hdcase.cycle_item_id if cycle.id not in cycles.keys(): cycles[cycle.id]=[] - for line in cycle_item.lines: - nurse=line.nurse_id + for cline in cycle_item.lines: + nurse=cline.nurse_id cycles[cycle.id].append(nurse.name) vals={ 'hdcase_id': hdcase.id, 'number': hdcase.number or "", 'date': hdcase.date, 'hct': hdcase.hct or 0, - 'epo_name': hdcase.epo or 0, + 'epo_name': hdcase.epo or "", 'ptype': ptype.name or "", 'ptype_color': ptype.color or "default", 'dname': hdcase.doctor_id.name or "", @@ -177,39 +178,43 @@ class ReportAccountHDCaseSummary(Model): 'idcard': patient.card_no or "", 'cseq': cycle.sequence or 0, 'cycle_item_id': cycle_item.id, - 'pm_number': pm_number and pm_number or "-", - 'inv_number': inv_number and inv_number or "-", + 'pm_number': pm_number and pm_number or "", + 'pm_id': pm_id, + 'inv_number': inv_number and inv_number or "", 'inv_id': inv_id, - 'mdc': hdcase.mdc, 'mdc_name': hdcase.mdc_name, 'dlz_name': hdcase.dlz_name, 'dlz_id': hdcase.dlz_id and hdcase.dlz_id or 0, - 'dlz_price': hdcase.dlz_price, - 'lab': hdcase.lab, - 'misc': hdcase.misc, - 'inv_ref': inv_ref and inv_ref or "-", - 'pick_ref': pick_ref and pick_ref or "-", + 'inv_ref': inv_ref and inv_ref or "", + 'pick_ref': pick_ref and pick_ref or "", 'pick_id': pick_id, } - for code, item in items.items(): - vals.update({ - code: sum([t['amount'] for t in item]) - }) # merge 1 line of number - number=vals['number'] - if number not in records.keys(): - records[number]=vals - #FIXME please check - #else: - #for code, item in items.items(): - #if vals.get(code): - #if not records[number].get(code): - #records[number][code]=0 - #records[number][code]+=vals[code] - #records[number]['lab']+=vals['lab'] - #records[number]['misc']+=vals['misc'] + hdcase_id=vals['hdcase_id'] + if not records.get(hdcase_id): + for categ_prod in categ_prods: + vals[categ_prod]=0 + vals['misc']=0 + records[hdcase_id]=vals + amt=line.amount or 0 + categ=line.product_categ_id + if categ: + code=(categ.code or "").lower() + if code: + code=code.replace("epo","mdc") #XXX + records[hdcase_id][code]+=amt + else: + if categ.parent_id: + code=categ.parent_id.code or '' + if code: + code=code.lower() + records[hdcase_id][code]+=amt + else: + records[hdcase_id]['misc']+=amt + else: + records[hdcase_id]['misc']+=amt lines=[] - for hdnumber, vals in records.items(): + for hdcase_id, vals in records.items(): lines.append(vals) company_name=company.name or "" if department_id: diff --git a/netforce_clinic/reports/report_account_hd_case_summary.xlsx b/netforce_clinic/reports/report_account_hd_case_summary.xlsx index 931cf909c31b3e9001da4c9e9faf13df48144543..be763ec7268c0eb46ffc400dba41e8dfc8e55163 100644 GIT binary patch literal 7474 zcmeHMWmJ^y)+S|0>5icU1`vjnPD$zR?v#}7p+VxML8Ot892%riS{kIgrIq}^6M8)F zd4HVm@7c4~%rk4v-t*ko{p{<$_TGxJ@Cdjt0002STP#Ha<`+Y~zcz3(vvp>9`tV*B zKP&?e#tc35iFobh4#g8Ut!@b$Ntg2RPZ_v1;!b5Ha`o{F0%#ZKBgIPlo(yt}rOjiT zpG9OyMo2ik(`Jl{xhC|=eS>kaOVVPaF-Se6E<^L!wo$1zjSn>IS<-%38dgw)Paz*j3M5z0kKAZ&4=!!|UhgY^de?MoJM0-)Xq^EjfY<8Xvlo0? z(AB#;48M10MxNMvI;P#?oMds4;EEVW>o1I2O-7wFdOe>Zw=H%H=qzTqQI zz@jM?(+kVPV7OMff+M9w2hIG&6H?X8G~K z{(x1cnw-PjGt8F5_rOJ*Qhozndu@3qb&Nhy*;3AMCKu z)7zB8QGrVoAS;TY_fQGuUMSPabHv)Obe8R}3&k}eg>~xsn_YpXysEplY{Z#nwTh5B zEWvt%@Bp)7l=_aG;`U&!FnDITKMonq1PlgLAhjm>pJBgPB&xbG)F2&eRR*C4Bc)$2 zlTVpGYpm|(=Ofi0$j?E;!rRCm_`d$EG2tRIu!W*jD}Z>ujcwE7kS9SgLL$^JBfj5q z*uxRsabvtZ$D3ObVj{S~_{BiQJsSTO$%Nl07wy~XwxuqoNP^vovV+pyQbVV}`la|5 zcAQwR-%Uwr1#><#P`uI$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&+7 I{e9{G1E-3{{hn}} {{idcard}} {{ptype}} - {{pm_number}} - {{view "link" string=inv_number action="cust_invoice" action_options="form_view_xml&cust_invoice_form&mode=form" active_id=inv_id}} + {{#if pm_id}} + {{view "link" string=pm_number action="payment" action_options="mode=form" active_id=pm_id}} + {{/if}} + + + {{#if inv_id}} + {{view "link" string=inv_number action="cust_invoice" action_options="form_view_xml&cust_invoice_form&mode=form" active_id=inv_id}} + {{/if}} {{mdc_name}} {{currency fee zero=""}} @@ -90,13 +96,13 @@ {{currency misc zero=""}} {{currency dlz_price zero=""}} - {{view "link" string=inv_ref action="cust_invoice" action_options="form_view_xml&cust_invoice_form&mode=form" active_id=inv_id}} + {{#if inv_id}} + {{view "link" string=inv_ref action="cust_invoice" action_options="form_view_xml&cust_invoice_form&mode=form" active_id=inv_id}} + {{/if}} {{#if pick_id}} {{view "link" string=pick_ref action="pick_out" action_options="mode=form" active_id=pick_id}} - {{else}} - - {{/if}} {{else}}