Ejemplo n.º 1
0
        /// <summary>
        /// ماموریت آموزشی
        /// شامل اضافه کار نمیشود
        /// </summary>
        /// <param name="Result"></param>
        /// <param name="MyConcept"></param>
        public override void C2014(BaseScndCnpValue Result, SecondaryConcept MyConcept)
        {
            ((PairableScndCnpValue)Result).Pairs.Clear();
            PairableScndCnpValue validMission  = new PairableScndCnpValue();
            PairableScndCnpValue AbsentMission = new PairableScndCnpValue();
            Permit    permit = this.Person.GetPermitByDate(this.ConceptCalculateDate, EngEnvironment.GetPrecard(Precards.HourDuty2));
            BaseShift shift  = this.Person.GetShiftByDate(this.ConceptCalculateDate);

            if (shift != null && shift.PairCount > 0)
            {
                #region بررسی غیبت ها

                AbsentMission.AddPairs(Operation.Intersect(permit, this.DoConcept(3028)));

                ((PairableScndCnpValue)this.DoConcept(3028)).AddPairs(Operation.Differance(this.DoConcept(3028), AbsentMission));
                ((PairableScndCnpValue)this.DoConcept(3001)).AddPairs(Operation.Differance(this.DoConcept(3001), AbsentMission));
                ((PairableScndCnpValue)Result).AppendPairs(AbsentMission);

                #endregion
            }
            else//روز تعطیل
            {
                ((PairableScndCnpValue)Result).AppendPairs(permit.Pairs);
            }

            this.ReCalculate(this.ConceptCalculateDate, 3008, 3010, 3014, 3029, 3030, 3031);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// بی حقوق ساعتی - مرخصی قطعی لحاظ نگردد
        /// </summary>
        /// <param name="Result"></param>
        /// <param name="MyConcept"></param>
        public override void C1055(BaseScndCnpValue Result, SecondaryConcept MyConcept)
        {
            ((PairableScndCnpValue)Result).Pairs.Clear();
            PairableScndCnpValue validLeave  = new PairableScndCnpValue();
            PairableScndCnpValue AbsentLeave = new PairableScndCnpValue();
            Permit    permit = this.Person.GetPermitByDate(this.ConceptCalculateDate, EngEnvironment.GetPrecard(Precards.NoSallaryHourLeave1));
            BaseShift shift  = this.Person.GetShiftByDate(this.ConceptCalculateDate);

            if (shift != null && shift.PairCount > 0 && permit.Value > 0)
            {
                #region بررسی غیبت ها
                PairableScndCnpValue intersect = Operation.Intersect(permit, this.DoConcept(3028));
                if (intersect != null && intersect.Value > 0)//در این حالت به میزان عدم حضور لحاظ گردد
                {
                    AbsentLeave.AddPairs(intersect);
                }
                else
                {
                    AbsentLeave.AddPairs(permit.Pairs.ToList <IPair>());
                }
                if (AbsentLeave.Value > this.DoConcept(1501).Value)
                {
                    int usedValue = 0;
                    for (int i = 0; i < AbsentLeave.PairCount; i++)
                    {
                        int notAllow = (usedValue + AbsentLeave.Pairs[i].Value) - this.DoConcept(1501).Value;
                        notAllow = notAllow < 0 ? 0 : notAllow;
                        int allow = AbsentLeave.Pairs[i].Value - notAllow;
                        allow      = allow < 0 ? 0 : allow;
                        usedValue += allow;
                        if (notAllow > 0)
                        {
                            AbsentLeave.Pairs[i] = new PairableScndCnpValuePair(AbsentLeave.Pairs[i].From, AbsentLeave.Pairs[i].From + allow);
                        }
                    }
                }
                ((PairableScndCnpValue)this.DoConcept(3028)).AddPairs(Operation.Differance(this.DoConcept(3028), AbsentLeave));
                ((PairableScndCnpValue)this.DoConcept(3001)).AddPairs(Operation.Differance(this.DoConcept(3001), AbsentLeave));
                ((PairableScndCnpValue)Result).AppendPairs(AbsentLeave);

                #endregion

                this.ReCalculate(this.ConceptCalculateDate, 3008, 3010, 3014, 3029, 3030, 3031);
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// فرجه تاخیر و تعجیل
        /// </summary>
        /// <param name="MyRule"></param>
        public override void R5032(AssignedRule MyRule)
        {
            //3020 غیبت ساعتی مجاز
            //3029 تاخیر
            //3030 تعجیل
            //3028 غیبت ساعتی
            //3021 تاخیر مجاز
            //3022 تعجیل مجاز
            //3031 غیبت بین وقت ساعتی غیرمجاز
            //3024 تاخیر ساعتی مجاز ماهانه
            //3026 غیبت ساعتی مجاز ماهانه
            //3027 غیبت بین وقت ساعتی مجاز ماهانه
            //1082 مجموع انواع مرخصی ساعتی
            //2023 مفهوم مجموع ماموريت ساعتي

            var conceptList = new[] { 2, 3020, 3022, 3024, 3026, 3031, 3020, 3027, 3028, 3040, 3026 };

            GetLog(MyRule, " Before Execute State:", conceptList);

            this.DoConcept(1082);
            this.DoConcept(2023);
            this.DoConcept(1002);
            this.DoConcept(1109);

            int  forje              = 0;
            int  forjeSum           = MyRule["First", this.RuleCalculateDate].ToInt();
            int  forjeTakhir        = MyRule["Second", this.RuleCalculateDate].ToInt();
            int  forjeTajil         = MyRule["Third", this.RuleCalculateDate].ToInt();
            int  forjeBetween       = MyRule["Fourth", this.RuleCalculateDate].ToInt();
            int  forjeMounth        = MyRule["Fifth", this.RuleCalculateDate].ToInt();
            int  forjeMounthTakhir  = MyRule["Sixth", this.RuleCalculateDate].ToInt();
            int  forjeMounthTajil   = MyRule["Seventh", this.RuleCalculateDate].ToInt();
            int  forjeMounthBetween = MyRule["Eighth", this.RuleCalculateDate].ToInt();
            bool allDayAbsence      = MyRule["Ninth", this.RuleCalculateDate].ToInt() > 0;
            //bool allMonthAbsence = MyRule["Tenth", this.RuleCalculateDate].ToInt() > 0;
            bool notFillAllowAbsence = (MyRule.HasParameter("Eleventh", this.RuleCalculateDate) && MyRule["Eleventh", this.RuleCalculateDate].ToInt() > 0);


            int SumHourlyAbsent = this.DoConcept(3024).Value + this.DoConcept(3025).Value + this.DoConcept(3027).Value;

            if (
                this.Person.GetShiftByDate(this.RuleCalculateDate).Value > 0 &&
                this.DoConcept(1).Value > 0 &&
                (forjeSum > 0 || forjeTakhir > 0 || forjeTajil > 0 || forjeBetween > 0) &&
                this.DoConcept(3028).Value > 0
                )
            {
                PairableScndCnpValue takhir = (PairableScndCnpValue)this.DoConcept(3029);
                PairableScndCnpValue tajil  = (PairableScndCnpValue)this.DoConcept(3030);
                if (takhir == null)
                {
                    takhir = new PairableScndCnpValue();
                }
                if (tajil == null)
                {
                    tajil = new PairableScndCnpValue();
                }

                #region چک کردن حضور قبل و بعد تاخیر و تعجیل و سقف مقدار

                if (allDayAbsence)
                {
                    foreach (PairableScndCnpValuePair takhirPair in ((PairableScndCnpValue)this.DoConcept(3029)).Pairs)
                    {
                        if ((takhirPair.Value > forjeSum && forjeSum > 0) || (takhirPair.Value > forjeTakhir && forjeTakhir > 0 && forjeSum == 0))
                        {
                            takhir = Operation.Differance(takhir, takhirPair);
                        }
                    }

                    foreach (PairableScndCnpValuePair tajilPair in ((PairableScndCnpValue)this.DoConcept(3030)).Pairs)
                    {
                        if ((tajilPair.Value > forjeSum && forjeSum > 0) || (tajilPair.Value > forjeTajil && forjeTajil > 0 && forjeSum == 0))
                        {
                            tajil = Operation.Differance(tajil, tajilPair);
                        }
                    }
                }

                #endregion

                PairableScndCnpValue tempPairs = new PairableScndCnpValue();

                #region تاخیر مجاز
                if (forjeSum > 0)
                {
                    forje = forjeSum;
                }
                else if (forjeTakhir > 0)
                {
                    forje = forjeTakhir;
                }
                if (forje > 0 && takhir != null && takhir.Value > 0 && ((takhir.Value + tempPairs.Value + SumHourlyAbsent <= forjeMounth) && forjeMounth > 0 ||
                                                                        (((forje + tempPairs.Value + SumHourlyAbsent <= forjeMounth) && forjeMounth > 0)) ||
                                                                        ((forje + tempPairs.Value + this.DoConcept(3024).Value <= forjeMounthTakhir) && forjeMounth == 0 && forjeMounthTakhir > 0) ||
                                                                        ((takhir.Value + tempPairs.Value + this.DoConcept(3024).Value <= forjeMounthTakhir) && forjeMounth == 0 && forjeMounthTakhir > 0)))
                {
                    //  ((PairableScndCnpValue)tempPairs).AddPairs(takhir);
                    foreach (PairableScndCnpValuePair takhirPair in takhir.Pairs)
                    {
                        if (takhirPair.Value <= forje)
                        {
                            tempPairs.AppendPair(new BasePair(takhirPair.From, takhirPair.From + forje));
                            //forje = 0;
                        }
                        //else
                        //{
                        //    forje -= takhir.Value;
                        //}
                    }
                }
                #endregion


                #region تعجیل مجاز
                if (forjeSum == 0 && forjeTajil > 0)
                {
                    forje = forjeTajil;
                }

                if (forje > 0 && tajil != null && tajil.Value > 0 && ((tajil.Value + tempPairs.Value + SumHourlyAbsent <= forjeMounth) && forjeMounth > 0 ||
                                                                      (((forje + tempPairs.Value + SumHourlyAbsent <= forjeMounth) && forjeMounth > 0)) ||
                                                                      ((forje + tempPairs.Value + this.DoConcept(3025).Value <= forjeMounthTajil) && forjeMounth == 0 && forjeMounthTajil > 0) ||
                                                                      ((tajil.Value + tempPairs.Value + this.DoConcept(3025).Value <= forjeMounthTajil) && forjeMounth == 0 && forjeMounthTajil > 0)))
                {
                    foreach (PairableScndCnpValuePair tajilPair in tajil.Pairs)
                    {
                        // ((PairableScndCnpValue)tempPairs).AppendPair(tajilPair);

                        if (tajilPair.Value <= forje)
                        {
                            //  ((PairableScndCnpValue)tempPairs).AddPairs(Operation.Differance(tempPairs, tajil));
                            tempPairs.AppendPair(new BasePair(tajilPair.To - forje, tajilPair.To));
                            //forje = 0;
                        }
                        //else if (tajil.Value <= forje)
                        //{
                        //    forje -= tajil.Value;
                        //}
                    }
                }
                #endregion

                #region غیبت بین وقت
                if (Operation.Intersect(this.DoConcept(3031), this.DoConcept(3028)).Value > 0)
                {
                    PairableScndCnpValue Between = ((PairableScndCnpValue)this.DoConcept(3031));
                    Between.AddPairs(Operation.Differance(Between, tempPairs));
                    if (allDayAbsence && ((Between.Value > forjeSum && forjeSum > 0) || (Between.Value > forjeBetween && forjeBetween > 0 && forjeSum == 0)))
                    {
                        Between = new PairableScndCnpValue();
                    }
                    if (forjeSum == 0 && forjeBetween > 0)
                    {
                        forje = forjeBetween;
                    }
                    if (forje > 0 && Between != null && Between.Value > 0 && ((Between.Value + tempPairs.Value + SumHourlyAbsent <= forjeMounth) && forjeMounth > 0 ||
                                                                              (((forje + tempPairs.Value + SumHourlyAbsent <= forjeMounth) && forjeMounth > 0)) ||
                                                                              ((forje + tempPairs.Value + this.DoConcept(3027).Value <= forjeMounthBetween) && forjeMounth == 0 && forjeMounthBetween > 0) ||
                                                                              ((Between.Value + tempPairs.Value + this.DoConcept(3027).Value <= forjeMounthBetween) && forjeMounth == 0 && forjeMounthBetween > 0)))
                    {
                        foreach (PairableScndCnpValuePair pair in Between.Pairs.OrderBy(x => x.From))
                        {
                            PairableScndCnpValue tempBetween = new PairableScndCnpValue();
                            ((PairableScndCnpValue)tempBetween).AppendPair(pair);

                            if (tempBetween.Value <= forje && forje > 0)
                            {
                                tempPairs.AppendPair(pair);
                                forje -= tempBetween.Value;
                            }

                            else if (tempBetween.Value > forje && forje > 0)
                            {
                                tempPairs.AppendPair(new BasePair(pair.From, pair.From + forje));
                                forje = 0;
                            }
                        }
                        this.DoConcept(3023).Value = Operation.Intersect(this.DoConcept(3031), tempPairs).Value;

                        ((PairableScndCnpValue)this.DoConcept(3031)).DecreasePairFromFirst(this.DoConcept(3023).Value);

                        this.DoConcept(2).Value += this.DoConcept(3023).Value;
                        this.ReCalculate(13, 3020, 3028);
                    }
                }
                #endregion

                if (tempPairs != null && tempPairs.Value > 0)
                {
                    if (!notFillAllowAbsence)
                    {
                        this.DoConcept(3021).Value += Operation.Intersect(tempPairs, takhir).Value;
                        this.DoConcept(3022).Value += Operation.Intersect(tempPairs, tajil).Value;
                        this.DoConcept(3020).Value  = this.DoConcept(3021).Value + this.DoConcept(3022).Value + this.DoConcept(3023).Value;
                    }

                    ((PairableScndCnpValue)this.DoConcept(3028)).AddPairs(Operation.Differance(this.DoConcept(3028), tempPairs));
                    ((PairableScndCnpValue)this.DoConcept(3029)).AddPairs(Operation.Differance(this.DoConcept(3029), tempPairs));
                    ((PairableScndCnpValue)this.DoConcept(3030)).AddPairs(Operation.Differance(this.DoConcept(3030), tempPairs));
                    ((PairableScndCnpValue)this.DoConcept(3031)).AddPairs(Operation.Differance(this.DoConcept(3031), tempPairs));
                }
            }

            GetLog(MyRule, " After Execute State:", conceptList);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// مرخصی روزانه در صورتی اعمال شود که شخص زیر 4 ساعت حضور داشته باشد
        /// </summary>
        /// <param name="Result"></param>
        /// <param name="MyConcept"></param>
        //public override void C1004(BaseScndCnpValue Result, SecondaryConcept MyConcept)
        //{
        //    if (this.DoConcept(1).Value <= 4 * 60)
        //    {
        //        base.C1004(Result, MyConcept);
        //    }
        //}

        /// <summary>
        /// مرخصی استعلاجی روزانه
        /// </summary>
        /// <param name="Result"></param>
        /// <param name="MyConcept"></param>
        public override void C1009(BaseScndCnpValue Result, SecondaryConcept MyConcept)
        {
            Permit permit = this.Person.GetPermitByDate(this.ConceptCalculateDate, EngEnvironment.GetPrecard(Precards.DailyEstelagiLeave));

            if (permit != null && permit.Value == 1)
            {
                PairableScndCnpValue tmpResult  = new PairableScndCnpValue();
                PairableScndCnpValue LeaveShift = ((PairableScndCnpValue)this.DoConcept(1116));
                int hour = 0;
                if (LeaveShift.PairCount == 1 && LeaveShift.Pairs.First().To >= LeaveShift.Pairs.First().From)
                {
                    if (this.DoConcept(6).Value > 0)
                    {
                        if (this.DoConcept(6).Value < LeaveShift.Pairs.First().From)
                        {
                            tmpResult.AddPairs(this.Person.GetShiftByDate(this.ConceptCalculateDate).Pairs.ToList <IPair>());
                        }
                        else if (this.DoConcept(6).Value >= LeaveShift.Pairs.First().From&& this.DoConcept(6).Value <= LeaveShift.Pairs.First().To)
                        {
                            tmpResult.Value = 1;
                        }
                        else//greater
                        {
                            int dev1 = 0;
                            if (this.DoConcept(3028).Value > 0)
                            {
                                dev1 = this.DoConcept(3028).Value / LeaveShift.Pairs.First().To;
                                hour = this.DoConcept(3028).Value % LeaveShift.Pairs.First().To;
                            }
                            else
                            {
                                dev1 = this.DoConcept(6).Value / LeaveShift.Pairs.First().To;
                                hour = this.DoConcept(6).Value % LeaveShift.Pairs.First().To;
                            }

                            if (hour >= LeaveShift.Pairs.First().From)
                            {
                                dev1++;
                                hour = 0;
                            }
                            tmpResult.Value = (int)dev1;
                        }
                    }
                    else//استعلاجی در روز تعطیل هم لحاظ میگردد
                    {
                        tmpResult.Value = 1;
                    }
                }
                else
                {
                    float dev = 1;

                    if (this.DoConcept(1113).Value > 0)
                    {
                        if (this.DoConcept(7).Value > 0)
                        {
                            dev = (float)this.DoConcept(6).Value / (float)this.DoConcept(7).Value;
                        }
                    }
                    dev = dev < 1 ? 1 : dev;


                    tmpResult.Value = (int)dev;
                    if (Result.Value < dev)
                    {
                        hour = (int)dev - tmpResult.Value;
                    }
                }


                Result.Value = tmpResult.Value;
                if (Result.Value > 0)
                {
                    ((PairableScndCnpValue)this.DoConcept(3028)).ClearPairs();
                    ((PairableScndCnpValue)this.DoConcept(3029)).ClearPairs();
                    ((PairableScndCnpValue)this.DoConcept(3030)).ClearPairs();
                    ((PairableScndCnpValue)this.DoConcept(3031)).ClearPairs();
                }
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// •	در صورتی به شخص کارکرد روزانه داده میشود که شخص حداقل به میزان 7:30 حضور داشته باشد.
        //•	 در صورت حضور کمتر از 7:30 , میزان حضور اضافه کار لحاظ میگردد.
        //•	در صورت حضور بیش از 7:30 , علاوه بر اختصاص کارکرد روزانه , اضافه کار نیز به شخص تعلق میگیرد.
        //•	در صورت عدم حضور شخص در یک روز , به شخص غیبت روزانه تعلق میگیرد
        /// </summary>
        /// <param name="MyRule"></param>
        public virtual void R2501_old(AssignedRule MyRule)
        {
            GetLog(MyRule, DebugRuleState.Before, 4, 4002, 3028, 3004, 13);
            if (this.DoConcept(2005).Value == 0 && this.DoConcept(1090).Value == 0)
            {
                this.DoConcept(4).Value = 0;
            }
            PairableScndCnpValue tmpCnp      = new PairableScndCnpValue();
            PairableScndCnpValue orginTmpCnp = new PairableScndCnpValue();

            tmpCnp.AddPairs(this.DoConcept(1));
            tmpCnp.AppendPairs(this.DoConcept(1003));
            tmpCnp.AppendPairs(this.DoConcept(2023));

            ((PairableScndCnpValue)this.DoConcept(4002)).ClearPairs();

            int minHozour = MyRule["first", this.RuleCalculateDate].ToInt();
            int esterhat  = MyRule["second", this.RuleCalculateDate].ToInt();
            int in2Shift  = MyRule["third", this.RuleCalculateDate].ToInt();

            this.DoConcept(3012).Value = minHozour;//بعلت عدم تعریم مفهوم  از این استفاده میشود
            if (tmpCnp.Value > 0)
            {
                orginTmpCnp.AddPairs(tmpCnp);
                int start1 = MyRule["4th", this.RuleCalculateDate].ToInt(); //شروع محدوده غیر مجاز اضافه کار قبل وقت صبح
                int start2 = MyRule["5th", this.RuleCalculateDate].ToInt(); //شروع محدوده غیر مجاز اضافه کار بعد وقت صبح
                int end2   = MyRule["6th", this.RuleCalculateDate].ToInt(); //پایان محدوده غیر مجاز اضافه کار بعد وقت صبح
                int start3 = MyRule["7th", this.RuleCalculateDate].ToInt(); //شروع محدوده غیر مجاز اضافه کار قبل وقت عصر
                int end3   = MyRule["8th", this.RuleCalculateDate].ToInt(); //پایان محدوده غیر مجاز اضافه کار قبل وقت عصر
                int end4   = MyRule["9th", this.RuleCalculateDate].ToInt(); //پایان محدوده غیر مجاز اضافه کار بعد وقت عصر
                int start  = tmpCnp.Pairs.First().From;
                int end    = tmpCnp.Pairs.Last().To;
                PairableScndCnpValuePair notAllow         = new PairableScndCnpValuePair();
                PairableScndCnpValue     notAllowOverwork = new PairableScndCnpValue();

                if (start1 > 0 && end4 > 0)
                {
                    notAllow = new PairableScndCnpValuePair(start1, end4);
                    notAllowOverwork.AddPairs(Operation.Differance(tmpCnp, notAllow));
                    tmpCnp.AddPairs(Operation.Intersect(tmpCnp, notAllow));
                }
                if (end > 0 && start2 > 0 && end2 > 0 && end > start2 && end < end2)
                {
                    notAllow = new PairableScndCnpValuePair(start2, end2);
                    notAllowOverwork.AppendPairs(Operation.Intersect(tmpCnp, notAllow));
                    tmpCnp.AddPairs(Operation.Differance(tmpCnp, notAllow));
                }

                if (start > 0 && start3 > 0 && end3 > 0 && start > start3 && start < end3)
                {
                    notAllow = new PairableScndCnpValuePair(start3, end3);
                    notAllowOverwork.AppendPairs(Operation.Intersect(tmpCnp, notAllow));
                    tmpCnp.AddPairs(Operation.Differance(tmpCnp, notAllow));
                }

                ((PairableScndCnpValue)this.DoConcept(4003)).AddPairs(notAllowOverwork);
            }
            if (tmpCnp.Value > minHozour)
            {
                if (tmpCnp.Value >= in2Shift && in2Shift > 0)
                {
                    tmpCnp.DecreasePairFromFirst(esterhat * 2);
                }
                else
                {
                    tmpCnp.DecreasePairFromFirst(esterhat);
                }
            }
            if (tmpCnp.Value > 0)
            {
                this.DoConcept(13).Value = tmpCnp.Value;

                if (tmpCnp.Value >= this.DoConcept(7).Value)
                {
                    this.DoConcept(4).Value = 1;
                    tmpCnp.DecreasePairFromFirst(this.DoConcept(7).Value);
                    ((PairableScndCnpValue)this.DoConcept(4002)).AddPairs(tmpCnp);
                }
                else
                {
                    //اگر حداقل حضور که معمولا 3:30 است را داشته باشد , این مفهوم مقدار دهس میشود
                    if (tmpCnp.Value >= minHozour)
                    {
                        this.DoConcept(503).Value = 1;
                        ((PairableScndCnpValue)this.DoConcept(3028)).IncreaseValue(this.DoConcept(7).Value);// - tmpCnp.Value);
                        ((PairableScndCnpValue)this.DoConcept(4002)).AddPairs(tmpCnp);
                    }
                    else
                    {
                        ((PairableScndCnpValue)this.DoConcept(4002)).AddPairs(tmpCnp);
                        //   this.DoConcept(13).Value = this.DoConcept(4002).Value;
                    }
                }
            }
            else if (this.DoConcept(2005).Value == 0 && this.DoConcept(1090).Value == 0 && this.DoConcept(1091).Value == 0)
            {
                this.DoConcept(3004).Value = 1;
            }
            this.DoConcept(5022).FromPairs = "";
            GetLog(MyRule, DebugRuleState.After, 4, 4002, 3028, 3004, 13);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// •	در صورتی به شخص کارکرد روزانه داده میشود که شخص حداقل به میزان 7:30 حضور داشته باشد.
        //•	 در صورت حضور کمتر از 7:30 , میزان حضور اضافه کار لحاظ میگردد.
        //•	در صورت حضور بیش از 7:30 , علاوه بر اختصاص کارکرد روزانه , اضافه کار نیز به شخص تعلق میگیرد.
        //•	در صورت عدم حضور شخص در یک روز , به شخص غیبت روزانه تعلق میگیرد
        /// </summary>
        /// <param name="MyRule"></param>
        public virtual void R2501(AssignedRule MyRule)
        {
            GetLog(MyRule, DebugRuleState.Before, 4, 4002, 3028, 3004, 13);
            this.DoConcept(501).Value = 1;//روز محاسبه شده را نگه میدارد.بوسیله این متوجه میشویم که حداکثر تعداد روز محاسباتی در ماه چقدر است-همیشه نمیتوان به تعداد رینج ماهانه اکتفا کرد
            if (this.DoConcept(2005).Value == 0 && this.DoConcept(1090).Value == 0)
            {
                this.DoConcept(4).Value = 0;
            }
            PairableScndCnpValue tmpCnp      = new PairableScndCnpValue();
            PairableScndCnpValue orginTmpCnp = new PairableScndCnpValue();

            tmpCnp.AddPairs(this.DoConcept(1));
            tmpCnp.AppendPairs(this.DoConcept(1003));
            tmpCnp.AppendPairs(this.DoConcept(2023));

            ((PairableScndCnpValue)this.DoConcept(4002)).ClearPairs();

            int minHozour = MyRule["first", this.RuleCalculateDate].ToInt();
            int esterhat  = MyRule["second", this.RuleCalculateDate].ToInt();
            int in2Shift  = MyRule["third", this.RuleCalculateDate].ToInt();

            this.DoConcept(3012).Value = minHozour; //بعلت عدم تعریم مفهوم  از این استفاده میشود
            if (tmpCnp.Value > 0)                   //کم کردن کارکرد خارج از محدوده
            {
                orginTmpCnp.AddPairs(tmpCnp);
                int start1 = MyRule["4th", this.RuleCalculateDate].ToInt(); //شروع محدوده غیر مجاز اضافه کار قبل وقت صبح
                int start2 = MyRule["5th", this.RuleCalculateDate].ToInt(); //شروع محدوده غیر مجاز اضافه کار بعد وقت صبح
                int end2   = MyRule["6th", this.RuleCalculateDate].ToInt(); //پایان محدوده غیر مجاز اضافه کار بعد وقت صبح
                int start3 = MyRule["7th", this.RuleCalculateDate].ToInt(); //شروع محدوده غیر مجاز اضافه کار قبل وقت عصر
                int end3   = MyRule["8th", this.RuleCalculateDate].ToInt(); //پایان محدوده غیر مجاز اضافه کار قبل وقت عصر
                int end4   = MyRule["9th", this.RuleCalculateDate].ToInt(); //پایان محدوده غیر مجاز اضافه کار بعد وقت عصر
                int start  = tmpCnp.Pairs.First().From;
                int end    = tmpCnp.Pairs.Last().To;
                PairableScndCnpValuePair notAllow         = new PairableScndCnpValuePair();
                PairableScndCnpValue     notAllowOverwork = new PairableScndCnpValue();

                if (start1 > 0 && end4 > 0)
                {
                    notAllow = new PairableScndCnpValuePair(start1, end4);
                    notAllowOverwork.AddPairs(Operation.Differance(tmpCnp, notAllow));
                    tmpCnp.AddPairs(Operation.Intersect(tmpCnp, notAllow));
                }
                if (end > 0 && start2 > 0 && end2 > 0 && end > start2 && end < end2)
                {
                    notAllow = new PairableScndCnpValuePair(start2, end2);
                    notAllowOverwork.AppendPairs(Operation.Intersect(tmpCnp, notAllow));
                    tmpCnp.AddPairs(Operation.Differance(tmpCnp, notAllow));
                }

                if (start > 0 && start3 > 0 && end3 > 0 && start > start3 && start < end3)
                {
                    notAllow = new PairableScndCnpValuePair(start3, end3);
                    notAllowOverwork.AppendPairs(Operation.Intersect(tmpCnp, notAllow));
                    tmpCnp.AddPairs(Operation.Differance(tmpCnp, notAllow));
                }

                //((PairableScndCnpValue)this.DoConcept(4003)).AddPairs(notAllowOverwork);
            }
            if (tmpCnp.Value > 0)//کم کردن مدت استراحت
            {
                if (tmpCnp.Value >= in2Shift && in2Shift > 0)
                {
                    tmpCnp.DecreasePairFromFirst(esterhat * 2);
                }
                else
                {
                    tmpCnp.DecreasePairFromFirst(esterhat);
                }
            }
            if (tmpCnp.Value > 0)
            {
                this.DoConcept(13).Value = tmpCnp.Value;
            }
            else if (this.DoConcept(2005).Value == 0 && this.DoConcept(1090).Value == 0 && this.DoConcept(1091).Value == 0)
            {
                this.DoConcept(3004).Value = 1;
            }
            this.DoConcept(5022).FromPairs = "";
            GetLog(MyRule, DebugRuleState.After, 4, 4002, 3028, 3004, 13);
        }