match uc
							parent
							
								
									e69cf8a48f
								
							
						
					
					
						commit
						5f88d19d74
					
				|  | @ -1,6 +1,6 @@ | |||
| <form model="clinic.setting.account.product" show_company="1"> | ||||
|     <field name="patient_type_id"/> | ||||
|     <field name="categ_id"/> | ||||
|     <field name="patient_type_id" required="1"/> | ||||
|     <field name="categ_id" required="1"/> | ||||
|     <field name="product_id" domain='[["categ_id","=",categ_id]]'/> | ||||
|     <field name="ar_credit_id" domain='[["type","!=","view"]]'/> | ||||
|     <field name="ar_debit_id" domain='[["type","!=","view"]]'/> | ||||
|  |  | |||
|  | @ -593,6 +593,9 @@ class HDCase(Model): | |||
| 
 | ||||
|     def make_invoices(self,ids,context={}): | ||||
|         setting=get_model("settings").browse(1,context) | ||||
|         fin_account_receivable_id=setting.account_receivable_id.id | ||||
|         if not fin_account_receivable_id: | ||||
|             raise Exception("Missing Account Receivable") | ||||
|         currency_id=setting.currency_id.id | ||||
|         if not currency_id: | ||||
|             raise Exception("Currency not found in account settings") | ||||
|  |  | |||
|  | @ -120,6 +120,7 @@ class PaymentMatching(Model): | |||
|         department_id=None | ||||
|         inv_state=defaults.get('inv_state') | ||||
|         view_type=defaults.get('view_type') | ||||
|         pcode='' | ||||
|         if ids: | ||||
|             obj=self.browse(ids)[0] | ||||
|             date_from=obj.date_from | ||||
|  | @ -128,8 +129,10 @@ class PaymentMatching(Model): | |||
|             department_id=obj.department_id.id | ||||
|             inv_state=obj.inv_state | ||||
|             view_type=obj.view_type | ||||
|             pcode=obj.pcode | ||||
|         lines=[] | ||||
|         invoices=[] | ||||
|         total_invoice=0 | ||||
|         total_match_invoice=0 | ||||
|         total_epo=0 | ||||
|         total_srv=0 | ||||
|  | @ -146,7 +149,7 @@ class PaymentMatching(Model): | |||
|                 dom.append(['department_id.branch_id','=',branch_id]) | ||||
|             elif department_id: | ||||
|                 dom.append(['department_id','=',department_id]) | ||||
|                 field_names=['date','number','amount_due','patient_id'] | ||||
|             field_names=['date','number','amount_due','patient_id'] | ||||
|             for inv in get_model('account.invoice').search_read(dom,field_names): | ||||
|                 vals={ | ||||
|                     'id': inv['id'], | ||||
|  | @ -161,7 +164,7 @@ class PaymentMatching(Model): | |||
|                         vals['patient_name']=patient.name | ||||
|                         vals['patient_nospace_name']=patient.name_check | ||||
|                         vals['patient_cid']=patient.card_no | ||||
|                         vals['patient_hn']=patient.hn | ||||
|                         vals['patient_hn']=patient.hn_no | ||||
|                     else: | ||||
|                         vals[field_name]=inv[field_name] | ||||
|                     vals[field_name]=inv[field_name] | ||||
|  | @ -169,9 +172,11 @@ class PaymentMatching(Model): | |||
|             return invoices | ||||
|         if view_type=='invoice': | ||||
|                 lines=get_invoices() | ||||
|                 total_invoice=len(lines) | ||||
|         else: | ||||
|             if obj: | ||||
|             if obj and obj.pcode=='SSO': | ||||
|                 invoices=get_invoices() | ||||
|                 total_invoice=len(invoices) | ||||
|                 rlines=obj.get_line() | ||||
|                 no=1 | ||||
|                 for rline in rlines: | ||||
|  | @ -218,18 +223,77 @@ class PaymentMatching(Model): | |||
|                                         break | ||||
|                     lines.append(line_vals) | ||||
|                     no+=1 | ||||
|             elif obj and obj.pcode=='UC': | ||||
|                 invoices=get_invoices() | ||||
|                 total_invoice=len(invoices) | ||||
|                 rlines=obj.get_line() | ||||
|                 no=1 | ||||
|                 for rline in rlines: | ||||
|                     #{'amount': '1500.0000', | ||||
|                      #'cstat': None, | ||||
|                      #'dttran': '2014-09-27T10:00:00', | ||||
|                      #'epostat': 'E', | ||||
|                      #'hdflag': 'COU', | ||||
|                      #'hdrate': '1500.0000', | ||||
|                      #'hn': '98511252', | ||||
|                      #'hreg': 'NHSO1', | ||||
|                      #'invno': '437941480', | ||||
|                      #'paid': '0.0000', | ||||
|                      #'paychk': '1', | ||||
|                      #'reimbpay': '0.0000', | ||||
|                      #'rid': '2190', | ||||
|                      #'station': '01'} | ||||
|                     date,time=(rline['dttran'] or "").split("T") | ||||
|                     fee=0 | ||||
|                     if rline.get('amount'): | ||||
|                         fee=float(rline['amount']) | ||||
|                     total_fee+=fee | ||||
|                     hn=rline['hn'] | ||||
|                     hn=hn.replace(" ", "") | ||||
|                     pname='' | ||||
|                     pname_check='' | ||||
|                     pid='' | ||||
|                     for pt in get_model("clinic.patient").search_browse([['hn_no','=',hn]]): | ||||
|                         pname=pt.name or "" | ||||
|                         pname_check=pt.name_check or "" | ||||
|                         pid=pt.card_no or "" | ||||
|                     vals={ | ||||
|                         'date':date, | ||||
|                         'patient_name': pname, | ||||
|                         'pid': pid, | ||||
|                         'hn': hn, | ||||
|                         'fee': fee, | ||||
|                         'srv': 0, | ||||
|                         'epo': 0, | ||||
|                         'inv_id': None, | ||||
|                         'inv_number': '', | ||||
|                         'no': no, | ||||
|                     } | ||||
|                     for inv in invoices: | ||||
|                         if inv['patient_id']: | ||||
|                             if pid==inv['patient_cid'] or hn==inv['patient_hn'] or pname_check==inv['patient_nospace_name']: | ||||
|                                 if date==inv['date'] and fee==inv['amount_due']: | ||||
|                                     vals['inv_id']=inv['id'] | ||||
|                                     vals['inv_number']=inv['number'] | ||||
|                                     total_match_invoice+=1 | ||||
|                                     break | ||||
|                     lines.append(vals) | ||||
|                     no+=1 | ||||
|         data={ | ||||
|             'lines': lines, | ||||
|             'date_from': date_from, | ||||
|             'date_to': date_to, | ||||
|             'total_qty': len(lines), | ||||
|             'total_item': len(lines), | ||||
|             'total_fee': total_fee, | ||||
|             'total_epo': total_epo, | ||||
|             'total_srv': total_srv, | ||||
|             'total_invoice': total_invoice, | ||||
|             'total_match_invoice': total_match_invoice, | ||||
|             'total_invoice': len(invoices), | ||||
|             'total_match_invoice_in_pc': (total_match_invoice/total_invoice)*100, | ||||
|             'total_unmatch_invoice': total_invoice-total_match_invoice, | ||||
|             'total_amount': total_amount, | ||||
|             'view_type': view_type, | ||||
|             'pcode': pcode, | ||||
|         } | ||||
|         return data | ||||
| 
 | ||||
|  |  | |||
|  | @ -8,8 +8,8 @@ class SettingAccountProduct(Model): | |||
| 
 | ||||
|     _fields={ | ||||
|         "setting_id": fields.Many2One("clinic.setting","Setting",required=True,on_delete="cascade"), | ||||
|         "patient_type_id": fields.Many2One("clinic.patient.type","Patient Type",search=True,required=True), | ||||
|         'categ_id': fields.Many2One("product.categ","Category",search=True,required=True), | ||||
|         "patient_type_id": fields.Many2One("clinic.patient.type","Patient Type",search=True), | ||||
|         'categ_id': fields.Many2One("product.categ","Category",search=True), | ||||
|         "product_id": fields.Many2One("product","Product",search=True,required=True), | ||||
|         "ar_credit_id": fields.Many2One("account.account","Income Credit",multi_company=True,search=True), | ||||
|         "ar_debit_id": fields.Many2One("account.account","AR Debit",multi_company=True,search=True), | ||||
|  |  | |||
|  | @ -1,17 +1,22 @@ | |||
| <div class="row" style="margin-top:10px;"> | ||||
|     <table class="table table-bordered"> | ||||
|         <thead> | ||||
|             <th style="text-align:center">Total Item</th> | ||||
|             <th style="text-align:center">Total Invoice</th> | ||||
|             <th style="text-align:center">Match</th> | ||||
|             <th style="text-align:center">Un Match</th> | ||||
|         </thead> | ||||
|         <tbody> | ||||
|             <tr> | ||||
|                 <td style="text-align:center">{{currency total_item}}</td> | ||||
|                 <td style="text-align:center">{{currency total_invoice}}</td> | ||||
|                 <td style="text-align:center">{{currency total_match_invoice}}</td> | ||||
|                 <td style="text-align:center">{{currency total_unmatch_invoice}}</td> | ||||
|             </tr> | ||||
|         </tbody> | ||||
|     </table> | ||||
| </div> | ||||
| <div class="row"> | ||||
| <table class="table table-hover"> | ||||
|     {{#ifeq view_type 'invoice'}} | ||||
|         <thead class="scroll-header"> | ||||
|  | @ -32,78 +37,125 @@ | |||
|         <tfoot> | ||||
|         </tfoot> | ||||
|     {{else}} | ||||
|         <thead class="scroll-header"> | ||||
|             <th>No.</th> | ||||
|             <th>Date</th> | ||||
|             <th>PID</th> | ||||
|             <th>HN</th> | ||||
|             <th>Patient</th> | ||||
|             <th style="text-align:right">Fee</th> | ||||
|             <th>Inv Fee</th> | ||||
|             <th style="text-align:right">EPO</th> | ||||
|             <th>Inv EPO</th> | ||||
|             <th style="text-align:right">Service</th> | ||||
|             <th>Inv Service</th> | ||||
|             <th style="text-align:right">Amount</th> | ||||
|         </thead> | ||||
|         <tbody> | ||||
|             {{#if lines}} | ||||
|                 {{#each lines}} | ||||
|                     <tr> | ||||
|                         <td>{{no}}</td> | ||||
|                         <td style="width:8%">{{date}}</td> | ||||
|                         <td>{{pid}}</td> | ||||
|                         <td>{{hn}}</td> | ||||
|                         <td>{{patient_name}}</td> | ||||
|                         <td style="text-align:right">{{currency fee}}</td> | ||||
|                         <td> | ||||
|                             <a style="text-decoration:None" href="ui#form_view_xml=cust_invoice_form&active_id={{inv_fee_id}}&name=cust_invoice&mode=form" target="_blank"> | ||||
|                                 {{#if inv_fee_id}} | ||||
|                                     <span class="label label-info"> | ||||
|                                         {{inv_fee}} | ||||
|                                     </span> | ||||
|         {{#ifeq pcode "SSO"}} | ||||
|             <thead class="scroll-header"> | ||||
|                 <th style="text-align:center">No.</th> | ||||
|                 <th style="text-align:center">Date</th> | ||||
|                 <th style="text-align:center">PID</th> | ||||
|                 <th style="text-align:center">HN</th> | ||||
|                 <th style="text-align:center">Patient</th> | ||||
|                 <th style="text-align:center">Fee</th> | ||||
|                 <th style="text-align:center">Inv Fee</th> | ||||
|                 <th style="text-align:center">EPO</th> | ||||
|                 <th style="text-align:center">Inv EPO</th> | ||||
|                 <th style="text-align:center">Service</th> | ||||
|                 <th style="text-align:center">Inv Service</th> | ||||
|                 <th style="text-align:center">Amount</th> | ||||
|             </thead> | ||||
|             <tbody> | ||||
|                 {{#if lines}} | ||||
|                     {{#each lines}} | ||||
|                         <tr> | ||||
|                             <td>{{no}}</td> | ||||
|                             <td style="width:8%">{{date}}</td> | ||||
|                             <td>{{pid}}</td> | ||||
|                             <td>{{hn}}</td> | ||||
|                             <td>{{patient_name}}</td> | ||||
|                             <td style="text-align:right">{{currency fee}}</td> | ||||
|                             <td> | ||||
|                                 <a style="text-decoration:None" href="ui#form_view_xml=cust_invoice_form&active_id={{inv_fee_id}}&name=cust_invoice&mode=form" target="_blank"> | ||||
|                                     {{#if inv_fee_id}} | ||||
|                                         <span class="label label-info"> | ||||
|                                             {{inv_fee}} | ||||
|                                         </span> | ||||
|                                     {{/if}} | ||||
|                                 </a> | ||||
|                             </td> | ||||
|                             <td style="text-align:right">{{currency epo}}</td> | ||||
|                             <td> | ||||
|                                 <a style="text-decoration:None" href="ui#form_view_xml=cust_invoice_form&active_id={{inv_epo_id}}&name=cust_invoice&mode=form" target="_blank"> | ||||
|                                     {{#if inv_epo_id}} | ||||
|                                         <span class="label label-info"> | ||||
|                                             {{inv_epo}} | ||||
|                                         </span> | ||||
|                                     {{/if}} | ||||
|                                 </a> | ||||
|                             </td> | ||||
|                             <td style="text-align:right">{{currency srv}}</td> | ||||
|                             <td> | ||||
|                                 <a href="ui#form_view_xml=cust_invoice_form&active_id={{inv_srv_id}}&name=cust_invoice&mode=form" target="_blank"> | ||||
|                                     {{#if inv_srv_id}} | ||||
|                                         <span class="label label-info"> | ||||
|                                             {{inv_srv}} | ||||
|                                         </span> | ||||
|                                     {{/if}} | ||||
|                                 </a> | ||||
|                             </td> | ||||
|                             <td style="text-align:right">{{currency amount}}</td> | ||||
|                         </tr> | ||||
|                     {{/each}} | ||||
|                 {{else}} | ||||
|                 {{/if}} | ||||
|             </tbody> | ||||
|                 <th></th> | ||||
|                 <th></th> | ||||
|                 <th></th> | ||||
|                 <th></th> | ||||
|                 <th></th> | ||||
|                 <th style="text-align:right;">{{currency total_fee}}</th> | ||||
|                 <th></th> | ||||
|                 <th style="text-align:right;">{{currency total_epo}}</th> | ||||
|                 <th></th> | ||||
|                 <th style="text-align:right">{{currency total_srv}}</th> | ||||
|                 <th></th> | ||||
|                 <th style="text-align:right">{{currency total_amount}}</th> | ||||
|             <tfoot> | ||||
|             </tfoot> | ||||
|         {{else}} | ||||
|             {{#ifeq pcode "UC"}} | ||||
|                 <thead class="scroll-header"> | ||||
|                     <th>No.</th> | ||||
|                     <th>Date</th> | ||||
|                     <th>HN</th> | ||||
|                     <th>ID</th> | ||||
|                     <th>Patient</th> | ||||
|                     <th>Fee</th> | ||||
|                     <th>Invoice</th> | ||||
|                 </thead> | ||||
|                 <tbody> | ||||
|                     {{#each lines}} | ||||
|                         <tr> | ||||
|                             <td>{{no}}</td> | ||||
|                             <td>{{date}}</td> | ||||
|                             <td>{{hn}}</td> | ||||
|                             <td>{{pid}}</td> | ||||
|                             <td>{{patient_name}}</td> | ||||
|                             <td>{{currency fee}}</td> | ||||
|                             <td> | ||||
|                                 {{#if inv_number}} | ||||
|                                     <a href="ui#form_view_xml=cust_invoice_form&active_id={{inv_id}}&name=cust_invoice&mode=form" target="_blank"> | ||||
|                                         <span class="label label-info"> | ||||
|                                             {{inv_number}} | ||||
|                                         </span> | ||||
|                                     </a> | ||||
|                                 {{/if}} | ||||
|                             </a> | ||||
|                         </td> | ||||
|                         <td style="text-align:right">{{currency epo}}</td> | ||||
|                         <td> | ||||
|                             <a style="text-decoration:None" href="ui#form_view_xml=cust_invoice_form&active_id={{inv_epo_id}}&name=cust_invoice&mode=form" target="_blank"> | ||||
|                                 {{#if inv_epo_id}} | ||||
|                                     <span class="label label-info"> | ||||
|                                         {{inv_epo}} | ||||
|                                     </span> | ||||
|                                 {{/if}} | ||||
|                             </a> | ||||
|                         </td> | ||||
|                         <td style="text-align:right">{{currency srv}}</td> | ||||
|                         <td> | ||||
|                             <a href="ui#form_view_xml=cust_invoice_form&active_id={{inv_srv_id}}&name=cust_invoice&mode=form" target="_blank"> | ||||
|                                 {{#if inv_srv_id}} | ||||
|                                     <span class="label label-info"> | ||||
|                                         {{inv_srv}} | ||||
|                                     </span> | ||||
|                                 {{/if}} | ||||
|                             </a> | ||||
|                         </td> | ||||
|                         <td style="text-align:right">{{currency amount}}</td> | ||||
|                     </tr> | ||||
|                 {{/each}} | ||||
|                             </td> | ||||
|                         </tr> | ||||
|                     {{/each}} | ||||
|                 </tbody> | ||||
|                 <tfoot> | ||||
|                     <th></th> | ||||
|                     <th></th> | ||||
|                     <th></th> | ||||
|                     <th></th> | ||||
|                     <th></th> | ||||
|                     <th>{{currency total_fee}}</th> | ||||
|                     <th></th> | ||||
|                 </tfoot> | ||||
|             {{else}} | ||||
|             {{/if}} | ||||
|         </tbody> | ||||
|             <th></th> | ||||
|             <th></th> | ||||
|             <th></th> | ||||
|             <th></th> | ||||
|             <th></th> | ||||
|             <th style="text-align:right;">{{currency total_fee}}</th> | ||||
|             <th></th> | ||||
|             <th style="text-align:right;">{{currency total_epo}}</th> | ||||
|             <th></th> | ||||
|             <th style="text-align:right">{{currency total_srv}}</th> | ||||
|             <th></th> | ||||
|             <th style="text-align:right">{{currency total_amount}}</th> | ||||
|         <tfoot> | ||||
|         </tfoot> | ||||
|                 TODO | ||||
|             {{/ifeq}} | ||||
|         {{/ifeq}} | ||||
|     {{/ifeq}} | ||||
| </table> | ||||
| </div> | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue