コード例 #1
0
        /// <summary>
        /// تبدیل به غیبت روزانه
        /// </summary>
        /// <param name="MyRule"></param>
        public override void R5009(AssignedRule MyRule)
        {
            this.DoConcept(1501);//نیم روز
            base.R5009(MyRule);
            return;

            //base.R5009(MyRule);

            //غيبت ساعتي مجاز 3020
            //3028 غيبت ساعتي غيرمجاز
            //3004 غيبت روزانه

            //کارکردخالص ساعتي 2
            //4 کارکردخالص روزانه
            //13 کارکردناخالص ساعتی
            //اضافه کار ساعتي 4002

            //1003 مرخصي استحقاقي ساعتي
            //1056 مرخصی بی حقوق ساعتی 12
            //2002 ماموريت خالص ساعتي


            GetLog(MyRule, DebugRuleState.Before, 2, 4, 3020, 3028, 3029, 3030, 3031, 13, 4002, 3004, 1002, 2002, 1109);

            this.DoConcept(1002);
            this.DoConcept(1109);
            this.DoConcept(2002);
            if (this.DoConcept(3028).Value >= MyRule["First", this.RuleCalculateDate].ToInt())
            {
                if (this.DoConcept(3048).Value == 0)
                {
                    this.DoConcept(3004).Value = 1;

                    this.DoConcept(3020).Value = 0;
                    //this.DoConcept(3028).Value = 0;
                    ((PairableScndCnpValue)this.DoConcept(3028)).ClearPairs();
                    ((PairableScndCnpValue)this.DoConcept(3029)).ClearPairs();
                    ((PairableScndCnpValue)this.DoConcept(3030)).ClearPairs();
                    ((PairableScndCnpValue)this.DoConcept(3031)).ClearPairs();
                }
                else
                {
                    this.DoConcept(3004).Value = ((int)((float)this.DoConcept(3028).Value / (float)this.DoConcept(7).Value));
                    int remainAbsence = ((int)((float)this.DoConcept(3028).Value % (float)this.DoConcept(7).Value));
                    int karkerd       = this.DoConcept(6).Value - this.DoConcept(3028).Value;

                    this.DoConcept(3020).Value = 0;


                    ((PairableScndCnpValue)this.DoConcept(3028)).ClearPairs();
                    ((PairableScndCnpValue)this.DoConcept(3029)).ClearPairs();
                    ((PairableScndCnpValue)this.DoConcept(3030)).ClearPairs();
                    ((PairableScndCnpValue)this.DoConcept(3031)).ClearPairs();
                    if (remainAbsence > 0)
                    {
                        ((PairableScndCnpValue)this.DoConcept(3028)).IncreaseValue(remainAbsence);
                    }
                    if (karkerd > 0)
                    {
                        this.DoConcept(4).Value  = ((int)((float)karkerd / (float)this.DoConcept(7).Value));
                        this.DoConcept(2).Value  = karkerd;
                        this.DoConcept(13).Value = karkerd;
                    }
                }

                if (MyRule.HasParameter("Second", this.RuleCalculateDate))
                {
                    if (MyRule["Second", this.RuleCalculateDate].ToInt() == 1)
                    {
                        ((PairableScndCnpValue)this.DoConcept(4002)).AppendPairs(((PairableScndCnpValue)this.DoConcept(2)).Pairs);
                    }
                }
                else
                {
                    ((PairableScndCnpValue)this.DoConcept(4002)).AppendPairs(((PairableScndCnpValue)this.DoConcept(2)).Pairs);
                }
            }
            GetLog(MyRule, DebugRuleState.After, 2, 4, 3020, 3028, , 3029, 3030, 3031, 13, 4002, 3004, 1002, 2002, 1109);
        }
コード例 #2
0
ファイル: RuleCalculator.cs プロジェクト: ImanRezaeipour/GTS
        /// <summary>قانون مرخصي 14-2</summary>
        /// <remarks>شناسه اين قانون در تعاريف بعدي هشتاد-80 درنظر گرفته شده است</remarks>
        public override void R3008(AssignedRule MyRule)
        {
            //13 کارکردناخالص
            //1005 مفهوم مرخصي استحقاقي روزانه
            //1003 مفهوم مرخصي استحقاقي ساعتي
            //110 مفهوم مرخصي بايد به کارکرد خالص اضافه شود
            //1001 مرخصي درروز

            //مرخصی ساعتی با حقوق-دادگاه 1025
            //مرخصی ساعتی با حقوق 1027

            //مرخصی با حقوق روزانه_فوت بستگان 1029
            //مرخصی با حقوق روزانه_جبرانی ماموریت 1031
            //مرخصی با حقوق روزانه_زایمان 1033
            //مرخصی با حقوق روزانه 1035
            //مرخصی با حقوق روزانه-دادگاه ورزشی 1037
            //1010  مرخصی استعلاجی روزانه
            //1090 مفهوم مجموع انواع مرخصی روزانه
            //1008مرخصی استعلاجی ساعتی

            if (MyRule.HasParameter("First", this.RuleCalculateDate))
            {
                if (MyRule["First", this.RuleCalculateDate].ToInt() == 1)
                {
                    GetLog(MyRule, DebugRuleState.Before, 2, 4, 13);
                    if (!EngEnvironment.HasCalendar(this.RuleCalculateDate, "1", "2", "4") ||
                        this.Person.GetShiftByDate(this.RuleCalculateDate).Pairs.Count > 0)
                    {
                        // پرسنل شیفتی ،روزی که مرخصی رفتن به اندازه کارکرد خالص به کارکرد ناخالص اضافه شود

                        if (this.DoConcept(1090).Value >= 1)
                        {
                            this.DoConcept(13).Value += this.DoConcept(1090).Value *this.DoConcept(2).Value;
                        }

                        //به دلیل اینکه در اضافه کار مرخصی های خارج از شیفت
                        //لحاظ شده است و در تعریف کارکردناخالص به آن اضافه گشته
                        //در این جا اشتراک مرخصی و شیفت را به کارکردناخالص اضافه میکنیم

                        int value = 0;
                        value += Operation.Intersect(this.Person.GetShiftByDate(this.RuleCalculateDate), this.DoConcept(1003)).Value;
                        value += Operation.Intersect(this.Person.GetShiftByDate(this.RuleCalculateDate), this.DoConcept(1008)).Value;
                        value += Operation.Intersect(this.Person.GetShiftByDate(this.RuleCalculateDate), this.DoConcept(1038)).Value;
                        value += Operation.Intersect(this.Person.GetShiftByDate(this.RuleCalculateDate), this.DoConcept(1025)).Value;
                        value += Operation.Intersect(this.Person.GetShiftByDate(this.RuleCalculateDate), this.DoConcept(1027)).Value;
                        value += Operation.Intersect(this.Person.GetShiftByDate(this.RuleCalculateDate), this.DoConcept(1008)).Value;

                        //this.DoConcept(13).Value += value;
                    }
                    else //مرخصی به کارکرد خالص اضافه شده و حالا کافی است کارکرد ناخالص دوباره محاسبه شود
                    {
                        this.DoConcept(13).Value = this.DoConcept(2).Value + this.DoConcept(4002).Value;
                    }
                    if (this.DoConcept(1090).Value >= 1 && this.DoConcept(4).Value == 0)
                    {
                        this.DoConcept(4).Value = 1;//مانا آرد
                    }
                }

                else if (MyRule["First", this.RuleCalculateDate].ToInt() > 0)
                {
                    if ((!EngEnvironment.HasCalendar(this.RuleCalculateDate, "1", "2", "4") ||
                         this.Person.GetShiftByDate(this.RuleCalculateDate).Pairs.Count > 0) && this.DoConcept(1090).Value > 0)
                    {
                        this.DoConcept(2).Value  = MyRule["First", this.RuleCalculateDate].ToInt();
                        this.DoConcept(13).Value = this.DoConcept(2).Value;
                    }
                }

                GetLog(MyRule, DebugRuleState.Before, 2, 4, 13);
            }
        }
コード例 #3
0
ファイル: RuleCalculator.cs プロジェクト: ImanRezaeipour/GTS
        /// <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);
        }
コード例 #4
0
        /// <summary>
        /// اعمال کسر تقلیل برای برخی از پرسنل
        /// </summary>
        /// <param name="MyRule"></param>
        public override void R5021(AssignedRule MyRule)
        {
            //1082 مجموع انواع مرخصی ساعتی
            //2023 مفهوم مجموع ماموريت ساعتي
            var conceptList = new[] { 2, 3, 13, 3020, 3028, 3040, 4002, 4005, 4006, 4007, 1119 };

            GetLog(MyRule, DebugRuleState.Before, conceptList);

            this.DoConcept(1082);
            this.DoConcept(2023);
            var personParam = this.Person.PersonTASpec.GetParamValue(this.Person.ID, "kasre_shirdehi", this.RuleCalculateDate);

            if (
                this.Person.GetShiftByDate(this.RuleCalculateDate).Value > 0 &&
                this.DoConcept(1).Value > 0 &&
                // مفدار غیبت مجاز برای تقلیل
                this.Person.GetShiftByDate(this.RuleCalculateDate).Value > 0 &&
                this.DoConcept(1).Value > 0 &&
                personParam != null
                )
            {
                var minutes = Utility.ToInteger(personParam.Value);

                if (MyRule["Second", this.RuleCalculateDate].ToInt() == 1)
                {
                    #region اعمال روی غیبت
                    if (this.DoConcept(3028).Value > 0)
                    {
                        while (this.DoConcept(3028).Value > 0 && minutes > 0)
                        {
                            foreach (IPair pair in ((PairableScndCnpValue)this.DoConcept(3028)).Pairs.OrderBy(x => x.From))
                            {
                                if (pair.Value > minutes)
                                {
                                    IPair tempPair = new BasePair(pair.To - minutes, pair.To);

                                    this.DoConcept(3020).Value += tempPair.Value;

                                    var PairableScndCnpValue = Operation.Differance(this.DoConcept(3028), tempPair);

                                    ((PairableScndCnpValue)this.DoConcept(3028)).AddPairs(PairableScndCnpValue.Pairs);

                                    // غيبت ساعتي مجاز تقليل
                                    ((PairableScndCnpValue)this.DoConcept(3040)).AppendPair(tempPair);

                                    ((PairableScndCnpValue)this.DoConcept(2)).AppendPair(tempPair);

                                    pair.To -= minutes;

                                    minutes = 0;

                                    break;
                                }

                                if (pair.Value == minutes)
                                {
                                    this.DoConcept(3020).Value += pair.Value;

                                    minutes -= pair.Value;

                                    ((PairableScndCnpValue)this.DoConcept(3028)).RemovePair(pair);

                                    // غيبت ساعتي مجاز تقليل
                                    ((PairableScndCnpValue)this.DoConcept(3040)).AppendPair(pair);

                                    ((PairableScndCnpValue)this.DoConcept(2)).AppendPair(pair);

                                    pair.From = pair.To = 0;

                                    break;
                                }

                                if (pair.Value < minutes)
                                {
                                    this.DoConcept(3020).Value += pair.Value;

                                    minutes -= pair.Value;

                                    ((PairableScndCnpValue)this.DoConcept(3028)).RemovePair(pair);

                                    // غيبت ساعتي مجاز تقليل
                                    ((PairableScndCnpValue)this.DoConcept(3040)).AddPair(pair);

                                    ((PairableScndCnpValue)this.DoConcept(2)).AppendPair(pair);

                                    pair.From = pair.To = 0;
                                }
                            }
                        }
                    }
                    #endregion
                }

                if (MyRule["First", this.RuleCalculateDate].ToInt() == 1)
                {
                    #region اعمال روی اضافه کار
                    if (minutes > 0)
                    {
                        // اعمال روی اضافه کار
                        ((PairableScndCnpValue)this.DoConcept(4002)).IncreaseValueEx(minutes);

                        var basePair = new BasePair(
                            ((PairableScndCnpValue)this.DoConcept(4002)).Pairs.OrderBy(x => x.To).Last().To - minutes,
                            ((PairableScndCnpValue)this.DoConcept(4002)).Pairs.OrderBy(x => x.To).Last().To
                            );

                        // غيبت ساعتي مجاز تقليل
                        ((PairableScndCnpValue)this.DoConcept(3040)).AddPair(basePair);

                        this.ReCalculate(3, 13, 4005, 4006, 4007);
                    }
                    #endregion
                }


                if (MyRule.HasParameter("Third", this.RuleCalculateDate))
                {
                    if (MyRule["Third", this.RuleCalculateDate].ToInt() == 1)
                    {
                        #region اعمال روی مرخصی
                        if (minutes > 0)
                        {
                            // اعمال روی مرخصی
                            this.Person.AddBudgetLeave(this.RuleCalculateDate, minutes);

                            this.DoConcept(1119).Value = minutes;
                        }
                        #endregion
                    }
                }
            }
            GetLog(MyRule, DebugRuleState.After, conceptList);
        }