Exemplo n.º 1
0
        /// <summary>مفهوم اضافه کاراول وقت</summary>
        /// <param name="Result"></param>
        /// <remarks>شناسه اين مفهوم در تعاريف بعدي شصت و دو-62 درنظر گرفته شده است</remarks>
        //public override void C4008(BaseScndCnpValue Result, SecondaryConcept MyConcept)
        //{

        //    int i = 0;
        //    ((PairableScndCnpValue)Result).ClearPairs();
        //    PairableScndCnpValue unionResult = (PairableScndCnpValue)this.DoConcept(1);
        //    PairableScndCnpValue validLeave = new PairableScndCnpValue();
        //    ((PairableScndCnpValue)validLeave ).AddPairs(Operation.Differance (unionResult,
        //                                                 this.Person.GetShiftByDate(this.ConceptCalculateDate)).Pairs);
        //    PairableScndCnpValue overTime = (PairableScndCnpValue)this.DoConcept(4002);
        //    BaseShift shift = this.Person.GetShiftByDate(this.ConceptCalculateDate);

        //    if (shift != null && shift.PairCount > 0)
        //    {
        //        IPair shiftPair = shift.Pairs.OrderBy(x => x.From).First();
        //        if (shift.PastedPairs.From == shiftPair.From)
        //        {

        //            while (i <= overTime.PairCount - 1)
        //            {
        //                if (shiftPair.From > overTime.PairPart(i).From)
        //                {
        //                    ((PairableScndCnpValue)Result).AppendPair(overTime.PairPart(i));
        //                }
        //                i++;
        //            }
        //        }
        //    }


        //}


        /// <summary>مفهوم اضافه کار  ساعتی جمعه کاری </summary>
        /// <param name="Result"></param>
        public override void C4046(BaseScndCnpValue Result, SecondaryConcept MyConcept)
        {
            ((PairableScndCnpValue)Result).ClearPairs();
            if (this.ConceptCalculateDate.DayOfWeek == DayOfWeek.Friday)
            {
                PairableScndCnpValue     unionResult  = new PairableScndCnpValue();
                PairableScndCnpValuePair unionResult2 = new PairableScndCnpValuePair();
                PairableScndCnpValuePair unionResult3 = new PairableScndCnpValuePair();
                unionResult2.From = 1440;
                unionResult2.To   = 2880;
                unionResult3.From = 1;
                unionResult3.To   = 1439;

                ((PairableScndCnpValue)Result).AddPairs(Operation.Intersect(
                                                            Operation.Differance(this.DoConcept(1),
                                                                                 this.Person.GetShiftByDate(this.ConceptCalculateDate)
                                                                                 ), Operation.Intersect(this.DoConcept(4002), unionResult3)));

                ((PairableScndCnpValue)Result).AppendPairs(Operation.Intersect(this.DoConcept(4002), this.DoConcept(2004)));
                //((PairableScndCnpValue)Result).AppendPairs();

                if (this.DoConcept(4002, this.RuleCalculateDate.AddDays(-1)).Value > 0)
                {
                    unionResult = (PairableScndCnpValue)this.DoConcept(4002, this.RuleCalculateDate.AddDays(-1));
                    ((PairableScndCnpValue)Result).AppendPairs(Operation.Intersect(unionResult, unionResult2));
                }
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// ماموریت آموزشی
        /// شامل اضافه کار نمیشود
        /// </summary>
        /// <param name="Result"></param>
        /// <param name="MyConcept"></param>
        public override void C2014(BaseScndCnpValue Result, SecondaryConcept MyConcept)
        {
            ((PairableScndCnpValue)Result).Pairs.Clear();
            PairableScndCnpValue validMission  = new PairableScndCnpValue();
            PairableScndCnpValue AbsentMission = new PairableScndCnpValue();
            Permit    permit = this.Person.GetPermitByDate(this.ConceptCalculateDate, EngEnvironment.GetPrecard(Precards.HourDuty2));
            BaseShift shift  = this.Person.GetShiftByDate(this.ConceptCalculateDate);

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

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

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

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

            this.ReCalculate(this.ConceptCalculateDate, 3008, 3010, 3014, 3029, 3030, 3031);
        }
Exemplo n.º 3
0
        /// <summary>مفهوم غيبت خالص ساعتي</summary>
        /// <param name="Result"></param>
        /// <remarks>شناسه اين مفهوم در تعاريف بعدي سي و شش-36 درنظر گرفته شده است</remarks>
        public override void C3001(BaseScndCnpValue Result, SecondaryConcept MyConcept)
        {
            Result.Value = 0;
            PairableScndCnpValue.ClearPairsValue(Result);
            ProceedTraffic proceedTraffic = this.Person.GetProceedTraficByDate(this.ConceptCalculateDate);

            if (proceedTraffic.IsFilled && this.DoConcept(1090).Value == 0 && this.DoConcept(2005).Value == 0 && this.DoConcept(1091).Value == 0 &&
                this.DoConcept(2026).Value == 0)
            {
                if (this.Person.GetShiftByDate(this.ConceptCalculateDate).ShiftType != ShiftTypesEnum.OVERTIME)
                {
                    if (this.Person.GetShiftByDate(this.ConceptCalculateDate).Value > 0 && proceedTraffic != null && (proceedTraffic.HasHourlyItem || (!proceedTraffic.HasHourlyItem && !proceedTraffic.HasDailyItem)))
                    {
                        ((PairableScndCnpValue)Result).AddPairs(Operation.Differance(this.Person.GetShiftByDate(this.ConceptCalculateDate), proceedTraffic));
                    }
                    else if (this.Person.GetShiftByDate(this.ConceptCalculateDate).Value > 0 && proceedTraffic == null)
                    {
                        ((PairableScndCnpValue)Result).AppendPairs(this.Person.GetShiftByDate(this.ConceptCalculateDate).Pairs);
                    }
                    else
                    {
                        Result.Value = 0;
                    }
                }
                else
                {
                    Result.Value = 0;
                }
            }
        }
Exemplo n.º 4
0
        /// <summary>  کد  حداکثر اضافه کاری بعد از وقت - پارامتر پویا</summary>
        /// <remarks></remarks>
        //اضافه کار مجاز4002
        public virtual void R6507(AssignedRule MyRule)
        {
            GetLog(MyRule, DebugRuleState.Before, 4002, 4003, 4007, 13);
            var personParam = this.Person.PersonTASpec.GetParamValue(this.Person.ID, "MAXEBAV", this.RuleCalculateDate);

            if (personParam != null && this.DoConcept(4007).Value > System.Convert.ToInt32(personParam.Value))
            {
                int notAllowValue             = this.DoConcept(4007).Value - System.Convert.ToInt32(personParam.Value);
                PairableScndCnpValue notAllow = new PairableScndCnpValue();
                foreach (PairableScndCnpValuePair pair in ((PairableScndCnpValue)this.DoConcept(4007)).Pairs.OrderByDescending(x => x.From))
                {
                    if (pair.Value >= notAllowValue)
                    {
                        IPair notAloowPair = new PairableScndCnpValuePair(pair.To - notAllowValue, pair.To);
                        notAllow.Pairs.Add(notAloowPair);
                        notAllowValue = 0;
                        break;
                    }
                    else
                    {
                        notAllowValue -= pair.Value;
                        notAllow.Pairs.Add(pair);
                    }
                }
                ((PairableScndCnpValue)this.DoConcept(4003)).AppendPairs(Operation.Intersect(this.DoConcept(4002), notAllow));
                ((PairableScndCnpValue)this.DoConcept(4002)).AddPairs(Operation.Differance(this.DoConcept(4002), notAllow));
                this.ReCalculate(13, 4007);
            }

            GetLog(MyRule, DebugRuleState.After, 4002, 4003, 4007, 13);
        }
Exemplo n.º 5
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);
            }
        }
Exemplo n.º 6
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);
            }
        }
Exemplo n.º 7
0
        /// <summary>
        /// حضور اول وقت قبل از ماموریت ساعتی بعد از ساعت 10 اجباری است
        /// </summary>
        /// <param name="MyRule"></param>
        public void R4502(AssignedRule MyRule)
        {
            //2 کارکرد خالص
            //ماموريت ساعتي 2004
            //3021 تاخیر مجاز
            //3029 تاخیر غیر مجاز
            GetLog(MyRule, DebugRuleState.Before, 2004, 2, 13, 3021, 3029, 3020, 3028);

            if (this.DoConcept(2004).Value > 0)
            {
                PairableScndCnpValue duty    = ((PairableScndCnpValue)this.DoConcept(2004));
                PairableScndCnpValue present = ((PairableScndCnpValue)this.DoConcept(1));

                if (duty.Pairs.FirstOrDefault() != null && duty.Pairs.OrderBy(x => x.From).First().From > 10 * HourMin)
                {
                    if (present.Pairs.FirstOrDefault() != null && present.Pairs.OrderBy(x => x.From).First().From > 10 * HourMin)
                    {
                        duty.ClearPairs();
                        this.DoConcept(2004).Value = 0;
                    }
                }
                else
                {//و اگرتاخیر داشت مجاز است
                    ProceedTraffic proceedTraffic = this.Person.GetProceedTraficByDate(this.RuleCalculateDate);
                    if (proceedTraffic.Pairs.FirstOrDefault() == null || proceedTraffic.Pairs.OrderBy(x => x.From).First().From > 10 * HourMin)
                    {
                        this.DoConcept(3021).Value = this.DoConcept(3029).Value;
                        ((PairableScndCnpValue)this.DoConcept(3029)).ClearPairs();
                        this.DoConcept(2).Value += this.DoConcept(3021).Value;
                        this.ReCalculate(13, 3020, 3028);
                    }
                }
            }
            GetLog(MyRule, DebugRuleState.After, 2004, 2, 13, 3021, 3029, 3020, 3028);
        }
Exemplo n.º 8
0
 /// <summary>مفهوم مجموع ماموريت ساعتي</summary>
 /// جدا کردن ماموریت 2019 و 2021
 /// <param name="Result"></param>
 public override void C2023(BaseScndCnpValue Result, SecondaryConcept MyConcept)
 {
     PairableScndCnpValue.AddPairsToScndCnpValue(this.DoConcept(2004), Result);
     //PairableScndCnpValue.AppendPairsToScndCnpValue(this.DoConcept(2019), Result);
     PairableScndCnpValue.AppendPairsToScndCnpValue(this.DoConcept(2020), Result);
     //PairableScndCnpValue.AppendPairsToScndCnpValue(this.DoConcept(2021), Result);
     PairableScndCnpValue.AppendPairsToScndCnpValue(this.DoConcept(2022), Result);
     this.DoConcept(13);//در قانون مربوطه باید اضافه گردد
     this.DoConcept(2).Value += Operation.Intersect(this.Person.GetShiftByDate(this.ConceptCalculateDate), Result).Value;
 }
Exemplo n.º 9
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);
            }
        }
Exemplo n.º 10
0
        /// <summary>مفهوم تاخير خالص ساعتي</summary>
        /// <param name="Result"></param>
        /// <remarks>شناسه اين مفهوم در تعاريف بعدي چهل و دو-42 درنظر گرفته شده است</remarks>
        public virtual void C3010(BaseScndCnpValue Result, SecondaryConcept MyConcept)
        {
            Result.Value = 0;
            PairableScndCnpValue.ClearPairsValue(Result);
            ProceedTraffic proceedTraffic = Person.GetProceedTraficByDate(this.ConceptCalculateDate);

            this.DoConcept(3038).Value = 0;
            if (this.DoConcept(1090).Value == 0 && this.DoConcept(2005).Value == 0 && this.DoConcept(1091).Value == 0)
            {
                PairableScndCnpValue absent = (PairableScndCnpValue)this.DoConcept(3001);
                BaseShift            shift  = this.Person.GetShiftByDate(this.ConceptCalculateDate);

                if (absent != null && shift != null && absent.PairCount != 0 && shift.PairCount != 0)
                {
                    if (proceedTraffic != null && proceedTraffic.Pairs.Where(x => x.IsFilled).Count() > 0 &&
                        Operation.Intersect(this.Person.GetShiftByDate(this.ConceptCalculateDate), proceedTraffic).Value > 0)
                    {
                        IPair pair = proceedTraffic.Pairs.Where(x => x.IsFilled).OrderBy(x => x.From).First();
                        //ShiftPair firstShiftPair = shift.Pairs.OrderBy(x => x.From).First();
                        foreach (ShiftPair shiftPair in shift.Pairs.OrderBy(x => x.From).ToList())
                        {
                            PairableScndCnpValue p = Operation.Intersect(shiftPair, absent);
                            if (p.PairCount > 0 && p.Pairs.OrderBy(x => x.From).Last().To ==
                                shiftPair.To)
                            {
                                //PairableScndCnpValue val = Operation.Differance(p.Pairs.OrderBy(x => x.From).First(), pair);
                                PairableScndCnpValue.AppendPairToScndCnpValue(p.Pairs.Last(), Result);
                                this.DoConcept(3038).Value += 1;
                                //break;
                            }
                        }
                    }
                    else
                    {
                        //در نظر گرفتن کل غیبت
                        foreach (ShiftPair shiftPair in shift.Pairs.OrderBy(x => x.From).ToList())
                        {
                            PairableScndCnpValue p = Operation.Intersect(shiftPair, absent);
                            if (p.PairCount > 0 && p.Pairs.OrderBy(x => x.From).First().From ==
                                shiftPair.From)
                            {
                                PairableScndCnpValue.AppendPairToScndCnpValue(p.Pairs.OrderBy(x => x.From).First(), Result);
                                this.DoConcept(3038).Value += 1;
                            }
                        }
                    }
                }
            }
        }
Exemplo n.º 11
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);
            }
        }
Exemplo n.º 12
0
        /// <summary>قانون مقداردهی به شبکاری و ضریب دادن به شبکاری C14</summary>
        public override void R2001(AssignedRule MyRule)
        {
            //15 شبکاری
            //16 تعداد شبکاری
            GetLog(MyRule, DebugRuleState.Before, 16, 15);
            PairableScndCnpValue.AppendPairToScndCnpValue(new PairableScndCnpValuePair(MyRule["First", this.RuleCalculateDate].ToInt(), MyRule["Second", this.RuleCalculateDate].ToInt()), this.DoConcept(14));
            this.DoConcept(16).Value = 1;
            this.DoConcept(15);

            if (this.DoConcept(15).Value > 0)
            {
                float coEfficient = MyRule["Third", this.RuleCalculateDate].ToInt() / 100f;
                float i           = this.DoConcept(15).Value *coEfficient;
                ((PairableScndCnpValue)this.DoConcept(15)).IncreaseValue((int)Math.Round(i));
            }

            GetLog(MyRule, DebugRuleState.After, 16, 15);
        }
Exemplo n.º 13
0
        public IList <PersonalMonthlyReportRowDetail> LoadPairableScndcnpValue(decimal PersonId, DateTime Date, ConceptsKeys key)
        {
            PairableScndCnpValue           PairableScndCnpValue = null;
            SecondaryConcept               ScndCnp             = null;
            PersonalMonthlyReportRowDetail PrsMonthlyRptRowDtl = null;

            return(NHibernateSession.QueryOver <PairableScndCnpValue>(() => PairableScndCnpValue)
                   .Select(Projections.Property(() => ScndCnp.Name).WithAlias(() => PrsMonthlyRptRowDtl.ScndCnpName),
                           Projections.Property(() => PairableScndCnpValue.FromPairs).WithAlias(() => PrsMonthlyRptRowDtl.Froms),
                           Projections.Property(() => PairableScndCnpValue.ToPairs).WithAlias(() => PrsMonthlyRptRowDtl.Tos),
                           Projections.Property(() => ScndCnp.Color).WithAlias(() => PrsMonthlyRptRowDtl.Color))
                   .JoinAlias(() => PairableScndCnpValue.Concept, () => ScndCnp)
                   .Where(x => x.Person.ID == PersonId)
                   .And(x => x.FromDate == Date)
                   .And(x => x.ToDate == Date)
                   .And(() => ScndCnp.KeyColumnName == key.ToString())
                   .TransformUsing(Transformers.AliasToBean <PersonalMonthlyReportRowDetail>())
                   .List <PersonalMonthlyReportRowDetail>());
        }
Exemplo n.º 14
0
        /// <summary>
        /// اعمال مجوز تاخیر مجاز بعد از ماموریت ساعت 23
        /// </summary>
        /// <param name="MyRule"></param>
        public void R287(AssignedRule MyRule)
        {
            //3021 تاخیر مجاز
            //تاخیر ساعتي 3029
            //201 کد پیشکارت درخواست تاخیر مجاز ماموریت
            GetLog(MyRule, " Before Execute State:", 3020, 3021, 3029);
            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);
                }
            }

            GetLog(MyRule, " After Execute State:", 3020, 3021, 3029);
        }
Exemplo n.º 15
0
        /// <summary>
        /// کد 6032 :   اعمال مجوز اضافه کاری
        /// </summary>
        /// <param name="MyRule"></param>
        public override void R6032(AssignedRule MyRule)
        {
            //4002 اضافه کارساعتي مجاز
            //4003 اضافه کارساعتي غیرمجاز
            //4015 اضافه کار با مجوز باشد
            //4016 مفهوم اضافه کار بعد از وقت مجوزی است
            //4029 مفهوم مجوز اضافه کاری
            //4007 مفهوم اضافه کارآخر وقت
            //4026 سقف اضافه کار که ضریب تعلق میگیرد

            Permit permit       = this.Person.GetPermitByDate(this.ConceptCalculateDate, EngEnvironment.GetPrecard(Precards.OverTime));
            Permit permitFriday = this.Person.GetPermitByDate(this.ConceptCalculateDate, EngEnvironment.GetPrecard(151));

            GetLog(MyRule, DebugRuleState.Before, 4007, 4002, 4005, 4003, 13);

            #region Apply Parameters
            int withoutPermitAlow = 0;
            if (this.Person.GetShiftByDate(this.RuleCalculateDate).Value == 0)
            {
                withoutPermitAlow = MyRule["MojazTatil", this.RuleCalculateDate].ToInt();
            }
            else
            {
                withoutPermitAlow = MyRule["MojazAadi", this.RuleCalculateDate].ToInt();
            }
            if (withoutPermitAlow > 0)
            {
                foreach (IPair pair in ((PairableScndCnpValue)this.DoConcept(4003)).Pairs)
                {
                    if (pair.Value - withoutPermitAlow > 0)
                    {
                        IPair allowedPair = new PairableScndCnpValuePair(pair.From, pair.From + withoutPermitAlow);

                        ((PairableScndCnpValue)this.DoConcept(4002)).AppendPair(allowedPair);
                        this.DoConcept(13).Value += allowedPair.Value;;

                        pair.From += withoutPermitAlow;
                        this.DoConcept(4003).Value = ((PairableScndCnpValue)this.DoConcept(4003)).PairValues;

                        break;
                    }
                    else if (pair.Value - withoutPermitAlow == 0)
                    {
                        ((PairableScndCnpValue)this.DoConcept(4002)).AppendPair(pair);
                        this.DoConcept(13).Value += pair.Value;

                        pair.From = pair.To = 0;
                        this.DoConcept(4003).Value = ((PairableScndCnpValue)this.DoConcept(4003)).PairValues;

                        break;
                    }
                    else
                    {
                        ((PairableScndCnpValue)this.DoConcept(4002)).AppendPair(pair);
                        this.DoConcept(13).Value += pair.Value;

                        withoutPermitAlow -= pair.Value;

                        pair.From = pair.To = 0;
                        this.DoConcept(4003).Value = ((PairableScndCnpValue)this.DoConcept(4003)).PairValues;
                    }
                }
            }
            #endregion

            if (permit != null && permit.Value > 0)
            {
                if (this.DoConcept(4003).Value > 0)
                {
                    foreach (PermitPair permitPair in permit.Pairs)
                    {
                        //مجوز مقداری و بازه ای - در حال حاضر نمیتوان روی خصیصه جفت بودن در مجوز حساب کرد
                        //لذا از روش زیر جهت شناسایی استفاده میگردد
                        #region Pairly Permit
                        if (permitPair.To - permitPair.From == permitPair.Value)
                        {
                            PairableScndCnpValue allowedOverWork    = Operation.Intersect(permitPair, (PairableScndCnpValue)this.DoConcept(4003));
                            PairableScndCnpValue notAllowedOverWork = Operation.Differance(this.DoConcept(4003), allowedOverWork);
                            ((PairableScndCnpValue)this.DoConcept(4002)).AppendPairs(allowedOverWork);
                            ((PairableScndCnpValue)this.DoConcept(4003)).AddPairs(notAllowedOverWork);
                            this.ReCalculate(13);

                            permitPair.IsApplyedOnTraffic = true;//اعمال شد
                        }
                        #endregion

                        #region Value Permit
                        else if ((permitPair.From == 1439 && permitPair.To == 1439 && permitPair.Value > 0) || permitPair.To - permitPair.From != permitPair.Value)
                        {
                            int permitOverWork = permitPair.Value;

                            foreach (IPair pair in ((PairableScndCnpValue)this.DoConcept(4003)).Pairs)
                            {
                                if (pair.Value - permitOverWork > 0)
                                {
                                    IPair allowedPair = new PairableScndCnpValuePair(pair.From, pair.From + permitOverWork);

                                    ((PairableScndCnpValue)this.DoConcept(4002)).AppendPair(allowedPair);

                                    pair.From += permitOverWork;
                                    this.DoConcept(4003).Value = ((PairableScndCnpValue)this.DoConcept(4003)).PairValues;

                                    break;
                                }
                                else if (pair.Value - permitOverWork == 0)
                                {
                                    ((PairableScndCnpValue)this.DoConcept(4002)).AppendPair(pair);

                                    pair.From = pair.To = 0;
                                    this.DoConcept(4003).Value = ((PairableScndCnpValue)this.DoConcept(4003)).PairValues;

                                    break;
                                }
                                else
                                {
                                    ((PairableScndCnpValue)this.DoConcept(4002)).AppendPair(pair);

                                    permitOverWork -= pair.Value;

                                    pair.From = pair.To = 0;
                                    this.DoConcept(4003).Value = ((PairableScndCnpValue)this.DoConcept(4003)).PairValues;
                                }
                            }
                            permitPair.IsApplyedOnTraffic = true;//اعمال شد
                        }
                        #endregion
                    }
                }
            }

            if (permitFriday != null && permitFriday.Value > 0)
            {
                if (this.DoConcept(4003).Value > 0)
                {
                    foreach (PermitPair permitPair in permitFriday.Pairs)
                    {
                        //مجوز مقداری و بازه ای - در حال حاضر نمیتوان روی خصیصه جفت بودن در مجوز حساب کرد
                        //لذا از روش زیر جهت شناسایی استفاده میگردد
                        #region Pairly permitFriday
                        if (permitPair.To - permitPair.From == permitPair.Value)
                        {
                            PairableScndCnpValue allowedOverWork    = Operation.Intersect(permitPair, (PairableScndCnpValue)this.DoConcept(4003));
                            PairableScndCnpValue notAllowedOverWork = Operation.Differance(this.DoConcept(4003), allowedOverWork);
                            ((PairableScndCnpValue)this.DoConcept(4002)).AppendPairs(allowedOverWork);
                            ((PairableScndCnpValue)this.DoConcept(4003)).AddPairs(notAllowedOverWork);

                            permitPair.IsApplyedOnTraffic = true;//اعمال شد
                        }
                        #endregion

                        #region Value permitFriday
                        else if ((permitPair.From == 1439 && permitPair.To == 1439 && permitPair.Value > 0) || permitPair.To - permitPair.From != permitPair.Value)
                        {
                            int permitOverWork = permitPair.Value;

                            foreach (IPair pair in ((PairableScndCnpValue)this.DoConcept(4003)).Pairs)
                            {
                                if (pair.Value - permitOverWork > 0)
                                {
                                    IPair allowedPair = new PairableScndCnpValuePair(pair.From, pair.From + permitOverWork);

                                    ((PairableScndCnpValue)this.DoConcept(4002)).AppendPair(allowedPair);

                                    pair.From += permitOverWork;
                                    this.DoConcept(4003).Value = ((PairableScndCnpValue)this.DoConcept(4003)).PairValues;

                                    break;
                                }
                                else if (pair.Value - permitOverWork == 0)
                                {
                                    ((PairableScndCnpValue)this.DoConcept(4002)).AppendPair(pair);

                                    pair.From = pair.To = 0;
                                    this.DoConcept(4003).Value = ((PairableScndCnpValue)this.DoConcept(4003)).PairValues;

                                    break;
                                }
                                else
                                {
                                    ((PairableScndCnpValue)this.DoConcept(4002)).AppendPair(pair);

                                    permitOverWork -= pair.Value;

                                    pair.From = pair.To = 0;
                                    this.DoConcept(4003).Value = ((PairableScndCnpValue)this.DoConcept(4003)).PairValues;
                                }
                            }
                            permitPair.IsApplyedOnTraffic = true;//اعمال شد
                        }
                        #endregion
                    }
                }
            }

            this.DoConcept(13).Value = this.DoConcept(2).Value + this.DoConcept(4002).Value;
            DateRange dateRange1 = this.GetDateRange(4005, this.RuleCalculateDate);
            if (this.RuleCalculateDate == dateRange1.ToDate || CalcDateZone.ToDate == this.RuleCalculateDate)
            {
                this.ReCalculate(4005);
            }
            this.ReCalculate(4007);
            GetLog(MyRule, DebugRuleState.After, 4007, 4002, 4005, 4003, 13);
        }
Exemplo n.º 16
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);
            }
        }
Exemplo n.º 17
0
        /// <summary></summary>
        /// <remarks>شناسه اين قانون در تعاريف بعدي دویست و هشتاد و یک-280 درنظر گرفته شده است</remarks>
        ///  کارکرد روز جمعه
        ///  در نیمه اول سال تا ساعت 13(پایان شیفت) و در نیمه دوم تا ساعت 12 حضور داشت
        ///  هشت ساعت کارکرد (آقای گرامی) منظور گردد
        public void R2501(AssignedRule MyRule)
        {
            //7 کارکرد در روز
            //3028 غيبت ساعتی غیرمجاز
            //3029 تاخیر
            //3030 تعجیل
            //3031 غیبت بین وقت
            //3004 غیبت روزانه
            //4002 اضافه کارساعتي مجاز
            //4003 اضافه کارساعتي غیرمجاز
            //3020 غيبت ساعتی مجاز
            //3026 غيبت ساعتی مجاز ماهانه

            if (this.RuleCalculateDate.DayOfWeek == DayOfWeek.Friday)
            {
                GetLog(MyRule, DebugRuleState.Before, 2, 4, 3028, 3020, 3034, 3026, 4002, 4003);
                PersianDateTime pd = Utility.ToPersianDateTime(this.RuleCalculateDate);
                if (this.Person.GetShiftByDate(this.RuleCalculateDate).Value > 0 &&
                    this.DoConcept(3004).Value == 0 && this.DoConcept(1).Value > 0)
                {
                    bool canApply = false;
                    if (pd.Month <= 6) //نیمه اول سال
                    {
                        //در نیمه اول سال حضور تا ساعت 13 یعنی حضور تا پایان شیفت
                        if (Operation.Intersect(this.DoConcept(3028), new PairableScndCnpValuePair(MyRule["First", this.RuleCalculateDate].ToInt() - 1, MyRule["First", this.RuleCalculateDate].ToInt())).Value == 0)
                        {
                            canApply = true;
                        }
                    }
                    else//نیمه دوم سال
                    {
                        if (Operation.Intersect(this.DoConcept(3028), new PairableScndCnpValuePair(MyRule["Second", this.RuleCalculateDate].ToInt() - 1, MyRule["Second", this.RuleCalculateDate].ToInt())).Value == 0)
                        {
                            canApply = true;
                        }
                    }
                    if (canApply)
                    {
                        IPair pair = this.Person.GetShiftByDate(this.RuleCalculateDate).First;//new PairableScndCnpValuePair(this.Person.GetShiftByDate(this.RuleCalculateDate).First.From, this.Person.GetShiftByDate(this.RuleCalculateDate).First.From + (8 * 60));
                        PairableScndCnpValue result = Operation.Differance(pair, this.DoConcept(3029));
                        result = Operation.Differance(result, this.DoConcept(3031));
                        result = Operation.Differance(result, this.DoConcept(3029));

                        this.DoConcept(2).Value = Operation.Intersect(result, this.Person.GetShiftByDate(this.RuleCalculateDate)).Value;
                        this.DoConcept(4).Value = 1;

                        if (Operation.Intersect(result, this.DoConcept(3028)).Value > 0)
                        {
                            this.DoConcept(3020).Value += Operation.Intersect(this.DoConcept(3030), result).Value;
                            ((PairableScndCnpValue)this.DoConcept(3028)).AddPairs(Operation.Differance(this.DoConcept(3028), result));
                        }
                        this.ReCalculate(13);
                        if (this.DoConcept(3034).Value > 0)
                        {
                            this.ReCalculate(3034);
                            this.ReCalculate(3026);
                        }
                    }
                }
                GetLog(MyRule, DebugRuleState.After, 2, 4, 3028, 3020, 3034, 3026, 4002, 4003);
            }
        }
Exemplo n.º 18
0
        /// <summary>
        /// •	در صورتی به شخص کارکرد روزانه داده میشود که شخص حداقل به میزان 7:30 حضور داشته باشد.
        //•	 در صورت حضور کمتر از 7:30 , میزان حضور اضافه کار لحاظ میگردد.
        //•	در صورت حضور بیش از 7:30 , علاوه بر اختصاص کارکرد روزانه , اضافه کار نیز به شخص تعلق میگیرد.
        //•	در صورت عدم حضور شخص در یک روز , به شخص غیبت روزانه تعلق میگیرد
        /// </summary>
        /// <param name="MyRule"></param>
        public virtual void R2501(AssignedRule MyRule)
        {
            GetLog(MyRule, DebugRuleState.Before, 4, 4002, 3028, 3004, 13);
            this.DoConcept(501).Value = 1;//روز محاسبه شده را نگه میدارد.بوسیله این متوجه میشویم که حداکثر تعداد روز محاسباتی در ماه چقدر است-همیشه نمیتوان به تعداد رینج ماهانه اکتفا کرد
            if (this.DoConcept(2005).Value == 0 && this.DoConcept(1090).Value == 0)
            {
                this.DoConcept(4).Value = 0;
            }
            PairableScndCnpValue tmpCnp      = new PairableScndCnpValue();
            PairableScndCnpValue orginTmpCnp = new PairableScndCnpValue();

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

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

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

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

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

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

                //((PairableScndCnpValue)this.DoConcept(4003)).AddPairs(notAllowOverwork);
            }
            if (tmpCnp.Value > 0)//کم کردن مدت استراحت
            {
                if (tmpCnp.Value >= in2Shift && in2Shift > 0)
                {
                    tmpCnp.DecreasePairFromFirst(esterhat * 2);
                }
                else
                {
                    tmpCnp.DecreasePairFromFirst(esterhat);
                }
            }
            if (tmpCnp.Value > 0)
            {
                this.DoConcept(13).Value = tmpCnp.Value;
            }
            else if (this.DoConcept(2005).Value == 0 && this.DoConcept(1090).Value == 0 && this.DoConcept(1091).Value == 0)
            {
                this.DoConcept(3004).Value = 1;
            }
            this.DoConcept(5022).FromPairs = "";
            GetLog(MyRule, DebugRuleState.After, 4, 4002, 3028, 3004, 13);
        }
Exemplo n.º 19
0
        /// <summary>
        /// •	در صورتی به شخص کارکرد روزانه داده میشود که شخص حداقل به میزان 7:30 حضور داشته باشد.
        //•	 در صورت حضور کمتر از 7:30 , میزان حضور اضافه کار لحاظ میگردد.
        //•	در صورت حضور بیش از 7:30 , علاوه بر اختصاص کارکرد روزانه , اضافه کار نیز به شخص تعلق میگیرد.
        //•	در صورت عدم حضور شخص در یک روز , به شخص غیبت روزانه تعلق میگیرد
        /// </summary>
        /// <param name="MyRule"></param>
        public virtual void R2501_old(AssignedRule MyRule)
        {
            GetLog(MyRule, DebugRuleState.Before, 4, 4002, 3028, 3004, 13);
            if (this.DoConcept(2005).Value == 0 && this.DoConcept(1090).Value == 0)
            {
                this.DoConcept(4).Value = 0;
            }
            PairableScndCnpValue tmpCnp      = new PairableScndCnpValue();
            PairableScndCnpValue orginTmpCnp = new PairableScndCnpValue();

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

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

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

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

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

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

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

                if (tmpCnp.Value >= this.DoConcept(7).Value)
                {
                    this.DoConcept(4).Value = 1;
                    tmpCnp.DecreasePairFromFirst(this.DoConcept(7).Value);
                    ((PairableScndCnpValue)this.DoConcept(4002)).AddPairs(tmpCnp);
                }
                else
                {
                    //اگر حداقل حضور که معمولا 3:30 است را داشته باشد , این مفهوم مقدار دهس میشود
                    if (tmpCnp.Value >= minHozour)
                    {
                        this.DoConcept(503).Value = 1;
                        ((PairableScndCnpValue)this.DoConcept(3028)).IncreaseValue(this.DoConcept(7).Value);// - tmpCnp.Value);
                        ((PairableScndCnpValue)this.DoConcept(4002)).AddPairs(tmpCnp);
                    }
                    else
                    {
                        ((PairableScndCnpValue)this.DoConcept(4002)).AddPairs(tmpCnp);
                        //   this.DoConcept(13).Value = this.DoConcept(4002).Value;
                    }
                }
            }
            else if (this.DoConcept(2005).Value == 0 && this.DoConcept(1090).Value == 0 && this.DoConcept(1091).Value == 0)
            {
                this.DoConcept(3004).Value = 1;
            }
            this.DoConcept(5022).FromPairs = "";
            GetLog(MyRule, DebugRuleState.After, 4, 4002, 3028, 3004, 13);
        }
Exemplo n.º 20
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();
                }
            }
        }
Exemplo n.º 21
0
        /// <summary>
        /// اعمال خروج روز قبل و ورود روز بعد از رست
        /// آولویت آن از 100011 به 1801  منتقل شد تا قبل قانون 13 انجام شود
        /// </summary>
        /// <param name="MyRule"></param>
        public void R293(AssignedRule MyRule)
        {
            //1501 رست
            //1502 رست ماهانه
            //7 کارکرد در روز
            //3028 غیبت ساعنی
            //3004 غیبت روزانه
            //3029 تاخیر
            //3020 غیبت ساتی مجاز
            //4002 اضافه کار
            //3030 تعجیل ساعتی غیر مجاز
            //1005 استحقاقی روزانه
            GetLog(MyRule, " Before Execute State:", 4028, 2, 4, 3028, 3004);
            if ((this.DoConcept(1501).Value == 1 || 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));
                        }
                    }
                }
            }

            if ((this.DoConcept(1501, this.RuleCalculateDate.AddDays(-1)).Value == 1 ||
                 this.DoConcept(1005, this.RuleCalculateDate.AddDays(-1)).Value == 1) &&
                this.DoConcept(1501).Value == 0 && this.DoConcept(1005).Value == 0)
            {
                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, " After Execute State:", 4028, 2, 4, 3028, 3004);
        }
Exemplo n.º 22
0
        /// <summary>
        /// فرجه تاخیر و تعجیل
        /// </summary>
        /// <param name="MyRule"></param>
        public override void R5032(AssignedRule MyRule)
        {
            //3020 غیبت ساعتی مجاز
            //3029 تاخیر
            //3030 تعجیل
            //3028 غیبت ساعتی
            //3021 تاخیر مجاز
            //3022 تعجیل مجاز
            //3031 غیبت بین وقت ساعتی غیرمجاز
            //3024 تاخیر ساعتی مجاز ماهانه
            //3026 غیبت ساعتی مجاز ماهانه
            //3027 غیبت بین وقت ساعتی مجاز ماهانه
            //1082 مجموع انواع مرخصی ساعتی
            //2023 مفهوم مجموع ماموريت ساعتي

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

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

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

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


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

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

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

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

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

                #endregion

                PairableScndCnpValue tempPairs = new PairableScndCnpValue();

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


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

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

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

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

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

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

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

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

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

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

            GetLog(MyRule, " After Execute State:", conceptList);
        }
Exemplo n.º 23
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);
        }