Exemple #1
0
        public static List <SalaryRepRow2> MakeReport2(SalarySheetInfo sh)
        {
            var ret = new List <SalaryRepRow2>();
            var drs = sh.DR_algas_lapa.KIND == 1 ?
                      sh.DR_algas_lapa.GetSALARY_SHEETS_RRowsByFK_SALARY_SHEETS_R_IDST().OrderBy(d => d.SNR) :
                      sh.DR_algas_lapa.GetSALARY_SHEETS_RRowsByFK_SALARY_SHEETS_R_IDS().OrderBy(d => d.SNR);
            var drsa = drs.ToArray();

            for (int i = 0; i < drsa.Length; i++)
            {
                var dr = drsa[i];
                var si = new SalaryInfo();
                si.SetFromRow(dr);
                var reprow = new SalaryRepRow2();
                reprow.SetFrom(si);
                reprow.SNR = i + 1;
                ret.Add(reprow);
            }
            return(ret);
        }
Exemple #2
0
        public static List <SalaryRepRow2> MakeAggregatedReport(DateTime dt1, DateTime dt2,
                                                                int?idp, int?idam, string iddep, EGroupBy groupby)
        {
            var ret = new List <SalaryRepRow2>();

            int retyrmt  = 0;
            int retidp   = 0;
            int retidam  = 0;
            int retiddep = 0;

            switch (groupby)
            {
            case EGroupBy.YearAndMonth:
                retyrmt = 1;
                break;

            case EGroupBy.Person:
                retidp = 1;
                break;

            case EGroupBy.PersonAndPosition:
                retidp  = 1;
                retidam = 1;
                break;

            case EGroupBy.Department:
                retiddep = 1;
                break;
            }

            KlonsARepDataSet.SP_REP_AGGREGATEDataTable table = null;
            var ad = new KlonsA.DataSets.KlonsARepDataSetTableAdapters.SP_REP_AGGREGATETableAdapter();

            if (retiddep == 1 || iddep != null)
            {
                table = ad.GetDataBy_SP_REP_AGGREGATE_02(dt1, dt2, iddep, retyrmt, retidp, retidam, retiddep);
            }
            else
            {
                table = ad.GetDataBy_SP_REP_AGGREGATE_01(dt1, dt2, idp, idam, retyrmt, retidp, retidam);
            }

            var drs = table.Rows;

            for (int i = 0; i < table.Rows.Count; i++)
            {
                var dr     = table[i];
                var reprow = new SalaryRepRow2();
                reprow.SetFrom(dr);
                reprow.SNR = i + 1;

                switch (groupby)
                {
                case EGroupBy.YearAndMonth:
                    reprow.Caption = $"{dr.YR} - {dr.MT:00}";
                    break;

                case EGroupBy.Person:
                    var dr_person = MyData.DataSetKlons.PERSONS.FindByID(dr.IDP);
                    reprow.Caption = dr_person.YNAME;
                    break;

                case EGroupBy.PersonAndPosition:
                    dr_person = MyData.DataSetKlons.PERSONS.FindByID(dr.IDP);
                    var dr_position = MyData.DataSetKlons.POSITIONS.FindByID(dr.IDAM);
                    reprow.Caption = $"{dr_person.YNAME}, {dr_position.TITLE}";
                    break;

                case EGroupBy.Department:
                    var dr_dep = MyData.DataSetKlons.DEPARTMENTS.FindByID(dr.IDDEP);
                    reprow.Caption = dr_dep.DESCR;
                    break;
                }

                ret.Add(reprow);
            }

            ret = ret.OrderBy(d => d.Caption).ToList();
            return(ret);
        }