add report invoice matching
							parent
							
								
									e358bea6c9
								
							
						
					
					
						commit
						4dc53d6ae3
					
				| 
						 | 
					@ -0,0 +1,6 @@
 | 
				
			||||||
 | 
					<action>
 | 
				
			||||||
 | 
					    <field name="type">report_xls</field>
 | 
				
			||||||
 | 
					    <field name="model">clinic.matching.payment</field>
 | 
				
			||||||
 | 
					    <field name="method">get_data_match</field>
 | 
				
			||||||
 | 
					    <field name="template">matching_payment_invoice</field>
 | 
				
			||||||
 | 
					</action>
 | 
				
			||||||
| 
						 | 
					@ -1,6 +1,6 @@
 | 
				
			||||||
<action>
 | 
					<action>
 | 
				
			||||||
    <field name="type">report_xls</field>
 | 
					    <field name="type">report_xls</field>
 | 
				
			||||||
    <field name="model">clinic.matching.payment</field>
 | 
					    <field name="model">clinic.matching.payment</field>
 | 
				
			||||||
    <field name="method">get_data</field>
 | 
					    <field name="method">get_data_unmatch</field>
 | 
				
			||||||
    <field name="template">matching_payment_invoice_unmatch</field>
 | 
					    <field name="template">matching_payment_invoice</field>
 | 
				
			||||||
</action>
 | 
					</action>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2,6 +2,7 @@
 | 
				
			||||||
    <head>
 | 
					    <head>
 | 
				
			||||||
        <field name="state"/>
 | 
					        <field name="state"/>
 | 
				
			||||||
        <button string="Print" dropdown="1" icon="print">
 | 
					        <button string="Print" dropdown="1" icon="print">
 | 
				
			||||||
 | 
					            <item string="Invoice Match" action="clinic_matching_payment_match_invoice"/>
 | 
				
			||||||
            <item string="Invoice Unmatch" action="clinic_matching_payment_unmatch_invoice"/>
 | 
					            <item string="Invoice Unmatch" action="clinic_matching_payment_unmatch_invoice"/>
 | 
				
			||||||
        </button>
 | 
					        </button>
 | 
				
			||||||
        <button string="Options" dropdown="1">
 | 
					        <button string="Options" dropdown="1">
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -68,6 +68,7 @@ class Department(Model):
 | 
				
			||||||
                'perms': perms,
 | 
					                'perms': perms,
 | 
				
			||||||
                'other_perms': [('set',other_perms)],
 | 
					                'other_perms': [('set',other_perms)],
 | 
				
			||||||
                'login_company_id': get_active_company(),
 | 
					                'login_company_id': get_active_company(),
 | 
				
			||||||
 | 
					                'home_action': 'clinic_board',
 | 
				
			||||||
            })
 | 
					            })
 | 
				
			||||||
            print("create profile %s"%(code))
 | 
					            print("create profile %s"%(code))
 | 
				
			||||||
            return profile_id
 | 
					            return profile_id
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -563,7 +563,44 @@ class MatchingPayment(Model):
 | 
				
			||||||
        super().write(ids,vals,**kw)
 | 
					        super().write(ids,vals,**kw)
 | 
				
			||||||
        self.function_store(ids)
 | 
					        self.function_store(ids)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def get_data(self,context={}):
 | 
					    def get_data_match(self,context={}):
 | 
				
			||||||
 | 
					        ref_id=int(context.get("refer_id","0"))
 | 
				
			||||||
 | 
					        obj=self.browse(ref_id)
 | 
				
			||||||
 | 
					        inv_match_ids=[]
 | 
				
			||||||
 | 
					        for line in obj.lines:
 | 
				
			||||||
 | 
					            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 not 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={
 | 
				
			||||||
 | 
					            'ptype': obj.patient_type_id.name or "",
 | 
				
			||||||
 | 
					            'title': 'Invoice Match',
 | 
				
			||||||
 | 
					            'lines': lines,
 | 
				
			||||||
 | 
					            'date_from': obj.date_from,
 | 
				
			||||||
 | 
					            'date_to': obj.date_to,
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        return data
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    def get_data_unmatch(self,context={}):
 | 
				
			||||||
        ref_id=int(context.get("refer_id","0"))
 | 
					        ref_id=int(context.get("refer_id","0"))
 | 
				
			||||||
        obj=self.browse(ref_id)
 | 
					        obj=self.browse(ref_id)
 | 
				
			||||||
        inv_match_ids=[]
 | 
					        inv_match_ids=[]
 | 
				
			||||||
| 
						 | 
					@ -592,6 +629,8 @@ class MatchingPayment(Model):
 | 
				
			||||||
            lines.append(vals)
 | 
					            lines.append(vals)
 | 
				
			||||||
            no+=1
 | 
					            no+=1
 | 
				
			||||||
        data={
 | 
					        data={
 | 
				
			||||||
 | 
					            'ptype': obj.patient_type_id.name or "",
 | 
				
			||||||
 | 
					            'title': 'Invoice Unmatch',
 | 
				
			||||||
            'lines': lines,
 | 
					            'lines': lines,
 | 
				
			||||||
            'date_from': obj.date_from,
 | 
					            'date_from': obj.date_from,
 | 
				
			||||||
            'date_to': obj.date_to,
 | 
					            'date_to': obj.date_to,
 | 
				
			||||||
| 
						 | 
					@ -606,7 +645,16 @@ class MatchingPayment(Model):
 | 
				
			||||||
                'mode': 'form',
 | 
					                'mode': 'form',
 | 
				
			||||||
                'active_id': obj.id,
 | 
					                'active_id': obj.id,
 | 
				
			||||||
            },
 | 
					            },
 | 
				
			||||||
            #'flash': 'TODO',
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    def print_invoice_match(self,ids,context={}):
 | 
				
			||||||
 | 
					        obj=self.browse(ids)[0]
 | 
				
			||||||
 | 
					        return {
 | 
				
			||||||
 | 
					            'next':{
 | 
				
			||||||
 | 
					                'name': 'clinic_matching_payment',
 | 
				
			||||||
 | 
					                'mode': 'form',
 | 
				
			||||||
 | 
					                'active_id': obj.id,
 | 
				
			||||||
 | 
					            },
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
MatchingPayment.register()
 | 
					MatchingPayment.register()
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -83,6 +83,9 @@ class ReportAccountHDCaseSummary(Model):
 | 
				
			||||||
        lines=[]
 | 
					        lines=[]
 | 
				
			||||||
        for hdcase in get_model("clinic.hd.case").search_browse(dom):
 | 
					        for hdcase in get_model("clinic.hd.case").search_browse(dom):
 | 
				
			||||||
            items={}
 | 
					            items={}
 | 
				
			||||||
 | 
					            mdc_name=(hdcase.epo or "").split("-")
 | 
				
			||||||
 | 
					            if mdc_name:
 | 
				
			||||||
 | 
					                mdc_name=mdc_name[0].title()
 | 
				
			||||||
            for line in hdcase.lines:
 | 
					            for line in hdcase.lines:
 | 
				
			||||||
                amt=line.amount or 0
 | 
					                amt=line.amount or 0
 | 
				
			||||||
                categ=line.product_categ_id
 | 
					                categ=line.product_categ_id
 | 
				
			||||||
| 
						 | 
					@ -117,6 +120,7 @@ class ReportAccountHDCaseSummary(Model):
 | 
				
			||||||
                'cycle_item_id': cycle_item.id,
 | 
					                'cycle_item_id': cycle_item.id,
 | 
				
			||||||
                'pm_number': pm_number,
 | 
					                'pm_number': pm_number,
 | 
				
			||||||
                'inv_number': inv_number,
 | 
					                'inv_number': inv_number,
 | 
				
			||||||
 | 
					                'mdc_name': mdc_name,
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            for code, item in items.items():
 | 
					            for code, item in items.items():
 | 
				
			||||||
                vals.update({
 | 
					                vals.update({
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							| 
						 | 
					@ -30,6 +30,7 @@
 | 
				
			||||||
            <th>ค่ายา</th>
 | 
					            <th>ค่ายา</th>
 | 
				
			||||||
            <th>ค่าฉีดยา</th>
 | 
					            <th>ค่าฉีดยา</th>
 | 
				
			||||||
            <th>HCT</th>
 | 
					            <th>HCT</th>
 | 
				
			||||||
 | 
					            <th>ยา</th>
 | 
				
			||||||
            {{#ifeq reimbursable "no"}}
 | 
					            {{#ifeq reimbursable "no"}}
 | 
				
			||||||
                <th>Rc.</th>
 | 
					                <th>Rc.</th>
 | 
				
			||||||
                <th>Inv.</th>
 | 
					                <th>Inv.</th>
 | 
				
			||||||
| 
						 | 
					@ -53,6 +54,7 @@
 | 
				
			||||||
                <td>{{currency epo zero=""}}</td>
 | 
					                <td>{{currency epo zero=""}}</td>
 | 
				
			||||||
                <td>{{currency srv zero=""}}</td>
 | 
					                <td>{{currency srv zero=""}}</td>
 | 
				
			||||||
                <td>{{hct}}</td>
 | 
					                <td>{{hct}}</td>
 | 
				
			||||||
 | 
					                <td>{{mdc_name}}</td>
 | 
				
			||||||
                {{#ifeq ../reimbursable "no"}}
 | 
					                {{#ifeq ../reimbursable "no"}}
 | 
				
			||||||
                    <td>{{pm_number}}</td>
 | 
					                    <td>{{pm_number}}</td>
 | 
				
			||||||
                    <td>{{inv_number}}</td>
 | 
					                    <td>{{inv_number}}</td>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,7 +1,8 @@
 | 
				
			||||||
- sickbed -> can not see sickbed because mix patient
 | 
					- permission
 | 
				
			||||||
 | 
					    - sickbed -> can not see sickbed because mix patient
 | 
				
			||||||
        - fixme:
 | 
					        - fixme:
 | 
				
			||||||
            - see deparment from sickbed => hd_case => and update department of patient (manymany)
 | 
					            - see deparment from sickbed => hd_case => and update department of patient (manymany)
 | 
				
			||||||
hd case => can not click next page
 | 
					    - hd case => can not click next page
 | 
				
			||||||
 | 
					
 | 
				
			||||||
report cycle item :
 | 
					report cycle item :
 | 
				
			||||||
    - sunanna can not see
 | 
					    - sunanna can not see
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue