
<?php

if (!defined('BASEPATH'))
    exit('No direct script access allowed');

class Saleslogtax extends MY_Controller {

    function __construct() {
        parent::__construct();
    }

    public function index() {
         $data['categories'] = $this->_getProdCategories();
        $this->load->view('settings/header');
        $this->load->view('sales/saleslogtax_view', $data);
        $this->load->view('settings/footer');
    }

    //  COLUNM NAMES


    // GET FOOD COSTING
    function getsalelogtax() {
         $this->load->model('sales/saleslogtax_model');
         $productgroup = $this->input->post('productgroup');
         $category = $this->input->post('category');
         $products = $this->input->post('products');
         $datefrom = $this->input->post('datefrom');
         $dateto = $this->input->post('dateto');
          $paymenttype = $this->input->post('paymenttype');

       $this->load->model('sales/saleslogtax_model');
echo  $this->saleslogtax_model->getsalelogtax($datefrom, $dateto);
//var_dump($b);
//$b= $this->salereport_model->getproductsale( $warehouse, $category, $products ,$datefrom, $dateto);
//var_dump($b);
    }

 private function _getProdCategories($id = NULL) {
        $this->load->model('inventory/categories_model');
        $catarr = $this->categories_model->getproductcategories();

        $data = '<option value="">Select</option>';

        for ($i = 0; $i < count($catarr); $i++) {
            if ($id != NULL && $id == $catarr[$i]->ID)
                $data .= "<option id=\"option_custom\" selected=\"yes\" value=\"" . $catarr[$i]->ID . "\">" . $catarr[$i]->NAME . "</option>\n";
            else
                $data .= "<option id=\"option_custom\" value=\"" . $catarr[$i]->ID . "\">" . $catarr[$i]->NAME . "</option>\n";
        }
        return $data;
    }
    function exportcsv()
{


        $file="taxsummary.csv";
            header("Content-Disposition: attachment; filename=" . urlencode($file));
            header("Content-Type: application/force-download");
            header("Content-Type: application/octet-stream");
            header("Content-Type: application/download");
            header("Content-Description: File Transfer");
            header("Content-type: application/csv");
            header("Pragma: no-cache");
            header("Expires: 0");

            $export= $this->input->post('exportdata');


$this->load->helper('download');
force_download($file, $export);
}

}
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */


