319 lines
9.3 KiB
PHP
319 lines
9.3 KiB
PHP
<?php
|
|
defined('BASEPATH') or exit('No direct script access allowed');
|
|
|
|
class ManageService extends CI_Controller
|
|
{
|
|
function __construct()
|
|
{
|
|
parent::__construct();
|
|
$this->load->model('ModelService', 'MS');
|
|
$this->load->model('ModelOperator', 'MO');
|
|
$this->load->model('ModelBarang', 'MB');
|
|
$this->load->model('ModelPelanggan', 'MP');
|
|
$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()
|
|
{
|
|
$username = $this->session->userdata('username');
|
|
$jabatan = $this->session->userdata('jabatan');
|
|
if ($username == null) {
|
|
redirect("Action");
|
|
} elseif ($jabatan != "ADMIN") {
|
|
redirect("Action");
|
|
}
|
|
|
|
$datService = $this->MS->getDataService();
|
|
$datOperator = $this->MO->getDataOperator();
|
|
$datPelanggan = $this->MP->getDataPelangganNormal();
|
|
$datBarang = $this->MB->getDataBarang();
|
|
|
|
$data = [
|
|
'sidebar' => "data proses service",
|
|
'navChild' => "data proses input",
|
|
'service' => $datService,
|
|
'operator' => $datOperator,
|
|
'pelanggan' => $datPelanggan,
|
|
'barang' => $datBarang
|
|
];
|
|
|
|
$this->load->view('master/Service', $data);
|
|
}
|
|
|
|
public function addNormal()
|
|
{
|
|
$username = $this->session->userdata('username');
|
|
$jabatan = $this->session->userdata('jabatan');
|
|
if ($username == null) {
|
|
redirect("Action");
|
|
} elseif ($jabatan != "ADMIN") {
|
|
redirect("Action");
|
|
}
|
|
|
|
$datService = $this->MS->getDataService();
|
|
$datOperator = $this->MO->getDataOperator();
|
|
$datPelanggan = $this->MP->getDataPelangganNormal();
|
|
$datBarang = $this->MB->getDataBarang();
|
|
|
|
$data = [
|
|
'sidebar' => "data proses service",
|
|
'navChild' => "data proses input",
|
|
'service' => $datService,
|
|
'operator' => $datOperator,
|
|
'pelanggan' => $datPelanggan,
|
|
'barang' => $datBarang
|
|
];
|
|
|
|
$this->load->view('proses/TambahService', $data);
|
|
}
|
|
|
|
public function addInternal()
|
|
{
|
|
$username = $this->session->userdata('username');
|
|
$jabatan = $this->session->userdata('jabatan');
|
|
if ($username == null) {
|
|
redirect("Action");
|
|
} elseif ($jabatan != "ADMIN") {
|
|
redirect("Action");
|
|
}
|
|
|
|
$datService = $this->MS->getDataService();
|
|
$datOperator = $this->MO->getDataOperator();
|
|
$datBarang = $this->MB->getDataBarang();
|
|
|
|
$data = [
|
|
'sidebar' => "data proses service",
|
|
'navChild' => "data proses input",
|
|
'service' => $datService,
|
|
'operator' => $datOperator,
|
|
'barang' => $datBarang
|
|
];
|
|
|
|
$this->load->view('proses/TambahServiceInternal', $data);
|
|
}
|
|
|
|
public function addOutlet()
|
|
{
|
|
$username = $this->session->userdata('username');
|
|
$jabatan = $this->session->userdata('jabatan');
|
|
if ($username == null) {
|
|
redirect("Action");
|
|
} elseif ($jabatan != "ADMIN") {
|
|
redirect("Action");
|
|
}
|
|
|
|
$datService = $this->MS->getDataService();
|
|
$datOperator = $this->MO->getDataOperator();
|
|
$datBarang = $this->MB->getDataBarang();
|
|
|
|
$data = [
|
|
'sidebar' => "data proses service",
|
|
'navChild' => "data proses input",
|
|
'service' => $datService,
|
|
'operator' => $datOperator,
|
|
'barang' => $datBarang
|
|
];
|
|
|
|
$this->load->view('proses/TambahServiceItp', $data);
|
|
}
|
|
|
|
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');
|
|
}
|
|
}
|
|
|
|
public function save()
|
|
{
|
|
$method = $this->input->post('method');
|
|
$id_service = $this->input->post('id');
|
|
$id_operator = $this->input->post('id_operator');
|
|
$id_pelanggan = $this->input->post('id_pelanggan');
|
|
$id_barang = $this->input->post('id_barang');
|
|
$status_service = $this->input->post('status_service');
|
|
$sn_service = $this->input->post('sn_service');
|
|
$keluhan_service = $this->input->post('keluhan_service');
|
|
$keterangan_service = $this->input->post('keterangan_service');
|
|
|
|
$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->create('service', $input);
|
|
|
|
if ($status_service=="Garansi") {
|
|
$inputclaim = [
|
|
'STATUS_CLAIMDELL' => "Belum Proses"
|
|
];
|
|
|
|
$actionclaim = $this->MS->create('claimdell', $inputclaim);
|
|
$datClaimdellID = $this->MS->getDataClaimdellID();
|
|
if (is_array($datClaimdellID)||is_object($$datClaimdellID)) {
|
|
$datClaimdellService = $this->MS->getDataClaimdellService();
|
|
|
|
$inputservice = [
|
|
'CLAIMDELL_ID' => $datClaimdellID[0]['ID_CLAIMDELL']
|
|
];
|
|
|
|
$actionservice = $this->MS->update('service', $inputservice, 'ID_SERVICE',$datClaimdellService[0]['ID_SERVICE']);
|
|
}
|
|
}
|
|
|
|
if ($actionservice) {
|
|
$this->session->set_flashdata('flash', 'ditambah');
|
|
redirect('ManageService');
|
|
} else {
|
|
$this->session->set_flashdata('flashgagal', 'ditambah');
|
|
redirect('ManageService');
|
|
}
|
|
|
|
}
|
|
|
|
public function saveinternal()
|
|
{
|
|
$method = $this->input->post('method');
|
|
$id_service = $this->input->post('id');
|
|
$id_operator = $this->input->post('id_operator');
|
|
$id_pelanggan = $this->input->post('id_pelanggan');
|
|
$id_barang = $this->input->post('id_barang');
|
|
$status_service = $this->input->post('status_service');
|
|
$sn_service = $this->input->post('sn_service');
|
|
$nosj_internal = $this->input->post('nosj_internal');
|
|
$keluhan_service = $this->input->post('keluhan_service');
|
|
$keterangan_service = $this->input->post('keterangan_service');
|
|
|
|
$inputinternal = [
|
|
'NOSJ_INTERNAL' => $nosj_internal
|
|
];
|
|
|
|
$inputservice = [
|
|
'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
|
|
];
|
|
|
|
$actioninternal = $this->MS->create('internal', $inputinternal);
|
|
$actionservice = $this->MS->create('service', $inputservice);
|
|
|
|
$datID = $this->MS->getDataInternalID();
|
|
if (is_array($datID)||is_object($$datID)) {
|
|
$update = [
|
|
'INTERNAL_ID' => $datID[0]['ID_INTERNAL']
|
|
];
|
|
$datIS = $this->MS->getDataInternalService();
|
|
$actionupdate = $this->MS->update('service', $update, 'ID_SERVICE',$datIS[0]['ID_SERVICE']);
|
|
}
|
|
|
|
if ($actionupdate) {
|
|
$this->session->set_flashdata('flash', 'ditambah');
|
|
redirect('ManageService');
|
|
} else {
|
|
$this->session->set_flashdata('flashgagal', 'ditambah');
|
|
redirect('ManageService');
|
|
}
|
|
|
|
}
|
|
|
|
public function saveitp()
|
|
{
|
|
$method = $this->input->post('method');
|
|
$id_service = $this->input->post('id');
|
|
$id_operator = $this->input->post('id_operator');
|
|
$id_barang = $this->input->post('id_barang');
|
|
$customer_itp = $this->input->post('customer_itp');
|
|
$status_service = $this->input->post('status_service');
|
|
$sn_service = $this->input->post('sn_service');
|
|
$nosj_itp = $this->input->post('nosj_itp');
|
|
$keluhan_service = $this->input->post('keluhan_service');
|
|
$keterangan_service = $this->input->post('keterangan_service');
|
|
|
|
$inputitp = [
|
|
'CUSTOMER_ITP' => $customer_itp,
|
|
'NOSJ_ITP' => $nosj_itp
|
|
];
|
|
|
|
$inputservice = [
|
|
'OPERATOR_ID' => $id_operator,
|
|
'PELANGGAN_ID' => '3',
|
|
'BARANG_ID' => $id_barang,
|
|
'STATUS_SERVICE' => $status_service,
|
|
'SN_SERVICE' => $sn_service,
|
|
'KELUHAN_SERVICE' => $keluhan_service,
|
|
'KETERANGAN_SERVICE' => $keterangan_service
|
|
];
|
|
|
|
$actionitp = $this->MS->create('itp', $inputitp);
|
|
$actionservice = $this->MS->create('service', $inputservice);
|
|
|
|
$datID = $this->MS->getDataItpID();
|
|
if (is_array($datID)||is_object($$datID)) {
|
|
$update = [
|
|
'ITP_ID' => $datID[0]['ID_ITP']
|
|
];
|
|
$datItp = $this->MS->getDataItpService();
|
|
$actionupdate = $this->MS->update('service', $update, 'ID_SERVICE',$datItp[0]['ID_SERVICE']);
|
|
}
|
|
|
|
if ($actionupdate) {
|
|
$this->session->set_flashdata('flash', 'ditambah');
|
|
redirect('ManageService');
|
|
} else {
|
|
$this->session->set_flashdata('flashgagal', 'ditambah');
|
|
redirect('ManageService');
|
|
}
|
|
|
|
}
|
|
|
|
public function hapus()
|
|
{
|
|
$id = $this->input->post('id');
|
|
if ($this->MS->delete('service', $id, 'ID_SERVICE')) {
|
|
$this->session->set_flashdata('flash', 'dihapus');
|
|
redirect('ManageService');
|
|
}
|
|
}
|
|
|
|
}
|