report changes
This commit is contained in:
@@ -9,12 +9,12 @@ namespace Company.Domain.ReportAgg
|
||||
{
|
||||
public interface IReportRepository
|
||||
{
|
||||
AllReport GetAllActiveWorkshopsNew(string year, string month);
|
||||
Task<AllReport> GetAllActiveWorkshopsNew(string year, string month);
|
||||
AllReport GetAllActiveWorkshops(string year, string month);
|
||||
WorkshopResult GetWorkshopContractDone(string year, string month, long accountId);
|
||||
WorkshopResult GetWorkshopContractSignDone(string year, string month, long accountId);
|
||||
WorkshopResult GetWorkshopCheckoutDone(string year, string month, long accountId);
|
||||
WorkshopResult GetWorkshopCheckoutSignDone(string year, string month, long accountId);
|
||||
WorkshopResult GetWorkshopContractDone(string year, string month, long accountId, List<long> workshopList);
|
||||
WorkshopResult GetWorkshopContractSignDone(string year, string month, long accountId, List<long> workshopList);
|
||||
WorkshopResult GetWorkshopCheckoutDone(string year, string month, long accountId, List<long> workshopList);
|
||||
WorkshopResult GetWorkshopCheckoutSignDone(string year, string month, long accountId, List<long> workshopList);
|
||||
List<EmployeeNotDone> GetEmployeeContract(string year, string month, long workshopId);
|
||||
List<EmployeeNotDone> GetEmployeeContractSign(string year, string month, long workshopId);
|
||||
List<EmployeeNotDone> GetEmployeeCheckout(string year, string month, long workshopId);
|
||||
|
||||
@@ -481,21 +481,25 @@ namespace Company.Domain.RollCallAgg
|
||||
internal void SetEarlyEnter(TimeSpan earlyEntryDuration)
|
||||
{
|
||||
EarlyEntryDuration = earlyEntryDuration;
|
||||
LateEntryDuration = TimeSpan.Zero;
|
||||
}
|
||||
|
||||
internal void SetLateEnter(TimeSpan lateEntryDuration)
|
||||
{
|
||||
LateEntryDuration = lateEntryDuration;
|
||||
EarlyEntryDuration = TimeSpan.Zero;
|
||||
}
|
||||
|
||||
internal void SetEarlyExit(TimeSpan earlyExit)
|
||||
{
|
||||
EarlyExitDuration = earlyExit;
|
||||
LateExitDuration = TimeSpan.Zero;
|
||||
}
|
||||
|
||||
internal void SetLateExit(TimeSpan lateExitDuration)
|
||||
{
|
||||
LateExitDuration = lateExitDuration;
|
||||
EarlyExitDuration = TimeSpan.Zero;
|
||||
}
|
||||
|
||||
public void setStartAndEnd(DateTime start, DateTime end, IRollCallDomainService service)
|
||||
|
||||
@@ -7,6 +7,8 @@ public class AccountResults
|
||||
public long AccountId { get; set; }
|
||||
public string AccountFullName { get; set; }
|
||||
|
||||
public List<long> WorkshopList { get; set; }
|
||||
|
||||
//public int ContractToBe { get; set; }
|
||||
//public int CheckoutoBe { get; set; }
|
||||
|
||||
|
||||
@@ -8,12 +8,12 @@ namespace CompanyManagment.App.Contracts.Report
|
||||
{
|
||||
public interface IReportApplication
|
||||
{
|
||||
AllReport GetAllActiveWorkshops(string year, string month);
|
||||
AllReport GetAllReports(string year, string month);
|
||||
WorkshopResult GetWorkshopContractDone(string year, string month, long accountId);
|
||||
WorkshopResult GetWorkshopContractSignDone(string year, string month, long accountId);
|
||||
WorkshopResult GetWorkshopCheckoutDone(string year, string month, long accountId);
|
||||
WorkshopResult GetWorkshopCheckoutSignDone(string year, string month, long accountId);
|
||||
Task<AllReport> GetAllActiveWorkshops(string year, string month);
|
||||
Task<AllReport> GetAllReports(string year, string month);
|
||||
WorkshopResult GetWorkshopContractDone(string year, string month, long accountId, List<long> workshopList);
|
||||
WorkshopResult GetWorkshopContractSignDone(string year, string month, long accountId, List<long> workshopList);
|
||||
WorkshopResult GetWorkshopCheckoutDone(string year, string month, long accountId, List<long> workshopList);
|
||||
WorkshopResult GetWorkshopCheckoutSignDone(string year, string month, long accountId, List<long> workshopList);
|
||||
List<EmployeeNotDone> GetEmployeeContract(string year, string month, long workshopId);
|
||||
List<EmployeeNotDone> GetEmployeeContractSign(string year, string month, long workshopId);
|
||||
List<EmployeeNotDone> GetEmployeeCheckout(string year, string month, long workshopId);
|
||||
|
||||
@@ -18,35 +18,35 @@ public class ReportApplication : IReportApplication
|
||||
_reportRepository = reportRepository;
|
||||
}
|
||||
|
||||
public AllReport GetAllActiveWorkshops(string year, string month)
|
||||
public async Task<AllReport> GetAllActiveWorkshops(string year, string month)
|
||||
{
|
||||
return _reportRepository.GetAllActiveWorkshops(year, month);
|
||||
return await _reportRepository.GetAllActiveWorkshopsNew(year, month);
|
||||
}
|
||||
|
||||
public AllReport GetAllReports(string year, string month)
|
||||
public async Task<AllReport> GetAllReports(string year, string month)
|
||||
{
|
||||
|
||||
return _reportRepository.GetAllActiveWorkshops(year, month);
|
||||
return await _reportRepository.GetAllActiveWorkshopsNew(year, month);
|
||||
}
|
||||
|
||||
public WorkshopResult GetWorkshopContractDone(string year, string month, long accountId)
|
||||
public WorkshopResult GetWorkshopContractDone(string year, string month, long accountId, List<long> workshopList)
|
||||
{
|
||||
return _reportRepository.GetWorkshopContractDone(year, month, accountId);
|
||||
return _reportRepository.GetWorkshopContractDone(year, month, accountId, workshopList);
|
||||
}
|
||||
|
||||
public WorkshopResult GetWorkshopContractSignDone(string year, string month, long accountId)
|
||||
public WorkshopResult GetWorkshopContractSignDone(string year, string month, long accountId, List<long> workshopList)
|
||||
{
|
||||
return _reportRepository.GetWorkshopContractSignDone(year, month, accountId);
|
||||
return _reportRepository.GetWorkshopContractSignDone(year, month, accountId, workshopList);
|
||||
}
|
||||
|
||||
public WorkshopResult GetWorkshopCheckoutDone(string year, string month, long accountId)
|
||||
public WorkshopResult GetWorkshopCheckoutDone(string year, string month, long accountId, List<long> workshopList)
|
||||
{
|
||||
return _reportRepository.GetWorkshopCheckoutDone(year, month, accountId);
|
||||
return _reportRepository.GetWorkshopCheckoutDone(year, month, accountId, workshopList);
|
||||
}
|
||||
|
||||
public WorkshopResult GetWorkshopCheckoutSignDone(string year, string month, long accountId)
|
||||
public WorkshopResult GetWorkshopCheckoutSignDone(string year, string month, long accountId, List<long> workshopList)
|
||||
{
|
||||
return _reportRepository.GetWorkshopCheckoutSignDone(year, month, accountId);
|
||||
return _reportRepository.GetWorkshopCheckoutSignDone(year, month, accountId, workshopList);
|
||||
}
|
||||
|
||||
public List<EmployeeNotDone> GetEmployeeContract(string year, string month, long workshopId)
|
||||
|
||||
@@ -308,7 +308,8 @@ namespace CompanyManagment.EFCore.Repository
|
||||
SalaryAidDateTimeGe = s.SalaryAidDateTime
|
||||
}).ToList(),
|
||||
|
||||
LateToWorkValue = x.LateToWorkValue == TimeSpan.Zero ? "-" : $"{(int)x.LateToWorkValue.TotalHours}:{x.LateToWorkValue.Minutes:D2}"
|
||||
//LateToWorkValue = x.LateToWorkValue == TimeSpan.Zero ? "-" : $"{(int)x.LateToWorkValue.TotalHours}:{x.LateToWorkValue.Minutes:D2}"
|
||||
LateToWorkValue = x.LateToWorkValue == TimeSpan.Zero ? "-" : $"{Convert.ToInt32(x.LateToWorkValue.TotalHours)}:{Convert.ToInt32(x.LateToWorkValue.TotalMinutes % 60):00}"
|
||||
|
||||
}).ToList();
|
||||
List<WorkshopViewModel> workshopsList = workshopsQuery.Select(x => new WorkshopViewModel
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using _0_Framework.Application;
|
||||
using AccountMangement.Infrastructure.EFCore;
|
||||
using Company.Domain.ReportAgg;
|
||||
@@ -23,9 +24,98 @@ public class ReportRepository : IReportRepository
|
||||
_accountContext = accountContext;
|
||||
}
|
||||
|
||||
//public AllReport getAll(string year, string month)
|
||||
//{
|
||||
|
||||
// var watch = System.Diagnostics.Stopwatch.StartNew();
|
||||
// //یافتن آغاز و پایان ماه جاری
|
||||
// //یافتن آغاز و پایان ماه بعد
|
||||
// #region FindMonthStartAndEnd
|
||||
|
||||
public AllReport GetAllActiveWorkshopsNew(string year, string month)
|
||||
// string nowFa = $"{(DateTime.Now.ToFarsi()).Substring(0, 8)}01";
|
||||
|
||||
// if (!string.IsNullOrWhiteSpace(year) && !string.IsNullOrWhiteSpace(month))
|
||||
// nowFa = $"{year}/{month}/01";
|
||||
|
||||
|
||||
// var currentEndOfMonth = nowFa.FindeEndOfMonth();
|
||||
|
||||
// //شروع ماه جاری
|
||||
// var currentMonthStart = nowFa.ToGeorgianDateTime();
|
||||
// // پایان کاه جاری
|
||||
// var currentMonthEnd = currentEndOfMonth.ToGeorgianDateTime();
|
||||
|
||||
|
||||
|
||||
// int currentYear = Convert.ToInt32(nowFa.Substring(0, 4));
|
||||
// var currentMonth = Convert.ToInt32(nowFa.Substring(5, 2));
|
||||
// var nextMonthStartFa = new PersianDateTime(currentYear, currentMonth, 1).AddMonths(1);
|
||||
|
||||
// //شروع ماه بعد
|
||||
// var nextMonthStart = ($"{nextMonthStartFa}").ToGeorgianDateTime();
|
||||
// //پایان ماه بعد
|
||||
// var nextMonthEnd = (($"{nextMonthStartFa}").FindeEndOfMonth()).ToGeorgianDateTime();
|
||||
|
||||
|
||||
// #endregion
|
||||
|
||||
// // کاهش درخواستهای تکراری به پایگاه داده
|
||||
// var checkoutAccountLeftWorks = _accountContext.AccountLeftWorks
|
||||
// .Where(x => x.RoleId == 5 && x.StartWorkGr < currentMonthEnd && x.LeftWorkGr > currentMonthStart)
|
||||
// .Select(x => new { x.WorkshopId, x.AccountId }).ToList();
|
||||
|
||||
// var allCheckoutAccountLeftWorkWorkshopIds = checkoutAccountLeftWorks.Select(x => x.WorkshopId).Distinct().ToList();
|
||||
|
||||
// var checkoutWorkshopEmployer = _context.WorkshopEmployers
|
||||
// .Where(x => allCheckoutAccountLeftWorkWorkshopIds.Contains(x.WorkshopId))
|
||||
// .Include(x => x.Employer.ContractingParty)
|
||||
// .Where(x => x.Employer.ContractingParty.IsBlock != "true" && x.Employer.ContractingParty.IsActiveString == "true" && x.Workshop.IsActiveString == "true")
|
||||
// .ToList();
|
||||
|
||||
// var checkoutWithOutInstitutionContract = checkoutWorkshopEmployer
|
||||
// .Where(x => x.Employer.ContractingPartyId == 30428)
|
||||
// .Select(x => x.WorkshopId)
|
||||
// .ToList();
|
||||
|
||||
// var checkoutFindHasInstitutionContract = _context.InstitutionContractSet
|
||||
// .Where(c => c.ContractStartGr <= currentMonthStart && c.ContractEndGr >= currentMonthEnd)
|
||||
// .Select(c => c.ContractingPartyId)
|
||||
// .ToHashSet();
|
||||
|
||||
// var checkoutWithInstitutionContract = checkoutWorkshopEmployer
|
||||
// .Where(x => x.Employer.ContractingPartyId != 30428 && checkoutFindHasInstitutionContract.Contains(x.Employer.ContractingPartyId))
|
||||
// .Select(x => x.WorkshopId)
|
||||
// .Distinct()
|
||||
// .ToList();
|
||||
|
||||
// var checkoutMixWitAndWitOut = checkoutWithInstitutionContract.Concat(checkoutWithOutInstitutionContract).Distinct().ToList();
|
||||
|
||||
// var allCheckoutLeftworks = _context.LeftWorkList
|
||||
// .Where(x => checkoutMixWitAndWitOut.Contains(x.WorkshopId) && x.StartWorkDate <= currentMonthEnd && x.LeftWorkDate > currentMonthStart)
|
||||
// .Select(x => x.EmployeeId)
|
||||
// .ToHashSet();
|
||||
|
||||
// var allCheckoutCreated = _context.CheckoutSet
|
||||
// .Where(x => allCheckoutLeftworks.Contains(x.EmployeeId) && x.ContractStart.Date >= currentMonthStart.Date && x.ContractEnd.Date <= currentMonthEnd.Date && x.IsActiveString == "true")
|
||||
// .ToList();
|
||||
|
||||
// var allCheckoutSigned = allCheckoutCreated.Count(x => x.Signature == "1");
|
||||
|
||||
// // بهینهسازی و کاهش پردازشهای اضافی
|
||||
// var checkoutPercent = allCheckoutLeftworks.Count > 0 ? (allCheckoutCreated.Count * 100) / allCheckoutLeftworks.Count : 0;
|
||||
// var checkoutSignaturePercent = allCheckoutCreated.Count > 0 ? (allCheckoutSigned * 100) / allCheckoutCreated.Count : 0;
|
||||
|
||||
// return new AllReport
|
||||
// {
|
||||
// CheckoutPercent = checkoutPercent,
|
||||
// CheckoutSignaturePercent = checkoutSignaturePercent,
|
||||
// // سایر فیلدهای موردنیاز
|
||||
// };
|
||||
|
||||
//}
|
||||
public async Task<AllReport> GetAllActiveWorkshopsNew(string year, string month)
|
||||
{
|
||||
var watch = System.Diagnostics.Stopwatch.StartNew();
|
||||
//یافتن آغاز و پایان ماه جاری
|
||||
//یافتن آغاز و پایان ماه بعد
|
||||
#region FindMonthStartAndEnd
|
||||
@@ -61,106 +151,361 @@ public class ReportRepository : IReportRepository
|
||||
|
||||
|
||||
//var allLeft = _context.LeftWorkList
|
||||
// .Include(x => x.Workshop)
|
||||
// .Count(x =>
|
||||
// x.StartWorkDate < currentMonthEnd && x.LeftWorkDate > currentMonthStart);
|
||||
|
||||
|
||||
//Console.ForegroundColor = ConsoleColor.Magenta;
|
||||
//Console.WriteLine("All Persoennel Active : " + allLeft);
|
||||
|
||||
//var leftsDeActive = _context.LeftWorkList
|
||||
// .Include(x => x.Workshop)
|
||||
// .Where(x => x.Workshop.IsActiveString != "true")
|
||||
// .Where(x =>
|
||||
// x.StartWorkDate < currentMonthEnd && x.LeftWorkDate > currentMonthStart);
|
||||
//Console.ForegroundColor = ConsoleColor.Red;
|
||||
//Console.WriteLine("DeActive Workshop : " + leftsDeActive.Count());
|
||||
|
||||
//var ActiveWorkshop = _context.LeftWorkList
|
||||
// .Include(x => x.Workshop)
|
||||
// .Where(x => x.Workshop.IsActiveString == "true")
|
||||
// .Where(x =>
|
||||
// x.StartWorkDate < currentMonthEnd && x.LeftWorkDate > currentMonthStart);
|
||||
//Console.ForegroundColor = ConsoleColor.Green;
|
||||
//Console.WriteLine("Active Workshop : " + ActiveWorkshop.Count());
|
||||
|
||||
|
||||
//var leftsActiveContractingParties = _context.LeftWorkList
|
||||
// .Include(x => x.Workshop)
|
||||
// .Where(x => x.Workshop.IsActiveString == "true")
|
||||
// .Where(x =>
|
||||
// x.StartWorkDate < currentMonthEnd && x.LeftWorkDate > currentMonthStart)
|
||||
// .Join(_context.WorkshopEmployers,
|
||||
// left => left.WorkshopId,
|
||||
// workshopEmployer => workshopEmployer.WorkshopId,
|
||||
// (left, workshopEmployer) => new { left, workshopEmployer})
|
||||
// .Join(_context.PersonalContractingParties,
|
||||
// result => result.workshopEmployer.Employer.id,
|
||||
// contractingParties => contractingParties.Employers.FirstOrDefault()!.id,
|
||||
// (result, contractingParties) => new
|
||||
// {
|
||||
// result.left,
|
||||
// result.workshopEmployer,
|
||||
// contractingParties
|
||||
// }).Where(x=>x.contractingParties.IsBlock == "false" && x.contractingParties.IsActiveString == "true")
|
||||
|
||||
|
||||
// ;
|
||||
//Console.ForegroundColor = ConsoleColor.Green;
|
||||
//Console.WriteLine("Active Workshop Join contractingParties : " + leftsActiveContractingParties.Count());
|
||||
//var leftsAllContractingParties = _context.LeftWorkList
|
||||
// .Include(x => x.Workshop)
|
||||
// .Where(x => x.Workshop.IsActiveString == "true")
|
||||
// .Where(x =>
|
||||
// x.StartWorkDate < currentMonthEnd && x.LeftWorkDate > currentMonthStart)
|
||||
// .Join(_context.WorkshopEmployers,
|
||||
// left => left.WorkshopId,
|
||||
// workshopEmployer => workshopEmployer.WorkshopId,
|
||||
// (left, workshopEmployer) => new { left, workshopEmployer })
|
||||
// .Join(_context.PersonalContractingParties,
|
||||
// result => result.workshopEmployer.Employer.id,
|
||||
// contractingParties => contractingParties.Employers.FirstOrDefault()!.id,
|
||||
// (result, contractingParties) => new
|
||||
// {
|
||||
// result.left,
|
||||
// result.workshopEmployer,
|
||||
// contractingParties
|
||||
// }).Where(x => x.contractingParties.IsBlock == "true" || x.contractingParties.IsActiveString == "false");
|
||||
//var workshopListAc = leftsActiveContractingParties.Select(x => x.workshopEmployer.WorkshopId);
|
||||
//var workshopListAllDeActive = leftsAllContractingParties.Select(x => x.workshopEmployer.WorkshopId);
|
||||
|
||||
//var employeeActive = leftsActiveContractingParties.Select(x => x.left.EmployeeId);
|
||||
//var employeeDeActive = leftsAllContractingParties.Select(x => x.left.EmployeeId);
|
||||
//Console.ForegroundColor = ConsoleColor.Green;
|
||||
//Console.WriteLine("All Workshop Join contractingParties deActive : " + leftsAllContractingParties.Count());
|
||||
//var workshops = _context.Workshops
|
||||
// .Where(x => x.IsActiveString == "true")
|
||||
// .Include(x => x.LeftWorks.Where(l => l.StartWorkDate < currentMonthEnd && l.LeftWorkDate > currentMonthStart))
|
||||
// .ToList();
|
||||
//Console.ForegroundColor = ConsoleColor.Green;
|
||||
//Console.WriteLine("Active Workshop2 : " + workshops.Sum(x=>x.LeftWorks.Count));
|
||||
|
||||
var accountLeftWorks = _accountContext.AccountLeftWorks
|
||||
#region checkout
|
||||
//یاتن اکانتهای قراداد ساده
|
||||
var checkoutAccountLeftWorks = _accountContext.AccountLeftWorks
|
||||
.Where(x => x.RoleId == 5)
|
||||
.Where(x => x.StartWorkGr < currentMonthEnd && x.LeftWorkGr > currentMonthStart);
|
||||
|
||||
var allAccountLeftWorkWorkshopIds = accountLeftWorks.Select(x => x.WorkshopId).ToList();
|
||||
var allCheckoutAccountLeftWorkWorkshopIds = checkoutAccountLeftWorks.Select(x => x.WorkshopId).ToList();
|
||||
|
||||
var e = _context.WorkshopEmployers
|
||||
.Where(x => allAccountLeftWorkWorkshopIds.Contains(x.WorkshopId))
|
||||
//یافتن کارگاه هایی که فعال هستند و طرف حساب انها فعال است
|
||||
var checkoutWorkshopEmployer = _context.WorkshopEmployers
|
||||
.Where(x => allCheckoutAccountLeftWorkWorkshopIds.Contains(x.WorkshopId))
|
||||
.Include(x => x.Workshop)
|
||||
.Include(x => x.Employer)
|
||||
.ThenInclude(x => x.ContractingParty)
|
||||
.Where(c => c.Employer.ContractingParty.IsBlock !="true" && c.Employer.ContractingParty.IsActiveString == "true");
|
||||
.Where(x => x.Employer.ContractingParty.IsBlock != "true" && x.Employer.ContractingParty.IsActiveString == "true")
|
||||
.Where(x => x.Workshop.IsActiveString == "true");
|
||||
|
||||
Console.ForegroundColor = ConsoleColor.Green;
|
||||
Console.WriteLine("AccountLeftWork Count : " + allAccountLeftWorkWorkshopIds.Count());
|
||||
int i = 1;
|
||||
foreach (var item in e)
|
||||
//یافتن کارگاه های استثنا بدون قردادمالی
|
||||
var checkoutWithOutInstitutionContract = checkoutWorkshopEmployer.Where(x => x.Employer.ContractingPartyId == 30428)
|
||||
.GroupBy(x => x.Workshop).Select(x => x.Key.id);
|
||||
|
||||
//یافتن قردادمالی برای کارگاه های یافت شده در تاریخ مورد نظر
|
||||
var checkoutFindHasInstitutionContract = _context.InstitutionContractSet
|
||||
.Where(c => c.ContractStartGr <= currentMonthStart && c.ContractEndGr >= currentMonthEnd)
|
||||
.Select(c => c.ContractingPartyId);
|
||||
|
||||
//فیلتر کارگاه های غیر استثنا با کمک کوئری بالا
|
||||
var checkoutWithInstitutionContract = checkoutWorkshopEmployer.Where(x => x.Employer.ContractingPartyId != 30428 && checkoutFindHasInstitutionContract.Contains(x.Employer.ContractingPartyId)).GroupBy(x => x.WorkshopId).Select(x => x.Key);
|
||||
|
||||
|
||||
//ترکیب کارگاه های استثنا و دارای قراداد
|
||||
var checkoutMixWitAndWitOut = checkoutWithInstitutionContract.Concat(checkoutWithOutInstitutionContract);
|
||||
|
||||
|
||||
//تمام پرسنل فعال برای تصفیه حساب در ماه مورد نظر
|
||||
var allCheckoutLeftworks = _context.LeftWorkList
|
||||
.Where(x => checkoutMixWitAndWitOut.Contains(x.WorkshopId))
|
||||
.Where(x =>
|
||||
x.StartWorkDate <= currentMonthEnd && x.LeftWorkDate > currentMonthStart);
|
||||
|
||||
//تمام تصفیه حساب های ایجاد شده ماه مورد نظر
|
||||
var allCheckoutLeftworkEmployeeIds = allCheckoutLeftworks.Select(x => x.EmployeeId);
|
||||
var allCheckoutLeftworkWorkshopIds = allCheckoutLeftworks.Select(x => x.WorkshopId).ToList();
|
||||
var allCheckoutCreated = _context.CheckoutSet
|
||||
.Where(x => allCheckoutLeftworkEmployeeIds.Contains(x.EmployeeId))
|
||||
.Where(x =>
|
||||
x.ContractStart.Date >= currentMonthStart.Date && x.ContractEnd.Date <= currentMonthEnd.Date && x.IsActiveString == "true");
|
||||
|
||||
//تصفیه حساب هایی که امضاء شده
|
||||
var allCheckoutSigned = allCheckoutCreated.Count(x => x.Signature == "1");
|
||||
|
||||
#endregion
|
||||
|
||||
#region Contracts
|
||||
//یاتن اکانتهای قراداد ساده
|
||||
var contractsAccountLeftWorks = _accountContext.AccountLeftWorks
|
||||
.Where(x => x.RoleId == 5)
|
||||
.Where(x => x.StartWorkGr < nextMonthEnd && x.LeftWorkGr > nextMonthStart);
|
||||
|
||||
var allContractAccountLeftWorkWorkshopIds = contractsAccountLeftWorks.Select(x => x.WorkshopId).ToList();
|
||||
|
||||
//یافتن کارگاه هایی که فعال هستند و طرف حساب انها فعال است
|
||||
var contractWorkshopEmployer = _context.WorkshopEmployers
|
||||
.Where(x => allContractAccountLeftWorkWorkshopIds.Contains(x.WorkshopId))
|
||||
.Include(x => x.Workshop)
|
||||
.Include(x => x.Employer)
|
||||
.ThenInclude(x => x.ContractingParty)
|
||||
.Where(x => x.Employer.ContractingParty.IsBlock != "true" && x.Employer.ContractingParty.IsActiveString == "true")
|
||||
.Where(x => x.Workshop.IsActiveString == "true");
|
||||
|
||||
//یافتن کارگاه های استثنا بدون قردادمالی
|
||||
var contractWithOutInstitutionContract = contractWorkshopEmployer.Where(x => x.Employer.ContractingPartyId == 30428)
|
||||
.GroupBy(x => x.Workshop).Select(x => x.Key.id);
|
||||
|
||||
//یافتن قردادمالی برای کارگاه های یافت شده در تاریخ مورد نظر
|
||||
var contractFindHasInstitutionContract = _context.InstitutionContractSet
|
||||
.Where(c => c.ContractStartGr <= nextMonthStart && c.ContractEndGr >= nextMonthEnd)
|
||||
.Select(c => c.ContractingPartyId);
|
||||
|
||||
//فیلتر کارگاه های غیر استثنا با کمک کوئری بالا
|
||||
var contractWithInstitutionContract = contractWorkshopEmployer.Where(x => x.Employer.ContractingPartyId != 30428 && contractFindHasInstitutionContract.Contains(x.Employer.ContractingPartyId)).GroupBy(x => x.WorkshopId).Select(x => x.Key);
|
||||
|
||||
|
||||
//ترکیب کارگاه های استثنا و دارای قراداد
|
||||
var contractMixWitAndWitOut = contractWithInstitutionContract.Concat(contractWithOutInstitutionContract);
|
||||
|
||||
|
||||
//تمام پرسنل فعال برای قراداد در ماه مورد نظر
|
||||
var allContractLeftworks = _context.LeftWorkList
|
||||
.Where(x => contractMixWitAndWitOut.Contains(x.WorkshopId))
|
||||
.Where(x =>
|
||||
x.StartWorkDate <= nextMonthEnd && x.LeftWorkDate > nextMonthStart);
|
||||
|
||||
//تمام قرارداد های ایجاد شده ماه مورد نظر
|
||||
var allContractLeftworkEmployeeIds = allContractLeftworks.Select(x => x.EmployeeId);
|
||||
|
||||
var allContractCreated = _context.Contracts
|
||||
.Where(x => allContractLeftworkEmployeeIds.Contains(x.EmployeeId))
|
||||
.Where(x =>
|
||||
x.ContarctStart.Date <= nextMonthEnd.Date && x.ContractEnd.Date > nextMonthStart.Date && x.IsActiveString == "true");
|
||||
|
||||
//قرارداد هایی که امضاء شده
|
||||
var allContractSigned = allContractCreated.Count(x => x.Signature == "1");
|
||||
|
||||
#endregion
|
||||
|
||||
//قرارداد هایی که باید ایجاد می شد
|
||||
var contractToBe = allContractLeftworks.Count();
|
||||
|
||||
//قراردادهای ایجاد شده
|
||||
var createdContracts = allContractCreated.Count();
|
||||
// قراداد های امضاء شده
|
||||
var signedContracts = allContractSigned;
|
||||
|
||||
|
||||
// تصفیه هایی که باید ایجاد می شد
|
||||
var checkoutToBe = allCheckoutLeftworks.Count();
|
||||
|
||||
// تصفیه های ایجاد شده
|
||||
var createdCheckouts = allCheckoutCreated.Count();
|
||||
//تصفیه های امضاء شده
|
||||
var signedChckouts = allCheckoutSigned;
|
||||
|
||||
Console.WriteLine("contractsToBe : " + allContractLeftworks.Count());
|
||||
Console.WriteLine("contracts created: " + allContractCreated.Count());
|
||||
Console.WriteLine("contracts signed: " + allContractSigned);
|
||||
|
||||
|
||||
Console.WriteLine("checkoutsToBe : " + allCheckoutLeftworks.Count());
|
||||
Console.WriteLine("checkouts created: " + allCheckoutCreated.Count());
|
||||
Console.WriteLine("checkouts signed: " + allCheckoutSigned);
|
||||
|
||||
|
||||
|
||||
var accounts = _accountContext.Accounts.Where(x => x.RoleId == 5);
|
||||
var accountsDictionary = accounts.ToDictionary(a => a.id, a => a.Fullname);
|
||||
//var allCheckoutLeftworkWorkshopIdsHashSet = new HashSet<long>(allCheckoutLeftworkWorkshopIds);
|
||||
|
||||
|
||||
//#region checkoutAccounts
|
||||
|
||||
//var checkoutAccountGroup = checkoutAccountLeftWorks
|
||||
// .Where(x => allCheckoutLeftworkWorkshopIds.Contains(x.WorkshopId))
|
||||
// .GroupBy(x => x.AccountId)
|
||||
// .AsEnumerable()
|
||||
// .Select(grouped =>
|
||||
// {
|
||||
// var workshopList = grouped.Select(w => w.WorkshopId).ToList();
|
||||
// int checkoutToBe = allCheckoutLeftworks.Count(n => workshopList.Contains(n.WorkshopId));
|
||||
// int createdCheckouts = allCheckoutCreated.Count(n => workshopList.Contains(n.WorkshopId));
|
||||
// int signedCheckout = allCheckoutCreated.Count(n => workshopList.Contains(n.WorkshopId) && n.Signature == "1");
|
||||
|
||||
// if (checkoutToBe > 0)
|
||||
// {
|
||||
// return new AccountResults()
|
||||
// {
|
||||
// WorkshopList = workshopList,
|
||||
// AccountId = grouped.Key,
|
||||
// AccountFullName = accountsDictionary[grouped.Key],
|
||||
// CheckoutDonePercent = (createdCheckouts * 100) / checkoutToBe,
|
||||
// CheckoutSignPercent = createdCheckouts > 0 ? (signedCheckout * 100) / createdCheckouts : 0,
|
||||
// };
|
||||
// }
|
||||
|
||||
// return null;
|
||||
// })
|
||||
// .Where(result => result != null)
|
||||
// .ToList();
|
||||
|
||||
|
||||
//#endregion
|
||||
|
||||
//#region ContractAccounts
|
||||
|
||||
//var contractAccountGroup = contractsAccountLeftWorks
|
||||
// .Where(x => allContractAccountLeftWorkWorkshopIds.Contains(x.WorkshopId))
|
||||
// .GroupBy(x => x.AccountId)
|
||||
// .AsEnumerable()
|
||||
// .Select(grouped =>
|
||||
// {
|
||||
// var workshopList = grouped.Select(w => w.WorkshopId).ToList();
|
||||
// int contractToBe = allContractLeftworks.Count(n => workshopList.Contains(n.WorkshopId));
|
||||
// int createdContracts = allContractCreated.Count(n => workshopList.Contains(n.WorkshopIds));
|
||||
// int signedContracts = allContractCreated.Count(n => workshopList.Contains(n.WorkshopIds) && n.Signature == "1");
|
||||
|
||||
// if (contractToBe > 0)
|
||||
// {
|
||||
// return new AccountResults()
|
||||
// {
|
||||
// WorkshopList = workshopList,
|
||||
// AccountId = grouped.Key,
|
||||
// AccountFullName = accountsDictionary[grouped.Key],
|
||||
// ContractDonePercent = (createdContracts * 100) / contractToBe,
|
||||
// ContractSignPercent = createdContracts > 0 ? (signedContracts * 100) / createdContracts : 0,
|
||||
// };
|
||||
// }
|
||||
|
||||
// return null;
|
||||
// })
|
||||
// .Where(result => result != null)
|
||||
// .ToList();
|
||||
|
||||
//#endregion
|
||||
|
||||
|
||||
|
||||
#region checkoutAccounts
|
||||
|
||||
|
||||
var checkoutAccountGroup = checkoutAccountLeftWorks
|
||||
.Where(x => allCheckoutLeftworkWorkshopIds.Contains(x.WorkshopId))
|
||||
.GroupBy(x => x.AccountId).Select(x => new AccountResults()
|
||||
{
|
||||
AccountId = x.Key,
|
||||
AccountFullName = accounts.FirstOrDefault(a => a.id == x.Key)!.Fullname,
|
||||
WorkshopList = x.Select(w => w.WorkshopId).ToList()
|
||||
// CheckoutDonePercent = (x.Sum(c => c.) * 100) / x.Sum(c => c.CheckoutLeftWorkCount),
|
||||
//CheckoutSignPercent = x.Sum(c => c.CheckoutDoneCount) > 0 ? (x.Sum(c => c.CheckoutSignDoneCount) * 100) / (x.Sum(c => c.CheckoutDoneCount)) : 0,
|
||||
|
||||
}).AsEnumerable();
|
||||
|
||||
|
||||
var checkoutAccountGroupresult = checkoutAccountGroup.Select(grouped =>
|
||||
{
|
||||
Console.WriteLine(i + " - " + "isActive : " + item.Employer.ContractingParty.IsActiveString + " isBlock : " + item.Employer.ContractingParty.IsBlock + " workshopId : " + item.WorkshopId);
|
||||
i++;
|
||||
}
|
||||
return new();
|
||||
|
||||
int checkoutToBe = allCheckoutLeftworks.Count(n => grouped.WorkshopList.Contains(n.WorkshopId));
|
||||
int createdCheckouts = allCheckoutCreated.Count(n => grouped.WorkshopList.Contains(n.WorkshopId));
|
||||
int signedCheckout = allCheckoutCreated.Count(n => grouped.WorkshopList.Contains(n.WorkshopId) && n.Signature == "1");
|
||||
|
||||
if (checkoutToBe > 0)
|
||||
{
|
||||
return new AccountResults()
|
||||
{
|
||||
WorkshopList = grouped.WorkshopList,
|
||||
AccountId = grouped.AccountId,
|
||||
AccountFullName = grouped.AccountFullName,
|
||||
CheckoutDonePercent = (createdCheckouts * 100) / checkoutToBe,
|
||||
CheckoutSignPercent = createdCheckouts > 0 ? (signedCheckout * 100) / createdCheckouts : 0,
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
return new AccountResults()
|
||||
{
|
||||
AccountId = 0,
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
}).Where(x => x.AccountId > 0).ToList();
|
||||
#endregion
|
||||
|
||||
#region contractAccouns
|
||||
var contractAccountGroup = contractsAccountLeftWorks
|
||||
.Where(x => allContractAccountLeftWorkWorkshopIds.Contains(x.WorkshopId))
|
||||
.GroupBy(x => x.AccountId).Select(x => new AccountResults()
|
||||
{
|
||||
AccountId = x.Key,
|
||||
AccountFullName = accounts.FirstOrDefault(a => a.id == x.Key)!.Fullname,
|
||||
WorkshopList = x.Select(w => w.WorkshopId).ToList()
|
||||
|
||||
|
||||
}).AsEnumerable();
|
||||
|
||||
|
||||
var contractAccountGroupResult = contractAccountGroup.Select(grouped =>
|
||||
{
|
||||
|
||||
int contractToBe = allContractLeftworks.Count(n => grouped.WorkshopList.Contains(n.WorkshopId));
|
||||
int createdContracts = allContractCreated.Count(n => grouped.WorkshopList.Contains(n.WorkshopIds));
|
||||
int signedContracts = allContractCreated.Count(n => grouped.WorkshopList.Contains(n.WorkshopIds) && n.Signature == "1");
|
||||
if (contractToBe > 0)
|
||||
{
|
||||
return new AccountResults()
|
||||
{
|
||||
WorkshopList = grouped.WorkshopList,
|
||||
AccountId = grouped.AccountId,
|
||||
AccountFullName = grouped.AccountFullName,
|
||||
ContractDonePercent = (createdContracts * 100) / contractToBe,
|
||||
ContractSignPercent = createdContracts > 0 ? (signedContracts * 100) / createdContracts : 0,
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
return new AccountResults()
|
||||
{
|
||||
AccountId = 0,
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
}).Where(x => x.AccountId > 0).ToList();
|
||||
|
||||
//var contractGroupResult = contractAccountResult.GroupBy(x => x.AccountId).Select(x => new AccountResults()
|
||||
//{
|
||||
// AccountId = x.Key,
|
||||
// AccountFullName = _accountContext.Accounts.FirstOrDefault(a => a.id == x.Key)!.Fullname,
|
||||
|
||||
// ContractDonePercent = (x.Sum(c => c.ContrctDoneCount) * 100) / (x.Sum(c => c.ContractLeftWorkCount)),
|
||||
// ContractSignPercent = x.Sum(c => c.ContrctDoneCount) > 0 ? (x.Sum(c => c.ContrctSignDoneCount) * 100) / (x.Sum(c => c.ContrctDoneCount)) : 0,
|
||||
|
||||
|
||||
//}).ToList();
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
//قرارداد
|
||||
var contractPercent = (createdContracts * 100) / contractToBe;
|
||||
//امضاء قراداد
|
||||
var contractSignaturePercent = createdContracts > 0 ? (signedContracts * 100) / createdContracts : 0;
|
||||
// تصفیه
|
||||
var checkoutPercent = (createdCheckouts * 100) / checkoutToBe;
|
||||
// امضاء تصفیه حساب
|
||||
var checkoutSignaturePercent = createdCheckouts > 0 ? (signedChckouts * 100) / createdCheckouts : 0;
|
||||
var finalResult = new AllReport()
|
||||
{
|
||||
//همه
|
||||
AllPercent = (contractPercent + contractSignaturePercent + checkoutPercent + checkoutSignaturePercent) / 4,
|
||||
//قرارداد
|
||||
ContractPercent = contractPercent,
|
||||
//امضاء قراداد
|
||||
ContractSignaturePercent = contractSignaturePercent,
|
||||
// تصفیه
|
||||
CheckoutPercent = checkoutPercent,
|
||||
// امضاء تصفیه حساب
|
||||
CheckoutSignaturePercent = checkoutSignaturePercent,
|
||||
|
||||
Year = $"{currentYear}",
|
||||
Month = nowFa.Substring(5, 2),
|
||||
ContractAccountResults = checkoutAccountGroupresult,
|
||||
CheckoutAccountResults = contractAccountGroupResult,
|
||||
|
||||
AllContract = contractToBe,
|
||||
ContractNotDone = contractToBe - createdContracts,
|
||||
ContrcatDone = createdContracts,
|
||||
ContractSignNotDone = createdContracts - signedContracts,
|
||||
ContractSignDone = signedContracts,
|
||||
|
||||
|
||||
AllCheckout = checkoutToBe,
|
||||
CheckoutNotDone = checkoutToBe - createdCheckouts,
|
||||
CheckoutDone = createdCheckouts,
|
||||
CheckoutSignDone = signedChckouts,
|
||||
CheckoutSignNotDone = createdCheckouts - signedChckouts,
|
||||
|
||||
|
||||
};
|
||||
Console.WriteLine("new metod >>>>>: " + watch.Elapsed);
|
||||
return finalResult;
|
||||
}
|
||||
|
||||
public AllReport GetAllActiveWorkshops(string year, string month)
|
||||
@@ -434,7 +779,7 @@ public class ReportRepository : IReportRepository
|
||||
|
||||
}
|
||||
|
||||
public WorkshopResult GetWorkshopContractDone(string year, string month, long accountId)
|
||||
public WorkshopResult GetWorkshopContractDone(string year, string month, long accountId, List<long> workshopList)
|
||||
{
|
||||
var watch = System.Diagnostics.Stopwatch.StartNew();
|
||||
string nowFa = "";
|
||||
@@ -458,121 +803,133 @@ public class ReportRepository : IReportRepository
|
||||
var nextMonthEnd = (($"{nextMonthStartFa}").FindeEndOfMonth()).ToGeorgianDateTime();
|
||||
|
||||
|
||||
//var instititionContracts = _context.InstitutionContractSet.Where(x => x.IsActiveString == "true").Select(x => x.ContractingPartyId).ToList();
|
||||
var blockContractingPartyIds = _context.PersonalContractingParties.Where(x => x.IsBlock == "false" && x.IsActiveString == "true").Select(x => x.id).ToList();
|
||||
//blockContractingPartyIds = blockContractingPartyIds.Where(x => instititionContracts.Contains(x)).ToList();
|
||||
var workshops = _context.Workshops.Where(x => x.IsActiveString == "true")
|
||||
.Include(x => x.WorkshopEmployers)
|
||||
.Include(x => x.LeftWorks)
|
||||
.Select(x => new ActiveWorkshops
|
||||
|
||||
////var instititionContracts = _context.InstitutionContractSet.Where(x => x.IsActiveString == "true").Select(x => x.ContractingPartyId).ToList();
|
||||
//var blockContractingPartyIds = _context.PersonalContractingParties.Where(x => x.IsBlock == "false" && x.IsActiveString == "true").Select(x => x.id).ToList();
|
||||
////blockContractingPartyIds = blockContractingPartyIds.Where(x => instititionContracts.Contains(x)).ToList();
|
||||
//var workshops = _context.Workshops.Where(x => workshopList.Contains(x.id))
|
||||
// .Include(x => x.LeftWorks)
|
||||
// .Select(x => new ActiveWorkshops
|
||||
// {
|
||||
// Id = x.id,
|
||||
// IsActiveString = x.IsActiveString,
|
||||
// WorkshopFullName = x.WorkshopFullName,
|
||||
// ArchiveCode = x.ArchiveCode,
|
||||
|
||||
|
||||
|
||||
// #region Contracts
|
||||
|
||||
// //contractLeft This Mont
|
||||
|
||||
// ContractLeftIds = x.LeftWorks.Where(l =>
|
||||
// l.StartWorkDate <= nextMonthEnd && l.LeftWorkDate > nextMonthStart).Select(l => l.id).ToList(),
|
||||
// #endregion
|
||||
|
||||
|
||||
|
||||
// }).AsSplitQuery();
|
||||
|
||||
//var workshopsList = workshops.Select(x => new ActiveWorkshops
|
||||
//{
|
||||
// Id = x.Id,
|
||||
// WorkshopFullName = x.WorkshopFullName,
|
||||
// ArchiveCode = x.ArchiveCode,
|
||||
// ContractingPartId = x.ContractingPartId,
|
||||
// AccountIdList = x.AccountIdList,
|
||||
// #region Contracts
|
||||
|
||||
// //contractLeft This Month
|
||||
// ContractLeftIds = _context.InstitutionContractSet.Any(c => c.ContractingPartyId == x.ContractingPartId && c.ContractStartGr <= nextMonthStart && c.ContractEndGr >= nextMonthEnd) ? x.ContractLeftIds : new List<long>(),
|
||||
|
||||
// #endregion
|
||||
|
||||
|
||||
//}).ToList();
|
||||
|
||||
//var result = workshops.Select(x => new ActiveWorkshops
|
||||
//{
|
||||
// Id = x.Id,
|
||||
// ContractLeftWorkCount = x.ContractLeftIds.Count,
|
||||
// ContractLeftIds = x.ContractLeftIds,
|
||||
// WorkshopFullName = x.WorkshopFullName,
|
||||
// ArchiveCode = x.ArchiveCode,
|
||||
// ContrctDoneCount = x.ContractLeftIds.Count > 0 ? _context.Contracts.Count(c => x.ContractLeftIds.Contains(c.EmployerId) &&
|
||||
// c.ContarctStart.Date <= nextMonthEnd.Date && c.ContractEnd.Date > nextMonthStart.Date && c.IsActiveString == "true") : 0,
|
||||
|
||||
|
||||
//}).Where(x => x.ContractLeftWorkCount > 0).ToList();
|
||||
|
||||
#region NewChanges
|
||||
|
||||
//تمام پرسنل فعال برای قراداد در ماه مورد نظر
|
||||
var allContractLeftworks = _context.LeftWorkList
|
||||
.Where(x => workshopList.Contains(x.WorkshopId))
|
||||
.Where(x =>
|
||||
x.StartWorkDate <= nextMonthEnd && x.LeftWorkDate > nextMonthStart);
|
||||
|
||||
//تمام قرارداد های ایجاد شده ماه مورد نظر
|
||||
var allContractLeftworkEmployeeIds = allContractLeftworks.Select(x => x.EmployeeId);
|
||||
|
||||
|
||||
var allContractCreated = _context.Contracts
|
||||
.Where(x => allContractLeftworkEmployeeIds.Contains(x.EmployeeId))
|
||||
.Where(x =>
|
||||
x.ContarctStart.Date <= nextMonthEnd.Date && x.ContractEnd.Date > nextMonthStart.Date && x.IsActiveString == "true");
|
||||
|
||||
//قرارداد هایی که امضاء شده
|
||||
var allContractSigned = allContractCreated.Count(x => x.Signature == "1");
|
||||
Console.WriteLine("ajax 1 >>>>>: " + watch.Elapsed);
|
||||
var workshops = _context.Workshops.Where(x => workshopList.Contains(x.id)).ToList();
|
||||
var workshopListResult = workshops
|
||||
.Select(workshop =>
|
||||
{
|
||||
Id = x.id,
|
||||
IsActiveString = x.IsActiveString,
|
||||
WorkshopFullName = x.WorkshopFullName,
|
||||
ArchiveCode = x.ArchiveCode,
|
||||
ContractingPartId = x.WorkshopEmployers.Select(e => e.Employer.ContractingPartyId).FirstOrDefault(),
|
||||
AccountIdList = _context.WorkshopAccounts.Where(m => m.WorkshopId == x.id).Select(a => a.AccountId)
|
||||
.ToList(),
|
||||
|
||||
|
||||
#region Contracts
|
||||
|
||||
//contractLeft This Mont
|
||||
|
||||
ContractLeftIds = x.LeftWorks.Select(l => new LeftWorkViewModel()
|
||||
var contractToBe = allContractLeftworks.Count(x => x.WorkshopId == workshop.id);
|
||||
var contractCreated = allContractCreated.Count(x => x.WorkshopIds == workshop.id);
|
||||
if (contractToBe > 0)
|
||||
{
|
||||
EmployeeId = l.EmployeeId,
|
||||
StartWorkDateGr = l.StartWorkDate,
|
||||
LeftWorkDateGr = l.LeftWorkDate.AddDays(-1),
|
||||
|
||||
}).Where(l =>
|
||||
(l.StartWorkDateGr <= nextMonthStart && l.LeftWorkDateGr > nextMonthStart) ||
|
||||
(l.StartWorkDateGr <= nextMonthEnd && l.LeftWorkDateGr >= nextMonthEnd) ||
|
||||
(l.StartWorkDateGr >= nextMonthStart && l.StartWorkDateGr <= nextMonthEnd) ||
|
||||
(l.LeftWorkDateGr >= nextMonthStart && l.LeftWorkDateGr <= nextMonthEnd)).Select(l => l.EmployeeId).ToList(),
|
||||
#endregion
|
||||
return new workshopSearch()
|
||||
{
|
||||
Id = workshop.id,
|
||||
WorkshopFullName = workshop.WorkshopFullName,
|
||||
ArchiveCode = workshop.ArchiveCode,
|
||||
ContractDonePercent = ((contractCreated * 100) / contractToBe),
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
})
|
||||
.Where(x => x != null)
|
||||
.OrderBy(x => x.ContractDonePercent)
|
||||
.ToList(); // تبدیل به لیست
|
||||
|
||||
|
||||
|
||||
}).Where(e => blockContractingPartyIds.Contains(e.ContractingPartId))
|
||||
.Where(a => a.AccountIdList.Contains(accountId)).AsSplitQuery();
|
||||
|
||||
var workshopsList = workshops.Select(x => new ActiveWorkshops
|
||||
{
|
||||
Id = x.Id,
|
||||
WorkshopFullName = x.WorkshopFullName,
|
||||
ArchiveCode = x.ArchiveCode,
|
||||
ContractingPartId = x.ContractingPartId,
|
||||
AccountIdList = x.AccountIdList,
|
||||
#region Contracts
|
||||
|
||||
//contractLeft This Month
|
||||
ContractLeftIds = _context.InstitutionContractSet.Any(c => c.ContractingPartyId == x.ContractingPartId && c.ContractStartGr <= nextMonthStart && c.ContractEndGr >= nextMonthEnd) ? x.ContractLeftIds : new List<long>(),
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
}).ToList();
|
||||
|
||||
var result = workshopsList.Select(x => new ActiveWorkshops
|
||||
{
|
||||
Id = x.Id,
|
||||
ContractLeftWorkCount = x.ContractLeftIds.Count,
|
||||
WorkshopFullName = x.WorkshopFullName,
|
||||
ArchiveCode = x.ArchiveCode,
|
||||
ContrctDoneCount = x.ContractLeftIds.Count > 0 ? _context.Contracts.Where(ct => ct.WorkshopIds == x.Id && ct.IsActiveString == "true").Where(ct => x.ContractLeftIds.Contains(ct.EmployeeId))
|
||||
.Count(l => (l.ContarctStart <= nextMonthStart && l.ContractEnd >= nextMonthStart) ||
|
||||
(l.ContarctStart <= nextMonthEnd && l.ContractEnd >= nextMonthEnd) ||
|
||||
(l.ContarctStart >= nextMonthStart && l.ContarctStart <= nextMonthEnd) ||
|
||||
(l.ContractEnd >= nextMonthStart && l.ContractEnd <= nextMonthEnd)) : 0,
|
||||
|
||||
|
||||
}).Where(x=>x.ContractLeftWorkCount > 0).ToList();
|
||||
var workshopList = result.Select(x => new workshopSearch()
|
||||
{
|
||||
Id = x.Id,
|
||||
WorkshopFullName = x.WorkshopFullName,
|
||||
ArchiveCode = x.ArchiveCode,
|
||||
ContractDonePercent = ((x.ContrctDoneCount * 100) / x.ContractLeftWorkCount),
|
||||
|
||||
}).OrderBy(x => x.ContractDonePercent).ToList();
|
||||
|
||||
var badWorkshop = workshopList.FirstOrDefault();
|
||||
var badWorkshopLeftWorks = _context.LeftWorkList.Where(l => l.WorkshopId == badWorkshop.Id).Select(l => new LeftWorkViewModel()
|
||||
{
|
||||
Id = l.id,
|
||||
EmployeeId = l.EmployeeId,
|
||||
EmployeeFullName = l.EmployeeFullName,
|
||||
StartWorkDateGr = l.StartWorkDate,
|
||||
LeftWorkDateGr = l.LeftWorkDate.AddDays(-1),
|
||||
|
||||
}).Where(l =>
|
||||
(l.StartWorkDateGr <= nextMonthStart && l.LeftWorkDateGr > nextMonthStart) ||
|
||||
(l.StartWorkDateGr <= nextMonthEnd && l.LeftWorkDateGr >= nextMonthEnd) ||
|
||||
(l.StartWorkDateGr >= nextMonthStart && l.StartWorkDateGr <= nextMonthEnd) ||
|
||||
(l.LeftWorkDateGr >= nextMonthStart && l.LeftWorkDateGr <= nextMonthEnd)).ToList();
|
||||
var badWorkshopContracts = _context.Contracts.Where(ct => ct.WorkshopIds == badWorkshop.Id && ct.IsActiveString == "true")
|
||||
.Where(l => (l.ContarctStart <= nextMonthStart && l.ContractEnd >= nextMonthStart) ||
|
||||
(l.ContarctStart <= nextMonthEnd && l.ContractEnd >= nextMonthEnd) ||
|
||||
(l.ContarctStart >= nextMonthStart && l.ContarctStart <= nextMonthEnd) ||
|
||||
(l.ContractEnd >= nextMonthStart && l.ContractEnd <= nextMonthEnd)).Select(x => x.EmployeeId).ToList();
|
||||
var notDoneEmployes = badWorkshopLeftWorks.Select(l => new EmployeeNotDone()
|
||||
var badWorkshop = workshopListResult.FirstOrDefault();
|
||||
var badWorkshopTobe = allContractLeftworks.Where(x => x.WorkshopId == badWorkshop.Id);
|
||||
var badWorkshopCreated = allContractCreated.Where(x => x.WorkshopIds == badWorkshop.Id).Select(x => x.EmployeeId);
|
||||
var notDoneEmployes = badWorkshopTobe.Select(l => new EmployeeNotDone()
|
||||
{
|
||||
Id = l.EmployeeId,
|
||||
EmployeeFullName = l.EmployeeFullName,
|
||||
|
||||
}).Where(l => !badWorkshopContracts.Contains(l.Id)).ToList();
|
||||
}).Where(l => !badWorkshopCreated.Contains(l.Id)).ToList();
|
||||
|
||||
var finalResult = new WorkshopResult()
|
||||
{
|
||||
WorkshopSearches = workshopList,
|
||||
WorkshopSearches = workshopListResult,
|
||||
EmployeeNotDones = notDoneEmployes,
|
||||
};
|
||||
Console.WriteLine("ajax >>>>>: " + watch.Elapsed);
|
||||
Console.WriteLine("ajax 2 >>>>>: " + watch.Elapsed);
|
||||
|
||||
#endregion
|
||||
|
||||
return finalResult;
|
||||
}
|
||||
|
||||
public WorkshopResult GetWorkshopContractSignDone(string year, string month, long accountId)
|
||||
public WorkshopResult GetWorkshopContractSignDone(string year, string month, long accountId,
|
||||
List<long> workshopList1)
|
||||
{
|
||||
var watch = System.Diagnostics.Stopwatch.StartNew();
|
||||
string nowFa = "";
|
||||
@@ -711,7 +1068,7 @@ public class ReportRepository : IReportRepository
|
||||
return finalResult;
|
||||
}
|
||||
|
||||
public WorkshopResult GetWorkshopCheckoutDone(string year, string month, long accountId)
|
||||
public WorkshopResult GetWorkshopCheckoutDone(string year, string month, long accountId, List<long> workshopList1)
|
||||
{
|
||||
var watch = System.Diagnostics.Stopwatch.StartNew();
|
||||
string nowFa = "";
|
||||
@@ -844,7 +1201,8 @@ public class ReportRepository : IReportRepository
|
||||
return finalResult;
|
||||
}
|
||||
|
||||
public WorkshopResult GetWorkshopCheckoutSignDone(string year, string month, long accountId)
|
||||
public WorkshopResult GetWorkshopCheckoutSignDone(string year, string month, long accountId,
|
||||
List<long> workshopList1)
|
||||
{
|
||||
var watch = System.Diagnostics.Stopwatch.StartNew();
|
||||
string nowFa = "";
|
||||
|
||||
@@ -384,14 +384,16 @@
|
||||
{
|
||||
if (firstItem1)
|
||||
{
|
||||
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
ajaxContractDone(@personnel.AccountId, '@personnel.AccountFullName');
|
||||
var workshopList = @Html.Raw(Json.Serialize(personnel.WorkshopList));
|
||||
ajaxContractDone(@personnel.AccountId, '@personnel.AccountFullName', workshopList);
|
||||
});
|
||||
</script>
|
||||
}
|
||||
|
||||
<div id="ContractDonePercentDiv" class="d-flex align-items-center m-1 select @(firstItem1 ? "active" : "") ContractDonePercent activeBtn" onclick="ajaxContractDone(@personnel.AccountId, '@personnel.AccountFullName')">
|
||||
|
||||
<div id="ContractDonePercentDiv" class="d-flex align-items-center m-1 select @(firstItem1 ? "active" : "") ContractDonePercent activeBtn" onclick="ajaxContractDone(@personnel.AccountId, '@personnel.AccountFullName', @Html.Raw(Json.Serialize(personnel.WorkshopList)))">
|
||||
<div class="col-xs-4">
|
||||
<div class="title-name">
|
||||
<div class="scrolltext text-container">
|
||||
@@ -940,7 +942,7 @@
|
||||
});
|
||||
|
||||
// workshopFirstLoad
|
||||
function ajaxContractDone(accountId, accountFullName) {
|
||||
function ajaxContractDone(accountId, accountFullName, workshopList) {
|
||||
$('#workshopListMobileSection').html('');
|
||||
$('#appendTableWorkshop').html('');
|
||||
$('#loading').show();
|
||||
@@ -950,7 +952,8 @@
|
||||
dataType: 'json',
|
||||
url: '@Url.Page("/Company/Reports/Index", "WorkshopContractDone")',
|
||||
type: 'GET',
|
||||
data: { "year": $('#selectYear').val(), "month": $('#selectMonth').val(), "accountId": Number(accountId) },
|
||||
data: { "year": $('#selectYear').val(), "month": $('#selectMonth').val(), "accountId": Number(accountId), "workshopList" : workshopList},
|
||||
traditional: true,
|
||||
headers: { "RequestVerificationToken": $('input[name="__RequestVerificationToken"]').val() },
|
||||
success: function(response) {
|
||||
if (response.success) {
|
||||
|
||||
@@ -50,10 +50,10 @@ public class IndexModel : PageModel
|
||||
public int CheckoutSignNotDone { get; set; }
|
||||
public int CheckoutSignDone { get; set; }
|
||||
|
||||
public void OnGet(string year, string month)
|
||||
public async Task OnGet(string year, string month)
|
||||
{
|
||||
YearlyList = _yearlySalaryApplication.GetYears();
|
||||
var allReports = _reportApplication.GetAllReports(year, month);
|
||||
var allReports = await _reportApplication.GetAllReports(year, month);
|
||||
AllPercent = allReports.AllPercent;
|
||||
ContractPercent = allReports.ContractPercent;
|
||||
ContractSignaturePercent = allReports.ContractSignaturePercent;
|
||||
@@ -78,13 +78,14 @@ public class IndexModel : PageModel
|
||||
CheckoutDone = allReports.CheckoutDone;
|
||||
CheckoutSignNotDone = allReports.CheckoutSignNotDone;
|
||||
CheckoutSignDone = allReports.CheckoutSignDone;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#region workshopFirstLoad
|
||||
|
||||
public IActionResult OnGetWorkshopContractDone(string year, string month, long accountId)
|
||||
public IActionResult OnGetWorkshopContractDone(string year, string month, long accountId, List<long> workshopList)
|
||||
{
|
||||
var res = _reportApplication.GetWorkshopContractDone(year, month, accountId);
|
||||
var res = _reportApplication.GetWorkshopContractDone(year, month, accountId, workshopList);
|
||||
return new JsonResult(new
|
||||
{
|
||||
success = true,
|
||||
@@ -93,9 +94,9 @@ public class IndexModel : PageModel
|
||||
});
|
||||
}
|
||||
|
||||
public IActionResult OnGetWorkshopContractSignDone(string year, string month, long accountId)
|
||||
public IActionResult OnGetWorkshopContractSignDone(string year, string month, long accountId, List<long> workshopList)
|
||||
{
|
||||
var res = _reportApplication.GetWorkshopContractSignDone(year, month, accountId);
|
||||
var res = _reportApplication.GetWorkshopContractSignDone(year, month, accountId, workshopList);
|
||||
return new JsonResult(new
|
||||
{
|
||||
success = true,
|
||||
@@ -104,9 +105,9 @@ public class IndexModel : PageModel
|
||||
});
|
||||
}
|
||||
|
||||
public IActionResult OnGetWorkshopCheckoutDone(string year, string month, long accountId)
|
||||
public IActionResult OnGetWorkshopCheckoutDone(string year, string month, long accountId, List<long> workshopList)
|
||||
{
|
||||
var res = _reportApplication.GetWorkshopCheckoutDone(year, month, accountId);
|
||||
var res = _reportApplication.GetWorkshopCheckoutDone(year, month, accountId, workshopList);
|
||||
return new JsonResult(new
|
||||
{
|
||||
success = true,
|
||||
@@ -115,9 +116,9 @@ public class IndexModel : PageModel
|
||||
});
|
||||
}
|
||||
|
||||
public IActionResult OnGetWorkshopCheckoutSignDone(string year, string month, long accountId)
|
||||
public IActionResult OnGetWorkshopCheckoutSignDone(string year, string month, long accountId, List<long> workshopList)
|
||||
{
|
||||
var res = _reportApplication.GetWorkshopCheckoutSignDone(year, month, accountId);
|
||||
var res = _reportApplication.GetWorkshopCheckoutSignDone(year, month, accountId, workshopList);
|
||||
return new JsonResult(new
|
||||
{
|
||||
success = true,
|
||||
|
||||
@@ -84,9 +84,9 @@ namespace ServiceHost.Areas.Admin.Pages
|
||||
//}
|
||||
}
|
||||
|
||||
public IActionResult OnGetReportDataAjax()
|
||||
public async Task<IActionResult> OnGetReportDataAjax()
|
||||
{
|
||||
var allReports = _reportApplication.GetAllReports(null, null);
|
||||
var allReports = await _reportApplication.GetAllReports(null, null);
|
||||
var now = new PersianDateTime(Convert.ToInt32(allReports.Year), Convert.ToInt32(allReports.Month), 1);
|
||||
var before = now.AddMonths(1);
|
||||
|
||||
|
||||
@@ -18,69 +18,73 @@
|
||||
|
||||
|
||||
@section Styles {
|
||||
<link href="~/AssetsClient/css/table-style.css?ver=@clientVersion" rel="stylesheet" />
|
||||
<link href="~/AssetsClient/css/table-responsive.css?ver=@clientVersion" rel="stylesheet" />
|
||||
<link href="~/AssetsClient/css/datetimepicker.css?ver=@clientVersion" rel="stylesheet" />
|
||||
<link href="~/AssetsClient/css/dropdown.css?ver=@clientVersion" rel="stylesheet" />
|
||||
<link href="~/AssetsClient/css/filter-search.css?ver=@clientVersion" rel="stylesheet" />
|
||||
<link href="~/assetsclient/css/operation-button.css?ver=@clientVersion" rel="stylesheet" />
|
||||
<link href="~/AssetsClient/css/select2.css?ver=@clientVersion" rel="stylesheet" />
|
||||
<link href="~/AdminTheme/assets/sweet-alert/sweet-alert.min.css" rel="stylesheet">
|
||||
<link href="~/AssetsClient/css/table-style.css?ver=@clientVersion" rel="stylesheet"/>
|
||||
<link href="~/AssetsClient/css/table-responsive.css?ver=@clientVersion" rel="stylesheet"/>
|
||||
<link href="~/AssetsClient/css/datetimepicker.css?ver=@clientVersion" rel="stylesheet"/>
|
||||
<link href="~/AssetsClient/css/dropdown.css?ver=@clientVersion" rel="stylesheet"/>
|
||||
<link href="~/AssetsClient/css/filter-search.css?ver=@clientVersion" rel="stylesheet"/>
|
||||
<link href="~/assetsclient/css/operation-button.css?ver=@clientVersion" rel="stylesheet"/>
|
||||
<link href="~/AssetsClient/css/select2.css?ver=@clientVersion" rel="stylesheet"/>
|
||||
<link href="~/AdminTheme/assets/sweet-alert/sweet-alert.min.css" rel="stylesheet">
|
||||
|
||||
<link href="~/assetsclient/pages/customizecheckout/css/CheckoutTemporary.css?ver=@clientVersion" rel="stylesheet" />
|
||||
<link href="~/assetsclient/pages/customizecheckout/css/CheckoutTemporary.css?ver=@clientVersion" rel="stylesheet"/>
|
||||
|
||||
|
||||
<style>
|
||||
.sweet-alert {
|
||||
font-family: 'IranSans' !important
|
||||
}
|
||||
<style>
|
||||
.sweet-alert {
|
||||
font-family: 'IranSans' !important
|
||||
}
|
||||
|
||||
button.btn-delete {
|
||||
border-radius: 8px;
|
||||
}
|
||||
button.btn-delete {
|
||||
border-radius: 8px;
|
||||
}
|
||||
|
||||
button.btn-print {
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
border-radius: 8px;
|
||||
}
|
||||
button.btn-print {
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
border-radius: 8px;
|
||||
}
|
||||
|
||||
.btn-excel {
|
||||
border-radius: 7px;
|
||||
padding: 3px 7px;
|
||||
color: #000000;
|
||||
background-color: #afffcc
|
||||
}
|
||||
.textRed {
|
||||
color: red !important;
|
||||
}
|
||||
|
||||
.btn-excel span {
|
||||
color: #1E293B;
|
||||
font-size: 12px;
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
line-height: 24px;
|
||||
}
|
||||
.btn-excel {
|
||||
border-radius: 7px;
|
||||
padding: 3px 7px;
|
||||
color: #000000;
|
||||
background-color: #afffcc
|
||||
}
|
||||
|
||||
.btn-excel:hover {
|
||||
background-color: #a8ebc1;
|
||||
}
|
||||
.btn-excel span {
|
||||
color: #1E293B;
|
||||
font-size: 12px;
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
line-height: 24px;
|
||||
}
|
||||
|
||||
@@media(max-width: 767px) {
|
||||
.table-contracts .Rtable .Rtable-row .Rtable-contract .Rtable-cell--heading button.btn-print {
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
border-radius: 8px;
|
||||
}
|
||||
.btn-excel:hover {
|
||||
background-color: #a8ebc1;
|
||||
}
|
||||
|
||||
.btn-excel, .btn-print-all {
|
||||
width: 35px;
|
||||
height: 35px;
|
||||
}
|
||||
@@media (max-width: 767px) {
|
||||
.table-contracts .Rtable .Rtable-row .Rtable-contract .Rtable-cell--heading button.btn-print {
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
border-radius: 8px;
|
||||
}
|
||||
|
||||
.btn-excel span, .btn-print-all span {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
.btn-excel, .btn-print-all {
|
||||
width: 35px;
|
||||
height: 35px;
|
||||
}
|
||||
|
||||
.btn-excel span, .btn-print-all span {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
}
|
||||
|
||||
|
||||
@@ -352,11 +356,13 @@
|
||||
<div class="Rtable-cell column-heading width2">شماره پرسنلی</div>
|
||||
<div class="Rtable-cell column-heading width3">سال</div>
|
||||
<div class="Rtable-cell column-heading width4">ماه</div>
|
||||
<div class="Rtable-cell column-heading width5">شماره قرارداد</div>
|
||||
<div class="Rtable-cell column-heading width5 d-xxl-block d-none">شماره قرارداد</div>
|
||||
<div class="Rtable-cell column-heading width6">نام پرسنل</div>
|
||||
<div class="Rtable-cell column-heading width7">آغاز قرارداد</div>
|
||||
<div class="Rtable-cell column-heading width8">پایان قرارداد</div>
|
||||
<div class="Rtable-cell column-heading width9">روزهای کارکرد</div>
|
||||
<div class="Rtable-cell column-heading width9">تاخیر در ورود</div>
|
||||
<div class="Rtable-cell column-heading width9">غیبت</div>
|
||||
<div class="Rtable-cell column-heading width9">مبلغ قابل پرداخت</div>
|
||||
<div class="Rtable-cell column-heading width10 text-end">عملیات</div>
|
||||
</div>
|
||||
@@ -390,7 +396,7 @@
|
||||
<div class="Rtable-cell--heading">ماه</div>
|
||||
<div class="Rtable-cell--content">@item.Month</div>
|
||||
</div>
|
||||
<div class="Rtable-cell d-md-block d-none width5">
|
||||
<div class="Rtable-cell d-xxl-block d-none width5">
|
||||
<div class="Rtable-cell--heading">شماره قرارداد</div>
|
||||
<div class="Rtable-cell--content">@item.ContractNo</div>
|
||||
</div>
|
||||
@@ -410,6 +416,14 @@
|
||||
<div class="Rtable-cell--heading">روزهای کارکرد</div>
|
||||
<div class="Rtable-cell--content ">@item.SumOfWorkingDays</div>
|
||||
</div>
|
||||
<div class="Rtable-cell d-md-flex d-none width9">
|
||||
<div class="Rtable-cell--heading">تاخیر در ورود</div>
|
||||
<div class="Rtable-cell--content @(item.TotalLateToWorkDeduction == "0" ? "" : "textRed")">@item.TotalLateToWorkDeduction</div>
|
||||
</div>
|
||||
<div class="Rtable-cell d-md-flex d-none width9">
|
||||
<div class="Rtable-cell--heading">غیبت</div>
|
||||
<div class="Rtable-cell--content @(item.AbsenceDeduction == "0" ? "" : "textRed")">@item.AbsenceDeduction</div>
|
||||
</div>
|
||||
<div class="Rtable-cell d-md-flex d-none width9">
|
||||
<div class="@(item.TotalPaymentD < 0 ? "bgColorMonthlySalaryMinus" : "bgColorMonthlySalaryPlus")">
|
||||
<div class="Rtable-cell--heading">مبلغ قابل پرداخت</div>
|
||||
|
||||
@@ -38,6 +38,10 @@
|
||||
border-radius: 8px;
|
||||
}
|
||||
|
||||
.textRed {
|
||||
color: red !important;
|
||||
}
|
||||
|
||||
.btn-excel {
|
||||
border-radius: 7px;
|
||||
padding: 3px 7px;
|
||||
@@ -352,11 +356,13 @@
|
||||
<div class="Rtable-cell column-heading width2">شماره پرسنلی</div>
|
||||
<div class="Rtable-cell column-heading width3">سال</div>
|
||||
<div class="Rtable-cell column-heading width4">ماه</div>
|
||||
<div class="Rtable-cell column-heading width5">شماره قرارداد</div>
|
||||
<div class="Rtable-cell column-heading width5 d-xxl-block d-none">شماره قرارداد</div>
|
||||
<div class="Rtable-cell column-heading width6">نام پرسنل</div>
|
||||
<div class="Rtable-cell column-heading width7">آغاز قرارداد</div>
|
||||
<div class="Rtable-cell column-heading width8">پایان قرارداد</div>
|
||||
<div class="Rtable-cell column-heading width9">روزهای کارکرد</div>
|
||||
<div class="Rtable-cell column-heading width9">تاخیر در ورود</div>
|
||||
<div class="Rtable-cell column-heading width9">غیبت</div>
|
||||
<div class="Rtable-cell column-heading width9">مبلغ قابل پرداخت</div>
|
||||
<div class="Rtable-cell column-heading width10 text-end">عملیات</div>
|
||||
</div>
|
||||
@@ -390,7 +396,7 @@
|
||||
<div class="Rtable-cell--heading">ماه</div>
|
||||
<div class="Rtable-cell--content">@item.Month</div>
|
||||
</div>
|
||||
<div class="Rtable-cell d-md-block d-none width5">
|
||||
<div class="Rtable-cell d-xxl-block d-none width5">
|
||||
<div class="Rtable-cell--heading">شماره قرارداد</div>
|
||||
<div class="Rtable-cell--content">@item.ContractNo</div>
|
||||
</div>
|
||||
@@ -412,6 +418,14 @@
|
||||
@item.SumOfWorkingDays
|
||||
</div>
|
||||
</div>
|
||||
<div class="Rtable-cell d-md-flex d-none width9">
|
||||
<div class="Rtable-cell--heading">تاخیر در ورود</div>
|
||||
<div class="Rtable-cell--content @(item.TotalLateToWorkDeduction == "0" ? "" : "textRed")">@item.TotalLateToWorkDeduction</div>
|
||||
</div>
|
||||
<div class="Rtable-cell d-md-flex d-none width9">
|
||||
<div class="Rtable-cell--heading">غیبت</div>
|
||||
<div class="Rtable-cell--content @(item.AbsenceDeduction == "0" ? "" : "textRed")">@item.AbsenceDeduction</div>
|
||||
</div>
|
||||
<div class="Rtable-cell d-md-flex d-none width9">
|
||||
<div class="@(item.TotalPaymentD < 0 ? "bgColorMonthlySalaryMinus" : "bgColorMonthlySalaryPlus" )">
|
||||
<div class="Rtable-cell--heading">مبلغ قابل پرداخت</div>
|
||||
|
||||
@@ -1608,6 +1608,35 @@ function showExcelAllModal() {
|
||||
|
||||
function downloadExcelAll() {
|
||||
var idlist = "";
|
||||
var year = $('#Year').val();
|
||||
var month = $('#Month').val();
|
||||
|
||||
|
||||
if (year === '0' || month === '0') {
|
||||
$('#dropdown-year').addClass("errored");
|
||||
$('#dropdown-month').addClass("errored");
|
||||
$('.alert-msg').show();
|
||||
$('.alert-msg p').text('لطفا سال و ماه را انتخاب نموده و جستجو نمایید');
|
||||
setTimeout(function () {
|
||||
$('.alert-msg').hide();
|
||||
$('.alert-msg p').text('');
|
||||
$('#dropdown-year').removeClass("errored");
|
||||
$('#dropdown-month').removeClass("errored");
|
||||
}, 3500);
|
||||
return
|
||||
}
|
||||
|
||||
if (!($('input:checkbox').is(":checked"))) {
|
||||
$('.alert-msg').show();
|
||||
$('.alert-msg p').text('هیچ موردی انتخاب نشده است.');
|
||||
setTimeout(function () {
|
||||
$('.alert-msg').hide();
|
||||
$('.alert-msg p').text('');
|
||||
}, 3500);
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
$('.foo').each(function () {
|
||||
if ($(this).is(":checked")) {
|
||||
|
||||
|
||||
@@ -1607,8 +1607,36 @@ function showExcelAllModal() {
|
||||
window.location.href = showCheckoutExcelModalUrl;
|
||||
}
|
||||
|
||||
function downloadExcelAll() {
|
||||
function excelDownloadAll() {
|
||||
var idlist = "";
|
||||
var year = $('#Year').val();
|
||||
var month = $('#Month').val();
|
||||
|
||||
|
||||
if (year === '0' || month === '0') {
|
||||
$('#dropdown-year').addClass("errored");
|
||||
$('#dropdown-month').addClass("errored");
|
||||
$('.alert-msg').show();
|
||||
$('.alert-msg p').text('لطفا سال و ماه را انتخاب نموده و جستجو نمایید');
|
||||
setTimeout(function () {
|
||||
$('.alert-msg').hide();
|
||||
$('.alert-msg p').text('');
|
||||
$('#dropdown-year').removeClass("errored");
|
||||
$('#dropdown-month').removeClass("errored");
|
||||
}, 3500);
|
||||
return
|
||||
}
|
||||
|
||||
if (!($('input:checkbox').is(":checked"))) {
|
||||
$('.alert-msg').show();
|
||||
$('.alert-msg p').text('هیچ موردی انتخاب نشده است.');
|
||||
setTimeout(function () {
|
||||
$('.alert-msg').hide();
|
||||
$('.alert-msg p').text('');
|
||||
}, 3500);
|
||||
return
|
||||
}
|
||||
|
||||
$('.foo').each(function () {
|
||||
if ($(this).is(":checked")) {
|
||||
|
||||
@@ -1619,22 +1647,47 @@ function downloadExcelAll() {
|
||||
}
|
||||
});
|
||||
|
||||
var filterArray = [];
|
||||
$("input[name='filter[]']:checked").each(function () {
|
||||
filterArray.push($(this).val());
|
||||
});
|
||||
|
||||
|
||||
if (idlist !== "") {
|
||||
//var url = CheckoutExcelAllUrl + "&idList=" + idlist;
|
||||
var url = CheckoutExcelAllUrl + "&idList=" + encodeURIComponent(idlist);
|
||||
|
||||
filterArray.forEach(function (filter) {
|
||||
url += "&filter=" + encodeURIComponent(filter);
|
||||
});
|
||||
|
||||
var yearFa = '&yearFa=' + year;
|
||||
var monthFa = '&monthFa=' + month;
|
||||
var url = CheckoutExcelAllUrl + '&idlist=' + idlist;
|
||||
|
||||
|
||||
//console.log(url + '?checkoutId=' + idlist + yearFa + monthFa);
|
||||
window.open(url, "_blank");
|
||||
|
||||
}
|
||||
}
|
||||
//function downloadExcelAll() {
|
||||
// var idlist = "";
|
||||
// $('.foo').each(function () {
|
||||
// if ($(this).is(":checked")) {
|
||||
|
||||
// var a = $(this).val();
|
||||
// var b = a + "+";
|
||||
// idlist += b;
|
||||
|
||||
// }
|
||||
// });
|
||||
|
||||
// var filterArray = [];
|
||||
// $("input[name='filter[]']:checked").each(function () {
|
||||
// filterArray.push($(this).val());
|
||||
// });
|
||||
|
||||
|
||||
// if (idlist !== "") {
|
||||
// //var url = CheckoutExcelAllUrl + "&idList=" + idlist;
|
||||
// var url = CheckoutExcelAllUrl + "&idList=" + encodeURIComponent(idlist);
|
||||
|
||||
// filterArray.forEach(function (filter) {
|
||||
// url += "&filter=" + encodeURIComponent(filter);
|
||||
// });
|
||||
// window.open(url, "_blank");
|
||||
// }
|
||||
//}
|
||||
|
||||
function printAllMobile() {
|
||||
var idlist = "";
|
||||
|
||||
Reference in New Issue
Block a user