Add New Searches for Get list in InstitutionContract
This commit is contained in:
@@ -0,0 +1,86 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace CompanyManagment.App.Contracts.InstitutionContract;
|
||||
|
||||
public class GetInstitutionContractListItemsViewModel
|
||||
{
|
||||
/// <summary>
|
||||
/// آیدی
|
||||
/// </summary>
|
||||
public long Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// دارای امضا
|
||||
/// </summary>
|
||||
public bool HasSigniture { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// شماره قرارداد
|
||||
/// </summary>
|
||||
public string ContractNo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// نام معرف
|
||||
/// </summary>
|
||||
public string RepresentativeName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// نام طرف حساب
|
||||
/// </summary>
|
||||
public string ContractingPartyName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// شماره کارفرما
|
||||
/// </summary>
|
||||
public string ArchiveNo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// نام کارفرماها
|
||||
/// </summary>
|
||||
public List<string> EmployerNames { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// تعداد کارگاه
|
||||
/// </summary>
|
||||
public int WorkshopsCount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// نام کارگاه ها
|
||||
/// </summary>
|
||||
public List<string> WorkshopNames { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// تعداد پرسنل
|
||||
/// </summary>
|
||||
public int EmployeesCount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// شروع قرارداد
|
||||
/// </summary>
|
||||
public string ContractStartFa { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// پایان قرارداد
|
||||
/// </summary>
|
||||
public string ContractEndFa { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// مبلغ قرارداد
|
||||
/// </summary>
|
||||
public double ContractAmount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// وضعیت مالی
|
||||
/// </summary>
|
||||
public double Balance { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// وضعیت قرارداد
|
||||
/// </summary>
|
||||
public InstitutionContractStatus Status { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// آیا منقضی شده است
|
||||
/// </summary>
|
||||
public bool IsExpired { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace CompanyManagment.App.Contracts.InstitutionContract;
|
||||
|
||||
/// <summary>
|
||||
/// لیست قرارداد های موسسه
|
||||
/// </summary>
|
||||
public class GetInstitutionContractListViewModel
|
||||
{
|
||||
/// <summary>
|
||||
/// بدهی کل
|
||||
/// </summary>
|
||||
public double TotalDebt { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// مبلغ قرارداد ها
|
||||
/// </summary>
|
||||
public double TotalAmount { get; set; }
|
||||
|
||||
public List<GetInstitutionContractListItemsViewModel> Items { get; set; }
|
||||
|
||||
}
|
||||
@@ -89,16 +89,6 @@ public class InstitutionContractListSearchModel
|
||||
/// </summary>
|
||||
public string EmployerOrWorkshopOrContractingPartyOrRepresentativeName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// تعداد نفرات از
|
||||
/// </summary>
|
||||
public int EmployeeCountFrom { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// تعداد نفرات تا
|
||||
/// </summary>
|
||||
public int EmployeeCountTo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// استان
|
||||
/// </summary>
|
||||
@@ -129,8 +119,31 @@ public class InstitutionContractListSearchModel
|
||||
/// </summary>
|
||||
public string ContractDateTo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// تب
|
||||
/// </summary>
|
||||
public InstitutionContractStatus? Status { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// فعال / غیرفعال
|
||||
/// </summary>
|
||||
public bool? IsActive { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// موجود / ناموجود
|
||||
/// </summary>
|
||||
public bool? HasSignature { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// نوع = روابط کار / مالیات و حسابداری
|
||||
/// </summary>
|
||||
public InstitutionContractType? Type { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// رسمی / غیررسمی
|
||||
/// </summary>
|
||||
public bool? IsOfficial { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// ایندکس صفحه
|
||||
/// </summary>
|
||||
@@ -140,117 +153,4 @@ public class InstitutionContractListSearchModel
|
||||
/// تعداد داخل صفحه
|
||||
/// </summary>
|
||||
public int PageSize { get; set; } = 30;
|
||||
}
|
||||
|
||||
public enum InstitutionContractStatus
|
||||
{
|
||||
Active,
|
||||
Deactive,
|
||||
DeactiveWithDebt,
|
||||
Block,
|
||||
Free,
|
||||
PendingForRenewal,
|
||||
WithoutWorkshop,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// لیست قرارداد های موسسه
|
||||
/// </summary>
|
||||
public class GetInstitutionContractListViewModel
|
||||
{
|
||||
/// <summary>
|
||||
/// بدهی کل
|
||||
/// </summary>
|
||||
public double TotalDebt { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// مبلغ قرارداد ها
|
||||
/// </summary>
|
||||
public double TotalAmount { get; set; }
|
||||
|
||||
public List<GetInstitutionContractListItemsViewModel> Items { get; set; }
|
||||
|
||||
}
|
||||
|
||||
public class GetInstitutionContractListItemsViewModel
|
||||
{
|
||||
/// <summary>
|
||||
/// آیدی
|
||||
/// </summary>
|
||||
public long Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// دارای امضا
|
||||
/// </summary>
|
||||
public bool HasSigniture { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// شماره قرارداد
|
||||
/// </summary>
|
||||
public string ContractNo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// نام معرف
|
||||
/// </summary>
|
||||
public string RepresentativeName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// نام طرف حساب
|
||||
/// </summary>
|
||||
public string ContractingPartyName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// شماره کارفرما
|
||||
/// </summary>
|
||||
public string ArchiveNo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// نام کارفرماها
|
||||
/// </summary>
|
||||
public List<string> EmployerNames { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// تعداد کارگاه
|
||||
/// </summary>
|
||||
public int WorkshopsCount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// نام کارگاه ها
|
||||
/// </summary>
|
||||
public List<string> WorkshopNames { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// تعداد پرسنل
|
||||
/// </summary>
|
||||
public int EmployeesCount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// شروع قرارداد
|
||||
/// </summary>
|
||||
public string ContractStartFa { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// پایان قرارداد
|
||||
/// </summary>
|
||||
public string ContractEndFa { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// مبلغ قرارداد
|
||||
/// </summary>
|
||||
public double ContractAmount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// وضعیت مالی
|
||||
/// </summary>
|
||||
public double Balance { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// وضعیت قرارداد
|
||||
/// </summary>
|
||||
public InstitutionContractStatus Status { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// آیا منقضی شده است
|
||||
/// </summary>
|
||||
public bool IsExpired { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
namespace CompanyManagment.App.Contracts.InstitutionContract;
|
||||
|
||||
public enum InstitutionContractStatus
|
||||
{
|
||||
Active,
|
||||
Deactive,
|
||||
DeactiveWithDebt,
|
||||
Block,
|
||||
Free,
|
||||
PendingForRenewal,
|
||||
WithoutWorkshop,
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
namespace CompanyManagment.App.Contracts.InstitutionContract;
|
||||
|
||||
public enum InstitutionContractType
|
||||
{
|
||||
/// <summary>
|
||||
/// روابط کار
|
||||
/// </summary>
|
||||
JobRelation,
|
||||
/// <summary>
|
||||
/// حسابداری و مالیات
|
||||
/// </summary>
|
||||
TaxAndFinancial
|
||||
}
|
||||
@@ -271,7 +271,7 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
|
||||
if (searchModel.TypeOfContract == "both")
|
||||
{
|
||||
query = query.Where(x => x.TypeOfContract == "JobRelation" || x.TypeOfContract == "taxAndFinancial");
|
||||
query = query.Where(x => x.TypeOfContract == "JobRelation" || x.TypeOfContract == "JobRelation");
|
||||
}
|
||||
else if (searchModel.TypeOfContract == "JobRelation" || string.IsNullOrWhiteSpace(searchModel.TypeOfContract))
|
||||
{
|
||||
@@ -1075,11 +1075,39 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
x.contract.ContractStartGr <= dateTo && x.contract.ContractEndGr <= dateFrom);
|
||||
}
|
||||
|
||||
if (searchModel.HasSignature != null)
|
||||
{
|
||||
var hasSignature = searchModel.HasSignature == true ? "1" : "0";
|
||||
joinedQuery = joinedQuery.Where(x => x.contract.Signature == hasSignature);
|
||||
}
|
||||
|
||||
if (searchModel.IsActive != null)
|
||||
{
|
||||
var isActiveStr = searchModel.IsActive == true ? "true" : "false";
|
||||
joinedQuery = joinedQuery.Where(x => x.contract.IsActiveString == isActiveStr);
|
||||
}
|
||||
|
||||
if (searchModel.Type != null)
|
||||
{
|
||||
var typeStr = searchModel.Type switch
|
||||
{
|
||||
InstitutionContractType.JobRelation => "JobRelation",
|
||||
InstitutionContractType.TaxAndFinancial => "taxAndFinancial",
|
||||
_ => throw new ArgumentOutOfRangeException()
|
||||
};
|
||||
joinedQuery = joinedQuery.Where(x=>x.contract.TypeOfContract == typeStr);
|
||||
}
|
||||
|
||||
if (searchModel.IsOfficial != null)
|
||||
{
|
||||
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();
|
||||
//Todo: Search by Status For Tab
|
||||
if (searchModel.Status != null)
|
||||
{
|
||||
switch (searchModel.Status)
|
||||
@@ -1104,7 +1132,8 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
case InstitutionContractStatus.Active:
|
||||
joinedQuery = joinedQuery.Where(x =>
|
||||
x.contract.IsActiveString != "blue" && // Not DeactiveWithDebt
|
||||
!(x.contract.ContractEndGr >= now && x.contract.ContractEndGr <= endThisMontGr) && // Not PendingForRenewal
|
||||
!(x.contract.ContractEndGr >= now &&
|
||||
x.contract.ContractEndGr <= endThisMontGr) && // Not PendingForRenewal
|
||||
x.contractingParty.IsBlock != "true" && // Not Block
|
||||
x.contract.ContractAmount != 0 && // Not Free
|
||||
x.contractingParty.Employers
|
||||
@@ -1114,6 +1143,10 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
joinedQuery = joinedQuery.Where(x => x.contract.IsActiveString != "blue");
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -1145,7 +1178,7 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
var minArchiveCode = arc.Count > 0 ? arc.Min(a => a) : 0;
|
||||
|
||||
var archiveCode = minArchiveCode == 10000000 ? 0 : minArchiveCode;
|
||||
var status = SetContractStatus(x.contract,x.contractingParty,x.statement);
|
||||
var status = SetContractStatus(x.contract, x.contractingParty, x.statement);
|
||||
return new GetInstitutionContractListItemsViewModel()
|
||||
{
|
||||
ContractAmount = x.contract.ContractAmount,
|
||||
@@ -1197,7 +1230,8 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
if (contract.ContractAmount == 0)
|
||||
{
|
||||
status = InstitutionContractStatus.Free;
|
||||
if ((contract.ContractEndGr >= now && contract.ContractEndGr <= endThisMontGr) || (contract.ContractEndGr < now))
|
||||
if ((contract.ContractEndGr >= now && contract.ContractEndGr <= endThisMontGr) ||
|
||||
(contract.ContractEndGr < now))
|
||||
{
|
||||
isExpier = true;
|
||||
}
|
||||
@@ -1208,6 +1242,7 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
status = InstitutionContractStatus.DeactiveWithDebt;
|
||||
isExpier = true;
|
||||
}
|
||||
|
||||
var workshops = contractingParty.Employers
|
||||
.SelectMany(e => e.WorkshopEmployers.Select(we => we.Workshop)).DistinctBy(w => w.id).ToList();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user