show detail
							parent
							
								
									b1b71ff805
								
							
						
					
					
						commit
						37b9ce4315
					
				| 
						 | 
				
			
			@ -11,6 +11,7 @@
 | 
			
		|||
            <field name="rate" onchange="onchange_vals"/>
 | 
			
		||||
            <field name="amount"/>
 | 
			
		||||
            <field name="pay_amount"/>
 | 
			
		||||
            <field name="cycle_item_id"/>
 | 
			
		||||
        </tab>
 | 
			
		||||
        <tab string="Computation">
 | 
			
		||||
            <field name="labor_cost_id"/>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,6 +1,7 @@
 | 
			
		|||
<list model="clinic.labor.cost.line">
 | 
			
		||||
    <field name="date"/>
 | 
			
		||||
    <field name="cycle_id"/>
 | 
			
		||||
    <field name="department_id"/>
 | 
			
		||||
    <field name="staff_id"/>
 | 
			
		||||
    <field name="type"/>
 | 
			
		||||
    <field name="amount"/>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -25,6 +25,7 @@ class LaborCostLine(Model):
 | 
			
		|||
        for obj in self.browse(ids):
 | 
			
		||||
            res[obj.id]={
 | 
			
		||||
                'pay_amount': round(obj.amount,0),
 | 
			
		||||
                'cycle_item_id': obj.labor_cost_id.cycle_item_id.id,
 | 
			
		||||
            }
 | 
			
		||||
        return res
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -38,6 +39,7 @@ class LaborCostLine(Model):
 | 
			
		|||
        'rate': fields.Float("Rate",scale=2),
 | 
			
		||||
        'amount': fields.Float("Amount",scale=2),
 | 
			
		||||
        'pay_amount': fields.Float("Pay Amount",function="_get_all",function_multi=True),
 | 
			
		||||
        'cycle_item_id': fields.Many2One("clinic.cycle.item","Cycle Item",function="_get_all",function_multi=True),
 | 
			
		||||
        'date': fields.Date("Date",search=True),
 | 
			
		||||
        'description': fields.Char("Description"),
 | 
			
		||||
        'company_id': fields.Many2One('company','Company'),
 | 
			
		||||
| 
						 | 
				
			
			@ -49,7 +51,7 @@ class LaborCostLine(Model):
 | 
			
		|||
    _defaults={
 | 
			
		||||
        "company_id": lambda *a: get_active_company(),
 | 
			
		||||
    }
 | 
			
		||||
    _order="cycle_id,level_id"
 | 
			
		||||
    _order="date,cycle_id,department_id"
 | 
			
		||||
    
 | 
			
		||||
    def create(self,vals,**kw):
 | 
			
		||||
        new_id=super().create(vals,**kw)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -100,6 +100,10 @@ class ReportLaborCostOverTime(Model):
 | 
			
		|||
                }
 | 
			
		||||
            staffs[staff.name]['amount']+=amt # amount from formular
 | 
			
		||||
            staffs[staff.name]['cycle_qty']+=1 # number of cycle
 | 
			
		||||
        def replace_quote(dom=""):
 | 
			
		||||
            dom=dom.replace("False","false")
 | 
			
		||||
            dom=dom.replace("True","true")
 | 
			
		||||
            return dom.replace("'","\"")
 | 
			
		||||
        lines=[]
 | 
			
		||||
        snames=sorted(staffs.keys()) #sort by staff name
 | 
			
		||||
        no=1
 | 
			
		||||
| 
						 | 
				
			
			@ -115,12 +119,18 @@ class ReportLaborCostOverTime(Model):
 | 
			
		|||
            ot_amount=ot_per_cycle*ot_qty
 | 
			
		||||
            net_pay=(vals['staff_wage'] or 0)+ot_amount
 | 
			
		||||
            net_diff=(vals['amount'] or 0)-net_pay
 | 
			
		||||
            dom=[
 | 
			
		||||
                ['date', '>=', date_from],
 | 
			
		||||
                ['date', '<=', date_to],
 | 
			
		||||
                ['staff_id','=', vals['staff_id']],
 | 
			
		||||
            ]
 | 
			
		||||
            vals.update({
 | 
			
		||||
                'no': no,
 | 
			
		||||
                'ot_qty': ot_qty,
 | 
			
		||||
                'ot_amount': ot_amount,
 | 
			
		||||
                'net_pay': net_pay,
 | 
			
		||||
                'net_diff': net_diff,
 | 
			
		||||
                'action_options': 'mode=list&search_domain=%s&tab_no=0'%replace_quote('%s'%(dom)),
 | 
			
		||||
            })
 | 
			
		||||
            lines.append(vals)
 | 
			
		||||
            no+=1
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -161,8 +161,12 @@ class ClinicSetting(Model):
 | 
			
		|||
        if user_id !=1:
 | 
			
		||||
            print("Only admin!!")
 | 
			
		||||
            return
 | 
			
		||||
        obj=self.browse(ids)[0]
 | 
			
		||||
        obj.del_duplicate_staff()
 | 
			
		||||
        for cost_line in get_model("clinic.labor.cost.line").search_browse([]):
 | 
			
		||||
            cost_line.write({
 | 
			
		||||
                'note': ' ',
 | 
			
		||||
            })
 | 
			
		||||
        #obj=self.browse(ids)[0]
 | 
			
		||||
        #obj.del_duplicate_staff()
 | 
			
		||||
        print("Done!")
 | 
			
		||||
 | 
			
		||||
    def del_duplicate_staff(self,ids,context={}):
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -29,8 +29,13 @@
 | 
			
		|||
                    <td style="text-align:right;">
 | 
			
		||||
                        <a href="#name=clinic_report_labor_cost_summary&defaults.date_from={{../date_from}}&defaults.date_to={{../date_to}}&defaults.staff_type={{staff_type}}&defaults.staff_id={{staff_id}}">{{currency amount zero=""}}</a>
 | 
			
		||||
                    </td>
 | 
			
		||||
                    <td style="text-align:right;">{{max_cycle}}</th>
 | 
			
		||||
                    <td style="text-align:right;">{{max_cycle}}</td>
 | 
			
		||||
                    <td style="text-align:right;">
 | 
			
		||||
                        {{view "link" string=cycle_qty action="clinic_labor_cost_item" action_options=action_options}}
 | 
			
		||||
                    </td>
 | 
			
		||||
                    <!--
 | 
			
		||||
                    <td style="text-align:right;">{{cycle_qty}}</th>
 | 
			
		||||
                    -->
 | 
			
		||||
                    <td style="text-align:right;">{{ot_qty}}</th>
 | 
			
		||||
                    <td style="text-align:right;">{{currency ot_per_cycle zero=""}}</th>
 | 
			
		||||
                    <td style="text-align:right;color:orange">{{currency ot_amount zero=""}}</th>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,3 +3,8 @@
 | 
			
		|||
        - staff -> ok
 | 
			
		||||
        - patient
 | 
			
		||||
 | 
			
		||||
> explain nurse
 | 
			
		||||
    กรณีแก้ไขรายชื่อหมอให้ดูรายชื่อแพทย์ให้ดี
 | 
			
		||||
 | 
			
		||||
> note:
 | 
			
		||||
    แก้ไขยาก หากมาเจอข้อผิดพลาดบางครั้ง
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue