コード例 #1
0
        /// <summary>
        /// محدوده مجاز اضافه کار ماموریت برای پرسنل بدون شیفت
        /// </summary>
        /// <param name="MyRule"></param>
        public virtual void R6511(AssignedRule MyRule)
        {
            //اضافه کار خاص ساعتي 4001
            //4002 اضافه کار ساعتی
            //4003 اضافه کار ساعتی عیر مجاز
            Permit permit = Person.GetPermitByDate(ConceptCalculateDate, EngEnvironment.GetPrecard(Precards.OverTime));

            if (this.Person.GetShiftByDate(this.RuleCalculateDate).Value == 0 && this.RuleCalculateDate.DayOfWeek != DayOfWeek.Thursday && !EngEnvironment.HasCalendar(this.RuleCalculateDate, "1") && this.DoConcept(2004).Value > 0)
            {
                GetLog(MyRule, DebugRuleState.Before, 4003, 4002);
                var temp = Operation.Differance(Operation.Intersect(this.DoConcept(4002), this.DoConcept(2004)), new PairableScndCnpValuePair(MyRule["First", this.RuleCalculateDate].ToInt(), MyRule["Second", RuleCalculateDate].ToInt()));
                ((PairableScndCnpValue)this.DoConcept(4003)).AppendPairs(temp);


                ((PairableScndCnpValue)this.DoConcept(4002))
                .AddPairs(Operation.Differance(this.DoConcept(4002), temp));
            }

            else if (this.RuleCalculateDate.DayOfWeek == DayOfWeek.Thursday && this.DoConcept(2004).Value > 0)
            {
                var temp = Operation.Differance(Operation.Intersect(this.DoConcept(4002), this.DoConcept(2004)), new PairableScndCnpValuePair(MyRule["Third", this.RuleCalculateDate].ToInt(), MyRule["Forth", RuleCalculateDate].ToInt()));
                ((PairableScndCnpValue)this.DoConcept(4003)).AppendPairs(temp);


                ((PairableScndCnpValue)this.DoConcept(4002))
                .AddPairs(Operation.Differance(this.DoConcept(4002), temp));
            }
            else if (this.RuleCalculateDate.DayOfWeek != DayOfWeek.Thursday && EngEnvironment.HasCalendar(this.RuleCalculateDate, "1") && this.DoConcept(2004).Value > 0)
            {
                var temp = Operation.Intersect(this.DoConcept(4002), this.DoConcept(2004));
                ((PairableScndCnpValue)this.DoConcept(4003)).AppendPairs(temp);
                ((PairableScndCnpValue)DoConcept(4002)).ClearPairs();
            }
            GetLog(MyRule, DebugRuleState.After, 4003, 4002);
        }
コード例 #2
0
ファイル: RuleCalculator.cs プロジェクト: ImanRezaeipour/GTS
        /// <summary>
        /// اعمال تاخیر روز بعد از رست
        /// </summary>
        /// <param name="MyRule"></param>
        public void R3503(AssignedRule MyRule)
        {
            //1501 رست
            //3028 غیبت ساعنی
            //3004 غیبت روزانه
            //3029 تاخیر
            //3020 غیبت ساتی مجاز
            //3021 تاخیر ساعتی مجاز
            //3024 تاخیر مجاز ماهانه
            //3026 غیبت مجاز ماهانه
            //3032 تاخیر ماهانه
            //3034 غیبت ساعتی ماهانه
            // 3 کارکرد ناخالص ماهانه
            //5 کارکرد روزانه ماهانه
            GetLog(MyRule, DebugRuleState.Before, 2, 4, 1501, 3020, 3021, 3028, 3029, 13, 3020, 3028, 3, 5, 3024, 3026, 3032, 3034);
            if (this.DoConcept(1501).Value == 0 && this.DoConcept(3004).Value == 0 && this.DoConcept(3029).Value > 0 &&
                this.DoConcept(1501, this.RuleCalculateDate.AddDays(-1)).Value > 0 &&
                !EngEnvironment.HasCalendar(this.ConceptCalculateDate, "3"))
            {
                int   allowToTime = MyRule["first", this.RuleCalculateDate].ToInt();
                IPair alowPair    = new PairableScndCnpValuePair(this.Person.GetShiftByDate(this.RuleCalculateDate).PastedPairs.From, allowToTime);
                this.DoConcept(3021).Value = Operation.Intersect(alowPair, this.DoConcept(3029)).Value;
                ((PairableScndCnpValue)this.DoConcept(3029)).AddPairs(Operation.Differance(this.DoConcept(3029), alowPair));
                this.DoConcept(2).Value += this.DoConcept(3021).Value;
                this.DoConcept(4).Value  = 1;
                this.ReCalculate(13, 3020, 3028, 5, 3, 3024, 3026, 3032, 3034);
            }

            GetLog(MyRule, DebugRuleState.After, 2, 4, 1501, 3020, 3021, 3028, 3029, 13, 3020, 3028, 3, 5, 3024, 3026, 3032, 3034);
        }
コード例 #3
0
 /// <summary>مفهوم اضافه کارساعتی تعطیل_روز غیرکاری، تعطیل رسمی و غیررسمی</summary>
 /// <param name="Result"></param>
 public void C4501(BaseScndCnpValue Result, SecondaryConcept MyConcept)
 {
     if (EngEnvironment.HasCalendar(this.ConceptCalculateDate, "1", "2") ||
         this.Person.GetShiftByDate(this.ConceptCalculateDate).Value == 0)
     {
         ((PairableScndCnpValue)Result).AddPairs(((PairableScndCnpValue)this.DoConcept(4001)).Pairs);
     }
 }
コード例 #4
0
 /// <summary>مفهوم ماموریت روزانه تعطیل_روز غیرکاری، تعطیل رسمی و غیررسمی</summary>
 /// <param name="Result"></param>
 public void C2502(BaseScndCnpValue Result, SecondaryConcept MyConcept)
 {
     if (EngEnvironment.HasCalendar(this.ConceptCalculateDate, "1", "2") ||
         this.Person.GetShiftByDate(this.ConceptCalculateDate).Value == 0)
     {
         Result.Value = this.DoConcept(2003).Value;
     }
 }
コード例 #5
0
 /// <summary>ماموريت 3-1</summary>
 /// <remarks>شناسه اين قانون در تعاريف بعدي يکصدوبيست وسه-3034 درنظر گرفته شده است</remarks>
 /// ماموريت 3-1: ماموريت به کارکرد خالص اضافه شود
 public override void R123(AssignedRule MyRule)
 {
     //2023 مجموع ماموريت ساعتي
     //2005 مجموع ماموریت روزانه
     //2026 ماموریت خارج از کشور
     //کارکردخالص ساعتي 2
     //4 کارکردخالص روزانه
     //13 کارکرد ناخالص ساعتی
     //ماموريت خالص روزانه 2003
     //348 ماموریت به کارکردخالص اضافه شود
     //ماموريت درروز 2001
     //7 کارکرد در روز
     GetLog(MyRule, DebugRuleState.Before, 2, 4, 13, 4002);
     if (!EngEnvironment.HasCalendar(this.RuleCalculateDate, "1", "2"))
     {
         if (this.DoConcept(2005).Value == 1 || this.DoConcept(2026).Value == 1)
         {
             this.DoConcept(4).Value = 1;
             if (this.DoConcept(6).Value > 0)
             {
                 this.DoConcept(2).Value = this.DoConcept(6).Value;
             }
             //else //باید توسط قانون روز غیر کاری به کارکرد اضافه شود انجام گردد
             //{
             //    this.DoConcept(2).Value = this.DoConcept(7).Value;
             //}
             if (this.DoConcept(2).Value == 0)
             {
                 this.DoConcept(4).Value = 0;
             }
         }
         else
         {
             int value = 0;
             value = Operation.Intersect(this.Person.GetShiftByDate(this.RuleCalculateDate), this.DoConcept(2023)).Value;
             if (value > 0)
             {
                 if (this.Person.GetShiftByDate(this.RuleCalculateDate).ShiftType == ShiftTypesEnum.WORK)
                 {
                     this.DoConcept(2).Value += value;
                 }
                 else if (this.Person.GetShiftByDate(this.RuleCalculateDate).ShiftType == ShiftTypesEnum.OVERTIME)
                 {
                     ((PairableScndCnpValue)this.DoConcept(4002)).IncreaseValue(value);
                 }
             }
         }
         this.ReCalculate(13);
     }
     GetLog(MyRule, DebugRuleState.After, 2, 4, 13, 4002);
 }
コード例 #6
0
        /// <summary>
        /// اعمال ضریب کارکد در تعطیلات رسمی غیر از جمعه
        /// </summary>
        /// <param name="MyRule"></param>
        public virtual void R2503(AssignedRule MyRule)
        {
            GetLog(MyRule, DebugRuleState.Before, 13);

            if (EngEnvironment.HasCalendar(this.RuleCalculateDate, "1") && this.RuleCalculateDate.DayOfWeek != DayOfWeek.Friday)
            {
                float coEfficient = MyRule["first", this.RuleCalculateDate].ToInt() / 100f;
                float zarib       = (float)this.DoConcept(13).Value *coEfficient;

                this.DoConcept(13).Value = (int)zarib;
            }

            GetLog(MyRule, DebugRuleState.After, 13);
        }
コード例 #7
0
        /// <summary>
        /// به ازای هر تطیل رسمی به غیر از جمعه , ..... اضافه کار لحاظ گردد
        /// </summary>
        /// <param name="MyRule"></param>
        public override void R6034(AssignedRule MyRule)
        {
            GetLog(MyRule, DebugRuleState.Before, 13, 4002);
            int overwork = MyRule["first", this.RuleCalculateDate].ToInt();

            if (EngEnvironment.HasCalendar(this.RuleCalculateDate, "1") && this.RuleCalculateDate.DayOfWeek != DayOfWeek.Friday && this.RuleCalculateDate.DayOfWeek != DayOfWeek.Thursday)
            {
                ((PairableScndCnpValue)this.DoConcept(4002)).IncreaseValue(overwork);
                if (this.DoConcept(13).Value < 24 * 60 + overwork)
                {
                    this.DoConcept(13).Value += overwork;
                }
            }
            GetLog(MyRule, DebugRuleState.After, 13, 4002);
        }
コード例 #8
0
        /// <summary>
        /// به ازای هر روز تعطیل رسمی و غیر رسمی مقدار ----ساعت کسر کار اضافه شود
        /// </summary>
        /// <param name="MyRule"></param>
        public virtual void R5501(AssignedRule MyRule)
        {
            GetLog(MyRule, DebugRuleState.Before, 3028);

            if (MyRule["Second", this.RuleCalculateDate].ToInt() > 0 && this.DoConcept(1).Value > 0 && (EngEnvironment.HasCalendar(this.RuleCalculateDate, "1", "2")))
            {
                int OverTime = MyRule["First", this.RuleCalculateDate].ToInt();
                ((PairableScndCnpValue)this.DoConcept(3028)).IncreaseValue(OverTime);
            }
            else if ((EngEnvironment.HasCalendar(this.RuleCalculateDate, "1", "2") || this.Person.GetShiftByDate(this.RuleCalculateDate).Value == 0))
            {
                int OverTime = MyRule["First", this.RuleCalculateDate].ToInt();
                ((PairableScndCnpValue)this.DoConcept(3028)).IncreaseValue(OverTime);
            }

            GetLog(MyRule, DebugRuleState.After, 3028);
        }
コード例 #9
0
ファイル: RuleCalculator.cs プロジェクト: ImanRezaeipour/GTS
        /// <summary>
        /// اعمال اضافه کار ویژه در زمان حضور در تعطیلات خاص
        /// </summary>
        /// <param name="MyRule"></param>
        public void R6501(AssignedRule MyRule)
        {
            //4032 اضافه کار ویژه
            //4033 اضافه کار ویژه ماهانه
            if (EngEnvironment.HasCalendar(this.RuleCalculateDate, "3"))
            {
                if (this.DoConcept(1).Value > 0)
                {
                    GetLog(MyRule, " Before Execute State:", 4032);

                    this.DoConcept(4032).Value += this.DoConcept(13).Value;

                    GetLog(MyRule, " After Execute State:", 4032);
                }
                //this.DoConcept(3004).Value = 0;
            }
            this.DoConcept(4033);
        }
コード例 #10
0
        /// <summary>
        /// مجوز مرخصی کارگاهی
        /// </summary>
        /// <param name="Result"></param>
        /// <param name="MyConcept"></param>
        public virtual void C1501(BaseScndCnpValue Result, SecondaryConcept MyConcept)
        {
            Result.Value = 0;
            Permit permit = this.Person.GetPermitByDate(this.ConceptCalculateDate, EngEnvironment.GetPrecard(127));

            if (permit != null && permit.Value == 1)
            {
                if (!EngEnvironment.HasCalendar(this.ConceptCalculateDate, "3"))
                {
                    Result.Value = 1;
                }
                if (this.DoConcept(3028).Value > 0)
                {
                    ((PairableScndCnpValue)this.DoConcept(3028)).ClearPairs();
                }
                if (this.DoConcept(3004).Value > 0)
                {
                    this.DoConcept(3004).Value = 0;
                }
            }
        }
コード例 #11
0
        /// اعمال مرخصی استحقاقی در روزها تعطیل بین مرخصی استحقاقی
        /// </summary>
        /// <param name="MyRule"></param>
        public override void R3023(AssignedRule MyRule)
        {
            //1029 مفهوم مرخصي تشویقی
            //1035 مفهوم اعطام


            #region تشویقی
            GetLog(MyRule, DebugRuleState.Before, 4, 1029);
            if (this.DoConcept(1029).Value > 0 &&
                this.DoConcept(1029, this.RuleCalculateDate.AddDays(-1)).Value == 0)
            {
                bool x1 = Utility.ToBoolean(MyRule["Rasmi", this.RuleCalculateDate].ToInt());
                bool x2 = EngEnvironment.HasCalendar(this.RuleCalculateDate.AddDays(-1), "1") && this.Person.GetShiftByDate(this.RuleCalculateDate.AddDays(-1)).Value == 0;

                bool y1 = Utility.ToBoolean(MyRule["GheireRasmi", this.RuleCalculateDate].ToInt());
                bool y2 = EngEnvironment.HasCalendar(this.RuleCalculateDate.AddDays(-1), "2") && this.Person.GetShiftByDate(this.RuleCalculateDate.AddDays(-1)).Value == 0;

                bool z1 = Utility.ToBoolean(MyRule["GheireKari", this.RuleCalculateDate].ToInt());
                bool z2 = (this.Person.GetShiftByDate(this.RuleCalculateDate.AddDays(-1)).Value == 0 ? true : false) & !x2 & !y2;

                int beforeDays            = 0;
                int maxLoopcounter        = 5;
                IList <DateTime> dateList = new List <DateTime>();
                while (x2 | y2 | z2)
                {
                    beforeDays++;
                    maxLoopcounter--;
                    if (maxLoopcounter < 1)
                    {
                        break;
                    }
                    if (this.Person.EmploymentDate > this.RuleCalculateDate.AddDays(-beforeDays))
                    {
                        break;
                    }

                    x2 = EngEnvironment.HasCalendar(this.RuleCalculateDate.AddDays(-beforeDays), "1") && this.Person.GetShiftByDate(this.RuleCalculateDate.AddDays(-beforeDays)).Value == 0;

                    y2 = EngEnvironment.HasCalendar(this.RuleCalculateDate.AddDays(-beforeDays), "2") && this.Person.GetShiftByDate(this.RuleCalculateDate.AddDays(-beforeDays)).Value == 0;

                    z2 = this.Person.GetShiftByDate(this.RuleCalculateDate.AddDays(-beforeDays)).Value == 0 ? true & !x2 & !y2 : false;

                    if ((x1 & x2) | (y1 & y2) | (z1 & z2))
                    {
                        dateList.Add(this.RuleCalculateDate.AddDays(-beforeDays));
                    }
                }
                if (this.DoConcept(1029, this.RuleCalculateDate.AddDays(-beforeDays)).Value > 0)
                {
                    foreach (DateTime calcDate in dateList)
                    {
                        this.DoConcept(1029, calcDate).Value = 1;
                        this.DoConcept(4, calcDate).Value    = 1;
                    }
                }
            }

            GetLog(MyRule, DebugRuleState.After, 4, 1029);

            #endregion

            #region اعزام
            GetLog(MyRule, DebugRuleState.Before, 4, 1035);
            if (this.DoConcept(1035).Value > 0 &&
                this.DoConcept(1035, this.RuleCalculateDate.AddDays(-1)).Value == 0)
            {
                bool x1 = Utility.ToBoolean(MyRule["Rasmi", this.RuleCalculateDate].ToInt());
                bool x2 = EngEnvironment.HasCalendar(this.RuleCalculateDate.AddDays(-1), "1") && this.Person.GetShiftByDate(this.RuleCalculateDate.AddDays(-1)).Value == 0;

                bool y1 = Utility.ToBoolean(MyRule["GheireRasmi", this.RuleCalculateDate].ToInt());
                bool y2 = EngEnvironment.HasCalendar(this.RuleCalculateDate.AddDays(-1), "2") && this.Person.GetShiftByDate(this.RuleCalculateDate.AddDays(-1)).Value == 0;

                bool z1 = Utility.ToBoolean(MyRule["GheireKari", this.RuleCalculateDate].ToInt());
                bool z2 = (this.Person.GetShiftByDate(this.RuleCalculateDate.AddDays(-1)).Value == 0 ? true : false) & !x2 & !y2;

                int beforeDays            = 0;
                int maxLoopcounter        = 5;
                IList <DateTime> dateList = new List <DateTime>();
                while (x2 | y2 | z2)
                {
                    beforeDays++;
                    maxLoopcounter--;
                    if (maxLoopcounter < 1)
                    {
                        break;
                    }
                    if (this.Person.EmploymentDate > this.RuleCalculateDate.AddDays(-beforeDays))
                    {
                        break;
                    }

                    x2 = EngEnvironment.HasCalendar(this.RuleCalculateDate.AddDays(-beforeDays), "1") && this.Person.GetShiftByDate(this.RuleCalculateDate.AddDays(-beforeDays)).Value == 0;

                    y2 = EngEnvironment.HasCalendar(this.RuleCalculateDate.AddDays(-beforeDays), "2") && this.Person.GetShiftByDate(this.RuleCalculateDate.AddDays(-beforeDays)).Value == 0;

                    z2 = this.Person.GetShiftByDate(this.RuleCalculateDate.AddDays(-beforeDays)).Value == 0 ? true & !x2 & !y2 : false;

                    if ((x1 & x2) | (y1 & y2) | (z1 & z2))
                    {
                        dateList.Add(this.RuleCalculateDate.AddDays(-beforeDays));
                    }
                }
                if (this.DoConcept(1035, this.RuleCalculateDate.AddDays(-beforeDays)).Value > 0)
                {
                    foreach (DateTime calcDate in dateList)
                    {
                        this.DoConcept(1035, calcDate).Value = 1;
                        this.DoConcept(4, calcDate).Value    = 1;
                    }
                }
            }

            GetLog(MyRule, DebugRuleState.After, 4, 1035);

            #endregion

            #region نوزاد
            GetLog(MyRule, DebugRuleState.Before, 4, 1037);
            if (this.DoConcept(1037).Value > 0 &&
                this.DoConcept(1037, this.RuleCalculateDate.AddDays(-1)).Value == 0)
            {
                bool x1 = Utility.ToBoolean(MyRule["Rasmi", this.RuleCalculateDate].ToInt());
                bool x2 = EngEnvironment.HasCalendar(this.RuleCalculateDate.AddDays(-1), "1") && this.Person.GetShiftByDate(this.RuleCalculateDate.AddDays(-1)).Value == 0;

                bool y1 = Utility.ToBoolean(MyRule["GheireRasmi", this.RuleCalculateDate].ToInt());
                bool y2 = EngEnvironment.HasCalendar(this.RuleCalculateDate.AddDays(-1), "2") && this.Person.GetShiftByDate(this.RuleCalculateDate.AddDays(-1)).Value == 0;

                bool z1 = Utility.ToBoolean(MyRule["GheireKari", this.RuleCalculateDate].ToInt());
                bool z2 = (this.Person.GetShiftByDate(this.RuleCalculateDate.AddDays(-1)).Value == 0 ? true : false) & !x2 & !y2;

                int beforeDays            = 0;
                int maxLoopcounter        = 5;
                IList <DateTime> dateList = new List <DateTime>();
                while (x2 | y2 | z2)
                {
                    beforeDays++;
                    maxLoopcounter--;
                    if (maxLoopcounter < 1)
                    {
                        break;
                    }
                    if (this.Person.EmploymentDate > this.RuleCalculateDate.AddDays(-beforeDays))
                    {
                        break;
                    }

                    x2 = EngEnvironment.HasCalendar(this.RuleCalculateDate.AddDays(-beforeDays), "1") && this.Person.GetShiftByDate(this.RuleCalculateDate.AddDays(-beforeDays)).Value == 0;

                    y2 = EngEnvironment.HasCalendar(this.RuleCalculateDate.AddDays(-beforeDays), "2") && this.Person.GetShiftByDate(this.RuleCalculateDate.AddDays(-beforeDays)).Value == 0;

                    z2 = this.Person.GetShiftByDate(this.RuleCalculateDate.AddDays(-beforeDays)).Value == 0 ? true & !x2 & !y2 : false;

                    if ((x1 & x2) | (y1 & y2) | (z1 & z2))
                    {
                        dateList.Add(this.RuleCalculateDate.AddDays(-beforeDays));
                    }
                }
                if (this.DoConcept(1037, this.RuleCalculateDate.AddDays(-beforeDays)).Value > 0)
                {
                    foreach (DateTime calcDate in dateList)
                    {
                        this.DoConcept(1037, calcDate).Value = 1;
                        this.DoConcept(4, calcDate).Value    = 1;
                    }
                }
            }

            GetLog(MyRule, DebugRuleState.After, 4, 1037);

            #endregion
        }
コード例 #12
0
        /// <summary>
        /// اضافه کاردر روزهای تعطیل رسمی و غیر رسمی
        /// </summary>
        /// <param name="MyRule"></param>
        public virtual void R6504(AssignedRule MyRule)
        {
            // 1 حضور
            // 4002 اضافه کار مجاز
            GetLog(MyRule, DebugRuleState.Before, 4002);

            if (MyRule["Second", this.RuleCalculateDate].ToInt() > 0 && this.DoConcept(1).Value > 0 && ((EngEnvironment.HasCalendar(this.RuleCalculateDate, "1", "2") || this.Person.GetShiftByDate(this.RuleCalculateDate).Value == 0)))
            {
                int OverTime = MyRule["First", this.RuleCalculateDate].ToInt();
                ((PairableScndCnpValue)this.DoConcept(4002)).IncreaseValue(OverTime);
            }

            else if ((MyRule["Second", this.RuleCalculateDate].ToInt() == 0 && this.DoConcept(1).Value > 0 && EngEnvironment.HasCalendar(this.RuleCalculateDate, "1", "2") && this.Person.GetShiftByDate(this.RuleCalculateDate).Value == 0) || (MyRule["Second", this.RuleCalculateDate].ToInt() == 0 && this.DoConcept(1).Value > 0 && this.Person.GetShiftByDate(this.RuleCalculateDate).Value == 0))
            {
                int OverTime = MyRule["First", this.RuleCalculateDate].ToInt();
                ((PairableScndCnpValue)this.DoConcept(4002)).IncreaseValue(OverTime);
            }
            this.ReCalculate(13);
            GetLog(MyRule, DebugRuleState.After, 4002);
        }
コード例 #13
0
        public override void R4001(AssignedRule MyRule)
        {
            //2023 مجموع ماموريت ساعتي
            //4 کارکردخالص روزانه
            //13 کارکرد ناخالص ساعتی
            //ماموريت خالص روزانه 2003
            //ماموريت درروز 2001
            //4002 اضافه کار مجاز
            //4003 اضافه کار غیرمجاز

            GetLog(MyRule, DebugRuleState.Before, 13);

            #region کارکرد خالص
            GetLog(MyRule, " Before Execute State:", 2, 4, 13, 2001, 4002);
            if (MyRule["First", this.RuleCalculateDate].ToInt() == 1 &&
                !EngEnvironment.HasCalendar(this.RuleCalculateDate, "1", "2"))
            {
                if (this.DoConcept(2005).Value == 1 && MyRule["Third", this.RuleCalculateDate].ToInt() == 1)
                {
                    this.DoConcept(4).Value = 1;
                    if (this.DoConcept(6).Value > 0)
                    {
                        this.DoConcept(2).Value = this.DoConcept(6).Value;
                    }
                    if (this.DoConcept(2).Value == 0)
                    {
                        this.DoConcept(4).Value = 0;
                    }
                }
                else if (MyRule["Forth", this.RuleCalculateDate].ToInt() == 1)
                {
                    int value = 0;
                    value = Operation.Intersect(this.Person.GetShiftByDate(this.RuleCalculateDate), this.DoConcept(2023)).Value;
                    if (value > 0)
                    {
                        if (this.Person.GetShiftByDate(this.RuleCalculateDate).ShiftType == ShiftTypesEnum.WORK)
                        {
                            this.DoConcept(2).Value += value;
                        }
                        else if (this.Person.GetShiftByDate(this.RuleCalculateDate).ShiftType == ShiftTypesEnum.OVERTIME)
                        {
                            ((PairableScndCnpValue)this.DoConcept(4002)).IncreaseValue(value);
                        }
                    }
                }
                this.ReCalculate(13);
            }
            GetLog(MyRule, " After Execute State:", 2, 4, 13, 2001, 4002);
            #endregion

            //اگر قانون 123 استفاده نشده است انگاه این قانون اجرا شود
            //جمله بالا اشتباه است زیرا در قانون بالا فقط داخل شیفت محاسبه میشود
            if (MyRule["Second", this.RuleCalculateDate].ToInt() == 1 &&
                MyRule["First", this.RuleCalculateDate].ToInt() == 0)
            {
                if (this.DoConcept(2005).Value == 1 && MyRule["Third", this.RuleCalculateDate].ToInt() == 1)
                {
                    if (this.DoConcept(6).Value > 0)
                    {
                        this.DoConcept(13).Value += this.DoConcept(6).Value;
                    }
                    else
                    {
                        this.DoConcept(13).Value += this.DoConcept(7).Value;
                    }
                }
                else if (MyRule["Forth", this.RuleCalculateDate].ToInt() == 1)
                {
                    int value = 0;

                    value = this.DoConcept(2023).Value;

                    if (value > 0)
                    {
                        this.DoConcept(13).Value += value;
                    }
                }
            }
            else if (MyRule["Second", this.RuleCalculateDate].ToInt() == 1)
            {//داخل شبفت در 123 محاسبه شده است
                if (this.DoConcept(2005).Value == 0)
                {
                    int value = 0;
                    // خارج شیفت به شرطی که قبلا در اضافه کار محاسبه نشده باشد
                    PairableScndCnpValue pairableScndCnpValue1 = Operation.Differance(this.DoConcept(2023), this.Person.GetShiftByDate(this.RuleCalculateDate));
                    PairableScndCnpValue pairableScndCnpValue2 = Operation.Differance(pairableScndCnpValue1, this.DoConcept(4002));
                    value = Operation.Differance(pairableScndCnpValue2, this.DoConcept(4003)).Value;
                    if (value > 0)
                    {
                        this.DoConcept(13).Value += value;
                    }
                }
            }
            GetLog(MyRule, DebugRuleState.After, 13);
        }
コード例 #14
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);
            }
        }