filter by category
							parent
							
								
									018f9a1f95
								
							
						
					
					
						commit
						6e8d3806f0
					
				| 
						 | 
					@ -4,5 +4,6 @@
 | 
				
			||||||
    <field name="date_to" required="1" span="2"/>
 | 
					    <field name="date_to" required="1" span="2"/>
 | 
				
			||||||
    <field name="type" onchange="onchange_type" span="2"/>
 | 
					    <field name="type" onchange="onchange_type" span="2"/>
 | 
				
			||||||
    <field name="staff_id" domain='[["type","=",type]]' span="2"/>
 | 
					    <field name="staff_id" domain='[["type","=",type]]' span="2"/>
 | 
				
			||||||
 | 
					    <field name="categ_id" span="2"/>
 | 
				
			||||||
    <field name="only_value" span="2"/>
 | 
					    <field name="only_value" span="2"/>
 | 
				
			||||||
</form>
 | 
					</form>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -16,6 +16,8 @@ class ReportLaborCostSummary(Model):
 | 
				
			||||||
        'staff_id': fields.Many2One("clinic.staff","Staff"),
 | 
					        'staff_id': fields.Many2One("clinic.staff","Staff"),
 | 
				
			||||||
        "type": fields.Selection([["doctor","Doctor"],["nurse","Nurse"],["staff","Staff"]],"Type"),
 | 
					        "type": fields.Selection([["doctor","Doctor"],["nurse","Nurse"],["staff","Staff"]],"Type"),
 | 
				
			||||||
        'department_id': fields.Many2One("clinic.department","Department"),
 | 
					        'department_id': fields.Many2One("clinic.department","Department"),
 | 
				
			||||||
 | 
					        'level_id': fields.Many2One("clinic.staff.level","Level"),
 | 
				
			||||||
 | 
					        'categ_id': fields.Many2One("clinic.staff.categ","Category"),
 | 
				
			||||||
        'branch_id': fields.Many2One("clinic.branch","Branch"),
 | 
					        'branch_id': fields.Many2One("clinic.branch","Branch"),
 | 
				
			||||||
        'only_value': fields.Boolean("Only Amount"),
 | 
					        'only_value': fields.Boolean("Only Amount"),
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
| 
						 | 
					@ -44,6 +46,8 @@ class ReportLaborCostSummary(Model):
 | 
				
			||||||
        staff_id=None
 | 
					        staff_id=None
 | 
				
			||||||
        staff_type=res['type']
 | 
					        staff_type=res['type']
 | 
				
			||||||
        only_value=res['only_value']
 | 
					        only_value=res['only_value']
 | 
				
			||||||
 | 
					        level_id=None
 | 
				
			||||||
 | 
					        categ_id=None
 | 
				
			||||||
        dom=[]
 | 
					        dom=[]
 | 
				
			||||||
        if ids:
 | 
					        if ids:
 | 
				
			||||||
            obj=self.browse(ids)[0]
 | 
					            obj=self.browse(ids)[0]
 | 
				
			||||||
| 
						 | 
					@ -51,6 +55,8 @@ class ReportLaborCostSummary(Model):
 | 
				
			||||||
            date_to=obj.date_to
 | 
					            date_to=obj.date_to
 | 
				
			||||||
            staff_id=obj.staff_id.id
 | 
					            staff_id=obj.staff_id.id
 | 
				
			||||||
            staff_type=obj.type
 | 
					            staff_type=obj.type
 | 
				
			||||||
 | 
					            level_id=obj.level_id.id
 | 
				
			||||||
 | 
					            categ_id=obj.categ_id.id
 | 
				
			||||||
            only_value=obj.only_value
 | 
					            only_value=obj.only_value
 | 
				
			||||||
        dom.append(['date','>=',date_from])
 | 
					        dom.append(['date','>=',date_from])
 | 
				
			||||||
        dom.append(['date','<=',date_to])
 | 
					        dom.append(['date','<=',date_to])
 | 
				
			||||||
| 
						 | 
					@ -60,6 +66,8 @@ class ReportLaborCostSummary(Model):
 | 
				
			||||||
            dom.append(['type','=',staff_type])
 | 
					            dom.append(['type','=',staff_type])
 | 
				
			||||||
        if only_value:
 | 
					        if only_value:
 | 
				
			||||||
            dom.append(['amount','!=',0])
 | 
					            dom.append(['amount','!=',0])
 | 
				
			||||||
 | 
					        if categ_id:
 | 
				
			||||||
 | 
					            dom.append(['staff_id.categ_id','=',categ_id])
 | 
				
			||||||
        staffs={}
 | 
					        staffs={}
 | 
				
			||||||
        for line in get_model("clinic.labor.cost.line").search_browse(dom):
 | 
					        for line in get_model("clinic.labor.cost.line").search_browse(dom):
 | 
				
			||||||
            lcost=line.labor_cost_id
 | 
					            lcost=line.labor_cost_id
 | 
				
			||||||
| 
						 | 
					@ -67,10 +75,20 @@ class ReportLaborCostSummary(Model):
 | 
				
			||||||
            dpt=citem.department_id
 | 
					            dpt=citem.department_id
 | 
				
			||||||
            amt=line.amount or 0
 | 
					            amt=line.amount or 0
 | 
				
			||||||
            staff=line.staff_id
 | 
					            staff=line.staff_id
 | 
				
			||||||
 | 
					            categ_name=''
 | 
				
			||||||
 | 
					            categ_id=None
 | 
				
			||||||
 | 
					            categ=staff.categ_id
 | 
				
			||||||
 | 
					            if categ:
 | 
				
			||||||
 | 
					                categ_id=categ.id
 | 
				
			||||||
 | 
					                categ_name=categ.name or ""
 | 
				
			||||||
            if not staffs.get(staff.name):
 | 
					            if not staffs.get(staff.name):
 | 
				
			||||||
                staffs[staff.name]={
 | 
					                staffs[staff.name]={
 | 
				
			||||||
 | 
					                'number': staff.number or '',
 | 
				
			||||||
                'staff_id': staff.id,
 | 
					                'staff_id': staff.id,
 | 
				
			||||||
                'staff_type': staff.type,
 | 
					                'staff_type': staff.type,
 | 
				
			||||||
 | 
					                'staff_level': staff.level_id.name,
 | 
				
			||||||
 | 
					                'categ_name': categ_name,
 | 
				
			||||||
 | 
					                'categ_id': categ_id,
 | 
				
			||||||
                dpt.name: {
 | 
					                dpt.name: {
 | 
				
			||||||
                    'amt': 0,
 | 
					                    'amt': 0,
 | 
				
			||||||
                    },
 | 
					                    },
 | 
				
			||||||
| 
						 | 
					@ -94,6 +112,10 @@ class ReportLaborCostSummary(Model):
 | 
				
			||||||
                'staff_name': sname,
 | 
					                'staff_name': sname,
 | 
				
			||||||
                'staff_id': vals.get('staff_id'),
 | 
					                'staff_id': vals.get('staff_id'),
 | 
				
			||||||
                'staff_type': vals.get('staff_type'),
 | 
					                'staff_type': vals.get('staff_type'),
 | 
				
			||||||
 | 
					                'staff_level': vals.get('staff_level'),
 | 
				
			||||||
 | 
					                'categ_name': vals.get('categ_name'),
 | 
				
			||||||
 | 
					                'categ_id': vals.get('categ_id'),
 | 
				
			||||||
 | 
					                'number': vals.get("number"),
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            total=0
 | 
					            total=0
 | 
				
			||||||
            lvals['sub_lines']=[]
 | 
					            lvals['sub_lines']=[]
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2,6 +2,9 @@
 | 
				
			||||||
<table class="table table-condensed table-striped">
 | 
					<table class="table table-condensed table-striped">
 | 
				
			||||||
    <thead>
 | 
					    <thead>
 | 
				
			||||||
        <tr>
 | 
					        <tr>
 | 
				
			||||||
 | 
					            <th></th>
 | 
				
			||||||
 | 
					            <th></th>
 | 
				
			||||||
 | 
					            <th></th>
 | 
				
			||||||
            <th></th>
 | 
					            <th></th>
 | 
				
			||||||
            <th></th>
 | 
					            <th></th>
 | 
				
			||||||
            <th style="text-align:center" colspan="{{comp_span}}">{{comp_name}}</th>
 | 
					            <th style="text-align:center" colspan="{{comp_span}}">{{comp_name}}</th>
 | 
				
			||||||
| 
						 | 
					@ -9,7 +12,10 @@
 | 
				
			||||||
        </tr>
 | 
					        </tr>
 | 
				
			||||||
        <tr>
 | 
					        <tr>
 | 
				
			||||||
            <th rowspan="2">#</th>
 | 
					            <th rowspan="2">#</th>
 | 
				
			||||||
 | 
					            <th rowspan="2">Number</th>
 | 
				
			||||||
            <th rowspan="2">Name</th>
 | 
					            <th rowspan="2">Name</th>
 | 
				
			||||||
 | 
					            <th rowspan="2">Level</th>
 | 
				
			||||||
 | 
					            <th rowspan="2">Category</th>
 | 
				
			||||||
                {{#each dpts}}
 | 
					                {{#each dpts}}
 | 
				
			||||||
                    <th style="text-align:right">{{name}}</th>
 | 
					                    <th style="text-align:right">{{name}}</th>
 | 
				
			||||||
                {{/each}}
 | 
					                {{/each}}
 | 
				
			||||||
| 
						 | 
					@ -21,9 +27,12 @@
 | 
				
			||||||
        {{#each lines }}
 | 
					        {{#each lines }}
 | 
				
			||||||
                <tr>
 | 
					                <tr>
 | 
				
			||||||
                    <td>{{no}}</th>
 | 
					                    <td>{{no}}</th>
 | 
				
			||||||
 | 
					                    <td>{{number}}</th>
 | 
				
			||||||
                    <td>
 | 
					                    <td>
 | 
				
			||||||
                        {{view "link" string=staff_name action="clinic_staff" action_options="mode=form" active_id=staff_id}}
 | 
					                        {{view "link" string=staff_name action="clinic_staff" action_options="mode=form" active_id=staff_id}}
 | 
				
			||||||
                    </td>
 | 
					                    </td>
 | 
				
			||||||
 | 
					                    <td>{{staff_level}}</th>
 | 
				
			||||||
 | 
					                    <td>{{categ_name}}</th>
 | 
				
			||||||
                    {{#each sub_lines}}
 | 
					                    {{#each sub_lines}}
 | 
				
			||||||
                        <td style="text-align:right;">
 | 
					                        <td style="text-align:right;">
 | 
				
			||||||
                            <a href="#name=clinic_report_labor_cost_detail&defaults.date_from={{../../date_from}}&defaults.date_to={{../../date_to}}&defaults.staff_type={{../staff_type}}&defaults.staff_id={{../staff_id}}&defaults.department_id={{dpt_id}}">{{currency amt zero=""}}</a>
 | 
					                            <a href="#name=clinic_report_labor_cost_detail&defaults.date_from={{../../date_from}}&defaults.date_to={{../../date_to}}&defaults.staff_type={{../staff_type}}&defaults.staff_id={{../staff_id}}&defaults.department_id={{dpt_id}}">{{currency amt zero=""}}</a>
 | 
				
			||||||
| 
						 | 
					@ -36,6 +45,9 @@
 | 
				
			||||||
        {{/each}}
 | 
					        {{/each}}
 | 
				
			||||||
    </tbody>
 | 
					    </tbody>
 | 
				
			||||||
    <tfoot>
 | 
					    <tfoot>
 | 
				
			||||||
 | 
					        <th></th>
 | 
				
			||||||
 | 
					        <th></th>
 | 
				
			||||||
 | 
					        <th></th>
 | 
				
			||||||
        <th>รวม</th>
 | 
					        <th>รวม</th>
 | 
				
			||||||
        <th style="text-align:right"></th>
 | 
					        <th style="text-align:right"></th>
 | 
				
			||||||
        {{#each total_lines}}
 | 
					        {{#each total_lines}}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue