diff --git a/netforce_clinic/layouts/clinic_labor_cost_line_form.xml b/netforce_clinic/layouts/clinic_labor_cost_line_form.xml index 1964a69..8d8326b 100644 --- a/netforce_clinic/layouts/clinic_labor_cost_line_form.xml +++ b/netforce_clinic/layouts/clinic_labor_cost_line_form.xml @@ -11,6 +11,7 @@ + diff --git a/netforce_clinic/layouts/clinic_labor_cost_line_list.xml b/netforce_clinic/layouts/clinic_labor_cost_line_list.xml index c81842d..f1d4575 100644 --- a/netforce_clinic/layouts/clinic_labor_cost_line_list.xml +++ b/netforce_clinic/layouts/clinic_labor_cost_line_list.xml @@ -1,6 +1,7 @@ + diff --git a/netforce_clinic/models/labor_cost_line.py b/netforce_clinic/models/labor_cost_line.py index 0a7fd3c..4907889 100644 --- a/netforce_clinic/models/labor_cost_line.py +++ b/netforce_clinic/models/labor_cost_line.py @@ -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) diff --git a/netforce_clinic/models/report_labor_cost_overtime.py b/netforce_clinic/models/report_labor_cost_overtime.py index d7c7c39..add003c 100644 --- a/netforce_clinic/models/report_labor_cost_overtime.py +++ b/netforce_clinic/models/report_labor_cost_overtime.py @@ -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 diff --git a/netforce_clinic/models/setting.py b/netforce_clinic/models/setting.py index 69ba98b..96e32ef 100644 --- a/netforce_clinic/models/setting.py +++ b/netforce_clinic/models/setting.py @@ -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={}): diff --git a/netforce_clinic/templates/report_labor_cost_overtime.hbs b/netforce_clinic/templates/report_labor_cost_overtime.hbs index 6e9ba0f..638ee1f 100644 --- a/netforce_clinic/templates/report_labor_cost_overtime.hbs +++ b/netforce_clinic/templates/report_labor_cost_overtime.hbs @@ -29,8 +29,13 @@ {{currency amount zero=""}} - {{max_cycle}} + {{max_cycle}} + + {{view "link" string=cycle_qty action="clinic_labor_cost_item" action_options=action_options}} + + {{ot_qty}} {{currency ot_per_cycle zero=""}} {{currency ot_amount zero=""}} diff --git a/netforce_clinic/todo.txt b/netforce_clinic/todo.txt index af7635a..5cfdfe0 100644 --- a/netforce_clinic/todo.txt +++ b/netforce_clinic/todo.txt @@ -3,3 +3,8 @@ - staff -> ok - patient +> explain nurse + กรณีแก้ไขรายชื่อหมอให้ดูรายชื่อแพทย์ให้ดี + +> note: + แก้ไขยาก หากมาเจอข้อผิดพลาดบางครั้ง