File size: 2,936 Bytes
971eb1e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
<?php
/* 

 * Author		= Dian Hermanto

 * Create Date	= 7 Februari 2017

 * File Name	= C_globalsetting.php

 * Location		= -

*/

class C_globalsetting  extends CI_Controller

{
	var $limit = 2;
	var $title = 'NKE ITSys';
	
 	// Start : Index tiap halaman
 	public function index()

	{		
		$sqlApp 		= "SELECT * FROM tappname";
		$resultaApp = $this->db->query($sqlApp)->result();
		foreach($resultaApp as $therow) :
			$appName = $therow->app_name;		
		endforeach;
		
		$url			= site_url('c_setting/c_globalsetting/index1/?id='.$this->url_encryption_helper->encode_url($appName));
		redirect($url);
	}
	
	public function index1($offset=0)

	{
		$this->load->model('m_setting/m_globalsetting/m_globalsetting', '', TRUE);
		
		if ($this->session->userdata('login') == TRUE)
		{
			$idAppName				= $_GET['id'];
			$appName				= $this->url_encryption_helper->decode_url($idAppName);
			
			$data['title'] 			= $appName;
			$data['Emp_DeptCode'] 	= $this->session->userdata('Emp_DeptCode');
			$data['h2_title']		= 'Global Setting';
			$data['form_action']	= site_url('c_setting/c_globalsetting/update_process');
			$data['link'] 			= array('link_back' => anchor('c_setting/c_globalsetting/','<input type="button" name="btnCancel" id="btnCancel" class="button_css" value="Cancel" />', array('style' => 'text-decoration: none;')));
			$data["MenuCode"] 		= 'MN075';
			
			$data['viewglobalsetting'] 	= $this->m_globalsetting->viewglobalsetting();
			$data['viewCurrency'] 		= $this->m_globalsetting->viewCurrency();
			
			$this->load->view('v_setting/v_globalsetting/globalsetting_form', $data);
		}
		else
		{
			redirect('login');
		}
	}
	// End
	
	function update_process()

	{
		$this->load->model('m_setting/m_globalsetting/m_globalsetting', '', TRUE);
		
		$globalsetting = array('Display_Rows' 	=> $this->input->post('Display_Rows'), 
						'decFormat'			=> $this->input->post('decFormat'),
						'currency_ID'		=> $this->input->post('currency_ID'),
						'purchasePrice'		=> $this->input->post('purchasePrice'),
						'salesPrice'		=> $this->input->post('salesPrice'),
						'RateType_SO'		=> $this->input->post('RateType_SO'),
						'RateType_PO'		=> $this->input->post('RateType_PO'),
						'RateType_SN'		=> $this->input->post('RateType_SN'),
						'RateType_RR'		=> $this->input->post('RateType_RR'),
						'RateType_SI'		=> $this->input->post('RateType_SI'),
						'RateType_VI'		=> $this->input->post('RateType_VI'),
						'RateType_GL'		=> $this->input->post('RateType_GL'),
						'recountType'		=> $this->input->post('recountType'),
						'isUpdOutApp'		=> $this->input->post('isUpdOutApp'),
						'isUpdProfLoss'		=> $this->input->post('isUpdProfLoss')); 
						
		$this->m_globalsetting->update($globalsetting);
		
		$url			= site_url('c_setting/c_globalsetting/index1/?id='.$this->url_encryption_helper->encode_url($appName));
		redirect($url);
	}
}