Esempio n. 1
0
        public ErrorList CountTotalPlan(IWorkTimeData wt, DateTime dt1, DateTime dt2)
        {
            var        error_list = new ErrorList();
            string     errstr = string.Format("{0}.{1}", dt1.Year, dt1.Month);
            int        i, j;
            float      vp, vpn;
            int        i1          = dt1.Day;
            int        i2          = dt2.Day;
            EDayPlanId daycodeplan = EDayPlanId.None;
            EDayFactId daycodefact = EDayFactId.None;

            for (i = i1; i <= i2; i++)
            {
                bool plandayadded     = false;
                bool planworkdayadded = false;

                for (j = 0; j < this.Count; j++)
                {
                    var dlset = this[j];

                    daycodeplan = dlset.Plan.DxPlan[i - 1];
                    daycodefact = dlset.Fact.DxFact[i - 1];

                    if (daycodeplan == EDayPlanId.None)
                    {
                        continue;
                    }
                    if (daycodefact == EDayFactId.None || daycodefact == EDayFactId.X)
                    {
                        continue;
                    }

                    vp  = dlset.Plan.Vx[i - 1];
                    vpn = dlset.PlanNight == null ? 0.0f : dlset.PlanNight.Vx[i - 1];

                    if (vp + vpn == 0.0f)
                    {
                        continue;
                    }

                    if (!plandayadded)
                    {
                        wt._PLAN_DAYS++;
                    }
                    wt._PLAN_HOURS       += vp;
                    wt._PLAN_HOURS_NIGHT += vpn;

                    if (SomeDataDefs.IsPlanWorkday(daycodeplan) &&
                        (SomeDataDefs.IsDayForWork(daycodefact) || daycodefact == EDayFactId.B))
                    {
                        if (!planworkdayadded)
                        {
                            wt._PLAN_WORK_DAYS++;
                        }
                        wt._PLAN_WORK_HOURS       += vp;
                        wt._PLAN_WORK_HOURS_NIGHT += vpn;
                        planworkdayadded           = true;
                    }

                    if (daycodeplan == EDayPlanId.DDSD)
                    {
                        if (!plandayadded)
                        {
                            wt._PLAN_HOLIDAYS_DAYS++;
                        }
                        wt._PLAN_HOLIDAYS_HOURS       += vp;
                        wt._PLAN_HOLIDAYS_HOURS_NIGHT += vpn;
                    }

                    plandayadded = true;
                }
            }

            return(error_list);
        }
Esempio n. 2
0
        public ErrorList CountTotalFact(IWorkTimeData wt, DateTime dt1, DateTime dt2)
        {
            var        error_list = new ErrorList();
            string     errstr = string.Format("{0}.{1}", dt1.Year, dt1.Month);
            int        i, j;
            float      v, vn, vo, vp;
            int        i1          = dt1.Day;
            int        i2          = dt2.Day;
            EDayPlanId daycodeplan = EDayPlanId.None;
            EDayFactId daycodefact = EDayFactId.None;

            for (i = i1; i <= i2; i++)
            {
                bool factdayadded = false;

                for (j = 0; j < this.Count; j++)
                {
                    var dlset = this[j];

                    daycodeplan = dlset.Plan.DxPlan[i - 1];
                    daycodefact = dlset.Fact.DxFact[i - 1];

                    if (daycodeplan == EDayPlanId.None)
                    {
                        continue;
                    }
                    if (daycodefact == EDayFactId.X || daycodefact == EDayFactId.None)
                    {
                        continue;
                    }

                    bool isFactHolidayWithBonus = daycodefact == EDayFactId.DS ||
                                                  daycodefact == EDayFactId.KS;
                    bool isAvPayFreeDay = daycodefact == EDayFactId.S ||
                                          daycodefact == EDayFactId.V || daycodefact == EDayFactId.AM;
                    //bool isAvPayWorkDay = daycodefact == EDayFactId.K;
                    bool isAvPayWorkDay = false;
                    bool IsFactWorkDay  = SomeDataDefs.IsDayForWork(daycodefact);


                    v  = dlset.Fact.Vx[i - 1];
                    vn = dlset.FactNight == null ? 0.0f : dlset.FactNight.Vx[i - 1];
                    vo = dlset.FactOvertime == null ? 0.0f : dlset.FactOvertime.Vx[i - 1];
                    vp = dlset.Plan.Vx[i - 1];

                    if (v + vp == 0)
                    {
                        continue;
                    }

                    if (isAvPayFreeDay)
                    {
                        if (vp == 0.0f)
                        {
                            continue;
                        }
                        if (!factdayadded)
                        {
                            wt._FACT_AVPAY_FREE_DAYS++;
                        }
                        wt._FACT_AVPAY_FREE_HOURS += vp;
                        wt._FACT_HOURS            += vp;

                        if (!factdayadded)
                        {
                            wt._FACT_DAYS++;
                        }

                        factdayadded = true;
                        continue;
                    }

                    if (!IsFactWorkDay)
                    {
                        continue;
                    }
                    if (v == 0)
                    {
                        continue;
                    }

                    wt._FACT_HOURS          += v;
                    wt._FACT_HOURS_NIGHT    += vn;
                    wt._FACT_HOURS_OVERTIME += vo;

                    if (isAvPayWorkDay)
                    {
                        if (!factdayadded)
                        {
                            wt._FACT_AVPAY_WORK_DAYS++;
                        }
                        wt._FACT_AVPAY_HOURS          += v;
                        wt._FACT_AVPAY_HOURS_OVERTIME += vo;

                        if (isFactHolidayWithBonus)
                        {
                            if (!factdayadded)
                            {
                                wt._FACT_AVPAY_WORKINHOLIDAYS++;
                            }
                            wt._FACT_AVPAY_HOLIDAYS_HOURS       += v;
                            wt._FACT_AVPAY_HOLIDAYS_HOURS_OVERT += vo;
                        }

                        if (!factdayadded)
                        {
                            wt._FACT_DAYS++;
                        }
                        factdayadded = true;
                        continue;
                    }

                    if (!factdayadded)
                    {
                        wt._FACT_WORK_DAYS++;
                    }
                    wt._FACT_WORK_HOURS          += v;
                    wt._FACT_WORK_HOURS_NIGHT    += vn;
                    wt._FACT_WORK_HOURS_OVERTIME += vo;

                    if (isFactHolidayWithBonus)
                    {
                        if (!factdayadded)
                        {
                            wt._FACT_HOLIDAYS_DAYS++;
                        }
                        wt._FACT_HOLIDAYS_HOURS          += v;
                        wt._FACT_HOLIDAYS_HOURS_NIGHT    += vn;
                        wt._FACT_HOLIDAYS_HOURS_OVERTIME += vo;
                    }

                    if (!factdayadded)
                    {
                        wt._FACT_DAYS++;
                    }
                    factdayadded = true;
                }
            }

            return(error_list);
        }