Compare commits

...

17 Commits

Author SHA1 Message Date
49c88e68d2 feat: implement Yekta checkout Excel generation and add view model 2025-12-22 15:51:57 +03:30
12fab5a9a5 add {id:guid} convention for controllers 2025-12-20 20:57:34 +03:30
20dd8f64f4 add: include OneMonthWithoutTax and OneMonthTax properties in InstitutionContractPrintViewModel 2025-12-20 20:28:08 +03:30
b827493306 refactor: remove unused discount-related classes from IInstitutionContractApplicationpnpm 2025-12-20 20:12:31 +03:30
04c65eae93 Merge branch 'Feature/institution-contract/print'
# Conflicts:
#	CompanyManagment.App.Contracts/InstitutionContract/IInstitutionContractApplication.cs
2025-12-20 20:10:30 +03:30
b4526a4338 Merge branch 'Feature/institution-contract/verify-mannually' 2025-12-20 20:09:13 +03:30
2d879ce80a fix: update workshop identification logic in InstitutionContractApplication 2025-12-20 20:06:28 +03:30
56e79d2099 fix: correct ContractAmountWithTax calculation for old contracts 2025-12-20 19:38:32 +03:30
93891f3837 add one month more details for InstitutionContract.cs print 2025-12-20 19:18:27 +03:30
SamSys
5bdfbc572b add next deploy and contractingParty add to workshop on AndroidApk page 2025-12-20 18:42:53 +03:30
4385a65cbc feat: add manual verification endpoint for institution contracts 2025-12-20 18:27:59 +03:30
722f8dae7c feat: implement manual verification for institution contracts and add signing type handling 2025-12-20 18:27:17 +03:30
SamSys
07113353c4 add uploadFrontEnd btn to AndroidApk page 2025-12-20 16:01:07 +03:30
8c6336b9bd fix: correct IsOldContract logic to properly identify old contracts 2025-12-20 14:35:02 +03:30
20e3d454cf feat: add ContractAmountWithTax calculation and update related references 2025-12-20 13:35:52 +03:30
2bf31db6b2 fix: enhance parameter binding logic for route parameters 2025-12-20 12:05:34 +03:30
7a4a6de84f feat: add OneMonthPrice to institution contract details 2025-12-20 10:56:36 +03:30
33 changed files with 12279 additions and 197 deletions

View File

@@ -98,6 +98,11 @@ public class InstitutionContract : EntityBase
// مبلغ قرارداد
public double ContractAmount { get; private set; }
public double ContractAmountWithTax => !IsOldContract ? ContractAmount + ContractAmountTax
: ContractAmount;
public double ContractAmountTax => ContractAmount*0.10;
//خسارت روزانه
public double DailyCompenseation { get; private set; }
@@ -159,6 +164,10 @@ public class InstitutionContract : EntityBase
public List<InstitutionContractAmendment> Amendments { get; private set; }
public InstitutionContractSigningType? SigningType { get; private set; }
public bool IsOldContract => LawId== 0;
public InstitutionContract()
{
ContactInfoList = [];
@@ -262,6 +271,10 @@ public class InstitutionContract : EntityBase
{
WorkshopGroup = null;
}
public void SetSigningType(InstitutionContractSigningType signingType)
{
SigningType = signingType;
}
}
public class InstitutionContractAmendment : EntityBase

View File

@@ -10,13 +10,15 @@ public class InstitutionContractWorkshopCurrent:InstitutionContractWorkshopBase
public InstitutionContractWorkshopCurrent(string workshopName, bool hasRollCallPlan,
bool hasRollCallPlanInPerson, bool hasCustomizeCheckoutPlan, bool hasContractPlan,
bool hasContractPlanInPerson, bool hasInsurancePlan, bool hasInsurancePlanInPerson,
int personnelCount, double price,long institutionContractWorkshopGroupId,InstitutionContractWorkshopGroup workshopGroup,long workshopId) : base(workshopName, hasRollCallPlan,
int personnelCount, double price,long institutionContractWorkshopGroupId,
InstitutionContractWorkshopGroup workshopGroup,long workshopId,long initialWorkshopId) : base(workshopName, hasRollCallPlan,
hasRollCallPlanInPerson, hasCustomizeCheckoutPlan, hasContractPlan,
hasContractPlanInPerson, hasInsurancePlan, hasInsurancePlanInPerson, personnelCount, price)
{
InstitutionContractWorkshopGroupId = institutionContractWorkshopGroupId;
WorkshopGroup = workshopGroup;
WorkshopId = workshopId;
InitialWorkshopId = initialWorkshopId;
}
public long InstitutionContractWorkshopGroupId { get; private set; }
public InstitutionContractWorkshopGroup WorkshopGroup { get; private set; }

View File

@@ -37,4 +37,10 @@ public class InstitutionContractWorkshopGroup : EntityBase
CurrentWorkshops = updatedDetails.ToList();
LastModifiedDate = DateTime.Now;
}
public void AddCurrentWorkshop(InstitutionContractWorkshopCurrent currentWorkshop)
{
CurrentWorkshops.Add(currentWorkshop);
LastModifiedDate = DateTime.Now;
}
}

View File

@@ -31,7 +31,7 @@ public class InstitutionContractWorkshopInitial:InstitutionContractWorkshopBase
WorkshopCreated = true;
WorkshopCurrent = new InstitutionContractWorkshopCurrent(WorkshopName,Services.RollCall,Services.RollCallInPerson,
Services.CustomizeCheckout,Services.Contract,Services.ContractInPerson,Services.Insurance,
Services.InsuranceInPerson,PersonnelCount,Price,InstitutionContractWorkshopGroupId,WorkshopGroup,workshopId);
Services.InsuranceInPerson,PersonnelCount,Price,InstitutionContractWorkshopGroupId,WorkshopGroup,workshopId,id);
WorkshopCurrent.SetEmployers(Employers.Select(x=>x.EmployerId).ToList());
}

View File

@@ -316,7 +316,10 @@ public class Workshop : EntityBase
IsStaticCheckout = isStaticCheckout;
}
public void AddContractingPartyId(long contractingPartyId)
{
ContractingPartyId = contractingPartyId;
}
public void Active(string archiveCode)
{
this.IsActive = true;

View File

@@ -0,0 +1,142 @@
using _0_Framework.Application;
using OfficeOpenXml;
using OfficeOpenXml.Style;
namespace CompanyManagement.Infrastructure.Excel.Checkout;
public class YektaTejaratCheckout
{
private static readonly Dictionary<string, string> Header = new()
{
{ "FullName", "نام و نام خانوادگی" },
{ "NationalCode", "کد ملی" },
{ "StaticPayableAmount", "مبلغ قابل پرداخت استاتیک" },
{ "AttendancePayableAmount", "مبلغ قابل پرداخت حضور غیاب" }
};
public static byte[] GenerateYektaTejaratCheckoutExcel(List<YektaTejaratCheckoutViewModel> data)
{
ExcelPackage.License.SetNonCommercialOrganization("Gozareshgir Noncommercial organization");
using var package = new ExcelPackage();
var worksheet = package.Workbook.Worksheets.Add("Sheet1");
// Add row index header
var indexCell = worksheet.Cells[1, 1];
indexCell.Value = "ردیف";
ApplyHeaderStyle(indexCell);
// Add headers to worksheet
for (int i = 0; i < Header.Count; i++)
{
worksheet.Cells[1, i + 2].Value = Header.ElementAt(i).Value;
ApplyHeaderStyle(worksheet.Cells[1, i + 2]);
}
// Add data rows
var dataRow = 2;
foreach (var item in data)
{
// Row number
var rowCounter = worksheet.Cells[dataRow, 1];
rowCounter.Value = dataRow - 1;
ApplyGeneralDataStyle(rowCounter);
ApplySpecificStyle(rowCounter, 1);
var column = 2;
foreach (var header in Header)
{
var property = item.GetType().GetProperty(header.Key);
var value = property?.GetValue(item, null)?.ToString();
// Check if the property requires MoneyToDouble()
if (RequiresMoneyToDouble(property?.Name))
{
worksheet.Cells[dataRow, column].Value = MoneyToDouble(value);
}
else
{
worksheet.Cells[dataRow, column].Value = value;
}
ApplyGeneralDataStyle(worksheet.Cells[dataRow, column]);
ApplySpecificStyle(worksheet.Cells[dataRow, column], column);
column++;
}
dataRow++;
}
// Auto-fit columns and set print settings
worksheet.Cells[worksheet.Dimension.Address].AutoFitColumns();
worksheet.PrinterSettings.PaperSize = ePaperSize.A4;
worksheet.PrinterSettings.Orientation = eOrientation.Portrait;
worksheet.PrinterSettings.FitToPage = true;
worksheet.PrinterSettings.FitToWidth = 1;
worksheet.PrinterSettings.FitToHeight = 0;
worksheet.View.RightToLeft = true;
return package.GetAsByteArray();
}
// Method to check if a property requires MoneyToDouble()
private static bool RequiresMoneyToDouble(string propertyName)
{
var propertiesRequiringConversion = new HashSet<string>
{
"StaticPayableAmount", "AttendancePayableAmount"
};
return propertiesRequiringConversion.Contains(propertyName);
}
// Convert money string to double
private static double MoneyToDouble(string value)
{
if (string.IsNullOrEmpty(value))
return 0;
var min = value.Length > 1 ? value.Substring(0, 2) : "";
var result = min == "\u200e\u2212" ? value.MoneyToDouble() * -1 : value.MoneyToDouble();
return result;
}
private static void ApplyHeaderStyle(ExcelRange cell)
{
cell.Style.Font.Bold = true;
cell.Style.Fill.PatternType = ExcelFillStyle.Solid;
cell.Style.Fill.BackgroundColor.SetColor(System.Drawing.Color.LightGray);
cell.Style.HorizontalAlignment = ExcelHorizontalAlignment.Center;
cell.Style.Border.BorderAround(ExcelBorderStyle.Thin);
}
private static void ApplyGeneralDataStyle(ExcelRange cell)
{
cell.Style.Border.BorderAround(ExcelBorderStyle.Thin);
cell.Style.HorizontalAlignment = ExcelHorizontalAlignment.Center;
cell.Style.VerticalAlignment = ExcelVerticalAlignment.Center;
cell.Style.Fill.PatternType = ExcelFillStyle.Solid;
}
private static void ApplySpecificStyle(ExcelRange cell, int columnIndex)
{
switch (columnIndex)
{
case 1: // ردیف
cell.Style.Fill.BackgroundColor.SetColor(System.Drawing.Color.LightGray);
break;
case 2: // نام و نام خانوادگی
case 3: // کد ملی
cell.Style.Fill.BackgroundColor.SetColor(System.Drawing.Color.LightYellow);
break;
case 4: // مبلغ قابل پرداخت استاتیک
cell.Style.Fill.BackgroundColor.SetColor(1, 208, 248, 208); // Light green
cell.Style.Numberformat.Format = "#,##0";
break;
case 5: // مبلغ قابل پرداخت حضور غیاب
cell.Style.Fill.BackgroundColor.SetColor(1, 168, 186, 254); // Light blue
cell.Style.Numberformat.Format = "#,##0";
break;
}
}
}

View File

@@ -0,0 +1,10 @@
namespace CompanyManagement.Infrastructure.Excel.Checkout;
public class YektaTejaratCheckoutViewModel
{
public required string FullName { get; set; }
public required string NationalCode { get; set; }
public required string StaticPayableAmount { get; set; }
public required string AttendancePayableAmount { get; set; }
}

View File

@@ -0,0 +1,17 @@
namespace CompanyManagment.App.Contracts.InstitutionContract;
public enum InstitutionContractSigningType
{
/// <summary>
/// قدیمی
/// </summary>
Legacy = 0,
/// <summary>
/// الکترونیکی با کد یکبار مصرف
/// </summary>
OtpBased = 1,
/// <summary>
/// به صورت فیزیکی
/// </summary>
Physical = 2
}

View File

@@ -7,7 +7,6 @@ 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;
@@ -260,154 +259,13 @@ public interface IInstitutionContractApplication
/// <returns></returns>
Task<InstitutionContractPrintViewModel> PrintOneAsync(long id);
Task<OperationResult> SetPendingWorkflow(long entityId);
Task<OperationResult> SetPendingWorkflow(long entityId,InstitutionContractSigningType signingType);
Task<long> GetIdByInstallmentId(long installmentId);
}
public class InstitutionContractDiscountResponse
{
public InstitutionContractDiscountOneTimeViewModel OneTime { get; set; }
public InstitutionContractDiscountMonthlyViewModel Monthly { get; set; }
}
public class InstitutionContractDiscountMonthlyViewModel:InstitutionContractDiscountOneTimeViewModel
{
public List<MonthlyInstallment> Installments { get; set; }
}
public class InstitutionContractDiscountOneTimeViewModel
{
/// <summary>
/// مجموع مبالغ
/// تایید قرارداد مالی به صورت دستی
/// </summary>
public string TotalAmount { get; set; }
/// <summary>
/// ارزش افزوده
/// </summary>
public string Tax { get; set; }
/// <summary>
/// مبلغ قابل پرداخت
/// </summary>
public string PaymentAmount { get; set; }
public string DiscountedAmount { get; set; }
public int DiscountPercetage { get; set; }
/// <param name="institutionContractId"></param>
/// <returns></returns>
Task<OperationResult> VerifyInstitutionContractManually(long institutionContractId);
public string Obligation { get; set; }
public string OneMonthAmount { get; set; }
}
public class InstitutionContractResetDiscountForCreateRequest
{
public int DiscountPercentage { get; set; }
public double TotalAmount { get; set; }
public bool IsInstallment { get; set; }
public InstitutionContractDuration Duration { get; set; }
public double OneMonthAmount { get; set; }
}
public class InstitutionContractSetDiscountForExtensionRequest
{
public Guid TempId { get; set; }
public int DiscountPercentage { get; set; }
public double TotalAmount { get; set; }
public bool IsInstallment { get; set; }
}
public class InstitutionContractResetDiscountForExtensionRequest
{
public Guid TempId { get; set; }
public bool IsInstallment { get; set; }
}
public class InstitutionContractSetDiscountRequest
{
public int DiscountPercentage { get; set; }
public double TotalAmount { get; set; }
public InstitutionContractDuration Duration { get; set; }
public double OneMonthAmount { get; set; }
public bool IsInstallment { get; set; }
}
public class InstitutionContractPrintViewModel
{
public InstitutionContratVerificationParty FirstParty { get; set; }
public InstitutionContratVerificationParty SecondParty { get; set; }
public string ContractNo { get; set; }
public string CreationDate { get; set; }
public string ContractStart { get; set; }
public string ContractEnd { get; set; }
public List<GetInstitutionVerificationDetailsWorkshopsViewModel> Workshops { get; set; }
public string TotalPrice { get; set; }
public string TaxPrice { get; set; }
public string PaymentPrice { get; set; }
public string VerifyCode { get; set; }
public string VerifyDate { get; set; }
public string VerifyTime { get; set; }
public string VerifierFullName { get; set; }
public string VerifierPhoneNumber { get; set; }
public LawViewModel LawViewModel { get; set; }
public string Obligation { get; set; }
}
public class InsertAmendmentTempWorkshopResponse
{
public Guid WorkshopTempId { get; set; }
public string Amount { get; set; }
}
public class InstitutionContractAmendmentWorkshopsResponse
{
/// <summary>
///
/// </summary>
public List<InstitutionContractAmendmentTempWorkshopViewModel> Workshops { get; set; }
public Guid TempId { get; set; }
}
public class InstitutionContractSelectListViewModel : SelectListViewModel;
public class InstitutionContractExtensionInquiryResponse
{
public long Id { get; set; }
public string FName { get; set; }
public string LName { get; set; }
public string DateOfBirthFa { get; set; }
public string FatherName { get; set; }
public string IdNumberSerial { get; set; }
public string IdNumber { get; set; }
public string Address { get; set; }
public string Phone { get; set; }
public string City { get; set; }
public string State { get; set; }
public long RepresentativeId { get; set; }
public string NationalCode { get; set; }
}
public class InstitutionContractExtensionPaymentMonthly:InstitutionContractExtensionPaymentOneTime
{
public List<MonthlyInstallment> Installments { get; set; }
}
public class InstitutionContractExtensionPaymentOneTime
{
/// <summary>
/// مجموع مبالغ
/// </summary>
public string TotalAmount { get; set; }
/// <summary>
/// ارزش افزوده
/// </summary>
public string Tax { get; set; }
/// <summary>
/// مبلغ قابل پرداخت
/// </summary>
public string PaymentAmount { get; set; }
}

View File

@@ -0,0 +1,9 @@
using System;
namespace CompanyManagment.App.Contracts.InstitutionContract;
public class InsertAmendmentTempWorkshopResponse
{
public Guid WorkshopTempId { get; set; }
public string Amount { get; set; }
}

View File

@@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
namespace CompanyManagment.App.Contracts.InstitutionContract;
public class InstitutionContractAmendmentWorkshopsResponse
{
/// <summary>
///
/// </summary>
public List<InstitutionContractAmendmentTempWorkshopViewModel> Workshops { get; set; }
public Guid TempId { get; set; }
}

View File

@@ -0,0 +1,38 @@
using System.Collections.Generic;
using CompanyManagment.App.Contracts.TemporaryClientRegistration;
namespace CompanyManagment.App.Contracts.InstitutionContract;
public class InstitutionContractDiscountResponse
{
public InstitutionContractDiscountOneTimeViewModel OneTime { get; set; }
public InstitutionContractDiscountMonthlyViewModel Monthly { get; set; }
}
public class InstitutionContractDiscountMonthlyViewModel:InstitutionContractDiscountOneTimeViewModel
{
public List<MonthlyInstallment> Installments { get; set; }
}
public class InstitutionContractDiscountOneTimeViewModel
{
/// <summary>
/// مجموع مبالغ
/// </summary>
public string TotalAmount { get; set; }
/// <summary>
/// ارزش افزوده
/// </summary>
public string Tax { get; set; }
/// <summary>
/// مبلغ قابل پرداخت
/// </summary>
public string PaymentAmount { get; set; }
public string DiscountedAmount { get; set; }
public int DiscountPercetage { get; set; }
public string Obligation { get; set; }
public string OneMonthAmount { get; set; }
}

View File

@@ -0,0 +1,18 @@
namespace CompanyManagment.App.Contracts.InstitutionContract;
public class InstitutionContractExtensionInquiryResponse
{
public long Id { get; set; }
public string FName { get; set; }
public string LName { get; set; }
public string DateOfBirthFa { get; set; }
public string FatherName { get; set; }
public string IdNumberSerial { get; set; }
public string IdNumber { get; set; }
public string Address { get; set; }
public string Phone { get; set; }
public string City { get; set; }
public string State { get; set; }
public long RepresentativeId { get; set; }
public string NationalCode { get; set; }
}

View File

@@ -0,0 +1,24 @@
using System.Collections.Generic;
using CompanyManagment.App.Contracts.TemporaryClientRegistration;
namespace CompanyManagment.App.Contracts.InstitutionContract;
public class InstitutionContractExtensionPaymentMonthly:InstitutionContractExtensionPaymentOneTime
{
public List<MonthlyInstallment> Installments { get; set; }
}
public class InstitutionContractExtensionPaymentOneTime
{
/// <summary>
/// مجموع مبالغ
/// </summary>
public string TotalAmount { get; set; }
/// <summary>
/// ارزش افزوده
/// </summary>
public string Tax { get; set; }
/// <summary>
/// مبلغ قابل پرداخت
/// </summary>
public string PaymentAmount { get; set; }
}

View File

@@ -0,0 +1,28 @@
using System.Collections.Generic;
using CompanyManagment.App.Contracts.Law;
namespace CompanyManagment.App.Contracts.InstitutionContract;
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 OneMonthPrice { 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 string OneMonthWithoutTax { get; set; }
public string OneMonthTax { get; set; }
}

View File

@@ -0,0 +1,10 @@
namespace CompanyManagment.App.Contracts.InstitutionContract;
public class InstitutionContractResetDiscountForCreateRequest
{
public int DiscountPercentage { get; set; }
public double TotalAmount { get; set; }
public bool IsInstallment { get; set; }
public InstitutionContractDuration Duration { get; set; }
public double OneMonthAmount { get; set; }
}

View File

@@ -0,0 +1,9 @@
using System;
namespace CompanyManagment.App.Contracts.InstitutionContract;
public class InstitutionContractResetDiscountForExtensionRequest
{
public Guid TempId { get; set; }
public bool IsInstallment { get; set; }
}

View File

@@ -0,0 +1,5 @@
using _0_Framework.Application;
namespace CompanyManagment.App.Contracts.InstitutionContract;
public class InstitutionContractSelectListViewModel : SelectListViewModel;

View File

@@ -0,0 +1,11 @@
using System;
namespace CompanyManagment.App.Contracts.InstitutionContract;
public class InstitutionContractSetDiscountForExtensionRequest
{
public Guid TempId { get; set; }
public int DiscountPercentage { get; set; }
public double TotalAmount { get; set; }
public bool IsInstallment { get; set; }
}

View File

@@ -0,0 +1,10 @@
namespace CompanyManagment.App.Contracts.InstitutionContract;
public class InstitutionContractSetDiscountRequest
{
public int DiscountPercentage { get; set; }
public double TotalAmount { get; set; }
public InstitutionContractDuration Duration { get; set; }
public double OneMonthAmount { get; set; }
public bool IsInstallment { get; set; }
}

View File

@@ -1537,7 +1537,7 @@ public class InstitutionContractApplication : IInstitutionContractApplication
return (await _institutionContractRepository.PrintAllAsync([id])).FirstOrDefault();
}
public async Task<OperationResult> SetPendingWorkflow(long entityId)
public async Task<OperationResult> SetPendingWorkflow(long entityId,InstitutionContractSigningType signingType)
{
var op = new OperationResult();
var institutionContract = await _institutionContractRepository.GetIncludeWorkshopDetailsAsync(entityId);
@@ -1551,6 +1551,30 @@ public class InstitutionContractApplication : IInstitutionContractApplication
return op.Failed("وضعیت قرارداد مالی برای این عملیات مناسب نمی باشد");
}
var initialCreatedWorkshops = institutionContract.WorkshopGroup.InitialWorkshops
.Where(x => x.WorkshopCreated && x.WorkshopId is > 0).ToList();
var currentWorkshops = institutionContract.WorkshopGroup.CurrentWorkshops.ToList();
foreach (var createdWorkshop in initialCreatedWorkshops)
{
if (currentWorkshops.Any(x => x.WorkshopId == createdWorkshop.WorkshopId))
{
continue;
}
var currentWorkshop = new InstitutionContractWorkshopCurrent(createdWorkshop.WorkshopName,
createdWorkshop.Services.RollCall, createdWorkshop.Services.RollCallInPerson,
createdWorkshop.Services.CustomizeCheckout, createdWorkshop.Services.Contract,
createdWorkshop.Services.ContractInPerson, createdWorkshop.Services.Insurance,
createdWorkshop.Services.InsuranceInPerson,createdWorkshop.PersonnelCount, createdWorkshop.Price,
createdWorkshop.InstitutionContractWorkshopGroupId,createdWorkshop.WorkshopGroup,
createdWorkshop.WorkshopId!.Value, createdWorkshop.id);
institutionContract.WorkshopGroup.AddCurrentWorkshop(currentWorkshop);
}
if (institutionContract.WorkshopGroup.InitialWorkshops.All(x => x.WorkshopCreated && x.WorkshopId is > 0))
{
institutionContract.Verified();
@@ -1559,7 +1583,9 @@ public class InstitutionContractApplication : IInstitutionContractApplication
{
institutionContract.SetPendingWorkflow();
}
institutionContract.SetSigningType(signingType);
await _institutionContractRepository.SaveChangesAsync();
return op.Succcedded();
}
@@ -1569,6 +1595,28 @@ public class InstitutionContractApplication : IInstitutionContractApplication
return await _institutionContractRepository.GetIdByInstallmentId(installmentId);
}
public async Task<OperationResult> VerifyInstitutionContractManually(long institutionContractId)
{
var op = new OperationResult();
var institutionContract =await _institutionContractRepository
.GetIncludeWorkshopDetailsAsync(institutionContractId);
if (institutionContract == null)
return op.Failed("قرارداد مالی یافت نشد");
if (institutionContract.VerificationStatus == InstitutionContractVerificationStatus.Verified)
return op.Failed("قرارداد مالی قبلا تایید شده است");
var transaction = await _institutionContractRepository.BeginTransactionAsync();
await SetPendingWorkflow(institutionContractId,InstitutionContractSigningType.Physical);
await transaction.CommitAsync();
await _institutionContractRepository.SaveChangesAsync();
return op.Succcedded();
}
private async Task<OperationResult<PersonalContractingParty>> CreateLegalContractingPartyEntity(
CreateInstitutionContractLegalPartyRequest request, long representativeId, string address, string city,
string state)

View File

@@ -34,6 +34,10 @@ public class InstitutionContractMapping : IEntityTypeConfiguration<InstitutionCo
builder.Property(x => x.VerifierPhoneNumber).HasMaxLength(20);
builder.Property(x => x.VerificationStatus).HasConversion<string>().HasMaxLength(122);
builder.Property(x=>x.SigningType).HasConversion<string>()
.HasMaxLength(25)
.IsRequired(false);
builder.HasMany(x => x.Installments)
.WithOne(x => x.InstitutionContract)
@@ -45,5 +49,10 @@ public class InstitutionContractMapping : IEntityTypeConfiguration<InstitutionCo
builder.HasMany(x => x.Amendments).WithOne(x => x.InstitutionContract)
.HasForeignKey(x => x.InstitutionContractId);
builder.Ignore(x => x.ContractAmountWithTax);
builder.Ignore(x => x.ContractAmountTax);
builder.Ignore(x => x.ContractAmountTax);
}
}

View File

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

View File

@@ -3462,6 +3462,10 @@ namespace CompanyManagment.EFCore.Migrations
.HasMaxLength(1)
.HasColumnType("nvarchar(1)");
b.Property<string>("SigningType")
.HasMaxLength(25)
.HasColumnType("nvarchar(25)");
b.Property<string>("State")
.HasMaxLength(20)
.HasColumnType("nvarchar(20)");

View File

@@ -4,9 +4,7 @@ using _0_Framework.Application.Sms;
using _0_Framework.Exceptions;
using _0_Framework.InfraStructure;
using Company.Domain.ContarctingPartyAgg;
using Company.Domain.ContractingPartyAccountAgg;
using Company.Domain.empolyerAgg;
using Company.Domain.FinancialInvoiceAgg;
using Company.Domain.FinancialStatmentAgg;
using Company.Domain.FinancialTransactionAgg;
using Company.Domain.InstitutionContractAgg;
@@ -17,7 +15,6 @@ using Company.Domain.InstitutionPlanAgg;
using Company.Domain.SmsResultAgg;
using Company.Domain.WorkshopAgg;
using CompanyManagment.App.Contracts.Employer;
using CompanyManagment.App.Contracts.FinancialInvoice;
using CompanyManagment.App.Contracts.FinancialStatment;
using CompanyManagment.App.Contracts.FinancilTransaction;
using CompanyManagment.App.Contracts.Hubs;
@@ -26,30 +23,17 @@ 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 CompanyManagment.EFCore.Migrations;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.SignalR;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Storage;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using MongoDB.Driver;
using OfficeOpenXml.Packaging.Ionic.Zip;
using PersianTools.Core;
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Diagnostics;
using System.Diagnostics.Metrics;
using System.Drawing;
using System.Globalization;
using System.Linq;
using System.Net;
using System.Threading;
using System.Threading.Tasks;
using static Microsoft.EntityFrameworkCore.DbLoggerCategory.Database;
using static System.Runtime.InteropServices.JavaScript.JSType;
using ContractingPartyAccount = Company.Domain.ContractingPartyAccountAgg.ContractingPartyAccount;
using FinancialStatment = Company.Domain.FinancialStatmentAgg.FinancialStatment;
using String = System.String;
@@ -1375,7 +1359,7 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
.Count(l => l.StartWorkDate <= DateTime.Now && l.LeftWorkDate >= DateTime.Now);
return new GetInstitutionContractListItemsViewModel()
{
ContractAmount = x.contract.ContractAmount,
ContractAmount = x.contract.ContractAmountWithTax,
Balance = statement?.FinancialTransactionList.Sum(ft => ft.Deptor - ft.Creditor) ?? 0,
WorkshopsCount = workshops.Count(),
ContractStartFa = x.contract.ContractStartGr.ToFarsi(),
@@ -1395,9 +1379,7 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
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)
IsOldContract = x.contract.SigningType == InstitutionContractSigningType.Legacy
};
}).ToList()
};
@@ -3216,6 +3198,9 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
PaymentPrice = institution.TotalAmount.ToMoney(),
TotalPrice = (institution.TotalAmount - institution.ValueAddedTax).ToMoney(),
TaxPrice = institution.ValueAddedTax.ToMoney(),
OneMonthPrice = institution.ContractAmountWithTax.ToMoney(),
OneMonthWithoutTax = institution.ContractAmount.ToMoney(),
OneMonthTax = institution.ContractAmountTax.ToMoney(),
VerifierFullName = institution.VerifierFullName,
VerifierPhoneNumber = institution.VerifierPhoneNumber,
VerifyCode = institution.VerifyCode,
@@ -4773,6 +4758,7 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
.Where(x => x.Installments.Any(i => i.Id == installmentId))
.Select(x => x.id).FirstOrDefaultAsync();
}
#endregion

View File

@@ -126,7 +126,7 @@ namespace GozareshgirProgramManager.Infrastructure.Migrations
b.HasIndex("SkillId");
b.ToTable("PhaseSections");
b.ToTable("PhaseSections", (string)null);
});
modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.Project", b =>
@@ -238,7 +238,7 @@ namespace GozareshgirProgramManager.Infrastructure.Migrations
b.HasIndex("SkillId");
b.ToTable("ProjectSections");
b.ToTable("ProjectSections", (string)null);
});
modelBuilder.Entity("GozareshgirProgramManager.Domain.ProjectAgg.Entities.ProjectTask", b =>

View File

@@ -807,6 +807,13 @@ public class institutionContractController : AdminBaseController
var res =await _institutionContractApplication.PrintOneAsync(id);
return res;
}
[HttpPost("mannual-verify/{id}")]
public async Task<ActionResult<OperationResult>> VerifyInstitutionContractMannualy(long id)
{
var res= await _institutionContractApplication.VerifyInstitutionContractManually(id);
return res;
}
}

View File

@@ -0,0 +1,15 @@
@page
<h4>Deploy Log</h4>
<pre style="
background:#111;
color:#0f0;
padding:15px;
max-height:600px;
overflow:auto;
font-size:13px;
border-radius:6px;">
</pre>

View File

@@ -2,6 +2,14 @@
@model ServiceHost.Areas.AdminNew.Pages.Company.AndroidApk.IndexModel
@{
ViewData["Title"] = "File Upload";
<style>
.lineDiv {
width: 100%;
height: 2px;
background-image: linear-gradient(to right, #ffffff, #e5e5e5, #cbcbcb, #b2b2b2, #9a9a9a, #9a9a9a, #9a9a9a, #9a9a9a, #b2b2b2, #cbcbcb, #e5e5e5, #ffffff);
margin: 10px;
}
</style>
}
<h1>Upload APK File</h1>
@@ -60,16 +68,85 @@
</form>
<form style="margin:50px" asp-page-handler="PaymentGateWay" id="11" method="post">
<form style="margin:30px" asp-page-handler="PaymentGateWay" id="11" method="post">
<button type="submit">درگاه پرداخت تستی </button>
</form>
<div class="lineDiv"></div>
<div class="row m-t-20">
<div class="col-4"></div>
<div class="col-2">
<form asp-page-handler="UploadFrontEnd" id="12" method="post">
<button type="submit"
class="btn btn-danger"
onclick="return confirm('آیا از انتشار نسخه جدید فرانت مطمئن هستید؟');">
🚀 Deploy Next UI
</button>
</form>
</div>
<div class="col-2">
<button type="button" class="btn btn-outline-secondary"
data-bs-toggle="modal"
data-bs-target="#logModal">
مشاهده لاگ Deploy
</button>
</div>
<div class="col-4"></div>
</div>
<div class="lineDiv"></div>
<div class="modal fade" id="logModal" tabindex="-1">
<div class="modal-dialog modal-xl modal-dialog-scrollable">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Deploy Log</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal"></button>
</div>
<div class="modal-body">
<pre id="logContent"
style="background: #111;
color: #0f0;
padding: 15px;
font-size: 13px;
text-align: left;
direction: ltr;">
</pre>
</div>
</div>
</div>
</div>
<form style="margin:20px" asp-page-handler="ContractingPartyToWorkshop" id="13" method="post">
<button class="btn btn-outline-secondary" type="submit"> افزودن آی دی طرف حساب به کارگاه </button>
</form>
@if (ViewData["message"] != null)
{
<p>@ViewData["message"]</p>
}
<script>
document.getElementById('logModal')
.addEventListener('show.bs.modal', function () {
fetch('?handler=Log')
.then(r => r.text())
.then(t => {
document.getElementById('logContent').textContent = t;
});
});
</script>
@* <script>

View File

@@ -1,36 +1,41 @@
using _0_Framework.Application;
using _0_Framework.Application.Enums;
using _0_Framework.Application.FaceEmbedding;
using _0_Framework.Application.PaymentGateway;
using _0_Framework.Domain.CustomizeCheckoutShared.Enums;
using AccountManagement.Domain.AccountLeftWorkAgg;
using AccountMangement.Infrastructure.EFCore;
using Company.Domain.AndroidApkVersionAgg;
using Company.Domain.CustomizeCheckoutAgg.ValueObjects;
using Company.Domain.CustomizeCheckoutTempAgg.ValueObjects;
using Company.Domain.InstitutionContractAgg;
using Company.Domain.InstitutionPlanAgg;
using Company.Domain.PaymentTransactionAgg;
using Company.Domain.RewardAgg;
using Company.Domain.RollCallAgg.DomainService;
using CompanyManagement.Infrastructure.Excel.WorkshopsRollCall;
using CompanyManagment.App.Contracts.AndroidApkVersion;
using CompanyManagment.App.Contracts.InstitutionContract;
using CompanyManagment.App.Contracts.PaymentTransaction;
using CompanyManagment.App.Contracts.TemporaryClientRegistration;
using CompanyManagment.EFCore;
using Hangfire;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.EntityFrameworkCore;
using System.Net.Http;
using System.Security.Cryptography.Xml;
using System.Text.Json.Serialization;
using _0_Framework.Application.PaymentGateway;
using Company.Domain.InstitutionContractAgg;
using Company.Domain.InstitutionPlanAgg;
using Company.Domain.PaymentTransactionAgg;
using CompanyManagment.App.Contracts.InstitutionContract;
using CompanyManagment.App.Contracts.PaymentTransaction;
using CompanyManagment.App.Contracts.TemporaryClientRegistration;
using Microsoft.Extensions.Options;
using Parbad;
using Parbad.AspNetCore;
using Parbad.Gateway.Sepehr;
using System.ComponentModel.DataAnnotations;
using _0_Framework.Application.Enums;
using _0_Framework.Application.FaceEmbedding;
using CompanyManagement.Infrastructure.Excel.WorkshopsRollCall;
using System.Diagnostics;
using System.Net.Http;
using System.Security.Cryptography.Xml;
using System.Text;
using System.Text.Json.Serialization;
using CompanyManagement.Infrastructure.Excel.Checkout;
using Microsoft.AspNetCore.Authentication;
using static ServiceHost.Areas.AdminNew.Pages.Company.AndroidApk.IndexModel2;
namespace ServiceHost.Areas.AdminNew.Pages.Company.AndroidApk
@@ -47,6 +52,7 @@ namespace ServiceHost.Areas.AdminNew.Pages.Company.AndroidApk
private readonly IHttpClientFactory _httpClientFactory;
private readonly IOnlinePayment _onlinePayment;
private readonly IFaceEmbeddingService _faceEmbeddingService;
private readonly IAuthHelper _authHelper;
[BindProperty] public IFormFile File { get; set; }
@@ -61,13 +67,18 @@ namespace ServiceHost.Areas.AdminNew.Pages.Company.AndroidApk
[Display(Name = "کد ورژن")]
public string VersionCode { get; set; }
/// <summary>
/// لاگ آپلود فرانت
/// </summary>
public string LogContent { get; set; }
[BindProperty] public ApkType SelectedApkType { get; set; }
[BindProperty] public bool IsForce { get; set; }
public IndexModel(IAndroidApkVersionApplication application, IRollCallDomainService rollCallDomainService,
CompanyContext context, AccountContext accountContext, IHttpClientFactory httpClientFactory,
IOptions<AppSettingConfiguration> appSetting,
ITemporaryClientRegistrationApplication clientRegistrationApplication, IOnlinePayment onlinePayment, IFaceEmbeddingService faceEmbeddingService)
ITemporaryClientRegistrationApplication clientRegistrationApplication, IOnlinePayment onlinePayment, IFaceEmbeddingService faceEmbeddingService, IAuthHelper authHelper)
{
_application = application;
_rollCallDomainService = rollCallDomainService;
@@ -77,6 +88,7 @@ namespace ServiceHost.Areas.AdminNew.Pages.Company.AndroidApk
_clientRegistrationApplication = clientRegistrationApplication;
_onlinePayment = onlinePayment;
_faceEmbeddingService = faceEmbeddingService;
_authHelper = authHelper;
_paymentGateway = new SepehrPaymentGateway(httpClientFactory);
}
@@ -140,11 +152,40 @@ namespace ServiceHost.Areas.AdminNew.Pages.Company.AndroidApk
public async Task<IActionResult> OnPostShiftDateNew()
{
//await UpdateInstitutionContract();
await UpdateFaceEmbeddingNames();
//await UpdateFaceEmbeddingNames();
//await SetInstitutionContractSigningType();
var bytes= GetYektaCheckout();
return File(bytes, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
"YektaCheckout.xlsx");
ViewData["message"] = "تومام یک";
return Page();
}
private async System.Threading.Tasks.Task SetInstitutionContractSigningType()
{
var query = _context.InstitutionContractSet
.Where(x=>x.VerificationStatus != InstitutionContractVerificationStatus.PendingForVerify);
var otpSigned = query.Where(x=>x.VerifierFullName != null && x.LawId != 0).ToList();
foreach (var institutionContract in otpSigned)
{
institutionContract.SetSigningType(InstitutionContractSigningType.OtpBased);
}
var lagacySigned = query.Where(x=>x.VerifierFullName == null && x.LawId == 0).ToList();
foreach (var institutionContract in lagacySigned)
{
institutionContract.SetSigningType(InstitutionContractSigningType.Legacy);
}
await _context.SaveChangesAsync();
}
public async Task<IActionResult> OnPostShiftDateNew2()
{
//var startRollCall = new DateTime(2025, 3, 21);
@@ -292,6 +333,105 @@ namespace ServiceHost.Areas.AdminNew.Pages.Company.AndroidApk
//TranslateCode(result?.ErrorCode);
return Page();
}
[DisableConcurrentExecution(timeoutInSeconds: 120)]
public async Task<IActionResult> OnPostUploadFrontEnd(CancellationToken cancellationToken)
{
var validAccountId = _authHelper.CurrentAccountId();
if (validAccountId == 2 || validAccountId == 322)
{
var batPath = @"C:\next-ui\deploy-next-ui.bat";
var psi = new ProcessStartInfo
{
FileName = batPath,
UseShellExecute = true, // خیلی مهم
Verb = "runas", // اجرای Administrator
CreateNoWindow = true,
WindowStyle = ProcessWindowStyle.Hidden
};
Process.Start(psi);
TempData["Message"] = "فرآیند Deploy شروع شد. لاگ را بررسی کنید.";
return RedirectToPage();
}
return Forbid();
}
/// <summary>
/// افزودن آی دی طرف حساب به کارگاه
/// </summary>
/// <returns></returns>
[DisableConcurrentExecution(timeoutInSeconds: 120)]
public async Task<IActionResult> OnPostContractingPartyToWorkshop()
{
var workshops = await _context.Workshops.Where(x => x.ContractingPartyId == 0).ToListAsync();
var worskhopEmployeer = await _context.WorkshopEmployers.Include(x => x.Employer).ToListAsync();
var contractingParties = await _context.PersonalContractingParties.ToListAsync();
foreach (var workshop in workshops)
{
var employers = worskhopEmployeer.Where(x => x.WorkshopId == workshop.id);
var contractingPartyIdList = new List<long>();
foreach (var employer in employers)
{
if (contractingParties.Any(x => x.id == employer.Employer.ContractingPartyId))
{
contractingPartyIdList.Add(employer.Employer.ContractingPartyId);
}
}
if (contractingPartyIdList.Count > 0)
{
if (contractingPartyIdList.Count == 1)
{
workshop.AddContractingPartyId(contractingPartyIdList[0]);
await _context.SaveChangesAsync();
}
else
{
var idDistinct = contractingPartyIdList.Distinct().ToList();
if (idDistinct.Count == 1)
{
workshop.AddContractingPartyId(contractingPartyIdList[0]);
await _context.SaveChangesAsync();
}
}
}
}
ViewData["message"] = "آی دی های طرف حساب اضافه شد";
return Page();
}
/// <summary>
/// دریافت لاگ آپلود فرانت
/// </summary>
/// <returns></returns>
public IActionResult OnGetLog()
{
var validAccountId = _authHelper.CurrentAccountId();
if (validAccountId == 2 || validAccountId == 322)
{
var logPath = @"C:\next-ui\log.txt";
if (!System.IO.File.Exists(logPath))
return Content("Log file not found.");
var content = System.IO.File.ReadAllText(logPath, Encoding.UTF8);
return Content(content);
}
return Content("شما مجاز به دیدن لاگ نیستید");
}
public async System.Threading.Tasks.Task OnGetCallback(string? transid, string? cardnumber,
string? tracking_number, string status)
@@ -840,8 +980,8 @@ namespace ServiceHost.Areas.AdminNew.Pages.Company.AndroidApk
contract => contract.ContractingPartyId,
contractingParty => contractingParty.id,
(contract, contractingParty) => new { contract, contractingParty });
var remoteContractsQuery = query
.Where(x => x.contractingParty.Employers
.Any(e => e.WorkshopEmployers
@@ -902,7 +1042,7 @@ namespace ServiceHost.Areas.AdminNew.Pages.Company.AndroidApk
x.PersonnelCount,
x.Price, x.InstitutionContractWorkshopGroupId,
group,
x.WorkshopId.Value);
x.WorkshopId.Value,x.id);
entity.SetEmployers(x.Employers.Select(e => e.EmployerId).ToList());
return entity;
@@ -978,6 +1118,22 @@ namespace ServiceHost.Areas.AdminNew.Pages.Company.AndroidApk
}
#endregion
private byte[] GetYektaCheckout()
{
var checkouts = _context.CheckoutSet
.Where(x => x.WorkshopId == 595
&& x.Month == "آذر" && x.Year == "1404").Select(x=>new YektaTejaratCheckoutViewModel()
{
AttendancePayableAmount = "0",
FullName = x.EmployeeFullName,
NationalCode = x.NationalCode,
StaticPayableAmount = x.TotalPayment.ToMoney()
}).ToList();
var bytes = YektaTejaratCheckout.GenerateYektaTejaratCheckoutExcel(checkouts);
return bytes;
}
}
public class IndexModel2 : PageModel

View File

@@ -164,7 +164,7 @@ public class GeneralController : GeneralBaseController
.Where(x => x.Type == FinancialInvoiceItemType.BuyInstitutionContract);
foreach (var editFinancialInvoiceItem in financialItems)
{
await _institutionContractApplication.SetPendingWorkflow(editFinancialInvoiceItem.EntityId);
await _institutionContractApplication.SetPendingWorkflow(editFinancialInvoiceItem.EntityId,InstitutionContractSigningType.OtpBased);
}
var financialInstallmentItems = financialInvoice.Items
.Where(x => x.Type == FinancialInvoiceItemType.BuyInstitutionContractInstallment);
@@ -174,7 +174,7 @@ public class GeneralController : GeneralBaseController
var institutionContractId =
await _institutionContractApplication.GetIdByInstallmentId(
editFinancialInvoiceItem.EntityId);
await _institutionContractApplication.SetPendingWorkflow(institutionContractId);
await _institutionContractApplication.SetPendingWorkflow(institutionContractId,InstitutionContractSigningType.OtpBased);
}
}

View File

@@ -70,7 +70,8 @@ public class ParameterBindingConvention : IApplicationModelConvention
{
if (selector.AttributeRouteModel?.Template != null)
{
if (selector.AttributeRouteModel.Template.Contains($"{{{parameterName}}}", StringComparison.OrdinalIgnoreCase))
if (selector.AttributeRouteModel.Template.Contains($"{{{parameterName}}}", StringComparison.OrdinalIgnoreCase) ||
selector.AttributeRouteModel.Template.Contains($"{{{parameterName}:", StringComparison.OrdinalIgnoreCase))
return true;
}
}
@@ -80,7 +81,8 @@ public class ParameterBindingConvention : IApplicationModelConvention
{
if (selector.AttributeRouteModel?.Template != null)
{
if (selector.AttributeRouteModel.Template.Contains($"{{{parameterName}}}", StringComparison.OrdinalIgnoreCase))
if (selector.AttributeRouteModel.Template.Contains($"{{{parameterName}}}", StringComparison.OrdinalIgnoreCase) ||
selector.AttributeRouteModel.Template.Contains($"{{{parameterName}:", StringComparison.OrdinalIgnoreCase))
return true;
}
}