Compare commits
1 Commits
Feature/ro
...
Feature/In
| Author | SHA1 | Date | |
|---|---|---|---|
| d173738a04 |
@@ -24,10 +24,10 @@ public class AqayePardakhtPaymentGateway:IPaymentGateway
|
||||
{
|
||||
_httpClient = httpClientFactory.CreateClient();
|
||||
|
||||
if (appSetting.Value.Domain == ".dadmehrg.ir")
|
||||
{
|
||||
_pin = "7349F84E81AB584862D9";
|
||||
}
|
||||
// if (appSetting.Value.Domain == ".dadmehrg.ir")
|
||||
// {
|
||||
// _pin = "7349F84E81AB584862D9";
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -27,10 +27,9 @@ public interface ISmsService
|
||||
|
||||
Task<double> GetCreditAmount();
|
||||
|
||||
public Task<bool> SendInstitutionVerificationLink(string number, string fullName, Guid institutionId, long contractingPartyId, long institutionContractId);
|
||||
public Task<bool> SendInstitutionVerificationLink(string number,string fullName, Guid institutionId);
|
||||
|
||||
public Task<bool> SendInstitutionVerificationCode(string number, string code, string contractingPartyFullName,
|
||||
long contractingPartyId, long institutionContractId);
|
||||
public Task<bool> SendInstitutionVerificationCode(string number, string code);
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -1,30 +1,28 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices.ComTypes;
|
||||
using System.Security.AccessControl;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using _0_Framework.Application;
|
||||
using _0_Framework.Application.Sms;
|
||||
using Company.Domain.SmsResultAgg;
|
||||
using CompanyManagment.App.Contracts.SmsResult;
|
||||
using IPE.SmsIrClient;
|
||||
using IPE.SmsIrClient.Models.Requests;
|
||||
using IPE.SmsIrClient.Models.Results;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using static System.Runtime.InteropServices.JavaScript.JSType;
|
||||
|
||||
|
||||
namespace CompanyManagment.EFCore.Services;
|
||||
namespace _0_Framework.Application.Sms;
|
||||
|
||||
public class SmsService : ISmsService
|
||||
{
|
||||
private readonly IConfiguration _configuration;
|
||||
private readonly ISmsResultRepository _smsResultRepository;
|
||||
public SmsIr SmsIr { get; set; }
|
||||
|
||||
|
||||
public SmsService(IConfiguration configuration, ISmsResultRepository smsResultRepository)
|
||||
public SmsService(IConfiguration configuration)
|
||||
{
|
||||
_configuration = configuration;
|
||||
_smsResultRepository = smsResultRepository;
|
||||
SmsIr = new SmsIr("Og5M562igmzJRhQPnq0GdtieYdLgtfikjzxOmeQBPxJjZtyge5Klc046Lfw1mxSa");
|
||||
|
||||
}
|
||||
@@ -206,7 +204,8 @@ public class SmsService : ISmsService
|
||||
int pageSize = 100; // max: 100
|
||||
SmsIr smsIr = new SmsIr("Og5M562igmzJRhQPnq0GdtieYdLgtfikjzxOmeQBPxJjZtyge5Klc046Lfw1mxSa");
|
||||
var response = await smsIr.GetArchivedReportAsync(pageNumber, pageSize, unixTimestamp, unixTimestamp2);
|
||||
|
||||
|
||||
|
||||
MessageReportResult[] messages = response.Data;
|
||||
foreach (var message in messages)
|
||||
{
|
||||
@@ -332,7 +331,7 @@ public class SmsService : ISmsService
|
||||
}
|
||||
|
||||
}
|
||||
public async Task<bool> SendInstitutionVerificationLink(string number, string fullName, Guid institutionId, long contractingPartyId, long institutionContractId)
|
||||
public async Task<bool> SendInstitutionVerificationLink(string number,string fullName, Guid institutionId)
|
||||
{
|
||||
var guidStr=institutionId.ToString();
|
||||
var firstPart = guidStr.Substring(0, 15);
|
||||
@@ -343,25 +342,15 @@ public class SmsService : ISmsService
|
||||
new("CODE1",firstPart),
|
||||
new("CODE2",secondPart)
|
||||
});
|
||||
var smsResult = new SmsResult(verificationSendResult.Data.MessageId, verificationSendResult.Message, "لینک تاییدیه قرارداد مالی",
|
||||
fullName, number, contractingPartyId, institutionContractId);
|
||||
await _smsResultRepository.CreateAsync(smsResult);
|
||||
await _smsResultRepository.SaveChangesAsync();
|
||||
return verificationSendResult.Status == 0;
|
||||
}
|
||||
|
||||
public async Task<bool> SendInstitutionVerificationCode(string number, string code, string contractingPartyFullName,
|
||||
long contractingPartyId, long institutionContractId)
|
||||
public async Task<bool> SendInstitutionVerificationCode(string number, string code)
|
||||
{
|
||||
var verificationSendResult =await SmsIr.VerifySendAsync(number, 965348, new VerifySendParameter[]
|
||||
{
|
||||
new("VERIFYCODE", code)
|
||||
});
|
||||
|
||||
var smsResult = new SmsResult(verificationSendResult.Data.MessageId, verificationSendResult.Message, "کد تاییدیه قرارداد مالی",
|
||||
contractingPartyFullName, number, contractingPartyId, institutionContractId);
|
||||
await _smsResultRepository.CreateAsync(smsResult);
|
||||
await _smsResultRepository.SaveChangesAsync();
|
||||
return verificationSendResult.Status == 0;
|
||||
}
|
||||
|
||||
@@ -1,46 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using _0_Framework_b.Domain;
|
||||
|
||||
namespace Company.Domain.AuthorizedBankDetailsAgg
|
||||
{
|
||||
public class AuthorizedBankDetails : EntityBase
|
||||
{
|
||||
private AuthorizedBankDetails()
|
||||
{
|
||||
OwnersList = new List<AuthorizedBankDetailsOwner>();
|
||||
}
|
||||
|
||||
public AuthorizedBankDetails(string cardNumber, string accountNumber, string ban, string bankName, List<AuthorizedBankDetailsOwner> ownersList)
|
||||
{
|
||||
CardNumber = cardNumber;
|
||||
AccountNumber = accountNumber;
|
||||
IBan = ban;
|
||||
BankName = bankName;
|
||||
OwnersList = ownersList ?? new List<AuthorizedBankDetailsOwner>();
|
||||
}
|
||||
|
||||
public string CardNumber { get; private set; }
|
||||
public string AccountNumber { get; private set; }
|
||||
public string IBan { get; private set; }
|
||||
public string BankName { get; private set; }
|
||||
public List<AuthorizedBankDetailsOwner> OwnersList { get; private set; }
|
||||
}
|
||||
|
||||
public class AuthorizedBankDetailsOwner // Value Object - not inheriting from EntityBase
|
||||
{
|
||||
private AuthorizedBankDetailsOwner() { }
|
||||
|
||||
public AuthorizedBankDetailsOwner(string fName, string lName, string nationalIdentifier, string customerType)
|
||||
{
|
||||
FName = fName;
|
||||
LName = lName;
|
||||
NationalIdentifier = nationalIdentifier;
|
||||
CustomerType = customerType;
|
||||
}
|
||||
|
||||
public string FName { get; private set; }
|
||||
public string LName { get; private set; }
|
||||
public string NationalIdentifier { get; private set; }
|
||||
public string CustomerType { get; private set; }
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
using _0_Framework_b.Domain;
|
||||
using System.Collections.Generic;
|
||||
using Company.Application.Contracts.AuthorizedBankDetails;
|
||||
|
||||
namespace Company.Domain.AuthorizedBankDetailsAgg
|
||||
{
|
||||
public interface IAuthorizedBankDetailsRepository : IRepository<long, AuthorizedBankDetails>
|
||||
{
|
||||
EditAuthorizedBankDetails GetDetails(long id);
|
||||
List<AuthorizedBankDetailsViewModel> Search(AuthorizedBankDetailsSearchModel searchModel);
|
||||
AuthorizedBankDetailsViewModel GetByIban(string iban);
|
||||
}
|
||||
}
|
||||
@@ -79,5 +79,4 @@ public interface IEmployeeRepository : IRepository<long, Employee>
|
||||
#endregion
|
||||
|
||||
|
||||
Task<List<EmployeeSelectListViewModel>> GetWorkingEmployeesSelectList(long workshopId);
|
||||
}
|
||||
@@ -6,7 +6,6 @@ using _0_Framework.Application;
|
||||
using _0_Framework.Domain;
|
||||
using CompanyManagment.App.Contracts.InstitutionContract;
|
||||
using CompanyManagment.App.Contracts.Workshop;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace Company.Domain.InstitutionContractAgg;
|
||||
|
||||
@@ -66,15 +65,14 @@ public interface IInstitutionContractRepository : IRepository<long, InstitutionC
|
||||
|
||||
#endregion
|
||||
|
||||
#region Upgrade(Amendment)
|
||||
#region Upgrade(Amendment)
|
||||
|
||||
Task<InstitutionContractAmendmentWorkshopsResponse> GetAmendmentWorkshops(long institutionContractId);
|
||||
Task<InsitutionContractAmendmentPaymentResponse> GetAmendmentPaymentDetails(InsitutionContractAmendmentPaymentRequest request);
|
||||
|
||||
Task<InsertAmendmentTempWorkshopResponse> InsertAmendmentTempWorkshops(InstitutionContractAmendmentTempWorkshopViewModel request);
|
||||
Task RemoveAmendmentWorkshops(Guid workshopTempId);
|
||||
#endregion
|
||||
|
||||
Task<List<InstitutionContractSelectListViewModel>> GetInstitutionContractSelectList(string search, string selected);
|
||||
Task<List<InstitutionContractPrintViewModel>> PrintAllAsync(List<long> ids);
|
||||
Task<(double amount, long contractingPartyId, long institutionContractId)> GetFirstPaymentAmount(Guid id);
|
||||
InstitutionContract GetIncludeContacts(long institutionContractId);
|
||||
}
|
||||
@@ -6,6 +6,7 @@ using System.Security.Cryptography;
|
||||
using _0_Framework.Domain;
|
||||
using Company.Domain.InstitutionContractContactInfoAgg;
|
||||
using CompanyManagment.App.Contracts.InstitutionContract;
|
||||
using OfficeOpenXml.Table.PivotTable;
|
||||
|
||||
namespace Company.Domain.InstitutionContractAgg;
|
||||
|
||||
@@ -125,8 +126,6 @@ public class InstitutionContract : EntityBase
|
||||
|
||||
public string VerifyCode { 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;
|
||||
|
||||
@@ -227,12 +226,10 @@ public class InstitutionContract : EntityBase
|
||||
}
|
||||
|
||||
|
||||
public void SetVerifyCode(string code,string verifierFullName, string verifierPhoneNumber)
|
||||
public void SetVerifyCode(string code)
|
||||
{
|
||||
VerifyCode = code;
|
||||
VerifyCodeCreation = DateTime.Now;
|
||||
VerifierFullName = verifierFullName;
|
||||
VerifierPhoneNumber = verifierPhoneNumber;
|
||||
}
|
||||
|
||||
public void SetWorkshopGroup(InstitutionContractWorkshopGroup workshopGroup)
|
||||
@@ -280,19 +277,11 @@ public class InstitutionContractAmendment : EntityBase
|
||||
|
||||
public long LawId { get; set; }
|
||||
|
||||
public void SetVerifyCode(string code,string verifierFullName, string verifierPhoneNumber)
|
||||
public void SetVerifyCode(string code)
|
||||
{
|
||||
VerifyCode = code;
|
||||
VerifyCodeCreation = DateTime.Now;
|
||||
VerifierFullName = verifierFullName;
|
||||
VerifierPhoneNumber = verifierPhoneNumber;
|
||||
VerificationCreation = DateTime.Now;
|
||||
}
|
||||
|
||||
public string VerifierPhoneNumber { get; private set; }
|
||||
|
||||
public string VerifierFullName { get; private set; }
|
||||
|
||||
public DateTime VerifyCodeCreation { get; set; }
|
||||
}
|
||||
|
||||
public class InstitutionContractAmendmentChange : EntityBase
|
||||
|
||||
@@ -1,151 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using MongoDB.Bson;
|
||||
using MongoDB.Bson.Serialization.Attributes;
|
||||
|
||||
namespace Company.Domain.InstitutionContractAmendmentTempAgg;
|
||||
|
||||
public class InstitutionContractAmendmentTemp
|
||||
{
|
||||
public InstitutionContractAmendmentTemp(List<InstitutionContractAmendmentTempPrevWorkshop> prevWorkshops,
|
||||
long institutionContractId)
|
||||
{
|
||||
Id = Guid.NewGuid();
|
||||
PrevWorkshops = prevWorkshops;
|
||||
NewWorkshops = prevWorkshops.Select(x=> new InstitutionContractAmendmentTempNewWorkshop(
|
||||
x.WorkshopName, x.CountPerson, x.ContractAndCheckout, x.ContractAndCheckoutInPerson, x.Insurance,
|
||||
x.InsuranceInPerson, x.RollCall, x.RollCallInPerson, x.CustomizeCheckout, x.Price, x.WorkshopId,
|
||||
x.CurrentWorkshopId, 0)).ToList();
|
||||
InstitutionContractId = institutionContractId;
|
||||
}
|
||||
|
||||
[BsonId]
|
||||
[BsonRepresentation(BsonType.String)]
|
||||
public Guid Id { get; private set; }
|
||||
public List<InstitutionContractAmendmentTempPrevWorkshop> PrevWorkshops { get; private set; }
|
||||
public List<InstitutionContractAmendmentTempNewWorkshop> NewWorkshops { get; private set; }
|
||||
public long InstitutionContractId { get; private set; }
|
||||
}
|
||||
|
||||
public class InstitutionContractAmendmentTempNewWorkshop : InstitutionContractAmendmentTempPrevWorkshop
|
||||
{
|
||||
public InstitutionContractAmendmentTempNewWorkshop(string workshopName, int countPerson, bool contractAndCheckout,
|
||||
bool contractAndCheckoutInPerson, bool insurance, bool insuranceInPerson, bool rollCall, bool rollCallInPerson,
|
||||
bool customizeCheckout, double price, long workshopId, long currentWorkshopId,double priceDifference) : base(
|
||||
workshopName, countPerson, contractAndCheckout, contractAndCheckoutInPerson, insurance, insuranceInPerson,
|
||||
rollCall, rollCallInPerson, customizeCheckout, price, workshopId, currentWorkshopId)
|
||||
{
|
||||
PriceDifference = priceDifference;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// مبلغ اختلاف کارگاه جدید با کارگاه قبلی(مبلغ اصلی ارتقاء)
|
||||
/// </summary>
|
||||
public double PriceDifference { get; private set; }
|
||||
|
||||
|
||||
public void Edit(string workshopName, int countPerson, bool contractAndCheckout,
|
||||
bool contractAndCheckoutInPerson,
|
||||
bool insurance, bool insuranceInPerson, bool rollCall, bool customizeCheckout,
|
||||
double price,double priceDifference)
|
||||
{
|
||||
base.Edit(workshopName, countPerson, contractAndCheckout, contractAndCheckoutInPerson, insurance,
|
||||
insuranceInPerson, rollCall, customizeCheckout, price);
|
||||
PriceDifference = priceDifference;
|
||||
}
|
||||
}
|
||||
|
||||
public class InstitutionContractAmendmentTempPrevWorkshop
|
||||
{
|
||||
public InstitutionContractAmendmentTempPrevWorkshop(string workshopName, int countPerson, bool contractAndCheckout,
|
||||
bool contractAndCheckoutInPerson,
|
||||
bool insurance, bool insuranceInPerson,
|
||||
bool rollCall, bool rollCallInPerson, bool customizeCheckout, double price, long workshopId,
|
||||
long currentWorkshopId)
|
||||
{
|
||||
Id = Guid.NewGuid();
|
||||
WorkshopName = workshopName;
|
||||
CountPerson = countPerson;
|
||||
ContractAndCheckout = contractAndCheckout;
|
||||
Insurance = insurance;
|
||||
RollCall = rollCall;
|
||||
CustomizeCheckout = customizeCheckout;
|
||||
ContractAndCheckoutInPerson = contractAndCheckoutInPerson;
|
||||
InsuranceInPerson = insuranceInPerson;
|
||||
RollCallInPerson = rollCallInPerson;
|
||||
Price = price;
|
||||
WorkshopId = workshopId;
|
||||
CurrentWorkshopId = currentWorkshopId;
|
||||
}
|
||||
|
||||
[BsonRepresentation(BsonType.String)]
|
||||
public Guid Id { get; set; }
|
||||
|
||||
public long CurrentWorkshopId { get; private set; }
|
||||
public long WorkshopId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// نام کارگاه
|
||||
/// </summary>
|
||||
public string WorkshopName { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// تعداد پرسنل
|
||||
/// </summary>
|
||||
public int CountPerson { get; private set; }
|
||||
|
||||
|
||||
#region ServiceSelection
|
||||
|
||||
/// <summary>
|
||||
/// قرارداد و تصفیه
|
||||
/// </summary>
|
||||
public bool ContractAndCheckout { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// بیمه
|
||||
/// </summary>
|
||||
public bool Insurance { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// حضورغباب
|
||||
/// </summary>
|
||||
public bool RollCall { get; private set; }
|
||||
|
||||
public bool RollCallInPerson { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// فیش غیر رسمی
|
||||
/// </summary>
|
||||
public bool CustomizeCheckout { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// خدمات حضوری قرداد و تصفیه
|
||||
/// </summary>
|
||||
public bool ContractAndCheckoutInPerson { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// خدمات حضوری بیمه
|
||||
/// </summary>
|
||||
public bool InsuranceInPerson { get; private set; }
|
||||
|
||||
public double Price { get; private set; }
|
||||
|
||||
#endregion
|
||||
|
||||
public void Edit(string workshopName, int countPerson, bool contractAndCheckout, bool contractAndCheckoutInPerson,
|
||||
bool insurance, bool insuranceInPerson, bool rollCall, bool customizeCheckout,
|
||||
double price)
|
||||
{
|
||||
WorkshopName = workshopName;
|
||||
CountPerson = countPerson;
|
||||
ContractAndCheckout = contractAndCheckout;
|
||||
Insurance = insurance;
|
||||
RollCall = rollCall;
|
||||
CustomizeCheckout = customizeCheckout;
|
||||
ContractAndCheckoutInPerson = contractAndCheckoutInPerson;
|
||||
InsuranceInPerson = insuranceInPerson;
|
||||
Price = price;
|
||||
}
|
||||
}
|
||||
@@ -9,22 +9,30 @@ namespace Company.Domain.PaymentTransactionAgg;
|
||||
/// </summary>
|
||||
public class PaymentTransaction:EntityBase
|
||||
{
|
||||
private PaymentTransaction(){}
|
||||
/// <summary>
|
||||
/// سازنده کلاس PaymentTransaction با دریافت اطلاعات تراکنش.
|
||||
/// </summary>
|
||||
/// <param name="contractingPartyId">شناسه طرف قرارداد</param>
|
||||
/// <param name="amount">مبلغ تراکنش</param>
|
||||
/// <param name="contractingPartyName"></param>
|
||||
/// <param name="callBackUrl"></param>
|
||||
/// <param name="contractingPartyName">نام طرف قرارداد</param>
|
||||
/// <param name="callBackUrl">آدرس بازگشت</param>
|
||||
/// <param name="transactionSource">منبع تراکنش</param>
|
||||
/// <param name="sourceId">شناسه منبع</param>
|
||||
public PaymentTransaction(long contractingPartyId,
|
||||
double amount,
|
||||
string contractingPartyName,string callBackUrl)
|
||||
string contractingPartyName,
|
||||
string callBackUrl,
|
||||
PaymentTransactionSource transactionSource,
|
||||
long sourceId)
|
||||
{
|
||||
ContractingPartyId = contractingPartyId;
|
||||
Status = PaymentTransactionStatus.Pending;
|
||||
Amount = amount;
|
||||
ContractingPartyName = contractingPartyName;
|
||||
CallBackUrl = callBackUrl;
|
||||
Source = transactionSource;
|
||||
SourceId = sourceId;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -67,6 +75,16 @@ public class PaymentTransaction:EntityBase
|
||||
/// </summary>
|
||||
public string TransactionId { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// نوع منبع تراکنش
|
||||
/// </summary>
|
||||
public PaymentTransactionSource Source { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// شناسه منبع (مثال: 2145 برای چک، 874156 برای بیمه)
|
||||
/// </summary>
|
||||
public long SourceId { get; private set; }
|
||||
|
||||
public string CallBackUrl { get; private set; }
|
||||
|
||||
public void SetPaid(string cardNumber,string bankName)
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace Company.Domain.RollCallAgg
|
||||
DateTime endSearch);
|
||||
void RemoveEmployeeRollCallsInDate(long workshopId, long employeeId, DateTime date);
|
||||
RollCallsByDateViewModel GetWorkshopRollCallHistory(RollCallSearchModel searchModel);
|
||||
CurrentDayRollCall GetWorkshopCurrentDayRollCalls(long workshopId,WorkshopCurrentDayRollCallSearchModel searchModel);
|
||||
CurrentDayRollCall GetWorkshopCurrentDayRollCalls(long workshopId);
|
||||
List<PersonnelCheckoutDailyRollCallViewModel> GetEmployeeRollCallsForMonth(IEnumerable<long> employeeIds,
|
||||
long workshopId, DateTime start, DateTime end);
|
||||
|
||||
|
||||
@@ -5,8 +5,7 @@ namespace Company.Domain.SmsResultAgg;
|
||||
|
||||
public class SmsResult: EntityBase
|
||||
{
|
||||
public SmsResult(int messageId, string status,string typeOfSms,
|
||||
string contractingPartyName,string mobile, long contractingPatyId, long institutionContractId)
|
||||
public SmsResult(int messageId, string status,string typeOfSms, string contractingPartyName,string mobile, long contractingPatyId, long institutionContractId)
|
||||
{
|
||||
MessageId = messageId;
|
||||
Status = status;
|
||||
|
||||
@@ -12,7 +12,9 @@ public class CaseHistoryRollCallExcelForEmployeeViewModel
|
||||
public string EmployeeFullName { get; set; }
|
||||
public string TotalWorkingHoursFa { get; set; }
|
||||
public string TotalWorkingTimeSpan { get; set; }
|
||||
|
||||
|
||||
|
||||
|
||||
public List<RollCallItemForEmployeeExcelViewModel> RollCalls { get; set; }
|
||||
}
|
||||
|
||||
@@ -38,8 +40,7 @@ public class RollCallItemForEmployeeExcelViewModel
|
||||
public bool HasLeave { get; set; }
|
||||
|
||||
public string TotalWorkingHours { get; set; }
|
||||
public string EnterTimeDifferences { get; set; }
|
||||
public string ExitTimeDifferences { get; set; }
|
||||
|
||||
}
|
||||
|
||||
public class RollCallTimeExcelViewModel
|
||||
|
||||
@@ -113,12 +113,11 @@ public class RollCallExcelGenerator : ExcelGenerator
|
||||
worksheet.Cells[i + row + 1, 1].Value = i + 1;
|
||||
worksheet.Cells[i + row + 1, 2].Value = rollCall.DayOfWeekFa;
|
||||
worksheet.Cells[i + row + 1, 3].Value = rollCall.DateFa;
|
||||
worksheet.Cells[i + row + 1, 4].Value = rollCall.EnterTimeDifferences;
|
||||
worksheet.Cells[i + row + 1, 4].Value = "-";
|
||||
worksheet.Cells[i + row + 1, 5].Value = rollCall.StartsItems;
|
||||
worksheet.Cells[i + row + 1, 6].Value = rollCall.EndsItems;
|
||||
worksheet.Cells[i + row + 1, 7].Value = rollCall.ExitTimeDifferences;
|
||||
worksheet.Cells[i + row + 1, 8].Value = rollCall.TotalWorkingHours == string.Empty
|
||||
? "ندارد" : rollCall.TotalWorkingHours;
|
||||
worksheet.Cells[i + row + 1, 7].Value = "-";
|
||||
worksheet.Cells[i + row + 1, 8].Value = rollCall.TotalWorkingHours == string.Empty ? "ندارد" : rollCall.TotalWorkingHours;
|
||||
|
||||
// Style data cells
|
||||
for (int j = 1; j <= 8; j++)
|
||||
@@ -308,49 +307,6 @@ public class RollCallExcelGenerator : ExcelGenerator
|
||||
return package.GetAsByteArray();
|
||||
}
|
||||
|
||||
private string CalculateExitMinuteDifference(TimeSpan early, TimeSpan late)
|
||||
{
|
||||
if (early == TimeSpan.Zero && late == TimeSpan.Zero)
|
||||
{
|
||||
return "-";
|
||||
}
|
||||
else if (late != TimeSpan.Zero)
|
||||
{
|
||||
var minutes = late.TotalMinutes > 999 ? "999" : late.TotalMinutes.ToString();
|
||||
return $"{minutes}+";
|
||||
}
|
||||
else if (early != TimeSpan.Zero)
|
||||
{
|
||||
var minutes = early.TotalMinutes > 999 ? "999" : early.TotalMinutes.ToString();
|
||||
return $"{minutes}-";
|
||||
}
|
||||
else
|
||||
{
|
||||
return $"";
|
||||
}
|
||||
}
|
||||
|
||||
private string CalculateEntryMinuteDifference(TimeSpan early, TimeSpan late)
|
||||
{
|
||||
if (early == TimeSpan.Zero && late == TimeSpan.Zero)
|
||||
{
|
||||
return "-";
|
||||
}
|
||||
else if (late != TimeSpan.Zero)
|
||||
{
|
||||
var minutes = late.TotalMinutes > 999 ? "999" : late.TotalMinutes.ToString();
|
||||
return $"{minutes}-";
|
||||
}
|
||||
else if (early != TimeSpan.Zero)
|
||||
{
|
||||
var minutes = early.TotalMinutes > 999 ? "999" : early.TotalMinutes.ToString();
|
||||
return $"{minutes}+";
|
||||
}
|
||||
else
|
||||
{
|
||||
return $"";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
namespace Company.Application.Contracts.AuthorizedBankDetails
|
||||
{
|
||||
public class AuthorizedBankDetailsSearchModel
|
||||
{
|
||||
public string CardNumber { get; set; }
|
||||
public string AccountNumber { get; set; }
|
||||
public string IBan { get; set; }
|
||||
public string BankName { get; set; }
|
||||
public string NationalIdentifier { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
using System;
|
||||
using System;
|
||||
|
||||
using System.Collections.Generic;
|
||||
namespace Company.Application.Contracts.AuthorizedBankDetails;
|
||||
|
||||
public class AuthorizedBankDetailsViewModel
|
||||
{
|
||||
public string NationalIdentifier { get; set; }
|
||||
|
||||
public long Id { get; set; }
|
||||
public string CustomerType { get; set; }
|
||||
public string CardNumber { get; set; }
|
||||
public string AccountNumber { get; set; }
|
||||
public string IBan { get; set; }
|
||||
public string BankName { get; set; }
|
||||
public List<AuthorizedBankDetailsOwnerViewModel> Owners { get; set; }
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Company.Application.Contracts.AuthorizedBankDetails
|
||||
{
|
||||
public class CreateAuthorizedBankDetails
|
||||
{
|
||||
public string CardNumber { get; set; }
|
||||
|
||||
public string AccountNumber { get; set; }
|
||||
|
||||
public string IBan { get; set; }
|
||||
|
||||
public string BankName { get; set; }
|
||||
|
||||
public List<CreateAuthorizedBankDetailsOwner> OwnersList { get; set; }
|
||||
}
|
||||
|
||||
public class CreateAuthorizedBankDetailsOwner
|
||||
{
|
||||
public string FName { get; set; }
|
||||
|
||||
public string LName { get; set; }
|
||||
|
||||
public string NationalIdentifier { get; set; }
|
||||
|
||||
public string CustomerType { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Company.Application.Contracts.AuthorizedBankDetails
|
||||
{
|
||||
public class EditAuthorizedBankDetails
|
||||
{
|
||||
public long Id { get; set; }
|
||||
|
||||
public string CardNumber { get; set; }
|
||||
|
||||
public string AccountNumber { get; set; }
|
||||
|
||||
public string IBan { get; set; }
|
||||
|
||||
public string BankName { get; set; }
|
||||
|
||||
public List<AuthorizedBankDetailsOwnerViewModel> OwnersList { get; set; }
|
||||
}
|
||||
|
||||
public class AuthorizedBankDetailsOwnerViewModel
|
||||
{
|
||||
public string FName { get; set; }
|
||||
public string LName { get; set; }
|
||||
public string NationalIdentifier { get; set; }
|
||||
public string CustomerType { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using _0_Framework.Application;
|
||||
using Company.Application.Contracts.AuthorizedBankDetails;
|
||||
|
||||
namespace Company.Application.Contracts.AuthorizedBankDetails
|
||||
{
|
||||
public interface IAuthorizedBankDetailsApplication
|
||||
{
|
||||
OperationResult Create(CreateAuthorizedBankDetails command);
|
||||
EditAuthorizedBankDetails GetDetails(long id);
|
||||
List<AuthorizedBankDetailsViewModel> Search(AuthorizedBankDetailsSearchModel searchModel);
|
||||
AuthorizedBankDetailsViewModel GetByIban(string iban);
|
||||
}
|
||||
}
|
||||
@@ -90,7 +90,7 @@ public class InquiryContractingPartyBankDetailsRequest
|
||||
public string CardNumber { get; set; }
|
||||
public string AccountNumber { get; set; }
|
||||
public string IBan { get; set; }
|
||||
public UidBanks? UidBank { get; set; }
|
||||
public UidBanks UidBank { get; set; }
|
||||
}
|
||||
public class ContractingPartyBankInquiryResponse
|
||||
{
|
||||
|
||||
@@ -76,7 +76,6 @@ public interface IEmployeeApplication
|
||||
Task<List<EmployeeSelectListViewModel>> WorkedEmployeesInWorkshopSelectList(long workshopId);
|
||||
|
||||
Task<OperationResult<EmployeeDataFromApiViewModel>> GetEmployeeDataFromApi(string nationalCode, string birthDate);
|
||||
Task<List<EmployeeSelectListViewModel>> GetWorkingEmployeesSelectList(long workshopId);
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -87,10 +87,6 @@ public class GetInstitutionContractListItemsViewModel
|
||||
public long ContractingPartyId { get; set; }
|
||||
|
||||
public List<InstitutionContractListWorkshop> Workshops { get; set; }
|
||||
|
||||
public bool IsInPersonContract { get; set; }
|
||||
|
||||
public bool IsOldContract { get; set; }
|
||||
}
|
||||
|
||||
public class InstitutionContractListWorkshop
|
||||
|
||||
@@ -7,7 +7,6 @@ using System.Threading.Tasks;
|
||||
using _0_Framework.Application;
|
||||
using _0_Framework.Application.Sms;
|
||||
using CompanyManagment.App.Contracts.Checkout;
|
||||
using CompanyManagment.App.Contracts.Law;
|
||||
using CompanyManagment.App.Contracts.TemporaryClientRegistration;
|
||||
using CompanyManagment.App.Contracts.Workshop;
|
||||
using CompanyManagment.App.Contracts.WorkshopPlan;
|
||||
@@ -78,8 +77,6 @@ public interface IInstitutionContractApplication
|
||||
/// <returns>لیست قراردادها برای چاپ</returns>
|
||||
List<InstitutionContractViewModel> PrintAll(List<long> id);
|
||||
|
||||
|
||||
[Obsolete("استفاده نشود، از متد غیرهمزمان استفاده شود")]
|
||||
/// <summary>
|
||||
/// چاپ یک قرارداد
|
||||
/// </summary>
|
||||
@@ -237,46 +234,29 @@ public interface IInstitutionContractApplication
|
||||
#region Upgrade (Amendment)
|
||||
|
||||
Task<InstitutionContractAmendmentWorkshopsResponse> GetAmendmentWorkshops(long institutionContractId);
|
||||
Task<InsertAmendmentTempWorkshopResponse> InsertAmendmentTempWorkshops(InstitutionContractAmendmentTempWorkshopViewModel request);
|
||||
Task RemoveAmendmentWorkshops(Guid workshopTempId);
|
||||
Task<InsitutionContractAmendmentPaymentResponse> GetAmendmentPaymentDetails(InsitutionContractAmendmentPaymentRequest request);
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
Task<OperationResult> ResendVerifyLink(long institutionContractId);
|
||||
|
||||
/// <summary>
|
||||
/// دیتای پرینت قرارداد مالی
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
Task<InstitutionContractPrintViewModel> PrintOneAsync(long id);
|
||||
Task<(double amount, long contractingPartyId, long institutionContractId)> GetFirstPaymentAmount(Guid id);
|
||||
Task<OperationResult> CompletePendingVerify(long institutionContractId);
|
||||
}
|
||||
|
||||
public class InstitutionContractPrintViewModel
|
||||
public class InsitutionContractAmendmentPaymentRequest
|
||||
{
|
||||
public InstitutionContratVerificationParty FirstParty { get; set; }
|
||||
public InstitutionContratVerificationParty SecondParty { get; set; }
|
||||
public string ContractNo { get; set; }
|
||||
public string CreationDate { get; set; }
|
||||
List<WorkshopTempViewModel> Workshops { get; set; }
|
||||
public long InstitutionContractId { get; set; }
|
||||
}
|
||||
|
||||
public class InsitutionContractAmendmentPaymentResponse
|
||||
{
|
||||
public InstitutionContractPaymentOneTimeViewModel OneTime { get; set; }
|
||||
public InstitutionContractPaymentMonthlyViewModel Monthly { 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 Guid WorkshopTempId { get; set; }
|
||||
public string Amount { get; set; }
|
||||
public string OneMonthAmount { get; set; }
|
||||
public string TotalAmount { get; set; }
|
||||
}
|
||||
|
||||
public class InstitutionContractAmendmentWorkshopsResponse
|
||||
@@ -284,9 +264,7 @@ public class InstitutionContractAmendmentWorkshopsResponse
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public List<InstitutionContractAmendmentTempWorkshopViewModel> Workshops { get; set; }
|
||||
|
||||
public Guid TempId { get; set; }
|
||||
public List<WorkshopTempViewModel> Workshops { get; set; }
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using CompanyManagment.App.Contracts.TemporaryClientRegistration;
|
||||
|
||||
namespace CompanyManagment.App.Contracts.InstitutionContract;
|
||||
|
||||
public class InsitutionContractAmendmentPaymentRequest
|
||||
{
|
||||
public Guid TempId { get; set; }
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
namespace CompanyManagment.App.Contracts.InstitutionContract;
|
||||
|
||||
public class InsitutionContractAmendmentPaymentResponse
|
||||
{
|
||||
public InstitutionContractPaymentOneTimeViewModel OneTime { get; set; }
|
||||
public InstitutionContractPaymentMonthlyViewModel Monthly { get; set; }
|
||||
public string ContractStart { get; set; }
|
||||
public string ContractEnd { get; set; }
|
||||
public string OneMonthAmount { get; set; }
|
||||
public string TotalAmount { get; set; }
|
||||
}
|
||||
@@ -1,64 +0,0 @@
|
||||
using System;
|
||||
|
||||
namespace CompanyManagment.App.Contracts.InstitutionContract;
|
||||
|
||||
public class InstitutionContractAmendmentTempWorkshopViewModel
|
||||
{
|
||||
public Guid TempId { get; set; }
|
||||
|
||||
public Guid WorkshopTempId { get; set; }
|
||||
|
||||
public long CurrentWorkshopId { get; set; }
|
||||
|
||||
public long WorkshopId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// نام کارگاه
|
||||
/// </summary>
|
||||
public string WorkshopName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// تعداد پرسنل
|
||||
/// </summary>
|
||||
public int CountPerson { get; set; }
|
||||
|
||||
|
||||
#region ServiceSelection
|
||||
|
||||
/// <summary>
|
||||
/// قرارداد و تصفیه
|
||||
/// </summary>
|
||||
public bool ContractAndCheckout { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// بیمه
|
||||
/// </summary>
|
||||
public bool Insurance { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// حضورغباب
|
||||
/// </summary>
|
||||
public bool RollCall { get; set; }
|
||||
|
||||
public bool RollCallInPerson { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// فیش غیر رسمی
|
||||
/// </summary>
|
||||
public bool CustomizeCheckout { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// خدمات حضوری قرداد و تصفیه
|
||||
/// </summary>
|
||||
public bool ContractAndCheckoutInPerson { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// خدمات حضوری بیمه
|
||||
/// </summary>
|
||||
public bool InsuranceInPerson { get; set; }
|
||||
|
||||
public double Price{ get; set; }
|
||||
public string PriceStr{ get; set; }
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -17,4 +17,7 @@ public class CreatePaymentTransaction
|
||||
/// مسیر برگشت پس از پرداخت
|
||||
/// </summary>
|
||||
public string CallBackUrl { get; set; }
|
||||
|
||||
public PaymentTransactionSource Source { get; set; }
|
||||
public long SourceId { get; set; }
|
||||
}
|
||||
@@ -101,5 +101,15 @@ public class PaymentTransactionDetailsViewModel
|
||||
/// </summary>
|
||||
public string TransactionId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// نوع منبع تراکنش
|
||||
/// </summary>
|
||||
public PaymentTransactionSource Source { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// شناسه منبع (مثال: 2145 برای چک، 874156 برای بیمه)
|
||||
/// </summary>
|
||||
public string SourceId { get; set; }
|
||||
|
||||
public string CallBackUrl { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
namespace CompanyManagment.App.Contracts.PaymentTransaction;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// انواع منابع تراکنش پرداخت
|
||||
/// </summary>
|
||||
public enum PaymentTransactionSource
|
||||
{
|
||||
/// <summary>
|
||||
/// سایر
|
||||
/// </summary>
|
||||
Other,
|
||||
/// <summary>
|
||||
/// قرارداد
|
||||
/// </summary>
|
||||
InstitutionContract
|
||||
}
|
||||
@@ -1,21 +1,22 @@
|
||||
namespace CompanyManagment.App.Contracts.PaymentTransaction;
|
||||
|
||||
/// <summary>
|
||||
/// وضعیت تراکنش درگاه پرداخت
|
||||
/// وضعیتهای مختلف تراکنش پرداخت
|
||||
/// </summary>
|
||||
public enum PaymentTransactionStatus
|
||||
{
|
||||
/// <summary>
|
||||
/// تراکنش در انتظار انجام است.
|
||||
/// در انتظار پرداخت
|
||||
/// </summary>
|
||||
Pending,
|
||||
Pending = 1,
|
||||
|
||||
/// <summary>
|
||||
/// تراکنش با شکست مواجه شد.
|
||||
/// پرداخت موفق
|
||||
/// </summary>
|
||||
Failed,
|
||||
Success = 2,
|
||||
|
||||
/// <summary>
|
||||
/// تراکنش با موفقیت انجام شد.
|
||||
/// پرداخت ناموفق
|
||||
/// </summary>
|
||||
Success,
|
||||
|
||||
}
|
||||
Failed = 3
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ namespace CompanyManagment.App.Contracts.RollCall
|
||||
/// <summary>
|
||||
/// گزارش آنلاین حضور غیاب
|
||||
/// </summary>
|
||||
CurrentDayRollCall GetWorkshopCurrentDayRollCalls(long workshopId,WorkshopCurrentDayRollCallSearchModel searchModel);
|
||||
CurrentDayRollCall GetWorkshopCurrentDayRollCalls(long workshopId);
|
||||
|
||||
/// <summary>
|
||||
/// گزارش آفلاین حضور غیاب کارگاه
|
||||
@@ -126,13 +126,6 @@ namespace CompanyManagment.App.Contracts.RollCall
|
||||
/// <returns></returns>
|
||||
OperationResult RecalculateValues(long workshopId, List<ReCalculateRollCallValues> command);
|
||||
}
|
||||
|
||||
public class WorkshopCurrentDayRollCallSearchModel
|
||||
{
|
||||
public long EmployeeId { get; set; }
|
||||
public int PersonnelCode { get; set; }
|
||||
}
|
||||
|
||||
public class ReCalculateRollCallValues
|
||||
{
|
||||
public long EmployeeId { get; set; }
|
||||
|
||||
@@ -1,70 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using _0_Framework.Application;
|
||||
using Company.Application.Contracts.AuthorizedBankDetails;
|
||||
using Company.Domain.AuthorizedBankDetailsAgg;
|
||||
|
||||
namespace CompanyManagment.Application
|
||||
{
|
||||
public class AuthorizedBankDetailsApplication : IAuthorizedBankDetailsApplication
|
||||
{
|
||||
private readonly IAuthorizedBankDetailsRepository _authorizedBankDetailsRepository;
|
||||
|
||||
public AuthorizedBankDetailsApplication(IAuthorizedBankDetailsRepository authorizedBankDetailsRepository)
|
||||
{
|
||||
_authorizedBankDetailsRepository = authorizedBankDetailsRepository;
|
||||
}
|
||||
|
||||
public OperationResult Create(CreateAuthorizedBankDetails command)
|
||||
{
|
||||
var operation = new OperationResult();
|
||||
|
||||
if (_authorizedBankDetailsRepository.Exists(x => x.CardNumber == command.CardNumber &&
|
||||
x.AccountNumber == command.AccountNumber &&
|
||||
x.IBan == command.IBan))
|
||||
return operation.Failed(ApplicationMessages.DuplicatedRecord);
|
||||
|
||||
var ownersList = new List<AuthorizedBankDetailsOwner>();
|
||||
if (command.OwnersList != null && command.OwnersList.Count > 0)
|
||||
{
|
||||
foreach (var owner in command.OwnersList)
|
||||
{
|
||||
var bankDetailsOwner = new AuthorizedBankDetailsOwner(
|
||||
owner.FName,
|
||||
owner.LName,
|
||||
owner.NationalIdentifier,
|
||||
owner.CustomerType
|
||||
);
|
||||
ownersList.Add(bankDetailsOwner);
|
||||
}
|
||||
}
|
||||
|
||||
var authorizedBankDetails = new AuthorizedBankDetails(
|
||||
command.CardNumber,
|
||||
command.AccountNumber,
|
||||
command.IBan,
|
||||
command.BankName,
|
||||
ownersList
|
||||
);
|
||||
|
||||
_authorizedBankDetailsRepository.Create(authorizedBankDetails);
|
||||
_authorizedBankDetailsRepository.SaveChanges();
|
||||
return operation.Succcedded();
|
||||
}
|
||||
|
||||
public EditAuthorizedBankDetails GetDetails(long id)
|
||||
{
|
||||
return _authorizedBankDetailsRepository.GetDetails(id);
|
||||
}
|
||||
|
||||
public List<AuthorizedBankDetailsViewModel> Search(AuthorizedBankDetailsSearchModel searchModel)
|
||||
{
|
||||
return _authorizedBankDetailsRepository.Search(searchModel);
|
||||
}
|
||||
|
||||
public AuthorizedBankDetailsViewModel GetByIban(string iban)
|
||||
{
|
||||
return _authorizedBankDetailsRepository.GetByIban(iban);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -193,7 +193,7 @@ public class ContractingPartyBankAccountsApplication : IContractingPartyBankAcco
|
||||
}
|
||||
else if (!string.IsNullOrWhiteSpace(accountNumber))
|
||||
{
|
||||
var accountNumberRes = await _uidService.AccountToIban(accountNumber, uidBank.Value);
|
||||
var accountNumberRes = await _uidService.AccountToIban(accountNumber, uidBank);
|
||||
if (accountNumberRes.ResponseContext.Status.Code != 0)
|
||||
{
|
||||
throw new BadRequestException(
|
||||
|
||||
@@ -373,9 +373,7 @@ namespace CompanyManagment.Application
|
||||
Color = color,
|
||||
PersonnelCode = personnelCodes.FirstOrDefault(y => x.Id == y.EmployeeId)?.PersonnelCode.ToString() ?? "-"
|
||||
};
|
||||
}).OrderBy(x => x.Color switch { "orange" => 0, "white" => 1, "red" => 2, "green" => 3, "black" => 4, _ => 5 })
|
||||
.ToList();
|
||||
|
||||
}).OrderByDescending(x => x.IsEligible).ThenByDescending(x => x.Reason).ToList();
|
||||
return op.Succcedded(employees);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1676,10 +1676,6 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
|
||||
|
||||
}
|
||||
|
||||
public async Task<List<EmployeeSelectListViewModel>> GetWorkingEmployeesSelectList(long workshopId)
|
||||
{
|
||||
return await _EmployeeRepository.GetWorkingEmployeesSelectList(workshopId);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -106,11 +106,8 @@ public class FinancialStatmentApplication : IFinancialStatmentApplication
|
||||
debtor = command.DeptorString.MoneyToDouble();
|
||||
|
||||
}
|
||||
|
||||
if (!command.TdateFa.TryToGeorgianDateTime(out var tDateGr))
|
||||
{
|
||||
return op.Failed("تاریخ وارد شده صحیح نمی باشد");
|
||||
}
|
||||
|
||||
var tDateGr = command.TdateFa.ToGeorgianDateTime();
|
||||
if (_financialStatmentRepository.Exists(x => x.ContractingPartyId == command.ContractingPartyId))
|
||||
{
|
||||
var financialStatment = _financialStatmentRepository.GetDetailsByContractingPartyId(command.ContractingPartyId);
|
||||
|
||||
@@ -2,14 +2,17 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Security.Policy;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using _0_Framework.Application;
|
||||
using _0_Framework.Application.Enums;
|
||||
using _0_Framework.Application.PaymentGateway;
|
||||
using _0_Framework.Application.Sms;
|
||||
using _0_Framework.Application.UID;
|
||||
using _0_Framework.Exceptions;
|
||||
using AccountManagement.Application.Contracts.Account;
|
||||
using Azure.Core;
|
||||
using Company.Domain.ContarctingPartyAgg;
|
||||
using Company.Domain.EmployeeAgg;
|
||||
using Company.Domain.empolyerAgg;
|
||||
@@ -23,6 +26,7 @@ using Company.Domain.WorkshopAgg;
|
||||
using CompanyManagment.App.Contracts.FinancialStatment;
|
||||
using CompanyManagment.App.Contracts.InstitutionContract;
|
||||
using CompanyManagment.App.Contracts.InstitutionContractContactinfo;
|
||||
using CompanyManagment.App.Contracts.PaymentTransaction;
|
||||
using CompanyManagment.App.Contracts.PersonalContractingParty;
|
||||
using CompanyManagment.App.Contracts.Workshop;
|
||||
using CompanyManagment.EFCore.Migrations;
|
||||
@@ -1141,7 +1145,7 @@ public class InstitutionContractApplication : IInstitutionContractApplication
|
||||
|
||||
|
||||
await _smsService.SendInstitutionVerificationLink(contractingParty.Phone, contractingPartyFullName,
|
||||
entity.PublicId, contractingParty.id,entity.id );
|
||||
entity.PublicId);
|
||||
|
||||
await _institutionContractRepository.SaveChangesAsync();
|
||||
|
||||
@@ -1203,12 +1207,7 @@ public class InstitutionContractApplication : IInstitutionContractApplication
|
||||
throw new NotFoundException("طرف قرارداد یافت نشد");
|
||||
|
||||
var code = new Random().Next(1000, 9999).ToString();
|
||||
|
||||
var contractingPartyFullName = contractingParty.IsLegal == "حقیقی"
|
||||
? contractingParty.FName + " " + contractingParty.LName
|
||||
: contractingParty.CeoFName + " " + contractingParty.CeoLName;
|
||||
|
||||
institutionContract.SetVerifyCode(code,contractingPartyFullName ,contractingParty.Phone);
|
||||
institutionContract.SetVerifyCode(code);
|
||||
|
||||
var transaction = await _institutionContractRepository.BeginTransactionAsync();
|
||||
try
|
||||
@@ -1254,32 +1253,6 @@ public class InstitutionContractApplication : IInstitutionContractApplication
|
||||
|
||||
if (institutionContract.VerifyCode != code)
|
||||
return op.Failed("کد وارد شده صحیح نمی باشد");
|
||||
|
||||
var transaction = await _institutionContractRepository.BeginTransactionAsync();
|
||||
institutionContract.SetPendingWorkflow();
|
||||
|
||||
var phone = institutionContract.ContactInfoList.FirstOrDefault(x =>
|
||||
x.SendSms && x.Position == "طرف قرارداد" && x.PhoneType == "شماره همراه");
|
||||
if (phone !=null)
|
||||
{
|
||||
var userPass = contractingParty.IsLegal == "حقیقی"
|
||||
? contractingParty.Nationalcode
|
||||
: contractingParty.NationalId;
|
||||
var createAcc = new RegisterAccount
|
||||
{
|
||||
Fullname = contractingParty.LName,
|
||||
Username = userPass,
|
||||
Password = userPass,
|
||||
Mobile = phone.PhoneNumber,
|
||||
NationalCode = userPass
|
||||
};
|
||||
var res = _accountApplication.RegisterClient(createAcc);
|
||||
if (res.IsSuccedded)
|
||||
CreateContractingPartyAccount(contractingParty.id, res.SendId);
|
||||
}
|
||||
|
||||
await transaction.CommitAsync();
|
||||
await _institutionContractRepository.SaveChangesAsync();
|
||||
return op.Succcedded();
|
||||
}
|
||||
|
||||
@@ -1345,46 +1318,49 @@ public class InstitutionContractApplication : IInstitutionContractApplication
|
||||
return await _institutionContractRepository.GetAmendmentWorkshops(institutionContractId);
|
||||
}
|
||||
|
||||
public async Task<InsertAmendmentTempWorkshopResponse> InsertAmendmentTempWorkshops(InstitutionContractAmendmentTempWorkshopViewModel request)
|
||||
{
|
||||
return await _institutionContractRepository.InsertAmendmentTempWorkshops(request);
|
||||
}
|
||||
|
||||
public Task RemoveAmendmentWorkshops(Guid workshopTempId)
|
||||
{
|
||||
return _institutionContractRepository.RemoveAmendmentWorkshops(workshopTempId);
|
||||
}
|
||||
|
||||
public Task<InsitutionContractAmendmentPaymentResponse> GetAmendmentPaymentDetails(InsitutionContractAmendmentPaymentRequest request)
|
||||
{
|
||||
return _institutionContractRepository.GetAmendmentPaymentDetails(request);
|
||||
}
|
||||
|
||||
public async Task<OperationResult> ResendVerifyLink(long institutionContractId)
|
||||
public async Task<(double amount,long contractingPartyId,long institutionContractId)> GetFirstPaymentAmount(Guid id)
|
||||
{
|
||||
var institutionContract = _institutionContractRepository.Get(institutionContractId);
|
||||
|
||||
if (institutionContract == null)
|
||||
{
|
||||
throw new NotFoundException("رکورد مورد نظر یافت نشد");
|
||||
}
|
||||
|
||||
if (institutionContract.VerificationStatus != InstitutionContractVerificationStatus.PendingForVerify)
|
||||
{
|
||||
throw new BadRequestException("این قرارداد مالی در وضعیت مناسبی برای ارسال مجدد لینک تایید نمی باشد");
|
||||
}
|
||||
var contractingParty = _contractingPartyRepository.Get(institutionContract.ContractingPartyId);
|
||||
if (contractingParty == null)
|
||||
throw new NotFoundException("طرف قرارداد یافت نشد");
|
||||
var contractingPartyFullName = contractingParty.FName + " " + contractingParty.LName;
|
||||
await _smsService.SendInstitutionVerificationLink(contractingParty.Phone, contractingPartyFullName,
|
||||
institutionContract.PublicId, contractingParty.id, institutionContract.id);
|
||||
return new OperationResult().Succcedded();
|
||||
var balanceAmount = await _institutionContractRepository.GetFirstPaymentAmount(id);
|
||||
return balanceAmount;
|
||||
}
|
||||
|
||||
public async Task<InstitutionContractPrintViewModel> PrintOneAsync(long id)
|
||||
public async Task<OperationResult> CompletePendingVerify(long institutionContractId)
|
||||
{
|
||||
return (await _institutionContractRepository.PrintAllAsync([id])).FirstOrDefault();
|
||||
var institutionContract = _institutionContractRepository.GetIncludeContacts(institutionContractId);
|
||||
|
||||
var transaction = await _institutionContractRepository.BeginTransactionAsync();
|
||||
|
||||
var phone = institutionContract.ContactInfoList.FirstOrDefault(x =>
|
||||
x.SendSms && x.Position == "طرف قرارداد" && x.PhoneType == "شماره همراه");
|
||||
|
||||
var contractingParty = _contractingPartyRepository.Get(institutionContract.ContractingPartyId);
|
||||
|
||||
if (phone !=null)
|
||||
{
|
||||
var userPass = contractingParty.IsLegal == "حقیقی"
|
||||
? contractingParty.Nationalcode
|
||||
: contractingParty.NationalId;
|
||||
var createAcc = new RegisterAccount
|
||||
{
|
||||
Fullname = contractingParty.LName,
|
||||
Username = userPass,
|
||||
Password = userPass,
|
||||
Mobile = phone.PhoneNumber,
|
||||
NationalCode = userPass
|
||||
};
|
||||
var res = _accountApplication.RegisterClient(createAcc);
|
||||
if (res.IsSuccedded)
|
||||
CreateContractingPartyAccount(contractingParty.id, res.SendId);
|
||||
}
|
||||
|
||||
await transaction.CommitAsync();
|
||||
await _institutionContractRepository.SaveChangesAsync();
|
||||
return new OperationResult().Succcedded();
|
||||
}
|
||||
|
||||
|
||||
@@ -1482,7 +1458,7 @@ public class InstitutionContractApplication : IInstitutionContractApplication
|
||||
return operation.Succcedded(personalContractingParty);
|
||||
}
|
||||
|
||||
public static List<InstitutionContractInstallment> CalculateInstallment(double amount, int installmentCount,
|
||||
private List<InstitutionContractInstallment> CalculateInstallment(double amount, int installmentCount,
|
||||
string loanStartDate, bool getRounded)
|
||||
{
|
||||
int day = Convert.ToInt32(loanStartDate.Substring(8, 2));
|
||||
|
||||
@@ -1869,11 +1869,6 @@ public class InsuranceListApplication : IInsuranceListApplication
|
||||
bool isManager = jobId is 10 or 16 or 17 or 18 or 3498;
|
||||
if (isManager && !includeStatus)
|
||||
return 0;
|
||||
|
||||
//پرسنل استثناء سیدعسکر موسوی زاده - فروشگاه ولی عصر
|
||||
if (employeeId == 1496)
|
||||
return 0;
|
||||
|
||||
//پرسنل استثناء
|
||||
if (employeeId == 42783)
|
||||
return 53082855;
|
||||
|
||||
@@ -50,7 +50,9 @@ public class PaymentTransactionApplication : IPaymentTransactionApplication
|
||||
command.ContractingPartyId,
|
||||
command.Amount,
|
||||
contractingPartyName,
|
||||
command.CallBackUrl);
|
||||
command.CallBackUrl,
|
||||
command.Source,
|
||||
command.SourceId);
|
||||
|
||||
await _paymentTransactionRepository.CreateAsync(entity);
|
||||
await _paymentTransactionRepository.SaveChangesAsync();
|
||||
|
||||
@@ -144,9 +144,9 @@ public class RollCallApplication : IRollCallApplication
|
||||
return _rollCallRepository.GetWorkshopRollCallHistory(searchModel);
|
||||
}
|
||||
|
||||
public CurrentDayRollCall GetWorkshopCurrentDayRollCalls(long workshopId, WorkshopCurrentDayRollCallSearchModel searchModel)
|
||||
public CurrentDayRollCall GetWorkshopCurrentDayRollCalls(long workshopId)
|
||||
{
|
||||
return _rollCallRepository.GetWorkshopCurrentDayRollCalls(workshopId, searchModel);
|
||||
return _rollCallRepository.GetWorkshopCurrentDayRollCalls(workshopId);
|
||||
}
|
||||
|
||||
public List<CheckoutDailyRollCallViewModel> GetActiveEmployeeRollCallsForDuration(long employeeId, long workshopId, string startDate,
|
||||
|
||||
@@ -674,7 +674,7 @@ public class TemporaryClientRegistrationApplication : ITemporaryClientRegistrati
|
||||
result.MonthlyValueAddedTaxStr= tenPercent.ToMoney();
|
||||
var monthlyTotalPaymentDouble = sumOfWorkshopsPaymentDouble + tenPercent;
|
||||
result.MonthlyTotalPaymentStr = monthlyTotalPaymentDouble.ToMoney();
|
||||
var installmentList = InstitutionContractRepository.InstitutionMonthlyInstallmentCaculation((int)duration, monthlyTotalPaymentDouble, installmentstart);
|
||||
var installmentList = InstitutionContractRepository.InstitutionMonthlyInstallmentCaculation(duration, monthlyTotalPaymentDouble, installmentstart);
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using Company.Domain.AdminMonthlyOverviewAgg;
|
||||
using Company.Domain.AndroidApkVersionAgg;
|
||||
using Company.Domain.AuthorizedBankDetailsAgg;
|
||||
using Company.Domain.BankAgg;
|
||||
using Company.Domain.BillAgg;
|
||||
using Company.Domain.Board;
|
||||
@@ -202,9 +201,6 @@ public class CompanyContext : DbContext
|
||||
|
||||
public DbSet<InstitutionContractContactInfoTemp> InstitutionContractContactInfoTemps { get; set; }
|
||||
|
||||
public DbSet<AuthorizedBankDetails> AuthorizedBankDetails { get; set; }
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region Pooya
|
||||
@@ -313,6 +309,7 @@ public class CompanyContext : DbContext
|
||||
|
||||
public DbSet<Employer> Employers { get; set; }
|
||||
|
||||
|
||||
public CompanyContext(DbContextOptions<CompanyContext> options) :base(options)
|
||||
{
|
||||
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
using Company.Domain.AuthorizedBankDetailsAgg;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace CompanyManagment.EFCore.Mapping
|
||||
{
|
||||
public class AuthorizedBankDetailsMapping : IEntityTypeConfiguration<AuthorizedBankDetails>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<AuthorizedBankDetails> builder)
|
||||
{
|
||||
builder.ToTable("AuthorizedBankDetails");
|
||||
builder.HasKey(x => x.id);
|
||||
|
||||
builder.Property(x => x.CardNumber).HasMaxLength(50);
|
||||
builder.Property(x => x.AccountNumber).HasMaxLength(50);
|
||||
builder.Property(x => x.IBan).HasMaxLength(50);
|
||||
builder.Property(x => x.BankName).HasMaxLength(100);
|
||||
|
||||
// Configure owners as owned entities (value objects)
|
||||
builder.OwnsMany(x => x.OwnersList, ownersBuilder =>
|
||||
{
|
||||
ownersBuilder.ToTable("AuthorizedBankDetailsOwners");
|
||||
ownersBuilder.WithOwner().HasForeignKey("AuthorizedBankDetailsId");
|
||||
ownersBuilder.Property<int>("Id").ValueGeneratedOnAdd();
|
||||
ownersBuilder.HasKey("Id");
|
||||
|
||||
ownersBuilder.Property(x => x.FName).HasMaxLength(100);
|
||||
ownersBuilder.Property(x => x.LName).HasMaxLength(100);
|
||||
ownersBuilder.Property(x => x.NationalIdentifier).HasMaxLength(20);
|
||||
ownersBuilder.Property(x => x.CustomerType).HasMaxLength(50);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12,8 +12,6 @@ public class InstitutionContractAmendmentMapping:IEntityTypeConfiguration<Instit
|
||||
builder.HasKey(x => x.id);
|
||||
|
||||
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)
|
||||
.WithMany(x => x.Amendments)
|
||||
|
||||
@@ -30,8 +30,6 @@ public class InstitutionContractMapping : IEntityTypeConfiguration<InstitutionCo
|
||||
builder.Property(x => x.HasValueAddedTax).HasMaxLength(10);
|
||||
|
||||
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);
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ public class PaymentTransactionMapping:IEntityTypeConfiguration<PaymentTransacti
|
||||
builder.Property(x => x.Status).HasConversion<string>().HasMaxLength(35);
|
||||
builder.Property(x => x.ContractingPartyName).HasMaxLength(255);
|
||||
builder.Property(x => x.CallBackUrl).HasMaxLength(500);
|
||||
builder.Property(x => x.Source).HasConversion<string>().HasMaxLength(35);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -13,8 +13,8 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
namespace CompanyManagment.EFCore.Migrations
|
||||
{
|
||||
[DbContext(typeof(CompanyContext))]
|
||||
[Migration("20251019092906_add authorized bank details")]
|
||||
partial class addauthorizedbankdetails
|
||||
[Migration("20251018094820_add source to payment transaction")]
|
||||
partial class addsourcetopaymenttransaction
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
@@ -93,38 +93,6 @@ namespace CompanyManagment.EFCore.Migrations
|
||||
b.ToTable("AndroidApkVersions", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Company.Domain.AuthorizedBankDetailsAgg.AuthorizedBankDetails", b =>
|
||||
{
|
||||
b.Property<long>("id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("id"));
|
||||
|
||||
b.Property<string>("AccountNumber")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("nvarchar(50)");
|
||||
|
||||
b.Property<string>("BankName")
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("nvarchar(100)");
|
||||
|
||||
b.Property<string>("CardNumber")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("nvarchar(50)");
|
||||
|
||||
b.Property<DateTime>("CreationDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("IBan")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("nvarchar(50)");
|
||||
|
||||
b.HasKey("id");
|
||||
|
||||
b.ToTable("AuthorizedBankDetails", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Company.Domain.AuthorizedPersonAgg.AuthorizedPerson", b =>
|
||||
{
|
||||
b.Property<long>("id")
|
||||
@@ -4941,6 +4909,14 @@ namespace CompanyManagment.EFCore.Migrations
|
||||
b.Property<DateTime>("CreationDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("Source")
|
||||
.IsRequired()
|
||||
.HasMaxLength(35)
|
||||
.HasColumnType("nvarchar(35)");
|
||||
|
||||
b.Property<long>("SourceId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<string>("Status")
|
||||
.IsRequired()
|
||||
.HasMaxLength(35)
|
||||
@@ -6908,48 +6884,6 @@ namespace CompanyManagment.EFCore.Migrations
|
||||
b.ToTable("EmployerWorkshop");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Company.Domain.AuthorizedBankDetailsAgg.AuthorizedBankDetails", b =>
|
||||
{
|
||||
b.OwnsMany("Company.Domain.AuthorizedBankDetailsAgg.AuthorizedBankDetailsOwner", "OwnersList", b1 =>
|
||||
{
|
||||
b1.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b1.Property<int>("Id"));
|
||||
|
||||
b1.Property<long>("AuthorizedBankDetailsId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b1.Property<string>("CustomerType")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("nvarchar(50)");
|
||||
|
||||
b1.Property<string>("FName")
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("nvarchar(100)");
|
||||
|
||||
b1.Property<string>("LName")
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("nvarchar(100)");
|
||||
|
||||
b1.Property<string>("NationalIdentifier")
|
||||
.HasMaxLength(20)
|
||||
.HasColumnType("nvarchar(20)");
|
||||
|
||||
b1.HasKey("Id");
|
||||
|
||||
b1.HasIndex("AuthorizedBankDetailsId");
|
||||
|
||||
b1.ToTable("AuthorizedBankDetailsOwners", (string)null);
|
||||
|
||||
b1.WithOwner()
|
||||
.HasForeignKey("AuthorizedBankDetailsId");
|
||||
});
|
||||
|
||||
b.Navigation("OwnersList");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Company.Domain.Board.Board", b =>
|
||||
{
|
||||
b.HasOne("Company.Domain.BoardType.BoardType", "BoardType")
|
||||
@@ -0,0 +1,52 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace CompanyManagment.EFCore.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class addsourcetopaymenttransaction : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "Source",
|
||||
table: "PaymentTransactions",
|
||||
type: "nvarchar(35)",
|
||||
maxLength: 35,
|
||||
nullable: false,
|
||||
defaultValue: "");
|
||||
|
||||
migrationBuilder.AddColumn<long>(
|
||||
name: "SourceId",
|
||||
table: "PaymentTransactions",
|
||||
type: "bigint",
|
||||
nullable: false,
|
||||
defaultValue: 0L);
|
||||
|
||||
migrationBuilder.AddColumn<long>(
|
||||
name: "LawId",
|
||||
table: "InstitutionContractAmendments",
|
||||
type: "bigint",
|
||||
nullable: false,
|
||||
defaultValue: 0L);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "Source",
|
||||
table: "PaymentTransactions");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "SourceId",
|
||||
table: "PaymentTransactions");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "LawId",
|
||||
table: "InstitutionContractAmendments");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,68 +0,0 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace CompanyManagment.EFCore.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class addauthorizedbankdetails : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "AuthorizedBankDetails",
|
||||
columns: table => new
|
||||
{
|
||||
id = table.Column<long>(type: "bigint", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
CardNumber = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
|
||||
AccountNumber = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
|
||||
IBan = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
|
||||
BankName = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
|
||||
CreationDate = table.Column<DateTime>(type: "datetime2", nullable: false)
|
||||
},
|
||||
constraints: table => { table.PrimaryKey("PK_AuthorizedBankDetails", x => x.id); });
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "AuthorizedBankDetailsOwners",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
FName = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
|
||||
LName = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
|
||||
NationalIdentifier = table.Column<string>(type: "nvarchar(20)", maxLength: 20, nullable: true),
|
||||
CustomerType = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
|
||||
AuthorizedBankDetailsId = table.Column<long>(type: "bigint", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_AuthorizedBankDetailsOwners", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_AuthorizedBankDetailsOwners_AuthorizedBankDetails_AuthorizedBankDetailsId",
|
||||
column: x => x.AuthorizedBankDetailsId,
|
||||
principalTable: "AuthorizedBankDetails",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_AuthorizedBankDetailsOwners_AuthorizedBankDetailsId",
|
||||
table: "AuthorizedBankDetailsOwners",
|
||||
column: "AuthorizedBankDetailsId");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "AuthorizedBankDetailsOwners");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "AuthorizedBankDetails");
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,74 +0,0 @@
|
||||
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");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -90,38 +90,6 @@ namespace CompanyManagment.EFCore.Migrations
|
||||
b.ToTable("AndroidApkVersions", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Company.Domain.AuthorizedBankDetailsAgg.AuthorizedBankDetails", b =>
|
||||
{
|
||||
b.Property<long>("id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("id"));
|
||||
|
||||
b.Property<string>("AccountNumber")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("nvarchar(50)");
|
||||
|
||||
b.Property<string>("BankName")
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("nvarchar(100)");
|
||||
|
||||
b.Property<string>("CardNumber")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("nvarchar(50)");
|
||||
|
||||
b.Property<DateTime>("CreationDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("IBan")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("nvarchar(50)");
|
||||
|
||||
b.HasKey("id");
|
||||
|
||||
b.ToTable("AuthorizedBankDetails", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Company.Domain.AuthorizedPersonAgg.AuthorizedPerson", b =>
|
||||
{
|
||||
b.Property<long>("id")
|
||||
@@ -3205,14 +3173,6 @@ namespace CompanyManagment.EFCore.Migrations
|
||||
.HasMaxLength(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")
|
||||
.HasMaxLength(20)
|
||||
.HasColumnType("nvarchar(20)");
|
||||
@@ -3255,21 +3215,10 @@ namespace CompanyManagment.EFCore.Migrations
|
||||
b.Property<DateTime>("VerificationCreation")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("VerifierFullName")
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("nvarchar(100)");
|
||||
|
||||
b.Property<string>("VerifierPhoneNumber")
|
||||
.HasMaxLength(20)
|
||||
.HasColumnType("nvarchar(20)");
|
||||
|
||||
b.Property<string>("VerifyCode")
|
||||
.HasMaxLength(10)
|
||||
.HasColumnType("nvarchar(10)");
|
||||
|
||||
b.Property<DateTime>("VerifyCodeCreation")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.HasKey("id");
|
||||
|
||||
b.HasIndex("InstitutionContractId");
|
||||
@@ -4957,6 +4906,14 @@ namespace CompanyManagment.EFCore.Migrations
|
||||
b.Property<DateTime>("CreationDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("Source")
|
||||
.IsRequired()
|
||||
.HasMaxLength(35)
|
||||
.HasColumnType("nvarchar(35)");
|
||||
|
||||
b.Property<long>("SourceId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<string>("Status")
|
||||
.IsRequired()
|
||||
.HasMaxLength(35)
|
||||
@@ -6924,48 +6881,6 @@ namespace CompanyManagment.EFCore.Migrations
|
||||
b.ToTable("EmployerWorkshop");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Company.Domain.AuthorizedBankDetailsAgg.AuthorizedBankDetails", b =>
|
||||
{
|
||||
b.OwnsMany("Company.Domain.AuthorizedBankDetailsAgg.AuthorizedBankDetailsOwner", "OwnersList", b1 =>
|
||||
{
|
||||
b1.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b1.Property<int>("Id"));
|
||||
|
||||
b1.Property<long>("AuthorizedBankDetailsId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b1.Property<string>("CustomerType")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("nvarchar(50)");
|
||||
|
||||
b1.Property<string>("FName")
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("nvarchar(100)");
|
||||
|
||||
b1.Property<string>("LName")
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("nvarchar(100)");
|
||||
|
||||
b1.Property<string>("NationalIdentifier")
|
||||
.HasMaxLength(20)
|
||||
.HasColumnType("nvarchar(20)");
|
||||
|
||||
b1.HasKey("Id");
|
||||
|
||||
b1.HasIndex("AuthorizedBankDetailsId");
|
||||
|
||||
b1.ToTable("AuthorizedBankDetailsOwners", (string)null);
|
||||
|
||||
b1.WithOwner()
|
||||
.HasForeignKey("AuthorizedBankDetailsId");
|
||||
});
|
||||
|
||||
b.Navigation("OwnersList");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Company.Domain.Board.Board", b =>
|
||||
{
|
||||
b.HasOne("Company.Domain.BoardType.BoardType", "BoardType")
|
||||
|
||||
@@ -1,107 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using _0_Framework.Application;
|
||||
using _0_Framework_b.InfraStructure;
|
||||
using Company.Application.Contracts.AuthorizedBankDetails;
|
||||
using Company.Domain.AuthorizedBankDetailsAgg;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace CompanyManagment.EFCore.Repository
|
||||
{
|
||||
public class AuthorizedBankDetailsRepository : RepositoryBase<long, AuthorizedBankDetails>, IAuthorizedBankDetailsRepository
|
||||
{
|
||||
private readonly CompanyContext _context;
|
||||
|
||||
public AuthorizedBankDetailsRepository(CompanyContext context) : base(context)
|
||||
{
|
||||
_context = context;
|
||||
}
|
||||
|
||||
public EditAuthorizedBankDetails GetDetails(long id)
|
||||
{
|
||||
var authorizedBankDetails = _context.AuthorizedBankDetails
|
||||
.Include(x => x.OwnersList)
|
||||
.FirstOrDefault(x => x.id == id);
|
||||
|
||||
if (authorizedBankDetails == null)
|
||||
return new EditAuthorizedBankDetails();
|
||||
|
||||
var result = new EditAuthorizedBankDetails
|
||||
{
|
||||
Id = authorizedBankDetails.id,
|
||||
CardNumber = authorizedBankDetails.CardNumber,
|
||||
AccountNumber = authorizedBankDetails.AccountNumber,
|
||||
IBan = authorizedBankDetails.IBan,
|
||||
BankName = authorizedBankDetails.BankName,
|
||||
OwnersList = authorizedBankDetails.OwnersList.Select(o => new AuthorizedBankDetailsOwnerViewModel
|
||||
{
|
||||
FName = o.FName,
|
||||
LName = o.LName,
|
||||
NationalIdentifier = o.NationalIdentifier,
|
||||
CustomerType = o.CustomerType
|
||||
}).ToList()
|
||||
};
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public List<AuthorizedBankDetailsViewModel> Search(AuthorizedBankDetailsSearchModel searchModel)
|
||||
{
|
||||
var query = _context.AuthorizedBankDetails
|
||||
.Include(x => x.OwnersList)
|
||||
.Select(x => new AuthorizedBankDetailsViewModel
|
||||
{
|
||||
Id = x.id,
|
||||
CardNumber = x.CardNumber,
|
||||
AccountNumber = x.AccountNumber,
|
||||
IBan = x.IBan,
|
||||
});
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(searchModel.CardNumber))
|
||||
query = query.Where(x => x.CardNumber.Contains(searchModel.CardNumber));
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(searchModel.AccountNumber))
|
||||
query = query.Where(x => x.AccountNumber.Contains(searchModel.AccountNumber));
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(searchModel.IBan))
|
||||
query = query.Where(x => x.IBan.Contains(searchModel.IBan));
|
||||
|
||||
// if (!string.IsNullOrWhiteSpace(searchModel.BankName))
|
||||
// query = query.Where(x => x.BankName.Contains(searchModel.BankName));
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(searchModel.NationalIdentifier))
|
||||
query = query.Where(x =>
|
||||
_context.AuthorizedBankDetails
|
||||
.Include(a => a.OwnersList)
|
||||
.Any(a => a.id == x.Id &&
|
||||
a.OwnersList.Any(o => o.NationalIdentifier.Contains(searchModel.NationalIdentifier))));
|
||||
|
||||
return query.OrderByDescending(x => x.Id).ToList();
|
||||
}
|
||||
|
||||
public AuthorizedBankDetailsViewModel GetByIban(string iban)
|
||||
{
|
||||
return _context.AuthorizedBankDetails
|
||||
.Include(x => x.OwnersList)
|
||||
.Where(x => x.IBan == iban)
|
||||
.Select(x => new AuthorizedBankDetailsViewModel
|
||||
{
|
||||
Id = x.id,
|
||||
CardNumber = x.CardNumber,
|
||||
AccountNumber = x.AccountNumber,
|
||||
IBan = x.IBan,
|
||||
BankName = x.BankName,
|
||||
NationalIdentifier = x.OwnersList.FirstOrDefault().NationalIdentifier,
|
||||
Owners = x.OwnersList.Select(o=> new AuthorizedBankDetailsOwnerViewModel()
|
||||
{
|
||||
FName = o.FName,
|
||||
LName = o.LName,
|
||||
NationalIdentifier = o.NationalIdentifier,
|
||||
CustomerType = o.CustomerType
|
||||
}).ToList()
|
||||
})
|
||||
.FirstOrDefault();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1062,29 +1062,5 @@ public class EmployeeRepository : RepositoryBase<long, Employee>, IEmployeeRepos
|
||||
|
||||
}
|
||||
|
||||
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
|
||||
#endregion
|
||||
}
|
||||
@@ -10,7 +10,6 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using AccountManagement.Application.Contracts.SubAccount;
|
||||
using ZstdSharp.Unsafe;
|
||||
using static Microsoft.EntityFrameworkCore.DbLoggerCategory;
|
||||
|
||||
namespace CompanyManagment.EFCore.Repository;
|
||||
@@ -267,26 +266,14 @@ public class FinancialStatmentRepository : RepositoryBase<long, FinancialStatmen
|
||||
|
||||
public async Task<FinancialStatmentDetailsByContractingPartyViewModel> GetDetailsByContractingParty(long contractingPartyId,FinancialStatementSearchModel searchModel)
|
||||
{
|
||||
var contractingParty = await _context.PersonalContractingParties
|
||||
.FirstOrDefaultAsync(x=>x.id == contractingPartyId);
|
||||
|
||||
if (contractingParty == null)
|
||||
throw new NotFoundException("طرف حساب یافت نشد");
|
||||
|
||||
var financialStatement = await _context.FinancialStatments
|
||||
.Include(x=>x.FinancialTransactionList)
|
||||
.FirstOrDefaultAsync(x=>x.ContractingPartyId == contractingPartyId);
|
||||
|
||||
|
||||
if (financialStatement == null)
|
||||
{
|
||||
financialStatement = new FinancialStatment(contractingPartyId,contractingParty.FName+" "+contractingParty.LName);
|
||||
|
||||
await _context.AddAsync(financialStatement);
|
||||
await _context.SaveChangesAsync();
|
||||
throw new NotFoundException("وضعیت مالی مورد نظر یافت نشد");
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool searched = false;
|
||||
#region Search
|
||||
|
||||
@@ -396,8 +383,7 @@ public class FinancialStatmentRepository : RepositoryBase<long, FinancialStatmen
|
||||
};
|
||||
list.Add(item);
|
||||
}
|
||||
|
||||
list.Reverse();
|
||||
|
||||
|
||||
var res = new FinancialStatmentDetailsByContractingPartyViewModel()
|
||||
{
|
||||
@@ -406,7 +392,7 @@ public class FinancialStatmentRepository : RepositoryBase<long, FinancialStatmen
|
||||
TotalCredit = financialStatement.FinancialTransactionList.Sum(x => x.Creditor),
|
||||
TotalDebt = financialStatement.FinancialTransactionList.Sum(x => x.Deptor),
|
||||
ContractingPartyName = financialStatement.ContractingPartyName,
|
||||
List = list,
|
||||
List = list.OrderByDescending(x=>x.DateTimeGr).ToList(),
|
||||
};
|
||||
return res;
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ using System.Collections.Generic;
|
||||
using System.Collections.Immutable;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using _0_Framework.Application;
|
||||
@@ -17,7 +16,6 @@ using Company.Domain.empolyerAgg;
|
||||
using Company.Domain.FinancialStatmentAgg;
|
||||
using Company.Domain.FinancialTransactionAgg;
|
||||
using Company.Domain.InstitutionContractAgg;
|
||||
using Company.Domain.InstitutionContractAmendmentTempAgg;
|
||||
using Company.Domain.InstitutionContractContactInfoAgg;
|
||||
using Company.Domain.InstitutionContractExtensionTempAgg;
|
||||
using Company.Domain.InstitutionPlanAgg;
|
||||
@@ -25,11 +23,9 @@ using Company.Domain.WorkshopAgg;
|
||||
using CompanyManagment.App.Contracts.Employer;
|
||||
using CompanyManagment.App.Contracts.InstitutionContract;
|
||||
using CompanyManagment.App.Contracts.InstitutionContractContactinfo;
|
||||
using CompanyManagment.App.Contracts.Law;
|
||||
using CompanyManagment.App.Contracts.TemporaryClientRegistration;
|
||||
using CompanyManagment.App.Contracts.Workshop;
|
||||
using CompanyManagment.App.Contracts.WorkshopPlan;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
@@ -46,20 +42,9 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
private readonly IEmployerRepository _employerRepository;
|
||||
private readonly IWorkshopRepository _workshopRepository;
|
||||
private readonly IMongoCollection<InstitutionContractExtensionTemp> _institutionExtensionTemp;
|
||||
private readonly IMongoCollection<InstitutionContractAmendmentTemp> _institutionAmendmentTemp;
|
||||
private readonly IPlanPercentageRepository _planPercentageRepository;
|
||||
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,
|
||||
IWorkshopRepository workshopRepository, IMongoDatabase database,
|
||||
IPlanPercentageRepository planPercentageRepository, ISmsService smsService) : base(context)
|
||||
@@ -71,8 +56,6 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
_smsService = smsService;
|
||||
_institutionExtensionTemp =
|
||||
database.GetCollection<InstitutionContractExtensionTemp>("InstitutionContractExtensionTemp");
|
||||
_institutionAmendmentTemp =
|
||||
database.GetCollection<InstitutionContractAmendmentTemp>("InstitutionContractAmendmentTemp");
|
||||
}
|
||||
|
||||
public EditInstitutionContract GetDetails(long id)
|
||||
@@ -1257,6 +1240,7 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
TotalCount = await joinedQuery.CountAsync(),
|
||||
List = list.Select(x =>
|
||||
{
|
||||
Console.WriteLine(x.contractingParty.id);
|
||||
var workshops = x.contractingParty.Employers
|
||||
.SelectMany(e => e.WorkshopEmployers.Select(we => we.Workshop)).DistinctBy(w => w.id).ToList();
|
||||
|
||||
@@ -1283,6 +1267,7 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
var workshopDetails = currentStateWorkshops?.Select(w =>
|
||||
{
|
||||
Workshop workshopSelected = null;
|
||||
Console.WriteLine(w.WorkshopId);
|
||||
if (w.WorkshopId != null && workshops.Select(ww => ww.id).Contains(w.WorkshopId.Value))
|
||||
{
|
||||
workshopSelected = workshops.First(ww => ww.id == w.WorkshopId.Value);
|
||||
@@ -1304,10 +1289,6 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
}
|
||||
};
|
||||
}).ToList() ?? [];
|
||||
|
||||
var employeesCount = _context.LeftWorkList
|
||||
.Where(l => workshops.Select(w => w.id).Contains(l.WorkshopId))
|
||||
.Count(l => l.StartWorkDate <= DateTime.Now && l.LeftWorkDate >= DateTime.Now);
|
||||
return new GetInstitutionContractListItemsViewModel()
|
||||
{
|
||||
ContractAmount = x.contract.ContractAmount,
|
||||
@@ -1322,17 +1303,14 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
Id = x.contract.id,
|
||||
ContractNo = x.contract.ContractNo,
|
||||
ArchiveNo = archiveCode.ToString(),
|
||||
EmployeesCount = employeesCount,
|
||||
EmployeesCount = _context.LeftWorkList
|
||||
.Where(l => workshops.Select(w => w.id).Contains(l.id))
|
||||
.Count(l => l.StartWorkDate <= DateTime.Now && l.LeftWorkDate >= DateTime.Now),
|
||||
EmployerNames = employers.Select(e => e.FullName).ToList(),
|
||||
ListStatus = status,
|
||||
IsExpired = x.contract.ContractEndGr <= endThisMontGr,
|
||||
ContractingPartyId = x.contractingParty.id,
|
||||
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)
|
||||
Workshops = workshopDetails
|
||||
};
|
||||
}).ToList()
|
||||
};
|
||||
@@ -1811,7 +1789,15 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
query.party.IsLegal == "حقیقی" ? query.party.Nationalcode : query.party.NationalId,
|
||||
LegalType = query.party.IsLegal == "حقیقی" ? LegalType.Real : LegalType.Legal,
|
||||
},
|
||||
FirstParty =_firstParty
|
||||
FirstParty = new InstitutionContratVerificationParty()
|
||||
{
|
||||
Address = "رشت - خیابان حاجی آیاد - کوچه سپهدار - ساختمان داماش - واحد 17",
|
||||
PhoneNumber = "09111111111",
|
||||
CeoName = "سید حسن مصباح",
|
||||
CompanyNameOrFullName = "نور داد مهر گستر کاسپین",
|
||||
NationalCodeOrNationalId = "1111111111",
|
||||
LegalType = LegalType.Legal
|
||||
}
|
||||
};
|
||||
|
||||
return res;
|
||||
@@ -2253,7 +2239,7 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
extensionNo, workshopsCount, employeeCount,
|
||||
previousInstitutionContract.Description,
|
||||
"NotOfficial", "JobRelation", hasValueAddedTax,
|
||||
payment.Tax.MoneyToDouble(), [],
|
||||
payment.Tax.MoneyToDouble(),[],
|
||||
request.LawId);
|
||||
|
||||
await CreateAsync(entity);
|
||||
@@ -2263,25 +2249,26 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
var workshopDetail = new InstitutionContractWorkshopInitial(
|
||||
workshop.WorkshopName, workshop.RollCall, workshop.RollCallInPerson,
|
||||
workshop.CustomizeCheckout, workshop.ContractAndCheckout,
|
||||
workshop.ContractAndCheckoutInPerson, workshop.Insurance,
|
||||
workshop.ContractAndCheckoutInPerson, workshop.Insurance,
|
||||
workshop.InsuranceInPerson, workshop.CountPerson, workshop.Price);
|
||||
|
||||
|
||||
workshopDetail.SetWorkshopGroup(entity.WorkshopGroup);
|
||||
|
||||
|
||||
if (workshop.WorkshopId != 0)
|
||||
{
|
||||
workshopDetail.SetWorkshopId(workshop.WorkshopId);
|
||||
}
|
||||
// Set parent reference
|
||||
|
||||
|
||||
// Add to the parent's collection
|
||||
entity.WorkshopGroup.InitialWorkshops.Add(workshopDetail);
|
||||
}
|
||||
|
||||
// Save the changes again
|
||||
await SaveChangesAsync();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
FinancialStatment financialStatement;
|
||||
if (_context.FinancialStatments.Any(x => x.ContractingPartyId == contractingParty.id))
|
||||
{
|
||||
@@ -2343,7 +2330,7 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
await SaveChangesAsync();
|
||||
|
||||
await _smsService.SendInstitutionVerificationLink(contractingParty.Phone, contractingPartyFullName,
|
||||
entity.PublicId, contractingParty.id, entity.id);
|
||||
entity.PublicId);
|
||||
|
||||
|
||||
await SaveChangesAsync();
|
||||
@@ -2359,251 +2346,46 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
.Include(x => x.WorkshopGroup)
|
||||
.ThenInclude(x => x.CurrentWorkshops)
|
||||
.FirstOrDefaultAsync(x => x.id == institutionContractId);
|
||||
|
||||
if (institutionContract.WorkshopGroup.CurrentWorkshops.Any(x => x.Price == 0))
|
||||
|
||||
var workshops = institutionContract.WorkshopGroup.CurrentWorkshops.Select(x => new WorkshopTempViewModel()
|
||||
{
|
||||
throw new BadRequestException(
|
||||
"این قرارداد قابل ارتقا به صورت ظاهری نیست لطفا به صورت دیتابیسی اقدام به ویرایش کنید");
|
||||
}
|
||||
Id = x.id,
|
||||
ContractAndCheckout = x.Services.Contract,
|
||||
ContractAndCheckoutInPerson = x.Services.ContractInPerson,
|
||||
CustomizeCheckout = x.Services.CustomizeCheckout,
|
||||
CountPerson = x.PersonnelCount,
|
||||
Insurance = x.Services.Insurance,
|
||||
InsuranceInPerson = x.Services.InsuranceInPerson,
|
||||
RollCall = x.Services.RollCall,
|
||||
WorkshopName = x.WorkshopName,
|
||||
WorkshopServicesAmountStr = x.Price.ToMoney(),
|
||||
WorkshopServicesAmount = x.Price,
|
||||
WorkshopId = x.WorkshopId ?? 0,
|
||||
RollCallInPerson = x.Services.RollCallInPerson,
|
||||
|
||||
var workshops = institutionContract.WorkshopGroup.CurrentWorkshops
|
||||
.Select(x => new InstitutionContractAmendmentTempPrevWorkshop(x.WorkshopName,x.PersonnelCount,
|
||||
x.Services.Contract,x.Services.ContractInPerson,x.Services.Insurance,
|
||||
x.Services.InsuranceInPerson,x.Services.RollCall,x.Services.RollCallInPerson,
|
||||
x.Services.CustomizeCheckout,x.Price,
|
||||
x.WorkshopId??0,x.id)).ToList();
|
||||
|
||||
|
||||
|
||||
var temp = new InstitutionContractAmendmentTemp(workshops, institutionContractId);
|
||||
|
||||
await _institutionAmendmentTemp.InsertOneAsync(temp);
|
||||
|
||||
var prevWorkshops = workshops.Select(x =>
|
||||
new InstitutionContractAmendmentTempWorkshopViewModel()
|
||||
{
|
||||
WorkshopName = x.WorkshopName,
|
||||
CountPerson = x.CountPerson,
|
||||
ContractAndCheckout = x.ContractAndCheckout,
|
||||
ContractAndCheckoutInPerson = x.ContractAndCheckoutInPerson,
|
||||
Insurance = x.Insurance,
|
||||
InsuranceInPerson = x.InsuranceInPerson,
|
||||
RollCall = x.RollCall,
|
||||
RollCallInPerson = x.RollCallInPerson,
|
||||
CustomizeCheckout = x.CustomizeCheckout,
|
||||
PriceStr = x.Price.ToMoney(),
|
||||
Price = x.Price,
|
||||
WorkshopId = x.WorkshopId,
|
||||
WorkshopTempId = x.Id,
|
||||
CurrentWorkshopId = x.CurrentWorkshopId,
|
||||
TempId =temp.Id
|
||||
})
|
||||
.ToList();
|
||||
}).ToList();
|
||||
var res = new InstitutionContractAmendmentWorkshopsResponse()
|
||||
{
|
||||
Workshops = prevWorkshops,
|
||||
TempId = temp.Id
|
||||
Workshops = workshops
|
||||
};
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
public async Task<InsitutionContractAmendmentPaymentResponse> GetAmendmentPaymentDetails(
|
||||
InsitutionContractAmendmentPaymentRequest request)
|
||||
public async Task<InsitutionContractAmendmentPaymentResponse> GetAmendmentPaymentDetails(InsitutionContractAmendmentPaymentRequest request)
|
||||
{
|
||||
var institutionContractAmendmentTemp = await _institutionAmendmentTemp
|
||||
.Find(x=>x.Id == request.TempId)
|
||||
.FirstOrDefaultAsync();
|
||||
if (institutionContractAmendmentTemp == null)
|
||||
throw new NotFoundException("دیتای وارد شده نامعتبر است");
|
||||
var institutionContract =await _context.InstitutionContractSet
|
||||
.Include(x => x.WorkshopGroup)
|
||||
.ThenInclude(x => x.CurrentWorkshops)
|
||||
.FirstOrDefaultAsync(x => x.id == request.InstitutionContractId);
|
||||
if (institutionContract == null)
|
||||
throw new NotFoundException("قرارداد مالی یافت نشد");
|
||||
|
||||
var amendmentStart = DateTime.Now;
|
||||
|
||||
var institutionContract = await _context.InstitutionContractSet
|
||||
.Include(x=>x.WorkshopGroup)
|
||||
.ThenInclude(x=>x.CurrentWorkshops)
|
||||
.FirstOrDefaultAsync(x => x.id == institutionContractAmendmentTemp.InstitutionContractId);
|
||||
|
||||
if (institutionContract == null)
|
||||
throw new NotFoundException("قرارداد مؤسسه یافت نشد");
|
||||
|
||||
var amendmentEnd = institutionContract.ContractEndGr;
|
||||
|
||||
var haContractInPerson = institutionContract.WorkshopGroup.CurrentWorkshops
|
||||
.Any(x => x.Services.ContractInPerson);
|
||||
if (!haContractInPerson)
|
||||
{
|
||||
if (institutionContractAmendmentTemp.NewWorkshops.Any(x => x.ContractAndCheckoutInPerson))
|
||||
{
|
||||
throw new BadRequestException("برای قرارداد آنلاین نمیتوان سرویس حضوری انتخاب کرد");
|
||||
}
|
||||
}
|
||||
|
||||
var pc = new PersianCalendar();
|
||||
|
||||
int startYear = pc.GetYear(amendmentStart);
|
||||
int startMonth = pc.GetMonth(amendmentStart);
|
||||
int startDay = pc.GetDayOfMonth(amendmentStart);
|
||||
|
||||
int endYear = pc.GetYear(amendmentEnd);
|
||||
int endMonth = pc.GetMonth(amendmentEnd);
|
||||
int endDay = pc.GetDayOfMonth(amendmentEnd);
|
||||
|
||||
// اختلاف خام ماهها
|
||||
int monthDiff = (endYear - startYear) * 12 + (endMonth - startMonth);
|
||||
|
||||
// اگر حتی چند روز از ماه بعدی هم گذشته بود → رند به بالا
|
||||
if (endDay > startDay)
|
||||
monthDiff++;
|
||||
|
||||
var sumOneMonth = institutionContractAmendmentTemp.NewWorkshops.Sum(x => x.PriceDifference);
|
||||
|
||||
var baseAmount = monthDiff * sumOneMonth;
|
||||
var tax = baseAmount*0.10;
|
||||
var totalPayment = tax+baseAmount;
|
||||
|
||||
|
||||
var res = new InsitutionContractAmendmentPaymentResponse()
|
||||
{
|
||||
ContractStart = amendmentStart.ToFarsi(),
|
||||
ContractEnd = amendmentEnd.ToFarsi(),
|
||||
OneMonthAmount = sumOneMonth.ToMoney(),
|
||||
TotalAmount = baseAmount.ToMoney(),
|
||||
};
|
||||
|
||||
res.OneTime = new InstitutionContractPaymentOneTimeViewModel()
|
||||
{
|
||||
TotalAmount = baseAmount.ToMoney(),
|
||||
PaymentAmount = totalPayment.ToMoney(),
|
||||
Tax = tax.ToMoney()
|
||||
};
|
||||
|
||||
if (haContractInPerson)
|
||||
{
|
||||
var installment = InstitutionMonthlyInstallmentCaculation(monthDiff,totalPayment, amendmentStart.ToFarsi());
|
||||
|
||||
var firstPrevInstallment = installment.First();
|
||||
var lastPrevInstallment = installment.Last();
|
||||
|
||||
var firstInstallment = new MonthlyInstallment()
|
||||
{
|
||||
InstallmentAmountStr = firstPrevInstallment.InstallmentAmountStr,
|
||||
InstallmentCounter = firstPrevInstallment.InstallmentCounter,
|
||||
InstalmentDate = amendmentStart.ToFarsi()
|
||||
};
|
||||
|
||||
var lastInstallment = new MonthlyInstallment()
|
||||
{
|
||||
InstallmentAmountStr = lastPrevInstallment.InstallmentAmountStr,
|
||||
InstallmentCounter = lastPrevInstallment.InstallmentCounter,
|
||||
InstalmentDate = lastPrevInstallment.InstalmentDate
|
||||
};
|
||||
|
||||
installment.Remove(firstPrevInstallment);
|
||||
installment.Remove(lastPrevInstallment);
|
||||
|
||||
installment.Insert(0, firstInstallment);
|
||||
installment.Add(lastInstallment);
|
||||
|
||||
res.Monthly = new InstitutionContractPaymentMonthlyViewModel()
|
||||
{
|
||||
Installments = installment,
|
||||
TotalAmount = baseAmount.ToMoney(),
|
||||
PaymentAmount = totalPayment.ToMoney(),
|
||||
Tax = tax.ToMoney()
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
//TODO : محاسبه مبلغ بر اساس کارگاه های انتخاب شده
|
||||
var res = new InsitutionContractAmendmentPaymentResponse();
|
||||
return res;
|
||||
}
|
||||
|
||||
public async Task<InsertAmendmentTempWorkshopResponse> InsertAmendmentTempWorkshops(
|
||||
InstitutionContractAmendmentTempWorkshopViewModel request)
|
||||
{
|
||||
var amendmentTemp =await _institutionAmendmentTemp
|
||||
.Find(x=> x.Id == request.TempId).FirstOrDefaultAsync();
|
||||
|
||||
if (amendmentTemp == null)
|
||||
throw new BadRequestException("دیتای وارد شده نامعتبر است");
|
||||
|
||||
var workshopTemp = amendmentTemp.NewWorkshops
|
||||
.FirstOrDefault(x => x.Id == request.WorkshopTempId);
|
||||
|
||||
var planForWorkshop = new WorkshopTempViewModel()
|
||||
{
|
||||
WorkshopName = request.WorkshopName,
|
||||
CountPerson = request.CountPerson,
|
||||
ContractAndCheckout = request.ContractAndCheckout,
|
||||
ContractAndCheckoutInPerson = request.ContractAndCheckoutInPerson,
|
||||
Insurance = request.Insurance,
|
||||
InsuranceInPerson = request.InsuranceInPerson,
|
||||
RollCall = request.RollCall,
|
||||
RollCallInPerson = request.RollCallInPerson,
|
||||
CustomizeCheckout = request.CustomizeCheckout
|
||||
};
|
||||
var price = _planPercentageRepository.GetInstitutionPlanForWorkshop(planForWorkshop)
|
||||
.OnlineAndInPersonSumAmountDouble;
|
||||
|
||||
if (workshopTemp == null)
|
||||
{
|
||||
var newWorkshopTemp = new InstitutionContractAmendmentTempNewWorkshop(request.WorkshopName,
|
||||
request.CountPerson,
|
||||
request.ContractAndCheckout, request.ContractAndCheckoutInPerson,
|
||||
request.Insurance, request.InsuranceInPerson,
|
||||
request.RollCall, request.RollCallInPerson,
|
||||
request.CustomizeCheckout, price,
|
||||
request.WorkshopId,0,price);
|
||||
|
||||
workshopTemp = newWorkshopTemp;
|
||||
|
||||
|
||||
amendmentTemp.NewWorkshops.Add(newWorkshopTemp);
|
||||
|
||||
await _institutionAmendmentTemp
|
||||
.ReplaceOneAsync(x => x.Id == amendmentTemp.Id, amendmentTemp);
|
||||
}
|
||||
else
|
||||
{
|
||||
amendmentTemp.NewWorkshops.Remove(workshopTemp);
|
||||
|
||||
var differencePrice = price - workshopTemp.Price;
|
||||
workshopTemp.Edit(request.WorkshopName, request.CountPerson,
|
||||
request.ContractAndCheckout, request.ContractAndCheckoutInPerson,
|
||||
request.Insurance, request.InsuranceInPerson,
|
||||
request.RollCall,
|
||||
request.CustomizeCheckout, price,differencePrice);
|
||||
|
||||
amendmentTemp.NewWorkshops.Add(workshopTemp);
|
||||
|
||||
await _institutionAmendmentTemp
|
||||
.ReplaceOneAsync(x => x.Id == amendmentTemp.Id, amendmentTemp);
|
||||
}
|
||||
|
||||
return new InsertAmendmentTempWorkshopResponse()
|
||||
{
|
||||
WorkshopTempId = workshopTemp.Id,
|
||||
Amount = workshopTemp.PriceDifference.ToMoney()
|
||||
};
|
||||
}
|
||||
|
||||
public async Task RemoveAmendmentWorkshops(Guid workshopTempId)
|
||||
{
|
||||
var amendmentTemp = await _institutionAmendmentTemp.Find(x => x.NewWorkshops.Any(w => w.Id == workshopTempId))
|
||||
.FirstOrDefaultAsync();
|
||||
if (amendmentTemp == null)
|
||||
throw new BadRequestException("دیتای وارد شده نامعتبر است");
|
||||
var workshopTemp = amendmentTemp.NewWorkshops.FirstOrDefault(x => x.Id == workshopTempId);
|
||||
if (workshopTemp == null)
|
||||
throw new BadRequestException("دیتای وارد شده نامعتبر است");
|
||||
|
||||
if (workshopTemp.CurrentWorkshopId!=0)
|
||||
throw new BadRequestException("شما نمی توانید این کارگاه را حذف کنید زیرا در قرارداد اصلی وجود دارد");
|
||||
|
||||
amendmentTemp.NewWorkshops.Remove(workshopTemp);
|
||||
|
||||
await _institutionAmendmentTemp.ReplaceOneAsync(x => x.Id == amendmentTemp.Id, amendmentTemp);
|
||||
|
||||
}
|
||||
public async Task<List<InstitutionContractSelectListViewModel>> GetInstitutionContractSelectList(string search,
|
||||
string selected)
|
||||
@@ -2659,110 +2441,34 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
|
||||
}
|
||||
|
||||
public async Task<List<InstitutionContractPrintViewModel>> PrintAllAsync(List<long> ids)
|
||||
public async Task<(double amount,long contractingPartyId,long institutionContractId)> GetFirstPaymentAmount(Guid id)
|
||||
{
|
||||
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 institutionContract = await _context.InstitutionContractSet
|
||||
.Include(institutionContract => institutionContract.Installments)
|
||||
.FirstOrDefaultAsync(x => x.PublicId == id);
|
||||
|
||||
var contractingPartyIds = query.Select(x => x.ContractingPartyId).ToList();
|
||||
var contractingParties = await _context.PersonalContractingParties
|
||||
.Where(x => contractingPartyIds.Contains(x.id))
|
||||
.ToListAsync();
|
||||
long contractingPartyId = institutionContract.ContractingPartyId;
|
||||
long institutionContractId = institutionContract.id;
|
||||
if (institutionContract == null)
|
||||
throw new NotFoundException("قرارداد مالی یافت نشد");
|
||||
|
||||
var list = query.ToList();
|
||||
if (!institutionContract.IsInstallment)
|
||||
return (institutionContract.TotalAmount,contractingPartyId,institutionContractId);
|
||||
|
||||
if (list.Count == 0)
|
||||
throw new NotFoundException("قرارداد مؤسسه یافت نشد");
|
||||
var institutionContractInstallment = institutionContract.Installments.FirstOrDefault();
|
||||
if (institutionContractInstallment == null)
|
||||
throw new NotFoundException("قسطی برای این قرارداد یافت نشد");
|
||||
return (institutionContract.TotalAmount,contractingPartyId,institutionContractId);
|
||||
}
|
||||
|
||||
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;
|
||||
public InstitutionContract GetIncludeContacts(long institutionContractId)
|
||||
{
|
||||
var institutionContract = _context.InstitutionContractSet
|
||||
.Include(x => x.ContactInfoList)
|
||||
.FirstOrDefault(x => x.id == institutionContractId);
|
||||
if (institutionContract == null)
|
||||
throw new NotFoundException("قرارداد مالی یافت نشد");
|
||||
return institutionContract;
|
||||
}
|
||||
|
||||
|
||||
@@ -2788,7 +2494,7 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
// حالت پرداخت اقساطی
|
||||
var monthlyTax = baseAmount * 0.10;
|
||||
var monthlyTotal = baseAmount + monthlyTax;
|
||||
var installments = InstitutionMonthlyInstallmentCaculation((int)duration, monthlyTotal, selectedPlan.ContractStart);
|
||||
var installments = InstitutionMonthlyInstallmentCaculation(duration, monthlyTotal, selectedPlan.ContractStart);
|
||||
|
||||
res.Monthly = new()
|
||||
{
|
||||
@@ -2870,7 +2576,7 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
return result;
|
||||
}
|
||||
|
||||
public static List<MonthlyInstallment> InstitutionMonthlyInstallmentCaculation(int duration,
|
||||
public static List<MonthlyInstallment> InstitutionMonthlyInstallmentCaculation(InstitutionContractDuration duration,
|
||||
double monthlyTotalPaymentDouble,
|
||||
string installmentstart)
|
||||
{
|
||||
@@ -2878,7 +2584,7 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
var installmentList = new List<MonthlyInstallment>();
|
||||
|
||||
|
||||
int instalmentCount = duration;
|
||||
int instalmentCount = (int)duration;
|
||||
var instalmentAmount = monthlyTotalPaymentDouble / instalmentCount;
|
||||
int currentInstallmentStartDay = int.Parse(installmentstart.Substring(8, 2));
|
||||
bool endOfMonth = currentInstallmentStartDay == 31;
|
||||
@@ -2938,7 +2644,6 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
#region CustomViewModels
|
||||
|
||||
|
||||
@@ -1724,86 +1724,9 @@ 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);
|
||||
|
||||
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)
|
||||
.ThenByDescending(x => x.Month).ThenByDescending(x => x.EmployerName);
|
||||
|
||||
if (!string.IsNullOrEmpty(searchModel.WorkShopName))
|
||||
query = query.Where(x => x.WorkShopName.Contains(searchModel.WorkShopName))
|
||||
.OrderByDescending(x => x.EmployerName).ThenByDescending(x => x.Year).OrderByDescending(x => x.Month);
|
||||
|
||||
|
||||
if (searchModel.WorkshopId > 0)
|
||||
{
|
||||
var workshopName = query.FirstOrDefault(u => u.WorkShopId == searchModel.WorkshopId)?.WorkShopName;
|
||||
|
||||
query = query.Where(x => x.WorkShopName.Contains(workshopName)).OrderByDescending(x => x.EmployerName)
|
||||
.ThenByDescending(x => x.Year).ThenByDescending(x => x.Month);
|
||||
}
|
||||
|
||||
if (searchModel.EmployerId > 0)
|
||||
{
|
||||
var employerName = query.FirstOrDefault(u => u.EmployerId == searchModel.EmployerId)?.EmployerName;
|
||||
query = query.Where(x => x.EmployerName.Contains(employerName)).OrderByDescending(x => x.EmployerName)
|
||||
.ThenByDescending(x => x.Year).ThenByDescending(x => x.Month);
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(searchModel.EmployerName))
|
||||
query = query.Where(x => x.EmployerName.Contains(searchModel.EmployerName))
|
||||
.OrderByDescending(x => x.EmployerName).ThenByDescending(x => x.Year).OrderByDescending(x => x.Month);
|
||||
|
||||
|
||||
if (searchModel.FixedSalary != null)
|
||||
query = query.Where(x => x.FixedSalary == searchModel.FixedSalary);
|
||||
|
||||
if (!string.IsNullOrEmpty(searchModel.TypeOfInsuranceSend) && searchModel.TypeOfInsuranceSend != "0")
|
||||
query = query.Where(x => x.TypeOfInsuranceSend == searchModel.TypeOfInsuranceSend);
|
||||
|
||||
if (!string.IsNullOrEmpty(searchModel.City) && searchModel.City != "0")
|
||||
query = query.Where(x => x.City == searchModel.City);
|
||||
|
||||
if (!string.IsNullOrEmpty(searchModel.Branch))
|
||||
query = query.Where(x => x.Branch.Contains(searchModel.Branch));
|
||||
|
||||
|
||||
var workshopList = await query.Skip(searchModel.PageIndex).Take(30).ToListAsync();
|
||||
var workshopIds = workshopList.Select(x=>x.WorkShopId);
|
||||
var workshopList = await notCreatedWorkshop.Skip(searchModel.PageIndex).Take(30).ToListAsync();
|
||||
var workshopIds = workshopList.Select(x=>x.id);
|
||||
|
||||
var employers =await _context.WorkshopEmployers
|
||||
.Where(x=>workshopIds.Contains(x.WorkshopId))
|
||||
@@ -1812,16 +1735,20 @@ public class InsuranceListRepository : RepositoryBase<long, InsuranceList>, IIns
|
||||
|
||||
var res = workshopList.Select(x =>
|
||||
{
|
||||
var employer = employers.FirstOrDefault(e => e.WorkshopId ==x.WorkShopId)?.Employer;
|
||||
var employer = employers.FirstOrDefault(e => e.WorkshopId ==x.id)?.Employer;
|
||||
|
||||
return new InsuranceListViewModel
|
||||
{
|
||||
WorkShopId = x.WorkShopId,
|
||||
WorkShopCode = x.WorkShopCode,
|
||||
WorkShopName = x.WorkShopName,
|
||||
WorkShopId = x.id,
|
||||
WorkShopCode = x.InsuranceCode,
|
||||
WorkShopName = x.InsuranceWorkshopInfo != null
|
||||
? x.InsuranceWorkshopInfo.WorkshopName
|
||||
: x.WorkshopFullName,
|
||||
EmployerName = employer != null
|
||||
? employer.FullName
|
||||
: (x.EmployerName),
|
||||
: (x.InsuranceWorkshopInfo != null
|
||||
? x.InsuranceWorkshopInfo.EmployerName
|
||||
: x.WorkshopFullName),
|
||||
Year = searchModel.Year,
|
||||
Month = searchModel.Month,
|
||||
TypeOfInsuranceSend = x.TypeOfInsuranceSend == "NormalList" ? "عادی" :
|
||||
|
||||
@@ -1052,11 +1052,11 @@ public class RollCallRepository : RepositoryBase<long, RollCall>, IRollCallRepos
|
||||
|
||||
|
||||
//گزارش آنلاین حضور غیاب کارگاه
|
||||
public CurrentDayRollCall GetWorkshopCurrentDayRollCalls(long workshopId,
|
||||
WorkshopCurrentDayRollCallSearchModel searchModel)
|
||||
public CurrentDayRollCall GetWorkshopCurrentDayRollCalls(long workshopId)
|
||||
{
|
||||
var date = DateTime.Now.Date;
|
||||
|
||||
|
||||
|
||||
//get active leaves for workshop which are active today and accepted and are either روزانه and استحقاقی or استعلاجی
|
||||
var leaves = _context.LeaveList
|
||||
.Where(x =>
|
||||
@@ -1070,11 +1070,7 @@ public class RollCallRepository : RepositoryBase<long, RollCall>, IRollCallRepos
|
||||
//var workingEmployees =
|
||||
// _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
|
||||
var activeEmployees =
|
||||
@@ -1088,15 +1084,6 @@ public class RollCallRepository : RepositoryBase<long, RollCall>, IRollCallRepos
|
||||
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));
|
||||
@@ -1530,9 +1517,7 @@ public class RollCallRepository : RepositoryBase<long, RollCall>, IRollCallRepos
|
||||
StartDate = y.StartDate.Value.ToString("HH:mm"),
|
||||
EndDate = y.EndDate!.Value.ToString("HH:mm"),
|
||||
StartDateGr = y.StartDate.Value,
|
||||
EndDateGr = y.EndDate.Value,
|
||||
EntryTimeDifferences = CalculateEntryTimeDifferences( y.EarlyEntryDuration, y.LateEntryDuration),
|
||||
ExitTimeDifferences = CalculateExitTimeDifferences(y.EarlyExitDuration, y.LateExitDuration)
|
||||
EndDateGr = y.EndDate.Value
|
||||
}),
|
||||
TotalWorkingHoursSpan = new TimeSpan(rollCallsList.Where(y => x.Date == y.ShiftDate.Date)
|
||||
.Sum(y => (y.EndDate!.Value - y.StartDate.Value).Ticks)),
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Net.Http.Json;
|
||||
using System.Text;
|
||||
@@ -9,7 +7,6 @@ using Newtonsoft.Json;
|
||||
using CompanyManagment.App.Contracts.AuthorizedPerson;
|
||||
using _0_Framework.Application;
|
||||
using _0_Framework.Application.UID;
|
||||
using Company.Application.Contracts.AuthorizedBankDetails;
|
||||
|
||||
namespace CompanyManagment.EFCore.Services;
|
||||
|
||||
@@ -17,21 +14,19 @@ public class UidService : IUidService
|
||||
{
|
||||
private readonly HttpClient _httpClient;
|
||||
private readonly IAuthorizedPersonApplication _authorizedPersonApplication;
|
||||
private readonly IAuthorizedBankDetailsApplication _authorizedBankDetailsApplication;
|
||||
private const string BaseUrl = "https://json-api.uid.ir/api/";
|
||||
|
||||
public const string BusinessToken = "5e03dd4e-999d-466f-92d8-7c0b1f66a8e9";
|
||||
public const string BusinessId = "98ed67ca-d441-4978-a748-e8bebce010eb";
|
||||
|
||||
|
||||
public UidService(IAuthorizedPersonApplication authorizedPersonApplication, IAuthorizedBankDetailsApplication authorizedBankDetailsApplication)
|
||||
public UidService(IAuthorizedPersonApplication authorizedPersonApplication)
|
||||
{
|
||||
_httpClient = new HttpClient()
|
||||
{
|
||||
BaseAddress = new Uri(BaseUrl)
|
||||
};
|
||||
_authorizedPersonApplication = authorizedPersonApplication;
|
||||
_authorizedBankDetailsApplication = authorizedBankDetailsApplication;
|
||||
}
|
||||
|
||||
public async Task<PersonalInfoResponse> GetPersonalInfo(string nationalCode, string birthDate)
|
||||
@@ -157,94 +152,18 @@ public class UidService : IUidService
|
||||
|
||||
public async Task<IbanInquiryResponse> IbanInquiry(string iban)
|
||||
{
|
||||
// First check if bank details exist in database
|
||||
var existingBankDetails = _authorizedBankDetailsApplication.GetByIban(iban);
|
||||
if (existingBankDetails != null)
|
||||
{
|
||||
// Return data from database instead of calling API
|
||||
return CreateIbanInquiryResponseFromDatabase(existingBankDetails);
|
||||
}
|
||||
|
||||
// If not found in database, call UID API
|
||||
var request = new
|
||||
{
|
||||
iban,
|
||||
requestContext = new UidRequestContext()
|
||||
};
|
||||
var json = JsonConvert.SerializeObject(request);
|
||||
var contentType = new StringContent(json, Encoding.UTF8, "application/json");
|
||||
|
||||
try
|
||||
{
|
||||
var request = new
|
||||
{
|
||||
iban,
|
||||
requestContext = new UidRequestContext()
|
||||
};
|
||||
var json = JsonConvert.SerializeObject(request);
|
||||
var contentType = new StringContent(json, Encoding.UTF8, "application/json");
|
||||
var requestResult = await _httpClient.PostAsync("inquiry/iban/v2", contentType);
|
||||
requestResult.EnsureSuccessStatusCode();
|
||||
//var stringRes =await requestResult.Content.ReadAsStringAsync();
|
||||
var responseResult = await requestResult.Content.ReadFromJsonAsync<IbanInquiryResponse>();
|
||||
|
||||
if (responseResult.ResponseContext.Status.Code == 0)
|
||||
{
|
||||
var entity = new CreateAuthorizedBankDetails
|
||||
{
|
||||
IBan = iban,
|
||||
AccountNumber = responseResult?.AccountBasicInformation?.AccountNumber ?? "",
|
||||
BankName = responseResult?.AccountBasicInformation?.BankInformation?.BankName ?? "",
|
||||
OwnersList = responseResult?.Owners.Select(x=> new CreateAuthorizedBankDetailsOwner()
|
||||
{
|
||||
FName = x.FirstName,
|
||||
LName = x.LastName,
|
||||
NationalIdentifier = x.NationalIdentifier,
|
||||
CustomerType = x.CustomerType
|
||||
}).ToList() ?? []
|
||||
};
|
||||
_authorizedBankDetailsApplication.Create(entity);
|
||||
}
|
||||
|
||||
return responseResult;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return new IbanInquiryResponse
|
||||
{
|
||||
ResponseContext = new ResponseContext(new UidStatus(14, "خطا در دریافت اطلاعات از سرویس"))
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
private IbanInquiryResponse CreateIbanInquiryResponseFromDatabase(AuthorizedBankDetailsViewModel bankDetails)
|
||||
{
|
||||
var accountBasicInfo = new IbanInquiryAccountBasicInformation
|
||||
{
|
||||
Iban = bankDetails.IBan,
|
||||
AccountNumber = bankDetails.AccountNumber,
|
||||
BankInformation = new IbanInquiryBankInformation
|
||||
{
|
||||
BankName = bankDetails.BankName
|
||||
},
|
||||
AccountStatus = "Active"
|
||||
};
|
||||
|
||||
var owners = new List<IbanInquiryOwner>();
|
||||
|
||||
// Add owner information if available
|
||||
if (bankDetails.Owners.Any())
|
||||
{
|
||||
var owner = bankDetails.Owners.First();
|
||||
owners.Add(new IbanInquiryOwner
|
||||
{
|
||||
NationalIdentifier = owner.NationalIdentifier,
|
||||
FirstName = owner.FName,
|
||||
LastName = owner.LName,
|
||||
CustomerType = owner.CustomerType
|
||||
});
|
||||
}
|
||||
|
||||
var responseContext = new ResponseContext(new UidStatus(0, "Success - از دیتابیس"));
|
||||
|
||||
return new IbanInquiryResponse
|
||||
{
|
||||
AccountBasicInformation = accountBasicInfo,
|
||||
Owners = owners,
|
||||
ResponseContext = responseContext
|
||||
};
|
||||
}
|
||||
|
||||
public async Task<AccountToIbanResponse> AccountToIban(string accountNumber, UidBanks bank)
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using _0_Framework.Application.UID;
|
||||
using Company.Application.Contracts.AuthorizedBankDetails;
|
||||
using Company.Domain.BillAgg;
|
||||
using Company.Domain.Board;
|
||||
using Company.Domain.ChapterAgg;
|
||||
@@ -210,7 +209,6 @@ using Company.Domain.ContactUsAgg;
|
||||
using CompanyManagment.App.Contracts.ContactUs;
|
||||
using Company.Domain.EmployeeAuthorizeTempAgg;
|
||||
using Company.Domain.AdminMonthlyOverviewAgg;
|
||||
using Company.Domain.AuthorizedBankDetailsAgg;
|
||||
using Company.Domain.ContractingPartyBankAccountsAgg;
|
||||
using Company.Domain.PaymentInstrumentAgg;
|
||||
using Company.Domain.PaymentTransactionAgg;
|
||||
@@ -474,9 +472,6 @@ public class PersonalBootstrapper
|
||||
services.AddTransient<ILawApplication,LawApplication>();
|
||||
services.AddTransient<ILawRepository,LawRepository>();
|
||||
|
||||
services.AddTransient<IAuthorizedBankDetailsRepository, AuthorizedBankDetailsRepository>();
|
||||
services.AddTransient<IAuthorizedBankDetailsApplication, AuthorizedBankDetailsApplication>();
|
||||
|
||||
services
|
||||
.AddTransient<IInstitutionContractExtenstionTempRepository, InstitutionContractExtenstionTempRepository>();
|
||||
#endregion
|
||||
|
||||
@@ -2,6 +2,7 @@ using System.Collections.Concurrent;
|
||||
using System.Transactions;
|
||||
using _0_Framework.Application;
|
||||
using _0_Framework.Application.Enums;
|
||||
using _0_Framework.Application.PaymentGateway;
|
||||
using _0_Framework.Application.Sms;
|
||||
using _0_Framework.Exceptions;
|
||||
using AccountManagement.Application.Contracts.Account;
|
||||
@@ -11,6 +12,7 @@ using CompanyManagment.App.Contracts.Employer;
|
||||
using CompanyManagment.App.Contracts.InstitutionContract;
|
||||
using CompanyManagment.App.Contracts.InstitutionContractContactinfo;
|
||||
using CompanyManagment.App.Contracts.InstitutionPlan;
|
||||
using CompanyManagment.App.Contracts.PaymentTransaction;
|
||||
using CompanyManagment.App.Contracts.PersonalContractingParty;
|
||||
using CompanyManagment.App.Contracts.Representative;
|
||||
using CompanyManagment.App.Contracts.TemporaryClientRegistration;
|
||||
@@ -19,6 +21,7 @@ using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.Rendering;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Conventions;
|
||||
using Microsoft.Extensions.Options;
|
||||
using ServiceHost.Areas.Client.Pages.Company.PaymentToEmployee;
|
||||
using ServiceHost.BaseControllers;
|
||||
|
||||
@@ -37,6 +40,9 @@ public class institutionContractController : AdminBaseController
|
||||
private readonly IWorkshopApplication _workshopApplication;
|
||||
private readonly ITemporaryClientRegistrationApplication _temporaryClientRegistration;
|
||||
private readonly ITemporaryClientRegistrationApplication _clientRegistrationApplication;
|
||||
private readonly IPaymentGateway _paymentGateway;
|
||||
private readonly IPaymentTransactionApplication _paymentTransactionApplication;
|
||||
|
||||
private static readonly ConcurrentDictionary<Guid, SemaphoreSlim> _locks
|
||||
= new ConcurrentDictionary<Guid, SemaphoreSlim>();
|
||||
|
||||
@@ -45,7 +51,9 @@ public class institutionContractController : AdminBaseController
|
||||
public institutionContractController(IInstitutionContractApplication institutionContractApplication,
|
||||
IPersonalContractingPartyApp contractingPartyApplication, IContactInfoApplication contactInfoApplication,
|
||||
IAccountApplication accountApplication, IEmployerApplication employerApplication,
|
||||
IWorkshopApplication workshopApplication, ITemporaryClientRegistrationApplication temporaryClientRegistration, ITemporaryClientRegistrationApplication clientRegistrationApplication)
|
||||
IWorkshopApplication workshopApplication, ITemporaryClientRegistrationApplication temporaryClientRegistration,
|
||||
ITemporaryClientRegistrationApplication clientRegistrationApplication, IHttpClientFactory httpClientFactory,
|
||||
IOptions<AppSettingConfiguration> appSetting, IPaymentTransactionApplication paymentTransactionApplication)
|
||||
{
|
||||
_institutionContractApplication = institutionContractApplication;
|
||||
_contractingPartyApplication = contractingPartyApplication;
|
||||
@@ -55,6 +63,8 @@ public class institutionContractController : AdminBaseController
|
||||
_workshopApplication = workshopApplication;
|
||||
_temporaryClientRegistration = temporaryClientRegistration;
|
||||
_clientRegistrationApplication = clientRegistrationApplication;
|
||||
_paymentTransactionApplication = paymentTransactionApplication;
|
||||
_paymentGateway = new AqayePardakhtPaymentGateway(httpClientFactory, appSetting);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -468,6 +478,57 @@ public class institutionContractController : AdminBaseController
|
||||
return res;
|
||||
}
|
||||
|
||||
[HttpPost("/api/institutionContract/pay")]
|
||||
public async Task<ActionResult<OperationResult>> PayContract([FromForm]institutionContractPayContractRequest request)
|
||||
{
|
||||
var id = request.Id;
|
||||
var baseUrl = request.BaseUrl;
|
||||
var op = new OperationResult();
|
||||
var amount = await _institutionContractApplication.GetFirstPaymentAmount(id);
|
||||
var callbackUrl = Url.Action(
|
||||
action: "InstitutionContractCallBack",
|
||||
controller: "General", // نام کنترلر بدون کلمهی "Controller"
|
||||
values: null,
|
||||
protocol: Request.Scheme); // http یا https
|
||||
|
||||
var transactionCommand = new CreatePaymentTransaction()
|
||||
{
|
||||
Amount = amount.amount,
|
||||
ContractingPartyId = amount.contractingPartyId,
|
||||
CallBackUrl = baseUrl,
|
||||
Source = PaymentTransactionSource.InstitutionContract,
|
||||
SourceId = amount.institutionContractId
|
||||
};
|
||||
var transaction = await _paymentTransactionApplication.Create(transactionCommand);
|
||||
|
||||
if (!transaction.IsSuccedded)
|
||||
{
|
||||
return op.Failed(transaction.Message);
|
||||
}
|
||||
|
||||
var command = new CreatePaymentGatewayRequest()
|
||||
{
|
||||
CallBackUrl = callbackUrl,
|
||||
Amount = amount.amount/10,
|
||||
InvoiceId = transaction.SendId.ToString(),
|
||||
};
|
||||
|
||||
var gatewayResponse = await _paymentGateway.Create(command);
|
||||
|
||||
if (gatewayResponse.IsSuccess)
|
||||
{
|
||||
_ = await _paymentTransactionApplication.SetTransactionId(transaction.SendId, gatewayResponse.TransactionId);
|
||||
return Redirect(_paymentGateway.GetStartPayUrl(gatewayResponse.TransactionId));
|
||||
}
|
||||
|
||||
if (gatewayResponse.ErrorCode.HasValue)
|
||||
{
|
||||
return op.Failed($"خطا در ایجاد درگاه پرداخت: {gatewayResponse.ErrorCode.Value}");
|
||||
}
|
||||
|
||||
return op.Failed("خطا در ایجاد درگاه پرداخت");
|
||||
}
|
||||
|
||||
[HttpPost("/api/institutionContract/Verification/{id:guid}/send-otp")]
|
||||
[AllowAnonymous]
|
||||
public async Task<ActionResult<OperationResult<OtpResultViewModel>>> SendVerifyOtp(Guid id)
|
||||
@@ -527,231 +588,13 @@ public class institutionContractController : AdminBaseController
|
||||
var res =await _institutionContractApplication.GetAmendmentWorkshops(institutionContractId);
|
||||
return res;
|
||||
}
|
||||
|
||||
[HttpPost("resend-verify-link/{institutionContractId}")]
|
||||
public async Task<OperationResult> ResendVerifyLink(long institutionContractId)
|
||||
{
|
||||
var res = await _institutionContractApplication.ResendVerifyLink(institutionContractId);
|
||||
return res;
|
||||
}
|
||||
|
||||
[HttpPost("amendment/insert-temp-workshops")]
|
||||
public async Task<ActionResult<InsertAmendmentTempWorkshopResponse>> InsertAmendmentTempWorkshops([FromBody]InstitutionContractAmendmentTempWorkshopViewModel request)
|
||||
{
|
||||
var res =await _institutionContractApplication.InsertAmendmentTempWorkshops(request);
|
||||
return res;
|
||||
}
|
||||
[HttpDelete("amendment/remove-temp-workshops/{workshopTempId:guid}")]
|
||||
public async Task<ActionResult> RemoveAmendmentWorkshops(Guid workshopTempId)
|
||||
{
|
||||
await _institutionContractApplication.RemoveAmendmentWorkshops(workshopTempId);
|
||||
return Ok();
|
||||
}
|
||||
[HttpPost("amendment/payment-details")]
|
||||
public async Task<ActionResult<InsitutionContractAmendmentPaymentResponse>> GetAmendmentPaymentDetails([FromBody]InsitutionContractAmendmentPaymentRequest request)
|
||||
{
|
||||
var res =await _institutionContractApplication.GetAmendmentPaymentDetails(request);
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
[HttpGet("edit-old/{id}")]
|
||||
public ActionResult<EditInstitutionContract> GetEditOldDetails(long id)
|
||||
{
|
||||
var representativList = new List<RepresentativeViewModel>();
|
||||
var contractingPartyList = new List<PersonalContractingPartyViewModel>();
|
||||
var res = _institutionContractApplication.GetDetails(id);
|
||||
|
||||
var representative = new RepresentativeViewModel
|
||||
{
|
||||
Id = res.RepresentativeId,
|
||||
FullName = res.RepresentativeName
|
||||
};
|
||||
representativList.Add(representative);
|
||||
var contractingParty = new PersonalContractingPartyViewModel
|
||||
{
|
||||
id = res.ContractingPartyId,
|
||||
FullName = _contractingPartyApplication.GetFullName(res.ContractingPartyId)
|
||||
};
|
||||
contractingPartyList.Add(contractingParty);
|
||||
res.RepresentativeSelectList =
|
||||
new SelectList(representativList, "Id", "FullName");
|
||||
res.ContractingPartiesSelectList =
|
||||
new SelectList(contractingPartyList, "id", "FullName");
|
||||
|
||||
var employer = _employerApplication.GetEmployerByContracrtingPartyID(res.ContractingPartyId);
|
||||
var emplId = employer.Select(x => x.Id).ToList();
|
||||
|
||||
var w = _workshopApplication.GetWorkshopsByEmployerId(emplId);
|
||||
var workshopIds = w.Select(x => x.Id).ToList();
|
||||
var workshopCount = Convert.ToString(w.Count);
|
||||
var pCount = 0;
|
||||
if (workshopIds.Count > 0)
|
||||
{
|
||||
foreach (var workshopId in workshopIds)
|
||||
{
|
||||
var p = _workshopApplication.PersonnelCount(workshopId);
|
||||
pCount += p;
|
||||
}
|
||||
|
||||
res.EmployeeCount = Convert.ToString(pCount);
|
||||
}
|
||||
else
|
||||
{
|
||||
res.EmployeeCount = "0";
|
||||
}
|
||||
|
||||
res.WorkshopCount = workshopCount;
|
||||
|
||||
|
||||
var contactInfo = _contactInfoApplication.GetContactInfolist(id);
|
||||
if (contactInfo.Count > 0)
|
||||
{
|
||||
res.ContactInfoCounter = contactInfo.Count;
|
||||
res.ContactInformationList = contactInfo;
|
||||
}
|
||||
else
|
||||
{
|
||||
res.ContactInfoCounter = 0;
|
||||
}
|
||||
|
||||
if (res.HasValueAddedTax == "true")
|
||||
{
|
||||
res.ContractAmount -= res.ValueAddedTax;
|
||||
res.ContractAmountOAlone = res.ContractAmount.ToMoney();
|
||||
res.ValueAddedTaxStr = res.ValueAddedTax.ToMoney();
|
||||
}
|
||||
else
|
||||
{
|
||||
res.ContractAmountOAlone = res.ContractAmountString;
|
||||
res.ValueAddedTaxStr = "0";
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
[HttpPost("edit-old")]
|
||||
public ActionResult<OperationResult> EditOld([FromBody] EditInstitutionContract command)
|
||||
{
|
||||
var op = new OperationResult();
|
||||
var phoneNumber = command.ContactInformationList.FirstOrDefault(x =>
|
||||
x.SendSmsString == "true" && x.Position == "طرف قرارداد" && x.PhoneType == "شماره همراه");
|
||||
var conractingParty = _contractingPartyApplication.GetDetails(command.ContractingPartyId);
|
||||
|
||||
if (conractingParty.IsLegal == "حقیقی" && string.IsNullOrWhiteSpace(conractingParty.Nationalcode))
|
||||
return new JsonResult(op.Failed("کد ملی طرف حساب وجود ندارد"));
|
||||
if (conractingParty.IsLegal == "حقوقی" && string.IsNullOrWhiteSpace(conractingParty.NationalId))
|
||||
return new JsonResult(op.Failed("شناسه ملی طرف حساب وجود ندارد"));
|
||||
if (phoneNumber == null)
|
||||
return new JsonResult(op.Failed("تعیین شماره همراه با سمت طرف قرارداد اجباریست"));
|
||||
//if (string.IsNullOrWhiteSpace(command.HasValueAddedTax))
|
||||
// command.HasValueAddedTax = "false";
|
||||
var result = _institutionContractApplication.Edit(command);
|
||||
var contractingPartyId = _institutionContractApplication.GetDetails(result.SendId);
|
||||
var counter = command.ContactInformationList.Count;
|
||||
var getOldContarct = _institutionContractApplication.NewSearch(new InstitutionContractSearchModel()
|
||||
{ ContractingPartyId = contractingPartyId.ContractingPartyId, IsActiveString = "both" }).Where(x=>x.IsActiveString == "false" || x.IsActiveString == "blue").ToList();
|
||||
if (result.IsSuccedded && counter > 0)
|
||||
{
|
||||
|
||||
if (getOldContarct.Count > 0)
|
||||
{
|
||||
foreach (var item in getOldContarct)
|
||||
{
|
||||
_contactInfoApplication.RemoveContactInfo(item.Id);
|
||||
foreach (var phone in command.ContactInformationList)
|
||||
{
|
||||
if (phone.PhoneNumber != null)
|
||||
{
|
||||
var contactinfo = new CreateContactInfo
|
||||
{
|
||||
InstitutionContractId = item.Id,
|
||||
PhoneType = phone.PhoneType,
|
||||
Position = phone.Position,
|
||||
PhoneNumber = phone.PhoneNumber,
|
||||
FnameLname = phone.FnameLname,
|
||||
SendSms = phone.SendSmsString == "true" ? true : false
|
||||
};
|
||||
_contactInfoApplication.Create(contactinfo);
|
||||
}
|
||||
|
||||
Thread.Sleep(500);
|
||||
}
|
||||
}
|
||||
}
|
||||
_contactInfoApplication.RemoveContactInfo(command.Id);
|
||||
foreach (var item in command.ContactInformationList)
|
||||
{
|
||||
if (item.PhoneNumber != null)
|
||||
{
|
||||
var contactinfo = new CreateContactInfo
|
||||
{
|
||||
InstitutionContractId = result.SendId,
|
||||
PhoneType = item.PhoneType,
|
||||
Position = item.Position,
|
||||
PhoneNumber = item.PhoneNumber,
|
||||
FnameLname = item.FnameLname,
|
||||
SendSms = item.SendSmsString == "true" ? true : false
|
||||
};
|
||||
_contactInfoApplication.Create(contactinfo);
|
||||
}
|
||||
|
||||
Thread.Sleep(500);
|
||||
}
|
||||
|
||||
|
||||
//ساخت اکانت کلاینت
|
||||
var userPass = conractingParty.IsLegal == "حقیقی"
|
||||
? conractingParty.Nationalcode
|
||||
: conractingParty.NationalId;
|
||||
var checkExistAccount = _accountApplication.CheckExistClientAccount(userPass);
|
||||
if (!checkExistAccount)
|
||||
{
|
||||
|
||||
var createAcc = new RegisterAccount
|
||||
{
|
||||
Fullname = conractingParty.LName,
|
||||
Username = userPass,
|
||||
Password = userPass,
|
||||
Mobile = phoneNumber.PhoneNumber,
|
||||
NationalCode = userPass
|
||||
};
|
||||
var res = _accountApplication.RegisterClient(createAcc);
|
||||
if (res.IsSuccedded)
|
||||
_institutionContractApplication.CreateContractingPartyAccount(command.ContractingPartyId, res.SendId);
|
||||
}
|
||||
}
|
||||
//Thread.Sleep(500);
|
||||
//for (int i = 0; i <= counter - 1; i++)
|
||||
//{
|
||||
// if (command.ContactInformationList[i].PhoneNumber != null)
|
||||
// {
|
||||
|
||||
// var contactinfo = new CreateContactInfo()
|
||||
// {
|
||||
// InstitutionContractId = result.SendId,
|
||||
// PhoneType = command.ContactInformationList[i].PhoneType,
|
||||
// Position = command.ContactInformationList[i].Position,
|
||||
// PhoneNumber = command.ContactInformationList[i].PhoneNumber,
|
||||
// FnameLname = command.ContactInformationList[i].FnameLname,
|
||||
// SendSms = command.ContactInformationList[i].SendSmsString == "true" ? true : false
|
||||
// };
|
||||
// _contactInfoApplication.Create(contactinfo);
|
||||
|
||||
// }
|
||||
// Thread.Sleep(500);
|
||||
//}
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
[HttpGet("print/{id}")]
|
||||
public async Task<ActionResult<InstitutionContractPrintViewModel>> PrintOne(long id)
|
||||
{
|
||||
var res =await _institutionContractApplication.PrintOneAsync(id);
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
public class institutionContractPayContractRequest
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
public string BaseUrl { get; set; }
|
||||
}
|
||||
|
||||
public class VerifyOtpRequest
|
||||
{
|
||||
|
||||
@@ -871,14 +871,6 @@
|
||||
|
||||
</div>
|
||||
|
||||
<div class="child-check level2">
|
||||
<label class="btn btn-icon waves-effect btn-default m-b-5 open-close">
|
||||
<i class="ion-plus"></i> <i class="ion-minus" style="display: none;"></i><input type="checkbox" style="display: none" class="open-btn" />
|
||||
</label>
|
||||
<label class="btn btn-inverse waves-effect waves-light m-b-5 parentLevel2"> <input type="checkbox" disabled="disabled" value="1004" class="check-btn"> <span style="bottom: 2px;position: relative"> قرارداد های مالی </span> </label>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@* بررسی مدارک پرسنل *@
|
||||
<div class="parent-check">
|
||||
|
||||
@@ -881,15 +881,6 @@
|
||||
|
||||
</div>
|
||||
|
||||
<div class="child-check level2">
|
||||
<label class="btn btn-icon waves-effect btn-default m-b-5 open-close">
|
||||
<i class="ion-plus"></i> <i class="ion-minus" style="display: none;"></i><input type="checkbox" style="display: none" class="open-btn" />
|
||||
</label>
|
||||
<label class="btn btn-inverse waves-effect waves-light m-b-5 parentLevel2"> <input type="checkbox" disabled="disabled" value="1004" class="check-btn"> <span style="bottom: 2px;position: relative"> قرارداد های مالی </span> </label>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@* بررسی مدارک پرسنل *@
|
||||
<div class="parent-check">
|
||||
|
||||
@@ -195,7 +195,7 @@
|
||||
<div class="rollcall-list Rtable Rtable--5cols Rtable--collapse px-1">
|
||||
|
||||
<div class="w-100 my-1">
|
||||
<div class="absenceHeadColorTop" style="border-radius: 10px 10px 0 0;">عدم حضور</div>
|
||||
<div class="absenceHeadColorTop" style="border-radius: 10px 10px 0 0;">غیبت</div>
|
||||
<div class="Rtable-row Rtable-row--head align-items-center d-flex table-rollcall-absent absenceHeadColor">
|
||||
<div class="Rtable-cell column-heading width1">ردیف</div>
|
||||
<div class="Rtable-cell column-heading width2">نام پرسنل</div>
|
||||
@@ -328,7 +328,7 @@
|
||||
<div class="btnsRollCallOnlline">
|
||||
<button class="btnRollCallStatus active" onclick="loadRollCallStatus('all')">آنلاین</button>
|
||||
<button class="btnRollCallStatus" onclick="loadRollCallStatus('leave')">مرخصی <span id="leaveCount"></span></button>
|
||||
<button class="btnRollCallStatus" onclick="loadRollCallStatus('absent')">عدم حضور <span id="absentCount"></span></button>
|
||||
<button class="btnRollCallStatus" onclick="loadRollCallStatus('absent')">غیبت <span id="absentCount"></span></button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="wrapper">
|
||||
|
||||
@@ -43,7 +43,7 @@ namespace ServiceHost.Areas.AdminNew.Pages.Company.RollCall
|
||||
WorkshopId = workshopId,
|
||||
};
|
||||
|
||||
RollCallViewModels = _rollCallApplication.GetWorkshopCurrentDayRollCalls(workshopId, new WorkshopCurrentDayRollCallSearchModel());
|
||||
RollCallViewModels = _rollCallApplication.GetWorkshopCurrentDayRollCalls(workshopId);
|
||||
return Page();
|
||||
}
|
||||
else
|
||||
@@ -56,7 +56,7 @@ namespace ServiceHost.Areas.AdminNew.Pages.Company.RollCall
|
||||
|
||||
public IActionResult OnGetCurrentDayAjax(string type, long workshopId)
|
||||
{
|
||||
RollCallViewModels = _rollCallApplication.GetWorkshopCurrentDayRollCalls(workshopId, new WorkshopCurrentDayRollCallSearchModel());
|
||||
RollCallViewModels = _rollCallApplication.GetWorkshopCurrentDayRollCalls(workshopId);
|
||||
|
||||
List<object> data = new();
|
||||
switch (type)
|
||||
@@ -83,7 +83,7 @@ namespace ServiceHost.Areas.AdminNew.Pages.Company.RollCall
|
||||
|
||||
public IActionResult OnGetCurrentAjaxCount(long workshopId)
|
||||
{
|
||||
RollCallViewModels = _rollCallApplication.GetWorkshopCurrentDayRollCalls(workshopId, new WorkshopCurrentDayRollCallSearchModel());
|
||||
RollCallViewModels = _rollCallApplication.GetWorkshopCurrentDayRollCalls(workshopId);
|
||||
|
||||
var absentEmployeesCount = RollCallViewModels.AbsentEmployees.Count(x => !x.HasLeave);
|
||||
var leaveEmployeesCount = RollCallViewModels.AbsentEmployees.Count(x => x.HasLeave);
|
||||
|
||||
@@ -127,8 +127,8 @@
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="gwb-card" permission="1004">
|
||||
<a href="https://admin@(AppSetting.Value.Domain)/workflow/institution-contract" class="click loadingButton">
|
||||
<div class="gwb-card" permission="1002">
|
||||
<a href="https://admin@(AppSetting.Value.Domain)/workflow" class="click loadingButton">
|
||||
<div class="d-flex align-items-center justify-content-between p-1 w-100">
|
||||
<div class="d-flex align-items-center">
|
||||
<img src="~/AssetsClient/images/insuranceList.png" alt="" class="img-fluid mx-1" width="50px" />
|
||||
|
||||
@@ -72,7 +72,9 @@ public class FinancialController : ClientBaseController
|
||||
{
|
||||
Amount = balanceAmount.Amount,
|
||||
ContractingPartyId = balanceAmount.ContractingPartyId,
|
||||
CallBackUrl = request.BaseUrl
|
||||
CallBackUrl = request.BaseUrl,
|
||||
Source = PaymentTransactionSource.Other,
|
||||
SourceId = 0
|
||||
};
|
||||
|
||||
var transaction = await _paymentTransactionApplication.Create(transactionCommand);
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -231,7 +231,7 @@
|
||||
|
||||
<div class="day-off-parent">
|
||||
<div class="day-off-title mb-2">
|
||||
روزهای فعالیت مجموعه
|
||||
روزهای تعطیل هفته
|
||||
</div>
|
||||
|
||||
<div class="day-off-button-container mb-3">
|
||||
|
||||
@@ -382,9 +382,7 @@ namespace ServiceHost.Areas.Client.Pages.Company.RollCall
|
||||
IsAbsent = x.IsAbsent,
|
||||
TotalWorkingHours = x.TotalWorkingHours,
|
||||
StartsItems = string.Join(Environment.NewLine, x.RollCallTimesList.Select(tr=>tr.StartDate)),
|
||||
EndsItems= string.Join(Environment.NewLine, x.RollCallTimesList.Select(tr=>tr.EndDate)),
|
||||
EnterTimeDifferences = string.Join(Environment.NewLine, x.RollCallTimesList.Select(tr=>tr.EntryTimeDifferences)),
|
||||
ExitTimeDifferences = string.Join(Environment.NewLine, x.RollCallTimesList.Select(tr=>tr.ExitTimeDifferences))
|
||||
EndsItems= string.Join(Environment.NewLine, x.RollCallTimesList.Select(tr=>tr.EndDate))
|
||||
}).ToList()
|
||||
|
||||
};
|
||||
|
||||
@@ -234,7 +234,7 @@
|
||||
<div class="rollcall-list Rtable Rtable--5cols Rtable--collapse px-1">
|
||||
|
||||
<div class="w-100 my-1">
|
||||
<div class="absenceHeadColorTop" style="border-radius: 10px 10px 0 0;">عدم حضور</div>
|
||||
<div class="absenceHeadColorTop" style="border-radius: 10px 10px 0 0;">غیبت</div>
|
||||
<div class="Rtable-row Rtable-row--head align-items-center d-flex table-rollcall-absent absenceHeadColor">
|
||||
<div class="Rtable-cell column-heading width1">ردیف</div>
|
||||
<div class="Rtable-cell column-heading width2">نام پرسنل</div>
|
||||
@@ -367,7 +367,7 @@
|
||||
<div class="btnsRollCallOnlline">
|
||||
<button class="btnRollCallStatus active" onclick="loadRollCallStatus('all')">آنلاین</button>
|
||||
<button class="btnRollCallStatus" onclick="loadRollCallStatus('leave')">مرخصی <span id="leaveCount"></span></button>
|
||||
<button class="btnRollCallStatus" onclick="loadRollCallStatus('absent')">عدم حضور <span id="absentCount"></span></button>
|
||||
<button class="btnRollCallStatus" onclick="loadRollCallStatus('absent')">غیبت <span id="absentCount"></span></button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="wrapper">
|
||||
|
||||
@@ -81,7 +81,7 @@ namespace ServiceHost.Areas.Client.Pages.Company.RollCall
|
||||
WorkshopId = workshopId,
|
||||
};
|
||||
|
||||
RollCallViewModels = _rollCallApplication.GetWorkshopCurrentDayRollCalls(workshopId, new WorkshopCurrentDayRollCallSearchModel());
|
||||
RollCallViewModels = _rollCallApplication.GetWorkshopCurrentDayRollCalls(workshopId);
|
||||
return Page();
|
||||
}
|
||||
else
|
||||
@@ -103,7 +103,7 @@ namespace ServiceHost.Areas.Client.Pages.Company.RollCall
|
||||
var workshopId = _passwordHasher.SlugDecrypt(workshopHash);
|
||||
if (workshopId > 0)
|
||||
{
|
||||
RollCallViewModels = _rollCallApplication.GetWorkshopCurrentDayRollCalls(workshopId, new WorkshopCurrentDayRollCallSearchModel());
|
||||
RollCallViewModels = _rollCallApplication.GetWorkshopCurrentDayRollCalls(workshopId);
|
||||
|
||||
List<object> data = new();
|
||||
switch (type)
|
||||
@@ -143,7 +143,7 @@ namespace ServiceHost.Areas.Client.Pages.Company.RollCall
|
||||
var workshopId = _passwordHasher.SlugDecrypt(workshopHash);
|
||||
if (workshopId > 0)
|
||||
{
|
||||
RollCallViewModels = _rollCallApplication.GetWorkshopCurrentDayRollCalls(workshopId, new WorkshopCurrentDayRollCallSearchModel());
|
||||
RollCallViewModels = _rollCallApplication.GetWorkshopCurrentDayRollCalls(workshopId);
|
||||
|
||||
var absentEmployeesCount = RollCallViewModels.AbsentEmployees.Count(x => !x.HasLeave);
|
||||
var leaveEmployeesCount = RollCallViewModels.AbsentEmployees.Count(x => x.HasLeave);
|
||||
|
||||
@@ -223,7 +223,7 @@
|
||||
|
||||
<div class="day-off-parent">
|
||||
<div class="day-off-title mb-2">
|
||||
روزهای فعالیت مجموعه
|
||||
روزهای تعطیل هفته
|
||||
</div>
|
||||
|
||||
<div class="day-off-button-container mb-3">
|
||||
|
||||
@@ -383,7 +383,7 @@
|
||||
|
||||
<div class="day-off-parent">
|
||||
<div class="day-off-title mb-2">
|
||||
روزهای فعالیت مجموعه
|
||||
روزهای تعطیل هفته
|
||||
</div>
|
||||
|
||||
<div class="day-off-button-container mb-3">
|
||||
|
||||
@@ -393,7 +393,7 @@
|
||||
|
||||
<div class="day-off-parent">
|
||||
<div class="day-off-title mb-2">
|
||||
روزهای فعالیت مجموعه
|
||||
روزهای تعطیل هفته
|
||||
</div>
|
||||
|
||||
<div class="day-off-button-container mb-3">
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
<button type="button" class="btn-close position-absolute text-start" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
<h6 class="m-0">پرینت حضور و غیاب انفرادی @Model.PersianMonthName ماه @Model.PersianYear</h6>
|
||||
</div>
|
||||
```````
|
||||
|
||||
<div class="modal-body" id="divTablescrollbar">
|
||||
<div class="row main-table">
|
||||
|
||||
@@ -121,17 +121,7 @@
|
||||
<span class="m-0">@item.DateFa</span>
|
||||
</td>
|
||||
<td style="font-family: 'IranText' !important; font-size: 10px !important; text-align: center">
|
||||
@if (item.RollCallTimesList.Any())
|
||||
{
|
||||
@foreach (var rollCallItem in item.RollCallTimesList)
|
||||
{
|
||||
<div>@(rollCallItem.EntryTimeDifferences ?? "-")</div>
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
<span>-</span>
|
||||
}
|
||||
-
|
||||
</td>
|
||||
<td style="font-family: 'IranText' !important; font-size: 10px !important; text-align: center">
|
||||
@if (item.RollCallTimesList.Any())
|
||||
@@ -160,17 +150,7 @@
|
||||
}
|
||||
</td>
|
||||
<td style="font-family: 'IranText' !important; font-size: 10px !important; text-align: center">
|
||||
@if (item.RollCallTimesList.Any())
|
||||
{
|
||||
@foreach (var rollCallItem in item.RollCallTimesList)
|
||||
{
|
||||
<div>@(rollCallItem.ExitTimeDifferences ?? "-")</div>
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
<span>-</span>
|
||||
}
|
||||
-
|
||||
</td>
|
||||
<td style="font-family: 'IranText' !important; font-size: 10px !important; text-align: center">
|
||||
@item.TotalWorkingHours
|
||||
|
||||
@@ -90,7 +90,7 @@
|
||||
|
||||
<div class="day-off-parent">
|
||||
<div class="day-off-title mb-2">
|
||||
روزهای فعالیت مجموعه
|
||||
روزهای تعطیل هفته
|
||||
</div>
|
||||
|
||||
<div class="day-off-button-container mb-3">
|
||||
|
||||
@@ -154,7 +154,7 @@
|
||||
|
||||
<div class="day-off-parent">
|
||||
<div class="day-off-title mb-2">
|
||||
روزهای فعالیت مجموعه
|
||||
روزهای تعطیل هفته
|
||||
</div>
|
||||
|
||||
<div class="day-off-button-container mb-3">
|
||||
|
||||
@@ -218,7 +218,7 @@
|
||||
|
||||
<div class="day-off-parent mb-4">
|
||||
<div class="day-off-title mb-2">
|
||||
روزهای فعالیت مجموعه
|
||||
روزهای تعطیل هفته
|
||||
</div>
|
||||
|
||||
<div class="day-off-button-container mb-3">
|
||||
|
||||
@@ -168,7 +168,7 @@
|
||||
|
||||
<div class="day-off-parent">
|
||||
<div class="day-off-title mb-2">
|
||||
روزهای فعالیت مجموعه
|
||||
روزهای تعطیل هفته
|
||||
</div>
|
||||
|
||||
<div class="day-off-button-container mb-3">
|
||||
|
||||
@@ -71,7 +71,7 @@
|
||||
|
||||
<li class="active" data-menu="absent">
|
||||
<div class="d-flex align-items-center justify-content-between" id="clickAbsentTab">
|
||||
<a href="javascript:void(0);">عدم حضور</a>
|
||||
<a href="javascript:void(0);">غیبت</a>
|
||||
<div>
|
||||
<div id="CountAbsentLoading" class="spinner-grow text-danger" role="status" style="align-items: center;justify-content: center;display: flex;margin: 0 0 0 9px;">
|
||||
<span class="visually-hidden">Loading...</span>
|
||||
@@ -218,7 +218,7 @@
|
||||
<div class="Rtable-row SubAccountRowMobile align-items-center position-relative openAction">
|
||||
<div class="Rtable-cell d-md-block d-flex width2">
|
||||
<div class="Rtable-cell--content text-start">
|
||||
<div class="roleName">عدم حضور</div>
|
||||
<div class="roleName">غیبت</div>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
|
||||
@@ -9,6 +9,7 @@ using _0_Framework.Application.PaymentGateway;
|
||||
using Microsoft.Extensions.Options;
|
||||
using CompanyManagment.App.Contracts.FinancialStatment;
|
||||
using CompanyManagment.App.Contracts.FinancilTransaction;
|
||||
using CompanyManagment.App.Contracts.InstitutionContract;
|
||||
|
||||
namespace ServiceHost.Controllers;
|
||||
|
||||
@@ -18,12 +19,14 @@ public class GeneralController : GeneralBaseController
|
||||
private readonly IPaymentTransactionApplication _paymentTransactionApplication;
|
||||
private readonly IPaymentGateway _paymentGateway;
|
||||
private readonly IFinancialStatmentApplication _financialStatmentApplication;
|
||||
private readonly IInstitutionContractApplication _institutionContractApplication;
|
||||
|
||||
public GeneralController(IPaymentTransactionApplication paymentTransactionApplication,IHttpClientFactory clientFactory, IFinancialStatmentApplication financialStatmentApplication, IOptions<AppSettingConfiguration> appSetting)
|
||||
public GeneralController(IPaymentTransactionApplication paymentTransactionApplication,IHttpClientFactory clientFactory, IFinancialStatmentApplication financialStatmentApplication, IOptions<AppSettingConfiguration> appSetting, IInstitutionContractApplication institutionContractApplication)
|
||||
{
|
||||
_paymentTransactionApplication = paymentTransactionApplication;
|
||||
_paymentGateway = new AqayePardakhtPaymentGateway(clientFactory, appSetting);
|
||||
_financialStatmentApplication = financialStatmentApplication;
|
||||
_institutionContractApplication = institutionContractApplication;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -112,6 +115,93 @@ public class GeneralController : GeneralBaseController
|
||||
// در غیر این صورت تراکنش ناموفق است
|
||||
return await HandleFailedTransaction(transaction, paymentTransactionId);
|
||||
}
|
||||
|
||||
|
||||
|
||||
[HttpPost("/api/institution-contract/callback")]
|
||||
public async Task<IActionResult> InstitutionContractCallBack(string? transid, string? cardnumber, string? tracking_number,
|
||||
string bank, string invoice_id, string? status,CancellationToken cancellationToken)
|
||||
{
|
||||
if (!long.TryParse(invoice_id, out var paymentTransactionId))
|
||||
{
|
||||
return BadRequest("Invalid invoice_id");
|
||||
}
|
||||
|
||||
var transaction = await _paymentTransactionApplication.GetDetails(paymentTransactionId);
|
||||
if (transaction == null)
|
||||
{
|
||||
return NotFound("Transaction not found");
|
||||
}
|
||||
|
||||
if (transaction.Status != PaymentTransactionStatus.Pending)
|
||||
{
|
||||
return BadRequest("این تراکنش قبلا پرداخت شده است");
|
||||
}
|
||||
|
||||
long institutionContractId = 0;
|
||||
if (transaction.Source != PaymentTransactionSource.InstitutionContract
|
||||
&& !long.TryParse(transaction.SourceId, out institutionContractId))
|
||||
{
|
||||
return BadRequest("اطلاعات تراکنش نامعتبر است");
|
||||
}
|
||||
|
||||
// اگر شماره کارت یا شماره پیگیری خالی باشد، تراکنش ناموفق است
|
||||
if (string.IsNullOrWhiteSpace(cardnumber) || string.IsNullOrWhiteSpace(tracking_number))
|
||||
{
|
||||
return await HandleFailedTransaction(transaction, paymentTransactionId);
|
||||
}
|
||||
|
||||
var verifyCommand = new VerifyPaymentGateWayRequest()
|
||||
{
|
||||
Amount = transaction.Amount/10,
|
||||
TransactionId = transid
|
||||
};
|
||||
var verifyRes =await _paymentGateway.Verify(verifyCommand, cancellationToken);
|
||||
|
||||
// اگر استاتوس 1 باشد، تراکنش موفق است
|
||||
if (verifyRes.IsSuccess)
|
||||
{
|
||||
var command = new CreateFinancialStatment()
|
||||
{
|
||||
ContractingPartyId = transaction.ContractingPartyId,
|
||||
Deptor = 0,
|
||||
Creditor = transaction.Amount,
|
||||
DeptorString = "0",
|
||||
TypeOfTransaction = "credit",
|
||||
DescriptionOption = "بابت قرارداد مابین (روابط کار)",
|
||||
Description = "درگاه بانکی",
|
||||
|
||||
};
|
||||
var statementResult = _financialStatmentApplication.CreateFromBankGateway(command);
|
||||
if (!statementResult.IsSuccedded)
|
||||
{
|
||||
return await HandleFailedTransaction(transaction, paymentTransactionId);
|
||||
}
|
||||
|
||||
var setSuccessResult = _paymentTransactionApplication.SetSuccess(paymentTransactionId, cardnumber, bank);
|
||||
|
||||
if (!setSuccessResult.IsSuccedded)
|
||||
{
|
||||
return new JsonResult(setSuccessResult);
|
||||
}
|
||||
//_institutionContractApplication.;
|
||||
|
||||
var institutionContract = await _institutionContractApplication
|
||||
.CompletePendingVerify(institutionContractId);
|
||||
|
||||
if (!institutionContract.IsSuccedded)
|
||||
{
|
||||
return await HandleFailedTransaction(transaction, paymentTransactionId);
|
||||
}
|
||||
|
||||
return Redirect(BuildCallbackUrl(transaction.CallBackUrl, true, transaction.Id));
|
||||
}
|
||||
|
||||
// در غیر این صورت تراکنش ناموفق است
|
||||
return await HandleFailedTransaction(transaction, paymentTransactionId);
|
||||
}
|
||||
|
||||
|
||||
|
||||
private async Task<IActionResult> HandleFailedTransaction(PaymentTransactionDetailsViewModel transaction, long transactionId)
|
||||
{
|
||||
|
||||
@@ -420,7 +420,7 @@ input:checked + .sliderEUP:before {
|
||||
background-color: #ffffff;
|
||||
background: rgba(209, 50, 50, 0.15);
|
||||
transition: ease .2s;
|
||||
/*width: 55px;*/
|
||||
width: 55px;
|
||||
}
|
||||
|
||||
.btn-workflow-rollcall-edit {
|
||||
|
||||
@@ -292,7 +292,7 @@ function loadEmployeeListByWorkFlowsAbsents(date) {
|
||||
</button>
|
||||
|
||||
<button type="button" class="btn-workflow-absent" onclick="confirmAbsentAlert(${rollCallItem.employeeId}, '${data.dateTimeFa}')">
|
||||
<span class="mx-1 text-nowrap">عدم حضور</span>
|
||||
<span class="mx-1">غیبت</span>
|
||||
</button>
|
||||
|
||||
<button class="btn-workflow-rollcall-edit position-relative" onclick="showModalEditRollCall(${rollCallItem.employeeId}, '${data.dateTimeFa}')">
|
||||
@@ -1028,7 +1028,7 @@ function showModalEditLeave(leaveId) {
|
||||
|
||||
function confirmAbsentAlert(employeeId, dateFa) {
|
||||
swal({
|
||||
title: "آیا از تایید این عدم حضور اطمینان دارید؟",
|
||||
title: "آیا از تایید این غیبت اطمینان دارید؟",
|
||||
text: "",
|
||||
type: "warning",
|
||||
showCancelButton: true,
|
||||
|
||||
Reference in New Issue
Block a user