some change
This commit is contained in:
@@ -650,7 +650,115 @@ public static class Tools
|
||||
return y2;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// تاریخ شمسی میگیرد و پایان ماه را به میلادی برمیگرداند
|
||||
/// </summary>
|
||||
/// <param name="date"></param>
|
||||
/// <returns></returns>
|
||||
public static DateTime FindeEndOfMonthReturnGr(this string date)
|
||||
{
|
||||
string y2 = string.Empty;
|
||||
var year = Convert.ToInt32(date.Substring(0, 4));
|
||||
var month = Convert.ToInt32(date.Substring(5, 2));
|
||||
var YearD = date.Substring(0, 4);
|
||||
var MonthD = date.Substring(5, 2);
|
||||
if (month <= 6)
|
||||
{
|
||||
y2 = $"{YearD}/{MonthD}/31";
|
||||
}
|
||||
else if (month > 6 && month < 12)
|
||||
{
|
||||
y2 = $"{YearD}/{MonthD}/30";
|
||||
}
|
||||
else if (month == 12)
|
||||
{
|
||||
switch (year)
|
||||
{
|
||||
case 1346:
|
||||
y2 = $"{YearD}/{MonthD}/30";
|
||||
break;
|
||||
case 1350:
|
||||
y2 = $"{YearD}/{MonthD}/30";
|
||||
break;
|
||||
case 1354:
|
||||
y2 = $"{YearD}/{MonthD}/30";
|
||||
break;
|
||||
case 1358:
|
||||
y2 = $"{YearD}/{MonthD}/30";
|
||||
break;
|
||||
case 1362:
|
||||
y2 = $"{YearD}/{MonthD}/30";
|
||||
break;
|
||||
case 1366:
|
||||
y2 = $"{YearD}/{MonthD}/30";
|
||||
break;
|
||||
case 1370:
|
||||
y2 = $"{YearD}/{MonthD}/30";
|
||||
break;
|
||||
case 1375:
|
||||
y2 = $"{YearD}/{MonthD}/30";
|
||||
break;
|
||||
case 1379:
|
||||
y2 = $"{YearD}/{MonthD}/30";
|
||||
break;
|
||||
case 1383:
|
||||
y2 = $"{YearD}/{MonthD}/30";
|
||||
break;
|
||||
case 1387:
|
||||
y2 = $"{YearD}/{MonthD}/30";
|
||||
break;
|
||||
case 1391:
|
||||
y2 = $"{YearD}/{MonthD}/30";
|
||||
break;
|
||||
case 1395:
|
||||
y2 = $"{YearD}/{MonthD}/30";
|
||||
break;
|
||||
case 1399:
|
||||
y2 = $"{YearD}/{MonthD}/30";
|
||||
break;
|
||||
case 1403:
|
||||
y2 = $"{YearD}/{MonthD}/30";
|
||||
break;
|
||||
case 1408:
|
||||
y2 = $"{YearD}/{MonthD}/30";
|
||||
break;
|
||||
case 1412:
|
||||
y2 = $"{YearD}/{MonthD}/30";
|
||||
break;
|
||||
case 1416:
|
||||
y2 = $"{YearD}/{MonthD}/30";
|
||||
break;
|
||||
case 1420:
|
||||
y2 = $"{YearD}/{MonthD}/30";
|
||||
break;
|
||||
case 1424:
|
||||
y2 = $"{YearD}/{MonthD}/30";
|
||||
break;
|
||||
case 1428:
|
||||
y2 = $"{YearD}/{MonthD}/30";
|
||||
break;
|
||||
case 1432:
|
||||
y2 = $"{YearD}/{MonthD}/30";
|
||||
break;
|
||||
case 1436:
|
||||
y2 = $"{YearD}/{MonthD}/30";
|
||||
break;
|
||||
case 1441:
|
||||
y2 = $"{YearD}/{MonthD}/30";
|
||||
break;
|
||||
case 1445:
|
||||
y2 = $"{YearD}/{MonthD}/30";
|
||||
break;
|
||||
|
||||
default:
|
||||
y2 = $"{YearD}/{MonthD}/29";
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return y2.ToGeorgianDateTime();
|
||||
}
|
||||
/// <summary>
|
||||
/// تعداد روزهای سال را برمیگرداند
|
||||
/// اگر کبیسهد بود سال 366 روزه برمیگرداند
|
||||
|
||||
@@ -111,11 +111,12 @@ public interface ICheckoutRepository : IRepository<long, Checkout>
|
||||
/// دریافت قردادها و جداول وابسته برای ایجاد فیش
|
||||
/// </summary>
|
||||
/// <param name="ids"></param>
|
||||
/// <param name="year"></param>
|
||||
/// <param name="month"></param>
|
||||
/// <param name="workshopId"></param>
|
||||
/// <returns></returns>
|
||||
Task<OperationResult<GetContractAndIncludesDataToCreateDto>> GetContractsAndIncludeDataDataToCreateCheckout(
|
||||
List<long> ids, string month, long workshopId);
|
||||
List<long> ids, string year, string month, long workshopId);
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -840,7 +840,7 @@ public class CheckoutApplication : ICheckoutApplication
|
||||
#endregion
|
||||
|
||||
var getContcatsData = await
|
||||
_checkoutRepository.GetContractsAndIncludeDataDataToCreateCheckout(ids, month, workshopId);
|
||||
_checkoutRepository.GetContractsAndIncludeDataDataToCreateCheckout(ids, year, month, workshopId);
|
||||
return getContcatsData;
|
||||
}
|
||||
#endregion
|
||||
|
||||
@@ -2762,8 +2762,11 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
||||
return employees;
|
||||
}
|
||||
|
||||
public async Task<OperationResult<GetContractAndIncludesDataToCreateDto>> GetContractsAndIncludeDataDataToCreateCheckout(List<long> ids, string month, long workshopId)
|
||||
public async Task<OperationResult<GetContractAndIncludesDataToCreateDto>> GetContractsAndIncludeDataDataToCreateCheckout(List<long> ids,string year, string month, long workshopId)
|
||||
{
|
||||
var checkoutSelectedStartFa = $"{year}/{month}/01";
|
||||
var checkoutSelectedStart = checkoutSelectedStartFa.ToGeorgianDateTime();
|
||||
var checkoutSelectedEnd = checkoutSelectedStartFa.FindeEndOfMonthReturnGr();
|
||||
var op = new OperationResult<GetContractAndIncludesDataToCreateDto>();
|
||||
var watcher = new Stopwatch();
|
||||
watcher.Start();
|
||||
@@ -3923,6 +3926,26 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
||||
timer.Start();
|
||||
var separation = new List<ContractSeparationViewModel>();
|
||||
var seprationData = getContracts.Select(x => new { x.EmployeeId, x.ContarctStart, x.ContractEnd }).ToList();
|
||||
|
||||
foreach (var contract in seprationData)
|
||||
{
|
||||
var start = new DateTime();
|
||||
var end = new DateTime();
|
||||
for (var current = contract.ContarctStart; current <= contract.ContractEnd; current=current.AddDays(1))
|
||||
{
|
||||
if (start == new DateTime() && current >= checkoutSelectedStart && current <= checkoutSelectedEnd)
|
||||
{
|
||||
start = current;
|
||||
}
|
||||
|
||||
if (end == new DateTime() && current == checkoutSelectedEnd)
|
||||
{
|
||||
end = current;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
foreach (var item in seprationData)
|
||||
{
|
||||
bool hasLeft = false;
|
||||
|
||||
@@ -133,8 +133,13 @@ public class CheckoutController : AdminBaseController
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ایجاد فیش حقوقی
|
||||
/// </summary>
|
||||
/// <param name="command"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<OperationResult<GetContractAndIncludesDataToCreateDto>> CreateCheckout()
|
||||
public async Task<OperationResult<GetContractAndIncludesDataToCreateDto>> CreateCheckout([FromBody]TestCreateCheckout command)
|
||||
{
|
||||
var ids = new
|
||||
List<long>()
|
||||
@@ -164,10 +169,16 @@ public class CheckoutController : AdminBaseController
|
||||
};
|
||||
|
||||
|
||||
var test = await _checkoutApplication.CreateCheckoutApi(ids, "1404", "10", 499);
|
||||
var test = await _checkoutApplication.CreateCheckoutApi(ids, command.year, command.Month, command.WorkshopId);
|
||||
return test;
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
|
||||
public class TestCreateCheckout
|
||||
{
|
||||
public string year { get; set; }
|
||||
public string Month { get; set; }
|
||||
public long WorkshopId { get; set; }
|
||||
}
|
||||
Reference in New Issue
Block a user