Compare commits

..

60 Commits

Author SHA1 Message Date
595b2c8a2d feat: update verification date and time properties in institution contract model 2025-10-28 13:15:46 +03:30
6b6b0767e3 Merge branch 'master' into Feature/InstitutionContract/print-api 2025-10-23 16:44:36 +03:30
3d86ba401f fix: update IsOldContract logic to handle null and empty workshop groups 2025-10-23 16:44:19 +03:30
6a6e2e532a feat: add print API for institution contracts and include verifier details 2025-10-23 14:13:55 +03:30
ca6638d6a3 feat: enhance workshop query with additional filtering options and improved mapping 2025-10-22 19:26:10 +03:30
608fb824dc refactor: remove unnecessary console logging in workshop selection 2025-10-22 17:23:17 +03:30
4686151bbb Merge branch 'Main'
# Conflicts:
#	CompanyManagment.EFCore/Repository/InstitutionContractRepository.cs
2025-10-22 17:04:59 +03:30
d7fae42e4f Merge remote-tracking branch 'origin/master' 2025-10-22 17:01:12 +03:30
2cfe480733 fix: correct workshop ID reference in employee count calculation 2025-10-22 17:00:33 +03:30
syntax24
c574ce534d Insurance Exept include = 0, Employee 1496 2025-10-22 16:55:11 +03:30
174edbf87d Merge branch 'Feature/InstitutionContract/add-old-edit-api' into Main
# Conflicts:
#	ServiceHost/Areas/Admin/Controllers/institutionContractController.cs
2025-10-22 15:29:43 +03:30
a827470831 feat: add API for editing old institution contracts with new properties 2025-10-22 15:19:17 +03:30
c9b61c3fc6 fix: validate Georgian date conversion in financial statement application 2025-10-22 12:07:26 +03:30
45002b88c4 fix: update absence terminology to 'عدم حضور' across multiple files 2025-10-22 11:18:55 +03:30
0bacb24aa2 Merge branch 'Feature/InstitutionContract/upgrade' into Main 2025-10-21 21:58:25 +03:30
7fd8851f71 refactor: optimize employee count calculation in InstitutionContractRepository 2025-10-21 21:57:04 +03:30
bc6ae854f8 Merge branch 'Feature/InstitutionContract/upgrade' into Main
# Conflicts:
#	Company.Domain/InstitutionContractAgg/IInstitutionContractRepository.cs
#	Company.Domain/InstitutionContractAgg/InstitutionContract.cs
2025-10-21 15:07:16 +03:30
68f1f81b53 feat: add BSON representation for Id property in InstitutionContractAmendmentTemp 2025-10-21 15:05:48 +03:30
d4c2ab939e fix: correct workshop ID reference in employee count calculation 2025-10-21 14:55:23 +03:30
5822005b68 Merge branch 'master' into Feature/InstitutionContract/upgrade
# Conflicts:
#	Company.Domain/InstitutionContractAgg/IInstitutionContractRepository.cs
#	Company.Domain/InstitutionContractAgg/InstitutionContract.cs
#	ServiceHost/Areas/Admin/Controllers/institutionContractController.cs
2025-10-21 14:45:22 +03:30
53aeb60861 Merge branch 'Feature/InstitutionContract/upgrade' into Main 2025-10-21 14:37:41 +03:30
c2a08d9c33 feat: add BsonRepresentation attribute to Id property for string representation in MongoDB 2025-10-21 14:37:11 +03:30
85e2481680 feat: enhance financial statement retrieval with contracting party validation and creation 2025-10-21 13:50:42 +03:30
b711e803a9 Merge branch 'master' into Main
# Conflicts:
#	ServiceHost/Areas/Admin/Controllers/institutionContractController.cs
2025-10-21 11:50:45 +03:30
232a834dc9 feat: add resend verification link end point added 2025-10-21 11:41:23 +03:30
55f7b4f7c0 Merge branch 'Feature/InstitutionContract/upgrade' into Main
# Conflicts:
#	Company.Domain/InstitutionContractAgg/IInstitutionContractRepository.cs
#	Company.Domain/InstitutionContractAgg/InstitutionContract.cs
2025-10-21 11:10:06 +03:30
c5b521bc50 feat: add endpoints for inserting, removing, and retrieving amendment workshops and payment details 2025-10-21 11:04:46 +03:30
acdd7de4f6 feat: update InsertAmendmentTempWorkshops method to return detailed response and refactor related classes 2025-10-21 11:02:10 +03:30
78458f24e5 feat: add entry and exit time differences to roll call reports 2025-10-20 15:43:59 +03:30
fde58a7c75 feat: add temporary workshop management for institution contract amendments 2025-10-20 13:13:43 +03:30
syntax24
dbddccf011 add inew permission admin > workflow > institution-contract 2025-10-19 23:06:14 +03:30
488454d354 feat: add authorized bank details functionality with repository and application layers 2025-10-19 13:20:54 +03:30
4126a7370f fix: handle nullable UidBank in account number conversion 2025-10-19 12:17:33 +03:30
7aff8ba59f fix: fix url workflow institution contract 2025-10-18 19:55:06 +03:30
7d6b57affd feat: make Workshops property public and update CalculateInstallment method visibility 2025-10-18 16:50:40 +03:30
950f2884ac Merge branch 'Main' 2025-10-18 09:20:10 +03:30
2edf150ef6 Merge branch 'Feature/Registeration-workflow/add-existed-employer' 2025-10-18 09:03:26 +03:30
df9c268959 Merge branch 'Feature/contracting-party-bank-account/add-inquiry' 2025-10-18 09:03:18 +03:30
3c6303e817 feat: add financial contracts card to workflow page 2025-10-16 18:06:44 +03:30
23386fda76 Merge branch 'Feature/contracting-party-bank-account/add-inquiry' into Main 2025-10-16 16:02:40 +03:30
ce4fc33daa Merge branch 'Feature/Registeration-workflow/add-existed-employer' into Main 2025-10-16 15:42:21 +03:30
f5d95b21b0 feat: enhance employer gender handling in registration workflow 2025-10-16 15:41:49 +03:30
6e83904e11 Merge branch 'Feature/Registeration-workflow/add-existed-employer' into Main 2025-10-16 15:27:30 +03:30
1f7785581c feat: streamline employer removal process from workshop details 2025-10-16 15:26:53 +03:30
9140f1ea0b Merge branch 'Feature/contracting-party-bank-account/add-inquiry' into Main 2025-10-16 14:00:37 +03:30
e5c0a7db58 Merge branch 'Feature/Registeration-workflow/add-existed-employer' into Main 2025-10-16 12:17:10 +03:30
d44a9224be feat: prevent duplicate employer registration in workshop 2025-10-16 12:16:31 +03:30
c8018948c2 feat: add validation to prevent upgrading institution contracts with zero-priced workshops 2025-10-16 11:56:45 +03:30
db40ab567c refactor: update InstitutionContractAmendment and InstitutionContractAmendmentChange constructors for improved encapsulation 2025-10-16 08:01:10 +03:30
5f324a6fa1 refactor: rename zInstitutionContractExtensionPaymentResponse to InstitutionContractExtensionPaymentResponse 2025-10-15 18:06:20 +03:30
d1703ad20e refactor: remove unused classes and rename InstitutionContractExtensionPaymentResponse 2025-10-15 17:50:52 +03:30
2f38470746 Merge branch 'Feature/InstitutionContract/upgrade' into Main
# Conflicts:
#	Company.Domain/InstitutionContractAgg/IInstitutionContractRepository.cs
#	CompanyManagment.App.Contracts/InstitutionContract/IInstitutionContractApplication.cs
#	CompanyManagment.EFCore/Repository/InstitutionContractRepository.cs
2025-10-15 17:49:23 +03:30
23c02abe65 feat: add endpoint to retrieve amendment workshops by institution contract ID 2025-10-15 17:34:16 +03:30
475142744f Merge branch 'Feature/admin-dashboard/add-date-details' into Main 2025-10-15 16:33:51 +03:30
230cde7c15 feat: enhance AdminDashboardViewModel to include date details for improved dashboard insights 2025-10-15 16:33:14 +03:30
13a2cd78cd feat: improve institution contract retrieval and ensure account creation consistency 2025-10-15 12:28:30 +03:30
91fc560355 feat: enhance registration workflow by adding account creation for contracting parties 2025-10-15 11:32:23 +03:30
8acb25dd67 feat: refactor financial transaction list processing for improved readability and performance 2025-10-15 10:54:09 +03:30
61b326aed4 feat: enhance InstitutionContractAmendment with lawId and improve constructor logic 2025-10-15 08:27:00 +03:30
756e06cc2f feat: implement amendment features in InstitutionContract, including payment and workshop retrieval 2025-10-14 09:51:29 +03:30
69 changed files with 24337 additions and 186 deletions

View File

@@ -204,8 +204,7 @@ public class SmsService : ISmsService
int pageSize = 100; // max: 100
SmsIr smsIr = new SmsIr("Og5M562igmzJRhQPnq0GdtieYdLgtfikjzxOmeQBPxJjZtyge5Klc046Lfw1mxSa");
var response = await smsIr.GetArchivedReportAsync(pageNumber, pageSize, unixTimestamp, unixTimestamp2);
MessageReportResult[] messages = response.Data;
foreach (var message in messages)
{

View File

@@ -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; }
}
}

View File

@@ -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);
}
}

View File

@@ -6,6 +6,7 @@ using _0_Framework.Application;
using _0_Framework.Domain;
using CompanyManagment.App.Contracts.InstitutionContract;
using CompanyManagment.App.Contracts.Workshop;
using Microsoft.AspNetCore.Mvc;
namespace Company.Domain.InstitutionContractAgg;
@@ -54,10 +55,26 @@ 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);
}

View File

@@ -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)
@@ -254,6 +256,19 @@ public class InstitutionContract : EntityBase
public class InstitutionContractAmendment : EntityBase
{
private InstitutionContractAmendment(){}
public InstitutionContractAmendment(long institutionContractId,
List<InstitutionContractInstallment> installments, double amount, bool hasInstallment,
InstitutionContractAmendmentChange amendmentChange, long lawId)
{
InstitutionContractId = institutionContractId;
Installments = installments is { Count: > 0} ? installments : [];
Amount = amount;
HasInstallment = hasInstallment;
AmendmentChanges = [amendmentChange];
LawId = lawId;
}
public long InstitutionContractId { get; set; }
public InstitutionContract InstitutionContract { get; set; }
public List<InstitutionContractInstallment> Installments { get; set; }
@@ -262,10 +277,47 @@ 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 void SetVerifyCode(string code,string verifierFullName, string verifierPhoneNumber)
{
VerifyCode = code;
VerifyCodeCreation = DateTime.Now;
VerifierFullName = verifierFullName;
VerifierPhoneNumber = verifierPhoneNumber;
}
public string VerifierPhoneNumber { get; private set; }
public string VerifierFullName { get; private set; }
public DateTime VerifyCodeCreation { get; set; }
}
public class InstitutionContractAmendmentChange : EntityBase
{
private InstitutionContractAmendmentChange() { }
private InstitutionContractAmendmentChange(long institutionContractAmendmentId,
InstitutionContractAmendment institutionContractAmendment, InstitutionContractAmendmentChangeType changeType,
DateTime changeDateGr, bool? hasRollCallPlan, bool? hasCustomizeCheckoutPlan, bool? hasContractPlan,
bool? hasContractPlanInPerson, bool? hasInsurancePlan, bool? hasInsurancePlanInPerson, int? personnelCount,
long? workshopDetailsId)
{
InstitutionContractAmendmentId = institutionContractAmendmentId;
InstitutionContractAmendment = institutionContractAmendment;
ChangeType = changeType;
ChangeDateGr = changeDateGr;
HasRollCallPlan = hasRollCallPlan;
HasCustomizeCheckoutPlan = hasCustomizeCheckoutPlan;
HasContractPlan = hasContractPlan;
HasContractPlanInPerson = hasContractPlanInPerson;
HasInsurancePlan = hasInsurancePlan;
HasInsurancePlanInPerson = hasInsurancePlanInPerson;
PersonnelCount = personnelCount;
WorkshopDetailsId = workshopDetailsId;
}
public long InstitutionContractAmendmentId { get; private set; }
public InstitutionContractAmendment InstitutionContractAmendment { get; private set; }
public InstitutionContractAmendmentChangeType ChangeType { get; private set; }
@@ -310,8 +362,6 @@ public class InstitutionContractAmendmentChange : EntityBase
/// تعداد کارگاه
/// </summary>
public long? WorkshopDetailsId { get; private set; }
}
public enum InstitutionContractAmendmentChangeType

View File

@@ -0,0 +1,151 @@
using System;
using System.Collections.Generic;
using System.Linq;
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)).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 long InstitutionContractId { get; private set; }
}
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) : base(
workshopName, countPerson, contractAndCheckout, contractAndCheckoutInPerson, insurance, insuranceInPerson,
rollCall, rollCallInPerson, customizeCheckout, price, workshopId, currentWorkshopId)
{
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;
}
}

View File

@@ -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
{

View File

@@ -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;

View File

@@ -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

View File

@@ -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 $"";
}
}
}

View File

@@ -1,4 +1,4 @@
using Company.Domain.InstitutionContractInsertTempAgg;
using Company.Domain.InstitutionContractExtensionTempAgg;
using MongoDB.Driver;
namespace CompanyManagement.Infrastructure.Mongo.InstitutionContractInsertTempRepo;

View File

@@ -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; }
}
}

View File

@@ -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; }
}

View File

@@ -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; }
}
}

View File

@@ -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; }
}
}

View File

@@ -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);
}
}

View File

@@ -90,7 +90,7 @@ public class InquiryContractingPartyBankDetailsRequest
public string CardNumber { get; set; }
public string AccountNumber { get; set; }
public string IBan { get; set; }
public UidBanks UidBank { get; set; }
public UidBanks? UidBank { get; set; }
}
public class ContractingPartyBankInquiryResponse
{

View File

@@ -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 => "ساعت حضور و غیاب";

View File

@@ -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,14 +215,80 @@ 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);
/// <summary>
/// دیتای پرینت قرارداد مالی
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
Task<InstitutionContractPrintViewModel> PrintOneAsync(long id);
}
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;
@@ -241,19 +310,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
{

View File

@@ -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; }
}

View File

@@ -0,0 +1,11 @@
namespace CompanyManagment.App.Contracts.InstitutionContract;
public class InsitutionContractAmendmentPaymentResponse
{
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; }
}

View File

@@ -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
}

View File

@@ -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; }
}

View File

@@ -0,0 +1,8 @@
namespace CompanyManagment.App.Contracts.InstitutionContract;
public class InstitutionContractExtensionPaymentResponse
{
public InstitutionContractPaymentOneTimeViewModel OneTime { get; set; }
public InstitutionContractPaymentMonthlyViewModel Monthly { get; set; }
}

View File

@@ -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; }
}

View File

@@ -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);
}
}
}

View File

@@ -193,7 +193,7 @@ public class ContractingPartyBankAccountsApplication : IContractingPartyBankAcco
}
else if (!string.IsNullOrWhiteSpace(accountNumber))
{
var accountNumberRes = await _uidService.AccountToIban(accountNumber, uidBank);
var accountNumberRes = await _uidService.AccountToIban(accountNumber, uidBank.Value);
if (accountNumberRes.ResponseContext.Status.Code != 0)
{
throw new BadRequestException(

View File

@@ -1340,6 +1340,10 @@ public class EmployerApplication : IEmployerApplication
var workshopDetails =
await _institutionContractRepository.GetInstitutionWorkshopInitialDetails(command
.InstitutionWorkshopInitialId);
if (workshopDetails.Employers.Any(x => x.EmployerId == employer.id))
{
throw new BadRequestException("این کارفرما قبلا در این کارگاه ثبت شده است");
}
workshopDetails.AddEmployer(employer.id);
await _institutionContractRepository.SaveChangesAsync();
@@ -1387,12 +1391,14 @@ public class EmployerApplication : IEmployerApplication
// Get workshop details
var workshopDetails =
await _institutionContractRepository.GetInstitutionWorkshopInitialDetails(institutionWorkshopDetailsId);
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("کارفرما در لیست کارگاه یافت نشد");
@@ -1400,10 +1406,7 @@ public class EmployerApplication : IEmployerApplication
workshopDetails.Employers.Remove(employerDetail);
await _institutionContractRepository.SaveChangesAsync();
// Delete the employer
_EmployerRepository.Remove(employerId);
await _EmployerRepository.SaveChangesAsync();
return operation.Succcedded();
}

View File

@@ -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);

View File

@@ -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,11 +1139,11 @@ public class InstitutionContractApplication : IInstitutionContractApplication
if (res.IsSuccedded)
CreateContractingPartyAccount(contractingParty.id, res.SendId);
await _institutionContractRepository.SaveChangesAsync();
await _smsService.SendInstitutionVerificationLink(contractingParty.Phone, contractingPartyFullName,
entity.PublicId);
await _institutionContractRepository.SaveChangesAsync();
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();
}
@@ -1274,7 +1302,7 @@ public class InstitutionContractApplication : IInstitutionContractApplication
RollCallInPerson = services.RollCallInPerson
},
WorkshopName = details.WorkshopName,
ArchiveCode =newArchiveCode
ArchiveCode = newArchiveCode
};
return res;
}
@@ -1290,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);
}
@@ -1310,6 +1340,53 @@ public class InstitutionContractApplication : IInstitutionContractApplication
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.SendInstitutionVerificationLink(contractingParty.Phone, contractingPartyFullName,
institutionContract.PublicId);
return new OperationResult().Succcedded();
}
public async Task<InstitutionContractPrintViewModel> PrintOneAsync(long id)
{
return (await _institutionContractRepository.PrintAllAsync([id])).FirstOrDefault();
}
private async Task<OperationResult<PersonalContractingParty>> CreateLegalContractingPartyEntity(
CreateInstitutionContractLegalPartyRequest request, long representativeId, string address, string city,
@@ -1350,8 +1427,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);
@@ -1396,7 +1473,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);
@@ -1405,7 +1482,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));
@@ -1513,4 +1590,4 @@ public class WorkshopsAndEmployeeViewModel
public int ArchiveCode { get; set; }
}
#endregion
#endregion

View File

@@ -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;

View File

@@ -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

View File

@@ -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
@@ -309,7 +313,6 @@ public class CompanyContext : DbContext
public DbSet<Employer> Employers { get; set; }
public CompanyContext(DbContextOptions<CompanyContext> options) :base(options)
{

View File

@@ -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);
});
}
}
}

View File

@@ -12,6 +12,8 @@ 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.HasOne(x => x.InstitutionContract)
.WithMany(x => x.Amendments)

View File

@@ -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);

File diff suppressed because it is too large Load Diff

View File

@@ -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");
}
}
}

View File

@@ -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");
}
}
}

View File

@@ -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")
@@ -3173,6 +3205,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 +3249,27 @@ 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>("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");
@@ -6870,6 +6924,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")

View File

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

View File

@@ -592,7 +592,7 @@ public class EmployerRepository : RepositoryBase<long, Employer>, IEmployerRepos
var legalTypeValue = legalType == LegalType.Real ? "حقیقی" : "حقوقی";
query = query.Where(x => x.IsLegal == legalTypeValue);
}
var viewModelQuery = query.Select(x => new EmployerSelectListViewModel()
{
Id = x.id,
@@ -1078,7 +1078,12 @@ public class EmployerRepository : RepositoryBase<long, Employer>, IEmployerRepos
PlaceOfIssue = employer.PlaceOfIssue,
DateOfIssue = employer.DateOfIssue.ToFarsi(),
FatherName = employer.FatherName,
Gender = employer.Gender == "مرد" ? Gender.Male : Gender.Female,
Gender = employer.Gender switch
{
null => Gender.None,
"مرد" => Gender.Male,
_ => Gender.Female
},
GovernmentSystemInfo = governmentSystemInfo,
IsAuth = employer.IsAuth,
PhoneNumber = employer.Phone,
@@ -1110,7 +1115,6 @@ public class EmployerRepository : RepositoryBase<long, Employer>, IEmployerRepos
CeoIdNumber = employer.IdNumber,
IdNumberSeri = employer.IdNumberSeri,
TelephoneNumber = employer.IdNumber
};
}
@@ -1123,7 +1127,6 @@ public class EmployerRepository : RepositoryBase<long, Employer>, IEmployerRepos
InstitutionWorkshopInitialId = contractWorkshopInitial.id,
RealEmployer = realEmployer,
LegalEmployer = legalEmployer,
};
return res;
}

View File

@@ -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;
}

View File

@@ -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,16 +17,19 @@ 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;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
@@ -42,9 +46,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 +71,8 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
_smsService = smsService;
_institutionExtensionTemp =
database.GetCollection<InstitutionContractExtensionTemp>("InstitutionContractExtensionTemp");
_institutionAmendmentTemp =
database.GetCollection<InstitutionContractAmendmentTemp>("InstitutionContractAmendmentTemp");
}
public EditInstitutionContract GetDetails(long id)
@@ -1240,7 +1257,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();
@@ -1267,7 +1283,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);
@@ -1289,6 +1304,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,
@@ -1303,14 +1322,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()
};
@@ -1476,6 +1498,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
@@ -1784,15 +1811,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;
@@ -1820,9 +1839,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
@@ -2035,7 +2056,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,
@@ -2046,7 +2067,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);
@@ -2232,7 +2253,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);
@@ -2242,26 +2263,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))
{
@@ -2275,7 +2295,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(),
@@ -2331,6 +2351,260 @@ 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();
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(),
};
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()
};
}
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);
workshopTemp = newWorkshopTemp;
amendmentTemp.NewWorkshops.Add(newWorkshopTemp);
await _institutionAmendmentTemp
.ReplaceOneAsync(x => x.Id == amendmentTemp.Id, amendmentTemp);
}
else
{
amendmentTemp.NewWorkshops.Remove(workshopTemp);
var differencePrice = price - workshopTemp.Price;
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)
{
@@ -2385,6 +2659,113 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
}
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;
}
private InstitutionContractExtensionPaymentResponse CalculateInPersonPayment(
InstitutionContractExtensionPlanDetail selectedPlan, double baseAmount, double tenPercent,
@@ -2408,7 +2789,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()
{
@@ -2490,7 +2871,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)
{
@@ -2498,7 +2879,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;
@@ -2558,6 +2939,7 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
#endregion
#region CustomViewModels

View File

@@ -1724,9 +1724,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 +1812,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" ? "عادی" :

View File

@@ -1517,7 +1517,9 @@ public class RollCallRepository : RepositoryBase<long, RollCall>, IRollCallRepos
StartDate = y.StartDate.Value.ToString("HH:mm"),
EndDate = y.EndDate!.Value.ToString("HH:mm"),
StartDateGr = y.StartDate.Value,
EndDateGr = y.EndDate.Value
EndDateGr = y.EndDate.Value,
EntryTimeDifferences = CalculateEntryTimeDifferences( y.EarlyEntryDuration, y.LateEntryDuration),
ExitTimeDifferences = CalculateExitTimeDifferences(y.EarlyExitDuration, y.LateExitDuration)
}),
TotalWorkingHoursSpan = new TimeSpan(rollCallsList.Where(y => x.Date == y.ShiftDate.Date)
.Sum(y => (y.EndDate!.Value - y.StartDate.Value).Ticks)),

View File

@@ -1,4 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Net.Http.Json;
using System.Text;
@@ -7,6 +9,7 @@ using Newtonsoft.Json;
using CompanyManagment.App.Contracts.AuthorizedPerson;
using _0_Framework.Application;
using _0_Framework.Application.UID;
using Company.Application.Contracts.AuthorizedBankDetails;
namespace CompanyManagment.EFCore.Services;
@@ -14,19 +17,21 @@ public class UidService : IUidService
{
private readonly HttpClient _httpClient;
private readonly IAuthorizedPersonApplication _authorizedPersonApplication;
private readonly IAuthorizedBankDetailsApplication _authorizedBankDetailsApplication;
private const string BaseUrl = "https://json-api.uid.ir/api/";
public const string BusinessToken = "5e03dd4e-999d-466f-92d8-7c0b1f66a8e9";
public const string BusinessId = "98ed67ca-d441-4978-a748-e8bebce010eb";
public UidService(IAuthorizedPersonApplication authorizedPersonApplication)
public UidService(IAuthorizedPersonApplication authorizedPersonApplication, IAuthorizedBankDetailsApplication authorizedBankDetailsApplication)
{
_httpClient = new HttpClient()
{
BaseAddress = new Uri(BaseUrl)
};
_authorizedPersonApplication = authorizedPersonApplication;
_authorizedBankDetailsApplication = authorizedBankDetailsApplication;
}
public async Task<PersonalInfoResponse> GetPersonalInfo(string nationalCode, string birthDate)
@@ -152,18 +157,94 @@ public class UidService : IUidService
public async Task<IbanInquiryResponse> IbanInquiry(string iban)
{
var request = new
{
iban,
requestContext = new UidRequestContext()
};
var json = JsonConvert.SerializeObject(request);
var contentType = new StringContent(json, Encoding.UTF8, "application/json");
// First check if bank details exist in database
var existingBankDetails = _authorizedBankDetailsApplication.GetByIban(iban);
if (existingBankDetails != null)
{
// Return data from database instead of calling API
return CreateIbanInquiryResponseFromDatabase(existingBankDetails);
}
// If not found in database, call UID API
var request = new
{
iban,
requestContext = new UidRequestContext()
};
var json = JsonConvert.SerializeObject(request);
var contentType = new StringContent(json, Encoding.UTF8, "application/json");
try
{
var requestResult = await _httpClient.PostAsync("inquiry/iban/v2", contentType);
requestResult.EnsureSuccessStatusCode();
//var stringRes =await requestResult.Content.ReadAsStringAsync();
var responseResult = await requestResult.Content.ReadFromJsonAsync<IbanInquiryResponse>();
if (responseResult.ResponseContext.Status.Code == 0)
{
var entity = new CreateAuthorizedBankDetails
{
IBan = iban,
AccountNumber = responseResult?.AccountBasicInformation?.AccountNumber ?? "",
BankName = responseResult?.AccountBasicInformation?.BankInformation?.BankName ?? "",
OwnersList = responseResult?.Owners.Select(x=> new CreateAuthorizedBankDetailsOwner()
{
FName = x.FirstName,
LName = x.LastName,
NationalIdentifier = x.NationalIdentifier,
CustomerType = x.CustomerType
}).ToList() ?? []
};
_authorizedBankDetailsApplication.Create(entity);
}
return responseResult;
}
catch
{
return new IbanInquiryResponse
{
ResponseContext = new ResponseContext(new UidStatus(14, "خطا در دریافت اطلاعات از سرویس"))
};
}
}
private IbanInquiryResponse CreateIbanInquiryResponseFromDatabase(AuthorizedBankDetailsViewModel bankDetails)
{
var accountBasicInfo = new IbanInquiryAccountBasicInformation
{
Iban = bankDetails.IBan,
AccountNumber = bankDetails.AccountNumber,
BankInformation = new IbanInquiryBankInformation
{
BankName = bankDetails.BankName
},
AccountStatus = "Active"
};
var owners = new List<IbanInquiryOwner>();
// Add owner information if available
if (bankDetails.Owners.Any())
{
var owner = bankDetails.Owners.First();
owners.Add(new IbanInquiryOwner
{
NationalIdentifier = owner.NationalIdentifier,
FirstName = owner.FName,
LastName = owner.LName,
CustomerType = owner.CustomerType
});
}
var responseContext = new ResponseContext(new UidStatus(0, "Success - از دیتابیس"));
return new IbanInquiryResponse
{
AccountBasicInformation = accountBasicInfo,
Owners = owners,
ResponseContext = responseContext
};
}
public async Task<AccountToIbanResponse> AccountToIban(string accountNumber, UidBanks bank)

View File

@@ -1,5 +1,6 @@
using System;
using _0_Framework.Application.UID;
using Company.Application.Contracts.AuthorizedBankDetails;
using Company.Domain.BillAgg;
using Company.Domain.Board;
using Company.Domain.ChapterAgg;
@@ -209,6 +210,7 @@ using Company.Domain.ContactUsAgg;
using CompanyManagment.App.Contracts.ContactUs;
using Company.Domain.EmployeeAuthorizeTempAgg;
using Company.Domain.AdminMonthlyOverviewAgg;
using Company.Domain.AuthorizedBankDetailsAgg;
using Company.Domain.ContractingPartyBankAccountsAgg;
using Company.Domain.PaymentInstrumentAgg;
using Company.Domain.PaymentTransactionAgg;
@@ -218,7 +220,7 @@ using CompanyManagment.App.Contracts.PaymentInstrument;
using CompanyManagment.App.Contracts.PaymentTransaction;
using CompanyManagment.App.Contracts.AuthorizedPerson;
using Company.Domain.AuthorizedPersonAgg;
using Company.Domain.InstitutionContractInsertTempAgg;
using Company.Domain.InstitutionContractExtensionTempAgg;
using Company.Domain.LawAgg;
using CompanyManagement.Infrastructure.Mongo.InstitutionContractInsertTempRepo;
using CompanyManagment.App.Contracts.Law;
@@ -472,6 +474,9 @@ public class PersonalBootstrapper
services.AddTransient<ILawApplication,LawApplication>();
services.AddTransient<ILawRepository,LawRepository>();
services.AddTransient<IAuthorizedBankDetailsRepository, AuthorizedBankDetailsRepository>();
services.AddTransient<IAuthorizedBankDetailsApplication, AuthorizedBankDetailsApplication>();
services
.AddTransient<IInstitutionContractExtenstionTempRepository, InstitutionContractExtenstionTempRepository>();
#endregion

View File

@@ -61,8 +61,9 @@ public class DashboardController : AdminBaseController
var taskCount = await _taskApplication.RequestedAndOverdueTasksCount(UserId);
var ticketCount = _ticketApplication.GetAdminTicketsCount();
return new AdminDashboardViewModel(calenderList, taskCount, ticketCount);
return new AdminDashboardViewModel(calenderList, taskCount, ticketCount,todayPersian.Year,todayPersian.MonthOfYear,todayPersian.Day,todayPersian.DayOfWeek);
}
[HttpGet("sms-remaining")]
@@ -75,4 +76,4 @@ public class DashboardController : AdminBaseController
public record SmsRemainingResult(int Data);
public record AdminDashboardViewModel(List<CalenderViewModel> Calender, int TaskCount, int TicketCount);
public record AdminDashboardViewModel(List<CalenderViewModel> Calender, int TaskCount, int TicketCount,int Year,string Month,int Day,string DayOfWeek);

View File

@@ -520,6 +520,236 @@ public class institutionContractController : AdminBaseController
var res =await _institutionContractApplication.ExtensionComplete(request);
return res;
}
[HttpGet("amendment/workshops/{institutionContractId}")]
public async Task<ActionResult<InstitutionContractAmendmentWorkshopsResponse>> GetAmendmentWorkshops(long institutionContractId)
{
var res =await _institutionContractApplication.GetAmendmentWorkshops(institutionContractId);
return res;
}
[HttpPost("resend-verify-link/{institutionContractId}")]
public async Task<OperationResult> ResendVerifyLink(long institutionContractId)
{
var res = await _institutionContractApplication.ResendVerifyLink(institutionContractId);
return res;
}
[HttpPost("amendment/insert-temp-workshops")]
public async Task<ActionResult<InsertAmendmentTempWorkshopResponse>> InsertAmendmentTempWorkshops([FromBody]InstitutionContractAmendmentTempWorkshopViewModel request)
{
var res =await _institutionContractApplication.InsertAmendmentTempWorkshops(request);
return res;
}
[HttpDelete("amendment/remove-temp-workshops/{workshopTempId:guid}")]
public async Task<ActionResult> RemoveAmendmentWorkshops(Guid workshopTempId)
{
await _institutionContractApplication.RemoveAmendmentWorkshops(workshopTempId);
return Ok();
}
[HttpPost("amendment/payment-details")]
public async Task<ActionResult<InsitutionContractAmendmentPaymentResponse>> GetAmendmentPaymentDetails([FromBody]InsitutionContractAmendmentPaymentRequest request)
{
var res =await _institutionContractApplication.GetAmendmentPaymentDetails(request);
return res;
}
[HttpGet("edit-old/{id}")]
public ActionResult<EditInstitutionContract> GetEditOldDetails(long id)
{
var representativList = new List<RepresentativeViewModel>();
var contractingPartyList = new List<PersonalContractingPartyViewModel>();
var res = _institutionContractApplication.GetDetails(id);
var representative = new RepresentativeViewModel
{
Id = res.RepresentativeId,
FullName = res.RepresentativeName
};
representativList.Add(representative);
var contractingParty = new PersonalContractingPartyViewModel
{
id = res.ContractingPartyId,
FullName = _contractingPartyApplication.GetFullName(res.ContractingPartyId)
};
contractingPartyList.Add(contractingParty);
res.RepresentativeSelectList =
new SelectList(representativList, "Id", "FullName");
res.ContractingPartiesSelectList =
new SelectList(contractingPartyList, "id", "FullName");
var employer = _employerApplication.GetEmployerByContracrtingPartyID(res.ContractingPartyId);
var emplId = employer.Select(x => x.Id).ToList();
var w = _workshopApplication.GetWorkshopsByEmployerId(emplId);
var workshopIds = w.Select(x => x.Id).ToList();
var workshopCount = Convert.ToString(w.Count);
var pCount = 0;
if (workshopIds.Count > 0)
{
foreach (var workshopId in workshopIds)
{
var p = _workshopApplication.PersonnelCount(workshopId);
pCount += p;
}
res.EmployeeCount = Convert.ToString(pCount);
}
else
{
res.EmployeeCount = "0";
}
res.WorkshopCount = workshopCount;
var contactInfo = _contactInfoApplication.GetContactInfolist(id);
if (contactInfo.Count > 0)
{
res.ContactInfoCounter = contactInfo.Count;
res.ContactInformationList = contactInfo;
}
else
{
res.ContactInfoCounter = 0;
}
if (res.HasValueAddedTax == "true")
{
res.ContractAmount -= res.ValueAddedTax;
res.ContractAmountOAlone = res.ContractAmount.ToMoney();
res.ValueAddedTaxStr = res.ValueAddedTax.ToMoney();
}
else
{
res.ContractAmountOAlone = res.ContractAmountString;
res.ValueAddedTaxStr = "0";
}
return res;
}
[HttpPost("edit-old")]
public ActionResult<OperationResult> EditOld([FromBody] EditInstitutionContract command)
{
var op = new OperationResult();
var phoneNumber = command.ContactInformationList.FirstOrDefault(x =>
x.SendSmsString == "true" && x.Position == "طرف قرارداد" && x.PhoneType == "شماره همراه");
var conractingParty = _contractingPartyApplication.GetDetails(command.ContractingPartyId);
if (conractingParty.IsLegal == "حقیقی" && string.IsNullOrWhiteSpace(conractingParty.Nationalcode))
return new JsonResult(op.Failed("کد ملی طرف حساب وجود ندارد"));
if (conractingParty.IsLegal == "حقوقی" && string.IsNullOrWhiteSpace(conractingParty.NationalId))
return new JsonResult(op.Failed("شناسه ملی طرف حساب وجود ندارد"));
if (phoneNumber == null)
return new JsonResult(op.Failed("تعیین شماره همراه با سمت طرف قرارداد اجباریست"));
//if (string.IsNullOrWhiteSpace(command.HasValueAddedTax))
// command.HasValueAddedTax = "false";
var result = _institutionContractApplication.Edit(command);
var contractingPartyId = _institutionContractApplication.GetDetails(result.SendId);
var counter = command.ContactInformationList.Count;
var getOldContarct = _institutionContractApplication.NewSearch(new InstitutionContractSearchModel()
{ ContractingPartyId = contractingPartyId.ContractingPartyId, IsActiveString = "both" }).Where(x=>x.IsActiveString == "false" || x.IsActiveString == "blue").ToList();
if (result.IsSuccedded && counter > 0)
{
if (getOldContarct.Count > 0)
{
foreach (var item in getOldContarct)
{
_contactInfoApplication.RemoveContactInfo(item.Id);
foreach (var phone in command.ContactInformationList)
{
if (phone.PhoneNumber != null)
{
var contactinfo = new CreateContactInfo
{
InstitutionContractId = item.Id,
PhoneType = phone.PhoneType,
Position = phone.Position,
PhoneNumber = phone.PhoneNumber,
FnameLname = phone.FnameLname,
SendSms = phone.SendSmsString == "true" ? true : false
};
_contactInfoApplication.Create(contactinfo);
}
Thread.Sleep(500);
}
}
}
_contactInfoApplication.RemoveContactInfo(command.Id);
foreach (var item in command.ContactInformationList)
{
if (item.PhoneNumber != null)
{
var contactinfo = new CreateContactInfo
{
InstitutionContractId = result.SendId,
PhoneType = item.PhoneType,
Position = item.Position,
PhoneNumber = item.PhoneNumber,
FnameLname = item.FnameLname,
SendSms = item.SendSmsString == "true" ? true : false
};
_contactInfoApplication.Create(contactinfo);
}
Thread.Sleep(500);
}
//ساخت اکانت کلاینت
var userPass = conractingParty.IsLegal == "حقیقی"
? conractingParty.Nationalcode
: conractingParty.NationalId;
var checkExistAccount = _accountApplication.CheckExistClientAccount(userPass);
if (!checkExistAccount)
{
var createAcc = new RegisterAccount
{
Fullname = conractingParty.LName,
Username = userPass,
Password = userPass,
Mobile = phoneNumber.PhoneNumber,
NationalCode = userPass
};
var res = _accountApplication.RegisterClient(createAcc);
if (res.IsSuccedded)
_institutionContractApplication.CreateContractingPartyAccount(command.ContractingPartyId, res.SendId);
}
}
//Thread.Sleep(500);
//for (int i = 0; i <= counter - 1; i++)
//{
// if (command.ContactInformationList[i].PhoneNumber != null)
// {
// var contactinfo = new CreateContactInfo()
// {
// InstitutionContractId = result.SendId,
// PhoneType = command.ContactInformationList[i].PhoneType,
// Position = command.ContactInformationList[i].Position,
// PhoneNumber = command.ContactInformationList[i].PhoneNumber,
// FnameLname = command.ContactInformationList[i].FnameLname,
// SendSms = command.ContactInformationList[i].SendSmsString == "true" ? true : false
// };
// _contactInfoApplication.Create(contactinfo);
// }
// Thread.Sleep(500);
//}
return result;
}
[HttpGet("print/{id}")]
public async Task<ActionResult<InstitutionContractPrintViewModel>> PrintOne(long id)
{
var res =await _institutionContractApplication.PrintOneAsync(id);
return res;
}
}

View File

@@ -871,6 +871,14 @@
</div>
<div class="child-check level2">
<label class="btn btn-icon waves-effect btn-default m-b-5 open-close">
<i class="ion-plus"></i> <i class="ion-minus" style="display: none;"></i><input type="checkbox" style="display: none" class="open-btn" />
</label>
<label class="btn btn-inverse waves-effect waves-light m-b-5 parentLevel2"> <input type="checkbox" disabled="disabled" value="1004" class="check-btn"> &nbsp;<span style="bottom: 2px;position: relative"> قرارداد های مالی </span> </label>
</div>
</div>
@* بررسی مدارک پرسنل *@
<div class="parent-check">

View File

@@ -881,6 +881,15 @@
</div>
<div class="child-check level2">
<label class="btn btn-icon waves-effect btn-default m-b-5 open-close">
<i class="ion-plus"></i> <i class="ion-minus" style="display: none;"></i><input type="checkbox" style="display: none" class="open-btn" />
</label>
<label class="btn btn-inverse waves-effect waves-light m-b-5 parentLevel2"> <input type="checkbox" disabled="disabled" value="1004" class="check-btn"> &nbsp;<span style="bottom: 2px;position: relative"> قرارداد های مالی </span> </label>
</div>
</div>
@* بررسی مدارک پرسنل *@
<div class="parent-check">

View File

@@ -195,7 +195,7 @@
<div class="rollcall-list Rtable Rtable--5cols Rtable--collapse px-1">
<div class="w-100 my-1">
<div class="absenceHeadColorTop" style="border-radius: 10px 10px 0 0;">غیبت</div>
<div class="absenceHeadColorTop" style="border-radius: 10px 10px 0 0;">عدم حضور</div>
<div class="Rtable-row Rtable-row--head align-items-center d-flex table-rollcall-absent absenceHeadColor">
<div class="Rtable-cell column-heading width1">ردیف</div>
<div class="Rtable-cell column-heading width2">نام پرسنل</div>
@@ -328,7 +328,7 @@
<div class="btnsRollCallOnlline">
<button class="btnRollCallStatus active" onclick="loadRollCallStatus('all')">آنلاین</button>
<button class="btnRollCallStatus" onclick="loadRollCallStatus('leave')">مرخصی <span id="leaveCount"></span></button>
<button class="btnRollCallStatus" onclick="loadRollCallStatus('absent')">غیبت <span id="absentCount"></span></button>
<button class="btnRollCallStatus" onclick="loadRollCallStatus('absent')">عدم حضور <span id="absentCount"></span></button>
</div>
</div>
<div class="wrapper">

View File

@@ -1,5 +1,9 @@
@page
@using _0_Framework.Application
@using Microsoft.Extensions.Options
@model ServiceHost.Areas.AdminNew.Pages.Company.WorkFlow.IndexModel
@inject IOptions<AppSettingConfiguration> AppSetting;
@{
}
@@ -122,6 +126,22 @@
</div>
</a>
</div>
<div class="gwb-card" permission="1004">
<a href="https://admin@(AppSetting.Value.Domain)/workflow/institution-contract" class="click loadingButton">
<div class="d-flex align-items-center justify-content-between p-1 w-100">
<div class="d-flex align-items-center">
<img src="~/AssetsClient/images/insuranceList.png" alt="" class="img-fluid mx-1" width="50px" />
<div class="text-start ms-1">
<div class="card-title">قرارداد های مالی</div>
</div>
</div>
</div>
<div class="spinner-loading loading" style="display: none;">
<span class="spinner-border spinner-border-sm loading text-white" role="status" aria-hidden="true"></span>
</div>
</a>
</div>
@* <div class="gwb-card">
<a asp-page="/Company/WorkFlow/Insurance" class="click loadingButton">

View File

@@ -231,7 +231,7 @@
<div class="day-off-parent">
<div class="day-off-title mb-2">
روزهای تعطیل هفته
روزهای فعالیت مجموعه
</div>
<div class="day-off-button-container mb-3">

View File

@@ -382,7 +382,9 @@ namespace ServiceHost.Areas.Client.Pages.Company.RollCall
IsAbsent = x.IsAbsent,
TotalWorkingHours = x.TotalWorkingHours,
StartsItems = string.Join(Environment.NewLine, x.RollCallTimesList.Select(tr=>tr.StartDate)),
EndsItems= string.Join(Environment.NewLine, x.RollCallTimesList.Select(tr=>tr.EndDate))
EndsItems= string.Join(Environment.NewLine, x.RollCallTimesList.Select(tr=>tr.EndDate)),
EnterTimeDifferences = string.Join(Environment.NewLine, x.RollCallTimesList.Select(tr=>tr.EntryTimeDifferences)),
ExitTimeDifferences = string.Join(Environment.NewLine, x.RollCallTimesList.Select(tr=>tr.ExitTimeDifferences))
}).ToList()
};

View File

@@ -234,7 +234,7 @@
<div class="rollcall-list Rtable Rtable--5cols Rtable--collapse px-1">
<div class="w-100 my-1">
<div class="absenceHeadColorTop" style="border-radius: 10px 10px 0 0;">غیبت</div>
<div class="absenceHeadColorTop" style="border-radius: 10px 10px 0 0;">عدم حضور</div>
<div class="Rtable-row Rtable-row--head align-items-center d-flex table-rollcall-absent absenceHeadColor">
<div class="Rtable-cell column-heading width1">ردیف</div>
<div class="Rtable-cell column-heading width2">نام پرسنل</div>
@@ -367,7 +367,7 @@
<div class="btnsRollCallOnlline">
<button class="btnRollCallStatus active" onclick="loadRollCallStatus('all')">آنلاین</button>
<button class="btnRollCallStatus" onclick="loadRollCallStatus('leave')">مرخصی <span id="leaveCount"></span></button>
<button class="btnRollCallStatus" onclick="loadRollCallStatus('absent')">غیبت <span id="absentCount"></span></button>
<button class="btnRollCallStatus" onclick="loadRollCallStatus('absent')">عدم حضور <span id="absentCount"></span></button>
</div>
</div>
<div class="wrapper">

View File

@@ -223,7 +223,7 @@
<div class="day-off-parent">
<div class="day-off-title mb-2">
روزهای تعطیل هفته
روزهای فعالیت مجموعه
</div>
<div class="day-off-button-container mb-3">

View File

@@ -383,7 +383,7 @@
<div class="day-off-parent">
<div class="day-off-title mb-2">
روزهای تعطیل هفته
روزهای فعالیت مجموعه
</div>
<div class="day-off-button-container mb-3">

View File

@@ -393,7 +393,7 @@
<div class="day-off-parent">
<div class="day-off-title mb-2">
روزهای تعطیل هفته
روزهای فعالیت مجموعه
</div>
<div class="day-off-button-container mb-3">

View File

@@ -17,7 +17,7 @@
<button type="button" class="btn-close position-absolute text-start" data-bs-dismiss="modal" aria-label="Close"></button>
<h6 class="m-0">پرینت حضور و غیاب انفرادی @Model.PersianMonthName ماه @Model.PersianYear</h6>
</div>
```````
<div class="modal-body" id="divTablescrollbar">
<div class="row main-table">
@@ -121,7 +121,17 @@
<span class="m-0">@item.DateFa</span>
</td>
<td style="font-family: 'IranText' !important; font-size: 10px !important; text-align: center">
-
@if (item.RollCallTimesList.Any())
{
@foreach (var rollCallItem in item.RollCallTimesList)
{
<div>@(rollCallItem.EntryTimeDifferences ?? "-")</div>
}
}
else
{
<span>-</span>
}
</td>
<td style="font-family: 'IranText' !important; font-size: 10px !important; text-align: center">
@if (item.RollCallTimesList.Any())
@@ -150,7 +160,17 @@
}
</td>
<td style="font-family: 'IranText' !important; font-size: 10px !important; text-align: center">
-
@if (item.RollCallTimesList.Any())
{
@foreach (var rollCallItem in item.RollCallTimesList)
{
<div>@(rollCallItem.ExitTimeDifferences ?? "-")</div>
}
}
else
{
<span>-</span>
}
</td>
<td style="font-family: 'IranText' !important; font-size: 10px !important; text-align: center">
@item.TotalWorkingHours

View File

@@ -90,7 +90,7 @@
<div class="day-off-parent">
<div class="day-off-title mb-2">
روزهای تعطیل هفته
روزهای فعالیت مجموعه
</div>
<div class="day-off-button-container mb-3">

View File

@@ -154,7 +154,7 @@
<div class="day-off-parent">
<div class="day-off-title mb-2">
روزهای تعطیل هفته
روزهای فعالیت مجموعه
</div>
<div class="day-off-button-container mb-3">

View File

@@ -218,7 +218,7 @@
<div class="day-off-parent mb-4">
<div class="day-off-title mb-2">
روزهای تعطیل هفته
روزهای فعالیت مجموعه
</div>
<div class="day-off-button-container mb-3">

View File

@@ -168,7 +168,7 @@
<div class="day-off-parent">
<div class="day-off-title mb-2">
روزهای تعطیل هفته
روزهای فعالیت مجموعه
</div>
<div class="day-off-button-container mb-3">

View File

@@ -71,7 +71,7 @@
<li class="active" data-menu="absent">
<div class="d-flex align-items-center justify-content-between" id="clickAbsentTab">
<a href="javascript:void(0);">غیبت</a>
<a href="javascript:void(0);">عدم حضور</a>
<div>
<div id="CountAbsentLoading" class="spinner-grow text-danger" role="status" style="align-items: center;justify-content: center;display: flex;margin: 0 0 0 9px;">
<span class="visually-hidden">Loading...</span>
@@ -218,7 +218,7 @@
<div class="Rtable-row SubAccountRowMobile align-items-center position-relative openAction">
<div class="Rtable-cell d-md-block d-flex width2">
<div class="Rtable-cell--content text-start">
<div class="roleName">غیبت</div>
<div class="roleName">عدم حضور</div>
</div>
</div>
<div>

View File

@@ -420,7 +420,7 @@ input:checked + .sliderEUP:before {
background-color: #ffffff;
background: rgba(209, 50, 50, 0.15);
transition: ease .2s;
width: 55px;
/*width: 55px;*/
}
.btn-workflow-rollcall-edit {

View File

@@ -292,7 +292,7 @@ function loadEmployeeListByWorkFlowsAbsents(date) {
</button>
<button type="button" class="btn-workflow-absent" onclick="confirmAbsentAlert(${rollCallItem.employeeId}, '${data.dateTimeFa}')">
<span class="mx-1">غیبت</span>
<span class="mx-1 text-nowrap">عدم حضور</span>
</button>
<button class="btn-workflow-rollcall-edit position-relative" onclick="showModalEditRollCall(${rollCallItem.employeeId}, '${data.dateTimeFa}')">
@@ -1028,7 +1028,7 @@ function showModalEditLeave(leaveId) {
function confirmAbsentAlert(employeeId, dateFa) {
swal({
title: "آیا از تایید این غیبت اطمینان دارید؟",
title: "آیا از تایید این عدم حضور اطمینان دارید؟",
text: "",
type: "warning",
showCancelButton: true,