report claim expense
							parent
							
								
									e0a27017d8
								
							
						
					
					
						commit
						1fcc52bbb6
					
				| 
						 | 
					@ -74,6 +74,8 @@ class HDCase(Model):
 | 
				
			||||||
        res={}
 | 
					        res={}
 | 
				
			||||||
        user_id=get_active_user()
 | 
					        user_id=get_active_user()
 | 
				
			||||||
        set_active_user(1)
 | 
					        set_active_user(1)
 | 
				
			||||||
 | 
					        reimbursable_ctx=context.get('reimbursable')
 | 
				
			||||||
 | 
					        print('reimbursable_ctx ', reimbursable_ctx)
 | 
				
			||||||
        for obj in self.browse(ids):
 | 
					        for obj in self.browse(ids):
 | 
				
			||||||
            dlz_use=0
 | 
					            dlz_use=0
 | 
				
			||||||
            dlz_max=0
 | 
					            dlz_max=0
 | 
				
			||||||
| 
						 | 
					@ -83,9 +85,9 @@ class HDCase(Model):
 | 
				
			||||||
                dz=dlz.dialyzer_id
 | 
					                dz=dlz.dialyzer_id
 | 
				
			||||||
                dlz_id=dz.id
 | 
					                dlz_id=dz.id
 | 
				
			||||||
                prod=dz.product_id
 | 
					                prod=dz.product_id
 | 
				
			||||||
                #name=dz.name or ""
 | 
					                name=""
 | 
				
			||||||
                #name=name.split()[-1]
 | 
					                if prod:
 | 
				
			||||||
                name=prod.description
 | 
					                    name=prod.description or ""
 | 
				
			||||||
                dlz_name.append(name)
 | 
					                dlz_name.append(name)
 | 
				
			||||||
                dlz_use+=dlz.use_time or 0
 | 
					                dlz_use+=dlz.use_time or 0
 | 
				
			||||||
                dlz_max+=dlz.max_use_time or 0
 | 
					                dlz_max+=dlz.max_use_time or 0
 | 
				
			||||||
| 
						 | 
					@ -101,6 +103,7 @@ class HDCase(Model):
 | 
				
			||||||
            for dline in obj.dialyzers:
 | 
					            for dline in obj.dialyzers:
 | 
				
			||||||
                dlz=dline.dialyzer_id
 | 
					                dlz=dline.dialyzer_id
 | 
				
			||||||
                prod=dlz.product_id
 | 
					                prod=dlz.product_id
 | 
				
			||||||
 | 
					                if prod:
 | 
				
			||||||
                    dlz_price+=prod.sale_price or 0
 | 
					                    dlz_price+=prod.sale_price or 0
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            for line in obj.lines:
 | 
					            for line in obj.lines:
 | 
				
			||||||
| 
						 | 
					@ -121,9 +124,18 @@ class HDCase(Model):
 | 
				
			||||||
                    elif categ.code=='FEE':
 | 
					                    elif categ.code=='FEE':
 | 
				
			||||||
                        fee+=amt*sign
 | 
					                        fee+=amt*sign
 | 
				
			||||||
                    elif categ.code=='DLZ':
 | 
					                    elif categ.code=='DLZ':
 | 
				
			||||||
 | 
					                        if prod:
 | 
				
			||||||
                            dlz_price+=prod.sale_price or 0
 | 
					                            dlz_price+=prod.sale_price or 0
 | 
				
			||||||
                    elif categ.code=="LAB":
 | 
					                    elif categ.code=="LAB":
 | 
				
			||||||
 | 
					                        if reimbursable_ctx:
 | 
				
			||||||
 | 
					                            if reimbursable_ctx==line.reimbursable:
 | 
				
			||||||
                                lab+=amt
 | 
					                                lab+=amt
 | 
				
			||||||
 | 
					                        else:
 | 
				
			||||||
 | 
					                            lab+=amt
 | 
				
			||||||
 | 
					                    else:
 | 
				
			||||||
 | 
					                        if reimbursable_ctx:
 | 
				
			||||||
 | 
					                            if reimbursable_ctx==line.reimbursable:
 | 
				
			||||||
 | 
					                                misc+=amt
 | 
				
			||||||
                        else:
 | 
					                        else:
 | 
				
			||||||
                            misc+=amt
 | 
					                            misc+=amt
 | 
				
			||||||
            res[obj.id]={
 | 
					            res[obj.id]={
 | 
				
			||||||
| 
						 | 
					@ -387,6 +399,8 @@ class HDCase(Model):
 | 
				
			||||||
        line=get_data_path(data,path,parent=True)
 | 
					        line=get_data_path(data,path,parent=True)
 | 
				
			||||||
        product_id=line.get('product_id')
 | 
					        product_id=line.get('product_id')
 | 
				
			||||||
        prod=get_model("product").browse(product_id)
 | 
					        prod=get_model("product").browse(product_id)
 | 
				
			||||||
 | 
					        if not prod:
 | 
				
			||||||
 | 
					            return data
 | 
				
			||||||
        if prod.can_sell:
 | 
					        if prod.can_sell:
 | 
				
			||||||
            line['reimbursable']='no'
 | 
					            line['reimbursable']='no'
 | 
				
			||||||
        else:
 | 
					        else:
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -105,7 +105,8 @@ class ReportAccountHDCaseSummary(Model):
 | 
				
			||||||
            dom.append(['product_id','=',product_id])
 | 
					            dom.append(['product_id','=',product_id])
 | 
				
			||||||
        records={}
 | 
					        records={}
 | 
				
			||||||
        cycles={}
 | 
					        cycles={}
 | 
				
			||||||
        for line in get_model("clinic.hd.case.line").search_browse(dom):
 | 
					        context['reimbursable']=reimbursable
 | 
				
			||||||
 | 
					        for line in get_model("clinic.hd.case.line").search_browse(dom,context=context):
 | 
				
			||||||
            hdcase=line.hd_case_id
 | 
					            hdcase=line.hd_case_id
 | 
				
			||||||
            items={}
 | 
					            items={}
 | 
				
			||||||
            mdc_name=(hdcase.epo or "").split("-")
 | 
					            mdc_name=(hdcase.epo or "").split("-")
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -38,7 +38,7 @@
 | 
				
			||||||
                <th>สิทธิ์</th>
 | 
					                <th>สิทธิ์</th>
 | 
				
			||||||
                <th>Receipt#</th>
 | 
					                <th>Receipt#</th>
 | 
				
			||||||
                <th>Invoice#</th>
 | 
					                <th>Invoice#</th>
 | 
				
			||||||
                <th>EPO</th>
 | 
					                <th>ชื่อยา</th>
 | 
				
			||||||
                <th>ค่าฟอก</th>
 | 
					                <th>ค่าฟอก</th>
 | 
				
			||||||
                <th>ค่ายา</th>
 | 
					                <th>ค่ายา</th>
 | 
				
			||||||
                <th>Lab</th>
 | 
					                <th>Lab</th>
 | 
				
			||||||
| 
						 | 
					@ -55,7 +55,7 @@
 | 
				
			||||||
                <th>ID Card</th>
 | 
					                <th>ID Card</th>
 | 
				
			||||||
                <th>สิทธิ์</th>
 | 
					                <th>สิทธิ์</th>
 | 
				
			||||||
                <th>HCT%</th>
 | 
					                <th>HCT%</th>
 | 
				
			||||||
                <th>EPO</th>
 | 
					                <th>ชื่อยา</th>
 | 
				
			||||||
                <th>ค่าฟอก</th>
 | 
					                <th>ค่าฟอก</th>
 | 
				
			||||||
                <th>ค่ายา</th>
 | 
					                <th>ค่ายา</th>
 | 
				
			||||||
                <th>ค่าบริการฉีดยา</th>
 | 
					                <th>ค่าบริการฉีดยา</th>
 | 
				
			||||||
| 
						 | 
					@ -80,14 +80,18 @@
 | 
				
			||||||
                    <td style="width:20%">{{idcard}}</td>
 | 
					                    <td style="width:20%">{{idcard}}</td>
 | 
				
			||||||
                    <td>{{ptype}}</td>
 | 
					                    <td>{{ptype}}</td>
 | 
				
			||||||
                    <td>{{pm_number}}</td>
 | 
					                    <td>{{pm_number}}</td>
 | 
				
			||||||
                    <td>{{inv_number}}</td>
 | 
					                    <td>
 | 
				
			||||||
 | 
					                        {{view "link" string=inv_number action="cust_invoice" action_options="form_view_xml&cust_invoice_form&mode=form" active_id=inv_id}}
 | 
				
			||||||
 | 
					                    </td>
 | 
				
			||||||
                    <td>{{epo_name}}</td>
 | 
					                    <td>{{epo_name}}</td>
 | 
				
			||||||
                    <td>{{currency fee zero=""}}</td>
 | 
					                    <td>{{currency fee zero=""}}</td>
 | 
				
			||||||
                    <td>{{currency epo zero=""}}</td>
 | 
					                    <td>{{currency epo zero=""}}</td>
 | 
				
			||||||
                    <td>{{currency lab zero=""}}</td>
 | 
					                    <td>{{currency lab zero=""}}</td>
 | 
				
			||||||
                    <td>{{currency misc zero=""}}</td>
 | 
					                    <td>{{currency misc zero=""}}</td>
 | 
				
			||||||
                    <td>{{currency dlz_price zero=""}}</td>
 | 
					                    <td>{{currency dlz_price zero=""}}</td>
 | 
				
			||||||
                    <td>{{inv_ref}}</td>
 | 
					                    <td>
 | 
				
			||||||
 | 
					                        {{view "link" string=inv_ref action="cust_invoice" action_options="form_view_xml&cust_invoice_form&mode=form" active_id=inv_id}}
 | 
				
			||||||
 | 
					                    </td>
 | 
				
			||||||
                    <td>
 | 
					                    <td>
 | 
				
			||||||
                        {{#if pick_id}}
 | 
					                        {{#if pick_id}}
 | 
				
			||||||
                            {{view "link" string=pick_ref action="pick_out" action_options="mode=form" active_id=pick_id}}
 | 
					                            {{view "link" string=pick_ref action="pick_out" action_options="mode=form" active_id=pick_id}}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue