This commit is contained in:
2026-03-15 00:29:41 -05:00
parent f66001e514
commit 3323435114
22 changed files with 1376 additions and 8 deletions

View File

@@ -11,6 +11,8 @@ export const permissions = {
ganttRead: "gantt.read",
salesRead: "sales.read",
salesWrite: "sales.write",
purchasingRead: "purchasing.read",
purchasingWrite: "purchasing.write",
shippingRead: "shipping.read",
shippingWrite: "shipping.write",
} as const;

View File

@@ -6,5 +6,6 @@ export * from "./crm/types.js";
export * from "./files/types.js";
export * from "./gantt/types.js";
export * from "./inventory/types.js";
export * from "./purchasing/types.js";
export * from "./sales/types.js";
export * from "./shipping/types.js";

View File

@@ -0,0 +1,70 @@
import type { InventoryUnitOfMeasure } from "../inventory/types.js";
export const purchaseOrderStatuses = ["DRAFT", "ISSUED", "APPROVED", "CLOSED"] as const;
export type PurchaseOrderStatus = (typeof purchaseOrderStatuses)[number];
export interface PurchaseVendorOptionDto {
id: string;
name: string;
email: string;
paymentTerms: string | null;
currencyCode: string | null;
}
export interface PurchaseLineDto {
id: string;
itemId: string;
itemSku: string;
itemName: string;
description: string;
quantity: number;
unitOfMeasure: InventoryUnitOfMeasure;
unitCost: number;
lineTotal: number;
position: number;
}
export interface PurchaseLineInput {
itemId: string;
description: string;
quantity: number;
unitOfMeasure: InventoryUnitOfMeasure;
unitCost: number;
position: number;
}
export interface PurchaseOrderSummaryDto {
id: string;
documentNumber: string;
vendorId: string;
vendorName: string;
status: PurchaseOrderStatus;
subtotal: number;
taxPercent: number;
taxAmount: number;
freightAmount: number;
total: number;
issueDate: string;
updatedAt: string;
lineCount: number;
}
export interface PurchaseOrderDetailDto extends PurchaseOrderSummaryDto {
vendorEmail: string;
notes: string;
paymentTerms: string | null;
currencyCode: string | null;
createdAt: string;
lines: PurchaseLineDto[];
}
export interface PurchaseOrderInput {
vendorId: string;
status: PurchaseOrderStatus;
issueDate: string;
taxPercent: number;
freightAmount: number;
notes: string;
lines: PurchaseLineInput[];
}