copy dari repo om Irfan
This commit is contained in:
@@ -0,0 +1,198 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
class ManageLicense extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('ModelLicense', 'ML');
|
||||
$this->load->model('ModelType', 'MT');
|
||||
$this->load->model('ModelKurir', 'MK');
|
||||
$this->load->library(['datatables', 'form_validation']);
|
||||
$this->form_validation->set_error_delimiters('', '');
|
||||
}
|
||||
public function output_json($data, $encode = true)
|
||||
{
|
||||
if ($encode) $data = json_encode($data);
|
||||
$this->output->set_content_type('application/json')->set_output($data);
|
||||
}
|
||||
public function index()
|
||||
{
|
||||
$datLicense = $this->ML->getDataLicense();
|
||||
$datType = $this->MT->getDataType();
|
||||
$datKurir = $this->MK->getDataKurir();
|
||||
$data = [
|
||||
'sidebar' => "data proses license",
|
||||
'navChild' => "data license",
|
||||
'license' => $datLicense,
|
||||
'type' => $datType,
|
||||
'kurir' => $datKurir
|
||||
];
|
||||
|
||||
$this->load->view('master/License', $data);
|
||||
}
|
||||
|
||||
public function add()
|
||||
{
|
||||
$datLicense = $this->ML->getDataLicense();
|
||||
$datType = $this->MT->getDataType();
|
||||
$data = [
|
||||
'sidebar' => "data proses license",
|
||||
'navChild' => "data license",
|
||||
'license' => $datLicense,
|
||||
'type' => $datType
|
||||
];
|
||||
|
||||
$this->load->view('master/Input', $data);
|
||||
}
|
||||
|
||||
public function save()
|
||||
{
|
||||
$method = $this->input->post('method');
|
||||
$id_license = $this->input->post('id');
|
||||
$so_license = $this->input->post('so_license');
|
||||
$type_license = $this->input->post('id_type');
|
||||
$number_license = $this->input->post('number_license');
|
||||
$status_license = $this->input->post('status_license');
|
||||
|
||||
if ($status_license=="Belum Ready") {
|
||||
$inputlicense = [
|
||||
'SO_LICENSE' => $so_license,
|
||||
'TYPE_ID' => $type_license,
|
||||
'NUMBER_LICENSE' => $number_license,
|
||||
'STATUS_LICENSE' => $status_license,
|
||||
];
|
||||
} else {
|
||||
$inputlicense = [
|
||||
'SO_LICENSE' => $so_license,
|
||||
'TYPE_ID' => $type_license,
|
||||
'NUMBER_LICENSE' => $number_license,
|
||||
'STATUS_LICENSE' => $status_license,
|
||||
'READY_LICENSE' => date('Y-m-d H:i:s')
|
||||
];
|
||||
}
|
||||
|
||||
$actionlicense = $this->ML->create('license', $inputlicense);
|
||||
|
||||
if ($actionlicense) {
|
||||
$this->session->set_flashdata('flash', 'ditambah');
|
||||
redirect('ManageLicense');
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'ditambah');
|
||||
redirect('ManageLicense');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function ready()
|
||||
{
|
||||
$method = $this->input->post('method');
|
||||
$id_license = $this->input->post('id_license');
|
||||
$so_license = $this->input->post('so_licenseed');
|
||||
$type_license = $this->input->post('id_typeed');
|
||||
$number_license = $this->input->post('number_licenseed');
|
||||
|
||||
$datCheck = $this->ML->getDataLicense($id_license);
|
||||
if ($datCheck[0]['STATUS_LICENSE']=="Belum Ready") {
|
||||
$updatelicense = [
|
||||
'SO_LICENSE' => $so_license,
|
||||
'TYPE_ID' => $type_license,
|
||||
'NUMBER_LICENSE' => $number_license,
|
||||
'STATUS_LICENSE' => "Ready",
|
||||
'READY_LICENSE' => date('Y-m-d H:i:s')
|
||||
];
|
||||
} else {
|
||||
$updatelicense = [
|
||||
'SO_LICENSE' => $so_license,
|
||||
'TYPE_ID' => $type_license,
|
||||
'NUMBER_LICENSE' => $number_license
|
||||
];
|
||||
}
|
||||
|
||||
$actionlicense = $this->ML->update('license', $updatelicense, 'ID_LICENSE',$id_license);
|
||||
|
||||
if ($actionlicense) {
|
||||
$this->session->set_flashdata('flash', 'diproses');
|
||||
redirect('ManageLicense');
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'diproses');
|
||||
redirect('ManageLicense');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function kirim()
|
||||
{
|
||||
$method = $this->input->post('method');
|
||||
$id_license = $this->input->post('id_license');
|
||||
$kurir_license = $this->input->post('id_kurired');
|
||||
|
||||
$datCheck = $this->ML->getDataLicense($id_license);
|
||||
if ($datCheck[0]['STATUS_LICENSE']=="Terkirim") {
|
||||
$updatelicense = [
|
||||
'KURIR_ID' => $kurir_license
|
||||
];
|
||||
} else {
|
||||
$updatelicense = [
|
||||
'KURIR_ID' => $kurir_license,
|
||||
'STATUS_LICENSE' => "Terkirim",
|
||||
'KIRIM_LICENSE' => date('Y-m-d H:i:s')
|
||||
];
|
||||
}
|
||||
|
||||
$actionlicense = $this->ML->update('license', $updatelicense, 'ID_LICENSE',$id_license);
|
||||
|
||||
if ($actionlicense) {
|
||||
$this->session->set_flashdata('flash', 'dikirim');
|
||||
redirect('ManageLicense');
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'dikirim');
|
||||
redirect('ManageLicense');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function hapus()
|
||||
{
|
||||
$id = $this->input->post('id');
|
||||
if ($this->ML->delete('license', $id, 'ID_LICENSE')) {
|
||||
$this->session->set_flashdata('flash', 'dihapus');
|
||||
redirect('ManageLicense');
|
||||
}
|
||||
}
|
||||
|
||||
//public function edit()
|
||||
//{
|
||||
// $method = $this->input->post('method');
|
||||
// $id_service = $this->input->post('id_service');
|
||||
// $id_operator = $this->input->post('id_operatored');
|
||||
// $id_pelanggan = $this->input->post('id_pelangganed');
|
||||
// $id_barang = $this->input->post('id_baranged');
|
||||
// $status_service = $this->input->post('status_serviceed');
|
||||
// $sn_service = $this->input->post('sn_serviceed');
|
||||
// $keluhan_service = $this->input->post('keluhan_serviceed');
|
||||
// $keterangan_service = $this->input->post('keterangan_serviceed');
|
||||
//
|
||||
// $input = [
|
||||
// 'OPERATOR_ID' => $id_operator,
|
||||
// 'PELANGGAN_ID' => $id_pelanggan,
|
||||
// 'BARANG_ID' => $id_barang,
|
||||
// 'STATUS_SERVICE' => $status_service,
|
||||
// 'SN_SERVICE' => $sn_service,
|
||||
// 'KELUHAN_SERVICE' => $keluhan_service,
|
||||
// 'KETERANGAN_SERVICE' => $keterangan_service
|
||||
// ];
|
||||
//
|
||||
// $action = $this->MS->update('service', $input,'ID_SERVICE',$id_service);
|
||||
//
|
||||
// if ($action) {
|
||||
// $this->session->set_flashdata('flash', 'ditambah');
|
||||
// redirect('ManageService');
|
||||
// } else {
|
||||
// $this->session->set_flashdata('flashgagal', 'ditambah');
|
||||
// redirect('ManageService');
|
||||
// }
|
||||
//}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user