Example #1
0
 function render_html()
 {
     // heading
     print "<h3>CDR RATE TABLES</h3><br>";
     print "<p>This page contains the different phone call rate tables that have been configured. You can define as many different call rates tables as you like, typically this is done when using different call providers to deliver services when they charge at different rates.</p>";
     // display options form
     $this->obj_table->render_options_form();
     // display table
     if (!count($this->obj_table->columns)) {
         format_msgbox("important", "<p>Please select some valid options to display.</p>");
     } elseif (!$this->obj_table->data_num_rows) {
         format_msgbox("important", "<p>There are no rate tables in the database that match the filters.</p>");
     } else {
         // links
         $structure = NULL;
         $structure["id"]["column"] = "id";
         $this->obj_table->add_link("tbl_lnk_details", "services/cdr-rates-view.php", $structure);
         $structure = NULL;
         $structure["id"]["column"] = "id";
         $this->obj_table->add_link("tbl_lnk_items", "services/cdr-rates-items.php", $structure);
         $structure = NULL;
         $structure["id"]["column"] = "id";
         $this->obj_table->add_link("tbl_lnk_delete", "services/cdr-rates-delete.php", $structure);
         // display the table
         $this->obj_table->render_table_html();
         // display CSV/PDF download link
         print "<p align=\"right\"><a class=\"button_export\" href=\"index-export.php?mode=csv&page=services/cdr_rates.php\">Export as CSV</a></p>";
         print "<p align=\"right\"><a class=\"button_export\" href=\"index-export.php?mode=pdf&page=services/cdr_rates.php\">Export as PDF</a></p>";
     }
 }
Example #2
0
 function render_html()
 {
     // heading
     print "<h3>STAFF LIST</h3><br><br>";
     // display options form
     $this->obj_table->render_options_form();
     // display data
     if (!count($this->obj_table->columns)) {
         format_msgbox("important", "<p>Please select some valid options to display.</p>");
     } elseif (!$this->obj_table->data_num_rows) {
         format_msgbox("info", "<p>You currently have no staff in your database.</p>");
     } else {
         // links
         $structure = NULL;
         $structure["id"]["column"] = "id";
         $this->obj_table->add_link("tbl_lnk_details", "hr/staff-view.php", $structure);
         $structure = NULL;
         $structure["id"]["column"] = "id";
         $this->obj_table->add_link("tbl_lnk_timesheet", "hr/staff-timebooked.php", $structure);
         // display the table
         $this->obj_table->render_table_html();
         // display CSV/PDF download link
         print "<p align=\"right\"><a class=\"button_export\" href=\"index-export.php?mode=csv&page=hr/staff.php\">Export as CSV</a></p>";
         print "<p align=\"right\"><a class=\"button_export\" href=\"index-export.php?mode=pdf&page=hr/staff.php\">Export as PDF</a></p>";
     }
 }
Example #3
0
 function render_html()
 {
     // heading
     print "<h3>TAXES</h3>";
     print "<p>This page list all the taxes added to the system.</p>";
     // display table
     if (!count($this->obj_table->columns)) {
         format_msgbox("important", "<p>Please select some valid options to display.</p>");
     } elseif (!$this->obj_table->data_num_rows) {
         format_msgbox("info", "<p>You currently have no taxes in your database.</p>");
     } else {
         // view link
         $structure = NULL;
         $structure["id"]["column"] = "id";
         $this->obj_table->add_link("view", "accounts/taxes/view.php", $structure);
         // tax collected link
         $structure = NULL;
         $structure["id"]["column"] = "id";
         $this->obj_table->add_link("collected", "accounts/taxes/tax_collected.php", $structure);
         // tax paid link
         $structure = NULL;
         $structure["id"]["column"] = "id";
         $this->obj_table->add_link("paid", "accounts/taxes/tax_paid.php", $structure);
         // display the table
         $this->obj_table->render_table_html();
         // display CSV/PDF download link
         print "<p align=\"right\"><a class=\"button_export\" href=\"index-export.php?mode=csv&page=accounts/taxes/taxes.php\">Export as CSV</a></p>";
         print "<p align=\"right\"><a class=\"button_export\" href=\"index-export.php?mode=pdf&page=accounts/taxes/taxes.php\">Export as PDF</a></p>";
     }
 }
Example #4
0
 function render_html()
 {
     // heading
     print "<h3>PROJECT PHASES</h3>";
     print "<p>All projects need to have at least one project phase, which staff can then use to book time to. A typical usage example is to have different phases\n\t\tfor different sections of work on the project - eg: \"design phase\", \"implementation phase\" and \"testing phase\".</p>";
     print "<p>You can check what time has been booked to the phases, by using the \"Timebooked\" button on the menu above.</p>";
     if (!$this->obj_table->data_num_rows) {
         format_msgbox("important", "<p>You currently have no phases belonging to this project.<br><br><a class=\"button\" href=\"index.php?page=projects/phase-edit.php&id=" . $this->id . "\">Add a new phase to the project</a></p>");
     } else {
         if (user_permissions_get("projects_write")) {
             // edit link
             $structure = NULL;
             $structure["id"]["value"] = $this->id;
             $structure["phaseid"]["column"] = "id";
             $this->obj_table->add_link("edit", "projects/phase-edit.php", $structure);
             // delete link
             $structure = NULL;
             $structure["id"]["value"] = $this->id;
             $structure["phaseid"]["column"] = "id";
             $this->obj_table->add_link("delete", "projects/phase-delete.php", $structure);
         }
         // display the table
         $this->obj_table->render_table_html();
         if (user_permissions_get("projects_write")) {
             print "<p><a class=\"button\" href=\"index.php?page=projects/phase-edit.php&id=" . $this->id . "\">Add a new phase to the project</a></p>";
         }
     }
 }
Example #5
0
 function render_html()
 {
     // title + summary
     print "<h3>DOMAINS</h3>";
     print "<p>List of domains managed by this server:</p>";
     // table data
     if (!$this->obj_table->data_num_rows) {
         format_msgbox("important", "<p>There are currently no domain names configured.</p>");
     } else {
         // details link
         $structure = NULL;
         $structure["id"]["column"] = "id";
         $this->obj_table->add_link("tbl_lnk_details", "domains/view.php", $structure);
         // domain records
         $structure = NULL;
         $structure["id"]["column"] = "id";
         $this->obj_table->add_link("tbl_lnk_records", "domains/records.php", $structure);
         // delete link
         $structure = NULL;
         $structure["id"]["column"] = "id";
         $this->obj_table->add_link("tbl_lnk_delete", "domains/delete.php", $structure);
         // display the table
         $this->obj_table->render_table_html();
     }
     // add link
     print "<p><a class=\"button\" href=\"index.php?page=domains/add.php\">Add New Domain</a></p>";
 }
Example #6
0
 function render_html()
 {
     // table data
     if (!$this->obj_table->data_num_rows and !$_GET["domain_name"]) {
         format_msgbox("important", "<p>There are currently no domain names configured.</p>");
     } else {
         // details link
         $structure = NULL;
         $structure["id"]["column"] = "id";
         $this->obj_table->add_link("tbl_lnk_details", "domains/view.php", $structure);
         // domain records
         $structure = NULL;
         $structure["id"]["column"] = "id";
         $this->obj_table->add_link("tbl_lnk_records", "domains/records.php", $structure);
         // delete link
         $structure = NULL;
         $structure["id"]["column"] = "id";
         $this->obj_table->add_link("tbl_lnk_delete", "domains/delete.php", $structure);
         // display the table
         $this->obj_table->render_table_html();
         if (!$this->obj_table->data_num_rows) {
             format_msgbox("important", "<p>No match on domain names with current filter expression.</p>");
         }
     }
 }
 function render_html()
 {
     // heading
     print "<h3>DATA TRAFFIC TYPES</h3><br>";
     print "<p>When billing data traffic services with differing prices/caps for specific traffic types - for example, national vs international traffic, the different traffic types will need to be defined here - once defined, services can have these traffic types assigned and configured with per-service data caps or unlimited options.</p>";
     // display options form
     $this->obj_table->render_options_form();
     // display table
     if (!count($this->obj_table->columns)) {
         format_msgbox("important", "<p>Please select some valid options to display.</p>");
     } elseif (!$this->obj_table->data_num_rows) {
         format_msgbox("important", "<p>There are no traffic types in the database that match the filters.</p>");
     } else {
         // links
         $structure = NULL;
         $structure["id"]["column"] = "id";
         $this->obj_table->add_link("tbl_lnk_details", "services/traffic-types-view.php", $structure);
         $structure = NULL;
         $structure["id"]["column"] = "id";
         $this->obj_table->add_link("tbl_lnk_delete", "services/traffic-types-delete.php", $structure);
         // display the table
         $this->obj_table->render_table_html();
         // display CSV/PDF download link
         print "<p align=\"right\"><a class=\"button_export\" href=\"index-export.php?mode=csv&page=services/traffic-types.php\">Export as CSV</a></p>";
         print "<p align=\"right\"><a class=\"button_export\" href=\"index-export.php?mode=pdf&page=services/traffic-types.php\">Export as PDF</a></p>";
     }
 }
Example #8
0
 function render_html()
 {
     // Title + Summapy
     print "<h3>INVOICE JOURNAL</h3><br>";
     print "<p>The journal is a place where you can put your own notes, files and view the history of this invoice.</p>";
     if (user_permissions_get("accounts_ap_write")) {
         print "<p><a class=\"button\" href=\"index.php?page=accounts/ap/journal-edit.php&type=text&id=" . $this->id . "\">Add new journal entry</a> <a class=\"button\" href=\"index.php?page=accounts/ap/journal-edit.php&type=file&id=" . $this->id . "\">Upload File</a></p>";
     } else {
         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();
     // display the journal
     $this->obj_journal->render_journal();
 }
Example #9
0
 function render_html()
 {
     // Title + Summary
     print "<h3>DATABASE BACKUP</h3><br>";
     print "<p>This page allows an administrator to perform an export of the entire MySQL database and download it as a file. This feature\n\t\t\tensures that no matter who runs your instance of the Amberdms Billing System, your data can always be retrieved.</p>";
     print "<p>The file generated is a standard SQL file compressed with gzip, it can be easily restored using the MySQL command line or\n\t\t\tvia a utility such as phpmyadmin.</p>";
     // report on usage
     $sql_obj = new sql_query();
     $usage = $sql_obj->stats_diskusage();
     format_msgbox("info", "<p>Estimated download size: " . format_size_human($usage) . " (before compression)</p>");
     // run check for file-system based journal files
     $sql_obj = new sql_query();
     $sql_obj->string = "SELECT id FROM file_uploads WHERE file_location != 'db' LIMIT 1";
     $sql_obj->execute();
     if ($sql_obj->num_rows()) {
         format_msgbox("important", "<p>Some of the files stored in the journal have been saved to the filesystem rather than the MySQL database. This backup will provide a copy of the database, but you will also need to download the contents of the data/ directory.</p>");
     }
     // export link
     print "<br>";
     print "<a class=\"button\" href=\"admin/db_backup-process.php\">Export Database</a>";
 }
 function render_html()
 {
     // Title + Summary
     print "<h3>USER STAFF ACCESS RIGHTS</h3><br>";
     print "<p>The Amberdms Billing System allows user accounts to be in charge of multiple staff members\n\t\t\t- what this means, is that you can configure which staff members the user can act on behalf\n\t\t\tof when entering time, invoices or other records.</p>";
     print "<p>This feature is useful for doing things such as assigning a secretary to be able to fill\n\t\t\tin timesheet for both themselves and their manager, or allowing accounting staff to be\n\t\t\table to edit all staff member's timesheets in order to correct mistakes at billing time.</p>";
     // display table
     if (!$this->obj_table->data_num_rows) {
         format_msgbox("info", "<p>This user currently has no staff access rights.</p>");
     } else {
         // edit link
         $structure = NULL;
         $structure["id"]["value"] = $this->id;
         $structure["staffid"]["column"] = "staffid";
         $this->obj_table->add_link("full details", "user/user-staffaccess-edit.php", $structure);
         // display the table
         $this->obj_table->render_table_html();
     }
     // add link
     print "<p><a class=\"button\" href=\"index.php?page=user/user-staffaccess-add.php&id=" . $this->id . "\">Add new staff access rights</a></p>";
 }
Example #11
0
 function render_html()
 {
     // title + summary
     print "<h3>NAME SERVERS</h3>";
     print "<p>NamedManager provides group management functions to allow isolation of different groups of Name Servers, so that specific domains can be pushed to specific hosts. This page allows configuration of these domain zones.</p>";
     // table data
     if (!$this->obj_table->data_num_rows) {
         format_msgbox("important", "<p>There are no defined groups.</p>");
     } else {
         // details link
         $structure = NULL;
         $structure["id"]["column"] = "id";
         $this->obj_table->add_link("tbl_lnk_details", "servers/group-view.php", $structure);
         // delete link
         $structure = NULL;
         $structure["id"]["column"] = "id";
         $this->obj_table->add_link("tbl_lnk_delete", "servers/group-delete.php", $structure);
         // display the table
         $this->obj_table->render_table_html();
     }
     // add link
     print "<p><a class=\"button\" href=\"index.php?page=servers/group-add.php\">Add New Server Group</a></p>";
 }
Example #12
0
 function render_html()
 {
     // title
     print "<h3>CUSTOMER PORTAL OPTIONS</h3><br>";
     print "<p>There are various options for the customer portal which can be configured and defined here, such as the customer's login password.</p>";
     // display the form
     $this->obj_form->render_form();
     if (!user_permissions_get("customers_write")) {
         format_msgbox("locked", "<p>Sorry, you do not have permission to edit this customer</p>");
     }
 }
Example #13
0
 function render_html()
 {
     // Title + Summary
     print "<h3>PROJECT DELETE</h3><br>";
     print "<p>This page allows you to delete an unwanted project.</p>";
     // display the form
     $this->obj_form->render_form();
     if ($this->locked) {
         format_msgbox("locked", "<p>This project now has time booked to it and can not be deleted. If the project has been finished, you can close it by setting the End Date field on the details page.</p>");
     }
 }
Example #14
0
 function render_html()
 {
     // title + summary
     print "<h3>TIME REGISTRATION - " . date("l d F Y", mktime(0, 0, 0, $this->date_split[1], $this->date_split[2], $this->date_split[0])) . "</h3><br>";
     // links
     $date_previous = mktime(0, 0, 0, $this->date_split[1], $this->date_split[2] - 1, $this->date_split[0]);
     $date_previous = date("Y-m-d", $date_previous);
     $date_next = mktime(0, 0, 0, $this->date_split[1], $this->date_split[2] + 1, $this->date_split[0]);
     $date_next = date("Y-m-d", $date_next);
     print "<p><b>";
     print "<a class=\"button\" href=\"index.php?page=timekeeping/timereg-day.php&date={$date_previous}&employeeid=" . $this->employeeid . "\">&lt;&lt; Previous Day</a>";
     if ($this->config_timesheet_booktofuture == "disabled") {
         if (time_date_to_timestamp($date_next) < time()) {
             print " <a class=\"button\" href=\"index.php?page=timekeeping/timereg-day.php&date={$date_next}&employeeid=" . $this->employeeid . "\">Next Day &gt;&gt;</a>";
         }
     } else {
         print " <a class=\"button\" href=\"index.php?page=timekeeping/timereg-day.php&date={$date_next}&employeeid=" . $this->employeeid . "\">Next Day &gt;&gt;</a>";
     }
     print "</b></p><br>";
     // Employee selection form
     //
     // we use a custom form display method here, since the normal form
     // class will draw a fully styled form in a table.
     //
     if ($this->employeeid) {
         print "<table class=\"table_highlight\" width=\"100%\"><tr><td width=\"100%\">";
     } else {
         print "<table class=\"table_highlight_important\" width=\"100%\"><tr><td width=\"100%\">";
     }
     print "<form method=\"get\" action=\"index.php\">";
     print "<p><b>Select an employee to view:</b></p>";
     $this->obj_form_employee->render_field("employeeid");
     $this->obj_form_employee->render_field("date");
     $this->obj_form_employee->render_field("page");
     $this->obj_form_employee->render_field("submit");
     print "</form>";
     print "</td></tr></table><br>";
     if ($this->employeeid) {
         if (!$this->obj_table_day->data_num_rows) {
             format_msgbox("info", "<p><b>There is currently no time registered to this day.</b></p>");
         } else {
             if (user_permissions_staff_get("timereg_write", $this->employeeid)) {
                 // edit link
                 $structure = NULL;
                 $structure["id"]["column"] = "id";
                 $structure["date"]["value"] = $this->date;
                 $this->obj_table_day->add_link("edit", "timekeeping/timereg-day-edit.php", $structure);
                 // delete link
                 $structure = NULL;
                 $structure["id"]["column"] = "id";
                 $structure["date"]["value"] = $this->date;
                 $structure["full_link"] = "yes";
                 $this->obj_table_day->add_link("delete", "timekeeping/timereg-day-delete-process.php", $structure);
             }
             // display table
             $this->obj_table_day->render_table_html();
         }
         print "<table width=\"100%\">";
         // add time link
         if (user_permissions_staff_get("timereg_write", $this->employeeid)) {
             print "<td align=\"left\" valign=\"top\"><p><a class=\"button\" href=\"index.php?page=timekeeping/timereg-day-edit.php&date=" . $this->date . "&employeeid=" . $this->employeeid . "\">Add new time entry</a></p></td>";
         } else {
             print "<p><i>You have read-only access to this employee and therefore can not add any more time.</i></p>";
         }
         // display CSV/PDF download link
         if ($this->obj_table_day->data_num_rows) {
             print "<td align=\"right\">";
             print "<p><a class=\"button_export\" href=\"index-export.php?mode=csv&page=timekeeping/timereg-day.php&date=" . $this->date . "&employeeid=" . $this->employeeid . "\">Export as CSV</a></p>";
             print "<p><a class=\"button_export\" href=\"index-export.php?mode=pdf&page=timekeeping/timereg-day.php&date=" . $this->date . "&employeeid=" . $this->employeeid . "\">Export as PDF</a></p>";
             print "</td>";
         }
         print "</table>";
     }
 }
 function render_html()
 {
     log_debug("invoice_form_delete", "Executing render_html()");
     // display form
     $this->obj_form->render_form();
     // display any reasons to prevent deletion
     if ($this->locked) {
         format_msgbox("locked", "<p>This invoice has been locked and can no longer be removed.</p>");
     } elseif ($this->amount_paid > 0) {
         format_msgbox("info", "<p>Please note: this invoice has had payments made against it, deleting the invoice will delete all record of the payment.</p>");
     }
 }
Example #16
0
 function render_html()
 {
     // Title + Summary
     print "<h3>DELETE ACCOUNT</h3><br>";
     print "<p>This page allows you to delete an unwanted account, provided that account has no transactions in it.</p>";
     // display the form
     $this->obj_form->render_form();
     if ($this->locked) {
         format_msgbox("locked", "<p>This account is locked and can not be removed.</p>");
     }
 }
 function render_html()
 {
     // heading
     print "<h3>CUSTOMER SERVICE HISTORY</h3>";
     print "<p>This page displays all the periods of this service, showing when the service was active and when it has been billed.</p>";
     $this->obj_customer->service_render_summarybox();
     if (!$this->obj_table->data_num_rows) {
         format_msgbox("info", "<p>This service does not have any history - this is normal when the service has just recently been added.</p>");
     } else {
         // get the unit name if applicable
         if (preg_match("/^[0-9]*\$/", $this->obj_customer->obj_service->data["units"])) {
             $unitname = sql_get_singlevalue("SELECT name as value FROM service_units WHERE id='" . $this->obj_customer->obj_service->data["units"] . "'");
         }
         // run through all the data rows to make custom changes
         for ($i = 0; $i < $this->obj_table->data_num_rows; $i++) {
             // make the invoice number a hyperlink
             if ($this->obj_table->data[$i]["code_invoice"] && user_permissions_get("accounts_ar_view")) {
                 $this->obj_table->data[$i]["code_invoice"] = "<a href=\"index.php?page=accounts/ar/invoice-view.php&id=" . $this->obj_table->data[$i]["invoiced_plan"] . "\">AR " . $this->obj_table->data[$i]["code_invoice"] . "</a>";
             }
             // tick the paid column if the invoice has been paid off completely
             if (!empty($this->obj_table->data[$i]["invoiced"])) {
                 if ($this->obj_table->data[$i]["amount_total"] == $this->obj_table->data[$i]["amount_paid"]) {
                     $this->obj_table->data[$i]["paid"] = 1;
                 }
             }
             // provide service-type specific options for displaying and querying usage.
             switch ($this->obj_table->data[$i]["service_type"]) {
                 case "phone_trunk":
                 case "phone_tollfree":
                 case "phone_single":
                     // display a "view call records" link which looks up the historical
                     // call data to fetch pricing
                     $this->obj_table->data[$i]["usage_summary"] = "<a href=\"index.php?page=customers/service-history-cdr.php&id_customer=" . $this->obj_customer->id . "&id_service_customer=" . $this->obj_customer->id_service_customer . "&id_service_period=" . $this->obj_table->data[$i]["id"] . "\">View Call Records</a>";
                     break;
                 case "data_traffic":
                 case "generic_with_usage":
                     if ($i == $this->obj_table->data_num_rows - 1) {
                         // if this is the most recent period, then add a check link next to the usage amount
                         $this->obj_table->data[$i]["usage_summary"] = $this->obj_table->data[$i]["usage_summary"] . " {$unitname} <a href=\"customers/services-checkusage-process.php?id_customer=" . $this->obj_customer->id . "&id_service_customer=" . $this->obj_customer->id_service_customer . "\">(get latest)</a>";
                     } else {
                         // displau usage amount
                         $this->obj_table->data[$i]["usage_summary"] = $this->obj_table->data[$i]["usage_summary"] . " {$unitname}";
                     }
                     break;
             }
             // end of service type
         }
         // display the table
         $this->obj_table->render_table_html();
         // display CSV/PDF download link
         print "<p align=\"right\"><a class=\"button_export\" href=\"index-export.php?mode=csv&page=customers/service-history.php&id_customer=" . $this->obj_customer->id . "&id_service_customer=" . $this->obj_customer->id_service_customer . "\">Export as CSV</a></p>";
         print "<p align=\"right\"><a class=\"button_export\" href=\"index-export.php?mode=pdf&page=customers/service-history.php&id_customer=" . $this->obj_customer->id . "&id_service_customer=" . $this->obj_customer->id_service_customer . "\">Export as PDF</a></p>";
     }
 }
Example #18
0
 function render_html()
 {
     // heading
     print "<h3>UNBILLED TIME</h3>";
     print "<p>This page shows all time which has not yet been added to an invoice for any non-internal projects.</p>";
     // display options form
     $this->obj_table->render_options_form();
     // display notice about limited access if suitable
     if ($this->access_staff_ids) {
         $sql_obj = new sql_query();
         $sql_obj->string = "SELECT id FROM staff";
         $sql_obj->execute();
         $sql_obj->num_rows();
         if (count($this->access_staff_ids) != $sql_obj->num_rows()) {
             format_msgbox("info", "<p>Please note that the following list of unbilled hours only included the specific users whom you have been configured to view - to view all employees, ask your admin to enable the timekeeping_all_view permission.</p>");
             print "<br>";
         }
     }
     // Display table data
     if (!$this->obj_table->data_num_rows) {
         format_msgbox("info", "<p>There is currently no unbilled time matching your search filter options.</p>");
     } else {
         // time entry link
         if ($this->obj_table->filter["filter_groupby"]["defaultvalue"] == "none") {
             $structure = NULL;
             $structure["id"]["column"] = "id";
             $structure["date"]["column"] = "date";
             $structure["employeeid"]["column"] = "employeeid";
             $this->obj_table->add_link("tbl_lnk_view_timeentry", "timekeeping/timereg-day-edit.php", $structure);
         }
         // TODO:
         // something about these two links below cause the table formatting to be slightly broken in the far right (empty?) column
         // problem occurs with either link
         //
         // project time group
         $structure = NULL;
         $structure["id"]["column"] = "projectid";
         $structure["groupid"]["column"] = "timegroupid";
         $structure["column"] = "time_group";
         $this->obj_table->add_link("tbl_lnk_groupid", "projects/timebilled-edit.php", $structure);
         // project/phase ID
         $structure = NULL;
         $structure["id"]["column"] = "projectid";
         $structure["column"] = "name_phase";
         $this->obj_table->add_link("tbl_lnk_project", "projects/timebooked.php", $structure);
         $this->obj_table->render_table_html();
         // display CSV/PDF download link
         print "<p align=\"right\"><a class=\"button_export\" href=\"index-export.php?mode=csv&page=timekeeping/unbilled.php\">Export as CSV</a></p>";
         print "<p align=\"right\"><a class=\"button_export\" href=\"index-export.php?mode=pdf&page=timekeeping/unbilled.php\">Export as PDF</a></p>";
     }
 }
Example #19
0
 function render_html()
 {
     // Title + Summary
     print "<h3>TRANSACTION DETAILS</h3><br>";
     print "<p>This page allows you to view and adjust the selected transaction.</p>";
     /*
     	Display the form
     
     	We have to do this manually in order to be able to handle all the transaction rows
     */
     // start form/table structure
     print "<form method=\"" . $this->obj_form->method . "\" action=\"" . $this->obj_form->action . "\" class=\"form_standard\">";
     print "<table class=\"form_table\" width=\"100%\">";
     // general form fields
     print "<tr class=\"header\">";
     print "<td colspan=\"2\"><b>" . language_translate_string($_SESSION["user"]["lang"], "general_ledger_transaction_details") . "</b></td>";
     print "</tr>";
     $this->obj_form->render_row("code_gl");
     $this->obj_form->render_row("date_trans");
     $this->obj_form->render_row("employeeid");
     $this->obj_form->render_row("description");
     $this->obj_form->render_row("description_useall");
     $this->obj_form->render_row("notes");
     print "</tr>";
     /*
     	Transaction Rows
     
     	This section is the most complex part of the form, where we add new rows to the form
     	for each transactions.
     */
     print "<tr class=\"header\">";
     print "<td colspan=\"2\"><b>" . language_translate_string($_SESSION["user"]["lang"], "general_ledger_transaction_rows") . "</b></td>";
     print "</tr>";
     print "<tr>";
     print "<td colspan=\"2\">";
     // header
     print "<table width=\"100%\">";
     print "<tr>";
     print "<td width=\"100%\" colspan=\"5\"><p>Enter all the parts of the transaction in the fields below. Because this is a double-entry accounting system, remember that you need to credit the source account and then debit the destination account, and that the totals for both the credit and debit accounts needs to match.</p></td>";
     print "</tr>";
     print "<tr>";
     print "<td width=\"20%\"><b>Account</b></td>";
     print "<td width=\"15%\"><b>Debit (dest)</b></td>";
     print "<td width=\"15%\"><b>Credit (src)</b></td>";
     print "<td width=\"15%\"><b>Source</b></td>";
     print "<td width=\"35%\"><b>Description</b></td>";
     print "</tr>";
     // display all the rows
     for ($i = 0; $i < $this->num_trans; $i++) {
         if (isset($_SESSION["error"]["trans_" . $i . "-error"])) {
             print "<tr class=\"form_error\">";
         } else {
             print "<tr class=\"table_highlight\">";
         }
         // account
         print "<td width=\"20%\" valign=\"top\">";
         $this->obj_form->render_field("trans_" . $i . "_account");
         print "</td>";
         // debit
         print "<td width=\"15%\" valign=\"top\">";
         $this->obj_form->render_field("trans_" . $i . "_debit");
         print "</td>";
         // credit
         print "<td width=\"15%\" valign=\"top\">";
         $this->obj_form->render_field("trans_" . $i . "_credit");
         print "</td>";
         // source
         print "<td width=\"15%\" valign=\"top\">";
         $this->obj_form->render_field("trans_" . $i . "_source");
         print "</td>";
         // description
         print "<td width=\"35%\" valign=\"top\">";
         $this->obj_form->render_field("trans_" . $i . "_description");
         print "</td>";
         print "</tr>";
     }
     /*
     	Totals Display
     */
     print "<tr class=\"table_highlight\">";
     // joining/filler columns
     print "<td width=\"20%\"></td>";
     // total debit
     print "<td width=\"15%\">";
     $this->obj_form->render_field("total_debit");
     print "</td>";
     // total credit
     print "<td width=\"15%\">";
     $this->obj_form->render_field("total_credit");
     print "</td>";
     // joining/filler columns
     print "<td width=\"15%\"></td>";
     print "<td width=\"35%\"></td>";
     print "</tr>";
     print "</table>";
     print "</td>";
     print "</tr>";
     // hidden fields
     $this->obj_form->render_field("id_transaction");
     $this->obj_form->render_field("num_trans");
     $this->obj_form->render_field("money_format");
     // form submit
     print "<tr class=\"header\">";
     print "<td colspan=\"2\"><b>" . language_translate_string($_SESSION["user"]["lang"], "general_ledger_transaction_submit") . "</b></td>";
     print "</tr>";
     if (user_permissions_get("accounts_gl_write") && !$this->locked) {
         $this->obj_form->render_row("submit");
     }
     // end table + form
     print "</table>";
     print "</form>";
     if (!user_permissions_get("accounts_gl_write")) {
         format_msgbox("locked", "<p>Sorry, you do not have permission to adjust this transaction</p>");
     } elseif ($this->locked) {
         format_msgbox("locked", "<p>This transaction has been locked and can no longer be adjusted.</p>");
     }
 }
 function render_html()
 {
     // title and summary
     print "<h3>RATE TABLE DELETE</h3><br>";
     print "<p>Use this page to delete an unused rate table.</p>";
     // display the form
     $this->obj_form->render_form();
     if ($this->locked) {
         format_msgbox("locked", "<p>Sorry, the rate table can not be deleted as it is in use by some services.</p>");
     }
 }
Example #21
0
 function render_html()
 {
     // title
     print "<h3>CUSTOMER DETAILS</h3><br>";
     print "<p>This page allows you to view and adjust the customer's records.</p>";
     print "<form class=\"form_standard\" action=\"" . $this->obj_form->action . "\" method=\"" . $this->obj_form->method . "\" enctype=\"multipart/form-data\">";
     print "<table class=\"form_table\" width=\"100%\">";
     //customer details
     print "<tr class=\"header\">";
     print "<td colspan=\"2\"><b>" . lang_trans("customer_view") . "</b></td>";
     print "</tr>";
     $this->obj_form->render_row("code_customer");
     $this->obj_form->render_row("name_customer");
     $this->obj_form->render_row("date_start");
     $this->obj_form->render_row("date_end");
     print "</table>";
     print "<br />";
     //customer contacts
     print "<table id=\"customer_contacts_table\" class=\"form_table\" width=\"100%\">";
     print "<tr class=\"header\">";
     print "<td colspan=\"2\"><b>" . lang_trans("customer_contacts") . "</b></td>";
     print "</tr>";
     for ($i = 0; $i < $this->num_contacts; $i++) {
         print "<tr >";
         print "<td>";
         if (isset($_SESSION["error"]["contact_" . $i . "-error"])) {
             print "<table id=\"contact_box_{$i}\" class=\"error_box contact_box\">";
         } else {
             print "<table id=\"contact_box_{$i}\" class=\"contact_box\">";
         }
         print "<tr>";
         //contact name
         print "<td width=\"25%\">";
         $this->obj_form->render_field("contact_id_{$i}");
         if (isset($_SESSION["error"]["contact_" . $i . "-error"])) {
             print "<span>";
         } else {
             print "<span class=\"hidden_text\">";
         }
         print "<label for=\"contact_{$i}\" >Name: </label><br />";
         print "</span>";
         $this->obj_form->render_field("contact_{$i}");
         if (isset($_SESSION["error"]["contact_" . $i . "-error"])) {
             print "<span>";
         } else {
             print "<span class=\"hidden_text\">";
         }
         print "<label for=\"role_{$i}\">Role: </label><br />";
         print "</span>";
         $this->obj_form->render_field("role_{$i}");
         $this->obj_form->render_field("num_records_{$i}");
         print "<div ";
         if (isset($_SESSION["error"]["contact_" . $i . "-error"])) {
             print "class=\"hidden_text\" ";
         }
         print "id=\"contact_text_{$i}\"><b>" . lang_trans($this->obj_form->structure["contact_{$i}"]["defaultvalue"]) . "</b>";
         print "<br />(" . lang_trans($this->obj_form->structure["role_{$i}"]["defaultvalue"]) . ")</div>";
         print "</td>";
         //delete contact link
         print "<td width=\"75%\" class=\"delete_contact_cell\">";
         $this->obj_form->render_field("delete_contact_{$i}");
         if ($i == 0) {
             print "&nbsp;";
         } else {
             print "<a id=\"delete_contact_{$i}\" href=\"\">delete contact...</a>";
         }
         print "</td>";
         print "</tr>";
         print "<tr>";
         //contact description
         print "<td width=\"25%\" class=\"description_cell\">";
         if (isset($_SESSION["error"]["contact_" . $i . "-error"])) {
             print "<span>";
         } else {
             print "<span class=\"hidden_text\">";
         }
         print "<label for=\"description_{$i}\">Description: </label><br />";
         print "</span>";
         $this->obj_form->render_field("description_{$i}");
         print "<p class=\"";
         if ($_SESSION["error"]["contact_" . $i . "-error"]) {
             print "hidden_text ";
         }
         print "contact_description\" id=\"description_text_{$i}\">" . $this->obj_form->structure["description_{$i}"]["defaultvalue"] . "</p>";
         if (isset($_SESSION["error"]["contact_" . $i . "-error"])) {
             print "<p class=\"change_contact\"><a id=\"change_contact_{$i}\" href=\"\" >done</a></p>";
         } else {
             print "<p class=\"change_contact\"><a id=\"change_contact_{$i}\" href=\"\" >change...</a></p>";
         }
         print "<input type=\"hidden\" name=\"change_contact_{$i}\" value=\"";
         if ($_SESSION["error"]["contact_" . $i . "-error"]) {
             print "open\" />";
         } else {
             print "closed\" />";
         }
         print "</td>";
         //contact records table
         print "<td width=\"75%\"  align=\"right\">";
         print "<table id=\"records_table_{$i}\" class=\"records_table\">";
         if ($this->obj_form->structure["num_records_{$i}"]["defaultvalue"] > 0) {
             for ($j = 0; $j < $this->obj_form->structure["num_records_{$i}"]["defaultvalue"]; $j++) {
                 print "<tr id=\"contact_" . $i . "_record_row_" . $j . "\">";
                 //record type
                 print "<td>";
                 $this->obj_form->render_field("contact_" . $i . "_record_id_" . $j);
                 $this->obj_form->render_field("contact_" . $i . "_type_" . $j);
                 $type = $this->obj_form->structure["contact_" . $i . "_type_" . $j]["defaultvalue"];
                 if ($type == "phone") {
                     print "<b>P</b>";
                 } elseif ($type == "fax") {
                     print "<b>F</b>";
                 } elseif ($type == "mobile") {
                     print "<b>M</b>";
                 } elseif ($type == "email") {
                     print "<b>E</b>";
                 }
                 print "</td>";
                 //record label
                 print "<td>";
                 $this->obj_form->render_field("contact_" . $i . "_label_" . $j);
                 print $this->obj_form->structure["contact_" . $i . "_label_" . $j]["defaultvalue"];
                 print "</td>";
                 //record detail
                 print "<td>";
                 $this->obj_form->render_field("contact_" . $i . "_detail_" . $j);
                 print "</td>";
                 //delete record link
                 print "<td class=\"delete_record\">";
                 $this->obj_form->render_field("contact_" . $i . "_delete_" . $j);
                 print "<a id=\"contact_" . $i . "_delete_" . $j . "\" href=\"\">delete</a>";
                 print "</td>";
                 print "</tr>";
             }
         }
         print "</table>";
         print "<br />";
         //add record form
         print "<div class=\"add_record\">";
         print "<div id=\"add_record_link_{$i}\"><a id=\"add_record_{$i}\" href=\"\">Add Record</a></div>";
         print "<div class=\"add_record_form\" id=\"add_record_form_{$i}\">";
         print "<table class=\"add_record_table\">";
         print "<tr>";
         print "<td colspan=2><b>Add Record</b></td>";
         print "</tr><tr>";
         print "<td>Record Type</td>";
         print "<td><select name=\"new_record_type_{$i}\">";
         print "<option value=\"phone\">Phone</option>";
         print "<option value=\"fax\">Fax</option>";
         print "<option value=\"mobile\">Mobile</option>";
         print "<option value=\"email\">Email</option>";
         print "</select></td>";
         print "</tr><tr>";
         print "<td>Label</td>";
         print "<td><input name=\"new_record_label_{$i}\" /></td>";
         print "</tr><tr>";
         print "<td>Detail</td>";
         print "<td><input name=\"new_record_detail_{$i}\" /></td>";
         print "</tr><tr>";
         print "<td colspan=2 class=\"insert_new_record\"><a class=\"disabled_link button_small\" id=\"insert_record_{$i}\" href=\"\">Insert</a></td></tr>";
         print "</table>";
         print "</div>";
         print "</div>";
         print "</td>";
         print "</tr>";
         print "</table>";
         print "</td>";
         print "</tr>";
     }
     print "<tr id=\"add_new_contact_row\">";
     print "<td>";
     print "<div class=\"add_contact_div\"><a href=\"\" id=\"add_new_contact\">Add New Contact</a></div>";
     print "</td>";
     print "</tr>";
     print "</table>";
     print "<br />";
     //customer taxes
     print "<table class=\"form_table\" width=\"100%\">";
     print "<tr class=\"header\">";
     print "<td colspan=\"2\"><b>" . lang_trans("customer_taxes") . "</b></td>";
     print "</tr>";
     $this->obj_form->render_row("tax_number");
     $this->obj_form->render_row("tax_default");
     $this->obj_form->render_row("tax_message");
     for ($i = 0; $i < count($this->tax_array); $i++) {
         $this->obj_form->render_row($this->tax_array[$i]);
     }
     print "</table>";
     print "<br />";
     //customer purchase
     print "<table class=\"form_table\" width=\"100%\">";
     print "<tr class=\"header\">";
     print "<td colspan=\"2\"><b>" . lang_trans("customer_purchase") . "</b></td>";
     print "</tr>";
     $this->obj_form->render_row("discount");
     print "</table>";
     print "<br />";
     //billing address
     print "<table class=\"form_table\" width=\"100%\">";
     print "<tr class=\"header\">";
     print "<td colspan=\"2\"><b>" . lang_trans("address_billing") . "</b></td>";
     print "</tr>";
     $this->obj_form->render_row("address1_street");
     $this->obj_form->render_row("address1_city");
     $this->obj_form->render_row("address1_state");
     $this->obj_form->render_row("address1_country");
     $this->obj_form->render_row("address1_zipcode");
     print "</table>";
     print "<br />";
     //shipping address
     print "<table class=\"form_table\" width=\"100%\">";
     print "<tr class=\"header\">";
     print "<td colspan=\"2\"><b>" . lang_trans("address_shipping") . "</b></td>";
     print "</tr>";
     $this->obj_form->render_row("address1_same_as_2");
     $this->obj_form->render_row("address2_street");
     $this->obj_form->render_row("address2_city");
     $this->obj_form->render_row("address2_state");
     $this->obj_form->render_row("address2_country");
     $this->obj_form->render_row("address2_zipcode");
     print "</table>";
     print "<br />";
     //billing options
     print "<table class=\"form_table\" width=\"100%\">";
     print "<tr class=\"header\">";
     print "<td colspan=\"2\"><b>" . lang_trans("billing_options") . "</b></td>";
     print "</tr>";
     $this->obj_form->render_row("billing_method");
     $this->obj_form->render_row("billing_direct_debit");
     print "</table>";
     print "<br />";
     //reseller options
     print "<table class=\"form_table\" width=\"100%\">";
     print "<tr class=\"header\">";
     print "<td colspan=\"2\"><b>" . lang_trans("reseller_options") . "</b></td>";
     print "</tr>";
     $this->obj_form->render_row("reseller_customer");
     $this->obj_form->render_row("reseller_id");
     $this->obj_form->render_row("reseller_message");
     print "</table>";
     print "<br />";
     if (user_permissions_get("customers_write")) {
         print "<table class=\"form_table\" width=\"100%\">";
         print "<tr class=\"header\">";
         print "<td colspan=\"2\"><b>" . lang_trans("submit") . "</b></td>";
         print "</tr>";
         $this->obj_form->render_row("submit");
         print "</table>";
     } else {
         format_msgbox("locked", "<p>Sorry, you do not have permission to edit this customer</p>");
     }
     $this->obj_form->render_field("id_customer");
     $this->obj_form->render_field("num_contacts");
     print "</form>";
 }
Example #22
0
function credit_render_invoiceselect($type, $id, $processpage)
{
    log_debug("inc_credits", "credit_render_summarybox({$type}, {$id})");
    // fetch credit information
    $sql_obj = new sql_query();
    $sql_obj->prepare_sql_settable("account_{$type}");
    if ($type == "ar_credit") {
        $sql_obj->prepare_sql_addfield("date_sent");
        $sql_obj->prepare_sql_addfield("sentmethod");
    }
    $sql_obj->prepare_sql_addfield("code_credit");
    $sql_obj->prepare_sql_addfield("amount_total");
    $sql_obj->prepare_sql_addfield("invoiceid");
    $sql_obj->prepare_sql_addfield("locked");
    $sql_obj->prepare_sql_addwhere("id='{$id}'");
    $sql_obj->prepare_sql_setlimit("1");
    $sql_obj->generate_sql();
    $sql_obj->execute();
    if ($sql_obj->num_rows()) {
        $sql_obj->fetch_array();
        if ($sql_obj->data[0]["locked"]) {
            // credit note is locked, nothing todo
            return 1;
        }
        /*
        	Select Invoice Items
        */
        $invoice_type = "unknown";
        if ($type == "ar_credit") {
            $invoice_type = "ar";
        } elseif ($type == "ap_credit") {
            $invoice_type = "ap";
        }
        $sql_invoice_obj = new sql_query();
        $sql_invoice_obj->string = "SELECT id as itemid, type, customid, chartid, quantity, units, price, amount, description FROM account_items WHERE invoiceid='" . $sql_obj->data[0]["invoiceid"] . "' AND invoicetype='" . $invoice_type . "' AND type!='payment' AND type!='tax'";
        $sql_invoice_obj->execute();
        if ($sql_invoice_obj->num_rows()) {
            $sql_invoice_obj->fetch_array();
        }
        /*
        	Create Form
        */
        $obj_invoice_form = new form_input();
        $obj_invoice_form->formname = $type . "_invoiceselect";
        $obj_invoice_form->language = $_SESSION["user"]["lang"];
        $obj_invoice_form->action = "index.php";
        $obj_invoice_form->method = "GET";
        // ID
        $structure = NULL;
        $structure["fieldname"] = "id";
        $structure["type"] = "hidden";
        $structure["defaultvalue"] = $id;
        $obj_invoice_form->add_input($structure);
        $structure = NULL;
        $structure["fieldname"] = "page";
        $structure["type"] = "hidden";
        $structure["defaultvalue"] = $processpage;
        $obj_invoice_form->add_input($structure);
        // submit
        $structure = NULL;
        $structure["fieldname"] = "submit";
        $structure["type"] = "submit";
        $structure["defaultvalue"] = "submit_add_credit_item";
        $obj_invoice_form->add_input($structure);
        /*
        	Generate Items Radio Array
        */
        if ($sql_invoice_obj->num_rows()) {
            $structure = NULL;
            $structure["fieldname"] = "invoice_item";
            $structure["type"] = "radio";
            foreach ($sql_invoice_obj->data as $data_invoice) {
                $description = $data_invoice["description"];
                switch ($data_invoice["type"]) {
                    case "standard":
                        $description = sql_get_singlevalue("SELECT CONCAT_WS('--', code_chart, description) as value FROM account_charts WHERE id='" . $data_invoice["chartid"] . "' LIMIT 1");
                        break;
                    case "product":
                        $description = sql_get_singlevalue("SELECT CONCAT_WS('--', code_product, name_product) as value FROM products WHERE id='" . $data_invoice["customid"] . "' LIMIT 1");
                        break;
                    case "service":
                    case "service_usage":
                        $description = sql_get_singlevalue("SELECT name_service as value FROM services WHERE id='" . $data_invoice["customid"] . "' LIMIT 1");
                        break;
                    default:
                        $description = "unknown item";
                        break;
                }
                $description .= " <i>" . $data_invoice["description"] . "</i>";
                $description .= " [" . format_money($data_invoice["amount"]) . " exc tax]";
                $structure["values"][] = $data_invoice["itemid"];
                $structure["translations"][$data_invoice["itemid"]] = $description;
            }
            $obj_invoice_form->add_input($structure);
        }
        /*
        	Render Form
        */
        if ($sql_invoice_obj->num_rows()) {
            print "<table width=\"100%\" class=\"table_highlight_info\">";
            print "<tr>";
            print "<td>";
            print "<p><b>Select an item to be credited from the selected invoice - note that amounts can be varied once selected:</b></p>";
            print "<form method=\"" . $obj_invoice_form->method . "\" action=\"" . $obj_invoice_form->action . "\">";
            $obj_invoice_form->render_field("invoice_item");
            print "<br>";
            $obj_invoice_form->render_field("id");
            $obj_invoice_form->render_field("page");
            $obj_invoice_form->render_field("submit");
            print "</form>";
            print "</td>";
            print "</tr>";
            print "</table>";
        } else {
            /*
            	No invoice items!
            */
            format_msgbox("important", "<p>Unable to add any items to this credit note - the selected invoice has no items on it.</p>");
        }
        print "<br>";
    }
}
 function render_html()
 {
     // heading
     print "<h3>SERVICE CALL RECORD LOGS</h3>";
     print "<p>This page shows all the call records for the selected service period and the prices associated with each call. Note that the seconds shown are the number of billable seconds, however this doesn't shown any seconds that were rounded up to whole minutes for billing purposes.</p>";
     // summary boxes
     $this->obj_customer->service_render_summarybox();
     // options table
     $this->obj_table->render_options_form();
     // data
     if (!$this->obj_table->data_num_rows) {
         format_msgbox("info", "<p>This period does not have any records attached to it, this can often happen with the current ongoing period, as depending on the method of import, usage records may only be usable after the first month.</p>");
     } else {
         // display the table
         $this->obj_table->render_table_html();
         // display CSV/PDF download link
         print "<p align=\"right\"><a class=\"button_export\" href=\"index-export.php?mode=csv&page=customers/service-history-cdr-export.php&id_customer=" . $this->obj_customer->id . "&id_service_customer=" . $this->obj_customer->id_service_customer . "&id_service_period=" . $this->id_service_period . "\">CDR Export Mode</a></p>";
         print "<br>";
         print "<p align=\"right\"><a class=\"button_export\" href=\"index-export.php?mode=csv&page=customers/service-history-cdr.php&id_customer=" . $this->obj_customer->id . "&id_service_customer=" . $this->obj_customer->id_service_customer . "&id_service_period=" . $this->id_service_period . "\">Export as CSV</a></p>";
         print "<p align=\"right\"><a class=\"button_export\" href=\"index-export.php?mode=pdf&page=customers/service-history-cdr.php&id_customer=" . $this->obj_customer->id . "&id_service_customer=" . $this->obj_customer->id_service_customer . "&id_service_period=" . $this->id_service_period . "\">Export as PDF</a></p>";
     }
 }
Example #24
0
 function render_html()
 {
     // heading
     print "<h3>LIST OF ACCOUNTS PAYABLE INVOICES</h3><br><br>";
     // display options form
     $this->obj_table->render_options_form();
     // display table
     if (!count($this->obj_table->columns)) {
         format_msgbox("important", "<p>Please select some valid options to display.</p>");
     } elseif (!$this->obj_table->data_num_rows) {
         $sql_obj = new sql_query();
         $sql_obj->string = "SELECT id FROM account_ap LIMIT 1";
         $sql_obj->execute();
         if ($sql_obj->num_rows()) {
             format_msgbox("important", "<p>Your current filter options do not match to any invoices.</p>");
         } else {
             format_msgbox("info", "<p>You currently have no AP invoices in your database.</p>");
         }
     } else {
         // details link
         $structure = NULL;
         $structure["id"]["column"] = "id";
         $this->obj_table->add_link("details", "accounts/ap/invoice-view.php", $structure);
         // items link
         $structure = NULL;
         $structure["id"]["column"] = "id";
         $this->obj_table->add_link("items", "accounts/ap/invoice-items.php", $structure);
         // payments link
         $structure = NULL;
         $structure["id"]["column"] = "id";
         $this->obj_table->add_link("payments", "accounts/ap/invoice-payments.php", $structure);
         // display the table
         $this->obj_table->render_table_html();
         // display CSV/PDF download link
         print "<p align=\"right\"><a class=\"button_export\" href=\"index-export.php?mode=csv&page=accounts/ap/ap.php\">Export as CSV</a></p>";
         print "<p align=\"right\"><a class=\"button_export\" href=\"index-export.php?mode=pdf&page=accounts/ap/ap.php\">Export as PDF</a></p>";
     }
 }
Example #25
0
 function render_html()
 {
     log_debug("taxes_report_transactions", "Executing render_html()");
     // display options form
     $this->obj_table->render_options_form();
     /*
     	Turn the code_invoice field into a hyperlink
     
     	Because we want to support both AR and AP links, we don't use the inbuilt table
     	class functions.
     
     	This is done in render_html rather than execute to prevent breaking CSV output.
     */
     for ($i = 0; $i < $this->obj_table->data_num_rows; $i++) {
         if ($this->obj_table->data[$i]["name_vendor"] == "AR Credit") {
             $this->obj_table->data[$i]["code_invoice"] = "<a href=\"index.php?page=accounts/ar/credit-view.php&id=" . $this->obj_table->data[$i]["id"] . "\">" . $this->obj_table->data[$i]["code_invoice"] . "</a>";
         } elseif ($this->obj_table->data[$i]["name_customer"] == "AP Credit") {
             $this->obj_table->data[$i]["code_invoice"] = "<a href=\"index.php?page=accounts/ap/credit-view.php&id=" . $this->obj_table->data[$i]["id"] . "\">" . $this->obj_table->data[$i]["code_invoice"] . "</a>";
         } elseif ($this->type == "ap") {
             $this->obj_table->data[$i]["code_invoice"] = "<a href=\"index.php?page=accounts/ap/invoice-view.php&id=" . $this->obj_table->data[$i]["id"] . "\">" . $this->obj_table->data[$i]["code_invoice"] . "</a>";
         } else {
             $this->obj_table->data[$i]["code_invoice"] = "<a href=\"index.php?page=accounts/ar/invoice-view.php&id=" . $this->obj_table->data[$i]["id"] . "\">" . $this->obj_table->data[$i]["code_invoice"] . "</a>";
         }
     }
     // Display Table
     // Note that the render_table_html function also performs the total row and total column generation tasks.
     if (!$this->obj_table->filter["filter_date_start"]["defaultvalue"] || !$this->obj_table->filter["filter_date_end"]["defaultvalue"]) {
         format_msgbox("important", "<p><b>Please select a time period to display using the filter options above.</b></p>");
         return 0;
     } elseif (!$this->obj_table->data_num_rows) {
         format_msgbox("important", "<p>No records matching specified date period found.</p>");
     } else {
         $this->obj_table->render_table_html();
     }
     return 1;
 }
 function render_html()
 {
     // heading
     print "<h3>INCOME STATEMENT</h3>";
     print "<p>This report shows income and expenses for the selected period.</p>";
     /*
     	Date selection form
     */
     print "<form method=\"" . $this->obj_form->method . "\" action=\"" . $this->obj_form->action . "\" class=\"form_standard\">";
     $this->obj_form->render_field("page");
     print "<table width=\"100%\" class=\"table_highlight\">";
     print "<tr>";
     $this->obj_form->render_row("date_start");
     $this->obj_form->render_row("date_end");
     $this->obj_form->render_row("mode");
     $this->obj_form->render_row("submit");
     print "</tr>";
     print "</table>";
     print "</form>";
     print "<br>";
     if (!$this->data_income || !$this->data_expense) {
         format_msgbox("important", "<p>No income and/or expense accounts have been configured.</p>");
     } else {
         /*
         	Define template
         */
         // start the html template
         $template_html = new template_engine();
         // load template
         $template_html->prepare_load_template("templates/html/report_incomestatement.html");
         /*
         	Fill in template fields
         */
         // totals
         $template_html->prepare_add_field("amount_total_income", $this->data_totals["income"]);
         $template_html->prepare_add_field("amount_total_expense", $this->data_totals["expense"]);
         $template_html->prepare_add_field("amount_total_final", $this->data_totals["final"]);
         // income data
         $structure_main = NULL;
         foreach ($this->data_income as $itemdata) {
             $structure = array();
             $structure["name_chart"] = $itemdata["code_chart"] . " -- " . $itemdata["description"];
             $structure["amount"] = @format_money($itemdata["amount"]);
             $structure_main[] = $structure;
         }
         $template_html->prepare_add_array("table_income", $structure_main);
         // income data
         $structure_main = NULL;
         foreach ($this->data_expense as $itemdata) {
             $structure = array();
             $structure["name_chart"] = $itemdata["code_chart"] . " -- " . $itemdata["description"];
             $structure["amount"] = @format_money($itemdata["amount"]);
             $structure_main[] = $structure;
         }
         $template_html->prepare_add_array("table_expense", $structure_main);
         /*
         	Output Template
         */
         // fill template
         $template_html->prepare_filltemplate();
         // display html
         foreach ($template_html->processed as $line) {
             print $line;
         }
         // display CSV download link
         print "<p align=\"right\"><a class=\"button_export\" href=\"index-export.php?mode=csv&page=accounts/reports/incomestatement.php\">Export as CSV</a></p>";
         print "<p align=\"right\"><a class=\"button_export\" href=\"index-export.php?mode=pdf&page=accounts/reports/incomestatement.php\">Export as PDF</a></p>";
     }
     // end if accounts exist
 }
Example #27
0
 function render_html()
 {
     // heading
     print "<h3>GENERAL LEDGER</h3>";
     print "<p>This page lists all the transactions in all the accounts.</p>";
     // display options form
     $this->obj_table->render_options_form();
     // display table
     if (!$this->obj_table->filter["filter_date_start"]["defaultvalue"] || !$this->obj_table->filter["filter_date_end"]["defaultvalue"]) {
         format_msgbox("important", "<p><b>Please select a time period to display using the filter options above.</b></p>");
         return 0;
     } else {
         if (!count($this->obj_table->columns)) {
             format_msgbox("important", "<p>Please select some valid options to display.</p>");
         } elseif (!$this->obj_table->data_num_rows) {
             format_msgbox("info", "<p>You currently have no transactions matching the filter options in your database.</p>");
         } else {
             // label all the reference links
             for ($i = 0; $i < count(array_keys($this->obj_table->data)); $i++) {
                 $this->obj_table->data[$i]["code_reference"] = ledger_trans_typelabel($this->obj_table->data[$i]["type"], $this->obj_table->data[$i]["customid"], TRUE);
             }
             // display the table
             $this->obj_table->render_table_html();
             // display CSV/PDF download link
             print "<p align=\"right\"><a class=\"button_export\" href=\"index-export.php?mode=csv&page=accounts/gl/gl.php\">Export as CSV</a></p>";
             print "<p align=\"right\"><a class=\"button_export\" href=\"index-export.php?mode=pdf&page=accounts/gl/gl.php\">Export as PDF</a></p>";
         }
     }
 }
Example #28
0
 function render_html()
 {
     // Title + Summary
     print "<h3>DELETE EMPLOYEE</h3><br>";
     print "<p>This page allows you to delete an unwanted employee. Note that it is only possible to delete a employee if they have had no payments and have not booked any time. If they do, you can not delete the employee, but instead you can disable the employee by setting the date_end field.</p>";
     // display the form
     $this->obj_form->render_form();
     if ($this->locked) {
         format_msgbox("locked", "<p>This employee has made various entries in the billing system and can no-longer be removed. Set the End Date field on the Employee Details page to show that the employee has left instead.</p>");
     }
 }
 function render_html()
 {
     // heading
     print "<h3>CUSTOMER LIST</h3><br><br>";
     print "<p>List of customers with direct debit enabled and a current balance</p>";
     // load options form
     // $this->obj_table_list->render_options_form();
     // display results
     if (!count($this->obj_table_list->columns)) {
         format_msgbox("important", "<p>Please select some valid options to display.</p>");
     } else {
         if (!$this->obj_table_list->data_num_rows) {
             format_msgbox("info", "<p>You currently have no customers in your database.</p>");
         } else {
             // phases link
             //			$structure = NULL;
             //			$structure["reseller_id"]["column"]	= "id";
             //			$this->obj_table_list->add_link("customer_reseller", "customers/view.php", $structure);
             // calculate all the totals and prepare processed values
             $this->obj_table_list->render_table_prepare();
             // display header row
             print "<table class=\"table_content\" cellspacing=\"0\" width=\"100%\">";
             print "<tr>";
             foreach ($this->obj_table_list->columns as $column) {
                 print "<td class=\"header\"><b>" . $this->obj_table_list->render_columns[$column] . "</b></td>";
             }
             //placeholder for links
             print "<td class=\"header\">&nbsp;</td>";
             print "</tr>";
             // display data
             for ($i = 0; $i < $this->obj_table_list->data_num_rows; $i++) {
                 $customer_id = $this->obj_table_list->data[$i]["id"];
                 $contact_id = sql_get_singlevalue("SELECT id AS value FROM customer_contacts WHERE customer_id = '" . $customer_id . "' AND role = 'accounts' LIMIT 1");
                 print "<tr>";
                 foreach ($this->obj_table_list->columns as $columns) {
                     print "<td valign=\"top\">";
                     //contact name
                     if ($columns == "name_contact") {
                         $value = sql_get_singlevalue("SELECT contact AS value FROM customer_contacts WHERE id = '" . $contact_id . "' LIMIT 1");
                         if ($value) {
                             print $value;
                         }
                     } else {
                         if ($columns == "contact_phone") {
                             $value = sql_get_singlevalue("SELECT detail AS value FROM customer_contact_records WHERE contact_id = '" . $contact_id . "' AND type = 'phone' LIMIT 1");
                             if ($value) {
                                 print $value;
                             }
                         } else {
                             if ($columns == "contact_mobile") {
                                 $value = sql_get_singlevalue("SELECT detail AS value FROM customer_contact_records WHERE contact_id = '" . $contact_id . "' AND type= 'mobile' LIMIT 1");
                                 if ($value) {
                                     print $value;
                                 }
                             } else {
                                 if ($columns == "contact_email") {
                                     $value = sql_get_singlevalue("SELECT detail AS value FROM customer_contact_records WHERE contact_id = '" . $contact_id . "' AND type= 'email' LIMIT 1");
                                     if ($value) {
                                         print $value;
                                     }
                                 } else {
                                     if ($columns == "contact_fax") {
                                         $value = sql_get_singlevalue("SELECT detail AS value FROM customer_contact_records WHERE contact_id = '" . $contact_id . "' AND type= 'fax' LIMIT 1");
                                         if ($value) {
                                             print $value;
                                         }
                                     } else {
                                         if ($this->obj_table_list->data_render[$i][$columns]) {
                                             //								print $columns;
                                             print $this->obj_table_list->data_render[$i][$columns];
                                         } else {
                                             print "&nbsp;";
                                         }
                                     }
                                 }
                             }
                         }
                     }
                     print "</td>";
                 }
                 //links
                 print "<td align=\"right\" nowrap >";
                 print "<a class=\"button_small\" href=\"index.php?page=customers/view.php&id=" . $this->obj_table_list->data[$i]["id"] . "\">" . lang_trans("details") . "</a> ";
                 print "<a class=\"button_small\" href=\"index.php?page=customers/attributes.php&id_customer=" . $this->obj_table_list->data[$i]["id"] . "\">" . lang_trans("tbl_lnk_attributes") . "</a> ";
                 print "<a class=\"button_small\" href=\"index.php?page=customers/orders.php&id_customer=" . $this->obj_table_list->data[$i]["id"] . "\">" . lang_trans("orders") . "</a> ";
                 print "<a class=\"button_small\" href=\"index.php?page=customers/invoices.php&id=" . $this->obj_table_list->data[$i]["id"] . "\">" . lang_trans("invoices") . "</a> ";
                 print "<a class=\"button_small\" href=\"index.php?page=customers/services.php&id=" . $this->obj_table_list->data[$i]["id"] . "\">" . lang_trans("services") . "</a> ";
                 print "</td>";
                 print "</tr>";
             }
             print "</table>";
             print "<br />";
             // display CSV/PDF download link
             print "<p align=\"right\"><a class=\"button_export\" style=\"font-weight: normal;\"  href=\"index-export.php?mode=csv&page=customers/customers-billing.php\">Export as CSV</a></p>";
             print "<p align=\"right\"><a class=\"button_export\" style=\"font-weight: normal;\" href=\"index-export.php?mode=pdf&page=customers/customers-billing.php\">Export as PDF</a></p>";
         }
     }
 }
Example #30
0
 function render_html()
 {
     // heading
     print "<h3>CUSTOMER ORDERS</h3>";
     print "<p>The customer orders page is a function developed to allow products and charges to be assigned to a customer and then involved onto a single bill - this may involve\n\t\t\tuse patterns like adding service setup fees and hardware (eg: connection fee + ADSL modem) and having them automatically billed at the next service run.</p>";
     // summary box
     $this->obj_customer->order_render_summarybox();
     // table
     if (!$this->obj_table->data_num_rows) {
         format_msgbox("info", "<p>This customer does not have any items on order at this stage.</p>");
         if (user_permissions_get("customers_orders")) {
             print "<p><b><a class=\"button\" href=\"index.php?page=customers/orders-view.php&id_customer=" . $this->obj_customer->id . "\">Order Products</a></b></p>";
         }
     } else {
         // details link
         $structure = NULL;
         $structure["id_customer"]["value"] = $this->obj_customer->id;
         $structure["id_order"]["column"] = "id_order";
         $this->obj_table->add_link("details", "customers/orders-view.php", $structure);
         if (user_permissions_get("customers_orders")) {
             // delete link
             $structure = NULL;
             $structure["id_customer"]["value"] = $this->obj_customer->id;
             $structure["id_order"]["column"] = "id_order";
             $structure["full_link"] = "yes";
             $this->obj_table->add_link("delete", "customers/orders-delete-process.php", $structure);
         }
         // display the table
         $this->obj_table->render_table_html();
         if (user_permissions_get("customers_orders")) {
             print "<p><a class=\"button\" href=\"index.php?page=customers/orders-view.php&id_customer=" . $this->obj_customer->id . "\">Order Products</a> <a class=\"button\" href=\"customers/orders-invoicegen-process.php?id_customer=" . $this->obj_customer->id . "\">Generate any new invoices</a></p>";
         }
     }
 }