feat: add registration details and pricing to InstitutionContract and related models
This commit is contained in:
@@ -47,4 +47,6 @@ public interface IInstitutionContractRepository : IRepository<long, InstitutionC
|
||||
|
||||
Task<PagedResult<GetInstitutionContractListItemsViewModel>> GetList(InstitutionContractListSearchModel searchModel);
|
||||
Task<GetInstitutionContractListStatsViewModel> GetListStats(InstitutionContractListSearchModel searchModel);
|
||||
Task<List<RegistrationWorkflowMainListViewModel>> RegistrationWorkflowMainList();
|
||||
Task<List<RegistrationWorkflowItemsViewModel>> RegistrationWorkflowItems(long institutionContractId);
|
||||
}
|
||||
@@ -183,13 +183,15 @@ public class InstitutionContract : EntityBase
|
||||
public class InstitutionContractWorkshopDetail:EntityBase
|
||||
{
|
||||
public InstitutionContractWorkshopDetail( string workshopName, bool hasRollCallPlan,
|
||||
bool hasCustomizeCheckoutPlan, bool hasContractPlan,int personnelCount)
|
||||
bool hasCustomizeCheckoutPlan, bool hasContractPlan,int personnelCount,double price)
|
||||
{
|
||||
WorkshopName = workshopName;
|
||||
HasRollCallPlan = hasRollCallPlan;
|
||||
HasCustomizeCheckoutPlan = hasCustomizeCheckoutPlan;
|
||||
HasContractPlan = hasContractPlan;
|
||||
PersonnelCount = personnelCount;
|
||||
WorkshopCreated = false;
|
||||
Price = price;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -219,11 +221,15 @@ public class InstitutionContractWorkshopDetail:EntityBase
|
||||
|
||||
public int PersonnelCount { get; private set; }
|
||||
|
||||
public bool WorkshopCreated { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// شناسه قرارداد نهاد مرتبط
|
||||
/// </summary>
|
||||
public long InstitutionContractId { get; private set; }
|
||||
|
||||
public double Price { get; set; }
|
||||
|
||||
private InstitutionContractWorkshopDetail()
|
||||
{
|
||||
}
|
||||
@@ -238,6 +244,7 @@ public class InstitutionContractWorkshopDetail:EntityBase
|
||||
public void SetWorkshopId(long workshopId)
|
||||
{
|
||||
WorkshopId = workshopId;
|
||||
WorkshopCreated = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using _0_Framework_b.Domain;
|
||||
using CompanyManagment.App.Contracts.InstitutionContract;
|
||||
using CompanyManagment.App.Contracts.TemporaryClientRegistration;
|
||||
|
||||
namespace Company.Domain.TemporaryClientRegistrationAgg;
|
||||
@@ -17,10 +18,5 @@ public interface IInstitutionContractTempRepository : IRepository<long, Institut
|
||||
/// <returns></returns>
|
||||
Task<InstitutionContractTempViewModel> GetInstitutionContractTemp(long id,long contractingPartyTempId);
|
||||
|
||||
/// <summary>
|
||||
/// دریافت لیست طرف حساب هایی که ثبت نام آنها تکمیل شده
|
||||
/// جهت نمایش در کارپوشه
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Task<List<RegistrationWorkflowMainList>> GetAllCompletedRegistration();
|
||||
|
||||
}
|
||||
@@ -76,15 +76,13 @@ public class Workshop : EntityBase
|
||||
|
||||
ClientEmployeeWorkshopList = new List<ClientEmployeeWorkshop>();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public Workshop(string workshopName,string workshopSureName, string insuranceCode, string typeOfOwnership, string archiveCode, string agentName, string agentPhone,
|
||||
string state, string city, string address, string typeOfInsuranceSend, string typeOfContract, string contractTerm,
|
||||
string agreementNumber, bool fixedSalary, string population,long? insuranceJobId, string zoneName, bool addBonusesPay, bool addYearsPay, bool addLeavePay, bool totalPaymentHide,
|
||||
bool isClassified, string computeOptions, string bonusesOptions, string yearsOptions, string hasRollCallFreeVip, bool workshopHolidayWorking,
|
||||
bool insuranceCheckoutOvertime, bool insuranceCheckoutFamilyAllowance, bool createContract, bool signContract, bool createCheckout, bool signCheckout,
|
||||
IsActive cutContractEndOfYear, bool rotatingShiftCompute, bool isStaticCheckout)
|
||||
IsActive cutContractEndOfYear, bool rotatingShiftCompute, bool isStaticCheckout,long contractingPartyId)
|
||||
{
|
||||
WorkshopName = workshopName;
|
||||
WorkshopSureName = workshopSureName;
|
||||
@@ -135,6 +133,8 @@ public class Workshop : EntityBase
|
||||
CutContractEndOfYear = cutContractEndOfYear;
|
||||
RotatingShiftCompute = rotatingShiftCompute;
|
||||
IsStaticCheckout = isStaticCheckout;
|
||||
RegistrationStatus = WorkshopRegistrationStatus.NotRegistered;
|
||||
ContractingPartyId = contractingPartyId;
|
||||
}
|
||||
|
||||
|
||||
@@ -234,8 +234,10 @@ public class Workshop : EntityBase
|
||||
/// </summary>
|
||||
public bool IsStaticCheckout { get; private set; }
|
||||
|
||||
public long ContractingPartyId { get; set; }
|
||||
public long ContractingPartyId { get; private set; }
|
||||
|
||||
public WorkshopRegistrationStatus RegistrationStatus { get; private set; }
|
||||
|
||||
public Workshop()
|
||||
{
|
||||
RollCallServicesList = new List<RollCallService>();
|
||||
@@ -347,4 +349,10 @@ public class Workshop : EntityBase
|
||||
this.IsActiveString = "false";
|
||||
ArchiveCode = "b-" + archiveCode;
|
||||
}
|
||||
}
|
||||
|
||||
public enum WorkshopRegistrationStatus
|
||||
{
|
||||
NotRegistered = 0,
|
||||
Registered = 1
|
||||
}
|
||||
@@ -159,6 +159,11 @@ public class CreateInstitutionContractWorkshopDetail
|
||||
/// تعداد پرسنل کارگاه
|
||||
/// </summary>
|
||||
public int PersonnelCount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// مبلغ
|
||||
/// </summary>
|
||||
public double Price { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -193,6 +193,14 @@ public interface IInstitutionContractApplication
|
||||
/// <param name="command"></param>
|
||||
/// <returns></returns>
|
||||
Task<OperationResult> ExtensionَAsync(CreateInstitutionContractRequest command);
|
||||
|
||||
/// <summary>
|
||||
/// دریافت لیست طرف حساب هایی که ثبت نام آنها تکمیل شده
|
||||
/// جهت نمایش در کارپوشه
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Task<List<RegistrationWorkflowMainListViewModel>> RegistrationWorkflowMainList();
|
||||
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -285,4 +293,4 @@ public class InstitutionContractInstallmentViewModel
|
||||
/// شناسه قرارداد مؤسسه مربوط به این قسط
|
||||
/// </summary>
|
||||
public long InstitutionContractId { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,88 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace CompanyManagment.App.Contracts.InstitutionContract;
|
||||
|
||||
public class RegistrationWorkflowMainListViewModel
|
||||
{
|
||||
/// <summary>
|
||||
/// شناسه قرارداد موسسه
|
||||
/// </summary>
|
||||
public long InstitutionContractId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// نام کامل طرف حساب
|
||||
/// </summary>
|
||||
public string ContractingPartyFullName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// شماره همراه
|
||||
/// </summary>
|
||||
public string Phone { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// تعداد کارگاههای انجام شده
|
||||
/// </summary>
|
||||
public int DoneWorkshops { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// تعداد کارگاههای انجام نشده
|
||||
/// </summary>
|
||||
public int UnDoneWorkshops { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// تعداد کل کارگاهها
|
||||
/// </summary>
|
||||
public int TotalWorkshops { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// مبلغ
|
||||
/// </summary>
|
||||
public double Amount { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// مدل نمایش آیتمهای گردش کار ثبت نام
|
||||
/// </summary>
|
||||
public class RegistrationWorkflowItemsViewModel
|
||||
{
|
||||
/// <summary>
|
||||
/// لیست کارفرمایان
|
||||
/// </summary>
|
||||
public List<RegistrationWorkflowItemsEmployerViewModel> Employers { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// نام کارگاه
|
||||
/// </summary>
|
||||
public string WorkshopName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// تعداد پرسنل
|
||||
/// </summary>
|
||||
public int PersonnelCount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// قیمت
|
||||
/// </summary>
|
||||
public double Price { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// وضعیت انجام شدن
|
||||
/// </summary>
|
||||
public bool IsDone { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// مدل نمایش کارفرما در آیتمهای گردش کار ثبت نام
|
||||
/// </summary>
|
||||
public class RegistrationWorkflowItemsEmployerViewModel
|
||||
{
|
||||
/// <summary>
|
||||
/// نام و نام خانوادگی
|
||||
/// </summary>
|
||||
public string FullName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// شناسه
|
||||
/// </summary>
|
||||
public long Id { get; set; }
|
||||
}
|
||||
@@ -112,12 +112,6 @@ public interface ITemporaryClientRegistrationApplication
|
||||
/// <returns></returns>
|
||||
Task<OperationResult> PayOffCompleted(long contractingPartyTempId);
|
||||
|
||||
/// <summary>
|
||||
/// دریافت لیست طرف حساب هایی که ثبت نام آنها تکمیل شده
|
||||
/// جهت نمایش در کارپوشه
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Task<List<RegistrationWorkflowMainList>> RegistrationWorkflowMainList();
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
namespace CompanyManagment.App.Contracts.TemporaryClientRegistration;
|
||||
|
||||
public class RegistrationWorkflowMainList
|
||||
{
|
||||
/// <summary>
|
||||
/// آی دی طرف حساب ثبت شده موقت
|
||||
/// </summary>
|
||||
public long ContractingPartyTempId { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// نام کامل طرف حساب
|
||||
/// </summary>
|
||||
public string ContractingPartyFullName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// شماره همراه
|
||||
/// </summary>
|
||||
public string Phone { get; set; }
|
||||
|
||||
}
|
||||
@@ -970,7 +970,7 @@ public class InstitutionContractApplication : IInstitutionContractApplication
|
||||
|
||||
var workshopDetails = command.Workshops.Select(x =>
|
||||
new InstitutionContractWorkshopDetail(x.WorkshopName, x.HasRollCallPlan, x.HasCustomizeCheckoutPlan,
|
||||
x.HasContractPlan, x.PersonnelCount)).ToList();
|
||||
x.HasContractPlan, x.PersonnelCount,x.Price)).ToList();
|
||||
|
||||
var financialStatement = new FinancialStatment(contractingParty.id,contractingPartyFullName);
|
||||
|
||||
@@ -1024,6 +1024,11 @@ public class InstitutionContractApplication : IInstitutionContractApplication
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public Task<List<RegistrationWorkflowMainListViewModel>> RegistrationWorkflowMainList()
|
||||
{
|
||||
return _institutionContractRepository.RegistrationWorkflowMainList();
|
||||
}
|
||||
|
||||
private async Task<OperationResult<PersonalContractingParty>> CreateLegalContractingPartyEntity(
|
||||
CreateInstitutionContractLegalPartyRequest request, long representativeId)
|
||||
{
|
||||
|
||||
@@ -907,10 +907,7 @@ public class TemporaryClientRegistrationApplication : ITemporaryClientRegistrati
|
||||
}
|
||||
|
||||
|
||||
public async Task<List<RegistrationWorkflowMainList>> RegistrationWorkflowMainList()
|
||||
{
|
||||
return await _institutionContractTempRepository.GetAllCompletedRegistration();
|
||||
}
|
||||
|
||||
|
||||
public async Task<OperationResult> SendAgreementLink(long contractingPartyTempId)
|
||||
{
|
||||
|
||||
@@ -168,7 +168,7 @@ public class WorkshopAppliction : IWorkshopApplication
|
||||
command.AddYearsPay,command.AddLeavePay,command.TotalPaymentHide,command.IsClassified,command.ComputeOptions,
|
||||
command.BonusesOptions,command.YearsOptions,command.HasRollCallFreeVip,command.WorkshopHolidayWorking,
|
||||
command.InsuranceCheckoutOvertime, command.InsuranceCheckoutFamilyAllowance, command.CreateContract, command.SignContract,
|
||||
command.CreateCheckout, command.SignCheckout, command.CutContractEndOfYear,command.RotatingShiftCompute, command.IsStaticCheckout);
|
||||
command.CreateCheckout, command.SignCheckout, command.CutContractEndOfYear,command.RotatingShiftCompute, command.IsStaticCheckout,institutionContract.ContractingPartyId);
|
||||
_workshopRepository.Create(workshop);
|
||||
_workshopRepository.SaveChanges();
|
||||
|
||||
|
||||
@@ -29,6 +29,7 @@ public class InstitutionContractMapping : IEntityTypeConfiguration<InstitutionCo
|
||||
builder.Property(x => x.TypeOfContract).HasMaxLength(30);
|
||||
builder.Property(x => x.HasValueAddedTax).HasMaxLength(10);
|
||||
|
||||
builder.Property(x => x.Status).HasConversion<string>().HasMaxLength(122);
|
||||
builder.OwnsMany(x => x.WorkshopDetails, workshopDetail =>
|
||||
{
|
||||
workshopDetail.HasKey(x => x.id);
|
||||
|
||||
@@ -43,6 +43,10 @@ partial class WorkshopMapping : IEntityTypeConfiguration<Workshop>
|
||||
|
||||
builder.Property(x => x.CutContractEndOfYear).HasConversion(x => x.ToString()
|
||||
, x => ((IsActive)Enum.Parse(typeof(IsActive), x))).HasMaxLength(5);
|
||||
|
||||
builder.Property(x => x.RegistrationStatus).HasConversion<string>().HasMaxLength(50);
|
||||
builder.HasQueryFilter(x => x.RegistrationStatus == WorkshopRegistrationStatus.Registered);
|
||||
|
||||
//builder.HasOne(x => x.Employer)
|
||||
// .WithMany(x => x.Workshops)
|
||||
// .HasForeignKey(x => x.EmployerId);
|
||||
|
||||
10446
CompanyManagment.EFCore/Migrations/20250820122958_add register in institution contract.Designer.cs
generated
Normal file
10446
CompanyManagment.EFCore/Migrations/20250820122958_add register in institution contract.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,132 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace CompanyManagment.EFCore.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class addregisterininstitutioncontract : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<long>(
|
||||
name: "ContractingPartyId",
|
||||
table: "Workshops",
|
||||
type: "bigint",
|
||||
nullable: false,
|
||||
defaultValue: 0L);
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "RegistrationStatus",
|
||||
table: "Workshops",
|
||||
type: "nvarchar(50)",
|
||||
maxLength: 50,
|
||||
nullable: false,
|
||||
defaultValue: "");
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "LegalPosition",
|
||||
table: "PersonalContractingParties",
|
||||
type: "nvarchar(50)",
|
||||
maxLength: 50,
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "Status",
|
||||
table: "InstitutionContracts",
|
||||
type: "nvarchar(122)",
|
||||
maxLength: 122,
|
||||
nullable: false,
|
||||
defaultValue: "");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "InstitutionContractInstallments",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<long>(type: "bigint", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
InstallmentDateGr = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||
InstallmentDateFa = table.Column<string>(type: "nvarchar(10)", maxLength: 10, nullable: false),
|
||||
Amount = table.Column<double>(type: "float", nullable: false),
|
||||
Description = table.Column<string>(type: "nvarchar(1000)", maxLength: 1000, nullable: true),
|
||||
InstitutionContractId = table.Column<long>(type: "bigint", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_InstitutionContractInstallments", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_InstitutionContractInstallments_InstitutionContracts_InstitutionContractId",
|
||||
column: x => x.InstitutionContractId,
|
||||
principalTable: "InstitutionContracts",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "InstitutionContractWorkshopDetail",
|
||||
columns: table => new
|
||||
{
|
||||
id = table.Column<long>(type: "bigint", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
WorkshopId = table.Column<long>(type: "bigint", nullable: true),
|
||||
WorkshopName = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
|
||||
HasRollCallPlan = table.Column<bool>(type: "bit", nullable: false),
|
||||
HasCustomizeCheckoutPlan = table.Column<bool>(type: "bit", nullable: false),
|
||||
HasContractPlan = table.Column<bool>(type: "bit", nullable: false),
|
||||
PersonnelCount = table.Column<int>(type: "int", nullable: false),
|
||||
WorkshopCreated = table.Column<bool>(type: "bit", nullable: false),
|
||||
InstitutionContractId = table.Column<long>(type: "bigint", nullable: false),
|
||||
Price = table.Column<double>(type: "float", nullable: false),
|
||||
CreationDate = table.Column<DateTime>(type: "datetime2", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_InstitutionContractWorkshopDetail", x => x.id);
|
||||
table.ForeignKey(
|
||||
name: "FK_InstitutionContractWorkshopDetail_InstitutionContracts_InstitutionContractId",
|
||||
column: x => x.InstitutionContractId,
|
||||
principalTable: "InstitutionContracts",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_InstitutionContractInstallments_InstitutionContractId",
|
||||
table: "InstitutionContractInstallments",
|
||||
column: "InstitutionContractId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_InstitutionContractWorkshopDetail_InstitutionContractId",
|
||||
table: "InstitutionContractWorkshopDetail",
|
||||
column: "InstitutionContractId");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "InstitutionContractInstallments");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "InstitutionContractWorkshopDetail");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "ContractingPartyId",
|
||||
table: "Workshops");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "RegistrationStatus",
|
||||
table: "Workshops");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "LegalPosition",
|
||||
table: "PersonalContractingParties");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "Status",
|
||||
table: "InstitutionContracts");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -686,6 +686,10 @@ namespace CompanyManagment.EFCore.Migrations
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("nvarchar(50)");
|
||||
|
||||
b.Property<string>("LegalPosition")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("nvarchar(50)");
|
||||
|
||||
b.Property<string>("NationalId")
|
||||
.IsRequired()
|
||||
.HasMaxLength(15)
|
||||
@@ -3041,6 +3045,11 @@ namespace CompanyManagment.EFCore.Migrations
|
||||
.HasMaxLength(20)
|
||||
.HasColumnType("nvarchar(20)");
|
||||
|
||||
b.Property<string>("Status")
|
||||
.IsRequired()
|
||||
.HasMaxLength(122)
|
||||
.HasColumnType("nvarchar(122)");
|
||||
|
||||
b.Property<double>("TotalAmount")
|
||||
.HasColumnType("float");
|
||||
|
||||
@@ -3060,6 +3069,39 @@ namespace CompanyManagment.EFCore.Migrations
|
||||
b.ToTable("InstitutionContracts", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Company.Domain.InstitutionContractAgg.InstitutionContractInstallment", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("Id"));
|
||||
|
||||
b.Property<double>("Amount")
|
||||
.HasColumnType("float");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.HasMaxLength(1000)
|
||||
.HasColumnType("nvarchar(1000)");
|
||||
|
||||
b.Property<string>("InstallmentDateFa")
|
||||
.IsRequired()
|
||||
.HasMaxLength(10)
|
||||
.HasColumnType("nvarchar(10)");
|
||||
|
||||
b.Property<DateTime>("InstallmentDateGr")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<long>("InstitutionContractId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("InstitutionContractId");
|
||||
|
||||
b.ToTable("InstitutionContractInstallments", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Company.Domain.InstitutionContractContactInfoAgg.InstitutionContractContactInfo", b =>
|
||||
{
|
||||
b.Property<long>("id")
|
||||
@@ -5954,6 +5996,9 @@ namespace CompanyManagment.EFCore.Migrations
|
||||
.HasMaxLength(10)
|
||||
.HasColumnType("nvarchar(10)");
|
||||
|
||||
b.Property<long>("ContractingPartyId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<bool>("CreateCheckout")
|
||||
.HasColumnType("bit");
|
||||
|
||||
@@ -6008,6 +6053,11 @@ namespace CompanyManagment.EFCore.Migrations
|
||||
.HasMaxLength(25)
|
||||
.HasColumnType("nvarchar(25)");
|
||||
|
||||
b.Property<string>("RegistrationStatus")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("nvarchar(50)");
|
||||
|
||||
b.Property<bool>("RotatingShiftCompute")
|
||||
.HasColumnType("bit");
|
||||
|
||||
@@ -9432,6 +9482,71 @@ namespace CompanyManagment.EFCore.Migrations
|
||||
b.Navigation("Holidayss");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Company.Domain.InstitutionContractAgg.InstitutionContract", b =>
|
||||
{
|
||||
b.OwnsMany("Company.Domain.InstitutionContractAgg.InstitutionContractWorkshopDetail", "WorkshopDetails", b1 =>
|
||||
{
|
||||
b1.Property<long>("id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b1.Property<long>("id"));
|
||||
|
||||
b1.Property<DateTime>("CreationDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b1.Property<bool>("HasContractPlan")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b1.Property<bool>("HasCustomizeCheckoutPlan")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b1.Property<bool>("HasRollCallPlan")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b1.Property<long>("InstitutionContractId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b1.Property<int>("PersonnelCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b1.Property<double>("Price")
|
||||
.HasColumnType("float");
|
||||
|
||||
b1.Property<bool>("WorkshopCreated")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b1.Property<long?>("WorkshopId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b1.Property<string>("WorkshopName")
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("nvarchar(100)");
|
||||
|
||||
b1.HasKey("id");
|
||||
|
||||
b1.HasIndex("InstitutionContractId");
|
||||
|
||||
b1.ToTable("InstitutionContractWorkshopDetail");
|
||||
|
||||
b1.WithOwner()
|
||||
.HasForeignKey("InstitutionContractId");
|
||||
});
|
||||
|
||||
b.Navigation("WorkshopDetails");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Company.Domain.InstitutionContractAgg.InstitutionContractInstallment", b =>
|
||||
{
|
||||
b.HasOne("Company.Domain.InstitutionContractAgg.InstitutionContract", "InstitutionContract")
|
||||
.WithMany("Installments")
|
||||
.HasForeignKey("InstitutionContractId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("InstitutionContract");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Company.Domain.InstitutionContractContactInfoAgg.InstitutionContractContactInfo", b =>
|
||||
{
|
||||
b.HasOne("Company.Domain.InstitutionContractAgg.InstitutionContract", "InstitutionContracts")
|
||||
@@ -10144,6 +10259,8 @@ namespace CompanyManagment.EFCore.Migrations
|
||||
modelBuilder.Entity("Company.Domain.InstitutionContractAgg.InstitutionContract", b =>
|
||||
{
|
||||
b.Navigation("ContactInfoList");
|
||||
|
||||
b.Navigation("Installments");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Company.Domain.InsurancJobAgg.InsuranceJob", b =>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Immutable;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
@@ -1155,14 +1156,24 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
|
||||
var orderedQuery = joinedQuery
|
||||
.OrderBy(x =>
|
||||
x.contract.IsActiveString == "blue" ? 0 : // DeactiveWithoutDebt
|
||||
(x.contract.ContractEndGr >= now && x.contract.ContractEndGr <= endOfMonth) ? 1 : // PendingToRenewal
|
||||
x.contractingParty.IsBlock == "true" ? 2 : // Block
|
||||
x.contract.ContractAmount == 0 ? 3 : // Free
|
||||
!x.contractingParty.Employers
|
||||
.SelectMany(e => e.WorkshopEmployers)
|
||||
.Any() ? 4 : // WithoutWorkshop
|
||||
5 // Active
|
||||
x.contract.IsActiveString == "blue"
|
||||
? 0
|
||||
: // DeactiveWithoutDebt
|
||||
(x.contract.ContractEndGr >= now && x.contract.ContractEndGr <= endOfMonth)
|
||||
? 1
|
||||
: // PendingToRenewal
|
||||
x.contractingParty.IsBlock == "true"
|
||||
? 2
|
||||
: // Block
|
||||
x.contract.ContractAmount == 0
|
||||
? 3
|
||||
: // Free
|
||||
!x.contractingParty.Employers
|
||||
.SelectMany(e => e.WorkshopEmployers)
|
||||
.Any()
|
||||
? 4
|
||||
: // WithoutWorkshop
|
||||
5 // Active
|
||||
);
|
||||
|
||||
var list = await orderedQuery.ApplyPagination(searchModel.PageIndex, searchModel.PageSize).ToListAsync();
|
||||
@@ -1213,9 +1224,10 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
return res;
|
||||
}
|
||||
|
||||
public async Task<GetInstitutionContractListStatsViewModel> GetListStats(InstitutionContractListSearchModel searchModel)
|
||||
public async Task<GetInstitutionContractListStatsViewModel> GetListStats(
|
||||
InstitutionContractListSearchModel searchModel)
|
||||
{
|
||||
var query = _context.InstitutionContractSet
|
||||
var query = _context.InstitutionContractSet
|
||||
.Include(x => x.ContactInfoList);
|
||||
|
||||
|
||||
@@ -1232,7 +1244,6 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
(x, statement) => new { x.contractingParty, x.contract, statement });
|
||||
|
||||
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(searchModel.EmployerOrWorkshopOrContractingPartyOrRepresentativeName))
|
||||
{
|
||||
var keyword = searchModel.EmployerOrWorkshopOrContractingPartyOrRepresentativeName;
|
||||
@@ -1315,12 +1326,12 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
var isOfficialStr = searchModel.IsOfficial == true ? "Official" : "NotOfficial";
|
||||
joinedQuery = joinedQuery.Where(x => x.contract.OfficialCompany == isOfficialStr);
|
||||
}
|
||||
|
||||
|
||||
var now = DateTime.Today;
|
||||
var nowFa = now.ToFarsi();
|
||||
var endFa = nowFa.FindeEndOfMonth();
|
||||
var endThisMontGr = endFa.ToGeorgianDateTime();
|
||||
|
||||
|
||||
if (searchModel.Status != null)
|
||||
{
|
||||
switch (searchModel.Status)
|
||||
@@ -1360,7 +1371,7 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
{
|
||||
joinedQuery = joinedQuery.Where(x => x.contract.IsActiveString != "blue");
|
||||
}
|
||||
|
||||
|
||||
var totalAmount = await joinedQuery.SumAsync(x => x.contract.ContractAmount);
|
||||
|
||||
var totalDebt = await _context.FinancialStatments.Include(x => x.FinancialTransactionList)
|
||||
@@ -1373,7 +1384,7 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
var @enum = Enum.Parse<InstitutionContractListStatus>(name);
|
||||
searchModel.Status = @enum;
|
||||
var count = (await GetList(searchModel)).TotalCount;
|
||||
counts.Add(new (){ListStatus = @enum, Count = count });
|
||||
counts.Add(new() { ListStatus = @enum, Count = count });
|
||||
}
|
||||
|
||||
var res = new GetInstitutionContractListStatsViewModel()
|
||||
@@ -1385,6 +1396,65 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
return res;
|
||||
}
|
||||
|
||||
public async Task<List<RegistrationWorkflowMainListViewModel>> RegistrationWorkflowMainList()
|
||||
{
|
||||
return await _context.InstitutionContractSet.Where(x => x.Status == InstitutionContractStatus.Incomplete)
|
||||
.Include(x => x.WorkshopDetails)
|
||||
.Join(_context.PersonalContractingParties,
|
||||
institutionContract => institutionContract.ContractingPartyId,
|
||||
contractingParty => contractingParty.id,
|
||||
(institutionContract, contractingParty) => new { institutionContract, contractingParty }).Select(x =>
|
||||
new RegistrationWorkflowMainListViewModel
|
||||
{
|
||||
InstitutionContractId = x.contractingParty.id,
|
||||
ContractingPartyFullName = $"{x.contractingParty.FName} {x.contractingParty.LName}",
|
||||
Phone = x.contractingParty.Phone,
|
||||
Amount = x.institutionContract.TotalAmount,
|
||||
DoneWorkshops = x.institutionContract.WorkshopDetails.Count(w => w.WorkshopCreated),
|
||||
TotalWorkshops = x.institutionContract.WorkshopDetails.Count(),
|
||||
UnDoneWorkshops = x.institutionContract.WorkshopDetails.Count(w => !w.WorkshopCreated),
|
||||
}).ToListAsync();
|
||||
}
|
||||
|
||||
public async Task<List<RegistrationWorkflowItemsViewModel>> RegistrationWorkflowItems(long institutionContractId)
|
||||
{
|
||||
var institutionContract = await _context.InstitutionContractSet
|
||||
.Include(x => x.WorkshopDetails)
|
||||
.FirstOrDefaultAsync(x => x.id == institutionContractId);
|
||||
if (institutionContract == null)
|
||||
throw new NotFoundException("قرارداد مؤسسه یافت نشد");
|
||||
|
||||
|
||||
var workshopIds = institutionContract.WorkshopDetails.Where(x => x.WorkshopId != null)
|
||||
.Select(x => x.WorkshopId.Value).ToList();
|
||||
|
||||
var workshops = await _context.Workshops.IgnoreQueryFilters()
|
||||
.Where(x => workshopIds.Contains(x.id))
|
||||
.Include(workshop => workshop.WorkshopEmployers)
|
||||
.ThenInclude(workshopEmployer => workshopEmployer.Employer)
|
||||
.ToListAsync();
|
||||
|
||||
var items = institutionContract.WorkshopDetails.Select(x =>
|
||||
{
|
||||
var workshop = workshops.FirstOrDefault(w => w.id == x.WorkshopId);
|
||||
return new RegistrationWorkflowItemsViewModel
|
||||
{
|
||||
Price = x.Price,
|
||||
IsDone = workshop is { RegistrationStatus: WorkshopRegistrationStatus.Registered },
|
||||
PersonnelCount = x.PersonnelCount,
|
||||
WorkshopName = x.WorkshopName,
|
||||
Employers = workshop?.WorkshopEmployers.Select(we => we.Employer).Select(we =>
|
||||
new RegistrationWorkflowItemsEmployerViewModel
|
||||
{
|
||||
Id = x.id,
|
||||
FullName = we.FullName,
|
||||
}).ToList() ?? [],
|
||||
};
|
||||
}).ToList();
|
||||
|
||||
return items;
|
||||
}
|
||||
|
||||
private (InstitutionContractListStatus status, bool isExpiered) SetContractStatus(InstitutionContract contract,
|
||||
PersonalContractingParty contractingParty,
|
||||
FinancialStatment financialStatment)
|
||||
|
||||
@@ -3,6 +3,7 @@ using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using _0_Framework.InfraStructure;
|
||||
using Company.Domain.TemporaryClientRegistrationAgg;
|
||||
using CompanyManagment.App.Contracts.InstitutionContract;
|
||||
using CompanyManagment.App.Contracts.TemporaryClientRegistration;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
@@ -48,19 +49,5 @@ public class InstitutionContractTempRepository : RepositoryBase<long, Institutio
|
||||
}).FirstOrDefaultAsync();
|
||||
}
|
||||
|
||||
public async Task<List<RegistrationWorkflowMainList>> GetAllCompletedRegistration()
|
||||
{
|
||||
return await _context.InstitutionContractTemps.Where(x => x.RegistrationStatus == InstitutionContractTempStatus.Completed)
|
||||
.Join(_context.ContractingPartyTemps,
|
||||
institutionContract => institutionContract.ContractingPartyTempId,
|
||||
contractingParty => contractingParty.id,
|
||||
(institutionContract, contractingParty) => new { institutionContract, contractingParty }).Select(x =>
|
||||
new RegistrationWorkflowMainList
|
||||
{
|
||||
ContractingPartyTempId = x.contractingParty.id,
|
||||
ContractingPartyFullName = $"{x.contractingParty.FName} {x.contractingParty.LName}",
|
||||
Phone = x.contractingParty.Phone
|
||||
|
||||
}).ToListAsync();
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using CompanyManagment.App.Contracts.AdminMonthlyOverview;
|
||||
using CompanyManagment.App.Contracts.InstitutionContract;
|
||||
using CompanyManagment.App.Contracts.TemporaryClientRegistration;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using ServiceHost.BaseControllers;
|
||||
@@ -8,10 +9,12 @@ namespace ServiceHost.Areas.Admin.Controllers
|
||||
public class RegistrationWorkflowController : AdminBaseController
|
||||
{
|
||||
private readonly ITemporaryClientRegistrationApplication _temporaryClientRegistrationApplication;
|
||||
protected readonly IInstitutionContractApplication _institutionContractApplication;
|
||||
|
||||
public RegistrationWorkflowController(ITemporaryClientRegistrationApplication temporaryClientRegistrationApplication)
|
||||
public RegistrationWorkflowController(ITemporaryClientRegistrationApplication temporaryClientRegistrationApplication, IInstitutionContractApplication institutionContractApplication)
|
||||
{
|
||||
_temporaryClientRegistrationApplication = temporaryClientRegistrationApplication;
|
||||
_institutionContractApplication = institutionContractApplication;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -19,9 +22,9 @@ namespace ServiceHost.Areas.Admin.Controllers
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("")]
|
||||
public async Task<ActionResult<List<RegistrationWorkflowMainList>>> GetList()
|
||||
public async Task<ActionResult<List<RegistrationWorkflowMainListViewModel>>> GetList()
|
||||
{
|
||||
var result = await _temporaryClientRegistrationApplication.RegistrationWorkflowMainList();
|
||||
var result = await _institutionContractApplication.RegistrationWorkflowMainList();
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user