296 lines
9.7 KiB
C#
296 lines
9.7 KiB
C#
using _0_Framework.Application;
|
|
using CompanyManagment.App.Contracts.Report;
|
|
using CompanyManagment.App.Contracts.Workshop;
|
|
using CompanyManagment.App.Contracts.YearlySalary;
|
|
using MD.PersianDateTime.Standard;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using Microsoft.AspNetCore.Mvc.RazorPages;
|
|
|
|
namespace ServiceHost.Areas.Admin.Pages.Company.Reports;
|
|
|
|
public class IndexModel : PageModel
|
|
{
|
|
private readonly IReportApplication _reportApplication;
|
|
private readonly IWorkshopApplication _workshopApplication;
|
|
private readonly IYearlySalaryApplication _yearlySalaryApplication;
|
|
public int AllPercent;
|
|
public int CheckoutPercent;
|
|
public int CheckoutSignaturePercent;
|
|
public int ContractPercent;
|
|
public int ContractSignaturePercent;
|
|
public string CurrentMonth;
|
|
public string Month;
|
|
public string NextMonth;
|
|
public string Year;
|
|
public List<string> YearlyList;
|
|
|
|
|
|
public IndexModel(IAuthHelper authHelper, IReportApplication reportApplication,
|
|
IYearlySalaryApplication yearlySalaryApplication, IWorkshopApplication workshopApplication)
|
|
{
|
|
_reportApplication = reportApplication;
|
|
_yearlySalaryApplication = yearlySalaryApplication;
|
|
_workshopApplication = workshopApplication;
|
|
}
|
|
|
|
public List<AccountResults> PersonnelContract { get; set; }
|
|
public List<AccountResults> PersonnelCheckout { get; set; }
|
|
|
|
//قراداد
|
|
public int AllContract { get; set; }
|
|
public int ContractNotDone { get; set; }
|
|
public int ContrcatDone { get; set; }
|
|
public int ContractSignNotDone { get; set; }
|
|
public int ContractSignDone { get; set; }
|
|
|
|
//تصفیه
|
|
public int AllCheckout { get; set; }
|
|
public int CheckoutNotDone { get; set; }
|
|
public int CheckoutDone { get; set; }
|
|
public int CheckoutSignNotDone { get; set; }
|
|
public int CheckoutSignDone { get; set; }
|
|
|
|
public async Task OnGet(string year, string month)
|
|
{
|
|
YearlyList = _yearlySalaryApplication.GetYears();
|
|
var allReports = await _reportApplication.GetAllReports(year, month);
|
|
AllPercent = allReports.AllPercent;
|
|
ContractPercent = allReports.ContractPercent;
|
|
ContractSignaturePercent = allReports.ContractSignaturePercent;
|
|
CheckoutPercent = allReports.CheckoutPercent;
|
|
CheckoutSignaturePercent = allReports.CheckoutSignaturePercent;
|
|
Year = allReports.Year;
|
|
Month = allReports.Month;
|
|
PersonnelContract = allReports.ContractAccountResults;
|
|
PersonnelCheckout = allReports.CheckoutAccountResults;
|
|
CurrentMonth = allReports.Month.ToFarsiMonthByNumber();
|
|
var now = new PersianDateTime(Convert.ToInt32(allReports.Year), Convert.ToInt32(allReports.Month), 1);
|
|
var before = now.AddMonths(1);
|
|
NextMonth = before.Month.ToFarsiMonthByIntNumber();
|
|
|
|
AllContract = allReports.AllContract;
|
|
ContractNotDone = allReports.ContractNotDone;
|
|
ContrcatDone = allReports.ContrcatDone;
|
|
ContractSignNotDone = allReports.ContractSignNotDone;
|
|
ContractSignDone = allReports.ContractSignDone;
|
|
AllCheckout = allReports.AllCheckout;
|
|
CheckoutNotDone = allReports.CheckoutNotDone;
|
|
CheckoutDone = allReports.CheckoutDone;
|
|
CheckoutSignNotDone = allReports.CheckoutSignNotDone;
|
|
CheckoutSignDone = allReports.CheckoutSignDone;
|
|
|
|
}
|
|
|
|
#region workshopFirstLoad
|
|
|
|
public IActionResult OnGetWorkshopContractDone(string year, string month, long accountId, List<long> workshopList)
|
|
{
|
|
var res = _reportApplication.GetWorkshopContractDone(year, month, accountId, workshopList);
|
|
return new JsonResult(new
|
|
{
|
|
success = true,
|
|
workshopList = res.WorkshopSearches,
|
|
employeeList = res.EmployeeNotDones
|
|
});
|
|
}
|
|
|
|
public IActionResult OnGetWorkshopContractSignDone(string year, string month, long accountId, List<long> workshopList)
|
|
{
|
|
var res = _reportApplication.GetWorkshopContractSignDone(year, month, accountId, workshopList);
|
|
return new JsonResult(new
|
|
{
|
|
success = true,
|
|
workshopList = res.WorkshopSearches,
|
|
employeeList = res.EmployeeNotDones
|
|
});
|
|
}
|
|
|
|
public IActionResult OnGetWorkshopCheckoutDone(string year, string month, long accountId, List<long> workshopList)
|
|
{
|
|
var res = _reportApplication.GetWorkshopCheckoutDone(year, month, accountId, workshopList);
|
|
return new JsonResult(new
|
|
{
|
|
success = true,
|
|
workshopList = res.WorkshopSearches,
|
|
employeeList = res.EmployeeNotDones
|
|
});
|
|
}
|
|
|
|
public IActionResult OnGetWorkshopCheckoutSignDone(string year, string month, long accountId, List<long> workshopList)
|
|
{
|
|
var res = _reportApplication.GetWorkshopCheckoutSignDone(year, month, accountId, workshopList);
|
|
return new JsonResult(new
|
|
{
|
|
success = true,
|
|
workshopList = res.WorkshopSearches,
|
|
employeeList = res.EmployeeNotDones
|
|
});
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region EmployeeNotDone
|
|
|
|
public IActionResult OnGetEmployeeContract(string year, string month, long workshopId)
|
|
{
|
|
var res = _reportApplication.GetEmployeeContract(year, month, workshopId);
|
|
return new JsonResult(new
|
|
{
|
|
success = true,
|
|
employeeList = res
|
|
});
|
|
}
|
|
|
|
public IActionResult OnGetEmployeeContractSign(string year, string month, long workshopId)
|
|
{
|
|
var res = _reportApplication.GetEmployeeContractSign(year, month, workshopId);
|
|
return new JsonResult(new
|
|
{
|
|
success = true,
|
|
employeeList = res
|
|
});
|
|
}
|
|
|
|
public IActionResult OnGetEmployeeCheckout(string year, string month, long workshopId)
|
|
{
|
|
var res = _reportApplication.GetEmployeeCheckout(year, month, workshopId);
|
|
return new JsonResult(new
|
|
{
|
|
success = true,
|
|
employeeList = res
|
|
});
|
|
}
|
|
|
|
public IActionResult OnGetEmployeeCheckoutSign(string year, string month, long workshopId, long accountId)
|
|
{
|
|
var res = _reportApplication.GetEmployeeCheckoutSign(year, month, workshopId);
|
|
return new JsonResult(new
|
|
{
|
|
success = true,
|
|
employeeList = res
|
|
});
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Print
|
|
|
|
//================PrintAll by account and workshoplist
|
|
public IActionResult OnGetPrintAllContractDone(string year, string month, long accountId,string workshopList)
|
|
{
|
|
|
|
var workshopIds = Tools.ExtractNumbers(workshopList);
|
|
var res = _reportApplication.GetPrintAllContractDone(year, month, accountId, workshopIds);
|
|
return Partial("PrintAll", res);
|
|
}
|
|
|
|
public IActionResult OnGetPrintAllContractSignDone(string year, string month, long accountId, string workshopList)
|
|
{
|
|
var workshopIds = Tools.ExtractNumbers(workshopList);
|
|
var res = _reportApplication.GetPrintAllContractSignDone(year, month, accountId, workshopIds);
|
|
return Partial("PrintAll", res);
|
|
}
|
|
|
|
public IActionResult OnGetPrintAllCheckoutDone(string year, string month, long accountId, string workshopList)
|
|
{
|
|
var workshopIds = Tools.ExtractNumbers(workshopList);
|
|
|
|
var res = _reportApplication.GetPrintAllCheckoutDone(year, month, accountId, workshopIds);
|
|
return Partial("PrintAll", res);
|
|
}
|
|
|
|
public IActionResult OnGetPrintAllCheckoutSignDone(string year, string month, long accountId, string workshopList)
|
|
{
|
|
var workshopIds = Tools.ExtractNumbers(workshopList);
|
|
var res = _reportApplication.GetPrintAllCheckoutSignDone(year, month, accountId, workshopIds);
|
|
return Partial("PrintAll", res);
|
|
}
|
|
//================Employee
|
|
|
|
|
|
public IActionResult OnGetPrintEmployeeContract(string year, string month, long workshopId, string accountFullName)
|
|
{
|
|
var workshop = _workshopApplication.GetDetails(workshopId);
|
|
var res = _reportApplication.GetEmployeeContract(year, month, workshopId);
|
|
var next = $"{year}/{month}/01";
|
|
var y = Convert.ToInt32(year);
|
|
var m = Convert.ToInt32(month);
|
|
var nextFa = new PersianDateTime(y, m, 1).AddMonths(1);
|
|
var monthFa = nextFa.Month.ToFarsiMonthByIntNumber();
|
|
|
|
var final = new PrintEmployeeNotDone
|
|
{
|
|
WorkshopFullName = workshop.WorkshopFullName,
|
|
ArchiveCode = workshop.ArchiveCode,
|
|
AccountFullName = accountFullName,
|
|
YearMonth = $"{monthFa} {nextFa.Year}",
|
|
EmployeeNotDones = res,
|
|
ReportType = "تنظیم قرارداد"
|
|
};
|
|
|
|
return Partial("PrintAllEmployee", final);
|
|
}
|
|
|
|
public IActionResult OnGetPrintEmployeeContractSign(string year, string month, long workshopId,
|
|
string accountFullName)
|
|
{
|
|
var workshop = _workshopApplication.GetDetails(workshopId);
|
|
var res = _reportApplication.GetEmployeeContractSign(year, month, workshopId);
|
|
var next = $"{year}/{month}/01";
|
|
var y = Convert.ToInt32(year);
|
|
var m = Convert.ToInt32(month);
|
|
var nextFa = new PersianDateTime(y, m, 1).AddMonths(1);
|
|
var monthFa = nextFa.Month.ToFarsiMonthByIntNumber();
|
|
|
|
var final = new PrintEmployeeNotDone
|
|
{
|
|
WorkshopFullName = workshop.WorkshopFullName,
|
|
ArchiveCode = workshop.ArchiveCode,
|
|
AccountFullName = accountFullName,
|
|
YearMonth = $"{monthFa} {nextFa.Year}",
|
|
EmployeeNotDones = res,
|
|
ReportType = "امضاء قرارداد"
|
|
};
|
|
|
|
return Partial("PrintAllEmployee", final);
|
|
}
|
|
|
|
public IActionResult OnGetPrintEmployeeCheckout(string year, string month, long workshopId, string accountFullName)
|
|
{
|
|
var workshop = _workshopApplication.GetDetails(workshopId);
|
|
var res = _reportApplication.GetEmployeeCheckout(year, month, workshopId);
|
|
|
|
var final = new PrintEmployeeNotDone
|
|
{
|
|
WorkshopFullName = workshop.WorkshopFullName,
|
|
ArchiveCode = workshop.ArchiveCode,
|
|
AccountFullName = accountFullName,
|
|
YearMonth = $"{month.ToFarsiMonthByNumber()} {year}",
|
|
EmployeeNotDones = res,
|
|
ReportType = "تنظیم تصفیه حساب"
|
|
};
|
|
|
|
return Partial("PrintAllEmployee", final);
|
|
}
|
|
|
|
public IActionResult OnGetPrintEmployeeCheckoutSign(string year, string month, long workshopId,
|
|
string accountFullName)
|
|
{
|
|
var workshop = _workshopApplication.GetDetails(workshopId);
|
|
var res = _reportApplication.GetEmployeeCheckoutSign(year, month, workshopId);
|
|
|
|
var final = new PrintEmployeeNotDone
|
|
{
|
|
WorkshopFullName = workshop.WorkshopFullName,
|
|
ArchiveCode = workshop.ArchiveCode,
|
|
AccountFullName = accountFullName,
|
|
YearMonth = $"{month.ToFarsiMonthByNumber()} {year}",
|
|
EmployeeNotDones = res,
|
|
ReportType = "امضاء تصفیه حساب"
|
|
};
|
|
|
|
return Partial("PrintAllEmployee", final);
|
|
}
|
|
|
|
#endregion
|
|
} |