This commit is contained in:
Matthias Hochmeister
2026-03-26 14:38:31 +01:00
parent c29b21f714
commit 3e5086441e

View File

@@ -451,7 +451,7 @@ export default function BestellungDetail() {
// ── Line items table ── // ── Line items table ──
const steuersatz = (parseFloat(String(bestellung.steuersatz)) || 20) / 100; const steuersatz = (parseFloat(String(bestellung.steuersatz)) || 20) / 100;
const hasPrices = positionen.some((p) => p.einzelpreis != null); const hasPrices = positionen.some((p) => p.einzelpreis != null && p.einzelpreis > 0);
const totalNetto = positionen.reduce((sum, p) => { const totalNetto = positionen.reduce((sum, p) => {
const ep = p.einzelpreis != null ? parseFloat(String(p.einzelpreis)) : 0; const ep = p.einzelpreis != null ? parseFloat(String(p.einzelpreis)) : 0;
@@ -482,7 +482,7 @@ export default function BestellungDetail() {
head: [['Bezeichnung', 'Art.-Nr.', 'Menge', 'Einzelpreis', 'Gesamt']], head: [['Bezeichnung', 'Art.-Nr.', 'Menge', 'Einzelpreis', 'Gesamt']],
body: rows, body: rows,
startY: curY, startY: curY,
theme: 'grid', theme: 'striped',
headStyles: { fillColor: [66, 66, 66], textColor: 255, fontStyle: 'bold' }, headStyles: { fillColor: [66, 66, 66], textColor: 255, fontStyle: 'bold' },
alternateRowStyles: { fillColor: [245, 245, 245] }, alternateRowStyles: { fillColor: [245, 245, 245] },
margin: { left: 10, right: 10 }, margin: { left: 10, right: 10 },
@@ -525,7 +525,7 @@ export default function BestellungDetail() {
head: [['Bezeichnung', 'Art.-Nr.', 'Menge']], head: [['Bezeichnung', 'Art.-Nr.', 'Menge']],
body: rows, body: rows,
startY: curY, startY: curY,
theme: 'grid', theme: 'striped',
headStyles: { fillColor: [66, 66, 66], textColor: 255, fontStyle: 'bold' }, headStyles: { fillColor: [66, 66, 66], textColor: 255, fontStyle: 'bold' },
alternateRowStyles: { fillColor: [245, 245, 245] }, alternateRowStyles: { fillColor: [245, 245, 245] },
margin: { left: 10, right: 10 }, margin: { left: 10, right: 10 },
@@ -897,40 +897,40 @@ export default function BestellungDetail() {
</TableRow> </TableRow>
</React.Fragment> </React.Fragment>
) : ( ) : (
<TableRow key={p.id}> <React.Fragment key={p.id}>
<TableCell> <TableRow>
<Box> <TableCell>{p.bezeichnung}</TableCell>
{p.bezeichnung} <TableCell>{p.artikelnummer || ''}</TableCell>
{p.spezifikationen && p.spezifikationen.length > 0 && ( <TableCell align="right">{p.menge}</TableCell>
<Box sx={{ pl: 2, mt: 0.5 }}> <TableCell>{p.einheit}</TableCell>
{p.spezifikationen.map((spec, i) => ( <TableCell align="right">{formatCurrency(p.einzelpreis)}</TableCell>
<Typography key={i} variant="caption" color="text.secondary" display="block"> {spec}</Typography> <TableCell align="right">{formatCurrency((p.einzelpreis ?? 0) * p.menge)}</TableCell>
))} <TableCell align="right">
</Box> {canManageOrders ? (
<TextField
size="small"
type="number"
sx={{ width: 70 }}
value={p.erhalten_menge}
inputProps={{ min: 0, max: p.menge }}
disabled={bestellung.status !== 'bestellt' && bestellung.status !== 'teillieferung'}
onChange={(e) => updateReceived.mutate({ itemId: p.id, menge: Number(e.target.value) })}
/>
) : (
p.erhalten_menge
)} )}
</Box> </TableCell>
</TableCell> </TableRow>
<TableCell>{p.artikelnummer || ''}</TableCell> {p.spezifikationen && p.spezifikationen.length > 0 && (
<TableCell align="right">{p.menge}</TableCell> <TableRow>
<TableCell>{p.einheit}</TableCell> <TableCell colSpan={7} sx={{ pt: 0, pb: 1, pl: 4, borderTop: 'none' }}>
<TableCell align="right">{formatCurrency(p.einzelpreis)}</TableCell> {p.spezifikationen.map((spec, i) => (
<TableCell align="right">{formatCurrency((p.einzelpreis ?? 0) * p.menge)}</TableCell> <Typography key={i} variant="caption" color="text.secondary" display="block"> {spec}</Typography>
<TableCell align="right"> ))}
{canManageOrders ? ( </TableCell>
<TextField </TableRow>
size="small" )}
type="number" </React.Fragment>
sx={{ width: 70 }}
value={p.erhalten_menge}
inputProps={{ min: 0, max: p.menge }}
disabled={bestellung.status !== 'bestellt' && bestellung.status !== 'teillieferung'}
onChange={(e) => updateReceived.mutate({ itemId: p.id, menge: Number(e.target.value) })}
/>
) : (
p.erhalten_menge
)}
</TableCell>
</TableRow>
), ),
)} )}