stocks change
This commit is contained in:
@@ -405,7 +405,11 @@ func (r *productRepository) GetLocationProducts(tenantID, locationID, subcategor
|
||||
|
||||
params := []interface{}{tenantID, locationID}
|
||||
|
||||
query := `SELECT a.*, b.productlocationid, b.status,
|
||||
// b.price is the per-store selling price. It has to be selected explicitly:
|
||||
// a.* only covers products (whose price column is retailprice, the master
|
||||
// price), so without this the catalogue could never read back a price set
|
||||
// for this outlet via CreateProductLocation.
|
||||
query := `SELECT a.*, b.productlocationid, b.status, b.price,
|
||||
COALESCE(SUM(CASE WHEN UPPER(c.stocktype) = 'IN' THEN c.quantity ELSE 0 END), 0) AS total_in,
|
||||
COALESCE(SUM(CASE WHEN UPPER(c.stocktype) = 'OUT' THEN c.quantity ELSE 0 END), 0) AS total_out,
|
||||
COALESCE(SUM(CASE WHEN UPPER(c.stocktype) = 'IN' THEN c.quantity ELSE 0 END) -
|
||||
@@ -427,7 +431,7 @@ func (r *productRepository) GetLocationProducts(tenantID, locationID, subcategor
|
||||
|
||||
query += ` GROUP BY a.productid, a.productname, a.productimage, a.categoryid, a.subcategoryid,
|
||||
a.productunit, a.productcost, a.taxpercent, a.taxamount, a.retailprice,
|
||||
b.tenantid, b.locationid, b.productlocationid, b.status
|
||||
b.tenantid, b.locationid, b.productlocationid, b.status, b.price
|
||||
ORDER BY a.productid DESC LIMIT ? OFFSET ?`
|
||||
|
||||
params = append(params, pagesize, offset)
|
||||
|
||||
Reference in New Issue
Block a user