create rollcallservice transaction chnages

This commit is contained in:
SamSys
2025-08-22 00:58:42 +03:30
parent 3aa5668696
commit 41503101b6

View File

@@ -909,24 +909,30 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
var workshop = _context.Workshops.FirstOrDefault(x => x.id == rollCallService.WorkshopId);
string description = "";
if (rollCallService.StartService <= prevMonthStart)
{
var monthPrev = prevMonthEnd.ToFarsi().Substring(5, 2);
var yearPrev = prevMonthEnd.ToFarsi().Substring(0, 4);
var prevMonthName = monthPrev.ToFarsiMonthByNumber();
description =
$"{prevMonthName} و {currentMonthName} {yearCurrent} - {workshop.WorkshopFullName}";
monthCounter = 2;
}
else if (rollCallService.StartService <= currentMonthStart &&
rollCallService.StartService > prevMonthStart)
//if (rollCallService.StartService <= prevMonthStart)
//{
// var monthPrev = prevMonthEnd.ToFarsi().Substring(5, 2);
// var yearPrev = prevMonthEnd.ToFarsi().Substring(0, 4);
// var prevMonthName = monthPrev.ToFarsiMonthByNumber();
// description =
// $"{prevMonthName} و {currentMonthName} {yearCurrent} - {workshop.WorkshopFullName}";
// monthCounter = 2;
//}
//else if (rollCallService.StartService <= currentMonthStart &&
// rollCallService.StartService > prevMonthStart)
//{
// monthCounter = 1;
// description = $"{currentMonthName} {yearCurrent} - {workshop.WorkshopFullName}";
//}
if (rollCallService.StartService <= currentMonthStart)
{
monthCounter = 1;
description = $"{currentMonthName} {yearCurrent} - {workshop.WorkshopFullName}";
}
var employees =
_context.RollCallEmployees.Where(x => x.WorkshopId == rollCallService.WorkshopId)
.Select(x => x.id);
@@ -965,9 +971,14 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
var tenPercent = amountWithoutTax * 10 / 100;
var totalAmonut = amountWithoutTax + tenPercent;
double roundFloor = Math.Floor(totalAmonut);
double result = Math.Ceiling(roundFloor / 10000.0) * 10000;
Console.WriteLine(counter + " - " + rollCallService.StartService.ToFarsi() + " - " +
rollCallService.WorkshopId + " - " + monthCounter + " - " + employeeCount +
$" - {amountWithoutTax}");
rollCallService.WorkshopId + " - " + employeeCount +
$" - {totalAmonut} - round {result}");
var financialStatment =
_context.FinancialStatments.FirstOrDefault(x =>
@@ -988,7 +999,7 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
var transaction = new FinancialTransaction(financialStatementId, endOfMonthGr, endOfMonth,
description,
"debt", "بابت سرویس حضور غیاب", totalAmonut, 0, 0);
"debt", "بابت سرویس حضور غیاب", result, 0, 0);
_context.FinancialTransactions.Add(transaction);
_context.SaveChanges();