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

View File

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

View File

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

View File

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

View File

@ -6,8 +6,9 @@ class SettingProduct(Model):
_fields={ _fields={
"setting_id": fields.Many2One("clinic.setting","Setting"), "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"), "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), 'uom_id': fields.Many2One("uom","UOM", required=True),
"product_id": fields.Many2One("product","Product"), "product_id": fields.Many2One("product","Product"),
'description': fields.Char("Description"), 'description': fields.Char("Description"),
@ -17,12 +18,13 @@ class SettingProduct(Model):
} }
_defaults={ _defaults={
'type': 'fee', #'type': 'fee',
'patient_type': 'sc', #'patient_type': 'sc',
'qty': 1, 'qty': 1,
'reimbursable': 'no',
} }
_order="patient_type_id,type" _order="patient_type_id"
SettingProduct.register() SettingProduct.register()

View File

@ -138,6 +138,7 @@ class VisitBoard(Model):
number='*(ยกเลิก)' number='*(ยกเลิก)'
else: else:
number+='(ยกเลิก)' number+='(ยกเลิก)'
print('sickbed_id ', sickbed_id)
line={ line={
'number': number, 'number': number,
'hn_name': hn_name, '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"), line['cycle_name']=utils.date2thai(date,format='%(Td)s %(d)s %(Tm)s',lang="th_TH2"),
lines.insert(index,line) lines.insert(index,line)
dates.append(date) dates.append(date)
if count==total_qty and not obj.patient_id: if count==total_qty and not patient_id:
index+=1 index+=1
# footer # footer
line=empty_line.copy() 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}}"><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}}">{{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_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}}"><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> <td style="background-color:{{visit_color}}">{{note}}</td>
{{/if}} {{/if}}