diff --git a/netforce_clinic/layouts/clinic_contact_form.xml b/netforce_clinic/layouts/clinic_contact_form.xml index 8f1ec91..10fa97c 100644 --- a/netforce_clinic/layouts/clinic_contact_form.xml +++ b/netforce_clinic/layouts/clinic_contact_form.xml @@ -3,6 +3,7 @@ + diff --git a/netforce_clinic/layouts/clinic_patient_form.xml b/netforce_clinic/layouts/clinic_patient_form.xml index f68c076..cb1df83 100644 --- a/netforce_clinic/layouts/clinic_patient_form.xml +++ b/netforce_clinic/layouts/clinic_patient_form.xml @@ -12,7 +12,7 @@ - + diff --git a/netforce_clinic/layouts/clinic_staff_form.xml b/netforce_clinic/layouts/clinic_staff_form.xml index 23c0b8c..61b389b 100644 --- a/netforce_clinic/layouts/clinic_staff_form.xml +++ b/netforce_clinic/layouts/clinic_staff_form.xml @@ -10,6 +10,7 @@ + diff --git a/netforce_clinic/migrations/import_acc.py b/netforce_clinic/migrations/import_acc.py index 113efbe..79f1a8d 100644 --- a/netforce_clinic/migrations/import_acc.py +++ b/netforce_clinic/migrations/import_acc.py @@ -1,39 +1,40 @@ from netforce.model import get_model from netforce import migration +from netforce.access import set_active_user, get_active_user class Migration(migration.Migration): _name="import.acc" _version="2.11.0" def migrate(self): - data={} - lines=get_model("conv.bal").search_browse([]) - for conv in lines: - if conv.id==24: - for invoice in conv.sale_invoices: - amount_due=invoice.amount_due or 0 - number=invoice.number or "" - if not data.get(number): - data[number]={'amount_due': amount_due} + #data={} + #lines=get_model("conv.bal").search_browse([]) + #for conv in lines: + #if conv.id==24: + #for invoice in conv.sale_invoices: + #amount_due=invoice.amount_due or 0 + #number=invoice.number or "" + #if not data.get(number): + #data[number]={'amount_due': amount_due} - f=open("/tmp/ar.csv","r") - res=f.read().split("\n") - total=0.0 - del res[0] - st="" - no=1 - for r in res: - r=r.split(",") - number=r[0] - if not data.get(number): - st+=','.join(r) - st+='\n' - print(no, 'XXX ', r) - no+=1 - f=open("res.csv","w") - f.write(st) - f.close() - print("diff ", total) + #f=open("/tmp/ar.csv","r") + #res=f.read().split("\n") + #total=0.0 + #del res[0] + #st="" + #no=1 + #for r in res: + #r=r.split(",") + #number=r[0] + #if not data.get(number): + #st+=','.join(r) + #st+='\n' + #print(no, 'XXX ', r) + #no+=1 + #f=open("res.csv","w") + #f.write(st) + #f.close() + #print("diff ", total) #cbv_id=24 #cbv=get_model("conv.bal").browse(cbv_id) @@ -46,6 +47,34 @@ class Migration(migration.Migration): #}) #print("import sale file (step 2)running ...") #get_model("conv.bal").import_sale_file([cbv.id],context={}) + #user_id=get_active_user() + #print("user_id ", user_id) + #set_active_user(1) + #cbv_id=24 + #print("create_open_entry...") + #cbv=get_model("conv.bal").browse(cbv_id) + #old={} + #for purchase in cbv.purch_invoices: + #number=purchase.number or '' + #print('number ', number) + #if not old.get(number): + #old.update({ + #'x': [number], + #}) + #else: + #x=old[number]['x'] + #number='%s.%s'%(number,len(x)) + #print('!!number ', number) + #purchase.write({ + #'number': number, + #}) + #x.append(number) + #cbv.create_open_entry() + #print("create_sale_invoices...") + #cbv.create_sale_invoices() + print("create_purch_invoices...") + cbv.create_purch_invoices() + print("Done!") return True Migration.register() diff --git a/netforce_clinic/models/matching_payment.py b/netforce_clinic/models/matching_payment.py index 4ecfb8c..f0e383c 100644 --- a/netforce_clinic/models/matching_payment.py +++ b/netforce_clinic/models/matching_payment.py @@ -80,6 +80,327 @@ class MatchingPayment(Model): raise Exception("No data to match") return lines + def match(self,ids,context={}): + obj=self.browse(ids)[0] + lines=obj.get_line() + matches1={} + matches2={} + matches3={} + matches4={} + dom=[] + dom.append(['date',">=",obj.date_from]) + dom.append(['date',"<=",obj.date_to]) + dom.append(['patient_id.type_id',"=",obj.patient_type_id.id]) + dom.append(['state','!=', 'completed']) + for exp in get_model('clinic.hd.case.expense').search_browse(dom): + patient=exp.patient_id + hn=patient.hn_no + pid=patient.card_no + pid=pid and pid or "" + name=patient.name or '' + name_check=name.replace(" ","") + date=exp.date or "" + lfee_amt=exp.fee_amt or 0 + lmdc_amt=exp.mdc_amt or 0 + lsrv_amt=exp.srv_amt or 0 + #hn + key1='%s:%s:%s:%s:%s'%( + hn, + date, + lfee_amt, + lsrv_amt, + lmdc_amt, + ) + # id card + key2='%s:%s:%s:%s:%s'%( + pid, + date, + lfee_amt, + lsrv_amt, + lmdc_amt, + ) + key3='%s:%s:%s:%s:%s'%( + name_check, + date, + lfee_amt, + lsrv_amt, + lmdc_amt, + ) + key4='%s:%s'%(name_check,date) + vals={ + 'pid': pid, + 'name': name, + 'date': date, + 'fee_amt': lfee_amt, + 'service_amt': lsrv_amt, + 'epo_amt': lmdc_amt, + 'hn': hn, + 'expense_id': exp.id, + } + if not matches1.get(key1): + matches1[key1]=vals + if not matches2.get(key2): + matches2[key2]=vals + if not matches3.get(key3): + matches3[key3]=vals + if not matches4.get(key3): + matches4[key4]=vals + nf_hcode='' + if obj.hcode_id: + nf_hcode=obj.hcode_id.code + records=[] + if obj.pcode=='SSO': + no=1 + for line in lines: + hcode=line.get('hcode18') + if not hcode: + hcode='0' + hcode=int(hcode) + hcode=str(hcode) + if nf_hcode==hcode: + lsrv_amt=line.get('epoadm29') or 0 + lfee_amt=line.get('amount23') or 0 + lmdc_amt=line.get('allow37') or 0 + dttran=line.get("dttran") + name=line.get("name14") + name2=name + name=name.replace(" ","") + pid=line.get('pid') + date=dttran[0:10] + time=dttran[11:] #XXX + if not time: + print("wrong format") + continue + hn=line.get('hn') + hn=''.join([x for x in hn if x.isdigit()]) + key1='%s:%s:%s:%s:%s'%( + hn, + date, + lfee_amt, + lsrv_amt, + lmdc_amt, + ) + key2='%s:%s:%s:%s:%s'%( + pid, + date, + lfee_amt, + lsrv_amt, + lmdc_amt, + ) + key3='%s:%s:%s:%s:%s'%( + name, + date, + lfee_amt, + lsrv_amt, + lmdc_amt, + ) + key4='%s:%s'%(name,date) + #vals={ + #'pid': pid, + #'name': name, + #'date': date, + #'fee_amt': lfee_amt, + #'service_amt': lsrv_amt, + #'epo_amt': lmdc_amt, + #} + record={ + 'no': no, + 'date':date, + 'patient_name': name2, + 'hn': hn, + 'fee_amt': lfee_amt, + 'srv_amt': lsrv_amt, + 'mdc_amt': lmdc_amt, + 'note': '', + 'nf_patient': '', + 'nf_pid': '', + 'nf_hn': '', + 'nf_fee_amt': 0, + 'nf_srv_amt': 0, + 'nf_mdc_amt': 0, + 'expense_id': None, + 'expense_number': '', + 'found': False, + } + if not matches1.get(key1): + if not matches2.get(key2): + if not matches4.get(key3): + notes=matches4.get(key4) + if notes: + print("not found") + record.update({ + 'nf_date': notes['date'], + 'nf_hn': notes['hn'], + 'nf_pid': notes['pid'], + 'nf_patient_name': notes['name'], + 'nf_fee_amt': notes['fee_amt'], + 'nf_srv_amt': notes['srv_amt'], + 'nf_mdc_amt': notes['mdc_amt'], + 'expense_id': notes['expense_id'], + 'expense_number': notes['expense_number'], + }) + else: + print(">> ", notes) + else: + print("found 3.") + # found 3. + found=matches3[key3] + record.update({ + 'expense_id': found['expense_id'], + }) + else: + # found 2. + print("found 2.") + found=matches2[key2] + record.update({ + 'expense_id': found['expense_id'], + }) + else: + # found 1. + found=matches1[key1] + print("found 1.") + record.update({ + 'expense_id': found['expense_id'], + 'expense_number': found['expense_number'], + 'found': True, + }) + records.append(record) + no+=1 + elif obj.pcode=='UC': + for line in lines: + #{'amount': '1500.0000', + #'cstat': None, + #'dttran': '2014-09-27T10:00:00', + #'epostat': 'E', + #'hdflag': 'COU', + #'hdrate': '1500.0000', + #'hn': '98511252', + #'hreg': 'NHSO1', + #'invno': '437941480', + #'paid': '0.0000', + #'paychk': '1', + #'reimbpay': '0.0000', + #'rid': '2190', + #'station': '01'} + date,time=(line['dttran'] or "").split("T") + amt=line['amount'] or "0" + amt=float(amt) + if date and time: + key1='%s-%s-%s'%( + line['hn'], + date, + amt, + ) + if not matches1.get(key1): + matches1[key1]={ + 'invno': line['invno'], + } + return records + + def onchange_date(self,context={}): + data=context['data'] + date=data['date'] + year,month,day=date.split("-") + weekday, total_day=monthrange(int(year), int(month)) + data['date_from']="%s-%s-01"%(year,month) + data['date_to']="%s-%s-%s"%(year,month,total_day) + return data + + def onchange_ptype(self,context={}): + data=context['data'] + type_id=data['patient_type_id'] + if type_id: + t=get_model('clinic.patient.type').browse(type_id) + data['pcode']=t.code or "" + return data + + def do_import(self,ids,context={}): + st=get_model("clinic.setting").browse(1) + if not st.import_account_id: + raise Exception("Import account not found (Ratchawat Setting -> Accounting)") + obj=self.browse(ids)[0] + if not obj.expenes: + raise Exception("Nothing to import") + + obj=self.browse(ids)[0] + partner=obj.patient_type_id.contact_id + company_id=get_active_company() + vals={ + "partner_id": partner.id, + "company_id": company_id, + "type": "in", + "pay_type": "invoice", + 'date': time.strftime("%Y-%m-%d"), + "account_id": st.import_account_id.id, + 'invoice_lines': [], + 'rd_cust': True, #XXX + } + + for exp in obj.expenes: + if exp.state=='match': + for inv in exp.hd_case_id.invoices: + if inv.partner_id.id==partner.id: + vals['invoice_lines'].append(('create',{ + 'invoice_id': inv.id, + 'amount': inv.amount_due or 0, + })) + #should not match again + exp.write({ + 'state': 'completed', + }) + hdcase=exp.hd_case_id + if hdcase: + hdcase.write({ + 'state': 'paid', + }) + + if not vals['invoice_lines']: + raise Exception("Nothing to import") + payment_id=get_model("account.payment").create(vals,context={"type":"in"}) + return { + 'next': { + 'name': 'payment', + 'mode': 'form', + 'active_id': payment_id, + }, + 'flash': 'Create Payment successfully', + } + + def update_id(self,ids,context={}): + obj=self.browse(ids)[0] + lines=obj.get_line() + pts={} + for line in lines: + pid=line.get("pid") + name=line.get("name14") + hn=line.get("hn") + if not pts.get(name): + pts[name]=pid + + for pt in get_model('clinic.patient').search_browse([]): + pid=pts.get(pt.name) + if pid: + if pt.card_no: + pid=''.join([str(x) for x in pt.card_no if x.isnumeric()]) + print(pt.name, 'pid ', pid) + else: + pid=int(pid) + print("pid ", pid) + pt.write({ + 'card_no': pid, + }) + print("Done!") + + def get_report_data(self,ids,context={}): + lines=[] + if ids: + obj=self.browse(ids)[0] + lines=obj.match() + data={ + 'lines': lines, + } + return data + def match_old(self,ids,context={}): obj=self.browse(ids)[0] lines=obj.get_line() @@ -246,293 +567,4 @@ class MatchingPayment(Model): 'flash': flash, } - def match(self,ids,context={}): - obj=self.browse(ids)[0] - lines=obj.get_line() - return lines - - matches1={} - matches2={} - matches3={} - dom=[] - dom.append(['date',">=",obj.date_from]) - dom.append(['date',"<=",obj.date_to]) - dom.append(['patient_id.type_id',"=",obj.patient_type_id.id]) - dom.append(['state','!=', 'completed']) - for exp in get_model('clinic.hd.case.expense').search_browse(dom): - hn=''.join([x for x in hn if x.isdigit()]) - key1='%s:%s:%s:%s:%s'%( - hn, - date, - lfee_amt, - lsrv_amt, - lmdc_amt, - ) - key2='%s:%s:%s:%s:%s'%( - pid, - date, - lfee_amt, - lsrv_amt, - lmdc_amt, - ) - key3='%s:%s:%s:%s:%s'%( - name, - date, - lfee_amt, - lsrv_amt, - lmdc_amt, - ) - vals={ - 'pid': pid, - 'name': name, - 'date': date, - 'fee_amt': lfee_amt, - 'service_amt': lsrv_amt, - 'epo_amt': lmdc_amt, - } - if not matches1.get(key1): - matches1[key1]=vals - if not matches2.get(key2): - matches2[key2]=vals - if not matches3.get(key3): - matches2[key2]=vals - if obj.pcode=='SSO': - for line in lines: - hcode=line.get('hcode18') - if not hcode: - hcode='0' - hcode=int(hcode) - hcode=str(hcode) - if obj.hcode==hcode: - lsrv_amt=line.get('epoadm29') or 0 - lfee_amt=line.get('amount23') or 0 - lmdc_amt=line.get('allow37') or 0 - dttran=line.get("dttran") - name=line.get("name14") - pid=line.get('pid') - date=dttran[0:10] - time=dttran[11:] #XXX - if not time: - print("wrong format") - continue - hn=line.get('hn') - hn=''.join([x for x in hn if x.isdigit()]) - key1='%s:%s:%s:%s:%s'%( - hn, - date, - lfee_amt, - lsrv_amt, - lmdc_amt, - ) - key2='%s:%s:%s:%s:%s'%( - pid, - date, - lfee_amt, - lsrv_amt, - lmdc_amt, - ) - key3='%s:%s:%s:%s:%s'%( - name, - date, - lfee_amt, - lsrv_amt, - lmdc_amt, - ) - vals={ - 'pid': pid, - 'name': name, - 'date': date, - 'fee_amt': lfee_amt, - 'service_amt': lsrv_amt, - 'epo_amt': lmdc_amt, - } - if not matches1.get(key1): - matches1[key1]=vals - if not matches2.get(key2): - matches2[key2]=vals - if not matches3.get(key3): - matches2[key2]=vals - - elif obj.pcode=='UC': - for line in lines: - #{'amount': '1500.0000', - #'cstat': None, - #'dttran': '2014-09-27T10:00:00', - #'epostat': 'E', - #'hdflag': 'COU', - #'hdrate': '1500.0000', - #'hn': '98511252', - #'hreg': 'NHSO1', - #'invno': '437941480', - #'paid': '0.0000', - #'paychk': '1', - #'reimbpay': '0.0000', - #'rid': '2190', - #'station': '01'} - date,time=(line['dttran'] or "").split("T") - amt=line['amount'] or "0" - amt=float(amt) - if date and time: - key1='%s-%s-%s'%( - line['hn'], - date, - amt, - ) - if not matches1.get(key1): - matches1[key1]={ - 'invno': line['invno'], - } - - for exp in get_model('clinic.hd.case.expense').search_browse(dom): - pt=exp.patient_id - if obj.pcode=='UC': - hdcase=exp.hd_case_id - date=hdcase.date - fee_amt=0 - for line in hdcase.lines: - categ=line.product_categ_id - if categ.code=='FEE': - fee_amt+=line.amount or 0 - key='%s-%s-%s'%(pt.hn_no,date,amt) - found=matches1.get(key) - if found: - exp.write({ - 'state': 'match', - }) - elif obj.pcode=='SSO': - key1='%s:%s:%s:%s:%s'%( - pt.hn_no, - exp.date, - exp.fee_amt and exp.fee_amt or 0, - exp.srv_amt and exp.srv_amt or 0, - exp.mdc_amt and exp.mdc_amt or 0, - ) - key2='%s:%s:%s:%s:%s'%( - pt.name or "", - exp.date, - exp.fee_amt and exp.fee_amt or 0, - exp.srv_amt and exp.srv_amt or 0, - exp.mdc_amt and exp.mdc_amt or 0, - ) - found=matches1.get(key1) or matches2.get(key2) - if found: - hdcase=exp.hd_case_id - exp.write({ - 'state': 'match', - }) - - flash='Done!' - return { - 'next': { - 'name': 'clinic_matching_payment', - 'mode': 'form', - 'active_id': obj.id, - }, - 'flash': flash, - } - - def onchange_date(self,context={}): - data=context['data'] - date=data['date'] - year,month,day=date.split("-") - weekday, total_day=monthrange(int(year), int(month)) - data['date_from']="%s-%s-01"%(year,month) - data['date_to']="%s-%s-%s"%(year,month,total_day) - return data - - def onchange_ptype(self,context={}): - data=context['data'] - type_id=data['patient_type_id'] - if type_id: - t=get_model('clinic.patient.type').browse(type_id) - data['pcode']=t.code or "" - return data - - def do_import(self,ids,context={}): - st=get_model("clinic.setting").browse(1) - if not st.import_account_id: - raise Exception("Import account not found (Ratchawat Setting -> Accounting)") - obj=self.browse(ids)[0] - if not obj.expenes: - raise Exception("Nothing to import") - - obj=self.browse(ids)[0] - partner=obj.patient_type_id.contact_id - company_id=get_active_company() - vals={ - "partner_id": partner.id, - "company_id": company_id, - "type": "in", - "pay_type": "invoice", - 'date': time.strftime("%Y-%m-%d"), - "account_id": st.import_account_id.id, - 'invoice_lines': [], - 'rd_cust': True, #XXX - } - - for exp in obj.expenes: - if exp.state=='match': - for inv in exp.hd_case_id.invoices: - if inv.partner_id.id==partner.id: - vals['invoice_lines'].append(('create',{ - 'invoice_id': inv.id, - 'amount': inv.amount_due or 0, - })) - #should not match again - exp.write({ - 'state': 'completed', - }) - hdcase=exp.hd_case_id - if hdcase: - hdcase.write({ - 'state': 'paid', - }) - - if not vals['invoice_lines']: - raise Exception("Nothing to import") - payment_id=get_model("account.payment").create(vals,context={"type":"in"}) - return { - 'next': { - 'name': 'payment', - 'mode': 'form', - 'active_id': payment_id, - }, - 'flash': 'Create Payment successfully', - } - - def update_id(self,ids,context={}): - obj=self.browse(ids)[0] - lines=obj.get_line() - pts={} - for line in lines: - pid=line.get("pid") - name=line.get("name14") - hn=line.get("hn") - if not pts.get(name): - pts[name]=pid - - for pt in get_model('clinic.patient').search_browse([]): - pid=pts.get(pt.name) - if pid: - if pt.card_no: - pid=''.join([str(x) for x in pt.card_no if x.isnumeric()]) - print(pt.name, 'pid ', pid) - else: - pid=int(pid) - print("pid ", pid) - pt.write({ - 'card_no': pid, - }) - print("Done!") - - def get_report_data(self,ids,context={}): - lines=[] - if ids: - obj=self.browse(ids)[0] - lines=obj.match() - data={ - 'lines': lines, - } - return data - MatchingPayment.register() diff --git a/netforce_clinic/models/partner.py b/netforce_clinic/models/partner.py index b65c44b..3d58e55 100644 --- a/netforce_clinic/models/partner.py +++ b/netforce_clinic/models/partner.py @@ -6,6 +6,7 @@ class Partner(Model): _fields={ 'walkin_cust': fields.Boolean("Walkin Customer"), 'is_patient': fields.Boolean("Is Patient"), + 'is_staff': fields.Boolean("Is Staff"), } Partner.register() diff --git a/netforce_clinic/models/setting.py b/netforce_clinic/models/setting.py index 16c3dbd..0f42dc1 100644 --- a/netforce_clinic/models/setting.py +++ b/netforce_clinic/models/setting.py @@ -110,12 +110,12 @@ class ClinicSetting(Model): if user_id !=1: print("Only admin!!") return - for pt in get_model("clinic.patient").search_browse([]): - partner=pt.partner_id - if partner: - partner.write({ - 'is_patient': True, - }) + + # try to create contact + for staff in get_model("clinic.staff").search_browse([]): + staff.write({ + 'note': ' ', + }) print("Done!") def reset_last_import(self,ids,context={}): diff --git a/netforce_clinic/models/staff.py b/netforce_clinic/models/staff.py index 0d660ea..424dc56 100644 --- a/netforce_clinic/models/staff.py +++ b/netforce_clinic/models/staff.py @@ -128,6 +128,7 @@ class Staff(Model): "hd_cases": fields.Many2Many("clinic.hd.case","HD Cases",function="_get_hdcase"), # not need to use (it's slow to load) "cycle_item_nurses": fields.One2Many("clinic.cycle.item.line","nurse_id","Cycle Items"), 'branch_id': fields.Many2One("clinic.branch","Branch", search=True), + "partner_id": fields.Many2One("partner","Contact"), } def _get_number(self,context={}): @@ -163,9 +164,39 @@ class Staff(Model): #_key=["name_check","branch_id"] #not working _sql_constraints=("clinic_staff_key_uniq","unique(name_check,branch_id)","name should be unique"), - _order="date desc,number desc" + def create_contact(self,name): + partner_id=get_model("partner").create({ + 'name': name, + 'last_name': name, + 'type': 'person', + 'is_staff': True, + }) + address_id=get_model('address').create({ + 'type': 'shipping', + 'partner_id': partner_id, + 'address': 'your address', + 'address2': 'your address2', + 'city': 'your city', + 'postal_code': 'your zip', + 'country_id': 1, + + }) + return partner_id, address_id + + def check_contact(self,name=""): + partner_id=None + dom=[ + ['name','=',name], + ['is_staff','=',True], + ] + for partner in get_model("partner").search_browse(dom): + if partner.name==name: + partner_id=partner.id + break + return partner_id + def check_emp(self,name="", employee_id=None): names=name.split(" ") first_name=names[0] @@ -194,8 +225,18 @@ class Staff(Model): emp_id=self.check_emp(name,employee_id) if emp_id: vals['employee_id']=emp_id + partner_id=get_model("clinic.staff").check_contact(name) + address_id=None + if not partner_id: + vals['partner_id'],address_id=self.create_contact(name) new_id=super().create(vals,**kw) self.function_store([new_id]) + if address_id: + addr=get_model('address').browse(address_id) + addr.write({ + 'partner_id': vals['partner_id'], + 'staff_id': new_id, + }) return new_id def write(self,ids,vals,**kw): @@ -206,8 +247,18 @@ class Staff(Model): emp_id=self.check_emp(name,obj.employee_id.id) if emp_id: vals['employee_id']=emp_id + partner_id=get_model("clinic.staff").check_contact(name) + address_id=None + if not partner_id: + vals['partner_id'],address_id=self.create_contact(name) self.function_store(ids) super().write(ids,vals,**kw) + if address_id: + addr=get_model('address').browse(address_id) + addr.write({ + 'partner_id': vals['partner_id'], + 'staff_id': ids[0], + }) def name_get(self,ids,context={}): vals=[] diff --git a/netforce_clinic/templates/matching_payment.hbs b/netforce_clinic/templates/matching_payment.hbs index fa213a9..0cc9c59 100644 --- a/netforce_clinic/templates/matching_payment.hbs +++ b/netforce_clinic/templates/matching_payment.hbs @@ -1,14 +1,27 @@ +

- - - - - - - - - + + + + + + + + + + + + + + + + + + + + + {{#each lines }} @@ -16,11 +29,17 @@ - - - + + - + + + + + + {{/each}} diff --git a/netforce_clinic/todo.txt b/netforce_clinic/todo.txt index 8d97bb0..2f31a54 100644 --- a/netforce_clinic/todo.txt +++ b/netforce_clinic/todo.txt @@ -1,7 +1,5 @@ todo: - -------- matching payment - - - ------- - + create contact from staff + - xxxx + script to clear invoice
#DateHNPatientEPO AmountService MedicalFee AmountHD CaseNote
Import FileNetforce
#DateHNPatientEPO AmountService MedicalFee AmountDateHNPatientEPO AmountService MedicalFee AmountExpense
{{no}} {{date}} {{hn}}{{view "link" string=patient_name action="clinic_patient" action_options="mode=form" active_id=patient_id}}{{currency epo_amt zero=""}}{{currency service_amt zero=""}}{{patient_name}} + {{currency mdc_amt zero=""}}{{currency srv_amt zero=""}} {{currency fee_amt zero=""}}{{note}}{{nf_date}}{{nf_hn}}{{nf_patient_name}} + {{currency nf_mdc_amt zero=""}}{{currency nf_srv_amt zero=""}}{{currency nf_fee_amt zero=""}}{{expense_number}}