diff --git a/CompanyManagment.App.Contracts/InstitutionContract/GetInstitutionContractListItemsViewModel.cs b/CompanyManagment.App.Contracts/InstitutionContract/GetInstitutionContractListItemsViewModel.cs
new file mode 100644
index 00000000..be7e0f5f
--- /dev/null
+++ b/CompanyManagment.App.Contracts/InstitutionContract/GetInstitutionContractListItemsViewModel.cs
@@ -0,0 +1,86 @@
+using System.Collections.Generic;
+
+namespace CompanyManagment.App.Contracts.InstitutionContract;
+
+public class GetInstitutionContractListItemsViewModel
+{
+ ///
+ /// آیدی
+ ///
+ public long Id { get; set; }
+
+ ///
+ /// دارای امضا
+ ///
+ public bool HasSigniture { get; set; }
+
+ ///
+ /// شماره قرارداد
+ ///
+ public string ContractNo { get; set; }
+
+ ///
+ /// نام معرف
+ ///
+ public string RepresentativeName { get; set; }
+
+ ///
+ /// نام طرف حساب
+ ///
+ public string ContractingPartyName { get; set; }
+
+ ///
+ /// شماره کارفرما
+ ///
+ public string ArchiveNo { get; set; }
+
+ ///
+ /// نام کارفرماها
+ ///
+ public List EmployerNames { get; set; }
+
+ ///
+ /// تعداد کارگاه
+ ///
+ public int WorkshopsCount { get; set; }
+
+ ///
+ /// نام کارگاه ها
+ ///
+ public List WorkshopNames { get; set; }
+
+ ///
+ /// تعداد پرسنل
+ ///
+ public int EmployeesCount { get; set; }
+
+ ///
+ /// شروع قرارداد
+ ///
+ public string ContractStartFa { get; set; }
+
+ ///
+ /// پایان قرارداد
+ ///
+ public string ContractEndFa { get; set; }
+
+ ///
+ /// مبلغ قرارداد
+ ///
+ public double ContractAmount { get; set; }
+
+ ///
+ /// وضعیت مالی
+ ///
+ public double Balance { get; set; }
+
+ ///
+ /// وضعیت قرارداد
+ ///
+ public InstitutionContractStatus Status { get; set; }
+
+ ///
+ /// آیا منقضی شده است
+ ///
+ public bool IsExpired { get; set; }
+}
\ No newline at end of file
diff --git a/CompanyManagment.App.Contracts/InstitutionContract/GetInstitutionContractListViewModel.cs b/CompanyManagment.App.Contracts/InstitutionContract/GetInstitutionContractListViewModel.cs
new file mode 100644
index 00000000..2210e2a7
--- /dev/null
+++ b/CompanyManagment.App.Contracts/InstitutionContract/GetInstitutionContractListViewModel.cs
@@ -0,0 +1,22 @@
+using System.Collections.Generic;
+
+namespace CompanyManagment.App.Contracts.InstitutionContract;
+
+///
+/// لیست قرارداد های موسسه
+///
+public class GetInstitutionContractListViewModel
+{
+ ///
+ /// بدهی کل
+ ///
+ public double TotalDebt { get; set; }
+
+ ///
+ /// مبلغ قرارداد ها
+ ///
+ public double TotalAmount { get; set; }
+
+ public List Items { get; set; }
+
+}
\ No newline at end of file
diff --git a/CompanyManagment.App.Contracts/InstitutionContract/IInstitutionContractApplication.cs b/CompanyManagment.App.Contracts/InstitutionContract/IInstitutionContractApplication.cs
index 0909064d..843aefa1 100644
--- a/CompanyManagment.App.Contracts/InstitutionContract/IInstitutionContractApplication.cs
+++ b/CompanyManagment.App.Contracts/InstitutionContract/IInstitutionContractApplication.cs
@@ -89,16 +89,6 @@ public class InstitutionContractListSearchModel
///
public string EmployerOrWorkshopOrContractingPartyOrRepresentativeName { get; set; }
- ///
- /// تعداد نفرات از
- ///
- public int EmployeeCountFrom { get; set; }
-
- ///
- /// تعداد نفرات تا
- ///
- public int EmployeeCountTo { get; set; }
-
///
/// استان
///
@@ -129,8 +119,31 @@ public class InstitutionContractListSearchModel
///
public string ContractDateTo { get; set; }
+ ///
+ /// تب
+ ///
public InstitutionContractStatus? Status { get; set; }
+ ///
+ /// فعال / غیرفعال
+ ///
+ public bool? IsActive { get; set; }
+
+ ///
+ /// موجود / ناموجود
+ ///
+ public bool? HasSignature { get; set; }
+
+ ///
+ /// نوع = روابط کار / مالیات و حسابداری
+ ///
+ public InstitutionContractType? Type { get; set; }
+
+ ///
+ /// رسمی / غیررسمی
+ ///
+ public bool? IsOfficial { get; set; }
+
///
/// ایندکس صفحه
///
@@ -140,117 +153,4 @@ public class InstitutionContractListSearchModel
/// تعداد داخل صفحه
///
public int PageSize { get; set; } = 30;
-}
-
-public enum InstitutionContractStatus
-{
- Active,
- Deactive,
- DeactiveWithDebt,
- Block,
- Free,
- PendingForRenewal,
- WithoutWorkshop,
-}
-
-///
-/// لیست قرارداد های موسسه
-///
-public class GetInstitutionContractListViewModel
-{
- ///
- /// بدهی کل
- ///
- public double TotalDebt { get; set; }
-
- ///
- /// مبلغ قرارداد ها
- ///
- public double TotalAmount { get; set; }
-
- public List Items { get; set; }
-
-}
-
-public class GetInstitutionContractListItemsViewModel
-{
- ///
- /// آیدی
- ///
- public long Id { get; set; }
-
- ///
- /// دارای امضا
- ///
- public bool HasSigniture { get; set; }
-
- ///
- /// شماره قرارداد
- ///
- public string ContractNo { get; set; }
-
- ///
- /// نام معرف
- ///
- public string RepresentativeName { get; set; }
-
- ///
- /// نام طرف حساب
- ///
- public string ContractingPartyName { get; set; }
-
- ///
- /// شماره کارفرما
- ///
- public string ArchiveNo { get; set; }
-
- ///
- /// نام کارفرماها
- ///
- public List EmployerNames { get; set; }
-
- ///
- /// تعداد کارگاه
- ///
- public int WorkshopsCount { get; set; }
-
- ///
- /// نام کارگاه ها
- ///
- public List WorkshopNames { get; set; }
-
- ///
- /// تعداد پرسنل
- ///
- public int EmployeesCount { get; set; }
-
- ///
- /// شروع قرارداد
- ///
- public string ContractStartFa { get; set; }
-
- ///
- /// پایان قرارداد
- ///
- public string ContractEndFa { get; set; }
-
- ///
- /// مبلغ قرارداد
- ///
- public double ContractAmount { get; set; }
-
- ///
- /// وضعیت مالی
- ///
- public double Balance { get; set; }
-
- ///
- /// وضعیت قرارداد
- ///
- public InstitutionContractStatus Status { get; set; }
-
- ///
- /// آیا منقضی شده است
- ///
- public bool IsExpired { get; set; }
}
\ No newline at end of file
diff --git a/CompanyManagment.App.Contracts/InstitutionContract/InstitutionContractStatus.cs b/CompanyManagment.App.Contracts/InstitutionContract/InstitutionContractStatus.cs
new file mode 100644
index 00000000..103f4dd3
--- /dev/null
+++ b/CompanyManagment.App.Contracts/InstitutionContract/InstitutionContractStatus.cs
@@ -0,0 +1,12 @@
+namespace CompanyManagment.App.Contracts.InstitutionContract;
+
+public enum InstitutionContractStatus
+{
+ Active,
+ Deactive,
+ DeactiveWithDebt,
+ Block,
+ Free,
+ PendingForRenewal,
+ WithoutWorkshop,
+}
\ No newline at end of file
diff --git a/CompanyManagment.App.Contracts/InstitutionContract/InstitutionContractType.cs b/CompanyManagment.App.Contracts/InstitutionContract/InstitutionContractType.cs
new file mode 100644
index 00000000..af958236
--- /dev/null
+++ b/CompanyManagment.App.Contracts/InstitutionContract/InstitutionContractType.cs
@@ -0,0 +1,13 @@
+namespace CompanyManagment.App.Contracts.InstitutionContract;
+
+public enum InstitutionContractType
+{
+ ///
+ /// روابط کار
+ ///
+ JobRelation,
+ ///
+ /// حسابداری و مالیات
+ ///
+ TaxAndFinancial
+}
\ No newline at end of file
diff --git a/CompanyManagment.EFCore/Repository/InstitutionContractRepository.cs b/CompanyManagment.EFCore/Repository/InstitutionContractRepository.cs
index 48b1f4e9..956998ae 100644
--- a/CompanyManagment.EFCore/Repository/InstitutionContractRepository.cs
+++ b/CompanyManagment.EFCore/Repository/InstitutionContractRepository.cs
@@ -271,7 +271,7 @@ public class InstitutionContractRepository : RepositoryBase 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 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
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 x.contract.IsActiveString != "blue");
+ }
#endregion
@@ -1145,7 +1178,7 @@ public class InstitutionContractRepository : RepositoryBase 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= 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 e.WorkshopEmployers.Select(we => we.Workshop)).DistinctBy(w => w.id).ToList();