Debug v20

This commit is contained in:
Laurent Destailleur 2024-04-03 03:27:28 +02:00
parent 20e0417f3b
commit c31c766431
2 changed files with 9 additions and 8 deletions

View File

@ -196,11 +196,11 @@ if ($filtertype != 1) {
print '</td>';
}
$coldisplay += $colspan;
print '<td class="bordertop nobottom linecoledit center valignmiddle" colspan="' . $colspan . '">';
print '<input type="submit" class="button button-add" name="addline" id="addline" value="' . $langs->trans('Add') . '">';
print '</td>';
print '</tr>';
$coldisplay += $colspan;
print '<td class="bordertop nobottom linecoledit right valignmiddle" colspan="' . $colspan . '">';
print '<input type="submit" class="button button-add small" name="addline" id="addline" value="' . $langs->trans('Add') . '">';
print '</td>';
print '</tr>';
?>

View File

@ -351,11 +351,12 @@ if ($resql) {
print '<span class="amount">'.price(price2num($sub_bom_product->pmp * $sub_bom_line->qty * (float) $line->qty, 'MT')).'</span></td>';
$total_cost .= $sub_bom_product->pmp * $sub_bom_line->qty * (float) $line->qty;
} else { // Minimum purchase price if cost price and PMP aren't defined
$sql_supplier_price = 'SELECT MIN(price) AS min_price, quantity AS qty FROM '.MAIN_DB_PREFIX.'product_fournisseur_price';
$sql_supplier_price .= ' WHERE fk_product = '. (int) $sub_bom_product->id;
$sql_supplier_price = "SELECT MIN(price) AS min_price, quantity AS qty FROM ".MAIN_DB_PREFIX."product_fournisseur_price";
$sql_supplier_price .= " WHERE fk_product = ". (int) $sub_bom_product->id;
$sql_supplier_price .= " GROUP BY quantity ORDER BY quantity ASC";
$resql_supplier_price = $object->db->query($sql_supplier_price);
if ($resql_supplier_price) {
$obj = $object->db->fetch_object($resql_supplier_price);
$obj = $object->db->fetch_object($resql_supplier_price); // Take first value so the ref with the smaller minimum quantity
if (!empty($obj->qty) && !empty($sub_bom_line->qty) && !empty($line->qty)) {
$line_cost = $obj->min_price / $obj->qty * $sub_bom_line->qty * (float) $line->qty;
} else {