plan and service new
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
using _0_Framework.Domain;
|
||||
using CompanyManagment.App.Contracts.InstitutionPlan;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Company.Domain.InstitutionPlanAgg;
|
||||
|
||||
public interface IPlanPercentageRepository : IRepository<long, PlanPercentage>
|
||||
{
|
||||
EditInstitutionPlanPercentage GetById(long id);
|
||||
|
||||
EditInstitutionPlanPercentage GetByFirst();
|
||||
|
||||
/// <summary>
|
||||
/// دریافت لیست 30 تایی مبالغ سرویس ها به ازای هر نفر
|
||||
/// </summary>
|
||||
/// <param name="pageIndex"></param>
|
||||
/// <param name="countPeron"></param>
|
||||
/// <returns></returns>
|
||||
List<InstitutionPlanViewModel> GetInstitutionPlanList(int pageIndex, int countPeron);
|
||||
}
|
||||
65
Company.Domain/InstitutionPlanAgg/PlanPercentage.cs
Normal file
65
Company.Domain/InstitutionPlanAgg/PlanPercentage.cs
Normal file
@@ -0,0 +1,65 @@
|
||||
using _0_Framework.Domain;
|
||||
|
||||
namespace Company.Domain.InstitutionPlanAgg;
|
||||
|
||||
public class PlanPercentage : EntityBaseWithoutCreationDate
|
||||
{
|
||||
public PlanPercentage(int contractAndCheckoutPercent, int insurancePercent, int rollCallPercent, int customizeCheckoutPercent, int contractAndCheckoutInPersonPercent, int insuranceInPersonPercent)
|
||||
{
|
||||
ContractAndCheckoutPercent = contractAndCheckoutPercent;
|
||||
InsurancePercent = insurancePercent;
|
||||
RollCallPercent = rollCallPercent;
|
||||
CustomizeCheckoutPercent = customizeCheckoutPercent;
|
||||
ContractAndCheckoutInPersonPercent = contractAndCheckoutInPersonPercent;
|
||||
InsuranceInPersonPercent = insuranceInPersonPercent;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// قرارداد و تصفیه
|
||||
/// درصد از مزد روزانه
|
||||
/// </summary>
|
||||
public int ContractAndCheckoutPercent { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// بیمه
|
||||
/// درصد از مزد روزانه
|
||||
/// </summary>
|
||||
public int InsurancePercent { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// حضورغباب
|
||||
/// درصد از مزد روزانه
|
||||
/// </summary>
|
||||
public int RollCallPercent { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// فیش غیر رسمی
|
||||
/// درصد از مزد روزانه
|
||||
/// </summary>
|
||||
public int CustomizeCheckoutPercent { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// خدمات حضوری قرداد و تصفیه
|
||||
/// درصد از مزد روزانه
|
||||
/// </summary>
|
||||
public int ContractAndCheckoutInPersonPercent { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// خدمات حضوری بیمه
|
||||
/// درصد از مزد روزانه
|
||||
/// </summary>
|
||||
public int InsuranceInPersonPercent { get; private set; }
|
||||
|
||||
|
||||
public void Edit(int contractAndCheckoutPercent, int insurancePercent, int rollCallPercent, int customizeCheckoutPercent, int contractAndCheckoutInPersonPercent, int insuranceInPersonPercent)
|
||||
{
|
||||
ContractAndCheckoutPercent = contractAndCheckoutPercent;
|
||||
InsurancePercent = insurancePercent;
|
||||
RollCallPercent = rollCallPercent;
|
||||
CustomizeCheckoutPercent = customizeCheckoutPercent;
|
||||
ContractAndCheckoutInPersonPercent = contractAndCheckoutInPersonPercent;
|
||||
InsuranceInPersonPercent = insuranceInPersonPercent;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
using _0_Framework.Domain;
|
||||
|
||||
namespace CompanyManagment.App.Contracts.InstitutionPlan;
|
||||
|
||||
public class CreateInstitutionPlanPercentage : EntityBase
|
||||
{
|
||||
/// <summary>
|
||||
/// قرارداد و تصفیه
|
||||
/// درصد از مزد روزانه
|
||||
/// </summary>
|
||||
public int ContractAndCheckoutPercent { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// بیمه
|
||||
/// درصد از مزد روزانه
|
||||
/// </summary>
|
||||
public int InsurancePercent { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// حضورغباب
|
||||
/// درصد از مزد روزانه
|
||||
/// </summary>
|
||||
public int RollCallPercent { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// فیش غیر رسمی
|
||||
/// درصد از مزد روزانه
|
||||
/// </summary>
|
||||
public int CustomizeCheckoutPercent { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// خدمات حضوری قرداد و تصفیه
|
||||
/// درصد از مزد روزانه
|
||||
/// </summary>
|
||||
public int ContractAndCheckoutInPersonPercent { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// خدمات حضوری بیمه
|
||||
/// درصد از مزد روزانه
|
||||
/// </summary>
|
||||
public int InsuranceInPersonPercent { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// قرارداد و تصفیه
|
||||
/// درصد از مزد روزانه
|
||||
/// string
|
||||
/// </summary>
|
||||
public string ContractAndCheckoutPercentStr { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// بیمه
|
||||
/// درصد از مزد روزانه
|
||||
/// string
|
||||
/// </summary>
|
||||
public string InsurancePercentStr { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// حضورغباب
|
||||
/// درصد از مزد روزانه
|
||||
/// string
|
||||
/// </summary>
|
||||
public string RollCallPercentStr { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// فیش غیر رسمی
|
||||
/// درصد از مزد روزانه
|
||||
/// string
|
||||
/// </summary>
|
||||
public string CustomizeCheckoutPercentStr { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// خدمات حضوری قرداد و تصفیه
|
||||
/// درصد از مزد روزانه
|
||||
/// string
|
||||
/// </summary>
|
||||
public string ContractAndCheckoutInPersonPercentStr { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// خدمات حضوری بیمه
|
||||
/// درصد از مزد روزانه
|
||||
/// string
|
||||
/// </summary>
|
||||
public string InsuranceInPersonPercentStr { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
namespace CompanyManagment.App.Contracts.InstitutionPlan;
|
||||
|
||||
public class EditInstitutionPlanPercentage : CreateInstitutionPlanPercentage
|
||||
{
|
||||
public long Id { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
using System.Collections.Generic;
|
||||
using _0_Framework.Application;
|
||||
|
||||
namespace CompanyManagment.App.Contracts.InstitutionPlan;
|
||||
|
||||
public interface IInstitutionPlanApplication
|
||||
{
|
||||
/// <summary>
|
||||
/// ایجاد یا ویرایش درصد پلن ها
|
||||
/// </summary>
|
||||
/// <param name="command"></param>
|
||||
/// <returns></returns>
|
||||
OperationResult CreateInstitutionPlanPercentage(CreateInstitutionPlanPercentage command);
|
||||
|
||||
/// <summary>
|
||||
/// دریافت لیست 30 تایی مبالغ سرویس ها به ازای هر نفر
|
||||
/// </summary>
|
||||
/// <param name="pageIndex"></param>
|
||||
/// <param name="countPeron"></param>
|
||||
/// <returns></returns>
|
||||
List<InstitutionPlanViewModel> GetInstitutionPlanList(int pageIndex, int countPeron);
|
||||
|
||||
/// <summary>
|
||||
/// دریافت درصد ها برای لود در مودال ایجاد
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
EditInstitutionPlanPercentage GetByFirst();
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
namespace CompanyManagment.App.Contracts.InstitutionPlan;
|
||||
|
||||
public class InstitutionPlanViewModel
|
||||
{
|
||||
/// <summary>
|
||||
/// تعداد پرسنل
|
||||
/// </summary>
|
||||
public int CountPerson { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// مبلغ قرارداد و تصفیه
|
||||
/// </summary>
|
||||
public string ContractAndCheckout{ get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// مبلغ بیمه
|
||||
/// </summary>
|
||||
public string Insurance { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// مبلغ حضورغباب
|
||||
/// </summary>
|
||||
public string RollCall { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// مبلغ فیش غیر رسمی
|
||||
/// </summary>
|
||||
public string CustomizeCheckout { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// مبلغ خدمات حضوری قرداد و تصفیه
|
||||
/// </summary>
|
||||
public string ContractAndCheckoutInPerson { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// مبلغ خدمات حضوری بیمه
|
||||
/// </summary>
|
||||
public string InsuranceInPerson { get; set; }
|
||||
|
||||
|
||||
#region Double
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// مبلغ قرارداد و تصفیه
|
||||
/// Double
|
||||
/// </summary>
|
||||
public double ContractAndCheckoutDouble { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// مبلغ بیمه
|
||||
/// Double
|
||||
/// </summary>
|
||||
public double InsuranceDouble { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// مبلغ حضورغباب
|
||||
/// Double
|
||||
/// </summary>
|
||||
public double RollCallDouble { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// مبلغ فیش غیر رسمی
|
||||
/// Double
|
||||
/// </summary>
|
||||
public double CustomizeCheckoutDouble { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// مبلغ خدمات حضوری قرداد و تصفیه
|
||||
/// Double
|
||||
/// </summary>
|
||||
public double ContractAndCheckoutInPersonDouble { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// مبلغ خدمات حضوری بیمه
|
||||
/// Double
|
||||
/// </summary>
|
||||
public double InsuranceInPersonDouble { get; set; }
|
||||
#endregion
|
||||
|
||||
|
||||
#region Total
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// مبلغ کل خدمات حضوری
|
||||
/// </summary>
|
||||
public string InPersonSumAmountStr { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// مبلغ کل خدمات آنلاین
|
||||
/// </summary>
|
||||
public string OnlineOnlySumAmountStr { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// مبلغ کل خدمات حضوری و آنلاین
|
||||
/// </summary>
|
||||
public string OnlineAndInPersonSumAmountStr { get; set; }
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
81
CompanyManagment.Application/InstitutionPlanApplication.cs
Normal file
81
CompanyManagment.Application/InstitutionPlanApplication.cs
Normal file
@@ -0,0 +1,81 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using _0_Framework.Application;
|
||||
using Company.Domain.InstitutionPlanAgg;
|
||||
using CompanyManagment.App.Contracts.InstitutionPlan;
|
||||
|
||||
namespace CompanyManagment.Application;
|
||||
|
||||
public class InstitutionPlanApplication : IInstitutionPlanApplication
|
||||
{
|
||||
private readonly IPlanPercentageRepository _planPercentageRepository;
|
||||
|
||||
|
||||
public InstitutionPlanApplication(IPlanPercentageRepository planPercentageRepository)
|
||||
{
|
||||
_planPercentageRepository = planPercentageRepository;
|
||||
}
|
||||
|
||||
public OperationResult CreateInstitutionPlanPercentage(CreateInstitutionPlanPercentage command)
|
||||
{
|
||||
var op = new OperationResult();
|
||||
if (string.IsNullOrWhiteSpace(command.ContractAndCheckoutInPersonPercentStr) || command.ContractAndCheckoutInPersonPercentStr == "0" ||
|
||||
string.IsNullOrWhiteSpace(command.ContractAndCheckoutPercentStr) || (command.ContractAndCheckoutPercentStr == "0" ||
|
||||
string.IsNullOrWhiteSpace(command.CustomizeCheckoutPercentStr) || command.CustomizeCheckoutPercentStr == "0" ||
|
||||
string.IsNullOrWhiteSpace(command.InsuranceInPersonPercentStr) || command.InsuranceInPersonPercentStr == "0" ||
|
||||
string.IsNullOrWhiteSpace(command.InsurancePercentStr) || command.InsurancePercentStr == "0" ||
|
||||
string.IsNullOrWhiteSpace(command.RollCallPercentStr) || command.RollCallPercentStr == "0"))
|
||||
return op.Failed("هیچ یک از فیلدها نمیتوانند صفر باشند");
|
||||
|
||||
int contractAndCheckoutInPersonPercent = 0;
|
||||
int contractAndCheckoutPercent = 0;
|
||||
int customizeCheckoutPercent = 0;
|
||||
int insuranceInPersonPercent = 0;
|
||||
int insurancePercent = 0;
|
||||
int rollCallPercent = 0;
|
||||
|
||||
try
|
||||
{
|
||||
contractAndCheckoutInPersonPercent = Convert.ToInt32(command.ContractAndCheckoutInPersonPercentStr);
|
||||
contractAndCheckoutPercent = Convert.ToInt32(command.ContractAndCheckoutPercentStr);
|
||||
customizeCheckoutPercent = Convert.ToInt32(command.CustomizeCheckoutPercentStr);
|
||||
insuranceInPersonPercent = Convert.ToInt32(command.InsuranceInPersonPercentStr);
|
||||
insurancePercent = Convert.ToInt32(command.InsurancePercentStr);
|
||||
rollCallPercent = Convert.ToInt32(command.RollCallPercentStr);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return op.Failed("لطفا عدد معتبر وارد کنید");
|
||||
|
||||
}
|
||||
|
||||
var firstPlan = _planPercentageRepository.GetByFirst();
|
||||
if (firstPlan != null)
|
||||
{
|
||||
var planPercentage = _planPercentageRepository.Get(firstPlan.Id);
|
||||
planPercentage.Edit(contractAndCheckoutPercent, insurancePercent, rollCallPercent, customizeCheckoutPercent, contractAndCheckoutInPersonPercent, insuranceInPersonPercent);
|
||||
_planPercentageRepository.SaveChanges();
|
||||
}
|
||||
else
|
||||
{
|
||||
var create = new PlanPercentage(contractAndCheckoutPercent, insurancePercent, rollCallPercent,
|
||||
customizeCheckoutPercent, contractAndCheckoutInPersonPercent, insuranceInPersonPercent);
|
||||
_planPercentageRepository.Create(create);
|
||||
_planPercentageRepository.SaveChanges();
|
||||
}
|
||||
|
||||
|
||||
|
||||
return op.Succcedded();
|
||||
}
|
||||
|
||||
public List<InstitutionPlanViewModel> GetInstitutionPlanList(int pageIndex, int countPeron)
|
||||
{
|
||||
return _planPercentageRepository.GetInstitutionPlanList(pageIndex, countPeron);
|
||||
}
|
||||
|
||||
public EditInstitutionPlanPercentage GetByFirst()
|
||||
{
|
||||
return _planPercentageRepository.GetByFirst();
|
||||
}
|
||||
}
|
||||
@@ -188,6 +188,8 @@ public class CompanyContext : DbContext
|
||||
|
||||
#endregion
|
||||
|
||||
public DbSet<PlanPercentage> PlanPercentages { get; set; }
|
||||
|
||||
#region TemporaryClientRegisteration
|
||||
|
||||
public DbSet<ContractingPartyTemp> ContractingPartyTemps { get; set; }
|
||||
|
||||
19
CompanyManagment.EFCore/Mapping/PlanPercentageMapping.cs
Normal file
19
CompanyManagment.EFCore/Mapping/PlanPercentageMapping.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Company.Domain.InstitutionPlanAgg;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace CompanyManagment.EFCore.Mapping;
|
||||
|
||||
public class PlanPercentageMapping : IEntityTypeConfiguration<PlanPercentage>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<PlanPercentage> builder)
|
||||
{
|
||||
builder.ToTable("PlanPercentage");
|
||||
builder.HasKey(x => x.id);
|
||||
}
|
||||
}
|
||||
9010
CompanyManagment.EFCore/Migrations/20250405124141_addPlanPercentageTable.Designer.cs
generated
Normal file
9010
CompanyManagment.EFCore/Migrations/20250405124141_addPlanPercentageTable.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,39 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace CompanyManagment.EFCore.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class addPlanPercentageTable : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "PlanPercentage",
|
||||
columns: table => new
|
||||
{
|
||||
id = table.Column<long>(type: "bigint", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
ContractAndCheckoutPercent = table.Column<int>(type: "int", nullable: false),
|
||||
InsurancePercent = table.Column<int>(type: "int", nullable: false),
|
||||
RollCallPercent = table.Column<int>(type: "int", nullable: false),
|
||||
CustomizeCheckoutPercent = table.Column<int>(type: "int", nullable: false),
|
||||
ContractAndCheckoutInPersonPercent = table.Column<int>(type: "int", nullable: false),
|
||||
InsuranceInPersonPercent = table.Column<int>(type: "int", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_PlanPercentage", x => x.id);
|
||||
});
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "PlanPercentage");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2871,6 +2871,37 @@ namespace CompanyManagment.EFCore.Migrations
|
||||
b.ToTable("InstitutionPlan", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Company.Domain.InstitutionPlanAgg.PlanPercentage", b =>
|
||||
{
|
||||
b.Property<long>("id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("id"));
|
||||
|
||||
b.Property<int>("ContractAndCheckoutInPersonPercent")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("ContractAndCheckoutPercent")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("CustomizeCheckoutPercent")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("InsuranceInPersonPercent")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("InsurancePercent")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("RollCallPercent")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("id");
|
||||
|
||||
b.ToTable("PlanPercentage", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Company.Domain.InsurancJobAgg.InsuranceJob", b =>
|
||||
{
|
||||
b.Property<long>("id")
|
||||
|
||||
@@ -12,6 +12,7 @@ using CompanyManagment.App.Contracts.Employer;
|
||||
using CompanyManagment.App.Contracts.InstitutionContract;
|
||||
using CompanyManagment.App.Contracts.Workshop;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using PersianTools.Core;
|
||||
|
||||
namespace CompanyManagment.EFCore.Repository;
|
||||
@@ -510,13 +511,64 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
|
||||
public double GetcontractAmount(int countPerson)
|
||||
{
|
||||
double res = 0;
|
||||
if (countPerson > 0)
|
||||
var planPercentage = _context.PlanPercentages.FirstOrDefault();
|
||||
int contarctAndCheckoutPercent = 100;
|
||||
int insurancePercent = 50;
|
||||
int rollCallPercent = 100;
|
||||
int customizeCkeckoutPercen = 50;
|
||||
int contarctAndCheckoutInPersonPercent = 900;
|
||||
int insuranceInPersonPercent = 500;
|
||||
if (planPercentage != null)
|
||||
{
|
||||
contarctAndCheckoutPercent = planPercentage.ContractAndCheckoutPercent;
|
||||
insurancePercent = planPercentage.InsurancePercent;
|
||||
rollCallPercent = planPercentage.RollCallPercent;
|
||||
customizeCkeckoutPercen = planPercentage.CustomizeCheckoutPercent;
|
||||
contarctAndCheckoutInPersonPercent = planPercentage.ContractAndCheckoutInPersonPercent;
|
||||
insuranceInPersonPercent = planPercentage.InsuranceInPersonPercent;
|
||||
}
|
||||
|
||||
|
||||
|
||||
var dailyWageYearlySalery = _context.YearlySalaries.Include(i=>i.YearlySalaryItemsList).FirstOrDefault(x =>
|
||||
x.StartDate.Date <= DateTime.Now.Date && x.EndDate >= DateTime.Now.Date);
|
||||
double res = 0;
|
||||
if (countPerson > 0 && dailyWageYearlySalery != null)
|
||||
{
|
||||
var dailyWage = dailyWageYearlySalery.YearlySalaryItemsList.Where(x => x.ItemName == "مزد روزانه")
|
||||
.Select(x => x.ItemValue).FirstOrDefault();
|
||||
|
||||
|
||||
var plan = _context.InstitutionPlans.FirstOrDefault(x => x.CountPerson == countPerson);
|
||||
if (plan != null)
|
||||
{
|
||||
res = plan.FinalContractAmont;
|
||||
//مبلغ قرارداد و تصفیه
|
||||
var contarctAndCheckout = ((dailyWage * contarctAndCheckoutPercent) / 100) * countPerson *
|
||||
plan.IncreasePercentage;
|
||||
//خدمات بیمه
|
||||
var insurance = ((dailyWage * insurancePercent) / 100) * countPerson *
|
||||
plan.IncreasePercentage;
|
||||
////خدمات حضور غیاب
|
||||
//var rollCall = ((dailyWage * rollCallPercent) / 100) * countPerson *
|
||||
// plan.IncreasePercentage;
|
||||
|
||||
////خدمات فیش حقوقی غیر رسمی
|
||||
//var customizeCkeckout = ((dailyWage * customizeCkeckoutPercen) / 100) * countPerson *
|
||||
// plan.IncreasePercentage;
|
||||
|
||||
//خدمات حضوری قرارداد و تصفیه
|
||||
var contarctAndCheckoutInPerson = ((dailyWage * contarctAndCheckoutInPersonPercent) / 100) * countPerson *
|
||||
plan.IncreasePercentage;
|
||||
|
||||
//خدمات حضوری بیمه
|
||||
var insuranceInPerson = ((dailyWage * insuranceInPersonPercent) / 100) * countPerson *
|
||||
plan.IncreasePercentage;
|
||||
|
||||
|
||||
//جمع کل
|
||||
res = contarctAndCheckout + insurance + contarctAndCheckoutInPerson + insuranceInPerson;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
170
CompanyManagment.EFCore/Repository/PlanPercentageRepository.cs
Normal file
170
CompanyManagment.EFCore/Repository/PlanPercentageRepository.cs
Normal file
@@ -0,0 +1,170 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using _0_Framework.Application;
|
||||
using _0_Framework.InfraStructure;
|
||||
using Company.Domain.InstitutionPlanAgg;
|
||||
using CompanyManagment.App.Contracts.InstitutionPlan;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace CompanyManagment.EFCore.Repository;
|
||||
|
||||
public class PlanPercentageRepository : RepositoryBase<long, PlanPercentage>, IPlanPercentageRepository
|
||||
{
|
||||
private readonly CompanyContext _context;
|
||||
public PlanPercentageRepository(CompanyContext context) : base(context)
|
||||
{
|
||||
_context = context;
|
||||
}
|
||||
|
||||
public EditInstitutionPlanPercentage GetById(long id)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
public EditInstitutionPlanPercentage GetByFirst()
|
||||
{
|
||||
return _context.PlanPercentages.Select(x => new EditInstitutionPlanPercentage()
|
||||
{
|
||||
Id = x.id,
|
||||
ContractAndCheckoutInPersonPercent = x.ContractAndCheckoutInPersonPercent,
|
||||
CustomizeCheckoutPercent = x.CustomizeCheckoutPercent,
|
||||
ContractAndCheckoutPercent = x.ContractAndCheckoutPercent,
|
||||
InsuranceInPersonPercent = x.InsuranceInPersonPercent,
|
||||
InsurancePercent = x.InsurancePercent,
|
||||
RollCallPercent = x.RollCallPercent,
|
||||
ContractAndCheckoutInPersonPercentStr = $"{x.ContractAndCheckoutInPersonPercent}",
|
||||
CustomizeCheckoutPercentStr = $"{x.CustomizeCheckoutPercent}",
|
||||
ContractAndCheckoutPercentStr = $"{x.ContractAndCheckoutPercent}",
|
||||
InsuranceInPersonPercentStr = $"{x.InsuranceInPersonPercent}",
|
||||
InsurancePercentStr = $"{x.InsurancePercent}",
|
||||
RollCallPercentStr = $"{x.RollCallPercent}",
|
||||
|
||||
}).FirstOrDefault();
|
||||
}
|
||||
|
||||
public List<InstitutionPlanViewModel> GetInstitutionPlanList(int pageIndex, int countPeron)
|
||||
{
|
||||
var planPercentage = _context.PlanPercentages.FirstOrDefault();
|
||||
if (planPercentage == null)
|
||||
return new List<InstitutionPlanViewModel>();
|
||||
|
||||
var dailyWageYearlySalery = _context.YearlySalaries.Include(i => i.YearlySalaryItemsList).FirstOrDefault(x =>
|
||||
x.StartDate.Date <= DateTime.Now.Date && x.EndDate >= DateTime.Now.Date);
|
||||
if (dailyWageYearlySalery == null)
|
||||
return new List<InstitutionPlanViewModel>();
|
||||
|
||||
var dailyWage = dailyWageYearlySalery.YearlySalaryItemsList.Where(x => x.ItemName == "مزد روزانه")
|
||||
.Select(x => x.ItemValue).FirstOrDefault();
|
||||
|
||||
if (countPeron > 0)
|
||||
{
|
||||
var planByCountPerson = _context.InstitutionPlans.Where(x => x.CountPerson == countPeron).Select(plan => new InstitutionPlanViewModel
|
||||
{
|
||||
CountPerson = plan.CountPerson,
|
||||
|
||||
ContractAndCheckoutDouble =
|
||||
((dailyWage * planPercentage.ContractAndCheckoutPercent / 100) * plan.CountPerson * plan.IncreasePercentage),
|
||||
|
||||
InsuranceDouble = (((dailyWage * planPercentage.InsurancePercent) / 100) * plan.CountPerson *
|
||||
plan.IncreasePercentage),
|
||||
|
||||
RollCallDouble = (((dailyWage * planPercentage.RollCallPercent) / 100) * plan.CountPerson *
|
||||
plan.IncreasePercentage),
|
||||
|
||||
CustomizeCheckoutDouble = (((dailyWage * planPercentage.CustomizeCheckoutPercent) / 100) * plan.CountPerson *
|
||||
plan.IncreasePercentage),
|
||||
|
||||
ContractAndCheckoutInPersonDouble = (((dailyWage * planPercentage.ContractAndCheckoutInPersonPercent) / 100) * plan.CountPerson *
|
||||
plan.IncreasePercentage),
|
||||
|
||||
InsuranceInPersonDouble = (((dailyWage * planPercentage.InsuranceInPersonPercent) / 100) * plan.CountPerson *
|
||||
plan.IncreasePercentage)
|
||||
|
||||
}).ToList();
|
||||
|
||||
planByCountPerson = planByCountPerson.Select(plan => new InstitutionPlanViewModel
|
||||
{
|
||||
CountPerson = plan.CountPerson,
|
||||
|
||||
ContractAndCheckout = plan.ContractAndCheckoutDouble.ToMoney(),
|
||||
|
||||
Insurance= plan.InsuranceDouble.ToMoney(),
|
||||
|
||||
RollCall = plan.RollCallDouble.ToMoney(),
|
||||
|
||||
CustomizeCheckout = plan.CustomizeCheckoutDouble.ToMoney(),
|
||||
|
||||
ContractAndCheckoutInPerson = plan.ContractAndCheckoutInPersonDouble.ToMoney(),
|
||||
|
||||
InsuranceInPerson = plan.InsuranceInPersonDouble.ToMoney(),
|
||||
|
||||
InPersonSumAmountStr = (plan.ContractAndCheckoutDouble + plan.InsuranceDouble + plan.ContractAndCheckoutInPersonDouble + plan.InsuranceInPersonDouble).ToMoney(),
|
||||
|
||||
OnlineAndInPersonSumAmountStr = (plan.ContractAndCheckoutDouble + plan.InsuranceDouble + plan.ContractAndCheckoutInPersonDouble + plan.InsuranceInPersonDouble + plan.RollCallDouble + plan.CustomizeCheckoutDouble).ToMoney(),
|
||||
|
||||
OnlineOnlySumAmountStr = (plan.ContractAndCheckoutDouble + plan.InsuranceDouble + plan.RollCallDouble + plan.CustomizeCheckoutDouble).ToMoney(),
|
||||
|
||||
}).ToList();
|
||||
|
||||
return planByCountPerson;
|
||||
}
|
||||
|
||||
|
||||
|
||||
var plans = _context.InstitutionPlans
|
||||
.OrderBy(x => x.CountPerson)
|
||||
.Skip(pageIndex)
|
||||
.Take(30)
|
||||
.Select(plan => new InstitutionPlanViewModel
|
||||
{
|
||||
CountPerson = plan.CountPerson,
|
||||
|
||||
ContractAndCheckoutDouble =
|
||||
((dailyWage * planPercentage.ContractAndCheckoutPercent / 100) * plan.CountPerson * plan.IncreasePercentage),
|
||||
|
||||
InsuranceDouble = (((dailyWage * planPercentage.InsurancePercent) / 100) * plan.CountPerson *
|
||||
plan.IncreasePercentage),
|
||||
|
||||
RollCallDouble = (((dailyWage * planPercentage.RollCallPercent) / 100) * plan.CountPerson *
|
||||
plan.IncreasePercentage),
|
||||
|
||||
CustomizeCheckoutDouble = (((dailyWage * planPercentage.CustomizeCheckoutPercent) / 100) * plan.CountPerson *
|
||||
plan.IncreasePercentage),
|
||||
|
||||
ContractAndCheckoutInPersonDouble = (((dailyWage * planPercentage.ContractAndCheckoutInPersonPercent) / 100) * plan.CountPerson *
|
||||
plan.IncreasePercentage),
|
||||
|
||||
InsuranceInPersonDouble = (((dailyWage * planPercentage.InsuranceInPersonPercent) / 100) * plan.CountPerson *
|
||||
plan.IncreasePercentage)
|
||||
}).ToList();
|
||||
|
||||
plans = plans.Select(plan => new InstitutionPlanViewModel
|
||||
{
|
||||
CountPerson = plan.CountPerson,
|
||||
|
||||
ContractAndCheckout = plan.ContractAndCheckoutDouble.ToMoney(),
|
||||
|
||||
Insurance = plan.InsuranceDouble.ToMoney(),
|
||||
|
||||
RollCall = plan.RollCallDouble.ToMoney(),
|
||||
|
||||
CustomizeCheckout = plan.CustomizeCheckoutDouble.ToMoney(),
|
||||
|
||||
ContractAndCheckoutInPerson = plan.ContractAndCheckoutInPersonDouble.ToMoney(),
|
||||
|
||||
InsuranceInPerson = plan.InsuranceInPersonDouble.ToMoney(),
|
||||
|
||||
InPersonSumAmountStr = (plan.ContractAndCheckoutDouble + plan.InsuranceDouble + plan.ContractAndCheckoutInPersonDouble + plan.InsuranceInPersonDouble).ToMoney(),
|
||||
|
||||
OnlineAndInPersonSumAmountStr = (plan.ContractAndCheckoutDouble + plan.InsuranceDouble + plan.ContractAndCheckoutInPersonDouble + plan.InsuranceInPersonDouble + plan.RollCallDouble + plan.CustomizeCheckoutDouble).ToMoney(),
|
||||
|
||||
OnlineOnlySumAmountStr = (plan.ContractAndCheckoutDouble + plan.InsuranceDouble + plan.RollCallDouble + plan.CustomizeCheckoutDouble).ToMoney(),
|
||||
|
||||
}).ToList();
|
||||
|
||||
|
||||
return plans;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -198,9 +198,11 @@ using CompanyManagement.Infrastructure.Excel.SalaryAid;
|
||||
using CompanyManagment.App.Contracts.EmployeeDocuments;
|
||||
using CompanyManagment.App.Contracts.EmployeeDocumentsAdminSelection;
|
||||
using Company.Domain.EmployeeClientTempAgg;
|
||||
using Company.Domain.InstitutionPlanAgg;
|
||||
using Company.Domain.LeftWorkTempAgg;
|
||||
using Company.Domain.TemporaryClientRegistrationAgg;
|
||||
using CompanyManagment.App.Contracts.EmployeeClientTemp;
|
||||
using CompanyManagment.App.Contracts.InstitutionPlan;
|
||||
using CompanyManagment.App.Contracts.LeftWorkTemp;
|
||||
using CompanyManagment.App.Contracts.TemporaryClientRegistration;
|
||||
|
||||
@@ -452,6 +454,10 @@ public class PersonalBootstrapper
|
||||
|
||||
#endregion
|
||||
services.AddTransient<IRollCallDomainService, RollCallDomainService>();
|
||||
|
||||
|
||||
services.AddTransient<IPlanPercentageRepository, PlanPercentageRepository>();
|
||||
services.AddTransient<IInstitutionPlanApplication, InstitutionPlanApplication>();
|
||||
//=========End Of Main====================================
|
||||
|
||||
//---File Project------------------------------------
|
||||
|
||||
@@ -15,6 +15,7 @@ using Company.Domain.ReportAgg;
|
||||
using Company.Domain.RollCallAgg;
|
||||
using Company.Domain.RollCallAgg.DomainService;
|
||||
using CompanyManagment.App.Contracts.AndroidApkVersion;
|
||||
using CompanyManagment.App.Contracts.InstitutionPlan;
|
||||
using CompanyManagment.App.Contracts.TemporaryClientRegistration;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using IUidService = _0_Framework.Application.UID.IUidService;
|
||||
@@ -48,6 +49,7 @@ namespace ServiceHost.Pages
|
||||
private readonly IWebHostEnvironment _webHostEnvironment;
|
||||
private readonly IAndroidApkVersionApplication _androidApkVersionApplication;
|
||||
private readonly ITemporaryClientRegistrationApplication _clientRegistrationApplication;
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -70,27 +72,61 @@ namespace ServiceHost.Pages
|
||||
|
||||
public IActionResult OnGet()
|
||||
{
|
||||
//bool ex = false;
|
||||
//while (!ex)
|
||||
//{
|
||||
// Console.WriteLine("enter National code ... ");
|
||||
// var nationalCode = Console.ReadLine();
|
||||
// Console.WriteLine("enter DateOfBirth ... ");
|
||||
// var dateOfBirth = Console.ReadLine();
|
||||
// Console.WriteLine("enter phoneNumber ... ");
|
||||
// var phone = Console.ReadLine();
|
||||
// var res =_clientRegistrationApplication.CreateContractingPartyTemp(nationalCode, dateOfBirth, phone).GetAwaiter().GetResult();
|
||||
// Console.WriteLine("do you want to exit ... ");
|
||||
// var exitCheck = Console.ReadLine();
|
||||
// if (exitCheck == "yes")
|
||||
// ex = true;
|
||||
//}
|
||||
|
||||
bool ex = false;
|
||||
//while (!ex)
|
||||
//{
|
||||
// Console.WriteLine("enter National code ... ");
|
||||
// var nationalCode = Console.ReadLine();
|
||||
// Console.WriteLine("enter DateOfBirth ... ");
|
||||
// var dateOfBirth = Console.ReadLine();
|
||||
// Console.WriteLine("enter phoneNumber ... ");
|
||||
// var phone = Console.ReadLine();
|
||||
// var res =_clientRegistrationApplication.CreateContractingPartyTemp(nationalCode, dateOfBirth, phone).GetAwaiter().GetResult();
|
||||
// Console.WriteLine("do you want to exit ... ");
|
||||
// var exitCheck = Console.ReadLine();
|
||||
// if (exitCheck == "yes")
|
||||
// ex = true;
|
||||
//}
|
||||
|
||||
// _reportRepository.GetAllActiveWorkshopsNew("1403", "12");
|
||||
// while (!ex)
|
||||
// {
|
||||
// var onGet = _institutionPlanApplication.GetByFirst();
|
||||
// Console.WriteLine("enter ContractAndCheckoutInPersonPercent ... " + onGet.ContractAndCheckoutInPersonPercent);
|
||||
// var ContractAndCheckoutInPersonPercent = Console.ReadLine();
|
||||
// Console.WriteLine("enter ContractAndCheckoutPercent ... " + onGet.ContractAndCheckoutPercent);
|
||||
// var ContractAndCheckoutPercent = Console.ReadLine();
|
||||
|
||||
//var test = _uidService.GetPersonalInfo("2669318622", "1363/02/25");
|
||||
HasApkToDownload = _androidApkVersionApplication.HasAndroidApkToDownload();
|
||||
// Console.WriteLine("enter InsurancePercent ... " + onGet.InsurancePercent);
|
||||
// var InsurancePercent = Console.ReadLine();
|
||||
// Console.WriteLine("enter InsuranceInPersonPercent ... " + onGet.InsuranceInPersonPercent);
|
||||
// var InsuranceInPersonPercent = Console.ReadLine();
|
||||
|
||||
// Console.WriteLine("enter CustomizeCheckoutPercent ... " + onGet.CustomizeCheckoutPercent);
|
||||
// var CustomizeCheckoutPercent = Console.ReadLine();
|
||||
// Console.WriteLine("enter RollCallPercent ... " + onGet.RollCallPercent);
|
||||
// var RollCallPercent = Console.ReadLine();
|
||||
// //var res = _institutionPlanApplication.GetInstitutionPlanList(Convert.ToInt32(pageIndex),
|
||||
// // Convert.ToInt32(countPerson));
|
||||
|
||||
// var res = _institutionPlanApplication.CreateInstitutionPlanPercentage(new CreateInstitutionPlanPercentage()
|
||||
// {
|
||||
// ContractAndCheckoutInPersonPercentStr = ContractAndCheckoutInPersonPercent,
|
||||
// ContractAndCheckoutPercentStr = ContractAndCheckoutPercent,
|
||||
// InsurancePercentStr = InsurancePercent,
|
||||
// InsuranceInPersonPercentStr = InsuranceInPersonPercent,
|
||||
// CustomizeCheckoutPercentStr = CustomizeCheckoutPercent,
|
||||
// RollCallPercentStr = RollCallPercent
|
||||
// });
|
||||
|
||||
// Console.WriteLine("do you want to exit ... ");
|
||||
// var exitCheck = Console.ReadLine();
|
||||
// if (exitCheck == "y")
|
||||
// ex = true;
|
||||
//}
|
||||
// _reportRepository.GetAllActiveWorkshopsNew("1403", "12");
|
||||
|
||||
//var test = _uidService.GetPersonalInfo("2669318622", "1363/02/25");
|
||||
HasApkToDownload = _androidApkVersionApplication.HasAndroidApkToDownload();
|
||||
if (User.Identity is { IsAuthenticated: true })
|
||||
{
|
||||
if (User.FindFirstValue("IsCamera") == "true")
|
||||
|
||||
Reference in New Issue
Block a user