guyk Posted July 24, 2009 Share Posted July 24, 2009 Bonjour, J'ai sur un site des problèmes de chiffres faux dans les factures PDF.le pb est dans le détail des produits, les valeurs TTC sont légèrement fausses, après débug recherche il ne s'agit pas de pb d'arrondi, mais un oubli de compter les tarifs dégressifs.Dans class/Order.php getProducts() et getTotalProductsWithTaxes() il faut faire comme dans class/Product.php.getPriceStatic()et compter les prix dégressifs conservés dans order_detail.product_quantity_discountcorrection public function getProducts($products = false, $selectedProducts = false, $selectedQty = false) { if (!$products) $products = $this->getProductsDetail(); $resultArray = array(); foreach ($products AS $k => $row) { // Change qty if selected if ($selectedQty) { $row['product_quantity'] = 0; foreach ($selectedProducts AS $key => $id_product) if ($row['id_order_detail'] == $id_product) $row['product_quantity'] = intval($selectedQty[$key]); if (!$row['product_quantity']) continue ; } $row['product_price_wt'] = floatval(number_format( ($row['product_price']* (1 + ($row['tax_rate'] * 0.01))) - $row["product_quantity_discount"]/$row['product_quantity'] , 2, '.', ''));// GK : Forgot the Quantity discount !! $row['total_wt'] = $row['product_quantity'] * $row['product_price_wt']; $row['total_price'] = number_format($row['total_wt'] / (1 + ($row['tax_rate'] * 0.01)), 2, '.', ''); $row['total_wt'] = number_format($row['total_wt'], 2, '.', ''); and public function getTotalProductsWithTaxes($products = false) { if (!$products) $products = $this->getProductsDetail(); $total = 0; foreach ($products AS $k => $row) { $qty = intval($row['product_quantity']); $total += round((floatval($row['product_price']) * (floatval($row['tax_rate']) * 0.01 + 1)) - ($row["product_quantity_discount"]/$row['product_quantity']) , 2) * $qty;// GK : and product_quantity_discount !!!! } return $total; } j'ai juste soustrait $row["product_quantity_discount"]/$row['product_quantity'] au prix unitaire avec taxebug non corrigé dans la V1.2 beta : je cree un bug dans bugtracker (mon premier..)ci-joint un exemple de fausse facture, ce devrait etre 1,10+4,00+4,00+1,80+1,80+1,65=14,35 lfc_bug_prixdegr.zip Link to comment Share on other sites More sharing options...
guyk Posted July 30, 2009 Author Share Posted July 30, 2009 corrigé dans la version V1.2 : ps_order_detail.product_price tient compte de product_quantity_discount lors de l'enregistrement de la commande Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now