コード例 #1
0
        public void GetPersonRow(int idp)
        {
            var table_persons = MyData.DataSetKlons.PERSONS;
            var dt1           = SalarySheet.MDT1;
            var dt2           = SalarySheet.MDT2;

            var dr_person     = table_persons.FindByID(idp);
            var drs_persons_r = dr_person.GetPERSONS_RRows().OrderBy(d => d.EDIT_DATE).ToArray();

            DR_Person_r = PeriodInfo.FindNearestBefore(drs_persons_r,
                                                       dt2, d => d.EDIT_DATE);
        }
コード例 #2
0
        public string GetLikmes()
        {
            var drs_likmes = MyData.DataSetKlons.RATES.OrderBy(d => d.ONDATE).ToArray();

            DR_Likmes = PeriodInfo.FindNearestBefore(drs_likmes,
                                                     MDT1, d => d.ONDATE);

            if (DR_Likmes == null)
            {
                return("Likmes nav definētas.");
            }

            return("OK");
        }
コード例 #3
0
        public bool GetPersonRow(ErrorList err, int idp, SalarySheetInfo sh)
        {
            var table_persons = MyData.DataSetKlons.PERSONS;

            IDP = idp;
            var dr_person = table_persons.FindByID(idp);

            if (dr_person == null)
            {
                var es = string.Format("{0} ({1}-{2})",
                                       IDP,
                                       sh.CalendarMonth.Year,
                                       sh.CalendarMonth.Month);
                err.AddError(es, "Nav darbinieka");
                return(false);
            }

            var drs_persons_r = dr_person.GetPERSONS_RRows().OrderBy(d => d.EDIT_DATE).ToArray();

            var dt2 = sh.MDT2;

            DR_Person_r = PeriodInfo.FindNearestBefore(drs_persons_r,
                                                       dt2, d => d.EDIT_DATE);

            if (DR_Person_r == null)
            {
                var es = string.Format("{0} {1} ({2}-{3})",
                                       dr_person.FNAME,
                                       dr_person.LNAME,
                                       sh.CalendarMonth.Year,
                                       sh.CalendarMonth.Month);
                err.AddError(es, "Norādītajam periodam nav ievadīti darbinieka dati.");
                return(false);
            }
            return(true);
        }
コード例 #4
0
        public ErrorList SetUpT(int idp)
        {
            if (SalarySheet == null)
            {
                throw new Exception("Bad init.");
            }

            var table_sar     = MyData.DataSetKlons.SALARY_SHEETS;
            var table_sar_r   = MyData.DataSetKlons.SALARY_SHEETS_R;
            var table_persons = MyData.DataSetKlons.PERSONS;

            var    error_list = new ErrorList();
            string error_source;

            int yr  = SalarySheet.YR;
            int mt  = SalarySheet.MT;
            var dt1 = SalarySheet.MDT1;
            var dt2 = SalarySheet.MDT2;

            var dr_person = table_persons.FindByID(idp);

            if (dr_person == null)
            {
                error_list.AddError("Algas lapa", "Nav darbinieka");
                return(error_list);
            }

            error_source = string.Format("Darbinieks :{0} {1})",
                                         dr_person.FNAME,
                                         dr_person.LNAME);

            var drs_persons_r = dr_person.GetPERSONS_RRows().OrderBy(d => d.EDIT_DATE).ToArray();


            DR_Person_r = PeriodInfo.FindNearestBefore(drs_persons_r,
                                                       dt2, d => d.EDIT_DATE);

            if (DR_Person_r == null)
            {
                error_list.AddError(error_source, "Norādītajam periodam nav ievadīti darbinieka dati.");
                return(error_list);
            }

            PersonR.DateFirst = dt1;
            PersonR.DateLast  = dt2;

            var drs_person_r = dr_person.GetPERSONS_RRows().OrderBy(d => d.EDIT_DATE).ToArray();

            //var rete = PersonR.ReadDateListFilter(drs_person_r, d => d.EDIT_DATE);
            var rete = PersonR.ReadDateListAll(drs_person_r, d => d.EDIT_DATE);

            if (rete != PeriodInfo.ERetReadStartEndList.OK || PersonR.LinkedPeriods[0].DateFirst > dt2)
            {
                error_list.AddError(error_source, "Norādītajam periodam nav ievadīti darbinieka dati.");
                return(error_list);
            }

            if (Events == null)
            {
                if (!GetEventList(error_list, idp))
                {
                    return(error_list);
                }
            }

            if (Row != null)
            {
                TotalPositionPay = new SalaryInfo();
                TotalPositionPay.SetFromRow(Row);
            }

            return(error_list);
        }
コード例 #5
0
        public ErrorList SetUp(int idp, int idam)
        {
            if (SalarySheet == null)
            {
                throw new Exception("Bad init.");
            }

            var table_sar         = MyData.DataSetKlons.SALARY_SHEETS;
            var table_sar_r       = MyData.DataSetKlons.SALARY_SHEETS_R;
            var table_darba_laiks = MyData.DataSetKlons.TIMESHEET;
            var table_sh          = MyData.DataSetKlons.SALARY_SHEET_TEMPL;
            var table_sh_r        = MyData.DataSetKlons.SALARY_SHEET_TEMPL_R;
            var table_persons     = MyData.DataSetKlons.PERSONS;
            var table_amati       = MyData.DataSetKlons.POSITIONS;
            var table_dl_sar_r    = MyData.DataSetKlons.TIMESHEET_LISTS_R;


            var    error_list = new ErrorList();
            string error_source;

            int yr  = SalarySheet.YR;
            int mt  = SalarySheet.MT;
            var dt1 = SalarySheet.MDT1;
            var dt2 = SalarySheet.MDT2;

            //var dv_dl_sar_r = new DataView(table_dl_sar_r);
            //dv_dl_sar_r.RowFilter = string.Format("Parent(FK_TIMESHEET_LISTS_R_IDS).YR = {0} AND Parent(FK_TIMESHEET_LISTS_R_IDS).MT = {1}", yr, mt);

            var dr_person = table_persons.FindByID(idp);
            var dr_amats  = table_amati.FindByID(idam);

            if (dr_person == null)
            {
                error_list.AddError("Algas lapa", "Nav darbinieka");
                return(error_list);
            }

            if (dr_amats == null)
            {
                error_list.AddError("Algas lapa", "Nav amata");
                return(error_list);
            }

            if (DR_salary_sheet_r_templ == null)
            {
                error_source = string.Format("Darbinieks :{0} {1} ({2})",
                                             dr_person.FNAME,
                                             dr_person.LNAME,
                                             dr_amats.TITLE);
            }
            else
            {
                error_source = string.Format("Lapa:{0} rinda:{1}",
                                             DR_salary_sheet_r_templ.SALARY_SHEET_TEMPLRow.SNR,
                                             DR_salary_sheet_r_templ.SNR);
            }

            var drs_persons_r = dr_person.GetPERSONS_RRows().OrderBy(d => d.EDIT_DATE).ToArray();


            DR_Person_r = PeriodInfo.FindNearestBefore(drs_persons_r,
                                                       dt2, d => d.EDIT_DATE);

            if (DR_Person_r == null)
            {
                error_list.AddError(error_source, "Norādītajam periodam nav ievadīti darbinieka dati.");
                return(error_list);
            }

            PersonR.DateFirst = dt1;
            PersonR.DateLast  = dt2;

            var drs_person_r = dr_person.GetPERSONS_RRows().OrderBy(d => d.EDIT_DATE).ToArray();

            //var rete = PersonR.ReadDateListFilter(drs_person_r, d => d.EDIT_DATE);
            var rete = PersonR.ReadDateListAll(drs_person_r, d => d.EDIT_DATE);

            if (rete != PeriodInfo.ERetReadStartEndList.OK || PersonR.LinkedPeriods[0].DateFirst > dt2)
            {
                error_list.AddError(error_source, "Norādītajam periodam nav ievadīti darbinieka dati.");
                return(error_list);
            }


            PositionsR.DateFirst = dt1;
            PositionsR.DateLast  = dt2;

            var drs_amats_r = dr_amats.GetPOSITIONS_RRows().OrderBy(d => d.EDIT_DATE).ToArray();

            rete = PositionsR.ReadDateListFilter(drs_amats_r, d => d.EDIT_DATE);
            if (rete != PeriodInfo.ERetReadStartEndList.OK)
            {
                error_list.AddError(error_source, "Norādītajam periodam nav ievadīti amata dati.");
                return(error_list);
            }

            var drs_dl_sar_r = dr_person.GetTIMESHEET_LISTS_RRows()
                               .WhereX(
                d =>
                d.TIMESHEET_LISTSRow.YR == yr &&
                d.TIMESHEET_LISTSRow.MT == mt &&
                d.IDAM == dr_amats.ID)
                               .ToArray();

            if (drs_dl_sar_r.Length == 0)
            {
                error_list.AddError(error_source, "Norādītajam periodam nav darba laika uzskaites datu.");
                return(error_list);
            }

            if (drs_dl_sar_r.Length > 1)
            {
                error_list.AddError(error_source, "Darba laika uzskaites datu rindu skaits > 1.");
                return(error_list);
            }

            var dr_dl_sar_r = drs_dl_sar_r[0];

            var dlrowset = dr_dl_sar_r.GetDLRowSet();

            DLRows = dlrowset;
            SetDLRows(dlrowset);

            if (DLRows == null || DLRows.Plan == null || DLRows.Fact == null ||
                (dr_dl_sar_r.NIGHT == 1 && (DLRows.PlanNight == null || DLRows.FactNight == null)) ||
                (dr_dl_sar_r.OVERTIME == 1 && DLRows.FactOvertime == null))
            {
                error_list.AddError(error_source, "Nekorekti darba laika uzskaites dati.");
                return(error_list);
            }

            if (Events == null)
            {
                if (!GetEventList(error_list, idp))
                {
                    return(error_list);
                }
            }

            if (IsRateTypeChangedDuringVacation(drs_amats_r))
            {
                error_list.AddError(error_source, "Atvaļinājuma laikā nevar mainīt algas likmes veidu.");
            }

            var err1 = CheckVacationTimePlan(idam);

            if (err1 != "OK")
            {
                error_list.AddError(error_source, err1);
                return(error_list);
            }

            if (Row != null)
            {
                TotalPositionPay = new SalaryInfo();
                TotalPositionPay.SetFromRow(Row);
            }

            return(error_list);
        }