feat: add ContractAmountWithTax calculation and update related references
This commit is contained in:
@@ -98,6 +98,9 @@ public class InstitutionContract : EntityBase
|
||||
// مبلغ قرارداد
|
||||
public double ContractAmount { get; private set; }
|
||||
|
||||
public double ContractAmountWithTax => !IsOldContract && IsInstallment ? ContractAmount + (ContractAmount * 0.10)
|
||||
: ContractAmount;
|
||||
|
||||
//خسارت روزانه
|
||||
public double DailyCompenseation { get; private set; }
|
||||
|
||||
@@ -159,6 +162,8 @@ public class InstitutionContract : EntityBase
|
||||
|
||||
public List<InstitutionContractAmendment> Amendments { get; private set; }
|
||||
|
||||
public bool IsOldContract => LawId!= 0;
|
||||
|
||||
public InstitutionContract()
|
||||
{
|
||||
ContactInfoList = [];
|
||||
|
||||
@@ -45,5 +45,8 @@ public class InstitutionContractMapping : IEntityTypeConfiguration<InstitutionCo
|
||||
|
||||
builder.HasMany(x => x.Amendments).WithOne(x => x.InstitutionContract)
|
||||
.HasForeignKey(x => x.InstitutionContractId);
|
||||
|
||||
|
||||
builder.Ignore(x => x.ContractAmountWithTax);
|
||||
}
|
||||
}
|
||||
@@ -1375,7 +1375,7 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
.Count(l => l.StartWorkDate <= DateTime.Now && l.LeftWorkDate >= DateTime.Now);
|
||||
return new GetInstitutionContractListItemsViewModel()
|
||||
{
|
||||
ContractAmount = x.contract.ContractAmount,
|
||||
ContractAmount = x.contract.ContractAmountWithTax,
|
||||
Balance = statement?.FinancialTransactionList.Sum(ft => ft.Deptor - ft.Creditor) ?? 0,
|
||||
WorkshopsCount = workshops.Count(),
|
||||
ContractStartFa = x.contract.ContractStartGr.ToFarsi(),
|
||||
@@ -1395,9 +1395,7 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
Workshops = workshopDetails,
|
||||
IsInPersonContract = x.contract.WorkshopGroup?.CurrentWorkshops
|
||||
.Any(y => y.Services.ContractInPerson) ?? true,
|
||||
IsOldContract = x.contract.WorkshopGroup?.CurrentWorkshops == null
|
||||
|| x.contract.WorkshopGroup.CurrentWorkshops.Count == 0
|
||||
|| x.contract.WorkshopGroup.CurrentWorkshops.Any(y => y.Price == 0)
|
||||
IsOldContract = x.contract.IsOldContract
|
||||
};
|
||||
}).ToList()
|
||||
};
|
||||
@@ -3216,7 +3214,7 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
PaymentPrice = institution.TotalAmount.ToMoney(),
|
||||
TotalPrice = (institution.TotalAmount - institution.ValueAddedTax).ToMoney(),
|
||||
TaxPrice = institution.ValueAddedTax.ToMoney(),
|
||||
OneMonthPrice = institution.ContractAmount.ToMoney(),
|
||||
OneMonthPrice = institution.ContractAmountWithTax.ToMoney(),
|
||||
VerifierFullName = institution.VerifierFullName,
|
||||
VerifierPhoneNumber = institution.VerifierPhoneNumber,
|
||||
VerifyCode = institution.VerifyCode,
|
||||
|
||||
@@ -24,12 +24,6 @@ public class ParameterBindingConvention : IApplicationModelConvention
|
||||
if (HasExplicitBindingSourceAttribute(parameter))
|
||||
continue;
|
||||
|
||||
#if DEBUG
|
||||
if (action.ActionName == "GetVerificationDetails")
|
||||
{
|
||||
|
||||
}
|
||||
#endif
|
||||
// اگر پارامتر از route میآید، skip کن
|
||||
if (IsRouteParameter(action, parameter))
|
||||
continue;
|
||||
@@ -76,8 +70,7 @@ public class ParameterBindingConvention : IApplicationModelConvention
|
||||
{
|
||||
if (selector.AttributeRouteModel?.Template != null)
|
||||
{
|
||||
if (selector.AttributeRouteModel.Template.Contains($"{{{parameterName}}}", StringComparison.OrdinalIgnoreCase) ||
|
||||
selector.AttributeRouteModel.Template.Contains($"{{{parameterName}:", StringComparison.OrdinalIgnoreCase))
|
||||
if (selector.AttributeRouteModel.Template.Contains($"{{{parameterName}}}", StringComparison.OrdinalIgnoreCase))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -87,8 +80,7 @@ public class ParameterBindingConvention : IApplicationModelConvention
|
||||
{
|
||||
if (selector.AttributeRouteModel?.Template != null)
|
||||
{
|
||||
if (selector.AttributeRouteModel.Template.Contains($"{{{parameterName}}}", StringComparison.OrdinalIgnoreCase) ||
|
||||
selector.AttributeRouteModel.Template.Contains($"{{{parameterName}:", StringComparison.OrdinalIgnoreCase))
|
||||
if (selector.AttributeRouteModel.Template.Contains($"{{{parameterName}}}", StringComparison.OrdinalIgnoreCase))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user