Einkaufspreise aller Lieferanten bei zugeordneten Produkten anzeigen

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Eduard Wisch 2026-02-17 07:05:51 +01:00
parent 82d4e8a323
commit c412d6c5a3

View file

@ -2056,6 +2056,32 @@ if ($action == 'edit' && $import->id > 0) {
print '<br><span class="opacitymedium"><i class="fas fa-barcode"></i> '.dol_escape_htmltag($line->ean).'</span>';
}
print ' <i class="fas fa-check-circle" style="color: green;"></i>';
// Alle Einkaufspreise des Produktes anzeigen
$sqlPrices = "SELECT pfp.fk_soc, pfp.price, pfp.ref_fourn, pfp.quantity, s.nom as supplier_name";
$sqlPrices .= " FROM ".MAIN_DB_PREFIX."product_fournisseur_price pfp";
$sqlPrices .= " LEFT JOIN ".MAIN_DB_PREFIX."societe s ON s.rowid = pfp.fk_soc";
$sqlPrices .= " WHERE pfp.fk_product = ".(int)$line->fk_product;
$sqlPrices .= " ORDER BY pfp.price ASC";
$resPrices = $db->query($sqlPrices);
if ($resPrices && $db->num_rows($resPrices) > 0) {
print '<div style="margin-top: 4px; font-size: 0.85em; line-height: 1.4;">';
while ($objP = $db->fetch_object($resPrices)) {
$isInvoiceSupplier = ($objP->fk_soc == $import->fk_soc);
$style = $isInvoiceSupplier ? 'font-weight: bold;' : 'color: #666;';
print '<div style="'.$style.'">';
print dol_escape_htmltag($objP->supplier_name);
print ': <strong>'.price($objP->price).'</strong>';
if (!empty($objP->ref_fourn)) {
print ' <span class="opacitymedium">('.dol_escape_htmltag($objP->ref_fourn).')</span>';
}
if ($isInvoiceSupplier) {
print ' <i class="fas fa-file-invoice" style="color: #337ab7;" title="'.$langs->trans('SupplierAssignment').'"></i>';
}
print '</div>';
}
print '</div>';
}
} else {
print '<span class="warning">'.$langs->trans('NoProductMatch').'</span>';
}