payment
parent
1286e1641d
commit
40f66dc7a2
|
@ -1,8 +0,0 @@
|
|||
<action>
|
||||
<field name="string">Report HD Dialy</field>
|
||||
<field name="view_cls">report</field>
|
||||
<field name="model">clinic.report.hd.dialy</field>
|
||||
<field name="report_template">report_hd_dialy</field>
|
||||
<field name="report_template_xls">report_hd_dialy</field>
|
||||
<field name="menu">clinic_menu</field>
|
||||
</action>
|
|
@ -1,8 +0,0 @@
|
|||
<action>
|
||||
<field name="string">Report HD Monthly</field>
|
||||
<field name="view_cls">report</field>
|
||||
<field name="model">clinic.report.hd.monthly</field>
|
||||
<field name="report_template">report_hd_monthly</field>
|
||||
<field name="report_template_xls">report_hd_monthly</field>
|
||||
<field name="menu">clinic_menu</field>
|
||||
</action>
|
|
@ -2,13 +2,13 @@
|
|||
<head>
|
||||
<field name="state"/>
|
||||
<button string="Options" dropdown="1">
|
||||
<item string="Print Payment" method="print_payment"/>
|
||||
<!--<item string="Print Payment" method="print_payment"/>-->
|
||||
</button>
|
||||
</head>
|
||||
<group span="6" columns="1">
|
||||
<field name="number"/>
|
||||
<field name="time_start"/>
|
||||
<field name="cycle_id"/>
|
||||
<field name="cycle_id" required="1"/>
|
||||
<field name="department_id"/>
|
||||
<field name="visit_id" readonly="1"/>
|
||||
</group>
|
||||
|
@ -29,7 +29,7 @@
|
|||
<field name="per_bp_stop"/>
|
||||
<field name="hct" onchange="onchange_hct"/>
|
||||
<newline/>
|
||||
<field name="hct_alert"/>
|
||||
<field offset="2" name="hct_msg" nolabel="1" readonly="1"/>
|
||||
<field name="dialyzers" nolabel="1">
|
||||
<list>
|
||||
<field name="dialyzer_id" domain="[['patient_id','=',parent.patient_id],['state','=','active']]" onchange="onchange_dialyzer"/>
|
||||
|
|
|
@ -31,7 +31,7 @@ from . import gen_visit
|
|||
from . import gen_visit_line
|
||||
from . import report_hd_detail
|
||||
from . import report_hd_summary
|
||||
from . import report_hd_madical
|
||||
from . import payment
|
||||
from . import input_data
|
||||
from . import report_hd_madical
|
||||
from . import translate
|
||||
#from . import translate
|
||||
|
|
|
@ -32,7 +32,6 @@ class HDcase(Model):
|
|||
"doctor_id": fields.Many2One("clinic.doctor","Doctor", required=False,search=True),
|
||||
"nurse_id": fields.Many2One("clinic.nurse","Nurse", required=True,search=True),
|
||||
"department_id": fields.Many2One("clinic.department", "Department",search=True),
|
||||
"cycle_id" : fields.Many2One("clinic.cycle","Cycle", required=True),
|
||||
"wh_start": fields.Float("Wt.Kg start"),
|
||||
"wh_stop": fields.Float("Wt.Kg stop"),
|
||||
"bp_start": fields.Integer("BP mmHG start"),
|
||||
|
@ -41,8 +40,8 @@ class HDcase(Model):
|
|||
"per_bp_stop": fields.Integer("/Per stop"),
|
||||
"epo_tn" : fields.Char("EpoTn (Drug name)"),
|
||||
"epo_unit" : fields.Integer("EpoUnit (Unit of Used drug)"),
|
||||
"hct": fields.Integer("HCT %", required=True),
|
||||
"hct_alert" : fields.Char("",readonly=True,function_multi=True),
|
||||
"hct": fields.Integer("HCT %"),
|
||||
"hct_msg" : fields.Char("HCT message"),
|
||||
"check_goverment_pay" : fields.Boolean("The Government Pay"),
|
||||
"check_personal_pay" : fields.Boolean("Pay yourself"),
|
||||
"state": fields.Selection([("draft","Draft"),("in_progress","In Progress"),("completed","Completed"),("discountinued","Discountinued"),("in_completed","In completed")],"Status",required=True),
|
||||
|
@ -101,10 +100,12 @@ class HDcase(Model):
|
|||
'nurse_id': _get_nurse,
|
||||
"number": _get_number,
|
||||
"company_id": lambda *a: get_active_company(),
|
||||
"fee": 1500,
|
||||
'hct': 0,
|
||||
'hct_msg': "Reimbursement of medicines : 1,125/Week",
|
||||
}
|
||||
_order="date desc,number desc"
|
||||
|
||||
|
||||
def onchange_dialyzer(self,context={}):
|
||||
data=context["data"]
|
||||
path=context["path"]
|
||||
|
@ -190,8 +191,8 @@ class HDcase(Model):
|
|||
settings=get_model("settings").browse(1)
|
||||
account_id=settings.account_receivable_id
|
||||
data['pay_account_id']=account_id.id
|
||||
pay_amount=total
|
||||
data['pay_amount']=pay_amount
|
||||
#pay_amount=total
|
||||
#data['pay_amount']=pay_amount
|
||||
return data
|
||||
|
||||
def onchange_pay(self,context={}):
|
||||
|
@ -234,7 +235,8 @@ class HDcase(Model):
|
|||
|
||||
payment_id=get_model("account.payment").create(vals,context={"type":"in"})
|
||||
obj.write({
|
||||
'pay_amount': remaining_amt-obj.pay_amount,
|
||||
#'pay_amount': remaining_amt-obj.pay_amount,
|
||||
'pay_amount': 0, # reset
|
||||
'payment_lines': [('create',{
|
||||
'payment_id': payment_id,
|
||||
'amount': obj.pay_amount,
|
||||
|
@ -249,13 +251,6 @@ class HDcase(Model):
|
|||
'flash': 'Pay OK',
|
||||
}
|
||||
|
||||
def onchange_hct(self,context={}):
|
||||
data=context['data']
|
||||
hct=data['hct']
|
||||
if(hct<=39):
|
||||
pass
|
||||
return data
|
||||
|
||||
def cancelled(self,ids,context={}):
|
||||
obj=self.browse(ids)[0]
|
||||
obj.write({" state":"cancelled"})
|
||||
|
@ -538,17 +533,16 @@ class HDcase(Model):
|
|||
|
||||
|
||||
def onchange_hct(self,context={}):
|
||||
print(">"*50)
|
||||
data=context['data']
|
||||
hct_alert=data.get("hct","")
|
||||
if(hct_alert<=36):
|
||||
data['hct_alert']="Reimbursement of medicines : 1,125/Week"
|
||||
elif(36<=hct_alert<=39):
|
||||
data['hct_alert']="Reimbursement of medicines : 750/Week"
|
||||
elif(hct_alert>39):
|
||||
data['hct_alert']="Can not be drawn"
|
||||
else:
|
||||
data['hct_alert']=""
|
||||
hct=data.get("hct",0)
|
||||
msg=""
|
||||
if(hct<=36):
|
||||
msg="Reimbursement of medicines : 1,125/Week"
|
||||
elif(hct>36 and hct<39):
|
||||
msg="Reimbursement of medicines : 750/Week"
|
||||
elif(hct>=39):
|
||||
msg="Can not be drawn"
|
||||
data['hct_msg']=msg
|
||||
return data
|
||||
|
||||
def undo(self,ids,context={}):
|
||||
|
@ -563,6 +557,11 @@ class HDcase(Model):
|
|||
'state': 'draft',
|
||||
})
|
||||
pick.delete()
|
||||
for payment in obj.payments:
|
||||
payment.to_draft()
|
||||
payment.delete()
|
||||
for pm_line in obj.payment_lines:
|
||||
pm_line.delete()
|
||||
|
||||
obj.write({
|
||||
'state': 'draft',
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import time
|
||||
import pprint
|
||||
|
||||
from netforce.model import Model, fields, get_model
|
||||
|
||||
|
|
|
@ -1,138 +0,0 @@
|
|||
import time
|
||||
|
||||
from netforce.model import Model, fields, get_model
|
||||
|
||||
class ReportHDDialy(Model):
|
||||
_name="clinic.report.hd.dialy"
|
||||
_string="Report HD Dialy"
|
||||
_transient=True
|
||||
|
||||
_fields={
|
||||
"patient_id" : fields.Many2One("clinic.patient","Patient"),
|
||||
"doctor_id" : fields.Many2One("clinic.doctor","Doctor"),
|
||||
"nurse_id" : fields.Many2One("clinic.nurse","Nurse"),
|
||||
"date_from": fields.Date("From"),
|
||||
"date_to": fields.Date("To"),
|
||||
"cycle_id": fields.Many2One("clinic.cycle","Cycle"),
|
||||
}
|
||||
|
||||
_defaults={
|
||||
'date_from': lambda *a: time.strftime("%Y-%m-%d"),
|
||||
'date_to': lambda *a: time.strftime("%Y-%m-%d"),
|
||||
}
|
||||
|
||||
_order="cycle_id desc"
|
||||
|
||||
|
||||
def get_report_data(self,ids,context={}):
|
||||
PATIENT_TYPE={
|
||||
"mg":"Medical Government",
|
||||
"sc":"Social Security",
|
||||
"nhso":"NHSO (30฿)",
|
||||
"personal": "Personal",
|
||||
"others": "Others",
|
||||
}
|
||||
|
||||
date_from=time.strftime("%Y-%m-%d")
|
||||
date_to=time.strftime("%Y-%m-%d")
|
||||
|
||||
defaults=context.get("defaults")
|
||||
if defaults.get("date_from"):
|
||||
date_from=defaults.get("date_from")
|
||||
if defaults.get("date_to"):
|
||||
date_to=defaults.get("date_to")
|
||||
|
||||
dom=[]
|
||||
dom.append(['state','=','completed'])
|
||||
if ids:
|
||||
obj=self.browse(ids)[0]
|
||||
if obj.date_from:
|
||||
date_from=obj.date_from
|
||||
if obj.date_to:
|
||||
date_to=obj.date_to
|
||||
if obj.cycle_id:
|
||||
dom.append([
|
||||
'cycle_id','=',obj.cycle_id.id,
|
||||
])
|
||||
if obj.patient_id:
|
||||
dom.append([
|
||||
'patient_id','=',obj.patient_id.id,
|
||||
])
|
||||
if obj.doctor_id:
|
||||
dom.append([
|
||||
'doctor_id','=',obj.doctor_id.id,
|
||||
])
|
||||
dom.append(['time_start', ">=", date_from+" 00:00:00"])
|
||||
dom.append(['time_stop',"<=", date_to+" 23:59:59"])
|
||||
|
||||
lines=[]
|
||||
cycles=[]
|
||||
index=0
|
||||
no_patient=0
|
||||
for hd_case in get_model("clinic.hd.case").search_browse(dom,order="cycle_id.sequence"):
|
||||
patient_type=hd_case.patient_id.type
|
||||
patient_type=PATIENT_TYPE.get(patient_type)
|
||||
cycle_name=hd_case.cycle_id.name or ""
|
||||
show_cycle=False
|
||||
if not cycle_name in cycles:
|
||||
cycles.append(cycle_name)
|
||||
show_cycle=True
|
||||
vals={
|
||||
'color': 'success',
|
||||
'show_cycle': False,
|
||||
'cycle' : "",
|
||||
'patient': "",
|
||||
'no_patient': no_patient,
|
||||
'patient_type' : "",
|
||||
'doctor' : "",
|
||||
'total' : "",
|
||||
'rc_no' : "",
|
||||
'dialyzer_name' : "",
|
||||
'nurse' : "",
|
||||
}
|
||||
lines.append(vals)
|
||||
no_patient=1
|
||||
else:
|
||||
no_patient+=1
|
||||
index+=1
|
||||
vals={
|
||||
'show_cycle': show_cycle,
|
||||
'cycle' : cycle_name,
|
||||
'patient': hd_case.patient_id.name,
|
||||
'patient_type' : patient_type,
|
||||
'no_patient': 0,
|
||||
'doctor' : hd_case.doctor_id.name,
|
||||
'total' : hd_case.fee,
|
||||
'rc_no' : hd_case.number,
|
||||
'dialyzer_name' : 'DZ-xxx',
|
||||
'nurse' : hd_case.nurse_id.name,
|
||||
}
|
||||
lines.append(vals)
|
||||
|
||||
# XXX
|
||||
if lines:
|
||||
vals={
|
||||
'color': 'success',
|
||||
'show_cycle': False,
|
||||
'cycle' : "",
|
||||
'patient': "",
|
||||
'no_patient': no_patient,
|
||||
'patient_type' : "",
|
||||
'doctor' : "",
|
||||
'total' : "",
|
||||
'rc_no' : "",
|
||||
'dialyzer_name' : "",
|
||||
'nurse' : "",
|
||||
}
|
||||
lines.append(vals)
|
||||
#XXX
|
||||
del lines[0]
|
||||
data={
|
||||
'lines': lines,
|
||||
'same_date': date_from==date_to,
|
||||
'date_from': date_from,
|
||||
'date_to': date_to,
|
||||
}
|
||||
return data
|
||||
|
||||
ReportHDDialy.register()
|
|
@ -1,117 +0,0 @@
|
|||
import time
|
||||
|
||||
from datetime import datetime
|
||||
from calendar import monthrange
|
||||
|
||||
from netforce.model import Model, fields, get_model
|
||||
|
||||
class ReportHDMonthly(Model):
|
||||
_name="clinic.report.hd.monthly"
|
||||
_string="Report HD Monthly"
|
||||
_transient=True
|
||||
|
||||
_fields={
|
||||
"date": fields.Date("Month", required=True),
|
||||
}
|
||||
|
||||
_defaults={
|
||||
'date': lambda *a: time.strftime("%Y-%m-%d"),
|
||||
}
|
||||
|
||||
def get_report_data(self,ids,context={}):
|
||||
date=datetime.now().strftime("%Y-%m-%d")
|
||||
datemonth=datetime.now().strftime("%m")
|
||||
if ids:
|
||||
obj=self.browse(ids)[0]
|
||||
date=obj.date
|
||||
year=int(date[0:4])
|
||||
month=int(date[5:7])
|
||||
month_str=datetime.strptime(date,'%Y-%m-%d').strftime("%B")
|
||||
next_month = str(month + 1)
|
||||
if next_month == 13:
|
||||
next_month = 12
|
||||
next_month_str=datetime.strptime(next_month,'%m').strftime("%B")
|
||||
|
||||
previous_month = str(month - 1)
|
||||
if previous_month == 0:
|
||||
previous_month = 12
|
||||
previous_month_str=datetime.strptime(previous_month,'%m').strftime("%B")
|
||||
|
||||
patients=get_model("clinic.patient").search_browse(['type','=','All'])
|
||||
patients_mg=get_model("clinic.patient").search_browse(['type','=','mg'])
|
||||
patients_sc=get_model("clinic.patient").search_browse(['type','=','sc'])
|
||||
patients_nhso=get_model("clinic.patient").search_browse(['type','=','nhso'])
|
||||
patients_pn=get_model("clinic.patient").search_browse(['type','=','personal'])
|
||||
|
||||
new_patients=0
|
||||
if datemonth==month:
|
||||
new_patients= len(patients)
|
||||
|
||||
weekday, total_day=monthrange(year, month)
|
||||
time_start='2014-%s-01 00:00:00'%(month)
|
||||
time_stop='2014-%s-%s 23:59:59'%(month,total_day)
|
||||
|
||||
dom=[]
|
||||
dom.append(['state','=','completed'])
|
||||
dom.append(['time_start','>=',time_start])
|
||||
dom.append(['time_stop','<=',time_stop])
|
||||
|
||||
hd_cases=get_model("clinic.hd.case").search_browse(dom)
|
||||
|
||||
lines=[
|
||||
{
|
||||
'topic': 'The number of times the Hemodialysis',
|
||||
'month': month_str,
|
||||
'amount': len(hd_cases),
|
||||
},
|
||||
|
||||
{
|
||||
'topic':'The number of cases brought',
|
||||
'month': previous_month_str,
|
||||
'amount': 'N/A',
|
||||
},
|
||||
{
|
||||
'topic':'Number of new patients',
|
||||
'month': month_str,
|
||||
'amount': new_patients,
|
||||
},
|
||||
{
|
||||
'topic':'Number of patients discharged',
|
||||
'month': month_str,
|
||||
'amount': 'N/A',
|
||||
},
|
||||
{
|
||||
'topic':'The number of cases brought',
|
||||
'month': next_month_str,
|
||||
'amount': 0,
|
||||
},
|
||||
{
|
||||
'topic':'Number of patients withdrawn Social Security',
|
||||
'month': '',
|
||||
'amount': len(patients_sc),
|
||||
},
|
||||
{
|
||||
'topic':'Number of patients withdrawn Medical Government',
|
||||
'month':'',
|
||||
'amount': len(patients_mg),
|
||||
},
|
||||
{
|
||||
'topic':'Number of patients withdrawn NHSO(30B)',
|
||||
'month':'',
|
||||
'amount': len(patients_nhso),
|
||||
},
|
||||
{
|
||||
'topic':'Many patients pay themselves',
|
||||
'month': '',
|
||||
'amount': len(patients_pn),
|
||||
},
|
||||
]
|
||||
|
||||
data={
|
||||
'month': month_str,
|
||||
'year': year,
|
||||
'lines': lines,
|
||||
}
|
||||
return data
|
||||
|
||||
ReportHDMonthly.register()
|
Loading…
Reference in New Issue