Closed ReachyBayern closed 1 week ago
thanks you for sharing this. Yes, please also add the scripts as they will be helpful.
@reggaetuna please go over this list and give feedback to what might already be part of the app and just needs understanding/clarification through documentation, what might be worked on in the develop branch already.
Thanks
client script workday - fieldupdate (target_hours)
frappe.ui.form.on('Workday', {
target_hours: function(frm, cdt, cdn) {
console.log('setting total_target_second.....s');
frappe.model.set_value(cdt, cdn, 'total_target_seconds', frappe.model.get_value(cdt, cdn, 'target_hours')*3600);
}
});
server script workday - before save: to calculate breaks for hours >9 and multiple checkins
l_exp_break_hours = float(doc.expected_break_hours) l_hours_worked = float(doc.hours_worked) l_set_break_time_after_9h = doc.custom_set_break_time_after_9h l_break_time_after_9_h = doc.custom_break_time_after_9h if (l_hours_worked >= 9 and l_exp_break_hours < 0.75 and l_set_break_time_after_9h ): l_exp_break_hours = 0.75 doc.expected_break_hours = 0.75 l_break_count = (len(doc.employee_checkins) 0.5 ) - 1 if (l_break_count >= 0): l_break_hours = float(doc.break_hours) l_new_break_seconds = (l_exp_break_hours - l_break_hours) 3600 if (l_new_break_seconds <= 0): l_new_break_seconds = 0 l_new_working_hours = l_hours_worked - (l_new_break_seconds / 3600 ) doc.actual_working_hours = l_new_working_hours doc.total_break_seconds = l_new_break_seconds doc.number_of_breaks = l_break_count else: doc.number_of_breaks = 0
version-14 and version-15 is updated and issue resolved
current problems:
Proposal:
server-scripts and client scripts could be sent as example if this is usefull.