feat: add discount amount to invoice response and display in invoice view
This commit is contained in:
@@ -179,6 +179,7 @@ export default function InvoiceViewPage() {
|
|||||||
|
|
||||||
<div className="grid grid-cols-2 gap-4 rounded-2xl border p-4 sm:grid-cols-4">
|
<div className="grid grid-cols-2 gap-4 rounded-2xl border p-4 sm:grid-cols-4">
|
||||||
<Stat label="Total" value={fmtAmount(invoice.totalAmount)} />
|
<Stat label="Total" value={fmtAmount(invoice.totalAmount)} />
|
||||||
|
{invoice.discountAmount > 0 && <Stat label="Scheme discount (included)" value={fmtAmount(invoice.discountAmount)} />}
|
||||||
<Stat label="Paid" value={fmtAmount(paidAmount)} />
|
<Stat label="Paid" value={fmtAmount(paidAmount)} />
|
||||||
<Stat label="Balance" value={fmtAmount(balance)} />
|
<Stat label="Balance" value={fmtAmount(balance)} />
|
||||||
<Stat label="Created" value={fmtDateTime(invoice.createdAt)} />
|
<Stat label="Created" value={fmtDateTime(invoice.createdAt)} />
|
||||||
|
|||||||
@@ -163,6 +163,7 @@ export const productReports = {
|
|||||||
export interface SalesKpis {
|
export interface SalesKpis {
|
||||||
grossSales: number
|
grossSales: number
|
||||||
returnValue: number
|
returnValue: number
|
||||||
|
discounts: number
|
||||||
netSales: number
|
netSales: number
|
||||||
orders: number
|
orders: number
|
||||||
averageOrderValue: number
|
averageOrderValue: number
|
||||||
@@ -170,11 +171,19 @@ export interface SalesKpis {
|
|||||||
grossProfitMarginPercent: number | null
|
grossProfitMarginPercent: number | null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface CashKpis {
|
||||||
|
collected: number
|
||||||
|
outstanding: number
|
||||||
|
overdue: number
|
||||||
|
collectionRatePercent: number | null
|
||||||
|
}
|
||||||
|
|
||||||
export interface DashboardSalesSummary {
|
export interface DashboardSalesSummary {
|
||||||
from: string
|
from: string
|
||||||
to: string
|
to: string
|
||||||
granularity: 'day' | 'month'
|
granularity: 'day' | 'month'
|
||||||
kpis: { current: SalesKpis; previous: SalesKpis; previousFrom: string; previousTo: string }
|
kpis: { current: SalesKpis; previous: SalesKpis; previousFrom: string; previousTo: string }
|
||||||
|
cash: { current: CashKpis; previous: CashKpis }
|
||||||
trend: Array<{ period: string; sales: number; returns: number }>
|
trend: Array<{ period: string; sales: number; returns: number }>
|
||||||
byCategory: Array<{ id: string | null; name: string; amount: number }>
|
byCategory: Array<{ id: string | null; name: string; amount: number }>
|
||||||
byRegion: Array<{ id: string | null; name: string; amount: number }>
|
byRegion: Array<{ id: string | null; name: string; amount: number }>
|
||||||
|
|||||||
@@ -1045,6 +1045,7 @@ export interface InvoiceResponse {
|
|||||||
finalizedAt: string | null
|
finalizedAt: string | null
|
||||||
finalizedBy: string | null
|
finalizedBy: string | null
|
||||||
totalAmount: number
|
totalAmount: number
|
||||||
|
discountAmount: number
|
||||||
paidAmount: number
|
paidAmount: number
|
||||||
isActive: boolean
|
isActive: boolean
|
||||||
createdAt: string
|
createdAt: string
|
||||||
|
|||||||
Reference in New Issue
Block a user