Compare commits

...

7 Commits

22 changed files with 11447 additions and 28 deletions

View File

@@ -79,4 +79,5 @@ public interface IEmployeeRepository : IRepository<long, Employee>
#endregion #endregion
Task<List<EmployeeSelectListViewModel>> GetWorkingEmployeesSelectList(long workshopId);
} }

View File

@@ -6,6 +6,7 @@ using _0_Framework.Application;
using _0_Framework.Domain; using _0_Framework.Domain;
using CompanyManagment.App.Contracts.InstitutionContract; using CompanyManagment.App.Contracts.InstitutionContract;
using CompanyManagment.App.Contracts.Workshop; using CompanyManagment.App.Contracts.Workshop;
using Microsoft.AspNetCore.Mvc;
namespace Company.Domain.InstitutionContractAgg; namespace Company.Domain.InstitutionContractAgg;
@@ -75,4 +76,5 @@ public interface IInstitutionContractRepository : IRepository<long, InstitutionC
#endregion #endregion
Task<List<InstitutionContractSelectListViewModel>> GetInstitutionContractSelectList(string search, string selected); Task<List<InstitutionContractSelectListViewModel>> GetInstitutionContractSelectList(string search, string selected);
Task<List<InstitutionContractPrintViewModel>> PrintAllAsync(List<long> ids);
} }

View File

@@ -125,6 +125,8 @@ public class InstitutionContract : EntityBase
public string VerifyCode { get; private set; } public string VerifyCode { get; private set; }
public DateTime VerifyCodeCreation { get; private set; } public DateTime VerifyCodeCreation { get; private set; }
public string VerifierFullName { get; private set; }
public string VerifierPhoneNumber { get; private set; }
[NotMapped] public bool VerifyCodeExpired => VerifyCodeCreation.Add(ExpireTime) <= DateTime.Now; [NotMapped] public bool VerifyCodeExpired => VerifyCodeCreation.Add(ExpireTime) <= DateTime.Now;
@@ -225,10 +227,12 @@ public class InstitutionContract : EntityBase
} }
public void SetVerifyCode(string code) public void SetVerifyCode(string code,string verifierFullName, string verifierPhoneNumber)
{ {
VerifyCode = code; VerifyCode = code;
VerifyCodeCreation = DateTime.Now; VerifyCodeCreation = DateTime.Now;
VerifierFullName = verifierFullName;
VerifierPhoneNumber = verifierPhoneNumber;
} }
public void SetWorkshopGroup(InstitutionContractWorkshopGroup workshopGroup) public void SetWorkshopGroup(InstitutionContractWorkshopGroup workshopGroup)
@@ -276,11 +280,19 @@ public class InstitutionContractAmendment : EntityBase
public long LawId { get; set; } public long LawId { get; set; }
public void SetVerifyCode(string code) public void SetVerifyCode(string code,string verifierFullName, string verifierPhoneNumber)
{ {
VerifyCode = code; VerifyCode = code;
VerificationCreation = DateTime.Now; VerifyCodeCreation = DateTime.Now;
VerifierFullName = verifierFullName;
VerifierPhoneNumber = verifierPhoneNumber;
} }
public string VerifierPhoneNumber { get; private set; }
public string VerifierFullName { get; private set; }
public DateTime VerifyCodeCreation { get; set; }
} }
public class InstitutionContractAmendmentChange : EntityBase public class InstitutionContractAmendmentChange : EntityBase

View File

@@ -25,7 +25,7 @@ namespace Company.Domain.RollCallAgg
DateTime endSearch); DateTime endSearch);
void RemoveEmployeeRollCallsInDate(long workshopId, long employeeId, DateTime date); void RemoveEmployeeRollCallsInDate(long workshopId, long employeeId, DateTime date);
RollCallsByDateViewModel GetWorkshopRollCallHistory(RollCallSearchModel searchModel); RollCallsByDateViewModel GetWorkshopRollCallHistory(RollCallSearchModel searchModel);
CurrentDayRollCall GetWorkshopCurrentDayRollCalls(long workshopId); CurrentDayRollCall GetWorkshopCurrentDayRollCalls(long workshopId,WorkshopCurrentDayRollCallSearchModel searchModel);
List<PersonnelCheckoutDailyRollCallViewModel> GetEmployeeRollCallsForMonth(IEnumerable<long> employeeIds, List<PersonnelCheckoutDailyRollCallViewModel> GetEmployeeRollCallsForMonth(IEnumerable<long> employeeIds,
long workshopId, DateTime start, DateTime end); long workshopId, DateTime start, DateTime end);

View File

@@ -76,6 +76,7 @@ public interface IEmployeeApplication
Task<List<EmployeeSelectListViewModel>> WorkedEmployeesInWorkshopSelectList(long workshopId); Task<List<EmployeeSelectListViewModel>> WorkedEmployeesInWorkshopSelectList(long workshopId);
Task<OperationResult<EmployeeDataFromApiViewModel>> GetEmployeeDataFromApi(string nationalCode, string birthDate); Task<OperationResult<EmployeeDataFromApiViewModel>> GetEmployeeDataFromApi(string nationalCode, string birthDate);
Task<List<EmployeeSelectListViewModel>> GetWorkingEmployeesSelectList(long workshopId);
#endregion #endregion

View File

@@ -7,6 +7,7 @@ using System.Threading.Tasks;
using _0_Framework.Application; using _0_Framework.Application;
using _0_Framework.Application.Sms; using _0_Framework.Application.Sms;
using CompanyManagment.App.Contracts.Checkout; using CompanyManagment.App.Contracts.Checkout;
using CompanyManagment.App.Contracts.Law;
using CompanyManagment.App.Contracts.TemporaryClientRegistration; using CompanyManagment.App.Contracts.TemporaryClientRegistration;
using CompanyManagment.App.Contracts.Workshop; using CompanyManagment.App.Contracts.Workshop;
using CompanyManagment.App.Contracts.WorkshopPlan; using CompanyManagment.App.Contracts.WorkshopPlan;
@@ -77,6 +78,8 @@ public interface IInstitutionContractApplication
/// <returns>لیست قراردادها برای چاپ</returns> /// <returns>لیست قراردادها برای چاپ</returns>
List<InstitutionContractViewModel> PrintAll(List<long> id); List<InstitutionContractViewModel> PrintAll(List<long> id);
[Obsolete("استفاده نشود، از متد غیرهمزمان استفاده شود")]
/// <summary> /// <summary>
/// چاپ یک قرارداد /// چاپ یک قرارداد
/// </summary> /// </summary>
@@ -241,6 +244,33 @@ public interface IInstitutionContractApplication
#endregion #endregion
Task<OperationResult> ResendVerifyLink(long institutionContractId); Task<OperationResult> ResendVerifyLink(long institutionContractId);
/// <summary>
/// دیتای پرینت قرارداد مالی
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
Task<InstitutionContractPrintViewModel> PrintOneAsync(long id);
}
public class InstitutionContractPrintViewModel
{
public InstitutionContratVerificationParty FirstParty { get; set; }
public InstitutionContratVerificationParty SecondParty { get; set; }
public string ContractNo { get; set; }
public string CreationDate { get; set; }
public string ContractStart { get; set; }
public string ContractEnd { get; set; }
public List<GetInstitutionVerificationDetailsWorkshopsViewModel> Workshops { get; set; }
public string TotalPrice { get; set; }
public string TaxPrice { get; set; }
public string PaymentPrice { get; set; }
public string VerifyCode { get; set; }
public string VerifyDateTime { get; set; }
public string VerifierFullName { get; set; }
public string VerifierPhoneNumber { get; set; }
public LawViewModel LawViewModel { get; set; }
public string Obligation { get; set; }
} }
public class InsertAmendmentTempWorkshopResponse public class InsertAmendmentTempWorkshopResponse

View File

@@ -79,7 +79,7 @@ namespace CompanyManagment.App.Contracts.RollCall
/// <summary> /// <summary>
/// گزارش آنلاین حضور غیاب /// گزارش آنلاین حضور غیاب
/// </summary> /// </summary>
CurrentDayRollCall GetWorkshopCurrentDayRollCalls(long workshopId); CurrentDayRollCall GetWorkshopCurrentDayRollCalls(long workshopId,WorkshopCurrentDayRollCallSearchModel searchModel);
/// <summary> /// <summary>
/// گزارش آفلاین حضور غیاب کارگاه /// گزارش آفلاین حضور غیاب کارگاه
@@ -126,6 +126,13 @@ namespace CompanyManagment.App.Contracts.RollCall
/// <returns></returns> /// <returns></returns>
OperationResult RecalculateValues(long workshopId, List<ReCalculateRollCallValues> command); OperationResult RecalculateValues(long workshopId, List<ReCalculateRollCallValues> command);
} }
public class WorkshopCurrentDayRollCallSearchModel
{
public long EmployeeId { get; set; }
public int PersonnelCode { get; set; }
}
public class ReCalculateRollCallValues public class ReCalculateRollCallValues
{ {
public long EmployeeId { get; set; } public long EmployeeId { get; set; }

View File

@@ -1676,6 +1676,10 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
} }
public async Task<List<EmployeeSelectListViewModel>> GetWorkingEmployeesSelectList(long workshopId)
{
return await _EmployeeRepository.GetWorkingEmployeesSelectList(workshopId);
}
#endregion #endregion

View File

@@ -1203,7 +1203,12 @@ public class InstitutionContractApplication : IInstitutionContractApplication
throw new NotFoundException("طرف قرارداد یافت نشد"); throw new NotFoundException("طرف قرارداد یافت نشد");
var code = new Random().Next(1000, 9999).ToString(); var code = new Random().Next(1000, 9999).ToString();
institutionContract.SetVerifyCode(code);
var contractingPartyFullName = contractingParty.IsLegal == "حقیقی"
? contractingParty.FName + " " + contractingParty.LName
: contractingParty.CeoFName + " " + contractingParty.CeoLName;
institutionContract.SetVerifyCode(code,contractingPartyFullName ,contractingParty.Phone);
var transaction = await _institutionContractRepository.BeginTransactionAsync(); var transaction = await _institutionContractRepository.BeginTransactionAsync();
try try
@@ -1377,6 +1382,11 @@ public class InstitutionContractApplication : IInstitutionContractApplication
return new OperationResult().Succcedded(); return new OperationResult().Succcedded();
} }
public async Task<InstitutionContractPrintViewModel> PrintOneAsync(long id)
{
return (await _institutionContractRepository.PrintAllAsync([id])).FirstOrDefault();
}
private async Task<OperationResult<PersonalContractingParty>> CreateLegalContractingPartyEntity( private async Task<OperationResult<PersonalContractingParty>> CreateLegalContractingPartyEntity(
CreateInstitutionContractLegalPartyRequest request, long representativeId, string address, string city, CreateInstitutionContractLegalPartyRequest request, long representativeId, string address, string city,

View File

@@ -144,9 +144,9 @@ public class RollCallApplication : IRollCallApplication
return _rollCallRepository.GetWorkshopRollCallHistory(searchModel); return _rollCallRepository.GetWorkshopRollCallHistory(searchModel);
} }
public CurrentDayRollCall GetWorkshopCurrentDayRollCalls(long workshopId) public CurrentDayRollCall GetWorkshopCurrentDayRollCalls(long workshopId, WorkshopCurrentDayRollCallSearchModel searchModel)
{ {
return _rollCallRepository.GetWorkshopCurrentDayRollCalls(workshopId); return _rollCallRepository.GetWorkshopCurrentDayRollCalls(workshopId, searchModel);
} }
public List<CheckoutDailyRollCallViewModel> GetActiveEmployeeRollCallsForDuration(long employeeId, long workshopId, string startDate, public List<CheckoutDailyRollCallViewModel> GetActiveEmployeeRollCallsForDuration(long employeeId, long workshopId, string startDate,

View File

@@ -12,6 +12,8 @@ public class InstitutionContractAmendmentMapping:IEntityTypeConfiguration<Instit
builder.HasKey(x => x.id); builder.HasKey(x => x.id);
builder.Property(x => x.VerifyCode).HasMaxLength(10); builder.Property(x => x.VerifyCode).HasMaxLength(10);
builder.Property(x => x.VerifierFullName).HasMaxLength(100);
builder.Property(x => x.VerifierPhoneNumber).HasMaxLength(20);
builder.HasOne(x => x.InstitutionContract) builder.HasOne(x => x.InstitutionContract)
.WithMany(x => x.Amendments) .WithMany(x => x.Amendments)

View File

@@ -30,6 +30,8 @@ public class InstitutionContractMapping : IEntityTypeConfiguration<InstitutionCo
builder.Property(x => x.HasValueAddedTax).HasMaxLength(10); builder.Property(x => x.HasValueAddedTax).HasMaxLength(10);
builder.Property(x => x.VerifyCode).HasMaxLength(20); builder.Property(x => x.VerifyCode).HasMaxLength(20);
builder.Property(x => x.VerifierFullName).HasMaxLength(100);
builder.Property(x => x.VerifierPhoneNumber).HasMaxLength(20);
builder.Property(x => x.VerificationStatus).HasConversion<string>().HasMaxLength(122); builder.Property(x => x.VerificationStatus).HasConversion<string>().HasMaxLength(122);

View File

@@ -0,0 +1,74 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace CompanyManagment.EFCore.Migrations
{
/// <inheritdoc />
public partial class AddVerifierdetailsininstituioncontractandamendment : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "VerifierFullName",
table: "InstitutionContracts",
type: "nvarchar(100)",
maxLength: 100,
nullable: true);
migrationBuilder.AddColumn<string>(
name: "VerifierPhoneNumber",
table: "InstitutionContracts",
type: "nvarchar(20)",
maxLength: 20,
nullable: true);
migrationBuilder.AddColumn<string>(
name: "VerifierFullName",
table: "InstitutionContractAmendments",
type: "nvarchar(100)",
maxLength: 100,
nullable: true);
migrationBuilder.AddColumn<string>(
name: "VerifierPhoneNumber",
table: "InstitutionContractAmendments",
type: "nvarchar(20)",
maxLength: 20,
nullable: true);
migrationBuilder.AddColumn<DateTime>(
name: "VerifyCodeCreation",
table: "InstitutionContractAmendments",
type: "datetime2",
nullable: false,
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "VerifierFullName",
table: "InstitutionContracts");
migrationBuilder.DropColumn(
name: "VerifierPhoneNumber",
table: "InstitutionContracts");
migrationBuilder.DropColumn(
name: "VerifierFullName",
table: "InstitutionContractAmendments");
migrationBuilder.DropColumn(
name: "VerifierPhoneNumber",
table: "InstitutionContractAmendments");
migrationBuilder.DropColumn(
name: "VerifyCodeCreation",
table: "InstitutionContractAmendments");
}
}
}

View File

@@ -3205,6 +3205,14 @@ namespace CompanyManagment.EFCore.Migrations
.HasMaxLength(122) .HasMaxLength(122)
.HasColumnType("nvarchar(122)"); .HasColumnType("nvarchar(122)");
b.Property<string>("VerifierFullName")
.HasMaxLength(100)
.HasColumnType("nvarchar(100)");
b.Property<string>("VerifierPhoneNumber")
.HasMaxLength(20)
.HasColumnType("nvarchar(20)");
b.Property<string>("VerifyCode") b.Property<string>("VerifyCode")
.HasMaxLength(20) .HasMaxLength(20)
.HasColumnType("nvarchar(20)"); .HasColumnType("nvarchar(20)");
@@ -3247,10 +3255,21 @@ namespace CompanyManagment.EFCore.Migrations
b.Property<DateTime>("VerificationCreation") b.Property<DateTime>("VerificationCreation")
.HasColumnType("datetime2"); .HasColumnType("datetime2");
b.Property<string>("VerifierFullName")
.HasMaxLength(100)
.HasColumnType("nvarchar(100)");
b.Property<string>("VerifierPhoneNumber")
.HasMaxLength(20)
.HasColumnType("nvarchar(20)");
b.Property<string>("VerifyCode") b.Property<string>("VerifyCode")
.HasMaxLength(10) .HasMaxLength(10)
.HasColumnType("nvarchar(10)"); .HasColumnType("nvarchar(10)");
b.Property<DateTime>("VerifyCodeCreation")
.HasColumnType("datetime2");
b.HasKey("id"); b.HasKey("id");
b.HasIndex("InstitutionContractId"); b.HasIndex("InstitutionContractId");

View File

@@ -1062,5 +1062,29 @@ public class EmployeeRepository : RepositoryBase<long, Employee>, IEmployeeRepos
} }
#endregion public async Task<List<EmployeeSelectListViewModel>> GetWorkingEmployeesSelectList(long workshopId)
{
var dateNow = DateTime.Now.Date;
var workshopActiveLeftWorksQuery = _context.LeftWorkList.Where(x => x.WorkshopId == workshopId &&
x.StartWorkDate <= dateNow && x.LeftWorkDate > dateNow);
var workshopActiveInsuranceLeftWorksQuery = _context.LeftWorkInsuranceList.Where(x => x.WorkshopId == workshopId &&
x.StartWorkDate <= dateNow && (x.LeftWorkDate > dateNow || x.LeftWorkDate == null));
var employeesQuery = _context.Employees.Where(x => workshopActiveLeftWorksQuery.Any(y => y.EmployeeId == x.id) ||
workshopActiveInsuranceLeftWorksQuery.Any(y => y.EmployeeId == x.id));
return await employeesQuery.Select(x => new EmployeeSelectListViewModel()
{
Id = x.id,
EmployeeFullName = x.FullName
}).ToListAsync();
}
#endregion
} }

View File

@@ -25,9 +25,11 @@ using Company.Domain.WorkshopAgg;
using CompanyManagment.App.Contracts.Employer; using CompanyManagment.App.Contracts.Employer;
using CompanyManagment.App.Contracts.InstitutionContract; using CompanyManagment.App.Contracts.InstitutionContract;
using CompanyManagment.App.Contracts.InstitutionContractContactinfo; using CompanyManagment.App.Contracts.InstitutionContractContactinfo;
using CompanyManagment.App.Contracts.Law;
using CompanyManagment.App.Contracts.TemporaryClientRegistration; using CompanyManagment.App.Contracts.TemporaryClientRegistration;
using CompanyManagment.App.Contracts.Workshop; using CompanyManagment.App.Contracts.Workshop;
using CompanyManagment.App.Contracts.WorkshopPlan; using CompanyManagment.App.Contracts.WorkshopPlan;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
@@ -48,6 +50,16 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
private readonly IPlanPercentageRepository _planPercentageRepository; private readonly IPlanPercentageRepository _planPercentageRepository;
private readonly ISmsService _smsService; private readonly ISmsService _smsService;
private readonly InstitutionContratVerificationParty _firstParty = new()
{
Address = "رشت - خیابان حاجی آیاد - کوچه سپهدار - ساختمان داماش - واحد 17",
PhoneNumber = "09111485044",
CeoName = "سید حسن مصباح",
CompanyNameOrFullName = "نور داد مهر گستر کاسپین",
NationalCodeOrNationalId = "14009970584",
LegalType = LegalType.Legal
};
public InstitutionContractRepository(CompanyContext context, IEmployerRepository employerRepository, public InstitutionContractRepository(CompanyContext context, IEmployerRepository employerRepository,
IWorkshopRepository workshopRepository, IMongoDatabase database, IWorkshopRepository workshopRepository, IMongoDatabase database,
IPlanPercentageRepository planPercentageRepository, ISmsService smsService) : base(context) IPlanPercentageRepository planPercentageRepository, ISmsService smsService) : base(context)
@@ -1799,15 +1811,7 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
query.party.IsLegal == "حقیقی" ? query.party.Nationalcode : query.party.NationalId, query.party.IsLegal == "حقیقی" ? query.party.Nationalcode : query.party.NationalId,
LegalType = query.party.IsLegal == "حقیقی" ? LegalType.Real : LegalType.Legal, LegalType = query.party.IsLegal == "حقیقی" ? LegalType.Real : LegalType.Legal,
}, },
FirstParty = new InstitutionContratVerificationParty() FirstParty =_firstParty
{
Address = "رشت - خیابان حاجی آیاد - کوچه سپهدار - ساختمان داماش - واحد 17",
PhoneNumber = "09111111111",
CeoName = "سید حسن مصباح",
CompanyNameOrFullName = "نور داد مهر گستر کاسپین",
NationalCodeOrNationalId = "1111111111",
LegalType = LegalType.Legal
}
}; };
return res; return res;
@@ -2655,6 +2659,112 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
} }
public async Task<List<InstitutionContractPrintViewModel>> PrintAllAsync(List<long> ids)
{
var query =_context.InstitutionContractSet
.Include(x=>x.WorkshopGroup)
.ThenInclude(x=>x.InitialWorkshops)
.Include(x=>x.WorkshopGroup)
.ThenInclude(x=>x.CurrentWorkshops)
.Where(x=>ids.Contains(x.id));
var contractingPartyIds = query.Select(x => x.ContractingPartyId).ToList();
var contractingParties = await _context.PersonalContractingParties
.Where(x => contractingPartyIds.Contains(x.id))
.ToListAsync();
var list = query.ToList();
if (list.Count == 0)
throw new NotFoundException("قرارداد مؤسسه یافت نشد");
var res = new List<InstitutionContractPrintViewModel>();
foreach (var institution in list)
{
var contractingParty = contractingParties.FirstOrDefault(x => x.id == institution.ContractingPartyId);
if (contractingParty == null)
{
throw new NotFoundException("طرف حساب یافت نشد");
}
var law = await _context.Laws
.FirstOrDefaultAsync(x => x.id == institution.LawId);
var secondParty = new InstitutionContratVerificationParty()
{
Address = contractingParty.Address,
PhoneNumber = contractingParty.Phone,
CeoName = contractingParty.IsLegal == "حقیقی"
? $"{contractingParty.FName} {contractingParty.LName}"
: $"{contractingParty.CeoFName} {contractingParty.CeoLName}",
CompanyNameOrFullName = contractingParty.IsLegal == "حقیقی"
? $"{contractingParty.FName} {contractingParty.LName}"
: contractingParty.LName,
NationalCodeOrNationalId =
contractingParty.IsLegal == "حقیقی" ? contractingParty.Nationalcode : contractingParty.NationalId,
LegalType = contractingParty.IsLegal == "حقیقی" ? LegalType.Real : LegalType.Legal,
};
var lawViewModel = new LawViewModel()
{
Id = law.id,
CreatedAt = law.CreationDate,
HeadTitle = law.HeadTitle,
IsActive = law.IsActive,
Items = law.Items.Select(x => new LawItemViewModel()
{
Details = x.Details,
Header = x.Header
}).ToList(),
Notifications = law.Notifications,
Title = law.Title,
Type = law.Type,
Version = law.Version
};
var item = new InstitutionContractPrintViewModel()
{
ContractStart = institution.ContractStartFa,
ContractEnd = institution.ContractEndFa,
ContractNo = institution.ContractNo,
CreationDate = institution.CreationDate.ToFarsi(),
FirstParty = _firstParty,
SecondParty = secondParty,
LawViewModel = lawViewModel,
Obligation = institution.Obligation.ToMoney(),
PaymentPrice = institution.TotalAmount.ToMoney(),
TotalPrice = (institution.TotalAmount - institution.ValueAddedTax).ToMoney(),
TaxPrice = institution.ValueAddedTax.ToMoney(),
VerifierFullName = institution.VerifierFullName,
VerifierPhoneNumber = institution.VerifierPhoneNumber,
VerifyCode = institution.VerifyCode,
VerifyDateTime = institution.VerifyCodeCreation.ToFarsi(),
Workshops = institution.WorkshopGroup.CurrentWorkshops
.Select(x => new GetInstitutionVerificationDetailsWorkshopsViewModel()
{
Name = x.WorkshopName,
PersonnelCount = x.PersonnelCount,
Services = new WorkshopServicesViewModel()
{
Contract = x.Services.Contract,
ContractInPerson = x.Services.ContractInPerson,
CustomizeCheckout = x.Services.CustomizeCheckout,
Insurance = x.Services.Insurance,
InsuranceInPerson = x.Services.InsuranceInPerson,
RollCall = x.Services.RollCall,
RollCallInPerson = x.Services.RollCallInPerson
},
Price = x.Price.ToMoney()
}).ToList()
};
res.Add(item);
}
return res;
}
private InstitutionContractExtensionPaymentResponse CalculateInPersonPayment( private InstitutionContractExtensionPaymentResponse CalculateInPersonPayment(
InstitutionContractExtensionPlanDetail selectedPlan, double baseAmount, double tenPercent, InstitutionContractExtensionPlanDetail selectedPlan, double baseAmount, double tenPercent,

View File

@@ -1052,11 +1052,11 @@ public class RollCallRepository : RepositoryBase<long, RollCall>, IRollCallRepos
//گزارش آنلاین حضور غیاب کارگاه //گزارش آنلاین حضور غیاب کارگاه
public CurrentDayRollCall GetWorkshopCurrentDayRollCalls(long workshopId) public CurrentDayRollCall GetWorkshopCurrentDayRollCalls(long workshopId,
WorkshopCurrentDayRollCallSearchModel searchModel)
{ {
var date = DateTime.Now.Date; var date = DateTime.Now.Date;
//get active leaves for workshop which are active today and accepted and are either روزانه and استحقاقی or استعلاجی //get active leaves for workshop which are active today and accepted and are either روزانه and استحقاقی or استعلاجی
var leaves = _context.LeaveList var leaves = _context.LeaveList
.Where(x => .Where(x =>
@@ -1070,7 +1070,11 @@ public class RollCallRepository : RepositoryBase<long, RollCall>, IRollCallRepos
//var workingEmployees = //var workingEmployees =
// _context.LeftWorkList.Where(x => x.WorkshopId == workshopId && x.StartWorkDate < date && x.LeftWorkDate.Date > date); // _context.LeftWorkList.Where(x => x.WorkshopId == workshopId && x.StartWorkDate < date && x.LeftWorkDate.Date > date);
if (searchModel.PersonnelCode>0)
{
personnelCodes = personnelCodes.Where(x=>x.PersonnelCode == searchModel.PersonnelCode);
}
//get activated employees //get activated employees
var activeEmployees = var activeEmployees =
@@ -1084,6 +1088,15 @@ public class RollCallRepository : RepositoryBase<long, RollCall>, IRollCallRepos
x.WorkshopId == workshopId && (x.ShiftDate.Date == date || x.EndDate == null) && x.RollCallModifyType != RollCallModifyType.Undefined); x.WorkshopId == workshopId && (x.ShiftDate.Date == date || x.EndDate == null) && x.RollCallModifyType != RollCallModifyType.Undefined);
if (searchModel.EmployeeId>0)
{
leaves = leaves.Where(x=>x.WorkshopId == searchModel.EmployeeId);
personnelCodes = personnelCodes.Where(x=>x.EmployeeId == searchModel.EmployeeId);
activeEmployees = activeEmployees.Where(x=>x.EmployeeId == searchModel.EmployeeId);
rollCallsQuery = rollCallsQuery.Where(x=>x.EmployeeId == searchModel.EmployeeId);
}
var mustBePresent = activeEmployees.Where(x => !leaves.Any(y => y.EmployeeId == x.EmployeeId)); var mustBePresent = activeEmployees.Where(x => !leaves.Any(y => y.EmployeeId == x.EmployeeId));

View File

@@ -744,6 +744,12 @@ public class institutionContractController : AdminBaseController
return result; return result;
} }
[HttpGet("print/{id}")]
public async Task<ActionResult<InstitutionContractPrintViewModel>> PrintOne(long id)
{
var res =await _institutionContractApplication.PrintOneAsync(id);
return res;
}
} }

View File

@@ -43,7 +43,7 @@ namespace ServiceHost.Areas.AdminNew.Pages.Company.RollCall
WorkshopId = workshopId, WorkshopId = workshopId,
}; };
RollCallViewModels = _rollCallApplication.GetWorkshopCurrentDayRollCalls(workshopId); RollCallViewModels = _rollCallApplication.GetWorkshopCurrentDayRollCalls(workshopId, new WorkshopCurrentDayRollCallSearchModel());
return Page(); return Page();
} }
else else
@@ -56,7 +56,7 @@ namespace ServiceHost.Areas.AdminNew.Pages.Company.RollCall
public IActionResult OnGetCurrentDayAjax(string type, long workshopId) public IActionResult OnGetCurrentDayAjax(string type, long workshopId)
{ {
RollCallViewModels = _rollCallApplication.GetWorkshopCurrentDayRollCalls(workshopId); RollCallViewModels = _rollCallApplication.GetWorkshopCurrentDayRollCalls(workshopId, new WorkshopCurrentDayRollCallSearchModel());
List<object> data = new(); List<object> data = new();
switch (type) switch (type)
@@ -83,7 +83,7 @@ namespace ServiceHost.Areas.AdminNew.Pages.Company.RollCall
public IActionResult OnGetCurrentAjaxCount(long workshopId) public IActionResult OnGetCurrentAjaxCount(long workshopId)
{ {
RollCallViewModels = _rollCallApplication.GetWorkshopCurrentDayRollCalls(workshopId); RollCallViewModels = _rollCallApplication.GetWorkshopCurrentDayRollCalls(workshopId, new WorkshopCurrentDayRollCallSearchModel());
var absentEmployeesCount = RollCallViewModels.AbsentEmployees.Count(x => !x.HasLeave); var absentEmployeesCount = RollCallViewModels.AbsentEmployees.Count(x => !x.HasLeave);
var leaveEmployeesCount = RollCallViewModels.AbsentEmployees.Count(x => x.HasLeave); var leaveEmployeesCount = RollCallViewModels.AbsentEmployees.Count(x => x.HasLeave);

View File

@@ -0,0 +1,35 @@
using _0_Framework.Application;
using Company.Domain.CheckoutAgg;
using CompanyManagment.App.Contracts.Employee;
using CompanyManagment.App.Contracts.RollCall;
using Microsoft.AspNetCore.Mvc;
using ServiceHost.BaseControllers;
namespace ServiceHost.Areas.Client.Controllers;
public class RollCallController:ClientBaseController
{
private long _workshopId;
private readonly IRollCallApplication _rollCallApplication;
private readonly IEmployeeApplication _employeeApplication;
public RollCallController(IRollCallApplication rollCallApplication,IAuthHelper authHelper, IEmployeeApplication employeeApplication)
{
_rollCallApplication = rollCallApplication;
_employeeApplication = employeeApplication;
_workshopId = authHelper.GetWorkshopId();
}
[HttpGet("current-day")]
public ActionResult<CurrentDayRollCall> GetCurrentDay(WorkshopCurrentDayRollCallSearchModel searchModel)
{
var res = _rollCallApplication.GetWorkshopCurrentDayRollCalls(_workshopId, searchModel);
return res;
}
[HttpGet("employee-select-list")]
public async Task<ActionResult<List<EmployeeSelectListViewModel>>> GetEmployeeSelectList()
{
var res = await _employeeApplication.GetWorkingEmployeesSelectList(_workshopId);
return res;
}
}

View File

@@ -81,7 +81,7 @@ namespace ServiceHost.Areas.Client.Pages.Company.RollCall
WorkshopId = workshopId, WorkshopId = workshopId,
}; };
RollCallViewModels = _rollCallApplication.GetWorkshopCurrentDayRollCalls(workshopId); RollCallViewModels = _rollCallApplication.GetWorkshopCurrentDayRollCalls(workshopId, new WorkshopCurrentDayRollCallSearchModel());
return Page(); return Page();
} }
else else
@@ -103,7 +103,7 @@ namespace ServiceHost.Areas.Client.Pages.Company.RollCall
var workshopId = _passwordHasher.SlugDecrypt(workshopHash); var workshopId = _passwordHasher.SlugDecrypt(workshopHash);
if (workshopId > 0) if (workshopId > 0)
{ {
RollCallViewModels = _rollCallApplication.GetWorkshopCurrentDayRollCalls(workshopId); RollCallViewModels = _rollCallApplication.GetWorkshopCurrentDayRollCalls(workshopId, new WorkshopCurrentDayRollCallSearchModel());
List<object> data = new(); List<object> data = new();
switch (type) switch (type)
@@ -143,7 +143,7 @@ namespace ServiceHost.Areas.Client.Pages.Company.RollCall
var workshopId = _passwordHasher.SlugDecrypt(workshopHash); var workshopId = _passwordHasher.SlugDecrypt(workshopHash);
if (workshopId > 0) if (workshopId > 0)
{ {
RollCallViewModels = _rollCallApplication.GetWorkshopCurrentDayRollCalls(workshopId); RollCallViewModels = _rollCallApplication.GetWorkshopCurrentDayRollCalls(workshopId, new WorkshopCurrentDayRollCallSearchModel());
var absentEmployeesCount = RollCallViewModels.AbsentEmployees.Count(x => !x.HasLeave); var absentEmployeesCount = RollCallViewModels.AbsentEmployees.Count(x => !x.HasLeave);
var leaveEmployeesCount = RollCallViewModels.AbsentEmployees.Count(x => x.HasLeave); var leaveEmployeesCount = RollCallViewModels.AbsentEmployees.Count(x => x.HasLeave);