diff --git a/accounts/accounts.php b/accounts/accounts.php index 3f8309d7..e5cec91d 100644 --- a/accounts/accounts.php +++ b/accounts/accounts.php @@ -71,7 +71,7 @@ function execute() $this->obj_form_ar->formname = "ar_invoice_quickselect"; $this->obj_form_ar->language = $_SESSION["user"]["lang"]; - $structure = form_helper_prepare_dropdownfromdb("id", "SELECT id, code_invoice as label FROM account_ar WHERE amount_total!=amount_paid ORDER BY code_invoice"); + $structure = form_helper_prepare_dropdownfromdb("id", "SELECT id, code_invoice as label FROM account_ar WHERE amount_total!=amount_paid AND cancelled=0 ORDER BY code_invoice"); if (count($structure["values"]) == 0) { @@ -105,7 +105,7 @@ function execute() // unpaid $sql_obj = New sql_query; - $sql_obj->string = "SELECT SUM(amount_total) as amount_total, SUM(amount_paid) as amount_paid FROM account_ar WHERE amount_total!=amount_paid"; + $sql_obj->string = "SELECT SUM(amount_total) as amount_total, SUM(amount_paid) as amount_paid FROM account_ar WHERE amount_total!=amount_paid AND cancelled=0"; $sql_obj->execute(); $sql_obj->fetch_array(); @@ -114,7 +114,7 @@ function execute() // overdue $sql_obj = New sql_query; - $sql_obj->string = "SELECT SUM(amount_total) as amount_total, SUM(amount_paid) as amount_paid FROM account_ar WHERE amount_total!=amount_paid AND date_due < '". date("Y-m-d") ."'"; + $sql_obj->string = "SELECT SUM(amount_total) as amount_total, SUM(amount_paid) as amount_paid FROM account_ar WHERE cancelled=0 AND amount_total!=amount_paid AND date_due < '". date("Y-m-d") ."'"; $sql_obj->execute(); $sql_obj->fetch_array(); diff --git a/accounts/ap/ap-credits.php b/accounts/ap/ap-credits.php new file mode 100644 index 00000000..93ccd485 --- /dev/null +++ b/accounts/ap/ap-credits.php @@ -0,0 +1,183 @@ +obj_table = New table; + + $this->obj_table->language = $_SESSION["user"]["lang"]; + $this->obj_table->tablename = "account_ap_credit_credit"; + + // define all the columns and structure + $this->obj_table->add_column("standard", "code_credit", "account_ap_credit.code_credit"); + $this->obj_table->add_column("standard", "code_ordernumber", "account_ap_credit.code_ordernumber"); + $this->obj_table->add_column("standard", "code_ponumber", "account_ap_credit.code_ponumber"); + $this->obj_table->add_column("standard", "name_vendor", "vendors.name_vendor"); + $this->obj_table->add_column("standard", "name_staff", "CONCAT_WS(' -- ', staff.staff_code, staff.name_staff)"); + $this->obj_table->add_column("date", "date_trans", "account_ap_credit.date_trans"); + $this->obj_table->add_column("price", "amount_tax", "account_ap_credit.amount_tax"); + $this->obj_table->add_column("price", "amount", "account_ap_credit.amount"); + $this->obj_table->add_column("price", "amount_total", "account_ap_credit.amount_total"); + + // totals + $this->obj_table->total_columns = array("amount_tax", "amount", "amount_total"); + + + // defaults + $this->obj_table->columns = array("code_credit", "name_vendor", "date_trans", "amount_total"); + $this->obj_table->columns_order = array("code_credit"); + $this->obj_table->columns_order_options = array("code_credit", "code_ordernumber", "code_ponumber", "name_vendor", "name_staff", "date_trans", "date_due", "sent"); + + // define SQL structure + $this->obj_table->sql_obj->prepare_sql_settable("account_ap_credit"); + $this->obj_table->sql_obj->prepare_sql_addfield("id", "account_ap_credit.id"); + $this->obj_table->sql_obj->prepare_sql_addjoin("LEFT JOIN vendors ON vendors.id = account_ap_credit.vendorid"); + $this->obj_table->sql_obj->prepare_sql_addjoin("LEFT JOIN staff ON staff.id = account_ap_credit.employeeid"); + + + // acceptable filter options + $structure = NULL; + $structure["fieldname"] = "date_start"; + $structure["type"] = "date"; + $structure["sql"] = "date_trans >= 'value'"; + $this->obj_table->add_filter($structure); + + $structure = NULL; + $structure["fieldname"] = "date_end"; + $structure["type"] = "date"; + $structure["sql"] = "date_trans <= 'value'"; + $this->obj_table->add_filter($structure); + + $structure = form_helper_prepare_dropdownfromdb("employeeid", "SELECT id, staff_code as label, name_staff as label1 FROM staff ORDER BY name_staff"); + $structure["sql"] = "account_ap_credit.employeeid='value'"; + $structure["options"]["search_filter"] = "enabled"; + $this->obj_table->add_filter($structure); + + $structure = form_helper_prepare_dropdownfromdb("vendorid", "SELECT id, code_vendor as label, name_vendor as label1 FROM vendors ORDER BY name_vendor"); + $structure["sql"] = "account_ap_credit.vendorid='value'"; + $structure["options"]["search_filter"] = "enabled"; + $this->obj_table->add_filter($structure); + + $structure = NULL; + $structure["fieldname"] = "credit_notes_search"; + $structure["type"] = "input"; + $structure["sql"] = "notes LIKE '%value%'"; + $this->obj_table->add_filter($structure); + + $structure = NULL; + $structure["fieldname"] = "hide_closed"; + $structure["type"] = "checkbox"; + $structure["options"]["label"] = "Hide Locked Credits"; + $structure["defaultvalue"] = "enabled"; + $structure["sql"] = "account_ap_credit.locked='0'"; + $this->obj_table->add_filter($structure); + + // load options + $this->obj_table->load_options_form(); + + + // fetch all the chart information + $this->obj_table->generate_sql(); + $this->obj_table->load_data_sql(); + + } + + + function render_html() + { + + // heading + print "
This page only displays credit notes which have yet to be completed, unless the \"Hide Paid Credits\" check box is unchecked.
"; + + // display options form + $this->obj_table->render_options_form(); + + // display table + if (!count($this->obj_table->columns)) + { + format_msgbox("important", "Please select some valid options to display.
"); + } + elseif (!$this->obj_table->data_num_rows) + { + $sql_obj = New sql_query; + $sql_obj->string = "SELECT id FROM account_ap_credit LIMIT 1"; + $sql_obj->execute(); + + if ($sql_obj->num_rows()) + { + format_msgbox("important", "Your current filter options do not match to any credit notes.
"); + } + else + { + format_msgbox("info", "You currently have no AP credit notes in your database.
"); + } + } + else + { + // details link + $structure = NULL; + $structure["id"]["column"] = "id"; + $this->obj_table->add_link("details", "accounts/ap/credit-view.php", $structure); + + + // items link + $structure = NULL; + $structure["id"]["column"] = "id"; + $this->obj_table->add_link("items", "accounts/ap/credit-items.php", $structure); + + // payments link + $structure = NULL; + $structure["id"]["column"] = "id"; + $this->obj_table->add_link("payments", "accounts/ap/credit-payments.php", $structure); + + + + // display the table + $this->obj_table->render_table_html(); + + // display CSV/PDF download link + print ""; + print ""; + } + } + + + function render_csv() + { + $this->obj_table->render_table_csv(); + } + + function render_pdf() + { + $this->obj_table->render_table_pdf(); + } + +} + +?> diff --git a/accounts/ap/ap.php b/accounts/ap/ap.php index d7482381..2a568e7b 100644 --- a/accounts/ap/ap.php +++ b/accounts/ap/ap.php @@ -44,13 +44,14 @@ function execute() $this->obj_table->add_column("price", "amount", "account_ap.amount"); $this->obj_table->add_column("price", "amount_total", "account_ap.amount_total"); $this->obj_table->add_column("price", "amount_paid", "account_ap.amount_paid"); + $this->obj_table->add_column("bool_tick", "closed", "(account_ap.amount_paid=account_ap.amount_total AND account_ap.amount_total>0)"); // totals $this->obj_table->total_columns = array("amount_tax", "amount", "amount_total", "amount_paid"); // defaults - $this->obj_table->columns = array("name_vendor", "code_invoice", "date_trans", "amount_total", "amount_paid"); + $this->obj_table->columns = array("name_vendor", "code_invoice", "date_trans", "amount_total", "amount_paid","closed"); $this->obj_table->columns_order = array("code_invoice"); $this->obj_table->columns_order_options = array("name_vendor", "code_invoice", "code_ordernumber", "code_ponumber", "name_staff", "date_trans", "date_due", "sent"); @@ -93,13 +94,11 @@ function execute() $structure = NULL; $structure["fieldname"] = "hide_closed"; $structure["type"] = "checkbox"; - $structure["options"]["label"] = "Hide Closed Invoices"; + $structure["options"]["label"] = "Hide Completed Invoices"; $structure["defaultvalue"] = "enabled"; - $structure["sql"] = "account_ap.amount_paid!=account_ap.amount_total"; + $structure["sql"] = "((account_ap.amount_paid<>account_ap.amount_total AND account_ap.amount_total>0) OR (account_ap.amount_total=0))"; $this->obj_table->add_filter($structure); - - // load options $this->obj_table->load_options_form(); @@ -158,6 +157,12 @@ function render_html() $structure["id"]["column"] = "id"; $this->obj_table->add_link("payments", "accounts/ap/invoice-payments.php", $structure); + // journal link + $structure = NULL; + $structure["id"]["column"] = "id"; + $this->obj_table->add_link("journal", "accounts/ap/journal.php", $structure); + + // display the table $this->obj_table->render_table_html(); diff --git a/accounts/ap/credit-add.php b/accounts/ap/credit-add.php new file mode 100644 index 00000000..17fe790a --- /dev/null +++ b/accounts/ap/credit-add.php @@ -0,0 +1,65 @@ +requires["javascript"][] = "include/vendors/javascript/populate_invoices_dropdown.js"; + } + + function check_permissions() + { + return user_permissions_get("accounts_ap_write"); + } + + + function check_requirements() + { + // nothing to check + return 1; + } + + + function execute() + { + + $vendor_id = @security_script_input('/^[0-9]*$/', $_GET["vendorid"]); + + $this->obj_form_credit = New credit_form_details; + $this->obj_form_credit->type = "ap_credit"; + $this->obj_form_credit->credit_id = 0; + $this->obj_form_credit->vendor_id = $vendor_id; + $this->obj_form_credit->processpage = "accounts/ap/credit-edit-process.php"; + + $this->obj_form_credit->execute(); + } + + function render_html() + { + // heading + print "This page provides features to allow you to create a new credit note for a vendor's invoice.
"; + + // display form + $this->obj_form_credit->render_html(); + } + +} + +?> diff --git a/accounts/ap/credit-delete-process.php b/accounts/ap/credit-delete-process.php new file mode 100644 index 00000000..596ad4c1 --- /dev/null +++ b/accounts/ap/credit-delete-process.php @@ -0,0 +1,39 @@ + diff --git a/accounts/ap/credit-delete.php b/accounts/ap/credit-delete.php new file mode 100644 index 00000000..4e812eb9 --- /dev/null +++ b/accounts/ap/credit-delete.php @@ -0,0 +1,94 @@ +id = @security_script_input('/^[0-9]*$/', $_GET["id"]); + + // define the navigiation menu + $this->obj_menu_nav = New menu_nav; + + $this->obj_menu_nav->add_item("Credit Details", "page=accounts/ap/credit-view.php&id=". $this->id .""); + $this->obj_menu_nav->add_item("Credit Items", "page=accounts/ap/credit-items.php&id=". $this->id .""); + $this->obj_menu_nav->add_item("Credit Payment/Refund", "page=accounts/ap/credit-payments.php&id=". $this->id .""); + $this->obj_menu_nav->add_item("Credit Journal", "page=accounts/ap/credit-journal.php&id=". $this->id .""); + $this->obj_menu_nav->add_item("Delete Credit", "page=accounts/ap/credit-delete.php&id=". $this->id ."", TRUE); + } + + + function check_permissions() + { + return user_permissions_get("accounts_ap_write"); + } + + + + function check_requirements() + { + // verify that the credit + $sql_obj = New sql_query; + $sql_obj->string = "SELECT id FROM account_ap_credit WHERE id='". $this->id ."' LIMIT 1"; + $sql_obj->execute(); + + if (!$sql_obj->num_rows()) + { + log_write("error", "page_output", "The requested credit note (". $this->id .") does not exist - possibly the credit note has been deleted."); + return 0; + } + + unset($sql_obj); + + + return 1; + } + + + function execute() + { + $this->obj_form_credit = New credit_form_delete; + $this->obj_form_credit->type = "ap_credit"; + $this->obj_form_credit->credit_id = $this->id; + $this->obj_form_credit->processpage = "accounts/ap/credit-delete-process.php"; + + $this->obj_form_credit->execute(); + } + + function render_html() + { + // heading + print "This page allows you to delete incorrect credit notes, provided that they have not been locked.
"; + + // display summary box + credit_render_summarybox("ap_credit", $this->id); + + // display form + $this->obj_form_credit->render_html(); + } + +} + + +?> diff --git a/accounts/ap/credit-edit-process.php b/accounts/ap/credit-edit-process.php new file mode 100644 index 00000000..27e85b7b --- /dev/null +++ b/accounts/ap/credit-edit-process.php @@ -0,0 +1,50 @@ + diff --git a/accounts/ap/credit-items-delete-process.php b/accounts/ap/credit-items-delete-process.php new file mode 100644 index 00000000..d396940f --- /dev/null +++ b/accounts/ap/credit-items-delete-process.php @@ -0,0 +1,41 @@ + diff --git a/accounts/ap/credit-items-edit-process.php b/accounts/ap/credit-items-edit-process.php new file mode 100644 index 00000000..6805306e --- /dev/null +++ b/accounts/ap/credit-items-edit-process.php @@ -0,0 +1,41 @@ + diff --git a/accounts/ap/credit-items-edit.php b/accounts/ap/credit-items-edit.php new file mode 100644 index 00000000..35d53ccf --- /dev/null +++ b/accounts/ap/credit-items-edit.php @@ -0,0 +1,279 @@ +requires["javascript"][] = "include/accounts/javascript/invoice-items-edit_ap.js"; + + // fetch variables + $this->id = @@security_script_input('/^[0-9]*$/', $_GET["id"]); + $this->itemid = @@security_script_input('/^[0-9]*$/', $_GET["itemid"]); + $this->item_type = @@security_script_input('/^[a-z]*$/', $_GET["type"]); + $this->invoice_item = @@security_script_input('/^[0-9]*$/', $_GET["invoice_item"]); + + // define the navigiation menu + $this->obj_menu_nav = New menu_nav; + + $this->obj_menu_nav->add_item("Credit Details", "page=accounts/ap/credit-view.php&id=". $this->id .""); + $this->obj_menu_nav->add_item("Credit Items", "page=accounts/ap/credit-items.php&id=". $this->id ."", TRUE); + $this->obj_menu_nav->add_item("Credit Payment/Refund", "page=accounts/ap/credit-payments.php&id=". $this->id .""); + $this->obj_menu_nav->add_item("Credit Journal", "page=accounts/ap/credit-journal.php&id=". $this->id .""); + $this->obj_menu_nav->add_item("Delete Credit", "page=accounts/ap/credit-delete.php&id=". $this->id .""); + } + + + + function check_permissions() + { + return user_permissions_get("accounts_ap_write"); + } + + + + function check_requirements() + { + // verify that the credit exists + $sql_obj = New sql_query; + $sql_obj->string = "SELECT id FROM account_ap_credit WHERE id='". $this->id ."' LIMIT 1"; + $sql_obj->execute(); + + if (!$sql_obj->num_rows()) + { + log_write("error", "page_output", "The requested credit note (". $this->id .") does not exist - possibly the credit note has been deleted."); + return 0; + } + + unset($sql_obj); + + + // verify that the item id supplied exists and fetch required information + if ($this->itemid) + { + $sql_obj = New sql_query; + $sql_obj->string = "SELECT id, type FROM account_items WHERE id='". $this->itemid ."' AND invoiceid='". $this->id ."' LIMIT 1"; + $sql_obj->execute(); + + if (!$sql_obj->num_rows()) + { + log_write("error", "page_output", "The requested item/credit combination does not exist. Are you trying to use a link to a deleted item?"); + return 0; + } + else + { + $sql_obj->fetch_array(); + + $this->item_type = $sql_obj->data[0]["type"]; + } + } + + return 1; + } + + + function execute() + { + /* + Generate Credit Item Form + */ + $this->obj_form_item = New invoice_form_item; + $this->obj_form_item->type = "ap_credit"; + $this->obj_form_item->invoiceid = $this->id; + $this->obj_form_item->itemid = $this->itemid; + $this->obj_form_item->item_type = "credit"; + $this->obj_form_item->processpage = "accounts/ap/credit-items-edit-process.php"; + + $this->obj_form_item->execute(); + + + + /* + Credit Information + */ + $this->credit = New credit; + $this->credit->id = $this->id; + $this->credit->type = "ap_credit"; + + $this->credit->load_data(); + + + /* + Fetch details for selected item and overwrite form (if an item is selected) + */ + + + + if ($this->invoice_item) + { + $sql_item_obj = New sql_query; + $sql_item_obj->string = "SELECT type, description, chartid, customid, amount FROM account_items WHERE id='". $this->invoice_item ."' LIMIT 1"; + $sql_item_obj->execute(); + + if ($sql_item_obj->num_rows()) + { + $sql_item_obj->fetch_array(); + + $description = "Credit for "; + + switch ($sql_item_obj->data[0]["type"]) + { + case "standard": + + $description .= sql_get_singlevalue("SELECT CONCAT_WS('--', code_chart, description) as value FROM account_charts WHERE id='". $sql_item_obj->data[0]["chartid"] ."' LIMIT 1"); + + // fetch taxes from account_items_options + $sql_tax_obj = New sql_query; + $sql_tax_obj->string = "SELECT option_value FROM account_items_options WHERE itemid='". $this->invoice_item ."'"; + $sql_tax_obj->execute(); + + if ($sql_tax_obj->num_rows()) + { + $sql_tax_obj->fetch_array(); + + foreach ($sql_tax_obj->data as $data_tax) + { + $this->obj_form_item->obj_form->structure["tax_". $data_tax["option_value"] ]["defaultvalue"] = "on"; + } + } + + unset($sql_tax_obj); + + break; + + case "time": + case "product": + $description .= sql_get_singlevalue("SELECT CONCAT_WS('--', code_product, name_product) as value FROM products WHERE id='". $sql_item_obj->data[0]["customid"] ."' LIMIT 1"); + + // fetch taxes from products + $sql_tax_obj = New sql_query; + $sql_tax_obj->string = "SELECT taxid FROM products_taxes WHERE productid='". $sql_item_obj->data[0]["customid"]."'"; + $sql_tax_obj->execute(); + + if ($sql_tax_obj->num_rows()) + { + $sql_tax_obj->fetch_array(); + + foreach ($sql_tax_obj->data as $data_tax) + { + $sql_cust_tax_obj = New sql_query; + $sql_cust_tax_obj->string = "SELECT id FROM vendors_taxes WHERE vendorid='". $this->credit->data["vendorid"] ."' AND taxid='". $data_tax["taxid"] ."'"; + $sql_cust_tax_obj->execute(); + + if ($sql_cust_tax_obj->num_rows()) + { + $this->obj_form_item->obj_form->structure["tax_". $data_tax["taxid"] ]["defaultvalue"] = "on"; + } + + unset($sql_cust_tax_obj); + } + } + + unset($sql_tax_obj); + + break; + + case "service": + case "service_usage": + $description .= sql_get_singlevalue("SELECT name_service as value FROM services WHERE id='". $sql_item_obj->data[0]["customid"] ."' LIMIT 1"); + + // fetch taxes from services + $sql_tax_obj = New sql_query; + $sql_tax_obj->string = "SELECT taxid FROM services_taxes WHERE serviceid='". $sql_item_obj->data[0]["customid"]."'"; + $sql_tax_obj->execute(); + + if ($sql_tax_obj->num_rows()) + { + $sql_tax_obj->fetch_array(); + + foreach ($sql_tax_obj->data as $data_tax) + { + $sql_cust_tax_obj = New sql_query; + $sql_cust_tax_obj->string = "SELECT id FROM vendors_taxes WHERE vendorid='". $this->credit->data["vendorid"] ."' AND taxid='". $data_tax["taxid"] ."'"; + $sql_cust_tax_obj->execute(); + + if ($sql_cust_tax_obj->num_rows()) + { + $this->obj_form_item->obj_form->structure["tax_". $data_tax["taxid"] ]["defaultvalue"] = "on"; + } + } + } + + unset($sql_tax_obj); + + + break; + + default: + $description .= "unknown item"; + break; + } + + $description .= " [". $sql_item_obj->data[0]["description"] ."]"; + } + else + { + // no such invoice item + log_write("error", "page", "The selected item does not appear to exist."); + } + + + /* + Add Data + */ + + $this->obj_form_item->obj_form->structure["amount"]["defaultvalue"] = $sql_item_obj->data[0]["amount"]; + $this->obj_form_item->obj_form->structure["chartid"]["defaultvalue"] = $sql_item_obj->data[0]["chartid"]; + $this->obj_form_item->obj_form->structure["description"]["defaultvalue"] = $description; + + } + else + { + log_write("debug", "page", "No invoice_item supplied, if an item is being edited, this will be OK."); + } + + + } + + + function render_html() + { + // title + summary + print "This page allows you to make changes to an credit item.
"; + + credit_render_summarybox("ap_credit", $this->id); + + $this->obj_form_item->render_html(); + } + +} + +?> diff --git a/accounts/ap/credit-items.php b/accounts/ap/credit-items.php new file mode 100644 index 00000000..9b61ea2c --- /dev/null +++ b/accounts/ap/credit-items.php @@ -0,0 +1,104 @@ +requires["css"][] = "include/accounts/css/invoice-items-edit.css"; + + // fetch variables + $this->id = @security_script_input('/^[0-9]*$/', $_GET["id"]); + + // define the navigiation menu + $this->obj_menu_nav = New menu_nav; + + $this->obj_menu_nav->add_item("Credit Details", "page=accounts/ap/credit-view.php&id=". $this->id .""); + $this->obj_menu_nav->add_item("Credit Items", "page=accounts/ap/credit-items.php&id=". $this->id ."", TRUE); + $this->obj_menu_nav->add_item("Credit Payment/Refund", "page=accounts/ap/credit-payments.php&id=". $this->id .""); + $this->obj_menu_nav->add_item("Credit Journal", "page=accounts/ap/credit-journal.php&id=". $this->id .""); + + if (user_permissions_get("accounts_ap_write")) + { + $this->obj_menu_nav->add_item("Delete Credit", "page=accounts/ap/credit-delete.php&id=". $this->id .""); + } + } + + + + function check_permissions() + { + return user_permissions_get("accounts_ap_view"); + } + + + + function check_requirements() + { + // verify that the credit + $sql_obj = New sql_query; + $sql_obj->string = "SELECT id FROM account_ap_credit WHERE id='". $this->id ."' LIMIT 1"; + $sql_obj->execute(); + + if (!$sql_obj->num_rows()) + { + log_write("error", "page_output", "The requested credit note (". $this->id .") does not exist - possibly the credit has been deleted."); + return 0; + } + + unset($sql_obj); + + + return 1; + } + + + function execute() + { + $this->obj_table_items = New invoice_list_items; + $this->obj_table_items->type = "ap_credit"; + $this->obj_table_items->invoiceid = $this->id; + $this->obj_table_items->page_view = "accounts/ap/credit-items-edit.php"; + $this->obj_table_items->page_delete = "accounts/ap/credit-items-delete-process.php"; + + $this->obj_table_items->execute(); + } + + function render_html() + { + // heading + print "This page shows all the items belonging to the credit and allows you to edit them.
"; + + // display summary box + credit_render_summarybox("ap_credit", $this->id); + + // display credit item box + credit_render_invoiceselect("ap_credit", $this->id, "accounts/ap/credit-items-edit.php"); + + // display form + $this->obj_table_items->render_html(); + } + +} + +?> diff --git a/accounts/ap/credit-journal-download-process.php b/accounts/ap/credit-journal-download-process.php new file mode 100644 index 00000000..c6bc4be5 --- /dev/null +++ b/accounts/ap/credit-journal-download-process.php @@ -0,0 +1,98 @@ +id = $fileid; + + $file_obj->load_data(); + $file_obj->filedata_render(); + + } + + +} // end of if logged in +else +{ + error_render_noperms(); + header("Location: ../../index.php?page=message.php"); + exit(0); +} + +?> diff --git a/accounts/ap/credit-journal-edit-process.php b/accounts/ap/credit-journal-edit-process.php new file mode 100644 index 00000000..a73032fe --- /dev/null +++ b/accounts/ap/credit-journal-edit-process.php @@ -0,0 +1,79 @@ +prepare_set_journalname("account_ap_credit"); + + // import form data + $journal->process_form_input(); + + + //// ERROR CHECKING /////////////////////// + + + // make sure the invoice ID submitted really exists + $sql_obj = New sql_query; + $sql_obj->string = "SELECT id FROM account_ap_credit WHERE id='". $journal->structure["customid"] ."'"; + $sql_obj->execute(); + + if (!$sql_obj->num_rows()) + { + $_SESSION["error"]["message"][] = "Unable to find requested credit note to modify journal for."; + } + + + /// if there was an error, go back to the entry page + if (isset($_SESSION["error"]["message"])) + { + $_SESSION["error"]["form"]["journal_edit"] = "failed"; + header("Location: ../../index.php?page=accounts/ap/credit-journal.php&id=". $journal->structure["customid"] ."&journalid=". $journal->structure["id"] ."&action=". $journal->structure["action"] .""); + exit(0); + } + else + { + if ($journal->structure["action"] == "delete") + { + $journal->action_delete(); + } + else + { + // update or create + $journal->action_update(); + } + + + // display updated details + header("Location: ../../index.php?page=accounts/ap/credit-journal.php&id=". $journal->structure["customid"] .""); + exit(0); + } + + ///////////////////////// + +} +else +{ + // user does not have perms to view this page/isn't logged on + error_render_noperms(); + header("Location: ../../index.php?page=message.php"); + exit(0); +} + + +?> diff --git a/accounts/ap/credit-journal-edit.php b/accounts/ap/credit-journal-edit.php new file mode 100644 index 00000000..a51dde7a --- /dev/null +++ b/accounts/ap/credit-journal-edit.php @@ -0,0 +1,142 @@ +id = @@security_script_input('/^[0-9]*$/', $_GET["id"]); + $this->journalid = @@security_script_input('/^[0-9]*$/', $_GET["journalid"]); + $this->action = @@security_script_input('/^[a-z]*$/', $_GET["action"]); + $this->type = @@security_script_input('/^[a-z]*$/', $_GET["type"]); + + + // define the navigiation menu + $this->obj_menu_nav = New menu_nav; + + $this->obj_menu_nav->add_item("Credit Details", "page=accounts/ap/credit-view.php&id=". $this->id .""); + $this->obj_menu_nav->add_item("Credit Items", "page=accounts/ap/credit-items.php&id=". $this->id .""); + $this->obj_menu_nav->add_item("Credit Payment/Refund", "page=accounts/ap/credit-payments.php&id=". $this->id .""); + $this->obj_menu_nav->add_item("Credit Journal", "page=accounts/ap/credit-journal.php&id=". $this->id ."", TRUE); + $this->obj_menu_nav->add_item("Delete Credit", "page=accounts/ap/credit-delete.php&id=". $this->id .""); + } + + + + function check_permissions() + { + return user_permissions_get("accounts_ap_write"); + } + + + + function check_requirements() + { + // verify that the invoice + $sql_obj = New sql_query; + $sql_obj->string = "SELECT id FROM account_ap_credit WHERE id='". $this->id ."' LIMIT 1"; + $sql_obj->execute(); + + if (!$sql_obj->num_rows()) + { + log_write("error", "page_output", "The requested credit note (". $this->id .") does not exist - possibly the credit has been deleted."); + return 0; + } + + unset($sql_obj); + + + return 1; + } + + + function execute() + { + + /* + Journal Forms + */ + + $this->obj_form_journal = New journal_input; + + // basic details of this entry + $this->obj_form_journal->prepare_set_journalname("account_ap_credit"); + $this->obj_form_journal->prepare_set_journalid($this->journalid); + $this->obj_form_journal->prepare_set_customid($this->id); + + // set the processing form + $this->obj_form_journal->prepare_set_form_process_page("accounts/ap/credit-journal-edit-process.php"); + } + + + function render_html() + { + if ($this->action == "delete") + { + print "This page allows you to delete an entry from the credit note journal.
"; + + // render delete form + $this->obj_form_journal->render_delete_form(); + + } + else + { + if ($this->type == "file") + { + // file uploader + if ($this->journalid) + { + print "This page allows you to attach a file to the credit note journal.
"; + } + else + { + print "This page allows you to attach a file to the credit note journal.
"; + } + + // edit or add file + $this->obj_form_journal->render_file_form(); + } + else + { + // default to text + if ($this->journalid) + { + print "This page allows you to edit an existing entry in the credit note journal.
"; + } + else + { + print "This page allows you to add an entry to the credit note journal.
"; + } + + // edit or add + $this->obj_form_journal->render_text_form(); + } + + } + } +} + +?> diff --git a/accounts/ap/credit-journal.php b/accounts/ap/credit-journal.php new file mode 100644 index 00000000..d871c91c --- /dev/null +++ b/accounts/ap/credit-journal.php @@ -0,0 +1,125 @@ +id = @security_script_input('/^[0-9]*$/', $_GET["id"]); + + // define the navigiation menu + $this->obj_menu_nav = New menu_nav; + + $this->obj_menu_nav->add_item("Credit Details", "page=accounts/ap/credit-view.php&id=". $this->id .""); + $this->obj_menu_nav->add_item("Credit Items", "page=accounts/ap/credit-items.php&id=". $this->id .""); + $this->obj_menu_nav->add_item("Credit Payment/Refund", "page=accounts/ap/credit-payments.php&id=". $this->id .""); + $this->obj_menu_nav->add_item("Credit Journal", "page=accounts/ap/credit-journal.php&id=". $this->id ."", TRUE); + + if (user_permissions_get("accounts_ap_write")) + { + $this->obj_menu_nav->add_item("Delete Credit", "page=accounts/ap/credit-delete.php&id=". $this->id .""); + } + } + + + + function check_permissions() + { + return user_permissions_get("accounts_ap_view"); + } + + + + function check_requirements() + { + // verify that the credit + $sql_obj = New sql_query; + $sql_obj->string = "SELECT id FROM account_ap_credit WHERE id='". $this->id ."' LIMIT 1"; + $sql_obj->execute(); + + if (!$sql_obj->num_rows()) + { + log_write("error", "page_output", "The requested credit (". $this->id .") does not exist - possibly the credit has been deleted."); + return 0; + } + + unset($sql_obj); + + + return 1; + } + + + function execute() + { + /* + Define the journal structure + */ + + // basic + $this->obj_journal = New journal_display; + $this->obj_journal->journalname = "account_ap_credit"; + + // set the pages to use for forms or file downloads + $this->obj_journal->prepare_set_form_process_page("accounts/ap/credit-journal-edit.php"); + $this->obj_journal->prepare_set_download_page("accounts/ap/credit-journal-download-process.php"); + + + // configure options form + $this->obj_journal->prepare_predefined_optionform(); + $this->obj_journal->add_fixed_option("id", $this->id); + + // load options + $this->obj_journal->load_options_form(); + + // define SQL structure + $this->obj_journal->sql_obj->prepare_sql_addwhere("customid='". $this->id ."'"); + + // process SQL + $this->obj_journal->generate_sql(); + $this->obj_journal->load_data(); + } + + + + + function render_html() + { + // Title + Summary + print "The journal is a place where you can put your own notes, files and view the history of this credit note.
"; + + if (user_permissions_get("accounts_ap_write")) + { + print "id ."\">Add new journal entry id ."\">Upload File
"; + } + else + { + format_msgbox("locked", "Note: your permissions limit you to read-only access to the journal
"); + } + + // display options form + $this->obj_journal->render_options_form(); + + // display the journal + $this->obj_journal->render_journal(); + } + +} + +?> diff --git a/accounts/ap/credit-payments-process.php b/accounts/ap/credit-payments-process.php new file mode 100644 index 00000000..aa627220 --- /dev/null +++ b/accounts/ap/credit-payments-process.php @@ -0,0 +1,39 @@ + diff --git a/accounts/ap/credit-payments.php b/accounts/ap/credit-payments.php new file mode 100644 index 00000000..2b64611b --- /dev/null +++ b/accounts/ap/credit-payments.php @@ -0,0 +1,99 @@ +requires["css"][] = "include/accounts/css/invoice-items-edit.css"; + + // fetch variables + $this->id = @security_script_input('/^[0-9]*$/', $_GET["id"]); + + // define the navigiation menu + $this->obj_menu_nav = New menu_nav; + + $this->obj_menu_nav->add_item("Credit Details", "page=accounts/ap/credit-view.php&id=". $this->id .""); + $this->obj_menu_nav->add_item("Credit Items", "page=accounts/ap/credit-items.php&id=". $this->id .""); + $this->obj_menu_nav->add_item("Credit Payment/Refund", "page=accounts/ap/credit-payments.php&id=". $this->id ."", TRUE); + $this->obj_menu_nav->add_item("Credit Journal", "page=accounts/ap/credit-journal.php&id=". $this->id .""); + + if (user_permissions_get("accounts_ap_write")) + { + $this->obj_menu_nav->add_item("Delete Credit", "page=accounts/ap/credit-delete.php&id=". $this->id .""); + } + } + + + + function check_permissions() + { + return user_permissions_get("accounts_ap_view"); + } + + + + function check_requirements() + { + // verify that the credit + $sql_obj = New sql_query; + $sql_obj->string = "SELECT id FROM account_ap_credit WHERE id='". $this->id ."' LIMIT 1"; + $sql_obj->execute(); + + if (!$sql_obj->num_rows()) + { + log_write("error", "page_output", "The requested credit note (". $this->id .") does not exist - possibly the credit has been deleted."); + return 0; + } + + unset($sql_obj); + + + return 1; + } + + + function execute() + { + $this->obj_form_credit = New credit_form_lock; + $this->obj_form_credit->type = "ap_credit"; + $this->obj_form_credit->credit_id = $this->id; + $this->obj_form_credit->processpage = "accounts/ap/credit-payments-process.php"; + + $this->obj_form_credit->execute(); + } + + function render_html() + { + // heading + print "This page allows you to lock credit notes to permanently apply the credit to the selected customer - once done, you can safely refund the customer via the customer's credit page.
"; + + // display summary box + credit_render_summarybox("ap_credit", $this->id); + + // display form + $this->obj_form_credit->render_html(); + } + + +} + +?> diff --git a/accounts/ap/credit-view.php b/accounts/ap/credit-view.php new file mode 100644 index 00000000..cdfbc7d3 --- /dev/null +++ b/accounts/ap/credit-view.php @@ -0,0 +1,97 @@ +id = @security_script_input('/^[0-9]*$/', $_GET["id"]); + + // define the navigiation menu + $this->obj_menu_nav = New menu_nav; + + $this->obj_menu_nav->add_item("Credit Details", "page=accounts/ap/credit-view.php&id=". $this->id ."", TRUE); + $this->obj_menu_nav->add_item("Credit Items", "page=accounts/ap/credit-items.php&id=". $this->id .""); + $this->obj_menu_nav->add_item("Credit Payment/Refund", "page=accounts/ap/credit-payments.php&id=". $this->id .""); + $this->obj_menu_nav->add_item("Credit Journal", "page=accounts/ap/credit-journal.php&id=". $this->id .""); + + if (user_permissions_get("accounts_ap_write")) + { + $this->obj_menu_nav->add_item("Delete Credit", "page=accounts/ap/credit-delete.php&id=". $this->id .""); + } + } + + + + function check_permissions() + { + return user_permissions_get("accounts_ap_view"); + } + + + + function check_requirements() + { + // verify that the credit + $sql_obj = New sql_query; + $sql_obj->string = "SELECT id FROM account_ap_credit WHERE id='". $this->id ."' LIMIT 1"; + $sql_obj->execute(); + + if (!$sql_obj->num_rows()) + { + log_write("error", "page_output", "The requested credit (". $this->id .") does not exist - possibly the credit has been deleted."); + return 0; + } + + unset($sql_obj); + + + return 1; + } + + + function execute() + { + $this->obj_form_credit = New credit_form_details; + $this->obj_form_credit->type = "ap_credit"; + $this->obj_form_credit->credit_id = $this->id; + $this->obj_form_credit->processpage = "accounts/ap/credit-edit-process.php"; + + $this->obj_form_credit->execute(); + } + + function render_html() + { + // heading + print "This page allows you to view the basic details of the credit. You can use the links in the green navigation menu above to change to different sections of the credit, in order to add items, payments or journal entries to the credit.
"; + + // display summary box + credit_render_summarybox("ap_credit", $this->id); + + // display form + $this->obj_form_credit->render_html(); + } + +} + +?> diff --git a/accounts/ap/invoice-bulk-payments.php b/accounts/ap/invoice-bulk-payments.php index 7355bca6..ca2af00d 100644 --- a/accounts/ap/invoice-bulk-payments.php +++ b/accounts/ap/invoice-bulk-payments.php @@ -14,7 +14,7 @@ class page_output var $obj_table; var $obj_form; - function page_output() + function __construct() { // requirements $this->requires["css"][] = "include/accounts/css/invoice-bulk-payments.css"; diff --git a/accounts/ap/invoice-delete.php b/accounts/ap/invoice-delete.php index 2087fb1e..eea73248 100644 --- a/accounts/ap/invoice-delete.php +++ b/accounts/ap/invoice-delete.php @@ -21,7 +21,7 @@ class page_output var $obj_form_invoice; - function page_output() + function __construct() { // fetch vapiables $this->id = @security_script_input('/^[0-9]*$/', $_GET["id"]); diff --git a/accounts/ap/invoice-items-edit.php b/accounts/ap/invoice-items-edit.php index 1ee8d2af..6d42f8eb 100644 --- a/accounts/ap/invoice-items-edit.php +++ b/accounts/ap/invoice-items-edit.php @@ -28,10 +28,10 @@ class page_output var $obj_form_item; - function page_output() + function __construct() { //require javascript file - $this->requires["javascript"][] = "include/accounts/javascript/invoice-items-edit.js"; + $this->requires["javascript"][] = "include/accounts/javascript/invoice-items-edit_ap.js"; // fetch vapiables $this->id = @security_script_input('/^[0-9]*$/', $_GET["id"]); diff --git a/accounts/ap/invoice-items.php b/accounts/ap/invoice-items.php index 8046d14b..38e0ca04 100644 --- a/accounts/ap/invoice-items.php +++ b/accounts/ap/invoice-items.php @@ -21,7 +21,7 @@ class page_output var $obj_table_items; - function page_output() + function __construct() { $this->requires["css"][] = "include/accounts/css/invoice-items-edit.css"; // fetch vapiables diff --git a/accounts/ap/invoice-payments-edit.php b/accounts/ap/invoice-payments-edit.php index 6b0d94ea..08fbf17f 100644 --- a/accounts/ap/invoice-payments-edit.php +++ b/accounts/ap/invoice-payments-edit.php @@ -27,7 +27,7 @@ class page_output var $obj_form_item; - function page_output() + function __construct() { // fetch variables $this->id = @security_script_input('/^[0-9]*$/', $_GET["id"]); diff --git a/accounts/ap/invoice-payments.php b/accounts/ap/invoice-payments.php index cfc30dbb..d1947d77 100644 --- a/accounts/ap/invoice-payments.php +++ b/accounts/ap/invoice-payments.php @@ -20,7 +20,7 @@ class page_output var $obj_table_payments; - function page_output() + function __construct() { // fetch vapiables $this->id = @security_script_input('/^[0-9]*$/', $_GET["id"]); diff --git a/accounts/ap/invoice-view.php b/accounts/ap/invoice-view.php index 329cb5d2..fba38436 100644 --- a/accounts/ap/invoice-view.php +++ b/accounts/ap/invoice-view.php @@ -26,7 +26,7 @@ class page_output var $obj_form_invoice; - function page_output() + function __construct() { // fetch vapiables $this->id = @security_script_input('/^[0-9]*$/', $_GET["id"]); diff --git a/accounts/ap/journal-edit-process.php b/accounts/ap/journal-edit-process.php index eb863549..89b2864b 100644 --- a/accounts/ap/journal-edit-process.php +++ b/accounts/ap/journal-edit-process.php @@ -40,7 +40,7 @@ /// if there was an error, go back to the entry page - if ($_SESSION["error"]["message"]) + if (isset($_SESSION["error"]["message"])) { $_SESSION["error"]["form"]["journal_edit"] = "failed"; header("Location: ../../index.php?page=accounts/ap/journal.php&id=". $journal->structure["customid"] ."&journalid=". $journal->structure["id"] ."&action=". $journal->structure["action"] .""); diff --git a/accounts/ap/journal-edit.php b/accounts/ap/journal-edit.php index 5ea88f32..04b5f0ea 100644 --- a/accounts/ap/journal-edit.php +++ b/accounts/ap/journal-edit.php @@ -20,7 +20,7 @@ class page_output var $obj_form_journal; - function page_output() + function __construct() { // fetch vapiables $this->id = @security_script_input('/^[0-9]*$/', $_GET["id"]); diff --git a/accounts/ap/journal.php b/accounts/ap/journal.php index 35e3c12c..7c194c9a 100644 --- a/accounts/ap/journal.php +++ b/accounts/ap/journal.php @@ -17,7 +17,7 @@ class page_output var $obj_journal; - function page_output() + function __construct() { // fetch vapiables $this->id = @security_script_input('/^[0-9]*$/', $_GET["id"]); @@ -113,6 +113,8 @@ function render_html() format_msgbox("locked", "Note: your permissions limit you to read-only access to the journal
"); } + + // display options form $this->obj_journal->render_options_form(); diff --git a/accounts/ar/account-statements.php b/accounts/ar/account-statements.php index 31481d5f..1f106825 100644 --- a/accounts/ar/account-statements.php +++ b/accounts/ar/account-statements.php @@ -15,7 +15,7 @@ class page_output var $obj_table; var $obj_form; - function page_output() + function __construct() { // requirements $this->requires["css"][] = "include/accounts/css/account-statements.css"; diff --git a/accounts/ar/ar.php b/accounts/ar/ar.php index bd494bfd..9bf68e64 100644 --- a/accounts/ar/ar.php +++ b/accounts/ar/ar.php @@ -46,13 +46,15 @@ function execute() $this->obj_table->add_column("price", "amount_total", "account_ar.amount_total"); $this->obj_table->add_column("price", "amount_paid", "account_ar.amount_paid"); $this->obj_table->add_column("bool_tick", "sent", "account_ar.sentmethod"); + $this->obj_table->add_column("bool_tick", "cancelled", "account_ar.cancelled"); + $this->obj_table->add_column("bool_tick", "closed", "(account_ar.amount_paid=account_ar.amount_total AND account_ar.amount_total>0)"); // totals $this->obj_table->total_columns = array("amount_tax", "amount", "amount_total", "amount_paid"); // defaults - $this->obj_table->columns = array("code_invoice", "name_customer", "date_trans", "amount_total", "amount_paid"); + $this->obj_table->columns = array("code_invoice", "name_customer", "date_trans", "amount_total", "amount_paid","closed"); $this->obj_table->columns_order = array("code_invoice"); $this->obj_table->columns_order_options = array("code_invoice", "code_ordernumber", "code_ponumber", "name_customer", "name_staff", "date_trans", "date_due", "sent"); @@ -93,13 +95,23 @@ function execute() $this->obj_table->add_filter($structure); $structure = NULL; - $structure["fieldname"] = "hide_closed"; - $structure["type"] = "checkbox"; - $structure["options"]["label"] = "Hide Closed Invoices"; - $structure["defaultvalue"] = "enabled"; - $structure["sql"] = "account_ar.amount_paid!=account_ar.amount_total"; + $structure["fieldname"] = "hide_closed"; + $structure["type"] = "checkbox"; + $structure["options"]["label"] = "Hide Completed Invoices"; + $structure["defaultvalue"] = "enabled"; + $structure["sql"] = "((account_ar.amount_paid<>account_ar.amount_total AND account_ar.amount_total>0) OR (account_ar.amount_total=0))"; $this->obj_table->add_filter($structure); - + + $structure = NULL; + $structure["fieldname"] = "hide_cancelled"; + $structure["type"] = "checkbox"; + $structure["options"]["label"] = "Hide Cancelled Invoices"; + $structure["options"]["no_fieldname"] = true; + $structure["options"]["no_shift"] = true; + $structure["defaultvalue"] = "enabled"; + $structure["sql"] = "account_ar.cancelled=0"; + $this->obj_table->add_filter($structure); + // load options $this->obj_table->load_options_form(); @@ -158,6 +170,15 @@ function render_html() $structure["id"]["column"] = "id"; $this->obj_table->add_link("payments", "accounts/ar/invoice-payments.php", $structure); + // journal link + $structure = NULL; + $structure["id"]["column"] = "id"; + $this->obj_table->add_link("journal", "accounts/ar/journal.php", $structure); + + // export link + $structure = NULL; + $structure["id"]["column"] = "id"; + $this->obj_table->add_link("export", "accounts/ar/invoice-export.php", $structure); diff --git a/accounts/ar/credit-add.php b/accounts/ar/credit-add.php index 27abd20d..04030a8b 100644 --- a/accounts/ar/credit-add.php +++ b/accounts/ar/credit-add.php @@ -18,7 +18,7 @@ class page_output var $obj_menu_nav; var $obj_form_credit; - function page_output() + function __construct() { $this->requires["javascript"][] = "include/customers/javascript/populate_invoices_dropdown.js"; } @@ -53,7 +53,7 @@ function execute() function render_html() { // heading - print "This page provides features to allow you to create a new credit note.
"; // display form diff --git a/accounts/ar/credit-delete.php b/accounts/ar/credit-delete.php index c1575903..0de87589 100644 --- a/accounts/ar/credit-delete.php +++ b/accounts/ar/credit-delete.php @@ -22,7 +22,7 @@ class page_output var $obj_form_credit; - function page_output() + function __construct() { // fetch variables $this->id = @security_script_input('/^[0-9]*$/', $_GET["id"]); diff --git a/accounts/ar/credit-export.php b/accounts/ar/credit-export.php index 5b51fbe4..9b96f703 100644 --- a/accounts/ar/credit-export.php +++ b/accounts/ar/credit-export.php @@ -21,7 +21,7 @@ class page_output var $obj_form_credit; - function page_output() + function __construct() { $this->requires["javascript"][] = "include/accounts/javascript/credit-export.js"; diff --git a/accounts/ar/credit-items-edit.php b/accounts/ar/credit-items-edit.php index d0696a22..9869f32d 100644 --- a/accounts/ar/credit-items-edit.php +++ b/accounts/ar/credit-items-edit.php @@ -29,10 +29,10 @@ class page_output var $obj_form_item; - function page_output() + function __construct() { //require javascript file - $this->requires["javascript"][] = "include/accounts/javascript/invoice-items-edit.js"; + $this->requires["javascript"][] = "include/accounts/javascript/invoice-items-edit_ar.js"; // fetch variables $this->id = @@security_script_input('/^[0-9]*$/', $_GET["id"]); diff --git a/accounts/ar/credit-items.php b/accounts/ar/credit-items.php index bd8ba9c1..137d0475 100644 --- a/accounts/ar/credit-items.php +++ b/accounts/ar/credit-items.php @@ -22,7 +22,7 @@ class page_output var $obj_table_items; - function page_output() + function __construct() { $this->requires["css"][] = "include/accounts/css/invoice-items-edit.css"; diff --git a/accounts/ar/credit-journal-edit-process.php b/accounts/ar/credit-journal-edit-process.php index adc5bf95..954b1ecf 100644 --- a/accounts/ar/credit-journal-edit-process.php +++ b/accounts/ar/credit-journal-edit-process.php @@ -40,7 +40,7 @@ /// if there was an error, go back to the entry page - if ($_SESSION["error"]["message"]) + if (isset($_SESSION["error"]["message"])) { $_SESSION["error"]["form"]["journal_edit"] = "failed"; header("Location: ../../index.php?page=accounts/ar/credit-journal.php&id=". $journal->structure["customid"] ."&journalid=". $journal->structure["id"] ."&action=". $journal->structure["action"] .""); diff --git a/accounts/ar/credit-journal-edit.php b/accounts/ar/credit-journal-edit.php index 794f8bc6..c3751df2 100644 --- a/accounts/ar/credit-journal-edit.php +++ b/accounts/ar/credit-journal-edit.php @@ -20,7 +20,7 @@ class page_output var $obj_form_journal; - function page_output() + function __construct() { // fetch variables $this->id = @@security_script_input('/^[0-9]*$/', $_GET["id"]); diff --git a/accounts/ar/credit-journal.php b/accounts/ar/credit-journal.php index 35f67946..679ce32a 100644 --- a/accounts/ar/credit-journal.php +++ b/accounts/ar/credit-journal.php @@ -17,7 +17,7 @@ class page_output var $obj_journal; - function page_output() + function __construct() { // fetch variables $this->id = @security_script_input('/^[0-9]*$/', $_GET["id"]); diff --git a/accounts/ar/credit-payments.php b/accounts/ar/credit-payments.php index ce1f6994..979929b7 100644 --- a/accounts/ar/credit-payments.php +++ b/accounts/ar/credit-payments.php @@ -20,7 +20,7 @@ class page_output var $obj_table_items; - function page_output() + function __construct() { $this->requires["css"][] = "include/accounts/css/invoice-items-edit.css"; diff --git a/accounts/ar/credit-view.php b/accounts/ar/credit-view.php index 0648ce18..f89a488b 100644 --- a/accounts/ar/credit-view.php +++ b/accounts/ar/credit-view.php @@ -21,7 +21,7 @@ class page_output var $obj_form_credit; - function page_output() + function __construct() { // fetch variables $this->id = @security_script_input('/^[0-9]*$/', $_GET["id"]); diff --git a/accounts/ar/invoice-bulk-payments.php b/accounts/ar/invoice-bulk-payments.php index ba9c4ac8..6f6f092b 100644 --- a/accounts/ar/invoice-bulk-payments.php +++ b/accounts/ar/invoice-bulk-payments.php @@ -14,7 +14,7 @@ class page_output var $obj_table; var $obj_form; - function page_output() + function __construct() { // requirements $this->requires["css"][] = "include/accounts/css/invoice-bulk-payments.css"; diff --git a/accounts/ar/invoice-delete.php b/accounts/ar/invoice-delete.php index 3a5e18fa..07019b03 100644 --- a/accounts/ar/invoice-delete.php +++ b/accounts/ar/invoice-delete.php @@ -21,7 +21,7 @@ class page_output var $obj_form_invoice; - function page_output() + function __construct() { // fetch variables $this->id = @security_script_input('/^[0-9]*$/', $_GET["id"]); @@ -34,7 +34,15 @@ function page_output() $this->obj_menu_nav->add_item("Invoice Payments", "page=accounts/ar/invoice-payments.php&id=". $this->id .""); $this->obj_menu_nav->add_item("Invoice Journal", "page=accounts/ar/journal.php&id=". $this->id .""); $this->obj_menu_nav->add_item("Export Invoice", "page=accounts/ar/invoice-export.php&id=". $this->id .""); - $this->obj_menu_nav->add_item("Delete Invoice", "page=accounts/ar/invoice-delete.php&id=". $this->id ."", TRUE); + if($GLOBALS["config"]["ACCOUNTS_CANCEL_DELETE"]=="1") + { + $title="Cancel Invoice"; + } + else + { + $title="Delete Invoice"; + } + $this->obj_menu_nav->add_item($title, "page=accounts/ar/invoice-delete.php&id=". $this->id ."",TRUE); } @@ -77,10 +85,18 @@ function execute() function render_html() { - // heading - print "This page allows you to delete incorrect invoices, provided that they have not been locked.
"; - + if($GLOBALS["config"]["ACCOUNTS_CANCEL_DELETE"]=="1") + { + // heading + print "This page allows you to cancel incorrect invoices, provided that they have not been locked.
"; + } + else + { + // heading + print "This page allows you to delete incorrect invoices, provided that they have not been locked.
"; + } // display summary box invoice_render_summarybox("ar", $this->id); diff --git a/accounts/ar/invoice-export.php b/accounts/ar/invoice-export.php index c8d8c2ed..047dc208 100644 --- a/accounts/ar/invoice-export.php +++ b/accounts/ar/invoice-export.php @@ -20,7 +20,7 @@ class page_output var $obj_form_invoice; - function page_output() + function __construct() { $this->requires["javascript"][] = "include/accounts/javascript/invoice-export.js"; @@ -36,9 +36,20 @@ function page_output() $this->obj_menu_nav->add_item("Invoice Journal", "page=accounts/ar/journal.php&id=". $this->id .""); $this->obj_menu_nav->add_item("Export Invoice", "page=accounts/ar/invoice-export.php&id=". $this->id ."", TRUE); - if (user_permissions_get("accounts_ar_write")) + if (user_permissions_get("accounts_ar_write") + && ((sql_get_singlevalue("SELECT cancelled as value FROM account_ar WHERE id='".$this->id."'")=='0' && $GLOBALS["config"]["ACCOUNTS_CANCEL_DELETE"]=="1") + || $GLOBALS["config"]["ACCOUNTS_CANCEL_DELETE"]=="0") + ) { - $this->obj_menu_nav->add_item("Delete Invoice", "page=accounts/ar/invoice-delete.php&id=". $this->id .""); + if($GLOBALS["config"]["ACCOUNTS_CANCEL_DELETE"]=="1") + { + $title="Cancel Invoice"; + } + else + { + $title="Delete Invoice"; + } + $this->obj_menu_nav->add_item($title, "page=accounts/ar/invoice-delete.php&id=". $this->id .""); } } diff --git a/accounts/ar/invoice-items-edit.php b/accounts/ar/invoice-items-edit.php index 0017952d..7197d43b 100644 --- a/accounts/ar/invoice-items-edit.php +++ b/accounts/ar/invoice-items-edit.php @@ -22,6 +22,7 @@ class page_output var $id; var $itemid; var $item_type; + var $productid; var $requires; var $obj_menu_nav; @@ -29,10 +30,10 @@ class page_output var $obj_form_item; - function page_output() + function __construct() { //require javascript file - $this->requires["javascript"][] = "include/accounts/javascript/invoice-items-edit.js"; + $this->requires["javascript"][] = "include/accounts/javascript/invoice-items-edit_ar.js"; // fetch variables $this->id = @@security_script_input('/^[0-9]*$/', $_GET["id"]); @@ -48,7 +49,22 @@ function page_output() $this->obj_menu_nav->add_item("Invoice Payments", "page=accounts/ar/invoice-payments.php&id=". $this->id .""); $this->obj_menu_nav->add_item("Invoice Journal", "page=accounts/ar/journal.php&id=". $this->id .""); $this->obj_menu_nav->add_item("Export Invoice", "page=accounts/ar/invoice-export.php&id=". $this->id .""); - $this->obj_menu_nav->add_item("Delete Invoice", "page=accounts/ar/invoice-delete.php&id=". $this->id .""); + + if (user_permissions_get("accounts_ar_write") + && ((sql_get_singlevalue("SELECT cancelled as value FROM account_ar WHERE id='".$this->id."'")=='0' && $GLOBALS["config"]["ACCOUNTS_CANCEL_DELETE"]=="1") + || $GLOBALS["config"]["ACCOUNTS_CANCEL_DELETE"]=="0") + ) + { + if($GLOBALS["config"]["ACCOUNTS_CANCEL_DELETE"]=="1") + { + $title="Cancel Invoice"; + } + else + { + $title="Delete Invoice"; + } + $this->obj_menu_nav->add_item($title, "page=accounts/ar/invoice-delete.php&id=". $this->id .""); + } } diff --git a/accounts/ar/invoice-items.php b/accounts/ar/invoice-items.php index 2e921951..ab8ddfd4 100644 --- a/accounts/ar/invoice-items.php +++ b/accounts/ar/invoice-items.php @@ -21,7 +21,7 @@ class page_output var $obj_table_items; - function page_output() + function __construct() { $this->requires["css"][] = "include/accounts/css/invoice-items-edit.css"; // fetch variables @@ -36,9 +36,20 @@ function page_output() $this->obj_menu_nav->add_item("Invoice Journal", "page=accounts/ar/journal.php&id=". $this->id .""); $this->obj_menu_nav->add_item("Export Invoice", "page=accounts/ar/invoice-export.php&id=". $this->id .""); - if (user_permissions_get("accounts_ar_write")) + if (user_permissions_get("accounts_ar_write") + && ((sql_get_singlevalue("SELECT cancelled as value FROM account_ar WHERE id='".$this->id."'")=='0' && $GLOBALS["config"]["ACCOUNTS_CANCEL_DELETE"]=="1") + || $GLOBALS["config"]["ACCOUNTS_CANCEL_DELETE"]=="0") + ) { - $this->obj_menu_nav->add_item("Delete Invoice", "page=accounts/ar/invoice-delete.php&id=". $this->id .""); + if($GLOBALS["config"]["ACCOUNTS_CANCEL_DELETE"]=="1") + { + $title="Cancel Invoice"; + } + else + { + $title="Delete Invoice"; + } + $this->obj_menu_nav->add_item($title, "page=accounts/ar/invoice-delete.php&id=". $this->id .""); } } diff --git a/accounts/ar/invoice-payments-edit.php b/accounts/ar/invoice-payments-edit.php index e2a7a215..2dc2f6c5 100644 --- a/accounts/ar/invoice-payments-edit.php +++ b/accounts/ar/invoice-payments-edit.php @@ -27,7 +27,7 @@ class page_output var $obj_form_item; - function page_output() + function __construct() { // fetch variables $this->id = @@security_script_input('/^[0-9]*$/', $_GET["id"]); @@ -41,7 +41,21 @@ function page_output() $this->obj_menu_nav->add_item("Invoice Payments", "page=accounts/ar/invoice-payments.php&id=". $this->id ."", TRUE); $this->obj_menu_nav->add_item("Invoice Journal", "page=accounts/ar/journal.php&id=". $this->id .""); $this->obj_menu_nav->add_item("Export Invoice", "page=accounts/ar/invoice-export.php&id=". $this->id .""); - $this->obj_menu_nav->add_item("Delete Invoice", "page=accounts/ar/invoice-delete.php&id=". $this->id .""); + if (user_permissions_get("accounts_ar_write") + && ((sql_get_singlevalue("SELECT cancelled as value FROM account_ar WHERE id='".$this->id."'")=='0' && $GLOBALS["config"]["ACCOUNTS_CANCEL_DELETE"]=="1") + || $GLOBALS["config"]["ACCOUNTS_CANCEL_DELETE"]=="0") + ) + { + if($GLOBALS["config"]["ACCOUNTS_CANCEL_DELETE"]=="1") + { + $title="Cancel Invoice"; + } + else + { + $title="Delete Invoice"; + } + $this->obj_menu_nav->add_item($title, "page=accounts/ar/invoice-delete.php&id=". $this->id .""); + } } diff --git a/accounts/ar/invoice-payments.php b/accounts/ar/invoice-payments.php index 6e1372b2..e9ffb72f 100644 --- a/accounts/ar/invoice-payments.php +++ b/accounts/ar/invoice-payments.php @@ -20,7 +20,7 @@ class page_output var $obj_table_payments; - function page_output() + function __construct() { // fetch variables $this->id = @security_script_input('/^[0-9]*$/', $_GET["id"]); @@ -34,9 +34,20 @@ function page_output() $this->obj_menu_nav->add_item("Invoice Journal", "page=accounts/ar/journal.php&id=". $this->id .""); $this->obj_menu_nav->add_item("Export Invoice", "page=accounts/ar/invoice-export.php&id=". $this->id .""); - if (user_permissions_get("accounts_ar_write")) + if (user_permissions_get("accounts_ar_write") + && ((sql_get_singlevalue("SELECT cancelled as value FROM account_ar WHERE id='".$this->id."'")=='0' && $GLOBALS["config"]["ACCOUNTS_CANCEL_DELETE"]=="1") + || $GLOBALS["config"]["ACCOUNTS_CANCEL_DELETE"]=="0") + ) { - $this->obj_menu_nav->add_item("Delete Invoice", "page=accounts/ar/invoice-delete.php&id=". $this->id .""); + if($GLOBALS["config"]["ACCOUNTS_CANCEL_DELETE"]=="1") + { + $title="Cancel Invoice"; + } + else + { + $title="Delete Invoice"; + } + $this->obj_menu_nav->add_item($title, "page=accounts/ar/invoice-delete.php&id=". $this->id .""); } } diff --git a/accounts/ar/invoice-view.php b/accounts/ar/invoice-view.php index 9e4eb8ba..9a991e80 100644 --- a/accounts/ar/invoice-view.php +++ b/accounts/ar/invoice-view.php @@ -20,7 +20,7 @@ class page_output var $obj_form_invoice; - function page_output() + function __construct() { // fetch variables $this->id = @security_script_input('/^[0-9]*$/', $_GET["id"]); @@ -34,9 +34,20 @@ function page_output() $this->obj_menu_nav->add_item("Invoice Journal", "page=accounts/ar/journal.php&id=". $this->id .""); $this->obj_menu_nav->add_item("Export Invoice", "page=accounts/ar/invoice-export.php&id=". $this->id .""); - if (user_permissions_get("accounts_ar_write")) + if (user_permissions_get("accounts_ar_write") + && ((sql_get_singlevalue("SELECT cancelled as value FROM account_ar WHERE id='".$this->id."'")=='0' && $GLOBALS["config"]["ACCOUNTS_CANCEL_DELETE"]=="1") + || $GLOBALS["config"]["ACCOUNTS_CANCEL_DELETE"]=="0") + ) { - $this->obj_menu_nav->add_item("Delete Invoice", "page=accounts/ar/invoice-delete.php&id=". $this->id .""); + if($GLOBALS["config"]["ACCOUNTS_CANCEL_DELETE"]=="1") + { + $title="Cancel Invoice"; + } + else + { + $title="Delete Invoice"; + } + $this->obj_menu_nav->add_item($title, "page=accounts/ar/invoice-delete.php&id=". $this->id .""); } } diff --git a/accounts/ar/journal-edit.php b/accounts/ar/journal-edit.php index b7cbb31d..f7961806 100644 --- a/accounts/ar/journal-edit.php +++ b/accounts/ar/journal-edit.php @@ -20,7 +20,7 @@ class page_output var $obj_form_journal; - function page_output() + function __construct() { // fetch variables $this->id = @@security_script_input('/^[0-9]*$/', $_GET["id"]); @@ -37,7 +37,22 @@ function page_output() $this->obj_menu_nav->add_item("Invoice Payments", "page=accounts/ar/invoice-payments.php&id=". $this->id .""); $this->obj_menu_nav->add_item("Invoice Journal", "page=accounts/ar/journal.php&id=". $this->id ."", TRUE); $this->obj_menu_nav->add_item("Export Invoice", "page=accounts/ar/invoice-export.php&id=". $this->id .""); - $this->obj_menu_nav->add_item("Delete Invoice", "page=accounts/ar/invoice-delete.php&id=". $this->id .""); + + if (user_permissions_get("accounts_ar_write") + && ((sql_get_singlevalue("SELECT cancelled as value FROM account_ar WHERE id='".$this->id."'")=='0' && $GLOBALS["config"]["ACCOUNTS_CANCEL_DELETE"]=="1") + || $GLOBALS["config"]["ACCOUNTS_CANCEL_DELETE"]=="0") + ) + { + if($GLOBALS["config"]["ACCOUNTS_CANCEL_DELETE"]=="1") + { + $title="Cancel Invoice"; + } + else + { + $title="Delete Invoice"; + } + $this->obj_menu_nav->add_item($title, "page=accounts/ar/invoice-delete.php&id=". $this->id .""); + } } diff --git a/accounts/ar/journal.php b/accounts/ar/journal.php index 6f26f678..3342680d 100644 --- a/accounts/ar/journal.php +++ b/accounts/ar/journal.php @@ -17,7 +17,7 @@ class page_output var $obj_journal; - function page_output() + function __construct() { // fetch variables $this->id = @security_script_input('/^[0-9]*$/', $_GET["id"]); @@ -31,9 +31,20 @@ function page_output() $this->obj_menu_nav->add_item("Invoice Journal", "page=accounts/ar/journal.php&id=". $this->id ."", TRUE); $this->obj_menu_nav->add_item("Export Invoice", "page=accounts/ar/invoice-export.php&id=". $this->id .""); - if (user_permissions_get("accounts_ar_write")) + if (user_permissions_get("accounts_ar_write") + && ((sql_get_singlevalue("SELECT cancelled as value FROM account_ar WHERE id='".$this->id."'")=='0' && $GLOBALS["config"]["ACCOUNTS_CANCEL_DELETE"]=="1") + || $GLOBALS["config"]["ACCOUNTS_CANCEL_DELETE"]=="0") + ) { - $this->obj_menu_nav->add_item("Delete Invoice", "page=accounts/ar/invoice-delete.php&id=". $this->id .""); + if($GLOBALS["config"]["ACCOUNTS_CANCEL_DELETE"]=="1") + { + $title="Cancel Invoice"; + } + else + { + $title="Delete Invoice"; + } + $this->obj_menu_nav->add_item($title, "page=accounts/ar/invoice-delete.php&id=". $this->id .""); } } diff --git a/accounts/charts/charts.php b/accounts/charts/charts.php index 2ea99e94..761b7557 100644 --- a/accounts/charts/charts.php +++ b/accounts/charts/charts.php @@ -66,6 +66,9 @@ function execute() if ($this->obj_table->data[$i]["chart_type"] == "Heading") { $this->obj_table->data[$i]["options"]["css_class"] = "chart_heading"; + $this->obj_table->data[$i]["chart_type"] =""; + $this->obj_table->data[$i]["description"]="". $this->obj_table->data[$i]["description"] .""; + $this->obj_table->data[$i]["code_chart"]="". $this->obj_table->data[$i]["code_chart"] .""; } } @@ -132,16 +135,18 @@ function render_html() } else { - // view link - $structure = NULL; - $structure["id"]["column"] = "id"; - $this->obj_table->add_link("view", "accounts/charts/view.php", $structure); // ledger link $structure = NULL; $structure["id"]["column"] = "id"; + $structure["logic"]["if"]["column"] = "chart_type"; $this->obj_table->add_link("ledger", "accounts/charts/ledger.php", $structure); + // view link + $structure = NULL; + $structure["id"]["column"] = "id"; + $this->obj_table->add_link("view", "accounts/charts/view.php", $structure); + // display the table $this->obj_table->render_table_html(); diff --git a/accounts/charts/delete.php b/accounts/charts/delete.php index 10bf0b2d..de94bbf0 100644 --- a/accounts/charts/delete.php +++ b/accounts/charts/delete.php @@ -22,7 +22,7 @@ class page_output var $locked; - function page_output() + function __construct() { // fetch variables $this->id = @security_script_input('/^[0-9]*$/', $_GET["id"]); diff --git a/accounts/charts/ledger.php b/accounts/charts/ledger.php index 9c198aa7..b8c02e20 100644 --- a/accounts/charts/ledger.php +++ b/accounts/charts/ledger.php @@ -20,7 +20,7 @@ class page_output var $obj_ledger; - function page_output() + function __construct() { // fetch variables $this->id = @security_script_input('/^[0-9]*$/', $_GET["id"]); diff --git a/accounts/charts/view.php b/accounts/charts/view.php index 32b687a3..650253d8 100644 --- a/accounts/charts/view.php +++ b/accounts/charts/view.php @@ -19,7 +19,7 @@ class page_output var $chart_type; // hold the ID of the chart type - function page_output() + function __construct() { // fetch variables $this->id = @security_script_input('/^[0-9]*$/', $_GET["id"]); @@ -28,7 +28,12 @@ function page_output() $this->obj_menu_nav = New menu_nav; $this->obj_menu_nav->add_item("Account Details", "page=accounts/charts/view.php&id=". $this->id ."", TRUE); - $this->obj_menu_nav->add_item("Account Ledger", "page=accounts/charts/ledger.php&id=". $this->id .""); + + $isheading= sql_get_singlevalue("SELECT (VALUE='Heading') as value FROM account_chart_type LEFT JOIN account_charts ON account_chart_type.id = account_charts.chart_type WHERE account_charts.id ='". $this->id ."'"); + if(!$isheading) + { + $this->obj_menu_nav->add_item("Account Ledger", "page=accounts/charts/ledger.php&id=". $this->id .""); + } if (user_permissions_get("accounts_charts_write")) { diff --git a/accounts/gl/delete.php b/accounts/gl/delete.php index ee9cf0ba..eee6880a 100644 --- a/accounts/gl/delete.php +++ b/accounts/gl/delete.php @@ -18,7 +18,7 @@ class page_output var $locked; - function page_output() + function __construct() { // fetch variables $this->id = @security_script_input('/^[0-9]*$/', $_GET["id"]); diff --git a/accounts/gl/view.php b/accounts/gl/view.php index 5db98796..024b1495 100644 --- a/accounts/gl/view.php +++ b/accounts/gl/view.php @@ -22,7 +22,7 @@ class page_output var $num_trans; - function page_output() + function __construct() { // define page dependencies $this->requires["javascript"][] = "include/accounts/javascript/gl.js"; diff --git a/accounts/import/bankstatement-assign.php b/accounts/import/bankstatement-assign.php index 65639750..d3042184 100644 --- a/accounts/import/bankstatement-assign.php +++ b/accounts/import/bankstatement-assign.php @@ -20,7 +20,7 @@ class page_output var $obj_form; - function page_output() + function __construct() { $this->requires["javascript"][] = "include/accounts/javascript/import.js"; $this->requires["css"][] = "include/accounts/css/bankstatement-assign.css"; diff --git a/accounts/import/bankstatement-csv.php b/accounts/import/bankstatement-csv.php index a9789bb9..624c5647 100644 --- a/accounts/import/bankstatement-csv.php +++ b/accounts/import/bankstatement-csv.php @@ -15,7 +15,7 @@ class page_output var $example_array; - function page_output() + function __construct() { $this->requires["javascript"][] = "include/accounts/javascript/import.js"; $this->requires["css"][] = "include/accounts/css/bankstatement-csv.css"; diff --git a/accounts/quotes/journal-edit.php b/accounts/quotes/journal-edit.php index 2f22eae0..d497626b 100644 --- a/accounts/quotes/journal-edit.php +++ b/accounts/quotes/journal-edit.php @@ -19,7 +19,7 @@ class page_output var $obj_form_journal; - function page_output() + function __construct() { // fetch quote ID $this->id = @security_script_input('/^[0-9]*$/', $_GET["id"]); @@ -35,6 +35,7 @@ function page_output() $this->obj_menu_nav->add_item("Quote Items", "page=accounts/quotes/quotes-items.php&id=". $this->id .""); $this->obj_menu_nav->add_item("Quote Journal", "page=accounts/quotes/journal.php&id=". $this->id ."", TRUE); $this->obj_menu_nav->add_item("Export Quote", "page=accounts/quotes/quotes-export.php&id=". $this->id .""); + $this->obj_menu_nav->add_item("Create Project", "page=accounts/quotes/quotes-convert-project.php&id=". $this->id .""); $this->obj_menu_nav->add_item("Convert to Invoice", "page=accounts/quotes/quotes-convert.php&id=". $this->id .""); $this->obj_menu_nav->add_item("Delete Quote", "page=accounts/quotes/quotes-delete.php&id=". $this->id .""); } diff --git a/accounts/quotes/journal.php b/accounts/quotes/journal.php index 6931213a..98fd6d1e 100644 --- a/accounts/quotes/journal.php +++ b/accounts/quotes/journal.php @@ -18,7 +18,7 @@ class page_output var $obj_journal; - function page_output() + function __construct() { // fetch quote ID $this->id = @security_script_input('/^[0-9]*$/', $_GET["id"]); @@ -33,6 +33,7 @@ function page_output() if (user_permissions_get("accounts_quotes_write")) { + $this->obj_menu_nav->add_item("Create Project", "page=accounts/quotes/quotes-convert-project.php&id=". $this->id .""); $this->obj_menu_nav->add_item("Convert to Invoice", "page=accounts/quotes/quotes-convert.php&id=". $this->id .""); $this->obj_menu_nav->add_item("Delete Quote", "page=accounts/quotes/quotes-delete.php&id=". $this->id .""); } diff --git a/accounts/quotes/quotes-convert-project.php b/accounts/quotes/quotes-convert-project.php new file mode 100644 index 00000000..40df4f14 --- /dev/null +++ b/accounts/quotes/quotes-convert-project.php @@ -0,0 +1,130 @@ +id = @security_script_input('/^[0-9]*$/', $_GET["id"]); + + // define the navigiation menu + $this->obj_menu_nav = New menu_nav; + + $this->obj_menu_nav->add_item("Quote Details", "page=accounts/quotes/quotes-view.php&id=". $this->id .""); + $this->obj_menu_nav->add_item("Quote Items", "page=accounts/quotes/quotes-items.php&id=". $this->id .""); + $this->obj_menu_nav->add_item("Quote Journal", "page=accounts/quotes/journal.php&id=". $this->id .""); + $this->obj_menu_nav->add_item("Export Quote", "page=accounts/quotes/quotes-export.php&id=". $this->id .""); + $this->obj_menu_nav->add_item("Create Project", "page=accounts/quotes/quotes-convert-project.php&id=". $this->id ."",TRUE); + $this->obj_menu_nav->add_item("Convert to Invoice", "page=accounts/quotes/quotes-convert.php&id=". $this->id .""); + $this->obj_menu_nav->add_item("Delete Quote", "page=accounts/quotes/quotes-delete.php&id=". $this->id .""); + } + + function check_permissions() + { + return user_permissions_get("projects_write"); + } + + function check_requirements() + { + // nothing todo + return 1; + } + + + function execute() + { + /* + Define form structure + */ + $this->obj_form = New form_input; + $this->obj_form->formname = "project_add"; + $this->obj_form->language = $_SESSION["user"]["lang"]; + + $this->obj_form->action = "projects/edit-process.php"; + $this->obj_form->method = "post"; + + + // general + $structure = NULL; + $structure["fieldname"] = "name_project"; + $structure["type"] = "input"; + $structure["options"]["req"] = "yes"; + $this->obj_form->add_input($structure); + + $structure = NULL; + $structure["fieldname"] = "code_project"; + $structure["type"] = "input"; + $this->obj_form->add_input($structure); + + $structure = NULL; + $structure["fieldname"] = "project_quote"; + $structure["type"] = "input"; + $structure["defaultvalue"] = sql_get_singlevalue("SELECT code_quote as value FROM account_quotes WHERE id=".$this->id); + $this->obj_form->add_input($structure); + + $structure = NULL; + $structure["fieldname"] = "date_start"; + $structure["type"] = "date"; + $structure["defaultvalue"] = date("Y-m-d"); + $structure["options"]["req"] = "yes"; + $this->obj_form->add_input($structure); + + $structure = NULL; + $structure["fieldname"] = "date_end"; + $structure["type"] = "date"; + $this->obj_form->add_input($structure); + + $structure = NULL; + $structure["fieldname"] = "internal_only"; + $structure["type"] = "checkbox"; + $structure["options"]["label"] = "This is an internal project - do not alert to unbilled hours"; + $this->obj_form->add_input($structure); + + $structure = NULL; + $structure["fieldname"] = "details"; + $structure["type"] = "textarea"; + $this->obj_form->add_input($structure); + + + // submit button + $structure = NULL; + $structure["fieldname"] = "submit"; + $structure["type"] = "submit"; + $structure["defaultvalue"] = "Create Project"; + $this->obj_form->add_input($structure); + + + // define subforms + $this->obj_form->subforms["project_view"] = array("code_project", "name_project", "project_quote", "date_start", "date_end", "internal_only", "details"); + $this->obj_form->subforms["submit"] = array("submit"); + + // load any data returned due to errors + $this->obj_form->load_data_error(); + + } + + function render_html() + { + // Title + Summary + print "This page allows you to add a new project.
"; + + + // display the form + $this->obj_form->render_form(); + } + +} + +?> diff --git a/accounts/quotes/quotes-convert.php b/accounts/quotes/quotes-convert.php index 1b8795d9..13690524 100644 --- a/accounts/quotes/quotes-convert.php +++ b/accounts/quotes/quotes-convert.php @@ -20,7 +20,7 @@ class page_output var $obj_form_quote; - function page_output() + function __construct() { // fetch quote ID $this->id = @security_script_input('/^[0-9]*$/', $_GET["id"]); @@ -32,6 +32,7 @@ function page_output() $this->obj_menu_nav->add_item("Quote Items", "page=accounts/quotes/quotes-items.php&id=". $this->id .""); $this->obj_menu_nav->add_item("Quote Journal", "page=accounts/quotes/journal.php&id=". $this->id .""); $this->obj_menu_nav->add_item("Export Quote", "page=accounts/quotes/quotes-export.php&id=". $this->id .""); + $this->obj_menu_nav->add_item("Create Project", "page=accounts/quotes/quotes-convert-project.php&id=". $this->id .""); $this->obj_menu_nav->add_item("Convert to Invoice", "page=accounts/quotes/quotes-convert.php&id=". $this->id ."", TRUE); $this->obj_menu_nav->add_item("Delete Quote", "page=accounts/quotes/quotes-delete.php&id=". $this->id .""); } diff --git a/accounts/quotes/quotes-delete.php b/accounts/quotes/quotes-delete.php index 797a9d92..a6fcc269 100644 --- a/accounts/quotes/quotes-delete.php +++ b/accounts/quotes/quotes-delete.php @@ -19,7 +19,7 @@ class page_output var $obj_form_quote; - function page_output() + function __construct() { // fetch quote ID $this->id = @security_script_input('/^[0-9]*$/', $_GET["id"]); @@ -31,6 +31,7 @@ function page_output() $this->obj_menu_nav->add_item("Quote Items", "page=accounts/quotes/quotes-items.php&id=". $this->id .""); $this->obj_menu_nav->add_item("Quote Journal", "page=accounts/quotes/journal.php&id=". $this->id .""); $this->obj_menu_nav->add_item("Export Quote", "page=accounts/quotes/quotes-export.php&id=". $this->id .""); + $this->obj_menu_nav->add_item("Create Project", "page=accounts/quotes/quotes-convert-project.php&id=". $this->id .""); $this->obj_menu_nav->add_item("Convert to Invoice", "page=accounts/quotes/quotes-convert.php&id=". $this->id .""); $this->obj_menu_nav->add_item("Delete Quote", "page=accounts/quotes/quotes-delete.php&id=". $this->id ."", TRUE); } diff --git a/accounts/quotes/quotes-export.php b/accounts/quotes/quotes-export.php index 076c2881..ad882679 100644 --- a/accounts/quotes/quotes-export.php +++ b/accounts/quotes/quotes-export.php @@ -21,7 +21,7 @@ class page_output var $obj_form_invoice; - function page_output() + function __construct() { // fetch variables $this->id = @security_script_input('/^[0-9]*$/', $_GET["id"]); @@ -36,6 +36,7 @@ function page_output() if (user_permissions_get("accounts_quotes_write")) { + $this->obj_menu_nav->add_item("Create Project", "page=accounts/quotes/quotes-convert-project.php&id=". $this->id .""); $this->obj_menu_nav->add_item("Convert to Invoice", "page=accounts/quotes/quotes-convert.php&id=". $this->id .""); $this->obj_menu_nav->add_item("Delete Quote", "page=accounts/quotes/quotes-delete.php&id=". $this->id .""); } diff --git a/accounts/quotes/quotes-items-edit.php b/accounts/quotes/quotes-items-edit.php index 41d91810..db3e5fce 100644 --- a/accounts/quotes/quotes-items-edit.php +++ b/accounts/quotes/quotes-items-edit.php @@ -28,10 +28,10 @@ class page_output var $obj_form_item; - function page_output() + function __construct() { //require javascript file - $this->requires["javascript"][] = "include/accounts/javascript/invoice-items-edit.js"; + $this->requires["javascript"][] = "include/accounts/javascript/invoice-items-edit_ar.js"; // fetch vapiables $this->id = @security_script_input('/^[0-9]*$/', $_GET["id"]); @@ -46,6 +46,7 @@ function page_output() $this->obj_menu_nav->add_item("Quote Items", "page=accounts/quotes/quotes-items.php&id=". $this->id ."", TRUE); $this->obj_menu_nav->add_item("Quote Journal", "page=accounts/quotes/journal.php&id=". $this->id .""); $this->obj_menu_nav->add_item("Export Quote", "page=accounts/quotes/quotes-export.php&id=". $this->id .""); + $this->obj_menu_nav->add_item("Create Project", "page=accounts/quotes/quotes-convert-project.php&id=". $this->id .""); $this->obj_menu_nav->add_item("Convert to Invoice", "page=accounts/quotes/quotes-convert.php&id=". $this->id .""); $this->obj_menu_nav->add_item("Delete Quote", "page=accounts/quotes/quotes-delete.php&id=". $this->id .""); diff --git a/accounts/quotes/quotes-items.php b/accounts/quotes/quotes-items.php index b2a1b2ef..294db685 100644 --- a/accounts/quotes/quotes-items.php +++ b/accounts/quotes/quotes-items.php @@ -22,7 +22,7 @@ class page_output var $obj_table_items; - function page_output() + function __construct() { $this->requires["css"][] = "include/accounts/css/invoice-items-edit.css"; // fetch quote ID @@ -38,6 +38,7 @@ function page_output() if (user_permissions_get("accounts_quotes_write")) { + $this->obj_menu_nav->add_item("Create Project", "page=accounts/quotes/quotes-convert-project.php&id=". $this->id .""); $this->obj_menu_nav->add_item("Convert to Invoice", "page=accounts/quotes/quotes-convert.php&id=". $this->id .""); $this->obj_menu_nav->add_item("Delete Quote", "page=accounts/quotes/quotes-delete.php&id=". $this->id .""); } diff --git a/accounts/quotes/quotes-view.php b/accounts/quotes/quotes-view.php index 0e15b068..0933e990 100644 --- a/accounts/quotes/quotes-view.php +++ b/accounts/quotes/quotes-view.php @@ -20,7 +20,7 @@ class page_output var $obj_form_quote; - function page_output() + function __construct() { // fetch quote ID $this->id = @security_script_input('/^[0-9]*$/', $_GET["id"]); @@ -35,6 +35,7 @@ function page_output() if (user_permissions_get("accounts_quotes_write")) { + $this->obj_menu_nav->add_item("Create Project", "page=accounts/quotes/quotes-convert-project.php&id=". $this->id .""); $this->obj_menu_nav->add_item("Convert to Invoice", "page=accounts/quotes/quotes-convert.php&id=". $this->id .""); $this->obj_menu_nav->add_item("Delete Quote", "page=accounts/quotes/quotes-delete.php&id=". $this->id .""); } diff --git a/accounts/reports/balancesheet.php b/accounts/reports/balancesheet.php index 2171f0e7..0f87de12 100644 --- a/accounts/reports/balancesheet.php +++ b/accounts/reports/balancesheet.php @@ -47,7 +47,7 @@ function execute() if (!$this->mode) { - if ($_SESSION["account_reports"]["mode"]) + if (isset($_SESSION["account_reports"]["mode"])) { $this->mode = $_SESSION["account_reports"]["mode"]; } @@ -59,7 +59,7 @@ function execute() if (!$this->date_end || $this->date_end == "--") { - if ($_SESSION["account_reports"]["date_end"]) + if (isset($_SESSION["account_reports"]["date_end"])) { $this->date_end = $_SESSION["account_reports"]["date_end"]; } diff --git a/accounts/reports/incomestatement.php b/accounts/reports/incomestatement.php index e5583487..5f1f6440 100644 --- a/accounts/reports/incomestatement.php +++ b/accounts/reports/incomestatement.php @@ -46,7 +46,7 @@ function execute() if (!$this->mode) { - if ($_SESSION["account_reports"]["mode"]) + if (isset($_SESSION["account_reports"]["mode"])) { $this->mode = $_SESSION["account_reports"]["mode"]; } @@ -58,7 +58,7 @@ function execute() if (!$this->date_start || $this->date_start == "--") { - if ($_SESSION["account_reports"]["date_start"]) + if (isset($_SESSION["account_reports"]["date_start"])) { $this->date_start = $_SESSION["account_reports"]["date_start"]; } @@ -70,7 +70,7 @@ function execute() if (!$this->date_end || $this->date_end == "--") { - if ($_SESSION["account_reports"]["date_end"]) + if (isset($_SESSION["account_reports"]["date_end"])) { $this->date_end = $_SESSION["account_reports"]["date_end"]; } @@ -232,6 +232,8 @@ function execute() $sql_obj->prepare_sql_addwhere("date_trans <= '". $this->date_end ."'"); } + // Only include uncancelled invoices only + $sql_obj->prepare_sql_addwhere("cancelled='0'"); // paid invoices only if ($this->mode == "Cash") diff --git a/accounts/reports/trialbalance.php b/accounts/reports/trialbalance.php index c979b51d..30ccdc89 100644 --- a/accounts/reports/trialbalance.php +++ b/accounts/reports/trialbalance.php @@ -42,7 +42,7 @@ function execute() if (!$this->date_start || $this->date_start == "--") { - if ($_SESSION["account_reports"]["date_start"]) + if (isset($_SESSION["account_reports"]["date_start"])) { $this->date_start = $_SESSION["account_reports"]["date_start"]; } @@ -54,7 +54,7 @@ function execute() if (!$this->date_end || $this->date_end == "--") { - if ($_SESSION["account_reports"]["date_end"]) + if (isset($_SESSION["account_reports"]["date_end"])) { $this->date_end = $_SESSION["account_reports"]["date_end"]; } @@ -98,7 +98,7 @@ function execute() $structure["type"] = "date"; $structure["defaultvalue"] = $this->date_end; $this->obj_form->add_input($structure); - + // submit $structure = NULL; $structure["fieldname"] = "submit"; diff --git a/accounts/taxes/delete.php b/accounts/taxes/delete.php index b5bee3f8..34001922 100644 --- a/accounts/taxes/delete.php +++ b/accounts/taxes/delete.php @@ -19,7 +19,7 @@ class page_output var $locked; - function page_output() + function __construct() { // fetch variables $this->id = @security_script_input('/^[0-9]*$/', $_GET["id"]); diff --git a/accounts/taxes/ledger.php b/accounts/taxes/ledger.php index 76c96a9c..f70ef09e 100644 --- a/accounts/taxes/ledger.php +++ b/accounts/taxes/ledger.php @@ -17,7 +17,7 @@ class page_output var $obj_sql_tax; - function page_output() + function __construct() { // fetch variables $this->id = @security_script_input('/^[0-9]*$/', $_GET["id"]); diff --git a/accounts/taxes/tax_collected.php b/accounts/taxes/tax_collected.php index 809f41be..ec143a81 100644 --- a/accounts/taxes/tax_collected.php +++ b/accounts/taxes/tax_collected.php @@ -19,7 +19,7 @@ class page_output var $obj_taxreport; - function page_output() + function __construct() { // fetch variables $this->id = @security_script_input('/^[0-9]*$/', $_GET["id"]); diff --git a/accounts/taxes/tax_paid.php b/accounts/taxes/tax_paid.php index db008bb6..73538366 100644 --- a/accounts/taxes/tax_paid.php +++ b/accounts/taxes/tax_paid.php @@ -20,7 +20,7 @@ class page_output var $obj_taxreport; - function page_output() + function __construct() { // fetch variables $this->id = @security_script_input('/^[0-9]*$/', $_GET["id"]); diff --git a/accounts/taxes/view.php b/accounts/taxes/view.php index a8c5829c..bf256d96 100644 --- a/accounts/taxes/view.php +++ b/accounts/taxes/view.php @@ -21,7 +21,7 @@ class page_output var $obj_form; - function page_output() + function __construct() { // fetch variables $this->id = @security_script_input('/^[0-9]*$/', $_GET["id"]); diff --git a/admin/config_application-process.php b/admin/config_application-process.php index 1140e7b4..3a7950ce 100644 --- a/admin/config_application-process.php +++ b/admin/config_application-process.php @@ -35,6 +35,7 @@ $data["ACCOUNTS_SERVICES_DATESHIFT"] = @security_form_input_predefined("int", "ACCOUNTS_SERVICES_DATESHIFT", 1, ""); $data["ACCOUNTS_TERMS_DAYS"] = @security_form_input_predefined("int", "ACCOUNTS_TERMS_DAYS", 0, ""); $data["ACCOUNTS_AUTOPAY"] = @security_form_input_predefined("checkbox", "ACCOUNTS_AUTOPAY", 0, ""); + $data["ACCOUNTS_CANCEL_DELETE"] = @security_form_input_predefined("checkbox", "ACCOUNTS_CANCEL_DELETE", 0, ""); $data["ACCOUNTS_EMAIL_ADDRESS"] = @security_form_input_predefined("email", "ACCOUNTS_EMAIL_ADDRESS", 1, ""); $data["ACCOUNTS_EMAIL_AUTOBCC"] = @security_form_input_predefined("checkbox", "ACCOUNTS_EMAIL_AUTOBCC", 1, ""); diff --git a/admin/config_application.php b/admin/config_application.php index 7c7db4f2..840df9d4 100644 --- a/admin/config_application.php +++ b/admin/config_application.php @@ -139,6 +139,12 @@ function execute() $structure["options"]["label"] = " Check to have invoices automatically paid where there is credit or reoccuring billing details."; $this->obj_form->add_input($structure); + $structure = NULL; + $structure["fieldname"] = "ACCOUNTS_CANCEL_DELETE"; + $structure["type"] = "checkbox"; + $structure["options"]["no_translate_fieldname"] = "yes"; + $structure["options"]["label"] = " Check to have invoices cancelled when 'deleted'. Uncheck for proper deletion."; + $this->obj_form->add_input($structure); // email options @@ -358,7 +364,7 @@ function execute() // define subforms $this->obj_form->subforms["config_defcodes"] = array("ACCOUNTS_AP_INVOICENUM", "ACCOUNTS_AR_INVOICENUM", "ACCOUNTS_GL_TRANSNUM", "ACCOUNTS_QUOTES_NUM", "ACCOUNTS_CREDIT_NUM", "CODE_ACCOUNT", "CODE_CUSTOMER", "CODE_VENDOR", "CODE_PRODUCT", "CODE_PROJECT", "CODE_STAFF"); - $this->obj_form->subforms["config_accounts"] = array("ACCOUNTS_SERVICES_ADVANCEBILLING", "ACCOUNTS_SERVICES_DATESHIFT", "ACCOUNTS_TERMS_DAYS", "ACCOUNTS_AUTOPAY"); + $this->obj_form->subforms["config_accounts"] = array("ACCOUNTS_SERVICES_ADVANCEBILLING", "ACCOUNTS_SERVICES_DATESHIFT", "ACCOUNTS_TERMS_DAYS", "ACCOUNTS_AUTOPAY", "ACCOUNTS_CANCEL_DELETE"); $this->obj_form->subforms["config_accounts_email"] = array("ACCOUNTS_EMAIL_ADDRESS", "ACCOUNTS_INVOICE_AUTOEMAIL", "ACCOUNTS_EMAIL_AUTOBCC", "ACCOUNTS_INVOICE_BATCHREPORT"); $this->obj_form->subforms["config_services_email"] = array("SERVICES_USAGEALERTS_ENABLE"); $this->obj_form->subforms["config_orders"] = array("ORDERS_BILL_ONSERVICE", "ORDERS_BILL_ENDOFMONTH"); diff --git a/admin/config_company-process.php b/admin/config_company-process.php index dcb34f3d..0198a5bc 100644 --- a/admin/config_company-process.php +++ b/admin/config_company-process.php @@ -29,9 +29,15 @@ $data["COMPANY_ADDRESS1_COUNTRY"] = @security_form_input_predefined("any", "COMPANY_ADDRESS1_COUNTRY", 1, ""); $data["COMPANY_ADDRESS1_ZIPCODE"] = @security_form_input_predefined("any", "COMPANY_ADDRESS1_ZIPCODE", 0, ""); $data["COMPANY_PAYMENT_DETAILS"] = @security_form_input_predefined("any", "COMPANY_PAYMENT_DETAILS", 1, ""); - - - + $data["COMPANY_TAX_NUMBER"] = @security_form_input_predefined("any", "COMPANY_TAX_NUMBER", 0, ""); + $data["COMPANY_REG_NUMBER"] = @security_form_input_predefined("any", "COMPANY_REG_NUMBER", 0, ""); + $data["COMPANY_ADDRESS2_STREET"] = @security_form_input_predefined("any", "COMPANY_ADDRESS2_STREET", 1, ""); + $data["COMPANY_ADDRESS2_CITY"] = @security_form_input_predefined("any", "COMPANY_ADDRESS2_CITY", 1, ""); + $data["COMPANY_ADDRESS2_STATE"] = @security_form_input_predefined("any", "COMPANY_ADDRESS2_STATE", 0, ""); + $data["COMPANY_ADDRESS2_COUNTRY"] = @security_form_input_predefined("any", "COMPANY_ADDRESS2_COUNTRY", 1, ""); + $data["COMPANY_ADDRESS2_ZIPCODE"] = @security_form_input_predefined("any", "COMPANY_ADDRESS2_ZIPCODE", 0, ""); + $data["COMPANY_B2C_TERMS"] = @security_form_input_predefined("html", "COMPANY_B2C_TERMS", 0,""); + $data["COMPANY_B2B_TERMS"] = @security_form_input_predefined("html", "COMPANY_B2B_TERMS", 0,""); /* Process company logo upload and verify content if any has been supplied. Enforce png only diff --git a/admin/config_company.php b/admin/config_company.php index a5511577..62be6d03 100644 --- a/admin/config_company.php +++ b/admin/config_company.php @@ -44,6 +44,18 @@ function execute() $structure["type"] = "input"; $structure["options"]["no_translate_fieldname"] = "yes"; $this->obj_form->add_input($structure); + + $structure = NULL; + $structure["fieldname"] = "COMPANY_REG_NUMBER"; + $structure["type"] = "input"; + $structure["options"]["no_translate_fieldname"] = "yes"; + $this->obj_form->add_input($structure); + + $structure = NULL; + $structure["fieldname"] = "COMPANY_TAX_NUMBER"; + $structure["type"] = "input"; + $structure["options"]["no_translate_fieldname"] = "yes"; + $this->obj_form->add_input($structure); $structure = NULL; $structure["fieldname"] = "COMPANY_CONTACT_EMAIL"; @@ -102,7 +114,64 @@ function execute() $structure["options"]["height"] = "60"; $structure["options"]["no_translate_fieldname"] = "yes"; $this->obj_form->add_input($structure); - + + $structure = NULL; + $structure["fieldname"] = "COMPANY_ADDRESS2_STREET"; + $structure["type"] = "textarea"; + $structure["options"]["width"] = "300"; + $structure["options"]["height"] = "60"; + $structure["options"]["no_translate_fieldname"] = "yes"; + $this->obj_form->add_input($structure); + + $structure = NULL; + $structure["fieldname"] = "COMPANY_ADDRESS2_CITY"; + $structure["type"] = "input"; + $structure["options"]["no_translate_fieldname"] = "yes"; + $this->obj_form->add_input($structure); + + $structure = NULL; + $structure["fieldname"] = "COMPANY_ADDRESS2_STATE"; + $structure["type"] = "input"; + $structure["options"]["no_translate_fieldname"] = "yes"; + $this->obj_form->add_input($structure); + + $structure = NULL; + $structure["fieldname"] = "COMPANY_ADDRESS2_COUNTRY"; + $structure["type"] = "input"; + $structure["options"]["no_translate_fieldname"] = "yes"; + $this->obj_form->add_input($structure); + + $structure = NULL; + $structure["fieldname"] = "COMPANY_ADDRESS2_ZIPCODE"; + $structure["type"] = "input"; + $structure["options"]["no_translate_fieldname"] = "yes"; + $this->obj_form->add_input($structure); + + $structure = NULL; + $structure["fieldname"] = "COMPANY_ADDRESS_MSG"; + $structure["type"] = "message"; + $structure["defaultvalue"] = "Enter the registered address of the company below, if different to the contact address."; + $structure["options"]["no_translate_fieldname"] = "yes"; + $this->obj_form->add_input($structure); + + $structure = NULL; + $structure["fieldname"] = "COMPANY_B2C_TERMS"; + $structure["type"] = "tinymce"; + $structure["options"]["width"] = 500; + $structure["options"]["height"] = 100; + $structure["options"]["no_translate_fieldname"] = "yes"; + $structure["options"]["css_field_class"] = "tinymce"; + $this->obj_form->add_input($structure); + + $structure = NULL; + $structure["fieldname"] = "COMPANY_B2B_TERMS"; + $structure["type"] = "tinymce"; + $structure["options"]["width"] = 500; + $structure["options"]["height"] = 100; + $structure["options"]["no_translate_fieldname"] = "yes"; + $structure["options"]["css_field_class"] = "tinymce"; + $this->obj_form->add_input($structure); + $structure = NULL; $structure["fieldname"] = "COMPANY_LOGO"; $structure["type"] = "file"; @@ -127,7 +196,8 @@ function execute() // define subforms $this->obj_form->subforms["config_company_details"] = array("COMPANY_NAME", "COMPANY_LOGO", "COMPANY_LOGO_MSG"); $this->obj_form->subforms["config_company_contact"] = array("COMPANY_CONTACT_EMAIL", "COMPANY_CONTACT_PHONE", "COMPANY_CONTACT_FAX", "COMPANY_ADDRESS1_STREET", "COMPANY_ADDRESS1_CITY","COMPANY_ADDRESS1_STATE","COMPANY_ADDRESS1_COUNTRY", "COMPANY_ADDRESS1_ZIPCODE"); - $this->obj_form->subforms["config_company_invoices"] = array("COMPANY_PAYMENT_DETAILS"); + $this->obj_form->subforms["config_company_registration"] = array("COMPANY_TAX_NUMBER","COMPANY_REG_NUMBER","COMPANY_ADDRESS_MSG","COMPANY_ADDRESS2_STREET","COMPANY_ADDRESS2_CITY","COMPANY_ADDRESS2_STATE","COMPANY_ADDRESS2_COUNTRY","COMPANY_ADDRESS2_ZIPCODE"); + $this->obj_form->subforms["config_company_terms"] = array("COMPANY_PAYMENT_DETAILS","COMPANY_B2C_TERMS","COMPANY_B2B_TERMS"); $this->obj_form->subforms["submit"] = array("submit"); if (error_check()) diff --git a/admin/templates.php b/admin/templates.php index 9d2cb431..5e4e69e1 100644 --- a/admin/templates.php +++ b/admin/templates.php @@ -14,7 +14,7 @@ class page_output var $email_template_array = array(); var $obj_sql_invoice_data = array(); - function page_output() + function __construct() { // define page dependencies $this->requires["css"][] = "include/admin/css/templates.css"; @@ -266,7 +266,7 @@ function render_html() print "You can adjust the PDFs generated by the Amberdms Billing System by using different templates - these templates may include different languages, different layouts or other styling effects.
"; - format_msgbox("info", "If you have made your own template you would like to contribute back or if you need customisation work, please contact support@amberdms.com for details and we will be happy to assist.
"); + //format_msgbox("info", "If you have made your own template you would like to contribute back or if you need customisation work, please contact support@amberdms.com for details and we will be happy to assist.
"); foreach ( $this->obj_sql_invoice_data as $invoice_type_name => $invoice_type_data ) diff --git a/customers/add.php b/customers/add.php index d5a6e438..eaf28ebc 100644 --- a/customers/add.php +++ b/customers/add.php @@ -14,7 +14,7 @@ class page_output var $num_contacts; var $tax_array = array(); - function page_output() + function __construct() { // required pages $this->requires["javascript"][] = "include/customers/javascript/addedit_customers.js"; @@ -103,6 +103,7 @@ function execute() $structure = NULL; $structure["fieldname"] = "contact_" .$i; $structure["type"] = "input"; + $structure["defaultvalue"] = ""; if (isset($_SESSION["error"]["contact_" .$i. "-error"])) { $structure["options"]["css_field_class"] = "hidden_form_field_error"; @@ -153,6 +154,7 @@ function execute() $structure = NULL; $structure["fieldname"] = "description_" .$i; $structure["type"] = "textarea"; + $structure["defaultvalue"] = ""; if (isset($_SESSION["error"]["contact_" .$i. "-error"])) { $structure["options"]["css_field_class"] = "hidden_form_field_error"; @@ -443,7 +445,7 @@ function render_html() { print ""; } - else if ($_SESSION["error"]["contact_" .$i. "-error"]) + else if (isset($_SESSION["error"]["contact_" .$i. "-error"])) { print ""; } @@ -459,7 +461,7 @@ function render_html() { print ""; } - else if ($_SESSION["error"]["contact_" .$i. "-error"]) + else if (isset($_SESSION["error"]["contact_" .$i. "-error"])) { print ""; } @@ -473,7 +475,7 @@ function render_html() $this->obj_form->render_field("num_records_$i"); print "obj_customer->id ."\">Export as CSV
"; - print "obj_customer->id ."\">Export as PDF
"; + print ""; + print ""; } diff --git a/customers/customers.php b/customers/customers.php index 1fbf6981..9e910576 100644 --- a/customers/customers.php +++ b/customers/customers.php @@ -469,14 +469,14 @@ function render_html() } print ""; } - //links print "]*>/gi,"[quote]"),c(/<\/blockquote>/gi,"[/quote]"),c(/
/gi,"\n"),c(/
/gi,"\n"),c(/
/gi,"\n"),c(//gi,""),c(/<\/p>/gi,"\n"),c(/ |\u00a0/gi," "),c(/"/gi,'"'),c(/</gi,"<"),c(/>/gi,">"),c(/&/gi,"&"),a},_punbb_bbcode2html:function(a){function c(b,c){a=a.replace(b,c)}return a=b.trim(a),c(/\n/gi,"
"),c(/\[b\]/gi,""),c(/\[\/b\]/gi,""),c(/\[i\]/gi,""),c(/\[\/i\]/gi,""),c(/\[u\]/gi,""),c(/\[\/u\]/gi,""),c(/\[url=([^\]]+)\](.*?)\[\/url\]/gi,'$2'),c(/\[url\](.*?)\[\/url\]/gi,'$1'),c(/\[img\](.*?)\[\/img\]/gi,''),c(/\[color=(.*?)\](.*?)\[\/color\]/gi,'$2'),c(/\[code\](.*?)\[\/code\]/gi,'$1 '),c(/\[quote.*?\](.*?)\[\/quote\]/gi,'$1 '),a}}}),function(){}}),d("0")()}(); \ No newline at end of file diff --git a/external/tinymce/js/tinymce/plugins/charmap/plugin.min.js b/external/tinymce/js/tinymce/plugins/charmap/plugin.min.js new file mode 100644 index 00000000..3fd9e23d --- /dev/null +++ b/external/tinymce/js/tinymce/plugins/charmap/plugin.min.js @@ -0,0 +1 @@ +!function(){var a={},b=function(b){for(var c=a[b],e=c.deps,f=c.defn,g=e.length,h=new Array(g),i=0;i
';var i=g(),j=Math.min(i.length,25),k=Math.ceil(i.length/j);for(e=0;e ",d=0;d ";var o={type:"container",html:c,onclick:function(a){var c=a.target;if(/^(TD|DIV)$/.test(c.nodeName)){var d=b(c).firstChild;d&&d.hasAttribute("data-chr")&&(h(d.getAttribute("data-chr")),a.ctrlKey||f.close())}},onmouseover:function(a){var c=b(a.target);c&&c.firstChild?(f.find("#preview").text(c.firstChild.firstChild.data),f.find("#previewTitle").text(c.title)):(f.find("#preview").text(" "),f.find("#previewTitle").text(" "))}};f=a.windowManager.open({title:"Special character",spacing:10,padding:10,items:[o,{type:"container",layout:"flex",direction:"column",align:"center",spacing:5,minWidth:160,minHeight:160,items:[{type:"label",name:"preview",text:" ",style:"font-size: 40px; text-align: center",border:1,minWidth:140,minHeight:80},{type:"spacer",minHeight:20},{type:"label",name:"previewTitle",text:" ",style:"white-space: pre-wrap;",border:1,minWidth:140}]}],buttons:[{text:"Close",onclick:function(){f.close()}}]})}var j=b.isArray;return a.addCommand("mceShowCharmap",i),a.addButton("charmap",{icon:"charmap",tooltip:"Special character",cmd:"mceShowCharmap"}),a.addMenuItem("charmap",{icon:"charmap",text:"Special character",cmd:"mceShowCharmap",context:"insert"}),{getCharMap:g,insertChar:h}}),function(){}}),d("0")()}(); \ No newline at end of file diff --git a/external/tinymce/js/tinymce/plugins/code/plugin.min.js b/external/tinymce/js/tinymce/plugins/code/plugin.min.js new file mode 100644 index 00000000..7a0437ed --- /dev/null +++ b/external/tinymce/js/tinymce/plugins/code/plugin.min.js @@ -0,0 +1 @@ +!function(){var a={},b=function(b){for(var c=a[b],e=c.deps,f=c.defn,g=e.length,h=new Array(g),i=0;i '+n+""}else c+=""}c+=""}c+=" code[class*="language-"], +pre[class*="language-"] { + background: #f5f2f0; +} + +/* Inline code */ +:not(pre) > code[class*="language-"] { + padding: .1em; + border-radius: .3em; +} + +.token.comment, +.token.prolog, +.token.doctype, +.token.cdata { + color: slategray; +} + +.token.punctuation { + color: #999; +} + +.namespace { + opacity: .7; +} + +.token.property, +.token.tag, +.token.boolean, +.token.number, +.token.constant, +.token.symbol, +.token.deleted { + color: #905; +} + +.token.selector, +.token.attr-name, +.token.string, +.token.char, +.token.builtin, +.token.inserted { + color: #690; +} + +.token.operator, +.token.entity, +.token.url, +.language-css .token.string, +.style .token.string { + color: #a67f59; + background: hsla(0, 0%, 100%, .5); +} + +.token.atrule, +.token.attr-value, +.token.keyword { + color: #07a; +} + +.token.function { + color: #DD4A68; +} + +.token.regex, +.token.important, +.token.variable { + color: #e90; +} + +.token.important, +.token.bold { + font-weight: bold; +} +.token.italic { + font-style: italic; +} + +.token.entity { + cursor: help; +} + diff --git a/external/tinymce/js/tinymce/plugins/codesample/plugin.min.js b/external/tinymce/js/tinymce/plugins/codesample/plugin.min.js new file mode 100644 index 00000000..a0285edc --- /dev/null +++ b/external/tinymce/js/tinymce/plugins/codesample/plugin.min.js @@ -0,0 +1 @@ +!function(){var a={},b=function(b){for(var c=a[b],e=c.deps,f=c.defn,g=e.length,h=new Array(g),i=0;i a.length)break a;if(!(q instanceof e)){k.lastIndex=0;var r=k.exec(q);if(r){m&&(n=r[1].length);var s=r.index-1+n,r=r[0].slice(n),t=r.length,u=s+t,v=q.slice(0,s+1),w=q.slice(u+1),x=[p,1];v&&x.push(v);var y=new e(h,l?c.tokenize(r,l):r,o);x.push(y),w&&x.push(w),Array.prototype.splice.apply(f,x)}}}}}return f},hooks:{all:{},add:function(a,b){var d=c.hooks.all;d[a]=d[a]||[],d[a].push(b)},run:function(a,b){var d=c.hooks.all[a];if(d&&d.length)for(var e,f=0;e=d[f++];)e(b)}}},d=c.Token=function(a,b,c){this.type=a,this.content=b,this.alias=c};if(d.stringify=function(a,b,e){if("string"==typeof a)return a;if("Array"===c.util.type(a))return a.map(function(c){return d.stringify(c,b,a)}).join("");var f={type:a.type,content:d.stringify(a.content,b,e),tag:"span",classes:["token",a.type],attributes:{},language:b,parent:e};if("comment"==f.type&&(f.attributes.spellcheck="true"),a.alias){var g="Array"===c.util.type(a.alias)?a.alias:[a.alias];Array.prototype.push.apply(f.classes,g)}c.hooks.run("wrap",f);var h="";for(var i in f.attributes)h+=(h?" ":"")+i+'="'+(f.attributes[i]||"")+'"';return"<"+f.tag+' class="'+f.classes.join(" ")+'" '+h+">"+f.content+""+f.tag+">"},!b.document)return b.addEventListener?(b.addEventListener("message",function(a){var d=JSON.parse(a.data),e=d.language,f=d.code,g=d.immediateClose;b.postMessage(c.highlight(f,c.languages[e],e)),g&&b.close()},!1),b.Prism):b.Prism}();return"undefined"!=typeof module&&module.exports&&(module.exports=c),"undefined"!=typeof global&&(global.Prism=c),c.languages.markup={comment://,prolog:/<\?[\w\W]+?\?>/,doctype://,cdata://i,tag:{pattern:/<\/?[^\s>\/=.]+(?:\s+[^\s>\/=]+(?:=(?:("|')(?:\\\1|\\?(?!\1)[\w\W])*\1|[^\s'">=]+))?)*\s*\/?>/i,inside:{tag:{pattern:/^<\/?[^\s>\/]+/i,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"attr-value":{pattern:/=(?:('|")[\w\W]*?(\1)|[^\s>]+)/i,inside:{punctuation:/[=>"']/}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:/?[\da-z]{1,8};/i},c.hooks.add("wrap",function(a){"entity"===a.type&&(a.attributes.title=a.content.replace(/&/,"&"))}),c.languages.xml=c.languages.markup,c.languages.html=c.languages.markup,c.languages.mathml=c.languages.markup,c.languages.svg=c.languages.markup,c.languages.css={comment:/\/\*[\w\W]*?\*\//,atrule:{pattern:/@[\w-]+?.*?(;|(?=\s*\{))/i,inside:{rule:/@[\w-]+/}},url:/url\((?:(["'])(\\(?:\r\n|[\w\W])|(?!\1)[^\\\r\n])*\1|.*?)\)/i,selector:/[^\{\}\s][^\{\};]*?(?=\s*\{)/,string:/("|')(\\(?:\r\n|[\w\W])|(?!\1)[^\\\r\n])*\1/,property:/(\b|\B)[\w-]+(?=\s*:)/i,important:/\B!important\b/i,"function":/[-a-z0-9]+(?=\()/i,punctuation:/[(){};:]/},c.languages.css.atrule.inside.rest=c.util.clone(c.languages.css),c.languages.markup&&(c.languages.insertBefore("markup","tag",{style:{pattern:/