filter matching payment
parent
bce643eec6
commit
e203358be3
|
@ -0,0 +1,6 @@
|
|||
<action>
|
||||
<field name="string">Select</field>
|
||||
<field name="view_cls">form_popup</field>
|
||||
<field name="model">clinic.matching.payment.popup</field>
|
||||
<field name="target">_popup</field>
|
||||
</action>
|
|
@ -1,5 +1,6 @@
|
|||
<inherit model="account.invoice" inherit="cust_invoice_form">
|
||||
<field name="related_id" position="before">
|
||||
<field name="department_id"/>
|
||||
<field name="department_id" span="2"/>
|
||||
<field name="patient_partner_id" span="2"/>
|
||||
</field>
|
||||
</inherit>
|
||||
|
|
|
@ -2,14 +2,13 @@
|
|||
<head>
|
||||
<field name="state"/>
|
||||
<button string="Print" dropdown="1" icon="print">
|
||||
<item string="Match" method="print_match"/>
|
||||
<item string="Unmatch" method="print_unmatch"/>
|
||||
<item string="Invoice Unmatch" action="clinic_matching_payment_unmatch_invoice"/>
|
||||
</button>
|
||||
<button string="Options" dropdown="1">
|
||||
<item string="Update Identification" method="update_id"/>
|
||||
<item string="To Draft" method="to_draft" states="approved"/>
|
||||
<item string="Clear" method="clear_line" confirm="Are you sure?"/>
|
||||
<item string="Select Type" action="clinic_matching_payment_popup"/>
|
||||
<item string="Update ID Card" method="update_id"/>
|
||||
<item string="Reset Items" method="clear_line" confirm="Are you sure?"/>
|
||||
</button>
|
||||
</head>
|
||||
<field name="date" onchange="onchange_date" mode="month" span="3"/>
|
||||
|
@ -21,8 +20,10 @@
|
|||
<field name="pcode" span="3"/>
|
||||
<field name="hcode_id" span="3" attrs='{"required":[["pcode","=","SSO"]],"invisible":[["pcode","!=","SSO"]]}'/>
|
||||
<field name="file" span="3"/>
|
||||
<field name="type" invisible="1" span="3"/>
|
||||
<tabs>
|
||||
<tab string="General">
|
||||
<group attrs='{"invisible":[["type","in",["match","unmatch"]]]}'>
|
||||
<field name="lines" nolabel="1" count="0">
|
||||
<list>
|
||||
<field name="date"/>
|
||||
|
@ -37,6 +38,39 @@
|
|||
<field name="state"/>
|
||||
</list>
|
||||
</field>
|
||||
</group>
|
||||
<group attrs='{"invisible":[["type","in",["all","match"]]]}'>
|
||||
<field name="unmatch_lines" nolabel="1" count="0">
|
||||
<list>
|
||||
<field name="date"/>
|
||||
<field name="hn"/>
|
||||
<field name="pid"/>
|
||||
<field name="name"/>
|
||||
<field name="epo" sum="1"/>
|
||||
<field name="srv" sum="1"/>
|
||||
<field name="fee" sum="1"/>
|
||||
<field name="amount" sum="1"/>
|
||||
<field name="invoice_id" onchange="onchange_invoice" domain='[["date","=",date],["state","=","waiting_payment"]]'/>
|
||||
<field name="state"/>
|
||||
</list>
|
||||
</field>
|
||||
</group>
|
||||
<group attrs='{"invisible":[["type","in",["all","unmatch"]]]}'>
|
||||
<field name="match_lines" nolabel="1" count="0">
|
||||
<list>
|
||||
<field name="date"/>
|
||||
<field name="hn"/>
|
||||
<field name="pid"/>
|
||||
<field name="name"/>
|
||||
<field name="epo" sum="1"/>
|
||||
<field name="srv" sum="1"/>
|
||||
<field name="fee" sum="1"/>
|
||||
<field name="amount" sum="1"/>
|
||||
<field name="invoice_id" onchange="onchange_invoice" domain='[["date","=",date],["state","=","waiting_payment"]]'/>
|
||||
<field name="state"/>
|
||||
</list>
|
||||
</field>
|
||||
</group>
|
||||
<group span="8" columns="1">
|
||||
<field name="total_srv" offset="1" span="3"/>
|
||||
<newline/>
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
<form model="clinic.matching.payment.popup" title="Select Type">
|
||||
<group form_layout="stacked">
|
||||
<field name="type" span="6"/>
|
||||
<field name="matching_payment_id" invisible="1"/>
|
||||
</group>
|
||||
<foot>
|
||||
<button string="Select" method="do_select" type="primary"/>
|
||||
</foot>
|
||||
</form>
|
|
@ -104,6 +104,7 @@ from . import make_apt
|
|||
from . import make_apt_line
|
||||
from . import matching_payment
|
||||
from . import matching_payment_line
|
||||
from . import matching_payment_popup
|
||||
from . import invoice_payment
|
||||
from . import invoice_payment_line
|
||||
from . import matching_hdcase
|
||||
|
|
|
@ -7,6 +7,8 @@ class AccountInvoice(Model):
|
|||
_fields={
|
||||
'clinic_expense_id': fields.Many2One("clinic.hd.case.expense","Expense"),
|
||||
'department_id': fields.Many2One("clinic.department","Department",search=True),
|
||||
'patient_partner_id': fields.Many2One("partner","Patient",search=True),
|
||||
}
|
||||
|
||||
|
||||
AccountInvoice.register()
|
||||
|
|
|
@ -506,6 +506,7 @@ class HDCase(Model):
|
|||
}))
|
||||
|
||||
patient=obj.patient_id
|
||||
patient_partner=patient.partner_id
|
||||
|
||||
if rmb_lines:
|
||||
ptype=patient.type_id
|
||||
|
@ -528,6 +529,8 @@ class HDCase(Model):
|
|||
}
|
||||
vals["partner_id"]=partner.id
|
||||
vals['lines']=rmb_lines
|
||||
if patient_partner:
|
||||
vals['patient_partner_id']=patient_partner.id,
|
||||
get_model("account.invoice").create(vals,context)
|
||||
|
||||
if normb_lines and is_credit:
|
||||
|
@ -548,6 +551,8 @@ class HDCase(Model):
|
|||
'partner_id':partner.id,
|
||||
}
|
||||
vals['lines']=normb_lines
|
||||
if patient_partner:
|
||||
vals['patient_partner_id']=patient_partner.id,
|
||||
get_model("account.invoice").create(vals,context) # create alway
|
||||
|
||||
obj.make_pickings()
|
||||
|
|
|
@ -10,7 +10,6 @@ from . import utils
|
|||
class MatchingPayment(Model):
|
||||
_name="clinic.matching.payment"
|
||||
_string="Payment Matching"
|
||||
#_transient=True
|
||||
|
||||
def _get_store(self,ids,context={}):
|
||||
res={}
|
||||
|
@ -28,9 +27,13 @@ class MatchingPayment(Model):
|
|||
total_fee=0
|
||||
total_srv=0
|
||||
total_epo=0
|
||||
for line in obj.lines:
|
||||
if line.state!='match':
|
||||
continue
|
||||
otype=obj.type or "all"
|
||||
lines=obj.lines
|
||||
if otype=='match':
|
||||
lines=obj.match_lines
|
||||
elif otype=='unmatch':
|
||||
lines=obj.unmatch_lines
|
||||
for line in lines:
|
||||
total_fee+=line.fee or 0
|
||||
total_srv+=line.srv or 0
|
||||
total_epo+=line.epo or 0
|
||||
|
@ -38,9 +41,9 @@ class MatchingPayment(Model):
|
|||
if state=='match':
|
||||
total_match+=1
|
||||
res[obj.id]={
|
||||
'total': len(obj.lines),
|
||||
'total': len(lines),
|
||||
'total_match': total_match,
|
||||
'total_unmatch': len(obj.lines)-total_match,
|
||||
'total_unmatch': len(lines)-total_match,
|
||||
'total_fee': total_fee,
|
||||
'total_srv': total_srv,
|
||||
'total_epo': total_epo,
|
||||
|
@ -58,6 +61,8 @@ class MatchingPayment(Model):
|
|||
'pcode': fields.Char("Code",required=True),
|
||||
'hcode_id': fields.Many2One("clinic.hospital","HCode"),
|
||||
'lines': fields.One2Many("clinic.matching.payment.line","match_id", "Lines"),
|
||||
'match_lines': fields.One2Many("clinic.matching.payment.line","match_id", "Lines",domain=[['state','=','match']]),
|
||||
'unmatch_lines': fields.One2Many("clinic.matching.payment.line","match_id", "Lines",domain=[['state','=','unmatch']]),
|
||||
'note': fields.Text("Note"),
|
||||
'total': fields.Integer("Total",function="_get_all",function_multi=True),
|
||||
'total_match': fields.Integer("Match",function="_get_all",function_multi=True),
|
||||
|
@ -66,6 +71,7 @@ class MatchingPayment(Model):
|
|||
'total_srv': fields.Float("Service",function="_get_all",function_multi=True),
|
||||
'total_epo': fields.Float("EPO",function="_get_all",function_multi=True),
|
||||
'state': fields.Selection([['draft','Draft'],['approved','Approved']],'State'),
|
||||
'type': fields.Selection([['all','All'],['match','Match'],['unmatch','Not Match']],'Type'),
|
||||
'user_id': fields.Many2One("base.user","Approver"),
|
||||
}
|
||||
|
||||
|
@ -102,6 +108,7 @@ class MatchingPayment(Model):
|
|||
'pcode': _get_pcode,
|
||||
'state': 'draft',
|
||||
'user_id': lambda *a: get_active_user(),
|
||||
'type': 'all',
|
||||
}
|
||||
_order="date desc"
|
||||
|
||||
|
@ -517,16 +524,36 @@ class MatchingPayment(Model):
|
|||
def get_data(self,context={}):
|
||||
ref_id=int(context.get("refer_id","0"))
|
||||
obj=self.browse(ref_id)
|
||||
dom=[]
|
||||
dom.append(['date','>=',obj.date_from])
|
||||
dom.append(['date','<=',obj.date_to])
|
||||
for invoice in get_model("account.invoice").search_browse(dom):
|
||||
pass
|
||||
match_ids=[]
|
||||
inv_match_ids=[]
|
||||
for line in obj.lines:
|
||||
pass
|
||||
print("name ", obj.name)
|
||||
data={}
|
||||
invoice=line.invoice_id
|
||||
if invoice and line.state=='match':
|
||||
inv_match_ids.append(invoice.id)
|
||||
dom=[
|
||||
['partner_id','=',obj.partner_id.id],
|
||||
['date', '>=', obj.date_from],
|
||||
['date', '<=', obj.date_to],
|
||||
['state','=','waiting_payment'],
|
||||
]
|
||||
lines=[]
|
||||
no=1
|
||||
for invoice in get_model('account.invoice').search_browse(dom):
|
||||
if invoice.id in inv_match_ids:
|
||||
continue
|
||||
vals={
|
||||
'no': no,
|
||||
'date': invoice.date,
|
||||
'number': invoice.number,
|
||||
'ref': invoice.ref,
|
||||
'amount_due': invoice.amount_due or 0,
|
||||
}
|
||||
lines.append(vals)
|
||||
no+=1
|
||||
data={
|
||||
'lines': lines,
|
||||
'date_from': obj.date_from,
|
||||
'date_to': obj.date_to,
|
||||
}
|
||||
return data
|
||||
|
||||
def print_invoice_unmatch(self,ids,context={}):
|
||||
|
@ -537,7 +564,7 @@ class MatchingPayment(Model):
|
|||
'mode': 'form',
|
||||
'active_id': obj.id,
|
||||
},
|
||||
'flash': 'TODO',
|
||||
#'flash': 'TODO',
|
||||
}
|
||||
|
||||
MatchingPayment.register()
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
from netforce.model import Model, fields, get_model
|
||||
|
||||
class MatchingPaymentPopup(Model):
|
||||
_name="clinic.matching.payment.popup"
|
||||
_transient=True
|
||||
|
||||
_fields={
|
||||
"matching_payment_id": fields.Many2One("clinic.matching.payment","Matching Payment",required=True,on_delete="cascade"),
|
||||
'type': fields.Selection([['all','All'],['match','Match'],['unmatch','Not Match']],'Type'),
|
||||
}
|
||||
|
||||
def _get_id(self,context={}):
|
||||
refer_id=context.get("refer_id")
|
||||
if not refer_id:
|
||||
return None
|
||||
return int(refer_id)
|
||||
|
||||
_defaults={
|
||||
'matching_payment_id': _get_id,
|
||||
'type': 'all',
|
||||
}
|
||||
|
||||
def do_select(self,ids,context):
|
||||
obj=self.browse(ids)[0]
|
||||
matching=obj.matching_payment_id
|
||||
matching.write({
|
||||
'type': obj.type,
|
||||
})
|
||||
return {
|
||||
'next': {
|
||||
'name': 'clinic_matching_payment',
|
||||
'mode': 'form',
|
||||
'active_id': matching.id,
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
MatchingPaymentPopup.register()
|
||||
|
Binary file not shown.
|
@ -1,16 +1,15 @@
|
|||
todo:
|
||||
- report k. boy (sub detail) -> ok
|
||||
- need to update level of nurse (Chanon)
|
||||
- staff rotation
|
||||
- update level for staff
|
||||
- add script to
|
||||
- multi department access ***
|
||||
- merge staff same name but different department
|
||||
- doctor นายแพทย์ ทวีชัย
|
||||
- ** udpate server (run click me)
|
||||
- run script
|
||||
- update level's nurse
|
||||
- report k. boy (sub detail) -> ok
|
||||
- ** update accounting
|
||||
- bug
|
||||
- wht (david)
|
||||
- link ref -> ok
|
||||
- bug -> ok
|
||||
- wht (david) -> p yui test
|
||||
|
||||
===============================
|
||||
|
||||
- compute labor cost
|
||||
|
|
Loading…
Reference in New Issue