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

class Cheque_Process extends CI_Controller {

    var $main_menu_name = "cheque_process";
	var $sub_menu_name = "cheque_process";

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

		
		$this->load->model('Cheque_Process_Model');
		$this->load->model('Bank_Model');
		$this->load->model('Common_Model');
		$this->load->model('Sequerty_Model');
	}
	
	public function index()
	{
		$data['main_menu_name'] = $this->main_menu_name;
		$data['sub_menu_name'] = $this->sub_menu_name;				
		$data['bank_list'] = $this->Bank_Model->get_all_bank();
		
		$this->load->view('suppier_payment/cheque_print',$data);
		
	//	echo "test";
		
	}
	
	public function cheque_printing()
	{
		$payee_only=$this->input->get('payee_only');
		$amount=$this->input->get('amount');
		$payee=$this->input->get('payee');
		$chque_date=$this->input->get('chque_date');
		$chque_date=date('dmY', strtotime($chque_date));
		if($payee_only==1){		
		}
		else
		{			
		$payee_only=0;	
		}
		
		
		if($amount&&$payee&&$chque_date){		
		$number_as_string=number_format($amount, 2, '.', '');
		$number_with_mark=number_format($amount, 2, '.', ',');
		
		$data['chque_date']=$chque_date;
		$data['payee']=$payee;
		$data['amount']=$number_with_mark;
		$data['payee_only']=$payee_only;		
		$data['cheque_amount_in_words']=$this->Cheque_Process_Model->convertNumber($number_as_string);
		}
		else
		{
			$data='';
		}
		
		$this->load->view('models/print_cheque',$data);
	}

	
	

}