Exemple #1
0
 function render_html()
 {
     print "<h3>ACCOUNTING REPORTS</h3>";
     print "<p>Select one of the report types below to configure and view financial reports.</p>";
     // trial balance
     format_linkbox("default", "index.php?page=accounts/reports/trialbalance.php", "<p><b>TRIAL BALANCE</b></p>\n\t\t\t<p>Lists all the accounts which transactions are filed against and provides a basic\n\t\t\toverview of the current state of the accounts.</p>");
     // income statement
     print "<br>";
     format_linkbox("default", "index.php?page=accounts/reports/incomestatement.php", "<p><b>INCOME STATEMENT</b></p>\n\t\t\t<p>Reports income and expenses for a selected time period.</p>");
     // balance sheet
     print "<br>";
     format_linkbox("default", "index.php?page=accounts/reports/balancesheet.php", "<p><b>BALANCE SHEET</b></p>\n\t\t\t<p>Shows assets, liabilities and equity for the selected time period.</p>");
 }
Exemple #2
0
 function render_html()
 {
     print "<h3>ADMINISTRATOR TOOLS</h3>";
     print "<p>Select from the following administration tools:</p>";
     // configuration
     format_linkbox("default", "index.php?page=admin/config.php", "<p><b>CONFIGURATION</b></p>\n\t\t\t<p>Configure various application & company settings, including default user settings, company name, address, invoicing\n\t\t\toptions and more advanced application settings.</p>");
     // templates
     print "<br>";
     format_linkbox("default", "index.php?page=admin/templates.php", "<p><b>TEMPLATE SELECTION</b></p>\n\t\t\t<p>Adjust the templates used for generating PDF invoices and other documents.</p>");
     // user management
     print "<br>";
     format_linkbox("default", "index.php?page=user/users.php", "<p><b>USER MANAGEMENT</b></p>\n\t\t\t<p>Add, adjust or delete users, or configure user permissions, as well as staff access rights.</p>");
     // blacklist defence
     print "<br>";
     format_linkbox("default", "index.php?page=admin/blacklist.php", "<p><b>BRUTE-FORCE BLACKLISTING</b></p>\n\t\t\t<p>If you are running the Amberdms Billing System on a publically accessible server, it is highly\n\t\t\trecommended that you configure blacklisting to prevent brute-force password guessing by attackers. To\n\t\t\tenable/disable blacklisting or to view/unlock backlisted addresses, use the <a href=\"admin/blacklist.php\">blacklisting</a> page.</p>");
     // audit locking
     print "<br>";
     format_linkbox("default", "index.php?page=admin/auditlock.php", "\n\t\t\t<p><b>AUDIT LOCKING</b></p>\n\t\t\t<p>If you wish to close off your accounts & financial records to a specified date, use the <a href=\"index.php?page=admin/auditlock.php\">audit locking</a>\n\t\t\tfeature. This is ideal for locking all the records for a past financial year to prevent any changes\n\t\t\tfrom being accidently made after you have balanced the books.</p>");
     // database backup
     print "<br>";
     format_linkbox("default", "index.php?page=admin/db_backup.php", "\n\t\t\t<p><b>DATABASE BACKUP</b></p>\n\t\t\t<p>If you would like to download a copy of your SQL database containing all your data, use our database backup tool to export it.</p>");
 }
Exemple #3
0
 function render_html()
 {
     // calcuate next/previous week/year
     if ($this->date_selected_weekofyear == 1) {
         $date_option_previousyear = $this->date_selected_year - 1;
         $date_option_previousweek = 52;
         $date_option_nextyear = $this->date_selected_year;
         $date_option_nextweek = 2;
     } elseif ($this->date_selected_weekofyear == 52) {
         $date_option_previousyear = $this->date_selected_year;
         $date_option_previousweek = 51;
         $date_option_nextyear = $this->date_selected_year + 1;
         $date_option_nextweek = 1;
     } else {
         $date_option_previousyear = $this->date_selected_year;
         $date_option_previousweek = $this->date_selected_weekofyear - 1;
         $date_option_nextyear = $this->date_selected_year;
         $date_option_nextweek = $this->date_selected_weekofyear + 1;
     }
     // Week view header
     print "<h3>TIME REGISTRATION</h3><br><br>";
     /*
     	Unbilled Time
     */
     if (user_permissions_get("projects_timegroup")) {
         /*
         	Create an array of all unbilled time records. We need to do the following to create this list:
         	1. Exclude any internal_only projects.
         	2. Include time which belongs to a time_group, but ONLY if the time group has not been added to an invoice.
         */
         $unbilled_ids = array();
         // select non-internal projects
         $sql_projects_obj = new sql_query();
         $sql_projects_obj->string = "SELECT projects.id as projectid, project_phases.id as phaseid FROM project_phases LEFT JOIN projects ON projects.id = project_phases.projectid WHERE projects.internal_only='0'";
         $sql_projects_obj->execute();
         if ($sql_projects_obj->num_rows()) {
             $sql_projects_obj->fetch_array();
             foreach ($sql_projects_obj->data as $project_data) {
                 // select non-group time records
                 $sql_obj = new sql_query();
                 $sql_obj->string = "SELECT id FROM timereg WHERE groupid='0' AND phaseid='" . $project_data["phaseid"] . "'";
                 $sql_obj->execute();
                 if ($sql_obj->num_rows()) {
                     $sql_obj->fetch_array();
                     foreach ($sql_obj->data as $data_tmp) {
                         // we store the ID inside an array key, since they are unique
                         // and this will prevent us needed to check for the existance of
                         // the ID already.
                         $unbilled_ids[$data_tmp["id"]] = "on";
                     }
                 }
                 unset($sql_obj);
                 // select unpaid group IDs
                 $sql_obj = new sql_query();
                 $sql_obj->string = "SELECT id FROM time_groups WHERE projectid='" . $project_data["projectid"] . "' AND invoiceid='0'";
                 $sql_obj->execute();
                 if ($sql_obj->num_rows()) {
                     $sql_obj->fetch_array();
                     foreach ($sql_obj->data as $data_group) {
                         // fetch all the time reg IDs belonging this group, but only select time entries marked as billable - we
                         // don't want to report a timegroup with unbillable time as being billed!
                         $sql_reg_obj = new sql_query();
                         $sql_reg_obj->string = "SELECT id FROM timereg WHERE groupid='" . $data_group["id"] . "' AND billable='1'";
                         $sql_reg_obj->execute();
                         if ($sql_reg_obj->num_rows()) {
                             $sql_reg_obj->fetch_array();
                             foreach ($sql_reg_obj->data as $data_tmp) {
                                 // we store the ID inside an array key, since they are unique
                                 // and this will prevent us needed to check for the existance of
                                 // the ID already.
                                 $unbilled_ids[$data_tmp["id"]] = "on";
                             }
                         }
                         unset($sql_reg_obj);
                     }
                 }
                 unset($sql_obj);
             }
         }
         // fetch amount of unbilled time
         $sql_obj = new sql_query();
         $sql_obj->prepare_sql_settable("timereg");
         $sql_obj->prepare_sql_addfield("timebooked", "SUM(timereg.time_booked)");
         if ($this->access_staff_ids) {
             $sql_obj->prepare_sql_addwhere("employeeid IN (" . format_arraytocommastring($this->access_staff_ids) . ")");
         }
         $sql_obj->prepare_sql_addjoin("LEFT JOIN time_groups ON timereg.groupid = time_groups.id");
         // provide list of valid IDs
         $unbilled_ids_keys = array_keys($unbilled_ids);
         $unbilled_ids_count = count($unbilled_ids_keys);
         $unbilled_ids_sql = "";
         if ($unbilled_ids_count) {
             $i = 0;
             foreach ($unbilled_ids_keys as $id) {
                 $i++;
                 if ($i == $unbilled_ids_count) {
                     $unbilled_ids_sql .= "timereg.id='{$id}' ";
                 } else {
                     $unbilled_ids_sql .= "timereg.id='{$id}' OR ";
                 }
             }
             $sql_obj->prepare_sql_addwhere("({$unbilled_ids_sql})");
             $sql_obj->generate_sql();
             $sql_obj->execute();
             $sql_obj->fetch_array();
             list($unbilled_time_hours, $unbilled_time_mins) = explode(":", time_format_hourmins($sql_obj->data[0]["timebooked"]));
             if ($unbilled_time_hours > 0 && $unbilled_time_mins > 0) {
                 $message = "There are currently {$unbilled_time_hours} hours and {$unbilled_time_mins} minutes of unbilled time to be processed. Click here to view.";
             } elseif ($unbilled_time_hours > 0) {
                 $message = "There are currently {$unbilled_time_hours} hours of unbilled time to be processed. Click here to view.";
             } elseif ($unbilled_time_mins > 0) {
                 $message = "There are currently {$unbilled_time_mins} minutes of unbilled time to be processed. Click here to view.";
             }
         } else {
             $message = "There is no unbilled time to be processed.";
         }
         // display
         print "<br>";
         format_linkbox("default", "index.php?page=timekeeping/unbilled.php", "<p><b>UNBILLED TIME</b></p><p>{$message}</p>");
     }
     /*end unbilled time*/
     print "<br />";
     /*
     Time booked
     */
     // fetch amount of time booked for today
     $sql_obj = new sql_query();
     $sql_obj->prepare_sql_settable("timereg");
     $sql_obj->prepare_sql_addfield("timebooked", "SUM(timereg.time_booked)");
     $sql_obj->prepare_sql_addwhere("date='" . date("Y-m-d") . "'");
     if ($this->access_staff_ids) {
         $sql_obj->prepare_sql_addwhere("employeeid IN (" . format_arraytocommastring($this->access_staff_ids) . ")");
     }
     $sql_obj->generate_sql();
     $sql_obj->execute();
     $sql_obj->fetch_array();
     list($booked_time_hours, $booked_time_mins) = explode(":", time_format_hourmins($sql_obj->data[0]["timebooked"]));
     if ($booked_time_hours > 0 && $booked_time_mins > 0) {
         $message = "<b>Time booked for today: {$booked_time_hours} hours and {$booked_time_mins} minutes.</b><br />Click here to add more time.";
     } elseif ($booked_time_hours > 0) {
         $message = "<b>Time booked for today: {$booked_time_hours} hours.</b><br />Click here to add more time.";
     } elseif ($booked_time_mins > 0) {
         $message = "<b>Time booked for today: {$booked_time_mins} minutes.</b><br />Click here to add more time.";
     } else {
         $message = "<b>No time has been booked for today</b><br />Click here to add time.</b>";
     }
     format_linkbox("default", "index.php?page=timekeeping/timereg-day-edit.php", "<p>{$message}</p>");
     print "<br />";
     print "<table class=\"table_highlight\" width=\"100%\"><tr>";
     // Week selection links
     print "<td width=\"70%\">";
     print "<b>WEEK " . $this->date_selected_weekofyear . ", " . $this->date_selected_year . "</b><br>";
     print "(" . time_format_humandate($this->date_selected_start) . " to " . time_format_humandate($this->date_selected_end) . ")<br>";
     print "<br>";
     print "<p><b>";
     print "<a class=\"button\" href=\"index.php?page=timekeeping/timereg.php&employeeid=" . $this->employeeid . "&weekofyear=" . $date_option_previousweek . "&year=" . $date_option_previousyear . "\">&lt;&lt; Previous Week</a>";
     // check for date in the future
     if ($this->config_timesheet_booktofuture == "disabled") {
         if (time_date_to_timestamp(time_calculate_weekstart($date_option_nextweek, $date_option_nextyear)) < time()) {
             // end date is in not in the future
             print " <a class=\"button\" href=\"index.php?page=timekeeping/timereg.php&employeeid=" . $this->employeeid . "&weekofyear=" . $date_option_nextweek . "&year=" . $date_option_nextyear . "\">Next Week &gt;&gt;</a>";
         }
     } else {
         print " <a class=\"button\" href=\"index.php?page=timekeeping/timereg.php&employeeid=" . $this->employeeid . "&weekofyear=" . $date_option_nextweek . "&year=" . $date_option_nextyear . "\">Next Week &gt;&gt;</a>";
     }
     print "</b></p>";
     print "</td>";
     // goto date form
     print "<td width=\"30%\">";
     print "<form method=\"get\" action=\"index.php\" class=\"form_standard\">";
     $this->obj_form_goto->render_field("date");
     print "<br>";
     $this->obj_form_goto->render_field("page");
     $this->obj_form_goto->render_field("submit");
     print "</form>";
     print "</td>";
     print "</tr></table><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\" class=\"form_standard\">";
     print "<p><b>Select an employee to view:</b></p>";
     $this->obj_form_employee->render_field("employeeid");
     $this->obj_form_employee->render_field("weekofyear");
     $this->obj_form_employee->render_field("year");
     $this->obj_form_employee->render_field("page");
     $this->obj_form_employee->render_field("submit");
     print "</form>";
     print "</td></tr></table><br>";
     if ($this->employeeid) {
         // custom labels and links
         if ($this->config_timesheet_booktofuture == "disabled") {
             if (time_date_to_timestamp($this->date_selected_daysofweek[0]) < time()) {
                 $this->obj_table_week->custom_column_link("monday", "index.php?page=timekeeping/timereg-day.php&date=" . $this->date_selected_daysofweek[0] . "");
             }
             if (time_date_to_timestamp($this->date_selected_daysofweek[1]) < time()) {
                 $this->obj_table_week->custom_column_link("tuesday", "index.php?page=timekeeping/timereg-day.php&date=" . $this->date_selected_daysofweek[1] . "");
             }
             if (time_date_to_timestamp($this->date_selected_daysofweek[2]) < time()) {
                 $this->obj_table_week->custom_column_link("wednesday", "index.php?page=timekeeping/timereg-day.php&date=" . $this->date_selected_daysofweek[2] . "");
             }
             if (time_date_to_timestamp($this->date_selected_daysofweek[3]) < time()) {
                 $this->obj_table_week->custom_column_link("thursday", "index.php?page=timekeeping/timereg-day.php&date=" . $this->date_selected_daysofweek[3] . "");
             }
             if (time_date_to_timestamp($this->date_selected_daysofweek[4]) < time()) {
                 $this->obj_table_week->custom_column_link("friday", "index.php?page=timekeeping/timereg-day.php&date=" . $this->date_selected_daysofweek[4] . "");
             }
             if (time_date_to_timestamp($this->date_selected_daysofweek[5]) < time()) {
                 $this->obj_table_week->custom_column_link("saturday", "index.php?page=timekeeping/timereg-day.php&date=" . $this->date_selected_daysofweek[5] . "");
             }
             if (time_date_to_timestamp($this->date_selected_daysofweek[6]) < time()) {
                 $this->obj_table_week->custom_column_link("sunday", "index.php?page=timekeeping/timereg-day.php&date=" . $this->date_selected_daysofweek[6] . "");
             }
         } else {
             // add links
             $this->obj_table_week->custom_column_link("monday", "index.php?page=timekeeping/timereg-day.php&date=" . $this->date_selected_daysofweek[0] . "");
             $this->obj_table_week->custom_column_link("tuesday", "index.php?page=timekeeping/timereg-day.php&date=" . $this->date_selected_daysofweek[1] . "");
             $this->obj_table_week->custom_column_link("wednesday", "index.php?page=timekeeping/timereg-day.php&date=" . $this->date_selected_daysofweek[2] . "");
             $this->obj_table_week->custom_column_link("thursday", "index.php?page=timekeeping/timereg-day.php&date=" . $this->date_selected_daysofweek[3] . "");
             $this->obj_table_week->custom_column_link("friday", "index.php?page=timekeeping/timereg-day.php&date=" . $this->date_selected_daysofweek[4] . "");
             $this->obj_table_week->custom_column_link("saturday", "index.php?page=timekeeping/timereg-day.php&date=" . $this->date_selected_daysofweek[5] . "");
             $this->obj_table_week->custom_column_link("sunday", "index.php?page=timekeeping/timereg-day.php&date=" . $this->date_selected_daysofweek[6] . "");
         }
         // column labels
         $this->obj_table_week->custom_column_label("monday", "Monday<br><font style=\"font-size: 8px;\">(" . time_format_humandate($this->date_selected_daysofweek[0]) . ")</font>");
         $this->obj_table_week->custom_column_label("tuesday", "Tuesday<br><font style=\"font-size: 8px;\">(" . time_format_humandate($this->date_selected_daysofweek[1]) . ")</font>");
         $this->obj_table_week->custom_column_label("wednesday", "Wednesday<br><font style=\"font-size: 8px;\">(" . time_format_humandate($this->date_selected_daysofweek[2]) . ")</font>");
         $this->obj_table_week->custom_column_label("thursday", "Thursday<br><font style=\"font-size: 8px;\">(" . time_format_humandate($this->date_selected_daysofweek[3]) . ")</font>");
         $this->obj_table_week->custom_column_label("friday", "Friday<br><font style=\"font-size: 8px;\">(" . time_format_humandate($this->date_selected_daysofweek[4]) . ")</font>");
         $this->obj_table_week->custom_column_label("saturday", "Saturday<br><font style=\"font-size: 8px;\">(" . time_format_humandate($this->date_selected_daysofweek[5]) . ")</font>");
         $this->obj_table_week->custom_column_label("sunday", "Sunday<br><font style=\"font-size: 8px;\">(" . time_format_humandate($this->date_selected_daysofweek[6]) . ")</font>");
         // display week time table
         $this->obj_table_week->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\">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
         print "<td align=\"right\">";
         print "<p><a class=\"button_export\" href=\"index-export.php?mode=csv&page=timekeeping/timereg.php\">Export as CSV</a></p>";
         print "<p><a class=\"button_export\" href=\"index-export.php?mode=pdf&page=timekeeping/timereg.php\">Export as PDF</a></p>";
         print "</td>";
         print "</table>";
     }
 }
Exemple #4
0
 function render_html()
 {
     print "<h3>ACCOUNTS</h3>";
     print "<br>";
     /*
     	Accounts AR
     */
     if (user_permissions_get("accounts_ar_view")) {
         print "<br>";
         print "<table width=\"100%\"><tr>";
         // blurb
         print "<td width=\"35%\">";
         // display
         format_linkbox("default", "index.php?page=accounts/ar/ar.php", "<p><b>AR INVOICES</b></p>\n\t\t\t\t\t\t\t<p>AR invoices are the invoices you create to bill your customers.<br>\n\t\t\t\t\t\t\t<br>\n\t\t\t\t\t\t\t" . format_money($this->total_ar_unpaid) . " in unpaid invoices.<br>\n\t\t\t\t\t\t\t" . format_money($this->total_ar_overdue) . " in overdue invoices.</p><br><br><br>");
         print "</td>";
         // quick select form
         print "<td width=\"35%\" class=\"table_highlight\">";
         print "<p><b>VIEW OPEN INVOICES:</b></p>";
         print "<form method=\"get\" action=\"index.php\">";
         $this->obj_form_ar->render_field("id");
         $this->obj_form_ar->render_field("page");
         if (count($this->obj_form_ar->structure["id"]["values"])) {
             $this->obj_form_ar->render_field("submit");
         }
         print "</form>";
         print "<br>";
         print "<p><b>VIEW INVOICES FOR CUSTOMER:</b></p>";
         print "<form method=\"get\" action=\"index.php\">";
         $this->obj_form_cust->render_field("id");
         $this->obj_form_cust->render_field("page");
         if (count($this->obj_form_cust->structure["id"]["values"])) {
             $this->obj_form_cust->render_field("submit");
         }
         print "</form>";
         print "</td>";
         print "</tr></table>";
     }
     /*
     	Accounts AP
     */
     if (user_permissions_get("accounts_ap_view")) {
         print "<br>";
         print "<table width=\"100%\"><tr>";
         // blurb
         print "<td width=\"35%\">";
         // display
         format_linkbox("default", "index.php?page=accounts/ap/ap.php", "<p><b>AP INVOICES</b></p>\n\t\t\t\t\t\t\t<p>AP invoices are the invoices sent to you from your vendors/suppliers.<br>\n\t\t\t\t\t\t\t<br>\n\t\t\t\t\t\t\t" . format_money($this->total_ap_unpaid) . " in unpaid invoices.<br>\n\t\t\t\t\t\t\t" . format_money($this->total_ap_overdue) . " in overdue invoices.</p><br><br><br>");
         print "</td>";
         // quick select form
         print "<td width=\"35%\" class=\"table_highlight\">";
         print "<p><b>VIEW OPEN INVOICES:</b></p>";
         print "<form method=\"get\" action=\"index.php\">";
         $this->obj_form_ap->render_field("id");
         $this->obj_form_ap->render_field("page");
         if (@count($this->obj_form_ap->structure["id"]["values"])) {
             $this->obj_form_ap->render_field("submit");
         }
         print "</form>";
         print "<br>";
         print "<p><b>VIEW INVOICES FROM VENDOR:</b></p>";
         print "<form method=\"get\" action=\"index.php\">";
         $this->obj_form_vend->render_field("id");
         $this->obj_form_vend->render_field("page");
         if (@count($this->obj_form_vend->structure["id"]["values"])) {
             $this->obj_form_vend->render_field("submit");
         }
         print "</form>";
         print "</td>";
         print "</tr></table>";
     }
 }