"use client";
import { Figures, Panel } from "@/components/portal";
import { fmtDate, money, signedInt, signedMoney } from "@/lib/compute";
import { HeadActions, PanelEmpty, TableWrap, TOTAL, plural } from "./bits";
import type { ReportData } from "./useReportData";
export default function StockTab({ d }: { d: ReportData }) {
const { R, mLbl, csv, print } = d;
return (
0}
aside={ 0 ? `${plural(R.negSizes, "size")} negative on hand` : "today, at catalogue cost"} onCsv={csv.valuation} onPrint={print.valuation} />}
foot={R.negSizes > 0 ? Negative sizes count as 0 : undefined}>
{R.valRows.length === 0 ? Nothing on hand. : (
| Item | SKU | Supplier | Units on hand | Unit cost | Value |
{R.valRows.map((r, i) => | {r.item} | {r.sku} | {r.supplier} | {r.units} | {money(r.cost)} | {money(r.val)} |
)}
| TOTAL | | | {R.valTotUnits} | | {money(R.valTot)} |
)}
}>
{R.shRows.length === 0 ?
No stocktakes filed this financial year. : (
| Date | Counted by | Lines counted | Variances | Net units | Net value |
{R.shRows.map((r, i) => | {fmtDate(r.date)} | {r.by} | {r.counted} | {r.variances} | {signedInt(r.net)} | {signedMoney(r.netVal)} |
)}
)}
}>
{R.topRows.length === 0 ?
Nothing issued in {mLbl}. : (
| # | Item | Supplier | Qty (month) | Value (month) | Share | Qty (FY) |
{R.topRows.map((r) => | {r.n} | {r.item} | {r.supplier} | {r.qty} | {money(r.val)} | {r.share} | {r.fyQty} |
)}
)}
}>
{R.supRows.length === 0 ?
No supplier orders placed in {mLbl}. : (
| Supplier | Orders | Value | Invoices |
{R.supRows.map((r) => | {r.name} | {r.n} | {money(r.amt)} | {r.invoices} |
)}
)}
);
}