Add Stock Tracking endpoint to Inventory

Adds GET /client/inventory/stock-movements, a unified read-only ledger
flattening every GRN line, sale line and return across all products
into one shape for the new Stock Tracking tab's table.
This commit is contained in:
2026-10-09 14:22:08 +05:30
parent 2eb88b058e
commit 1a502767ba
4 changed files with 91 additions and 0 deletions
+21
View File
@@ -85,6 +85,27 @@ namespace Fitness_core_BE.DTOs.Inventory
public List<SaleItemDto> Items { get; set; } = [];
}
/// <summary>One row in the Stock Tracking tab's unified ledger -- every GRN line, sale line
/// and return across every product, flattened into one shape for a single filterable table.
/// Not persisted; built on read from GRNs/Sales/Returns.</summary>
public class StockMovementDto
{
/// <summary>"GRN" | "Sale" | "Return".</summary>
public string Type { get; set; } = string.Empty;
public Guid ProductId { get; set; }
public string ProductName { get; set; } = string.Empty;
/// <summary>The GRN/Sale number this line belongs to, or the return's Category label.</summary>
public string Reference { get; set; } = string.Empty;
/// <summary>Only set for Type == "Return" -- the write-off/return category.</summary>
public string? Category { get; set; }
/// <summary>Signed: positive for a GRN or a CustomerReturn (stock in), negative for a
/// Sale or any other return category (stock out).</summary>
public decimal QuantityChange { get; set; }
/// <summary>This line's monetary value -- a GRN/Sale line's LineTotal, or a return's Amount.</summary>
public decimal Amount { get; set; }
public DateTime Date { get; set; }
}
public class StockReturnDto
{
public Guid StockReturnId { get; set; }