feat: refine payment calculation logic in TemporaryClientRegistrationApplication

This commit is contained in:
MahanCh
2025-09-02 14:19:23 +03:30
parent 3e4c57d813
commit 87609773e5

View File

@@ -535,14 +535,13 @@ public class TemporaryClientRegistrationApplication : ITemporaryClientRegistrati
var result = new ReviewAndPaymentViewModel();
int months = 0;
months = (int)duration;
var months = (int)duration;
//رند کردن مبالغ کارگاه ها
var roundAmount = (((Convert.ToInt64(totalPayment1MonthDouble))) / 1000000) * 1000000;
double roundAmount2 = roundAmount;
//بدست آوردن جمع کل مبالغ کارگاه بر اساس مدت قراداد
var sumOfWorkshopsPaymentDouble = months * roundAmount2;
result.SumOfWorkshopsPayment = sumOfWorkshopsPaymentDouble.ToMoney();
result.SumOfWorkshopsPayment = roundAmount2.ToMoney();
var installmentstart = (DateTime.Now).ToFarsi();
var originalDay = int.Parse(installmentstart.Substring(8, 2));
@@ -660,9 +659,10 @@ public class TemporaryClientRegistrationApplication : ITemporaryClientRegistrati
_ => throw new ArgumentOutOfRangeException(nameof(duration), duration, null)
};
var discountAmount = (sumOfWorkshopsPaymentDouble * discount) / 100;
var discountedPayment = sumOfWorkshopsPaymentDouble - discountAmount;
result.Discount = discountAmount.ToMoney();
var oneMonthDiscountAmount = (roundAmount * discount) / 100;
var totalDiscount = oneMonthDiscountAmount * months;
var discountedPayment = sumOfWorkshopsPaymentDouble - totalDiscount;
result.Discount = ((double)oneMonthDiscountAmount).ToMoney();
var taxDouble = (discountedPayment * 10)/100;
result.ValueAddedTaxStr =taxDouble.ToMoney();
result.OneTimeWithoutTaxPaymentStr = discountedPayment.ToMoney();