conv_bal
watcha.h@almacom.co.th 2014-12-21 01:55:26 +07:00
parent 15e6f3d834
commit 2b0a6bbecd
10 changed files with 76 additions and 118 deletions

View File

@ -11,25 +11,27 @@
<field name="cycle_id" required="1"/> <field name="cycle_id" required="1"/>
<field name="date"/> <field name="date"/>
<tabs> <tabs>
<!--
<tab string="HDCase"> <tab string="HDCase">
<field name="hd_cases" nolabel="1" count="5"> <field name="hd_cases" nolabel="1" count="5">
<list model="clinic.hd.case" colors='{"#cfc":[["state","=","completed"]],"#f9e37d":[["state","=","in_progress"]],"#bcbbb9":[["state","=","cancelled"]],"#ACD1E9":[["state","=","waiting_payment"]],"#70DB93":[["state","=","paid"]]}'> <list model="clinic.hd.case" colors='{"#cfc":[["state","=","completed"]],"#f9e37d":[["state","=","in_progress"]],"#bcbbb9":[["state","=","cancelled"]],"#ACD1E9":[["state","=","waiting_payment"]],"#70DB93":[["state","=","paid"]]}'>
<field name="sickbed_id" domain="[['available','=',true]]" span="2"/> <field name="sickbed_id" domain="[['available','=',true]]" span="2"/>
<field name="patient_id" span="2"/> <field name="patient_id" span="2"/>
<!--<field name="time_start" span="2"/>--> <field name="time_start" span="2"/>
<field name="wt_start" span="2"/> <field name="wt_start" span="2"/>
<field name="bp_start" span="2"/> <field name="bp_start" span="2"/>
<field name="membrane_type" span="2"/> <field name="membrane_type" span="2"/>
<field name="vascular_acc" span="2"/> <field name="vascular_acc" span="2"/>
<field name="bid_flow_rate" span="2"/> <field name="bid_flow_rate" span="2"/>
<field name="ultrafittration" span="2"/> <field name="ultrafittration" span="2"/>
<!--<field name="time_stop" span="2"/>--> <field name="time_stop" span="2"/>
<field name="wt_stop" span="2"/> <field name="wt_stop" span="2"/>
<field name="bp_stop" span="2"/> <field name="bp_stop" span="2"/>
<field name="hd_case_id" span="2"/> <field name="hd_case_id" span="2"/>
</list> </list>
</field> </field>
</tab> </tab>
-->
<tab string="Nurses"> <tab string="Nurses">
<field name="nurses" nolabel="1"> <field name="nurses" nolabel="1">
<list> <list>

View File

@ -6,7 +6,7 @@
<item string="To Draft" method="to_draft" states="completed,cancelled"/> <item string="To Draft" method="to_draft" states="completed,cancelled"/>
</button> </button>
</head> </head>
<group form_layout="stacked"> <group form_layout="stacked" attrs='{"readonly":[["state","=","completed"]]}'>
<field name="number" span="2"/> <field name="number" span="2"/>
<field name="sickbed_id" domain="[['available','=',true]]" required="1" span="2"/> <field name="sickbed_id" domain="[['available','=',true]]" required="1" span="2"/>
<field name="patient_id" span="2" onchange="onchange_patient"/> <field name="patient_id" span="2" onchange="onchange_patient"/>
@ -19,7 +19,7 @@
</group> </group>
<tabs> <tabs>
<tab string="General"> <tab string="General">
<group form_layout="form"> <group form_layout="form" attrs='{"readonly":[["state","=","completed"]]}'>
<field name="time_start" span="2"/> <field name="time_start" span="2"/>
<field name="time_stop" span="2"/> <field name="time_stop" span="2"/>
<field name="duration" span="2"/> <field name="duration" span="2"/>
@ -37,7 +37,7 @@
<field name="membrane_type" span="2" /> <field name="membrane_type" span="2" />
<field name="bid_flow_rate" span="2"/> <field name="bid_flow_rate" span="2"/>
<field name="ultrafittration" span="2"/> <field name="ultrafittration" span="2"/>
<field name="dialyzers" nolabel="1"> <field name="dialyzers" nolabel="1" attrs='{"readonly":[["state","=","completed"]]}'>
<list> <list>
<field name="dialyzer_id" domain="[['patient_id','=',parent.patient_id],['state','=','active']]" onchange="onchange_dialyzer"/> <field name="dialyzer_id" domain="[['patient_id','=',parent.patient_id],['state','=','active']]" onchange="onchange_dialyzer"/>
<field name="dialyzer_type" span="2"/> <field name="dialyzer_type" span="2"/>
@ -52,9 +52,10 @@
<group span="12" form_layout="stacked"> <group span="12" form_layout="stacked">
<field name="lines" count="3" nolabel="1"> <field name="lines" count="3" nolabel="1">
<list> <list>
<field name="type" onchange="onchange_type"/>
<field name="product_id" onchange="onchange_product"/> <field name="product_id" onchange="onchange_product"/>
<field name="product_categ_id" onchange="onchange_line"/>
<field name="description"/> <field name="description"/>
<field name="reimbursable" onchange="onchange_line"/>
<field name="qty" onchange="onchange_line"/> <field name="qty" onchange="onchange_line"/>
<field name="uom_id"/> <field name="uom_id"/>
<field name="price" onchange="onchange_line"/> <field name="price" onchange="onchange_line"/>
@ -70,10 +71,9 @@
</group> </group>
</group> </group>
<group span="4" columns="1"> <group span="4" columns="1">
<field name="total"/> <field name="total_amount"/>
<field name="fee_amount"/> <field name="rmb_amount"/>
<field name="mdc_amount"/> <field name="due_amount"/>
<field name="srv_amount"/>
<field name="payment_lines" nolabel="1"> <field name="payment_lines" nolabel="1">
<template> <template>
{{#each context.data}} {{#each context.data}}
@ -88,14 +88,13 @@
{{/each}} {{/each}}
</template> </template>
</field> </field>
<field name="amount"/>
</group> </group>
</tab> </tab>
<tab string="Doctors"> <tab string="Doctors">
<field name="staffs" nolabel="1"> <field name="staffs" nolabel="1">
<list> <list>
<field name="type"/> <!--<field name="type" invisible="1"/>-->
<field name="staff_id" domain="[['type','=',type]]"/> <field name="staff_id" domain="[['type','=','doctor']]"/>
<field name="priop"/> <field name="priop"/>
<field name="note"/> <field name="note"/>
</list> </list>
@ -109,15 +108,15 @@
<field name="note" nolabel="1"/> <field name="note" nolabel="1"/>
</tab> </tab>
<tab string="Other"> <tab string="Other">
<field name="nurse_id" span="3"/> <field name="nurse_id" span="4"/>
<field name="fee_partner_id" span="3" domain="[['type','=','org']]"/> <field name="fee_partner_id" span="4" domain="[['type','=','org']]"/>
</tab> </tab>
</tabs> </tabs>
<foot> <foot>
<button string="Start" type="success" icon="arrow-right" method="do_treatment" states="draft,waiting_treatment"/> <button string="Start" type="success" icon="arrow-right" method="do_treatment" states="draft,waiting_treatment"/>
<button string="Done" type="success" icon="ok" method="done" states="in_progress"/> <button string="Done" type="success" icon="ok" method="done" states="in_progress"/>
<button string="Discontinue" type="danger" icon="remove" action="clinic_hd_case_distcont" states="in_progress"/> <button string="Discontinue" type="danger" icon="remove" action="clinic_hd_case_distcont" states="in_progress"/>
<button string="Request Fee" type="default" icon="arrow-right" states="completed" method="request_fee" attrs='{"invisible": [["req_fee","=",0]]}'/> <button string="Claim Expenses" type="default" icon="arrow-right" states="completed" method="request_fee" attrs='{"invisible": [["req_fee","=",1]]}'/>
<button string="Pay" type="success" icon="ok" method="pay" states="completed" attrs='{"invisible": [["req_fee","=",1]]}'/> <button string="Pay" type="success" icon="ok" method="pay" states="completed" attrs='{"invisible": [["req_fee","=",1]]}'/>
</foot> </foot>
<related> <related>

View File

@ -0,0 +1,5 @@
<inherit model="product.categ" inherit="prod_categ_form">
<field name="image" position="after">
<field name="expense"/>
</field>
</inherit>

View File

@ -0,0 +1,5 @@
<inherit model="product.categ" inherit="prod_categ_list">
<field name="parent_id" position="after">
<field name="expense"/>
</field>
</inherit>

View File

@ -81,3 +81,4 @@ from . import labor_cost_staff
from . import labor_cost_entry from . import labor_cost_entry
from . import labor_cost_entry_line from . import labor_cost_entry_line
from . import sickbed from . import sickbed
from . import product_categ

View File

@ -32,33 +32,21 @@ class HDCase(Model):
def _get_all(self,ids,context={}): def _get_all(self,ids,context={}):
vals={} vals={}
for obj in self.browse(ids): for obj in self.browse(ids):
total=0 total_amt=0
rmb_amt=0
due_amt=0 due_amt=0
fee_amt=0
mdc_amt=0
srv_amt=0
for line in obj.lines: for line in obj.lines:
if line.type=='fee': if line.reimbursable:
fee_amt+=line.amount or 0.0 rmb_amt+=line.amount or 0.0
elif line.type=='medicine':
mdc_amt+=line.amount or 0.0
elif line.type=='service':
srv_amt+=line.amount or 0.0
total+=line.amount or 0.0
if obj.invoice_policy=='fee':
due_amt=total-fee_amt
elif obj.invoice_policy=='fee_mdc':
due_amt=total-(fee_amt+mdc_amt)
else: else:
due_amt=total due_amt+=line.amount or 0.0
total_amt+=line.amount or 0.0
for line in obj.payment_lines: for line in obj.payment_lines:
due_amt-=line.amount or 0.0 due_amt-=line.amount or 0.0
vals[obj.id]={ vals[obj.id]={
"total": total, "total_amount": total_amt,
"amount": due_amt, "due_amount": due_amt,
'fee_amount': fee_amt, 'rmb_amount': rmb_amt,
'mdc_amount': mdc_amt,
'srv_amount': srv_amt,
'hd_case_id': obj.id, 'hd_case_id': obj.id,
} }
return vals return vals
@ -105,11 +93,9 @@ class HDCase(Model):
"expenes": fields.One2Many("clinic.hd.case.expense","hd_case_id","Expenses"), "expenes": fields.One2Many("clinic.hd.case.expense","hd_case_id","Expenses"),
'visit_id': fields.Many2One("clinic.visit", "Visit"), 'visit_id': fields.Many2One("clinic.visit", "Visit"),
'duration': fields.Integer("Duration (Hours)",function="_get_duration"), 'duration': fields.Integer("Duration (Hours)",function="_get_duration"),
"total": fields.Float("Total",function="_get_all",readonly=True,function_multi=True), "total_amount": fields.Float("Total",function="_get_all",readonly=True,function_multi=True),
"fee_amount": fields.Float("Fee",function="_get_all",readonly=True,function_multi=True), "rmb_amount": fields.Float("Reimbursable",function="_get_all",readonly=True,function_multi=True),
"mdc_amount": fields.Float("Medicine",function="_get_all",readonly=True,function_multi=True), "due_amount": fields.Float("Due Amount",function="_get_all",readonly=True,function_multi=True),
"srv_amount": fields.Float("Service",function="_get_all",readonly=True,function_multi=True),
"amount": fields.Float("Due Amount",function="_get_all",readonly=True,function_multi=True),
'fee_partner_id': fields.Many2One("partner","Contact Fee"), 'fee_partner_id': fields.Many2One("partner","Contact Fee"),
'fee_paid': fields.Boolean("Fee Paid"), 'fee_paid': fields.Boolean("Fee Paid"),
'note': fields.Text("Note"), 'note': fields.Text("Note"),
@ -250,6 +236,7 @@ class HDCase(Model):
prod=get_model("product").browse(product_id) prod=get_model("product").browse(product_id)
line['uom_id']=prod.uom_id.id line['uom_id']=prod.uom_id.id
line['description']=prod.name line['description']=prod.name
line['product_categ_id']=prod.categ_id.id
qty=1 qty=1
price=prod.sale_price or 0.0 price=prod.sale_price or 0.0
amt=qty*price amt=qty*price
@ -267,48 +254,21 @@ class HDCase(Model):
data['pay_amount']=0 data['pay_amount']=0
return data return data
def onchange_type(self,context={}):
data=self.onchange_policy(context)
return data
def onchange_policy(self,context={}):
data=context['data']
data=self.update_amount(context)
return data
def update_amount(self,context={}): def update_amount(self,context={}):
data=context['data'] data=context['data']
inv_pol=data['invoice_policy']
total=0.0
fee=0.0
mdc=0.0
srv=0.0
due_amt=0.0 due_amt=0.0
rmb_amt=0.0
for line in data['lines']: for line in data['lines']:
amt=line['amount'] or 0.0 amt=line['amount'] or 0.0
total+=amt reimbursable=line['reimbursable']
ltype=line['type'] if reimbursable=='yes':
if ltype=='fee': rmb_amt+=amt
fee+=amt
elif ltype=='medicine':
mdc+=amt
elif ltype=='service':
srv+=amt
elif ltype=='others':
pass
if inv_pol=='fee':
due_amt=total-fee
data['invoice_option']=''
elif inv_pol=='fee_mdc':
due_amt=total-fee-mdc
data['invoice_option']='fee_mdc_split'
else: else:
due_amt=total due_amt+=amt
data['total']=total print("xx ", rmb_amt, due_amt)
data['fee_amount']=fee data['rmb_amount']=rmb_amt
data['mdc_amount']=mdc data['due_amount']=due_amt
data['srv_amount']=srv data['total_amount']=due_amt+rmb_amt
data['amount']=due_amt
return data return data
def make_payment(self,ids,context={}): def make_payment(self,ids,context={}):
@ -630,6 +590,8 @@ class HDCase(Model):
return True return True
def do_expense(self,ids,context={}): def do_expense(self,ids,context={}):
return
#TODO
for obj in self.browse(ids): for obj in self.browse(ids):
# clear old expense # clear old expense
for exp in obj.expenes: for exp in obj.expenes:

View File

@ -11,10 +11,13 @@ class Hdcaseline(Model):
"price":fields.Float("Price"), "price":fields.Float("Price"),
"amount":fields.Float("Amount"), "amount":fields.Float("Amount"),
"type": fields.Selection([("fee","Fee"),('medicine','Medicine'),('service','Service'),("others","Others")],"Type",required=True), "type": fields.Selection([("fee","Fee"),('medicine','Medicine'),('service','Service'),("others","Others")],"Type",required=True),
"product_categ_id": fields.Many2One("product.categ","Category",domain=[['expense','=',True]]),
'reimbursable': fields.Selection([['yes','Yes'],['no','No']],"Reimbursable"),
} }
_defaults={ _defaults={
'type': 'others', 'type': 'others',
'reimbursable': False,
} }
Hdcaseline.register() Hdcaseline.register()

View File

@ -5,15 +5,15 @@ class HdCaseStaff(Model):
_name_field="staff_id" _name_field="staff_id"
_fields={ _fields={
"hd_case_id": fields.Many2One("clinic.hd.case","HdCase",required=True,on_delete="cascade"), "hd_case_id": fields.Many2One("clinic.hd.case","HdCase",required=True,on_delete="cascade"),
"staff_id": fields.Many2One("clinic.staff","Staff",search=True), "staff_id": fields.Many2One("clinic.staff","Doctor",search=True),
"type": fields.Selection([("doctor","Doctor"),('nurse','Nurse'),("staff","Staff")],"Type",required=True), "type": fields.Selection([("doctor","Doctor"),('nurse','Nurse'),("staff","Staff")],"Type",required=True),
"priop": fields.Selection([("owner","Owner"),('second','Secondary'),('other','Other')],"Priority"), "priop": fields.Selection([("owner","Owner"),('second','Secondary'),('other','Other')],"Priority"),
'note': fields.Char("Note"), 'note': fields.Char("Note"),
} }
_defaults={ _defaults={
'type': 'nurse', 'type': 'doctor',
'priop': 'other', 'priop': 'second',
} }
HdCaseStaff.register() HdCaseStaff.register()

View File

@ -0,0 +1,13 @@
from netforce.model import Model, fields
class ProductCateg(Model):
_inherit="product.categ"
_fields={
'expense': fields.Boolean("Expense"),
}
_defaults={
'expense': False,
}
ProductCateg.register()

View File

@ -1,35 +1,3 @@
===== categ_id
cycle item product_id
- list's nurse ca
- list hd case + U
- xxx
- change datetime
visit:
- confirm
- copy data to hdcase -> cycle item
=====
- design
1. create cycle item
=====
==== after midnight, create payment
====
if patient not do visit before treatment , how to do?
==
import payment
======
import payment
step:
1. check matching
2. prepare file to import
3. import
- find import
-
- change day schedue relate
======