mirror of
https://github.com/itflow-org/itflow
synced 2026-02-28 19:04:52 +00:00
Invoices - Allow specifying discount during creation
This commit is contained in:
@@ -12,6 +12,8 @@ if (isset($_POST['add_invoice'])) {
|
||||
|
||||
$client_id = intval($_POST['client']);
|
||||
|
||||
$invoice_amount = 0 - $invoice_discount; // Calc amount if discount is applied, otherwise wrongly shows 0
|
||||
|
||||
// Get Net Terms
|
||||
$client_net_terms = intval(getFieldById('clients', $client_id, 'client_net_terms'));
|
||||
|
||||
@@ -23,7 +25,7 @@ if (isset($_POST['add_invoice'])) {
|
||||
//Generate a unique URL key for clients to access
|
||||
$url_key = randomString(156);
|
||||
|
||||
mysqli_query($mysqli,"INSERT INTO invoices SET invoice_prefix = '$config_invoice_prefix', invoice_number = $invoice_number, invoice_scope = '$scope', invoice_date = '$date', invoice_due = DATE_ADD('$date', INTERVAL $client_net_terms day), invoice_currency_code = '$session_company_currency', invoice_category_id = $category, invoice_status = 'Draft', invoice_url_key = '$url_key', invoice_client_id = $client_id");
|
||||
mysqli_query($mysqli,"INSERT INTO invoices SET invoice_prefix = '$config_invoice_prefix', invoice_number = $invoice_number, invoice_scope = '$scope', invoice_date = '$date', invoice_due = DATE_ADD('$date', INTERVAL $client_net_terms day), invoice_discount_amount = '$invoice_discount', invoice_amount = '$invoice_amount', invoice_currency_code = '$session_company_currency', invoice_category_id = $category, invoice_status = 'Draft', invoice_url_key = '$url_key', invoice_client_id = $client_id");
|
||||
|
||||
$invoice_id = mysqli_insert_id($mysqli);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user