variants units

This commit is contained in:
2026-09-02 16:01:24 +05:30
parent 09efc5403f
commit e45da9f7df
8 changed files with 374 additions and 61 deletions

View File

@@ -224,8 +224,8 @@ func (r *deliveriesRepository) UpdateDelivery(data models.UpdateDeliveryStatus)
case "picked":
if data.Pickuplocationid != 0 && data.Deliverytype != "B" {
cloc.Latitude = data.Riderslat
cloc.Longitude = data.Riderslon
cloc.Latitude = models.FlexibleString(data.Riderslat)
cloc.Longitude = models.FlexibleString(data.Riderslon)
cloc.Address = data.Address
cloc.Suburb = data.Suburb
cloc.City = data.City
@@ -247,8 +247,8 @@ func (r *deliveriesRepository) UpdateDelivery(data models.UpdateDeliveryStatus)
}
if data.Deliverylocationid != 0 && data.Deliverytype != "B" {
cloc.Latitude = data.Deliverylat
cloc.Longitude = data.Deliverylong
cloc.Latitude = models.FlexibleString(data.Deliverylat)
cloc.Longitude = models.FlexibleString(data.Deliverylong)
cloc.Address = data.Address
cloc.Suburb = data.Suburb
cloc.City = data.City

View File

@@ -123,7 +123,14 @@ func (r *productRepository) VariantsForProducts(tenantid, locationid int, produc
Select(`
v.*,
p.productname AS variantproductname,
COALESCE(NULLIF((
COALESCE(p.unitvalue, '') AS variantunitvalue,
COALESCE(p.productunit, '') AS variantproductunit,
-- The variant’s own override wins, then the outlet’s price, then the
-- master price. The override was being ignored entirely: a size
-- priced differently from its product was sold at the product’s
-- price. NULLIF because 0 in that column means "no override", not
-- "free".
COALESCE(NULLIF(v.price, 0), NULLIF((
SELECT pl.price FROM productlocations pl
WHERE pl.productid = v.variantproductid AND pl.tenantid = v.tenantid AND pl.locationid = ?
LIMIT 1

View File

@@ -695,8 +695,8 @@ func (r *tenantRepository) CreateTenantUser(data models.Tenants) (bool, error) {
cust.State = data.State
cust.Postcode = data.Postcode
cust.Applocationid = data.Applocationid
cust.Latitude = data.Latitude
cust.Longitude = data.Longitude
cust.Latitude = models.FlexibleString(data.Latitude)
cust.Longitude = models.FlexibleString(data.Longitude)
cust.Primaryaddress = 1
cid := r.CheckCustomer(data.Primarycontact)