67 lines
2.7 KiB
C#
67 lines
2.7 KiB
C#
using Distribution.Features.ShopPO;
|
|
using Distribution.Models;
|
|
|
|
namespace Distribution.Features.Invoice;
|
|
|
|
public record CreateInvoiceRequest(Guid ShopPOId, Guid? CreatedByUserId = null);
|
|
public record InvoiceItemAdjustment(Guid InvoiceItemId, int AdjustedQuantity, bool IsRemoved = false, string? Note = null);
|
|
public record FinalizeInvoiceRequest(List<InvoiceItemAdjustment>? Adjustments = null, Guid? FinalizedByUserId = null);
|
|
public record PrintInvoiceRequest(Guid? PrintedByUserId = null);
|
|
|
|
// InvoiceItemId set = edit/remove/restore an existing line; ItemId set (InvoiceItemId null) = add a new line.
|
|
public record InvoiceItemEdit(Guid? InvoiceItemId, Guid? ItemId, int Quantity, decimal? UnitPrice = null, bool IsRemoved = false);
|
|
// DiscountSchemeIds: the percentage-discount scheme chosen in the editor (at most one); null = leave as is.
|
|
public record UpdateInvoiceItemsRequest(List<InvoiceItemEdit> Items, Guid? EditedByUserId = null, List<Guid>? DiscountSchemeIds = null);
|
|
|
|
public record PreviewLine(Guid ItemId, int Quantity, decimal UnitPrice, bool IsFree = false, bool IsRemoved = false, Guid? SchemeId = null);
|
|
public record PreviewInvoiceTotalsRequest(List<PreviewLine> Items, List<Guid>? DiscountSchemeIds = null);
|
|
// Quantity = how many free units the scheme still entitles for the lines as typed.
|
|
public record FreeEntitlement(Guid SchemeId, int Quantity);
|
|
public record InvoiceTotalsPreview(decimal DiscountAmount, decimal TotalAmount, List<FreeEntitlement> FreeEntitlements);
|
|
|
|
public record InvoiceVersionItemResponse(Guid? ShopPOItemId, Guid ItemId, string ItemName, int Quantity, decimal UnitPrice, bool IsRemoved);
|
|
|
|
public record InvoiceVersionResponse(
|
|
Guid Id,
|
|
int VersionNumber,
|
|
InvoiceVersionStage Stage,
|
|
decimal TotalAmount,
|
|
Guid CreatedBy,
|
|
DateTime CreatedAt,
|
|
List<InvoiceVersionItemResponse> Items);
|
|
|
|
public record InvoiceItemResponse(
|
|
Guid Id,
|
|
Guid? ShopPOItemId,
|
|
Guid ItemId,
|
|
string ItemName,
|
|
int? OrderedQuantity,
|
|
int Quantity,
|
|
decimal UnitPrice,
|
|
bool IsRemoved,
|
|
bool IsFree = false,
|
|
Guid? SchemeId = null,
|
|
string? SchemeName = null);
|
|
|
|
public record InvoiceResponse(
|
|
Guid Id,
|
|
Guid ShopPOId,
|
|
Guid StoreId,
|
|
string StoreName,
|
|
InvoiceStatus Status,
|
|
PaymentStatus PaymentStatus,
|
|
Guid CreatedBy,
|
|
DateTime? PrintedAt,
|
|
Guid? PrintedBy,
|
|
DateTime? FinalizedAt,
|
|
Guid? FinalizedBy,
|
|
decimal TotalAmount,
|
|
decimal DiscountAmount,
|
|
decimal PaidAmount,
|
|
bool IsActive,
|
|
DateTime CreatedAt,
|
|
List<InvoiceItemResponse> Items,
|
|
List<ShopPODiscountResponse>? Discounts = null);
|
|
|
|
public record OutstandingPaymentsResponse(int InvoiceCount, decimal OutstandingAmount);
|