fixing report-counting-sapronak

This commit is contained in:
ragilap
2025-12-16 10:44:19 +07:00
parent f60564d673
commit cf7b3418a5
12 changed files with 593 additions and 589 deletions
@@ -189,9 +189,6 @@ func (r *PurchaseRepositoryImpl) UpdateReceivingDetails(
if upd.VehicleNumber != nil {
data["vehicle_number"] = upd.VehicleNumber
}
if upd.ReceivedQty != nil {
data["total_qty"] = upd.ReceivedQty
}
if upd.WarehouseID != nil && *upd.WarehouseID != 0 {
data["warehouse_id"] = upd.WarehouseID
}
@@ -814,7 +814,13 @@ func (s *purchaseService) ReceiveProducts(c *fiber.Ctx, id uint, req *validation
// Always ensure PW when qty > 0 so stockable has target.
if prep.receivedQty > 0 {
pwID, err := pwRepoTx.EnsureProductWarehouse(c.Context(), uint(item.ProductId), prep.warehouseID, purchase.CreatedBy)
pwID, err := pwRepoTx.EnsureProductWarehouse(
c.Context(),
uint(item.ProductId),
prep.warehouseID,
item.ProjectFlockKandangId,
purchase.CreatedBy,
)
if err != nil {
return err
}