Ejemplo n.º 1
0
        public ErrorList SetUpFromSarRow(KlonsADataSet.SALARY_SHEETSRow dr_lapa)
        {
            var error_list = new ErrorList();

            var er = SetUpLightFromSarRow(dr_lapa);

            if (er != "OK")
            {
                return(new ErrorList("", er));
            }

            var drs_r = dr_lapa.XKind == ESalarySheetKind.Total ?
                        dr_lapa.GetSALARY_SHEETS_RRowsByFK_SALARY_SHEETS_R_IDST().OrderBy(d => d.SNR) :
                        dr_lapa.GetSALARY_SHEETS_RRowsByFK_SALARY_SHEETS_R_IDS().OrderBy(d => d.SNR);

            foreach (var dr_r in drs_r)
            {
                var salary_sheet_row = new SalarySheetRowInfo(this);
                var err = salary_sheet_row.SetUpFromRowX(dr_r);
                if (err.HasErrors)
                {
                    return(err);
                }
                Rows.Add(salary_sheet_row);
            }

            return(error_list);
        }
Ejemplo n.º 2
0
        public bool GetRow(int addmt, out SalarySheetRowInfo row)
        {
            row = null;
            var table_sar   = MyData.DataSetKlons.SALARY_SHEETS;
            var table_sar_r = MyData.DataSetKlons.SALARY_SHEETS_R;

            int yr = SalarySheet.YR;
            int mt = SalarySheet.MT;

            Utils.AddMonths(ref yr, ref mt, addmt);

            int idp  = Row.IDP;
            int idam = Row.IDAM;

            var drs = table_sar_r.WhereX(
                d =>
            {
                var dr_sar = d.SALARY_SHEETSRowByFK_SALARY_SHEETS_R_IDS;
                return
                (d.IDP == idp &&
                 d.IDAM == idam &&
                 dr_sar.YR == yr &&
                 dr_sar.MT == mt);
            }).ToArray();

            if (drs.Length == 0)
            {
                return(true);
            }
            var dr = drs[0];

            var shr = new SalarySheetRowInfo();
            var err = shr.SetUpFromRowX(dr);

            if (err != null && err.Count > 0)
            {
                return(false);
            }

            row = shr;

            return(true);
        }
Ejemplo n.º 3
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);
        }