background job changed
This commit is contained in:
@@ -4364,6 +4364,7 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
{
|
||||
var sendResult = await _smsService.SendInstitutionCreationVerificationLink(item.Number, item.FullName,
|
||||
item.InstitutionId, item.ContractingPartyId, item.InstitutionContractId, typeOfSms);
|
||||
Thread.Sleep(1000);
|
||||
}
|
||||
|
||||
Console.WriteLine("executed at : " + persianNow + " - " + hour + ":" + minute);
|
||||
@@ -4415,12 +4416,13 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
TypeOfContract = x.TypeOfContract,
|
||||
IsInstallment = x.IsInstallment,
|
||||
VerificationStatus = x.VerificationStatus,
|
||||
SigningType = x.SigningType,
|
||||
InstallmentList = x.Installments
|
||||
.Select(ins => new InstitutionContractInstallmentViewModel
|
||||
{ AmountDouble = ins.Amount, InstallmentDateGr = ins.InstallmentDateGr })
|
||||
.OrderBy(ins => ins.InstallmentDateGr).Skip(1).ToList(),
|
||||
}).Where(x =>
|
||||
x.ContractStartGr < endOfMonthGr && x.ContractEndGr >= endOfMonthGr && x.ContractAmountDouble > 0)
|
||||
x.ContractStartGr < endOfMonthGr && x.ContractEndGr >= endOfMonthGr && x.ContractAmountDouble > 0 && x.VerificationStatus != InstitutionContractVerificationStatus.PendingForVerify)
|
||||
.ToListAsync();
|
||||
|
||||
#endregion
|
||||
@@ -4438,13 +4440,13 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
|
||||
|
||||
#region GetDectivedContractOnCurrentMonth
|
||||
|
||||
|
||||
if (futureContracts.Any())
|
||||
{
|
||||
List<long> futureContractIds = futureContracts.Select(x => x.ContractingPartyId).ToList();
|
||||
List<InstitutionContractViewModel> deatcivedContract = await _context.InstitutionContractSet
|
||||
.Where(x => x.IsActiveString == "false" && futureContractIds.Contains(x.ContractingPartyId) &&
|
||||
x.ContractEndGr.Date == endOfCurrentMonth.Date && x.ContractAmount > 0)
|
||||
x.ContractEndGr.Date == endOfCurrentMonth.Date && x.ContractAmount > 0 && x.VerificationStatus != InstitutionContractVerificationStatus.PendingForVerify)
|
||||
.Select(x => new InstitutionContractViewModel
|
||||
{
|
||||
Id = x.id,
|
||||
@@ -4459,6 +4461,7 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
TypeOfContract = x.TypeOfContract,
|
||||
IsInstallment = x.IsInstallment,
|
||||
VerificationStatus = x.VerificationStatus,
|
||||
SigningType = x.SigningType,
|
||||
InstallmentList = x.Installments
|
||||
.Select(ins => new InstitutionContractInstallmentViewModel
|
||||
{ AmountDouble = ins.Amount, InstallmentDateGr = ins.InstallmentDateGr })
|
||||
@@ -4469,6 +4472,12 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
institutionContracts.AddRange(deatcivedContract);
|
||||
}
|
||||
|
||||
// قرارداد هایی که پطور یکجا پرداخت شده اند
|
||||
var paidInFull = institutionContracts.Where(x =>
|
||||
x.SigningType != InstitutionContractSigningType.Legacy && x.IsInstallment == false && x.SigningType != null).ToList();
|
||||
|
||||
//حذف قراداد هایی که یکجا پرداخت شده اند از لیست ایجاد سند ماهانه
|
||||
institutionContracts = institutionContracts.Except(paidInFull).ToList();
|
||||
|
||||
#region RollCallServicCompute
|
||||
|
||||
@@ -4516,8 +4525,7 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
|
||||
if (!alreadyCreated)
|
||||
{
|
||||
if (item.IsInstallment &&
|
||||
item.VerificationStatus == InstitutionContractVerificationStatus.Verified)
|
||||
if (item.IsInstallment)
|
||||
{
|
||||
var instalment = item.InstallmentList
|
||||
.FirstOrDefault(x =>
|
||||
@@ -4551,8 +4559,7 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
await _financialStatmentRepository.SaveChangesAsync();
|
||||
|
||||
|
||||
if (item.IsInstallment &&
|
||||
item.VerificationStatus == InstitutionContractVerificationStatus.Verified)
|
||||
if (item.IsInstallment)
|
||||
{
|
||||
var instalment = item.InstallmentList
|
||||
.FirstOrDefault(x =>
|
||||
@@ -4579,12 +4586,17 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
|
||||
|
||||
#region RollCallServicCompute
|
||||
|
||||
if (item.VerificationStatus != InstitutionContractVerificationStatus.Verified &&
|
||||
!item.IsInstallment && item.ContractingPartyId != 30520 && item.ContractingPartyId != 30739)
|
||||
//ایجاد سند مالی حضورغیاب
|
||||
//قرارداد هایی که جدید نیستند و اقساط ندارند
|
||||
//کارگاه های استثناء : کباب مهدی 30520 و نمونه پروتئین 30739
|
||||
if (item.SigningType != InstitutionContractSigningType.OtpBased && item.SigningType != InstitutionContractSigningType.Physical
|
||||
&& !item.IsInstallment && item.ContractingPartyId != 30520 && item.ContractingPartyId != 30739)
|
||||
{
|
||||
try
|
||||
{
|
||||
//TODO
|
||||
//@refactor Need
|
||||
|
||||
var employers = await _context.Employers
|
||||
.Where(x => x.ContractingPartyId == item.ContractingPartyId)
|
||||
.Select(x => x.id).ToListAsync();
|
||||
|
||||
Reference in New Issue
Block a user