import payment
parent
f8e99319b4
commit
d65ca9e339
|
@ -57,7 +57,6 @@
|
|||
<item string="Departments" action="clinic_department"/>
|
||||
<item string="Hospital" action="clinic_hospital"/>
|
||||
<item string="Nationalities" action="clinic_nation"/>
|
||||
<!--<item string="Period" action="clinic_period"/>-->
|
||||
<item string="Valcular Access" action="clinic_vascular_access"/>
|
||||
<item string="Clinic Settings" action="clinic_setting"/>
|
||||
<divider/>
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
<tabs>
|
||||
<tab string="Information">
|
||||
<field name="total_row" span="3" readonly="1"/>
|
||||
<field name="remain_row" span="3" readonly="1"/>
|
||||
<!--<field name="remain_row" span="3" readonly="1"/>-->
|
||||
<field name="match_qty" span="3" readonly="1"/>
|
||||
<field name="unmatch_qty" span="3" readonly="1"/>
|
||||
<newline/>
|
||||
|
|
|
@ -157,7 +157,7 @@ class ImportHDCase(Model):
|
|||
'total_row': len(lines),
|
||||
'remain_row': remain_row,
|
||||
'msg': msg,
|
||||
'done_qty': done_qty,
|
||||
'done_qty': done_qty-1,
|
||||
'fail_qty': fail_qty,
|
||||
})
|
||||
print("Done!")
|
||||
|
|
|
@ -26,7 +26,7 @@ class ImportPayment(Model):
|
|||
'file': fields.File("File"),
|
||||
'max_row': fields.Integer("Max Row"),
|
||||
'remain_row': fields.Integer("Pending"),
|
||||
'total_row': fields.Integer("Total Payment"),
|
||||
'total_row': fields.Integer("Total Record"),
|
||||
'est_time': fields.Float("Estimate Time",scale=4),
|
||||
'msg': fields.Text("Message"),
|
||||
'done_qty': fields.Integer("Success"),
|
||||
|
@ -152,8 +152,7 @@ class ImportPayment(Model):
|
|||
'patient_id': patient_id,
|
||||
}))
|
||||
unmatch_qty+=1
|
||||
|
||||
|
||||
|
||||
for mline in obj.match_lines:
|
||||
mline.delete()
|
||||
for umline in obj.unmatch_lines:
|
||||
|
@ -165,12 +164,11 @@ class ImportPayment(Model):
|
|||
remain_row=len(lines)-blank-did-count
|
||||
if remain_row <= 0:
|
||||
msg="Nothing to import"
|
||||
|
||||
obj.write({
|
||||
'total_row': len(lines),
|
||||
'remain_row': remain_row-match_qty,
|
||||
'msg': msg,
|
||||
'done_qty': match_qty,
|
||||
'done_qty': match_qty+unmatch_qty,
|
||||
'fail_qty': fail_qty,
|
||||
'match_qty': match_qty,
|
||||
'unmatch_qty': unmatch_qty,
|
||||
|
@ -178,7 +176,6 @@ class ImportPayment(Model):
|
|||
'match_lines': mlines,
|
||||
'unmatch_lines': umlines,
|
||||
})
|
||||
|
||||
print("Done!")
|
||||
|
||||
|
||||
|
|
|
@ -78,5 +78,13 @@ class ImportVisit(Model):
|
|||
else:
|
||||
print("found ", name)
|
||||
|
||||
return {
|
||||
'next': {
|
||||
'name': 'import_clinic_visit',
|
||||
'mode': 'form',
|
||||
'active_id': obj.id,
|
||||
},
|
||||
'flash': 'Create visit successully',
|
||||
}
|
||||
|
||||
ImportVisit.register()
|
||||
|
|
|
@ -1,161 +0,0 @@
|
|||
import time
|
||||
|
||||
from netforce.model import Model, fields, get_model
|
||||
from netforce.access import get_active_company
|
||||
from netforce.utils import get_file_path
|
||||
|
||||
from . import utils
|
||||
|
||||
class ImportPayment(Model):
|
||||
_name="clinic.import.payment"
|
||||
_transient=True
|
||||
|
||||
_fields={
|
||||
'date': fields.DateTime("Date"),
|
||||
'file': fields.File("File"),
|
||||
'result': fields.Text("Success"),
|
||||
'hcode': fields.Char("Hospital Code"),
|
||||
}
|
||||
|
||||
def get_hcode(self,context={}):
|
||||
settings=get_model("settings").browse(1)
|
||||
hcode=settings.hospital_code or ""
|
||||
return hcode
|
||||
|
||||
_defaults={
|
||||
'date': lambda *a: time.strftime("%Y-%m-%d %H:%M:%S"),
|
||||
'hcode': get_hcode,
|
||||
}
|
||||
|
||||
|
||||
def import_uc(self,ids,context={}):
|
||||
obj=self.browse(ids)[0]
|
||||
fname=obj.file
|
||||
fpath=get_file_path(fname)
|
||||
if not fpath:
|
||||
raise Exception("Please select file")
|
||||
lines=utils.read_xml(fpath,node='HDBills')
|
||||
if not lines:
|
||||
raise Exception("Wrong file")
|
||||
data_uc=get_model("clinic.data.uc")
|
||||
uc_ids=data_uc.search([])
|
||||
data_uc.delete(uc_ids)
|
||||
result=""
|
||||
result+="Match: %s"%(50)
|
||||
result+="\n"
|
||||
result+="*"*50
|
||||
for line in lines:
|
||||
# TODO need to check match or not
|
||||
data_uc.create(line)
|
||||
line['type']='success'
|
||||
print(line)
|
||||
result+="\n"
|
||||
result+="Not Match: %s"%(40)
|
||||
result+="\n"
|
||||
result+="*"*50
|
||||
obj.write({
|
||||
'result': result,
|
||||
})
|
||||
|
||||
def import_sc(self,ids,context={}):
|
||||
obj=self.browse(ids)[0]
|
||||
fname=obj.file
|
||||
fpath=get_file_path(fname)
|
||||
lines=utils.read_excel(fpath)
|
||||
if not lines:
|
||||
raise Exception("Wrong File")
|
||||
|
||||
patients={}
|
||||
for pt in get_model("clinic.patient").search_read([[]],['hn_num','name']):
|
||||
hn=pt['hn_num']
|
||||
if not hn:
|
||||
continue
|
||||
patients[hn]={
|
||||
'id': pt['id'],
|
||||
'name': pt['name'],
|
||||
}
|
||||
|
||||
def get_hn_nu(hn=""):
|
||||
return ''.join(x for x in hn if x.isdigit())
|
||||
|
||||
for line in lines:
|
||||
hcode=line.get('hcode18','0')
|
||||
if not hcode:
|
||||
hcode='0'
|
||||
hcode=int(hcode)
|
||||
hcode=str(hcode)
|
||||
if obj.hcode==hcode:
|
||||
invno=line.get("invno","")
|
||||
name=line.get("name14")
|
||||
hn=line.get('hn',"")
|
||||
hn_num=get_hn_nu(hn)
|
||||
hct=line.get("HCT","")
|
||||
amount=line.get("amount23",0)
|
||||
dttran=line.get("dttran","")
|
||||
|
||||
vals=patients.get(hn_num)
|
||||
if vals:
|
||||
#print(vals)
|
||||
pass
|
||||
else:
|
||||
print('not found ', hn, hn_num, name)
|
||||
#print(dttran, invno, hcode, hn, name, hct, amount)
|
||||
|
||||
def clear_sc(self,ids,context={}):
|
||||
sc_ids=get_model("clinic.data.sc").search([])
|
||||
get_model("clinic.data.sc").delete(sc_ids)
|
||||
obj=self.browse(ids)[0]
|
||||
obj.write({
|
||||
'result': 'Clear OK',
|
||||
})
|
||||
|
||||
def match_invoice_sc(self,ids,context={}):
|
||||
obj=self.browse(ids)[0]
|
||||
for sc in get_model("clinic.data.sc").search_browse([['type','=','match']]):
|
||||
for invoice in sc.hd_case_id.invoices:
|
||||
print(invoice.number)
|
||||
|
||||
obj.write({
|
||||
'result': 'Match OK',
|
||||
})
|
||||
|
||||
def approve_sc(self,ids,context={}):
|
||||
settings=get_model("settings").browse(1)
|
||||
account_id=settings.ap_sc_id.id
|
||||
if not account_id:
|
||||
raise Exception("No Account payment for Social Security")
|
||||
obj=self.browse(ids)[0]
|
||||
vals={
|
||||
'partner_id': '',
|
||||
"company_id": get_active_company(),
|
||||
"type": "in",
|
||||
"pay_type": "invoice",
|
||||
"date": obj.date or time.strftime("%Y-%m-%d"),
|
||||
"account_id": account_id,
|
||||
'invoice_lines': [],
|
||||
}
|
||||
invoice_ids=[]
|
||||
partner_id=None
|
||||
for sc in get_model("clinic.data.sc").search_browse([['type','=','match']]):
|
||||
if not partner_id:
|
||||
partner_id=sc.hd_case_id.fee_partner_id.id
|
||||
for invoice in sc.hd_case_id.invoices:
|
||||
invoice_ids.append(invoice.id)
|
||||
vals['invoice_lines'].append(('create',{
|
||||
'invoice_id': invoice.id,
|
||||
'amount': invoice.amount_due or 0.0,
|
||||
}))
|
||||
sc.delete() #XXX
|
||||
vals['partner_id']=partner_id
|
||||
payment_id=get_model("account.payment").create(vals,context={"type":"in"})
|
||||
#get_model("account.payment").browse(payment_id).post()
|
||||
return {
|
||||
'next': {
|
||||
'name': 'payment',
|
||||
'mode': 'form',
|
||||
'active_id': payment_id,
|
||||
},
|
||||
'flash': 'Paid',
|
||||
}
|
||||
|
||||
ImportPayment.register()
|
|
@ -3,7 +3,7 @@
|
|||
- missing hd case in staff (nurse, doctor)
|
||||
- special nurse
|
||||
- report for show max cycle and got cycle
|
||||
|
||||
- create journal entry
|
||||
===============
|
||||
|
||||
hd case
|
||||
|
|
Loading…
Reference in New Issue