示例#1
0
 /**
  * This method load the index page of orders where a the user can see all current orders
  *
  * @return html content
  */
 public function index()
 {
     //$this->load->model('user_model');
     $this->load->model('order_model');
     $this->load->helper('my_helper');
     /* datatables plugin */
     $this->layout_lib->add_additional_css('/assets/plugins/datatables/css/jquery.datatables.min.css');
     $this->layout_lib->add_additional_css('/assets/plugins/datatables/css/jquery.datatables_themeroller.css');
     $this->layout_lib->add_additional_js('/assets/plugins/datatables/js/jquery.datatables.min.js');
     $this->layout_lib->add_additional_js('/assets/js/views/orders.js');
     $orders = $this->order_model->get_records(['start_date IS NOT' => NULL, 'end_date' => NULL]);
     usort($orders, function ($a, $b) {
         return $a->record_id > $b->record_id;
     });
     $datetime_now = new DateTime('NOW', new DateTimeZone('UTC'));
     foreach ($orders as $key => $order) {
         $order->store_table_info();
         $order->user_info();
         $order->order_products();
         $order->calculate_total_cost();
         /* Calculate elapsed time from order start date */
         $order_start_date = new DateTime($order->start_date, new DateTimeZone('UTC'));
         $diff = $order_start_date->diff($datetime_now);
         $elapsed_days = $diff->format('%a');
         $elapsed_hours = $elapsed_days * 24 + $diff->format('%H');
         $order->elapsed_time = time_to_seconds($diff->format($elapsed_hours . ':%I:%S'));
     }
     $this->view_data['page_title'] = 'Παραγγελίες';
     $this->view_data['orders'] = $orders;
     $this->layout_lib->load('store_layout_view', 'store/orders/orders_view', $this->view_data);
 }
 function total_seconds()
 {
     $total_time = 0;
     // in seconds
     foreach ($this->problems as $problem) {
         if ($problem->time != "-") {
             $total_time = $total_time + time_to_seconds($problem->time);
         }
     }
     return $total_time;
 }
示例#3
0
    if ($report_data[$i]->status == 1) {
        $income = $report_data[$i]->charges;
    } elseif ($report_data[$i]->status == 0) {
        $income = $total_charges;
    }
    /*****************************************/
    ?>
                                 
<?php 
    /*******total hours*********/
    if (!empty($report_data[$i]->hours)) {
        $new_total_hours = $report_data[$i]->hours;
    } else {
        $new_total_hours = $new_hours;
    }
    $to_seconds = time_to_seconds($new_total_hours);
    ?>
                                   <td><?php 
    echo $new_total_hours;
    ?>
</td>
<?php 
    /************************/
    ?>
                                   <td><?php 
    if ($report_data[$i]->status == 0) {
        echo "<strong style='color:#0820F9';>" . $income;
    } else {
        echo $income;
    }
    ?>
示例#4
0
 /**
  * This method fetches all order of a specific user
  *
  * @return html content
  */
 public function ajax_load_unpaid_orders()
 {
     if ($this->input->is_ajax_request() and $this->input->method() == 'post') {
         $this->load->model('order_model');
         $this->load->helper('my_helper');
         $user = $this->view_data['logged_in_user'];
         $orders = $this->order_model->get_records(['end_date IS NOT' => NULL, 'payment_status' => 'pending', 'user_record_id' => $user->record_id]);
         usort($orders, function ($a, $b) {
             return $a->record_id > $b->record_id;
         });
         $datetime_now = new DateTime('NOW', new DateTimeZone('UTC'));
         foreach ($orders as $key => $order) {
             $order->calculate_total_cost();
             if ($order->total_price) {
                 $order->store_table_info();
                 $order->user_info = $user;
                 $order->order_products();
                 /* Calculate elapsed time from order start date */
                 $order_start_date = new DateTime($order->start_date, new DateTimeZone('UTC'));
                 $diff = $order_start_date->diff($datetime_now);
                 $elapsed_days = $diff->format('%a');
                 $elapsed_hours = $elapsed_days * 24 + $diff->format('%H');
                 $order->elapsed_time = time_to_seconds($diff->format($elapsed_hours . ':%I:%S'));
             } else {
                 $order->payment_status = 'deleted';
                 unset($order->total_price, $order->order_products);
                 $order->save();
                 unset($orders[$key]);
             }
         }
         $this->view_data['orders'] = $orders;
         $this->layout_lib->load('waiter/order_chip_view', NULL, $this->view_data);
     }
 }
function Minus_times( $firsttime, $secondtime )
{
$temp	=	time_to_seconds( $firsttime ) - time_to_seconds( $secondtime );

$Total	= seconds_to_time( $temp );

return $Total;
}