NTP_V2/src/NTP.Application/Refinery/Trips/TripsContracts.cs

273 lines
11 KiB
C#

namespace NTP.Application.Refinery.Trips;
/// <summary>Envelope of write operations: <c>message</c> is the legacy Arabic success text (toasted by the client).</summary>
public sealed record TripsResult(string Message, long? Id = null);
// ---------------------------------------------------------------- filters
/// <summary>
/// Grid / report filters (legacy factoryweb.search whitelist, mapped on REFINERY_TRIPS_VIEW). <c>StatusCode</c> and
/// <c>PaymentMethodCode</c> accept a comma separated list (multi-select). Dates are days (yyyy-MM-dd).
/// </summary>
public sealed record TripQuery(
string? Pn = null,
string? Tn = null,
string? Trn = null,
string? Nnpn = null,
string? LoadingNo = null,
string? DischargeAuthNo = null,
DateTime? DispatchDate = null,
DateTime? DischargeEntryDate = null,
DateTime? LoadingDateFrom = null,
DateTime? LoadingDateTo = null,
DateTime? PaymentedDateFrom = null,
DateTime? PaymentedDateTo = null,
string? StatusCode = null,
string? PaymentMethodCode = null,
string? HasWageClaim = null,
string? HavePaymentMethod = null,
string? DieselCharge = null,
string? WageClaimNo = null,
long? WageClaimId = null,
string? BankAccount = null,
string? WaterExist = null,
long? Id = null);
// ---------------------------------------------------------------- grid
/// <summary>One grid row. The icons of the legacy action column derive from DieselCharge / HavePaymentMethod / WaterAmount / ReversePayment.</summary>
public sealed class TripRow
{
public long Id { get; set; }
public string? Pn { get; set; }
public string? DispatchDate { get; set; }
public long? LoadingNo { get; set; }
public string? DischargeAuthNo { get; set; }
public string? DischargeEntryDate { get; set; }
public string? Tn { get; set; }
public string? Trn { get; set; }
public string? Nnpn { get; set; }
public long? WageClaimId { get; set; }
public long? WageClaimNo { get; set; }
public string? StatusCode { get; set; }
public int DieselCharge { get; set; }
public string? HavePaymentMethod { get; set; }
public decimal? WaterAmount { get; set; }
public int? ReversePayment { get; set; }
public decimal? NetWage { get; set; }
}
public sealed record TripGridDto(
long Id, string? Pn, string? DispatchDate, long? LoadingNo, string? DischargeAuthNo, string? DischargeEntryDate,
string? Tn, string? Trn, string? Nnpn, long? WageClaimId, long? WageClaimNo, string? StatusCode,
int DieselCharge, bool HasPaymentMethod, bool HasWater, bool Reversed, decimal? NetWage);
// ---------------------------------------------------------------- one trip
/// <summary>Raw row of REFINERY_TRIPS_VIEW for the form and the actions.</summary>
public sealed class TripRecord
{
public long Id { get; set; }
public string? Pn { get; set; }
public string? StatusCode { get; set; }
public string? DispatchDate { get; set; }
public string? ActualLoadingDate { get; set; }
public DateTime? LoadingDate { get; set; }
public string? ClientName { get; set; }
public string? Tn { get; set; }
public string? Trn { get; set; }
public string? Nnpn { get; set; }
public string? Drvr { get; set; }
public long? LoadingNo { get; set; }
public decimal? GrossWeight { get; set; }
public decimal? EmptyWeight { get; set; }
public decimal? NetLoadingWeight { get; set; }
public decimal? LitersWeight { get; set; }
public string? DischargeAuthNo { get; set; }
public string? DischargeEntryDate { get; set; }
public decimal? ActualGrossWeight { get; set; }
public decimal? ActualEmptyWeight { get; set; }
public decimal? NetDischargeWeight { get; set; }
public decimal? WaterAmount { get; set; }
public decimal? SedimentAmount { get; set; }
public decimal? WeightDifference { get; set; }
public decimal? NetWage { get; set; }
public decimal? TripNetWage { get; set; }
public decimal? RemainingBalance { get; set; }
public int DieselCharge { get; set; }
public int? ReversePayment { get; set; }
public decimal? FirstAdvancePayment { get; set; }
public decimal? SecondAdvancePayment { get; set; }
public decimal? PenaltyAmount { get; set; }
public decimal? PenaltyQuantity { get; set; }
public string? HavePaymentMethod { get; set; }
public string? DriverWalletNumber { get; set; }
public long? WageClaimId { get; set; }
public long? WageClaimNo { get; set; }
public string? CardNumber { get; set; }
public decimal? CurrentBalance { get; set; }
public long? RefineryWalletId { get; set; }
public decimal? DinarakReferenceId { get; set; }
public string? Remarks { get; set; }
public string? ReceivedByName { get; set; }
public DateTime? ReceivedDate { get; set; }
public DateTime? PaymentedDate { get; set; }
public string? PaymentOptions { get; set; }
public long? VoucherSerialNumber { get; set; }
public string? PaidEpayment { get; set; }
public string? PaymentMethod { get; set; }
public string? OwnerName { get; set; }
}
/// <summary>Active REFINERY_WALLET of the truck (legacy checkEWallet) or the wallet the trip was paid to.</summary>
public sealed class TripWallet
{
public long Id { get; set; }
public int? Epayment { get; set; }
public string? WalletNumber { get; set; }
public long? OwnerNnpn { get; set; }
public string? OwnerName { get; set; }
public string? DriverName { get; set; }
public long? DriverNnpn { get; set; }
public string? BankAccount { get; set; }
public string? Iban { get; set; }
public string? BankName { get; set; }
}
public sealed record TripWalletDto(
int? Epayment, string? WalletNumber, string? OwnerNnpn, string? OwnerName, string? BankAccount, string? Iban, string? BankName,
string? DriverWalletNumber);
public sealed record TripDetailDto(
long Id,
string? Pn,
string? StatusCode,
string? DispatchDate,
string? ActualLoadingDate,
string? ClientName,
string? Tn,
string? Trn,
string? Nnpn,
string? DriverName,
long? LoadingNo,
decimal? GrossWeight,
decimal? EmptyWeight,
decimal? NetLoadingWeight,
decimal? LitersWeight,
string? DischargeAuthNo,
string? DischargeEntryDate,
decimal? ActualGrossWeight,
decimal? ActualEmptyWeight,
decimal? NetDischargeWeight,
decimal? WaterAmount,
decimal? SedimentAmount,
decimal? WeightDifference,
decimal? NetWage,
decimal? TripNetWage,
decimal? RemainingBalance,
int DieselCharge,
bool Reversed,
string? CardNumber,
decimal? CurrentBalance,
decimal? NewBalance,
decimal? FirstPaymentValue,
decimal? SecondPaymentValue,
long? WageClaimId,
long? WageClaimNo,
string? Remarks,
string? ReceivedByName,
string? ReceivedDate,
string? PaymentedDate,
string? PaymentOptions,
long? VoucherSerialNumber,
bool AuditMode,
TripWalletDto? Wallet,
IReadOnlyList<string> Actions);
// ---------------------------------------------------------------- log
public sealed class TripLogRow
{
public long Id { get; set; }
public string? MethodName { get; set; }
public string? LogDate { get; set; }
public string? Login { get; set; }
public string? OldData { get; set; }
public string? NewData { get; set; }
}
public sealed record TripLogDto(long Id, string? MethodName, string? LogDate, string? Login, string? OldData, string? NewData);
// ---------------------------------------------------------------- print
/// <summary>Cash voucher "سند صرف نقدي" (legacy print): the page prints it, the serial is stored on the trip.</summary>
public sealed record TripVoucherDto(
long Id, string Pn, string Serial, string Date, decimal Amount, string? DischargeAuthNo, string? OwnerName);
// ---------------------------------------------------------------- reports
public sealed record DieselReportQuery(
string? Pn = null, string? Tn = null, string? StatusCode = null, string? DischargeAuthNo = null, string? DieselCharge = null,
DateTime? DateFrom = null, DateTime? DateTo = null);
public sealed class DieselReportRow
{
public long Id { get; set; }
public string? Pn { get; set; }
public string? Tn { get; set; }
public string? StatusCode { get; set; }
public string? DischargeAuthNo { get; set; }
public DateTime? CreationDate { get; set; }
public string? FirstName { get; set; }
public string? MethodName { get; set; }
public decimal? BalanceBefore { get; set; }
public decimal? BalanceAfter { get; set; }
public decimal? Amount { get; set; }
}
public sealed class CardRow
{
public long Id { get; set; }
public long Tn { get; set; }
public string? CardNumber { get; set; }
public decimal? CurrentBalance { get; set; }
}
/// <summary>Row of the trips excel report (legacy report(), manager column set).</summary>
public sealed class TripReportRow
{
public long Id { get; set; }
public string? Pn { get; set; }
public string? DispatchDate { get; set; }
public long? LoadingNo { get; set; }
public string? DischargeAuthNo { get; set; }
public string? DischargeEntryDate { get; set; }
public decimal? NetLoadingWeight { get; set; }
public decimal? NetDischargeWeight { get; set; }
public string? Tn { get; set; }
public string? Trn { get; set; }
public string? Nnpn { get; set; }
public decimal? CurrentBalance { get; set; }
public int DieselCharge { get; set; }
public decimal? NetWage { get; set; }
public decimal? TripNetWage { get; set; }
public decimal? RemainingBalance { get; set; }
public string? StatusCode { get; set; }
public long? WageClaimNo { get; set; }
public DateTime? PaymentedDate { get; set; }
public DateTime? ReceivedDate { get; set; }
public string? ReceivedByName { get; set; }
public string? ActualLoadingDate { get; set; }
public string? PaymentMethod { get; set; }
public string? PaidEpayment { get; set; }
public string? PaymentOptions { get; set; }
public string? OwnerName { get; set; }
public string? OwnerNameEnglish { get; set; }
public string? BankName { get; set; }
public string? Iban { get; set; }
public string? BankAccount { get; set; }
public string? WalletNumber { get; set; }
public long? OwnerNnpn { get; set; }
}
public sealed record BankReportQuery(string? BankAccount, string? StatusCode, string? HasWageClaim, DateTime? PaymentedDateFrom, DateTime? PaymentedDateTo);
public sealed record RecalculateBalanceRequest(DateTime StartDate, DateTime EndDate, long VariableGroupId);
/// <summary>Result of an export: file content, name and content type.</summary>
public sealed record TripExportFile(byte[] Content, string FileName, string ContentType);