Compare commits

...

91 Commits

Author SHA1 Message Date
SamSys
f93991db96 change 2025-11-05 13:37:14 +03:30
sadegh Farokhi
bca3e1dd42 Delete .github/workflows/dad-mehrPublish.yaml 2025-11-05 13:36:44 +03:30
syntax24
c7e22e4ca6 testtest 2025-11-05 13:27:46 +03:30
syntax24
7386bd5750 test 2025-11-05 13:25:35 +03:30
sadegh Farokhi
5c8a521f8e Update dad-mehrPublish.yaml 2025-11-05 13:20:28 +03:30
syntax24
22973fe47b test 2025-11-05 13:17:59 +03:30
syntax24
48c83e648d update yaml 2025-11-05 11:51:39 +03:30
sadegh Farokhi
494b80c461 Update dad-mehrPublish.yaml 2025-11-05 11:35:52 +03:30
sadegh Farokhi
7cdb431d98 Update dad-mehrPublish.yaml 2025-11-04 19:13:50 +03:30
SamSys
f7ae463544 Merge branch 'WorskhopClassifiedPlan' of https://github.com/samsyntax24/OriginalGozareshgir into WorskhopClassifiedPlan 2025-11-04 19:09:22 +03:30
sadegh Farokhi
1913147f89 Rename dad-mehrPublish to dad-mehrPublish.yaml 2025-11-04 18:54:43 +03:30
sadegh Farokhi
77798eaccb Update dad-mehrPublish 2025-11-04 18:50:22 +03:30
SamSys
f17c1f0d8e test 2025-11-04 18:43:47 +03:30
sadegh Farokhi
bd4f2d18f5 Update dad-mehrPublish 2025-11-04 18:41:51 +03:30
SamSys
0bbed013d2 Merge branch 'WorskhopClassifiedPlan' of https://github.com/samsyntax24/OriginalGozareshgir into WorskhopClassifiedPlan 2025-11-04 18:41:05 +03:30
SamSys
3455c8a786 change appsetting 2025-11-04 18:40:45 +03:30
sadegh Farokhi
9981116caa Create dad-mehrPublish 2025-11-04 18:33:18 +03:30
SamSys
10e7400611 test moda completed 2025-11-02 19:11:04 +03:30
SamSys
23c99e60d5 ClassificationEmployee add to group or edit membrize completed 2025-10-26 19:10:20 +03:30
SamSys
490393acbc ClassficationScheme > EditSalariesAndCoefficient front completed 2025-10-25 01:32:09 +03:30
SamSys
c6874b33cf ClassificationSalariestab and create front completed 2025-10-19 23:11:39 +03:30
SamSys
596e21b712 craetejobs modal front 2025-10-14 04:21:50 +03:30
SamSys
e9c3176dfc change createjobe modal 2025-10-12 00:04:33 +03:30
SamSys
4a956a1397 createJobs load modal 2025-10-11 16:04:46 +03:30
SamSys
fc3053dd17 Merge branch 'master' into WorskhopClassifiedPlan 2025-10-11 15:10:12 +03:30
SamSys
bb79380ce5 add Classification Tab group list frontEnd 2025-10-11 15:05:01 +03:30
aad1645edd Merge branch 'Feature/Insurance/add-not-created-tab' 2025-10-11 14:58:59 +03:30
af1388f0d7 feat: update not created workshops query to include filtering by left work insurance dates 2025-10-11 14:58:30 +03:30
4d0cf13d40 Merge branch 'Feature/Insurance/add-not-created-tab' 2025-10-11 14:46:05 +03:30
6584558e6a fix: update error message for invalid national ID and birth date mismatch 2025-10-11 14:35:37 +03:30
ed5681256d feat: enhance "Not Created" tab functionality and improve data loading in InsuranceList 2025-10-11 13:14:30 +03:30
7a58423eb3 feat: implement "GetNotCreatedWorkshop" method and update related functionality in InsuranceList 2025-10-09 14:30:09 +03:30
70164ae498 feat: add "GetNotCreatedWorkshop" method to InsuranceList functionality 2025-10-09 13:47:43 +03:30
db225fea18 feat: add "Not Created" tab and implement related functionality in InsuranceList page 2025-10-09 12:27:20 +03:30
SamSys
849369fea3 GroupAndJobs tab Query 2025-10-08 17:41:23 +03:30
2bbe616127 fix: apply IgnoreQueryFilters in LeaveRepository for accurate data retrieval 2025-10-08 09:53:06 +03:30
SamSys
283f66ab32 Merge branch 'master' into WorskhopClassifiedPlan 2025-10-07 17:36:14 +03:30
f64e6ac176 Merge branch 'Feature/Leave/add-invalid-leave' 2025-10-07 17:23:27 +03:30
9095ed28e1 fix invalid bug 2025-10-07 17:20:48 +03:30
04ec2ed5a4 Merge branch 'Feature/Leave/add-invalid-leave' 2025-10-07 14:12:49 +03:30
SamSys
c7f5310c56 Edit Employee change NationalCode Validation By Nationality 2025-10-07 14:02:12 +03:30
7b3d1f527c feat: integrate "IsInvalid" filter and dropdown functionality in leave management 2025-10-07 12:51:18 +03:30
SamSys
abf00884a4 Create ClassificationGroup With CreateScheme - EditScheme 2025-10-07 01:38:01 +03:30
SamSys
50718eda93 Merge branch 'master' into WorskhopClassifiedPlan 2025-10-06 23:54:50 +03:30
dbbee73e2a add is invalid to list - NOT FINISHED 2025-10-06 20:07:32 +03:30
21df40af3b add isInvalid to leave entity - set query filter for it 2025-10-06 19:50:42 +03:30
SamSys
f50fdd7f91 createLive bug fixed 2025-10-06 14:45:54 +03:30
SamSys
a3dc27f08e SchemeTab, create scheme , scheme list 2025-10-06 13:26:36 +03:30
SamSys
055ce2b2a7 merge from master 2025-10-04 16:35:11 +03:30
SamSys
87cde91ad0 Extecpt Condition EmployeeId = 45104, workshopId = 315 2025-10-02 16:11:38 +03:30
SamSys
55f62da928 monthlyWage bug fixed 2025-10-02 15:39:01 +03:30
SamSys
5a7f233568 checkout dailyWage bug fixed 2025-10-02 14:22:48 +03:30
SamSys
9d83de947f Merge branch 'master' of https://github.com/samsyntax24/OriginalGozareshgir 2025-10-02 13:03:47 +03:30
SamSys
f4c3aa1889 Except Personnel checkoutChange 2025-10-02 13:03:29 +03:30
8fb10ba5b0 add validation for leave 2025-10-01 16:32:58 +03:30
SamSys
d0928804ee new permission to DailyWageReport btn on Contract list 2025-09-30 22:05:12 +03:30
SamSys
67f199e86f merge from master 2025-09-30 21:37:19 +03:30
SamSys
8171e06965 Create razorPage for classificationScheme , add isClassificationCompleted bool to workshop Table 2025-09-30 21:20:05 +03:30
SamSys
bfa8688c38 Merge branch 'master' into WorskhopClassifiedPlan 2025-09-30 00:15:53 +03:30
SamSys
85936cad63 gozareshgir address and phone changed 2025-09-29 05:11:05 +03:30
SamSys
6f805d9abe add enamd logo 2025-09-28 18:33:09 +03:30
914a7def53 feat: add condition for left personnel for laon installment 2025-09-28 14:47:33 +03:30
7777ad52de create workshop permission 2025-09-25 13:06:39 +03:30
b8b8d9c3c4 set account permission in EditWorkshop 2025-09-25 12:47:04 +03:30
SamSys
04710e321a Merge branch 'master' of https://git.dadmehrg.ir/gozareshgir/OriginalGozareshgir 2025-09-25 12:26:46 +03:30
SamSys
b9ff14757b new tab permission code 2025-09-25 12:26:38 +03:30
f387d0c535 fix create pay bug 2025-09-24 15:38:47 +03:30
ffc6969ee7 feat: change the create customize checkout 2025-09-24 13:47:55 +03:30
SamSys
66c903045f ClassiicationChemeApplication 2025-09-23 18:49:56 +03:30
c3bbd9af98 feat: change the loan is paid by checkout 2025-09-23 17:55:03 +03:30
72435f2d47 fix: InsuranceList edit on get bug 2025-09-22 11:07:37 +03:30
SamSys
b245023dd2 Static file for GroupRate 2025-09-22 02:06:39 +03:30
SamSys
8044d64d5e Classification tables Mapping 2025-09-18 05:16:00 +03:30
SamSys
1ef86d5e9c Classification Tables Designed 2025-09-16 05:26:20 +03:30
SamSys
b3cf56eb1c conflict Fixed 2025-09-16 03:01:41 +03:30
SamSys
20dbd0121f Merge From Master 2025-09-16 03:01:02 +03:30
SamSys
7d3a1dad71 test mirror2 2025-09-08 00:53:59 +03:30
SamSys
b5fc98a47b test mirror 2025-09-08 00:50:28 +03:30
SamSys
29fed23805 Checkout NEW Compute DailyWage Completed 2025-09-02 04:33:30 +03:30
SamSys
a26f079969 merge from master to manualDailyWage 2025-08-31 17:20:27 +03:30
SamSys
77458978b5 checkout change 2025-08-31 05:28:59 +03:30
SamSys
7e3f7d1dcf Completed DailYWage and BaseYear report For Contract 2025-08-28 06:09:02 +03:30
SamSys
c40b457d1f Merge branch 'master' into ManualDailyWageContractSide 2025-08-26 01:49:05 +03:30
SamSys
a344c3f3a6 Merge branch 'master' into ManualDailyWageContractSide 2025-08-24 03:45:58 +03:30
SamSys
8f76b8c082 Upgraded daillyWage Completed 2025-08-24 03:37:54 +03:30
SamSys
584425b3af and new metod to upgrade dailyWage 2025-08-23 07:09:56 +03:30
SamSys
2f60883ea2 add new prop to contractTable - compute dailyWage 2025-08-23 04:27:04 +03:30
SamSys
df1e6f62b8 new manualdailywage metod to create contract 2025-08-21 15:55:53 +03:30
SamSys
856ed38f08 Merge branch 'master' into ManualDailyWageContractSide 2025-08-21 01:49:27 +03:30
SamSys
4a3515ad65 manualDailyWage frontEnd Completed 2025-08-20 02:52:06 +03:30
SamSys
49b84b50a5 add dailywage select on create contract front 2025-08-18 05:33:31 +03:30
148 changed files with 80262 additions and 5442 deletions

View File

@@ -0,0 +1,237 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace _0_Framework.Application;
/// <summary>
/// دامنه امتیازات گروه های طبقه بندی مشاغل
/// </summary>
public static class ClassificationRangeOfGroupRate
{
/// <summary>
/// دریافت فاصله امتیاز گروه
/// </summary>
/// <param name="groupNo"></param>
/// <returns></returns>
public static ClassificationGroupRate GetGroupDistanceRate(string groupNo)
{
switch (groupNo)
{
case "1":
return new ClassificationGroupRate()
{
GroupNo = groupNo,
LowRate = 0,
HighRate = 80,
DistanceRate = 0,
};
break;
case "2":
return new ClassificationGroupRate()
{
GroupNo = groupNo,
LowRate = 81,
HighRate = 95,
DistanceRate = 15,
};
break;
case "3":
return new ClassificationGroupRate()
{
GroupNo = groupNo,
LowRate = 96,
HighRate = 110,
DistanceRate = 30, //فاصله سقف این گروه تا سقف گروه یک
};
break;
case "4":
return new ClassificationGroupRate()
{
GroupNo = groupNo,
LowRate = 111,
HighRate = 125,
DistanceRate = 45, //فاصله سقف این گروه تا سقف گروه یک
};
break;
case "5":
return new ClassificationGroupRate()
{
GroupNo = groupNo,
LowRate = 126,
HighRate = 145,
DistanceRate = 65, //فاصله سقف این گروه تا سقف گروه یک
};
break;
case "6":
return new ClassificationGroupRate()
{
GroupNo = groupNo,
LowRate = 146,
HighRate = 165,
DistanceRate = 85,
};
break;
case "7":
return new ClassificationGroupRate()
{
GroupNo = groupNo,
LowRate = 166,
HighRate = 185,
DistanceRate = 105,
};
break;
case "8":
return new ClassificationGroupRate()
{
GroupNo = groupNo,
LowRate = 186,
HighRate = 210,
DistanceRate = 130,
};
break;
case "9":
return new ClassificationGroupRate()
{
GroupNo = groupNo,
LowRate = 211,
HighRate = 235,
DistanceRate = 155,
};
break;
case "10":
return new ClassificationGroupRate()
{
GroupNo = groupNo,
LowRate = 236,
HighRate = 265,
DistanceRate = 185,
};
break;
case "11":
return new ClassificationGroupRate()
{
GroupNo = groupNo,
LowRate = 266,
HighRate = 295,
DistanceRate = 215,
};
break;
case "12":
return new ClassificationGroupRate()
{
GroupNo = groupNo,
LowRate = 296,
HighRate = 325,
DistanceRate = 245,
};
break;
case "13":
return new ClassificationGroupRate()
{
GroupNo = groupNo,
LowRate = 326,
HighRate = 365,
DistanceRate = 285,
};
break;
case "14":
return new ClassificationGroupRate()
{
GroupNo = groupNo,
LowRate = 366,
HighRate = 405,
DistanceRate = 325,
};
break;
case "15":
return new ClassificationGroupRate()
{
GroupNo = groupNo,
LowRate = 406,
HighRate = 445,
DistanceRate = 365,
};
break;
case "16":
return new ClassificationGroupRate()
{
GroupNo = groupNo,
LowRate = 446,
HighRate = 495,
DistanceRate = 415,
};
break;
case "17":
return new ClassificationGroupRate()
{
GroupNo = groupNo,
LowRate = 496,
HighRate = 545,
DistanceRate = 465,
};
break;
case "18":
return new ClassificationGroupRate()
{
GroupNo = groupNo,
LowRate = 546,
HighRate = 605,
DistanceRate = 525,
};
break;
case "19":
return new ClassificationGroupRate()
{
GroupNo = groupNo,
LowRate = 606,
HighRate = 665,
DistanceRate = 585,
};
break;
case "20":
return new ClassificationGroupRate()
{
GroupNo = groupNo,
LowRate = 666,
HighRate = 740,
DistanceRate = 660,
};
break;
}
return new ClassificationGroupRate();
}
}
/// <summary>
/// دیتای امتیازات هر گرو
/// </summary>
public class ClassificationGroupRate
{
/// <summary>
/// شمازه گروه
/// </summary>
public string GroupNo { get; set; }
/// <summary>
/// امتیاز کف
/// </summary>
public int LowRate { get; set; }
/// <summary>
/// امتیاز سقف
/// </summary>
public int HighRate { get; set; }
/// <summary>
/// فاصله امتیاز
/// </summary>
public int DistanceRate { get; set; }
}

View File

@@ -0,0 +1,14 @@
namespace _0_Framework.Application.Enums;
public enum TypeOfCoefficient
{
/// <summary>
/// ضریب ریالی طرح
/// </summary>
RialCoefficient,
/// <summary>
/// ضریب ریالی اداره کار
/// </summary>
JobOrganization,
}

View File

@@ -33,6 +33,35 @@ public static class Tools
public static string[] DayNames = { "شنبه", "یکشنبه", "دو شنبه", "سه شنبه", "چهار شنبه", "پنج شنبه", "جمعه" };
public static string[] DayNamesG = { "یکشنبه", "دو شنبه", "سه شنبه", "چهار شنبه", "پنج شنبه", "جمعه", "شنبه" };
/// <summary>
/// نام ستون از جدول مزد سنوات طبثه بندی را میگیرد و دیتای داخل آن ستون را برمیگرداند
/// </summary>
/// <param name="obj"></param>
/// <param name="propertyName"></param>
/// <returns></returns>
public static double? GetDynamicDouble(object obj, string propertyName)
{
if (obj == null || string.IsNullOrWhiteSpace(propertyName))
return null;
var propertyInfo = obj.GetType().GetProperty(propertyName);
if (propertyInfo == null)
return null;
var value = propertyInfo.GetValue(obj);
if (value == null)
return null;
try
{
return Convert.ToDouble(value);
}
catch
{
return null;
}
}
public static bool IsMobileValid(this string mobileNo)
{
@@ -477,26 +506,42 @@ public static class Tools
string bb = string.Empty;
bool isNegative = false;
for (int x = 0; x < myMoney.Length; x++)
try
{
if (char.IsDigit(myMoney[x]))
if (!string.IsNullOrWhiteSpace(myMoney))
{
bb += myMoney[x];
}
else if (myMoney[x] == '-' && bb.Length == 0)
{
// اگر علامت منفی قبل از اولین عدد آمد، در نظر بگیر
isNegative = true;
}
}
for (int x = 0; x < myMoney.Length; x++)
{
if (char.IsDigit(myMoney[x]))
{
bb += myMoney[x];
}
else if (myMoney[x] == '-' && bb.Length == 0)
{
// اگر علامت منفی قبل از اولین عدد آمد، در نظر بگیر
isNegative = true;
}
}
if (bb.Length > 0)
{
double res = double.Parse(bb);
return isNegative ? -res : res;
if (bb.Length > 0)
{
double res = double.Parse(bb);
return isNegative ? -res : res;
}
else
{
return 0;
}
}
else
{
return 0;
}
}
else
catch (Exception)
{
return 0;
}
}

View File

@@ -5,14 +5,14 @@ namespace _0_Framework.InfraStructure;
public static class QueryableExtensions
{
public static IQueryable<T> ApplyPagination<T>(this IQueryable<T> query, int page, int pageSize)
public static IQueryable<T> ApplyPagination<T>(this IQueryable<T> query, int page, int pageSize = 30)
{
if (page <= 0) page = 1;
if (pageSize <= 0) pageSize = 10;
return query.Skip((page - 1) * pageSize).Take(pageSize);
}
public static IEnumerable<T> ApplyPagination<T>(this IEnumerable<T> source, int page, int pageSize)
public static IEnumerable<T> ApplyPagination<T>(this IEnumerable<T> source, int page, int pageSize = 30)
{
if (page <= 0) page = 1;
if (pageSize <= 0) pageSize = 10;

View File

@@ -0,0 +1,80 @@
using _0_Framework.Domain;
using System;
namespace Company.Domain.ClassificationSchemeAgg;
public class ClassificationEmployee : EntityBase
{
/// <summary>
/// ایجاد پرسنل طرح
/// </summary>
/// <param name="workshopId"></param>
/// <param name="employeeId"></param>
/// <param name="classificationSchemeId"></param>
/// <param name="classificationGroupId"></param>
/// <param name="classificationGroupJobId"></param>
public ClassificationEmployee(long workshopId, long employeeId, long classificationSchemeId, long classificationGroupId, long classificationGroupJobId)
{
WorkshopId = workshopId;
EmployeeId = employeeId;
ClassificationSchemeId = classificationSchemeId;
ClassificationGroupId = classificationGroupId;
ClassificationGroupJobId = classificationGroupJobId;
}
/// <summary>
/// آی دی کارگاه
/// </summary>
public long WorkshopId { get; private set; }
/// <summary>
/// آی دی پرسنل
/// </summary>
public long EmployeeId { get; private set; }
/// <summary>
/// آی دی طرح
/// </summary>
public long ClassificationSchemeId { get; private set; }
/// <summary>
/// آی دی گروه
/// </summary>
public long ClassificationGroupId { get; private set; }
/// <summary>
/// آی دی شغل
/// </summary>
public long ClassificationGroupJobId { get; private set; }
/// <summary>
/// تاریخ شروع استفاده از گروه
/// </summary>
public DateTime? StartGroupDate{ get; private set; }
/// <summary>
/// تاریخ پایان استفاده از گروه
/// </summary>
public DateTime? EndGroupDate { get; private set; }
public ClassificationGroup ClassificationGroup { get; set; }
/// <summary>
/// ویرایش پرسنل طرح
/// </summary>
/// <param name="workshopId"></param>
/// <param name="employeeId"></param>
/// <param name="classificationSchemeId"></param>
/// <param name="classificationGroupId"></param>
/// <param name="classificationGroupJobId"></param>
public void Edit(long classificationGroupId, long classificationGroupJobId)
{
ClassificationGroupId = classificationGroupId;
ClassificationGroupJobId = classificationGroupJobId;
}
}

View File

@@ -0,0 +1,43 @@
using System.Collections.Generic;
using _0_Framework.Domain;
namespace Company.Domain.ClassificationSchemeAgg;
public class ClassificationGroup : EntityBase
{
/// <summary>
/// ایجاد گروه های بیست گانه طرح طبقه بندی
/// </summary>
/// <param name="groupNo"></param>
/// <param name="workshopId"></param>
/// <param name="classificationSchemeId"></param>
public ClassificationGroup(string groupNo, long workshopId, long classificationSchemeId)
{
GroupNo = groupNo;
WorkshopId = workshopId;
ClassificationSchemeId = classificationSchemeId;
}
/// <summary>
/// شماره گروه
/// </summary>
public string GroupNo { get; private set; }
/// <summary>
/// آی دی کارگاه
/// </summary>
public long WorkshopId { get; private set; }
/// <summary>
/// آی دی طرح
/// </summary>
public long ClassificationSchemeId { get; private set; }
public ClassificationScheme ClassificationScheme { get; set; }
public List<ClassificationGroupJob> ClassificationGroupJobs { get; set; }
public List<ClassificationGroupSalary> ClassificationGroupSalaries { get; set; }
public List<ClassificationEmployee> ClassificationEmployees { get; set; }
}

View File

@@ -0,0 +1,55 @@
using _0_Framework.Domain;
using _0_Framework_b.Domain;
namespace Company.Domain.ClassificationSchemeAgg;
public class ClassificationGroupJob : EntityBaseWithoutCreationDate
{
/// <summary>
/// ایجاد لیست مشغال برای گروه های طرح طبقه بندی
/// </summary>
/// <param name="jobId"></param>
/// <param name="jobName"></param>
/// <param name="jobCode"></param>
/// <param name="classificationGroupId"></param>
/// <param name="groupNo"></param>
public ClassificationGroupJob(long jobId, string jobName, string jobCode, long classificationGroupId, string groupNo)
{
JobId = jobId;
JobName = jobName;
JobCode = jobCode;
ClassificationGroupId = classificationGroupId;
GroupNo = groupNo;
}
/// <summary>
/// آی دی شغل
/// </summary>
public long JobId { get; private set; }
/// <summary>
/// نام شغل
/// </summary>
public string JobName { get; private set; }
/// <summary>
/// کد شغل
/// </summary>
public string JobCode { get; private set; }
/// <summary>
/// آی دی گروه
/// </summary>
public long ClassificationGroupId { get; private set; }
/// <summary>
/// شماره گروه
/// </summary>
public string GroupNo { get; private set; }
public ClassificationGroup ClassificationGroup { get; set; }
}

View File

@@ -0,0 +1,82 @@
using _0_Framework.Domain;
using System;
namespace Company.Domain.ClassificationSchemeAgg;
public class ClassificationGroupSalary : EntityBase
{
/// <summary>
/// ایجاد دستمزد برای گروه
/// </summary>
/// <param name="classificationGroupId"></param>
/// <param name="groupNo"></param>
/// <param name="groupSalary"></param>
/// <param name="startDate"></param>
/// <param name="endDate"></param>
/// <param name="year"></param>
public ClassificationGroupSalary(long classificationGroupId, string groupNo, double groupSalary, DateTime startDate, DateTime endDate, int year, long schemeId)
{
ClassificationGroupId = classificationGroupId;
GroupNo = groupNo;
GroupSalary = groupSalary;
StartDate = startDate;
EndDate = endDate;
Year = year;
SchemeId = schemeId;
}
/// <summary>
/// آی دی گروه
/// </summary>
public long ClassificationGroupId { get; private set; }
/// <summary>
/// شماره گروه
/// </summary>
public string GroupNo { get; private set; }
/// <summary>
/// دستمزد گروه
/// </summary>
public double GroupSalary { get; private set; }
/// <summary>
/// تاریخ شروع
/// </summary>
public DateTime StartDate { get; private set; }
/// <summary>
/// تاریخ پایان
/// </summary>
public DateTime EndDate { get; private set; }
/// <summary>
/// سال
/// </summary>
public int Year { get; private set; }
public long SchemeId { get; private set; }
public ClassificationGroup ClassificationGroup { get; set; }
/// <summary>
/// ویرایش دستمزد گروه
/// </summary>
/// <param name="groupSalary"></param>
/// <param name="startDate"></param>
/// <param name="endDate"></param>
/// <param name="year"></param>
public void Edit(double groupSalary, DateTime startDate, DateTime endDate, int year)
{
GroupSalary = groupSalary;
StartDate = startDate;
EndDate = endDate;
Year = year;
}
}

View File

@@ -0,0 +1,68 @@
using System;
using _0_Framework.Domain;
namespace Company.Domain.ClassificationSchemeAgg;
public class ClassificationRialCoefficient : EntityBaseWithoutCreationDate
{
/// <summary>
/// ایچاد ضریب ریالی
/// </summary>
/// <param name="classificationSchemeId"></param>
/// <param name="rialCoefficient"></param>
/// <param name="startDate"></param>
/// <param name="endDate"></param>
/// <param name="year"></param>
public ClassificationRialCoefficient(long classificationSchemeId, double rialCoefficient, DateTime startDate, DateTime endDate, int year)
{
ClassificationSchemeId = classificationSchemeId;
RialCoefficient = rialCoefficient;
StartDate = startDate;
EndDate = endDate;
Year = year;
}
//آی دی طرح
public long ClassificationSchemeId { get; private set; }
/// <summary>
/// ضریب ریالی
/// </summary>
public double RialCoefficient { get; private set; }
/// <summary>
/// تاریخ شروع
/// </summary>
public DateTime StartDate { get; private set; }
/// <summary>
/// تاریخ پایان
/// </summary>
public DateTime EndDate { get; private set; }
/// <summary>
/// سال
/// </summary>
public int Year { get; private set; }
public ClassificationScheme ClassificationScheme { get; set; }
/// <summary>
/// ویرایش ضریب ریالی
/// </summary>
/// <param name="classificationSchemeId"></param>
/// <param name="rialCoefficient"></param>
/// <param name="startDate"></param>
/// <param name="endDate"></param>
/// <param name="year"></param>
public void Edit(double rialCoefficient, DateTime startDate, DateTime endDate, int year)
{
RialCoefficient = rialCoefficient;
StartDate = startDate;
EndDate = endDate;
Year = year;
}
}

View File

@@ -0,0 +1,88 @@
using System;
using System.Collections.Generic;
using _0_Framework.Application.Enums;
using _0_Framework.Domain;
namespace Company.Domain.ClassificationSchemeAgg;
public class ClassificationScheme : EntityBase
{
/// <summary>
/// ایجاد طرح طبقه بندی مشاغل
/// </summary>
/// <param name="includingDateGr"></param>
/// <param name="executionDateGr"></param>
/// <param name="designerFullName"></param>
/// <param name="designerPhone"></param>
/// <param name="workshopId"></param>
/// <param name="typeOfCoefficient"></param>
public ClassificationScheme(DateTime includingDateGr, DateTime executionDateGr, string designerFullName, string designerPhone, long workshopId, TypeOfCoefficient typeOfCoefficient)
{
IncludingDateGr = includingDateGr;
ExecutionDateGr = executionDateGr;
DesignerFullName = designerFullName;
DesignerPhone = designerPhone;
WorkshopId = workshopId;
TypeOfCoefficient = typeOfCoefficient;
}
/// <summary>
/// تاریخ شمول طرح
/// </summary>
public DateTime IncludingDateGr { get; private set; }
/// <summary>
/// تاریخ اجرای طرح
/// </summary>
public DateTime ExecutionDateGr { get; private set; }
/// <summary>
/// تاریخ پایان طرح
/// </summary>
public DateTime? EndSchemeDateGr { get; private set; }
/// <summary>
/// نام کامل طراح
/// </summary>
public string DesignerFullName { get; private set; }
/// <summary>
/// شماره همراه طراح
/// </summary>
public string DesignerPhone { get; private set; }
/// <summary>
/// آی دی کارگاه
/// </summary>
public long WorkshopId { get; private set; }
/// <summary>
/// نوع ضریب
/// </summary>
public TypeOfCoefficient TypeOfCoefficient { get; private set; }
public List<ClassificationGroup> ClassificationGroups { get; set; }
public List<ClassificationRialCoefficient> ClassificationRialCoefficients { get; set; }
/// <summary>
/// ویرایش طرح
/// </summary>
/// <param name="includingDateGr"></param>
/// <param name="executionDateGr"></param>
/// <param name="designerFullName"></param>
/// <param name="designerPhone"></param>
/// <param name="workshopId"></param>
public void Edit(DateTime includingDateGr, DateTime executionDateGr,string designerFullName, string designerPhone, TypeOfCoefficient typeOfCoefficient)
{
IncludingDateGr = includingDateGr;
ExecutionDateGr = executionDateGr;
DesignerFullName = designerFullName;
DesignerPhone = designerPhone;
TypeOfCoefficient = typeOfCoefficient;
}
}

View File

@@ -0,0 +1,25 @@
using _0_Framework.Domain;
using CompanyManagment.App.Contracts.ClassificationScheme;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Company.Domain.ClassificationSchemeAgg;
public interface IClassificationEmployeeRepository : IRepository<long, ClassificationEmployee>
{
/// <summary>
/// دریافت لیست پرسنل کارگاه
/// تب افزودن پرسنل
/// </summary>
/// <param name="schemeId"></param>
/// <returns></returns>
Task<List<EmployeeInfoList>> GetEmployeeListData(long schemeId);
/// <summary>
/// دریافت اطلاعات عضویتی پرسنل در گروه
/// </summary>
/// <param name="employeeId"></param>
/// <returns></returns>
Task<ClassificationEmployee> GetEmployeeMemberizeData(long employeeId);
}

View File

@@ -0,0 +1,61 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using _0_Framework.Domain;
using CompanyManagment.App.Contracts.ClassificationScheme;
namespace Company.Domain.ClassificationSchemeAgg;
public interface IClassificationGroupRepository : IRepository<long, ClassificationGroup>
{
/// <summary>
/// دریافت گروه های طرح
/// </summary>
/// <param name="schemeId"></param>
/// <returns></returns>
Task<List<ClassificationGroupList>> GetGroups(long schemeId);
/// <summary>
/// دریافت گروه ها و مشاغلشان برای تب تعیین مشاغل
/// </summary>
/// <param name="schemeId"></param>
/// <returns></returns>
Task<List<ClassificationGroupAndJobModel>> GetGroupAndJobs(long schemeId);
/// <summary>
/// دریافت مشاغل گروه توسط آی دی گروه
/// </summary>
/// <param name="groupId"></param>
/// <returns></returns>
Task<List<EditClassificationGroupJob>> GetGroupJobs(long groupId);
/// <summary>
/// چک میکند که آی پرسنلی وجود دارد که این شغل به او نسبت داده شده
/// </summary>
/// <param name="id"></param>
/// <param name="groupId"></param>
/// <returns></returns>
Task<bool> CheckEmployeeHasThisJob(long id, long groupId);
/// <summary>
/// ایجاد مشاغل
/// </summary>
/// <param name="createClassificationGroupJob"></param>
/// <param name="deleteJobList"></param>
/// <returns></returns>
Task<bool> CreateJobs(List<ClassificationGroupJob> createClassificationGroupJob, List<long> deleteJobList);
/// <summary>
/// در یافت اطلاعات گروه برای لود مودال ایجاد دستمزد های
/// </summary>
/// <returns></returns>
Task<SalaryAndRialCoefficientModel> GetGroupToCreateSalariesModal(long schemeId);
/// <summary>
/// ایجاد گروه های بیست گانه
/// </summary>
/// <param name="groupList"></param>
/// <returns></returns>
Task CreateGroups(List<ClassificationGroup> groupList);
}

View File

@@ -0,0 +1,34 @@
using _0_Framework.Domain;
using CompanyManagment.App.Contracts.ClassificationScheme;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Company.Domain.ClassificationSchemeAgg;
public interface IClassificationGroupSalariesRepository : IRepository<long, ClassificationGroupSalary>
{
/// <summary>
/// ایجاد دستمزدهای گروه ها
/// </summary>
/// <param name="createClassificationGroupSalary"></param>
/// <returns></returns>
Task CreateSalaries(List<ClassificationGroupSalary> createClassificationGroupSalary);
/// <summary>
/// دریافت دستمزدها و ضریب ریالی برای مودال ویرایش
/// </summary>
/// <param name="schemeId"></param>
/// <param name="startDate"></param>
/// <param name="endDate"></param>
/// <returns></returns>
Task<SalaryAndRialCoefficientModel> GetEditSalariesData(long schemeId, string startDate, string endDate);
/// <summary>
/// لیست دستمزدها بر اساس تاریخ و سال برای تب دستمزدها
/// </summary>
/// <param name="schemeId"></param>
/// <returns></returns>
Task<SalaryAndRialCoefficientTab> GetSalariesTabData(long schemeId);
}

View File

@@ -0,0 +1,8 @@
using _0_Framework.Domain;
namespace Company.Domain.ClassificationSchemeAgg;
public interface IClassificationRialCoefficientRepository : IRepository<long, ClassificationRialCoefficient>
{
}

View File

@@ -0,0 +1,42 @@
using _0_Framework.Application;
using _0_Framework.Domain;
using CompanyManagment.App.Contracts.ClassificationScheme;
using CompanyManagment.App.Contracts.YearlySalary;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Company.Domain.ClassificationSchemeAgg;
public interface IClassificationSchemeRepository : IRepository<long, ClassificationScheme>
{
/// <summary>
/// پارشیال صفحه ایجاد طرح
/// </summary>
/// <param name="worskhopId"></param>
/// <returns></returns>
Task<ClassificationSchemePartialModel> ClassificationSchemePartialModel(long workshopId);
/// <summary>
/// دریافت اطلاعات طرح برای ویرایش
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
Task<EditClassificationScheme> GetClassificationScheme(long id);
/// <summary>
/// متد محاسبه پایه سنوات برا افراد تک گروه
/// </summary>
/// <param name="schemeStart">تاریخ شروع طرح</param>
/// <param name="schemeEnd">تاریخ پاین طرح، اجباری نیست</param>
/// <param name="contractStart">تاریخ شروع قراداد</param>
/// <param name="contractEnd">تاریخ پایان قراداد</param>
/// <param name="groupNo">شماره گروه</param>
/// <param name="employeeId">آی دی پرسنل</param>
/// <param name="workshopId">آی دی کارگاه</param>
/// <returns></returns>
Task<BaseYearDataViewModel> BaseYearComputeOneGroup(DateTime schemeStart, DateTime? schemeEnd,
DateTime contractStart, DateTime contractEnd, string groupNo, long employeeId, long workshopId);
}

View File

@@ -10,7 +10,7 @@ namespace Company.Domain.ClassifiedSalaryAgg
{
public class ClassifiedSalary : EntityBase
{
//test
//test//test
public ClassifiedSalary(double group1, double group2, double group3, double group4, double group5, double group6, double group7, double group8, double group9, double group10, double group11, double group12, double group13, double group14, double group15, double group16, double group17, double group18, double group19, double group20, DateTime startDate, DateTime endDate, int year)
{
Group1 = group1;

View File

@@ -17,7 +17,7 @@ public class Contract : EntityBase
public Contract(long personnelCode, long employeeId, long employerId,
long workshopIds, long yearlySalaryId, DateTime contarctStart, DateTime contractEnd, string dayliWage,
string archiveCode, DateTime getWorkDate, DateTime setContractDate, string jobType,
string contractType, string workshopAddress1, string workshopAddress2, string consumableItems, long jobTypeId, string housingAllowance, string agreementSalary, string workingHoursWeekly, string familyAllowance, string contractPeriod)
string contractType, string workshopAddress1, string workshopAddress2, string consumableItems, long jobTypeId, string housingAllowance, string agreementSalary, string workingHoursWeekly, string familyAllowance, string contractPeriod, double dailySalaryAffected, double baseYearAffected, double dailySalaryUnAffected, double baseYearUnAffected, bool hasManualDailyWage, string dailyWageType)
{
PersonnelCode = personnelCode;
EmployeeId = employeeId;
@@ -45,6 +45,19 @@ public class Contract : EntityBase
WorkingHoursWeekly = workingHoursWeekly;
FamilyAllowance = familyAllowance;
ContractPeriod = contractPeriod;
//پراپرتی های جدید برای دستمزد دلخواه
#region NewManualDailyWage
DailySalaryAffected = dailySalaryAffected;
BaseYearAffected = baseYearAffected;
DailySalaryUnAffected = dailySalaryUnAffected;
BaseYearUnAffected = baseYearUnAffected;
HasManualDailyWage = hasManualDailyWage;
DailyWageType = dailyWageType;
#endregion
Signature = "0";
@@ -65,7 +78,42 @@ public class Contract : EntityBase
public DateTime SetContractDate { get; private set; }
public string JobType { get; private set; }
public string ContractType { get; private set; }
/// <summary>
/// مزد تجمیعی یعد از تاثیر ساعت کار
/// </summary>
public string DayliWage { get; private set; }
/// <summary>
/// دستمزد روزانه خام بعد از تاثیر ساعت کار
/// </summary>
public double DailySalaryAffected { get; set; }
/// <summary>
/// پایه سنوات بعد از تاثیر ساعت کار
/// </summary>
public double BaseYearAffected { get; set; }
/// <summary>
/// دستمزد روزانه قبل از تاثیر ساعت کار
/// </summary>
public double DailySalaryUnAffected { get; set; }
/// <summary>
/// پایه سنوات قبل از تاثیر ساعت کار
/// </summary>
public double BaseYearUnAffected { get; set; }
/// <summary>
/// آیا دستمزد روزانه دستی وارد شده است؟
/// </summary>
public bool HasManualDailyWage { get; set; }
/// <summary>
/// نوع دستمزد انتخاب شده
/// </summary>
public string DailyWageType { get; set; }
public string IsActiveString { get; private set; }
public string ArchiveCode { get; private set; }
public string WorkshopAddress1 { get; private set; }
@@ -89,6 +137,7 @@ public class Contract : EntityBase
public Contract()
{
WorkingHoursList = new List<WorkingHours>();
}
public void Edit(long pesrsonnelCode, long employeeId, long employerId, long workshopId, long yearlySalaryId,

View File

@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using _0_Framework.Application;
using _0_Framework.Domain;
using CompanyManagment.App.Contracts.Contract;
@@ -9,6 +10,24 @@ namespace Company.Domain.ContractAgg;
public interface IContractRepository : IRepository<long, Contract>
{
/// <summary>
/// دریافت مزد ارتقاء یافته
/// </summary>
/// <param name="workshopId"></param>
/// <param name="employeeId"></param>
/// <param name="yearlySalaryId"></param>
/// <returns></returns>
Task<double> GetManualDailWage(long workshopId, long employeeId, long yearlySalaryId, DateTime contractStart);
/// <summary>
/// دریافت لیست مزد ارتقاء یافته
/// </summary>
/// <param name="workshopId"></param>
/// <param name="employeeId"></param>
/// <param name="contractStart"></param>
/// <returns></returns>
Task<UpgradeManualDailyWageModel> GetManualDailWageList(long workshopId, long employeeId,
DateTime contractStart);
EditContract GetDetails(long id);
EditContract GetContractByStartEnd(DateTime start, DateTime end, long workshopId, long employeeId);

View File

@@ -67,6 +67,8 @@ public interface IInsuranceListRepository:IRepository<long, InsuranceList>
Task<InsuranceListTabsCountViewModel> GetTabCounts(InsuranceListSearchModel searchModel);
#endregion
Task<List<InsuranceListViewModel>> GetNotCreatedWorkshop(InsuranceListSearchModel searchModel);
}

View File

@@ -11,6 +11,13 @@ public interface IJobRepository : IRepository<long, Job>
EditJob GetDetails(long id);
List<JobViewModel> Search(JobSearchModel searchModel);
List<JobViewModel> SearchJobForMain(JobSearchModel searchModel);
/// <summary>
/// جستجوس مشاغل
/// </summary>
/// <param name="searchtText"></param>
/// <returns></returns>
Task<List<JobViewModel>> JobSearchSelect(string searchtText);
// Task<List<JobViewModel>> GetJobListByText(string searchtText);
List<JobViewModel> GetJobListByText(string searchtText);
List<JobViewModel> GetJobListByWorkshopId(long workshopId);

View File

@@ -22,7 +22,7 @@ public interface ILeaveRepository : IRepository<long, Leave>
bool CheckContractExist(DateTime myDate,long employeeId, long workshopId);
LeavErrorViewModel CheckErrors(DateTime startLeav, DateTime endLeav, long employeeId, long workshopId);
LeavErrorViewModel CheckErrors(DateTime startLeav, DateTime endLeav, long employeeId, long workshopId,bool isInvalid);
LeaveViewModel LeavOnChekout(DateTime starContract, DateTime endContract, long employeeId, long workshopId);
List<LeaveMainViewModel> searchClient(LeaveSearchModel searchModel);
LeavePrintViewModel PrintOne(long id);

View File

@@ -8,7 +8,9 @@ public class Leave: EntityBase
{
public Leave(DateTime startLeave, DateTime endLeave,
string leaveHourses, long workshopId, long employeeId,
string paidLeaveType, string leaveType, string employeeFullName, string workshopName, bool isAccepted, string decription, int year, int month, TimeSpan shiftDuration, bool hasShiftDuration)
string paidLeaveType, string leaveType, string employeeFullName, string workshopName,
bool isAccepted, string decription, int year, int month, TimeSpan shiftDuration,
bool hasShiftDuration,bool isInvalid)
{
StartLeave = startLeave;
EndLeave = endLeave;
@@ -25,6 +27,7 @@ public class Leave: EntityBase
Month = month;
ShiftDuration = shiftDuration;
HasShiftDuration = hasShiftDuration;
IsInvalid = isInvalid;
}
public DateTime StartLeave { get; private set; }
@@ -43,6 +46,10 @@ public class Leave: EntityBase
public TimeSpan ShiftDuration { get; private set; }
public bool HasShiftDuration { get; private set; }
/// <summary>
///آیا فاقد اعتبار است. فاقد اعتبار ها فقط برای فیش های غیررسمی مورد استفاده قرار میگیرند
/// </summary>
public bool IsInvalid { get; private set; }
public void Edit(DateTime startLeave, DateTime endLeave,
string leaveHourses, long workshopId, long employeeId,

View File

@@ -15,7 +15,7 @@ namespace Company.Domain.RollCallAgg;
public interface IRollCallMandatoryRepository : IRepository<long, RollCall>
{
ComputingViewModel MandatoryCompute(long employeeId, long workshopId, DateTime contractStart, DateTime contractEnd, CreateWorkingHoursTemp command, bool holidayWorking, bool isStaticCheckout, bool rotatingShiftCompute, bool totalLeaveCompute);
ComputingViewModel MandatoryCompute(long employeeId, long workshopId, DateTime contractStart, DateTime contractEnd, CreateWorkingHoursTemp command, bool holidayWorking, bool isStaticCheckout, bool rotatingShiftCompute, double dailyWageUnAffected, bool totalLeaveCompute);
/// <summary>
/// محاسبه ساعات کارکرد پرسنل در صورت داشتن حضور غیاب

View File

@@ -185,8 +185,17 @@ public class Workshop : EntityBase
public bool AddLeavePay { get; private set; }
public string ZoneName { get; private set; }
public bool TotalPaymentHide { get; private set; }
/// <summary>
/// آیا طبقه بندی شده است
/// [کارگاه دارای طرح طبقه بندی می باشد ؟]
/// </summary>
public bool IsClassified { get; private set; }
/// <summary>
/// آیا طرح طبقه بندی تکمیل شده است
/// </summary>
public bool IsClassificationSchemeCompleted { get; private set; }
//نحوه محاسبه مزد مرخصی
public string ComputeOptions { get; private set; }

View File

@@ -6,6 +6,7 @@ using CompanyManagment.App.Contracts.YearlySalary;
using System.Threading.Tasks;
using CompanyManagment.App.Contracts.Checkout;
using CompanyManagment.App.Contracts.Holiday;
using CompanyManagment.App.Contracts.Contract;
namespace Company.Domain.YearlySalaryAgg;
@@ -17,11 +18,39 @@ public interface IYearlySalaryRepository : IRepository<long, YearlySalary>
void TestDayliFeeCompute();
List<string> GetYears();
List<YearlySalaryViewModel> GetYearlySalary();
/// <summary>
/// دریافت مزد روزانه فیش حقوقی
/// </summary>
/// <param name="contract"></param>
/// <param name="checkoutStart"></param>
/// <param name="checkoutEnd"></param>
/// <returns></returns>
Task<double> GetCheckoutDailyWage(EditContract contract, DateTime checkoutStart, DateTime checkoutEnd);
/// <summary>
/// دریافت مزد روزانه بر اساس تاریخ شروع و پایان
/// </summary>
/// <param name="start"></param>
/// <param name="end"></param>
/// <returns></returns>
Task<(double dailyWage, long yearlySalaryId)> GetDailyWageByStartEnd(DateTime start, DateTime end);
MontlywageBunosYearsViewModel GetMontlyBunosYears(TimeSpan weeklyTime, DateTime contractStart,DateTime contractEnd, double daylyWage, string weeklyWorkingTime, int officialholiday, int friday, string totalHoursH, string totalHorsM, string basic, int fridayStartToEnd, double dayliFeeComplete, bool hasRollCall, bool holidaysWorking,string shiftWork);
double GetLeavePay(DateTime contractStart, DateTime contractEnd, double daylyWage, double consumableItem, double housingAllowance, double familyAllowance , string weeklyWorkingTime, int officialholiday, int friday, string totalHoursH, string totalHorsM);
double GetOverTimeWorking(double dayliWage, string overTimeWorkH, string overTimeWorkM);
double GetOverNightWorking(double dayliWage, string overNightWorkH, string overNightWorkM, string weeklyWorkingTime, int officialholiday, int friday, DateTime contractStart, DateTime contractEnd, string totalHoursH, string totalHorsM);
/// <summary>
/// متد ارتقاء مزد دلخواه
/// </summary>
/// <param name="newContractStart"></param>
/// <param name="lastContractStart"></param>
/// <param name="lastContractManualDailyWage"></param>
/// <returns></returns>
Task<UpgradeManualDailyWageModel> UpgradeManualDailyWage(DateTime newContractStart, DateTime lastContractStart,
double lastContractManualDailyWage);
/// <summary>
/// متد محاسبه پایه سنوات و لیست پایه سنوات های پرسنل
/// </summary>

View File

@@ -160,4 +160,37 @@ public class CreateCheckout
public TimeSpan TotalPaidLeave { get; set; }
public TimeSpan TotalSickLeave { get; set; }
public bool HasLeft { get; set; }
/// <summary>
/// دستمزد روزانه خام بعد از تاثیر ساعت کار
/// </summary>
public double DailySalaryAffected { get; set; }
/// <summary>
/// پایه سنوات بعد از تاثیر ساعت کار
/// </summary>
public double BaseYearAffected { get; set; }
/// <summary>
/// دستمزد روزانه قبل از تاثیر ساعت کار
/// </summary>
public double DailySalaryUnAffected { get; set; }
/// <summary>
/// دستمزد روزانه دریافت شده از سمت فرانت
/// </summary>
public string DailySalaryUnAffectedStr { get; set; }
/// <summary>
/// مزد سالانه نرمال دریافت از سمت فرانت
/// </summary>
public string NormalDailyWage { get; set; }
/// <summary>
/// پایه سنوات قبل از تاثیر ساعت کار
/// </summary>
public double BaseYearUnAffected { get; set; }
}

View File

@@ -0,0 +1,84 @@
using System.Collections.Generic;
namespace CompanyManagment.App.Contracts.ClassificationScheme;
/// <summary>
/// مدل برای مدال افزودن پرسنل ب گروه
/// </summary>
public class AddEmployeeToGroup
{
/// <summary>
/// آی دی
/// </summary>
public long Id { get; set; }
/// <summary>
/// نام کامل پرسنل
/// </summary>
public string EmployeeFullName { get; set; }
/// <summary>
/// آی دی پرسنل
/// </summary>
public long EmployeeId { get; set; }
/// <summary>
/// آی دی طرح
/// </summary>
public long SchemeId { get; set; }
/// <summary>
/// آی دی گروه
/// </summary>
public long GroupId { get; set; }
/// <summary>
/// شماره گروه
/// </summary>
public string GoroupNo { get; set; }
/// <summary>
/// آی دی شغل
/// </summary>
public long JobId { get; set; }
/// <summary>
/// نام شغل
/// </summary>
public string JobName { get; set; }
/// <summary>
/// کد شغل
/// </summary>
public string JobCode { get; set; }
/// <summary>
/// لیست گروه ها
/// </summary>
public List<ClassificationGroupList> ClassificationGroupList{ get; set; }
}
/// <summary>
/// لیست گروه ها
/// </summary>
public class ClassificationGroupList
{
/// <summary>
/// آی دی گروه
/// </summary>
public long GroupId { get; set; }
/// <summary>
/// شماره گروه
/// استرینگ
/// </summary>
public string GroupNo { get; set; }
/// <summary>
/// شماره گروه
/// اینتیجر
/// </summary>
public int GroupNoInt { get; set; }
}

View File

@@ -0,0 +1,104 @@
using System.Collections.Generic;
namespace CompanyManagment.App.Contracts.ClassificationScheme;
/// <summary>
/// ایجاد گروه
/// </summary>
public class ClassificationGroupAndJobModel
{
/// <summary>
/// آی دی گروه
/// </summary>
public long GroupId { get; set; }
/// <summary>
/// شماره گروه
/// استرینگ
/// </summary>
public string GroupNo { get; set; }
/// <summary>
/// شماره گروه نوع عددی
/// </summary>
public int GroupNoInt { get; set; }
/// <summary>
/// آی دی کارگاه
/// </summary>
public long WorkshopId { get; set; }
/// <summary>
/// آی دی طرح
/// </summary>
public long ClassificationSchemeId { get; set; }
/// <summary>
/// لیست مشاغل
/// </summary>
public List<EditClassificationGroupJob> EditClassificationGroupJob { get; set; }
}
/// <summary>
/// ایجاد مشاغل گروه
/// </summary>
public class CreateClassificationGroupJob
{
/// <summary>
/// آی دی شغل
/// </summary>
public long JobId { get; set; }
/// <summary>
/// نام شغل
/// </summary>
public string JobName { get; set; }
/// <summary>
/// کد شغل
/// </summary>
public string JobCode { get; set; }
/// <summary>
/// آی دی گروه
/// </summary>
public long ClassificationGroupId { get; set; }
/// <summary>
/// شماره گروه
/// </summary>
public string GroupNo { get; set; }
}
/// <summary>
/// ویرایش مشاغل گروه
/// </summary>
public class EditClassificationGroupJob : CreateClassificationGroupJob
{
/// <summary>
/// ای دی شغل
/// </summary>
public long Id { get; set; }
}
/// <summary>
/// ایجاد یا ویرایش مشاغل
/// </summary>
public class CreateOrEditGroupJobs
{
/// <summary>
/// آی دی گروه
/// </summary>
public long GroupId { get; set; }
/// <summary>
/// شماره گروه
/// استرینگ
/// </summary>
public string GroupNo { get; set; }
/// <summary>
/// آی دی مشاغل
/// </summary>
public List<long> JobIdList { get; set; }
}

View File

@@ -0,0 +1,24 @@
using System.Collections.Generic;
namespace CompanyManagment.App.Contracts.ClassificationScheme;
/// <summary>
/// پارشیال صفحه ایجاد طرح
/// </summary>
public class ClassificationSchemePartialModel
{
/// <summary>
/// آیا طرح دارد
/// </summary>
public bool HasScheme { get; set; }
/// <summary>
/// آی دی کارگاه
/// </summary>
public long WorkshopId { get; set; }
/// <summary>
/// لیست طرح
/// </summary>
public List<EditClassificationScheme> ClassificationSchemesList { get; set; }
}

View File

@@ -0,0 +1,204 @@
using _0_Framework.Application.Enums;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CompanyManagment.App.Contracts.ClassificationScheme;
/// <summary>
/// ایجاد دستمزد گروه و ضریب ریالی
/// </summary>
public class CreateClassificationGroupSalaryAndRialCoefficient
{
/// <summary>
/// آی دی گروه
/// </summary>
public long ClassificationGroupId { get; set; }
/// <summary>
/// شماره گروه
/// </summary>
public string GroupNo { get; set; }
/// <summary>
/// دستمزد گروه
/// </summary>
public double GroupSalary { get; set; }
/// <summary>
/// تاریخ شروع
/// </summary>
public DateTime StartDate { get; set; }
/// <summary>
/// تاریخ پایان
/// </summary>
public DateTime EndDate { get; set; }
/// <summary>
/// سال
/// </summary>
public int Year { get; set; }
}
/// <summary>
/// ویرایش دستمزد
/// </summary>
public class EditClassificationGroupSalaryAndRialCoefficient : CreateClassificationGroupSalaryAndRialCoefficient
{
/// <summary>
/// آی دی
/// </summary>
public long Id { get; set; }
/// <summary>
/// تاریخ شروع
/// شمسی
/// </summary>
[DataType(DataType.Text)]
public string StartDateFa { get; set; }
/// <summary>
/// تاریخ پایان
/// شمسی
/// </summary>
[DataType(DataType.Text)]
public string EndDateFa { get; set; }
/// <summary>
/// دستمزد گروه
/// </summary>
public string GroupSalaryStr { get; set; }
}
/// <summary>
/// لیست دستمزدها و ضرایب ریالی
/// </summary>
public class SalaryAndRialCoefficientModel
{
/// <summary>
/// تاریخ شروع
/// میلادی
/// </summary>
public DateTime StartDate { get; set; }
/// <summary>
/// تاریخ شروع
/// شمسی
/// </summary>
[DataType(DataType.Text)]
public string StartDateFa { get; set; }
/// <summary>
/// تاریخ پایان
/// میلادی
/// </summary>
public DateTime EndDate { get; set; }
/// <summary>
/// تاریخ پایان
/// شمسی
/// </summary>
[DataType(DataType.Text)]
public string EndDateFa { get; set; }
/// <summary>
/// سال
/// </summary>
public int Year { get; set; }
/// <summary>
/// ضریب ریالی
/// string
/// </summary>
public string RialCoefficientStr { get; set; }
/// <summary>
/// ضریب ریالی
/// double
/// </summary>
public double RialCoefficient { get; set; }
/// <summary>
/// آی دی طرح
/// </summary>
public long SchemeId { get; set; }
/// <summary>
/// نوع ضریب
/// </summary>
public TypeOfCoefficient TypeOfCoefficient { get; set; }
/// <summary>
/// آی دی ضریب ریالی
/// </summary>
public long CoefficientId { get; set; }
/// <summary>
/// لیست دستمزدها و ضرایب بر اساس سال
/// </summary>
public List<EditClassificationGroupSalaryAndRialCoefficient> SalariesAndCoefficientList { get; set; }
}
/// <summary>
/// تب دستمزد ها و ضرایب ریالی
/// </summary>
public class SalaryAndRialCoefficientTab
{
/// <summary>
/// آی دی طرح
/// </summary>
public long SchemeId { get; set; }
/// <summary>
/// آیا دستمزدی قبلا ایجاد شده است؟
/// </summary>
public bool HasAnySalaries { get; set; }
/// <summary>
/// لیست دستمزدها و ضرایب
/// </summary>
public List<SalaryAndRialCoefficientTabDataList> SalaryAndRialCoefficientTabDataList { get; set; }
}
/// <summary>
/// لیست دستمزدها
/// </summary>
public class SalaryAndRialCoefficientTabDataList
{
/// <summary>
/// تاریخ شروع
/// شمسی
/// </summary>
[DataType(DataType.Text)]
public string StartDateFa { get; set; }
/// <summary>
/// تاریخ پایان
/// شمسی
/// </summary>
[DataType(DataType.Text)]
public string EndDateFa { get; set; }
/// <summary>
/// سال
/// </summary>
public int Year { get; set; }
/// <summary>
/// ضریب ریالی
/// string
/// </summary>
public string RialCoefficientStr { get; set; }
}

View File

@@ -0,0 +1,63 @@
using _0_Framework.Application.Enums;
using System;
using System.ComponentModel.DataAnnotations;
namespace CompanyManagment.App.Contracts.ClassificationScheme;
/// <summary>
/// ایجاد طرح
/// </summary>
public class CreateClassificationScheme
{
/// <summary>
/// تاریخ شمول طرح
/// میلادی
/// </summary>
public DateTime IncludingDateGr { get; set; }
/// <summary>
/// تاریخ شمول طرح
/// شمسی
/// </summary>
public string IncludingDateFa { get; set; }
/// <summary>
/// تاریخ اجرای طرح
/// میلادی
/// </summary>
public DateTime ExecutionDateGr { get; set; }
/// <summary>
/// تاریخ اجرای طرح
/// شمسی
/// </summary>
public string ExecutionDateFa { get; set; }
/// <summary>
/// تاریخ پایان طرح
/// </summary>
public DateTime? EndSchemeDateGr { get; set; }
/// <summary>
/// نام کامل طراح
/// </summary>
public string DesignerFullName { get; set; }
/// <summary>
/// شماره همراه طراح
/// </summary>
[RegularExpression("^[0-9]*$", ErrorMessage = "لطفا فقط عدد وارد کنید")]
public string DesignerPhone { get; set; }
/// <summary>
/// آی دی کارگاه
/// </summary>
public long WorkshopId { get; set; }
/// <summary>
/// نوع ضریب
/// </summary>
public TypeOfCoefficient TypeOfCoefficient { get; set; }
}

View File

@@ -0,0 +1,12 @@
namespace CompanyManagment.App.Contracts.ClassificationScheme;
/// <summary>
/// ویرایش طرح
/// </summary>
public class EditClassificationScheme : CreateClassificationScheme
{
/// <summary>
/// آی دی طرح
/// </summary>
public long Id { get; set; }
}

View File

@@ -0,0 +1,110 @@
using System.Collections.Generic;
namespace CompanyManagment.App.Contracts.ClassificationScheme;
/// <summary>
/// جستجوی پرسنل
/// تب افزودن پرسنل طبقه بندی مشاغل
/// </summary>
public class EmployeeInfoTab
{
/// <summary>
/// آی دی کارگاه
/// </summary>
public long WorkshopId { get; set; }
/// <summary>
/// آی دی پرسنل
/// </summary>
public long EmployeeId { get; set; }
/// <summary>
/// نام کامل پرسنل
/// </summary>
public string FullName { get; set; }
/// <summary>
/// آی دی طرح
/// </summary>
public long SchemeId { get; set; }
/// <summary>
/// لیست پرسنل
/// </summary>
public List<EmployeeInfoList> EmployeeInfoList { get; set; }
public List<string> YearlyList { get; set; }
}
/// <summary>
/// لیست پرسنل
/// تب افزودن پرسنل طبقه بندی مشاغل
/// </summary>
public class EmployeeInfoList
{
/// <summary>
/// آی دی پرسنل
/// </summary>
public long EmployeeId { get; set; }
/// <summary>
/// نام کامل پرسنل
/// </summary>
public string FullName { get; set; }
/// <summary>
/// شماره گروه یا گره هایی که پرسنل در آن اضافه شده
/// </summary>
public string GroupNo { get; set; }
/// <summary>
/// آیا پرسنل هیچ گروهی دارد؟
/// </summary>
public bool HasGroup { get; set; }
/// <summary>
/// آخرین تاریخ شروع بکار قراداد
/// </summary>
public string LastStartContractWork { get; set; }
/// <summary>
/// آخرین تاریخ ترک کار قراداد
/// </summary>
public string LastLeftContractWork { get; set; }
/// <summary>
/// آخرین تاریخ شروع بکار بیمه
/// </summary>
public string LastStartInsuranceWork { get; set; }
/// <summary>
/// آخرین تاریخ ترک کار بیمه
/// </summary>
public string LastLeftInsuranceWork { get; set; }
/// <summary>
/// آیا پرسنل قرداد است
/// </summary>
public bool ContractPerson { get; set; }
/// <summary>
/// آیا پرسنل بیمه است
/// </summary>
public bool InsurancePerson { get; set; }
/// <summary>
/// آیا ترک کار قرارداد دارد
/// </summary>
public bool ContractLeft { get; set; }
/// <summary>
/// آیا ترک کار بیمه دارد
/// </summary>
public bool InsuranceLeft { get; set; }
/// <summary>
/// آیا کلا ترک کار کرده است
/// </summary>
public bool Black { get; set; }
}

View File

@@ -0,0 +1,167 @@
using _0_Framework.Application;
using CompanyManagment.App.Contracts.TemporaryClientRegistration;
using CompanyManagment.App.Contracts.YearlySalary;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace CompanyManagment.App.Contracts.ClassificationScheme;
/// <summary>
/// اپلیکیش طرح طبقه بندی مشاغل
/// </summary>
public interface IClassificationSchemeApplication
{
/// <summary>
/// پارشیال صفحه ایجاد طرح
/// </summary>
/// <param name="worskhopId"></param>
/// <returns></returns>
Task<ClassificationSchemePartialModel> ClassificationSchemePartialModel(long workshopId);
/// <summary>
/// ایجاد طرح
/// </summary>
/// <param name="command"></param>
/// <returns></returns>
Task<OperationResult> CreateClassificationScheme(CreateClassificationScheme command);
/// <summary>
/// دریافت اطلاعات طرح برای مودال ویرایش
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
Task<EditClassificationScheme> GetClassificationScheme(long id);
/// <summary>
/// ویرایش طرح
/// </summary>
/// <param name="command"></param>
/// <returns></returns>
Task<OperationResult> EditClassificationScheme(EditClassificationScheme command);
/// <summary>
/// دریافت گروه ها و مشاغلشان برای تب تعیین مشاغل
/// </summary>
/// <param name="schemeId"></param>
/// <returns></returns>
Task<List<ClassificationGroupAndJobModel>> GetGroupAndJobs(long schemeId);
/// <summary>
/// دریافت مشاغل گروه توسط آی دی گروه
/// </summary>
/// <param name="groupId"></param>
/// <returns></returns>
Task<List<EditClassificationGroupJob>> GetGroupJobs(long groupId);
/// <summary>
/// چک میکند که آی پرسنلی وجود دارد که این شغل به او نسبت داده شده
/// </summary>
/// <param name="id"></param>
/// <param name="groupId"></param>
/// <returns></returns>
Task<bool> CheckEmployeeHasThisJob(long id, long groupId);
/// <summary>
/// ایجاد مشاغل گروه
/// </summary>
/// <param name="createClassificationGroupJob"></param>
/// <param name="deleteJobList"></param>
/// <returns></returns>
Task<bool> CreateGroupJobs(List<CreateClassificationGroupJob> createClassificationGroupJob, List<long> deleteJobList);
/// <summary>
/// چک میکند که آیا برای این طرح تابحال دستمزدی ایجاد شده یا نه
/// </summary>
/// <param name="schemeId"></param>
/// <returns></returns>
Task<SalaryAndRialCoefficientTab> GetSalariesTabData(long schemeId);
/// <summary>
/// در یافت اطلاعات گروه برای لود مودال ایجاد دستمزد های
/// </summary>
/// <returns></returns>
Task<SalaryAndRialCoefficientModel> GetGroupToCreateSalariesModal(long schemeId);
/// <summary>
/// ایجاد دستمزدها و ضرایب ریالی هر گروه در هر سال
/// </summary>
/// <param name="command"></param>
/// <returns></returns>
Task<OperationResult> CreateGroupSalaryAndCoefficient(SalaryAndRialCoefficientModel command);
/// <summary>
/// دریافت دستمزدها و ضریب ریالی برای مودال ویرایش
/// </summary>
/// <param name="schemeId"></param>
/// <param name="startDate"></param>
/// <param name="endDate"></param>
/// <returns></returns>
Task<SalaryAndRialCoefficientModel> GetEditSalariesData(long schemeId, string startDate, string endDate);
/// <summary>
/// ثبت ویرایش دستمزدها و ضریب
/// </summary>
/// <param name="command"></param>
/// <returns></returns>
Task<OperationResult> EditGroupSalaryAndCoefficient(SalaryAndRialCoefficientModel command);
/// <summary>
/// دریافت لیست پرسنل برای تب افزودن پرسنل
/// </summary>
/// <param name="command"></param>
/// <returns></returns>
Task<EmployeeInfoTab> GetEmployeeDataTab(EmployeeInfoTab command);
/// <summary>
/// دریافت گروه های طرح
/// </summary>
/// <param name="schemeId"></param>
/// <returns></returns>
Task<List<ClassificationGroupList>> GetGroups(long schemeId);
/// <summary>
/// ذخیره پرسنل افزوده شده در گروه
/// </summary>
/// <param name="command"></param>
/// <returns></returns>
Task<OperationResult> AddEmployeeToGroup(AddEmployeeToGroup command);
/// <summary>
/// ذخیره ویرایش گروه پرسنل
/// </summary>
/// <param name="command"></param>
/// <returns></returns>
Task<OperationResult> EditGroupMember(AddEmployeeToGroup command);
/// <summary>
/// دریافت اطلاعات عضویتی پرسنل در گروه
/// </summary>
/// <param name="employeeId"></param>
/// <returns></returns>
Task<AddEmployeeToGroup> GetEmployeeMemberizeData(long employeeId);
/// <summary>
/// متد محاسبه پایه سنوات برا افراد تک گروه
/// </summary>
/// <param name="schemeStart">تاریخ شروع طرح</param>
/// <param name="schemeEnd">تاریخ پاین طرح، اجباری نیست</param>
/// <param name="contractStart">تاریخ شروع قراداد</param>
/// <param name="contractEnd">تاریخ پایان قراداد</param>
/// <param name="groupNo">شماره گروه</param>
/// <param name="employeeId">آی دی پرسنل</param>
/// <param name="workshopId">آی دی کارگاه</param>
/// <returns></returns>
Task<BaseYearDataViewModel> BaseYearComputeOneGroup(DateTime schemeStart, DateTime? schemeEnd,
DateTime contractStart, DateTime contractEnd, string groupNo, long employeeId, long workshopId);
}

View File

@@ -61,9 +61,23 @@ public class ComputingViewModel
/// </summary>
public TimeSpan EmployeeMandatoryHours { get; set; }
/// <summary>
/// مجموع مرخصی های پرسنل در این فیش حقوقی
/// پایه سنوات قبل از تاثیر ساعت کار
/// </summary>
//public TimeSpan TotalLeaveOnThisCheckout { get; set; }
public double BaseYearUnAffected { get; set; }
/// <summary>
/// پایه سنوات بعد از تاثیر ساعت کار
/// </summary>
public double BaseYearAffected { get; set; }
/// <summary>
/// دستمزد روزانه خام بعد از تاثیر ساعت کار
/// </summary>
public double DailySalaryAffected { get; set; }
//public List<string> holidays;
}

View File

@@ -0,0 +1,70 @@
using CompanyManagment.App.Contracts.YearlySalary;
using System.Collections.Generic;
namespace CompanyManagment.App.Contracts.Contract;
/// <summary>
/// نمایش نحوه محاسبه پایه سنوات و دستمزد روزانه
/// </summary>
public class ContractDailyWageAndBaseYearReport
{
/// <summary>
/// لیست داده های محاسبه پایه سنوات
/// </summary>
public BaseYearDataViewModel BaseYearDataViewModel { get; set; }
/// <summary>
/// پایه سنوات متاثر از ساعت کار
/// </summary>
public string BaseYearAffected { get; set; }
/// <summary>
/// دستمزد روزانه متاثر از ساعت کار
/// </summary>
public string DailySalaryAffected { get; set; }
/// <summary>
/// دستمزد روزانه بدون تاثیر ساعت کار
/// </summary>
public string DailySalaryUnAffected { get; set; }
/// <summary>
/// دستمزد روزانه تجمیعی
/// </summary>
public string DailyWage { get; set; }
/// <summary>
/// تاریخ قراداد
/// </summary>
public string ContractDate { get; set; }
/// <summary>
/// نوع دستمزد انتخاب شده
/// </summary>
public string DailyWageType { get; set; }
/// <summary>
/// لیست ارتقاء
/// </summary>
public List<UpgradeManualDailyWageList> UpgradeManualDailyWageLists { get; set; }
/// <summary>
/// نام پرسنل
/// </summary>
public string EmployeeName { get; set; }
/// <summary>
/// نام کارگاه
/// </summary>
public string WorkshopName { get; set; }
/// <summary>
/// آیا با متد جدید محاسبه شده
/// </summary>
public bool OldComputeMethod { get; set; }
/// <summary>
/// آیا محاسبات با مقادیر ذخیره شده مغایرت دارد
/// </summary>
public bool Contradiction { get; set; }
}

View File

@@ -140,7 +140,36 @@ public class CreateContract
public string ConvertMonth { get; set; }
public string FormStep { get; set; }
/// <summary>
/// دستمزد روزانه خام بعد از تاثیر ساعت کار
/// </summary>
public double DailySalaryAffected { get; set; }
/// <summary>
/// پایه سنوات بعد از تاثیر ساعت کار
/// </summary>
public double BaseYearAffected { get; set; }
/// <summary>
/// دستمزد روزانه قبل از تاثیر ساعت کار
/// </summary>
public double DailySalaryUnAffected { get; set; }
/// <summary>
/// پایه سنوات قبل از تاثیر ساعت کار
/// </summary>
public double BaseYearUnAffected { get; set; }
/// <summary>
/// آیا دستمزد روزانه دستی وارد شده است؟
/// </summary>
public bool HasManualDailyWage { get; set; }
/// <summary>
/// نوع دستمزد انتخاب شده
/// </summary>
public string DailyWageType { get; set; }
public List<ContractViweModel> Contracts { get; set; }
public List<WorkshopViewModel> Workshops { get; set; }
public List<EmployerViewModel> Employers { get; set; }

View File

@@ -7,6 +7,14 @@ namespace CompanyManagment.App.Contracts.Contract;
public interface IContractApplication
{
/// <summary>
/// دریافت مزد ارتقاء یافته
/// </summary>
/// <param name="workshopId"></param>
/// <param name="employeeId"></param>
/// <param name="yearlySalaryId"></param>
/// <returns></returns>
Task<double> GetManualDailWage(long workshopId, long employeeId, long yearlySalaryId, DateTime contractStart);
OperationResult Create(CreateContract command);
OperationResult CreateNew(createContractModel command);
OperationResult Edit(EditContract command);

View File

@@ -0,0 +1,36 @@
using System.Collections.Generic;
namespace CompanyManagment.App.Contracts.Contract;
/// <summary>
/// ویو مدل رتقاء دستمزد روزانه و لیست ارتقاء
/// </summary>
public class UpgradeManualDailyWageModel
{
/// <summary>
/// دستمزد روزانه
/// </summary>
public double DailyWage{ get; set; }
/// <summary>
/// لیست ارتقاء
/// </summary>
public List<UpgradeManualDailyWageList> UpgradeManualDailyWageLists { get; set; }
}
/// <summary>
/// لیست ارتقاء
/// </summary>
public class UpgradeManualDailyWageList
{
/// <summary>
/// تاریخ شروع و پایان بازه ارتقاء
/// </summary>
public string StartEndDate { get; set; }
/// <summary>
/// دستمزد روزانه
/// </summary>
public string DailyWage { get; set; }
}

View File

@@ -6,6 +6,7 @@ using System.Threading.Tasks;
using _0_Framework.Application;
using CompanyManagment.App.Contracts.InsuranceList;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
namespace CompanyManagment.App.Contracts.InsuranceList;
@@ -47,4 +48,6 @@ public interface IInsuranceListApplication
Task<InsuranceListTabsCountViewModel> GetTabCounts(InsuranceListSearchModel searchModel);
#endregion
Task<List<InsuranceListViewModel>> GetNotCreatedWorkshop(InsuranceListSearchModel searchModel);
}

View File

@@ -13,6 +13,13 @@ public interface IJobApplication
List<JobViewModel> Search(JobSearchModel searchModel);
List<JobViewModel> SearchJobForMain(JobSearchModel searchModel);
//Task<List<JobViewModel>> GetJobListByText(string searchtText);
/// <summary>
/// جستجوی مشاغل برای سلکت تو
/// </summary>
/// <param name="searchtText"></param>
/// <returns></returns>
Task<List<JobViewModel>> JobSearchSelect(string searchtText);
List<JobViewModel> GetJobListByText(string searchtText);
List<JobViewModel> GetJobListByWorkshopId(long workshopId);
List<JobViewModel> GetJobListByTextAndWorkshopId(string textSearch, long workshopId);

View File

@@ -37,4 +37,5 @@ public class CreateLeave
public List<CustomizeRotatingShiftsViewModel> RotatingShifts { get; set; }
public bool HasRollCall { get; set; }
public CustomizeRotatingShiftsViewModel SelectedShift { get; set; }
public bool IsInvallid { get; set; }
}

View File

@@ -14,5 +14,8 @@ namespace CompanyManagment.App.Contracts.Leave
public string LeftWorlErrMessage { get; set; }
public bool HasNotContract { get; set; }
public string ContractErrMessage { get; set; }
public bool HasHolidayError { get; set; }
public string HolidayErrorMessage { get; set; }
}
}

View File

@@ -27,4 +27,5 @@ public class LeavePrintViewModel
public string MonthGr { get; set; }
public int PrintCounter { get; set; }
public List<EmprViewModel> EmployerList { get; set; }
public bool IsInvalid { get; set; }
}

View File

@@ -20,4 +20,5 @@ public class LeaveSearchModel
public int Year { get; set; }
public int Month { get; set; }
public int PageIndex { get; set; }
public bool IsInvalid { get; set; }
}

View File

@@ -27,4 +27,5 @@ public class LeaveViewModel
public TimeSpan ShiftDuration { get; set; }
public bool HasShiftDuration { get; set; }
public bool IsInvalid { get; set; }
}

View File

@@ -8,7 +8,8 @@ namespace CompanyManagment.App.Contracts.RollCall;
public interface IRollCallMandatoryApplication
{
bool HasRollCallRecord(long employeeId, long workshopId, DateTime contractStart);
ComputingViewModel MandatoryCompute(long employeeId, long workshopId, DateTime contractStart, DateTime contractEnd, CreateWorkingHoursTemp command, bool holidayWorking, bool isStaticCheckout, bool rotatingShiftCompute, bool totalLeaveCompute);
ComputingViewModel MandatoryCompute(long employeeId, long workshopId, DateTime contractStart, DateTime contractEnd, CreateWorkingHoursTemp command, bool holidayWorking, bool isStaticCheckout, bool rotatingShiftCompute, double dailyWageUnAffected, bool totalLeaveCompute);
/// <summary>
/// گزارش نوبت کاری حضور غیاب

View File

@@ -311,4 +311,9 @@ public class CreateWorkingHoursTemp
public string WeeklyWorkingTime { get; set; }
public long ContractId { get; set; }
public long WorknigHoursId { get; set; }
/// <summary>
/// دستمزد روزانه قبل از تاثیر ساعت کار
/// </summary>
public double DailySalaryUnAffected { get; set; }
}

View File

@@ -1,4 +1,6 @@
namespace CompanyManagment.App.Contracts.Workshop.DTOs;
using System.ComponentModel.DataAnnotations.Schema;
namespace CompanyManagment.App.Contracts.Workshop.DTOs;
public class AutoExtensionEmployeeListDto
{
@@ -32,6 +34,17 @@ public class AutoExtensionEmployeeListDto
public bool EmployeeHasCreateContract { get; set; }
/// <summary>
/// دستمزد روزانه دریافت شده از سمت فرانت
/// </summary>
public string DailySalaryUnAffectedStr => "0";
/// <summary>
/// مزد سالانه نرمال دریافت از سمت فرانت
/// </summary>
public string NormalDailyWage => "0";
public string ContarctStart { get; set; }
public string ContractEnd { get; set; }

View File

@@ -38,6 +38,46 @@ public class createContractModel
public long YearlySalaryId { get; set; }
public long EmployerId { get; set; }
/// <summary>
/// دستمزد روزانه خام بعد از تاثیر ساعت کار
/// </summary>
public double DailySalaryAffected { get; set; }
/// <summary>
/// پایه سنوات بعد از تاثیر ساعت کار
/// </summary>
public double BaseYearAffected { get; set; }
/// <summary>
/// دستمزد روزانه قبل از تاثیر ساعت کار
/// </summary>
public double DailySalaryUnAffected { get; set; }
/// <summary>
/// دستمزد روزانه دریافت شده از سمت فرانت
/// </summary>
public string DailySalaryUnAffectedStr { get; set; }
/// <summary>
/// مزد سالانه نرمال دریافت از سمت فرانت
/// </summary>
public string NormalDailyWage { get; set; }
/// <summary>
/// پایه سنوات قبل از تاثیر ساعت کار
/// </summary>
public double BaseYearUnAffected { get; set; }
/// <summary>
/// آیا دستمزد روزانه دستی وارد شده است؟
/// </summary>
public bool HasManualDailyWage { get; set; }
/// <summary>
/// نوع دستمزد انتخاب شده
/// </summary>
public string DailyWageType { get; set; }
}

View File

@@ -24,6 +24,11 @@ public class BaseYearDataViewModel
/// </summary>
public double BaseYearResult { get; set; }
/// <summary>
/// اولین روز شروع بکار
/// </summary>
public string FirstWorkDayInLeftWork { get; set; }
/// <summary>
/// لیست تمام پایه سنوات های محاسبه شده
/// </summary>
@@ -64,4 +69,29 @@ public class BaseYearDataList
/// سالی که در آن پایه سنوات تعلق گرفته
/// </summary>
public string Year { get; set; }
/// <summary>
///روزی که پایه سنوات تعلق گرفته
///یا شروع بکار. ترک کار
/// شمسی
/// </summary>
public string BaseYearPayDay { get; set; }
/// <summary>
/// روزی که پایه سنوات تعلق گرفته
///یا شروع بکار. ترک کار
/// میلادی
/// </summary>
public DateTime BaseYearPayDayGr { get; set; }
/// <summary>
/// آیا تاریخ شروع بکار دارد
/// </summary>
public bool HasStartWork { get; set; }
/// <summary>
/// آیا تاریخ پایان کار دارد
/// </summary>
public bool HasLeftWork { get; set; }
}

View File

@@ -2,7 +2,9 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using _0_Framework.Application;
using CompanyManagment.App.Contracts.Contract;
using CompanyManagment.App.Contracts.Holiday;
using CompanyManagment.App.Contracts.LeftWork;
namespace CompanyManagment.App.Contracts.YearlySalary;
@@ -14,6 +16,35 @@ public interface IYearlySalaryApplication
OperationResult Err();
EditYearlySalary GetDetails(long id);
List<YearlySalaryViewModel> GetYearlySalary();
/// <summary>
/// متد ارتقاء مزد دلخواه
/// </summary>
/// <param name="newContractStart"></param>
/// <param name="lastContractStart"></param>
/// <param name="lastContractManualDailyWage"></param>
/// <returns></returns>
Task<UpgradeManualDailyWageModel> UpgradeManualDailyWage(DateTime newContractStart, DateTime lastContractStart,
double lastContractManualDailyWage);
/// <summary>
/// متد محاسبه پایه سنوات و لیست پایه سنوات های پرسنل
/// </summary>
/// <param name="contractStart"></param>
/// <param name="contractEnd"></param>
/// <param name="employeeId"></param>
/// <param name="workshopId"></param>
/// <param name="leftWorkList"></param>
/// <returns></returns>
Task<BaseYearDataViewModel> BaseYearComputeByContractId(long contractId);
/// <summary>
/// دریافت مزد روزانه بر اساس تاریخ شروع و پایان
/// </summary>
/// <param name="start"></param>
/// <param name="end"></param>
/// <returns></returns>
Task<(double dailyWage, long yearlySalaryId)> GetDailyWageByStartEnd(DateTime start, DateTime end);
List<YearlySalaryViewModel> Search(YearlySalarySearchModel searchModel);
EditYearlySalary GetDetailsBySearchModel(YearlySalarySearchModel searchModel);

View File

@@ -152,17 +152,38 @@ public class CheckoutApplication : ICheckoutApplication
var housingAllowance = command.HousingAllowance.MoneyToDouble();
//حق تاهل
var marriedAllowance = command.MarriedAllowance.MoneyToDouble();
var MontlyYearsBunos =
_yearlySalaryRepository.GetMontlyBunosYears(command.WeeklyTime, command.ContractStartGr, command.ContractEndGr, dayliWage, command.WorkingWeeklyTime, command.officialholiday, command.friday, command.TotalHolidaysAndNotH, command.TotalHolidaysAndNotM, command.Basic, command.FridayStarttoEnd, command.DailFeeComplete, command.HasRollCall, command.HolidayWorking, command.ShiftWork);
//دستمزد ماهانه
var monthlyWage = MontlyYearsBunos.MontlyWage;
//سنوات
var years = command.YearsPay;
//var MontlyYearsBunos =
//_yearlySalaryRepository.GetMontlyBunosYears(command.WeeklyTime, command.ContractStartGr, command.ContractEndGr, dayliWage, command.WorkingWeeklyTime, command.officialholiday, command.friday, command.TotalHolidaysAndNotH, command.TotalHolidaysAndNotM, command.Basic, command.FridayStarttoEnd, command.DailFeeComplete, command.HasRollCall, command.HolidayWorking, command.ShiftWork);
//دستمزد ماهانه
#region Salary
var totalDays = (command.ContractEndGr - command.ContractStartGr).TotalDays + 1;
var mandatoryDays = totalDays - command.FridayStarttoEnd - command.officialholiday;
if (!command.HasRollCall && command.ShiftWork != "4")
mandatoryDays = totalDays - command.FridayStarttoEnd;
var monthlyWage = command.DailySalaryAffected * totalDays;
//پایه سنوات
var bacicYears = command.BaseYearAffected * totalDays;
#endregion
//سنوات
var years = command.YearsPay;
//عیدی و پاداش
var bunos = command.BonusesPay;
//پایه سنوات
var bacicYears = MontlyYearsBunos.BasicYears;
var sumOfWorkingDays = MontlyYearsBunos.SumOfWorkingDay;
//فاطمه احمدژاد === موقت عیدی و پاداش و سنوات حساب نشه
if (command.EmployeeId == 45104 && command.WorkshopId == 315)
{
years = 0;
bunos = 0;
}
var sumOfWorkingDays = $"{totalDays}";
if (command.friday > 0)
{
var fridayPercent = dayliWage * 40 / 100;
@@ -200,11 +221,11 @@ public class CheckoutApplication : ICheckoutApplication
.Select(x => new CheckoutSalaryAid(x.Amount, x.SalaryAidDateTimeGe, x.SalaryAidDateTimeFa, x.CalculationDateTimeGe, x.CalculationDateTimeFa, x.Id)).ToList();
command.SalaryAidDeduction = salaryAids.Sum(x => x.Amount.MoneyToDouble());
var loanInstallments = _rollCallMandatoryRepository.LoanInstallmentForCheckout(command.EmployeeId,
command.WorkshopId, command.ContractStartGr, command.ContractEndGr)
.Select(x => new CheckoutLoanInstallment(x.Amount, x.Month, x.Year, x.IsActive, x.RemainingAmount, x.LoanAmount, x.Id)).ToList();
command.WorkshopId, command.ContractStartGr, command.HasLeft ? DateTime.MaxValue : command.ContractEndGr)
.Select(x =>
new CheckoutLoanInstallment(x.Amount, x.Month, x.Year, x.IsActive, x.RemainingAmount, x.LoanAmount, x.Id)).ToList();
command.InstallmentDeduction = loanInstallments.Sum(x => x.AmountForMonth.MoneyToDouble());

View File

@@ -0,0 +1,408 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using _0_Framework.Application;
using _0_Framework.Application.Enums;
using Company.Domain.ClassificationSchemeAgg;
using CompanyManagment.App.Contracts.ClassificationScheme;
using CompanyManagment.App.Contracts.YearlySalary;
using Microsoft.EntityFrameworkCore;
namespace CompanyManagment.Application;
public class ClassificationSchemeApplication : IClassificationSchemeApplication
{
private readonly IClassificationSchemeRepository _classificationSchemeRepository;
private readonly IClassificationGroupRepository _classificationGroupRepository;
private readonly IClassificationGroupSalariesRepository _classificationGroupSalariesRepository;
private readonly IClassificationRialCoefficientRepository _classificationRialCoefficientRepository;
private readonly IClassificationEmployeeRepository _classificationEmployeeRepository;
public ClassificationSchemeApplication(IClassificationSchemeRepository classificationSchemeRepository, IClassificationGroupRepository classificationGroupRepository, IClassificationGroupSalariesRepository classificationGroupSalariesRepository, IClassificationRialCoefficientRepository classificationRialCoefficientRepository, IClassificationEmployeeRepository classificationEmployeeRepository)
{
_classificationSchemeRepository = classificationSchemeRepository;
_classificationGroupRepository = classificationGroupRepository;
_classificationGroupSalariesRepository = classificationGroupSalariesRepository;
_classificationRialCoefficientRepository = classificationRialCoefficientRepository;
_classificationEmployeeRepository = classificationEmployeeRepository;
}
public Task<ClassificationSchemePartialModel> ClassificationSchemePartialModel(long workshopId)
{
return _classificationSchemeRepository.ClassificationSchemePartialModel(workshopId);
}
public async Task<OperationResult> CreateClassificationScheme(CreateClassificationScheme command)
{
var op = new OperationResult();
#region Validation
if (!command.ExecutionDateFa.TryToGeorgianDateTime(out var executionDateGr))
{
return op.Failed("تاریخ اجرا صحیح نمی باشد");
}
if (!command.IncludingDateFa.TryToGeorgianDateTime(out var includingDateGr))
{
return op.Failed("تاریخ شمول صحیح نمی باشد");
}
#endregion
//ایجاد طرح
var create = new ClassificationScheme(includingDateGr, executionDateGr,
command.DesignerFullName, command.DesignerPhone, command.WorkshopId, command.TypeOfCoefficient);
_classificationSchemeRepository.Create(create);
await _classificationSchemeRepository.SaveChangesAsync();
//ایجاد گروه های طرح
var groups = new List<ClassificationGroup>()
{
new ClassificationGroup("1",command.WorkshopId,create.id),
new ClassificationGroup("2",command.WorkshopId,create.id),
new ClassificationGroup("3",command.WorkshopId,create.id),
new ClassificationGroup("4",command.WorkshopId,create.id),
new ClassificationGroup("5",command.WorkshopId,create.id),
new ClassificationGroup("6",command.WorkshopId,create.id),
new ClassificationGroup("7",command.WorkshopId,create.id),
new ClassificationGroup("8",command.WorkshopId,create.id),
new ClassificationGroup("9",command.WorkshopId,create.id),
new ClassificationGroup("10",command.WorkshopId,create.id),
new ClassificationGroup("11",command.WorkshopId,create.id),
new ClassificationGroup("12",command.WorkshopId,create.id),
new ClassificationGroup("13",command.WorkshopId,create.id),
new ClassificationGroup("14",command.WorkshopId,create.id),
new ClassificationGroup("15",command.WorkshopId,create.id),
new ClassificationGroup("16",command.WorkshopId,create.id),
new ClassificationGroup("17",command.WorkshopId,create.id),
new ClassificationGroup("18",command.WorkshopId,create.id),
new ClassificationGroup("19",command.WorkshopId,create.id),
new ClassificationGroup("20",command.WorkshopId,create.id),
};
await _classificationGroupRepository.CreateGroups(groups);
return op.Succcedded();
}
public Task<EditClassificationScheme> GetClassificationScheme(long id)
{
return _classificationSchemeRepository.GetClassificationScheme(id);
}
public async Task<OperationResult> EditClassificationScheme(EditClassificationScheme command)
{
var op = new OperationResult();
#region Validation
if (!command.ExecutionDateFa.TryToGeorgianDateTime(out var executionDateGr))
{
return op.Failed("تاریخ اجرا صحیح نمی باشد");
}
if (!command.IncludingDateFa.TryToGeorgianDateTime(out var includingDateGr))
{
return op.Failed("تاریخ شمول صحیح نمی باشد");
}
var scheme = _classificationSchemeRepository.Get(command.Id);
if (scheme == null)
return op.Failed("رکورد مورد نظر وجود ندارد");
#endregion
scheme.Edit(includingDateGr, executionDateGr, command.DesignerFullName,command.DesignerPhone,command.TypeOfCoefficient);
await _classificationSchemeRepository.SaveChangesAsync();
return op.Succcedded();
}
public async Task<List<ClassificationGroupAndJobModel>> GetGroupAndJobs(long schemeId)
{
return await _classificationGroupRepository.GetGroupAndJobs(schemeId);
}
public async Task<List<EditClassificationGroupJob>> GetGroupJobs(long groupId)
{
return await _classificationGroupRepository.GetGroupJobs(groupId);
}
public async Task<bool> CheckEmployeeHasThisJob(long id, long groupId)
{
return await _classificationGroupRepository.CheckEmployeeHasThisJob(id, groupId);
}
public async Task<bool> CreateGroupJobs(List<CreateClassificationGroupJob> createClassificationGroupJob, List<long> deleteJobList)
{
var newJoblist = new List<ClassificationGroupJob>();
if (createClassificationGroupJob.Count > 0)
{
foreach (var item in createClassificationGroupJob)
{
var newJob = new ClassificationGroupJob(item.JobId, item.JobName, item.JobCode, item.ClassificationGroupId,
item.GroupNo);
newJoblist.Add(newJob);
}
}
return await _classificationGroupRepository.CreateJobs(newJoblist, deleteJobList);
}
public async Task<SalaryAndRialCoefficientTab> GetSalariesTabData(long schemeId)
{
return await _classificationGroupSalariesRepository.GetSalariesTabData(schemeId);
}
public async Task<SalaryAndRialCoefficientModel> GetGroupToCreateSalariesModal(long schemeId)
{
return await _classificationGroupRepository.GetGroupToCreateSalariesModal(schemeId);
}
public async Task<OperationResult> CreateGroupSalaryAndCoefficient(SalaryAndRialCoefficientModel command)
{
var op = new OperationResult();
#region Validation
if (string.IsNullOrWhiteSpace(command.StartDateFa) || string.IsNullOrWhiteSpace(command.StartDateFa))
return op.Failed("تاریخ شروع و پایان نمی توانند خالی باشند");
if (command.TypeOfCoefficient == TypeOfCoefficient.RialCoefficient && command.RialCoefficient == 0)
return op.Failed("ضریب ریالی وارد نشده است");
if (command.SalariesAndCoefficientList.Any(x=> string.IsNullOrWhiteSpace(x.GroupSalaryStr) || x.GroupSalaryStr =="0"))
return op.Failed("دستمزد تمامی گروه ها می بایست تعیین شود");
if (!command.StartDateFa.TryToGeorgianDateTime(out var startDate))
{
return op.Failed("تاریخ شروع وارد شده صحیح نمی باشد");
}
if (!command.EndDateFa.TryToGeorgianDateTime(out var endDate))
{
return op.Failed("تاریخ پایان وارد شده صحیح نمی باشد");
}
if (_classificationGroupSalariesRepository.Exists(x => x.StartDate <= endDate && x.EndDate >= startDate && x.SchemeId == command.SchemeId))
{
return op.Failed("بازه تاریخ وارد شده با داده های ذخیره شده قبل تداخل دارد");
}
var year = Convert.ToInt32(command.StartDateFa.Substring(0, 4));
var endDateYear = Convert.ToInt32(command.EndDateFa.Substring(0, 4));
if(year != endDateYear)
return op.Failed("سال تاریخ شروع از سال تاریخ پایان متفاوت است");
#endregion
var createSalaries = new List<ClassificationGroupSalary>();
foreach (var item in command.SalariesAndCoefficientList)
{
item.GroupSalary = item.GroupSalaryStr.MoneyToDouble();
var create = new ClassificationGroupSalary(item.ClassificationGroupId,item.GroupNo,item.GroupSalary,startDate, endDate, year, command.SchemeId);
createSalaries.Add(create);
}
await _classificationGroupSalariesRepository.CreateSalaries(createSalaries);
if (command.TypeOfCoefficient == TypeOfCoefficient.RialCoefficient)
{
try
{
command.RialCoefficient = command.RialCoefficient;
await _classificationRialCoefficientRepository.CreateAsync(new ClassificationRialCoefficient(command.SchemeId,
command.RialCoefficient, startDate, endDate, year));
await _classificationRialCoefficientRepository.SaveChangesAsync();
}
catch (Exception e)
{
return op.Failed("فرمت مبلغ ضریب ریالی اشتباه است");
}
}
op.SendId = command.SchemeId;
return op.Succcedded();
}
public async Task<SalaryAndRialCoefficientModel> GetEditSalariesData(long schemeId, string startDate, string endDate)
{
return await _classificationGroupSalariesRepository.GetEditSalariesData(schemeId, startDate, endDate);
}
public async Task<OperationResult> EditGroupSalaryAndCoefficient(SalaryAndRialCoefficientModel command)
{
var op = new OperationResult();
#region Validation
if (string.IsNullOrWhiteSpace(command.StartDateFa) || string.IsNullOrWhiteSpace(command.StartDateFa))
return op.Failed("تاریخ شروع و پایان نمی توانند خالی باشند");
if (command.TypeOfCoefficient == TypeOfCoefficient.RialCoefficient && command.RialCoefficient == 0)
return op.Failed("ضریب ریالی وارد نشده است");
if (command.SalariesAndCoefficientList.Any(x => string.IsNullOrWhiteSpace(x.GroupSalaryStr) || x.GroupSalaryStr == "0"))
return op.Failed("دستمزد تمامی گروه ها می بایست تعیین شود");
if (!command.StartDateFa.TryToGeorgianDateTime(out var startDate))
{
return op.Failed("تاریخ شروع وارد شده صحیح نمی باشد");
}
if (!command.EndDateFa.TryToGeorgianDateTime(out var endDate))
{
return op.Failed("تاریخ پایان وارد شده صحیح نمی باشد");
}
var salariesId = command.SalariesAndCoefficientList.Select(x => x.Id).ToList();
if (_classificationGroupSalariesRepository.Exists(x => x.StartDate <= endDate && x.EndDate >= startDate && x.SchemeId == command.SchemeId && !salariesId.Contains(x.id)))
{
return op.Failed("بازه تاریخ وارد شده با داده های ذخیره شده قبل تداخل دارد");
}
var year = Convert.ToInt32(command.StartDateFa.Substring(0, 4));
var endDateYear = Convert.ToInt32(command.EndDateFa.Substring(0, 4));
if (year != endDateYear)
return op.Failed("سال تاریخ شروع از سال تاریخ پایان متفاوت است");
#endregion
foreach (var item in command.SalariesAndCoefficientList)
{
var editSalary = _classificationGroupSalariesRepository.Get(item.Id);
item.GroupSalary = item.GroupSalaryStr.MoneyToDouble();
editSalary.Edit(item.GroupSalary, startDate, endDate, year);
await _classificationGroupSalariesRepository.SaveChangesAsync();
}
if (command.TypeOfCoefficient == TypeOfCoefficient.RialCoefficient)
{
var editRialCoefficient = _classificationRialCoefficientRepository.Get(command.CoefficientId);
editRialCoefficient.Edit(command.RialCoefficient, startDate, endDate, year);
await _classificationRialCoefficientRepository.SaveChangesAsync();
}
return op.Succcedded();
}
public async Task<EmployeeInfoTab> GetEmployeeDataTab(EmployeeInfoTab command)
{
var employeeInfoTab = new EmployeeInfoTab();
var employeeInfoList = _classificationEmployeeRepository.GetEmployeeListData(command.SchemeId).GetAwaiter().GetResult();
if (employeeInfoList.Any())
{
if (!string.IsNullOrWhiteSpace(command.FullName))
employeeInfoList = employeeInfoList.Where(x => x.FullName.Contains(command.FullName)).ToList();
employeeInfoTab.EmployeeInfoList = employeeInfoList;
employeeInfoTab.FullName = command.FullName;
}
return employeeInfoTab;
}
public async Task<List<ClassificationGroupList>> GetGroups(long schemeId)
{
return await _classificationGroupRepository.GetGroups(schemeId);
}
public async Task<OperationResult> AddEmployeeToGroup(AddEmployeeToGroup command)
{
var op = new OperationResult();
#region Validation
if (command.GroupId == 0)
return op.Failed("لطفا گروه را انتخاب کنید");
if (command.JobId == 0)
return op.Failed("لطفا سمت را انتخاب کنید");
#endregion
var scheme = _classificationSchemeRepository.GetClassificationScheme(command.SchemeId).GetAwaiter().GetResult();
var create = new ClassificationEmployee(scheme.WorkshopId, command.EmployeeId, command.SchemeId,
command.GroupId, command.JobId);
await _classificationEmployeeRepository.CreateAsync(create);
await _classificationEmployeeRepository.SaveChangesAsync();
return op.Succcedded();
}
public async Task<OperationResult> EditGroupMember(AddEmployeeToGroup command)
{
var op = new OperationResult();
#region Validation
if (command.GroupId == 0)
return op.Failed("لطفا گروه را انتخاب کنید");
if (command.JobId == 0)
return op.Failed("لطفا سمت را انتخاب کنید");
#endregion
var editGroup = _classificationEmployeeRepository.Get(command.Id);
editGroup.Edit(command.GroupId, command.JobId);
await _classificationEmployeeRepository.SaveChangesAsync();
return op.Succcedded();
}
/// <summary>
/// دریافت اطلاعات عضویتی پرسنل در گروه
/// </summary>
/// <param name="employeeId"></param>
/// <returns></returns>
public async Task<AddEmployeeToGroup> GetEmployeeMemberizeData(long employeeId)
{
var result = new AddEmployeeToGroup();
var res = await _classificationEmployeeRepository.GetEmployeeMemberizeData(employeeId);
result.EmployeeId = employeeId;
result.GroupId = res.ClassificationGroupId;
result.JobId = res.ClassificationGroupJobId;
result.Id = res.id;
return result;
}
public async Task<BaseYearDataViewModel> BaseYearComputeOneGroup(DateTime schemeStart, DateTime? schemeEnd, DateTime contractStart, DateTime contractEnd,
string groupNo, long employeeId, long workshopId)
{
return await _classificationSchemeRepository.BaseYearComputeOneGroup(schemeStart, schemeEnd, contractStart,
contractEnd, groupNo, employeeId, workshopId);
}
}

View File

@@ -78,6 +78,11 @@ public class ContractApplication : IContractApplication
}
public async Task<double> GetManualDailWage(long workshopId, long employeeId, long yearlySalaryId, DateTime contractStart)
{
return await _contractRepository.GetManualDailWage(workshopId, employeeId, yearlySalaryId, contractStart);
}
public OperationResult Create(CreateContract command)
{
var yearlysalaryList = _yearlySalaryRepository.GetYearlySalary();
@@ -142,7 +147,9 @@ public class ContractApplication : IContractApplication
yearlySalarId,
start, end, command.DayliWage, command.ArchiveCode, getWorkdate, setContractDate,
command.JobType, command.ContractType, command.WorkshopAddress1, command.WorkshopAddress2,
command.ConsumableItems, command.JobTypeId, command.HousingAllowance, command.AgreementSalary, command.WorkingHoursWeekly, command.FamilyAllowance, command.ContractPeriod);
command.ConsumableItems, command.JobTypeId, command.HousingAllowance, command.AgreementSalary,
command.WorkingHoursWeekly, command.FamilyAllowance, command.ContractPeriod,command.DailySalaryAffected,
command.BaseYearAffected, command.DailySalaryUnAffected,command.BaseYearUnAffected, command.HasManualDailyWage, command.DailyWageType);
_contractRepository.Create(makeContract);
_contractRepository.SaveChanges();
@@ -356,7 +363,9 @@ public class ContractApplication : IContractApplication
command.YearlySalaryId,
start, end, command.DayliWage, command.ArchiveCode, getWorkdate, setContractDate,
command.JobName, command.ContractType, command.WorkshopAddress1, command.WorkshopAddress2,
command.ConsumableItems, command.JobId, command.HousingAllowance, "0", command.WorkingHoursWeekly, command.FamilyAllowance, command.ContractPeriod);
command.ConsumableItems, command.JobId, command.HousingAllowance, "0", command.WorkingHoursWeekly, command.FamilyAllowance, command.ContractPeriod,
command.DailySalaryAffected,
command.BaseYearAffected, command.DailySalaryUnAffected, command.BaseYearUnAffected, command.HasManualDailyWage, command.DailyWageType);
_contractRepository.Create(makeContract);
_contractRepository.SaveChanges();

View File

@@ -319,7 +319,10 @@ namespace CompanyManagment.Application
if (workshopId == 170)
{
var exceptionEmployeeIds = _customizeWorkshopGroupSettingsRepository.GetEmployeeSettingsByGroupSettingsId(117).Select(x => x.EmployeeId).ToList();
var exceptionEmployeeIds = _customizeWorkshopGroupSettingsRepository
.GetEmployeeSettingsByGroupSettingsId(117)
.Select(x => x.EmployeeId)
.Where(x=> workshopLeftWorksInMonth.Select(l=>l.EmployeeId).Contains(x)).ToList();
foreach (var employeesId in exceptionEmployeeIds)
{

View File

@@ -249,7 +249,10 @@ namespace CompanyManagment.Application
if (workshopId == 170)
{
var exceptionEmployeeIds = _customizeWorkshopGroupSettingsRepository.GetEmployeeSettingsByGroupSettingsId(117).Select(x => x.EmployeeId).ToList();
var exceptionEmployeeIds = _customizeWorkshopGroupSettingsRepository
.GetEmployeeSettingsByGroupSettingsId(117)
.Select(x => x.EmployeeId)
.Where(x=> workshopLeftWorksInMonth.Select(l=>l.EmployeeId).Contains(x)).ToList();
foreach (var employeesId in exceptionEmployeeIds)
{

View File

@@ -179,8 +179,13 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
else
{
nationalCodValid = false;
return opration.Failed("کد ملی وارد شده نا معتبر است");
nationalCodValid = false;
return opration.Failed("کد ملی وارد شده نا معتبر است");
}
}
catch (Exception)
@@ -313,8 +318,15 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
else
{
nationalCodValid = false;
return opration.Failed("کد ملی وارد شده نا معتبر است");
if (command.Nationality == "ایرانی")
{
nationalCodValid = false;
return opration.Failed("کد ملی وارد شده نا معتبر است");
}
else
{
nationalCodValid = true;
}
}
}
catch (Exception)
@@ -1632,11 +1644,11 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
if (apiResult.ResponseContext.Status.Code == 3)
{
return op.Failed("کد ملی نامعتبر است");
return op.Failed("کد ملی و تاریخ تولد با هم همخانی ندارند");
}
if (apiResult.ResponseContext.Status.Code != 0)
{
return op.Failed("کد ملی و تاریخ تولد با هم همخانی ندارند");
return op.Failed("اطلاعات وارد شده نامعتبر میباشد");
}
var basicInfo = apiResult.BasicInformation;
var identityInfo = apiResult.IdentificationInformation;

View File

@@ -1868,6 +1868,10 @@ public class InsuranceListApplication : IInsuranceListApplication
bool isManager = jobId is 10 or 16 or 17 or 18 or 3498;
if (isManager && !includeStatus)
return 0;
//پرسنل استثناء سیدعسکر موسوی زاده - فروشگاه ولی عصر
if (employeeId == 1496)
return 0;
//پرسنل استثناء
if (employeeId == 42783)
@@ -2366,5 +2370,10 @@ public class InsuranceListApplication : IInsuranceListApplication
return _insuranceListRepositpry.GetTabCounts(searchModel);
}
public async Task<List<InsuranceListViewModel>> GetNotCreatedWorkshop(InsuranceListSearchModel searchModel)
{
return await _insuranceListRepositpry.GetNotCreatedWorkshop(searchModel);
}
#endregion
}

View File

@@ -1,4 +1,5 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using _0_Framework.Application;
using Company.Domain.JobAgg;
using CompanyManagment.App.Contracts.Job;
@@ -66,6 +67,11 @@ public class JobApplication : IJobApplication
return _jobRepository.SearchJobForMain(searchModel);
}
public async Task<List<JobViewModel>> JobSearchSelect(string searchtText)
{
return await _jobRepository.JobSearchSelect(searchtText);
}
//public Task<List<JobViewModel>> GetJobListByText(string searchtText)
//{
// return _jobRepository.GetJobListByText(searchtText);

View File

@@ -84,7 +84,7 @@ public class LeaveApplication : ILeaveApplication
var end = command.PaidLeaveType == "ساعتی" ? start : command.EndLeave.ToGeorgianDateTime();
var checkErr = _leaveRepository.CheckErrors(start, end, command.EmployeeId, command.WorkshopId);
var checkErr = _leaveRepository.CheckErrors(start, end, command.EmployeeId, command.WorkshopId,command.IsInvallid);
// start = new DateTime(start.Year, start.Month, start.Day, startH.Hours, startH.Minutes, startH.Seconds);
//end = new DateTime(end.Year, end.Month, end.Day, endH.Hours, endH.Minutes, endH.Seconds);
@@ -96,8 +96,10 @@ public class LeaveApplication : ILeaveApplication
return op.Failed(checkErr.ContractErrMessage);
if (checkErr.HasLeftWork)
return op.Failed(checkErr.LeftWorlErrMessage);
//if (checkErr.HasHolidayError)
// return op.Failed(checkErr.HolidayErrorMessage);
if (start > end)
if (start > end)
return op.Failed("تارخ شروع از پایان بزرگتر است");
@@ -180,29 +182,30 @@ public class LeaveApplication : ILeaveApplication
shiftDuration = shiftEndDateTime - shiftStartDateTime;
hasShiftDuration = true;
}
}
else if (employeeSettings is { WorkshopShiftStatus: WorkshopShiftStatus.Irregular })
{
if ((end - start).TotalDays > 1)
else if (employeeSettings is { WorkshopShiftStatus: WorkshopShiftStatus.Irregular })
{
return op.Failed("شما نمیتوانید بیشتر از یک روز مرخصی روزانه ثبت کنید");
}
var isActive = _rollCallEmployeeStatusApplication.IsActiveInPeriod(command.EmployeeId, command.WorkshopId, start, start);
if (isActive)
{
shiftDuration = employeeSettings.IrregularShift.WorkshopIrregularShifts switch
if ((end - start).TotalDays > 1)
{
WorkshopIrregularShifts.TwelveThirtySix => TimeSpan.FromHours(12),
WorkshopIrregularShifts.TwelveTwentyFour => TimeSpan.FromHours(12),
WorkshopIrregularShifts.TwentyFourFortyEight => TimeSpan.FromHours(24),
WorkshopIrregularShifts.TwentyFourTwentyFour => TimeSpan.FromHours(24),
_ => new TimeSpan()
};
hasShiftDuration = true;
}
return op.Failed("شما نمیتوانید بیشتر از یک روز مرخصی روزانه ثبت کنید");
}
var isActive = _rollCallEmployeeStatusApplication.IsActiveInPeriod(command.EmployeeId, command.WorkshopId, start, start);
if (isActive)
{
shiftDuration = employeeSettings.IrregularShift.WorkshopIrregularShifts switch
{
WorkshopIrregularShifts.TwelveThirtySix => TimeSpan.FromHours(12),
WorkshopIrregularShifts.TwelveTwentyFour => TimeSpan.FromHours(12),
WorkshopIrregularShifts.TwentyFourFortyEight => TimeSpan.FromHours(24),
WorkshopIrregularShifts.TwentyFourTwentyFour => TimeSpan.FromHours(24),
_ => new TimeSpan()
};
hasShiftDuration = true;
}
}
}
}
@@ -235,7 +238,8 @@ public class LeaveApplication : ILeaveApplication
var employeeFullName = _employeeRepository.GetDetails(command.EmployeeId).EmployeeFullName;
var workshopName = _workshopRepository.GetDetails(command.WorkshopId).WorkshopName;
var leave = new Leave(start, end, totalhourses, command.WorkshopId, command.EmployeeId
, command.PaidLeaveType, command.LeaveType, employeeFullName, workshopName, command.IsAccepted, command.Decription, year, month, shiftDuration, hasShiftDuration);
, command.PaidLeaveType, command.LeaveType, employeeFullName, workshopName, command.IsAccepted, command.Decription,
year, month, shiftDuration, hasShiftDuration,command.IsInvallid);
_leaveRepository.Create(leave);
_leaveRepository.SaveChanges();
@@ -297,13 +301,15 @@ public class LeaveApplication : ILeaveApplication
return op.Failed("لطفا تاریخ پایان را وارد کنید");
var start = command.StartLeave.ToGeorgianDateTime();
var end = command.PaidLeaveType == "ساعتی" ? start : command.EndLeave.ToGeorgianDateTime();
var checkErr = _leaveRepository.CheckErrors(start, end, command.EmployeeId, command.WorkshopId);
var checkErr = _leaveRepository.CheckErrors(start, end, command.EmployeeId, command.WorkshopId,command.IsInvallid);
if (checkErr.HasChekout)
return op.Failed(checkErr.CheckoutErrMessage);
if (checkErr.HasLeftWork)
return op.Failed(checkErr.LeftWorlErrMessage);
if (checkErr.HasHolidayError)
return op.Failed(checkErr.HolidayErrorMessage);
if (start > end)
return op.Failed("تارخ شروع از پایان بزرگتر است");

View File

@@ -21,9 +21,11 @@ public class RollCallMandatoryApplication : IRollCallMandatoryApplication
return _rollCallMandatoryRepository.Exists(x => x.EmployeeId == employeeId && x.WorkshopId == workshopId && x.StartDate.Value.Date >= contractStart.Date);
}
public ComputingViewModel MandatoryCompute(long employeeId, long workshopId, DateTime contractStart, DateTime contractEnd, CreateWorkingHoursTemp command, bool holidayWorking, bool isStaticCheckout, bool rotatingShiftCompute,bool totalLeaveCompute)
public ComputingViewModel MandatoryCompute(long employeeId, long workshopId, DateTime contractStart, DateTime contractEnd, CreateWorkingHoursTemp command, bool holidayWorking, bool isStaticCheckout, bool rotatingShiftCompute, double dailyWageUnAffected, bool totalLeaveCompute)
{
return _rollCallMandatoryRepository.MandatoryCompute(employeeId,workshopId, contractStart, contractEnd, command, holidayWorking, isStaticCheckout, rotatingShiftCompute, totalLeaveCompute);
return _rollCallMandatoryRepository.MandatoryCompute(employeeId,workshopId, contractStart, contractEnd, command, holidayWorking, isStaticCheckout, rotatingShiftCompute, dailyWageUnAffected, totalLeaveCompute);
}
public async Task<ComputingViewModel> RotatingShiftReport(long workshopId, long employeeId, DateTime contractStart, DateTime contractEnd,

View File

@@ -113,37 +113,37 @@ public class WorkshopAppliction : IWorkshopApplication
return operation.Failed("لطفا جمعیت شهر را انتخاب کنید");
}
if (command.IsClassified)
{
if (string.IsNullOrWhiteSpace(command.CreatePlan.ExecutionDateFa) || command.CreatePlan.ExecutionDateFa.Length < 10)
return operation.Failed("تاریخ اجرای طرح را بصورت صحیح وارد کنید");
if(string.IsNullOrWhiteSpace(command.CreatePlan.IncludingDateFa) || command.CreatePlan.IncludingDateFa.Length <10)
return operation.Failed("تاریخ شمول طرح را بصورت صحیح وارد کنید");
var groupCounter = 0;
// var planEmployeeCounter = command.CreatePlan.EditWorkshopPlanEmployeeList == null ? 0 : command.CreatePlan.EditWorkshopPlanEmployeeList.Count;
for (int i = 0; i <= command.CreatePlan.EditGroupPlanlist.Count - 1; i++)
{
if (!string.IsNullOrWhiteSpace(command.CreatePlan.EditGroupPlanlist[i].AnnualSalaryStr)
&& !string.IsNullOrWhiteSpace(command.CreatePlan.EditGroupPlanlist[i].BaseSalaryStr)
&& !string.IsNullOrWhiteSpace(command.CreatePlan.EditGroupPlanlist[i].JobSalaryStr)
&& command.CreatePlan.EditGroupPlanlist[i].JobIdList.Count > 0)
{
groupCounter += 1;
//if (command.IsClassified)
//{
// if (string.IsNullOrWhiteSpace(command.CreatePlan.ExecutionDateFa) || command.CreatePlan.ExecutionDateFa.Length < 10)
// return operation.Failed("تاریخ اجرای طرح را بصورت صحیح وارد کنید");
// if(string.IsNullOrWhiteSpace(command.CreatePlan.IncludingDateFa) || command.CreatePlan.IncludingDateFa.Length <10)
// return operation.Failed("تاریخ شمول طرح را بصورت صحیح وارد کنید");
// var groupCounter = 0;
// // var planEmployeeCounter = command.CreatePlan.EditWorkshopPlanEmployeeList == null ? 0 : command.CreatePlan.EditWorkshopPlanEmployeeList.Count;
// for (int i = 0; i <= command.CreatePlan.EditGroupPlanlist.Count - 1; i++)
// {
// if (!string.IsNullOrWhiteSpace(command.CreatePlan.EditGroupPlanlist[i].AnnualSalaryStr)
// && !string.IsNullOrWhiteSpace(command.CreatePlan.EditGroupPlanlist[i].BaseSalaryStr)
// && !string.IsNullOrWhiteSpace(command.CreatePlan.EditGroupPlanlist[i].JobSalaryStr)
// && command.CreatePlan.EditGroupPlanlist[i].JobIdList.Count > 0)
// {
// groupCounter += 1;
}
}
// }
// }
if (groupCounter >= 1)
{
createPlanValidations = true;
// if (groupCounter >= 1)
// {
// createPlanValidations = true;
}
else
{
createPlanValidations = false;
return operation.Failed("وارد کردن اطلاعات تمامی گروه ها الزامی است");
}
}
// }
// else
// {
// createPlanValidations = false;
// return operation.Failed("وارد کردن اطلاعات تمامی گروه ها الزامی است");
// }
//}
//if (string.IsNullOrWhiteSpace(command.TypeOfInsuranceSend))
// return operation.Failed("لطفا نوع ارسال لیست بیمه را مشخص کنید");
var account = new AccountViewModel();

View File

@@ -1,12 +1,17 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Threading.Tasks;
using _0_Framework.Application;
using Company.Domain.YearlySalaryAgg;
using CompanyManagment.App.Contracts.Contract;
using CompanyManagment.App.Contracts.Holiday;
using CompanyManagment.App.Contracts.LeftWork;
using CompanyManagment.App.Contracts.YearlySalary;
using CompanyManagment.EFCore;
using Microsoft.EntityFrameworkCore;
using static Microsoft.EntityFrameworkCore.DbLoggerCategory.Database;
namespace CompanyManagment.Application;
@@ -128,6 +133,41 @@ public class YearlySalaryApplication : IYearlySalaryApplication
return _yearlySalaryRepository.GetYearlySalary();
}
public Task<UpgradeManualDailyWageModel> UpgradeManualDailyWage(DateTime newContractStart, DateTime lastContractStart, double lastContractManualDailyWage)
{
return _yearlySalaryRepository.UpgradeManualDailyWage(newContractStart, lastContractStart,
lastContractManualDailyWage);
}
public async Task<BaseYearDataViewModel> BaseYearComputeByContractId(long contractId)
{
var contract = await _context.Contracts.FirstOrDefaultAsync(x => x.id == contractId);
var leftWorkList = await _context.LeftWorkList.Where(x=>x.EmployeeId ==contract.EmployeeId && x.WorkshopId == contract.WorkshopIds).Select(x => new LeftWorkViewModel()
{
Id = x.id,
LeftWorkDate = x.LeftWorkDate.ToFarsi(),
StartWorkDate = x.StartWorkDate.ToFarsi(),
LeftWorkDateGr = x.LeftWorkDate,
StartWorkDateGr = x.StartWorkDate,
WorkshopId = x.WorkshopId,
EmployeeId = x.EmployeeId,
HasLeft = x.HasLeft,
}).ToListAsync();
var baseYearResult = await _yearlySalaryRepository.BaseYearCompute(contract.ContarctStart, contract.ContractEnd,
contract.EmployeeId, contract.WorkshopIds, leftWorkList);
return baseYearResult;
}
public async Task<(double dailyWage, long yearlySalaryId)> GetDailyWageByStartEnd(DateTime start, DateTime end)
{
return await _yearlySalaryRepository.GetDailyWageByStartEnd(start, end);
}
public List<YearlySalaryViewModel> Search(YearlySalarySearchModel searchModel)
{
return _yearlySalaryRepository.Search(searchModel);

View File

@@ -6,6 +6,7 @@ using Company.Domain.Board;
using Company.Domain.BoardType;
using Company.Domain.ChapterAgg;
using Company.Domain.CheckoutAgg;
using Company.Domain.ClassificationSchemeAgg;
using Company.Domain.ClassifiedSalaryAgg;
using Company.Domain.ClientEmployeeWorkshopAgg;
using Company.Domain.Contact2Agg;
@@ -211,6 +212,42 @@ public class CompanyContext : DbContext
public DbSet<PlanPercentage> PlanPercentages { get; set; }
#region ClassificationScheme
/// <summary>
/// جدول طرح طبقه بندی
/// </summary>
public DbSet<ClassificationScheme> ClassificationSchemes { get; set; }
/// <summary>
/// جدول گروه های طرح
/// </summary>
public DbSet<ClassificationGroup> ClassificationGroups { get; set; }
/// <summary>
/// جدول ضرایب ریالی
/// </summary>
public DbSet<ClassificationRialCoefficient> ClassificationRialCoefficients { get; set; }
/// <summary>
/// جدول شغل های گروه
/// </summary>
public DbSet<ClassificationGroupJob> ClassificationGroupJobs { get; set; }
/// <summary>
/// جدول مزد شغل گروه ها
/// </summary>
public DbSet<ClassificationGroupSalary> ClassificationGroupSalaries { get; set; }
/// <summary>
/// جدول پرسنل طرح
/// </summary>
public DbSet<ClassificationEmployee> ClassificationEmployees { get; set; }
#endregion
#region TemporaryClientRegisteration
public DbSet<ContractingPartyTemp> ContractingPartyTemps { get; set; }

View File

@@ -0,0 +1,22 @@
using Company.Domain.ClassificationSchemeAgg;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace CompanyManagment.EFCore.Mapping;
public class ClassificationEmployeeMapping : IEntityTypeConfiguration<ClassificationEmployee>
{
public void Configure(EntityTypeBuilder<ClassificationEmployee> builder)
{
builder.ToTable("ClassificationEmployee");
builder.HasKey(x => x.id);
builder.Property(x => x.StartGroupDate).IsRequired(false);
builder.Property(x => x.EndGroupDate).IsRequired(false);
builder.HasOne(x => x.ClassificationGroup)
.WithMany(x => x.ClassificationEmployees)
.HasForeignKey(x => x.ClassificationGroupId);
}
}

View File

@@ -0,0 +1,22 @@
using Company.Domain.ClassificationSchemeAgg;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace CompanyManagment.EFCore.Mapping;
public class ClassificationGroupJobMapping : IEntityTypeConfiguration<ClassificationGroupJob>
{
public void Configure(EntityTypeBuilder<ClassificationGroupJob> builder)
{
builder.ToTable("ClassificationGroupJobs");
builder.HasKey(x => x.id);
builder.Property(x => x.JobName).HasMaxLength(255);
builder.Property(x => x.JobCode).HasMaxLength(100);
builder.Property(x => x.GroupNo).HasMaxLength(2);
builder.HasOne(x => x.ClassificationGroup)
.WithMany(x => x.ClassificationGroupJobs)
.HasForeignKey(x => x.ClassificationGroupId);
}
}

View File

@@ -0,0 +1,35 @@
using Company.Domain.ClassificationSchemeAgg;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace CompanyManagment.EFCore.Mapping;
public class ClassificationGroupMapping : IEntityTypeConfiguration<ClassificationGroup>
{
public void Configure(EntityTypeBuilder<ClassificationGroup> builder)
{
builder.ToTable("ClassificationGroups");
builder.HasKey(x => x.id);
builder.Property(x => x.GroupNo).HasMaxLength(2);
builder.HasOne(x => x.ClassificationScheme)
.WithMany(x => x.ClassificationGroups)
.HasForeignKey(x => x.ClassificationSchemeId);
builder.HasMany(x => x.ClassificationGroupJobs)
.WithOne(x => x.ClassificationGroup)
.HasForeignKey(x => x.ClassificationGroupId);
builder.HasMany(x => x.ClassificationEmployees)
.WithOne(x => x.ClassificationGroup)
.HasForeignKey(x => x.ClassificationGroupId);
builder.HasMany(x => x.ClassificationGroupSalaries)
.WithOne(x => x.ClassificationGroup)
.HasForeignKey(x => x.ClassificationGroupId);
}
}

View File

@@ -0,0 +1,20 @@
using Company.Domain.ClassificationSchemeAgg;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace CompanyManagment.EFCore.Mapping;
public class ClassificationGroupSalaryMapping : IEntityTypeConfiguration<ClassificationGroupSalary>
{
public void Configure(EntityTypeBuilder<ClassificationGroupSalary> builder)
{
builder.ToTable("ClassificationGroupSalaries");
builder.HasKey(x => x.id);
builder.Property(x => x.GroupNo).HasMaxLength(2);
builder.HasOne(x => x.ClassificationGroup)
.WithMany(x => x.ClassificationGroupSalaries)
.HasForeignKey(x => x.ClassificationGroupId);
}
}

View File

@@ -0,0 +1,18 @@
using Company.Domain.ClassificationSchemeAgg;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace CompanyManagment.EFCore.Mapping;
public class ClassificationRialCoefficientMapping : IEntityTypeConfiguration<ClassificationRialCoefficient>
{
public void Configure(EntityTypeBuilder<ClassificationRialCoefficient> builder)
{
builder.ToTable("ClassificationRialCoefficients");
builder.HasKey(x => x.id);
builder.HasOne(x => x.ClassificationScheme)
.WithMany(x => x.ClassificationRialCoefficients)
.HasForeignKey(x => x.ClassificationSchemeId);
}
}

View File

@@ -0,0 +1,38 @@
using System;
using _0_Framework.Application.Enums;
using Company.Domain.ClassificationSchemeAgg;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace CompanyManagment.EFCore.Mapping;
public class ClassificationSchemeMapping : IEntityTypeConfiguration<ClassificationScheme>
{
public void Configure(EntityTypeBuilder<ClassificationScheme> builder)
{
builder.ToTable("ClassificationSchemes");
builder.HasKey(x => x.id);
builder.Property(x => x.IncludingDateGr);
builder.Property(x => x.ExecutionDateGr);
builder.Property(x => x.EndSchemeDateGr).IsRequired(false);
builder.Property(x => x.DesignerFullName).HasMaxLength(50);
builder.Property(x => x.DesignerPhone).HasMaxLength(20);
builder.Property(x => x.WorkshopId);
builder.Property(x => x.WorkshopId);
builder.Property(x => x.TypeOfCoefficient).HasConversion(
v => v.ToString(),
v => (TypeOfCoefficient)Enum.Parse(typeof(TypeOfCoefficient), v)).HasMaxLength(30);
builder.HasMany(x => x.ClassificationGroups)
.WithOne(x => x.ClassificationScheme)
.HasForeignKey(x => x.ClassificationSchemeId);
builder.HasMany(x => x.ClassificationRialCoefficients)
.WithOne(x => x.ClassificationScheme)
.HasForeignKey(x => x.ClassificationSchemeId);
}
}

View File

@@ -26,6 +26,8 @@ public class ContractMapping : IEntityTypeConfiguration<Contract>
builder.Property(x => x.ContractPeriod).HasMaxLength(2).IsRequired(false);
builder.Property(x => x.AgreementSalary).HasMaxLength(50).IsRequired(false);
builder.Property(x => x.Signature).HasMaxLength(1).IsRequired(false);
builder.Property(x=>x.DailyWageType).HasMaxLength(30).IsRequired(false);

View File

@@ -20,6 +20,7 @@ public class LeaveMapping : IEntityTypeConfiguration<Leave>
builder.Property(x => x.IsAccepted);
builder.Property(x => x.Decription).HasMaxLength(255);
builder.Property(x => x.ShiftDuration).HasTimeSpanConversion();
builder.HasQueryFilter(x => !x.IsInvalid);
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,73 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace CompanyManagment.EFCore.Migrations
{
/// <inheritdoc />
public partial class ManualDailyWageToContract : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<double>(
name: "BaseYearAffected",
table: "Contracts",
type: "float",
nullable: false,
defaultValue: 0.0);
migrationBuilder.AddColumn<double>(
name: "BaseYearUnAffected",
table: "Contracts",
type: "float",
nullable: false,
defaultValue: 0.0);
migrationBuilder.AddColumn<double>(
name: "DailySalaryAffected",
table: "Contracts",
type: "float",
nullable: false,
defaultValue: 0.0);
migrationBuilder.AddColumn<double>(
name: "DailySalaryUnAffected",
table: "Contracts",
type: "float",
nullable: false,
defaultValue: 0.0);
migrationBuilder.AddColumn<bool>(
name: "HasManualDailyWage",
table: "Contracts",
type: "bit",
nullable: false,
defaultValue: false);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "BaseYearAffected",
table: "Contracts");
migrationBuilder.DropColumn(
name: "BaseYearUnAffected",
table: "Contracts");
migrationBuilder.DropColumn(
name: "DailySalaryAffected",
table: "Contracts");
migrationBuilder.DropColumn(
name: "DailySalaryUnAffected",
table: "Contracts");
migrationBuilder.DropColumn(
name: "HasManualDailyWage",
table: "Contracts");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,29 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace CompanyManagment.EFCore.Migrations
{
/// <inheritdoc />
public partial class DailyWageTypeoContract : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "DailyWageType",
table: "Contracts",
type: "nvarchar(30)",
maxLength: 30,
nullable: true);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "DailyWageType",
table: "Contracts");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,201 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace CompanyManagment.EFCore.Migrations
{
/// <inheritdoc />
public partial class ClassificationScheme : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "ClassificationSchemes",
columns: table => new
{
id = table.Column<long>(type: "bigint", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
IncludingDateGr = table.Column<DateTime>(type: "datetime2", nullable: false),
ExecutionDateGr = table.Column<DateTime>(type: "datetime2", nullable: false),
EndSchemeDateGr = table.Column<DateTime>(type: "datetime2", nullable: true),
DesignerFullName = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
DesignerPhone = table.Column<string>(type: "nvarchar(20)", maxLength: 20, nullable: true),
WorkshopId = table.Column<long>(type: "bigint", nullable: false),
TypeOfCoefficient = table.Column<string>(type: "nvarchar(30)", maxLength: 30, nullable: false),
CreationDate = table.Column<DateTime>(type: "datetime2", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ClassificationSchemes", x => x.id);
});
migrationBuilder.CreateTable(
name: "ClassificationGroups",
columns: table => new
{
id = table.Column<long>(type: "bigint", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
GroupNo = table.Column<string>(type: "nvarchar(2)", maxLength: 2, nullable: true),
WorkshopId = table.Column<long>(type: "bigint", nullable: false),
ClassificationSchemeId = table.Column<long>(type: "bigint", nullable: false),
CreationDate = table.Column<DateTime>(type: "datetime2", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ClassificationGroups", x => x.id);
table.ForeignKey(
name: "FK_ClassificationGroups_ClassificationSchemes_ClassificationSchemeId",
column: x => x.ClassificationSchemeId,
principalTable: "ClassificationSchemes",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "ClassificationRialCoefficients",
columns: table => new
{
id = table.Column<long>(type: "bigint", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
ClassificationSchemeId = table.Column<long>(type: "bigint", nullable: false),
RialCoefficient = table.Column<double>(type: "float", nullable: false),
StartDate = table.Column<DateTime>(type: "datetime2", nullable: false),
EndDate = table.Column<DateTime>(type: "datetime2", nullable: false),
Year = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ClassificationRialCoefficients", x => x.id);
table.ForeignKey(
name: "FK_ClassificationRialCoefficients_ClassificationSchemes_ClassificationSchemeId",
column: x => x.ClassificationSchemeId,
principalTable: "ClassificationSchemes",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "ClassificationEmployee",
columns: table => new
{
id = table.Column<long>(type: "bigint", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
WorkshopId = table.Column<long>(type: "bigint", nullable: false),
EmployeeId = table.Column<long>(type: "bigint", nullable: false),
ClassificationSchemeId = table.Column<long>(type: "bigint", nullable: false),
ClassificationGroupId = table.Column<long>(type: "bigint", nullable: false),
ClassificationGroupJobId = table.Column<long>(type: "bigint", nullable: false),
StartGroupDate = table.Column<DateTime>(type: "datetime2", nullable: true),
EndGroupDate = table.Column<DateTime>(type: "datetime2", nullable: true),
CreationDate = table.Column<DateTime>(type: "datetime2", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ClassificationEmployee", x => x.id);
table.ForeignKey(
name: "FK_ClassificationEmployee_ClassificationGroups_ClassificationGroupId",
column: x => x.ClassificationGroupId,
principalTable: "ClassificationGroups",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "ClassificationGroupJobs",
columns: table => new
{
id = table.Column<long>(type: "bigint", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
JobId = table.Column<long>(type: "bigint", nullable: false),
JobName = table.Column<string>(type: "nvarchar(255)", maxLength: 255, nullable: true),
JobCode = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
ClassificationGroupId = table.Column<long>(type: "bigint", nullable: false),
GroupNo = table.Column<string>(type: "nvarchar(2)", maxLength: 2, nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_ClassificationGroupJobs", x => x.id);
table.ForeignKey(
name: "FK_ClassificationGroupJobs_ClassificationGroups_ClassificationGroupId",
column: x => x.ClassificationGroupId,
principalTable: "ClassificationGroups",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "ClassificationGroupSalaries",
columns: table => new
{
id = table.Column<long>(type: "bigint", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
ClassificationGroupId = table.Column<long>(type: "bigint", nullable: false),
GroupNo = table.Column<string>(type: "nvarchar(2)", maxLength: 2, nullable: true),
GroupSalary = table.Column<double>(type: "float", nullable: false),
StartDate = table.Column<DateTime>(type: "datetime2", nullable: false),
EndDate = table.Column<DateTime>(type: "datetime2", nullable: false),
Year = table.Column<int>(type: "int", nullable: false),
CreationDate = table.Column<DateTime>(type: "datetime2", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ClassificationGroupSalaries", x => x.id);
table.ForeignKey(
name: "FK_ClassificationGroupSalaries_ClassificationGroups_ClassificationGroupId",
column: x => x.ClassificationGroupId,
principalTable: "ClassificationGroups",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_ClassificationEmployee_ClassificationGroupId",
table: "ClassificationEmployee",
column: "ClassificationGroupId");
migrationBuilder.CreateIndex(
name: "IX_ClassificationGroupJobs_ClassificationGroupId",
table: "ClassificationGroupJobs",
column: "ClassificationGroupId");
migrationBuilder.CreateIndex(
name: "IX_ClassificationGroups_ClassificationSchemeId",
table: "ClassificationGroups",
column: "ClassificationSchemeId");
migrationBuilder.CreateIndex(
name: "IX_ClassificationGroupSalaries_ClassificationGroupId",
table: "ClassificationGroupSalaries",
column: "ClassificationGroupId");
migrationBuilder.CreateIndex(
name: "IX_ClassificationRialCoefficients_ClassificationSchemeId",
table: "ClassificationRialCoefficients",
column: "ClassificationSchemeId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "ClassificationEmployee");
migrationBuilder.DropTable(
name: "ClassificationGroupJobs");
migrationBuilder.DropTable(
name: "ClassificationGroupSalaries");
migrationBuilder.DropTable(
name: "ClassificationRialCoefficients");
migrationBuilder.DropTable(
name: "ClassificationGroups");
migrationBuilder.DropTable(
name: "ClassificationSchemes");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,29 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace CompanyManagment.EFCore.Migrations
{
/// <inheritdoc />
public partial class newPropToWorkshop : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<bool>(
name: "IsClassificationSchemeCompleted",
table: "Workshops",
type: "bit",
nullable: false,
defaultValue: false);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "IsClassificationSchemeCompleted",
table: "Workshops");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,29 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace CompanyManagment.EFCore.Migrations
{
/// <inheritdoc />
public partial class addisInvalidtoleave : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<bool>(
name: "IsInvalid",
table: "Leave",
type: "bit",
nullable: false,
defaultValue: false);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "IsInvalid",
table: "Leave");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,29 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace CompanyManagment.EFCore.Migrations
{
/// <inheritdoc />
public partial class SchemeIdAdded : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<long>(
name: "SchemeId",
table: "ClassificationGroupSalaries",
type: "bigint",
nullable: false,
defaultValue: 0L);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "SchemeId",
table: "ClassificationGroupSalaries");
}
}
}

View File

@@ -443,6 +443,217 @@ namespace CompanyManagment.EFCore.Migrations
b.ToTable("Checkouts", (string)null);
});
modelBuilder.Entity("Company.Domain.ClassificationSchemeAgg.ClassificationEmployee", b =>
{
b.Property<long>("id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("id"));
b.Property<long>("ClassificationGroupId")
.HasColumnType("bigint");
b.Property<long>("ClassificationGroupJobId")
.HasColumnType("bigint");
b.Property<long>("ClassificationSchemeId")
.HasColumnType("bigint");
b.Property<DateTime>("CreationDate")
.HasColumnType("datetime2");
b.Property<long>("EmployeeId")
.HasColumnType("bigint");
b.Property<DateTime?>("EndGroupDate")
.HasColumnType("datetime2");
b.Property<DateTime?>("StartGroupDate")
.HasColumnType("datetime2");
b.Property<long>("WorkshopId")
.HasColumnType("bigint");
b.HasKey("id");
b.HasIndex("ClassificationGroupId");
b.ToTable("ClassificationEmployee", (string)null);
});
modelBuilder.Entity("Company.Domain.ClassificationSchemeAgg.ClassificationGroup", b =>
{
b.Property<long>("id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("id"));
b.Property<long>("ClassificationSchemeId")
.HasColumnType("bigint");
b.Property<DateTime>("CreationDate")
.HasColumnType("datetime2");
b.Property<string>("GroupNo")
.HasMaxLength(2)
.HasColumnType("nvarchar(2)");
b.Property<long>("WorkshopId")
.HasColumnType("bigint");
b.HasKey("id");
b.HasIndex("ClassificationSchemeId");
b.ToTable("ClassificationGroups", (string)null);
});
modelBuilder.Entity("Company.Domain.ClassificationSchemeAgg.ClassificationGroupJob", b =>
{
b.Property<long>("id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("id"));
b.Property<long>("ClassificationGroupId")
.HasColumnType("bigint");
b.Property<string>("GroupNo")
.HasMaxLength(2)
.HasColumnType("nvarchar(2)");
b.Property<string>("JobCode")
.HasMaxLength(100)
.HasColumnType("nvarchar(100)");
b.Property<long>("JobId")
.HasColumnType("bigint");
b.Property<string>("JobName")
.HasMaxLength(255)
.HasColumnType("nvarchar(255)");
b.HasKey("id");
b.HasIndex("ClassificationGroupId");
b.ToTable("ClassificationGroupJobs", (string)null);
});
modelBuilder.Entity("Company.Domain.ClassificationSchemeAgg.ClassificationGroupSalary", b =>
{
b.Property<long>("id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("id"));
b.Property<long>("ClassificationGroupId")
.HasColumnType("bigint");
b.Property<DateTime>("CreationDate")
.HasColumnType("datetime2");
b.Property<DateTime>("EndDate")
.HasColumnType("datetime2");
b.Property<string>("GroupNo")
.HasMaxLength(2)
.HasColumnType("nvarchar(2)");
b.Property<double>("GroupSalary")
.HasColumnType("float");
b.Property<long>("SchemeId")
.HasColumnType("bigint");
b.Property<DateTime>("StartDate")
.HasColumnType("datetime2");
b.Property<int>("Year")
.HasColumnType("int");
b.HasKey("id");
b.HasIndex("ClassificationGroupId");
b.ToTable("ClassificationGroupSalaries", (string)null);
});
modelBuilder.Entity("Company.Domain.ClassificationSchemeAgg.ClassificationRialCoefficient", b =>
{
b.Property<long>("id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("id"));
b.Property<long>("ClassificationSchemeId")
.HasColumnType("bigint");
b.Property<DateTime>("EndDate")
.HasColumnType("datetime2");
b.Property<double>("RialCoefficient")
.HasColumnType("float");
b.Property<DateTime>("StartDate")
.HasColumnType("datetime2");
b.Property<int>("Year")
.HasColumnType("int");
b.HasKey("id");
b.HasIndex("ClassificationSchemeId");
b.ToTable("ClassificationRialCoefficients", (string)null);
});
modelBuilder.Entity("Company.Domain.ClassificationSchemeAgg.ClassificationScheme", b =>
{
b.Property<long>("id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("id"));
b.Property<DateTime>("CreationDate")
.HasColumnType("datetime2");
b.Property<string>("DesignerFullName")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("DesignerPhone")
.HasMaxLength(20)
.HasColumnType("nvarchar(20)");
b.Property<DateTime?>("EndSchemeDateGr")
.HasColumnType("datetime2");
b.Property<DateTime>("ExecutionDateGr")
.HasColumnType("datetime2");
b.Property<DateTime>("IncludingDateGr")
.HasColumnType("datetime2");
b.Property<string>("TypeOfCoefficient")
.IsRequired()
.HasMaxLength(30)
.HasColumnType("nvarchar(30)");
b.Property<long>("WorkshopId")
.HasColumnType("bigint");
b.HasKey("id");
b.ToTable("ClassificationSchemes", (string)null);
});
modelBuilder.Entity("Company.Domain.ClassifiedSalaryAgg.ClassifiedSalary", b =>
{
b.Property<long>("id")
@@ -753,6 +964,12 @@ namespace CompanyManagment.EFCore.Migrations
.HasMaxLength(255)
.HasColumnType("nvarchar(255)");
b.Property<double>("BaseYearAffected")
.HasColumnType("float");
b.Property<double>("BaseYearUnAffected")
.HasColumnType("float");
b.Property<string>("ConsumableItems")
.IsRequired()
.HasMaxLength(50)
@@ -781,6 +998,16 @@ namespace CompanyManagment.EFCore.Migrations
b.Property<DateTime>("CreationDate")
.HasColumnType("datetime2");
b.Property<double>("DailySalaryAffected")
.HasColumnType("float");
b.Property<double>("DailySalaryUnAffected")
.HasColumnType("float");
b.Property<string>("DailyWageType")
.HasMaxLength(30)
.HasColumnType("nvarchar(30)");
b.Property<string>("DayliWage")
.IsRequired()
.HasMaxLength(50)
@@ -800,6 +1027,9 @@ namespace CompanyManagment.EFCore.Migrations
b.Property<DateTime>("GetWorkDate")
.HasColumnType("datetime2");
b.Property<bool>("HasManualDailyWage")
.HasColumnType("bit");
b.Property<string>("HousingAllowance")
.IsRequired()
.HasMaxLength(50)
@@ -3721,6 +3951,9 @@ namespace CompanyManagment.EFCore.Migrations
b.Property<bool>("IsAccepted")
.HasColumnType("bit");
b.Property<bool>("IsInvalid")
.HasColumnType("bit");
b.Property<string>("LeaveHourses")
.HasMaxLength(5)
.HasColumnType("nvarchar(5)");
@@ -5936,6 +6169,9 @@ namespace CompanyManagment.EFCore.Migrations
.HasMaxLength(10)
.HasColumnType("nvarchar(10)");
b.Property<bool>("IsClassificationSchemeCompleted")
.HasColumnType("bit");
b.Property<bool>("IsClassified")
.HasColumnType("bit");
@@ -6647,6 +6883,61 @@ namespace CompanyManagment.EFCore.Migrations
b.Navigation("Workshop");
});
modelBuilder.Entity("Company.Domain.ClassificationSchemeAgg.ClassificationEmployee", b =>
{
b.HasOne("Company.Domain.ClassificationSchemeAgg.ClassificationGroup", "ClassificationGroup")
.WithMany("ClassificationEmployees")
.HasForeignKey("ClassificationGroupId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("ClassificationGroup");
});
modelBuilder.Entity("Company.Domain.ClassificationSchemeAgg.ClassificationGroup", b =>
{
b.HasOne("Company.Domain.ClassificationSchemeAgg.ClassificationScheme", "ClassificationScheme")
.WithMany("ClassificationGroups")
.HasForeignKey("ClassificationSchemeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("ClassificationScheme");
});
modelBuilder.Entity("Company.Domain.ClassificationSchemeAgg.ClassificationGroupJob", b =>
{
b.HasOne("Company.Domain.ClassificationSchemeAgg.ClassificationGroup", "ClassificationGroup")
.WithMany("ClassificationGroupJobs")
.HasForeignKey("ClassificationGroupId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("ClassificationGroup");
});
modelBuilder.Entity("Company.Domain.ClassificationSchemeAgg.ClassificationGroupSalary", b =>
{
b.HasOne("Company.Domain.ClassificationSchemeAgg.ClassificationGroup", "ClassificationGroup")
.WithMany("ClassificationGroupSalaries")
.HasForeignKey("ClassificationGroupId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("ClassificationGroup");
});
modelBuilder.Entity("Company.Domain.ClassificationSchemeAgg.ClassificationRialCoefficient", b =>
{
b.HasOne("Company.Domain.ClassificationSchemeAgg.ClassificationScheme", "ClassificationScheme")
.WithMany("ClassificationRialCoefficients")
.HasForeignKey("ClassificationSchemeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("ClassificationScheme");
});
modelBuilder.Entity("Company.Domain.ClientEmployeeWorkshopAgg.ClientEmployeeWorkshop", b =>
{
b.HasOne("Company.Domain.EmployeeAgg.Employee", "Employee")
@@ -9910,6 +10201,22 @@ namespace CompanyManagment.EFCore.Migrations
b.Navigation("PetitionsList");
});
modelBuilder.Entity("Company.Domain.ClassificationSchemeAgg.ClassificationGroup", b =>
{
b.Navigation("ClassificationEmployees");
b.Navigation("ClassificationGroupJobs");
b.Navigation("ClassificationGroupSalaries");
});
modelBuilder.Entity("Company.Domain.ClassificationSchemeAgg.ClassificationScheme", b =>
{
b.Navigation("ClassificationGroups");
b.Navigation("ClassificationRialCoefficients");
});
modelBuilder.Entity("Company.Domain.ContarctingPartyAgg.PersonalContractingParty", b =>
{
b.Navigation("ContractingPartyBankAccounts");

View File

@@ -0,0 +1,192 @@
using System.Collections.Generic;
using System.Linq;
using System;
using System.Threading.Tasks;
using _0_Framework.Application;
using _0_Framework.InfraStructure;
using Company.Domain.ClassificationSchemeAgg;
using CompanyManagment.App.Contracts.ClassificationScheme;
using CompanyManagment.App.Contracts.Workshop;
using Microsoft.EntityFrameworkCore;
namespace CompanyManagment.EFCore.Repository;
public class ClassificationEmployeeRepository : RepositoryBase<long, ClassificationEmployee>, IClassificationEmployeeRepository
{
private readonly CompanyContext _context;
public ClassificationEmployeeRepository(CompanyContext context) : base(context)
{
_context = context;
}
public async Task<List<EmployeeInfoList>> GetEmployeeListData(long schemeId)
{
var leftDate = new DateTime(2121, 3, 21);
var workshopId = _context.ClassificationSchemes.FirstOrDefault(x => x.id == schemeId)!.WorkshopId;
var join = new List<PersonnelInfoViewModel>();
var contractLeftWork =await _context.LeftWorkList.Include(em=>em.Employee).Select(x => new PersonnelInfoViewModel()
{
WorkshopId = x.WorkshopId,
EmployeeId = x.EmployeeId,
FullName = x.Employee.FullName,
PersonnelCode = 0,
ContractPerson = true,
ContractLeft = x.LeftWorkDate != leftDate,
StartWork = x.StartWorkDate,
LeftWork = x.LeftWorkDate,
LastStartInsuranceWork = "-",
LastLeftInsuranceWork = "-",
}).Where(x => x.WorkshopId == workshopId)
.OrderByDescending(x => x.StartWork)
.ToListAsync();
contractLeftWork = contractLeftWork.Select(x => new PersonnelInfoViewModel()
{
WorkshopId = x.WorkshopId,
EmployeeId = x.EmployeeId,
FullName = x.FullName,
ContractPerson = true,
ContractLeft = x.ContractLeft,
LastStartContractWork = x.StartWork.ToFarsi(),
LastLeftContractWork = x.LeftWork != leftDate ? x.LeftWork.ToFarsi() : "-",
StartWork = x.StartWork,
LeftWork = x.LeftWork,
LastStartInsuranceWork = x.LastStartInsuranceWork,
LastLeftInsuranceWork = x.LastLeftInsuranceWork,
}).ToList();
var insuranceLeftWork =await _context.LeftWorkInsuranceList.Include(em=> em.Employee).Select(x => new PersonnelInfoViewModel()
{
WorkshopId = x.WorkshopId,
EmployeeId = x.EmployeeId,
FullName = x.Employee.FullName,
PersonnelCode = 0,
InsurancePerson = true,
InsuranceLeft = x.LeftWorkDate != null,
StartWork = x.StartWorkDate,
LastStartInsuranceWork = x.StartWorkDate.ToFarsi(),
LastLeftInsuranceWork = x.LeftWorkDate != null ? x.LeftWorkDate.ToFarsi() : "-",
}).Where(x => x.WorkshopId == workshopId)
.OrderByDescending(x => x.StartWork).ToListAsync();
insuranceLeftWork = insuranceLeftWork.Select(x => new PersonnelInfoViewModel()
{
WorkshopId = x.WorkshopId,
EmployeeId = x.EmployeeId,
FullName = x.FullName,
PersonnelCode = _context.PersonnelCodeSet.Any(p => p.EmployeeId == x.EmployeeId && p.WorkshopId == x.WorkshopId) ?
_context.PersonnelCodeSet.FirstOrDefault(p => p.EmployeeId == x.EmployeeId && p.WorkshopId == x.WorkshopId)!.PersonnelCode : 0,
InsurancePerson = true,
InsuranceLeft = x.InsuranceLeft,
StartWork = x.StartWork,
LastStartInsuranceWork = x.LastStartInsuranceWork,
LastLeftInsuranceWork = x.LastLeftInsuranceWork,
}).ToList();
var joinEqualList = contractLeftWork.Join(insuranceLeftWork,
x => x.EmployeeId,
c => c.EmployeeId,
(first, second) => new PersonnelInfoViewModel
{
EmployeeId = first.EmployeeId,
ContractPerson = first.ContractPerson,
ContractLeft = first.ContractLeft,
InsurancePerson = second.InsurancePerson,
InsuranceLeft = second.InsuranceLeft,
LastStartContractWork = first.LastStartContractWork,
LastLeftContractWork = first.LastLeftContractWork,
StartWork = first.StartWork,
LeftWork = first.LeftWork,
LastStartInsuranceWork = second.LastStartInsuranceWork,
LastLeftInsuranceWork = second.LastLeftInsuranceWork,
}).ToList();
if (contractLeftWork.Any() && !insuranceLeftWork.Any())
{
join = contractLeftWork.ToList();
}
else if (!contractLeftWork.Any() && insuranceLeftWork.Any())
{
join = insuranceLeftWork.ToList();
}
else if (contractLeftWork.Any() && insuranceLeftWork.Any())
{
join = contractLeftWork.Concat(insuranceLeftWork).ToList();
}
//if (joinEqualList.Count == 0)
// return new List<EmployeeInfoList>();
//join = join.GroupBy(x => x.EmployeeId).Select(d => d.First()).ToList();
var employeeWhitGroup = _context.ClassificationEmployees.Include(g=>g.ClassificationGroup)
.Where(x => x.ClassificationSchemeId == schemeId);
var finalList = join.Select(x =>
{
var hasGroup = employeeWhitGroup.Any(em => em.EmployeeId == x.EmployeeId);
var groupNo = "";
if (hasGroup)
{
var group = employeeWhitGroup.Where(g => g.EmployeeId == x.EmployeeId)
.Select(n => n.ClassificationGroup.GroupNo).ToList();
if (group.Count > 0)
groupNo = string.Join(" - ", group);
}
var contractPerson = joinEqualList.Any(c => c.EmployeeId == x.EmployeeId) ? joinEqualList.FirstOrDefault(c => c.EmployeeId == x.EmployeeId)!.ContractPerson : x.ContractPerson;
var insurancePerson = joinEqualList.Any(c => c.EmployeeId == x.EmployeeId) ? joinEqualList.FirstOrDefault(c => c.EmployeeId == x.EmployeeId)!.InsurancePerson : x.InsurancePerson;
var contractLeft = joinEqualList.Any(c => c.EmployeeId == x.EmployeeId) ? joinEqualList.FirstOrDefault(c => c.EmployeeId == x.EmployeeId)!.ContractLeft : x.ContractLeft;
var insuranceLeft = joinEqualList.Any(c => c.EmployeeId == x.EmployeeId) ? joinEqualList.FirstOrDefault(c => c.EmployeeId == x.EmployeeId)!.InsuranceLeft : x.InsuranceLeft;
var lastStartInsuranceWork = joinEqualList.Any(c => c.EmployeeId == x.EmployeeId) ? joinEqualList.FirstOrDefault(c => c.EmployeeId == x.EmployeeId)!.LastStartInsuranceWork : x.LastStartInsuranceWork;
var lastLeftInsuranceWork = joinEqualList.Any(c => c.EmployeeId == x.EmployeeId) ? joinEqualList.FirstOrDefault(c => c.EmployeeId == x.EmployeeId)!.LastLeftInsuranceWork : x.LastLeftInsuranceWork;
return new EmployeeInfoList
{
HasGroup = hasGroup,
GroupNo = groupNo,
EmployeeId = x.EmployeeId,
FullName = x.FullName,
ContractPerson = contractPerson,
InsurancePerson = insurancePerson,
ContractLeft = contractLeft,
InsuranceLeft = insuranceLeft,
Black = ((contractPerson && insurancePerson && insuranceLeft && contractLeft) || (contractPerson && !insurancePerson && contractLeft) || (insurancePerson && !contractPerson && insuranceLeft)) ? true : false,
LastStartContractWork = x.LastStartContractWork,
LastLeftContractWork = x.LastLeftContractWork,
LastStartInsuranceWork = lastStartInsuranceWork,
LastLeftInsuranceWork = lastLeftInsuranceWork,
};
}).ToList();
var final = finalList.GroupBy(x => x.EmployeeId).Select(x => x.First()).ToList();
return final;
}
/// <summary>
/// دریافت اطلاعات عضویتی پرسنل در گروه
/// </summary>
/// <param name="employeeId"></param>
/// <returns></returns>
public async Task<ClassificationEmployee> GetEmployeeMemberizeData(long employeeId)
{
return await _context.ClassificationEmployees.FirstOrDefaultAsync(x => x.EmployeeId == employeeId);
}
}

View File

@@ -0,0 +1,167 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using _0_Framework.InfraStructure;
using Company.Domain.ClassificationSchemeAgg;
using CompanyManagment.App.Contracts.ClassificationScheme;
using Microsoft.EntityFrameworkCore;
namespace CompanyManagment.EFCore.Repository;
public class ClassificationGroupRepository : RepositoryBase<long, ClassificationGroup>, IClassificationGroupRepository
{
private readonly CompanyContext _context;
public ClassificationGroupRepository(CompanyContext context) : base(context)
{
_context = context;
}
/// <summary>
/// دریافت گروه های طرح
/// </summary>
/// <param name="schemeId"></param>
/// <returns></returns>
public async Task<List<ClassificationGroupList>> GetGroups(long schemeId)
{
return await _context.ClassificationGroups
.Where(x => x.ClassificationSchemeId == schemeId)
.Select(x=> new ClassificationGroupList
{
GroupId = x.id,
GroupNo = x.GroupNo,
GroupNoInt = Convert.ToInt32(x.GroupNo)
}).OrderBy(x=>x.GroupNoInt).ToListAsync();
}
/// <summary>
/// دریافت گروه ها و مشاغلشان برای تب تعیین مشاغل
/// </summary>
/// <param name="schemeId"></param>
/// <returns></returns>
public async Task<List<ClassificationGroupAndJobModel>> GetGroupAndJobs(long schemeId)
{
return await _context.ClassificationGroups.Where(x => x.ClassificationSchemeId == schemeId)
.Include(x => x.ClassificationGroupJobs).Select(x => new ClassificationGroupAndJobModel
{
GroupId = x.id,
GroupNo = x.GroupNo,
GroupNoInt = Convert.ToInt32(x.GroupNo),
WorkshopId = x.WorkshopId,
ClassificationSchemeId = x.ClassificationSchemeId,
EditClassificationGroupJob = x.ClassificationGroupJobs.Select(jobs => new EditClassificationGroupJob()
{
Id = jobs.id,
JobId = jobs.JobId,
JobName = jobs.JobName,
JobCode = jobs.JobCode,
ClassificationGroupId = jobs.ClassificationGroupId,
GroupNo = jobs.GroupNo,
}).ToList(),
}).OrderBy(x=>x.GroupNoInt).ToListAsync();
}
/// <summary>
/// دریافت مشاغل گروه توسط آی دی گروه
/// </summary>
/// <param name="groupId"></param>
/// <returns></returns>
public async Task<List<EditClassificationGroupJob>> GetGroupJobs(long groupId)
{
return await _context.ClassificationGroupJobs
.Where(x => x.ClassificationGroupId == groupId).Select(jobs => new EditClassificationGroupJob()
{
Id = jobs.id,
JobId = jobs.JobId,
JobName = jobs.JobName,
JobCode = jobs.JobCode,
ClassificationGroupId = jobs.ClassificationGroupId,
GroupNo = jobs.GroupNo,
}).ToListAsync();
}
/// <summary>
/// چک میکند که آی پرسنلی وجود دارد که این شغل به او نسبت داده شده
/// </summary>
/// <param name="id"></param>
/// <param name="groupId"></param>
/// <returns></returns>
public async Task<bool> CheckEmployeeHasThisJob(long id, long groupId)
{
return await _context.ClassificationEmployees.AnyAsync(x =>
x.ClassificationGroupJobId == id && x.ClassificationGroupId == groupId);
}
/// <summary>
/// ایجاد مشاغل
/// </summary>
/// <param name="createClassificationGroupJob"></param>
/// <param name="deleteJobList"></param>
/// <returns></returns>
public async Task<bool> CreateJobs(List<ClassificationGroupJob> createClassificationGroupJob, List<long> deleteJobList)
{
if (createClassificationGroupJob.Count > 0)
{
await _context.ClassificationGroupJobs.AddRangeAsync(createClassificationGroupJob);
await _context.SaveChangesAsync();
}
if (deleteJobList.Count > 0)
{
var deleteItems = _context.ClassificationGroupJobs.Where(x => deleteJobList.Contains(x.id));
_context.ClassificationGroupJobs.RemoveRange(deleteItems);
await _context.SaveChangesAsync();
}
return true;
}
/// <summary>
/// در یافت اطلاعات گروه برای لود مودال ایجاد دستمزد های
/// </summary>
/// <returns></returns>
public async Task<SalaryAndRialCoefficientModel> GetGroupToCreateSalariesModal(long schemeId)
{
var result = new SalaryAndRialCoefficientModel();
var scheme =await _context.ClassificationSchemes.FirstOrDefaultAsync(x => x.id == schemeId);
var groups =await _context.ClassificationGroups.Where(x => x.ClassificationSchemeId == schemeId).ToListAsync();
if (scheme != null)
{
result.TypeOfCoefficient = scheme.TypeOfCoefficient;
result.SchemeId = schemeId;
result.SalariesAndCoefficientList = groups.Select(x => new EditClassificationGroupSalaryAndRialCoefficient
{
ClassificationGroupId = x.id,
GroupNo = x.GroupNo,
}).ToList();
}
return result;
}
/// <summary>
/// ایجاد گروه های بیست گانه
/// </summary>
/// <param name="groupList"></param>
/// <returns></returns>
public async Task CreateGroups(List<ClassificationGroup> groupList)
{
await _context.AddRangeAsync(groupList);
await _context.SaveChangesAsync();
}
}

View File

@@ -0,0 +1,143 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using _0_Framework.Application;
using _0_Framework.Application.Enums;
using _0_Framework.InfraStructure;
using Company.Domain.ClassificationSchemeAgg;
using CompanyManagment.App.Contracts.ClassificationScheme;
using Microsoft.EntityFrameworkCore;
namespace CompanyManagment.EFCore.Repository;
public class ClassificationGroupSalariesRepository : RepositoryBase<long, ClassificationGroupSalary>, IClassificationGroupSalariesRepository
{
private readonly CompanyContext _context;
public ClassificationGroupSalariesRepository(CompanyContext context) : base(context)
{
_context = context;
}
public async Task CreateSalaries(List<ClassificationGroupSalary> createClassificationGroupSalary)
{
if (createClassificationGroupSalary.Count > 0)
{
await _context.ClassificationGroupSalaries.AddRangeAsync(createClassificationGroupSalary);
await _context.SaveChangesAsync();
}
}
/// <summary>
/// دریافت دستمزدها و ضریب ریالی برای مودال ویرایش
/// </summary>
/// <param name="schemeId"></param>
/// <param name="startDate"></param>
/// <param name="endDate"></param>
/// <returns></returns>
public async Task<SalaryAndRialCoefficientModel> GetEditSalariesData(long schemeId, string startDate, string endDate)
{
var salaryAndRialCoefficientModel = new SalaryAndRialCoefficientModel();
try
{
var scheme = _context.ClassificationSchemes.FirstOrDefaultAsync(x => x.id == schemeId).GetAwaiter().GetResult();
var startDatGr = startDate.ToGeorgian();
var rialCoEfficient = await _context.ClassificationRialCoefficients
.FirstOrDefaultAsync(x => x.ClassificationSchemeId == schemeId && x.StartDate == startDatGr);
salaryAndRialCoefficientModel.SchemeId = schemeId;
salaryAndRialCoefficientModel.StartDateFa = startDate;
salaryAndRialCoefficientModel.EndDateFa = endDate;
salaryAndRialCoefficientModel.TypeOfCoefficient = scheme.TypeOfCoefficient;
if (rialCoEfficient == null)
{
salaryAndRialCoefficientModel.RialCoefficient = 0;
salaryAndRialCoefficientModel.CoefficientId = 0;
}
else
{
salaryAndRialCoefficientModel.RialCoefficient = scheme.TypeOfCoefficient == TypeOfCoefficient.RialCoefficient ? rialCoEfficient.RialCoefficient : 0;
salaryAndRialCoefficientModel.CoefficientId = scheme.TypeOfCoefficient == TypeOfCoefficient.RialCoefficient ? rialCoEfficient.id : 0;
}
salaryAndRialCoefficientModel.SalariesAndCoefficientList = _context.ClassificationGroupSalaries.Where(x => x.SchemeId == schemeId && x.StartDate == startDatGr).Select(x => new EditClassificationGroupSalaryAndRialCoefficient
{
Id = x.id,
ClassificationGroupId = x.ClassificationGroupId,
GroupNo = x.GroupNo,
GroupSalaryStr = x.GroupSalary.ToMoney(),
GroupSalary = x.GroupSalary
})
.ToList();
}
catch (System.Exception)
{
return new SalaryAndRialCoefficientModel();
}
return salaryAndRialCoefficientModel;
}
public async Task<SalaryAndRialCoefficientTab> GetSalariesTabData(long schemeId)
{
var scheme = await _context.ClassificationSchemes.Include(xc=>xc.ClassificationRialCoefficients)
.Include(xg => xg.ClassificationGroups)
.ThenInclude(xs => xs.ClassificationGroupSalaries)
.FirstOrDefaultAsync(x => x.id == schemeId);
if (scheme == null)
return null;
// جمع‌آوری همه‌ی حقوق‌ها از تمام گروه‌ها
var allSalaries = scheme.ClassificationGroups
.SelectMany(g => g.ClassificationGroupSalaries)
.ToList();
// اگر هیچ حقوقی وجود ندارد
if (!allSalaries.Any())
{
return new SalaryAndRialCoefficientTab
{
SchemeId = scheme.id,
HasAnySalaries = false,
SalaryAndRialCoefficientTabDataList = new List<SalaryAndRialCoefficientTabDataList>()
};
}
// گروه‌بندی بر اساس StartDate و EndDate برای حذف موارد تکراری
var distinctPeriods = allSalaries
.GroupBy(s => new { s.StartDate, s.EndDate })
.Select(g => g.First()) // فقط یکی از هر بازه تاریخ
.OrderByDescending(x => x.StartDate)
.ToList();
//تبدیل به مدل خروجی
var dataList = distinctPeriods
.Select(s => new SalaryAndRialCoefficientTabDataList
{
RialCoefficientStr = $"{scheme.ClassificationRialCoefficients.FirstOrDefault(x=>x.StartDate.Date == s.StartDate.Date && x.EndDate.Date == s.EndDate.Date)?.RialCoefficient}",
StartDateFa = s.StartDate.ToFarsi(),
EndDateFa = s.EndDate.ToFarsi(),
Year = s.Year// یا هر روش سال شمسی که داری
})
.ToList();
var result = new SalaryAndRialCoefficientTab
{
SchemeId = scheme.id,
HasAnySalaries = allSalaries.Any(),
SalaryAndRialCoefficientTabDataList = dataList
};
return result;
}
}

View File

@@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Threading.Tasks;
using _0_Framework.InfraStructure;
using Company.Domain.ClassificationSchemeAgg;
using Microsoft.EntityFrameworkCore;
namespace CompanyManagment.EFCore.Repository;
public class ClassificationRialCoefficientRepository : RepositoryBase<long, ClassificationRialCoefficient>, IClassificationRialCoefficientRepository
{
private readonly CompanyContext _context;
public ClassificationRialCoefficientRepository(CompanyContext context) : base(context)
{
_context = context;
}
}

View File

@@ -0,0 +1,542 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using _0_Framework.Application;
using _0_Framework.InfraStructure;
using Company.Domain.ClassificationSchemeAgg;
using CompanyManagment.App.Contracts.ClassificationScheme;
using CompanyManagment.App.Contracts.LeftWork;
using CompanyManagment.App.Contracts.YearlySalary;
using Microsoft.EntityFrameworkCore;
using PersianTools.Core;
namespace CompanyManagment.EFCore.Repository;
public class ClassificationSchemeRepository :RepositoryBase<long, ClassificationScheme>, IClassificationSchemeRepository
{
private readonly CompanyContext _context;
public ClassificationSchemeRepository(CompanyContext context) : base(context)
{
_context = context;
}
public async Task<ClassificationSchemePartialModel> ClassificationSchemePartialModel(long workshopId)
{
var hasScheme =await _context.ClassificationSchemes.AnyAsync(x => x.WorkshopId == workshopId);
if (!hasScheme)
return new ClassificationSchemePartialModel()
{
HasScheme = false,
};
var schemeList = _context.ClassificationSchemes.Where(x => x.WorkshopId == workshopId).Select(x =>
new EditClassificationScheme()
{
Id = x.id,
WorkshopId = x.WorkshopId,
IncludingDateGr = x.IncludingDateGr,
ExecutionDateGr = x.ExecutionDateGr,
EndSchemeDateGr = x.EndSchemeDateGr,
IncludingDateFa = x.IncludingDateGr.ToFarsi(),
ExecutionDateFa = x.ExecutionDateGr.ToFarsi(),
DesignerFullName = x.DesignerFullName,
DesignerPhone = x.DesignerPhone,
TypeOfCoefficient = x.TypeOfCoefficient
}).ToListAsync();
return new ClassificationSchemePartialModel()
{
HasScheme = true,
WorkshopId = workshopId,
ClassificationSchemesList = schemeList.GetAwaiter().GetResult()
};
}
/// <summary>
/// دریافت اطلاعات طرح برای ویرایش
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
public Task<EditClassificationScheme> GetClassificationScheme(long id)
{
return _context.ClassificationSchemes.Select(x =>
new EditClassificationScheme()
{
Id = x.id,
WorkshopId = x.WorkshopId,
IncludingDateGr = x.IncludingDateGr,
ExecutionDateGr = x.ExecutionDateGr,
EndSchemeDateGr = x.EndSchemeDateGr,
IncludingDateFa = x.IncludingDateGr.ToFarsi(),
ExecutionDateFa = x.ExecutionDateGr.ToFarsi(),
DesignerFullName = x.DesignerFullName,
DesignerPhone = x.DesignerPhone,
TypeOfCoefficient = x.TypeOfCoefficient
}).FirstOrDefaultAsync(x => x.Id == id);
}
/// <summary>
/// متد محاسبه پایه سنوات برا افراد تک گروه
/// </summary>
/// <param name="schemeStart">تاریخ شروع طرح</param>
/// <param name="schemeEnd">تاریخ پاین طرح، اجباری نیست</param>
/// <param name="contractStart">تاریخ شروع قراداد</param>
/// <param name="contractEnd">تاریخ پایان قراداد</param>
/// <param name="groupNo">شماره گروه</param>
/// <param name="employeeId">آی دی پرسنل</param>
/// <param name="workshopId">آی دی کارگاه</param>
/// <returns></returns>
public async Task<BaseYearDataViewModel> BaseYearComputeOneGroup(DateTime schemeStart, DateTime? schemeEnd,
DateTime contractStart, DateTime contractEnd, string groupNo, long employeeId, long workshopId)
{
//خروجی متد
var baseYearResult = new BaseYearDataViewModel();
baseYearResult.WorkshopId = workshopId;
baseYearResult.EmployeeId = employeeId;
//لیست شروع بکار / ترک کار پرسنل
var leftWorkList = await _context.LeftWorkList
.Where(x => x.EmployeeId == employeeId && x.WorkshopId == workshopId).Select(x=> new LeftWorkViewModel
{
Id = x.id,
StartWorkDateGr = x.StartWorkDate,
StartWorkDate = x.StartWorkDate.ToFarsi(),
LeftWorkDateGr = x.LeftWorkDate,
HasLeft = x.HasLeft,
}).OrderBy(x=>x.StartWorkDateGr).ToListAsync();
//اولین شروع بکار
var firstStartWorkDate = leftWorkList.First().StartWorkDateGr;
var firstStartWork = leftWorkList.First().StartWorkDate;
//اگر شروع طرح بعد از اولین شروع بکار بود
if (schemeStart > firstStartWorkDate)
{
var leftWorkStart = leftWorkList.FirstOrDefault(x => x.StartWorkDateGr <= schemeStart && x.LeftWorkDateGr > schemeStart);
if (leftWorkStart != null)
{
//اگر تاریخ شروع طرح بین بازه اولین شروع بکار و ترک کار قرار گرفت
if (leftWorkStart.StartWorkDateGr == firstStartWorkDate)
{
var changedLeftwork = new LeftWorkViewModel()
{
Id = leftWorkStart.Id,
StartWorkDateGr = schemeStart,
StartWorkDate = schemeStart.ToFarsi(),
LeftWorkDateGr = leftWorkStart.LeftWorkDateGr,
HasLeft = leftWorkStart.HasLeft,
};
leftWorkList.Remove(leftWorkStart);
leftWorkList.Add(changedLeftwork);
firstStartWork = schemeStart.ToFarsi();
}
else //اگر تاریخ شروع طرح در بازه شروع به ترک کارهایی بعد از اولین قرارگرفت
{
//لیست شروع بکار/ ترک کارهایی که باید حذف شوند
var leftWorksToBeRemove = leftWorkList.Where(x => x.StartWorkDateGr < leftWorkStart.StartWorkDateGr)
.ToList();
foreach (var item in leftWorksToBeRemove.ToList())
{
leftWorkList.Remove(item);
}
var changedLeftwork = new LeftWorkViewModel()
{
Id = leftWorkStart.Id,
StartWorkDateGr = schemeStart,
StartWorkDate = schemeStart.ToFarsi(),
LeftWorkDateGr = leftWorkStart.LeftWorkDateGr,
HasLeft = leftWorkStart.HasLeft,
};
firstStartWork = schemeStart.ToFarsi();
leftWorkList.Remove(leftWorkStart);
leftWorkList.Add(changedLeftwork);
}
}
else //اگر شروع طرح در فاصله بین شروع بکار/ترک کارها بود
{
//لیست شروع بکار/ ترک کارهایی که باید حذف شوند
var leftWorksToBeRemove = leftWorkList.Where(x => x.StartWorkDateGr < schemeStart)
.ToList();
foreach (var item in leftWorksToBeRemove.ToList())
{
leftWorkList.Remove(item);
}
leftWorkList = leftWorkList.OrderBy(x => x.StartWorkDateGr).ToList();
firstStartWork = leftWorkList.First().StartWorkDate;
}
}
//مرتب سازی
leftWorkList = leftWorkList.OrderBy(x => x.StartWorkDateGr).ToList();
//مقادیر سالانه
var salary = await _context.YearlySalaries.OrderByDescending(x => x.EndDate).Include(x => x.YearlySalaryItemsList).ToListAsync();
//مزد سنوات طبقه بندی
var classifiedBaseYearList =await _context.ClassifiedSalaries.ToListAsync();
//آیا در حلقه کبیشه بودن چک شود
bool checkKabiseh = true;
var isKabiseh = false;
var EndOfYaerDate = new DateTime();
//لیست تاریخ هایی که پایه سنوات تعلق گرفته
var baseYearDateList = new List<DateTime>();
double baseYear = 0;
//اگر تاریخ پایان طرح خالی نبود
if (schemeEnd.HasValue)
{
//اگر تاریخ پایان طرخ از تاریخ پایان قرارداد کوچکتر بود
//در نتیجه تاریخ پاینه محاسبات همان پایان طرح است
if (schemeEnd.Value < contractEnd)
contractEnd = schemeEnd.Value;
}
//اگر فقط یک شروع بکار داشت
if (leftWorkList.Count < 2)
{
var leftWork = leftWorkList.First();
//اگر ترک کار کرده بود پایان چرخه تاریخ آخرین روز کاری اوست
var endComputeDate = leftWork.HasLeft && leftWork.LeftWorkDateGr <= contractEnd ? leftWork.LeftWorkDateGr.AddDays(-1) : contractEnd;
//شروع چرخه شروع بکار پرسنل
var startComputeDate = leftWork.StartWorkDateGr;
for (var current = startComputeDate; current <= endComputeDate; current = current.AddDays(1))
{
var currentChanges = new DateTime(current.Year, current.Month, current.Day);
if (checkKabiseh)
{
isKabiseh = ($"{current.ToFarsi()}").YearTotalDays() == 367 ? true : false;
string kabise = "";
if (isKabiseh)
kabise = "kabise";
var currentChangesPc = currentChanges.ToPersianDateTime();
EndOfYaerDate = isKabiseh ? ($"{currentChangesPc.AddDays(365)}").ToGeorgianDateTime() : ($"{currentChangesPc.AddDays(364)}").ToGeorgianDateTime();
Console.WriteLine($" start : {current.ToFarsi()} {kabise}");
}
checkKabiseh = false;
if (current == EndOfYaerDate)
{
var a = current.AddDays(1);
if (a <= endComputeDate)
{
checkKabiseh = true;
baseYearDateList.Add(a);
Console.WriteLine($" End : {a.ToFarsi()}");
}
}
}
}
else //اگر بیش از یک شروع بکار داشت
{
int max365 = 0;
int dayCounter = 0;
bool hasCute = false;
foreach (var leftWork in leftWorkList)
{
//اگر ترک کار کرده بود پایان چرخه تاریخ آخرین روز کاری اوست
var endComputeDate = leftWork.HasLeft && leftWork.LeftWorkDateGr <= contractEnd ? leftWork.LeftWorkDateGr.AddDays(-1) : contractEnd;
//شروع چرخه شروع بکار پرسنل
var startComputeDate = leftWork.StartWorkDateGr;
for (var current = startComputeDate; current <= endComputeDate; current = current.AddDays(1))
{
if (checkKabiseh && dayCounter == 0)
{
isKabiseh = ($"{current.ToFarsi()}").YearTotalDays() == 367 ? true : false;
string kabise = "";
if (isKabiseh)
kabise = "kabise";
max365 = isKabiseh ? 366 : 365;
Console.WriteLine($" start : {current.ToFarsi()} {kabise}");
}
dayCounter += 1;
checkKabiseh = false;
if (dayCounter == max365)
{
var a = !hasCute ? current.AddDays(1) : current;
if (a <= endComputeDate)
{
checkKabiseh = true;
baseYearDateList.Add(a);
Console.WriteLine($" End : {a.ToFarsi()}");
Console.WriteLine(dayCounter);
if (hasCute)
{
dayCounter = 1;
isKabiseh = ($"{current.ToFarsi()}").YearTotalDays() == 367 ? true : false;
max365 = isKabiseh ? 366 : 365;
string kabise = "";
if (isKabiseh)
kabise = "kabise";
Console.WriteLine($" start : {current.ToFarsi()} {kabise}");
}
else
{
dayCounter = 0;
}
hasCute = false;
}
else
{
hasCute = true;
max365 += 1;
}
}
}
}
}
double selectBase = 0;
var baseList = new List<(double baseYaer, DateTime start, DateTime end, string baseYearPay, DateTime baseYearPayGr, string year, bool hasStartWork, bool hasLeftWork)>();
if (baseYearDateList.Count > 0)
{
var firstBaseYearDate = baseYearDateList.First();
var res = MonthByMonthList(firstBaseYearDate, contractEnd);
var firstbasicSalari =
salary.FirstOrDefault(x => x.StartDate <= firstBaseYearDate && x.EndDate >= firstBaseYearDate);
var firstClassifiedBaseYear = classifiedBaseYearList.FirstOrDefault(x => x.StartDate <= firstBaseYearDate && x.EndDate >= firstBaseYearDate);
//پایه سنوات سال جاری
var firstBasicObject = Tools.GetDynamicDouble(firstClassifiedBaseYear, $"Group{groupNo}");
double firstBasic = firstBasicObject != null ? firstBasicObject.Value : 0;
var firstfixFeePercentage = firstbasicSalari
.YearlySalaryItemsList.Where(x => x.ItemName == "درصد مزد ثابت").Select(x => x.ItemValue).FirstOrDefault();
// پایه سنوات سال قبل ضربدر درصد مزد ثابت تقسیم بر صد
//var beforePercntBaseYear = ((beforBaseStart * firstfixFeePercentage) / 100) + beforBaseStart;
//firstBasic += beforePercntBaseYear;
baseYear = firstBasic;
res = res.Where(x => x.start != firstBaseYearDate).OrderBy(x => x.start).ToList();
//var afterSalary = salary.Where(x => x.StartDate > firstbasicSalari.EndDate).ToList();
var first = (firstBasic, firstbasicSalari.StartDate, firstbasicSalari.EndDate, firstBaseYearDate.ToFarsi(), firstBaseYearDate, firstbasicSalari.Year, false, false);
baseList.Add(first);
Console.ForegroundColor = ConsoleColor.Green;
Console.WriteLine($"{1398} -> firstBasic : {firstBasic}");
var lastItem = res.Count > 1 ? res.Last() : res.FirstOrDefault();
foreach (var item in res)
{
var lastReecord = baseList.Last();
var year = Convert.ToInt32(item.start.ToFarsi().Substring(0, 4));
if (item.start > lastReecord.end && lastReecord.year != $"{year}")
{
var selectedSalary = salary.Where(x => x.Year == $"{year}").OrderBy(x => x.StartDate).ToList();
var currentSalary = selectedSalary.First();
if (selectedSalary.Count > 1)
{
currentSalary = selectedSalary.Last();
var firstSalery = selectedSalary.First();
if (baseYearDateList.Any(x => x >= firstSalery.StartDate && x <= firstSalery.EndDate) || lastItem.end < currentSalary.StartDate)
{
currentSalary = firstSalery;
}
}
var selectedBaseYear = classifiedBaseYearList.Where(x => x.Year == year).OrderBy(x => x.StartDate).ToList();
var currentBaseYear = selectedBaseYear.First();
if (selectedBaseYear.Count > 1)
{
currentBaseYear = selectedBaseYear.Last();
var firstBaseYear = selectedBaseYear.First();
if (baseYearDateList.Any(x => x >= firstBaseYear.StartDate && x <= firstBaseYear.EndDate) || lastItem.end < currentBaseYear.StartDate)
{
currentBaseYear = firstBaseYear;
}
}
//درصد مزد ثابت تاریخ جاری
var fixFeePercentage = currentSalary
.YearlySalaryItemsList.Where(x => x.ItemName == "درصد مزد ثابت").Select(x => x.ItemValue).FirstOrDefault();
// پایه سنوات سال قبل ضربدر درصد مزد ثابت تقسیم بر صد
var percntBaseYear = ((lastReecord.baseYaer * fixFeePercentage) / 100) + lastReecord.baseYaer;
Console.ForegroundColor = ConsoleColor.Green;
var currentBasicObject = Tools.GetDynamicDouble(currentBaseYear, $"Group{groupNo}");
double currentBasic = currentBasicObject != null ? currentBasicObject.Value : 0;
//var currentBasic = currentSalary
// .YearlySalaryItemsList.Where(x => x.ItemName == "پایه سنوات").Select(x => x.ItemValue).FirstOrDefault();
Console.WriteLine($"{year} -> [{lastReecord.baseYaer} * {fixFeePercentage} /100 + {lastReecord.baseYaer}] = {percntBaseYear} => [{currentBasic} + {percntBaseYear}] = {currentBasic + percntBaseYear} ");
if (!baseYearDateList.Any(x => x >= currentBaseYear.StartDate && x <= currentBaseYear.EndDate))
currentBasic = 0;
var currentBase = currentBasic + percntBaseYear;
baseYear = currentBase;
var baseYearPay = "-";
var baseYearPayDayGr = new DateTime();
if (baseYearDateList.Any(x => x >= currentBaseYear.StartDate && x <= currentBaseYear.EndDate))
{
var existBaseYear = baseYearDateList.FirstOrDefault(x => x >= currentBaseYear.StartDate && x <= currentBaseYear.EndDate);
baseYearPay = existBaseYear.ToFarsi();
baseYearPayDayGr = new DateTime(existBaseYear.Year, existBaseYear.Month, existBaseYear.Day, 17, 01, 01);
}
else
{
baseYearPayDayGr = new DateTime(item.start.Year, item.start.Month, item.start.Day, 17, 01, 01);
}
Console.ForegroundColor = ConsoleColor.DarkYellow;
Console.WriteLine(baseYearPay);
Console.ResetColor();
// var round = GetCurrectFirstDailyFee(currentBase, $"{year}");
var record = (baseYear, currentSalary.StartDate, currentSalary.EndDate, baseYearPay, baseYearPayDayGr, currentSalary.Year, false, false);
baseList.Add(record);
}
}
Console.ResetColor();
}
selectBase = baseList.Any() ? baseList.Last().baseYaer : 0;
//افزودن تاریخ های شروع بکار و ترک کار به لیست
foreach (var left in leftWorkList)
{
var startWork = (0, new DateTime(), new DateTime(), left.StartWorkDateGr.ToFarsi(), left.StartWorkDateGr, "-", true, false);
baseList.Add(startWork);
if (left.HasLeft)
{
var leftWork = (0, new DateTime(), new DateTime(), left.LeftWorkDateGr.ToFarsi(), left.LeftWorkDateGr, "-", false, true);
baseList.Add(leftWork);
}
}
baseYearResult = new BaseYearDataViewModel()
{
WorkshopId = workshopId,
EmployeeId = employeeId,
BaseYearResult = selectBase,
FirstWorkDayInLeftWork = firstStartWork,
BaseYearDataList = baseList.Select(x => new BaseYearDataList()
{
BaseYear = x.baseYaer,
StartDateGr = x.start,
EndDateGr = x.end,
BaseYearPayDay = x.baseYearPay,
BaseYearPayDayGr = x.baseYearPayGr,
StartDateFa = x.start.ToFarsi(),
EndDateFa = x.end.ToFarsi(),
Year = x.year,
HasLeftWork = x.hasLeftWork,
HasStartWork = x.hasStartWork,
}).OrderBy(x => x.BaseYearPayDayGr).ToList(),
};
Console.WriteLine("BaseYear : " + selectBase);
return baseYearResult;
}
/// <summary>
/// متد کمکی پایه سنوات
/// </summary>
/// <param name="startDate"></param>
/// <param name="endDate"></param>
/// <returns></returns>
private List<(DateTime start, DateTime end)> MonthByMonthList(DateTime startDate, DateTime endDate)
{
var start = startDate.ToFarsi();
var end = endDate.ToFarsi();
var ContractPreiodsList = new List<(DateTime start, DateTime end)>();
var syear = Convert.ToInt32(start.Substring(0, 4));
var smonth = Convert.ToInt32(start.Substring(5, 2));
var sday = Convert.ToInt32(start.Substring(8, 2));
var eyear = Convert.ToInt32(end.Substring(0, 4));
var emonth = Convert.ToInt32(end.Substring(5, 2));
var eday = Convert.ToInt32(end.Substring(8, 2));
var PersianStartDate = new PersianDateTime(syear, smonth, sday);
var PersianStartDateAddingMount = new PersianDateTime(syear, smonth, 1);
var PersianEndDate = new PersianDateTime(eyear, emonth, eday);
var totalmonth = ((PersianEndDate.Year - PersianStartDateAddingMount.Year) * 12) + (PersianEndDate.Month - PersianStartDateAddingMount.Month) + 1;
for (int i = 0; i < totalmonth; i++)
{
var currentEndDate = PersianStartDateAddingMount.AddMonths(1).AddDays(-1);
if (currentEndDate > PersianEndDate)
{
currentEndDate = PersianEndDate;
}
DateTime startPeriod = ($"{PersianStartDate}").ToGeorgianDateTime();
DateTime endPeriod = ($"{currentEndDate}").ToGeorgianDateTime();
var record = (startPeriod, endPeriod);
ContractPreiodsList.Add(record);
//Console.WriteLine($"Month {i + 1} : {PersianStartDate.ToString("yyyy-MM-dd")} to {currentEndDate.ToString("yyyy-MM-dd")}");
PersianStartDate = PersianStartDate.AddMonths(1);
PersianStartDate = new PersianDateTime(PersianStartDate.Year, PersianStartDate.Month, 1);
}
return ContractPreiodsList;
}
}

View File

@@ -1,7 +1,9 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Threading.Tasks;
using _0_Framework.Application;
using _0_Framework.InfraStructure;
using Company.Domain.ContractAgg;
@@ -13,6 +15,7 @@ using CompanyManagment.App.Contracts.Employee;
using CompanyManagment.App.Contracts.Employer;
using CompanyManagment.App.Contracts.LeftWork;
using CompanyManagment.App.Contracts.Workshop;
using Microsoft.EntityFrameworkCore;
using PersianTools.Core;
using DateTime = System.DateTime;
@@ -40,6 +43,56 @@ public class ContractRepository : RepositoryBase<long, Contract>, IContractRepos
_leftWorkRepository = leftWorkRepository;
}
public async Task<double> GetManualDailWage(long workshopId, long employeeId, long yearlySalaryId, DateTime contractStart)
{
var lastContract = await _context.Contracts
.Where(x => x.WorkshopIds == workshopId && x.EmployeeId == employeeId && x.IsActiveString == "true" && x.ContarctStart < contractStart)
.OrderByDescending(x => x.ContarctStart)
.FirstOrDefaultAsync();
//اگر قردادی قبل از قرارداد جدید نداشت
if (lastContract == null)
return 0;
//اگر آخرین قرداد مزد دلخواه نداشت
if (!lastContract.HasManualDailyWage)
return 0;
var lastContractYearlySalary = await _context.YearlySalaries
.FirstOrDefaultAsync(x => x.StartDate <= lastContract.ContarctStart && x.EndDate >= lastContract.ContarctStart);
//اگر دستمزد آخرین قراداد و قرداد جدید از یک مقادیر سالانه بودن بدون ارتقاء دستمزد دلخواه آخرین قرداد ارسال میشه
if (lastContractYearlySalary.id == yearlySalaryId)
return lastContract.DailySalaryUnAffected;
var dailyWageResult = _yearlySalaryRepository.UpgradeManualDailyWage(contractStart,
lastContractYearlySalary.StartDate, lastContract.DailySalaryUnAffected).GetAwaiter().GetResult();
return dailyWageResult.DailyWage;
}
public async Task<UpgradeManualDailyWageModel> GetManualDailWageList(long workshopId, long employeeId,
DateTime contractStart)
{
var oldContracts = await _context.Contracts
.Where(x => x.WorkshopIds == workshopId && x.EmployeeId == employeeId && x.IsActiveString == "true" && x.DailyWageType == "ManualDailyWage" && x.ContarctStart < contractStart)
.OrderByDescending(x => x.ContarctStart)
.FirstOrDefaultAsync();
if (oldContracts == null)
return new UpgradeManualDailyWageModel();
//var endOfMonthFromStart = ($"{contractStart.ToFarsi().FindeEndOfMonth()}").ToGeorgianDateTime();
var result =await _yearlySalaryRepository.UpgradeManualDailyWage(contractStart, oldContracts.ContarctStart,
oldContracts.DailySalaryUnAffected);
return result;
}
public EditContract GetDetails(long id)
{
return _context.Contracts.Select(x => new EditContract
@@ -70,8 +123,12 @@ public class ContractRepository : RepositoryBase<long, Contract>, IContractRepos
ContractPeriod = x.ContractPeriod,
AgreementSalary = x.AgreementSalary,
ArchiveCode = x.ArchiveCode,
BaseYearAffected = x.BaseYearAffected,
BaseYearUnAffected = x.BaseYearUnAffected,
DailySalaryAffected = x.DailySalaryAffected,
DailySalaryUnAffected = x.DailySalaryUnAffected,
HasManualDailyWage = x.HasManualDailyWage,
DailyWageType = x.DailyWageType,

View File

@@ -342,43 +342,7 @@ public class InsuranceListRepository : RepositoryBase<long, InsuranceList>, IIns
var acountId = _authHelper.CurrentAccountId();
var workshopIds = _context.WorkshopAccounts.Where(x => x.AccountId == acountId).Select(x => x.WorkshopId);
#region sample
//var query = _context.InsuranceListSet
// .Where(x => workshopIds.Contains(x.WorkshopId))
// .Join(_context.Workshops.Include(x => x.InsuranceWorkshopInfo),
// insurance => insurance.WorkshopId,
// workshop => workshop.id,
// (insurance, workshop) => new { insurance, workshop })
// .Join(_context.WorkshopEmployers,
// result => result.workshop.id,
// employer => employer.WorkshopId,
// (result, employer) => new InsuranceListViewModel
// {
// Id = result.insurance.id,
// Year = result.insurance.Year,
// MonthNumber = result.insurance.Month,
// Month = result.insurance.Month.GetMonthByNumber(),
// WorkShopId = result.insurance.WorkshopId,
// WorkShopCode = result.workshop.InsuranceWorkshopInfo != null ? result.workshop.InsuranceWorkshopInfo.InsuranceCode : result.workshop.InsuranceCode,
// WorkShopName = result.workshop.InsuranceWorkshopInfo != null ? result.workshop.InsuranceWorkshopInfo.WorkshopName : result.workshop.WorkshopFullName,
// TypeOfInsuranceSend = result.workshop.TypeOfInsuranceSend == "NormalList" ? "عادی" :
// result.workshop.TypeOfInsuranceSend == "Govermentlist" ? "کمک دولت" :
// result.workshop.TypeOfInsuranceSend == "Familylist" ? "خانوادگی" : "",
// FixedSalary = result.workshop.FixedSalary,
// StrFixedSalary = result.workshop.FixedSalary ? "دارد" : "ندارد",
// EmployerName = result.workshop.InsuranceWorkshopInfo != null ? result.workshop.InsuranceWorkshopInfo.EmployerName : result.workshop.WorkshopFullName,
// Branch = "",
// City = "",
// ConfirmSentlist = result.insurance.ConfirmSentlist,
// IsBlockCantracingParty = "",
// EmployerId = employer.EmployerId,
// });
#endregion
var query = _context.InsuranceListSet
.Where(x => workshopIds.Contains(x.WorkshopId))
@@ -1345,8 +1309,12 @@ public class InsuranceListRepository : RepositoryBase<long, InsuranceList>, IIns
public List<EmployeeDetailsForInsuranceListViewModel> GetEmployeeInsuranceDataForEdit(long insuranceListId, DateTime startDate, DateTime endDate)
{
var res = _context.EmployeeInsurancListDataSet
var employeeDataQuery = _context.EmployeeInsurancListDataSet
.Where(x => x.InsuranceListId == insuranceListId)
.Join(_context.InsuranceListSet,
employeeInsurancListData => employeeInsurancListData.InsuranceListId,
insuranceList => insuranceList.id,
(employeeInsurancListData, insuranceList) => new{employeeInsurancListData,insuranceList})
.Join(_context.LeftWorkInsuranceList
.Where(x =>
((x.LeftWorkDate != null && x.LeftWorkDate != DateTime.MinValue) &&
@@ -1357,14 +1325,18 @@ public class InsuranceListRepository : RepositoryBase<long, InsuranceList>, IIns
(x.LeftWorkDate == null || x.LeftWorkDate == DateTime.MinValue))
.Where(x => x.StartWorkDate <= endDate)
.Include(x => x.Employee),
employeeData => employeeData.EmployeeId,
leftwork => leftwork.EmployeeId,
(employeeData, leftwork) => new { employeeData, leftwork })
.Join(_context.Jobs,
employeeData =>new { employeeData.employeeInsurancListData.EmployeeId,employeeData.insuranceList.WorkshopId},
leftwork => new {leftwork.EmployeeId,leftwork.WorkshopId},
(employeeData, leftwork)
=> new { employeeData = employeeData.employeeInsurancListData, leftwork });
var employeeJobs =employeeDataQuery.Join(_context.Jobs,
result => result.leftwork.JobId,
job => job.id,
(result, job) => new { result, job })
.GroupJoin(_context.InsuranceEmployeeInformationSet.AsSplitQuery(),
(result, job) => new { result, job });
var res =employeeJobs.GroupJoin(_context.InsuranceEmployeeInformationSet.AsSplitQuery(),
allResult => allResult.result.employeeData.EmployeeId,
employeeInfo => employeeInfo.EmployeeId,
(allResult, employeeInfo) => new
@@ -1501,6 +1473,7 @@ public class InsuranceListRepository : RepositoryBase<long, InsuranceList>, IIns
var workshopIds = _context.WorkshopAccounts
.Where(a => a.AccountId == acountId)
.Select(a => a.WorkshopId);
var query = _context.InsuranceListSet
.Where(x => workshopIds.Contains(x.WorkshopId))
.Join(_context.Workshops.Include(x => x.InsuranceWorkshopInfo),
@@ -1597,7 +1570,64 @@ public class InsuranceListRepository : RepositoryBase<long, InsuranceList>, IIns
}
/// <summary>
public async Task<List<InsuranceListViewModel>> GetNotCreatedWorkshop(InsuranceListSearchModel searchModel)
{
if (string.IsNullOrEmpty(searchModel.Month) || string.IsNullOrEmpty(searchModel.Year) )
{
return [];
}
var acountId = _authHelper.CurrentAccountId();
var accountWorkshopIds = _context.WorkshopAccounts.Where(x => x.AccountId == acountId)
.Select(x => x.WorkshopId);
var firstDayOfMonth = $"{searchModel.Year}/{searchModel.Month}/01".ToGeorgianDateTime();
var insuranceWorkshops = _context.Workshops
.Where(x=>x.InsuranceCode != null && x.InsuranceCode.Length >=10 && accountWorkshopIds.Contains(x.id) && x.IsActiveString== "true");
var existInsurances = _context.InsuranceListSet
.Where(x=>x.Month == searchModel.Month&& x.Year == searchModel.Year).AsQueryable();
var notCreatedWorkshop = insuranceWorkshops.Where(w=>!existInsurances.Select(x=>x.WorkshopId).Contains(w.id));
notCreatedWorkshop = notCreatedWorkshop
.Include(x => x.LeftWorkInsurances)
.Where(x => x.LeftWorkInsurances.Any(l=>l.StartWorkDate <= firstDayOfMonth &&
(l.LeftWorkDate == null || l.LeftWorkDate >= firstDayOfMonth)));
var res = await notCreatedWorkshop
.GroupJoin(_context.WorkshopEmployers,
workshop => workshop.id,
workshopEmployer => workshopEmployer.WorkshopId,
(workshop, workshopEmployer) => new { workshop, workshopEmployer })
.SelectMany(x => x.workshopEmployer.DefaultIfEmpty(), (x, workshopEmployer) => new { x.workshop, workshopEmployer })
.GroupJoin(_context.Employers,
allResult => allResult.workshopEmployer.EmployerId,
employer => employer.id,
(allResult, employer) => new { allResult.workshop, allResult.workshopEmployer, employer })
.SelectMany(x => x.employer.DefaultIfEmpty(), (x, employer) => new { x.workshop, x.workshopEmployer, employer })
.Select(x => new InsuranceListViewModel
{
WorkShopId = x.workshop.id,
WorkShopCode = x.workshop.InsuranceCode,
WorkShopName = x.workshop.InsuranceWorkshopInfo != null ? x.workshop.InsuranceWorkshopInfo.WorkshopName : x.workshop.WorkshopFullName,
EmployerName = x.employer != null ? x.employer.FullName : (x.workshop.InsuranceWorkshopInfo != null ? x.workshop.InsuranceWorkshopInfo.EmployerName : x.workshop.WorkshopFullName),
Year = searchModel.Year,
Month = searchModel.Month,
TypeOfInsuranceSend = x.workshop.TypeOfInsuranceSend == "NormalList" ? "عادی" :
x.workshop.TypeOfInsuranceSend == "Govermentlist" ? "کمک دولت" :
x.workshop.TypeOfInsuranceSend == "Familylist" ? "خانوادگی" : "",
FixedSalary = (bool)x.workshop.FixedSalary,
StrFixedSalary = (bool)x.workshop.FixedSalary ? "دارد" : "ندارد",
EmployerId = x.workshopEmployer != null ? x.workshopEmployer.EmployerId : 0,
ArchiveCode = x.workshop.ArchiveCode,
City = x.workshop.City,
}).Skip(searchModel.PageIndex).Take(30).ToListAsync();
return res;
}
/// <summary>
///
/// </summary>
/// <param name="year"></param>

View File

@@ -1,5 +1,6 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using _0_Framework.InfraStructure;
using Company.Domain.JobAgg;
using CompanyManagment.App.Contracts.Job;
@@ -83,6 +84,32 @@ public class JobRepository: RepositoryBase<long, Job>, IJobRepository
}
public async Task<List<JobViewModel>> JobSearchSelect(string searchtText)
{
if (!string.IsNullOrWhiteSpace(searchtText))
{
var query =_context.Jobs.Select(x => new JobViewModel
{
Id = x.id,
JobName = x.JobName,
JobCode = x.JobCode
});
query = query.Where(x => x.JobName.Contains(searchtText));
var jobViewModelList =await query.Take(100).Select(x => new JobViewModel
{
Id = x.Id,
JobName = x.JobName,
JobCode = x.JobCode
}).ToListAsync();
return jobViewModelList;
}
else
{
return new List<JobViewModel>();
}
}
// public async Task<List<JobViewModel>> GetJobListByText(string searchtText)
public List<JobViewModel> GetJobListByText(string searchtText)
{

View File

@@ -6,12 +6,14 @@ using _0_Framework.InfraStructure;
using Company.Domain.LeaveAgg;
using CompanyManagment.App.Contracts.Checkout;
using CompanyManagment.App.Contracts.Leave;
using Microsoft.EntityFrameworkCore;
namespace CompanyManagment.EFCore.Repository;
public class LeaveRepository : RepositoryBase<long, Leave>, ILeaveRepository
{
private readonly CompanyContext _context;
public LeaveRepository(CompanyContext context) : base(context)
{
_context = context;
@@ -20,24 +22,24 @@ public class LeaveRepository : RepositoryBase<long, Leave>, ILeaveRepository
public EditLeave GetDetails(long id)
{
return _context.LeaveList.Select(x => new EditLeave()
{
Id = x.id,
StartLeave = x.StartLeave.ToFarsi(),
EndLeave = x.EndLeave.ToFarsi(),
StartLeaveGr = x.StartLeave,
EndLeaveGr = x.EndLeave,
WorkshopId = x.WorkshopId,
EmployeeId = x.EmployeeId,
LeaveHourses = x.LeaveHourses,
PaidLeaveType = x.PaidLeaveType,
LeaveType = x.LeaveType,
EmployeeFullName = x.EmployeeFullName,
WorkshopName = x.WorkshopName,
IsAccepted = x.IsAccepted,
Decription = x.Decription,
Year = x.Year,
Month = x.Month,
HasRollCall = x.HasShiftDuration,
{
Id = x.id,
StartLeave = x.StartLeave.ToFarsi(),
EndLeave = x.EndLeave.ToFarsi(),
StartLeaveGr = x.StartLeave,
EndLeaveGr = x.EndLeave,
WorkshopId = x.WorkshopId,
EmployeeId = x.EmployeeId,
LeaveHourses = x.LeaveHourses,
PaidLeaveType = x.PaidLeaveType,
LeaveType = x.LeaveType,
EmployeeFullName = x.EmployeeFullName,
WorkshopName = x.WorkshopName,
IsAccepted = x.IsAccepted,
Decription = x.Decription,
Year = x.Year,
Month = x.Month,
HasRollCall = x.HasShiftDuration,
}).FirstOrDefault(x => x.Id == id);
}
@@ -63,16 +65,20 @@ public class LeaveRepository : RepositoryBase<long, Leave>, ILeaveRepository
Month = x.Month,
HasShiftDuration = x.HasShiftDuration,
ShiftDuration = x.ShiftDuration,
IsInvalid = x.IsInvalid
});
if (searchModel.WorkshopId != 0 && searchModel.EmployeeId != 0)
if (searchModel.IsInvalid)
{
query = query.IgnoreQueryFilters().Where(x => x.IsInvalid);
}
if (searchModel.WorkshopId != 0 && searchModel.EmployeeId != 0)
query = query.Where(x => x.WorkshopId == searchModel.WorkshopId && x.EmployeeId == searchModel.EmployeeId);
if (!string.IsNullOrWhiteSpace(searchModel.LeaveType))
query = query.Where(x => x.LeaveType == searchModel.LeaveType);
query = query.Where(x => x.LeaveType == searchModel.LeaveType);
if (!string.IsNullOrWhiteSpace(searchModel.PaidLeaveType))
query = query.Where(x => x.PaidLeaveType == searchModel.PaidLeaveType);
query = query.Where(x => x.PaidLeaveType == searchModel.PaidLeaveType);
if (!string.IsNullOrWhiteSpace(searchModel.StartLeave) && !string.IsNullOrWhiteSpace(searchModel.EndLeave))
{
DateTime startSearch = searchModel.StartLeave.ToGeorgianDateTime();
@@ -81,21 +87,29 @@ public class LeaveRepository : RepositoryBase<long, Leave>, ILeaveRepository
(startSearch <= x.EndLeaveGr.Date && endSearch >= x.EndLeaveGr.Date) ||
(startSearch >= x.StartLeaveGr.Date && startSearch <= x.EndLeaveGr.Date) ||
(endSearch >= x.StartLeaveGr.Date && endSearch <= x.EndLeaveGr.Date));
}else if (searchModel.StartLeaveGr != null && searchModel.EndLeaveGr != null)
}
else if (searchModel.StartLeaveGr != null && searchModel.EndLeaveGr != null)
{
query = query.Where(x => (searchModel.StartLeaveGr <= x.StartLeaveGr.Date && searchModel.EndLeaveGr >= x.StartLeaveGr.Date) ||
(searchModel.StartLeaveGr <= x.EndLeaveGr.Date && searchModel.EndLeaveGr >= x.EndLeaveGr.Date) ||
(searchModel.StartLeaveGr >= x.StartLeaveGr.Date && searchModel.StartLeaveGr <= x.EndLeaveGr.Date) ||
(searchModel.EndLeaveGr >= x.StartLeaveGr.Date && searchModel.EndLeaveGr <= x.EndLeaveGr.Date));
}
if(searchModel.IsAccepted)
query = query.Where(x => x.IsAccepted == true);
return query.OrderByDescending(x => x.Id).ToList();
query = query.Where(x =>
(searchModel.StartLeaveGr <= x.StartLeaveGr.Date && searchModel.EndLeaveGr >= x.StartLeaveGr.Date) ||
(searchModel.StartLeaveGr <= x.EndLeaveGr.Date && searchModel.EndLeaveGr >= x.EndLeaveGr.Date) ||
(searchModel.StartLeaveGr >= x.StartLeaveGr.Date && searchModel.StartLeaveGr <= x.EndLeaveGr.Date) ||
(searchModel.EndLeaveGr >= x.StartLeaveGr.Date && searchModel.EndLeaveGr <= x.EndLeaveGr.Date));
}
if (searchModel.IsAccepted)
query = query.Where(x => x.IsAccepted == true);
return query.OrderByDescending(x => x.Id).ToList();
}
public List<LeaveMainViewModel> searchClient(LeaveSearchModel searchModel)
{
var leaveMainList = _context.LeaveList.Where(x => x.WorkshopId == searchModel.WorkshopId && x.EmployeeId == searchModel.EmployeeId);
var leaveMainList = _context.LeaveList.Where(x =>
x.WorkshopId == searchModel.WorkshopId && x.EmployeeId == searchModel.EmployeeId);
if (searchModel.IsInvalid)
{
leaveMainList = leaveMainList.IgnoreQueryFilters().Where(x => x.IsInvalid);
}
if (searchModel.LeaveType == "paidLeave")
leaveMainList = leaveMainList.Where(x => x.LeaveType == "استحقاقی");
@@ -135,7 +149,7 @@ public class LeaveRepository : RepositoryBase<long, Leave>, ILeaveRepository
EndLeaveGr = item.EndLeave,
WorkshopId = item.WorkshopId,
EmployeeId = item.EmployeeId,
LeaveHourses = Tools.CalculateLeaveHoursAndDays(item.PaidLeaveType,item.LeaveHourses),
LeaveHourses = Tools.CalculateLeaveHoursAndDays(item.PaidLeaveType, item.LeaveHourses),
PaidLeaveType = item.PaidLeaveType,
LeaveType = item.LeaveType,
IsAccepted = item.IsAccepted,
@@ -150,7 +164,7 @@ public class LeaveRepository : RepositoryBase<long, Leave>, ILeaveRepository
public LeavePrintViewModel PrintOne(long id)
{
var leave = _context.LeaveList.Select(x => new LeavePrintViewModel()
var leave = _context.LeaveList.IgnoreQueryFilters().Select(x => new LeavePrintViewModel()
{
Id = x.id,
ContractNo = "",
@@ -169,17 +183,21 @@ public class LeaveRepository : RepositoryBase<long, Leave>, ILeaveRepository
IsAccepted = x.IsAccepted,
Decription = x.Decription,
EmployerList = new List<EmprViewModel>(),
IsInvalid = x.IsInvalid
}).SingleOrDefault(x => x.Id == id);
//leave.ContractNo = _context.Contracts.FirstOrDefault(x => x.ContarctStart <= leave.StartLeaveGr && x.ContractEnd > leave.StartLeaveGr
// && x.ContarctStart < leave.EndLeaveGr && x.ContractEnd > leave.EndLeaveGr
// && x.WorkshopIds == leave.WorkshopId && x.EmployeeId == leave.EmployeeId).ContractNo;
leave.ContractNo = _context.Contracts.FirstOrDefault(x=>x.ContarctStart <= leave.StartLeaveGr && x.ContractEnd >= leave.StartLeaveGr && x.EmployeeId == leave.EmployeeId && x.WorkshopIds == leave.WorkshopId)?.ContractNo;
leave.ContractNo = _context.Contracts.FirstOrDefault(x =>
x.ContarctStart <= leave.StartLeaveGr && x.ContractEnd >= leave.StartLeaveGr &&
x.EmployeeId == leave.EmployeeId && x.WorkshopIds == leave.WorkshopId)?.ContractNo;
var Employee = _context.Employees.SingleOrDefault(x => x.id == leave.EmployeeId);
leave.NationalCode = Employee.NationalCode;
var emp = _context.WorkshopEmployers.Where(x => x.WorkshopId == leave.WorkshopId).Select(x => x.EmployerId).ToList();
var emp = _context.WorkshopEmployers.Where(x => x.WorkshopId == leave.WorkshopId).Select(x => x.EmployerId)
.ToList();
var employerlist = _context.Employers.Select(x => new EmprViewModel()
{
Id = x.id,
@@ -204,7 +222,7 @@ public class LeaveRepository : RepositoryBase<long, Leave>, ILeaveRepository
foreach (var item in id)
{
var leave = _context.LeaveList.Select(x => new LeavePrintViewModel
var leave = _context.LeaveList.IgnoreQueryFilters().Select(x => new LeavePrintViewModel
{
Id = x.id,
ContractNo = "",
@@ -225,21 +243,24 @@ public class LeaveRepository : RepositoryBase<long, Leave>, ILeaveRepository
Year = x.Year,
Month = x.Month,
MonthGr = Tools.ToFarsiMonthByIntNumber(x.Month),
EmployerList = new List<EmprViewModel>()
EmployerList = new List<EmprViewModel>(),
IsInvalid = x.IsInvalid
}).SingleOrDefault(x => x.Id == item);
//leave.ContractNo = _context.Contracts.FirstOrDefault(x => x.ContarctStart <= leave.StartLeaveGr && x.ContractEnd > leave.StartLeaveGr
// && x.ContarctStart < leave.EndLeaveGr && x.ContractEnd > leave.EndLeaveGr
// && x.WorkshopIds == leave.WorkshopId && x.EmployeeId == leave.EmployeeId).ContractNo;
leave.ContractNo = _context.Contracts.FirstOrDefault(x => x.ContarctStart <= leave.StartLeaveGr
&& x.ContractEnd >= leave.StartLeaveGr && x.EmployeeId == leave.EmployeeId
leave.ContractNo = _context.Contracts.FirstOrDefault(x => x.ContarctStart <= leave.StartLeaveGr
&& x.ContractEnd >= leave.StartLeaveGr &&
x.EmployeeId == leave.EmployeeId
&& x.WorkshopIds == leave.WorkshopId)?.ContractNo;
var Employee = _context.Employees.SingleOrDefault(x => x.id == leave.EmployeeId);
leave.NationalCode = Employee.NationalCode;
var emp = _context.WorkshopEmployers.Where(x => x.WorkshopId == leave.WorkshopId).Select(x => x.EmployerId).ToList();
var emp = _context.WorkshopEmployers.Where(x => x.WorkshopId == leave.WorkshopId).Select(x => x.EmployerId)
.ToList();
var employerlist = _context.Employers.Select(x => new EmprViewModel()
{
Id = x.id,
@@ -254,8 +275,10 @@ public class LeaveRepository : RepositoryBase<long, Leave>, ILeaveRepository
{
leave.EmployerList = new List<EmprViewModel>();
}
query.Add(leave);
}
query = query.OrderBy(x => x.Year).ThenBy(x => x.Month).ToList();
int printNumer = 0;
foreach (var rec in query)
@@ -263,6 +286,7 @@ public class LeaveRepository : RepositoryBase<long, Leave>, ILeaveRepository
printNumer += 1;
rec.PrintCounter = printNumer;
}
return query;
}
@@ -281,6 +305,11 @@ public class LeaveRepository : RepositoryBase<long, Leave>, ILeaveRepository
if (searchModel.LeaveType == "sickLeave")
leaveMainList = leaveMainList.Where(x => x.LeaveType == "استعلاجی");
if (searchModel.IsInvalid)
{
leaveMainList = leaveMainList.IgnoreQueryFilters().Where(x => x.IsInvalid);
}
if (!string.IsNullOrWhiteSpace(searchModel.StartLeave) && !string.IsNullOrWhiteSpace(searchModel.EndLeave))
{
var start = searchModel.StartLeave.ToGeorgianDateTime();
@@ -297,41 +326,43 @@ public class LeaveRepository : RepositoryBase<long, Leave>, ILeaveRepository
}
var leaveList = leaveMainList.Where(x => x.WorkshopId == searchModel.WorkshopId).Select(item => new LeaveViewModel()
{
Id = item.id,
StartLeave = item.StartLeave.ToFarsi(),
EndLeave = item.EndLeave.ToFarsi(),
StartLeaveGr = item.StartLeave,
EndLeaveGr = item.EndLeave,
WorkshopId = item.WorkshopId,
EmployeeId = item.EmployeeId,
EmployeeFullName = item.EmployeeFullName,
LeaveHourses = Tools.CalculateLeaveHoursAndDays(item.PaidLeaveType, item.LeaveHourses),
PaidLeaveType = item.PaidLeaveType,
LeaveType = item.LeaveType,
IsAccepted = item.IsAccepted,
Decription = item.Decription,
Year = item.Year,
Month = item.Month,
MonthStr = item.Month.ToFarsiMonthByIntNumber(),
CreationDate = item.CreationDate,
}).OrderByDescending(x => x.CreationDate).Skip(searchModel.PageIndex).Take(30).ToList();
var leaveList = leaveMainList.Where(x => x.WorkshopId == searchModel.WorkshopId).Select(item =>
new LeaveViewModel()
{
Id = item.id,
StartLeave = item.StartLeave.ToFarsi(),
EndLeave = item.EndLeave.ToFarsi(),
StartLeaveGr = item.StartLeave,
EndLeaveGr = item.EndLeave,
WorkshopId = item.WorkshopId,
EmployeeId = item.EmployeeId,
EmployeeFullName = item.EmployeeFullName,
LeaveHourses = Tools.CalculateLeaveHoursAndDays(item.PaidLeaveType, item.LeaveHourses),
PaidLeaveType = item.PaidLeaveType,
LeaveType = item.LeaveType,
IsAccepted = item.IsAccepted,
Decription = item.Decription,
Year = item.Year,
Month = item.Month,
MonthStr = item.Month.ToFarsiMonthByIntNumber(),
CreationDate = item.CreationDate,
IsInvalid = item.IsInvalid
}).OrderByDescending(x => x.CreationDate).Skip(searchModel.PageIndex).Take(30).ToList();
return leaveList;
}
#endregion
public bool CheckIfValidToEdit(long id)
{
var leave = _context.LeaveList.FirstOrDefault(x => x.id == id);
var checkoutExist = _context.CheckoutSet.Where(x => x.WorkshopId == leave.WorkshopId && x.EmployeeId == leave.EmployeeId)
var checkoutExist = _context.CheckoutSet
.Where(x => x.WorkshopId == leave.WorkshopId && x.EmployeeId == leave.EmployeeId)
.Where(x => leave.StartLeave <= x.ContractEnd).ToList();
if (checkoutExist.Count > 0)
{
return false;
}
else
@@ -346,37 +377,38 @@ public class LeaveRepository : RepositoryBase<long, Leave>, ILeaveRepository
var item = _context.LeaveList.FirstOrDefault(x => x.id == id);
if (item != null)
{
var checkoutExist = _context.CheckoutSet.Where(x => x.WorkshopId == item.WorkshopId && x.EmployeeId == item.EmployeeId)
var checkoutExist = _context.CheckoutSet
.Where(x => x.WorkshopId == item.WorkshopId && x.EmployeeId == item.EmployeeId)
.Where(x => item.StartLeave <= x.ContractEnd).ToList();
if (checkoutExist.Count > 0)
{
return op.Failed("در بازه زمانی این مرخصی و یا بعد از آن فیش حقوقی وجود دارد");
}
else
{
_context.LeaveList.Remove(item);
_context.SaveChanges();
return op.Succcedded();
}
}
return op.Failed("موردی یافت نشد");
}
#region Pooya
public bool HasDailyLeave(long employeeId, long workshopId, DateTime date)
{
return _context.LeaveList
.Where(x => (x.LeaveType == "استحقاقی" && x.PaidLeaveType == "روزانه") ||
x.LeaveType == "استعلاجی")
.FirstOrDefault(x => x.EmployeeId == employeeId && x.WorkshopId == workshopId &&
x.StartLeave.Date <= date.Date && x.EndLeave.Date >= date.Date) != null;
.Where(x => (x.LeaveType == "استحقاقی" && x.PaidLeaveType == "روزانه") ||
x.LeaveType == "استعلاجی")
.FirstOrDefault(x => x.EmployeeId == employeeId && x.WorkshopId == workshopId &&
x.StartLeave.Date <= date.Date && x.EndLeave.Date >= date.Date) != null;
}
public List<LeaveViewModel> GetByWorkshopIdEmployeeIdInDates(long workshopId, long employeeId, DateTime start, DateTime end)
public List<LeaveViewModel> GetByWorkshopIdEmployeeIdInDates(long workshopId, long employeeId, DateTime start,
DateTime end)
{
return _context.LeaveList.Where(x => x.EmployeeId == employeeId && x.EndLeave >= start && x.StartLeave <= end)
.Select(x => new LeaveViewModel
@@ -389,28 +421,32 @@ public class LeaveRepository : RepositoryBase<long, Leave>, ILeaveRepository
EndLeaveGr = x.EndLeave,
LeaveHourses = x.LeaveHourses
}).ToList();
}
}
#endregion
public bool CheckContractExist(DateTime myDate, long employeeId, long workshopId)
{
var result = _context.Contracts.Any(x => x.ContarctStart <= myDate
&& x.ContractEnd >= myDate && x.EmployeeId == employeeId &&
x.WorkshopIds == workshopId && x.IsActiveString=="true");
x.WorkshopIds == workshopId && x.IsActiveString == "true");
return result;
}
public LeavErrorViewModel CheckErrors(DateTime startLeav, DateTime endLeav, long employeeId, long workshopId)
public LeavErrorViewModel CheckErrors(DateTime startLeav, DateTime endLeav, long employeeId, long workshopId,
bool invalidCheckout)
{
var res = new LeavErrorViewModel();
#region Check iF Has Checkout
//var checkoutExist = _context.CheckoutSet.Where(x => x.WorkshopId == workshopId && x.EmployeeId == employeeId)
// .Where(x => (startLeav >= x.ContractStart && startLeav <= x.ContractEnd && endLeav > x.ContractEnd) ||
// (startLeav >= x.ContractStart && endLeav <= x.ContractEnd) ||
// (startLeav < x.ContractStart && endLeav <= x.ContractEnd && endLeav >= x.ContractStart) ||
// (startLeav < x.ContractStart && endLeav > x.ContractEnd)).ToList();
var checkoutExist = _context.CheckoutSet.Where(x => x.WorkshopId == workshopId && x.EmployeeId == employeeId && startLeav <= x.ContractEnd).ToList();
var checkoutExist = _context.CheckoutSet.Where(x =>
x.WorkshopId == workshopId && x.EmployeeId == employeeId && startLeav <= x.ContractEnd).ToList();
if (checkoutExist.Count > 0)
{
res.HasChekout = true;
@@ -433,6 +469,7 @@ public class LeaveRepository : RepositoryBase<long, Leave>, ILeaveRepository
res.ContractErrMessage = "در بازه تاریخ مرخصی وارد شده قراردادی وجود ندارد";
return res;
}
#endregion
#region Check LeftWork
@@ -445,11 +482,32 @@ public class LeaveRepository : RepositoryBase<long, Leave>, ILeaveRepository
if (leftCheck.Count < 1)
{
res.HasLeftWork = true;
res.LeftWorlErrMessage = " پرسنل در بازه تاریخ وارد شده شروع بکار ندارد";
return res;
res.HasLeftWork = true;
res.LeftWorlErrMessage = " پرسنل در بازه تاریخ وارد شده شروع بکار ندارد";
return res;
}
#endregion
#region HolidayError
var hasCustomizeCheckout =
_context.RollCallServices.FirstOrDefault(x => x.WorkshopId == workshopId && x.IsActiveString == "true")
?.HasCustomizeCheckoutService == "true";
if (_context.HolidayItems.Any(x => startLeav.Date == x.Holidaydate.Date) ||
startLeav.DayOfWeek == DayOfWeek.Friday)
{
if (!hasCustomizeCheckout)
{
res.HasHolidayError = true;
res.HolidayErrorMessage = "شما نمیتوانید در روز های تعطیل مرخصی ثبت کنید";
}
else if (!invalidCheckout)
{
res.HasHolidayError = true;
res.HolidayErrorMessage = "شما نمیتوانید در روز های مرخصی دارای اعتبار ثبت کنید";
}
}
#endregion
@@ -459,7 +517,7 @@ public class LeaveRepository : RepositoryBase<long, Leave>, ILeaveRepository
public LeaveViewModel LeavOnChekout(DateTime starContract, DateTime endContract, long employeeId, long workshopId)
{
return _context.LeaveList.Where(x => x.EmployeeId == employeeId && x.WorkshopId == workshopId).Select(x =>
return _context.LeaveList.Where(x => x.EmployeeId == employeeId && x.WorkshopId == workshopId).Select(x =>
new LeaveViewModel()
{
Id = x.id,
@@ -472,10 +530,9 @@ public class LeaveRepository : RepositoryBase<long, Leave>, ILeaveRepository
LeaveType = x.LeaveType,
IsAccepted = x.IsAccepted,
Decription = x.Decription
}).FirstOrDefault(x =>
(starContract <= x.StartLeaveGr && endContract >= x.StartLeaveGr) ||
(starContract <= x.EndLeaveGr && endContract >= x.EndLeaveGr) ||
(starContract <= x.EndLeaveGr && endContract >= x.EndLeaveGr) ||
(starContract >= x.StartLeaveGr && starContract <= x.EndLeaveGr) ||
(endContract >= x.StartLeaveGr && endContract <= x.EndLeaveGr));
}

View File

@@ -122,6 +122,7 @@ public class LeftWorkRepository : RepositoryBase<long, LeftWork>, ILeftWorkRepos
AddYearsPay = x.AddYearsPay,
AddLeavePay = x.AddLeavePay,
JobId = x.JobId,
HasLeft = x.HasLeft,
JobName = _context.Jobs.FirstOrDefault(j => j.id == x.JobId).JobName

View File

@@ -35,9 +35,11 @@ public class LoanRepository : RepositoryBase<long, Loan>, ILoanRepository
var startDate = loan.LoanInstallments.MinBy(x => x.InstallmentDate).InstallmentDate;
var endDate = loan.LoanInstallments.MaxBy(x => x.InstallmentDate).InstallmentDate;
var customizeCheckouts =await _companyContext.CustomizeCheckouts.Where(x => x.WorkshopId == loan.WorkshopId && x.EmployeeId == loan.EmployeeId &&
x.ContractStart <= endDate && x.ContractEnd >= startDate).Select(x=> new {x.MonthInt, x.YearInt}).ToListAsync();
var pc = new PersianCalendar();
var checkouts = (await _companyContext.CheckoutSet
.Where(x => x.WorkshopId == loan.WorkshopId && x.EmployeeId == loan.EmployeeId &&
startDate <= x.ContractEnd && endDate >= x.ContractEnd).AsNoTracking()
.SelectMany(x => x.LoanInstallments).ToListAsync());
var result = new LoanDetailsViewModel()
{
@@ -51,7 +53,7 @@ public class LoanRepository : RepositoryBase<long, Loan>, ILoanRepository
Id = x.Id,
InstallmentAmount = x.AmountForMonth.ToMoney(),
InstallmentDate = x.InstallmentDate.ToFarsi(),
IsPaid = customizeCheckouts.Any(c => c.MonthInt.ToString() == x.Month && c.YearInt.ToString() == x.Year)
IsPaid = checkouts.Any(c => c.EntityId == x.Id),
}).ToList()
};

View File

@@ -65,11 +65,12 @@ public class RollCallMandatoryRepository : RepositoryBase<long, RollCall>, IRoll
}
#region OfficialChckout
public ComputingViewModel MandatoryCompute(long employeeId, long workshopId, DateTime contractStart,
DateTime contractEnd,
CreateWorkingHoursTemp command, bool holidayWorking, bool isStaticCheckout, bool rotatingShiftCompute, bool totalLeaveCompute)
{
#region OfficialChckout
public ComputingViewModel MandatoryCompute(long employeeId, long workshopId, DateTime contractStart,
DateTime contractEnd,
CreateWorkingHoursTemp command, bool holidayWorking, bool isStaticCheckout, bool rotatingShiftCompute,double dailyWageUnAffected, bool totalLeaveCompute)
{
#region Entities
string SumWorkeTime = string.Empty;
@@ -490,18 +491,31 @@ public class RollCallMandatoryRepository : RepositoryBase<long, RollCall>, IRoll
var startDate = command.GetWorkDateHide.ToGeorgianDateTime();
var dayliFee = "خطای تاریخ";
double dayliFeeDouble = 0;
double baseYearUnAffected = 0;
double baseYearAffected = 0;
double dailySalaryAffected = 0;
if (styear >= 1370)
{
if (leftworkList == null)
leftworkList = new List<LeftWorkViewModel>();
var dayliFeeResult = _yearlySalaryRepository.DayliFeeComputing(startDate, contractStart, contractEnd,
command.EmployeeId, command.WorkshopId, leftworkList);
dayliFee = dayliFeeResult.DayliFee;
dayliFeeDouble = dayliFeeResult.DayliFeeDouble;
dayliFeeComplete = dayliFeeResult.DayliFee.MoneyToDouble();
basic = dayliFeeResult.Basic;
//var dayliFeeResult = _yearlySalaryRepository.DayliFeeComputing(startDate, contractStart, contractEnd,
// command.EmployeeId, command.WorkshopId, leftworkList);
//dayliFee = dayliFeeResult.DayliFee;
//dayliFeeDouble = dayliFeeResult.DayliFeeDouble;
//dayliFeeComplete = dayliFeeResult.DayliFee.MoneyToDouble();
//basic = dayliFeeResult.Basic;
//dayliFee = dailyWageUnAffected;
var baseYear = _yearlySalaryRepository.BaseYearCompute(contractStart, contractEnd, command.EmployeeId,
command.WorkshopId, leftworkList).Result;
dayliFee = (dailyWageUnAffected + baseYear.BaseYearResult).ToMoney();
baseYearUnAffected = baseYear.BaseYearResult;
baseYearAffected = baseYearUnAffected;
dailySalaryAffected = dailyWageUnAffected;
}
#endregion
@@ -526,10 +540,25 @@ public class RollCallMandatoryRepository : RepositoryBase<long, RollCall>, IRoll
if (!string.IsNullOrWhiteSpace(command.ShiftWork))
{
var workedHoursePerDay = totalHourses / mandatorDays;
var result = (dayliFeeDouble / 7.33) * workedHoursePerDay;
//var result = (dayliFeeDouble / 7.33) * workedHoursePerDay;
//dayliFee = result.ToMoney();
#region NeWdailyWage
var da = dailyWageUnAffected / 7.33;
dailySalaryAffected = da > 0 ? ((workedHoursePerDay * da).ToMoney()).MoneyToDouble() : 0;
var ba = baseYearUnAffected / 7.33;
baseYearAffected = ba > 0 ? ((workedHoursePerDay * ba).ToMoney()).MoneyToDouble() : 0;
var fullDailySalary = dailySalaryAffected + baseYearAffected;
dayliFee = fullDailySalary.ToMoney();
#endregion
dayliFee = result.ToMoney();
var HousingAllowonceNumberType = HousingAllowance.MoneyToDouble();
var HousingStep1 = HousingAllowonceNumberType / 30;
@@ -907,6 +936,13 @@ public class RollCallMandatoryRepository : RepositoryBase<long, RollCall>, IRoll
//ساعت موظفی پرسنل در این ماه
EmployeeMandatoryHours = mandatoryHoursTimeSpan,
#endregion
#region NewDailWage
BaseYearAffected = baseYearAffected,
DailySalaryAffected = dailySalaryAffected,
#endregion
};
#endregion
@@ -3511,6 +3547,7 @@ public class RollCallMandatoryRepository : RepositoryBase<long, RollCall>, IRoll
StartLeaveGr = contractStart,
EndLeaveGr = contractEnd,
IsAccepted = true,
};
List<LeaveViewModel> leaveList = _leaveRepository.search(leaveHourseSearch);

File diff suppressed because it is too large Load Diff

View File

@@ -209,10 +209,12 @@ using Company.Domain.ContactUsAgg;
using CompanyManagment.App.Contracts.ContactUs;
using Company.Domain.EmployeeAuthorizeTempAgg;
using Company.Domain.AdminMonthlyOverviewAgg;
using Company.Domain.ClassificationSchemeAgg;
using Company.Domain.ContractingPartyBankAccountsAgg;
using Company.Domain.PaymentInstrumentAgg;
using Company.Domain.PaymentTransactionAgg;
using CompanyManagment.App.Contracts.AdminMonthlyOverview;
using CompanyManagment.App.Contracts.ClassificationScheme;
using CompanyManagment.App.Contracts.ContractingPartyBankAccounts;
using CompanyManagment.App.Contracts.PaymentInstrument;
using CompanyManagment.App.Contracts.PaymentTransaction;
@@ -493,11 +495,25 @@ public class PersonalBootstrapper
services.AddTransient<IPlanPercentageRepository, PlanPercentageRepository>();
services.AddTransient<IInstitutionPlanApplication, InstitutionPlanApplication>();
//=========End Of Main====================================
//---File Project------------------------------------
services.AddTransient<IBoardApplication, BoardApplication>();
#region ClassificationScheme
services.AddTransient<IClassificationSchemeApplication, ClassificationSchemeApplication>();
services.AddTransient<IClassificationSchemeRepository, ClassificationSchemeRepository>();
services.AddTransient<IClassificationGroupRepository, ClassificationGroupRepository>();
services.AddTransient<IClassificationGroupSalariesRepository, ClassificationGroupSalariesRepository>();
services.AddTransient<IClassificationRialCoefficientRepository, ClassificationRialCoefficientRepository>();
services.AddTransient<IClassificationEmployeeRepository, ClassificationEmployeeRepository>();
#endregion
//=========End Of Main====================================
//---File Project------------------------------------
services.AddTransient<IBoardApplication, BoardApplication>();
services.AddTransient<IBoardRepository, BoardRepository>();
services.AddTransient<IFileApplication, FileApplication>();

Some files were not shown because too many files have changed in this diff Show More