fixed
This commit is contained in:
@@ -8,6 +8,7 @@ import type {
|
||||
JournalEntryRow,
|
||||
KitRow,
|
||||
LowStockRow,
|
||||
OrderItemOption,
|
||||
PartRow,
|
||||
PurchaseOrderListRow,
|
||||
SalesOrderListRow,
|
||||
@@ -94,6 +95,28 @@ export function getParts(): PartRow[] {
|
||||
.all() as PartRow[];
|
||||
}
|
||||
|
||||
export function getOrderItemOptions(): OrderItemOption[] {
|
||||
return db()
|
||||
.prepare(
|
||||
`
|
||||
SELECT
|
||||
p.id,
|
||||
p.sku,
|
||||
p.name,
|
||||
p.kind,
|
||||
COALESCE(ib.quantity_on_hand, 0) AS quantityOnHand,
|
||||
p.sale_price AS salePrice,
|
||||
p.unit_cost AS unitCost,
|
||||
p.unit_of_measure AS unitOfMeasure
|
||||
FROM parts p
|
||||
LEFT JOIN inventory_balances ib ON ib.part_id = p.id
|
||||
WHERE p.is_active = 1
|
||||
ORDER BY p.kind DESC, p.sku ASC
|
||||
`
|
||||
)
|
||||
.all() as OrderItemOption[];
|
||||
}
|
||||
|
||||
export function getAssembliesWithComponents(): KitRow[] {
|
||||
return db()
|
||||
.prepare(
|
||||
|
||||
Reference in New Issue
Block a user