@eristack/qups
Version:
Quantity / unit price / subtotal (QUPS) with 2-of-3 sources of truth, plus modifiers and tax — business line pricing on @eristack/money
53 lines • 1.56 kB
TypeScript
import { Money } from "@eristack/money";
export type TaxMode = "exclusive" | "inclusive";
export type TaxInput = {
/** net + rate → tax + gross (exclusive). */
truth: "net+rate";
net: Money;
ratePercent: string;
mode?: "exclusive";
} | {
/** gross + rate → net + tax (inclusive). */
truth: "gross+rate";
gross: Money;
ratePercent: string;
mode: "inclusive";
} | {
/** net + tax → gross; rate optional derived as informational string. */
truth: "net+tax";
net: Money;
tax: Money;
};
/**
* Tax triad with two sources of truth (net/rate, gross/rate, or net/tax).
* Uses `@eristack/money` Tax operators under the hood.
*/
export declare class LineTax {
readonly truth: "net+rate" | "gross+rate" | "net+tax";
readonly net: Money;
readonly tax: Money;
readonly gross: Money;
/** Percent points when known from rate-based truth. */
readonly ratePercent: string | null;
private constructor();
static of(input: TaxInput): LineTax;
withRounding(round?: import("@eristack/money").MonetaryOperator): LineTax;
toJSON(): {
truth: "gross+rate" | "net+rate" | "net+tax";
net: {
currency: string;
amount: string;
};
tax: {
currency: string;
amount: string;
};
gross: {
currency: string;
amount: string;
};
ratePercent: string | null;
};
}
export declare function assertRate(ratePercent: string): void;
//# sourceMappingURL=tax.d.ts.map