// получаем часы переработки для конкретного сотрудника public List<HRHours> getEmployeesHRHours(string employee_id, string start_period, string begda, string endda) { SQLDB db = new SQLDB(); List<HRHours> current = db.getHRHours(employee_id, start_period, begda, endda); return current; }
public void GetReportFactTime(List<Employee> employees, Period per) { OpenReportExcelFile(@"C:\Inetpub\wwwroot\timeboard\Reports\ReportFactTime.xls"); Excel.Workbook workbook = (Excel.Workbook)thisApplication.Workbooks["ReportFactTime.xls"]; Excel.Worksheet worksheet = (Excel.Worksheet)workbook.Worksheets["Лист1"]; // пишем за какой период отчет Excel.Range caption = worksheet.get_Range("C4", "H4"); caption.Value2 = "по фактически отработанному времени за " + per.MonthName.ToUpper() + " " + per.Year + " года"; // определяем с какой строки писать int i = 10; int last = employees.Count + i - 1; // определяем границы таблицы string coord1 = "A" + i.ToString(); string coord2 = "X" + last.ToString(); // рисуем сетку таблицы Excel.Range range = worksheet.get_Range(coord1, coord2); range.Borders.LineStyle = Excel.XlLineStyle.xlContinuous; range.Borders.Weight = Excel.XlBorderWeight.xlThin; SQLDB sql = new SQLDB(); EmployeeComparerByFullnameASC emp_comp = new EmployeeComparerByFullnameASC(); employees.Sort(emp_comp); foreach (Employee emp in employees) { decimal norma = 0; decimal overhours = 0; decimal def_sum = 0; Deflections d = new Deflections(); List<HRHours> hr_current = sql.getHRHours(emp.EmployeeID, emp.StartPeriod, emp.BeginDate, emp.EndDate); List<Schedule> schedule = sql.getSchedule(emp.EmployeeID, emp.StartPeriod, emp.BeginDate, emp.EndDate); List<ScheduleDeflection> dschedule = sql.getScheduleDeflection(emp.EmployeeID, emp.StartPeriod, emp.BeginDate, emp.EndDate); // отклонения /*decimal def_B = 0; // Б decimal def_V = 0; // В - выходной decimal def_VP = 0; // ВП decimal def_G = 0; // Г decimal def_DO = 0; // ДО decimal def_K = 0; // К decimal def_NN = 0; // НН decimal def_NP = 0; // НП decimal def_OV = 0; // ОВ decimal def_OD = 0; // ОД decimal def_OJ = 0; // ОЖ decimal def_OZ = 0; // ОЗ decimal def_OT = 0; // ОТ decimal def_PK = 0; // ПК decimal def_PR = 0; // ПР decimal def_R = 0; // Р decimal def_RP = 0; // РП decimal def_U = 0; // У decimal def_UD = 0; // УД */ foreach (Schedule sch in schedule) { // если выходной или изменение на выходной то пишем в отклонения по выходному дню if (((sch.DaySchedule == "FREE") && (Convert.ToInt32(sch.TimeHours) == 0)) || (sch.DayScheduleVar == "F")) d.def_V += sch.TimeHours; else norma += sch.TimeHours; } foreach (HRHours over in hr_current) overhours += (over.DayOverHours + over.NightOverHours); foreach (ScheduleDeflection sdf in dschedule) { def_sum += sdf.TimeHours; if (sdf.CodeT13.Equals("РВ")) { def_sum -= sdf.TimeHours; // убираем из поля Итого отработано по факту overhours += sdf.TimeHours; // записываем в поле Итого сверхурочных часов } switch (sdf.CodeT13) { case "Б": d.def_B += sdf.TimeHours; break; case "ВП": d.def_VP += sdf.TimeHours; break; case "Г": d.def_G += sdf.TimeHours; break; case "ДО": d.def_DO += sdf.TimeHours; break; case "К": d.def_K += sdf.TimeHours; break; case "НН": d.def_NN += sdf.TimeHours; break; case "НП": d.def_NP += sdf.TimeHours; break; case "ОВ": d.def_OV += sdf.TimeHours; break; case "ОД": d.def_OD += sdf.TimeHours; break; case "ОЖ": d.def_OJ += sdf.TimeHours; break; case "ОЗ": d.def_OZ += sdf.TimeHours; break; case "ОТ": d.def_OT += sdf.TimeHours; break; case "ПК": d.def_PK += sdf.TimeHours; break; case "ПР": d.def_PR += sdf.TimeHours; break; case "Р": d.def_R += sdf.TimeHours; break; case "РП": d.def_RP += sdf.TimeHours; break; case "У": d.def_U += sdf.TimeHours; break; case "УД": d.def_UD += sdf.TimeHours; break; case "РВ": d.def_RV += sdf.TimeHours; break; default: break; } } worksheet.Cells[i, 1] = emp.EmployeeID; worksheet.Cells[i, 2] = emp.FullName; worksheet.Cells[i, 3] = norma; worksheet.Cells[i, 4] = d.def_B; worksheet.Cells[i, 5] = d.def_V; worksheet.Cells[i, 6] = d.def_VP; worksheet.Cells[i, 7] = d.def_G; worksheet.Cells[i, 8] = d.def_DO; worksheet.Cells[i, 9] = d.def_K; worksheet.Cells[i, 10] = d.def_NN; worksheet.Cells[i, 11] = d.def_NP; worksheet.Cells[i, 12] = d.def_OV; worksheet.Cells[i, 13] = d.def_OD; worksheet.Cells[i, 14] = d.def_OJ; worksheet.Cells[i, 15] = d.def_OZ; worksheet.Cells[i, 16] = d.def_OT; worksheet.Cells[i, 17] = d.def_PK; worksheet.Cells[i, 18] = d.def_PR; worksheet.Cells[i, 19] = d.def_R; worksheet.Cells[i, 20] = d.def_RP; worksheet.Cells[i, 21] = d.def_U; worksheet.Cells[i, 22] = d.def_UD; worksheet.Cells[i, 23] = d.def_RV; worksheet.Cells[i, 24] = norma - def_sum; worksheet.Cells[i, 25] = overhours; worksheet.Cells[i, 26] = getCompany(emp.Department); worksheet.Cells[i, 27] = getPath(emp.Department); worksheet.Cells[i, 28] = getDepartment(emp.Department); i++; } SaveReportToExcel(); }
protected void Page_Load(object sender, EventArgs e) { if (Session["User"] == null) Response.Redirect("Default.aspx"); Date dt = new Date(); SAPDB db = new SAPDB(); SQLDB sql = new SQLDB(); PeriodDB perdb = new PeriodDB(); NightHoursDB nightdb = new NightHoursDB(); Person user = (Person)Session["User"]; string role = ""; string month_id = ""; string year = ""; string start_date = ""; string end_date = ""; if (Request.QueryString["rtb"] != null) { EncryptedQueryString QueryString = new EncryptedQueryString(Request.QueryString["rtb"]); if (QueryString["role"] != null) role = QueryString["role"].ToString(); if (QueryString["month_id"] != null) month_id = QueryString["month_id"].ToString(); if (QueryString["year"] != null) year = QueryString["year"].ToString(); if (QueryString["start_date"] != null) start_date = QueryString["start_date"].ToString(); if (QueryString["end_date"] != null) end_date = QueryString["end_date"].ToString(); } List<NightHours> nighthours = nightdb.getNightHours(); Period per = perdb.getPeriod(Convert.ToInt32(month_id), Convert.ToInt32(year)); EmployeeList emp_list = new EmployeeList(); List<Employee> all_employees = db.getEmployeeListForReports(start_date, end_date, user.TabNum, role); if (all_employees == null) { MessageBox.Show("Невозможно сформировать отчет! Список сотрудников за период пуст!"); return; } EmployeeComparerByFullnameASC emp_comp = new EmployeeComparerByFullnameASC(); all_employees.Sort(emp_comp); Response.Clear(); Response.Charset = "utf-8"; Response.ContentType = "application/vnd.ms-excel"; string str = @"<table cellspacing='0' cellpadding='0' border='1'> <tr> <td width='30px' style='font-weight: bold;' align='center' valign='middle'> Таб. номер </td> <td width='100px' style='font-weight: bold;' align='center' valign='middle'> ФИО </td>"; int count_days = dt.getCountDays(per.MonthID, per.Year); for (int i = 1; i <= count_days; i++) str += "<td width='20px' style='font-weight: bold;' align='center'>" + i.ToString() + "</td><td width='20px' style='background-color: #99CCFF; font-weight: bold;' align='center' >" + i.ToString() + "a</td>"; str += "<td> </td><td> </td><td> </td></tr>"; foreach (Employee emp in all_employees) { str += "<tr>"; str += "<td width='30px' align='center'>" + DeleteZeroFromEmployeeID(emp.EmployeeID) + "</td>"; str += "<td width='100px' align='center'>" + emp.FullName + "</td>"; int day = 1; List<HRHours> hr_current = sql.getHRHours(emp.EmployeeID, emp.StartPeriod, emp.BeginDate, emp.EndDate); List<Schedule> schedule = sql.getSchedule(emp.EmployeeID, emp.StartPeriod, emp.BeginDate, emp.EndDate); List<ScheduleDeflection> dschedule = sql.getScheduleDeflection(emp.EmployeeID, emp.StartPeriod, emp.BeginDate, emp.EndDate); foreach (Schedule sch in schedule) { decimal all_hours = 0; decimal night_hours = 0; int d = Convert.ToInt32(sch.DayPeriod); // если у нас день не совпадает с днем в графике, заполняю пустым квадратом //TimekeeperHours tkh = tkh_current.Find(delegate(TimekeeperHours h) { return Convert.ToInt32(h.Day) == day; }); HRHours hr = hr_current.Find(delegate(HRHours hrh) { return Convert.ToInt32(hrh.Day) == day; }); if (hr != null) { all_hours += hr.DayOverHours + hr.NightOverHours; night_hours += hr.NightOverHours; } while (d != day) { if (day == count_days) break; if (all_hours != 0) str += "<td width='20px' align='center'>" + all_hours.ToString() + "</td>"; else str += "<td width='20px' align='center'> </td>"; if (night_hours != 0) str += "<td width='20px' style='background-color: #99CCFF;' align='center'>" + night_hours.ToString() + "</td>"; else str += "<td width='20px' style='background-color: #99CCFF;' align='center'> </td>"; day++; } ScheduleDeflection sd = dschedule.Find(delegate(ScheduleDeflection dsch) { return Convert.ToInt32(dsch.DayPeriod) == day; }); if (sd != null) { //time = CheckDecimalNumber(sd.CodeT13); decimal diversity = sch.TimeHours - sd.TimeHours; if (diversity != 0) { if (diversity > 0) { all_hours = diversity; } else { all_hours = sd.TimeHours; } } if (all_hours != 0) str += "<td width='20px' align='center'>" + all_hours.ToString() + "</td>"; else str += "<td width='20px' align='center'> </td>"; if (night_hours != 0) str += "<td width='20px' style='background-color: #99CCFF;' align='center'>" + night_hours.ToString() + "</td>"; else str += "<td width='20px' style='background-color: #99CCFF;' align='center'> </td>"; } else { // если выходной или изменение на выходной то пишем в отклонения по выходному дню if (((sch.DaySchedule == "FREE") && (Convert.ToInt32(sch.TimeHours) == 0)) || (sch.DayScheduleVar == "F")) { if (all_hours != 0) str += "<td width='20px' align='center'>" + all_hours.ToString() + "</td>"; else str += "<td width='20px' align='center'> </td>"; if (night_hours != 0) str += "<td width='20px' style='background-color: #99CCFF;' align='center'>" + night_hours.ToString() + "</td>"; else str += "<td width='20px' style='background-color: #99CCFF;' align='center'> </td>"; } else { //decimal hour_start = Convert.ToInt32(sch.TimeBegin.Substring(0, 2)); //decimal hour_end = Convert.ToInt32(sch.TimeEnd.Substring(0, 2)); //decimal minute_start = Convert.ToDecimal(sch.TimeBegin.Substring(2, 2)); //decimal minute_end = Convert.ToDecimal(sch.TimeEnd.Substring(2, 2)); //if (hour_start == 0) hour_start = 24; //if (hour_end == 0) hour_end = 24;\ /* hour_start += minute_start / 60; hour_end += minute_end / 60; if (sch.TimeHours != 0) { if ((hour_start > 6) && (hour_end < 22)) all_hours += sch.TimeHours; if (hour_start <= 6) { night_hours += 6 - hour_start - 1; all_hours += sch.TimeHours; } if (hour_end >= 22) { night_hours += hour_end - 22; all_hours += sch.TimeHours; } } */ all_hours += sch.TimeHours; NightHours nhour = nighthours.Find(delegate(NightHours nh) { return nh.DaySchedule.ToUpper() == sch.DaySchedule.ToUpper(); }); if (nhour != null) { night_hours += nhour.Night_Hours; } //day_hours += (night_hours + sch.TimeHours); if (all_hours != 0) str += "<td width='20px' align='center'>" + all_hours.ToString() + "</td>"; else str += "<td width='20px' align='center'> </td>"; if (night_hours != 0) str += "<td width='20px' style='background-color: #99CCFF;' align='center'>" + night_hours.ToString() + "</td>"; else str += "<td width='20px' style='background-color: #99CCFF;' align='center'> </td>"; } } day++; } while (day <= count_days) { decimal all_hours = 0; decimal night_hours = 0; //HRHours hr = hr_current.Find(delegate(HRHours hrh) { return Convert.ToInt32(hrh.Day) == day; }); if (all_hours != 0) str += "<td width='20px' align='center'>" + all_hours.ToString() + "</td>"; else str += "<td width='20px' align='center'> </td>"; if (night_hours != 0) str += "<td width='20px' style='background-color: #99CCFF;' align='center'>" + night_hours.ToString() + "</td>"; else str += "<td width='20px' style='background-color: #99CCFF;' align='center'> </td>"; day++; } str += "<td>" + getCompany(emp.Department) + "</td><td>" + getPath(emp.Department) + "</td><td>" + getDepartment(emp.Department) + "</td>"; str += "</tr>"; } str += "</table>"; Response.Write(str); Response.End(); }
public void GetReportTimeboard(List<Employee> all_employees, Period per) { SQLDB sql = new SQLDB(); Date dt = new Date(); OpenReportExcelFile(@"C:\Inetpub\wwwroot\timeboard\Reports\ReportTimeboard.xls"); Excel.Workbook workbook = (Excel.Workbook)thisApplication.Workbooks["ReportTimeboard.xls"]; Excel.Worksheet worksheet = (Excel.Worksheet)workbook.Worksheets["Sheet1"]; NightHoursDB nightdb = new NightHoursDB(); List<NightHours> nighthours = nightdb.getNightHours(); EmployeeComparerByFullnameASC emp_comp = new EmployeeComparerByFullnameASC(); all_employees.Sort(emp_comp); int count_days = dt.getCountDays(per.MonthID, per.Year); worksheet.Cells[1, 1] = "Таб. номер"; worksheet.Cells[1, 2] = "ФИО"; int j = 2; int i = 1; for (i = 1; i <= count_days; i++) { worksheet.Cells[1, ++j] = i; worksheet.Cells[1, ++j] = i + "a"; } i = 2; foreach (Employee emp in all_employees) { worksheet.Cells[i, 1] = DeleteZeroFromEmployeeID(emp.EmployeeID); worksheet.Cells[i, 2] = emp.FullName; j = 2; int day = 1; EmployeeList emp_list = new EmployeeList(); List<HRHours> hr_current = sql.getHRHours(emp.EmployeeID, emp.StartPeriod, emp.BeginDate, emp.EndDate); List<Schedule> schedule = sql.getSchedule(emp.EmployeeID, emp.StartPeriod, emp.BeginDate, emp.EndDate); List<ScheduleDeflection> dschedule = sql.getScheduleDeflection(emp.EmployeeID, emp.StartPeriod, emp.BeginDate, emp.EndDate); foreach (Schedule sch in schedule) { j++; decimal all_hours = 0; decimal night_hours = 0; int d = Convert.ToInt32(sch.DayPeriod); // если у нас день не совпадает с днем в графике, заполняю пустым квадратом HRHours hr = hr_current.Find(delegate(HRHours hrh) { return Convert.ToInt32(hrh.Day) == day; }); if (hr != null) { all_hours += hr.DayOverHours + hr.NightOverHours; night_hours += hr.NightOverHours; } while (d != day) { if (day == count_days) break; if (all_hours != 0) worksheet.Cells[i, j] = all_hours.ToString(); if (night_hours != 0) worksheet.Cells[i, ++j] = night_hours.ToString(); else j++; j++; day++; } ScheduleDeflection sd = dschedule.Find(delegate(ScheduleDeflection dsch) { return Convert.ToInt32(dsch.DayPeriod) == day; }); if (sd != null) { //time = CheckDecimalNumber(sd.CodeT13); decimal diversity = sch.TimeHours - sd.TimeHours; if (diversity != 0) { if (diversity > 0) { all_hours = diversity; } else { all_hours = sd.TimeHours; } } if (all_hours != 0) worksheet.Cells[i, j] = all_hours.ToString(); if (night_hours != 0) worksheet.Cells[i, ++j] = night_hours.ToString(); else j++; } else { // если выходной или изменение на выходной то пишем в отклонения по выходному дню if (((sch.DaySchedule == "FREE") && (Convert.ToInt32(sch.TimeHours) == 0)) || (sch.DayScheduleVar == "F")) { if (all_hours != 0) worksheet.Cells[i, j] = all_hours.ToString(); if (night_hours != 0) worksheet.Cells[i, ++j] = night_hours.ToString(); else j++; } else { //decimal hour_start = Convert.ToInt32(sch.TimeBegin.Substring(0, 2)); //decimal hour_end = Convert.ToInt32(sch.TimeEnd.Substring(0, 2)); //decimal minute_start = Convert.ToDecimal(sch.TimeBegin.Substring(2, 2)); //decimal minute_end = Convert.ToDecimal(sch.TimeEnd.Substring(2, 2)); //if (hour_start == 0) hour_start = 24; //if (hour_end == 0) hour_end = 24;\ /* hour_start += minute_start / 60; hour_end += minute_end / 60; if (sch.TimeHours != 0) { if ((hour_start > 6) && (hour_end < 22)) all_hours += sch.TimeHours; if (hour_start <= 6) { night_hours += 6 - hour_start - 1; all_hours += sch.TimeHours; } if (hour_end >= 22) { night_hours += hour_end - 22; all_hours += sch.TimeHours; } }*/ all_hours += sch.TimeHours; NightHours nhour = nighthours.Find(delegate(NightHours nh) { return nh.DaySchedule.ToUpper() == sch.DaySchedule.ToUpper(); }); if (nhour != null) { night_hours += nhour.Night_Hours; } //day_hours += (night_hours + sch.TimeHours); if (all_hours != 0) worksheet.Cells[i, j] = all_hours.ToString(); if (night_hours != 0) worksheet.Cells[i, ++j] = night_hours.ToString(); else j++; } } day++; } while (day <= count_days) { decimal all_hours = 0; decimal night_hours = 0; //HRHours hr = hr_current.Find(delegate(HRHours hrh) { return Convert.ToInt32(hrh.Day) == day; }); if (all_hours != 0) worksheet.Cells[i, j] = all_hours.ToString(); if (night_hours != 0) worksheet.Cells[i, ++j] = night_hours.ToString(); else j++; j++; day++; } worksheet.Cells[i, ++j] = getCompany(emp.Department); worksheet.Cells[i, ++j] = getPath(emp.Department); worksheet.Cells[i, ++j] = getDepartment(emp.Department); i++; } SaveReportToExcel(); }
protected void Page_Load(object sender, EventArgs e) { if (Session["User"] == null) Response.Redirect("Default.aspx"); Date dt = new Date(); SAPDB db = new SAPDB(); SQLDB sql = new SQLDB(); PeriodDB perdb = new PeriodDB(); Person user = (Person)Session["User"]; string role = ""; string month_id = ""; string year = ""; string start_date = ""; string end_date = ""; if (Request.QueryString["rft"] != null) { EncryptedQueryString QueryString = new EncryptedQueryString(Request.QueryString["rft"]); if (QueryString["role"] != null) role = QueryString["role"].ToString(); if (QueryString["month_id"] != null) month_id = QueryString["month_id"].ToString(); if (QueryString["year"] != null) year = QueryString["year"].ToString(); if (QueryString["start_date"] != null) start_date = QueryString["start_date"].ToString(); if (QueryString["end_date"] != null) end_date = QueryString["end_date"].ToString(); } Period per = perdb.getPeriod(Convert.ToInt32(month_id), Convert.ToInt32(year)); EmployeeList emp_list = new EmployeeList(); List<Employee> all_employees = db.getEmployeeListForReports(start_date, end_date, user.TabNum, role); if (all_employees == null) { MessageBox.Show("Невозможно сформировать отчет! Список сотрудников за период пуст!"); return; } EmployeeComparerByFullnameASC emp_comp = new EmployeeComparerByFullnameASC(); all_employees.Sort(emp_comp); Response.Clear(); Response.Charset = "utf-8"; Response.ContentType = "application/vnd.ms-excel"; string str = @"<table cellspacing='0' cellpadding='0' border='1'> <tr> <td colspan='25' style='border: 0px; height: 30px; font-weight: bold;' align='center' valign='middle'> ОТЧЕТ </td> <td> </td><td> </td><td> </td> </tr> <tr> <td colspan='25' style='border: 0px; height: 30px;' align='center' valign='middle'>"; str += "по фактически отработанному времени за " + per.MonthName.ToUpper() + " " + per.Year + " года</td><td> </td><td> </td><td> </td></tr>"; str += @"<tr> <td rowspan='2' style='background-color: #99CCFF; font-weight: bold;' align='center'> Таб. номер </td> <td rowspan='2' style='background-color: #99CCFF; font-weight: bold;' align='center'> ФИО </td> <td rowspan='2' style='width:80px; background-color: #99CCFF; font-weight: bold;' align='center'> Кол-во рабочих часов по графику (норма) </td> <td colspan='20' style='height: 30px; background-color: #99CCFF; font-weight: bold;' align='center'> ОТКЛОНЕНИЯ </td> <td rowspan='2' style='width:80px; background-color: #99CCFF; font-weight: bold;' align='center'> Итого отработано часов за период (факт) </td> <td rowspan='2' style='width:80px; background-color: #99CCFF; font-weight: bold;' align='center'> Итого отработано сверурочных часов </td> <td rowspan='2'> </td><td rowspan='2'> </td><td rowspan='2'> </td> </tr> <tr> <td style='width:80px; background-color: #FFFF99; font-weight: bold;' align='center'> Временная нетрудоспособность </td> <td style='width:80px; background-color: #FFFF99; font-weight: bold;' align='center'> Выходные дни (еженедельный отпуск) и нерабочие праздничные дни </td> <td style='width:80px; background-color: #FFFF99; font-weight: bold;' align='center'> Время простоя по вине работника </td> <td style='width:80px; background-color: #FFFF99; font-weight: bold;' align='center'> Невыходы на время исполнения государственных или общественных обязанностей согласно законодательству </td> <td style='width:80px; background-color: #FFFF99; font-weight: bold;' align='center'> Отпуск без сохранения заработной платы, предоставляемый работнику по разрешению работодателя </td> <td style='width:80px; background-color: #FFFF99; font-weight: bold;' align='center'> Служебная командировка </td> <td style='width:80px; background-color: #FFFF99; font-weight: bold;' align='center'> Неявки по невыясненным причинам (до выяснения обстоятельств) </td> <td style='width:80px; background-color: #FFFF99; font-weight: bold;' align='center'> Время простоя по причинам, не зависящим от работодателя и работника </td> <td style='width:80px; background-color: #FFFF99; font-weight: bold;' align='center'> Дополнительные выходные дни (оплачиваемые) </td> <td style='width:80px; background-color: #FFFF99; font-weight: bold;' align='center'> Ежегодный дополнительный оплачиваемый отпуск </td> <td style='width:80px; background-color: #FFFF99; font-weight: bold;' align='center'> Отпуск по уходу за ребенком до достижения им возраста трех лет </td> <td style='width:80px; background-color: #FFFF99; font-weight: bold;' align='center'> Отпуск без сохранения заработной платы при условиях, предусмотренных действующим законодательством Российской Федерации </td> <td style='width:80px; background-color: #FFFF99; font-weight: bold;' align='center'> Ежегодный основной оплачиваемый отпуск </td> <td style='width:80px; background-color: #FFFF99; font-weight: bold;' align='center'> Повышение квалификации с отрывом от работы </td> <td style='width:80px; background-color: #FFFF99; font-weight: bold;' align='center'> Прогулы (отсутствие на рабочем месте без уважительных причин в течение времени, установленного законодательством) </td> <td style='width:80px; background-color: #FFFF99; font-weight: bold;' align='center'> Отпуск по беременности и родам (отпуск в связи с усыновлением новорожденного ребенка) </td> <td style='width:80px; background-color: #FFFF99; font-weight: bold;' align='center'> Время простоя по вине работодателя </td> <td style='width:80px; background-color: #FFFF99; font-weight: bold;' align='center'> Дополнительный отпуск в связи с обучением с сохранением среднего заработка работникам, совмещающим работу с обучением </td> <td style='width:80px; background-color: #FFFF99; font-weight: bold;' align='center'> Дополнительный отпуск в связи с обучением без сохранения заработной платы </td> <td style='width:80px; background-color: #FFFF99; font-weight: bold;' align='center'> Работа в выходные и праздничные дни </td> </tr> "; foreach(Employee emp in all_employees) { decimal norma = 0; decimal overhours = 0; decimal def_sum = 0; Deflections d = new Deflections(); List<HRHours> hr_current = sql.getHRHours(emp.EmployeeID, emp.StartPeriod, emp.BeginDate, emp.EndDate); List<Schedule> schedule = sql.getSchedule(emp.EmployeeID, emp.StartPeriod, emp.BeginDate, emp.EndDate); List<ScheduleDeflection> dschedule = sql.getScheduleDeflection(emp.EmployeeID, emp.StartPeriod, emp.BeginDate, emp.EndDate); foreach (Schedule sch in schedule) { // если выходной или изменение на выходной то пишем в отклонения по выходному дню if (((sch.DaySchedule == "FREE") && (Convert.ToInt32(sch.TimeHours) == 0)) || (sch.DayScheduleVar == "F")) d.def_V += sch.TimeHours; else norma += sch.TimeHours; } foreach (HRHours over in hr_current) overhours += (over.DayOverHours + over.NightOverHours); foreach (ScheduleDeflection sdf in dschedule) { def_sum += sdf.TimeHours; if (sdf.CodeT13.Equals("РВ")) { def_sum -= sdf.TimeHours; // убираем из поля Итого отработано по факту overhours += sdf.TimeHours; // записываем в поле Итого сверхурочных часов } switch (sdf.CodeT13) { case "Б": d.def_B += sdf.TimeHours; break; case "ВП": d.def_VP += sdf.TimeHours; break; case "Г": d.def_G += sdf.TimeHours; break; case "ДО": d.def_DO += sdf.TimeHours; break; case "К": d.def_K += sdf.TimeHours; break; case "НН": d.def_NN += sdf.TimeHours; break; case "НП": d.def_NP += sdf.TimeHours; break; case "ОВ": d.def_OV += sdf.TimeHours; break; case "ОД": d.def_OD += sdf.TimeHours; break; case "ОЖ": d.def_OJ += sdf.TimeHours; break; case "ОЗ": d.def_OZ += sdf.TimeHours; break; case "ОТ": d.def_OT += sdf.TimeHours; break; case "ПК": d.def_PK += sdf.TimeHours; break; case "ПР": d.def_PR += sdf.TimeHours; break; case "Р": d.def_R += sdf.TimeHours; break; case "РП": d.def_RP += sdf.TimeHours; break; case "У": d.def_U += sdf.TimeHours; break; case "УД": d.def_UD += sdf.TimeHours; break; case "РВ": d.def_RV += sdf.TimeHours; break; default: break; } } str += "<tr>"; str += "<td align='center'>" + DeleteZeroFromEmployeeID(emp.EmployeeID) + "</td>"; str += "<td align='center'>" + emp.FullName + "</td>"; if (norma != 0) str += "<td align='center'>" + norma.ToString() + "</td>"; else str += "<td> </td>"; if (d.def_B != 0) str += "<td align='center'>" + d.def_B.ToString() + "</td>"; else str += "<td> </td>"; if (d.def_V != 0) str += "<td align='center'>" + d.def_V.ToString() + "</td>"; else str += "<td> </td>"; if (d.def_VP != 0) str += "<td align='center'>" + d.def_VP.ToString() + "</td>"; else str += "<td> </td>"; if (d.def_G != 0) str += "<td align='center'>" + d.def_G.ToString() + "</td>"; else str += "<td> </td>"; if (d.def_DO != 0) str += "<td align='center'>" + d.def_DO.ToString() + "</td>"; else str += "<td> </td>"; if (d.def_K != 0) str += "<td align='center'>" + d.def_K.ToString() + "</td>"; else str += "<td> </td>"; if (d.def_NN != 0) str += "<td align='center'>" + d.def_NN.ToString() + "</td>"; else str += "<td> </td>"; if (d.def_NP != 0) str += "<td align='center'>" + d.def_NP.ToString() + "</td>"; else str += "<td> </td>"; if (d.def_OV != 0) str += "<td align='center'>" + d.def_OV.ToString() + "</td>"; else str += "<td> </td>"; if (d.def_OD != 0) str += "<td align='center'>" + d.def_OD.ToString() + "</td>"; else str += "<td> </td>"; if (d.def_OJ != 0) str += "<td align='center'>" + d.def_OJ.ToString() + "</td>"; else str += "<td> </td>"; if (d.def_OZ != 0) str += "<td align='center'>" + d.def_OZ.ToString() + "</td>"; else str += "<td> </td>"; if (d.def_OT != 0) str += "<td align='center'>" + d.def_OT.ToString() + "</td>"; else str += "<td> </td>"; if (d.def_PK != 0) str += "<td align='center'>" + d.def_PK.ToString() + "</td>"; else str += "<td> </td>"; if (d.def_PR != 0) str += "<td align='center'>" + d.def_PR.ToString() + "</td>"; else str += "<td> </td>"; if (d.def_R != 0) str += "<td align='center'>" + d.def_R.ToString() + "</td>"; else str += "<td> </td>"; if (d.def_RP != 0) str += "<td align='center'>" + d.def_RP.ToString() + "</td>"; else str += "<td> </td>"; if (d.def_U != 0) str += "<td align='center'>" + d.def_U.ToString() + "</td>"; else str += "<td> </td>"; if (d.def_UD != 0) str += "<td align='center'>" + d.def_UD.ToString() + "</td>"; else str += "<td> </td>"; if (d.def_RV != 0) str += "<td align='center'>" + d.def_RV.ToString() + "</td>"; else str += "<td> </td>"; if ((norma - def_sum) != 0) str += "<td align='center'>" + (norma - def_sum).ToString() + "</td>"; else str += "<td> </td>"; if (overhours != 0) str += "<td align='center'>" + overhours.ToString() + "</td>"; else str += "<td> </td>"; str += "<td>" + getCompany(emp.Department) + "</td><td>" + getPath(emp.Department) + "</td><td>" + getDepartment(emp.Department) + "</td>"; str += "</tr>"; str += "</tr>"; } str += "</table>"; Response.Write(str); Response.End(); }