conv_bal
watcha.h 2015-02-05 16:03:51 +07:00
parent 35ed3299cc
commit 64a075e131
11 changed files with 67 additions and 13 deletions

View File

@ -0,0 +1,5 @@
<inherit model="account.invoice" inherit="cust_invoice_form">
<field name="related_id" position="before">
<field name="department_id"/>
</field>
</inherit>

View File

@ -0,0 +1,5 @@
<inherit model="account.invoice" inherit="cust_invoice_list">
<field name="partner_id" position="after">
<field name="department_id"/>
</field>
</inherit>

View File

@ -1,4 +1,10 @@
<form model="clinic.matching.payment" title="Matching Payment">
<head>
<button string="Options" dropdown="1">
<item string="Update Identification" method="update_id"/>
<item string="Print Log" icon="print"/>
</button>
</head>
<tabs>
<tab string="General">
<separator string="1. Click Match > 2. Check Items > 3. Import Payment"/>

View File

@ -3,8 +3,9 @@
<button string="Generate Visit" action="clinic_gen_visit" type="success"/>
</head>
<field name="reg_date"/>
<field name="number"/>
<field name="hn_no"/>
<field name="trt_no"/>
<field name="card_no"/>
<field name="name"/>
<field name="type_id"/>
<field name="branch_id"/>

View File

@ -1,5 +1,6 @@
<form model="clinic.hd.case.payment">
<field name="hd_case_id" invisible="1"/>
<field name="bill_no"/>
<field name="pay_amount" onchange="onchange_amount"/>
<newline/>
<field name="to_pay" readonly="1"/>

View File

@ -108,7 +108,7 @@ class AccountPayment(Model):
'credit': rvals['credit'],
"track_id": track_id,
}))
lines=lines1+lines2
lines=lines1+lines2 #debit, credit
move=get_model("account.move").browse(move_id)
move.write({
'lines': lines,

View File

@ -317,7 +317,8 @@ class HDCase(Model):
if not income_account_id:
raise Exception("No Income Account")
pay_amount=obj.pay_amount
bill_no=context.get("bill_no", "")
if context.get("amount",0):
pay_amount=context['amount'] or 0.0
@ -330,7 +331,7 @@ class HDCase(Model):
'date': time.strftime("%Y-%m-%d"),
"account_id": cash_account_id,
'related_id': "clinic.hd.case,%s"%obj.id,
'ref': obj.number,
'ref': bill_no or obj.number or "",
'direct_lines': [],
}

View File

@ -9,6 +9,7 @@ class HDCasePayment(Model):
"pay_amount": fields.Float("Due Amount"),
"to_pay": fields.Float("To Pay"),
"complete": fields.Boolean("Mark as full payment for Cash"),
'bill_no': fields.Char("Bill No."),
}
def _get_hd_case_id(self,context={}):
@ -39,6 +40,7 @@ class HDCasePayment(Model):
hd_case=get_model("clinic.hd.case").browse(obj.hd_case_id.id)
context['amount']=obj.pay_amount or 0.0
context['is_credit']=False
context['bill_no']=obj.bill_no or ""
hd_case.make_invoices(context=context) #XXX
hd_case.post_invoices()
if obj.pay_amount:

View File

@ -208,9 +208,15 @@ class MatchingPayment(Model):
)
found=matches1.get(key1) or matches2.get(key2)
if found:
exp.write({
'state': 'match',
})
hdcase=exp.hd_case_id
if hdcase:
for inv in hdcase.invoices:
pass
#if
#pass
exp.write({
'state': 'match',
})
else:
note+="not found %s, %s\n"%(key1,key2)
obj.write({
@ -298,5 +304,30 @@ class MatchingPayment(Model):
},
'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!")
MatchingPayment.register()

View File

@ -42,9 +42,9 @@ class Patient(Model):
_fields={
'type_id': fields.Many2One("clinic.patient.type","Type",search=True,required=True),
"number": fields.Char("HN",required=True,search=True),
"trt_no": fields.Char("TRT. No",search=True),
"hn_no": fields.Char("HN Number",function="_get_hn_no"),
"number": fields.Char("HN Number",required=True,search=True),
"trt_no": fields.Char("TRT",search=True),
"hn_no": fields.Char("HN",function="_get_hn_no"),
"hn": fields.Char("REF/HN",search=False),
"name": fields.Char("Name",required=True,search=True),
"reg_date": fields.Date("Register Date",required=False,search=True),
@ -57,9 +57,9 @@ class Patient(Model):
'email': fields.Char("Email"),
"weight": fields.Float("Weight (kg.)"),
"height": fields.Float("Height (cm.)"),
"card_type": fields.Selection([("identification","Identification"),("passport","Passport")],"Card Type"),
'card_no' : fields.Char("Card Number"),
'card_exp' : fields.Date("Card Expire"),
"card_type": fields.Selection([("identification","Identification"),("passport","Passport")],"ID Type"),
'card_no' : fields.Char("ID",size=13),
'card_exp' : fields.Date("ID Exp."),
"app_no": fields.Char("Application No."),
"salary": fields.Selection([["20000","5,001-20,000"],["50000","20,001-50,000"],["100000","50,001-100,000"],["100001","100,000+"]], "Salary"),
"addresses": fields.One2Many("address","patient_id","Addresses"),

View File

@ -21,10 +21,12 @@ class ReportVisit(Model):
}
def _get_date_from(self,context={}):
return time.strftime("%Y-%m-%d")
year,month=time.strftime("%Y-%m").split("-")
return '%s-%s-01'%(year,month)
def _get_date_to(self,context={}):
return time.strftime("%Y-%m-%d")
year,month,day=time.strftime("%Y-%m-%d").split("-")
weekday, total_day=monthrange(int(year), int(month))
return "%s-%s-%s"%(year,month,total_day)