Initial commit: Voiced invoice desktop app
Offline-first invoicing app for Arun P, built by Bongbetic. - Tauri v2 (Rust) + React/TypeScript + IBM Carbon Design System UI - SQLite (rusqlite) storage with a persistent invoice-number series - Guided first-run setup, pre-filled vendor/bank details - Fixed-amount or rate x quantity line items (per sec/min/hour/session/unit) - GST as CGST+SGST or IGST, Indian amount-in-words - Optional signature, with a computer-generated note as fallback - Print-ready PDF export via @react-pdf/renderer - Windows cross-compile via cargo-xwin (NSIS installer) Co-authored-by: CommandCodeBot <noreply@commandcode.ai>
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
mod commands;
|
||||
mod db;
|
||||
mod models;
|
||||
|
||||
use rusqlite::Connection;
|
||||
use std::path::PathBuf;
|
||||
use std::sync::Mutex;
|
||||
use tauri::Manager;
|
||||
|
||||
pub struct AppState {
|
||||
pub db: Mutex<Connection>,
|
||||
pub data_dir: PathBuf,
|
||||
}
|
||||
|
||||
#[cfg_attr(mobile, tauri::mobile_entry_point)]
|
||||
pub fn run() {
|
||||
tauri::Builder::default()
|
||||
.plugin(tauri_plugin_opener::init())
|
||||
.plugin(tauri_plugin_dialog::init())
|
||||
.setup(|app| {
|
||||
let data_dir = app
|
||||
.path()
|
||||
.app_data_dir()
|
||||
.expect("could not resolve the application data directory");
|
||||
std::fs::create_dir_all(&data_dir).expect("could not create the application data directory");
|
||||
|
||||
let conn = db::open(&data_dir.join("voiced.db")).expect("could not open the database");
|
||||
app.manage(AppState {
|
||||
db: Mutex::new(conn),
|
||||
data_dir,
|
||||
});
|
||||
Ok(())
|
||||
})
|
||||
.invoke_handler(tauri::generate_handler![
|
||||
commands::settings::get_settings,
|
||||
commands::settings::save_settings,
|
||||
commands::settings::list_banks,
|
||||
commands::settings::save_bank,
|
||||
commands::settings::delete_bank,
|
||||
commands::series::get_active_series,
|
||||
commands::series::list_series,
|
||||
commands::series::start_new_series,
|
||||
commands::clients::list_clients,
|
||||
commands::clients::save_client,
|
||||
commands::clients::delete_client,
|
||||
commands::invoice::peek_next_invoice_number,
|
||||
commands::invoice::create_invoice,
|
||||
commands::invoice::list_invoices,
|
||||
commands::invoice::get_invoice,
|
||||
commands::invoice::delete_invoice,
|
||||
commands::assets::import_asset,
|
||||
commands::assets::save_asset_bytes,
|
||||
commands::assets::read_asset_data_uri,
|
||||
commands::assets::remove_asset,
|
||||
commands::assets::save_binary_file,
|
||||
])
|
||||
.run(tauri::generate_context!())
|
||||
.expect("error while running the Voiced application");
|
||||
}
|
||||
Reference in New Issue
Block a user