conv_bal
watcha.h@almacom.co.th 2014-12-21 09:54:45 +07:00
parent 2b0a6bbecd
commit 3c4cdfa5ee
7 changed files with 30 additions and 17 deletions

View File

@ -12,9 +12,10 @@
<field name="products" nolabel="1">
<list>
<field name="patient_type_id"/>
<field name="type"/>
<field name="product_id" onchange="onchange_product"/>
<field name="product_categ_id"/>
<field name="description"/>
<field name="reimbursable"/>
<field name="uom_id"/>
<field name="price" onchange="onchange_setting_line"/>
<field name="qty" onchange="onchange_setting_line"/>
@ -22,15 +23,17 @@
</list>
<form>
<field name="patient_type_id"/>
<field name="type"/>
<field name="product_id"/>
<field name="product_categ_id"/>
<field name="description"/>
<field name="reimbursable"/>
<field name="uom_id"/>
<field name="price"/>
<field name="qty"/>
<field name="amount"/>
</form>
</field>
<!--
<separator string="Invoice Policy"/>
<field name="invoice_policies" nolabel="1">
<list>
@ -44,6 +47,7 @@
<field name="invoice_option"/>
</form>
</field>
-->
</group>
</tab>
<tab string="Labor Cost">

View File

@ -36,7 +36,7 @@ class HDCase(Model):
rmb_amt=0
due_amt=0
for line in obj.lines:
if line.reimbursable:
if line.reimbursable=='yes':
rmb_amt+=line.amount or 0.0
else:
due_amt+=line.amount or 0.0
@ -853,7 +853,7 @@ class HDCase(Model):
return res
def get_staff_fee(self,vals,patient_id=None):
def get_staff_line(self,vals,patient_id=None):
if not patient_id:
return vals
# staff
@ -882,13 +882,15 @@ class HDCase(Model):
amt=st_prod.amount
if not amt:
amt=qty*price
categ=st_prod.product_categ_id
vals['lines'].append(('create',{
'product_id': prod.id,
'uom_id': st_prod.uom_id.id,
'type': st_prod.type,
'product_categ_id': categ.id,
'description': st_prod.description,
'price': price,
'qty': qty,
'reimbursable': st_prod.reimbursable,
'amount': amt,
}))
# XXX need to get default
@ -916,18 +918,15 @@ class HDCase(Model):
def create(self,vals,**kw):
patient_id=vals['patient_id']
vals=self.get_staff_fee(vals,patient_id)
vals=self.get_invoice_policy(vals,patient_id)
vals=self.get_staff_line(vals,patient_id)
new_id=super().create(vals,**kw)
return new_id
def write(self,ids,vals,**kw):
patient_id=vals.get('patient_id')
vals=self.get_invoice_policy(vals,patient_id)
obj=self.browse(ids)[0]
super().write(ids,vals,**kw)
if not obj.amount:
vals['req_fee']=1 # to show button pay
super().write(ids,vals,**kw)
def approve(self,ids,context={}):
obj=self.browse(ids)[0]

View File

@ -17,7 +17,7 @@ class Hdcaseline(Model):
_defaults={
'type': 'others',
'reimbursable': False,
'reimbursable': 'no',
}
Hdcaseline.register()

View File

@ -54,6 +54,9 @@ class ClinicSetting(Model):
line['description']=prod.name
price=prod.sale_price or 0.0
line['price']=price
categ=prod.categ_id
if categ:
line['product_categ_id']=categ.id
qty=1
amt=qty*price
line['amount']=amt

View File

@ -6,8 +6,9 @@ class SettingProduct(Model):
_fields={
"setting_id": fields.Many2One("clinic.setting","Setting"),
"type": fields.Selection([("fee","Fee"),('medicine','Medicine'),('service','Service'),("others","Others")],"Type",required=True),
"patient_type_id": fields.Many2One("clinic.patient.type","Patient Type"),
"product_categ_id": fields.Many2One("product.categ","Category",domain=[['expense','=',True]]),
'reimbursable': fields.Selection([['yes','Yes'],['no','No']],"Reimbursable"),
'uom_id': fields.Many2One("uom","UOM", required=True),
"product_id": fields.Many2One("product","Product"),
'description': fields.Char("Description"),
@ -17,12 +18,13 @@ class SettingProduct(Model):
}
_defaults={
'type': 'fee',
'patient_type': 'sc',
#'type': 'fee',
#'patient_type': 'sc',
'qty': 1,
'reimbursable': 'no',
}
_order="patient_type_id,type"
_order="patient_type_id"
SettingProduct.register()

View File

@ -138,6 +138,7 @@ class VisitBoard(Model):
number='*(ยกเลิก)'
else:
number+='(ยกเลิก)'
print('sickbed_id ', sickbed_id)
line={
'number': number,
'hn_name': hn_name,
@ -194,7 +195,7 @@ class VisitBoard(Model):
line['cycle_name']=utils.date2thai(date,format='%(Td)s %(d)s %(Tm)s',lang="th_TH2"),
lines.insert(index,line)
dates.append(date)
if count==total_qty and not obj.patient_id:
if count==total_qty and not patient_id:
index+=1
# footer
line=empty_line.copy()

View File

@ -45,7 +45,11 @@
<td style="background-color:{{visit_color}}"><a href="/ui#name=clinic_patient&active_id={{patient_id}}&mode=form">{{patient_name}}</a></td>
<td style="background-color:{{visit_color}}">{{patient_type}}</td>
<td style="background-color:{{visit_color}}"><a href="/ui#name=clinic_staff&active_id={{doctor_id}}&mode=form">{{doctor_name}}</a></td>
<td style="background-color:{{visit_color}}"><a href="/ui#name=clinic_sickbed&active_id={{sickbed_id}}&mode=form">{{sickbed_name}}</a></td>
{{#if sickbed_id}}
<td style="background-color:{{visit_color}}"><a href="/ui#name=clinic_sickbed&active_id={{sickbed_id}}&mode=form">{{sickbed_name}}</a></td>
{{else}}
<td style="background-color:{{visit_color}}">{{sickbed_name}}</td>
{{/if}}
<td style="background-color:{{visit_color}}"><a href="/ui#name=clinic_hd_case&active_id={{hd_case_id}}&mode=form">{{hd_case_number}}</a></td>
<td style="background-color:{{visit_color}}">{{note}}</td>
{{/if}}