Exemple #1
0
 public ErrorList CalcList(SalarySheetRowInfo sr)
 {
     if (sr.SalarySheetRowSet == null)
     {
         sr.CheckLinkedRows(sr.Row.IDP);
     }
     return(CalcList(sr.SalarySheet, sr.Row.IDP, sr.SalarySheetRowSet.TotalPersonPay));
 }
Exemple #2
0
        public ErrorList FillRowX()
        {
            var err = SR.CheckLinkedRows(SR.Row.IDP);

            if (err.HasErrors)
            {
                return(err);
            }
            err = SR.SalarySheetRowSet.FillRow();
            return(err);
        }
Exemple #3
0
        public ErrorList CalcSickDays(SalarySheetRowInfo sr)
        {
            var err = sr.CheckLinkedRows(sr.Row.IDP);

            if (err.HasErrors)
            {
                return(err);
            }

            if (sr.IsSingleRow())
            {
                err = CalcSickDaysB(sr, null);
                return(err);
            }

            TotalSDCI = new SickDayCalcInfo(PreparingReport);
            err       = TotalSDCI.CalcSickDaysA(sr.SalarySheetRowSet);
            if (err.HasErrors)
            {
                return(err);
            }

            if (TotalSDCI.TotalRow.DaysCount == 0)
            {
                new ErrorList();
            }

            SetAvPayFrom(TotalSDCI);

            SickDayCalcInfo[] sdcs      = null;
            string[]          positions = null;

            if (sr.Row.XType == ESalarySheetRowType.Total)
            {
                var srs = sr.SalarySheetRowSet;

                sdcs      = new SickDayCalcInfo[srs.LinkedRows.Length];
                positions = new string[srs.LinkedRows.Length];

                for (int i = 0; i < srs.LinkedRows.Length; i++)
                {
                    var lr  = srs.LinkedRows[i];
                    var sdc = new SickDayCalcInfo(PreparingReport);
                    positions[i] = lr.GetPositionTitle();
                    sdcs[i]      = sdc;
                    sdc.SetAvPayFrom(this);

                    err = sdc.CalcSickDaysB(lr, TotalSDCI);
                    if (err.HasErrors)
                    {
                        return(err);
                    }
                }
                SumTotalPay(sdcs, TotalSDCI);
                if (PreparingReport)
                {
                    PrepareListT(sdcs, positions);
                }
            }
            else
            {
                if (PreparingReport)
                {
                    PrepareListA(sr.GetPositionTitle());
                }
                err = CalcSickDaysB(sr, TotalSDCI);
                if (err.HasErrors)
                {
                    return(err);
                }
            }

            return(new ErrorList());
        }
Exemple #4
0
        public static ReportViewerData MakeReportData(KlonsADataSet.SALARY_SHEETS_RRow dr_lapas_r)
        {
            var sr  = new SalarySheetRowInfo();
            var err = sr.SetUpFromRowX(dr_lapas_r);

            if (err.HasErrors)
            {
                Form_ErrorList.ShowErrorList(MyData.MyMainForm, err);
                return(null);
            }
            sr.CheckLinkedRows(dr_lapas_r.IDP);

            var sc = new SalaryCalcTInfo(sr.SalarySheetRowSet, new SalaryInfo(), true);

            err = sc.FillRow();
            if (err.HasErrors)
            {
                Form_ErrorList.ShowErrorList(MyData.MyMainForm, err);
                return(null);
            }

            var person = string.Format("{0} {1}, {2}", sr.DR_Person_r.FNAME,
                                       sr.DR_Person_r.LNAME, sr.GetPositionTitle().Nz().ToLower());
            var period = string.Format("{0:dd.MM.yyyy} - {1:dd.MM.yyyy}",
                                       sr.SalarySheet.DT1, sr.SalarySheet.DT2);

            ReportViewerData rd = new ReportViewerData();

            rd.FileName = "ReportA_AprIzklasts_1";
            if (sr.IsSingleRow())
            {
                var sc0 = sc.LinkedSCI[0];
                sc0.CheckBeforeReport();

                sc0.AvPayCalc.SetCurMonthPay(sr.SalarySheet.YR, sr.SalarySheet.MT, sc.TotalSI._TOTAL_BEFORE_TAXES, sc.TotalSI._PAY);

                rd.Sources["dsSickPay"]     = sc0.SickDayCalc?.Rows;
                rd.Sources["dsAvPay"]       = sc0.AvPayCalc.ReportRows;
                rd.Sources["dsWorkPay"]     = sc0.WorkPayCalc.GetRows2();
                rd.Sources["dsVacationPay"] = sc0.VacationCalc.Rows;
                rd.Sources["dsCalcR"]       = sc0.CalcR.ReportRows;
                rd.Sources["dsBonus"]       = sc0.BonusCalc.ReportRows;
                rd.Sources["dsSalary"]      = sc0.MakeReport1();
                rd.AddReportParameters(new string[]
                {
                    "CompanyName", MyData.Params.CompNameX,
                    "RPerson", person,
                    "RPeriod", period,
                    "RSickPay", sc0.SickDayCalc.TotalRow.SickDayPay.ToString("N2"),
                    "RSickPay75", sc0.SickDayCalc.TotalRow.SickDayPay75.ToString("N2"),
                    "RSickPay80", sc0.SickDayCalc.TotalRow.SickDayPay80.ToString("N2"),
                    "RAvPayHour", sc0.AvPayCalc.RateHour.ToString("N4"),
                    "RAvPayDay", sc0.AvPayCalc.RateDay.ToString("N4"),
                    "RAvPayCalDay", sc0.AvPayCalc.RateCalendarDay.ToString("N4"),
                    "RAvPayRemark", sc0.AvPayCalc.UsingMinRate?"Izmantotas minimālās likmes.": "",
                    "RPosTitle0", sc0.SR.GetPositionTitle(),
                    "RPosTitle1", null,
                    "RPosTitle2", null,
                    "RPosTitle3", null,
                    "RPosTitle4", null,
                    "RIsAvPayUsed", sc0.SI.IsAvPayUsed().ToString()
                });
            }
            else
            {
                var rep = sc.MakeReport1();
                sc.CheckBeforeReport();

                sc.AvPayCalc.SetCurMonthPay(sr.SalarySheet.YR, sr.SalarySheet.MT, sc.TotalSI._TOTAL_BEFORE_TAXES, sc.TotalSI._PAY);

                rd.Sources["dsSickPay"]     = sc.SickDayCalc.Rows;
                rd.Sources["dsAvPay"]       = sc.AvPayCalc.ReportRows;
                rd.Sources["dsWorkPay"]     = sc.WorkPayCalc.GetRows2();
                rd.Sources["dsVacationPay"] = sc.VacationCalc.Rows;
                rd.Sources["dsCalcR"]       = sc.CalcR.ReportRows;
                rd.Sources["dsBonus"]       = sc.BonusCalc.ReportRows;
                rd.Sources["dsSalary"]      = rep.GetGoodRows();
                rd.AddReportParameters(new string[]
                {
                    "CompanyName", MyData.Params.CompNameX,
                    "RPerson", person,
                    "RPeriod", period,
                    "RSickPay", sc.SickDayCalc.TotalRow.SickDayPay.ToString("N2"),
                    "RSickPay75", sc.SickDayCalc.TotalRow.SickDayPay75.ToString("N2"),
                    "RSickPay80", sc.SickDayCalc.TotalRow.SickDayPay80.ToString("N2"),
                    "RAvPayHour", sc.AvPayCalc.RateHour.ToString("N4"),
                    "RAvPayDay", sc.AvPayCalc.RateDay.ToString("N4"),
                    "RAvPayCalDay", sc.AvPayCalc.RateCalendarDay.ToString("N4"),
                    "RAvPayRemark", sc.AvPayCalc.UsingMinRate?"Izmantotas minimālās likmes.": "",
                    "RPosTitle0", rep.Titles[0],
                    "RPosTitle1", rep.Titles[1],
                    "RPosTitle2", rep.Titles[2],
                    "RPosTitle3", rep.Titles[3],
                    "RPosTitle4", rep.Titles[4],
                    "RIsAvPayUsed", sc.TotalSI.IsAvPayUsed().ToString()
                });
            }
            return(rd);
        }