clean report
parent
331121f367
commit
b53bf0673c
|
@ -0,0 +1,11 @@
|
||||||
|
<action>
|
||||||
|
<field name="string">Matching Payment Group</field>
|
||||||
|
<field name="view_cls">multi_view</field>
|
||||||
|
<field name="model">clinic.matching.payment.group</field>
|
||||||
|
<field name="menu">account_menu</field>
|
||||||
|
<field name="tabs">[
|
||||||
|
["All",[]],
|
||||||
|
["Draft",[["state","=","draft"]]],
|
||||||
|
["Approved",[["state","=","approved"]]]
|
||||||
|
]</field>
|
||||||
|
</action>
|
|
@ -2,20 +2,15 @@
|
||||||
<item string="Settings" position="before">
|
<item string="Settings" position="before">
|
||||||
<item string="Ratchawat">
|
<item string="Ratchawat">
|
||||||
<item string="Labor Costs" action="clinic_labor_cost"/>
|
<item string="Labor Costs" action="clinic_labor_cost"/>
|
||||||
<!--<item string="Labor Cost Entries" action="clinic_labor_cost_entry"/>-->
|
<item string="Matching Payments" action="clinic_matching_payment"/>
|
||||||
<item string="Payments Matching" action="clinic_matching_payment"/>
|
<item string="Matching Payments (Group)" action="clinic_matching_payment_group"/>
|
||||||
<item string="HD Cases Matching" action="clinic_matching_hdcase_acc"/>
|
<item string="Mathing HD Cases" action="clinic_matching_hdcase_acc"/>
|
||||||
<!--<item string="HD Case Expenses" action="clinic_hd_case_expense"/>-->
|
|
||||||
<divider/>
|
<divider/>
|
||||||
<header string="REPORTS"/>
|
<header string="REPORTS"/>
|
||||||
<item string="Labor Cost Summary" action="clinic_report_labor_cost_summary"/>
|
<item string="Labor Cost Summary" action="clinic_report_labor_cost_summary"/>
|
||||||
<item string="Labor Cost Detail" action="clinic_report_labor_cost_detail"/>
|
<item string="Labor Cost Detail" action="clinic_report_labor_cost_detail"/>
|
||||||
<item string="Labor Cost Daily" action="clinic_report_labor_cost_daily"/>
|
<item string="Labor Cost Daily" action="clinic_report_labor_cost_daily"/>
|
||||||
<item string="Labor Cost Overtime" action="clinic_report_labor_cost_overtime"/>
|
<item string="Labor Cost Overtime" action="clinic_report_labor_cost_overtime"/>
|
||||||
<!--<item string="Staff" action="clinic_report_staff"/>-->
|
|
||||||
<!--<item string="Staff Fee" action="clinic_report_staff_fee"/>-->
|
|
||||||
<!--<item string="Staff Fee Detail" action="clinic_report_staff_fee_detail"/>-->
|
|
||||||
<!--<item string="Staff Fee Summary" action="clinic_report_staff_fee_sum"/>-->
|
|
||||||
<divider/>
|
<divider/>
|
||||||
<header string="OTHERS"/>
|
<header string="OTHERS"/>
|
||||||
<item string="Ratchawat Settings" action="clinic_account_setting"/>
|
<item string="Ratchawat Settings" action="clinic_account_setting"/>
|
||||||
|
|
|
@ -34,8 +34,8 @@
|
||||||
</group>
|
</group>
|
||||||
<group span="4" columns="1">
|
<group span="4" columns="1">
|
||||||
<field name="total"/>
|
<field name="total"/>
|
||||||
<field name="match_total"/>
|
<field name="total_match"/>
|
||||||
<field name="unmatch_total"/>
|
<field name="total_unmatch"/>
|
||||||
</group>
|
</group>
|
||||||
<foot replace="1">
|
<foot replace="1">
|
||||||
<button string="Match" method="do_match" type="success" icon='ok'/>
|
<button string="Match" method="do_match" type="success" icon='ok'/>
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
<form model="clinic.matching.payment.group" attrs='{"readonly":[["state","=","approved"]]}'>
|
||||||
|
<head>
|
||||||
|
<field name="state"/>
|
||||||
|
<button string="Print" action="print" icon="print"/>
|
||||||
|
<button string="Options" dropdown="1">
|
||||||
|
</button>
|
||||||
|
</head>
|
||||||
|
<field name="name" span="3"/>
|
||||||
|
<field name="lines" nolabel="1" count="0">
|
||||||
|
<list>
|
||||||
|
<field name="matching_id" onchange="onchange_matching"/>
|
||||||
|
<field name="epo"/>
|
||||||
|
<field name="srv"/>
|
||||||
|
<field name="fee"/>
|
||||||
|
<field name="amount"/>
|
||||||
|
</list>
|
||||||
|
</field>
|
||||||
|
<group span="8" columns="1">
|
||||||
|
</group>
|
||||||
|
<group span="4" columns="1">
|
||||||
|
<field name="total"/>
|
||||||
|
</group>
|
||||||
|
<foot>
|
||||||
|
<button string="Post" method="post" type="success"/>
|
||||||
|
</foot>
|
||||||
|
</form>
|
|
@ -0,0 +1,4 @@
|
||||||
|
<list model="clinic.matching.payment.group" colors='{"#cfc":[["state","=","approved"]],"#dbdbdb":[["state","=","cancelled"]]}'>
|
||||||
|
<field name="name"/>
|
||||||
|
<field name="state"/>
|
||||||
|
</list>
|
|
@ -103,6 +103,8 @@ from . import make_apt
|
||||||
from . import make_apt_line
|
from . import make_apt_line
|
||||||
from . import matching_payment
|
from . import matching_payment
|
||||||
from . import matching_payment_line
|
from . import matching_payment_line
|
||||||
|
from . import matching_payment_group
|
||||||
|
from . import matching_payment_group_line
|
||||||
from . import matching_hdcase
|
from . import matching_hdcase
|
||||||
from . import sale_order
|
from . import sale_order
|
||||||
from . import shop
|
from . import shop
|
||||||
|
|
|
@ -16,15 +16,24 @@ class MatchingPayment(Model):
|
||||||
def _get_all(self,ids,context={}):
|
def _get_all(self,ids,context={}):
|
||||||
res={}
|
res={}
|
||||||
for obj in self.browse(ids):
|
for obj in self.browse(ids):
|
||||||
match_total=0
|
total_match=0
|
||||||
|
total_fee=0
|
||||||
|
total_srv=0
|
||||||
|
total_epo=0
|
||||||
for line in obj.lines:
|
for line in obj.lines:
|
||||||
|
total_fee+=line.fee or 0
|
||||||
|
total_srv+=line.srv or 0
|
||||||
|
total_epo+=line.epo or 0
|
||||||
state=line.state or ''
|
state=line.state or ''
|
||||||
if state=='match':
|
if state=='match':
|
||||||
match_total+=1
|
total_match+=1
|
||||||
res[obj.id]={
|
res[obj.id]={
|
||||||
'total': len(obj.lines),
|
'total': len(obj.lines),
|
||||||
'match_total': match_total,
|
'total_match': total_match,
|
||||||
'unmatch_total': len(obj.lines)-match_total,
|
'total_unmatch': len(obj.lines)-total_match,
|
||||||
|
'total_fee': total_fee,
|
||||||
|
'total_srv': total_srv,
|
||||||
|
'total_epo': total_epo,
|
||||||
}
|
}
|
||||||
return res
|
return res
|
||||||
|
|
||||||
|
@ -39,9 +48,12 @@ class MatchingPayment(Model):
|
||||||
'hcode_id': fields.Many2One("clinic.hospital","HCode"),
|
'hcode_id': fields.Many2One("clinic.hospital","HCode"),
|
||||||
'lines': fields.One2Many("clinic.matching.payment.line","match_id", "Lines"),
|
'lines': fields.One2Many("clinic.matching.payment.line","match_id", "Lines"),
|
||||||
'note': fields.Text("Note"),
|
'note': fields.Text("Note"),
|
||||||
'match_total': fields.Integer("Match",function="_get_all",function_multi=True),
|
|
||||||
'unmatch_total': fields.Integer("Unmatch",function="_get_all",function_multi=True),
|
|
||||||
'total': fields.Integer("Total",function="_get_all",function_multi=True),
|
'total': fields.Integer("Total",function="_get_all",function_multi=True),
|
||||||
|
'total_match': fields.Integer("Match",function="_get_all",function_multi=True),
|
||||||
|
'total_unmatch': fields.Integer("Unmatch",function="_get_all",function_multi=True),
|
||||||
|
'total_fee': fields.Float("FEE",function="_get_all",function_multi=True),
|
||||||
|
'total_srv': fields.Float("Service",function="_get_all",function_multi=True),
|
||||||
|
'total_epo': fields.Float("EPO",function="_get_all",function_multi=True),
|
||||||
'state': fields.Selection([['draft','Draft'],['approved','Approved']],'State'),
|
'state': fields.Selection([['draft','Draft'],['approved','Approved']],'State'),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,66 @@
|
||||||
|
from netforce.model import Model, fields, get_model
|
||||||
|
from netforce.utils import get_data_path
|
||||||
|
|
||||||
|
class MatchingPaymentGroup(Model):
|
||||||
|
_name="clinic.matching.payment.group"
|
||||||
|
_string="Matching Payment Group"
|
||||||
|
|
||||||
|
def _get_all(self,ids,context={}):
|
||||||
|
res={}
|
||||||
|
for obj in self.browse(ids):
|
||||||
|
total=0
|
||||||
|
for line in obj.lines:
|
||||||
|
matching=line.matching_id
|
||||||
|
for mline in matching.lines:
|
||||||
|
total+=mline.fee or 0
|
||||||
|
total+=mline.srv or 0
|
||||||
|
total+=mline.epo or 0
|
||||||
|
res[obj.id]={
|
||||||
|
'total': total,
|
||||||
|
}
|
||||||
|
return res
|
||||||
|
|
||||||
|
_fields={
|
||||||
|
'name': fields.Char("Name",required=True),
|
||||||
|
'lines': fields.One2Many("clinic.matching.payment.group.line","group_matching_id", "Lines"),
|
||||||
|
'total': fields.Float("Total",function="_get_all",function_multi=True),
|
||||||
|
'state': fields.Selection([['draft','Draft'],['approved','Approved']],'State'),
|
||||||
|
}
|
||||||
|
|
||||||
|
_defaults={
|
||||||
|
'state': 'draft',
|
||||||
|
}
|
||||||
|
|
||||||
|
def post(self,ids,context={}):
|
||||||
|
for obj in self.browse(ids):
|
||||||
|
print("%s posted"%(obj.id))
|
||||||
|
return {
|
||||||
|
'next': {
|
||||||
|
'name': 'clinic_matching_payment_group',
|
||||||
|
'mode': 'form',
|
||||||
|
'active_id': obj.id,
|
||||||
|
},
|
||||||
|
'flash': 'Posted',
|
||||||
|
}
|
||||||
|
|
||||||
|
def update_amount(self,context={}):
|
||||||
|
data=context['data']
|
||||||
|
data['total']=0
|
||||||
|
for line in data['lines']:
|
||||||
|
data['total']+=line['amount'] or 0
|
||||||
|
return data
|
||||||
|
|
||||||
|
def onchange_matching(self,context={}):
|
||||||
|
data=context['data']
|
||||||
|
path=context['path']
|
||||||
|
line=get_data_path(data,path,parent=True)
|
||||||
|
matching_id=line['matching_id']
|
||||||
|
matching=get_model('clinic.matching.payment').browse(matching_id)
|
||||||
|
line['srv']=matching['total_srv'] or 0
|
||||||
|
line['epo']=matching['total_epo'] or 0
|
||||||
|
line['fee']=matching['total_fee'] or 0
|
||||||
|
line['amount']=line['fee']+line['epo']+line['srv']
|
||||||
|
data=self.update_amount(context=context)
|
||||||
|
return data
|
||||||
|
|
||||||
|
MatchingPaymentGroup.register()
|
|
@ -0,0 +1,28 @@
|
||||||
|
from netforce.model import Model, fields
|
||||||
|
|
||||||
|
class MatchingPaymentGroupLine(Model):
|
||||||
|
_name="clinic.matching.payment.group.line"
|
||||||
|
_string="Matching Payment Group Line"
|
||||||
|
|
||||||
|
def _get_all(self,ids,context={}):
|
||||||
|
res={}
|
||||||
|
for obj in self.browse(ids):
|
||||||
|
fee=obj.fee or 0
|
||||||
|
epo=obj.epo or 0
|
||||||
|
srv=obj.srv or 0
|
||||||
|
amount=fee+epo+srv
|
||||||
|
res[obj.id]={
|
||||||
|
'amount': amount,
|
||||||
|
}
|
||||||
|
return res
|
||||||
|
|
||||||
|
_fields={
|
||||||
|
'group_matching_id': fields.Many2One("clinic.matching.payment.group","Group Matching",required=True,on_delete="cascade"),
|
||||||
|
'matching_id': fields.Many2One("clinic.matching.payment","Group Matching"),
|
||||||
|
'fee': fields.Float("Fee"),
|
||||||
|
'srv': fields.Float("Service"),
|
||||||
|
'epo': fields.Float("EPO"),
|
||||||
|
'amount': fields.Float("Amount", function="_get_all", function_multi=True),
|
||||||
|
}
|
||||||
|
|
||||||
|
MatchingPaymentGroupLine.register()
|
|
@ -167,6 +167,15 @@ class ReportMedicalSummary(Model):
|
||||||
company=get_model('company').browse(company_id)
|
company=get_model('company').browse(company_id)
|
||||||
month_str=utils.MONTHS['th_TH'][int(month)]
|
month_str=utils.MONTHS['th_TH'][int(month)]
|
||||||
|
|
||||||
|
# remove zero
|
||||||
|
for line in lines:
|
||||||
|
#st=""
|
||||||
|
for sline in line['sub_lines']:
|
||||||
|
qty=sline['qty']
|
||||||
|
if not qty:
|
||||||
|
sline['qty']=''
|
||||||
|
#st+="%s"%(qty)
|
||||||
|
#print(st)
|
||||||
lines=sorted(lines, key=lambda x: x['prod_name'])
|
lines=sorted(lines, key=lambda x: x['prod_name'])
|
||||||
year=int(year)+543
|
year=int(year)+543
|
||||||
|
|
||||||
|
|
|
@ -132,7 +132,7 @@
|
||||||
</b>
|
</b>
|
||||||
</center>
|
</center>
|
||||||
</span>
|
</span>
|
||||||
<table class="table">
|
<table class="table table-bordered">
|
||||||
<thead>
|
<thead>
|
||||||
{{#each titles}}
|
{{#each titles}}
|
||||||
<th>{{name}}</th>
|
<th>{{name}}</th>
|
||||||
|
@ -141,7 +141,7 @@
|
||||||
<tbody>
|
<tbody>
|
||||||
{{#each medicals}}
|
{{#each medicals}}
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td style="width:20%;">
|
||||||
<a href="/ui#name=product&active_id={{prod_id}}&mode=form"> {{prod_name}} </a>
|
<a href="/ui#name=product&active_id={{prod_id}}&mode=form"> {{prod_name}} </a>
|
||||||
</td>
|
</td>
|
||||||
{{#each sub_lines}}
|
{{#each sub_lines}}
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
ประจำเดือน {{month}} {{year}}
|
ประจำเดือน {{month}} {{year}}
|
||||||
</h4>
|
</h4>
|
||||||
</center>
|
</center>
|
||||||
<table class="table">
|
<table class="table table-bordered">
|
||||||
<thead>
|
<thead>
|
||||||
{{#each titles}}
|
{{#each titles}}
|
||||||
<th>{{name}}</th>
|
<th>{{name}}</th>
|
||||||
|
@ -16,7 +16,7 @@
|
||||||
<tbody>
|
<tbody>
|
||||||
{{#each lines}}
|
{{#each lines}}
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td style="width:20%;">
|
||||||
<a href="/ui#name=product&active_id={{prod_id}}&mode=form"> {{prod_name}} </a>
|
<a href="/ui#name=product&active_id={{prod_id}}&mode=form"> {{prod_name}} </a>
|
||||||
</td>
|
</td>
|
||||||
{{#each sub_lines}}
|
{{#each sub_lines}}
|
||||||
|
|
Loading…
Reference in New Issue