fix in the product import
This commit is contained in:
@@ -39,6 +39,11 @@ type ProductRepository interface {
|
||||
CreateProductLocation(input []models.Productlocations) error
|
||||
CreateProductVariant(input models.Productvariant) error
|
||||
DeleteProductLocation(tenantid, locationid, productid int) error
|
||||
|
||||
// Releasing a product from the admin catalogue to every outlet, and pulling
|
||||
// it back. See productPublishRepository.go.
|
||||
PublishProduct(tenantID, productID int, price float64) (int, error)
|
||||
UnpublishProduct(tenantID, productID int) (int, error)
|
||||
FindTenantProductByCatalogueRef(tenantid int, brand string, catalogueid int64) (*models.Products, error)
|
||||
CreateProductReturningID(product models.Products) (int, error)
|
||||
GetImportedCatalogueRefs(tenantid int, brand string) ([]models.ImportedCatalogueRef, error)
|
||||
@@ -395,7 +400,7 @@ func (r *productRepository) GetStockStatement(tenantID, locationID, subcategoryI
|
||||
// arithmetically identical to closing — the Inventory ledger then showed
|
||||
// the same number in both columns and looked like stock never moved, even
|
||||
// on days with sales.
|
||||
query := `SELECT a.productid,a.productname,a.productimage,a.categoryid,a.subcategoryid,a.productunit,a.unitvalue,a.productcost,a.taxpercent,a.taxamount,a.retailprice,b.tenantid,b.locationid,
|
||||
query := `SELECT a.productid,a.productname,a.productimage,a.categoryid,a.subcategoryid,a.productunit,a.unitvalue,a.productcost,a.taxpercent,a.taxamount,a.retailprice,b.tenantid,b.locationid,b.publishedat,
|
||||
COALESCE( SUM(CASE WHEN UPPER(c.stocktype) = 'IN' AND c.stockdate::date < CURRENT_DATE THEN c.quantity ELSE 0 END) -
|
||||
SUM(CASE WHEN UPPER(c.stocktype) = 'OUT' AND c.stockdate::date < CURRENT_DATE THEN c.quantity ELSE 0 END),0 )
|
||||
AS opening,
|
||||
@@ -430,7 +435,7 @@ func (r *productRepository) GetStockStatement(tenantID, locationID, subcategoryI
|
||||
a.productid, a.productname, a.productimage,
|
||||
a.categoryid, a.subcategoryid, a.productunit,
|
||||
a.productcost, a.taxpercent, a.taxamount,
|
||||
a.retailprice, b.tenantid, b.locationid
|
||||
a.retailprice, b.tenantid, b.locationid, b.publishedat
|
||||
ORDER BY a.productid DESC LIMIT ` + strconv.Itoa(pagesize) + ` OFFSET ` + strconv.Itoa(offset)
|
||||
|
||||
if err := r.db.Raw(query, params...).Scan(&data).Error; err != nil {
|
||||
|
||||
Reference in New Issue
Block a user