Merge pull request #68 from LQYBill/fix/productOrderPrice

fix : prices on product order page and allow to invoice sku with 0 qty
pull/6221/head
Qiuyi LI 2024-04-02 16:12:04 +02:00 committed by GitHub
commit 6876b91a27
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 3 deletions

View File

@ -25,7 +25,7 @@ public class PurchaseInvoiceEntry {
} }
public BigDecimal unitPrice() { public BigDecimal unitPrice() {
return totalAmount.divide(BigDecimal.valueOf(quantity)); return quantity == 0 ? BigDecimal.ZERO : totalAmount.divide(BigDecimal.valueOf(quantity));
} }

View File

@ -171,7 +171,7 @@
s.purchasing_amount, s.purchasing_amount,
s.available_amount, s.available_amount,
qtyInOrdersNotShipped.quantity as qtyInOrdersNotShipped, qtyInOrdersNotShipped.quantity as qtyInOrdersNotShipped,
IF(s.available_amount IS NULL, 0, s.available_amount) + IF(s.purchasing_amount IS NULL, 0, s.purchasing_amount) - IF(qtyInOrdersNotShipped.quantity IS NULL, 0, qtyInOrdersNotShipped.quantity) as stock, s.available_amount + s.purchasing_amount - IF(qtyInOrdersNotShipped.quantity IS NULL, 0, qtyInOrdersNotShipped.quantity) as stock,
s.image_source, s.image_source,
s.service_fee, s.service_fee,
IF(sp.price_rmb IS NULL, sp.price, IF(sp.price_rmb IS NULL, sp.price,
@ -203,7 +203,7 @@
FROM sku s FROM sku s
JOIN client_sku cs ON s.id = cs.sku_id JOIN client_sku cs ON s.id = cs.sku_id
JOIN product p ON s.product_id = p.id JOIN product p ON s.product_id = p.id
LEFT JOIN sku_price sp ON s.id = sp.sku_id LEFT JOIN sku_current_price sp ON s.id = sp.sku_id
LEFT JOIN sales_28 s28 ON s.id = s28.sku_id LEFT JOIN sales_28 s28 ON s.id = s28.sku_id
LEFT JOIN sales_42 s42 ON s.id = s42.sku_id LEFT JOIN sales_42 s42 ON s.id = s42.sku_id
LEFT JOIN sales_7 s7 ON s.id = s7.sku_id LEFT JOIN sales_7 s7 ON s.id = s7.sku_id