refactor: refs #6501 Minor change
gitea/salix/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Guillermo Bonet 2024-02-12 10:36:09 +01:00
parent 23bf9b2750
commit 4b5802202d
1 changed files with 13 additions and 6 deletions

View File

@ -120,6 +120,7 @@ BEGIN
COALESCE(b2.packing, b.packing) packing, COALESCE(b2.packing, b.packing) packing,
COALESCE(b3.groupingMode, b2.groupingMode, b.groupingMode) package, COALESCE(b3.groupingMode, b2.groupingMode, b.groupingMode) package,
IFNULL(p.name, s.nickname) productor, IFNULL(p.name, s.nickname) productor,
TRUE tinta,
b.packagingFk, b.packagingFk,
b2.id buyFk, b2.id buyFk,
b2.stickers, b2.stickers,
@ -136,8 +137,8 @@ BEGIN
e.commission, e.commission,
pa.isPackageReturnable, pa.isPackageReturnable,
IFNULL(pa2.value, pa.value) `value`, IFNULL(pa2.value, pa.value) `value`,
r.rate3, r.r3,
r.rate2, r.r2,
it.promo, it.promo,
b.`grouping` groupingOrigin, b.`grouping` groupingOrigin,
b.packing packingOrigin, b.packing packingOrigin,
@ -179,11 +180,17 @@ BEGIN
SELECT *, SELECT *,
quantity - MOD(quantity , `grouping`) subQuantity, quantity - MOD(quantity , `grouping`) subQuantity,
MOD(quantity, `grouping`) soll, MOD(quantity, `grouping`) soll,
ROUND((IF(volume > 0,volume, width * `depth` * IF(height = 0, `size` + 10, height))) / packing, 0) cm3, ROUND((IF(volume > 0,volume, width * `depth` *
IF(height = 0, `size` + 10, height))) /
packing, 0) cm3,
buyingValue + comissionValue + freightValue cost, buyingValue + comissionValue + freightValue cost,
@carriage := ROUND((IF(volume > 0, volume, width * `depth` * IF(height = 0, `size` + 10, height))) * m3 / 1000000 / Packing, 3) carriage, @carriage := ROUND((IF(volume > 0, volume, width * `depth` *
@comission := ROUND((buyingValue + comissionValue + freightValue) * commission / 100, 3) commission, IF(height = 0, `size` + 10, height))) *
ROUND(@packaging := (returnCost + IF(isPackageReturnable != 0, 0, value)) / packing, 3) packaging, m3 / 1000000 / Packing, 3) carriage,
@comission := ROUND((buyingValue + comissionValue + freightValue) *
commission / 100, 3) commission,
ROUND(@packaging := (returnCost + IF(isPackageReturnable != 0, 0, value))
/ packing, 3) packaging,
@cost := IFNULL((buyingValue + comissionValue + freightValue), 0) + @cost := IFNULL((buyingValue + comissionValue + freightValue), 0) +
IFNULL(@packaging, 0) + IFNULL(@packaging, 0) +
IFNULL(@carriage, 0) + IFNULL(@carriage, 0) +