A comprehensive Windows desktop application for small business invoicing and client management built with WPF, C#, .NET 8, Entity Framework Core, and SQLite.
- Language: C# 10
- Framework: .NET 8 (Windows)
- UI: WPF (Windows Presentation Foundation)
- Database: SQLite (local file-based)
- ORM: Entity Framework Core 8.0
- PDF Generation: QuestPDF 2024.12.0
- Email: System.Net.Mail (built-in SMTP)
- Architecture: MVVM (Model-View-ViewModel)
- Dependency Injection: Microsoft.Extensions.DependencyInjection
-
Products & Services Management
- Add, edit, delete products/services
- Track name, description, unit price, tax rate, SKU
- Soft delete (mark as inactive)
-
Client Management
- Complete client database
- Company info, contacts, billing address, VAT numbers
- Track client invoices and statements
- Soft delete with invoice validation
-
Invoice Management
- Create, edit, delete invoices
- Auto-generate invoice numbers (configurable prefix + sequence)
- Line items with quantity, pricing, tax
- Invoice statuses: Draft, Sent, Paid, Overdue
- Duplicate existing invoices
- Calculated subtotals, tax, totals
-
Statement Generation
- Generate client statements for date ranges
- Opening/closing balances
- Invoice and payment tracking
- Save and edit statements
-
PDF Export
- Professional invoice PDFs
- Statement PDFs
- Company logo and branding
- Itemized tables with tax summary
- Customizable footer
-
Email Functionality
- Send invoices and statements via SMTP
- Configurable email templates
- PDF attachment
- Email tracking and logging
- Test email connection
-
Settings & Configuration
- Company profile (name, address, logo, contact info)
- Invoice numbering rules
- Default tax rates
- Email SMTP configuration
- Customizable templates
InvoiceApp/
├── Models/ # Entity models
│ ├── Product.cs
│ ├── Client.cs
│ ├── Invoice.cs
│ ├── InvoiceLineItem.cs
│ ├── Statement.cs
│ ├── AppSettings.cs
│ └── EmailLog.cs
├── Data/ # Database context
│ └── InvoiceDbContext.cs
├── Services/ # Business logic
│ ├── ProductService.cs
│ ├── ClientService.cs
│ ├── InvoiceService.cs
│ ├── StatementService.cs
│ ├── SettingsService.cs
│ ├── PdfService.cs
│ └── EmailService.cs
├── ViewModels/ # MVVM ViewModels
│ ├── ViewModelBase.cs
│ ├── RelayCommand.cs
│ ├── MainWindowViewModel.cs
│ ├── DashboardViewModel.cs
│ ├── InvoiceListViewModel.cs
│ ├── ClientListViewModel.cs
│ ├── ProductListViewModel.cs
│ ├── StatementListViewModel.cs
│ └── SettingsViewModel.cs
├── Views/ # WPF Views
│ ├── MainWindow.xaml
│ ├── DashboardView.xaml
│ ├── InvoiceListView.xaml (to be implemented)
│ ├── ClientListView.xaml (to be implemented)
│ ├── ProductListView.xaml (to be implemented)
│ ├── StatementListView.xaml (to be implemented)
│ ├── SettingsView.xaml (to be implemented)
│ └── [Dialog windows for edit operations]
├── App.xaml # Application entry point
├── App.xaml.cs # DI configuration
└── InvoiceApp.csproj # Project file
- Id, Name, Description, UnitPrice, TaxRate, Sku, IsActive, CreatedAt, UpdatedAt
- Id, CompanyName, ContactPerson, Email, Phone, BillingAddress, VatNumber, IsActive, CreatedAt, UpdatedAt
- Id, InvoiceNumber, ClientId, InvoiceDate, DueDate, Notes, PaymentTerms
- Subtotal, TaxAmount, Total, Status, SentDate, PaidDate, CreatedAt, UpdatedAt
- Id, InvoiceId, ProductId, Description, Quantity, UnitPrice, TaxRate, LineTotal, SortOrder
- Id, ClientId, StartDate, EndDate, OpeningBalance, ClosingBalance, CreatedAt, Notes
- Id, StatementId, InvoiceId, Date, Description, Debit, Credit, Balance, SortOrder
- Company profile settings
- Invoice configuration
- Email SMTP settings
- Templates
- Id, InvoiceId, StatementId, RecipientEmail, Subject, Body, Success, ErrorMessage, SentAt
- Windows 10 or Windows 11
- Visual Studio 2022 (Community, Professional, or Enterprise)
- .NET 8 SDK
-
Clone or Extract the Project
Extract InvoiceApp folder to your desired location -
Open in Visual Studio 2022
- Launch Visual Studio 2022
- File → Open → Project/Solution
- Navigate to
InvoiceApp.slnand open it
-
Restore NuGet Packages
- Visual Studio will automatically restore packages
- Or manually: Right-click Solution → Restore NuGet Packages
-
Build the Solution
- Build → Build Solution (Ctrl+Shift+B)
- Or F6
-
Run the Application
- Debug → Start Debugging (F5)
- Or Debug → Start Without Debugging (Ctrl+F5)
On first launch, the application will:
- Create the SQLite database in
%LocalAppData%\InvoiceApp\invoice.db - Initialize the database schema
- Seed default settings
The SQLite database is stored at:
C:\Users\[YourUsername]\AppData\Local\InvoiceApp\invoice.db
- Launch the application
- Go to Settings
- Configure:
- Company profile (name, address, logo, contact info)
- Invoice numbering (prefix, starting number)
- Default tax rate
- Email SMTP settings (for sending invoices)
- Navigate to "Products/Services"
- Click "Add Product" to create new products
- Edit or delete existing products
- Products can be selected when creating invoices
- Navigate to "Clients"
- Add client information
- Edit or view client details
- Cannot delete clients with existing invoices (will be marked inactive)
- Navigate to "Invoices"
- Click "Create Invoice"
- Select client
- Add line items (products/services)
- Set dates and payment terms
- Save as Draft or mark as Sent
- Generate PDF or email to client
- Navigate to "Statements"
- Click "Generate Statement"
- Select client and date range
- Review transactions and balances
- Save and/or export to PDF
- Configure SMTP settings in Settings
- Test email connection
- From invoice or statement, click "Send Email"
- Review/edit subject and body
- PDF is automatically attached
The application is designed for easy extension:
- New Entity: Add to Models folder, update DbContext, create service
- New View: Create XAML view, ViewModel, add to navigation
- New Service: Implement interface, register in App.xaml.cs DI
- New Report: Extend PdfService with new document template
Several views need XAML implementation:
- InvoiceListView.xaml
- ClientListView.xaml
- ProductListView.xaml
- StatementListView.xaml
- SettingsView.xaml
- Edit dialogs (ClientEditDialog, ProductEditDialog, InvoiceEditWindow, etc.)
Follow the DashboardView.xaml pattern:
- Create UserControl
- Bind to ViewModel properties
- Use DataGrid for lists
- Add command buttons
- Models: Data entities (Models folder)
- Views: XAML UI (Views folder)
- ViewModels: UI logic, data binding (ViewModels folder)
- Commands: RelayCommand, AsyncRelayCommand for user actions
- Services: Business logic (Services folder)
Services act as repositories, abstracting data access from ViewModels.
All services are registered in App.xaml.cs and injected via constructor injection.
- Database location:
%LocalAppData%\InvoiceApp\invoice.db - Delete database file to reset (will lose all data)
- Check file permissions
- Verify SMTP settings
- Check firewall/antivirus
- Use "Test Email Connection" in Settings
- Gmail requires "App Passwords" if 2FA is enabled
- Ensure .NET 8 SDK is installed
- Restore NuGet packages
- Clean and rebuild solution
Potential features for future versions:
- Multi-currency support
- Recurring invoices
- Payment recording and tracking
- Advanced reporting and analytics
- Data export (CSV, Excel)
- Backup and restore
- Multi-user support
- Cloud synchronization
- Mobile app integration
- Barcode/QR code generation
This application is provided as-is for use by small businesses.
For issues or questions:
- Check this README
- Review code comments
- Examine error messages and logs
- Complete MVVM architecture
- SQLite database with EF Core
- Product, Client, Invoice, Statement management
- PDF generation (QuestPDF)
- Email functionality (SMTP)
- Settings and configuration
- Clean, maintainable code structure