....
commit
57f74cb0c7
|
@ -2,7 +2,7 @@
|
||||||
<field name="string">Treatments</field>
|
<field name="string">Treatments</field>
|
||||||
<field name="view_cls">multi_view</field>
|
<field name="view_cls">multi_view</field>
|
||||||
<field name="model">clinic.hd.case</field>
|
<field name="model">clinic.hd.case</field>
|
||||||
<field name="tabs">[["All",[]],["Draft",[["state","=","draft"]]],["In Progress",[["state","=","in_progress"]]],["Completed",[["state","=","completed"]]],["Uncompleted",[["state","=","uncompleted"]]]]</field>
|
<field name="tabs">[["All",[]],["Draft",[["state","=","draft"]]],["In Progress",[["state","=","in_progress"]]],["Completed",[["state","=","completed"]]],["In Completed",[["state","=","in_completed"]]]]</field>
|
||||||
<field name="modes">list,form</field>
|
<field name="modes">list,form</field>
|
||||||
<field name="menu">clinic_menu</field>
|
<field name="menu">clinic_menu</field>
|
||||||
</action>
|
</action>
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
<action>
|
||||||
|
<field name="string">Payment</field>
|
||||||
|
<field name="view_cls">form_popup</field>
|
||||||
|
<field name="model">clinic.payment</field>
|
||||||
|
<field name="target">_popup</field>
|
||||||
|
</action>
|
|
@ -2,7 +2,7 @@
|
||||||
<field name="string">Visits</field>
|
<field name="string">Visits</field>
|
||||||
<field name="view_cls">multi_view</field>
|
<field name="view_cls">multi_view</field>
|
||||||
<field name="model">clinic.visit</field>
|
<field name="model">clinic.visit</field>
|
||||||
<field name="tabs">[["All",[]],["Draft",[["state","=","draft"]]],["Waiting Treatment",[["state","=","waiting_treatment"]]],["Treatment",[["state","=","treatment"]]],["Cancelled",[["state","=","cancelled"]]]]</field>
|
<field name="tabs">[["All",[]],["Draft",[["state","=","draft"]]],["Confirmed",[["state","=","confirmed"]]],["Cancelled",[["state","=","cancelled"]]]]</field>
|
||||||
<field name="modes">list,calendar,form</field>
|
<field name="modes">list,calendar,form</field>
|
||||||
<field name="menu">clinic_menu</field>
|
<field name="menu">clinic_menu</field>
|
||||||
</action>
|
</action>
|
||||||
|
|
|
@ -23,8 +23,8 @@
|
||||||
</group>
|
</group>
|
||||||
<foot>
|
<foot>
|
||||||
<button string="Confirm" type="success" states="new" method="confirm"/>
|
<button string="Confirm" type="success" states="new" method="confirm"/>
|
||||||
<button string="Drop" type="danger" states="active" method="drop"/>
|
<button string="Drop" type="danger" icon="remove" states="active" method="drop"/>
|
||||||
<button string="Renew" type="primary" states="active" method="renew"/>
|
<button string="Renew" type="primary" icon="refresh" states="active" method="renew"/>
|
||||||
</foot>
|
</foot>
|
||||||
<related>
|
<related>
|
||||||
<field name="pickings" click_action="view_picking"/>
|
<field name="pickings" click_action="view_picking"/>
|
||||||
|
|
|
@ -2,16 +2,15 @@
|
||||||
<head>
|
<head>
|
||||||
<field name="state"/>
|
<field name="state"/>
|
||||||
<button string="Options" dropdown="1">
|
<button string="Options" dropdown="1">
|
||||||
<item string="TODO" method="todo"/>
|
<item string="Print Payment" method="print_payment"/>
|
||||||
</button>
|
</button>
|
||||||
</head>
|
</head>
|
||||||
<group span="6" columns="1">
|
<group span="6" columns="1">
|
||||||
<field name="number"/>
|
<field name="number"/>
|
||||||
<field name="time_start"/>
|
<field name="time_start"/>
|
||||||
<field name="cycle_id"/>
|
<field name="cycle_id"/>
|
||||||
<field name="nurse_id"/>
|
|
||||||
<field name="visit_id"/>
|
|
||||||
<field name="department_id"/>
|
<field name="department_id"/>
|
||||||
|
<field name="visit_id"/>
|
||||||
</group>
|
</group>
|
||||||
<group span="6" columns="1">
|
<group span="6" columns="1">
|
||||||
<field name="patient_id" onchange="onchange_patient"/>
|
<field name="patient_id" onchange="onchange_patient"/>
|
||||||
|
@ -28,10 +27,10 @@
|
||||||
<field name="per_bp_start"/>
|
<field name="per_bp_start"/>
|
||||||
<field name="bp_stop"/>
|
<field name="bp_stop"/>
|
||||||
<field name="per_bp_stop"/>
|
<field name="per_bp_stop"/>
|
||||||
<field name="hct"/>
|
<field name="hct" onchange="onchange_hct"/>
|
||||||
<field name="dialyzers" nolabel="1">
|
<field name="dialyzers" nolabel="1">
|
||||||
<list>
|
<list>
|
||||||
<field name="dialyzer_id" domain="[['patient_id','=',parent.patient_id]]" onchange="onchange_dialyzer"/>
|
<field name="dialyzer_id" domain="[['patient_id','=',parent.patient_id],['state','=','active']]" onchange="onchange_dialyzer"/>
|
||||||
<field name="description"/>
|
<field name="description"/>
|
||||||
<field name="use_time"/>
|
<field name="use_time"/>
|
||||||
<field name="max_use_time"/>
|
<field name="max_use_time"/>
|
||||||
|
@ -43,6 +42,29 @@
|
||||||
</list>
|
</list>
|
||||||
</field>
|
</field>
|
||||||
</tab>
|
</tab>
|
||||||
|
<tab string="Fees">
|
||||||
|
<field name="gm_lines" count="3" nolabel="1">
|
||||||
|
<list>
|
||||||
|
<field name="product_id" onchange="onchange_gmproduct"/>
|
||||||
|
<field name="description"/>
|
||||||
|
<field name="qty" onchange="onchange_gmline"/>
|
||||||
|
<field name="uom_id"/>
|
||||||
|
<field name="price" onchange="onchange_gmline"/>
|
||||||
|
<field name="amount"/>
|
||||||
|
</list>
|
||||||
|
</field>
|
||||||
|
<group span="8" columns="1">
|
||||||
|
<group span="6" columns="1">
|
||||||
|
<field name="fee_partner_id" domain="[['type','=','org']]" attrs='{"required":[["fee_amount","!=",0]]}'/>
|
||||||
|
</group>
|
||||||
|
<group span="2" columns="1">
|
||||||
|
</group>
|
||||||
|
</group>
|
||||||
|
<group span="4" columns="1">
|
||||||
|
<field name="fee_total"/>
|
||||||
|
<field name="fee_amount"/>
|
||||||
|
</group>
|
||||||
|
</tab>
|
||||||
<tab string="Other Expenses">
|
<tab string="Other Expenses">
|
||||||
<field name="lines" count="3" nolabel="1">
|
<field name="lines" count="3" nolabel="1">
|
||||||
<list>
|
<list>
|
||||||
|
@ -59,29 +81,7 @@
|
||||||
<group span="4" columns="1">
|
<group span="4" columns="1">
|
||||||
<field name="total"/>
|
<field name="total"/>
|
||||||
<field name="amount"/>
|
<field name="amount"/>
|
||||||
</group>
|
<button string="Pay Now" span="2" size="small" action="clinic_payment" icon="arrow-right" type="success"/>
|
||||||
</tab>
|
|
||||||
<tab string="Government Pays">
|
|
||||||
<field name="gm_lines" count="3" nolabel="1">
|
|
||||||
<list>
|
|
||||||
<field name="product_id" onchange="onchange_gmproduct"/>
|
|
||||||
<field name="description"/>
|
|
||||||
<field name="qty" onchange="onchange_gmline"/>
|
|
||||||
<field name="uom_id"/>
|
|
||||||
<field name="price" onchange="onchange_gmline"/>
|
|
||||||
<field name="amount"/>
|
|
||||||
</list>
|
|
||||||
</field>
|
|
||||||
<group span="8" columns="1">
|
|
||||||
<group span="6" columns="1">
|
|
||||||
<field name="fee_partner_id" domain="[['type','=','org']]" attrs='{"required":[["fee_amount","!=",0]]}'/>
|
|
||||||
</group>
|
|
||||||
<group span="2" columns="1">
|
|
||||||
</group>
|
|
||||||
</group>
|
|
||||||
<group span="4" columns="1">
|
|
||||||
<field name="fee_total"/>
|
|
||||||
<field name="fee_amount"/>
|
|
||||||
</group>
|
</group>
|
||||||
</tab>
|
</tab>
|
||||||
<tab string="Notes">
|
<tab string="Notes">
|
||||||
|
@ -89,9 +89,10 @@
|
||||||
</tab>
|
</tab>
|
||||||
</tabs>
|
</tabs>
|
||||||
<foot>
|
<foot>
|
||||||
<button string="Confirm" type="success" method="confirm" states="draft"/>
|
<button string="Do Treatment" type="success" icon="arrow-right" method="do_treatment" states="draft"/>
|
||||||
<button string="Complete" type="success" method="complete" states="in_progress"/>
|
<button string="Complete" type="success" icon="ok" method="complete" states="in_progress"/>
|
||||||
<button string="Discontinue" type="danger" 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="Undo" type="default" icon="refresh" method="undo" states="completed"/>
|
||||||
</foot>
|
</foot>
|
||||||
<related>
|
<related>
|
||||||
<field name="invoices" click_action="view_invoice"/>
|
<field name="invoices" click_action="view_invoice"/>
|
||||||
|
|
|
@ -5,55 +5,9 @@
|
||||||
<field name="name"/>
|
<field name="name"/>
|
||||||
<field name="date_import"/>
|
<field name="date_import"/>
|
||||||
<field name="type" required="1"/>
|
<field name="type" required="1"/>
|
||||||
<separator string="Select File -> Load Sheet -> Select Sheet(only one) -> Click Import"/>
|
<field name="input_id" readonly="1"/>
|
||||||
<group span="8" columns="1">
|
<field name="mg_payment_id" readonly="1"/>
|
||||||
<group span="12">
|
|
||||||
<field name="file" nolabel="1" onchange="onchange_file"/>
|
|
||||||
<button string="Load Sheet" size="small" type="warning" icon="download" method="load_sheet" attrs='{"invisible":[["state","in",["close"]]]}'/>
|
|
||||||
<button string="Clear Sheet" size="small" type="danger" icon="remove" method="clear_sheet" attrs='{"invisible":[["state","in",["close"]]]}'/>
|
|
||||||
</group>
|
|
||||||
<field name="sheets" count="3" nolabel="1">
|
|
||||||
<list>
|
|
||||||
<field name="name"/>
|
|
||||||
<field name="select" onchange="onchange_sheet"/>
|
|
||||||
</list>
|
|
||||||
</field>
|
|
||||||
<group span="6">
|
|
||||||
</group>
|
|
||||||
<group span="6">
|
|
||||||
<!--<button span="3" string="Import" type="success" icon="arrow-right" method="import_payment" attrs='{"invisible":[["state","in",["success"]]]}'/>-->
|
|
||||||
<!--<button span="3" string="Close" type="danger" method="close_import" attrs='{"invisible":[["state","in",["success"]]]}'/>-->
|
|
||||||
</group>
|
|
||||||
</group>
|
|
||||||
<group span="4" columns="1">
|
|
||||||
<group attrs='{"invisible":[["type","!=","mg"]]}'>
|
|
||||||
<separator string="Medical Government"/>
|
|
||||||
<field name="mg_payment_id" readonly="1"/>
|
|
||||||
<field name="mg_move_id" readonly="1"/>
|
|
||||||
<button string="POST" size="small" type="success" method="post_mg" attrs='{"invisible":[["state","in",["close"]]]}'/>
|
|
||||||
<button string="UNDO" size="small" type="danger" method="undo_mg" attrs='{"invisible":[["state","in",["close"]]]}'/>
|
|
||||||
</group>
|
|
||||||
|
|
||||||
<group attrs='{"invisible":[["type","!=","sc"]]}'>
|
|
||||||
<separator string="Social Security"/>
|
|
||||||
<field name="sc_payment_id" readonly="1"/>
|
|
||||||
<field name="sc_move_id" readonly="1"/>
|
|
||||||
<button string="POST" size="small" type="success" method="post_sc" attrs='{"invisible":[["state","in",["close"]]]}'/>
|
|
||||||
<button string="UNDO" size="small" type="danger" method="undo_sc" attrs='{"invisible":[["state","in",["close"]]]}'/>
|
|
||||||
</group>
|
|
||||||
|
|
||||||
<group attrs='{"invisible":[["type","!=","nhso"]]}'>
|
|
||||||
<separator string="NHSO (30฿)"/>
|
|
||||||
<field name="nhso_payment_id" readonly="1"/>
|
|
||||||
<field name="nhso_move_id" readonly="1"/>
|
|
||||||
<button string="POST" size="small" type="success" method="post_nhso" attrs='{"invisible":[["state","in",["close"]]]}'/>
|
|
||||||
<button string="UNDO" size="small" type="danger" method="undo_nhso" attrs='{"invisible":[["state","in",["close"]]]}'/>
|
|
||||||
</group>
|
|
||||||
|
|
||||||
</group>
|
|
||||||
<foot>
|
<foot>
|
||||||
<button span="3" string="Import" type="success" icon="arrow-right" method="import_payment" attrs='{"invisible":[["state","in",["close"]]]}'/>
|
<button span="3" size="large" icon="arrow-right" string="Import" type="primary" method="import"/>
|
||||||
<button span="3" string="Close" type="danger" method="close" attrs='{"invisible":[["state","in",["close"]]]}'/>
|
|
||||||
<button span="3" string="To Draft" icon="refresh" type="default" method="to_draft" attrs='{"invisible":[["state","in",["draft"]]]}'/>
|
|
||||||
</foot>
|
</foot>
|
||||||
</form>
|
</form>
|
||||||
|
|
|
@ -0,0 +1,46 @@
|
||||||
|
<form model="clinic.import.payment" attrs='{"readonly":[["state","in",["close"]]]}'>
|
||||||
|
<head>
|
||||||
|
<field name="state"/>
|
||||||
|
<button string="Report" icon="print" action="report"/>
|
||||||
|
</head>
|
||||||
|
<field name="name"/>
|
||||||
|
<field name="date_import"/>
|
||||||
|
<field name="type" required="1"/>
|
||||||
|
<separator string="Select File -> Load DATA -> Click See Data"/>
|
||||||
|
<group span="6" columns="1">
|
||||||
|
<field span="6" name="file" onchange="onchange_file"/>
|
||||||
|
<button span="6" string="Load DATA" size="small" type="warning" icon="download" method="load_data" attrs='{"invisible":[["state","in",["close"]]]}'/>
|
||||||
|
<field span="6" name="input_id" readonly="1"/>
|
||||||
|
</group>
|
||||||
|
<group span="6" columns="1">
|
||||||
|
<group attrs='{"invisible":[["type","!=","mg"]]}'>
|
||||||
|
<separator string="Medical Government"/>
|
||||||
|
<field name="mg_payment_id" readonly="1"/>
|
||||||
|
<field name="mg_move_id" readonly="1"/>
|
||||||
|
<button string="POST" size="small" type="success" method="post_mg" attrs='{"invisible":[["state","in",["close"]]]}'/>
|
||||||
|
<button string="UNDO" size="small" type="danger" method="undo_mg" attrs='{"invisible":[["state","in",["close"]]]}'/>
|
||||||
|
</group>
|
||||||
|
|
||||||
|
<group attrs='{"invisible":[["type","!=","sc"]]}'>
|
||||||
|
<separator string="Social Security"/>
|
||||||
|
<field name="sc_payment_id" readonly="1"/>
|
||||||
|
<field name="sc_move_id" readonly="1"/>
|
||||||
|
<button string="POST" size="small" type="success" method="post_sc" attrs='{"invisible":[["state","in",["close"]]]}'/>
|
||||||
|
<button string="UNDO" size="small" type="danger" method="undo_sc" attrs='{"invisible":[["state","in",["close"]]]}'/>
|
||||||
|
</group>
|
||||||
|
|
||||||
|
<group attrs='{"invisible":[["type","!=","nhso"]]}'>
|
||||||
|
<separator string="NHSO (30฿)"/>
|
||||||
|
<field name="nhso_payment_id" readonly="1"/>
|
||||||
|
<field name="nhso_move_id" readonly="1"/>
|
||||||
|
<button string="POST" size="small" type="success" method="post_nhso" attrs='{"invisible":[["state","in",["close"]]]}'/>
|
||||||
|
<button string="UNDO" size="small" type="danger" method="undo_nhso" attrs='{"invisible":[["state","in",["close"]]]}'/>
|
||||||
|
</group>
|
||||||
|
|
||||||
|
</group>
|
||||||
|
<foot>
|
||||||
|
<!--<button span="3" string="Import" type="success" icon="arrow-right" method="import_payment" attrs='{"invisible":[["state","in",["close"]]]}'/>-->
|
||||||
|
<button span="3" string="Close" type="danger" method="close" attrs='{"invisible":[["state","in",["close"]]]}'/>
|
||||||
|
<button span="3" string="To Draft" icon="refresh" type="default" method="to_draft" attrs='{"invisible":[["state","in",["draft"]]]}'/>
|
||||||
|
</foot>
|
||||||
|
</form>
|
|
@ -7,9 +7,9 @@
|
||||||
<item string="Patients">
|
<item string="Patients">
|
||||||
<item string="Patients" action="clinic_patient"/>
|
<item string="Patients" action="clinic_patient"/>
|
||||||
<item string="Dialyzers" action="clinic_dialyzer"/>
|
<item string="Dialyzers" action="clinic_dialyzer"/>
|
||||||
<item string="Schedules" action="clinic_schedule"/>
|
<!--<item string="Schedules" action="clinic_schedule"/>-->
|
||||||
<divider/>
|
<divider/>
|
||||||
<header string="OPTIONS"/>
|
<header string="OTHERS"/>
|
||||||
<item string="Races" action="clinic_race"/>
|
<item string="Races" action="clinic_race"/>
|
||||||
<item string="Nationalities" action="clinic_nation"/>
|
<item string="Nationalities" action="clinic_nation"/>
|
||||||
<item string="Graduations" action="clinic_grade"/>
|
<item string="Graduations" action="clinic_grade"/>
|
||||||
|
@ -26,11 +26,7 @@
|
||||||
<item string="Daily" action="clinic_hd_report"/>
|
<item string="Daily" action="clinic_hd_report"/>
|
||||||
<item string="Monthly" action="clinic_hd_report_monthly"/>
|
<item string="Monthly" action="clinic_hd_report_monthly"/>
|
||||||
</item>
|
</item>
|
||||||
<item string="Imports">
|
|
||||||
<item string="Import Payments" action="clinic_import_payment"/>
|
|
||||||
</item>
|
|
||||||
<item string="Settings">
|
<item string="Settings">
|
||||||
<!-- <item string="Cycle" action="clinic_cycle"/>-->
|
|
||||||
<item string="Departments" action="clinic_department"/>
|
<item string="Departments" action="clinic_department"/>
|
||||||
<item string="Cycle" action="clinic_cycle"/>
|
<item string="Cycle" action="clinic_cycle"/>
|
||||||
<item string="Clinic Settings" action="clinic_setting"/>
|
<item string="Clinic Settings" action="clinic_setting"/>
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
<inherit inherit="account_menu">
|
||||||
|
<item string="Settings" position="before">
|
||||||
|
<item string="Ratchawat">
|
||||||
|
<item string="Import Payments" action="clinic_import_payment"/>
|
||||||
|
</item>
|
||||||
|
</item>
|
||||||
|
</inherit>
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
<form model="clinic.payment">
|
||||||
|
<field name="partner_id" />
|
||||||
|
<field name="lines" nolabel="1">
|
||||||
|
<list>
|
||||||
|
<field name="description"/>
|
||||||
|
<field name="qty"/>
|
||||||
|
<field name="price"/>
|
||||||
|
<field name="amount"/>
|
||||||
|
</list>
|
||||||
|
</field>
|
||||||
|
<group span="4">
|
||||||
|
</group>
|
||||||
|
<group span="8">
|
||||||
|
<field offset="6" name="total"/>
|
||||||
|
</group>
|
||||||
|
<foot>
|
||||||
|
<button string="POST" type="success" method="post"/>
|
||||||
|
</foot>
|
||||||
|
</form>
|
|
@ -1,8 +1,5 @@
|
||||||
<form model="clinic.setting" title="Financial Settings">
|
<form model="clinic.setting" title="Financial Settings">
|
||||||
<tabs>
|
<tabs>
|
||||||
<tab string="Schedule">
|
|
||||||
<button string="Gen Schedule" method="gen_schedule" icon="arrow-right" type="success" />
|
|
||||||
</tab>
|
|
||||||
<tab string="Accounting">
|
<tab string="Accounting">
|
||||||
<separator string="Account Setting Medical Govelopment"/>
|
<separator string="Account Setting Medical Govelopment"/>
|
||||||
<field name="mg_partner_id" />
|
<field name="mg_partner_id" />
|
||||||
|
|
|
@ -1,34 +1,32 @@
|
||||||
<form model="clinic.visit" attrs='{"readonly":[["state","in",["treatment"]]]}' show_company="1">
|
<form model="clinic.visit" attrs='{"readonly":[["state","in",["confirmed"]]]}' show_company="1">
|
||||||
<head>
|
<head>
|
||||||
<field name="state"/>
|
<field name="state"/>
|
||||||
<button string="Print" icon="print" action="report_visit_form"/>
|
<button string="Print" icon="print" action="report_visit_form"/>
|
||||||
<button string="Options" dropdown="1">
|
<button string="Options" dropdown="1">
|
||||||
<item string="Copy" method="copy"/>
|
<item string="Copy" method="copy"/>
|
||||||
<item string="Create Dialyzer" method="create_dialyzer"/>
|
<!--<item string="Create Dialyzer" method="create_dialyzer"/>-->
|
||||||
<item string="Generate Cycle" method="generate_cycle"/>
|
<!--<item string="Generate Cycle" method="generate_cycle"/>-->
|
||||||
</button>
|
</button>
|
||||||
</head>
|
</head>
|
||||||
<tabs>
|
<tabs>
|
||||||
<tab string="General">
|
<tab string="General">
|
||||||
<group span="6" columns="1">
|
<group span="6" columns="1">
|
||||||
<field name="number"/>
|
<field name="number"/>
|
||||||
<field name="time_start" onchange="onchange_time" attrs='{"required":[["state","=","waiting_treatment"]]}'/>
|
<field name="time_start" onchange="onchange_time"/>
|
||||||
<field name="department_id"/>
|
<field name="department_id"/>
|
||||||
<field name="cycle_id" onchange="onchange_time" required="1"/>
|
<field name="cycle_id" onchange="onchange_time" required="1"/>
|
||||||
</group>
|
</group>
|
||||||
<group span="6" columns="1">
|
<group span="6" columns="1">
|
||||||
<field name="patient_id" onchange="onchange_patient"/>
|
<field name="patient_id" onchange="onchange_patient"/>
|
||||||
<field name="time_stop" attrs='{"required":[["state","=","waiting_treatment"]]}'/>
|
<field name="time_stop"/>
|
||||||
<field name="doctor_id"/>
|
<field name="doctor_id"/>
|
||||||
<field name="nurse_id" attrs='{"required":[["state","=","waiting_treatment"]]}'/>
|
<field name="nurse_id"/>
|
||||||
</group>
|
</group>
|
||||||
</tab>
|
</tab>
|
||||||
</tabs>
|
</tabs>
|
||||||
<foot>
|
<foot>
|
||||||
<button string="Confirm" type="success" method="confirm" states="draft" />
|
<button string="Confirm" type="success" method="confirm" states="draft" />
|
||||||
<button string="Do Treatment" type="success" method="do_treatment" icon="arrow-right" states="waiting_treatment" />
|
<button string="To Draft" type="default" icon="refresh" method="to_draft" states="confirmed" />
|
||||||
<button string="Dicard" type="warning" icon="trash" method="discard" states="waiting_treatment" confirm="Are you sure to cancel HD case?"/>
|
|
||||||
<button string="Re Visit" type="default" attrs='{"invisible":[["state","=","treatment"]]}' icon="repeat" method="reopen" states="cancelled" />
|
|
||||||
</foot>
|
</foot>
|
||||||
<related>
|
<related>
|
||||||
<field name="hd_cases" readonly="1"/>
|
<field name="hd_cases" readonly="1"/>
|
||||||
|
|
|
@ -32,3 +32,6 @@ from . import cycle
|
||||||
from . import gen_visit
|
from . import gen_visit
|
||||||
from . import gen_visit_line
|
from . import gen_visit_line
|
||||||
from . import report_hd_monthly
|
from . import report_hd_monthly
|
||||||
|
from . import payment
|
||||||
|
from . import payment_line
|
||||||
|
from . import input_data
|
||||||
|
|
|
@ -152,6 +152,7 @@ class Dialyzer(Model):
|
||||||
for obj in self.browse(ids):
|
for obj in self.browse(ids):
|
||||||
if obj.state != 'new':
|
if obj.state != 'new':
|
||||||
raise Exception("Can not delete Dializer %s because state is not 'new'"%obj.number)
|
raise Exception("Can not delete Dializer %s because state is not 'new'"%obj.number)
|
||||||
|
super().delete(ids)
|
||||||
|
|
||||||
def cancel(self,ids,context={}):
|
def cancel(self,ids,context={}):
|
||||||
obj=self.browse(ids[0])
|
obj=self.browse(ids[0])
|
||||||
|
|
|
@ -29,11 +29,13 @@ class GenVisit(Model):
|
||||||
'friday': fields.Boolean("Fridays"),
|
'friday': fields.Boolean("Fridays"),
|
||||||
'doctor_id': fields.Many2One("clinic.doctor","Doctor"),
|
'doctor_id': fields.Many2One("clinic.doctor","Doctor"),
|
||||||
'nurse_id': fields.Many2One("clinic.nurse","Nurse"),
|
'nurse_id': fields.Many2One("clinic.nurse","Nurse"),
|
||||||
'duration': fields.Integer("Duration", function="_get_duration"),
|
'duration': fields.Integer("Duration (hrs)", function="_get_duration"),
|
||||||
}
|
}
|
||||||
|
|
||||||
def _get_lines(self,context={}):
|
def _get_lines(self,context={}):
|
||||||
ids=context.get("ids")
|
ids=context.get("ids")
|
||||||
|
if not ids:
|
||||||
|
ids=[context.get("refer_id")]
|
||||||
lines=[{'patient_id': id} for id in ids]
|
lines=[{'patient_id': id} for id in ids]
|
||||||
return lines
|
return lines
|
||||||
|
|
||||||
|
@ -45,12 +47,20 @@ class GenVisit(Model):
|
||||||
return nurse_ids[0]
|
return nurse_ids[0]
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
def _get_cycle(self,context={}):
|
||||||
|
cycle_ids=get_model('clinic.cycle').search([],order="sequence")
|
||||||
|
if cycle_ids:
|
||||||
|
cycle_id=cycle_ids[0]
|
||||||
|
return cycle_id or None
|
||||||
|
|
||||||
_defaults={
|
_defaults={
|
||||||
'lines': _get_lines,
|
'lines': _get_lines,
|
||||||
'date_from': lambda *a: datetime.now().strftime(FMT_DATETIME),
|
'date_from': lambda *a: datetime.now().strftime(FMT_DATETIME),
|
||||||
'date_to': lambda *a: datetime.now().strftime(FMT_DATETIME),
|
'date_to': lambda *a: datetime.now().strftime(FMT_DATETIME),
|
||||||
'nurse_id': _get_nurse,
|
'nurse_id': _get_nurse,
|
||||||
'duration': 1,
|
'duration': 1,
|
||||||
|
'cycle_id': _get_cycle,
|
||||||
|
'monday': True,
|
||||||
}
|
}
|
||||||
|
|
||||||
def onchange_time(self,context={}):
|
def onchange_time(self,context={}):
|
||||||
|
@ -64,17 +74,18 @@ class GenVisit(Model):
|
||||||
date_from=data['date_from']
|
date_from=data['date_from']
|
||||||
date_to=(datetime.strptime(date_from,FMT_DATETIME)+timedelta(seconds=seconds)).strftime(FMT_DATETIME)
|
date_to=(datetime.strptime(date_from,FMT_DATETIME)+timedelta(seconds=seconds)).strftime(FMT_DATETIME)
|
||||||
data['date_to']='%s %s'%(data['date_to'][0:10],date_to[11:])
|
data['date_to']='%s %s'%(data['date_to'][0:10],date_to[11:])
|
||||||
data['duration']=(datetime.strptime(data['date_to'],FMT_DATETIME)-datetime.strptime(data['date_from'],FMT_DATETIME)).days+1
|
duration=(datetime.strptime(data['date_to'],FMT_DATETIME)-datetime.strptime(data['date_from'],FMT_DATETIME)).seconds/3600
|
||||||
|
data['duration']=duration
|
||||||
return data
|
return data
|
||||||
|
|
||||||
def onchange_dateto(self,context={}):
|
def onchange_dateto(self,context={}):
|
||||||
data=context['data']
|
data=context['data']
|
||||||
data['duration']=(datetime.strptime(data['date_to'],FMT_DATETIME)-datetime.strptime(data['date_from'],FMT_DATETIME)).days+1
|
data['duration']=(datetime.strptime(data['date_to'],FMT_DATETIME)-datetime.strptime(data['date_from'],FMT_DATETIME)).seconds/3600
|
||||||
return data
|
return data
|
||||||
|
|
||||||
def gen_visit(self,ids,context):
|
def gen_visit(self,ids,context):
|
||||||
obj=self.browse(ids)[0]
|
obj=self.browse(ids)[0]
|
||||||
time_stop=obj.date_to[11:]
|
#time_stop=obj.date_to[11:]
|
||||||
days=[
|
days=[
|
||||||
obj.monday and 1 or 0,
|
obj.monday and 1 or 0,
|
||||||
obj.tuesday and 2 or 0,
|
obj.tuesday and 2 or 0,
|
||||||
|
@ -86,29 +97,46 @@ class GenVisit(Model):
|
||||||
print("days ", days)
|
print("days ", days)
|
||||||
if not days:
|
if not days:
|
||||||
raise Exception("Please select Day")
|
raise Exception("Please select Day")
|
||||||
duration=datetime.strptime(obj.date_to,FMT_DATETIME)-datetime.strptime(obj.date_from,FMT_DATETIME)
|
#duration=datetime.strptime(obj.date_to,FMT_DATETIME)-datetime.strptime(obj.date_from,FMT_DATETIME)
|
||||||
for day in range(duration.days+1):
|
# loop patient
|
||||||
date_from=(datetime.strptime(obj.date_from,FMT_DATETIME)+timedelta(days=day)).strftime(FMT_DATETIME)
|
visit_vals=[]
|
||||||
date_to="%s %s" % (obj.date_from[0:10],time_stop)
|
date_from=datetime.strptime(obj.date_from,FMT_DATETIME)
|
||||||
# loop patient
|
date_to=datetime.strptime(obj.date_to,FMT_DATETIME)
|
||||||
visit_vals=[]
|
#total_days=(date_to-date_from).days
|
||||||
for line in obj.lines:
|
for line in obj.lines:
|
||||||
# loop days in weekend
|
# loop days in weekend
|
||||||
for day in days:
|
ntoday=1
|
||||||
|
day_total=(date_to-date_from).days+ntoday
|
||||||
|
for weekday in days:
|
||||||
|
wd=date_from.weekday()
|
||||||
|
start_date=date_from
|
||||||
|
while wd != weekday-1:
|
||||||
|
start_date+=timedelta(days=1)
|
||||||
|
wd=start_date.weekday()
|
||||||
|
|
||||||
|
#XXX should gen only in scoop
|
||||||
|
if start_date.strftime(FMT_DATE) > date_to.strftime(FMT_DATE):
|
||||||
|
continue
|
||||||
|
count=0
|
||||||
|
while count < day_total:
|
||||||
|
tmp=start_date+timedelta(days=count)
|
||||||
vals={
|
vals={
|
||||||
'patient_id': line.patient_id.id,
|
'patient_id': line.patient_id.id,
|
||||||
'doctor_id': obj.doctor_id.id,
|
'doctor_id': obj.doctor_id.id,
|
||||||
'nurse_id': obj.nurse_id.id,
|
'nurse_id': obj.nurse_id.id,
|
||||||
'cycle_id': obj.cycle_id.id,
|
'cycle_id': obj.cycle_id.id,
|
||||||
'time_start': date_from,
|
'time_start': "%s %s" % (tmp.strftime(FMT_DATE),date_from.strftime(FMT_DATETIME)[11:]),
|
||||||
'time_stop': date_to,
|
'time_stop': "%s %s" % (tmp.strftime(FMT_DATE),date_to.strftime(FMT_DATETIME)[11:]),
|
||||||
'state': 'draft',
|
'state': 'draft',
|
||||||
}
|
}
|
||||||
visit_vals.append(vals)
|
visit_vals.append(vals)
|
||||||
|
count+=7
|
||||||
|
start_date=tmp
|
||||||
|
|
||||||
if visit_vals:
|
if visit_vals:
|
||||||
dom=[]
|
dom=[]
|
||||||
dom.append(['time_start','>=','%s %s'%(obj.date_from[0:10],' 00:00:00')])
|
dom.append(['time_start','>=','%s %s'%(date_from.strftime(FMT_DATE)[0:10],' 00:00:00')])
|
||||||
dom.append(['time_stop','<=','%s %s'%(obj.date_to[0:10],' 23:59:59')])
|
dom.append(['time_stop','<=','%s %s'%(start_date.strftime(FMT_DATE)[0:10],' 23:59:59')])
|
||||||
# search patient
|
# search patient
|
||||||
dom.append(['state','=','draft'])
|
dom.append(['state','=','draft'])
|
||||||
patient_ids=[visit['patient_id'] for visit in visit_vals]
|
patient_ids=[visit['patient_id'] for visit in visit_vals]
|
||||||
|
@ -118,7 +146,7 @@ class GenVisit(Model):
|
||||||
visit_ids=visit_obj.search(dom)
|
visit_ids=visit_obj.search(dom)
|
||||||
# delete old visit (same duration)
|
# delete old visit (same duration)
|
||||||
visit_obj.delete(visit_ids)
|
visit_obj.delete(visit_ids)
|
||||||
for vas in visit_vals:
|
for vals in visit_vals:
|
||||||
visit_obj.create(vals)
|
visit_obj.create(vals)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import time
|
import time
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime
|
||||||
|
|
||||||
from netforce.model import Model, fields, get_model
|
from netforce.model import Model, fields, get_model
|
||||||
from netforce.utils import get_data_path
|
from netforce.utils import get_data_path
|
||||||
|
@ -43,9 +43,8 @@ class HDcase(Model):
|
||||||
"hct": fields.Integer("HCT %", required=True),
|
"hct": fields.Integer("HCT %", required=True),
|
||||||
"check_goverment_pay" : fields.Boolean("The Government Pay"),
|
"check_goverment_pay" : fields.Boolean("The Government Pay"),
|
||||||
"check_personal_pay" : fields.Boolean("Pay yourself"),
|
"check_personal_pay" : fields.Boolean("Pay yourself"),
|
||||||
"state": fields.Selection([("draft","Draft"),("confirmed","Confirmed"),("approved","Approved"),("cancelled","Cancelled"),("paid","Paid")],"Status",required=True),
|
"hct": fields.Integer("HCT %(>39)"),
|
||||||
"hct": fields.Integer("HCT %"),
|
"state": fields.Selection([("draft","Draft"),("in_progress","In Progress"),("completed","Completed"),("discountinued","Discountinued"),("in_completed","In completed")],"Status",required=True),
|
||||||
"state": fields.Selection([("draft","Draft"),("in_progress","In Progress"),("completed","Completed"),("discountinued","Discountinued"),("uncompleted","Uncompleted")],"Status",required=True),
|
|
||||||
"dialyzers": fields.One2Many("clinic.dialyzer.line","hd_case_id","Dialyzers"),
|
"dialyzers": fields.One2Many("clinic.dialyzer.line","hd_case_id","Dialyzers"),
|
||||||
"lines": fields.One2Many("clinic.hd.case.line","hd_case_id","Lines"),
|
"lines": fields.One2Many("clinic.hd.case.line","hd_case_id","Lines"),
|
||||||
"gm_lines": fields.One2Many("clinic.hd.case.gm.line","hd_case_id","GM Lines"),
|
"gm_lines": fields.One2Many("clinic.hd.case.gm.line","hd_case_id","GM Lines"),
|
||||||
|
@ -109,8 +108,16 @@ class HDcase(Model):
|
||||||
if not dialyzer_id:
|
if not dialyzer_id:
|
||||||
return {}
|
return {}
|
||||||
dialyzer=get_model("clinic.dialyzer").browse(dialyzer_id)
|
dialyzer=get_model("clinic.dialyzer").browse(dialyzer_id)
|
||||||
|
use_time=dialyzer.use_time or 0
|
||||||
|
max_time=dialyzer.max_use_time or 0
|
||||||
|
if use_time > max_time:
|
||||||
|
dialyzer.write({
|
||||||
|
'state': 'expire',
|
||||||
|
})
|
||||||
|
raise Exception("%s is expired"%dialyzer.number)
|
||||||
|
use_time+=1
|
||||||
line["description"]=dialyzer.description or ""
|
line["description"]=dialyzer.description or ""
|
||||||
line["use_time"]=dialyzer.use_time
|
line["use_time"]=use_time
|
||||||
line["max_use_time"]=dialyzer.max_use_time
|
line["max_use_time"]=dialyzer.max_use_time
|
||||||
line["member_type"]=dialyzer.member_type
|
line["member_type"]=dialyzer.member_type
|
||||||
line["dialyzer_type"]=dialyzer.dialyzer_type
|
line["dialyzer_type"]=dialyzer.dialyzer_type
|
||||||
|
@ -165,11 +172,11 @@ class HDcase(Model):
|
||||||
return data
|
return data
|
||||||
|
|
||||||
def onchange_hct(self,context={}):
|
def onchange_hct(self,context={}):
|
||||||
data=context['hct']
|
data=context['data']
|
||||||
hct=data['hct']
|
hct=data['hct']
|
||||||
if(hct<=39):
|
if(hct<=39):
|
||||||
raise Exception("Unit not found in uom")
|
data['hct']=0
|
||||||
|
return data
|
||||||
|
|
||||||
def cancelled(self,ids,context={}):
|
def cancelled(self,ids,context={}):
|
||||||
obj=self.browse(ids)[0]
|
obj=self.browse(ids)[0]
|
||||||
|
@ -205,6 +212,9 @@ class HDcase(Model):
|
||||||
data['fee_total']=total
|
data['fee_total']=total
|
||||||
data['fee_amount']=total
|
data['fee_amount']=total
|
||||||
return data
|
return data
|
||||||
|
|
||||||
|
def make_payment(self,ids,context={}):
|
||||||
|
pass
|
||||||
|
|
||||||
def make_invoices(self,ids,context={}):
|
def make_invoices(self,ids,context={}):
|
||||||
setting=get_model("settings").browse(1)
|
setting=get_model("settings").browse(1)
|
||||||
|
@ -217,11 +227,11 @@ class HDcase(Model):
|
||||||
raise Exception("Unit not found in uom")
|
raise Exception("Unit not found in uom")
|
||||||
obj=self.browse(ids[0])
|
obj=self.browse(ids[0])
|
||||||
due_date=obj.date[0:10]
|
due_date=obj.date[0:10]
|
||||||
# XXX
|
|
||||||
context['type']='out'
|
context['type']='out'
|
||||||
context['inv_type']='invoice'
|
context['inv_type']='invoice'
|
||||||
|
# TODO payment without invoice
|
||||||
if obj.lines and obj.total:
|
if obj.lines and obj.total:
|
||||||
# XXX need to split function prepare invoice
|
|
||||||
vals={
|
vals={
|
||||||
"type": "out",
|
"type": "out",
|
||||||
"inv_type": "invoice",
|
"inv_type": "invoice",
|
||||||
|
@ -255,7 +265,7 @@ class HDcase(Model):
|
||||||
inv_id=get_model("account.invoice").create(vals,context)
|
inv_id=get_model("account.invoice").create(vals,context)
|
||||||
# create picking
|
# create picking
|
||||||
obj.make_pickings()
|
obj.make_pickings()
|
||||||
if obj.fee:
|
if obj.fee_total:
|
||||||
vals={
|
vals={
|
||||||
"type": "out",
|
"type": "out",
|
||||||
"inv_type": "invoice",
|
"inv_type": "invoice",
|
||||||
|
@ -270,22 +280,22 @@ class HDcase(Model):
|
||||||
}
|
}
|
||||||
vals["partner_id"]=obj.fee_partner_id.id
|
vals["partner_id"]=obj.fee_partner_id.id
|
||||||
# XXX
|
# XXX
|
||||||
#if obj.fee_partner_id.account_payable_id:
|
|
||||||
#account_receivable_id=obj.fee_partner_id.account_payable_id.id
|
|
||||||
if obj.fee_partner_id.account_receivable_id:
|
if obj.fee_partner_id.account_receivable_id:
|
||||||
account_id=obj.fee_partner_id.account_receivable_id.id or account_receivable_id
|
account_id=obj.fee_partner_id.account_receivable_id.id or account_receivable_id
|
||||||
if not account_receivable_id:
|
if not account_receivable_id:
|
||||||
raise Exception("%s not found account recievable %s"%obj.fee_partner_id.name)
|
raise Exception("%s not found account recievable %s"%obj.fee_partner_id.name)
|
||||||
line={
|
for line in obj.gm_lines:
|
||||||
"product_id": None,
|
prod=line.product_id
|
||||||
"description": "Fee",
|
inv_line={
|
||||||
"qty": 1,
|
"product_id": prod.id,
|
||||||
"uom_id": uom[0].id,
|
"description": prod.name,
|
||||||
"unit_price": obj.fee,
|
"qty": 1,
|
||||||
"amount": obj.fee,
|
"uom_id": prod.uom_id.id,
|
||||||
'account_id': account_id,
|
"unit_price": line.price,
|
||||||
}
|
"amount": line.amount,
|
||||||
vals['lines'].append(('create',line))
|
'account_id': account_id, # XXX
|
||||||
|
}
|
||||||
|
vals['lines'].append(('create',inv_line))
|
||||||
inv_id=get_model("account.invoice").create(vals,context)
|
inv_id=get_model("account.invoice").create(vals,context)
|
||||||
|
|
||||||
def make_pickings(self,ids,context={}):
|
def make_pickings(self,ids,context={}):
|
||||||
|
@ -321,7 +331,9 @@ class HDcase(Model):
|
||||||
|
|
||||||
for line in obj.lines:
|
for line in obj.lines:
|
||||||
prod=line.product_id
|
prod=line.product_id
|
||||||
|
|
||||||
if prod.type != 'stock':
|
if prod.type != 'stock':
|
||||||
|
print("continue ")
|
||||||
continue
|
continue
|
||||||
wh_loc_id=prod.location_id.id
|
wh_loc_id=prod.location_id.id
|
||||||
if not wh_loc_id:
|
if not wh_loc_id:
|
||||||
|
@ -352,21 +364,31 @@ class HDcase(Model):
|
||||||
inv.post()
|
inv.post()
|
||||||
print("Post!")
|
print("Post!")
|
||||||
|
|
||||||
def confirm(self,ids,context={}):
|
def do_treatment(self,ids,context={}):
|
||||||
obj=self.browse(ids)[0]
|
obj=self.browse(ids)[0]
|
||||||
|
if not obj.dialyzers:
|
||||||
|
raise Exception("Can not do treatment without dialyzer!")
|
||||||
obj.write({"state":"in_progress"})
|
obj.write({"state":"in_progress"})
|
||||||
|
|
||||||
def discontinue(self,ids,context={}):
|
def discontinue(self,ids,context={}):
|
||||||
obj=self.browse(ids)[0]
|
obj=self.browse(ids)[0]
|
||||||
# TODO pop to note
|
# TODO pop to note
|
||||||
obj.write({"state":"uncompleted"})
|
obj.write({"state":"in_completed"})
|
||||||
|
|
||||||
|
def update_usetime(self,ids,context={}):
|
||||||
|
for obj in self.browse(ids):
|
||||||
|
for dlz_line in obj.dialyzers:
|
||||||
|
dlz=dlz_line.dialyzer_id
|
||||||
|
dlz.write({
|
||||||
|
'use_time': dlz_line.use_time,
|
||||||
|
})
|
||||||
|
return True
|
||||||
|
|
||||||
def complete(self,ids,context={}):
|
def complete(self,ids,context={}):
|
||||||
obj=self.browse(ids)[0]
|
obj=self.browse(ids)[0]
|
||||||
if not obj.dialyzers:
|
|
||||||
raise Exception("Please enter dialyzer!")
|
|
||||||
obj.make_invoices()
|
obj.make_invoices()
|
||||||
obj.post_invoices()
|
obj.post_invoices()
|
||||||
|
obj.update_usetime()
|
||||||
obj.write({
|
obj.write({
|
||||||
"state":"completed",
|
"state":"completed",
|
||||||
})
|
})
|
||||||
|
@ -439,4 +461,29 @@ class HDcase(Model):
|
||||||
data['fee']=0.0
|
data['fee']=0.0
|
||||||
return data
|
return data
|
||||||
|
|
||||||
|
def undo(self,ids,context={}):
|
||||||
|
obj=self.browse(ids)[0]
|
||||||
|
for inv in obj.invoices:
|
||||||
|
inv.write({
|
||||||
|
'state': 'draft',
|
||||||
|
})
|
||||||
|
inv.delete()
|
||||||
|
for pick in obj.pickings:
|
||||||
|
pick.write({
|
||||||
|
'state': 'draft',
|
||||||
|
})
|
||||||
|
pick.delete()
|
||||||
|
|
||||||
|
obj.write({
|
||||||
|
'state': 'draft',
|
||||||
|
})
|
||||||
|
return {
|
||||||
|
'next': {
|
||||||
|
'name': 'clinic_hd_case',
|
||||||
|
'mode': 'form',
|
||||||
|
'active_id': obj.id,
|
||||||
|
},
|
||||||
|
'flash': '%s has been undo'%obj.number,
|
||||||
|
}
|
||||||
|
|
||||||
HDcase.register()
|
HDcase.register()
|
||||||
|
|
|
@ -37,6 +37,7 @@ class ImportPayment(Model):
|
||||||
"state": fields.Selection([("draft","Draft"),("success","Succes"),("fail","Fail"),('close','Close')],"Status"),
|
"state": fields.Selection([("draft","Draft"),("success","Succes"),("fail","Fail"),('close','Close')],"Status"),
|
||||||
'note': fields.Text("Note"),
|
'note': fields.Text("Note"),
|
||||||
'partner_id': fields.Many2One("partner","Contact"),
|
'partner_id': fields.Many2One("partner","Contact"),
|
||||||
|
'input_id': fields.Many2One("clinic.input.data", "Data"),
|
||||||
}
|
}
|
||||||
|
|
||||||
_order="date_import desc"
|
_order="date_import desc"
|
||||||
|
@ -53,21 +54,42 @@ class ImportPayment(Model):
|
||||||
}
|
}
|
||||||
|
|
||||||
def load_data(self,ids,context):
|
def load_data(self,ids,context):
|
||||||
records=[1,2,]
|
obj=self.browse(ids[0])
|
||||||
del records[0]
|
fname=obj.file
|
||||||
fmt1="%y-%m-%d"
|
if not fname:
|
||||||
fmt2="%Y-%m-%d"
|
raise Exception("Please select file!")
|
||||||
for record in records:
|
fpath=get_file_path(fname)
|
||||||
row=record.split(",")
|
suffix=fpath.split(".")[-1]
|
||||||
doc_date=row[0]
|
if suffix not in ('xls', 'xlsx'):
|
||||||
if doc_date:
|
raise Exception("ERROR : file support only xls, xlsx")
|
||||||
#'%m/%d/%y
|
wb=xlrd.open_workbook(fpath)
|
||||||
pt="(\d+)/(\d+)/(\d+)"
|
worksheet=wb.sheet_by_name("Sheet1")
|
||||||
res=re.search(pt,doc_date)
|
num_rows=worksheet.nrows-1
|
||||||
if res:
|
curr_row=-1
|
||||||
doc_date="%s-%s-%s" % (res.group(3),res.group(1),res.group(2))
|
cols={
|
||||||
newdate=datetime.strptime(doc_date,fmt1)
|
'hn': 38,
|
||||||
print(newdate.strftime(fmt2))
|
'dttran': 71,
|
||||||
|
'name14': 39,
|
||||||
|
'hcode18': 65, # remove -1
|
||||||
|
'amount23': 74,
|
||||||
|
'cur': 91,
|
||||||
|
'epoadm29': 93,
|
||||||
|
'eponame': 98,
|
||||||
|
'ln': 99,
|
||||||
|
'st': 101,
|
||||||
|
'allow37': 109,
|
||||||
|
}
|
||||||
|
|
||||||
|
while curr_row < num_rows:
|
||||||
|
curr_row +=1
|
||||||
|
vals={
|
||||||
|
'date': worksheet.cell_value(curr_row,cols['dttran']),
|
||||||
|
'name': worksheet.cell_value(curr_row,cols['name14']),
|
||||||
|
'hn': worksheet.cell_value(curr_row,cols['hn']),
|
||||||
|
'amount': worksheet.cell_value(curr_row,cols['amount23']),
|
||||||
|
'hct': worksheet.cell_value(curr_row,cols['amount23']),
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
def load_sheet(self,ids,context={}):
|
def load_sheet(self,ids,context={}):
|
||||||
obj=self.browse(ids[0])
|
obj=self.browse(ids[0])
|
||||||
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
from netforce.model import Model, fields, get_model
|
||||||
|
|
||||||
|
class InputData(Model):
|
||||||
|
_name="clinic.input.data"
|
||||||
|
_transient=True
|
||||||
|
|
||||||
|
_fields={
|
||||||
|
'date': fields.Date("Date"),
|
||||||
|
'name': fields.Char("Patient Name"),
|
||||||
|
'hn': fields.Char("HN"),
|
||||||
|
'amount': fields.Char("Amount"),
|
||||||
|
'hct': fields.Char("HCT"),
|
||||||
|
'medical_type': fields.Char("Medical Type"),
|
||||||
|
'medical_cost': fields.Char("Medical Cost"),
|
||||||
|
'other_cost': fields.Char("Other Cost"),
|
||||||
|
}
|
||||||
|
|
||||||
|
InputData.register()
|
|
@ -0,0 +1,65 @@
|
||||||
|
#from netforce.access import get_active_user
|
||||||
|
from netforce.model import Model, fields, get_model
|
||||||
|
|
||||||
|
class Payment(Model):
|
||||||
|
_name="clinic.payment"
|
||||||
|
_transient=True
|
||||||
|
|
||||||
|
def _get_all(self,ids,context={}):
|
||||||
|
res={}
|
||||||
|
for obj in self.browse(ids):
|
||||||
|
total=0.0
|
||||||
|
for line in obj.lines:
|
||||||
|
total+=line.amount or 0.0
|
||||||
|
res[obj.id]={
|
||||||
|
'total': total
|
||||||
|
}
|
||||||
|
return res
|
||||||
|
|
||||||
|
_fields={
|
||||||
|
'partner_id': fields.Many2One("partner","Partner"),
|
||||||
|
'lines': fields.One2Many("clinic.payment.line","payment_id", "Lines"),
|
||||||
|
'total': fields.Float("Total", function="_get_all",function_multi=True),
|
||||||
|
"state": fields.Selection([["draft","Draft"],['paid','Paid'],["cancelled","Cancelled"]],"Status",required=True),
|
||||||
|
}
|
||||||
|
|
||||||
|
def _get_partner_id(self,context={}):
|
||||||
|
refer_id=context.get("refer_id") # hd_case_id
|
||||||
|
hd_case=get_model('clinic.hd.case').browse(refer_id)
|
||||||
|
partner_id=hd_case.patient_id.partner_id.id or None
|
||||||
|
return partner_id
|
||||||
|
|
||||||
|
def _get_lines(self,context={}):
|
||||||
|
refer_id=context.get("refer_id") # hd_case_id
|
||||||
|
hd_case=get_model('clinic.hd.case').browse(refer_id)
|
||||||
|
lines=[]
|
||||||
|
for line in hd_case.lines:
|
||||||
|
vals={
|
||||||
|
'description': line.description or '',
|
||||||
|
'qty': line.qty or 0,
|
||||||
|
'price': line.price,
|
||||||
|
'amount': line.amount,
|
||||||
|
}
|
||||||
|
lines.append(vals)
|
||||||
|
return lines
|
||||||
|
|
||||||
|
def _get_total(self,context={}):
|
||||||
|
refer_id=context.get("refer_id")
|
||||||
|
hd_case=get_model('clinic.hd.case').browse(refer_id)
|
||||||
|
total=0.0
|
||||||
|
for line in hd_case.lines:
|
||||||
|
total+=line.amount
|
||||||
|
print("total ", total)
|
||||||
|
return total
|
||||||
|
|
||||||
|
_defaults={
|
||||||
|
'partner_id': _get_partner_id,
|
||||||
|
'lines': _get_lines,
|
||||||
|
'total': _get_total,
|
||||||
|
}
|
||||||
|
|
||||||
|
def paid(self,context={}):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
Payment.register()
|
|
@ -0,0 +1,17 @@
|
||||||
|
from netforce.model import Model, fields, get_model
|
||||||
|
|
||||||
|
class PaymentLine(Model):
|
||||||
|
_name="clinic.payment.line"
|
||||||
|
_transient=True
|
||||||
|
|
||||||
|
_fields={
|
||||||
|
'payment_id': fields.Many2One("clinic.payment","Payment"),
|
||||||
|
'description': fields.Char("Description"),
|
||||||
|
'qty': fields.Integer("Qty"),
|
||||||
|
'price': fields.Float("Unit Price"),
|
||||||
|
'account_id': fields.Many2One("account.account","Account"),
|
||||||
|
'amount': fields.Float("Amount"),
|
||||||
|
}
|
||||||
|
|
||||||
|
PaymentLine.register()
|
||||||
|
|
|
@ -1,119 +0,0 @@
|
||||||
import time
|
|
||||||
|
|
||||||
from netforce.model import Model, fields, get_model
|
|
||||||
|
|
||||||
class HDReport(Model):
|
|
||||||
_name="clinic.hd.report"
|
|
||||||
_string="HD Report"
|
|
||||||
_transient=True
|
|
||||||
|
|
||||||
_fields={
|
|
||||||
"date": fields.Date("Start-Date"),
|
|
||||||
#"time_start": fields.DateTime("Time start",required=False,search=True),
|
|
||||||
#"time_stop": fields.DateTime("Time stop",required=False,search=True),
|
|
||||||
"cycle_id": fields.Many2One("clinic.cycle","Cycle"),
|
|
||||||
}
|
|
||||||
|
|
||||||
_defaults={
|
|
||||||
'date': lambda *a: time.strftime("%Y-%m-%d"),
|
|
||||||
#'time_start': lambda *a: time.strftime("%Y-%m-%d"),
|
|
||||||
#'time_stop': lambda *a: time.strftime("%Y-%m-%d"),
|
|
||||||
}
|
|
||||||
|
|
||||||
_order="cycle_id desc"
|
|
||||||
|
|
||||||
|
|
||||||
def get_report_data(self,ids,context={}):
|
|
||||||
PATIENT_TYPE={
|
|
||||||
"mg":"Medical Government",
|
|
||||||
"sc":"Social Security",
|
|
||||||
"nhso":"NHSO (30฿)",
|
|
||||||
"personal": "Personal",
|
|
||||||
"others": "Others",
|
|
||||||
}
|
|
||||||
#time_start=time.strftime("%Y-%m-%d")
|
|
||||||
#time_stop=time.strftime("%Y-%m-%d")
|
|
||||||
date=time.strftime("%Y-%m-%d")
|
|
||||||
dom=[]
|
|
||||||
dom.append(['state','=','completed'])
|
|
||||||
if ids:
|
|
||||||
obj=self.browse(ids)[0]
|
|
||||||
if obj.date:
|
|
||||||
date=obj.date
|
|
||||||
if obj.cycle_id:
|
|
||||||
dom.append([
|
|
||||||
'cycle_id','=',obj.cycle_id.id,
|
|
||||||
])
|
|
||||||
dom.append(['time_start', ">=", obj.date+"00:00:00"])
|
|
||||||
dom.append(['time_stop', "<=", obj.date+"23:59:59"])
|
|
||||||
print("dom ", dom)
|
|
||||||
lines=[]
|
|
||||||
cycles=[]
|
|
||||||
index=0
|
|
||||||
no_patient=0
|
|
||||||
for hd_case in get_model("clinic.hd.case").search_browse(dom,order="cycle_id.sequence"):
|
|
||||||
patient_type=hd_case.patient_id.type
|
|
||||||
patient_type=PATIENT_TYPE.get(patient_type)
|
|
||||||
dialyzer_name=hd_case.dialyzers.id
|
|
||||||
dialyzer_name=DIALYZER_NAME.get(dialyzer_name)
|
|
||||||
cycle_name=hd_case.cycle_id.name or ""
|
|
||||||
show_cycle=False
|
|
||||||
if not cycle_name in cycles:
|
|
||||||
cycles.append(cycle_name)
|
|
||||||
show_cycle=True
|
|
||||||
if index > 1:
|
|
||||||
vals={
|
|
||||||
'color': 'success',
|
|
||||||
'show_cycle': False,
|
|
||||||
'cycle' : "",
|
|
||||||
'patient': "",
|
|
||||||
'no_patient': no_patient,
|
|
||||||
'patient_type' : "",
|
|
||||||
'doctor' : "",
|
|
||||||
'total' : "",
|
|
||||||
'rc_no' : "",
|
|
||||||
'dialyzer_name' : "",
|
|
||||||
'nurse' : "",
|
|
||||||
}
|
|
||||||
lines.append(vals)
|
|
||||||
no_patient=1
|
|
||||||
else:
|
|
||||||
no_patient+=1
|
|
||||||
index+=1
|
|
||||||
vals={
|
|
||||||
'show_cycle': show_cycle,
|
|
||||||
'cycle' : cycle_name,
|
|
||||||
'patient': hd_case.patient_id.name,
|
|
||||||
'patient_type' : patient_type,
|
|
||||||
'no_patient': 0,
|
|
||||||
'doctor' : hd_case.doctor_id.name,
|
|
||||||
'total' : hd_case.fee,
|
|
||||||
'rc_no' : hd_case.number,
|
|
||||||
'dialyzer' : dialyzer_name,
|
|
||||||
'nurse' : hd_case.nurse_id.name,
|
|
||||||
}
|
|
||||||
lines.append(vals)
|
|
||||||
|
|
||||||
# XXX
|
|
||||||
if lines:
|
|
||||||
vals={
|
|
||||||
'color': 'success',
|
|
||||||
'show_cycle': False,
|
|
||||||
'cycle' : "",
|
|
||||||
'patient': "",
|
|
||||||
'no_patient': no_patient,
|
|
||||||
'patient_type' : "",
|
|
||||||
'doctor' : "",
|
|
||||||
'total' : "",
|
|
||||||
'rc_no' : "",
|
|
||||||
'dialyzer_name' : "",
|
|
||||||
'nurse' : "",
|
|
||||||
}
|
|
||||||
lines.append(vals)
|
|
||||||
|
|
||||||
data={
|
|
||||||
'lines': lines,
|
|
||||||
}
|
|
||||||
return data
|
|
||||||
|
|
||||||
HDReport.register()
|
|
|
@ -14,16 +14,6 @@ class Visit(Model):
|
||||||
_name_field="number"
|
_name_field="number"
|
||||||
_multi_company=True
|
_multi_company=True
|
||||||
|
|
||||||
def _get_visit_late(self,ids,context={}):
|
|
||||||
res={}
|
|
||||||
datenow=time.strftime("%Y-%m-%d")
|
|
||||||
for obj in self.browse(ids):
|
|
||||||
late=0
|
|
||||||
if datenow > (obj.date_visit or '') and obj.state=='waiting_treatment':
|
|
||||||
late=1
|
|
||||||
res[obj.id]=late
|
|
||||||
return res
|
|
||||||
|
|
||||||
_fields={
|
_fields={
|
||||||
"number": fields.Char("Number",required=True,search=True),
|
"number": fields.Char("Number",required=True,search=True),
|
||||||
"time_start": fields.DateTime("Time Start",required=True),
|
"time_start": fields.DateTime("Time Start",required=True),
|
||||||
|
@ -32,12 +22,11 @@ class Visit(Model):
|
||||||
"doctor_id": fields.Many2One("clinic.doctor","Doctor",search=True),
|
"doctor_id": fields.Many2One("clinic.doctor","Doctor",search=True),
|
||||||
"nurse_id": fields.Many2One("clinic.nurse","Nurse",search=True),
|
"nurse_id": fields.Many2One("clinic.nurse","Nurse",search=True),
|
||||||
"department_id": fields.Many2One("clinic.department", "Department",search=True),
|
"department_id": fields.Many2One("clinic.department", "Department",search=True),
|
||||||
"state": fields.Selection([("draft","Draft"),("waiting_treatment","Waiting Treatment"),('treatment','Treatment'),("cancelled","Cancelled")],"Status",required=True),
|
|
||||||
"comments": fields.One2Many("message","related_id","Comments"),
|
"comments": fields.One2Many("message","related_id","Comments"),
|
||||||
"company_id": fields.Many2One("company","Company"),
|
"company_id": fields.Many2One("company","Company"),
|
||||||
'hd_cases': fields.One2Many('clinic.hd.case','visit_id',"HD Cases",readonly=True),
|
'hd_cases': fields.One2Many('clinic.hd.case','visit_id',"HD Cases",readonly=True),
|
||||||
"cycle_id": fields.Many2One("clinic.cycle","Cycle"),
|
"cycle_id": fields.Many2One("clinic.cycle","Cycle"),
|
||||||
"state": fields.Selection([("draft","Draft"),("waiting_treatment","Waiting Treatment"),('treatment','Treatment'),("cancelled","Cancelled")],"Status",required=True),
|
"state": fields.Selection([["draft","Draft"],["confirmed","Confirmed"],["cancelled","Cancelled"]],"Status",required=True),
|
||||||
"comments": fields.One2Many("message","related_id","Comments"),
|
"comments": fields.One2Many("message","related_id","Comments"),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -97,21 +86,18 @@ class Visit(Model):
|
||||||
number=self._get_number(context)
|
number=self._get_number(context)
|
||||||
vals={
|
vals={
|
||||||
'number': number,
|
'number': number,
|
||||||
'state': 'waiting_treatment',
|
'state': 'confirmed',
|
||||||
}
|
}
|
||||||
obj.write(vals)
|
obj.write(vals)
|
||||||
|
|
||||||
def do_treatment(self,ids,context={}):
|
|
||||||
hd_case_obj=get_model("clinic.hd.case")
|
hd_case_obj=get_model("clinic.hd.case")
|
||||||
dt=datetime
|
#dt=datetime
|
||||||
datenow=dt.now().strftime("%Y-%m-%d")
|
#datenow=dt.now().strftime("%Y-%m-%d")
|
||||||
obj=self.browse(ids)[0]
|
obj=self.browse(ids)[0]
|
||||||
date_visit=obj.time_start[0:10]
|
#date_visit=obj.time_start[0:10]
|
||||||
# cannot treatment if current date is not same visit date
|
# cannot treatment if current date is not same visit date
|
||||||
if date_visit!=datenow:
|
#if date_visit!=datenow:
|
||||||
raise Exception("Today is not treament date!")
|
#raise Exception("Today is not treament date!")
|
||||||
|
|
||||||
#include_fee=obj.patient_id.type in ('mg','sc','nhso') and True or False
|
|
||||||
vals={
|
vals={
|
||||||
'patient_id': obj.patient_id.id,
|
'patient_id': obj.patient_id.id,
|
||||||
'doctor_id': obj.doctor_id.id,
|
'doctor_id': obj.doctor_id.id,
|
||||||
|
@ -122,13 +108,24 @@ class Visit(Model):
|
||||||
'cycle_id' : obj.cycle_id.id,
|
'cycle_id' : obj.cycle_id.id,
|
||||||
'visit_id': obj.id,
|
'visit_id': obj.id,
|
||||||
'cycle_id': obj.cycle_id.id,
|
'cycle_id': obj.cycle_id.id,
|
||||||
#'fee': include_fee and 1500.00 or 0.0,
|
|
||||||
'fee_type': obj.patient_id.type,
|
'fee_type': obj.patient_id.type,
|
||||||
'lines':[],
|
'lines':[],
|
||||||
|
'gm_lines':[],
|
||||||
'dialyzers': [],
|
'dialyzers': [],
|
||||||
'state': 'in_progress',
|
'state': 'draft',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
products=get_model("product").search_browse([['code','=','FEE']])
|
||||||
|
for product in products:
|
||||||
|
vals['gm_lines'].append(('create',{
|
||||||
|
'product_id': product.id,
|
||||||
|
'description': product.name or "",
|
||||||
|
'qty': 1,
|
||||||
|
'price': product.sale_price or 0.0,
|
||||||
|
'amount': product.sale_price or 0.0,
|
||||||
|
'uom_id': product.uom_id.id,
|
||||||
|
}))
|
||||||
|
|
||||||
patient_type={
|
patient_type={
|
||||||
"mg":"Medical Government",
|
"mg":"Medical Government",
|
||||||
"sc":"Social Security",
|
"sc":"Social Security",
|
||||||
|
@ -150,7 +147,6 @@ class Visit(Model):
|
||||||
break
|
break
|
||||||
|
|
||||||
hd_case_id=hd_case_obj.create(vals)
|
hd_case_id=hd_case_obj.create(vals)
|
||||||
obj.write({"state":"treatment"})
|
|
||||||
return {
|
return {
|
||||||
'next': {
|
'next': {
|
||||||
'name': 'clinic_hd_case',
|
'name': 'clinic_hd_case',
|
||||||
|
@ -239,5 +235,17 @@ class Visit(Model):
|
||||||
time_start=data['time_start']
|
time_start=data['time_start']
|
||||||
data['time_stop']=(datetime.strptime(time_start,FMT_DATE)+timedelta(seconds=seconds)).strftime(FMT_DATE)
|
data['time_stop']=(datetime.strptime(time_start,FMT_DATE)+timedelta(seconds=seconds)).strftime(FMT_DATE)
|
||||||
return data
|
return data
|
||||||
|
|
||||||
|
def to_draft(self,ids,context={}):
|
||||||
|
obj=self.browse(ids)[0]
|
||||||
|
for hd_case in obj.hd_cases:
|
||||||
|
# XXX
|
||||||
|
hd_case.write({
|
||||||
|
'state': 'draft',
|
||||||
|
})
|
||||||
|
hd_case.delete()
|
||||||
|
obj.write({
|
||||||
|
'state': 'draft',
|
||||||
|
})
|
||||||
|
|
||||||
Visit.register()
|
Visit.register()
|
||||||
|
|
Loading…
Reference in New Issue