diff --git a/0_Framework/Application/Tools.cs b/0_Framework/Application/Tools.cs
index 7fb0c7e3..f28e3246 100644
--- a/0_Framework/Application/Tools.cs
+++ b/0_Framework/Application/Tools.cs
@@ -1396,6 +1396,73 @@ public static class Tools
return false;
return true;
}
+
+ ///
+ /// چک میکند که در دو شیفت استاتیک تداخل زمانی وجود دارد یا خیر
+ /// چک میکند که آیا ساعات وارد شده ولید هستند یا خیر
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static bool InterferenceTime(string start1, string end1, string start2, string end2)
+ {
+ if (!CheckValidHm(start1))
+ return true;
+
+ if (!CheckValidHm(end1))
+ return true;
+
+ if (!CheckValidHm(start2))
+ return true;
+
+ if (!CheckValidHm(end2))
+ return true;
+
+ //اگه دو شیفت نبود
+ if (string.IsNullOrWhiteSpace(start1) || string.IsNullOrWhiteSpace(start2))
+ return false;
+
+
+ try
+ {
+ var start1Gr = Convert.ToDateTime(start1);
+ var end1Gr = Convert.ToDateTime(end1);
+
+ if (end1Gr < start1Gr)
+ end1Gr = end1Gr.AddDays(1);
+
+ var start2Gr = Convert.ToDateTime(start2);
+ var end2Gr = Convert.ToDateTime(end2);
+
+
+ start2Gr = new DateTime(end1Gr.Year, end1Gr.Month, end1Gr.Day, start2Gr.Hour, start2Gr.Minute,
+ start2Gr.Second);
+
+
+ end2Gr = new DateTime(end1Gr.Year, end1Gr.Month, end1Gr.Day, end2Gr.Hour, end2Gr.Minute,
+ end2Gr.Second);
+ if (end2Gr < start2Gr)
+ end2Gr = end2Gr.AddDays(1);
+
+ var diff = (end1Gr - start1Gr).Add((end2Gr - start2Gr));
+ if (diff > new TimeSpan(24,0,0))
+ return true;
+
+ if (start2Gr <= end1Gr)
+ return true;
+
+ return false;
+ }
+ catch (Exception)
+ {
+
+ return true;
+ }
+
+
+ }
public static DateTime FindFirstDayOfMonthGr(this DateTime date)
{
var pc = new PersianCalendar();
diff --git a/0_Framework/Application/UID/UidService.cs b/0_Framework/Application/UID/UidService.cs
index 3d472dcb..ccf3c0ef 100644
--- a/0_Framework/Application/UID/UidService.cs
+++ b/0_Framework/Application/UID/UidService.cs
@@ -10,67 +10,70 @@ namespace _0_Framework.Application.UID;
public class UidService : IUidService
{
- private readonly HttpClient _httpClient;
- private const string BaseUrl= "https://json-api.uid.ir/api/inquiry/";
+ private readonly HttpClient _httpClient;
+ private const string BaseUrl = "https://json-api.uid.ir/api/inquiry/";
- public UidService()
- {
- _httpClient = new HttpClient()
- {
- BaseAddress = new Uri(BaseUrl)
- };
- }
+ public UidService()
+ {
+ _httpClient = new HttpClient()
+ {
+ BaseAddress = new Uri(BaseUrl)
+ };
+ }
- public async Task GetPersonalInfo(string nationalCode, string birthDate)
- {
- var request = new PersonalInfoRequest
- {
- BirthDate = birthDate ,
- NationalId = nationalCode,
- RequestContext = new UidRequestContext()
- };
- var json = JsonConvert.SerializeObject(request);
- var contentType = new StringContent(json, Encoding.UTF8, "application/json");
+ public async Task GetPersonalInfo(string nationalCode, string birthDate)
+ {
+ var request = new PersonalInfoRequest
+ {
+ BirthDate = birthDate,
+ NationalId = nationalCode,
+ RequestContext = new UidRequestContext()
+ };
+ var json = JsonConvert.SerializeObject(request);
+ var contentType = new StringContent(json, Encoding.UTF8, "application/json");
- var requestResult = await _httpClient.PostAsync("person/v2", contentType);
- try
- {
- if (!requestResult.IsSuccessStatusCode)
- return null;
- var responseResult = await requestResult.Content.ReadFromJsonAsync();
- if (responseResult.BasicInformation != null)
- {
- responseResult.BasicInformation.FirstName = responseResult.BasicInformation.FirstName?.ToPersian();
- responseResult.BasicInformation.LastName = responseResult.BasicInformation.LastName?.ToPersian();
- responseResult.BasicInformation.FatherName = responseResult.BasicInformation.FatherName?.ToPersian();
- }
+ try
+ {
+ var requestResult = await _httpClient.PostAsync("person/v2", contentType);
+ if (!requestResult.IsSuccessStatusCode)
+ return null;
+ var responseResult = await requestResult.Content.ReadFromJsonAsync();
+ if (responseResult.BasicInformation != null)
+ {
+ responseResult.BasicInformation.FirstName = responseResult.BasicInformation.FirstName?.ToPersian();
+ responseResult.BasicInformation.LastName = responseResult.BasicInformation.LastName?.ToPersian();
+ responseResult.BasicInformation.FatherName = responseResult.BasicInformation.FatherName?.ToPersian();
+ }
- return responseResult;
- }
- catch
- {
+ return responseResult;
+ }
+ catch
+ {
- return null;
- }
- }
+ return new PersonalInfoResponse(new UidBasicInformation(),
+ new IdentificationInformation(default, default, default, default, default), new RegistrationStatus(),
+ new ResponseContext(new UidStatus(14, "")));
+ }
+
+ }
- public async Task IsMachPhoneWithNationalCode(string nationalCode, string phoneNumber)
- {
- var request = new PersonalInfoRequest
- {
- MobileNumber = phoneNumber,
- NationalId = nationalCode,
- RequestContext = new UidRequestContext()
- };
- var json = JsonConvert.SerializeObject(request);
- var contentType = new StringContent(json, Encoding.UTF8, "application/json");
+ public async Task IsMachPhoneWithNationalCode(string nationalCode, string phoneNumber)
+ {
+ var request = new PersonalInfoRequest
+ {
+ MobileNumber = phoneNumber,
+ NationalId = nationalCode,
+ RequestContext = new UidRequestContext()
+ };
+ var json = JsonConvert.SerializeObject(request);
+ var contentType = new StringContent(json, Encoding.UTF8, "application/json");
- var requestResult = await _httpClient.PostAsync("mobile/owner/v2", contentType);
- if (!requestResult.IsSuccessStatusCode)
- return null;
+ var requestResult = await _httpClient.PostAsync("mobile/owner/v2", contentType);
+ if (!requestResult.IsSuccessStatusCode)
+ return null;
- var responseResult = await requestResult.Content.ReadFromJsonAsync();
- return responseResult;
- }
+ var responseResult = await requestResult.Content.ReadFromJsonAsync();
+ return responseResult;
+ }
}
\ No newline at end of file
diff --git a/AccountManagement.Application.Contracts/Media/IMediaApplication.cs b/AccountManagement.Application.Contracts/Media/IMediaApplication.cs
index a4148a11..cbeb3184 100644
--- a/AccountManagement.Application.Contracts/Media/IMediaApplication.cs
+++ b/AccountManagement.Application.Contracts/Media/IMediaApplication.cs
@@ -4,12 +4,13 @@ using System.Collections.Generic;
namespace AccountManagement.Application.Contracts.Media
{
- public interface IMediaApplication
- {
- MediaViewModel Get(long id);
- OperationResult UploadFile(IFormFile file, string fileLabel, string relativePath, int maximumFileLength, List allowedExtensions);
- OperationResult MoveFile(long mediaId, string newRelativePath);
- OperationResult DeleteFile(long mediaId);
- List GetRange(IEnumerable select);
- }
-}
+ public interface IMediaApplication
+ {
+ MediaViewModel Get(long id);
+ OperationResult UploadFile(IFormFile file, string fileLabel, string relativePath, int maximumFileLength,
+ List allowedExtensions, string category);
+ OperationResult MoveFile(long mediaId, string newRelativePath);
+ OperationResult DeleteFile(long mediaId);
+ List GetRange(IEnumerable select);
+ }
+}
\ No newline at end of file
diff --git a/AccountManagement.Application/MediaApplication.cs b/AccountManagement.Application/MediaApplication.cs
index a0a37355..354027da 100644
--- a/AccountManagement.Application/MediaApplication.cs
+++ b/AccountManagement.Application/MediaApplication.cs
@@ -9,147 +9,113 @@ using Microsoft.AspNetCore.Http;
namespace AccountManagement.Application
{
- public class MediaApplication:IMediaApplication
- {
+ public class MediaApplication : IMediaApplication
+ {
- private const string _basePath = "Medias";
- private readonly IMediaRepository _mediaRepository;
+ private const string _basePath = "Medias";
+ private readonly IMediaRepository _mediaRepository;
- public MediaApplication(IMediaRepository mediaRepository)
- {
- _mediaRepository = mediaRepository;
- }
+ public MediaApplication(IMediaRepository mediaRepository)
+ {
+ _mediaRepository = mediaRepository;
+ }
- ///
- /// دریافت فایل و نوشتن آن در مسیر داده شده، و ثبت مدیا
- ///
- /// فایل
- /// برچسب فایل که در نام فایل ظاهر می شود
- /// مسیر فایل
- /// [.png,.jpg,.jpeg] پسوند های مجاز مثلا
- /// حداکثر حجم فایل به مگابایت
- ///
- public OperationResult UploadFile(IFormFile file, string fileLabel, string relativePath,int maximumFileLength,List allowedExtensions)
- {
- OperationResult op = new();
- var path = Path.Combine(_basePath, relativePath);
- var fileExtension = Path.GetExtension(file.FileName);
-
- if (file == null || file.Length == 0)
- return op.Failed("خطای سیستمی");
-
- if (file.Length > (maximumFileLength * 1024 * 1024))
- return op.Failed($"حجم فایل نمی تواند بیشتر از " +
- $"{maximumFileLength}" +
- $"مگابایت باشد");
-
- if (!allowedExtensions.Contains(fileExtension.ToLower()))
- {
- var operationMessage = ":فرمت فایل باید یکی از موارد زیر باشد";
- operationMessage += "\n";
- operationMessage += string.Join(" ", allowedExtensions);
- return op.Failed(operationMessage);
- }
+ ///
+ /// دریافت فایل و نوشتن آن در مسیر داده شده، و ثبت مدیا
+ ///
+ /// فایل
+ /// برچسب فایل که در نام فایل ظاهر می شود
+ /// مسیر فایل
+ /// حداکثر حجم فایل به مگابایت
+ /// [.png,.jpg,.jpeg] پسوند های مجاز مثلا
+ ///
+ ///
+ public OperationResult UploadFile(IFormFile file, string fileLabel, string relativePath, int maximumFileLength,
+ List allowedExtensions, string category)
+ {
+ return _mediaRepository.UploadFile(file, fileLabel, relativePath, maximumFileLength, allowedExtensions, category);
+ }
- Directory.CreateDirectory(path);
+ ///
+ /// حذف فایل
+ ///
+ public OperationResult DeleteFile(long mediaId)
+ {
+ OperationResult op = new();
+ var media = _mediaRepository.Get(mediaId);
+ if (media == null)
+ return op.Failed("رکورد مورد نظر یافت نشد");
+ try
+ {
+ if (File.Exists(media.Path))
+ File.Delete(media.Path);
+ else
+ return op.Failed("فایل یافت نشد");
+ }
+ catch
+ {
+ return op.Failed("خطایی در حذف فایل رخ داده است");
+ }
- var extension = Path.GetExtension(file.FileName);
+ _mediaRepository.Remove(media.id);
+ _mediaRepository.SaveChanges();
+ return op.Succcedded();
+ }
- var uniqueFileName = $"{fileLabel}-{DateTime.Now.Ticks}{extension}";
- var filePath = Path.Combine(path, uniqueFileName);
- using (var fileStream = new FileStream(filePath, FileMode.CreateNew))
- {
- file.CopyTo(fileStream);
- }
- var mediaEntity = new Media(filePath, extension, "فایل", "EmployeeDocuments");
- _mediaRepository.Create(mediaEntity);
- _mediaRepository.SaveChanges();
+ ///
+ /// جابجا کردن فایل
+ ///
+ public OperationResult MoveFile(long mediaId, string newRelativePath)
+ {
+ OperationResult op = new();
+ var media = _mediaRepository.Get(mediaId);
+ var oldPath = media.Path;
+ var path = Path.Combine(_basePath, newRelativePath);
+ Directory.CreateDirectory(path);
- return op.Succcedded(mediaEntity.id);
+ string filepath = Path.Combine(path, Path.GetFileName(oldPath));
+ try
+ {
+ File.Move(oldPath, filepath);
+ }
+ catch
+ {
+ return op.Failed("در جابجایی فایل خطایی رخ داده است");
+ }
- }
+ media.Edit(filepath, media.Type, media.Category);
+ _mediaRepository.SaveChanges();
+ return op.Succcedded();
+ }
+ public MediaViewModel Get(long id)
+ {
+ var media = _mediaRepository.Get(id);
+ if (media == null)
+ return new();
+ return new MediaViewModel()
+ {
+ Category = media.Category,
+ Path = media.Path,
+ Id = media.id,
+ Type = media.Type
+ };
+ }
- ///
- /// حذف فایل
- ///
- public OperationResult DeleteFile(long mediaId)
- {
- OperationResult op = new();
- var media = _mediaRepository.Get(mediaId);
- if (media == null)
- return op.Failed("رکورد مورد نظر یافت نشد");
- try
- {
- if (File.Exists(media.Path))
- File.Delete(media.Path);
- else
- return op.Failed("فایل یافت نشد");
- }
- catch
- {
- return op.Failed("خطایی در حذف فایل رخ داده است");
- }
+ public List GetRange(IEnumerable ids)
+ {
+ var medias = _mediaRepository.GetRange(ids);
+ return medias.Select(x => new MediaViewModel()
+ {
+ Category = x.Category,
+ Path = x.Path,
+ Id = x.id,
+ Type = x.Type,
+ }).ToList();
+ }
- _mediaRepository.Remove(media.id);
- _mediaRepository.SaveChanges();
- return op.Succcedded();
- }
-
- ///
- /// جابجا کردن فایل
- ///
- public OperationResult MoveFile(long mediaId, string newRelativePath)
- {
- OperationResult op = new();
- var media = _mediaRepository.Get(mediaId);
- var oldPath = media.Path;
- var path = Path.Combine(_basePath, newRelativePath);
- Directory.CreateDirectory(path);
-
- string filepath = Path.Combine(path, Path.GetFileName(oldPath));
- try
- {
- File.Move(oldPath, filepath);
- }
- catch
- {
- return op.Failed("در جابجایی فایل خطایی رخ داده است");
- }
-
- media.Edit(filepath, media.Type, media.Category);
- _mediaRepository.SaveChanges();
- return op.Succcedded();
- }
-
- public MediaViewModel Get(long id)
- {
- var media = _mediaRepository.Get(id);
- if (media == null)
- return new();
- return new MediaViewModel()
- {
- Category = media.Category,
- Path = media.Path,
- Id = media.id,
- Type = media.Type
- };
- }
-
- public List GetRange(IEnumerable ids)
- {
- var medias = _mediaRepository.GetRange(ids);
- return medias.Select(x=>new MediaViewModel()
- {
- Category = x.Category,
- Path = x.Path,
- Id = x.id,
- Type = x.Type,
- }).ToList();
- }
-
- }
+ }
}
diff --git a/AccountManagement.Domain/AssignAgg/Assign.cs b/AccountManagement.Domain/AssignAgg/Assign.cs
index 6f1a5810..4b098569 100644
--- a/AccountManagement.Domain/AssignAgg/Assign.cs
+++ b/AccountManagement.Domain/AssignAgg/Assign.cs
@@ -2,6 +2,7 @@
using AccountManagement.Domain.TaskAgg;
using System;
using System.Collections.Generic;
+using System.Linq;
using AccountManagement.Domain.TaskMessageAgg;
namespace AccountManagement.Domain.AssignAgg;
@@ -158,4 +159,24 @@ public class Assign : EntityBase
IsDoneRequest=isDoneRequest;
DoneDescription=doneDescription;
}
+
+ public void ChangeAssignedId(long assignedId)
+ {
+ AssignedId = assignedId;
+ }
+
+ public void SetAssignerId(long assignerId)
+ {
+ AssignerId = assignerId;
+ }
+
+ public void ChangeSender(long senderId)
+ {
+ Task.SetSender(senderId);
+ var taskMessageItemsEnumerable =TaskMessageList.SelectMany(m => m.TaskMessageItemsList);
+ foreach (var taskMessageItems in taskMessageItemsEnumerable)
+ {
+ taskMessageItems.SetSenderId(senderId);
+ }
+ }
}
\ No newline at end of file
diff --git a/AccountManagement.Domain/MediaAgg/IMediaRepository.cs b/AccountManagement.Domain/MediaAgg/IMediaRepository.cs
index b8ccb898..f84117d6 100644
--- a/AccountManagement.Domain/MediaAgg/IMediaRepository.cs
+++ b/AccountManagement.Domain/MediaAgg/IMediaRepository.cs
@@ -1,12 +1,15 @@
using System.Collections.Generic;
+using _0_Framework.Application;
using _0_Framework.Domain;
using AccountManagement.Application.Contracts.Media;
+using Microsoft.AspNetCore.Http;
namespace AccountManagement.Domain.MediaAgg;
-public interface IMediaRepository:IRepository
+public interface IMediaRepository : IRepository
{
+ public string BasePath { get; protected set; }
void CreateMediaWithTaskMedia(long taskId, long mediaId);
List GetMediaByTaskId(long taskId);
void Remove(long id);
@@ -23,4 +26,6 @@ public interface IMediaRepository:IRepository
#endregion
+ OperationResult UploadFile(IFormFile file, string fileLabel, string relativePath, int maximumFileLength,
+ List allowedExtensions, string category);
}
\ No newline at end of file
diff --git a/AccountManagement.Domain/TaskAgg/Tasks.cs b/AccountManagement.Domain/TaskAgg/Tasks.cs
index 39d94082..44878729 100644
--- a/AccountManagement.Domain/TaskAgg/Tasks.cs
+++ b/AccountManagement.Domain/TaskAgg/Tasks.cs
@@ -1,10 +1,12 @@
using System;
using System.Collections.Generic;
+using System.Linq;
using System.Security.AccessControl;
using _0_Framework.Domain;
using AccountManagement.Domain.AssignAgg;
using AccountManagement.Domain.TaskMediaAgg;
using AccountManagement.Domain.TaskScheduleAgg;
+using OfficeOpenXml.Style;
namespace AccountManagement.Domain.TaskAgg;
@@ -80,4 +82,40 @@ public class Tasks : EntityBase
TaskScheduleId = taskScheduleId;
}
+ public void ChangeSender(long senderId)
+ {
+ var prevSender = SenderId;
+
+ var assigners = Assigns.Where(x => x.AssignerId == prevSender).ToList();
+
+ foreach (var assigner in assigners)
+ {
+ assigner.SetAssignerId(senderId);
+ }
+
+ var senderMessageItem = Assigns
+ .SelectMany(x=>x.TaskMessageList
+ .SelectMany(m=>m.TaskMessageItemsList)).Where(x=>x.SenderAccountId == prevSender).ToList();
+
+ var receiverMessageItem = Assigns.SelectMany(x=>x.TaskMessageList
+ .SelectMany(m=>m.TaskMessageItemsList)).Where(x=>x.ReceiverAccountId == prevSender).ToList();
+
+
+ SenderId = senderId;
+
+ foreach (var taskMessageItems in senderMessageItem)
+ {
+ taskMessageItems.SetSenderId(senderId);
+ }
+ foreach (var taskMessageItems in receiverMessageItem)
+ {
+ taskMessageItems.SetReceiver(senderId);
+ }
+
+ }
+
+ public void SetSender(long senderId)
+ {
+ SenderId = senderId;
+ }
}
\ No newline at end of file
diff --git a/AccountManagement.Domain/TaskMessageItemsAgg/TaskMessageItems.cs b/AccountManagement.Domain/TaskMessageItemsAgg/TaskMessageItems.cs
index 155017f2..a63f881e 100644
--- a/AccountManagement.Domain/TaskMessageItemsAgg/TaskMessageItems.cs
+++ b/AccountManagement.Domain/TaskMessageItemsAgg/TaskMessageItems.cs
@@ -19,4 +19,13 @@ public class TaskMessageItems:EntityBase
public TaskMessage TaskMessage { get; set; }
+ public void SetSenderId(long senderId)
+ {
+ SenderAccountId = senderId;
+ }
+
+ public void SetReceiver(long receiverId)
+ {
+ ReceiverAccountId = receiverId;
+ }
}
\ No newline at end of file
diff --git a/AccountMangement.Infrastructure.EFCore/Repository/MediaRepository.cs b/AccountMangement.Infrastructure.EFCore/Repository/MediaRepository.cs
index 541ce3f1..756bfae3 100644
--- a/AccountMangement.Infrastructure.EFCore/Repository/MediaRepository.cs
+++ b/AccountMangement.Infrastructure.EFCore/Repository/MediaRepository.cs
@@ -1,5 +1,8 @@
-using System.Collections.Generic;
+using System;
+using System.Collections.Generic;
+using System.IO;
using System.Linq;
+using _0_Framework.Application;
using _0_Framework.InfraStructure;
using AccountManagement.Application.Contracts.Media;
using AccountManagement.Domain.AdminResponseMediaAgg;
@@ -7,27 +10,35 @@ using AccountManagement.Domain.ClientResponseMediaAgg;
using AccountManagement.Domain.MediaAgg;
using AccountManagement.Domain.TaskMediaAgg;
using AccountManagement.Domain.TicketMediasAgg;
+using Microsoft.AspNetCore.Hosting;
+using Microsoft.AspNetCore.Http;
using Microsoft.EntityFrameworkCore;
namespace AccountMangement.Infrastructure.EFCore.Repository;
-public class MediaRepository:RepositoryBase,IMediaRepository
+public class MediaRepository : RepositoryBase, IMediaRepository
{
+ private const string _basePath = "Storage/Medias";
+ public string BasePath { get; set; }
+
+
private readonly AccountContext _accountContext;
- public MediaRepository( AccountContext taskManagerContext) : base(taskManagerContext)
+ public MediaRepository(AccountContext taskManagerContext, IWebHostEnvironment webHostEnvironment) : base(taskManagerContext)
{
_accountContext = taskManagerContext;
+ BasePath = webHostEnvironment.ContentRootPath + "/Storage";
}
//ساخت جدول واسط بین مدیا و نسک
//نکته: این متد ذخیره انجام نمیدهد
+
public void CreateMediaWithTaskMedia(long taskId, long mediaId)
{
- var Taskmedias = new TaskMedia(taskId,mediaId);
+ var Taskmedias = new TaskMedia(taskId, mediaId);
_accountContext.Add(Taskmedias);
}
public void Remove(long id)
{
- var media = Get(id);
+ var media = Get(id);
Remove(media);
}
@@ -77,6 +88,48 @@ public class MediaRepository:RepositoryBase,IMediaRepository
{
return _accountContext.Medias.Where(x => mediaIds.Contains(x.id)).ToList();
}
+
+ public OperationResult UploadFile(IFormFile file, string fileLabel, string relativePath, int maximumFileLength,
+ List allowedExtensions, string category)
+ {
+ OperationResult op = new();
+ var path = Path.Combine(_basePath, relativePath);
+ var fileExtension = Path.GetExtension(file.FileName);
+
+ if (file == null || file.Length == 0)
+ return op.Failed("خطای سیستمی");
+
+ if (file.Length > (maximumFileLength * 1024 * 1024))
+ return op.Failed($"حجم فایل نمی تواند بیشتر از " +
+ $"{maximumFileLength}" +
+ $"مگابایت باشد");
+
+ if (!allowedExtensions.Contains(fileExtension.ToLower()))
+ {
+ var operationMessage = ":فرمت فایل باید یکی از موارد زیر باشد";
+ operationMessage += "\n";
+ operationMessage += string.Join(" ", allowedExtensions);
+ return op.Failed(operationMessage);
+ }
+
+
+ Directory.CreateDirectory(path);
+
+ var extension = Path.GetExtension(file.FileName);
+
+ var uniqueFileName = $"{fileLabel}-{DateTime.Now.Ticks}{extension}";
+ var filePath = Path.Combine(path, uniqueFileName);
+ using (var fileStream = new FileStream(filePath, FileMode.CreateNew))
+ {
+ file.CopyTo(fileStream);
+ }
+ var mediaEntity = new Media(filePath, extension, "فایل", category);
+ Create(mediaEntity);
+ SaveChanges();
+
+ return op.Succcedded(mediaEntity.id);
+
+ }
}
#endregion
diff --git a/Company.Domain/CheckoutAgg/Checkout.cs b/Company.Domain/CheckoutAgg/Checkout.cs
index 760f8259..a0a24239 100644
--- a/Company.Domain/CheckoutAgg/Checkout.cs
+++ b/Company.Domain/CheckoutAgg/Checkout.cs
@@ -3,6 +3,7 @@ using System.Collections;
using System.Collections.Generic;
using _0_Framework.Application;
using _0_Framework.Domain;
+using _0_Framework.Domain.CustomizeCheckoutShared.Enums;
using Company.Domain.CheckoutAgg.ValueObjects;
using Company.Domain.CustomizeCheckoutAgg.ValueObjects;
using Company.Domain.WorkshopAgg;
@@ -29,7 +30,7 @@ public class Checkout : EntityBase
string overNightWorkValue, string fridayWorkValue, string rotatingShifValue, string absenceValue,
string totalDayOfLeaveCompute, string totalDayOfYearsCompute, string totalDayOfBunosesCompute,
ICollection loanInstallments,
- ICollection salaryAids)
+ ICollection salaryAids,CheckoutRollCall checkoutRollCall)
{
EmployeeFullName = employeeFullName;
FathersName = fathersName;
@@ -88,6 +89,7 @@ public class Checkout : EntityBase
TotalDayOfBunosesCompute = totalDayOfBunosesCompute;
LoanInstallments = loanInstallments;
SalaryAids = salaryAids;
+ CheckoutRollCall = checkoutRollCall;
}
public string EmployeeFullName { get; private set; }
@@ -196,7 +198,8 @@ public class Checkout : EntityBase
public ICollection LoanInstallments { get; set; } = [];
public ICollection SalaryAids { get; set; } = [];
- #endregion
+ public CheckoutRollCall CheckoutRollCall { get; private set; }
+ #endregion
public Workshop Workshop { get; set; }
@@ -308,4 +311,149 @@ public class Checkout : EntityBase
LoanInstallments = lonaInstallments;
InstallmentDeduction = installmentsAmount;
}
+
+ public void SetCheckoutRollCall(CheckoutRollCall checkoutRollCall)
+ {
+ CheckoutRollCall = checkoutRollCall;
+ }
+}
+
+public class CheckoutRollCall
+{
+ private CheckoutRollCall(){}
+ public CheckoutRollCall(TimeSpan totalMandatoryTimeSpan, TimeSpan totalPresentTimeSpan, TimeSpan totalBreakTimeSpan,
+ TimeSpan totalWorkingTimeSpan, TimeSpan totalPaidLeaveTmeSpan, TimeSpan totalSickLeaveTimeSpan,
+ ICollection rollCallDaysCollection)
+ {
+ TotalMandatoryTimeSpan = totalMandatoryTimeSpan;
+ TotalPresentTimeSpan = totalPresentTimeSpan;
+ TotalBreakTimeSpan = totalBreakTimeSpan;
+ TotalWorkingTimeSpan = totalWorkingTimeSpan;
+ TotalPaidLeaveTmeSpan = totalPaidLeaveTmeSpan;
+ TotalSickLeaveTimeSpan = totalSickLeaveTimeSpan;
+ RollCallDaysCollection = rollCallDaysCollection;
+ }
+
+
+ ///
+ /// مجموع ساعت موظفی
+ ///
+ public TimeSpan TotalMandatoryTimeSpan { get; private set; }
+
+ ///
+ /// مجموع ساعت حضور
+ ///
+ public TimeSpan TotalPresentTimeSpan { get; private set; }
+
+ ///
+ /// مجموع ساعت استراحت
+ ///
+ public TimeSpan TotalBreakTimeSpan { get; private set; }
+
+ ///
+ /// مجموع ساعت کارکرد
+ ///
+ public TimeSpan TotalWorkingTimeSpan { get; private set; }
+
+ ///
+ /// مجموع ساعت مرخصی استحقاقی
+ ///
+ public TimeSpan TotalPaidLeaveTmeSpan { get; private set; }
+
+ ///
+ /// مجموع ساعت مرخصی استعلاجی
+ ///
+ public TimeSpan TotalSickLeaveTimeSpan { get; private set; }
+
+ ///
+ /// روز های حضور غیاب
+ ///
+ public ICollection RollCallDaysCollection { get; private set; }
+}
+
+public class CheckoutRollCallDay
+{
+ private CheckoutRollCallDay(){}
+ public CheckoutRollCallDay(DateTime date, string firstStartDate, string firstEndDate,
+ string secondStartDate, string secondEndDate, TimeSpan breakTimeSpan,
+ bool isSliced, TimeSpan workingTimeSpan, bool isAbsent, bool isFriday,
+ bool isHoliday, string leaveType)
+ {
+ Date = date;
+ FirstStartDate = firstStartDate;
+ FirstEndDate = firstEndDate;
+ SecondStartDate = secondStartDate;
+ SecondEndDate = secondEndDate;
+ BreakTimeSpan = breakTimeSpan;
+ IsSliced = isSliced;
+ WorkingTimeSpan = workingTimeSpan;
+ IsAbsent = isAbsent;
+ IsFriday = isFriday;
+ IsHoliday = isHoliday;
+ LeaveType = leaveType;
+ }
+
+ public long Id { get; set; }
+
+ ///
+ /// تاریخ
+ ///
+ public DateTime Date { get; private set; }
+ ///
+ /// ورود اول
+ ///
+ public string FirstStartDate { get; private set; }
+
+ ///
+ /// خروج اول
+ ///
+ public string FirstEndDate { get; private set; }
+
+ ///
+ /// ورود دوم
+ ///
+ public string SecondStartDate { get; private set; }
+
+ ///
+ /// خروج دوم
+ ///
+ public string SecondEndDate { get; private set; }
+
+ ///
+ /// ساعت استراحت
+ ///
+ public TimeSpan BreakTimeSpan { get; private set; }
+
+ ///
+ /// مقدار زمان کارکرد
+ ///
+ public TimeSpan WorkingTimeSpan { get; private set; }
+
+ ///
+ /// آیا منقطع است؟
+ ///
+ public bool IsSliced { get; private set; }
+
+ ///
+ /// آیا غیبت است
+ ///
+ public bool IsAbsent { get; private set; }
+
+ ///
+ /// آیا جمعه است
+ ///
+ public bool IsFriday { get; private set; }
+
+ ///
+ /// آیا تعطیل رسمی است
+ ///
+ public bool IsHoliday { get; private set; }
+
+ ///
+ /// نوع مرخصی - درصورت نداشتن مرخصی مقدارش null میباشد
+ ///
+ public string LeaveType { get; private set; }
+
+ public long CheckoutId { get; set; }
+
}
\ No newline at end of file
diff --git a/Company.Domain/CheckoutAgg/ICheckoutRepository.cs b/Company.Domain/CheckoutAgg/ICheckoutRepository.cs
index 6828fe80..90d2f576 100644
--- a/Company.Domain/CheckoutAgg/ICheckoutRepository.cs
+++ b/Company.Domain/CheckoutAgg/ICheckoutRepository.cs
@@ -59,6 +59,16 @@ public interface ICheckoutRepository : IRepository
OperationResult DeleteAllCheckouts(List ids);
OperationResult DeleteCheckout(long id);
List CheckHasSignature(List ids);
+
+ ///
+ /// لیست تصفیه حساب
+ /// جدید
+ ///
+ ///
+ ///
+ ///
+ Task> SearchCheckoutOptimized(CheckoutSearchModel searchModel);
+
Task> SearchForMainCheckout(CheckoutSearchModel searchModel);
#endregion
diff --git a/Company.Domain/EmployeeComputeOptionsAgg/EmployeeComputeOptions.cs b/Company.Domain/EmployeeComputeOptionsAgg/EmployeeComputeOptions.cs
index 0f724037..4bb2974f 100644
--- a/Company.Domain/EmployeeComputeOptionsAgg/EmployeeComputeOptions.cs
+++ b/Company.Domain/EmployeeComputeOptionsAgg/EmployeeComputeOptions.cs
@@ -3,36 +3,110 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
+using _0_Framework.Application;
using _0_Framework.Domain;
namespace Company.Domain.EmployeeComputeOptionsAgg
{
public class EmployeeComputeOptions : EntityBase
{
- public EmployeeComputeOptions(long workshopId, long employeeId, string computeOptions, string bonusesOptions, string yearsOptions)
- {
- WorkshopId = workshopId;
- EmployeeId = employeeId;
- ComputeOptions = computeOptions;
- BonusesOptions = bonusesOptions;
- YearsOptions = yearsOptions;
- }
+ public EmployeeComputeOptions(long workshopId, long employeeId, string computeOptions, string bonusesOptions, string yearsOptions,
+ bool createContract, bool signContract, bool createCheckout, bool signCheckout, string contractTerm, IsActive cutContractEndOfYear)
+ {
+ WorkshopId = workshopId;
+ EmployeeId = employeeId;
+ ComputeOptions = computeOptions;
+ BonusesOptions = bonusesOptions;
+ YearsOptions = yearsOptions;
+ ContractTerm = contractTerm;
+ CutContractEndOfYear = contractTerm == "1" ? IsActive.None : cutContractEndOfYear;
- public long WorkshopId { get; private set;}
- public long EmployeeId { get; private set;}
+ SetContractAndCheckoutOptions(createContract, signContract, createCheckout, signCheckout);
+ }
- //نحوه محاسبه مزد مرخصی
- public string ComputeOptions { get; private set; }
- //نحوه محاسبه عیدی
- public string BonusesOptions { get; private set; }
- //نحوه محاسبه سنوات
- public string YearsOptions { get; private set; }
- public void Edit(string computeOptions, string bonusesOptions, string yearsOptions)
- {
- ComputeOptions = computeOptions;
- BonusesOptions = bonusesOptions;
- YearsOptions = yearsOptions;
- }
- }
+
+ public long WorkshopId { get; private set; }
+ public long EmployeeId { get; private set; }
+
+ //نحوه محاسبه مزد مرخصی
+ public string ComputeOptions { get; private set; }
+ //نحوه محاسبه عیدی
+ public string BonusesOptions { get; private set; }
+ //نحوه محاسبه سنوات
+ public string YearsOptions { get; private set; }
+
+ ///
+ /// ایجاد قرارداد
+ ///
+ public bool CreateContract { get; private set; }
+
+ ///
+ /// امضای قرارداد
+ ///
+ public bool SignContract { get; private set; }
+ ///
+ /// ایجاد تصفیه
+ ///
+ public bool CreateCheckout { get; private set; }
+ ///
+ /// امضای تصفیه
+ ///
+ public bool SignCheckout { get; private set; }
+
+ ///
+ /// مدت قرارداد
+ ///
+ public string ContractTerm { get; private set; }
+
+ ///
+ /// اگر قرارداد بیش از یک ماه باشد و گزینه انتخاب شده منتهی به پایان سال باشد
+ /// این آیتم
+ /// True
+ /// است
+ ///
+ public IsActive CutContractEndOfYear { get; private set; }
+
+
+
+ public void Edit(string computeOptions, string bonusesOptions, string yearsOptions, bool createContract, bool signContract, bool createCheckout,
+ bool signCheckout, string contractTerm, IsActive cutContractEndOfYear)
+ {
+ ComputeOptions = computeOptions;
+ BonusesOptions = bonusesOptions;
+ YearsOptions = yearsOptions;
+
+ ContractTerm = contractTerm;
+ CutContractEndOfYear = contractTerm == "1" ? IsActive.None : cutContractEndOfYear;
+ SetContractAndCheckoutOptions(createContract, signContract, createCheckout, signCheckout);
+ }
+
+
+
+ private void SetContractAndCheckoutOptions(bool createContract, bool signContract, bool createCheckout,
+ bool signCheckout)
+ {
+ CreateContract = createContract;
+ if (createContract)
+ {
+ SignContract = signContract;
+ CreateCheckout = createCheckout;
+ if (createCheckout)
+ {
+ SignCheckout = signCheckout;
+ }
+ else
+ {
+ SignCheckout = false;
+ }
+ }
+ else
+ {
+ SignContract = false;
+ CreateCheckout = false;
+ SignCheckout = false;
+ }
+ }
+ }
}
+
diff --git a/Company.Domain/InsuranceListAgg/IInsuranceListRepository.cs b/Company.Domain/InsuranceListAgg/IInsuranceListRepository.cs
index d40fca9c..1ff57039 100644
--- a/Company.Domain/InsuranceListAgg/IInsuranceListRepository.cs
+++ b/Company.Domain/InsuranceListAgg/IInsuranceListRepository.cs
@@ -60,4 +60,13 @@ public interface IInsuranceListRepository:IRepository
#region client
List SearchForClient(InsuranceListSearchModel searchModel);
#endregion
-}
\ No newline at end of file
+
+ #region Mahan
+ Task GetInsuranceOperationDetails(long id);
+
+ Task GetTabCounts(InsuranceListSearchModel searchModel);
+
+ #endregion
+}
+
+
diff --git a/Company.Domain/InsuranceListAgg/InsuranceList.cs b/Company.Domain/InsuranceListAgg/InsuranceList.cs
index b0880d7f..3da643cb 100644
--- a/Company.Domain/InsuranceListAgg/InsuranceList.cs
+++ b/Company.Domain/InsuranceListAgg/InsuranceList.cs
@@ -4,7 +4,9 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using _0_Framework.Domain;
+using Company.Domain.InsuranceListAgg.ValueObjects;
using Company.Domain.InsuranceWorkshopAgg;
+using CompanyManagment.App.Contracts.InsuranceList.Enums;
namespace Company.Domain.InsuranceListAgg;
@@ -151,6 +153,21 @@ public class InsuranceList : EntityBase
///
public double SumOfMarriedAllowance { get; private set; }
+ #region Mahan
+ ///
+ /// بازرسی
+ ///
+ public InsuranceListInspection Inspection { get; set; } =new (InsuranceListInspectionType.None,DateTime.MinValue, 0);
+ ///
+ /// بدهی
+ ///
+ public InsuranceListDebt Debt { get; set; } = new(InsuranceListDebtType.None, DateTime.MinValue, 0, 0);
+ ///
+ /// تاییدیه کارفرما
+ ///
+ public InsuranceListEmployerApproval EmployerApproval { get; set; } = new(InsuranceListEmployerApprovalStatus.None, string.Empty);
+ #endregion
+
public List InsuranceListWorkshops { get; set; }
public void Edit(int sumOfEmployees, int sumOfWorkingDays, double sumOfSalaries, double sumOfBenefitsIncluded, double included,
@@ -174,4 +191,22 @@ public class InsuranceList : EntityBase
SumOfDailyWagePlusBaseYears = sumOfDailyWage + sumOfBaseYears;
}
-}
\ No newline at end of file
+
+ public void SetDebt(InsuranceListDebt debt)
+ {
+ Debt = debt;
+ }
+ public void SetInspection(InsuranceListInspection inspection)
+ {
+ Inspection = inspection;
+ }
+ public void SetEmployerApproval(InsuranceListEmployerApproval employerApproval)
+ {
+ EmployerApproval = employerApproval;
+ }
+ public void SetConfirmSentlist(bool confirmSentlist)
+ {
+ ConfirmSentlist = confirmSentlist;
+ }
+
+}
diff --git a/Company.Domain/InsuranceListAgg/ValueObjects/InsuranceListDebt.cs b/Company.Domain/InsuranceListAgg/ValueObjects/InsuranceListDebt.cs
new file mode 100644
index 00000000..1d3b488b
--- /dev/null
+++ b/Company.Domain/InsuranceListAgg/ValueObjects/InsuranceListDebt.cs
@@ -0,0 +1,31 @@
+using System;
+using CompanyManagment.App.Contracts.InsuranceList.Enums;
+
+namespace Company.Domain.InsuranceListAgg.ValueObjects;
+
+public class InsuranceListDebt
+{
+ public InsuranceListDebt(InsuranceListDebtType type, DateTime debtDate, double amount, long mediaId)
+ {
+ Type = type;
+ if (type == InsuranceListDebtType.None)
+ {
+ DebtDate = DateTime.MinValue;
+ Amount = 0;
+ MediaId = 0;
+ }
+ else
+ {
+ DebtDate = debtDate;
+ Amount = amount;
+ MediaId = mediaId;
+ IsDone = true;
+ }
+ }
+
+ public InsuranceListDebtType Type { get; set; }
+ public DateTime DebtDate { get; set; }
+ public double Amount { get; set; }
+ public long MediaId { get; set; }
+ public bool IsDone { get; set; }
+}
\ No newline at end of file
diff --git a/Company.Domain/InsuranceListAgg/ValueObjects/InsuranceListEmployerApproval.cs b/Company.Domain/InsuranceListAgg/ValueObjects/InsuranceListEmployerApproval.cs
new file mode 100644
index 00000000..64a53bf4
--- /dev/null
+++ b/Company.Domain/InsuranceListAgg/ValueObjects/InsuranceListEmployerApproval.cs
@@ -0,0 +1,26 @@
+using System.Security.Cryptography;
+using CompanyManagment.App.Contracts.InsuranceList.Enums;
+
+namespace Company.Domain.InsuranceListAgg.ValueObjects;
+
+public class InsuranceListEmployerApproval
+{
+ public InsuranceListEmployerApproval(InsuranceListEmployerApprovalStatus status, string description)
+ {
+ Status = status;
+ if (status == InsuranceListEmployerApprovalStatus.None)
+ {
+ Description = string.Empty;
+ }
+ else
+ {
+
+ Description = description;
+ IsDone = true;
+ }
+ }
+
+ public InsuranceListEmployerApprovalStatus Status { get; set; }
+ public string Description { get; set; }
+ public bool IsDone { get; set; }
+}
\ No newline at end of file
diff --git a/Company.Domain/InsuranceListAgg/ValueObjects/InsuranceListInspection.cs b/Company.Domain/InsuranceListAgg/ValueObjects/InsuranceListInspection.cs
new file mode 100644
index 00000000..4a1d15dd
--- /dev/null
+++ b/Company.Domain/InsuranceListAgg/ValueObjects/InsuranceListInspection.cs
@@ -0,0 +1,29 @@
+using System;
+using CompanyManagment.App.Contracts.InsuranceList.Enums;
+
+namespace Company.Domain.InsuranceListAgg.ValueObjects;
+
+public class InsuranceListInspection
+{
+ public InsuranceListInspection(InsuranceListInspectionType type, DateTime lastInspectionDateTime, long mediaId)
+ {
+ Type = type;
+ if (type == InsuranceListInspectionType.None)
+ {
+ LastInspectionDateTime = DateTime.MinValue;
+ MediaId = 0;
+ }
+ else
+ {
+ LastInspectionDateTime = lastInspectionDateTime;
+ MediaId = mediaId;
+ IsDone = true;
+ }
+ }
+
+ public InsuranceListInspectionType Type { get; set; }
+ public DateTime LastInspectionDateTime { get; set; }
+ public long MediaId { get; set; }
+ public bool IsDone { get; set; }
+
+}
\ No newline at end of file
diff --git a/Company.Domain/LeftWorkAgg/ILeftWorkRepository.cs b/Company.Domain/LeftWorkAgg/ILeftWorkRepository.cs
index 78c73415..3b0e36e3 100644
--- a/Company.Domain/LeftWorkAgg/ILeftWorkRepository.cs
+++ b/Company.Domain/LeftWorkAgg/ILeftWorkRepository.cs
@@ -5,6 +5,7 @@ using _0_Framework.Application;
using _0_Framework.Domain;
using CompanyManagment.App.Contracts.LeftWork;
using CompanyManagment.App.Contracts.PersonnleCode;
+using CompanyManagment.App.Contracts.Workshop.DTOs;
namespace Company.Domain.LeftWorkAgg;
@@ -46,4 +47,11 @@ public interface ILeftWorkRepository : IRepository
Task GetLastLeftWork(long employeeId, long workshopId);
List SearchCreateContract(LeftWorkSearchModel searchModel);
+
+ ///
+ /// دریافت اطلاعات کارگاه و پرسنل برای ایجاد قرارداد
+ ///
+ ///
+ ///
+ AutoExtensionDto AutoExtentionEmployees(long workshopId);
}
\ No newline at end of file
diff --git a/Company.Domain/WorkshopAgg/Workshop.cs b/Company.Domain/WorkshopAgg/Workshop.cs
index a6246c50..c1a56263 100644
--- a/Company.Domain/WorkshopAgg/Workshop.cs
+++ b/Company.Domain/WorkshopAgg/Workshop.cs
@@ -1,6 +1,7 @@
using System.Collections.Generic;
using System.Globalization;
using System.Security.AccessControl;
+using _0_Framework.Application;
using _0_Framework.Domain;
using Company.Domain.CheckoutAgg;
using Company.Domain.ClientEmployeeWorkshopAgg;
@@ -92,7 +93,7 @@ public class Workshop : EntityBase
string state, string city, string address, string typeOfInsuranceSend, string typeOfContract, string contractTerm,
string agreementNumber, bool fixedSalary, string population,long? insuranceJobId, string zoneName, bool addBonusesPay, bool addYearsPay, bool addLeavePay, bool totalPaymentHide,
bool isClassified, string computeOptions, string bonusesOptions, string yearsOptions, string hasRollCallFreeVip, bool workshopHolidayWorking,
- bool insuranceCheckoutOvertime, bool insuranceCheckoutFamilyAllowance)
+ bool insuranceCheckoutOvertime, bool insuranceCheckoutFamilyAllowance, bool createContract, bool signContract, bool createCheckout, bool signCheckout, IsActive cutContractEndOfYear)
{
WorkshopName = workshopName;
WorkshopSureName = workshopSureName;
@@ -136,7 +137,12 @@ public class Workshop : EntityBase
WorkshopHolidayWorking = workshopHolidayWorking;
InsuranceCheckoutOvertime = insuranceCheckoutOvertime;
InsuranceCheckoutFamilyAllowance = insuranceCheckoutFamilyAllowance;
- }
+ CreateContract = createContract;
+ SignContract = signContract;
+ CreateCheckout = createCheckout;
+ SignCheckout = signCheckout;
+ CutContractEndOfYear = cutContractEndOfYear;
+ }
public string WorkshopName { get; private set; }
@@ -210,6 +216,19 @@ public class Workshop : EntityBase
/// محاسبه حق اولاد در لیست بیمه
///
public bool InsuranceCheckoutFamilyAllowance { get; private set; }
+
+ public bool CreateContract { get; private set; }
+ public bool SignContract { get; private set; }
+ public bool CreateCheckout { get; private set; }
+ public bool SignCheckout { get; private set; }
+
+ ///
+ /// اگر قرارداد بیش از یک ماه باشد و گزینه انتخاب شده منتهی به پایان سال باشد
+ /// این آیتم
+ /// True
+ /// است
+ ///
+ public IsActive CutContractEndOfYear { get; private set; }
//public Employer Employer { get; private set; }
public Workshop()
@@ -243,7 +262,7 @@ public class Workshop : EntityBase
string state, string city, string address, string typeOfInsuranceSend, string typeOfContract, string contractTerm,
string agreementNumber, bool fixedSalary, string population, long? insuranceJobId, string zoneName, bool addBonusesPay, bool addYearsPay, bool addLeavePay,
bool totalPaymentHide, bool isClassified, string computeOptions, string bonusesOptions, string yearsOptions, string hasRollCallFreeVip, bool workshopHolidayWorking,
- bool insuranceCheckoutOvertime, bool insuranceCheckoutFamilyAllowance)
+ bool insuranceCheckoutOvertime, bool insuranceCheckoutFamilyAllowance, bool createContract, bool signContract, bool createCheckout, bool signCheckout, IsActive cutContractEndOfYear)
{
WorkshopName = workshopName;
WorkshopSureName = workshopSureName;
@@ -284,7 +303,12 @@ public class Workshop : EntityBase
WorkshopHolidayWorking = workshopHolidayWorking;
InsuranceCheckoutOvertime = insuranceCheckoutOvertime;
InsuranceCheckoutFamilyAllowance = insuranceCheckoutFamilyAllowance;
- }
+ CreateContract = createContract;
+ SignContract = signContract;
+ CreateCheckout = createCheckout;
+ SignCheckout = signCheckout;
+ CutContractEndOfYear = cutContractEndOfYear;
+ }
public void Active(string archiveCode)
diff --git a/CompanyManagment.App.Contracts/Checkout/CheckoutViewModel.cs b/CompanyManagment.App.Contracts/Checkout/CheckoutViewModel.cs
index 134682a0..2dea371f 100644
--- a/CompanyManagment.App.Contracts/Checkout/CheckoutViewModel.cs
+++ b/CompanyManagment.App.Contracts/Checkout/CheckoutViewModel.cs
@@ -132,7 +132,118 @@ public class CheckoutViewModel
/// مدت مرخصی استحقاقی
///
public string TotalPaidLeave { get; set; }
+
+
+ public bool HasSignCheckout { get; set; }
+
+ public TimeSpan TotalHourlyLeave { get; set; }
public List MonthlyRollCall { get; set; }
public List InstallmentViewModels { get; set; }
public List SalaryAidViewModels { get; set; }
+ public CheckoutRollCallViewModel CheckoutRollCall { get; set; }
+
+}
+
+public class CheckoutRollCallViewModel
+{
+ ///
+ /// مجموع ساعت موظفی
+ ///
+ public TimeSpan TotalMandatoryTimeSpan { get; set; }
+
+ ///
+ /// مجموع ساعت حضور
+ ///
+ public TimeSpan TotalPresentTimeSpan { get; set; }
+
+ ///
+ /// مجموع ساعت استراحت
+ ///
+ public TimeSpan TotalBreakTimeSpan { get; set; }
+
+ ///
+ /// مجموع ساعت کارکرد
+ ///
+ public TimeSpan TotalWorkingTimeSpan { get; set; }
+
+ ///
+ /// مجموع ساعت مرخصی استحقاقی
+ ///
+ public TimeSpan TotalPaidLeaveTmeSpan { get; set; }
+
+ ///
+ /// مجموع ساعت مرخصی استعلاجی
+ ///
+ public TimeSpan TotalSickLeaveTimeSpan { get; set; }
+
+ ///
+ /// روز های حضور غیاب
+ ///
+ public ICollection RollCallDaysCollection { get; set; }
+}
+
+public class CheckoutRollCallDayViewModel
+{
+ public long Id { get; set; }
+
+ ///
+ /// تاریخ
+ ///
+ public DateTime Date { get; set; }
+ ///
+ /// ورود اول
+ ///
+ public string FirstStartDate { get; set; }
+
+ ///
+ /// خروج اول
+ ///
+ public string FirstEndDate { get; set; }
+
+ ///
+ /// ورود دوم
+ ///
+ public string SecondStartDate { get; set; }
+
+ ///
+ /// خروج دوم
+ ///
+ public string SecondEndDate { get; set; }
+
+ ///
+ /// ساعت استراحت
+ ///
+ public TimeSpan BreakTimeSpan { get; set; }
+
+ ///
+ /// مقدار زمان کارکرد
+ ///
+ public TimeSpan WorkingTimeSpan { get; set; }
+
+ ///
+ /// آیا منقطع است؟
+ ///
+ public bool IsSliced { get; set; }
+
+ ///
+ /// آیا غیبت است
+ ///
+ public bool IsAbsent { get; set; }
+
+ ///
+ /// آیا جمعه است
+ ///
+ public bool IsFriday { get; set; }
+
+ ///
+ /// آیا تعطیل رسمی است
+ ///
+ public bool IsHoliday { get; set; }
+
+ ///
+ /// نوع مرخصی - درصورت نداشتن مرخصی مقدارش null میباشد
+ ///
+ public string LeaveType { get; set; }
+
+ public long CheckoutId { get; set; }
}
\ No newline at end of file
diff --git a/CompanyManagment.App.Contracts/Checkout/CreateCheckout.cs b/CompanyManagment.App.Contracts/Checkout/CreateCheckout.cs
index dee0bc11..423d087c 100644
--- a/CompanyManagment.App.Contracts/Checkout/CreateCheckout.cs
+++ b/CompanyManagment.App.Contracts/Checkout/CreateCheckout.cs
@@ -5,6 +5,7 @@ using System.Text;
using System.Threading.Tasks;
using CompanyManagment.App.Contracts.Contract;
using CompanyManagment.App.Contracts.Employee;
+using CompanyManagment.App.Contracts.RollCall;
using CompanyManagment.App.Contracts.YearlySalary;
using Microsoft.AspNetCore.Mvc.Rendering;
@@ -138,4 +139,20 @@ public class CreateCheckout
public string ShiftWork { get; set; }
+ ///
+ /// محاسبه اضافه کار در بیمه
+ ///
+ public bool HasInsuranceChekoutOverTime {get; set; }
+
+
+ public List GroupedRollCalls { get; set; }
+
+ public TimeSpan TotalWorkingTimeSpan { get; set; }
+
+ public TimeSpan TotalBreakTimeSpan { get; set; }
+
+ public TimeSpan TotalPresentTimeSpan { get; set; }
+ public TimeSpan TotalPaidLeave { get; set; }
+ public TimeSpan TotalSickLeave { get; set; }
+
}
\ No newline at end of file
diff --git a/CompanyManagment.App.Contracts/Checkout/CreateCheckoutListViewModel.cs b/CompanyManagment.App.Contracts/Checkout/CreateCheckoutListViewModel.cs
index c0daaa97..1414d918 100644
--- a/CompanyManagment.App.Contracts/Checkout/CreateCheckoutListViewModel.cs
+++ b/CompanyManagment.App.Contracts/Checkout/CreateCheckoutListViewModel.cs
@@ -39,7 +39,11 @@ public class CreateCheckoutListViewModel
public string Description { get; set; }
+ ///
+ /// آیا پرسنل اجازه ایجاد قرارداد دارد
+ ///
+ public bool EmployeeHasCreateCheckout { get; set; }
-
+ public bool HasWorkFlow { get; set; }
public List CreateCheckoutList { get; set; }
}
\ No newline at end of file
diff --git a/CompanyManagment.App.Contracts/Checkout/ICheckoutApplication.cs b/CompanyManagment.App.Contracts/Checkout/ICheckoutApplication.cs
index 40321f83..74f5cccb 100644
--- a/CompanyManagment.App.Contracts/Checkout/ICheckoutApplication.cs
+++ b/CompanyManagment.App.Contracts/Checkout/ICheckoutApplication.cs
@@ -27,6 +27,14 @@ public interface ICheckoutApplication
Task GetContractResultToCreateCheckout(long workshopId, long employeeId, string year,
string month,
string contractStart, string contractEnd);
+ ///
+ /// لیست تصفیه حساب
+ /// جدید
+ ///
+ ///
+ ///
+ ///
+ Task> SearchCheckoutOptimized(CheckoutSearchModel searchModel);
Task> Search(CheckoutSearchModel searchModel);
List SimpleSearch(CheckoutSearchModel searchModel);
List PrintAll(List id);
diff --git a/CompanyManagment.App.Contracts/Contract/ComputingViewModel.cs b/CompanyManagment.App.Contracts/Contract/ComputingViewModel.cs
index 0596d434..0e8ce49c 100644
--- a/CompanyManagment.App.Contracts/Contract/ComputingViewModel.cs
+++ b/CompanyManagment.App.Contracts/Contract/ComputingViewModel.cs
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using CompanyManagment.App.Contracts.Loan;
+using CompanyManagment.App.Contracts.RollCall;
using CompanyManagment.App.Contracts.SalaryAid;
using CompanyManagment.App.Contracts.WorkingHoursTemp;
@@ -45,6 +46,15 @@ public class ComputingViewModel
public bool HasRotatingShift { get; set; }
+ public List GroupedRollCalls { get; set; }
+
+ public TimeSpan TotalWorkingTimeSpan { get; set; }
+
+ public TimeSpan TotalBreakTimeSpan { get; set; }
+
+ public TimeSpan TotalPresentTimeSpan { get; set; }
+ public TimeSpan TotalPaidLeave { get; set; }
+ public TimeSpan TotalSickLeave { get; set; }
//public List holidays;
}
\ No newline at end of file
diff --git a/CompanyManagment.App.Contracts/Contract/ContractViweModel.cs b/CompanyManagment.App.Contracts/Contract/ContractViweModel.cs
index f9d453b4..4e575494 100644
--- a/CompanyManagment.App.Contracts/Contract/ContractViweModel.cs
+++ b/CompanyManagment.App.Contracts/Contract/ContractViweModel.cs
@@ -63,6 +63,10 @@ public class ContractViweModel
public string EmployeeLName { get; set; }
public string IsBlockCantracingParty { get; set; }
+ ///
+ /// آیا مجاز به امضاء قرادا می باشد
+ ///
+ public bool HasSignContract { get; set; }
public IQueryable WorkshopEmployerList { get; set; }
public List Employers { get; set; }
public List Workshops { get; set; }
diff --git a/CompanyManagment.App.Contracts/Employee/CreateEmployeeByClient.cs b/CompanyManagment.App.Contracts/Employee/CreateEmployeeByClient.cs
index 29f9346c..1918c115 100644
--- a/CompanyManagment.App.Contracts/Employee/CreateEmployeeByClient.cs
+++ b/CompanyManagment.App.Contracts/Employee/CreateEmployeeByClient.cs
@@ -28,6 +28,8 @@ public class CreateEmployeeByClient
public List EmployeeDocumentItems { get; set; }
public bool HasEmployeeDocument { get; set; }
public bool HasRollCallService { get; set; }
+ public bool CanceledAuthorize { get; set; }
+ public string BirthDate { get; set; }
}
diff --git a/CompanyManagment.App.Contracts/Employee/EmployeeByNationalCodeInWorkshopViewModel.cs b/CompanyManagment.App.Contracts/Employee/EmployeeByNationalCodeInWorkshopViewModel.cs
index 3e4c10e6..4f6dce73 100644
--- a/CompanyManagment.App.Contracts/Employee/EmployeeByNationalCodeInWorkshopViewModel.cs
+++ b/CompanyManagment.App.Contracts/Employee/EmployeeByNationalCodeInWorkshopViewModel.cs
@@ -17,6 +17,7 @@ public record EmployeeByNationalCodeInWorkshopViewModel
public long PersonnelCode { get; set; }
public List EmployeeBankInfos { get; set; }
public EmployeeByNationalCodeEmployeeDocumentViewModel EmployeeDocument { get; set; }
+ public bool AuthorizedCanceled { get; set; }
}
diff --git a/CompanyManagment.App.Contracts/Employee/EmployeeDataFromApiViewModel.cs b/CompanyManagment.App.Contracts/Employee/EmployeeDataFromApiViewModel.cs
index c28dc277..c6fca7ad 100644
--- a/CompanyManagment.App.Contracts/Employee/EmployeeDataFromApiViewModel.cs
+++ b/CompanyManagment.App.Contracts/Employee/EmployeeDataFromApiViewModel.cs
@@ -26,4 +26,5 @@ public class EmployeeDataFromApiViewModel
///
public string IdNumberSeri { get; set; }
+ public bool AuthorizedCanceled { get; set; }
}
\ No newline at end of file
diff --git a/CompanyManagment.App.Contracts/EmployeeComputeOptions/CreateEmployeeComputeOptions.cs b/CompanyManagment.App.Contracts/EmployeeComputeOptions/CreateEmployeeComputeOptions.cs
index c9e9fa35..a9edb6e2 100644
--- a/CompanyManagment.App.Contracts/EmployeeComputeOptions/CreateEmployeeComputeOptions.cs
+++ b/CompanyManagment.App.Contracts/EmployeeComputeOptions/CreateEmployeeComputeOptions.cs
@@ -1,4 +1,5 @@
-using System;
+using _0_Framework.Application;
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -17,5 +18,35 @@ namespace CompanyManagment.App.Contracts.EmployeeComputeOptions
public string BonusesOptions { get; set; }
//نحوه محاسبه سنوات
public string YearsOptions { get; set; }
+
+ ///
+ /// ایجاد قرارداد
+ ///
+ public bool CreateContract { get; set; }
+ ///
+ /// امضای قرارداد
+ ///
+ public bool SignContract { get; set; }
+ ///
+ /// ایجاد تصفیه
+ ///
+ public bool CreateCheckout { get; set; }
+ ///
+ /// امضای تصفیه
+ ///
+ public bool SignCheckout { get; set; }
+
+ ///
+ /// مدت قرارداد
+ ///
+ public string ContractTerm { get; set; }
+
+ ///
+ /// اگر قرارداد بیش از یک ماه باشد و گزینه انتخاب شده منتهی به پایان سال باشد
+ /// این آیتم
+ /// True
+ /// است
+ ///
+ public IsActive CutContractEndOfYear { get; set; }
}
}
diff --git a/CompanyManagment.App.Contracts/EmployeeComputeOptions/EmployeeComputeOptionsViewModel.cs b/CompanyManagment.App.Contracts/EmployeeComputeOptions/EmployeeComputeOptionsViewModel.cs
index 5a6caa28..78249c6c 100644
--- a/CompanyManagment.App.Contracts/EmployeeComputeOptions/EmployeeComputeOptionsViewModel.cs
+++ b/CompanyManagment.App.Contracts/EmployeeComputeOptions/EmployeeComputeOptionsViewModel.cs
@@ -1,4 +1,6 @@
-namespace CompanyManagment.App.Contracts.EmployeeComputeOptions;
+using _0_Framework.Application;
+
+namespace CompanyManagment.App.Contracts.EmployeeComputeOptions;
public class EmployeeComputeOptionsViewModel
{
@@ -12,4 +14,34 @@ public class EmployeeComputeOptionsViewModel
public string BonusesOptions { get; set; }
//نحوه محاسبه سنوات
public string YearsOptions { get; set; }
+ ///
+ /// ایجاد قرارداد
+ ///
+ public bool CreateContract { get; set; }
+ ///
+ /// امضای قرارداد
+ ///
+ public bool SignContract { get; set; }
+ ///
+ /// ایجاد تصفیه
+ ///
+ public bool CreateCheckout { get; set; }
+ ///
+ /// امضای تصفیه
+ ///
+ public bool SignCheckout { get; set; }
+
+
+ ///
+ /// مدت قرارداد
+ ///
+ public string ContractTerm { get; set; }
+
+ ///
+ /// اگر قرارداد بیش از یک ماه باشد و گزینه انتخاب شده منتهی به پایان سال باشد
+ /// این آیتم
+ /// True
+ /// است
+ ///
+ public IsActive CutContractEndOfYear { get; set; }
}
\ No newline at end of file
diff --git a/CompanyManagment.App.Contracts/InsuranceList/EditInsuranceList.cs b/CompanyManagment.App.Contracts/InsuranceList/EditInsuranceList.cs
index 9a45fa67..93301e98 100644
--- a/CompanyManagment.App.Contracts/InsuranceList/EditInsuranceList.cs
+++ b/CompanyManagment.App.Contracts/InsuranceList/EditInsuranceList.cs
@@ -14,9 +14,6 @@ public class EditInsuranceList:CreateInsuranceList
public bool FixedSalary { get; set; }
public string Population { get; set; }
public long? InsuranceJobId { get; set; }
-
- ///
- /// پرسنل هایی که قرارداد ترک کار کرده اند ولی ترک کار بیمه ندارند
- ///
public List LeftWorkEmployees { get; set; }
+
}
\ No newline at end of file
diff --git a/CompanyManagment.App.Contracts/InsuranceList/EmployeeDetailsForInsuranceListViewModel.cs b/CompanyManagment.App.Contracts/InsuranceList/EmployeeDetailsForInsuranceListViewModel.cs
index 3dcb1c29..66d08800 100644
--- a/CompanyManagment.App.Contracts/InsuranceList/EmployeeDetailsForInsuranceListViewModel.cs
+++ b/CompanyManagment.App.Contracts/InsuranceList/EmployeeDetailsForInsuranceListViewModel.cs
@@ -298,4 +298,6 @@ public class EmployeeDetailsForInsuranceListViewModel
///// DSK_SPOUSE
/////
//public double SumOfMarriedAllowance { get; set; }
+ public string Month { get; set; }
+ public string Year { get; set; }
}
\ No newline at end of file
diff --git a/CompanyManagment.App.Contracts/InsuranceList/Enums/InsuranceListDebtType.cs b/CompanyManagment.App.Contracts/InsuranceList/Enums/InsuranceListDebtType.cs
new file mode 100644
index 00000000..8af13a94
--- /dev/null
+++ b/CompanyManagment.App.Contracts/InsuranceList/Enums/InsuranceListDebtType.cs
@@ -0,0 +1,8 @@
+namespace CompanyManagment.App.Contracts.InsuranceList.Enums;
+
+public enum InsuranceListDebtType
+{
+ None,
+ Old,
+ New
+}
\ No newline at end of file
diff --git a/CompanyManagment.App.Contracts/InsuranceList/Enums/InsuranceListEmployerApprovalStatus.cs b/CompanyManagment.App.Contracts/InsuranceList/Enums/InsuranceListEmployerApprovalStatus.cs
new file mode 100644
index 00000000..cce4e634
--- /dev/null
+++ b/CompanyManagment.App.Contracts/InsuranceList/Enums/InsuranceListEmployerApprovalStatus.cs
@@ -0,0 +1,14 @@
+namespace CompanyManagment.App.Contracts.InsuranceList.Enums;
+
+public enum InsuranceListEmployerApprovalStatus
+{
+ None,
+ ///
+ /// تاییدیه شفاهی (اذنی)
+ ///
+ VerbalApproval,
+ ///
+ /// تاییدیه کاغذی
+ ///
+ WrittenApproval
+}
\ No newline at end of file
diff --git a/CompanyManagment.App.Contracts/InsuranceList/Enums/InsuranceListInspectionType.cs b/CompanyManagment.App.Contracts/InsuranceList/Enums/InsuranceListInspectionType.cs
new file mode 100644
index 00000000..184cb99d
--- /dev/null
+++ b/CompanyManagment.App.Contracts/InsuranceList/Enums/InsuranceListInspectionType.cs
@@ -0,0 +1,8 @@
+namespace CompanyManagment.App.Contracts.InsuranceList.Enums;
+
+public enum InsuranceListInspectionType
+{
+ None,
+ Old,
+ New
+}
\ No newline at end of file
diff --git a/CompanyManagment.App.Contracts/InsuranceList/IInsuranceListApplication.cs b/CompanyManagment.App.Contracts/InsuranceList/IInsuranceListApplication.cs
index 16b954d3..a93637cb 100644
--- a/CompanyManagment.App.Contracts/InsuranceList/IInsuranceListApplication.cs
+++ b/CompanyManagment.App.Contracts/InsuranceList/IInsuranceListApplication.cs
@@ -5,6 +5,7 @@ using System.Text;
using System.Threading.Tasks;
using _0_Framework.Application;
using CompanyManagment.App.Contracts.InsuranceList;
+using Microsoft.AspNetCore.Http;
namespace CompanyManagment.App.Contracts.InsuranceList;
@@ -17,9 +18,9 @@ public interface IInsuranceListApplication
MainEmployeeDetailsViewModel SearchEmployeeForCreateInsuranceList(EmployeeForCreateInsuranceListSearchModel searchModel);
double MarriedAllowance(string maritalStatus, long jobId, bool includedStatus,
- int countWorkingDays, double marriedAlowance, int endMonthCurrentDay);
+ int countWorkingDays, double marriedAlowance, int endMonthCurrentDay);
- OperationResult CreateEmployeeDetailsInfo(EmployeeDetailsForInsuranceListViewModel command);
+ OperationResult CreateEmployeeDetailsInfo(EmployeeDetailsForInsuranceListViewModel command);
OperationResult EditEmployeeDetailsInfo(EmployeeDetailsForInsuranceListViewModel command);
OperationResult Remove(long id);
EditInsuranceList GetDetailsForEdit(long id);
@@ -34,4 +35,16 @@ public interface IInsuranceListApplication
//farokhiChanges
(double basic, int totalYear) BasicYear(long employeeId, long worshopId, DateTime startDate);
double GetMonthlyBaseYear(double dayliBase, int countWorkingDays);
+
+ #region Mahan
+ ///
+ /// مراحل اجرایی برای تکمیل و ارسال لیست بیمه
+ ///
+ ///
+ Task ConfirmInsuranceOperation(InsuranceListConfirmOperation command);
+ Task GetInsuranceOperationDetails(long id);
+
+ Task GetTabCounts(InsuranceListSearchModel searchModel);
+
+ #endregion
}
\ No newline at end of file
diff --git a/CompanyManagment.App.Contracts/InsuranceList/InsuranceListConfirmOperation.cs b/CompanyManagment.App.Contracts/InsuranceList/InsuranceListConfirmOperation.cs
new file mode 100644
index 00000000..a13d7d1b
--- /dev/null
+++ b/CompanyManagment.App.Contracts/InsuranceList/InsuranceListConfirmOperation.cs
@@ -0,0 +1,48 @@
+using CompanyManagment.App.Contracts.InsuranceList.Enums;
+using Microsoft.AspNetCore.Http;
+
+namespace CompanyManagment.App.Contracts.InsuranceList;
+
+public class InsuranceListConfirmOperation
+{
+ public long InsuranceListId { get; set; }
+ ///
+ /// بازرسی
+ ///
+ public CreateInsuranceListInspection Inspection { get; set; }
+ ///
+ /// بدهی
+ ///
+ public CreateInsuranceListDebt Debt { get; set; }
+ ///
+ /// تاییدیه کارفرما
+ ///
+ public CreateInsuranceListApproval Approval { get; set; }
+ public bool ConfirmSentList { get; set; }
+}
+public class CreateInsuranceListApproval
+{
+ public InsuranceListEmployerApprovalStatus ApprovalStatus { get; set; }
+ public string Description { get; set; }
+}
+
+public class CreateInsuranceListDebt
+{
+ public InsuranceListDebtType Type { get; set; }
+ public string DebtDate { get; set; }
+ public string Amount { get; set; }
+ public IFormFile DebtFile { get; set; }
+ public long DebtFileMediaId { get; set; }
+ public string FilePath { get; set; }
+}
+
+public class CreateInsuranceListInspection
+{
+ public InsuranceListInspectionType Type { get; set; }
+ public string LastInspectionDate { get; set; }
+ public IFormFile InspectionFile { get; set; }
+ public long InspectionFileMediaId { get; set; }
+ public string FilePath { get; set; }
+
+
+}
\ No newline at end of file
diff --git a/CompanyManagment.App.Contracts/InsuranceList/InsuranceListSearchModel.cs b/CompanyManagment.App.Contracts/InsuranceList/InsuranceListSearchModel.cs
index 432e79be..45606294 100644
--- a/CompanyManagment.App.Contracts/InsuranceList/InsuranceListSearchModel.cs
+++ b/CompanyManagment.App.Contracts/InsuranceList/InsuranceListSearchModel.cs
@@ -25,4 +25,29 @@ public class InsuranceListSearchModel
public int PageIndex { get; set; }
public bool SearchAll { get; set; }
+
+ public InsuranceListSearchStatus Status { get; set; }
+}
+
+public enum InsuranceListSearchStatus
+{
+ ///
+ /// انجام نشده
+ ///
+ NotStarted = 0,
+
+ ///
+ /// در حال انجام امور
+ ///
+ InProgress = 1,
+
+ ///
+ /// آماده ارسال لیست
+ ///
+ ReadyToSendList = 2,
+
+ ///
+ /// انجام بیمه
+ ///
+ Done = 3
}
\ No newline at end of file
diff --git a/CompanyManagment.App.Contracts/InsuranceList/InsuranceListTabsCountViewModel.cs b/CompanyManagment.App.Contracts/InsuranceList/InsuranceListTabsCountViewModel.cs
new file mode 100644
index 00000000..5764a66b
--- /dev/null
+++ b/CompanyManagment.App.Contracts/InsuranceList/InsuranceListTabsCountViewModel.cs
@@ -0,0 +1,24 @@
+namespace CompanyManagment.App.Contracts.InsuranceList;
+
+public class InsuranceListTabsCountViewModel
+{
+ ///
+ /// انجام نشده
+ ///
+ public int NotStarted { get; set; }
+
+ ///
+ /// در حال انجام امور
+ ///
+ public int InProgress { get; set; }
+
+ ///
+ /// آماده ارسال لیست
+ ///
+ public int ReadyToSendList { get; set; }
+
+ ///
+ /// انجام بیمه
+ ///
+ public int Done { get; set; }
+}
\ No newline at end of file
diff --git a/CompanyManagment.App.Contracts/InsuranceList/InsuranceListViewModel.cs b/CompanyManagment.App.Contracts/InsuranceList/InsuranceListViewModel.cs
index 604d89b4..4a31820e 100644
--- a/CompanyManagment.App.Contracts/InsuranceList/InsuranceListViewModel.cs
+++ b/CompanyManagment.App.Contracts/InsuranceList/InsuranceListViewModel.cs
@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
+using CompanyManagment.App.Contracts.InsuranceList.Enums;
namespace CompanyManagment.App.Contracts.InsuranceList;
@@ -27,4 +28,16 @@ public class InsuranceListViewModel
public long WorkShopId { get; set; }
public string IsBlockCantracingParty { get; set; }
public long EmployerId { get; set; }
+
+ /// وضعیت بازرسی
+ public bool InspectionDone { get; set; }
+ /// وضعیت بدهی
+ public bool DebtDone { get; set; }
+ /// تاییدیه کارفرما
+ public bool EmployerApproved { get; set; }
+
+ ///
+ /// نوع تاییدیه کارفرما
+ ///
+ public InsuranceListEmployerApprovalStatus EmployerApprovalStatus { get; set; }
}
\ No newline at end of file
diff --git a/CompanyManagment.App.Contracts/LeftWork/ILeftWorkApplication.cs b/CompanyManagment.App.Contracts/LeftWork/ILeftWorkApplication.cs
index 8e5a19b6..349884bd 100644
--- a/CompanyManagment.App.Contracts/LeftWork/ILeftWorkApplication.cs
+++ b/CompanyManagment.App.Contracts/LeftWork/ILeftWorkApplication.cs
@@ -5,6 +5,7 @@ using System.Text;
using System.Threading.Tasks;
using _0_Framework.Application;
using CompanyManagment.App.Contracts.PersonnleCode;
+using CompanyManagment.App.Contracts.Workshop.DTOs;
using Microsoft.AspNetCore.Mvc;
namespace CompanyManagment.App.Contracts.LeftWork;
@@ -30,4 +31,10 @@ public interface ILeftWorkApplication
OperationResult CreateLeftWorkByLeftWorkGroups(string employeeFullName, long commandEmployeeId, List commandPersonnelCode, List leftWorkGroups);
OperationResult CheckDeleteLeftWork(long workshopId, long employeeId, string date, int type);
OperationResult CheckEditLeftWork(long workshopId, long employeeId, string date, int type);
+ ///
+ /// دریافت اطلاعات کارگاه و پرسنل برای ایجاد قرارداد
+ ///
+ ///
+ ///
+ AutoExtensionDto AutoExtentionEmployees(long workshopId);
}
\ No newline at end of file
diff --git a/CompanyManagment.App.Contracts/RollCall/ShiftList.cs b/CompanyManagment.App.Contracts/RollCall/ShiftList.cs
index e405366e..0cf64861 100644
--- a/CompanyManagment.App.Contracts/RollCall/ShiftList.cs
+++ b/CompanyManagment.App.Contracts/RollCall/ShiftList.cs
@@ -6,10 +6,12 @@ public class ShiftList
{
public DateTime Start { get; set; }
public DateTime End { get; set; }
- ///
- /// تاخیر در ورود (مدت زمانی که کارمند با تأخیر وارد شده است)
- ///
- public TimeSpan LateEntryDuration { get; set; }
+
+ public DateTime EndWithOutResTime { get; set; }
+ ///
+ /// تاخیر در ورود (مدت زمانی که کارمند با تأخیر وارد شده است)
+ ///
+ public TimeSpan LateEntryDuration { get; set; }
///
/// تعجیل در ورود (مدت زمانی که کارمند زودتر از زمان مشخص وارد شده است)
diff --git a/CompanyManagment.App.Contracts/Workshop/ConnectedPersonnelViewModel.cs b/CompanyManagment.App.Contracts/Workshop/ConnectedPersonnelViewModel.cs
index 8830cd2d..eb6baebf 100644
--- a/CompanyManagment.App.Contracts/Workshop/ConnectedPersonnelViewModel.cs
+++ b/CompanyManagment.App.Contracts/Workshop/ConnectedPersonnelViewModel.cs
@@ -1,4 +1,5 @@
-using System;
+using _0_Framework.Application;
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -26,4 +27,34 @@ public class ConnectedPersonnelViewModel
public string BonusesOptions { get; set; }
//نحوه محاسبه سنوات
public string YearsOptions { get; set; }
+
+ ///
+ /// ایجاد قرارداد
+ ///
+ public bool CreateContract { get; set; }
+ ///
+ /// امضای قرارداد
+ ///
+ public bool SignContract { get; set; }
+ ///
+ /// ایجاد تصفیه
+ ///
+ public bool CreateCheckout { get; set; }
+ ///
+ /// امضای تصفیه
+ ///
+ public bool SignCheckout { get; set; }
+
+ ///
+ /// مدت قرارداد
+ ///
+ public string ContractTerm { get; set; }
+
+ ///
+ /// اگر قرارداد بیش از یک ماه باشد و گزینه انتخاب شده منتهی به پایان سال باشد
+ /// این آیتم
+ /// True
+ /// است
+ ///
+ public IsActive CutContractEndOfYear { get; set; }
}
\ No newline at end of file
diff --git a/CompanyManagment.App.Contracts/Workshop/CreateWorkshop.cs b/CompanyManagment.App.Contracts/Workshop/CreateWorkshop.cs
index cd0d05b0..5ade90d9 100644
--- a/CompanyManagment.App.Contracts/Workshop/CreateWorkshop.cs
+++ b/CompanyManagment.App.Contracts/Workshop/CreateWorkshop.cs
@@ -1,5 +1,6 @@
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
+using _0_Framework.Application;
using AccountManagement.Application.Contracts.Account;
using CompanyManagment.App.Contracts.Employer;
using CompanyManagment.App.Contracts.InsuranceJob;
@@ -116,4 +117,29 @@ public class CreateWorkshop
///
public bool InsuranceCheckoutFamilyAllowance { get; set; }
+ ///
+ /// ایجاد قرارداد
+ ///
+ public bool CreateContract { get; set; }
+ ///
+ /// امضاء قراداد
+ ///
+ public bool SignContract { get; set; }
+ ///
+ /// ایجات تصفیه حساب
+ ///
+ public bool CreateCheckout { get; set; }
+ ///
+ /// امضاء تصفیه حساب
+ ///
+ public bool SignCheckout { get; set; }
+
+ ///
+ /// اگر قرارداد بیش از یک ماه باشد و گزینه انتخاب شده منتهی به پایان سال باشد
+ /// این آیتم
+ /// True
+ /// است
+ ///
+ public IsActive CutContractEndOfYear { get; set; }
+
}
\ No newline at end of file
diff --git a/CompanyManagment.App.Contracts/Workshop/DTOs/AutoExtensionDto.cs b/CompanyManagment.App.Contracts/Workshop/DTOs/AutoExtensionDto.cs
new file mode 100644
index 00000000..48b93965
--- /dev/null
+++ b/CompanyManagment.App.Contracts/Workshop/DTOs/AutoExtensionDto.cs
@@ -0,0 +1,64 @@
+using System.Collections.Generic;
+using Microsoft.AspNetCore.Mvc.Rendering;
+
+namespace CompanyManagment.App.Contracts.Workshop.DTOs;
+
+public class AutoExtensionDto
+{
+ ///
+ /// نام کارگاه
+ ///
+ public string WorkshopName { get; set; }
+
+ ///
+ /// آیا کارفرما خطای اطلاعات هویتی دارد
+ ///
+ public bool EmployerWarning { get; set; }
+
+ ///
+ /// پیام خطاهای کارفرما
+ ///
+ public string EmployerWarningMessage { get; set; }
+
+ ///
+ /// آیا کارگاه پرسنل دارد
+ ///
+ public bool HavingPersonel { get; set; }
+
+ ///
+ /// آی دی کارگاه
+ ///
+ public long WorkshopId { get; set; }
+
+ ///
+ /// کد بایگانی کارگاه
+ ///
+ public string ArchiveCode { get; set; }
+ ///
+ /// آدرس کارگاه
+ ///
+ public string WAddress1 { get; set; }
+
+ ///
+ /// آی دی کارفرما
+ ///
+ public long EmployerId { get; set; }
+
+ ///
+ /// سلکت لیست پرسنل
+ ///
+ public SelectList EmployeeSelectList { get; set; }
+
+ ///
+ /// لیست پرسنل
+ ///
+ public List EmployeeList { get; set; }
+
+ ///
+ /// آیا مجاز به ایجاد قراداد است؟
+ ///
+ public bool CreateContract { get; set; }
+
+
+
+}
\ No newline at end of file
diff --git a/CompanyManagment.App.Contracts/Workshop/DTOs/AutoExtensionEmployeeListDto.cs b/CompanyManagment.App.Contracts/Workshop/DTOs/AutoExtensionEmployeeListDto.cs
new file mode 100644
index 00000000..f92c4330
--- /dev/null
+++ b/CompanyManagment.App.Contracts/Workshop/DTOs/AutoExtensionEmployeeListDto.cs
@@ -0,0 +1,38 @@
+namespace CompanyManagment.App.Contracts.Workshop.DTOs;
+
+public class AutoExtensionEmployeeListDto
+{
+ ///
+ /// آی دی پرسنل
+ ///
+ public long EmployeeId { get; set; }
+ ///
+ /// نام کامل پرسنل
+ ///
+ public string EmployeeName { get; set; }
+
+ ///
+ /// کد پرسنلی
+ ///
+ public long PersonnelCode { get; set; }
+
+ ///
+ /// سمت
+ ///
+ public string JobType { get; set; }
+
+ ///
+ /// آی دی شغل
+ ///
+ public long JobTypeId { get; set; }
+
+ ///
+ /// آیا پرسنل اجازه ایجاد قرارداد دارد
+ ///
+ public bool EmployeeHasCreateContract { get; set; }
+
+
+ public string ContarctStart { get; set; }
+ public string ContractEnd { get; set; }
+
+}
\ No newline at end of file
diff --git a/CompanyManagment.App.Contracts/Workshop/WorkshopViewModel.cs b/CompanyManagment.App.Contracts/Workshop/WorkshopViewModel.cs
index 83ae5e48..434fedcd 100644
--- a/CompanyManagment.App.Contracts/Workshop/WorkshopViewModel.cs
+++ b/CompanyManagment.App.Contracts/Workshop/WorkshopViewModel.cs
@@ -1,4 +1,5 @@
using System.Collections.Generic;
+using _0_Framework.Application;
using CompanyManagment.App.Contracts.Employee;
using CompanyManagment.App.Contracts.Employer;
using CompanyManagment.App.Contracts.LeftWork;
@@ -80,5 +81,31 @@ public class WorkshopViewModel
public string HasRollCallFreeVip { get; set; }
- #endregion
+ #endregion
+
+
+ ///
+ /// ایجاد قرارداد
+ ///
+ public bool CreateContract { get; set; }
+ ///
+ /// امضاء قراداد
+ ///
+ public bool SignContract { get; set; }
+ ///
+ /// ایجات تصفیه حساب
+ ///
+ public bool CreateCheckout { get; set; }
+ ///
+ /// امضاء تصفیه حساب
+ ///
+ public bool SignCheckout { get; set; }
+
+ ///
+ /// اگر قرارداد بیش از یک ماه باشد و گزینه انتخاب شده منتهی به پایان سال باشد
+ /// این آیتم
+ /// True
+ /// است
+ ///
+ public IsActive CutContractEndOfYear { get; set; }
}
\ No newline at end of file
diff --git a/CompanyManagment.App.Contracts/YearlySalary/IYearlySalaryApplication.cs b/CompanyManagment.App.Contracts/YearlySalary/IYearlySalaryApplication.cs
index d068375a..42e5b33e 100644
--- a/CompanyManagment.App.Contracts/YearlySalary/IYearlySalaryApplication.cs
+++ b/CompanyManagment.App.Contracts/YearlySalary/IYearlySalaryApplication.cs
@@ -25,4 +25,5 @@ public interface IYearlySalaryApplication
InsuranceYearlySalaryModel GetInsuranceItems(DateTime startDate, DateTime endDate, string year);
#endregion
+
}
\ No newline at end of file
diff --git a/CompanyManagment.Application/AndroidApkVersionApplication.cs b/CompanyManagment.Application/AndroidApkVersionApplication.cs
index e201ca52..ac41133c 100644
--- a/CompanyManagment.Application/AndroidApkVersionApplication.cs
+++ b/CompanyManagment.Application/AndroidApkVersionApplication.cs
@@ -48,9 +48,9 @@ public class AndroidApkVersionApplication : IAndroidApkVersionApplication
Directory.CreateDirectory(path);
- var apk = new ApkReader.ApkReader().Read(file.OpenReadStream());
+ //var apk = new ApkReader.ApkReader().Read(file.OpenReadStream());
- string uniqueFileName = $"{Path.GetFileNameWithoutExtension(file.FileName)}.v{apk.VersionName}{Path.GetExtension(file.FileName)}";
+ string uniqueFileName = $"{Path.GetFileNameWithoutExtension(file.FileName)}{Path.GetExtension(file.FileName)}";
string filepath = Path.Combine(path, uniqueFileName);
@@ -60,7 +60,7 @@ public class AndroidApkVersionApplication : IAndroidApkVersionApplication
await file.CopyToAsync(stream);
}
- var entity = new AndroidApkVersion(apk.VersionName, apk.VersionCode, IsActive.True, filepath);
+ var entity = new AndroidApkVersion("0", "0", IsActive.True, filepath);
_androidApkVersionRepository.Create(entity);
_androidApkVersionRepository.SaveChanges();
return op.Succcedded();
diff --git a/CompanyManagment.Application/BankApplication.cs b/CompanyManagment.Application/BankApplication.cs
index 7dabda37..d4c0a44d 100644
--- a/CompanyManagment.Application/BankApplication.cs
+++ b/CompanyManagment.Application/BankApplication.cs
@@ -55,7 +55,7 @@ namespace CompanyManagment.Application
if(command.BankLogoPictureFile != null && command.BankLogoPictureFile.Length >0 )
{
var uploadResult = _mediaApplication.UploadFile(command.BankLogoPictureFile, command.BankName,
- _basePath, 10, [".jpg", ".jpeg", ".png",".svg"]);
+ _basePath, 10, [".jpg", ".jpeg", ".png",".svg"], "Bank");
if (uploadResult.IsSuccedded == false)
return uploadResult;
mediaId = uploadResult.SendId;
@@ -81,7 +81,7 @@ namespace CompanyManagment.Application
if (command.BankLogoPictureFile != null && command.BankLogoPictureFile.Length > 0)
{
var uploadResult = _mediaApplication.UploadFile(command.BankLogoPictureFile, command.BankName,
- _basePath, 10, [".jpg", ".jpeg", ".png",".svg"]);
+ _basePath, 10, [".jpg", ".jpeg", ".png",".svg"], "Bank");
if (uploadResult.IsSuccedded == false)
return uploadResult;
_mediaApplication.DeleteFile(entity.BankLogoMediaId);
diff --git a/CompanyManagment.Application/CheckoutApplication.cs b/CompanyManagment.Application/CheckoutApplication.cs
index b7778cf3..7f6e34a5 100644
--- a/CompanyManagment.Application/CheckoutApplication.cs
+++ b/CompanyManagment.Application/CheckoutApplication.cs
@@ -14,267 +14,415 @@ using CompanyManagment.App.Contracts.Checkout;
using CompanyManagment.App.Contracts.PersonalContractingParty;
using CompanyManagment.App.Contracts.Leave;
using CompanyManagment.App.Contracts.MandantoryHours;
+using _0_Framework.Domain.CustomizeCheckoutShared.ValueObjects;
+using Company.Domain.EmployeeAgg;
+using CompanyManagment.App.Contracts.HolidayItem;
+using CompanyManagment.App.Contracts.RollCall;
+using CompanyManagment.EFCore.Migrations;
+using CompanyManagment.EFCore.Repository;
+using System.Globalization;
+using Company.Domain.LeaveAgg;
+using Company.Domain.WorkshopAgg;
namespace CompanyManagment.Application;
public class CheckoutApplication : ICheckoutApplication
{
- private readonly ICheckoutRepository _checkoutRepository;
- private readonly IYearlySalaryRepository _yearlySalaryRepository;
- private readonly ILeftWorkRepository _leftWorkRepository;
- private readonly IEmployerRepository _employerRepository;
- private readonly IPersonalContractingPartyApp _contractingPartyApp;
- private readonly ILeaveApplication _leaveApplication;
- private readonly IMandatoryHoursApplication _mandatoryHoursApplication;
- private readonly IRollCallMandatoryRepository _rollCallMandatoryRepository;
+ private readonly ICheckoutRepository _checkoutRepository;
+ private readonly IYearlySalaryRepository _yearlySalaryRepository;
+ private readonly ILeftWorkRepository _leftWorkRepository;
+ private readonly IEmployerRepository _employerRepository;
+ private readonly IPersonalContractingPartyApp _contractingPartyApp;
+ private readonly ILeaveApplication _leaveApplication;
+ private readonly IMandatoryHoursApplication _mandatoryHoursApplication;
+ private readonly IRollCallMandatoryRepository _rollCallMandatoryRepository;
+ private readonly IRollCallRepository _rollCallRepository;
+ private readonly IHolidayItemApplication _holidayItemApplication;
- public CheckoutApplication(ICheckoutRepository checkoutRepository, IYearlySalaryRepository yearlySalaryRepository,
- ILeftWorkRepository leftWorkRepository,
- IEmployerRepository employerRepository, IPersonalContractingPartyApp contractingPartyApp, ILeaveApplication leaveApplication, IMandatoryHoursApplication mandatoryHoursApplication, IRollCallMandatoryRepository rollCallMandatoryRepository)
- {
- _checkoutRepository = checkoutRepository;
- _yearlySalaryRepository = yearlySalaryRepository;
- _leftWorkRepository = leftWorkRepository;
- _employerRepository = employerRepository;
- _contractingPartyApp = contractingPartyApp;
- _leaveApplication = leaveApplication;
- _mandatoryHoursApplication = mandatoryHoursApplication;
- _rollCallMandatoryRepository = rollCallMandatoryRepository;
- }
+ public CheckoutApplication(ICheckoutRepository checkoutRepository, IYearlySalaryRepository yearlySalaryRepository,
+ ILeftWorkRepository leftWorkRepository,
+ IEmployerRepository employerRepository, IPersonalContractingPartyApp contractingPartyApp, ILeaveApplication leaveApplication, IMandatoryHoursApplication mandatoryHoursApplication, IRollCallMandatoryRepository rollCallMandatoryRepository, IRollCallRepository rollCallRepository, IHolidayItemApplication holidayItemApplication)
+ {
+ _checkoutRepository = checkoutRepository;
+ _yearlySalaryRepository = yearlySalaryRepository;
+ _leftWorkRepository = leftWorkRepository;
+ _employerRepository = employerRepository;
+ _contractingPartyApp = contractingPartyApp;
+ _leaveApplication = leaveApplication;
+ _mandatoryHoursApplication = mandatoryHoursApplication;
+ _rollCallMandatoryRepository = rollCallMandatoryRepository;
+ _rollCallRepository = rollCallRepository;
+ _holidayItemApplication = holidayItemApplication;
+ }
- [SuppressMessage("ReSharper.DPA", "DPA0007: Large number of DB records", MessageId = "count: 241")]
- public void Create(CreateCheckout command)
- {
- var operation = new OperationResult();
- var syear = Convert.ToInt32(command.ContractStart.Substring(0, 4));
- var smonth = Convert.ToInt32(command.ContractStart.Substring(5, 2));
- string month = string.Empty;
- switch (smonth)
- {
- case 1:
- month = "فروردین";
- break;
- case 2:
- month = "اردیبهشت";
- break;
- case 3:
- month = "خرداد";
- break;
- case 4:
- month = "تیر";
- break;
- case 5:
- month = "مرداد";
- break;
- case 6:
- month = "شهریور";
- break;
- case 7:
- month = "مهر";
- break;
- case 8:
- month = "آبان";
- break;
- case 9:
- month = "آذر";
- break;
- case 10:
- month = "دی";
- break;
- case 11:
- month = "بهمن";
- break;
- case 12:
- month = "اسفند";
- break;
- }
- var year = syear.ToString();
+ [SuppressMessage("ReSharper.DPA", "DPA0007: Large number of DB records", MessageId = "count: 241")]
+ public void Create(CreateCheckout command)
+ {
+ var operation = new OperationResult();
+ var syear = Convert.ToInt32(command.ContractStart.Substring(0, 4));
+ var smonth = Convert.ToInt32(command.ContractStart.Substring(5, 2));
+ string month = string.Empty;
+ switch (smonth)
+ {
+ case 1:
+ month = "فروردین";
+ break;
+ case 2:
+ month = "اردیبهشت";
+ break;
+ case 3:
+ month = "خرداد";
+ break;
+ case 4:
+ month = "تیر";
+ break;
+ case 5:
+ month = "مرداد";
+ break;
+ case 6:
+ month = "شهریور";
+ break;
+ case 7:
+ month = "مهر";
+ break;
+ case 8:
+ month = "آبان";
+ break;
+ case 9:
+ month = "آذر";
+ break;
+ case 10:
+ month = "دی";
+ break;
+ case 11:
+ month = "بهمن";
+ break;
+ case 12:
+ month = "اسفند";
+ break;
+ }
+ var year = syear.ToString();
- #region SickLeav
+ #region SickLeav
- //var serachModel = new LeaveSearchModel()
- //{
- // EmployeeId = command.EmployeeId,
- // WorkshopId = command.WorkshopId,
- // LeaveType = "استعلاجی",
- // StartLeave = command.ContractStart,
- // EndLeave = command.ContractEnd,
- // IsAccepted = true,
- //};
- //var leavList = _leaveApplication.search(serachModel);
- // int sickLeaveCount = 0;
- //if (leavList.Count > 0)
- //{
+ //var serachModel = new LeaveSearchModel()
+ //{
+ // EmployeeId = command.EmployeeId,
+ // WorkshopId = command.WorkshopId,
+ // LeaveType = "استعلاجی",
+ // StartLeave = command.ContractStart,
+ // EndLeave = command.ContractEnd,
+ // IsAccepted = true,
+ //};
+ //var leavList = _leaveApplication.search(serachModel);
+ // int sickLeaveCount = 0;
+ //if (leavList.Count > 0)
+ //{
- // foreach (var leave in leavList)
- // {
- // if (leave.StartLeaveGr < command.ContractStartGr && leave.EndLeaveGr <= command.ContractEndGr)
- // {
- // int res = (int)((leave.EndLeaveGr - command.ContractStartGr).TotalDays +1);
- // sickLeaveCount += res;
- // }
- // else if (leave.StartLeaveGr >= command.ContractStartGr && leave.EndLeaveGr > command.ContractEndGr)
- // {
- // int res = (int)((command.ContractEndGr - leave.StartLeaveGr).TotalDays + 1);
- // sickLeaveCount += res;
- // }
- // else
- // {
- // int res = (int)((leave.EndLeaveGr - leave.StartLeaveGr).TotalDays + 1);
- // sickLeaveCount += res;
- // }
+ // foreach (var leave in leavList)
+ // {
+ // if (leave.StartLeaveGr < command.ContractStartGr && leave.EndLeaveGr <= command.ContractEndGr)
+ // {
+ // int res = (int)((leave.EndLeaveGr - command.ContractStartGr).TotalDays +1);
+ // sickLeaveCount += res;
+ // }
+ // else if (leave.StartLeaveGr >= command.ContractStartGr && leave.EndLeaveGr > command.ContractEndGr)
+ // {
+ // int res = (int)((command.ContractEndGr - leave.StartLeaveGr).TotalDays + 1);
+ // sickLeaveCount += res;
+ // }
+ // else
+ // {
+ // int res = (int)((leave.EndLeaveGr - leave.StartLeaveGr).TotalDays + 1);
+ // sickLeaveCount += res;
+ // }
- // }
- //}
+ // }
+ //}
+
+ #endregion
+
+ var dayliWage = command.DayliWage.MoneyToDouble();
+ // کمک هزینه اقلام
+ var consumableItem = command.ConsumableItems.MoneyToDouble();
+ //حق اولاد
+ var familyAllowance = command.FamilyAllowance.MoneyToDouble();
+ //کمک هزینه مسکن
+ 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 bunos = command.BonusesPay;
+ //پایه سنوات
+ var bacicYears = MontlyYearsBunos.BasicYears;
+ var sumOfWorkingDays = MontlyYearsBunos.SumOfWorkingDay;
+ if (command.friday > 0)
+ {
+ var fridayPercent = dayliWage * 40 / 100;
+ //فوق العاده جمعه کاری
+ command.FridayPay = fridayPercent * command.friday;
+ }
+ //حق بیمه سهم کارگر
+ #region InsuranceDeduction
+
+ var insuranceOverTime = command.HasInsuranceChekoutOverTime ? command.OvertimePay : 0;
+ var insuranceDeduction = (monthlyWage + bacicYears + consumableItem + housingAllowance + marriedAllowance + insuranceOverTime) * 7 / 100;
#endregion
- var dayliWage = command.DayliWage.MoneyToDouble();
- // کمک هزینه اقلام
- var consumableItem = command.ConsumableItems.MoneyToDouble();
- //حق اولاد
- var familyAllowance = command.FamilyAllowance.MoneyToDouble();
- //کمک هزینه مسکن
- 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 bunos = command.BonusesPay;
- //پایه سنوات
- var bacicYears = MontlyYearsBunos.BasicYears;
- var sumOfWorkingDays = MontlyYearsBunos.SumOfWorkingDay;
- if (command.friday > 0)
- {
- var fridayPercent = dayliWage * 40 / 100;
- //فوق العاده جمعه کاری
- command.FridayPay = fridayPercent * command.friday;
- }
- //حق بیمه سهم کارگر
- var insuranceDeduction = (monthlyWage + bacicYears + consumableItem + housingAllowance + marriedAllowance) * 7 / 100;
if (command.OvertimePay > 0 && command.AbsenceDeduction > 0)
- {
- if (command.AbsenceDeduction >= command.OvertimePay)
- {
- command.AbsenceDeduction = command.AbsenceDeduction - command.OvertimePay;
- command.OvertimePay = 0;
- }
- else
- {
- command.OvertimePay = command.OvertimePay - command.AbsenceDeduction;
- command.AbsenceDeduction = 0;
- }
+ {
+ if (command.AbsenceDeduction >= command.OvertimePay)
+ {
+ command.AbsenceDeduction = command.AbsenceDeduction - command.OvertimePay;
+ command.OvertimePay = 0;
+ }
+ else
+ {
+ command.OvertimePay = command.OvertimePay - command.AbsenceDeduction;
+ command.AbsenceDeduction = 0;
+ }
- }
- var checkoutStart = $"{command.Year}/{command.Month}/01";
- var checkoutEnd = checkoutStart.FindeEndOfMonth();
- var salaryAids =
- _rollCallMandatoryRepository.SalaryAidsForCheckout(command.EmployeeId, command.WorkshopId, checkoutStart.ToGeorgianDateTime(), checkoutEnd.ToGeorgianDateTime())
- .Select(x => new CheckoutSalaryAid(x.Amount, x.SalaryAidDateTimeGe, x.SalaryAidDateTimeFa, x.CalculationDateTimeGe, x.CalculationDateTimeFa, x.Id)).ToList();
+ }
+ var checkoutStart = $"{command.Year}/{command.Month}/01";
+ var checkoutEnd = checkoutStart.FindeEndOfMonth();
+ var salaryAids =
+ _rollCallMandatoryRepository.SalaryAidsForCheckout(command.EmployeeId, command.WorkshopId, checkoutStart.ToGeorgianDateTime(), checkoutEnd.ToGeorgianDateTime())
+ .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());
+ 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();
+ 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.InstallmentDeduction = loanInstallments.Sum(x => x.AmountForMonth.MoneyToDouble());
+ command.InstallmentDeduction = loanInstallments.Sum(x => x.AmountForMonth.MoneyToDouble());
- var totalClaimsDouble = monthlyWage + bacicYears + consumableItem + housingAllowance + marriedAllowance + command.OvertimePay +
- command.NightworkPay + familyAllowance + bunos + years + command.LeavePay + command.FridayPay + command.ShiftPay;
- var totalClaims = totalClaimsDouble.ToMoney();
- var totalDeductionDouble = insuranceDeduction + command.AbsenceDeduction + command.InstallmentDeduction + command.SalaryAidDeduction;
- var totalDeductions = totalDeductionDouble.ToMoney();
- var totalPayment = totalClaimsDouble - totalDeductionDouble;
+
- if (_checkoutRepository.Exists(x =>
- x.Month == command.Month && x.Year == command.Year && x.ContractNo == command.ContractNo))
- {
- operation.Failed("امکان ثبت رکورد تکراری وجود ندارد");
- }
- else
- {
- if (string.IsNullOrWhiteSpace(command.Signature))
- {
- command.Signature = "0";
- }
+ var firstDayOfMonth = $"{command.ContractStart.Substring(0, 8)}01".ToGeorgianDateTime();
+ var firstDayOfCurrentMonth = new DateTime(syear, smonth, 1, new PersianCalendar());
+
+ LeaveSearchModel sickLeaveSearch = new LeaveSearchModel()
+ {
+ EmployeeId = command.EmployeeId,
+ WorkshopId = command.WorkshopId,
+ StartLeaveGr = command.ContractStartGr,
+ EndLeaveGr = command.ContractEndGr,
+ IsAccepted = true,
+ };
+ var leaves = _leaveApplication.search(sickLeaveSearch);
+
+ firstDayOfMonth.AddMonthsFa(1, out var lastDayOfCurrentMonth);
+
+ lastDayOfCurrentMonth = lastDayOfCurrentMonth.AddDays(-1);
+
+ int dateRange = (int)(lastDayOfCurrentMonth - firstDayOfCurrentMonth).TotalDays + 1;
+
+ var holidays = _holidayItemApplication.Search(new HolidayItemSearchModel()
+ {
+ HolidayYear = command.ContractStartGr.ToFarsiYear()
+ });
+ //all the dates from start to end, to be compared with present days to get absent dates
+ var completeDaysList = Enumerable.Range(0, dateRange).Select(offset => firstDayOfCurrentMonth.AddDays(offset).Date).ToList();
+
+ var absentRecords = completeDaysList
+ .ExceptBy(command.GroupedRollCalls.Select(x => x.CreationDate.Date), y => y.Date)
+ .Select(x =>
+ {
+ var leave = leaves.FirstOrDefault(y =>
+ y.EmployeeId == command.EmployeeId && y.EndLeaveGr.Date >= x.Date && y.StartLeaveGr.Date <= x.Date);
+ var isHoliday = holidays.Any(y => y.HolidaydateGr == x.Date);
+ var isFriday = x.Date.DayOfWeek == DayOfWeek.Friday;
+ var isNormalWorkingDay = isHoliday == false && isFriday == false;
+ return new CheckoutDailyRollCallViewModel()
+ {
+ StartDate1 = null,
+ EndDate1 = null,
+ DateTimeGr = x.Date,
+ DayOfWeek = x.Date.DayOfWeek.ToString(),
+ RollCallDateFa = x.Date.ToFarsi(),
+ LeaveType = leave != null ? leave.LeaveType : "",
+ IsAbsent = leave == null && isNormalWorkingDay
+ };
+ });
+
+ var presentDays = command.GroupedRollCalls.Select(x =>
+ {
+
+ var orderedRollcalls = x.ShiftList.OrderBy(y => y.Start);
+
+ var rollCallTimeSpanPerDay = x.SumOneDaySpan;
+ TimeSpan breakTimePerDay = x.BreakTime;
+
+ return new CheckoutDailyRollCallViewModel()
+ {
+ StartDate1 = orderedRollcalls.FirstOrDefault().Start.ToString("HH:mm"),
+ EndDate1 = orderedRollcalls.FirstOrDefault().EndWithOutResTime.ToString("HH:mm"),
+
+ StartDate2 = orderedRollcalls.Skip(1).FirstOrDefault()?.Start.ToString("HH:mm") ?? "",
+ EndDate2 = orderedRollcalls.Skip(1).FirstOrDefault()?.EndWithOutResTime.ToString("HH:mm") ?? "",
+
+ TotalhourseSpan = rollCallTimeSpanPerDay,
+
+ BreakTimeTimeSpan = breakTimePerDay,
+
+ DayOfWeek = x.CreationDate.DayOfWeek.DayOfWeeKToPersian(),
+ RollCallDateFa = x.CreationDate.Date.ToFarsi(),
+ DateTimeGr = x.CreationDate.Date,
+ IsSliced = x.ShiftList.Count() > 2,
+ IsAbsent = false
+ };
+ });
+
+
+ presentDays = presentDays.Select(x => new CheckoutDailyRollCallViewModel
+ {
+ StartDate1 = x.StartDate1,
+ EndDate1 = x.EndDate1,
+ EndDate2 = x.EndDate2,
+ StartDate2 = x.StartDate2,
+ TotalWorkingHours = $"{(int)(x.TotalhourseSpan.TotalHours)}:{x.TotalhourseSpan.Minutes:00}",
+ BreakTimeString = $"{(int)(x.BreakTimeTimeSpan.TotalHours)}:{x.BreakTimeTimeSpan.Minutes:00}",
+ TotalhourseSpan = x.TotalhourseSpan,
+ BreakTimeTimeSpan = x.BreakTimeTimeSpan,
+ DayOfWeek = x.DayOfWeek,
+ RollCallDateFa = x.RollCallDateFa,
+ DateTimeGr = x.DateTimeGr,
+ IsSliced = x.IsSliced,
+ IsAbsent = false
+ });
+
+ var result = presentDays.Concat(absentRecords).OrderBy(x => x.DateTimeGr).ToList();
+ result.ForEach(x =>
+ {
+ x.IsHoliday = holidays.Any(y => x.DateTimeGr.Date == y.HolidaydateGr.Date);
+ x.IsFriday = x.DateTimeGr.DayOfWeek == DayOfWeek.Friday;
+ });
+
+ var checkoutRollCallDays = result.Select(x => new CheckoutRollCallDay(x.DateTimeGr,
+ x.StartDate1, x.EndDate1, x.StartDate2, x.EndDate2,
+ x.BreakTimeTimeSpan, x.IsSliced, x.TotalhourseSpan, x.IsAbsent, x.IsFriday, x.IsHoliday, x.LeaveType))
+ .ToList();
+
+
+ double mandatoryHours = _mandatoryHoursApplication.GetMandatoryHoursByYearAndMonth(syear, smonth);
+ int mandatoryWholeHours = (int)mandatoryHours;
+ int mandatoryMinutes = (int)((mandatoryHours - mandatoryWholeHours) * 60);
+
+ var totalMandatoryHours = TimeSpan.FromHours(mandatoryWholeHours).Add(TimeSpan.FromMinutes(mandatoryMinutes));
+ var checkoutRollCall = new CheckoutRollCall(totalMandatoryHours, command.TotalPresentTimeSpan, command.TotalBreakTimeSpan,
+ command.TotalWorkingTimeSpan, command.TotalPaidLeave, command.TotalSickLeave, checkoutRollCallDays);
- var checkout = new Checkout(command.EmployeeFullName, command.FathersName, command.NationalCode
- , command.DateOfBirth, command.EmployeeId, command.WorkshopName, command.WorkshopId, command.ContractNo, command.ContractStartGr, command.ContractEndGr, month, year,
- command.ContractId, command.WorkingHoursId, monthlyWage, bacicYears, consumableItem, housingAllowance
- , command.OvertimePay, command.NightworkPay, command.FridayPay, 0, command.ShiftPay, familyAllowance, bunos, years, command.LeavePay, insuranceDeduction, 0, command.InstallmentDeduction, command.SalaryAidDeduction, command.AbsenceDeduction, sumOfWorkingDays,
- command.ArchiveCode, command.PersonnelCode, totalClaims, totalDeductions, totalPayment, command.Signature, marriedAllowance, command.LeaveCheckout, command.CreditLeaves, command.AbsencePeriod, command.AverageHoursPerDay, command.HasRollCall, command.OverTimeWorkValue, command.OverNightWorkValue
- , command.FridayWorkValue, command.RotatingShiftValue, command.AbsenceValue, command.TotalDayOfLeaveCompute, command.TotalDayOfYearsCompute, command.TotalDayOfBunosesCompute, loanInstallments, salaryAids);
- _checkoutRepository.CreateCkeckout(checkout).GetAwaiter().GetResult();
- //_checkoutRepository.SaveChanges();
- //var employeeFullName = new SqlParameter("@EmployeeFullName", SqlDbType.NVarChar, 50);
- //employeeFullName.Value = command.EmployeeFullName;
- //var fathersName = new SqlParameter("@FathersName", SqlDbType.NVarChar, 20);
- //fathersName.Value = command.EmployeeFullName;
+ var totalClaimsDouble = monthlyWage + bacicYears + consumableItem + housingAllowance + marriedAllowance + command.OvertimePay +
+ command.NightworkPay + familyAllowance + bunos + years + command.LeavePay + command.FridayPay + command.ShiftPay;
+ var totalClaims = totalClaimsDouble.ToMoney();
+ var totalDeductionDouble = insuranceDeduction + command.AbsenceDeduction + command.InstallmentDeduction + command.SalaryAidDeduction;
+ var totalDeductions = totalDeductionDouble.ToMoney();
+ var totalPayment = totalClaimsDouble - totalDeductionDouble;
- }
+ if (_checkoutRepository.Exists(x =>
+ x.Month == command.Month && x.Year == command.Year && x.ContractNo == command.ContractNo))
+ {
+ operation.Failed("امکان ثبت رکورد تکراری وجود ندارد");
+ }
+ else
+ {
+ if (string.IsNullOrWhiteSpace(command.Signature))
+ {
+ command.Signature = "0";
+ }
- }
- public OperationResult Edit(EditCheckout command)
+ var checkout = new Checkout(command.EmployeeFullName, command.FathersName, command.NationalCode
+ , command.DateOfBirth, command.EmployeeId, command.WorkshopName, command.WorkshopId, command.ContractNo, command.ContractStartGr, command.ContractEndGr, month, year,
+ command.ContractId, command.WorkingHoursId, monthlyWage, bacicYears, consumableItem, housingAllowance
+ , command.OvertimePay, command.NightworkPay, command.FridayPay, 0, command.ShiftPay, familyAllowance, bunos, years, command.LeavePay, insuranceDeduction, 0, command.InstallmentDeduction, command.SalaryAidDeduction, command.AbsenceDeduction, sumOfWorkingDays,
+ command.ArchiveCode, command.PersonnelCode, totalClaims, totalDeductions, totalPayment, command.Signature, marriedAllowance, command.LeaveCheckout, command.CreditLeaves, command.AbsencePeriod, command.AverageHoursPerDay, command.HasRollCall, command.OverTimeWorkValue, command.OverNightWorkValue
+ , command.FridayWorkValue, command.RotatingShiftValue, command.AbsenceValue, command.TotalDayOfLeaveCompute, command.TotalDayOfYearsCompute, command.TotalDayOfBunosesCompute,
+ loanInstallments, salaryAids,checkoutRollCall);
+
+ _checkoutRepository.CreateCkeckout(checkout).GetAwaiter().GetResult();
+ //_checkoutRepository.SaveChanges();
+
+ //var employeeFullName = new SqlParameter("@EmployeeFullName", SqlDbType.NVarChar, 50);
+ //employeeFullName.Value = command.EmployeeFullName;
+ //var fathersName = new SqlParameter("@FathersName", SqlDbType.NVarChar, 20);
+ //fathersName.Value = command.EmployeeFullName;
+
+ }
+
+
+ }
+
+ public OperationResult Edit(EditCheckout command)
+ {
+ throw new NotImplementedException();
+ }
+
+ public EditCheckout GetDetails(long id)
+ {
+ return _checkoutRepository.GetDetails(id);
+ }
+
+ public async Task GetContractResultToCreateCheckout(long workshopId, long employeeId, string year, string month,
+ string contractStart, string contractEnd)
+ {
+ return await _checkoutRepository.GetContractResultToCreateCheckout(workshopId, employeeId, year, month, contractStart,
+ contractEnd);
+
+ }
+
+ public Task> SearchCheckoutOptimized(CheckoutSearchModel searchModel)
{
- throw new NotImplementedException();
+ return _checkoutRepository.SearchCheckoutOptimized(searchModel);
}
- public EditCheckout GetDetails(long id)
- {
- return _checkoutRepository.GetDetails(id);
- }
-
- public async Task GetContractResultToCreateCheckout(long workshopId, long employeeId, string year, string month,
- string contractStart, string contractEnd)
- {
- return await _checkoutRepository.GetContractResultToCreateCheckout(workshopId, employeeId, year, month, contractStart,
- contractEnd);
-
- }
public async Task> Search(CheckoutSearchModel searchModel)
{
+ var watch = System.Diagnostics.Stopwatch.StartNew();
+ watch.Start();
var result = new List();
- var query = await _checkoutRepository.SearchForMainCheckout(searchModel);
- query = query.Select(x => new CheckoutViewModel()
- {
- Id = x.Id,
- EmployeeFullName = x.EmployeeFullName,
- ContractStart = x.ContractStart,
- ContractEnd = x.ContractEnd,
- ContractStartGr = x.ContractStartGr,
- ContractEndGr = x.ContractEndGr,
- PersonnelCode = x.PersonnelCode,
- PersonnelCodeInt = x.PersonnelCodeInt,
- ArchiveCode = x.ArchiveCode,
- SumOfWorkingDays = x.SumOfWorkingDays,
- WorkshopName = x.WorkshopName,
- Month = x.Month,
- Year = x.Year,
- ContractNo = x.ContractNo,
- ContractId = x.ContractId,
- WorkshopId = x.WorkshopId,
- EmployeeId = x.EmployeeId,
- IsActiveString = x.IsActiveString,
- Signature = x.Signature,
- CreationDate = x.CreationDate,
- EmployerName = _employerRepository.GetEmployerByWorkshopId(x.WorkshopId).FirstOrDefault()?.EmployerFullName,
- IsBlockCantracingParty = _employerRepository.GetEmployerByWorkshopId(x.WorkshopId).FirstOrDefault()?.IsBlockContractingParty,
- }).ToList();
+ var query = await _checkoutRepository.SearchForMainCheckout(searchModel);
+ query = query.Select(x => new CheckoutViewModel()
+ {
+ Id = x.Id,
+ EmployeeFullName = x.EmployeeFullName,
+ ContractStart = x.ContractStart,
+ ContractEnd = x.ContractEnd,
+ ContractStartGr = x.ContractStartGr,
+ ContractEndGr = x.ContractEndGr,
+ PersonnelCode = x.PersonnelCode,
+ PersonnelCodeInt = x.PersonnelCodeInt,
+ ArchiveCode = x.ArchiveCode,
+ SumOfWorkingDays = x.SumOfWorkingDays,
+ WorkshopName = x.WorkshopName,
+ Month = x.Month,
+ Year = x.Year,
+ ContractNo = x.ContractNo,
+ ContractId = x.ContractId,
+ WorkshopId = x.WorkshopId,
+ EmployeeId = x.EmployeeId,
+ IsActiveString = x.IsActiveString,
+ Signature = x.Signature,
+ CreationDate = x.CreationDate,
+ EmployerName = _employerRepository.GetEmployerByWorkshopId(x.WorkshopId).FirstOrDefault()?.EmployerFullName,
+ IsBlockCantracingParty = _employerRepository.GetEmployerByWorkshopId(x.WorkshopId).FirstOrDefault()?.IsBlockContractingParty,
+ }).ToList();
//foreach (var items in query)
//{
// var s = _employerRepository.GetEmployerByWorkshopId(items.WorkshopId);
@@ -289,220 +437,241 @@ public class CheckoutApplication : ICheckoutApplication
// // = employerName;
//}
-
+ Console.WriteLine("old : " + watch.Elapsed);
return query;
- }
+ }
- public List SimpleSearch(CheckoutSearchModel searchModel)
- {
- return _checkoutRepository.SimpleSearch(searchModel);
- }
+ public List SimpleSearch(CheckoutSearchModel searchModel)
+ {
+ return _checkoutRepository.SimpleSearch(searchModel);
+ }
- public List PrintAll(List id)
- {
- var result = _checkoutRepository.PrintAll(id);
- var oneRecord = result.FirstOrDefault();
- if (oneRecord == null)
- return new();
- result.ForEach(x =>
- {
+ public List PrintAll(List id)
+ {
+ var result = _checkoutRepository.PrintAll(id);
+ var oneRecord = result.FirstOrDefault();
+ if (oneRecord == null)
+ return new();
+ result.ForEach(x =>
+ {
- int yearFa;
- int monthFa;
- try
- {
- yearFa = int.Parse(oneRecord.Year);
- monthFa = oneRecord.Month.ToMonthByStringValue();
- }
- catch (Exception e)
- {
- return;
- }
- double mandatoryHours = _mandatoryHoursApplication.GetMandatoryHoursByYearAndMonth(yearFa, monthFa);
- int mandatoryWholeHours = (int)mandatoryHours;
- int mandatoryMinutes = (int)((mandatoryHours - mandatoryWholeHours) * 60);
- var totalWorking = new TimeSpan(x.MonthlyRollCall.Sum(y => y.TotalhourseSpan.Ticks));
- var totalBreakTime = new TimeSpan(x.MonthlyRollCall.Sum(y => y.BreakTimeTimeSpan.Ticks));
- var totalPresent = totalWorking + totalBreakTime;
- x.TotalWorkingTimeStr = Tools.ToFarsiHoursAndMinutes((int)totalWorking.TotalHours, totalWorking.Minutes, "-");
- x.TotalBreakTimeStr = Tools.ToFarsiHoursAndMinutes((int)totalBreakTime.TotalHours, totalBreakTime.Minutes, "-");
- x.TotalPresentTimeStr = Tools.ToFarsiHoursAndMinutes((int)totalPresent.TotalHours, totalPresent.Minutes, "-");
- x.TotalMandatoryTimeStr = Tools.ToFarsiHoursAndMinutes(mandatoryWholeHours, mandatoryMinutes, "-");
+ int yearFa;
+ int monthFa;
+ try
+ {
+ yearFa = int.Parse(oneRecord.Year);
+ monthFa = oneRecord.Month.ToMonthByStringValue();
+ }
+ catch (Exception e)
+ {
+ return;
+ }
+ double mandatoryHours = _mandatoryHoursApplication.GetMandatoryHoursByYearAndMonth(yearFa, monthFa);
+ int mandatoryWholeHours = (int)mandatoryHours;
+ int mandatoryMinutes = (int)((mandatoryHours - mandatoryWholeHours) * 60);
+ var totalWorking = new TimeSpan(x.MonthlyRollCall.Sum(y => y.TotalhourseSpan.Ticks));
+ var totalBreakTime = new TimeSpan(x.MonthlyRollCall.Sum(y => y.BreakTimeTimeSpan.Ticks));
+ TimeSpan totalPresent = totalWorking + totalBreakTime;
+ if (x.CheckoutRollCall == null)
+ {
+ if (x.HasRollCall)
+ {
+ totalWorking = new TimeSpan(x.MonthlyRollCall.Sum(x => x.TotalhourseSpan.Ticks)) -
+ x.TotalHourlyLeave;
+ totalBreakTime = new TimeSpan(x.MonthlyRollCall.Sum(x => x.BreakTimeTimeSpan.Ticks));
+ totalPresent = totalWorking + totalBreakTime;
+ }
+ else
+ {
+ totalBreakTime = new TimeSpan(x.MonthlyRollCall.Sum(x => x.BreakTimeTimeSpan.Ticks));
+ totalPresent = new TimeSpan(x.MonthlyRollCall.Sum(x => x.TotalhourseSpan.Ticks));
+ totalWorking = totalPresent - totalBreakTime;
+ }
- });
- return result;
- }
+ x.TotalWorkingTimeStr =
+ Tools.ToFarsiHoursAndMinutes((int)totalWorking.TotalHours, totalWorking.Minutes, "-");
+ x.TotalBreakTimeStr =
+ Tools.ToFarsiHoursAndMinutes((int)totalBreakTime.TotalHours, totalBreakTime.Minutes, "-");
+ x.TotalPresentTimeStr =
+ Tools.ToFarsiHoursAndMinutes((int)totalPresent.TotalHours, totalPresent.Minutes, "-");
+ x.TotalMandatoryTimeStr = Tools.ToFarsiHoursAndMinutes(mandatoryWholeHours, mandatoryMinutes, "-");
+ }
+ });
+
+ return result;
+ }
- public CheckoutViewModel PrintOne(long id)
- {
- var result = _checkoutRepository.PrintOne(id);
+ public CheckoutViewModel PrintOne(long id)
+ {
+ var result = _checkoutRepository.PrintOne(id);
- int yearFa;
- int monthFa;
- try
- {
- yearFa = int.Parse(result.Year);
- monthFa = result.Month.ToMonthByStringValue();
- }
- catch (Exception e)
- {
- return new();
- }
- double mandatoryHours = _mandatoryHoursApplication.GetMandatoryHoursByYearAndMonth(yearFa, monthFa);
- int mandatoryWholeHours = (int)mandatoryHours;
- int mandatoryMinutes = (int)((mandatoryHours - mandatoryWholeHours) * 60);
- TimeSpan totalWorking;
- TimeSpan totalBreakTime;
- TimeSpan totalPresent;
- if (result.HasRollCall)
- {
- totalWorking = new TimeSpan(result.MonthlyRollCall.Sum(x => x.TotalhourseSpan.Ticks));
- totalBreakTime = new TimeSpan(result.MonthlyRollCall.Sum(x => x.BreakTimeTimeSpan.Ticks));
- totalPresent = totalWorking + totalBreakTime;
- }
- else
- {
- totalBreakTime = new TimeSpan(result.MonthlyRollCall.Sum(x => x.BreakTimeTimeSpan.Ticks));
- totalPresent = new TimeSpan(result.MonthlyRollCall.Sum(x => x.TotalhourseSpan.Ticks));
- totalWorking = totalPresent - totalBreakTime;
- }
+ int yearFa;
+ int monthFa;
+ try
+ {
+ yearFa = int.Parse(result.Year);
+ monthFa = result.Month.ToMonthByStringValue();
+ }
+ catch (Exception e)
+ {
+ return new();
+ }
+ double mandatoryHours = _mandatoryHoursApplication.GetMandatoryHoursByYearAndMonth(yearFa, monthFa);
+ int mandatoryWholeHours = (int)mandatoryHours;
+ int mandatoryMinutes = (int)((mandatoryHours - mandatoryWholeHours) * 60);
+ TimeSpan totalWorking;
+ TimeSpan totalBreakTime;
+ TimeSpan totalPresent;
+ TimeSpan totalHoursLeave;
+ if (result.HasRollCall)
+ {
+ totalWorking = new TimeSpan(result.MonthlyRollCall.Sum(x => x.TotalhourseSpan.Ticks)) - result.TotalHourlyLeave;
+ totalBreakTime = new TimeSpan(result.MonthlyRollCall.Sum(x => x.BreakTimeTimeSpan.Ticks));
+ totalPresent = totalWorking + totalBreakTime;
+ }
+ else
+ {
+ totalBreakTime = new TimeSpan(result.MonthlyRollCall.Sum(x => x.BreakTimeTimeSpan.Ticks));
+ totalPresent = new TimeSpan(result.MonthlyRollCall.Sum(x => x.TotalhourseSpan.Ticks));
+ totalWorking = totalPresent - totalBreakTime;
+ }
- result.TotalWorkingTimeStr = Tools.ToFarsiHoursAndMinutes((int)totalWorking.TotalHours, totalWorking.Minutes, "-");
- result.TotalBreakTimeStr = Tools.ToFarsiHoursAndMinutes((int)totalBreakTime.TotalHours, totalBreakTime.Minutes, "-");
- result.TotalPresentTimeStr = Tools.ToFarsiHoursAndMinutes((int)totalPresent.TotalHours, totalPresent.Minutes, "-");
- result.TotalMandatoryTimeStr = Tools.ToFarsiHoursAndMinutes(mandatoryWholeHours, mandatoryMinutes, "-");
+ result.TotalWorkingTimeStr = Tools.ToFarsiHoursAndMinutes((int)totalWorking.TotalHours, totalWorking.Minutes, "-");
+ result.TotalBreakTimeStr = Tools.ToFarsiHoursAndMinutes((int)totalBreakTime.TotalHours, totalBreakTime.Minutes, "-");
+ result.TotalPresentTimeStr = Tools.ToFarsiHoursAndMinutes((int)totalPresent.TotalHours, totalPresent.Minutes, "-");
+ result.TotalMandatoryTimeStr = Tools.ToFarsiHoursAndMinutes(mandatoryWholeHours, mandatoryMinutes, "-");
- return result;
- }
+ return result;
+ }
- public CheckoutLeavePrintViewModel LeavePrint(long id)
- {
- return _checkoutRepository.PrintLeave(id);
- }
+ public CheckoutLeavePrintViewModel LeavePrint(long id)
+ {
+ return _checkoutRepository.PrintLeave(id);
+ }
- public OperationResult Sign(long id)
- {
- var opration = new OperationResult();
- var contract = _checkoutRepository.Get(id);
- if (contract == null)
- return opration.Failed("رکورد مورد نظر یافت نشد");
+ public OperationResult Sign(long id)
+ {
+ var opration = new OperationResult();
+ var contract = _checkoutRepository.Get(id);
+ if (contract == null)
+ return opration.Failed("رکورد مورد نظر یافت نشد");
- contract.Sign();
+ contract.Sign();
- _checkoutRepository.SaveChanges();
- opration.IsSuccedded = true;
- return opration.Succcedded();
- }
+ _checkoutRepository.SaveChanges();
+ opration.IsSuccedded = true;
+ return opration.Succcedded();
+ }
- public OperationResult UnSign(long id)
- {
- var opration = new OperationResult();
- var contract = _checkoutRepository.Get(id);
- if (contract == null)
- return opration.Failed("رکورد مورد نظر یافت نشد");
+ public OperationResult UnSign(long id)
+ {
+ var opration = new OperationResult();
+ var contract = _checkoutRepository.Get(id);
+ if (contract == null)
+ return opration.Failed("رکورد مورد نظر یافت نشد");
- contract.UnSign();
+ contract.UnSign();
- _checkoutRepository.SaveChanges();
- opration.IsSuccedded = true;
- return opration.Succcedded();
- }
+ _checkoutRepository.SaveChanges();
+ opration.IsSuccedded = true;
+ return opration.Succcedded();
+ }
- public OperationResult Active(long id)
- {
- var opration = new OperationResult();
- var contract = _checkoutRepository.Get(id);
- if (contract == null)
- return opration.Failed("رکورد مورد نظر یافت نشد");
+ public OperationResult Active(long id)
+ {
+ var opration = new OperationResult();
+ var contract = _checkoutRepository.Get(id);
+ if (contract == null)
+ return opration.Failed("رکورد مورد نظر یافت نشد");
- contract.Active();
+ contract.Active();
- _checkoutRepository.SaveChanges();
- return opration.Succcedded();
- }
+ _checkoutRepository.SaveChanges();
+ return opration.Succcedded();
+ }
- public OperationResult DeActive(long id)
- {
- var opration = new OperationResult();
- var contract = _checkoutRepository.Get(id);
- if (contract == null)
- return opration.Failed("رکورد مورد نظر یافت نشد");
+ public OperationResult DeActive(long id)
+ {
+ var opration = new OperationResult();
+ var contract = _checkoutRepository.Get(id);
+ if (contract == null)
+ return opration.Failed("رکورد مورد نظر یافت نشد");
- contract.DeActive();
+ contract.DeActive();
- _checkoutRepository.SaveChanges();
+ _checkoutRepository.SaveChanges();
- return opration.Succcedded();
- }
+ return opration.Succcedded();
+ }
- public OperationResult RemoveCheckout(long id)
- {
- return _checkoutRepository.RemoveCheckout(id);
- }
+ public OperationResult RemoveCheckout(long id)
+ {
+ return _checkoutRepository.RemoveCheckout(id);
+ }
- public OperationResult CustomSet(long id, double rewardPay, double salaryAidDeduction)
- {
- var opration = new OperationResult();
- var checkout = _checkoutRepository.Get(id);
- var totalClaimsDouble = checkout.TotalClaims.MoneyToDouble();
- var totalDeductionsDouble = checkout.TotalDeductions.MoneyToDouble();
- totalClaimsDouble = (double)(totalClaimsDouble - checkout.RewardPay);
- totalDeductionsDouble = totalDeductionsDouble - checkout.SalaryAidDeduction;
+ public OperationResult CustomSet(long id, double rewardPay, double salaryAidDeduction)
+ {
+ var opration = new OperationResult();
+ var checkout = _checkoutRepository.Get(id);
+ var totalClaimsDouble = checkout.TotalClaims.MoneyToDouble();
+ var totalDeductionsDouble = checkout.TotalDeductions.MoneyToDouble();
+ totalClaimsDouble = (double)(totalClaimsDouble - checkout.RewardPay);
+ totalDeductionsDouble = totalDeductionsDouble - checkout.SalaryAidDeduction;
- var totalClaims = totalClaimsDouble + rewardPay;
- var totalDeductions = totalDeductionsDouble + salaryAidDeduction;
+ var totalClaims = totalClaimsDouble + rewardPay;
+ var totalDeductions = totalDeductionsDouble + salaryAidDeduction;
- var totalClaimsString = totalClaims.ToMoney();
- var totalDeductionsString = totalDeductions.ToMoney();
- var totalPayment = totalClaims - totalDeductions;
+ var totalClaimsString = totalClaims.ToMoney();
+ var totalDeductionsString = totalDeductions.ToMoney();
+ var totalPayment = totalClaims - totalDeductions;
- checkout.CustomSet(rewardPay, salaryAidDeduction, totalClaimsString, totalDeductionsString, totalPayment);
+ checkout.CustomSet(rewardPay, salaryAidDeduction, totalClaimsString, totalDeductionsString, totalPayment);
- _checkoutRepository.SaveChanges();
- opration.IsSuccedded = true;
- return opration.Succcedded();
- }
+ _checkoutRepository.SaveChanges();
+ opration.IsSuccedded = true;
+ return opration.Succcedded();
+ }
- #region Client
+ #region Client
- public List SearchForClient(CheckoutSearchModel searchModel)
- {
- return _checkoutRepository.SearchForClient(searchModel);
- }
+ public List SearchForClient(CheckoutSearchModel searchModel)
+ {
+ return _checkoutRepository.SearchForClient(searchModel);
+ }
- #endregion
- #region NewChangeByHeydari
- public List CheckHasSignature(List ids)
- {
- return _checkoutRepository.CheckHasSignature(ids);
- }
- public OperationResult DeleteAllCheckouts(List ids)
- {
- return _checkoutRepository.DeleteAllCheckouts(ids);
- }
- public OperationResult DeleteCheckout(long id)
- {
- return _checkoutRepository.DeleteCheckout(id);
- }
- public async Task> SearchForMainCheckout(CheckoutSearchModel searchModel)
- {
- return await _checkoutRepository.SearchForMainCheckout(searchModel);
- }
- #endregion
- #region Pooya
+ #endregion
+ #region NewChangeByHeydari
+ public List CheckHasSignature(List ids)
+ {
+ return _checkoutRepository.CheckHasSignature(ids);
+ }
+ public OperationResult DeleteAllCheckouts(List ids)
+ {
+ return _checkoutRepository.DeleteAllCheckouts(ids);
+ }
+ public OperationResult DeleteCheckout(long id)
+ {
+ return _checkoutRepository.DeleteCheckout(id);
+ }
+ public async Task> SearchForMainCheckout(CheckoutSearchModel searchModel)
+ {
+ return await _checkoutRepository.SearchForMainCheckout(searchModel);
+ }
+ #endregion
+ #region Pooya
- public List<(long EmployeeId, DateTime CheckoutStart, DateTime CheckoutEnd)> GetLastCheckoutsByWorkshopIdForWorkFlow(long workshopId, DateTime start, DateTime end)
- {
- return _checkoutRepository.GetLastCheckoutsByWorkshopIdForWorkFlow(workshopId, start, end);
- }
+ public List<(long EmployeeId, DateTime CheckoutStart, DateTime CheckoutEnd)> GetLastCheckoutsByWorkshopIdForWorkFlow(long workshopId, DateTime start, DateTime end)
+ {
+ return _checkoutRepository.GetLastCheckoutsByWorkshopIdForWorkFlow(workshopId, start, end);
+ }
- #endregion
+ #endregion
}
\ No newline at end of file
diff --git a/CompanyManagment.Application/ContractApplication.cs b/CompanyManagment.Application/ContractApplication.cs
index 8bcc1c80..4d670a54 100644
--- a/CompanyManagment.Application/ContractApplication.cs
+++ b/CompanyManagment.Application/ContractApplication.cs
@@ -12,6 +12,7 @@ using Company.Domain.YearlySalaryAgg;
using Company.Domain.YearlySalaryItemsAgg;
using CompanyManagment.App.Contracts.Contract;
using CompanyManagment.App.Contracts.Employee;
+using CompanyManagment.App.Contracts.EmployeeComputeOptions;
using CompanyManagment.App.Contracts.Employer;
using CompanyManagment.App.Contracts.LeftWork;
using CompanyManagment.App.Contracts.PersonalContractingParty;
@@ -39,6 +40,7 @@ public class ContractApplication : IContractApplication
private readonly IPersonnelCodeRepository _personnelCodeRepository;
private readonly IWorkingHoursTempApplication _workingHoursTempApplication;
private readonly IPersonalContractingPartyApp _contractingPartyApp;
+ private readonly IEmployeeComputeOptionsApplication _employeeComputeOptionsApplication;
public List EmpList;
@@ -54,7 +56,7 @@ public class ContractApplication : IContractApplication
IYearlySalaryRepository yearlySalaryRepository,
IYearlySalaryItemRepository yearlySalaryItemRepository
, IEmployeeApplication employeeApplication, IEmployerApplication employerApplication, IWorkshopApplication workshopApplication, IEmployerRepository employerRepository,
- IWorkingHoursApplication workingHoursApplication, IWorkingHoursItemsApplication workingHoursItemsApplication, ILeftWorkRepository leftWorkRepository, IPersonnelCodeRepository personnelCodeRepository, IWorkingHoursTempApplication workingHoursTempApplication, IPersonalContractingPartyApp contractingPartyApp)
+ IWorkingHoursApplication workingHoursApplication, IWorkingHoursItemsApplication workingHoursItemsApplication, ILeftWorkRepository leftWorkRepository, IPersonnelCodeRepository personnelCodeRepository, IWorkingHoursTempApplication workingHoursTempApplication, IPersonalContractingPartyApp contractingPartyApp, IEmployeeComputeOptionsApplication employeeComputeOptionsApplication)
{
_contractRepository = contractRepository;
_holidayItemRepository = holidayItemRepository;
@@ -70,6 +72,7 @@ public class ContractApplication : IContractApplication
_personnelCodeRepository = personnelCodeRepository;
_workingHoursTempApplication = workingHoursTempApplication;
_contractingPartyApp = contractingPartyApp;
+ _employeeComputeOptionsApplication = employeeComputeOptionsApplication;
//_leftWorkApplication = leftWorkApplication;
}
@@ -3155,7 +3158,7 @@ public class ContractApplication : IContractApplication
EmployeeFName = x.EmployeeFName,
EmployeeLName = x.EmployeeLName,
IsBlockCantracingParty = _contractingPartyApp.IsBlockByEmployerId(x.EmployerId),
-
+ HasSignContract = _employeeComputeOptionsApplication.GetEmployeeOptions(x.WorkshopIds,x.EmployeeId).SignContract
}).ToList();
diff --git a/CompanyManagment.Application/EmployeeAplication.cs b/CompanyManagment.Application/EmployeeAplication.cs
index 7201bbac..5842c8eb 100644
--- a/CompanyManagment.Application/EmployeeAplication.cs
+++ b/CompanyManagment.Application/EmployeeAplication.cs
@@ -197,6 +197,7 @@ public class EmployeeAplication : RepositoryBase, IEmployeeAppli
return opration.Failed("کد ملی وارد شده تکراری است");
}
}
+
@@ -995,10 +996,24 @@ public class EmployeeAplication : RepositoryBase, IEmployeeAppli
//{
// return op.Failed("این پرسنل قبلا افزوده شده است و در انتظار تایید میباشد");
//}
+
var employee = _EmployeeRepository.GetByNationalCodeIgnoreQueryFilter(command.NationalCode);
+
var workshop = _WorkShopRepository.GetDetails(command.WorkshopId);
- if (employee == null)
+
+ if (employee == null && command.CanceledAuthorize)
+ {
+ var birthDate = command.BirthDate.ToGeorgianDateTime();
+ var dateOfIssue = new DateTime(1922, 1, 1);
+
+ employee = new Employee(command.FirstName, command.LastName, null, birthDate,
+ dateOfIssue, null, command.NationalCode, null, command.Gender, "ایرانی", null, null);
+ _EmployeeRepository.Create(employee);
+ _EmployeeRepository.SaveChanges();
+
+ }
+ if (employee == null)
{
return op.Failed("خطای سیستمی. لطفا دوباره تلاش کنید . درصورت تکرار این مشکل با تیم پشتیبان تماس بگیرید");
}
@@ -1241,6 +1256,11 @@ public class EmployeeAplication : RepositoryBase, IEmployeeAppli
if (employee == null)
{
var personalInfo = await _uidService.GetPersonalInfo(nationalCode, birthDate);
+
+ if (personalInfo.ResponseContext.Status.Code == 14)
+ {
+ return op.Failed("سامانه احراز هویت در دسترس نمیباشد لطفا اطلاعات پرسنل را به صورت دستی وارد کنید",new EmployeeByNationalCodeInWorkshopViewModel(){AuthorizedCanceled = true});
+ }
if (personalInfo.ResponseContext.Status.Code != 0)
{
return op.Failed("کد ملی و تاریخ تولد با هم همخانی ندارند");
@@ -1539,7 +1559,11 @@ public class EmployeeAplication : RepositoryBase, IEmployeeAppli
if (employee.IsAuthorized == false)
{
var apiResult = await _uidService.GetPersonalInfo(nationalCode, birthDate);
+ if (apiResult.ResponseContext.Status.Code == 14)
+ {
+ return op.Failed("این پرسنل در بانک اطلاعات موجود میباشد");
+ }
if (apiResult.ResponseContext.Status.Code != 0)
{
return op.Failed("کد ملی و تاریخ تولد با هم همخانی ندارند");
@@ -1595,7 +1619,16 @@ public class EmployeeAplication : RepositoryBase, IEmployeeAppli
return op.Succcedded(data);
}
var apiResult = await _uidService.GetPersonalInfo(nationalCode, birthDate);
+ if (apiResult.ResponseContext.Status.Code == 14)
+ {
+ return op.Failed("سامانه احراز هویت در دسترس نمیباشد لطفا اطلاعات پرسنل را به صورت دستی وارد کنید", new EmployeeDataFromApiViewModel() { AuthorizedCanceled = true });
+ }
+
+ if (apiResult.ResponseContext.Status.Code == 3)
+ {
+ return op.Failed("کد ملی نامعتبر است");
+ }
if (apiResult.ResponseContext.Status.Code != 0)
{
return op.Failed("کد ملی و تاریخ تولد با هم همخانی ندارند");
diff --git a/CompanyManagment.Application/EmployeeComputeOptionsApplication.cs b/CompanyManagment.Application/EmployeeComputeOptionsApplication.cs
index 74760e7e..d7becaf1 100644
--- a/CompanyManagment.Application/EmployeeComputeOptionsApplication.cs
+++ b/CompanyManagment.Application/EmployeeComputeOptionsApplication.cs
@@ -21,41 +21,54 @@ public class EmployeeComputeOptionsApplication : IEmployeeComputeOptionsApplicat
public OperationResult Create(CreateEmployeeComputeOptions command)
{
- var opration = new OperationResult();
+
+ var opration = new OperationResult();
+ if (command.CreateContract && command.ContractTerm != "1" && command.CutContractEndOfYear == IsActive.None)
+ return opration.Failed("لطفا تعیین کنید که قراداد منتهی به پایان سال یاشد یا نباشد");
+
+ if (command.ContractTerm == "1")
+ command.CutContractEndOfYear = IsActive.None;
+
+
try
- {
- if (_employeeComputeOptionsRepository.Exists(x =>
- x.EmployeeId == command.EmployeeId && x.WorkshopId == command.WorkshopId))
- {
- var query = GetEmployeeOptions(command.WorkshopId, command.EmployeeId);
- var editOptions = _employeeComputeOptionsRepository.Get(query.Id);
- editOptions.Edit(command.ComputeOptions, command.BonusesOptions, command.YearsOptions);
- _employeeComputeOptionsRepository.SaveChanges();
- return opration.Succcedded();
- }
- else
- {
- var createOptions = new EmployeeComputeOptions(command.WorkshopId, command.EmployeeId,
- command.ComputeOptions, command.BonusesOptions, command.YearsOptions);
- _employeeComputeOptionsRepository.Create(createOptions);
- _employeeComputeOptionsRepository.SaveChanges();
- return opration.Succcedded();
- }
- }
- catch (Exception a)
- {
- return opration.Failed("ثبت با خطا مواجه شد");
- }
-
+ {
+ if (_employeeComputeOptionsRepository.Exists(x =>
+ x.EmployeeId == command.EmployeeId && x.WorkshopId == command.WorkshopId))
+ {
+ var query = GetEmployeeOptions(command.WorkshopId, command.EmployeeId);
+ var editOptions = _employeeComputeOptionsRepository.Get(query.Id);
+
+ editOptions.Edit(command.ComputeOptions, command.BonusesOptions, command.YearsOptions,
+ command.CreateContract, command.SignContract, command.CreateCheckout, command.SignCheckout, command.ContractTerm, command.CutContractEndOfYear);
+
+ _employeeComputeOptionsRepository.SaveChanges();
+ return opration.Succcedded();
+ }
+ else
+ {
+ var createOptions = new EmployeeComputeOptions(command.WorkshopId, command.EmployeeId,
+ command.ComputeOptions, command.BonusesOptions, command.YearsOptions, command.CreateContract,
+ command.SignContract, command.CreateCheckout, command.SignCheckout, command.ContractTerm, command.CutContractEndOfYear);
+
+ _employeeComputeOptionsRepository.Create(createOptions);
+ _employeeComputeOptionsRepository.SaveChanges();
+ return opration.Succcedded();
+ }
+ }
+ catch (Exception a)
+ {
+ return opration.Failed("ثبت با خطا مواجه شد");
+ }
+
}
public EmployeeComputeOptionsViewModel GetEmployeeOptions(long workshopId, long employeeId)
{
- return _employeeComputeOptionsRepository.GetEmployeeOptions(workshopId, employeeId);
+ return _employeeComputeOptionsRepository.GetEmployeeOptions(workshopId, employeeId);
}
public List GetAllByWorkshopId(long workshopId)
{
- return _employeeComputeOptionsRepository.GetAllByWorkshopId(workshopId);
+ return _employeeComputeOptionsRepository.GetAllByWorkshopId(workshopId);
}
}
\ No newline at end of file
diff --git a/CompanyManagment.Application/InsuranceListApplication.cs b/CompanyManagment.Application/InsuranceListApplication.cs
index 95d3f118..251be235 100644
--- a/CompanyManagment.Application/InsuranceListApplication.cs
+++ b/CompanyManagment.Application/InsuranceListApplication.cs
@@ -1,10 +1,13 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
+using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
+using System.Threading.Tasks;
using _0_Framework.Application;
using _0_Framework.Domain.CustomizeCheckoutShared.ValueObjects;
+using AccountManagement.Domain.MediaAgg;
using Company.Domain.CheckoutAgg;
using Company.Domain.DateSalaryAgg;
using Company.Domain.DateSalaryItemAgg;
@@ -15,6 +18,7 @@ using Company.Domain.empolyerAgg;
using Company.Domain.InsuranceEmployeeInfoAgg;
using Company.Domain.InsuranceJobItemAgg;
using Company.Domain.InsuranceListAgg;
+using Company.Domain.InsuranceListAgg.ValueObjects;
using Company.Domain.InsurancWorkshopInfoAgg;
using Company.Domain.LeftWorkAgg;
using Company.Domain.LeftWorkInsuranceAgg;
@@ -25,6 +29,7 @@ using CompanyManagment.App.Contracts.EmployeeInsurancListData;
using CompanyManagment.App.Contracts.InsuranceEmployeeInfo;
using CompanyManagment.App.Contracts.InsuranceJobItem;
using CompanyManagment.App.Contracts.InsuranceList;
+using CompanyManagment.App.Contracts.InsuranceList.Enums;
using CompanyManagment.App.Contracts.InsuranceYearlySalary;
using CompanyManagment.App.Contracts.LeftWorkInsurance;
using CompanyManagment.App.Contracts.PersonalContractingParty;
@@ -32,69 +37,72 @@ using CompanyManagment.App.Contracts.YearlySalary;
using CompanyManagment.App.Contracts.YearlySalaryItems;
using CompanyManagment.EFCore.Migrations;
using MD.PersianDateTime.Standard;
+using Microsoft.AspNetCore.Authorization.Infrastructure;
+using Microsoft.AspNetCore.Http;
namespace CompanyManagment.Application;
-public class InsuranceListApplication: IInsuranceListApplication
+public class InsuranceListApplication : IInsuranceListApplication
{
- //private readonly ITransactionManager _transactionManager;
- private readonly IInsuranceListRepository _insuranceListRepositpry;
- private readonly IEmployeeInsurancListDataRepository _employeeInsurancListDataRepository;
- private readonly IInsuranceEmployeeInfoRepository _insuranceEmployeeInfoRepository;
- private readonly IEmployeeRepository _employeeRepository;
- private readonly IWorkshopRepository _workShopRepository;
- private readonly ILeftWorkInsuranceApplication _leftWorkInsuranceApplication;
- private readonly IInsuranceEmployeeInfoApplication _insuranceEmployeeInfoApplication;
- private readonly IEmployeeInsurancListDataApplication _employeeInsurancListDataApplication;
- private readonly IYearlySalaryApplication _yearlySalaryApplication;
- private readonly IYearlySalaryItemApplication _yearlySalaryItemApplication;
- private readonly IInsuranceWorkshopInfoRepository _insuranceWorkshopInfoRepository;
- private readonly IInsuranceJobItemRepositpry _insuranceJobItemRepository;
- private readonly IDateSalaryRepository _dateSalaryRepository;
- private readonly IDateSalaryItemRepository _dateSalaryItemRepository;
- private readonly IPersonalContractingPartyApp _contractingPartyApp;
- private readonly ILeftWorkInsuranceRepository _leftWorkInsuranceRepository;
- private readonly IInsuranceYearlySalaryApplication _insuranceYearlySalaryApplication;
- private readonly ICheckoutRepository _checkoutRepository;
+ //private readonly ITransactionManager _transactionManager;
+ private readonly IInsuranceListRepository _insuranceListRepositpry;
+ private readonly IEmployeeInsurancListDataRepository _employeeInsurancListDataRepository;
+ private readonly IInsuranceEmployeeInfoRepository _insuranceEmployeeInfoRepository;
+ private readonly IEmployeeRepository _employeeRepository;
+ private readonly IWorkshopRepository _workShopRepository;
+ private readonly ILeftWorkInsuranceApplication _leftWorkInsuranceApplication;
+ private readonly IInsuranceEmployeeInfoApplication _insuranceEmployeeInfoApplication;
+ private readonly IEmployeeInsurancListDataApplication _employeeInsurancListDataApplication;
+ private readonly IYearlySalaryApplication _yearlySalaryApplication;
+ private readonly IYearlySalaryItemApplication _yearlySalaryItemApplication;
+ private readonly IInsuranceWorkshopInfoRepository _insuranceWorkshopInfoRepository;
+ private readonly IInsuranceJobItemRepositpry _insuranceJobItemRepository;
+ private readonly IDateSalaryRepository _dateSalaryRepository;
+ private readonly IDateSalaryItemRepository _dateSalaryItemRepository;
+ private readonly IPersonalContractingPartyApp _contractingPartyApp;
+ private readonly ILeftWorkInsuranceRepository _leftWorkInsuranceRepository;
+ private readonly IInsuranceYearlySalaryApplication _insuranceYearlySalaryApplication;
+ private readonly ICheckoutRepository _checkoutRepository;
+ private readonly IMediaRepository _mediaRepository;
+ public InsuranceListApplication(IInsuranceListRepository insuranceListRepositpry, IEmployeeInsurancListDataRepository employeeInsurancListDataRepository, IInsuranceEmployeeInfoRepository insuranceEmployeeInfoRepository, IEmployeeRepository employeeRepository, IWorkshopRepository workShopRepository, ILeftWorkInsuranceApplication leftWorkInsuranceApplication, IInsuranceEmployeeInfoApplication insuranceEmployeeInfoApplication, IEmployeeInsurancListDataApplication employeeInsurancListDataApplication, IYearlySalaryApplication yearlySalaryApplication, IYearlySalaryItemApplication yearlySalaryItemApplication, IInsuranceWorkshopInfoRepository insuranceWorkshopInfoRepository, IInsuranceJobItemRepositpry insuranceJobItemRepository, IDateSalaryRepository dateSalaryRepository, IDateSalaryItemRepository dateSalaryItemRepository, IPersonalContractingPartyApp contractingPartyApp, ILeftWorkInsuranceRepository leftWorkInsuranceRepository, IInsuranceYearlySalaryApplication insuranceYearlySalaryApplication, ICheckoutRepository checkoutRepository, IMediaRepository mediaRepository)
+ {
+ // _transactionManager = transactionManager;
- public InsuranceListApplication( IInsuranceListRepository insuranceListRepositpry, IEmployeeInsurancListDataRepository employeeInsurancListDataRepository, IInsuranceEmployeeInfoRepository insuranceEmployeeInfoRepository, IEmployeeRepository employeeRepository, IWorkshopRepository workShopRepository, ILeftWorkInsuranceApplication leftWorkInsuranceApplication, IInsuranceEmployeeInfoApplication insuranceEmployeeInfoApplication, IEmployeeInsurancListDataApplication employeeInsurancListDataApplication, IYearlySalaryApplication yearlySalaryApplication,IYearlySalaryItemApplication yearlySalaryItemApplication ,IInsuranceWorkshopInfoRepository insuranceWorkshopInfoRepository,IInsuranceJobItemRepositpry insuranceJobItemRepository, IDateSalaryRepository dateSalaryRepository, IDateSalaryItemRepository dateSalaryItemRepository, IPersonalContractingPartyApp contractingPartyApp, ILeftWorkInsuranceRepository leftWorkInsuranceRepository, IInsuranceYearlySalaryApplication insuranceYearlySalaryApplication, ICheckoutRepository checkoutRepository)
- {
- // _transactionManager = transactionManager;
-
- _insuranceListRepositpry = insuranceListRepositpry;
- _employeeInsurancListDataRepository = employeeInsurancListDataRepository;
- _insuranceEmployeeInfoRepository = insuranceEmployeeInfoRepository;
- _employeeRepository = employeeRepository;
- _workShopRepository = workShopRepository;
- _leftWorkInsuranceApplication = leftWorkInsuranceApplication;
- _insuranceEmployeeInfoApplication = insuranceEmployeeInfoApplication;
- _employeeInsurancListDataApplication = employeeInsurancListDataApplication;
- _yearlySalaryApplication = yearlySalaryApplication;
- _yearlySalaryItemApplication = yearlySalaryItemApplication;
- _insuranceWorkshopInfoRepository = insuranceWorkshopInfoRepository;
- _insuranceJobItemRepository = insuranceJobItemRepository;
- _dateSalaryRepository = dateSalaryRepository;
- _dateSalaryItemRepository = dateSalaryItemRepository;
- _contractingPartyApp = contractingPartyApp;
- _leftWorkInsuranceRepository = leftWorkInsuranceRepository;
- _insuranceYearlySalaryApplication = insuranceYearlySalaryApplication;
- _checkoutRepository = checkoutRepository;
- }
+ _insuranceListRepositpry = insuranceListRepositpry;
+ _employeeInsurancListDataRepository = employeeInsurancListDataRepository;
+ _insuranceEmployeeInfoRepository = insuranceEmployeeInfoRepository;
+ _employeeRepository = employeeRepository;
+ _workShopRepository = workShopRepository;
+ _leftWorkInsuranceApplication = leftWorkInsuranceApplication;
+ _insuranceEmployeeInfoApplication = insuranceEmployeeInfoApplication;
+ _employeeInsurancListDataApplication = employeeInsurancListDataApplication;
+ _yearlySalaryApplication = yearlySalaryApplication;
+ _yearlySalaryItemApplication = yearlySalaryItemApplication;
+ _insuranceWorkshopInfoRepository = insuranceWorkshopInfoRepository;
+ _insuranceJobItemRepository = insuranceJobItemRepository;
+ _dateSalaryRepository = dateSalaryRepository;
+ _dateSalaryItemRepository = dateSalaryItemRepository;
+ _contractingPartyApp = contractingPartyApp;
+ _leftWorkInsuranceRepository = leftWorkInsuranceRepository;
+ _insuranceYearlySalaryApplication = insuranceYearlySalaryApplication;
+ _checkoutRepository = checkoutRepository;
+ _mediaRepository = mediaRepository;
+ }
public OperationResult Create(CreateInsuranceList command)
{
-
+
var operation = new OperationResult();
- if (command.WorkshopId==0 )
+ if (command.WorkshopId == 0)
{
return operation.Failed(" انتخاب کارگاه اجباری می باشد ");
}
- if ( command.Month == "0" )
+ if (command.Month == "0")
{
return operation.Failed(" انتخاب ماه اجباری می باشد ");
}
- if ( command.Year == "0")
+ if (command.Year == "0")
{
return operation.Failed("انتخاب سال اجباری می باشد ");
}
@@ -114,64 +122,64 @@ public class InsuranceListApplication: IInsuranceListApplication
{
var createInsuranceEmployeeInfo = new CreateInsuranceEmployeeInfo();
- createInsuranceEmployeeInfo.EmployeeId = item.EmployeeId;
- createInsuranceEmployeeInfo.FName = item.FName;
- createInsuranceEmployeeInfo.LName = item.LName;
- createInsuranceEmployeeInfo.FatherName = item.FatherName;
- createInsuranceEmployeeInfo.PlaceOfIssue = item.PlaceOfIssue;
- createInsuranceEmployeeInfo.NationalCode = item.NationalCode;
- createInsuranceEmployeeInfo.IdNumber = item.IdNumber;
- createInsuranceEmployeeInfo.Gender = item.Gender;
- createInsuranceEmployeeInfo.InsuranceCode = item.InsuranceCode;
- createInsuranceEmployeeInfo.DateOfBirthGr = item.DateOfBirth.ToGeorgianDateTime();
- createInsuranceEmployeeInfo.DateOfIssueGr = item.DateOfIssue.ToGeorgianDateTime();
- _insuranceEmployeeInfoApplication.Create(createInsuranceEmployeeInfo);
- }
- else
- {
+ createInsuranceEmployeeInfo.EmployeeId = item.EmployeeId;
+ createInsuranceEmployeeInfo.FName = item.FName;
+ createInsuranceEmployeeInfo.LName = item.LName;
+ createInsuranceEmployeeInfo.FatherName = item.FatherName;
+ createInsuranceEmployeeInfo.PlaceOfIssue = item.PlaceOfIssue;
+ createInsuranceEmployeeInfo.NationalCode = item.NationalCode;
+ createInsuranceEmployeeInfo.IdNumber = item.IdNumber;
+ createInsuranceEmployeeInfo.Gender = item.Gender;
+ createInsuranceEmployeeInfo.InsuranceCode = item.InsuranceCode;
+ createInsuranceEmployeeInfo.DateOfBirthGr = item.DateOfBirth.ToGeorgianDateTime();
+ createInsuranceEmployeeInfo.DateOfIssueGr = item.DateOfIssue.ToGeorgianDateTime();
+ _insuranceEmployeeInfoApplication.Create(createInsuranceEmployeeInfo);
+ }
+ else
+ {
- var insuranceEmployeeInfo = new EditInsuranceEmployeeInfo();
- insuranceEmployeeInfo.Id = item.InsuranceEmployeeInformationId;
- insuranceEmployeeInfo.EmployeeId = item.EmployeeId;
- insuranceEmployeeInfo.FName = item.FName;
- insuranceEmployeeInfo.LName = item.LName;
- insuranceEmployeeInfo.FatherName = item.FatherName;
- insuranceEmployeeInfo.PlaceOfIssue = item.PlaceOfIssue;
- insuranceEmployeeInfo.NationalCode = item.NationalCode;
- insuranceEmployeeInfo.IdNumber = item.IdNumber;
- insuranceEmployeeInfo.Gender = item.Gender;
- insuranceEmployeeInfo.InsuranceCode = item.InsuranceCode;
- insuranceEmployeeInfo.DateOfBirthGr = item.DateOfBirth.ToGeorgianDateTime();
- insuranceEmployeeInfo.DateOfIssueGr = item.DateOfIssue.ToGeorgianDateTime();
- _insuranceEmployeeInfoApplication.Edit(insuranceEmployeeInfo);
+ var insuranceEmployeeInfo = new EditInsuranceEmployeeInfo();
+ insuranceEmployeeInfo.Id = item.InsuranceEmployeeInformationId;
+ insuranceEmployeeInfo.EmployeeId = item.EmployeeId;
+ insuranceEmployeeInfo.FName = item.FName;
+ insuranceEmployeeInfo.LName = item.LName;
+ insuranceEmployeeInfo.FatherName = item.FatherName;
+ insuranceEmployeeInfo.PlaceOfIssue = item.PlaceOfIssue;
+ insuranceEmployeeInfo.NationalCode = item.NationalCode;
+ insuranceEmployeeInfo.IdNumber = item.IdNumber;
+ insuranceEmployeeInfo.Gender = item.Gender;
+ insuranceEmployeeInfo.InsuranceCode = item.InsuranceCode;
+ insuranceEmployeeInfo.DateOfBirthGr = item.DateOfBirth.ToGeorgianDateTime();
+ insuranceEmployeeInfo.DateOfIssueGr = item.DateOfIssue.ToGeorgianDateTime();
+ _insuranceEmployeeInfoApplication.Edit(insuranceEmployeeInfo);
- }
- }
- }
- else
- {
- return operation.Failed(" لیست پرسنل در کارگاه و تاریخ انتخاب شده خالی است ");
- }
- #endregion
+ }
+ }
+ }
+ else
+ {
+ return operation.Failed(" لیست پرسنل در کارگاه و تاریخ انتخاب شده خالی است ");
+ }
+ #endregion
- string startMonthCurrent = command.Year + "/" + command.Month + "/01";
- string endMonthCurrent = startMonthCurrent.FindeEndOfMonth();
- command.StartDate = startMonthCurrent.ToGeorgianDateTime();
- command.EndDate = endMonthCurrent.ToGeorgianDateTime();
+ string startMonthCurrent = command.Year + "/" + command.Month + "/01";
+ string endMonthCurrent = startMonthCurrent.FindeEndOfMonth();
+ command.StartDate = startMonthCurrent.ToGeorgianDateTime();
+ command.EndDate = endMonthCurrent.ToGeorgianDateTime();
- #region InsuranceList
+ #region InsuranceList
- operation = _insuranceListRepositpry.CreateInsuranceList(command);
+ operation = _insuranceListRepositpry.CreateInsuranceList(command);
- #endregion
+ #endregion
- return operation;
- }
- }
+ return operation;
+ }
+ }
public OperationResult Edit(EditInsuranceList command)
{
-
+
var operation = new OperationResult();
if (command.WorkshopId == 0)
{
@@ -185,21 +193,21 @@ public class InsuranceListApplication: IInsuranceListApplication
{
return operation.Failed("انتخاب سال اجباری می باشد ");
}
- else if (_insuranceListRepositpry.Exists(x =>x.id!=command.Id && x.WorkshopId == command.WorkshopId && x.Month == command.Month && x.Year == command.Year))
+ else if (_insuranceListRepositpry.Exists(x => x.id != command.Id && x.WorkshopId == command.WorkshopId && x.Month == command.Month && x.Year == command.Year))
{
return operation.Failed(" لیست بیمه برای کارگاه، سال و ماه انتخاب شده قبلا ایجاد شده است ");
}
else
{
- #region EmployeeDetailsForInsurance
- if (command.EmployeeDetailsForInsuranceList != null && command.EmployeeDetailsForInsuranceList.Count > 0)
- {
- foreach (var item in command.EmployeeDetailsForInsuranceList)
- {
- if (item.InsuranceEmployeeInformationId == 0)
- {
- var createInsuranceEmployeeInfo = new CreateInsuranceEmployeeInfo();
+ #region EmployeeDetailsForInsurance
+ if (command.EmployeeDetailsForInsuranceList != null && command.EmployeeDetailsForInsuranceList.Count > 0)
+ {
+ foreach (var item in command.EmployeeDetailsForInsuranceList)
+ {
+ if (item.InsuranceEmployeeInformationId == 0)
+ {
+ var createInsuranceEmployeeInfo = new CreateInsuranceEmployeeInfo();
createInsuranceEmployeeInfo.EmployeeId = item.EmployeeId;
createInsuranceEmployeeInfo.FName = item.FName;
@@ -211,144 +219,144 @@ public class InsuranceListApplication: IInsuranceListApplication
createInsuranceEmployeeInfo.Gender = item.Gender;
createInsuranceEmployeeInfo.InsuranceCode = item.InsuranceCode;
createInsuranceEmployeeInfo.DateOfBirthGr = item.DateOfBirth.ToGeorgianDateTime();
- createInsuranceEmployeeInfo.DateOfIssueGr =!string.IsNullOrEmpty(item.DateOfIssue)? item.DateOfIssue.ToGeorgianDateTime(): "1300/10/11".ToGeorgianDateTime();
+ createInsuranceEmployeeInfo.DateOfIssueGr = !string.IsNullOrEmpty(item.DateOfIssue) ? item.DateOfIssue.ToGeorgianDateTime() : "1300/10/11".ToGeorgianDateTime();
_insuranceEmployeeInfoApplication.Create(createInsuranceEmployeeInfo);
}
else
{
- var insuranceEmployeeInfo = new EditInsuranceEmployeeInfo();
- insuranceEmployeeInfo.Id = item.InsuranceEmployeeInformationId;
- insuranceEmployeeInfo.EmployeeId = item.EmployeeId;
- insuranceEmployeeInfo.FName = item.FName;
- insuranceEmployeeInfo.LName = item.LName;
- insuranceEmployeeInfo.FatherName = item.FatherName;
- insuranceEmployeeInfo.PlaceOfIssue = item.PlaceOfIssue;
- insuranceEmployeeInfo.NationalCode = item.NationalCode;
- insuranceEmployeeInfo.IdNumber = item.IdNumber;
- insuranceEmployeeInfo.Gender = item.Gender;
- insuranceEmployeeInfo.InsuranceCode = item.InsuranceCode;
- insuranceEmployeeInfo.DateOfBirthGr = item.DateOfBirth.ToGeorgianDateTime();
- insuranceEmployeeInfo.DateOfIssueGr = !string.IsNullOrEmpty(item.DateOfIssue) ? item.DateOfIssue.ToGeorgianDateTime() : "1300/10/11".ToGeorgianDateTime(); ;
- _insuranceEmployeeInfoApplication.Edit(insuranceEmployeeInfo);
+ var insuranceEmployeeInfo = new EditInsuranceEmployeeInfo();
+ insuranceEmployeeInfo.Id = item.InsuranceEmployeeInformationId;
+ insuranceEmployeeInfo.EmployeeId = item.EmployeeId;
+ insuranceEmployeeInfo.FName = item.FName;
+ insuranceEmployeeInfo.LName = item.LName;
+ insuranceEmployeeInfo.FatherName = item.FatherName;
+ insuranceEmployeeInfo.PlaceOfIssue = item.PlaceOfIssue;
+ insuranceEmployeeInfo.NationalCode = item.NationalCode;
+ insuranceEmployeeInfo.IdNumber = item.IdNumber;
+ insuranceEmployeeInfo.Gender = item.Gender;
+ insuranceEmployeeInfo.InsuranceCode = item.InsuranceCode;
+ insuranceEmployeeInfo.DateOfBirthGr = item.DateOfBirth.ToGeorgianDateTime();
+ insuranceEmployeeInfo.DateOfIssueGr = !string.IsNullOrEmpty(item.DateOfIssue) ? item.DateOfIssue.ToGeorgianDateTime() : "1300/10/11".ToGeorgianDateTime(); ;
+ _insuranceEmployeeInfoApplication.Edit(insuranceEmployeeInfo);
- }
- }
- }
- else
- {
- return operation.Failed(" لیست پرسنل در کارگاه و تاریخ انتخاب شده خالی است ");
- }
- #endregion
+ }
+ }
+ }
+ else
+ {
+ return operation.Failed(" لیست پرسنل در کارگاه و تاریخ انتخاب شده خالی است ");
+ }
+ #endregion
- string startMonthCurrent = command.Year + "/" + command.Month + "/01";
- string endMonthCurrent = startMonthCurrent.FindeEndOfMonth();
- command.StartDate = startMonthCurrent.ToGeorgianDateTime();
- command.EndDate = endMonthCurrent.ToGeorgianDateTime();
+ string startMonthCurrent = command.Year + "/" + command.Month + "/01";
+ string endMonthCurrent = startMonthCurrent.FindeEndOfMonth();
+ command.StartDate = startMonthCurrent.ToGeorgianDateTime();
+ command.EndDate = endMonthCurrent.ToGeorgianDateTime();
- #region InsuranceList
+ #region InsuranceList
- operation = _insuranceListRepositpry.EditInsuranceList(command);
+ operation = _insuranceListRepositpry.EditInsuranceList(command);
- #endregion
+ #endregion
- if (command.InsuranceWorkshopInfo != null)
- {
- var insuranceWorkshopInfoObj =
- _insuranceWorkshopInfoRepository.Get(command.InsuranceWorkshopInfo.InsuranceWorkshopInfoId);
- insuranceWorkshopInfoObj.Edit(command.InsuranceWorkshopInfo.WorkshopName,
- command.InsuranceWorkshopInfo.InsuranceCode, command.InsuranceWorkshopInfo.AgreementNumber,
- command.InsuranceWorkshopInfo.EmployerName, command.InsuranceWorkshopInfo.Address, command.InsuranceWorkshopInfo.ListNumber);
- _insuranceWorkshopInfoRepository.SaveChanges();
+ if (command.InsuranceWorkshopInfo != null)
+ {
+ var insuranceWorkshopInfoObj =
+ _insuranceWorkshopInfoRepository.Get(command.InsuranceWorkshopInfo.InsuranceWorkshopInfoId);
+ insuranceWorkshopInfoObj.Edit(command.InsuranceWorkshopInfo.WorkshopName,
+ command.InsuranceWorkshopInfo.InsuranceCode, command.InsuranceWorkshopInfo.AgreementNumber,
+ command.InsuranceWorkshopInfo.EmployerName, command.InsuranceWorkshopInfo.Address, command.InsuranceWorkshopInfo.ListNumber);
+ _insuranceWorkshopInfoRepository.SaveChanges();
- }
+ }
return operation;
}
-
- }
- public EditInsuranceList GetDetails(long id)
- {
- var insuranceListDetails = _insuranceListRepositpry.GetDetails(id);
- string startMonthCurrent = insuranceListDetails.Year + "/" + insuranceListDetails.Month + "/01";
- string endMonthCurrent = startMonthCurrent.FindeEndOfMonth();
- var dayMonthCurrent = Convert.ToInt32(endMonthCurrent.Substring(8, 2));
- var year = Convert.ToInt32(insuranceListDetails.Year);
- var month = Convert.ToInt32(insuranceListDetails.Month);
- var day = 1;
- var persianCurrentStartDate = new PersianDateTime(year, month, day);
- var persianCurrentEndDate = new PersianDateTime(year, month, dayMonthCurrent);
+ }
+
+ public EditInsuranceList GetDetails(long id)
+ {
+ var insuranceListDetails = _insuranceListRepositpry.GetDetails(id);
+ string startMonthCurrent = insuranceListDetails.Year + "/" + insuranceListDetails.Month + "/01";
+ string endMonthCurrent = startMonthCurrent.FindeEndOfMonth();
+ var dayMonthCurrent = Convert.ToInt32(endMonthCurrent.Substring(8, 2));
+ var year = Convert.ToInt32(insuranceListDetails.Year);
+ var month = Convert.ToInt32(insuranceListDetails.Month);
+ var day = 1;
+ var persianCurrentStartDate = new PersianDateTime(year, month, day);
+ var persianCurrentEndDate = new PersianDateTime(year, month, dayMonthCurrent);
- var model = new YearlySalarySearchModel();
- model.StartDateGr = startMonthCurrent.ToGeorgianDateTime();
- model.EndDateGr = endMonthCurrent.ToGeorgianDateTime();
- model.year = insuranceListDetails.Year;
- var yearSalaryObj = _yearlySalaryApplication.GetDetailsBySearchModel(model);
- var yearlysalaryItem = new YearlysalaryItemViewModel();
- var housingAllowance = new YearlysalaryItemViewModel();
- var consumableItems = new YearlysalaryItemViewModel();
- if (yearSalaryObj != null)
- {
- yearlysalaryItem = _yearlySalaryItemApplication
- .GetItemsByYearlySalaryId(yearSalaryObj.Id).FirstOrDefault(x => x.ItemName == "مزد روزانه");
- housingAllowance = _yearlySalaryItemApplication
- .GetItemsByYearlySalaryId(yearSalaryObj.Id).FirstOrDefault(x => x.ItemName == "کمک هزینه مسکن");
- consumableItems = _yearlySalaryItemApplication
- .GetItemsByYearlySalaryId(yearSalaryObj.Id).FirstOrDefault(x => x.ItemName == "کمک هزینه اقلام");
- }
+ var model = new YearlySalarySearchModel();
+ model.StartDateGr = startMonthCurrent.ToGeorgianDateTime();
+ model.EndDateGr = endMonthCurrent.ToGeorgianDateTime();
+ model.year = insuranceListDetails.Year;
+ var yearSalaryObj = _yearlySalaryApplication.GetDetailsBySearchModel(model);
+ var yearlysalaryItem = new YearlysalaryItemViewModel();
+ var housingAllowance = new YearlysalaryItemViewModel();
+ var consumableItems = new YearlysalaryItemViewModel();
+ if (yearSalaryObj != null)
+ {
+ yearlysalaryItem = _yearlySalaryItemApplication
+ .GetItemsByYearlySalaryId(yearSalaryObj.Id).FirstOrDefault(x => x.ItemName == "مزد روزانه");
+ housingAllowance = _yearlySalaryItemApplication
+ .GetItemsByYearlySalaryId(yearSalaryObj.Id).FirstOrDefault(x => x.ItemName == "کمک هزینه مسکن");
+ consumableItems = _yearlySalaryItemApplication
+ .GetItemsByYearlySalaryId(yearSalaryObj.Id).FirstOrDefault(x => x.ItemName == "کمک هزینه اقلام");
+ }
foreach (var item in insuranceListDetails.EmployeeDetailsForInsuranceList)
{
-
- item.IncludeStatus = _leftWorkInsuranceApplication.GetLeftPersonelByWorkshopIdAndEmployeeId(insuranceListDetails.WorkshopId,item.EmployeeId).IncludeStatus;
+
+ item.IncludeStatus = _leftWorkInsuranceApplication.GetLeftPersonelByWorkshopIdAndEmployeeId(insuranceListDetails.WorkshopId, item.EmployeeId).IncludeStatus;
if (!string.IsNullOrEmpty(item.LeftWorkDate))
{
var yearEndDateUser = Convert.ToInt32(item.LeftWorkDate.Substring(0, 4));
var monthEndDateUser = Convert.ToInt32(item.LeftWorkDate.Substring(5, 2));
var dayEndDateUser = Convert.ToInt32(item.LeftWorkDate.Substring(8, 2));
- var persianLeftDateUser = new PersianDateTime(yearEndDateUser, monthEndDateUser, dayEndDateUser);
- if (persianLeftDateUser <= persianCurrentEndDate)
- item.HasLeftWorkInMonth = true;
- else
- item.HasLeftWorkInMonth = false;
- }
- else
- {
- item.HasLeftWorkInMonth = false;
- }
- var yearStartDateUser = Convert.ToInt32(item.StartWorkDate.Substring(0, 4));
- var monthStartDateUser = Convert.ToInt32(item.StartWorkDate.Substring(5, 2));
- var dayStartDateUser = Convert.ToInt32(item.StartWorkDate.Substring(8, 2));
- var persianStartDateUser = new PersianDateTime(yearStartDateUser, monthStartDateUser, dayStartDateUser);
- if (persianStartDateUser < persianCurrentStartDate)
- item.HasStartWorkInMonth = false;
- else
- item.HasStartWorkInMonth = true;
- item.StartMonthCurrent = startMonthCurrent;
- item.DailyWageStr = item.DailyWage.ToMoney();
+ var persianLeftDateUser = new PersianDateTime(yearEndDateUser, monthEndDateUser, dayEndDateUser);
+ if (persianLeftDateUser <= persianCurrentEndDate)
+ item.HasLeftWorkInMonth = true;
+ else
+ item.HasLeftWorkInMonth = false;
+ }
+ else
+ {
+ item.HasLeftWorkInMonth = false;
+ }
+ var yearStartDateUser = Convert.ToInt32(item.StartWorkDate.Substring(0, 4));
+ var monthStartDateUser = Convert.ToInt32(item.StartWorkDate.Substring(5, 2));
+ var dayStartDateUser = Convert.ToInt32(item.StartWorkDate.Substring(8, 2));
+ var persianStartDateUser = new PersianDateTime(yearStartDateUser, monthStartDateUser, dayStartDateUser);
+ if (persianStartDateUser < persianCurrentStartDate)
+ item.HasStartWorkInMonth = false;
+ else
+ item.HasStartWorkInMonth = true;
+ item.StartMonthCurrent = startMonthCurrent;
+ item.DailyWageStr = item.DailyWage.ToMoney();
- item.HousingAllowance = housingAllowance.ItemValue;
- item.ConsumableItems = consumableItems.ItemValue;
- item.EndMonthCurrentDay = dayMonthCurrent;
- }
- insuranceListDetails.EmployeeDetailsForInsuranceList = insuranceListDetails.EmployeeDetailsForInsuranceList.OrderByDescending(x => x.HasLeftWorkInMonth).ThenByDescending(x => x.HasStartWorkInMonth)
- .ThenBy(x => x.LName).ToList();
+ item.HousingAllowance = housingAllowance.ItemValue;
+ item.ConsumableItems = consumableItems.ItemValue;
+ item.EndMonthCurrentDay = dayMonthCurrent;
+ }
+ insuranceListDetails.EmployeeDetailsForInsuranceList = insuranceListDetails.EmployeeDetailsForInsuranceList.OrderByDescending(x => x.HasLeftWorkInMonth).ThenByDescending(x => x.HasStartWorkInMonth)
+ .ThenBy(x => x.LName).ToList();
- insuranceListDetails.AllInsuredShare = insuranceListDetails.InsuredShare +
- insuranceListDetails.EmployerShare +
- insuranceListDetails.UnEmploymentInsurance;
+ insuranceListDetails.AllInsuredShare = insuranceListDetails.InsuredShare +
+ insuranceListDetails.EmployerShare +
+ insuranceListDetails.UnEmploymentInsurance;
- insuranceListDetails.LeftWorkEmployees =
- _leftWorkInsuranceRepository.GetEmployeesWithContractExitOnly(insuranceListDetails.WorkshopId);
+ insuranceListDetails.LeftWorkEmployees =
+ _leftWorkInsuranceRepository.GetEmployeesWithContractExitOnly(insuranceListDetails.WorkshopId);
- return insuranceListDetails;
- }
+ return insuranceListDetails;
+ }
- public List Search(InsuranceListSearchModel searchModel)
+ public List Search(InsuranceListSearchModel searchModel)
{
return _insuranceListRepositpry.OptimizedSearch(searchModel);
//var result = _insuranceListRepositpry.Search(searchModel);
@@ -371,19 +379,19 @@ public class InsuranceListApplication: IInsuranceListApplication
// EmployerId = x.EmployerId,
// IsBlockCantracingParty = _contractingPartyApp.IsBlockByEmployerId(x.EmployerId),
- //}).ToList();
- //return result;
- }
+ //}).ToList();
+ //return result;
+ }
///
/// محاسبه جدول پرسنل در مودال ایجاد لیست بیمه
///
///
///
- public MainEmployeeDetailsViewModel SearchEmployeeForCreateInsuranceList( EmployeeForCreateInsuranceListSearchModel searchModel)
+ public MainEmployeeDetailsViewModel SearchEmployeeForCreateInsuranceList(EmployeeForCreateInsuranceListSearchModel searchModel)
{
- var watch = new Stopwatch();
-
+ var watch = new Stopwatch();
+
var result = new MainEmployeeDetailsViewModel();
var workshopId = searchModel.WorkshopIds.FirstOrDefault();
var workshop = _workShopRepository.GetDetails(workshopId);
@@ -392,41 +400,40 @@ public class InsuranceListApplication: IInsuranceListApplication
double monthlybaseYear = 0;
// اگر در این سال و ماه برای این کارگاه لیست بیمه ایجاد نشده بود
if (!_insuranceListRepositpry.Exists(x =>
- x.Year == searchModel.Year && x.Month == searchModel.Month &&
- searchModel.WorkshopIds.Contains(x.WorkshopId)))
+ x.Year == searchModel.Year && x.Month == searchModel.Month &&
+ searchModel.WorkshopIds.Contains(x.WorkshopId)))
{
var startMonthFa = $"{searchModel.Year}/{searchModel.Month.PadLeft(2, '0')}/01";
DateTime startDateGr = startMonthFa.ToGeorgianDateTime();
- DateTime endDateGr = startMonthFa.FindeEndOfMonth()
- .ToGeorgianDateTime();
+ DateTime endDateGr = startMonthFa.FindeEndOfMonth()
+ .ToGeorgianDateTime();
int endOfMonth = Convert.ToInt32((startMonthFa.FindeEndOfMonth()).Substring(8, 2));
-
- //مقادیر سالانه این تاریخ
- var yearlysaleries = _yearlySalaryApplication.GetInsuranceItems(startDateGr, endDateGr, searchModel.Year);
+ //مقادیر سالانه این تاریخ
+ var yearlysaleries = _yearlySalaryApplication.GetInsuranceItems(startDateGr, endDateGr, searchModel.Year);
- // دریافت اطلاعات هویتی و شروع و ترک کار کارکنان
- var employeesInfoAndLeftWorks =
- _leftWorkInsuranceApplication.GetEmployeeInsuranceLeftWorksAndInformation(workshopId, startDateGr,
- endDateGr);
+ // دریافت اطلاعات هویتی و شروع و ترک کار کارکنان
+ var employeesInfoAndLeftWorks =
+ _leftWorkInsuranceApplication.GetEmployeeInsuranceLeftWorksAndInformation(workshopId, startDateGr,
+ endDateGr);
var employeeInsurancDataPreviusList =
_insuranceListRepositpry.GetEmployeeInsuranceDataAmonthAgo(startDateGr, workshopId);
- watch.Start();
- var computeResult = employeesInfoAndLeftWorks.Select(employee =>
+ watch.Start();
+ var computeResult = employeesInfoAndLeftWorks.Select(employee =>
{
var dateOfBirth = employee.DateOfBirthGr.ToFarsi();
var dateOfIssue = employee.DateOfIssueGr.ToFarsi();
var leftDate = employee.LeftWorkDateGr?.AddDays(-1) ?? new DateTime();
- bool isManager = employee.JobId is 10 or 16 or 17 or 18 or 3498;
+ bool isManager = employee.JobId is 10 or 16 or 17 or 18 or 3498;
//آیا در کارگاه تیک محاسبه اضافه کار یا حق اولاد زده شده است؟
bool hasWorkshopOverTimeOrFamilyAllowance =
workshop.InsuranceCheckoutFamilyAllowance || workshop.InsuranceCheckoutOvertime;
-
+
//آیا پرسنل فیش حقوق دارد
//این مورد زمانی چک می شود که تیک محاسبه در کارگاه زده شده باشد
// در غیر اینصورت بصورت پیشفرض دارای فیش حقوق در نظر گرفته می شود
@@ -439,21 +446,24 @@ public class InsuranceListApplication: IInsuranceListApplication
searchModel.Year, searchModel.Month);
if (checkout.hasChekout)
{
-
+
familyAllowance = checkout.FamilyAlloance;
overTimePay = checkout.OverTimePay;
-
+
}
else
{
+ //چون کارفرما فیش حقوقی ندارد
+ //ولی در لیست بیمه حضور دارد
+ //برای جلوگیری از هشدار فرانت کارفرما را داری فیش حقوقی فرض میکنیم
employeeHasCheckout = isManager == false ? false : true;
}
}
-
- var workingDays = Tools.GetEmployeeInsuranceWorkingDays(employee.StartWorkDateGr, leftDate, startDateGr,endDateGr, employee.EmployeeId);
- var leftWorkFa = workingDays.hasLeftWorkInMonth ? employee.LeftWorkDateGr.ToFarsi(): "";
+
+ var workingDays = Tools.GetEmployeeInsuranceWorkingDays(employee.StartWorkDateGr, leftDate, startDateGr, endDateGr, employee.EmployeeId);
+ var leftWorkFa = workingDays.hasLeftWorkInMonth ? employee.LeftWorkDateGr.ToFarsi() : "";
var startWorkFa = employee.StartWorkDateGr.ToFarsi();
//به دست آوردن دستمزد روزانه با توجه به اینکه کارگاه مشاغل مقطوع است یا خیر
@@ -463,487 +473,487 @@ public class InsuranceListApplication: IInsuranceListApplication
var res = GetDailyWageFixedSalary(searchModel.Year, workshopId, employee.EmployeeId, startDateGr,
endDateGr, employee.JobId, searchModel.Population, searchModel.InsuranceJobId);
dailyWage = res ?? 0;
-
+
}
else
{
var res = ComputeDailyWage(yearlysaleries.DayliWage, employee.EmployeeId, workshopId, searchModel.Year);
dailyWage = res;
}
-
-
+
+
//بدست آوردن پایه سنوات
var baseYears = _insuranceListRepositpry.GetEmployeeInsuranceBaseYear(employee.EmployeeId, workshopId,
- workingDays.countWorkingDays, startDateGr, endDateGr,workingDays.startWork, workingDays.endWork, workingDays.hasLeftWorkInMonth);
+ workingDays.countWorkingDays, startDateGr, endDateGr, workingDays.startWork, workingDays.endWork, workingDays.hasLeftWorkInMonth);
//آیا کارفرما یا مدیر عامل است؟
-
- baseYears.baseYear = isManager ? 0 : baseYears.baseYear;
- Console.WriteLine(employee.JobId + " - "+ baseYears.baseYear);
- //جمع مزد روزانه و پایه سنوات
- var dailyWagePlusBaseYears = dailyWage + baseYears.baseYear;
-
- //دستمزد ماهانه با محاسبه پایه سنوات
+ baseYears.baseYear = isManager ? 0 : baseYears.baseYear;
+ Console.WriteLine(employee.JobId + " - " + baseYears.baseYear);
+ //جمع مزد روزانه و پایه سنوات
+ var dailyWagePlusBaseYears = dailyWage + baseYears.baseYear;
+
+
+ //دستمزد ماهانه با محاسبه پایه سنوات
var monthlySalary = GetRoundValue(dailyWagePlusBaseYears * workingDays.countWorkingDays);
- //حق تاهل
- var marriedAllowance = employee.MaritalStatus == "متاهل" && !isManager ? yearlysaleries.MarriedAllowance : 0;
+ //حق تاهل
+ var marriedAllowance = employee.MaritalStatus == "متاهل" && !isManager ? yearlysaleries.MarriedAllowance : 0;
//محاسبه مزایای ماهانه
- var monthlyBenefits = GetMonthlyBenefits(endOfMonth, yearlysaleries.ConsumableItems, yearlysaleries.HousingAllowance, marriedAllowance, workingDays.countWorkingDays, searchModel.TypeOfInsuranceSendWorkshop, employee.JobId, employee.EmployeeId,employee.IncludeStatus);
+ var monthlyBenefits = GetMonthlyBenefits(endOfMonth, yearlysaleries.ConsumableItems, yearlysaleries.HousingAllowance, marriedAllowance, workingDays.countWorkingDays, searchModel.TypeOfInsuranceSendWorkshop, employee.JobId, employee.EmployeeId, employee.IncludeStatus);
- //if (employee.EmployeeId is 7999)// سید عباس خوشکلام سلیمان
- // monthlyBenefits = 80869389;
- //if (employee.EmployeeId is 43787)// شهرام براهیمی سیقلان
- // monthlyBenefits = 54748472;
- if (workshop.InsuranceCheckoutOvertime && employeeHasCheckout && !isManager)
- {
+ //if (employee.EmployeeId is 7999)// سید عباس خوشکلام سلیمان
+ // monthlyBenefits = 80869389;
+ //if (employee.EmployeeId is 43787)// شهرام براهیمی سیقلان
+ // monthlyBenefits = 54748472;
+ if (workshop.InsuranceCheckoutOvertime && employeeHasCheckout && !isManager)
+ {
monthlyBenefits = GetRoundValue(monthlyBenefits += overTimePay);
}
-
- //سرای ملک
- // نوشین خالی
- // 39692467
- //if (employee.EmployeeId == 45280)
- // monthlyBenefits += 39692467;
- var marriedAllowanceCompute = MarriedAllowance(employee.MaritalStatus, employee.JobId, employee.IncludeStatus,
- workingDays.countWorkingDays, yearlysaleries.MarriedAllowance, endOfMonth);
- //محاسبه جمع مزایای مشمول و دستمزد ماهانه
- var benefitsIncludedContinuous = monthlyBenefits + monthlySalary;
+ //سرای ملک
+ // نرجس خالی
+ // 39692467
+ if (employee.EmployeeId == 45280)
+ monthlyBenefits += 39692467;
- //benefitsIncludedContinuous = employee.JobId != 16 ? benefitsIncludedContinuous : 0;
- //محاسبه حق بیمه سهم بیمه شده
- var insuranceShare = (benefitsIncludedContinuous * 7) / 100;
+ var marriedAllowanceCompute = MarriedAllowance(employee.MaritalStatus, employee.JobId, employee.IncludeStatus,
+ workingDays.countWorkingDays, yearlysaleries.MarriedAllowance, endOfMonth);
+ //محاسبه جمع مزایای مشمول و دستمزد ماهانه
+ var benefitsIncludedContinuous = monthlyBenefits + monthlySalary;
- //محاسبه حق بیمه سهم کارفرما
- var employerShare = (benefitsIncludedContinuous * 20) / 100;
+ //benefitsIncludedContinuous = employee.JobId != 16 ? benefitsIncludedContinuous : 0;
+ //محاسبه حق بیمه سهم بیمه شده
+ var insuranceShare = (benefitsIncludedContinuous * 7) / 100;
- // محاسبه بیمه بیکاری
- var unEmploymentInsurance = (benefitsIncludedContinuous * 3) / 100;
+ //محاسبه حق بیمه سهم کارفرما
+ var employerShare = (benefitsIncludedContinuous * 20) / 100;
+
+ // محاسبه بیمه بیکاری
+ var unEmploymentInsurance = (benefitsIncludedContinuous * 3) / 100;
- var employeeListData = employeeInsurancDataPreviusList
- .FirstOrDefault(e => e.EmployeeId == employee.EmployeeId);
- //مزیای عیر مشمول لیست قبل
- var benefitsIncludedNonContinuous =
- employeeListData?.BenefitsIncludedNonContinuous ?? 0;
- if (workshop.InsuranceCheckoutFamilyAllowance && employeeHasCheckout && !isManager)
- {
+ var employeeListData = employeeInsurancDataPreviusList
+ .FirstOrDefault(e => e.EmployeeId == employee.EmployeeId);
+ //مزیای عیر مشمول لیست قبل
+ var benefitsIncludedNonContinuous =
+ employeeListData != null ? employeeListData.BenefitsIncludedNonContinuous : 0;
+ if (workshop.InsuranceCheckoutFamilyAllowance && employeeHasCheckout && !isManager)
+ {
+
+ benefitsIncludedNonContinuous = GetRoundValue(benefitsIncludedNonContinuous + familyAllowance);
+ }
+
- benefitsIncludedNonContinuous = GetRoundValue(benefitsIncludedNonContinuous + familyAllowance);
- }
-
-
var includedAndNotIncluded = benefitsIncludedContinuous + benefitsIncludedNonContinuous;
return new EmployeeDetailsForInsuranceListViewModel
- {
- #region EmployeeInfo
+ {
+ #region EmployeeInfo
EmployeeHasCheckout = employeeHasCheckout,
InsuranceEmployeeInformationId = employee.InsuranceEmployeeInformationId,
- EmployeeId = employee.EmployeeId,
- FName = employee.FName,
- LName = employee.LName,
- FatherName = employee.FatherName,
- DateOfBirth = dateOfBirth == "1300/10/11" ? "" : dateOfBirth,
- DateOfIssue = dateOfIssue,
- DateOfBirthGr = employee.DateOfBirthGr,
- DateOfIssueGr = employee.DateOfIssueGr,
- PlaceOfIssue = employee.PlaceOfIssue,
- IdNumber = employee.IdNumber,
- Gender = employee.Gender,
- NationalCode = employee.NationalCode,
- Nationality = employee.Nationality,
- InsuranceCode = employee.InsuranceCode,
+ EmployeeId = employee.EmployeeId,
+ FName = employee.FName,
+ LName = employee.LName,
+ FatherName = employee.FatherName,
+ DateOfBirth = dateOfBirth == "1300/10/11" ? "" : dateOfBirth,
+ DateOfIssue = dateOfIssue,
+ DateOfBirthGr = employee.DateOfBirthGr,
+ DateOfIssueGr = employee.DateOfIssueGr,
+ PlaceOfIssue = employee.PlaceOfIssue,
+ IdNumber = employee.IdNumber,
+ Gender = employee.Gender,
+ NationalCode = employee.NationalCode,
+ Nationality = employee.Nationality,
+ InsuranceCode = employee.InsuranceCode,
// آیا وضعیت تاهل پرسنل ست شده است
IsMaritalStatusSet = !string.IsNullOrWhiteSpace(employee.MaritalStatus),
MaritalStatus = employee.MaritalStatus,
- StartMonthCurrent = startMonthFa,
- WorkingDays = workingDays.countWorkingDays,
- StartWorkDate = startWorkFa,
- StartWorkDateGr = employee.StartWorkDateGr,
- LeftWorkDate = leftWorkFa,
- LeftWorkDateGr = workingDays.hasLeftWorkInMonth ? employee.LeftWorkDateGr : null,
- JobId = employee.JobId,
- JobName = employee.JobName,
- JobCode = employee.JobCode,
+ StartMonthCurrent = startMonthFa,
+ WorkingDays = workingDays.countWorkingDays,
+ StartWorkDate = startWorkFa,
+ StartWorkDateGr = employee.StartWorkDateGr,
+ LeftWorkDate = leftWorkFa,
+ LeftWorkDateGr = workingDays.hasLeftWorkInMonth ? employee.LeftWorkDateGr : null,
+ JobId = employee.JobId,
+ JobName = employee.JobName,
+ JobCode = employee.JobCode,
- HasStartWorkInMonth = workingDays.hasStartWorkInMonth,
- HasLeftWorkInMonth = workingDays.hasLeftWorkInMonth,
- #endregion
+ HasStartWorkInMonth = workingDays.hasStartWorkInMonth,
+ HasLeftWorkInMonth = workingDays.hasLeftWorkInMonth,
+ #endregion
- #region Compute
- //مشمول مزایا بودن
- IncludeStatus = employee.IncludeStatus,
+ #region Compute
+ //مشمول مزایا بودن
+ IncludeStatus = employee.IncludeStatus,
//دستمزد روزانه
- DailyWage = GetRoundValue(dailyWage),
+ DailyWage = GetRoundValue(dailyWage),
DailyWageStr = dailyWage.ToMoney(),
- HasConfilictJobs = dailyWage == 0,
+ HasConfilictJobs = dailyWage == 0,
- //پایه سنوات
- BaseYears = baseYears.baseYear,
+ //پایه سنوات
+ BaseYears = baseYears.baseYear,
- //مجموع مزد روزانه و پایه سنوات
- DailyWagePlusBaseYears = dailyWagePlusBaseYears,
+ //مجموع مزد روزانه و پایه سنوات
+ DailyWagePlusBaseYears = dailyWagePlusBaseYears,
- //حق تاهل
- MarriedAllowance = marriedAllowanceCompute,
+ //حق تاهل
+ MarriedAllowance = marriedAllowanceCompute,
//دستمزد ماهانه
MonthlySalary = monthlySalary,
-
-
+
+
//مزایای ماهانه
MonthlyBenefits = monthlyBenefits,
- //جمع مزایای مشمول و دستمزد ماهانه
- BenefitsIncludedContinuous = benefitsIncludedContinuous,
+ //جمع مزایای مشمول و دستمزد ماهانه
+ BenefitsIncludedContinuous = benefitsIncludedContinuous,
- //مزایای غیر مشمول *
- BenefitsIncludedNonContinuous = benefitsIncludedNonContinuous,
+ //مزایای غیر مشمول *
+ BenefitsIncludedNonContinuous = benefitsIncludedNonContinuous,
- // جمع کل دستمزد و مزایای ماهانه مشمول و غیر مشمول *
- IncludedAndNotIncluded = includedAndNotIncluded,
+ // جمع کل دستمزد و مزایای ماهانه مشمول و غیر مشمول *
+ IncludedAndNotIncluded = includedAndNotIncluded,
- //حق بیمه سهم بیمه شده
- InsuranceShare = GetRoundValue(insuranceShare),
+ //حق بیمه سهم بیمه شده
+ InsuranceShare = GetRoundValue(insuranceShare),
- //حق بیمه سهم کارفرما
- EmployerShare = GetRoundValue(employerShare),
+ //حق بیمه سهم کارفرما
+ EmployerShare = GetRoundValue(employerShare),
- //بیمه بیکاری
- UnEmploymentInsurance = GetRoundValue(unEmploymentInsurance),
+ //بیمه بیکاری
+ UnEmploymentInsurance = GetRoundValue(unEmploymentInsurance),
- //کمک هزینه مسکن
- HousingAllowance = yearlysaleries.HousingAllowance,
- //کمک هزینه اقلام
- ConsumableItems = yearlysaleries.ConsumableItems,
+ //کمک هزینه مسکن
+ HousingAllowance = yearlysaleries.HousingAllowance,
+ //کمک هزینه اقلام
+ ConsumableItems = yearlysaleries.ConsumableItems,
- EndMonthCurrentDay = endOfMonth,
- YearlySalaryItem = yearlysaleries.DayliWage,
- MonthlyBaseYearsStr = "0",
- MonthlyBaseYears = 0,
- OverTimePay = overTimePay,
- FamilyAllowance = familyAllowance
- #endregion
+ EndMonthCurrentDay = endOfMonth,
+ YearlySalaryItem = yearlysaleries.DayliWage,
+ MonthlyBaseYearsStr = "0",
+ MonthlyBaseYears = 0,
+ OverTimePay = overTimePay,
+ FamilyAllowance = familyAllowance
+ #endregion
};
- }).ToList();
+ }).ToList();
Console.WriteLine("New Compute : " + watch.Elapsed);
- watch.Stop();
+ watch.Stop();
- watch.Start();
+ watch.Start();
- #region Old_heydari
- //List list = new List();
- //var leftWorkInsuranceViewModel = _leftWorkInsuranceApplication.SearchForCreateInsuranceList(searchModel);
- ////int leftWorkInsuranceCount= leftWorkInsuranceViewModelList.Count();
+ #region Old_heydari
+ //List list = new List();
+ //var leftWorkInsuranceViewModel = _leftWorkInsuranceApplication.SearchForCreateInsuranceList(searchModel);
+ ////int leftWorkInsuranceCount= leftWorkInsuranceViewModelList.Count();
- //string startMonthCurrent = searchModel.Year + "/" + searchModel.Month + "/01";
- //string endMonthCurrent = startMonthCurrent.FindeEndOfMonth();
+ //string startMonthCurrent = searchModel.Year + "/" + searchModel.Month + "/01";
+ //string endMonthCurrent = startMonthCurrent.FindeEndOfMonth();
- //var model = new YearlySalarySearchModel();
- //var startDate = startMonthCurrent.ToGeorgianDateTime();
- //var endDate = endMonthCurrent.ToGeorgianDateTime();
- //model.StartDateGr = startDate;
- //model.EndDateGr = endMonthCurrent.ToGeorgianDateTime();
- //model.year = searchModel.Year;
+ //var model = new YearlySalarySearchModel();
+ //var startDate = startMonthCurrent.ToGeorgianDateTime();
+ //var endDate = endMonthCurrent.ToGeorgianDateTime();
+ //model.StartDateGr = startDate;
+ //model.EndDateGr = endMonthCurrent.ToGeorgianDateTime();
+ //model.year = searchModel.Year;
- //foreach (var item in leftWorkInsuranceViewModel)
- //{
- // var employeeObject = _employeeRepository.GetDetailsByADDate(item.EmployeeId);
+ //foreach (var item in leftWorkInsuranceViewModel)
+ //{
+ // var employeeObject = _employeeRepository.GetDetailsByADDate(item.EmployeeId);
- // var employeeDetailsForInsuranceObj = new EmployeeDetailsForInsuranceListViewModel();
- // employeeDetailsForInsuranceObj.HasConfilictJobs = false;
+ // var employeeDetailsForInsuranceObj = new EmployeeDetailsForInsuranceListViewModel();
+ // employeeDetailsForInsuranceObj.HasConfilictJobs = false;
- // // آیا وضعیت تاهل پرسنل ست شده است
- // employeeDetailsForInsuranceObj.IsMaritalStatusSet =
- // !string.IsNullOrWhiteSpace(employeeObject.MaritalStatus);
- // //دزیافت اطلاعات هویتی پرسنل
- // //در صورت نداشن دیتا از جدول پرسنل پر می شود
- // #region PersonnelInfo
+ // // آیا وضعیت تاهل پرسنل ست شده است
+ // employeeDetailsForInsuranceObj.IsMaritalStatusSet =
+ // !string.IsNullOrWhiteSpace(employeeObject.MaritalStatus);
+ // //دزیافت اطلاعات هویتی پرسنل
+ // //در صورت نداشن دیتا از جدول پرسنل پر می شود
+ // #region PersonnelInfo
- // if (_insuranceEmployeeInfoRepository.Exists(x => x.EmployeeId == item.EmployeeId))
- // {
- // var employeeInfoObject = _insuranceEmployeeInfoApplication.GetDetailsByEmployeeId(item.EmployeeId);
- // employeeDetailsForInsuranceObj.InsuranceEmployeeInformationId = employeeInfoObject.Id;
- // employeeDetailsForInsuranceObj.EmployeeId = employeeInfoObject.EmployeeId;
- // employeeDetailsForInsuranceObj.FName = employeeInfoObject.FName;
- // employeeDetailsForInsuranceObj.LName = employeeInfoObject.LName;
- // employeeDetailsForInsuranceObj.FatherName = employeeInfoObject.FatherName;
- // employeeDetailsForInsuranceObj.DateOfBirth = employeeInfoObject.DateOfBirth;
- // employeeDetailsForInsuranceObj.DateOfIssue = employeeInfoObject.DateOfIssue;
- // employeeDetailsForInsuranceObj.DateOfBirthGr = employeeInfoObject.DateOfBirthGr;
- // employeeDetailsForInsuranceObj.DateOfIssueGr = employeeInfoObject.DateOfIssueGr;
- // employeeDetailsForInsuranceObj.PlaceOfIssue = employeeInfoObject.PlaceOfIssue;
- // employeeDetailsForInsuranceObj.IdNumber = employeeInfoObject.IdNumber;
- // employeeDetailsForInsuranceObj.Gender = employeeInfoObject.Gender;
+ // if (_insuranceEmployeeInfoRepository.Exists(x => x.EmployeeId == item.EmployeeId))
+ // {
+ // var employeeInfoObject = _insuranceEmployeeInfoApplication.GetDetailsByEmployeeId(item.EmployeeId);
+ // employeeDetailsForInsuranceObj.InsuranceEmployeeInformationId = employeeInfoObject.Id;
+ // employeeDetailsForInsuranceObj.EmployeeId = employeeInfoObject.EmployeeId;
+ // employeeDetailsForInsuranceObj.FName = employeeInfoObject.FName;
+ // employeeDetailsForInsuranceObj.LName = employeeInfoObject.LName;
+ // employeeDetailsForInsuranceObj.FatherName = employeeInfoObject.FatherName;
+ // employeeDetailsForInsuranceObj.DateOfBirth = employeeInfoObject.DateOfBirth;
+ // employeeDetailsForInsuranceObj.DateOfIssue = employeeInfoObject.DateOfIssue;
+ // employeeDetailsForInsuranceObj.DateOfBirthGr = employeeInfoObject.DateOfBirthGr;
+ // employeeDetailsForInsuranceObj.DateOfIssueGr = employeeInfoObject.DateOfIssueGr;
+ // employeeDetailsForInsuranceObj.PlaceOfIssue = employeeInfoObject.PlaceOfIssue;
+ // employeeDetailsForInsuranceObj.IdNumber = employeeInfoObject.IdNumber;
+ // employeeDetailsForInsuranceObj.Gender = employeeInfoObject.Gender;
- // //از جدول پرسنل پر می شود
- // employeeDetailsForInsuranceObj.NationalCode = employeeObject.NationalCode; //employeeInfoObject.NationalCode;
- // employeeDetailsForInsuranceObj.Nationality = employeeObject.Nationality;
- // employeeDetailsForInsuranceObj.InsuranceCode = employeeObject.InsuranceCode; //employeeInfoObject.InsuranceCode;
- // }
- // else
- // {
- // // var employeeObject = _employeeRepository.GetDetailsByADDate(item.EmployeeId);
- // employeeDetailsForInsuranceObj.InsuranceEmployeeInformationId = 0;
- // //employeeDetailsForInsuranceObj.EmployeeInsurancListDataId = 0;
- // employeeDetailsForInsuranceObj.EmployeeId = employeeObject.Id;
- // employeeDetailsForInsuranceObj.FName = employeeObject.FName;
- // employeeDetailsForInsuranceObj.LName = employeeObject.LName;
- // employeeDetailsForInsuranceObj.FatherName = employeeObject.FatherName;
- // employeeDetailsForInsuranceObj.DateOfBirth = (employeeObject.DateOfBirth == "1300/10/11" ? "" : employeeObject.DateOfBirth);
- // employeeDetailsForInsuranceObj.DateOfIssue = employeeObject.DateOfIssue;
- // employeeDetailsForInsuranceObj.PlaceOfIssue = employeeObject.PlaceOfIssue;
- // employeeDetailsForInsuranceObj.NationalCode = employeeObject.NationalCode;
- // employeeDetailsForInsuranceObj.IdNumber = employeeObject.IdNumber;
- // employeeDetailsForInsuranceObj.Gender = employeeObject.Gender;
- // employeeDetailsForInsuranceObj.InsuranceCode = employeeObject.InsuranceCode;
- // employeeDetailsForInsuranceObj.Nationality = employeeObject.Nationality;
- // }
- // #endregion
+ // //از جدول پرسنل پر می شود
+ // employeeDetailsForInsuranceObj.NationalCode = employeeObject.NationalCode; //employeeInfoObject.NationalCode;
+ // employeeDetailsForInsuranceObj.Nationality = employeeObject.Nationality;
+ // employeeDetailsForInsuranceObj.InsuranceCode = employeeObject.InsuranceCode; //employeeInfoObject.InsuranceCode;
+ // }
+ // else
+ // {
+ // // var employeeObject = _employeeRepository.GetDetailsByADDate(item.EmployeeId);
+ // employeeDetailsForInsuranceObj.InsuranceEmployeeInformationId = 0;
+ // //employeeDetailsForInsuranceObj.EmployeeInsurancListDataId = 0;
+ // employeeDetailsForInsuranceObj.EmployeeId = employeeObject.Id;
+ // employeeDetailsForInsuranceObj.FName = employeeObject.FName;
+ // employeeDetailsForInsuranceObj.LName = employeeObject.LName;
+ // employeeDetailsForInsuranceObj.FatherName = employeeObject.FatherName;
+ // employeeDetailsForInsuranceObj.DateOfBirth = (employeeObject.DateOfBirth == "1300/10/11" ? "" : employeeObject.DateOfBirth);
+ // employeeDetailsForInsuranceObj.DateOfIssue = employeeObject.DateOfIssue;
+ // employeeDetailsForInsuranceObj.PlaceOfIssue = employeeObject.PlaceOfIssue;
+ // employeeDetailsForInsuranceObj.NationalCode = employeeObject.NationalCode;
+ // employeeDetailsForInsuranceObj.IdNumber = employeeObject.IdNumber;
+ // employeeDetailsForInsuranceObj.Gender = employeeObject.Gender;
+ // employeeDetailsForInsuranceObj.InsuranceCode = employeeObject.InsuranceCode;
+ // employeeDetailsForInsuranceObj.Nationality = employeeObject.Nationality;
+ // }
+ // #endregion
- // //روزهای کارکرد پرسنل
- // #region ComputingWorkingDays
+ // //روزهای کارکرد پرسنل
+ // #region ComputingWorkingDays
- // int startWork = 0;
- // int endWork = 0;
+ // int startWork = 0;
+ // int endWork = 0;
- // var year = Convert.ToInt32(searchModel.Year);
- // var month = Convert.ToInt32(searchModel.Month);
- // var day = 1;
- // var persianCurrentStartDate = new PersianDateTime(year, month, day);
- // var dayMonthCurrent = Convert.ToInt32(endMonthCurrent.Substring(8, 2));
- // var persianCurrentEndDate = new PersianDateTime(year, month, dayMonthCurrent);
- // //آخرین روز ماه جاری
- // var endMonthCurrentDay = Convert.ToInt32(endMonthCurrent.Substring(8, 2));
+ // var year = Convert.ToInt32(searchModel.Year);
+ // var month = Convert.ToInt32(searchModel.Month);
+ // var day = 1;
+ // var persianCurrentStartDate = new PersianDateTime(year, month, day);
+ // var dayMonthCurrent = Convert.ToInt32(endMonthCurrent.Substring(8, 2));
+ // var persianCurrentEndDate = new PersianDateTime(year, month, dayMonthCurrent);
+ // //آخرین روز ماه جاری
+ // var endMonthCurrentDay = Convert.ToInt32(endMonthCurrent.Substring(8, 2));
- // var yearStartDateUser = Convert.ToInt32(item.StartWorkDate.Substring(0, 4));
- // var monthStartDateUser = Convert.ToInt32(item.StartWorkDate.Substring(5, 2));
- // var dayStartDateUser = Convert.ToInt32(item.StartWorkDate.Substring(8, 2));
- // var persianStartDateUser = new PersianDateTime(yearStartDateUser, monthStartDateUser, dayStartDateUser);
+ // var yearStartDateUser = Convert.ToInt32(item.StartWorkDate.Substring(0, 4));
+ // var monthStartDateUser = Convert.ToInt32(item.StartWorkDate.Substring(5, 2));
+ // var dayStartDateUser = Convert.ToInt32(item.StartWorkDate.Substring(8, 2));
+ // var persianStartDateUser = new PersianDateTime(yearStartDateUser, monthStartDateUser, dayStartDateUser);
- // if (persianStartDateUser < persianCurrentStartDate)
- // employeeDetailsForInsuranceObj.HasStartWorkInMonth = false;
- // else
- // employeeDetailsForInsuranceObj.HasStartWorkInMonth = true;
+ // if (persianStartDateUser < persianCurrentStartDate)
+ // employeeDetailsForInsuranceObj.HasStartWorkInMonth = false;
+ // else
+ // employeeDetailsForInsuranceObj.HasStartWorkInMonth = true;
- // //اگر شروع به کار کاربر از ابتدای ماه جاری کمتر باشد
- // if (persianStartDateUser <= persianCurrentStartDate)
- // {
- // startWork = 1;
- // }
- // else
- // {
- // startWork = dayStartDateUser;
- // }
+ // //اگر شروع به کار کاربر از ابتدای ماه جاری کمتر باشد
+ // if (persianStartDateUser <= persianCurrentStartDate)
+ // {
+ // startWork = 1;
+ // }
+ // else
+ // {
+ // startWork = dayStartDateUser;
+ // }
- // if (!string.IsNullOrEmpty(item.LeftWorkDate))
- // {
- // var yearEndDateUser = Convert.ToInt32(item.LeftWorkDate.Substring(0, 4));
- // var monthEndDateUser = Convert.ToInt32(item.LeftWorkDate.Substring(5, 2));
- // var dayEndDateUser = Convert.ToInt32(item.LeftWorkDate.Substring(8, 2));
- // var persianLeftDateUser = new PersianDateTime(yearEndDateUser, monthEndDateUser, dayEndDateUser);
- // var persianEndDateUser = persianLeftDateUser.AddDays(-1);
- // var persianEndDateUserStr = persianLeftDateUser.AddDays(-1).ToString("yyyy/MM/dd");
+ // if (!string.IsNullOrEmpty(item.LeftWorkDate))
+ // {
+ // var yearEndDateUser = Convert.ToInt32(item.LeftWorkDate.Substring(0, 4));
+ // var monthEndDateUser = Convert.ToInt32(item.LeftWorkDate.Substring(5, 2));
+ // var dayEndDateUser = Convert.ToInt32(item.LeftWorkDate.Substring(8, 2));
+ // var persianLeftDateUser = new PersianDateTime(yearEndDateUser, monthEndDateUser, dayEndDateUser);
+ // var persianEndDateUser = persianLeftDateUser.AddDays(-1);
+ // var persianEndDateUserStr = persianLeftDateUser.AddDays(-1).ToString("yyyy/MM/dd");
- // //if (persianLeftDateUser <= persianCurrentEndDate)
- // // employeeDetailsForInsuranceObj.HasLeftWorkInMonth = true;
- // //else
- // // employeeDetailsForInsuranceObj.HasLeftWorkInMonth = false;
+ // //if (persianLeftDateUser <= persianCurrentEndDate)
+ // // employeeDetailsForInsuranceObj.HasLeftWorkInMonth = true;
+ // //else
+ // // employeeDetailsForInsuranceObj.HasLeftWorkInMonth = false;
- // //ترک کارش در ماه و سال جاری بود نمایش داده شود
- // if (!item.LeftWorkDate.Contains(searchModel.Year + "/" + searchModel.Month))
- // {
- // employeeDetailsForInsuranceObj.HasLeftWorkInMonth = false;
- // item.LeftWorkDate = string.Empty;
- // item.LeftWorkDateGr = null;
- // }
- // else
- // {
- // employeeDetailsForInsuranceObj.HasLeftWorkInMonth = true;
- // }
+ // //ترک کارش در ماه و سال جاری بود نمایش داده شود
+ // if (!item.LeftWorkDate.Contains(searchModel.Year + "/" + searchModel.Month))
+ // {
+ // employeeDetailsForInsuranceObj.HasLeftWorkInMonth = false;
+ // item.LeftWorkDate = string.Empty;
+ // item.LeftWorkDateGr = null;
+ // }
+ // else
+ // {
+ // employeeDetailsForInsuranceObj.HasLeftWorkInMonth = true;
+ // }
- // //اگر پایان به کار کاربر از پایان ماه جاری بیشتر باشد
- // if (persianEndDateUser >= persianCurrentEndDate)
- // {
- // endWork = endMonthCurrentDay;
- // }
- // else
- // {
- // endWork = Convert.ToInt32(persianEndDateUserStr.Substring(8, 2));
- // }
- // }
- // else
- // {
- // employeeDetailsForInsuranceObj.HasLeftWorkInMonth = false;
- // endWork = endMonthCurrentDay;
- // }
+ // //اگر پایان به کار کاربر از پایان ماه جاری بیشتر باشد
+ // if (persianEndDateUser >= persianCurrentEndDate)
+ // {
+ // endWork = endMonthCurrentDay;
+ // }
+ // else
+ // {
+ // endWork = Convert.ToInt32(persianEndDateUserStr.Substring(8, 2));
+ // }
+ // }
+ // else
+ // {
+ // employeeDetailsForInsuranceObj.HasLeftWorkInMonth = false;
+ // endWork = endMonthCurrentDay;
+ // }
- // int countWorkingDays = 0;
- // for (int i = startWork; i <= endWork; i++)
- // {
- // countWorkingDays = countWorkingDays + 1;
- // }
- // //farokhiChanges
- // //روزهای کارکرد پرسنل با آی دی های زیر دستی تعریف شد
- // switch (item.EmployeeId)
- // {
+ // int countWorkingDays = 0;
+ // for (int i = startWork; i <= endWork; i++)
+ // {
+ // countWorkingDays = countWorkingDays + 1;
+ // }
+ // //farokhiChanges
+ // //روزهای کارکرد پرسنل با آی دی های زیر دستی تعریف شد
+ // switch (item.EmployeeId)
+ // {
- // //case 3812://ثابت- کسری حاجی پور
- // // countWorkingDays = 15;
- // // break;
- // case 40463://ثابت
- // countWorkingDays = 10;
- // break;
- // case 40469://ثابت
- // countWorkingDays = 7;
- // break;
- // case 9950://ثابت
- // countWorkingDays = 15;
- // break;
- // case 9640://ثابت
- // countWorkingDays = 15;
- // break;
- // case 40998://ثابت
- // countWorkingDays = 15;
- // break;
- // case 6219://ثابت
- // countWorkingDays = 15;
- // break;
- // //case 7897://ثابت
- // // countWorkingDays = 15;
- // break;
- // }
- // #endregion
+ // //case 3812://ثابت- کسری حاجی پور
+ // // countWorkingDays = 15;
+ // // break;
+ // case 40463://ثابت
+ // countWorkingDays = 10;
+ // break;
+ // case 40469://ثابت
+ // countWorkingDays = 7;
+ // break;
+ // case 9950://ثابت
+ // countWorkingDays = 15;
+ // break;
+ // case 9640://ثابت
+ // countWorkingDays = 15;
+ // break;
+ // case 40998://ثابت
+ // countWorkingDays = 15;
+ // break;
+ // case 6219://ثابت
+ // countWorkingDays = 15;
+ // break;
+ // //case 7897://ثابت
+ // // countWorkingDays = 15;
+ // break;
+ // }
+ // #endregion
- // employeeDetailsForInsuranceObj.IncludeStatus = item.IncludeStatus;
+ // employeeDetailsForInsuranceObj.IncludeStatus = item.IncludeStatus;
- // #region InsuranceJob
- // double dailyWage = employeeDetailsForInsuranceObj.DailyWage;
- // if (searchModel.FixedSalary)
- // {
- // dailyWage = Convert.ToDouble(GetDailyWageFixedSalary(searchModel.Year, workshopId, item.EmployeeId, model.StartDateGr, model.EndDateGr, item.JobId, searchModel.Population, searchModel.InsuranceJobId));
- // employeeDetailsForInsuranceObj.HasConfilictJobs = (dailyWage == 0 ? true : false);
- // }
- // #endregion
+ // #region InsuranceJob
+ // double dailyWage = employeeDetailsForInsuranceObj.DailyWage;
+ // if (searchModel.FixedSalary)
+ // {
+ // dailyWage = Convert.ToDouble(GetDailyWageFixedSalary(searchModel.Year, workshopId, item.EmployeeId, model.StartDateGr, model.EndDateGr, item.JobId, searchModel.Population, searchModel.InsuranceJobId));
+ // employeeDetailsForInsuranceObj.HasConfilictJobs = (dailyWage == 0 ? true : false);
+ // }
+ // #endregion
- // if (yearlysaleries != null)
- // {
- // if (!searchModel.FixedSalary)
- // {
- // //dailyWage= yearlysalaryItem.ItemValue;
- // dailyWage = ComputeDailyWage(yearlysaleries.DayliWage, item.EmployeeId, workshopId, searchModel.Year);
- // //(double basic, int totalYears) basicResult = BasicYear(item.EmployeeId, workshopId, startDate);
- // //var basic = basicResult.basic;
+ // if (yearlysaleries != null)
+ // {
+ // if (!searchModel.FixedSalary)
+ // {
+ // //dailyWage= yearlysalaryItem.ItemValue;
+ // dailyWage = ComputeDailyWage(yearlysaleries.DayliWage, item.EmployeeId, workshopId, searchModel.Year);
+ // //(double basic, int totalYears) basicResult = BasicYear(item.EmployeeId, workshopId, startDate);
+ // //var basic = basicResult.basic;
- // //if (basicResult.totalYears > 0)
- // //{
- // // monthlybaseYear = GetMonthlyBaseYear(basicResult.basic, countWorkingDays);
- // //}
- // }
- // employeeDetailsForInsuranceObj.DailyWage = GetRoundValue(dailyWage);
- // employeeDetailsForInsuranceObj.BaseYears = 0;
+ // //if (basicResult.totalYears > 0)
+ // //{
+ // // monthlybaseYear = GetMonthlyBaseYear(basicResult.basic, countWorkingDays);
+ // //}
+ // }
+ // employeeDetailsForInsuranceObj.DailyWage = GetRoundValue(dailyWage);
+ // employeeDetailsForInsuranceObj.BaseYears = 0;
- // employeeDetailsForInsuranceObj.DailyWageStr = employeeDetailsForInsuranceObj.DailyWage.ToMoney();
- // employeeDetailsForInsuranceObj.DailyWagePlusBaseYears = 0;
- // employeeDetailsForInsuranceObj.MonthlySalary = GetRoundValue(dailyWage * countWorkingDays);
- // employeeDetailsForInsuranceObj.HousingAllowance = yearlysaleries.HousingAllowance;
- // employeeDetailsForInsuranceObj.ConsumableItems = yearlysaleries.ConsumableItems;
- // employeeDetailsForInsuranceObj.EndMonthCurrentDay = endMonthCurrentDay;
- // employeeDetailsForInsuranceObj.YearlySalaryItem = yearlysaleries.DayliWage;
- // employeeDetailsForInsuranceObj.MonthlyBaseYearsStr = monthlybaseYear.ToMoney();
+ // employeeDetailsForInsuranceObj.DailyWageStr = employeeDetailsForInsuranceObj.DailyWage.ToMoney();
+ // employeeDetailsForInsuranceObj.DailyWagePlusBaseYears = 0;
+ // employeeDetailsForInsuranceObj.MonthlySalary = GetRoundValue(dailyWage * countWorkingDays);
+ // employeeDetailsForInsuranceObj.HousingAllowance = yearlysaleries.HousingAllowance;
+ // employeeDetailsForInsuranceObj.ConsumableItems = yearlysaleries.ConsumableItems;
+ // employeeDetailsForInsuranceObj.EndMonthCurrentDay = endMonthCurrentDay;
+ // employeeDetailsForInsuranceObj.YearlySalaryItem = yearlysaleries.DayliWage;
+ // employeeDetailsForInsuranceObj.MonthlyBaseYearsStr = monthlybaseYear.ToMoney();
- // employeeDetailsForInsuranceObj.MarriedAllowance = 0;
+ // employeeDetailsForInsuranceObj.MarriedAllowance = 0;
- // if (item.IncludeStatus)
- // {
- // var marital = employeeObject.MaritalStatus == "متاهل" ? yearlysaleries.MarriedAllowance : 0;
- // employeeDetailsForInsuranceObj.MonthlyBenefits = GetMonthlyBenefits(endMonthCurrentDay, yearlysaleries.ConsumableItems, yearlysaleries.HousingAllowance, marital, countWorkingDays, searchModel.TypeOfInsuranceSendWorkshop, item.JobId, item.EmployeeId);
- // }
- // else
- // {
- // employeeDetailsForInsuranceObj.MonthlyBenefits = 0;
- // }
+ // if (item.IncludeStatus)
+ // {
+ // var marital = employeeObject.MaritalStatus == "متاهل" ? yearlysaleries.MarriedAllowance : 0;
+ // employeeDetailsForInsuranceObj.MonthlyBenefits = GetMonthlyBenefits(endMonthCurrentDay, yearlysaleries.ConsumableItems, yearlysaleries.HousingAllowance, marital, countWorkingDays, searchModel.TypeOfInsuranceSendWorkshop, item.JobId, item.EmployeeId);
+ // }
+ // else
+ // {
+ // employeeDetailsForInsuranceObj.MonthlyBenefits = 0;
+ // }
- // if (searchModel.TypeOfInsuranceSendWorkshop == "Govermentlist" && item.JobId == 10) //کمک دولت
- // {
- // employeeDetailsForInsuranceObj.MonthlyBenefits = 0;
- // }
- // //farokhiChanges
- // if (item.EmployeeId == 42783)
- // employeeDetailsForInsuranceObj.MonthlyBenefits = 53082855;
+ // if (searchModel.TypeOfInsuranceSendWorkshop == "Govermentlist" && item.JobId == 10) //کمک دولت
+ // {
+ // employeeDetailsForInsuranceObj.MonthlyBenefits = 0;
+ // }
+ // //farokhiChanges
+ // if (item.EmployeeId == 42783)
+ // employeeDetailsForInsuranceObj.MonthlyBenefits = 53082855;
- // employeeDetailsForInsuranceObj.BenefitsIncludedContinuous = employeeDetailsForInsuranceObj.MonthlyBenefits + employeeDetailsForInsuranceObj.MonthlySalary;
+ // employeeDetailsForInsuranceObj.BenefitsIncludedContinuous = employeeDetailsForInsuranceObj.MonthlyBenefits + employeeDetailsForInsuranceObj.MonthlySalary;
- // //حق بیمه سهم بیمه شده
- // var insuranceShare = (employeeDetailsForInsuranceObj.BenefitsIncludedContinuous * 7) / 100;
- // employeeDetailsForInsuranceObj.InsuranceShare = GetRoundValue(insuranceShare); //Math.Round(insuranceShare, MidpointRounding.ToPositiveInfinity);
+ // //حق بیمه سهم بیمه شده
+ // var insuranceShare = (employeeDetailsForInsuranceObj.BenefitsIncludedContinuous * 7) / 100;
+ // employeeDetailsForInsuranceObj.InsuranceShare = GetRoundValue(insuranceShare); //Math.Round(insuranceShare, MidpointRounding.ToPositiveInfinity);
- // //حق بیمه سهم کارفرما
- // var employerShare = (employeeDetailsForInsuranceObj.BenefitsIncludedContinuous * 20) / 100;
- // employeeDetailsForInsuranceObj.EmployerShare = GetRoundValue(employerShare); //Math.Round(employerShare, MidpointRounding.ToPositiveInfinity);
+ // //حق بیمه سهم کارفرما
+ // var employerShare = (employeeDetailsForInsuranceObj.BenefitsIncludedContinuous * 20) / 100;
+ // employeeDetailsForInsuranceObj.EmployerShare = GetRoundValue(employerShare); //Math.Round(employerShare, MidpointRounding.ToPositiveInfinity);
- // //if (searchModel.TypeOfInsuranceSendWorkshop == "Govermentlist" && item.JobId==10)//کمک دولت
- // //{employeeDetailsForInsuranceObj.InsuranceShare = 0;}
+ // //if (searchModel.TypeOfInsuranceSendWorkshop == "Govermentlist" && item.JobId==10)//کمک دولت
+ // //{employeeDetailsForInsuranceObj.InsuranceShare = 0;}
- // var unEmploymentInsurance = (employeeDetailsForInsuranceObj.BenefitsIncludedContinuous * 3) / 100;
- // employeeDetailsForInsuranceObj.UnEmploymentInsurance = GetRoundValue(unEmploymentInsurance);
+ // var unEmploymentInsurance = (employeeDetailsForInsuranceObj.BenefitsIncludedContinuous * 3) / 100;
+ // employeeDetailsForInsuranceObj.UnEmploymentInsurance = GetRoundValue(unEmploymentInsurance);
- // employeeDetailsForInsuranceObj.BenefitsIncludedNonContinuous = employeeDetailsForInsuranceObj.BenefitsIncludedNonContinuous;
- // employeeDetailsForInsuranceObj.IncludedAndNotIncluded = employeeDetailsForInsuranceObj.BenefitsIncludedNonContinuous + employeeDetailsForInsuranceObj.BenefitsIncludedContinuous;
+ // employeeDetailsForInsuranceObj.BenefitsIncludedNonContinuous = employeeDetailsForInsuranceObj.BenefitsIncludedNonContinuous;
+ // employeeDetailsForInsuranceObj.IncludedAndNotIncluded = employeeDetailsForInsuranceObj.BenefitsIncludedNonContinuous + employeeDetailsForInsuranceObj.BenefitsIncludedContinuous;
- // }
+ // }
- // employeeDetailsForInsuranceObj.StartMonthCurrent = startMonthCurrent;
- // employeeDetailsForInsuranceObj.WorkingDays = countWorkingDays;
- // employeeDetailsForInsuranceObj.StartWorkDate = item.StartWorkDate;
- // employeeDetailsForInsuranceObj.LeftWorkDate = item.LeftWorkDate;
- // employeeDetailsForInsuranceObj.JobId = item.JobId;
- // employeeDetailsForInsuranceObj.JobName = item.JobName;
- // employeeDetailsForInsuranceObj.JobCode = item.JobCode;
- // if (!string.IsNullOrWhiteSpace(item.LeftWorkDate))
- // employeeDetailsForInsuranceObj.LeftWorkDateGr = item.LeftWorkDateGr;
+ // employeeDetailsForInsuranceObj.StartMonthCurrent = startMonthCurrent;
+ // employeeDetailsForInsuranceObj.WorkingDays = countWorkingDays;
+ // employeeDetailsForInsuranceObj.StartWorkDate = item.StartWorkDate;
+ // employeeDetailsForInsuranceObj.LeftWorkDate = item.LeftWorkDate;
+ // employeeDetailsForInsuranceObj.JobId = item.JobId;
+ // employeeDetailsForInsuranceObj.JobName = item.JobName;
+ // employeeDetailsForInsuranceObj.JobCode = item.JobCode;
+ // if (!string.IsNullOrWhiteSpace(item.LeftWorkDate))
+ // employeeDetailsForInsuranceObj.LeftWorkDateGr = item.LeftWorkDateGr;
- // employeeDetailsForInsuranceObj.StartWorkDateGr = item.StartWorkDateGr;
- // //farokhiChanges
- // if (item.EmployeeId == 42783)
- // employeeDetailsForInsuranceObj.MonthlyBenefits = 53082855;
+ // employeeDetailsForInsuranceObj.StartWorkDateGr = item.StartWorkDateGr;
+ // //farokhiChanges
+ // if (item.EmployeeId == 42783)
+ // employeeDetailsForInsuranceObj.MonthlyBenefits = 53082855;
- // list.Add(employeeDetailsForInsuranceObj);
- //}
+ // list.Add(employeeDetailsForInsuranceObj);
+ //}
- //result.EmployeeDetailsForInsuranceList = list.OrderByDescending(x => x.HasLeftWorkInMonth).ThenByDescending(x => x.HasStartWorkInMonth)
- // .ThenBy(x => x.LName).ToList();
+ //result.EmployeeDetailsForInsuranceList = list.OrderByDescending(x => x.HasLeftWorkInMonth).ThenByDescending(x => x.HasStartWorkInMonth)
+ // .ThenBy(x => x.LName).ToList();
- #endregion
+ #endregion
- result.EmployeeDetailsForInsuranceList = computeResult.OrderByDescending(x => x.HasLeftWorkInMonth).ThenByDescending(x => x.HasStartWorkInMonth)
- .ThenBy(x => x.LName).ToList();
- Console.WriteLine("ToList compute : " + watch.Elapsed);
- result.IsExist = false;
- result.IsBlock = isBolock;
- result.MaritalStatus = yearlysaleries.MarriedAllowance;
+ result.EmployeeDetailsForInsuranceList = computeResult.OrderByDescending(x => x.HasLeftWorkInMonth).ThenByDescending(x => x.HasStartWorkInMonth)
+ .ThenBy(x => x.LName).ToList();
+ Console.WriteLine("ToList compute : " + watch.Elapsed);
+ result.IsExist = false;
+ result.IsBlock = isBolock;
+ result.MaritalStatus = yearlysaleries.MarriedAllowance;
}
else
@@ -951,205 +961,206 @@ public class InsuranceListApplication: IInsuranceListApplication
result.IsExist = true;
result.IsBlock = isBolock;
}
-
+
return result;
}
- public double MarriedAllowance(string maritalStatus,long jobId, bool includedStatus,
- int countWorkingDays, double marriedAlowance,int endMonthCurrentDay)
+ public double MarriedAllowance(string maritalStatus, long jobId, bool includedStatus,
+ int countWorkingDays, double marriedAlowance, int endMonthCurrentDay)
{
- bool isManager = jobId is 10 or 16 or 17 or 18 or 3498;
- if (isManager)//اگر مدیر عامل بود
- return 0;
- if (maritalStatus != "متاهل")//اگر مجرد بود
- return 0;
-
- if(countWorkingDays == endMonthCurrentDay)
- return (marriedAlowance);
+ bool isManager = jobId is 10 or 16 or 17 or 18 or 3498;
+ if (isManager)//اگر مدیر عامل بود
+ return 0;
+ if (maritalStatus != "متاهل")//اگر مجرد بود
+ return 0;
+
+ if (countWorkingDays == endMonthCurrentDay)
+ return (marriedAlowance);
return endMonthCurrentDay switch
{
- 29 => GetRoundValue((marriedAlowance / 29) * countWorkingDays),
- 30 => GetRoundValue((marriedAlowance / 30) * countWorkingDays),
- 31 => GetRoundValue((marriedAlowance / 31) * countWorkingDays),
- _ => marriedAlowance
+ 29 => GetRoundValue((marriedAlowance / 29) * countWorkingDays),
+ 30 => GetRoundValue((marriedAlowance / 30) * countWorkingDays),
+ 31 => GetRoundValue((marriedAlowance / 31) * countWorkingDays),
+ _ => marriedAlowance
};
}
- public OperationResult CreateEmployeeDetailsInfo(EmployeeDetailsForInsuranceListViewModel command)
- {
- var result = new OperationResult();
- try
- {
- //_transactionManager.BeginTransaction();
+ public OperationResult CreateEmployeeDetailsInfo(EmployeeDetailsForInsuranceListViewModel command)
+ {
+ var result = new OperationResult();
- var createInsuranceEmployeeInfo = new CreateInsuranceEmployeeInfo();
- createInsuranceEmployeeInfo.EmployeeId = command.EmployeeId;
- createInsuranceEmployeeInfo.FName = command.FName;
- createInsuranceEmployeeInfo.LName = command.LName;
- createInsuranceEmployeeInfo.FatherName = command.FatherName;
- createInsuranceEmployeeInfo.PlaceOfIssue = command.PlaceOfIssue;
- createInsuranceEmployeeInfo.NationalCode = command.NationalCode;
- createInsuranceEmployeeInfo.IdNumber = command.IdNumber;
- createInsuranceEmployeeInfo.Gender = command.Gender;
- createInsuranceEmployeeInfo.InsuranceCode = command.InsuranceCode;
- createInsuranceEmployeeInfo.DateOfBirthGr = command.DateOfBirth.ToGeorgianDateTime();
- createInsuranceEmployeeInfo.DateOfIssueGr = command.DateOfIssue.ToGeorgianDateTime();
- result = _insuranceEmployeeInfoApplication.Create(createInsuranceEmployeeInfo);
+ try
+ {
+ //_transactionManager.BeginTransaction();
- //var createEmployeeInsuranceListData = new CreateEmployeeInsurancListData();
- //createEmployeeInsuranceListData.InsuranceListId = command.InsuranceListId;
- //createEmployeeInsuranceListData.EmployeeId = command.EmployeeId;
- ////روزهای کارکرد پرسنل
- //createEmployeeInsuranceListData.WorkingDays = command.WorkingDays;
- //// دستمزد روزانه
- //createEmployeeInsuranceListData.DailyWage = command.DailyWage;
- ////دستمزد ماهانه
- //createEmployeeInsuranceListData.MonthlySalary = command.MonthlySalary;
- ////مزایای ماهانه
- //createEmployeeInsuranceListData.MonthlyBenefits = command.MonthlyBenefits;
- ////دستمزد و مزایای ماهانه مشمول
- //createEmployeeInsuranceListData.MonthlyBenefitsIncluded = command.MonthlyBenefitsIncluded;
- //// مزایای مشمول مستمر
- //createEmployeeInsuranceListData.BenefitsIncludedContinuous = command.BenefitsIncludedContinuous;
- ////مزایای مشمول غیر مستمر
- //createEmployeeInsuranceListData.BenefitsIncludedNonContinuous = command.BenefitsIncludedNonContinuous;
- ////سهم بیمه حق کارگر
- //createEmployeeInsuranceListData.InsuranceShare = command.InsuranceShare;
- //// تاریخ شروع به کار
- //createEmployeeInsuranceListData.StartWorkDate = command.StartWorkDate.ToGeorgian();
- ////تاریخ ترک کار
- //if()
- //createEmployeeInsuranceListData.LeftWorkDate = command.LeftWorkDate.ToGeorgian();
- //// آی دی شغل
- //createEmployeeInsuranceListData.JobId = command.JobId;
- //result = _employeeInsurancListDataApplication.Create(createEmployeeInsuranceListData);
+ var createInsuranceEmployeeInfo = new CreateInsuranceEmployeeInfo();
+ createInsuranceEmployeeInfo.EmployeeId = command.EmployeeId;
+ createInsuranceEmployeeInfo.FName = command.FName;
+ createInsuranceEmployeeInfo.LName = command.LName;
+ createInsuranceEmployeeInfo.FatherName = command.FatherName;
+ createInsuranceEmployeeInfo.PlaceOfIssue = command.PlaceOfIssue;
+ createInsuranceEmployeeInfo.NationalCode = command.NationalCode;
+ createInsuranceEmployeeInfo.IdNumber = command.IdNumber;
+ createInsuranceEmployeeInfo.Gender = command.Gender;
+ createInsuranceEmployeeInfo.InsuranceCode = command.InsuranceCode;
+ createInsuranceEmployeeInfo.DateOfBirthGr = command.DateOfBirth.ToGeorgianDateTime();
+ createInsuranceEmployeeInfo.DateOfIssueGr = command.DateOfIssue.ToGeorgianDateTime();
+ result = _insuranceEmployeeInfoApplication.Create(createInsuranceEmployeeInfo);
- // _transactionManager.CommitTransaction();
- }
- catch (Exception ex)
- {
- result.IsSuccedded = false;
- result.Message = "ثبت اطلاعات با خطا مواجه شد";
- // _transactionManager.RollbackTransaction();
- }
+ //var createEmployeeInsuranceListData = new CreateEmployeeInsurancListData();
+ //createEmployeeInsuranceListData.InsuranceListId = command.InsuranceListId;
+ //createEmployeeInsuranceListData.EmployeeId = command.EmployeeId;
+ ////روزهای کارکرد پرسنل
+ //createEmployeeInsuranceListData.WorkingDays = command.WorkingDays;
+ //// دستمزد روزانه
+ //createEmployeeInsuranceListData.DailyWage = command.DailyWage;
+ ////دستمزد ماهانه
+ //createEmployeeInsuranceListData.MonthlySalary = command.MonthlySalary;
+ ////مزایای ماهانه
+ //createEmployeeInsuranceListData.MonthlyBenefits = command.MonthlyBenefits;
+ ////دستمزد و مزایای ماهانه مشمول
+ //createEmployeeInsuranceListData.MonthlyBenefitsIncluded = command.MonthlyBenefitsIncluded;
+ //// مزایای مشمول مستمر
+ //createEmployeeInsuranceListData.BenefitsIncludedContinuous = command.BenefitsIncludedContinuous;
+ ////مزایای مشمول غیر مستمر
+ //createEmployeeInsuranceListData.BenefitsIncludedNonContinuous = command.BenefitsIncludedNonContinuous;
+ ////سهم بیمه حق کارگر
+ //createEmployeeInsuranceListData.InsuranceShare = command.InsuranceShare;
+ //// تاریخ شروع به کار
+ //createEmployeeInsuranceListData.StartWorkDate = command.StartWorkDate.ToGeorgian();
+ ////تاریخ ترک کار
+ //if()
+ //createEmployeeInsuranceListData.LeftWorkDate = command.LeftWorkDate.ToGeorgian();
+ //// آی دی شغل
+ //createEmployeeInsuranceListData.JobId = command.JobId;
+ //result = _employeeInsurancListDataApplication.Create(createEmployeeInsuranceListData);
- return result;
+ // _transactionManager.CommitTransaction();
+ }
+ catch (Exception ex)
+ {
+ result.IsSuccedded = false;
+ result.Message = "ثبت اطلاعات با خطا مواجه شد";
+ // _transactionManager.RollbackTransaction();
+ }
- }
+ return result;
- public OperationResult EditEmployeeDetailsInfo(EmployeeDetailsForInsuranceListViewModel command)
- {
- var result = new OperationResult();
+ }
- try
- {
- //_transactionManager.BeginTransaction();
- var insuranceEmployeeInfo = new EditInsuranceEmployeeInfo();
- insuranceEmployeeInfo.Id = command.InsuranceEmployeeInformationId;
- insuranceEmployeeInfo.EmployeeId = command.EmployeeId;
- insuranceEmployeeInfo.FName = command.FName;
- insuranceEmployeeInfo.LName = command.LName;
- insuranceEmployeeInfo.FatherName = command.FatherName;
- insuranceEmployeeInfo.PlaceOfIssue = command.PlaceOfIssue;
- insuranceEmployeeInfo.NationalCode = command.NationalCode;
- insuranceEmployeeInfo.IdNumber = command.IdNumber;
- insuranceEmployeeInfo.Gender = command.Gender;
- insuranceEmployeeInfo.InsuranceCode = command.InsuranceCode;
- insuranceEmployeeInfo.DateOfBirthGr = command.DateOfBirth.ToGeorgianDateTime();
- insuranceEmployeeInfo.DateOfIssueGr = command.DateOfIssue.ToGeorgianDateTime();
- result = _insuranceEmployeeInfoApplication.Edit(insuranceEmployeeInfo);
+ public OperationResult EditEmployeeDetailsInfo(EmployeeDetailsForInsuranceListViewModel command)
+ {
+ var result = new OperationResult();
+
+ try
+ {
+ //_transactionManager.BeginTransaction();
+ var insuranceEmployeeInfo = new EditInsuranceEmployeeInfo();
+ insuranceEmployeeInfo.Id = command.InsuranceEmployeeInformationId;
+ insuranceEmployeeInfo.EmployeeId = command.EmployeeId;
+ insuranceEmployeeInfo.FName = command.FName;
+ insuranceEmployeeInfo.LName = command.LName;
+ insuranceEmployeeInfo.FatherName = command.FatherName;
+ insuranceEmployeeInfo.PlaceOfIssue = command.PlaceOfIssue;
+ insuranceEmployeeInfo.NationalCode = command.NationalCode;
+ insuranceEmployeeInfo.IdNumber = command.IdNumber;
+ insuranceEmployeeInfo.Gender = command.Gender;
+ insuranceEmployeeInfo.InsuranceCode = command.InsuranceCode;
+ insuranceEmployeeInfo.DateOfBirthGr = command.DateOfBirth.ToGeorgianDateTime();
+ insuranceEmployeeInfo.DateOfIssueGr = command.DateOfIssue.ToGeorgianDateTime();
+ result = _insuranceEmployeeInfoApplication.Edit(insuranceEmployeeInfo);
- // var createEmployeeInsuranceListData = new EditEmployeeInsurancListData();
- // createEmployeeInsuranceListData.InsuranceListId = command.InsuranceListId;
- //// createEmployeeInsuranceListData.Id = command.EmployeeInsurancListDataId;
- // createEmployeeInsuranceListData.EmployeeId = command.EmployeeId;
- // //روزهای کارکرد پرسنل
- // createEmployeeInsuranceListData.WorkingDays = command.WorkingDays;
- // // دستمزد روزانه
- // createEmployeeInsuranceListData.DailyWage = command.DailyWage;
- // //دستمزد ماهانه
- // createEmployeeInsuranceListData.MonthlySalary = command.MonthlySalary;
- // //مزایای ماهانه
- // createEmployeeInsuranceListData.MonthlyBenefits = command.MonthlyBenefits;
- // //دستمزد و مزایای ماهانه مشمول
- // createEmployeeInsuranceListData.MonthlyBenefitsIncluded = command.MonthlyBenefitsIncluded;
- // // مزایای مشمول مستمر
- // createEmployeeInsuranceListData.BenefitsIncludedContinuous = command.BenefitsIncludedContinuous;
- // //مزایای مشمول غیر مستمر
- // createEmployeeInsuranceListData.BenefitsIncludedNonContinuous = command.BenefitsIncludedNonContinuous;
- // //سهم بیمه حق کارگر
- // createEmployeeInsuranceListData.InsuranceShare = command.InsuranceShare;
- // // تاریخ شروع به کار
- // createEmployeeInsuranceListData.StartWorkDate = command.StartWorkDate.ToGeorgian();
- // //تاریخ ترک کار
- // createEmployeeInsuranceListData.LeftWorkDate = command.LeftWorkDate.ToGeorgian();
- // // آی دی شغل
- // createEmployeeInsuranceListData.JobId = command.JobId;
- // result = _employeeInsurancListDataApplication.Edit(createEmployeeInsuranceListData);
+ // var createEmployeeInsuranceListData = new EditEmployeeInsurancListData();
+ // createEmployeeInsuranceListData.InsuranceListId = command.InsuranceListId;
+ //// createEmployeeInsuranceListData.Id = command.EmployeeInsurancListDataId;
+ // createEmployeeInsuranceListData.EmployeeId = command.EmployeeId;
+ // //روزهای کارکرد پرسنل
+ // createEmployeeInsuranceListData.WorkingDays = command.WorkingDays;
+ // // دستمزد روزانه
+ // createEmployeeInsuranceListData.DailyWage = command.DailyWage;
+ // //دستمزد ماهانه
+ // createEmployeeInsuranceListData.MonthlySalary = command.MonthlySalary;
+ // //مزایای ماهانه
+ // createEmployeeInsuranceListData.MonthlyBenefits = command.MonthlyBenefits;
+ // //دستمزد و مزایای ماهانه مشمول
+ // createEmployeeInsuranceListData.MonthlyBenefitsIncluded = command.MonthlyBenefitsIncluded;
+ // // مزایای مشمول مستمر
+ // createEmployeeInsuranceListData.BenefitsIncludedContinuous = command.BenefitsIncludedContinuous;
+ // //مزایای مشمول غیر مستمر
+ // createEmployeeInsuranceListData.BenefitsIncludedNonContinuous = command.BenefitsIncludedNonContinuous;
+ // //سهم بیمه حق کارگر
+ // createEmployeeInsuranceListData.InsuranceShare = command.InsuranceShare;
+ // // تاریخ شروع به کار
+ // createEmployeeInsuranceListData.StartWorkDate = command.StartWorkDate.ToGeorgian();
+ // //تاریخ ترک کار
+ // createEmployeeInsuranceListData.LeftWorkDate = command.LeftWorkDate.ToGeorgian();
+ // // آی دی شغل
+ // createEmployeeInsuranceListData.JobId = command.JobId;
+ // result = _employeeInsurancListDataApplication.Edit(createEmployeeInsuranceListData);
- // _transactionManager.CommitTransaction();
- }
- catch (Exception ex)
- {
- result.IsSuccedded = false;
- result.Message = "ثبت اطلاعات با خطا مواجه شد";
- // _transactionManager.RollbackTransaction();
- }
+ // _transactionManager.CommitTransaction();
+ }
+ catch (Exception ex)
+ {
+ result.IsSuccedded = false;
+ result.Message = "ثبت اطلاعات با خطا مواجه شد";
+ // _transactionManager.RollbackTransaction();
+ }
- return result;
+ return result;
- }
+ }
- public OperationResult Remove(long id)
- {
- return _insuranceListRepositpry.Remove(id);
- }
+ public OperationResult Remove(long id)
+ {
+ return _insuranceListRepositpry.Remove(id);
+ }
- public EditInsuranceList GetDetailsForEdit(long id)
- {
- var insuranceListDetails = _insuranceListRepositpry.GetDetailsForEdit(id);
- //string startMonthCurrent = insuranceListDetails.Year + "/" + insuranceListDetails.Month + "/01";
- //string endMonthCurrent = startMonthCurrent.FindeEndOfMonth();
- //var dayMonthCurrent = Convert.ToInt32(endMonthCurrent.Substring(8, 2));
- //var year = Convert.ToInt32(insuranceListDetails.Year);
- //var month = Convert.ToInt32(insuranceListDetails.Month);
- //var day = 1;
- //var persianCurrentStartDate = new PersianDateTime(year, month, day);
- //var persianCurrentEndDate = new PersianDateTime(year, month, dayMonthCurrent);
+ public EditInsuranceList GetDetailsForEdit(long id)
+ {
+ var insuranceListDetails = _insuranceListRepositpry.GetDetailsForEdit(id);
+ //string startMonthCurrent = insuranceListDetails.Year + "/" + insuranceListDetails.Month + "/01";
+ //string endMonthCurrent = startMonthCurrent.FindeEndOfMonth();
+ //var dayMonthCurrent = Convert.ToInt32(endMonthCurrent.Substring(8, 2));
+ //var year = Convert.ToInt32(insuranceListDetails.Year);
+ //var month = Convert.ToInt32(insuranceListDetails.Month);
+ //var day = 1;
+ //var persianCurrentStartDate = new PersianDateTime(year, month, day);
+ //var persianCurrentEndDate = new PersianDateTime(year, month, dayMonthCurrent);
- //var model = new YearlySalarySearchModel();
- //model.StartDateGr = startMonthCurrent.ToGeorgianDateTime();
- //model.EndDateGr = endMonthCurrent.ToGeorgianDateTime();
- //model.year = insuranceListDetails.Year;
- //var yearSalaryObj = _yearlySalaryApplication.GetDetailsBySearchModel(model);
- //var yearlysalaryItem = new YearlysalaryItemViewModel();
- //var housingAllowance = new YearlysalaryItemViewModel();
- //var consumableItems = new YearlysalaryItemViewModel();
- //if (yearSalaryObj != null)
- //{
- // yearlysalaryItem = _yearlySalaryItemApplication.GetItemsByYearlySalaryId(yearSalaryObj.Id)
- // .Where(x => x.ItemName == "مزد روزانه").FirstOrDefault();
- // housingAllowance = _yearlySalaryItemApplication.GetItemsByYearlySalaryId(yearSalaryObj.Id)
- // .Where(x => x.ItemName == "کمک هزینه مسکن").FirstOrDefault();
- // consumableItems = _yearlySalaryItemApplication.GetItemsByYearlySalaryId(yearSalaryObj.Id)
- // .Where(x => x.ItemName == "کمک هزینه اقلام").FirstOrDefault();
- //}
+ //var model = new YearlySalarySearchModel();
+ //model.StartDateGr = startMonthCurrent.ToGeorgianDateTime();
+ //model.EndDateGr = endMonthCurrent.ToGeorgianDateTime();
+ //model.year = insuranceListDetails.Year;
+ //var yearSalaryObj = _yearlySalaryApplication.GetDetailsBySearchModel(model);
+ //var yearlysalaryItem = new YearlysalaryItemViewModel();
+ //var housingAllowance = new YearlysalaryItemViewModel();
+ //var consumableItems = new YearlysalaryItemViewModel();
+ //if (yearSalaryObj != null)
+ //{
+ // yearlysalaryItem = _yearlySalaryItemApplication.GetItemsByYearlySalaryId(yearSalaryObj.Id)
+ // .Where(x => x.ItemName == "مزد روزانه").FirstOrDefault();
+ // housingAllowance = _yearlySalaryItemApplication.GetItemsByYearlySalaryId(yearSalaryObj.Id)
+ // .Where(x => x.ItemName == "کمک هزینه مسکن").FirstOrDefault();
+ // consumableItems = _yearlySalaryItemApplication.GetItemsByYearlySalaryId(yearSalaryObj.Id)
+ // .Where(x => x.ItemName == "کمک هزینه اقلام").FirstOrDefault();
+ //}
- return insuranceListDetails;
- }
+ return insuranceListDetails;
+ }
public double GetRoundValue(double value)
{
string strValue = value.ToString();
if (strValue.IndexOf('.') > -1)
{
-
- string a = strValue.Substring(strValue.IndexOf('.')+1, 1);
+
+ string a = strValue.Substring(strValue.IndexOf('.') + 1, 1);
if (int.Parse(a) > 5)
{
return (Math.Round(value, MidpointRounding.ToPositiveInfinity));
@@ -1160,33 +1171,33 @@ public class InsuranceListApplication: IInsuranceListApplication
}
}
- return value;
- }
+ return value;
+ }
//محاسبه پرسنل در جدول - DSKWOR EDIT
public MainEmployeeDetailsViewModel SearchEmployeeListForEditByInsuranceListId(EmployeeForEditInsuranceListSearchModel searchModel)
{
- var mainEmployeeDetailsViewModel= new MainEmployeeDetailsViewModel();
- var mainEmployeeDetailsViewModel2= new MainEmployeeDetailsViewModel();
- var mainEmployeeDetailsViewModelForNewPersonel= new MainEmployeeDetailsViewModel();
+ var mainEmployeeDetailsViewModel = new MainEmployeeDetailsViewModel();
+ var mainEmployeeDetailsViewModel2 = new MainEmployeeDetailsViewModel();
+ var mainEmployeeDetailsViewModelForNewPersonel = new MainEmployeeDetailsViewModel();
- List ids = searchModel.WorkshopIds.Where(x=>x!=searchModel.WorkshopId).ToList();
+ List ids = searchModel.WorkshopIds.Where(x => x != searchModel.WorkshopId).ToList();
searchModel.Month = searchModel.Month.PadLeft(2, '0');
- if (!_insuranceListRepositpry.Exists(x => x.Year == searchModel.Year && x.Month == searchModel.Month && (ids!=null && ids.Count > 0 && ids.Contains(x.WorkshopId))))
+ if (!_insuranceListRepositpry.Exists(x => x.Year == searchModel.Year && x.Month == searchModel.Month && (ids != null && ids.Count > 0 && ids.Contains(x.WorkshopId))))
{
- mainEmployeeDetailsViewModel = _insuranceListRepositpry.SearchEmployeeListForEditByInsuranceListId(searchModel);
+ mainEmployeeDetailsViewModel = _insuranceListRepositpry.SearchEmployeeListForEditByInsuranceListId(searchModel);
- var employeeForCreateInsurance = new EmployeeForCreateInsuranceListSearchModel();
- employeeForCreateInsurance.Month = searchModel.Month;
- employeeForCreateInsurance.Year = searchModel.Year;
- employeeForCreateInsurance.WorkshopIds = ids;
- #region OtherWorkshop
- if (ids != null && ids.Count > 0)//اگر ورکشاپهای دیگر را انتخاب کرد
- {
- mainEmployeeDetailsViewModel2 = SearchEmployeeForCreateInsuranceList(employeeForCreateInsurance);
- }
- #endregion
+ var employeeForCreateInsurance = new EmployeeForCreateInsuranceListSearchModel();
+ employeeForCreateInsurance.Month = searchModel.Month;
+ employeeForCreateInsurance.Year = searchModel.Year;
+ employeeForCreateInsurance.WorkshopIds = ids;
+ #region OtherWorkshop
+ if (ids != null && ids.Count > 0)//اگر ورکشاپهای دیگر را انتخاب کرد
+ {
+ mainEmployeeDetailsViewModel2 = SearchEmployeeForCreateInsuranceList(employeeForCreateInsurance);
+ }
+ #endregion
#region NewPersonel
@@ -1194,11 +1205,11 @@ public class InsuranceListApplication: IInsuranceListApplication
var searchModelForCreate = new EmployeeForCreateInsuranceListSearchModel();
searchModelForCreate.Month = searchModel.Month;
searchModelForCreate.Year = searchModel.Year;
- searchModelForCreate.WorkshopIds=new List(){ searchModel.WorkshopId };
+ searchModelForCreate.WorkshopIds = new List() { searchModel.WorkshopId };
var leftWorkInsuranceViewModelList = _leftWorkInsuranceApplication.SearchForCreateInsuranceList(searchModelForCreate);
var newEmployeeId = leftWorkInsuranceViewModelList.Select(x => x.EmployeeId).ToList();
var oldEmployeeId = mainEmployeeDetailsViewModel.EmployeeDetailsForInsuranceList.Select(x => x.EmployeeId).ToList();
- if(!newEmployeeId.SequenceEqual(oldEmployeeId))
+ if (!newEmployeeId.SequenceEqual(oldEmployeeId))
{
var employeeAddIds = new List();
var employeeRemoveIds = new List();
@@ -1223,24 +1234,24 @@ public class InsuranceListApplication: IInsuranceListApplication
if (employeeAddIds != null && employeeAddIds.Count > 0)
{
leftWorkInsuranceViewModelList = leftWorkInsuranceViewModelList.Where(x => employeeAddIds.Contains(x.EmployeeId)).ToList();
- mainEmployeeDetailsViewModelForNewPersonel = GetEmployeeForInsuranceList(leftWorkInsuranceViewModelList,searchModel);
+ mainEmployeeDetailsViewModelForNewPersonel = GetEmployeeForInsuranceList(leftWorkInsuranceViewModelList, searchModel);
if (mainEmployeeDetailsViewModelForNewPersonel.EmployeeDetailsForInsuranceList != null &&
mainEmployeeDetailsViewModelForNewPersonel.EmployeeDetailsForInsuranceList.Count > 0)
{
mainEmployeeDetailsViewModel.EmployeeDetailsForInsuranceList = mainEmployeeDetailsViewModel.EmployeeDetailsForInsuranceList.Union(mainEmployeeDetailsViewModelForNewPersonel.EmployeeDetailsForInsuranceList).ToList();
}
}
- if (employeeRemoveIds != null && employeeRemoveIds.Count>0)
+ if (employeeRemoveIds != null && employeeRemoveIds.Count > 0)
{
mainEmployeeDetailsViewModel.EmployeeDetailsForInsuranceList = mainEmployeeDetailsViewModel
.EmployeeDetailsForInsuranceList.Where(x => !employeeRemoveIds.Contains(x.EmployeeId))
.ToList();
- }
+ }
- }
- #endregion
+ }
+ #endregion
string startMonthCurrent = searchModel.Year + "/" + searchModel.Month + "/01";
@@ -1251,12 +1262,12 @@ public class InsuranceListApplication: IInsuranceListApplication
var day = 1;
var persianCurrentStartDate = new PersianDateTime(year, month, day);
var persianCurrentEndDate = new PersianDateTime(year, month, dayMonthCurrent);
-
+
var model = new YearlySalarySearchModel();
model.StartDateGr = startMonthCurrent.ToGeorgianDateTime();
model.EndDateGr = endMonthCurrent.ToGeorgianDateTime();
model.year = searchModel.Year;
-
+
var yearlysalaryItem = new YearlysalaryItemViewModel();
var housingAllowance = new YearlysalaryItemViewModel();
var consumableItems = new YearlysalaryItemViewModel();
@@ -1270,82 +1281,82 @@ public class InsuranceListApplication: IInsuranceListApplication
int endWork = 0;
item.IsMaritalStatusSet = // آیا وضعیت تاهل پرسنل ست شده است
!string.IsNullOrWhiteSpace(employeeObject.MaritalStatus);
-
+
#region HasConfilictLeftWork
- bool hasConfilict = false;
- // // اگر شروع به کار و ترک کارش در جدول ترک کار تغییر کرده باشد
- if (item.HasConfilictLeftWork)//item.LeftWorkDate != item.StrLeftWorkDateNew || (item.StartWorkDate != item.StrStartWorkDateNew && !string.IsNullOrEmpty(item.StrStartWorkDateNew) ) ||(item.JobId!=item.JobIdNew && item.JobIdNew!=0))
- {
- if (item.LeftWorkDate != item.StrLeftWorkDateNew)
- {
- item.LeftWorkDate = item.StrLeftWorkDateNew;
- item.LeftWorkDateGr = item.LeftWorkDateNew;
+ bool hasConfilict = false;
+ // // اگر شروع به کار و ترک کارش در جدول ترک کار تغییر کرده باشد
+ if (item.HasConfilictLeftWork)//item.LeftWorkDate != item.StrLeftWorkDateNew || (item.StartWorkDate != item.StrStartWorkDateNew && !string.IsNullOrEmpty(item.StrStartWorkDateNew) ) ||(item.JobId!=item.JobIdNew && item.JobIdNew!=0))
+ {
+ if (item.LeftWorkDate != item.StrLeftWorkDateNew)
+ {
+ item.LeftWorkDate = item.StrLeftWorkDateNew;
+ item.LeftWorkDateGr = item.LeftWorkDateNew;
- }
+ }
- if (item.StartWorkDate != item.StrStartWorkDateNew &&
- !string.IsNullOrEmpty(item.StrStartWorkDateNew))
- {
- item.StartWorkDate = item.StrStartWorkDateNew;
- item.StartWorkDateGr = item.StartWorkDateNew;
- }
+ if (item.StartWorkDate != item.StrStartWorkDateNew &&
+ !string.IsNullOrEmpty(item.StrStartWorkDateNew))
+ {
+ item.StartWorkDate = item.StrStartWorkDateNew;
+ item.StartWorkDateGr = item.StartWorkDateNew;
+ }
- if (item.JobId != item.JobIdNew && item.JobIdNew != 0)
- {
- item.JobId = item.JobIdNew;
- item.JobCode = item.JobCodeNew;
- item.JobName = item.JobNameNew;
- }
+ if (item.JobId != item.JobIdNew && item.JobIdNew != 0)
+ {
+ item.JobId = item.JobIdNew;
+ item.JobCode = item.JobCodeNew;
+ item.JobName = item.JobNameNew;
+ }
- item.IncludeStatus = item.IncludeStatusNew;//(item.IncludeStatus==item.IncludeStatusNew);
+ item.IncludeStatus = item.IncludeStatusNew;//(item.IncludeStatus==item.IncludeStatusNew);
- hasConfilict = true;
- }
+ hasConfilict = true;
+ }
- #endregion
+ #endregion
- var yearSalaryObj = _yearlySalaryApplication.GetDetailsBySearchModel(model);
- if (yearSalaryObj != null)
- {
- yearlysalaryItem = _yearlySalaryItemApplication.GetItemsByYearlySalaryId(yearSalaryObj.Id)
- .Where(x => x.ItemName == "مزد روزانه").FirstOrDefault();
- housingAllowance = _yearlySalaryItemApplication.GetItemsByYearlySalaryId(yearSalaryObj.Id)
- .Where(x => x.ItemName == "کمک هزینه مسکن").FirstOrDefault();
- consumableItems = _yearlySalaryItemApplication.GetItemsByYearlySalaryId(yearSalaryObj.Id)
- .Where(x => x.ItemName == "کمک هزینه اقلام").FirstOrDefault();
- maritalStatus = _yearlySalaryItemApplication.GetItemsByYearlySalaryId(yearSalaryObj.Id)
- .Where(x => x.ItemName == "حق تاهل").FirstOrDefault();
- item.HousingAllowance = housingAllowance.ItemValue;
- item.ConsumableItems = consumableItems.ItemValue;
- //item.MarriedAllowance = maritalStatus.ItemValue;
- item.YearlySalaryItem = yearlysalaryItem.ItemValue;
+ var yearSalaryObj = _yearlySalaryApplication.GetDetailsBySearchModel(model);
+ if (yearSalaryObj != null)
+ {
+ yearlysalaryItem = _yearlySalaryItemApplication.GetItemsByYearlySalaryId(yearSalaryObj.Id)
+ .Where(x => x.ItemName == "مزد روزانه").FirstOrDefault();
+ housingAllowance = _yearlySalaryItemApplication.GetItemsByYearlySalaryId(yearSalaryObj.Id)
+ .Where(x => x.ItemName == "کمک هزینه مسکن").FirstOrDefault();
+ consumableItems = _yearlySalaryItemApplication.GetItemsByYearlySalaryId(yearSalaryObj.Id)
+ .Where(x => x.ItemName == "کمک هزینه اقلام").FirstOrDefault();
+ maritalStatus = _yearlySalaryItemApplication.GetItemsByYearlySalaryId(yearSalaryObj.Id)
+ .Where(x => x.ItemName == "حق تاهل").FirstOrDefault();
+ item.HousingAllowance = housingAllowance.ItemValue;
+ item.ConsumableItems = consumableItems.ItemValue;
+ //item.MarriedAllowance = maritalStatus.ItemValue;
+ item.YearlySalaryItem = yearlysalaryItem.ItemValue;
- }
+ }
//ترک کارش در ماه و سال جاری بود نمایش داده شود
- if (!string.IsNullOrEmpty(item.LeftWorkDate) && !item.LeftWorkDate.Contains(searchModel.Year+"/"+searchModel.Month ) )
+ if (!string.IsNullOrEmpty(item.LeftWorkDate) && !item.LeftWorkDate.Contains(searchModel.Year + "/" + searchModel.Month))
{
item.LeftWorkDate = string.Empty;
item.LeftWorkDateGr = null;
}
- if (!string.IsNullOrEmpty(item.LeftWorkDate)) //&& item.LeftWorkDate.Substring(5, 2)==searchModel.Month && item.LeftWorkDate.Substring(0, 4) == searchModel.Year)
- {
- // item.HasLeftWorkInMonth = true;
- var yearEndDateUser = Convert.ToInt32(item.LeftWorkDate.Substring(0, 4));
- var monthEndDateUser = Convert.ToInt32(item.LeftWorkDate.Substring(5, 2));
- var dayEndDateUser = Convert.ToInt32(item.LeftWorkDate.Substring(8, 2));
+ if (!string.IsNullOrEmpty(item.LeftWorkDate)) //&& item.LeftWorkDate.Substring(5, 2)==searchModel.Month && item.LeftWorkDate.Substring(0, 4) == searchModel.Year)
+ {
+ // item.HasLeftWorkInMonth = true;
+ var yearEndDateUser = Convert.ToInt32(item.LeftWorkDate.Substring(0, 4));
+ var monthEndDateUser = Convert.ToInt32(item.LeftWorkDate.Substring(5, 2));
+ var dayEndDateUser = Convert.ToInt32(item.LeftWorkDate.Substring(8, 2));
- var persianLeftDateUser = new PersianDateTime(yearEndDateUser, monthEndDateUser, dayEndDateUser);
- var persianEndDateUser = persianLeftDateUser.AddDays(-1);
- var persianEndDateUserStr = persianLeftDateUser.AddDays(-1).ToString("yyyy/MM/dd");
+ var persianLeftDateUser = new PersianDateTime(yearEndDateUser, monthEndDateUser, dayEndDateUser);
+ var persianEndDateUser = persianLeftDateUser.AddDays(-1);
+ var persianEndDateUserStr = persianLeftDateUser.AddDays(-1).ToString("yyyy/MM/dd");
- if (persianLeftDateUser <= persianCurrentEndDate)
- item.HasLeftWorkInMonth = true;
- else
- item.HasLeftWorkInMonth = false;
+ if (persianLeftDateUser <= persianCurrentEndDate)
+ item.HasLeftWorkInMonth = true;
+ else
+ item.HasLeftWorkInMonth = false;
//اگر پایان به کار کاربر از پایان ماه جاری بیشتر باشد
if (persianEndDateUser >= persianCurrentEndDate)
@@ -1366,8 +1377,8 @@ public class InsuranceListApplication: IInsuranceListApplication
var monthStartDateUser = Convert.ToInt32(item.StartWorkDate.Substring(5, 2));
var dayStartDateUser = Convert.ToInt32(item.StartWorkDate.Substring(8, 2));
var persianStartDateUser = new PersianDateTime(yearStartDateUser, monthStartDateUser, dayStartDateUser);
-
- if(persianStartDateUser <= persianCurrentStartDate)
+
+ if (persianStartDateUser <= persianCurrentStartDate)
{
startWork = 1;
}
@@ -1376,18 +1387,18 @@ public class InsuranceListApplication: IInsuranceListApplication
startWork = dayStartDateUser;
}
- if(persianStartDateUser < persianCurrentStartDate)
+ if (persianStartDateUser < persianCurrentStartDate)
item.HasStartWorkInMonth = false;
else
item.HasStartWorkInMonth = true;
-
+
if (hasConfilict) //اگر ترک کار شخص تغییر کرده بود، دوباره محاسبه شود
{
item.StartMonthCurrent = startMonthCurrent;
item.HousingAllowance = housingAllowance.ItemValue;
item.ConsumableItems = consumableItems.ItemValue;
- item.DailyWage= ComputeDailyWage(yearlysalaryItem.ItemValue, item.EmployeeId, searchModel.WorkshopId, searchModel.Year);
+ item.DailyWage = ComputeDailyWage(yearlysalaryItem.ItemValue, item.EmployeeId, searchModel.WorkshopId, searchModel.Year);
item.DailyWageStr = item.DailyWage.ToMoney();
}
else
@@ -1399,63 +1410,63 @@ public class InsuranceListApplication: IInsuranceListApplication
{
#region InsuranceJob
- double dailyWage = item.DailyWage;
- if (searchModel.FixedSalary)
- {
- dailyWage = Convert.ToDouble(GetDailyWageFixedSalary(searchModel.Year, searchModel.WorkshopId, item.EmployeeId, model.StartDateGr, model.EndDateGr, item.JobId, searchModel.Population, searchModel.InsuranceJobId));
- item.HasConfilictJobs = (dailyWage == 0 ? true : false);
- }
- #endregion
+ double dailyWage = item.DailyWage;
+ if (searchModel.FixedSalary)
+ {
+ dailyWage = Convert.ToDouble(GetDailyWageFixedSalary(searchModel.Year, searchModel.WorkshopId, item.EmployeeId, model.StartDateGr, model.EndDateGr, item.JobId, searchModel.Population, searchModel.InsuranceJobId));
+ item.HasConfilictJobs = (dailyWage == 0 ? true : false);
+ }
+ #endregion
- if (hasConfilict)
- {
- int countWorkingDays = 0;
- for (int i = startWork; i <= endWork; i++)
- {
- countWorkingDays = countWorkingDays + 1;
- }
+ if (hasConfilict)
+ {
+ int countWorkingDays = 0;
+ for (int i = startWork; i <= endWork; i++)
+ {
+ countWorkingDays = countWorkingDays + 1;
+ }
- item.MonthlySalary = GetRoundValue(dailyWage * countWorkingDays);
- item.WorkingDays = countWorkingDays;
- if (item.IncludeStatus)
- {
- var marital = employeeObject.MaritalStatus == "متاهل" ? maritalStatus.ItemValue : 0;
- item.MonthlyBenefits = GetMonthlyBenefits(dayMonthCurrent, consumableItems.ItemValue, housingAllowance.ItemValue, marital, countWorkingDays, searchModel.TypeOfInsuranceSendWorkshop, item.JobId, item.EmployeeId, item.IncludeStatus);
- }
- else
- {
- item.MonthlyBenefits = 0;
- }
- }
+ item.MonthlySalary = GetRoundValue(dailyWage * countWorkingDays);
+ item.WorkingDays = countWorkingDays;
+ if (item.IncludeStatus)
+ {
+ var marital = employeeObject.MaritalStatus == "متاهل" ? maritalStatus.ItemValue : 0;
+ item.MonthlyBenefits = GetMonthlyBenefits(dayMonthCurrent, consumableItems.ItemValue, housingAllowance.ItemValue, marital, countWorkingDays, searchModel.TypeOfInsuranceSendWorkshop, item.JobId, item.EmployeeId, item.IncludeStatus);
+ }
+ else
+ {
+ item.MonthlyBenefits = 0;
+ }
+ }
- if (searchModel.TypeOfInsuranceSendWorkshop == "Govermentlist" && item.JobId == 10) //کمک دولت
- {
- item.MonthlyBenefits = 0;
- }
+ if (searchModel.TypeOfInsuranceSendWorkshop == "Govermentlist" && item.JobId == 10) //کمک دولت
+ {
+ item.MonthlyBenefits = 0;
+ }
- item.BenefitsIncludedContinuous = item.MonthlyBenefits + item.MonthlySalary;
+ item.BenefitsIncludedContinuous = item.MonthlyBenefits + item.MonthlySalary;
- var insuranceShare = (item.BenefitsIncludedContinuous * 7) / 100;
- item.InsuranceShare = GetRoundValue(insuranceShare);
- //}
+ var insuranceShare = (item.BenefitsIncludedContinuous * 7) / 100;
+ item.InsuranceShare = GetRoundValue(insuranceShare);
+ //}
- var employerShare = (item.BenefitsIncludedContinuous * 20) / 100;
- item.EmployerShare = GetRoundValue(employerShare);
+ var employerShare = (item.BenefitsIncludedContinuous * 20) / 100;
+ item.EmployerShare = GetRoundValue(employerShare);
- var unEmploymentInsurance = (item.BenefitsIncludedContinuous * 3) / 100;
- item.UnEmploymentInsurance = GetRoundValue(unEmploymentInsurance);
+ var unEmploymentInsurance = (item.BenefitsIncludedContinuous * 3) / 100;
+ item.UnEmploymentInsurance = GetRoundValue(unEmploymentInsurance);
// item.BenefitsIncludedNonContinuous = item.BenefitsIncludedContinuous;
- item.IncludedAndNotIncluded = item.BenefitsIncludedContinuous + item.BenefitsIncludedNonContinuous;
+ item.IncludedAndNotIncluded = item.BenefitsIncludedContinuous + item.BenefitsIncludedNonContinuous;
}
-
+
}
- if (mainEmployeeDetailsViewModel2.EmployeeDetailsForInsuranceList!=null && mainEmployeeDetailsViewModel2.EmployeeDetailsForInsuranceList.Count>0)
+ if (mainEmployeeDetailsViewModel2.EmployeeDetailsForInsuranceList != null && mainEmployeeDetailsViewModel2.EmployeeDetailsForInsuranceList.Count > 0)
mainEmployeeDetailsViewModel.EmployeeDetailsForInsuranceList = mainEmployeeDetailsViewModel.EmployeeDetailsForInsuranceList.Union(mainEmployeeDetailsViewModel2.EmployeeDetailsForInsuranceList).OrderByDescending(x => x.HasLeftWorkInMonth).ThenByDescending(x => x.HasStartWorkInMonth).ThenBy(x => x.LName).ToList();
else
mainEmployeeDetailsViewModel.EmployeeDetailsForInsuranceList = mainEmployeeDetailsViewModel.EmployeeDetailsForInsuranceList.OrderByDescending(x => x.HasLeftWorkInMonth).ThenByDescending(x => x.HasStartWorkInMonth).ThenBy(x => x.LName).ToList();
-
+
mainEmployeeDetailsViewModel.IsExist = false;
mainEmployeeDetailsViewModel.MaritalStatus = maritalStatus.ItemValue;
}
@@ -1466,96 +1477,96 @@ public class InsuranceListApplication: IInsuranceListApplication
return mainEmployeeDetailsViewModel;
}
- public MainEmployeeDetailsViewModel GetEmployeeListForEditByInsuranceListId(
- EmployeeForEditInsuranceListSearchModel searchModel)
- {
- var result = new MainEmployeeDetailsViewModel();
- var workshopId = searchModel.WorkshopIds.FirstOrDefault();
- var startMonthFa = $"{searchModel.Year}/{searchModel.Month.PadLeft(2, '0')}/01";
- DateTime startDateGr = startMonthFa.ToGeorgianDateTime();
- DateTime endDateGr = startMonthFa.FindeEndOfMonth()
- .ToGeorgianDateTime();
- int endOfMonth = Convert.ToInt32((startMonthFa.FindeEndOfMonth()).Substring(8, 2));
+ public MainEmployeeDetailsViewModel GetEmployeeListForEditByInsuranceListId(
+ EmployeeForEditInsuranceListSearchModel searchModel)
+ {
+ var result = new MainEmployeeDetailsViewModel();
+ var workshopId = searchModel.WorkshopIds.FirstOrDefault();
+ var startMonthFa = $"{searchModel.Year}/{searchModel.Month.PadLeft(2, '0')}/01";
+ DateTime startDateGr = startMonthFa.ToGeorgianDateTime();
+ DateTime endDateGr = startMonthFa.FindeEndOfMonth()
+ .ToGeorgianDateTime();
+ int endOfMonth = Convert.ToInt32((startMonthFa.FindeEndOfMonth()).Substring(8, 2));
- //مقادیر سالانه این تاریخ
- var yearlysaleries = _yearlySalaryApplication.GetInsuranceItems(startDateGr, endDateGr, searchModel.Year);
+ //مقادیر سالانه این تاریخ
+ var yearlysaleries = _yearlySalaryApplication.GetInsuranceItems(startDateGr, endDateGr, searchModel.Year);
- // دریافت اطلاعات هویتی و شروع و ترک کار کارکنان
- //var employeesInfoAndLeftWorks =
- // _leftWorkInsuranceApplication.GetEmployeeInsuranceLeftWorksAndInformation(workshopId, startDateGr,
- // endDateGr);
+ // دریافت اطلاعات هویتی و شروع و ترک کار کارکنان
+ //var employeesInfoAndLeftWorks =
+ // _leftWorkInsuranceApplication.GetEmployeeInsuranceLeftWorksAndInformation(workshopId, startDateGr,
+ // endDateGr);
var employeeInsurancDataPreviusList =
- _insuranceListRepositpry.GetEmployeeInsuranceDataForEdit(searchModel.InsuranceId,startDateGr,endDateGr);
+ _insuranceListRepositpry.GetEmployeeInsuranceDataForEdit(searchModel.InsuranceId, startDateGr, endDateGr);
- var computeResult = employeeInsurancDataPreviusList.Select(employeeData =>
- {
- var dateOfBirth = employeeData.DateOfBirthGr.ToFarsi();
- var dateOfIssue = employeeData.DateOfIssueGr.ToFarsi();
- var leftDate = employeeData.LeftWorkDateGr != null ? employeeData.LeftWorkDateGr.Value.AddDays(-1) : new DateTime();
- var workingDays = Tools.GetEmployeeInsuranceWorkingDays(employeeData.StartWorkDateGr, leftDate, startDateGr, endDateGr, employeeData.EmployeeId);
- var leftWorkFa = workingDays.hasLeftWorkInMonth ? employeeData.LeftWorkDateGr.ToFarsi() : "";
- var startWorkFa = employeeData.StartWorkDateGr.ToFarsi();
- var workshop = _workShopRepository.GetDetails(workshopId);
+ var computeResult = employeeInsurancDataPreviusList.Select(employeeData =>
+ {
+ var dateOfBirth = employeeData.DateOfBirthGr.ToFarsi();
+ var dateOfIssue = employeeData.DateOfIssueGr.ToFarsi();
+ var leftDate = employeeData.LeftWorkDateGr != null ? employeeData.LeftWorkDateGr.Value.AddDays(-1) : new DateTime();
+ var workingDays = Tools.GetEmployeeInsuranceWorkingDays(employeeData.StartWorkDateGr, leftDate, startDateGr, endDateGr, employeeData.EmployeeId);
+ var leftWorkFa = workingDays.hasLeftWorkInMonth ? employeeData.LeftWorkDateGr.ToFarsi() : "";
+ var startWorkFa = employeeData.StartWorkDateGr.ToFarsi();
+ var workshop = _workShopRepository.GetDetails(workshopId);
- //آیا کارفرما است
- bool isManager = employeeData.JobId is 10 or 16 or 17 or 18 or 3498;
+ //آیا کارفرما است
+ bool isManager = employeeData.JobId is 10 or 16 or 17 or 18 or 3498;
- //محاسبه حق بیمه سهم کارفرما
- var employerShare = (employeeData.BenefitsIncludedContinuous * 20) / 100;
+ //محاسبه حق بیمه سهم کارفرما
+ var employerShare = (employeeData.BenefitsIncludedContinuous * 20) / 100;
- // محاسبه بیمه بیکاری
- var unEmploymentInsurance = (employeeData.BenefitsIncludedContinuous * 3) / 100;
+ // محاسبه بیمه بیکاری
+ var unEmploymentInsurance = (employeeData.BenefitsIncludedContinuous * 3) / 100;
- //آیا در کارگاه تیک محاسبه اضافه کار یا حق اولاد زده شده است؟
- //این مورد زمانی چک می شود که تیک محاسبه در کارگاه زده شده باشد
- // در غیر اینصورت بصورت پیشفرض دارای فیش حقوق در نظر گرفته می شود
- bool hasWorkshopOverTimeOrFamilyAllowance =
- workshop.InsuranceCheckoutFamilyAllowance || workshop.InsuranceCheckoutOvertime;
+ //آیا در کارگاه تیک محاسبه اضافه کار یا حق اولاد زده شده است؟
+ //این مورد زمانی چک می شود که تیک محاسبه در کارگاه زده شده باشد
+ // در غیر اینصورت بصورت پیشفرض دارای فیش حقوق در نظر گرفته می شود
+ bool hasWorkshopOverTimeOrFamilyAllowance =
+ workshop.InsuranceCheckoutFamilyAllowance || workshop.InsuranceCheckoutOvertime;
- bool employeeHasCheckout = true;
- bool hasOverTimePay = false;
- bool hasFamilyAllowance = false;
+ bool employeeHasCheckout = true;
+ bool hasOverTimePay = false;
+ bool hasFamilyAllowance = false;
- if (hasWorkshopOverTimeOrFamilyAllowance && (leftDate >= startDateGr || employeeData.LeftWorkDateGr == null))
- {
- var checkout = _checkoutRepository.HasCheckout(workshopId, employeeData.EmployeeId,
- searchModel.Year, searchModel.Month);
- if (checkout.hasChekout)
- {
- if (checkout.OverTimePay > 0)
- hasOverTimePay = true;
- if (checkout.FamilyAlloance > 0)
- hasFamilyAllowance = true;
+ if (hasWorkshopOverTimeOrFamilyAllowance && (leftDate >= startDateGr || employeeData.LeftWorkDateGr == null))
+ {
+ var checkout = _checkoutRepository.HasCheckout(workshopId, employeeData.EmployeeId,
+ searchModel.Year, searchModel.Month);
+ if (checkout.hasChekout)
+ {
+ if (checkout.OverTimePay > 0)
+ hasOverTimePay = true;
+ if (checkout.FamilyAlloance > 0)
+ hasFamilyAllowance = true;
- }
- else
- {
- employeeHasCheckout = isManager == false ? false : true;
- }
- }
+ }
+ else
+ {
+ employeeHasCheckout = isManager == false ? false : true;
+ }
+ }
- bool familyAllowanceIsSet = true;
- bool overTimePayIsSet = true;
- if (workshop.InsuranceCheckoutFamilyAllowance && employeeHasCheckout && employeeData.FamilyAllowance == 0 && hasFamilyAllowance && !isManager)
- {
+ bool familyAllowanceIsSet = true;
+ bool overTimePayIsSet = true;
+ if (workshop.InsuranceCheckoutFamilyAllowance && employeeHasCheckout && employeeData.FamilyAllowance == 0 && hasFamilyAllowance && !isManager)
+ {
- familyAllowanceIsSet = false;
- }
+ familyAllowanceIsSet = false;
+ }
- if (workshop.InsuranceCheckoutOvertime && employeeHasCheckout && employeeData.OverTimePay == 0 && hasOverTimePay && !isManager)
- {
+ if (workshop.InsuranceCheckoutOvertime && employeeHasCheckout && employeeData.OverTimePay == 0 && hasOverTimePay && !isManager)
+ {
overTimePayIsSet = false;
}
return new EmployeeDetailsForInsuranceListViewModel
- {
+ {
#region EmployeeInfo
EmployeeHasCheckout = employeeHasCheckout,
EmployeeInsurancListDataId = employeeData.EmployeeInsurancListDataId,
- InsuranceEmployeeInformationId = employeeData.InsuranceEmployeeInformationId,
+ InsuranceEmployeeInformationId = employeeData.InsuranceEmployeeInformationId,
EmployeeId = employeeData.EmployeeId,
FName = employeeData.FName,
LName = employeeData.LName,
@@ -1574,111 +1585,111 @@ public class InsuranceListApplication: IInsuranceListApplication
IsMaritalStatusSet = !string.IsNullOrWhiteSpace(employeeData.MaritalStatus),
MaritalStatus = employeeData.MaritalStatus,
- StartMonthCurrent = startMonthFa,
- WorkingDays = workingDays.countWorkingDays,
- StartWorkDate = startWorkFa,
- StartWorkDateGr = employeeData.StartWorkDateGr,
- LeftWorkDate = leftWorkFa,
- LeftWorkDateGr = workingDays.hasLeftWorkInMonth ? employeeData.LeftWorkDateGr : null,
- JobId = employeeData.JobId,
- JobName = employeeData.JobName,
- JobCode = employeeData.JobCode,
+ StartMonthCurrent = startMonthFa,
+ WorkingDays = workingDays.countWorkingDays,
+ StartWorkDate = startWorkFa,
+ StartWorkDateGr = employeeData.StartWorkDateGr,
+ LeftWorkDate = leftWorkFa,
+ LeftWorkDateGr = workingDays.hasLeftWorkInMonth ? employeeData.LeftWorkDateGr : null,
+ JobId = employeeData.JobId,
+ JobName = employeeData.JobName,
+ JobCode = employeeData.JobCode,
- HasStartWorkInMonth = workingDays.hasStartWorkInMonth,
- HasLeftWorkInMonth = workingDays.hasLeftWorkInMonth,
- #endregion
+ HasStartWorkInMonth = workingDays.hasStartWorkInMonth,
+ HasLeftWorkInMonth = workingDays.hasLeftWorkInMonth,
+ #endregion
- #region Compute
- //مشمول مزایا بودن
- IncludeStatus = employeeData.IncludeStatus,
+ #region Compute
+ //مشمول مزایا بودن
+ IncludeStatus = employeeData.IncludeStatus,
- //دستمزد روزانه
- DailyWage = GetRoundValue(employeeData.DailyWage),
- DailyWageStr = employeeData.DailyWage.ToMoney(),
+ //دستمزد روزانه
+ DailyWage = GetRoundValue(employeeData.DailyWage),
+ DailyWageStr = employeeData.DailyWage.ToMoney(),
- //HasConfilictJobs = dailyWage == 0,
+ //HasConfilictJobs = dailyWage == 0,
- //پایه سنوات
- BaseYears = employeeData.BaseYears,
+ //پایه سنوات
+ BaseYears = employeeData.BaseYears,
- //مجموع مزد روزانه و پایه سنوات
- DailyWagePlusBaseYears = employeeData.DailyWagePlusBaseYears,
+ //مجموع مزد روزانه و پایه سنوات
+ DailyWagePlusBaseYears = employeeData.DailyWagePlusBaseYears,
- //حق تاهل
- MarriedAllowance = employeeData.MarriedAllowance,
+ //حق تاهل
+ MarriedAllowance = employeeData.MarriedAllowance,
- //دستمزد ماهانه
- MonthlySalary = employeeData.MonthlySalary,
+ //دستمزد ماهانه
+ MonthlySalary = employeeData.MonthlySalary,
- //مزایای ماهانه
- MonthlyBenefits = employeeData.MonthlyBenefits,
+ //مزایای ماهانه
+ MonthlyBenefits = employeeData.MonthlyBenefits,
- //مزایای مشمول
- BenefitsIncludedContinuous = employeeData.BenefitsIncludedContinuous,
+ //مزایای مشمول
+ BenefitsIncludedContinuous = employeeData.BenefitsIncludedContinuous,
- //مزایای غیر مشمول
- BenefitsIncludedNonContinuous = employeeData.BenefitsIncludedNonContinuous,
+ //مزایای غیر مشمول
+ BenefitsIncludedNonContinuous = employeeData.BenefitsIncludedNonContinuous,
- // جمع کل دستمزد و مزایای ماهانه مشمول و غیر مشمول
- IncludedAndNotIncluded = employeeData.IncludedAndNotIncluded,
+ // جمع کل دستمزد و مزایای ماهانه مشمول و غیر مشمول
+ IncludedAndNotIncluded = employeeData.IncludedAndNotIncluded,
- //حق بیمه سهم بیمه شده
- InsuranceShare = GetRoundValue(employeeData.InsuranceShare),
+ //حق بیمه سهم بیمه شده
+ InsuranceShare = GetRoundValue(employeeData.InsuranceShare),
- //حق بیمه سهم کارفرما
- EmployerShare = GetRoundValue(employerShare),
+ //حق بیمه سهم کارفرما
+ EmployerShare = GetRoundValue(employerShare),
- //بیمه بیکاری
- UnEmploymentInsurance = GetRoundValue(unEmploymentInsurance),
+ //بیمه بیکاری
+ UnEmploymentInsurance = GetRoundValue(unEmploymentInsurance),
- //کمک هزینه مسکن
- HousingAllowance = yearlysaleries.HousingAllowance,
- //کمک هزینه اقلام
- ConsumableItems = yearlysaleries.ConsumableItems,
+ //کمک هزینه مسکن
+ HousingAllowance = yearlysaleries.HousingAllowance,
+ //کمک هزینه اقلام
+ ConsumableItems = yearlysaleries.ConsumableItems,
- EndMonthCurrentDay = endOfMonth,
- YearlySalaryItem = yearlysaleries.DayliWage,
- MonthlyBaseYearsStr = "0",
- MonthlyBaseYears = 0,
+ EndMonthCurrentDay = endOfMonth,
+ YearlySalaryItem = yearlysaleries.DayliWage,
+ MonthlyBaseYearsStr = "0",
+ MonthlyBaseYears = 0,
- OverTimeIsSet = overTimePayIsSet,
- FamilyAllowanceIsSet = familyAllowanceIsSet
- #endregion
+ OverTimeIsSet = overTimePayIsSet,
+ FamilyAllowanceIsSet = familyAllowanceIsSet
+ #endregion
- };
- });
+ };
+ });
- result.EmployeeDetailsForInsuranceList = computeResult.OrderByDescending(x => x.HasLeftWorkInMonth).ThenByDescending(x => x.HasStartWorkInMonth)
- .ThenBy(x => x.LName).ToList();
+ result.EmployeeDetailsForInsuranceList = computeResult.OrderByDescending(x => x.HasLeftWorkInMonth).ThenByDescending(x => x.HasStartWorkInMonth)
+ .ThenBy(x => x.LName).ToList();
- result.IsExist = false;
- result.MaritalStatus = yearlysaleries.MarriedAllowance;
+ result.IsExist = false;
+ result.MaritalStatus = yearlysaleries.MarriedAllowance;
- return result;
- }
+ return result;
+ }
- public OperationResult ConfirmInsuranceList(long id)
+ public OperationResult ConfirmInsuranceList(long id)
+ {
+ OperationResult result = new OperationResult();
+
+ try
+ {
+ result = _insuranceListRepositpry.ConfirmInsuranceList(id);
+ result.Message = "تایید ارسال لیست بیمه با موفقیت انجام شد";
+ }
+ catch (Exception)
+ {
+ result.Message = "تایید ارسال لیست بیمه با خطا انجام شد";
+ }
+
+ return result;
+ }
+
+ private double? GetDailyWageFixedSalary(string year, long workshopId, long employeeId, DateTime? startDateGr, DateTime? endDateGr, long jobId, string population, long? insuranceJobId)
{
- OperationResult result = new OperationResult();
- try
- {
- result = _insuranceListRepositpry.ConfirmInsuranceList(id);
- result.Message = "تایید ارسال لیست بیمه با موفقیت انجام شد";
- }
- catch (Exception)
- {
- result.Message = "تایید ارسال لیست بیمه با خطا انجام شد";
- }
-
- return result;
- }
-
- private double? GetDailyWageFixedSalary(string year, long workshopId,long employeeId,DateTime? startDateGr, DateTime? endDateGr, long jobId, string population, long? insuranceJobId)
- {
-
double? result = 0;
string month = $"{startDateGr.ToFarsi()}".Substring(5, 2);
//اگر مشاغل مقطوع بود و شغلش کارفرما بود
@@ -1704,30 +1715,30 @@ public class InsuranceListApplication: IInsuranceListApplication
break;
}
- //var dateSaleryviewModel = new DateSalarySearchModel();
- //dateSaleryviewModel.StartDateGr = startDateGr;
- //dateSaleryviewModel.EndDateGr = endDateGr;
- //var _dateSalary = _dateSalaryRepository.GetDateSalaryViewModel(dateSaleryviewModel);
- //// && _dateSalary.Id >0
- //if (_dateSalary != null)
- //{
- // var dateSaleryItemviewModel = new DateSalaryItemSearchModel();
- // dateSaleryItemviewModel.DateSalaryId = _dateSalary.Id;
- // dateSaleryItemviewModel.Percent = percent;
- // var dateSalaryItem = _dateSalaryItemRepository.Search(dateSaleryItemviewModel);
- // if (dateSalaryItem != null)
- // result = dateSalaryItem[0].Salary;
- //}
- }
- if (jobId == 10) //کارفرما
- {
- InsuranceListSearchModel searchModel = new InsuranceListSearchModel();
- var workshop = _workShopRepository.GetDetails(workshopId);
- if (workshop.FixedSalary)
+ //var dateSaleryviewModel = new DateSalarySearchModel();
+ //dateSaleryviewModel.StartDateGr = startDateGr;
+ //dateSaleryviewModel.EndDateGr = endDateGr;
+ //var _dateSalary = _dateSalaryRepository.GetDateSalaryViewModel(dateSaleryviewModel);
+ //// && _dateSalary.Id >0
+ //if (_dateSalary != null)
+ //{
+ // var dateSaleryItemviewModel = new DateSalaryItemSearchModel();
+ // dateSaleryItemviewModel.DateSalaryId = _dateSalary.Id;
+ // dateSaleryItemviewModel.Percent = percent;
+ // var dateSalaryItem = _dateSalaryItemRepository.Search(dateSaleryItemviewModel);
+ // if (dateSalaryItem != null)
+ // result = dateSalaryItem[0].Salary;
+ //}
+ }
+ if (jobId == 10) //کارفرما
+ {
+ InsuranceListSearchModel searchModel = new InsuranceListSearchModel();
+ var workshop = _workShopRepository.GetDetails(workshopId);
+ if (workshop.FixedSalary)
{
var inJob = _insuranceJobItemRepository
- .GetInsuranceJobItemByInsuranceJobId((long)workshop.InsuranceJobId,year, month);
+ .GetInsuranceJobItemByInsuranceJobId((long)workshop.InsuranceJobId, year, month);
if (workshop.Population == "MoreThan500")
{
var max = inJob.MaxBy(x => x.PercentageMoreThan);
@@ -1765,55 +1776,55 @@ public class InsuranceListApplication: IInsuranceListApplication
- }
- //var insuransList = _insuranceListRepositpry.GetInsuranceListByWorkshopIdAndYear(workshopId, year);
- //var employeeInsurancListData = _employeeInsurancListDataRepository.GetEmployeeInsurancListDataByEmployeeIdAndInsuranceListId(employeeId, insuransList.Id);
- //if (employeeInsurancListData != null )
- //{
- // result = employeeInsurancListData.DailyWage;
- //}
- }
- else
- {
+ }
+ //var insuransList = _insuranceListRepositpry.GetInsuranceListByWorkshopIdAndYear(workshopId, year);
+ //var employeeInsurancListData = _employeeInsurancListDataRepository.GetEmployeeInsurancListDataByEmployeeIdAndInsuranceListId(employeeId, insuransList.Id);
+ //if (employeeInsurancListData != null )
+ //{
+ // result = employeeInsurancListData.DailyWage;
+ //}
+ }
+ else
+ {
- var searchModel = new InsuranceJobItemSearchModel();
- searchModel.InsuranceJobId = (long)insuranceJobId;
- var JobItem = _insuranceJobItemRepository.GetInsuranceJobItemByInsuranceJobIdForFixedSalary((long)insuranceJobId, jobId, year, month);
+ var searchModel = new InsuranceJobItemSearchModel();
+ searchModel.InsuranceJobId = (long)insuranceJobId;
+ var JobItem = _insuranceJobItemRepository.GetInsuranceJobItemByInsuranceJobIdForFixedSalary((long)insuranceJobId, jobId, year, month);
- if (JobItem != null && JobItem.Id != 0)
- {
- double percent = 0;
- if (population == "MoreThan500")
- percent = JobItem.PercentageMoreThan;
- else if (population == "LessThan500")
- percent = JobItem.PercentageLessThan;
+ if (JobItem != null && JobItem.Id != 0)
+ {
+ double percent = 0;
+ if (population == "MoreThan500")
+ percent = JobItem.PercentageMoreThan;
+ else if (population == "LessThan500")
+ percent = JobItem.PercentageLessThan;
+
+ var dateSaleryviewModel = new DateSalarySearchModel();
+ dateSaleryviewModel.StartDateGr = startDateGr;
+ dateSaleryviewModel.EndDateGr = endDateGr;
+ var _dateSalary = _dateSalaryRepository.GetDateSalaryViewModel(dateSaleryviewModel);
+ // && _dateSalary.Id >0
+ if (_dateSalary != null)
+ {
+ var dateSaleryItemviewModel = new DateSalaryItemSearchModel();
+ dateSaleryItemviewModel.DateSalaryId = _dateSalary.Id;
+ dateSaleryItemviewModel.Percent = percent;
+ var dateSalaryItem = _dateSalaryItemRepository.Search(dateSaleryItemviewModel);
+ if (dateSalaryItem != null)
+ result = dateSalaryItem[0].Salary;
+ }
+ }
- var dateSaleryviewModel = new DateSalarySearchModel();
- dateSaleryviewModel.StartDateGr = startDateGr;
- dateSaleryviewModel.EndDateGr = endDateGr;
- var _dateSalary = _dateSalaryRepository.GetDateSalaryViewModel(dateSaleryviewModel);
- // && _dateSalary.Id >0
- if (_dateSalary != null)
- {
- var dateSaleryItemviewModel = new DateSalaryItemSearchModel();
- dateSaleryItemviewModel.DateSalaryId = _dateSalary.Id;
- dateSaleryItemviewModel.Percent = percent;
- var dateSalaryItem = _dateSalaryItemRepository.Search(dateSaleryItemviewModel);
- if (dateSalaryItem != null)
- result = dateSalaryItem[0].Salary;
- }
- }
-
}
}
catch (Exception)
{
- result = 0;
- }
- return result;
- }
+ result = 0;
+ }
+ return result;
+ }
///
/// محاسبه مزایای ماهانه مشمول
@@ -1827,28 +1838,28 @@ public class InsuranceListApplication: IInsuranceListApplication
///
///
///
- private double GetMonthlyBenefits(int endMonthCurrentDay, double consumableItemsItemValue, double housingAllowanceItemValue,double maritalStatus, int countWorkingDays, string typeOfInsuranceSendWorkshop, long jobId,long employeeId,bool includeStatus)
+ private double GetMonthlyBenefits(int endMonthCurrentDay, double consumableItemsItemValue, double housingAllowanceItemValue, double maritalStatus, int countWorkingDays, string typeOfInsuranceSendWorkshop, long jobId, long employeeId, bool includeStatus)
{
- //ToDo
- //افزودن شرط مشمول مزایای
+ //ToDo
+ //افزودن شرط مشمول مزایای
- //اگر پرسنل کارفرما بود و نوع لیست کارگاه کمک دولت بود مزایا محاسبه نشود
- //اگر تیک مشمول مزایا در ترک کار خاموش بود مزایا نگیرد
+ //اگر پرسنل کارفرما بود و نوع لیست کارگاه کمک دولت بود مزایا محاسبه نشود
+ //اگر تیک مشمول مزایا در ترک کار خاموش بود مزایا نگیرد
- bool isManager = jobId is 10 or 16 or 17 or 18 or 3498;
- if (isManager && !includeStatus)
+ bool isManager = jobId is 10 or 16 or 17 or 18 or 3498;
+ if (isManager && !includeStatus)
return 0;
//پرسنل استثناء
if (employeeId == 42783)
return 53082855;
-
- //if(employeeId == 8859)
- // return GetRoundValue(((consumableItemsItemValue + housingAllowanceItemValue + maritalStatus) / 31) * countWorkingDays);
- //مزایای ماهانه با توجه به پایان ماه که 30 یا 31 روزه است، متفاوت می باشد
- //برای ماه 29 روزه هم تقسیم بر 30 می شود.
- if (countWorkingDays == endMonthCurrentDay)
+ //if(employeeId == 8859)
+ // return GetRoundValue(((consumableItemsItemValue + housingAllowanceItemValue + maritalStatus) / 31) * countWorkingDays);
+
+ //مزایای ماهانه با توجه به پایان ماه که 30 یا 31 روزه است، متفاوت می باشد
+ //برای ماه 29 روزه هم تقسیم بر 30 می شود.
+ if (countWorkingDays == endMonthCurrentDay)
return (consumableItemsItemValue + housingAllowanceItemValue + maritalStatus);
else if (endMonthCurrentDay == 29)//farokhiChanges در خط پایین عدد 30 رو به 29 تغییر دادم
return GetRoundValue(((consumableItemsItemValue + housingAllowanceItemValue + maritalStatus) / 29) * countWorkingDays);
@@ -1860,82 +1871,82 @@ public class InsuranceListApplication: IInsuranceListApplication
return GetRoundValue(((consumableItemsItemValue + housingAllowanceItemValue + maritalStatus) / endMonthCurrentDay) * countWorkingDays);
}
-
- private double ComputeDailyWage(double yearlysalaryItemValue, long employeeId, long workshopId, string year)
+
+ private double ComputeDailyWage(double yearlysalaryItemValue, long employeeId, long workshopId, string year)
{
double dailyWage = yearlysalaryItemValue;
- InsuranceListSearchModel searchModel = new InsuranceListSearchModel();
+ InsuranceListSearchModel searchModel = new InsuranceListSearchModel();
var insuransList = _insuranceListRepositpry.GetInsuranceListByWorkshopIdAndYear(workshopId, year);
if (insuransList != null)
{
- var employeeInsurancListData = _employeeInsurancListDataRepository.GetEmployeeInsurancListDataByEmployeeIdAndInsuranceListId( employeeId, insuransList.Id);
- if (employeeInsurancListData != null && employeeInsurancListData.DailyWage> dailyWage)
+ var employeeInsurancListData = _employeeInsurancListDataRepository.GetEmployeeInsurancListDataByEmployeeIdAndInsuranceListId(employeeId, insuransList.Id);
+ if (employeeInsurancListData != null && employeeInsurancListData.DailyWage > dailyWage)
{
- dailyWage=employeeInsurancListData.DailyWage;
+ dailyWage = employeeInsurancListData.DailyWage;
}
}
dailyWage = employeeId == 6536 ? 9399512 : dailyWage;
return dailyWage;
}
- public MainEmployeeDetailsViewModel GetEmployeeForInsuranceList(List leftWorkInsuranceViewModelList, EmployeeForEditInsuranceListSearchModel searchModel)
+ public MainEmployeeDetailsViewModel GetEmployeeForInsuranceList(List leftWorkInsuranceViewModelList, EmployeeForEditInsuranceListSearchModel searchModel)
{
var result = new MainEmployeeDetailsViewModel();
List list = new List();
- int leftWorkInsuranceCount= leftWorkInsuranceViewModelList.Count();
+ int leftWorkInsuranceCount = leftWorkInsuranceViewModelList.Count();
string startMonthCurrent = searchModel.Year + "/" + searchModel.Month + "/01";
string endMonthCurrent = startMonthCurrent.FindeEndOfMonth();
- var model = new YearlySalarySearchModel();
- model.StartDateGr = startMonthCurrent.ToGeorgianDateTime();
- model.EndDateGr = endMonthCurrent.ToGeorgianDateTime();
- model.year = searchModel.Year;
+ var model = new YearlySalarySearchModel();
+ model.StartDateGr = startMonthCurrent.ToGeorgianDateTime();
+ model.EndDateGr = endMonthCurrent.ToGeorgianDateTime();
+ model.year = searchModel.Year;
-
- var yearSalaryObj = _yearlySalaryApplication.GetDetailsBySearchModel(model);
- var yearlysalaryItem = new YearlysalaryItemViewModel();
- var housingAllowance = new YearlysalaryItemViewModel();
- var consumableItems = new YearlysalaryItemViewModel();
- var maritalStatus = new YearlysalaryItemViewModel();
- if (yearSalaryObj != null)
- {
- yearlysalaryItem = _yearlySalaryItemApplication.GetItemsByYearlySalaryId(yearSalaryObj.Id)
- .Where(x => x.ItemName == "مزد روزانه").FirstOrDefault();
- housingAllowance = _yearlySalaryItemApplication.GetItemsByYearlySalaryId(yearSalaryObj.Id)
- .Where(x => x.ItemName == "کمک هزینه مسکن").FirstOrDefault();
- consumableItems = _yearlySalaryItemApplication.GetItemsByYearlySalaryId(yearSalaryObj.Id)
- .Where(x => x.ItemName == "کمک هزینه اقلام").FirstOrDefault();
- maritalStatus = _yearlySalaryItemApplication.GetItemsByYearlySalaryId(yearSalaryObj.Id)
- .Where(x => x.ItemName == "حق تاهل").FirstOrDefault();
- }
+ var yearSalaryObj = _yearlySalaryApplication.GetDetailsBySearchModel(model);
- foreach (var item in leftWorkInsuranceViewModelList)
- {
- var employeeObject = _employeeRepository.GetDetailsByADDate(item.EmployeeId);
+ var yearlysalaryItem = new YearlysalaryItemViewModel();
+ var housingAllowance = new YearlysalaryItemViewModel();
+ var consumableItems = new YearlysalaryItemViewModel();
+ var maritalStatus = new YearlysalaryItemViewModel();
+ if (yearSalaryObj != null)
+ {
+ yearlysalaryItem = _yearlySalaryItemApplication.GetItemsByYearlySalaryId(yearSalaryObj.Id)
+ .Where(x => x.ItemName == "مزد روزانه").FirstOrDefault();
+ housingAllowance = _yearlySalaryItemApplication.GetItemsByYearlySalaryId(yearSalaryObj.Id)
+ .Where(x => x.ItemName == "کمک هزینه مسکن").FirstOrDefault();
+ consumableItems = _yearlySalaryItemApplication.GetItemsByYearlySalaryId(yearSalaryObj.Id)
+ .Where(x => x.ItemName == "کمک هزینه اقلام").FirstOrDefault();
+ maritalStatus = _yearlySalaryItemApplication.GetItemsByYearlySalaryId(yearSalaryObj.Id)
+ .Where(x => x.ItemName == "حق تاهل").FirstOrDefault();
+ }
- var employeeDetailsForInsuranceObj = new EmployeeDetailsForInsuranceListViewModel();
- employeeDetailsForInsuranceObj.HasConfilictJobs = false;
- employeeDetailsForInsuranceObj.IsMaritalStatusSet = // آیا وضعیت تاهل پرسنل ست شده است
- !string.IsNullOrWhiteSpace(employeeObject.MaritalStatus);
- if (_insuranceEmployeeInfoRepository.Exists(x => x.EmployeeId == item.EmployeeId))
- {
- var employeeInfoObject = _insuranceEmployeeInfoApplication.GetDetailsByEmployeeId(item.EmployeeId);
- employeeDetailsForInsuranceObj.InsuranceEmployeeInformationId = employeeInfoObject.Id;
- employeeDetailsForInsuranceObj.EmployeeId = employeeInfoObject.EmployeeId;
- employeeDetailsForInsuranceObj.FName = employeeInfoObject.FName;
- employeeDetailsForInsuranceObj.LName = employeeInfoObject.LName;
- employeeDetailsForInsuranceObj.FatherName = employeeInfoObject.FatherName;
- employeeDetailsForInsuranceObj.DateOfBirth = employeeInfoObject.DateOfBirth;
- employeeDetailsForInsuranceObj.DateOfIssue = employeeInfoObject.DateOfIssue;
- employeeDetailsForInsuranceObj.DateOfBirthGr = employeeInfoObject.DateOfBirthGr;
- employeeDetailsForInsuranceObj.DateOfIssueGr = employeeInfoObject.DateOfIssueGr;
- employeeDetailsForInsuranceObj.PlaceOfIssue = employeeInfoObject.PlaceOfIssue;
- employeeDetailsForInsuranceObj.IdNumber = employeeInfoObject.IdNumber;
- employeeDetailsForInsuranceObj.Gender = employeeInfoObject.Gender;
+ foreach (var item in leftWorkInsuranceViewModelList)
+ {
+ var employeeObject = _employeeRepository.GetDetailsByADDate(item.EmployeeId);
+
+ var employeeDetailsForInsuranceObj = new EmployeeDetailsForInsuranceListViewModel();
+ employeeDetailsForInsuranceObj.HasConfilictJobs = false;
+ employeeDetailsForInsuranceObj.IsMaritalStatusSet = // آیا وضعیت تاهل پرسنل ست شده است
+ !string.IsNullOrWhiteSpace(employeeObject.MaritalStatus);
+ if (_insuranceEmployeeInfoRepository.Exists(x => x.EmployeeId == item.EmployeeId))
+ {
+ var employeeInfoObject = _insuranceEmployeeInfoApplication.GetDetailsByEmployeeId(item.EmployeeId);
+ employeeDetailsForInsuranceObj.InsuranceEmployeeInformationId = employeeInfoObject.Id;
+ employeeDetailsForInsuranceObj.EmployeeId = employeeInfoObject.EmployeeId;
+ employeeDetailsForInsuranceObj.FName = employeeInfoObject.FName;
+ employeeDetailsForInsuranceObj.LName = employeeInfoObject.LName;
+ employeeDetailsForInsuranceObj.FatherName = employeeInfoObject.FatherName;
+ employeeDetailsForInsuranceObj.DateOfBirth = employeeInfoObject.DateOfBirth;
+ employeeDetailsForInsuranceObj.DateOfIssue = employeeInfoObject.DateOfIssue;
+ employeeDetailsForInsuranceObj.DateOfBirthGr = employeeInfoObject.DateOfBirthGr;
+ employeeDetailsForInsuranceObj.DateOfIssueGr = employeeInfoObject.DateOfIssueGr;
+ employeeDetailsForInsuranceObj.PlaceOfIssue = employeeInfoObject.PlaceOfIssue;
+ employeeDetailsForInsuranceObj.IdNumber = employeeInfoObject.IdNumber;
+ employeeDetailsForInsuranceObj.Gender = employeeInfoObject.Gender;
//از جدول پرسنل پر می شود
employeeDetailsForInsuranceObj.NationalCode =
@@ -1953,7 +1964,7 @@ public class InsuranceListApplication: IInsuranceListApplication
employeeDetailsForInsuranceObj.FName = employeeObject.FName;
employeeDetailsForInsuranceObj.LName = employeeObject.LName;
employeeDetailsForInsuranceObj.FatherName = employeeObject.FatherName;
- employeeDetailsForInsuranceObj.DateOfBirth = employeeObject.DateOfBirth=="1300/10/11"?"": employeeObject.DateOfBirth;
+ employeeDetailsForInsuranceObj.DateOfBirth = employeeObject.DateOfBirth == "1300/10/11" ? "" : employeeObject.DateOfBirth;
employeeDetailsForInsuranceObj.DateOfIssue = employeeObject.DateOfIssue;
employeeDetailsForInsuranceObj.PlaceOfIssue = employeeObject.PlaceOfIssue;
employeeDetailsForInsuranceObj.NationalCode = employeeObject.NationalCode;
@@ -1963,92 +1974,92 @@ public class InsuranceListApplication: IInsuranceListApplication
employeeDetailsForInsuranceObj.Nationality = employeeObject.Nationality;
}
- #region ComputingWorkingDays
+ #region ComputingWorkingDays
- int startWork = 0;
- int endWork = 0;
+ int startWork = 0;
+ int endWork = 0;
- var year = Convert.ToInt32(searchModel.Year);
- var month = Convert.ToInt32(searchModel.Month);
- var day = 1;
- var persianCurrentStartDate = new PersianDateTime(year, month, day);
- var dayMonthCurrent = Convert.ToInt32(endMonthCurrent.Substring(8, 2));
- var persianCurrentEndDate = new PersianDateTime(year, month, dayMonthCurrent);
- //آخرین روز ماه جاری
- var endMonthCurrentDay = Convert.ToInt32(endMonthCurrent.Substring(8, 2));
+ var year = Convert.ToInt32(searchModel.Year);
+ var month = Convert.ToInt32(searchModel.Month);
+ var day = 1;
+ var persianCurrentStartDate = new PersianDateTime(year, month, day);
+ var dayMonthCurrent = Convert.ToInt32(endMonthCurrent.Substring(8, 2));
+ var persianCurrentEndDate = new PersianDateTime(year, month, dayMonthCurrent);
+ //آخرین روز ماه جاری
+ var endMonthCurrentDay = Convert.ToInt32(endMonthCurrent.Substring(8, 2));
- var yearStartDateUser = Convert.ToInt32(item.StartWorkDate.Substring(0, 4));
- var monthStartDateUser = Convert.ToInt32(item.StartWorkDate.Substring(5, 2));
- var dayStartDateUser = Convert.ToInt32(item.StartWorkDate.Substring(8, 2));
- var persianStartDateUser = new PersianDateTime(yearStartDateUser, monthStartDateUser, dayStartDateUser);
+ var yearStartDateUser = Convert.ToInt32(item.StartWorkDate.Substring(0, 4));
+ var monthStartDateUser = Convert.ToInt32(item.StartWorkDate.Substring(5, 2));
+ var dayStartDateUser = Convert.ToInt32(item.StartWorkDate.Substring(8, 2));
+ var persianStartDateUser = new PersianDateTime(yearStartDateUser, monthStartDateUser, dayStartDateUser);
- if (persianStartDateUser < persianCurrentStartDate)
- employeeDetailsForInsuranceObj.HasStartWorkInMonth = false;
- else
- employeeDetailsForInsuranceObj.HasStartWorkInMonth = true;
+ if (persianStartDateUser < persianCurrentStartDate)
+ employeeDetailsForInsuranceObj.HasStartWorkInMonth = false;
+ else
+ employeeDetailsForInsuranceObj.HasStartWorkInMonth = true;
- //اگر شروع به کار کاربر از ابتدای ماه جاری کمتر باشد
- if (persianStartDateUser <= persianCurrentStartDate)
- {
- startWork = 1;
- }
- else
- {
- startWork = dayStartDateUser;
- }
+ //اگر شروع به کار کاربر از ابتدای ماه جاری کمتر باشد
+ if (persianStartDateUser <= persianCurrentStartDate)
+ {
+ startWork = 1;
+ }
+ else
+ {
+ startWork = dayStartDateUser;
+ }
- if (!string.IsNullOrEmpty(item.LeftWorkDate))
- {
- var yearEndDateUser = Convert.ToInt32(item.LeftWorkDate.Substring(0, 4));
- var monthEndDateUser = Convert.ToInt32(item.LeftWorkDate.Substring(5, 2));
- var dayEndDateUser = Convert.ToInt32(item.LeftWorkDate.Substring(8, 2));
- var persianLeftDateUser = new PersianDateTime(yearEndDateUser, monthEndDateUser, dayEndDateUser);
- var persianEndDateUser = persianLeftDateUser.AddDays(-1);
- var persianEndDateUserStr = persianLeftDateUser.AddDays(-1).ToString("yyyy/MM/dd");
+ if (!string.IsNullOrEmpty(item.LeftWorkDate))
+ {
+ var yearEndDateUser = Convert.ToInt32(item.LeftWorkDate.Substring(0, 4));
+ var monthEndDateUser = Convert.ToInt32(item.LeftWorkDate.Substring(5, 2));
+ var dayEndDateUser = Convert.ToInt32(item.LeftWorkDate.Substring(8, 2));
+ var persianLeftDateUser = new PersianDateTime(yearEndDateUser, monthEndDateUser, dayEndDateUser);
+ var persianEndDateUser = persianLeftDateUser.AddDays(-1);
+ var persianEndDateUserStr = persianLeftDateUser.AddDays(-1).ToString("yyyy/MM/dd");
- //if (persianLeftDateUser <= persianCurrentEndDate)
- // employeeDetailsForInsuranceObj.HasLeftWorkInMonth = true;
- //else
- // employeeDetailsForInsuranceObj.HasLeftWorkInMonth = false;
+ //if (persianLeftDateUser <= persianCurrentEndDate)
+ // employeeDetailsForInsuranceObj.HasLeftWorkInMonth = true;
+ //else
+ // employeeDetailsForInsuranceObj.HasLeftWorkInMonth = false;
- //ترک کارش در ماه و سال جاری بود نمایش داده شود
- if (!item.LeftWorkDate.Contains(searchModel.Year + "/" + searchModel.Month))
- {
- employeeDetailsForInsuranceObj.HasLeftWorkInMonth = false;
- item.LeftWorkDate = string.Empty;
- item.LeftWorkDateGr = null;
- }
- else
- {
- employeeDetailsForInsuranceObj.HasLeftWorkInMonth = true;
- }
+ //ترک کارش در ماه و سال جاری بود نمایش داده شود
+ if (!item.LeftWorkDate.Contains(searchModel.Year + "/" + searchModel.Month))
+ {
+ employeeDetailsForInsuranceObj.HasLeftWorkInMonth = false;
+ item.LeftWorkDate = string.Empty;
+ item.LeftWorkDateGr = null;
+ }
+ else
+ {
+ employeeDetailsForInsuranceObj.HasLeftWorkInMonth = true;
+ }
- //اگر پایان به کار کاربر از پایان ماه جاری بیشتر باشد
- if (persianEndDateUser >= persianCurrentEndDate)
- {
- endWork = endMonthCurrentDay;
- }
- else
- {
- endWork = Convert.ToInt32(persianEndDateUserStr.Substring(8, 2));
- }
- }
- else
- {
- employeeDetailsForInsuranceObj.HasLeftWorkInMonth = false;
- endWork = endMonthCurrentDay;
- }
+ //اگر پایان به کار کاربر از پایان ماه جاری بیشتر باشد
+ if (persianEndDateUser >= persianCurrentEndDate)
+ {
+ endWork = endMonthCurrentDay;
+ }
+ else
+ {
+ endWork = Convert.ToInt32(persianEndDateUserStr.Substring(8, 2));
+ }
+ }
+ else
+ {
+ employeeDetailsForInsuranceObj.HasLeftWorkInMonth = false;
+ endWork = endMonthCurrentDay;
+ }
- int countWorkingDays = 0;
- for (int i = startWork; i <= endWork; i++)
- {
- countWorkingDays = countWorkingDays + 1;
- }
+ int countWorkingDays = 0;
+ for (int i = startWork; i <= endWork; i++)
+ {
+ countWorkingDays = countWorkingDays + 1;
+ }
- //farokhiChanges
- //روزهای کارکرد پرسنل با آی دی های زیر دستی تعریف شد
- switch (item.EmployeeId)
- {
+ //farokhiChanges
+ //روزهای کارکرد پرسنل با آی دی های زیر دستی تعریف شد
+ switch (item.EmployeeId)
+ {
//case 3812://ثابت
// countWorkingDays = 15;
@@ -2059,8 +2070,8 @@ public class InsuranceListApplication: IInsuranceListApplication
case 40469://ثابت
countWorkingDays = 7;
break;
- //case 9950://ثابت
- // countWorkingDays = 15;
+ //case 9950://ثابت
+ // countWorkingDays = 15;
break;
case 9640://ثابت
countWorkingDays = 15;
@@ -2071,31 +2082,31 @@ public class InsuranceListApplication: IInsuranceListApplication
case 6219://ثابت
countWorkingDays = 15;
break;
- //case 7897://ثابت
- // countWorkingDays = 15;
- // break;
+ //case 7897://ثابت
+ // countWorkingDays = 15;
+ // break;
}
;
- #endregion
+ #endregion
- employeeDetailsForInsuranceObj.IncludeStatus = item.IncludeStatus;
+ employeeDetailsForInsuranceObj.IncludeStatus = item.IncludeStatus;
#region InsuranceJob
double dailyWage = employeeDetailsForInsuranceObj.DailyWage;
if (searchModel.FixedSalary)
{
- dailyWage = Convert.ToDouble(GetDailyWageFixedSalary(searchModel.Year, item.WorkshopId,item.EmployeeId, model.StartDateGr, model.EndDateGr, item.JobId, searchModel.Population, searchModel.InsuranceJobId));
+ dailyWage = Convert.ToDouble(GetDailyWageFixedSalary(searchModel.Year, item.WorkshopId, item.EmployeeId, model.StartDateGr, model.EndDateGr, item.JobId, searchModel.Population, searchModel.InsuranceJobId));
employeeDetailsForInsuranceObj.HasConfilictJobs = (dailyWage == 0 ? true : false);
}
#endregion
if (yearlysalaryItem != null)
{
- if(!searchModel.FixedSalary )
+ if (!searchModel.FixedSalary)
{
//dailyWage= yearlysalaryItem.ItemValue;
- dailyWage = ComputeDailyWage(yearlysalaryItem.ItemValue, item.EmployeeId,item.WorkshopId, searchModel.Year) ;
+ dailyWage = ComputeDailyWage(yearlysalaryItem.ItemValue, item.EmployeeId, item.WorkshopId, searchModel.Year);
}
employeeDetailsForInsuranceObj.DailyWage = GetRoundValue(dailyWage);
employeeDetailsForInsuranceObj.DailyWageStr = employeeDetailsForInsuranceObj.DailyWage.ToMoney();
@@ -2114,13 +2125,13 @@ public class InsuranceListApplication: IInsuranceListApplication
employeeDetailsForInsuranceObj.MonthlyBenefits = 0;
}
- if (searchModel.TypeOfInsuranceSendWorkshop == "Govermentlist" && item.JobId == 10) //کمک دولت
- {
- employeeDetailsForInsuranceObj.MonthlyBenefits = 0;
- }
+ if (searchModel.TypeOfInsuranceSendWorkshop == "Govermentlist" && item.JobId == 10) //کمک دولت
+ {
+ employeeDetailsForInsuranceObj.MonthlyBenefits = 0;
+ }
+
+ employeeDetailsForInsuranceObj.BenefitsIncludedContinuous = employeeDetailsForInsuranceObj.MonthlyBenefits + employeeDetailsForInsuranceObj.MonthlySalary;
- employeeDetailsForInsuranceObj.BenefitsIncludedContinuous =employeeDetailsForInsuranceObj.MonthlyBenefits + employeeDetailsForInsuranceObj.MonthlySalary;
-
//if ((!item.IncludeStatus &&(item.JobId == 10 || item.JobId == 17 || item.JobId == 18 || item.JobId == 16)) ||(item.IncludeStatus && item.JobId == 10)) // 10 --> karfarma
//{
// var insuranceShare2 =(employeeDetailsForInsuranceObj.BenefitsIncludedContinuous * 27) / 100;
@@ -2133,69 +2144,207 @@ public class InsuranceListApplication: IInsuranceListApplication
//}
var employerShare = (employeeDetailsForInsuranceObj.BenefitsIncludedContinuous * 20) / 100;
- employeeDetailsForInsuranceObj.EmployerShare = GetRoundValue(employerShare); //Math.Round(employerShare, MidpointRounding.ToPositiveInfinity);
+ employeeDetailsForInsuranceObj.EmployerShare = GetRoundValue(employerShare); //Math.Round(employerShare, MidpointRounding.ToPositiveInfinity);
- //if (searchModel.TypeOfInsuranceSendWorkshop == "Govermentlist" && item.JobId==10)//کمک دولت
- //{employeeDetailsForInsuranceObj.InsuranceShare = 0;}
+ //if (searchModel.TypeOfInsuranceSendWorkshop == "Govermentlist" && item.JobId==10)//کمک دولت
+ //{employeeDetailsForInsuranceObj.InsuranceShare = 0;}
- var unEmploymentInsurance =(employeeDetailsForInsuranceObj.BenefitsIncludedContinuous * 3) / 100;
+ var unEmploymentInsurance = (employeeDetailsForInsuranceObj.BenefitsIncludedContinuous * 3) / 100;
employeeDetailsForInsuranceObj.UnEmploymentInsurance = GetRoundValue(unEmploymentInsurance);
- employeeDetailsForInsuranceObj.BenefitsIncludedNonContinuous = employeeDetailsForInsuranceObj.BenefitsIncludedNonContinuous;
- employeeDetailsForInsuranceObj.IncludedAndNotIncluded = employeeDetailsForInsuranceObj.BenefitsIncludedNonContinuous + employeeDetailsForInsuranceObj.BenefitsIncludedContinuous;
+ employeeDetailsForInsuranceObj.BenefitsIncludedNonContinuous = employeeDetailsForInsuranceObj.BenefitsIncludedNonContinuous;
+ employeeDetailsForInsuranceObj.IncludedAndNotIncluded = employeeDetailsForInsuranceObj.BenefitsIncludedNonContinuous + employeeDetailsForInsuranceObj.BenefitsIncludedContinuous;
- }
+ }
- employeeDetailsForInsuranceObj.StartMonthCurrent = startMonthCurrent;
- employeeDetailsForInsuranceObj.WorkingDays = countWorkingDays;
- employeeDetailsForInsuranceObj.StartWorkDate = item.StartWorkDate;
- employeeDetailsForInsuranceObj.LeftWorkDate = item.LeftWorkDate;
- employeeDetailsForInsuranceObj.JobId = item.JobId;
- employeeDetailsForInsuranceObj.JobName = item.JobName;
- employeeDetailsForInsuranceObj.JobCode = item.JobCode;
- if (!string.IsNullOrWhiteSpace(item.LeftWorkDate))
- employeeDetailsForInsuranceObj.LeftWorkDateGr = item.LeftWorkDateGr;
+ employeeDetailsForInsuranceObj.StartMonthCurrent = startMonthCurrent;
+ employeeDetailsForInsuranceObj.WorkingDays = countWorkingDays;
+ employeeDetailsForInsuranceObj.StartWorkDate = item.StartWorkDate;
+ employeeDetailsForInsuranceObj.LeftWorkDate = item.LeftWorkDate;
+ employeeDetailsForInsuranceObj.JobId = item.JobId;
+ employeeDetailsForInsuranceObj.JobName = item.JobName;
+ employeeDetailsForInsuranceObj.JobCode = item.JobCode;
+ if (!string.IsNullOrWhiteSpace(item.LeftWorkDate))
+ employeeDetailsForInsuranceObj.LeftWorkDateGr = item.LeftWorkDateGr;
- employeeDetailsForInsuranceObj.StartWorkDateGr = item.StartWorkDateGr;
+ employeeDetailsForInsuranceObj.StartWorkDateGr = item.StartWorkDateGr;
- list.Add(employeeDetailsForInsuranceObj);
- }
+ list.Add(employeeDetailsForInsuranceObj);
+ }
- list = list.OrderByDescending(x => x.HasLeftWorkInMonth).ThenByDescending(x => x.HasStartWorkInMonth)
- .ThenBy(x => x.LName).ToList();
- result.EmployeeDetailsForInsuranceList = list;
- result.IsExist = false;
- result.MaritalStatus = maritalStatus.ItemValue;
- //}
- //else
- //{
- // result.IsExist = true;
- //}
- return result;
- }
+ list = list.OrderByDescending(x => x.HasLeftWorkInMonth).ThenByDescending(x => x.HasStartWorkInMonth)
+ .ThenBy(x => x.LName).ToList();
+ result.EmployeeDetailsForInsuranceList = list;
+ result.IsExist = false;
+ result.MaritalStatus = maritalStatus.ItemValue;
+ //}
+ //else
+ //{
+ // result.IsExist = true;
+ //}
+ return result;
+ }
- #region Client
+ #region Client
- public List SearchForClient(InsuranceListSearchModel searchModel)
- {
- var result = _insuranceListRepositpry.SearchForClient(searchModel);
- return result;
- }
+ public List SearchForClient(InsuranceListSearchModel searchModel)
+ {
+ var result = _insuranceListRepositpry.SearchForClient(searchModel);
+ return result;
+ }
- #endregion
- //farokhiChanges
- public (double basic, int totalYear) BasicYear(long employeeId, long worshopId, DateTime startDate)
- {
- var totalYears = _leftWorkInsuranceRepository.TotalWorkingYears(employeeId, worshopId, startDate);
- var baseSalary = _insuranceYearlySalaryApplication.GetBaseYearByDate(startDate, totalYears);
- return (baseSalary, totalYears);
- }
+ #endregion
+ //farokhiChanges
+ public (double basic, int totalYear) BasicYear(long employeeId, long worshopId, DateTime startDate)
+ {
+ var totalYears = _leftWorkInsuranceRepository.TotalWorkingYears(employeeId, worshopId, startDate);
+ var baseSalary = _insuranceYearlySalaryApplication.GetBaseYearByDate(startDate, totalYears);
+ return (baseSalary, totalYears);
+ }
- public double GetMonthlyBaseYear(double dayliBase, int countWorkingDays)
- {
- double res =GetRoundValue(dayliBase * countWorkingDays);
- return res;
- }
+ public double GetMonthlyBaseYear(double dayliBase, int countWorkingDays)
+ {
+ double res = GetRoundValue(dayliBase * countWorkingDays);
+ return res;
+ }
+
+ #region Mahan
+
+ public async Task ConfirmInsuranceOperation(InsuranceListConfirmOperation command)
+ {
+ // Improved version of the ConfirmInsuranceOperation method's main logic
+ async Task CreateMediaAsync(InsuranceList insuranceList, string insuranceType, IFormFile file)
+ {
+ var path = Path.Combine(_mediaRepository.BasePath, "InsuranceList", $"{insuranceList.Year}_{insuranceList.Month}", insuranceList.id.ToString());
+ Directory.CreateDirectory(path);
+
+ string uniqueFileName = $"{insuranceType}_{Path.GetFileNameWithoutExtension(file.FileName)}_{DateTime.Now.Ticks}{Path.GetExtension(file.FileName)}";
+ string filePath = Path.Combine(path, uniqueFileName);
+
+ await using (var stream = new FileStream(filePath, FileMode.Create))
+ {
+ await file.CopyToAsync(stream);
+ }
+ var type = Path.GetExtension(filePath);
+ var media = new Media(filePath, type, "فایل", "InsuranceList");
+ await _mediaRepository.CreateAsync(media);
+ await _mediaRepository.SaveChangesAsync();
+ return media.id;
+ }
+
+ var op = new OperationResult();
+ var insuranceList = _insuranceListRepositpry.Get(command.InsuranceListId);
+ if (insuranceList == null)
+ return op.Failed("لیست بیمه پیدا نشد");
+
+ bool completeDebt = false, completeInspection = false, completeApproval = false;
+
+ // Debt Section
+ if (command.Debt.Type != InsuranceListDebtType.None)
+ {
+ var debt = command.Debt;
+ if (string.IsNullOrWhiteSpace(debt.DebtDate))
+ return op.Failed("لطفا تاریخ بدهی را وارد کنید");
+ if (!debt.DebtDate.TryToGeorgianDateTime(out var debtDateGr))
+ return op.Failed("تاریخ بدهی نامعتبر است");
+
+ if (debt.DebtFile is not { Length: > 0 } && debt.DebtFileMediaId <= 0)
+ return op.Failed("لطفا فایل بدهی را وارد کنید");
+
+ if (debt.DebtFile is { Length: > 20_000_000 })
+ return op.Failed("حجم فایل نمیتواند از 20 مگابایت بیشتر باشد");
+
+ var debtAmount = debt.Amount.MoneyToDouble();
+ if (debtAmount <= 0)
+ return op.Failed("مبلغ بدهی نامعتبر است");
+
+
+
+ var mediaId = command.Debt.DebtFileMediaId;
+ if (debt.DebtFile is { Length: > 0 })
+ {
+ mediaId = await CreateMediaAsync(insuranceList, "debt", debt.DebtFile);
+ }
+
+ var debtEntity = new InsuranceListDebt(debt.Type, debtDateGr, debtAmount, mediaId);
+ insuranceList.SetDebt(debtEntity);
+ completeDebt = true;
+ }
+
+ // Inspection Section
+ if (command.Inspection.Type != InsuranceListInspectionType.None)
+ {
+ var inspection = command.Inspection;
+ if (string.IsNullOrWhiteSpace(inspection.LastInspectionDate))
+ return op.Failed("لطفا تاریخ بازرسی را وارد کنید");
+
+ if (!inspection.LastInspectionDate.TryToGeorgianDateTime(out var inspectionDateGr))
+ return op.Failed("تاریخ بازرسی نامعتبر است");
+
+ if (inspection.InspectionFile is not { Length: > 0 } && inspection.InspectionFileMediaId <= 0)
+ return op.Failed("لطفا فایل بازرسی را وارد کنید");
+
+ if (inspection.InspectionFile is { Length: > 20_000_000 })
+ return op.Failed("حجم فایل نمیتواند از 20 مگابایت بیشتر باشد");
+
+
+ var mediaId = inspection.InspectionFileMediaId;
+ if (inspection.InspectionFile is { Length: > 0 })
+ {
+ mediaId = await CreateMediaAsync(insuranceList, "inspection", inspection.InspectionFile);
+ }
+ var inspectionEntity = new InsuranceListInspection(inspection.Type, inspectionDateGr, mediaId);
+ insuranceList.SetInspection(inspectionEntity);
+ completeInspection = true;
+ }
+
+ // Approval Section
+ if (command.Approval.ApprovalStatus != InsuranceListEmployerApprovalStatus.None)
+ {
+ var approval = command.Approval;
+ if (approval.ApprovalStatus == InsuranceListEmployerApprovalStatus.VerbalApproval)
+ {
+ if (string.IsNullOrWhiteSpace(approval.Description))
+ return op.Failed("لطفا توضیحات را وارد کنید");
+
+ if (approval.Description.Length < 15)
+ return op.Failed("توضیحات باید حداقل 15 کاراکتر باشد");
+ }
+ var approvalEntity = new InsuranceListEmployerApproval(approval.ApprovalStatus, approval.Description);
+ insuranceList.SetEmployerApproval(approvalEntity);
+ completeApproval = true;
+ }
+
+ // Final Confirmation
+ if (command.ConfirmSentList)
+ {
+ if (!(completeApproval && completeDebt && completeInspection))
+ return op.Failed("تا زمانی که تمامی بخش ها پر نشده باشد نمیتوانید لیست را ارسال کنید");
+
+ insuranceList.SetConfirmSentlist(true);
+ }
+ else
+ {
+ insuranceList.SetConfirmSentlist(false);
+ }
+
+ await _insuranceListRepositpry.SaveChangesAsync();
+ return op.Succcedded();
+
+ }
+
+
+ public Task GetInsuranceOperationDetails(long id)
+ {
+ return _insuranceListRepositpry.GetInsuranceOperationDetails(id);
+ }
+
+ public Task GetTabCounts(InsuranceListSearchModel searchModel)
+ {
+ return _insuranceListRepositpry.GetTabCounts(searchModel);
+ }
+
+ #endregion
}
\ No newline at end of file
diff --git a/CompanyManagment.Application/LeftWorkApplication.cs b/CompanyManagment.Application/LeftWorkApplication.cs
index 83cf6825..8f7a30ae 100644
--- a/CompanyManagment.Application/LeftWorkApplication.cs
+++ b/CompanyManagment.Application/LeftWorkApplication.cs
@@ -15,6 +15,7 @@ using CompanyManagment.App.Contracts.PersonnleCode;
using CompanyManagment.App.Contracts.RollCallEmployee;
using CompanyManagment.App.Contracts.WorkingHours;
using CompanyManagment.App.Contracts.WorkingHoursItems;
+using CompanyManagment.App.Contracts.Workshop.DTOs;
using PersianTools.Core;
namespace CompanyManagment.Application;
@@ -600,6 +601,11 @@ public class LeftWorkApplication : ILeftWorkApplication
return _leftWorkRepository.CheckEditLeftWork(workshopId, employeeId, date.ToGeorgianDateTime(), type);
}
+ public AutoExtensionDto AutoExtentionEmployees(long workshopId)
+ {
+ return _leftWorkRepository.AutoExtentionEmployees(workshopId);
+ }
+
#region Pooya
//این متد ترک کار های کارمند را با فعالیت حضور غیاب یکپارچه می کند
private void IfEmployeeHasNewLeftWorkDateAddEndDateToRollCallStatus(long employeeId)
diff --git a/CompanyManagment.Application/LeftWorkTempApplication.cs b/CompanyManagment.Application/LeftWorkTempApplication.cs
index d351f619..fbb8daf4 100644
--- a/CompanyManagment.Application/LeftWorkTempApplication.cs
+++ b/CompanyManagment.Application/LeftWorkTempApplication.cs
@@ -19,6 +19,7 @@ using CompanyManagment.App.Contracts.LeftWork;
using CompanyManagment.App.Contracts.LeftWorkTemp;
using CompanyManagment.App.Contracts.ReportClient;
using CompanyManagment.App.Contracts.RollCallEmployee;
+using CompanyManagment.EFCore.Migrations;
using OperationResult = _0_Framework.Application.OperationResult;
using Tools = _0_Framework.Application.Tools;
@@ -174,8 +175,19 @@ public class LeftWorkTempApplication : ILeftWorkTempApplication
await _leftWorkRepository.CreateAsync(newLeftWork);
_leftWorkTempRepository.Remove(leftWorkTemp);
+ var rollCallEmployee = _rollCallEmployeeRepository.GetBy(leftWorkTemp.EmployeeId, leftWorkTemp.WorkshopId);
+
+ var rollCallStatus = rollCallEmployee?.EmployeesStatus.MaxBy(x => x.StartDate);
+
+ if (rollCallStatus != null)
+ {
+ var startWork = newLeftWork.StartWorkDate;
+ rollCallStatus.Edit(startWork, rollCallStatus.EndDate);
+
+ }
await _leftWorkRepository.SaveChangesAsync();
await _leftWorkTempRepository.SaveChangesAsync();
+
return op.Succcedded();
}
diff --git a/CompanyManagment.Application/WorkshopAppliction.cs b/CompanyManagment.Application/WorkshopAppliction.cs
index c63e074d..ddf011fd 100644
--- a/CompanyManagment.Application/WorkshopAppliction.cs
+++ b/CompanyManagment.Application/WorkshopAppliction.cs
@@ -73,10 +73,28 @@ public class WorkshopAppliction : IWorkshopApplication
if (string.IsNullOrEmpty(command.WorkshopName) || string.IsNullOrEmpty(command.ArchiveCode))
return operation.Failed("موارد اجباری را پر کنید");
- //if (_workshopRepository.Exists(x => x.WorkshopName == command.WorkshopName))
- // return operation.Failed("نام کارگاه تکراری است");
+ //if (_workshopRepository.Exists(x => x.WorkshopName == command.WorkshopName))
+ // return operation.Failed("نام کارگاه تکراری است");
- if (_workshopRepository.Exists(x => !string.IsNullOrEmpty(x.InsuranceCode) && x.InsuranceCode == command.InsuranceCode))
+ if (command.ContractTerm != "1" && command.ContractTerm != "ForEver" && (command.CutContractEndOfYear != IsActive.False && command.CutContractEndOfYear != IsActive.True))
+ return operation.Failed("لطفا تیک قرداداد منتهی به پایان سال را تعیین وضعیت کنید");
+
+ if (command.ContractTerm == "1" && command.ContractTerm == "ForEver")
+ command.CutContractEndOfYear = IsActive.None;
+ if (!command.CreateContract)
+ {
+ command.SignContract = false;
+ command.CreateCheckout = false;
+ command.SignCheckout = false;
+ }
+
+ if (!command.CreateCheckout)
+ {
+ command.SignCheckout = false;
+ }
+
+
+ if (_workshopRepository.Exists(x => !string.IsNullOrEmpty(x.InsuranceCode) && x.InsuranceCode == command.InsuranceCode))
return operation.Failed("کد بیمه کارگاه تکراری است");
if (!string.IsNullOrEmpty(command.Address) && string.IsNullOrEmpty(command.State))
@@ -145,7 +163,11 @@ public class WorkshopAppliction : IWorkshopApplication
command.ArchiveCode, command.AgentName, command.AgentPhone, command.State, command.City,
command.Address,
command.TypeOfInsuranceSend, command.TypeOfContract,command.ContractTerm,command.AgreementNumber
- ,command.FixedSalary, command.Population,command.InsuranceJobId,command.ZoneName,command.AddBonusesPay,command.AddYearsPay,command.AddLeavePay,command.TotalPaymentHide,command.IsClassified,command.ComputeOptions,command.BonusesOptions,command.YearsOptions,command.HasRollCallFreeVip,command.WorkshopHolidayWorking, command.InsuranceCheckoutOvertime, command.InsuranceCheckoutFamilyAllowance);
+ ,command.FixedSalary, command.Population,command.InsuranceJobId,command.ZoneName,command.AddBonusesPay,
+ command.AddYearsPay,command.AddLeavePay,command.TotalPaymentHide,command.IsClassified,command.ComputeOptions,
+ command.BonusesOptions,command.YearsOptions,command.HasRollCallFreeVip,command.WorkshopHolidayWorking,
+ command.InsuranceCheckoutOvertime, command.InsuranceCheckoutFamilyAllowance, command.CreateContract, command.SignContract,
+ command.CreateCheckout, command.SignCheckout, command.CutContractEndOfYear);
_workshopRepository.Create(workshop);
_workshopRepository.SaveChanges();
@@ -211,10 +233,28 @@ public class WorkshopAppliction : IWorkshopApplication
return operation.Failed("لطفا کارفرما را انتخاب نمایید");
var employer = command.EmployerIdList.ToList();
- //if (_workshopRepository.Exists(x => x.WorkshopName == command.WorkshopName && x.id != command.Id))
- // return operation.Failed(" نام کارگاه تکراری است ");
+ //if (_workshopRepository.Exists(x => x.WorkshopName == command.WorkshopName && x.id != command.Id))
+ // return operation.Failed(" نام کارگاه تکراری است ");
- if (command.TypeOfInsuranceSend != null && string.IsNullOrEmpty(command.InsuranceCode))
+ if (command.ContractTerm != "1" && command.ContractTerm != "ForEver" && (command.CutContractEndOfYear != IsActive.False && command.CutContractEndOfYear != IsActive.True))
+ return operation.Failed("لطفا تیک قرداداد منتهی به پایان سال را تعیین وضعیت کنید");
+
+ if (command.ContractTerm == "1" && command.ContractTerm == "ForEver")
+ command.CutContractEndOfYear = IsActive.None;
+ if (!command.CreateContract)
+ {
+ command.SignContract = false;
+ command.CreateCheckout = false;
+ command.SignCheckout = false;
+ }
+
+ if (!command.CreateCheckout)
+ {
+ command.SignCheckout = false;
+ }
+
+
+ if (command.TypeOfInsuranceSend != null && string.IsNullOrEmpty(command.InsuranceCode))
return operation.Failed("لطفا کد بیمه کارگاه را وارد کنید");
if (_workshopRepository.Exists(x => !string.IsNullOrEmpty(x.InsuranceCode) && x.InsuranceCode == command.InsuranceCode && x.id != command.Id))
return operation.Failed("کد بیمه کارگاه تکراری است");
@@ -315,7 +355,10 @@ public class WorkshopAppliction : IWorkshopApplication
command.Address,
command.TypeOfInsuranceSend, command.TypeOfContract,command.ContractTerm, command.AgreementNumber
, command.FixedSalary, command.Population, command.InsuranceJobId, command.ZoneName,
- command.AddBonusesPay, command.AddYearsPay, command.AddLeavePay, command.TotalPaymentHide,command.IsClassified, command.ComputeOptions,command.BonusesOptions, command.YearsOptions,command.HasRollCallFreeVip, command.WorkshopHolidayWorking, command.InsuranceCheckoutOvertime,command.InsuranceCheckoutFamilyAllowance);
+ command.AddBonusesPay, command.AddYearsPay, command.AddLeavePay, command.TotalPaymentHide,command.IsClassified,
+ command.ComputeOptions,command.BonusesOptions, command.YearsOptions,command.HasRollCallFreeVip,
+ command.WorkshopHolidayWorking, command.InsuranceCheckoutOvertime,command.InsuranceCheckoutFamilyAllowance,
+ command.CreateContract, command.SignContract, command.CreateCheckout, command.SignCheckout, command.CutContractEndOfYear);
_workshopRepository.SaveChanges();
_workshopRepository.RemoveOldRelation(command.Id);
@@ -535,159 +578,169 @@ public class WorkshopAppliction : IWorkshopApplication
{
return _workshopRepository.SearchForClient(searchModel);
}
+
public OperationResult CreateForClient(CreateWorkshop command)
{
-
- var accountIds = new List();
- var operation = new OperationResult();
- //if (command.EmployerIdList == null)
- // return operation.Failed("لطفا کارفرما را انتخاب نمایید");
- var employer = command.EmployerIdList.ToList();
- if (command.AccountIdsList != null)
- {
- accountIds = command.AccountIdsList.ToList();
- }
-
- if (string.IsNullOrEmpty(command.WorkshopName) || string.IsNullOrEmpty(command.ArchiveCode) || command.ArchiveCode == "0")
- return operation.Failed("موارد اجباری را پر کنید");
- //if (_workshopRepository.Exists(x => x.WorkshopName == command.WorkshopName))
- // return operation.Failed("نام کارگاه تکراری است");
- if (_workshopRepository.Exists(x => x.InsuranceCode != null && x.InsuranceCode == command.InsuranceCode))
- {
- if (_workshopRepository.ExistsWorkshopAccountInsuranceCode(command.InsuranceCode))
- return operation.Failed("کد بیمه کارگاه تکراری است");
- }
-
- if (_workshopRepository.ExistsWorkshopAccountArchiveCode(command.ArchiveCode))
- return operation.Failed("شماره بایگانی تکراری است");
-
- if (string.IsNullOrEmpty(command.State)) //(!string.IsNullOrEmpty(command.Address) && string.IsNullOrEmpty(command.State))
- return operation.Failed("لطفا استان و شهر را انتخاب کنید");
-
- if (command.City == "0" || command.City == "شهرستان")
- return operation.Failed("لطفا شهر را انتخاب کنید");
- if (string.IsNullOrEmpty(command.Address))
- return operation.Failed("لطفا آدرس را وارد کنید");
-
- if (!string.IsNullOrEmpty(command.TypeOfInsuranceSend) && command.TypeOfInsuranceSend != "false" && string.IsNullOrEmpty(command.InsuranceCode))
- return operation.Failed("لطفا کد بیمه کارگاه را وارد کنید");
-
- if (command.FixedSalary)
- {
- if (command.InsuranceJobId == 0 || command.InsuranceJobId == null)
- return operation.Failed("لطفا صنف را انتخاب کنید");
- if (string.IsNullOrWhiteSpace(command.Population))
- return operation.Failed("لطفا جمعیت شهر را انتخاب کنید");
- }
-
- //if (string.IsNullOrWhiteSpace(command.TypeOfInsuranceSend))
- // return operation.Failed("لطفا نوع ارسال لیست بیمه را مشخص کنید");
-
- var workshop = new Workshop(command.WorkshopName, command.WorkshopSureName, command.InsuranceCode,command.TypeOfOwnership,
- command.ArchiveCode, command.AgentName, command.AgentPhone, command.State, command.City, command.Address,
- command.TypeOfInsuranceSend, command.TypeOfContract, command.ContractTerm, command.AgreementNumber, command.FixedSalary,
- command.Population, command.InsuranceJobId, command.ZoneName, command.AddBonusesPay,
- command.AddYearsPay, command.AddLeavePay,command.TotalPaymentHide, command.IsClassified, command.ComputeOptions,
- command.BonusesOptions, command.YearsOptions,command.HasRollCallFreeVip, command.WorkshopHolidayWorking,
- command.InsuranceCheckoutOvertime,command.InsuranceCheckoutFamilyAllowance);
- _workshopRepository.Create(workshop);
- _workshopRepository.SaveChanges();
-
-
-
- foreach (var e in employer)
- {
- _workshopRepository.EmployerWorkshop(workshop.id, e);
- }
-
-
- _workshopRepository.CreateWorkshopAccounts(accountIds, workshop.id);
-
-
-
- return operation.Succcedded();
-
-
+ throw new NotImplementedException();
}
public OperationResult EditForClient(EditWorkshop command)
{
- var leftSearch = new LeftWorkSearchModel()
- {
- WorkshopId = command.Id
- };
- var leftWork = _leftWorkRepository.search(leftSearch);
- var accountIds = new List();
- var operation = new OperationResult();
- var workshop = _workshopRepository.Get(command.Id);
- if (command.AccountIdsList != null)
- {
- accountIds = command.AccountIdsList.ToList();
- }
- if (workshop == null)
- operation.Failed("رکورد مورد نظر وجود ندارد");
- if (command.EmployerIdList == null)
- return operation.Failed("لطفا کارفرما را انتخاب نمایید");
- var employer = command.EmployerIdList.ToList();
-
- if (string.IsNullOrEmpty(command.WorkshopName) || string.IsNullOrEmpty(command.ArchiveCode) || command.ArchiveCode == "0")
- return operation.Failed("موارد اجباری را پر کنید");
-
- //if (_workshopRepository.Exists(x => x.WorkshopName == command.WorkshopName && x.id != command.Id))
- // return operation.Failed(" رکورد مورد نظر تکراری است ");
- if (_workshopRepository.Exists(x =>
- x.InsuranceCode != null && x.InsuranceCode == command.InsuranceCode && x.id != command.Id))
- {
- if (_workshopRepository.ExistsWorkshopAccountInsuranceCodeByworkshopId(command.Id, command.InsuranceCode))
- return operation.Failed("کد بیمه کارگاه تکراری است");
- }
-
- if (_workshopRepository.ExistsWorkshopAccountArchiveCodeByWorkshopId(command.Id, command.ArchiveCode))
- return operation.Failed("شماره بایگانی تکراری است");
-
- if (command.State == null)
- return operation.Failed("لطفا استان و شهر را انتخاب کنید");
- if ((command.City == "0" || command.City == "شهرستان"))
- return operation.Failed("لطفا شهر را انتخاب کنید");
- if (command.TypeOfInsuranceSend != null && command.InsuranceCode == null)
- return operation.Failed("لطفا کد بیمه کارگاه را وارد کنید");
- if (command.Address == null)
- return operation.Failed("لطفا آدرس را وارد کنید");
- if (command.FixedSalary)
- {
- if (command.InsuranceJobId == 0 || command.InsuranceJobId == null)
- return operation.Failed("لطفا صنف را انتخاب کنید");
- if (string.IsNullOrWhiteSpace(command.Population))
- return operation.Failed("لطفا جمعیت شهر را انتخاب کنید");
- }
-
- workshop.Edit(command.WorkshopName, command.WorkshopSureName, command.InsuranceCode, command.TypeOfOwnership,
- command.ArchiveCode, command.AgentName, command.AgentPhone, command.State, command.City,
- command.Address,
- command.TypeOfInsuranceSend, command.TypeOfContract, command.ContractTerm, command.AgreementNumber
- , command.FixedSalary, command.Population, command.InsuranceJobId, command.ZoneName,
- command.AddBonusesPay, command.AddYearsPay, command.AddLeavePay,command.TotalPaymentHide,command.IsClassified,
- command.ComputeOptions, command.BonusesOptions, command.YearsOptions,command.HasRollCallFreeVip, command.WorkshopHolidayWorking,
- command.InsuranceCheckoutOvertime, command.InsuranceCheckoutFamilyAllowance);
- _workshopRepository.SaveChanges();
-
- //_workshopRepository.RemoveOldRelation(command.Id);
- _workshopRepository.RemoveEmployerWorkshop(command.Id);
- foreach (var e in employer)
- {
- _workshopRepository.EmployerWorkshop(workshop.id, e);
- }
- // _workshopRepository.WorkshopAccounts(accountIds, workshop.id);
- foreach (var item in leftWork)
- {
- var editLeft = _leftWorkRepository.Get(item.Id);
-
- editLeft.EditBonuses(command.AddBonusesPay, command.AddYearsPay, command.AddLeavePay);
- _leftWorkRepository.SaveChanges();
- }
- return operation.Succcedded();
-
+ throw new NotImplementedException();
}
+ //public OperationResult CreateForClient(CreateWorkshop command)
+ //{
+
+ // var accountIds = new List();
+ // var operation = new OperationResult();
+ // //if (command.EmployerIdList == null)
+ // // return operation.Failed("لطفا کارفرما را انتخاب نمایید");
+ // var employer = command.EmployerIdList.ToList();
+ // if (command.AccountIdsList != null)
+ // {
+ // accountIds = command.AccountIdsList.ToList();
+ // }
+
+ // if (string.IsNullOrEmpty(command.WorkshopName) || string.IsNullOrEmpty(command.ArchiveCode) || command.ArchiveCode == "0")
+ // return operation.Failed("موارد اجباری را پر کنید");
+ // //if (_workshopRepository.Exists(x => x.WorkshopName == command.WorkshopName))
+ // // return operation.Failed("نام کارگاه تکراری است");
+ // if (_workshopRepository.Exists(x => x.InsuranceCode != null && x.InsuranceCode == command.InsuranceCode))
+ // {
+ // if (_workshopRepository.ExistsWorkshopAccountInsuranceCode(command.InsuranceCode))
+ // return operation.Failed("کد بیمه کارگاه تکراری است");
+ // }
+
+ // if (_workshopRepository.ExistsWorkshopAccountArchiveCode(command.ArchiveCode))
+ // return operation.Failed("شماره بایگانی تکراری است");
+
+ // if (string.IsNullOrEmpty(command.State)) //(!string.IsNullOrEmpty(command.Address) && string.IsNullOrEmpty(command.State))
+ // return operation.Failed("لطفا استان و شهر را انتخاب کنید");
+
+ // if (command.City == "0" || command.City == "شهرستان")
+ // return operation.Failed("لطفا شهر را انتخاب کنید");
+ // if (string.IsNullOrEmpty(command.Address))
+ // return operation.Failed("لطفا آدرس را وارد کنید");
+
+ // if (!string.IsNullOrEmpty(command.TypeOfInsuranceSend) && command.TypeOfInsuranceSend != "false" && string.IsNullOrEmpty(command.InsuranceCode))
+ // return operation.Failed("لطفا کد بیمه کارگاه را وارد کنید");
+
+ // if (command.FixedSalary)
+ // {
+ // if (command.InsuranceJobId == 0 || command.InsuranceJobId == null)
+ // return operation.Failed("لطفا صنف را انتخاب کنید");
+ // if (string.IsNullOrWhiteSpace(command.Population))
+ // return operation.Failed("لطفا جمعیت شهر را انتخاب کنید");
+ // }
+
+ // //if (string.IsNullOrWhiteSpace(command.TypeOfInsuranceSend))
+ // // return operation.Failed("لطفا نوع ارسال لیست بیمه را مشخص کنید");
+
+ // var workshop = new Workshop(command.WorkshopName, command.WorkshopSureName, command.InsuranceCode,command.TypeOfOwnership,
+ // command.ArchiveCode, command.AgentName, command.AgentPhone, command.State, command.City, command.Address,
+ // command.TypeOfInsuranceSend, command.TypeOfContract, command.ContractTerm, command.AgreementNumber, command.FixedSalary,
+ // command.Population, command.InsuranceJobId, command.ZoneName, command.AddBonusesPay,
+ // command.AddYearsPay, command.AddLeavePay,command.TotalPaymentHide, command.IsClassified, command.ComputeOptions,
+ // command.BonusesOptions, command.YearsOptions,command.HasRollCallFreeVip, command.WorkshopHolidayWorking,
+ // command.InsuranceCheckoutOvertime,command.InsuranceCheckoutFamilyAllowance);
+ // _workshopRepository.Create(workshop);
+ // _workshopRepository.SaveChanges();
+
+
+
+ // foreach (var e in employer)
+ // {
+ // _workshopRepository.EmployerWorkshop(workshop.id, e);
+ // }
+
+
+ // _workshopRepository.CreateWorkshopAccounts(accountIds, workshop.id);
+
+
+
+ // return operation.Succcedded();
+
+
+ //}
+
+ //public OperationResult EditForClient(EditWorkshop command)
+ //{
+ // var leftSearch = new LeftWorkSearchModel()
+ // {
+ // WorkshopId = command.Id
+ // };
+ // var leftWork = _leftWorkRepository.search(leftSearch);
+ // var accountIds = new List();
+ // var operation = new OperationResult();
+ // var workshop = _workshopRepository.Get(command.Id);
+ // if (command.AccountIdsList != null)
+ // {
+ // accountIds = command.AccountIdsList.ToList();
+ // }
+ // if (workshop == null)
+ // operation.Failed("رکورد مورد نظر وجود ندارد");
+ // if (command.EmployerIdList == null)
+ // return operation.Failed("لطفا کارفرما را انتخاب نمایید");
+ // var employer = command.EmployerIdList.ToList();
+
+ // if (string.IsNullOrEmpty(command.WorkshopName) || string.IsNullOrEmpty(command.ArchiveCode) || command.ArchiveCode == "0")
+ // return operation.Failed("موارد اجباری را پر کنید");
+
+ // //if (_workshopRepository.Exists(x => x.WorkshopName == command.WorkshopName && x.id != command.Id))
+ // // return operation.Failed(" رکورد مورد نظر تکراری است ");
+ // if (_workshopRepository.Exists(x =>
+ // x.InsuranceCode != null && x.InsuranceCode == command.InsuranceCode && x.id != command.Id))
+ // {
+ // if (_workshopRepository.ExistsWorkshopAccountInsuranceCodeByworkshopId(command.Id, command.InsuranceCode))
+ // return operation.Failed("کد بیمه کارگاه تکراری است");
+ // }
+
+ // if (_workshopRepository.ExistsWorkshopAccountArchiveCodeByWorkshopId(command.Id, command.ArchiveCode))
+ // return operation.Failed("شماره بایگانی تکراری است");
+
+ // if (command.State == null)
+ // return operation.Failed("لطفا استان و شهر را انتخاب کنید");
+ // if ((command.City == "0" || command.City == "شهرستان"))
+ // return operation.Failed("لطفا شهر را انتخاب کنید");
+ // if (command.TypeOfInsuranceSend != null && command.InsuranceCode == null)
+ // return operation.Failed("لطفا کد بیمه کارگاه را وارد کنید");
+ // if (command.Address == null)
+ // return operation.Failed("لطفا آدرس را وارد کنید");
+ // if (command.FixedSalary)
+ // {
+ // if (command.InsuranceJobId == 0 || command.InsuranceJobId == null)
+ // return operation.Failed("لطفا صنف را انتخاب کنید");
+ // if (string.IsNullOrWhiteSpace(command.Population))
+ // return operation.Failed("لطفا جمعیت شهر را انتخاب کنید");
+ // }
+
+ // workshop.Edit(command.WorkshopName, command.WorkshopSureName, command.InsuranceCode, command.TypeOfOwnership,
+ // command.ArchiveCode, command.AgentName, command.AgentPhone, command.State, command.City,
+ // command.Address,
+ // command.TypeOfInsuranceSend, command.TypeOfContract, command.ContractTerm, command.AgreementNumber
+ // , command.FixedSalary, command.Population, command.InsuranceJobId, command.ZoneName,
+ // command.AddBonusesPay, command.AddYearsPay, command.AddLeavePay,command.TotalPaymentHide,command.IsClassified,
+ // command.ComputeOptions, command.BonusesOptions, command.YearsOptions,command.HasRollCallFreeVip, command.WorkshopHolidayWorking,
+ // command.InsuranceCheckoutOvertime, command.InsuranceCheckoutFamilyAllowance);
+ // _workshopRepository.SaveChanges();
+
+ // //_workshopRepository.RemoveOldRelation(command.Id);
+ // _workshopRepository.RemoveEmployerWorkshop(command.Id);
+ // foreach (var e in employer)
+ // {
+ // _workshopRepository.EmployerWorkshop(workshop.id, e);
+ // }
+ // // _workshopRepository.WorkshopAccounts(accountIds, workshop.id);
+ // foreach (var item in leftWork)
+ // {
+ // var editLeft = _leftWorkRepository.Get(item.Id);
+
+ // editLeft.EditBonuses(command.AddBonusesPay, command.AddYearsPay, command.AddLeavePay);
+ // _leftWorkRepository.SaveChanges();
+ // }
+ // return operation.Succcedded();
+
+ //}
public bool GetWorkshopAccountByAcountID(long acountID)
{
diff --git a/CompanyManagment.Application/YearlySalaryApplication.cs b/CompanyManagment.Application/YearlySalaryApplication.cs
index 82afe137..f5535933 100644
--- a/CompanyManagment.Application/YearlySalaryApplication.cs
+++ b/CompanyManagment.Application/YearlySalaryApplication.cs
@@ -160,7 +160,7 @@ public class YearlySalaryApplication : IYearlySalaryApplication
public InsuranceYearlySalaryModel GetInsuranceItems(DateTime startDate, DateTime endDate, string year)
{
return _yearlySalaryRepository.GetInsuranceItems(startDate, endDate, year);
- }
+ }
#endregion
}
\ No newline at end of file
diff --git a/CompanyManagment.EFCore/Mapping/CheckoutMapping.cs b/CompanyManagment.EFCore/Mapping/CheckoutMapping.cs
index 5eb88650..d88259e1 100644
--- a/CompanyManagment.EFCore/Mapping/CheckoutMapping.cs
+++ b/CompanyManagment.EFCore/Mapping/CheckoutMapping.cs
@@ -1,5 +1,6 @@
using System;
using _0_Framework.Application;
+using _0_Framework.InfraStructure;
using Company.Domain.CheckoutAgg;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
@@ -73,5 +74,28 @@ class CheckoutMapping : IEntityTypeConfiguration
salaryAid.Property(x => x.Amount).HasMaxLength(25);
salaryAid.Property(x => x.CalculationDateTimeFa).HasMaxLength(15);
});
+
+ builder.OwnsOne(x => x.CheckoutRollCall, rollCall =>
+ {
+ rollCall.Property(x => x.TotalPresentTimeSpan).HasTimeSpanConversion();
+ rollCall.Property(x => x.TotalBreakTimeSpan).HasTimeSpanConversion();
+ rollCall.Property(x => x.TotalWorkingTimeSpan).HasTimeSpanConversion();
+ rollCall.Property(x => x.TotalPaidLeaveTmeSpan).HasTimeSpanConversion();
+ rollCall.Property(x => x.TotalSickLeaveTimeSpan).HasTimeSpanConversion();
+ rollCall.Property(x => x.TotalMandatoryTimeSpan).HasTimeSpanConversion();
+ rollCall.OwnsMany(x => x.RollCallDaysCollection, rollCallDay =>
+ {
+ rollCallDay.HasKey(x => x.Id);
+ rollCallDay.WithOwner().HasForeignKey(x => x.CheckoutId);
+
+ rollCallDay.Property(x => x.WorkingTimeSpan).HasTimeSpanConversion();
+ rollCallDay.Property(x => x.BreakTimeSpan).HasTimeSpanConversion();
+ rollCallDay.Property(x => x.FirstStartDate).HasMaxLength(18);
+ rollCallDay.Property(x => x.FirstEndDate).HasMaxLength(18);
+ rollCallDay.Property(x => x.SecondStartDate).HasMaxLength(18);
+ rollCallDay.Property(x => x.SecondEndDate).HasMaxLength(18);
+ rollCallDay.Property(x => x.LeaveType).HasMaxLength(18);
+ });
+ });
}
}
\ No newline at end of file
diff --git a/CompanyManagment.EFCore/Mapping/EmployeeComputeOptionsMapping.cs b/CompanyManagment.EFCore/Mapping/EmployeeComputeOptionsMapping.cs
index 1bfa8b6c..19cffcd5 100644
--- a/CompanyManagment.EFCore/Mapping/EmployeeComputeOptionsMapping.cs
+++ b/CompanyManagment.EFCore/Mapping/EmployeeComputeOptionsMapping.cs
@@ -1,4 +1,6 @@
-using Company.Domain.EmployeeComputeOptionsAgg;
+using System;
+using _0_Framework.Application;
+using Company.Domain.EmployeeComputeOptionsAgg;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
@@ -16,6 +18,9 @@ public class EmployeeComputeOptionsMapping : IEntityTypeConfiguration x.ComputeOptions).HasMaxLength(50);
builder.Property(x => x.YearsOptions).HasMaxLength(50);
builder.Property(x => x.BonusesOptions).HasMaxLength(50);
+ builder.Property(x => x.ContractTerm).HasMaxLength(10);
+ builder.Property(x => x.CutContractEndOfYear).HasConversion(x => x.ToString()
+ , x => ((IsActive)Enum.Parse(typeof(IsActive), x))).HasMaxLength(5);
}
}
\ No newline at end of file
diff --git a/CompanyManagment.EFCore/Mapping/InsuranceListMapping.cs b/CompanyManagment.EFCore/Mapping/InsuranceListMapping.cs
index 5a781b31..b89965e2 100644
--- a/CompanyManagment.EFCore/Mapping/InsuranceListMapping.cs
+++ b/CompanyManagment.EFCore/Mapping/InsuranceListMapping.cs
@@ -13,5 +13,32 @@ public class InsuranceListMapping : IEntityTypeConfiguration
builder.Property(x => x.Year).HasMaxLength(4);
builder.Property(x => x.Month).HasMaxLength(2);
+
+ builder.ComplexProperty(x => x.Inspection, inspection =>
+ {
+ inspection.IsRequired();
+ inspection.Property(x => x.Type).HasConversion().HasMaxLength(50);
+ inspection.Property(x => x.LastInspectionDateTime);
+ inspection.Property(x => x.MediaId);
+ });
+
+ builder.ComplexProperty(x => x.Debt, debt =>
+ {
+ debt.IsRequired();
+ debt.Property(x => x.Type).HasConversion().HasMaxLength(50);
+ debt.Property(x => x.DebtDate);
+ debt.Property(x => x.Amount);
+ debt.Property(x => x.MediaId);
+ });
+
+ builder.ComplexProperty(x => x.EmployerApproval, approval =>
+ {
+ approval.IsRequired();
+ approval.Property(x => x.Status).HasConversion().HasMaxLength(50);
+ approval.Property(x => x.Description).HasMaxLength(500);
+ });
+
+ //builder.HasMany(x => x.EmployerSignatures)
+ // .WithOne(x => x.InsuranceList).HasForeignKey(x => x.InsuranceListId);
}
}
\ No newline at end of file
diff --git a/CompanyManagment.EFCore/Mapping/WorkshopMapping.cs b/CompanyManagment.EFCore/Mapping/WorkshopMapping.cs
index f99f7f73..22e569ef 100644
--- a/CompanyManagment.EFCore/Mapping/WorkshopMapping.cs
+++ b/CompanyManagment.EFCore/Mapping/WorkshopMapping.cs
@@ -1,4 +1,6 @@
-using Company.Domain.InsurancWorkshopInfoAgg;
+using System;
+using _0_Framework.Application;
+using Company.Domain.InsurancWorkshopInfoAgg;
using Company.Domain.WorkshopAgg;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
@@ -38,10 +40,13 @@ partial class WorkshopMapping : IEntityTypeConfiguration
builder.Property(x => x.IsOldContract);
builder.Property(x => x.HasRollCallFreeVip).HasMaxLength(5);
builder.Property(x => x.WorkshopHolidayWorking);
- //builder.HasOne(x => x.Employer)
- // .WithMany(x => x.Workshops)
- // .HasForeignKey(x => x.EmployerId);
- builder.HasMany(x => x.LeftWorks)
+
+ builder.Property(x => x.CutContractEndOfYear).HasConversion(x => x.ToString()
+ , x => ((IsActive)Enum.Parse(typeof(IsActive), x))).HasMaxLength(5);
+ //builder.HasOne(x => x.Employer)
+ // .WithMany(x => x.Workshops)
+ // .HasForeignKey(x => x.EmployerId);
+ builder.HasMany(x => x.LeftWorks)
.WithOne(x => x.Workshop)
.HasForeignKey(x => x.WorkshopId);
diff --git a/CompanyManagment.EFCore/Migrations/20250521125646_add inspection-debt-approval to insurance list.Designer.cs b/CompanyManagment.EFCore/Migrations/20250521125646_add inspection-debt-approval to insurance list.Designer.cs
new file mode 100644
index 00000000..d587468b
--- /dev/null
+++ b/CompanyManagment.EFCore/Migrations/20250521125646_add inspection-debt-approval to insurance list.Designer.cs
@@ -0,0 +1,9589 @@
+//
+using System;
+using System.Collections.Generic;
+using CompanyManagment.EFCore;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Metadata;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+
+#nullable disable
+
+namespace CompanyManagment.EFCore.Migrations
+{
+ [DbContext(typeof(CompanyContext))]
+ [Migration("20250521125646_add inspection-debt-approval to insurance list")]
+ partial class addinspectiondebtapprovaltoinsurancelist
+ {
+ ///
+ protected override void BuildTargetModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder
+ .HasAnnotation("ProductVersion", "8.0.10")
+ .HasAnnotation("Relational:MaxIdentifierLength", 128);
+
+ SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
+
+ modelBuilder.Entity("Company.Domain.AndroidApkVersionAgg.AndroidApkVersion", b =>
+ {
+ b.Property("id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("bigint");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id"));
+
+ b.Property("CreationDate")
+ .HasColumnType("datetime2");
+
+ b.Property("IsActive")
+ .IsRequired()
+ .HasMaxLength(5)
+ .HasColumnType("nvarchar(5)");
+
+ b.Property("Path")
+ .HasMaxLength(255)
+ .HasColumnType("nvarchar(255)");
+
+ b.Property("Title")
+ .HasMaxLength(50)
+ .HasColumnType("nvarchar(50)");
+
+ b.Property("VersionCode")
+ .HasMaxLength(20)
+ .HasColumnType("nvarchar(20)");
+
+ b.Property("VersionName")
+ .HasMaxLength(35)
+ .HasColumnType("nvarchar(35)");
+
+ b.HasKey("id");
+
+ b.ToTable("AndroidApkVersions", (string)null);
+ });
+
+ modelBuilder.Entity("Company.Domain.BankAgg.Bank", b =>
+ {
+ b.Property("id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("bigint");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id"));
+
+ b.Property("BankLogoMediaId")
+ .HasColumnType("bigint");
+
+ b.Property("BankName")
+ .HasMaxLength(50)
+ .HasColumnType("nvarchar(50)");
+
+ b.HasKey("id");
+
+ b.ToTable("Banks", (string)null);
+ });
+
+ modelBuilder.Entity("Company.Domain.BillAgg.EntityBill", b =>
+ {
+ b.Property("id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("bigint");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id"));
+
+ b.Property("Appointed")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Contact")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("CreationDate")
+ .HasColumnType("datetime2");
+
+ b.Property("Description")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("IsActiveString")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("ProcessingStage")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("SubjectBill")
+ .IsRequired()
+ .HasMaxLength(500)
+ .HasColumnType("nvarchar(500)");
+
+ b.HasKey("id");
+
+ b.ToTable("TextManager_Bill", (string)null);
+ });
+
+ modelBuilder.Entity("Company.Domain.Board.Board", b =>
+ {
+ b.Property("id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("bigint");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id"));
+
+ b.Property("BoardChairman")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("BoardType_Id")
+ .HasColumnType("int");
+
+ b.Property("Branch")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("CreationDate")
+ .HasColumnType("datetime2");
+
+ b.Property("DisputeResolutionPetitionDate")
+ .HasColumnType("datetime2");
+
+ b.Property("ExpertReport")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("File_Id")
+ .HasColumnType("bigint");
+
+ b.HasKey("id");
+
+ b.HasIndex("BoardType_Id");
+
+ b.HasIndex("File_Id");
+
+ b.ToTable("Boards", (string)null);
+ });
+
+ modelBuilder.Entity("Company.Domain.BoardType.BoardType", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("Title")
+ .HasColumnType("nvarchar(max)");
+
+ b.HasKey("Id");
+
+ b.ToTable("BoardTypes", (string)null);
+ });
+
+ modelBuilder.Entity("Company.Domain.ChapterAgg.EntityChapter", b =>
+ {
+ b.Property("id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("bigint");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id"));
+
+ b.Property("Chapter")
+ .IsRequired()
+ .HasMaxLength(60)
+ .HasColumnType("nvarchar(60)");
+
+ b.Property("CreationDate")
+ .HasColumnType("datetime2");
+
+ b.Property("IsActiveString")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Subtitle_Id")
+ .HasColumnType("bigint");
+
+ b.HasKey("id");
+
+ b.HasIndex("Subtitle_Id");
+
+ b.ToTable("TextManager_Chapter", (string)null);
+ });
+
+ modelBuilder.Entity("Company.Domain.CheckoutAgg.Checkout", b =>
+ {
+ b.Property("id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("bigint");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id"));
+
+ b.Property("AbsenceDeduction")
+ .HasColumnType("float");
+
+ b.Property("AbsencePeriod")
+ .HasColumnType("float");
+
+ b.Property("AbsenceValue")
+ .HasMaxLength(10)
+ .HasColumnType("nvarchar(10)");
+
+ b.Property("ArchiveCode")
+ .HasMaxLength(15)
+ .HasColumnType("nvarchar(15)");
+
+ b.Property("AverageHoursPerDay")
+ .HasColumnType("float");
+
+ b.Property("BaseYearsPay")
+ .HasColumnType("float");
+
+ b.Property("BonusesPay")
+ .HasColumnType("float");
+
+ b.Property("ConsumableItems")
+ .HasColumnType("float");
+
+ b.Property("ContractEnd")
+ .HasColumnType("datetime2");
+
+ b.Property("ContractId")
+ .HasColumnType("bigint");
+
+ b.Property("ContractNo")
+ .HasMaxLength(50)
+ .HasColumnType("nvarchar(50)");
+
+ b.Property("ContractStart")
+ .HasColumnType("datetime2");
+
+ b.Property("CreationDate")
+ .HasColumnType("datetime2");
+
+ b.Property("CreditLeaves")
+ .HasColumnType("float");
+
+ b.Property("DateOfBirth")
+ .HasMaxLength(10)
+ .HasColumnType("nvarchar(10)");
+
+ b.Property("EmployeeFullName")
+ .HasMaxLength(50)
+ .HasColumnType("nvarchar(50)");
+
+ b.Property("EmployeeId")
+ .HasColumnType("bigint");
+
+ b.Property("FamilyAllowance")
+ .HasColumnType("float");
+
+ b.Property("FathersName")
+ .HasMaxLength(20)
+ .HasColumnType("nvarchar(20)");
+
+ b.Property("FridayPay")
+ .HasColumnType("float");
+
+ b.Property("FridayWorkValue")
+ .HasMaxLength(10)
+ .HasColumnType("nvarchar(10)");
+
+ b.Property("HasRollCall")
+ .HasColumnType("bit");
+
+ b.Property("HousingAllowance")
+ .HasColumnType("float");
+
+ b.Property("InstallmentDeduction")
+ .HasColumnType("float");
+
+ b.Property("InsuranceDeduction")
+ .HasColumnType("float");
+
+ b.Property("IsActiveString")
+ .HasMaxLength(10)
+ .HasColumnType("nvarchar(10)");
+
+ b.Property("LeaveCheckout")
+ .HasColumnType("bit");
+
+ b.Property("LeavePay")
+ .HasColumnType("float");
+
+ b.Property("MarriedAllowance")
+ .HasColumnType("float");
+
+ b.Property("MissionPay")
+ .HasColumnType("float");
+
+ b.Property("Month")
+ .HasMaxLength(10)
+ .HasColumnType("nvarchar(10)");
+
+ b.Property("MonthlySalary")
+ .HasColumnType("float");
+
+ b.Property("NationalCode")
+ .HasMaxLength(10)
+ .HasColumnType("nvarchar(10)");
+
+ b.Property("NightworkPay")
+ .HasColumnType("float");
+
+ b.Property("OverNightWorkValue")
+ .HasMaxLength(10)
+ .HasColumnType("nvarchar(10)");
+
+ b.Property("OverTimeWorkValue")
+ .HasMaxLength(10)
+ .HasColumnType("nvarchar(10)");
+
+ b.Property("OvertimePay")
+ .HasColumnType("float");
+
+ b.Property("PersonnelCode")
+ .HasMaxLength(10)
+ .HasColumnType("nvarchar(10)");
+
+ b.Property("RewardPay")
+ .HasColumnType("float");
+
+ b.Property("RotatingShiftValue")
+ .HasMaxLength(10)
+ .HasColumnType("nvarchar(10)");
+
+ b.Property("SalaryAidDeduction")
+ .HasColumnType("float");
+
+ b.Property("ShiftPay")
+ .HasColumnType("float");
+
+ b.Property("Signature")
+ .HasMaxLength(20)
+ .HasColumnType("nvarchar(20)");
+
+ b.Property("SumOfWorkingDays")
+ .HasMaxLength(6)
+ .HasColumnType("nvarchar(6)");
+
+ b.Property("TaxDeducation")
+ .HasColumnType("float");
+
+ b.Property("TotalClaims")
+ .HasMaxLength(25)
+ .HasColumnType("nvarchar(25)");
+
+ b.Property("TotalDayOfBunosesCompute")
+ .HasMaxLength(10)
+ .HasColumnType("nvarchar(10)");
+
+ b.Property("TotalDayOfLeaveCompute")
+ .HasMaxLength(10)
+ .HasColumnType("nvarchar(10)");
+
+ b.Property("TotalDayOfYearsCompute")
+ .HasMaxLength(10)
+ .HasColumnType("nvarchar(10)");
+
+ b.Property("TotalDeductions")
+ .HasMaxLength(25)
+ .HasColumnType("nvarchar(25)");
+
+ b.Property("TotalPayment")
+ .HasColumnType("float");
+
+ b.Property("WorkingHoursId")
+ .HasColumnType("bigint");
+
+ b.Property("WorkshopId")
+ .HasColumnType("bigint");
+
+ b.Property("WorkshopName")
+ .HasMaxLength(70)
+ .HasColumnType("nvarchar(70)");
+
+ b.Property("Year")
+ .HasMaxLength(4)
+ .HasColumnType("nvarchar(4)");
+
+ b.Property("YearsPay")
+ .HasColumnType("float");
+
+ b.HasKey("id");
+
+ b.HasIndex("WorkshopId");
+
+ b.ToTable("Checkouts", (string)null);
+ });
+
+ modelBuilder.Entity("Company.Domain.ClassifiedSalaryAgg.ClassifiedSalary", b =>
+ {
+ b.Property("id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("bigint");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id"));
+
+ b.Property("CreationDate")
+ .HasColumnType("datetime2");
+
+ b.Property("EndDate")
+ .HasColumnType("datetime2");
+
+ b.Property("Group1")
+ .HasColumnType("float");
+
+ b.Property("Group10")
+ .HasColumnType("float");
+
+ b.Property("Group11")
+ .HasColumnType("float");
+
+ b.Property("Group12")
+ .HasColumnType("float");
+
+ b.Property("Group13")
+ .HasColumnType("float");
+
+ b.Property("Group14")
+ .HasColumnType("float");
+
+ b.Property("Group15")
+ .HasColumnType("float");
+
+ b.Property("Group16")
+ .HasColumnType("float");
+
+ b.Property("Group17")
+ .HasColumnType("float");
+
+ b.Property("Group18")
+ .HasColumnType("float");
+
+ b.Property("Group19")
+ .HasColumnType("float");
+
+ b.Property("Group2")
+ .HasColumnType("float");
+
+ b.Property("Group20")
+ .HasColumnType("float");
+
+ b.Property("Group3")
+ .HasColumnType("float");
+
+ b.Property("Group4")
+ .HasColumnType("float");
+
+ b.Property