<?php

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

class Costing extends MY_Controller {

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

    public function index() {
        $this->load->view('settings/header');
        $this->load->view('sales/costing_view', null);
        $this->load->view('settings/footer');
    }

    //  COLUNM NAMES
    function getcolumns() {

        $params = $this->uri->segment(3);
        if ($params == 1 || $params == 0) {
            $data = '{"cnames": ["","",""], "url": "costing/getcosting",
                "colModel": [           
{"name":"NAME","index":"NAME", "width":"100"},
{"name":"AMOUNT","index":"AMOUNT", "width":"100","align":"right"},
{"name":"PERCENTAGE","index":"PERCENTAGE","width":"100","align":"right"}
]}';
        } else {
            $data = '{"cnames": ["","",""], "url": "costing/getcosting"}';
        }
        echo $data;
    }

    // GET FOOD COSTING
    function getcosting() {
        $this->load->model('sales/costing_model');
        $datefrom = $this->input->post('datefrom');
        $dateto = $this->input->post('dateto');
        echo $this->costing_model->getcosting($datefrom, $dateto);
    }
    
    

}