Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- defined('BASEPATH') OR exit('No direct script access allowed');
- use PhpOffice\PhpSpreadsheet\Spreadsheet;
- // use PhpOffice\PhpSpreadsheet\Reader\Xlsx;
- // use PhpOffice\PhpSpreadsheet\Reader\Xls;
- use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
- class Custom extends CI_Controller {
- var $d;
- var $in;
- public function __construct()
- {
- parent::__construct();
- if(!isset($_SERVER['HTTP_REFERER'])) redirect('/');
- $this->d = getSession($this);
- $this->d->_notification = getNotification($this);
- $this->d->_controller = $this->router->fetch_class();
- $this->d->_method = $this->router->fetch_method();
- loadLanguage($this, $this->d->_controller, $this->d->_method);
- $this->in = getPostAsObject($this);
- checkstatus($this);
- if(!$this->session->userdata('authenticated')) {
- redirect('/login');
- }
- helper_log();
- }
- public function index()
- {
- $this->load->view('template_view');
- }
- function laporan_pemasukan($arg1="", $arg2="")
- {
- if(empty($arg1)) $this->d->_action = 'view';
- else $this->d->_action = $arg1;
- modelLoad($this,array('mtpb_header'));
- if($this->d->_action == 'view'){
- modelLoad($this,array('mreferensi_dokumen_pabean'));
- $this->d->sdokumen_pabean = $this->mreferensi_dokumen_pabean->viewPosting(1);
- } else if($this->d->_action == 'viewdt'){
- modelLoad($this,array('mtpb_barang'));
- $res = $this->mtpb_barang->viewCustomsIn($this->in);
- printJSON($res);
- } else if($this->d->_action == 'excel'){
- printJSON($this->in);
- // modelLoad($this,array('mtpb_barang'));
- // $res = $this->mtpb_barang->viewCustomsIn($this->in);
- // printJSON($res);
- }
- $this->load->view('template_view', $this->d);
- }
- function laporan_pengeluaran($arg1="", $arg2="")
- {
- if(empty($arg1)) $this->d->_action = 'view';
- else $this->d->_action = $arg1;
- modelLoad($this,array('mtpb_header'));
- if($this->d->_action == 'view'){
- modelLoad($this,array('mreferensi_dokumen_pabean'));
- $this->d->sdokumen_pabean = $this->mreferensi_dokumen_pabean->viewPosting(3);
- } else if($this->d->_action == 'viewdt'){
- modelLoad($this,array('mtpb_barang'));
- $res = $this->mtpb_barang->viewCustomsOut($this->in);
- printJSON($res);
- }
- $this->load->view('template_view', $this->d);
- }
- function laporan_wip($arg1="", $arg2="")
- {
- if(empty($arg1)) $this->d->_action = 'view';
- else $this->d->_action = $arg1;
- $this->load->model('vt_customs');
- if($this->d->_action == 'view'){
- } else if($this->d->_action == 'store'){
- } else if($this->d->_action == 'edit'){
- } else if($this->d->_action == 'update'){
- } else if($this->d->_action == 'delete'){
- } else if($this->d->_action == 'viewdt'){
- $res = $this->vt_customs->viewWIP($this->in);
- printJSON($res);
- } else if($this->d->_action == ''){
- }
- $this->load->view('template_view', $this->d);
- }
- function custom_laporan_mutasi_bahan_baku($arg1="", $arg2="")
- {
- if(empty($arg1)) $this->d->_action = 'view';
- else $this->d->_action = $arg1;
- $this->load->model('vt_customs');
- if($this->d->_action == 'view'){
- } else if($this->d->_action == 'store'){
- } else if($this->d->_action == 'edit'){
- } else if($this->d->_action == 'update'){
- } else if($this->d->_action == 'delete'){
- } else if($this->d->_action == 'viewdt'){
- $res = $this->vt_customs->viewWIP($this->in);
- printJSON($res);
- } else if($this->d->_action == ''){
- }
- $this->load->view('template_view', $this->d);
- }
- function laporan_mutasi_bahan_baku($arg1="", $arg2="")
- {
- if(empty($arg1)) $this->d->_action = 'view';
- else $this->d->_action = $arg1;
- // $this->load->model('msales_approval');
- if($this->d->_action == 'add'){
- $this->d->_modal = array('referensi_dokumen_pabean');
- } else if($this->d->_action == 'store'){
- } else if($this->d->_action == 'edit'){
- } else if($this->d->_action == 'update'){
- } else if($this->d->_action == 'delete'){
- } else if($this->d->_action == 'viewdt'){
- modelLoad($this,array('mt_wh_detail'));
- $res = $this->mt_wh_detail->viewMutationDT($this->in);
- printJSON($res);
- } else if($this->d->_action == 'toExcel'){
- // printJSON($this->in);
- $spreadsheet = new Spreadsheet();
- $sheet = $spreadsheet->getActiveSheet();
- $sheet->setCellValue('A1', 'No');
- $sheet->setCellValue('B1', 'Kode Barang');
- $sheet->setCellValue('C1', 'Kode External');
- $sheet->setCellValue('D1', 'Nama Barang');
- $sheet->setCellValue('E1', 'Unit');
- $sheet->setCellValue('F1', 'Saldo Awal');
- $sheet->setCellValue('G1', 'Pemasukan');
- $sheet->setCellValue('H1', 'Pengeluaran');
- $sheet->setCellValue('I1', 'Penyesuaian Adjustment');
- $sheet->setCellValue('J1', 'Saldo Akhir');
- $sheet->setCellValue('K1', 'Stock Opname');
- $sheet->setCellValue('L1', 'Selisih');
- $sheet->setCellValue('M1', 'Keterangan');
- modelLoad($this,array('mt_wh_detail'));
- $res = $this->mt_wh_detail->toExcel($this->in);
- // printJSON($res);
- $no = 1;
- $x = 2;
- foreach($res as $res) {
- $sheet->setCellValue('A' .$x, $no++);
- $sheet->setCellValue('B' .$x, $res->kode_barang);
- $sheet->setCellValue('C' .$x, $res->external_code);
- $sheet->setCellValue('D' .$x, $res->nama_barang);
- $sheet->setCellValue('E' .$x, $res->kode_satuan);
- $sheet->setCellValue('F' .$x, number_format($res->qty_begin,2));
- $sheet->setCellValue('G' .$x, number_format($res->qty_in,2));
- $sheet->setCellValue('H' .$x, number_format($res->qty_out,2));
- $sheet->setCellValue('I' .$x, number_format($res->qty_adjust,2));
- $sheet->setCellValue('J' .$x, number_format($res->qty_end,2));
- $sheet->setCellValue('K' .$x, number_format($res->qty_opname,2));
- $sheet->setCellValue('L' .$x, number_format($res->qty_selisih,2));
- $sheet->setCellValue('M' .$x, $res->description);
- $x++;
- }
- $styleArray = array(
- 'borders' => array(
- 'allBorders' => array(
- 'borderStyle' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THIN,
- ),
- ),
- );
- $i = $x - 1;
- foreach(range('A','M') as $columnID) {
- $sheet->getColumnDimension($columnID)
- ->setAutoSize(true);
- }
- $sheet->getStyle('A1:M'.$i)->applyFromArray($styleArray);
- $writer = new Xlsx($spreadsheet);
- header('Content-Type: application/vnd.ms-excel');
- header('Content-Disposition: attachment;filename="'.$this->d->_controller . '/' . $this->d->_method.'.xlsx"');
- header('Cache-Control: max-age=0');
- $writer->save('php://output');
- }
- $this->load->view('template_view', $this->d);
- }
- function laporan_mutasi_bahan_bakar($arg1="", $arg2="")
- {
- if(empty($arg1)) $this->d->_action = 'view';
- else $this->d->_action = $arg1;
- // $this->load->model('msales_approval');
- if($this->d->_action == 'add'){
- $this->d->_modal = array('referensi_dokumen_pabean');
- } else if($this->d->_action == 'store'){
- } else if($this->d->_action == 'edit'){
- } else if($this->d->_action == 'update'){
- } else if($this->d->_action == 'delete'){
- } else if($this->d->_action == 'viewdt'){
- // $res = $this->mreferensi_dokumen_pabean->viewDT($this->in);
- // printJSON($res);
- } else if($this->d->_action == ''){
- }
- $this->load->view('template_view', $this->d);
- }
- function laporan_mutasi_barang_jadi($arg1="", $arg2="")
- {
- if(empty($arg1)) $this->d->_action = 'view';
- else $this->d->_action = $arg1;
- // $this->load->model('msales_approval');
- if($this->d->_action == 'add'){
- $this->d->_modal = array('referensi_dokumen_pabean');
- } else if($this->d->_action == 'store'){
- } else if($this->d->_action == 'edit'){
- } else if($this->d->_action == 'update'){
- } else if($this->d->_action == 'delete'){
- } else if($this->d->_action == 'viewdt'){
- modelLoad($this,array('mt_wh_detail'));
- $res = $this->mt_wh_detail->viewMutationDT($this->in);
- printJSON($res);
- } else if($this->d->_action == ''){
- }
- $this->load->view('template_view', $this->d);
- }
- function laporan_mutasi_barang_modal($arg1="", $arg2="")
- {
- if(empty($arg1)) $this->d->_action = 'view';
- else $this->d->_action = $arg1;
- // $this->load->model('msales_approval');
- if($this->d->_action == 'add'){
- $this->d->_modal = array('referensi_dokumen_pabean');
- } else if($this->d->_action == 'store'){
- } else if($this->d->_action == 'edit'){
- } else if($this->d->_action == 'update'){
- } else if($this->d->_action == 'delete'){
- } else if($this->d->_action == 'viewdt'){
- modelLoad($this,array('mt_wh_detail'));
- $res = $this->mt_wh_detail->viewMutationDT($this->in);
- printJSON($res);
- } else if($this->d->_action == ''){
- }
- $this->load->view('template_view', $this->d);
- }
- function laporan_mutasi_keperluan_penelitian($arg1="", $arg2="")
- {
- if(empty($arg1)) $this->d->_action = 'view';
- else $this->d->_action = $arg1;
- // $this->load->model('msales_approval');
- if($this->d->_action == 'add'){
- $this->d->_modal = array('referensi_dokumen_pabean');
- } else if($this->d->_action == 'store'){
- } else if($this->d->_action == 'edit'){
- } else if($this->d->_action == 'update'){
- } else if($this->d->_action == 'delete'){
- } else if($this->d->_action == 'viewdt'){
- modelLoad($this,array('mt_wh_detail'));
- $res = $this->mt_wh_detail->viewMutationDT($this->in);
- printJSON($res);
- } else if($this->d->_action == ''){
- }
- $this->load->view('template_view', $this->d);
- }
- function laporan_mutasi_peralatan_kantor($arg1="", $arg2="")
- {
- if(empty($arg1)) $this->d->_action = 'view';
- else $this->d->_action = $arg1;
- // $this->load->model('msales_approval');
- if($this->d->_action == 'add'){
- $this->d->_modal = array('referensi_dokumen_pabean');
- } else if($this->d->_action == 'store'){
- } else if($this->d->_action == 'edit'){
- } else if($this->d->_action == 'update'){
- } else if($this->d->_action == 'delete'){
- } else if($this->d->_action == 'viewdt'){
- modelLoad($this,array('mt_wh_detail'));
- $res = $this->mt_wh_detail->viewMutationDT($this->in);
- printJSON($res);
- } else if($this->d->_action == ''){
- }
- $this->load->view('template_view', $this->d);
- }
- function laporan_mutasi_sisa_produksi_scrap($arg1="", $arg2="")
- {
- if(empty($arg1)) $this->d->_action = 'view';
- else $this->d->_action = $arg1;
- // $this->load->model('msales_approval');
- if($this->d->_action == 'add'){
- $this->d->_modal = array('referensi_dokumen_pabean');
- } else if($this->d->_action == 'store'){
- } else if($this->d->_action == 'edit'){
- } else if($this->d->_action == 'update'){
- } else if($this->d->_action == 'delete'){
- } else if($this->d->_action == 'viewdt'){
- modelLoad($this,array('mt_wh_detail'));
- $res = $this->mt_wh_detail->viewMutationDT($this->in);
- printJSON($res);
- } else if($this->d->_action == ''){
- }
- $this->load->view('template_view', $this->d);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement