Compare commits
8 Commits
Feature/In
...
Feature/in
| Author | SHA1 | Date | |
|---|---|---|---|
| 56e79d2099 | |||
| 93891f3837 | |||
|
|
5bdfbc572b | ||
|
|
07113353c4 | ||
| 8c6336b9bd | |||
| 20e3d454cf | |||
| 2bf31db6b2 | |||
| 7a4a6de84f |
@@ -98,6 +98,11 @@ public class InstitutionContract : EntityBase
|
||||
// مبلغ قرارداد
|
||||
public double ContractAmount { get; private set; }
|
||||
|
||||
public double ContractAmountWithTax => !IsOldContract ? ContractAmount + ContractAmountTax
|
||||
: ContractAmount;
|
||||
|
||||
public double ContractAmountTax => ContractAmount*0.10;
|
||||
|
||||
//خسارت روزانه
|
||||
public double DailyCompenseation { get; private set; }
|
||||
|
||||
@@ -159,6 +164,8 @@ public class InstitutionContract : EntityBase
|
||||
|
||||
public List<InstitutionContractAmendment> Amendments { get; private set; }
|
||||
|
||||
public bool IsOldContract => LawId== 0;
|
||||
|
||||
public InstitutionContract()
|
||||
{
|
||||
ContactInfoList = [];
|
||||
|
||||
@@ -78,7 +78,6 @@ public interface IInsuranceListRepository:IRepository<long, InsuranceList>
|
||||
#endregion
|
||||
|
||||
Task<List<InsuranceListViewModel>> GetNotCreatedWorkshop(InsuranceListSearchModel searchModel);
|
||||
Task<InsuranceClientPrintViewModel> ClientPrintOne(long id);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -316,7 +316,10 @@ public class Workshop : EntityBase
|
||||
IsStaticCheckout = isStaticCheckout;
|
||||
}
|
||||
|
||||
|
||||
public void AddContractingPartyId(long contractingPartyId)
|
||||
{
|
||||
ContractingPartyId = contractingPartyId;
|
||||
}
|
||||
public void Active(string archiveCode)
|
||||
{
|
||||
this.IsActive = true;
|
||||
|
||||
@@ -344,6 +344,9 @@ public class InstitutionContractPrintViewModel
|
||||
public string TotalPrice { get; set; }
|
||||
public string TaxPrice { get; set; }
|
||||
public string PaymentPrice { get; set; }
|
||||
public string OneMonthPrice { get; set; }
|
||||
public string OneMonthWithoutTax { get; set; }
|
||||
public string OneMonthTax { get; set; }
|
||||
public string VerifyCode { get; set; }
|
||||
public string VerifyDate { get; set; }
|
||||
public string VerifyTime { get; set; }
|
||||
|
||||
@@ -5,7 +5,6 @@ using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using _0_Framework.Application;
|
||||
using CompanyManagment.App.Contracts.InsuranceList;
|
||||
using CompanyManagment.App.Contracts.Workshop;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
@@ -97,94 +96,6 @@ public interface IInsuranceListApplication
|
||||
#endregion
|
||||
|
||||
Task<List<InsuranceListViewModel>> GetNotCreatedWorkshop(InsuranceListSearchModel searchModel);
|
||||
Task<InsuranceClientPrintViewModel> ClientPrintOne(long id);
|
||||
}
|
||||
|
||||
public class InsuranceClientPrintViewModel
|
||||
{
|
||||
public string Month { get; set; }
|
||||
public string Year { get; set; }
|
||||
public string WorkshopName { get; set; }
|
||||
public string ListNo { get; set; }
|
||||
public string AgreementNumber { get; set; }
|
||||
public string WorkshopInsuranceCode { get; set; }
|
||||
public string WorkshopEmployerName { get; set; }
|
||||
public string WorkshopAddress { get; set; }
|
||||
public List<InsuranceClientPrintItemsViewModel> Items { get; set; }
|
||||
public string EmployerShare { get; set; }
|
||||
public string InsuredShare { get; set; }
|
||||
public string UnEmploymentInsurance { get; set; }
|
||||
public string AllInsuredShare { get; set; }
|
||||
|
||||
}
|
||||
public class InsuranceClientPrintItemsViewModel
|
||||
{
|
||||
/// <summary>
|
||||
/// شماره بیمه
|
||||
/// </summary>
|
||||
public string InsuranceCode { get; set; }
|
||||
/// <summary>
|
||||
/// نام و نام خانوادگی
|
||||
/// </summary>
|
||||
public string FullName { get; set; }
|
||||
/// <summary>
|
||||
/// شغل
|
||||
/// </summary>
|
||||
public string JobName { get; set; }
|
||||
/// <summary>
|
||||
/// کد ملی
|
||||
/// </summary>
|
||||
public string NationalCode { get; set; }
|
||||
/// <summary>
|
||||
/// شروع به کار
|
||||
/// </summary>
|
||||
public string StartWork { get; set; }
|
||||
/// <summary>
|
||||
/// ترک کار
|
||||
/// </summary>
|
||||
public string LeftWork { get; set; }
|
||||
/// <summary>
|
||||
/// روزهای کارکرد
|
||||
/// </summary>
|
||||
public string WorkingDays { get; set; }
|
||||
/// <summary>
|
||||
/// دستمزد روزانه
|
||||
/// </summary>
|
||||
public string DailyWage { get; set; }
|
||||
/// <summary>
|
||||
/// پایه سنوات روزانه
|
||||
/// </summary>
|
||||
public string BaseYears { get; set; }
|
||||
/// <summary>
|
||||
/// دستمزد ماهانه
|
||||
/// </summary>
|
||||
public string MonthlySalary { get; set; }
|
||||
/// <summary>
|
||||
/// مزایای ماهیانه مشمول
|
||||
/// </summary>
|
||||
public string MonthlyBenefits { get; set; }
|
||||
/// <summary>
|
||||
/// حق تاهل
|
||||
/// </summary>
|
||||
public string MarriedAllowance { get; set; }
|
||||
/// <summary>
|
||||
/// حقوق و مزایای ماهیانه مشمول
|
||||
/// </summary>
|
||||
public string BenefitsIncludedContinuous { get; set; }
|
||||
/// <summary>
|
||||
/// حقوق و مزایای ماهیانه غیر مشمول
|
||||
/// </summary>
|
||||
public string BenefitsIncludedNonContinuous { get; set; }
|
||||
/// <summary>
|
||||
/// مجموع مزایای ماهیانه مشمول و غیر مشمول
|
||||
/// </summary>
|
||||
public string IncludedAndNotIncluded { get; set; }
|
||||
/// <summary>
|
||||
/// حق بیمه سهم بیمه شده
|
||||
/// </summary>
|
||||
public string InsuranceShare { get; set; }
|
||||
|
||||
|
||||
}
|
||||
|
||||
public class InsuranceClientSearchModel:PaginationRequest
|
||||
@@ -202,11 +113,4 @@ public class InsuranceClientListViewModel
|
||||
public int YearInt { get; set; }
|
||||
public string MonthName { get; set; }
|
||||
public int MonthInt { get; set; }
|
||||
public int PersonnelCount { get; set; }
|
||||
public int LeftWorkCount { get; set; }
|
||||
public string AllInsuredShare { get; set; }
|
||||
public string InsuredShare { get; set; }
|
||||
public string EmployerShare { get; set; }
|
||||
public string UnEmploymentInsurance { get; set; }
|
||||
|
||||
}
|
||||
@@ -2381,10 +2381,5 @@ public class InsuranceListApplication : IInsuranceListApplication
|
||||
return await _insuranceListRepositpry.GetNotCreatedWorkshop(searchModel);
|
||||
}
|
||||
|
||||
public async Task<InsuranceClientPrintViewModel> ClientPrintOne(long id)
|
||||
{
|
||||
return await _insuranceListRepositpry.ClientPrintOne(id);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -45,5 +45,10 @@ public class InstitutionContractMapping : IEntityTypeConfiguration<InstitutionCo
|
||||
|
||||
builder.HasMany(x => x.Amendments).WithOne(x => x.InstitutionContract)
|
||||
.HasForeignKey(x => x.InstitutionContractId);
|
||||
|
||||
|
||||
builder.Ignore(x => x.ContractAmountWithTax);
|
||||
builder.Ignore(x => x.ContractAmountTax);
|
||||
builder.Ignore(x => x.ContractAmountTax);
|
||||
}
|
||||
}
|
||||
@@ -1375,7 +1375,7 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
.Count(l => l.StartWorkDate <= DateTime.Now && l.LeftWorkDate >= DateTime.Now);
|
||||
return new GetInstitutionContractListItemsViewModel()
|
||||
{
|
||||
ContractAmount = x.contract.ContractAmount,
|
||||
ContractAmount = x.contract.ContractAmountWithTax,
|
||||
Balance = statement?.FinancialTransactionList.Sum(ft => ft.Deptor - ft.Creditor) ?? 0,
|
||||
WorkshopsCount = workshops.Count(),
|
||||
ContractStartFa = x.contract.ContractStartGr.ToFarsi(),
|
||||
@@ -1395,9 +1395,7 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
Workshops = workshopDetails,
|
||||
IsInPersonContract = x.contract.WorkshopGroup?.CurrentWorkshops
|
||||
.Any(y => y.Services.ContractInPerson) ?? true,
|
||||
IsOldContract = x.contract.WorkshopGroup?.CurrentWorkshops == null
|
||||
|| x.contract.WorkshopGroup.CurrentWorkshops.Count == 0
|
||||
|| x.contract.WorkshopGroup.CurrentWorkshops.Any(y => y.Price == 0)
|
||||
IsOldContract = x.contract.IsOldContract
|
||||
};
|
||||
}).ToList()
|
||||
};
|
||||
@@ -3216,6 +3214,9 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
PaymentPrice = institution.TotalAmount.ToMoney(),
|
||||
TotalPrice = (institution.TotalAmount - institution.ValueAddedTax).ToMoney(),
|
||||
TaxPrice = institution.ValueAddedTax.ToMoney(),
|
||||
OneMonthPrice = institution.ContractAmountWithTax.ToMoney(),
|
||||
OneMonthWithoutTax = institution.ContractAmount.ToMoney(),
|
||||
OneMonthTax = institution.ContractAmountTax.ToMoney(),
|
||||
VerifierFullName = institution.VerifierFullName,
|
||||
VerifierPhoneNumber = institution.VerifierPhoneNumber,
|
||||
VerifyCode = institution.VerifyCode,
|
||||
|
||||
@@ -176,20 +176,18 @@ public class InsuranceListRepository : RepositoryBase<long, InsuranceList>, IIns
|
||||
if (item.InsuranceShare.ToMoney() != checkout.InsuranceDeduction.ToMoney())
|
||||
{
|
||||
checkout.SetUpdateNeeded();
|
||||
if (!_context.CheckoutWarningMessages.Any(x =>
|
||||
x.CheckoutId == checkout.id && x.TypeOfCheckoutWarning !=
|
||||
TypeOfCheckoutWarning.InsuranceEmployeeShare))
|
||||
if (!_context.CheckoutWarningMessages.Any(x => x.CheckoutId == checkout.id && x.TypeOfCheckoutWarning != TypeOfCheckoutWarning.InsuranceEmployeeShare))
|
||||
{
|
||||
var createWarrning =
|
||||
new CheckoutWarningMessage(
|
||||
"مبلغ بیمه سهم کارگر با مبلغ محاسبه شده در لیست بیمه مغایرت دارد",
|
||||
checkout.id, TypeOfCheckoutWarning.InsuranceEmployeeShare);
|
||||
"مبلغ بیمه سهم کارگر با مبلغ محاسبه شده در لیست بیمه مغایرت دارد", checkout.id, TypeOfCheckoutWarning.InsuranceEmployeeShare);
|
||||
_context.CheckoutWarningMessages.Add(createWarrning);
|
||||
}
|
||||
|
||||
_context.SaveChanges();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -731,7 +729,7 @@ public class InsuranceListRepository : RepositoryBase<long, InsuranceList>, IIns
|
||||
var id = insuranceListObj.id;
|
||||
if (command.EmployeeInsurancListDataList != null && command.EmployeeInsurancListDataList.Count > 0)
|
||||
{
|
||||
var farisMonthName = Tools.ToFarsiMonthByNumber(command.Month);
|
||||
var farisMonthName = Tools.ToFarsiMonthByNumber(command.Month);
|
||||
|
||||
var checkouts = _context.CheckoutSet.Where(x =>
|
||||
x.WorkshopId == command.WorkshopId && x.Year == command.Year && x.Month == farisMonthName &&
|
||||
@@ -757,21 +755,20 @@ public class InsuranceListRepository : RepositoryBase<long, InsuranceList>, IIns
|
||||
if (item.InsuranceShare.ToMoney() != checkout.InsuranceDeduction.ToMoney())
|
||||
{
|
||||
checkout.SetUpdateNeeded();
|
||||
if (!_context.CheckoutWarningMessages.Any(x =>
|
||||
x.CheckoutId == checkout.id && x.TypeOfCheckoutWarning !=
|
||||
TypeOfCheckoutWarning.InsuranceEmployeeShare))
|
||||
if (!_context.CheckoutWarningMessages.Any(x => x.CheckoutId == checkout.id && x.TypeOfCheckoutWarning != TypeOfCheckoutWarning.InsuranceEmployeeShare))
|
||||
{
|
||||
var createWarrning =
|
||||
new CheckoutWarningMessage(
|
||||
"مبلغ بیمه سهم کارگر با مبلغ محاسبه شده در لیست بیمه مغایرت دارد",
|
||||
checkout.id, TypeOfCheckoutWarning.InsuranceEmployeeShare);
|
||||
"مبلغ بیمه سهم کارگر با مبلغ محاسبه شده در لیست بیمه مغایرت دارد", checkout.id, TypeOfCheckoutWarning.InsuranceEmployeeShare);
|
||||
_context.CheckoutWarningMessages.Add(createWarrning);
|
||||
}
|
||||
|
||||
|
||||
_context.SaveChanges();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
_employeeInsurancListDataRepository.SaveChanges();
|
||||
@@ -1780,76 +1777,46 @@ public class InsuranceListRepository : RepositoryBase<long, InsuranceList>, IIns
|
||||
return res;
|
||||
}
|
||||
|
||||
public async Task<PagedResult<InsuranceClientListViewModel>> GetInsuranceClientList(
|
||||
InsuranceClientSearchModel searchModel)
|
||||
public async Task<PagedResult<InsuranceClientListViewModel>> GetInsuranceClientList(InsuranceClientSearchModel searchModel)
|
||||
{
|
||||
var workshopId = _authHelper.GetWorkshopId();
|
||||
var query = _context.InsuranceListSet
|
||||
.Where(x => x.WorkshopId == workshopId);
|
||||
|
||||
|
||||
if (searchModel.Year > 0)
|
||||
.Select(x => new InsuranceClientListViewModel
|
||||
{
|
||||
query = query.Where(x => x.Year == searchModel.Year.ToString("0000"));
|
||||
}
|
||||
Id = x.id,
|
||||
WorkShopId = x.WorkshopId,
|
||||
Year = x.Year,
|
||||
YearInt = Convert.ToInt32(x.Year),
|
||||
Month = x.Month,
|
||||
MonthName = x.Month.ToFarsiMonthByNumber(),
|
||||
MonthInt = Convert.ToInt32(x.Month),
|
||||
}).Where(x => x.WorkShopId == workshopId);
|
||||
|
||||
|
||||
if (searchModel.Year>0)
|
||||
{
|
||||
query = query.Where(x => x.YearInt == searchModel.Year);
|
||||
}
|
||||
if (searchModel.Month > 0)
|
||||
{
|
||||
query = query.Where(x => x.Month == searchModel.Month.ToString("00"));
|
||||
query = query.Where(x => x.MonthInt == searchModel.Month);
|
||||
}
|
||||
|
||||
var res = new PagedResult<InsuranceClientListViewModel>
|
||||
{
|
||||
TotalCount = query.Count()
|
||||
};
|
||||
|
||||
var list = (await query.ApplyPagination(searchModel.PageIndex, searchModel.PageSize).ToListAsync());
|
||||
|
||||
var insuranceListIds = list.Select(x => x.id).ToList();
|
||||
|
||||
var employeeData = await _context.EmployeeInsurancListDataSet
|
||||
.Where(x => insuranceListIds.Contains(x.InsuranceListId))
|
||||
.GroupBy(x => x.InsuranceListId)
|
||||
.Select(g => new
|
||||
{
|
||||
g.Key,
|
||||
Count = g.Count(x=>x.LeftWorkDate != null)
|
||||
}).ToListAsync();
|
||||
|
||||
|
||||
var resList = list
|
||||
.Select(x => new InsuranceClientListViewModel
|
||||
{
|
||||
Id = x.id,
|
||||
WorkShopId = x.WorkshopId,
|
||||
Year = x.Year,
|
||||
YearInt = Convert.ToInt32(x.Year),
|
||||
Month = x.Month,
|
||||
MonthName = x.Month.ToFarsiMonthByNumber(),
|
||||
MonthInt = Convert.ToInt32(x.Month),
|
||||
EmployerShare = x.EmployerShare.ToMoney(),
|
||||
InsuredShare = x.InsuredShare.ToMoney(),
|
||||
UnEmploymentInsurance = x.UnEmploymentInsurance.ToMoney(),
|
||||
PersonnelCount = x.SumOfEmployees,
|
||||
AllInsuredShare = (x.InsuredShare +
|
||||
x.EmployerShare +
|
||||
x.UnEmploymentInsurance).ToMoney(),
|
||||
LeftWorkCount =employeeData.FirstOrDefault(e=>e.Key == x.id)?.Count ?? 0,
|
||||
}).ToList();
|
||||
|
||||
resList = searchModel.Sorting switch
|
||||
query = searchModel.Sorting switch
|
||||
{
|
||||
"CreationDate-Max" => resList.OrderByDescending(x => x.Id).ToList(),
|
||||
"CreationDate-Min" => resList.OrderBy(x => x.Id).ToList(),
|
||||
"Month-Max" => resList.OrderByDescending(x => x.MonthInt).ToList(),
|
||||
"Month-Min" => resList.OrderBy(x => x.MonthInt).ToList(),
|
||||
"Year-Max" => resList.OrderByDescending(x => x.YearInt).ToList(),
|
||||
"Year-Min" => resList.OrderBy(x => x.YearInt).ToList(),
|
||||
_ => resList.OrderByDescending(x => x.Id).ToList(),
|
||||
"CreationDate-Max" => query.OrderByDescending(x => x.Id),
|
||||
"CreationDate-Min" => query.OrderBy(x => x.Id),
|
||||
"Month-Max" => query.OrderByDescending(x => x.MonthInt),
|
||||
"Month-Min" => query.OrderBy(x => x.MonthInt),
|
||||
"Year-Max" => query.OrderByDescending(x => x.YearInt),
|
||||
"Year-Min" => query.OrderBy(x => x.YearInt),
|
||||
_ => query.OrderByDescending(x => x.Id),
|
||||
};
|
||||
|
||||
|
||||
res.List = resList;
|
||||
res.List =await query.ApplyPagination(searchModel.PageIndex,searchModel.PageSize).ToListAsync();
|
||||
return res;
|
||||
}
|
||||
|
||||
@@ -1879,41 +1846,41 @@ public class InsuranceListRepository : RepositoryBase<long, InsuranceList>, IIns
|
||||
.Include(x => x.LeftWorkInsurances)
|
||||
.Where(x => x.LeftWorkInsurances.Any(l => l.StartWorkDate <= firstDayOfMonth &&
|
||||
(l.LeftWorkDate == null || l.LeftWorkDate >= firstDayOfMonth)));
|
||||
|
||||
|
||||
var query = notCreatedWorkshop.Select(result=>new InsuranceListViewModel
|
||||
{
|
||||
Year = searchModel.Year,
|
||||
Month = searchModel.Month,
|
||||
WorkShopId = result.id,
|
||||
WorkShopCode = result.InsuranceWorkshopInfo != null
|
||||
? result.InsuranceWorkshopInfo.InsuranceCode
|
||||
: result.InsuranceCode,
|
||||
WorkShopName = result.InsuranceWorkshopInfo != null
|
||||
? result.InsuranceWorkshopInfo.WorkshopName
|
||||
: result.WorkshopFullName,
|
||||
TypeOfInsuranceSend = result.TypeOfInsuranceSend == "NormalList" ? "عادی" :
|
||||
result.TypeOfInsuranceSend == "Govermentlist" ? "کمک دولت" :
|
||||
result.TypeOfInsuranceSend == "Familylist" ? "خانوادگی" : "",
|
||||
FixedSalary = result.FixedSalary,
|
||||
StrFixedSalary = result.FixedSalary ? "دارد" : "ندارد",
|
||||
EmployerName = result.InsuranceWorkshopInfo != null
|
||||
? result.InsuranceWorkshopInfo.EmployerName
|
||||
: result.WorkshopFullName,
|
||||
Branch = "",
|
||||
City = "",
|
||||
ArchiveCode = result.ArchiveCode,
|
||||
});
|
||||
|
||||
|
||||
if (!string.IsNullOrEmpty(searchModel.Month) && searchModel.Month != "0")
|
||||
query = query.Where(x => x.Month == searchModel.Month).OrderByDescending(x => x.WorkShopName)
|
||||
.ThenByDescending(x => x.EmployerName).ThenByDescending(x => x.Year);
|
||||
|
||||
|
||||
var query = notCreatedWorkshop.Select(result => new InsuranceListViewModel
|
||||
{
|
||||
Year = searchModel.Year,
|
||||
Month = searchModel.Month,
|
||||
WorkShopId = result.id,
|
||||
WorkShopCode = result.InsuranceWorkshopInfo != null
|
||||
? result.InsuranceWorkshopInfo.InsuranceCode
|
||||
: result.InsuranceCode,
|
||||
WorkShopName = result.InsuranceWorkshopInfo != null
|
||||
? result.InsuranceWorkshopInfo.WorkshopName
|
||||
: result.WorkshopFullName,
|
||||
TypeOfInsuranceSend = result.TypeOfInsuranceSend == "NormalList" ? "عادی" :
|
||||
result.TypeOfInsuranceSend == "Govermentlist" ? "کمک دولت" :
|
||||
result.TypeOfInsuranceSend == "Familylist" ? "خانوادگی" : "",
|
||||
FixedSalary = result.FixedSalary,
|
||||
StrFixedSalary = result.FixedSalary ? "دارد" : "ندارد",
|
||||
EmployerName = result.InsuranceWorkshopInfo != null
|
||||
? result.InsuranceWorkshopInfo.EmployerName
|
||||
: result.WorkshopFullName,
|
||||
Branch = "",
|
||||
City = "",
|
||||
ArchiveCode = result.ArchiveCode,
|
||||
});
|
||||
|
||||
|
||||
if (!string.IsNullOrEmpty(searchModel.Month) && searchModel.Month != "0")
|
||||
query = query.Where(x => x.Month == searchModel.Month).OrderByDescending(x => x.WorkShopName)
|
||||
.ThenByDescending(x => x.EmployerName).ThenByDescending(x => x.Year);
|
||||
|
||||
if (!string.IsNullOrEmpty(searchModel.Year) && searchModel.Year != "0")
|
||||
query = query.Where(x => x.Year == searchModel.Year).OrderByDescending(x => x.EmployerName)
|
||||
.ThenByDescending(x => x.WorkShopName).ThenByDescending(x => x.Month);
|
||||
|
||||
if (!string.IsNullOrEmpty(searchModel.Year) && searchModel.Year != "0")
|
||||
query = query.Where(x => x.Year == searchModel.Year).OrderByDescending(x => x.EmployerName)
|
||||
.ThenByDescending(x => x.WorkShopName).ThenByDescending(x => x.Month);
|
||||
|
||||
|
||||
if (!string.IsNullOrEmpty(searchModel.WorkShopCode))
|
||||
query = query.Where(x => x.WorkShopCode == searchModel.WorkShopCode).OrderByDescending(x => x.Year)
|
||||
@@ -1958,112 +1925,41 @@ public class InsuranceListRepository : RepositoryBase<long, InsuranceList>, IIns
|
||||
|
||||
|
||||
var workshopList = await query.Skip(searchModel.PageIndex).Take(30).ToListAsync();
|
||||
var workshopIds = workshopList.Select(x => x.WorkShopId);
|
||||
|
||||
var employers = await _context.WorkshopEmployers
|
||||
.Where(x => workshopIds.Contains(x.WorkshopId))
|
||||
.GroupBy(x => x.WorkshopId)
|
||||
.Select(x => x.First()).ToListAsync();
|
||||
|
||||
var res = workshopList.Select(x =>
|
||||
{
|
||||
var employer = employers.FirstOrDefault(e => e.WorkshopId == x.WorkShopId)?.Employer;
|
||||
|
||||
return new InsuranceListViewModel
|
||||
{
|
||||
WorkShopId = x.WorkShopId,
|
||||
WorkShopCode = x.WorkShopCode,
|
||||
WorkShopName = x.WorkShopName,
|
||||
EmployerName = employer != null
|
||||
? employer.FullName
|
||||
: (x.EmployerName),
|
||||
Year = searchModel.Year,
|
||||
Month = searchModel.Month,
|
||||
TypeOfInsuranceSend = x.TypeOfInsuranceSend == "NormalList" ? "عادی" :
|
||||
x.TypeOfInsuranceSend == "Govermentlist" ? "کمک دولت" :
|
||||
x.TypeOfInsuranceSend == "Familylist" ? "خانوادگی" : "",
|
||||
FixedSalary = (bool)x.FixedSalary,
|
||||
StrFixedSalary = (bool)x.FixedSalary ? "دارد" : "ندارد",
|
||||
EmployerId = employer?.id ?? 0,
|
||||
ArchiveCode = x.ArchiveCode,
|
||||
City = x.City,
|
||||
};
|
||||
}).ToList();
|
||||
var workshopIds = workshopList.Select(x=>x.WorkShopId);
|
||||
|
||||
var employers =await _context.WorkshopEmployers
|
||||
.Where(x=>workshopIds.Contains(x.WorkshopId))
|
||||
.GroupBy(x=>x.WorkshopId)
|
||||
.Select(x=>x.First()).ToListAsync();
|
||||
|
||||
var res = workshopList.Select(x =>
|
||||
{
|
||||
var employer = employers.FirstOrDefault(e => e.WorkshopId ==x.WorkShopId)?.Employer;
|
||||
|
||||
return new InsuranceListViewModel
|
||||
{
|
||||
WorkShopId = x.WorkShopId,
|
||||
WorkShopCode = x.WorkShopCode,
|
||||
WorkShopName = x.WorkShopName,
|
||||
EmployerName = employer != null
|
||||
? employer.FullName
|
||||
: (x.EmployerName),
|
||||
Year = searchModel.Year,
|
||||
Month = searchModel.Month,
|
||||
TypeOfInsuranceSend = x.TypeOfInsuranceSend == "NormalList" ? "عادی" :
|
||||
x.TypeOfInsuranceSend == "Govermentlist" ? "کمک دولت" :
|
||||
x.TypeOfInsuranceSend == "Familylist" ? "خانوادگی" : "",
|
||||
FixedSalary = (bool)x.FixedSalary,
|
||||
StrFixedSalary = (bool)x.FixedSalary ? "دارد" : "ندارد",
|
||||
EmployerId = employer?.id ?? 0,
|
||||
ArchiveCode = x.ArchiveCode,
|
||||
City = x.City,
|
||||
};
|
||||
}).ToList();
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
public async Task<InsuranceClientPrintViewModel> ClientPrintOne(long id)
|
||||
{
|
||||
var insurance = await _context.InsuranceListSet.FirstOrDefaultAsync(x => x.id == id);
|
||||
|
||||
if (insurance == null)
|
||||
return null;
|
||||
|
||||
var employeeInsurance = _context.EmployeeInsurancListDataSet
|
||||
.Where(x => x.InsuranceListId == insurance.id);
|
||||
|
||||
var workshop = await _context.Workshops
|
||||
.Include(x => x.InsuranceWorkshopInfo)
|
||||
.FirstOrDefaultAsync(x => x.id == insurance.WorkshopId);
|
||||
|
||||
var employeeIds = await employeeInsurance
|
||||
.Select(x => x.EmployeeId).ToListAsync();
|
||||
|
||||
var employees = await _context.Employees
|
||||
.Where(x => employeeIds.Contains(x.id)).ToListAsync();
|
||||
|
||||
var jobIds = employeeInsurance.Select(x => x.JobId).ToList();
|
||||
|
||||
var jobs = await _context.Jobs
|
||||
.Where(x => jobIds.Contains(x.id)).ToDictionaryAsync(x => x.id, x => x.JobName);
|
||||
|
||||
var employeeData = employeeInsurance.ToList().Select(x =>
|
||||
{
|
||||
var employee = employees.FirstOrDefault(e => e.id == x.EmployeeId);
|
||||
return new InsuranceClientPrintItemsViewModel()
|
||||
{
|
||||
BaseYears = x.BaseYears.ToMoney(),
|
||||
BenefitsIncludedContinuous = x.BenefitsIncludedContinuous.ToMoney(),
|
||||
BenefitsIncludedNonContinuous = x.BenefitsIncludedNonContinuous.ToMoney(),
|
||||
DailyWage = x.DailyWage.ToMoney(),
|
||||
IncludedAndNotIncluded = (x.BenefitsIncludedNonContinuous + x.BenefitsIncludedContinuous).ToMoney(),
|
||||
WorkingDays = x.WorkingDays.ToString(),
|
||||
MarriedAllowance = x.MarriedAllowance.ToMoney(),
|
||||
StartWork = x.StartWorkDate.ToFarsi(),
|
||||
LeftWork = x.LeftWorkDate.ToFarsi(),
|
||||
MonthlyBenefits = x.MonthlyBenefits.ToMoney(),
|
||||
MonthlySalary = x.MonthlySalary.ToMoney(),
|
||||
NationalCode = employee.NationalCode,
|
||||
InsuranceCode = employee.InsuranceCode,
|
||||
JobName = jobs.GetValueOrDefault(x.JobId, ""),
|
||||
FullName = employee.FullName,
|
||||
InsuranceShare = x.InsuranceShare.ToMoney(),
|
||||
};
|
||||
}).ToList();
|
||||
|
||||
var result = new InsuranceClientPrintViewModel()
|
||||
{
|
||||
Items = employeeData.ToList(),
|
||||
AllInsuredShare = (insurance.InsuredShare +
|
||||
insurance.EmployerShare +
|
||||
insurance.UnEmploymentInsurance).ToMoney(),
|
||||
EmployerShare = insurance.EmployerShare.ToMoney(),
|
||||
InsuredShare = insurance.InsuredShare.ToMoney(),
|
||||
UnEmploymentInsurance = insurance.UnEmploymentInsurance.ToMoney(),
|
||||
WorkshopName = workshop.InsuranceWorkshopInfo.WorkshopName,
|
||||
WorkshopAddress = workshop.InsuranceWorkshopInfo.Address,
|
||||
WorkshopEmployerName = workshop.InsuranceWorkshopInfo.EmployerName,
|
||||
WorkshopInsuranceCode = workshop.InsuranceWorkshopInfo.InsuranceCode,
|
||||
AgreementNumber = workshop.InsuranceWorkshopInfo.AgreementNumber,
|
||||
ListNo = "01",
|
||||
Month = insurance.Month,
|
||||
Year = insurance.Year
|
||||
|
||||
};
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
@page
|
||||
|
||||
|
||||
<h4>Deploy Log</h4>
|
||||
|
||||
<pre style="
|
||||
background:#111;
|
||||
color:#0f0;
|
||||
padding:15px;
|
||||
max-height:600px;
|
||||
overflow:auto;
|
||||
font-size:13px;
|
||||
border-radius:6px;">
|
||||
|
||||
</pre>
|
||||
@@ -2,6 +2,14 @@
|
||||
@model ServiceHost.Areas.AdminNew.Pages.Company.AndroidApk.IndexModel
|
||||
@{
|
||||
ViewData["Title"] = "File Upload";
|
||||
<style>
|
||||
.lineDiv {
|
||||
width: 100%;
|
||||
height: 2px;
|
||||
background-image: linear-gradient(to right, #ffffff, #e5e5e5, #cbcbcb, #b2b2b2, #9a9a9a, #9a9a9a, #9a9a9a, #9a9a9a, #b2b2b2, #cbcbcb, #e5e5e5, #ffffff);
|
||||
margin: 10px;
|
||||
}
|
||||
</style>
|
||||
}
|
||||
|
||||
<h1>Upload APK File</h1>
|
||||
@@ -60,16 +68,85 @@
|
||||
</form>
|
||||
|
||||
|
||||
<form style="margin:50px" asp-page-handler="PaymentGateWay" id="11" method="post">
|
||||
<form style="margin:30px" asp-page-handler="PaymentGateWay" id="11" method="post">
|
||||
|
||||
<button type="submit">درگاه پرداخت تستی </button>
|
||||
</form>
|
||||
<div class="lineDiv"></div>
|
||||
<div class="row m-t-20">
|
||||
<div class="col-4"></div>
|
||||
<div class="col-2">
|
||||
<form asp-page-handler="UploadFrontEnd" id="12" method="post">
|
||||
<button type="submit"
|
||||
class="btn btn-danger"
|
||||
onclick="return confirm('آیا از انتشار نسخه جدید فرانت مطمئن هستید؟');">
|
||||
🚀 Deploy Next UI
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
<div class="col-2">
|
||||
<button type="button" class="btn btn-outline-secondary"
|
||||
data-bs-toggle="modal"
|
||||
data-bs-target="#logModal">
|
||||
مشاهده لاگ Deploy
|
||||
</button>
|
||||
</div>
|
||||
<div class="col-4"></div>
|
||||
</div>
|
||||
<div class="lineDiv"></div>
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="modal fade" id="logModal" tabindex="-1">
|
||||
<div class="modal-dialog modal-xl modal-dialog-scrollable">
|
||||
<div class="modal-content">
|
||||
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title">Deploy Log</h5>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal"></button>
|
||||
</div>
|
||||
|
||||
<div class="modal-body">
|
||||
<pre id="logContent"
|
||||
style="background: #111;
|
||||
color: #0f0;
|
||||
padding: 15px;
|
||||
font-size: 13px;
|
||||
text-align: left;
|
||||
direction: ltr;">
|
||||
|
||||
</pre>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<form style="margin:20px" asp-page-handler="ContractingPartyToWorkshop" id="13" method="post">
|
||||
|
||||
<button class="btn btn-outline-secondary" type="submit"> افزودن آی دی طرف حساب به کارگاه </button>
|
||||
</form>
|
||||
|
||||
|
||||
|
||||
|
||||
@if (ViewData["message"] != null)
|
||||
{
|
||||
<p>@ViewData["message"]</p>
|
||||
}
|
||||
<script>
|
||||
document.getElementById('logModal')
|
||||
.addEventListener('show.bs.modal', function () {
|
||||
|
||||
fetch('?handler=Log')
|
||||
.then(r => r.text())
|
||||
.then(t => {
|
||||
document.getElementById('logContent').textContent = t;
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
@* <script>
|
||||
|
||||
|
||||
@@ -1,36 +1,40 @@
|
||||
using _0_Framework.Application;
|
||||
using _0_Framework.Application.Enums;
|
||||
using _0_Framework.Application.FaceEmbedding;
|
||||
using _0_Framework.Application.PaymentGateway;
|
||||
using _0_Framework.Domain.CustomizeCheckoutShared.Enums;
|
||||
using AccountManagement.Domain.AccountLeftWorkAgg;
|
||||
using AccountMangement.Infrastructure.EFCore;
|
||||
using Company.Domain.AndroidApkVersionAgg;
|
||||
using Company.Domain.CustomizeCheckoutAgg.ValueObjects;
|
||||
using Company.Domain.CustomizeCheckoutTempAgg.ValueObjects;
|
||||
using Company.Domain.InstitutionContractAgg;
|
||||
using Company.Domain.InstitutionPlanAgg;
|
||||
using Company.Domain.PaymentTransactionAgg;
|
||||
using Company.Domain.RewardAgg;
|
||||
using Company.Domain.RollCallAgg.DomainService;
|
||||
using CompanyManagement.Infrastructure.Excel.WorkshopsRollCall;
|
||||
using CompanyManagment.App.Contracts.AndroidApkVersion;
|
||||
using CompanyManagment.App.Contracts.InstitutionContract;
|
||||
using CompanyManagment.App.Contracts.PaymentTransaction;
|
||||
using CompanyManagment.App.Contracts.TemporaryClientRegistration;
|
||||
using CompanyManagment.EFCore;
|
||||
using Hangfire;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.Net.Http;
|
||||
using System.Security.Cryptography.Xml;
|
||||
using System.Text.Json.Serialization;
|
||||
using _0_Framework.Application.PaymentGateway;
|
||||
using Company.Domain.InstitutionContractAgg;
|
||||
using Company.Domain.InstitutionPlanAgg;
|
||||
using Company.Domain.PaymentTransactionAgg;
|
||||
using CompanyManagment.App.Contracts.InstitutionContract;
|
||||
using CompanyManagment.App.Contracts.PaymentTransaction;
|
||||
using CompanyManagment.App.Contracts.TemporaryClientRegistration;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Parbad;
|
||||
using Parbad.AspNetCore;
|
||||
using Parbad.Gateway.Sepehr;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using _0_Framework.Application.Enums;
|
||||
using _0_Framework.Application.FaceEmbedding;
|
||||
using CompanyManagement.Infrastructure.Excel.WorkshopsRollCall;
|
||||
using System.Diagnostics;
|
||||
using System.Net.Http;
|
||||
using System.Security.Cryptography.Xml;
|
||||
using System.Text;
|
||||
using System.Text.Json.Serialization;
|
||||
using Microsoft.AspNetCore.Authentication;
|
||||
using static ServiceHost.Areas.AdminNew.Pages.Company.AndroidApk.IndexModel2;
|
||||
|
||||
namespace ServiceHost.Areas.AdminNew.Pages.Company.AndroidApk
|
||||
@@ -47,6 +51,7 @@ namespace ServiceHost.Areas.AdminNew.Pages.Company.AndroidApk
|
||||
private readonly IHttpClientFactory _httpClientFactory;
|
||||
private readonly IOnlinePayment _onlinePayment;
|
||||
private readonly IFaceEmbeddingService _faceEmbeddingService;
|
||||
private readonly IAuthHelper _authHelper;
|
||||
|
||||
|
||||
[BindProperty] public IFormFile File { get; set; }
|
||||
@@ -61,13 +66,18 @@ namespace ServiceHost.Areas.AdminNew.Pages.Company.AndroidApk
|
||||
[Display(Name = "کد ورژن")]
|
||||
public string VersionCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// لاگ آپلود فرانت
|
||||
/// </summary>
|
||||
public string LogContent { get; set; }
|
||||
|
||||
[BindProperty] public ApkType SelectedApkType { get; set; }
|
||||
[BindProperty] public bool IsForce { get; set; }
|
||||
|
||||
public IndexModel(IAndroidApkVersionApplication application, IRollCallDomainService rollCallDomainService,
|
||||
CompanyContext context, AccountContext accountContext, IHttpClientFactory httpClientFactory,
|
||||
IOptions<AppSettingConfiguration> appSetting,
|
||||
ITemporaryClientRegistrationApplication clientRegistrationApplication, IOnlinePayment onlinePayment, IFaceEmbeddingService faceEmbeddingService)
|
||||
ITemporaryClientRegistrationApplication clientRegistrationApplication, IOnlinePayment onlinePayment, IFaceEmbeddingService faceEmbeddingService, IAuthHelper authHelper)
|
||||
{
|
||||
_application = application;
|
||||
_rollCallDomainService = rollCallDomainService;
|
||||
@@ -77,6 +87,7 @@ namespace ServiceHost.Areas.AdminNew.Pages.Company.AndroidApk
|
||||
_clientRegistrationApplication = clientRegistrationApplication;
|
||||
_onlinePayment = onlinePayment;
|
||||
_faceEmbeddingService = faceEmbeddingService;
|
||||
_authHelper = authHelper;
|
||||
_paymentGateway = new SepehrPaymentGateway(httpClientFactory);
|
||||
}
|
||||
|
||||
@@ -292,6 +303,105 @@ namespace ServiceHost.Areas.AdminNew.Pages.Company.AndroidApk
|
||||
//TranslateCode(result?.ErrorCode);
|
||||
return Page();
|
||||
}
|
||||
[DisableConcurrentExecution(timeoutInSeconds: 120)]
|
||||
public async Task<IActionResult> OnPostUploadFrontEnd(CancellationToken cancellationToken)
|
||||
{
|
||||
var validAccountId = _authHelper.CurrentAccountId();
|
||||
if (validAccountId == 2 || validAccountId == 322)
|
||||
{
|
||||
var batPath = @"C:\next-ui\deploy-next-ui.bat";
|
||||
|
||||
var psi = new ProcessStartInfo
|
||||
{
|
||||
FileName = batPath,
|
||||
UseShellExecute = true, // خیلی مهم
|
||||
Verb = "runas", // اجرای Administrator
|
||||
CreateNoWindow = true,
|
||||
WindowStyle = ProcessWindowStyle.Hidden
|
||||
};
|
||||
|
||||
Process.Start(psi);
|
||||
|
||||
TempData["Message"] = "فرآیند Deploy شروع شد. لاگ را بررسی کنید.";
|
||||
return RedirectToPage();
|
||||
}
|
||||
return Forbid();
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// افزودن آی دی طرف حساب به کارگاه
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[DisableConcurrentExecution(timeoutInSeconds: 120)]
|
||||
public async Task<IActionResult> OnPostContractingPartyToWorkshop()
|
||||
{
|
||||
var workshops = await _context.Workshops.Where(x => x.ContractingPartyId == 0).ToListAsync();
|
||||
|
||||
var worskhopEmployeer = await _context.WorkshopEmployers.Include(x => x.Employer).ToListAsync();
|
||||
|
||||
var contractingParties = await _context.PersonalContractingParties.ToListAsync();
|
||||
|
||||
foreach (var workshop in workshops)
|
||||
{
|
||||
var employers = worskhopEmployeer.Where(x => x.WorkshopId == workshop.id);
|
||||
var contractingPartyIdList = new List<long>();
|
||||
foreach (var employer in employers)
|
||||
{
|
||||
if (contractingParties.Any(x => x.id == employer.Employer.ContractingPartyId))
|
||||
{
|
||||
contractingPartyIdList.Add(employer.Employer.ContractingPartyId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (contractingPartyIdList.Count > 0)
|
||||
{
|
||||
|
||||
|
||||
if (contractingPartyIdList.Count == 1)
|
||||
{
|
||||
workshop.AddContractingPartyId(contractingPartyIdList[0]);
|
||||
await _context.SaveChangesAsync();
|
||||
}
|
||||
else
|
||||
{
|
||||
var idDistinct = contractingPartyIdList.Distinct().ToList();
|
||||
if (idDistinct.Count == 1)
|
||||
{
|
||||
workshop.AddContractingPartyId(contractingPartyIdList[0]);
|
||||
await _context.SaveChangesAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ViewData["message"] = "آی دی های طرف حساب اضافه شد";
|
||||
return Page();
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// دریافت لاگ آپلود فرانت
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public IActionResult OnGetLog()
|
||||
{
|
||||
var validAccountId = _authHelper.CurrentAccountId();
|
||||
if (validAccountId == 2 || validAccountId == 322)
|
||||
{
|
||||
var logPath = @"C:\next-ui\log.txt";
|
||||
if (!System.IO.File.Exists(logPath))
|
||||
return Content("Log file not found.");
|
||||
|
||||
var content = System.IO.File.ReadAllText(logPath, Encoding.UTF8);
|
||||
return Content(content);
|
||||
}
|
||||
return Content("شما مجاز به دیدن لاگ نیستید");
|
||||
|
||||
}
|
||||
|
||||
|
||||
public async System.Threading.Tasks.Task OnGetCallback(string? transid, string? cardnumber,
|
||||
string? tracking_number, string status)
|
||||
@@ -840,8 +950,8 @@ namespace ServiceHost.Areas.AdminNew.Pages.Company.AndroidApk
|
||||
contract => contract.ContractingPartyId,
|
||||
contractingParty => contractingParty.id,
|
||||
(contract, contractingParty) => new { contract, contractingParty });
|
||||
|
||||
|
||||
|
||||
|
||||
var remoteContractsQuery = query
|
||||
.Where(x => x.contractingParty.Employers
|
||||
.Any(e => e.WorkshopEmployers
|
||||
|
||||
@@ -19,15 +19,4 @@ public class InsuranceController:ClientBaseController
|
||||
var insurances =await _insuranceListApplication.GetInsuranceClientList(searchModel);
|
||||
return Ok(insurances);
|
||||
}
|
||||
|
||||
[HttpGet("print-one")]
|
||||
public async Task<ActionResult<InsuranceClientPrintViewModel>> ClientPrintList(long id)
|
||||
{
|
||||
InsuranceClientPrintViewModel res = await _insuranceListApplication.ClientPrintOne(id);
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
public class InsuranceClientViewModel
|
||||
{
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user