88 lines
2.5 KiB
PHP
88 lines
2.5 KiB
PHP
<?php
|
|
defined('BASEPATH') or exit('No direct script access allowed');
|
|
|
|
class ManageCheck extends CI_Controller
|
|
{
|
|
function __construct()
|
|
{
|
|
parent::__construct();
|
|
$this->load->model('ModelProgress', 'MP');
|
|
$this->load->model('ModelService', 'MS');
|
|
$this->load->model('ModelOperator', 'MO');
|
|
$this->load->model('ModelTeknisi', 'MT');
|
|
$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()
|
|
{
|
|
|
|
$datCheck = $this->MP->getViewCheck();
|
|
$datProgress = $this->MP->getDataProgress();
|
|
$datService = $this->MS->getDataService();
|
|
$datTeknisi = $this->MT->getDataTeknisi();
|
|
|
|
$data = [
|
|
'sidebar' => "data pengerjaan service",
|
|
'navChild' => "data pengerjaan check",
|
|
'check' => $datCheck,
|
|
'progress' => $datProgress,
|
|
'service' => $datService,
|
|
'teknisi' => $datTeknisi
|
|
];
|
|
|
|
$this->load->view('master/Check', $data);
|
|
}
|
|
|
|
public function edit()
|
|
{
|
|
$method = $this->input->post('method');
|
|
$id_progress = $this->input->post('id_progress');
|
|
$id_teknisi = $this->input->post('id_teknisied');
|
|
$status_progress = $this->input->post('status_progressed');
|
|
$kerusakan_progress = $this->input->post('kerusakan_progressed');
|
|
|
|
$updateprogress = [
|
|
'TEKNISI_ID' => $id_teknisi,
|
|
'STATUS_PROGRESS' => $status_progress,
|
|
'KERUSAKAN_PROGRESS' => $kerusakan_progress,
|
|
'CHECK_PROGRESS' => date('Y-m-d H:i:s')
|
|
];
|
|
|
|
$actionprogress = $this->MP->update('progress', $updateprogress,'ID_PROGRESS',$id_progress);
|
|
|
|
if ($status_progress=="Claim Garansi") {
|
|
$datGID = $this->MS->getGaransiID($id_progress);
|
|
|
|
if ($datGID[0]['GARANSI_ID'] == null) {
|
|
$inputgaransi = [
|
|
'STATUS_GARANSI' => "Belum Proses"
|
|
];
|
|
|
|
$actiongaransi = $this->MS->create('garansi', $inputgaransi);
|
|
$datIDG = $this->MS->getIDGaransi();
|
|
if (is_array($datIDG)||is_object($$datIDG)) {
|
|
$inputprogress = [
|
|
'GARANSI_ID' => $datIDG[0]['ID_GARANSI']
|
|
];
|
|
|
|
$updateprogress2 = $this->MS->update('progress', $inputprogress, 'ID_PROGRESS',$id_progress);
|
|
}
|
|
}
|
|
}
|
|
|
|
if ($actionprogress) {
|
|
$this->session->set_flashdata('flash', 'diproses');
|
|
redirect('ManageCheck');
|
|
} else {
|
|
$this->session->set_flashdata('flashgagal', 'diproses');
|
|
redirect('ManageCheck');
|
|
}
|
|
}
|
|
|
|
}
|