Add issue/cancel lifecycle, GST derivation and integer-paise totals
issue_invoice allocates the number, freezes vendor and bank details and stores server-computed totals in one transaction. Issued invoices are cancelled, not deleted. Tax heads derive from supplier state and place of supply (a disagreeing choice is rejected); unregistered suppliers issue a plain Invoice. Adds GSTIN checksum validation, canonical India Compliance state list, server-side drafts, series validation, relative and magic-byte-checked asset paths, and GST settings. PDF re-exports use the frozen vendor snapshot.
This commit is contained in:
+11
-2
@@ -1,5 +1,6 @@
|
||||
mod commands;
|
||||
mod db;
|
||||
mod gst;
|
||||
mod models;
|
||||
|
||||
use rusqlite::Connection;
|
||||
@@ -46,6 +47,10 @@ fn init_state(app: &tauri::App) -> Result<AppState, Box<dyn std::error::Error>>
|
||||
return Err(e.into());
|
||||
}
|
||||
};
|
||||
if let Err(e) = db::relativize_asset_paths(&conn, &data_dir) {
|
||||
show_startup_error(app, &format!("Could not update stored image paths: {e}"), Some(&data_dir));
|
||||
return Err(e.into());
|
||||
}
|
||||
Ok(AppState {
|
||||
db: Mutex::new(conn),
|
||||
data_dir,
|
||||
@@ -96,10 +101,14 @@ pub fn run() {
|
||||
commands::clients::save_client,
|
||||
commands::clients::delete_client,
|
||||
commands::invoice::peek_next_invoice_number,
|
||||
commands::invoice::create_invoice,
|
||||
commands::invoice::issue_invoice,
|
||||
commands::invoice::cancel_invoice,
|
||||
commands::invoice::list_invoices,
|
||||
commands::invoice::get_invoice,
|
||||
commands::invoice::delete_invoice,
|
||||
commands::invoice::save_draft,
|
||||
commands::invoice::list_drafts,
|
||||
commands::invoice::get_draft,
|
||||
commands::invoice::delete_draft,
|
||||
commands::assets::import_asset,
|
||||
commands::assets::save_asset_bytes,
|
||||
commands::assets::read_asset_data_uri,
|
||||
|
||||
Reference in New Issue
Block a user