add temporary client registration features and workshop service calculations
This commit is contained in:
@@ -4,4 +4,4 @@ namespace Company.Domain.TemporaryClientRegistrationAgg;
|
||||
|
||||
public interface IInstitutionContractContactInfoTempRepository : IRepository<long, InstitutionContractContactInfoTemp>
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -16,20 +16,8 @@ public class CreateWorkshopTemp
|
||||
/// ای دی طرف حساب
|
||||
/// </summary>
|
||||
public long ContractingPartyTempId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// جمع کل مبالغ سرویس ها برای کارگاه
|
||||
/// Double
|
||||
/// </summary>
|
||||
public double WorkshopServicesAmount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// جمع کل مبالغ سرویس ها برای کارگاه
|
||||
/// فارسی
|
||||
/// </summary>
|
||||
public string WorkshopServicesAmountStr { get; set; }
|
||||
|
||||
|
||||
|
||||
|
||||
#region ServiceSelection
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using _0_Framework.Application;
|
||||
using _0_Framework.Application.Enums;
|
||||
using CompanyManagment.App.Contracts.InstitutionPlan;
|
||||
|
||||
namespace CompanyManagment.App.Contracts.TemporaryClientRegistration;
|
||||
@@ -16,7 +17,7 @@ public interface ITemporaryClientRegistrationApplication
|
||||
/// <param name="mobile"></param>
|
||||
/// <returns></returns>
|
||||
Task<OperationResult<ContractingPartyTempViewModel>> CreateContractingPartyTemp(string nationalCode, string dateOfBirth, string mobile);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// تکمیل اطلاعات
|
||||
/// </summary>
|
||||
@@ -57,6 +58,21 @@ public interface ITemporaryClientRegistrationApplication
|
||||
/// <returns></returns>
|
||||
Task<ReviewAndPaymentViewModel> GetTotalPaymentAndWorkshopList(long contractingPartyTempId,
|
||||
string periodModel = "12", string paymentModel = "OneTime", string contractStartType = "currentMonth");
|
||||
|
||||
/// <summary>
|
||||
/// دریافت مبالغ بررسی و پرداخت با لیست کارگاه ها
|
||||
/// این متد برای زمانی است که کارگاه ها در مرحله ثبت نام موقت هستند
|
||||
/// و هنوز در دیتابیس ثبت نشده اند
|
||||
/// </summary>
|
||||
/// <param name="contractingPartyTempId"></param>
|
||||
/// <param name="workshopList"></param>
|
||||
/// <param name="periodModel"></param>
|
||||
/// <param name="paymentModel"></param>
|
||||
/// <param name="contractStartType"></param>
|
||||
/// <returns></returns>
|
||||
Task<ReviewAndPaymentViewModel> GetTotalPaymentAndWorkshopList(long contractingPartyTempId,
|
||||
List<WorkshopTempViewModel> workshopList,
|
||||
string periodModel = "12", string paymentModel = "OneTime", string contractStartType = "currentMonth");
|
||||
|
||||
/// <summary>
|
||||
/// ایجاد یا ویرایش قرارداد موقت
|
||||
@@ -100,4 +116,4 @@ public interface ITemporaryClientRegistrationApplication
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Task<List<RegistrationWorkflowMainList>> RegistrationWorkflowMainList();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,4 +3,16 @@
|
||||
public class WorkshopTempViewModel : CreateWorkshopTemp
|
||||
{
|
||||
public long Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// جمع کل مبالغ سرویس ها برای کارگاه
|
||||
/// Double
|
||||
/// </summary>
|
||||
public double WorkshopServicesAmount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// جمع کل مبالغ سرویس ها برای کارگاه
|
||||
/// فارسی
|
||||
/// </summary>
|
||||
public string WorkshopServicesAmountStr { get; set; }
|
||||
}
|
||||
@@ -523,6 +523,160 @@ public class TemporaryClientRegistrationApplication : ITemporaryClientRegistrati
|
||||
|
||||
}
|
||||
|
||||
public async Task<ReviewAndPaymentViewModel> GetTotalPaymentAndWorkshopList(long contractingPartyTempId, List<WorkshopTempViewModel> workshops, string periodModel = "12",
|
||||
string paymentModel = "OneTime", string contractStartType = "currentMonth")
|
||||
{
|
||||
//دریافت کارگاه ها
|
||||
|
||||
double totalPayment1MonthDouble = 0;
|
||||
|
||||
//بدست آوردن جمع کل برای یک ماه
|
||||
foreach (var workshop in workshops)
|
||||
{
|
||||
totalPayment1MonthDouble += workshop.WorkshopServicesAmount;
|
||||
}
|
||||
|
||||
if (totalPayment1MonthDouble == 0)
|
||||
return new ReviewAndPaymentViewModel();
|
||||
|
||||
var result = new ReviewAndPaymentViewModel();
|
||||
|
||||
int months = 0;
|
||||
months = periodModel switch
|
||||
{
|
||||
"1" => 1,
|
||||
"3" => 3,
|
||||
"6" => 6,
|
||||
"12" => 12,
|
||||
_ => 12,
|
||||
};
|
||||
//رند کردن مبالغ کارگاه ها
|
||||
var roundAmount = (((Convert.ToInt64(totalPayment1MonthDouble))) / 1000000) * 1000000;
|
||||
double roundAmount2 = roundAmount;
|
||||
//بدست آوردن جمع کل مبالغ کارگاه بر اساس مدت قراداد
|
||||
result.SumOfWorkshopsPaymentDouble = months * roundAmount2;
|
||||
result.SumOfWorkshopsPaymentPaymentStr = result.SumOfWorkshopsPaymentDouble.ToMoney();
|
||||
|
||||
|
||||
result.PeriodModel = periodModel;
|
||||
result.PaymentModel = paymentModel;
|
||||
|
||||
|
||||
var tenPercent = result.SumOfWorkshopsPaymentDouble * 10 / 100;
|
||||
//مالیات
|
||||
result.ValueAddedTaxDouble = tenPercent;
|
||||
result.ValueAddedTaxSt = tenPercent.ToMoney();
|
||||
//پرداخت یکجا
|
||||
#region OneTimePaymentResult
|
||||
|
||||
double discountOneTimePeyment = result.SumOfWorkshopsPaymentDouble - tenPercent;
|
||||
|
||||
|
||||
//مبلغ بدون مالیات و با تخفیف
|
||||
result.OneTimeWithoutTaxPaymentDouble = discountOneTimePeyment;
|
||||
result.OneTimeWithoutTaxPaymentStr = discountOneTimePeyment.ToMoney();
|
||||
|
||||
//مبلغ با مالیات
|
||||
result.OneTimeTotalPaymentDouble = discountOneTimePeyment + tenPercent;
|
||||
result.OneTimeTotalPaymentStr = result.OneTimeTotalPaymentDouble.ToMoney();
|
||||
|
||||
#endregion
|
||||
|
||||
//پرداخت ماهیانه
|
||||
#region MonthlyPaymentResult
|
||||
|
||||
//مبلغ بدون مالیات
|
||||
result.MonthlyWithoutTaxPaymentDouble = result.SumOfWorkshopsPaymentDouble;
|
||||
result.MonthlyWithoutTaxPaymentStr = result.SumOfWorkshopsPaymentDouble.ToMoney();
|
||||
|
||||
// مبلغ با مالیات
|
||||
result.MonthlyTotalPaymentDouble = result.SumOfWorkshopsPaymentDouble + tenPercent;
|
||||
result.MonthlyTotalPaymentStr = result.MonthlyTotalPaymentDouble.ToMoney();
|
||||
var installmentList = new List<MonthlyInstallment>();
|
||||
|
||||
var startDate = (DateTime.Now).ToFarsi();
|
||||
result.ContractStartCurrentMonthFa = $"{startDate.Substring(0, 8)}01";
|
||||
result.ContractStartCurrentMonthGr = result.ContractStartCurrentMonthFa.ToGeorgianDateTime();
|
||||
startDate = result.ContractStartCurrentMonthFa;
|
||||
|
||||
result.ContractStartNextMonthGr = ((startDate.FindeEndOfMonth()).ToGeorgianDateTime()).AddDays(1);
|
||||
result.ContractStartNextMonthFa = result.ContractStartNextMonthGr.ToFarsi();
|
||||
|
||||
if (contractStartType == "nextMonth")
|
||||
startDate = result.ContractStartNextMonthFa;
|
||||
|
||||
|
||||
|
||||
var findeEnd = Tools.FindEndOfContract(startDate, periodModel);
|
||||
var contractEndDate = findeEnd.endDateGr;
|
||||
result.ContractEndGr = contractEndDate;
|
||||
result.ContractEndFa = contractEndDate.ToFarsi();
|
||||
|
||||
if (periodModel == "1")
|
||||
{
|
||||
|
||||
installmentList.Add(new MonthlyInstallment()
|
||||
{
|
||||
InstallmentAmountStr = result.MonthlyTotalPaymentStr,
|
||||
InstallmentCounter = "سررسید پرداخت اول",
|
||||
InstalmentDate = (DateTime.Now).ToFarsi()
|
||||
|
||||
});
|
||||
result.MonthlyInstallments = installmentList;
|
||||
}
|
||||
else
|
||||
{
|
||||
int instalmentCount = Convert.ToInt32(periodModel);
|
||||
var instalmentAmount = result.MonthlyTotalPaymentDouble / instalmentCount;
|
||||
var findEndOfMonth = startDate.FindeEndOfMonth();
|
||||
for (int i = 1; i <= instalmentCount; i++)
|
||||
{
|
||||
if (i == 1)
|
||||
{
|
||||
startDate = (DateTime.Now).ToFarsi();
|
||||
|
||||
}
|
||||
else if (i > 1)
|
||||
{
|
||||
var currentMonthStart = ((findEndOfMonth.ToGeorgianDateTime()).AddDays(1)).ToFarsi();
|
||||
startDate = currentMonthStart.FindeEndOfMonth();
|
||||
findEndOfMonth = startDate;
|
||||
}
|
||||
|
||||
installmentList.Add(new MonthlyInstallment()
|
||||
{
|
||||
InstallmentAmountStr = instalmentAmount.ToMoney(),
|
||||
InstallmentCounter = i switch
|
||||
{
|
||||
1 => "سررسید پرداخت اول",
|
||||
2 => "سررسید پرداخت دوم",
|
||||
3 => "سررسید پرداخت سوم",
|
||||
4 => "سررسید پرداخت چهارم",
|
||||
5 => "سررسید پرداخت پنجم",
|
||||
6 => "سررسید پرداخت ششم",
|
||||
7 => "سررسید پرداخت هفتم",
|
||||
8 => "سررسید پرداخت هشتم",
|
||||
9 => "سررسید پرداخت نهم",
|
||||
10 => "سررسید پرداخت دهم",
|
||||
11 => "سررسید پرداخت یازدهم",
|
||||
12 => "سررسید پرداخت دوازدهم",
|
||||
_ => "سررسید پرداخت دوازدهم",
|
||||
},
|
||||
InstalmentDate = startDate
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
result.MonthlyInstallments = installmentList;
|
||||
result.ContractingPartTempId = contractingPartyTempId;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ایجاد یا ویرایش قرارداد موقت
|
||||
/// </summary>
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
using _0_Framework.Application;
|
||||
using _0_Framework.Application.Enums;
|
||||
using AccountManagement.Application.Contracts.Account;
|
||||
using CompanyManagement.Infrastructure.Excel.InstitutionContract;
|
||||
using CompanyManagment.App.Contracts.Employer;
|
||||
using CompanyManagment.App.Contracts.InstitutionContract;
|
||||
using CompanyManagment.App.Contracts.InstitutionContractContactinfo;
|
||||
using CompanyManagment.App.Contracts.InstitutionPlan;
|
||||
using CompanyManagment.App.Contracts.PersonalContractingParty;
|
||||
using CompanyManagment.App.Contracts.Representative;
|
||||
using CompanyManagment.App.Contracts.TemporaryClientRegistration;
|
||||
using CompanyManagment.App.Contracts.Workshop;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.Rendering;
|
||||
@@ -24,11 +27,13 @@ public class institutionContractController : AdminBaseController
|
||||
private readonly IAccountApplication _accountApplication;
|
||||
private readonly IEmployerApplication _employerApplication;
|
||||
private readonly IWorkshopApplication _workshopApplication;
|
||||
private readonly ITemporaryClientRegistrationApplication _temporaryClientRegistration;
|
||||
|
||||
|
||||
public institutionContractController(IInstitutionContractApplication institutionContractApplication,
|
||||
IPersonalContractingPartyApp contractingPartyApplication, IContactInfoApplication contactInfoApplication,
|
||||
IAccountApplication accountApplication, IEmployerApplication employerApplication, IWorkshopApplication workshopApplication)
|
||||
IAccountApplication accountApplication, IEmployerApplication employerApplication,
|
||||
IWorkshopApplication workshopApplication, ITemporaryClientRegistrationApplication temporaryClientRegistration)
|
||||
{
|
||||
_institutionContractApplication = institutionContractApplication;
|
||||
_contractingPartyApplication = contractingPartyApplication;
|
||||
@@ -36,6 +41,7 @@ public class institutionContractController : AdminBaseController
|
||||
_accountApplication = accountApplication;
|
||||
_employerApplication = employerApplication;
|
||||
_workshopApplication = workshopApplication;
|
||||
_temporaryClientRegistration = temporaryClientRegistration;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -351,159 +357,161 @@ public class institutionContractController : AdminBaseController
|
||||
blockTimes = afterActtion.BlockTimes
|
||||
});
|
||||
}
|
||||
[HttpGet("extension/{id}")]
|
||||
|
||||
[HttpGet("extension/{id}")]
|
||||
public ActionResult<EditInstitutionContract> OnGetExtension(long id)
|
||||
{
|
||||
var todayGr = DateTime.Now;
|
||||
var todayFa = todayGr.ToFarsi();
|
||||
var previusContract = _institutionContractApplication.GetDetails(id);
|
||||
var previusContractEnd = previusContract.ContractEndGr.AddDays(1);
|
||||
var startFa = previusContractEnd.ToFarsi();
|
||||
var endFa = startFa.FindeEndOfYear();
|
||||
{
|
||||
var todayGr = DateTime.Now;
|
||||
var todayFa = todayGr.ToFarsi();
|
||||
var previusContract = _institutionContractApplication.GetDetails(id);
|
||||
var previusContractEnd = previusContract.ContractEndGr.AddDays(1);
|
||||
var startFa = previusContractEnd.ToFarsi();
|
||||
var endFa = startFa.FindeEndOfYear();
|
||||
|
||||
|
||||
var representativList = new List<RepresentativeViewModel>();
|
||||
var contractingPartyList = new List<PersonalContractingPartyViewModel>();
|
||||
var res = _institutionContractApplication.GetDetails(id);
|
||||
var representative = new RepresentativeViewModel
|
||||
{
|
||||
Id = res.RepresentativeId,
|
||||
FullName = res.RepresentativeName
|
||||
};
|
||||
representativList.Add(representative);
|
||||
var contractingParty = new PersonalContractingPartyViewModel
|
||||
{
|
||||
id = res.ContractingPartyId,
|
||||
FullName = _contractingPartyApplication.GetFullName(res.ContractingPartyId)
|
||||
};
|
||||
contractingPartyList.Add(contractingParty);
|
||||
res.RepresentativeSelectList =
|
||||
new SelectList(representativList, "Id", "FullName");
|
||||
res.ContractingPartiesSelectList =
|
||||
new SelectList(contractingPartyList, "id", "FullName");
|
||||
var representativList = new List<RepresentativeViewModel>();
|
||||
var contractingPartyList = new List<PersonalContractingPartyViewModel>();
|
||||
var res = _institutionContractApplication.GetDetails(id);
|
||||
var representative = new RepresentativeViewModel
|
||||
{
|
||||
Id = res.RepresentativeId,
|
||||
FullName = res.RepresentativeName
|
||||
};
|
||||
representativList.Add(representative);
|
||||
var contractingParty = new PersonalContractingPartyViewModel
|
||||
{
|
||||
id = res.ContractingPartyId,
|
||||
FullName = _contractingPartyApplication.GetFullName(res.ContractingPartyId)
|
||||
};
|
||||
contractingPartyList.Add(contractingParty);
|
||||
res.RepresentativeSelectList =
|
||||
new SelectList(representativList, "Id", "FullName");
|
||||
res.ContractingPartiesSelectList =
|
||||
new SelectList(contractingPartyList, "id", "FullName");
|
||||
|
||||
var employer = _employerApplication.GetEmployerByContracrtingPartyID(res.ContractingPartyId);
|
||||
var emplId = employer.Select(x => x.Id).ToList();
|
||||
var employer = _employerApplication.GetEmployerByContracrtingPartyID(res.ContractingPartyId);
|
||||
var emplId = employer.Select(x => x.Id).ToList();
|
||||
|
||||
var w = _workshopApplication.GetWorkshopsByEmployerId(emplId);
|
||||
var workshopIds = w.Select(x => x.Id).ToList();
|
||||
var workshopCount = Convert.ToString(w.Count);
|
||||
var w = _workshopApplication.GetWorkshopsByEmployerId(emplId);
|
||||
var workshopIds = w.Select(x => x.Id).ToList();
|
||||
var workshopCount = Convert.ToString(w.Count);
|
||||
|
||||
var pCount = 0;
|
||||
if (workshopIds.Count > 0)
|
||||
{
|
||||
foreach (var workshopId in workshopIds)
|
||||
{
|
||||
var p = _workshopApplication.PersonnelCount(workshopId);
|
||||
pCount += p;
|
||||
}
|
||||
var pCount = 0;
|
||||
if (workshopIds.Count > 0)
|
||||
{
|
||||
foreach (var workshopId in workshopIds)
|
||||
{
|
||||
var p = _workshopApplication.PersonnelCount(workshopId);
|
||||
pCount += p;
|
||||
}
|
||||
|
||||
res.EmployeeCount = Convert.ToString(pCount);
|
||||
}
|
||||
else
|
||||
{
|
||||
res.EmployeeCount = "0";
|
||||
}
|
||||
res.EmployeeCount = Convert.ToString(pCount);
|
||||
}
|
||||
else
|
||||
{
|
||||
res.EmployeeCount = "0";
|
||||
}
|
||||
|
||||
|
||||
//var left = _leftWorkApplication.GetLeftPersonelByWorkshopId(workshopIds);
|
||||
//var left = _leftWorkApplication.GetLeftPersonelByWorkshopId(workshopIds);
|
||||
|
||||
res.WorkshopCount = workshopCount;
|
||||
res.WorkshopCount = workshopCount;
|
||||
|
||||
res.WorkshopManualCount = workshopCount;
|
||||
res.EmployeeManualCount = res.EmployeeCount;
|
||||
res.WorkshopManualCount = workshopCount;
|
||||
res.EmployeeManualCount = res.EmployeeCount;
|
||||
|
||||
res.ContractDateFa = todayFa;
|
||||
res.ContractStartFa = startFa;
|
||||
res.ContractEndFa = endFa;
|
||||
res.ContractAmountString = "0";
|
||||
res.DailyCompenseationString = "0";
|
||||
res.ObligationString = "0";
|
||||
res.TotalAmountString = "0";
|
||||
res.PrviousContractId = id;
|
||||
res.ContractDateFa = todayFa;
|
||||
res.ContractStartFa = startFa;
|
||||
res.ContractEndFa = endFa;
|
||||
res.ContractAmountString = "0";
|
||||
res.DailyCompenseationString = "0";
|
||||
res.ObligationString = "0";
|
||||
res.TotalAmountString = "0";
|
||||
res.PrviousContractId = id;
|
||||
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(res.EmployeeManualCount))
|
||||
{
|
||||
var countPerson = Convert.ToInt32(res.EmployeeCount);
|
||||
var finalAmount = _institutionContractApplication.GetcontractAmount(countPerson);
|
||||
if (!string.IsNullOrWhiteSpace(res.EmployeeManualCount))
|
||||
{
|
||||
var countPerson = Convert.ToInt32(res.EmployeeCount);
|
||||
var finalAmount = _institutionContractApplication.GetcontractAmount(countPerson);
|
||||
|
||||
var syear = Convert.ToInt32(startFa.Substring(0, 4));
|
||||
var smonth = Convert.ToInt32(startFa.Substring(5, 2));
|
||||
var sday = Convert.ToInt32(startFa.Substring(8, 2));
|
||||
var syear = Convert.ToInt32(startFa.Substring(0, 4));
|
||||
var smonth = Convert.ToInt32(startFa.Substring(5, 2));
|
||||
var sday = Convert.ToInt32(startFa.Substring(8, 2));
|
||||
|
||||
|
||||
var eyear = Convert.ToInt32(endFa.Substring(0, 4));
|
||||
var emonth = Convert.ToInt32(endFa.Substring(5, 2));
|
||||
var eday = Convert.ToInt32(endFa.Substring(8, 2));
|
||||
emonth += 1;
|
||||
var eyear = Convert.ToInt32(endFa.Substring(0, 4));
|
||||
var emonth = Convert.ToInt32(endFa.Substring(5, 2));
|
||||
var eday = Convert.ToInt32(endFa.Substring(8, 2));
|
||||
emonth += 1;
|
||||
|
||||
var def = (eyear - syear) * 12 + emonth - smonth;
|
||||
var def = (eyear - syear) * 12 + emonth - smonth;
|
||||
|
||||
|
||||
//رند ماهیانه
|
||||
//int rightMDigits = (int)(finalAmount % 1000000);
|
||||
//if (rightMDigits < 500000)
|
||||
//{
|
||||
// finalAmount = (int)(finalAmount / 100000) * 100000;
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// finalAmount = (int)(finalAmount / 100000 + 1) * 100000;
|
||||
//}
|
||||
finalAmount = (int)(finalAmount / 1000000) * 1000000;
|
||||
//رند ماهیانه
|
||||
//int rightMDigits = (int)(finalAmount % 1000000);
|
||||
//if (rightMDigits < 500000)
|
||||
//{
|
||||
// finalAmount = (int)(finalAmount / 100000) * 100000;
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// finalAmount = (int)(finalAmount / 100000 + 1) * 100000;
|
||||
//}
|
||||
finalAmount = (int)(finalAmount / 1000000) * 1000000;
|
||||
|
||||
double compute = 0;
|
||||
double tenPercent = 0;
|
||||
if (res.HasValueAddedTax == "true")
|
||||
{
|
||||
tenPercent = finalAmount * 10 / 100;
|
||||
res.ContractAmountOAlone = finalAmount.ToMoney();
|
||||
double compute = 0;
|
||||
double tenPercent = 0;
|
||||
if (res.HasValueAddedTax == "true")
|
||||
{
|
||||
tenPercent = finalAmount * 10 / 100;
|
||||
res.ContractAmountOAlone = finalAmount.ToMoney();
|
||||
|
||||
//افزودن 10 درصد
|
||||
finalAmount += tenPercent;
|
||||
res.ContractAmountString = finalAmount.ToMoney();
|
||||
res.ValueAddedTaxStr = tenPercent.ToMoney();
|
||||
compute = finalAmount * def;
|
||||
res.ObligationString = compute.ToMoney();
|
||||
res.TotalAmountString = res.ObligationString;
|
||||
}
|
||||
else
|
||||
{
|
||||
res.ContractAmountOAlone = finalAmount.ToMoney();
|
||||
res.ContractAmountString = res.ContractAmountOAlone;
|
||||
res.ValueAddedTaxStr = "0";
|
||||
compute = finalAmount * def;
|
||||
res.ObligationString = compute.ToMoney();
|
||||
res.TotalAmountString = res.ObligationString;
|
||||
}
|
||||
//افزودن 10 درصد
|
||||
finalAmount += tenPercent;
|
||||
res.ContractAmountString = finalAmount.ToMoney();
|
||||
res.ValueAddedTaxStr = tenPercent.ToMoney();
|
||||
compute = finalAmount * def;
|
||||
res.ObligationString = compute.ToMoney();
|
||||
res.TotalAmountString = res.ObligationString;
|
||||
}
|
||||
else
|
||||
{
|
||||
res.ContractAmountOAlone = finalAmount.ToMoney();
|
||||
res.ContractAmountString = res.ContractAmountOAlone;
|
||||
res.ValueAddedTaxStr = "0";
|
||||
compute = finalAmount * def;
|
||||
res.ObligationString = compute.ToMoney();
|
||||
res.TotalAmountString = res.ObligationString;
|
||||
}
|
||||
|
||||
|
||||
//رند سالانه
|
||||
//رند سالانه
|
||||
|
||||
//int rightYDigits = (int)(compute % 10000000);
|
||||
//if (rightYDigits < 5000000)
|
||||
//int rightYDigits = (int)(compute % 10000000);
|
||||
//if (rightYDigits < 5000000)
|
||||
|
||||
//compute = (int)(compute / 1000000) * 1000000;
|
||||
}
|
||||
//compute = (int)(compute / 1000000) * 1000000;
|
||||
}
|
||||
|
||||
var contactInfo = _contactInfoApplication.GetContactInfolist(id);
|
||||
if (contactInfo.Count > 0)
|
||||
{
|
||||
res.ContactInfoCounter = contactInfo.Count;
|
||||
res.ContactInformationList = contactInfo;
|
||||
}
|
||||
else
|
||||
{
|
||||
res.ContactInfoCounter = 0;
|
||||
}
|
||||
var contactInfo = _contactInfoApplication.GetContactInfolist(id);
|
||||
if (contactInfo.Count > 0)
|
||||
{
|
||||
res.ContactInfoCounter = contactInfo.Count;
|
||||
res.ContactInformationList = contactInfo;
|
||||
}
|
||||
else
|
||||
{
|
||||
res.ContactInfoCounter = 0;
|
||||
}
|
||||
|
||||
|
||||
return res;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
[HttpPost("extension")]
|
||||
public async Task<ActionResult<OperationResult>> OnPostExtension([FromBody]ExtenstionInstitutionContractRequest command)
|
||||
public async Task<ActionResult<OperationResult>> OnPostExtension(
|
||||
[FromBody] ExtenstionInstitutionContractRequest command)
|
||||
{
|
||||
var op = new OperationResult();
|
||||
|
||||
@@ -515,73 +523,74 @@ public class institutionContractController : AdminBaseController
|
||||
return new JsonResult(op.Failed("کد ملی طرف حساب وجود ندارد"));
|
||||
if (conractingParty.IsLegal == "حقوقی" && string.IsNullOrWhiteSpace(conractingParty.NationalId))
|
||||
return new JsonResult(op.Failed("شناسه ملی طرف حساب وجود ندارد"));
|
||||
if(phoneNumber == null)
|
||||
if (phoneNumber == null)
|
||||
return new JsonResult(op.Failed("تعیین شماره همراه با سمت طرف قرارداد اجباریست"));
|
||||
|
||||
|
||||
var counter = command.ContactInfos.Count;
|
||||
|
||||
var result = await _institutionContractApplication.ExtensionَAsync(command);
|
||||
var result = await _institutionContractApplication.ExtensionَAsync(command);
|
||||
|
||||
if (result.IsSuccedded && counter > 0)
|
||||
{
|
||||
for (var i = 0; i <= counter - 1; i++)
|
||||
{
|
||||
if (command.ContactInfos[i].PhoneNumber != null)
|
||||
{
|
||||
var contactinfo = new CreateContactInfo
|
||||
{
|
||||
InstitutionContractId = result.SendId,
|
||||
PhoneType = command.ContactInfos[i].PhoneType,
|
||||
Position = command.ContactInfos[i].Position,
|
||||
PhoneNumber = command.ContactInfos[i].PhoneNumber,
|
||||
FnameLname = command.ContactInfos[i].FnameLname,
|
||||
SendSms = command.ContactInfos[i].SendSmsString == "true" ? true : false
|
||||
};
|
||||
_contactInfoApplication.Create(contactinfo);
|
||||
}
|
||||
if (result.IsSuccedded && counter > 0)
|
||||
{
|
||||
for (var i = 0; i <= counter - 1; i++)
|
||||
{
|
||||
if (command.ContactInfos[i].PhoneNumber != null)
|
||||
{
|
||||
var contactinfo = new CreateContactInfo
|
||||
{
|
||||
InstitutionContractId = result.SendId,
|
||||
PhoneType = command.ContactInfos[i].PhoneType,
|
||||
Position = command.ContactInfos[i].Position,
|
||||
PhoneNumber = command.ContactInfos[i].PhoneNumber,
|
||||
FnameLname = command.ContactInfos[i].FnameLname,
|
||||
SendSms = command.ContactInfos[i].SendSmsString == "true" ? true : false
|
||||
};
|
||||
_contactInfoApplication.Create(contactinfo);
|
||||
}
|
||||
|
||||
Thread.Sleep(500);
|
||||
}
|
||||
}
|
||||
|
||||
Thread.Sleep(500);
|
||||
}
|
||||
}
|
||||
|
||||
if (result.IsSuccedded)
|
||||
{
|
||||
_institutionContractApplication.DeActive(command.PreviousContractId);
|
||||
_institutionContractApplication.ReActiveAllAfterCreateNew(command.ContractingPartyId);
|
||||
}
|
||||
var contractingPartyId = _institutionContractApplication.GetDetails(result.SendId);
|
||||
|
||||
var getOldContarct = _institutionContractApplication.NewSearch(new InstitutionContractSearchModel()
|
||||
{ ContractingPartyId = contractingPartyId.ContractingPartyId, IsActiveString = "both" }).Where(x => x.IsActiveString == "false" || x.IsActiveString == "blue").ToList();
|
||||
if (result.IsSuccedded && counter > 0)
|
||||
{
|
||||
if (result.IsSuccedded)
|
||||
{
|
||||
_institutionContractApplication.DeActive(command.PreviousContractId);
|
||||
_institutionContractApplication.ReActiveAllAfterCreateNew(command.ContractingPartyId);
|
||||
}
|
||||
|
||||
if (getOldContarct.Count > 0)
|
||||
{
|
||||
foreach (var item in getOldContarct)
|
||||
{
|
||||
_contactInfoApplication.RemoveContactInfo(item.Id);
|
||||
foreach (var phone in command.ContactInfos)
|
||||
{
|
||||
if (phone.PhoneNumber != null)
|
||||
{
|
||||
var contactinfo = new CreateContactInfo
|
||||
{
|
||||
InstitutionContractId = item.Id,
|
||||
PhoneType = phone.PhoneType,
|
||||
Position = phone.Position,
|
||||
PhoneNumber = phone.PhoneNumber,
|
||||
FnameLname = phone.FnameLname,
|
||||
SendSms = phone.SendSmsString == "true" ? true : false
|
||||
};
|
||||
_contactInfoApplication.Create(contactinfo);
|
||||
}
|
||||
var contractingPartyId = _institutionContractApplication.GetDetails(result.SendId);
|
||||
|
||||
Thread.Sleep(500);
|
||||
}
|
||||
}
|
||||
var getOldContarct = _institutionContractApplication.NewSearch(new InstitutionContractSearchModel()
|
||||
{ ContractingPartyId = contractingPartyId.ContractingPartyId, IsActiveString = "both" })
|
||||
.Where(x => x.IsActiveString == "false" || x.IsActiveString == "blue").ToList();
|
||||
if (result.IsSuccedded && counter > 0)
|
||||
{
|
||||
if (getOldContarct.Count > 0)
|
||||
{
|
||||
foreach (var item in getOldContarct)
|
||||
{
|
||||
_contactInfoApplication.RemoveContactInfo(item.Id);
|
||||
foreach (var phone in command.ContactInfos)
|
||||
{
|
||||
if (phone.PhoneNumber != null)
|
||||
{
|
||||
var contactinfo = new CreateContactInfo
|
||||
{
|
||||
InstitutionContractId = item.Id,
|
||||
PhoneType = phone.PhoneType,
|
||||
Position = phone.Position,
|
||||
PhoneNumber = phone.PhoneNumber,
|
||||
FnameLname = phone.FnameLname,
|
||||
SendSms = phone.SendSmsString == "true" ? true : false
|
||||
};
|
||||
_contactInfoApplication.Create(contactinfo);
|
||||
}
|
||||
|
||||
Thread.Sleep(500);
|
||||
}
|
||||
}
|
||||
|
||||
//ساخت اکانت کلاینت
|
||||
var userPass = conractingParty.IsLegal == "حقیقی"
|
||||
@@ -590,7 +599,6 @@ public class institutionContractController : AdminBaseController
|
||||
var checkExistAccount = _accountApplication.CheckExistClientAccount(userPass);
|
||||
if (!checkExistAccount)
|
||||
{
|
||||
|
||||
var createAcc = new RegisterAccount
|
||||
{
|
||||
Fullname = conractingParty.LName,
|
||||
@@ -601,13 +609,14 @@ public class institutionContractController : AdminBaseController
|
||||
};
|
||||
var res = _accountApplication.RegisterClient(createAcc);
|
||||
if (res.IsSuccedded)
|
||||
_institutionContractApplication.CreateContractingPartyAccount(command.ContractingPartyId, res.SendId);
|
||||
_institutionContractApplication.CreateContractingPartyAccount(command.ContractingPartyId,
|
||||
res.SendId);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
@@ -624,5 +633,56 @@ public class institutionContractController : AdminBaseController
|
||||
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
||||
$"قرارداد های مالی.xlsx");
|
||||
}
|
||||
|
||||
[HttpPost("create/inquiry")]
|
||||
public async Task<ActionResult<OperationResult<ContractingPartyTempViewModel>>> CreateInquiry(
|
||||
[FromBody] CreateInquiryRequest request)
|
||||
{
|
||||
var res = await _temporaryClientRegistration.CreateContractingPartyTemp(request.NationalCode,
|
||||
request.DateOfBirth,
|
||||
request.Mobile);
|
||||
return res;
|
||||
}
|
||||
|
||||
[HttpPost("create/workshop-service-calculator")]
|
||||
public ActionResult<InstitutionPlanViewModel> WorkshopServiceCalculator(CreateWorkshopTemp command)
|
||||
{
|
||||
var workshopTemp = new WorkshopTempViewModel
|
||||
{
|
||||
WorkshopName = command.WorkshopName,
|
||||
CountPerson = command.CountPerson,
|
||||
ContractingPartyTempId = command.ContractingPartyTempId,
|
||||
ContractAndCheckout = command.ContractAndCheckout,
|
||||
Insurance = command.Insurance,
|
||||
RollCall = command.RollCall,
|
||||
CustomizeCheckout = command.CustomizeCheckout,
|
||||
ContractAndCheckoutInPerson = command.ContractAndCheckoutInPerson,
|
||||
InsuranceInPerson = command.InsuranceInPerson
|
||||
};
|
||||
|
||||
return _temporaryClientRegistration.GetInstitutionPlanForWorkshop(workshopTemp);
|
||||
}
|
||||
|
||||
[HttpPost("create/institution-plan-calculator")]
|
||||
public async Task<ActionResult<ReviewAndPaymentViewModel>> InstitutionPlanCalculator(
|
||||
[FromBody] InstitutionPlanCalculatorRequest request)
|
||||
{
|
||||
var res = await _temporaryClientRegistration.GetTotalPaymentAndWorkshopList(request.ContractingPartyTempId,
|
||||
request.workshopList, request.PeriodModel, request.PaymentModel, request.ContractStartType);
|
||||
return res;
|
||||
}
|
||||
|
||||
public record InstitutionPlanCalculatorRequest(
|
||||
long ContractingPartyTempId,
|
||||
List<WorkshopTempViewModel> workshopList,
|
||||
string PeriodModel = "12",
|
||||
string PaymentModel = "OneTime",
|
||||
string ContractStartType = "currentMonth");
|
||||
}
|
||||
|
||||
public class CreateInquiryRequest
|
||||
{
|
||||
public string NationalCode { get; set; }
|
||||
public string DateOfBirth { get; set; }
|
||||
public string Mobile { get; set; }
|
||||
}
|
||||
Reference in New Issue
Block a user