set installment persian numbers
This commit is contained in:
@@ -327,12 +327,12 @@ public class InstitutionContractInstallmentViewModel
|
||||
/// <summary>
|
||||
/// مبلغ قسط
|
||||
/// </summary>
|
||||
public double Amount { get; set; }
|
||||
public string Amount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// توضیحات قسط
|
||||
/// عدد قسط فارسی
|
||||
/// </summary>
|
||||
public string Description { get; set; }
|
||||
public string InstallmentIndex { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// شناسه قرارداد مؤسسه مربوط به این قسط
|
||||
|
||||
@@ -1693,6 +1693,8 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
{
|
||||
throw new NotFoundException("قرارداد مؤسسه یافت نشد");
|
||||
}
|
||||
int installmentNumber = 1;
|
||||
|
||||
|
||||
var res = new GetInstitutionVerificationDetailsViewModel()
|
||||
{
|
||||
@@ -1703,15 +1705,21 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
TaxPrice = query.contract.ValueAddedTax.ToMoney(),
|
||||
TotalPrice = (query.contract.TotalAmount - query.contract.ValueAddedTax).ToMoney(),
|
||||
PaymentPrice = query.contract.TotalAmount.ToMoney(),
|
||||
Installments = query.contract.Installments.Select(x => new InstitutionContractInstallmentViewModel()
|
||||
{
|
||||
Amount = x.Amount,
|
||||
Description = x.Description,
|
||||
Id = x.Id,
|
||||
InstallmentDateFa = x.InstallmentDateFa,
|
||||
InstallmentDateGr = x.InstallmentDateGr,
|
||||
InstitutionContractId = x.InstitutionContractId
|
||||
}).ToList(),
|
||||
Installments = query.contract.Installments.OrderBy(x=>x.InstallmentDateGr)
|
||||
.Select(x =>
|
||||
{
|
||||
var res = new InstitutionContractInstallmentViewModel()
|
||||
{
|
||||
Amount = x.Description,
|
||||
InstallmentIndex = GetInstallmentPersianNumber(installmentNumber),
|
||||
Id = x.Id,
|
||||
InstallmentDateFa = x.InstallmentDateFa,
|
||||
InstallmentDateGr = x.InstallmentDateGr,
|
||||
InstitutionContractId = x.InstitutionContractId,
|
||||
};
|
||||
installmentNumber++;
|
||||
return res;
|
||||
}).ToList(),
|
||||
Workshops = query.contract.WorkshopGroup.WorkshopDetails
|
||||
.Where(x => x.DetailType == WorkshopDetailType.Initial)
|
||||
.Select(x => new GetInstitutionVerificationDetailsWorkshopsViewModel
|
||||
@@ -1757,7 +1765,23 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
private string GetInstallmentPersianNumber(int number)
|
||||
{
|
||||
return number switch
|
||||
{
|
||||
1 => "اول",
|
||||
2 => "دوم",
|
||||
3 => "سوم",
|
||||
4 => "چهارم",
|
||||
5 => "پنجم",
|
||||
6 => "ششم",
|
||||
7 => "هفتم",
|
||||
8 => "هشتم",
|
||||
9 => "نهم",
|
||||
10 => "دهم",
|
||||
_ => number.ToString()
|
||||
};
|
||||
}
|
||||
public async Task<InstitutionContract> GetByPublicIdAsync(Guid id)
|
||||
{
|
||||
return await _context.InstitutionContractSet.FirstOrDefaultAsync(x => x.PublicId == id);
|
||||
|
||||
Reference in New Issue
Block a user