<?php 

class Laporan extends CI_Controller{

	function __construct(){
		parent::__construct();
	 	$this->load->model('m_kontak');/* sesuaikan dengan nama file pada model */
		$this->load->model('m_login'); 
		$this->load->model('m_admin'); 
		$this->load->model('m_kasir');
		$this->load->model('m_bukukas');
		$this->load->model('m_metode');
		$this->load->model('m_member');
		$this->load->model('m_barang');
		$this->load->model('m_kantor');
		$this->load->model('m_stokopname');
		$this->load->model('m_transaksi');
		$this->load->model('m_supliyer'); 
		$this->load->library('session');
		$this->load->library('upload');
		$this->load->model('m_katagori'); 
		 
		$this->load->helper(array('form', 'url','tanggal'));
		if($this->session->userdata('status') != "loginbro"  and empty($this->session->userdata('email')) ){
			$this->session->set_flashdata('msg','<div class="alert alert-danger alert-dismissible">
						<a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</a>
						<strong> Admin Bukan Admin </strong>Ulangi Kembali
						</div> ');

			redirect(base_url("")); 
			
		}
	 
	 
	}

	function cetak_barang(){		
		 

		 
		$data['title1'] = 'Data Laporan Data Barang'; 	
 
		$data['kontak'] = $this->m_kontak->kontak();
		$data['kantor'] = $this->m_kantor->kantor();
		$data['barang'] = $this->m_barang->barang_nama_cetak(); 
		$data['kantor2'] = $this->m_kantor->kantor();
		$data['admin'] = $this->m_admin->data_admin(); 
	 	$data['admin_login'] = $this->m_admin->data_admin_login(); 
		 
		 
		$this->load->view('master/laporan/cetak_barang',$data);
		 
		 
		  
	} 
	function cetak_barang_baru(){		
		 

		 
		$data['title1'] = 'Data Laporan Data Barang'; 	
 
		$data['kontak'] = $this->m_kontak->kontak();
		$data['kantor'] = $this->m_kantor->kantor();
		$data['barang'] = $this->m_barang->barang_nama_cetak_baru(); 
		$data['kantor2'] = $this->m_kantor->kantor();
		$data['admin'] = $this->m_admin->data_admin(); 
	 	$data['admin_login'] = $this->m_admin->data_admin_login(); 
		 
		 
		$this->load->view('master/laporan/cetak_barang_baru',$data);
		 
		 
		  
	} 
	function cetak_barang_kulaan(){		
		 

		 
		$data['title1'] = 'Data Laporan Data Barang'; 	
 
		$data['kontak'] = $this->m_kontak->kontak();
		$data['kantor'] = $this->m_kantor->kantor();
		$data['barang'] = $this->m_barang->barang_nama_cetak(); 
		$data['kantor2'] = $this->m_kantor->kantor();
		$data['admin'] = $this->m_admin->data_admin(); 
	 	$data['admin_login'] = $this->m_admin->data_admin_login(); 
		 
		 
		$this->load->view('master/laporan/cetak_barang_kulaan',$data);
		 
		 
		  
	} 
	function cetak_member(){		
		 

		 
		$data['title1'] = 'Data Laporan Member'; 	
		 
		$data['kontak'] = $this->m_kontak->kontak();
		$data['kantor'] = $this->m_kantor->kantor();
		$data['member'] = $this->m_member->member(); 
		$data['kantor2'] = $this->m_kantor->kantor();
		$data['admin'] = $this->m_admin->data_admin(); 
	 	$data['admin_login'] = $this->m_admin->data_admin_login(); 
		 
		 
		$this->load->view('master/laporan/cetak_member',$data);
		 
		 
		  
	}
	function form_stok_opname(){		
		 

		 
		$data['title1'] = 'Form Cetak Lembar Stok Opname'; 	
		$data['title2'] = 'Ubah Data'; 	
		$data['title3'] = 'Laporan Data';
		$data['title4'] = 'Supliyer';
		$data['kontak'] = $this->m_kontak->kontak();
		$data['kantor'] = $this->m_kantor->kantor();
		$data['barang'] = $this->m_barang->barang_nama(); 
		$data['kantor2'] = $this->m_kantor->kantor();
		$data['admin'] = $this->m_admin->data_admin(); 
		$data['rak'] = $this->m_admin->data_rak(); 
		$data['rak2'] = $this->m_admin->data_rak();
	 	$data['admin_login'] = $this->m_admin->data_admin_login(); 
		 
		 
		$this->load->view('master/header',$data); 
		$this->load->view('master/laporan/form_stok_opname');
		$this->load->view('master/footer',$data); 
		 
		 
		  
	} 
	function form_laporan_rak(){		
		 

		 
		$data['title1'] = 'Form Cetak Data Barang'; 	
		$data['title2'] = 'Ubah Data'; 	
		$data['title3'] = 'Laporan Data';
		$data['title4'] = 'Supliyer';
		$data['kontak'] = $this->m_kontak->kontak();
		$data['kantor'] = $this->m_kantor->kantor();
		$data['barang'] = $this->m_barang->barang_nama(); 
		$data['kantor2'] = $this->m_kantor->kantor();
		$data['admin'] = $this->m_admin->data_admin(); 
		$data['rak'] = $this->m_admin->data_rak(); 
		$data['rak2'] = $this->m_admin->data_rak();
	 	$data['admin_login'] = $this->m_admin->data_admin_login(); 
		 
		 
		$this->load->view('master/header',$data); 
		$this->load->view('master/laporan/form_laporan_rak');
		$this->load->view('master/footer',$data); 
		 
		 
		  
	} 
	function form_laporan_buku_kas(){		
		 

		 
		$data['title1'] = 'Form Laporan Buku Kas'; 	
		$data['title2'] = 'Ubah Data'; 	
		$data['title3'] = 'Laporan Data';
		$data['title4'] = 'Supliyer';
		$data['kontak'] = $this->m_kontak->kontak();
		$data['kantor'] = $this->m_kantor->kantor();
		$data['barang'] = $this->m_barang->barang_nama(); 
		$data['kantor2'] = $this->m_kantor->kantor();
		$data['admin'] = $this->m_admin->data_admin(); 
		$data['rak'] = $this->m_admin->data_rak(); 
		$data['rak2'] = $this->m_admin->data_rak();
	 	$data['admin_login'] = $this->m_admin->data_admin_login(); 
		 
		 
		$this->load->view('master/header',$data); 
		$this->load->view('master/laporan/form_buku_kas');
		$this->load->view('master/footer',$data); 
		 
		 
		  
	} 
	function form_laporan_stok_opname_rak(){		
		 

		 
		$data['title1'] = 'Form Stok Opname Barang'; 	
		$data['title2'] = 'Ubah Data'; 	
		$data['title3'] = 'Laporan Data';
		$data['title4'] = 'Supliyer';
		$data['kontak'] = $this->m_kontak->kontak();
		$data['kantor'] = $this->m_kantor->kantor();
		$data['barang'] = $this->m_barang->barang_nama(); 
		$data['kantor2'] = $this->m_kantor->kantor();
		$data['admin'] = $this->m_admin->data_admin(); 
		$data['rak'] = $this->m_admin->data_rak(); 
	 	$data['admin_login'] = $this->m_admin->data_admin_login(); 
		 
		 
		$this->load->view('master/header',$data); 
		$this->load->view('master/laporan/form_laporan_stok_opname_rak');
		$this->load->view('master/footer',$data); 
		 
		 
		  
	} 
	function tampil_stokopname_rak_barang(){		
		 

		 
		$data['title1'] = 'Tampil Stok Opname Barang'; 	
		$data['title2'] = 'Ubah Data'; 	
		$data['title3'] = 'Laporan Data';
		$data['title4'] = 'Supliyer';
		$data['kontak'] = $this->m_kontak->kontak();
		$data['kantor'] = $this->m_kantor->kantor();
		$data['barang'] = $this->m_barang->barang_nama(); 
		$data['kantor2'] = $this->m_kantor->kantor();
		$data['admin'] = $this->m_admin->data_admin(); 
		$data['rak'] = $this->m_admin->data_rak(); 
	 	$data['admin_login'] = $this->m_admin->data_admin_login(); 
		 
		 
		$this->load->view('master/header',$data); 
		$this->load->view('master/laporan/tampil_stokopname_rak_barang');
		$this->load->view('master/footer',$data); 
		 
		 
		  
	} 
	function cetak_rak_barang(){		
		 

		 
		$data['title1'] = 'Cetak Data Barang'; 	
		$data['title2'] = 'Ubah Data'; 	
		$data['title3'] = 'Laporan Data';
		$data['title4'] = 'Supliyer';
		$data['kontak'] = $this->m_kontak->kontak();
		$data['kantor'] = $this->m_kantor->kantor();
		$data['barang'] = $this->m_barang->barang_nama(); 
		$data['kantor2'] = $this->m_kantor->kantor();
		$data['admin'] = $this->m_admin->data_admin(); 
	 	$data['admin_login'] = $this->m_admin->data_admin_login(); 

	 	$id_rak=$this->input->post('id_rak');
	 	$this->db->where('id_rak',$id_rak);
		$query = $this->db->get('tb_rak');
		$row = $query->row();
		$data['nama_rak_tampil']= $row->nama_rak;
		
		$urutan = $this->input->post('urutan');   
		$data['barang'] = $this->m_admin->cetak_data_rak($id_rak,$urutan);  
		 
		$this->load->view('master/laporan/cetak_rak_barang',$data);
		 
		 
		  
	} 
	function cetak_lembar_stok_opname(){		
		 

		 
		$data['title1'] = 'Cetak Lembar Stok Opname Barang'; 	
	 
		$data['kontak'] = $this->m_kontak->kontak();
		$data['kantor'] = $this->m_kantor->kantor();
		$data['barang'] = $this->m_barang->barang_nama(); 
		$data['kantor2'] = $this->m_kantor->kantor();
		$data['admin'] = $this->m_admin->data_admin(); 
	 	$data['admin_login'] = $this->m_admin->data_admin_login(); 

	 	$id_rak=$this->input->post('id_rak');
	 	$this->db->where('id_rak',$id_rak);
		$query = $this->db->get('tb_rak');
		$row = $query->row();
		$data['nama_rak_tampil']= $row->nama_rak;
		 
		$data['barang'] = $this->m_admin->cetak_data_rak($id_rak);  
		 
		$this->load->view('master/laporan/cetak_lembar_stok_opname',$data);
		 
		 
		  
	} 
	function cetak_label_rak_barang(){		
		 

		 
		$data['title1'] = 'Cetak Data Barang'; 	
		$data['title2'] = 'Ubah Data'; 	
		$data['title3'] = 'Laporan Data';
		$data['title4'] = 'Supliyer';
		$data['kontak'] = $this->m_kontak->kontak();
		$data['kantor'] = $this->m_kantor->kantor();
		$data['barang'] = $this->m_barang->barang_nama(); 
		$data['kantor2'] = $this->m_kantor->kantor();
		$data['admin'] = $this->m_admin->data_admin(); 
	 	$data['admin_login'] = $this->m_admin->data_admin_login(); 

	 	$id_rak=$this->input->post('id_rak');
	 	$this->db->where('id_rak',$id_rak);
		$query = $this->db->get('tb_rak');
		$row = $query->row();
		$data['nama_rak_tampil']= $row->nama_rak;
		 
		$data['barang'] = $this->m_admin->cetak_data_rak($id_rak);  
		 
		$this->load->view('master/laporan/cetak_label_rak',$data);
		 
		 
		  
	}
	function get_admin_kasir(){
        $id=$this->input->post('id_kantor');
        $data=$this->m_admin->get_admin($id);
        echo json_encode($data);
    }
    function form_kulakan_manual(){		
		 
		date_default_timezone_get('Asia/Jakarta');
		$bulan = date('m');
		$tahun = date('Y');


		$sql_menu = "SELECT tb_transaksi.id_transaksi,tb_transaksi.date FROM tb_transaksi WHERE   month(tb_transaksi.date) =  '$bulan' and year(tb_transaksi.date) = '$tahun'  order BY tb_transaksi.date DESC LIMIT 5  ";
		$main_menu = $this->db->query($sql_menu)->result();
		foreach ($main_menu as $main) {
			$ID_TRX=$main->id_transaksi;

			$cek= $this->db->query("SELECT tb_jual_detail.id_transaksi FROM tb_jual_detail  where id_transaksi='$ID_TRX'")->num_rows();
			if($cek == 0){
				$hapus_barjual = "DELETE FROM tb_transaksi where id_transaksi='$ID_TRX'     ";
				$data = $this->db->query($hapus_barjual);

			}
		}
		 
		$data['title1'] = 'Data Laporan Transaksi'; 	
		$data['title2'] = 'Ubah Data'; 	
		$data['title3'] = 'Laporan Data';
		$data['title4'] = 'Supliyer';
		$data['kontak'] = $this->m_kontak->kontak();
		$data['kantor'] = $this->m_kantor->kantor();
		$data['kantor1'] = $this->m_kantor->kantor();
		$data['kantor2'] = $this->m_kantor->kantor();
		$data['kantorxx'] = $this->m_kantor->kantor();
		$data['admin'] = $this->m_admin->data_admin(); 
	 	$data['admin_login'] = $this->m_admin->data_admin_login(); 
		 
		$this->load->view('master/header',$data); 
		$this->load->view('master/laporan/form_laporan_kulakan_manual');
		$this->load->view('master/footer',$data); 
		
		 
		  
	}
	function form_transaksi_jual_katagori(){		
		 
		date_default_timezone_get('Asia/Jakarta');
		$bulan = date('m');
		$tahun = date('Y');


		$sql_menu = "SELECT tb_transaksi.id_transaksi,tb_transaksi.date FROM tb_transaksi WHERE   month(tb_transaksi.date) =  '$bulan' and year(tb_transaksi.date) = '$tahun'  order BY tb_transaksi.date DESC LIMIT 5  ";
		$main_menu = $this->db->query($sql_menu)->result();
		foreach ($main_menu as $main) {
			$ID_TRX=$main->id_transaksi;

			$cek= $this->db->query("SELECT tb_jual_detail.id_transaksi FROM tb_jual_detail  where id_transaksi='$ID_TRX'")->num_rows();
			if($cek == 0){
				$hapus_barjual = "DELETE FROM tb_transaksi where id_transaksi='$ID_TRX'     ";
				$data = $this->db->query($hapus_barjual);

			}
		}
		 
		$data['title1'] = 'Data Laporan Transaksi'; 	
		$data['title2'] = 'Ubah Data'; 	
		$data['title3'] = 'Laporan Data';
		$data['title4'] = 'Supliyer';
		$data['kontak'] = $this->m_kontak->kontak();
		$data['kantor'] = $this->m_kantor->kantor();
		$data['kantor1'] = $this->m_kantor->kantor();
		$data['kantor2'] = $this->m_kantor->kantor();
		$data['kantorxx'] = $this->m_kantor->kantor();
		$data['kantorza'] = $this->m_kantor->kantor();
		$data['kantorzax'] = $this->m_kantor->kantor();
		$data['admin'] = $this->m_admin->data_admin(); 
	 	$data['admin_login'] = $this->m_admin->data_admin_login(); 
		$data['katagori'] = $this->m_katagori->katagori(); 


		$this->load->view('master/header',$data); 
		$this->load->view('master/laporan/form_transaksi_jual_katagori');
		$this->load->view('master/footer',$data); 
		
		 
		  
	}
	function form_transaksi(){		
		 
		date_default_timezone_get('Asia/Jakarta');
		$bulan = date('m');
		$tahun = date('Y');


		$sql_menu = "SELECT tb_transaksi.id_transaksi,tb_transaksi.date FROM tb_transaksi WHERE   month(tb_transaksi.date) =  '$bulan' and year(tb_transaksi.date) = '$tahun'  order BY tb_transaksi.date DESC LIMIT 5  ";
		$main_menu = $this->db->query($sql_menu)->result();
		foreach ($main_menu as $main) {
			$ID_TRX=$main->id_transaksi;

			$cek= $this->db->query("SELECT tb_jual_detail.id_transaksi FROM tb_jual_detail  where id_transaksi='$ID_TRX'")->num_rows();
			if($cek == 0){
				$hapus_barjual = "DELETE FROM tb_transaksi where id_transaksi='$ID_TRX'     ";
				$data = $this->db->query($hapus_barjual);

			}
		}
		 
		$data['title1'] = 'Data Laporan Transaksi'; 	
		$data['title2'] = 'Ubah Data'; 	
		$data['title3'] = 'Laporan Data';
		$data['title4'] = 'Supliyer';
		$data['kontak'] = $this->m_kontak->kontak();
		$data['kantor'] = $this->m_kantor->kantor();
		$data['kantor1'] = $this->m_kantor->kantor();
		$data['kantor2'] = $this->m_kantor->kantor();
		$data['kantorxx'] = $this->m_kantor->kantor();
		$data['kantorza'] = $this->m_kantor->kantor();
		$data['kantorzax'] = $this->m_kantor->kantor();
		$data['admin'] = $this->m_admin->data_admin(); 
	 	$data['admin_login'] = $this->m_admin->data_admin_login(); 
		 
		$this->load->view('master/header',$data); 
		$this->load->view('master/laporan/form_laporan_transaksi');
		$this->load->view('master/footer',$data); 
		
		 
		  
	}
	function form_transaksi_custom(){		
		 
		date_default_timezone_get('Asia/Jakarta');
		$bulan = date('m');
		$tahun = date('Y');


		$sql_menu = "SELECT tb_transaksi.id_transaksi,tb_transaksi.date FROM tb_transaksi WHERE   month(tb_transaksi.date) =  '$bulan' and year(tb_transaksi.date) = '$tahun'  order BY tb_transaksi.date DESC LIMIT 1  ";
		$main_menu = $this->db->query($sql_menu)->result();
		foreach ($main_menu as $main) {
			$ID_TRX=$main->id_transaksi;

			$cek= $this->db->query("SELECT tb_jual_detail.id_transaksi FROM tb_jual_detail  where id_transaksi='$ID_TRX'")->num_rows();
			if($cek == 0){
				$hapus_barjual = "DELETE FROM tb_transaksi where id_transaksi='$ID_TRX'     ";
				$data = $this->db->query($hapus_barjual);

			}
		}
		 
		$data['title1'] = 'Data Laporan Transaksi '; 	
		$data['title2'] = 'Ubah Data'; 	
		$data['title3'] = 'Laporan Data';
		$data['title4'] = 'Supliyer';
		$data['kontak'] = $this->m_kontak->kontak();
		$data['kantor'] = $this->m_kantor->kantor();
		$data['kantor1'] = $this->m_kantor->kantor();
		$data['kantor2'] = $this->m_kantor->kantor();
		$data['kantorxx'] = $this->m_kantor->kantor();
		$data['kantorza'] = $this->m_kantor->kantor();
		$data['kantorzax'] = $this->m_kantor->kantor();
		$data['admin'] = $this->m_admin->data_admin(); 
	 	$data['admin_login'] = $this->m_admin->data_admin_login(); 
		 
		$this->load->view('master/header',$data); 
		$this->load->view('master/laporan/form_laporan_transaksi_custom');
		$this->load->view('master/footer',$data); 
		
		 
		  
	}
	function form_transaksi_laris(){		
		 
		date_default_timezone_get('Asia/Jakarta');
		$bulan = date('m');
		$tahun = date('Y');


		$sql_menu = "SELECT tb_transaksi.id_transaksi,tb_transaksi.date FROM tb_transaksi WHERE   month(tb_transaksi.date) =  '$bulan' and year(tb_transaksi.date) = '$tahun'  order BY tb_transaksi.date DESC LIMIT 5  ";
		$main_menu = $this->db->query($sql_menu)->result();
		foreach ($main_menu as $main) {
			$ID_TRX=$main->id_transaksi;

			$cek= $this->db->query("SELECT tb_jual_detail.id_transaksi FROM tb_jual_detail  where id_transaksi='$ID_TRX'")->num_rows();
			if($cek == 0){
				$hapus_barjual = "DELETE FROM tb_transaksi where id_transaksi='$ID_TRX'     ";
				$data = $this->db->query($hapus_barjual);

			}
		}
		 
		$data['title1'] = 'Data Laporan Barang Terlaris'; 	
		$data['title2'] = 'Ubah Data'; 	
		$data['title3'] = 'Laporan Data';
		$data['title4'] = 'Supliyer';
		$data['kontak'] = $this->m_kontak->kontak();
		$data['kantor'] = $this->m_kantor->kantor();
		$data['kantor1'] = $this->m_kantor->kantor();
		$data['kantor2'] = $this->m_kantor->kantor();
		$data['kantorxx'] = $this->m_kantor->kantor();
		$data['admin'] = $this->m_admin->data_admin(); 
	 	$data['admin_login'] = $this->m_admin->data_admin_login(); 
		 
		$this->load->view('master/header',$data); 
		$this->load->view('master/laporan/form_laporan_transaksi_laris');
		$this->load->view('master/footer',$data); 
		
		 
		  
	}
	function form_stokopname(){		
		 

		 
		$data['title1'] = 'Data Laporan Stok Opname'; 	
		$data['title2'] = 'Ubah Data'; 	
		$data['title3'] = 'Laporan Data';
		$data['title4'] = 'Supliyer';
		$data['kontak'] = $this->m_kontak->kontak();
		$data['kantor'] = $this->m_kantor->kantor();
		$data['kantor1'] = $this->m_kantor->kantor();
		$data['kantor2'] = $this->m_kantor->kantor();
		$data['kantorxx'] = $this->m_kantor->kantor();
		$data['admin'] = $this->m_admin->data_admin(); 
	 	$data['admin_login'] = $this->m_admin->data_admin_login(); 
		 
		$this->load->view('master/header',$data); 
		$this->load->view('master/laporan/form_laporan_stokopname');
		$this->load->view('master/footer',$data); 
		
		 
		  
	}
	function form_retur(){		
		 

		 
		$data['title1'] = 'Data Laporan Retur Pembelian'; 	
		$data['title2'] = 'Ubah Data'; 	
		$data['title3'] = 'Laporan Data Retur Pembelian';
	 
		$data['kontak'] = $this->m_kontak->kontak();
		$data['kantor'] = $this->m_kantor->kantor();
		$data['kantor1'] = $this->m_kantor->kantor();
		$data['kantor2'] = $this->m_kantor->kantor();
		$data['kantorxx'] = $this->m_kantor->kantor();
		$data['admin'] = $this->m_admin->data_admin(); 
	 	$data['admin_login'] = $this->m_admin->data_admin_login(); 
		 
		$this->load->view('master/header',$data); 
		$this->load->view('master/laporan/form_laporan_retur');
		$this->load->view('master/footer',$data); 
		
		 
		  
	}
	function cetak_laporan_kulakan_manual(){		

		 
		 date_default_timezone_get('Asia/Jakarta');
        $bulan = date('m');
        $tahun = date('Y');

        $tanggal= $this->input->post('tanggal');
	  	$data['tanggal']= $this->input->post('tanggal');

		$username = $this->session->userdata("username");  
		$this->db->where('username',$username);
		$query = $this->db->get('tb_admin');
		$row = $query->row();
		$data['id_admin']= $row->id;
		$data['nama_admin']= $row->nama_admin;
		$data['id_kantor']= $row->id_kantor;

		$id_admin = $row->id;
		$level = $row->level;
		$id_kantor = $row->id_kantor;


		$this->db->where('id_kantor',$id_kantor);
		$query = $this->db->get('tb_kantor');
		$row = $query->row();
		$data['nama_kantor']= $row->nama_kantor;

		 
		$data['title1'] = 'Data Laporan Transaksi'; 	
		$data['title2'] = 'Ubah Data'; 	
		$data['title3'] = 'Laporan Data';
		$data['title4'] = 'Supliyer';
		$data['kontak'] = $this->m_kontak->kontak();
		$data['kantor'] = $this->m_kantor->kantor();
		$data['kantor1'] = $this->m_kantor->kantor();
		$data['kantor2'] = $this->m_kantor->kantor();
		$data['admin'] = $this->m_admin->data_admin(); 
	  	$jenis_laporan= $this->input->post('jenis_laporan');
	  	$data['jenis_laporan']= $this->input->post('jenis_laporan');
	  
	  	$id_kantor_cari= $this->input->post('id_kantor');
	  	$bulan= $this->input->post('bulan');
	  	$data['bulan']= $this->input->post('bulan');
	  	$tahun= $this->input->post('tahun');
	  	$data['tahun']= $this->input->post('tahun');
	  	$tanggal_awal= $this->input->post('tanggal_awal');
	  	$data['tanggal_awal']= $this->input->post('tanggal_awal');
	  	$tanggal_akhir= $this->input->post('tanggal_akhir');
	  	$data['tanggal_akhir']= $this->input->post('tanggal_akhir');
	  	$id_admin= $this->input->post('id_admin');
	  	
	  	$data['transaksi']=$this->m_transaksi->laporan_kulakan_manual($jenis_laporan,$tanggal, $id_kantor_cari,$bulan,$tahun,	$tanggal_awal,	$tanggal_akhir,$id_admin);
	 
	   	$this->load->view('master/laporan/cetak_laporan_kulakan_manual',$data);
		 
		 
		  
	}


	function cetak_laporan_transaksi(){		

		 
		 date_default_timezone_get('Asia/Jakarta');
        $bulan = date('m');
        $tahun = date('Y');

        	$tanggal= $this->input->post('tanggal');
	  	$data['tanggal']= $this->input->post('tanggal');

	  	// if(!empty($tanggal)){
		// 	  		$sql_menu = "SELECT tb_transaksi.id_transaksi,tb_transaksi.date FROM tb_transaksi WHERE   month(tb_transaksi.date) =  '$bulan' and year(tb_transaksi.date) = '$tahun' order BY tb_transaksi.date DESC LIMIT 1  ";


		// 	  		$main_menu = $this->db->query($sql_menu)->result();
		// 	  		foreach ($main_menu as $main) {
		// 	  			$ID_TRX=$main->id_transaksi;

		// 	  			$cek= $this->db->query("SELECT tb_jual_detail.id_transaksi FROM tb_jual_detail  where id_transaksi='$ID_TRX'")->num_rows();
		// 	  			if($cek == 0){
		// 	  				$hapus_barjual = "DELETE FROM tb_transaksi where id_transaksi='$ID_TRX'     ";
		// 	  				$data1 = $this->db->query($hapus_barjual);

		// 	  			}
		// 	  		}

		// 		// ==============================================

		// 	  		$sql_menu2 = "SELECT tb_transaksi.id_transaksi,tb_transaksi.date FROM tb_transaksi WHERE DATE(tb_transaksi.date) =  CURDATE()   ";
		// 	  		$main_menu2 = $this->db->query($sql_menu2)->result();
		// 	  		foreach ($main_menu2 as $main2) {
		// 	  			$ID_TRX2=$main2->id_transaksi;

		// 	  			$cek2= $this->db->query("SELECT tb_jual_detail.id_transaksi FROM tb_jual_detail  where id_transaksi='$ID_TRX2'")->num_rows();
		// 	  			if($cek2 == 0){
		// 	  				$hapus_barjual2 = "DELETE FROM tb_transaksi where id_transaksi='$ID_TRX2'     ";
		// 	  				$data2 = $this->db->query($hapus_barjual2);

		// 	  			}
		// 	  		}
		// }else{
		// 	$sql_menu = "SELECT tb_transaksi.id_transaksi,tb_transaksi.date FROM tb_transaksi WHERE   month(tb_transaksi.date) =  '$bulan' and year(tb_transaksi.date) = '$tahun'  LIMIT 1  ";


		// 	  		$main_menu = $this->db->query($sql_menu)->result();
		// 	  		foreach ($main_menu as $main) {
		// 	  			$ID_TRX=$main->id_transaksi;

		// 	  			$cek= $this->db->query("SELECT tb_jual_detail.id_transaksi FROM tb_jual_detail  where id_transaksi='$ID_TRX'")->num_rows();
		// 	  			if($cek == 0){
		// 	  				$hapus_barjual = "DELETE FROM tb_transaksi where id_transaksi='$ID_TRX'     ";
		// 	  				$data1 = $this->db->query($hapus_barjual);

		// 	  			}
		// 	  		}
		// }	  		

		$username = $this->session->userdata("username");  
		$this->db->where('username',$username);
		$query = $this->db->get('tb_admin');
		$row = $query->row();
		$data['id_admin']= $row->id;
		$data['nama_admin']= $row->nama_admin;
		$data['id_kantor']= $row->id_kantor;

		$id_admin = $row->id;
		$level = $row->level;
		$id_kantor = $row->id_kantor;


		$this->db->where('id_kantor',$id_kantor);
		$query = $this->db->get('tb_kantor');
		$row = $query->row();
		$data['nama_kantor']= $row->nama_kantor;

		 
		$data['title1'] = 'Data Laporan Transaksi'; 	
		$data['title2'] = 'Ubah Data'; 	
		$data['title3'] = 'Laporan Data';
		$data['title4'] = 'Supliyer';
		$data['kontak'] = $this->m_kontak->kontak();
		$data['kantor'] = $this->m_kantor->kantor();
		$data['kantor1'] = $this->m_kantor->kantor();
		$data['kantor2'] = $this->m_kantor->kantor();
		$data['admin'] = $this->m_admin->data_admin(); 
	  	$jenis_laporan= $this->input->post('jenis_laporan');
	  	$data['jenis_laporan']= $this->input->post('jenis_laporan');
	  
	  	$id_kantor_cari= $this->input->post('id_kantor');
	  	$bulan= $this->input->post('bulan');
	  	$data['bulan']= $this->input->post('bulan');
	  	$tahun= $this->input->post('tahun');
	  	$data['tahun']= $this->input->post('tahun');
	  	$tanggal_awal= $this->input->post('tanggal_awal');
	  	$data['tanggal_awal']= $this->input->post('tanggal_awal');
	  	$tanggal_akhir= $this->input->post('tanggal_akhir');
	  	$data['tanggal_akhir']= $this->input->post('tanggal_akhir');
	  	$id_admin= $this->input->post('id_admin');
	  	
	  	$data['transaksi']=$this->m_transaksi->laporan($jenis_laporan,$tanggal, $id_kantor_cari,$bulan,$tahun,	$tanggal_awal,	$tanggal_akhir,$id_admin);
	  	$data['jumlah']=$this->m_transaksi->jumlah_total($jenis_laporan,$tanggal, $id_kantor_cari,$bulan,$tahun,	$tanggal_awal,	$tanggal_akhir,$id_admin);
	   
		$this->load->view('master/laporan/cetak_laporan_transaksi',$data);
		 
		 
		  
	}
	function cetak_laporan_rincian(){		

		 
		date_default_timezone_get('Asia/Jakarta');
        $bulan = date('m');
        $tahun = date('Y');

        $tanggal= $this->input->post('tanggal');
	  	$data['tanggal']= $this->input->post('tanggal');

	   

		$username = $this->session->userdata("username");  
		$this->db->where('username',$username);
		$query = $this->db->get('tb_admin');
		$row = $query->row();
		$data['id_admin']= $row->id;
		$data['nama_admin']= $row->nama_admin;
		$data['id_kantor']= $row->id_kantor;

		$id_admin = $row->id;
		$level = $row->level;
		$id_kantor = $row->id_kantor;


		$this->db->where('id_kantor',$id_kantor);
		$query = $this->db->get('tb_kantor');
		$row = $query->row();
		$data['nama_kantor']= $row->nama_kantor;

		 
		$data['title1'] = 'Data Laporan Transaksi'; 	
		$data['title2'] = 'Ubah Data'; 	
		$data['title3'] = 'Laporan Data';
		$data['title4'] = 'Supliyer';
		$data['kontak'] = $this->m_kontak->kontak();
		$data['kantor'] = $this->m_kantor->kantor();
		$data['kantor1'] = $this->m_kantor->kantor();
		$data['kantor2'] = $this->m_kantor->kantor();
		$data['admin'] = $this->m_admin->data_admin(); 
	  	$jenis_laporan= $this->input->post('jenis_laporan');
	  	$data['jenis_laporan']= $this->input->post('jenis_laporan');
	  
	  	$id_kantor_cari= $this->input->post('id_kantor');
	  	$bulan= $this->input->post('bulan');
	  	$data['bulan']= $this->input->post('bulan');
	  	$tahun= $this->input->post('tahun');
	  	$data['tahun']= $this->input->post('tahun');
	  	$tanggal_awal= $this->input->post('tanggal_awal');
	  	$data['tanggal_awal']= $this->input->post('tanggal_awal');
	  	$tanggal_akhir= $this->input->post('tanggal_akhir');
	  	$data['tanggal_akhir']= $this->input->post('tanggal_akhir');
	  	$id_admin= $this->input->post('id_admin');
	  	
	  	$data['transaksi']=$this->m_transaksi->laporan_rincian($jenis_laporan,$tanggal, $id_kantor_cari,$bulan,$tahun,	$tanggal_awal,	$tanggal_akhir,$id_admin);
	  	$data['jumlah']=$this->m_transaksi->jumlah_total($jenis_laporan,$tanggal, $id_kantor_cari,$bulan,$tahun,	$tanggal_awal,	$tanggal_akhir,$id_admin);
	   
		$this->load->view('master/laporan/cetak_laporan_transaksi_rincian',$data);
		 
		 
		  
	}
	function cetak_laporan_transaksi_custom(){		

		 
		 date_default_timezone_get('Asia/Jakarta');
        $bulan = date('m');
        $tahun = date('Y');

        $tanggal= $this->input->post('tanggal');
	  	$data['tanggal']= $this->input->post('tanggal');
	  
		$username = $this->session->userdata("username");  
		$this->db->where('username',$username);
		$query = $this->db->get('tb_admin');
		$row = $query->row();
		$data['id_admin']= $row->id;
		$data['nama_admin']= $row->nama_admin;
		$data['id_kantor']= $row->id_kantor;

		$id_admin = $row->id;
		$level = $row->level;
		$id_kantor = $row->id_kantor;


		$this->db->where('id_kantor',$id_kantor);
		$query = $this->db->get('tb_kantor');
		$row = $query->row();
		$data['nama_kantor']= $row->nama_kantor;

		 
		$data['title1'] = 'Data Laporan Transaksi'; 	
		$data['title2'] = 'Ubah Data'; 	
		$data['title3'] = 'Laporan Data';
		$data['title4'] = 'Supliyer';
		$data['kontak'] = $this->m_kontak->kontak();
		$data['kantor'] = $this->m_kantor->kantor();
		$data['kantor1'] = $this->m_kantor->kantor();
		$data['kantor2'] = $this->m_kantor->kantor();
		$data['admin'] = $this->m_admin->data_admin(); 
	  	$jenis_laporan= $this->input->post('jenis_laporan');
	  	$data['jenis_laporan']= $this->input->post('jenis_laporan');
	  	$grup= $this->input->post('grup');
	  	$urutan= $this->input->post('urutan');
	  	$data['urutan']= $this->input->post('urutan');
	  	
		$pilihan= $this->input->post('pilihan');
		$data['pilihan']= $this->input->post('pilihan');
	  	$id_kantor_cari= $this->input->post('id_kantor');
	  	$bulan= $this->input->post('bulan');
	  	$data['bulan']= $this->input->post('bulan');
	  	$tahun= $this->input->post('tahun');
	  	$data['tahun']= $this->input->post('tahun');
	  	$tanggal_awal= $this->input->post('tanggal_awal');
	  	$data['tanggal_awal']= $this->input->post('tanggal_awal');
	  	$tanggal_akhir= $this->input->post('tanggal_akhir');
	  	$data['tanggal_akhir']= $this->input->post('tanggal_akhir');
	  	$id_admin= $this->input->post('id_admin');
	  	
	  	$data['transaksi']=$this->m_transaksi->laporan_custom($jenis_laporan,$tanggal, $id_kantor_cari,$bulan,$tahun,	$tanggal_awal,	$tanggal_akhir,$id_admin,$grup,$urutan,$pilihan);

		$this->load->view('master/laporan/cetak_laporan_transaksi_custom',$data);
		 
		 
		  
	}
	function cetak_laporan_jual(){		

		 
		 date_default_timezone_get('Asia/Jakarta');
        $bulan = date('m');
        $tahun = date('Y');

        $tanggal= $this->input->post('tanggal');
	  	$data['tanggal']= $this->input->post('tanggal');
	  
		$username = $this->session->userdata("username");  
		$this->db->where('username',$username);
		$query = $this->db->get('tb_admin');
		$row = $query->row();
		$data['id_admin']= $row->id;
		$data['nama_admin']= $row->nama_admin;
		$data['id_kantor']= $row->id_kantor;

		$id_admin = $row->id;
		$level = $row->level;
		$id_kantor = $row->id_kantor;


		$this->db->where('id_kantor',$id_kantor);
		$query = $this->db->get('tb_kantor');
		$row = $query->row();
		$data['nama_kantor']= $row->nama_kantor;

		 
		$data['title1'] = 'Data Laporan Transaksi'; 	
		$data['title2'] = 'Ubah Data'; 	
		$data['title3'] = 'Laporan Data';
		$data['title4'] = 'Supliyer';
		$data['kontak'] = $this->m_kontak->kontak();
		$data['kantor'] = $this->m_kantor->kantor();
		$data['kantor1'] = $this->m_kantor->kantor();
		$data['kantor2'] = $this->m_kantor->kantor();
		$data['admin'] = $this->m_admin->data_admin(); 
	  	$jenis_laporan= $this->input->post('jenis_laporan');
	  	$data['jenis_laporan']= $this->input->post('jenis_laporan');
	  	$grup= $this->input->post('grup');
	  	$urutan= $this->input->post('urutan');
	  	$data['urutan']= $this->input->post('urutan');
	  	
		$pilihan= $this->input->post('pilihan');
		$data['pilihan']= $this->input->post('pilihan');
	  	$id_kantor_cari= $this->input->post('id_kantor');
	  	$bulan= $this->input->post('bulan');
	  	$data['bulan']= $this->input->post('bulan');
	  	$tahun= $this->input->post('tahun');
	  	$data['tahun']= $this->input->post('tahun');
	  	$tanggal_awal= $this->input->post('tanggal_awal');
	  	$data['tanggal_awal']= $this->input->post('tanggal_awal');
	  	$tanggal_akhir= $this->input->post('tanggal_akhir');
	  	$data['tanggal_akhir']= $this->input->post('tanggal_akhir');
	  	$id_admin= $this->input->post('id_admin');

	  	////////////////////
	  	$data['id_katagori']= $this->input->post('id_katagori');
	  	$id_katagori= $this->input->post('id_katagori');

		$this->db->where('id_katagori',$id_katagori);
		$query2 = $this->db->get('tb_katagori');
		$row2 = $query2->row();
		$data['id_katagori']= $row2->id_katagori;
		$data['nama_katagori']= $row2->nama_katagori;
	 	


	  
	  	
	  	$data['transaksi']=$this->m_transaksi->laporan_transaksi_jual_katagori($jenis_laporan,$tanggal, $id_kantor_cari,$bulan,$tahun,	$tanggal_awal,	$tanggal_akhir,$id_admin,$grup,$urutan,$pilihan,$id_katagori);


	  	$data['transaksi_total']=$this->m_transaksi->laporan_transaksi_jual_katagori_total($jenis_laporan,$tanggal, $id_kantor_cari,$bulan,$tahun,	$tanggal_awal,	$tanggal_akhir,$id_admin,$grup,$urutan,$pilihan,$id_katagori);

		$this->load->view('master/laporan/cetak_laporan_transaksi_jual_katagori',$data);
		 
		 
		  
	}
	function cetak_laporan_transaksi_ringkas(){		

		 
		 date_default_timezone_get('Asia/Jakarta');
        $bulan = date('m');
        $tahun = date('Y');

        $tanggal= $this->input->post('tanggal');
	  	$data['tanggal']= $this->input->post('tanggal');

	  
		$username = $this->session->userdata("username");  
		$this->db->where('username',$username);
		$query = $this->db->get('tb_admin');
		$row = $query->row();
		$data['id_admin']= $row->id;
		$data['nama_admin']= $row->nama_admin;
		$data['id_kantor']= $row->id_kantor;

		$id_admin = $row->id;
		$level = $row->level;
		$id_kantor = $row->id_kantor;


		$this->db->where('id_kantor',$id_kantor);
		$query = $this->db->get('tb_kantor');
		$row = $query->row();
		$data['nama_kantor']= $row->nama_kantor;

		 
		$data['title1'] = 'Data Laporan Transaksi'; 	
		$data['title2'] = 'Ubah Data'; 	
		$data['title3'] = 'Laporan Data';
		$data['title4'] = 'Supliyer';
		$data['kontak'] = $this->m_kontak->kontak();
		$data['kantor'] = $this->m_kantor->kantor();
		$data['kantor1'] = $this->m_kantor->kantor();
		$data['kantor2'] = $this->m_kantor->kantor();
		$data['admin'] = $this->m_admin->data_admin(); 
	  	$jenis_laporan= $this->input->post('jenis_laporan');
	  	$data['jenis_laporan']= $this->input->post('jenis_laporan');
	  
	  	$id_kantor_cari= $this->input->post('id_kantor');
	  	$bulan= $this->input->post('bulan');
	  	$data['bulan']= $this->input->post('bulan');
	  	$tahun= $this->input->post('tahun');
	  	$data['tahun']= $this->input->post('tahun');
	  	$tanggal_awal= $this->input->post('tanggal_awal');
	  	$data['tanggal_awal']= $this->input->post('tanggal_awal');
	  	$tanggal_akhir= $this->input->post('tanggal_akhir');
	  	$data['tanggal_akhir']= $this->input->post('tanggal_akhir');
	  	$id_admin= $this->input->post('id_admin');
	  	
	  	$data['transaksi']=$this->m_transaksi->laporan_tanggal($jenis_laporan,$tanggal, $id_kantor_cari,$bulan,$tahun,	$tanggal_awal,	$tanggal_akhir,$id_admin);
	  	$data['jumlah']=$this->m_transaksi->jumlah_total($jenis_laporan,$tanggal, $id_kantor_cari,$bulan,$tahun,	$tanggal_awal,	$tanggal_akhir,$id_admin);
	   
		$this->load->view('master/laporan/cetak_laporan_transaksi_ringkas',$data);
		 
		  
	}
	function cetak_laporan_transaksi2(){		

		 
		 date_default_timezone_get('Asia/Jakarta');
        $bulan = date('m');
        $tahun = date('Y');

        	$tanggal= $this->input->post('tanggal');
	  	$data['tanggal']= $this->input->post('tanggal');

// 	  	if(!empty($tanggal)){
// 			  		$sql_menu = "SELECT tb_transaksi.id_transaksi,tb_transaksi.date FROM tb_transaksi WHERE   month(tb_transaksi.date) =  '$bulan' and year(tb_transaksi.date) = '$tahun' order BY tb_transaksi.date DESC LIMIT 5  ";


// 			  		$main_menu = $this->db->query($sql_menu)->result();
// 			  		foreach ($main_menu as $main) {
// 			  			$ID_TRX=$main->id_transaksi;

// 			  			$cek= $this->db->query("SELECT tb_jual_detail.id_transaksi FROM tb_jual_detail  where id_transaksi='$ID_TRX'")->num_rows();
// 			  			if($cek == 0){
// 			  				$hapus_barjual = "DELETE FROM tb_transaksi where id_transaksi='$ID_TRX'     ";
// 			  				$data1 = $this->db->query($hapus_barjual);

// 			  			}
// 			  		}

// 				// ==============================================

// 			  		$sql_menu2 = "SELECT tb_transaksi.id_transaksi,tb_transaksi.date FROM tb_transaksi WHERE DATE(tb_transaksi.date) =  CURDATE()   ";
// 			  		$main_menu2 = $this->db->query($sql_menu2)->result();
// 			  		foreach ($main_menu2 as $main2) {
// 			  			$ID_TRX2=$main2->id_transaksi;

// 			  			$cek2= $this->db->query("SELECT tb_jual_detail.id_transaksi FROM tb_jual_detail  where id_transaksi='$ID_TRX2'")->num_rows();
// 			  			if($cek2 == 0){
// 			  				$hapus_barjual2 = "DELETE FROM tb_transaksi where id_transaksi='$ID_TRX2'     ";
// 			  				$data2 = $this->db->query($hapus_barjual2);

// 			  			}
// 			  		}
// 		}else{
// 			$sql_menu = "SELECT tb_transaksi.id_transaksi,tb_transaksi.date FROM tb_transaksi WHERE   month(tb_transaksi.date) =  '$bulan' and year(tb_transaksi.date) = '$tahun'  LIMIT 5  ";


// 			  		$main_menu = $this->db->query($sql_menu)->result();
// 			  		foreach ($main_menu as $main) {
// 			  			$ID_TRX=$main->id_transaksi;

// 			  			$cek= $this->db->query("SELECT tb_jual_detail.id_transaksi FROM tb_jual_detail  where id_transaksi='$ID_TRX'")->num_rows();
// 			  			if($cek == 0){
// 			  				$hapus_barjual = "DELETE FROM tb_transaksi where id_transaksi='$ID_TRX'     ";
// 			  				$data1 = $this->db->query($hapus_barjual);

// 			  			}
// 			  		}
// 		}	  		

		$username = $this->session->userdata("username");  
		$this->db->where('username',$username);
		$query = $this->db->get('tb_admin');
		$row = $query->row();
		$data['id_admin']= $row->id;
		$data['nama_admin']= $row->nama_admin;
		$data['id_kantor']= $row->id_kantor;

		$id_admin = $row->id;
		$level = $row->level;
		$id_kantor = $row->id_kantor;


		$this->db->where('id_kantor',$id_kantor);
		$query = $this->db->get('tb_kantor');
		$row = $query->row();
		$data['nama_kantor']= $row->nama_kantor;

		 
		$data['title1'] = 'Data Laporan Transaksi'; 	
		$data['title2'] = 'Ubah Data'; 	
		$data['title3'] = 'Laporan Data';
		$data['title4'] = 'Supliyer';
		$data['kontak'] = $this->m_kontak->kontak();
		$data['kantor'] = $this->m_kantor->kantor();
		$data['kantor1'] = $this->m_kantor->kantor();
		$data['kantor2'] = $this->m_kantor->kantor();
		$data['admin'] = $this->m_admin->data_admin(); 
	  	$jenis_laporan= $this->input->post('jenis_laporan');
	  	$data['jenis_laporan']= $this->input->post('jenis_laporan');
	  
	  	$id_kantor_cari= $this->input->post('id_kantor');
	  	$bulan= $this->input->post('bulan');
	  	$data['bulan']= $this->input->post('bulan');
	  	$tahun= $this->input->post('tahun');
	  	$data['tahun']= $this->input->post('tahun');
	  	$tanggal_awal= $this->input->post('tanggal_awal');
	  	$data['tanggal_awal']= $this->input->post('tanggal_awal');
	  	$tanggal_akhir= $this->input->post('tanggal_akhir');
	  	$data['tanggal_akhir']= $this->input->post('tanggal_akhir');
	  	$id_admin= $this->input->post('id_admin');
	  	
	  	$data['transaksi']=$this->m_transaksi->laporan($jenis_laporan,$tanggal, $id_kantor_cari,$bulan,$tahun,	$tanggal_awal,	$tanggal_akhir,$id_admin);
	  	$data['jumlah']=$this->m_transaksi->jumlah_total($jenis_laporan,$tanggal, $id_kantor_cari,$bulan,$tahun,	$tanggal_awal,	$tanggal_akhir,$id_admin);
	   
		$this->load->view('master/laporan/cetak_laporan_transaksi2',$data);
		 
		 
		  
	}
	function cetak_laporan_barang_terlaris(){		

		 
		 date_default_timezone_get('Asia/Jakarta');
        $bulan = date('m');
        $tahun = date('Y');

        	$tanggal= $this->input->post('tanggal');
	  	$data['tanggal']= $this->input->post('tanggal');
 	  		

		$username = $this->session->userdata("username");  
		$this->db->where('username',$username);
		$query = $this->db->get('tb_admin');
		$row = $query->row();
		$data['id_admin']= $row->id;
		$data['nama_admin']= $row->nama_admin;
		$data['id_kantor']= $row->id_kantor;

		$id_admin = $row->id;
		$level = $row->level;
		$id_kantor = $row->id_kantor;


		$this->db->where('id_kantor',$id_kantor);
		$query = $this->db->get('tb_kantor');
		$row = $query->row();
		$data['nama_kantor']= $row->nama_kantor;

		 
		$data['title1'] = 'Data Laporan Transaksi'; 	
		$data['title2'] = 'Ubah Data'; 	
		$data['title3'] = 'Laporan Data';
		$data['title4'] = 'Supliyer';
		$data['kontak'] = $this->m_kontak->kontak();
		$data['kantor'] = $this->m_kantor->kantor();
		$data['kantor1'] = $this->m_kantor->kantor();
		$data['kantor2'] = $this->m_kantor->kantor();
		$data['admin'] = $this->m_admin->data_admin(); 
	  	$jenis_laporan= $this->input->post('jenis_laporan');
	  	$data['jenis_laporan']= $this->input->post('jenis_laporan');
	  
	  	$id_kantor_cari= $this->input->post('id_kantor');
	  	$bulan= $this->input->post('bulan');
	  	$data['bulan']= $this->input->post('bulan');
	  	$tahun= $this->input->post('tahun');
	  	$data['tahun']= $this->input->post('tahun');
	  	$tanggal_awal= $this->input->post('tanggal_awal');
	  	$data['tanggal_awal']= $this->input->post('tanggal_awal');
	  	$tanggal_akhir= $this->input->post('tanggal_akhir');
	  	$data['tanggal_akhir']= $this->input->post('tanggal_akhir');
	  	$id_admin= $this->input->post('id_admin');
	  	$jumlah_cek= $this->input->post('jumlah_cek');
	  	
	  	$data['transaksi']=$this->m_transaksi->laporan_barang_laris($jenis_laporan,$tanggal, $id_kantor_cari,$bulan, $tahun,	$tanggal_awal,	$tanggal_akhir,$id_admin,$jumlah_cek);
	   
		$this->load->view('master/laporan/cetak_laporan_barang_laris',$data);
		 
		 
		  
	}
	function cetak_laporan_stokopname(){		
		$username = $this->session->userdata("username");  
		$this->db->where('username',$username);
		$query = $this->db->get('tb_admin');
		$row = $query->row();
		$data['id_admin']= $row->id;
		$data['nama_admin']= $row->nama_admin;
		$data['id_kantor']= $row->id_kantor;

		$id_admin = $row->id;
		$level = $row->level;
		$id_kantor = $row->id_kantor;


		$this->db->where('id_kantor',$id_kantor);
		$query = $this->db->get('tb_kantor');
		$row = $query->row();
		$data['nama_kantor']= $row->nama_kantor;

		 
		$data['title1'] = 'Data Laporan Stok Opname'; 	
		$data['title2'] = 'Ubah Data'; 	
		$data['title3'] = 'Laporan Data';
		$data['title4'] = 'Supliyer';
		$data['kontak'] = $this->m_kontak->kontak();
		$data['kantor'] = $this->m_kantor->kantor();
		$data['kantor1'] = $this->m_kantor->kantor();
		$data['kantor2'] = $this->m_kantor->kantor();
		$data['admin'] = $this->m_admin->data_admin(); 
	  	$jenis_laporan= $this->input->post('jenis_laporan');
	  	$data['jenis_laporan']= $this->input->post('jenis_laporan');
	  	$tanggal= $this->input->post('tanggal');
	  	$data['tanggal']= $this->input->post('tanggal');
	  	$id_kantor_cari= $this->input->post('id_kantor');
	  	$bulan= $this->input->post('bulan');
	  	$data['bulan']= $this->input->post('bulan');
	  	$tahun= $this->input->post('tahun');
	  	$data['tahun']= $this->input->post('tahun');
	  	$tanggal_awal= $this->input->post('tanggal_awal');
	  	$data['tanggal_awal']= $this->input->post('tanggal_awal');
	  	$tanggal_akhir= $this->input->post('tanggal_akhir');
	  	$data['tanggal_akhir']= $this->input->post('tanggal_akhir');
	  	$id_admin= $this->input->post('id_admin');
	  	
	  	$data['transaksi']=$this->m_stokopname->laporan($jenis_laporan,$tanggal, $id_kantor_cari,$bulan,$tahun,	$tanggal_awal,	$tanggal_akhir,$id_admin);
	  	$data['jumlah']=$this->m_transaksi->jumlah_total_stokopname($jenis_laporan,$tanggal, $id_kantor_cari,$bulan,$tahun,	$tanggal_awal,	$tanggal_akhir,$id_admin);
	   
	   
		$this->load->view('master/laporan/cetak_laporan_stokopname',$data);
		 
		 
		  
	}
	function cetak_laporan_retur(){		
		$username = $this->session->userdata("username");  
		$this->db->where('username',$username);
		$query = $this->db->get('tb_admin');
		$row = $query->row();
		$data['id_admin']= $row->id;
		$data['nama_admin']= $row->nama_admin;
		$data['id_kantor']= $row->id_kantor;

		$id_admin = $row->id;
		$level = $row->level;
		$id_kantor = $row->id_kantor;


		$this->db->where('id_kantor',$id_kantor);
		$query = $this->db->get('tb_kantor');
		$row = $query->row();
		$data['nama_kantor']= $row->nama_kantor;

		 
		$data['title1'] = 'Data Laporan Retur Pembelian'; 	
		$data['title2'] = 'Ubah Data'; 	
		$data['title3'] = 'Laporan Data';
		$data['title4'] = 'Supliyer';
		$data['kontak'] = $this->m_kontak->kontak();
		$data['kantor'] = $this->m_kantor->kantor();
		$data['kantor1'] = $this->m_kantor->kantor();
		$data['kantor2'] = $this->m_kantor->kantor();
		$data['admin'] = $this->m_admin->data_admin(); 
	  	$jenis_laporan= $this->input->post('jenis_laporan');
	  	$data['jenis_laporan']= $this->input->post('jenis_laporan');
	  	$tanggal= $this->input->post('tanggal');
	  	$data['tanggal']= $this->input->post('tanggal');
	  	$id_kantor_cari= $this->input->post('id_kantor');
	  	$bulan= $this->input->post('bulan');
	  	$data['bulan']= $this->input->post('bulan');
	  	$tahun= $this->input->post('tahun');
	  	$data['tahun']= $this->input->post('tahun');
	  	$tanggal_awal= $this->input->post('tanggal_awal');
	  	$data['tanggal_awal']= $this->input->post('tanggal_awal');
	  	$tanggal_akhir= $this->input->post('tanggal_akhir');
	  	$data['tanggal_akhir']= $this->input->post('tanggal_akhir');
	  	$id_admin= $this->input->post('id_admin');
	  	
	  	$data['transaksi']=$this->m_transaksi->laporan_retur($jenis_laporan,$tanggal, $id_kantor_cari,$bulan,$tahun,	$tanggal_awal,	$tanggal_akhir,$id_admin);
	  	$data['jumlah']=$this->m_transaksi->jumlah_total_retur($jenis_laporan,$tanggal, $id_kantor_cari,$bulan,$tahun,	$tanggal_awal,	$tanggal_akhir,$id_admin);
	   
		$this->load->view('master/laporan/cetak_laporan_retur',$data);
		 
		 
		  
	}
	function form_faktur(){		
		 

		 
		$data['title1'] = 'Data Laporan Faktur'; 	
		$data['admin_login'] = $this->m_admin->data_admin_login(); 
		$data['kontak'] = $this->m_kontak->kontak();
		$data['kantor'] = $this->m_kantor->kantor();
		$data['kantor1'] = $this->m_kantor->kantor();
		$data['kantor2'] = $this->m_kantor->kantor();
		$data['admin'] = $this->m_admin->data_admin(); 
	 
		 
		$this->load->view('master/header',$data); 
		$this->load->view('master/laporan/form_laporan_faktur');
		$this->load->view('master/footer',$data); 
		
		 
		  
	}
	function cetak_laporan_faktur(){		
		$username = $this->session->userdata("username");  
		$this->db->where('username',$username);
		$query = $this->db->get('tb_admin');
		$row = $query->row();
		$data['id_admin']= $row->id;
		$data['nama_admin']= $row->nama_admin;
		$data['id_kantor']= $row->id_kantor;

		$id_admin = $row->id;
		$level = $row->level;
		$id_kantor = $row->id_kantor;


		$this->db->where('id_kantor',$id_kantor);
		$query = $this->db->get('tb_kantor');
		$row = $query->row();
		$data['nama_kantor']= $row->nama_kantor;

		 
		$data['title1'] = 'Data Laporan Transaksi'; 	
		$data['title2'] = 'Ubah Data'; 	
		$data['title3'] = 'Laporan Data';
		$data['title4'] = 'Supliyer';
		$data['kontak'] = $this->m_kontak->kontak();
		$data['kantor'] = $this->m_kantor->kantor();
		$data['kantor1'] = $this->m_kantor->kantor();
		$data['kantor2'] = $this->m_kantor->kantor();
		$data['admin'] = $this->m_admin->data_admin();
		$status= $this->input->post('status'); 
	  	$jenis_laporan= $this->input->post('jenis_laporan');
	  	$data['jenis_laporan']= $this->input->post('jenis_laporan');
	  	$tanggal= $this->input->post('tanggal');
	  	$data['tanggal']= $this->input->post('tanggal');
	  	$id_kantor_cari= $this->input->post('id_kantor');
	  	$bulan= $this->input->post('bulan');
	  	$data['bulan']= $this->input->post('bulan');
	  	$tahun= $this->input->post('tahun');
	  	$data['tahun']= $this->input->post('tahun');
	  	$tanggal_awal= $this->input->post('tanggal_awal');
	  	$data['tanggal_awal']= $this->input->post('tanggal_awal');
	  	$tanggal_akhir= $this->input->post('tanggal_akhir');
	  	$data['tanggal_akhir']= $this->input->post('tanggal_akhir');
	  	
	  	$data['faktur']=$this->m_transaksi->faktur($jenis_laporan,$tanggal, $id_kantor_cari,$bulan,$tahun,	$tanggal_awal,	$tanggal_akhir,$status);
	  	$data['jumlah']=$this->m_transaksi->jumlah_faktur($jenis_laporan,$tanggal, $id_kantor_cari,$bulan,$tahun,	$tanggal_awal,	$tanggal_akhir,$status);
	   
		$this->load->view('master/laporan/cetak_laporan_faktur',$data);
		 
		 
		  
	}
	function form_dropout(){		
		 

		 
		$data['title1'] = 'Data Laporan Drop Out Barang'; 	
		$data['admin_login'] = $this->m_admin->data_admin_login(); 
		$data['kontak'] = $this->m_kontak->kontak();
		$data['kantor'] = $this->m_kantor->kantor();
		$data['kantor1'] = $this->m_kantor->kantor();
		$data['kantor2'] = $this->m_kantor->kantor();
		$data['admin'] = $this->m_admin->data_admin(); 
	 
		 
		$this->load->view('master/header',$data); 
		$this->load->view('master/laporan/form_laporan_dropout');
		$this->load->view('master/footer',$data); 
		
		 
		  
	}
	function cetak_laporan_history_kasir_delete(){		
		  
		$username = $this->session->userdata("username");  
		$this->db->where('username',$username);
		$query = $this->db->get('tb_admin');
		$row = $query->row();
		$data['id_admin']= $row->id;
		$data['nama_admin']= $row->nama_admin;
		$data['id_kantor']= $row->id_kantor;

		$id_admin = $row->id;
		$level = $row->level;
		$id_kantor = $row->id_kantor;


		$this->db->where('id_kantor',$id_kantor);
		$query = $this->db->get('tb_kantor');
		$row = $query->row();
		$data['nama_kantor']= $row->nama_kantor;

		 
		$data['title1'] = 'Data Laporan History Kasir'; 	
		 
		$data['title3'] = 'Laporan Data';
	 
		$data['kontak'] = $this->m_kontak->kontak();
		$data['kantor'] = $this->m_kantor->kantor();
		$data['kantor1'] = $this->m_kantor->kantor();
		$data['kantor2'] = $this->m_kantor->kantor();
		$data['admin'] = $this->m_admin->data_admin(); 
	  	$jenis_laporan= $this->input->post('jenis_laporan');
	  	$data['jenis_laporan']= $this->input->post('jenis_laporan');
	  	$tanggal= $this->input->post('tanggal');
	  	$data['tanggal']= $this->input->post('tanggal');
	  	$id_kantor_cari= $this->input->post('id_kantor');
	  	$bulan= $this->input->post('bulan');
	  	$data['bulan']= $this->input->post('bulan');
	  	$tahun= $this->input->post('tahun');
	  	$data['tahun']= $this->input->post('tahun');
	  	$tanggal_awal= $this->input->post('tanggal_awal');
	  	$data['tanggal_awal']= $this->input->post('tanggal_awal');
	  	$tanggal_akhir= $this->input->post('tanggal_akhir');
	  	$data['tanggal_akhir']= $this->input->post('tanggal_akhir');
	  	$id_admin= $this->input->post('id_admin');
	  	
	  	$data['kasir']=$this->m_kasir->laporan_kasir_delete($jenis_laporan,$tanggal, $id_kantor_cari,$bulan,$tahun,	$tanggal_awal,	$tanggal_akhir,$id_admin);
	 

		$this->load->view('master/laporan/cetak_laporan_history_kasir_delete',$data);
	 
		
		 
		  
	}
	
	function cetak_laporan_history_kasir(){		
		  
		$username = $this->session->userdata("username");  
		$this->db->where('username',$username);
		$query = $this->db->get('tb_admin');
		$row = $query->row();
		$data['id_admin']= $row->id;
		$data['nama_admin']= $row->nama_admin;
		$data['id_kantor']= $row->id_kantor;

		$id_admin = $row->id;
		$level = $row->level;
		$id_kantor = $row->id_kantor;


		$this->db->where('id_kantor',$id_kantor);
		$query = $this->db->get('tb_kantor');
		$row = $query->row();
		$data['nama_kantor']= $row->nama_kantor;

		 
		$data['title1'] = 'Data Laporan History Kasir'; 	
		 
		$data['title3'] = 'Laporan Data';
	 
		$data['kontak'] = $this->m_kontak->kontak();
		$data['kantor'] = $this->m_kantor->kantor();
		$data['kantor1'] = $this->m_kantor->kantor();
		$data['kantor2'] = $this->m_kantor->kantor();
		$data['admin'] = $this->m_admin->data_admin(); 
	  	$jenis_laporan= $this->input->post('jenis_laporan');
	  	$data['jenis_laporan']= $this->input->post('jenis_laporan');
	  	$tanggal= $this->input->post('tanggal');
	  	$data['tanggal']= $this->input->post('tanggal');
	  	$id_kantor_cari= $this->input->post('id_kantor');
	  	$bulan= $this->input->post('bulan');
	  	$data['bulan']= $this->input->post('bulan');
	  	$tahun= $this->input->post('tahun');
	  	$data['tahun']= $this->input->post('tahun');
	  	$tanggal_awal= $this->input->post('tanggal_awal');
	  	$data['tanggal_awal']= $this->input->post('tanggal_awal');
	  	$tanggal_akhir= $this->input->post('tanggal_akhir');
	  	$data['tanggal_akhir']= $this->input->post('tanggal_akhir');
	  	$id_admin= $this->input->post('id_admin');
	  	
	  	$data['kasir']=$this->m_kasir->laporan($jenis_laporan,$tanggal, $id_kantor_cari,$bulan,$tahun,	$tanggal_awal,	$tanggal_akhir,$id_admin);
	 

		$this->load->view('master/laporan/cetak_laporan_history_kasir',$data);
	 
		
		 
		  
	}
	function cetak_laporan_bukukas(){		
		  
		$username = $this->session->userdata("username");  
		$this->db->where('username',$username);
		$query = $this->db->get('tb_admin');
		$row = $query->row();
		$data['id_admin']= $row->id;
		$data['nama_admin']= $row->nama_admin;
		$data['id_kantor']= $row->id_kantor;

		$id_admin = $row->id;
		$level = $row->level;
		$id_kantor = $row->id_kantor;


		$this->db->where('id_kantor',$id_kantor);
		$query = $this->db->get('tb_kantor');
		$row = $query->row();
		$data['nama_kantor']= $row->nama_kantor;

		 
		$data['title1'] = 'Data Laporan Buku Kas'; 	
		 
		$data['title3'] = 'Laporan Data';
	 
		$data['kontak'] = $this->m_kontak->kontak();
		$data['kantor'] = $this->m_kantor->kantor();
		$data['kantor1'] = $this->m_kantor->kantor();
		$data['kantor2'] = $this->m_kantor->kantor();
		$data['admin'] = $this->m_admin->data_admin(); 
	  	$jenis_laporan= $this->input->post('jenis_laporan');
	  	$data['jenis_laporan']= $this->input->post('jenis_laporan');
	  	$tanggal= $this->input->post('tanggal');
	  	$data['tanggal']= $this->input->post('tanggal');
	  	$id_kantor_cari= $this->input->post('id_kantor');
	  	$bulan= $this->input->post('bulan');
	  	$data['bulan']= $this->input->post('bulan');
	  	$tahun= $this->input->post('tahun');
	  	$data['tahun']= $this->input->post('tahun');
	  	$tanggal_awal= $this->input->post('tanggal_awal');
	  	$data['tanggal_awal']= $this->input->post('tanggal_awal');
	  	$tanggal_akhir= $this->input->post('tanggal_akhir');
	  	$data['tanggal_akhir']= $this->input->post('tanggal_akhir');
	  	$id_admin= $this->input->post('id_admin');
	  	
	  	$data['bukukas']=$this->m_bukukas->laporan($jenis_laporan,$tanggal, $id_kantor_cari,$bulan,$tahun,	$tanggal_awal,	$tanggal_akhir,$id_admin);
	 

		$this->load->view('master/laporan/cetak_laporan_bukukas',$data);
	 
		
		 
		  
	}
	function history_kasir(){		
		 

		 
		$data['title1'] = 'Form Laporan History Kasir'; 	
		$data['admin_login'] = $this->m_admin->data_admin_login(); 
		$data['kontak'] = $this->m_kontak->kontak();
	 
		$data['kantor'] = $this->m_kantor->kantor();
		$data['kantor1'] = $this->m_kantor->kantor();
		$data['kantor2'] = $this->m_kantor->kantor();
		$data['admin'] = $this->m_admin->data_admin(); 
	 
		 
		$this->load->view('master/header',$data); 
		$this->load->view('master/laporan/form_laporan_history_kasir',$data);
		$this->load->view('master/footer',$data); 
		
		 
		  
	}
	function history_kasir_delete(){		
		 

		 
		$data['title1'] = 'Form Laporan History Kasir Delete Keranjang'; 	
		$data['admin_login'] = $this->m_admin->data_admin_login(); 
		$data['kontak'] = $this->m_kontak->kontak();
	 
		$data['kantor'] = $this->m_kantor->kantor();
		$data['kantor1'] = $this->m_kantor->kantor();
		$data['kantor2'] = $this->m_kantor->kantor();
		$data['admin'] = $this->m_admin->data_admin(); 
	 
		 
		$this->load->view('master/header',$data); 
		$this->load->view('master/laporan/form_laporan_history_kasir_delete',$data);
		$this->load->view('master/footer',$data); 
		
		 
		  
	}
	function cetak_laporan_dropout(){		
		$username = $this->session->userdata("username");  
		$this->db->where('username',$username);
		$query = $this->db->get('tb_admin');
		$row = $query->row();
		$data['id_admin']= $row->id;
		$data['nama_admin']= $row->nama_admin;
		$data['id_kantor']= $row->id_kantor;

		$id_admin = $row->id;
		$level = $row->level;
		$id_kantor = $row->id_kantor;


		$this->db->where('id_kantor',$id_kantor);
		$query = $this->db->get('tb_kantor');
		$row = $query->row();
		$data['nama_kantor']= $row->nama_kantor;

		 
		$data['title1'] = 'Data Laporan Drop Out Barang'; 	
		$data['title2'] = 'Ubah Data'; 	
	 
		$data['kontak'] = $this->m_kontak->kontak();
		$data['kantor'] = $this->m_kantor->kantor();
		$data['kantor1'] = $this->m_kantor->kantor();
		$data['kantor2'] = $this->m_kantor->kantor();
		$data['admin'] = $this->m_admin->data_admin(); 
	  	$jenis_laporan= $this->input->post('jenis_laporan');
	  	$data['jenis_laporan']= $this->input->post('jenis_laporan');
	  	$tanggal= $this->input->post('tanggal');
	  	$data['tanggal']= $this->input->post('tanggal');
	  	$id_kantor_cari= $this->input->post('id_kantor');
	  	$bulan= $this->input->post('bulan');
	  	$data['bulan']= $this->input->post('bulan');
	  	$tahun= $this->input->post('tahun');
	  	$data['tahun']= $this->input->post('tahun');
	  	$tanggal_awal= $this->input->post('tanggal_awal');
	  	$data['tanggal_awal']= $this->input->post('tanggal_awal');
	  	$tanggal_akhir= $this->input->post('tanggal_akhir');
	  	$data['tanggal_akhir']= $this->input->post('tanggal_akhir');
	  	
	  	$data['dropout']=$this->m_transaksi->dropout($jenis_laporan,$tanggal, $id_kantor_cari,$bulan,$tahun,	$tanggal_awal,	$tanggal_akhir);
	

	   
		$this->load->view('master/laporan/cetak_laporan_dropout',$data);
		 
		 
		  
	}
	function form_barcode(){		
		 

		 
		$data['title1'] = 'Cetak Barcode'; 	
		$data['admin_login'] = $this->m_admin->data_admin_login();  
		$data['kontak'] = $this->m_kontak->kontak();
		$data['kantor'] = $this->m_kantor->kantor();
		$data['kantor1'] = $this->m_kantor->kantor();
		$data['kantor2'] = $this->m_kantor->kantor();
		$data['admin'] = $this->m_admin->data_admin(); 
		$data['barang'] = $this->m_barang->barang(); 
	 	$data['barcode_list'] = $this->m_barang->barcode_list(); 
		 
		$this->load->view('master/header',$data); 
		$this->load->view('master/laporan/form_barcode',$data);
		$this->load->view('master/footer_barcode',$data); 
		
		 
		  
	}
	public function hapus_label_id($id){
		 
		 
	    $this->db->delete('tb_label', array('id_barang' => $id)); 
	    
	    redirect('laporan/form_label');
		
	}
	public function hapus_barcode_id($id){
		 
		 
	    $this->db->delete('tb_cetak_barcode', array('id_barang' => $id)); 
	    
	    redirect('laporan/form_barcode');
		
	}
	function form_label(){		
		 

		 
		$data['title1'] = 'Cetak Label Barang'; 	
		$data['admin_login'] = $this->m_admin->data_admin_login();  
		$data['kontak'] = $this->m_kontak->kontak();
		$data['kantor'] = $this->m_kantor->kantor();
		$data['kantor1'] = $this->m_kantor->kantor();
		$data['kantor2'] = $this->m_kantor->kantor();
		$data['admin'] = $this->m_admin->data_admin(); 
		$data['barang'] = $this->m_barang->barang(); 
	 	$data['label_list'] = $this->m_barang->label_list(); 
		 
		$this->load->view('master/header',$data); 
		$this->load->view('master/laporan/form_label',$data);
		$this->load->view('master/footer_barcode',$data); 
		
		 
		  
	}
	function cetak_barcode(){		
		 

		 
		$data['title1'] = 'Cetak Barcode'; 	
		$data['admin_login'] = $this->m_admin->data_admin_login();  
		$data['kontak'] = $this->m_kontak->kontak();
		$data['kantor'] = $this->m_kantor->kantor();
		$data['kantor1'] = $this->m_kantor->kantor();
		$data['kantor2'] = $this->m_kantor->kantor();
		$data['admin'] = $this->m_admin->data_admin(); 
		$data['barang'] = $this->m_barang->barang(); 
	 	$data['barcode_list'] = $this->m_barang->barcode_list(); 
		 
	 
		$this->load->view('master/laporan/cetak_barcode',$data);
	 
		 
		  
	}
	function cetak_label(){		
		 

		 
		$data['title1'] = 'Cetak Barcode'; 	
		$data['admin_login'] = $this->m_admin->data_admin_login();  
		$data['kontak'] = $this->m_kontak->kontak();
		$data['kantor'] = $this->m_kantor->kantor();
		$data['kantor1'] = $this->m_kantor->kantor();
		$data['kantor2'] = $this->m_kantor->kantor();
		$data['admin'] = $this->m_admin->data_admin(); 
		$data['barang'] = $this->m_barang->barang(); 
	 	$data['label_list'] = $this->m_barang->label_list(); 
		 
	 
		$this->load->view('master/laporan/cetak_label',$data);
	 
		 
		  
	}
	function cetak_label_all(){		
		 

		 
		$data['title1'] = 'Cetak Barcode'; 	
		$data['admin_login'] = $this->m_admin->data_admin_login();  
		$data['kontak'] = $this->m_kontak->kontak();
		$data['kantor'] = $this->m_kantor->kantor();
		$data['kantor1'] = $this->m_kantor->kantor();
		$data['kantor2'] = $this->m_kantor->kantor();
		$data['admin'] = $this->m_admin->data_admin(); 
		$data['barang'] = $this->m_barang->barang(); 
	 	$data['label_list'] = $this->m_barang->label_list_all(); 
		 
	 
	 
		$this->load->view('master/laporan/cetak_label_all',$data);
	 
		 
		  
	}
	/*
	public function code_list_barcode()
	{	 
		$id_barang=$this->input->post('id_barang');
		$this->db->where('id',$id_barang);
		$query = $this->db->get('tb_barang');
		$row = $query->row();
		$sku_number= 6373735;


		$this->load->library('zend');
        $this->zend->load('Zend/Barcode');
        $image_resource = Zend_Barcode::factory('code128', 'image', array('text'=>$sku_number), array())->draw();
        $image_name     = $sku_number.'.jpg';
        $image_dir      = './assets/barcode/'; // penyimpanan file barcode
        imagejpeg($image_resource, $image_dir.$image_name); 

		$data=array(
			'id'=>  null,
			'id_barang'=> $this->input->post('id_barang'),
			'jumlah'=> $this->input->post('jumlah'),
			'bar_code'=> $image_name

			 
		);

		$this->db->insert('tb_cetak_barcode',$data);
		$this->session->set_flashdata('msg','success');
		redirect('laporan/form_barcode');


 
        
        
    }  
    */
   public function code_list_barcode()
	{	 
		 

		$data=array(
			'id'=>  null,
			'id_barang'=> $this->input->post('id_barang'),
			'jumlah_samping'=> $this->input->post('jumlah_samping'),
			'jumlah_baris'=> $this->input->post('jumlah_baris'),
			  
		);


		if ($this->db->insert('tb_cetak_barcode',$data))
		{
			$this->session->set_flashdata('msg','success');
			redirect('laporan/form_barcode');
		}
		else
		{
			$this->session->set_flashdata('msg','error');
			redirect('laporan/form_barcode');
		}


 
        
        
    } 
     public function code_list_label()
	{	 
		 

		$data=array(
			'id_label'=>  null,
			'id_barang'=> $this->input->post('id_barang'),
			 
		);

		$this->db->insert('tb_label',$data);
		$this->session->set_flashdata('msg','success');
		redirect('laporan/form_label');


 
        
        
    } 
   function barcode($kode)
	{
	$height = isset($_GET['height']) ? mysql_real_escape_string($_GET['height']) : '35';   $width = isset($_GET['width']) ? mysql_real_escape_string($_GET['width']) : '2'; //1,2,3,dst

		$this->load->library('zend');$this->load->library('pdf');

    $this->zend->load('Zend/Barcode');

	   $barcodeOPT = array(

		      'text' => $kode,

		      'barHeight'=> $height,

		      'factor'=>$width,

	    );

       $renderOPT = array();

			 $render = Zend_Barcode::factory(

			'code128', 'image', $barcodeOPT, $renderOPT

		)->render();
	}
    public function code_list_barcode_kosong()
	{	 
		$hapus = "DELETE FROM tb_cetak_barcode   ";
		$data = $this->db->query($hapus);
	 
		$this->session->set_flashdata('msg','hapus');
		redirect('laporan/form_barcode');


 
        
        
    }  
    public function code_list_label_kosong()
	{	 
		$hapus = "DELETE FROM tb_label   ";
		$data = $this->db->query($hapus);
		 
		$this->session->set_flashdata('msg','hapus');
		redirect('laporan/form_label');


 
        
        
    }  
    function form_stok(){		
		 

		 
		$data['title1'] = 'Form Cetak Stok Barang'; 	
		$data['admin_login'] = $this->m_admin->data_admin_login();  
		$data['kontak'] = $this->m_kontak->kontak();
		$data['kantor'] = $this->m_kantor->kantor();
		$data['kantor1'] = $this->m_kantor->kantor();
		$data['kantor2'] = $this->m_kantor->kantor();
		$data['admin'] = $this->m_admin->data_admin(); 
		$data['barang'] = $this->m_barang->barang(); 
	 	$data['barcode_list'] = $this->m_barang->barcode_list(); 
		 
		$this->load->view('master/header',$data); 
		$this->load->view('master/laporan/form_stok',$data);
		$this->load->view('master/footer_barcode',$data); 
		
		 
		  
	}
	function form_stok_baru(){		
		 

		 
		$data['title1'] = 'Form Cetak Stok Barang'; 	
		$data['admin_login'] = $this->m_admin->data_admin_login();  
		$data['kontak'] = $this->m_kontak->kontak();
		$data['kantor'] = $this->m_kantor->kantor();
		$data['kantor1'] = $this->m_kantor->kantor();
		$data['kantor2'] = $this->m_kantor->kantor();
		$data['admin'] = $this->m_admin->data_admin(); 
		$data['barang'] = $this->m_barang->barang(); 
	 	$data['barcode_list'] = $this->m_barang->barcode_list(); 
		 
		$this->load->view('master/header',$data); 
		$this->load->view('master/laporan/form_stok_baru',$data);
		$this->load->view('master/footer_barcode',$data); 
		
		 
		  
	}
	  
	function cetak_stok_barang(){		
		 

		 
		$data['title1'] = 'Data Laporan Transaksi'; 	
		$data['title2'] = 'Ubah Data'; 	
		$data['title3'] = 'Laporan Data';
		$data['title4'] = 'Supliyer';
		$data['kontak'] = $this->m_kontak->kontak();
		$data['kantor'] = $this->m_kantor->kantor();
		$data['barang'] = $this->m_barang->barang_nama(); 
	 
		$data['admin'] = $this->m_admin->data_admin(); 
	 	$data['admin_login'] = $this->m_admin->data_admin_login(); 
		$id_kantor = $this->input->post('id_kantor');
		$this->db->where('id_kantor',$id_kantor);
		$query = $this->db->get('tb_kantor');
		$row = $query->row();
		$data['nama_kantor']= $row->nama_kantor;

            		  

		$data['barang'] = $this->m_kantor->kantor_stok($id_kantor); 
		$data['kantor2'] = $this->m_kantor->kantor();   
		 
		$this->load->view('master/laporan/cetak_stok',$data);
		 
		 
		  
	} 
	function cetak_stok_barang_baru(){		
		 

		 
		$data['title1'] = 'Data Laporan Transaksi'; 	
		$data['title2'] = 'Ubah Data'; 	
		$data['title3'] = 'Laporan Data';
		$data['title4'] = 'Supliyer';
		$data['kontak'] = $this->m_kontak->kontak();
		$data['kantor'] = $this->m_kantor->kantor();
		$data['barang'] = $this->m_barang->barang_nama(); 
	 
		$data['admin'] = $this->m_admin->data_admin(); 
	 	$data['admin_login'] = $this->m_admin->data_admin_login(); 
		$id_kantor = $this->input->post('id_kantor');
		$this->db->where('id_kantor',$id_kantor);
		$query = $this->db->get('tb_kantor');
		$row = $query->row();
		$data['nama_kantor']= $row->nama_kantor;

            		  

		$data['barang'] = $this->m_kantor->kantor_stok_baru($id_kantor); 
		$data['kantor2'] = $this->m_kantor->kantor();   
		 
		$this->load->view('master/laporan/cetak_stok_baru',$data);
		 
		 
		  
	} 
	 function form_barang_terjual(){		
		 

		 
		$data['title1'] = 'Cetak Jumlah Barang Terjual'; 	
		$data['admin_login'] = $this->m_admin->data_admin_login();  
		$data['kontak'] = $this->m_kontak->kontak();
		$data['kantor'] = $this->m_kantor->kantor();
		$data['kantor1'] = $this->m_kantor->kantor();
		$data['kantor2'] = $this->m_kantor->kantor();
		$data['admin'] = $this->m_admin->data_admin(); 
		$data['barang'] = $this->m_barang->barang(); 
	 	$data['barcode_list'] = $this->m_barang->barcode_list(); 
		 
		$this->load->view('master/header',$data); 
		$this->load->view('master/laporan/form_barang_terjual',$data);
		$this->load->view('master/footer_barcode',$data); 
		
		 
		  
	}
	function cetak_barang_terjual_tanggal(){		
		 

		 
		$data['title1'] = 'Data Laporan Transaksi'; 	
		$data['title2'] = 'Ubah Data'; 	
		$data['title3'] = 'Laporan Data';
		$data['title4'] = 'Supliyer';
		$data['kontak'] = $this->m_kontak->kontak();
		$data['kantor'] = $this->m_kantor->kantor();
		$data['barang'] = $this->m_barang->barang_nama(); 
	 
		$data['admin'] = $this->m_admin->data_admin(); 
	 	$data['admin_login'] = $this->m_admin->data_admin_login(); 

		$id_kantor = $this->input->post('id_kantor');
		$tanggal = $this->input->post('tanggal');
		$data['tanggal'] = $this->input->post('tanggal');
		$tahun = $this->input->post('tahun');

		$this->db->where('id_kantor',$id_kantor);
		$query = $this->db->get('tb_kantor');
		$row = $query->row();
		$data['nama_kantor']= $row->nama_kantor;

            		  

		$data['barang'] = $this->m_barang->cetak_barang_terjual_tanggal($id_kantor,$tanggal,$tahun);  
   	 
		$this->load->view('master/laporan/cetak_barang_terjual_tanggal',$data);
		 
		 
		  
	} 
	function cetak_barang_terjual(){		
		 

		 
		$data['title1'] = 'Data Laporan Transaksi'; 	
		$data['title2'] = 'Ubah Data'; 	
		$data['title3'] = 'Laporan Data';
		$data['title4'] = 'Supliyer';
		$data['kontak'] = $this->m_kontak->kontak();
		$data['kantor'] = $this->m_kantor->kantor();
		$data['barang'] = $this->m_barang->barang_nama(); 
	 
		$data['admin'] = $this->m_admin->data_admin(); 
	 	$data['admin_login'] = $this->m_admin->data_admin_login(); 

		$id_kantor = $this->input->post('id_kantor');
		$bulan = $this->input->post('bulan');
		$data['bulan'] = $this->input->post('bulan');
		$tahun = $this->input->post('tahun');

		$this->db->where('id_kantor',$id_kantor);
		$query = $this->db->get('tb_kantor');
		$row = $query->row();
		$data['nama_kantor']= $row->nama_kantor;

            		  

		$data['barang'] = $this->m_barang->cetak_barang_terjual($id_kantor,$bulan,$tahun);  
  
		 
		$this->load->view('master/laporan/cetak_barang_terjual',$data);
		 
		 
		  
	} 
	function form_history_barang(){		
		 

		 
		$data['title1'] = 'Cetak History In Out Barang '; 	
		$data['admin_login'] = $this->m_admin->data_admin_login();  
		$data['kontak'] = $this->m_kontak->kontak();
		$data['kantor'] = $this->m_kantor->kantor();
		$data['kantor1'] = $this->m_kantor->kantor();
		$data['kantor2'] = $this->m_kantor->kantor();
		$data['admin'] = $this->m_admin->data_admin(); 
		$data['barang'] = $this->m_barang->barang(); 
	 	$data['barcode_list'] = $this->m_barang->barcode_list(); 
		 
		$this->load->view('master/header',$data); 
		$this->load->view('master/laporan/form_barang_history',$data);
		$this->load->view('master/footer_barcode',$data); 
		
		 
		  
	}
	function cetak_barang_history(){		
		 

		 
		$data['title1'] = 'Data Laporan Transaksi'; 	
		$data['title2'] = 'Ubah Data'; 	
		$data['title3'] = 'Laporan Data';
		$data['title4'] = 'Supliyer';
		$data['kontak'] = $this->m_kontak->kontak();
		$data['kantor'] = $this->m_kantor->kantor();
		$data['barang'] = $this->m_barang->barang_nama(); 
	 
		$data['admin'] = $this->m_admin->data_admin(); 
	 	$data['admin_login'] = $this->m_admin->data_admin_login(); 

		$id_kantor = $this->input->post('id_kantor');
	 
		$id_barang = $this->input->post('id_barang');

		$this->db->where('id_kantor',$id_kantor);
		$query = $this->db->get('tb_kantor');
		$row = $query->row();
		$data['nama_kantor']= $row->nama_kantor;

            		  

		$data['barang'] = $this->m_barang->cetak_barang_history($id_kantor,$id_barang);  
  
		 
		$this->load->view('master/laporan/cetak_barang_history',$data);
		 
		 
		  
	} 
	 
    


}