GetContractsAndIncludeDataDataToCreateCheckout

This commit is contained in:
gozareshgir
2026-01-22 16:09:27 +03:30
parent d3dacceab1
commit 48cc07bf2a
6 changed files with 1501 additions and 16 deletions

View File

@@ -107,5 +107,14 @@ public interface ICheckoutRepository : IRepository<long, Checkout>
/// <returns></returns>
Task<List<CheckoutPrintDto>> CheckoutPrint(List<long> ids);
/// <summary>
/// دریافت قردادها و جداول وابسته برای ایجاد فیش
/// </summary>
/// <param name="ids"></param>
/// <param name="month"></param>
/// <returns></returns>
Task<OperationResult<GetContractAndIncludesDataToCreateDto>> GetContractsAndIncludeDataDataToCreateCheckout(
List<long> ids, string month);
#endregion
}

View File

@@ -0,0 +1,6 @@
namespace CompanyManagment.App.Contracts.Checkout.Dto;
public class GetContractAndIncludesDataToCreateDto
{
}

View File

@@ -106,6 +106,14 @@ public interface ICheckoutApplication
/// <returns></returns>
Task<OperationResult<List<ContractsListToCreateCheckoutDto>>> GetContractToCreateCheckout(long workshopId,
string year, string month, long employeeId);
/// <summary>
/// ایجاد فیش حقوقی
/// </summary>
/// <param name="ids"></param>
/// <param name="year"></param>
/// <param name="month"></param>
/// <returns></returns>
Task<OperationResult> CreateCheckoutApi(List<long> ids, string year, string month);
#endregion
}

View File

@@ -789,7 +789,7 @@ public class CheckoutApplication : ICheckoutApplication
}
public async Task<OperationResult> CreateCheckoutApi(List<long> ContractsId, string ConvertYear, string ConvertMonth)
public async Task<OperationResult> CreateCheckoutApi(List<long> ids, string year, string month)
{
var op = new OperationResult();
@@ -798,26 +798,26 @@ public class CheckoutApplication : ICheckoutApplication
#region Validation
if (!string.IsNullOrWhiteSpace(ConvertYear) && string.IsNullOrWhiteSpace(ConvertMonth))
if (!string.IsNullOrWhiteSpace(year) && string.IsNullOrWhiteSpace(month))
return op.Failed("ماه را انتخاب کنید");
if (string.IsNullOrWhiteSpace(ConvertYear) && !string.IsNullOrWhiteSpace(ConvertMonth))
if (string.IsNullOrWhiteSpace(year) && !string.IsNullOrWhiteSpace(month))
return op.Failed("سال را انتخاب کنید");
if (string.IsNullOrWhiteSpace(ConvertYear) && string.IsNullOrWhiteSpace(ConvertMonth))
if (string.IsNullOrWhiteSpace(year) && string.IsNullOrWhiteSpace(month))
{
ConvertYear = "0";
ConvertMonth = "0";
year = "0";
month = "0";
var today = DateTime.Now;
var FaToday = today.ToFarsi();
var year = FaToday.Substring(0, 4);
var month = FaToday.Substring(5, 2);
var convertedYear = FaToday.Substring(0, 4);
var convertedMonth = FaToday.Substring(5, 2);
ConvertYear = year;
ConvertMonth = month;
year = convertedYear;
month = convertedMonth;
}
if (ContractsId.Count == 0)
if (ids.Count == 0)
return op.Failed("هیچ موردی انتخاب نشده اشت");
#endregion
@@ -829,6 +829,8 @@ public class CheckoutApplication : ICheckoutApplication
#endregion
var getContcatsData =
_checkoutRepository.GetContractsAndIncludeDataDataToCreateCheckout(ids, month);
return op.Succcedded();
}
#endregion

File diff suppressed because it is too large Load Diff

View File

@@ -108,16 +108,24 @@ public class CheckoutController : AdminBaseController
[HttpGet("GetContractsToCreateCheckout")]
public async Task<OperationResult<List<ContractsListToCreateCheckoutDto>>> GetContractsToCreateCheckout(long workshopId, string year, string month, long employeeId)
{
var result =await _checkoutApplication.GetContractToCreateCheckout(workshopId, year, month, employeeId);
if (!result.IsSuccedded)
return result;
var hasWorkFlow =await _workFlowApplication.HasWorkFlow(workshopId, year, month);
//var hasWorkFlow =await _workFlowApplication.HasWorkFlow(workshopId, year, month);
//if (hasWorkFlow)
// return new OperationResult<List<ContractsListToCreateCheckoutDto>>().Failed(
// "این کارگاه به دلیل داشتن کارپوشه مجاز به ایجاد تصفیه حساب نمی باشد");
#region testCreate
var ids = result.Data.Where(x => x.CreateCheckoutStatus == CreateCheckoutStatus.ReadyToCreate).Select(x => x.Id).ToList();
var test = await _checkoutApplication.CreateCheckoutApi(ids, year, month);
#endregion
if (hasWorkFlow)
return new OperationResult<List<ContractsListToCreateCheckoutDto>>().Failed(
"این کارگاه به دلیل داشتن کارپوشه مجاز به ایجاد تصفیه حساب نمی باشد");
return result;
}