Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions accounts/ap/ap.php
Original file line number Diff line number Diff line change
Expand Up @@ -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");

Expand Down Expand Up @@ -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();

Expand Down Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion accounts/ap/invoice-bulk-payments.php
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
2 changes: 1 addition & 1 deletion accounts/ap/invoice-delete.php
Original file line number Diff line number Diff line change
Expand Up @@ -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"]);
Expand Down
4 changes: 2 additions & 2 deletions accounts/ap/invoice-items-edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -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"]);
Expand Down
2 changes: 1 addition & 1 deletion accounts/ap/invoice-items.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion accounts/ap/invoice-payments-edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -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"]);
Expand Down
2 changes: 1 addition & 1 deletion accounts/ap/invoice-payments.php
Original file line number Diff line number Diff line change
Expand Up @@ -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"]);
Expand Down
2 changes: 1 addition & 1 deletion accounts/ap/invoice-view.php
Original file line number Diff line number Diff line change
Expand Up @@ -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"]);
Expand Down
2 changes: 1 addition & 1 deletion accounts/ap/journal-edit-process.php
Original file line number Diff line number Diff line change
Expand Up @@ -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"] ."");
Expand Down
2 changes: 1 addition & 1 deletion accounts/ap/journal-edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -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"]);
Expand Down
4 changes: 3 additions & 1 deletion accounts/ap/journal.php
Original file line number Diff line number Diff line change
Expand Up @@ -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"]);
Expand Down Expand Up @@ -113,6 +113,8 @@ function render_html()
format_msgbox("locked", "<p>Note: your permissions limit you to read-only access to the journal</p>");
}



// display options form
$this->obj_journal->render_options_form();

Expand Down
2 changes: 1 addition & 1 deletion accounts/ar/account-statements.php
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
35 changes: 28 additions & 7 deletions accounts/ar/ar.php
Original file line number Diff line number Diff line change
Expand Up @@ -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");

Expand Down Expand Up @@ -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();

Expand Down Expand Up @@ -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);



Expand Down
2 changes: 1 addition & 1 deletion accounts/ar/credit-add.php
Original file line number Diff line number Diff line change
Expand Up @@ -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";
}
Expand Down
2 changes: 1 addition & 1 deletion accounts/ar/credit-delete.php
Original file line number Diff line number Diff line change
Expand Up @@ -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"]);
Expand Down
2 changes: 1 addition & 1 deletion accounts/ar/credit-export.php
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down
4 changes: 2 additions & 2 deletions accounts/ar/credit-items-edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -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"]);
Expand Down
2 changes: 1 addition & 1 deletion accounts/ar/credit-items.php
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down
2 changes: 1 addition & 1 deletion accounts/ar/credit-journal-edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -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"]);
Expand Down
2 changes: 1 addition & 1 deletion accounts/ar/credit-journal.php
Original file line number Diff line number Diff line change
Expand Up @@ -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"]);
Expand Down
2 changes: 1 addition & 1 deletion accounts/ar/credit-payments.php
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down
2 changes: 1 addition & 1 deletion accounts/ar/credit-view.php
Original file line number Diff line number Diff line change
Expand Up @@ -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"]);
Expand Down
2 changes: 1 addition & 1 deletion accounts/ar/invoice-bulk-payments.php
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
28 changes: 22 additions & 6 deletions accounts/ar/invoice-delete.php
Original file line number Diff line number Diff line change
Expand Up @@ -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"]);
Expand All @@ -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);
}


Expand Down Expand Up @@ -77,10 +85,18 @@ function execute()

function render_html()
{
// heading
print "<h3>DELETE INVOICE</h3><br>";
print "<p>This page allows you to delete incorrect invoices, provided that they have not been locked.</p>";

if($GLOBALS["config"]["ACCOUNTS_CANCEL_DELETE"]=="1")
{
// heading
print "<h3>CANCEL INVOICE</h3><br>";
print "<p>This page allows you to cancel incorrect invoices, provided that they have not been locked.</p>";
}
else
{
// heading
print "<h3>DELETE INVOICE</h3><br>";
print "<p>This page allows you to delete incorrect invoices, provided that they have not been locked.</p>";
}
// display summary box
invoice_render_summarybox("ar", $this->id);

Expand Down
17 changes: 14 additions & 3 deletions accounts/ar/invoice-export.php
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand All @@ -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 ."");
}
}

Expand Down
Loading