Merge branch 'master' into Fix/program-manager/fix-some-bugs

This commit is contained in:
gozareshgir
2026-01-25 20:05:30 +03:30
22 changed files with 11928 additions and 152 deletions

View File

@@ -2,6 +2,7 @@
<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<NuGetAudit>false</NuGetAudit>
</PropertyGroup>
<ItemGroup>

View File

@@ -31,7 +31,7 @@ public class Checkout : EntityBase
string overNightWorkValue, string fridayWorkValue, string rotatingShifValue, string absenceValue,
string totalDayOfLeaveCompute, string totalDayOfYearsCompute, string totalDayOfBunosesCompute,
ICollection<CheckoutLoanInstallment> loanInstallments,
ICollection<CheckoutSalaryAid> salaryAids, CheckoutRollCall checkoutRollCall, TimeSpan employeeMandatoryHours, bool hasInsuranceShareTheSameAsList)
ICollection<CheckoutSalaryAid> salaryAids, CheckoutRollCall checkoutRollCall, TimeSpan employeeMandatoryHours, bool hasInsuranceShareTheSameAsList, ICollection<CheckoutReward> rewards,double rewardPay)
{
EmployeeFullName = employeeFullName;
FathersName = fathersName;
@@ -71,7 +71,7 @@ public class Checkout : EntityBase
TotalClaims = totalClaims;
TotalDeductions = totalDeductions;
TotalPayment = totalPayment;
RewardPay = 0;
RewardPay = rewardPay;
IsActiveString = "true";
Signature = signature;
MarriedAllowance = marriedAllowance;
@@ -93,6 +93,7 @@ public class Checkout : EntityBase
CheckoutRollCall = checkoutRollCall;
EmployeeMandatoryHours = employeeMandatoryHours;
HasInsuranceShareTheSameAsList = hasInsuranceShareTheSameAsList;
Rewards = rewards;
}
@@ -130,7 +131,7 @@ public class Checkout : EntityBase
public double BonusesPay { get; private set; }
public double YearsPay { get; private set; }
public double LeavePay { get; private set; }
public double? RewardPay { get; private set; }
public double RewardPay { get; private set; }
public double InsuranceDeduction { get; private set; }
public double TaxDeducation { get; private set; }
public double InstallmentDeduction { get; private set; }
@@ -223,6 +224,8 @@ public class Checkout : EntityBase
public ICollection<CheckoutLoanInstallment> LoanInstallments { get; set; } = [];
public ICollection<CheckoutSalaryAid> SalaryAids { get; set; } = [];
public ICollection<CheckoutReward> Rewards { get; set; } = [];
public CheckoutRollCall CheckoutRollCall { get; private set; }
#endregion
@@ -239,7 +242,7 @@ public class Checkout : EntityBase
double insuranceDeduction, double taxDeducation, double installmentDeduction,
double salaryAidDeduction, double absenceDeduction, string sumOfWorkingDays
, string archiveCode, string personnelCode,
string totalClaims, string totalDeductions, double totalPayment, double? rewardPay)
string totalClaims, string totalDeductions, double totalPayment, double rewardPay)
{
EmployeeFullName = employeeFullName;
FathersName = fathersName;
@@ -337,6 +340,11 @@ public class Checkout : EntityBase
InstallmentDeduction = installmentsAmount;
}
public void SetReward(ICollection<CheckoutReward> rewards, double rewardAmount)
{
RewardPay = rewardAmount;
Rewards = rewards;
}
public void SetCheckoutRollCall(CheckoutRollCall checkoutRollCall)
{
CheckoutRollCall = checkoutRollCall;

View File

@@ -0,0 +1,57 @@
using System;
namespace Company.Domain.CheckoutAgg.ValueObjects;
public class CheckoutReward
{
public CheckoutReward(string amount, double amountDouble, string grantDateFa, DateTime grantDateGr, string description, string title, long entityId)
{
Amount = amount;
AmountDouble = amountDouble;
GrantDateFa = grantDateFa;
GrantDateGr = grantDateGr;
Description = description;
Title = title;
EntityId = entityId;
}
/// <summary>
/// مبلغ پاداش
/// string
/// </summary>
public string Amount { get; set; }
/// <summary>
/// مبلغ پاداش
/// double
/// </summary>
public double AmountDouble { get; set; }
/// <summary>
/// تاریخ اعطاء
/// شمسی
/// </summary>
public string GrantDateFa { get; set; }
/// <summary>
/// تاریخ اعطاء
/// میلادی
/// </summary>
public DateTime GrantDateGr { get; set; }
/// <summary>
/// توضیحات
/// </summary>
public string Description { get; set; }
/// <summary>
/// عنوان
/// </summary>
public string Title { get; set; }
/// <summary>
/// آی دی پاداش
/// </summary>
public long EntityId { get; set; }
}

View File

@@ -1,15 +1,16 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using _0_Framework.Domain;
using _0_Framework.Domain;
using Company.Domain.CustomizeWorkshopEmployeeSettingsAgg.Entities;
using CompanyManagment.App.Contracts.Contract;
using CompanyManagment.App.Contracts.CustomizeCheckout;
using CompanyManagment.App.Contracts.Leave;
using CompanyManagment.App.Contracts.Loan;
using CompanyManagment.App.Contracts.Reward;
using CompanyManagment.App.Contracts.RollCall;
using CompanyManagment.App.Contracts.SalaryAid;
using CompanyManagment.App.Contracts.WorkingHoursTemp;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Company.Domain.RollCallAgg;
@@ -53,6 +54,9 @@ public interface IRollCallMandatoryRepository : IRepository<long, RollCall>
List<SalaryAidViewModel> SalaryAidsForCheckout(long employeeId, long workshopId, DateTime checkoutStart,
DateTime checkoutEnd);
List<RewardViewModel> RewardForCheckout(long employeeId, long workshopId, DateTime checkoutEnd,
DateTime checkoutStart);
Task<ComputingViewModel> RotatingShiftReport(long workshopId, long employeeId, DateTime contractStart,
DateTime contractEnd, string shiftwork, bool hasRollCall, CreateWorkingHoursTemp command,bool holidayWorking);
}

View File

@@ -193,4 +193,9 @@ public class CreateCheckout
/// پایه سنوات قبل از تاثیر ساعت کار
/// </summary>
public double BaseYearUnAffected { get; set; }
/// <summary>
/// آیا برای محاسبه پاداش مجاز است
/// </summary>
public bool RewardPayCompute { get; set; }
}

View File

@@ -4,6 +4,7 @@
<TargetFramework>net10.0</TargetFramework>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<NoWarn>$(NoWarn);1591</NoWarn>
<NuGetAudit>false</NuGetAudit>
</PropertyGroup>
<ItemGroup>

View File

@@ -324,6 +324,7 @@ public class InstitutionContractCreationWorkshopsResponse
{
public List<WorkshopTempViewModel> WorkshopTemps { get; set; }
public string TotalAmount { get; set; }
public Guid TempId { get; set; }
}
public class InstitutionContractCreationWorkshopsRequest

View File

@@ -151,6 +151,9 @@ public class CreateWorkshop
/// تصفیه حساب بصورت استاتیک محاصبه شود
/// </summary>
public bool IsStaticCheckout { get; set; }
/// <summary>
/// آیا پاداش در فیش حقوقی محاسبه شود
/// </summary>
public bool RewardComputeOnCheckout { get; set; }
}

View File

@@ -240,6 +240,16 @@ public class CheckoutApplication : ICheckoutApplication
command.InstallmentDeduction = loanInstallments.Sum(x => x.AmountForMonth.MoneyToDouble());
var rewards = new List<CheckoutReward>();
double rewardPay = 0;
if (command.RewardPayCompute)
{
rewards = _rollCallMandatoryRepository.RewardForCheckout(command.EmployeeId, command.WorkshopId, checkoutEnd.ToGeorgianDateTime(), checkoutStart.ToGeorgianDateTime())
.Select(x => new CheckoutReward(x.Amount, x.AmountDouble, x.GrantDateFa, x.GrantDateGr, x.Description, x.Title, x.Id)).ToList();
rewardPay = rewards.Sum(x => x.AmountDouble);
}
@@ -361,7 +371,7 @@ public class CheckoutApplication : ICheckoutApplication
var totalClaimsDouble = monthlyWage + bacicYears + consumableItem + housingAllowance + marriedAllowance + command.OvertimePay +
command.NightworkPay + familyAllowance + bunos + years + command.LeavePay + command.FridayPay + command.ShiftPay;
command.NightworkPay + familyAllowance + bunos + years + command.LeavePay + command.FridayPay + command.ShiftPay + rewardPay;
var totalClaims = totalClaimsDouble.ToMoney();
var totalDeductionDouble = insuranceDeduction + command.AbsenceDeduction + command.InstallmentDeduction + command.SalaryAidDeduction;
var totalDeductions = totalDeductionDouble.ToMoney();
@@ -386,7 +396,7 @@ public class CheckoutApplication : ICheckoutApplication
, command.OvertimePay, command.NightworkPay, command.FridayPay, 0, command.ShiftPay, familyAllowance, bunos, years, command.LeavePay, insuranceDeduction, 0, command.InstallmentDeduction, command.SalaryAidDeduction, command.AbsenceDeduction, sumOfWorkingDays,
command.ArchiveCode, command.PersonnelCode, totalClaims, totalDeductions, totalPayment, command.Signature, marriedAllowance, command.LeaveCheckout, command.CreditLeaves, command.AbsencePeriod, command.AverageHoursPerDay, command.HasRollCall, command.OverTimeWorkValue, command.OverNightWorkValue
, command.FridayWorkValue, command.RotatingShiftValue, command.AbsenceValue, command.TotalDayOfLeaveCompute, command.TotalDayOfYearsCompute, command.TotalDayOfBunosesCompute,
loanInstallments, salaryAids,checkoutRollCall,command.EmployeeMandatoryHours, hasInsuranceShareTheSameAsList);
loanInstallments, salaryAids,checkoutRollCall,command.EmployeeMandatoryHours, hasInsuranceShareTheSameAsList, rewards, rewardPay);
_checkoutRepository.CreateCkeckout(checkout).GetAwaiter().GetResult();
//_checkoutRepository.SaveChanges();

View File

@@ -1516,8 +1516,9 @@ public class InstitutionContractApplication : IInstitutionContractApplication
.Where(x => x.WorkshopCreated && x.WorkshopId is > 0).ToList();
var currentWorkshops = institutionContract.WorkshopGroup.CurrentWorkshops.ToList();
var accountId = _contractingPartyRepository
.GetAccountByPersonalContractingParty(institutionContract.ContractingPartyId).Id;
var account = _contractingPartyRepository
.GetAccountByPersonalContractingParty(institutionContract.ContractingPartyId);
var accountId = account.Id;
foreach (var createdWorkshop in initialCreatedWorkshops)
{
if (currentWorkshops.Any(x => x.WorkshopId == createdWorkshop.WorkshopId))
@@ -1569,7 +1570,7 @@ public class InstitutionContractApplication : IInstitutionContractApplication
var previousInstitutionContract = await _institutionContractRepository
.GetPreviousContract(institutionContract.id);
previousInstitutionContract?.DeActive();
ReActiveAllAfterCreateNew(institutionContract.ContractingPartyId);
await _contractingPartyRepository.ActiveAllAsync(institutionContract.ContractingPartyId);
await _institutionContractRepository.SaveChangesAsync();
return op.Succcedded();
}

View File

@@ -34,7 +34,7 @@ class CheckoutMapping : IEntityTypeConfiguration<Checkout>
builder.Property(x => x.FamilyAllowance);
builder.Property(x => x.HousingAllowance);
builder.Property(x => x.ConsumableItems);
builder.Property(x => x.RewardPay).HasColumnType("float").IsRequired(false);
builder.Property(x => x.RewardPay);
builder.Property(x => x.LeaveCheckout);
builder.Property(x => x.CreditLeaves);
@@ -82,6 +82,15 @@ class CheckoutMapping : IEntityTypeConfiguration<Checkout>
salaryAid.Property(x => x.CalculationDateTimeFa).HasMaxLength(15);
});
builder.OwnsMany(x => x.Rewards, reward =>
{
reward.Property(x => x.Description).HasColumnType("ntext");
reward.Property(x => x.Title).HasMaxLength(255);
reward.Property(x=> x.Amount).HasMaxLength(25);
reward.Property(x => x.GrantDateFa).HasMaxLength(10);
});
builder.OwnsOne(x => x.CheckoutRollCall, rollCall =>
{
rollCall.Property(x => x.TotalPresentTimeSpan).HasTimeSpanConversion();

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,66 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace CompanyManagment.EFCore.Migrations
{
/// <inheritdoc />
public partial class AddRewardtocheckout : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<double>(
name: "RewardPay",
table: "Checkouts",
type: "float",
nullable: false,
defaultValue: 0.0,
oldClrType: typeof(double),
oldType: "float",
oldNullable: true);
migrationBuilder.CreateTable(
name: "CheckoutReward",
columns: table => new
{
Checkoutid = table.Column<long>(type: "bigint", nullable: false),
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
Amount = table.Column<string>(type: "nvarchar(25)", maxLength: 25, nullable: true),
AmountDouble = table.Column<double>(type: "float", nullable: false),
GrantDateFa = table.Column<string>(type: "nvarchar(10)", maxLength: 10, nullable: true),
GrantDateGr = table.Column<DateTime>(type: "datetime2", nullable: false),
Description = table.Column<string>(type: "ntext", nullable: true),
Title = table.Column<string>(type: "nvarchar(255)", maxLength: 255, nullable: true),
EntityId = table.Column<long>(type: "bigint", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_CheckoutReward", x => new { x.Checkoutid, x.Id });
table.ForeignKey(
name: "FK_CheckoutReward_Checkouts_Checkoutid",
column: x => x.Checkoutid,
principalTable: "Checkouts",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
});
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "CheckoutReward");
migrationBuilder.AlterColumn<double>(
name: "RewardPay",
table: "Checkouts",
type: "float",
nullable: true,
oldClrType: typeof(double),
oldType: "float");
}
}
}

View File

@@ -635,7 +635,7 @@ namespace CompanyManagment.EFCore.Migrations
.HasMaxLength(10)
.HasColumnType("nvarchar(10)");
b.Property<double?>("RewardPay")
b.Property<double>("RewardPay")
.HasColumnType("float");
b.Property<string>("RotatingShiftValue")
@@ -7501,6 +7501,49 @@ namespace CompanyManagment.EFCore.Migrations
.HasForeignKey("Checkoutid");
});
b.OwnsMany("Company.Domain.CheckoutAgg.ValueObjects.CheckoutReward", "Rewards", b1 =>
{
b1.Property<long>("Checkoutid")
.HasColumnType("bigint");
b1.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b1.Property<int>("Id"));
b1.Property<string>("Amount")
.HasMaxLength(25)
.HasColumnType("nvarchar(25)");
b1.Property<double>("AmountDouble")
.HasColumnType("float");
b1.Property<string>("Description")
.HasColumnType("ntext");
b1.Property<long>("EntityId")
.HasColumnType("bigint");
b1.Property<string>("GrantDateFa")
.HasMaxLength(10)
.HasColumnType("nvarchar(10)");
b1.Property<DateTime>("GrantDateGr")
.HasColumnType("datetime2");
b1.Property<string>("Title")
.HasMaxLength(255)
.HasColumnType("nvarchar(255)");
b1.HasKey("Checkoutid", "Id");
b1.ToTable("CheckoutReward");
b1.WithOwner()
.HasForeignKey("Checkoutid");
});
b.OwnsMany("Company.Domain.CheckoutAgg.ValueObjects.CheckoutSalaryAid", "SalaryAids", b1 =>
{
b1.Property<long>("Checkoutid")
@@ -7545,6 +7588,8 @@ namespace CompanyManagment.EFCore.Migrations
b.Navigation("LoanInstallments");
b.Navigation("Rewards");
b.Navigation("SalaryAids");
b.Navigation("Workshop");

View File

@@ -531,6 +531,7 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
entity.SetSalaryAid(command.SalaryAids, command.SalaryAidDeduction);
entity.SetLoanInstallment(command.LoanInstallments, command.InstallmentDeduction);
entity.SetReward(command.Rewards,command.RewardPay);
entity.SetCheckoutRollCall(command.CheckoutRollCall);
entity.SetEmployeeMandatoryHours(command.EmployeeMandatoryHours);
if(command.HasInsuranceShareTheSameAsList)
@@ -934,7 +935,7 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
TotalClaims = item.TotalClaims,
TotalDeductions = item.TotalDeductions,
TotalPayment = item.TotalPayment.ToMoney(),
RewardPay = item.RewardPay.ToMoneyNullable(),
RewardPay = item.RewardPay.ToMoney(),
ContractStartGr = item.ContractStart,
ContractEndGr = item.ContractEnd,
IsLeft = false,
@@ -1335,7 +1336,7 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
TotalClaims = x.TotalClaims,
TotalDeductions = x.TotalDeductions,
TotalPayment = x.TotalPayment.ToMoney(),
RewardPay = x.RewardPay.ToMoneyNullable(),
RewardPay = x.RewardPay.ToMoney(),
ContractStartGr = x.ContractStart,
ContractEndGr = x.ContractEnd,
IsLeft = false,

View File

@@ -124,69 +124,69 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
public EditInstitutionContract GetDetails(long id)
{
return _context.InstitutionContractSet.Select(x => new EditInstitutionContract()
{
Id = x.id,
ContractNo = x.ContractNo,
ContractStartGr = x.ContractStartGr,
ContractStartFa = x.ContractStartFa,
ContractEndGr = x.ContractEndGr,
ContractEndFa = x.ContractEndFa,
RepresentativeName = x.RepresentativeName,
ContractingPartyName = x.ContractingPartyName,
RepresentativeId = x.RepresentativeId,
ContractingPartyId = x.ContractingPartyId,
ContractDateFa = x.ContractDateFa,
State = x.State,
City = x.City,
Address = x.Address,
Description = x.Description,
WorkshopManualCount = x.WorkshopManualCount,
EmployeeManualCount = x.EmployeeManualCount,
ContractAmountString = x.ContractAmount.ToMoney(),
ContractAmount = x.ContractAmount,
DailyCompenseationString = x.DailyCompenseation.ToMoney(),
ObligationString = x.Obligation.ToMoney(),
TotalAmountString = x.TotalAmount.ToMoney(),
ExtensionNo = x.ExtensionNo,
OfficialCompany = x.OfficialCompany,
TypeOfContract = x.TypeOfContract,
Signature = x.Signature,
HasValueAddedTax = x.HasValueAddedTax,
ValueAddedTax = x.ValueAddedTax,
})
{
Id = x.id,
ContractNo = x.ContractNo,
ContractStartGr = x.ContractStartGr,
ContractStartFa = x.ContractStartFa,
ContractEndGr = x.ContractEndGr,
ContractEndFa = x.ContractEndFa,
RepresentativeName = x.RepresentativeName,
ContractingPartyName = x.ContractingPartyName,
RepresentativeId = x.RepresentativeId,
ContractingPartyId = x.ContractingPartyId,
ContractDateFa = x.ContractDateFa,
State = x.State,
City = x.City,
Address = x.Address,
Description = x.Description,
WorkshopManualCount = x.WorkshopManualCount,
EmployeeManualCount = x.EmployeeManualCount,
ContractAmountString = x.ContractAmount.ToMoney(),
ContractAmount = x.ContractAmount,
DailyCompenseationString = x.DailyCompenseation.ToMoney(),
ObligationString = x.Obligation.ToMoney(),
TotalAmountString = x.TotalAmount.ToMoney(),
ExtensionNo = x.ExtensionNo,
OfficialCompany = x.OfficialCompany,
TypeOfContract = x.TypeOfContract,
Signature = x.Signature,
HasValueAddedTax = x.HasValueAddedTax,
ValueAddedTax = x.ValueAddedTax,
})
.FirstOrDefault(x => x.Id == id);
}
public EditInstitutionContract GetFirstContract(long contractingPartyId, string typeOfContract)
{
return _context.InstitutionContractSet.Select(x => new EditInstitutionContract()
{
Id = x.id,
ContractNo = x.ContractNo,
ContractStartGr = x.ContractStartGr,
ContractStartFa = x.ContractStartFa,
ContractEndGr = x.ContractEndGr,
ContractEndFa = x.ContractEndFa,
RepresentativeName = x.RepresentativeName,
ContractingPartyName = x.ContractingPartyName,
RepresentativeId = x.RepresentativeId,
ContractingPartyId = x.ContractingPartyId,
ContractDateFa = x.ContractDateFa,
State = x.State,
City = x.City,
Address = x.Address,
Description = x.Description,
WorkshopManualCount = x.WorkshopManualCount,
EmployeeManualCount = x.EmployeeManualCount,
ContractAmountString = x.ContractAmount.ToMoney(),
DailyCompenseationString = x.DailyCompenseation.ToMoney(),
ObligationString = x.Obligation.ToMoney(),
TotalAmountString = x.TotalAmount.ToMoney(),
ExtensionNo = x.ExtensionNo,
OfficialCompany = x.OfficialCompany,
TypeOfContract = x.TypeOfContract,
Signature = x.Signature
})
{
Id = x.id,
ContractNo = x.ContractNo,
ContractStartGr = x.ContractStartGr,
ContractStartFa = x.ContractStartFa,
ContractEndGr = x.ContractEndGr,
ContractEndFa = x.ContractEndFa,
RepresentativeName = x.RepresentativeName,
ContractingPartyName = x.ContractingPartyName,
RepresentativeId = x.RepresentativeId,
ContractingPartyId = x.ContractingPartyId,
ContractDateFa = x.ContractDateFa,
State = x.State,
City = x.City,
Address = x.Address,
Description = x.Description,
WorkshopManualCount = x.WorkshopManualCount,
EmployeeManualCount = x.EmployeeManualCount,
ContractAmountString = x.ContractAmount.ToMoney(),
DailyCompenseationString = x.DailyCompenseation.ToMoney(),
ObligationString = x.Obligation.ToMoney(),
TotalAmountString = x.TotalAmount.ToMoney(),
ExtensionNo = x.ExtensionNo,
OfficialCompany = x.OfficialCompany,
TypeOfContract = x.TypeOfContract,
Signature = x.Signature
})
.Where(x => x.ContractingPartyId == contractingPartyId && x.TypeOfContract == typeOfContract)
.OrderBy(x => x.ExtensionNo).FirstOrDefault();
}
@@ -604,40 +604,40 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
}).ToList(),
}).ToList();
listQuery = listQuery.Select(x => new InstitutionContractViewModel()
{
Id = x.Id,
ContractNo = x.ContractNo,
ContractStartGr = x.ContractStartGr,
ContractStartFa = x.ContractStartFa,
ContractEndGr = x.ContractEndGr,
ContractEndFa = x.ContractEndFa,
RepresentativeId = x.RepresentativeId,
RepresentativeName = x.RepresentativeName,
ContractingPartyName = x.ContractingPartyName,
ContractingPartyId = x.ContractingPartyId,
ContractAmount = x.ContractAmount,
TotalAmount = x.TotalAmount,
SearchAmount = x.SearchAmount,
IsActiveString = x.IsActiveString,
OfficialCompany = x.OfficialCompany,
TypeOfContract = x.TypeOfContract,
Signature = x.Signature,
ExpireColor = x.ExpireColor,
IsExpier = x.IsExpier,
BalanceDouble = x.BalanceDouble,
BalanceStr = x.BalanceStr,
EmployerViewModels = x.EmployerViewModels,
EmployerNo = x.EmployerNo,
EmployerName = x.EmployerViewModels.Select(n => n.FullName).FirstOrDefault(),
WorkshopViewModels = x.WorkshopViewModels,
WorkshopCount = x.WorkshopCount,
IsContractingPartyBlock = x.IsContractingPartyBlock,
BlockTimes = x.BlockTimes,
EmployeeCount =
{
Id = x.Id,
ContractNo = x.ContractNo,
ContractStartGr = x.ContractStartGr,
ContractStartFa = x.ContractStartFa,
ContractEndGr = x.ContractEndGr,
ContractEndFa = x.ContractEndFa,
RepresentativeId = x.RepresentativeId,
RepresentativeName = x.RepresentativeName,
ContractingPartyName = x.ContractingPartyName,
ContractingPartyId = x.ContractingPartyId,
ContractAmount = x.ContractAmount,
TotalAmount = x.TotalAmount,
SearchAmount = x.SearchAmount,
IsActiveString = x.IsActiveString,
OfficialCompany = x.OfficialCompany,
TypeOfContract = x.TypeOfContract,
Signature = x.Signature,
ExpireColor = x.ExpireColor,
IsExpier = x.IsExpier,
BalanceDouble = x.BalanceDouble,
BalanceStr = x.BalanceStr,
EmployerViewModels = x.EmployerViewModels,
EmployerNo = x.EmployerNo,
EmployerName = x.EmployerViewModels.Select(n => n.FullName).FirstOrDefault(),
WorkshopViewModels = x.WorkshopViewModels,
WorkshopCount = x.WorkshopCount,
IsContractingPartyBlock = x.IsContractingPartyBlock,
BlockTimes = x.BlockTimes,
EmployeeCount =
((x.WorkshopViewModels.Sum(w => w.LeftWorkIds.Count)) + (x.WorkshopViewModels.Sum(w =>
w.InsuranceLeftWorkIds.Count(c => !w.LeftWorkIds.Contains(c))))).ToString(),
ArchiveCode = x.WorkshopViewModels.Count > 0 ? ArchiveCodeFinder(x.WorkshopViewModels) : 0,
}).OrderBy(x => x.WorkshopCount != "0" && string.IsNullOrWhiteSpace(x.ExpireColor))
ArchiveCode = x.WorkshopViewModels.Count > 0 ? ArchiveCodeFinder(x.WorkshopViewModels) : 0,
}).OrderBy(x => x.WorkshopCount != "0" && string.IsNullOrWhiteSpace(x.ExpireColor))
.ThenBy(x => x.WorkshopCount == "0" && string.IsNullOrWhiteSpace(x.ExpireColor))
.ThenBy(x => x.IsExpier == "true")
.ThenBy(x => x.ExpireColor == "purple")
@@ -1474,7 +1474,8 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
IsInPersonContract = workshopGroup?.CurrentWorkshops
.Any(y => y.Services.ContractInPerson) ?? true,
IsOldContract = x.contract.SigningType == InstitutionContractSigningType.Legacy,
InstitutionContractIsSentFlag = sendFlags.ContainsKey(x.contract.id) ? sendFlags[x.contract.id] : false
InstitutionContractIsSentFlag =
sendFlags.ContainsKey(x.contract.id) ? sendFlags[x.contract.id] : false
};
}).ToList()
};
@@ -2268,7 +2269,7 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
extenstionTemp
);
var workshopIds = prevInstitutionContracts.WorkshopGroup.CurrentWorkshops.Select(x => x.WorkshopId.Value);
var workshopIds = prevInstitutionContracts.WorkshopGroup?.CurrentWorkshops?.Select(x => x.WorkshopId.Value)??[];
var workshopsNotInInstitution = employerWorkshopIds.Where(x => !workshopIds.Contains(x)).ToList();
@@ -2276,7 +2277,7 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
.Where(x => workshopIds.Contains(x.id) || employerWorkshopIds.Contains(x.id))
.ToListAsync();
var workshopDetails = prevInstitutionContracts.WorkshopGroup.CurrentWorkshops
var workshopDetails = prevInstitutionContracts.WorkshopGroup?.CurrentWorkshops?
.Select(x =>
{
var workshop = workshops.FirstOrDefault(w => w.id == x.WorkshopId);
@@ -2316,7 +2317,7 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
WorkshopId = workshop?.id ?? 0,
RollCallInPerson = service.RollCallInPerson
};
}).ToList();
}).ToList()??[];
var notIncludeWorskhopsLeftWork = await _context.LeftWorkList
.Where(x => workshopsNotInInstitution.Contains(x.WorkshopId) && x.StartWorkDate <= DateTime.Now &&
x.LeftWorkDate >= DateTime.Now)
@@ -3358,9 +3359,17 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
OneMonthPrice = institution.ContractAmountWithTax.ToMoney(),
OneMonthWithoutTax = institution.ContractAmount.ToMoney(),
OneMonthTax = institution.ContractAmountTax.ToMoney(),
VerifierFullName = institution.VerifierFullName,
VerifierPhoneNumber = institution.VerifierPhoneNumber,
VerifyCode = institution.VerifyCode,
VerifierFullName =
institution.VerificationStatus == InstitutionContractVerificationStatus.PendingForVerify
? null
: institution.VerifierFullName,
VerifierPhoneNumber =
institution.VerificationStatus == InstitutionContractVerificationStatus.PendingForVerify
? null
: institution.VerifierPhoneNumber,
VerifyCode = institution.VerificationStatus == InstitutionContractVerificationStatus.PendingForVerify
? null
: institution.VerifyCode,
VerifyDate = institution.VerifyCodeCreation.ToFarsi(),
VerifyTime = institution.VerifyCodeCreation.ToString("HH:mm:ss"),
Workshops = institution.WorkshopGroup.InitialWorkshops
@@ -3563,10 +3572,6 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
#endregion
#region PrivateMetods
/// <summary>
@@ -3611,11 +3616,8 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
#endregion
//ایجاد سند مالی ماهانه
#region CreateMontlyTransaction
/// <summary>
@@ -3625,7 +3627,6 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
public async Task CreateTransactionForInstitutionContracts(DateTime endOfMonthGr, string endOfMonthFa,
string description)
{
#region FindeNextMonth 1th
var firstDayOfMonthGr = ($"{endOfMonthFa.Substring(0, 8)}01").ToGeorgianDateTime();
@@ -3656,7 +3657,7 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
SigningType = x.SigningType,
InstallmentList = x.Installments
.Select(ins => new InstitutionContractInstallmentViewModel
{ AmountDouble = ins.Amount, InstallmentDateGr = ins.InstallmentDateGr })
{ AmountDouble = ins.Amount, InstallmentDateGr = ins.InstallmentDateGr })
.OrderBy(ins => ins.InstallmentDateGr).Skip(1).ToList(),
}).Where(x =>
x.ContractStartGr < endOfMonthGr && x.ContractEndGr >= endOfMonthGr && x.ContractAmountDouble > 0 &&
@@ -3703,7 +3704,7 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
SigningType = x.SigningType,
InstallmentList = x.Installments
.Select(ins => new InstitutionContractInstallmentViewModel
{ AmountDouble = ins.Amount, InstallmentDateGr = ins.InstallmentDateGr })
{ AmountDouble = ins.Amount, InstallmentDateGr = ins.InstallmentDateGr })
.OrderBy(ins => ins.InstallmentDateGr).Skip(1).ToList(),
}).ToListAsync();
@@ -4008,8 +4009,6 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
}
public async Task<long> GetIdByInstallmentId(long installmentId)
{
return await _context.InstitutionContractSet.Include(x => x.Installments)
@@ -4364,10 +4363,11 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
var creationTemp = await _institutionContractCreationTemp.Find(x => x.Id == request.TempId)
.FirstOrDefaultAsync();
// creationTemp.SetContractingPartyInfo(request.LegalType,request.RealParty,request.LegalParty);
bool tempCreated = false;
if (creationTemp == null)
{
throw new BadRequestException("دیتای درخواست شده نامعتبر است");
creationTemp = new InstitutionContractCreationTemp();
await _institutionContractCreationTemp.InsertOneAsync(creationTemp);
}
List<WorkshopTempViewModel> workshopDetails = [];
@@ -4445,7 +4445,6 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
Id = 0,
IdNumberSerial = "",
IdNumberSeri = "",
};
creationTemp.SetContractingPartyInfo(request.LegalType, real, legal);
}
@@ -4462,7 +4461,8 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
var res = new InstitutionContractCreationWorkshopsResponse()
{
TotalAmount = workshopDetails.Sum(x => x.WorkshopServicesAmount).ToMoney(),
WorkshopTemps = workshopDetails
WorkshopTemps = workshopDetails,
TempId = creationTemp.Id
};
return res;
}
@@ -5221,11 +5221,6 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
#endregion
#region CustomViewModels
public class WorkshopsAndEmployeeViewModel

View File

@@ -245,7 +245,7 @@ public class PersonalContractingPartyRepository : RepositoryBase<long, PersonalC
return new();
}
return _accountContext.Accounts.Where(x => x.id == accId && x.IsActiveString == "true").Select(x =>
return _accountContext.Accounts.Where(x => x.id == accId).Select(x =>
new AccountViewModel()
{
Id = x.id,
@@ -845,8 +845,7 @@ public class PersonalContractingPartyRepository : RepositoryBase<long, PersonalC
public async Task<OperationResult> ActiveAllAsync(long id)
{
OperationResult result = new OperationResult();
await using var transaction =await _context.Database.BeginTransactionAsync();
await using var accountTransaction = await _accountContext.Database.BeginTransactionAsync();
try
{
var personel = _context.PersonalContractingParties
@@ -890,15 +889,12 @@ public class PersonalContractingPartyRepository : RepositoryBase<long, PersonalC
}
await _context.SaveChangesAsync();
await transaction.CommitAsync();
await accountTransaction.CommitAsync();
result.Succcedded();
}
catch (Exception)
{
result.Failed("فعال کردن طرف حساب با خطا مواجه شد");
await transaction.RollbackAsync();
await accountTransaction.RollbackAsync();
}
return result;

View File

@@ -74,7 +74,7 @@ public class ReportClientRepository : IReportClientRepository
TotalClaims = x.TotalClaims,
TotalDeductions = x.TotalDeductions,
TotalPayment = x.TotalPayment.ToMoney(),
RewardPay = x.RewardPay.ToMoneyNullable(),
RewardPay = x.RewardPay.ToMoney(),
MarriedAllowance = x.MarriedAllowance.ToMoney(),
}).Where(x => x.WorkshopId == workshopId);
@@ -448,7 +448,7 @@ public class ReportClientRepository : IReportClientRepository
TotalClaims = x.TotalClaims,
TotalDeductions = x.TotalDeductions,
TotalPayment = x.TotalPayment.ToMoney(),
RewardPay = x.RewardPay.ToMoneyNullable(),
RewardPay = x.RewardPay.ToMoney(),
MarriedAllowance = x.MarriedAllowance.ToMoney(),
}).Where(x => x.WorkshopId == workshopId);

View File

@@ -5199,10 +5199,10 @@ public class RollCallMandatoryRepository : RepositoryBase<long, RollCall>, IRoll
};
}
private List<RewardViewModel> RewardForCheckout(long employeeId, long workshopId, DateTime checkoutEnd,
public List<RewardViewModel> RewardForCheckout(long employeeId, long workshopId, DateTime checkoutEnd,
DateTime checkoutStart)
{
return _context.Rewards.Where(x =>
var result = _context.Rewards.Where(x =>
x.WorkshopId == workshopId && x.EmployeeId == employeeId && x.GrantDate <= checkoutEnd &&
x.GrantDate >= checkoutStart).Select(x => new RewardViewModel
{
@@ -5215,6 +5215,8 @@ public class RollCallMandatoryRepository : RepositoryBase<long, RollCall>, IRoll
IsActive = x.IsActive,
Id = x.id
}).ToList();
return result;
}
private List<FineViewModel> FinesForCheckout(long employeeId, long workshopId, DateTime contractStart,

View File

@@ -160,7 +160,9 @@ public class WorkshopRepository : RepositoryBase<long, Company.Domain.WorkshopAg
public EditWorkshop GetDetails(long id)
{
var emp = _context.WorkshopEmployers.Where(x => x.WorkshopId == id)
.Select(x => x.EmployerId).ToList();
.Select(x => x.Employer).ToList();
var contractingPart = emp.Select(x => x.ContractingPartyId).ToList();
bool rewardCompute = contractingPart.Any(x=>x == 30804);
return _context.Workshops.Select(x => new EditWorkshop
{
Id = x.id,
@@ -193,7 +195,7 @@ public class WorkshopRepository : RepositoryBase<long, Company.Domain.WorkshopAg
BonusesOptions = string.IsNullOrWhiteSpace(x.BonusesOptions) ? "EndOfContract1402leftWork1403" : x.BonusesOptions,
YearsOptions = x.YearsOptions,
IsOldContract = x.IsOldContract,
EmployerIdList = emp,
EmployerIdList = emp.Select(e=>e.id).ToList(),
HasRollCallFreeVip = x.HasRollCallFreeVip,
WorkshopHolidayWorking = x.WorkshopHolidayWorking,
InsuranceCheckoutOvertime = x.InsuranceCheckoutOvertime,
@@ -205,6 +207,7 @@ public class WorkshopRepository : RepositoryBase<long, Company.Domain.WorkshopAg
SignCheckout = x.SignCheckout,
RotatingShiftCompute = x.RotatingShiftCompute,
IsStaticCheckout = x.IsStaticCheckout,
RewardComputeOnCheckout = rewardCompute
}).FirstOrDefault(x => x.Id == id);
}

View File

@@ -794,7 +794,8 @@ public class IndexModel : PageModel
watch.Stop();
#endregion
var firstContract = _contractApplication.GetDetails(ContractsId[0]);
var workshop = _workshopApplication.GetDetails(firstContract.WorkshopIds);
//int i = 0;
foreach (var item in ContractsId)
@@ -809,7 +810,7 @@ public class IndexModel : PageModel
if (separation.checker)
{
//workshopInfo
var workshop = _workshopApplication.GetDetails(contract.WorkshopIds);
var employeeOptions =
_employeeComputeOptionsApplication.GetAllByWorkshopId(contract.WorkshopIds);
@@ -1212,7 +1213,7 @@ public class IndexModel : PageModel
#endregion
RewardPayCompute = workshop.RewardComputeOnCheckout,
};
_checkoutApplication.Create(command);

View File

@@ -4,6 +4,7 @@
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<NuGetAudit>false</NuGetAudit>
</PropertyGroup>
<ItemGroup>