Creates purchase records with supplier, items, payment details, and billing while validating inventory levels and integrating with accounting systems.
// Source: https://github.com/orion-ai-community/BizzAI | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
// Provided via justclaw.it.com; keep this notice with the code.
import mongoose from "mongoose";
import Purchase from "../models/Purchase.js";
import Item from "../models/Item.js";
import Supplier from "../models/Supplier.js";
import Counter from "../models/Counter.js";
import CashbankTransaction from "../models/CashbankTransaction.js";
import BankAccount from "../models/BankAccount.js";
import { info, error } from "../utils/logger.js";
import { logStockMovement } from "../utils/stockMovementLogger.js";
import { validateStockLevels } from "../utils/inventoryValidator.js";
import { createBillFromPurchase } from "../utils/billUtils.js";
import
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key