1336 lines
41 KiB
PHP
1336 lines
41 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', 'Service');
|
|
$this->load->model('ModelDashboard', 'Dashboard');
|
|
$this->load->model('AllModels', 'Amod');
|
|
$this->load->library(['datatables', 'form_validation']);
|
|
$this->form_validation->set_error_delimiters('', '');
|
|
$this->Dashboard->ceklogin();
|
|
}
|
|
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 dataSerahTerima_Service_A1() { // [1]
|
|
$datService = $this->Service->getData_Service_byID_status0();
|
|
$tgl = date('d/m/Y');
|
|
|
|
$no = 0;
|
|
foreach ($datService as $key) {
|
|
$datDfs = $this->Service->getData_DaftarService_bySERVICE($key['ID_SERVICE']);
|
|
$nodfs = 0;
|
|
foreach ($datDfs as $dat) {
|
|
$datSns = $this->Service->getData_SnService_byDFS($dat['ID_DFS']);
|
|
$datDfs[$nodfs++] += ['SN' => $datSns];
|
|
}
|
|
$datService[$no++] += ['BARANG' => $datDfs];
|
|
}
|
|
|
|
$data = [
|
|
'sidebar' => "menu service",
|
|
'navChild' => "service terima internal",
|
|
'service' => $datService,
|
|
'tgl' => $tgl
|
|
];
|
|
$this->load->view('proses/ServiceSerahTerima_Service_A1', $data);
|
|
}
|
|
|
|
public function revisiserah_SVA1() { // [2]
|
|
$id_service = $this->input->post('id_servicerev');
|
|
|
|
$datService = $this->Service->getData_Service_byID($id_service);
|
|
if ($datService==FALSE OR $datService[0]['STATUS_SERVICE']!=0) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$datDfs = $this->Service->getData_DaftarService_bySERVICE($id_service);
|
|
foreach ($datDfs as $key) {
|
|
$datKuantiti = $this->Service->getData_Kuantiti_byID($key['BARANG_ID']);
|
|
if ($datService[0]['JENIS_SERVICE']==0) {
|
|
$pcm_kuantiti = $datKuantiti[0]['PCM_KUANTITI'];
|
|
$proses_kuantiti = $datKuantiti[0]['PROSES_KUANTITI'];
|
|
$pcm = $pcm_kuantiti+$key['QTY_DFS'];
|
|
$proses = $proses_kuantiti-$key['QTY_DFS'];
|
|
$update = [
|
|
'PCM_KUANTITI' => $pcm,
|
|
'PROSES_KUANTITI' => $proses,
|
|
];
|
|
$action = $this->Service->update('kuantiti', $update, 'ID_KUANTITI', $key['BARANG_ID']);
|
|
} else if ($datService[0]['JENIS_SERVICE']==1) {
|
|
$itp_kuantiti = $datKuantiti[0]['ITP_KUANTITI'];
|
|
$proses_kuantiti = $datKuantiti[0]['PROSES_KUANTITI'];
|
|
$itp = $itp_kuantiti+$key['QTY_DFS'];
|
|
$proses = $proses_kuantiti-$key['QTY_DFS'];
|
|
$update = [
|
|
'ITP_KUANTITI' => $itp,
|
|
'PROSES_KUANTITI' => $proses,
|
|
];
|
|
$action = $this->Service->update('kuantiti', $update, 'ID_KUANTITI', $key['BARANG_ID']);
|
|
}
|
|
}
|
|
|
|
$update = [
|
|
'STATUS_SERVICE' => NULL
|
|
];
|
|
$action = $this->Service->update('service', $update, 'ID_SERVICE', $id_service);
|
|
|
|
if ($action) {
|
|
$this->session->set_flashdata('success', 'direvisi');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
} else {
|
|
$this->session->set_flashdata('failed', 'direvisi');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
}
|
|
|
|
public function kunciserah_SVA1() { // [3]
|
|
$id_service = $this->input->post('id_servicelock');
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$tgl = date('Y-m-d');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$datService = $this->Service->getData_Service_byID($id_service);
|
|
if ($datService==FALSE OR $datService[0]['STATUS_SERVICE']!=0) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$datDfs = $this->Service->getData_DaftarService_bySERVICE($id_service);
|
|
foreach ($datDfs as $key) {
|
|
$datKuantiti = $this->Service->getData_Kuantiti_byID($key['BARANG_ID']);
|
|
if ($datKuantiti[0]['PROSES_KUANTITI']<$key['QTY_DFS']) {
|
|
$this->session->set_flashdata('qtyproses_error', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
}
|
|
|
|
foreach ($datDfs as $key) {
|
|
$datKuantiti = $this->Service->getData_Kuantiti_byID($key['BARANG_ID']);
|
|
$service_kuantiti = $datKuantiti[0]['SERVICE_KUANTITI'];
|
|
$proses_kuantiti = $datKuantiti[0]['PROSES_KUANTITI'];
|
|
$service = $service_kuantiti+$key['QTY_DFS'];
|
|
$proses = $proses_kuantiti-$key['QTY_DFS'];
|
|
$update = [
|
|
'SERVICE_KUANTITI' => $service,
|
|
'PROSES_KUANTITI' => $proses,
|
|
];
|
|
$action = $this->Service->update('kuantiti', $update, 'ID_KUANTITI', $key['BARANG_ID']);
|
|
|
|
if ($key['TYPE_JENIS']==1) {
|
|
$datSns = $this->Service->getData_SnService_byDFS($key['ID_DFS']);
|
|
foreach ($datSns as $dat) {
|
|
$datSnStock = $this->Service->getData_SnStock_byNAMA_status17($dat['NAMA_SNS']);
|
|
if ($datSnStock==TRUE) {
|
|
$update = [
|
|
'STATUS_SNSTOCK' => '7'
|
|
];
|
|
$action = $this->Service->update('sn_stock', $update, 'ID_SNSTOCK', $datSnStock[0]['ID_SNSTOCK']);
|
|
}
|
|
}
|
|
}
|
|
|
|
if ($key['TYPE_JENIS']==0) {
|
|
$input = [
|
|
'TGL_NONSNS' => $tgl,
|
|
'KODE_BUKTI' => $datService[0]['KODE_SERVICE'],
|
|
'BARANG_ID' => $key['BARANG_ID'],
|
|
'MASUK_NONSNS' => $key['QTY_DFS'],
|
|
'KELUAR_NONSNS' => '0',
|
|
'PENERIMA_ID' => $id_karyawan
|
|
];
|
|
$action = $this->Service->create('nonsn_service', $input);
|
|
}
|
|
}
|
|
|
|
$update = [
|
|
'STATUS_SERVICE' => '1',
|
|
'TERIMA_SERVICE' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Service->update('service', $update, 'ID_SERVICE', $id_service);
|
|
|
|
if ($action) {
|
|
$this->session->set_flashdata('success', 'dikunci');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
} else {
|
|
$this->session->set_flashdata('failed', 'dikunci');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
}
|
|
|
|
public function dataSerahTerima_Service_B1() { // [4]
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$nama_panggilan = $this->session->userdata('nama_panggilan');
|
|
$datService = $this->Service->getData_SnService_byKARYAWAN_statusNull($id_karyawan);
|
|
$datPelanggan = $this->Service->getData_Pelanggan_byID();
|
|
$datUnitService = $this->Service->getData_UnitService_byID();
|
|
$datKota = $this->Service->getData_Kota_byID();
|
|
$datJenis = $this->Service->getData_Jenis_BIAYANot0();
|
|
$tgl = date('d/m/Y');
|
|
|
|
if ($datService==TRUE) {
|
|
$id_sns = $datService[0]['ID_SNS'];
|
|
$dataUnitService = $this->Service->getData_UnitService_byID($datService[0]['UNITSERVICE_ID']);
|
|
$serFull = $dataUnitService[0]['BIAYA_SERVICE'];
|
|
$serHalf = ($dataUnitService[0]['BIAYA_SERVICE']/2);
|
|
$serFull = number_format($dataUnitService[0]['BIAYA_SERVICE'],0);
|
|
$serHalf = number_format(($dataUnitService[0]['BIAYA_SERVICE']/2),0);
|
|
$serFull = str_replace(',', '.', $serFull);
|
|
$serHalf = str_replace(',', '.', $serHalf);
|
|
} else {
|
|
$id_sns = NULL;
|
|
$serFull = NULL;
|
|
$serHalf = NULL;
|
|
}
|
|
|
|
$data = [
|
|
'sidebar' => "menu service",
|
|
'navChild' => "service terima external",
|
|
'service' => $datService,
|
|
'karyawan' => $nama_panggilan,
|
|
'pelanggan' => $datPelanggan,
|
|
'unitservice' => $datUnitService,
|
|
'kota' => $datKota,
|
|
'jenis' => $datJenis,
|
|
'tgl' => $tgl,
|
|
'id_sns' => $id_sns,
|
|
'serFull' => $serFull,
|
|
'serHalf' => $serHalf
|
|
];
|
|
$this->load->view('proses/ServiceSerahTerima_Service_B1', $data);
|
|
}
|
|
|
|
public function kodeService() { // [5]
|
|
$kk = $this->Service->getKode_Service();
|
|
$tgl = date('y');
|
|
if (is_array($kk) || is_object($kk)) {
|
|
foreach ($kk as $row) {
|
|
if ($row['KODE'] == null) {
|
|
return "SRV".$tgl."00001";
|
|
} else {
|
|
$str = (string) $row['KODE'];
|
|
$tgl_lama = substr($str, 3, -5);
|
|
if ($tgl_lama!=$tgl) {
|
|
return "SRV".$tgl."00001";
|
|
} else {
|
|
$panjang = 5;
|
|
$data = substr($str, 5, $panjang);
|
|
$ko = (int) $data + 1;
|
|
$str = (string) $ko;
|
|
$panjang = 10 - strlen($str);
|
|
$data = "SRV".$tgl."00000";
|
|
$data = substr($data, 0, $panjang) . $str;
|
|
return $data;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
public function tambahservice_SVB1() { // [6]
|
|
$id_service = $this->input->post('id');
|
|
$id_pelanggan = $this->input->post('id_pelanggan');
|
|
$id_unitservice = $this->input->post('id_unitservice');
|
|
$nama_sns = $this->input->post('nama_sns');
|
|
$kel_sns = $this->input->post('kel_sns');
|
|
$part_sns = $this->input->post('part_sns');
|
|
$garansi_sns = $this->input->post('garansi_sns');
|
|
$id_kota = $this->input->post('id_kota');
|
|
$nama_pelanggan = $this->input->post('nama_pelanggan');
|
|
$telp_pelanggan = $this->input->post('telp_pelanggan');
|
|
$id_jenis = $this->input->post('id_jenis');
|
|
$nama_unitservice = $this->input->post('nama_unitservice');
|
|
$kode_service = $this->kodeService();
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$level = $this->session->userdata('level');
|
|
$tgl = date('Y-m-d');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$kel_sns = preg_replace('/\R+/', " " , $kel_sns);
|
|
$kel_sns = strtoupper($kel_sns);
|
|
$nama_sns = strtoupper($nama_sns);
|
|
|
|
if ($id_pelanggan=="") {
|
|
$nama_pelanggan = strtoupper($nama_pelanggan);
|
|
$datPelanggan = $this->Service->getData_Pelanggan_byNAMA_byKOTA($nama_pelanggan, $id_kota);
|
|
if ($datPelanggan==TRUE) {
|
|
$id_pelanggan = $datPelanggan[0]['ID_PELANGGAN'];
|
|
} else {
|
|
$input = [
|
|
'NAMA_PELANGGAN' => $nama_pelanggan,
|
|
'KOTA_ID' => $id_kota,
|
|
'TELP_PELANGGAN' => $telp_pelanggan,
|
|
'TAMBAH_PELANGGAN' => "Oleh $panggilan pada $timestamp",
|
|
'TYPE_PELANGGAN' => '2',
|
|
'TOP_PELANGGAN' => '0',
|
|
'KELOMPOK_ID' => '0',
|
|
'STATUS_PELANGGAN' => '1',
|
|
'ALIAS_PELANGGAN' => "",
|
|
'PIC_PELANGGAN' => "",
|
|
'ALAMAT_PELANGGAN' => "",
|
|
'KIRIM_PELANGGAN' => "",
|
|
'EMAIL_PELANGGAN' => "",
|
|
'NPWP_PELANGGAN' => "",
|
|
'JANGKA_PELANGGAN' => '60',
|
|
'LIMIT_PELANGGAN' => '25000000'
|
|
];
|
|
$action = $this->Service->create('pelanggan', $input);
|
|
|
|
$id_pelanggan = $this->Service->getID_PelangganMax();
|
|
$id_pelanggan = $id_pelanggan[0]['ID_PELANGGAN'];
|
|
}
|
|
}
|
|
|
|
if ($id_unitservice=="") {
|
|
$nama_unitservice = strtoupper($nama_unitservice);
|
|
$datUnitService = $this->Service->getData_UnitService_byNAMA_byJENIS($nama_unitservice, $id_jenis);
|
|
if ($datUnitService==TRUE) {
|
|
$id_unitservice = $datUnitService[0]['ID_UNITSERVICE'];
|
|
} else {
|
|
$input = [
|
|
'NAMA_UNITSERVICE' => $nama_unitservice,
|
|
'JENIS_ID' => $id_jenis,
|
|
];
|
|
$action = $this->Service->create('unitservice', $input);
|
|
|
|
$id_unitservice = $this->Service->getID_UnitServiceMax();
|
|
$id_unitservice = $id_unitservice[0]['ID_UNITSERVICE'];
|
|
}
|
|
}
|
|
|
|
$input = [
|
|
'KODE_SERVICE' => $kode_service,
|
|
'TGL_SERVICE' => $tgl,
|
|
'JENIS_SERVICE' => $level,
|
|
'PEMBUAT_ID' => $id_karyawan,
|
|
'PELANGGAN_ID' => $id_pelanggan
|
|
];
|
|
$action = $this->Service->create('service', $input);
|
|
|
|
$id_service = $this->Service->getID_ServiceMax();
|
|
$id_service = $id_service[0]['ID_SERVICE'];
|
|
|
|
$input = [
|
|
'SERVICE_ID' => $id_service,
|
|
'UNITSERVICE_ID' => $id_unitservice,
|
|
'NAMA_SNS' => $nama_sns,
|
|
'KEL_SNS' => $kel_sns,
|
|
'PART_SNS' => $part_sns,
|
|
'GARANSI_SNS' => $garansi_sns
|
|
];
|
|
$action = $this->Service->create('sn_service', $input);
|
|
|
|
if ($action) {
|
|
$value = true;
|
|
} else {
|
|
$value = false;
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
|
|
}
|
|
|
|
public function ubahservice_SVB1() { // [7]
|
|
$id_sns = $this->input->post('id_snsed');
|
|
$id_pelanggan = $this->input->post('id_pelangganed');
|
|
$id_unitservice = $this->input->post('id_unitserviceed');
|
|
$nama_sns = $this->input->post('nama_snsed');
|
|
$kel_sns = $this->input->post('kel_snsed');
|
|
$part_sns = $this->input->post('part_snsed');
|
|
$garansi_sns = $this->input->post('garansi_snsed');
|
|
$tgl = date('Y-m-d');
|
|
|
|
$datSns = $this->Service->getData_SnService_byID($id_sns);
|
|
if ($datSns==FALSE OR $datSns[0]['STATUS_SERVICE']!=NULL) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$kel_sns = preg_replace('/\R+/', " " , $kel_sns);
|
|
$kel_sns = strtoupper($kel_sns);
|
|
$nama_sns = strtoupper($nama_sns);
|
|
|
|
$update = [
|
|
'UNITSERVICE_ID' => $id_unitservice,
|
|
'NAMA_SNS' => $nama_sns,
|
|
'KEL_SNS' => $kel_sns,
|
|
'PART_SNS' => $part_sns,
|
|
'GARANSI_SNS' => $garansi_sns
|
|
];
|
|
$action = $this->Service->update('sn_service', $update, 'ID_SNS', $id_sns);
|
|
|
|
$update = [
|
|
'TGL_SERVICE' => $tgl,
|
|
'PELANGGAN_ID' => $id_pelanggan
|
|
];
|
|
$action = $this->Service->update('service', $update, 'ID_SERVICE', $datSns[0]['SERVICE_ID']);
|
|
|
|
if ($action) {
|
|
$this->session->set_flashdata('success', 'diubah');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
} else {
|
|
$this->session->set_flashdata('failed', 'diubah');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
}
|
|
|
|
public function cetakservice_SVB1() { // [8]
|
|
$id_sns = $this->input->post('id_sns');
|
|
|
|
$datSns = $this->Service->getData_SnService_byID($id_sns);
|
|
$datUnitService = $this->Service->getData_UnitService_byID($datSns[0]['UNITSERVICE_ID']);
|
|
$serFull = $datUnitService[0]['BIAYA_SERVICE'];
|
|
$serHalf = ($datUnitService[0]['BIAYA_SERVICE']/2);
|
|
$serFull = number_format($datUnitService[0]['BIAYA_SERVICE'],0);
|
|
$serHalf = number_format(($datUnitService[0]['BIAYA_SERVICE']/2),0);
|
|
$serFull = str_replace(',', '.', $serFull);
|
|
$serHalf = str_replace(',', '.', $serHalf);
|
|
|
|
$no = 0;
|
|
foreach ($datSns as $key) {
|
|
if ($key['GARANSI_SNS']==0) {
|
|
$status = "Warranty PCM";
|
|
} else if ($key['GARANSI_SNS']==1) {
|
|
$status = "Warranty NonPCM";
|
|
} else if ($key['GARANSI_SNS']==2) {
|
|
$status = "NonWarranty";
|
|
} else if ($key['GARANSI_SNS']==3) {
|
|
$status = "Warranty ITP";
|
|
}
|
|
$datSns[$no++] += ['STATUS' => $status];
|
|
}
|
|
|
|
$data = [
|
|
'title' => '',
|
|
'service' => $datSns,
|
|
'serFull' => $serFull,
|
|
'serHalf' => $serHalf,
|
|
];
|
|
$this->load->view('cetak/SJ_Service', $data);
|
|
}
|
|
|
|
public function batalservice_SVB1() { // [9]
|
|
$id_sns = $this->input->post('id_sns');
|
|
$ket_batal = $this->input->post('ket_batal');
|
|
|
|
$datSns = $this->Service->getData_SnService_byID($id_sns);
|
|
if ($datSns==FALSE OR $datSns[0]['STATUS_SERVICE']!=NULL) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$ket_batal = preg_replace('/\R+/', " " , $ket_batal);
|
|
|
|
$update = [
|
|
'STATUS_SNS' => '0',
|
|
];
|
|
$action = $this->Service->update('sn_service', $update, 'ID_SNS', $id_sns);
|
|
|
|
$update = [
|
|
'STATUS_SERVICE' => '9',
|
|
'KET_BATAL' => $ket_batal
|
|
];
|
|
$action = $this->Service->update('service', $update, 'ID_SERVICE', $datSns[0]['SERVICE_ID']);
|
|
|
|
if ($action) {
|
|
$this->session->set_flashdata('success', 'dibatalkan');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
} else {
|
|
$this->session->set_flashdata('failed', 'dibatalkan');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
}
|
|
|
|
public function prosesservice_SVB1() { // [10]
|
|
$id_sns = $this->input->post('id_sns');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$datSns = $this->Service->getData_SnService_byID($id_sns);
|
|
if ($datSns==FALSE OR $datSns[0]['STATUS_SERVICE']!=NULL) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$update = [
|
|
'STATUS_SERVICE' => '1',
|
|
'TERIMA_SERVICE' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Service->update('service', $update, 'ID_SERVICE', $datSns[0]['SERVICE_ID']);
|
|
|
|
if ($action) {
|
|
$this->session->set_flashdata('success', 'diproses');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
} else {
|
|
$this->session->set_flashdata('failed', 'diproses');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
}
|
|
|
|
public function dataCekUnit_Service_A1($id) { // [11]
|
|
$datService = $this->Service->getData_SnService_statusNull();
|
|
$tgl = date('d/m/Y');
|
|
|
|
$no = 0;
|
|
foreach ($datService as $key) {
|
|
$datHsv = $this->Service->getData_HistoriService_bySNS($key['ID_SNS']);
|
|
if ($datHsv==TRUE) {
|
|
$teknisi = $datHsv[count($datHsv)-1]['NAMA_PANGGILAN_KARYAWAN'];
|
|
$status = $datHsv[count($datHsv)-1]['STATUS_HSV'];
|
|
$tanggal = $datHsv[count($datHsv)-1]['TIMESTAMP'];
|
|
$detail = "$teknisi $tanggal";
|
|
} else {
|
|
$status = NULL;
|
|
$teknisi = "Belum dicek";
|
|
$detail = "$teknisi";
|
|
}
|
|
|
|
if ($id==1) {
|
|
if ($status==NULL) {
|
|
$datService[$no] += ['SHOW' => '1'];
|
|
} else {
|
|
$datService[$no] += ['SHOW' => '0'];
|
|
}
|
|
} else if ($id==2) {
|
|
if ($status>=2 AND $status<=6) {
|
|
$datService[$no] += ['SHOW' => '1'];
|
|
} else {
|
|
$datService[$no] += ['SHOW' => '0'];
|
|
}
|
|
} else if ($id==3) {
|
|
if ($status!=NULL AND $status!=2 AND $status!=3 AND $status!=4 AND $status!=5 AND $status!=6) {
|
|
$datService[$no] += ['SHOW' => '1'];
|
|
} else {
|
|
$datService[$no] += ['SHOW' => '0'];
|
|
}
|
|
}
|
|
|
|
$datService[$no] += ['DETAIL' => $detail];
|
|
$datService[$no++] += ['STATUS' => $status];
|
|
}
|
|
|
|
$data = [
|
|
'sidebar' => "menu service",
|
|
'navChild' => "service cek unit",
|
|
'service' => $datService,
|
|
'tgl' => $tgl,
|
|
'id' => $id,
|
|
];
|
|
$this->load->view('proses/ServiceCekUnit_Service_A1', $data);
|
|
}
|
|
|
|
public function dataCekUnit_Service_A2($id) { // [12]
|
|
$service = $this->Service->getData_HistoriService_bySNS($id);
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$datSns = $this->Service->getData_SnService_byID($id);
|
|
|
|
if ($service==FALSE) {
|
|
$lock = 1;
|
|
} else if ($service[count($service)-1]['TEKNISI_ID']==$id_karyawan) {
|
|
$lock = 0;
|
|
} else {
|
|
$lock = 1;
|
|
}
|
|
|
|
if ($datSns[0]['PELANGGAN_ID']==NULL) {
|
|
$kontak = $datSns[0]['PENERIMA'];
|
|
} else {
|
|
$kontak = $datSns[0]['NAMA_PELANGGAN'];
|
|
}
|
|
|
|
$data = [
|
|
'sidebar' => "menu service",
|
|
'navChild' => "service cek unit",
|
|
'service' => $service,
|
|
'nama_sns' => $datSns[0]['NAMA_SNS'],
|
|
'kontak' => $kontak,
|
|
'lock' => $lock,
|
|
'id_karyawan' => $id_karyawan,
|
|
'id_sns' => $id,
|
|
];
|
|
$this->load->view('proses/ServiceCekUnit_Service_A2', $data);
|
|
}
|
|
|
|
public function simpanjejak_SVA1() { // [13]
|
|
$id_hsv = $this->input->post('id');
|
|
$id_sns = $this->input->post('id_sns');
|
|
$status_hsv = $this->input->post('status_hsv');
|
|
$ket_hsv = $this->input->post('ket_hsv');
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$tgl = date('Y-m-d');
|
|
|
|
$datSns = $this->Service->getData_SnService_byID($id_sns);
|
|
if ($datSns==FALSE OR $datSns[0]['STATUS_SNS']!=NULL) {
|
|
$this->session->set_flashdata('not_valid', 'error');
|
|
redirect('ManageService/dataCekUnit_Service_A1');
|
|
}
|
|
|
|
$ket_hsv = preg_replace('/\R+/', " " , $ket_hsv);
|
|
|
|
$input = [
|
|
'TGL_HSV' => $tgl,
|
|
'SNS_ID' => $id_sns,
|
|
'TEKNISI_ID' => $id_karyawan,
|
|
'KET_HSV' => $ket_hsv,
|
|
'STATUS_HSV' => $status_hsv,
|
|
];
|
|
$action = $this->Service->create('histori_service', $input);
|
|
|
|
if ($action) {
|
|
$this->session->set_flashdata('success', 'ditambah');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
} else {
|
|
$this->session->set_flashdata('failed', 'ditambah');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
}
|
|
|
|
public function ubahjejak_SVA1() { // [14]
|
|
$id_hsv = $this->input->post('id_hsved');
|
|
$id_sns = $this->input->post('id_snsed');
|
|
$status_hsv = $this->input->post('status_hsved');
|
|
$ket_hsv = $this->input->post('ket_hsved');
|
|
$tgl = date('Y-m-d');
|
|
|
|
$datSns = $this->Service->getData_SnService_byID($id_sns);
|
|
if ($datSns==FALSE OR $datSns[0]['STATUS_SNS']!=NULL) {
|
|
$this->session->set_flashdata('not_valid', 'error');
|
|
redirect('ManageService/dataCekUnit_Service_A1');
|
|
}
|
|
|
|
$ket_hsv = preg_replace('/\R+/', " " , $ket_hsv);
|
|
|
|
$update = [
|
|
'TGL_HSV' => $tgl,
|
|
'KET_HSV' => $ket_hsv,
|
|
'STATUS_HSV' => $status_hsv,
|
|
];
|
|
$action = $this->Service->update('histori_service', $update, 'ID_HSV', $id_hsv);
|
|
|
|
if ($action) {
|
|
$this->session->set_flashdata('success', 'diubah');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
} else {
|
|
$this->session->set_flashdata('failed', 'diubah');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
}
|
|
|
|
public function hapusjejak_SVA1() { // [15]
|
|
$id_hsv = $this->input->post('id_hsvdel');
|
|
$id_sns = $this->input->post('id_snsdel');
|
|
$tgl = date('Y-m-d');
|
|
|
|
$datSns = $this->Service->getData_SnService_byID($id_sns);
|
|
if ($datSns==FALSE OR $datSns[0]['STATUS_SNS']!=NULL) {
|
|
$this->session->set_flashdata('not_valid', 'error');
|
|
redirect('ManageService/dataCekUnit_Service_A1');
|
|
}
|
|
|
|
$action = $this->Service->delete('histori_service', $id_hsv, 'ID_HSV');
|
|
|
|
if ($action) {
|
|
$this->session->set_flashdata('success', 'dihapus');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
} else {
|
|
$this->session->set_flashdata('failed', 'dihapus');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
}
|
|
|
|
public function dataUbahUnit_Service_A1() { // [16]
|
|
$datService = $this->Service->getData_SnService_statusNull();
|
|
$datSnsGudang = $this->Service->getData_SnService_statusNull_fromGudang();
|
|
$datSnsPelanggan = $this->Service->getData_SnService_statusNull_fromPelanggan();
|
|
$datSnsRetur = $this->Service->getData_SnService_status1();
|
|
$datSo = $this->Service->getData_SalesOrder_byADMINSERVICE_status1();
|
|
$tgl = date('d/m/Y');
|
|
|
|
$no = 0;
|
|
$countData = 0;
|
|
foreach ($datService as $key) {
|
|
$datHsv = $this->Service->getData_HistoriService_bySNS($key['ID_SNS']);
|
|
if ($datHsv==TRUE) {
|
|
$teknisi = $datHsv[count($datHsv)-1]['NAMA_PANGGILAN_KARYAWAN'];
|
|
$status = $datHsv[count($datHsv)-1]['STATUS_HSV'];
|
|
$tanggal = $datHsv[count($datHsv)-1]['TIMESTAMP'];
|
|
$detail = "$teknisi $tanggal";
|
|
} else {
|
|
$countData++;
|
|
$status = NULL;
|
|
$teknisi = "Belum dicek";
|
|
$detail = "$teknisi";
|
|
}
|
|
$datService[$no] += ['DETAIL' => $detail];
|
|
$datService[$no++] += ['STATUS' => $status];
|
|
}
|
|
|
|
$data = [
|
|
'sidebar' => "menu service",
|
|
'navChild' => "service ubah unit",
|
|
'service' => $datService,
|
|
'snsgud' => $datSnsGudang,
|
|
'snspel' => $datSnsPelanggan,
|
|
'snsret' => $datSnsRetur,
|
|
'so' => $datSo,
|
|
'tgl' => $tgl,
|
|
'countData' => $countData,
|
|
];
|
|
$this->load->view('proses/ServiceUbahUnit_Service_A1', $data);
|
|
}
|
|
|
|
public function batalservice_SVA1() { // [17]
|
|
$id_sns = $this->input->post('id_sns');
|
|
$id_so = $this->input->post('id_so');
|
|
$ket_batal = $this->input->post('ket_batal');
|
|
$tgl = date('Y-m-d');
|
|
|
|
$datSns = $this->Service->getData_SnService_byID($id_sns);
|
|
if ($datSns==FALSE OR $datSns[0]['STATUS_SNS']!=NULL) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
if ($id_so!="") {
|
|
$datSo = $this->Service->getData_SalesOrder_byID($id_so);
|
|
if ($datSo==FALSE OR $datSo[0]['STATUS_SO']!="1") {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
}
|
|
|
|
$ket_batal = preg_replace('/\R+/', " " , $ket_batal);
|
|
|
|
if ($id_so=="") {
|
|
$update = [
|
|
'STATUS_SNS' => '0',
|
|
'TGL_SNS' => $tgl,
|
|
];
|
|
$action = $this->Service->update('sn_service', $update, 'ID_SNS', $id_sns);
|
|
} else {
|
|
$update = [
|
|
'STATUS_SNS' => '0',
|
|
'SO_ID' => $id_so,
|
|
'TGL_SNS' => $tgl,
|
|
];
|
|
$action = $this->Service->update('sn_service', $update, 'ID_SNS', $id_sns);
|
|
}
|
|
|
|
$update = [
|
|
'STATUS_SERVICE' => '9',
|
|
'KET_BATAL' => $ket_batal
|
|
];
|
|
$action = $this->Service->update('service', $update, 'ID_SERVICE', $datSns[0]['SERVICE_ID']);
|
|
|
|
if ($action) {
|
|
$this->session->set_flashdata('success', 'dibatalkan');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
} else {
|
|
$this->session->set_flashdata('failed', 'dibatalkan');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
}
|
|
|
|
public function kembalikanuser_SVA1() { // [18]
|
|
$snsserah = $this->input->post('snsserah');
|
|
$id_so = $this->input->post('id_so');
|
|
$tgl = date('Y-m-d');
|
|
|
|
foreach ($snsserah as $key) {
|
|
$datSns = $this->Service->getData_SnService_byID($key);
|
|
if ($datSns==FALSE OR $datSns[0]['STATUS_SNS']!=NULL) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
if ($id_so=="" AND $datSns[0]['GARANSI_SNS']>0 AND $datSns[0]['GARANSI_SNS']<3) {
|
|
$this->session->set_flashdata('non-warranty-error', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
}
|
|
|
|
if ($id_so!="") {
|
|
$datSo = $this->Service->getData_SalesOrder_byID($id_so);
|
|
if ($datSo==FALSE OR $datSo[0]['STATUS_SO']!="1") {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
}
|
|
|
|
if ($id_so=="") {
|
|
foreach ($snsserah as $key) {
|
|
$update = [
|
|
'STATUS_SNS' => '1',
|
|
'TGL_SNS' => $tgl,
|
|
];
|
|
$action = $this->Service->update('sn_service', $update, 'ID_SNS', $key);
|
|
}
|
|
} else {
|
|
foreach ($snsserah as $key) {
|
|
$update = [
|
|
'STATUS_SNS' => '1',
|
|
'SO_ID' => $id_so,
|
|
'TGL_SNS' => $tgl,
|
|
];
|
|
$action = $this->Service->update('sn_service', $update, 'ID_SNS', $key);
|
|
}
|
|
}
|
|
|
|
if ($action) {
|
|
$this->session->set_flashdata('success', 'dikembalikan');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
} else {
|
|
$this->session->set_flashdata('failed', 'dikembalikan');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
}
|
|
|
|
public function kembalikangudang_SVA1() { // [19]
|
|
$sns = $this->input->post('snskembaligudang');
|
|
$tgl = date('Y-m-d');
|
|
|
|
foreach ($sns as $key) {
|
|
$datSns = $this->Service->getData_SnService_byID($key);
|
|
if ($datSns==FALSE OR $datSns[0]['STATUS_SNS']!=NULL OR $datSns[0]['PSV_ID']!=NULL) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
}
|
|
|
|
foreach ($sns as $key) {
|
|
$update = [
|
|
'STATUS_SNS' => '2',
|
|
'TGL_SNS' => $tgl,
|
|
];
|
|
$action = $this->Service->update('sn_service', $update, 'ID_SNS', $key);
|
|
}
|
|
|
|
if ($action) {
|
|
$this->session->set_flashdata('success', 'dipindah');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
} else {
|
|
$this->session->set_flashdata('failed', 'dipindah');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
}
|
|
|
|
public function returservice_SVA1() { // [20]
|
|
$id_sns = $this->input->post('id_sns');
|
|
$ket_hsv = $this->input->post('ket_hsv');
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$tgl = date('Y-m-d');
|
|
|
|
$datSns = $this->Service->getData_SnService_byID($id_sns);
|
|
if ($datSns==FALSE OR $datSns[0]['STATUS_SNS']!="1") {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$update = [
|
|
'STATUS_SNS' => NULL,
|
|
'TGL_SNS' => NULL,
|
|
'SO_ID' => NULL,
|
|
];
|
|
$action = $this->Service->update('sn_service', $update, 'ID_SNS', $id_sns);
|
|
|
|
$ket_hsv = preg_replace('/\R+/', " " , $ket_hsv);
|
|
$input = [
|
|
'TGL_HSV' => $tgl,
|
|
'SNS_ID' => $id_sns,
|
|
'TEKNISI_ID' => $id_karyawan,
|
|
'KET_HSV' => $ket_hsv,
|
|
'STATUS_HSV' => '2',
|
|
];
|
|
$action = $this->Service->create('histori_service', $input);
|
|
|
|
if ($action) {
|
|
$this->session->set_flashdata('success', 'kembali service');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
} else {
|
|
$this->session->set_flashdata('failed', 'kembali service');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
}
|
|
|
|
public function dataUbahUnit_Service_A2($id) { // [21]
|
|
$service = $this->Service->getData_HistoriService_bySNS($id);
|
|
$datSns = $this->Service->getData_SnService_byID($id);
|
|
|
|
if ($datSns[0]['PELANGGAN_ID']==NULL) {
|
|
$kontak = $datSns[0]['PENERIMA'];
|
|
} else {
|
|
$kontak = $datSns[0]['NAMA_PELANGGAN'];
|
|
}
|
|
|
|
$data = [
|
|
'sidebar' => "menu service",
|
|
'navChild' => "service ubah unit",
|
|
'service' => $service,
|
|
'nama_sns' => $datSns[0]['NAMA_SNS'],
|
|
'kontak' => $kontak,
|
|
];
|
|
$this->load->view('proses/ServiceUbahUnit_Service_A2', $data);
|
|
}
|
|
|
|
public function dataUbahUnit_Service_R1() { // [22]
|
|
$datService = $this->Service->getData_SnService_allStatus_allSource();
|
|
$tgl = date('d/m/Y');
|
|
|
|
$data = [
|
|
'sidebar' => "menu service",
|
|
'navChild' => "service ubah unit",
|
|
'service' => $datService,
|
|
'tgl' => $tgl,
|
|
];
|
|
$this->load->view('proses/ServiceUbahUnit_Service_R1', $data);
|
|
}
|
|
|
|
public function dataKembaliGudang_Service_A1() { // [23]
|
|
$datService = $this->Service->getData_SnService_status2_PSVNull();
|
|
$tgl = date('d/m/Y');
|
|
|
|
$data = [
|
|
'sidebar' => "menu service",
|
|
'navChild' => "service pengembalian Sn",
|
|
'service' => $datService,
|
|
'tgl' => $tgl,
|
|
];
|
|
$this->load->view('proses/ServiceKembaliGudang_Service_A1', $data);
|
|
}
|
|
|
|
public function kembaliservice_SVA1() { // [24]
|
|
$id_sns = $this->input->post('id_sns');
|
|
$ket_hsv = $this->input->post('ket_hsv');
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$tgl = date('Y-m-d');
|
|
|
|
$datSns = $this->Service->getData_SnService_byID($id_sns);
|
|
if ($datSns==FALSE OR $datSns[0]['STATUS_SNS']!="2" OR $datSns[0]['PSV_ID']!=NULL) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$update = [
|
|
'STATUS_SNS' => NULL,
|
|
];
|
|
$action = $this->Service->update('sn_service', $update, 'ID_SNS', $id_sns);
|
|
|
|
$ket_hsv = preg_replace('/\R+/', " " , $ket_hsv);
|
|
$input = [
|
|
'TGL_HSV' => $tgl,
|
|
'SNS_ID' => $id_sns,
|
|
'TEKNISI_ID' => $id_karyawan,
|
|
'KET_HSV' => $ket_hsv,
|
|
'STATUS_HSV' => '2',
|
|
];
|
|
$action = $this->Service->create('histori_service', $input);
|
|
|
|
if ($action) {
|
|
$this->session->set_flashdata('success', 'kembali service');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
} else {
|
|
$this->session->set_flashdata('failed', 'kembali service');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
}
|
|
|
|
public function dataKembaliGudang_Service_B1() { // [25]
|
|
$datService = $this->Service->getData_NonSnService_groupBARANG();
|
|
$tgl = date('d/m/Y');
|
|
|
|
$data = [
|
|
'sidebar' => "menu service",
|
|
'navChild' => "service pengembalian NonSn",
|
|
'service' => $datService,
|
|
'tgl' => $tgl,
|
|
];
|
|
$this->load->view('proses/ServiceKembaliGudang_Service_B1', $data);
|
|
}
|
|
|
|
public function dataKembaliGudang_Service_B2($id) { // [26]
|
|
$service = $this->Service->getData_NonSnService_byBARANG($id);
|
|
$datBarang = $this->Service->getData_Barang_byID($id);
|
|
|
|
$data = [
|
|
'sidebar' => "menu service",
|
|
'navChild' => "service pengembalian NonSn",
|
|
'service' => $service,
|
|
'kode_barang' => $datBarang[0]['KODE_BARANG'],
|
|
];
|
|
$this->load->view('proses/ServiceKembaliGudang_Service_B2', $data);
|
|
}
|
|
|
|
public function dataCetakUlang_Service_A1() { // [27]
|
|
$datService = $this->Service->getData_SnService_PELANGGANNull_allStatus();
|
|
$tgl = date('d/m/Y');
|
|
|
|
$data = [
|
|
'sidebar' => "menu service",
|
|
'navChild' => "service cetakulang",
|
|
'service' => $datService,
|
|
'tgl' => $tgl,
|
|
];
|
|
$this->load->view('proses/ServiceCetakUlang_Service_A1', $data);
|
|
}
|
|
|
|
public function cetakulang_SVA1($id_sns) { // [28]
|
|
$datSns = $this->Service->getData_SnService_byID($id_sns);
|
|
$datUnitService = $this->Service->getData_UnitService_byID($datSns[0]['UNITSERVICE_ID']);
|
|
$serFull = $datUnitService[0]['BIAYA_SERVICE'];
|
|
$serHalf = ($datUnitService[0]['BIAYA_SERVICE']/2);
|
|
$serFull = number_format($datUnitService[0]['BIAYA_SERVICE'],0);
|
|
$serHalf = number_format(($datUnitService[0]['BIAYA_SERVICE']/2),0);
|
|
$serFull = str_replace(',', '.', $serFull);
|
|
$serHalf = str_replace(',', '.', $serHalf);
|
|
|
|
$no = 0;
|
|
foreach ($datSns as $key) {
|
|
if ($key['GARANSI_SNS']==0) {
|
|
$status = "Warranty PCM";
|
|
} else if ($key['GARANSI_SNS']==1) {
|
|
$status = "Warranty NonPCM";
|
|
} else if ($key['GARANSI_SNS']==2) {
|
|
$status = "NonWarranty";
|
|
} else if ($key['GARANSI_SNS']==3) {
|
|
$status = "Warranty ITP";
|
|
}
|
|
$datSns[$no++] += ['STATUS' => $status];
|
|
}
|
|
|
|
$data = [
|
|
'title' => '',
|
|
'service' => $datSns,
|
|
'serFull' => $serFull,
|
|
'serHalf' => $serHalf,
|
|
];
|
|
$this->load->view('cetak/SJ_Service', $data);
|
|
}
|
|
|
|
public function dataKlaim_Service_A1() { // [29]
|
|
$service = $this->Service->getData_KlaimService_Null();
|
|
$datService = $this->Service->getData_SnService_allStatus_allSource();
|
|
$datServiceCenter = $this->Service->getData_ServiceCenter_byID();
|
|
$datKsv = $this->Service->getData_KlaimService_NotNull();
|
|
$datSnPinjam = $this->Service->getData_SnPinjam_allStatus_allSource();
|
|
$tgl = date('Y-m-d');
|
|
|
|
$data = [
|
|
'sidebar' => "menu service",
|
|
'navChild' => "service klaim",
|
|
'service' => $service,
|
|
'datasv' => $datService,
|
|
'snp' => $datSnPinjam,
|
|
'srvcen' => $datServiceCenter,
|
|
'ksv' => $datKsv,
|
|
'tgl' => $tgl,
|
|
];
|
|
$this->load->view('proses/ServiceKlaim_Service_A1', $data);
|
|
}
|
|
|
|
public function simpanklaim_SVA1() { // [30]
|
|
$id_ksv = $this->input->post('id');
|
|
$id_sns = $this->input->post('id_sns');
|
|
$tgl_ksv = $this->input->post('tgl_ksv');
|
|
$no_ksv = $this->input->post('no_ksv');
|
|
$id_servicecenter = $this->input->post('id_servicecenter');
|
|
$tgl = date('Y-m-d');
|
|
|
|
if (strtotime($tgl_ksv) > strtotime($tgl)) {
|
|
$this->session->set_flashdata('date_error', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$no_ksv = strtoupper($no_ksv);
|
|
$input = [
|
|
'TGL_KSV' => $tgl_ksv,
|
|
'SNS_ID' => $id_sns,
|
|
'NO_KSV' => $no_ksv,
|
|
'SERVICECENTER_ID' => $id_servicecenter,
|
|
];
|
|
$action = $this->Service->create('klaim_service', $input);
|
|
|
|
if ($action) {
|
|
$this->session->set_flashdata('success', 'ditambah');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
} else {
|
|
$this->session->set_flashdata('failed', 'ditambah');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
}
|
|
|
|
public function simpanklaimpinjam_SVA1() { // [37]
|
|
$id_ksv = $this->input->post('id');
|
|
$id_snp = $this->input->post('id_snp');
|
|
$tgl_ksv = $this->input->post('tgl_ksv');
|
|
$no_ksv = $this->input->post('no_ksv');
|
|
$kel_ksv = $this->input->post('kel_ksv');
|
|
$id_servicecenter = $this->input->post('id_servicecenter');
|
|
$tgl = date('Y-m-d');
|
|
|
|
if (strtotime($tgl_ksv) > strtotime($tgl)) {
|
|
$this->session->set_flashdata('date_error', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$kel_ksv = preg_replace('/\R+/', " " , $kel_ksv);
|
|
$no_ksv = strtoupper($no_ksv);
|
|
$kel_ksv = strtoupper($kel_ksv);
|
|
$input = [
|
|
'TGL_KSV' => $tgl_ksv,
|
|
'SNP_ID' => $id_snp,
|
|
'NO_KSV' => $no_ksv,
|
|
'KEL_KSV' => $kel_ksv,
|
|
'SERVICECENTER_ID' => $id_servicecenter,
|
|
];
|
|
$action = $this->Service->create('klaim_service', $input);
|
|
|
|
if ($action) {
|
|
$this->session->set_flashdata('success', 'ditambah');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
} else {
|
|
$this->session->set_flashdata('failed', 'ditambah');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
}
|
|
|
|
public function ubahklaim_SVA1() { // [31]
|
|
$id_ksv = $this->input->post('id_ksved');
|
|
$id_sns = $this->input->post('id_snsed');
|
|
$tgl_ksv = $this->input->post('tgl_ksved');
|
|
$no_ksv = $this->input->post('no_ksved');
|
|
$id_servicecenter = $this->input->post('id_servicecentered');
|
|
$tgl = date('Y-m-d');
|
|
|
|
if (strtotime($tgl_ksv) > strtotime($tgl)) {
|
|
$this->session->set_flashdata('date_error', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$datKsv = $this->Service->getData_KlaimService_byID($id_ksv);
|
|
if ($datKsv==FALSE OR $datKsv[0]['STATUS_KSV']!=NULL) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$update = [
|
|
'TGL_KSV' => $tgl_ksv,
|
|
'SNS_ID' => $id_sns,
|
|
'NO_KSV' => $no_ksv,
|
|
'SERVICECENTER_ID' => $id_servicecenter
|
|
];
|
|
$action = $this->Service->update('klaim_service', $update, 'ID_KSV', $id_ksv);
|
|
|
|
if ($action) {
|
|
$this->session->set_flashdata('success', 'diubah');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
} else {
|
|
$this->session->set_flashdata('failed', 'diubah');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
}
|
|
|
|
public function ubahklaimpinjam_SVA1() { // [38]
|
|
$id_ksv = $this->input->post('id_ksvedpin');
|
|
$id_snp = $this->input->post('id_snpedpin');
|
|
$tgl_ksv = $this->input->post('tgl_ksvedpin');
|
|
$no_ksv = $this->input->post('no_ksvedpin');
|
|
$kel_ksv = $this->input->post('kel_ksvedpin');
|
|
$id_servicecenter = $this->input->post('id_servicecenteredpin');
|
|
$tgl = date('Y-m-d');
|
|
|
|
if (strtotime($tgl_ksv) > strtotime($tgl)) {
|
|
$this->session->set_flashdata('date_error', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$datKsv = $this->Service->getData_KlaimService_byID($id_ksv);
|
|
if ($datKsv==FALSE OR $datKsv[0]['STATUS_KSV']!=NULL) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$kel_ksv = preg_replace('/\R+/', " " , $kel_ksv);
|
|
$no_ksv = strtoupper($no_ksv);
|
|
$kel_ksv = strtoupper($kel_ksv);
|
|
$update = [
|
|
'TGL_KSV' => $tgl_ksv,
|
|
'SNP_ID' => $id_snp,
|
|
'NO_KSV' => $no_ksv,
|
|
'KEL_KSV' => $kel_ksv,
|
|
'SERVICECENTER_ID' => $id_servicecenter
|
|
];
|
|
$action = $this->Service->update('klaim_service', $update, 'ID_KSV', $id_ksv);
|
|
|
|
if ($action) {
|
|
$this->session->set_flashdata('success', 'diubah');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
} else {
|
|
$this->session->set_flashdata('failed', 'diubah');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
}
|
|
|
|
public function kunciklaim_SVA1() { // [32]
|
|
$id_ksv = $this->input->post('id_ksvlock');
|
|
$status_ksv = $this->input->post('status_ksv');
|
|
$ket_ksv = $this->input->post('ket_ksv');
|
|
|
|
$datKsv = $this->Service->getData_KlaimService_byID($id_ksv);
|
|
if ($datKsv == FALSE OR $datKsv[0]['STATUS_KSV']!=NULL) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$update = [
|
|
'STATUS_KSV' => $status_ksv,
|
|
'KET_KSV' => $ket_ksv
|
|
];
|
|
$action = $this->Service->update('klaim_service', $update, 'ID_KSV', $id_ksv);
|
|
|
|
if ($action) {
|
|
$this->session->set_flashdata('success', 'dikunci');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
} else {
|
|
$this->session->set_flashdata('failed', 'dikunci');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
}
|
|
|
|
public function kembaliklaim_SVA1() { // [33]
|
|
$id_ksv = $this->input->post('id_ksv');
|
|
|
|
$datKsv = $this->Service->getData_KlaimService_byID($id_ksv);
|
|
if ($datKsv == FALSE OR $datKsv[0]['STATUS_KSV']==NULL) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$update = [
|
|
'STATUS_KSV' => NULL,
|
|
'KET_KSV' => NULL
|
|
];
|
|
$action = $this->Service->update('klaim_service', $update, 'ID_KSV', $id_ksv);
|
|
|
|
if ($action) {
|
|
$this->session->set_flashdata('success', 'dikembalikan');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
} else {
|
|
$this->session->set_flashdata('failed', 'dikembalikan');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
}
|
|
|
|
public function dataKlaim_Service_B1() { // [34]
|
|
$service = $this->Service->getData_KlaimService_AllStatus();
|
|
$tgl = date('d/m/Y');
|
|
|
|
$data = [
|
|
'sidebar' => "menu service",
|
|
'navChild' => "service klaim",
|
|
'service' => $service,
|
|
'tgl' => $tgl,
|
|
];
|
|
$this->load->view('proses/ServiceKlaim_Service_B1', $data);
|
|
}
|
|
|
|
public function dataUbahUnit_Service_B1() { // [35]
|
|
$datService = $this->Service->getData_SnService_statusNull();
|
|
$datSnsGudang = $this->Service->getData_SnService_statusNull_fromGudang();
|
|
$datSnsPelanggan = $this->Service->getData_SnService_statusNull_fromPelanggan();
|
|
$datSnsRetur = $this->Service->getData_SnService_status1();
|
|
$datSo = $this->Service->getData_SalesOrder_byADMINSERVICE_status1();
|
|
$tgl = date('d/m/Y');
|
|
|
|
$no = 0;
|
|
$countData = 0;
|
|
foreach ($datService as $key) {
|
|
$datHsv = $this->Service->getData_HistoriService_bySNS($key['ID_SNS']);
|
|
if ($datHsv==TRUE) {
|
|
$teknisi = $datHsv[count($datHsv)-1]['NAMA_PANGGILAN_KARYAWAN'];
|
|
$status = $datHsv[count($datHsv)-1]['STATUS_HSV'];
|
|
$tanggal = $datHsv[count($datHsv)-1]['TIMESTAMP'];
|
|
$detail = "$teknisi $tanggal";
|
|
} else {
|
|
$status = NULL;
|
|
$teknisi = "Belum dicek";
|
|
$detail = "$teknisi";
|
|
}
|
|
$datService[$no] += ['DETAIL' => $detail];
|
|
$datService[$no++] += ['STATUS' => $status];
|
|
|
|
if ($status>=2 AND $status<=6) {
|
|
$countData++;
|
|
}
|
|
}
|
|
|
|
$data = [
|
|
'sidebar' => "menu service",
|
|
'navChild' => "service ubah unit",
|
|
'service' => $datService,
|
|
'snsgud' => $datSnsGudang,
|
|
'snspel' => $datSnsPelanggan,
|
|
'snsret' => $datSnsRetur,
|
|
'so' => $datSo,
|
|
'tgl' => $tgl,
|
|
'countData' => $countData,
|
|
];
|
|
$this->load->view('proses/ServiceUbahUnit_Service_B1', $data);
|
|
}
|
|
|
|
public function dataUbahUnit_Service_C1() { // [36]
|
|
$datService = $this->Service->getData_SnService_statusNull();
|
|
$datSnsGudang = $this->Service->getData_SnService_statusNull_fromGudang();
|
|
$datSnsPelanggan = $this->Service->getData_SnService_statusNull_fromPelanggan();
|
|
$datSnsRetur = $this->Service->getData_SnService_status1();
|
|
$datSo = $this->Service->getData_SalesOrder_byADMINSERVICE_status1();
|
|
$tgl = date('d/m/Y');
|
|
|
|
$no = 0;
|
|
$countData = 0;
|
|
foreach ($datService as $key) {
|
|
$datHsv = $this->Service->getData_HistoriService_bySNS($key['ID_SNS']);
|
|
if ($datHsv==TRUE) {
|
|
$teknisi = $datHsv[count($datHsv)-1]['NAMA_PANGGILAN_KARYAWAN'];
|
|
$status = $datHsv[count($datHsv)-1]['STATUS_HSV'];
|
|
$tanggal = $datHsv[count($datHsv)-1]['TIMESTAMP'];
|
|
$detail = "$teknisi $tanggal";
|
|
} else {
|
|
$status = NULL;
|
|
$teknisi = "Belum dicek";
|
|
$detail = "$teknisi";
|
|
}
|
|
$datService[$no] += ['DETAIL' => $detail];
|
|
$datService[$no++] += ['STATUS' => $status];
|
|
|
|
if ($status!=NULL AND $status!=2 AND $status!=3 AND $status!=4 AND $status!=5 AND $status!=6) {
|
|
$countData++;
|
|
}
|
|
}
|
|
|
|
$data = [
|
|
'sidebar' => "menu service",
|
|
'navChild' => "service ubah unit",
|
|
'service' => $datService,
|
|
'snsgud' => $datSnsGudang,
|
|
'snspel' => $datSnsPelanggan,
|
|
'snsret' => $datSnsRetur,
|
|
'so' => $datSo,
|
|
'tgl' => $tgl,
|
|
'countData' => $countData,
|
|
];
|
|
$this->load->view('proses/ServiceUbahUnit_Service_C1', $data);
|
|
}
|
|
|
|
}
|