コード例 #1
0
 public function testBasicConversions()
 {
     $currency = currency(1, 'EUR');
     $this->assertNotEquals($currency->to('USD')->plain(), 1, '', static::FLOAT_PRECISION);
     $this->assertNotEquals($currency->toUSD()->plain(), 1, '', static::FLOAT_PRECISION);
     $this->assertEquals($currency->toUSD()->getCurrency()->getCode(), 'USD');
 }
コード例 #2
0
ファイル: UsersController.php プロジェクト: avail/osu-web
 public function checkUsernameAvailability()
 {
     $username = Request::input('username');
     $errors = Auth::user()->validateUsernameChangeTo($username);
     $available = count($errors) === 0;
     $message = $available ? "Username '" . e($username) . "' is available!" : implode(' ', $errors);
     $cost = $available ? Auth::user()->usernameChangeCost() : 0;
     return ['username' => Request::input('username'), 'available' => $available, 'message' => $message, 'cost' => $cost, 'costString' => currency($cost)];
 }
コード例 #3
0
function form_mercado_pago()
{
    if (get_option('mercadopago_url_sucess') != '') {
        $url_sucess = get_option('mercadopago_url_sucess');
    } else {
        $url_sucess = get_site_url();
    }
    if (get_option('mercadopago_url_pending') != '') {
        $url_pending = get_option('mercadopago_url_pending');
    } else {
        $url_pending = get_site_url();
    }
    $output = '<br /><tr><td>';
    $output .= 'Client Id</td>';
    $output .= '<td><input name="mercadopago_client_id" type="text" value="' . get_option('mercadopago_client_id') . '"/></td></tr>';
    $output .= '<tr><td>Client Secret</td>';
    $output .= '<td><input name="mercadopago_client_secret" type="text" value="' . get_option('mercadopago_client_secret') . '"/></td></tr>';
    $output .= '<tr><td></td><td><small>To get fields above, follow: 
		<a href="https://www.mercadopago.com/mla/herramientas/aplicaciones" target="_blank">Argentina</a> or
		<a href="https://www.mercadopago.com/mlb/ferramentas/aplicacoes" target="_blank">Brasil</a> or <a href="https://www.mercadopago.com/mlm/herramientas/aplicaciones" target="_blank">Mexico</a> or <a href="https://www.mercadopago.com/mlv/herramientas/aplicaciones" target="_blank">Venezuela</a> <br /><br /></small></td></tr>';
    $output .= '<tr><td>Store Category</td>';
    $output .= '<td>' . category() . '</td></tr>';
    $output .= '<tr><td>Type Checkout</td>';
    $output .= '<td>' . type_checkout() . '</td></tr>';
    $output .= '<tr><td>Sandbox</td>';
    $output .= '<td>' . sandbox() . '</td></tr>';
    $output .= '<tr><td>Url Sucess Payment</td>';
    $output .= '<td><input name="mercadopago_url_sucess" type="text" value="' . $url_sucess . '"/></td></tr>';
    $output .= '<tr><td>Url Peding Payment</td>';
    $output .= '<td><input name="mercadopago_url_pending" type="text" value="' . $url_pending . '"/></td></tr>';
    $output .= '<tr><td></td><td><small>This is just the url where the custumer is redirect after his payment is done, you can set in both fields above any url of your site, but needs to be a <b>valid URL.</b>.<br /><br /> Please set your <b>instant payment notification</b> to receive your automatic order status changes at: 
		<a href="https://www.mercadopago.com/mla/herramientas/notificaciones" target="_blank">Argentina</a> or
		<a href="https://www.mercadopago.com/mlb/ferramentas/notificacoes" target="_blank">Brasil</a> or <a href="https://www.mercadopago.com/mlm/herramientas/notificaciones" target="_blank">Mexico</a> or <a href="https://www.mercadopago.com/mlv/herramientas/notificaciones" target="_blank">Venezuela</a><br />
		Set your url follwing this exemple: http://yourstore.com</b></small></td></tr>';
    $output .= '<tr><td>Store Country</td>';
    $output .= '<td>' . country() . '</td></tr>';
    $output .= '<tr><td>Currency</td>';
    $output .= '<td>' . currency() . '</td></tr>';
    $output .= '<tr><td></td><td><small>Select Real to Brasil, or Pesos or Dollar to Argentina</small></td></tr>';
    $output .= '<tr><td>Excluded methods</td>';
    $output .= '<td>' . methods(get_option('mercadopago_country')) . '</td></tr>';
    $output .= '<tr><td></td><td><small>SELECT only the methods that you <b>DO NOT</b>want to accept by MercadoPago<br />
		<br /><b>Attention: </b> Payment methods depends on what country your account was created, if you change the country,<b> save the module first</b> and just after that select the Exclude Payment Methods!
		<br /><br /><b>DO NOT</b> exclude All methods<br /><br /></small></td></tr>';
    $output .= '<tr><td>Limit Payments</td>';
    $output .= '<td>' . instalments() . '</td></tr>';
    $output .= '<tr><td></td><td><small>This option allow you to limit the maximum number of instalments of MercadoPago</small></td></tr>';
    $output .= '<tr><td>Debug mode</td>';
    $output .= '<td>' . debugs() . '</td></tr>';
    $output .= '<tr><td></td><td><small>Turn debug mode on to see erro log with your getting error on checkout</small></td></tr>';
    return $output;
}
コード例 #4
0
ファイル: places.php プロジェクト: JamesWuChina/CI-Property
 public function search($offset = 0)
 {
     $options = $this->m_places->array_from_post(array('title_s', 'type', 'city', 'minbed', 'maxbed', 'minbath', 'maxbath', 'minprice', 'maxprice', 'minfloor', 'maxfloor'));
     if ($this->form_validation->run('search')) {
         $count = $this->m_places->search($options, $status = FALSE);
         $perpage = getOptions('paging');
         if (count($count) > $perpage) {
             $this->load->library('pagination');
             $config['base_url'] = site_url('admin/places/search');
             $config['total_rows'] = count($count);
             $config['per_page'] = $perpage;
             $config['uri_segment'] = 4;
             $q = $this->pagination->initialize($config);
             $offset = $this->uri->segment(4) ? $this->uri->segment(4) : 0;
         } else {
             $this->data['pagination'] = '';
             $offset = 0;
         }
         $status = $this->m_places->status_place;
         $telo = $this->m_places->search($options, $status = FALSE, $perpage, $offset);
         $str = '';
         if ($telo) {
             $str .= '<section class="col-xs-12 col-sm-6 col-md-12">';
             foreach ($telo as $s) {
                 $str .= '<article class="search-result row">';
                 $str .= $s->image ? '<div class="col-xs-12 col-sm-12 col-md-3"><img class="img-responsive thumbnail" src="' . base_url('assets/img/timthumb.php') . '?src=' . base_url($s->image) . '&zc=0&h=140&w=180"></div>' : '<div class="col-xs-12 col-sm-12 col-md-3"><img class="img-responsive thumbnail" src="http://placehold.it/250x140&text=no+primary+image"></div>';
                 $str .= '<div class="col-xs-12 col-sm-12 col-md-2"><ul class="meta-search">';
                 $str .= '<ul><i class="fa fa-money"></i><span> ' . ($s->prices === null ? 'Not Set' : $this->data['currency'][getOptions('currency')] . ' ' . currency($s->prices)) . '</span></li>';
                 $str .= '<ul><li><i class="glyphicon glyphicon-home"></i> <span>' . ($s->title_type === null ? 'Not Set' : $s->title_type) . '</span></li>';
                 $str .= '<ul><li><i class="fa fa-arrows"></i> <span>' . ($s->floor_dim === null ? 'Not Set' : $s->floor_dim . ' ' . $this->data['floor'][getOptions('floor_metric')]) . '</span></li>';
                 $str .= '<ul><li><i class="fa fa-table"></i> <span>' . ($s->bedrooms === null ? 'Not Set' : $s->bedrooms . ' bedrooms') . '</span></li>';
                 $str .= '<ul><li><a href=' . site_url('front/places/details') . '/' . $s->id_places . ' class="btn btn-primary btn-xs">View Details</a></li>';
                 $str .= '</ul></div>';
                 $str .= '<div class="col-xs-12 col-sm-12 col-md-7 excerpet">';
                 $str .= '<h3>' . $s->title_places . ' / ' . $this->data['status'][$s->status] . '</h3>';
                 $str .= '<p>' . limit_to_numwords(strip_tags($s->desc), 50) . '</p></div>';
                 //                    $str .= '<td>' . ($s->title_type === null ? 'Not Set' : $s->title_type) . '</td>';
                 //                    $str .= '<td>' . ($s->prices === null ? 'Not Set' : $this->data['currency'][getOptions('currency')] . ' ' . currency($s->prices)) . '</td>';
                 $str .= '<span class="clearfix borda"></span></article>';
             }
             $str .= '<div>' . $this->pagination->create_links() . '</div>';
             $str .= '</section>';
         } else {
             $str .= 'No Data Found';
         }
         echo $str;
     }
 }
コード例 #5
0
                    <input type="text" name="job_task[new][description]" id="task_desc_new" class="edit_task_description" value=""><?php 
        if (class_exists('module_product', false)) {
            module_product::print_job_task_dropdown('new');
        }
        ?>
<a href="#" class="task_toggle_long_description ui-icon ui-icon-plus">&raquo;</a>
                    <div class="task_long_description">
                        <textarea name="job_task[new][long_description]" id="task_long_desc_new" class="edit_task_long_description"></textarea>
                    </div>
                </td>
                <td valign="top">
                    <input type="text" name="job_task[new][hours]" value="" size="3" style="width:25px;" onchange="setamount(this.value,'new');" onkeyup="setamount(this.value,'new');" id="task_hours_new">
                </td>
                <td valign="top" nowrap="">
                    <?php 
        echo currency('<input type="text" name="job_task[new][amount]" value="" id="newtaskamount" class="currency">');
        ?>

                </td>
                <td valign="top">
                    <input type="text" name="job_task[new][date_due]" value="<?php 
        echo print_date($job['date_due']);
        ?>
" class="date_field">
                </td>
                <?php 
        if (module_config::c('job_allow_staff_assignment', 1)) {
            ?>

                    <td valign="top">
                        <?php 
コード例 #6
0
ファイル: Vendor.php プロジェクト: VishalRajai/Hackers4Life
 function business_settings($para1 = "", $para2 = "")
 {
     if (!$this->crud_model->vendor_permission('business_settings')) {
         redirect(base_url() . 'index.php/vendor');
     }
     if ($para1 == "cash_set") {
         $val = '';
         if ($para2 == 'true') {
             $val = 'ok';
         } else {
             if ($para2 == 'false') {
                 $val = 'no';
             }
         }
         echo $val;
         $this->db->where('vendor_id', $this->session->userdata('vendor_id'));
         $this->db->update('vendor', array('cash_set' => $val));
     } else {
         if ($para1 == "paypal_set") {
             $val = '';
             if ($para2 == 'true') {
                 $val = 'ok';
             } else {
                 if ($para2 == 'false') {
                     $val = 'no';
                 }
             }
             echo $val;
             $this->db->where('vendor_id', $this->session->userdata('vendor_id'));
             $this->db->update('vendor', array('paypal_set' => $val));
         } else {
             if ($para1 == "stripe_set") {
                 $val = '';
                 if ($para2 == 'true') {
                     $val = 'ok';
                 } else {
                     if ($para2 == 'false') {
                         $val = 'no';
                     }
                 }
                 echo $val;
                 $this->db->where('vendor_id', $this->session->userdata('vendor_id'));
                 $this->db->update('vendor', array('stripe_set' => $val));
             } else {
                 if ($para1 == "membership_price") {
                     echo $this->db->get_where('membership', array('membership_id' => $para2))->row()->price;
                 } else {
                     if ($para1 == "membership_info") {
                         $return = '<div class="table-responsive"><table class="table table-striped">';
                         if ($para2 !== '0') {
                             $results = $this->db->get_where('membership', array('membership_id' => $para2))->result_array();
                             foreach ($results as $row) {
                                 $return .= '<tr>';
                                 $return .= '<td>' . translate('title') . '</td>';
                                 $return .= '<td>' . $row['title'] . '</td>';
                                 $return .= '</tr>';
                                 $return .= '<tr>';
                                 $return .= '<td>' . translate('price') . '</td>';
                                 $return .= '<td>' . currency() . $row['price'] . '</td>';
                                 $return .= '</tr>';
                                 $return .= '<tr>';
                                 $return .= '<td>' . translate('timespan') . '</td>';
                                 $return .= '<td>' . $row['timespan'] . '</td>';
                                 $return .= '</tr>';
                                 $return .= '<tr>';
                                 $return .= '<td>' . translate('maximum_product') . '</td>';
                                 $return .= '<td>' . $row['product_limit'] . '</td>';
                                 $return .= '</tr>';
                             }
                         } else {
                             if ($para2 == '0') {
                                 $return .= '<tr>';
                                 $return .= '<td>' . translate('title') . '</td>';
                                 $return .= '<td>' . translate('default') . '</td>';
                                 $return .= '</tr>';
                                 $return .= '<tr>';
                                 $return .= '<td>' . translate('price') . '</td>';
                                 $return .= '<td>' . translate('free') . '</td>';
                                 $return .= '</tr>';
                                 $return .= '<tr>';
                                 $return .= '<td>' . translate('timespan') . '</td>';
                                 $return .= '<td>' . translate('lifetime') . '</td>';
                                 $return .= '</tr>';
                                 $return .= '<tr>';
                                 $return .= '<td>' . translate('maximum_product') . '</td>';
                                 $return .= '<td>' . $this->db->get_where('general_settings', array('type' => 'default_member_product_limit'))->row()->value . '</td>';
                                 $return .= '</tr>';
                             }
                         }
                         $return .= '</table></div>';
                         echo $return;
                     } else {
                         if ($para1 == 'set') {
                             $publishable = $this->input->post('stripe_publishable');
                             $secret = $this->input->post('stripe_secret');
                             $stripe = json_encode(array('publishable' => $publishable, 'secret' => $secret));
                             $this->db->where('vendor_id', $this->session->userdata('vendor_id'));
                             $this->db->update('vendor', array('paypal_email' => $this->input->post('paypal_email')));
                             $this->db->where('vendor_id', $this->session->userdata('vendor_id'));
                             $this->db->update('vendor', array('stripe_details' => $stripe));
                         } else {
                             $page_data['page_name'] = "business_settings";
                             $this->load->view('back/index', $page_data);
                         }
                     }
                 }
             }
         }
     }
 }
コード例 #7
0
ファイル: added_list.php プロジェクト: josephcb24/Tutu
                <small><?php 
            echo translate('total');
            ?>
 : <?php 
            echo currency();
            echo $this->cart->format_number($items['subtotal'] + $shipping_n + $tax_n);
            ?>
</small>
                <?php 
        } else {
            ?>
                <small><?php 
            echo translate('total');
            ?>
 : <?php 
            echo currency();
            echo $this->cart->format_number($items['subtotal'] + $tax_n);
            ?>
</small>
                <?php 
        }
        ?>
            </div>
        </li>
        <?php 
    }
    ?>
        <li class="subtotal" id="subtotal">
            <div class="overflow-h margin-bottom-10">
                <div>
                    <span><?php 
コード例 #8
0
invoice_itemqty').val(),<?php 
        echo $invoice_item_id;
        ?>
);" onkeyup="setamount($('#<?php 
        echo $invoice_item_id;
        ?>
invoice_itemqty').val(),<?php 
        echo $invoice_item_id;
        ?>
);">
                                    </td>
                                    <td nowrap="">
                                        <span class="currency">
                                <?php 
        //name="invoice_invoice_item[new][amount]"
        echo currency('<span value="" id="' . $invoice_item_id . 'invoice_itemamount" class="">' . $invoice_item_data['invoice_item_amount'] . '</span>', true, $invoice['currency_id']);
        ?>

                                </span>

                                        <?php 
        //echo currency('<input type="text" name="invoice_invoice_item['.$invoice_item_id.'][amount]" value="'.$invoice_item_data['invoice_item_amount'].'" id="'.$invoice_item_id.'invoice_itemamount" class="currency">',true,$invoice['currency_id']);
        ?>

                                    </td>
                                    <td nowrap="nowrap" align="center">
                                        <input type="submit" name="ts" class="save_invoice_item small_button" value="<?php 
        _e('Save');
        ?>
">
                                    </td>
コード例 #9
0
ファイル: finance.php プロジェクト: sgh1986915/php-crm
 public static function get_finance_summary($week_start, $week_end, $multiplyer = 1, $row_limit = 7)
 {
     $cache_key = 'finance_sum_' . md5(module_security::get_loggedin_id() . '_' . serialize(func_get_args()));
     $cache_timeout = module_config::c('cache_objects', 60);
     if ($cached_item = module_cache::get('finance', $cache_key)) {
         return $cached_item;
     }
     $base_href = module_finance::link_generate(false, array('full' => false, 'page' => 'dashboard_popup', 'arguments' => array('display_mode' => 'ajax')), array('foo'));
     $base_href .= '&';
     /*$base_href .= (strpos($base_href,'?')!==false) ? '&' : '?';
       $base_href .= 'display_mode=ajax&';
       $base_href .= 'home_page_stats=true&';*/
     // init structure:
     if ($multiplyer > 1) {
         $row_limit++;
     }
     for ($x = 0; $x < $row_limit; $x++) {
         //$time = strtotime("+$x days",strtotime($week_start));
         $time = strtotime("+" . $x * $multiplyer . " days", strtotime($week_start));
         $data[date("Ymd", $time)] = array("day" => $time, "hours" => 0, "amount" => 0, "amount_invoiced" => 0, "amount_paid" => 0, "amount_spent" => 0);
         if (class_exists('module_envato', false)) {
             $data[date("Ymd", $time)]['envato_earnings'] = 0;
         }
     }
     $data['total'] = array('day' => _l('Totals:'), 'week' => _l('Totals:'), 'hours' => 0, 'amount' => 0, 'amount_invoiced' => 0, 'amount_paid' => 0, 'amount_spent' => 0);
     if (class_exists('module_envato', false)) {
         $data['total']['envato_earnings'] = 0;
     }
     if (class_exists('module_job', false)) {
         module_debug::log(array('title' => 'Finance Dashboard Job', 'data' => ''));
         // find all task LOGS completed within these dayes
         $sql = "SELECT t.task_id, tl.date_created, t.hours AS task_hours, t.amount, tl.hours AS hours_logged, p.job_id, p.hourly_rate, t.date_done ";
         //            $sql .= " FROM `"._DB_PREFIX."task_log` tl ";
         //            $sql .= " LEFT JOIN `"._DB_PREFIX."task` t ON tl.task_id = t.task_id ";
         $sql .= " FROM `" . _DB_PREFIX . "task` t";
         $sql .= " LEFT JOIN `" . _DB_PREFIX . "task_log` tl ON t.task_id = tl.task_id ";
         $sql .= " LEFT JOIN `" . _DB_PREFIX . "job` p ON t.job_id = p.job_id";
         $sql .= " WHERE ( (tl.date_created >= '{$week_start}' AND tl.date_created < '{$week_end}') OR (t.fully_completed = 1 AND t.date_done >= '{$week_start}' AND t.date_done < '{$week_end}') )";
         $sql .= " AND t.job_id IN ( ";
         $valid_job_ids = module_job::get_valid_job_ids();
         if (count($valid_job_ids)) {
             foreach ($valid_job_ids as $valid_job_id) {
                 $sql .= (int) $valid_job_id['job_id'] . ", ";
             }
             $sql = rtrim($sql, ', ');
         } else {
             $sql .= ' NULL ';
         }
         $sql .= " ) ";
         //            echo $sql;
         $tasks = query($sql);
         $logged_tasks = array();
         while ($r = mysql_fetch_assoc($tasks)) {
             if (!$r['date_created']) {
                 $r['date_created'] = $r['date_done'];
             }
             if ($multiplyer > 1) {
                 $week_day = date('w', strtotime($r['date_created'])) - 1;
                 $r['date_created'] = date('Y-m-d', strtotime('-' . $week_day . ' days', strtotime($r['date_created'])));
             }
             $key = date("Ymd", strtotime($r['date_created']));
             if (!isset($data[$key])) {
                 // for some reason we're getting results here that shouldn't be in the list
                 // for now we just skip these results until I figure out why (only had 1 guy report this error, maybe misconfig)
                 continue;
             }
             // copied from dashboard_popup_hours_logged.php
             // needed get_tasks call to do the _JOB_TASK_ACCESS_ASSIGNED_ONLY permission check
             $jobtasks = module_job::get_tasks($r['job_id']);
             $task = isset($jobtasks[$r['task_id']]) ? $jobtasks[$r['task_id']] : false;
             if (!$task) {
                 continue;
             }
             if (!isset($task['manual_task_type']) || $task['manual_task_type'] < 0) {
                 $task['manual_task_type'] = $task['default_task_type'];
             }
             if (isset($r['hours_logged']) && $r['hours_logged'] > 0) {
                 if ($r['hours_logged'] == $task['completed']) {
                     // this listing is the only logged hours for this task.
                     if ($task['fully_completed']) {
                         // task complete, we show the final amount and hours.
                         if ($task['amount'] > 0) {
                             if ($task['manual_task_type'] == _TASK_TYPE_QTY_AMOUNT) {
                                 $display_amount = $task['amount'] * $task['hours'];
                             } else {
                                 $display_amount = $task['amount'];
                             }
                         } else {
                             $display_amount = $r['task_hours'] * $r['hourly_rate'];
                         }
                     } else {
                         // task isn't fully completed yet, just use hourly rate for now.
                         $display_amount = $r['hours_logged'] * $r['hourly_rate'];
                     }
                 } else {
                     // this is part of a bigger log of hours for this single task.
                     $display_amount = $r['hours_logged'] * $r['hourly_rate'];
                 }
                 $hours_logged = $r['task_hours'] > 0 ? $r['hours_logged'] : 0;
             } else {
                 // there are no logged hours for this particular task, but it is set to completed.
                 // we just assume it is completed on this day.
                 if ($task['amount'] > 0) {
                     if ($task['manual_task_type'] == _TASK_TYPE_QTY_AMOUNT) {
                         $display_amount = $task['amount'] * $task['hours'];
                     } else {
                         $display_amount = $task['amount'];
                     }
                 } else {
                     $display_amount = $r['task_hours'] * $r['hourly_rate'];
                 }
                 $hours_logged = $task['hours'];
             }
             $data[$key]['amount'] += $display_amount;
             $data['total']['amount'] += $display_amount;
             $data[$key]['hours'] += $hours_logged;
             $data['total']['hours'] += $hours_logged;
             /*$hourly_rate = $r['hourly_rate'];
               if($hours_logged > 0 && $r['amount'] > 0 && $hourly_rate > 0){
                   // there is a custom amount assigned to thsi task.
                   // only calculate this amount if the full hours is complete.
                   $hourly_rate = $r['amount'] / $r['task_hours'];
               }
               if($hours_logged > 0 && $hourly_rate > 0){
                   $data[$key]['amount'] += ($hours_logged * $hourly_rate);
                   $data['total']['amount'] += ($hours_logged * $hourly_rate);
               }*/
         }
     }
     module_debug::log(array('title' => 'Finance Dashboard Invoices', 'data' => ''));
     // find invoices sent this week.
     $sql = "SELECT i.* ";
     $sql .= " FROM `" . _DB_PREFIX . "invoice` i ";
     $sql .= " LEFT JOIN `" . _DB_PREFIX . "invoice_item` ii ON i.invoice_id = ii.invoice_id ";
     if (class_exists('module_job', false)) {
         $sql .= " LEFT JOIN `" . _DB_PREFIX . "task` t ON ii.task_id = t.task_id ";
         $sql .= " LEFT JOIN `" . _DB_PREFIX . "job` p ON t.job_id = p.job_id ";
     }
     $sql .= " WHERE (i.date_create >= '{$week_start}' AND i.date_create <= '{$week_end}')";
     $sql .= " GROUP BY i.invoice_id";
     // todo - sql in here to limit what they can see.
     $invoices = query($sql);
     // group invoices into days of the week.
     while ($invoice_data = mysql_fetch_assoc($invoices)) {
         //$invoice_data = module_invoice::get_invoice($i['invoice_id']);
         if ($invoice_data) {
             if ($multiplyer > 1) {
                 $week_day = date('w', strtotime($invoice_data['date_create'])) - 1;
                 $invoice_data['date_create'] = date('Y-m-d', strtotime('-' . $week_day . ' days', strtotime($invoice_data['date_create'])));
             }
             $key = date("Ymd", strtotime($invoice_data['date_create']));
             if (!isset($data[$key])) {
                 // for some reason we're getting results here that shouldn't be in the list
                 // for now we just skip these results until I figure out why (only had 1 guy report this error, maybe misconfig)
                 continue;
             }
             if (isset($data[$key])) {
                 $data[$key]['amount_invoiced'] += $invoice_data['c_total_amount'];
                 $data['total']['amount_invoiced'] += $invoice_data['c_total_amount'];
             }
         }
     }
     module_debug::log(array('title' => 'Finance Dashboard Finances', 'data' => ''));
     // find all payments made this week.
     // we also have to search for entries in the new "finance" table and make sure we dont double up here.
     $finance_records = module_finance::get_finances(array('date_from' => $week_start, 'date_to' => $week_end));
     foreach ($finance_records as $finance_record) {
         if (isset($finance_record['payment_type']) && ($finance_record['payment_type'] == _INVOICE_PAYMENT_TYPE_OVERPAYMENT_CREDIT || $finance_record['payment_type'] == _INVOICE_PAYMENT_TYPE_CREDIT)) {
             // CODE COPIED FROM FINANCE_LIST.PHP
             // dont add these ones to the totals on the dashboard
             continue;
         }
         if ($finance_record['credit'] > 0) {
             if ($multiplyer > 1) {
                 $week_day = date('w', strtotime($finance_record['transaction_date'])) - 1;
                 $finance_record['transaction_date'] = date('Y-m-d', strtotime('-' . $week_day . ' days', strtotime($finance_record['transaction_date'])));
             }
             $key = date("Ymd", strtotime($finance_record['transaction_date']));
             if (isset($data[$key])) {
                 $data[$key]['amount_paid'] += $finance_record['amount'];
                 $data['total']['amount_paid'] += $finance_record['amount'];
             }
         }
         if ($finance_record['debit'] > 0) {
             if ($multiplyer > 1) {
                 $week_day = date('w', strtotime($finance_record['transaction_date'])) - 1;
                 $finance_record['transaction_date'] = date('Y-m-d', strtotime('-' . $week_day . ' days', strtotime($finance_record['transaction_date'])));
             }
             $key = date("Ymd", strtotime($finance_record['transaction_date']));
             if (isset($data[$key])) {
                 $data[$key]['amount_spent'] += $finance_record['amount'];
                 $data['total']['amount_spent'] += $finance_record['amount'];
             }
         }
     }
     module_debug::log(array('title' => 'Finance Dashboard DONE!', 'data' => ''));
     /*$sql = "SELECT p.* ";
       $sql .= " FROM `"._DB_PREFIX."invoice_payment` p ";
       $sql .= " WHERE (p.date_paid >= '$week_start' AND p.date_paid <= '$week_end')";
       // todo - sql in here to limit what they can see.
       $payments = query($sql);
       // group invoices into days of the week.
       while($payment = mysql_fetch_assoc($payments)){
           //$invoice_data = module_invoice::get_invoice($i['invoice_id']);
           if($multiplyer > 1){
               $week_day = date('w',strtotime($payment['date_paid'])) - 1;
               $payment['date_paid'] = date('Y-m-d',strtotime('-'.$week_day.' days',strtotime($payment['date_paid'])));
           }
           $key = date("Ymd",strtotime($payment['date_paid']));
           if(isset($data[$key])){
               $data[$key]['amount_paid'] += $payment['amount'];
               $data['total']['amount_paid'] += $payment['amount'];
           }
       }*/
     if (class_exists('module_envato', false)) {
         $envato_currency = "USD";
         $envato = new envato_api();
         $local_currency = $envato->read_setting("local_currency", "AUD");
         $currency_convert_multiplier = $envato->currency_convert($envato_currency, $local_currency);
         // find summary of earnings between these dates in the envato statement.
         $week_start_time = strtotime($week_start);
         $week_end_time = strtotime($week_end);
         $sql = "SELECT * FROM `" . _DB_PREFIX . "envato_statement` s WHERE `time` >= '{$week_start_time}' AND `time` <= {$week_end_time}";
         $sql .= " AND ( `type` = 'sale' OR `type` = 'referral_cut' )";
         foreach (qa($sql) as $sale) {
             $sale_time = $sale['time'];
             if ($multiplyer > 1) {
                 $week_day = date('w', $sale_time) - 1;
                 $sale_time = strtotime('-' . $week_day . ' days', $sale_time);
             }
             $key = date("Ymd", $sale_time);
             if (!isset($data[$key])) {
                 continue;
             }
             $data[$key]['envato_earnings'] += round($currency_convert_multiplier * $sale['earnt'], 2);
             $data['total']['envato_earnings'] += round($currency_convert_multiplier * $sale['earnt'], 2);
             /*if($sale['type']=='sale'){
                   $sales_count++;
               }
               $sales_amount+= $sale['earnt'];*/
         }
     }
     if ($multiplyer > 1) {
         // dont want totals on previous weeks listing
         unset($data['total']);
     }
     foreach ($data as $data_id => $row) {
         //$row['amount'] = dollar($row['amount']);
         $row['chart_amount'] = $row['amount'];
         $row['amount'] = currency((int) $row['amount']);
         $row['chart_amount_invoiced'] = $row['amount_invoiced'];
         $row['amount_invoiced'] = currency((int) $row['amount_invoiced']);
         $row['chart_amount_paid'] = $row['amount_paid'];
         $row['amount_paid'] = currency((int) $row['amount_paid']);
         $row['chart_amount_spent'] = $row['amount_spent'];
         $row['amount_spent'] = currency((int) $row['amount_spent']);
         if (class_exists('module_envato', false)) {
             $row['chart_envato_earnings'] = $row['envato_earnings'];
             $row['envato_earnings'] = currency((int) $row['envato_earnings']);
         }
         // combine together
         $row['chart_hours'] = $row['hours'];
         $row['hours'] = sprintf('%s (%s)', $row['hours'], $row['amount']);
         if (is_numeric($row['day'])) {
             $time = $row['day'];
             $date = date('Y-m-d', $time);
             $row['date'] = $date;
             if ($multiplyer > 1) {
                 $date .= '|' . date('Y-m-d', strtotime('+' . $multiplyer . ' days', $time));
             }
             //$row['hours'] = '<a href="'.$base_href.'w=hours&date='.$date.'" class="summary_popup">'. _l('%s hours',$row['hours']) . '</a>';
             $row['hours_link'] = '<a href="' . $base_href . 'w=hours&date=' . $date . '" class="summary_popup">' . $row['hours'] . '</a>';
             $row['amount_link'] = '<a href="' . $base_href . 'w=hours&date=' . $date . '" class="summary_popup">' . $row['amount'] . '</a>';
             $row['amount_invoiced_link'] = '<a href="' . $base_href . 'w=amount_invoiced&date=' . $date . '" class="summary_popup">' . $row['amount_invoiced'] . '</a>';
             $row['amount_paid_link'] = '<a href="' . $base_href . 'w=amount_paid&date=' . $date . '" class="summary_popup">' . $row['amount_paid'] . '</a>';
             $row['amount_spent_link'] = '<a href="' . $base_href . 'w=amount_spent&date=' . $date . '" class="summary_popup">' . $row['amount_spent'] . '</a>';
             $row['day'] = _l(date('D', $time)) . ' ' . date('j', $time) . _l(date('S', $time));
             $row['week'] = _l(date('M', $time)) . ' ' . date('j', $time) . _l(date('S', $time));
             // if it's today.
             if ($time == strtotime(date("Y-m-d"))) {
                 $row['highlight'] = true;
             }
         } else {
         }
         $data[$data_id] = $row;
     }
     module_cache::put('finance', $cache_key, $data, $cache_timeout);
     return $data;
 }
コード例 #10
0
ファイル: start_helper.php プロジェクト: Calit2-UCI/IoT_Map
 /**
  * Returns unformatted currency string
  * Or unformatted if payments is not installed
  *
  * @param int $params['cur_id'] currency id
  * @param string $params['cur_gid'] currency gid
  * @param int $params['value'] amount
  * @param string $params['template']&nbsp;[abbr][value|dec_part:2|dec_sep:.|gr_sep:&nbsp;]
  * @return string
  */
 function currency_output($params = array())
 {
     $CI =& get_instance();
     if ($CI->pg_module->is_module_installed('payments')) {
         $CI->load->helper('payments');
         return currency($params);
     } else {
         return '<span dir="ltr">' . $params['value'] . '&nbsp;USD</span>';
     }
 }
コード例 #11
0
ファイル: header.php プロジェクト: buyzer/ferina-themes
if ($keranjang != null) {
    foreach ($keranjang as $key => $val) {
        if ($val['type'] == 'retail') {
            $harga = get_post_meta($val['id'], 'mtb_harga_satuan_retail', true);
        } else {
            if ($val['jumlah'] < 10) {
                $harga = get_post_meta($val['id'], 'mtb_harga_grossir_5_item', true);
            } else {
                $harga = get_post_meta($val['id'], 'mtb_harga_grossir_10_item', true);
            }
        }
        $url = wp_get_attachment_url(get_post_thumbnail_id($val['id']));
        if ($url != "") {
            echo '<li><img style="width: 25%;" src="' . $url . '"><span>' . get_the_title($val['id'], 'thumbnail') . ' <br/>' . currency($harga) . '</span></li>';
        } else {
            echo '<li><span>' . get_the_title($val['id'], 'thumbnail') . ' <br/>' . currency($harga) . '</span></li>';
        }
    }
    ?>
									<li class="for-link">
										<a title="<?php 
    _e('View Cart', 'ferina');
    ?>
" href="<?php 
    get_the_permalink(get_option('cart_pages'));
    ?>
"><?php 
    _e('View Cart', 'ferina');
    ?>
</a>
										<a title="<?php 
コード例 #12
0
ファイル: home-old.php プロジェクト: Garybaldy/rotio
"><?php 
echo loadImgProduk($lsrate->id . '/' . $lsrate->idgbr . '/' . $gb);
?>
</a><? }?><br />
		<? if($hb==0){?>
		<span class="rp">Rp. <?php 
echo currency($ha);
?>
</span>
        <? }else{?>
		<span class="rpline">Rp. <?php 
echo currency($ha);
?>
</span><br />
		<span class="rp">Rp. <?php 
echo currency($hb);
?>
</span>
        <? }?>

		<? //------ rating bintang
		$def_width_star3=11; // artinya 11px
		$total_width_star3=0;
		if($lsrate->rate!=0){
			$res_rate3=$lsrate->rate/$lsrate->cust;
			$total_width_star3=ceil($def_width_star3*$res_rate3);
		}
		?>
	<ul style="margin-left:80px;margin-top:5px;">
		<li style="text-align:right;float:left;padding-top:3px">
			<div id="staroff" style="float:right"><div id="staron" style="width:<?php 
コード例 #13
0
ファイル: places.php プロジェクト: JamesWuChina/CI-Property
 public function get_ajax($offset = 0)
 {
     $count = $this->m_places->get_place();
     $perpage = getOptions('paging');
     if (count($count) > $perpage) {
         $this->load->library('pagination');
         $config['base_url'] = site_url('admin/places/get_ajax');
         $config['total_rows'] = count($count);
         $config['per_page'] = $perpage;
         $config['uri_segment'] = 4;
         $q = $this->pagination->initialize($config);
         $offset = $this->uri->segment(4) ? $this->uri->segment(4) : 0;
     } else {
         $this->data['pagination'] = '';
         $offset = 0;
     }
     $telo = $this->m_places->get_place($perpage, $offset);
     $str = '';
     if ($telo) {
         $str .= '<table class="table table-bordered table-condensed"">
                     <thead>
                         <tr class="active">
                             <th class="text-center">Image</th>
                             <th class="text-center">Title</th>
                             <th class="text-center">Type</th>
                             <th class="text-center">Price</th>
                             <th class="text-center">Action</th>
                         </tr>
                     </thead>
                     <tbody>';
         foreach ($telo as $s) {
             $str .= '<tr class="text-center">';
             $str .= $s->image ? '<td class="col-md-1"><img src="' . base_url('assets/img/timthumb.php') . '?src=' . base_url($s->image) . '&zc=0&h=140&w=180"></td>' : '<td class="col-md-1"><img class="img-responsive" src="http://placehold.it/100x100&text=no+primary+image"></td>';
             $str .= '<td>' . $s->title_places . '</td>';
             $str .= '<td>' . ($s->title_type === null ? 'Not Set' : $s->title_type) . '</td>';
             $str .= '<td>' . ($s->prices === null ? 'Not Set' : $this->data['currency'][getOptions('currency')] . ' ' . currency($s->prices)) . '</td>';
             $str .= '<td><a href="' . site_url('admin/places/edit') . '/' . $s->id_places . '" class="btn btn-default">Edit</a>';
             $str .= '<a id="del-' . $s->id_places . '" href="' . site_url('admin/places/del_places') . '/' . $s->id_places . '" class="btn btn-default del-in">Delete</a></td>';
             $str .= '</tr>';
         }
         $str .= '<tbody></table>';
         $str .= '<div>' . $this->pagination->create_links() . '</div>';
     } else {
         $str .= 'No Data Found';
     }
     echo $str;
 }
コード例 #14
0
ファイル: ajax_task_edit.php プロジェクト: sgh1986915/php-crm
         // no hour input
     } else {
         echo $hours_value;
     }
 }
 ?>
 </td>
 <?php 
 if (module_invoice::can_i('view', 'Invoices')) {
     ?>
 <td nowrap="">
     <?php 
     if ($task_editable) {
         ?>
         <?php 
         echo currency('<input type="text" name="job_task[' . $task_id . '][staff_amount]" value="' . ($task_data['staff_amount'] != 0 ? number_out($task_data['staff_amount']) : number_out($task_data['staff_hours'] * $job['staff_hourly_rate'])) . '" id="' . $task_id . 'staff_taskamount" class="currency" tabindex="15">');
         ?>
     <?php 
     } else {
         ?>
         <?php 
         echo $task_data['staff_amount'] != 0 ? dollar($task_data['staff_amount'], true, $job['currency_id']) : dollar($task_data['staff_hours'] * $job['staff_hourly_rate'], true, $job['currency_id']);
         ?>
     <?php 
     }
     ?>
 </td>
 <?php 
 }
 ?>
 <td colspan="<?php 
コード例 #15
0
ファイル: invoice.php プロジェクト: ideagital/jinuemall.com
 PV
                          </h4>
                        </td>
                      </tr>
                      <tr>
                        <td class="text-right" colspan="5">
                          <h4 class="text-primary">
                            <?php 
echo wordvar('Net Total');
?>
                          </h4>
                        </td>
                        <td>
                          <h4 class="text-primary">
                            <?php 
echo currency($order['order_total']);
?>
                          </h4>
                        </td>
                      </tr>
                    </tfoot>
                  </table>
                </div>
              </div>
            </div>
          </div>
          <div class="row">
            <div class="col-lg-12">
              <div class="well">
                <strong><?php 
echo wordvar('Notes');
コード例 #16
0
ファイル: aff.php プロジェクト: Garybaldy/rotio
?>
</td>
	<td><?php 
echo format_date_ina($lk->daftar, '-', ' ');
?>
</td>
	<td><?php 
echo $lk->no_tlp;
?>
</td>
	<td><?php 
echo currency($lk->min_transfer);
?>
</td>
	<td><?php 
echo currency($lk->komisi);
?>
</td>
	<td>
	<?php 
echo anchor(config_item('modulename') . '/' . $this->router->class . '/detail/' . $lk->id, loadImg('icon/edit.png', '', false, config_item('modulename'), true), array('title' => lang('edit')));
?>
	<?php 
echo anchor(config_item('modulename') . '/' . $this->router->class . '/delete/' . $lk->id, loadImg('icon/delete.png', '', false, config_item('modulename'), true), array('title' => lang('del'), 'class' => 'butdel'));
?>
	<? if($lk->selisih>0){?><input type="checkbox" name="check_kom" value="<?php 
echo $lk->id_komisi;
?>
" /><? }?>
	</td>
</tr>
コード例 #17
0
        ?>
</td>
                    <td>#<?php 
        echo $row['sale_code'];
        ?>
</td>
                    <td><?php 
        echo $this->crud_model->get_type_name_by_id('user', $row['buyer'], 'username');
        ?>
</td>
                    <td><?php 
        echo date('d-m-Y', $row['sale_datetime']);
        ?>
</td>
                    <td><?php 
        echo currency() . $this->cart->format_number($this->crud_model->vendor_share_in_sale($row['sale_id'], $this->session->userdata('vendor_id'))['total']);
        ?>
</td>               
                </tr>
                <?php 
    }
}
?>
                </tbody>
        </table>
    </div>
    
<style type="text/css">
    .pending{
        background: #D2F3FF  !important;
    }
コード例 #18
0
foreach ($all_users as $row) {
    $i++;
    ?>
				<tr>
					<td><?php 
    echo $i;
    ?>
</td>
					<td><?php 
    echo $row['username'];
    ?>
 <?php 
    echo $row['surname'];
    ?>
</td>
					<td><?php 
    echo $row['email'];
    ?>
</td>
					<td><?php 
    echo currency() . $this->crud_model->total_purchase($row['user_id']);
    ?>
</td>            	
				</tr>
	            <?php 
}
?>
				</tbody>
		</table>
	</div>
           
コード例 #19
0
ファイル: header.php プロジェクト: ideagital/jinuemall.com
                </a>
                <ul class="dropdown-menu">
				<?php 
while ($transactions = mysqli_fetch_array($transactions_query)) {
    ?>
                  <li>
					<a href="<?php 
    echo $site_url;
    ?>
/wallet/transactions">
						
					<?php 
    if ($transactions['income'] != "") {
        echo "<div class='notifications label  label-primary label-success'>" . currency($transactions['income']) . "</div>";
    } elseif ($transactions['expend'] != "") {
        echo "<div class='notifications label  label-primary label-danger'>" . currency($transactions['expend']) . "</div>";
    }
    ?>
						<p>
						<?php 
    if ($transactions['transaction'] == "receive") {
        echo wordvar($transactions['transaction_description']) . " <u>\$" . number_format($transactions['income'] * 1) . "</u>";
        $amount_status = "success";
    } elseif ($transactions['transaction'] == "pay") {
        echo wordvar($transactions['transaction_description']) . " <u>\$" . number_format($transactions['expend'] * 1) . "</u>";
        $amount_status = "danger";
    } elseif ($transactions['transaction'] == "transfer") {
        echo wordvar($transactions['transaction_description']) . " <u>\$" . number_format($transactions['expend'] * 1) . "</u>";
        $amount_status = "danger";
    } elseif ($transactions['transaction'] == "withdraw") {
    } elseif ($transactions['transaction'] == "upgrade") {
コード例 #20
0
ファイル: search.php プロジェクト: ideagital/jinuemall.com
									<h2 class="name">
										<a href="<?php 
    echo $site_url . '/' . $product['product_url'];
    ?>
"><?php 
    echo $product['product_name'];
    ?>
</a>	
									</h2>	

									<div class="price-box"> 

	                                  	<p class="special-price">
	                                   		<span class="price"><?php 
    echo currency($product['product_price_member']);
    ?>
</span> 
	                                  	</p>  
		                          	</div>
								</div>
							</div>
							<!-- END GRID ITEM -->
						</div>
						<?php 
}
?>
					</div>
				</div>
				<!-- END GRID CONTENT -->
コード例 #21
0
ファイル: cekout.php プロジェクト: Garybaldy/rotio
 : Rp <label id="total_biaya_kirim"><?php 
echo currency($total_biaya_kirim);
?>
 </label><span class="load_biaya_kirim"></span><br />
    	<?php 
echo lang('kode_unik_trans');
?>
 : Rp <label><?php 
echo currency($kode_unik);
?>
 </label><br />
	<?php 
echo lang('transfer_unik');
?>
 <b><span>Rp. <span id="biaya_total"><?php 
echo currency($tot);
?>
</span> <span class="load_biaya_kirim"></span></span></b>
	</ul>
</div>
<br>
<div class="wrap-ct">
	<div class="head-title-member">
		<h3><?php 
echo lang('chose_bayar');
?>
</h3>
	</div>
	<ul class="form" style="padding:15px;">
		<h6><input id="c1" type="checkbox" name="bayar" value="1" /> <?php 
echo lang('tansfer_bank');
コード例 #22
0
ファイル: Currency.php プロジェクト: nerea91/laravel
 /**
  * Format currency $number for humans, adding digit separators and currency sybol.
  *
  * @param  float
  * @param  integer
  *
  * @return string
  */
 public function format($number, $precision = 2)
 {
     return currency($number, $this, $precision);
 }
コード例 #23
0
ファイル: kupon.php プロジェクト: Garybaldy/rotio
?>
">
	<td><?php 
echo $i;
?>
</td>
	<td><?php 
echo $lk->kode_kupon;
?>
</td>
	<td><?php 
echo $arr_jenis_kupon[$lk->jenis_kupon];
?>
</td>
	<td><?php 
echo currency($lk->nilai_kupon);
?>
</td>	
	<td><?php 
echo format_date_ina($lk->tgl_awal, '-', ' ');
?>
</td>
	<td><?php 
echo format_date_ina($lk->tgl_akhir, '-', ' ');
?>
</td>
	<td><?php 
echo $arr_status_kupon[$lk->status_kupon];
?>
</td>	
	<td>
コード例 #24
0
ファイル: signup.php プロジェクト: ideagital/jinuemall.com
								<div class="number">
									R-Wallet
								</div>
								<div class="text">
									<input type="radio" id="rMoney" name="payment_method" <?php 
    if ($me['rMoney'] >= $package['package_price']) {
        echo "checked";
    } else {
        echo "disabled";
    }
    ?>
 value="rMoney"><span><?php 
    echo wordvar('Current balance');
    ?>
 : <?php 
    echo currency($me['rMoney'] * 1);
    ?>
</span>
								</div>
							</label>
						</div>
					</div>
						<!--div class="col-md-4 form-group">
						<label class="checkbox-inline">
							<h3>
								Use 
							</h3>
							
							<div class="text">
								<input type="checkbox"><span>Hold PV</span>
							</div>
コード例 #25
0
ファイル: sales_view.php プロジェクト: josephcb24/Tutu
                                <td><b><?php 
    echo translate('shipping');
    ?>
</b></td>
                                <td><?php 
    echo currency() . $this->cart->format_number($row['shipping']);
    ?>
</td>
                            </tr>
                            <tr>
                                <td><b><?php 
    echo translate('grand_total');
    ?>
</b></td>
                                <td><?php 
    echo currency() . $this->cart->format_number($row['grand_total']);
    ?>
</td>
                            </tr>
                        </tbody>
                    </table>
                </div> 
            </div>  
        </div>
	</div>
</div>

<div class="row">
	<div class="col-md-12">
        <div class="col-lg-6 col-md-6 col-sm-6">
        </div>
コード例 #26
0
ファイル: upgrade-form.php プロジェクト: epochwolf/kairos
echo $current_level->name;
?>
 ($0) <span class="text-muted">Current Level</span>
    </label>
  </div>

  <?php 
foreach ($upgrades as $upgrade) {
    ?>
    <div class="radio">
      <label>
        <input type="radio" name="admission_level" value="<?php 
    echo $upgrade->to;
    ?>
">
        <?php 
    echo $upgrade->to_name;
    ?>
 (<?php 
    echo currency($upgrade->price_for($form->attendee));
    ?>
)
      </label>
    </div>
  <?php 
}
?>
  <?php 
echo error_display($form, "admission_level");
?>
</div>
コード例 #27
0
								<?php 
                $x++;
            }
            ?>
						</td>
					</tr>
					<tr>
						<th>
							<?php 
            _e('Payment Amount');
            ?>
						</th>
						<td>
							<?php 
            if (module_config::c('invoice_allow_payment_amount_adjustment', 1)) {
                echo currency('<input type="text" name="payment_amount" value="' . number_out($invoice['total_amount_due']) . '" class="currency">', true, $invoice['currency_id']);
            } else {
                echo dollar($invoice['total_amount_due'], true, $invoice['currency_id']);
                echo '<input type="hidden" name="payment_amount" value="' . number_out($invoice['total_amount_due']) . '">';
            }
            ?>
						</td>
					</tr>
					<tr>
						<td>&nbsp;</td>
						<td>
							<input type="submit" name="pay" value="<?php 
            _e('Make Payment');
            ?>
"
							       class="submit_button save_button">
コード例 #28
0
ファイル: job.php プロジェクト: sgh1986915/php-crm
 public function handle_hook($hook, &$calling_module = false, $show_all = false)
 {
     switch ($hook) {
         case 'dashboard_widgets':
             // see finance for example of widget usage.
             break;
         case "home_alerts":
             $cache_timeout = module_config::c('cache_objects', 60);
             $cache_key = 'home_alerts_' . module_security::get_loggedin_id();
             $alerts = array();
             /*if(module_config::c('job_task_alerts',1)){
                   // find out any overdue tasks or jobs.
                   $sql = "SELECT t.*,p.name AS job_name FROM `"._DB_PREFIX."task` t ";
                   $sql .= " LEFT JOIN `"._DB_PREFIX."job` p USING (job_id) ";
                   $sql .= " WHERE t.date_due != '0000-00-00' AND t.date_due <= '".date('Y-m-d',strtotime('+'.module_config::c('alert_days_in_future',5).' days'))."' AND ((t.hours = 0 AND t.completed = 0) OR t.completed < t.hours)";
                   $tasks = qa($sql);
                   foreach($tasks as $task){
                       $alert_res = process_alert($task['date_due'], _l('Job: %s',$task['job_name']));
                       if($alert_res){
                           $alert_res['link'] = $this->link_open($task['job_id']);
                           $alert_res['name'] = $task['description'];
                           $alerts[] = $alert_res;
                       }
                   }
               }*/
             if ($show_all || module_config::c('job_alerts', 1)) {
                 // find any jobs that are past the due date and dont have a finished date.
                 $key = _l('Incomplete Job');
                 if (class_exists('module_dashboard', false)) {
                     $columns = array('job' => _l('Job Title'), 'customer' => _l('Customer'), 'website' => module_config::c('project_name_single', 'Website'), 'progress' => _l('Job Progress'), 'assigned_staff' => _l('Staff'), 'date' => _l('Due Date'), 'days' => _l('Day Count'));
                     if (!class_exists('module_website', false) || !module_website::is_plugin_enabled()) {
                         unset($columns['website']);
                     }
                     if (!module_customer::can_i('view', 'Customers')) {
                         unset($columns['customer']);
                     }
                     module_dashboard::register_group($key, array('columns' => $columns, 'sort' => array('time' => 'DESC')));
                 }
                 if ($cached_alerts = module_cache::get('job', $cache_key . $key)) {
                     $alerts = array_merge($alerts, $cached_alerts);
                 } else {
                     module_debug::log(array('title' => 'Job Home Alerts: ', 'data' => " starting: " . $key));
                     $this_alerts = array();
                     //                        $sql = "SELECT * FROM `"._DB_PREFIX."job` p ";
                     //                        $sql .= " WHERE p.date_due != '0000-00-00' AND p.date_due <= '".date('Y-m-d',strtotime('+'.module_config::c('alert_days_in_future',5).' days'))."' AND p.date_completed = '0000-00-00'";
                     //                        $tasks = qa($sql);
                     $jobs = self::get_jobs(array(), array('custom_where' => " AND u.date_due != '0000-00-00' AND u.date_due <= '" . date('Y-m-d', strtotime('+' . module_config::c('alert_days_in_future', 5) . ' days')) . "' AND u.date_completed = '0000-00-00'"));
                     foreach ($jobs as $job_data) {
                         // permission check:
                         //                            $job_data = self::get_job($task['job_id']);
                         //                            if(!$job_data || $job_data['job_id']!=$task['job_id'])continue;
                         $alert_res = process_alert($job_data['date_due'], 'temp');
                         if ($alert_res) {
                             $alert_res['link'] = $this->link_open($job_data['job_id'], false, $job_data);
                             $alert_res['name'] = $job_data['name'];
                             // new dashboard alert layout here:
                             $alert_res['time'] = strtotime($alert_res['date']);
                             $alert_res['group'] = $key;
                             $alert_res['job'] = $this->link_open($job_data['job_id'], true, $job_data);
                             $alert_res['customer'] = $job_data['customer_id'] ? module_customer::link_open($job_data['customer_id'], true) : _l('N/A');
                             $alert_res['website'] = $job_data['website_id'] ? module_website::link_open($job_data['website_id'], true) : _l('N/A');
                             $alert_res['assigned_staff'] = $job_data['user_id'] ? module_user::link_open($job_data['user_id'], true) : _l('N/A');
                             $alert_res['progress'] = $job_data['total_percent_complete'] * 100 . '%';
                             $alert_res['date'] = print_date($alert_res['date']);
                             $alert_res['days'] = $alert_res['warning'] ? '<span class="important">' . $alert_res['days'] . '</span>' : $alert_res['days'];
                             $this_alerts['jobincomplete' . $job_data['job_id']] = $alert_res;
                         }
                     }
                     module_debug::log(array('title' => 'Job Home Alerts: ', 'data' => " starting: " . $key . ' #2'));
                     // find any jobs that haven't started yet (ie: have a start date, but no completed tasks)
                     //                        $sql = "SELECT * FROM `"._DB_PREFIX."job` p ";
                     //                        $sql .= " WHERE p.date_completed = '0000-00-00' AND p.date_start != '0000-00-00' AND p.date_start <= '".date('Y-m-d',strtotime('+'.module_config::c('alert_days_in_future',5).' days'))."'";
                     //                        $jobs = qa($sql);
                     $jobs = self::get_jobs(array(), array('custom_where' => " AND u.date_completed = '0000-00-00' AND u.date_due = '0000-00-00' AND u.date_start != '0000-00-00' AND u.date_start <= '" . date('Y-m-d', strtotime('+' . module_config::c('alert_days_in_future', 5) . ' days')) . "'"));
                     foreach ($jobs as $job_data) {
                         //$job_data = self::get_job($job['job_id']);
                         //if(!$job_data || $job_data['job_id']!=$job['job_id'])continue;
                         /*$job_started=true;
                                                     if(module_config::c('job_start_alerts_old',0)){
                                                         $tasks = self::get_tasks($job['job_id']);
                                                         $job_started = false;
                                                         foreach($tasks as $task){
                                                             if($task['fully_completed']){
                                                                 $job_started = true;
                                                                 break;
                                                             }
                                                         }
                                                     }
                                                     if(!$job_started){
                         
                                                         $alert_res = process_alert($job['date_start'], _l('Job Not Started'));
                                                         if($alert_res){
                                                             $alert_res['link'] = $this->link_open($job['job_id'],false,$job);
                                                             $alert_res['name'] = $job['name'];
                                                             $alerts[] = $alert_res;
                                                         }
                                                     }else{*/
                         // do the same alert as above.
                         if (!isset($this_alerts['jobincomplete' . $job_data['job_id']])) {
                             $alert_res = process_alert($job_data['date_start'], $key);
                             if ($alert_res) {
                                 $alert_res['link'] = $this->link_open($job_data['job_id'], false, $job_data);
                                 $alert_res['name'] = $job_data['name'];
                                 // new dashboard alert layout here:
                                 $alert_res['time'] = strtotime($alert_res['date']);
                                 $alert_res['group'] = $key;
                                 $alert_res['job'] = $this->link_open($job_data['job_id'], true, $job_data);
                                 $alert_res['customer'] = $job_data['customer_id'] ? module_customer::link_open($job_data['customer_id'], true) : _l('N/A');
                                 $alert_res['website'] = $job_data['website_id'] ? module_website::link_open($job_data['website_id'], true) : _l('N/A');
                                 $alert_res['assigned_staff'] = $job_data['user_id'] ? module_user::link_open($job_data['user_id'], true) : _l('N/A');
                                 $alert_res['progress'] = $job_data['total_percent_complete'] * 100 . '%';
                                 $alert_res['date'] = print_date($alert_res['date']);
                                 $alert_res['days'] = $alert_res['warning'] ? '<span class="important">' . $alert_res['days'] . '</span>' : $alert_res['days'];
                                 $this_alerts['jobincomplete' . $job_data['job_id']] = $alert_res;
                             }
                         }
                         /* }*/
                     }
                     module_cache::put('job', $cache_key . $key, $this_alerts, $cache_timeout);
                     $alerts = array_merge($alerts, $this_alerts);
                 }
             }
             if (module_config::c('job_allow_quotes', 0) && ($show_all || module_config::c('job_quote_alerts', 1))) {
                 // find any jobs that dont have a start date yet.
                 $key = _l('Pending Job Quote');
                 if (class_exists('module_dashboard', false)) {
                     $columns = array('job' => _l('Job Title'), 'customer' => _l('Customer'), 'website' => module_config::c('project_name_single', 'Website'), 'assigned_staff' => _l('Staff'), 'date' => _l('Quoted Date'), 'days' => _l('Day Count'));
                     if (!class_exists('module_website', false) || !module_website::is_plugin_enabled()) {
                         unset($columns['website']);
                     }
                     if (!module_customer::can_i('view', 'Customers')) {
                         unset($columns['customer']);
                     }
                     module_dashboard::register_group($key, array('columns' => $columns));
                 }
                 if ($cached_alerts = module_cache::get('job', $cache_key . $key)) {
                     $alerts = array_merge($alerts, $cached_alerts);
                 } else {
                     module_debug::log(array('title' => 'Job Home Alerts: ', 'data' => " starting: " . $key));
                     $this_alerts = array();
                     //$sql = "SELECT * FROM `"._DB_PREFIX."job` p ";
                     //$sql .= " WHERE p.date_quote != '0000-00-00' AND p.date_start = '0000-00-00'";
                     //$tasks = qa($sql);
                     $jobs = self::get_jobs(array('date_start' => '0000-00-00', 'date_quote' => '!0000-00-00'));
                     foreach ($jobs as $job_data) {
                         //$job_data = self::get_job($task['job_id']);
                         //if(!$job_data || $job_data['job_id']!=$task['job_id'])continue;
                         $alert_res = process_alert($job_data['date_quote'], $key);
                         if ($alert_res) {
                             $alert_res['link'] = $this->link_open($job_data['job_id'], false, $job_data);
                             $alert_res['name'] = $job_data['name'];
                             // new dashboard alert layout here:
                             $alert_res['time'] = strtotime($job_data['date_quote']);
                             $alert_res['group'] = $key;
                             $alert_res['job'] = $this->link_open($job_data['job_id'], true, $job_data);
                             $alert_res['customer'] = $job_data['customer_id'] ? module_customer::link_open($job_data['customer_id'], true) : _l('N/A');
                             $alert_res['website'] = $job_data['website_id'] ? module_website::link_open($job_data['website_id'], true) : _l('N/A');
                             $alert_res['assigned_staff'] = $job_data['user_id'] ? module_user::link_open($job_data['user_id'], true) : _l('N/A');
                             //$alert_res['progress'] = ($job_data['total_percent_complete'] * 100).'%';
                             $alert_res['date'] = print_date($alert_res['date']);
                             $alert_res['days'] = $alert_res['warning'] ? '<span class="important">' . $alert_res['days'] . '</span>' : $alert_res['days'];
                             $this_alerts[] = $alert_res;
                         }
                     }
                     module_cache::put('job', $cache_key . $key, $this_alerts, $cache_timeout);
                     $alerts = array_merge($alerts, $this_alerts);
                 }
             }
             if ($show_all || module_config::c('job_invoice_alerts', 1)) {
                 // find any completed jobs that don't have an invoice.
                 $key = _l('Please Generate Invoice');
                 if (class_exists('module_dashboard', false)) {
                     $columns = array('job' => _l('Job Title'), 'customer' => _l('Customer'), 'website' => module_config::c('project_name_single', 'Website'), 'assigned_staff' => _l('Staff'), 'invoicable_amount' => _l('Invoiceable Amount'), 'date' => _l('Completed Date'), 'days' => _l('Day Count'));
                     if (!class_exists('module_website', false) || !module_website::is_plugin_enabled()) {
                         unset($columns['website']);
                     }
                     if (!module_customer::can_i('view', 'Customers')) {
                         unset($columns['customer']);
                     }
                     module_dashboard::register_group($key, array('columns' => $columns));
                 }
                 if ($cached_alerts = module_cache::get('job', $cache_key . $key)) {
                     $alerts = array_merge($alerts, $cached_alerts);
                 } else {
                     module_debug::log(array('title' => 'Job Home Alerts: ', 'data' => " starting: " . $key));
                     $this_alerts = array();
                     $sql = "SELECT j.* FROM `" . _DB_PREFIX . "job` j ";
                     $from = " LEFT JOIN `" . _DB_PREFIX . "task` t USING (job_id) ";
                     $from .= " LEFT JOIN `" . _DB_PREFIX . "invoice_item` ii ON t.task_id = ii.task_id ";
                     $from .= " LEFT JOIN `" . _DB_PREFIX . "invoice` i ON ii.invoice_id = i.invoice_id  ";
                     $where = " WHERE i.invoice_id IS NULL AND (j.date_completed != '0000-00-00')";
                     switch (self::get_job_access_permissions()) {
                         case _JOB_ACCESS_ALL:
                             break;
                         case _JOB_ACCESS_ASSIGNED:
                             // only assigned jobs!
                             //$from .= " LEFT JOIN `"._DB_PREFIX."task` t ON u.job_id = t.job_id ";
                             $where .= " AND (j.user_id = " . (int) module_security::get_loggedin_id() . " OR t.user_id = " . (int) module_security::get_loggedin_id() . ")";
                             break;
                         case _JOB_ACCESS_CUSTOMER:
                             // tie in with customer permissions to only get jobs from customers we can access.
                             $customers = module_customer::get_customers();
                             if (count($customers)) {
                                 $where .= " AND j.customer_id IN ( ";
                                 foreach ($customers as $customer) {
                                     $where .= $customer['customer_id'] . ', ';
                                 }
                                 $where = rtrim($where, ', ');
                                 $where .= " ) ";
                             }
                             break;
                     }
                     // tie in with customer permissions to only get jobs from customers we can access.
                     switch (module_customer::get_customer_data_access()) {
                         case _CUSTOMER_ACCESS_ALL:
                             // all customers! so this means all jobs!
                             break;
                         case _CUSTOMER_ACCESS_ALL_COMPANY:
                         case _CUSTOMER_ACCESS_CONTACTS:
                         case _CUSTOMER_ACCESS_TASKS:
                         case _CUSTOMER_ACCESS_STAFF:
                             $valid_customer_ids = module_security::get_customer_restrictions();
                             if (count($valid_customer_ids)) {
                                 $where .= " AND ( j.customer_id = 0 OR j.customer_id IN ( ";
                                 foreach ($valid_customer_ids as $valid_customer_id) {
                                     $where .= (int) $valid_customer_id . ", ";
                                 }
                                 $where = rtrim($where, ', ');
                                 $where .= " )";
                                 $where .= " )";
                             }
                     }
                     $res = qa($sql . $from . $where . " GROUP BY j.job_id");
                     foreach ($res as $job) {
                         if (!isset($job['c_total_amount_invoicable']) || $job['c_total_amount_invoicable'] < 0) {
                             $this->update_job_completion_status($job['job_id']);
                             // seed the cache
                             $job = $this->get_job($job['job_id']);
                         }
                         //$job = $this->get_job($r['job_id']);
                         //if($job && $job['job_id'] == $r['job_id'] && $job['total_amount_invoicable'] > 0 && module_invoice::can_i('create','Invoices')){
                         if (isset($job['c_total_amount_invoicable']) && $job['c_total_amount_invoicable'] > 0 && module_invoice::can_i('create', 'Invoices')) {
                             $alert_res = process_alert($job['date_completed'], $key);
                             if ($alert_res) {
                                 $alert_res['link'] = $this->link_open($job['job_id'], false, $job);
                                 $alert_res['name'] = $job['name'];
                                 // new dashboard alert layout here:
                                 $alert_res['time'] = strtotime($job['date_completed']);
                                 $alert_res['group'] = $key;
                                 $alert_res['job'] = $this->link_open($job['job_id'], true, $job);
                                 $alert_res['customer'] = $job['customer_id'] ? module_customer::link_open($job['customer_id'], true) : _l('N/A');
                                 $alert_res['website'] = $job['website_id'] ? module_website::link_open($job['website_id'], true) : _l('N/A');
                                 $alert_res['assigned_staff'] = $job['user_id'] ? module_user::link_open($job['user_id'], true) : _l('N/A');
                                 $alert_res['invoicable_amount'] = currency($job['c_total_amount_invoicable'], true, $job['currency_id']);
                                 //$alert_res['progress'] = ($job['total_percent_complete'] * 100).'%';
                                 $alert_res['date'] = print_date($alert_res['date']);
                                 $alert_res['days'] = $alert_res['warning'] ? '<span class="important">' . $alert_res['days'] . '</span>' : $alert_res['days'];
                                 $this_alerts[] = $alert_res;
                             }
                         }
                     }
                     module_cache::put('job', $cache_key . $key, $this_alerts, $cache_timeout);
                     $alerts = array_merge($alerts, $this_alerts);
                 }
             }
             if ($show_all || module_config::c('job_renew_alerts', 1)) {
                 // find any jobs that have a renew date soon and have not been renewed.
                 $key = _l('Job Renewal Pending');
                 $key_auto = _l('Automatic Job Renewal Pending');
                 if (class_exists('module_dashboard', false)) {
                     $columns = array('job' => _l('Job Title'), 'customer' => _l('Customer'), 'website' => module_config::c('project_name_single', 'Website'), 'assigned_staff' => _l('Staff'), 'renewal_period' => _l('Period'), 'date_create' => _l('Created Date'), 'date' => _l('Renewal Date'), 'days' => _l('Day Count'));
                     if (!class_exists('module_website', false) || !module_website::is_plugin_enabled()) {
                         unset($columns['website']);
                     }
                     if (!module_customer::can_i('view', 'Customers')) {
                         unset($columns['customer']);
                     }
                     module_dashboard::register_group($key, array('columns' => $columns));
                     $columns = array('job' => _l('Job Title'), 'customer' => _l('Customer'), 'website' => module_config::c('project_name_single', 'Website'), 'assigned_staff' => _l('Staff'), 'renewal_period' => _l('Period'), 'date_create' => _l('Created Date'), 'date' => _l('Renewal Date'), 'renew_invoice' => _l('Automatic Invoice'), 'days' => _l('Day Count'));
                     if (!module_customer::can_i('view', 'Customers')) {
                         unset($columns['customer']);
                     }
                     module_dashboard::register_group($key_auto, array('columns' => $columns));
                 }
                 if ($cached_alerts = module_cache::get('job', $cache_key . $key)) {
                     $alerts = array_merge($alerts, $cached_alerts);
                 } else {
                     module_debug::log(array('title' => 'Job Home Alerts: ', 'data' => " starting: " . $key));
                     $this_alerts = array();
                     /*$sql = "SELECT p.* FROM `"._DB_PREFIX."job` p ";
                       $sql .= " WHERE p.date_renew != '0000-00-00'";
                       $sql .= " AND p.date_renew <= '".date('Y-m-d',strtotime('+'.module_config::c('alert_days_in_future',5).' days'))."'";
                       $sql .= " AND (p.renew_job_id IS NULL OR p.renew_job_id = 0)";
                       $res = qa($sql);*/
                     $res = self::get_jobs(array(), array('custom_where' => " AND  u.date_renew != '0000-00-00' AND u.date_renew <= '" . date('Y-m-d', strtotime('+' . module_config::c('alert_days_in_future', 5) . ' days')) . "' AND (u.renew_job_id IS NULL OR u.renew_job_id = 0)"));
                     foreach ($res as $job) {
                         //$job = self::get_job($r['job_id']);
                         //if(!$job || $job['job_id']!=$r['job_id'])continue;
                         if ($job['renew_auto']) {
                             $alert_res = process_alert($job['date_renew'], $key_auto);
                         } else {
                             $alert_res = process_alert($job['date_renew'], $key);
                         }
                         if ($alert_res) {
                             $alert_res['link'] = $this->link_open($job['job_id'], false, $job);
                             $alert_res['name'] = $job['name'];
                             $alert_res['renewal_period'] = _l('N/A');
                             // work out renewal period
                             if ($job['date_start'] && $job['date_start'] != '0000-00-00') {
                                 $time_diff = strtotime($job['date_renew']) - strtotime($job['date_start']);
                                 if ($time_diff > 0) {
                                     $diff_type = 'day';
                                     $days = round($time_diff / 86400);
                                     if ($days >= 365) {
                                         $time_diff = round($days / 365, 1);
                                         $diff_type = 'year';
                                     } else {
                                         $time_diff = $days;
                                     }
                                     $alert_res['renewal_period'] = $time_diff . ' ' . $diff_type;
                                 }
                             }
                             // new dashboard alert layout here:
                             $alert_res['time'] = strtotime($job['date_renew']);
                             if ($job['renew_auto']) {
                                 $alert_res['group'] = $key_auto;
                                 $alert_res['renew_invoice'] = $job['renew_invoice'] ? _l('Yes') : _l('No');
                             } else {
                                 $alert_res['group'] = $key;
                             }
                             $alert_res['job'] = $this->link_open($job['job_id'], true, $job);
                             $alert_res['customer'] = $job['customer_id'] ? module_customer::link_open($job['customer_id'], true) : _l('N/A');
                             $alert_res['website'] = $job['website_id'] ? module_website::link_open($job['website_id'], true) : _l('N/A');
                             $alert_res['assigned_staff'] = $job['user_id'] ? module_user::link_open($job['user_id'], true) : _l('N/A');
                             //$alert_res['progress'] = ($job['total_percent_complete'] * 100).'%';
                             $alert_res['date_create'] = print_date($job['date_start']);
                             $alert_res['date'] = print_date($job['date_renew']);
                             $alert_res['days'] = $alert_res['warning'] ? '<span class="important">' . $alert_res['days'] . '</span>' : $alert_res['days'];
                             $this_alerts[] = $alert_res;
                         }
                     }
                     module_cache::put('job', $cache_key . $key, $this_alerts, $cache_timeout);
                     $alerts = array_merge($alerts, $this_alerts);
                 }
             }
             if ($show_all || module_config::c('job_approval_alerts', 1)) {
                 $job_task_creation_permissions = self::get_job_task_creation_permissions();
                 if ($job_task_creation_permissions == _JOB_TASK_CREATION_WITHOUT_APPROVAL) {
                     // find any jobs that have tasks requiring approval
                     $key = _l('Tasks Require Approval');
                     if (class_exists('module_dashboard', false)) {
                         $columns = array('job' => _l('Job Title'), 'customer' => _l('Customer'), 'website' => module_config::c('project_name_single', 'Website'), 'assigned_staff' => _l('Staff'), 'task_count' => _l('Tasks to Approve'), 'date' => _l('Task Date'), 'days' => _l('Day Count'));
                         if (!class_exists('module_website', false) || !module_website::is_plugin_enabled()) {
                             unset($columns['website']);
                         }
                         if (!module_customer::can_i('view', 'Customers')) {
                             unset($columns['customer']);
                         }
                         module_dashboard::register_group($key, array('columns' => $columns));
                     }
                     if ($cached_alerts = module_cache::get('job', $cache_key . $key)) {
                         $alerts = array_merge($alerts, $cached_alerts);
                     } else {
                         module_debug::log(array('title' => 'Job Home Alerts: ', 'data' => " starting: " . $key));
                         $this_alerts = array();
                         $sql = "SELECT p.job_id,p.name, t.date_updated, t.date_created, COUNT(t.task_id) AS approval_count FROM `" . _DB_PREFIX . "job` p ";
                         $sql .= " LEFT JOIN `" . _DB_PREFIX . "task` t ON p.job_id = t.job_id";
                         $sql .= " WHERE t.approval_required = 1";
                         $sql .= " GROUP BY p.job_id ";
                         $res = qa($sql);
                         foreach ($res as $r) {
                             $job = self::get_job($r['job_id']);
                             if (!$job || $job['job_id'] != $r['job_id']) {
                                 continue;
                             }
                             $alert_res = process_alert($r['date_updated'] && $r['date_updated'] != '0000-00-00' ? $r['date_updated'] : $r['date_created'], $key);
                             if ($alert_res) {
                                 $alert_res['link'] = $this->link_open($r['job_id'], false, $r);
                                 $alert_res['name'] = $r['name'];
                                 // new dashboard alert layout here:
                                 $alert_res['time'] = strtotime($r['date_updated'] && $r['date_updated'] != '0000-00-00' ? $r['date_updated'] : $r['date_created']);
                                 $alert_res['group'] = $key;
                                 $alert_res['job'] = $this->link_open($job['job_id'], true, $job);
                                 $alert_res['customer'] = $job['customer_id'] ? module_customer::link_open($job['customer_id'], true) : _l('N/A');
                                 $alert_res['website'] = $job['website_id'] ? module_website::link_open($job['website_id'], true) : _l('N/A');
                                 $alert_res['assigned_staff'] = $job['user_id'] ? module_user::link_open($job['user_id'], true) : _l('N/A');
                                 //$alert_res['progress'] = ($job['total_percent_complete'] * 100).'%';
                                 $alert_res['task_count'] = $r['approval_count'];
                                 $alert_res['date'] = print_date($alert_res['time']);
                                 $alert_res['days'] = $alert_res['warning'] ? '<span class="important">' . $alert_res['days'] . '</span>' : $alert_res['days'];
                                 $this_alerts[] = $alert_res;
                             }
                         }
                         module_cache::put('job', $cache_key . $key, $this_alerts, $cache_timeout);
                         $alerts = array_merge($alerts, $this_alerts);
                     }
                 }
                 // find any rejected tasks
                 $key = _l('Tasks Have Been Rejected');
                 if (class_exists('module_dashboard', false)) {
                     $columns = array('job' => _l('Job Title'), 'customer' => _l('Customer'), 'website' => module_config::c('project_name_single', 'Website'), 'assigned_staff' => _l('Staff'), 'task_count' => _l('Tasks Rejected'), 'date' => _l('Task Date'), 'days' => _l('Day Count'));
                     if (!class_exists('module_website', false) || !module_website::is_plugin_enabled()) {
                         unset($columns['website']);
                     }
                     if (!module_customer::can_i('view', 'Customers')) {
                         unset($columns['customer']);
                     }
                     module_dashboard::register_group($key, array('columns' => $columns));
                 }
                 if ($cached_alerts = module_cache::get('job', $cache_key . $key)) {
                     $alerts = array_merge($alerts, $cached_alerts);
                 } else {
                     module_debug::log(array('title' => 'Job Home Alerts: ', 'data' => " starting: " . $key));
                     $this_alerts = array();
                     $sql = "SELECT p.job_id,p.name, t.date_updated, t.date_created, COUNT(t.task_id) AS approval_count FROM `" . _DB_PREFIX . "job` p ";
                     $sql .= " LEFT JOIN `" . _DB_PREFIX . "task` t ON p.job_id = t.job_id";
                     $sql .= " WHERE t.approval_required = 2";
                     $sql .= " GROUP BY p.job_id ";
                     $res = qa($sql);
                     foreach ($res as $r) {
                         $job = self::get_job($r['job_id']);
                         if (!$job || $job['job_id'] != $r['job_id']) {
                             continue;
                         }
                         $alert_res = process_alert($r['date_updated'] && $r['date_updated'] != '0000-00-00' ? $r['date_updated'] : $r['date_created'], $key);
                         if ($alert_res) {
                             $alert_res['link'] = $this->link_open($r['job_id'], false, $r);
                             $alert_res['name'] = $r['name'];
                             // new dashboard alert layout here:
                             $alert_res['time'] = strtotime($r['date_updated'] && $r['date_updated'] != '0000-00-00' ? $r['date_updated'] : $r['date_created']);
                             $alert_res['group'] = $key;
                             $alert_res['job'] = $this->link_open($job['job_id'], true, $job);
                             $alert_res['customer'] = $job['customer_id'] ? module_customer::link_open($job['customer_id'], true) : _l('N/A');
                             $alert_res['website'] = $job['website_id'] ? module_website::link_open($job['website_id'], true) : _l('N/A');
                             $alert_res['assigned_staff'] = $job['user_id'] ? module_user::link_open($job['user_id'], true) : _l('N/A');
                             //$alert_res['progress'] = ($job['total_percent_complete'] * 100).'%';
                             $alert_res['task_count'] = $r['approval_count'];
                             $alert_res['date'] = print_date($alert_res['time']);
                             $alert_res['days'] = $alert_res['warning'] ? '<span class="important">' . $alert_res['days'] . '</span>' : $alert_res['days'];
                             $this_alerts[] = $alert_res;
                         }
                     }
                     module_cache::put('job', $cache_key . $key, $this_alerts, $cache_timeout);
                     $alerts = array_merge($alerts, $this_alerts);
                 }
             }
             if (module_security::can_user(module_security::get_loggedin_id(), 'Show Dashboard Todo List')) {
                 $key = _l('Job Todo');
                 if (class_exists('module_dashboard', false)) {
                     $columns = array('job' => _l('Job Title'), 'customer' => _l('Customer Name'), 'progress' => _l('Task Progress'), 'task' => _l('Task Description'), 'assigned_staff' => _l('Staff'), 'date' => _l('Due Date'), 'days' => _l('Day Count'));
                     if (!module_customer::can_i('view', 'Customers')) {
                         unset($columns['customer']);
                     }
                     module_dashboard::register_group($key, array('columns' => $columns));
                 }
                 if ($cached_alerts = module_cache::get('job', $cache_key . $key)) {
                     $alerts = array_merge($alerts, $cached_alerts);
                 } else {
                     module_debug::log(array('title' => 'Job Home Alerts: ', 'data' => " starting: " . $key));
                     $this_alerts = array();
                     $todo_list = self::get_tasks_todo();
                     $x = 0;
                     foreach ($todo_list as $todo_item) {
                         if ($todo_item['hours_completed'] > 0) {
                             if ($todo_item['hours'] > 0) {
                                 $percentage = round($todo_item['hours_completed'] / $todo_item['hours'], 2);
                                 $percentage = min(1, $percentage);
                             } else {
                                 $percentage = 1;
                             }
                         } else {
                             $percentage = 0;
                         }
                         $job_data = module_job::get_job($todo_item['job_id'], false);
                         $alert_res = process_alert($todo_item['date_due'], 'temp');
                         if ($alert_res) {
                             $alert_res['link'] = $this->link_open($todo_item['job_id'], false, $job_data);
                             $alert_res['name'] = $percentage * 100 . '% ' . $todo_item['description'];
                             $alert_res['item'] = $job_data['name'];
                             // new dashboard alert layout here:
                             $alert_res['time'] = strtotime($alert_res['date']);
                             $alert_res['group'] = $key;
                             $alert_res['job'] = $this->link_open($todo_item['job_id'], true, $job_data);
                             $alert_res['customer'] = $job_data['customer_id'] ? module_customer::link_open($job_data['customer_id'], true) : _l('N/A');
                             $alert_res['assigned_staff'] = $todo_item['user_id'] ? module_user::link_open($todo_item['user_id'], true) : _l('N/A');
                             $alert_res['progress'] = $percentage * 100 . '%';
                             $alert_res['task'] = htmlspecialchars($todo_item['description']);
                             $alert_res['date'] = $alert_res['warning'] ? '<span class="important">' . print_date($alert_res['date']) . '</span>' : print_date($alert_res['date']);
                             $alert_res['days'] = $alert_res['warning'] ? '<span class="important">' . $alert_res['days'] . '</span>' : $alert_res['days'];
                             $this_alerts[] = $alert_res;
                         }
                     }
                     module_cache::put('job', $cache_key . $key, $this_alerts, $cache_timeout);
                     $alerts = array_merge($alerts, $this_alerts);
                 }
             }
             return $alerts;
             break;
     }
     return false;
 }
コード例 #29
0
ファイル: product_list.php プロジェクト: josephcb24/Tutu
							<span>
								<?php 
        echo currency() . $this->crud_model->get_product_price($row2['product_id']);
        ?>
							</span>
							<span style=" text-decoration: line-through;color:#c9253c;">
								<?php 
        echo currency() . $row2['sale_price'];
        ?>
							</span>
						<?php 
    } else {
        ?>
							<span>
								<?php 
        echo currency() . $row2['sale_price'];
        ?>
							</span>
						<?php 
    }
    ?>
						</p>
						
					</dd>
				</dl>
				<?php 
}
?>
			</div><!--/posts-->
			<!-- End Posts -->
							   
コード例 #30
0
                                <td><b><?php 
        echo translate('shipping');
        ?>
</b></td>
                                <td><?php 
        echo currency() . $this->cart->format_number($shipping);
        ?>
</td>
                            </tr>
                            <tr>
                                <td><b><?php 
        echo translate('grand_total');
        ?>
</b></td>
                                <td><?php 
        echo currency() . $this->cart->format_number($total + $vat + $shipping);
        ?>
</td>
                            </tr>
                        </tbody>
                    </table>
                </div> 
            </div>  
        </div>
	</div>
</div>

<div class="row">
	<div class="col-md-12">
        <div class="col-lg-6 col-md-6 col-sm-6">
        </div>