"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 ? : undefined}> {R.valRows.length === 0 ? Nothing on hand. : ( ItemSKUSupplierUnits on handUnit costValue {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. : ( DateCounted byLines countedVariancesNet unitsNet 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}. : ( #ItemSupplierQty (month)Value (month)ShareQty (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}. : ( SupplierOrdersValueInvoices {R.supRows.map((r) => {r.name}{r.n}{money(r.amt)}{r.invoices})} )}
); }