{% extends 'att/report/base.html' %} {% load i18n %} {% block opts_modify %} var userCols = [ {field:'emp_code', width:120, title: "{% trans 'report_column_empCode' %}", sort:true} ,{field:'first_name', width:140, title: "{% trans 'report_column_firstName' %}"} ,{field:'last_name', width:80, title: "{% trans 'report_column_lastName' %}"} ,{field:'nick_name', width:80, title: "{% trans 'report_column_nickName' %}"} ,{field:'gender', width:60, title: "{% trans 'report_column_gender' %}"} ,{field:'dept_code', width:60, title: "{% trans 'report_column_departmentCode' %}"} ,{field:'dept_name', width:140, title: "{% trans 'report_column_departmentName' %}"} ,{field:'position_code', title: "{% trans 'report_column_positionCode' %}"} ,{field:'position_name', title: "{% trans 'report_column_positionName' %}"} ]; var otherCols = [ {field:'total_late', width:80, title: "{% trans 'report_column_lateDuration' %}"} ,{field:'total_early_leave', width:100, title: "{% trans 'report_column_earlyLeaveDuration' %}"} ,{field:'total_absent', width:80, title: "{% trans 'report_column_absentDuration' %}"} ,{field:'total_worked', title: "{% trans 'report_column_actualWorkDuration' %}"} {# ,{field:'short_time', title: "{% trans 'report_column_shortDuration' %}", hide: true}#} {# ,{field:'total_ot', title: "{% trans 'report_column_overtimeDuration' %}", hide: true}#} ,{field:'total_not', title: "{% trans 'report_column_normalOvertime' %}"} ,{field:'total_wot', title: "{% trans 'report_column_weekendOvertime' %}"} ,{field:'total_hot', title: "{% trans 'report_column_holidayOvertime' %}"} ,{field:'total_leave', title: "{% trans 'report_column_leaveDuration' %}"} ]; var leaveCols = []; {% for c in category %} leaveCols.push({field: 'leave_'+"{{ c.0 }}", title: "{{ c.1 }}",}) {% endfor %} var dateCols = []; var start = new Date(date.getFullYear(), date.getMonth(), 1) while((date.getTime() - start.getTime()) >= 0){ var _start = moment(start) dateCols.push({field:_start.format("MM/DD"), title:_start.format("D"), width: 50}) start.setDate(start.getDate()+1); } _cols = userCols.concat(dateCols).concat(otherCols).concat(leaveCols); $.extend(opts, { cols: [_cols] ,method: "get" ,url: "/att/api/dailyStatusReport/" }); {% endblock %} {% block columns_modify %} var start = new Date(startDate.substring(0, 4), parseInt(startDate.substring(5, 7))-1, startDate.substring(8, 10)) var end = new Date(endDate.substring(0, 4), parseInt(endDate.substring(5, 7))-1, endDate.substring(8, 10)) var dateCols = []; while((end.getTime() - start.getTime()) >= 0){ var _start = moment(start); dateCols.push({field:_start.format("MM/DD"), title:_start.format("D"), width: 50}) start.setDate(start.getDate()+1); } _cols = userCols.concat(dateCols).concat(otherCols).concat(leaveCols); $.extend(opts, { cols: [_cols] ,method: "get" ,where: c }); // tb = table.reload(tb.config.id, opts) tb = table.render(opts) $.extend(action_opts, { curTable: tb }); $("#{{model_name}}_fluid" + " div.grid-toolbar").actions(action_opts); form.on("submit({{ model_name }}-search)", function (data) { refreshReport(''); }); {% endblock %}