This commit is contained in:
seb
2026-10-08 22:44:51 +02:00
parent 22063e6944
commit ee93f71b27
11 changed files with 1047 additions and 67 deletions

View File

@@ -8,11 +8,13 @@ import TableCell from '@mui/material/TableCell';
import TableContainer from '@mui/material/TableContainer';
import TableHead from '@mui/material/TableHead';
import TableRow from '@mui/material/TableRow';
import Typography from '@mui/material/Typography';
import AddIcon from '@mui/icons-material/Add';
import SearchIcon from '@mui/icons-material/Search';
import DeleteSweepOutlinedIcon from '@mui/icons-material/DeleteSweepOutlined';
import { PanelTile } from 'dashgui/panels';
import { LINE_COLUMNS, hasArticleLines } from './manifestConfig';
import { LINE_COLUMNS, hasArticleLines, parseNum, getFirstVal } from './manifestConfig';
import { formatPrice } from '../../utils/price';
import ManifestFormLine from './ManifestFormLine';
class ManifestLines extends PureComponent {
@@ -43,6 +45,21 @@ class ManifestLines extends PureComponent {
const hasArticles = hasArticleLines(lines);
let totalNet = 0;
let totalGross = 0;
if (Array.isArray(lines)) {
for (const line of lines) {
const amount = parseNum(getFirstVal(line.amount, line.count)) ?? 0;
const net = parseNum(getFirstVal(line.net, line.netprice, line.netPrice)) ?? 0;
const tax = parseNum(getFirstVal(line.tax, line.taxrate, line.taxRate)) ?? 0;
const rebate = parseNum(getFirstVal(line.rebate)) ?? 0;
const lineNet = amount * net * (1 - rebate / 100);
const lineGross = lineNet * (1 + tax / 100);
totalNet += lineNet;
totalGross += lineGross;
}
}
return (
<PanelTile
wide={wide}
@@ -102,6 +119,8 @@ class ManifestLines extends PureComponent {
return (
<ManifestFormLine
key={lineKey}
index={index}
positionIndex={index + 1}
kind={kind}
line={line.key != null ? line : { ...line, key: index }}
columns={columns}
@@ -151,6 +170,22 @@ class ManifestLines extends PureComponent {
>
Alle Zeilen entfernen
</Button>
{(totalNet > 0 || totalGross > 0) && (
<Box sx={{ ml: 'auto', display: 'flex', alignItems: 'center', gap: 2, pr: 0.5 }}>
<Typography variant="body2" sx={{ color: 'text.secondary', fontWeight: 600, fontSize: '0.8rem' }}>
Netto:{' '}
<Box component="span" sx={{ color: 'text.primary', fontWeight: 700 }}>
{formatPrice(totalNet)}
</Box>
</Typography>
<Typography variant="body2" sx={{ color: 'primary.dark', fontWeight: 700, fontSize: '0.85rem' }}>
Brutto:{' '}
<Box component="span" sx={{ color: 'primary.dark', fontWeight: 800 }}>
{formatPrice(totalGross)}
</Box>
</Typography>
</Box>
)}
</Box>
</Stack>
</PanelTile>