public void PrepareList(string postitle) { for (int i = 0; i < ReportRows.Count; i++) { var r = ReportRows[i]; var jr = JoinRows[i]; jr.Caption = string.Format("{0:dd.MM.yyyy} - {1:dd.MM.yyyy}", jr.DateStart, jr.DateEnd); } if (ReportRows.Count > 1) { ReportRows.Add(TotalRow); var tjr = new WorkPayCalcJoinRow(); tjr.Caption = "Kopā"; tjr.IsTotal = true; JoinRows.Add(tjr); } }
public void PrepareListT() { if (LinkedWorkPayCalcs.Length == 1) { var w0 = LinkedWorkPayCalcs[0]; w0.PrepareList(w0.PositionTitle); ReportRows = w0.ReportRows; JoinRows = w0.JoinRows; return; } ReportRows.Add(TotalRow); var tjr = new WorkPayCalcJoinRow(); tjr.Caption = "Kopā amati"; JoinRows.Add(tjr); var emptyrow = new SalaryInfo(); var emptyjoinrow = new WorkPayCalcJoinRow() { IsTitle = true }; for (int i = 0; i < LinkedWorkPayCalcs.Length; i++) { ReportRows.Add(emptyrow); JoinRows.Add(emptyjoinrow); var wpc = LinkedWorkPayCalcs[i]; var pos = wpc.PositionTitle; ReportRows.Add(emptyrow); var jr = new WorkPayCalcJoinRow(); jr.Caption = pos; jr.IsTitle = true; JoinRows.Add(jr); ReportRows.AddRange(wpc.ReportRows); JoinRows.AddRange(wpc.JoinRows); } }
public void CalcWorkPay(SalarySheetRowInfo sr, SalaryInfo si = null) { if (sr.Row.XType == ESalarySheetRowType.Total) { throw new Exception("Bad idea."); } var dt1 = sr.SalarySheet.DT1; var dt2 = sr.SalarySheet.DT2; if (si == null) { TotalRow = new SalaryInfo(); } else { TotalRow = si; } var posR = sr.PositionsR.FilterListWithDates(dt1, dt2); var amatirpay = new SalaryInfo[posR.LinkedPeriods.Count]; TotalRow._CALENDAR_DAYS = sr.SalarySheet.CalendarMonth.DaysInMonth; TotalRow._CALENDAR_DAYS_USE = sr.CountCalendarDays(); sr.DLRows.CountPlanMonth(TotalRow, sr.SalarySheet.MDT1, sr.SalarySheet.MDT2); sr.DLRows.CountPlan(TotalRow, sr.SalarySheet.MDT1, sr.SalarySheet.MDT2); PeriodInfo amats_hf; if (!sr.Events.Positions.TryGetValue(sr.Row.IDAM, out amats_hf)) { throw new Exception("Bad init."); } amats_hf = amats_hf.FilterListWithDates(dt1, dt2); for (int i = 0; i < amatirpay.Length; i++) { var ari_x = posR.LinkedPeriods[i]; var ari_l = ari_x.FilterThisWithList(amats_hf); if (ari_l.LinkedPeriods.Count == 0) { continue; } var wt = new SalaryInfo(); amatirpay[i] = wt; for (int j = 0; j < ari_l.LinkedPeriods.Count; j++) { var ari = ari_l.LinkedPeriods[j]; sr.DLRows.CountPlan(wt, ari.DateFirst, ari.DateLast); sr.DLRows.CountFact(wt, ari.DateFirst, ari.DateLast); } var dr_amati_r = ari_x.Item1 as KlonsADataSet.POSITIONS_RRow; switch (dr_amati_r.XRateType) { case ESalaryType.Month: case ESalaryType.Day: wt.GetRateDefs(dr_amati_r, TotalRow._MONTH_WORKDAYS, TotalRow._MONTH_WORKHOURS); CalcPayWithDayRate(wt, dr_amati_r); break; case ESalaryType.Hour: wt.GetRateDefs(dr_amati_r, TotalRow._MONTH_WORKDAYS, TotalRow._MONTH_WORKHOURS); CalcPayWithHourRate(wt, dr_amati_r); break; case ESalaryType.Aggregated: wt.GetRateDefs(dr_amati_r, TotalRow._MONTH_WORKDAYS, TotalRow._MONTH_WORKHOURS); CalcPayWithoutAvPay(wt, dr_amati_r); AvPayCalcRequired = true; break; case ESalaryType.Piece: CalcPayWithoutAvPay(wt, dr_amati_r); AvPayCalcRequired = true; break; } wt._SALARY = wt.SumSalary(); if (PreparingReport) { ReportRows.Add(wt); var dtr1 = ari_l.LinkedPeriods[0].DateFirst; var dtr2 = ari_l.LinkedPeriods[ari_l.LinkedPeriods.Count - 1].DateLast; var jr = new WorkPayCalcJoinRow(); jr.DateStart = dtr1; jr.DateEnd = dtr2; JoinRows.Add(jr); } TotalRow.AddWorkTime(wt); TotalRow.AddSalary(wt); } TotalRow._SALARY_PIECEWORK = CalcPieceWorkPay(dt1, dt2, sr.Row.IDAM); TotalRow.PlanedWorkPay = KlonsData.RoundA(TotalRow.PlanedWorkPay, 2); TotalRow._SALARY_DAY = KlonsData.RoundA(TotalRow._SALARY_DAY, 2); TotalRow._SALARY_NIGHT = KlonsData.RoundA(TotalRow._SALARY_NIGHT, 2); TotalRow._SALARY_OVERTIME = KlonsData.RoundA(TotalRow._SALARY_OVERTIME, 2); TotalRow._SALARY_HOLIDAYS_DAY = KlonsData.RoundA(TotalRow._SALARY_HOLIDAYS_DAY, 2); TotalRow._SALARY_HOLIDAYS_NIGHT = KlonsData.RoundA(TotalRow._SALARY_HOLIDAYS_NIGHT, 2); TotalRow._SALARY_HOLIDAYS_OVERTIME = KlonsData.RoundA(TotalRow._SALARY_HOLIDAYS_OVERTIME, 2); TotalRow._SALARY_AVPAY_FREE_DAYS = KlonsData.RoundA(TotalRow._SALARY_AVPAY_FREE_DAYS, 2); TotalRow._SALARY_AVPAY_WORK_DAYS = KlonsData.RoundA(TotalRow._SALARY_AVPAY_WORK_DAYS, 2); TotalRow._SALARY_AVPAY_WORK_DAYS_OVERTIME = KlonsData.RoundA(TotalRow._SALARY_AVPAY_WORK_DAYS_OVERTIME, 2); TotalRow._SALARY_AVPAY_HOLIDAYS = KlonsData.RoundA(TotalRow._SALARY_AVPAY_HOLIDAYS, 2); TotalRow._SALARY_AVPAY_HOLIDAYS_OVERTIME = KlonsData.RoundA(TotalRow._SALARY_AVPAY_HOLIDAYS_OVERTIME, 2); TotalRow._SALARY = TotalRow.SumSalary(); TotalRow.SumForAvPay(); if (PreparingReport && !AvPayCalcRequired) { PrepareList(sr.GetPositionTitle()); } }