Initial commit
This commit is contained in:
@@ -0,0 +1,137 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using PowderCoating.Core.Enums;
|
||||
using PowderCoating.Application.DTOs.GiftCertificate;
|
||||
|
||||
namespace PowderCoating.Application.DTOs.Invoice;
|
||||
|
||||
public class InvoiceListDto
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string InvoiceNumber { get; set; } = string.Empty;
|
||||
public int? JobId { get; set; }
|
||||
public string? JobNumber { get; set; }
|
||||
public int CustomerId { get; set; }
|
||||
public string CustomerName { get; set; } = string.Empty;
|
||||
public InvoiceStatus Status { get; set; }
|
||||
public DateTime InvoiceDate { get; set; }
|
||||
public DateTime? DueDate { get; set; }
|
||||
public decimal Total { get; set; }
|
||||
public decimal AmountPaid { get; set; }
|
||||
public decimal BalanceDue { get; set; }
|
||||
public bool IsOverdue => Status != InvoiceStatus.Paid && Status != InvoiceStatus.Voided
|
||||
&& Status != InvoiceStatus.WrittenOff && DueDate.HasValue && DueDate.Value < DateTime.UtcNow;
|
||||
}
|
||||
|
||||
public class InvoiceDto
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string InvoiceNumber { get; set; } = string.Empty;
|
||||
public int? JobId { get; set; }
|
||||
public string? JobNumber { get; set; }
|
||||
public int CustomerId { get; set; }
|
||||
public string CustomerName { get; set; } = string.Empty;
|
||||
public string? CustomerEmail { get; set; }
|
||||
public string? CustomerPhone { get; set; }
|
||||
public bool CustomerNotifyByEmail { get; set; }
|
||||
public string? PreparedById { get; set; }
|
||||
public string? PreparedByName { get; set; }
|
||||
public InvoiceStatus Status { get; set; }
|
||||
public DateTime InvoiceDate { get; set; }
|
||||
public DateTime? DueDate { get; set; }
|
||||
public DateTime? SentDate { get; set; }
|
||||
public DateTime? PaidDate { get; set; }
|
||||
public decimal SubTotal { get; set; }
|
||||
public decimal TaxPercent { get; set; }
|
||||
public decimal TaxAmount { get; set; }
|
||||
public decimal DiscountAmount { get; set; }
|
||||
public decimal Total { get; set; }
|
||||
public decimal AmountPaid { get; set; }
|
||||
public decimal BalanceDue { get; set; }
|
||||
public string? Notes { get; set; }
|
||||
public string? InternalNotes { get; set; }
|
||||
public string? Terms { get; set; }
|
||||
public string? CustomerPO { get; set; }
|
||||
public string? ExternalReference { get; set; }
|
||||
public int? SalesTaxAccountId { get; set; }
|
||||
public string? SalesTaxAccountName { get; set; }
|
||||
public decimal CreditApplied { get; set; }
|
||||
public decimal GiftCertificateRedeemed { get; set; }
|
||||
// Online payments (Stripe Connect)
|
||||
public OnlinePaymentStatus OnlinePaymentStatus { get; set; }
|
||||
public string? PaymentLinkToken { get; set; }
|
||||
public DateTime? PaymentLinkExpiresAt { get; set; }
|
||||
public decimal OnlineAmountPaid { get; set; }
|
||||
public List<InvoiceItemDto> InvoiceItems { get; set; } = new();
|
||||
public List<PaymentDtos.PaymentDto> Payments { get; set; } = new();
|
||||
public List<RefundDto> Refunds { get; set; } = new();
|
||||
public List<CreditMemoApplicationDto> CreditApplications { get; set; } = new();
|
||||
public List<GiftCertificateRedemptionDto> GiftCertificateRedemptions { get; set; } = new();
|
||||
}
|
||||
|
||||
public class CreateInvoiceDto
|
||||
{
|
||||
public int? JobId { get; set; }
|
||||
[Range(1, int.MaxValue, ErrorMessage = "Please select a customer.")]
|
||||
public int CustomerId { get; set; }
|
||||
public string? PreparedById { get; set; }
|
||||
public DateTime InvoiceDate { get; set; } = DateTime.Today;
|
||||
public DateTime? DueDate { get; set; }
|
||||
public decimal TaxPercent { get; set; }
|
||||
public decimal DiscountAmount { get; set; }
|
||||
public string? Notes { get; set; }
|
||||
public string? InternalNotes { get; set; }
|
||||
public string? Terms { get; set; }
|
||||
public string? CustomerPO { get; set; }
|
||||
public List<CreateInvoiceItemDto> InvoiceItems { get; set; } = new();
|
||||
}
|
||||
|
||||
public class UpdateInvoiceDto
|
||||
{
|
||||
public DateTime InvoiceDate { get; set; }
|
||||
public DateTime? DueDate { get; set; }
|
||||
public decimal TaxPercent { get; set; }
|
||||
public decimal DiscountAmount { get; set; }
|
||||
public string? Notes { get; set; }
|
||||
public string? InternalNotes { get; set; }
|
||||
public string? Terms { get; set; }
|
||||
public string? CustomerPO { get; set; }
|
||||
public List<CreateInvoiceItemDto> InvoiceItems { get; set; } = new();
|
||||
}
|
||||
|
||||
public class InvoiceItemDto
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public int InvoiceId { get; set; }
|
||||
public int? SourceJobItemId { get; set; }
|
||||
public int? CatalogItemId { get; set; }
|
||||
public string Description { get; set; } = string.Empty;
|
||||
public decimal Quantity { get; set; }
|
||||
public decimal UnitPrice { get; set; }
|
||||
public decimal TotalPrice { get; set; }
|
||||
public string? ColorName { get; set; }
|
||||
public string? Notes { get; set; }
|
||||
public int DisplayOrder { get; set; }
|
||||
public int? RevenueAccountId { get; set; }
|
||||
public string? RevenueAccountName { get; set; }
|
||||
public bool IsGiftCertificate { get; set; }
|
||||
public int? GeneratedGiftCertificateId { get; set; }
|
||||
public string? GeneratedGiftCertificateCode { get; set; }
|
||||
}
|
||||
|
||||
public class CreateInvoiceItemDto
|
||||
{
|
||||
public int? SourceJobItemId { get; set; }
|
||||
public int? CatalogItemId { get; set; }
|
||||
public string Description { get; set; } = string.Empty;
|
||||
public decimal Quantity { get; set; } = 1;
|
||||
public decimal UnitPrice { get; set; }
|
||||
public decimal TotalPrice { get; set; }
|
||||
public string? ColorName { get; set; }
|
||||
public string? Notes { get; set; }
|
||||
public int DisplayOrder { get; set; }
|
||||
public int? RevenueAccountId { get; set; }
|
||||
public bool IsGiftCertificate { get; set; } = false;
|
||||
public string? GcRecipientName { get; set; }
|
||||
public string? GcRecipientEmail { get; set; }
|
||||
public DateTime? GcExpiryDate { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
using PowderCoating.Core.Enums;
|
||||
|
||||
namespace PowderCoating.Application.DTOs.Invoice;
|
||||
|
||||
public class PaymentDtos
|
||||
{
|
||||
public class PaymentDto
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public int InvoiceId { get; set; }
|
||||
public decimal Amount { get; set; }
|
||||
public DateTime PaymentDate { get; set; }
|
||||
public PaymentMethod PaymentMethod { get; set; }
|
||||
public string PaymentMethodDisplay => PaymentMethod switch
|
||||
{
|
||||
PaymentMethod.Cash => "Cash",
|
||||
PaymentMethod.Check => "Check",
|
||||
PaymentMethod.CreditDebitCard => "Credit/Debit Card",
|
||||
PaymentMethod.BankTransferACH => "Bank Transfer / ACH",
|
||||
PaymentMethod.DigitalPayment => "Digital Payment",
|
||||
_ => PaymentMethod.ToString()
|
||||
};
|
||||
public string? Reference { get; set; }
|
||||
public string? Notes { get; set; }
|
||||
public string? RecordedById { get; set; }
|
||||
public string? RecordedByName { get; set; }
|
||||
public int? DepositAccountId { get; set; }
|
||||
public string? DepositAccountName { get; set; }
|
||||
}
|
||||
|
||||
public class RecordPaymentDto
|
||||
{
|
||||
public int InvoiceId { get; set; }
|
||||
public decimal Amount { get; set; }
|
||||
public DateTime PaymentDate { get; set; } = DateTime.Today;
|
||||
public PaymentMethod PaymentMethod { get; set; }
|
||||
public string? Reference { get; set; }
|
||||
public string? Notes { get; set; }
|
||||
public int? DepositAccountId { get; set; }
|
||||
}
|
||||
|
||||
public class EditPaymentDto
|
||||
{
|
||||
public int PaymentId { get; set; }
|
||||
public int InvoiceId { get; set; }
|
||||
public DateTime PaymentDate { get; set; }
|
||||
public PaymentMethod PaymentMethod { get; set; }
|
||||
public string? Reference { get; set; }
|
||||
public string? Notes { get; set; }
|
||||
public int? DepositAccountId { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
using PowderCoating.Core.Enums;
|
||||
|
||||
namespace PowderCoating.Application.DTOs.Invoice;
|
||||
|
||||
// ── Refund DTOs ───────────────────────────────────────────────────────────────
|
||||
|
||||
public class RefundDto
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public int InvoiceId { get; set; }
|
||||
public int? PaymentId { get; set; }
|
||||
public decimal Amount { get; set; }
|
||||
public DateTime RefundDate { get; set; }
|
||||
public PaymentMethod RefundMethod { get; set; }
|
||||
public string RefundMethodDisplay => RefundMethod switch
|
||||
{
|
||||
PaymentMethod.Cash => "Cash",
|
||||
PaymentMethod.Check => "Check",
|
||||
PaymentMethod.CreditDebitCard => "Credit/Debit Card",
|
||||
PaymentMethod.BankTransferACH => "Bank Transfer / ACH",
|
||||
PaymentMethod.DigitalPayment => "Digital Payment",
|
||||
PaymentMethod.StoreCredit => "Store Credit",
|
||||
_ => RefundMethod.ToString()
|
||||
};
|
||||
public string Reason { get; set; } = string.Empty;
|
||||
public string? Reference { get; set; }
|
||||
public string? Notes { get; set; }
|
||||
public RefundStatus Status { get; set; }
|
||||
public DateTime? IssuedDate { get; set; }
|
||||
public string? IssuedByName { get; set; }
|
||||
}
|
||||
|
||||
public class IssueRefundDto
|
||||
{
|
||||
public int? PaymentId { get; set; }
|
||||
public decimal Amount { get; set; }
|
||||
public DateTime RefundDate { get; set; } = DateTime.Today;
|
||||
public PaymentMethod RefundMethod { get; set; }
|
||||
public string Reason { get; set; } = string.Empty;
|
||||
public string? Reference { get; set; }
|
||||
public string? Notes { get; set; }
|
||||
}
|
||||
|
||||
// ── Credit Memo DTOs ──────────────────────────────────────────────────────────
|
||||
|
||||
public class CreditMemoDto
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string MemoNumber { get; set; } = string.Empty;
|
||||
public int CustomerId { get; set; }
|
||||
public string CustomerName { get; set; } = string.Empty;
|
||||
public int? OriginalInvoiceId { get; set; }
|
||||
public string? OriginalInvoiceNumber { get; set; }
|
||||
public int? ReworkRecordId { get; set; }
|
||||
public decimal Amount { get; set; }
|
||||
public decimal AmountApplied { get; set; }
|
||||
public decimal RemainingBalance { get; set; }
|
||||
public DateTime IssueDate { get; set; }
|
||||
public DateTime? ExpiryDate { get; set; }
|
||||
public string Reason { get; set; } = string.Empty;
|
||||
public string? Notes { get; set; }
|
||||
public CreditMemoStatus Status { get; set; }
|
||||
public string? IssuedByName { get; set; }
|
||||
public List<CreditMemoApplicationDto> Applications { get; set; } = new();
|
||||
}
|
||||
|
||||
public class CreditMemoApplicationDto
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public int CreditMemoId { get; set; }
|
||||
public string MemoNumber { get; set; } = string.Empty;
|
||||
public int InvoiceId { get; set; }
|
||||
public string InvoiceNumber { get; set; } = string.Empty;
|
||||
public decimal AmountApplied { get; set; }
|
||||
public DateTime AppliedDate { get; set; }
|
||||
public string? AppliedByName { get; set; }
|
||||
}
|
||||
|
||||
public class IssueCreditMemoDto
|
||||
{
|
||||
public decimal Amount { get; set; }
|
||||
public string Reason { get; set; } = string.Empty;
|
||||
public string? Notes { get; set; }
|
||||
public DateTime? ExpiryDate { get; set; }
|
||||
public int? ReworkRecordId { get; set; }
|
||||
}
|
||||
|
||||
public class ApplyCreditDto
|
||||
{
|
||||
public int CreditMemoId { get; set; }
|
||||
public decimal Amount { get; set; }
|
||||
}
|
||||
Reference in New Issue
Block a user