<?php

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

class Nonmovingitems extends MY_Controller {

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

    function index() {     
        $this->load->model('settings/appsettings_model');
        $data['dslimit'] = $this->appsettings_model->getappsettings('deadstocklimit');
        $this->load->view('settings/header');
        $this->load->view('inventory/nonmovingitems_view', $data);
        $this->load->view('settings/footer');
    }
     
    // GET NONMOVING ITEMS     HUSSAIN 02/03/2012
    public function getnonmovingitems() {
        $this->load->model('settings/appsettings_model');
        $datefrom = $this->input->post('datefrom');
        $dateto = date('Y-m-d');
        $this->load->model('inventory/nonmovingitems_model');
        echo  $this->nonmovingitems_model->getnonmovingitems($datefrom);

    }
    function exportcsv()
    {
        $file="nonmovingitems.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);
    }
}