---
tags: [purchases, cross-module]
module: Purchases
---

# [Cross]CrossModuleDependencies

## Connections
[[_Purchases]] · [[[Model]Supplier]] · [[[Model]PurchaseBill]] · [[[Model]BillReturn]] · [[[Model]PurchaseOrder]] · [[[Model]Expense]] · [[[Model]SupplierPaymentReceipt]] · [[[Service]PurchaseBillServices]] · [[[Service]SupplierServices]] · [[[Observer]Observers]] · [[[Command]Commands]]

---

## Accounting Module
| Used | Type | Purpose |
|---|---|---|
| `Account` | Model | Supplier `payment_account_id`; Expense `payment_account_id`; Receipt `payment_account_id` |
| `JournalEntry` | Model | All transactional entities link to a journal entry |
| `JournalRecord` | Model | Supplier.journalRecords |
| `FiscalYear` | Model | All transactional entities belong to a fiscal year |
| `PaymentTerm` | Model | PurchaseBill / BillReturn `payment_term_id` |
| `CreatingNewJournalEntryService` | Service | Called by every Store/Update service to create double-entry records |
| `RetrievingCurrentFinancialYearService` | Service | Determines active fiscal year on create |
| `GetAccountingSettingsCountService` | Service | Used in bill index to show accounting setup status |
| `FillOpeningClosingBalance` | Job | Dispatched after bill store/update to recalculate balances |

---

## Settings Module
| Used | Type | Purpose |
|---|---|---|
| `Tax` | Model | All detail lines have `tax_id` |
| `FormDesign` | Model | PurchaseBill, BillReturn, PurchaseOrder, Expense, Receipt all have `form_design_id` |
| `TaxesRepository` | Repo | Tax dropdown in bill/expense forms |
| `GeneralSettingsRepository` | Repo | Currency + company info |
| `RetrievingCurrentFinancialYearService` | Service | Active fiscal year |
| `RetrievingTenantCurrencyService` | Service | Default currency for bill creation |
| `RetrievingInventorySystemService` | Service | Whether to update stock on bill save |
| `RetrievingFormDesignByFormTypeService` | Service | PDF form layout |

---

## Products Module
| Used | Type | Purpose |
|---|---|---|
| `Product` | Model | All detail lines reference `product_id` (withTrashed) |
| `WarehouseProduct` | Model | Bill/Return/PO details link `warehouse_product_id` |
| `CostCenter` | Model | All transactional entities have optional `cost_center_id` |
| `ProductsRepository` | Repo | Product list for bill/expense detail lines |

---

## Inventory Module
| Used | Type | Purpose |
|---|---|---|
| `SuppliersRepository` | Repo | Supplier dropdown on INBOUND requisition form (Inventory uses this) |
| `PurchaseBill` | Model | Target when converting an INBOUND Requisition |
| `BillReturn` | Model | WarehouseProductLog polymorphic entity type |
| `PreparingDataForCreatingPurchaseBillService` | Service | Bill form data on requisition → bill conversion |
| `MappingRequisitionDataToPurchaseBillService` | Service | Maps requisition fields to bill (Inventory calls this) |

---

## Sales Module
| Used | Type | Purpose |
|---|---|---|
| `Customer` | Model | Expense.customer_id (Expense can be linked to a customer) |
| `BillTaxesStatusEnum` | Enum | Shares `sales::invoices.*` translation keys |

---

## CompanyUser Module
| Used | Type | Purpose |
|---|---|---|
| `User` | Model | `created_by` / `updated_by` / `deleted_by` on all entities |
| `TenantBaseController` | Base class | All web controllers extend this |
| `ContentGenerator` | Base class | `NotifyDueBillContentGenerator` extends this |

---

## Tenant Module
| Used | Type | Purpose |
|---|---|---|
| `UpdatingLastActivityService` | Service | All 3 observers call this on `created` events |
| `FeatureNameEnum` | Enum | `BillsLimits` · `ExpensesLimits` · `PaymentReceiptsLimits` — usage tracking |
| `RetrievingTenantsService` | Service | `RunNotifyDuePurchaseBillsCommand` iterates all tenants |

---

## App (Core)
| Used | Type | Purpose |
|---|---|---|
| `UsesTenantConnection` | Trait | All models use tenant DB |
| `AuditableTrait` | Trait | Supplier, PurchaseBill, BillReturn, PurchaseOrder, Expense, SupplierPaymentReceipt |
| `SoftDeletes` | Trait | All models |
| `FormatDateAndTimeTrait` | Trait | PurchaseBill, BillReturn, PurchaseOrder, Expense, SupplierPaymentReceipt |
| `CacheClientService` | Service | Used by SuppliersRepository for cached dropdowns |
| `BaseApiController` | Base class | All API controllers |
| `DownloadingPDFService` / `PrintingPDFService` | Services | PDF generation used in PDF + Print controllers |
| `PrintingMultipleViewsMultiTemplatePDFService` | Service | Bulk PDF exports |
