xxxx
parent
f4881e778a
commit
b242fa569a
|
@ -5,55 +5,9 @@
|
|||
<field name="name"/>
|
||||
<field name="date_import"/>
|
||||
<field name="type" required="1"/>
|
||||
<separator string="Select File -> Load Sheet -> Select Sheet(only one) -> Click Import"/>
|
||||
<group span="8" columns="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>
|
||||
<field name="input_id" readonly="1"/>
|
||||
<field name="mg_payment_id" readonly="1"/>
|
||||
<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"]]]}'/>
|
||||
<button span="3" size="large" icon="arrow-right" string="Import" type="primary" method="import"/>
|
||||
</foot>
|
||||
</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>
|
|
@ -1,8 +1,5 @@
|
|||
<form model="clinic.setting" title="Financial Settings">
|
||||
<tabs>
|
||||
<tab string="Schedule">
|
||||
<button string="Gen Schedule" method="gen_schedule" icon="arrow-right" type="success" />
|
||||
</tab>
|
||||
<tab string="Accounting">
|
||||
<separator string="Account Setting Medical Govelopment"/>
|
||||
<field name="mg_partner_id" />
|
||||
|
|
|
@ -33,3 +33,4 @@ from . import gen_visit
|
|||
from . import gen_visit_line
|
||||
from . import payment
|
||||
from . import payment_line
|
||||
from . import input_data
|
||||
|
|
|
@ -331,7 +331,9 @@ class HDcase(Model):
|
|||
|
||||
for line in obj.lines:
|
||||
prod=line.product_id
|
||||
|
||||
if prod.type != 'stock':
|
||||
print("continue ")
|
||||
continue
|
||||
wh_loc_id=prod.location_id.id
|
||||
if not wh_loc_id:
|
||||
|
|
|
@ -37,6 +37,7 @@ class ImportPayment(Model):
|
|||
"state": fields.Selection([("draft","Draft"),("success","Succes"),("fail","Fail"),('close','Close')],"Status"),
|
||||
'note': fields.Text("Note"),
|
||||
'partner_id': fields.Many2One("partner","Contact"),
|
||||
'input_id': fields.Many2One("clinic.input.data", "Data"),
|
||||
}
|
||||
|
||||
_order="date_import desc"
|
||||
|
@ -53,7 +54,42 @@ class ImportPayment(Model):
|
|||
}
|
||||
|
||||
def load_data(self,ids,context):
|
||||
pass
|
||||
obj=self.browse(ids[0])
|
||||
fname=obj.file
|
||||
if not fname:
|
||||
raise Exception("Please select file!")
|
||||
fpath=get_file_path(fname)
|
||||
suffix=fpath.split(".")[-1]
|
||||
if suffix not in ('xls', 'xlsx'):
|
||||
raise Exception("ERROR : file support only xls, xlsx")
|
||||
wb=xlrd.open_workbook(fpath)
|
||||
worksheet=wb.sheet_by_name("Sheet1")
|
||||
num_rows=worksheet.nrows-1
|
||||
curr_row=-1
|
||||
cols={
|
||||
'hn': 38,
|
||||
'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={}):
|
||||
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()
|
Loading…
Reference in New Issue