# abdallahfathii/cashir-app architecture

> Architecture diagram of the GitHub repository abdallahfathii/cashir-app, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-11). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/abdallahfathii/cashir-app
- Repository: https://github.com/abdallahfathii/cashir-app

## Overview

This is a Windows WPF point-of-sale application for an agricultural pesticide shop. A cashier builds a cart, completes a sale, and the database persists the invoice and stock changes; separate screens manage products, review sales, record returns, monitor low stock, and report on sales. Reports can be exported as PDFs or shared through WhatsApp. The graph includes documented screens whose code was not sampled, but omits unverified navigation links. Source excerpts and the SOURCE INDEX support the shown calls; the README supplies broader feature coverage.

Main entry points: [`Database.cs`](https://github.com/abdallahfathii/cashir-app/blob/main/Database.cs) (Database Operations), [`SalesPage.xaml.cs`](https://github.com/abdallahfathii/cashir-app/blob/main/SalesPage.xaml.cs) (Sales History), [`PosPage.xaml.cs`](https://github.com/abdallahfathii/cashir-app/blob/main/PosPage.xaml.cs) (Point of Sale), [`ReportsPage.xaml.cs`](https://github.com/abdallahfathii/cashir-app/blob/main/ReportsPage.xaml.cs) (Sales Reports)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_application["Application Shell"]
  node_startup["Application Startup<br/>[App.xaml.cs]"]
  node_mainwindow["Main Window<br/>[MainWindow.xaml.cs]"]
end

subgraph group_sales["Sales Workflows"]
  node_pos["Point of Sale<br/>[PosPage.xaml.cs]"]
  node_sales_page["Sales History<br/>[SalesPage.xaml.cs]"]
  node_edit_sale["Edit Sale Dialog"]
  node_return_dialog["Partial Returns"]
end

subgraph group_inventory["Inventory Management"]
  node_products_page["Product Management"]
  node_product_dialog["Product Editor"]
  node_low_stock["Low Stock Alerts"]
end

subgraph group_reporting["Reporting and Sharing"]
  node_reports_page["Sales Reports"]
  node_pdf_helper["PDF Reports<br/>[Pdfhelper.cs]"]
  node_whatsapp_helper["WhatsApp Messages<br/>[Whatsapphelper.cs]"]
end

subgraph group_data["Data and Models"]
  node_sale_model["Sale Models<br/>[Sale.cs]"]
  node_product_model["Product Model<br/>[Product.cs]"]
  node_database["Database Operations<br/>[Database.cs]"]
  node_sqlite[("Local SQLite Store<br/>[pesticide_pos.db]")]
end

node_cashier(("Cashier / Staff"))
node_whatsapp["WhatsApp"]

node_cashier -->|"rings sales"| node_pos
node_cashier -->|"manages products"| node_products_page
node_cashier -->|"reviews invoices"| node_sales_page
node_cashier -->|"views reports"| node_reports_page
node_cashier -->|"checks alerts"| node_low_stock
node_startup -->|"initializes"| node_database
node_pos -->|"saves sales"| node_database
node_pos -->|"loads products"| node_database
node_pos -->|"builds sale"| node_sale_model
node_sales_page -->|"loads and changes sales"| node_database
node_sales_page -->|"opens editor"| node_edit_sale
node_sales_page -->|"opens return"| node_return_dialog
node_sales_page -->|"sends invoice"| node_whatsapp_helper
node_edit_sale -->|"updates sale"| node_database
node_return_dialog -->|"records return"| node_database
node_products_page -->|"product access"| node_database
node_product_dialog -->|"saves product"| node_database
node_product_dialog -->|"edits product"| node_product_model
node_low_stock -->|"loads low stock"| node_database
node_reports_page -->|"loads sales and products"| node_database
node_reports_page -->|"generates reports"| node_pdf_helper
node_reports_page -->|"builds report messages"| node_whatsapp_helper
node_whatsapp_helper -->|"opens message link"| node_whatsapp
node_database -->|"reads and writes"| node_product_model
node_database -->|"reads and writes"| node_sale_model
node_database -->|"persists records"| node_sqlite
node_pdf_helper -->|"formats sale data"| node_sale_model

click node_startup "https://github.com/abdallahfathii/cashir-app/blob/main/App.xaml.cs"
click node_mainwindow "https://github.com/abdallahfathii/cashir-app/blob/main/MainWindow.xaml.cs"
click node_pos "https://github.com/abdallahfathii/cashir-app/blob/main/PosPage.xaml.cs"
click node_sale_model "https://github.com/abdallahfathii/cashir-app/blob/main/Sale.cs"
click node_sales_page "https://github.com/abdallahfathii/cashir-app/blob/main/SalesPage.xaml.cs"
click node_edit_sale "https://github.com/abdallahfathii/cashir-app/blob/main/Editsaledialog.xaml.cs"
click node_return_dialog "https://github.com/abdallahfathii/cashir-app/blob/main/Returndialog.xaml.cs"
click node_products_page "https://github.com/abdallahfathii/cashir-app/blob/main/ProductsPage.xaml.cs"
click node_product_dialog "https://github.com/abdallahfathii/cashir-app/blob/main/ProductDialog.xaml.cs"
click node_low_stock "https://github.com/abdallahfathii/cashir-app/blob/main/LowStockPage.xaml.cs"
click node_product_model "https://github.com/abdallahfathii/cashir-app/blob/main/Product.cs"
click node_reports_page "https://github.com/abdallahfathii/cashir-app/blob/main/ReportsPage.xaml.cs"
click node_pdf_helper "https://github.com/abdallahfathii/cashir-app/blob/main/Pdfhelper.cs"
click node_whatsapp_helper "https://github.com/abdallahfathii/cashir-app/blob/main/Whatsapphelper.cs"
click node_database "https://github.com/abdallahfathii/cashir-app/blob/main/Database.cs"
click node_sqlite "https://github.com/abdallahfathii/cashir-app/blob/main/pesticide_pos.db"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_startup,node_mainwindow toneBlue
class node_pos,node_sales_page,node_edit_sale,node_return_dialog toneAmber
class node_products_page,node_product_dialog,node_low_stock toneMint
class node_reports_page,node_pdf_helper,node_whatsapp_helper toneRose
class node_sale_model,node_product_model,node_database,node_sqlite,node_cashier,node_whatsapp toneIndigo
```

## Components

### Application Shell

- [Application Startup](https://github.com/abdallahfathii/cashir-app/blob/main/App.xaml.cs): `App.xaml.cs`
- [Main Window](https://github.com/abdallahfathii/cashir-app/blob/main/MainWindow.xaml.cs): `MainWindow.xaml.cs`

### Sales Workflows

- [Point of Sale](https://github.com/abdallahfathii/cashir-app/blob/main/PosPage.xaml.cs): `PosPage.xaml.cs`
- [Sales History](https://github.com/abdallahfathii/cashir-app/blob/main/SalesPage.xaml.cs): `SalesPage.xaml.cs`
- [Edit Sale Dialog](https://github.com/abdallahfathii/cashir-app/blob/main/Editsaledialog.xaml.cs): `Editsaledialog.xaml.cs`
- [Partial Returns](https://github.com/abdallahfathii/cashir-app/blob/main/Returndialog.xaml.cs): `Returndialog.xaml.cs`

### Inventory Management

- [Product Management](https://github.com/abdallahfathii/cashir-app/blob/main/ProductsPage.xaml.cs): `ProductsPage.xaml.cs`
- [Product Editor](https://github.com/abdallahfathii/cashir-app/blob/main/ProductDialog.xaml.cs): `ProductDialog.xaml.cs`
- [Low Stock Alerts](https://github.com/abdallahfathii/cashir-app/blob/main/LowStockPage.xaml.cs): `LowStockPage.xaml.cs`

### Reporting and Sharing

- [Sales Reports](https://github.com/abdallahfathii/cashir-app/blob/main/ReportsPage.xaml.cs): `ReportsPage.xaml.cs`
- [PDF Reports](https://github.com/abdallahfathii/cashir-app/blob/main/Pdfhelper.cs): `Pdfhelper.cs`
- [WhatsApp Messages](https://github.com/abdallahfathii/cashir-app/blob/main/Whatsapphelper.cs): `Whatsapphelper.cs`

### Data and Models

- [Sale Models](https://github.com/abdallahfathii/cashir-app/blob/main/Sale.cs): `Sale.cs`
- [Product Model](https://github.com/abdallahfathii/cashir-app/blob/main/Product.cs): `Product.cs`
- [Database Operations](https://github.com/abdallahfathii/cashir-app/blob/main/Database.cs): `Database.cs`
- [Local SQLite Store](https://github.com/abdallahfathii/cashir-app/blob/main/pesticide_pos.db): `pesticide_pos.db`

### Other components

- **Cashier / Staff**
- **WhatsApp**

## Connections

- Cashier / Staff → Point of Sale: rings sales (evidence: `README.md`)
- Cashier / Staff → Product Management: manages products (evidence: `README.md`)
- Cashier / Staff → Sales History: reviews invoices (evidence: `README.md`)
- Cashier / Staff → Sales Reports: views reports (evidence: `README.md`)
- Cashier / Staff → Low Stock Alerts: checks alerts (evidence: `README.md`)
- Application Startup → Database Operations: initializes (evidence: `App.xaml.cs`)
- Point of Sale → Database Operations: saves sales (evidence: `PosPage.xaml.cs`)
- Point of Sale → Database Operations: loads products (evidence: `PosPage.xaml.cs`)
- Point of Sale → Sale Models: builds sale (evidence: `PosPage.xaml.cs`)
- Sales History → Database Operations: loads and changes sales (evidence: `SalesPage.xaml.cs`)
- Sales History → Edit Sale Dialog: opens editor (evidence: `SalesPage.xaml.cs`)
- Sales History → Partial Returns: opens return (evidence: `SalesPage.xaml.cs`)
- Sales History → WhatsApp Messages: sends invoice (evidence: `SalesPage.xaml.cs`)
- Edit Sale Dialog → Database Operations: updates sale (evidence: `Editsaledialog.xaml.cs`)
- Partial Returns → Database Operations: records return (evidence: `Returndialog.xaml.cs`)
- Product Management → Database Operations: product access (evidence: `ProductsPage.xaml.cs`)
- Product Editor → Database Operations: saves product (evidence: `ProductDialog.xaml.cs`)
- Product Editor → Product Model: edits product (evidence: `ProductDialog.xaml.cs`)
- Low Stock Alerts → Database Operations: loads low stock (evidence: `LowStockPage.xaml.cs`)
- Sales Reports → Database Operations: loads sales and products (evidence: `ReportsPage.xaml.cs`)
- Sales Reports → PDF Reports: generates reports (evidence: `ReportsPage.xaml.cs`)
- Sales Reports → WhatsApp Messages: builds report messages (evidence: `ReportsPage.xaml.cs`)
- WhatsApp Messages → WhatsApp: opens message link (evidence: `Whatsapphelper.cs`)
- Database Operations → Product Model: reads and writes (evidence: `Database.cs`)
- Database Operations → Sale Models: reads and writes (evidence: `Database.cs`)
- Database Operations → Local SQLite Store: persists records (evidence: `Database.cs`)
- PDF Reports → Sale Models: formats sale data (evidence: `Pdfhelper.cs`)
