/// <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); }
/// <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); } }
/// <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); // } //} } }
/// <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()); }
/// <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()); }
/// <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; } }
/// <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; } }
/// <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(); } } }
/// <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; } }
/// <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); }
/// <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; } } }
/// <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); } } } }
/// <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); } }
/// <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(); } } }
/// <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); } }
/// <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); }
/// <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); } }
/// <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); } }
/// <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); }
/// <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); } }
/// <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); }
/// <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); } }
/// <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); }