public function handle_hook($hook, $mod = false) { switch ($hook) { case 'dashboard_widgets': $widgets = array(); include 'pages/dashboard_summary_widgets.php'; return $widgets; break; case 'dashboard': include 'pages/dashboard_summary.php'; // not in lite edition: if (is_file(dirname(__FILE__) . '/pages/finance_quick.php')) { include 'pages/finance_quick.php'; } return false; break; case "home_alerts": $alerts = array(); if ($mod != 'calendar' && module_config::c('finance_alerts', 1) && module_finance::can_i('view', 'Finance Upcoming')) { // find any jobs that are past the due date and dont have a finished date. $sql = "SELECT * FROM `" . _DB_PREFIX . "finance_recurring` r "; $sql .= " WHERE r.next_due_date != '0000-00-00' AND r.next_due_date <= '" . date('Y-m-d', strtotime('+' . module_config::c('finance_alert_days_in_future', 14) . ' days')) . "'"; $sql .= " AND (r.end_date = '0000-00-00' OR r.next_due_date < r.end_date)"; $upcoming_finances = qa($sql); foreach ($upcoming_finances as $finance) { $alert_res = process_alert($finance['next_due_date'], _l('Upcoming Transaction Due'), module_config::c('finance_alert_days_in_future', 14)); if ($alert_res) { $alert_res['link'] = $this->link_open_recurring($finance['finance_recurring_id']); $alert_res['name'] = ($finance['type'] == 'i' ? '+' . dollar($finance['amount']) : '') . ($finance['type'] == 'e' ? '-' . dollar($finance['amount']) : '') . ' (' . $finance['name'] . ')'; $alerts[] = $alert_res; } } } return $alerts; break; } }
</a> </td> </tr> <?php } ?> </tbody> </table> </div> <?php $fieldset_data = array('heading' => array('title' => _l('Invoice Payment History'), 'type' => 'h3'), 'elements_before' => ob_get_clean()); echo module_form::generate_fieldset($fieldset_data); unset($fieldset_data); if (class_exists('module_finance', false) && module_finance::is_plugin_enabled() && module_finance::can_i('view', 'Finance') && module_finance::is_enabled() && is_file('includes/plugin_finance/pages/finance_invoice_edit.php') && module_config::c('invoice_show_finances', 1)) { include 'includes/plugin_finance/pages/finance_invoice_edit.php'; } } // invoice_id check hook_handle_callback('layout_column_half', 'end'); $form_actions = array('class' => 'action_bar action_bar_left', 'elements' => array(array('type' => 'save_button', 'name' => 'butt_save', 'onclick' => "\$('#form_redirect').val('" . (!$invoice_id && isset($_REQUEST['job_id']) && (int) $_REQUEST['job_id'] > 0 ? module_job::link_open($_REQUEST['job_id']) : module_invoice::link_open(false)) . "');", 'value' => _l('Save and Return')), array('type' => 'save_button', 'name' => 'butt_save', 'value' => _l('Save')))); if ((int) $invoice_id) { if ($invoice['date_paid'] && $invoice['date_paid'] != '0000-00-00') { $form_actions['elements'][] = array('type' => 'save_button', 'class' => 'submit_button', 'name' => 'butt_email', 'value' => _l('Email Receipt')); } else { $form_actions['elements'][] = array('type' => 'submit', 'class' => 'submit_button', 'name' => 'butt_email', 'value' => _l('Email Invoice')); } if (function_exists('convert_html2pdf')) { if (!module_invoice::can_i('edit', 'Invoices')) { $form_actions['elements'][] = array('type' => 'button', 'class' => 'submit_button no_permissions', 'name' => 'butt_print', 'value' => _l('Print PDF'), 'onclick' => "window.location.href='" . module_invoice::link_public_print($invoice_id) . "';");
<?php /** * Copyright: dtbaker 2012 * Licence: Please check CodeCanyon.net for licence details. * More licence clarification available here: http://codecanyon.net/wiki/support/legal-terms/licensing-terms/ * Deploy: 9809 f200f46c2a19bb98d112f2d32a8de0c4 * Envato: 4ffca17e-861e-4921-86c3-8931978c40ca * Package Date: 2015-11-25 02:55:20 * IP Address: 67.79.165.254 */ if (!module_finance::can_i('view', 'Finance Upcoming')) { redirect_browser(_BASE_HREF); } $module->page_title = 'Recurring'; $search = isset($_REQUEST['search']) ? $_REQUEST['search'] : array(); if (module_config::c('finance_recurring_show_finished', 0)) { $search['show_finished'] = true; } if (!isset($search['date_to'])) { $search['date_to'] = print_date(strtotime('+' . (int) module_config::c('finance_recurring_months', 6) . ' months')); } $balance = isset($_REQUEST['balance']) ? (double) $_REQUEST['balance'] : module_config::c('finance_recurring_start_balance', 0); module_config::save_config('finance_recurring_start_balance', $balance); $_SESSION['_finance_recurring_ids'] = array(); module_debug::log(array('title' => 'calling get_recurrings', 'data' => '')); $upcoming_finances_unsorted = module_finance::get_recurrings($search); module_debug::log(array('title' => 'finished calling get_recurrings', 'data' => 'count: ' . count($upcoming_finances_unsorted))); $upcoming_finances = array(); $limit_timestamp = isset($search['date_to']) && !empty($search['date_to']) ? strtotime(input_date($search['date_to'])) : strtotime('+' . (int) module_config::c('finance_recurring_months', 6) . ' months'); $duplicate_limit = 30;
?> </tbody> </table> <?php } ?> </div> <?php $fieldset_data = array('heading' => array('title' => 'Job Invoices:', 'type' => 'h3'), 'elements_before' => ob_get_clean()); if (module_invoice::can_i('create', 'Invoices')) { $fieldset_data['heading']['button'] = array('title' => _l('Create New Invoice'), 'url' => '#', 'id' => 'job_generate_invoice_button'); } echo module_form::generate_fieldset($fieldset_data); } if (class_exists('module_finance', false) && module_finance::is_plugin_enabled() && module_finance::can_i('view', 'Finance') && (int) $job_id > 0 && module_finance::is_enabled() && is_file('includes/plugin_finance/pages/finance_job_edit.php')) { include 'includes/plugin_finance/pages/finance_job_edit.php'; } ?> </form> <?php // run the custom data hook to display items in this particular hook location hook_handle_callback('custom_data_hook_location', _CUSTOM_DATA_HOOK_LOCATION_JOB_FOOTER, 'job', $job_id, $job); hook_handle_callback('layout_column_half', 'end'); ?>
}); if (class_exists('module_extra', false)) { $table_manager->display_extra('finance', function ($finance) { module_extra::print_table_data('finance', isset($finance['finance_id']) ? $finance['finance_id'] : 0); }); } $table_manager->set_columns($columns); $table_manager->row_callback = function ($finance) { if (isset($finance['finance_id']) && $finance['finance_id']) { $finance['finance_record'] = module_finance::get_finance($finance['finance_id']); } else { $finance['finance_record'] = false; } return $finance; }; if (module_finance::can_i('create', 'Finance')) { $header_rows = array(); ob_start(); ?> <div style="height:18px; width:89px; overflow: hidden; position: absolute; background: #FFFFFF;" onmouseover="$(this).height('auto');$(this).width('auto');" onmouseout="$(this).height('18px');$(this).width('89px');"> <?php $categories = module_finance::get_categories(); foreach ($categories as $category) { ?> <input type="checkbox" name="finance_category_id[]" value="<?php echo $category['finance_category_id']; ?> " id="category_<?php echo $category['finance_category_id'];
function set_starting_balance(){ var balance = prompt('<?php _e('Please enter starting balance'); ?> ',0); window.location.href = '<?php $url = module_finance::link_open_recurring(false, false); echo $url . (strpos($url, '?') ? '&' : '?'); ?> balance='+balance; } </script> <?php $heading = array('title_final' => _l('Upcoming Transactions'), 'type' => 'h2', 'main' => true, 'button' => array()); if (module_finance::can_i('create', 'Finance Upcoming')) { $heading['button'][] = array('title' => "Add New", 'type' => 'add', 'url' => module_finance::link_open_recurring('new')); $heading['button'][] = array('title' => _l("Set Starting Balance (currently %s)", dollar($balance)), 'url' => 'javascript:set_starting_balance();'); } print_heading($heading); ?> <form action="" method="post" id="finance_recurring_form"> <?php $categories_rel = array(); foreach (module_finance::get_categories() as $category) { $categories_rel[$category['finance_category_id']] = $category['name']; } $accounts_rel = array(); foreach (module_finance::get_accounts() as $account) {
$fieldset_data['elements'][] = array('title' => 'Linked Staff', 'fields' => array(function () use(&$finance, $locked, $linked_staff_members) { ?> <input type="hidden" name="job_staff_expense" value="<?php echo isset($finance['job_staff_expense']) ? (int) $finance['job_staff_expense'] : ''; ?> "> <?php echo print_select_box($linked_staff_members, 'user_id', isset($finance['user_id']) ? $finance['user_id'] : 0, '', _l(' - None - ')); if (isset($finance['user_id']) && $finance['user_id']) { echo ' <a href="' . module_user::link_open($finance['user_id'], false) . '">' . _l('Open User') . '</a>'; } })); } $fieldset_data['elements'][] = array('title' => 'Attachment', 'fields' => array(function () use(&$finance, $locked, $finance_id) { if ((int) $finance_id > 0) { module_file::display_files(array('owner_table' => 'finance', 'owner_id' => $finance_id, 'layout' => 'gallery', 'editable' => module_security::is_page_editable() && module_finance::can_i('edit', 'Finance'))); } else { _e('Please press save first'); } })); echo module_form::generate_fieldset($fieldset_data); unset($fieldset_data); $form_actions = array('class' => 'action_bar action_bar_left', 'elements' => array(array('type' => 'save_button', 'name' => 'butt_save_return', 'value' => _l('Save and Return')), array('type' => 'save_button', 'name' => 'butt_save', 'value' => _l('Save')))); if ((int) $finance_recurring_id > 0 && isset($_SESSION['_finance_recurring_ids'])) { // find if there is a next recurring id $next = 0; foreach ($_SESSION['_finance_recurring_ids'] as $next_data) { if ($next == -1) { $next = 1; // done. $form_actions['elements'][] = array('type' => 'hidden', 'name' => 'recurring_next', 'id' => 'recurring_next', 'value' => '');