Compare commits
132 Commits
Feature/la
...
Feature/In
| Author | SHA1 | Date | |
|---|---|---|---|
| 87d47fa0d9 | |||
| c7d4481a6d | |||
| dff6bc2541 | |||
| 4b52d144e0 | |||
| 90a1683047 | |||
|
|
74dca1d2d2 | ||
|
|
a9b4eb6195 | ||
|
|
2125e15fb9 | ||
| b7f7d3b223 | |||
| d078feccf9 | |||
| 18c27d7a9a | |||
|
|
c080e11fe0 | ||
|
|
0eb9ecc373 | ||
| 470651cb76 | |||
| c6a7e0a0bd | |||
| 2a9d9574e3 | |||
|
|
7b1542d5c6 | ||
|
|
981fd2d4ee | ||
|
|
7f3f785e39 | ||
| ca1ef420af | |||
| d7baf358cc | |||
|
|
676c8d2fa6 | ||
|
|
632ab3631b | ||
| 595b2c8a2d | |||
| fcf2b38457 | |||
| c7bace728e | |||
| 8134216a4a | |||
|
|
3d013cfa60 | ||
| 30bfc96cbe | |||
| 7b71bd36b1 | |||
| 5d55118c3c | |||
| 62900a22a1 | |||
| 280db87408 | |||
| e6977b29fc | |||
| 6e902011ca | |||
| 7cce903f6e | |||
| 4d6077c93d | |||
| c5a1e5c274 | |||
| 4c6de6a76f | |||
| c36e81e263 | |||
| 25c7b67eb5 | |||
| 19b390b17d | |||
| 6b6b0767e3 | |||
| 3d86ba401f | |||
| 818d88d859 | |||
| 6a6e2e532a | |||
| 1a70569a36 | |||
| 8d24339f04 | |||
| ca6638d6a3 | |||
| 608fb824dc | |||
| 4686151bbb | |||
| d7fae42e4f | |||
| 2cfe480733 | |||
|
|
c574ce534d | ||
| 174edbf87d | |||
| a827470831 | |||
| bea858d4e7 | |||
| c9b61c3fc6 | |||
| 45002b88c4 | |||
| 0bacb24aa2 | |||
| 7fd8851f71 | |||
| bc6ae854f8 | |||
| 68f1f81b53 | |||
| d4c2ab939e | |||
| 5822005b68 | |||
| 53aeb60861 | |||
| c2a08d9c33 | |||
| 85e2481680 | |||
| b711e803a9 | |||
| 232a834dc9 | |||
| 55f7b4f7c0 | |||
| c5b521bc50 | |||
| acdd7de4f6 | |||
| 78458f24e5 | |||
| fde58a7c75 | |||
|
|
dbddccf011 | ||
| 488454d354 | |||
| 4126a7370f | |||
| 7aff8ba59f | |||
| 7d6b57affd | |||
| 950f2884ac | |||
| 2edf150ef6 | |||
| df9c268959 | |||
| 3c6303e817 | |||
| 23386fda76 | |||
| 119f4496cd | |||
| ce4fc33daa | |||
| f5d95b21b0 | |||
| 6e83904e11 | |||
| 1f7785581c | |||
| 9140f1ea0b | |||
| 81e6094817 | |||
| e5c0a7db58 | |||
| d44a9224be | |||
| c8018948c2 | |||
| a5e68cbd90 | |||
| 37a6920a74 | |||
| db40ab567c | |||
| 5f324a6fa1 | |||
| d1703ad20e | |||
| 2f38470746 | |||
| 23c02abe65 | |||
| 475142744f | |||
| 230cde7c15 | |||
| 13a2cd78cd | |||
| 4aa3c10466 | |||
| 91fc560355 | |||
| 8acb25dd67 | |||
| 9297bdefb5 | |||
| 61b326aed4 | |||
|
|
397280d0a2 | ||
| 5975a92aa1 | |||
| 0cec7c0cce | |||
| be6cb6430f | |||
| f863fb065f | |||
| 76aa1eae88 | |||
| d0b29e7643 | |||
| f1106deff9 | |||
| 94a5741906 | |||
| 221d06a0fc | |||
| 2b993fb746 | |||
| 756e06cc2f | |||
|
|
5b3c7e471e | ||
|
|
330a3ca839 | ||
| 7c4cf1e2ed | |||
| 1d2c4f26f1 | |||
| 761ac352df | |||
| ecfb7af386 | |||
| 92fd8d6b0e | |||
| 4f68d141e8 | |||
| 75ea35596b | |||
| a0e2b969c0 |
15
0_Framework/Application/Enums/TypeOfCheckoutWarning.cs
Normal file
15
0_Framework/Application/Enums/TypeOfCheckoutWarning.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
namespace _0_Framework.Application.Enums;
|
||||
|
||||
public enum TypeOfCheckoutWarning
|
||||
{
|
||||
/// <summary>
|
||||
/// هشدار های متفرقه
|
||||
/// </summary>
|
||||
OthersWarning,
|
||||
/// <summary>
|
||||
/// هشدار سهم بیمه کارگر
|
||||
/// </summary>
|
||||
InsuranceEmployeeShare,
|
||||
|
||||
|
||||
}
|
||||
@@ -27,9 +27,11 @@ public interface ISmsService
|
||||
|
||||
Task<double> GetCreditAmount();
|
||||
|
||||
public Task<bool> SendInstitutionVerificationLink(string number,string fullName, Guid institutionId);
|
||||
public Task<bool> SendInstitutionCreationVerificationLink(string number, string fullName, Guid institutionId, long contractingPartyId, long institutionContractId);
|
||||
public Task<bool> SendInstitutionAmendmentVerificationLink(string number, string fullName, Guid institutionId, long contractingPartyId, long institutionContractId);
|
||||
|
||||
public Task<bool> SendInstitutionVerificationCode(string number, string code);
|
||||
public Task<bool> SendInstitutionVerificationCode(string number, string code, string contractingPartyFullName,
|
||||
long contractingPartyId, long institutionContractId);
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -1512,6 +1512,14 @@ public static class Tools
|
||||
#region Mahan
|
||||
|
||||
|
||||
public static bool IsvalidIban(this string iban)
|
||||
{
|
||||
return Regex.IsMatch(iban, @"^IR[0-9]{24}$");
|
||||
}
|
||||
public static bool IsValidCardNumber(this string cardNumber)
|
||||
{
|
||||
return Regex.IsMatch(cardNumber, @"^[0-9]{16}$");
|
||||
}
|
||||
/// <summary>
|
||||
/// این متد حروف عربی را به فارسی در میاورد. مثال: علي را به علی تبدیل میکند
|
||||
/// </summary>
|
||||
|
||||
@@ -110,6 +110,53 @@ public interface IUidService
|
||||
{
|
||||
Task<PersonalInfoResponse> GetPersonalInfo(string nationalCode , string birthDate);
|
||||
Task<MatchMobileWithNationalCodeResponse> IsMachPhoneWithNationalCode(string nationalCode , string phoneNumber);
|
||||
Task<IbanInquiryResponse> IbanInquiry (string iban);
|
||||
Task<AccountToIbanResponse> AccountToIban(string accountNumber, UidBanks bank);
|
||||
Task<CardToNumberResponse> CardToIban(string cardNumber);
|
||||
}
|
||||
|
||||
public class CardToNumberResponse:UidBaseResponse
|
||||
{
|
||||
public string Iban { get; set; }
|
||||
public string CardNumber { get; set; }
|
||||
}
|
||||
|
||||
public class AccountToIbanResponse:UidBaseResponse
|
||||
{
|
||||
public string Iban { get; set; }
|
||||
}
|
||||
|
||||
public class IbanInquiryResponse:UidBaseResponse
|
||||
{
|
||||
public IbanInquiryAccountBasicInformation AccountBasicInformation { get; set; }
|
||||
[JsonProperty("owners")]
|
||||
public List<IbanInquiryOwner> Owners { get; set; }
|
||||
}
|
||||
|
||||
public class IbanInquiryAccountBasicInformation
|
||||
{
|
||||
public string Iban { get; set; }
|
||||
public string AccountNumber { get; set; }
|
||||
public IbanInquiryBankInformation BankInformation { get; set; }
|
||||
public string AccountStatus { get; set; }
|
||||
|
||||
}
|
||||
|
||||
public class IbanInquiryBankInformation
|
||||
{
|
||||
public string BankName { get; set; }
|
||||
}
|
||||
|
||||
public class IbanInquiryOwner
|
||||
{
|
||||
[JsonProperty("firstName")]
|
||||
public string FirstName { get; set; }
|
||||
[JsonProperty("lastName")]
|
||||
public string LastName { get; set; }
|
||||
[JsonProperty("nationalIdentifier")]
|
||||
public string NationalIdentifier { get; set; }
|
||||
[JsonProperty("customerType")]
|
||||
public string CustomerType { get; set; }
|
||||
}
|
||||
|
||||
public class MatchMobileWithNationalCodeResponse
|
||||
@@ -118,4 +165,7 @@ public class MatchMobileWithNationalCodeResponse
|
||||
|
||||
public ResponseContext ResponseContext { get; set; }
|
||||
}
|
||||
|
||||
public class UidBaseResponse
|
||||
{
|
||||
public ResponseContext ResponseContext { get; set; }
|
||||
}
|
||||
|
||||
117
0_Framework/Application/UID/UidBanks.cs
Normal file
117
0_Framework/Application/UID/UidBanks.cs
Normal file
@@ -0,0 +1,117 @@
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace _0_Framework.Application.UID;
|
||||
|
||||
public enum UidBanks
|
||||
{
|
||||
[Description("بانک دی")]
|
||||
BANK_DEY = 66,
|
||||
|
||||
[Description("بانک سپه")]
|
||||
BANK_SEPAH = 15,
|
||||
|
||||
[Description("بانک شهر")]
|
||||
BANK_SHAHR = 61,
|
||||
|
||||
[Description("بانک ملت")]
|
||||
BANK_MELAT = 12,
|
||||
|
||||
[Description("بانک ملی")]
|
||||
BANK_MELLI = 17,
|
||||
|
||||
[Description("بانک رفاه کارگران")]
|
||||
BANK_REFAH = 13,
|
||||
|
||||
[Description("بانک سینا")]
|
||||
BANK_SINA = 59,
|
||||
|
||||
[Description("بانک مسکن")]
|
||||
BANK_MASKAN = 14,
|
||||
|
||||
[Description("بانک آینده")]
|
||||
BANK_AYANDEH = 62,
|
||||
|
||||
[Description("بانک انصار")]
|
||||
BANK_ANSAR = 63,
|
||||
|
||||
[Description("بانک تجارت")]
|
||||
BANK_TEJARAT = 18,
|
||||
|
||||
[Description("بانک رسالت")]
|
||||
BANK_RESALAT = 70,
|
||||
|
||||
[Description("بانک سامان")]
|
||||
BANK_SAMAN = 56,
|
||||
|
||||
[Description("بانک مرکزی")]
|
||||
BANK_MARKAZI = 10,
|
||||
|
||||
[Description("بانک سرمایه")]
|
||||
BANK_SARMAYEH = 58,
|
||||
|
||||
[Description("بانک صادرات")]
|
||||
BANK_SADERAT = 19,
|
||||
|
||||
[Description("بانک قوامین")]
|
||||
BANK_GHAVAMIN = 52,
|
||||
|
||||
[Description("بانک پارسیان")]
|
||||
BANK_PARSIAN = 54,
|
||||
|
||||
[Description("بانک کشاورزی")]
|
||||
BANK_KESHAVARZI = 16,
|
||||
|
||||
[Description("بانک گردشگری")]
|
||||
BANK_GARDESHGARI = 64,
|
||||
|
||||
[Description("پست بانک")]
|
||||
BANK_POST_BANK = 21,
|
||||
|
||||
[Description("بانک پاسارگاد")]
|
||||
BANK_PASARGAD = 57,
|
||||
|
||||
[Description("بانک کارآفرین")]
|
||||
BANK_KARAFARIN = 53,
|
||||
|
||||
[Description("بانک خاورمیانه")]
|
||||
BANK_KHAVARMIANEH = 78,
|
||||
|
||||
[Description("بانک ایران زمین")]
|
||||
BANK_IRAN_ZAMIN = 69,
|
||||
|
||||
[Description("بانک مهر اقتصاد")]
|
||||
BANK_MEHR_EQTESAD = 79,
|
||||
|
||||
[Description("بانک صنعت و معدن")]
|
||||
BANK_SANAT_MADAN = 11,
|
||||
|
||||
[Description("بانک اقتصاد نوین")]
|
||||
BANK_EGHTESAD_NOVIN = 55,
|
||||
|
||||
[Description("بانک توسعه تعاون")]
|
||||
BANK_TOSSE_TAAVON = 22,
|
||||
|
||||
[Description("بانک توسعه صادرات")]
|
||||
BANK_TOSSE_SADERAT = 20,
|
||||
|
||||
[Description("بانک ایران و ونزوئلا")]
|
||||
BANK_IRAN_VENEZUELA = 95,
|
||||
|
||||
[Description("بانک حکمت ایرانیان")]
|
||||
BANK_HEKMAT_IRANIAN = 65,
|
||||
|
||||
[Description("بانک قرض الحسنه مهر")]
|
||||
BANK_GHARZOLHASANEH_MEHR = 60,
|
||||
|
||||
[Description("موسسه مالی و اعتباری ملل")]
|
||||
BANK_MOASSASE_MELLAL = 75,
|
||||
|
||||
[Description("موسسه مالی و اعتباری نور")]
|
||||
BANK_MOASSASE_NOOR = 80,
|
||||
|
||||
[Description("موسسه مالی و اعتباری کوثر")]
|
||||
BANK_MOASSASE_KOSAR = 73,
|
||||
|
||||
[Description("موسسه مالی و اعتباری توسعه")]
|
||||
BANK_MOASSASE_TOSSE = 51
|
||||
}
|
||||
27
0_Framework/Application/UID/UidBanksExtension.cs
Normal file
27
0_Framework/Application/UID/UidBanksExtension.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Reflection;
|
||||
|
||||
namespace _0_Framework.Application.UID
|
||||
{
|
||||
public static class UidBanksExtension
|
||||
{
|
||||
/// <summary>
|
||||
/// دریافت نام فارسی بانک
|
||||
/// </summary>
|
||||
/// <param name="bank">بانک</param>
|
||||
/// <returns>نام فارسی بانک</returns>
|
||||
public static string GetPersianName(this UidBanks bank)
|
||||
{
|
||||
var fieldInfo = bank.GetType().GetField(bank.ToString());
|
||||
|
||||
if (fieldInfo == null)
|
||||
return string.Empty;
|
||||
|
||||
var attribute = (DescriptionAttribute)Attribute.GetCustomAttribute(
|
||||
fieldInfo, typeof(DescriptionAttribute));
|
||||
|
||||
return attribute?.Description ?? bank.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
using System.Collections.Generic;
|
||||
using _0_Framework_b.Domain;
|
||||
|
||||
namespace Company.Domain.AuthorizedBankDetailsAgg
|
||||
{
|
||||
public class AuthorizedBankDetails : EntityBase
|
||||
{
|
||||
private AuthorizedBankDetails()
|
||||
{
|
||||
OwnersList = new List<AuthorizedBankDetailsOwner>();
|
||||
}
|
||||
|
||||
public AuthorizedBankDetails(string cardNumber, string accountNumber, string ban, string bankName, List<AuthorizedBankDetailsOwner> ownersList)
|
||||
{
|
||||
CardNumber = cardNumber;
|
||||
AccountNumber = accountNumber;
|
||||
IBan = ban;
|
||||
BankName = bankName;
|
||||
OwnersList = ownersList ?? new List<AuthorizedBankDetailsOwner>();
|
||||
}
|
||||
|
||||
public string CardNumber { get; private set; }
|
||||
public string AccountNumber { get; private set; }
|
||||
public string IBan { get; private set; }
|
||||
public string BankName { get; private set; }
|
||||
public List<AuthorizedBankDetailsOwner> OwnersList { get; private set; }
|
||||
}
|
||||
|
||||
public class AuthorizedBankDetailsOwner // Value Object - not inheriting from EntityBase
|
||||
{
|
||||
private AuthorizedBankDetailsOwner() { }
|
||||
|
||||
public AuthorizedBankDetailsOwner(string fName, string lName, string nationalIdentifier, string customerType)
|
||||
{
|
||||
FName = fName;
|
||||
LName = lName;
|
||||
NationalIdentifier = nationalIdentifier;
|
||||
CustomerType = customerType;
|
||||
}
|
||||
|
||||
public string FName { get; private set; }
|
||||
public string LName { get; private set; }
|
||||
public string NationalIdentifier { get; private set; }
|
||||
public string CustomerType { get; private set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
using _0_Framework_b.Domain;
|
||||
using System.Collections.Generic;
|
||||
using Company.Application.Contracts.AuthorizedBankDetails;
|
||||
|
||||
namespace Company.Domain.AuthorizedBankDetailsAgg
|
||||
{
|
||||
public interface IAuthorizedBankDetailsRepository : IRepository<long, AuthorizedBankDetails>
|
||||
{
|
||||
EditAuthorizedBankDetails GetDetails(long id);
|
||||
List<AuthorizedBankDetailsViewModel> Search(AuthorizedBankDetailsSearchModel searchModel);
|
||||
AuthorizedBankDetailsViewModel GetByIban(string iban);
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Security.AccessControl;
|
||||
using _0_Framework.Application;
|
||||
using _0_Framework.Domain;
|
||||
using _0_Framework.Domain.CustomizeCheckoutShared.Enums;
|
||||
@@ -12,25 +13,25 @@ namespace Company.Domain.CheckoutAgg;
|
||||
|
||||
public class Checkout : EntityBase
|
||||
{
|
||||
private Checkout()
|
||||
{
|
||||
|
||||
}
|
||||
public Checkout()
|
||||
{
|
||||
}
|
||||
|
||||
public Checkout(string employeeFullName, string fathersName, string nationalCode, string dateOfBirth,
|
||||
long employeeId, string workshopName, long workshopId, string contractNo, DateTime contractStart,
|
||||
DateTime contractEnd, string month, string year, long contractId, long workingHoursId,
|
||||
DateTime contractEnd, string month, string year, long contractId, long workingHoursId,
|
||||
double monthlySalary, double baseYearsPay, double consumableItems, double housingAllowance,
|
||||
double overtimePay, double nightworkPay, double fridayPay, double missionPay, double shiftPay,
|
||||
double familyAllowance, double bonusesPay, double yearsPay, double leavePay,
|
||||
double insuranceDeduction, double taxDeducation, double installmentDeduction,
|
||||
double salaryAidDeduction, double absenceDeduction, string sumOfWorkingDays
|
||||
, string archiveCode, string personnelCode,
|
||||
, string archiveCode, string personnelCode,
|
||||
string totalClaims, string totalDeductions, double totalPayment, string signature, double marriedAllowance, bool leaveCheckout,
|
||||
double creditLeaves, double absencePeriod, double averageHoursPerDay, bool hasRollCall, string overTimeWorkvalue,
|
||||
string overNightWorkValue, string fridayWorkValue, string rotatingShifValue, string absenceValue,
|
||||
string totalDayOfLeaveCompute, string totalDayOfYearsCompute, string totalDayOfBunosesCompute,
|
||||
ICollection<CheckoutLoanInstallment> loanInstallments,
|
||||
ICollection<CheckoutSalaryAid> salaryAids,CheckoutRollCall checkoutRollCall,TimeSpan employeeMandatoryHours)
|
||||
ICollection<CheckoutSalaryAid> salaryAids, CheckoutRollCall checkoutRollCall, TimeSpan employeeMandatoryHours, bool hasInsuranceShareTheSameAsList)
|
||||
{
|
||||
EmployeeFullName = employeeFullName;
|
||||
FathersName = fathersName;
|
||||
@@ -91,6 +92,7 @@ public class Checkout : EntityBase
|
||||
SalaryAids = salaryAids;
|
||||
CheckoutRollCall = checkoutRollCall;
|
||||
EmployeeMandatoryHours = employeeMandatoryHours;
|
||||
HasInsuranceShareTheSameAsList = hasInsuranceShareTheSameAsList;
|
||||
}
|
||||
|
||||
|
||||
@@ -99,7 +101,7 @@ public class Checkout : EntityBase
|
||||
public string Signature { get; private set; }
|
||||
public string FathersName { get; private set; }
|
||||
public string NationalCode { get; private set; }
|
||||
public string DateOfBirth { get; private set; }
|
||||
public string DateOfBirth { get; private set; }
|
||||
public long EmployeeId { get; private set; }
|
||||
|
||||
public string WorkshopName { get; private set; }
|
||||
@@ -135,7 +137,7 @@ public class Checkout : EntityBase
|
||||
public double SalaryAidDeduction { get; private set; }
|
||||
|
||||
public double AbsenceDeduction { get; private set; }
|
||||
|
||||
|
||||
public string SumOfWorkingDays { get; private set; }
|
||||
public string ArchiveCode { get; private set; }
|
||||
public string PersonnelCode { get; private set; }
|
||||
@@ -157,58 +159,70 @@ public class Checkout : EntityBase
|
||||
//میانگین ساعت کار در یک روز
|
||||
public double AverageHoursPerDay { get; private set; }
|
||||
public bool HasRollCall { get; private set; }
|
||||
/// <summary>
|
||||
/// مقدار اضافه کار
|
||||
/// </summary>
|
||||
/// <summary>
|
||||
/// مقدار اضافه کار
|
||||
/// </summary>
|
||||
public string OverTimeWorkValue { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// مقدار شبکاری
|
||||
/// </summary>
|
||||
|
||||
/// <summary>
|
||||
/// مقدار شبکاری
|
||||
/// </summary>
|
||||
public string OverNightWorkValue { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// مقدار جمعه کاری
|
||||
/// </summary>
|
||||
public string FridayWorkValue { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// درصد نوبت کاری
|
||||
/// </summary>
|
||||
public string RotatingShiftValue { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
|
||||
/// <summary>
|
||||
/// مقدار جمعه کاری
|
||||
/// </summary>
|
||||
public string FridayWorkValue { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// درصد نوبت کاری
|
||||
/// </summary>
|
||||
public string RotatingShiftValue { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// مقدار غیبت
|
||||
/// </summary>
|
||||
public string AbsenceValue { get; private set; }
|
||||
public string AbsenceValue { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// تعداد روزهای محاسبه شده برای مزد مرخصی
|
||||
/// </summary>
|
||||
public string TotalDayOfLeaveCompute { get; private set; }
|
||||
/// <summary>
|
||||
/// تعداد روزهای محاسبه شده برای سنوات
|
||||
/// </summary>
|
||||
public string TotalDayOfYearsCompute { get; private set; }
|
||||
/// <summary>
|
||||
/// تعداد روزهای محاسبه شده برای عیدی و پاداش
|
||||
/// </summary>
|
||||
public string TotalDayOfBunosesCompute { get; private set; }
|
||||
/// <summary>
|
||||
/// تعداد روزهای محاسبه شده برای مزد مرخصی
|
||||
/// </summary>
|
||||
public string TotalDayOfLeaveCompute { get; private set; }
|
||||
/// <summary>
|
||||
/// تعداد روزهای محاسبه شده برای سنوات
|
||||
/// </summary>
|
||||
public string TotalDayOfYearsCompute { get; private set; }
|
||||
/// <summary>
|
||||
/// تعداد روزهای محاسبه شده برای عیدی و پاداش
|
||||
/// </summary>
|
||||
public string TotalDayOfBunosesCompute { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// دارای تداخل مبلغ است. این در زمانی اتفاق می افتد که فیش مبلغ آن تغییر کرده ولی به دلیل مسائل قانونی امکان صدور دوباره آن وجود ندارد
|
||||
/// </summary>
|
||||
public bool HasAmountConflict { get; private set; }
|
||||
/// <summary>
|
||||
/// دارای تداخل مبلغ است. این در زمانی اتفاق می افتد که فیش مبلغ آن تغییر کرده ولی به دلیل مسائل قانونی امکان صدور دوباره آن وجود ندارد
|
||||
/// </summary>
|
||||
public bool HasAmountConflict { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// ساعت موظفی پرسنل در ماه
|
||||
/// </summary>
|
||||
/// <summary>
|
||||
/// ساعت موظفی پرسنل در ماه
|
||||
/// </summary>
|
||||
public TimeSpan EmployeeMandatoryHours { get; set; }
|
||||
|
||||
#region valueObjects
|
||||
|
||||
public ICollection<CheckoutLoanInstallment> LoanInstallments { get; set; } = [];
|
||||
public ICollection<CheckoutSalaryAid> SalaryAids { get; set; } = [];
|
||||
/// <summary>
|
||||
/// آیا حق بیمه مشابه لیست بیمه حساب شده؟
|
||||
/// </summary>
|
||||
public bool HasInsuranceShareTheSameAsList { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// آیا فیش نیاز به بروزرسانی دارد
|
||||
/// </summary>
|
||||
public bool IsUpdateNeeded { get; private set; }
|
||||
|
||||
public List<CheckoutWarningMessage> CheckoutWarningMessageList { get; set; }
|
||||
|
||||
#region valueObjects
|
||||
|
||||
public ICollection<CheckoutLoanInstallment> LoanInstallments { get; set; } = [];
|
||||
public ICollection<CheckoutSalaryAid> SalaryAids { get; set; } = [];
|
||||
public CheckoutRollCall CheckoutRollCall { get; private set; }
|
||||
#endregion
|
||||
|
||||
@@ -277,7 +291,7 @@ public class Checkout : EntityBase
|
||||
var year = contarctStart.ToFarsiYear();
|
||||
var sumYear = year.Substring(Math.Max(0, year.Length - 2));
|
||||
|
||||
|
||||
|
||||
ContractNo = archiveCode + "/" + personnelCode + "/" + sumYear + "/" + month;
|
||||
}
|
||||
public void Active()
|
||||
@@ -312,7 +326,7 @@ public class Checkout : EntityBase
|
||||
}
|
||||
|
||||
|
||||
public void SetSalaryAid(ICollection<CheckoutSalaryAid> salaryAids,double salaryAidAmount)
|
||||
public void SetSalaryAid(ICollection<CheckoutSalaryAid> salaryAids, double salaryAidAmount)
|
||||
{
|
||||
SalaryAids = salaryAids;
|
||||
SalaryAidDeduction = salaryAidAmount;
|
||||
@@ -330,30 +344,45 @@ public class Checkout : EntityBase
|
||||
|
||||
public void SetAmountConflict(bool hasAmountConflict)
|
||||
{
|
||||
HasAmountConflict = hasAmountConflict;
|
||||
HasAmountConflict = hasAmountConflict;
|
||||
}
|
||||
|
||||
public void SetEmployeeMandatoryHours(TimeSpan employeeMandatoryHours)
|
||||
{
|
||||
EmployeeMandatoryHours = employeeMandatoryHours;
|
||||
}
|
||||
|
||||
public void SetInsuranceShare()
|
||||
{
|
||||
HasInsuranceShareTheSameAsList = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// نیاز به آپدیت
|
||||
/// </summary>
|
||||
public void SetUpdateNeeded()
|
||||
{
|
||||
IsUpdateNeeded = true;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public class CheckoutRollCall
|
||||
{
|
||||
private CheckoutRollCall(){}
|
||||
public CheckoutRollCall(TimeSpan totalMandatoryTimeSpan, TimeSpan totalPresentTimeSpan, TimeSpan totalBreakTimeSpan,
|
||||
TimeSpan totalWorkingTimeSpan, TimeSpan totalPaidLeaveTmeSpan, TimeSpan totalSickLeaveTimeSpan,
|
||||
ICollection<CheckoutRollCallDay> rollCallDaysCollection)
|
||||
{
|
||||
TotalMandatoryTimeSpan = totalMandatoryTimeSpan;
|
||||
TotalPresentTimeSpan = totalPresentTimeSpan;
|
||||
TotalBreakTimeSpan = totalBreakTimeSpan;
|
||||
TotalWorkingTimeSpan = totalWorkingTimeSpan;
|
||||
TotalPaidLeaveTmeSpan = totalPaidLeaveTmeSpan;
|
||||
TotalSickLeaveTimeSpan = totalSickLeaveTimeSpan;
|
||||
RollCallDaysCollection = rollCallDaysCollection;
|
||||
}
|
||||
private CheckoutRollCall() { }
|
||||
public CheckoutRollCall(TimeSpan totalMandatoryTimeSpan, TimeSpan totalPresentTimeSpan, TimeSpan totalBreakTimeSpan,
|
||||
TimeSpan totalWorkingTimeSpan, TimeSpan totalPaidLeaveTmeSpan, TimeSpan totalSickLeaveTimeSpan,
|
||||
ICollection<CheckoutRollCallDay> rollCallDaysCollection)
|
||||
{
|
||||
TotalMandatoryTimeSpan = totalMandatoryTimeSpan;
|
||||
TotalPresentTimeSpan = totalPresentTimeSpan;
|
||||
TotalBreakTimeSpan = totalBreakTimeSpan;
|
||||
TotalWorkingTimeSpan = totalWorkingTimeSpan;
|
||||
TotalPaidLeaveTmeSpan = totalPaidLeaveTmeSpan;
|
||||
TotalSickLeaveTimeSpan = totalSickLeaveTimeSpan;
|
||||
RollCallDaysCollection = rollCallDaysCollection;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
@@ -394,27 +423,27 @@ public class CheckoutRollCall
|
||||
|
||||
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;
|
||||
}
|
||||
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 long Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// تاریخ
|
||||
@@ -458,12 +487,12 @@ public class CheckoutRollCallDay
|
||||
/// <summary>
|
||||
/// آیا غیبت است
|
||||
/// </summary>
|
||||
public bool IsAbsent { get; private set; }
|
||||
public bool IsAbsent { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// آیا جمعه است
|
||||
/// </summary>
|
||||
public bool IsFriday { get; private set; }
|
||||
public bool IsFriday { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// آیا تعطیل رسمی است
|
||||
@@ -475,6 +504,6 @@ public class CheckoutRollCallDay
|
||||
/// </summary>
|
||||
public string LeaveType { get; private set; }
|
||||
|
||||
public long CheckoutId { get; set; }
|
||||
public long CheckoutId { get; set; }
|
||||
|
||||
}
|
||||
32
Company.Domain/CheckoutAgg/CheckoutWarningMessage.cs
Normal file
32
Company.Domain/CheckoutAgg/CheckoutWarningMessage.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
using _0_Framework.Application.Enums;
|
||||
using _0_Framework.Domain;
|
||||
|
||||
namespace Company.Domain.CheckoutAgg;
|
||||
|
||||
public class CheckoutWarningMessage : EntityBaseWithoutCreationDate
|
||||
{
|
||||
public CheckoutWarningMessage(string warningMessage, long checkoutId, TypeOfCheckoutWarning typeOfCheckoutWarning)
|
||||
{
|
||||
WarningMessage = warningMessage;
|
||||
CheckoutId = checkoutId;
|
||||
TypeOfCheckoutWarning = typeOfCheckoutWarning;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// پیام هشدار
|
||||
/// </summary>
|
||||
public string WarningMessage { get; private set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// آی دی فیش حقوقی
|
||||
/// </summary>
|
||||
public long CheckoutId { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// نوع هشدار فیش حقوقی
|
||||
/// </summary>
|
||||
public TypeOfCheckoutWarning TypeOfCheckoutWarning { get; private set; }
|
||||
|
||||
public Checkout Checkout { get; set; }
|
||||
}
|
||||
@@ -54,9 +54,28 @@ public interface IInstitutionContractRepository : IRepository<long, InstitutionC
|
||||
void UpdateStatusIfNeeded(long institutionContractId);
|
||||
Task<GetInstitutionVerificationDetailsViewModel> GetVerificationDetails(Guid id);
|
||||
Task<InstitutionContract> GetByPublicIdAsync(Guid id);
|
||||
|
||||
#region Extension
|
||||
|
||||
Task<InstitutionContractExtensionInquiryResult> GetExtensionInquiry(long previousContractId);
|
||||
Task<InstitutionContractExtensionWorkshopsResponse> GetExtensionWorkshops(InstitutionContractExtensionWorkshopsRequest request);
|
||||
Task<InstitutionContractExtensionPlanResponse> GetExtensionInstitutionPlan(InstitutionContractExtensionPlanRequest request);
|
||||
Task<InstitutionContractExtensionPaymentResponse> GetExtensionPaymentMethod(InstitutionContractExtensionPaymentRequest request);
|
||||
Task<OperationResult> ExtensionComplete(InstitutionContractExtensionCompleteRequest request);
|
||||
|
||||
#endregion
|
||||
|
||||
#region Upgrade(Amendment)
|
||||
|
||||
Task<InstitutionContractAmendmentWorkshopsResponse> GetAmendmentWorkshops(long institutionContractId);
|
||||
Task<InsitutionContractAmendmentPaymentResponse> GetAmendmentPaymentDetails(InsitutionContractAmendmentPaymentRequest request);
|
||||
|
||||
Task<InsertAmendmentTempWorkshopResponse> InsertAmendmentTempWorkshops(InstitutionContractAmendmentTempWorkshopViewModel request);
|
||||
Task RemoveAmendmentWorkshops(Guid workshopTempId);
|
||||
#endregion
|
||||
|
||||
Task<List<InstitutionContractSelectListViewModel>> GetInstitutionContractSelectList(string search, string selected);
|
||||
Task<List<InstitutionContractPrintViewModel>> PrintAllAsync(List<long> ids);
|
||||
Task AmendmentComplete(InstitutionContractAmendmentCompleteRequest request);
|
||||
Task<GetInstitutionAmendmentVerificationDetailsViewModel> GetAmendmentVerificationDetails(Guid id, long amendmentId);
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Linq;
|
||||
using System.Security.Cryptography;
|
||||
using _0_Framework.Domain;
|
||||
using Company.Domain.InstitutionContractContactInfoAgg;
|
||||
@@ -119,26 +120,25 @@ public class InstitutionContract : EntityBase
|
||||
public string HasValueAddedTax { get; private set; }
|
||||
|
||||
public double ValueAddedTax { get; private set; }
|
||||
|
||||
|
||||
public Guid PublicId { get; private set; }
|
||||
|
||||
public string VerifyCode { get; private set; }
|
||||
public DateTime VerifyCodeCreation { get; private set; }
|
||||
|
||||
[NotMapped]
|
||||
public bool VerifyCodeExpired => VerifyCodeCreation.Add(ExpireTime) <= DateTime.Now;
|
||||
public string VerifierFullName { get; private set; }
|
||||
public string VerifierPhoneNumber { get; private set; }
|
||||
|
||||
[NotMapped] public bool VerifyCodeExpired => VerifyCodeCreation.Add(ExpireTime) <= DateTime.Now;
|
||||
|
||||
[NotMapped] public bool CanResendVerifyCode => VerifyCodeCreation.Add(ReSendTime) <= DateTime.Now;
|
||||
|
||||
[NotMapped]
|
||||
public bool CanResendVerifyCode => VerifyCodeCreation.Add(ReSendTime) <= DateTime.Now;
|
||||
|
||||
[NotMapped] public TimeSpan ExpireTime => TimeSpan.FromMinutes(5);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
[NotMapped] public TimeSpan ReSendTime => TimeSpan.FromMinutes(2);
|
||||
|
||||
|
||||
public bool IsInstallment { get; set; }
|
||||
|
||||
|
||||
public InstitutionContractVerificationStatus VerificationStatus { get; private set; }
|
||||
|
||||
public InstitutionContractWorkshopGroup WorkshopGroup { get; private set; }
|
||||
@@ -227,10 +227,12 @@ public class InstitutionContract : EntityBase
|
||||
}
|
||||
|
||||
|
||||
public void SetVerifyCode(string code)
|
||||
public void SetVerifyCode(string code,string verifierFullName, string verifierPhoneNumber)
|
||||
{
|
||||
VerifyCode = code;
|
||||
VerifyCodeCreation = DateTime.Now;
|
||||
VerifierFullName = verifierFullName;
|
||||
VerifierPhoneNumber = verifierPhoneNumber;
|
||||
}
|
||||
|
||||
public void SetWorkshopGroup(InstitutionContractWorkshopGroup workshopGroup)
|
||||
@@ -250,10 +252,29 @@ public class InstitutionContract : EntityBase
|
||||
{
|
||||
WorkshopGroup = null;
|
||||
}
|
||||
|
||||
public void AddAmendment(InstitutionContractAmendment amendment)
|
||||
{
|
||||
Amendments.Add(amendment);
|
||||
}
|
||||
}
|
||||
|
||||
public class InstitutionContractAmendment : EntityBase
|
||||
{
|
||||
private InstitutionContractAmendment(){}
|
||||
public InstitutionContractAmendment(long institutionContractId,
|
||||
List<InstitutionContractInstallment> installments, double amount, bool hasInstallment,
|
||||
List<InstitutionContractAmendmentChange> amendmentChanges, long lawId)
|
||||
{
|
||||
InstitutionContractId = institutionContractId;
|
||||
Installments = installments is { Count: > 0} ? installments : [];
|
||||
Amount = amount;
|
||||
HasInstallment = hasInstallment;
|
||||
AmendmentChanges = amendmentChanges;
|
||||
LawId = lawId;
|
||||
VerificationStatus = InstitutionContractVerificationStatus.PendingForVerify;
|
||||
}
|
||||
|
||||
public long InstitutionContractId { get; set; }
|
||||
public InstitutionContract InstitutionContract { get; set; }
|
||||
public List<InstitutionContractInstallment> Installments { get; set; }
|
||||
@@ -262,10 +283,124 @@ public class InstitutionContractAmendment : EntityBase
|
||||
public string VerifyCode { get; set; }
|
||||
public DateTime VerificationCreation { get; set; }
|
||||
public List<InstitutionContractAmendmentChange> AmendmentChanges { get; set; }
|
||||
|
||||
public long LawId { get; set; }
|
||||
|
||||
|
||||
public string VerifierPhoneNumber { get; private set; }
|
||||
|
||||
public string VerifierFullName { get; private set; }
|
||||
|
||||
public InstitutionContractVerificationStatus VerificationStatus { get; set; }
|
||||
|
||||
public DateTime VerifyCodeCreation { get; set; }
|
||||
|
||||
public void SetVerifyCode(string code,string verifierFullName, string verifierPhoneNumber)
|
||||
{
|
||||
VerifyCode = code;
|
||||
VerifyCodeCreation = DateTime.Now;
|
||||
VerifierFullName = verifierFullName;
|
||||
VerifierPhoneNumber = verifierPhoneNumber;
|
||||
}
|
||||
public void Verified()
|
||||
{
|
||||
VerificationStatus = InstitutionContractVerificationStatus.Verified;
|
||||
}
|
||||
}
|
||||
|
||||
public class InstitutionContractAmendmentChange : EntityBase
|
||||
{
|
||||
private InstitutionContractAmendmentChange() { }
|
||||
|
||||
private InstitutionContractAmendmentChange(InstitutionContractAmendmentChangeType changeType,
|
||||
DateTime changeDateGr, bool? hasCustomizeCheckoutPlan, bool? hasContractPlan,
|
||||
bool? hasContractPlanInPerson, bool? hasInsurancePlan, bool? hasInsurancePlanInPerson, int? personnelCount,
|
||||
bool? hasRollCallPlan, bool? hasRollCallInPerson,
|
||||
long? currentWorkshopId, int personnelCountDifference)
|
||||
{
|
||||
ChangeType = changeType;
|
||||
ChangeDateGr = changeDateGr;
|
||||
HasRollCallPlan = hasRollCallPlan;
|
||||
HasCustomizeCheckoutPlan = hasCustomizeCheckoutPlan;
|
||||
HasContractPlan = hasContractPlan;
|
||||
HasContractPlanInPerson = hasContractPlanInPerson;
|
||||
HasInsurancePlan = hasInsurancePlan;
|
||||
HasInsurancePlanInPerson = hasInsurancePlanInPerson;
|
||||
PersonnelCount = personnelCount;
|
||||
PersonnelCountDifference = personnelCountDifference;
|
||||
CurrentWorkshopId = currentWorkshopId;
|
||||
HasRollCallInPerson = hasRollCallInPerson;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// تغییر تعداد پرسنل
|
||||
/// </summary>
|
||||
public static InstitutionContractAmendmentChange CreatePersonCountChange(
|
||||
DateTime changeDateGr, int personnelCount, int personnelCountDifference,
|
||||
long currentWorkshopId)
|
||||
{
|
||||
return new InstitutionContractAmendmentChange(
|
||||
changeType: InstitutionContractAmendmentChangeType.PersonCount,
|
||||
changeDateGr: changeDateGr,
|
||||
hasCustomizeCheckoutPlan: null,
|
||||
hasContractPlan: null,
|
||||
hasContractPlanInPerson: null,
|
||||
hasInsurancePlan: null,
|
||||
hasInsurancePlanInPerson: null,
|
||||
personnelCount: personnelCount,
|
||||
hasRollCallPlan: null,
|
||||
hasRollCallInPerson: null,
|
||||
currentWorkshopId: currentWorkshopId,
|
||||
personnelCountDifference: personnelCountDifference);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// تغییر خدمات
|
||||
/// </summary>
|
||||
public static InstitutionContractAmendmentChange CreateServicesChange(
|
||||
DateTime changeDateGr, long currentWorkshopId, bool hasRollCallPlan, bool hasRollCallInPerson,
|
||||
bool hasCustomizeCheckoutPlan, bool hasContractPlan, bool hasContractPlanInPerson,
|
||||
bool hasInsurancePlan, bool hasInsurancePlanInPerson)
|
||||
{
|
||||
return new InstitutionContractAmendmentChange(
|
||||
changeType: InstitutionContractAmendmentChangeType.Services,
|
||||
changeDateGr: changeDateGr,
|
||||
hasCustomizeCheckoutPlan: hasCustomizeCheckoutPlan,
|
||||
hasContractPlan: hasContractPlan,
|
||||
hasContractPlanInPerson: hasContractPlanInPerson,
|
||||
hasInsurancePlan: hasInsurancePlan,
|
||||
hasInsurancePlanInPerson: hasInsurancePlanInPerson,
|
||||
personnelCount: null,
|
||||
hasRollCallPlan: hasRollCallPlan,
|
||||
hasRollCallInPerson: hasRollCallInPerson,
|
||||
currentWorkshopId: currentWorkshopId,
|
||||
personnelCountDifference: 0);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ایجاد کارگاه جدید
|
||||
/// </summary>
|
||||
public static InstitutionContractAmendmentChange CreateWorkshopCreatedChange(
|
||||
DateTime changeDateGr, bool hasRollCallPlan, bool hasRollCallInPerson,
|
||||
bool hasCustomizeCheckoutPlan, bool hasContractPlan, bool hasContractPlanInPerson,
|
||||
bool hasInsurancePlan, bool hasInsurancePlanInPerson,int personnelCount)
|
||||
{
|
||||
return new InstitutionContractAmendmentChange(
|
||||
changeType: InstitutionContractAmendmentChangeType.WorkshopCreated,
|
||||
changeDateGr: changeDateGr,
|
||||
hasCustomizeCheckoutPlan: hasCustomizeCheckoutPlan,
|
||||
hasContractPlan: hasContractPlan,
|
||||
hasContractPlanInPerson: hasContractPlanInPerson,
|
||||
hasInsurancePlan: hasInsurancePlan,
|
||||
hasInsurancePlanInPerson: hasInsurancePlanInPerson,
|
||||
personnelCount: personnelCount,
|
||||
hasRollCallPlan: hasRollCallPlan,
|
||||
hasRollCallInPerson: hasRollCallInPerson,
|
||||
currentWorkshopId: null,
|
||||
personnelCountDifference: 0);
|
||||
}
|
||||
|
||||
|
||||
public long InstitutionContractAmendmentId { get; private set; }
|
||||
public InstitutionContractAmendment InstitutionContractAmendment { get; private set; }
|
||||
public InstitutionContractAmendmentChangeType ChangeType { get; private set; }
|
||||
@@ -276,6 +411,8 @@ public class InstitutionContractAmendmentChange : EntityBase
|
||||
/// </summary>
|
||||
public bool? HasRollCallPlan { get; private set; }
|
||||
|
||||
public bool? HasRollCallInPerson { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// پلن فیش غیر رسمی
|
||||
/// </summary>
|
||||
@@ -305,13 +442,17 @@ public class InstitutionContractAmendmentChange : EntityBase
|
||||
/// تعداد پرسنل
|
||||
/// </summary>
|
||||
public int? PersonnelCount { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// مقدار تغییرات تعداد پرسنل
|
||||
/// </summary>
|
||||
public int PersonnelCountDifference { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// تعداد کارگاه
|
||||
/// </summary>
|
||||
public long? WorkshopDetailsId { get; private set; }
|
||||
|
||||
|
||||
public long? CurrentWorkshopId { get; private set; }
|
||||
}
|
||||
|
||||
public enum InstitutionContractAmendmentChangeType
|
||||
|
||||
@@ -9,7 +9,7 @@ public class InstitutionContractWorkshopBase:EntityBase
|
||||
protected InstitutionContractWorkshopBase(){}
|
||||
public InstitutionContractWorkshopBase(string workshopName, bool hasRollCallPlan,bool hasRollCallPlanInPerson,
|
||||
bool hasCustomizeCheckoutPlan, bool hasContractPlan,bool hasContractPlanInPerson,bool hasInsurancePlan,bool hasInsurancePlanInPerson,
|
||||
int personnelCount, double price )
|
||||
int personnelCount, double price,bool isAmendment )
|
||||
{
|
||||
WorkshopName = workshopName;
|
||||
Services = new WorkshopServices(hasInsurancePlan, hasInsurancePlanInPerson,
|
||||
@@ -17,7 +17,10 @@ public class InstitutionContractWorkshopBase:EntityBase
|
||||
PersonnelCount = personnelCount;
|
||||
Price = price;
|
||||
Employers = [];
|
||||
IsAmendment = isAmendment;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// شناسه کارگاه
|
||||
/// </summary>
|
||||
@@ -42,7 +45,11 @@ public class InstitutionContractWorkshopBase:EntityBase
|
||||
|
||||
|
||||
public double Price { get; private set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// جهت نمایش دادن اینکه آیا این کارگاه مربوط به ارتقا قرارداد است یا خیر
|
||||
/// </summary>
|
||||
public bool IsAmendment { get; set; }
|
||||
|
||||
public List<InstitutionContractWorkshopDetailEmployer> Employers { get; private set; } = new();
|
||||
|
||||
|
||||
@@ -10,9 +10,10 @@ public class InstitutionContractWorkshopCurrent:InstitutionContractWorkshopBase
|
||||
public InstitutionContractWorkshopCurrent(string workshopName, bool hasRollCallPlan,
|
||||
bool hasRollCallPlanInPerson, bool hasCustomizeCheckoutPlan, bool hasContractPlan,
|
||||
bool hasContractPlanInPerson, bool hasInsurancePlan, bool hasInsurancePlanInPerson,
|
||||
int personnelCount, double price,long institutionContractWorkshopGroupId,InstitutionContractWorkshopGroup workshopGroup,long workshopId) : base(workshopName, hasRollCallPlan,
|
||||
int personnelCount, double price,long institutionContractWorkshopGroupId,
|
||||
InstitutionContractWorkshopGroup workshopGroup,long workshopId,bool isAmendment) : base(workshopName, hasRollCallPlan,
|
||||
hasRollCallPlanInPerson, hasCustomizeCheckoutPlan, hasContractPlan,
|
||||
hasContractPlanInPerson, hasInsurancePlan, hasInsurancePlanInPerson, personnelCount, price)
|
||||
hasContractPlanInPerson, hasInsurancePlan, hasInsurancePlanInPerson, personnelCount, price,isAmendment)
|
||||
{
|
||||
InstitutionContractWorkshopGroupId = institutionContractWorkshopGroupId;
|
||||
WorkshopGroup = workshopGroup;
|
||||
|
||||
@@ -31,6 +31,13 @@ public class InstitutionContractWorkshopGroup : EntityBase
|
||||
InitialWorkshops = initialWorkshops.ToList();
|
||||
LastModifiedDate = DateTime.Now;
|
||||
}
|
||||
|
||||
public void AddAmendmentWorkshops(List<InstitutionContractWorkshopInitial> amendmentDetails)
|
||||
{
|
||||
InitialWorkshops.AddRange(amendmentDetails);
|
||||
LastModifiedDate = DateTime.Now;
|
||||
}
|
||||
|
||||
|
||||
public void UpdateCurrentWorkshops(List<InstitutionContractWorkshopCurrent> updatedDetails)
|
||||
{
|
||||
|
||||
@@ -11,9 +11,9 @@ public class InstitutionContractWorkshopInitial:InstitutionContractWorkshopBase
|
||||
public InstitutionContractWorkshopInitial(string workshopName, bool hasRollCallPlan,
|
||||
bool hasRollCallPlanInPerson, bool hasCustomizeCheckoutPlan, bool hasContractPlan,
|
||||
bool hasContractPlanInPerson, bool hasInsurancePlan, bool hasInsurancePlanInPerson,
|
||||
int personnelCount, double price) : base(workshopName, hasRollCallPlan,
|
||||
int personnelCount, double price,bool isAmendment =false) : base(workshopName, hasRollCallPlan,
|
||||
hasRollCallPlanInPerson, hasCustomizeCheckoutPlan, hasContractPlan, hasContractPlanInPerson,
|
||||
hasInsurancePlan, hasInsurancePlanInPerson, personnelCount, price)
|
||||
hasInsurancePlan, hasInsurancePlanInPerson, personnelCount, price,isAmendment)
|
||||
{
|
||||
WorkshopCreated = false;
|
||||
}
|
||||
@@ -31,7 +31,8 @@ public class InstitutionContractWorkshopInitial:InstitutionContractWorkshopBase
|
||||
WorkshopCreated = true;
|
||||
WorkshopCurrent = new InstitutionContractWorkshopCurrent(WorkshopName,Services.RollCall,Services.RollCallInPerson,
|
||||
Services.CustomizeCheckout,Services.Contract,Services.ContractInPerson,Services.Insurance,
|
||||
Services.InsuranceInPerson,PersonnelCount,Price,InstitutionContractWorkshopGroupId,WorkshopGroup,workshopId);
|
||||
Services.InsuranceInPerson,PersonnelCount,Price,InstitutionContractWorkshopGroupId,WorkshopGroup,workshopId,
|
||||
IsAmendment);
|
||||
WorkshopCurrent.SetEmployers(Employers.Select(x=>x.EmployerId).ToList());
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,167 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using CompanyManagment.App.Contracts.InstitutionContract;
|
||||
using MongoDB.Bson;
|
||||
using MongoDB.Bson.Serialization.Attributes;
|
||||
|
||||
namespace Company.Domain.InstitutionContractAmendmentTempAgg;
|
||||
|
||||
public class InstitutionContractAmendmentTemp
|
||||
{
|
||||
public InstitutionContractAmendmentTemp(List<InstitutionContractAmendmentTempPrevWorkshop> prevWorkshops,
|
||||
long institutionContractId)
|
||||
{
|
||||
Id = Guid.NewGuid();
|
||||
PrevWorkshops = prevWorkshops;
|
||||
NewWorkshops = prevWorkshops.Select(x=> new InstitutionContractAmendmentTempNewWorkshop(
|
||||
x.WorkshopName, x.CountPerson, x.ContractAndCheckout, x.ContractAndCheckoutInPerson, x.Insurance,
|
||||
x.InsuranceInPerson, x.RollCall, x.RollCallInPerson, x.CustomizeCheckout, x.Price, x.WorkshopId,
|
||||
x.CurrentWorkshopId, 0,x.Id)).ToList();
|
||||
InstitutionContractId = institutionContractId;
|
||||
}
|
||||
|
||||
[BsonId]
|
||||
[BsonRepresentation(BsonType.String)]
|
||||
public Guid Id { get; private set; }
|
||||
public List<InstitutionContractAmendmentTempPrevWorkshop> PrevWorkshops { get; private set; }
|
||||
public List<InstitutionContractAmendmentTempNewWorkshop> NewWorkshops { get; private set; }
|
||||
|
||||
public InstitutionContractPaymentMonthlyViewModel MonthlyPayment { get; set; }
|
||||
|
||||
public InstitutionContractPaymentOneTimeViewModel OneTimePayment { get; set; }
|
||||
|
||||
public long InstitutionContractId { get; private set; }
|
||||
|
||||
public int MonthDifference { get; set; }
|
||||
public void AddPaymentDetails(InstitutionContractPaymentMonthlyViewModel resMonthly, InstitutionContractPaymentOneTimeViewModel resOneTime, int monthDiff)
|
||||
{
|
||||
MonthlyPayment = resMonthly;
|
||||
OneTimePayment = resOneTime;
|
||||
MonthDifference = monthDiff;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public class InstitutionContractAmendmentTempNewWorkshop : InstitutionContractAmendmentTempPrevWorkshop
|
||||
{
|
||||
public InstitutionContractAmendmentTempNewWorkshop(string workshopName, int countPerson, bool contractAndCheckout,
|
||||
bool contractAndCheckoutInPerson, bool insurance, bool insuranceInPerson, bool rollCall, bool rollCallInPerson,
|
||||
bool customizeCheckout, double price, long workshopId, long currentWorkshopId,double priceDifference,Guid prevId) : base(
|
||||
workshopName, countPerson, contractAndCheckout, contractAndCheckoutInPerson, insurance, insuranceInPerson,
|
||||
rollCall, rollCallInPerson, customizeCheckout, price, workshopId, currentWorkshopId)
|
||||
{
|
||||
Id = prevId;
|
||||
PriceDifference = priceDifference;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// مبلغ اختلاف کارگاه جدید با کارگاه قبلی(مبلغ اصلی ارتقاء)
|
||||
/// </summary>
|
||||
public double PriceDifference { get; private set; }
|
||||
|
||||
|
||||
public void Edit(string workshopName, int countPerson, bool contractAndCheckout,
|
||||
bool contractAndCheckoutInPerson,
|
||||
bool insurance, bool insuranceInPerson, bool rollCall, bool customizeCheckout,
|
||||
double price,double priceDifference)
|
||||
{
|
||||
base.Edit(workshopName, countPerson, contractAndCheckout, contractAndCheckoutInPerson, insurance,
|
||||
insuranceInPerson, rollCall, customizeCheckout, price);
|
||||
PriceDifference = priceDifference;
|
||||
}
|
||||
}
|
||||
|
||||
public class InstitutionContractAmendmentTempPrevWorkshop
|
||||
{
|
||||
public InstitutionContractAmendmentTempPrevWorkshop(string workshopName, int countPerson, bool contractAndCheckout,
|
||||
bool contractAndCheckoutInPerson,
|
||||
bool insurance, bool insuranceInPerson,
|
||||
bool rollCall, bool rollCallInPerson, bool customizeCheckout, double price, long workshopId,
|
||||
long currentWorkshopId)
|
||||
{
|
||||
Id = Guid.NewGuid();
|
||||
WorkshopName = workshopName;
|
||||
CountPerson = countPerson;
|
||||
ContractAndCheckout = contractAndCheckout;
|
||||
Insurance = insurance;
|
||||
RollCall = rollCall;
|
||||
CustomizeCheckout = customizeCheckout;
|
||||
ContractAndCheckoutInPerson = contractAndCheckoutInPerson;
|
||||
InsuranceInPerson = insuranceInPerson;
|
||||
RollCallInPerson = rollCallInPerson;
|
||||
Price = price;
|
||||
WorkshopId = workshopId;
|
||||
CurrentWorkshopId = currentWorkshopId;
|
||||
}
|
||||
|
||||
[BsonRepresentation(BsonType.String)]
|
||||
public Guid Id { get; set; }
|
||||
|
||||
public long CurrentWorkshopId { get; private set; }
|
||||
public long WorkshopId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// نام کارگاه
|
||||
/// </summary>
|
||||
public string WorkshopName { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// تعداد پرسنل
|
||||
/// </summary>
|
||||
public int CountPerson { get; private set; }
|
||||
|
||||
|
||||
#region ServiceSelection
|
||||
|
||||
/// <summary>
|
||||
/// قرارداد و تصفیه
|
||||
/// </summary>
|
||||
public bool ContractAndCheckout { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// بیمه
|
||||
/// </summary>
|
||||
public bool Insurance { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// حضورغباب
|
||||
/// </summary>
|
||||
public bool RollCall { get; private set; }
|
||||
|
||||
public bool RollCallInPerson { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// فیش غیر رسمی
|
||||
/// </summary>
|
||||
public bool CustomizeCheckout { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// خدمات حضوری قرداد و تصفیه
|
||||
/// </summary>
|
||||
public bool ContractAndCheckoutInPerson { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// خدمات حضوری بیمه
|
||||
/// </summary>
|
||||
public bool InsuranceInPerson { get; private set; }
|
||||
|
||||
public double Price { get; private set; }
|
||||
|
||||
#endregion
|
||||
|
||||
public void Edit(string workshopName, int countPerson, bool contractAndCheckout, bool contractAndCheckoutInPerson,
|
||||
bool insurance, bool insuranceInPerson, bool rollCall, bool customizeCheckout,
|
||||
double price)
|
||||
{
|
||||
WorkshopName = workshopName;
|
||||
CountPerson = countPerson;
|
||||
ContractAndCheckout = contractAndCheckout;
|
||||
Insurance = insurance;
|
||||
RollCall = rollCall;
|
||||
CustomizeCheckout = customizeCheckout;
|
||||
ContractAndCheckoutInPerson = contractAndCheckoutInPerson;
|
||||
InsuranceInPerson = insuranceInPerson;
|
||||
Price = price;
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,7 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using _0_Framework.Application;
|
||||
|
||||
namespace Company.Domain.InstitutionContractInsertTempAgg;
|
||||
namespace Company.Domain.InstitutionContractExtensionTempAgg;
|
||||
|
||||
public interface IInstitutionContractExtenstionTempRepository
|
||||
{
|
||||
@@ -5,7 +5,7 @@ using CompanyManagment.App.Contracts.InstitutionContractContactinfo;
|
||||
using MongoDB.Bson;
|
||||
using MongoDB.Bson.Serialization.Attributes;
|
||||
|
||||
namespace Company.Domain.InstitutionContractInsertTempAgg;
|
||||
namespace Company.Domain.InstitutionContractExtensionTempAgg;
|
||||
|
||||
public class InstitutionContractExtensionTemp
|
||||
{
|
||||
@@ -30,8 +30,8 @@ public class InstitutionContractExtensionTemp
|
||||
public InstitutionContractExtensionPlanDetail ThreeMonths { get; set; }
|
||||
public InstitutionContractExtensionPlanDetail SixMonths { get; set; }
|
||||
public InstitutionContractExtensionPlanDetail TwelveMonths { get; set; }
|
||||
public InstitutionContractExtensionPaymentMonthly MonthlyPayment { get; set; }
|
||||
public InstitutionContractExtensionPaymentOneTime OneTimePayment { get; set; }
|
||||
public InstitutionContractPaymentMonthlyViewModel MonthlyPayment { get; set; }
|
||||
public InstitutionContractPaymentOneTimeViewModel OneTimePayment { get; set; }
|
||||
|
||||
public bool HasContractInPerson { get; set; }
|
||||
|
||||
@@ -58,8 +58,8 @@ public class InstitutionContractExtensionTemp
|
||||
HasContractInPerson = hasContractInPerson;
|
||||
}
|
||||
|
||||
public void SetAmountAndDuration(InstitutionContractDuration duration,InstitutionContractExtensionPaymentMonthly monthly,
|
||||
InstitutionContractExtensionPaymentOneTime oneTime)
|
||||
public void SetAmountAndDuration(InstitutionContractDuration duration,InstitutionContractPaymentMonthlyViewModel monthly,
|
||||
InstitutionContractPaymentOneTimeViewModel oneTime)
|
||||
{
|
||||
Duration = duration;
|
||||
MonthlyPayment = monthly;
|
||||
@@ -51,6 +51,14 @@ public interface IInsuranceListRepository:IRepository<long, InsuranceList>
|
||||
List<EmployeeInsurancListDataViewModel> GetEmployeeInsuranceDataAmonthAgo(DateTime currentMonthStartDate, long workshopId);
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// دریافت اطلاعات بیمه کارکنان برای استفاده در فیش حقوقی
|
||||
/// </summary>
|
||||
/// <param name="startDate"></param>
|
||||
/// <param name="workshopId"></param>
|
||||
/// <returns></returns>
|
||||
List<EmployeeInsurancListDataViewModel> EmployeeInsuranceDataBy(DateTime startDate, long workshopId);
|
||||
|
||||
/// <summary>
|
||||
/// بدست آوردن اطلاعات محاسباتی ماه پرسنل برای ویرایش
|
||||
/// </summary>
|
||||
|
||||
@@ -11,21 +11,23 @@ namespace Company.Domain.ReportAgg
|
||||
{
|
||||
Task<AllReport> GetAllActiveWorkshopsNew(string year, string month);
|
||||
AllReport GetAllActiveWorkshops(string year, string month);
|
||||
WorkshopResult GetWorkshopContractDone(string year, string month, long accountId, List<long> workshopList);
|
||||
WorkshopResult GetWorkshopContractSignDone(string year, string month, long accountId, List<long> workshopList);
|
||||
WorkshopResult GetWorkshopCheckoutDone(string year, string month, long accountId, List<long> workshopList);
|
||||
WorkshopResult GetWorkshopCheckoutSignDone(string year, string month, long accountId, List<long> workshopList);
|
||||
List<EmployeeNotDone> GetEmployeeContract(string year, string month, long workshopId);
|
||||
List<EmployeeNotDone> GetEmployeeContractSign(string year, string month, long workshopId);
|
||||
List<EmployeeNotDone> GetEmployeeCheckout(string year, string month, long workshopId);
|
||||
List<EmployeeNotDone> GetEmployeeCheckoutSign(string year, string month, long workshopId);
|
||||
PrintAllContractCheckout GetPrintAllContractDone(string year, string month, long accountId,
|
||||
Task<WorkshopResult> GetWorkshopContractDone(string year, string month, long accountId, List<long> workshopList);
|
||||
Task<WorkshopResult> GetWorkshopContractSignDone(string year, string month, long accountId,
|
||||
List<long> workshopList);
|
||||
PrintAllContractCheckout GetPrintAllContractSignDone(string year, string month, long accountId,
|
||||
Task<WorkshopResult> GetWorkshopCheckoutDone(string year, string month, long accountId, List<long> workshopList);
|
||||
Task<WorkshopResult> GetWorkshopCheckoutSignDone(string year, string month, long accountId,
|
||||
List<long> workshopList);
|
||||
PrintAllContractCheckout GetPrintAllCheckoutDone(string year, string month, long accountId,
|
||||
Task<List<EmployeeNotDone>> GetEmployeeContract(string year, string month, long workshopId);
|
||||
Task<List<EmployeeNotDone>> GetEmployeeContractSign(string year, string month, long workshopId);
|
||||
Task<List<EmployeeNotDone>> GetEmployeeCheckout(string year, string month, long workshopId);
|
||||
Task<List<EmployeeNotDone>> GetEmployeeCheckoutSign(string year, string month, long workshopId);
|
||||
Task<PrintAllContractCheckout> GetPrintAllContractDone(string year, string month, long accountId,
|
||||
List<long> workshopList);
|
||||
PrintAllContractCheckout GetPrintAllCheckoutSignDone(string year, string month, long accountId,
|
||||
Task<PrintAllContractCheckout> GetPrintAllContractSignDone(string year, string month, long accountId,
|
||||
List<long> workshopList);
|
||||
Task<PrintAllContractCheckout> GetPrintAllCheckoutDone(string year, string month, long accountId,
|
||||
List<long> workshopList);
|
||||
Task<PrintAllContractCheckout> GetPrintAllCheckoutSignDone(string year, string month, long accountId,
|
||||
List<long> workshopList);
|
||||
|
||||
|
||||
|
||||
@@ -26,5 +26,6 @@ namespace Company.Domain.RollCallEmployeeStatusAgg
|
||||
List<RollCallEmployeeStatusViewModel> GetActiveByWorkshopIdInDate(long workshopId, DateTime startDateGr, DateTime endDateGr);
|
||||
List<RollCallEmployeeStatusViewModel> GetByWorkshopIdInDates(long workshopId, DateTime start, DateTime end);
|
||||
bool IsActiveInPeriod(long employeeId, long workshopId, DateTime startDate, DateTime endDate);
|
||||
}
|
||||
void RemoveRange(IEnumerable<RollCallEmployeeStatus> rollCallEmployeeStatusList);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,8 @@ namespace Company.Domain.SmsResultAgg;
|
||||
|
||||
public class SmsResult: EntityBase
|
||||
{
|
||||
public SmsResult(int messageId, string status,string typeOfSms, string contractingPartyName,string mobile, long contractingPatyId, long institutionContractId)
|
||||
public SmsResult(int messageId, string status,string typeOfSms,
|
||||
string contractingPartyName,string mobile, long contractingPatyId, long institutionContractId)
|
||||
{
|
||||
MessageId = messageId;
|
||||
Status = status;
|
||||
|
||||
@@ -70,6 +70,7 @@ public interface IWorkshopRepository : IRepository<long, Workshop>
|
||||
Task<List<WorkshopWithLeftWorkTempEmployeesDto>> GetWorkshopsForLeftWorkTemp(long accountId);
|
||||
Task<int> GetWorkshopsForLeftWorkTempCount(long accountId);
|
||||
Task<List<WorkshopSelectListViewModel>> GetSelectList(string search, long id);
|
||||
int GetLastArchiveCode();
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Security.AccessControl;
|
||||
using _0_Framework.Application;
|
||||
using _0_Framework.Domain;
|
||||
using Company.Domain.ContarctingPartyAgg;
|
||||
using Company.Domain.ContractAgg;
|
||||
@@ -66,6 +68,11 @@ public class Employer : EntityBase
|
||||
public string SanaPassword { get; private set; }
|
||||
|
||||
public string EmployerNo { get; set; }
|
||||
public bool IsAuth { get; set; }
|
||||
public string IdNumberSerial { get; set; }
|
||||
|
||||
public string IdNumberSeri { get; set; }
|
||||
|
||||
public PersonalContractingParty ContractingParty { get; set; }
|
||||
|
||||
//public List<Workshop> Workshops { get; private set; }
|
||||
@@ -227,4 +234,35 @@ public class Employer : EntityBase
|
||||
this.IsActive = false;
|
||||
this.Address = "false";
|
||||
}
|
||||
|
||||
public void Authentication(string fName, string lName, string fatherName,string idNumber,
|
||||
string idNumberSeri, string idNumberSerial, string dateOfBirth, Gender gender,string phone)
|
||||
{
|
||||
this.FName = fName;
|
||||
this.LName = lName;
|
||||
this.FatherName = fatherName;
|
||||
this.IdNumberSeri = idNumberSeri;
|
||||
this.IdNumberSerial = idNumberSerial;
|
||||
this.DateOfBirth = !string.IsNullOrWhiteSpace(dateOfBirth) ? dateOfBirth.ToGeorgianDateTime() : new();
|
||||
this.IdNumber = idNumber;
|
||||
this.Gender = gender == _0_Framework.Application.Gender.Male? "مرد" : "زن";
|
||||
this.IsAuth = true;
|
||||
Phone = phone;
|
||||
}
|
||||
|
||||
|
||||
public void LegalAuthentication(string fName, string lName, string fatherName,string idNumber, string idNumberSeri,
|
||||
string idNumberSerial, string dateOfBirth, Gender gender,string phone)
|
||||
{
|
||||
FName = fName;
|
||||
EmployerLName = lName;
|
||||
this.FatherName = fatherName;
|
||||
this.IdNumberSeri = idNumberSeri;
|
||||
this.IdNumberSerial = idNumberSerial;
|
||||
this.DateOfBirth = !string.IsNullOrWhiteSpace(dateOfBirth) ? dateOfBirth.ToGeorgianDateTime() : new();
|
||||
this.IdNumber = idNumber;
|
||||
this.Gender =gender == _0_Framework.Application.Gender.Male? "مرد" : "زن";
|
||||
this.IsAuth = true;
|
||||
Phone = phone;
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,11 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using _0_Framework.Application;
|
||||
using _0_Framework.Application.Enums;
|
||||
using _0_Framework.Domain;
|
||||
using CompanyManagment.App.Contracts.Checkout;
|
||||
using CompanyManagment.App.Contracts.Employer;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace Company.Domain.empolyerAgg;
|
||||
|
||||
@@ -34,7 +36,7 @@ public interface IEmployerRepository : IRepository<long, Employer>
|
||||
|
||||
List<EmployerViewModel> GetEmployersHasWorkshop();
|
||||
|
||||
Task<List<EmployerSelectListViewModel>> GetSelectList(string search,long id);
|
||||
Task<List<EmployerSelectListViewModel>> GetSelectList(string search, long id, LegalType? legalType);
|
||||
|
||||
|
||||
#endregion
|
||||
@@ -68,5 +70,5 @@ public interface IEmployerRepository : IRepository<long, Employer>
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
Task<ActionResult<EditEmployerWorkflowRegistration>> GetWorkflowRegistrationForEdit(long employerId, long institutionWorkshopDetailsId);
|
||||
}
|
||||
@@ -12,9 +12,7 @@ public class CaseHistoryRollCallExcelForEmployeeViewModel
|
||||
public string EmployeeFullName { get; set; }
|
||||
public string TotalWorkingHoursFa { get; set; }
|
||||
public string TotalWorkingTimeSpan { get; set; }
|
||||
|
||||
|
||||
|
||||
|
||||
public List<RollCallItemForEmployeeExcelViewModel> RollCalls { get; set; }
|
||||
}
|
||||
|
||||
@@ -40,7 +38,8 @@ public class RollCallItemForEmployeeExcelViewModel
|
||||
public bool HasLeave { get; set; }
|
||||
|
||||
public string TotalWorkingHours { get; set; }
|
||||
|
||||
public string EnterTimeDifferences { get; set; }
|
||||
public string ExitTimeDifferences { get; set; }
|
||||
}
|
||||
|
||||
public class RollCallTimeExcelViewModel
|
||||
|
||||
@@ -113,11 +113,12 @@ public class RollCallExcelGenerator : ExcelGenerator
|
||||
worksheet.Cells[i + row + 1, 1].Value = i + 1;
|
||||
worksheet.Cells[i + row + 1, 2].Value = rollCall.DayOfWeekFa;
|
||||
worksheet.Cells[i + row + 1, 3].Value = rollCall.DateFa;
|
||||
worksheet.Cells[i + row + 1, 4].Value = "-";
|
||||
worksheet.Cells[i + row + 1, 4].Value = rollCall.EnterTimeDifferences;
|
||||
worksheet.Cells[i + row + 1, 5].Value = rollCall.StartsItems;
|
||||
worksheet.Cells[i + row + 1, 6].Value = rollCall.EndsItems;
|
||||
worksheet.Cells[i + row + 1, 7].Value = "-";
|
||||
worksheet.Cells[i + row + 1, 8].Value = rollCall.TotalWorkingHours == string.Empty ? "ندارد" : rollCall.TotalWorkingHours;
|
||||
worksheet.Cells[i + row + 1, 7].Value = rollCall.ExitTimeDifferences;
|
||||
worksheet.Cells[i + row + 1, 8].Value = rollCall.TotalWorkingHours == string.Empty
|
||||
? "ندارد" : rollCall.TotalWorkingHours;
|
||||
|
||||
// Style data cells
|
||||
for (int j = 1; j <= 8; j++)
|
||||
@@ -307,6 +308,49 @@ public class RollCallExcelGenerator : ExcelGenerator
|
||||
return package.GetAsByteArray();
|
||||
}
|
||||
|
||||
private string CalculateExitMinuteDifference(TimeSpan early, TimeSpan late)
|
||||
{
|
||||
if (early == TimeSpan.Zero && late == TimeSpan.Zero)
|
||||
{
|
||||
return "-";
|
||||
}
|
||||
else if (late != TimeSpan.Zero)
|
||||
{
|
||||
var minutes = late.TotalMinutes > 999 ? "999" : late.TotalMinutes.ToString();
|
||||
return $"{minutes}+";
|
||||
}
|
||||
else if (early != TimeSpan.Zero)
|
||||
{
|
||||
var minutes = early.TotalMinutes > 999 ? "999" : early.TotalMinutes.ToString();
|
||||
return $"{minutes}-";
|
||||
}
|
||||
else
|
||||
{
|
||||
return $"";
|
||||
}
|
||||
}
|
||||
|
||||
private string CalculateEntryMinuteDifference(TimeSpan early, TimeSpan late)
|
||||
{
|
||||
if (early == TimeSpan.Zero && late == TimeSpan.Zero)
|
||||
{
|
||||
return "-";
|
||||
}
|
||||
else if (late != TimeSpan.Zero)
|
||||
{
|
||||
var minutes = late.TotalMinutes > 999 ? "999" : late.TotalMinutes.ToString();
|
||||
return $"{minutes}-";
|
||||
}
|
||||
else if (early != TimeSpan.Zero)
|
||||
{
|
||||
var minutes = early.TotalMinutes > 999 ? "999" : early.TotalMinutes.ToString();
|
||||
return $"{minutes}+";
|
||||
}
|
||||
else
|
||||
{
|
||||
return $"";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Company.Domain.InstitutionContractInsertTempAgg;
|
||||
using Company.Domain.InstitutionContractExtensionTempAgg;
|
||||
using MongoDB.Driver;
|
||||
|
||||
namespace CompanyManagement.Infrastructure.Mongo.InstitutionContractInsertTempRepo;
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
namespace Company.Application.Contracts.AuthorizedBankDetails
|
||||
{
|
||||
public class AuthorizedBankDetailsSearchModel
|
||||
{
|
||||
public string CardNumber { get; set; }
|
||||
public string AccountNumber { get; set; }
|
||||
public string IBan { get; set; }
|
||||
public string BankName { get; set; }
|
||||
public string NationalIdentifier { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using System;
|
||||
|
||||
using System.Collections.Generic;
|
||||
namespace Company.Application.Contracts.AuthorizedBankDetails;
|
||||
|
||||
public class AuthorizedBankDetailsViewModel
|
||||
{
|
||||
public string NationalIdentifier { get; set; }
|
||||
|
||||
public long Id { get; set; }
|
||||
public string CustomerType { get; set; }
|
||||
public string CardNumber { get; set; }
|
||||
public string AccountNumber { get; set; }
|
||||
public string IBan { get; set; }
|
||||
public string BankName { get; set; }
|
||||
public List<AuthorizedBankDetailsOwnerViewModel> Owners { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Company.Application.Contracts.AuthorizedBankDetails
|
||||
{
|
||||
public class CreateAuthorizedBankDetails
|
||||
{
|
||||
public string CardNumber { get; set; }
|
||||
|
||||
public string AccountNumber { get; set; }
|
||||
|
||||
public string IBan { get; set; }
|
||||
|
||||
public string BankName { get; set; }
|
||||
|
||||
public List<CreateAuthorizedBankDetailsOwner> OwnersList { get; set; }
|
||||
}
|
||||
|
||||
public class CreateAuthorizedBankDetailsOwner
|
||||
{
|
||||
public string FName { get; set; }
|
||||
|
||||
public string LName { get; set; }
|
||||
|
||||
public string NationalIdentifier { get; set; }
|
||||
|
||||
public string CustomerType { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Company.Application.Contracts.AuthorizedBankDetails
|
||||
{
|
||||
public class EditAuthorizedBankDetails
|
||||
{
|
||||
public long Id { get; set; }
|
||||
|
||||
public string CardNumber { get; set; }
|
||||
|
||||
public string AccountNumber { get; set; }
|
||||
|
||||
public string IBan { get; set; }
|
||||
|
||||
public string BankName { get; set; }
|
||||
|
||||
public List<AuthorizedBankDetailsOwnerViewModel> OwnersList { get; set; }
|
||||
}
|
||||
|
||||
public class AuthorizedBankDetailsOwnerViewModel
|
||||
{
|
||||
public string FName { get; set; }
|
||||
public string LName { get; set; }
|
||||
public string NationalIdentifier { get; set; }
|
||||
public string CustomerType { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
using System.Collections.Generic;
|
||||
using _0_Framework.Application;
|
||||
using Company.Application.Contracts.AuthorizedBankDetails;
|
||||
|
||||
namespace Company.Application.Contracts.AuthorizedBankDetails
|
||||
{
|
||||
public interface IAuthorizedBankDetailsApplication
|
||||
{
|
||||
OperationResult Create(CreateAuthorizedBankDetails command);
|
||||
EditAuthorizedBankDetails GetDetails(long id);
|
||||
List<AuthorizedBankDetailsViewModel> Search(AuthorizedBankDetailsSearchModel searchModel);
|
||||
AuthorizedBankDetailsViewModel GetByIban(string iban);
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using _0_Framework.Application.Enums;
|
||||
using CompanyManagment.App.Contracts.Employer;
|
||||
using CompanyManagment.App.Contracts.Loan;
|
||||
using CompanyManagment.App.Contracts.RollCall;
|
||||
@@ -133,6 +134,15 @@ public class CheckoutViewModel
|
||||
/// </summary>
|
||||
public string TotalPaidLeave { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// آیا فیش نیاز به بروزرسانی دارد
|
||||
/// </summary>
|
||||
public bool IsUpdateNeeded { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// لیست پیام های هشدار فیش حقوقی
|
||||
/// </summary>
|
||||
public List<CheckoutWarningMessageModel> CheckoutWarningMessageList { get; set; }
|
||||
|
||||
public bool HasSignCheckout { get; set; }
|
||||
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
using _0_Framework.Application.Enums;
|
||||
|
||||
namespace CompanyManagment.App.Contracts.Checkout;
|
||||
|
||||
/// <summary>
|
||||
/// مدل هشدار فیش حقوقی
|
||||
/// </summary>
|
||||
public class CheckoutWarningMessageModel
|
||||
{
|
||||
/// <summary>
|
||||
/// پیام هشدار
|
||||
/// </summary>
|
||||
public string WarningMessage { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// آی دی فیش حقوقی
|
||||
/// </summary>
|
||||
public long CheckoutId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// نوع هشدار فیش حقوقی
|
||||
/// </summary>
|
||||
public TypeOfCheckoutWarning TypeOfCheckoutWarning { get; set; }
|
||||
}
|
||||
@@ -1,8 +1,10 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Security.AccessControl;
|
||||
using System.Security.Cryptography;
|
||||
using System.Threading.Tasks;
|
||||
using System.Transactions;
|
||||
using _0_Framework.Application;
|
||||
using _0_Framework.Application.UID;
|
||||
using CompanyManagment.App.Contracts.OriginalTitle;
|
||||
|
||||
namespace CompanyManagment.App.Contracts.ContractingPartyBankAccounts;
|
||||
@@ -74,5 +76,27 @@ public interface IContractingPartyBankAccountsApplication
|
||||
/// <param name="selected">نام سلکت شده</param>
|
||||
/// <returns></returns>
|
||||
Task<List<string>> ContractingPartyNamesSelectList(string search, string selected);
|
||||
|
||||
/// <summary>
|
||||
/// احراز هویت اطلاعات بانکی طرف حساب
|
||||
/// </summary>
|
||||
/// <param name="command"></param>
|
||||
/// <returns></returns>
|
||||
Task<ContractingPartyBankInquiryResponse> InquiryContractingPartyBankDetails(InquiryContractingPartyBankDetailsRequest command);
|
||||
|
||||
}
|
||||
public class InquiryContractingPartyBankDetailsRequest
|
||||
{
|
||||
public string CardNumber { get; set; }
|
||||
public string AccountNumber { get; set; }
|
||||
public string IBan { get; set; }
|
||||
public UidBanks? UidBank { get; set; }
|
||||
}
|
||||
public class ContractingPartyBankInquiryResponse
|
||||
{
|
||||
public string FullName { get; set; }
|
||||
public string Iban { get; set; }
|
||||
public string AccountNumber { get; set; }
|
||||
public string CardNumber { get; set; }
|
||||
}
|
||||
|
||||
|
||||
@@ -25,4 +25,5 @@ public class CustomizeWorkshopEmployeeSettingsViewModel
|
||||
public int LeavePermittedDays { get; set; }
|
||||
public ICollection<CustomizeRotatingShiftsViewModel> CustomizeRotatingShiftsViewModels { get; set; }
|
||||
public List<DayOfWeek> WeeklyOffDays { get; set; }
|
||||
public bool HasLeft { get; set; }
|
||||
}
|
||||
@@ -6,6 +6,7 @@ using _0_Framework.Application;
|
||||
using _0_Framework.Application.Enums;
|
||||
using CompanyManagment.App.Contracts.Checkout;
|
||||
using CompanyManagment.App.Contracts.Employee;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
|
||||
namespace CompanyManagment.App.Contracts.Employer;
|
||||
@@ -46,8 +47,9 @@ public interface IEmployerApplication
|
||||
/// </summary>
|
||||
/// <param name="search"></param>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="legalType"></param>
|
||||
/// <returns></returns>
|
||||
Task<List<EmployerSelectListViewModel>> GetSelectList(string search, long id);
|
||||
Task<List<EmployerSelectListViewModel>> GetSelectList(string search, long id, LegalType? legalType = null);
|
||||
|
||||
#endregion
|
||||
#region NewByHeydari
|
||||
@@ -145,6 +147,7 @@ public interface IEmployerApplication
|
||||
Task<OperationResult> DeleteWorkflowRegistration(long employerId, long institutionWorkshopDetailsId);
|
||||
|
||||
Task<OperationResult<AuthenticateUserViewModel>> AuthenticateEmployer(string nationalCode, string dateOfBirth, string mobile);
|
||||
Task<ActionResult<EditEmployerWorkflowRegistration>> GetWorkflowRegistrationForEdit(long employerId, long institutionWorkshopDetailsId);
|
||||
}
|
||||
|
||||
public class AuthenticateUserViewModel
|
||||
@@ -207,6 +210,11 @@ public class AuthenticateUserViewModel
|
||||
/// </summary>
|
||||
public class CreateEmployerWorkflowRegistration
|
||||
{
|
||||
/// <summary>
|
||||
/// درزمانی که یوزر کارفرمایی رو انتخاب کرد که از قبل ثبت شده است
|
||||
/// این فیلد باید مقدار داشته باشد
|
||||
/// </summary>
|
||||
public long EmployerId { get; set; }
|
||||
/// <summary>
|
||||
/// اطلاعات کارفرمای حقیقی
|
||||
/// </summary>
|
||||
@@ -323,7 +331,9 @@ public class CreateLegalEmployerWorkflowRegistration
|
||||
/// اطلاعات سیستم دولتی
|
||||
/// </summary>
|
||||
public GovernmentSystemInfo GovernmentSystemInfo { get; set; }
|
||||
|
||||
|
||||
public string IdNumberSeri { get; set; }
|
||||
public string IdNumberSerial { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -395,6 +405,9 @@ public class CreateRealEmployerWorkflowRegistration
|
||||
/// شماره تلفن
|
||||
/// </summary>
|
||||
public string Telephone { get; set; }
|
||||
|
||||
public string IdNumberSeri { get; set; }
|
||||
public string IdNumberSerial { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -87,6 +87,10 @@ public class GetInstitutionContractListItemsViewModel
|
||||
public long ContractingPartyId { get; set; }
|
||||
|
||||
public List<InstitutionContractListWorkshop> Workshops { get; set; }
|
||||
|
||||
public bool IsInPersonContract { get; set; }
|
||||
|
||||
public bool IsOldContract { get; set; }
|
||||
}
|
||||
|
||||
public class InstitutionContractListWorkshop
|
||||
@@ -102,13 +106,13 @@ public class WorkshopServicesViewModel
|
||||
public string InsuranceLabel => "ارسال لیست بیمه";
|
||||
|
||||
public bool InsuranceInPerson { get; set; }
|
||||
public string InsuranceInPersonLabel => "خدمات حضوری";
|
||||
public string InsuranceInPersonLabel => "خدمات مستقیم";
|
||||
|
||||
public bool Contract { get; set; }
|
||||
public string ContractLabel => "قرارداد و تصفیه حساب";
|
||||
|
||||
public bool ContractInPerson { get; set; }
|
||||
public string ContractInPersonLabel => "خدمات حضوری";
|
||||
public string ContractInPersonLabel => "خدمات مستقیم";
|
||||
|
||||
public bool RollCall { get; set; }
|
||||
public string RollCallLabel => "ساعت حضور و غیاب";
|
||||
|
||||
@@ -4,6 +4,8 @@ public class GetInstitutionVerificationDetailsWorkshopsViewModel
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public int PersonnelCount { get; set; }
|
||||
|
||||
public WorkshopServicesViewModel OldServices { get; set; }
|
||||
public WorkshopServicesViewModel Services { get; set; }
|
||||
public string Price { get; set; }
|
||||
}
|
||||
@@ -7,6 +7,7 @@ using System.Threading.Tasks;
|
||||
using _0_Framework.Application;
|
||||
using _0_Framework.Application.Sms;
|
||||
using CompanyManagment.App.Contracts.Checkout;
|
||||
using CompanyManagment.App.Contracts.Law;
|
||||
using CompanyManagment.App.Contracts.TemporaryClientRegistration;
|
||||
using CompanyManagment.App.Contracts.Workshop;
|
||||
using CompanyManagment.App.Contracts.WorkshopPlan;
|
||||
@@ -77,6 +78,8 @@ public interface IInstitutionContractApplication
|
||||
/// <returns>لیست قراردادها برای چاپ</returns>
|
||||
List<InstitutionContractViewModel> PrintAll(List<long> id);
|
||||
|
||||
|
||||
[Obsolete("استفاده نشود، از متد غیرهمزمان استفاده شود")]
|
||||
/// <summary>
|
||||
/// چاپ یک قرارداد
|
||||
/// </summary>
|
||||
@@ -212,15 +215,112 @@ public interface IInstitutionContractApplication
|
||||
Task<OperationResult<OtpResultViewModel>> SendVerifyOtp(Guid id);
|
||||
Task<OperationResult> VerifyOtp(Guid publicId, string code);
|
||||
Task<InstitutionContractWorkshopDetailViewModel> GetWorkshopInitialDetails(long workshopDetailsId);
|
||||
|
||||
#region Extension
|
||||
|
||||
Task<InstitutionContractExtensionInquiryResult> GetExtensionInquiry(long previousContractId);
|
||||
Task<InstitutionContractExtensionWorkshopsResponse> GetExtensionWorkshops(InstitutionContractExtensionWorkshopsRequest request);
|
||||
Task<InstitutionContractExtensionPlanResponse> GetExtensionInstitutionPlan(InstitutionContractExtensionPlanRequest request);
|
||||
|
||||
Task<InstitutionContractExtensionWorkshopsResponse> GetExtensionWorkshops(
|
||||
InstitutionContractExtensionWorkshopsRequest request);
|
||||
|
||||
Task<InstitutionContractExtensionPlanResponse> GetExtensionInstitutionPlan(
|
||||
InstitutionContractExtensionPlanRequest request);
|
||||
|
||||
Task<InstitutionContractExtensionPaymentResponse> GetExtensionPaymentMethod(
|
||||
InstitutionContractExtensionPaymentRequest request);
|
||||
|
||||
|
||||
Task<OperationResult> ExtensionComplete(InstitutionContractExtensionCompleteRequest request);
|
||||
Task<List<InstitutionContractSelectListViewModel>> GetInstitutionContractSelectList(string search,string selected);
|
||||
|
||||
#endregion
|
||||
|
||||
#region Upgrade (Amendment)
|
||||
|
||||
Task<InstitutionContractAmendmentWorkshopsResponse> GetAmendmentWorkshops(long institutionContractId);
|
||||
Task<InsertAmendmentTempWorkshopResponse> InsertAmendmentTempWorkshops(InstitutionContractAmendmentTempWorkshopViewModel request);
|
||||
Task RemoveAmendmentWorkshops(Guid workshopTempId);
|
||||
Task<InsitutionContractAmendmentPaymentResponse> GetAmendmentPaymentDetails(InsitutionContractAmendmentPaymentRequest request);
|
||||
|
||||
#endregion
|
||||
|
||||
Task<OperationResult> ResendVerifyLink(long institutionContractId);
|
||||
Task AmendmentComplete(InstitutionContractAmendmentCompleteRequest request);
|
||||
/// <summary>
|
||||
/// دیتای پرینت قرارداد مالی
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
Task<InstitutionContractPrintViewModel> PrintOneAsync(long id);
|
||||
|
||||
Task<GetInstitutionAmendmentVerificationDetailsViewModel> GetAmendmentVerificationDetails(Guid id, long amendmentId);
|
||||
}
|
||||
|
||||
public class GetInstitutionAmendmentVerificationDetailsViewModel
|
||||
{
|
||||
public InstitutionContratVerificationParty FirstParty { get; set; }
|
||||
public InstitutionContratVerificationParty SecondParty { get; set; }
|
||||
public string ContractNo { get; set; }
|
||||
public string AmendmentCreationDate { get; set; }
|
||||
public string AmendmentStart { get; set; }
|
||||
public string AmendmentEnd { get; set; }
|
||||
public List<GetInstitutionVerificationDetailsWorkshopsViewModel> Workshops { get; set; }
|
||||
public string TotalPrice { get; set; }
|
||||
public string TaxPrice { get; set; }
|
||||
public string PaymentPrice { get; set; }
|
||||
public List<InstitutionContractInstallmentViewModel> Installments { get; set; }
|
||||
public bool IsInstallment { get; set; }
|
||||
|
||||
}
|
||||
|
||||
public class InstitutionContractAmendmentCompleteRequest
|
||||
{
|
||||
public Guid TempId { get; set; }
|
||||
public bool IsInstallment { get; set; }
|
||||
public long LawId { get; set; }
|
||||
|
||||
|
||||
}
|
||||
|
||||
public class InstitutionContractPrintViewModel
|
||||
{
|
||||
public InstitutionContratVerificationParty FirstParty { get; set; }
|
||||
public InstitutionContratVerificationParty SecondParty { get; set; }
|
||||
public string ContractNo { get; set; }
|
||||
public string CreationDate { get; set; }
|
||||
public string ContractStart { get; set; }
|
||||
public string ContractEnd { get; set; }
|
||||
public List<GetInstitutionVerificationDetailsWorkshopsViewModel> Workshops { get; set; }
|
||||
public string TotalPrice { get; set; }
|
||||
public string TaxPrice { get; set; }
|
||||
public string PaymentPrice { get; set; }
|
||||
public string VerifyCode { get; set; }
|
||||
public string VerifyDate { get; set; }
|
||||
public string VerifyTime { get; set; }
|
||||
public string VerifierFullName { get; set; }
|
||||
public string VerifierPhoneNumber { get; set; }
|
||||
public LawViewModel LawViewModel { get; set; }
|
||||
public string Obligation { get; set; }
|
||||
}
|
||||
|
||||
public class InsertAmendmentTempWorkshopResponse
|
||||
{
|
||||
public Guid WorkshopTempId { get; set; }
|
||||
public string Amount { get; set; }
|
||||
}
|
||||
|
||||
public class InstitutionContractAmendmentWorkshopsResponse
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public List<InstitutionContractAmendmentTempWorkshopViewModel> Workshops { get; set; }
|
||||
|
||||
public Guid TempId { get; set; }
|
||||
|
||||
}
|
||||
|
||||
public class InstitutionContractSelectListViewModel : SelectListViewModel;
|
||||
|
||||
public class InstitutionContractExtensionInquiryResponse
|
||||
{
|
||||
public long Id { get; set; }
|
||||
@@ -238,19 +338,7 @@ public class InstitutionContractExtensionInquiryResponse
|
||||
public string NationalCode { get; set; }
|
||||
}
|
||||
|
||||
public class InstitutionContractExtensionCompleteRequest
|
||||
{
|
||||
public Guid TemporaryId { get; set; }
|
||||
public bool IsInstallment { get; set; }
|
||||
public long LawId { get; set; }
|
||||
}
|
||||
|
||||
public class InstitutionContractExtensionPaymentResponse
|
||||
{
|
||||
public InstitutionContractExtensionPaymentOneTime OneTime { get; set; }
|
||||
public InstitutionContractExtensionPaymentMonthly Monthly { get; set; }
|
||||
|
||||
}
|
||||
|
||||
public class InstitutionContractExtensionPaymentMonthly:InstitutionContractExtensionPaymentOneTime
|
||||
{
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using CompanyManagment.App.Contracts.TemporaryClientRegistration;
|
||||
|
||||
namespace CompanyManagment.App.Contracts.InstitutionContract;
|
||||
|
||||
public class InsitutionContractAmendmentPaymentRequest
|
||||
{
|
||||
public Guid TempId { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace CompanyManagment.App.Contracts.InstitutionContract;
|
||||
|
||||
public class InsitutionContractAmendmentPaymentResponse
|
||||
{
|
||||
public List<InsitutionContractAmendmentPaymentWorkshopResponse> workshops { get; set; }
|
||||
public InstitutionContractPaymentOneTimeViewModel OneTime { get; set; }
|
||||
public InstitutionContractPaymentMonthlyViewModel Monthly { get; set; }
|
||||
public string ContractStart { get; set; }
|
||||
public string ContractEnd { get; set; }
|
||||
public string OneMonthAmount { get; set; }
|
||||
public string TotalAmount { get; set; }
|
||||
}
|
||||
|
||||
public class InsitutionContractAmendmentPaymentWorkshopResponse
|
||||
{
|
||||
public string WorkshopName { get; set; }
|
||||
public WorkshopServicesViewModel OldServices { get; set; }
|
||||
public WorkshopServicesViewModel NewServices { get; set; }
|
||||
|
||||
public bool IsNewWorkshop { get; set; }
|
||||
|
||||
public int PrevPersonnelCount { get; set; }
|
||||
public int NewPersonnelCount { get; set; }
|
||||
|
||||
public double Price { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
using System;
|
||||
|
||||
namespace CompanyManagment.App.Contracts.InstitutionContract;
|
||||
|
||||
public class InstitutionContractAmendmentTempWorkshopViewModel
|
||||
{
|
||||
public Guid TempId { get; set; }
|
||||
|
||||
public Guid WorkshopTempId { get; set; }
|
||||
|
||||
public long CurrentWorkshopId { get; set; }
|
||||
|
||||
public long WorkshopId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// نام کارگاه
|
||||
/// </summary>
|
||||
public string WorkshopName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// تعداد پرسنل
|
||||
/// </summary>
|
||||
public int CountPerson { get; set; }
|
||||
|
||||
|
||||
#region ServiceSelection
|
||||
|
||||
/// <summary>
|
||||
/// قرارداد و تصفیه
|
||||
/// </summary>
|
||||
public bool ContractAndCheckout { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// بیمه
|
||||
/// </summary>
|
||||
public bool Insurance { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// حضورغباب
|
||||
/// </summary>
|
||||
public bool RollCall { get; set; }
|
||||
|
||||
public bool RollCallInPerson { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// فیش غیر رسمی
|
||||
/// </summary>
|
||||
public bool CustomizeCheckout { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// خدمات حضوری قرداد و تصفیه
|
||||
/// </summary>
|
||||
public bool ContractAndCheckoutInPerson { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// خدمات حضوری بیمه
|
||||
/// </summary>
|
||||
public bool InsuranceInPerson { get; set; }
|
||||
|
||||
public double Price{ get; set; }
|
||||
public string PriceStr{ get; set; }
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
using System;
|
||||
|
||||
namespace CompanyManagment.App.Contracts.InstitutionContract;
|
||||
|
||||
public class InstitutionContractExtensionCompleteRequest
|
||||
{
|
||||
public Guid TemporaryId { get; set; }
|
||||
public bool IsInstallment { get; set; }
|
||||
public long LawId { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
namespace CompanyManagment.App.Contracts.InstitutionContract;
|
||||
|
||||
public class InstitutionContractExtensionPaymentResponse
|
||||
{
|
||||
public InstitutionContractPaymentOneTimeViewModel OneTime { get; set; }
|
||||
public InstitutionContractPaymentMonthlyViewModel Monthly { get; set; }
|
||||
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
using System.Collections.Generic;
|
||||
using CompanyManagment.App.Contracts.TemporaryClientRegistration;
|
||||
|
||||
namespace CompanyManagment.App.Contracts.InstitutionContract;
|
||||
|
||||
public class InstitutionContractPaymentOneTimeViewModel
|
||||
{
|
||||
/// <summary>
|
||||
/// مجموع مبالغ
|
||||
/// </summary>
|
||||
public string TotalAmount { get; set; }
|
||||
/// <summary>
|
||||
/// ارزش افزوده
|
||||
/// </summary>
|
||||
public string Tax { get; set; }
|
||||
/// <summary>
|
||||
/// مبلغ قابل پرداخت
|
||||
/// </summary>
|
||||
public string PaymentAmount { get; set; }
|
||||
}
|
||||
public class InstitutionContractPaymentMonthlyViewModel:InstitutionContractPaymentOneTimeViewModel
|
||||
{
|
||||
public List<MonthlyInstallment> Installments { get; set; }
|
||||
}
|
||||
@@ -3,4 +3,6 @@ namespace CompanyManagment.App.Contracts.InstitutionContract;
|
||||
public class InstitutionContractWorkshopDetailViewModel
|
||||
{
|
||||
public WorkshopServicesViewModel ServicesViewModel { get; set; }
|
||||
public string WorkshopName { get; set; }
|
||||
public int ArchiveCode { get; set; }
|
||||
}
|
||||
@@ -31,6 +31,50 @@ public interface IInsuranceListApplication
|
||||
double GetRoundValue(double value);
|
||||
OperationResult ConfirmInsuranceList(long id);
|
||||
|
||||
#region New
|
||||
/// <summary>
|
||||
/// دستمزد روزانه مشاغل مقطوع بیمه
|
||||
/// </summary>
|
||||
/// <param name="year"></param>
|
||||
/// <param name="workshopId"></param>
|
||||
/// <param name="employeeId"></param>
|
||||
/// <param name="startDateGr"></param>
|
||||
/// <param name="endDateGr"></param>
|
||||
/// <param name="jobId"></param>
|
||||
/// <param name="population"></param>
|
||||
/// <param name="insuranceJobId"></param>
|
||||
/// <returns></returns>
|
||||
double? GetDailyWageFixedSalary(string year, long workshopId, long employeeId, DateTime? startDateGr,
|
||||
DateTime? endDateGr, long jobId, string population, long? insuranceJobId);
|
||||
|
||||
/// <summary>
|
||||
/// محاسبه مزایای ماهانه
|
||||
/// </summary>
|
||||
/// <param name="endMonthCurrentDay"></param>
|
||||
/// <param name="consumableItemsItemValue"></param>
|
||||
/// <param name="housingAllowanceItemValue"></param>
|
||||
/// <param name="maritalStatus"></param>
|
||||
/// <param name="countWorkingDays"></param>
|
||||
/// <param name="typeOfInsuranceSendWorkshop"></param>
|
||||
/// <param name="jobId"></param>
|
||||
/// <param name="employeeId"></param>
|
||||
/// <param name="includeStatus"></param>
|
||||
/// <returns></returns>
|
||||
public double GetMonthlyBenefits(int endMonthCurrentDay, double consumableItemsItemValue,
|
||||
double housingAllowanceItemValue, double maritalStatus, int countWorkingDays,
|
||||
string typeOfInsuranceSendWorkshop, long jobId, long employeeId, bool includeStatus);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="yearlysalaryItemValue"></param>
|
||||
/// <param name="employeeId"></param>
|
||||
/// <param name="workshopId"></param>
|
||||
/// <param name="year"></param>
|
||||
/// <returns></returns>
|
||||
public double ComputeDailyWage(double yearlysalaryItemValue, long employeeId, long workshopId, string year);
|
||||
|
||||
#endregion
|
||||
List<InsuranceListViewModel> SearchForClient(InsuranceListSearchModel searchModel);
|
||||
|
||||
//farokhiChanges
|
||||
|
||||
@@ -27,6 +27,8 @@ namespace CompanyManagment.App.Contracts.Report
|
||||
public int ContractSignNotDone { get; set; }
|
||||
public int ContractSignDone { get; set; }
|
||||
|
||||
public int ContractSignToBe { get; set; }
|
||||
|
||||
//تصفیه
|
||||
public int AllCheckout { get; set; }
|
||||
public int CheckoutNotDone { get; set; }
|
||||
@@ -34,6 +36,8 @@ namespace CompanyManagment.App.Contracts.Report
|
||||
public int CheckoutSignNotDone { get; set; }
|
||||
public int CheckoutSignDone { get; set; }
|
||||
|
||||
public int CheckoutSignToBe { get; set; }
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -10,21 +10,23 @@ namespace CompanyManagment.App.Contracts.Report
|
||||
{
|
||||
Task<AllReport> GetAllActiveWorkshops(string year, string month);
|
||||
Task<AllReport> GetAllReports(string year, string month);
|
||||
WorkshopResult GetWorkshopContractDone(string year, string month, long accountId, List<long> workshopList);
|
||||
WorkshopResult GetWorkshopContractSignDone(string year, string month, long accountId, List<long> workshopList);
|
||||
WorkshopResult GetWorkshopCheckoutDone(string year, string month, long accountId, List<long> workshopList);
|
||||
WorkshopResult GetWorkshopCheckoutSignDone(string year, string month, long accountId, List<long> workshopList);
|
||||
List<EmployeeNotDone> GetEmployeeContract(string year, string month, long workshopId);
|
||||
List<EmployeeNotDone> GetEmployeeContractSign(string year, string month, long workshopId);
|
||||
List<EmployeeNotDone> GetEmployeeCheckout(string year, string month, long workshopId);
|
||||
List<EmployeeNotDone> GetEmployeeCheckoutSign(string year, string month, long workshopId);
|
||||
PrintAllContractCheckout GetPrintAllContractDone(string year, string month, long accountId,
|
||||
Task<WorkshopResult> GetWorkshopContractDone(string year, string month, long accountId, List<long> workshopList);
|
||||
Task<WorkshopResult> GetWorkshopContractSignDone(string year, string month, long accountId,
|
||||
List<long> workshopList);
|
||||
PrintAllContractCheckout GetPrintAllContractSignDone(string year, string month, long accountId,
|
||||
Task<WorkshopResult> GetWorkshopCheckoutDone(string year, string month, long accountId, List<long> workshopList);
|
||||
Task<WorkshopResult> GetWorkshopCheckoutSignDone(string year, string month, long accountId,
|
||||
List<long> workshopList);
|
||||
PrintAllContractCheckout GetPrintAllCheckoutDone(string year, string month, long accountId,
|
||||
Task<List<EmployeeNotDone>> GetEmployeeContract(string year, string month, long workshopId);
|
||||
Task<List<EmployeeNotDone>> GetEmployeeContractSign(string year, string month, long workshopId);
|
||||
Task<List<EmployeeNotDone>> GetEmployeeCheckout(string year, string month, long workshopId);
|
||||
Task<List<EmployeeNotDone>> GetEmployeeCheckoutSign(string year, string month, long workshopId);
|
||||
Task<PrintAllContractCheckout> GetPrintAllContractDone(string year, string month, long accountId,
|
||||
List<long> workshopList);
|
||||
PrintAllContractCheckout GetPrintAllCheckoutSignDone(string year, string month, long accountId,
|
||||
Task<PrintAllContractCheckout> GetPrintAllContractSignDone(string year, string month, long accountId,
|
||||
List<long> workshopList);
|
||||
Task<PrintAllContractCheckout> GetPrintAllCheckoutDone(string year, string month, long accountId,
|
||||
List<long> workshopList);
|
||||
Task<PrintAllContractCheckout> GetPrintAllCheckoutSignDone(string year, string month, long accountId,
|
||||
List<long> workshopList);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using _0_Framework.Application;
|
||||
using Company.Application.Contracts.AuthorizedBankDetails;
|
||||
using Company.Domain.AuthorizedBankDetailsAgg;
|
||||
|
||||
namespace CompanyManagment.Application
|
||||
{
|
||||
public class AuthorizedBankDetailsApplication : IAuthorizedBankDetailsApplication
|
||||
{
|
||||
private readonly IAuthorizedBankDetailsRepository _authorizedBankDetailsRepository;
|
||||
|
||||
public AuthorizedBankDetailsApplication(IAuthorizedBankDetailsRepository authorizedBankDetailsRepository)
|
||||
{
|
||||
_authorizedBankDetailsRepository = authorizedBankDetailsRepository;
|
||||
}
|
||||
|
||||
public OperationResult Create(CreateAuthorizedBankDetails command)
|
||||
{
|
||||
var operation = new OperationResult();
|
||||
|
||||
if (_authorizedBankDetailsRepository.Exists(x => x.CardNumber == command.CardNumber &&
|
||||
x.AccountNumber == command.AccountNumber &&
|
||||
x.IBan == command.IBan))
|
||||
return operation.Failed(ApplicationMessages.DuplicatedRecord);
|
||||
|
||||
var ownersList = new List<AuthorizedBankDetailsOwner>();
|
||||
if (command.OwnersList != null && command.OwnersList.Count > 0)
|
||||
{
|
||||
foreach (var owner in command.OwnersList)
|
||||
{
|
||||
var bankDetailsOwner = new AuthorizedBankDetailsOwner(
|
||||
owner.FName,
|
||||
owner.LName,
|
||||
owner.NationalIdentifier,
|
||||
owner.CustomerType
|
||||
);
|
||||
ownersList.Add(bankDetailsOwner);
|
||||
}
|
||||
}
|
||||
|
||||
var authorizedBankDetails = new AuthorizedBankDetails(
|
||||
command.CardNumber,
|
||||
command.AccountNumber,
|
||||
command.IBan,
|
||||
command.BankName,
|
||||
ownersList
|
||||
);
|
||||
|
||||
_authorizedBankDetailsRepository.Create(authorizedBankDetails);
|
||||
_authorizedBankDetailsRepository.SaveChanges();
|
||||
return operation.Succcedded();
|
||||
}
|
||||
|
||||
public EditAuthorizedBankDetails GetDetails(long id)
|
||||
{
|
||||
return _authorizedBankDetailsRepository.GetDetails(id);
|
||||
}
|
||||
|
||||
public List<AuthorizedBankDetailsViewModel> Search(AuthorizedBankDetailsSearchModel searchModel)
|
||||
{
|
||||
return _authorizedBankDetailsRepository.Search(searchModel);
|
||||
}
|
||||
|
||||
public AuthorizedBankDetailsViewModel GetByIban(string iban)
|
||||
{
|
||||
return _authorizedBankDetailsRepository.GetByIban(iban);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -193,8 +193,19 @@ public class CheckoutApplication : ICheckoutApplication
|
||||
//حق بیمه سهم کارگر
|
||||
#region InsuranceDeduction
|
||||
|
||||
var insuranceOverTime = command.HasInsuranceChekoutOverTime ? command.OvertimePay : 0;
|
||||
var insuranceDeduction = (monthlyWage + bacicYears + consumableItem + housingAllowance + marriedAllowance + insuranceOverTime) * 7 / 100;
|
||||
double insuranceDeduction = 0;
|
||||
bool hasInsuranceShareTheSameAsList = false;
|
||||
if (command.InsuranceDeduction == 0)
|
||||
{
|
||||
var insuranceOverTime = command.HasInsuranceChekoutOverTime ? command.OvertimePay : 0;
|
||||
insuranceDeduction = (monthlyWage + bacicYears + consumableItem + housingAllowance + marriedAllowance + insuranceOverTime) * 7 / 100;
|
||||
}
|
||||
else
|
||||
{
|
||||
insuranceDeduction = command.InsuranceDeduction;
|
||||
hasInsuranceShareTheSameAsList = true;
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -375,7 +386,7 @@ public class CheckoutApplication : ICheckoutApplication
|
||||
, 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,command.EmployeeMandatoryHours);
|
||||
loanInstallments, salaryAids,checkoutRollCall,command.EmployeeMandatoryHours, hasInsuranceShareTheSameAsList);
|
||||
|
||||
_checkoutRepository.CreateCkeckout(checkout).GetAwaiter().GetResult();
|
||||
//_checkoutRepository.SaveChanges();
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using _0_Framework.Application;
|
||||
using _0_Framework.Application.UID;
|
||||
using _0_Framework.Exceptions;
|
||||
using Company.Domain.ContarctingPartyAgg;
|
||||
using Company.Domain.ContractingPartyBankAccountsAgg;
|
||||
using CompanyManagment.App.Contracts.ContractingPartyBankAccounts;
|
||||
@@ -12,13 +16,15 @@ public class ContractingPartyBankAccountsApplication : IContractingPartyBankAcco
|
||||
{
|
||||
private readonly IContractingPartyBankAccountsRepository _contractingPartyBankAccountsRepository;
|
||||
private readonly IPersonalContractingPartyRepository _personalContractingPartyRepository;
|
||||
private readonly IUidService _uidService;
|
||||
|
||||
public ContractingPartyBankAccountsApplication(
|
||||
IContractingPartyBankAccountsRepository contractingPartyBankAccountsRepository,
|
||||
IPersonalContractingPartyRepository personalContractingPartyRepository)
|
||||
IPersonalContractingPartyRepository personalContractingPartyRepository, IUidService uidService)
|
||||
{
|
||||
_contractingPartyBankAccountsRepository = contractingPartyBankAccountsRepository;
|
||||
_personalContractingPartyRepository = personalContractingPartyRepository;
|
||||
_uidService = uidService;
|
||||
}
|
||||
|
||||
public async Task<OperationResult> Create(CreateContractingPartyBankAccounts command)
|
||||
@@ -69,18 +75,19 @@ public class ContractingPartyBankAccountsApplication : IContractingPartyBankAcco
|
||||
if (string.IsNullOrWhiteSpace(command.IBan))
|
||||
return operationResult.Failed("شماره شبا خود را وارد کنید");
|
||||
}
|
||||
else if(string.IsNullOrWhiteSpace(command.CardNumber) &&
|
||||
else if (string.IsNullOrWhiteSpace(command.CardNumber) &&
|
||||
string.IsNullOrWhiteSpace(command.AccountNumber) &&
|
||||
string.IsNullOrWhiteSpace(command.IBan))
|
||||
{
|
||||
return operationResult.Failed(" حداقل یکی از اطلاعات بانکی را وارد کنید: شماره کارت، شماره حساب یا شماره شبا");
|
||||
return operationResult.Failed(
|
||||
" حداقل یکی از اطلاعات بانکی را وارد کنید: شماره کارت، شماره حساب یا شماره شبا");
|
||||
}
|
||||
|
||||
if (string.IsNullOrWhiteSpace(command.AccountHolderName))
|
||||
{
|
||||
return operationResult.Failed("نام صاحب حساب را وارد کنید");
|
||||
}
|
||||
|
||||
|
||||
|
||||
var entity = new ContractingPartyBankAccount(command.ContractingPartyId, command.CardNumber,
|
||||
command.AccountHolderName, command.AccountNumber, command.IBan, command.IsAuth);
|
||||
@@ -130,4 +137,83 @@ public class ContractingPartyBankAccountsApplication : IContractingPartyBankAcco
|
||||
{
|
||||
return await _contractingPartyBankAccountsRepository.ContractingPartyNamesSelectList(search, selected);
|
||||
}
|
||||
|
||||
public async Task<ContractingPartyBankInquiryResponse> InquiryContractingPartyBankDetails(
|
||||
InquiryContractingPartyBankDetailsRequest command)
|
||||
{
|
||||
var iBan = command.IBan;
|
||||
var cardNumber = command.CardNumber;
|
||||
var accountNumber = command.AccountNumber;
|
||||
var uidBank = command.UidBank;
|
||||
ContractingPartyBankInquiryResponse result = new ContractingPartyBankInquiryResponse();
|
||||
if (!string.IsNullOrWhiteSpace(iBan))
|
||||
{
|
||||
if (!iBan.IsvalidIban())
|
||||
{
|
||||
throw new BadRequestException("شماره شبا وارد شده معتبر نمی باشد");
|
||||
}
|
||||
|
||||
var response = await _uidService.IbanInquiry(iBan);
|
||||
if (response.ResponseContext.Status.Code != 0)
|
||||
{
|
||||
throw new BadRequestException("خطای احراز هویت. کد خطا: " + response.ResponseContext.Status.Code);
|
||||
}
|
||||
|
||||
var owner = response.Owners.FirstOrDefault();
|
||||
var ownerFirstName = owner != null ? $"{owner.FirstName} {owner.LastName}" : "";
|
||||
result.FullName = ownerFirstName;
|
||||
result.AccountNumber = response.AccountBasicInformation.AccountNumber;
|
||||
result.Iban = response.AccountBasicInformation.Iban;
|
||||
}
|
||||
else if (!string.IsNullOrWhiteSpace(cardNumber))
|
||||
{
|
||||
if (!cardNumber.IsValidCardNumber())
|
||||
{
|
||||
throw new BadRequestException("شماره کارت وارد شده معتبر نمی باشد");
|
||||
}
|
||||
|
||||
var bankCardRes = await _uidService.CardToIban(cardNumber);
|
||||
if (bankCardRes.ResponseContext.Status.Code != 0)
|
||||
{
|
||||
throw new BadRequestException("خطای احراز هویت. کد خطا: " + bankCardRes.ResponseContext.Status.Code);
|
||||
}
|
||||
|
||||
var response = await _uidService.IbanInquiry(bankCardRes.Iban);
|
||||
if (response.ResponseContext.Status.Code != 0)
|
||||
{
|
||||
throw new BadRequestException("خطای احراز هویت. کد خطا: " + response.ResponseContext.Status.Code);
|
||||
}
|
||||
|
||||
var owner = response.Owners.FirstOrDefault();
|
||||
var ownerFirstName = owner != null ? $"{owner.FirstName} {owner.LastName}" : "";
|
||||
result.FullName = ownerFirstName;
|
||||
result.AccountNumber = response.AccountBasicInformation.AccountNumber;
|
||||
result.CardNumber = cardNumber;
|
||||
result.Iban = response.AccountBasicInformation.Iban;
|
||||
}
|
||||
else if (!string.IsNullOrWhiteSpace(accountNumber))
|
||||
{
|
||||
var accountNumberRes = await _uidService.AccountToIban(accountNumber, uidBank.Value);
|
||||
if (accountNumberRes.ResponseContext.Status.Code != 0)
|
||||
{
|
||||
throw new BadRequestException(
|
||||
"خطای احراز هویت. کد خطا: " + accountNumberRes.ResponseContext.Status.Code);
|
||||
}
|
||||
|
||||
var response = await _uidService.IbanInquiry(accountNumberRes.Iban);
|
||||
|
||||
var owner = response.Owners.FirstOrDefault();
|
||||
var ownerFirstName = owner != null ? $"{owner.FirstName} {owner.LastName}" : "";
|
||||
result.FullName = ownerFirstName;
|
||||
result.AccountNumber = response.AccountBasicInformation.AccountNumber;
|
||||
result.Iban = response.AccountBasicInformation.Iban;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new BadRequestException(
|
||||
"حداقل یکی از اطلاعات بانکی را وارد کنید: شماره کارت، شماره حساب یا شماره شبا");
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -373,7 +373,9 @@ namespace CompanyManagment.Application
|
||||
Color = color,
|
||||
PersonnelCode = personnelCodes.FirstOrDefault(y => x.Id == y.EmployeeId)?.PersonnelCode.ToString() ?? "-"
|
||||
};
|
||||
}).OrderByDescending(x => x.IsEligible).ThenByDescending(x => x.Reason).ToList();
|
||||
}).OrderBy(x => x.Color switch { "orange" => 0, "white" => 1, "red" => 2, "green" => 3, "black" => 4, _ => 5 })
|
||||
.ToList();
|
||||
|
||||
return op.Succcedded(employees);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Security.AccessControl;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml;
|
||||
using _0_Framework.Application;
|
||||
using _0_Framework.Application.Enums;
|
||||
using _0_Framework.Application.UID;
|
||||
@@ -13,6 +14,7 @@ using Company.Domain.WorkshopAgg;
|
||||
using CompanyManagment.App.Contracts.Checkout;
|
||||
using CompanyManagment.App.Contracts.Employer;
|
||||
using CompanyManagment.EFCore.Repository;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Identity.Client;
|
||||
|
||||
namespace CompanyManagment.Application;
|
||||
@@ -42,7 +44,6 @@ public class EmployerApplication : IEmployerApplication
|
||||
}
|
||||
|
||||
|
||||
|
||||
public OperationResult Active(long id)
|
||||
{
|
||||
var opration = new OperationResult();
|
||||
@@ -1029,7 +1030,7 @@ public class EmployerApplication : IEmployerApplication
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Api
|
||||
|
||||
public async Task<List<GetEmployerListViewModel>> GetEmployerList(GetEmployerSearchModel searchModel)
|
||||
@@ -1285,9 +1286,10 @@ public class EmployerApplication : IEmployerApplication
|
||||
return opration.Succcedded();
|
||||
}
|
||||
|
||||
public async Task<List<EmployerSelectListViewModel>> GetSelectList(string search, long id)
|
||||
public async Task<List<EmployerSelectListViewModel>> GetSelectList(string search, long id,
|
||||
LegalType? legalType = null)
|
||||
{
|
||||
return await _EmployerRepository.GetSelectList(search, id);
|
||||
return await _EmployerRepository.GetSelectList(search, id, legalType);
|
||||
}
|
||||
|
||||
async Task<OperationResult<string>> IEmployerApplication.Remove(long id)
|
||||
@@ -1312,19 +1314,36 @@ public class EmployerApplication : IEmployerApplication
|
||||
{
|
||||
var operation = new OperationResult();
|
||||
var tranasction = await _EmployerRepository.BeginTransactionAsync();
|
||||
OperationResult<Employer> createEmployerResult = command.LegalType switch
|
||||
Employer employer;
|
||||
if (command.EmployerId != 0)
|
||||
{
|
||||
LegalType.Real => await CreateRealEmployerRegistration(command.RealEmployer, command.ContractingPartyId),
|
||||
LegalType.Legal => await CreateLegalEmployerRegistration(command.LegalEmployer, command.ContractingPartyId),
|
||||
_ => throw new ArgumentOutOfRangeException()
|
||||
};
|
||||
var employer = createEmployerResult.Data;
|
||||
employer = _EmployerRepository.Get(command.EmployerId);
|
||||
if (employer == null)
|
||||
throw new NotFoundException("کارفرمای مورد نظر یافت نشد");
|
||||
}
|
||||
else
|
||||
{
|
||||
OperationResult<Employer> createEmployerResult = command.LegalType switch
|
||||
{
|
||||
LegalType.Real =>
|
||||
await CreateRealEmployerRegistration(command.RealEmployer, command.ContractingPartyId),
|
||||
LegalType.Legal => await CreateLegalEmployerRegistration(command.LegalEmployer,
|
||||
command.ContractingPartyId),
|
||||
_ => throw new ArgumentOutOfRangeException()
|
||||
};
|
||||
employer = createEmployerResult.Data;
|
||||
|
||||
if (!createEmployerResult.IsSuccedded)
|
||||
return operation.Failed(createEmployerResult.Message);
|
||||
if (!createEmployerResult.IsSuccedded)
|
||||
return operation.Failed(createEmployerResult.Message);
|
||||
}
|
||||
|
||||
var workshopDetails =
|
||||
await _institutionContractRepository.GetInstitutionWorkshopInitialDetails(command.InstitutionWorkshopInitialId);
|
||||
await _institutionContractRepository.GetInstitutionWorkshopInitialDetails(command
|
||||
.InstitutionWorkshopInitialId);
|
||||
if (workshopDetails.Employers.Any(x => x.EmployerId == employer.id))
|
||||
{
|
||||
throw new BadRequestException("این کارفرما قبلا در این کارگاه ثبت شده است");
|
||||
}
|
||||
workshopDetails.AddEmployer(employer.id);
|
||||
|
||||
await _institutionContractRepository.SaveChangesAsync();
|
||||
@@ -1335,7 +1354,7 @@ public class EmployerApplication : IEmployerApplication
|
||||
public async Task<OperationResult> EditWorkflowRegistration(EditEmployerWorkflowRegistration command)
|
||||
{
|
||||
var operation = new OperationResult();
|
||||
|
||||
|
||||
// Get the existing employer
|
||||
var employer = _EmployerRepository.Get(command.EmployerId);
|
||||
if (employer == null)
|
||||
@@ -1364,55 +1383,55 @@ public class EmployerApplication : IEmployerApplication
|
||||
public async Task<OperationResult> DeleteWorkflowRegistration(long employerId, long institutionWorkshopDetailsId)
|
||||
{
|
||||
var operation = new OperationResult();
|
||||
|
||||
|
||||
// Check if employer exists
|
||||
var employer = _EmployerRepository.Get(employerId);
|
||||
if (employer == null)
|
||||
return operation.Failed("کارفرمای مورد نظر یافت نشد");
|
||||
|
||||
|
||||
// Get workshop details
|
||||
var workshopDetails = await _institutionContractRepository.GetInstitutionWorkshopInitialDetails(institutionWorkshopDetailsId);
|
||||
var workshopDetails =
|
||||
await _institutionContractRepository
|
||||
.GetInstitutionWorkshopInitialDetails(institutionWorkshopDetailsId);
|
||||
if (workshopDetails == null)
|
||||
return operation.Failed("جزئیات کارگاه موسسه یافت نشد");
|
||||
|
||||
|
||||
// Find and remove the employer from workshop details
|
||||
var employerDetail = workshopDetails.Employers.FirstOrDefault(e => e.EmployerId == employerId);
|
||||
var employerDetail = workshopDetails
|
||||
.Employers.FirstOrDefault(e => e.EmployerId == employerId);
|
||||
if (employerDetail == null)
|
||||
return operation.Failed("کارفرما در لیست کارگاه یافت نشد");
|
||||
|
||||
|
||||
// Remove the employer from the list
|
||||
workshopDetails.Employers.Remove(employerDetail);
|
||||
|
||||
|
||||
await _institutionContractRepository.SaveChangesAsync();
|
||||
|
||||
// Delete the employer
|
||||
_EmployerRepository.Remove(employerId);
|
||||
await _EmployerRepository.SaveChangesAsync();
|
||||
|
||||
|
||||
return operation.Succcedded();
|
||||
}
|
||||
|
||||
|
||||
public async Task<OperationResult<AuthenticateUserViewModel>> AuthenticateEmployer(string nationalCode,
|
||||
string dateOfBirth,
|
||||
string mobile)
|
||||
{
|
||||
var op = new OperationResult<AuthenticateUserViewModel>();
|
||||
|
||||
|
||||
var dateOfBirthGr = dateOfBirth.ToGeorgianDateTime();
|
||||
|
||||
|
||||
var isMachMobilAndNationalCode = await _uidService.IsMachPhoneWithNationalCode(nationalCode, mobile);
|
||||
if (isMachMobilAndNationalCode == null)
|
||||
return op.Failed("خطا در سرویس احراز هویت");
|
||||
if (!isMachMobilAndNationalCode.IsMatched)
|
||||
return op.Failed("شماره همراه وارد شده با کد ملی مطابقت ندارد");
|
||||
var apiRespons = await _uidService.GetPersonalInfo(nationalCode, dateOfBirth);
|
||||
|
||||
|
||||
if (apiRespons == null)
|
||||
throw new InternalServerException("سیستم احراز هویت در دسترس نمی باشد");
|
||||
|
||||
if (apiRespons.ResponseContext.Status.Code ==14)
|
||||
|
||||
if (apiRespons.ResponseContext.Status.Code == 14)
|
||||
throw new InternalServerException("سیستم احراز هویت در دسترس نمی باشد");
|
||||
|
||||
|
||||
if (apiRespons.ResponseContext.Status.Code != 0)
|
||||
return op.Failed($"{apiRespons.ResponseContext.Status.Message}");
|
||||
|
||||
@@ -1420,6 +1439,7 @@ public class EmployerApplication : IEmployerApplication
|
||||
? apiRespons.IdentificationInformation.NationalId
|
||||
: apiRespons.IdentificationInformation.ShenasnamehNumber;
|
||||
|
||||
|
||||
var res = new AuthenticateUserViewModel()
|
||||
{
|
||||
DateOfBirth = dateOfBirth,
|
||||
@@ -1436,6 +1456,12 @@ public class EmployerApplication : IEmployerApplication
|
||||
return op.Succcedded(res);
|
||||
}
|
||||
|
||||
public Task<ActionResult<EditEmployerWorkflowRegistration>> GetWorkflowRegistrationForEdit(long employerId,
|
||||
long institutionWorkshopDetailsId)
|
||||
{
|
||||
return _EmployerRepository.GetWorkflowRegistrationForEdit(employerId, institutionWorkshopDetailsId);
|
||||
}
|
||||
|
||||
private async Task<OperationResult<Employer>> CreateLegalEmployerRegistration(
|
||||
CreateLegalEmployerWorkflowRegistration command, long contractingPartyId)
|
||||
{
|
||||
@@ -1502,6 +1528,11 @@ public class EmployerApplication : IEmployerApplication
|
||||
command.GovernmentSystemInfo.EServiceUsername, command.GovernmentSystemInfo.EServicePassword,
|
||||
command.GovernmentSystemInfo.TaxUsername, command.GovernmentSystemInfo.TaxPassword,
|
||||
command.GovernmentSystemInfo.SanaUsername, command.GovernmentSystemInfo.SanaPassword);
|
||||
if (command.IsAuth)
|
||||
{
|
||||
legalEmployerData.LegalAuthentication(command.CeoFName,command.CeoLName,command.CeoFatherName,
|
||||
command.CeoIdNumber,command.IdNumberSeri,command.IdNumberSerial,command.CeoDateOfBirth,command.Gender,command.PhoneNumber);
|
||||
}
|
||||
|
||||
await _EmployerRepository.CreateAsync(legalEmployerData);
|
||||
await _EmployerRepository.SaveChangesAsync();
|
||||
@@ -1555,6 +1586,12 @@ public class EmployerApplication : IEmployerApplication
|
||||
command.GovernmentSystemInfo.EServicePassword,
|
||||
command.GovernmentSystemInfo.TaxUsername, command.GovernmentSystemInfo.TaxPassword,
|
||||
command.GovernmentSystemInfo.SanaUsername, command.GovernmentSystemInfo.SanaPassword);
|
||||
if (command.IsAuth)
|
||||
{
|
||||
employerData.Authentication(command.FName, command.LName, command.FatherName, command.IdNumber,
|
||||
command.IdNumberSeri,
|
||||
command.IdNumberSerial, command.DateOfBirth, command.Gender, command.PhoneNumber);
|
||||
}
|
||||
|
||||
await _EmployerRepository.CreateAsync(employerData);
|
||||
await _EmployerRepository.SaveChangesAsync();
|
||||
@@ -1664,5 +1701,6 @@ public class EmployerApplication : IEmployerApplication
|
||||
await _EmployerRepository.SaveChangesAsync();
|
||||
return operation.Succcedded();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -106,8 +106,11 @@ public class FinancialStatmentApplication : IFinancialStatmentApplication
|
||||
debtor = command.DeptorString.MoneyToDouble();
|
||||
|
||||
}
|
||||
|
||||
var tDateGr = command.TdateFa.ToGeorgianDateTime();
|
||||
|
||||
if (!command.TdateFa.TryToGeorgianDateTime(out var tDateGr))
|
||||
{
|
||||
return op.Failed("تاریخ وارد شده صحیح نمی باشد");
|
||||
}
|
||||
if (_financialStatmentRepository.Exists(x => x.ContractingPartyId == command.ContractingPartyId))
|
||||
{
|
||||
var financialStatment = _financialStatmentRepository.GetDetailsByContractingPartyId(command.ContractingPartyId);
|
||||
|
||||
@@ -318,7 +318,7 @@ public class InstitutionContractApplication : IInstitutionContractApplication
|
||||
command.DailyCompenseation, command.Obligation,
|
||||
command.TotalAmount, command.ExtensionNo, command.WorkshopManualCount, command.EmployeeManualCount,
|
||||
command.Description, command.OfficialCompany, command.TypeOfContract, command.HasValueAddedTax,
|
||||
command.ValueAddedTax, [],command.LawId);
|
||||
command.ValueAddedTax, [], command.LawId);
|
||||
|
||||
_institutionContractRepository.Create(createContract);
|
||||
_institutionContractRepository.SaveChanges();
|
||||
@@ -1046,7 +1046,7 @@ public class InstitutionContractApplication : IInstitutionContractApplication
|
||||
command.Workshops.Count.ToString(),
|
||||
command.Workshops.Sum(x => x.PersonnelCount).ToString(), command.Description,
|
||||
"NotOfficial", "JobRelation", hasValueAddedTax,
|
||||
command.TaxAmount, workshopDetails,command.LawId);
|
||||
command.TaxAmount, workshopDetails, command.LawId);
|
||||
|
||||
|
||||
FinancialStatment financialStatement;
|
||||
@@ -1139,12 +1139,12 @@ public class InstitutionContractApplication : IInstitutionContractApplication
|
||||
if (res.IsSuccedded)
|
||||
CreateContractingPartyAccount(contractingParty.id, res.SendId);
|
||||
|
||||
|
||||
await _smsService.SendInstitutionCreationVerificationLink(contractingParty.Phone, contractingPartyFullName,
|
||||
entity.PublicId, contractingParty.id,entity.id );
|
||||
|
||||
await _institutionContractRepository.SaveChangesAsync();
|
||||
|
||||
await _smsService.SendInstitutionVerificationLink(contractingParty.Phone, contractingPartyFullName,
|
||||
entity.PublicId);
|
||||
|
||||
|
||||
await transaction.CommitAsync();
|
||||
return opration.Succcedded();
|
||||
}
|
||||
@@ -1153,7 +1153,7 @@ public class InstitutionContractApplication : IInstitutionContractApplication
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
|
||||
|
||||
public Task<List<RegistrationWorkflowMainListViewModel>> RegistrationWorkflowMainList()
|
||||
{
|
||||
@@ -1203,7 +1203,12 @@ public class InstitutionContractApplication : IInstitutionContractApplication
|
||||
throw new NotFoundException("طرف قرارداد یافت نشد");
|
||||
|
||||
var code = new Random().Next(1000, 9999).ToString();
|
||||
institutionContract.SetVerifyCode(code);
|
||||
|
||||
var contractingPartyFullName = contractingParty.IsLegal == "حقیقی"
|
||||
? contractingParty.FName + " " + contractingParty.LName
|
||||
: contractingParty.CeoFName + " " + contractingParty.CeoLName;
|
||||
|
||||
institutionContract.SetVerifyCode(code,contractingPartyFullName ,contractingParty.Phone);
|
||||
|
||||
var transaction = await _institutionContractRepository.BeginTransactionAsync();
|
||||
try
|
||||
@@ -1249,8 +1254,31 @@ public class InstitutionContractApplication : IInstitutionContractApplication
|
||||
|
||||
if (institutionContract.VerifyCode != code)
|
||||
return op.Failed("کد وارد شده صحیح نمی باشد");
|
||||
|
||||
var transaction = await _institutionContractRepository.BeginTransactionAsync();
|
||||
institutionContract.SetPendingWorkflow();
|
||||
|
||||
var phone = institutionContract.ContactInfoList.FirstOrDefault(x =>
|
||||
x.SendSms && x.Position == "طرف قرارداد" && x.PhoneType == "شماره همراه");
|
||||
if (phone !=null)
|
||||
{
|
||||
var userPass = contractingParty.IsLegal == "حقیقی"
|
||||
? contractingParty.Nationalcode
|
||||
: contractingParty.NationalId;
|
||||
var createAcc = new RegisterAccount
|
||||
{
|
||||
Fullname = contractingParty.LName,
|
||||
Username = userPass,
|
||||
Password = userPass,
|
||||
Mobile = phone.PhoneNumber,
|
||||
NationalCode = userPass
|
||||
};
|
||||
var res = _accountApplication.RegisterClient(createAcc);
|
||||
if (res.IsSuccedded)
|
||||
CreateContractingPartyAccount(contractingParty.id, res.SendId);
|
||||
}
|
||||
|
||||
await transaction.CommitAsync();
|
||||
await _institutionContractRepository.SaveChangesAsync();
|
||||
return op.Succcedded();
|
||||
}
|
||||
@@ -1259,6 +1287,7 @@ public class InstitutionContractApplication : IInstitutionContractApplication
|
||||
{
|
||||
var details = await _institutionContractRepository.GetInstitutionWorkshopInitialDetails(workshopDetailsId);
|
||||
var services = details.Services;
|
||||
var newArchiveCode = _workshopRepository.GetLastArchiveCode() + 1;
|
||||
|
||||
var res = new InstitutionContractWorkshopDetailViewModel()
|
||||
{
|
||||
@@ -1271,7 +1300,9 @@ public class InstitutionContractApplication : IInstitutionContractApplication
|
||||
InsuranceInPerson = services.InsuranceInPerson,
|
||||
RollCall = services.RollCall,
|
||||
RollCallInPerson = services.RollCallInPerson
|
||||
}
|
||||
},
|
||||
WorkshopName = details.WorkshopName,
|
||||
ArchiveCode = newArchiveCode
|
||||
};
|
||||
return res;
|
||||
}
|
||||
@@ -1287,12 +1318,14 @@ public class InstitutionContractApplication : IInstitutionContractApplication
|
||||
return await _institutionContractRepository.GetExtensionWorkshops(request);
|
||||
}
|
||||
|
||||
public async Task<InstitutionContractExtensionPlanResponse> GetExtensionInstitutionPlan(InstitutionContractExtensionPlanRequest request)
|
||||
public async Task<InstitutionContractExtensionPlanResponse> GetExtensionInstitutionPlan(
|
||||
InstitutionContractExtensionPlanRequest request)
|
||||
{
|
||||
return await _institutionContractRepository.GetExtensionInstitutionPlan(request);
|
||||
}
|
||||
|
||||
public async Task<InstitutionContractExtensionPaymentResponse> GetExtensionPaymentMethod(InstitutionContractExtensionPaymentRequest request)
|
||||
public async Task<InstitutionContractExtensionPaymentResponse> GetExtensionPaymentMethod(
|
||||
InstitutionContractExtensionPaymentRequest request)
|
||||
{
|
||||
return await _institutionContractRepository.GetExtensionPaymentMethod(request);
|
||||
}
|
||||
@@ -1301,6 +1334,68 @@ public class InstitutionContractApplication : IInstitutionContractApplication
|
||||
{
|
||||
return await _institutionContractRepository.ExtensionComplete(request);
|
||||
}
|
||||
|
||||
public async Task<List<InstitutionContractSelectListViewModel>> GetInstitutionContractSelectList(string search, string selected)
|
||||
{
|
||||
return await _institutionContractRepository.GetInstitutionContractSelectList(search,selected);
|
||||
}
|
||||
|
||||
public async Task<InstitutionContractAmendmentWorkshopsResponse> GetAmendmentWorkshops(long institutionContractId)
|
||||
{
|
||||
return await _institutionContractRepository.GetAmendmentWorkshops(institutionContractId);
|
||||
}
|
||||
|
||||
public async Task<InsertAmendmentTempWorkshopResponse> InsertAmendmentTempWorkshops(InstitutionContractAmendmentTempWorkshopViewModel request)
|
||||
{
|
||||
return await _institutionContractRepository.InsertAmendmentTempWorkshops(request);
|
||||
}
|
||||
|
||||
public Task RemoveAmendmentWorkshops(Guid workshopTempId)
|
||||
{
|
||||
return _institutionContractRepository.RemoveAmendmentWorkshops(workshopTempId);
|
||||
}
|
||||
|
||||
public Task<InsitutionContractAmendmentPaymentResponse> GetAmendmentPaymentDetails(InsitutionContractAmendmentPaymentRequest request)
|
||||
{
|
||||
return _institutionContractRepository.GetAmendmentPaymentDetails(request);
|
||||
}
|
||||
|
||||
public async Task<OperationResult> ResendVerifyLink(long institutionContractId)
|
||||
{
|
||||
var institutionContract = _institutionContractRepository.Get(institutionContractId);
|
||||
|
||||
if (institutionContract == null)
|
||||
{
|
||||
throw new NotFoundException("رکورد مورد نظر یافت نشد");
|
||||
}
|
||||
|
||||
if (institutionContract.VerificationStatus != InstitutionContractVerificationStatus.PendingForVerify)
|
||||
{
|
||||
throw new BadRequestException("این قرارداد مالی در وضعیت مناسبی برای ارسال مجدد لینک تایید نمی باشد");
|
||||
}
|
||||
var contractingParty = _contractingPartyRepository.Get(institutionContract.ContractingPartyId);
|
||||
if (contractingParty == null)
|
||||
throw new NotFoundException("طرف قرارداد یافت نشد");
|
||||
var contractingPartyFullName = contractingParty.FName + " " + contractingParty.LName;
|
||||
await _smsService.SendInstitutionCreationVerificationLink(contractingParty.Phone, contractingPartyFullName,
|
||||
institutionContract.PublicId, contractingParty.id, institutionContract.id);
|
||||
return new OperationResult().Succcedded();
|
||||
}
|
||||
|
||||
public async Task<InstitutionContractPrintViewModel> PrintOneAsync(long id)
|
||||
{
|
||||
return (await _institutionContractRepository.PrintAllAsync([id])).FirstOrDefault();
|
||||
}
|
||||
|
||||
public async Task<GetInstitutionAmendmentVerificationDetailsViewModel> GetAmendmentVerificationDetails(Guid id, long amendmentId)
|
||||
{
|
||||
return await _institutionContractRepository.GetAmendmentVerificationDetails(id,amendmentId);
|
||||
}
|
||||
|
||||
public async Task AmendmentComplete(InstitutionContractAmendmentCompleteRequest request)
|
||||
{
|
||||
await _institutionContractRepository.AmendmentComplete(request);
|
||||
}
|
||||
|
||||
|
||||
private async Task<OperationResult<PersonalContractingParty>> CreateLegalContractingPartyEntity(
|
||||
@@ -1342,8 +1437,8 @@ public class InstitutionContractApplication : IInstitutionContractApplication
|
||||
|
||||
if (request.IsAuth)
|
||||
{
|
||||
legalContractingParty.LegalAuthentication(request.FName,request.LName,request.FatherName,
|
||||
request.IdNumber,null,null,request.BirthDateFa,request.Gender,request.PhoneNumber);
|
||||
legalContractingParty.LegalAuthentication(request.FName, request.LName, request.FatherName,
|
||||
request.IdNumber, null, null, request.BirthDateFa, request.Gender, request.PhoneNumber);
|
||||
}
|
||||
|
||||
await _contractingPartyRepository.CreateAsync(legalContractingParty);
|
||||
@@ -1388,7 +1483,7 @@ public class InstitutionContractApplication : IInstitutionContractApplication
|
||||
if (request.IsAuth)
|
||||
{
|
||||
personalContractingParty.Authentication(request.FName, request.LName, request.FatherName,
|
||||
request.IdNumber, null,null, request.BirthDateFa, request.Gender,request.PhoneNumber);
|
||||
request.IdNumber, null, null, request.BirthDateFa, request.Gender, request.PhoneNumber);
|
||||
}
|
||||
|
||||
await _contractingPartyRepository.CreateAsync(personalContractingParty);
|
||||
@@ -1397,7 +1492,7 @@ public class InstitutionContractApplication : IInstitutionContractApplication
|
||||
return operation.Succcedded(personalContractingParty);
|
||||
}
|
||||
|
||||
private List<InstitutionContractInstallment> CalculateInstallment(double amount, int installmentCount,
|
||||
public static List<InstitutionContractInstallment> CalculateInstallment(double amount, int installmentCount,
|
||||
string loanStartDate, bool getRounded)
|
||||
{
|
||||
int day = Convert.ToInt32(loanStartDate.Substring(8, 2));
|
||||
@@ -1505,4 +1600,4 @@ public class WorkshopsAndEmployeeViewModel
|
||||
public int ArchiveCode { get; set; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion
|
||||
@@ -1707,7 +1707,7 @@ public class InsuranceListApplication : IInsuranceListApplication
|
||||
return result;
|
||||
}
|
||||
|
||||
private double? GetDailyWageFixedSalary(string year, long workshopId, long employeeId, DateTime? startDateGr, DateTime? endDateGr, long jobId, string population, long? insuranceJobId)
|
||||
public double? GetDailyWageFixedSalary(string year, long workshopId, long employeeId, DateTime? startDateGr, DateTime? endDateGr, long jobId, string population, long? insuranceJobId)
|
||||
{
|
||||
|
||||
double? result = 0;
|
||||
@@ -1858,7 +1858,7 @@ public class InsuranceListApplication : IInsuranceListApplication
|
||||
/// <param name="jobId"></param>
|
||||
/// <param name="employeeId"></param>
|
||||
/// <returns></returns>
|
||||
private double GetMonthlyBenefits(int endMonthCurrentDay, double consumableItemsItemValue, double housingAllowanceItemValue, double maritalStatus, int countWorkingDays, string typeOfInsuranceSendWorkshop, long jobId, long employeeId, bool includeStatus)
|
||||
public double GetMonthlyBenefits(int endMonthCurrentDay, double consumableItemsItemValue, double housingAllowanceItemValue, double maritalStatus, int countWorkingDays, string typeOfInsuranceSendWorkshop, long jobId, long employeeId, bool includeStatus)
|
||||
{
|
||||
//ToDo
|
||||
//افزودن شرط مشمول مزایای
|
||||
@@ -1869,6 +1869,11 @@ public class InsuranceListApplication : IInsuranceListApplication
|
||||
bool isManager = jobId is 10 or 16 or 17 or 18 or 3498;
|
||||
if (isManager && !includeStatus)
|
||||
return 0;
|
||||
|
||||
//پرسنل استثناء سیدعسکر موسوی زاده - فروشگاه ولی عصر
|
||||
if (employeeId == 1496)
|
||||
return 0;
|
||||
|
||||
//پرسنل استثناء
|
||||
if (employeeId == 42783)
|
||||
return 53082855;
|
||||
@@ -1893,7 +1898,7 @@ public class InsuranceListApplication : IInsuranceListApplication
|
||||
|
||||
|
||||
|
||||
private double ComputeDailyWage(double yearlysalaryItemValue, long employeeId, long workshopId, string year)
|
||||
public double ComputeDailyWage(double yearlysalaryItemValue, long employeeId, long workshopId, string year)
|
||||
{
|
||||
double dailyWage = yearlysalaryItemValue;
|
||||
InsuranceListSearchModel searchModel = new InsuranceListSearchModel();
|
||||
|
||||
@@ -30,13 +30,14 @@ public class LeftWorkApplication : ILeftWorkApplication
|
||||
private readonly IEmployeeRepository _employeeRepository;
|
||||
private readonly IWorkshopRepository _workshopRepository;
|
||||
private readonly IRollCallEmployeeRepository _rollCallEmployeeRepository;
|
||||
private readonly IRollCallEmployeeStatusRepository _rollCallEmployeeStatusRepository;
|
||||
private readonly IRollCallEmployeeStatusRepository _rollCallEmployeeStatusRepository;
|
||||
|
||||
|
||||
public LeftWorkApplication(ILeftWorkRepository leftWorkRepository, IContractRepository contractRepository,
|
||||
public LeftWorkApplication(ILeftWorkRepository leftWorkRepository, IContractRepository contractRepository,
|
||||
IContractApplication contractApplication, IWorkingHoursApplication workingHoursApplication,
|
||||
IWorkingHoursItemsApplication workingHoursItemsApplication, IEmployeeRepository employeeRepository,
|
||||
IWorkshopRepository workshopRepository, IRollCallEmployeeStatusRepository rollCallEmployeeStatusRepository, IRollCallEmployeeRepository rollCallEmployeeRepository)
|
||||
IWorkshopRepository workshopRepository, IRollCallEmployeeStatusRepository rollCallEmployeeStatusRepository,
|
||||
IRollCallEmployeeRepository rollCallEmployeeRepository)
|
||||
{
|
||||
_leftWorkRepository = leftWorkRepository;
|
||||
_contractRepository = contractRepository;
|
||||
@@ -51,7 +52,6 @@ public class LeftWorkApplication : ILeftWorkApplication
|
||||
|
||||
public OperationResult Create(CreateLeftWork command)
|
||||
{
|
||||
|
||||
// var Contracts = _contractRepository.Search(new ContractSearchModel()
|
||||
// {
|
||||
// EmployeeId = command.EmployeeId,
|
||||
@@ -70,7 +70,6 @@ public class LeftWorkApplication : ILeftWorkApplication
|
||||
var start = command.StartWorkDate.ToGeorgianDateTime();
|
||||
|
||||
|
||||
|
||||
//if (_leftWorkRepository.Exists(x =>
|
||||
// x.StartWorkDate > start && x.EmployeeId == command.EmployeeId && x.WorkshopId == command.WorkshopId))
|
||||
// return operation.Failed("تاریخ وارد شده کوچکتر از سابقه شروع به کار قبلی است");
|
||||
@@ -112,16 +111,17 @@ public class LeftWorkApplication : ILeftWorkApplication
|
||||
return operation.Failed("تاریخ وارد شده در بازه زمانی سابقه ترک کار قبلی است");
|
||||
|
||||
var employeeFullName = _employeeRepository.GetDetails(command.EmployeeId).EmployeeFullName;
|
||||
var workshop = _workshopRepository.GetDetails(command.WorkshopId);
|
||||
var workshopName = workshop.WorkshopFullName;
|
||||
var workshop = _workshopRepository.GetDetails(command.WorkshopId);
|
||||
var workshopName = workshop.WorkshopFullName;
|
||||
var leftWork = new LeftWork(left, start, command.WorkshopId,
|
||||
command.EmployeeId, employeeFullName, workshopName, command.JobId, command.IncludeStatus,
|
||||
command.AddBonusesPay, command.AddYearsPay, command.AddLeavePay,workshop.ComputeOptions,workshop.BonusesOptions);
|
||||
command.AddBonusesPay, command.AddYearsPay, command.AddLeavePay, workshop.ComputeOptions,
|
||||
workshop.BonusesOptions);
|
||||
_leftWorkRepository.Create(leftWork);
|
||||
_leftWorkRepository.SaveChanges();
|
||||
IfEmployeeHasNewLeftWorkDateAddEndDateToRollCallStatus(command.EmployeeId);
|
||||
IfEmployeeHasNewLeftWorkDateAddEndDateToRollCallStatus(command.EmployeeId, command.WorkshopId);
|
||||
|
||||
return operation.Succcedded();
|
||||
return operation.Succcedded();
|
||||
}
|
||||
|
||||
//public OperationResult Create(CreateLeftWork command)
|
||||
@@ -193,8 +193,8 @@ public class LeftWorkApplication : ILeftWorkApplication
|
||||
command.EmployeeId, command.JobId, command.IncludeStatus, command.AddBonusesPay, command.AddYearsPay,
|
||||
command.AddLeavePay);
|
||||
_leftWorkRepository.SaveChanges();
|
||||
IfEmployeeHasNewLeftWorkDateAddEndDateToRollCallStatus(command.EmployeeId);
|
||||
return operation.Succcedded();
|
||||
IfEmployeeHasNewLeftWorkDateAddEndDateToRollCallStatus(command.EmployeeId, command.WorkshopId);
|
||||
return operation.Succcedded();
|
||||
}
|
||||
|
||||
public EditLeftWork GetDetails(long id)
|
||||
@@ -214,11 +214,9 @@ public class LeftWorkApplication : ILeftWorkApplication
|
||||
|
||||
public List<LeftWorkViewModel> SearchCreateContract(LeftWorkSearchModel searchModel)
|
||||
{
|
||||
|
||||
return _leftWorkRepository.SearchCreateContract(searchModel);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public async Task<List<LeftWorkViewModel>> searchAsync(LeftWorkSearchModel searchModel)
|
||||
{
|
||||
@@ -228,7 +226,6 @@ public class LeftWorkApplication : ILeftWorkApplication
|
||||
|
||||
public string GetBeforeDate(string date)
|
||||
{
|
||||
|
||||
var persianBefore = "";
|
||||
var year = Convert.ToInt32(date.Substring(0, 4));
|
||||
var month = Convert.ToInt32(date.Substring(5, 2));
|
||||
@@ -255,10 +252,8 @@ public class LeftWorkApplication : ILeftWorkApplication
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void LeftWorkExtension(long contractId, string CStart, string CEnd)
|
||||
{
|
||||
|
||||
var step1 = _contractApplication.GetDetails(contractId);
|
||||
var step2 = _workingHoursApplication.GetByContractId(contractId);
|
||||
var step3 = _workingHoursItemsApplication.GetWorkingHoursItems();
|
||||
@@ -380,13 +375,11 @@ public class LeftWorkApplication : ILeftWorkApplication
|
||||
ContarctStart = CStart,
|
||||
ContractEnd = CEnd,
|
||||
GetWorkDateHide = step1.GetWorkDate,
|
||||
|
||||
};
|
||||
var step5 = _contractApplication.MandatoryHours(computing);
|
||||
string workingDays = string.Empty;
|
||||
if (step5.NumberOfWorkingDays == "0")
|
||||
{
|
||||
|
||||
workingDays = step5.ComplexNumberOfWorkingDays;
|
||||
}
|
||||
else
|
||||
@@ -477,8 +470,6 @@ public class LeftWorkApplication : ILeftWorkApplication
|
||||
OverTimeWorkM = step5.OverTimeWorkM == "0" ? "" : step5.OverTimeWorkM,
|
||||
OverNightWorkH = step5.OverNightWorkH == "0" ? "" : step5.OverNightWorkH,
|
||||
OverNightWorkM = step5.OverNightWorkM == "0" ? "" : step5.OverNightWorkM,
|
||||
|
||||
|
||||
};
|
||||
var resss = _contractApplication.Create(createNew);
|
||||
}
|
||||
@@ -529,7 +520,9 @@ public class LeftWorkApplication : ILeftWorkApplication
|
||||
item.LeftWorkDate = string.IsNullOrWhiteSpace(item.LeftWorkDate) ? "1500/01/01" : item.LeftWorkDate;
|
||||
var left = item.LeftWorkDate.ToGeorgianDateTime();
|
||||
var start = item.StartWorkDate.ToGeorgianDateTime();
|
||||
if (_leftWorkRepository.Exists(x => x.StartWorkDate > start && left == null && x.EmployeeId == informationLeftwork.EmployeeId && x.WorkshopId == informationLeftwork.WorkshopId && x.id!=item.Id))
|
||||
if (_leftWorkRepository.Exists(x =>
|
||||
x.StartWorkDate > start && left == null && x.EmployeeId == informationLeftwork.EmployeeId &&
|
||||
x.WorkshopId == informationLeftwork.WorkshopId && x.id != item.Id))
|
||||
return operation.Failed("وارد کردن تاریخ پایان کار اجباری است ");
|
||||
if (_leftWorkRepository.Exists(x =>
|
||||
x.StartWorkDate == start && x.EmployeeId == informationLeftwork.EmployeeId &&
|
||||
@@ -540,17 +533,23 @@ public class LeftWorkApplication : ILeftWorkApplication
|
||||
x.EmployeeId == informationLeftwork.EmployeeId &&
|
||||
x.WorkshopId == informationLeftwork.WorkshopId && x.id != item.Id))
|
||||
return operation.Failed("شروع به کار قبلی این شخص ترک کار ندارد ");
|
||||
if (_leftWorkRepository.Exists(x => x.StartWorkDate <= start && x.LeftWorkDate < left && x.LeftWorkDate >= start && x.EmployeeId == informationLeftwork.EmployeeId && x.WorkshopId == informationLeftwork.WorkshopId && x.id != item.Id))
|
||||
if (_leftWorkRepository.Exists(x =>
|
||||
x.StartWorkDate <= start && x.LeftWorkDate < left && x.LeftWorkDate >= start &&
|
||||
x.EmployeeId == informationLeftwork.EmployeeId &&
|
||||
x.WorkshopId == informationLeftwork.WorkshopId && x.id != item.Id))
|
||||
return operation.Failed("تاریخ وارد شده در بازه زمانی سابقه ترک کار قبلی است");
|
||||
}
|
||||
}
|
||||
|
||||
operation = _leftWorkRepository.CreateLeftWork(informationLeftwork);
|
||||
if (informationLeftwork != null && operation.IsSuccedded) IfEmployeeHasNewLeftWorkDateAddEndDateToRollCallStatus(informationLeftwork.EmployeeId);
|
||||
return operation;
|
||||
}
|
||||
operation = _leftWorkRepository.CreateLeftWork(informationLeftwork);
|
||||
if (informationLeftwork != null && operation.IsSuccedded)
|
||||
IfEmployeeHasNewLeftWorkDateAddEndDateToRollCallStatus(informationLeftwork.EmployeeId,
|
||||
informationLeftwork.WorkshopId);
|
||||
return operation;
|
||||
}
|
||||
|
||||
public OperationResult CreateLeftWorkByLeftWorkGroups(string employeeFullName, long commandEmployeeId, List<PersonnelCodeViewModel> commandPersonnelCode, List<LeftWorkGroup> leftWorkGroups)
|
||||
public OperationResult CreateLeftWorkByLeftWorkGroups(string employeeFullName, long commandEmployeeId,
|
||||
List<PersonnelCodeViewModel> commandPersonnelCode, List<LeftWorkGroup> leftWorkGroups)
|
||||
{
|
||||
var operation = new OperationResult();
|
||||
|
||||
@@ -560,7 +559,9 @@ public class LeftWorkApplication : ILeftWorkApplication
|
||||
{
|
||||
foreach (var item2 in item.LeftWorkViewModels)
|
||||
{
|
||||
item2.LeftWorkDate = string.IsNullOrWhiteSpace(item2.LeftWorkDate) ? "1500/01/01" : item2.LeftWorkDate;
|
||||
item2.LeftWorkDate = string.IsNullOrWhiteSpace(item2.LeftWorkDate)
|
||||
? "1500/01/01"
|
||||
: item2.LeftWorkDate;
|
||||
var left = item2.LeftWorkDate.ToGeorgianDateTime();
|
||||
var start = item2.StartWorkDate.ToGeorgianDateTime();
|
||||
if (_leftWorkRepository.Exists(x =>
|
||||
@@ -586,14 +587,16 @@ public class LeftWorkApplication : ILeftWorkApplication
|
||||
}
|
||||
}
|
||||
|
||||
operation = _leftWorkRepository.CreateLeftWorkByLeftWorkGroups(employeeFullName, commandEmployeeId, commandPersonnelCode, leftWorkGroups);
|
||||
if (operation.IsSuccedded) IfEmployeeHasNewLeftWorkDateAddEndDateToRollCallStatus(commandEmployeeId);
|
||||
return operation;
|
||||
}
|
||||
operation = _leftWorkRepository.CreateLeftWorkByLeftWorkGroups(employeeFullName, commandEmployeeId,
|
||||
commandPersonnelCode, leftWorkGroups);
|
||||
if (operation.IsSuccedded)
|
||||
IfEmployeeHasNewLeftWorkDateAddEndDateToRollCallStatus(commandEmployeeId);
|
||||
return operation;
|
||||
}
|
||||
|
||||
public OperationResult CheckDeleteLeftWork(long workshopId, long employeeId, string date, int type)
|
||||
{
|
||||
return _leftWorkRepository.CheckDeleteLeftWork( workshopId, employeeId, date.ToGeorgianDateTime(),type);
|
||||
return _leftWorkRepository.CheckDeleteLeftWork(workshopId, employeeId, date.ToGeorgianDateTime(), type);
|
||||
}
|
||||
|
||||
public OperationResult CheckEditLeftWork(long workshopId, long employeeId, string date, int type)
|
||||
@@ -607,21 +610,23 @@ public class LeftWorkApplication : ILeftWorkApplication
|
||||
}
|
||||
|
||||
#region Pooya
|
||||
|
||||
//این متد ترک کار های کارمند را با فعالیت حضور غیاب یکپارچه می کند
|
||||
private void IfEmployeeHasNewLeftWorkDateAddEndDateToRollCallStatus(long employeeId)
|
||||
{
|
||||
//get last leftworks for employee in all workshops
|
||||
var leftWorks = _leftWorkRepository.search(new LeftWorkSearchModel() { EmployeeId = employeeId }).GroupBy(x => x.WorkshopId).Select(x =>
|
||||
{
|
||||
var leftWork = x.MaxBy(y => y.StartWorkDateGr);
|
||||
return new LeftWorkViewModel()
|
||||
var leftWorks = _leftWorkRepository.search(new LeftWorkSearchModel() { EmployeeId = employeeId })
|
||||
.GroupBy(x => x.WorkshopId).Select(x =>
|
||||
{
|
||||
EmployeeId = employeeId,
|
||||
WorkshopId = x.Key,
|
||||
LeftWorkDateGr = leftWork.LeftWorkDateGr.Date.AddDays(-1),
|
||||
StartWorkDateGr = leftWork.StartWorkDateGr
|
||||
};
|
||||
}).ToList();
|
||||
var leftWork = x.MaxBy(y => y.StartWorkDateGr);
|
||||
return new LeftWorkViewModel()
|
||||
{
|
||||
EmployeeId = employeeId,
|
||||
WorkshopId = x.Key,
|
||||
LeftWorkDateGr = leftWork.LeftWorkDateGr.Date.AddDays(-1),
|
||||
StartWorkDateGr = leftWork.StartWorkDateGr
|
||||
};
|
||||
}).ToList();
|
||||
|
||||
//get rollCallEmployee associated with those leftworks which have a higher end date than leftworkDate
|
||||
var rollCallsEmployee = _rollCallEmployeeRepository.GetByEmployeeIdWithStatuses(employeeId)
|
||||
@@ -632,17 +637,90 @@ public class LeftWorkApplication : ILeftWorkApplication
|
||||
x.WorkshopId,
|
||||
x.EmployeeId,
|
||||
y.LeftWorkDateGr,
|
||||
Status = x.Statuses.OrderByDescending(z => z.StartDate).FirstOrDefault(z => z.StartDateGr.Date < y.LeftWorkDateGr && z.EndDateGr.Date > y.LeftWorkDateGr)
|
||||
Status = x.Statuses.OrderByDescending(z => z.StartDate).FirstOrDefault(z =>
|
||||
z.StartDateGr.Date < y.LeftWorkDateGr && z.EndDateGr.Date > y.LeftWorkDateGr)
|
||||
});
|
||||
|
||||
//shaping up the list to send as parameter to repository
|
||||
var newRollCallRecords = joinedList.Where(x => x.Status != null).Select(x => new AdjustRollCallEmployeesWithEmployeeLeftWork()
|
||||
{
|
||||
LeaveDate = x.LeftWorkDateGr,
|
||||
RollCallStatusId = x.Status.Id
|
||||
}).ToList();
|
||||
if(newRollCallRecords.Count > 0)
|
||||
var newRollCallRecords = joinedList.Where(x => x.Status != null).Select(x =>
|
||||
new AdjustRollCallEmployeesWithEmployeeLeftWork()
|
||||
{
|
||||
LeaveDate = x.LeftWorkDateGr,
|
||||
RollCallStatusId = x.Status.Id
|
||||
}).ToList();
|
||||
if (newRollCallRecords.Count > 0)
|
||||
_rollCallEmployeeStatusRepository.AdjustRollCallStatusEndDates(newRollCallRecords);
|
||||
|
||||
foreach (var rollCallEmployeeViewModel in rollCallsEmployee)
|
||||
{
|
||||
var maxLeftWork = leftWorks.FirstOrDefault(x => x.WorkshopId == rollCallEmployeeViewModel.WorkshopId);
|
||||
if (maxLeftWork == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
var employeeStatus = _rollCallEmployeeRepository.GetBy(rollCallEmployeeViewModel.EmployeeId,
|
||||
rollCallEmployeeViewModel.WorkshopId);
|
||||
var rollCallEmployeeStatusList = employeeStatus.EmployeesStatus
|
||||
.Where(x => x.StartDate >= maxLeftWork.LeftWorkDateGr).ToList();
|
||||
if (rollCallEmployeeStatusList.Any())
|
||||
{
|
||||
_rollCallEmployeeStatusRepository.RemoveRange(rollCallEmployeeStatusList);
|
||||
_rollCallEmployeeStatusRepository.SaveChanges();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void IfEmployeeHasNewLeftWorkDateAddEndDateToRollCallStatus(long employeeId, long workshopId)
|
||||
{
|
||||
//get last leftworks for employee in all workshops
|
||||
var leftWorks = _leftWorkRepository.search(new LeftWorkSearchModel()
|
||||
{ EmployeeId = employeeId, WorkshopId = workshopId })
|
||||
.Select(x => new LeftWorkViewModel()
|
||||
{
|
||||
EmployeeId = employeeId,
|
||||
WorkshopId = x.WorkshopId,
|
||||
LeftWorkDateGr = x.LeftWorkDateGr.Date.AddDays(-1),
|
||||
StartWorkDateGr = x.StartWorkDateGr
|
||||
}).ToList();
|
||||
|
||||
var maxLeftWork = leftWorks.MaxBy(y => y.StartWorkDateGr);
|
||||
|
||||
|
||||
//get rollCallEmployee associated with those leftworks which have a higher end date than leftworkDate
|
||||
var rollCallsEmployee = _rollCallEmployeeRepository.GetBy(employeeId, workshopId);
|
||||
|
||||
// var joinedList = rollCallsEmployee.Join(leftWorks, x => x.WorkshopId, y => y.WorkshopId, (x, y) => new
|
||||
// {
|
||||
// x.WorkshopId,
|
||||
// x.EmployeeId,
|
||||
// y.LeftWorkDateGr,
|
||||
// Status = x.Statuses.OrderByDescending(z => z.StartDate).FirstOrDefault(z => z.StartDateGr.Date < y.LeftWorkDateGr && z.EndDateGr.Date > y.LeftWorkDateGr)
|
||||
// });
|
||||
|
||||
|
||||
var status = rollCallsEmployee.EmployeesStatus.OrderByDescending(z => z.StartDate)
|
||||
.FirstOrDefault(rollCallEmployeeStatus => rollCallEmployeeStatus.StartDate.Date < maxLeftWork.LeftWorkDateGr
|
||||
&& rollCallEmployeeStatus.EndDate.Date >
|
||||
maxLeftWork.LeftWorkDateGr);
|
||||
|
||||
if (status != null)
|
||||
{
|
||||
var adjust = new AdjustRollCallEmployeesWithEmployeeLeftWork()
|
||||
{
|
||||
LeaveDate = maxLeftWork.LeftWorkDateGr,
|
||||
RollCallStatusId = status.id
|
||||
};
|
||||
_rollCallEmployeeStatusRepository.AdjustRollCallStatusEndDates([adjust]);
|
||||
}
|
||||
|
||||
var rollCallEmployeeStatusList = rollCallsEmployee.EmployeesStatus
|
||||
.Where(x => x.StartDate >= maxLeftWork.LeftWorkDateGr).ToList();
|
||||
if (rollCallEmployeeStatusList.Any())
|
||||
{
|
||||
_rollCallEmployeeStatusRepository.RemoveRange(rollCallEmployeeStatusList);
|
||||
_rollCallEmployeeStatusRepository.SaveChanges();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -27,26 +27,30 @@ namespace CompanyManagment.Application;
|
||||
|
||||
public class LeftWorkTempApplication : ILeftWorkTempApplication
|
||||
{
|
||||
private readonly ILeftWorkTempRepository _leftWorkTempRepository;
|
||||
private readonly ILeftWorkRepository _leftWorkRepository;
|
||||
private readonly IWorkshopRepository _workshopRepository;
|
||||
private readonly IEmployeeRepository _employeeRepository;
|
||||
private readonly IJobRepository _jobRepository;
|
||||
private readonly ICheckoutRepository _checkoutRepository;
|
||||
private readonly IContractRepository _contractRepository;
|
||||
private readonly ILeftWorkTempRepository _leftWorkTempRepository;
|
||||
private readonly ILeftWorkRepository _leftWorkRepository;
|
||||
private readonly IWorkshopRepository _workshopRepository;
|
||||
private readonly IEmployeeRepository _employeeRepository;
|
||||
private readonly IJobRepository _jobRepository;
|
||||
private readonly ICheckoutRepository _checkoutRepository;
|
||||
private readonly IContractRepository _contractRepository;
|
||||
private readonly IRollCallEmployeeRepository _rollCallEmployeeRepository;
|
||||
private readonly IRollCallEmployeeStatusRepository _rollCallEmployeeStatusRepository;
|
||||
|
||||
|
||||
public LeftWorkTempApplication(ILeftWorkTempRepository leftWorkTempRepository, ILeftWorkRepository leftWorkRepository, IWorkshopRepository workshopRepository, IEmployeeRepository employeeRepository, IJobRepository jobRepository, ICheckoutRepository checkoutRepository, IContractRepository contractRepository, IRollCallEmployeeStatusRepository rollCallEmployeeStatusRepository, IRollCallEmployeeRepository rollCallEmployeeRepository)
|
||||
{
|
||||
_leftWorkTempRepository = leftWorkTempRepository;
|
||||
_leftWorkRepository = leftWorkRepository;
|
||||
_workshopRepository = workshopRepository;
|
||||
_employeeRepository = employeeRepository;
|
||||
_jobRepository = jobRepository;
|
||||
_checkoutRepository = checkoutRepository;
|
||||
_contractRepository = contractRepository;
|
||||
public LeftWorkTempApplication(ILeftWorkTempRepository leftWorkTempRepository,
|
||||
ILeftWorkRepository leftWorkRepository, IWorkshopRepository workshopRepository,
|
||||
IEmployeeRepository employeeRepository, IJobRepository jobRepository, ICheckoutRepository checkoutRepository,
|
||||
IContractRepository contractRepository, IRollCallEmployeeStatusRepository rollCallEmployeeStatusRepository,
|
||||
IRollCallEmployeeRepository rollCallEmployeeRepository)
|
||||
{
|
||||
_leftWorkTempRepository = leftWorkTempRepository;
|
||||
_leftWorkRepository = leftWorkRepository;
|
||||
_workshopRepository = workshopRepository;
|
||||
_employeeRepository = employeeRepository;
|
||||
_jobRepository = jobRepository;
|
||||
_checkoutRepository = checkoutRepository;
|
||||
_contractRepository = contractRepository;
|
||||
_rollCallEmployeeStatusRepository = rollCallEmployeeStatusRepository;
|
||||
_rollCallEmployeeRepository = rollCallEmployeeRepository;
|
||||
}
|
||||
@@ -59,15 +63,16 @@ public class LeftWorkTempApplication : ILeftWorkTempApplication
|
||||
{
|
||||
#region Validation
|
||||
|
||||
if (_leftWorkTempRepository.Exists(x=>x.WorkshopId == command.WorkshopId && x.EmployeeId == employeeId))
|
||||
if (_leftWorkTempRepository.Exists(x => x.WorkshopId == command.WorkshopId && x.EmployeeId == employeeId))
|
||||
{
|
||||
return op.Failed("برای پرسنل وارد شده قبلا درخواست ترک کار ثبت کرده اید");
|
||||
return op.Failed("برای پرسنل وارد شده قبلا درخواست ترک کار ثبت کرده اید");
|
||||
}
|
||||
|
||||
if (command.LeftWorkTime.TryToGeorgianDateTime(out var leftWorkDateGr) == false)
|
||||
{
|
||||
return op.Failed("تاریخ شروع به کار وارد شده نامعتبر است");
|
||||
}
|
||||
|
||||
if (command.LastDayStanding.TryToGeorgianDateTime(out var lastDayStandingDateGr) == false)
|
||||
{
|
||||
return op.Failed("تاریخ شروع به کار وارد شده نامعتبر است");
|
||||
@@ -101,7 +106,6 @@ public class LeftWorkTempApplication : ILeftWorkTempApplication
|
||||
}
|
||||
|
||||
|
||||
|
||||
//if (leftWork.StartWorkDate >= leftWorkDateGr)
|
||||
//{
|
||||
// return op.Failed("ترک کار نمیتواند کوچک تر یا مساوی شروع به کار باشد");
|
||||
@@ -121,10 +125,10 @@ public class LeftWorkTempApplication : ILeftWorkTempApplication
|
||||
// return op.Failed("این پرسنل در تاریخ ترک کار وارد شده دارای قرارداد میباشد");
|
||||
//}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
var leftWorkTemp = LeftWorkTemp.CreateLeftWork(leftWork.id, leftWork.StartWorkDate, leftWorkDateGr, lastDayStandingDateGr,
|
||||
var leftWorkTemp = LeftWorkTemp.CreateLeftWork(leftWork.id, leftWork.StartWorkDate, leftWorkDateGr,
|
||||
lastDayStandingDateGr,
|
||||
command.WorkshopId, employeeId, leftWork.JobId);
|
||||
|
||||
await _leftWorkTempRepository.CreateAsync(leftWorkTemp);
|
||||
@@ -135,61 +139,63 @@ public class LeftWorkTempApplication : ILeftWorkTempApplication
|
||||
}
|
||||
|
||||
public Task<GetStartWorkTempDetails> GetStartAndLeftWorkDetails(long employeeId, long workshopId)
|
||||
{
|
||||
return _leftWorkTempRepository.GetStartAndLeftWorkDetails(employeeId, workshopId);
|
||||
}
|
||||
{
|
||||
return _leftWorkTempRepository.GetStartAndLeftWorkDetails(employeeId, workshopId);
|
||||
}
|
||||
|
||||
public async Task<OperationResult> AcceptStartWork(AcceptStartWorkTemp command)
|
||||
{
|
||||
var op = new OperationResult();
|
||||
if (command.StartDateTime.TryToGeorgianDateTime(out var startDateGr) == false)
|
||||
{
|
||||
return op.Failed("تاریخ شروع به کار وارد شده نامعتبر است");
|
||||
}
|
||||
public async Task<OperationResult> AcceptStartWork(AcceptStartWorkTemp command)
|
||||
{
|
||||
var op = new OperationResult();
|
||||
if (command.StartDateTime.TryToGeorgianDateTime(out var startDateGr) == false)
|
||||
{
|
||||
return op.Failed("تاریخ شروع به کار وارد شده نامعتبر است");
|
||||
}
|
||||
|
||||
var leftWorkTemp = _leftWorkTempRepository.Get(command.LeftWorkTempId);
|
||||
var leftWorkTemp = _leftWorkTempRepository.Get(command.LeftWorkTempId);
|
||||
|
||||
if (leftWorkTemp.LeftWorkType != LeftWorkTempType.StartWork)
|
||||
{
|
||||
return op.Failed("اطلاعات وارد شده نامعتبر است");
|
||||
}
|
||||
if (leftWorkTemp.LeftWorkType != LeftWorkTempType.StartWork)
|
||||
{
|
||||
return op.Failed("اطلاعات وارد شده نامعتبر است");
|
||||
}
|
||||
|
||||
if (_leftWorkRepository.Exists(x => x.WorkshopId == leftWorkTemp.WorkshopId && x.EmployeeId == leftWorkTemp.EmployeeId && x.LeftWorkDate >= startDateGr))
|
||||
{
|
||||
return op.Failed("شروع به کار وارد شده با ترک کار های قبلی تداخل دارد");
|
||||
}
|
||||
if (_leftWorkRepository.Exists(x =>
|
||||
x.WorkshopId == leftWorkTemp.WorkshopId && x.EmployeeId == leftWorkTemp.EmployeeId &&
|
||||
x.LeftWorkDate >= startDateGr))
|
||||
{
|
||||
return op.Failed("شروع به کار وارد شده با ترک کار های قبلی تداخل دارد");
|
||||
}
|
||||
|
||||
|
||||
if (_jobRepository.Exists(x => x.id == command.JobId) == false)
|
||||
{
|
||||
return op.Failed("سمت وارد شده نامعتبر است");
|
||||
}
|
||||
if (_jobRepository.Exists(x => x.id == command.JobId) == false)
|
||||
{
|
||||
return op.Failed("سمت وارد شده نامعتبر است");
|
||||
}
|
||||
|
||||
var defaultTime = new DateTime(2121, 03, 21);
|
||||
var defaultTime = new DateTime(2121, 03, 21);
|
||||
|
||||
var workshop = _workshopRepository.Get(leftWorkTemp.WorkshopId);
|
||||
var employee = _employeeRepository.Get(leftWorkTemp.EmployeeId);
|
||||
var workshop = _workshopRepository.Get(leftWorkTemp.WorkshopId);
|
||||
var employee = _employeeRepository.Get(leftWorkTemp.EmployeeId);
|
||||
|
||||
var newLeftWork = new LeftWork(defaultTime, startDateGr, leftWorkTemp.WorkshopId, leftWorkTemp.EmployeeId,
|
||||
employee.FullName, workshop.WorkshopFullName, command.JobId, false, false, false, false, "", "");
|
||||
var newLeftWork = new LeftWork(defaultTime, startDateGr, leftWorkTemp.WorkshopId, leftWorkTemp.EmployeeId,
|
||||
employee.FullName, workshop.WorkshopFullName, command.JobId, false, false, false, false, "", "");
|
||||
|
||||
await _leftWorkRepository.CreateAsync(newLeftWork);
|
||||
_leftWorkTempRepository.Remove(leftWorkTemp);
|
||||
var rollCallEmployee = _rollCallEmployeeRepository.GetBy(leftWorkTemp.EmployeeId, leftWorkTemp.WorkshopId);
|
||||
await _leftWorkRepository.CreateAsync(newLeftWork);
|
||||
_leftWorkTempRepository.Remove(leftWorkTemp);
|
||||
var rollCallEmployee = _rollCallEmployeeRepository.GetBy(leftWorkTemp.EmployeeId, leftWorkTemp.WorkshopId);
|
||||
|
||||
var rollCallStatus = rollCallEmployee?.EmployeesStatus.MaxBy(x => x.StartDate);
|
||||
var rollCallStatus = rollCallEmployee?.EmployeesStatus.MaxBy(x => x.StartDate);
|
||||
|
||||
if (rollCallStatus != null)
|
||||
{
|
||||
var startWork = newLeftWork.StartWorkDate;
|
||||
rollCallStatus.Edit(startWork, rollCallStatus.EndDate);
|
||||
if (rollCallStatus != null)
|
||||
{
|
||||
var startWork = newLeftWork.StartWorkDate;
|
||||
rollCallStatus.Edit(startWork, rollCallStatus.EndDate);
|
||||
}
|
||||
|
||||
}
|
||||
await _leftWorkRepository.SaveChangesAsync();
|
||||
await _leftWorkTempRepository.SaveChangesAsync();
|
||||
await _leftWorkRepository.SaveChangesAsync();
|
||||
await _leftWorkTempRepository.SaveChangesAsync();
|
||||
|
||||
return op.Succcedded();
|
||||
}
|
||||
return op.Succcedded();
|
||||
}
|
||||
|
||||
public async Task<OperationResult> AcceptLeftWork(AcceptLeftWorkTemp command)
|
||||
{
|
||||
@@ -237,9 +243,12 @@ public class LeftWorkTempApplication : ILeftWorkTempApplication
|
||||
x.WorkshopId == leftWorkTemp.WorkshopId &&
|
||||
x.ContractStart <= lastDayStandingGr && x.ContractEnd >= lastDayStandingGr))
|
||||
{
|
||||
return op.Failed("این پرسنل در تاریخ ترک کار وارد شده دارای فیش حقوقی میباشد. ابتدا فیش حقوقی پرسنل را حذف کنید ");
|
||||
return op.Failed(
|
||||
"این پرسنل در تاریخ ترک کار وارد شده دارای فیش حقوقی میباشد. ابتدا فیش حقوقی پرسنل را حذف کنید ");
|
||||
}
|
||||
|
||||
var transaction = await _rollCallEmployeeStatusRepository.BeginTransactionAsync();
|
||||
|
||||
leftWork.Edit(leftWorkDateGr, leftWork.StartWorkDate, leftWork.WorkshopId, leftWork.EmployeeId, leftWork.JobId,
|
||||
leftWork.IncludeStatus, leftWork.AddBonusesPay, leftWork.AddYearsPay, leftWork.AddLeavePay);
|
||||
|
||||
@@ -247,8 +256,9 @@ public class LeftWorkTempApplication : ILeftWorkTempApplication
|
||||
await _leftWorkRepository.SaveChangesAsync();
|
||||
await _leftWorkTempRepository.SaveChangesAsync();
|
||||
|
||||
IfEmployeeHasNewLeftWorkDateAddEndDateToRollCallStatus(leftWork.EmployeeId);
|
||||
IfEmployeeHasNewLeftWorkDateAddEndDateToRollCallStatus(leftWork.EmployeeId, leftWork.WorkshopId);
|
||||
|
||||
await transaction.CommitAsync();
|
||||
return op.Succcedded();
|
||||
}
|
||||
|
||||
@@ -259,45 +269,59 @@ public class LeftWorkTempApplication : ILeftWorkTempApplication
|
||||
|
||||
public List<LeftWorkTempViewModel> GetLeftWorksByWorkshopId(long workshopId)
|
||||
{
|
||||
return _leftWorkTempRepository.GetLeftWorksByWorkshopId(workshopId);
|
||||
|
||||
return _leftWorkTempRepository.GetLeftWorksByWorkshopId(workshopId);
|
||||
}
|
||||
|
||||
//این متد ترک کار های کارمند را با فعالیت حضور غیاب یکپارچه می کند
|
||||
private void IfEmployeeHasNewLeftWorkDateAddEndDateToRollCallStatus(long employeeId)
|
||||
private void IfEmployeeHasNewLeftWorkDateAddEndDateToRollCallStatus(long employeeId, long workshopId)
|
||||
{
|
||||
//get last leftworks for employee in all workshops
|
||||
var leftWorks = _leftWorkRepository.search(new LeftWorkSearchModel() { EmployeeId = employeeId }).GroupBy(x => x.WorkshopId).Select(x =>
|
||||
{
|
||||
var leftWork = x.MaxBy(y => y.StartWorkDateGr);
|
||||
return new LeftWorkViewModel()
|
||||
var leftWorks = _leftWorkRepository.search(new LeftWorkSearchModel()
|
||||
{ EmployeeId = employeeId, WorkshopId = workshopId })
|
||||
.Select(x => new LeftWorkViewModel()
|
||||
{
|
||||
EmployeeId = employeeId,
|
||||
WorkshopId = x.Key,
|
||||
LeftWorkDateGr = leftWork.LeftWorkDateGr.Date.AddDays(-1),
|
||||
StartWorkDateGr = leftWork.StartWorkDateGr
|
||||
};
|
||||
}).ToList();
|
||||
WorkshopId = x.WorkshopId,
|
||||
LeftWorkDateGr = x.LeftWorkDateGr.Date.AddDays(-1),
|
||||
StartWorkDateGr = x.StartWorkDateGr
|
||||
}).ToList();
|
||||
|
||||
var maxLeftWork = leftWorks.MaxBy(y => y.StartWorkDateGr);
|
||||
|
||||
|
||||
//get rollCallEmployee associated with those leftworks which have a higher end date than leftworkDate
|
||||
var rollCallsEmployee = _rollCallEmployeeRepository.GetByEmployeeIdWithStatuses(employeeId)
|
||||
.Where(x => leftWorks.Any(y => y.WorkshopId == x.WorkshopId)).ToList();
|
||||
var rollCallsEmployee = _rollCallEmployeeRepository.GetBy(employeeId, workshopId);
|
||||
|
||||
var joinedList = rollCallsEmployee.Join(leftWorks, x => x.WorkshopId, y => y.WorkshopId, (x, y) => new
|
||||
{
|
||||
x.WorkshopId,
|
||||
x.EmployeeId,
|
||||
y.LeftWorkDateGr,
|
||||
Status = x.Statuses.OrderByDescending(z => z.StartDate).FirstOrDefault(z => z.StartDateGr.Date < y.LeftWorkDateGr && z.EndDateGr.Date > y.LeftWorkDateGr)
|
||||
});
|
||||
// var joinedList = rollCallsEmployee.Join(leftWorks, x => x.WorkshopId, y => y.WorkshopId, (x, y) => new
|
||||
// {
|
||||
// x.WorkshopId,
|
||||
// x.EmployeeId,
|
||||
// y.LeftWorkDateGr,
|
||||
// Status = x.Statuses.OrderByDescending(z => z.StartDate).FirstOrDefault(z => z.StartDateGr.Date < y.LeftWorkDateGr && z.EndDateGr.Date > y.LeftWorkDateGr)
|
||||
// });
|
||||
|
||||
//shaping up the list to send as parameter to repository
|
||||
var newRollCallRecords = joinedList.Where(x => x.Status != null).Select(x => new AdjustRollCallEmployeesWithEmployeeLeftWork()
|
||||
|
||||
var status = rollCallsEmployee.EmployeesStatus.OrderByDescending(z => z.StartDate)
|
||||
.FirstOrDefault(rollCallEmployeeStatus => rollCallEmployeeStatus.StartDate.Date < maxLeftWork.LeftWorkDateGr
|
||||
&& rollCallEmployeeStatus.EndDate.Date >
|
||||
maxLeftWork.LeftWorkDateGr);
|
||||
|
||||
if (status != null)
|
||||
{
|
||||
LeaveDate = x.LeftWorkDateGr,
|
||||
RollCallStatusId = x.Status.Id
|
||||
}).ToList();
|
||||
if (newRollCallRecords.Count > 0)
|
||||
_rollCallEmployeeStatusRepository.AdjustRollCallStatusEndDates(newRollCallRecords);
|
||||
var adjust = new AdjustRollCallEmployeesWithEmployeeLeftWork()
|
||||
{
|
||||
LeaveDate = maxLeftWork.LeftWorkDateGr,
|
||||
RollCallStatusId = status.id
|
||||
};
|
||||
_rollCallEmployeeStatusRepository.AdjustRollCallStatusEndDates([adjust]);
|
||||
}
|
||||
|
||||
var rollCallEmployeeStatusList = rollCallsEmployee.EmployeesStatus
|
||||
.Where(x => x.StartDate >= maxLeftWork.LeftWorkDateGr).ToList();
|
||||
if (rollCallEmployeeStatusList.Any())
|
||||
{
|
||||
_rollCallEmployeeStatusRepository.RemoveRange(rollCallEmployeeStatusList);
|
||||
_rollCallEmployeeStatusRepository.SaveChanges();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -29,67 +29,67 @@ public class ReportApplication : IReportApplication
|
||||
return await _reportRepository.GetAllActiveWorkshopsNew(year, month);
|
||||
}
|
||||
|
||||
public WorkshopResult GetWorkshopContractDone(string year, string month, long accountId, List<long> workshopList)
|
||||
public async Task<WorkshopResult> GetWorkshopContractDone(string year, string month, long accountId, List<long> workshopList)
|
||||
{
|
||||
return _reportRepository.GetWorkshopContractDone(year, month, accountId, workshopList);
|
||||
return await _reportRepository.GetWorkshopContractDone(year, month, accountId, workshopList);
|
||||
}
|
||||
|
||||
public WorkshopResult GetWorkshopContractSignDone(string year, string month, long accountId, List<long> workshopList)
|
||||
public async Task<WorkshopResult> GetWorkshopContractSignDone(string year, string month, long accountId, List<long> workshopList)
|
||||
{
|
||||
return _reportRepository.GetWorkshopContractSignDone(year, month, accountId, workshopList);
|
||||
return await _reportRepository.GetWorkshopContractSignDone(year, month, accountId, workshopList);
|
||||
}
|
||||
|
||||
public WorkshopResult GetWorkshopCheckoutDone(string year, string month, long accountId, List<long> workshopList)
|
||||
public async Task<WorkshopResult> GetWorkshopCheckoutDone(string year, string month, long accountId, List<long> workshopList)
|
||||
{
|
||||
return _reportRepository.GetWorkshopCheckoutDone(year, month, accountId, workshopList);
|
||||
return await _reportRepository.GetWorkshopCheckoutDone(year, month, accountId, workshopList);
|
||||
}
|
||||
|
||||
public WorkshopResult GetWorkshopCheckoutSignDone(string year, string month, long accountId, List<long> workshopList)
|
||||
public async Task<WorkshopResult> GetWorkshopCheckoutSignDone(string year, string month, long accountId, List<long> workshopList)
|
||||
{
|
||||
return _reportRepository.GetWorkshopCheckoutSignDone(year, month, accountId, workshopList);
|
||||
return await _reportRepository.GetWorkshopCheckoutSignDone(year, month, accountId, workshopList);
|
||||
}
|
||||
|
||||
public List<EmployeeNotDone> GetEmployeeContract(string year, string month, long workshopId)
|
||||
public async Task<List<EmployeeNotDone>> GetEmployeeContract(string year, string month, long workshopId)
|
||||
{
|
||||
return _reportRepository.GetEmployeeContract(year, month, workshopId);
|
||||
return await _reportRepository.GetEmployeeContract(year, month, workshopId);
|
||||
}
|
||||
|
||||
public List<EmployeeNotDone> GetEmployeeContractSign(string year, string month, long workshopId)
|
||||
public async Task<List<EmployeeNotDone>> GetEmployeeContractSign(string year, string month, long workshopId)
|
||||
{
|
||||
return _reportRepository.GetEmployeeContractSign(year, month, workshopId);
|
||||
return await _reportRepository.GetEmployeeContractSign(year, month, workshopId);
|
||||
}
|
||||
|
||||
public List<EmployeeNotDone> GetEmployeeCheckout(string year, string month, long workshopId)
|
||||
public async Task<List<EmployeeNotDone>> GetEmployeeCheckout(string year, string month, long workshopId)
|
||||
{
|
||||
return _reportRepository.GetEmployeeCheckout(year, month, workshopId);
|
||||
return await _reportRepository.GetEmployeeCheckout(year, month, workshopId);
|
||||
}
|
||||
|
||||
public List<EmployeeNotDone> GetEmployeeCheckoutSign(string year, string month, long workshopId)
|
||||
public async Task<List<EmployeeNotDone>> GetEmployeeCheckoutSign(string year, string month, long workshopId)
|
||||
{
|
||||
return _reportRepository.GetEmployeeCheckoutSign(year, month, workshopId);
|
||||
return await _reportRepository.GetEmployeeCheckoutSign(year, month, workshopId);
|
||||
}
|
||||
|
||||
#region Print
|
||||
|
||||
public PrintAllContractCheckout GetPrintAllContractDone(string year, string month, long accountId,
|
||||
public async Task<PrintAllContractCheckout> GetPrintAllContractDone(string year, string month, long accountId,
|
||||
List<long> workshopList)
|
||||
{
|
||||
return _reportRepository.GetPrintAllContractDone(year, month, accountId, workshopList);
|
||||
return await _reportRepository.GetPrintAllContractDone(year, month, accountId, workshopList);
|
||||
}
|
||||
public PrintAllContractCheckout GetPrintAllContractSignDone(string year, string month, long accountId,
|
||||
public async Task<PrintAllContractCheckout> GetPrintAllContractSignDone(string year, string month, long accountId,
|
||||
List<long> workshopList)
|
||||
{
|
||||
return _reportRepository.GetPrintAllContractSignDone(year, month, accountId, workshopList);
|
||||
return await _reportRepository.GetPrintAllContractSignDone(year, month, accountId, workshopList);
|
||||
}
|
||||
public PrintAllContractCheckout GetPrintAllCheckoutDone(string year, string month, long accountId,
|
||||
public async Task<PrintAllContractCheckout> GetPrintAllCheckoutDone(string year, string month, long accountId,
|
||||
List<long> workshopList)
|
||||
{
|
||||
return _reportRepository.GetPrintAllCheckoutDone(year, month, accountId, workshopList);
|
||||
return await _reportRepository.GetPrintAllCheckoutDone(year, month, accountId, workshopList);
|
||||
}
|
||||
public PrintAllContractCheckout GetPrintAllCheckoutSignDone(string year, string month, long accountId,
|
||||
public async Task<PrintAllContractCheckout> GetPrintAllCheckoutSignDone(string year, string month, long accountId,
|
||||
List<long> workshopList)
|
||||
{
|
||||
return _reportRepository.GetPrintAllCheckoutSignDone(year, month, accountId, workshopList);
|
||||
return await _reportRepository.GetPrintAllCheckoutSignDone(year, month, accountId, workshopList);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -674,7 +674,7 @@ public class TemporaryClientRegistrationApplication : ITemporaryClientRegistrati
|
||||
result.MonthlyValueAddedTaxStr= tenPercent.ToMoney();
|
||||
var monthlyTotalPaymentDouble = sumOfWorkshopsPaymentDouble + tenPercent;
|
||||
result.MonthlyTotalPaymentStr = monthlyTotalPaymentDouble.ToMoney();
|
||||
var installmentList = InstitutionContractRepository.InstitutionMonthlyInstallmentCaculation(duration, monthlyTotalPaymentDouble, installmentstart);
|
||||
var installmentList = InstitutionContractRepository.InstitutionMonthlyInstallmentCaculation((int)duration, monthlyTotalPaymentDouble, installmentstart);
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -1048,7 +1048,7 @@ public class WorkshopAppliction : IWorkshopApplication
|
||||
|
||||
var institutionContract =
|
||||
await _institutionContractRepository.GetIncludeWorkshopDetailsAsync(contractWorkshopInitial
|
||||
.InstitutionContractId);
|
||||
.WorkshopGroup.InstitutionContractId);
|
||||
if (institutionContract == null)
|
||||
{
|
||||
return operation.Failed("قرارداد مالی موسسه یافت نشد");
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using Company.Domain.AdminMonthlyOverviewAgg;
|
||||
using Company.Domain.AndroidApkVersionAgg;
|
||||
using Company.Domain.AuthorizedBankDetailsAgg;
|
||||
using Company.Domain.BankAgg;
|
||||
using Company.Domain.BillAgg;
|
||||
using Company.Domain.Board;
|
||||
@@ -201,6 +202,9 @@ public class CompanyContext : DbContext
|
||||
|
||||
public DbSet<InstitutionContractContactInfoTemp> InstitutionContractContactInfoTemps { get; set; }
|
||||
|
||||
public DbSet<AuthorizedBankDetails> AuthorizedBankDetails { get; set; }
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region Pooya
|
||||
@@ -226,6 +230,8 @@ public class CompanyContext : DbContext
|
||||
|
||||
#endregion
|
||||
|
||||
public DbSet<CheckoutWarningMessage> CheckoutWarningMessages { get; set; }
|
||||
|
||||
public DbSet<CustomizeCheckout> CustomizeCheckouts { get; set; }
|
||||
public DbSet<CustomizeCheckoutTemp> CustomizeCheckoutTemps { get; set; }
|
||||
public DbSet<TaxLeftWorkItem> TaxLeftWorkItems { get; set; }
|
||||
@@ -309,7 +315,6 @@ public class CompanyContext : DbContext
|
||||
|
||||
public DbSet<Employer> Employers { get; set; }
|
||||
|
||||
|
||||
public CompanyContext(DbContextOptions<CompanyContext> options) :base(options)
|
||||
{
|
||||
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
using Company.Domain.AuthorizedBankDetailsAgg;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace CompanyManagment.EFCore.Mapping
|
||||
{
|
||||
public class AuthorizedBankDetailsMapping : IEntityTypeConfiguration<AuthorizedBankDetails>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<AuthorizedBankDetails> builder)
|
||||
{
|
||||
builder.ToTable("AuthorizedBankDetails");
|
||||
builder.HasKey(x => x.id);
|
||||
|
||||
builder.Property(x => x.CardNumber).HasMaxLength(50);
|
||||
builder.Property(x => x.AccountNumber).HasMaxLength(50);
|
||||
builder.Property(x => x.IBan).HasMaxLength(50);
|
||||
builder.Property(x => x.BankName).HasMaxLength(100);
|
||||
|
||||
// Configure owners as owned entities (value objects)
|
||||
builder.OwnsMany(x => x.OwnersList, ownersBuilder =>
|
||||
{
|
||||
ownersBuilder.ToTable("AuthorizedBankDetailsOwners");
|
||||
ownersBuilder.WithOwner().HasForeignKey("AuthorizedBankDetailsId");
|
||||
ownersBuilder.Property<int>("Id").ValueGeneratedOnAdd();
|
||||
ownersBuilder.HasKey("Id");
|
||||
|
||||
ownersBuilder.Property(x => x.FName).HasMaxLength(100);
|
||||
ownersBuilder.Property(x => x.LName).HasMaxLength(100);
|
||||
ownersBuilder.Property(x => x.NationalIdentifier).HasMaxLength(20);
|
||||
ownersBuilder.Property(x => x.CustomerType).HasMaxLength(50);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -50,12 +50,18 @@ class CheckoutMapping : IEntityTypeConfiguration<Checkout>
|
||||
builder.Property(x => x.TotalDayOfLeaveCompute).HasMaxLength(10);
|
||||
builder.Property(x => x.TotalDayOfYearsCompute).HasMaxLength(10);
|
||||
builder.Property(x => x.TotalDayOfBunosesCompute).HasMaxLength(10);
|
||||
|
||||
|
||||
builder.Property(x => x.EmployeeMandatoryHours).HasTimeSpanConversion();
|
||||
builder.HasOne(x => x.Workshop)
|
||||
.WithMany(x => x.Checkouts)
|
||||
.HasForeignKey(x => x.WorkshopId);
|
||||
|
||||
builder.HasMany(x => x.CheckoutWarningMessageList)
|
||||
.WithOne(x => x.Checkout)
|
||||
.HasForeignKey(x => x.CheckoutId);
|
||||
|
||||
|
||||
builder.OwnsMany(x => x.LoanInstallments, installments =>
|
||||
{
|
||||
installments.Property(x => x.AmountForMonth).HasMaxLength(25);
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
using System;
|
||||
using _0_Framework.Application.Enums;
|
||||
using Company.Domain.CheckoutAgg;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace CompanyManagment.EFCore.Mapping;
|
||||
|
||||
public class CheckoutWarningMessageMapping : IEntityTypeConfiguration<CheckoutWarningMessage>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<CheckoutWarningMessage> builder)
|
||||
{
|
||||
builder.ToTable("CheckoutWarningMessage");
|
||||
builder.HasKey(x => x.id);
|
||||
|
||||
builder.Property(x => x.WarningMessage).HasMaxLength(150);
|
||||
|
||||
builder.Property(x => x.TypeOfCheckoutWarning).HasConversion(
|
||||
v => v.ToString(),
|
||||
v => (TypeOfCheckoutWarning)Enum.Parse(typeof(TypeOfCheckoutWarning), v)).HasMaxLength(30);
|
||||
|
||||
builder.HasOne(x => x.Checkout)
|
||||
.WithMany(x => x.CheckoutWarningMessageList)
|
||||
.HasForeignKey(x => x.CheckoutId);
|
||||
}
|
||||
}
|
||||
@@ -12,6 +12,10 @@ public class InstitutionContractAmendmentMapping:IEntityTypeConfiguration<Instit
|
||||
builder.HasKey(x => x.id);
|
||||
|
||||
builder.Property(x => x.VerifyCode).HasMaxLength(10);
|
||||
builder.Property(x => x.VerifierFullName).HasMaxLength(100);
|
||||
builder.Property(x => x.VerifierPhoneNumber).HasMaxLength(20);
|
||||
|
||||
builder.Property(x=>x.VerificationStatus).HasConversion<string>().HasMaxLength(50);
|
||||
|
||||
builder.HasOne(x => x.InstitutionContract)
|
||||
.WithMany(x => x.Amendments)
|
||||
|
||||
@@ -30,6 +30,8 @@ public class InstitutionContractMapping : IEntityTypeConfiguration<InstitutionCo
|
||||
builder.Property(x => x.HasValueAddedTax).HasMaxLength(10);
|
||||
|
||||
builder.Property(x => x.VerifyCode).HasMaxLength(20);
|
||||
builder.Property(x => x.VerifierFullName).HasMaxLength(100);
|
||||
builder.Property(x => x.VerifierPhoneNumber).HasMaxLength(20);
|
||||
|
||||
builder.Property(x => x.VerificationStatus).HasConversion<string>().HasMaxLength(122);
|
||||
|
||||
|
||||
10971
CompanyManagment.EFCore/Migrations/20251014082438_add authenticate columns to employer.Designer.cs
generated
Normal file
10971
CompanyManagment.EFCore/Migrations/20251014082438_add authenticate columns to employer.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,49 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace CompanyManagment.EFCore.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class addauthenticatecolumnstoemployer : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "IdNumberSeri",
|
||||
table: "Employers",
|
||||
type: "nvarchar(max)",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "IdNumberSerial",
|
||||
table: "Employers",
|
||||
type: "nvarchar(max)",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<bool>(
|
||||
name: "IsAuth",
|
||||
table: "Employers",
|
||||
type: "bit",
|
||||
nullable: false,
|
||||
defaultValue: false);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "IdNumberSeri",
|
||||
table: "Employers");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "IdNumberSerial",
|
||||
table: "Employers");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "IsAuth",
|
||||
table: "Employers");
|
||||
}
|
||||
}
|
||||
}
|
||||
11048
CompanyManagment.EFCore/Migrations/20251019092906_add authorized bank details.Designer.cs
generated
Normal file
11048
CompanyManagment.EFCore/Migrations/20251019092906_add authorized bank details.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,68 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace CompanyManagment.EFCore.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class addauthorizedbankdetails : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "AuthorizedBankDetails",
|
||||
columns: table => new
|
||||
{
|
||||
id = table.Column<long>(type: "bigint", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
CardNumber = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
|
||||
AccountNumber = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
|
||||
IBan = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
|
||||
BankName = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
|
||||
CreationDate = table.Column<DateTime>(type: "datetime2", nullable: false)
|
||||
},
|
||||
constraints: table => { table.PrimaryKey("PK_AuthorizedBankDetails", x => x.id); });
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "AuthorizedBankDetailsOwners",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
FName = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
|
||||
LName = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
|
||||
NationalIdentifier = table.Column<string>(type: "nvarchar(20)", maxLength: 20, nullable: true),
|
||||
CustomerType = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
|
||||
AuthorizedBankDetailsId = table.Column<long>(type: "bigint", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_AuthorizedBankDetailsOwners", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_AuthorizedBankDetailsOwners_AuthorizedBankDetails_AuthorizedBankDetailsId",
|
||||
column: x => x.AuthorizedBankDetailsId,
|
||||
principalTable: "AuthorizedBankDetails",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_AuthorizedBankDetailsOwners_AuthorizedBankDetailsId",
|
||||
table: "AuthorizedBankDetailsOwners",
|
||||
column: "AuthorizedBankDetailsId");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "AuthorizedBankDetailsOwners");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "AuthorizedBankDetails");
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,74 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace CompanyManagment.EFCore.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class AddVerifierdetailsininstituioncontractandamendment : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "VerifierFullName",
|
||||
table: "InstitutionContracts",
|
||||
type: "nvarchar(100)",
|
||||
maxLength: 100,
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "VerifierPhoneNumber",
|
||||
table: "InstitutionContracts",
|
||||
type: "nvarchar(20)",
|
||||
maxLength: 20,
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "VerifierFullName",
|
||||
table: "InstitutionContractAmendments",
|
||||
type: "nvarchar(100)",
|
||||
maxLength: 100,
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "VerifierPhoneNumber",
|
||||
table: "InstitutionContractAmendments",
|
||||
type: "nvarchar(20)",
|
||||
maxLength: 20,
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<DateTime>(
|
||||
name: "VerifyCodeCreation",
|
||||
table: "InstitutionContractAmendments",
|
||||
type: "datetime2",
|
||||
nullable: false,
|
||||
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "VerifierFullName",
|
||||
table: "InstitutionContracts");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "VerifierPhoneNumber",
|
||||
table: "InstitutionContracts");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "VerifierFullName",
|
||||
table: "InstitutionContractAmendments");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "VerifierPhoneNumber",
|
||||
table: "InstitutionContractAmendments");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "VerifyCodeCreation",
|
||||
table: "InstitutionContractAmendments");
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,83 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace CompanyManagment.EFCore.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class AddIsAmendmentininstitutioncontractWorkshopDetials : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.RenameColumn(
|
||||
name: "WorkshopDetailsId",
|
||||
table: "InstitutionContractAmendmentChange",
|
||||
newName: "CurrentWorkshopId");
|
||||
|
||||
migrationBuilder.AddColumn<bool>(
|
||||
name: "IsAmendment",
|
||||
table: "InstitutionContractWorkshopInitials",
|
||||
type: "bit",
|
||||
nullable: false,
|
||||
defaultValue: false);
|
||||
|
||||
migrationBuilder.AddColumn<bool>(
|
||||
name: "IsAmendment",
|
||||
table: "InstitutionContractWorkshopCurrents",
|
||||
type: "bit",
|
||||
nullable: false,
|
||||
defaultValue: false);
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "VerificationStatus",
|
||||
table: "InstitutionContractAmendments",
|
||||
type: "nvarchar(50)",
|
||||
maxLength: 50,
|
||||
nullable: false,
|
||||
defaultValue: "");
|
||||
|
||||
migrationBuilder.AddColumn<bool>(
|
||||
name: "HasRollCallInPerson",
|
||||
table: "InstitutionContractAmendmentChange",
|
||||
type: "bit",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "PersonnelCountDifference",
|
||||
table: "InstitutionContractAmendmentChange",
|
||||
type: "int",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "IsAmendment",
|
||||
table: "InstitutionContractWorkshopInitials");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "IsAmendment",
|
||||
table: "InstitutionContractWorkshopCurrents");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "VerificationStatus",
|
||||
table: "InstitutionContractAmendments");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "HasRollCallInPerson",
|
||||
table: "InstitutionContractAmendmentChange");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "PersonnelCountDifference",
|
||||
table: "InstitutionContractAmendmentChange");
|
||||
|
||||
migrationBuilder.RenameColumn(
|
||||
name: "CurrentWorkshopId",
|
||||
table: "InstitutionContractAmendmentChange",
|
||||
newName: "WorkshopDetailsId");
|
||||
}
|
||||
}
|
||||
}
|
||||
11070
CompanyManagment.EFCore/Migrations/20251027125514_hasInsuranceShareTheSameAsList_checkoutTable.Designer.cs
generated
Normal file
11070
CompanyManagment.EFCore/Migrations/20251027125514_hasInsuranceShareTheSameAsList_checkoutTable.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,29 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace CompanyManagment.EFCore.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class hasInsuranceShareTheSameAsList_checkoutTable : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<bool>(
|
||||
name: "HasInsuranceShareTheSameAsList",
|
||||
table: "Checkouts",
|
||||
type: "bit",
|
||||
nullable: false,
|
||||
defaultValue: false);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "HasInsuranceShareTheSameAsList",
|
||||
table: "Checkouts");
|
||||
}
|
||||
}
|
||||
}
|
||||
11116
CompanyManagment.EFCore/Migrations/20251028121828_CheckoutWarningMessage.Designer.cs
generated
Normal file
11116
CompanyManagment.EFCore/Migrations/20251028121828_CheckoutWarningMessage.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,58 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace CompanyManagment.EFCore.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class CheckoutWarningMessage : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<bool>(
|
||||
name: "IsUpdateNeeded",
|
||||
table: "Checkouts",
|
||||
type: "bit",
|
||||
nullable: false,
|
||||
defaultValue: false);
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "CheckoutWarningMessage",
|
||||
columns: table => new
|
||||
{
|
||||
id = table.Column<long>(type: "bigint", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
WarningMessage = table.Column<string>(type: "nvarchar(150)", maxLength: 150, nullable: true),
|
||||
CheckoutId = table.Column<long>(type: "bigint", nullable: false),
|
||||
TypeOfCheckoutWarning = table.Column<string>(type: "nvarchar(30)", maxLength: 30, nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_CheckoutWarningMessage", x => x.id);
|
||||
table.ForeignKey(
|
||||
name: "FK_CheckoutWarningMessage_Checkouts_CheckoutId",
|
||||
column: x => x.CheckoutId,
|
||||
principalTable: "Checkouts",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_CheckoutWarningMessage_CheckoutId",
|
||||
table: "CheckoutWarningMessage",
|
||||
column: "CheckoutId");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "CheckoutWarningMessage");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "IsUpdateNeeded",
|
||||
table: "Checkouts");
|
||||
}
|
||||
}
|
||||
}
|
||||
11085
CompanyManagment.EFCore/Migrations/20251106075529_institutioncontractAmendment law id.Designer.cs
generated
Normal file
11085
CompanyManagment.EFCore/Migrations/20251106075529_institutioncontractAmendment law id.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,22 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace CompanyManagment.EFCore.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class institutioncontractAmendmentlawid : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
11081
CompanyManagment.EFCore/Migrations/20251106075938_ignore law id.Designer.cs
generated
Normal file
11081
CompanyManagment.EFCore/Migrations/20251106075938_ignore law id.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,30 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace CompanyManagment.EFCore.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class ignorelawid : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<long>(
|
||||
name: "LawId",
|
||||
table: "InstitutionContractAmendments",
|
||||
type: "bigint",
|
||||
nullable: false,
|
||||
defaultValue: 0L);
|
||||
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "LawId",
|
||||
table: "InstitutionContractAmendments");
|
||||
}
|
||||
}
|
||||
}
|
||||
11084
CompanyManagment.EFCore/Migrations/20251106080435_lawId test.Designer.cs
generated
Normal file
11084
CompanyManagment.EFCore/Migrations/20251106080435_lawId test.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,20 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace CompanyManagment.EFCore.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class lawIdtest : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -90,6 +90,38 @@ namespace CompanyManagment.EFCore.Migrations
|
||||
b.ToTable("AndroidApkVersions", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Company.Domain.AuthorizedBankDetailsAgg.AuthorizedBankDetails", b =>
|
||||
{
|
||||
b.Property<long>("id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("id"));
|
||||
|
||||
b.Property<string>("AccountNumber")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("nvarchar(50)");
|
||||
|
||||
b.Property<string>("BankName")
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("nvarchar(100)");
|
||||
|
||||
b.Property<string>("CardNumber")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("nvarchar(50)");
|
||||
|
||||
b.Property<DateTime>("CreationDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("IBan")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("nvarchar(50)");
|
||||
|
||||
b.HasKey("id");
|
||||
|
||||
b.ToTable("AuthorizedBankDetails", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Company.Domain.AuthorizedPersonAgg.AuthorizedPerson", b =>
|
||||
{
|
||||
b.Property<long>("id")
|
||||
@@ -383,6 +415,9 @@ namespace CompanyManagment.EFCore.Migrations
|
||||
b.Property<bool>("HasAmountConflict")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<bool>("HasInsuranceShareTheSameAsList")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<bool>("HasRollCall")
|
||||
.HasColumnType("bit");
|
||||
|
||||
@@ -399,6 +434,9 @@ namespace CompanyManagment.EFCore.Migrations
|
||||
.HasMaxLength(10)
|
||||
.HasColumnType("nvarchar(10)");
|
||||
|
||||
b.Property<bool>("IsUpdateNeeded")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<bool>("LeaveCheckout")
|
||||
.HasColumnType("bit");
|
||||
|
||||
@@ -511,6 +549,33 @@ namespace CompanyManagment.EFCore.Migrations
|
||||
b.ToTable("Checkouts", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Company.Domain.CheckoutAgg.CheckoutWarningMessage", b =>
|
||||
{
|
||||
b.Property<long>("id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("id"));
|
||||
|
||||
b.Property<long>("CheckoutId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<string>("TypeOfCheckoutWarning")
|
||||
.IsRequired()
|
||||
.HasMaxLength(30)
|
||||
.HasColumnType("nvarchar(30)");
|
||||
|
||||
b.Property<string>("WarningMessage")
|
||||
.HasMaxLength(150)
|
||||
.HasColumnType("nvarchar(150)");
|
||||
|
||||
b.HasKey("id");
|
||||
|
||||
b.HasIndex("CheckoutId");
|
||||
|
||||
b.ToTable("CheckoutWarningMessage", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Company.Domain.ClassifiedSalaryAgg.ClassifiedSalary", b =>
|
||||
{
|
||||
b.Property<long>("id")
|
||||
@@ -3173,6 +3238,14 @@ namespace CompanyManagment.EFCore.Migrations
|
||||
.HasMaxLength(122)
|
||||
.HasColumnType("nvarchar(122)");
|
||||
|
||||
b.Property<string>("VerifierFullName")
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("nvarchar(100)");
|
||||
|
||||
b.Property<string>("VerifierPhoneNumber")
|
||||
.HasMaxLength(20)
|
||||
.HasColumnType("nvarchar(20)");
|
||||
|
||||
b.Property<string>("VerifyCode")
|
||||
.HasMaxLength(20)
|
||||
.HasColumnType("nvarchar(20)");
|
||||
@@ -3209,13 +3282,32 @@ namespace CompanyManagment.EFCore.Migrations
|
||||
b.Property<long>("InstitutionContractId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("LawId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<DateTime>("VerificationCreation")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("VerificationStatus")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("nvarchar(50)");
|
||||
|
||||
b.Property<string>("VerifierFullName")
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("nvarchar(100)");
|
||||
|
||||
b.Property<string>("VerifierPhoneNumber")
|
||||
.HasMaxLength(20)
|
||||
.HasColumnType("nvarchar(20)");
|
||||
|
||||
b.Property<string>("VerifyCode")
|
||||
.HasMaxLength(10)
|
||||
.HasColumnType("nvarchar(10)");
|
||||
|
||||
b.Property<DateTime>("VerifyCodeCreation")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.HasKey("id");
|
||||
|
||||
b.HasIndex("InstitutionContractId");
|
||||
@@ -3240,6 +3332,9 @@ namespace CompanyManagment.EFCore.Migrations
|
||||
b.Property<DateTime>("CreationDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<long?>("CurrentWorkshopId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<bool?>("HasContractPlan")
|
||||
.HasColumnType("bit");
|
||||
|
||||
@@ -3255,6 +3350,9 @@ namespace CompanyManagment.EFCore.Migrations
|
||||
b.Property<bool?>("HasInsurancePlanInPerson")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<bool?>("HasRollCallInPerson")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<bool?>("HasRollCallPlan")
|
||||
.HasColumnType("bit");
|
||||
|
||||
@@ -3264,8 +3362,8 @@ namespace CompanyManagment.EFCore.Migrations
|
||||
b.Property<int?>("PersonnelCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<long?>("WorkshopDetailsId")
|
||||
.HasColumnType("bigint");
|
||||
b.Property<int>("PersonnelCountDifference")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("id");
|
||||
|
||||
@@ -3332,6 +3430,9 @@ namespace CompanyManagment.EFCore.Migrations
|
||||
b.Property<long>("InstitutionContractWorkshopGroupId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<bool>("IsAmendment")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<int>("PersonnelCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
@@ -3397,6 +3498,9 @@ namespace CompanyManagment.EFCore.Migrations
|
||||
b.Property<long>("InstitutionContractWorkshopGroupId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<bool>("IsAmendment")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<int>("PersonnelCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
@@ -6779,9 +6883,18 @@ namespace CompanyManagment.EFCore.Migrations
|
||||
.HasMaxLength(20)
|
||||
.HasColumnType("nvarchar(20)");
|
||||
|
||||
b.Property<string>("IdNumberSeri")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("IdNumberSerial")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<bool>("IsActive")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<bool>("IsAuth")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<string>("IsLegal")
|
||||
.HasMaxLength(10)
|
||||
.HasColumnType("nvarchar(10)");
|
||||
@@ -6861,6 +6974,48 @@ namespace CompanyManagment.EFCore.Migrations
|
||||
b.ToTable("EmployerWorkshop");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Company.Domain.AuthorizedBankDetailsAgg.AuthorizedBankDetails", b =>
|
||||
{
|
||||
b.OwnsMany("Company.Domain.AuthorizedBankDetailsAgg.AuthorizedBankDetailsOwner", "OwnersList", b1 =>
|
||||
{
|
||||
b1.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b1.Property<int>("Id"));
|
||||
|
||||
b1.Property<long>("AuthorizedBankDetailsId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b1.Property<string>("CustomerType")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("nvarchar(50)");
|
||||
|
||||
b1.Property<string>("FName")
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("nvarchar(100)");
|
||||
|
||||
b1.Property<string>("LName")
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("nvarchar(100)");
|
||||
|
||||
b1.Property<string>("NationalIdentifier")
|
||||
.HasMaxLength(20)
|
||||
.HasColumnType("nvarchar(20)");
|
||||
|
||||
b1.HasKey("Id");
|
||||
|
||||
b1.HasIndex("AuthorizedBankDetailsId");
|
||||
|
||||
b1.ToTable("AuthorizedBankDetailsOwners", (string)null);
|
||||
|
||||
b1.WithOwner()
|
||||
.HasForeignKey("AuthorizedBankDetailsId");
|
||||
});
|
||||
|
||||
b.Navigation("OwnersList");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Company.Domain.Board.Board", b =>
|
||||
{
|
||||
b.HasOne("Company.Domain.BoardType.BoardType", "BoardType")
|
||||
@@ -7106,6 +7261,17 @@ namespace CompanyManagment.EFCore.Migrations
|
||||
b.Navigation("Workshop");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Company.Domain.CheckoutAgg.CheckoutWarningMessage", b =>
|
||||
{
|
||||
b.HasOne("Company.Domain.CheckoutAgg.Checkout", "Checkout")
|
||||
.WithMany("CheckoutWarningMessageList")
|
||||
.HasForeignKey("CheckoutId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Checkout");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Company.Domain.ClientEmployeeWorkshopAgg.ClientEmployeeWorkshop", b =>
|
||||
{
|
||||
b.HasOne("Company.Domain.EmployeeAgg.Employee", "Employee")
|
||||
@@ -10625,6 +10791,11 @@ namespace CompanyManagment.EFCore.Migrations
|
||||
b.Navigation("PetitionsList");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Company.Domain.CheckoutAgg.Checkout", b =>
|
||||
{
|
||||
b.Navigation("CheckoutWarningMessageList");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Company.Domain.ContarctingPartyAgg.PersonalContractingParty", b =>
|
||||
{
|
||||
b.Navigation("ContractingPartyBankAccounts");
|
||||
|
||||
@@ -0,0 +1,107 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using _0_Framework.Application;
|
||||
using _0_Framework_b.InfraStructure;
|
||||
using Company.Application.Contracts.AuthorizedBankDetails;
|
||||
using Company.Domain.AuthorizedBankDetailsAgg;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace CompanyManagment.EFCore.Repository
|
||||
{
|
||||
public class AuthorizedBankDetailsRepository : RepositoryBase<long, AuthorizedBankDetails>, IAuthorizedBankDetailsRepository
|
||||
{
|
||||
private readonly CompanyContext _context;
|
||||
|
||||
public AuthorizedBankDetailsRepository(CompanyContext context) : base(context)
|
||||
{
|
||||
_context = context;
|
||||
}
|
||||
|
||||
public EditAuthorizedBankDetails GetDetails(long id)
|
||||
{
|
||||
var authorizedBankDetails = _context.AuthorizedBankDetails
|
||||
.Include(x => x.OwnersList)
|
||||
.FirstOrDefault(x => x.id == id);
|
||||
|
||||
if (authorizedBankDetails == null)
|
||||
return new EditAuthorizedBankDetails();
|
||||
|
||||
var result = new EditAuthorizedBankDetails
|
||||
{
|
||||
Id = authorizedBankDetails.id,
|
||||
CardNumber = authorizedBankDetails.CardNumber,
|
||||
AccountNumber = authorizedBankDetails.AccountNumber,
|
||||
IBan = authorizedBankDetails.IBan,
|
||||
BankName = authorizedBankDetails.BankName,
|
||||
OwnersList = authorizedBankDetails.OwnersList.Select(o => new AuthorizedBankDetailsOwnerViewModel
|
||||
{
|
||||
FName = o.FName,
|
||||
LName = o.LName,
|
||||
NationalIdentifier = o.NationalIdentifier,
|
||||
CustomerType = o.CustomerType
|
||||
}).ToList()
|
||||
};
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public List<AuthorizedBankDetailsViewModel> Search(AuthorizedBankDetailsSearchModel searchModel)
|
||||
{
|
||||
var query = _context.AuthorizedBankDetails
|
||||
.Include(x => x.OwnersList)
|
||||
.Select(x => new AuthorizedBankDetailsViewModel
|
||||
{
|
||||
Id = x.id,
|
||||
CardNumber = x.CardNumber,
|
||||
AccountNumber = x.AccountNumber,
|
||||
IBan = x.IBan,
|
||||
});
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(searchModel.CardNumber))
|
||||
query = query.Where(x => x.CardNumber.Contains(searchModel.CardNumber));
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(searchModel.AccountNumber))
|
||||
query = query.Where(x => x.AccountNumber.Contains(searchModel.AccountNumber));
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(searchModel.IBan))
|
||||
query = query.Where(x => x.IBan.Contains(searchModel.IBan));
|
||||
|
||||
// if (!string.IsNullOrWhiteSpace(searchModel.BankName))
|
||||
// query = query.Where(x => x.BankName.Contains(searchModel.BankName));
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(searchModel.NationalIdentifier))
|
||||
query = query.Where(x =>
|
||||
_context.AuthorizedBankDetails
|
||||
.Include(a => a.OwnersList)
|
||||
.Any(a => a.id == x.Id &&
|
||||
a.OwnersList.Any(o => o.NationalIdentifier.Contains(searchModel.NationalIdentifier))));
|
||||
|
||||
return query.OrderByDescending(x => x.Id).ToList();
|
||||
}
|
||||
|
||||
public AuthorizedBankDetailsViewModel GetByIban(string iban)
|
||||
{
|
||||
return _context.AuthorizedBankDetails
|
||||
.Include(x => x.OwnersList)
|
||||
.Where(x => x.IBan == iban)
|
||||
.Select(x => new AuthorizedBankDetailsViewModel
|
||||
{
|
||||
Id = x.id,
|
||||
CardNumber = x.CardNumber,
|
||||
AccountNumber = x.AccountNumber,
|
||||
IBan = x.IBan,
|
||||
BankName = x.BankName,
|
||||
NationalIdentifier = x.OwnersList.FirstOrDefault().NationalIdentifier,
|
||||
Owners = x.OwnersList.Select(o=> new AuthorizedBankDetailsOwnerViewModel()
|
||||
{
|
||||
FName = o.FName,
|
||||
LName = o.LName,
|
||||
NationalIdentifier = o.NationalIdentifier,
|
||||
CustomerType = o.CustomerType
|
||||
}).ToList()
|
||||
})
|
||||
.FirstOrDefault();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -524,6 +524,8 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
||||
entity.SetLoanInstallment(command.LoanInstallments, command.InstallmentDeduction);
|
||||
entity.SetCheckoutRollCall(command.CheckoutRollCall);
|
||||
entity.SetEmployeeMandatoryHours(command.EmployeeMandatoryHours);
|
||||
if(command.HasInsuranceShareTheSameAsList)
|
||||
entity.SetInsuranceShare();
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
}
|
||||
@@ -1689,7 +1691,7 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
||||
return new List<CheckoutViewModel>();
|
||||
}
|
||||
#endregion
|
||||
var query = _context.CheckoutSet
|
||||
var query = _context.CheckoutSet.Include(w => w.CheckoutWarningMessageList)
|
||||
.AsSplitQuery().Select(x => new CheckoutViewModel()
|
||||
{
|
||||
Id = x.id,
|
||||
@@ -1724,7 +1726,14 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
||||
SalaryAidDateTimeFa = s.SalaryAidDateTimeFa,
|
||||
SalaryAidDateTimeGe = s.SalaryAidDateTime
|
||||
}).ToList(),
|
||||
HasAmountConflict = x.HasAmountConflict
|
||||
HasAmountConflict = x.HasAmountConflict,
|
||||
IsUpdateNeeded = x.IsUpdateNeeded,
|
||||
CheckoutWarningMessageList = x.CheckoutWarningMessageList.Select(wm => new CheckoutWarningMessageModel
|
||||
{
|
||||
WarningMessage = wm.WarningMessage,
|
||||
TypeOfCheckoutWarning = wm.TypeOfCheckoutWarning,
|
||||
|
||||
}).ToList()
|
||||
|
||||
}).Where(x => x.WorkshopId == searchModel.WorkshopId);
|
||||
if (searchModel.EmployeeId > 0)
|
||||
@@ -1992,7 +2001,7 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
||||
// );
|
||||
|
||||
var checkouts =
|
||||
_context.CheckoutSet.Where(x => workshopAcounts.Contains(x.WorkshopId))
|
||||
_context.CheckoutSet.Include(w=>w.CheckoutWarningMessageList).Where(x => workshopAcounts.Contains(x.WorkshopId))
|
||||
.Join(_context.Workshops.AsSplitQuery(),
|
||||
ch => ch.WorkshopId,
|
||||
workshop => workshop.id,
|
||||
@@ -2261,7 +2270,14 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
||||
CreationDate = x.ch.CreationDate,
|
||||
EmployerName = $"{x.workshopEmployer.Employer.FName} {x.workshopEmployer.Employer.LName}",
|
||||
IsBlockCantracingParty = x.contractingParty.IsBlock,
|
||||
HasSignCheckout = x.option != null ? x.option.SignCheckout : x.workshop.SignCheckout
|
||||
HasSignCheckout = x.option != null ? x.option.SignCheckout : x.workshop.SignCheckout,
|
||||
IsUpdateNeeded = x.ch.IsUpdateNeeded,
|
||||
CheckoutWarningMessageList = x.ch.CheckoutWarningMessageList.Select(wm=> new CheckoutWarningMessageModel
|
||||
{
|
||||
WarningMessage = wm.WarningMessage,
|
||||
TypeOfCheckoutWarning = wm.TypeOfCheckoutWarning,
|
||||
|
||||
}).ToList()
|
||||
|
||||
|
||||
}).OrderByDescending(x=>x.Id).Take(3000).ToList().DistinctBy(x => x.Id)
|
||||
@@ -2299,7 +2315,14 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
||||
CreationDate = x.ch.CreationDate,
|
||||
EmployerName = $"{x.workshopEmployer.Employer.FName} {x.workshopEmployer.Employer.LName}",
|
||||
IsBlockCantracingParty = x.contractingParty.IsBlock,
|
||||
HasSignCheckout = x.option != null ? x.option.SignCheckout : x.workshop.SignCheckout
|
||||
HasSignCheckout = x.option != null ? x.option.SignCheckout : x.workshop.SignCheckout,
|
||||
IsUpdateNeeded = x.ch.IsUpdateNeeded,
|
||||
CheckoutWarningMessageList = x.ch.CheckoutWarningMessageList.Select(wm => new CheckoutWarningMessageModel
|
||||
{
|
||||
WarningMessage = wm.WarningMessage,
|
||||
TypeOfCheckoutWarning = wm.TypeOfCheckoutWarning,
|
||||
|
||||
}).ToList()
|
||||
|
||||
}).OrderByDescending(x => x.Id)
|
||||
.GroupBy(x => x.Id)
|
||||
@@ -2365,7 +2388,14 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
||||
CreationDate = x.ch.CreationDate,
|
||||
EmployerName = $"{x.workshopEmployer.Employer.FName} {x.workshopEmployer.Employer.LName}",
|
||||
IsBlockCantracingParty = x.contractingParty.IsBlock,
|
||||
HasSignCheckout = x.option != null ? x.option.SignCheckout : x.workshop.SignCheckout
|
||||
HasSignCheckout = x.option != null ? x.option.SignCheckout : x.workshop.SignCheckout,
|
||||
IsUpdateNeeded = x.ch.IsUpdateNeeded,
|
||||
CheckoutWarningMessageList = x.ch.CheckoutWarningMessageList.Select(wm => new CheckoutWarningMessageModel
|
||||
{
|
||||
WarningMessage = wm.WarningMessage,
|
||||
TypeOfCheckoutWarning = wm.TypeOfCheckoutWarning,
|
||||
|
||||
}).ToList()
|
||||
|
||||
}).GroupBy(x => x.Id).Select(x => x.First()).ToList()
|
||||
.OrderByDescending(x => x.ContractStartGr).ToList();
|
||||
@@ -2398,7 +2428,14 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
||||
CreationDate = x.ch.CreationDate,
|
||||
EmployerName = $"{x.workshopEmployer.Employer.FName} {x.workshopEmployer.Employer.LName}",
|
||||
IsBlockCantracingParty = x.contractingParty.IsBlock,
|
||||
HasSignCheckout = x.option != null ? x.option.SignCheckout : x.workshop.SignCheckout
|
||||
HasSignCheckout = x.option != null ? x.option.SignCheckout : x.workshop.SignCheckout,
|
||||
IsUpdateNeeded = x.ch.IsUpdateNeeded,
|
||||
CheckoutWarningMessageList = x.ch.CheckoutWarningMessageList.Select(wm => new CheckoutWarningMessageModel
|
||||
{
|
||||
WarningMessage = wm.WarningMessage,
|
||||
TypeOfCheckoutWarning = wm.TypeOfCheckoutWarning,
|
||||
|
||||
}).ToList()
|
||||
|
||||
}).GroupBy(x => x.Id)
|
||||
.Select(x => x.First()).ToList()
|
||||
|
||||
@@ -19,39 +19,41 @@ using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace CompanyManagment.EFCore.Repository;
|
||||
|
||||
public class CustomizeWorkshopGroupSettingsRepository(CompanyContext companyContext, IRollCallEmployeeRepository _rollCallEmployeeRepository)
|
||||
public class CustomizeWorkshopGroupSettingsRepository(
|
||||
CompanyContext companyContext,
|
||||
IRollCallEmployeeRepository _rollCallEmployeeRepository)
|
||||
: RepositoryBase<long, CustomizeWorkshopGroupSettings>(companyContext),
|
||||
ICustomizeWorkshopGroupSettingsRepository
|
||||
{
|
||||
private readonly CompanyContext _companyContext = companyContext;
|
||||
private readonly IRollCallEmployeeRepository _rollCallEmployeeRepository = _rollCallEmployeeRepository;
|
||||
|
||||
public CustomizeWorkshopGroupSettings GetIncludeWorkshopSettings(long id)
|
||||
{
|
||||
|
||||
return _companyContext.CustomizeWorkshopGroupSettings.AsSplitQuery().Include(x => x.CustomizeWorkshopSettings)
|
||||
.FirstOrDefault(x => x.id == id);
|
||||
.FirstOrDefault(x => x.id == id);
|
||||
}
|
||||
|
||||
public CustomizeWorkshopGroupSettings GetWorkshopMainGroup(long workshopId)
|
||||
{
|
||||
return _companyContext.CustomizeWorkshopGroupSettings
|
||||
.Include(x=>x.CustomizeWorkshopSettings)
|
||||
.Include(x=> x.CustomizeWorkshopEmployeeSettingsCollection)
|
||||
.AsSplitQuery().FirstOrDefault(x => x.MainGroup && x.CustomizeWorkshopSettings.WorkshopId == workshopId);
|
||||
return _companyContext.CustomizeWorkshopGroupSettings
|
||||
.Include(x => x.CustomizeWorkshopSettings)
|
||||
.Include(x => x.CustomizeWorkshopEmployeeSettingsCollection)
|
||||
.AsSplitQuery().FirstOrDefault(x => x.MainGroup && x.CustomizeWorkshopSettings.WorkshopId == workshopId);
|
||||
}
|
||||
|
||||
public List<EmployeeViewModel> GetEmployeesWithoutGroup(long customizeWorkshopSettingId)
|
||||
{
|
||||
var workshopSettings = _companyContext.CustomizeWorkshopSettings.Find(customizeWorkshopSettingId);
|
||||
var workshopSettings = _companyContext.CustomizeWorkshopSettings.Find(customizeWorkshopSettingId);
|
||||
|
||||
if (workshopSettings == null)
|
||||
return new();
|
||||
|
||||
var existsEmployees = _companyContext.CustomizeWorkshopEmployeeSettings
|
||||
.AsSplitQuery().Include(x=>x.CustomizeWorkshopGroupSettings)
|
||||
.Where(x => x.WorkshopId == workshopSettings.WorkshopId && !x.CustomizeWorkshopGroupSettings.MainGroup)
|
||||
.Select(x=>x.EmployeeId).ToList();
|
||||
|
||||
.AsSplitQuery().Include(x => x.CustomizeWorkshopGroupSettings)
|
||||
.Where(x => x.WorkshopId == workshopSettings.WorkshopId && !x.CustomizeWorkshopGroupSettings.MainGroup)
|
||||
.Select(x => x.EmployeeId).ToList();
|
||||
|
||||
var workshopId = workshopSettings.WorkshopId;
|
||||
var rollCallEmployees = _rollCallEmployeeRepository.GetActivePersonnelByWorkshopId(workshopId);
|
||||
|
||||
@@ -81,79 +83,81 @@ public class CustomizeWorkshopGroupSettingsRepository(CompanyContext companyCont
|
||||
|
||||
var dateNow = DateTime.Now.Date;
|
||||
|
||||
//var existsEmployees = _companyContext.CustomizeWorkshopEmployeeSettings
|
||||
// .AsSplitQuery().Include(x => x.CustomizeWorkshopGroupSettings)
|
||||
// .Where(x => x.WorkshopId == workshopId && !x.CustomizeWorkshopGroupSettings.MainGroup)
|
||||
// .Select(x => x.EmployeeId).ToList();
|
||||
//var existsEmployees = _companyContext.CustomizeWorkshopEmployeeSettings
|
||||
// .AsSplitQuery().Include(x => x.CustomizeWorkshopGroupSettings)
|
||||
// .Where(x => x.WorkshopId == workshopId && !x.CustomizeWorkshopGroupSettings.MainGroup)
|
||||
// .Select(x => x.EmployeeId).ToList();
|
||||
|
||||
//var rollCallEmployees = _rollCallEmployeeRepository.GetActivePersonnelByWorkshopId(workshopId);
|
||||
//var rollCallEmployees = _rollCallEmployeeRepository.GetActivePersonnelByWorkshopId(workshopId);
|
||||
|
||||
//var employees = rollCallEmployees
|
||||
// .Where(x => !existsEmployees.Contains(x.EmployeeId))
|
||||
// .Select(x => new EmployeeViewModel()
|
||||
// {
|
||||
// EmployeeFullName = x.EmployeeFullName,
|
||||
// Id = x.EmployeeId
|
||||
// }).ToList();
|
||||
//var employees = rollCallEmployees
|
||||
// .Where(x => !existsEmployees.Contains(x.EmployeeId))
|
||||
// .Select(x => new EmployeeViewModel()
|
||||
// {
|
||||
// EmployeeFullName = x.EmployeeFullName,
|
||||
// Id = x.EmployeeId
|
||||
// }).ToList();
|
||||
|
||||
var employees = _companyContext.RollCallEmployees
|
||||
.Include(x =>
|
||||
x.EmployeesStatus)
|
||||
.Where(
|
||||
x =>
|
||||
x.WorkshopId == workshopId &&
|
||||
x.EmployeesStatus.Any(y => y.StartDate.Date <= dateNow && y.EndDate.Date > dateNow) &&
|
||||
x.HasUploadedImage == "true")
|
||||
.GroupJoin(_companyContext.CustomizeWorkshopEmployeeSettings
|
||||
.AsSplitQuery()
|
||||
.Include(x => x.CustomizeWorkshopGroupSettings)
|
||||
.Where(x => !x.CustomizeWorkshopGroupSettings.MainGroup && x.WorkshopId == workshopId), rollCallEmployee => rollCallEmployee.EmployeeId,
|
||||
cws => cws.EmployeeId,
|
||||
(rollCallEmployee, cws) => new { rollCallEmployee, cws })
|
||||
.SelectMany(x => x.cws.DefaultIfEmpty(), (x, cws) => new { x.rollCallEmployee, cws })
|
||||
.Where(x => x.cws == null).Select(x=> new EmployeeViewModel()
|
||||
{
|
||||
var employees = _companyContext.RollCallEmployees
|
||||
.Include(x =>
|
||||
x.EmployeesStatus)
|
||||
.Where(x =>
|
||||
x.WorkshopId == workshopId &&
|
||||
x.EmployeesStatus.Any(y => y.StartDate.Date <= dateNow && y.EndDate.Date > dateNow) &&
|
||||
x.HasUploadedImage == "true")
|
||||
.GroupJoin(_companyContext.CustomizeWorkshopEmployeeSettings
|
||||
.AsSplitQuery()
|
||||
.Include(x => x.CustomizeWorkshopGroupSettings)
|
||||
.Where(x => !x.CustomizeWorkshopGroupSettings.MainGroup && x.WorkshopId == workshopId),
|
||||
rollCallEmployee => rollCallEmployee.EmployeeId,
|
||||
cws => cws.EmployeeId,
|
||||
(rollCallEmployee, cws) => new { rollCallEmployee, cws })
|
||||
.SelectMany(x => x.cws.DefaultIfEmpty(), (x, cws) => new { x.rollCallEmployee, cws })
|
||||
.Where(x => x.cws == null).Select(x => new EmployeeViewModel()
|
||||
{
|
||||
EmployeeFullName = x.rollCallEmployee.EmployeeFullName,
|
||||
Id = x.rollCallEmployee.EmployeeId
|
||||
});
|
||||
});
|
||||
|
||||
return employees.ToList();
|
||||
return employees.ToList();
|
||||
}
|
||||
|
||||
public bool HasAnyEmployeeWithoutGroup(long workshopId)
|
||||
{
|
||||
var dateNow = DateTime.Now.Date;
|
||||
var dateNow = DateTime.Now.Date;
|
||||
var leftWork = _companyContext.LeftWorkList.Where(x =>
|
||||
x.WorkshopId == workshopId && x.StartWorkDate <= dateNow && x.LeftWorkDate >= dateNow);
|
||||
|
||||
var rollCallEmployeesWithoutCWS = _companyContext.RollCallEmployees
|
||||
.Include(x =>
|
||||
x.EmployeesStatus)
|
||||
.Where(
|
||||
x =>
|
||||
x.WorkshopId == workshopId &&
|
||||
x.EmployeesStatus.Any(y => y.StartDate.Date <= dateNow && y.EndDate.Date > dateNow) &&
|
||||
x.HasUploadedImage == "true"&&
|
||||
leftWork.Any(l => l.EmployeeId == x.EmployeeId && l.WorkshopId == x.WorkshopId))
|
||||
.GroupJoin(_companyContext.CustomizeWorkshopEmployeeSettings
|
||||
.AsSplitQuery()
|
||||
.Include(x => x.CustomizeWorkshopGroupSettings)
|
||||
.Where(x => !x.CustomizeWorkshopGroupSettings.MainGroup && x.WorkshopId == workshopId), rollCallEmployee => rollCallEmployee.EmployeeId,
|
||||
cws => cws.EmployeeId,
|
||||
(rollCallEmployee, cws) => new { rollCallEmployee, cws })
|
||||
.SelectMany(x => x.cws.DefaultIfEmpty(), (x, cws) => new { x.rollCallEmployee, cws })
|
||||
.Any(x => x.cws == null);
|
||||
|
||||
return rollCallEmployeesWithoutCWS;
|
||||
.Include(x =>
|
||||
x.EmployeesStatus)
|
||||
.Where(x =>
|
||||
x.WorkshopId == workshopId &&
|
||||
x.EmployeesStatus.Any(y => y.StartDate.Date <= dateNow && y.EndDate.Date > dateNow) &&
|
||||
x.HasUploadedImage == "true" &&
|
||||
leftWork.Any(l => l.EmployeeId == x.EmployeeId && l.WorkshopId == x.WorkshopId))
|
||||
.GroupJoin(_companyContext.CustomizeWorkshopEmployeeSettings
|
||||
.AsSplitQuery()
|
||||
.Include(x => x.CustomizeWorkshopGroupSettings)
|
||||
.Where(x => !x.CustomizeWorkshopGroupSettings.MainGroup && x.WorkshopId == workshopId),
|
||||
rollCallEmployee => rollCallEmployee.EmployeeId,
|
||||
cws => cws.EmployeeId,
|
||||
(rollCallEmployee, cws) => new { rollCallEmployee, cws })
|
||||
.SelectMany(x => x.cws.DefaultIfEmpty(), (x, cws) => new { x.rollCallEmployee, cws })
|
||||
.Any(x => x.cws == null);
|
||||
|
||||
return rollCallEmployeesWithoutCWS;
|
||||
}
|
||||
|
||||
public CustomizeWorkshopGroupSettings GetWithEmployees(long groupId)
|
||||
{
|
||||
return _companyContext.CustomizeWorkshopGroupSettings.AsSplitQuery().Include(x => x.CustomizeWorkshopEmployeeSettingsCollection)
|
||||
return _companyContext.CustomizeWorkshopGroupSettings.AsSplitQuery()
|
||||
.Include(x => x.CustomizeWorkshopEmployeeSettingsCollection)
|
||||
.FirstOrDefault(x => x.id == groupId);
|
||||
}
|
||||
|
||||
public List<CustomizeWorkshopEmployeeSettingsViewModel> GetShiftChangedEmployeeSettingsByGroupSettingsId(long groupSettingsId)
|
||||
public List<CustomizeWorkshopEmployeeSettingsViewModel> GetShiftChangedEmployeeSettingsByGroupSettingsId(
|
||||
long groupSettingsId)
|
||||
{
|
||||
var groupEmployeeSettingsList = _companyContext.CustomizeWorkshopGroupSettings
|
||||
.AsSplitQuery().Include(x => x.CustomizeWorkshopEmployeeSettingsCollection)
|
||||
@@ -169,23 +173,26 @@ public class CustomizeWorkshopGroupSettingsRepository(CompanyContext companyCont
|
||||
x.id
|
||||
}).ToList();
|
||||
|
||||
return groupEmployeeSettingsList.Join(employees, x => x.EmployeeId, y => y.id, (x, y) => new CustomizeWorkshopEmployeeSettingsViewModel()
|
||||
{
|
||||
EmployeeId = x.EmployeeId,
|
||||
Id = x.id,
|
||||
IsShiftChanged = x.IsShiftChanged,
|
||||
IsSettingChanged = x.IsSettingChanged,
|
||||
Name = y.FullName,
|
||||
RollCallWorkshopShifts = x.CustomizeWorkshopEmployeeSettingsShifts.Select(z => new CustomizeWorkshopShiftViewModel()
|
||||
return groupEmployeeSettingsList.Join(employees, x => x.EmployeeId, y => y.id, (x, y) =>
|
||||
new CustomizeWorkshopEmployeeSettingsViewModel()
|
||||
{
|
||||
EndTime = z.EndTime.ToString("HH:mm"),
|
||||
Placement = z.Placement,
|
||||
StartTime = z.StartTime.ToString("HH:mm")
|
||||
}).ToList()
|
||||
}).ToList();
|
||||
EmployeeId = x.EmployeeId,
|
||||
Id = x.id,
|
||||
IsShiftChanged = x.IsShiftChanged,
|
||||
IsSettingChanged = x.IsSettingChanged,
|
||||
Name = y.FullName,
|
||||
RollCallWorkshopShifts = x.CustomizeWorkshopEmployeeSettingsShifts.Select(z =>
|
||||
new CustomizeWorkshopShiftViewModel()
|
||||
{
|
||||
EndTime = z.EndTime.ToString("HH:mm"),
|
||||
Placement = z.Placement,
|
||||
StartTime = z.StartTime.ToString("HH:mm")
|
||||
}).ToList()
|
||||
}).ToList();
|
||||
}
|
||||
|
||||
public List<CustomizeWorkshopEmployeeSettingsViewModel> GetSettingChangedEmployeeSettingsByGroupSettingsId(long groupSettingsId)
|
||||
public List<CustomizeWorkshopEmployeeSettingsViewModel> GetSettingChangedEmployeeSettingsByGroupSettingsId(
|
||||
long groupSettingsId)
|
||||
{
|
||||
var groupEmployeeSettingsList = _companyContext.CustomizeWorkshopGroupSettings
|
||||
.AsSplitQuery().Include(x => x.CustomizeWorkshopEmployeeSettingsCollection)
|
||||
@@ -201,38 +208,52 @@ public class CustomizeWorkshopGroupSettingsRepository(CompanyContext companyCont
|
||||
x.id
|
||||
}).ToList();
|
||||
|
||||
return groupEmployeeSettingsList.Join(employees, x => x.EmployeeId, y => y.id, (x, y) => new CustomizeWorkshopEmployeeSettingsViewModel()
|
||||
{
|
||||
EmployeeId = x.EmployeeId,
|
||||
Id = x.id,
|
||||
IsSettingChanged = x.IsSettingChanged,
|
||||
IsShiftChanged = x.IsShiftChanged,
|
||||
Name = y.FullName,
|
||||
RollCallWorkshopShifts = x.CustomizeWorkshopEmployeeSettingsShifts.Select(z => new CustomizeWorkshopShiftViewModel()
|
||||
return groupEmployeeSettingsList.Join(employees, x => x.EmployeeId, y => y.id, (x, y) =>
|
||||
new CustomizeWorkshopEmployeeSettingsViewModel()
|
||||
{
|
||||
EndTime = z.EndTime.ToString("HH:mm"),
|
||||
Placement = z.Placement,
|
||||
StartTime = z.StartTime.ToString("HH:mm")
|
||||
}).ToList()
|
||||
}).ToList();
|
||||
EmployeeId = x.EmployeeId,
|
||||
Id = x.id,
|
||||
IsSettingChanged = x.IsSettingChanged,
|
||||
IsShiftChanged = x.IsShiftChanged,
|
||||
Name = y.FullName,
|
||||
RollCallWorkshopShifts = x.CustomizeWorkshopEmployeeSettingsShifts.Select(z =>
|
||||
new CustomizeWorkshopShiftViewModel()
|
||||
{
|
||||
EndTime = z.EndTime.ToString("HH:mm"),
|
||||
Placement = z.Placement,
|
||||
StartTime = z.StartTime.ToString("HH:mm")
|
||||
}).ToList()
|
||||
}).ToList();
|
||||
}
|
||||
|
||||
public List<CustomizeWorkshopEmployeeSettingsViewModel> GetEmployeeSettingsByGroupSettingsId(long groupSettingsId)
|
||||
{
|
||||
|
||||
var entity = _companyContext.CustomizeWorkshopGroupSettings.AsSplitQuery().Include(x=>x.CustomizeWorkshopEmployeeSettingsCollection)
|
||||
.FirstOrDefault(x => x.id == groupSettingsId);
|
||||
var entity = _companyContext.CustomizeWorkshopGroupSettings.AsSplitQuery()
|
||||
.Include(x => x.CustomizeWorkshopEmployeeSettingsCollection)
|
||||
.FirstOrDefault(x => x.id == groupSettingsId);
|
||||
|
||||
if (entity == null)
|
||||
return new();
|
||||
|
||||
var employees = entity.CustomizeWorkshopEmployeeSettingsCollection;
|
||||
if (employees.Count == 0)
|
||||
return [];
|
||||
|
||||
var workshopId = employees.FirstOrDefault()?.WorkshopId??0;
|
||||
|
||||
if (workshopId == 0)
|
||||
return [];
|
||||
|
||||
|
||||
var employeeIds = employees.Select(x => x.EmployeeId).ToList();
|
||||
|
||||
|
||||
var employeeIds = employees.Select(x => x.EmployeeId);
|
||||
var names = _companyContext.Employees.Where(x => employeeIds.Contains(x.id))
|
||||
.Select(x => new { x.id, x.FullName }).ToList();
|
||||
|
||||
|
||||
var names = _companyContext.Employees.Where(x => employeeIds.Contains(x.id)).Select(x => new { x.id, x.FullName }).ToList();
|
||||
var leftWork = _companyContext.LeftWorkList.Where(x =>
|
||||
x.WorkshopId == workshopId &&
|
||||
employeeIds.Contains(x.EmployeeId)).ToList();
|
||||
|
||||
var joinedList = employees.Join(names, x => x.EmployeeId, y => y.id, (x, y) =>
|
||||
new CustomizeWorkshopEmployeeSettingsViewModel
|
||||
@@ -243,82 +264,86 @@ public class CustomizeWorkshopGroupSettingsRepository(CompanyContext companyCont
|
||||
Salary = x.Salary,
|
||||
IsSettingChanged = x.IsSettingChanged,
|
||||
IsShiftChanged = x.IsShiftChanged,
|
||||
RollCallWorkshopShifts = x.CustomizeWorkshopEmployeeSettingsShifts.Select(z => new CustomizeWorkshopShiftViewModel()
|
||||
{
|
||||
EndTime = z.EndTime.ToString("HH:mm"),
|
||||
StartTime = z.StartTime.ToString("HH:mm"),
|
||||
Placement = z.Placement
|
||||
}).ToList(),
|
||||
RollCallWorkshopShifts = x.CustomizeWorkshopEmployeeSettingsShifts
|
||||
.Select(z => new CustomizeWorkshopShiftViewModel()
|
||||
{
|
||||
EndTime = z.EndTime.ToString("HH:mm"),
|
||||
StartTime = z.StartTime.ToString("HH:mm"),
|
||||
Placement = z.Placement
|
||||
}).ToList(),
|
||||
IrregularShift = x.IrregularShift,
|
||||
WorkshopShiftStatus = x.WorkshopShiftStatus,
|
||||
LeavePermittedDays = x.LeavePermittedDays,
|
||||
CustomizeRotatingShiftsViewModels = x.CustomizeRotatingShifts
|
||||
.Select(r=> new CustomizeRotatingShiftsViewModel(){StartTime = r.StartTime.ToString("HH:mm") , EndTime =r.EndTime.ToString("HH:mm") }).ToList()
|
||||
|
||||
.Select(r => new CustomizeRotatingShiftsViewModel
|
||||
{
|
||||
StartTime = r.StartTime.ToString("HH:mm"),
|
||||
EndTime = r.EndTime.ToString("HH:mm")
|
||||
}).ToList(),
|
||||
HasLeft = leftWork.OrderByDescending(l=>l.StartWorkDate).FirstOrDefault(l => x.EmployeeId == l.EmployeeId)?.HasLeft ?? false
|
||||
});
|
||||
return joinedList.ToList();
|
||||
return joinedList.OrderBy(x=>x.HasLeft).ToList();
|
||||
}
|
||||
|
||||
public EditCustomizeWorkshopGroupSettings GetCustomizeWorkshopGroupSettingsDetails(long groupId)
|
||||
{
|
||||
|
||||
var entity = _companyContext.CustomizeWorkshopGroupSettings.AsSplitQuery().FirstOrDefault(x => x.id == groupId);
|
||||
return new EditCustomizeWorkshopGroupSettings()
|
||||
{
|
||||
//FridayWork = entity.FridayWork,
|
||||
FridayPay = new (){ FridayPayType = entity.FridayPay.FridayPayType, Value = entity.FridayPay.Value },
|
||||
FridayPay = new() { FridayPayType = entity.FridayPay.FridayPayType, Value = entity.FridayPay.Value },
|
||||
LateToWork = new()
|
||||
{
|
||||
{
|
||||
LateToWorkTimeFinesVewModels = entity.LateToWork.LateToWorkTimeFines.Select(x =>
|
||||
new LateToWorkTimeFineVewModel() { FineMoney = x.FineMoney, Minute = x.Minute }).ToList(),
|
||||
Value = entity.LateToWork.Value, LateToWorkType = entity.LateToWork.LateToWorkType
|
||||
},
|
||||
HolidayWork = entity.HolidayWork,
|
||||
FineAbsenceDeduction = new()
|
||||
{
|
||||
{
|
||||
Value = entity.FineAbsenceDeduction.Value,
|
||||
FineAbsenceDayOfWeekViewModels = entity.FineAbsenceDeduction.FineAbsenceDayOfWeekCollection
|
||||
.Select(x => new FineAbsenceDayOfWeekViewModel() { DayOfWeek = x.DayOfWeek }).ToList(),
|
||||
FineAbsenceDeductionType = entity.FineAbsenceDeduction.FineAbsenceDeductionType
|
||||
},
|
||||
EarlyExit = new()
|
||||
{
|
||||
{
|
||||
EarlyExitTimeFinesViewModels = entity.EarlyExit.EarlyExitTimeFines.Select(x =>
|
||||
new EarlyExitTimeFineViewModel() { FineMoney = x.FineMoney, Minute = x.Minute }).ToList(),
|
||||
Value = entity.EarlyExit.Value, EarlyExitType = entity.EarlyExit.EarlyExitType
|
||||
},
|
||||
BonusesPay = new()
|
||||
{
|
||||
{
|
||||
Value = entity.BonusesPay.Value, BonusesPayType = entity.BonusesPay.BonusesPayType,
|
||||
PaymentType = entity.BonusesPay.PaymentType
|
||||
},
|
||||
ShiftPay = new()
|
||||
{
|
||||
{
|
||||
Value = entity.ShiftPay.Value, ShiftPayType = entity.ShiftPay.ShiftPayType,
|
||||
ShiftType = entity.ShiftPay.ShiftType
|
||||
},
|
||||
InsuranceDeduction = new()
|
||||
{
|
||||
{
|
||||
Value = entity.InsuranceDeduction.Value,
|
||||
InsuranceDeductionType = entity.InsuranceDeduction.InsuranceDeductionType
|
||||
},
|
||||
OverTimePay = new()
|
||||
{ OverTimePayType = entity.OverTimePay.OverTimePayType, Value = entity.OverTimePay.Value },
|
||||
{ OverTimePayType = entity.OverTimePay.OverTimePayType, Value = entity.OverTimePay.Value },
|
||||
BaseYearsPay = new()
|
||||
{
|
||||
{
|
||||
BaseYearsPayType = entity.BaseYearsPay.BaseYearsPayType,
|
||||
Value = entity.BaseYearsPay.Value
|
||||
},
|
||||
NightWorkPay = new()
|
||||
{ NightWorkingType = entity.NightWorkPay.NightWorkingType, Value = entity.NightWorkPay.Value },
|
||||
LeavePay =new() { Value = entity.LeavePay.Value, LeavePayType = entity.LeavePay.LeavePayType },
|
||||
{ NightWorkingType = entity.NightWorkPay.NightWorkingType, Value = entity.NightWorkPay.Value },
|
||||
LeavePay = new() { Value = entity.LeavePay.Value, LeavePayType = entity.LeavePay.LeavePayType },
|
||||
MarriedAllowance = new()
|
||||
{
|
||||
{
|
||||
Value = entity.MarriedAllowance.Value,
|
||||
MarriedAllowanceType = entity.MarriedAllowance.MarriedAllowanceType
|
||||
},
|
||||
FamilyAllowance = new()
|
||||
{
|
||||
{
|
||||
FamilyAllowanceType = entity.FamilyAllowance.FamilyAllowanceType,
|
||||
Value = entity.FamilyAllowance.Value
|
||||
},
|
||||
@@ -332,23 +357,27 @@ public class CustomizeWorkshopGroupSettingsRepository(CompanyContext companyCont
|
||||
IsShiftChanged = entity.IsShiftChange,
|
||||
ShiftViewModel = entity.CustomizeWorkshopGroupSettingsShifts.Select(x =>
|
||||
new CustomizeWorkshopShiftViewModel()
|
||||
{ EndTime = x.EndTime.ToString("HH:mm"), Placement = x.Placement, StartTime = x.StartTime.ToString("HH:mm") }).ToList(),
|
||||
{
|
||||
EndTime = x.EndTime.ToString("HH:mm"), Placement = x.Placement,
|
||||
StartTime = x.StartTime.ToString("HH:mm")
|
||||
}).ToList(),
|
||||
LeavePermittedDays = entity.LeavePermittedDays,
|
||||
CustomizeRotatingShiftsViewModels = entity.CustomizeRotatingShifts.Select(x=> new CustomizeRotatingShiftsViewModel()
|
||||
{
|
||||
EndTime = x.EndTime.ToString("HH:mm"),
|
||||
StartTime = x.StartTime.ToString("HH:mm")
|
||||
}).ToList(),
|
||||
OffDayOfWeeks = entity.WeeklyOffDays.Select(x=>x.DayOfWeek).ToList()
|
||||
CustomizeRotatingShiftsViewModels = entity.CustomizeRotatingShifts.Select(x =>
|
||||
new CustomizeRotatingShiftsViewModel()
|
||||
{
|
||||
EndTime = x.EndTime.ToString("HH:mm"),
|
||||
StartTime = x.StartTime.ToString("HH:mm")
|
||||
}).ToList(),
|
||||
OffDayOfWeeks = entity.WeeklyOffDays.Select(x => x.DayOfWeek).ToList()
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
public List<CustomizeWorkshopGroupSettings> GetAllGroupsIncludeEmployeeSettingsByWorkshopSettingsId(long workshopSettingsId)
|
||||
public List<CustomizeWorkshopGroupSettings> GetAllGroupsIncludeEmployeeSettingsByWorkshopSettingsId(
|
||||
long workshopSettingsId)
|
||||
{
|
||||
return _companyContext.CustomizeWorkshopGroupSettings
|
||||
.AsSplitQuery().Include(x => x.CustomizeWorkshopEmployeeSettingsCollection)
|
||||
.Where(x => x.CustomizeWorkshopSettingId == workshopSettingsId).ToList();
|
||||
return _companyContext.CustomizeWorkshopGroupSettings
|
||||
.AsSplitQuery().Include(x => x.CustomizeWorkshopEmployeeSettingsCollection)
|
||||
.Where(x => x.CustomizeWorkshopSettingId == workshopSettingsId).ToList();
|
||||
}
|
||||
|
||||
public void Remove(long groupId)
|
||||
@@ -360,7 +389,8 @@ public class CustomizeWorkshopGroupSettingsRepository(CompanyContext companyCont
|
||||
_companyContext.SaveChanges();
|
||||
}
|
||||
|
||||
public CustomizeWorkshopGroupSettingsViewModel GetEmployeesGroupSettingsByEmployeeId(long employeeId, long workshopId)
|
||||
public CustomizeWorkshopGroupSettingsViewModel GetEmployeesGroupSettingsByEmployeeId(long employeeId,
|
||||
long workshopId)
|
||||
{
|
||||
return _companyContext.CustomizeWorkshopGroupSettings
|
||||
.Include(x => x.CustomizeWorkshopEmployeeSettingsCollection)
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -10,6 +10,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using AccountManagement.Application.Contracts.SubAccount;
|
||||
using ZstdSharp.Unsafe;
|
||||
using static Microsoft.EntityFrameworkCore.DbLoggerCategory;
|
||||
|
||||
namespace CompanyManagment.EFCore.Repository;
|
||||
@@ -266,16 +267,26 @@ public class FinancialStatmentRepository : RepositoryBase<long, FinancialStatmen
|
||||
|
||||
public async Task<FinancialStatmentDetailsByContractingPartyViewModel> GetDetailsByContractingParty(long contractingPartyId,FinancialStatementSearchModel searchModel)
|
||||
{
|
||||
var contractingParty = await _context.PersonalContractingParties
|
||||
.FirstOrDefaultAsync(x=>x.id == contractingPartyId);
|
||||
|
||||
|
||||
if (contractingParty == null)
|
||||
throw new NotFoundException("طرف حساب یافت نشد");
|
||||
|
||||
var financialStatement = await _context.FinancialStatments
|
||||
.Include(x=>x.FinancialTransactionList)
|
||||
.FirstOrDefaultAsync(x=>x.ContractingPartyId == contractingPartyId);
|
||||
|
||||
|
||||
if (financialStatement == null)
|
||||
{
|
||||
throw new NotFoundException("وضعیت مالی مورد نظر یافت نشد");
|
||||
financialStatement = new FinancialStatment(contractingPartyId,contractingParty.FName+" "+contractingParty.LName);
|
||||
|
||||
await _context.AddAsync(financialStatement);
|
||||
await _context.SaveChangesAsync();
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool searched = false;
|
||||
#region Search
|
||||
|
||||
@@ -323,6 +334,71 @@ public class FinancialStatmentRepository : RepositoryBase<long, FinancialStatmen
|
||||
}
|
||||
#endregion
|
||||
double balance = 0;
|
||||
// var list = financialStatement.FinancialTransactionList.Select(t =>
|
||||
// {
|
||||
// if (!searched)
|
||||
// {
|
||||
// if (t.TypeOfTransaction == "debt")
|
||||
// {
|
||||
// balance += t.Deptor;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// balance -= t.Creditor;
|
||||
// }
|
||||
// }
|
||||
// return new FinancialTransactionDetailViewModel()
|
||||
// {
|
||||
// Id = t.id,
|
||||
// DateTimeGr = t.TdateGr,
|
||||
// DateFa = t.TdateGr.ToFarsi(),
|
||||
// TimeFa = $"{t.TdateGr:HH:mm}",
|
||||
// Description = t.DescriptionOption + " " + t.Description,
|
||||
// Debtor = t.Deptor,
|
||||
// Creditor = t.Creditor,
|
||||
// Balance = balance,
|
||||
// Type = t.TypeOfTransaction == "debt"
|
||||
// ? FinancialTransactionType.Debt
|
||||
// : FinancialTransactionType.Credit,
|
||||
// TypeStr = t.TypeOfTransaction == "debt" ? "ایجاد درآمد" : "دریافت درآمد"
|
||||
// };
|
||||
// }).OrderByDescending(t => t.DateTimeGr).ToList();
|
||||
|
||||
|
||||
var list = new List<FinancialTransactionDetailViewModel>();
|
||||
foreach (var financialTransaction in financialStatement.FinancialTransactionList.OrderBy(t=>t.TdateGr))
|
||||
{
|
||||
if (!searched)
|
||||
{
|
||||
if (financialTransaction.TypeOfTransaction == "debt")
|
||||
{
|
||||
balance += financialTransaction.Deptor;
|
||||
}
|
||||
else
|
||||
{
|
||||
balance -= financialTransaction.Creditor;
|
||||
}
|
||||
}
|
||||
var item = new FinancialTransactionDetailViewModel()
|
||||
{
|
||||
Id = financialTransaction.id,
|
||||
DateTimeGr = financialTransaction.TdateGr,
|
||||
DateFa = financialTransaction.TdateGr.ToFarsi(),
|
||||
TimeFa = $"{financialTransaction.TdateGr:HH:mm}",
|
||||
Description = financialTransaction.DescriptionOption + " " + financialTransaction.Description,
|
||||
Debtor = financialTransaction.Deptor,
|
||||
Creditor = financialTransaction.Creditor,
|
||||
Balance = balance,
|
||||
Type = financialTransaction.TypeOfTransaction == "debt"
|
||||
? FinancialTransactionType.Debt
|
||||
: FinancialTransactionType.Credit,
|
||||
TypeStr = financialTransaction.TypeOfTransaction == "debt" ? "ایجاد درآمد" : "دریافت درآمد"
|
||||
};
|
||||
list.Add(item);
|
||||
}
|
||||
|
||||
list.Reverse();
|
||||
|
||||
var res = new FinancialStatmentDetailsByContractingPartyViewModel()
|
||||
{
|
||||
Id = financialStatement.id,
|
||||
@@ -330,35 +406,7 @@ public class FinancialStatmentRepository : RepositoryBase<long, FinancialStatmen
|
||||
TotalCredit = financialStatement.FinancialTransactionList.Sum(x => x.Creditor),
|
||||
TotalDebt = financialStatement.FinancialTransactionList.Sum(x => x.Deptor),
|
||||
ContractingPartyName = financialStatement.ContractingPartyName,
|
||||
List = financialStatement.FinancialTransactionList.Select(t =>
|
||||
{
|
||||
if (!searched)
|
||||
{
|
||||
if (t.TypeOfTransaction == "debt")
|
||||
{
|
||||
balance += t.Deptor;
|
||||
}
|
||||
else
|
||||
{
|
||||
balance -= t.Creditor;
|
||||
}
|
||||
}
|
||||
return new FinancialTransactionDetailViewModel()
|
||||
{
|
||||
Id = t.id,
|
||||
DateTimeGr = t.TdateGr,
|
||||
DateFa = t.TdateGr.ToFarsi(),
|
||||
TimeFa = $"{t.TdateGr:HH:mm}",
|
||||
Description = t.DescriptionOption + " " + t.Description,
|
||||
Debtor = t.Deptor,
|
||||
Creditor = t.Creditor,
|
||||
Balance = balance,
|
||||
Type = t.TypeOfTransaction == "debt"
|
||||
? FinancialTransactionType.Debt
|
||||
: FinancialTransactionType.Credit,
|
||||
TypeStr = t.TypeOfTransaction == "debt" ? "ایجاد درآمد" : "دریافت درآمد"
|
||||
};
|
||||
}).OrderByDescending(t => t.DateTimeGr).ToList(),
|
||||
List = list,
|
||||
};
|
||||
return res;
|
||||
}
|
||||
|
||||
@@ -124,7 +124,7 @@ public class FineRepository : RepositoryBase<long, Fine>, IFineRepository
|
||||
}
|
||||
query = query.Where(x => x.EmployeeId == searchModel.EmployeeId);
|
||||
|
||||
var list = query.ToList().Select(x => new FineViewModel()
|
||||
var list = query.OrderByDescending(x=>x.FineDate).ToList().Select(x => new FineViewModel()
|
||||
{
|
||||
Amount = x.Amount.ToMoney(),
|
||||
AmountDouble = x.Amount,
|
||||
|
||||
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Collections.Immutable;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using _0_Framework.Application;
|
||||
@@ -16,13 +17,15 @@ using Company.Domain.empolyerAgg;
|
||||
using Company.Domain.FinancialStatmentAgg;
|
||||
using Company.Domain.FinancialTransactionAgg;
|
||||
using Company.Domain.InstitutionContractAgg;
|
||||
using Company.Domain.InstitutionContractAmendmentTempAgg;
|
||||
using Company.Domain.InstitutionContractContactInfoAgg;
|
||||
using Company.Domain.InstitutionContractInsertTempAgg;
|
||||
using Company.Domain.InstitutionContractExtensionTempAgg;
|
||||
using Company.Domain.InstitutionPlanAgg;
|
||||
using Company.Domain.WorkshopAgg;
|
||||
using CompanyManagment.App.Contracts.Employer;
|
||||
using CompanyManagment.App.Contracts.InstitutionContract;
|
||||
using CompanyManagment.App.Contracts.InstitutionContractContactinfo;
|
||||
using CompanyManagment.App.Contracts.Law;
|
||||
using CompanyManagment.App.Contracts.TemporaryClientRegistration;
|
||||
using CompanyManagment.App.Contracts.Workshop;
|
||||
using CompanyManagment.App.Contracts.WorkshopPlan;
|
||||
@@ -42,9 +45,20 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
private readonly IEmployerRepository _employerRepository;
|
||||
private readonly IWorkshopRepository _workshopRepository;
|
||||
private readonly IMongoCollection<InstitutionContractExtensionTemp> _institutionExtensionTemp;
|
||||
private readonly IMongoCollection<InstitutionContractAmendmentTemp> _institutionAmendmentTemp;
|
||||
private readonly IPlanPercentageRepository _planPercentageRepository;
|
||||
private readonly ISmsService _smsService;
|
||||
|
||||
private readonly InstitutionContratVerificationParty _firstParty = new()
|
||||
{
|
||||
Address = "رشت - خیابان حاجی آیاد - کوچه سپهدار - ساختمان داماش - واحد 17",
|
||||
PhoneNumber = "09111485044",
|
||||
CeoName = "سید حسن مصباح",
|
||||
CompanyNameOrFullName = "نور داد مهر گستر کاسپین",
|
||||
NationalCodeOrNationalId = "14009970584",
|
||||
LegalType = LegalType.Legal
|
||||
};
|
||||
|
||||
public InstitutionContractRepository(CompanyContext context, IEmployerRepository employerRepository,
|
||||
IWorkshopRepository workshopRepository, IMongoDatabase database,
|
||||
IPlanPercentageRepository planPercentageRepository, ISmsService smsService) : base(context)
|
||||
@@ -56,6 +70,8 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
_smsService = smsService;
|
||||
_institutionExtensionTemp =
|
||||
database.GetCollection<InstitutionContractExtensionTemp>("InstitutionContractExtensionTemp");
|
||||
_institutionAmendmentTemp =
|
||||
database.GetCollection<InstitutionContractAmendmentTemp>("InstitutionContractAmendmentTemp");
|
||||
}
|
||||
|
||||
public EditInstitutionContract GetDetails(long id)
|
||||
@@ -1083,6 +1099,11 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
joinedQuery = joinedQuery.Where(x =>
|
||||
x.contractingParty.RepresentativeFullName.Contains(keyword) ||
|
||||
(x.contractingParty.FName + " " + x.contractingParty.LName).Contains(keyword) ||
|
||||
(x.contractingParty.IsLegal == "حقیقی" ? x.contractingParty.SureName == null
|
||||
? x.contractingParty.FName + " " + x.contractingParty.LName
|
||||
: x.contractingParty.FName + " " + x.contractingParty.LName + " " + x.contractingParty.SureName
|
||||
: x.contractingParty.SureName == null ? x.contractingParty.LName
|
||||
: x.contractingParty.LName + " " + x.contractingParty.SureName).Contains(keyword)||
|
||||
x.contractingParty.Employers.Any(e =>
|
||||
e.FullName.Contains(keyword) ||
|
||||
e.WorkshopEmployers.Any(we =>
|
||||
@@ -1235,7 +1256,6 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
TotalCount = await joinedQuery.CountAsync(),
|
||||
List = list.Select(x =>
|
||||
{
|
||||
Console.WriteLine(x.contractingParty.id);
|
||||
var workshops = x.contractingParty.Employers
|
||||
.SelectMany(e => e.WorkshopEmployers.Select(we => we.Workshop)).DistinctBy(w => w.id).ToList();
|
||||
|
||||
@@ -1262,7 +1282,6 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
var workshopDetails = currentStateWorkshops?.Select(w =>
|
||||
{
|
||||
Workshop workshopSelected = null;
|
||||
Console.WriteLine(w.WorkshopId);
|
||||
if (w.WorkshopId != null && workshops.Select(ww => ww.id).Contains(w.WorkshopId.Value))
|
||||
{
|
||||
workshopSelected = workshops.First(ww => ww.id == w.WorkshopId.Value);
|
||||
@@ -1284,6 +1303,10 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
}
|
||||
};
|
||||
}).ToList() ?? [];
|
||||
|
||||
var employeesCount = _context.LeftWorkList
|
||||
.Where(l => workshops.Select(w => w.id).Contains(l.WorkshopId))
|
||||
.Count(l => l.StartWorkDate <= DateTime.Now && l.LeftWorkDate >= DateTime.Now);
|
||||
return new GetInstitutionContractListItemsViewModel()
|
||||
{
|
||||
ContractAmount = x.contract.ContractAmount,
|
||||
@@ -1298,14 +1321,17 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
Id = x.contract.id,
|
||||
ContractNo = x.contract.ContractNo,
|
||||
ArchiveNo = archiveCode.ToString(),
|
||||
EmployeesCount = _context.LeftWorkList
|
||||
.Where(l => workshops.Select(w => w.id).Contains(l.id))
|
||||
.Count(l => l.StartWorkDate <= DateTime.Now && l.LeftWorkDate >= DateTime.Now),
|
||||
EmployeesCount = employeesCount,
|
||||
EmployerNames = employers.Select(e => e.FullName).ToList(),
|
||||
ListStatus = status,
|
||||
IsExpired = x.contract.ContractEndGr <= endThisMontGr,
|
||||
ContractingPartyId = x.contractingParty.id,
|
||||
Workshops = workshopDetails
|
||||
Workshops = workshopDetails,
|
||||
IsInPersonContract = x.contract.WorkshopGroup?.CurrentWorkshops
|
||||
.Any(y=>y.Services.ContractInPerson)??true,
|
||||
IsOldContract = x.contract.WorkshopGroup?.CurrentWorkshops == null
|
||||
|| x.contract.WorkshopGroup.CurrentWorkshops.Count == 0
|
||||
|| x.contract.WorkshopGroup.CurrentWorkshops.Any(y => y.Price == 0)
|
||||
};
|
||||
}).ToList()
|
||||
};
|
||||
@@ -1471,6 +1497,11 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
case InstitutionContractListStatus.Deactive:
|
||||
joinedQuery = joinedQuery.Where(x => x.contract.ContractEndGr < now);
|
||||
break;
|
||||
|
||||
case InstitutionContractListStatus.PendingForVerify:
|
||||
joinedQuery = joinedQuery.Where(x =>
|
||||
x.contract.VerificationStatus == InstitutionContractVerificationStatus.PendingForVerify);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -1779,15 +1810,7 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
query.party.IsLegal == "حقیقی" ? query.party.Nationalcode : query.party.NationalId,
|
||||
LegalType = query.party.IsLegal == "حقیقی" ? LegalType.Real : LegalType.Legal,
|
||||
},
|
||||
FirstParty = new InstitutionContratVerificationParty()
|
||||
{
|
||||
Address = "رشت - خیابان حاجی آیاد - کوچه سپهدار - ساختمان داماش - واحد 17",
|
||||
PhoneNumber = "09111111111",
|
||||
CeoName = "سید حسن مصباح",
|
||||
CompanyNameOrFullName = "نور داد مهر گستر کاسپین",
|
||||
NationalCodeOrNationalId = "1111111111",
|
||||
LegalType = LegalType.Legal
|
||||
}
|
||||
FirstParty =_firstParty
|
||||
};
|
||||
|
||||
return res;
|
||||
@@ -1815,9 +1838,11 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
|
||||
public async Task<InstitutionContract> GetByPublicIdAsync(Guid id)
|
||||
{
|
||||
return await _context.InstitutionContractSet.FirstOrDefaultAsync(x => x.PublicId == id);
|
||||
return await _context.InstitutionContractSet.Include(x=>x.ContactInfoList).FirstOrDefaultAsync(x => x.PublicId == id);
|
||||
}
|
||||
|
||||
#region Extension
|
||||
|
||||
public async Task<InstitutionContractExtensionInquiryResult> GetExtensionInquiry(long previousContractId)
|
||||
{
|
||||
var institutionContracts = await _context.InstitutionContractSet
|
||||
@@ -2030,7 +2055,7 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
res.ThreeMonths =
|
||||
CalculateInstitutionPlan(InstitutionContractDuration.ThreeMonths, amount, false, newContractStart);
|
||||
|
||||
res.SixMonths =
|
||||
res.SixMonths =
|
||||
CalculateInstitutionPlan(InstitutionContractDuration.SixMonths, amount, false, newContractStart);
|
||||
|
||||
res.TwelveMonths = CalculateInstitutionPlan(InstitutionContractDuration.TwelveMonths, amount, false,
|
||||
@@ -2041,7 +2066,7 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
.Select(x => new InstitutionContractExtensionTempWorkshop(x.WorkshopName, x.CountPerson,
|
||||
x.ContractAndCheckout, x.ContractAndCheckoutInPerson,
|
||||
x.Insurance, x.InsuranceInPerson, x.RollCall, x.RollCall,
|
||||
x.RollCallInPerson, x.WorkshopServicesAmount,x.WorkshopId)).ToList();
|
||||
x.RollCallInPerson, x.WorkshopServicesAmount, x.WorkshopId)).ToList();
|
||||
|
||||
institutionTemp.SetWorkshopsAndPlanAmounts(workshops, res.OneMonth, res.ThreeMonths, res.SixMonths,
|
||||
res.TwelveMonths, hasInPerson);
|
||||
@@ -2227,7 +2252,7 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
extensionNo, workshopsCount, employeeCount,
|
||||
previousInstitutionContract.Description,
|
||||
"NotOfficial", "JobRelation", hasValueAddedTax,
|
||||
payment.Tax.MoneyToDouble(),[],
|
||||
payment.Tax.MoneyToDouble(), [],
|
||||
request.LawId);
|
||||
|
||||
await CreateAsync(entity);
|
||||
@@ -2237,26 +2262,25 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
var workshopDetail = new InstitutionContractWorkshopInitial(
|
||||
workshop.WorkshopName, workshop.RollCall, workshop.RollCallInPerson,
|
||||
workshop.CustomizeCheckout, workshop.ContractAndCheckout,
|
||||
workshop.ContractAndCheckoutInPerson, workshop.Insurance,
|
||||
workshop.ContractAndCheckoutInPerson, workshop.Insurance,
|
||||
workshop.InsuranceInPerson, workshop.CountPerson, workshop.Price);
|
||||
|
||||
|
||||
workshopDetail.SetWorkshopGroup(entity.WorkshopGroup);
|
||||
|
||||
|
||||
if (workshop.WorkshopId != 0)
|
||||
{
|
||||
workshopDetail.SetWorkshopId(workshop.WorkshopId);
|
||||
}
|
||||
// Set parent reference
|
||||
|
||||
|
||||
// Add to the parent's collection
|
||||
entity.WorkshopGroup.InitialWorkshops.Add(workshopDetail);
|
||||
}
|
||||
|
||||
// Save the changes again
|
||||
await SaveChangesAsync();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
FinancialStatment financialStatement;
|
||||
if (_context.FinancialStatments.Any(x => x.ContractingPartyId == contractingParty.id))
|
||||
{
|
||||
@@ -2270,7 +2294,7 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
}
|
||||
|
||||
var today = DateTime.Today;
|
||||
if (request.IsInstallment && payment is InstitutionContractExtensionPaymentMonthly monthly)
|
||||
if (request.IsInstallment && payment is InstitutionContractPaymentMonthlyViewModel monthly)
|
||||
{
|
||||
var installments = monthly.Installments.Select(x =>
|
||||
new InstitutionContractInstallment(x.InstalmentDate.ToGeorgianDateTime(),
|
||||
@@ -2317,8 +2341,8 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
|
||||
await SaveChangesAsync();
|
||||
|
||||
await _smsService.SendInstitutionVerificationLink(contractingParty.Phone, contractingPartyFullName,
|
||||
entity.PublicId);
|
||||
await _smsService.SendInstitutionCreationVerificationLink(contractingParty.Phone, contractingPartyFullName,
|
||||
entity.PublicId, contractingParty.id, entity.id);
|
||||
|
||||
|
||||
await SaveChangesAsync();
|
||||
@@ -2326,6 +2350,624 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
return opration.Succcedded();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public async Task<InstitutionContractAmendmentWorkshopsResponse> GetAmendmentWorkshops(long institutionContractId)
|
||||
{
|
||||
var institutionContract = await _context.InstitutionContractSet
|
||||
.Include(x => x.WorkshopGroup)
|
||||
.ThenInclude(x => x.CurrentWorkshops)
|
||||
.FirstOrDefaultAsync(x => x.id == institutionContractId);
|
||||
|
||||
if (institutionContract.WorkshopGroup.CurrentWorkshops.Any(x => x.Price == 0))
|
||||
{
|
||||
throw new BadRequestException(
|
||||
"این قرارداد قابل ارتقا به صورت ظاهری نیست لطفا به صورت دیتابیسی اقدام به ویرایش کنید");
|
||||
}
|
||||
|
||||
var workshops = institutionContract.WorkshopGroup.CurrentWorkshops
|
||||
.Select(x => new InstitutionContractAmendmentTempPrevWorkshop(x.WorkshopName,x.PersonnelCount,
|
||||
x.Services.Contract,x.Services.ContractInPerson,x.Services.Insurance,
|
||||
x.Services.InsuranceInPerson,x.Services.RollCall,x.Services.RollCallInPerson,
|
||||
x.Services.CustomizeCheckout,x.Price,
|
||||
x.WorkshopId??0,x.id)).ToList();
|
||||
|
||||
|
||||
await _institutionAmendmentTemp
|
||||
.DeleteManyAsync(x => x.InstitutionContractId == institutionContractId);;
|
||||
|
||||
var temp = new InstitutionContractAmendmentTemp(workshops, institutionContractId);
|
||||
|
||||
await _institutionAmendmentTemp.InsertOneAsync(temp);
|
||||
|
||||
var prevWorkshops = workshops.Select(x =>
|
||||
new InstitutionContractAmendmentTempWorkshopViewModel()
|
||||
{
|
||||
WorkshopName = x.WorkshopName,
|
||||
CountPerson = x.CountPerson,
|
||||
ContractAndCheckout = x.ContractAndCheckout,
|
||||
ContractAndCheckoutInPerson = x.ContractAndCheckoutInPerson,
|
||||
Insurance = x.Insurance,
|
||||
InsuranceInPerson = x.InsuranceInPerson,
|
||||
RollCall = x.RollCall,
|
||||
RollCallInPerson = x.RollCallInPerson,
|
||||
CustomizeCheckout = x.CustomizeCheckout,
|
||||
PriceStr = x.Price.ToMoney(),
|
||||
Price = x.Price,
|
||||
WorkshopId = x.WorkshopId,
|
||||
WorkshopTempId = x.Id,
|
||||
CurrentWorkshopId = x.CurrentWorkshopId,
|
||||
TempId =temp.Id
|
||||
})
|
||||
.ToList();
|
||||
var res = new InstitutionContractAmendmentWorkshopsResponse()
|
||||
{
|
||||
Workshops = prevWorkshops,
|
||||
TempId = temp.Id
|
||||
};
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
public async Task<InsitutionContractAmendmentPaymentResponse> GetAmendmentPaymentDetails(
|
||||
InsitutionContractAmendmentPaymentRequest request)
|
||||
{
|
||||
var institutionContractAmendmentTemp = await _institutionAmendmentTemp
|
||||
.Find(x=>x.Id == request.TempId)
|
||||
.FirstOrDefaultAsync();
|
||||
if (institutionContractAmendmentTemp == null)
|
||||
throw new NotFoundException("دیتای وارد شده نامعتبر است");
|
||||
|
||||
var amendmentStart = DateTime.Now;
|
||||
|
||||
var institutionContract = await _context.InstitutionContractSet
|
||||
.Include(x=>x.WorkshopGroup)
|
||||
.ThenInclude(x=>x.CurrentWorkshops)
|
||||
.FirstOrDefaultAsync(x => x.id == institutionContractAmendmentTemp.InstitutionContractId);
|
||||
|
||||
if (institutionContract == null)
|
||||
throw new NotFoundException("قرارداد مؤسسه یافت نشد");
|
||||
|
||||
var amendmentEnd = institutionContract.ContractEndGr;
|
||||
|
||||
var haContractInPerson = institutionContract.WorkshopGroup.CurrentWorkshops
|
||||
.Any(x => x.Services.ContractInPerson);
|
||||
if (!haContractInPerson)
|
||||
{
|
||||
if (institutionContractAmendmentTemp.NewWorkshops.Any(x => x.ContractAndCheckoutInPerson))
|
||||
{
|
||||
throw new BadRequestException("برای قرارداد آنلاین نمیتوان سرویس حضوری انتخاب کرد");
|
||||
}
|
||||
}
|
||||
|
||||
var pc = new PersianCalendar();
|
||||
|
||||
int startYear = pc.GetYear(amendmentStart);
|
||||
int startMonth = pc.GetMonth(amendmentStart);
|
||||
int startDay = pc.GetDayOfMonth(amendmentStart);
|
||||
|
||||
int endYear = pc.GetYear(amendmentEnd);
|
||||
int endMonth = pc.GetMonth(amendmentEnd);
|
||||
int endDay = pc.GetDayOfMonth(amendmentEnd);
|
||||
|
||||
// اختلاف خام ماهها
|
||||
int monthDiff = (endYear - startYear) * 12 + (endMonth - startMonth);
|
||||
|
||||
// اگر حتی چند روز از ماه بعدی هم گذشته بود → رند به بالا
|
||||
if (endDay > startDay)
|
||||
monthDiff++;
|
||||
|
||||
var sumOneMonth = institutionContractAmendmentTemp
|
||||
.NewWorkshops.Sum(x => x.PriceDifference);
|
||||
|
||||
var baseAmount = monthDiff * sumOneMonth;
|
||||
var tax = baseAmount*0.10;
|
||||
var totalPayment = tax+baseAmount;
|
||||
|
||||
|
||||
|
||||
var res = new InsitutionContractAmendmentPaymentResponse()
|
||||
{
|
||||
ContractStart = amendmentStart.ToFarsi(),
|
||||
ContractEnd = amendmentEnd.ToFarsi(),
|
||||
OneMonthAmount = sumOneMonth.ToMoney(),
|
||||
TotalAmount = baseAmount.ToMoney(),
|
||||
workshops = institutionContractAmendmentTemp.NewWorkshops
|
||||
.Select(x=>
|
||||
{
|
||||
var prevWorkshop = institutionContractAmendmentTemp.PrevWorkshops
|
||||
.FirstOrDefault(w=> w.Id == x.Id);
|
||||
var isNewWorkshop = prevWorkshop == null;
|
||||
return new InsitutionContractAmendmentPaymentWorkshopResponse()
|
||||
{
|
||||
WorkshopName = x.WorkshopName,
|
||||
IsNewWorkshop = isNewWorkshop,
|
||||
NewPersonnelCount = x.CountPerson,
|
||||
PrevPersonnelCount = prevWorkshop?.CountPerson??0,
|
||||
Price = x.PriceDifference,
|
||||
OldServices = prevWorkshop != null? new WorkshopServicesViewModel()
|
||||
{
|
||||
Contract = prevWorkshop.ContractAndCheckout,
|
||||
ContractInPerson = prevWorkshop.ContractAndCheckoutInPerson,
|
||||
CustomizeCheckout = prevWorkshop.CustomizeCheckout,
|
||||
Insurance = prevWorkshop.Insurance,
|
||||
InsuranceInPerson = prevWorkshop.InsuranceInPerson,
|
||||
RollCall = prevWorkshop.RollCall,
|
||||
RollCallInPerson = prevWorkshop.RollCallInPerson,
|
||||
}: new WorkshopServicesViewModel(),
|
||||
NewServices = new WorkshopServicesViewModel()
|
||||
{
|
||||
Contract = x.ContractAndCheckout,
|
||||
ContractInPerson = x.ContractAndCheckoutInPerson,
|
||||
CustomizeCheckout = x.CustomizeCheckout,
|
||||
Insurance = x.Insurance,
|
||||
InsuranceInPerson = x.InsuranceInPerson,
|
||||
RollCall = x.RollCall,
|
||||
RollCallInPerson = x.RollCallInPerson,
|
||||
},
|
||||
};
|
||||
}).OrderByDescending(x=>x.Price).ToList()
|
||||
};
|
||||
|
||||
res.OneTime = new InstitutionContractPaymentOneTimeViewModel()
|
||||
{
|
||||
TotalAmount = baseAmount.ToMoney(),
|
||||
PaymentAmount = totalPayment.ToMoney(),
|
||||
Tax = tax.ToMoney()
|
||||
};
|
||||
|
||||
if (haContractInPerson)
|
||||
{
|
||||
var installment = InstitutionMonthlyInstallmentCaculation(monthDiff,totalPayment, amendmentStart.ToFarsi());
|
||||
|
||||
var firstPrevInstallment = installment.First();
|
||||
var lastPrevInstallment = installment.Last();
|
||||
|
||||
var firstInstallment = new MonthlyInstallment()
|
||||
{
|
||||
InstallmentAmountStr = firstPrevInstallment.InstallmentAmountStr,
|
||||
InstallmentCounter = firstPrevInstallment.InstallmentCounter,
|
||||
InstalmentDate = amendmentStart.ToFarsi()
|
||||
};
|
||||
|
||||
var lastInstallment = new MonthlyInstallment()
|
||||
{
|
||||
InstallmentAmountStr = lastPrevInstallment.InstallmentAmountStr,
|
||||
InstallmentCounter = lastPrevInstallment.InstallmentCounter,
|
||||
InstalmentDate = lastPrevInstallment.InstalmentDate
|
||||
};
|
||||
|
||||
installment.Remove(firstPrevInstallment);
|
||||
installment.Remove(lastPrevInstallment);
|
||||
|
||||
installment.Insert(0, firstInstallment);
|
||||
installment.Add(lastInstallment);
|
||||
|
||||
res.Monthly = new InstitutionContractPaymentMonthlyViewModel()
|
||||
{
|
||||
Installments = installment,
|
||||
TotalAmount = baseAmount.ToMoney(),
|
||||
PaymentAmount = totalPayment.ToMoney(),
|
||||
Tax = tax.ToMoney()
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
institutionContractAmendmentTemp.AddPaymentDetails(res.Monthly, res.OneTime, monthDiff);
|
||||
await _institutionAmendmentTemp
|
||||
.ReplaceOneAsync(x => x.Id == institutionContractAmendmentTemp.Id, institutionContractAmendmentTemp);
|
||||
|
||||
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
public async Task<InsertAmendmentTempWorkshopResponse> InsertAmendmentTempWorkshops(
|
||||
InstitutionContractAmendmentTempWorkshopViewModel request)
|
||||
{
|
||||
var amendmentTemp =await _institutionAmendmentTemp
|
||||
.Find(x=> x.Id == request.TempId).FirstOrDefaultAsync();
|
||||
|
||||
if (amendmentTemp == null)
|
||||
throw new BadRequestException("دیتای وارد شده نامعتبر است");
|
||||
|
||||
var workshopTemp = amendmentTemp.NewWorkshops
|
||||
.FirstOrDefault(x => x.Id == request.WorkshopTempId);
|
||||
|
||||
var planForWorkshop = new WorkshopTempViewModel()
|
||||
{
|
||||
WorkshopName = request.WorkshopName,
|
||||
CountPerson = request.CountPerson,
|
||||
ContractAndCheckout = request.ContractAndCheckout,
|
||||
ContractAndCheckoutInPerson = request.ContractAndCheckoutInPerson,
|
||||
Insurance = request.Insurance,
|
||||
InsuranceInPerson = request.InsuranceInPerson,
|
||||
RollCall = request.RollCall,
|
||||
RollCallInPerson = request.RollCallInPerson,
|
||||
CustomizeCheckout = request.CustomizeCheckout
|
||||
};
|
||||
var price = _planPercentageRepository.GetInstitutionPlanForWorkshop(planForWorkshop)
|
||||
.OnlineAndInPersonSumAmountDouble;
|
||||
|
||||
if (workshopTemp == null)
|
||||
{
|
||||
var newWorkshopTemp = new InstitutionContractAmendmentTempNewWorkshop(request.WorkshopName,
|
||||
request.CountPerson,
|
||||
request.ContractAndCheckout, request.ContractAndCheckoutInPerson,
|
||||
request.Insurance, request.InsuranceInPerson,
|
||||
request.RollCall, request.RollCallInPerson,
|
||||
request.CustomizeCheckout, price,
|
||||
request.WorkshopId,0,price,Guid.NewGuid());
|
||||
|
||||
workshopTemp = newWorkshopTemp;
|
||||
|
||||
|
||||
amendmentTemp.NewWorkshops.Add(newWorkshopTemp);
|
||||
|
||||
await _institutionAmendmentTemp
|
||||
.ReplaceOneAsync(x => x.Id == amendmentTemp.Id, amendmentTemp);
|
||||
}
|
||||
else
|
||||
{
|
||||
var prevWorkshop = amendmentTemp.PrevWorkshops
|
||||
.FirstOrDefault(x => x.Id == workshopTemp.Id);
|
||||
var differencePrice = 0d;
|
||||
if (prevWorkshop != null)
|
||||
{
|
||||
differencePrice = price - prevWorkshop.Price;
|
||||
}
|
||||
else
|
||||
{
|
||||
differencePrice = price;
|
||||
}
|
||||
amendmentTemp.NewWorkshops.Remove(workshopTemp);
|
||||
|
||||
|
||||
if (differencePrice<0)
|
||||
{
|
||||
differencePrice = 0;
|
||||
}
|
||||
workshopTemp.Edit(request.WorkshopName, request.CountPerson,
|
||||
request.ContractAndCheckout, request.ContractAndCheckoutInPerson,
|
||||
request.Insurance, request.InsuranceInPerson,
|
||||
request.RollCall,
|
||||
request.CustomizeCheckout, price,differencePrice);
|
||||
|
||||
amendmentTemp.NewWorkshops.Add(workshopTemp);
|
||||
|
||||
await _institutionAmendmentTemp
|
||||
.ReplaceOneAsync(x => x.Id == amendmentTemp.Id, amendmentTemp);
|
||||
}
|
||||
|
||||
return new InsertAmendmentTempWorkshopResponse()
|
||||
{
|
||||
WorkshopTempId = workshopTemp.Id,
|
||||
Amount = workshopTemp.PriceDifference.ToMoney()
|
||||
};
|
||||
}
|
||||
|
||||
public async Task RemoveAmendmentWorkshops(Guid workshopTempId)
|
||||
{
|
||||
var amendmentTemp = await _institutionAmendmentTemp.Find(x => x.NewWorkshops.Any(w => w.Id == workshopTempId))
|
||||
.FirstOrDefaultAsync();
|
||||
if (amendmentTemp == null)
|
||||
throw new BadRequestException("دیتای وارد شده نامعتبر است");
|
||||
var workshopTemp = amendmentTemp.NewWorkshops.FirstOrDefault(x => x.Id == workshopTempId);
|
||||
if (workshopTemp == null)
|
||||
throw new BadRequestException("دیتای وارد شده نامعتبر است");
|
||||
|
||||
if (workshopTemp.CurrentWorkshopId!=0)
|
||||
throw new BadRequestException("شما نمی توانید این کارگاه را حذف کنید زیرا در قرارداد اصلی وجود دارد");
|
||||
|
||||
amendmentTemp.NewWorkshops.Remove(workshopTemp);
|
||||
|
||||
await _institutionAmendmentTemp.ReplaceOneAsync(x => x.Id == amendmentTemp.Id, amendmentTemp);
|
||||
|
||||
}
|
||||
public async Task<List<InstitutionContractSelectListViewModel>> GetInstitutionContractSelectList(string search,
|
||||
string selected)
|
||||
{
|
||||
var contractingParties = _context.PersonalContractingParties.Select(x => new InstitutionContractSelectListViewModel()
|
||||
{
|
||||
Id = x.id,
|
||||
Text = x.IsLegal == "حقیقی" ? x.SureName == null
|
||||
? x.FName + " " + x.LName
|
||||
: x.FName + " " + x.LName + " " + x.SureName
|
||||
: x.SureName == null ? x.LName
|
||||
: x.LName + " " + x.SureName
|
||||
});
|
||||
|
||||
var workshops = _context.Workshops.Select(x => new InstitutionContractSelectListViewModel()
|
||||
{
|
||||
Id = x.id,
|
||||
Text = x.WorkshopFullName
|
||||
});
|
||||
//کارفرما ها به غیر از آن هایی که به طرف حساب ---- وصل هستند
|
||||
var employers = _context.Employers.Where(x=>x.ContractingPartyId != 30428)
|
||||
.Select(x => new InstitutionContractSelectListViewModel()
|
||||
{
|
||||
Id = x.id,
|
||||
Text = x.FullName
|
||||
});
|
||||
var representatives = _context.RepresentativeSet.Select(x => new InstitutionContractSelectListViewModel()
|
||||
{
|
||||
Id = x.id,
|
||||
Text = x.FName + " " + x.LName
|
||||
});
|
||||
|
||||
var res = contractingParties
|
||||
.Union(workshops)
|
||||
.Union(employers)
|
||||
.Union(representatives);
|
||||
|
||||
InstitutionContractSelectListViewModel idSelected = null;
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(selected))
|
||||
{
|
||||
idSelected = await res.FirstOrDefaultAsync(x => x.Text == selected);
|
||||
}
|
||||
if (!string.IsNullOrWhiteSpace(search))
|
||||
{
|
||||
res = res.Where(x => x.Text.Contains(search));
|
||||
}
|
||||
|
||||
var list = await res.Take(100).ToListAsync();
|
||||
|
||||
if (idSelected != null)
|
||||
list.Add(idSelected);
|
||||
|
||||
return list.DistinctBy(x => x.Id).ToList();
|
||||
|
||||
}
|
||||
|
||||
public async Task<List<InstitutionContractPrintViewModel>> PrintAllAsync(List<long> ids)
|
||||
{
|
||||
var query =_context.InstitutionContractSet
|
||||
.Include(x=>x.WorkshopGroup)
|
||||
.ThenInclude(x=>x.InitialWorkshops)
|
||||
.Include(x=>x.WorkshopGroup)
|
||||
.ThenInclude(x=>x.CurrentWorkshops)
|
||||
.Where(x=>ids.Contains(x.id));
|
||||
|
||||
var contractingPartyIds = query.Select(x => x.ContractingPartyId).ToList();
|
||||
var contractingParties = await _context.PersonalContractingParties
|
||||
.Where(x => contractingPartyIds.Contains(x.id))
|
||||
.ToListAsync();
|
||||
|
||||
var list = query.ToList();
|
||||
|
||||
if (list.Count == 0)
|
||||
throw new NotFoundException("قرارداد مؤسسه یافت نشد");
|
||||
|
||||
var res = new List<InstitutionContractPrintViewModel>();
|
||||
foreach (var institution in list)
|
||||
{
|
||||
var contractingParty = contractingParties.FirstOrDefault(x => x.id == institution.ContractingPartyId);
|
||||
|
||||
if (contractingParty == null)
|
||||
{
|
||||
throw new NotFoundException("طرف حساب یافت نشد");
|
||||
}
|
||||
|
||||
var law = await _context.Laws
|
||||
.FirstOrDefaultAsync(x => x.id == institution.LawId);
|
||||
|
||||
|
||||
var secondParty = new InstitutionContratVerificationParty()
|
||||
{
|
||||
Address = contractingParty.Address,
|
||||
PhoneNumber = contractingParty.Phone,
|
||||
CeoName = contractingParty.IsLegal == "حقیقی"
|
||||
? $"{contractingParty.FName} {contractingParty.LName}"
|
||||
: $"{contractingParty.CeoFName} {contractingParty.CeoLName}",
|
||||
CompanyNameOrFullName = contractingParty.IsLegal == "حقیقی"
|
||||
? $"{contractingParty.FName} {contractingParty.LName}"
|
||||
: contractingParty.LName,
|
||||
NationalCodeOrNationalId =
|
||||
contractingParty.IsLegal == "حقیقی" ? contractingParty.Nationalcode : contractingParty.NationalId,
|
||||
LegalType = contractingParty.IsLegal == "حقیقی" ? LegalType.Real : LegalType.Legal,
|
||||
};
|
||||
|
||||
var lawViewModel = new LawViewModel()
|
||||
{
|
||||
Id = law.id,
|
||||
CreatedAt = law.CreationDate,
|
||||
HeadTitle = law.HeadTitle,
|
||||
IsActive = law.IsActive,
|
||||
Items = law.Items.Select(x => new LawItemViewModel()
|
||||
{
|
||||
Details = x.Details,
|
||||
Header = x.Header
|
||||
}).ToList(),
|
||||
Notifications = law.Notifications,
|
||||
Title = law.Title,
|
||||
Type = law.Type,
|
||||
Version = law.Version
|
||||
};
|
||||
|
||||
var item = new InstitutionContractPrintViewModel()
|
||||
{
|
||||
ContractStart = institution.ContractStartFa,
|
||||
ContractEnd = institution.ContractEndFa,
|
||||
ContractNo = institution.ContractNo,
|
||||
CreationDate = institution.CreationDate.ToFarsi(),
|
||||
FirstParty = _firstParty,
|
||||
SecondParty = secondParty,
|
||||
LawViewModel = lawViewModel,
|
||||
Obligation = institution.Obligation.ToMoney(),
|
||||
PaymentPrice = institution.TotalAmount.ToMoney(),
|
||||
TotalPrice = (institution.TotalAmount - institution.ValueAddedTax).ToMoney(),
|
||||
TaxPrice = institution.ValueAddedTax.ToMoney(),
|
||||
VerifierFullName = institution.VerifierFullName,
|
||||
VerifierPhoneNumber = institution.VerifierPhoneNumber,
|
||||
VerifyCode = institution.VerifyCode,
|
||||
VerifyDate = institution.VerifyCodeCreation.ToFarsi(),
|
||||
VerifyTime = institution.VerifyCodeCreation.ToString("HH:mm:ss"),
|
||||
Workshops = institution.WorkshopGroup.CurrentWorkshops
|
||||
.Select(x => new GetInstitutionVerificationDetailsWorkshopsViewModel()
|
||||
{
|
||||
Name = x.WorkshopName,
|
||||
PersonnelCount = x.PersonnelCount,
|
||||
Services = new WorkshopServicesViewModel()
|
||||
{
|
||||
Contract = x.Services.Contract,
|
||||
ContractInPerson = x.Services.ContractInPerson,
|
||||
CustomizeCheckout = x.Services.CustomizeCheckout,
|
||||
Insurance = x.Services.Insurance,
|
||||
InsuranceInPerson = x.Services.InsuranceInPerson,
|
||||
RollCall = x.Services.RollCall,
|
||||
RollCallInPerson = x.Services.RollCallInPerson
|
||||
},
|
||||
Price = x.Price.ToMoney()
|
||||
}).ToList()
|
||||
};
|
||||
res.Add(item);
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
public async Task AmendmentComplete(InstitutionContractAmendmentCompleteRequest request)
|
||||
{
|
||||
var amendmentTemp = await _institutionAmendmentTemp
|
||||
.Find(x=>x.Id == request.TempId).FirstOrDefaultAsync();
|
||||
|
||||
if (amendmentTemp == null)
|
||||
throw new BadRequestException("دیتای وارد شده نامعتبر است");
|
||||
|
||||
var institutionContract = await _context.InstitutionContractSet
|
||||
.Include(x=>x.Amendments)
|
||||
.Include(x=>x.WorkshopGroup)
|
||||
.ThenInclude(x=>x.CurrentWorkshops)
|
||||
.FirstOrDefaultAsync(x => x.id == amendmentTemp.InstitutionContractId);
|
||||
|
||||
|
||||
List<InstitutionContractInstallment> installments = [];
|
||||
double amount = 0;
|
||||
if (request.IsInstallment)
|
||||
{
|
||||
installments = amendmentTemp.MonthlyPayment.Installments.Select(x=>
|
||||
new InstitutionContractInstallment(x.InstalmentDate.ToGeorgianDateTime(),
|
||||
x.InstallmentAmountStr.MoneyToDouble(), "")).ToList();
|
||||
amount = amendmentTemp.MonthlyPayment.PaymentAmount.MoneyToDouble();
|
||||
}
|
||||
else
|
||||
{
|
||||
amount = amendmentTemp.OneTimePayment.PaymentAmount.MoneyToDouble();
|
||||
}
|
||||
var newWorkshops = amendmentTemp
|
||||
.NewWorkshops.Where(x=>x.CurrentWorkshopId ==0).ToList();
|
||||
|
||||
var newWorkshopTempIds = newWorkshops.Select(x=>x.Id).ToList();
|
||||
|
||||
var changes = newWorkshops.Select(x=>
|
||||
InstitutionContractAmendmentChange.CreateWorkshopCreatedChange(DateTime.Now,x.RollCall,x.RollCallInPerson,x.CustomizeCheckout,
|
||||
x.ContractAndCheckout,x.ContractAndCheckoutInPerson,x.Insurance,x.InsuranceInPerson,x.CountPerson)).ToList();
|
||||
|
||||
var changedWorkshops = amendmentTemp.NewWorkshops
|
||||
.Where(x => !newWorkshopTempIds.Contains(x.Id)).ToList();
|
||||
|
||||
foreach (var changedWorkshop in changedWorkshops)
|
||||
{
|
||||
var prev = amendmentTemp.PrevWorkshops.FirstOrDefault(x => x.Id == changedWorkshop.Id);
|
||||
if (prev == null)
|
||||
throw new BadRequestException("دیتای وارد شده ناقص ذخیره شده است");
|
||||
|
||||
// مقایسه مقادیر بولین بین prev و changedWorkshop برای تشخیص تغییرات
|
||||
var changedBooleans = new Dictionary<string, (bool Previous, bool Current)>();
|
||||
|
||||
if (prev.CustomizeCheckout != changedWorkshop.CustomizeCheckout)
|
||||
changedBooleans.Add("CustomizeCheckout", (prev.CustomizeCheckout, changedWorkshop.CustomizeCheckout));
|
||||
|
||||
if (prev.ContractAndCheckout != changedWorkshop.ContractAndCheckout)
|
||||
changedBooleans.Add("ContractAndCheckout", (prev.ContractAndCheckout, changedWorkshop.ContractAndCheckout));
|
||||
|
||||
if (prev.ContractAndCheckoutInPerson != changedWorkshop.ContractAndCheckoutInPerson)
|
||||
changedBooleans.Add("ContractAndCheckoutInPerson", (prev.ContractAndCheckoutInPerson, changedWorkshop.ContractAndCheckoutInPerson));
|
||||
|
||||
if (prev.Insurance != changedWorkshop.Insurance)
|
||||
changedBooleans.Add("Insurance", (prev.Insurance, changedWorkshop.Insurance));
|
||||
|
||||
if (prev.InsuranceInPerson != changedWorkshop.InsuranceInPerson)
|
||||
changedBooleans.Add("InsuranceInPerson", (prev.InsuranceInPerson, changedWorkshop.InsuranceInPerson));
|
||||
|
||||
if (prev.RollCall != changedWorkshop.RollCall)
|
||||
changedBooleans.Add("RollCall", (prev.RollCall, changedWorkshop.RollCall));
|
||||
|
||||
if (prev.RollCallInPerson != changedWorkshop.RollCallInPerson)
|
||||
changedBooleans.Add("RollCallInPerson", (prev.RollCallInPerson, changedWorkshop.RollCallInPerson));
|
||||
|
||||
// اگر تغییری وجود داشته باشد، آن را به لیست تغییرات اضافه کن
|
||||
if (changedBooleans.Any())
|
||||
{
|
||||
var change = InstitutionContractAmendmentChange.CreateServicesChange(
|
||||
DateTime.Now,
|
||||
changedWorkshop.WorkshopId,
|
||||
changedWorkshop.RollCall,
|
||||
changedWorkshop.RollCallInPerson,
|
||||
changedWorkshop.CustomizeCheckout,
|
||||
changedWorkshop.ContractAndCheckout,
|
||||
changedWorkshop.ContractAndCheckoutInPerson,
|
||||
changedWorkshop.Insurance,
|
||||
changedWorkshop.InsuranceInPerson);
|
||||
|
||||
changes.Add(change);
|
||||
}
|
||||
|
||||
if (changedWorkshop.CountPerson != prev.CountPerson)
|
||||
{
|
||||
var difference = changedWorkshop.CountPerson - prev.CountPerson;
|
||||
var change = InstitutionContractAmendmentChange.CreatePersonCountChange(
|
||||
DateTime.Now,
|
||||
changedWorkshop.CountPerson,
|
||||
difference,changedWorkshop.WorkshopId);
|
||||
|
||||
changes.Add(change);
|
||||
}
|
||||
}
|
||||
|
||||
var amendment = new InstitutionContractAmendment(institutionContract.id,installments,amount,
|
||||
request.IsInstallment,changes,request.LawId);
|
||||
institutionContract.AddAmendment(amendment);
|
||||
|
||||
await _smsService.SendInstitutionAmendmentVerificationLink(
|
||||
institutionContract.VerifierPhoneNumber,
|
||||
institutionContract.ContractingPartyName,
|
||||
institutionContract.PublicId,
|
||||
institutionContract.ContractingPartyId,
|
||||
institutionContract.id
|
||||
);
|
||||
|
||||
await _institutionAmendmentTemp.DeleteOneAsync(x=>x.Id == amendmentTemp.Id);
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
}
|
||||
|
||||
public async Task<GetInstitutionAmendmentVerificationDetailsViewModel> GetAmendmentVerificationDetails(Guid id,
|
||||
long amendmentId)
|
||||
{
|
||||
var institutionContract = await _context.InstitutionContractSet
|
||||
.Include(x => x.Amendments)
|
||||
.FirstOrDefaultAsync(x => x.PublicId == id);
|
||||
|
||||
if (institutionContract == null)
|
||||
throw new NotFoundException("قرارداد مؤسسه یافت نشد");
|
||||
|
||||
var amendment = institutionContract.Amendments
|
||||
.FirstOrDefault(x => x.id == amendmentId);
|
||||
if (amendment == null)
|
||||
throw new NotFoundException("ارتقا یافت نشد");
|
||||
|
||||
if (amendment.VerificationStatus != InstitutionContractVerificationStatus.PendingForVerify)
|
||||
throw new BadRequestException("این ارتقا قبلا تایید شده است");
|
||||
|
||||
throw new NotImplementedException();
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
private InstitutionContractExtensionPaymentResponse CalculateInPersonPayment(
|
||||
InstitutionContractExtensionPlanDetail selectedPlan, double baseAmount, double tenPercent,
|
||||
@@ -2349,7 +2991,7 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
// حالت پرداخت اقساطی
|
||||
var monthlyTax = baseAmount * 0.10;
|
||||
var monthlyTotal = baseAmount + monthlyTax;
|
||||
var installments = InstitutionMonthlyInstallmentCaculation(duration, monthlyTotal, selectedPlan.ContractStart);
|
||||
var installments = InstitutionMonthlyInstallmentCaculation((int)duration, monthlyTotal, selectedPlan.ContractStart);
|
||||
|
||||
res.Monthly = new()
|
||||
{
|
||||
@@ -2431,7 +3073,7 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
return result;
|
||||
}
|
||||
|
||||
public static List<MonthlyInstallment> InstitutionMonthlyInstallmentCaculation(InstitutionContractDuration duration,
|
||||
public static List<MonthlyInstallment> InstitutionMonthlyInstallmentCaculation(int duration,
|
||||
double monthlyTotalPaymentDouble,
|
||||
string installmentstart)
|
||||
{
|
||||
@@ -2439,7 +3081,7 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
var installmentList = new List<MonthlyInstallment>();
|
||||
|
||||
|
||||
int instalmentCount = (int)duration;
|
||||
int instalmentCount = duration;
|
||||
var instalmentAmount = monthlyTotalPaymentDouble / instalmentCount;
|
||||
int currentInstallmentStartDay = int.Parse(installmentstart.Substring(8, 2));
|
||||
bool endOfMonth = currentInstallmentStartDay == 31;
|
||||
@@ -2499,6 +3141,7 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
#region CustomViewModels
|
||||
|
||||
|
||||
@@ -7,11 +7,14 @@ using System.Runtime.CompilerServices;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
using _0_Framework.Application;
|
||||
using _0_Framework.Application.Enums;
|
||||
using _0_Framework.InfraStructure;
|
||||
using AccountMangement.Infrastructure.EFCore;
|
||||
using Company.Domain.CheckoutAgg;
|
||||
using Company.Domain.EmployeeAgg;
|
||||
using Company.Domain.EmployeeChildrenAgg;
|
||||
using Company.Domain.EmployeeInsurancListDataAgg;
|
||||
using Company.Domain.empolyerAgg;
|
||||
using Company.Domain.InsuranceListAgg;
|
||||
using Company.Domain.InsuranceWorkshopAgg;
|
||||
using Company.Domain.InsuranceYearlySalaryAgg;
|
||||
@@ -132,6 +135,11 @@ public class InsuranceListRepository : RepositoryBase<long, InsuranceList>, IIns
|
||||
var id = insuranceListObj.id;
|
||||
if (command.EmployeeInsurancListDataList != null && command.EmployeeInsurancListDataList.Count > 0)
|
||||
{
|
||||
var farisMonthName = Tools.ToFarsiMonthByNumber(command.Month);
|
||||
|
||||
var checkouts = _context.CheckoutSet.Where(x =>
|
||||
x.WorkshopId == command.WorkshopId && x.Year == command.Year && x.Month == farisMonthName &&
|
||||
x.IsActiveString == "true");
|
||||
foreach (var item in command.EmployeeInsurancListDataList)
|
||||
{
|
||||
if (item.EmployeeInsurancListDataId == 0)
|
||||
@@ -158,6 +166,29 @@ public class InsuranceListRepository : RepositoryBase<long, InsuranceList>, IIns
|
||||
item.LeftWorkDate, item.JobId, item.IncludeStatus, item.BaseYears,
|
||||
item.MarriedAllowance, item.OverTimePay, item.FamilyAllowance);
|
||||
}
|
||||
|
||||
|
||||
if (checkouts.Any())
|
||||
{
|
||||
var checkout = checkouts.FirstOrDefault(x => x.EmployeeId == item.EmployeeId);
|
||||
if (checkout != null)
|
||||
{
|
||||
if (item.InsuranceShare.ToMoney() != checkout.InsuranceDeduction.ToMoney())
|
||||
{
|
||||
checkout.SetUpdateNeeded();
|
||||
if (!_context.CheckoutWarningMessages.Any(x => x.CheckoutId == checkout.id && x.TypeOfCheckoutWarning != TypeOfCheckoutWarning.InsuranceEmployeeShare))
|
||||
{
|
||||
var createWarrning =
|
||||
new CheckoutWarningMessage(
|
||||
"مبلغ بیمه سهم کارگر با مبلغ محاسبه شده در لیست بیمه مغایرت دارد", checkout.id, TypeOfCheckoutWarning.InsuranceEmployeeShare);
|
||||
_context.CheckoutWarningMessages.Add(createWarrning);
|
||||
}
|
||||
|
||||
_context.SaveChanges();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
_employeeInsurancListDataRepository.SaveChanges();
|
||||
@@ -698,6 +729,11 @@ public class InsuranceListRepository : RepositoryBase<long, InsuranceList>, IIns
|
||||
var id = insuranceListObj.id;
|
||||
if (command.EmployeeInsurancListDataList != null && command.EmployeeInsurancListDataList.Count > 0)
|
||||
{
|
||||
var farisMonthName = Tools.ToFarsiMonthByNumber(command.Month);
|
||||
|
||||
var checkouts = _context.CheckoutSet.Where(x =>
|
||||
x.WorkshopId == command.WorkshopId && x.Year == command.Year && x.Month == farisMonthName &&
|
||||
x.IsActiveString == "true");
|
||||
foreach (var item in command.EmployeeInsurancListDataList)
|
||||
{
|
||||
var employeeInsurancListData = new EmployeeInsurancListData(id,
|
||||
@@ -711,6 +747,28 @@ public class InsuranceListRepository : RepositoryBase<long, InsuranceList>, IIns
|
||||
item.LeftWorkDate, item.JobId, item.IncludeStatus, item.BaseYears, item.MarriedAllowance,
|
||||
item.OverTimePay, item.FamilyAllowance);
|
||||
_employeeInsurancListDataRepository.Create(employeeInsurancListData);
|
||||
if (checkouts.Any())
|
||||
{
|
||||
var checkout = checkouts.FirstOrDefault(x => x.EmployeeId == item.EmployeeId);
|
||||
if (checkout != null)
|
||||
{
|
||||
if (item.InsuranceShare.ToMoney() != checkout.InsuranceDeduction.ToMoney())
|
||||
{
|
||||
checkout.SetUpdateNeeded();
|
||||
if (!_context.CheckoutWarningMessages.Any(x => x.CheckoutId == checkout.id && x.TypeOfCheckoutWarning != TypeOfCheckoutWarning.InsuranceEmployeeShare))
|
||||
{
|
||||
var createWarrning =
|
||||
new CheckoutWarningMessage(
|
||||
"مبلغ بیمه سهم کارگر با مبلغ محاسبه شده در لیست بیمه مغایرت دارد", checkout.id, TypeOfCheckoutWarning.InsuranceEmployeeShare);
|
||||
_context.CheckoutWarningMessages.Add(createWarrning);
|
||||
}
|
||||
|
||||
_context.SaveChanges();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
_employeeInsurancListDataRepository.SaveChanges();
|
||||
@@ -1411,6 +1469,27 @@ public class InsuranceListRepository : RepositoryBase<long, InsuranceList>, IIns
|
||||
}
|
||||
|
||||
|
||||
public List<EmployeeInsurancListDataViewModel> EmployeeInsuranceDataBy(DateTime startDate, long workshopId)
|
||||
{
|
||||
var res = _context.InsuranceListSet
|
||||
.Where(x => x.StartDate <= startDate && x.EndDate >= startDate &&
|
||||
x.WorkshopId == workshopId)
|
||||
.Join(_context.EmployeeInsurancListDataSet,
|
||||
insuranceList => insuranceList.id,
|
||||
employeeInsurancListData => employeeInsurancListData.InsuranceListId,
|
||||
(insuranceList, employeeInsurancListData) => new EmployeeInsurancListDataViewModel
|
||||
{
|
||||
InsuranceListId = insuranceList.id,
|
||||
EmployeeId = employeeInsurancListData.EmployeeId,
|
||||
WorkingDays = employeeInsurancListData.WorkingDays,
|
||||
BenefitsIncludedNonContinuous = employeeInsurancListData.BenefitsIncludedNonContinuous,
|
||||
InsuranceShare = employeeInsurancListData.InsuranceShare,
|
||||
});
|
||||
|
||||
return res.ToList();
|
||||
}
|
||||
|
||||
|
||||
public List<EmployeeDetailsForInsuranceListViewModel> GetEmployeeInsuranceDataForEdit(long insuranceListId,
|
||||
DateTime startDate, DateTime endDate)
|
||||
{
|
||||
@@ -1724,9 +1803,86 @@ public class InsuranceListRepository : RepositoryBase<long, InsuranceList>, IIns
|
||||
.Include(x => x.LeftWorkInsurances)
|
||||
.Where(x => x.LeftWorkInsurances.Any(l => l.StartWorkDate <= firstDayOfMonth &&
|
||||
(l.LeftWorkDate == null || l.LeftWorkDate >= firstDayOfMonth)));
|
||||
|
||||
|
||||
var query = notCreatedWorkshop.Select(result=>new InsuranceListViewModel
|
||||
{
|
||||
Year = searchModel.Year,
|
||||
Month = searchModel.Month,
|
||||
WorkShopId = result.id,
|
||||
WorkShopCode = result.InsuranceWorkshopInfo != null
|
||||
? result.InsuranceWorkshopInfo.InsuranceCode
|
||||
: result.InsuranceCode,
|
||||
WorkShopName = result.InsuranceWorkshopInfo != null
|
||||
? result.InsuranceWorkshopInfo.WorkshopName
|
||||
: result.WorkshopFullName,
|
||||
TypeOfInsuranceSend = result.TypeOfInsuranceSend == "NormalList" ? "عادی" :
|
||||
result.TypeOfInsuranceSend == "Govermentlist" ? "کمک دولت" :
|
||||
result.TypeOfInsuranceSend == "Familylist" ? "خانوادگی" : "",
|
||||
FixedSalary = result.FixedSalary,
|
||||
StrFixedSalary = result.FixedSalary ? "دارد" : "ندارد",
|
||||
EmployerName = result.InsuranceWorkshopInfo != null
|
||||
? result.InsuranceWorkshopInfo.EmployerName
|
||||
: result.WorkshopFullName,
|
||||
Branch = "",
|
||||
City = "",
|
||||
ArchiveCode = result.ArchiveCode,
|
||||
});
|
||||
|
||||
|
||||
if (!string.IsNullOrEmpty(searchModel.Month) && searchModel.Month != "0")
|
||||
query = query.Where(x => x.Month == searchModel.Month).OrderByDescending(x => x.WorkShopName)
|
||||
.ThenByDescending(x => x.EmployerName).ThenByDescending(x => x.Year);
|
||||
|
||||
var workshopList = await notCreatedWorkshop.Skip(searchModel.PageIndex).Take(30).ToListAsync();
|
||||
var workshopIds = workshopList.Select(x=>x.id);
|
||||
if (!string.IsNullOrEmpty(searchModel.Year) && searchModel.Year != "0")
|
||||
query = query.Where(x => x.Year == searchModel.Year).OrderByDescending(x => x.EmployerName)
|
||||
.ThenByDescending(x => x.WorkShopName).ThenByDescending(x => x.Month);
|
||||
|
||||
|
||||
if (!string.IsNullOrEmpty(searchModel.WorkShopCode))
|
||||
query = query.Where(x => x.WorkShopCode == searchModel.WorkShopCode).OrderByDescending(x => x.Year)
|
||||
.ThenByDescending(x => x.Month).ThenByDescending(x => x.EmployerName);
|
||||
|
||||
if (!string.IsNullOrEmpty(searchModel.WorkShopName))
|
||||
query = query.Where(x => x.WorkShopName.Contains(searchModel.WorkShopName))
|
||||
.OrderByDescending(x => x.EmployerName).ThenByDescending(x => x.Year).OrderByDescending(x => x.Month);
|
||||
|
||||
|
||||
if (searchModel.WorkshopId > 0)
|
||||
{
|
||||
var workshopName = query.FirstOrDefault(u => u.WorkShopId == searchModel.WorkshopId)?.WorkShopName;
|
||||
|
||||
query = query.Where(x => x.WorkShopName.Contains(workshopName)).OrderByDescending(x => x.EmployerName)
|
||||
.ThenByDescending(x => x.Year).ThenByDescending(x => x.Month);
|
||||
}
|
||||
|
||||
if (searchModel.EmployerId > 0)
|
||||
{
|
||||
var employerName = query.FirstOrDefault(u => u.EmployerId == searchModel.EmployerId)?.EmployerName;
|
||||
query = query.Where(x => x.EmployerName.Contains(employerName)).OrderByDescending(x => x.EmployerName)
|
||||
.ThenByDescending(x => x.Year).ThenByDescending(x => x.Month);
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(searchModel.EmployerName))
|
||||
query = query.Where(x => x.EmployerName.Contains(searchModel.EmployerName))
|
||||
.OrderByDescending(x => x.EmployerName).ThenByDescending(x => x.Year).OrderByDescending(x => x.Month);
|
||||
|
||||
|
||||
if (searchModel.FixedSalary != null)
|
||||
query = query.Where(x => x.FixedSalary == searchModel.FixedSalary);
|
||||
|
||||
if (!string.IsNullOrEmpty(searchModel.TypeOfInsuranceSend) && searchModel.TypeOfInsuranceSend != "0")
|
||||
query = query.Where(x => x.TypeOfInsuranceSend == searchModel.TypeOfInsuranceSend);
|
||||
|
||||
if (!string.IsNullOrEmpty(searchModel.City) && searchModel.City != "0")
|
||||
query = query.Where(x => x.City == searchModel.City);
|
||||
|
||||
if (!string.IsNullOrEmpty(searchModel.Branch))
|
||||
query = query.Where(x => x.Branch.Contains(searchModel.Branch));
|
||||
|
||||
|
||||
var workshopList = await query.Skip(searchModel.PageIndex).Take(30).ToListAsync();
|
||||
var workshopIds = workshopList.Select(x=>x.WorkShopId);
|
||||
|
||||
var employers =await _context.WorkshopEmployers
|
||||
.Where(x=>workshopIds.Contains(x.WorkshopId))
|
||||
@@ -1735,20 +1891,16 @@ public class InsuranceListRepository : RepositoryBase<long, InsuranceList>, IIns
|
||||
|
||||
var res = workshopList.Select(x =>
|
||||
{
|
||||
var employer = employers.FirstOrDefault(e => e.WorkshopId ==x.id)?.Employer;
|
||||
var employer = employers.FirstOrDefault(e => e.WorkshopId ==x.WorkShopId)?.Employer;
|
||||
|
||||
return new InsuranceListViewModel
|
||||
{
|
||||
WorkShopId = x.id,
|
||||
WorkShopCode = x.InsuranceCode,
|
||||
WorkShopName = x.InsuranceWorkshopInfo != null
|
||||
? x.InsuranceWorkshopInfo.WorkshopName
|
||||
: x.WorkshopFullName,
|
||||
WorkShopId = x.WorkShopId,
|
||||
WorkShopCode = x.WorkShopCode,
|
||||
WorkShopName = x.WorkShopName,
|
||||
EmployerName = employer != null
|
||||
? employer.FullName
|
||||
: (x.InsuranceWorkshopInfo != null
|
||||
? x.InsuranceWorkshopInfo.EmployerName
|
||||
: x.WorkshopFullName),
|
||||
: (x.EmployerName),
|
||||
Year = searchModel.Year,
|
||||
Month = searchModel.Month,
|
||||
TypeOfInsuranceSend = x.TypeOfInsuranceSend == "NormalList" ? "عادی" :
|
||||
|
||||
@@ -97,7 +97,7 @@ public class LoanRepository : RepositoryBase<long, Loan>, ILoanRepository
|
||||
query = query.Where(x => x.StartInstallmentPayment >= startDate && x.StartInstallmentPayment <= endDate);
|
||||
}
|
||||
query = query.Where(x => x.EmployeeId == searchModel.EmployeeId);
|
||||
var list = query.ToList().Select(x => new LoanViewModel()
|
||||
var list = query.OrderByDescending(x=>x.StartInstallmentPayment).ToList().Select(x => new LoanViewModel()
|
||||
{
|
||||
Amount = x.Amount.ToMoney(),
|
||||
AmountDouble = x.Amount,
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user