clean
parent
deb6672b9d
commit
71eb85568b
|
@ -0,0 +1,6 @@
|
|||
<action>
|
||||
<field name="type">report_odt2</field>
|
||||
<field name="model">clinic.shop</field>
|
||||
<field name="method">get_data</field>
|
||||
<field name="template">cust_payment</field>
|
||||
</action>
|
|
@ -4,5 +4,5 @@
|
|||
<field name="model">clinic.matching.payment</field>
|
||||
<field name="report_template">matching_payment</field>
|
||||
<field name="report_template_xls">matching_payment</field>
|
||||
<field name="menu">clinic_menu</field>
|
||||
<field name="menu">account_menu</field>
|
||||
</action>
|
||||
|
|
|
@ -2,17 +2,18 @@
|
|||
<item string="Settings" position="before">
|
||||
<item string="Ratchawat">
|
||||
<item string="Labor Costs" action="clinic_labor_cost"/>
|
||||
<item string="Labor Cost Entries" action="clinic_labor_cost_entry"/>
|
||||
<!--<item string="Labor Cost Entries" action="clinic_labor_cost_entry"/>-->
|
||||
<item string="Payments Matching" action="clinic_matching_payment"/>
|
||||
<item string="HD Cases Matching" action="clinic_matching_hdcase_acc"/>
|
||||
<item string="HD Case Expenses" action="clinic_hd_case_expense"/>
|
||||
<!--<item string="HD Case Expenses" action="clinic_hd_case_expense"/>-->
|
||||
<divider/>
|
||||
<header string="REPORTS"/>
|
||||
<item string="Labor Cost Summary" action="clinic_report_labor_cost_summary"/>
|
||||
<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"/>
|
||||
<item string="Labor Cost Detail" action="clinic_report_labor_cost_detail"/>
|
||||
<!--<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/>
|
||||
<header string="OTHERS"/>
|
||||
<item string="Ratchawat Settings" action="clinic_account_setting"/>
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<field name="state"/>
|
||||
<button string="Options" dropdown="1">
|
||||
<item string="Copy" method="copy" states="active"/>
|
||||
<item string="To Draft" method="to_draft" states="active"/>
|
||||
<item string="To Draft" method="to_draft" states="drop,active"/>
|
||||
</button>
|
||||
</head>
|
||||
<group span="6" columns="1">
|
||||
|
|
|
@ -60,7 +60,6 @@
|
|||
<field name="lines" count="3" nolabel="1">
|
||||
<list>
|
||||
<field name="product_categ_id" onchange="onchange_line"/>
|
||||
<!--<field name="product_id" domain='[["categ_id.id","=",product_categ_id],["code","like",parent.type_code]]' onchange="onchange_product"/>-->
|
||||
<field name="product_id" domain='[["categ_id.id","=",product_categ_id],["patient_types.id","=",parent.patient_type_id]]' onchange="onchange_product"/>
|
||||
<field name="description"/>
|
||||
<field name="reimbursable" onchange="onchange_line"/>
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
<field name="total" string="Total" span="6" offset="6"/>
|
||||
</group>
|
||||
</tab>
|
||||
<tab string="Nurses">
|
||||
<tab string="Nurse Cost">
|
||||
<field name="nurse_lines" nolabel="1">
|
||||
<list>
|
||||
<field name="cycle_id"/>
|
||||
|
@ -46,7 +46,7 @@
|
|||
</field>
|
||||
<field name="total_ncost" string="Total" span="3" offset="9"/>
|
||||
</tab>
|
||||
<tab string="Doctors">
|
||||
<tab string="Doctor Cost">
|
||||
<field name="doctor_lines" nolabel="1">
|
||||
<list>
|
||||
<field name="cycle_id"/>
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
<item string="Import Payment" method="do_import" type="default"/>
|
||||
</button>
|
||||
</head>
|
||||
<separator string="1. Click Match > 2. Check Items > 3. Import Payment"/>
|
||||
<field name="date" onchange="onchange_date" mode="month" span="2"/>
|
||||
<field name="date_from" span="2"/>
|
||||
<field name="date_to" span="2"/>
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<form model="clinic.shop" attrs='{"readonly":[["state","in",["cancelled","paid","waiting_payment"]]]}' show_company="1">
|
||||
<head>
|
||||
<field name="state"/>
|
||||
<button string="Print" icon="print" action="clinic_cust_print" action_options="convert=pdf"/>
|
||||
<button string="Options" dropdown="1">
|
||||
<item string="To Draft" method="to_draft" states="paid"/>
|
||||
</button>
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
from . import clinic_setting
|
||||
from . import import_ar
|
||||
from . import import_acc
|
||||
|
|
|
@ -2,23 +2,21 @@ from netforce.model import get_model
|
|||
from netforce import migration
|
||||
|
||||
class Migration(migration.Migration):
|
||||
_name="import.ar"
|
||||
_name="import.acc"
|
||||
_version="2.10.0"
|
||||
|
||||
def migrate(self):
|
||||
cbv_id=24
|
||||
cbv=get_model("conv.bal").browse(cbv_id)
|
||||
cbv.write({
|
||||
'file': '',
|
||||
'file': 'tb.csv',
|
||||
})
|
||||
print("import acc file running ...")
|
||||
get_model("conv.bal").import_acc_file([cbv.id],context={})
|
||||
print("import sale file running ...")
|
||||
print("import acc file (step 1) running ...")
|
||||
cbv.write({
|
||||
'file': '',
|
||||
'file': 'ar.csv',
|
||||
})
|
||||
print("import sale file (step 2)running ...")
|
||||
get_model("conv.bal").import_sale_file([cbv.id],context={})
|
||||
print("Done! ", cbv.id, cbv.file)
|
||||
return True
|
||||
|
||||
Migration.register()
|
|
@ -1,144 +0,0 @@
|
|||
from netforce.model import get_model
|
||||
from netforce import migration
|
||||
from netforce.utils import get_file_path
|
||||
from netforce.access import get_active_user, set_active_user, set_active_company, get_active_company
|
||||
from . import utils
|
||||
|
||||
class Migration(migration.Migration):
|
||||
_name="import.pks"
|
||||
_version="2.10"
|
||||
|
||||
def import_visit(self,lines):
|
||||
visits={}
|
||||
cycles=[(c['id'],'%s:00'%c['time_start'],'%s:00'%c['time_stop']) for c in get_model("clinic.cycle").search_read([[]],['time_start','time_stop'])]
|
||||
for line in lines:
|
||||
hcode=line.get('hcode18')
|
||||
if not hcode:
|
||||
hcode='0'
|
||||
hcode=int(hcode)
|
||||
hcode=str(hcode)
|
||||
hcode_impt='23869'
|
||||
if hcode_impt==hcode:
|
||||
name=line.get("name14")
|
||||
patient_ids=get_model("clinic.patient").search([['name','=',name]])
|
||||
if patient_ids:
|
||||
patient_id=patient_ids[0]
|
||||
patient=get_model("clinic.patient").browse(patient_id)
|
||||
doctor=patient.doctor_id
|
||||
department=patient.department_id
|
||||
vals={
|
||||
'patient_id': patient.id,
|
||||
'doctor_id': doctor.id,
|
||||
'department_id': department.id,
|
||||
'state': 'pending',
|
||||
}
|
||||
# find cycle
|
||||
dttran=line.get("dttran")
|
||||
date=dttran[0:10]
|
||||
time=dttran[11:]
|
||||
if not time:
|
||||
continue
|
||||
cycle_id=None
|
||||
for cycle in cycles:
|
||||
time_start=cycle[1]
|
||||
time_stop=cycle[2]
|
||||
if time >= time_start:
|
||||
cycle_id=cycle[0]
|
||||
vals['cycle_id']=cycle_id
|
||||
vals['time_start']='%s %s'%(date,time_start)
|
||||
vals['time_stop']='%s %s'%(date,time_stop)
|
||||
if not cycle_id:
|
||||
raise Exception("not found cycle on this time %s %s %s"%(dttran, time_start,time_stop))
|
||||
visit_ids=get_model("clinic.visit").search([['visit_date','=',date],['patient_id','=',patient_id]])
|
||||
visit_id=None
|
||||
if not visit_ids:
|
||||
vals['visit_date']=date
|
||||
visit_id=get_model('clinic.visit').create(vals)
|
||||
#print('create visit ', visit_id, date)
|
||||
else:
|
||||
visit_id=visit_ids[0]
|
||||
#print('already ', date, ' ', name)
|
||||
if visit_id:
|
||||
visits.update({
|
||||
visit_id: {
|
||||
'hct': line.get('hct'),
|
||||
'epoadm29':line.get("epoadm29"), # SRV
|
||||
'amount23':line.get("amount23"), # FEE
|
||||
'allow37':line.get("allow37"), # EPO
|
||||
}
|
||||
})
|
||||
else:
|
||||
print("found ", name)
|
||||
return visits
|
||||
|
||||
def confirm_visit(self,visits):
|
||||
st=get_model("clinic.setting").browse(1)
|
||||
st.write({
|
||||
'auto_gen': True,
|
||||
})
|
||||
hd_case_ids=[]
|
||||
visit_ids=visits.keys()
|
||||
for visit in get_model('clinic.visit').browse(visit_ids):
|
||||
if visit!='confirmed':
|
||||
hd_case_id=visit.confirm()['next']['active_id']
|
||||
hd_case=get_model("clinic.hd.case").browse(hd_case_id)
|
||||
# lines
|
||||
vals={
|
||||
'hct': visits[visit.id]['hct'] or 0,
|
||||
'lines': [],
|
||||
}
|
||||
for st_prod in st.products:
|
||||
if st_prod.patient_type_id.id==3:
|
||||
prod=st_prod.product_id
|
||||
price=st_prod.price
|
||||
qty=st_prod.qty
|
||||
categ=st_prod.product_categ_id
|
||||
if categ.code=='FEE':
|
||||
amt=visits[visit.id]['amount23'] or 0
|
||||
elif categ.code=='SRV':
|
||||
amt=visits[visit.id]['epoadm29'] or 0
|
||||
elif categ.code=='EPO':
|
||||
amt=visits[visit.id]['allow37'] or 0
|
||||
else:
|
||||
amt=0
|
||||
vals['lines'].append(('create',{
|
||||
'product_id': prod.id,
|
||||
'uom_id': st_prod.uom_id.id,
|
||||
'product_categ_id': categ.id,
|
||||
'description': st_prod.description,
|
||||
'price': price,
|
||||
'qty': qty,
|
||||
'reimbursable': st_prod.reimbursable,
|
||||
'amount': amt,
|
||||
}))
|
||||
hd_case.write(vals)
|
||||
hd_case_ids.append(hd_case.id)
|
||||
st.write({
|
||||
'auto_gen': False,
|
||||
})
|
||||
return hd_case_ids
|
||||
|
||||
|
||||
def hdc_done(self,hd_case_ids):
|
||||
done_ids=[]
|
||||
for hd_case in get_model("clinic.hd.case").browse(hd_case_ids):
|
||||
if hd_case.state=='waiting_treatment':
|
||||
hd_case.complete()
|
||||
done_ids.append(hd_case.id)
|
||||
return done_ids
|
||||
|
||||
def migrate(self):
|
||||
fname='pks.xls'
|
||||
fpath=get_file_path(fname)
|
||||
lines=utils.read_excel(fpath,show_datetime=True)
|
||||
set_active_company(1)
|
||||
visits=self.import_visit(lines)
|
||||
print("visit ", len(visits))
|
||||
hd_case_ids=self.confirm_visit(visits)
|
||||
print('hd case ', len(hd_case_ids))
|
||||
hd_case_ids=self.hdc_done(hd_case_ids)
|
||||
print('Done ', len(hd_case_ids))
|
||||
set_active_company(1)
|
||||
return True
|
||||
|
||||
Migration.register()
|
|
@ -1,141 +0,0 @@
|
|||
from netforce.model import get_model
|
||||
from netforce import migration
|
||||
from netforce.utils import get_file_path
|
||||
from netforce.access import get_active_user, set_active_user, set_active_company, get_active_company
|
||||
from . import utils
|
||||
|
||||
class Migration(migration.Migration):
|
||||
_name="import.uc"
|
||||
_version="2.11"
|
||||
|
||||
def import_visit(self,lines):
|
||||
visits={}
|
||||
cycles=[(c['id'],'%s:00'%c['time_start'],'%s:00'%c['time_stop']) for c in get_model("clinic.cycle").search_read([[]],['time_start','time_stop'])]
|
||||
patients=get_model("clinic.patient").search_browse([])
|
||||
for line in lines:
|
||||
dttran=line.get("dttran")
|
||||
hn=line.get("hn")
|
||||
if hn:
|
||||
hn=''.join(x for x in hn if x.isdigit)
|
||||
|
||||
pid=None
|
||||
for pt in patients:
|
||||
if pt['hn_num']==hn:
|
||||
pid=pt.id
|
||||
break
|
||||
if not pid:
|
||||
print('continue ', pid)
|
||||
continue
|
||||
if dttran:
|
||||
date,time=dttran.split("T")
|
||||
if not time:
|
||||
continue
|
||||
cycle_id=None
|
||||
patient=get_model("clinic.patient").browse(pid)
|
||||
doctor=patient.doctor_id
|
||||
department=patient.department_id
|
||||
vals={
|
||||
'patient_id': patient.id,
|
||||
'doctor_id': doctor.id,
|
||||
'department_id': department.id,
|
||||
'state': 'pending',
|
||||
}
|
||||
for cycle in cycles:
|
||||
time_start=cycle[1]
|
||||
time_stop=cycle[2]
|
||||
if time >= time_start:
|
||||
cycle_id=cycle[0]
|
||||
vals['cycle_id']=cycle_id
|
||||
vals['time_start']='%s %s'%(date,time_start)
|
||||
vals['time_stop']='%s %s'%(date,time_stop)
|
||||
if not cycle_id:
|
||||
raise Exception("not found cycle on this time %s %s %s"%(dttran, time_start,time_stop))
|
||||
visit_ids=get_model("clinic.visit").search([['visit_date','=',date],['patient_id','=',pid]])
|
||||
visit_id=None
|
||||
if not visit_ids:
|
||||
vals['visit_date']=date
|
||||
visit_id=get_model('clinic.visit').create(vals)
|
||||
else:
|
||||
visit_id=visit_ids[0]
|
||||
if visit_id:
|
||||
visits.update({
|
||||
visit_id: {
|
||||
'hct': line.get('hct'),
|
||||
}
|
||||
})
|
||||
|
||||
pass
|
||||
return visits
|
||||
|
||||
def confirm_visit(self,visits):
|
||||
st=get_model("clinic.setting").browse(1)
|
||||
st.write({
|
||||
'auto_gen': True,
|
||||
})
|
||||
hd_case_ids=[]
|
||||
visit_ids=visits.keys()
|
||||
for visit in get_model('clinic.visit').browse(visit_ids):
|
||||
if visit!='confirmed':
|
||||
hd_case_id=visit.confirm()['next']['active_id']
|
||||
hd_case=get_model("clinic.hd.case").browse(hd_case_id)
|
||||
# lines
|
||||
vals={
|
||||
'hct': visits[visit.id]['hct'] or 0,
|
||||
'lines': [],
|
||||
}
|
||||
for st_prod in st.products:
|
||||
if st_prod.patient_type_id.id==3:
|
||||
prod=st_prod.product_id
|
||||
price=st_prod.price
|
||||
qty=st_prod.qty
|
||||
categ=st_prod.product_categ_id
|
||||
if categ.code=='FEE':
|
||||
amt=visits[visit.id]['amount23'] or 0
|
||||
elif categ.code=='SRV':
|
||||
amt=visits[visit.id]['epoadm29'] or 0
|
||||
elif categ.code=='EPO':
|
||||
amt=visits[visit.id]['allow37'] or 0
|
||||
else:
|
||||
amt=0
|
||||
vals['lines'].append(('create',{
|
||||
'product_id': prod.id,
|
||||
'uom_id': st_prod.uom_id.id,
|
||||
'product_categ_id': categ.id,
|
||||
'description': st_prod.description,
|
||||
'price': price,
|
||||
'qty': qty,
|
||||
'reimbursable': st_prod.reimbursable,
|
||||
'amount': amt,
|
||||
}))
|
||||
hd_case.write(vals)
|
||||
hd_case_ids.append(hd_case.id)
|
||||
st.write({
|
||||
'auto_gen': False,
|
||||
})
|
||||
return hd_case_ids
|
||||
|
||||
|
||||
def hdc_done(self,hd_case_ids):
|
||||
done_ids=[]
|
||||
for hd_case in get_model("clinic.hd.case").browse(hd_case_ids):
|
||||
if hd_case.state=='waiting_treatment':
|
||||
hd_case.complete()
|
||||
done_ids.append(hd_case.id)
|
||||
return done_ids
|
||||
|
||||
def migrate(self):
|
||||
#fname='22283_EURSTM_201406.xml'
|
||||
fname='22283_UOCDSTM_20140902.xml'
|
||||
fpath=get_file_path(fname)
|
||||
node='HDBills'
|
||||
lines=utils.read_xml(fpath,node=node)
|
||||
set_active_company(1)
|
||||
visits=self.import_visit(lines)
|
||||
print("visit ", len(visits))
|
||||
#hd_case_ids=self.confirm_visit(visits)
|
||||
#print('hd case ', len(hd_case_ids))
|
||||
#hd_case_ids=self.hdc_done(hd_case_ids)
|
||||
#print('Done ', len(hd_case_ids))
|
||||
return True
|
||||
|
||||
Migration.register()
|
|
@ -15,7 +15,7 @@ class Dialyzer(Model):
|
|||
"number": fields.Char("Number",required=True,search=True),
|
||||
'ref': fields.Char("Ref."),
|
||||
"note": fields.Text("Note",search=True),
|
||||
"date": fields.Date("Create Date",search=True),
|
||||
"date": fields.DateTime("Create Date",search=True),
|
||||
"use_time": fields.Integer("Use Time"),
|
||||
"max_use_time": fields.Integer("Max Use Time"),
|
||||
"exp_date": fields.Date("Expiry Date",search=True),
|
||||
|
@ -80,7 +80,7 @@ class Dialyzer(Model):
|
|||
|
||||
_defaults={
|
||||
"state": "new",
|
||||
"date": lambda *a: time.strftime("%Y-%m-%d"),
|
||||
"date": lambda *a: time.strftime("%Y-%m-%d %H:%M:%S"),
|
||||
'number': '/',
|
||||
"max_use_time": 10,
|
||||
"use_time": 0,
|
||||
|
@ -132,6 +132,7 @@ class Dialyzer(Model):
|
|||
pick_vals={
|
||||
"type": "out",
|
||||
'journal_id': stock_journal.id,
|
||||
'date': obj.date,
|
||||
"ref": obj.number,
|
||||
"related_id": "clinic.dialyzer,%s"%obj.id,
|
||||
"partner_id": obj.patient_id.partner_id.id,
|
||||
|
|
|
@ -33,7 +33,7 @@ class LaborCost(Model):
|
|||
total_a+=fline.var_a or 0
|
||||
total_b+=fline.var_b or 0
|
||||
var_ptx=total_case*(obj.var_k or 0)
|
||||
var_fml1='PTxK=%sX%s'%(total_a,total_b)
|
||||
var_fml1='PTxK=%sx%s'%(total_a,total_b)
|
||||
total_bstr=total_b < 0 and "+%s"%(abs(total_b)) or "-%s"%total_b
|
||||
var_x=0.0
|
||||
if total_a:
|
||||
|
@ -56,7 +56,7 @@ class LaborCost(Model):
|
|||
'var_pt': total_case,
|
||||
'var_ptx': total_case*(obj.var_k or 0),
|
||||
'var_fml1': '%s'%(var_fml1),
|
||||
'var_fml2': '%s=%sX%s'%(var_ptx,total_a,total_b),
|
||||
'var_fml2': '%s=%sx%s'%(var_ptx,total_a,total_b),
|
||||
'var_fml3': '(%s%s)/%s'%(var_ptx,total_bstr,total_a),
|
||||
'var_x': round(var_x,2),
|
||||
'total': total,
|
||||
|
|
|
@ -526,8 +526,10 @@ class MatchingPayment(Model):
|
|||
print("Done!")
|
||||
|
||||
def get_report_data(self,ids,context={}):
|
||||
obj=self.browse(ids)[0]
|
||||
lines=obj.match()
|
||||
lines=[]
|
||||
if ids:
|
||||
obj=self.browse(ids)[0]
|
||||
lines=obj.match()
|
||||
data={
|
||||
'lines': lines,
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ import time
|
|||
|
||||
from netforce.model import Model, fields, get_model
|
||||
from netforce.access import get_active_user, set_active_user, get_active_company
|
||||
from netforce.utils import get_data_path
|
||||
from netforce.utils import get_data_path, get_file_path
|
||||
|
||||
class Shop(Model):
|
||||
_name="clinic.shop"
|
||||
|
@ -460,4 +460,74 @@ class Shop(Model):
|
|||
},
|
||||
}
|
||||
|
||||
def get_bill(self,context={}):
|
||||
if not context.get('refer_id'):
|
||||
return {}
|
||||
shop_id=int(context['refer_id'])
|
||||
shop=self.browse(shop_id)
|
||||
comp_id=get_active_company()
|
||||
comp=get_model('company').browse(comp_id)
|
||||
st=get_model('settings').browse(1)
|
||||
addresses=st.addresses
|
||||
comp_addr=''
|
||||
if addresses:
|
||||
comp_addr=addresses[0].address_text
|
||||
cust=shop.contact_id
|
||||
cust_name=cust.name or ''
|
||||
cust_addr=''
|
||||
if cust.addresses:
|
||||
cust_addr=cust.addresses[0].address_text
|
||||
|
||||
#if cust_name.lower()=='walk
|
||||
if cust.walkin_cust:
|
||||
cust_name=shop.ref or ''
|
||||
no=1
|
||||
sub_total=0
|
||||
amount_total=0
|
||||
lines=[]
|
||||
for line in shop.lines:
|
||||
amt=line.amount or 0
|
||||
prod=line.product_id
|
||||
lines.append({
|
||||
'no': no,
|
||||
'product_name': prod.name or '',
|
||||
'description': line.description or '',
|
||||
'uom_name': line.uom_id.name or '',
|
||||
'qty': line.qty or 0,
|
||||
'price': line.price or 0,
|
||||
'amount': amt,
|
||||
})
|
||||
sub_total+=amt
|
||||
amount_total+=sub_total #XXX
|
||||
no+=1
|
||||
data={
|
||||
'comp_name': comp.name or '',
|
||||
'comp_addr': comp_addr or '',
|
||||
'number': shop.number or '',
|
||||
'ref': shop.ref,
|
||||
'date': shop.date,
|
||||
'cust_name': cust_name,
|
||||
'cust_addr': cust_addr,
|
||||
'lines':lines,
|
||||
'sub_total': sub_total,
|
||||
'amount_total': amount_total,
|
||||
}
|
||||
if comp.logo:
|
||||
data['logo']=get_file_path(comp.logo)
|
||||
return data
|
||||
|
||||
def get_data(self,ids,context={}):
|
||||
settings=get_model('settings').browse(1)
|
||||
pages=[]
|
||||
for obj in get_model('clinic.shop').browse(ids):
|
||||
context['refer_id']=obj.id
|
||||
data=get_model('clinic.shop').get_bill(context=context)
|
||||
pages.append(data)
|
||||
if pages:
|
||||
pages[-1]["is_last_page"]=True
|
||||
return {
|
||||
"pages": pages,
|
||||
"logo": get_file_path(settings.logo),
|
||||
}
|
||||
|
||||
Shop.register()
|
||||
|
|
Binary file not shown.
Loading…
Reference in New Issue