Add NBT support to GRN processing and pricing calculations

This commit is contained in:
2026-10-08 12:41:44 +05:30
parent 40e890d4ff
commit 55aa35308a
7 changed files with 92 additions and 34 deletions
+16 -7
View File
@@ -20,7 +20,9 @@ public record GrnItemRequest(
decimal? DiscountPercent = null,
decimal? VatPercent = null,
// Free-issue units: stocked but not costed. Serial/batch entries must cover accepted + free.
int FreeQuantity = 0);
int FreeQuantity = 0,
// Ignored when NBT is disabled in configuration; null falls back to the GRN-wide percentage.
decimal? NbtPercent = null);
public record CreateGrnRequest(
Guid WarehouseId,
@@ -29,7 +31,8 @@ public record CreateGrnRequest(
Guid? ReceivedByUserId = null,
// GRN-wide defaults for lines that don't set their own.
decimal? DiscountPercent = null,
decimal? VatPercent = null);
decimal? VatPercent = null,
decimal? NbtPercent = null);
public record CreateFlatGrnRequest(
Guid PurchaseOrderId,
@@ -38,7 +41,8 @@ public record CreateFlatGrnRequest(
// TEMPORARY: required while auth doesn't resolve a logged-in user server-side — see testbug.md #28.
Guid? ReceivedByUserId = null,
decimal? DiscountPercent = null,
decimal? VatPercent = null);
decimal? VatPercent = null,
decimal? NbtPercent = null);
/// <summary>A goods receipt with no purchase order. SupplierId is optional.</summary>
public record CreateDirectGrnRequest(
@@ -48,7 +52,8 @@ public record CreateDirectGrnRequest(
// TEMPORARY: required while auth doesn't resolve a logged-in user server-side — see testbug.md #28.
Guid? ReceivedByUserId = null,
decimal? DiscountPercent = null,
decimal? VatPercent = null);
decimal? VatPercent = null,
decimal? NbtPercent = null);
public record GrnBatchLineResponse(string? BatchNumber, DateTime? ExpiryDate, int Quantity);
@@ -71,7 +76,9 @@ public record GrnItemResponse(
decimal VatAmount,
// Gross - discount + VAT.
decimal LineTotal,
int FreeQuantity);
int FreeQuantity,
decimal NbtPercent,
decimal NbtAmount);
public record GrnResponse(
Guid Id,
@@ -89,7 +96,9 @@ public record GrnResponse(
// Sum of line gross amounts.
decimal SubTotal,
decimal DiscountAmount,
// SubTotal - DiscountAmount (the base VAT is charged on).
// SubTotal - DiscountAmount (the base NBT is charged on; VAT is charged on this plus NBT).
decimal TaxableAmount,
decimal VatAmount,
decimal TotalAmount);
decimal TotalAmount,
decimal NbtPercent,
decimal NbtAmount);