Ejemplo n.º 1
0
 public function search()
 {
     $this->Sale->create_temp_table();
     $search = $this->input->get('search');
     $limit = $this->input->get('limit');
     $offset = $this->input->get('offset');
     $sort = $this->input->get('sort');
     $order = $this->input->get('order');
     $is_valid_receipt = !empty($search) ? $this->sale_lib->is_valid_receipt($search) : FALSE;
     $filters = array('sale_type' => 'all', 'location_id' => 'all', 'start_date' => $this->input->get('start_date'), 'end_date' => $this->input->get('end_date'), 'only_cash' => FALSE, 'only_invoices' => $this->config->item('invoice_enable') && $this->input->get('only_invoices'), 'is_valid_receipt' => $is_valid_receipt);
     // check if any filter is set in the multiselect dropdown
     $filledup = array_fill_keys($this->input->get('filters'), TRUE);
     $filters = array_merge($filters, $filledup);
     $sales = $this->Sale->search($search, $filters, $limit, $offset, $sort, $order);
     $total_rows = $this->Sale->get_found_rows($search, $filters);
     $payments = $this->Sale->get_payments_summary($search, $filters);
     $payment_summary = $this->xss_clean(get_sales_manage_payments_summary($payments, $sales, $this));
     $data_rows = array();
     foreach ($sales->result() as $sale) {
         $data_rows[] = $this->xss_clean(get_sale_data_row($sale, $this));
     }
     if ($total_rows > 0) {
         $data_rows[] = $this->xss_clean(get_sale_data_last_row($sales, $this));
     }
     echo json_encode(array('total' => $total_rows, 'rows' => $data_rows, 'payment_summary' => $payment_summary));
 }
Ejemplo n.º 2
0
 function get_row()
 {
     $sale_id = $this->input->post('row_id');
     $sale_info = $this->Sale->get_info($sale_id)->result_array();
     $data_row = get_sale_data_row($sale_info[0], $this);
     echo $data_row;
 }
Ejemplo n.º 3
0
function get_sales_manage_table_data_rows($sales, $controller)
{
    $CI =& get_instance();
    $table_data_rows = '';
    foreach ($sales->result_array() as $sale) {
        $table_data_rows .= get_sale_data_row($sale, $controller);
    }
    if ($sales->num_rows() == 0) {
        $table_data_rows .= "<tr><td colspan='8'><div class='warning_message' style='padding:7px;'>" . $CI->lang->line('sales_no_sales_to_display') . "</div></tr></tr>";
    }
    return $table_data_rows;
}