public function decanding() { $sorting_info = Sort::columns('shortages'); $this->db->select("*"); $this->helper_model->search("Shortages_Search_Form", "shortages"); $this->helper_model->sort($sorting_info); return $this->db->get('decanding_shortages_view')->result(); }
public function search_limited_tankers($limit, $start, $where = "") { $sorting_info = Sort::columns('tankers'); $this->db->select('*'); $this->db->from('tankers_status_view'); $this->helper_model->search("Tankers_Search_Form", "tankers"); if ($where != "") { $this->db->where($where); } $this->helper_model->sort($sorting_info); $this->db->limit($limit, $start); $result = $this->db->get()->result(); return $result; }
<html> <head> <title>Accounts</title> <link href="<?php echo css(); ?> bootstrap.min.css" rel="stylesheet"> </head> <body> <style> table{ font-size: <?php echo $font_size; ?> ; } table td, th{ padding: 5px; } .multiple_entites{ border-bottom: 1px dashed lightgray; } </style> <div id="page-wrapper" style="min-height: 700px;"> <div class="container-fluid"> <div class="row"> <div class="col-lg-12"> <section class="col-md-12" style="text-align: center;"> <h3 class=""> Trips Details </h3>
public function search_trips($keys, $limit, $start, $sort) { //applying keys.... include_once APPPATH . "serviceProviders/Sort.php"; $sorting_info = Sort::columns($keys['module']); if ($keys['trip_status'] != '') { if ($keys['trip_status'] == 2) { $this->db->where('stn_number !=', ''); } if ($keys['trip_status'] == 1) { $this->db->where('stn_number', ''); } } if ($keys['from'] != '') { $this->db->where('entryDate >=', $keys['from']); } if ($keys['to'] != '') { $this->db->where('entryDate <=', $keys['to']); } if ($keys['trip_id'] != '') { $this->db->where('trip_id', $keys['trip_id']); } if ($keys['entryDate'] != '') { $this->db->where('entryDate', $keys['entryDate']); } if ($keys['product'] != '') { $this->db->where_in('product_id', $keys['product']); } if ($keys['trips_routes'] != '') { $where = "("; foreach ($keys['trips_routes'] as $route) { $route_parts = explode('_', $route); $where .= "(source_id = " . $route_parts[0] . " AND destination_id = " . $route_parts[1] . ") OR "; } $where .= ")"; $where_parts = explode(') OR )', $where); $where = $where_parts[0]; $where .= "))"; $this->db->where($where); } else { if ($keys['source'] != '') { $this->db->where_in('source_id', $keys['source']); } if ($keys['destination'] != '') { $this->db->where_in('destination_id', $keys['destination']); } } if ($keys['company'] != '') { $this->db->where_in('company_id', $keys['company']); } if ($keys['contractor'] != '') { $this->db->where_in('contractor_id', $keys['contractor']); } if ($keys['customer'] != '') { $this->db->where_in('customer_id', $keys['customer']); } if ($keys['tanker'] != '') { $this->db->where_in('tanker_id', $keys['tanker']); } if ($keys['stn_number'] != '') { $this->db->like('stn_number', $keys['stn_number']); } if ($keys['trip_type'] != '') { $this->db->where_in('trip_type_id', $keys['trip_type']); } if ($keys['trip_master_type'] != '') { if ($keys['trip_master_type'] == 'primary') { $where = "(trip_type_id = 2 OR trip_type_id = 4 OR trip_type_id = 1 OR trip_type_id = 5)"; $this->db->where($where); } else { if ($keys['trip_master_type'] == 'secondary') { $where = "(trip_type_id = 3)"; $this->db->where($where); } else { if ($keys['trip_master_type'] == 'secondary_local') { $where = "(trip_type_id = 6)"; $this->db->where($where); } } } } if ($keys['trip_master_types'] != '') { $trip_types = array(); foreach ($keys['trip_master_types'] as $type) { switch ($type) { case "primary": $trip_types = [1, 2, 4, 5]; break; case "secondary": array_push($trip_types, 3); break; case "secondary_local": array_push($trip_types, 6); break; } } $this->db->where_in('trip_type_id', $trip_types); } /////////////////////////////////////////////////////// $this->db->select('*'); $this->db->limit($limit, $start); foreach ($sorting_info as $sort) { $this->db->order_by($sort['sort_by'], $sort['order_by']); } $trips = $this->db->get('trips_view')->result(); return $trips; }
<thead style="border-top: 3px solid lightgray;"> <tr> <?php echo Sort::createPrintableHeaders("manage_accounts_black_oil", $columns); ?> </tr> </thead> <tbody> <?php $selected_columns = $columns; $columns = Sort::columns('manage_accounts_black_oil'); //Showing Customers Data foreach ($accounts as $record) { echo "<tr>"; $markup = ""; $markup .= printable_column('trip_id', $selected_columns, $record->trip_id); $markup .= printable_column('trip_sub_type', $selected_columns, $record->trip_sub_type); $markup .= printable_column('trip_date', $selected_columns, $record->trip_date); $markup .= printable_column('source', $selected_columns, $record->source); $markup .= printable_column('destination', $selected_columns, $record->destination); $markup .= printable_column('invoice_date', $selected_columns, $record->invoice_date); $markup .= printable_column('invoice_number', $selected_columns, $record->invoice_number); $markup .= printable_column('stn_number', $selected_columns, $record->stn_number); $markup .= printable_column('tanker_number', $selected_columns, $record->tanker_number); $markup .= printable_column('product', $selected_columns, $record->product); $markup .= printable_column('dis_qty', $selected_columns, $record->dis_qty / $unit);
public function search_black_oil($keys, $limit, $start) { //applying keys.... include_once APPPATH . "serviceProviders/Sort.php"; $sorting_info = Sort::columns('manage_accounts_black_oil'); /* * ------------------------------- * Search By Account Titles * ------------------------------- */ if ($keys['account_title'] != '') { $trip_detail_ids = []; if ($keys['dr_cr'] != '') { switch ($keys['dr_cr']) { case 1: $this->db->select('ma.trip_detail_id'); $this->db->join('dr_cr_status_for_manage_accounts_view as dr_cr_status', 'dr_cr_status.trip_detail_id = ma.trip_detail_id', 'left'); $this->db->where('account_title_id', $keys['account_title']); $this->db->where('dr_cr_status.dr_cr', 1); $result = $this->db->get('manage_accounts_white_oil_view as ma')->result(); $trip_detail_ids = property_to_array('trip_detail_id', $result); break; case 2: $debit_ids[] = 0; $this->db->select('dr_cr_status_for_manage_accounts_view.trip_detail_id'); $this->db->where('account_title_id', $keys['account_title']); $this->db->where('dr_cr_status_for_manage_accounts_view.dr_cr', '1'); $result = $this->db->get('dr_cr_status_for_manage_accounts_view')->result(); $debit_ids = property_to_array('trip_detail_id', $result); $this->db->select('dr_cr_status_for_manage_accounts_view.trip_detail_id'); $this->db->where_not_in('dr_cr_status_for_manage_accounts_view.trip_detail_id', $debit_ids); $result = $this->db->get('dr_cr_status_for_manage_accounts_view')->result(); $trip_detail_ids = property_to_array('trip_detail_id', $result); break; case 0: $this->db->select('ma.trip_detail_id'); $this->db->join('dr_cr_status_for_manage_accounts_view as dr_cr_status', 'dr_cr_status.trip_detail_id = ma.trip_detail_id', 'left'); $this->db->where('account_title_id', $keys['account_title']); $this->db->where('dr_cr_status.dr_cr', 0); $result = $this->db->get('manage_accounts_white_oil_view as ma')->result(); $trip_detail_ids = property_to_array('trip_detail_id', $result); break; case 3: $credit_ids[] = 0; $this->db->select('dr_cr_status_for_manage_accounts_view.trip_detail_id'); $this->db->where('account_title_id', $keys['account_title']); $this->db->where('dr_cr_status_for_manage_accounts_view.dr_cr', '0'); $result = $this->db->get('dr_cr_status_for_manage_accounts_view')->result(); $credit_ids = property_to_array('trip_detail_id', $result); $this->db->select('dr_cr_status_for_manage_accounts_view.trip_detail_id'); $this->db->where_not_in('dr_cr_status_for_manage_accounts_view.trip_detail_id', $credit_ids); $result = $this->db->get('dr_cr_status_for_manage_accounts_view')->result(); $trip_detail_ids = property_to_array('trip_detail_id', $result); break; } } if (sizeof($trip_detail_ids) == 0) { $trip_detail_ids[] = 0; } } /*-------------------------------*/ $this->db->select('*'); /* * ------------------------------ * SEARCH BY TRIPS BILLING * ------------------------------ * */ if ($keys['bill_status'] != '') { if ($keys['bill_status'] == 1) { $this->db->where('bill_id !=', 0); if ($keys['billed_from'] != '') { $this->db->where('billed_date_time >', $keys['billed_from']); } if ($keys['billed_to'] != '') { $this->db->where('billed_date_time <', $keys['billed_to']); } } if ($keys['bill_status'] == 0) { $this->db->where('bill_id', 0); } } /*--------------------------------------------*/ /* * ------------------------------ * OPEN AND CLOSED TRIPS * ----------------------------- * */ if ($keys['trip_status'] != '') { if ($keys['trip_status'] == 1) { $this->db->where('stn_number', ''); } else { if ($keys['trip_status'] == 2) { $this->db->where('stn_number !=', ''); } } } /*----------------------------------------*/ if ($keys['account_title'] != '') { if (sizeof($trip_detail_ids) > 0) { $this->db->where_in('trip_detail_id', $trip_detail_ids); } } if ($keys['from'] != '') { $this->db->where('trip_date >=', $keys['from']); } if ($keys['to'] != '') { $this->db->where('trip_date <=', $keys['to']); } if ($keys['trip_id'] != '') { $this->db->where('trip_id', $keys['trip_id']); } if ($keys['trip_type'] != '') { $this->db->where_in('trip_type_id', $keys['trip_type']); } if ($keys['trip_master_type'] != '') { if ($keys['trip_master_type'] == 'primary') { $where = "(trip_type_id = 2 OR trip_type_id = 4)"; $this->db->where($where); } else { if ($keys['trip_master_type'] == 'secondary') { $where = "(trip_type_id = 1 OR trip_type_id = 3)"; $this->db->where($where); } else { if ($keys['trip_master_type'] == 'secondary_local') { $where = "(trip_type_id = 6)"; $this->db->where($where); } } } } if ($keys['trip_master_types'] != '') { $trip_types = array(); foreach ($keys['trip_master_types'] as $type) { switch ($type) { case "primary": $trip_types = [1, 2, 4, 5]; break; case "secondary": array_push($trip_types, 3); break; case "secondary_local": array_push($trip_types, 6); break; } } $this->db->where_in('trip_type_id', $trip_types); } if ($keys['tanker'] != '') { $this->db->where_in('tanker_id', $keys['tanker']); } if ($keys['entryDate'] != '') { $this->db->where('trip_date', $keys['entryDate']); } if ($keys['product'] != '') { $this->db->where_in('product_id', $keys['product']); } if ($keys['trips_routes'] != '') { $where = "("; foreach ($keys['trips_routes'] as $route) { $route_parts = explode('_', $route); $where .= "(source_id = " . $route_parts[0] . " AND destination_id = " . $route_parts[1] . ") OR "; } $where .= ")"; $where_parts = explode(') OR )', $where); $where = $where_parts[0]; $where .= "))"; $this->db->where($where); } else { if ($keys['source'] != '') { $this->db->where_in('source_id', $keys['source']); } if ($keys['destination'] != '') { $this->db->where_in('destination_id', $keys['destination']); } } if ($keys['company'] != '') { $this->db->where_in('company_id', $keys['company']); } if ($keys['cmp_freight_unit'] != '') { $this->db->where('company_freight_unit', $keys['cmp_freight_unit']); } if ($keys['cst_freight_unit'] != '') { $this->db->where('customer_freight_unit', $keys['cst_freight_unit']); } if ($keys['wht'] != '') { $this->db->where('wht', $keys['wht']); } if ($keys['company_commission'] != '') { $this->db->where('company_commission', $keys['company_commission']); } if ($keys['contractor'] != '') { $this->db->where_in('contractor_id', $keys['contractor']); } if ($keys['contractor_commission'] != '') { $this->db->where('contractor_commission', $keys['contractor_commission']); } if ($keys['customer'] != '') { $this->db->where_in('customer_id', $keys['customer']); } if ($keys['cst_freight_unit'] != '') { $this->db->where('customer_freight_unit', $keys['cst_freight_unit']); } /* * -------------------------------------- * filter by trip details ids * -------------------------------------- * */ if (isset($keys['trip_detail_ids']) && $keys['trip_detail_ids'] != '') { $this->db->where_in('trip_detail_id', $keys['trip_detail_ids']); } foreach ($sorting_info as $sort) { $this->db->order_by($sort['sort_by'], $sort['order_by']); } $this->db->limit($limit, $start); $accounts = $this->db->get('manage_accounts_black_oil_view')->result(); return $accounts; }