コード例 #1
0
        /// <summary>
        /// تاخیر تبدیل شده به مرخصی ماهانه
        /// </summary>
        /// <param name="Result"></param>
        /// <param name="MyConcept"></param>
        ///

        public override void C1004(BaseScndCnpValue Result, SecondaryConcept MyConcept)
        {
            //طبق توافق صورت گرفته در اینجا تنها داشتن مجوز ملاک مقداردهی مرخصی استحقاقی روزانه است
            int leaveInDay = this.DoConcept(1001).Value > this.DoConcept(6).Value&& this.DoConcept(6).Value > 0
                                 ? this.DoConcept(6).Value
                                 : this.DoConcept(1001).Value;

            Permit permit = this.Person.GetPermitByDate(this.ConceptCalculateDate, EngEnvironment.GetPrecard(Precards.DailyEstehghaghiLeave));

            //طبق درخواست این سازمان در صورت حضور مرخصی روزانه داده نمیشود
            if (permit != null && permit.Value == 1 && this.DoConcept(1).Value == 0)
            {
                int   demandLeave = this.Person.GetRemainLeave(this.ConceptCalculateDate);
                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;

                if (this.Person.GetShiftByDate(this.ConceptCalculateDate).Value > 0 || this.DoConcept(1021).Value == 1)
                {
                    if (dev * leaveInDay > demandLeave && this.DoConcept(1098).Value == 0)
                    {
                        //تبدیل مرخصی استحقاقی به مرخصی بی حقوق در صورت عدم طلب
                        if (this.DoConcept(1014).Value == 1)
                        {
                            this.DoConcept(1066).Value = 1;
                        }
                    }
                    else
                    {
                        Result.Value = (int)dev;
                        if (Result.Value < dev)
                        {
                            float remain = dev - Result.Value;
                            ((PairableScndCnpValue)this.DoConcept(1002)).IncreaseValue((int)(remain * leaveInDay));
                            //((PairableScndCnpValue)this.DoConcept(3028)).DecreasePairFromFirst(this.DoConcept(1002).Value);
                            //((PairableScndCnpValue)this.DoConcept(3001)).DecreasePairFromFirst(this.DoConcept(1002).Value);
                            //this.ReCalculate(this.ConceptCalculateDate, 3008, 3010, 3014, 3029, 3030, 3031);
                        }
                        this.Person.AddUsedLeave(this.ConceptCalculateDate, (int)(dev * leaveInDay), permit);
                    }
                }
                //else
                //{
                //    //مرخصی قطعی در روزغیرکاری
                //    if (this.DoConcept(1021).Value == 1)
                //    {
                //        //حتی اگر طلب نداشته باشد باید منفی شود
                //        Result.Value = 1;
                //        this.Person.AddUsedLeave(this.ConceptCalculateDate, leaveInDay, permit);
                //    }
                //}
            }
        }
コード例 #2
0
        /// <summary>
        /// اعمال مجوز تاخیر مجاز بعد از ماموریت ساعت 23
        /// </summary>
        /// <param name="MyRule"></param>
        public void R4503(AssignedRule MyRule)
        {
            //3021 تاخیر مجاز
            //تاخیر ساعتي 3029
            //201 کد پیشکارت درخواست تاخیر مجاز ماموریت

            /*if (this.DoConcept(3029).Value > 0)
             * {
             *  PairableScndCnpValue late = ((PairableScndCnpValue)this.DoConcept(3029));
             *  Permit permit = this.Person.GetPermitByDate(this.RuleCalculateDate, EngEnvironment.GetPrecard(201));
             *  if (permit != null && (permit.Value > 0 || permit.PairCount > 0))
             *  {
             *      IPair pair = new ShiftPair();
             *      pair.From = this.Person.GetShiftByDate(this.RuleCalculateDate).Pairs.OrderBy(x => x.From).First().From;
             *      pair.To = pair.From + MyRule["First", this.RuleCalculateDate].ToInt();
             *      this.DoConcept(3021).Value = Operation.Intersect(pair, late).Value;
             *      ((PairableScndCnpValue)this.DoConcept(3029)).AddPairs(Operation.Differance(late, pair));
             *      this.ReCalculate(13, 3020, 3028);
             *  }
             * }*/

            Permit permit = this.Person.GetPermitByDate(this.RuleCalculateDate, EngEnvironment.GetPrecard(201));

            if (permit != null && (permit.Value > 0 || permit.PairCount > 0))
            {
                GetLog(MyRule, DebugRuleState.Before, 4002);
                IPair pair  = permit.Pairs.First();
                IPair mojaz = new ShiftPair(1, 6 * 60);
                PairableScndCnpValue overtime = Operation.Intersect(pair, mojaz);
                ((PairableScndCnpValue)this.DoConcept(4002)).AppendPairs(overtime);
                GetLog(MyRule, DebugRuleState.After, 4002);
            }
        }
コード例 #3
0
        /// <summary>
        /// اعمال اضافه کار پنجشنبه با کد 151
        /// درخواست اضافه کار عادی منجر به مجاز شدن میشود
        /// </summary>
        /// <param name="MyRule"></param>
        public virtual void R6501(AssignedRule MyRule)
        {
            var conceptList = new List <int>();

            conceptList.AddRange(new[] { 4002, 4003, 13, 6501 });
            GetLog(MyRule, DebugRuleState.Before, conceptList.Distinct().ToArray());

            if (this.RuleCalculateDate.DayOfWeek == DayOfWeek.Thursday)
            {
                Permit permit = this.Person.GetPermitByDate(this.RuleCalculateDate, EngEnvironment.GetPrecard(151));
                if (permit == null || permit.Value == 0)
                {
                    ((PairableScndCnpValue)this.DoConcept(4003)).AddPairs(Operation.Differance(this.DoConcept(4002), this.DoConcept(2023)));
                    ((PairableScndCnpValue)this.DoConcept(6501)).AddPairs(Operation.Differance(this.DoConcept(4002), this.DoConcept(2023)));
                    ((PairableScndCnpValue)this.DoConcept(4002)).AddPairs(Operation.Intersect(this.DoConcept(4002), this.DoConcept(2023)));
                    this.DoConcept(13).Value = this.DoConcept(4002).Value;
                    ((PairableScndCnpValue)this.DoConcept(6501)).AddPairs(this.DoConcept(4002));
                }
                else
                {
                    ((PairableScndCnpValue)this.DoConcept(4002)).AppendPairs(this.DoConcept(4003));
                    ((PairableScndCnpValue)this.DoConcept(4003)).ClearPairs();
                    this.DoConcept(13).Value = this.DoConcept(4002).Value;
                    ((PairableScndCnpValue)this.DoConcept(6501)).AddPairs(this.DoConcept(4002));
                }
            }
            GetLog(MyRule, DebugRuleState.After, conceptList.Distinct().ToArray());
        }
コード例 #4
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);
        }
コード例 #5
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);
        }
コード例 #6
0
        /// <summary>
        /// اعمال اضافه کار شبکاری با کد 152
        /// درخواست اضافه کار عادی منجر به مجاز شدن نمیشود
        /// </summary>
        /// <param name="MyRule"></param>
        public virtual void R6502(AssignedRule MyRule)
        {
            var conceptList = new List <int>();

            conceptList.AddRange(new[] { 4002, 4003, 13, 6503 });
            GetLog(MyRule, DebugRuleState.Before, conceptList.Distinct().ToArray());
            PairableScndCnpValuePair pair = new PairableScndCnpValuePair(MyRule["First", this.RuleCalculateDate].ToInt(), MyRule["Second", this.RuleCalculateDate].ToInt());

            Permit permit = this.Person.GetPermitByDate(this.RuleCalculateDate, EngEnvironment.GetPrecard(152));

            if (permit != null && permit.Value > 0 &&
                Operation.Intersect(this.DoConcept(4003), pair).Value > 0)
            {
                this.DoConcept(13).Value += Operation.Intersect(this.DoConcept(4003), pair).Value;

                ((PairableScndCnpValue)this.DoConcept(4002)).AppendPairs(Operation.Intersect(this.DoConcept(4003), pair));
                ((PairableScndCnpValue)this.DoConcept(6503)).AppendPairs(Operation.Intersect(this.DoConcept(4003), pair));
                ((PairableScndCnpValue)this.DoConcept(4003)).AddPairs(Operation.Differance(this.DoConcept(4003), pair));
            }

            /* else if ((permit != null || permit.Value > 0)
             *   && Operation.Intersect(this.DoConcept(4002), pair).Value > 0)
             * {
             *   this.DoConcept(13).Value -= Operation.Intersect(this.DoConcept(4002), pair).Value;
             *
             *   ((PairableScndCnpValue)this.DoConcept(4003)).AppendPairs(Operation.Intersect(this.DoConcept(4002), pair));
             *   ((PairableScndCnpValue)this.DoConcept(4002)).AddPairs(Operation.Differance(this.DoConcept(4002), pair));
             *
             * }*/

            GetLog(MyRule, DebugRuleState.After, conceptList.Distinct().ToArray());
        }
コード例 #7
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);
     }
 }
コード例 #8
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;
     }
 }
コード例 #9
0
        /// <summary>مفهوم مرخصي با حقوق خالص روزانه_151</summary>
        /// <param name="Result"></param>
        public virtual void C1504(BaseScndCnpValue Result, SecondaryConcept MyConcept)
        {
            Permit permit = this.Person.GetPermitByDate(this.ConceptCalculateDate, EngEnvironment.GetPrecard(151));

            //Result.Value = permit != null && permit.Value == 1 ? 1 : 0;
            if (this.Person.GetShiftByDate(this.ConceptCalculateDate).Value > 0
                ||
                this.DoConcept(1021).Value == 1)
            {
                Result.Value = permit != null && permit.Value == 1 ? 1 : 0;
            }
        }
コード例 #10
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);
 }
コード例 #11
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);
        }
コード例 #12
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);
        }
コード例 #13
0
        /// <summary>
        /// آف دکتر
        /// کسر از اضافه کار
        /// </summary>
        /// <param name="Result"></param>
        /// <param name="MyConcept"></param>
        public virtual void C1503(BaseScndCnpValue Result, SecondaryConcept MyConcept)
        {
            ((PairableScndCnpValue)Result).ClearPairs();

            Permit permit = this.Person.GetPermitByDate(this.ConceptCalculateDate, EngEnvironment.GetPrecard(154));

            if (permit.Value > 0)
            {
                ((PairableScndCnpValue)this.DoConcept(3028)).ClearPairs();
                ((PairableScndCnpValue)this.DoConcept(3029)).ClearPairs();
                ((PairableScndCnpValue)this.DoConcept(3030)).ClearPairs();
                ((PairableScndCnpValue)this.DoConcept(3031)).ClearPairs();
                this.DoConcept(3004).Value = 0;
                Result.Value = 1;
            }
        }
コード例 #14
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="Result"></param>
        /// <param name="MyConcept"></param>
        //public override void C1002(BaseScndCnpValue Result, SecondaryConcept MyConcept)
        //{
        //    ((PairableScndCnpValue)Result).ClearPairs();
        //    Permit permit = this.Person.GetPermitByDate(this.ConceptCalculateDate, EngEnvironment.GetPrecard(Precards.HourLeave1));
        //    PairableScndCnpValue permitPairs = new PairableScndCnpValue();
        //    int demandLeave = 0;
        //    int leavePieceCount = this.DoConcept(1092).Value;

        //    #region محاسبه مجوزهای داخل شیفتی که محدودیت های تعداد و مقدار برای آنها اعمال شده باشد

        //    BaseShift shift = this.Person.GetShiftByDate(this.ConceptCalculateDate);
        //    foreach (PermitPair permitPair in permit.Pairs)
        //    {
        //        PairableScndCnpValue pairsInShift = Operation.Intersect(permitPair, shift);

        //        permitPairs.AppendPair(permitPair);
        //        //if (this.DoConcept(1099).Value == 0)
        //        //{
        //        //    PermitInShift.AppendPairs(pairsInShift.Pairs);
        //        //}
        //        //else
        //        //{
        //        //    PermitInShift.AppendPair(permitPair);
        //        //}
        //    }

        //    #endregion

        //    #region بررسی مقدار طلب بمنظور تبدیل مجوز مرخصی به مرخصی

        //    demandLeave = this.Person.GetRemainLeave(this.ConceptCalculateDate);
        //    if (permitPairs.Value > 0 && (permitPairs.Value > demandLeave && this.DoConcept(1098).Value == 0))
        //    {
        //        PairableScndCnpValue removedPairs = permitPairs.DecreasePairFromLast(permitPairs.Value - demandLeave);
        //        //تبدیل مرخصی استحقاقی به مرخصی بی حقوق در صورت عدم طلب
        //        if (this.DoConcept(1014).Value == 1)
        //        {
        //            ((PairableScndCnpValue)this.DoConcept(3028)).AddPairs(Operation.Differance(this.DoConcept(3028), removedPairs));
        //            ((PairableScndCnpValue)this.DoConcept(3001)).AddPairs(Operation.Differance(this.DoConcept(3001), removedPairs));

        //            this.DoConcept(1056).Value += removedPairs.PairValues;
        //        }
        //    }

        //    #endregion

        //    if (permitPairs.Value > 0)
        //    {
        //        if (this.DoConcept(1099).Value == 0)
        //        {
        //            ((PairableScndCnpValue)Result).AppendPairs(Operation.Intersect(this.DoConcept(3028), permitPairs));
        //            this.Person.AddUsedLeave(this.ConceptCalculateDate,
        //                                     Operation.Intersect(this.DoConcept(3028), permitPairs).Value, permit);
        //        }
        //        else
        //        {
        //            ((PairableScndCnpValue)Result).AppendPairs(permitPairs);
        //            this.Person.AddUsedLeave(this.ConceptCalculateDate,
        //                                     Operation.Intersect(permitPairs, permitPairs).Value, permit);
        //        }
        //        ((PairableScndCnpValue)this.DoConcept(3028)).AddPairs(Operation.Differance(this.DoConcept(3028), permitPairs));
        //        ((PairableScndCnpValue)this.DoConcept(3001)).AddPairs(Operation.Differance(this.DoConcept(3001), permitPairs));
        //        this.DoConcept(1092).Value = leavePieceCount;

        //        this.ReCalculate(this.ConceptCalculateDate, 3008, 3010, 3014, 3029, 3030, 3031);
        //    }
        //}

        /// <summary>
        /// مرخصی روزانه با توجه به مفهوم مرخصی در روز
        /// </summary>
        /// <param name="Result"></param>
        /// <param name="MyConcept"></param>
        //public override void C1004(BaseScndCnpValue Result, SecondaryConcept MyConcept)
        //{
        //    int leaveInDay = this.DoConcept(1001).Value;

        //    Permit permit = this.Person.GetPermitByDate(this.ConceptCalculateDate, EngEnvironment.GetPrecard(Precards.DailyEstehghaghiLeave));
        //    if (permit != null && permit.Value == 1)
        //    {
        //        if (this.Person.GetShiftByDate(this.ConceptCalculateDate).Value > 0)
        //        {
        //            int demandLeave = this.Person.GetRemainLeave(this.ConceptCalculateDate);
        //            if (leaveInDay > demandLeave && this.DoConcept(1098).Value == 0)
        //            {
        //                //تبدیل مرخصی استحقاقی به مرخصی بی حقوق در صورت عدم طلب
        //                if (this.DoConcept(1014).Value == 1)
        //                {
        //                    this.DoConcept(1066).Value = 1;
        //                }
        //            }
        //            else
        //            {
        //                Result.Value = 1;
        //                this.Person.AddUsedLeave(this.ConceptCalculateDate, leaveInDay, permit);
        //            }
        //        }
        //        else
        //        {
        //            //مرخصی قطعی در روزغیرکاری
        //            if (this.DoConcept(1021).Value == 1)
        //            {
        //                //حتی اگر طلب نداشته باشد باید منفی شود
        //                Result.Value = 1;
        //                this.Person.AddUsedLeave(this.ConceptCalculateDate, leaveInDay, permit);
        //            }
        //        }
        //    }
        //}

        /// <summary>مفهوم مرخصی بیماری بی حقوق خالص روزانه_31 </summary>
        /// <param name="Result"></param>
        public override void C1063(BaseScndCnpValue Result, SecondaryConcept MyConcept)
        {
            //طبق درخواست مانا مرخصی روزانه ای که در روزهای 5 شنبه گرفته میشود باید روزانه شود نه ساعتی
            Permit permit = this.Person.GetPermitByDate(this.ConceptCalculateDate, EngEnvironment.GetPrecard(Precards.DailyNoSallaryIllnessLeave1));

            if (permit != null && permit.Value == 1)
            {
                Result.Value = 1;
                this.DoConcept(3003).Value = 0;
                //Result.FromDate =
                //Result.ToDate = this.ConceptCalculateDate;
            }
            else
            {
                Result.Value = 0;
            }
        }
コード例 #15
0
 /// <summary>مفهوم رست </summary>
 /// <param name="Result"></param>
 public void C1501(BaseScndCnpValue Result, SecondaryConcept MyConcept)
 {
     //Result.Value = 0;
     if (this.DoConcept(3004).Value == 1 || this.DoConcept(3028).Value > 5 * HourMin)
     {
         Permit rest = this.Person.GetPermitByDate(this.RuleCalculateDate, EngEnvironment.GetPrecard(202));
         if (rest != null && rest.Value == 1)
         {
             this.DoConcept(1501).Value = 1;
             this.DoConcept(4).Value    = 1;
             this.DoConcept(2).Value    = 0;// this.Person.GetShiftByDate(this.RuleCalculateDate).PairValues;
             this.DoConcept(6).Value    = 0;
             this.DoConcept(3004).Value = 0;
             ((PairableScndCnpValue)this.DoConcept(3028)).ClearPairs();
         }
     }
 }
コード例 #16
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);
        }
コード例 #17
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);
        }
コード例 #18
0
ファイル: RuleCalculator.cs プロジェクト: ImanRezaeipour/GTS
        /// <summary>
        /// کد 6501 :  افزودن مقدار.....ساعت به اضافه کار مجاز با توجه به پیش کارت
        /// </summary>
        /// <param name="MyRule"></param>
        public virtual void R6501(AssignedRule MyRule)
        {
            // 4002اضافه کارساعتی مجاز
            // افزودن اضافه کار به اندازه..... به اضافه کار مجاز با توجه به پیش کارت
            GetLog(MyRule, DebugRuleState.Before, 4002, 4005, 13);
            Permit permit = this.Person.GetPermitByDate(this.ConceptCalculateDate, EngEnvironment.GetPrecard(152));

            if (permit != null && permit.Value > 0)
            {
                if (MyRule["First", this.RuleCalculateDate].ToInt() > 0)
                {
                    ((PairableScndCnpValue)this.DoConcept(4002)).IncreaseValue(MyRule["First", this.RuleCalculateDate].ToInt());
                    this.DoConcept(13).Value = this.DoConcept(2).Value + this.DoConcept(4002).Value;
                }
            }
            this.ReCalculate(4005);
            GetLog(MyRule, DebugRuleState.After, 4002, 4005, 13);
        }
コード例 #19
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;
                }
            }
        }
コード例 #20
0
        /// <summary>مفهوم مرخصي استحقاقي خالص روزانه</summary>
        /// <param name="Result"></param>
        /// <remarks>شناسه اين مفهوم در تعاريف بعدي بيست و دو-22 درنظر گرفته شده است</remarks>
        public override void C1004(BaseScndCnpValue Result, SecondaryConcept MyConcept)
        {
            //طبق توافق صورت گرفته در اینجا تنها داشتن مجوز ملاک مقداردهی مرخصی استحقاقی روزانه است
            int leaveInDay = this.DoConcept(1001).Value;

            Permit permit = this.Person.GetPermitByDate(this.ConceptCalculateDate, EngEnvironment.GetPrecard(Precards.DailyEstehghaghiLeave));

            if (permit != null && permit.Value == 1)
            {
                if (this.Person.GetShiftByDate(this.ConceptCalculateDate).Value > 0)
                {
                    int demandLeave = this.Person.GetRemainLeave(this.ConceptCalculateDate);
                    if (leaveInDay > demandLeave)
                    {
                        //تبدیل مرخصی استحقاقی به مرخصی بی حقوق در صورت عدم طلب
                        if (this.DoConcept(1014).Value == 1)
                        {
                            this.DoConcept(1066).Value = 1;
                        }
                    }
                    else
                    {
                        Result.Value = 1;
                        this.Person.AddUsedLeave(this.ConceptCalculateDate, leaveInDay, permit);
                    }
                }
                else
                {
                    //مرخصی قطعی در روزغیرکاری
                    if (this.DoConcept(1021).Value == 1)
                    {
                        //حتی اگر طلب نداشته باشد باید منفی شود
                        Result.Value = 1;
                        this.Person.AddUsedLeave(this.ConceptCalculateDate, leaveInDay, permit);
                    }
                }
            }
        }
コード例 #21
0
        /// <summary>
        /// مرخصی نیم روز
        /// مرخصی روزانه ای که تا حد مشخصی از غیبت را پوشش میدهد و د هر صورت به میزان مشخص از
        /// مانده مرخصی کسر میگردد
        /// </summary>
        /// <param name="Result"></param>
        /// <param name="MyConcept"></param>
        public virtual void C1501(BaseScndCnpValue Result, SecondaryConcept MyConcept)
        {
            ((PairableScndCnpValue)Result).ClearPairs();
            PairableScndCnpValue validLeave  = new PairableScndCnpValue();
            PairableScndCnpValue AbsentLeave = new PairableScndCnpValue();
            Permit    permit = this.Person.GetPermitByDate(this.ConceptCalculateDate, EngEnvironment.GetPrecard(150));
            BaseShift shift  = this.Person.GetShiftByDate(this.ConceptCalculateDate);

            if (shift != null && shift.PairCount > 0 && permit.Value > 0)
            {
                // ساعات نیم روز سوال گردد

                IPair firstHalf  = new PairableScndCnpValuePair(shift.PastedPairs.From, 11 * 60 + 30);
                IPair secondHalf = new PairableScndCnpValuePair(10 * 60 + 45, shift.PastedPairs.To);

                if (Operation.Intersect(firstHalf, this.DoConcept(3028)).Value > Operation.Intersect(secondHalf, this.DoConcept(3028)).Value)
                {
                    this.Person.AddUsedLeave(this.ConceptCalculateDate, firstHalf.Value, permit);
                    //((PairableScndCnpValue)Result).AddPair(firstHalf);
                    Result.Value = 1;
                    ((PairableScndCnpValue)this.DoConcept(3028)).AddPairs(Operation.Differance(this.DoConcept(3028), firstHalf));
                    ((PairableScndCnpValue)this.DoConcept(3001)).AddPairs(this.DoConcept(3028));
                }
                else
                {
                    this.Person.AddUsedLeave(this.ConceptCalculateDate, secondHalf.Value, permit);
                    //((PairableScndCnpValue)Result).AddPair(secondHalf);
                    Result.Value = 1;
                    ((PairableScndCnpValue)this.DoConcept(3028)).AddPairs(Operation.Differance(this.DoConcept(3028), secondHalf));
                    ((PairableScndCnpValue)this.DoConcept(3001)).AddPairs(this.DoConcept(3028));
                }

                this.ReCalculate(this.ConceptCalculateDate, 3008, 3010, 3014, 3029, 3030, 3031);
            }
        }
コード例 #22
0
        /// <summary>
        /// اعمال خروج روز قبل و ورود روز بعد از رست
        /// آولویت آن از 100011 به 1801  منتقل شد تا قبل قانون 13 انجام شود
        /// </summary>
        /// <param name="MyRule"></param>
        public void R3504(AssignedRule MyRule)
        {
            //1501 رست
            //1502 رست ماهانه
            //7 کارکرد در روز
            //3028 غیبت ساعنی
            //3004 غیبت روزانه
            //3029 تاخیر
            //3020 غیبت ساتی مجاز
            //4002 اضافه کار
            //3030 تعجیل ساعتی غیر مجاز
            //1005 استحقاقی روزانه

            //مثلا اگر روز اول رست تعطیل کاری باشد
            Permit rest = this.Person.GetPermitByDate(this.RuleCalculateDate, EngEnvironment.GetPrecard(202));

            if ((/*this.DoConcept(1501).Value == 1*/
                    (rest != null && rest.Value > 0) || this.DoConcept(1005).Value == 1) &&
                this.DoConcept(1501, this.RuleCalculateDate.AddDays(-1)).Value == 0 &&
                this.DoConcept(1005, this.RuleCalculateDate.AddDays(-1)).Value == 0)
            {
                ProceedTraffic ProceedTraffic = this.Person.GetProceedTraficByDate(this.RuleCalculateDate.AddDays(-1));
                if (ProceedTraffic != null && ProceedTraffic.PairCount > 0)
                {
                    if (Operation.Intersect(
                            this.DoConcept(3028, this.RuleCalculateDate.AddDays(-1)),
                            this.DoConcept(3030, this.RuleCalculateDate.AddDays(-1)))
                        .Value > 0)
                    {
                        IPair pair = ProceedTraffic.Pairs.OrderBy(x => x.To).Last();
                        if (pair.To >= 12 * HourMin)
                        {
                            IPair alowPair = new PairableScndCnpValuePair(12 * HourMin, this.Person.GetShiftByDate(this.RuleCalculateDate).PastedPairs.To);
                            PairableScndCnpValue allowAbsence = Operation.Intersect(alowPair, this.DoConcept(3030, this.RuleCalculateDate.AddDays(-1)));

                            this.DoConcept(2, this.RuleCalculateDate.AddDays(-1)).Value    += allowAbsence.PairValues;
                            this.DoConcept(4, this.RuleCalculateDate.AddDays(-1)).Value     = 1;
                            this.DoConcept(3020, this.RuleCalculateDate.AddDays(-1)).Value += allowAbsence.PairValues;
                            PairableScndCnpValue absence = Operation.Differance(this.DoConcept(3030, this.RuleCalculateDate.AddDays(-1)), allowAbsence);
                            ((PairableScndCnpValue)this.DoConcept(3030, this.RuleCalculateDate.AddDays(-1))).AddPairs(absence);
                            this.DoConcept(3004, this.RuleCalculateDate.AddDays(-1)).Value = 0;
                            this.ReCalculate(3028, this.RuleCalculateDate.AddDays(-1));
                            this.ReCalculate(4002, this.RuleCalculateDate.AddDays(-1));
                            this.ReCalculate(13, this.RuleCalculateDate.AddDays(-1));
                        }
                    }
                }
            }
            //مثلا اگر روز آخر رست تعطیل کاری باشد
            rest = this.Person.GetPermitByDate(this.RuleCalculateDate.AddDays(-1), EngEnvironment.GetPrecard(202));
            if ((/*this.DoConcept(1501, this.RuleCalculateDate.AddDays(-1)).Value == 1*/
                    (rest != null && rest.Value > 0) ||
                    this.DoConcept(1005, this.RuleCalculateDate.AddDays(-1)).Value == 1
                    ) &&
                this.DoConcept(1501).Value == 0 && this.DoConcept(1005).Value == 0)
            {
                GetLog(MyRule, DebugRuleState.Before, 4028, 2, 4, 3028, 3004, 3020, 4002, 13);
                ProceedTraffic ProceedTraffic = this.Person.GetProceedTraficByDate(this.RuleCalculateDate);
                if (ProceedTraffic != null && ProceedTraffic.PairCount > 0)
                {
                    if (Operation.Intersect(
                            this.DoConcept(3028), this.DoConcept(3029)).Value > 0)
                    {
                        IPair pair = ProceedTraffic.Pairs.OrderBy(x => x.To).Last();
                        if (pair.From <= 11 * HourMin + 30)
                        {
                            IPair alowPair = new PairableScndCnpValuePair(5 * 60, 11 * HourMin + 30);
                            PairableScndCnpValue allowAbsence = Operation.Intersect(alowPair, this.DoConcept(3028));

                            this.DoConcept(2).Value += allowAbsence.PairValues;
                            this.DoConcept(4).Value  = 1;

                            this.DoConcept(3020).Value += allowAbsence.PairValues;
                            PairableScndCnpValue absence = Operation.Differance(this.DoConcept(3028), allowAbsence);
                            ((PairableScndCnpValue)this.DoConcept(3028)).AddPairs(absence);
                            this.DoConcept(3004).Value = 0;
                            this.ReCalculate(4002);
                            this.ReCalculate(13);
                        }
                    }
                }
                GetLog(MyRule, DebugRuleState.After, 4028, 2, 4, 3028, 3004, 3020, 4002, 13);
            }
        }
コード例 #23
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="Result"></param>
        /// <param name="MyConcept"></param>
        public override void C1002(BaseScndCnpValue Result, SecondaryConcept MyConcept)
        {
            ((PairableScndCnpValue)Result).ClearPairs();
            //120 precard : مرخصی نیم روز
            Permit halfDayPermit = this.Person.GetPermitByDate(this.ConceptCalculateDate, EngEnvironment.GetPrecard(120));
            Permit hourlyLeave   = this.Person.GetPermitByDate(this.ConceptCalculateDate, EngEnvironment.GetPrecard(Precards.HourLeave1));

            if (halfDayPermit.ID > 0 && halfDayPermit.PairCount > 0)
            {
                PairableScndCnpValue PermitInShift = new PairableScndCnpValue();
                int demandLeave = 0;
                PairableScndCnpValue absence = (PairableScndCnpValue)this.DoConcept(3028);
                int absenceDuration          = 0;
                int maxLeave = 3 * 60 + 30;
                foreach (PairableScndCnpValuePair pair in absence.Pairs)
                {
                    if (absenceDuration >= maxLeave)
                    {
                        break;
                    }
                    int pairValue = pair.Value;
                    if (absenceDuration + pair.Value > maxLeave)
                    {
                        pairValue = maxLeave - absenceDuration;
                        //absenceDuration = maxLeave;
                    }

                    demandLeave = this.Person.GetRemainLeave(this.ConceptCalculateDate);
                    if (demandLeave < pairValue && this.DoConcept(1098).Value == 0)
                    {
                        pairValue = demandLeave;
                    }

                    this.Person.AddUsedLeave(this.ConceptCalculateDate, pairValue, halfDayPermit);

                    absenceDuration += pairValue;
                }

                IList <IPair> pairList = absence.DecreasePairFromFirst(absenceDuration);
                ((PairableScndCnpValue)this.DoConcept(3001)).DecreasePairFromFirst(absenceDuration);
                foreach (IPair pair in pairList)
                {
                    ((PairableScndCnpValue)Result).AppendPair(pair);
                }

                this.ReCalculate(this.ConceptCalculateDate, 3008, 3010, 3014, 3029, 3030, 3031);
            }
            if (hourlyLeave.ID > 0 && hourlyLeave.PairCount > 0)
            {
                base.C1002(Result, MyConcept);
            }
        }
コード例 #24
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();
                }
            }
        }
コード例 #25
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);
            }
        }
コード例 #26
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
        }
コード例 #27
0
 /// <summary>
 /// اضافه کار آنکالی
 /// </summary>
 /// <param name="MyRule"></param>
 public virtual void R6503(AssignedRule MyRule)
 {
     //2035 ماموریت با کد 65
     //6501 آنکالی
     GetLog(MyRule, DebugRuleState.Before, 6501);
     if (this.DoConcept(2035).Value > 0)
     {
         Permit permit   = this.Person.GetPermitByDate(this.RuleCalculateDate, EngEnvironment.GetPrecard(Precards.DailyLeave6));
         int    OverTime = MyRule["First", this.RuleCalculateDate].ToInt();
         if (OverTime > 0)
         {
             this.DoConcept(6501).Value = OverTime * this.DoConcept(2035).Value;
         }
     }
     GetLog(MyRule, DebugRuleState.After, 6501);
 }
コード例 #28
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);
        }
コード例 #29
0
        /// <summary>
        /// درخواست مرخصی و ماموریت بین وقت قطعی است
        /// </summary>
        /// <param name="MyRule"></param>
        public virtual void R1501(AssignedRule MyRule)
        {
            //1003 مرخصی ساعتی
            //1100 مجموع مرخصی با حقوق ساعتی
            //2023 مجموع ماموریت ساعتی
            if (this.Person.GetShiftByDate(this.RuleCalculateDate).Value > 0)
            {
                GetLog(MyRule, DebugRuleState.Before, 2023, 3028, 1003, 1100);
                bool   duty   = false;
                Permit permit = this.Person.GetPermitByDate(this.ConceptCalculateDate, EngEnvironment.GetPrecard(Precards.HourDuty1));
                if (permit != null && permit.Value > 0)
                {
                    duty = true;
                }
                else
                {
                    permit = this.Person.GetPermitByDate(this.ConceptCalculateDate, EngEnvironment.GetPrecard(Precards.HourDuty2));
                    if (permit != null && permit.Value > 0)
                    {
                        duty = true;
                    }
                    else
                    {
                        permit = this.Person.GetPermitByDate(this.ConceptCalculateDate, EngEnvironment.GetPrecard(Precards.HourDuty3));
                        if (permit != null && permit.Value > 0)
                        {
                            duty = true;
                        }
                        else
                        {
                            permit = this.Person.GetPermitByDate(this.ConceptCalculateDate, EngEnvironment.GetPrecard(Precards.HourDuty4));
                            if (permit != null && permit.Value > 0)
                            {
                                duty = true;
                            }
                            else
                            {
                                permit = this.Person.GetPermitByDate(this.ConceptCalculateDate, EngEnvironment.GetPrecard(Precards.HourDuty5));
                                if (permit != null && permit.Value > 0)
                                {
                                    duty = true;
                                }
                            }
                        }
                    }
                }
                if (duty)
                {
                    int shiftStart = this.Person.GetShiftByDate(this.RuleCalculateDate).Pairs.OrderBy(x => x.From).First().From;
                    foreach (PermitPair pair in permit.Pairs.Where(x => x.From > shiftStart))
                    {
                        if (Operation.Intersect(pair, this.DoConcept(2023)).Value == 0)
                        {
                            ((PairableScndCnpValue)this.DoConcept(2023)).AppendPair(pair);
                            ((PairableScndCnpValue)this.DoConcept(3028)).AppendPair(pair);
                        }
                    }
                }

                permit = this.Person.GetPermitByDate(this.ConceptCalculateDate, EngEnvironment.GetPrecard(Precards.HourLeave1));
                if (permit != null && permit.Value > 0)
                {
                    int shiftStart = this.Person.GetShiftByDate(this.RuleCalculateDate).Pairs.OrderBy(x => x.From).First().From;
                    foreach (PermitPair pair in permit.Pairs.Where(x => x.From > shiftStart))
                    {
                        if (Operation.Intersect(pair, this.DoConcept(1003)).Value == 0)
                        {
                            this.Person.AddUsedLeave(this.RuleCalculateDate, pair.value, permit);
                            ((PairableScndCnpValue)this.DoConcept(1003)).AppendPair(pair);
                            ((PairableScndCnpValue)this.DoConcept(3028)).AppendPair(pair);
                        }
                    }
                }
                bool leave = false;
                permit = this.Person.GetPermitByDate(this.ConceptCalculateDate, EngEnvironment.GetPrecard(Precards.HourLeave2));
                if (permit != null && permit.Value > 0)
                {
                    leave = true;
                }
                else
                {
                    permit = this.Person.GetPermitByDate(this.ConceptCalculateDate, EngEnvironment.GetPrecard(Precards.HourLeave3));
                    if (permit != null && permit.Value > 0)
                    {
                        leave = true;
                    }
                    else
                    {
                        permit = this.Person.GetPermitByDate(this.ConceptCalculateDate, EngEnvironment.GetPrecard(Precards.HourLeave4));
                        if (permit != null && permit.Value > 0)
                        {
                            leave = true;
                        }
                        else
                        {
                            permit = this.Person.GetPermitByDate(this.ConceptCalculateDate, EngEnvironment.GetPrecard(Precards.HourLeave5));
                            if (permit != null && permit.Value > 0)
                            {
                                leave = true;
                            }
                        }
                    }
                }

                if (leave)
                {
                    int shiftStart = this.Person.GetShiftByDate(this.RuleCalculateDate).Pairs.OrderBy(x => x.From).First().From;
                    foreach (PermitPair pair in permit.Pairs.Where(x => x.From > shiftStart))
                    {
                        if (this.DoConcept(1100).Value == 0)
                        {
                            this.DoConcept(1100).Value += pair.value;
                            ((PairableScndCnpValue)this.DoConcept(3028)).AppendPair(pair);
                        }
                    }
                }
                GetLog(MyRule, DebugRuleState.After, 2023, 3028, 1003, 1100);
            }
        }
コード例 #30
0
 /// <summary>
 /// تبدیل غیبت ساعتی ماهانه به روزانه
 /// در صورتی که در خواست تبدیل غیبت به مرخصی ثبت بوشد , اعمال میگردد
 /// </summary>
 /// <param name="MyRule"></param>
 public override void R5018(AssignedRule MyRule)
 {
     //3506 کسر کار تبدیل شده به روزانه ماهانه
     //3502 کسر کار تبدیل شده به مرخصی
     //پیشکارت 153 , مرخصی تبدیل کسر کار بیش از 8 ساعت - حتما باید روز آخر ماه ثبت گردد
     //1006 مرخصی روازانه ماهانه
     if (this.DoConcept(9).Value > 0)
     {
         GetLog(MyRule, DebugRuleState.Before, 3034, 3502, 3506, 1006, 5);
         int    absence      = this.DoConcept(3034).Value;
         int    dailyAbsence = this.DoConcept(3005).Value;
         Permit permit       = this.Person.GetPermitByDate(this.RuleCalculateDate, EngEnvironment.GetPrecard(153));
         if (permit != null && permit.Value > 0)
         {
             if (this.DoConcept(3019).Value > 0 && this.DoConcept(3034).Value > 0)
             {
                 int tmp  = this.DoConcept(3034).Value / this.DoConcept(3019).Value;
                 int tmp2 = this.DoConcept(3034).Value % this.DoConcept(3019).Value;
                 this.Person.AddUsedLeave(this.ConceptCalculateDate, tmp * this.DoConcept(3019).Value, permit);
                 this.DoConcept(3502).Value += (tmp * this.DoConcept(3019).Value);
                 this.DoConcept(1006).Value += tmp;
                 this.DoConcept(5).Value    -= tmp;
                 this.DoConcept(3034).Value  = tmp2;
             }
         }
         else
         {
             base.R5018(MyRule);
             if (dailyAbsence < this.DoConcept(3005).Value)
             {
                 this.DoConcept(3506).Value = absence - this.DoConcept(3034).Value;
             }
         }
         GetLog(MyRule, DebugRuleState.After, 3034, 3502, 3506, 1006, 5);
     }
 }