copy dari repo om Irfan
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
require APPPATH . 'libraries/REST_Controller.php';
|
||||
require APPPATH . 'libraries/Format.php';
|
||||
|
||||
class Accounting extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->ceklogin();
|
||||
$this->load->model('LoginModel', 'LoginM');
|
||||
$this->load->model('AbsensiModel', 'AbsensiM');
|
||||
$this->load->model('ModelPembelian', 'MP');
|
||||
$this->load->model('ModelSetData', 'Setdata');
|
||||
}
|
||||
public function output_json($data, $encode = true)
|
||||
{
|
||||
if ($encode) $data = json_encode($data);
|
||||
$this->output->set_content_type('application/json')->set_output($data);
|
||||
}
|
||||
private function ceklogin()
|
||||
{
|
||||
$username = $this->session->userdata('username');
|
||||
if ($username == null) {
|
||||
redirect("login");
|
||||
}
|
||||
}
|
||||
public function index()
|
||||
{
|
||||
$username = $this->session->userdata('username');
|
||||
$jabatan = $this->session->userdata('jabatan');
|
||||
$id_setdata = $this->Setdata->getIDSETDATA();
|
||||
$id_setdata = $id_setdata[0]['ID_SETDATA'];
|
||||
$data = array(
|
||||
'sidebar' => "menu accounting",
|
||||
'navChild' => "",
|
||||
'id' => $id_setdata
|
||||
);
|
||||
$this->load->view('menu/Accounting', $data);
|
||||
|
||||
}
|
||||
|
||||
public function dashboard()
|
||||
{
|
||||
$id_karyawan = $this->session->userdata('id_karyawan');
|
||||
$jabatan = $this->session->userdata('jabatan');
|
||||
$data = array(
|
||||
'sidebar' => "dashboard",
|
||||
'navChild' => "",
|
||||
);
|
||||
$this->load->view('index', $data);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,207 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
class Action extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('Kueri');
|
||||
$this->load->model('LevelModel', 'LevelM');
|
||||
$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');
|
||||
if ($username != null) {
|
||||
redirect("Authority");
|
||||
}
|
||||
$this->load->view('signin');
|
||||
}
|
||||
public function login()
|
||||
{
|
||||
$this->load->view('signin');
|
||||
}
|
||||
public function admin_so()
|
||||
{
|
||||
$data = array(
|
||||
'status_checker' => $this->Kueri->lihat_status()
|
||||
);
|
||||
$this->load->view('so-center', $data);
|
||||
}
|
||||
public function table_admin_so()
|
||||
{
|
||||
$data = array(
|
||||
'oper_tek' => $this->Kueri->lihat_ot()
|
||||
);
|
||||
$this->load->view('table-admin-so', $data);
|
||||
}
|
||||
public function table_sales_order()
|
||||
{
|
||||
// $data = array(
|
||||
// 'oper_tek' => $this->Kueri->lihat_ot()
|
||||
// );
|
||||
$this->load->view('table-sales-order');
|
||||
}
|
||||
// public function my_history()
|
||||
// {
|
||||
// $ID_USER=$this->session->userdata('ID_USER');
|
||||
// $data = array(
|
||||
// 'my_so' => $this->Kueri->lihat_soku($ID_USER)
|
||||
// );
|
||||
// $this->load->view('table-myhistory', $data);
|
||||
// }
|
||||
public function hapus_so()
|
||||
{
|
||||
$KODE_SO = $this->input->post('KODE_SO');
|
||||
$this->Model_toko->del_so($KODE_SO);
|
||||
redirect(base_url("index.php/Action/tables_admin_so"));
|
||||
}
|
||||
// public function table_account()
|
||||
// {
|
||||
// $this->load->view('table-account');
|
||||
// }
|
||||
public function table_pelanggan()
|
||||
{
|
||||
$this->load->view('table-pelanggan');
|
||||
}
|
||||
public function table_barang()
|
||||
{
|
||||
$this->load->view('table-barang');
|
||||
}
|
||||
public function tambah_so()
|
||||
{
|
||||
$this->load->view('tambah-so');
|
||||
}
|
||||
// public function tambah_user()
|
||||
// {
|
||||
// $this->load->view('tambah-user');
|
||||
// }
|
||||
public function tambah_barang()
|
||||
{
|
||||
$this->load->view('tambah-barang');
|
||||
}
|
||||
public function tambah_pelanggan()
|
||||
{
|
||||
$this->load->view('tambah-pelanggan');
|
||||
}
|
||||
public function edit_user()
|
||||
{
|
||||
$this->load->view('edit-user');
|
||||
}
|
||||
public function edit_barang()
|
||||
{
|
||||
$this->load->view('edit-barang');
|
||||
}
|
||||
// public function edit_pelanggan()
|
||||
// {
|
||||
// $this->load->view('edit-pelanggan');
|
||||
// }
|
||||
public function view_so()
|
||||
{
|
||||
$data = array(
|
||||
'status_checker' => $this->Kueri->lihat_status()
|
||||
);
|
||||
$this->load->view('view-so', $data);
|
||||
}
|
||||
public function login_action()
|
||||
{
|
||||
$usernames = $this->session->userdata('username');
|
||||
$levels = $this->session->userdata('level');
|
||||
if ($usernames != null) {
|
||||
redirect('authority');
|
||||
}
|
||||
////
|
||||
$username = $this->input->post('username');
|
||||
$password = $this->input->post('password');
|
||||
$remember = $this->input->post('rememberme');
|
||||
|
||||
|
||||
$check_un = $this->Kueri->getUn($username);
|
||||
$check_login_r = $this->Kueri->getLogin($username, $password)->num_rows();
|
||||
// var_dump($check_un);
|
||||
|
||||
if ($check_un > 0) {
|
||||
if ($check_login_r > 0) {
|
||||
$datauser = $this->Kueri->getLogin($username, $password)->row_array();
|
||||
|
||||
$lev = $this->LevelM->getDataLevel($datauser['LEVEL_ID']);
|
||||
// $level = 'sdfdsfsdfs';
|
||||
if (is_array($lev) || is_object($lev)) {
|
||||
foreach ($lev as $key) {
|
||||
$level = $key['NAMA_LEVEL'];
|
||||
}
|
||||
}
|
||||
|
||||
$sessions = array(
|
||||
'id_user' => $datauser['ID_USER'],
|
||||
'nama_user' => $datauser['NAMA_USER'],
|
||||
'nama_panggilan' => $datauser['NAMA_PANGGILAN'],
|
||||
'username' => $datauser['USERNAME'],
|
||||
'password' => $datauser['PASSWORD'],
|
||||
'level' => $level,
|
||||
'status' => $datauser['STATUS']
|
||||
);
|
||||
if ($remember != null) {
|
||||
|
||||
setcookie('username', $username, time() + (86400 * 30), "/");
|
||||
setcookie('password', $password, time() + (86400 * 30), "/");
|
||||
}
|
||||
// var_dump($sessionsnya);
|
||||
// kill();
|
||||
$this->session->set_userdata($sessions);
|
||||
redirect('authority');
|
||||
} else {
|
||||
$this->session->set_flashdata('flash_gagal', 'Password Salah');
|
||||
redirect('Action');
|
||||
}
|
||||
} else {
|
||||
$this->session->set_flashdata('flash_gagal', 'Username belum terdaftar');
|
||||
redirect('Action');
|
||||
}
|
||||
|
||||
|
||||
|
||||
// if ($check_login_r > 0) {
|
||||
// $datauser = $this->Kueri->getLogin($username, $password)->row_array();
|
||||
|
||||
// $lev = $this->LevelM->getDataLevel($datauser['LEVEL_ID']);
|
||||
// // $level = 'sdfdsfsdfs';
|
||||
// if (is_array($lev) || is_object($lev)) {
|
||||
// foreach ($lev as $key) {
|
||||
// $level = $key['NAMA_LEVEL'];
|
||||
// }
|
||||
// }
|
||||
|
||||
// $sessions = array(
|
||||
// 'id_user' => $datauser['ID_USER'],
|
||||
// 'nama_user' => $datauser['NAMA_USER'],
|
||||
// 'nama_panggilan' => $datauser['NAMA_PANGGILAN'],
|
||||
// 'username' => $datauser['USERNAME'],
|
||||
// 'password' => $datauser['PASSWORD'],
|
||||
// 'level' => $level,
|
||||
// 'status' => $datauser['STATUS']
|
||||
// );
|
||||
// // var_dump($sessionsnya);
|
||||
// // kill();
|
||||
// $this->session->set_userdata($sessions);
|
||||
// redirect('authority');
|
||||
// } else {
|
||||
// $this->session->set_flashdata('flash_gagal', 'Login');
|
||||
// redirect('Action');
|
||||
// }
|
||||
}
|
||||
public function logout_action()
|
||||
{
|
||||
$this->session->sess_destroy();
|
||||
setcookie('username', "", time() - 3600);
|
||||
setcookie('password', "", time() - 3600);
|
||||
redirect('Action');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,145 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
class ManageSn extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('ModelSn', 'MS');
|
||||
$this->load->model('ModelBeli', 'MBeli');
|
||||
$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");
|
||||
}
|
||||
|
||||
$datSn = $this->MS->getDataSn();
|
||||
|
||||
$data = [
|
||||
'sidebar' => "data proses sn",
|
||||
'navChild' => "data proses barangsn",
|
||||
'sn' => $datSn
|
||||
];
|
||||
|
||||
$this->load->view('master/Sn', $data);
|
||||
}
|
||||
|
||||
public function add()
|
||||
{
|
||||
$username = $this->session->userdata('username');
|
||||
if ($username == null) {
|
||||
redirect("Login");
|
||||
}
|
||||
$datSn = $this->MS->getDataSn();
|
||||
$datBeli = $this->MBeli->getDataBeli();
|
||||
$data = [
|
||||
'sidebar' => "data proses sn",
|
||||
'navChild' => "data proses barangsn",
|
||||
'sn' => $datSn,
|
||||
'beli' => $datBeli
|
||||
];
|
||||
$this->load->view('proses/TambahSn', $data);
|
||||
}
|
||||
|
||||
public function hapus()
|
||||
{
|
||||
$id = $this->input->post('id');
|
||||
if ($this->MS->delete('sn', $id, 'ID_SN')) {
|
||||
$this->session->set_flashdata('flash', 'dihapus');
|
||||
redirect('ManageSn');
|
||||
}
|
||||
}
|
||||
|
||||
public function sn()
|
||||
{
|
||||
$username = $this->session->userdata('username');
|
||||
$jabatan = $this->session->userdata('jabatan');
|
||||
if ($username == null) {
|
||||
redirect("Login");
|
||||
} elseif ($jabatan != "ADMIN") {
|
||||
redirect("Login");
|
||||
}
|
||||
|
||||
$beli = $this->MS->getBeli();
|
||||
|
||||
$data = [
|
||||
'sidebar' => "data proses sn",
|
||||
'navChild' => "data proses barangsn",
|
||||
'sn' => $beli
|
||||
];
|
||||
|
||||
$this->load->view('master/Sn', $data);
|
||||
}
|
||||
|
||||
public function getsn($id)
|
||||
{
|
||||
$sn = $this->MS->getSnn($id);
|
||||
$this->output_json(['sn' => $sn]);
|
||||
}
|
||||
|
||||
public function ambildatasn($id = null)
|
||||
{
|
||||
if ($id != null) {
|
||||
$sn = $this->MS->getSnn($id);
|
||||
$data = ['beli' => $id, 'sn' => $sn];
|
||||
$this->load->view('proses/ambildatasn', $data);
|
||||
} else {
|
||||
$data = ['beli' => null, 'sn' => []];
|
||||
$this->load->view('proses/ambildatasn', $data);
|
||||
}
|
||||
}
|
||||
|
||||
public function tambahsn($beli, $sn)
|
||||
{
|
||||
|
||||
$datID = $this->MS->getIDBarang($beli);
|
||||
if (is_array($datID)||is_object($$datID)) {
|
||||
$input = [
|
||||
'NAMA_SN' => $sn,
|
||||
'BELI_ID' => $beli,
|
||||
'BARANG_ID' => $datID[0]['BARANG_ID'],
|
||||
'GUDANG_ID' => '1'
|
||||
];
|
||||
|
||||
$action = $this->MS->create('sn', $input);
|
||||
$this->output_json(['value' => "berhasil"]);
|
||||
}
|
||||
//$datID = $this->MSSn->getDataID($sku);
|
||||
|
||||
//if (is_array($datID)||is_object($$datID)) {
|
||||
// $input2 = [
|
||||
// 'NAMA_SN' => $sn,
|
||||
// 'ID_SKU' => $sku,
|
||||
// 'ID_TYPE' => $datID[0]['ID_TYPE'],
|
||||
// 'ID_PROCESSOR' => $datID[0]['ID_PROCESSOR'],
|
||||
// 'ID_RAM' => $datID[0]['ID_RAM'],
|
||||
// 'ID_HDD' => $datID[0]['ID_HDD'],
|
||||
// 'ID_SSD' => $datID[0]['ID_SSD'],
|
||||
// 'ID_VGA' => $datID[0]['ID_VGA'],
|
||||
// 'ID_OS' => $datID[0]['ID_OS'],
|
||||
// 'ID_DVD' => $datID[0]['ID_DVD'],
|
||||
// 'ID_WARNA' => $datID[0]['ID_WARNA'],
|
||||
// 'ID_KEYMOU' => $datID[0]['ID_KEYMOU'],
|
||||
// 'ID_SP' => $datID[0]['ID_SP'],
|
||||
// 'ID_RAID' => $datID[0]['ID_RAID']
|
||||
// ];
|
||||
//
|
||||
// $action2 = $this->MSSn->create('inventory', $input2);
|
||||
//}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
require APPPATH . 'libraries/REST_Controller.php';
|
||||
require APPPATH . 'libraries/Format.php';
|
||||
|
||||
class DataAccounting extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->ceklogin();
|
||||
$this->load->model('LoginModel', 'LoginM');
|
||||
$this->load->model('AbsensiModel', 'AbsensiM');
|
||||
}
|
||||
public function output_json($data, $encode = true)
|
||||
{
|
||||
if ($encode) $data = json_encode($data);
|
||||
$this->output->set_content_type('application/json')->set_output($data);
|
||||
}
|
||||
private function ceklogin()
|
||||
{
|
||||
$username = $this->session->userdata('username');
|
||||
if ($username == null) {
|
||||
redirect("login");
|
||||
}
|
||||
}
|
||||
public function index()
|
||||
{
|
||||
$username = $this->session->userdata('username');
|
||||
$jabatan = $this->session->userdata('jabatan');
|
||||
$data = array(
|
||||
'sidebar' => "menu accounting",
|
||||
'navChild' => "",
|
||||
);
|
||||
$this->load->view('menu/DataAccounting', $data);
|
||||
|
||||
}
|
||||
|
||||
public function dashboard()
|
||||
{
|
||||
$id_karyawan = $this->session->userdata('id_karyawan');
|
||||
$jabatan = $this->session->userdata('jabatan');
|
||||
$data = array(
|
||||
'sidebar' => "dashboard",
|
||||
'navChild' => "",
|
||||
);
|
||||
$this->load->view('index', $data);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,169 @@
|
||||
<?php
|
||||
|
||||
use Restserver\Libraries\REST_Controller;
|
||||
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
require APPPATH . 'libraries/REST_Controller.php';
|
||||
require APPPATH . 'libraries/Format.php';
|
||||
|
||||
class KasMasuk extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('ModelPembelian', 'MP');
|
||||
$this->load->model('ModelSupplier', 'MS');
|
||||
$this->load->model('ModelBarang', 'MB');
|
||||
$this->load->model('ModelGudang', 'MG');
|
||||
$this->load->model('ModelTransaksi', 'MT');
|
||||
$this->load->model('ModelNeraca', 'MN');
|
||||
$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()
|
||||
{
|
||||
|
||||
$datTransaksi = $this->MT->getDataTransaksi();
|
||||
$datNeraca = $this->MN->getDataNeraca();
|
||||
|
||||
$data = [
|
||||
'sidebar' => "menu accounting",
|
||||
'navChild' => "",
|
||||
'relasi' => $datTransaksi,
|
||||
'neraca' => $datNeraca
|
||||
];
|
||||
|
||||
$this->load->view('proses/AccountingKasMasuk', $data);
|
||||
}
|
||||
|
||||
public function tambahHarga($id)
|
||||
{
|
||||
$stock = $this->MP->getPembelianHarga($id);
|
||||
$title = $this->MP->getSJPembelian($id);
|
||||
$barang = $this->MB->getDataBarangPembelian();
|
||||
$gudang = $this->MG->getDataGudangPembelian();
|
||||
|
||||
$data = [
|
||||
'sidebar' => "menu pembelian",
|
||||
'navChild' => "",
|
||||
'stock' => $stock,
|
||||
'id_pembelian' => $id,
|
||||
'sj_pembelian' => $title[0]['SJ_PEMBELIAN'],
|
||||
'barang' => $barang,
|
||||
'gudang' => $gudang
|
||||
];
|
||||
|
||||
$this->load->view('proses/PembelianHarga', $data);
|
||||
}
|
||||
|
||||
public function saverelasi()
|
||||
{
|
||||
$method = $this->input->post('method');
|
||||
$id_transaksi = $this->input->post('id_transaksi');
|
||||
$id_stock = $this->input->post('id_stock');
|
||||
$qty = $this->input->post('qty');
|
||||
$radio_beli = $this->input->post('radio_beli');
|
||||
$radio_ppn = $this->input->post('radio_ppn');
|
||||
$invoice_pembelian = $this->input->post('invoice_pembelian');
|
||||
$tgl_invoicebeli = $this->input->post('tgl_invoicebeli');
|
||||
$dpp_satuan = $this->input->post('dpp_satuan');
|
||||
$dpp_total = $dpp_satuan*$qty;
|
||||
|
||||
$inputharga = [
|
||||
'DPP_BELI_SATUAN' => $dpp_satuan,
|
||||
'DPP_BELI_TOTAL' => $dpp_total,
|
||||
'STATUS_PPN' => $radio_ppn,
|
||||
'STATUS_BELI' => $radio_beli,
|
||||
'STOCK_ID' => $id_stock
|
||||
];
|
||||
|
||||
$actionharga = $this->MP->create('harga', $inputharga);
|
||||
|
||||
$harga_id = $this->MP->getStockHargaID();
|
||||
$updatestock = [
|
||||
'HARGA_ID' => $harga_id[0]['ID_HARGA']
|
||||
];
|
||||
$updatepembelian = [
|
||||
'INVOICE_PEMBELIAN' => $invoice_pembelian,
|
||||
'TGL_INVOICEBELI' => $tgl_invoicebeli
|
||||
];
|
||||
$actionstock = $this->MP->update('stock', $updatestock, 'ID_STOCK', $id_stock);
|
||||
$actionpembelian = $this->MP->update('pembelian', $updatepembelian, 'ID_PEMBELIAN', $id_pembelian);
|
||||
|
||||
if ($actionstock) {
|
||||
$this->session->set_flashdata('flash', 'ditambah');
|
||||
redirect($_SERVER['HTTP_REFERER']);
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'ditambah');
|
||||
redirect($_SERVER['HTTP_REFERER']);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function editharga()
|
||||
{
|
||||
$method = $this->input->post('method');
|
||||
$id_pembelian = $this->input->post('id_pembelian');
|
||||
$id_stock = $this->input->post('id_stock');
|
||||
$id_harga = $this->input->post('id_harga');
|
||||
$qty = $this->input->post('qty');
|
||||
$radio_beli = $this->input->post('radio_belied');
|
||||
$radio_ppn = $this->input->post('radio_ppned');
|
||||
$invoice_pembelian = $this->input->post('invoice_pembelianed');
|
||||
$tgl_invoicebeli = $this->input->post('tgl_invoicebelied');
|
||||
$dpp_satuan = $this->input->post('dpp_satuaned');
|
||||
$dpp_total = $dpp_satuan*$qty;
|
||||
|
||||
$updateharga = [
|
||||
'DPP_BELI_SATUAN' => $dpp_satuan,
|
||||
'DPP_BELI_TOTAL' => $dpp_total,
|
||||
'STATUS_PPN' => $radio_ppn,
|
||||
'STATUS_BELI' => $radio_beli,
|
||||
'STOCK_ID' => $id_stock
|
||||
];
|
||||
|
||||
$updatepembelian = [
|
||||
'INVOICE_PEMBELIAN' => $invoice_pembelian,
|
||||
'TGL_INVOICEBELI' => $tgl_invoicebeli
|
||||
];
|
||||
|
||||
$actionharga = $this->MP->update('harga', $updateharga, 'ID_HARGA', $id_harga);
|
||||
$actionpembelian = $this->MP->update('pembelian', $updatepembelian, 'ID_PEMBELIAN', $id_pembelian);
|
||||
|
||||
if ($actionpembelian) {
|
||||
$this->session->set_flashdata('flash', 'diedit');
|
||||
redirect($_SERVER['HTTP_REFERER']);
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'diedit');
|
||||
redirect($_SERVER['HTTP_REFERER']);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function konfirmasi()
|
||||
{
|
||||
$method = $this->input->post('method');
|
||||
$id_pembelian = $this->input->post('id_pembelian');
|
||||
|
||||
$update = [
|
||||
'STATUS_PEMBELIAN' => "INVOICE SUDAH PROSES"
|
||||
];
|
||||
|
||||
$action = $this->MP->update('pembelian', $update, 'ID_PEMBELIAN', $id_pembelian);
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('flash', 'dikonfirmasi');
|
||||
redirect('ManagePembelianINV');
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'dikonfirmasi');
|
||||
redirect('ManagePembelianINV');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
require APPPATH . 'libraries/REST_Controller.php';
|
||||
require APPPATH . 'libraries/Format.php';
|
||||
|
||||
class Kasbank extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->ceklogin();
|
||||
$this->load->model('LoginModel', 'LoginM');
|
||||
$this->load->model('AbsensiModel', 'AbsensiM');
|
||||
$this->load->model('ModelPembelian', 'MP');
|
||||
$this->load->model('ModelAccounting', 'MA');
|
||||
}
|
||||
public function output_json($data, $encode = true)
|
||||
{
|
||||
if ($encode) $data = json_encode($data);
|
||||
$this->output->set_content_type('application/json')->set_output($data);
|
||||
}
|
||||
private function ceklogin()
|
||||
{
|
||||
$username = $this->session->userdata('username');
|
||||
if ($username == null) {
|
||||
redirect("login");
|
||||
}
|
||||
}
|
||||
public function index()
|
||||
{
|
||||
$username = $this->session->userdata('username');
|
||||
$jabatan = $this->session->userdata('jabatan');
|
||||
$accounting = $this->MA->getDataAccounting();
|
||||
$data = array(
|
||||
'sidebar' => "menu accounting",
|
||||
'navChild' => "",
|
||||
'accounting' => $accounting,
|
||||
);
|
||||
$this->load->view('menu/Kasbank', $data);
|
||||
|
||||
}
|
||||
|
||||
public function dashboard()
|
||||
{
|
||||
$id_karyawan = $this->session->userdata('id_karyawan');
|
||||
$jabatan = $this->session->userdata('jabatan');
|
||||
$data = array(
|
||||
'sidebar' => "dashboard",
|
||||
'navChild' => "",
|
||||
);
|
||||
$this->load->view('index', $data);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
require APPPATH . 'libraries/REST_Controller.php';
|
||||
require APPPATH . 'libraries/Format.php';
|
||||
|
||||
class Konsinyasi extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->ceklogin();
|
||||
$this->load->model('LoginModel', 'LoginM');
|
||||
$this->load->model('AbsensiModel', 'AbsensiM');
|
||||
$this->load->model('ModelPembelian', 'MP');
|
||||
$this->load->model('ModelSetData', 'Setdata');
|
||||
}
|
||||
public function output_json($data, $encode = true)
|
||||
{
|
||||
if ($encode) $data = json_encode($data);
|
||||
$this->output->set_content_type('application/json')->set_output($data);
|
||||
}
|
||||
private function ceklogin()
|
||||
{
|
||||
$username = $this->session->userdata('username');
|
||||
if ($username == null) {
|
||||
redirect("login");
|
||||
}
|
||||
}
|
||||
public function index()
|
||||
{
|
||||
$username = $this->session->userdata('username');
|
||||
$jabatan = $this->session->userdata('jabatan');
|
||||
$pembelian = $this->MP->getDataPembelian();
|
||||
$id_setdata = $this->Setdata->getIDSETDATA();
|
||||
$id_setdata = $id_setdata[0]['ID_SETDATA'];
|
||||
$data = array(
|
||||
'sidebar' => "menu persediaan",
|
||||
'navChild' => "",
|
||||
'pembelian' => $pembelian,
|
||||
'id' => $id_setdata
|
||||
);
|
||||
$this->load->view('menu/Konsinyasi', $data);
|
||||
|
||||
}
|
||||
|
||||
public function dashboard()
|
||||
{
|
||||
$id_karyawan = $this->session->userdata('id_karyawan');
|
||||
$jabatan = $this->session->userdata('jabatan');
|
||||
$data = array(
|
||||
'sidebar' => "dashboard",
|
||||
'navChild' => "",
|
||||
);
|
||||
$this->load->view('index', $data);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
require APPPATH . 'libraries/REST_Controller.php';
|
||||
require APPPATH . 'libraries/Format.php';
|
||||
|
||||
class Laporan extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->ceklogin();
|
||||
$this->load->model('LoginModel', 'LoginM');
|
||||
$this->load->model('AbsensiModel', 'AbsensiM');
|
||||
$this->load->model('ModelPembelian', 'MP');
|
||||
$this->load->model('ModelAccounting', 'MA');
|
||||
}
|
||||
public function output_json($data, $encode = true)
|
||||
{
|
||||
if ($encode) $data = json_encode($data);
|
||||
$this->output->set_content_type('application/json')->set_output($data);
|
||||
}
|
||||
private function ceklogin()
|
||||
{
|
||||
$username = $this->session->userdata('username');
|
||||
if ($username == null) {
|
||||
redirect("login");
|
||||
}
|
||||
}
|
||||
public function index()
|
||||
{
|
||||
$username = $this->session->userdata('username');
|
||||
$jabatan = $this->session->userdata('jabatan');
|
||||
$data = array(
|
||||
'sidebar' => "menu accounting",
|
||||
'navChild' => "",
|
||||
);
|
||||
$this->load->view('menu/Laporan', $data);
|
||||
|
||||
}
|
||||
|
||||
public function dashboard()
|
||||
{
|
||||
$id_karyawan = $this->session->userdata('id_karyawan');
|
||||
$jabatan = $this->session->userdata('jabatan');
|
||||
$data = array(
|
||||
'sidebar' => "dashboard",
|
||||
'navChild' => "",
|
||||
);
|
||||
$this->load->view('index', $data);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,193 @@
|
||||
<?php
|
||||
|
||||
use Restserver\Libraries\REST_Controller;
|
||||
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
require APPPATH . 'libraries/REST_Controller.php';
|
||||
require APPPATH . 'libraries/Format.php';
|
||||
|
||||
class ManageAccounting extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('ModelAccounting', 'MA');
|
||||
$this->load->model('ModelBank', 'MBa');
|
||||
$this->load->model('ModelBiaya', 'MBi');
|
||||
$this->load->model('ModelHutang', 'MH');
|
||||
$this->load->model('ModelKas', 'MK');
|
||||
$this->load->model('ModelKasbank', 'MKB');
|
||||
$this->load->model('ModelPiutang', 'MP');
|
||||
$this->load->model('ModalTransaksi', '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()
|
||||
{
|
||||
|
||||
$datPembelian = $this->MP->getDataPembelianHarga();
|
||||
$datSupplier = $this->MS->getDataSupplier();
|
||||
|
||||
$data = [
|
||||
'sidebar' => "menu pembelian",
|
||||
'navChild' => "",
|
||||
'pembelian' => $datPembelian,
|
||||
'supplier' => $datSupplier
|
||||
];
|
||||
|
||||
$this->load->view('proses/PembelianINV', $data);
|
||||
}
|
||||
|
||||
public function tambahHarga($id)
|
||||
{
|
||||
$stock = $this->MP->getPembelianHarga($id);
|
||||
$title = $this->MP->getSJPembelian($id);
|
||||
$barang = $this->MB->getDataBarangPembelian();
|
||||
$gudang = $this->MG->getDataGudangPembelian();
|
||||
|
||||
$data = [
|
||||
'sidebar' => "menu pembelian",
|
||||
'navChild' => "",
|
||||
'stock' => $stock,
|
||||
'id_pembelian' => $id,
|
||||
'sj_pembelian' => $title[0]['SJ_PEMBELIAN'],
|
||||
'barang' => $barang,
|
||||
'gudang' => $gudang
|
||||
];
|
||||
|
||||
$this->load->view('proses/PembelianHarga', $data);
|
||||
}
|
||||
|
||||
public function saveharga()
|
||||
{
|
||||
$method = $this->input->post('method');
|
||||
$id_pembelian = $this->input->post('id_pembelian');
|
||||
$id_stock = $this->input->post('id_stock');
|
||||
$qty = $this->input->post('qty');
|
||||
$radio_beli = $this->input->post('radio_beli');
|
||||
$radio_ppn = $this->input->post('radio_ppn');
|
||||
$invoice_pembelian = $this->input->post('invoice_pembelian');
|
||||
$tgl_invoicebeli = $this->input->post('tgl_invoicebeli');
|
||||
$dpp_satuan = $this->input->post('dpp_satuan');
|
||||
$dpp_total = $dpp_satuan*$qty;
|
||||
|
||||
$inputharga = [
|
||||
'DPP_BELI_SATUAN' => $dpp_satuan,
|
||||
'DPP_BELI_TOTAL' => $dpp_total,
|
||||
'STATUS_PPN' => $radio_ppn,
|
||||
'STATUS_BELI' => $radio_beli,
|
||||
'STOCK_ID' => $id_stock
|
||||
];
|
||||
|
||||
$actionharga = $this->MP->create('harga', $inputharga);
|
||||
|
||||
$harga_id = $this->MP->getStockHargaID();
|
||||
$updatestock = [
|
||||
'HARGA_ID' => $harga_id[0]['ID_HARGA']
|
||||
];
|
||||
$updatepembelian = [
|
||||
'INVOICE_PEMBELIAN' => $invoice_pembelian,
|
||||
'TGL_INVOICEBELI' => $tgl_invoicebeli
|
||||
];
|
||||
$actionstock = $this->MP->update('stock', $updatestock, 'ID_STOCK', $id_stock);
|
||||
$actionpembelian = $this->MP->update('pembelian', $updatepembelian, 'ID_PEMBELIAN', $id_pembelian);
|
||||
|
||||
if ($actionstock) {
|
||||
$this->session->set_flashdata('flash', 'ditambah');
|
||||
redirect($_SERVER['HTTP_REFERER']);
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'ditambah');
|
||||
redirect($_SERVER['HTTP_REFERER']);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function editharga()
|
||||
{
|
||||
$method = $this->input->post('method');
|
||||
$id_pembelian = $this->input->post('id_pembelian');
|
||||
$id_stock = $this->input->post('id_stock');
|
||||
$id_harga = $this->input->post('id_harga');
|
||||
$qty = $this->input->post('qty');
|
||||
$radio_beli = $this->input->post('radio_belied');
|
||||
$radio_ppn = $this->input->post('radio_ppned');
|
||||
$invoice_pembelian = $this->input->post('invoice_pembelianed');
|
||||
$tgl_invoicebeli = $this->input->post('tgl_invoicebelied');
|
||||
$dpp_satuan = $this->input->post('dpp_satuaned');
|
||||
$dpp_total = $dpp_satuan*$qty;
|
||||
|
||||
$updateharga = [
|
||||
'DPP_BELI_SATUAN' => $dpp_satuan,
|
||||
'DPP_BELI_TOTAL' => $dpp_total,
|
||||
'STATUS_PPN' => $radio_ppn,
|
||||
'STATUS_BELI' => $radio_beli,
|
||||
'STOCK_ID' => $id_stock
|
||||
];
|
||||
|
||||
$updatepembelian = [
|
||||
'INVOICE_PEMBELIAN' => $invoice_pembelian,
|
||||
'TGL_INVOICEBELI' => $tgl_invoicebeli
|
||||
];
|
||||
|
||||
$actionharga = $this->MP->update('harga', $updateharga, 'ID_HARGA', $id_harga);
|
||||
$actionpembelian = $this->MP->update('pembelian', $updatepembelian, 'ID_PEMBELIAN', $id_pembelian);
|
||||
|
||||
if ($actionpembelian) {
|
||||
$this->session->set_flashdata('flash', 'diedit');
|
||||
redirect($_SERVER['HTTP_REFERER']);
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'diedit');
|
||||
redirect($_SERVER['HTTP_REFERER']);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function konfirmasi()
|
||||
{
|
||||
$method = $this->input->post('method');
|
||||
$id_pembelian = $this->input->post('id_pembelian');
|
||||
|
||||
$update = [
|
||||
'STATUS_PEMBELIAN' => "INVOICE PEMBELIAN OK"
|
||||
];
|
||||
|
||||
$action = $this->MP->update('pembelian', $update, 'ID_PEMBELIAN', $id_pembelian);
|
||||
|
||||
$datTransaksi = $this->MP->createTransaksi($id_pembelian);
|
||||
$datHargaTotal = $this->MP->getHargaTotal($id_pembelian);
|
||||
$data1 = $datTransaksi[0]['INVOICE_PEMBELIAN'];
|
||||
$data2 = $datTransaksi[0]['TGL_INVOICEBELI'];
|
||||
$data3 = "Hutang";
|
||||
|
||||
if ($datTransaksi[0]['STATUS_PPN']==='Include') {
|
||||
$data4 = $datHargaTotal[0]['DPP_BELI_TOTAL'];
|
||||
} else if ($datTransaksi[0]['STATUS_PPN']==='Exclude') {
|
||||
$data4 = $datHargaTotal[0]['DPP_BELI_TOTAL']*1.1;
|
||||
}
|
||||
|
||||
$inputTransaksi = [
|
||||
'DOKUMEN_TRANSAKSI' => $data1,
|
||||
'TGL_TRANSAKSI' => $data2,
|
||||
'JENIS_TRANSAKSI' => $data3,
|
||||
'NILAI_TRANSAKSI' => $data4,
|
||||
|
||||
];
|
||||
|
||||
$actiontransaksi = $this->MP->create('transaksi', $inputTransaksi);
|
||||
|
||||
if ($actiontransaksi) {
|
||||
$this->session->set_flashdata('flash', 'dikonfirmasi');
|
||||
redirect('ManagePembelianINV');
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'dikonfirmasi');
|
||||
redirect('ManagePembelianINV');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
class ManageAdminGudang extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('ModelAdminGudang', 'MAG');
|
||||
$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()
|
||||
{
|
||||
|
||||
$datGudang = $this->MAG->getDataAdminGudang();
|
||||
|
||||
$data = [
|
||||
'sidebar' => "data master service",
|
||||
'navChild' => "data master admin gudang",
|
||||
'gudang' => $datGudang
|
||||
];
|
||||
|
||||
$this->load->view('master/AdminGudang', $data);
|
||||
}
|
||||
|
||||
public function save()
|
||||
{
|
||||
$method = $this->input->post('method');
|
||||
$id_admingudang = $this->input->post('id');
|
||||
$nama = $this->input->post('nama');
|
||||
|
||||
$this->form_validation->set_rules('nama', 'Nama', 'required');
|
||||
if ($this->form_validation->run() == FALSE) {
|
||||
$data = [
|
||||
'status' => false,
|
||||
'errors' => [
|
||||
'nama' => form_error('nama')
|
||||
|
||||
]
|
||||
];
|
||||
$this->output_json($data);
|
||||
} else {
|
||||
|
||||
$input = [
|
||||
'NAMA_ADMINGUDANG' => $nama
|
||||
|
||||
];
|
||||
|
||||
if ($method === 'add') {
|
||||
$action = $this->MAG->create('admingudang', $input);
|
||||
} else if ($method === 'edit') {
|
||||
$action = $this->MAG->update('admingudang', $input, 'ID_ADMINGUDANG', $id_admingudang);
|
||||
}
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('flash', 'ditambah');
|
||||
redirect('ManageAdminGudang');
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'ditambah');
|
||||
redirect('ManageAdminGudang');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function hapus()
|
||||
{
|
||||
$id = $this->input->post('id');
|
||||
if ($this->MAG->delete('admingudang', $id, 'ID_ADMINGUDANG')) {
|
||||
$this->session->set_flashdata('flash', 'dihapus');
|
||||
redirect('ManageAdminGudang');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
class ManageAgen extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('ModelAgen', 'Agen');
|
||||
$this->load->model('ModelDashboard', 'Dashboard');
|
||||
$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(){
|
||||
$datAgen = $this->Agen->getDataAgen();
|
||||
$data = [
|
||||
'sidebar' => "master data",
|
||||
'navChild' => "data master agen",
|
||||
'agen' => $datAgen
|
||||
];
|
||||
$this->load->view('master/Agen', $data);
|
||||
}
|
||||
|
||||
public function save()
|
||||
{
|
||||
$method = $this->input->post('method');
|
||||
$id_agen = $this->input->post('id');
|
||||
$nama_agen = $this->input->post('nama_agen');
|
||||
|
||||
$date = date('Y-m-d H:i:s');
|
||||
$input = [
|
||||
'NAMA_AGEN' => $nama_agen
|
||||
];
|
||||
|
||||
$action = $this->Agen->create('agen', $input);
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('success', 'ditambah');
|
||||
redirect('ManageAgen');
|
||||
} else {
|
||||
$this->session->set_flashdata('failed', 'ditambah');
|
||||
redirect('ManageAgen');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function edit()
|
||||
{
|
||||
$method = $this->input->post('method');
|
||||
$id_agen = $this->input->post('id_agen');
|
||||
$nama_agen = $this->input->post('nama_agened');
|
||||
|
||||
$update = [
|
||||
'NAMA_AGEN' => $nama_agen
|
||||
];
|
||||
|
||||
$action = $this->Agen->update('agen', $update,'ID_AGEN',$id_agen);
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('success', 'diubah');
|
||||
redirect('ManageAgen');
|
||||
} else {
|
||||
$this->session->set_flashdata('failed', 'diubah');
|
||||
redirect('ManageAgen');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function hapus()
|
||||
{
|
||||
$id = $this->input->post('id');
|
||||
if ($this->Agen->delete('agen', $id, 'ID_AGEN')) {
|
||||
$action = $this ->Agen->delete('agen',$id,'ID_AGEN');
|
||||
$this->session->set_flashdata('success', 'dihapus');
|
||||
redirect('ManageAgen');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
<?php
|
||||
|
||||
use Restserver\Libraries\REST_Controller;
|
||||
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
require APPPATH . 'libraries/REST_Controller.php';
|
||||
require APPPATH . 'libraries/Format.php';
|
||||
|
||||
class ManageBK extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('ModelBankKeluar', 'BankKeluar');
|
||||
$this->load->model('ModelBank', 'Bank');
|
||||
$this->load->model('ModelDpPembelian', 'Dpb');
|
||||
$this->load->model('ModelDpPenjualan', 'Dpj');
|
||||
$this->load->model('ModelHutangDagang', 'Hda');
|
||||
$this->load->model('ModelKendaraan', 'Kendaraan');
|
||||
$this->load->model('ModelKas', 'Kas');
|
||||
$this->load->model('ModelKaryawan', 'Karyawan');
|
||||
$this->load->model('ModelPerkiraan', 'Perkiraan');
|
||||
$this->load->model('ModelPajak', 'Pajak');
|
||||
$this->load->model('ModelPiutangKaryawan', 'Pkar');
|
||||
$this->load->model('ModelPiutangPihakKe3', 'Ppi');
|
||||
$this->load->model('ModelPiutangDagang', 'Pda');
|
||||
$this->load->model('ModelBiayaPengiriman', 'Bp');
|
||||
$this->load->model('ModelPelanggan', 'Pelanggan');
|
||||
$this->load->model('ModelSupplier', 'Supplier');
|
||||
$this->load->model('ModelPihakKe3', 'PihakKe3');
|
||||
$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);
|
||||
}
|
||||
|
||||
//Step One, View Bank Keluar
|
||||
public function index() {
|
||||
|
||||
$datBankKeluar = $this->BankKeluar->getDataBankKeluarRev();
|
||||
|
||||
$data = [
|
||||
'sidebar' => "menu accounting",
|
||||
'navChild' => "",
|
||||
'bankkeluar' => $datBankKeluar
|
||||
];
|
||||
|
||||
$this->load->view('proses/BKView', $data);
|
||||
}
|
||||
|
||||
public function revisi() {
|
||||
$method = $this->input->post('method');
|
||||
$id_bankkeluar = $this->input->post('id_bankkeluar');
|
||||
|
||||
//Proses Konfirmasi + Update Saldo Bank
|
||||
$databank = $this->BankKeluar->getDataBankKeluarRev($id_bankkeluar);
|
||||
$saldo = $databank[0]['SALDO_BANK'];
|
||||
$nominal = $databank[0]['KREDIT_BANKKELUAR'];
|
||||
$id_bank = $databank[0]['BANK_ID'];
|
||||
$saldo_bank = $saldo+$nominal;
|
||||
$update = [
|
||||
'SALDO_BANK' => $saldo_bank
|
||||
];
|
||||
$action = $this->BankKeluar->update('bank', $update, 'ID_BANK', $id_bank);
|
||||
$update = [
|
||||
'STATUS_BANKKELUAR' => NULL
|
||||
];
|
||||
$action = $this->BankKeluar->update('bankkeluar', $update, 'ID_BANKKELUAR', $id_bankkeluar);
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('flash', 'direvisi');
|
||||
redirect('ManageBK');
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'direvisi');
|
||||
redirect('ManageBK');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//Step Two, View Bank Keluar
|
||||
public function viewTransaksi($id) {
|
||||
$transaksi = $this->BankKeluar->getDataKasbankBK($id);
|
||||
$title = $this->BankKeluar->getTitleBK($id);
|
||||
$data = [
|
||||
'sidebar' => "menu accounting",
|
||||
'navChild' => "",
|
||||
'transaksi' => $transaksi,
|
||||
'id_bankkeluar' => $id,
|
||||
'title1' => $title[0]['KODE_BANKKELUAR'],
|
||||
'title2' => $title[0]['DEBIT'],
|
||||
'title3' => $title[0]['KREDIT'],
|
||||
];
|
||||
|
||||
$this->load->view('proses/KBBKView', $data);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
<?php
|
||||
|
||||
use Restserver\Libraries\REST_Controller;
|
||||
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
require APPPATH . 'libraries/REST_Controller.php';
|
||||
require APPPATH . 'libraries/Format.php';
|
||||
|
||||
class ManageBM extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('ModelBankMasuk', 'BankMasuk');
|
||||
$this->load->model('ModelBank', 'Bank');
|
||||
$this->load->model('ModelDpPembelian', 'Dpb');
|
||||
$this->load->model('ModelDpPenjualan', 'Dpj');
|
||||
$this->load->model('ModelHutangDagang', 'Hda');
|
||||
$this->load->model('ModelKendaraan', 'Kendaraan');
|
||||
$this->load->model('ModelKas', 'Kas');
|
||||
$this->load->model('ModelKaryawan', 'Karyawan');
|
||||
$this->load->model('ModelPerkiraan', 'Perkiraan');
|
||||
$this->load->model('ModelPajak', 'Pajak');
|
||||
$this->load->model('ModelPiutangKaryawan', 'Pkar');
|
||||
$this->load->model('ModelPiutangPihakKe3', 'Ppi');
|
||||
$this->load->model('ModelPiutangDagang', 'Pda');
|
||||
$this->load->model('ModelBiayaPengiriman', 'Bp');
|
||||
$this->load->model('ModelPelanggan', 'Pelanggan');
|
||||
$this->load->model('ModelSupplier', 'Supplier');
|
||||
$this->load->model('ModelPihakKe3', 'PihakKe3');
|
||||
$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);
|
||||
}
|
||||
|
||||
//Step One, View Bank Masuk
|
||||
public function index() {
|
||||
|
||||
$datBankMasuk = $this->BankMasuk->getDataBankMasukRev();
|
||||
|
||||
$data = [
|
||||
'sidebar' => "menu accounting",
|
||||
'navChild' => "",
|
||||
'bankmasuk' => $datBankMasuk
|
||||
];
|
||||
|
||||
$this->load->view('proses/BMView', $data);
|
||||
}
|
||||
|
||||
public function revisi() {
|
||||
$method = $this->input->post('method');
|
||||
$id_bankmasuk = $this->input->post('id_bankmasuk');
|
||||
|
||||
//Proses Konfirmasi + Update Saldo Bank
|
||||
$databank = $this->BankMasuk->getDataBankMasukRev($id_bankmasuk);
|
||||
$saldo = $databank[0]['SALDO_BANK'];
|
||||
$nominal = $databank[0]['DEBIT_BANKMASUK'];
|
||||
$id_bank = $databank[0]['BANK_ID'];
|
||||
$saldo_bank = $saldo-$nominal;
|
||||
$update = [
|
||||
'SALDO_BANK' => $saldo_bank
|
||||
];
|
||||
$action = $this->BankMasuk->update('bank', $update, 'ID_BANK', $id_bank);
|
||||
$update = [
|
||||
'STATUS_BANKMASUK' => NULL
|
||||
];
|
||||
$action = $this->BankMasuk->update('bankmasuk', $update, 'ID_BANKMASUK', $id_bankmasuk);
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('flash', 'direvisi');
|
||||
redirect('ManageBM');
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'direvisi');
|
||||
redirect('ManageBM');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//Step Two, View Bank Masuk
|
||||
public function viewTransaksi($id) {
|
||||
$transaksi = $this->BankMasuk->getDataKasbankBM($id);
|
||||
$title = $this->BankMasuk->getTitleBM($id);
|
||||
$data = [
|
||||
'sidebar' => "menu accounting",
|
||||
'navChild' => "",
|
||||
'transaksi' => $transaksi,
|
||||
'id_bankmasuk' => $id,
|
||||
'title1' => $title[0]['KODE_BANKMASUK'],
|
||||
'title2' => $title[0]['DEBIT'],
|
||||
'title3' => $title[0]['KREDIT'],
|
||||
];
|
||||
|
||||
$this->load->view('proses/KBBMView', $data);
|
||||
}
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,159 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
class ManageBarang extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('ModelBarang', 'MBarang');
|
||||
$this->load->model('ModelType', 'MType');
|
||||
$this->load->model('ModelProcessor', 'MProcessor');
|
||||
$this->load->model('ModelRam', 'MRam');
|
||||
$this->load->model('ModelHarddisk', 'MHarddisk');
|
||||
$this->load->model('ModelSsd', 'MSsd');
|
||||
$this->load->model('ModelOs', 'MOs');
|
||||
$this->load->model('ModelVga', 'MVga');
|
||||
$this->load->model('ModelMonitor', 'MMonitor');
|
||||
$this->load->model('ModelWarna', 'MWarna');
|
||||
$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");
|
||||
}
|
||||
|
||||
$datBarang = $this->MBarang->getNamaBarang();
|
||||
|
||||
$data = [
|
||||
'sidebar' => "data list 3",
|
||||
'navChild' => "data list barang",
|
||||
'barang' => $datBarang
|
||||
];
|
||||
|
||||
$this->load->view('barang/table-barang', $data);
|
||||
}
|
||||
|
||||
public function add()
|
||||
{
|
||||
$username = $this->session->userdata('username');
|
||||
if ($username == null) {
|
||||
redirect("Login");
|
||||
}
|
||||
$datBarang = $this->MBarang->getDataBarang();
|
||||
$datType = $this->MType->getDataType();
|
||||
$datProcessor = $this->MProcessor->getDataProcessor();
|
||||
$datRam = $this->MRam->getDataRam();
|
||||
$datHarddisk = $this->MHarddisk->getDataHarddisk();
|
||||
$datSsd = $this->MSsd->getDataSsd();
|
||||
$datOs = $this->MOs->getDataOs();
|
||||
$datVga = $this->MVga->getDataVga();
|
||||
$datMonitor = $this->MMonitor->getDataMonitor();
|
||||
$datWarna = $this->MWarna->getDataWarna();
|
||||
$data = [
|
||||
'sidebar' => "data list 3",
|
||||
'navChild' => "data list barang",
|
||||
'barang' => $datBarang,
|
||||
'type' => $datType,
|
||||
'processor' => $datProcessor,
|
||||
'ram' => $datRam,
|
||||
'hdd' => $datHarddisk,
|
||||
'ssd' => $datSsd,
|
||||
'os' => $datOs,
|
||||
'vga' => $datVga,
|
||||
'monitor' => $datMonitor,
|
||||
'warna' => $datWarna
|
||||
];
|
||||
//var_dump($data);
|
||||
$this->load->view('barang/barang-tambah', $data);
|
||||
}
|
||||
|
||||
public function save()
|
||||
{
|
||||
$method = $this->input->post('method');
|
||||
$id_barang = $this->input->post('id');
|
||||
$type = $this->input->post('TYPE');
|
||||
$processor = $this->input->post('PROCESSOR');
|
||||
$ram = $this->input->post('RAM');
|
||||
$hdd = $this->input->post('HDD');
|
||||
$ssd = $this->input->post('SSD');
|
||||
$os = $this->input->post('OS');
|
||||
$vga = $this->input->post('VGA');
|
||||
$monitor = $this->input->post('MONITOR');
|
||||
$warna = $this->input->post('WARNA');
|
||||
|
||||
$this->form_validation->set_rules('TYPE', 'Pilih Type', 'required');
|
||||
$this->form_validation->set_rules('PROCESSOR', 'Pilih Processor', 'required');
|
||||
$this->form_validation->set_rules('RAM', 'Pilih RAM', 'required');
|
||||
$this->form_validation->set_rules('HDD', 'Pilih HDD', 'required');
|
||||
$this->form_validation->set_rules('SSD', 'Pilih SSD', 'required');
|
||||
$this->form_validation->set_rules('OS', 'Pilih OS', 'required');
|
||||
$this->form_validation->set_rules('VGA', 'Pilih VGA', 'required');
|
||||
$this->form_validation->set_rules('MONITOR', 'Pilih Monitor', 'required');
|
||||
$this->form_validation->set_rules('WARNA', 'Pilih Warna', 'required');
|
||||
|
||||
if ($this->form_validation->run() == FALSE) {
|
||||
$data = [
|
||||
'status' => false,
|
||||
'errors' => [
|
||||
'TYPE' => form_error('TYPE'),
|
||||
'PROCESSOR' => form_error('PROCESSOR'),
|
||||
'RAM' => form_error('RAM'),
|
||||
'HDD' => form_error('HDD'),
|
||||
'SSD' => form_error('SSD'),
|
||||
'OS' => form_error('OS'),
|
||||
'VGA' => form_error('VGA'),
|
||||
'MONITOR' => form_error('MONITOR'),
|
||||
'WARNA' => form_error('WARNA')
|
||||
]
|
||||
];
|
||||
$this->output_json($data);
|
||||
} else {
|
||||
|
||||
$input = [
|
||||
'ID_TYPE' => $type,
|
||||
'ID_PROCESSOR' => $processor,
|
||||
'ID_RAM' => $ram,
|
||||
'ID_HDD' => $hdd,
|
||||
'ID_SSD' => $ssd,
|
||||
'ID_OS' => $os,
|
||||
'ID_VGA' => $vga,
|
||||
'ID_MONITOR' => $monitor,
|
||||
'ID_WARNA' => $warna
|
||||
];
|
||||
|
||||
$action = $this->MBarang->create('barang', $input);
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('flash', 'ditambah');
|
||||
//$this->output_json(['status' => true]);
|
||||
redirect('ManageBarang');
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'ditambah');
|
||||
//$this->output_json(['status' => true]);
|
||||
redirect('ManageBarang');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function hapus()
|
||||
{
|
||||
$id = $this->input->post('id');
|
||||
if ($this->MBarang->delete('barang', $id, 'ID_BARANG')) {
|
||||
$this->session->set_flashdata('flash', 'dihapus');
|
||||
redirect('ManageBarang');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
class ManageBarang extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('ModelBarang', 'MBarang');
|
||||
$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");
|
||||
}
|
||||
|
||||
$datBarang = $this->MBarang->getDataBarang();
|
||||
|
||||
$data = [
|
||||
'sidebar' => "data master service",
|
||||
'navChild' => "data proses barang",
|
||||
'barang' => $datBarang
|
||||
];
|
||||
|
||||
$this->load->view('master/Barang', $data);
|
||||
}
|
||||
|
||||
public function add()
|
||||
{
|
||||
$username = $this->session->userdata('username');
|
||||
if ($username == null) {
|
||||
redirect("Login");
|
||||
}
|
||||
$datBarang = $this->MBarang->getDataBarang();
|
||||
$data = [
|
||||
'sidebar' => "data master service",
|
||||
'navChild' => "data proses barang",
|
||||
'barang' => $datBarang
|
||||
];
|
||||
$this->load->view('proses/TambahBarang', $data);
|
||||
}
|
||||
|
||||
public function save()
|
||||
{
|
||||
$method = $this->input->post('method');
|
||||
$id_barang = $this->input->post('id');
|
||||
$jenis = $this->input->post('JENIS');
|
||||
$kode_barang = $this->input->post('kode_barang');
|
||||
$nama_barang = $this->input->post('nama_barang');
|
||||
$keterangan_barang = $this->input->post('keterangan_barang');
|
||||
|
||||
$this->form_validation->set_rules('JENIS', 'Pilih Jenis', 'required');
|
||||
$this->form_validation->set_rules('kode_barang', 'Kode Barang', 'required');
|
||||
$this->form_validation->set_rules('nama_barang', 'Nama Barang', 'required');
|
||||
|
||||
if ($this->form_validation->run() == FALSE) {
|
||||
$data = [
|
||||
'status' => false,
|
||||
'errors' => [
|
||||
'JENIS' => form_error('JENIS'),
|
||||
'kode_barang' => form_error('kode_barang'),
|
||||
'nama_barang' => form_error('nama_barang')
|
||||
]
|
||||
];
|
||||
$this->session->set_flashdata('flashgagal', 'ditambah');
|
||||
redirect('ManageBarang');
|
||||
|
||||
} else {
|
||||
|
||||
$input = [
|
||||
'JENIS_ID' => $jenis,
|
||||
'KODE_BARANG' => $kode_barang,
|
||||
'NAMA_BARANG' => $nama_barang,
|
||||
'KETERANGAN_BARANG' => $keterangan_barang
|
||||
];
|
||||
|
||||
$action = $this->MBarang->create('barang', $input);
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('flash', 'ditambah');
|
||||
redirect('ManageBarang');
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'ditambah');
|
||||
redirect('ManageBarang');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function hapus()
|
||||
{
|
||||
$id = $this->input->post('id');
|
||||
if ($this->MBarang->delete('barang', $id, 'ID_BARANG')) {
|
||||
$this->session->set_flashdata('flash', 'dihapus');
|
||||
redirect('ManageBarang');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,129 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
class ManageBeli extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('ModelBeli', 'MBeli');
|
||||
$this->load->model('ModelSupplier', 'MSupplier');
|
||||
$this->load->model('ModelBarang', 'MBarang');
|
||||
$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");
|
||||
}
|
||||
|
||||
$datBeli = $this->MBeli->getDataBeli();
|
||||
|
||||
$data = [
|
||||
'sidebar' => "data proses pembelian",
|
||||
'navChild' => "data proses purchasing",
|
||||
'beli' => $datBeli
|
||||
];
|
||||
|
||||
$this->load->view('master/Beli', $data);
|
||||
}
|
||||
|
||||
public function add()
|
||||
{
|
||||
$username = $this->session->userdata('username');
|
||||
if ($username == null) {
|
||||
redirect("Login");
|
||||
}
|
||||
$datBeli = $this->MBeli->getDataBeli();
|
||||
$datSupplier = $this->MSupplier->getDataSupplier();
|
||||
$datBarang = $this->MBarang->getDataBarang();
|
||||
$data = [
|
||||
'sidebar' => "data proses pembelian",
|
||||
'navChild' => "data proses purchasing",
|
||||
'beli' => $datBeli,
|
||||
'supplier' => $datSupplier,
|
||||
'barang' => $datBarang
|
||||
];
|
||||
$this->load->view('proses/TambahBeli', $data);
|
||||
}
|
||||
|
||||
public function save()
|
||||
{
|
||||
$method = $this->input->post('method');
|
||||
$id_beli = $this->input->post('id');
|
||||
$supplier = $this->input->post('SUPPLIER');
|
||||
$barang = $this->input->post('BARANG');
|
||||
$po_beli = $this->input->post('po_beli');
|
||||
$tanggal_beli = $this->input->post('tanggal_beli');
|
||||
$jumlah_beli = $this->input->post('jumlah_beli');
|
||||
|
||||
$this->form_validation->set_rules('SUPPLIER', 'Pilih Supplier', 'required');
|
||||
$this->form_validation->set_rules('BARANG', 'Pilih Barang', 'required');
|
||||
$this->form_validation->set_rules('po_beli', 'Nomor PO', 'required');
|
||||
|
||||
if ($this->form_validation->run() == FALSE) {
|
||||
$data = [
|
||||
'status' => false,
|
||||
'errors' => [
|
||||
'SUPPLIER' => form_error('SUPPLIER'),
|
||||
'BARANG' => form_error('BARANG'),
|
||||
'po_beli' => form_error('po_beli')
|
||||
]
|
||||
];
|
||||
$this->session->set_flashdata('flashgagal', 'ditambah');
|
||||
redirect('ManageBeli');
|
||||
|
||||
} else {
|
||||
|
||||
$input = [
|
||||
'SUPPLIER_ID' => $supplier,
|
||||
'BARANG_ID' => $barang,
|
||||
'PO_BELI' => $po_beli,
|
||||
'TANGGAL_BELI' => $tanggal_beli,
|
||||
'JUMLAH_BELI' => $jumlah_beli
|
||||
];
|
||||
$input2 = [
|
||||
'BARANG_ID' => $barang,
|
||||
'JUMLAH_INVENTORY' => $jumlah_beli,
|
||||
'GUDANG_ID' => '1'
|
||||
];
|
||||
|
||||
$action = $this->MBeli->create('beli', $input);
|
||||
$action2 = $this->MBeli->create('inventory', $input2);
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('flash', 'ditambah');
|
||||
redirect('ManageBeli');
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'ditambah');
|
||||
redirect('ManageBeli');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function hapus()
|
||||
{
|
||||
$id = $this->input->post('id');
|
||||
$action1 = $this->MBeli->delete('beli', $id, 'ID_BELI');
|
||||
$action2 = $this->MBeli->delete('inventory', $id, 'ID_INVENTORY');
|
||||
|
||||
if ($action1) {
|
||||
$this->session->set_flashdata('flash', 'dihapus');
|
||||
redirect('ManageBeli');
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'dihapus');
|
||||
redirect('ManageBeli');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
<?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');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
class ManageClaim extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('ModelProgress', 'MP');
|
||||
$this->load->model('ModelService', 'MS');
|
||||
$this->load->model('ModelAgen', 'MA');
|
||||
$this->load->model('ModelClaim', 'MC');
|
||||
$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()
|
||||
{
|
||||
|
||||
$datProgress = $this->MP->getDataProgress();
|
||||
$datService = $this->MS->getDataServiceClaim();
|
||||
$datClaim = $this->MC->getViewClaim();
|
||||
$datAgen = $this->MA->getDataAgen();
|
||||
|
||||
$data = [
|
||||
'sidebar' => "data claim service",
|
||||
'navChild' => "data claim input",
|
||||
'claim' => $datClaim,
|
||||
'service' => $datService,
|
||||
'agen' => $datAgen
|
||||
];
|
||||
|
||||
$this->load->view('master/Claim', $data);
|
||||
}
|
||||
|
||||
public function edit()
|
||||
{
|
||||
$method = $this->input->post('method');
|
||||
$id_garansi = $this->input->post('id_garansi');
|
||||
$id_agen = $this->input->post('id_agened');
|
||||
$id_service = $this->input->post('id_serviceed');
|
||||
$nolap_garansi = $this->input->post('nolap_garansi');
|
||||
$keterangan_garansi = $this->input->post('keterangan_garansi');
|
||||
|
||||
$input = [
|
||||
'NOLAP_GARANSI' => $nolap_garansi,
|
||||
'AGEN_ID' => $id_agen,
|
||||
'KETERANGAN_GARANSI' => $keterangan_garansi,
|
||||
'TANGGAL_GARANSI' => date('Y-m-d H:i:s'),
|
||||
'STATUS_GARANSI' => "Proses Claim"
|
||||
];
|
||||
|
||||
$action = $this->MC->update('garansi', $input,'ID_GARANSI',$id_garansi);
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('flash', 'diproses');
|
||||
redirect('ManageClaim');
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'diproses');
|
||||
redirect('ManageClaim');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,117 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
class ManageConfigNB extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('ModelSn', 'MSn');
|
||||
$this->load->model('ModelType', 'MType');
|
||||
$this->load->model('ModelProcessor', 'MProcessor');
|
||||
$this->load->model('ModelRam', 'MRam');
|
||||
$this->load->model('ModelHarddisk', 'MHarddisk');
|
||||
$this->load->model('ModelSsd', 'MSsd');
|
||||
$this->load->model('ModelVga', 'MVga');
|
||||
$this->load->model('ModelOs', 'MOs');
|
||||
$this->load->model('ModelDvd', 'MDvd');
|
||||
$this->load->model('ModelWarna', 'MWarna');
|
||||
$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("Login");
|
||||
} elseif ($jabatan != "ADMIN") {
|
||||
redirect("Login");
|
||||
}
|
||||
|
||||
$datSn = $this->MSn->getDataSn();
|
||||
|
||||
$data = [
|
||||
'sidebar' => "data master",
|
||||
'navChild' => "data sn",
|
||||
'sn' => $datSn
|
||||
];
|
||||
|
||||
$this->load->view('sn/table-sn', $data);
|
||||
}
|
||||
|
||||
public function add()
|
||||
{
|
||||
$username = $this->session->userdata('username');
|
||||
if ($username == null) {
|
||||
redirect("Login");
|
||||
}
|
||||
$datSn = $this->MSn->getDataSn();
|
||||
$datInvoice = $this->MInvoice->getDataInvoice();
|
||||
$datSGudang = $this->MSGudang->getDataSGudang();
|
||||
$datSPenjualan = $this->MSPenjualan->getDataSPenjualan();
|
||||
$data = [
|
||||
'sidebar' => "data master",
|
||||
'navChild' => "data sn",
|
||||
'sn' => $datSn,
|
||||
'invoice' => $datInvoice,
|
||||
'sgudang' => $datSGudang,
|
||||
'spenjualan' => $datSPenjualan
|
||||
|
||||
];
|
||||
$this->load->view('sn/sn-tambah', $data);
|
||||
}
|
||||
|
||||
public function save()
|
||||
{
|
||||
$method = $this->input->post('method');
|
||||
$no_sn = $this->input->post('no_sn');
|
||||
$no_invoice = $this->input->post('no_invoice');
|
||||
|
||||
$this->form_validation->set_rules('no_sn', 'Nomor SN', 'required');
|
||||
$this->form_validation->set_rules('no_invoice', 'Nomor Invoice', 'required');
|
||||
|
||||
if ($this->form_validation->run() == FALSE) {
|
||||
$data = [
|
||||
'status' => false,
|
||||
'errors' => [
|
||||
'no_sn' => form_error('no_sn'),
|
||||
'no_invoice' => form_error('no_invoice')
|
||||
]
|
||||
];
|
||||
$this->output_json($data);
|
||||
} else {
|
||||
$input = [
|
||||
'NO_SN' => $no_sn,
|
||||
'ID_INVOICE' => $no_invoice,
|
||||
'ID_STATUSGUDANG' => '1',
|
||||
'ID_STATUSPENJUALAN' => '1'
|
||||
];
|
||||
|
||||
$action = $this->MSn->create('sn', $input);
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('flash', 'ditambah');
|
||||
redirect('ManageSn');
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'ditambah');
|
||||
redirect('ManageSn');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function hapus()
|
||||
{
|
||||
$id = $this->input->post('id');
|
||||
if ($this->MSn->delete('sn', $id, 'ID_SN')) {
|
||||
$this->session->set_flashdata('flash', 'dihapus');
|
||||
redirect('ManageSn');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,114 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
class ManageConfigPC extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('ModelSn', 'MSn');
|
||||
$this->load->model('ModelType', 'MType');
|
||||
$this->load->model('ModelProcessor', 'MProcessor');
|
||||
$this->load->model('ModelRam', 'MRam');
|
||||
$this->load->model('ModelHarddisk', 'MHarddisk');
|
||||
$this->load->model('ModelSsd', 'MSsd');
|
||||
$this->load->model('ModelVga', 'MVga');
|
||||
$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("Login");
|
||||
} elseif ($jabatan != "ADMIN") {
|
||||
redirect("Login");
|
||||
}
|
||||
|
||||
$datSn = $this->MSn->getDataSn();
|
||||
|
||||
$data = [
|
||||
'sidebar' => "data master",
|
||||
'navChild' => "data sn",
|
||||
'sn' => $datSn
|
||||
];
|
||||
|
||||
$this->load->view('sn/table-sn', $data);
|
||||
}
|
||||
|
||||
public function add()
|
||||
{
|
||||
$username = $this->session->userdata('username');
|
||||
if ($username == null) {
|
||||
redirect("Login");
|
||||
}
|
||||
$datSn = $this->MSn->getDataSn();
|
||||
$datInvoice = $this->MInvoice->getDataInvoice();
|
||||
$datSGudang = $this->MSGudang->getDataSGudang();
|
||||
$datSPenjualan = $this->MSPenjualan->getDataSPenjualan();
|
||||
$data = [
|
||||
'sidebar' => "data master",
|
||||
'navChild' => "data sn",
|
||||
'sn' => $datSn,
|
||||
'invoice' => $datInvoice,
|
||||
'sgudang' => $datSGudang,
|
||||
'spenjualan' => $datSPenjualan
|
||||
|
||||
];
|
||||
$this->load->view('sn/sn-tambah', $data);
|
||||
}
|
||||
|
||||
public function save()
|
||||
{
|
||||
$method = $this->input->post('method');
|
||||
$no_sn = $this->input->post('no_sn');
|
||||
$no_invoice = $this->input->post('no_invoice');
|
||||
|
||||
$this->form_validation->set_rules('no_sn', 'Nomor SN', 'required');
|
||||
$this->form_validation->set_rules('no_invoice', 'Nomor Invoice', 'required');
|
||||
|
||||
if ($this->form_validation->run() == FALSE) {
|
||||
$data = [
|
||||
'status' => false,
|
||||
'errors' => [
|
||||
'no_sn' => form_error('no_sn'),
|
||||
'no_invoice' => form_error('no_invoice')
|
||||
]
|
||||
];
|
||||
$this->output_json($data);
|
||||
} else {
|
||||
$input = [
|
||||
'NO_SN' => $no_sn,
|
||||
'ID_INVOICE' => $no_invoice,
|
||||
'ID_STATUSGUDANG' => '1',
|
||||
'ID_STATUSPENJUALAN' => '1'
|
||||
];
|
||||
|
||||
$action = $this->MSn->create('sn', $input);
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('flash', 'ditambah');
|
||||
redirect('ManageSn');
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'ditambah');
|
||||
redirect('ManageSn');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function hapus()
|
||||
{
|
||||
$id = $this->input->post('id');
|
||||
if ($this->MSn->delete('sn', $id, 'ID_SN')) {
|
||||
$this->session->set_flashdata('flash', 'dihapus');
|
||||
redirect('ManageSn');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,122 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
class ManageConfigSRV extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('ModelSn', 'MSn');
|
||||
$this->load->model('ModelType', 'MType');
|
||||
$this->load->model('ModelProcessor', 'MProcessor');
|
||||
$this->load->model('ModelRam', 'MRam');
|
||||
$this->load->model('ModelHarddisk', 'MHarddisk');
|
||||
$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("Login");
|
||||
} elseif ($jabatan != "ADMIN") {
|
||||
redirect("Login");
|
||||
}
|
||||
|
||||
$datSn = $this->MSn->getDataSn();
|
||||
$datType = $this->MType->getDataType();
|
||||
$datProcessor = $this->MProcessor->getDataProcessor();
|
||||
$datRam = $this->MRam->getDataRam();
|
||||
$datHarddisk = $this->MHarddisk->getDataHarddisk();
|
||||
|
||||
$data = [
|
||||
'sidebar' => "data master",
|
||||
'navChild' => "data config srv",
|
||||
'sn' => $datSn,
|
||||
'type' => $datType,
|
||||
'processor' => $datProcessor,
|
||||
'ram' => $datRam,
|
||||
'harddisk' => $datHarddisk
|
||||
];
|
||||
|
||||
$this->load->view('config/table-server', $data);
|
||||
}
|
||||
|
||||
public function add()
|
||||
{
|
||||
$username = $this->session->userdata('username');
|
||||
if ($username == null) {
|
||||
redirect("Login");
|
||||
}
|
||||
$datSn = $this->MSn->getDataSn();
|
||||
$datType = $this->MType->getDataType();
|
||||
$datProcessor = $this->MProcessor->getDataProcessor();
|
||||
$datRam = $this->MRam->getDataRam();
|
||||
$datHarddisk = $this->MHarddisk->getDataHarddisk();
|
||||
$data = [
|
||||
'sidebar' => "data master",
|
||||
'navChild' => "data config srv",
|
||||
'sn' => $datSn,
|
||||
'type' => $datType,
|
||||
'processor' => $datProcessor,
|
||||
'ram' => $datRam,
|
||||
'harddisk' => $datHarddisk
|
||||
|
||||
];
|
||||
$this->load->view('config/server-tambah', $data);
|
||||
}
|
||||
|
||||
public function save()
|
||||
{
|
||||
$method = $this->input->post('method');
|
||||
$no_sn = $this->input->post('no_sn');
|
||||
$no_invoice = $this->input->post('no_invoice');
|
||||
|
||||
$this->form_validation->set_rules('no_sn', 'Nomor SN', 'required');
|
||||
$this->form_validation->set_rules('no_invoice', 'Nomor Invoice', 'required');
|
||||
|
||||
if ($this->form_validation->run() == FALSE) {
|
||||
$data = [
|
||||
'status' => false,
|
||||
'errors' => [
|
||||
'no_sn' => form_error('no_sn'),
|
||||
'no_invoice' => form_error('no_invoice')
|
||||
]
|
||||
];
|
||||
$this->output_json($data);
|
||||
} else {
|
||||
$input = [
|
||||
'NO_SN' => $no_sn,
|
||||
'ID_INVOICE' => $no_invoice,
|
||||
'ID_STATUSGUDANG' => '1',
|
||||
'ID_STATUSPENJUALAN' => '1'
|
||||
];
|
||||
|
||||
$action = $this->MSn->create('sn', $input);
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('flash', 'ditambah');
|
||||
redirect('ManageSn');
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'ditambah');
|
||||
redirect('ManageSn');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function hapus()
|
||||
{
|
||||
$id = $this->input->post('id');
|
||||
if ($this->MSn->delete('sn', $id, 'ID_SN')) {
|
||||
$this->session->set_flashdata('flash', 'dihapus');
|
||||
redirect('ManageSn');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
class ManageDistributor extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('ModelDistributor','MDistributor');
|
||||
$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");
|
||||
}
|
||||
|
||||
$datDistributor = $this->MDistributor->getDataDistributor();
|
||||
|
||||
$data = [
|
||||
'sidebar' => "data list 2",
|
||||
'navChild' => "data list distributor",
|
||||
'distributor' => $datDistributor
|
||||
];
|
||||
|
||||
$this->load->view('list/table-listdistributor', $data);
|
||||
}
|
||||
|
||||
public function save()
|
||||
{
|
||||
$method = $this->input->post('method');
|
||||
$id_distributor = $this->input->post('id');
|
||||
$nama = $this->input->post('nama');
|
||||
|
||||
$this->form_validation->set_rules('nama', 'Nama', 'required');
|
||||
if ($this->form_validation->run() == FALSE) {
|
||||
$data = [
|
||||
'status' => false,
|
||||
'errors' => [
|
||||
'nama' => form_error('nama')
|
||||
|
||||
]
|
||||
];
|
||||
$this->output_json($data);
|
||||
} else {
|
||||
|
||||
$input = [
|
||||
'NAMA_DISTRIBUTOR' => $nama
|
||||
|
||||
];
|
||||
|
||||
if ($method === 'add') {
|
||||
$action = $this->MDistributor->create('distributor', $input);
|
||||
} else if ($method === 'edit') {
|
||||
$action = $this->MDistributor->update('distributor', $input, 'ID_DISTRIBUTOR', $id_distributor);
|
||||
}
|
||||
|
||||
if ($action) {
|
||||
if ($method === 'add') {
|
||||
$this->output_json(['status' => true]);
|
||||
} else if ($method === 'edit') {
|
||||
redirect('ManageDistributor');
|
||||
}
|
||||
} else {
|
||||
$this->output_json(['status' => false]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function hapus()
|
||||
{
|
||||
$id = $this->input->post('id');
|
||||
if ($this->MDistributor->delete('distributor', $id, 'ID_DISTRIBUTOR')) {
|
||||
redirect('ManageDistributor');
|
||||
}
|
||||
}
|
||||
|
||||
// public function add(){
|
||||
// $username = $this->session->userdata('username');
|
||||
// if ($username == null){
|
||||
// redirect("Action");
|
||||
// }
|
||||
|
||||
// $this->load->view('tambah-user');
|
||||
// }
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
use Restserver\Libraries\REST_Controller;
|
||||
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
require APPPATH . 'libraries/REST_Controller.php';
|
||||
require APPPATH . 'libraries/Format.php';
|
||||
|
||||
class ManageDpPajak extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('ModelDpPajak', 'DpPajak');
|
||||
$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()
|
||||
{
|
||||
$dppajak = $this->DpPajak->getDataDpPajak();
|
||||
|
||||
$data = [
|
||||
'sidebar' => "menu accounting",
|
||||
'navChild' => "",
|
||||
'dppajak' => $dppajak
|
||||
];
|
||||
|
||||
$this->load->view('proses/DpPajak', $data);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,233 @@
|
||||
<?php
|
||||
|
||||
use Restserver\Libraries\REST_Controller;
|
||||
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
require APPPATH . 'libraries/REST_Controller.php';
|
||||
require APPPATH . 'libraries/Format.php';
|
||||
|
||||
class ManageDpPembelian extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('ModelDpPembelian', 'DpPembelian');
|
||||
$this->load->model('ModelHutangDagang', 'Hda');
|
||||
$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()
|
||||
{
|
||||
$dppembelian = $this->DpPembelian->getDataDpPembelian();
|
||||
$hda = $this->Hda->getDataHutangDagangDetail();
|
||||
|
||||
$data = [
|
||||
'sidebar' => "menu accounting",
|
||||
'navChild' => "",
|
||||
'dppembelian' => $dppembelian,
|
||||
'hda' => $hda
|
||||
];
|
||||
|
||||
$this->load->view('proses/DpPembelian', $data);
|
||||
}
|
||||
|
||||
//Step Two, Input Transaksi
|
||||
public function tambahTransaksi($id) {
|
||||
$transaksi = $this->DpPembelian->getDataDetailDpPembelian($id);
|
||||
$title = $this->DpPembelian->getTitleDPB($id);
|
||||
$id_supplier = $this->Hda->getDataDPB($id);
|
||||
$id_supplier = $id_supplier[0]['SUPPLIER_ID'];
|
||||
$hda = $this->Hda->getDataHutangDagangDPB($id_supplier);
|
||||
$data = [
|
||||
'sidebar' => "menu accounting",
|
||||
'navChild' => "",
|
||||
'transaksi' => $transaksi,
|
||||
'id_dpb' => $id,
|
||||
'title1' => $title[0]['KODE_DPB'],
|
||||
'title2' => $title[0]['DEBIT'],
|
||||
'title3' => $title[0]['KREDIT'],
|
||||
'hda' => $hda
|
||||
];
|
||||
|
||||
$this->load->view('proses/DetailDpPembelian', $data);
|
||||
}
|
||||
|
||||
public function kodeDetailDPB() {
|
||||
$kk = $this->DpPembelian->getKodeDetailDPB();
|
||||
if (is_array($kk) || is_object($kk)) {
|
||||
foreach ($kk as $row) {
|
||||
if ($row['KODE'] == null) {
|
||||
return "DDPB/000001";
|
||||
} else {
|
||||
$str = (string) $row['KODE'];
|
||||
$panjang = 6;
|
||||
$data = substr($str, 5, $panjang);
|
||||
|
||||
$ko = (int) $data + 1;
|
||||
$str = (string) $ko;
|
||||
|
||||
$panjang = 11 - strlen($str);
|
||||
$data = "DDPB/000000";
|
||||
$data = substr($data, 0, $panjang) . $str;
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function kodeDetailHDA() {
|
||||
$kk = $this->DpPembelian->getKodeDetailHDA();
|
||||
if (is_array($kk) || is_object($kk)) {
|
||||
foreach ($kk as $row) {
|
||||
if ($row['KODE'] == null) {
|
||||
return "DHDA/000001";
|
||||
} else {
|
||||
$str = (string) $row['KODE'];
|
||||
$panjang = 6;
|
||||
$data = substr($str, 5, $panjang);
|
||||
|
||||
$ko = (int) $data + 1;
|
||||
$str = (string) $ko;
|
||||
|
||||
$panjang = 11 - strlen($str);
|
||||
$data = "DHDA/000000";
|
||||
$data = substr($data, 0, $panjang) . $str;
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function savetransaksi() {
|
||||
//Step Input Transaksi
|
||||
$method = $this->input->post('method');
|
||||
$id_ddpb = $this->input->post('id');
|
||||
$id_dpb = $this->input->post('id_dpb');
|
||||
$id_hda = $this->input->post('id_hda');
|
||||
$debit_ddpb = $this->input->post('debit_ddpb');
|
||||
$kode_ddpb = $this->kodeDetailDPB();
|
||||
$kode_dhda = $this->kodeDetailHDA();
|
||||
|
||||
$datadpb = $this->DpPembelian->getDataDpPembelian($id_dpb);
|
||||
$nominal_dpb = $datadpb[0]['NOMINAL_DPB'];
|
||||
$blockcon_dpb = $datadpb[0]['BLOCKCON'];
|
||||
$id_supplier = $datadpb[0]['SUPPLIER_ID'];
|
||||
$sisa1 = $nominal_dpb-$blockcon_dpb;
|
||||
$datahda = $this->DpPembelian->getDataHutangDagang($id_hda);
|
||||
$nominal_hda = $datahda[0]['NOMINAL_HDA'];
|
||||
$blockcon_hda = $datahda[0]['BLOCKCON'];
|
||||
$sisa2 = $nominal_hda-$blockcon_hda;
|
||||
|
||||
if ($sisa1<$debit_ddpb) {
|
||||
$this->session->set_flashdata('flashdpb', 'ditambah');
|
||||
redirect($_SERVER['HTTP_REFERER']);
|
||||
}
|
||||
|
||||
if ($sisa2<$debit_ddpb) {
|
||||
$this->session->set_flashdata('flashhda', 'ditambah');
|
||||
redirect($_SERVER['HTTP_REFERER']);
|
||||
}
|
||||
|
||||
$input = [
|
||||
'DPB_ID' => $id_dpb,
|
||||
'HDA_ID' => $id_hda,
|
||||
'DEBIT_DDPB' => $debit_ddpb,
|
||||
'KODE_DDPB' => $kode_ddpb
|
||||
];
|
||||
$action = $this->DpPembelian->create('detail_dpb', $input);
|
||||
$input = [
|
||||
'KODE_BUKTI' => $kode_ddpb,
|
||||
'HDA_ID' => $id_hda,
|
||||
'DEBIT_DHDA' => $debit_ddpb,
|
||||
'KODE_DHDA' => $kode_dhda
|
||||
];
|
||||
$action = $this->DpPembelian->create('detail_hda', $input);
|
||||
|
||||
//Step Ambil Data Lama
|
||||
$id_ddpb = $this->DpPembelian->getIDDDPB();
|
||||
$id_dhda = $this->DpPembelian->getIDDHDA();
|
||||
$datadpb = $this->DpPembelian->getDataDPB($id_ddpb[0]['ID_DDPB']);
|
||||
$blockcon_dpb = $datadpb[0]['BLOCKCON'];
|
||||
$blockcon_dpb = $blockcon_dpb+$debit_ddpb;
|
||||
$datahda = $this->DpPembelian->getDataHDA($id_dhda[0]['ID_DHDA']);
|
||||
$blockcon_hda = $datahda[0]['BLOCKCON'];
|
||||
$blockcon_hda = $blockcon_hda+$debit_ddpb;
|
||||
$datasupplier = $this->DpPembelian->getDataSupplier($id_supplier);
|
||||
$piutang_supplier = $datasupplier[0]['PIUTANG_SUPPLIER'];
|
||||
$saldo_supplier = $datasupplier[0]['SALDO_SUPPLIER'];
|
||||
$piutang_supplier = $piutang_supplier-$debit_ddpb;
|
||||
$saldo_supplier = $saldo_supplier-$debit_ddpb;
|
||||
$update = [
|
||||
'BLOCKCON' => $blockcon_dpb
|
||||
];
|
||||
$action = $this->DpPembelian->update('dp_pembelian', $update, 'ID_DPB', $id_dpb);
|
||||
$update = [
|
||||
'BLOCKCON' => $blockcon_hda
|
||||
];
|
||||
$action = $this->DpPembelian->update('hutang_dagang', $update, 'ID_HDA', $id_hda);
|
||||
$update = [
|
||||
'PIUTANG_SUPPLIER' => $piutang_supplier,
|
||||
'SALDO_SUPPLIER' => $saldo_supplier
|
||||
];
|
||||
$action = $this->DpPembelian->update('supplier', $update, 'ID_SUPPLIER', $id_supplier);
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('flash', 'ditambah');
|
||||
redirect($_SERVER['HTTP_REFERER']);
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'ditambah');
|
||||
redirect($_SERVER['HTTP_REFERER']);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function resetdpb() {
|
||||
$id = $this->input->post('id');
|
||||
|
||||
//Step Reset Saldo Data Blockcon di DPB dan HDA
|
||||
$dataddpb = $this->DpPembelian->getDataDDPB($id);
|
||||
$id_dpb = $dataddpb[0]['DPB_ID'];
|
||||
$id_hda = $dataddpb[0]['HDA_ID'];
|
||||
$debit_ddpb = $dataddpb[0]['DEBIT_DDPB'];
|
||||
$kode_ddpb = $dataddpb[0]['KODE_DDPB'];
|
||||
$datadpb = $this->DpPembelian->getDpPembelian($id_dpb);
|
||||
$id_supplier = $datadpb[0]['SUPPLIER_ID'];
|
||||
$blockcon_dpb = $datadpb[0]['BLOCKCON'];
|
||||
$blockcon_dpb = $blockcon_dpb-$debit_ddpb;
|
||||
$datahda = $this->DpPembelian->getDataHutangDagang($id_hda);
|
||||
$blockcon_hda = $datahda[0]['BLOCKCON'];
|
||||
$blockcon_hda = $blockcon_hda-$debit_ddpb;
|
||||
$datasupplier = $this->DpPembelian->getDataSupplier($id_supplier);
|
||||
$piutang_supplier = $datasupplier[0]['PIUTANG_SUPPLIER'];
|
||||
$saldo_supplier = $datasupplier[0]['SALDO_SUPPLIER'];
|
||||
$piutang_supplier = $piutang_supplier+$debit_ddpb;
|
||||
$saldo_supplier = $saldo_supplier+$debit_ddpb;
|
||||
$update = [
|
||||
'BLOCKCON' => $blockcon_dpb
|
||||
];
|
||||
$action = $this->DpPembelian->update('dp_pembelian', $update, 'ID_DPB', $id_dpb);
|
||||
$update = [
|
||||
'BLOCKCON' => $blockcon_hda
|
||||
];
|
||||
$action = $this->DpPembelian->update('hutang_dagang', $update, 'ID_HDA', $id_hda);
|
||||
$update = [
|
||||
'PIUTANG_SUPPLIER' => $piutang_supplier,
|
||||
'SALDO_SUPPLIER' => $saldo_supplier
|
||||
];
|
||||
$action = $this->DpPembelian->update('supplier', $update, 'ID_SUPPLIER', $id_supplier);
|
||||
|
||||
//Step Hapus Data
|
||||
$action = $this->DpPembelian->delete('detail_dpb',$id,'ID_DDPB');
|
||||
$action = $this->DpPembelian->hapusDetailHda($kode_ddpb);
|
||||
|
||||
$this->session->set_flashdata('flash', 'direset');
|
||||
redirect($_SERVER['HTTP_REFERER']);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,233 @@
|
||||
<?php
|
||||
|
||||
use Restserver\Libraries\REST_Controller;
|
||||
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
require APPPATH . 'libraries/REST_Controller.php';
|
||||
require APPPATH . 'libraries/Format.php';
|
||||
|
||||
class ManageDpPenjualan extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('ModelDpPenjualan', 'DpPenjualan');
|
||||
$this->load->model('ModelPiutangDagang', 'Pda');
|
||||
$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()
|
||||
{
|
||||
$dppenjualan = $this->DpPenjualan->getDataDpPenjualan();
|
||||
$pda = $this->Pda->getDataPiutangDagangDetail();
|
||||
|
||||
$data = [
|
||||
'sidebar' => "menu accounting",
|
||||
'navChild' => "",
|
||||
'dppenjualan' => $dppenjualan,
|
||||
'pda' => $pda
|
||||
];
|
||||
|
||||
$this->load->view('proses/DpPenjualan', $data);
|
||||
}
|
||||
|
||||
//Step Two, Input Transaksi
|
||||
public function tambahTransaksi($id) {
|
||||
$transaksi = $this->DpPenjualan->getDataDetailDpPenjualan($id);
|
||||
$title = $this->DpPenjualan->getTitleDPJ($id);
|
||||
$id_pelanggan = $this->Pda->getDataDPJ($id);
|
||||
$id_pelanggan = $id_pelanggan[0]['PELANGGAN_ID'];
|
||||
$pda = $this->Pda->getDataPiutangDagangDPJ($id_pelanggan);
|
||||
$data = [
|
||||
'sidebar' => "menu accounting",
|
||||
'navChild' => "",
|
||||
'transaksi' => $transaksi,
|
||||
'id_dpj' => $id,
|
||||
'title1' => $title[0]['KODE_DPJ'],
|
||||
'title2' => $title[0]['DEBIT'],
|
||||
'title3' => $title[0]['KREDIT'],
|
||||
'pda' => $pda
|
||||
];
|
||||
|
||||
$this->load->view('proses/DetailDpPenjualan', $data);
|
||||
}
|
||||
|
||||
public function kodeDetailDPJ() {
|
||||
$kk = $this->DpPenjualan->getKodeDetailDPJ();
|
||||
if (is_array($kk) || is_object($kk)) {
|
||||
foreach ($kk as $row) {
|
||||
if ($row['KODE'] == null) {
|
||||
return "DDPJ/000001";
|
||||
} else {
|
||||
$str = (string) $row['KODE'];
|
||||
$panjang = 6;
|
||||
$data = substr($str, 5, $panjang);
|
||||
|
||||
$ko = (int) $data + 1;
|
||||
$str = (string) $ko;
|
||||
|
||||
$panjang = 11 - strlen($str);
|
||||
$data = "DDPJ/000000";
|
||||
$data = substr($data, 0, $panjang) . $str;
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function kodeDetailPDA() {
|
||||
$kk = $this->DpPenjualan->getKodeDetailPDA();
|
||||
if (is_array($kk) || is_object($kk)) {
|
||||
foreach ($kk as $row) {
|
||||
if ($row['KODE'] == null) {
|
||||
return "DPDA/000001";
|
||||
} else {
|
||||
$str = (string) $row['KODE'];
|
||||
$panjang = 6;
|
||||
$data = substr($str, 5, $panjang);
|
||||
|
||||
$ko = (int) $data + 1;
|
||||
$str = (string) $ko;
|
||||
|
||||
$panjang = 11 - strlen($str);
|
||||
$data = "DPDA/000000";
|
||||
$data = substr($data, 0, $panjang) . $str;
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function savetransaksi() {
|
||||
//Step Input Transaksi
|
||||
$method = $this->input->post('method');
|
||||
$id_ddpj = $this->input->post('id');
|
||||
$id_dpj = $this->input->post('id_dpj');
|
||||
$id_pda = $this->input->post('id_pda');
|
||||
$kredit_ddpj = $this->input->post('kredit_ddpj');
|
||||
$kode_ddpj = $this->kodeDetailDPJ();
|
||||
$kode_dpda = $this->kodeDetailPDA();
|
||||
|
||||
$datadpj = $this->DpPenjualan->getDataDpPenjualan($id_dpj);
|
||||
$nominal_dpj = $datadpj[0]['NOMINAL_DPJ'];
|
||||
$blockcon_dpj = $datadpj[0]['BLOCKCON'];
|
||||
$id_pelanggan = $datadpj[0]['PELANGGAN_ID'];
|
||||
$sisa1 = $nominal_dpj-$blockcon_dpj;
|
||||
$datapda = $this->DpPenjualan->getDataPiutangDagang($id_pda);
|
||||
$nominal_pda = $datapda[0]['NOMINAL_PDA'];
|
||||
$blockcon_pda = $datapda[0]['BLOCKCON'];
|
||||
$sisa2 = $nominal_pda-$blockcon_pda;
|
||||
|
||||
if ($sisa1<$kredit_ddpj) {
|
||||
$this->session->set_flashdata('flashdpj', 'ditambah');
|
||||
redirect($_SERVER['HTTP_REFERER']);
|
||||
}
|
||||
|
||||
if ($sisa2<$kredit_ddpj) {
|
||||
$this->session->set_flashdata('flashpda', 'ditambah');
|
||||
redirect($_SERVER['HTTP_REFERER']);
|
||||
}
|
||||
|
||||
$input = [
|
||||
'DPJ_ID' => $id_dpj,
|
||||
'PDA_ID' => $id_pda,
|
||||
'KREDIT_DDPJ' => $kredit_ddpj,
|
||||
'KODE_DDPJ' => $kode_ddpj
|
||||
];
|
||||
$action = $this->DpPenjualan->create('detail_dpj', $input);
|
||||
$input = [
|
||||
'KODE_BUKTI' => $kode_ddpj,
|
||||
'PDA_ID' => $id_pda,
|
||||
'KREDIT_DPDA' => $kredit_ddpj,
|
||||
'KODE_DPDA' => $kode_dpda
|
||||
];
|
||||
$action = $this->DpPenjualan->create('detail_pda', $input);
|
||||
|
||||
//Step Ambil Data Lama
|
||||
$id_ddpj = $this->DpPenjualan->getIDDDPJ();
|
||||
$id_dpda = $this->DpPenjualan->getIDDPDA();
|
||||
$datadpj = $this->DpPenjualan->getDataDPJ($id_ddpj[0]['ID_DDPJ']);
|
||||
$blockcon_dpj = $datadpj[0]['BLOCKCON'];
|
||||
$blockcon_dpj = $blockcon_dpj+$kredit_ddpj;
|
||||
$datapda = $this->DpPenjualan->getDataPDA($id_dpda[0]['ID_DPDA']);
|
||||
$blockcon_pda = $datapda[0]['BLOCKCON'];
|
||||
$blockcon_pda = $blockcon_pda+$kredit_ddpj;
|
||||
$datapelanggan = $this->DpPenjualan->getDataPelanggan($id_pelanggan);
|
||||
$saldo_pelanggan = $datapelanggan[0]['SALDO_PELANGGAN'];
|
||||
$hutang_pelanggan = $datapelanggan[0]['HUTANG_PELANGGAN'];
|
||||
$saldo_pelanggan = $saldo_pelanggan-$kredit_ddpj;
|
||||
$hutang_pelanggan = $hutang_pelanggan-$kredit_ddpj;
|
||||
$update = [
|
||||
'BLOCKCON' => $blockcon_dpj
|
||||
];
|
||||
$action = $this->DpPenjualan->update('dp_penjualan', $update, 'ID_DPJ', $id_dpj);
|
||||
$update = [
|
||||
'BLOCKCON' => $blockcon_pda
|
||||
];
|
||||
$action = $this->DpPenjualan->update('piutang_dagang', $update, 'ID_PDA', $id_pda);
|
||||
$update = [
|
||||
'HUTANG_PELANGGAN' => $hutang_pelanggan,
|
||||
'SALDO_PELANGGAN' => $saldo_pelanggan
|
||||
];
|
||||
$action = $this->DpPenjualan->update('pelanggan', $update, 'ID_PELANGGAN', $id_pelanggan);
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('flash', 'ditambah');
|
||||
redirect($_SERVER['HTTP_REFERER']);
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'ditambah');
|
||||
redirect($_SERVER['HTTP_REFERER']);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function resetdpj() {
|
||||
$id = $this->input->post('id');
|
||||
|
||||
//Step Reset Saldo Data Blockcon di DPJ dan PDA
|
||||
$dataddpj = $this->DpPenjualan->getDataDDPJ($id);
|
||||
$id_dpj = $dataddpj[0]['DPJ_ID'];
|
||||
$id_pda = $dataddpj[0]['PDA_ID'];
|
||||
$kredit_ddpj = $dataddpj[0]['KREDIT_DDPJ'];
|
||||
$kode_ddpj = $dataddpj[0]['KODE_DDPJ'];
|
||||
$datadpj = $this->DpPenjualan->getDpPenjualan($id_dpj);
|
||||
$id_pelanggan = $datadpj[0]['PELANGGAN_ID'];
|
||||
$blockcon_dpj = $datadpj[0]['BLOCKCON'];
|
||||
$blockcon_dpj = $blockcon_dpj-$kredit_ddpj;
|
||||
$datapda = $this->DpPenjualan->getDataPiutangDagang($id_pda);
|
||||
$blockcon_pda = $datapda[0]['BLOCKCON'];
|
||||
$blockcon_pda = $blockcon_pda-$kredit_ddpj;
|
||||
$datapelanggan = $this->DpPenjualan->getDataPelanggan($id_pelanggan);
|
||||
$hutang_pelanggan = $datapelanggan[0]['HUTANG_PELANGGAN'];
|
||||
$saldo_pelanggan = $datapelanggan[0]['SALDO_PELANGGAN'];
|
||||
$hutang_pelanggan = $hutang_pelanggan+$kredit_ddpj;
|
||||
$saldo_pelanggan = $saldo_pelanggan+$kredit_ddpj;
|
||||
$update = [
|
||||
'BLOCKCON' => $blockcon_dpj
|
||||
];
|
||||
$action = $this->DpPenjualan->update('dp_penjualan', $update, 'ID_DPJ', $id_dpj);
|
||||
$update = [
|
||||
'BLOCKCON' => $blockcon_pda
|
||||
];
|
||||
$action = $this->DpPenjualan->update('piutang_dagang', $update, 'ID_PDA', $id_pda);
|
||||
$update = [
|
||||
'HUTANG_PELANGGAN' => $hutang_pelanggan,
|
||||
'SALDO_PELANGGAN' => $saldo_pelanggan
|
||||
];
|
||||
$action = $this->DpPenjualan->update('pelanggan', $update, 'ID_PELANGGAN', $id_pelanggan);
|
||||
|
||||
//Step Hapus Data
|
||||
$action = $this->DpPenjualan->delete('detail_dpj',$id,'ID_DDPJ');
|
||||
$action = $this->DpPenjualan->hapusDetailPda($kode_ddpj);
|
||||
|
||||
$this->session->set_flashdata('flash', 'direset');
|
||||
redirect($_SERVER['HTTP_REFERER']);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
class ManageDvd extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('ModelDvd', 'MD');
|
||||
$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()
|
||||
{
|
||||
|
||||
$datDvd = $this->MD->getDataDvd();
|
||||
|
||||
$data = [
|
||||
'sidebar' => "master data",
|
||||
'navChild' => "",
|
||||
'dvd' => $datDvd
|
||||
];
|
||||
|
||||
$this->load->view('master/Dvd', $data);
|
||||
}
|
||||
|
||||
public function save()
|
||||
{
|
||||
$method = $this->input->post('method');
|
||||
$id_dvd = $this->input->post('id');
|
||||
$nama_dvd = $this->input->post('nama_dvd');
|
||||
$type_dvd = $this->input->post('type_dvd');
|
||||
|
||||
$input = [
|
||||
'NAMA_DVD' => $nama_dvd,
|
||||
'TYPE_DVD' => $type_dvd
|
||||
];
|
||||
|
||||
$action = $this->MD->create('dvd', $input);
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('flash', 'ditambah');
|
||||
redirect('ManageDvd');
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'ditambah');
|
||||
redirect('ManageDvd');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function edit()
|
||||
{
|
||||
$method = $this->input->post('method');
|
||||
$id_dvd = $this->input->post('id_dvd');
|
||||
$nama_dvd = $this->input->post('nama_dvded');
|
||||
$type_dvd = $this->input->post('type_dvded');
|
||||
|
||||
$update = [
|
||||
'NAMA_DVD' => $nama_dvd,
|
||||
'TYPE_DVD' => $type_dvd
|
||||
];
|
||||
|
||||
$action = $this->MD->update('dvd', $update,'ID_DVD',$id_dvd);
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('flash', 'diedit');
|
||||
redirect('ManageDvd');
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'diedit');
|
||||
redirect('ManageDvd');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function hapus()
|
||||
{
|
||||
$id = $this->input->post('id');
|
||||
if ($this->MD->delete('dvd', $id, 'ID_DVD')) {
|
||||
$action = $this ->MD->delete('dvd',$id,'ID_DVD');
|
||||
$this->session->set_flashdata('flash', 'dihapus');
|
||||
redirect('ManageDvd');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
class ManageGroup extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('ModelGroup', 'MG');
|
||||
$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()
|
||||
{
|
||||
|
||||
$datGroup = $this->MG->getDataGroup();
|
||||
|
||||
$data = [
|
||||
'sidebar' => "master data",
|
||||
'navChild' => "",
|
||||
'group' => $datGroup
|
||||
];
|
||||
|
||||
$this->load->view('master/Group', $data);
|
||||
}
|
||||
|
||||
public function save()
|
||||
{
|
||||
$method = $this->input->post('method');
|
||||
$id_group = $this->input->post('id');
|
||||
$nama_group = $this->input->post('nama_group');
|
||||
|
||||
$input = [
|
||||
'NAMA_GROUP' => $nama_group
|
||||
];
|
||||
|
||||
$action = $this->MG->create('group', $input);
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('flash', 'ditambah');
|
||||
redirect('ManageGroup');
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'ditambah');
|
||||
redirect('ManageGroup');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function edit()
|
||||
{
|
||||
$method = $this->input->post('method');
|
||||
$id_group = $this->input->post('id_group');
|
||||
$nama_group = $this->input->post('nama_grouped');
|
||||
|
||||
$update = [
|
||||
'NAMA_GROUP' => $nama_group
|
||||
];
|
||||
|
||||
$action = $this->MG->update('group', $update,'ID_GROUP',$id_group);
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('flash', 'diedit');
|
||||
redirect('ManageGroup');
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'diedit');
|
||||
redirect('ManageGroup');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function hapus()
|
||||
{
|
||||
$id = $this->input->post('id');
|
||||
if ($this->MG->delete('group', $id, 'ID_GROUP')) {
|
||||
$action = $this ->MG->delete('group',$id,'ID_GROUP');
|
||||
$this->session->set_flashdata('flash', 'dihapus');
|
||||
redirect('ManageGroup');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
class ManageGrup extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('ModelGrup', 'MG');
|
||||
$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()
|
||||
{
|
||||
|
||||
$datGrup = $this->MG->getDataGrup();
|
||||
|
||||
$data = [
|
||||
'sidebar' => "master data",
|
||||
'navChild' => "",
|
||||
'grup' => $datGrup
|
||||
];
|
||||
|
||||
$this->load->view('master/Grup', $data);
|
||||
}
|
||||
|
||||
public function save()
|
||||
{
|
||||
$method = $this->input->post('method');
|
||||
$id_grup = $this->input->post('id');
|
||||
$nama_grup = $this->input->post('nama_grup');
|
||||
|
||||
$input = [
|
||||
'NAMA_GRUP' => $nama_grup
|
||||
];
|
||||
|
||||
$action = $this->MG->create('grup', $input);
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('flash', 'ditambah');
|
||||
redirect('ManageGrup');
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'ditambah');
|
||||
redirect('ManageGrup');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function edit()
|
||||
{
|
||||
$method = $this->input->post('method');
|
||||
$id_grup = $this->input->post('id_grup');
|
||||
$nama_grup = $this->input->post('nama_gruped');
|
||||
|
||||
$update = [
|
||||
'NAMA_GRUP' => $nama_grup
|
||||
];
|
||||
|
||||
$action = $this->MG->update('grup', $update,'ID_GRUP',$id_grup);
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('flash', 'diedit');
|
||||
redirect('ManageGrup');
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'diedit');
|
||||
redirect('ManageGrup');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function hapus()
|
||||
{
|
||||
$id = $this->input->post('id');
|
||||
if ($this->MG->delete('grup', $id, 'ID_GRUP')) {
|
||||
$action = $this ->MG->delete('grup',$id,'ID_GRUP');
|
||||
$this->session->set_flashdata('flash', 'dihapus');
|
||||
redirect('ManageGrup');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
class ManageGudang extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('ModelGudang', 'MG');
|
||||
$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()
|
||||
{
|
||||
|
||||
$datGudang = $this->MG->getDataGudang();
|
||||
|
||||
$data = [
|
||||
'sidebar' => "master data",
|
||||
'navChild' => "",
|
||||
'gudang' => $datGudang
|
||||
];
|
||||
|
||||
$this->load->view('master/Gudang', $data);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
class ManageHarddisk extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('ModelHarddisk', 'MHarddisk');
|
||||
$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");
|
||||
}
|
||||
|
||||
$datHarddisk = $this->MHarddisk->getDataHarddisk();
|
||||
|
||||
$data = [
|
||||
'sidebar' => "data master sku",
|
||||
'navChild' => "data master harddisk",
|
||||
'hdd' => $datHarddisk
|
||||
];
|
||||
|
||||
$this->load->view('master/Harddisk', $data);
|
||||
}
|
||||
|
||||
public function save()
|
||||
{
|
||||
$method = $this->input->post('method');
|
||||
$id_hdd = $this->input->post('id');
|
||||
$nama = $this->input->post('nama');
|
||||
|
||||
$this->form_validation->set_rules('nama', 'Nama', 'required');
|
||||
if ($this->form_validation->run() == FALSE) {
|
||||
$data = [
|
||||
'status' => false,
|
||||
'errors' => [
|
||||
'nama' => form_error('nama')
|
||||
|
||||
]
|
||||
];
|
||||
$this->output_json($data);
|
||||
} else {
|
||||
|
||||
$input = [
|
||||
'NAMA_HDD' => $nama
|
||||
|
||||
];
|
||||
|
||||
if ($method === 'add') {
|
||||
$action = $this->MHarddisk->create('hdd', $input);
|
||||
} else if ($method === 'edit') {
|
||||
$action = $this->MHarddisk->update('hdd', $input, 'ID_HDD', $id_hdd);
|
||||
}
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('flash', 'ditambah');
|
||||
redirect('ManageHarddisk');
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'ditambah');
|
||||
redirect('ManageHarddisk');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function hapus()
|
||||
{
|
||||
$id = $this->input->post('id');
|
||||
if ($this->MHarddisk->delete('hdd', $id, 'ID_HDD')) {
|
||||
$this->session->set_flashdata('flash', 'dihapus');
|
||||
redirect('ManageHarddisk');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,122 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
class ManageHarga extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('ModelHarga', 'MHarga');
|
||||
$this->load->model('ModelSku', 'MSku');
|
||||
$this->load->model('ModelBarang', 'MBarang');
|
||||
$this->load->model('ModelDistributor', 'MDistributor');
|
||||
$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("Login");
|
||||
} elseif ($jabatan != "ADMIN") {
|
||||
redirect("Login");
|
||||
}
|
||||
|
||||
$datHarga = $this->MHarga->getDataHarga();
|
||||
|
||||
$data = [
|
||||
'sidebar' => "data master",
|
||||
'navChild' => "data harga",
|
||||
'harga' => $datHarga
|
||||
];
|
||||
|
||||
$this->load->view('harga/table-harga', $data);
|
||||
}
|
||||
|
||||
public function add()
|
||||
{
|
||||
$username = $this->session->userdata('username');
|
||||
if ($username == null) {
|
||||
redirect("Login");
|
||||
}
|
||||
$datSku = $this->MSku->getDataSku();
|
||||
$datHarga = $this->MHarga->getDataHarga();
|
||||
$data = [
|
||||
'sidebar' => "data master",
|
||||
'navChild' => "data harga",
|
||||
'sku' => $datSku,
|
||||
'harga' => $datHarga
|
||||
|
||||
];
|
||||
|
||||
$this->load->view('harga/harga-tambah', $data);
|
||||
}
|
||||
|
||||
public function save()
|
||||
{
|
||||
$method = $this->input->post('method');
|
||||
$po = $this->input->post('NO_PO');
|
||||
$hpp = $this->input->post('hpp');
|
||||
|
||||
$this->form_validation->set_rules('NO_PO', 'Pilih Nomor PO', 'required');
|
||||
$this->form_validation->set_rules('hpp', 'Harga', 'required');
|
||||
|
||||
if ($this->form_validation->run() == FALSE) {
|
||||
$data = [
|
||||
'status' => false,
|
||||
'errors' => [
|
||||
'NO_PO' => form_error('NO_PO'),
|
||||
'hpp' => form_error('hpp')
|
||||
]
|
||||
];
|
||||
$this->output_json($data);
|
||||
} else {
|
||||
$input = [
|
||||
'ID_SKU' => $po,
|
||||
'HPP' => $hpp
|
||||
];
|
||||
|
||||
$action = $this->MHarga->create('harga', $input);
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('flash', 'ditambah');
|
||||
//$this->output_json(['status' => true]);
|
||||
redirect('ManageHarga');
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'ditambah');
|
||||
//$this->output_json(['status' => true]);
|
||||
redirect('ManageHarga');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function hapus()
|
||||
{
|
||||
$id = $this->input->post('id');
|
||||
if ($this->MHarga->delete('harga', $id, 'ID_HARGA')) {
|
||||
$this->session->set_flashdata('flash', 'dihapus');
|
||||
redirect('ManageHarga');
|
||||
}
|
||||
}
|
||||
|
||||
public function cek_pass($id, $pass = null)
|
||||
{
|
||||
if ($pass == null) {
|
||||
$this->output_json(['cek' => 'ksng']);
|
||||
} else {
|
||||
$dat = $this->KaryawanM->cekPass($id, $pass);
|
||||
|
||||
if ($dat != null) {
|
||||
$this->output_json(['cek' => 'benar']);
|
||||
} else {
|
||||
$this->output_json(['cek' => 'salah']);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
class ManageHargaBeli extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('ModelHargaBeli', 'MHBeli');
|
||||
$this->load->model('ModelBeli', 'MBeli');
|
||||
$this->load->model('ModelSupplier', 'MSupplier');
|
||||
$this->load->model('ModelBarang', 'MBarang');
|
||||
$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");
|
||||
}
|
||||
|
||||
$datHBeli = $this->MHBeli->getDataHargaBeli();
|
||||
|
||||
$data = [
|
||||
'sidebar' => "data proses pembelian",
|
||||
'navChild' => "data proses hargabeli",
|
||||
'hargabeli' => $datHBeli
|
||||
];
|
||||
|
||||
$this->load->view('master/HargaBeli', $data);
|
||||
}
|
||||
|
||||
public function add()
|
||||
{
|
||||
$username = $this->session->userdata('username');
|
||||
if ($username == null) {
|
||||
redirect("Login");
|
||||
}
|
||||
$datBeli = $this->MBeli->getDataBeliID();
|
||||
$data = [
|
||||
'sidebar' => "data proses pembelian",
|
||||
'navChild' => "data proses hargabeli",
|
||||
'beli' => $datBeli
|
||||
];
|
||||
$this->load->view('proses/TambahHargaBeli', $data);
|
||||
}
|
||||
|
||||
public function save()
|
||||
{
|
||||
$method = $this->input->post('method');
|
||||
$id_beli = $this->input->post('id');
|
||||
$beli = $this->input->post('BELI');
|
||||
$harga_beli = $this->input->post('harga_beli');
|
||||
|
||||
$datID = $this->MBeli->getDataBeliID($beli);
|
||||
|
||||
$input = [
|
||||
'HARGA_BELI' => $harga_beli
|
||||
];
|
||||
|
||||
if (is_array($datID)||is_object($$datID)) {
|
||||
$input = [
|
||||
'HARGA_BELI' => $harga_beli
|
||||
];
|
||||
$action = $this->MBeli->update('beli', $input, 'ID_BELI',$datID[0]['ID_BELI']);
|
||||
}
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('flash', 'ditambah');
|
||||
redirect('ManageHargaBeli');
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'ditambah');
|
||||
redirect('ManageHargaBeli');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function hapus()
|
||||
{
|
||||
$id = $this->input->post('id');
|
||||
if ($this->MBeli->delete('beli', $id, 'ID_BELI')) {
|
||||
$this->session->set_flashdata('flash', 'dihapus');
|
||||
redirect('ManageHargaBeli');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
class ManageHdd extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('ModelHdd', 'MH');
|
||||
$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()
|
||||
{
|
||||
|
||||
$datHdd = $this->MH->getDataHdd();
|
||||
|
||||
$data = [
|
||||
'sidebar' => "master data",
|
||||
'navChild' => "",
|
||||
'hdd' => $datHdd
|
||||
];
|
||||
|
||||
$this->load->view('master/Hdd', $data);
|
||||
}
|
||||
|
||||
public function save()
|
||||
{
|
||||
$method = $this->input->post('method');
|
||||
$id_hdd = $this->input->post('id');
|
||||
$nama_hdd = $this->input->post('nama_hdd');
|
||||
|
||||
$input = [
|
||||
'NAMA_HDD' => $nama_hdd
|
||||
];
|
||||
|
||||
$action = $this->MH->create('hdd', $input);
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('flash', 'ditambah');
|
||||
redirect('ManageHdd');
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'ditambah');
|
||||
redirect('ManageHdd');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function edit()
|
||||
{
|
||||
$method = $this->input->post('method');
|
||||
$id_hdd = $this->input->post('id_hdd');
|
||||
$nama_hdd = $this->input->post('nama_hdded');
|
||||
|
||||
$update = [
|
||||
'NAMA_HDD' => $nama_hdd
|
||||
];
|
||||
|
||||
$action = $this->MH->update('hdd', $update,'ID_HDD',$id_hdd);
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('flash', 'diedit');
|
||||
redirect('ManageHdd');
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'diedit');
|
||||
redirect('ManageHdd');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function hapus()
|
||||
{
|
||||
$id = $this->input->post('id');
|
||||
if ($this->MH->delete('hdd', $id, 'ID_HDD')) {
|
||||
$action = $this ->MH->delete('hdd',$id,'ID_HDD');
|
||||
$this->session->set_flashdata('flash', 'dihapus');
|
||||
redirect('ManageHdd');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,214 @@
|
||||
<?php
|
||||
|
||||
use Restserver\Libraries\REST_Controller;
|
||||
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
require APPPATH . 'libraries/REST_Controller.php';
|
||||
require APPPATH . 'libraries/Format.php';
|
||||
|
||||
class ManageHutang extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('ModelHutang', 'MH');
|
||||
$this->load->model('ModelNeraca', 'MN');
|
||||
$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()
|
||||
{
|
||||
|
||||
$datHutang = $this->MH->getDataHutang();
|
||||
$datNeraca = $this->MN->getDataNeraca();
|
||||
|
||||
$data = [
|
||||
'sidebar' => "menu accounting",
|
||||
'navChild' => "",
|
||||
'hutang' => $datHutang,
|
||||
'neraca' => $datNeraca
|
||||
];
|
||||
|
||||
$this->load->view('proses/Hutang', $data);
|
||||
}
|
||||
|
||||
public function tambahKasbank($id)
|
||||
{
|
||||
$kasbank = $this->MN->getNaunganKelompok($id);
|
||||
$title = $this->MN->getNamaNaungan($id);
|
||||
$supplier = $this->MS->getDataSupplier();
|
||||
$pelanggan = $this->MP->getDataPelanggan();
|
||||
$tp = $this->MT->getDataTp();
|
||||
$anggotasup = $this->MS->getKelompokSupplier();
|
||||
$anggotapel = $this->MP->getKelompokPelanggan();
|
||||
$anggotathird = $this->MT->getKelompokTp();
|
||||
|
||||
$data = [
|
||||
'sidebar' => "master data",
|
||||
'navChild' => "",
|
||||
'kelompok' => $kelompok,
|
||||
'id_naungan' => $id,
|
||||
'nama_naungan' => $title[0]['NAMA_NAUNGAN'],
|
||||
'supplier' => $supplier,
|
||||
'pelanggan' => $pelanggan,
|
||||
'tp' => $tp,
|
||||
'anggotasup' => $anggotasup,
|
||||
'anggotapel' => $anggotapel,
|
||||
'anggotathird' => $anggotathird
|
||||
];
|
||||
|
||||
$this->load->view('master/Kelompok', $data);
|
||||
}
|
||||
|
||||
public function tambahRelasi($id)
|
||||
{
|
||||
$relasi = $this->MT->getDataTransaksi($id);
|
||||
$title = $this->MP->getSJPembelian($id);
|
||||
$barang = $this->MB->getDataBarangPembelian();
|
||||
$gudang = $this->MG->getDataGudangPembelian();
|
||||
|
||||
$data = [
|
||||
'sidebar' => "menu pembelian",
|
||||
'navChild' => "",
|
||||
'stock' => $stock,
|
||||
'id_pembelian' => $id,
|
||||
'sj_pembelian' => $title[0]['SJ_PEMBELIAN'],
|
||||
'barang' => $barang,
|
||||
'gudang' => $gudang
|
||||
];
|
||||
|
||||
$this->load->view('proses/PembelianHarga', $data);
|
||||
}
|
||||
|
||||
public function saveharga()
|
||||
{
|
||||
$method = $this->input->post('method');
|
||||
$id_pembelian = $this->input->post('id_pembelian');
|
||||
$id_stock = $this->input->post('id_stock');
|
||||
$qty = $this->input->post('qty');
|
||||
$radio_beli = $this->input->post('radio_beli');
|
||||
$radio_ppn = $this->input->post('radio_ppn');
|
||||
$invoice_pembelian = $this->input->post('invoice_pembelian');
|
||||
$tgl_invoicebeli = $this->input->post('tgl_invoicebeli');
|
||||
$dpp_satuan = $this->input->post('dpp_satuan');
|
||||
$dpp_total = $dpp_satuan*$qty;
|
||||
|
||||
$inputharga = [
|
||||
'DPP_BELI_SATUAN' => $dpp_satuan,
|
||||
'DPP_BELI_TOTAL' => $dpp_total,
|
||||
'STATUS_PPN' => $radio_ppn,
|
||||
'STATUS_BELI' => $radio_beli,
|
||||
'STOCK_ID' => $id_stock
|
||||
];
|
||||
|
||||
$actionharga = $this->MP->create('harga', $inputharga);
|
||||
|
||||
$harga_id = $this->MP->getStockHargaID();
|
||||
$updatestock = [
|
||||
'HARGA_ID' => $harga_id[0]['ID_HARGA']
|
||||
];
|
||||
$updatepembelian = [
|
||||
'INVOICE_PEMBELIAN' => $invoice_pembelian,
|
||||
'TGL_INVOICEBELI' => $tgl_invoicebeli
|
||||
];
|
||||
$actionstock = $this->MP->update('stock', $updatestock, 'ID_STOCK', $id_stock);
|
||||
$actionpembelian = $this->MP->update('pembelian', $updatepembelian, 'ID_PEMBELIAN', $id_pembelian);
|
||||
|
||||
if ($actionstock) {
|
||||
$this->session->set_flashdata('flash', 'ditambah');
|
||||
redirect($_SERVER['HTTP_REFERER']);
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'ditambah');
|
||||
redirect($_SERVER['HTTP_REFERER']);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function editharga()
|
||||
{
|
||||
$method = $this->input->post('method');
|
||||
$id_pembelian = $this->input->post('id_pembelian');
|
||||
$id_stock = $this->input->post('id_stock');
|
||||
$id_harga = $this->input->post('id_harga');
|
||||
$qty = $this->input->post('qty');
|
||||
$radio_beli = $this->input->post('radio_belied');
|
||||
$radio_ppn = $this->input->post('radio_ppned');
|
||||
$invoice_pembelian = $this->input->post('invoice_pembelianed');
|
||||
$tgl_invoicebeli = $this->input->post('tgl_invoicebelied');
|
||||
$dpp_satuan = $this->input->post('dpp_satuaned');
|
||||
$dpp_total = $dpp_satuan*$qty;
|
||||
|
||||
$updateharga = [
|
||||
'DPP_BELI_SATUAN' => $dpp_satuan,
|
||||
'DPP_BELI_TOTAL' => $dpp_total,
|
||||
'STATUS_PPN' => $radio_ppn,
|
||||
'STATUS_BELI' => $radio_beli,
|
||||
'STOCK_ID' => $id_stock
|
||||
];
|
||||
|
||||
$updatepembelian = [
|
||||
'INVOICE_PEMBELIAN' => $invoice_pembelian,
|
||||
'TGL_INVOICEBELI' => $tgl_invoicebeli
|
||||
];
|
||||
|
||||
$actionharga = $this->MP->update('harga', $updateharga, 'ID_HARGA', $id_harga);
|
||||
$actionpembelian = $this->MP->update('pembelian', $updatepembelian, 'ID_PEMBELIAN', $id_pembelian);
|
||||
|
||||
if ($actionpembelian) {
|
||||
$this->session->set_flashdata('flash', 'diedit');
|
||||
redirect($_SERVER['HTTP_REFERER']);
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'diedit');
|
||||
redirect($_SERVER['HTTP_REFERER']);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function konfirmasi()
|
||||
{
|
||||
$method = $this->input->post('method');
|
||||
$id_pembelian = $this->input->post('id_pembelian');
|
||||
|
||||
$update = [
|
||||
'STATUS_PEMBELIAN' => "INVOICE PEMBELIAN OK"
|
||||
];
|
||||
|
||||
$action = $this->MP->update('pembelian', $update, 'ID_PEMBELIAN', $id_pembelian);
|
||||
|
||||
$datTransaksi = $this->MP->createTransaksi($id_pembelian);
|
||||
$data1 = $datTransaksi[0]['INVOICE_PEMBELIAN'];
|
||||
$data2 = $datTransaksi[0]['STATUS_BELI'];
|
||||
$data3 = $datTransaksi[0]['TGL_INVOICEBELI'];
|
||||
|
||||
if ($datTransaksi[0]['STATUS_PPN']==='Include') {
|
||||
$data4 = $datTransaksi[0]['DPP_BELI_TOTAL'];
|
||||
} else if ($datTransaksi[0]['STATUS_PPN']==='Exclude') {
|
||||
$data4 = $datTransaksi[0]['DPP_BELI_TOTAL']*1.1;
|
||||
}
|
||||
|
||||
$inputTransaksi = [
|
||||
'DOKUMEN_TRANSAKSI' => $data1,
|
||||
'JENIS_TRANSAKSI' => $data2,
|
||||
'TGL_TRANSAKSI' => $data3,
|
||||
'NILAI_TRANSAKSI' => $data4
|
||||
|
||||
];
|
||||
|
||||
$actiontransaksi = $this->MP->create('transaksi', $inputTransaksi);
|
||||
|
||||
if ($actiontransaksi) {
|
||||
$this->session->set_flashdata('flash', 'dikonfirmasi');
|
||||
redirect('ManagePembelianINV');
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'dikonfirmasi');
|
||||
redirect('ManagePembelianINV');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
<?php
|
||||
|
||||
use Restserver\Libraries\REST_Controller;
|
||||
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
require APPPATH . 'libraries/REST_Controller.php';
|
||||
require APPPATH . 'libraries/Format.php';
|
||||
|
||||
class ManageHutangBank extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('ModelHutangBank', 'HutangBank');
|
||||
$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()
|
||||
{
|
||||
|
||||
$datHutangBank = $this->HutangBank->getDataHutangBank();
|
||||
|
||||
$data = [
|
||||
'sidebar' => "menu accounting",
|
||||
'navChild' => "",
|
||||
'hutangbank'=> $datHutangBank
|
||||
];
|
||||
|
||||
$this->load->view('proses/HutangBank', $data);
|
||||
}
|
||||
|
||||
public function konfirmasi()
|
||||
{
|
||||
$method = $this->input->post('method');
|
||||
$id_hba = $this->input->post('id_hba');
|
||||
|
||||
$update = [
|
||||
'STATUS_HBA' => "LUNAS"
|
||||
];
|
||||
|
||||
$action = $this->HutangBank->update('hutang_bank', $update, 'ID_HBA', $id_hba);
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('flash', 'dikunci');
|
||||
redirect('ManageHutangBank');
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'dikunci');
|
||||
redirect('ManageHutangBank');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function viewDeskripsi($id)
|
||||
{
|
||||
$deskripsi = $this->HutangBank->getDataDeskripsiHBA($id);
|
||||
$title = $this->HutangBank->getTitleHBA($id);
|
||||
|
||||
$data = [
|
||||
'sidebar' => "menu accounting",
|
||||
'navChild' => "",
|
||||
'deskripsi' => $deskripsi,
|
||||
'id_hba' => $id,
|
||||
'title1' => $title[0]['KODE_HBA'],
|
||||
'title2' => $title[0]['DEBIT'],
|
||||
'title3' => $title[0]['KREDIT']
|
||||
];
|
||||
|
||||
$this->load->view('proses/DeskripsiHBA', $data);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
<?php
|
||||
|
||||
use Restserver\Libraries\REST_Controller;
|
||||
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
require APPPATH . 'libraries/REST_Controller.php';
|
||||
require APPPATH . 'libraries/Format.php';
|
||||
|
||||
class ManageHutangDagang extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('ModelHutangDagang', 'HutangDagang');
|
||||
$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);
|
||||
}
|
||||
|
||||
//Step One, Input Hutang Dagang
|
||||
public function index()
|
||||
{
|
||||
|
||||
$datHutangDagang = $this->HutangDagang->getDataHutangDagang();
|
||||
|
||||
$data = [
|
||||
'sidebar' => "menu accounting",
|
||||
'navChild' => "",
|
||||
'hutangdagang' => $datHutangDagang
|
||||
];
|
||||
|
||||
$this->load->view('proses/HutangDagang', $data);
|
||||
}
|
||||
|
||||
public function konfirmasi()
|
||||
{
|
||||
$method = $this->input->post('method');
|
||||
$id_hda = $this->input->post('id_hda');
|
||||
|
||||
$update = [
|
||||
'STATUS_HDA' => "LUNAS"
|
||||
];
|
||||
|
||||
$action = $this->HutangDagang->update('hutang_dagang', $update, 'ID_HDA', $id_hda);
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('flash', 'dikunci');
|
||||
redirect('ManageHutangDagang');
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'dikunci');
|
||||
redirect('ManageHutangDagang');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//Step Two, View Deskripsi
|
||||
public function viewDeskripsi($id)
|
||||
{
|
||||
$deskripsi = $this->HutangDagang->getDataDeskripsiHDA($id);
|
||||
$title = $this->HutangDagang->getTitleHDA($id);
|
||||
|
||||
$data = [
|
||||
'sidebar' => "menu accounting",
|
||||
'navChild' => "",
|
||||
'deskripsi' => $deskripsi,
|
||||
'id_hda' => $id,
|
||||
'title1' => $title[0]['KODE_HDA'],
|
||||
'title2' => $title[0]['DEBIT'],
|
||||
'title3' => $title[0]['KREDIT']
|
||||
];
|
||||
|
||||
$this->load->view('proses/DeskripsiHDA', $data);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
<?php
|
||||
|
||||
use Restserver\Libraries\REST_Controller;
|
||||
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
require APPPATH . 'libraries/REST_Controller.php';
|
||||
require APPPATH . 'libraries/Format.php';
|
||||
|
||||
class ManageHutangLain extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('ModelHutangLain', 'HutangLain');
|
||||
$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);
|
||||
}
|
||||
|
||||
//Step One, Input Hutang Lain
|
||||
public function index()
|
||||
{
|
||||
|
||||
$datHutangLain = $this->HutangLain->getDataHutangLain();
|
||||
|
||||
$data = [
|
||||
'sidebar' => "menu accounting",
|
||||
'navChild' => "",
|
||||
'hutanglain' => $datHutangLain
|
||||
];
|
||||
|
||||
$this->load->view('proses/HutangLain', $data);
|
||||
}
|
||||
|
||||
public function konfirmasi()
|
||||
{
|
||||
$method = $this->input->post('method');
|
||||
$id_hla = $this->input->post('id_hla');
|
||||
|
||||
$update = [
|
||||
'STATUS_HLA' => "LUNAS"
|
||||
];
|
||||
|
||||
$action = $this->HutangLain->update('hutang_lain', $update, 'ID_HLA', $id_hla);
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('flash', 'dikunci');
|
||||
redirect('ManageHutangLain');
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'dikunci');
|
||||
redirect('ManageHutangLain');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//Step Two, View Deskripsi
|
||||
public function viewDeskripsi($id)
|
||||
{
|
||||
$deskripsi = $this->HutangLain->getDataDeskripsiHLA($id);
|
||||
$title = $this->HutangLain->getTitleHLA($id);
|
||||
|
||||
$data = [
|
||||
'sidebar' => "menu accounting",
|
||||
'navChild' => "",
|
||||
'deskripsi' => $deskripsi,
|
||||
'id_hla' => $id,
|
||||
'title1' => $title[0]['KODE_HLA'],
|
||||
'title2' => $title[0]['DEBIT'],
|
||||
'title3' => $title[0]['KREDIT']
|
||||
];
|
||||
|
||||
$this->load->view('proses/DeskripsiHLA', $data);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
<?php
|
||||
|
||||
use Restserver\Libraries\REST_Controller;
|
||||
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
require APPPATH . 'libraries/REST_Controller.php';
|
||||
require APPPATH . 'libraries/Format.php';
|
||||
|
||||
class ManageHutangPajak extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('ModelHutangPajak', 'HutangPajak');
|
||||
$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);
|
||||
}
|
||||
|
||||
//Step One, Input Hutang Pajak
|
||||
public function index()
|
||||
{
|
||||
|
||||
$datHutangPajak = $this->HutangPajak->getDataHutangPajak();
|
||||
|
||||
$data = [
|
||||
'sidebar' => "menu accounting",
|
||||
'navChild' => "",
|
||||
'hutangpajak' => $datHutangPajak
|
||||
];
|
||||
|
||||
$this->load->view('proses/HutangPajak', $data);
|
||||
}
|
||||
|
||||
public function konfirmasi()
|
||||
{
|
||||
$method = $this->input->post('method');
|
||||
$id_hpa = $this->input->post('id_hpa');
|
||||
|
||||
$update = [
|
||||
'STATUS_HPA' => "LUNAS"
|
||||
];
|
||||
|
||||
$action = $this->HutangPajak->update('hutang_pajak', $update, 'ID_HPA', $id_hpa);
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('flash', 'dikunci');
|
||||
redirect('ManageHutangPajak');
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'dikunci');
|
||||
redirect('ManageHutangPajak');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//Step Two, View Deskripsi
|
||||
public function viewDeskripsi($id)
|
||||
{
|
||||
$deskripsi = $this->HutangPajak->getDataDeskripsiHPA($id);
|
||||
$title = $this->HutangPajak->getTitleHPA($id);
|
||||
|
||||
$data = [
|
||||
'sidebar' => "menu accounting",
|
||||
'navChild' => "",
|
||||
'deskripsi' => $deskripsi,
|
||||
'id_hpa' => $id,
|
||||
'title1' => $title[0]['KODE_HPA'],
|
||||
'title2' => $title[0]['DEBIT'],
|
||||
'title3' => $title[0]['KREDIT']
|
||||
];
|
||||
|
||||
$this->load->view('proses/DeskripsiHPA', $data);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,394 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
class ManageInventory extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('ModelInventory', 'MI');
|
||||
$this->load->model('ModelType', 'MType');
|
||||
$this->load->model('ModelProcessor', 'MProcessor');
|
||||
$this->load->model('ModelRam', 'MRam');
|
||||
$this->load->model('ModelHarddisk', 'MHarddisk');
|
||||
$this->load->model('ModelSsd', 'MSsd');
|
||||
$this->load->model('ModelVga', 'MVga');
|
||||
$this->load->model('ModelOs', 'MOs');
|
||||
$this->load->model('ModelDvd', 'MDvd');
|
||||
$this->load->model('ModelSp', 'MSp');
|
||||
$this->load->model('ModelKeyMou', 'MKeyMou');
|
||||
$this->load->model('ModelWarna', 'MWarna');
|
||||
$this->load->model('ModelRaid', 'MRaid');
|
||||
$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");
|
||||
}
|
||||
|
||||
$datInventory = $this->MI->getDataInventory();
|
||||
|
||||
$data = [
|
||||
'sidebar' => "data inventory",
|
||||
'navChild' => "data inventory sku",
|
||||
'inventory' => $datInventory
|
||||
];
|
||||
|
||||
$this->load->view('inventory/table-inventory', $data);
|
||||
}
|
||||
|
||||
public function addPC()
|
||||
{
|
||||
$username = $this->session->userdata('username');
|
||||
if ($username == null) {
|
||||
redirect("Login");
|
||||
}
|
||||
$datInventory = $this->MI->getDataInventory();
|
||||
$datType = $this->MType->getDataType();
|
||||
$datProcessor = $this->MProcessor->getDataProcessor();
|
||||
$datRam = $this->MRam->getDataRam();
|
||||
$datHarddisk = $this->MHarddisk->getDataHarddisk();
|
||||
$datSsd = $this->MSsd->getDataSsd();
|
||||
$datVga = $this->MVga->getDataVga();
|
||||
$datOs = $this->MOs->getDataOs();
|
||||
$datDvd = $this->MDvd->getDataDvd();
|
||||
$datSp = $this->MSp->getDataSp();
|
||||
$datKeyMou = $this->MKeyMou->getDataKeyMou();
|
||||
$data = [
|
||||
'sidebar' => "data inventory",
|
||||
'navChild' => "data inventory sku",
|
||||
'inventory' => $datInventory,
|
||||
'type' => $datType,
|
||||
'processor' => $datProcessor,
|
||||
'ram' => $datRam,
|
||||
'hdd' => $datHarddisk,
|
||||
'ssd' => $datSsd,
|
||||
'vga' => $datVga,
|
||||
'os' => $datOs,
|
||||
'dvd' => $datDvd,
|
||||
'sp' => $datSp,
|
||||
'keymou' => $datKeyMou
|
||||
];
|
||||
//var_dump($data);
|
||||
$this->load->view('inventory/inventory-tambahpc', $data);
|
||||
}
|
||||
|
||||
public function addNB()
|
||||
{
|
||||
$username = $this->session->userdata('username');
|
||||
if ($username == null) {
|
||||
redirect("Login");
|
||||
}
|
||||
$datInventory = $this->MI->getDataInventory();
|
||||
$datType = $this->MType->getDataType();
|
||||
$datProcessor = $this->MProcessor->getDataProcessor();
|
||||
$datRam = $this->MRam->getDataRam();
|
||||
$datHarddisk = $this->MHarddisk->getDataHarddisk();
|
||||
$datSsd = $this->MSsd->getDataSsd();
|
||||
$datVga = $this->MVga->getDataVga();
|
||||
$datOs = $this->MOs->getDataOs();
|
||||
$datDvd = $this->MDvd->getDataDvd();
|
||||
$datWarna = $this->MWarna->getDataWarna();
|
||||
$data = [
|
||||
'sidebar' => "data inventory",
|
||||
'navChild' => "data inventory sku",
|
||||
'inventory' => $datInventory,
|
||||
'type' => $datType,
|
||||
'processor' => $datProcessor,
|
||||
'ram' => $datRam,
|
||||
'hdd' => $datHarddisk,
|
||||
'ssd' => $datSsd,
|
||||
'vga' => $datVga,
|
||||
'os' => $datOs,
|
||||
'dvd' => $datDvd,
|
||||
'warna' => $datWarna
|
||||
];
|
||||
//var_dump($data);
|
||||
$this->load->view('inventory/inventory-tambahnb', $data);
|
||||
}
|
||||
|
||||
public function addSRV()
|
||||
{
|
||||
$username = $this->session->userdata('username');
|
||||
if ($username == null) {
|
||||
redirect("Login");
|
||||
}
|
||||
$datInventory = $this->MI->getDataInventory();
|
||||
$datType = $this->MType->getDataType();
|
||||
$datProcessor = $this->MProcessor->getDataProcessor();
|
||||
$datRam = $this->MRam->getDataRam();
|
||||
$datHarddisk = $this->MHarddisk->getDataHarddisk();
|
||||
$datSsd = $this->MSsd->getDataSsd();
|
||||
$datVga = $this->MVga->getDataVga();
|
||||
$datOs = $this->MOs->getDataOs();
|
||||
$datDvd = $this->MDvd->getDataDvd();
|
||||
$datKeyMou = $this->MKeyMou->getDataKeyMou();
|
||||
$datRaid = $this->MRaid->getDataRaid();
|
||||
$data = [
|
||||
'sidebar' => "data inventory",
|
||||
'navChild' => "data inventory sku",
|
||||
'inventory' => $datInventory,
|
||||
'type' => $datType,
|
||||
'processor' => $datProcessor,
|
||||
'ram' => $datRam,
|
||||
'hdd' => $datHarddisk,
|
||||
'ssd' => $datSsd,
|
||||
'vga' => $datVga,
|
||||
'os' => $datOs,
|
||||
'dvd' => $datDvd,
|
||||
'keymou' => $datKeyMou,
|
||||
'raid' => $datRaid
|
||||
];
|
||||
//var_dump($data);
|
||||
$this->load->view('inventory/inventory-tambahsrv', $data);
|
||||
}
|
||||
|
||||
public function savePC()
|
||||
{
|
||||
$method = $this->input->post('method');
|
||||
$id_inventory = $this->input->post('id');
|
||||
$type = $this->input->post('TYPE');
|
||||
$processor = $this->input->post('PROCESSOR');
|
||||
$ram = $this->input->post('RAM');
|
||||
$hdd = $this->input->post('HDD');
|
||||
$ssd = $this->input->post('SSD');
|
||||
$vga = $this->input->post('VGA');
|
||||
$os = $this->input->post('OS');
|
||||
$dvd = $this->input->post('DVD');
|
||||
$sp = $this->input->post('SP');
|
||||
$keymou = $this->input->post('KEYMOU');
|
||||
|
||||
$this->form_validation->set_rules('TYPE', 'Pilih Type', 'required');
|
||||
$this->form_validation->set_rules('PROCESSOR', 'Pilih Processor', 'required');
|
||||
$this->form_validation->set_rules('RAM', 'Pilih RAM', 'required');
|
||||
$this->form_validation->set_rules('HDD', 'Pilih HDD', 'required');
|
||||
$this->form_validation->set_rules('SSD', 'Pilih SSD', 'required');
|
||||
$this->form_validation->set_rules('VGA', 'Pilih VGA', 'required');
|
||||
$this->form_validation->set_rules('OS', 'Pilih OS', 'required');
|
||||
$this->form_validation->set_rules('DVD', 'Pilih Dvd', 'required');
|
||||
$this->form_validation->set_rules('SP', 'Pilih Serial Paralel', 'required');
|
||||
$this->form_validation->set_rules('KEYMOU', 'Pilih Keyboard Mouse', 'required');
|
||||
|
||||
if ($this->form_validation->run() == FALSE) {
|
||||
$data = [
|
||||
'status' => false,
|
||||
'errors' => [
|
||||
'TYPE' => form_error('TYPE'),
|
||||
'PROCESSOR' => form_error('PROCESSOR'),
|
||||
'RAM' => form_error('RAM'),
|
||||
'HDD' => form_error('HDD'),
|
||||
'SSD' => form_error('SSD'),
|
||||
'VGA' => form_error('VGA'),
|
||||
'OS' => form_error('OS'),
|
||||
'DVD' => form_error('DVD'),
|
||||
'SP' => form_error('SP'),
|
||||
'KEYMOU' => form_error('KEYMOU')
|
||||
]
|
||||
];
|
||||
//$this->output_json($data);//
|
||||
$this->session->set_flashdata('flashgagal', 'ditambah');
|
||||
redirect('ManageInventory');
|
||||
|
||||
} else {
|
||||
|
||||
$input = [
|
||||
'ID_TYPE' => $type,
|
||||
'ID_PROCESSOR' => $processor,
|
||||
'ID_RAM' => $ram,
|
||||
'ID_HDD' => $hdd,
|
||||
'ID_SSD' => $ssd,
|
||||
'ID_VGA' => $vga,
|
||||
'ID_OS' => $os,
|
||||
'ID_DVD' => $dvd,
|
||||
'ID_SP' => $sp,
|
||||
'ID_KEYMOU' => $keymou,
|
||||
'ID_RAID' => '1',
|
||||
'ID_WARNA' => '1'
|
||||
];
|
||||
|
||||
$action = $this->MI->create('inventory', $input);
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('flash', 'ditambah');
|
||||
//$this->output_json(['status' => true]);
|
||||
redirect('ManageInventory');
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'ditambah');
|
||||
//$this->output_json(['status' => true]);
|
||||
redirect('ManageInventory');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function saveNB()
|
||||
{
|
||||
$method = $this->input->post('method');
|
||||
$id_inventory = $this->input->post('id');
|
||||
$type = $this->input->post('TYPE');
|
||||
$processor = $this->input->post('PROCESSOR');
|
||||
$ram = $this->input->post('RAM');
|
||||
$hdd = $this->input->post('HDD');
|
||||
$ssd = $this->input->post('SSD');
|
||||
$vga = $this->input->post('VGA');
|
||||
$os = $this->input->post('OS');
|
||||
$dvd = $this->input->post('DVD');
|
||||
$warna = $this->input->post('WARNA');
|
||||
|
||||
$this->form_validation->set_rules('TYPE', 'Pilih Type', 'required');
|
||||
$this->form_validation->set_rules('PROCESSOR', 'Pilih Processor', 'required');
|
||||
$this->form_validation->set_rules('RAM', 'Pilih RAM', 'required');
|
||||
$this->form_validation->set_rules('HDD', 'Pilih HDD', 'required');
|
||||
$this->form_validation->set_rules('SSD', 'Pilih SSD', 'required');
|
||||
$this->form_validation->set_rules('VGA', 'Pilih VGA', 'required');
|
||||
$this->form_validation->set_rules('OS', 'Pilih OS', 'required');
|
||||
$this->form_validation->set_rules('DVD', 'Pilih Dvd', 'required');
|
||||
$this->form_validation->set_rules('WARNA', 'Pilih Warna', 'required');
|
||||
|
||||
if ($this->form_validation->run() == FALSE) {
|
||||
$data = [
|
||||
'status' => false,
|
||||
'errors' => [
|
||||
'TYPE' => form_error('TYPE'),
|
||||
'PROCESSOR' => form_error('PROCESSOR'),
|
||||
'RAM' => form_error('RAM'),
|
||||
'HDD' => form_error('HDD'),
|
||||
'SSD' => form_error('SSD'),
|
||||
'VGA' => form_error('VGA'),
|
||||
'OS' => form_error('OS'),
|
||||
'DVD' => form_error('DVD'),
|
||||
'WARNA' => form_error('WARNA')
|
||||
]
|
||||
];
|
||||
//$this->output_json($data);//
|
||||
$this->session->set_flashdata('flashgagal', 'ditambah');
|
||||
redirect('ManageInventory');
|
||||
|
||||
} else {
|
||||
|
||||
$input = [
|
||||
'ID_TYPE' => $type,
|
||||
'ID_PROCESSOR' => $processor,
|
||||
'ID_RAM' => $ram,
|
||||
'ID_HDD' => $hdd,
|
||||
'ID_SSD' => $ssd,
|
||||
'ID_VGA' => $vga,
|
||||
'ID_OS' => $os,
|
||||
'ID_DVD' => $dvd,
|
||||
'ID_WARNA' => $warna,
|
||||
'ID_SP' => '1',
|
||||
'ID_KEYMOU' => '1',
|
||||
'ID_RAID' => '1'
|
||||
];
|
||||
|
||||
$action = $this->MI->create('inventory', $input);
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('flash', 'ditambah');
|
||||
//$this->output_json(['status' => true]);
|
||||
redirect('ManageInventory');
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'ditambah');
|
||||
//$this->output_json(['status' => true]);
|
||||
redirect('ManageInventory');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function saveSRV()
|
||||
{
|
||||
$method = $this->input->post('method');
|
||||
$id_inventory = $this->input->post('id');
|
||||
$type = $this->input->post('TYPE');
|
||||
$processor = $this->input->post('PROCESSOR');
|
||||
$ram = $this->input->post('RAM');
|
||||
$hdd = $this->input->post('HDD');
|
||||
$ssd = $this->input->post('SSD');
|
||||
$vga = $this->input->post('VGA');
|
||||
$os = $this->input->post('OS');
|
||||
$dvd = $this->input->post('DVD');
|
||||
$raid = $this->input->post('RAID');
|
||||
$keymou = $this->input->post('KEYMOU');
|
||||
|
||||
$this->form_validation->set_rules('TYPE', 'Pilih Type', 'required');
|
||||
$this->form_validation->set_rules('PROCESSOR', 'Pilih Processor', 'required');
|
||||
$this->form_validation->set_rules('RAM', 'Pilih RAM', 'required');
|
||||
$this->form_validation->set_rules('HDD', 'Pilih HDD', 'required');
|
||||
$this->form_validation->set_rules('SSD', 'Pilih SSD', 'required');
|
||||
$this->form_validation->set_rules('VGA', 'Pilih VGA', 'required');
|
||||
$this->form_validation->set_rules('OS', 'Pilih OS', 'required');
|
||||
$this->form_validation->set_rules('DVD', 'Pilih Dvd', 'required');
|
||||
$this->form_validation->set_rules('RAID', 'Pilih RAID Controller', 'required');
|
||||
$this->form_validation->set_rules('KEYMOU', 'Pilih Keyboard Mouse', 'required');
|
||||
|
||||
if ($this->form_validation->run() == FALSE) {
|
||||
$data = [
|
||||
'status' => false,
|
||||
'errors' => [
|
||||
'TYPE' => form_error('TYPE'),
|
||||
'PROCESSOR' => form_error('PROCESSOR'),
|
||||
'RAM' => form_error('RAM'),
|
||||
'HDD' => form_error('HDD'),
|
||||
'SSD' => form_error('SSD'),
|
||||
'VGA' => form_error('VGA'),
|
||||
'OS' => form_error('OS'),
|
||||
'DVD' => form_error('DVD'),
|
||||
'RAID' => form_error('RAID'),
|
||||
'KEYMOU' => form_error('KEYMOU')
|
||||
]
|
||||
];
|
||||
//$this->output_json($data);//
|
||||
$this->session->set_flashdata('flashgagal', 'ditambah');
|
||||
redirect('ManageInventory');
|
||||
|
||||
} else {
|
||||
|
||||
$input = [
|
||||
'ID_TYPE' => $type,
|
||||
'ID_PROCESSOR' => $processor,
|
||||
'ID_RAM' => $ram,
|
||||
'ID_HDD' => $hdd,
|
||||
'ID_SSD' => $ssd,
|
||||
'ID_VGA' => $vga,
|
||||
'ID_OS' => $os,
|
||||
'ID_DVD' => $dvd,
|
||||
'ID_RAID' => $raid,
|
||||
'ID_KEYMOU' => $keymou,
|
||||
'ID_WARNA' => '1',
|
||||
'ID_SP' => '1'
|
||||
];
|
||||
|
||||
$action = $this->MI->create('inventory', $input);
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('flash', 'ditambah');
|
||||
//$this->output_json(['status' => true]);
|
||||
redirect('ManageInventory');
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'ditambah');
|
||||
//$this->output_json(['status' => true]);
|
||||
redirect('ManageInventory');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function hapus()
|
||||
{
|
||||
$id = $this->input->post('id');
|
||||
if ($this->MI->delete('inventory', $id, 'ID_INVENTORY')) {
|
||||
$this->session->set_flashdata('flash', 'dihapus');
|
||||
redirect('ManageInventory');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,166 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
class ManageInventoryNB extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('ModelInventoryNB', 'MINB');
|
||||
$this->load->model('ModelType', 'MType');
|
||||
$this->load->model('ModelProcessor', 'MProcessor');
|
||||
$this->load->model('ModelRam', 'MRam');
|
||||
$this->load->model('ModelHarddisk', 'MHarddisk');
|
||||
$this->load->model('ModelSsd', 'MSsd');
|
||||
$this->load->model('ModelVga', 'MVga');
|
||||
$this->load->model('ModelOs', 'MOs');
|
||||
$this->load->model('ModelWarna', 'MWarna');
|
||||
$this->load->model('ModelDvd', 'MDvd');
|
||||
$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");
|
||||
}
|
||||
|
||||
$datInventoryNB = $this->MINB->getDataInventoryNB();
|
||||
|
||||
$data = [
|
||||
'sidebar' => "data inventory",
|
||||
'navChild' => "data inventory sku",
|
||||
'nb' => $datInventoryNB
|
||||
];
|
||||
|
||||
$this->load->view('inventory/table-inventory', $data);
|
||||
}
|
||||
|
||||
public function add()
|
||||
{
|
||||
$username = $this->session->userdata('username');
|
||||
if ($username == null) {
|
||||
redirect("Login");
|
||||
}
|
||||
$datInventoryNB = $this->MINB->getDataInventoryNB();
|
||||
$datType = $this->MType->getDataType();
|
||||
$datProcessor = $this->MProcessor->getDataProcessor();
|
||||
$datRam = $this->MRam->getDataRam();
|
||||
$datHarddisk = $this->MHarddisk->getDataHarddisk();
|
||||
$datSsd = $this->MSsd->getDataSsd();
|
||||
$datVga = $this->MVga->getDataVga();
|
||||
$datOs = $this->MOs->getDataOs();
|
||||
$datWarna = $this->MWarna->getDataWarna();
|
||||
$datDvd = $this->MDvd->getDataDvd();
|
||||
$data = [
|
||||
'sidebar' => "data inventory",
|
||||
'navChild' => "data inventory sku",
|
||||
'nb' => $datInventoryNB,
|
||||
'type' => $datType,
|
||||
'processor' => $datProcessor,
|
||||
'ram' => $datRam,
|
||||
'hdd' => $datHarddisk,
|
||||
'ssd' => $datSsd,
|
||||
'vga' => $datVga,
|
||||
'os' => $datOs,
|
||||
'warna' => $datWarna,
|
||||
'dvd' => $datDvd
|
||||
];
|
||||
//var_dump($data);
|
||||
$this->load->view('inventory/inventory-tambahnb', $data);
|
||||
}
|
||||
|
||||
public function save()
|
||||
{
|
||||
$method = $this->input->post('method');
|
||||
$id_nb = $this->input->post('id');
|
||||
$nota_pembelian = $this->input->post('nota_pembelian');
|
||||
$type = $this->input->post('TYPE');
|
||||
$processor = $this->input->post('PROCESSOR');
|
||||
$ram = $this->input->post('RAM');
|
||||
$hdd = $this->input->post('HDD');
|
||||
$ssd = $this->input->post('SSD');
|
||||
$vga = $this->input->post('VGA');
|
||||
$os = $this->input->post('OS');
|
||||
$warna = $this->input->post('WARNA');
|
||||
$dvd = $this->input->post('DVD');
|
||||
|
||||
$this->form_validation->set_rules('nota_pembelian', 'Nota Pembelian', 'required');
|
||||
$this->form_validation->set_rules('TYPE', 'Pilih Type', 'required');
|
||||
$this->form_validation->set_rules('PROCESSOR', 'Pilih Processor', 'required');
|
||||
$this->form_validation->set_rules('RAM', 'Pilih RAM', 'required');
|
||||
$this->form_validation->set_rules('HDD', 'Pilih HDD', 'required');
|
||||
$this->form_validation->set_rules('SSD', 'Pilih SSD', 'required');
|
||||
$this->form_validation->set_rules('VGA', 'Pilih VGA', 'required');
|
||||
$this->form_validation->set_rules('OS', 'Pilih OS', 'required');
|
||||
$this->form_validation->set_rules('WARNA', 'Pilih Warna', 'required');
|
||||
$this->form_validation->set_rules('DVD', 'Pilih Dvd', 'required');
|
||||
|
||||
if ($this->form_validation->run() == FALSE) {
|
||||
$data = [
|
||||
'status' => false,
|
||||
'errors' => [
|
||||
'nota_pembelian' => form_error('nota_pembelian'),
|
||||
'TYPE' => form_error('TYPE'),
|
||||
'PROCESSOR' => form_error('PROCESSOR'),
|
||||
'RAM' => form_error('RAM'),
|
||||
'HDD' => form_error('HDD'),
|
||||
'SSD' => form_error('SSD'),
|
||||
'VGA' => form_error('VGA'),
|
||||
'OS' => form_error('OS'),
|
||||
'WARNA' => form_error('WARNA'),
|
||||
'DVD' => form_error('DVD')
|
||||
]
|
||||
];
|
||||
//$this->output_json($data);//
|
||||
$this->session->set_flashdata('flashgagal', 'ditambah');
|
||||
redirect('ManageInventoryNB');
|
||||
|
||||
} else {
|
||||
|
||||
$input = [
|
||||
'NOTA_PEMBELIAN' => $nota_pembelian,
|
||||
'ID_TYPE' => $type,
|
||||
'ID_PROCESSOR' => $processor,
|
||||
'ID_RAM' => $ram,
|
||||
'ID_HDD' => $hdd,
|
||||
'ID_SSD' => $ssd,
|
||||
'ID_VGA' => $vga,
|
||||
'ID_OS' => $os,
|
||||
'ID_WARNA' => $warna,
|
||||
'ID_DVD' => $dvd
|
||||
];
|
||||
|
||||
$action = $this->MINB->create('inventory', $input);
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('flash', 'ditambah');
|
||||
//$this->output_json(['status' => true]);
|
||||
redirect('ManageInventoryNB');
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'ditambah');
|
||||
//$this->output_json(['status' => true]);
|
||||
redirect('ManageInventoryNB');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function hapus()
|
||||
{
|
||||
$id = $this->input->post('id');
|
||||
if ($this->MINB->delete('inventory', $id, 'ID_INVENTORY')) {
|
||||
$this->session->set_flashdata('flash', 'dihapus');
|
||||
redirect('ManageInventoryNB');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,173 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
class ManageInventoryPC extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('ModelInventoryPC', 'MIPC');
|
||||
$this->load->model('ModelType', 'MType');
|
||||
$this->load->model('ModelProcessor', 'MProcessor');
|
||||
$this->load->model('ModelRam', 'MRam');
|
||||
$this->load->model('ModelHarddisk', 'MHarddisk');
|
||||
$this->load->model('ModelSsd', 'MSsd');
|
||||
$this->load->model('ModelVga', 'MVga');
|
||||
$this->load->model('ModelOs', 'MOs');
|
||||
$this->load->model('ModelDvd', 'MDvd');
|
||||
$this->load->model('ModelSp', 'MSp');
|
||||
$this->load->model('ModelKeyMou', 'MKeyMou');
|
||||
$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");
|
||||
}
|
||||
|
||||
$datInventoryPC = $this->MIPC->getDataInventoryPC();
|
||||
|
||||
$data = [
|
||||
'sidebar' => "data inventory",
|
||||
'navChild' => "data inventory sku",
|
||||
'pc' => $datInventoryPC
|
||||
];
|
||||
|
||||
$this->load->view('inventory/table-inventory', $data);
|
||||
}
|
||||
|
||||
public function add()
|
||||
{
|
||||
$username = $this->session->userdata('username');
|
||||
if ($username == null) {
|
||||
redirect("Login");
|
||||
}
|
||||
$datInventoryPC = $this->MIPC->getDataInventoryPC();
|
||||
$datType = $this->MType->getDataType();
|
||||
$datProcessor = $this->MProcessor->getDataProcessor();
|
||||
$datRam = $this->MRam->getDataRam();
|
||||
$datHarddisk = $this->MHarddisk->getDataHarddisk();
|
||||
$datSsd = $this->MSsd->getDataSsd();
|
||||
$datVga = $this->MVga->getDataVga();
|
||||
$datOs = $this->MOs->getDataOs();
|
||||
$datDvd = $this->MDvd->getDataDvd();
|
||||
$datSp = $this->MSp->getDataSp();
|
||||
$datKeyMou = $this->MKeyMou->getDataKeyMou();
|
||||
$data = [
|
||||
'sidebar' => "data inventory",
|
||||
'navChild' => "data inventory sku",
|
||||
'pc' => $datInventoryPC,
|
||||
'type' => $datType,
|
||||
'processor' => $datProcessor,
|
||||
'ram' => $datRam,
|
||||
'hdd' => $datHarddisk,
|
||||
'ssd' => $datSsd,
|
||||
'vga' => $datVga,
|
||||
'os' => $datOs,
|
||||
'dvd' => $datDvd,
|
||||
'sp' => $datSp,
|
||||
'keymou' => $datKeyMou
|
||||
];
|
||||
//var_dump($data);
|
||||
$this->load->view('inventory/inventory-tambahpc', $data);
|
||||
}
|
||||
|
||||
public function save()
|
||||
{
|
||||
$method = $this->input->post('method');
|
||||
$id_pc = $this->input->post('id');
|
||||
$no_notapembelian = $this->input->post('no_notapembelian');
|
||||
$type = $this->input->post('TYPE');
|
||||
$processor = $this->input->post('PROCESSOR');
|
||||
$ram = $this->input->post('RAM');
|
||||
$hdd = $this->input->post('HDD');
|
||||
$ssd = $this->input->post('SSD');
|
||||
$vga = $this->input->post('VGA');
|
||||
$os = $this->input->post('OS');
|
||||
$dvd = $this->input->post('DVD');
|
||||
$sp = $this->input->post('SP');
|
||||
$keymou = $this->input->post('KEYMOU');
|
||||
|
||||
$this->form_validation->set_rules('no_notapembelian', 'Nota Pembelian', 'required');
|
||||
$this->form_validation->set_rules('TYPE', 'Pilih Type', 'required');
|
||||
$this->form_validation->set_rules('PROCESSOR', 'Pilih Processor', 'required');
|
||||
$this->form_validation->set_rules('RAM', 'Pilih RAM', 'required');
|
||||
$this->form_validation->set_rules('HDD', 'Pilih HDD', 'required');
|
||||
$this->form_validation->set_rules('SSD', 'Pilih SSD', 'required');
|
||||
$this->form_validation->set_rules('VGA', 'Pilih VGA', 'required');
|
||||
$this->form_validation->set_rules('OS', 'Pilih OS', 'required');
|
||||
$this->form_validation->set_rules('DVD', 'Pilih Dvd', 'required');
|
||||
$this->form_validation->set_rules('SP', 'Pilih Serial Paralel', 'required');
|
||||
$this->form_validation->set_rules('KEYMOU', 'Pilih Keyboard Mouse', 'required');
|
||||
|
||||
if ($this->form_validation->run() == FALSE) {
|
||||
$data = [
|
||||
'status' => false,
|
||||
'errors' => [
|
||||
'no_notapembelian' => form_error('no_notapembelian'),
|
||||
'TYPE' => form_error('TYPE'),
|
||||
'PROCESSOR' => form_error('PROCESSOR'),
|
||||
'RAM' => form_error('RAM'),
|
||||
'HDD' => form_error('HDD'),
|
||||
'SSD' => form_error('SSD'),
|
||||
'VGA' => form_error('VGA'),
|
||||
'OS' => form_error('OS'),
|
||||
'DVD' => form_error('DVD'),
|
||||
'SP' => form_error('SP'),
|
||||
'KEYMOU' => form_error('KEYMOU')
|
||||
]
|
||||
];
|
||||
//$this->output_json($data);//
|
||||
$this->session->set_flashdata('flashgagal', 'ditambah');
|
||||
redirect('ManageInventoryPC');
|
||||
|
||||
} else {
|
||||
|
||||
$input = [
|
||||
'NO_NOTAPEMBELIAN' => $no_notapembelian,
|
||||
'ID_TYPE' => $type,
|
||||
'ID_PROCESSOR' => $processor,
|
||||
'ID_RAM' => $ram,
|
||||
'ID_HDD' => $hdd,
|
||||
'ID_SSD' => $ssd,
|
||||
'ID_VGA' => $vga,
|
||||
'ID_OS' => $os,
|
||||
'ID_DVD' => $dvd,
|
||||
'ID_SP' => $sp,
|
||||
'ID_KEYMOU' => $keymou
|
||||
];
|
||||
|
||||
$action = $this->MIPC->create('pc', $input);
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('flash', 'ditambah');
|
||||
//$this->output_json(['status' => true]);
|
||||
redirect('ManageInventoryPC');
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'ditambah');
|
||||
//$this->output_json(['status' => true]);
|
||||
redirect('ManageInventoryPC');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function hapus()
|
||||
{
|
||||
$id = $this->input->post('id');
|
||||
if ($this->MIPC->delete('pc', $id, 'ID_PC')) {
|
||||
$this->session->set_flashdata('flash', 'dihapus');
|
||||
redirect('ManageInventoryPC');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,160 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
class ManageInventorySRV extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('ModelInventorySRV', 'MISRV');
|
||||
$this->load->model('ModelType', 'MType');
|
||||
$this->load->model('ModelProcessor', 'MProcessor');
|
||||
$this->load->model('ModelRam', 'MRam');
|
||||
$this->load->model('ModelHarddisk', 'MHarddisk');
|
||||
$this->load->model('ModelSsd', 'MSsd');
|
||||
$this->load->model('ModelOs', 'MOs');
|
||||
$this->load->model('ModelDvd', 'MDvd');
|
||||
$this->load->model('ModelRaid', 'MRaid');
|
||||
$this->load->model('ModelKeyMou', 'MKeyMou');
|
||||
$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");
|
||||
}
|
||||
|
||||
$datInventorySRV = $this->MIPC->getDataInventorySRV();
|
||||
|
||||
$data = [
|
||||
'sidebar' => "data inventory",
|
||||
'navChild' => "data inventory sku",
|
||||
'server' => $datInventorySRV
|
||||
];
|
||||
|
||||
$this->load->view('inventory/table-inventory', $data);
|
||||
}
|
||||
|
||||
public function add()
|
||||
{
|
||||
$username = $this->session->userdata('username');
|
||||
if ($username == null) {
|
||||
redirect("Login");
|
||||
}
|
||||
$datInventorySRV = $this->MIPC->getDataInventorySRV();
|
||||
$datType = $this->MType->getDataType();
|
||||
$datProcessor = $this->MProcessor->getDataProcessor();
|
||||
$datRam = $this->MRam->getDataRam();
|
||||
$datHarddisk = $this->MHarddisk->getDataHarddisk();
|
||||
$datSsd = $this->MSsd->getDataSsd();
|
||||
$datDvd = $this->MDvd->getDataDvd();
|
||||
$datRaid = $this->MSp->getDataRaid();
|
||||
$datKeyMou = $this->MKeyMou->getDataKeyMou();
|
||||
$data = [
|
||||
'sidebar' => "data inventory",
|
||||
'navChild' => "data inventory sku",
|
||||
'server' => $datInventorySRV,
|
||||
'type' => $datType,
|
||||
'processor' => $datProcessor,
|
||||
'ram' => $datRam,
|
||||
'hdd' => $datHarddisk,
|
||||
'ssd' => $datSsd,
|
||||
'dvd' => $datDvd,
|
||||
'raid' => $datRaid,
|
||||
'keymou' => $datKeyMou
|
||||
];
|
||||
//var_dump($data);
|
||||
$this->load->view('inventory/inventory-tambahsrv', $data);
|
||||
}
|
||||
|
||||
public function save()
|
||||
{
|
||||
$method = $this->input->post('method');
|
||||
$id_pc = $this->input->post('id');
|
||||
$no_notapembelian = $this->input->post('no_notapembelian');
|
||||
$type = $this->input->post('TYPE');
|
||||
$processor = $this->input->post('PROCESSOR');
|
||||
$ram = $this->input->post('RAM');
|
||||
$hdd = $this->input->post('HDD');
|
||||
$ssd = $this->input->post('SSD');
|
||||
$dvd = $this->input->post('DVD');
|
||||
$raid = $this->input->post('RAID');
|
||||
$keymou = $this->input->post('KEYMOU');
|
||||
|
||||
$this->form_validation->set_rules('no_notapembelian', 'Nota Pembelian', 'required');
|
||||
$this->form_validation->set_rules('TYPE', 'Pilih Type', 'required');
|
||||
$this->form_validation->set_rules('PROCESSOR', 'Pilih Processor', 'required');
|
||||
$this->form_validation->set_rules('RAM', 'Pilih RAM', 'required');
|
||||
$this->form_validation->set_rules('HDD', 'Pilih HDD', 'required');
|
||||
$this->form_validation->set_rules('SSD', 'Pilih SSD', 'required');
|
||||
$this->form_validation->set_rules('DVD', 'Pilih Dvd', 'required');
|
||||
$this->form_validation->set_rules('RAID', 'Pilih RAID Card', 'required');
|
||||
$this->form_validation->set_rules('KEYMOU', 'Pilih Keyboard Mouse', 'required');
|
||||
|
||||
if ($this->form_validation->run() == FALSE) {
|
||||
$data = [
|
||||
'status' => false,
|
||||
'errors' => [
|
||||
'no_notapembelian' => form_error('no_notapembelian'),
|
||||
'TYPE' => form_error('TYPE'),
|
||||
'PROCESSOR' => form_error('PROCESSOR'),
|
||||
'RAM' => form_error('RAM'),
|
||||
'HDD' => form_error('HDD'),
|
||||
'SSD' => form_error('SSD'),
|
||||
'DVD' => form_error('DVD'),
|
||||
'RAID' => form_error('RAID'),
|
||||
'KEYMOU' => form_error('KEYMOU')
|
||||
]
|
||||
];
|
||||
//$this->output_json($data);//
|
||||
$this->session->set_flashdata('flashgagal', 'ditambah');
|
||||
redirect('ManageInventorySRV');
|
||||
|
||||
} else {
|
||||
|
||||
$input = [
|
||||
'NO_NOTAPEMBELIAN' => $no_notapembelian,
|
||||
'ID_TYPE' => $type,
|
||||
'ID_PROCESSOR' => $processor,
|
||||
'ID_RAM' => $ram,
|
||||
'ID_HDD' => $hdd,
|
||||
'ID_SSD' => $ssd,
|
||||
'ID_DVD' => $dvd,
|
||||
'ID_RAID' => $raid,
|
||||
'ID_KEYMOU' => $keymou
|
||||
];
|
||||
|
||||
$action = $this->MISRV->create('server', $input);
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('flash', 'ditambah');
|
||||
//$this->output_json(['status' => true]);
|
||||
redirect('ManageInventorySRV');
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'ditambah');
|
||||
//$this->output_json(['status' => true]);
|
||||
redirect('ManageInventorySRV');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function hapus()
|
||||
{
|
||||
$id = $this->input->post('id');
|
||||
if ($this->MISRV->delete('server', $id, 'ID_SERVER')) {
|
||||
$this->session->set_flashdata('flash', 'dihapus');
|
||||
redirect('ManageInventorySRV');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,166 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
class ManageInventorySn extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('ModelInventorySn', 'MISn');
|
||||
$this->load->model('ModelInventory', 'MI');
|
||||
$this->load->model('ModelType', 'MType');
|
||||
$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");
|
||||
}
|
||||
|
||||
$datInventorySn = $this->MISn->getDataInventorySn();
|
||||
|
||||
$data = [
|
||||
'sidebar' => "data inventory",
|
||||
'navChild' => "data inventory sn",
|
||||
'sn' => $datInventorySn
|
||||
];
|
||||
|
||||
$this->load->view('inventory/table-inventorySn', $data);
|
||||
}
|
||||
|
||||
public function add()
|
||||
{
|
||||
$username = $this->session->userdata('username');
|
||||
if ($username == null) {
|
||||
redirect("Login");
|
||||
}
|
||||
$datInventorySn = $this->MISn->getDataInventorySn();
|
||||
$datInventory = $this->MI->getDataInventory();
|
||||
$data = [
|
||||
'sidebar' => "data inventory",
|
||||
'navChild' => "data inventory sn",
|
||||
'sn' => $datInventorySn,
|
||||
'inventory' => $datInventory
|
||||
];
|
||||
//var_dump($data);
|
||||
$this->load->view('inventory/sn', $data);
|
||||
}
|
||||
|
||||
public function save()
|
||||
{
|
||||
$method = $this->input->post('method');
|
||||
$id_sn = $this->input->post('id');
|
||||
$nama_sn = $this->input->post('nama_sn');
|
||||
$inventory = $this->input->post('INVENTORY');
|
||||
|
||||
$this->form_validation->set_rules('nama_sn', 'Serial Number', 'required');
|
||||
$this->form_validation->set_rules('INVENTORY', 'Pilih Type', 'required');
|
||||
|
||||
if ($this->form_validation->run() == FALSE) {
|
||||
$data = [
|
||||
'status' => false,
|
||||
'errors' => [
|
||||
'nama_sn' => form_error('nama_sn'),
|
||||
'INVENTORY' => form_error('INVENTORY')
|
||||
]
|
||||
];
|
||||
//$this->output_json($data);//
|
||||
$this->session->set_flashdata('flashgagal', 'ditambah');
|
||||
redirect('ManageInventorySn');
|
||||
|
||||
} else {
|
||||
|
||||
$input = [
|
||||
'NAMA_SN' => $nama_sn,
|
||||
'ID_INVENTORY' => $inventory
|
||||
];
|
||||
|
||||
$action = $this->MISn->create('sn', $input);
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('flash', 'ditambah');
|
||||
//$this->output_json(['status' => true]);
|
||||
redirect('ManageInventorySn');
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'ditambah');
|
||||
//$this->output_json(['status' => true]);
|
||||
redirect('ManageInventorySn');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function hapus()
|
||||
{
|
||||
$id = $this->input->post('id');
|
||||
if ($this->MISn->delete('sn', $id, 'ID_SN')) {
|
||||
$this->session->set_flashdata('flash', 'dihapus');
|
||||
redirect('ManageInventorySn');
|
||||
}
|
||||
}
|
||||
|
||||
public function sn()
|
||||
{
|
||||
$username = $this->session->userdata('username');
|
||||
$jabatan = $this->session->userdata('jabatan');
|
||||
if ($username == null) {
|
||||
redirect("Login");
|
||||
} elseif ($jabatan != "ADMIN") {
|
||||
redirect("Login");
|
||||
}
|
||||
|
||||
$inventory = $this->MISn->getInventory();
|
||||
|
||||
$data = [
|
||||
'sidebar' => "data inventory",
|
||||
'navChild' => "data inventory sn",
|
||||
'sn' => $inventory
|
||||
];
|
||||
|
||||
$this->load->view('inventory/sn', $data);
|
||||
}
|
||||
|
||||
public function getsn($id)
|
||||
{
|
||||
$sn = $this->MISn->getSnn($id);
|
||||
$this->output_json(['sn' => $sn]);
|
||||
}
|
||||
|
||||
public function ambildata($id = null)
|
||||
{
|
||||
if ($id != null) {
|
||||
$sn = $this->MISn->getSnn($id);
|
||||
$data = ['inventory' => $id, 'sn' => $sn];
|
||||
$this->load->view('inventory/ambildata', $data);
|
||||
} else {
|
||||
$data = ['inventory' => null, 'sn' => []];
|
||||
$this->load->view('inventory/ambildata', $data);
|
||||
}
|
||||
}
|
||||
|
||||
public function tambahsn($inventory, $sn)
|
||||
{
|
||||
|
||||
$input = [
|
||||
'NAMA_SN' => $sn,
|
||||
'ID_INVENTORY' => $inventory
|
||||
];
|
||||
|
||||
$action = $this->MISn->create('sn', $input);
|
||||
|
||||
if ($action) {
|
||||
$this->output_json(['value' => "berhasil"]);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,394 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
class ManageInventoryView extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('ModelInventoryView', 'MIView');
|
||||
$this->load->model('ModelType', 'MType');
|
||||
$this->load->model('ModelProcessor', 'MProcessor');
|
||||
$this->load->model('ModelRam', 'MRam');
|
||||
$this->load->model('ModelHarddisk', 'MHarddisk');
|
||||
$this->load->model('ModelSsd', 'MSsd');
|
||||
$this->load->model('ModelVga', 'MVga');
|
||||
$this->load->model('ModelOs', 'MOs');
|
||||
$this->load->model('ModelDvd', 'MDvd');
|
||||
$this->load->model('ModelSp', 'MSp');
|
||||
$this->load->model('ModelKeyMou', 'MKeyMou');
|
||||
$this->load->model('ModelWarna', 'MWarna');
|
||||
$this->load->model('ModelRaid', 'MRaid');
|
||||
$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");
|
||||
}
|
||||
|
||||
$datInventoryView = $this->MIView->getDataInventoryView();
|
||||
|
||||
$data = [
|
||||
'sidebar' => "data inventory",
|
||||
'navChild' => "data inventory view",
|
||||
'view' => $datInventoryView
|
||||
];
|
||||
|
||||
$this->load->view('inventory/table-inventoryView', $data);
|
||||
}
|
||||
|
||||
public function addPC()
|
||||
{
|
||||
$username = $this->session->userdata('username');
|
||||
if ($username == null) {
|
||||
redirect("Login");
|
||||
}
|
||||
$datInventory = $this->MI->getDataInventory();
|
||||
$datType = $this->MType->getDataType();
|
||||
$datProcessor = $this->MProcessor->getDataProcessor();
|
||||
$datRam = $this->MRam->getDataRam();
|
||||
$datHarddisk = $this->MHarddisk->getDataHarddisk();
|
||||
$datSsd = $this->MSsd->getDataSsd();
|
||||
$datVga = $this->MVga->getDataVga();
|
||||
$datOs = $this->MOs->getDataOs();
|
||||
$datDvd = $this->MDvd->getDataDvd();
|
||||
$datSp = $this->MSp->getDataSp();
|
||||
$datKeyMou = $this->MKeyMou->getDataKeyMou();
|
||||
$data = [
|
||||
'sidebar' => "data inventory",
|
||||
'navChild' => "data inventory sku",
|
||||
'inventory' => $datInventory,
|
||||
'type' => $datType,
|
||||
'processor' => $datProcessor,
|
||||
'ram' => $datRam,
|
||||
'hdd' => $datHarddisk,
|
||||
'ssd' => $datSsd,
|
||||
'vga' => $datVga,
|
||||
'os' => $datOs,
|
||||
'dvd' => $datDvd,
|
||||
'sp' => $datSp,
|
||||
'keymou' => $datKeyMou
|
||||
];
|
||||
//var_dump($data);
|
||||
$this->load->view('inventory/inventory-tambahpc', $data);
|
||||
}
|
||||
|
||||
public function addNB()
|
||||
{
|
||||
$username = $this->session->userdata('username');
|
||||
if ($username == null) {
|
||||
redirect("Login");
|
||||
}
|
||||
$datInventory = $this->MI->getDataInventory();
|
||||
$datType = $this->MType->getDataType();
|
||||
$datProcessor = $this->MProcessor->getDataProcessor();
|
||||
$datRam = $this->MRam->getDataRam();
|
||||
$datHarddisk = $this->MHarddisk->getDataHarddisk();
|
||||
$datSsd = $this->MSsd->getDataSsd();
|
||||
$datVga = $this->MVga->getDataVga();
|
||||
$datOs = $this->MOs->getDataOs();
|
||||
$datDvd = $this->MDvd->getDataDvd();
|
||||
$datWarna = $this->MWarna->getDataWarna();
|
||||
$data = [
|
||||
'sidebar' => "data inventory",
|
||||
'navChild' => "data inventory sku",
|
||||
'inventory' => $datInventory,
|
||||
'type' => $datType,
|
||||
'processor' => $datProcessor,
|
||||
'ram' => $datRam,
|
||||
'hdd' => $datHarddisk,
|
||||
'ssd' => $datSsd,
|
||||
'vga' => $datVga,
|
||||
'os' => $datOs,
|
||||
'dvd' => $datDvd,
|
||||
'warna' => $datWarna
|
||||
];
|
||||
//var_dump($data);
|
||||
$this->load->view('inventory/inventory-tambahnb', $data);
|
||||
}
|
||||
|
||||
public function addSRV()
|
||||
{
|
||||
$username = $this->session->userdata('username');
|
||||
if ($username == null) {
|
||||
redirect("Login");
|
||||
}
|
||||
$datInventory = $this->MI->getDataInventory();
|
||||
$datType = $this->MType->getDataType();
|
||||
$datProcessor = $this->MProcessor->getDataProcessor();
|
||||
$datRam = $this->MRam->getDataRam();
|
||||
$datHarddisk = $this->MHarddisk->getDataHarddisk();
|
||||
$datSsd = $this->MSsd->getDataSsd();
|
||||
$datVga = $this->MVga->getDataVga();
|
||||
$datOs = $this->MOs->getDataOs();
|
||||
$datDvd = $this->MDvd->getDataDvd();
|
||||
$datKeyMou = $this->MKeyMou->getDataKeyMou();
|
||||
$datRaid = $this->MRaid->getDataRaid();
|
||||
$data = [
|
||||
'sidebar' => "data inventory",
|
||||
'navChild' => "data inventory sku",
|
||||
'inventory' => $datInventory,
|
||||
'type' => $datType,
|
||||
'processor' => $datProcessor,
|
||||
'ram' => $datRam,
|
||||
'hdd' => $datHarddisk,
|
||||
'ssd' => $datSsd,
|
||||
'vga' => $datVga,
|
||||
'os' => $datOs,
|
||||
'dvd' => $datDvd,
|
||||
'keymou' => $datKeyMou,
|
||||
'raid' => $datRaid
|
||||
];
|
||||
//var_dump($data);
|
||||
$this->load->view('inventory/inventory-tambahsrv', $data);
|
||||
}
|
||||
|
||||
public function savePC()
|
||||
{
|
||||
$method = $this->input->post('method');
|
||||
$id_inventory = $this->input->post('id');
|
||||
$type = $this->input->post('TYPE');
|
||||
$processor = $this->input->post('PROCESSOR');
|
||||
$ram = $this->input->post('RAM');
|
||||
$hdd = $this->input->post('HDD');
|
||||
$ssd = $this->input->post('SSD');
|
||||
$vga = $this->input->post('VGA');
|
||||
$os = $this->input->post('OS');
|
||||
$dvd = $this->input->post('DVD');
|
||||
$sp = $this->input->post('SP');
|
||||
$keymou = $this->input->post('KEYMOU');
|
||||
|
||||
$this->form_validation->set_rules('TYPE', 'Pilih Type', 'required');
|
||||
$this->form_validation->set_rules('PROCESSOR', 'Pilih Processor', 'required');
|
||||
$this->form_validation->set_rules('RAM', 'Pilih RAM', 'required');
|
||||
$this->form_validation->set_rules('HDD', 'Pilih HDD', 'required');
|
||||
$this->form_validation->set_rules('SSD', 'Pilih SSD', 'required');
|
||||
$this->form_validation->set_rules('VGA', 'Pilih VGA', 'required');
|
||||
$this->form_validation->set_rules('OS', 'Pilih OS', 'required');
|
||||
$this->form_validation->set_rules('DVD', 'Pilih Dvd', 'required');
|
||||
$this->form_validation->set_rules('SP', 'Pilih Serial Paralel', 'required');
|
||||
$this->form_validation->set_rules('KEYMOU', 'Pilih Keyboard Mouse', 'required');
|
||||
|
||||
if ($this->form_validation->run() == FALSE) {
|
||||
$data = [
|
||||
'status' => false,
|
||||
'errors' => [
|
||||
'TYPE' => form_error('TYPE'),
|
||||
'PROCESSOR' => form_error('PROCESSOR'),
|
||||
'RAM' => form_error('RAM'),
|
||||
'HDD' => form_error('HDD'),
|
||||
'SSD' => form_error('SSD'),
|
||||
'VGA' => form_error('VGA'),
|
||||
'OS' => form_error('OS'),
|
||||
'DVD' => form_error('DVD'),
|
||||
'SP' => form_error('SP'),
|
||||
'KEYMOU' => form_error('KEYMOU')
|
||||
]
|
||||
];
|
||||
//$this->output_json($data);//
|
||||
$this->session->set_flashdata('flashgagal', 'ditambah');
|
||||
redirect('ManageInventory');
|
||||
|
||||
} else {
|
||||
|
||||
$input = [
|
||||
'ID_TYPE' => $type,
|
||||
'ID_PROCESSOR' => $processor,
|
||||
'ID_RAM' => $ram,
|
||||
'ID_HDD' => $hdd,
|
||||
'ID_SSD' => $ssd,
|
||||
'ID_VGA' => $vga,
|
||||
'ID_OS' => $os,
|
||||
'ID_DVD' => $dvd,
|
||||
'ID_SP' => $sp,
|
||||
'ID_KEYMOU' => $keymou,
|
||||
'ID_RAID' => '1',
|
||||
'ID_WARNA' => '1'
|
||||
];
|
||||
|
||||
$action = $this->MI->create('inventory', $input);
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('flash', 'ditambah');
|
||||
//$this->output_json(['status' => true]);
|
||||
redirect('ManageInventory');
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'ditambah');
|
||||
//$this->output_json(['status' => true]);
|
||||
redirect('ManageInventory');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function saveNB()
|
||||
{
|
||||
$method = $this->input->post('method');
|
||||
$id_inventory = $this->input->post('id');
|
||||
$type = $this->input->post('TYPE');
|
||||
$processor = $this->input->post('PROCESSOR');
|
||||
$ram = $this->input->post('RAM');
|
||||
$hdd = $this->input->post('HDD');
|
||||
$ssd = $this->input->post('SSD');
|
||||
$vga = $this->input->post('VGA');
|
||||
$os = $this->input->post('OS');
|
||||
$dvd = $this->input->post('DVD');
|
||||
$warna = $this->input->post('WARNA');
|
||||
|
||||
$this->form_validation->set_rules('TYPE', 'Pilih Type', 'required');
|
||||
$this->form_validation->set_rules('PROCESSOR', 'Pilih Processor', 'required');
|
||||
$this->form_validation->set_rules('RAM', 'Pilih RAM', 'required');
|
||||
$this->form_validation->set_rules('HDD', 'Pilih HDD', 'required');
|
||||
$this->form_validation->set_rules('SSD', 'Pilih SSD', 'required');
|
||||
$this->form_validation->set_rules('VGA', 'Pilih VGA', 'required');
|
||||
$this->form_validation->set_rules('OS', 'Pilih OS', 'required');
|
||||
$this->form_validation->set_rules('DVD', 'Pilih Dvd', 'required');
|
||||
$this->form_validation->set_rules('WARNA', 'Pilih Warna', 'required');
|
||||
|
||||
if ($this->form_validation->run() == FALSE) {
|
||||
$data = [
|
||||
'status' => false,
|
||||
'errors' => [
|
||||
'TYPE' => form_error('TYPE'),
|
||||
'PROCESSOR' => form_error('PROCESSOR'),
|
||||
'RAM' => form_error('RAM'),
|
||||
'HDD' => form_error('HDD'),
|
||||
'SSD' => form_error('SSD'),
|
||||
'VGA' => form_error('VGA'),
|
||||
'OS' => form_error('OS'),
|
||||
'DVD' => form_error('DVD'),
|
||||
'WARNA' => form_error('WARNA')
|
||||
]
|
||||
];
|
||||
//$this->output_json($data);//
|
||||
$this->session->set_flashdata('flashgagal', 'ditambah');
|
||||
redirect('ManageInventory');
|
||||
|
||||
} else {
|
||||
|
||||
$input = [
|
||||
'ID_TYPE' => $type,
|
||||
'ID_PROCESSOR' => $processor,
|
||||
'ID_RAM' => $ram,
|
||||
'ID_HDD' => $hdd,
|
||||
'ID_SSD' => $ssd,
|
||||
'ID_VGA' => $vga,
|
||||
'ID_OS' => $os,
|
||||
'ID_DVD' => $dvd,
|
||||
'ID_WARNA' => $warna,
|
||||
'ID_SP' => '1',
|
||||
'ID_KEYMOU' => '1',
|
||||
'ID_RAID' => '1'
|
||||
];
|
||||
|
||||
$action = $this->MI->create('inventory', $input);
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('flash', 'ditambah');
|
||||
//$this->output_json(['status' => true]);
|
||||
redirect('ManageInventory');
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'ditambah');
|
||||
//$this->output_json(['status' => true]);
|
||||
redirect('ManageInventory');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function saveSRV()
|
||||
{
|
||||
$method = $this->input->post('method');
|
||||
$id_inventory = $this->input->post('id');
|
||||
$type = $this->input->post('TYPE');
|
||||
$processor = $this->input->post('PROCESSOR');
|
||||
$ram = $this->input->post('RAM');
|
||||
$hdd = $this->input->post('HDD');
|
||||
$ssd = $this->input->post('SSD');
|
||||
$vga = $this->input->post('VGA');
|
||||
$os = $this->input->post('OS');
|
||||
$dvd = $this->input->post('DVD');
|
||||
$raid = $this->input->post('RAID');
|
||||
$keymou = $this->input->post('KEYMOU');
|
||||
|
||||
$this->form_validation->set_rules('TYPE', 'Pilih Type', 'required');
|
||||
$this->form_validation->set_rules('PROCESSOR', 'Pilih Processor', 'required');
|
||||
$this->form_validation->set_rules('RAM', 'Pilih RAM', 'required');
|
||||
$this->form_validation->set_rules('HDD', 'Pilih HDD', 'required');
|
||||
$this->form_validation->set_rules('SSD', 'Pilih SSD', 'required');
|
||||
$this->form_validation->set_rules('VGA', 'Pilih VGA', 'required');
|
||||
$this->form_validation->set_rules('OS', 'Pilih OS', 'required');
|
||||
$this->form_validation->set_rules('DVD', 'Pilih Dvd', 'required');
|
||||
$this->form_validation->set_rules('RAID', 'Pilih RAID Controller', 'required');
|
||||
$this->form_validation->set_rules('KEYMOU', 'Pilih Keyboard Mouse', 'required');
|
||||
|
||||
if ($this->form_validation->run() == FALSE) {
|
||||
$data = [
|
||||
'status' => false,
|
||||
'errors' => [
|
||||
'TYPE' => form_error('TYPE'),
|
||||
'PROCESSOR' => form_error('PROCESSOR'),
|
||||
'RAM' => form_error('RAM'),
|
||||
'HDD' => form_error('HDD'),
|
||||
'SSD' => form_error('SSD'),
|
||||
'VGA' => form_error('VGA'),
|
||||
'OS' => form_error('OS'),
|
||||
'DVD' => form_error('DVD'),
|
||||
'RAID' => form_error('RAID'),
|
||||
'KEYMOU' => form_error('KEYMOU')
|
||||
]
|
||||
];
|
||||
//$this->output_json($data);//
|
||||
$this->session->set_flashdata('flashgagal', 'ditambah');
|
||||
redirect('ManageInventory');
|
||||
|
||||
} else {
|
||||
|
||||
$input = [
|
||||
'ID_TYPE' => $type,
|
||||
'ID_PROCESSOR' => $processor,
|
||||
'ID_RAM' => $ram,
|
||||
'ID_HDD' => $hdd,
|
||||
'ID_SSD' => $ssd,
|
||||
'ID_VGA' => $vga,
|
||||
'ID_OS' => $os,
|
||||
'ID_DVD' => $dvd,
|
||||
'ID_RAID' => $raid,
|
||||
'ID_KEYMOU' => $keymou,
|
||||
'ID_WARNA' => '1',
|
||||
'ID_SP' => '1'
|
||||
];
|
||||
|
||||
$action = $this->MI->create('inventory', $input);
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('flash', 'ditambah');
|
||||
//$this->output_json(['status' => true]);
|
||||
redirect('ManageInventory');
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'ditambah');
|
||||
//$this->output_json(['status' => true]);
|
||||
redirect('ManageInventory');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function hapus()
|
||||
{
|
||||
$id = $this->input->post('id');
|
||||
if ($this->MI->delete('inventory', $id, 'ID_INVENTORY')) {
|
||||
$this->session->set_flashdata('flash', 'dihapus');
|
||||
redirect('ManageInventory');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
class ManageInvoice extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('ModelInvoice', 'MInvoice');
|
||||
$this->load->model('ModelDistributor', 'MDistributor');
|
||||
$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("Login");
|
||||
} elseif ($jabatan != "ADMIN") {
|
||||
redirect("Login");
|
||||
}
|
||||
|
||||
$datInvoice = $this->MInvoice->getDataInvoice();
|
||||
|
||||
$data = [
|
||||
'sidebar' => "data master",
|
||||
'navChild' => "data invoice",
|
||||
'invoice' => $datInvoice
|
||||
];
|
||||
|
||||
$this->load->view('invoice/table-invoice', $data);
|
||||
}
|
||||
|
||||
public function add()
|
||||
{
|
||||
$username = $this->session->userdata('username');
|
||||
if ($username == null) {
|
||||
redirect("Login");
|
||||
}
|
||||
$datDistributor = $this->MDistributor->getDataDistributor();
|
||||
$datInvoice = $this->MInvoice->getDataInvoice();
|
||||
$data = [
|
||||
'sidebar' => "data master",
|
||||
'navChild' => "data invoice",
|
||||
'distributor' => $datDistributor,
|
||||
'invoice' => $datInvoice
|
||||
|
||||
];
|
||||
//var_dump($data);
|
||||
$this->load->view('invoice/invoice-tambah', $data);
|
||||
}
|
||||
|
||||
public function save()
|
||||
{
|
||||
$method = $this->input->post('method');
|
||||
$no_invoice = $this->input->post('no_invoice');
|
||||
$tgl_invoice = $this->input->post('tgl_invoice');
|
||||
$distributor = $this->input->post('distributor');
|
||||
$nama_sku = $this->input->post('nama_sku');
|
||||
$hpp = $this->input->post('hpp');
|
||||
$jumlah = $this->input->post('jumlah');
|
||||
|
||||
$this->form_validation->set_rules('no_invoice', 'Nomor Invoice', 'required');
|
||||
$this->form_validation->set_rules('tgl_invoice', 'Tanggal Invoice', 'required');
|
||||
$this->form_validation->set_rules('distributor', 'Distributor', 'required');
|
||||
$this->form_validation->set_rules('nama_sku', 'Nama SKU', 'required');
|
||||
$this->form_validation->set_rules('hpp', 'Harga HPP', 'required');
|
||||
$this->form_validation->set_rules('jumlah', 'Jumlah', 'required');
|
||||
|
||||
if ($this->form_validation->run() == FALSE) {
|
||||
$data = [
|
||||
'status' => false,
|
||||
'errors' => [
|
||||
'no_invoice' => form_error('no_invoice'),
|
||||
'tgl_invoice' => form_error('tgl_invoice'),
|
||||
'distributor' => form_error('distributor'),
|
||||
'nama_sku' => form_error('nama_sku'),
|
||||
'hpp' => form_error('hpp'),
|
||||
'jumlah' => form_error('jumlah')
|
||||
]
|
||||
];
|
||||
$this->output_json($data);
|
||||
} else {
|
||||
$input = [
|
||||
'NO_INVOICE' => $no_invoice,
|
||||
'TGL_INVOICE' => $tgl_invoice,
|
||||
'ID_DISTRIBUTOR' => $distributor,
|
||||
'NAMA_SKU' => $nama_sku,
|
||||
'HPP' => $hpp,
|
||||
'JUMLAH' => $jumlah
|
||||
];
|
||||
|
||||
$action = $this->MInvoice->create('invoice', $input);
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('flash', 'ditambah');
|
||||
redirect('ManageInvoice');
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'ditambah');
|
||||
redirect('ManageInvoice');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function hapus()
|
||||
{
|
||||
$id = $this->input->post('id');
|
||||
if ($this->MInvoice->delete('invoice', $id, 'ID_INVOICE')) {
|
||||
$this->session->set_flashdata('flash', 'dihapus');
|
||||
redirect('ManageInvoice');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
class ManageJabatan extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('JabatanModel', 'JabatanM');
|
||||
$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");
|
||||
}
|
||||
|
||||
$datJabatan = $this->JabatanM->getDataJabatan();
|
||||
|
||||
$data = [
|
||||
'sidebar' => "data master",
|
||||
'navChild' => "data jabatan",
|
||||
'jabatan' => $datJabatan
|
||||
];
|
||||
|
||||
$this->load->view('karyawan/table-jabatan', $data);
|
||||
}
|
||||
|
||||
public function save()
|
||||
{
|
||||
$method = $this->input->post('method');
|
||||
$id_jabatan = $this->input->post('id');
|
||||
$nama = $this->input->post('nama');
|
||||
|
||||
$this->form_validation->set_rules('nama', 'Nama', 'required');
|
||||
if ($this->form_validation->run() == FALSE) {
|
||||
$data = [
|
||||
'status' => false,
|
||||
'errors' => [
|
||||
'nama' => form_error('nama')
|
||||
|
||||
]
|
||||
];
|
||||
$this->output_json($data);
|
||||
} else {
|
||||
|
||||
$input = [
|
||||
'NAMA_JABATAN' => $nama
|
||||
|
||||
];
|
||||
|
||||
if ($method === 'add') {
|
||||
$action = $this->JabatanM->create('jabatan', $input);
|
||||
} else if ($method === 'edit') {
|
||||
$action = $this->JabatanM->update('jabatan', $input, 'ID_JABATAN', $id_jabatan);
|
||||
}
|
||||
|
||||
if ($action) {
|
||||
if ($method === 'add') {
|
||||
$this->output_json(['status' => true]);
|
||||
} else if ($method === 'edit') {
|
||||
redirect('ManageJabatan');
|
||||
}
|
||||
} else {
|
||||
$this->output_json(['status' => false]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function hapus()
|
||||
{
|
||||
$id = $this->input->post('id');
|
||||
if ($this->JabatanM->delete('jabatan', $id, 'ID_jabatan')) {
|
||||
redirect('ManageJabatan');
|
||||
}
|
||||
}
|
||||
|
||||
// public function add(){
|
||||
// $username = $this->session->userdata('username');
|
||||
// if ($username == null){
|
||||
// redirect("Action");
|
||||
// }
|
||||
|
||||
// $this->load->view('tambah-user');
|
||||
// }
|
||||
}
|
||||
@@ -0,0 +1,192 @@
|
||||
<?php
|
||||
|
||||
use Restserver\Libraries\REST_Controller;
|
||||
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
require APPPATH . 'libraries/REST_Controller.php';
|
||||
require APPPATH . 'libraries/Format.php';
|
||||
|
||||
class ManageKBBank extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('ModelBank', 'Bank');
|
||||
$this->load->model('ModelNeraca', 'Neraca');
|
||||
$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);
|
||||
}
|
||||
|
||||
//Step One, Create Set Data
|
||||
public function index() {
|
||||
|
||||
$datDbank = $this->Bank->getDataDetailBank();
|
||||
$datBank = $this->Bank->getDataBankDbank();
|
||||
$data = [
|
||||
'sidebar' => "set data",
|
||||
'navChild' => "",
|
||||
'dbank' => $datDbank,
|
||||
'bank' => $datBank
|
||||
];
|
||||
|
||||
$this->load->view('proses/SetKBBank', $data);
|
||||
}
|
||||
|
||||
public function kodeDBANK() {
|
||||
$kk = $this->Bank->getKodeDBANK();
|
||||
if (is_array($kk) || is_object($kk)) {
|
||||
foreach ($kk as $row) {
|
||||
if ($row['KODE'] == null) {
|
||||
return "DBANK/000001";
|
||||
} else {
|
||||
$str = (string) $row['KODE'];
|
||||
$panjang = 6;
|
||||
$data = substr($str, 6, $panjang);
|
||||
|
||||
$ko = (int) $data + 1;
|
||||
$str = (string) $ko;
|
||||
|
||||
$panjang = 12 - strlen($str);
|
||||
$data = "DBANK/000000";
|
||||
$data = substr($data, 0, $panjang) . $str;
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function save() {
|
||||
$method = $this->input->post('method');
|
||||
$id = $this->input->post('id_dbank');
|
||||
$id_bank = $this->input->post('id_bank');
|
||||
$debit_dbank = $this->input->post('debit_dbank');
|
||||
$kode_dbank = $this->KodeDBANK();
|
||||
|
||||
$nilai = $this->Neraca->getDataNeraca(2);
|
||||
$nilai = $nilai[0]['NILAI_NERACA'];
|
||||
$nilai_neraca = $nilai+$debit_dbank;
|
||||
$id_neraca = 2;
|
||||
$update = [
|
||||
'NILAI_NERACA' => $nilai_neraca
|
||||
];
|
||||
$action = $this->Neraca->update('neraca', $update, 'ID_NERACA',$id_neraca);
|
||||
|
||||
$input = [
|
||||
'BANK_ID' => $id_bank,
|
||||
'KODE_DBANK' => $kode_dbank,
|
||||
'KODE_BUKTI' => "SETDATA",
|
||||
'DEBIT_DBANK' => $debit_dbank
|
||||
];
|
||||
$action = $this->Bank->create('detail_bank', $input);
|
||||
|
||||
$bank = $this->Bank->getDataBank($id_bank);
|
||||
$saldo_bank = $bank[0]['SALDO_BANK'];
|
||||
$saldo_bank = $saldo_bank+$debit_dbank;
|
||||
$update = [
|
||||
'SALDO_BANK' => $saldo_bank
|
||||
];
|
||||
$action = $this->Bank->update('bank', $update, 'ID_BANK',$id_bank);
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('flash', 'dilakukan');
|
||||
redirect($_SERVER['HTTP_REFERER']);
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'dilakukan');
|
||||
redirect($_SERVER['HTTP_REFERER']);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function edit() {
|
||||
$method = $this->input->post('method');
|
||||
$id_dbank = $this->input->post('id_dbank');
|
||||
$debit_dbank = $this->input->post('debit_dbanked');
|
||||
|
||||
$dbank = $this->Bank->getDataDetailDbank($id_dbank);
|
||||
$debit = $dbank[0]['DEBIT_DBANK'];
|
||||
$id_bank = $dbank[0]['BANK_ID'];
|
||||
$nilai = $this->Neraca->getDataNeraca(2);
|
||||
$nilai = $nilai[0]['NILAI_NERACA'];
|
||||
$nilai_neraca = $nilai-$debit;
|
||||
$id_neraca = 2;
|
||||
$update = [
|
||||
'NILAI_NERACA' => $nilai_neraca
|
||||
];
|
||||
$action = $this->Neraca->update('neraca', $update, 'ID_NERACA',$id_neraca);
|
||||
|
||||
$bank = $this->Bank->getDataBank($id_bank);
|
||||
$saldo_bank = $bank[0]['SALDO_BANK'];
|
||||
$saldo_bank = $saldo_bank-$debit;
|
||||
$update = [
|
||||
'SALDO_BANK' => $saldo_bank
|
||||
];
|
||||
$action = $this->Bank->update('bank', $update, 'ID_BANK',$id_bank);
|
||||
|
||||
$update = [
|
||||
'DEBIT_DBANK' => $debit_dbank
|
||||
];
|
||||
$action = $this->Bank->update('detail_bank', $update, 'ID_DBANK',$id_dbank);
|
||||
|
||||
$bank = $this->Bank->getDataBank($id_bank);
|
||||
$saldo_bank = $bank[0]['SALDO_BANK'];
|
||||
$saldo_bank = $saldo_bank+$debit_dbank;
|
||||
$update = [
|
||||
'SALDO_BANK' => $saldo_bank
|
||||
];
|
||||
$action = $this->Bank->update('bank', $update, 'ID_BANK',$id_bank);
|
||||
|
||||
$nilai = $this->Neraca->getDataNeraca(2);
|
||||
$nilai = $nilai[0]['NILAI_NERACA'];
|
||||
$nilai_neraca = $nilai+$debit_dbank;
|
||||
$id_neraca = 2;
|
||||
$update = [
|
||||
'NILAI_NERACA' => $nilai_neraca
|
||||
];
|
||||
$action = $this->Neraca->update('neraca', $update, 'ID_NERACA',$id_neraca);
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('flash', 'diubah');
|
||||
redirect($_SERVER['HTTP_REFERER']);
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'diubah');
|
||||
redirect($_SERVER['HTTP_REFERER']);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function hapus() {
|
||||
$id = $this->input->post('id');
|
||||
|
||||
$dbank = $this->Bank->getDataDetailDbank($id);
|
||||
$debit = $dbank[0]['DEBIT_DBANK'];
|
||||
$id_bank = $dbank[0]['BANK_ID'];
|
||||
|
||||
$nilai = $this->Neraca->getDataNeraca(2);
|
||||
$nilai = $nilai[0]['NILAI_NERACA'];
|
||||
$nilai_neraca = $nilai-$debit;
|
||||
$id_neraca = 2;
|
||||
$update = [
|
||||
'NILAI_NERACA' => $nilai_neraca
|
||||
];
|
||||
$action = $this->Neraca->update('neraca', $update, 'ID_NERACA',$id_neraca);
|
||||
|
||||
$bank = $this->Bank->getDataBank($id_bank);
|
||||
$saldo_bank = $bank[0]['SALDO_BANK'];
|
||||
$saldo_bank = $saldo_bank-$debit;
|
||||
$update = [
|
||||
'SALDO_BANK' => $saldo_bank
|
||||
];
|
||||
$action = $this->Bank->update('bank', $update, 'ID_BANK',$id_bank);
|
||||
|
||||
$action = $this->Bank->delete('detail_bank',$id,'ID_DBANK');
|
||||
|
||||
$this->session->set_flashdata('flash', 'dihapus');
|
||||
redirect($_SERVER['HTTP_REFERER']);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,193 @@
|
||||
<?php
|
||||
|
||||
use Restserver\Libraries\REST_Controller;
|
||||
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
require APPPATH . 'libraries/REST_Controller.php';
|
||||
require APPPATH . 'libraries/Format.php';
|
||||
|
||||
class ManageKBDpb extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('ModelSupplier', 'Supplier');
|
||||
$this->load->model('ModelNeraca', 'Neraca');
|
||||
$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);
|
||||
}
|
||||
|
||||
//Step One, Create Set Data
|
||||
public function index() {
|
||||
|
||||
$datDpb = $this->Supplier->getDataDpPembelian();
|
||||
$datSupplier = $this->Supplier->getDataSupplierDpb();
|
||||
$data = [
|
||||
'sidebar' => "set data",
|
||||
'navChild' => "",
|
||||
'dpb' => $datDpb,
|
||||
'supplier' => $datSupplier
|
||||
];
|
||||
|
||||
$this->load->view('proses/SetKBDpb', $data);
|
||||
}
|
||||
|
||||
public function kodeDPBeli() {
|
||||
$kk = $this->Supplier->getKodeDPB();
|
||||
if (is_array($kk) || is_object($kk)) {
|
||||
foreach ($kk as $row) {
|
||||
if ($row['KODE'] == null) {
|
||||
return "DPB/000001";
|
||||
} else {
|
||||
$str = (string) $row['KODE'];
|
||||
$panjang = 6;
|
||||
$data = substr($str, 4, $panjang);
|
||||
|
||||
$ko = (int) $data + 1;
|
||||
$str = (string) $ko;
|
||||
|
||||
$panjang = 10 - strlen($str);
|
||||
$data = "DPB/000000";
|
||||
$data = substr($data, 0, $panjang) . $str;
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function save() {
|
||||
$method = $this->input->post('method');
|
||||
$id = $this->input->post('id_dpb');
|
||||
$id_supplier = $this->input->post('id_supplier');
|
||||
$nominal_dpb = $this->input->post('nominal_dpb');
|
||||
$kode_dpb = $this->KodeDPBeli();
|
||||
|
||||
$nilai = $this->Neraca->getDataNeraca(7);
|
||||
$nilai = $nilai[0]['NILAI_NERACA'];
|
||||
$nilai_neraca = $nilai+$nominal_dpb;
|
||||
$id_neraca = 7;
|
||||
$update = [
|
||||
'NILAI_NERACA' => $nilai_neraca
|
||||
];
|
||||
$action = $this->Neraca->update('neraca', $update, 'ID_NERACA',$id_neraca);
|
||||
|
||||
$input = [
|
||||
'SUPPLIER_ID' => $id_supplier,
|
||||
'KODE_DPB' => $kode_dpb,
|
||||
'KODE_BUKTI' => "SETDATA",
|
||||
'NOMINAL_DPB' => $nominal_dpb,
|
||||
'BLOCKCON' => '0'
|
||||
];
|
||||
$action = $this->Supplier->create('dp_pembelian', $input);
|
||||
|
||||
$supplier = $this->Supplier->getDataSupplier($id_supplier);
|
||||
$saldo_supplier = $supplier[0]['SALDO_SUPPLIER'];
|
||||
$saldo_supplier = $saldo_supplier+$nominal_dpb;
|
||||
$update = [
|
||||
'SALDO_SUPPLIER' => $saldo_supplier
|
||||
];
|
||||
$action = $this->Supplier->update('supplier', $update, 'ID_SUPPLIER',$id_supplier);
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('flash', 'dilakukan');
|
||||
redirect($_SERVER['HTTP_REFERER']);
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'dilakukan');
|
||||
redirect($_SERVER['HTTP_REFERER']);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function edit() {
|
||||
$method = $this->input->post('method');
|
||||
$id_dpb = $this->input->post('id_dpb');
|
||||
$nominal_dpb = $this->input->post('nominal_dpbed');
|
||||
|
||||
$dpb = $this->Supplier->getDataDpb($id_dpb);
|
||||
$nominal = $dpb[0]['NOMINAL_DPB'];
|
||||
$id_supplier = $dpb[0]['SUPPLIER_ID'];
|
||||
$nilai = $this->Neraca->getDataNeraca(7);
|
||||
$nilai = $nilai[0]['NILAI_NERACA'];
|
||||
$nilai_neraca = $nilai-$nominal;
|
||||
$id_neraca = 7;
|
||||
$update = [
|
||||
'NILAI_NERACA' => $nilai_neraca
|
||||
];
|
||||
$action = $this->Neraca->update('neraca', $update, 'ID_NERACA',$id_neraca);
|
||||
|
||||
$supplier = $this->Supplier->getDataSupplier($id_supplier);
|
||||
$saldo_supplier = $supplier[0]['SALDO_SUPPLIER'];
|
||||
$saldo_supplier = $saldo_supplier-$nominal;
|
||||
$update = [
|
||||
'SALDO_SUPPLIER' => $saldo_supplier
|
||||
];
|
||||
$action = $this->Supplier->update('supplier', $update, 'ID_SUPPLIER',$id_supplier);
|
||||
|
||||
$update = [
|
||||
'NOMINAL_DPB' => $nominal_dpb
|
||||
];
|
||||
$action = $this->Supplier->update('dp_pembelian', $update, 'ID_DPB',$id_dpb);
|
||||
|
||||
$supplier = $this->Supplier->getDataSupplier($id_supplier);
|
||||
$saldo_supplier = $supplier[0]['SALDO_SUPPLIER'];
|
||||
$saldo_supplier = $saldo_supplier+$nominal_dpb;
|
||||
$update = [
|
||||
'SALDO_SUPPLIER' => $saldo_supplier
|
||||
];
|
||||
$action = $this->Supplier->update('supplier', $update, 'ID_SUPPLIER',$id_supplier);
|
||||
|
||||
$nilai = $this->Neraca->getDataNeraca(7);
|
||||
$nilai = $nilai[0]['NILAI_NERACA'];
|
||||
$nilai_neraca = $nilai+$nominal_dpb;
|
||||
$id_neraca = 7;
|
||||
$update = [
|
||||
'NILAI_NERACA' => $nilai_neraca
|
||||
];
|
||||
$action = $this->Neraca->update('neraca', $update, 'ID_NERACA',$id_neraca);
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('flash', 'diubah');
|
||||
redirect($_SERVER['HTTP_REFERER']);
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'diubah');
|
||||
redirect($_SERVER['HTTP_REFERER']);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function hapus() {
|
||||
$id = $this->input->post('id');
|
||||
|
||||
$dpb = $this->Supplier->getDataDpb($id);
|
||||
$nominal = $dpb[0]['NOMINAL_DPB'];
|
||||
$id_supplier = $dpb[0]['SUPPLIER_ID'];
|
||||
|
||||
$nilai = $this->Neraca->getDataNeraca(7);
|
||||
$nilai = $nilai[0]['NILAI_NERACA'];
|
||||
$nilai_neraca = $nilai-$nominal;
|
||||
$id_neraca = 7;
|
||||
$update = [
|
||||
'NILAI_NERACA' => $nilai_neraca
|
||||
];
|
||||
$action = $this->Neraca->update('neraca', $update, 'ID_NERACA',$id_neraca);
|
||||
|
||||
$supplier = $this->Supplier->getDataSupplier($id_supplier);
|
||||
$saldo_supplier = $supplier[0]['SALDO_SUPPLIER'];
|
||||
$saldo_supplier = $saldo_supplier-$nominal;
|
||||
$update = [
|
||||
'SALDO_SUPPLIER' => $saldo_supplier
|
||||
];
|
||||
$action = $this->Supplier->update('supplier', $update, 'ID_SUPPLIER',$id_supplier);
|
||||
|
||||
$action = $this->Supplier->delete('dp_pembelian',$id,'ID_DPB');
|
||||
|
||||
$this->session->set_flashdata('flash', 'dihapus');
|
||||
redirect($_SERVER['HTTP_REFERER']);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,193 @@
|
||||
<?php
|
||||
|
||||
use Restserver\Libraries\REST_Controller;
|
||||
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
require APPPATH . 'libraries/REST_Controller.php';
|
||||
require APPPATH . 'libraries/Format.php';
|
||||
|
||||
class ManageKBDpj extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('ModelPelanggan', 'Pelanggan');
|
||||
$this->load->model('ModelNeraca', 'Neraca');
|
||||
$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);
|
||||
}
|
||||
|
||||
//Step One, Create Set Data
|
||||
public function index() {
|
||||
|
||||
$datPelanggan = $this->Pelanggan->getDataPelangganDpj();
|
||||
$datDpj = $this->Pelanggan->getDataDpPenjualan();
|
||||
$data = [
|
||||
'sidebar' => "set data",
|
||||
'navChild' => "",
|
||||
'pelanggan' => $datPelanggan,
|
||||
'dpj' => $datDpj
|
||||
];
|
||||
|
||||
$this->load->view('proses/SetKBDpj', $data);
|
||||
}
|
||||
|
||||
public function kodeDPJual() {
|
||||
$kk = $this->Pelanggan->getKodeDPJ();
|
||||
if (is_array($kk) || is_object($kk)) {
|
||||
foreach ($kk as $row) {
|
||||
if ($row['KODE'] == null) {
|
||||
return "DPJ/000001";
|
||||
} else {
|
||||
$str = (string) $row['KODE'];
|
||||
$panjang = 6;
|
||||
$data = substr($str, 4, $panjang);
|
||||
|
||||
$ko = (int) $data + 1;
|
||||
$str = (string) $ko;
|
||||
|
||||
$panjang = 10 - strlen($str);
|
||||
$data = "DPJ/000000";
|
||||
$data = substr($data, 0, $panjang) . $str;
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function save() {
|
||||
$method = $this->input->post('method');
|
||||
$id = $this->input->post('id_dpj');
|
||||
$id_pelanggan = $this->input->post('id_pelanggan');
|
||||
$nominal_dpj = $this->input->post('nominal_dpj');
|
||||
$kode_dpj = $this->KodeDPJual();
|
||||
|
||||
$nilai = $this->Neraca->getDataNeraca(19);
|
||||
$nilai = $nilai[0]['NILAI_NERACA'];
|
||||
$nilai_neraca = $nilai+$nominal_dpj;
|
||||
$id_neraca = 19;
|
||||
$update = [
|
||||
'NILAI_NERACA' => $nilai_neraca
|
||||
];
|
||||
$action = $this->Neraca->update('neraca', $update, 'ID_NERACA',$id_neraca);
|
||||
|
||||
$input = [
|
||||
'PELANGGAN_ID' => $id_pelanggan,
|
||||
'KODE_DPJ' => $kode_dpj,
|
||||
'KODE_BUKTI' => "SETDATA",
|
||||
'NOMINAL_DPJ' => $nominal_dpj,
|
||||
'BLOCKCON' => '0'
|
||||
];
|
||||
$action = $this->Pelanggan->create('dp_penjualan', $input);
|
||||
|
||||
$pelanggan = $this->Pelanggan->getDataPelanggan($id_pelanggan);
|
||||
$saldo_pelanggan = $pelanggan[0]['SALDO_PELANGGAN'];
|
||||
$saldo_pelanggan = $saldo_pelanggan+$nominal_dpj;
|
||||
$update = [
|
||||
'SALDO_PELANGGAN' => $saldo_pelanggan
|
||||
];
|
||||
$action = $this->Pelanggan->update('pelanggan', $update, 'ID_PELANGGAN',$id_pelanggan);
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('flash', 'dilakukan');
|
||||
redirect($_SERVER['HTTP_REFERER']);
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'dilakukan');
|
||||
redirect($_SERVER['HTTP_REFERER']);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function edit() {
|
||||
$method = $this->input->post('method');
|
||||
$id_dpj = $this->input->post('id_dpj');
|
||||
$nominal_dpj = $this->input->post('nominal_dpjed');
|
||||
|
||||
$dpj = $this->Pelanggan->getDataDpj($id_dpj);
|
||||
$nominal = $dpj[0]['NOMINAL_DPJ'];
|
||||
$id_pelanggan = $dpj[0]['PELANGGAN_ID'];
|
||||
$nilai = $this->Neraca->getDataNeraca(19);
|
||||
$nilai = $nilai[0]['NILAI_NERACA'];
|
||||
$nilai_neraca = $nilai-$nominal;
|
||||
$id_neraca = 19;
|
||||
$update = [
|
||||
'NILAI_NERACA' => $nilai_neraca
|
||||
];
|
||||
$action = $this->Neraca->update('neraca', $update, 'ID_NERACA',$id_neraca);
|
||||
|
||||
$pelanggan = $this->Pelanggan->getDataPelanggan($id_pelanggan);
|
||||
$saldo_pelanggan = $pelanggan[0]['SALDO_PELANGGAN'];
|
||||
$saldo_pelanggan = $saldo_pelanggan-$nominal;
|
||||
$update = [
|
||||
'SALDO_PELANGGAN' => $saldo_pelanggan
|
||||
];
|
||||
$action = $this->Pelanggan->update('pelanggan', $update, 'ID_PELANGGAN',$id_pelanggan);
|
||||
|
||||
$update = [
|
||||
'NOMINAL_DPJ' => $nominal_dpj
|
||||
];
|
||||
$action = $this->Pelanggan->update('dp_penjualan', $update, 'ID_DPJ',$id_dpj);
|
||||
|
||||
$pelanggan = $this->Pelanggan->getDataPelanggan($id_pelanggan);
|
||||
$saldo_pelanggan = $pelanggan[0]['SALDO_PELANGGAN'];
|
||||
$saldo_pelanggan = $saldo_pelanggan+$nominal_dpj;
|
||||
$update = [
|
||||
'SALDO_PELANGGAN' => $saldo_pelanggan
|
||||
];
|
||||
$action = $this->Pelanggan->update('pelanggan', $update, 'ID_PELANGGAN',$id_pelanggan);
|
||||
|
||||
$nilai = $this->Neraca->getDataNeraca(19);
|
||||
$nilai = $nilai[0]['NILAI_NERACA'];
|
||||
$nilai_neraca = $nilai+$nominal_dpj;
|
||||
$id_neraca = 19;
|
||||
$update = [
|
||||
'NILAI_NERACA' => $nilai_neraca
|
||||
];
|
||||
$action = $this->Neraca->update('neraca', $update, 'ID_NERACA',$id_neraca);
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('flash', 'diubah');
|
||||
redirect($_SERVER['HTTP_REFERER']);
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'diubah');
|
||||
redirect($_SERVER['HTTP_REFERER']);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function hapus() {
|
||||
$id = $this->input->post('id');
|
||||
|
||||
$dpj = $this->Pelanggan->getDataDpj($id);
|
||||
$nominal = $dpj[0]['NOMINAL_DPJ'];
|
||||
$id_pelanggan = $dpj[0]['PELANGGAN_ID'];
|
||||
|
||||
$nilai = $this->Neraca->getDataNeraca(19);
|
||||
$nilai = $nilai[0]['NILAI_NERACA'];
|
||||
$nilai_neraca = $nilai-$nominal;
|
||||
$id_neraca = 19;
|
||||
$update = [
|
||||
'NILAI_NERACA' => $nilai_neraca
|
||||
];
|
||||
$action = $this->Neraca->update('neraca', $update, 'ID_NERACA',$id_neraca);
|
||||
|
||||
$pelanggan = $this->Pelanggan->getDataPelanggan($id_pelanggan);
|
||||
$saldo_pelanggan = $pelanggan[0]['SALDO_PELANGGAN'];
|
||||
$saldo_pelanggan = $saldo_pelanggan-$nominal;
|
||||
$update = [
|
||||
'SALDO_PELANGGAN' => $saldo_pelanggan
|
||||
];
|
||||
$action = $this->Pelanggan->update('pelanggan', $update, 'ID_PELANGGAN',$id_pelanggan);
|
||||
|
||||
$action = $this->Pelanggan->delete('dp_penjualan',$id,'ID_DPJ');
|
||||
|
||||
$this->session->set_flashdata('flash', 'dihapus');
|
||||
redirect($_SERVER['HTTP_REFERER']);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,193 @@
|
||||
<?php
|
||||
|
||||
use Restserver\Libraries\REST_Controller;
|
||||
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
require APPPATH . 'libraries/REST_Controller.php';
|
||||
require APPPATH . 'libraries/Format.php';
|
||||
|
||||
class ManageKBDpp extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('ModelCorp', 'Corp');
|
||||
$this->load->model('ModelNeraca', 'Neraca');
|
||||
$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);
|
||||
}
|
||||
|
||||
//Step One, Create Set Data
|
||||
public function index() {
|
||||
|
||||
$datCorp = $this->Corp->getDataCorpDpp();
|
||||
$datDpp = $this->Corp->getDataDpPajak();
|
||||
$data = [
|
||||
'sidebar' => "set data",
|
||||
'navChild' => "",
|
||||
'corp' => $datCorp,
|
||||
'dpp' => $datDpp
|
||||
];
|
||||
|
||||
$this->load->view('proses/SetKBDpp', $data);
|
||||
}
|
||||
|
||||
public function kodeDPPajak() {
|
||||
$kk = $this->Corp->getKodeDPP();
|
||||
if (is_array($kk) || is_object($kk)) {
|
||||
foreach ($kk as $row) {
|
||||
if ($row['KODE'] == null) {
|
||||
return "DPP/000001";
|
||||
} else {
|
||||
$str = (string) $row['KODE'];
|
||||
$panjang = 6;
|
||||
$data = substr($str, 4, $panjang);
|
||||
|
||||
$ko = (int) $data + 1;
|
||||
$str = (string) $ko;
|
||||
|
||||
$panjang = 10 - strlen($str);
|
||||
$data = "DPP/000000";
|
||||
$data = substr($data, 0, $panjang) . $str;
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function save() {
|
||||
$method = $this->input->post('method');
|
||||
$id = $this->input->post('id_dpp');
|
||||
$id_corp = $this->input->post('id_corp');
|
||||
$nominal_dpp = $this->input->post('nominal_dpp');
|
||||
$kode_dpp = $this->KodeDPPajak();
|
||||
|
||||
$nilai = $this->Neraca->getDataNeraca(8);
|
||||
$nilai = $nilai[0]['NILAI_NERACA'];
|
||||
$nilai_neraca = $nilai+$nominal_dpp;
|
||||
$id_neraca = 8;
|
||||
$update = [
|
||||
'NILAI_NERACA' => $nilai_neraca
|
||||
];
|
||||
$action = $this->Neraca->update('neraca', $update, 'ID_NERACA',$id_neraca);
|
||||
|
||||
$input = [
|
||||
'CORP_ID' => $id_corp,
|
||||
'KODE_DPP' => $kode_dpp,
|
||||
'KODE_BUKTI' => "SETDATA",
|
||||
'NOMINAL_DPP' => $nominal_dpp,
|
||||
'BLOCKCON' => '0'
|
||||
];
|
||||
$action = $this->Corp->create('dp_pajak', $input);
|
||||
|
||||
$corp = $this->Corp->getDataCorp($id_corp);
|
||||
$saldo_pajak = $corp[0]['SALDO_PAJAK'];
|
||||
$saldo_pajak = $saldo_pajak+$nominal_dpp;
|
||||
$update = [
|
||||
'SALDO_PAJAK' => $saldo_pajak
|
||||
];
|
||||
$action = $this->Corp->update('corp', $update, 'ID_CORP',$id_corp);
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('flash', 'dilakukan');
|
||||
redirect($_SERVER['HTTP_REFERER']);
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'dilakukan');
|
||||
redirect($_SERVER['HTTP_REFERER']);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function edit() {
|
||||
$method = $this->input->post('method');
|
||||
$id_dpp = $this->input->post('id_dpp');
|
||||
$nominal_dpp = $this->input->post('nominal_dpped');
|
||||
|
||||
$dpp = $this->Corp->getDataDpp($id_dpp);
|
||||
$nominal = $dpp[0]['NOMINAL_DPP'];
|
||||
$id_corp = $dpp[0]['CORP_ID'];
|
||||
$nilai = $this->Neraca->getDataNeraca(8);
|
||||
$nilai = $nilai[0]['NILAI_NERACA'];
|
||||
$nilai_neraca = $nilai-$nominal;
|
||||
$id_neraca = 8;
|
||||
$update = [
|
||||
'NILAI_NERACA' => $nilai_neraca
|
||||
];
|
||||
$action = $this->Neraca->update('neraca', $update, 'ID_NERACA',$id_neraca);
|
||||
|
||||
$corp = $this->Corp->getDataCorp($id_corp);
|
||||
$saldo_pajak = $corp[0]['SALDO_PAJAK'];
|
||||
$saldo_pajak = $saldo_pajak-$nominal;
|
||||
$update = [
|
||||
'SALDO_PAJAK' => $saldo_pajak
|
||||
];
|
||||
$action = $this->Corp->update('corp', $update, 'ID_CORP',$id_corp);
|
||||
|
||||
$update = [
|
||||
'NOMINAL_DPP' => $nominal_dpp
|
||||
];
|
||||
$action = $this->Corp->update('dp_pajak', $update, 'ID_DPP',$id_dpp);
|
||||
|
||||
$corp = $this->Corp->getDataCorp($id_corp);
|
||||
$saldo_pajak = $corp[0]['SALDO_PAJAK'];
|
||||
$saldo_pajak = $saldo_pajak+$nominal_dpp;
|
||||
$update = [
|
||||
'SALDO_PAJAK' => $saldo_pajak
|
||||
];
|
||||
$action = $this->Corp->update('corp', $update, 'ID_CORP',$id_corp);
|
||||
|
||||
$nilai = $this->Neraca->getDataNeraca(8);
|
||||
$nilai = $nilai[0]['NILAI_NERACA'];
|
||||
$nilai_neraca = $nilai+$nominal_dpp;
|
||||
$id_neraca = 8;
|
||||
$update = [
|
||||
'NILAI_NERACA' => $nilai_neraca
|
||||
];
|
||||
$action = $this->Neraca->update('neraca', $update, 'ID_NERACA',$id_neraca);
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('flash', 'diubah');
|
||||
redirect($_SERVER['HTTP_REFERER']);
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'diubah');
|
||||
redirect($_SERVER['HTTP_REFERER']);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function hapus() {
|
||||
$id = $this->input->post('id');
|
||||
|
||||
$dpp = $this->Corp->getDataDpp($id);
|
||||
$nominal = $dpp[0]['NOMINAL_DPP'];
|
||||
$id_corp = $dpp[0]['CORP_ID'];
|
||||
|
||||
$nilai = $this->Neraca->getDataNeraca(8);
|
||||
$nilai = $nilai[0]['NILAI_NERACA'];
|
||||
$nilai_neraca = $nilai-$nominal;
|
||||
$id_neraca = 8;
|
||||
$update = [
|
||||
'NILAI_NERACA' => $nilai_neraca
|
||||
];
|
||||
$action = $this->Neraca->update('neraca', $update, 'ID_NERACA',$id_neraca);
|
||||
|
||||
$corp = $this->Corp->getDataCorp($id_corp);
|
||||
$saldo_pajak = $corp[0]['SALDO_PAJAK'];
|
||||
$saldo_pajak = $saldo_pajak-$nominal;
|
||||
$update = [
|
||||
'SALDO_PAJAK' => $saldo_pajak
|
||||
];
|
||||
$action = $this->Corp->update('corp', $update, 'ID_CORP',$id_corp);
|
||||
|
||||
$action = $this->Corp->delete('dp_pajak',$id,'ID_DPP');
|
||||
|
||||
$this->session->set_flashdata('flash', 'dihapus');
|
||||
redirect($_SERVER['HTTP_REFERER']);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,183 @@
|
||||
<?php
|
||||
|
||||
use Restserver\Libraries\REST_Controller;
|
||||
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
require APPPATH . 'libraries/REST_Controller.php';
|
||||
require APPPATH . 'libraries/Format.php';
|
||||
|
||||
class ManageKBHba extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('ModelBank', 'Bank');
|
||||
$this->load->model('ModelNeraca', 'Neraca');
|
||||
$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() {
|
||||
|
||||
$datHutang = $this->Bank->getDataHutangBank();
|
||||
$datBank = $this->Bank->getDataBank();
|
||||
$data = [
|
||||
'sidebar' => "set data",
|
||||
'navChild' => "",
|
||||
'hutang' => $datHutang,
|
||||
'bank' => $datBank
|
||||
];
|
||||
|
||||
$this->load->view('proses/SetKBHba', $data);
|
||||
}
|
||||
|
||||
public function kodeHutangBank() {
|
||||
$kk = $this->Bank->getKodeHBA();
|
||||
if (is_array($kk) || is_object($kk)) {
|
||||
foreach ($kk as $row) {
|
||||
if ($row['KODE'] == NULL) {
|
||||
return "HBA/000001";
|
||||
} else {
|
||||
$str = (string) $row['KODE'];
|
||||
$panjang = 6;
|
||||
$data = substr($str, 4, $panjang);
|
||||
|
||||
$ko = (int) $data + 1;
|
||||
$str = (string) $ko;
|
||||
|
||||
$panjang = 10 - strlen($str);
|
||||
$data = "HBA/000000";
|
||||
$data = substr($data, 0, $panjang) . $str;
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function save() {
|
||||
$method = $this->input->post('method');
|
||||
$id = $this->input->post('id_hba');
|
||||
$id_bank = $this->input->post('id_bank');
|
||||
$nominal_hba = $this->input->post('nominal_hba');
|
||||
$kode_hba = $this->kodeHutangBank();
|
||||
$input = [
|
||||
'KODE_HBA' => $kode_hba,
|
||||
'KODE_BUKTI' => "SETDATA",
|
||||
'BANK_ID' => $id_bank,
|
||||
'NOMINAL_HBA' => $nominal_hba,
|
||||
'BLOCKCON' => '0'
|
||||
];
|
||||
$action = $this->Bank->create('hutang_bank', $input);
|
||||
$hutang_bank = $this->Bank->getDataBank($id_bank);
|
||||
$hutang_bank = $hutang_bank[0]['HUTANG_BANK'];
|
||||
$hutang_bank = $hutang_bank+$nominal_hba;
|
||||
$update = [
|
||||
'HUTANG_BANK' => $hutang_bank
|
||||
];
|
||||
$action = $this->Bank->update('bank', $update, 'ID_BANK',$id_bank);
|
||||
$nilai = $this->Neraca->getDataNeraca(17);
|
||||
$nilai = $nilai[0]['NILAI_NERACA'];
|
||||
$nilai_neraca = $nilai+$nominal_hba;
|
||||
$id_neraca = 17;
|
||||
$update = [
|
||||
'NILAI_NERACA' => $nilai_neraca
|
||||
];
|
||||
$action = $this->Neraca->update('neraca', $update, 'ID_NERACA',$id_neraca);
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('flash', 'dilakukan');
|
||||
redirect($_SERVER['HTTP_REFERER']);
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'dilakukan');
|
||||
redirect($_SERVER['HTTP_REFERER']);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function edit() {
|
||||
$method = $this->input->post('method');
|
||||
$id_hba = $this->input->post('id_hba');
|
||||
$id_bank = $this->input->post('id_bank');
|
||||
$nominal_hba = $this->input->post('nominal_hbaed');
|
||||
|
||||
$nominallama = $this->Bank->getDataHutangBank($id_hba);
|
||||
$hutanglama = $nominallama[0]['HUTANG_BANK'];
|
||||
$nominallama = $nominallama[0]['NOMINAL_HBA'];
|
||||
$nilai = $this->Neraca->getDataNeraca(17);
|
||||
$nilai = $nilai[0]['NILAI_NERACA'];
|
||||
$nilai_neraca = $nilai-$nominallama;
|
||||
$id_neraca = 17;
|
||||
$update = [
|
||||
'NILAI_NERACA' => $nilai_neraca
|
||||
];
|
||||
$action = $this->Neraca->update('neraca', $update, 'ID_NERACA',$id_neraca);
|
||||
$hutang_bank = $hutanglama-$nominallama;
|
||||
$update = [
|
||||
'HUTANG_BANK' => $hutang_bank
|
||||
];
|
||||
$action = $this->Bank->update('bank', $update, 'ID_BANK',$id_bank);
|
||||
$update = [
|
||||
'NOMINAL_HBA' => $nominal_hba
|
||||
];
|
||||
$action = $this->Bank->update('hutang_bank', $update,'ID_HBA',$id_hba);
|
||||
$nilai = $this->Neraca->getDataNeraca(17);
|
||||
$nilai = $nilai[0]['NILAI_NERACA'];
|
||||
$nilai_neraca = $nilai+$nominal_hba;
|
||||
$id_neraca = 17;
|
||||
$update = [
|
||||
'NILAI_NERACA' => $nilai_neraca
|
||||
];
|
||||
$action = $this->Neraca->update('neraca', $update, 'ID_NERACA',$id_neraca);
|
||||
$hutang_bank = $this->Bank->getDataHutangBank($id_hba);
|
||||
$hutang_bank = $hutang_bank[0]['HUTANG_BANK'];
|
||||
$hutang_bank = $hutang_bank+$nominal_hba;
|
||||
$update = [
|
||||
'HUTANG_BANK' => $hutang_bank
|
||||
];
|
||||
$action = $this->Bank->update('bank', $update, 'ID_BANK',$id_bank);
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('flash', 'diubah');
|
||||
redirect($_SERVER['HTTP_REFERER']);
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'diubah');
|
||||
redirect($_SERVER['HTTP_REFERER']);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function hapus() {
|
||||
$id = $this->input->post('id');
|
||||
|
||||
//Step Ambil Data Lama
|
||||
$datahutang = $this->Bank->getDataHutangBank($id);
|
||||
$id_bank = $datahutang[0]['BANK_ID'];
|
||||
$nominal_hba = $datahutang[0]['NOMINAL_HBA'];
|
||||
$hutang_bank = $datahutang[0]['HUTANG_BANK'];
|
||||
$hutang_bank = $hutang_bank-$nominal_hba;
|
||||
$update = [
|
||||
'HUTANG_BANK' => $hutang_bank
|
||||
];
|
||||
$action = $this->Bank->update('bank', $update, 'ID_BANK', $id_bank);
|
||||
$nilai = $this->Neraca->getDataNeraca(17);
|
||||
$nilai = $nilai[0]['NILAI_NERACA'];
|
||||
$nilai_neraca = $nilai-$nominal_hba;
|
||||
$id_neraca = 17;
|
||||
$update = [
|
||||
'NILAI_NERACA' => $nilai_neraca
|
||||
];
|
||||
$action = $this->Neraca->update('neraca', $update, 'ID_NERACA',$id_neraca);
|
||||
|
||||
//Step Hapus Data
|
||||
$action = $this->Bank->delete('hutang_bank',$id,'ID_HBA');
|
||||
|
||||
$this->session->set_flashdata('flash', 'dihapus');
|
||||
redirect($_SERVER['HTTP_REFERER']);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,332 @@
|
||||
<?php
|
||||
|
||||
use Restserver\Libraries\REST_Controller;
|
||||
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
require APPPATH . 'libraries/REST_Controller.php';
|
||||
require APPPATH . 'libraries/Format.php';
|
||||
|
||||
class ManageKBHda extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('ModelCorp', 'Corp');
|
||||
$this->load->model('ModelSupplier', 'Supplier');
|
||||
$this->load->model('ModelNeraca', 'Neraca');
|
||||
$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() {
|
||||
|
||||
$datHutang = $this->Supplier->getDataHutangDagang();
|
||||
$datSupplier = $this->Supplier->getDataSupplier();
|
||||
$datCorp = $this->Corp->getDataCorp();
|
||||
$data = [
|
||||
'sidebar' => "set data",
|
||||
'navChild' => "",
|
||||
'hutang' => $datHutang,
|
||||
'supplier' => $datSupplier,
|
||||
'corp' => $datCorp
|
||||
];
|
||||
|
||||
$this->load->view('proses/SetKBHda', $data);
|
||||
}
|
||||
|
||||
public function kodeHutangDagang() {
|
||||
$kk = $this->Supplier->getKodeHDA();
|
||||
if (is_array($kk) || is_object($kk)) {
|
||||
foreach ($kk as $row) {
|
||||
if ($row['KODE'] == NULL) {
|
||||
return "HDA/000001";
|
||||
} else {
|
||||
$str = (string) $row['KODE'];
|
||||
$panjang = 6;
|
||||
$data = substr($str, 4, $panjang);
|
||||
|
||||
$ko = (int) $data + 1;
|
||||
$str = (string) $ko;
|
||||
|
||||
$panjang = 10 - strlen($str);
|
||||
$data = "HDA/000000";
|
||||
$data = substr($data, 0, $panjang) . $str;
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function kodePembelian() {
|
||||
$kk = $this->Supplier->getKodePembelian();
|
||||
if (is_array($kk) || is_object($kk)) {
|
||||
foreach ($kk as $row) {
|
||||
if ($row['KODE'] == NULL) {
|
||||
return "PB/000001";
|
||||
} else {
|
||||
$str = (string) $row['KODE'];
|
||||
$panjang = 6;
|
||||
$data = substr($str, 3, $panjang);
|
||||
|
||||
$ko = (int) $data + 1;
|
||||
$str = (string) $ko;
|
||||
|
||||
$panjang = 9 - strlen($str);
|
||||
$data = "PB/000000";
|
||||
$data = substr($data, 0, $panjang) . $str;
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function save() {
|
||||
$method = $this->input->post('method');
|
||||
$id = $this->input->post('id_hda');
|
||||
$id_supplier = $this->input->post('id_supplier');
|
||||
$id_corp = $this->input->post('id_corp');
|
||||
$nominal_hda = $this->input->post('nominal_hda');
|
||||
$tgl_invoicebeli = $this->input->post('tgl_invoicebeli');
|
||||
$invoice_pembelian = $this->input->post('invoice_pembelian');
|
||||
$kode_hda = $this->kodeHutangDagang();
|
||||
$kode_pembelian = $this->kodePembelian();
|
||||
$input = [
|
||||
'KODE_PEMBELIAN' => $kode_pembelian,
|
||||
'CORP_ID' => $id_corp,
|
||||
'SUPPLIER_ID' => $id_supplier,
|
||||
'INVOICE_PEMBELIAN' => $invoice_pembelian,
|
||||
'TGL_INVOICEBELI' => $tgl_invoicebeli,
|
||||
'STATUS_PEMBELIAN' => '0'
|
||||
];
|
||||
$action = $this->Supplier->create('pembelian', $input);
|
||||
$id_pembelian = $this->Supplier->getIDPembelian();
|
||||
$id_pembelian = $id_pembelian[0]['ID_PEMBELIAN'];
|
||||
$input = [
|
||||
'KODE_HDA' => $kode_hda,
|
||||
'PEMBELIAN_ID' => $id_pembelian,
|
||||
'NOMINAL_HDA' => $nominal_hda,
|
||||
'BLOCKCON' => '0'
|
||||
];
|
||||
$action = $this->Supplier->create('hutang_dagang', $input);
|
||||
$piutang_supplier = $this->Supplier->getDataSupplier($id_supplier);
|
||||
$piutang_supplier = $piutang_supplier[0]['PIUTANG_SUPPLIER'];
|
||||
$piutang_supplier = $piutang_supplier+$nominal_hda;
|
||||
$update = [
|
||||
'PIUTANG_SUPPLIER' => $piutang_supplier
|
||||
];
|
||||
$action = $this->Supplier->update('supplier', $update, 'ID_SUPPLIER',$id_supplier);
|
||||
$hutang_corp = $this->Supplier->getDataCorp($id_corp);
|
||||
$hutang_corp = $hutang_corp[0]['HUTANG_CORP'];
|
||||
$hutang_corp = $hutang_corp+$nominal_hda;
|
||||
$update = [
|
||||
'HUTANG_CORP' => $hutang_corp
|
||||
];
|
||||
$action = $this->Supplier->update('corp', $update, 'ID_CORP',$id_corp);
|
||||
$nilai = $this->Neraca->getDataNeraca(15);
|
||||
$nilai = $nilai[0]['NILAI_NERACA'];
|
||||
$nilai_neraca = $nilai+$nominal_hda;
|
||||
$id_neraca = 15;
|
||||
$update = [
|
||||
'NILAI_NERACA' => $nilai_neraca
|
||||
];
|
||||
$action = $this->Neraca->update('neraca', $update, 'ID_NERACA',$id_neraca);
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('flash', 'dilakukan');
|
||||
redirect($_SERVER['HTTP_REFERER']);
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'dilakukan');
|
||||
redirect($_SERVER['HTTP_REFERER']);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function edit() {
|
||||
$method = $this->input->post('method');
|
||||
$id_hda = $this->input->post('id_hda');
|
||||
$id_corp = $this->input->post('id_corp');
|
||||
$id_supplier = $this->input->post('id_suppliered');
|
||||
$nominal_hda = $this->input->post('nominal_hdaed');
|
||||
$tgl_invoicebeli = $this->input->post('tgl_invoicebelied');
|
||||
$invoice_pembelian = $this->input->post('invoice_pembelianed');
|
||||
|
||||
$pembanding = $this->Supplier->getDataPembelian($id_hda);
|
||||
$supplier_id = $pembanding[0]['SUPPLIER_ID'];
|
||||
$corp_id = $pembanding[0]['CORP_ID'];
|
||||
|
||||
if ($id_supplier==$supplier_id) {
|
||||
$nominal = $pembanding[0]['NOMINAL_HDA'];
|
||||
$nilai = $this->Neraca->getDataNeraca(15);
|
||||
$nilai = $nilai[0]['NILAI_NERACA'];
|
||||
$nilai_neraca = $nilai-$nominal;
|
||||
$id_neraca = 15;
|
||||
$update = [
|
||||
'NILAI_NERACA' => $nilai_neraca
|
||||
];
|
||||
$action = $this->Neraca->update('neraca', $update, 'ID_NERACA',$id_neraca);
|
||||
$piutang_supplier = $this->Supplier->getDataSupplier($id_supplier);
|
||||
$piutang_supplier = $piutang_supplier[0]['PIUTANG_SUPPLIER'];
|
||||
$piutang_supplier = $piutang_supplier-$nominal;
|
||||
$update = [
|
||||
'PIUTANG_SUPPLIER' => $piutang_supplier
|
||||
];
|
||||
$action = $this->Supplier->update('supplier', $update, 'ID_SUPPLIER',$id_supplier);
|
||||
$hutang_corp = $this->Supplier->getDataCorp($id_corp);
|
||||
$hutang_corp = $hutang_corp[0]['HUTANG_CORP'];
|
||||
$hutang_corp = $hutang_corp-$nominal;
|
||||
$update = [
|
||||
'HUTANG_CORP' => $hutang_corp
|
||||
];
|
||||
$action = $this->Supplier->update('corp', $update, 'ID_CORP',$id_corp);
|
||||
$nilai = $this->Neraca->getDataNeraca(15);
|
||||
$nilai = $nilai[0]['NILAI_NERACA'];
|
||||
$nilai_neraca = $nilai+$nominal_hda;
|
||||
$id_neraca = 15;
|
||||
$update = [
|
||||
'NILAI_NERACA' => $nilai_neraca
|
||||
];
|
||||
$action = $this->Neraca->update('neraca', $update, 'ID_NERACA',$id_neraca);
|
||||
$id_pembelian = $this->Supplier->getDataPembelian($id_hda);
|
||||
$id_pembelian = $id_pembelian[0]['PEMBELIAN_ID'];
|
||||
$update = [
|
||||
'CORP_ID' => $id_corp,
|
||||
'SUPPLIER_ID' => $id_supplier,
|
||||
'INVOICE_PEMBELIAN' => $invoice_pembelian,
|
||||
'TGL_INVOICEBELI' => $tgl_invoicebeli
|
||||
];
|
||||
$action = $this->Supplier->update('pembelian', $update,'ID_PEMBELIAN',$id_pembelian);
|
||||
$update = [
|
||||
'NOMINAL_HDA' => $nominal_hda
|
||||
];
|
||||
$action = $this->Supplier->update('hutang_dagang', $update,'ID_HDA',$id_hda);
|
||||
$hutang_corp = $this->Supplier->getDataCorp($id_corp);
|
||||
$hutang_corp = $hutang_corp[0]['HUTANG_CORP'];
|
||||
$hutang_corp = $hutang_corp+$nominal_hda;
|
||||
$update = [
|
||||
'HUTANG_CORP' => $hutang_corp
|
||||
];
|
||||
$action = $this->Supplier->update('corp', $update,'ID_CORP',$id_corp);
|
||||
$piutang_supplier = $this->Supplier->getDataSupplier($id_supplier);
|
||||
$piutang_supplier = $piutang_supplier[0]['PIUTANG_SUPPLIER'];
|
||||
$piutang_supplier = $piutang_supplier+$nominal_hda;
|
||||
$update = [
|
||||
'PIUTANG_SUPPLIER' => $piutang_supplier
|
||||
];
|
||||
$action = $this->Supplier->update('supplier', $update,'ID_SUPPLIER',$id_supplier);
|
||||
} else {
|
||||
$nominal = $pembanding[0]['NOMINAL_HDA'];
|
||||
$nilai = $this->Neraca->getDataNeraca(15);
|
||||
$nilai = $nilai[0]['NILAI_NERACA'];
|
||||
$nilai_neraca = $nilai-$nominal;
|
||||
$id_neraca = 15;
|
||||
$update = [
|
||||
'NILAI_NERACA' => $nilai_neraca
|
||||
];
|
||||
$action = $this->Neraca->update('neraca', $update, 'ID_NERACA',$id_neraca);
|
||||
$piutang_supplier = $this->Supplier->getDataSupplier($supplier_id);
|
||||
$piutang_supplier = $piutang_supplier[0]['PIUTANG_SUPPLIER'];
|
||||
$piutang_supplier = $piutang_supplier-$nominal;
|
||||
$update = [
|
||||
'PIUTANG_SUPPLIER' => $piutang_supplier
|
||||
];
|
||||
$action = $this->Supplier->update('supplier', $update, 'ID_SUPPLIER',$supplier_id);
|
||||
$hutang_corp = $this->Supplier->getDataCorp($corp_id);
|
||||
$hutang_corp = $hutang_corp[0]['HUTANG_CORP'];
|
||||
$hutang_corp = $hutang_corp-$nominal;
|
||||
$update = [
|
||||
'HUTANG_CORP' => $hutang_corp
|
||||
];
|
||||
$action = $this->Supplier->update('corp', $update, 'ID_CORP',$corp_id);
|
||||
$nilai = $this->Neraca->getDataNeraca(15);
|
||||
$nilai = $nilai[0]['NILAI_NERACA'];
|
||||
$nilai_neraca = $nilai+$nominal_hda;
|
||||
$id_neraca = 15;
|
||||
$update = [
|
||||
'NILAI_NERACA' => $nilai_neraca
|
||||
];
|
||||
$action = $this->Neraca->update('neraca', $update, 'ID_NERACA',$id_neraca);
|
||||
$id_pembelian = $this->Supplier->getDataPembelian($id_hda);
|
||||
$id_pembelian = $id_pembelian[0]['PEMBELIAN_ID'];
|
||||
$update = [
|
||||
'CORP_ID' => $id_corp,
|
||||
'SUPPLIER_ID' => $id_supplier,
|
||||
'INVOICE_PEMBELIAN' => $invoice_pembelian,
|
||||
'TGL_INVOICEBELI' => $tgl_invoicebeli
|
||||
];
|
||||
$action = $this->Supplier->update('pembelian', $update,'ID_PEMBELIAN',$id_pembelian);
|
||||
$update = [
|
||||
'NOMINAL_HDA' => $nominal_hda
|
||||
];
|
||||
$action = $this->Supplier->update('hutang_dagang', $update,'ID_HDA',$id_hda);
|
||||
$hutang_corp = $this->Supplier->getDataCorp($id_corp);
|
||||
$hutang_corp = $hutang_corp[0]['HUTANG_CORP'];
|
||||
$hutang_corp = $hutang_corp+$nominal_hda;
|
||||
$update = [
|
||||
'HUTANG_CORP' => $hutang_corp
|
||||
];
|
||||
$action = $this->Supplier->update('corp', $update,'ID_CORP',$id_corp);
|
||||
$piutang_supplier = $this->Supplier->getDataSupplier($id_supplier);
|
||||
$piutang_supplier = $piutang_supplier[0]['PIUTANG_SUPPLIER'];
|
||||
$piutang_supplier = $piutang_supplier+$nominal_hda;
|
||||
$update = [
|
||||
'PIUTANG_SUPPLIER' => $piutang_supplier
|
||||
];
|
||||
$action = $this->Supplier->update('supplier', $update,'ID_SUPPLIER',$id_supplier);
|
||||
}
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('flash', 'diubah');
|
||||
redirect($_SERVER['HTTP_REFERER']);
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'diubah');
|
||||
redirect($_SERVER['HTTP_REFERER']);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function hapus() {
|
||||
$id = $this->input->post('id');
|
||||
|
||||
//Step Ambil Data Lama
|
||||
$datahutang = $this->Supplier->getDataPembelian($id);
|
||||
$id_pembelian = $datahutang[0]['PEMBELIAN_ID'];
|
||||
$id_supplier = $datahutang[0]['SUPPLIER_ID'];
|
||||
$id_corp = $datahutang[0]['CORP_ID'];
|
||||
$nominal_hda = $datahutang[0]['NOMINAL_HDA'];
|
||||
$hutang_corp = $this->Supplier->getDataCorp($id_corp);
|
||||
$hutang_corp = $hutang_corp[0]['HUTANG_CORP'];
|
||||
$hutang_corp = $hutang_corp-$nominal_hda;
|
||||
$update = [
|
||||
'HUTANG_CORP' => $hutang_corp
|
||||
];
|
||||
$action = $this->Supplier->update('corp', $update, 'ID_CORP', $id_corp);
|
||||
$piutang_supplier = $this->Supplier->getDataSupplier($id_supplier);
|
||||
$piutang_supplier = $piutang_supplier[0]['PIUTANG_SUPPLIER'];
|
||||
$piutang_supplier = $piutang_supplier-$nominal_hda;
|
||||
$update = [
|
||||
'PIUTANG_SUPPLIER' => $piutang_supplier
|
||||
];
|
||||
$action = $this->Supplier->update('supplier', $update, 'ID_SUPPLIER', $id_supplier);
|
||||
$nilai = $this->Neraca->getDataNeraca(15);
|
||||
$nilai = $nilai[0]['NILAI_NERACA'];
|
||||
$nilai_neraca = $nilai-$nominal_hda;
|
||||
$id_neraca = 15;
|
||||
$update = [
|
||||
'NILAI_NERACA' => $nilai_neraca
|
||||
];
|
||||
$action = $this->Neraca->update('neraca', $update, 'ID_NERACA',$id_neraca);
|
||||
|
||||
//Step Hapus Data
|
||||
$action = $this->Supplier->delete('pembelian',$id_pembelian,'ID_PEMBELIAN');
|
||||
$action = $this->Supplier->delete('hutang_dagang',$id,'ID_HDA');
|
||||
|
||||
$this->session->set_flashdata('flash', 'dihapus');
|
||||
redirect($_SERVER['HTTP_REFERER']);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,154 @@
|
||||
<?php
|
||||
|
||||
use Restserver\Libraries\REST_Controller;
|
||||
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
require APPPATH . 'libraries/REST_Controller.php';
|
||||
require APPPATH . 'libraries/Format.php';
|
||||
|
||||
class ManageKBHla extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('ModelNeraca', 'Neraca');
|
||||
$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() {
|
||||
|
||||
$datHutang = $this->Neraca->getDataHutangLain();
|
||||
$data = [
|
||||
'sidebar' => "set data",
|
||||
'navChild' => "",
|
||||
'hutang' => $datHutang
|
||||
];
|
||||
|
||||
$this->load->view('proses/SetKBHla', $data);
|
||||
}
|
||||
|
||||
public function kodeHutangLain() {
|
||||
$kk = $this->Neraca->getKodeHLA();
|
||||
if (is_array($kk) || is_object($kk)) {
|
||||
foreach ($kk as $row) {
|
||||
if ($row['KODE'] == NULL) {
|
||||
return "HLA/000001";
|
||||
} else {
|
||||
$str = (string) $row['KODE'];
|
||||
$panjang = 6;
|
||||
$data = substr($str, 4, $panjang);
|
||||
|
||||
$ko = (int) $data + 1;
|
||||
$str = (string) $ko;
|
||||
|
||||
$panjang = 10 - strlen($str);
|
||||
$data = "HLA/000000";
|
||||
$data = substr($data, 0, $panjang) . $str;
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function save() {
|
||||
$method = $this->input->post('method');
|
||||
$id = $this->input->post('id_hla');
|
||||
$nominal_hla = $this->input->post('nominal_hla');
|
||||
$ket_hla = $this->input->post('ket_hla');
|
||||
$kode_hla = $this->kodeHutangLain();
|
||||
$input = [
|
||||
'KODE_HLA' => $kode_hla,
|
||||
'KODE_BUKTI' => "SETDATA",
|
||||
'NOMINAL_HLA' => $nominal_hla,
|
||||
'KET_HLA' => $ket_hla,
|
||||
'BLOCKCON' => '0'
|
||||
];
|
||||
$action = $this->Neraca->create('hutang_lain', $input);
|
||||
$nilai = $this->Neraca->getDataNeraca(18);
|
||||
$nilai = $nilai[0]['NILAI_NERACA'];
|
||||
$nilai_neraca = $nilai+$nominal_hla;
|
||||
$id_neraca = 18;
|
||||
$update = [
|
||||
'NILAI_NERACA' => $nilai_neraca
|
||||
];
|
||||
$action = $this->Neraca->update('neraca', $update, 'ID_NERACA',$id_neraca);
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('flash', 'dilakukan');
|
||||
redirect($_SERVER['HTTP_REFERER']);
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'dilakukan');
|
||||
redirect($_SERVER['HTTP_REFERER']);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function edit() {
|
||||
$method = $this->input->post('method');
|
||||
$id_hla = $this->input->post('id_hla');
|
||||
$nominal_hla = $this->input->post('nominal_hlaed');
|
||||
$ket_hla = $this->input->post('ket_hlaed');
|
||||
|
||||
$nominallama = $this->Neraca->getDataHutangLain($id_hla);
|
||||
$nominallama = $nominallama[0]['NOMINAL_HLA'];
|
||||
$nilai = $this->Neraca->getDataNeraca(18);
|
||||
$nilai = $nilai[0]['NILAI_NERACA'];
|
||||
$nilai_neraca = $nilai-$nominallama;
|
||||
$id_neraca = 18;
|
||||
$update = [
|
||||
'NILAI_NERACA' => $nilai_neraca
|
||||
];
|
||||
$action = $this->Neraca->update('neraca', $update, 'ID_NERACA',$id_neraca);
|
||||
$update = [
|
||||
'NOMINAL_HLA' => $nominal_hla,
|
||||
'KET_HLA' => $ket_hla
|
||||
];
|
||||
$action = $this->Neraca->update('hutang_lain', $update,'ID_HLA',$id_hla);
|
||||
$nilai = $this->Neraca->getDataNeraca(18);
|
||||
$nilai = $nilai[0]['NILAI_NERACA'];
|
||||
$nilai_neraca = $nilai+$nominal_hla;
|
||||
$id_neraca = 18;
|
||||
$update = [
|
||||
'NILAI_NERACA' => $nilai_neraca
|
||||
];
|
||||
$action = $this->Neraca->update('neraca', $update, 'ID_NERACA',$id_neraca);
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('flash', 'diubah');
|
||||
redirect($_SERVER['HTTP_REFERER']);
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'diubah');
|
||||
redirect($_SERVER['HTTP_REFERER']);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function hapus() {
|
||||
$id = $this->input->post('id');
|
||||
|
||||
//Step Ambil Data Lama
|
||||
$datahutang = $this->Neraca->getDataHutangLain($id);
|
||||
$nominal_hla = $datahutang[0]['NOMINAL_HLA'];
|
||||
$nilai = $this->Neraca->getDataNeraca(18);
|
||||
$nilai = $nilai[0]['NILAI_NERACA'];
|
||||
$nilai_neraca = $nilai-$nominal_hla;
|
||||
$id_neraca = 18;
|
||||
$update = [
|
||||
'NILAI_NERACA' => $nilai_neraca
|
||||
];
|
||||
$action = $this->Neraca->update('neraca', $update, 'ID_NERACA',$id_neraca);
|
||||
|
||||
//Step Hapus Data
|
||||
$action = $this->Neraca->delete('hutang_lain',$id,'ID_HLA');
|
||||
|
||||
$this->session->set_flashdata('flash', 'dihapus');
|
||||
redirect($_SERVER['HTTP_REFERER']);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,190 @@
|
||||
<?php
|
||||
|
||||
use Restserver\Libraries\REST_Controller;
|
||||
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
require APPPATH . 'libraries/REST_Controller.php';
|
||||
require APPPATH . 'libraries/Format.php';
|
||||
|
||||
class ManageKBHpa extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('ModelCorp', 'Corp');
|
||||
$this->load->model('ModelNeraca', 'Neraca');
|
||||
$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() {
|
||||
|
||||
$datHutang = $this->Corp->getDataHutangPajak();
|
||||
$datCorp = $this->Corp->getDataCorpHpa();
|
||||
$data = [
|
||||
'sidebar' => "set data",
|
||||
'navChild' => "",
|
||||
'hutang' => $datHutang,
|
||||
'corp' => $datCorp
|
||||
];
|
||||
|
||||
$this->load->view('proses/SetKBHpa', $data);
|
||||
}
|
||||
|
||||
public function kodeHutangCorp() {
|
||||
$kk = $this->Corp->getKodeHPA();
|
||||
if (is_array($kk) || is_object($kk)) {
|
||||
foreach ($kk as $row) {
|
||||
if ($row['KODE'] == NULL) {
|
||||
return "HPA/000001";
|
||||
} else {
|
||||
$str = (string) $row['KODE'];
|
||||
$panjang = 6;
|
||||
$data = substr($str, 4, $panjang);
|
||||
|
||||
$ko = (int) $data + 1;
|
||||
$str = (string) $ko;
|
||||
|
||||
$panjang = 10 - strlen($str);
|
||||
$data = "HPA/000000";
|
||||
$data = substr($data, 0, $panjang) . $str;
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function save() {
|
||||
$method = $this->input->post('method');
|
||||
$id = $this->input->post('id_hpa');
|
||||
$id_corp = $this->input->post('id_corp');
|
||||
$nominal_hpa = $this->input->post('nominal_hpa');
|
||||
$kode_hpa = $this->kodeHutangCorp();
|
||||
$input = [
|
||||
'KODE_HPA' => $kode_hpa,
|
||||
'CORP_ID' => $id_corp,
|
||||
'NOMINAL_HPA' => $nominal_hpa,
|
||||
'BLOCKCON' => '0'
|
||||
];
|
||||
$action = $this->Corp->create('hutang_pajak', $input);
|
||||
$hutang_pajak = $this->Corp->getDataCorp($id_corp);
|
||||
$hutang_pajak = $hutang_pajak[0]['HUTANG_PAJAK'];
|
||||
$hutang_pajak = $hutang_pajak+$nominal_hpa;
|
||||
$update = [
|
||||
'HUTANG_PAJAK' => $hutang_pajak
|
||||
];
|
||||
$action = $this->Corp->update('corp', $update, 'ID_CORP',$id_corp);
|
||||
$nilai = $this->Neraca->getDataNeraca(16);
|
||||
$nilai = $nilai[0]['NILAI_NERACA'];
|
||||
$nilai_neraca = $nilai+$nominal_hpa;
|
||||
$id_neraca = 16;
|
||||
$update = [
|
||||
'NILAI_NERACA' => $nilai_neraca
|
||||
];
|
||||
$action = $this->Neraca->update('neraca', $update, 'ID_NERACA',$id_neraca);
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('flash', 'dilakukan');
|
||||
redirect($_SERVER['HTTP_REFERER']);
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'dilakukan');
|
||||
redirect($_SERVER['HTTP_REFERER']);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function edit() {
|
||||
$method = $this->input->post('method');
|
||||
$id_hpa = $this->input->post('id_hpa');
|
||||
$nominal_hpa = $this->input->post('nominal_hpaed');
|
||||
|
||||
$hpa = $this->Corp->getDataHpa($id_hpa);
|
||||
$nominal = $hpa[0]['NOMINAL_HPA'];
|
||||
$id_corp = $hpa[0]['CORP_ID'];
|
||||
$nilai = $this->Neraca->getDataNeraca(16);
|
||||
$nilai = $nilai[0]['NILAI_NERACA'];
|
||||
$nilai_neraca = $nilai-$nominal;
|
||||
$id_neraca = 16;
|
||||
$update = [
|
||||
'NILAI_NERACA' => $nilai_neraca
|
||||
];
|
||||
$action = $this->Neraca->update('neraca', $update, 'ID_NERACA',$id_neraca);
|
||||
|
||||
$corp = $this->Corp->getDataCorp($id_corp);
|
||||
$hutang_pajak = $corp[0]['HUTANG_PAJAK'];
|
||||
$hutang_pajak = $hutang_pajak-$nominal;
|
||||
$update = [
|
||||
'HUTANG_PAJAK' => $hutang_pajak
|
||||
];
|
||||
$action = $this->Corp->update('corp', $update, 'ID_CORP',$id_corp);
|
||||
|
||||
$update = [
|
||||
'NOMINAL_HPA' => $nominal_hpa
|
||||
];
|
||||
$action = $this->Corp->update('hutang_pajak', $update,'ID_HPA',$id_hpa);
|
||||
|
||||
$nilai = $this->Neraca->getDataNeraca(16);
|
||||
$nilai = $nilai[0]['NILAI_NERACA'];
|
||||
$nilai_neraca = $nilai+$nominal_hpa;
|
||||
$id_neraca = 16;
|
||||
$update = [
|
||||
'NILAI_NERACA' => $nilai_neraca
|
||||
];
|
||||
$action = $this->Neraca->update('neraca', $update, 'ID_NERACA',$id_neraca);
|
||||
|
||||
$corp = $this->Corp->getDataCorp($id_corp);
|
||||
$hutang_pajak = $corp[0]['HUTANG_PAJAK'];
|
||||
$hutang_pajak = $hutang_pajak+$nominal_hpa;
|
||||
$update = [
|
||||
'HUTANG_PAJAK' => $hutang_pajak
|
||||
];
|
||||
$action = $this->Corp->update('corp', $update, 'ID_CORP',$id_corp);
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('flash', 'diubah');
|
||||
redirect($_SERVER['HTTP_REFERER']);
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'diubah');
|
||||
redirect($_SERVER['HTTP_REFERER']);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function hapus() {
|
||||
$id = $this->input->post('id');
|
||||
|
||||
//Step Ambil Data Lama
|
||||
$hpa = $this->Corp->getDataHpa($id);
|
||||
$id_corp = $hpa[0]['CORP_ID'];
|
||||
$nominal_hpa = $hpa[0]['NOMINAL_HPA'];
|
||||
|
||||
$corp = $this->Corp->getDataCorp($id_corp);
|
||||
$hutang_pajak = $corp[0]['HUTANG_PAJAK'];
|
||||
$hutang_pajak = $hutang_pajak-$nominal_hpa;
|
||||
$update = [
|
||||
'HUTANG_PAJAK' => $hutang_pajak
|
||||
];
|
||||
$action = $this->Corp->update('corp', $update, 'ID_CORP', $id_corp);
|
||||
|
||||
$nilai = $this->Neraca->getDataNeraca(16);
|
||||
$nilai = $nilai[0]['NILAI_NERACA'];
|
||||
$nilai_neraca = $nilai-$nominal_hpa;
|
||||
$id_neraca = 16;
|
||||
$update = [
|
||||
'NILAI_NERACA' => $nilai_neraca
|
||||
];
|
||||
$action = $this->Neraca->update('neraca', $update, 'ID_NERACA',$id_neraca);
|
||||
|
||||
//Step Hapus Data
|
||||
$action = $this->Corp->delete('hutang_pajak',$id,'ID_HPA');
|
||||
|
||||
$this->session->set_flashdata('flash', 'dihapus');
|
||||
redirect($_SERVER['HTTP_REFERER']);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,192 @@
|
||||
<?php
|
||||
|
||||
use Restserver\Libraries\REST_Controller;
|
||||
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
require APPPATH . 'libraries/REST_Controller.php';
|
||||
require APPPATH . 'libraries/Format.php';
|
||||
|
||||
class ManageKBKas extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('ModelKas', 'Kas');
|
||||
$this->load->model('ModelNeraca', 'Neraca');
|
||||
$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);
|
||||
}
|
||||
|
||||
//Step One, Create Set Data
|
||||
public function index() {
|
||||
|
||||
$datDkas = $this->Kas->getDataDetailKas();
|
||||
$datKas = $this->Kas->getDataKasDkas();
|
||||
$data = [
|
||||
'sidebar' => "set data",
|
||||
'navChild' => "",
|
||||
'dkas' => $datDkas,
|
||||
'kas' => $datKas
|
||||
];
|
||||
|
||||
$this->load->view('proses/SetKBKas', $data);
|
||||
}
|
||||
|
||||
public function kodeDKAS() {
|
||||
$kk = $this->Kas->getKodeDKAS();
|
||||
if (is_array($kk) || is_object($kk)) {
|
||||
foreach ($kk as $row) {
|
||||
if ($row['KODE'] == null) {
|
||||
return "DKAS/000001";
|
||||
} else {
|
||||
$str = (string) $row['KODE'];
|
||||
$panjang = 6;
|
||||
$data = substr($str, 5, $panjang);
|
||||
|
||||
$ko = (int) $data + 1;
|
||||
$str = (string) $ko;
|
||||
|
||||
$panjang = 11 - strlen($str);
|
||||
$data = "DKAS/000000";
|
||||
$data = substr($data, 0, $panjang) . $str;
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function save() {
|
||||
$method = $this->input->post('method');
|
||||
$id = $this->input->post('id_dkas');
|
||||
$id_kas = $this->input->post('id_kas');
|
||||
$debit_dkas = $this->input->post('debit_dkas');
|
||||
$kode_dkas = $this->KodeDKAS();
|
||||
|
||||
$nilai = $this->Neraca->getDataNeraca(1);
|
||||
$nilai = $nilai[0]['NILAI_NERACA'];
|
||||
$nilai_neraca = $nilai+$debit_dkas;
|
||||
$id_neraca = 1;
|
||||
$update = [
|
||||
'NILAI_NERACA' => $nilai_neraca
|
||||
];
|
||||
$action = $this->Neraca->update('neraca', $update, 'ID_NERACA',$id_neraca);
|
||||
|
||||
$input = [
|
||||
'KAS_ID' => $id_kas,
|
||||
'KODE_DKAS' => $kode_dkas,
|
||||
'KODE_BUKTI' => "SETDATA",
|
||||
'DEBIT_DKAS' => $debit_dkas
|
||||
];
|
||||
$action = $this->Kas->create('detail_kas', $input);
|
||||
|
||||
$kas = $this->Kas->getDataKas($id_kas);
|
||||
$saldo_kas = $kas[0]['SALDO_KAS'];
|
||||
$saldo_kas = $saldo_kas+$debit_dkas;
|
||||
$update = [
|
||||
'SALDO_KAS' => $saldo_kas
|
||||
];
|
||||
$action = $this->Kas->update('kas', $update, 'ID_KAS',$id_kas);
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('flash', 'dilakukan');
|
||||
redirect($_SERVER['HTTP_REFERER']);
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'dilakukan');
|
||||
redirect($_SERVER['HTTP_REFERER']);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function edit() {
|
||||
$method = $this->input->post('method');
|
||||
$id_dkas = $this->input->post('id_dkas');
|
||||
$debit_dkas = $this->input->post('debit_dkased');
|
||||
|
||||
$dkas = $this->Kas->getDataDetailDkas($id_dkas);
|
||||
$debit = $dkas[0]['DEBIT_DKAS'];
|
||||
$id_kas = $dkas[0]['KAS_ID'];
|
||||
$nilai = $this->Neraca->getDataNeraca(1);
|
||||
$nilai = $nilai[0]['NILAI_NERACA'];
|
||||
$nilai_neraca = $nilai-$debit;
|
||||
$id_neraca = 1;
|
||||
$update = [
|
||||
'NILAI_NERACA' => $nilai_neraca
|
||||
];
|
||||
$action = $this->Neraca->update('neraca', $update, 'ID_NERACA',$id_neraca);
|
||||
|
||||
$kas = $this->Kas->getDataKas($id_kas);
|
||||
$saldo_kas = $kas[0]['SALDO_KAS'];
|
||||
$saldo_kas = $saldo_kas-$debit;
|
||||
$update = [
|
||||
'SALDO_KAS' => $saldo_kas
|
||||
];
|
||||
$action = $this->Kas->update('kas', $update, 'ID_KAS',$id_kas);
|
||||
|
||||
$update = [
|
||||
'DEBIT_DKAS' => $debit_dkas
|
||||
];
|
||||
$action = $this->Kas->update('detail_kas', $update, 'ID_DKAS',$id_dkas);
|
||||
|
||||
$kas = $this->Kas->getDataKas($id_kas);
|
||||
$saldo_kas = $kas[0]['SALDO_KAS'];
|
||||
$saldo_kas = $saldo_kas+$debit_dkas;
|
||||
$update = [
|
||||
'SALDO_KAS' => $saldo_kas
|
||||
];
|
||||
$action = $this->Kas->update('kas', $update, 'ID_KAS',$id_kas);
|
||||
|
||||
$nilai = $this->Neraca->getDataNeraca(1);
|
||||
$nilai = $nilai[0]['NILAI_NERACA'];
|
||||
$nilai_neraca = $nilai+$debit_dkas;
|
||||
$id_neraca = 1;
|
||||
$update = [
|
||||
'NILAI_NERACA' => $nilai_neraca
|
||||
];
|
||||
$action = $this->Neraca->update('neraca', $update, 'ID_NERACA',$id_neraca);
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('flash', 'diubah');
|
||||
redirect($_SERVER['HTTP_REFERER']);
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'diubah');
|
||||
redirect($_SERVER['HTTP_REFERER']);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function hapus() {
|
||||
$id = $this->input->post('id');
|
||||
|
||||
$dkas = $this->Kas->getDataDetailDkas($id);
|
||||
$debit = $dkas[0]['DEBIT_DKAS'];
|
||||
$id_kas = $dkas[0]['KAS_ID'];
|
||||
|
||||
$nilai = $this->Neraca->getDataNeraca(1);
|
||||
$nilai = $nilai[0]['NILAI_NERACA'];
|
||||
$nilai_neraca = $nilai-$debit;
|
||||
$id_neraca = 1;
|
||||
$update = [
|
||||
'NILAI_NERACA' => $nilai_neraca
|
||||
];
|
||||
$action = $this->Neraca->update('neraca', $update, 'ID_NERACA',$id_neraca);
|
||||
|
||||
$kas = $this->Kas->getDataKas($id_kas);
|
||||
$saldo_kas = $kas[0]['SALDO_KAS'];
|
||||
$saldo_kas = $saldo_kas-$debit;
|
||||
$update = [
|
||||
'SALDO_KAS' => $saldo_kas
|
||||
];
|
||||
$action = $this->Kas->update('kas', $update, 'ID_KAS',$id_kas);
|
||||
|
||||
$action = $this->Kas->delete('detail_kas',$id,'ID_DKAS');
|
||||
|
||||
$this->session->set_flashdata('flash', 'dihapus');
|
||||
redirect($_SERVER['HTTP_REFERER']);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,332 @@
|
||||
<?php
|
||||
|
||||
use Restserver\Libraries\REST_Controller;
|
||||
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
require APPPATH . 'libraries/REST_Controller.php';
|
||||
require APPPATH . 'libraries/Format.php';
|
||||
|
||||
class ManageKBPda extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('ModelCorp', 'Corp');
|
||||
$this->load->model('ModelPelanggan', 'Pelanggan');
|
||||
$this->load->model('ModelNeraca', 'Neraca');
|
||||
$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() {
|
||||
|
||||
$datPiutang = $this->Pelanggan->getDataPiutangDagang();
|
||||
$datPelanggan = $this->Pelanggan->getDataPelanggan();
|
||||
$datCorp = $this->Corp->getDataCorp();
|
||||
$datSales = $this->Pelanggan->getDataSales();
|
||||
$data = [
|
||||
'sidebar' => "set data",
|
||||
'navChild' => "",
|
||||
'piutang' => $datPiutang,
|
||||
'pelanggan' => $datPelanggan,
|
||||
'corp' => $datCorp,
|
||||
'sales' => $datSales
|
||||
];
|
||||
|
||||
$this->load->view('proses/SetKBPda', $data);
|
||||
}
|
||||
|
||||
public function kodePiutangDagang() {
|
||||
$kk = $this->Pelanggan->getKodePDA();
|
||||
if (is_array($kk) || is_object($kk)) {
|
||||
foreach ($kk as $row) {
|
||||
if ($row['KODE'] == NULL) {
|
||||
return "PDA/000001";
|
||||
} else {
|
||||
$str = (string) $row['KODE'];
|
||||
$panjang = 6;
|
||||
$data = substr($str, 4, $panjang);
|
||||
|
||||
$ko = (int) $data + 1;
|
||||
$str = (string) $ko;
|
||||
|
||||
$panjang = 10 - strlen($str);
|
||||
$data = "PDA/000000";
|
||||
$data = substr($data, 0, $panjang) . $str;
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function kodePenjualan() {
|
||||
$kk = $this->Pelanggan->getKodePenjualan();
|
||||
if (is_array($kk) || is_object($kk)) {
|
||||
foreach ($kk as $row) {
|
||||
if ($row['KODE'] == NULL) {
|
||||
return "PJ/000001";
|
||||
} else {
|
||||
$str = (string) $row['KODE'];
|
||||
$panjang = 6;
|
||||
$data = substr($str, 3, $panjang);
|
||||
|
||||
$ko = (int) $data + 1;
|
||||
$str = (string) $ko;
|
||||
|
||||
$panjang = 9 - strlen($str);
|
||||
$data = "PJ/000000";
|
||||
$data = substr($data, 0, $panjang) . $str;
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function save() {
|
||||
$method = $this->input->post('method');
|
||||
$id = $this->input->post('id_pda');
|
||||
$id_pelanggan = $this->input->post('id_pelanggan');
|
||||
$id_corp = $this->input->post('id_corp');
|
||||
$id_sales = $this->input->post('id_sales');
|
||||
$nominal_pda = $this->input->post('nominal_pda');
|
||||
$po_penjualan = $this->input->post('po_penjualan');
|
||||
$kode_pda = $this->kodePiutangDagang();
|
||||
$kode_penjualan = $this->kodePenjualan();
|
||||
$input = [
|
||||
'KODE_PENJUALAN' => $kode_penjualan,
|
||||
'CORP_ID' => $id_corp,
|
||||
'SALES_ID' => $id_sales,
|
||||
'PELANGGAN_ID' => $id_pelanggan,
|
||||
'PO_PENJUALAN' => $po_penjualan,
|
||||
'STATUS_PENJUALAN' => '0'
|
||||
];
|
||||
$action = $this->Pelanggan->create('penjualan', $input);
|
||||
$id_penjualan = $this->Pelanggan->getIDPenjualan();
|
||||
$id_penjualan = $id_penjualan[0]['ID_PENJUALAN'];
|
||||
$input = [
|
||||
'KODE_PDA' => $kode_pda,
|
||||
'PENJUALAN_ID' => $id_penjualan,
|
||||
'NOMINAL_PDA' => $nominal_pda,
|
||||
'BLOCKCON' => '0'
|
||||
];
|
||||
$action = $this->Pelanggan->create('piutang_dagang', $input);
|
||||
$hutang_pelanggan = $this->Pelanggan->getDataPelanggan($id_pelanggan);
|
||||
$hutang_pelanggan = $hutang_pelanggan[0]['HUTANG_PELANGGAN'];
|
||||
$hutang_pelanggan = $hutang_pelanggan+$nominal_pda;
|
||||
$update = [
|
||||
'HUTANG_PELANGGAN' => $hutang_pelanggan
|
||||
];
|
||||
$action = $this->Pelanggan->update('pelanggan', $update, 'ID_PELANGGAN',$id_pelanggan);
|
||||
$piutang_corp = $this->Pelanggan->getDataCorp($id_corp);
|
||||
$piutang_corp = $piutang_corp[0]['PIUTANG_CORP'];
|
||||
$piutang_corp = $piutang_corp+$nominal_pda;
|
||||
$update = [
|
||||
'PIUTANG_CORP' => $piutang_corp
|
||||
];
|
||||
$action = $this->Pelanggan->update('corp', $update, 'ID_CORP',$id_corp);
|
||||
$nilai = $this->Neraca->getDataNeraca(3);
|
||||
$nilai = $nilai[0]['NILAI_NERACA'];
|
||||
$nilai_neraca = $nilai+$nominal_pda;
|
||||
$id_neraca = 3;
|
||||
$update = [
|
||||
'NILAI_NERACA' => $nilai_neraca
|
||||
];
|
||||
$action = $this->Neraca->update('neraca', $update, 'ID_NERACA',$id_neraca);
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('flash', 'dilakukan');
|
||||
redirect($_SERVER['HTTP_REFERER']);
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'dilakukan');
|
||||
redirect($_SERVER['HTTP_REFERER']);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function edit() {
|
||||
$method = $this->input->post('method');
|
||||
$id_pda = $this->input->post('id_pda');
|
||||
$id_corp = $this->input->post('id_corp');
|
||||
$id_sales = $this->input->post('id_sales');
|
||||
$id_pelanggan = $this->input->post('id_pelanggan');
|
||||
$nominal_pda = $this->input->post('nominal_pdaed');
|
||||
$po_penjualan = $this->input->post('po_penjualaned');
|
||||
|
||||
$pembanding = $this->Pelanggan->getDataPenjualan($id_pda);
|
||||
$pelanggan_id = $pembanding[0]['PELANGGAN_ID'];
|
||||
$corp_id = $pembanding[0]['CORP_ID'];
|
||||
|
||||
if ($id_pelanggan==$pelanggan_id) {
|
||||
$nominal = $pembanding[0]['NOMINAL_PDA'];
|
||||
$nilai = $this->Neraca->getDataNeraca(3);
|
||||
$nilai = $nilai[0]['NILAI_NERACA'];
|
||||
$nilai_neraca = $nilai-$nominal;
|
||||
$id_neraca = 3;
|
||||
$update = [
|
||||
'NILAI_NERACA' => $nilai_neraca
|
||||
];
|
||||
$action = $this->Neraca->update('neraca', $update, 'ID_NERACA',$id_neraca);
|
||||
$hutang_pelanggan = $this->Pelanggan->getDataPelanggan($id_pelanggan);
|
||||
$hutang_pelanggan = $hutang_pelanggan[0]['HUTANG_PELANGGAN'];
|
||||
$hutang_pelanggan = $hutang_pelanggan-$nominal;
|
||||
$update = [
|
||||
'HUTANG_PELANGGAN' => $hutang_pelanggan
|
||||
];
|
||||
$action = $this->Pelanggan->update('pelanggan', $update, 'ID_PELANGGAN',$id_pelanggan);
|
||||
$piutang_corp = $this->Pelanggan->getDataCorp($id_corp);
|
||||
$piutang_corp = $piutang_corp[0]['PIUTANG_CORP'];
|
||||
$piutang_corp = $piutang_corp-$nominal;
|
||||
$update = [
|
||||
'PIUTANG_CORP' => $piutang_corp
|
||||
];
|
||||
$action = $this->Pelanggan->update('corp', $update, 'ID_CORP',$id_corp);
|
||||
$nilai = $this->Neraca->getDataNeraca(3);
|
||||
$nilai = $nilai[0]['NILAI_NERACA'];
|
||||
$nilai_neraca = $nilai+$nominal_pda;
|
||||
$id_neraca = 3;
|
||||
$update = [
|
||||
'NILAI_NERACA' => $nilai_neraca
|
||||
];
|
||||
$action = $this->Neraca->update('neraca', $update, 'ID_NERACA',$id_neraca);
|
||||
$id_penjualan = $this->Pelanggan->getDataPenjualan($id_pda);
|
||||
$id_penjualan = $id_penjualan[0]['PENJUALAN_ID'];
|
||||
$update = [
|
||||
'CORP_ID' => $id_corp,
|
||||
'PELANGGAN_ID' => $id_pelanggan,
|
||||
'PO_PENJUALAN' => $po_penjualan
|
||||
];
|
||||
$action = $this->Pelanggan->update('penjualan', $update,'ID_PENJUALAN',$id_penjualan);
|
||||
$update = [
|
||||
'NOMINAL_PDA' => $nominal_pda
|
||||
];
|
||||
$action = $this->Pelanggan->update('piutang_dagang', $update,'ID_PDA',$id_pda);
|
||||
$piutang_corp = $this->Pelanggan->getDataCorp($id_corp);
|
||||
$piutang_corp = $piutang_corp[0]['PIUTANG_CORP'];
|
||||
$piutang_corp = $piutang_corp+$nominal_pda;
|
||||
$update = [
|
||||
'PIUTANG_CORP' => $piutang_corp
|
||||
];
|
||||
$action = $this->Pelanggan->update('corp', $update,'ID_CORP',$id_corp);
|
||||
$hutang_pelanggan = $this->Pelanggan->getDataPelanggan($id_pelanggan);
|
||||
$hutang_pelanggan = $hutang_pelanggan[0]['HUTANG_PELANGGAN'];
|
||||
$hutang_pelanggan = $hutang_pelanggan+$nominal_pda;
|
||||
$update = [
|
||||
'HUTANG_PELANGGAN' => $hutang_pelanggan
|
||||
];
|
||||
$action = $this->Pelanggan->update('pelanggan', $update,'ID_PELANGGAN',$id_pelanggan);
|
||||
} else {
|
||||
$nominal = $pembanding[0]['NOMINAL_PDA'];
|
||||
$nilai = $this->Neraca->getDataNeraca(3);
|
||||
$nilai = $nilai[0]['NILAI_NERACA'];
|
||||
$nilai_neraca = $nilai-$nominal;
|
||||
$id_neraca = 3;
|
||||
$update = [
|
||||
'NILAI_NERACA' => $nilai_neraca
|
||||
];
|
||||
$action = $this->Neraca->update('neraca', $update, 'ID_NERACA',$id_neraca);
|
||||
$hutang_pelanggan = $this->Pelanggan->getDataPelanggan($pelanggan_id);
|
||||
$hutang_pelanggan = $hutang_pelanggan[0]['HUTANG_PELANGGAN'];
|
||||
$hutang_pelanggan = $hutang_pelanggan-$nominal;
|
||||
$update = [
|
||||
'HUTANG_PELANGGAN' => $hutang_pelanggan
|
||||
];
|
||||
$action = $this->Pelanggan->update('pelanggan', $update, 'ID_PELANGGAN',$pelanggan_id);
|
||||
$piutang_corp = $this->Pelanggan->getDataCorp($corp_id);
|
||||
$piutang_corp = $piutang_corp[0]['PIUTANG_CORP'];
|
||||
$piutang_corp = $piutang_corp-$nominal;
|
||||
$update = [
|
||||
'PIUTANG_CORP' => $piutang_corp
|
||||
];
|
||||
$action = $this->Pelanggan->update('corp', $update, 'ID_CORP',$corp_id);
|
||||
$nilai = $this->Neraca->getDataNeraca(3);
|
||||
$nilai = $nilai[0]['NILAI_NERACA'];
|
||||
$nilai_neraca = $nilai+$nominal_pda;
|
||||
$id_neraca = 3;
|
||||
$update = [
|
||||
'NILAI_NERACA' => $nilai_neraca
|
||||
];
|
||||
$action = $this->Neraca->update('neraca', $update, 'ID_NERACA',$id_neraca);
|
||||
$id_penjualan = $this->Pelanggan->getDataPenjualan($id_pda);
|
||||
$id_penjualan = $id_penjualan[0]['PENJUALAN_ID'];
|
||||
$update = [
|
||||
'CORP_ID' => $id_corp,
|
||||
'PELANGGAN_ID' => $id_pelanggan,
|
||||
'PO_PENJUALAN' => $po_penjualan
|
||||
];
|
||||
$action = $this->Pelanggan->update('penjualan', $update,'ID_PENJUALAN',$id_penjualan);
|
||||
$update = [
|
||||
'NOMINAL_PDA' => $nominal_pda
|
||||
];
|
||||
$action = $this->Pelanggan->update('piutang_dagang', $update,'ID_PDA',$id_pda);
|
||||
$piutang_corp = $this->Pelanggan->getDataCorp($id_corp);
|
||||
$piutang_corp = $piutang_corp[0]['PIUTANG_CORP'];
|
||||
$piutang_corp = $piutang_corp+$nominal_pda;
|
||||
$update = [
|
||||
'PIUTANG_CORP' => $piutang_corp
|
||||
];
|
||||
$action = $this->Pelanggan->update('corp', $update,'ID_CORP',$id_corp);
|
||||
$hutang_pelanggan = $this->Pelanggan->getDataPelanggan($id_pelanggan);
|
||||
$hutang_pelanggan = $hutang_pelanggan[0]['HUTANG_PELANGGAN'];
|
||||
$hutang_pelanggan = $hutang_pelanggan+$nominal_pda;
|
||||
$update = [
|
||||
'HUTANG_PELANGGAN' => $hutang_pelanggan
|
||||
];
|
||||
$action = $this->Pelanggan->update('pelanggan', $update,'ID_PELANGGAN',$id_pelanggan);
|
||||
}
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('flash', 'diubah');
|
||||
redirect($_SERVER['HTTP_REFERER']);
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'diubah');
|
||||
redirect($_SERVER['HTTP_REFERER']);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function hapus() {
|
||||
$id = $this->input->post('id');
|
||||
|
||||
//Step Ambil Data Lama
|
||||
$datapiutang = $this->Pelanggan->getDataPenjualan($id);
|
||||
$id_penjualan = $datapiutang[0]['PENJUALAN_ID'];
|
||||
$id_pelanggan = $datapiutang[0]['PELANGGAN_ID'];
|
||||
$id_corp = $datapiutang[0]['CORP_ID'];
|
||||
$nominal_pda = $datapiutang[0]['NOMINAL_PDA'];
|
||||
$piutang_corp = $this->Pelanggan->getDataCorp($id_corp);
|
||||
$piutang_corp = $piutang_corp[0]['PIUTANG_CORP'];
|
||||
$piutang_corp = $piutang_corp-$nominal_pda;
|
||||
$update = [
|
||||
'PIUTANG_CORP' => $piutang_corp
|
||||
];
|
||||
$action = $this->Pelanggan->update('corp', $update, 'ID_CORP', $id_corp);
|
||||
$hutang_pelanggan = $this->Pelanggan->getDataPelanggan($id_pelanggan);
|
||||
$hutang_pelanggan = $hutang_pelanggan[0]['HUTANG_PELANGGAN'];
|
||||
$hutang_pelanggan = $hutang_pelanggan-$nominal_pda;
|
||||
$update = [
|
||||
'HUTANG_PELANGGAN' => $hutang_pelanggan
|
||||
];
|
||||
$action = $this->Pelanggan->update('pelanggan', $update, 'ID_PELANGGAN', $id_pelanggan);
|
||||
$nilai = $this->Neraca->getDataNeraca(3);
|
||||
$nilai = $nilai[0]['NILAI_NERACA'];
|
||||
$nilai_neraca = $nilai-$nominal_pda;
|
||||
$id_neraca = 3;
|
||||
$update = [
|
||||
'NILAI_NERACA' => $nilai_neraca
|
||||
];
|
||||
$action = $this->Neraca->update('neraca', $update, 'ID_NERACA',$id_neraca);
|
||||
|
||||
//Step Hapus Data
|
||||
$action = $this->Pelanggan->delete('penjualan',$id_penjualan,'ID_PENJUALAN');
|
||||
$action = $this->Pelanggan->delete('piutang_dagang',$id,'ID_PDA');
|
||||
|
||||
$this->session->set_flashdata('flash', 'dihapus');
|
||||
redirect($_SERVER['HTTP_REFERER']);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,183 @@
|
||||
<?php
|
||||
|
||||
use Restserver\Libraries\REST_Controller;
|
||||
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
require APPPATH . 'libraries/REST_Controller.php';
|
||||
require APPPATH . 'libraries/Format.php';
|
||||
|
||||
class ManageKBPkar extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('ModelKaryawan', 'Karyawan');
|
||||
$this->load->model('ModelNeraca', 'Neraca');
|
||||
$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() {
|
||||
|
||||
$datPiutang = $this->Karyawan->getDataPiutangKaryawan();
|
||||
$datKaryawan = $this->Karyawan->getDataKaryawan();
|
||||
$data = [
|
||||
'sidebar' => "set data",
|
||||
'navChild' => "",
|
||||
'piutang' => $datPiutang,
|
||||
'karyawan' => $datKaryawan
|
||||
];
|
||||
|
||||
$this->load->view('proses/SetKBPkar', $data);
|
||||
}
|
||||
|
||||
public function kodePiutangKaryawan() {
|
||||
$kk = $this->Karyawan->getKodePKAR();
|
||||
if (is_array($kk) || is_object($kk)) {
|
||||
foreach ($kk as $row) {
|
||||
if ($row['KODE'] == NULL) {
|
||||
return "PKAR/000001";
|
||||
} else {
|
||||
$str = (string) $row['KODE'];
|
||||
$panjang = 6;
|
||||
$data = substr($str, 5, $panjang);
|
||||
|
||||
$ko = (int) $data + 1;
|
||||
$str = (string) $ko;
|
||||
|
||||
$panjang = 11 - strlen($str);
|
||||
$data = "PKAR/000000";
|
||||
$data = substr($data, 0, $panjang) . $str;
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function save() {
|
||||
$method = $this->input->post('method');
|
||||
$id = $this->input->post('id_pkar');
|
||||
$id_karyawan = $this->input->post('id_karyawan');
|
||||
$nominal_pkar = $this->input->post('nominal_pkar');
|
||||
$kode_pkar = $this->kodePiutangKaryawan();
|
||||
$input = [
|
||||
'KODE_PKAR' => $kode_pkar,
|
||||
'KODE_BUKTI' => "SETDATA",
|
||||
'KARYAWAN_ID' => $id_karyawan,
|
||||
'NOMINAL_PKAR' => $nominal_pkar,
|
||||
'BLOCKCON' => '0'
|
||||
];
|
||||
$action = $this->Karyawan->create('piutang_karyawan', $input);
|
||||
$piutang_karyawan = $this->Karyawan->getDataKaryawan($id_karyawan);
|
||||
$piutang_karyawan = $piutang_karyawan[0]['HUTANG_KARYAWAN'];
|
||||
$piutang_karyawan = $piutang_karyawan+$nominal_pkar;
|
||||
$update = [
|
||||
'HUTANG_KARYAWAN' => $piutang_karyawan
|
||||
];
|
||||
$action = $this->Karyawan->update('karyawan', $update, 'ID_KARYAWAN',$id_karyawan);
|
||||
$nilai = $this->Neraca->getDataNeraca(5);
|
||||
$nilai = $nilai[0]['NILAI_NERACA'];
|
||||
$nilai_neraca = $nilai+$nominal_pkar;
|
||||
$id_neraca = 5;
|
||||
$update = [
|
||||
'NILAI_NERACA' => $nilai_neraca
|
||||
];
|
||||
$action = $this->Neraca->update('neraca', $update, 'ID_NERACA',$id_neraca);
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('flash', 'dilakukan');
|
||||
redirect($_SERVER['HTTP_REFERER']);
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'dilakukan');
|
||||
redirect($_SERVER['HTTP_REFERER']);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function edit() {
|
||||
$method = $this->input->post('method');
|
||||
$id_pkar = $this->input->post('id_pkar');
|
||||
$id_karyawan = $this->input->post('id_karyawan');
|
||||
$nominal_pkar = $this->input->post('nominal_pkared');
|
||||
|
||||
$nominallama = $this->Karyawan->getDataPiutangKaryawan($id_pkar);
|
||||
$piutanglama = $nominallama[0]['HUTANG_KARYAWAN'];
|
||||
$nominallama = $nominallama[0]['NOMINAL_PKAR'];
|
||||
$nilai = $this->Neraca->getDataNeraca(5);
|
||||
$nilai = $nilai[0]['NILAI_NERACA'];
|
||||
$nilai_neraca = $nilai-$nominallama;
|
||||
$id_neraca = 5;
|
||||
$update = [
|
||||
'NILAI_NERACA' => $nilai_neraca
|
||||
];
|
||||
$action = $this->Neraca->update('neraca', $update, 'ID_NERACA',$id_neraca);
|
||||
$piutang_karyawan = $piutanglama-$nominallama;
|
||||
$update = [
|
||||
'HUTANG_KARYAWAN' => $piutang_karyawan
|
||||
];
|
||||
$action = $this->Karyawan->update('karyawan', $update, 'ID_KARYAWAN',$id_karyawan);
|
||||
$update = [
|
||||
'NOMINAL_PKAR' => $nominal_pkar
|
||||
];
|
||||
$action = $this->Karyawan->update('piutang_karyawan', $update,'ID_PKAR',$id_pkar);
|
||||
$nilai = $this->Neraca->getDataNeraca(5);
|
||||
$nilai = $nilai[0]['NILAI_NERACA'];
|
||||
$nilai_neraca = $nilai+$nominal_pkar;
|
||||
$id_neraca = 5;
|
||||
$update = [
|
||||
'NILAI_NERACA' => $nilai_neraca
|
||||
];
|
||||
$action = $this->Neraca->update('neraca', $update, 'ID_NERACA',$id_neraca);
|
||||
$piutang_karyawan = $this->Karyawan->getDataPiutangKaryawan($id_pkar);
|
||||
$piutang_karyawan = $piutang_karyawan[0]['HUTANG_KARYAWAN'];
|
||||
$piutang_karyawan = $piutang_karyawan+$nominal_pkar;
|
||||
$update = [
|
||||
'HUTANG_KARYAWAN' => $piutang_karyawan
|
||||
];
|
||||
$action = $this->Karyawan->update('karyawan', $update, 'ID_KARYAWAN',$id_karyawan);
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('flash', 'diubah');
|
||||
redirect($_SERVER['HTTP_REFERER']);
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'diubah');
|
||||
redirect($_SERVER['HTTP_REFERER']);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function hapus() {
|
||||
$id = $this->input->post('id');
|
||||
|
||||
//Step Ambil Data Lama
|
||||
$datapiutang = $this->Karyawan->getDataPiutangKaryawan($id);
|
||||
$id_karyawan = $datapiutang[0]['KARYAWAN_ID'];
|
||||
$nominal_pkar = $datapiutang[0]['NOMINAL_PKAR'];
|
||||
$piutang_karyawan = $datapiutang[0]['HUTANG_KARYAWAN'];
|
||||
$piutang_karyawan = $piutang_karyawan-$nominal_pkar;
|
||||
$update = [
|
||||
'HUTANG_KARYAWAN' => $piutang_karyawan
|
||||
];
|
||||
$action = $this->Karyawan->update('karyawan', $update, 'ID_KARYAWAN', $id_karyawan);
|
||||
$nilai = $this->Neraca->getDataNeraca(5);
|
||||
$nilai = $nilai[0]['NILAI_NERACA'];
|
||||
$nilai_neraca = $nilai-$nominal_pkar;
|
||||
$id_neraca = 5;
|
||||
$update = [
|
||||
'NILAI_NERACA' => $nilai_neraca
|
||||
];
|
||||
$action = $this->Neraca->update('neraca', $update, 'ID_NERACA',$id_neraca);
|
||||
|
||||
//Step Hapus Data
|
||||
$action = $this->Karyawan->delete('piutang_karyawan',$id,'ID_PKAR');
|
||||
|
||||
$this->session->set_flashdata('flash', 'dihapus');
|
||||
redirect($_SERVER['HTTP_REFERER']);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,183 @@
|
||||
<?php
|
||||
|
||||
use Restserver\Libraries\REST_Controller;
|
||||
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
require APPPATH . 'libraries/REST_Controller.php';
|
||||
require APPPATH . 'libraries/Format.php';
|
||||
|
||||
class ManageKBPpi extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('ModelPihakke3', 'Pihakke3');
|
||||
$this->load->model('ModelNeraca', 'Neraca');
|
||||
$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() {
|
||||
|
||||
$datPiutang = $this->Pihakke3->getDataPiutangPihakKe3();
|
||||
$datPihakke3 = $this->Pihakke3->getDataPihakKe3();
|
||||
$data = [
|
||||
'sidebar' => "set data",
|
||||
'navChild' => "",
|
||||
'piutang' => $datPiutang,
|
||||
'pihakke3' => $datPihakke3
|
||||
];
|
||||
|
||||
$this->load->view('proses/SetKBPpi', $data);
|
||||
}
|
||||
|
||||
public function kodePiutangPihakke3() {
|
||||
$kk = $this->Pihakke3->getKodePPI();
|
||||
if (is_array($kk) || is_object($kk)) {
|
||||
foreach ($kk as $row) {
|
||||
if ($row['KODE'] == NULL) {
|
||||
return "PPI/000001";
|
||||
} else {
|
||||
$str = (string) $row['KODE'];
|
||||
$panjang = 6;
|
||||
$data = substr($str, 4, $panjang);
|
||||
|
||||
$ko = (int) $data + 1;
|
||||
$str = (string) $ko;
|
||||
|
||||
$panjang = 10 - strlen($str);
|
||||
$data = "PPI/000000";
|
||||
$data = substr($data, 0, $panjang) . $str;
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function save() {
|
||||
$method = $this->input->post('method');
|
||||
$id = $this->input->post('id_ppi');
|
||||
$id_pihakke3 = $this->input->post('id_pihakke3');
|
||||
$nominal_ppi = $this->input->post('nominal_ppi');
|
||||
$kode_ppi = $this->kodePiutangPihakke3();
|
||||
$input = [
|
||||
'KODE_PPI' => $kode_ppi,
|
||||
'KODE_BUKTI' => "SETDATA",
|
||||
'PIHAKKE3_ID' => $id_pihakke3,
|
||||
'NOMINAL_PPI' => $nominal_ppi,
|
||||
'BLOCKCON' => '0'
|
||||
];
|
||||
$action = $this->Pihakke3->create('piutang_pihakke3', $input);
|
||||
$piutang_pihakke3 = $this->Pihakke3->getDataPihakKe3($id_pihakke3);
|
||||
$piutang_pihakke3 = $piutang_pihakke3[0]['HUTANG_PIHAKKE3'];
|
||||
$piutang_pihakke3 = $piutang_pihakke3+$nominal_ppi;
|
||||
$update = [
|
||||
'HUTANG_PIHAKKE3' => $piutang_pihakke3
|
||||
];
|
||||
$action = $this->Pihakke3->update('pihakke3', $update, 'ID_PIHAKKE3',$id_pihakke3);
|
||||
$nilai = $this->Neraca->getDataNeraca(6);
|
||||
$nilai = $nilai[0]['NILAI_NERACA'];
|
||||
$nilai_neraca = $nilai+$nominal_ppi;
|
||||
$id_neraca = 6;
|
||||
$update = [
|
||||
'NILAI_NERACA' => $nilai_neraca
|
||||
];
|
||||
$action = $this->Neraca->update('neraca', $update, 'ID_NERACA',$id_neraca);
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('flash', 'dilakukan');
|
||||
redirect($_SERVER['HTTP_REFERER']);
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'dilakukan');
|
||||
redirect($_SERVER['HTTP_REFERER']);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function edit() {
|
||||
$method = $this->input->post('method');
|
||||
$id_ppi = $this->input->post('id_ppi');
|
||||
$id_pihakke3 = $this->input->post('id_pihakke3');
|
||||
$nominal_ppi = $this->input->post('nominal_ppied');
|
||||
|
||||
$nominallama = $this->Pihakke3->getDataPiutangPihakKe3($id_ppi);
|
||||
$piutanglama = $nominallama[0]['HUTANG_PIHAKKE3'];
|
||||
$nominallama = $nominallama[0]['NOMINAL_PPI'];
|
||||
$nilai = $this->Neraca->getDataNeraca(6);
|
||||
$nilai = $nilai[0]['NILAI_NERACA'];
|
||||
$nilai_neraca = $nilai-$nominallama;
|
||||
$id_neraca = 6;
|
||||
$update = [
|
||||
'NILAI_NERACA' => $nilai_neraca
|
||||
];
|
||||
$action = $this->Neraca->update('neraca', $update, 'ID_NERACA',$id_neraca);
|
||||
$piutang_pihakke3 = $piutanglama-$nominallama;
|
||||
$update = [
|
||||
'HUTANG_PIHAKKE3' => $piutang_pihakke3
|
||||
];
|
||||
$action = $this->Pihakke3->update('pihakke3', $update, 'ID_PIHAKKE3',$id_pihakke3);
|
||||
$update = [
|
||||
'NOMINAL_PPI' => $nominal_ppi
|
||||
];
|
||||
$action = $this->Pihakke3->update('piutang_pihakke3', $update,'ID_PPI',$id_ppi);
|
||||
$nilai = $this->Neraca->getDataNeraca(6);
|
||||
$nilai = $nilai[0]['NILAI_NERACA'];
|
||||
$nilai_neraca = $nilai+$nominal_ppi;
|
||||
$id_neraca = 6;
|
||||
$update = [
|
||||
'NILAI_NERACA' => $nilai_neraca
|
||||
];
|
||||
$action = $this->Neraca->update('neraca', $update, 'ID_NERACA',$id_neraca);
|
||||
$piutang_pihakke3 = $this->Pihakke3->getDataPiutangPihakKe3($id_ppi);
|
||||
$piutang_pihakke3 = $piutang_pihakke3[0]['HUTANG_PIHAKKE3'];
|
||||
$piutang_pihakke3 = $piutang_pihakke3+$nominal_ppi;
|
||||
$update = [
|
||||
'HUTANG_PIHAKKE3' => $piutang_pihakke3
|
||||
];
|
||||
$action = $this->Pihakke3->update('pihakke3', $update, 'ID_PIHAKKE3',$id_pihakke3);
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('flash', 'diubah');
|
||||
redirect($_SERVER['HTTP_REFERER']);
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'diubah');
|
||||
redirect($_SERVER['HTTP_REFERER']);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function hapus() {
|
||||
$id = $this->input->post('id');
|
||||
|
||||
//Step Ambil Data Lama
|
||||
$datapiutang = $this->Pihakke3->getDataPiutangPihakKe3($id);
|
||||
$id_pihakke3 = $datapiutang[0]['PIHAKKE3_ID'];
|
||||
$nominal_ppi = $datapiutang[0]['NOMINAL_PPI'];
|
||||
$piutang_pihakke3 = $datapiutang[0]['HUTANG_PIHAKKE3'];
|
||||
$piutang_pihakke3 = $piutang_pihakke3-$nominal_ppi;
|
||||
$update = [
|
||||
'HUTANG_PIHAKKE3' => $piutang_pihakke3
|
||||
];
|
||||
$action = $this->Pihakke3->update('pihakke3', $update, 'ID_PIHAKKE3', $id_pihakke3);
|
||||
$nilai = $this->Neraca->getDataNeraca(6);
|
||||
$nilai = $nilai[0]['NILAI_NERACA'];
|
||||
$nilai_neraca = $nilai-$nominal_ppi;
|
||||
$id_neraca = 6;
|
||||
$update = [
|
||||
'NILAI_NERACA' => $nilai_neraca
|
||||
];
|
||||
$action = $this->Neraca->update('neraca', $update, 'ID_NERACA',$id_neraca);
|
||||
|
||||
//Step Hapus Data
|
||||
$action = $this->Pihakke3->delete('piutang_pihakke3',$id,'ID_PPI');
|
||||
|
||||
$this->session->set_flashdata('flash', 'dihapus');
|
||||
redirect($_SERVER['HTTP_REFERER']);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
<?php
|
||||
|
||||
use Restserver\Libraries\REST_Controller;
|
||||
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
require APPPATH . 'libraries/REST_Controller.php';
|
||||
require APPPATH . 'libraries/Format.php';
|
||||
|
||||
class ManageKK extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('ModelKasKeluar', 'KasKeluar');
|
||||
$this->load->model('ModelBank', 'Bank');
|
||||
$this->load->model('ModelDpPembelian', 'Dpb');
|
||||
$this->load->model('ModelDpPenjualan', 'Dpj');
|
||||
$this->load->model('ModelHutangDagang', 'Hda');
|
||||
$this->load->model('ModelKendaraan', 'Kendaraan');
|
||||
$this->load->model('ModelKas', 'Kas');
|
||||
$this->load->model('ModelKaryawan', 'Karyawan');
|
||||
$this->load->model('ModelPerkiraan', 'Perkiraan');
|
||||
$this->load->model('ModelPajak', 'Pajak');
|
||||
$this->load->model('ModelPiutangKaryawan', 'Pkar');
|
||||
$this->load->model('ModelPiutangPihakKe3', 'Ppi');
|
||||
$this->load->model('ModelPiutangDagang', 'Pda');
|
||||
$this->load->model('ModelBiayaPengiriman', 'Bp');
|
||||
$this->load->model('ModelPelanggan', 'Pelanggan');
|
||||
$this->load->model('ModelSupplier', 'Supplier');
|
||||
$this->load->model('ModelPihakKe3', 'PihakKe3');
|
||||
$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);
|
||||
}
|
||||
|
||||
//Step One, View Kas Keluar
|
||||
public function index() {
|
||||
|
||||
$datKasKeluar = $this->KasKeluar->getDataKasKeluarRev();
|
||||
|
||||
$data = [
|
||||
'sidebar' => "menu accounting",
|
||||
'navChild' => "",
|
||||
'kaskeluar' => $datKasKeluar
|
||||
];
|
||||
|
||||
$this->load->view('proses/KKView', $data);
|
||||
}
|
||||
|
||||
public function revisi() {
|
||||
$method = $this->input->post('method');
|
||||
$id_kaskeluar = $this->input->post('id_kaskeluar');
|
||||
|
||||
//Proses Konfirmasi + Update Saldo Kas
|
||||
$datakas = $this->KasKeluar->getDataKasKeluarRev($id_kaskeluar);
|
||||
$saldo = $datakas[0]['SALDO_KAS'];
|
||||
$nominal = $datakas[0]['KREDIT_KASKELUAR'];
|
||||
$id_kas = $datakas[0]['KAS_ID'];
|
||||
$saldo_kas = $saldo+$nominal;
|
||||
$update = [
|
||||
'SALDO_KAS' => $saldo_kas
|
||||
];
|
||||
$action = $this->KasKeluar->update('kas', $update, 'ID_KAS', $id_kas);
|
||||
$update = [
|
||||
'STATUS_KASKELUAR' => NULL
|
||||
];
|
||||
$action = $this->KasKeluar->update('kaskeluar', $update, 'ID_KASKELUAR', $id_kaskeluar);
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('flash', 'direvisi');
|
||||
redirect('ManageKK');
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'direvisi');
|
||||
redirect('ManageKK');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//Step Two, View Kas Keluar
|
||||
public function viewTransaksi($id) {
|
||||
$transaksi = $this->KasKeluar->getDataKasbankKK($id);
|
||||
$title = $this->KasKeluar->getTitleKK($id);
|
||||
$data = [
|
||||
'sidebar' => "menu accounting",
|
||||
'navChild' => "",
|
||||
'transaksi' => $transaksi,
|
||||
'id_kaskeluar' => $id,
|
||||
'title1' => $title[0]['KODE_KASKELUAR'],
|
||||
'title2' => $title[0]['DEBIT'],
|
||||
'title3' => $title[0]['KREDIT'],
|
||||
];
|
||||
|
||||
$this->load->view('proses/KBKKView', $data);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
<?php
|
||||
|
||||
use Restserver\Libraries\REST_Controller;
|
||||
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
require APPPATH . 'libraries/REST_Controller.php';
|
||||
require APPPATH . 'libraries/Format.php';
|
||||
|
||||
class ManageKM extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('ModelKasMasuk', 'KasMasuk');
|
||||
$this->load->model('ModelBank', 'Bank');
|
||||
$this->load->model('ModelDpPembelian', 'Dpb');
|
||||
$this->load->model('ModelDpPenjualan', 'Dpj');
|
||||
$this->load->model('ModelHutangDagang', 'Hda');
|
||||
$this->load->model('ModelKendaraan', 'Kendaraan');
|
||||
$this->load->model('ModelKas', 'Kas');
|
||||
$this->load->model('ModelKaryawan', 'Karyawan');
|
||||
$this->load->model('ModelPerkiraan', 'Perkiraan');
|
||||
$this->load->model('ModelPajak', 'Pajak');
|
||||
$this->load->model('ModelPiutangKaryawan', 'Pkar');
|
||||
$this->load->model('ModelPiutangPihakKe3', 'Ppi');
|
||||
$this->load->model('ModelPiutangDagang', 'Pda');
|
||||
$this->load->model('ModelBiayaPengiriman', 'Bp');
|
||||
$this->load->model('ModelPelanggan', 'Pelanggan');
|
||||
$this->load->model('ModelSupplier', 'Supplier');
|
||||
$this->load->model('ModelPihakKe3', 'PihakKe3');
|
||||
$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);
|
||||
}
|
||||
|
||||
//Step One, View Kas Masuk
|
||||
public function index() {
|
||||
|
||||
$datKasMasuk = $this->KasMasuk->getDataKasMasukRev();
|
||||
|
||||
$data = [
|
||||
'sidebar' => "menu accounting",
|
||||
'navChild' => "",
|
||||
'kasmasuk' => $datKasMasuk
|
||||
];
|
||||
|
||||
$this->load->view('proses/KMView', $data);
|
||||
}
|
||||
|
||||
public function revisi() {
|
||||
$method = $this->input->post('method');
|
||||
$id_kasmasuk = $this->input->post('id_kasmasuk');
|
||||
|
||||
//Proses Konfirmasi + Update Saldo Kas
|
||||
$datakas = $this->KasMasuk->getDataKasMasukRev($id_kasmasuk);
|
||||
$saldo = $datakas[0]['SALDO_KAS'];
|
||||
$nominal = $datakas[0]['DEBIT_KASMASUK'];
|
||||
$id_kas = $datakas[0]['KAS_ID'];
|
||||
$saldo_kas = $saldo-$nominal;
|
||||
$update = [
|
||||
'SALDO_KAS' => $saldo_kas
|
||||
];
|
||||
$action = $this->KasMasuk->update('kas', $update, 'ID_KAS', $id_kas);
|
||||
$update = [
|
||||
'STATUS_KASMASUK' => NULL
|
||||
];
|
||||
$action = $this->KasMasuk->update('kasmasuk', $update, 'ID_KASMASUK', $id_kasmasuk);
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('flash', 'direvisi');
|
||||
redirect('ManageKM');
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'direvisi');
|
||||
redirect('ManageKM');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//Step Two, View Kas Masuk
|
||||
public function viewTransaksi($id) {
|
||||
$transaksi = $this->KasMasuk->getDataKasbankKM($id);
|
||||
$title = $this->KasMasuk->getTitleKM($id);
|
||||
$data = [
|
||||
'sidebar' => "menu accounting",
|
||||
'navChild' => "",
|
||||
'transaksi' => $transaksi,
|
||||
'id_kasmasuk' => $id,
|
||||
'title1' => $title[0]['KODE_KASMASUK'],
|
||||
'title2' => $title[0]['DEBIT'],
|
||||
'title3' => $title[0]['KREDIT'],
|
||||
];
|
||||
|
||||
$this->load->view('proses/KBKMView', $data);
|
||||
}
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,87 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
class ManageKeyMou extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('ModelKeyMou', 'MKeyMou');
|
||||
$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");
|
||||
}
|
||||
|
||||
$datKeyMou = $this->MKeyMou->getDataKeyMou();
|
||||
|
||||
$data = [
|
||||
'sidebar' => "data master sku",
|
||||
'navChild' => "data master keymou",
|
||||
'keymou' => $datKeyMou
|
||||
];
|
||||
|
||||
$this->load->view('master/KeyboardMouse', $data);
|
||||
}
|
||||
|
||||
public function save()
|
||||
{
|
||||
$method = $this->input->post('method');
|
||||
$id_keymou = $this->input->post('id');
|
||||
$nama = $this->input->post('nama');
|
||||
|
||||
$this->form_validation->set_rules('nama', 'Nama', 'required');
|
||||
if ($this->form_validation->run() == FALSE) {
|
||||
$data = [
|
||||
'status' => false,
|
||||
'errors' => [
|
||||
'nama' => form_error('nama')
|
||||
|
||||
]
|
||||
];
|
||||
$this->output_json($data);
|
||||
} else {
|
||||
|
||||
$input = [
|
||||
'NAMA_KEYMOU' => $nama
|
||||
|
||||
];
|
||||
|
||||
if ($method === 'add') {
|
||||
$action = $this->MKeyMou->create('keymou', $input);
|
||||
} else if ($method === 'edit') {
|
||||
$action = $this->MKeyMou->update('keymou', $input, 'ID_KEYMOU', $id_keymou);
|
||||
}
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('flash', 'ditambah');
|
||||
redirect('ManageKeyMou');
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'ditambah');
|
||||
redirect('ManageKeyMou');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function hapus()
|
||||
{
|
||||
$id = $this->input->post('id');
|
||||
if ($this->MKeyMou->delete('keymou', $id, 'ID_KEYMOU')) {
|
||||
$this->session->set_flashdata('flash', 'dihapus');
|
||||
redirect('ManageKeyMou');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
class ManageKm extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('ModelKm', '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()
|
||||
{
|
||||
|
||||
$datKm = $this->MK->getDataKm();
|
||||
|
||||
$data = [
|
||||
'sidebar' => "master data",
|
||||
'navChild' => "",
|
||||
'km' => $datKm
|
||||
];
|
||||
|
||||
$this->load->view('master/Km', $data);
|
||||
}
|
||||
|
||||
public function save()
|
||||
{
|
||||
$method = $this->input->post('method');
|
||||
$id_km = $this->input->post('id');
|
||||
$nama_km = $this->input->post('nama_km');
|
||||
$type_km = $this->input->post('type_km');
|
||||
|
||||
$input = [
|
||||
'NAMA_KM' => $nama_km,
|
||||
'TYPE_KM' => $type_km
|
||||
];
|
||||
|
||||
$action = $this->MK->create('km', $input);
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('flash', 'ditambah');
|
||||
redirect('ManageKm');
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'ditambah');
|
||||
redirect('ManageKm');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function edit()
|
||||
{
|
||||
$method = $this->input->post('method');
|
||||
$id_km = $this->input->post('id_km');
|
||||
$nama_km = $this->input->post('nama_kmed');
|
||||
$type_km = $this->input->post('type_kmed');
|
||||
|
||||
$update = [
|
||||
'NAMA_KM' => $nama_km,
|
||||
'TYPE_KM' => $type_km
|
||||
];
|
||||
|
||||
$action = $this->MK->update('km', $update,'ID_KM',$id_km);
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('flash', 'diedit');
|
||||
redirect('ManageKm');
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'diedit');
|
||||
redirect('ManageKm');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function hapus()
|
||||
{
|
||||
$id = $this->input->post('id');
|
||||
if ($this->MK->delete('km', $id, 'ID_KM')) {
|
||||
$action = $this ->MK->delete('km',$id,'ID_KM');
|
||||
$this->session->set_flashdata('flash', 'dihapus');
|
||||
redirect('ManageKm');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
class ManageKomisi extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('ModelDashboard', 'Dashboard');
|
||||
$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 index() {
|
||||
$id_karyawan = $this->session->userdata('id_karyawan');
|
||||
$datShm = $this->Dashboard->getData_SetHakMaster_byKARYAWAN($id_karyawan);
|
||||
$datKomisi = $this->Dashboard->getData_Komisi();
|
||||
|
||||
if ($datShm[0]['KOMISI_SHM']==0) {
|
||||
$akses = "Tidak Berhak";
|
||||
$datKomisi = NULL;
|
||||
} else if ($datShm[0]['KOMISI_SHM']==1) {
|
||||
$akses = "Hanya Baca";
|
||||
} else if ($datShm[0]['KOMISI_SHM']==2) {
|
||||
$akses = "Akses Penuh";
|
||||
}
|
||||
|
||||
$data = [
|
||||
'sidebar' => "dashboard",
|
||||
'navChild' => "",
|
||||
'komisi' => $datKomisi,
|
||||
'hak' => $datShm[0]['KOMISI_SHM'],
|
||||
'akses' => $akses,
|
||||
];
|
||||
$this->load->view('master/Komisi', $data);
|
||||
}
|
||||
|
||||
public function ubah() {
|
||||
$method = $this->input->post('method');
|
||||
$id_jenis = $this->input->post('id_jenised');
|
||||
$komisi_dealer = $this->input->post('komisi_dealered');
|
||||
$komisi_user = $this->input->post('komisi_usered');
|
||||
|
||||
$update = [
|
||||
'KOMISI_DEALER' => $komisi_dealer,
|
||||
'KOMISI_USER' => $komisi_user
|
||||
];
|
||||
$action = $this->Dashboard->update('jenis', $update, 'ID_JENIS', $id_jenis);
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('success', 'diubah');
|
||||
redirect('ManageKomisi');
|
||||
} else {
|
||||
$this->session->set_flashdata('failed', 'diubah');
|
||||
redirect('ManageKomisi');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
class ManageKonfirmasi 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()
|
||||
{
|
||||
$username = $this->session->userdata('username');
|
||||
$jabatan = $this->session->userdata('jabatan');
|
||||
if ($username == null) {
|
||||
redirect("Action");
|
||||
} elseif ($jabatan != "ADMIN") {
|
||||
redirect("Action");
|
||||
}
|
||||
|
||||
$datKonfirmasi = $this->MP->getViewKonfirmasi();
|
||||
$datService = $this->MS->getDataService();
|
||||
$datTeknisi = $this->MT->getDataTeknisi();
|
||||
|
||||
$data = [
|
||||
'sidebar' => "data pengerjaan service",
|
||||
'navChild' => "data pengerjaan konfirmasi",
|
||||
'konfirmasi'=> $datKonfirmasi,
|
||||
'service' => $datService,
|
||||
'teknisi' => $datTeknisi
|
||||
];
|
||||
|
||||
$this->load->view('master/Konfirmasi', $data);
|
||||
}
|
||||
|
||||
public function edit()
|
||||
{
|
||||
$method = $this->input->post('method');
|
||||
$id_progress = $this->input->post('id_progress');
|
||||
$status_progress = $this->input->post('status_progressed');
|
||||
|
||||
|
||||
$input = [
|
||||
'STATUS_PROGRESS' => $status_progress,
|
||||
'KONFIRM_PROGRESS' => date('Y-m-d H:i:s')
|
||||
];
|
||||
|
||||
$action = $this->MP->update('progress', $input, 'ID_PROGRESS',$id_progress);
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('flash', 'ditambah');
|
||||
redirect('ManageKonfirmasi');
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'ditambah');
|
||||
redirect('ManageKonfirmasi');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
class ManageKonfirmasiGudang 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->model('ModelAdminGudang', 'MAG');
|
||||
$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()
|
||||
{
|
||||
|
||||
$datKonfirmasi = $this->MP->getViewKonfirmasiGudang();
|
||||
$datService = $this->MS->getDataService();
|
||||
$datTeknisi = $this->MT->getDataAdmin();
|
||||
$datAGudang = $this->MAG->getDataAdminGudang();
|
||||
|
||||
$data = [
|
||||
'sidebar' => "data konfirmasi service",
|
||||
'navChild' => "data konfirmasi gudang",
|
||||
'konfirmasi'=> $datKonfirmasi,
|
||||
'service' => $datService,
|
||||
'admin' => $datTeknisi,
|
||||
'agudang' => $datAGudang
|
||||
];
|
||||
|
||||
$this->load->view('master/KonfirmasiGudang', $data);
|
||||
}
|
||||
|
||||
public function edit()
|
||||
{
|
||||
$method = $this->input->post('method');
|
||||
$id_progress = $this->input->post('id_progress');
|
||||
$id_admingudang = $this->input->post('id_admingudanged');
|
||||
|
||||
$updateprogress = [
|
||||
'STATUS_PROGRESS' => "DITERIMA GUDANG",
|
||||
'ADMINGUDANG_ID' => $id_admingudang,
|
||||
'INTERNAL_PROGRESS' => date('Y-m-d H:i:s')
|
||||
];
|
||||
|
||||
$actionprogress = $this->MP->update('progress', $updateprogress, 'ID_PROGRESS',$id_progress);
|
||||
|
||||
if ($actionprogress) {
|
||||
$this->session->set_flashdata('flash', 'diproses');
|
||||
redirect('ManageKonfirmasiGudang');
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'diproses');
|
||||
redirect('ManageKonfirmasiGudang');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
class ManageKonfirmasiPengerjaan 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()
|
||||
{
|
||||
|
||||
$datKonfirmasi = $this->MP->getViewKonfirmasi();
|
||||
$datService = $this->MS->getDataService();
|
||||
$datTeknisi = $this->MT->getDataTeknisi();
|
||||
$datAdmin = $this->MO->getDataAdminService();
|
||||
|
||||
$data = [
|
||||
'sidebar' => "data konfirmasi service",
|
||||
'navChild' => "data konfirmasi pengerjaan",
|
||||
'konfirmasi'=> $datKonfirmasi,
|
||||
'service' => $datService,
|
||||
'teknisi' => $datTeknisi,
|
||||
'admin' => $datAdmin
|
||||
];
|
||||
|
||||
$this->load->view('master/KonfirmasiPengerjaan', $data);
|
||||
}
|
||||
|
||||
public function edit()
|
||||
{
|
||||
$method = $this->input->post('method');
|
||||
$id_progress = $this->input->post('id_progress');
|
||||
$id_adminservice = $this->input->post('id_adminserviceed');
|
||||
$status_progress = $this->input->post('status_progressed');
|
||||
|
||||
if ($status_progress=="Selesai Check" || $status_progress=="Check Ulang") {
|
||||
$input = [
|
||||
'STATUS_PROGRESS' => $status_progress,
|
||||
'ADMINSERVICE_ID' => $id_adminservice
|
||||
];
|
||||
$action = $this->MP->update('progress', $input, 'ID_PROGRESS',$id_progress);
|
||||
|
||||
} else {
|
||||
$input = [
|
||||
'STATUS_PROGRESS' => $status_progress,
|
||||
'ADMINSERVICE_ID' => $id_adminservice,
|
||||
'KONFIRM_PROGRESS' => date('Y-m-d H:i:s')
|
||||
];
|
||||
$action = $this->MP->update('progress', $input, 'ID_PROGRESS',$id_progress);
|
||||
}
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('flash', 'ditambah');
|
||||
redirect('ManageKonfirmasiPengerjaan');
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'ditambah');
|
||||
redirect('ManageKonfirmasiPengerjaan');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,134 @@
|
||||
<?php
|
||||
|
||||
use Restserver\Libraries\REST_Controller;
|
||||
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
require APPPATH . 'libraries/REST_Controller.php';
|
||||
require APPPATH . 'libraries/Format.php';
|
||||
|
||||
class ManageKuartal extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('ModelDashboard', 'Dashboard');
|
||||
$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 index() {
|
||||
$id_karyawan = $this->session->userdata('id_karyawan');
|
||||
$datShm = $this->Dashboard->getData_SetHakMaster_byKARYAWAN($id_karyawan);
|
||||
$datKuartal = $this->Dashboard->getData_Kuartal();
|
||||
$tgl = date('Y-m-d');
|
||||
|
||||
$no = 0;
|
||||
foreach ($datKuartal as $key) {
|
||||
$datMk = $this->Dashboard->getData_ManajemenKuartal_byKUARTAL($key['ID_KUARTAL']);
|
||||
if ($datMk==TRUE) {
|
||||
$lock = 1;
|
||||
} else {
|
||||
$lock = 0;
|
||||
}
|
||||
$datKuartal[$no++] += ['LOCK' => $lock];
|
||||
}
|
||||
|
||||
if ($datShm[0]['KUARTAL_SHM']==0) {
|
||||
$akses = "Tidak Berhak";
|
||||
$datKuartal = NULL;
|
||||
} else if ($datShm[0]['KUARTAL_SHM']==1) {
|
||||
$akses = "Hanya Baca";
|
||||
} else if ($datShm[0]['KUARTAL_SHM']==2) {
|
||||
$akses = "Akses Penuh";
|
||||
}
|
||||
|
||||
$data = [
|
||||
'sidebar' => "dashboard",
|
||||
'navChild' => "",
|
||||
'kuartal' => $datKuartal,
|
||||
'hak' => $datShm[0]['KUARTAL_SHM'],
|
||||
'akses' => $akses,
|
||||
'tgl' => $tgl,
|
||||
];
|
||||
|
||||
$this->load->view('master/Kuartal', $data);
|
||||
}
|
||||
|
||||
public function simpan() {
|
||||
$method = $this->input->post('method');
|
||||
$id = $this->input->post('id_kuartal');
|
||||
$nama_kuartal = $this->input->post('nama_kuartal');
|
||||
$awal_kuartal = $this->input->post('awal_kuartal');
|
||||
$akhir_kuartal = $this->input->post('akhir_kuartal');
|
||||
|
||||
$input = [
|
||||
'NAMA_KUARTAL' => $nama_kuartal,
|
||||
'AWAL_KUARTAL' => $awal_kuartal,
|
||||
'AKHIR_KUARTAL' => $akhir_kuartal
|
||||
];
|
||||
$action = $this->Dashboard->create('kuartal', $input);
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('success', 'ditambah');
|
||||
redirect('ManageKuartal');
|
||||
} else {
|
||||
$this->session->set_flashdata('failed', 'ditambah');
|
||||
redirect('ManageKuartal');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function ubah() {
|
||||
$method = $this->input->post('method');
|
||||
$id_kuartal = $this->input->post('id_kuartaled');
|
||||
$nama_kuartal = $this->input->post('nama_kuartaled');
|
||||
$awal_kuartal = $this->input->post('awal_kuartaled');
|
||||
$akhir_kuartal = $this->input->post('akhir_kuartaled');
|
||||
|
||||
$update = [
|
||||
'NAMA_KUARTAL' => $nama_kuartal,
|
||||
'AWAL_KUARTAL' => $awal_kuartal,
|
||||
'AKHIR_KUARTAL' => $akhir_kuartal
|
||||
];
|
||||
$action = $this->Dashboard->update('kuartal', $update, 'ID_KUARTAL', $id_kuartal);
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('success', 'diubah');
|
||||
redirect('ManageKuartal');
|
||||
} else {
|
||||
$this->session->set_flashdata('failed', 'diubah');
|
||||
redirect('ManageKuartal');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function hapus() {
|
||||
$method = $this->input->post('method');
|
||||
$id = $this->input->post('id_kuartaldel');
|
||||
|
||||
$datMk = $this->Dashboard->getData_ManajemenKuartal_byKUARTAL($id);
|
||||
if ($datMk==TRUE) {
|
||||
$this->session->set_flashdata('data_used', 'error');
|
||||
redirect('ManageKuartal');
|
||||
}
|
||||
|
||||
$action = $this->Dashboard->delete('kuartal', $id, 'ID_KUARTAL');
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('success', 'dihapus');
|
||||
redirect('ManageKuartal');
|
||||
} else {
|
||||
$this->session->set_flashdata('failed', 'dihapus');
|
||||
redirect('ManageKuartal');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
class ManageKurir extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$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()
|
||||
{
|
||||
|
||||
$datKurir = $this->MK->getDataKurir();
|
||||
|
||||
$data = [
|
||||
'sidebar' => "data master license",
|
||||
'navChild' => "data master kurir",
|
||||
'kurir' => $datKurir
|
||||
];
|
||||
|
||||
$this->load->view('master/Kurir', $data);
|
||||
}
|
||||
|
||||
public function save()
|
||||
{
|
||||
$method = $this->input->post('method');
|
||||
$id_kurir = $this->input->post('id');
|
||||
$nama = $this->input->post('nama');
|
||||
|
||||
$this->form_validation->set_rules('nama', 'Nama', 'required');
|
||||
if ($this->form_validation->run() == FALSE) {
|
||||
$data = [
|
||||
'status' => false,
|
||||
'errors' => [
|
||||
'nama' => form_error('nama')
|
||||
|
||||
]
|
||||
];
|
||||
$this->output_json($data);
|
||||
} else {
|
||||
|
||||
$input = [
|
||||
'NAMA_KURIR' => $nama
|
||||
|
||||
];
|
||||
|
||||
if ($method === 'add') {
|
||||
$action = $this->MK->create('kurir', $input);
|
||||
} else if ($method === 'edit') {
|
||||
$action = $this->MK->update('kurir', $input, 'ID_KURIR', $id_kurir);
|
||||
}
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('flash', 'ditambah');
|
||||
redirect('ManageKurir');
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'ditambah');
|
||||
redirect('ManageKurir');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function hapus()
|
||||
{
|
||||
$id = $this->input->post('id');
|
||||
if ($this->MK->delete('kurir', $id, 'ID_KURIR')) {
|
||||
$this->session->set_flashdata('flash', 'dihapus');
|
||||
redirect('ManageKurir');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
class ManageLain extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('ModelLain', 'Lain');
|
||||
$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()
|
||||
{
|
||||
|
||||
$datLain = $this->Lain->getDataLain();
|
||||
|
||||
$data = [
|
||||
'sidebar' => "master data",
|
||||
'navChild' => "",
|
||||
'lain' => $datLain
|
||||
];
|
||||
|
||||
$this->load->view('master/Lain', $data);
|
||||
}
|
||||
|
||||
public function save()
|
||||
{
|
||||
$method = $this->input->post('method');
|
||||
$id_lain = $this->input->post('id');
|
||||
$nama_lain = $this->input->post('nama_lain');
|
||||
|
||||
$input = [
|
||||
'NAMA_LAIN' => $nama_lain
|
||||
];
|
||||
|
||||
$action = $this->Lain->create('lain', $input);
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('flash', 'ditambah');
|
||||
redirect('ManageLain');
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'ditambah');
|
||||
redirect('ManageLain');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function edit()
|
||||
{
|
||||
$method = $this->input->post('method');
|
||||
$id_lain = $this->input->post('id_lain');
|
||||
$nama_lain = $this->input->post('nama_lained');
|
||||
|
||||
$update = [
|
||||
'NAMA_LAIN' => $nama_lain
|
||||
];
|
||||
|
||||
$action = $this->Lain->update('lain', $update,'ID_LAIN',$id_lain);
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('flash', 'diedit');
|
||||
redirect('ManageLain');
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'diedit');
|
||||
redirect('ManageLain');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function hapus()
|
||||
{
|
||||
$id = $this->input->post('id');
|
||||
if ($this->Lain->delete('lain', $id, 'ID_LAIN')) {
|
||||
$action = $this ->Lain->delete('lain',$id,'ID_LAIN');
|
||||
$this->session->set_flashdata('flash', 'dihapus');
|
||||
redirect('ManageLain');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,110 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
class ManageLaporan1 extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('ModelLaporan1', 'MLaporan1');
|
||||
$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("Login");
|
||||
} elseif ($jabatan != "ADMIN") {
|
||||
redirect("Login");
|
||||
}
|
||||
|
||||
$datLaporan1 = $this->MLaporan1->getDataLaporan1();
|
||||
|
||||
$data = [
|
||||
'sidebar' => "data master 2",
|
||||
'navChild' => "data laporan 1",
|
||||
'laporan1' => $datLaporan1
|
||||
];
|
||||
|
||||
$this->load->view('laporan/table-laporan1', $data);
|
||||
}
|
||||
|
||||
public function add()
|
||||
{
|
||||
$username = $this->session->userdata('username');
|
||||
if ($username == null) {
|
||||
redirect("Login");
|
||||
}
|
||||
$datPromo = $this->MPromo->getDataPromo();
|
||||
$datInvoice = $this->MInvoice->getDataInvoice();
|
||||
$data = [
|
||||
'sidebar' => "data master",
|
||||
'navChild' => "data invoice",
|
||||
'invoice' => $datInvoice,
|
||||
'promo' => $datPromo
|
||||
|
||||
];
|
||||
$this->load->view('promo/promo-tambah', $data);
|
||||
}
|
||||
|
||||
public function save()
|
||||
{
|
||||
$method = $this->input->post('method');
|
||||
$nama_promo = $this->input->post('nama_promo');
|
||||
$tgl_promo = $this->input->post('tgl_promo');
|
||||
$potongan = $this->input->post('potongan');
|
||||
$no_invoice = $this->input->post('no_invoice');
|
||||
|
||||
$this->form_validation->set_rules('nama_promo', 'Nama Promo', 'required');
|
||||
$this->form_validation->set_rules('tgl_promo', 'Tanggal Promo', 'required');
|
||||
$this->form_validation->set_rules('potongan', 'Potongan', 'required');
|
||||
$this->form_validation->set_rules('no_invoice', 'Nomor Invoice', 'required');
|
||||
|
||||
if ($this->form_validation->run() == FALSE) {
|
||||
$data = [
|
||||
'status' => false,
|
||||
'errors' => [
|
||||
'nama_promo' => form_error('nama_promo'),
|
||||
'tgl_promo' => form_error('tgl_promo'),
|
||||
'potongan' => form_error('potongan'),
|
||||
'no_invoice' => form_error('no_invoice')
|
||||
]
|
||||
];
|
||||
$this->output_json($data);
|
||||
} else {
|
||||
$input = [
|
||||
'NAMA_PROMO' => $nama_promo,
|
||||
'TGL_PROMO' => $tgl_promo,
|
||||
'POTONGAN' => $potongan,
|
||||
'ID_INVOICE' => $no_invoice
|
||||
];
|
||||
|
||||
$action = $this->MPromo->create('promo', $input);
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('flash', 'ditambah');
|
||||
redirect('ManagePromo');
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'ditambah');
|
||||
redirect('ManagePromo');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function hapus()
|
||||
{
|
||||
$id = $this->input->post('id');
|
||||
if ($this->MPromo->delete('promo', $id, 'ID_PROMO')) {
|
||||
$this->session->set_flashdata('flash', 'dihapus');
|
||||
redirect('ManagePromo');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
class ManageLayar extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('ModelLayar', 'ML');
|
||||
$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()
|
||||
{
|
||||
|
||||
$datLayar = $this->ML->getDataLayar();
|
||||
|
||||
$data = [
|
||||
'sidebar' => "master data",
|
||||
'navChild' => "",
|
||||
'layar' => $datLayar
|
||||
];
|
||||
|
||||
$this->load->view('master/Layar', $data);
|
||||
}
|
||||
|
||||
public function save()
|
||||
{
|
||||
$method = $this->input->post('method');
|
||||
$id_layar = $this->input->post('id');
|
||||
$nama_layar = $this->input->post('nama_layar');
|
||||
$type_layar = $this->input->post('type_layar');
|
||||
$touch_ready = $this->input->post('touch_ready');
|
||||
|
||||
$input = [
|
||||
'NAMA_LAYAR' => $nama_layar,
|
||||
'TYPE_LAYAR' => $type_layar,
|
||||
'TOUCH_READY' => $touch_ready
|
||||
];
|
||||
|
||||
$action = $this->ML->create('layar', $input);
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('flash', 'ditambah');
|
||||
redirect('ManageLayar');
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'ditambah');
|
||||
redirect('ManageLayar');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function edit()
|
||||
{
|
||||
$method = $this->input->post('method');
|
||||
$id_layar = $this->input->post('id_layar');
|
||||
$nama_layar = $this->input->post('nama_layared');
|
||||
$type_layar = $this->input->post('type_layared');
|
||||
$touch_ready = $this->input->post('touch_ready');
|
||||
|
||||
$update = [
|
||||
'NAMA_LAYAR' => $nama_layar,
|
||||
'TYPE_LAYAR' => $type_layar,
|
||||
'TOUCH_READY' => $touch_ready
|
||||
];
|
||||
|
||||
$action = $this->ML->update('layar', $update,'ID_LAYAR',$id_layar);
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('flash', 'diedit');
|
||||
redirect('ManageLayar');
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'diedit');
|
||||
redirect('ManageLayar');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function hapus()
|
||||
{
|
||||
$id = $this->input->post('id');
|
||||
if ($this->ML->delete('layar', $id, 'ID_LAYAR')) {
|
||||
$action = $this ->ML->delete('layar',$id,'ID_LAYAR');
|
||||
$this->session->set_flashdata('flash', 'dihapus');
|
||||
redirect('ManageLayar');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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');
|
||||
// }
|
||||
//}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
class ManageMonitor extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('ModelMonitor', 'MMonitor');
|
||||
$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");
|
||||
}
|
||||
|
||||
$datMonitor = $this->MMonitor->getDataMonitor();
|
||||
|
||||
$data = [
|
||||
'sidebar' => "data list",
|
||||
'navChild' => "data list monitor",
|
||||
'monitor' => $datMonitor
|
||||
];
|
||||
|
||||
$this->load->view('list/table-listmonitor', $data);
|
||||
}
|
||||
|
||||
public function save()
|
||||
{
|
||||
$method = $this->input->post('method');
|
||||
$id_processor = $this->input->post('id');
|
||||
$nama = $this->input->post('nama');
|
||||
|
||||
$this->form_validation->set_rules('nama', 'Nama', 'required');
|
||||
if ($this->form_validation->run() == FALSE) {
|
||||
$data = [
|
||||
'status' => false,
|
||||
'errors' => [
|
||||
'nama' => form_error('nama')
|
||||
|
||||
]
|
||||
];
|
||||
$this->output_json($data);
|
||||
} else {
|
||||
|
||||
$input = [
|
||||
'NAMA_MONITOR' => $nama
|
||||
|
||||
];
|
||||
|
||||
if ($method === 'add') {
|
||||
$action = $this->MMonitor->create('monitor', $input);
|
||||
} else if ($method === 'edit') {
|
||||
$action = $this->MMonitor->update('monitor', $input, 'ID_MONITOR', $id_monitor);
|
||||
}
|
||||
|
||||
if ($action) {
|
||||
if ($method === 'add') {
|
||||
$this->output_json(['status' => true]);
|
||||
} else if ($method === 'edit') {
|
||||
redirect('ManageMonitor');
|
||||
}
|
||||
} else {
|
||||
$this->output_json(['status' => false]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function hapus()
|
||||
{
|
||||
$id = $this->input->post('id');
|
||||
if ($this->MMonitor->delete('monitor', $id, 'ID_MONITOR')) {
|
||||
redirect('ManageMonitor');
|
||||
}
|
||||
}
|
||||
|
||||
// public function add(){
|
||||
// $username = $this->session->userdata('username');
|
||||
// if ($username == null){
|
||||
// redirect("Action");
|
||||
// }
|
||||
|
||||
// $this->load->view('tambah-user');
|
||||
// }
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
class ManageNeraca extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('ModelNeraca', 'MN');
|
||||
$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()
|
||||
{
|
||||
|
||||
$datNeraca = $this->MN->getDataNeraca();
|
||||
|
||||
$data = [
|
||||
'sidebar' => "master data",
|
||||
'navChild' => "",
|
||||
'neraca' => $datNeraca
|
||||
];
|
||||
|
||||
$this->load->view('master/Neraca', $data);
|
||||
}
|
||||
|
||||
public function save()
|
||||
{
|
||||
$method = $this->input->post('method');
|
||||
$id_neraca = $this->input->post('id');
|
||||
$nama_neraca = $this->input->post('nama_neraca');
|
||||
$kode_neraca = $this->input->post('kode_neraca');
|
||||
$type_neraca = $this->input->post('type_neraca');
|
||||
|
||||
$input = [
|
||||
'NAMA_NERACA' => $nama_neraca,
|
||||
'KODE_NERACA' => $kode_neraca,
|
||||
'TYPE_NERACA' => $type_neraca
|
||||
];
|
||||
|
||||
$action = $this->MN->create('neraca', $input);
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('flash', 'ditambah');
|
||||
redirect('ManageNeraca');
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'ditambah');
|
||||
redirect('ManageNeraca');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function edit()
|
||||
{
|
||||
$method = $this->input->post('method');
|
||||
$id_neraca = $this->input->post('id_neraca');
|
||||
$nama_neraca = $this->input->post('nama_neracaed');
|
||||
$kode_neraca = $this->input->post('kode_neracaed');
|
||||
$type_neraca = $this->input->post('type_neracaed');
|
||||
|
||||
$update = [
|
||||
'NAMA_NERACA' => $nama_neraca,
|
||||
'KODE_NERACA' => $kode_neraca,
|
||||
'TYPE_NERACA' => $type_neraca
|
||||
];
|
||||
|
||||
$action = $this->MN->update('neraca', $update,'ID_NERACA',$id_neraca);
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('flash', 'diedit');
|
||||
redirect('ManageNeraca');
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'diedit');
|
||||
redirect('ManageNeraca');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function hapus()
|
||||
{
|
||||
$id = $this->input->post('id');
|
||||
if ($this->MN->delete('neraca', $id, 'ID_NERACA')) {
|
||||
$action = $this ->MN->delete('neraca',$id,'ID_NERACA');
|
||||
$this->session->set_flashdata('flash', 'dihapus');
|
||||
redirect('ManageNeraca');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
class ManageOperator extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('ModelOperator', 'MO');
|
||||
$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()
|
||||
{
|
||||
|
||||
$datOperator = $this->MO->getDataOperator();
|
||||
|
||||
$data = [
|
||||
'sidebar' => "data master service",
|
||||
'navChild' => "data master operator",
|
||||
'operator' => $datOperator
|
||||
];
|
||||
|
||||
$this->load->view('master/Operator', $data);
|
||||
}
|
||||
|
||||
public function save()
|
||||
{
|
||||
$method = $this->input->post('method');
|
||||
$id_operator = $this->input->post('id');
|
||||
$id_teknisi = $this->input->post('id');
|
||||
$nama = $this->input->post('nama');
|
||||
|
||||
$this->form_validation->set_rules('nama', 'Nama', 'required');
|
||||
if ($this->form_validation->run() == FALSE) {
|
||||
$data = [
|
||||
'status' => false,
|
||||
'errors' => [
|
||||
'nama' => form_error('nama')
|
||||
|
||||
]
|
||||
];
|
||||
$this->output_json($data);
|
||||
} else {
|
||||
|
||||
$input = [
|
||||
'NAMA_OPERATOR' => $nama
|
||||
|
||||
];
|
||||
|
||||
$inputteknisi = [
|
||||
'NAMA_TEKNISI' => $nama
|
||||
|
||||
];
|
||||
|
||||
if ($method === 'add') {
|
||||
$action = $this->MO->create('operator', $input);
|
||||
$actionteknisi = $this->MO->create('teknisi', $inputteknisi);
|
||||
} else if ($method === 'edit') {
|
||||
$action = $this->MO->update('operator', $input, 'ID_OPERATOR', $id_operator);
|
||||
$actionteknisi = $this->MO->update('teknisi', $inputteknisi, 'ID_TEKNISI', $id_teknisi);
|
||||
}
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('flash', 'ditambah');
|
||||
redirect('ManageOperator');
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'ditambah');
|
||||
redirect('ManageOperator');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function hapus()
|
||||
{
|
||||
$id = $this->input->post('id');
|
||||
if ($this->MO->delete('operator', $id, 'ID_OPERATOR')) {
|
||||
$action = $this ->MO->delete('teknisi',$id,'ID_TEKNISI');
|
||||
$this->session->set_flashdata('flash', 'dihapus');
|
||||
redirect('ManageOperator');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
class ManageOs extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('ModelOs', 'MO');
|
||||
$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()
|
||||
{
|
||||
|
||||
$datOs = $this->MO->getDataOs();
|
||||
|
||||
$data = [
|
||||
'sidebar' => "master data",
|
||||
'navChild' => "",
|
||||
'os' => $datOs
|
||||
];
|
||||
|
||||
$this->load->view('master/Os', $data);
|
||||
}
|
||||
|
||||
public function save()
|
||||
{
|
||||
$method = $this->input->post('method');
|
||||
$id_os = $this->input->post('id');
|
||||
$nama_os = $this->input->post('nama_os');
|
||||
$type_os = $this->input->post('type_os');
|
||||
|
||||
$input = [
|
||||
'NAMA_OS' => $nama_os,
|
||||
'TYPE_OS' => $type_os
|
||||
];
|
||||
|
||||
$action = $this->MO->create('os', $input);
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('flash', 'ditambah');
|
||||
redirect('ManageOs');
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'ditambah');
|
||||
redirect('ManageOs');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function edit()
|
||||
{
|
||||
$method = $this->input->post('method');
|
||||
$id_os = $this->input->post('id_os');
|
||||
$nama_os = $this->input->post('nama_osed');
|
||||
$type_os = $this->input->post('type_osed');
|
||||
|
||||
$update = [
|
||||
'NAMA_OS' => $nama_os,
|
||||
'TYPE_OS' => $type_os
|
||||
];
|
||||
|
||||
$action = $this->MO->update('os', $update,'ID_OS',$id_os);
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('flash', 'diedit');
|
||||
redirect('ManageOs');
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'diedit');
|
||||
redirect('ManageOs');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function hapus()
|
||||
{
|
||||
$id = $this->input->post('id');
|
||||
if ($this->MO->delete('os', $id, 'ID_OS')) {
|
||||
$action = $this ->MO->delete('os',$id,'ID_OS');
|
||||
$this->session->set_flashdata('flash', 'dihapus');
|
||||
redirect('ManageOs');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
class ManagePajak extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('ModelPajak', '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()
|
||||
{
|
||||
|
||||
$datPajak = $this->MP->getDataPajak();
|
||||
|
||||
$data = [
|
||||
'sidebar' => "master data",
|
||||
'navChild' => "",
|
||||
'pajak' => $datPajak
|
||||
];
|
||||
|
||||
$this->load->view('master/Pajak', $data);
|
||||
}
|
||||
|
||||
public function save()
|
||||
{
|
||||
$method = $this->input->post('method');
|
||||
$id_pajak = $this->input->post('id');
|
||||
$kode_pajak = $this->input->post('kode_pajak');
|
||||
$nama_pajak = $this->input->post('nama_pajak');
|
||||
|
||||
$input = [
|
||||
'NAMA_PAJAK' => $nama_pajak,
|
||||
'KODE_PAJAK' => $kode_pajak,
|
||||
'SALDO_PAJAK' => '0',
|
||||
'HUTANG_PAJAK' => '0'
|
||||
];
|
||||
|
||||
$action = $this->MP->create('pajak', $input);
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('flash', 'ditambah');
|
||||
redirect('ManagePajak');
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'ditambah');
|
||||
redirect('ManagePajak');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function edit()
|
||||
{
|
||||
$method = $this->input->post('method');
|
||||
$id_pajak = $this->input->post('id_pajak');
|
||||
$kode_pajak = $this->input->post('kode_pajaked');
|
||||
$nama_pajak = $this->input->post('nama_pajaked');
|
||||
|
||||
$update = [
|
||||
'NAMA_PAJAK' => $nama_pajak,
|
||||
'KODE_PAJAK' => $kode_pajak
|
||||
];
|
||||
|
||||
$action = $this->MP->update('pajak', $update,'ID_PAJAK',$id_pajak);
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('flash', 'diedit');
|
||||
redirect('ManagePajak');
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'diedit');
|
||||
redirect('ManagePajak');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function hapus()
|
||||
{
|
||||
$id = $this->input->post('id');
|
||||
if ($this->MP->delete('pajak', $id, 'ID_PAJAK')) {
|
||||
$action = $this ->MP->delete('pajak',$id,'ID_PAJAK');
|
||||
$this->session->set_flashdata('flash', 'dihapus');
|
||||
redirect('ManagePajak');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,413 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
class ManagePenjualan extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('ModelSupplier', 'MS');
|
||||
$this->load->model('ModelPembelian', 'MP');
|
||||
$this->load->model('ModelBarang', 'MB');
|
||||
$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');
|
||||
|
||||
$datPembelian = $this->MP->getDataPembelian();
|
||||
|
||||
$data = [
|
||||
'sidebar' => "menu pembelian",
|
||||
'navChild' => ""
|
||||
];
|
||||
|
||||
$this->load->view('informasi/pembelian', $data);
|
||||
}
|
||||
|
||||
public function add()
|
||||
{
|
||||
$datSupplier = $this->MS->getDataSupplier();
|
||||
$datBarang = $this->MB->getDataBarang();
|
||||
$datPembelian = $this->MP->getDataPembelian();
|
||||
$data = [
|
||||
'sidebar' => "menu pembelian",
|
||||
'navChild' => "",
|
||||
'supplier' => $datSupplier,
|
||||
'pembelian' => $datPembelian,
|
||||
'barang' => $datBarang
|
||||
];
|
||||
$this->load->view('proses/pembelian', $data);
|
||||
}
|
||||
|
||||
public function save()
|
||||
{
|
||||
$method = $this->input->post('method');
|
||||
$tgl_penjualan = $this->input->post('tgl_penjualan');
|
||||
$nama_customer = $this->input->post('nama_customer');
|
||||
$no_sn = $this->input->post('no_sn');
|
||||
|
||||
$this->form_validation->set_rules('tgl_penjualan', 'Tanggal Penjualan', 'required');
|
||||
$this->form_validation->set_rules('nama_customer', 'Nama Customer', 'required');
|
||||
$this->form_validation->set_rules('no_sn', 'Serial Number', 'required');
|
||||
|
||||
if ($this->form_validation->run() == FALSE) {
|
||||
$data = [
|
||||
'status' => false,
|
||||
'errors' => [
|
||||
'tgl_penjualan' => form_error('tgl_penjualan'),
|
||||
'nama_customer' => form_error('nama_customer'),
|
||||
'no_sn' => form_error('no_sn')
|
||||
]
|
||||
];
|
||||
$this->output_json($data);
|
||||
} else {
|
||||
$input = [
|
||||
'TGL_PENJUALAN' => $tgl_penjualan,
|
||||
'NAMA_CUSTOMER' => $nama_customer,
|
||||
'ID_SN' => $no_sn
|
||||
];
|
||||
|
||||
$input2 = [
|
||||
'ID_SN' => $no_sn,
|
||||
'ID_STATUSPENJUALAN' => '2'
|
||||
];
|
||||
|
||||
$action = $this->MPenjualan->create('penjualan', $input);
|
||||
$action = $this->MSn->update('sn', $input2, 'ID_SN', $no_sn);
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('flash', 'ditambah');
|
||||
redirect('ManagePenjualan');
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'ditambah');
|
||||
redirect('ManagePenjualan');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function save5()
|
||||
{
|
||||
$method = $this->input->post('method');
|
||||
$tgl_penjualan = $this->input->post('tgl_penjualan');
|
||||
$nama_customer = $this->input->post('nama_customer');
|
||||
$no_sn1 = $this->input->post('no_sn1');
|
||||
$no_sn2 = $this->input->post('no_sn2');
|
||||
$no_sn3 = $this->input->post('no_sn3');
|
||||
$no_sn4 = $this->input->post('no_sn4');
|
||||
$no_sn5 = $this->input->post('no_sn5');
|
||||
|
||||
$this->form_validation->set_rules('tgl_penjualan', 'Tanggal Penjualan', 'required');
|
||||
$this->form_validation->set_rules('nama_customer', 'Nama Customer', 'required');
|
||||
$this->form_validation->set_rules('no_sn1', 'Serial Number 1', 'required');
|
||||
$this->form_validation->set_rules('no_sn2', 'Serial Number 2', 'required');
|
||||
$this->form_validation->set_rules('no_sn3', 'Serial Number 3', 'required');
|
||||
$this->form_validation->set_rules('no_sn4', 'Serial Number 4', 'required');
|
||||
$this->form_validation->set_rules('no_sn5', 'Serial Number 5', 'required');
|
||||
|
||||
if ($this->form_validation->run() == FALSE) {
|
||||
$data = [
|
||||
'status' => false,
|
||||
'errors' => [
|
||||
'tgl_penjualan' => form_error('tgl_penjualan'),
|
||||
'nama_customer' => form_error('nama_customer'),
|
||||
'no_sn1' => form_error('no_sn1'),
|
||||
'no_sn2' => form_error('no_sn2'),
|
||||
'no_sn3' => form_error('no_sn3'),
|
||||
'no_sn4' => form_error('no_sn4'),
|
||||
'no_sn5' => form_error('no_sn5')
|
||||
]
|
||||
];
|
||||
$this->output_json($data);
|
||||
} else {
|
||||
|
||||
$inputPenjualan1 = [
|
||||
'TGL_PENJUALAN' => $tgl_penjualan,
|
||||
'NAMA_CUSTOMER' => $nama_customer,
|
||||
'ID_SN' => $no_sn1
|
||||
];
|
||||
|
||||
$inputPenjualan2 = [
|
||||
'TGL_PENJUALAN' => $tgl_penjualan,
|
||||
'NAMA_CUSTOMER' => $nama_customer,
|
||||
'ID_SN' => $no_sn2
|
||||
];
|
||||
|
||||
$inputPenjualan3 = [
|
||||
'TGL_PENJUALAN' => $tgl_penjualan,
|
||||
'NAMA_CUSTOMER' => $nama_customer,
|
||||
'ID_SN' => $no_sn3
|
||||
];
|
||||
|
||||
$inputPenjualan4 = [
|
||||
'TGL_PENJUALAN' => $tgl_penjualan,
|
||||
'NAMA_CUSTOMER' => $nama_customer,
|
||||
'ID_SN' => $no_sn4
|
||||
];
|
||||
|
||||
$inputPenjualan5 = [
|
||||
'TGL_PENJUALAN' => $tgl_penjualan,
|
||||
'NAMA_CUSTOMER' => $nama_customer,
|
||||
'ID_SN' => $no_sn5
|
||||
];
|
||||
|
||||
$inputStatus1 = [
|
||||
'ID_SN' => $no_sn1,
|
||||
'ID_STATUSPENJUALAN' => '2'
|
||||
];
|
||||
|
||||
$inputStatus2 = [
|
||||
'ID_SN' => $no_sn2,
|
||||
'ID_STATUSPENJUALAN' => '2'
|
||||
];
|
||||
|
||||
$inputStatus3 = [
|
||||
'ID_SN' => $no_sn3,
|
||||
'ID_STATUSPENJUALAN' => '2'
|
||||
];
|
||||
|
||||
$inputStatus4 = [
|
||||
'ID_SN' => $no_sn4,
|
||||
'ID_STATUSPENJUALAN' => '2'
|
||||
];
|
||||
|
||||
$inputStatus5 = [
|
||||
'ID_SN' => $no_sn5,
|
||||
'ID_STATUSPENJUALAN' => '2'
|
||||
];
|
||||
|
||||
$action = $this->MPenjualan->create('penjualan', $inputPenjualan1);
|
||||
$action = $this->MPenjualan->create('penjualan', $inputPenjualan2);
|
||||
$action = $this->MPenjualan->create('penjualan', $inputPenjualan3);
|
||||
$action = $this->MPenjualan->create('penjualan', $inputPenjualan4);
|
||||
$action = $this->MPenjualan->create('penjualan', $inputPenjualan5);
|
||||
$action = $this->MSn->update('sn', $inputStatus1, 'ID_SN', $no_sn1);
|
||||
$action = $this->MSn->update('sn', $inputStatus2, 'ID_SN', $no_sn2);
|
||||
$action = $this->MSn->update('sn', $inputStatus3, 'ID_SN', $no_sn3);
|
||||
$action = $this->MSn->update('sn', $inputStatus4, 'ID_SN', $no_sn4);
|
||||
$action = $this->MSn->update('sn', $inputStatus5, 'ID_SN', $no_sn5);
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('flash', 'ditambah');
|
||||
redirect('ManagePenjualan');
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'ditambah');
|
||||
redirect('ManagePenjualan');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function save10()
|
||||
{
|
||||
$method = $this->input->post('method');
|
||||
$tgl_penjualan = $this->input->post('tgl_penjualan');
|
||||
$nama_customer = $this->input->post('nama_customer');
|
||||
$no_sn1 = $this->input->post('no_sn1');
|
||||
$no_sn2 = $this->input->post('no_sn2');
|
||||
$no_sn3 = $this->input->post('no_sn3');
|
||||
$no_sn4 = $this->input->post('no_sn4');
|
||||
$no_sn5 = $this->input->post('no_sn5');
|
||||
$no_sn6 = $this->input->post('no_sn6');
|
||||
$no_sn7 = $this->input->post('no_sn7');
|
||||
$no_sn8 = $this->input->post('no_sn8');
|
||||
$no_sn9 = $this->input->post('no_sn9');
|
||||
$no_sn10 = $this->input->post('no_sn10');
|
||||
|
||||
$this->form_validation->set_rules('tgl_penjualan', 'Tanggal Penjualan', 'required');
|
||||
$this->form_validation->set_rules('nama_customer', 'Nama Customer', 'required');
|
||||
$this->form_validation->set_rules('no_sn1', 'Serial Number 1', 'required');
|
||||
$this->form_validation->set_rules('no_sn2', 'Serial Number 2', 'required');
|
||||
$this->form_validation->set_rules('no_sn3', 'Serial Number 3', 'required');
|
||||
$this->form_validation->set_rules('no_sn4', 'Serial Number 4', 'required');
|
||||
$this->form_validation->set_rules('no_sn5', 'Serial Number 5', 'required');
|
||||
$this->form_validation->set_rules('no_sn6', 'Serial Number 6', 'required');
|
||||
$this->form_validation->set_rules('no_sn7', 'Serial Number 7', 'required');
|
||||
$this->form_validation->set_rules('no_sn8', 'Serial Number 8', 'required');
|
||||
$this->form_validation->set_rules('no_sn9', 'Serial Number 9', 'required');
|
||||
$this->form_validation->set_rules('no_sn10', 'Serial Number 10', 'required');
|
||||
|
||||
if ($this->form_validation->run() == FALSE) {
|
||||
$data = [
|
||||
'status' => false,
|
||||
'errors' => [
|
||||
'tgl_penjualan' => form_error('tgl_penjualan'),
|
||||
'nama_customer' => form_error('nama_customer'),
|
||||
'no_sn1' => form_error('no_sn1'),
|
||||
'no_sn2' => form_error('no_sn2'),
|
||||
'no_sn3' => form_error('no_sn3'),
|
||||
'no_sn4' => form_error('no_sn4'),
|
||||
'no_sn5' => form_error('no_sn5'),
|
||||
'no_sn6' => form_error('no_sn6'),
|
||||
'no_sn7' => form_error('no_sn7'),
|
||||
'no_sn8' => form_error('no_sn8'),
|
||||
'no_sn9' => form_error('no_sn9'),
|
||||
'no_sn10' => form_error('no_sn10')
|
||||
]
|
||||
];
|
||||
$this->output_json($data);
|
||||
} else {
|
||||
|
||||
$inputPenjualan1 = [
|
||||
'TGL_PENJUALAN' => $tgl_penjualan,
|
||||
'NAMA_CUSTOMER' => $nama_customer,
|
||||
'ID_SN' => $no_sn1
|
||||
];
|
||||
|
||||
$inputPenjualan2 = [
|
||||
'TGL_PENJUALAN' => $tgl_penjualan,
|
||||
'NAMA_CUSTOMER' => $nama_customer,
|
||||
'ID_SN' => $no_sn2
|
||||
];
|
||||
|
||||
$inputPenjualan3 = [
|
||||
'TGL_PENJUALAN' => $tgl_penjualan,
|
||||
'NAMA_CUSTOMER' => $nama_customer,
|
||||
'ID_SN' => $no_sn3
|
||||
];
|
||||
|
||||
$inputPenjualan4 = [
|
||||
'TGL_PENJUALAN' => $tgl_penjualan,
|
||||
'NAMA_CUSTOMER' => $nama_customer,
|
||||
'ID_SN' => $no_sn4
|
||||
];
|
||||
|
||||
$inputPenjualan5 = [
|
||||
'TGL_PENJUALAN' => $tgl_penjualan,
|
||||
'NAMA_CUSTOMER' => $nama_customer,
|
||||
'ID_SN' => $no_sn5
|
||||
];
|
||||
|
||||
$inputPenjualan6 = [
|
||||
'TGL_PENJUALAN' => $tgl_penjualan,
|
||||
'NAMA_CUSTOMER' => $nama_customer,
|
||||
'ID_SN' => $no_sn6
|
||||
];
|
||||
|
||||
$inputPenjualan7 = [
|
||||
'TGL_PENJUALAN' => $tgl_penjualan,
|
||||
'NAMA_CUSTOMER' => $nama_customer,
|
||||
'ID_SN' => $no_sn7
|
||||
];
|
||||
|
||||
$inputPenjualan8 = [
|
||||
'TGL_PENJUALAN' => $tgl_penjualan,
|
||||
'NAMA_CUSTOMER' => $nama_customer,
|
||||
'ID_SN' => $no_sn8
|
||||
];
|
||||
|
||||
$inputPenjualan9 = [
|
||||
'TGL_PENJUALAN' => $tgl_penjualan,
|
||||
'NAMA_CUSTOMER' => $nama_customer,
|
||||
'ID_SN' => $no_sn9
|
||||
];
|
||||
|
||||
$inputPenjualan10 = [
|
||||
'TGL_PENJUALAN' => $tgl_penjualan,
|
||||
'NAMA_CUSTOMER' => $nama_customer,
|
||||
'ID_SN' => $no_sn10
|
||||
];
|
||||
|
||||
$inputStatus1 = [
|
||||
'ID_SN' => $no_sn1,
|
||||
'ID_STATUSPENJUALAN' => '2'
|
||||
];
|
||||
|
||||
$inputStatus2 = [
|
||||
'ID_SN' => $no_sn2,
|
||||
'ID_STATUSPENJUALAN' => '2'
|
||||
];
|
||||
|
||||
$inputStatus3 = [
|
||||
'ID_SN' => $no_sn3,
|
||||
'ID_STATUSPENJUALAN' => '2'
|
||||
];
|
||||
|
||||
$inputStatus4 = [
|
||||
'ID_SN' => $no_sn4,
|
||||
'ID_STATUSPENJUALAN' => '2'
|
||||
];
|
||||
|
||||
$inputStatus5 = [
|
||||
'ID_SN' => $no_sn5,
|
||||
'ID_STATUSPENJUALAN' => '2'
|
||||
];
|
||||
|
||||
$inputStatus6 = [
|
||||
'ID_SN' => $no_sn6,
|
||||
'ID_STATUSPENJUALAN' => '2'
|
||||
];
|
||||
|
||||
$inputStatus7 = [
|
||||
'ID_SN' => $no_sn7,
|
||||
'ID_STATUSPENJUALAN' => '2'
|
||||
];
|
||||
|
||||
$inputStatus8 = [
|
||||
'ID_SN' => $no_sn8,
|
||||
'ID_STATUSPENJUALAN' => '2'
|
||||
];
|
||||
|
||||
$inputStatus9 = [
|
||||
'ID_SN' => $no_sn9,
|
||||
'ID_STATUSPENJUALAN' => '2'
|
||||
];
|
||||
|
||||
$inputStatus10 = [
|
||||
'ID_SN' => $no_sn10,
|
||||
'ID_STATUSPENJUALAN' => '2'
|
||||
];
|
||||
|
||||
$action = $this->MPenjualan->create('penjualan', $inputPenjualan1);
|
||||
$action = $this->MPenjualan->create('penjualan', $inputPenjualan2);
|
||||
$action = $this->MPenjualan->create('penjualan', $inputPenjualan3);
|
||||
$action = $this->MPenjualan->create('penjualan', $inputPenjualan4);
|
||||
$action = $this->MPenjualan->create('penjualan', $inputPenjualan5);
|
||||
$action = $this->MPenjualan->create('penjualan', $inputPenjualan6);
|
||||
$action = $this->MPenjualan->create('penjualan', $inputPenjualan7);
|
||||
$action = $this->MPenjualan->create('penjualan', $inputPenjualan8);
|
||||
$action = $this->MPenjualan->create('penjualan', $inputPenjualan9);
|
||||
$action = $this->MPenjualan->create('penjualan', $inputPenjualan10);
|
||||
$action = $this->MSn->update('sn', $inputStatus1, 'ID_SN', $no_sn1);
|
||||
$action = $this->MSn->update('sn', $inputStatus2, 'ID_SN', $no_sn2);
|
||||
$action = $this->MSn->update('sn', $inputStatus3, 'ID_SN', $no_sn3);
|
||||
$action = $this->MSn->update('sn', $inputStatus4, 'ID_SN', $no_sn4);
|
||||
$action = $this->MSn->update('sn', $inputStatus5, 'ID_SN', $no_sn5);
|
||||
$action = $this->MSn->update('sn', $inputStatus6, 'ID_SN', $no_sn6);
|
||||
$action = $this->MSn->update('sn', $inputStatus7, 'ID_SN', $no_sn7);
|
||||
$action = $this->MSn->update('sn', $inputStatus8, 'ID_SN', $no_sn8);
|
||||
$action = $this->MSn->update('sn', $inputStatus9, 'ID_SN', $no_sn9);
|
||||
$action = $this->MSn->update('sn', $inputStatus10, 'ID_SN', $no_sn10);
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('flash', 'ditambah');
|
||||
redirect('ManagePenjualan');
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'ditambah');
|
||||
redirect('ManagePenjualan');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function hapus()
|
||||
{
|
||||
$id = $this->input->post('id');
|
||||
$no_sn = $this->input->post('no_sn');
|
||||
if ($this->MPenjualan->delete('penjualan', $id, 'ID_PENJUALAN')) {
|
||||
$inputStatus = [
|
||||
'ID_SN' => $no_sn,
|
||||
'ID_STATUSPENJUALAN' => '1'
|
||||
];
|
||||
$action = $this->MSn->update('sn', $inputStatus, 'ID_SN', $no_sn);
|
||||
$this->session->set_flashdata('flash', 'dihapus');
|
||||
redirect('ManagePenjualan');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,254 @@
|
||||
<?php
|
||||
|
||||
use Restserver\Libraries\REST_Controller;
|
||||
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
require APPPATH . 'libraries/REST_Controller.php';
|
||||
require APPPATH . 'libraries/Format.php';
|
||||
|
||||
class ManagePembelianINV extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('ModelPembelian', 'Pembelian');
|
||||
$this->load->model('ModelNeraca', 'Neraca');
|
||||
$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() {
|
||||
|
||||
$datPembelian = $this->Pembelian->getDataPembelianHarga();
|
||||
|
||||
$data = [
|
||||
'sidebar' => "menu pembelian",
|
||||
'navChild' => "",
|
||||
'pembelian' => $datPembelian
|
||||
];
|
||||
|
||||
$this->load->view('proses/PembelianINV', $data);
|
||||
}
|
||||
|
||||
public function tambahHarga($id) {
|
||||
$harga = $this->Pembelian->getPembelianHarga($id);
|
||||
$title = $this->Pembelian->getSJPembelian($id);
|
||||
|
||||
$nominal_hda='0';
|
||||
foreach ($harga as $key) {
|
||||
$hutang = $key['HARGA_DB']*$key['QTY_DB'];
|
||||
$nominal_hda = $nominal_hda+$hutang;
|
||||
}
|
||||
|
||||
$data = [
|
||||
'sidebar' => "menu pembelian",
|
||||
'navChild' => "",
|
||||
'harga' => $harga,
|
||||
'id_pembelian' => $id,
|
||||
'nominal_hda' => $nominal_hda,
|
||||
'sj_pembelian' => $title[0]['SJ_PEMBELIAN'],
|
||||
'inv_pembelian' => $title[0]['INV_PEMBELIAN']
|
||||
];
|
||||
|
||||
$this->load->view('proses/PembelianHarga', $data);
|
||||
}
|
||||
|
||||
public function saveharga() {
|
||||
$method = $this->input->post('method');
|
||||
$id_db = $this->input->post('id_db');
|
||||
$harga_db = $this->input->post('harga_db');
|
||||
|
||||
$update = [
|
||||
'HARGA_DB' => $harga_db
|
||||
];
|
||||
|
||||
$action = $this->Pembelian->update('daftar_beli', $update, 'ID_DB', $id_db);
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('flash', 'ditambah');
|
||||
redirect($_SERVER['HTTP_REFERER']);
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'ditambah');
|
||||
redirect($_SERVER['HTTP_REFERER']);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function editharga() {
|
||||
$method = $this->input->post('method');
|
||||
$id_db = $this->input->post('id_db');
|
||||
$harga_db = $this->input->post('harga_dbed');
|
||||
|
||||
$update = [
|
||||
'HARGA_DB' => $harga_db
|
||||
];
|
||||
|
||||
$action = $this->Pembelian->update('daftar_beli', $update, 'ID_DB', $id_db);
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('flash', 'diubah');
|
||||
redirect($_SERVER['HTTP_REFERER']);
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'diubah');
|
||||
redirect($_SERVER['HTTP_REFERER']);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function invoice() {
|
||||
$method = $this->input->post('method');
|
||||
$id_pembelian = $this->input->post('id_pembelian');
|
||||
$inv_pembelian = $this->input->post('inv_pembelian');
|
||||
$tgl_invbeli = $this->input->post('tgl_invbeli');
|
||||
$tempo_invbeli = $this->input->post('tempo_invbeli');
|
||||
$ppn_pembelian = $this->input->post('radio_ppn');
|
||||
|
||||
$harga = $this->Pembelian->getPembelianHarga($id_pembelian);
|
||||
|
||||
foreach ($harga as $key) {
|
||||
if ($key['HARGA_DB']==NULL) {
|
||||
$this->session->set_flashdata('flashharga', 'diproses');
|
||||
redirect($_SERVER['HTTP_REFERER']);
|
||||
}
|
||||
}
|
||||
|
||||
$inv_pembelian = strtoupper($inv_pembelian);
|
||||
|
||||
if ($tempo_invbeli=="") {
|
||||
$tempo_invbeli = '0';
|
||||
$tempo_invbeli = $this->Pembelian->addTempo($tgl_invbeli,$tempo_invbeli);
|
||||
} else {
|
||||
$tempo_invbeli = $this->Pembelian->addTempo($tgl_invbeli,$tempo_invbeli);
|
||||
}
|
||||
|
||||
$update = [
|
||||
'INV_PEMBELIAN' => $inv_pembelian,
|
||||
'TGL_INVBELI' => $tgl_invbeli,
|
||||
'TEMPO_INVBELI' => $tempo_invbeli,
|
||||
'PPN_PEMBELIAN' => $ppn_pembelian
|
||||
];
|
||||
$action = $this->Pembelian->update('pembelian', $update, 'ID_PEMBELIAN', $id_pembelian);
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('flash', 'diproses');
|
||||
redirect('ManagePembelianINV');
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'diproses');
|
||||
redirect('ManagePembelianINV');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function kodeHutangDagang() {
|
||||
$kk = $this->Pembelian->getKodeHutangDagang();
|
||||
if (is_array($kk) || is_object($kk)) {
|
||||
foreach ($kk as $row) {
|
||||
if ($row['KODE'] == null) {
|
||||
return "HDA/000001";
|
||||
} else {
|
||||
$str = (string) $row['KODE'];
|
||||
$panjang = 6;
|
||||
$data = substr($str, 4, $panjang);
|
||||
|
||||
$ko = (int) $data + 1;
|
||||
$str = (string) $ko;
|
||||
|
||||
$panjang = 10 - strlen($str);
|
||||
$data = "HDA/000000";
|
||||
$data = substr($data, 0, $panjang) . $str;
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function konfirmasi() {
|
||||
$method = $this->input->post('method');
|
||||
$id_pembelian = $this->input->post('id_pembelian');
|
||||
$kode_hda = $this->kodeHutangDagang();
|
||||
|
||||
$daftarHarga = $this->Pembelian->getDataDaftarHarga($id_pembelian);
|
||||
|
||||
foreach ($daftarHarga as $key) {
|
||||
$avg_dh = $key['AVG_DH'];
|
||||
$global_kuantiti = $key['GLOBAL_KUANTITI'];
|
||||
$harga_db = $key['HARGA_DB'];
|
||||
$qty_db = $key['QTY_DB'];
|
||||
|
||||
$data1 = $global_kuantiti-$qty_db;
|
||||
$data2 = $data1*$avg_dh;
|
||||
$data3 = $harga_db*$qty_db;
|
||||
$data4 = $data2+$data3;
|
||||
$data5 = $data4/$global_kuantiti;
|
||||
$tgl_dh = date('Y-m-d H:i:s');
|
||||
|
||||
$update = [
|
||||
'AVG_DH' => $data5,
|
||||
'TGL_DH' => $tgl_dh
|
||||
];
|
||||
|
||||
$action = $this->Pembelian->update('daftar_harga', $update, 'ID_DH', $key['ID_DH']);
|
||||
}
|
||||
|
||||
$hda = $this->Pembelian->getPembelianHarga($id_pembelian);
|
||||
$tempo_invbeli = $hda[0]['TEMPO_INVBELI'];
|
||||
|
||||
$nominal_hda='0';
|
||||
|
||||
foreach ($hda as $key) {
|
||||
$hutang = $key['HARGA_DB']*$key['QTY_DB'];
|
||||
$nominal_hda = $nominal_hda+$hutang;
|
||||
}
|
||||
|
||||
$setdata = $this->Neraca->getSetdata_ID();
|
||||
$id_setdata = $setdata[0]['SETDATA_ID'];
|
||||
|
||||
$neraca = $this->Neraca->getDataNilaiNeraca($id_setdata,15);
|
||||
$nilai_neraca = $neraca[0]['NILAI_NERACA'];
|
||||
$id_neraca = $neraca[0]['ID_NERACA'];
|
||||
$nilai = $nilai_neraca+$nominal_hda;
|
||||
$update = [
|
||||
'NILAI_NERACA' => $nilai
|
||||
];
|
||||
$action = $this->Neraca->update('neraca', $update, 'ID_NERACA', $id_neraca);
|
||||
|
||||
$neraca = $this->Neraca->getDataNilaiNeraca($id_setdata,27);
|
||||
$nilai_neraca = $neraca[0]['NILAI_NERACA'];
|
||||
$id_neraca = $neraca[0]['ID_NERACA'];
|
||||
$nilai = $nilai_neraca+$nominal_hda;
|
||||
$update = [
|
||||
'NILAI_NERACA' => $nilai
|
||||
];
|
||||
$action = $this->Neraca->update('neraca', $update, 'ID_NERACA', $id_neraca);
|
||||
|
||||
|
||||
$input = [
|
||||
'PEMBELIAN_ID' => $id_pembelian,
|
||||
'NOMINAL_HDA' => $nominal_hda,
|
||||
'KODE_HDA' => $kode_hda,
|
||||
'TEMPO_HDA' => $tempo_invbeli,
|
||||
];
|
||||
|
||||
$action = $this->Pembelian->create('hutang_dagang', $input);
|
||||
|
||||
$update = [
|
||||
'STATUS_PEMBELIAN' => '1'
|
||||
];
|
||||
|
||||
$action = $this->Pembelian->update('pembelian', $update, 'ID_PEMBELIAN', $id_pembelian);
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('flash', 'diproses');
|
||||
redirect('ManagePembelianINV');
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'diproses');
|
||||
redirect('ManagePembelianINV');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,464 @@
|
||||
<?php
|
||||
|
||||
use Restserver\Libraries\REST_Controller;
|
||||
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
require APPPATH . 'libraries/REST_Controller.php';
|
||||
require APPPATH . 'libraries/Format.php';
|
||||
|
||||
class ManagePembelianSJ extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('ModelBarang', 'Barang');
|
||||
$this->load->model('ModelCorp', 'Corp');
|
||||
$this->load->model('ModelGudang', 'Gudang');
|
||||
$this->load->model('ModelNeraca', 'Neraca');
|
||||
$this->load->model('ModelSupplier', 'Supplier');
|
||||
$this->load->model('ModelPembelian', 'Pembelian');
|
||||
$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() {
|
||||
|
||||
$datPembelian = $this->Pembelian->getDataPembelian();
|
||||
$datCorp = $this->Corp->getDataCorp();
|
||||
$datGudang = $this->Gudang->getDataGudangPembelian();
|
||||
$datSupplier = $this->Supplier->getDataSupplier();
|
||||
$tgl = date('m/d/Y');
|
||||
|
||||
$data = [
|
||||
'sidebar' => "menu pembelian",
|
||||
'navChild' => "",
|
||||
'pembelian' => $datPembelian,
|
||||
'corp' => $datCorp,
|
||||
'gudang' => $datGudang,
|
||||
'supplier' => $datSupplier,
|
||||
'tgl' => $tgl
|
||||
];
|
||||
|
||||
$this->load->view('proses/PembelianSJ', $data);
|
||||
}
|
||||
|
||||
public function kodePembelian() {
|
||||
$kk = $this->Pembelian->getKodePembelian();
|
||||
if (is_array($kk) || is_object($kk)) {
|
||||
foreach ($kk as $row) {
|
||||
if ($row['KODE'] == null) {
|
||||
return "PB/000001";
|
||||
} else {
|
||||
$str = (string) $row['KODE'];
|
||||
$panjang = 6;
|
||||
$data = substr($str, 3, $panjang);
|
||||
|
||||
$ko = (int) $data + 1;
|
||||
$str = (string) $ko;
|
||||
|
||||
$panjang = 9 - strlen($str);
|
||||
$data = "PB/000000";
|
||||
$data = substr($data, 0, $panjang) . $str;
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function save() {
|
||||
$method = $this->input->post('method');
|
||||
$id_pembelian = $this->input->post('id');
|
||||
$id_supplier = $this->input->post('id_supplier');
|
||||
$id_corp = $this->input->post('id_corp');
|
||||
$sj_pembelian = $this->input->post('sj_pembelian');
|
||||
$tgl_sjbeli = $this->input->post('tgl_sjbeli');
|
||||
$kode_pembelian = $this->kodePembelian();
|
||||
|
||||
$sj_pembelian = strtoupper($sj_pembelian);
|
||||
|
||||
$input = [
|
||||
'SUPPLIER_ID' => $id_supplier,
|
||||
'CORP_ID' => $id_corp,
|
||||
'TGL_SJBELI' => $tgl_sjbeli,
|
||||
'SJ_PEMBELIAN' => $sj_pembelian,
|
||||
'KODE_PEMBELIAN'=> $kode_pembelian
|
||||
];
|
||||
|
||||
$action = $this->Pembelian->create('pembelian', $input);
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('flash', 'ditambah');
|
||||
redirect('ManagePembelianSJ');
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'ditambah');
|
||||
redirect('ManagePembelianSJ');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function edit() {
|
||||
$method = $this->input->post('method');
|
||||
$id_pembelian = $this->input->post('id_pembelian');
|
||||
$id_supplier = $this->input->post('id_suppliered');
|
||||
$id_corp = $this->input->post('id_corped');
|
||||
$sj_pembelian = $this->input->post('sj_pembelianed');
|
||||
$tgl_sjbeli = $this->input->post('tgl_sjbelied');
|
||||
|
||||
$update = [
|
||||
'SUPPLIER_ID' => $id_supplier,
|
||||
'CORP_ID' => $id_corp,
|
||||
'TGL_SJBELI' => $tgl_sjbeli,
|
||||
'SJ_PEMBELIAN' => $sj_pembelian
|
||||
];
|
||||
|
||||
$action = $this->Pembelian->update('pembelian', $update,'ID_PEMBELIAN',$id_pembelian);
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('flash', 'diubah');
|
||||
redirect('ManagePembelianSJ');
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'diubah');
|
||||
redirect('ManagePembelianSJ');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function hapus() {
|
||||
$id = $this->input->post('id');
|
||||
$action = $this->Pembelian->delDB($id);
|
||||
$action = $this->Pembelian->delete('pembelian',$id,'ID_PEMBELIAN');
|
||||
$this->session->set_flashdata('flash', 'dihapus');
|
||||
redirect('ManagePembelianSJ');
|
||||
}
|
||||
|
||||
public function tambahStock($id) {
|
||||
$stock = $this->Pembelian->getDataTambahStock($id);
|
||||
$title = $this->Pembelian->getSJPembelian($id);
|
||||
$barang = $this->Barang->getBarangDB();
|
||||
$gudang = $this->Gudang->getDataGudangPembelian();
|
||||
|
||||
$data = [
|
||||
'sidebar' => "menu pembelian",
|
||||
'navChild' => "",
|
||||
'stock' => $stock,
|
||||
'id_pembelian' => $id,
|
||||
'sj_pembelian' => $title[0]['SJ_PEMBELIAN'],
|
||||
'id_db' => $title[0]['ID_DB'],
|
||||
'barang' => $barang,
|
||||
'gudang' => $gudang
|
||||
];
|
||||
|
||||
$this->load->view('proses/PembelianST', $data);
|
||||
}
|
||||
|
||||
public function savedb() {
|
||||
$method = $this->input->post('method');
|
||||
$id_pembelian = $this->input->post('id_pembelian');
|
||||
$id = $this->input->post('id_db');
|
||||
$id_barang = $this->input->post('id_barang');
|
||||
$qty_db = $this->input->post('qty_db');
|
||||
|
||||
$input = [
|
||||
'BARANG_ID' => $id_barang,
|
||||
'PEMBELIAN_ID' => $id_pembelian,
|
||||
'QTY_DB' => $qty_db
|
||||
];
|
||||
$action = $this->Pembelian->create('daftar_beli', $input);
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('flash', 'dilakukan');
|
||||
redirect($_SERVER['HTTP_REFERER']);
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'dilakukan');
|
||||
redirect($_SERVER['HTTP_REFERER']);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function editdb() {
|
||||
$method = $this->input->post('method');
|
||||
$id_db = $this->input->post('id_db');
|
||||
$id_barang = $this->input->post('id_barang');
|
||||
$qty_db = $this->input->post('qty_dbed');
|
||||
|
||||
$datadb = $this->Pembelian->getDataDaftarBeli($id_db);
|
||||
$qty = $datadb[0]['QTY_DB'];
|
||||
$barang = $datadb[0]['BARANG_ID'];
|
||||
|
||||
$jenis = $this->Pembelian->getDataJenis($barang);
|
||||
$type_jenis = $jenis[0]['TYPE_JENIS'];
|
||||
|
||||
if ($type_jenis=="1") {
|
||||
$action = $this->Pembelian->delSn($id_db);
|
||||
}
|
||||
|
||||
$update = [
|
||||
'BARANG_ID' => $id_barang,
|
||||
'QTY_DB' => $qty_db
|
||||
];
|
||||
$action = $this->Pembelian->update('daftar_beli', $update, 'ID_DB', $id_db);
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('flash', 'diubah');
|
||||
redirect($_SERVER['HTTP_REFERER']);
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'diubah');
|
||||
redirect($_SERVER['HTTP_REFERER']);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function hapusdb() {
|
||||
$id = $this->input->post('id');
|
||||
|
||||
$datadb = $this->Pembelian->getDataDaftarBeli($id);
|
||||
$id_barang = $datadb[0]['BARANG_ID'];
|
||||
|
||||
$jenis = $this->Pembelian->getDataJenis($id_barang);
|
||||
$type_jenis = $jenis[0]['TYPE_JENIS'];
|
||||
|
||||
if ($type_jenis=="1") {
|
||||
$action = $this->Pembelian->delSn($id);
|
||||
}
|
||||
|
||||
$action = $this->Pembelian->delete('daftar_beli',$id,'ID_DB');
|
||||
|
||||
$this->session->set_flashdata('flash', 'dihapus');
|
||||
redirect($_SERVER['HTTP_REFERER']);
|
||||
}
|
||||
|
||||
public function tambahSn($id) {
|
||||
$stock = $this->Pembelian->getDataTambahSn($id);
|
||||
$max = $this->Pembelian->getQtyReal($id);
|
||||
$data = [
|
||||
'sidebar' => "menu pembelian",
|
||||
'navChild' => "",
|
||||
'stock' => $stock,
|
||||
'id_db' => $id,
|
||||
'qty' => $stock[0]['QTY_DB'],
|
||||
'title' => $stock[0]['NAMA_BARANG'],
|
||||
'max' => $max,
|
||||
];
|
||||
|
||||
$this->load->view('proses/PembelianSN', $data);
|
||||
}
|
||||
|
||||
public function datasn() {
|
||||
$id = $this->input->post('id');
|
||||
$data = $this->Pembelian->getDataSn($id);
|
||||
$this->output_json(['value' => 1, 'total' => sizeof($data), 'data' => $data]);
|
||||
}
|
||||
|
||||
public function jumlahdatasn() {
|
||||
$id = $this->input->post('id');
|
||||
$data = $this->Pembelian->getDataSn($id);
|
||||
$this->output_json(['value' => 1, 'jumlah_data' => sizeof($data)]);
|
||||
}
|
||||
|
||||
public function savesn() {
|
||||
$id = $this->input->post('id_sn');
|
||||
$id_db = $this->input->post('id_db');
|
||||
$nama_sn = $this->input->post('nama_sn');
|
||||
$nama_sn = strtoupper($nama_sn);
|
||||
|
||||
$dataDb = $this->Pembelian->getDataTambahSn($id_db);
|
||||
$qtyDb = $dataDb[0]['QTY_DB'];
|
||||
$id_barang = $dataDb[0]['BID'];
|
||||
$qtyReal = $this->Pembelian->getQtyReal($id_db);
|
||||
|
||||
if ($id != null) {
|
||||
$data = [
|
||||
'NAMA_SN' => $nama_sn,
|
||||
'DB_ID' => $id_db,
|
||||
'BARANG_ID' => $id_barang
|
||||
];
|
||||
$action = $this->Pembelian->update('sn', $data, 'ID_SN', $id);
|
||||
|
||||
if ($action) {
|
||||
$this->output_json(['value' => 1, 'id' => $id, 'nama_sn' => $nama_sn]);
|
||||
$this->session->set_flashdata('flash', 'diedit');
|
||||
} else {
|
||||
$this->output_json(['value' => 0, 'id' => $id, 'nama_sn' => $nama_sn]);
|
||||
}
|
||||
} else {
|
||||
//Fungsi Tambah SN
|
||||
$data = [
|
||||
'NAMA_SN' => $nama_sn,
|
||||
'DB_ID' => $id_db,
|
||||
'GUDANG_ID' => '1',
|
||||
'BARANG_ID' => $id_barang
|
||||
];
|
||||
$action = $this->Pembelian->create('sn', $data);
|
||||
|
||||
//Fungsi update Qty Real Tabel Barang
|
||||
$qtyReal = $this->Pembelian->getQtyReal($id_db);
|
||||
if ($qtyReal==$qtyDb){
|
||||
$this->output_json(['value' => 2, 'id' => $id, 'nama_sn' => $nama_sn]);
|
||||
$this->session->set_flashdata('flashkunci', 'dilakukan');
|
||||
} else if ($action) {
|
||||
$this->output_json(['value' => 1, 'id' => $id, 'nama_sn' => $nama_sn]);
|
||||
} else {
|
||||
$this->output_json(['value' => 0, 'id' => $id, 'nama_sn' => $nama_sn]);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function hapussn() {
|
||||
$id = $this->input->post('id_sn');
|
||||
$id_db = $this->Pembelian->getDataSnDb($id);
|
||||
$id_db = $id_db[0]['DB_ID'];
|
||||
|
||||
$qtyReal = $this->Pembelian->getQtyReal($id_db);
|
||||
$qtyStock = $this->Pembelian->getDataTambahSn($id_db);
|
||||
$qtyStock = $qtyStock[0]['QTY_DB'];
|
||||
|
||||
$action = $this->Pembelian->delete('sn', $id, 'ID_SN');
|
||||
|
||||
if ($qtyReal==$qtyStock){
|
||||
$this->output_json(['value' => 2, 'message' => 'Berhasil', 'dt' => $action]);
|
||||
$this->session->set_flashdata('flashkurang', 'dilakukan');
|
||||
} else {
|
||||
if ($action) {
|
||||
$this->output_json(['value' => 1, 'message' => 'Berhasil', 'dt' => $action]);
|
||||
} else {
|
||||
$this->output_json(['value' => 0, 'message' => "gagal", 'dt' => $action]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function kodeStockKuantiti() {
|
||||
$kk = $this->Pembelian->getKodeSTQ();
|
||||
if (is_array($kk) || is_object($kk)) {
|
||||
foreach ($kk as $row) {
|
||||
if ($row['KODE'] == null) {
|
||||
return "STQ/000001";
|
||||
} else {
|
||||
$str = (string) $row['KODE'];
|
||||
$panjang = 6;
|
||||
$data = substr($str, 4, $panjang);
|
||||
|
||||
$ko = (int) $data + 1;
|
||||
$str = (string) $ko;
|
||||
|
||||
$panjang = 10 - strlen($str);
|
||||
$data = "STQ/000000";
|
||||
$data = substr($data, 0, $panjang) . $str;
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function kodeStockSn() {
|
||||
$kk = $this->Pembelian->getKodeSTSN();
|
||||
if (is_array($kk) || is_object($kk)) {
|
||||
foreach ($kk as $row) {
|
||||
if ($row['KODE'] == null) {
|
||||
return "STSN/000001";
|
||||
} else {
|
||||
$str = (string) $row['KODE'];
|
||||
$panjang = 6;
|
||||
$data = substr($str, 5, $panjang);
|
||||
|
||||
$ko = (int) $data + 1;
|
||||
$str = (string) $ko;
|
||||
|
||||
$panjang = 11 - strlen($str);
|
||||
$data = "STSN/000000";
|
||||
$data = substr($data, 0, $panjang) . $str;
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function konfirmasi() {
|
||||
$method = $this->input->post('method');
|
||||
$id_pembelian = $this->input->post('id_pembelian');
|
||||
|
||||
$pembelian = $this->Pembelian->getPembelianHarga($id_pembelian);
|
||||
|
||||
foreach ($pembelian as $key) {
|
||||
$type_jenis = $key['TYPE_JENIS'];
|
||||
if ($type_jenis=="1") {
|
||||
$qtyReal = $this->Pembelian->getQtyReal($key['ID_DB']);
|
||||
$qtyDb = $key['QTY_DB'];
|
||||
if ($qtyReal<$qtyDb) {
|
||||
$this->session->set_flashdata('flashsn', 'diproses');
|
||||
redirect($_SERVER['HTTP_REFERER']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($pembelian as $key) {
|
||||
$type_jenis = $key['TYPE_JENIS'];
|
||||
if ($type_jenis=="1") {
|
||||
$sn = $this->Pembelian->getDataSn($key['ID_DB']);
|
||||
foreach ($sn as $dat) {
|
||||
$kode_stsn = $this->kodeStockSn();
|
||||
$input = [
|
||||
'KODE_STSN' => $kode_stsn,
|
||||
'KODE_BUKTI' => $key['KODE_PEMBELIAN'],
|
||||
'TGL_STSN' => $key['TGL_SJBELI'],
|
||||
'BARANG_ID' => $key['BARANG_ID'],
|
||||
'SUPPLIER_ID' => $key['SUPPLIER_ID'],
|
||||
'SN_ID' => $dat['ID_SN']
|
||||
];
|
||||
$action = $this->Pembelian->create('stock_sn', $input);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($pembelian as $key) {
|
||||
$kuantiti = $this->Pembelian->getDataKuantiti($key['ID_DB']);
|
||||
$id_kuantiti = $kuantiti[0]['ID_KUANTITI'];
|
||||
$global_kuantiti = $kuantiti[0]['GLOBAL_KUANTITI'];
|
||||
$pcm_kuantiti = $kuantiti[0]['PCM_KUANTITI'];
|
||||
$tgl_dh = date('Y-m-d H:i:s');
|
||||
|
||||
$kuantiti1 = $pcm_kuantiti+$key['QTY_DB'];
|
||||
$kuantiti2 = $global_kuantiti+$key['QTY_DB'];
|
||||
$update = [
|
||||
'PCM_KUANTITI' => $kuantiti1,
|
||||
'GLOBAL_KUANTITI' => $kuantiti2,
|
||||
'TGL_KUANTITI' => $tgl_dh
|
||||
];
|
||||
$action = $this->Pembelian->update('kuantiti', $update, 'ID_KUANTITI', $id_kuantiti);
|
||||
|
||||
$kode_stq = $this->kodeStockKuantiti();
|
||||
$input = [
|
||||
'KODE_STQ' => $kode_stq,
|
||||
'KODE_BUKTI' => $key['KODE_PEMBELIAN'],
|
||||
'TGL_STQ' => $key['TGL_SJBELI'],
|
||||
'BARANG_ID' => $key['BARANG_ID'],
|
||||
'QTY_BEFORE' => $global_kuantiti,
|
||||
'QTY_IN' => $key['QTY_DB'],
|
||||
'QTY_OUT' => '0',
|
||||
'QTY_AFTER' => $kuantiti2
|
||||
];
|
||||
$action = $this->Pembelian->create('stock_kuantiti', $input);
|
||||
}
|
||||
|
||||
$update = [
|
||||
'STATUS_PEMBELIAN' => '0'
|
||||
];
|
||||
|
||||
$action = $this->Pembelian->update('pembelian', $update, 'ID_PEMBELIAN', $id_pembelian);
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('flash', 'diproses');
|
||||
redirect('ManagePembelianSJ');
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'diproses');
|
||||
redirect('ManagePembelianSJ');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,464 @@
|
||||
<?php
|
||||
|
||||
use Restserver\Libraries\REST_Controller;
|
||||
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
require APPPATH . 'libraries/REST_Controller.php';
|
||||
require APPPATH . 'libraries/Format.php';
|
||||
|
||||
class ManagePembelianSJ extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('ModelPembelian', 'MP');
|
||||
$this->load->model('ModelSupplier', 'MS');
|
||||
$this->load->model('ModelBarang', 'MB');
|
||||
$this->load->model('ModelGudang', 'MG');
|
||||
$this->load->model('ModelCorp', 'MC');
|
||||
$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()
|
||||
{
|
||||
|
||||
$datPembelian = $this->MP->getDataPembelian();
|
||||
$datSupplier = $this->MS->getDataSupplier();
|
||||
$datCorp = $this->MC->getDataCorp();
|
||||
|
||||
$data = [
|
||||
'sidebar' => "menu pembelian",
|
||||
'navChild' => "",
|
||||
'pembelian' => $datPembelian,
|
||||
'supplier' => $datSupplier,
|
||||
'corp' => $datCorp
|
||||
];
|
||||
|
||||
$this->load->view('proses/PembelianSJ', $data);
|
||||
}
|
||||
|
||||
public function save()
|
||||
{
|
||||
$method = $this->input->post('method');
|
||||
$id_pembelian = $this->input->post('id');
|
||||
$id_supplier = $this->input->post('id_supplier');
|
||||
$id_corp = $this->input->post('id_corp');
|
||||
$sj_pembelian = $this->input->post('sj_pembelian');
|
||||
$tgl_sjbeli = $this->input->post('tgl_sjbeli');
|
||||
$kode_pembelian = $this->kodePembelian();
|
||||
|
||||
$sj_pembelian = strtoupper($sj_pembelian);
|
||||
|
||||
$input = [
|
||||
'SUPPLIER_ID' => $id_supplier,
|
||||
'CORP_ID' => $id_corp,
|
||||
'TGL_SJBELI' => $tgl_sjbeli,
|
||||
'SJ_PEMBELIAN' => $sj_pembelian,
|
||||
'KODE_PEMBELIAN'=> $kode_pembelian
|
||||
];
|
||||
|
||||
$action = $this->MP->create('pembelian', $input);
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('flash', 'ditambah');
|
||||
redirect('ManagePembelianSJ');
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'ditambah');
|
||||
redirect('ManagePembelianSJ');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function edit()
|
||||
{
|
||||
$method = $this->input->post('method');
|
||||
$id_pembelian = $this->input->post('id_pembelian');
|
||||
$id_supplier = $this->input->post('id_suppliered');
|
||||
$id_corp = $this->input->post('id_corped');
|
||||
$sj_pembelian = $this->input->post('sj_pembelianed');
|
||||
$tgl_sjbeli = $this->input->post('tgl_sjbelied');
|
||||
|
||||
$update = [
|
||||
'SUPPLIER_ID' => $id_supplier,
|
||||
'CORP_ID' => $id_corp,
|
||||
'TGL_SJBELI' => $tgl_sjbeli,
|
||||
'SJ_PEMBELIAN' => $sj_pembelian
|
||||
];
|
||||
|
||||
$action = $this->MP->update('pembelian', $update,'ID_PEMBELIAN',$id_pembelian);
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('flash', 'diubah');
|
||||
redirect('ManagePembelianSJ');
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'diubah');
|
||||
redirect('ManagePembelianSJ');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function hapus()
|
||||
{
|
||||
$id = $this->input->post('id');
|
||||
if ($this->MP->delete('pembelian', $id, 'ID_PEMBELIAN')) {
|
||||
$action = $this ->MP->delete('pembelian',$id,'ID_PEMBELIAN');
|
||||
$this->session->set_flashdata('flash', 'dihapus');
|
||||
redirect('ManagePembelianSJ');
|
||||
}
|
||||
}
|
||||
|
||||
public function tambahStock($id)
|
||||
{
|
||||
$stock = $this->MP->getDataTambahStock($id);
|
||||
$title = $this->MP->getSJPembelian($id);
|
||||
$barang = $this->MB->getDataBarang();
|
||||
$gudang = $this->MG->getDataGudangPembelian();
|
||||
|
||||
$data = [
|
||||
'sidebar' => "menu pembelian",
|
||||
'navChild' => "",
|
||||
'stock' => $stock,
|
||||
'id_pembelian' => $id,
|
||||
'sj_pembelian' => $title[0]['SJ_PEMBELIAN'],
|
||||
'barang' => $barang,
|
||||
'gudang' => $gudang
|
||||
];
|
||||
|
||||
$this->load->view('proses/PembelianST', $data);
|
||||
}
|
||||
|
||||
public function savestock()
|
||||
{
|
||||
$method = $this->input->post('method');
|
||||
$id_pembelian = $this->input->post('id_pembelian');
|
||||
$id_stock = $this->input->post('id');
|
||||
$id_barang = $this->input->post('id_barang');
|
||||
$id_gudang = $this->input->post('id_gudang');
|
||||
$qty = $this->input->post('qty');
|
||||
|
||||
$input = [
|
||||
'PEMBELIAN_ID' => $id_pembelian,
|
||||
'BARANG_ID' => $id_barang,
|
||||
'GUDANG_ID' => $id_gudang,
|
||||
'QTY' => $qty,
|
||||
'BLOCKADDSN' => '0'
|
||||
];
|
||||
|
||||
$action = $this->MP->create('stock', $input);
|
||||
|
||||
$qty_barang = $this->MB->getDataBarangQtyReal($id_barang);
|
||||
$qty_real = $qty_barang[0]['QTY_REAL']+$qty;
|
||||
|
||||
$updatebarang = [
|
||||
'QTY_REAL' => $qty_real
|
||||
];
|
||||
|
||||
$actionupdate = $this->MB->update('barang', $updatebarang, 'ID_BARANG', $id_barang);
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('flash', 'ditambah');
|
||||
redirect($_SERVER['HTTP_REFERER']);
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'ditambah');
|
||||
redirect($_SERVER['HTTP_REFERER']);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function editstock()
|
||||
{
|
||||
$method = $this->input->post('method');
|
||||
$id_pembelian = $this->input->post('id_pembelian');
|
||||
$id_stock = $this->input->post('id_stock');
|
||||
$id_barang = $this->input->post('id_baranged');
|
||||
$id_gudang = $this->input->post('id_gudanged');
|
||||
$qty = $this->input->post('qtyed');
|
||||
|
||||
//Fungsi Reset Tabel sebelum Input Stock
|
||||
$before = $this->MP->getStockID($id_stock);
|
||||
$qtyBarang = $before[0]['QTY_REAL'];
|
||||
$qtyStock = $before[0]['QTY'];
|
||||
$blockaddsn = $before[0]['BLOCKADDSN'];
|
||||
$idbarangBefore = $before[0]['BARANG_ID'];
|
||||
|
||||
if ($blockaddsn==NULL) {
|
||||
$qtyrealOnBarang = $qtyBarang-$qtyStock;
|
||||
$updatebarang = [
|
||||
'QTY_REAL' => $qtyrealOnBarang
|
||||
];
|
||||
$actionbarang = $this->MB->update('barang',$updatebarang,'ID_BARANG',$idbarangBefore);
|
||||
} else {
|
||||
$qtyrealOnBarang = $qtyBarang-$blockaddsn;
|
||||
$updatebarang = [
|
||||
'QTY_REAL' => $qtyrealOnBarang
|
||||
];
|
||||
$actionbarang = $this->MB->update('barang',$updatebarang,'ID_BARANG',$idbarangBefore);
|
||||
$updatestock = [
|
||||
'QTY' => '0'
|
||||
];
|
||||
$actionstock = $this->MP->update('stock',$updatestock,'ID_STOCK',$id_stock);
|
||||
}
|
||||
|
||||
$actiondeletesn = $this->MP->delSN($id_stock);
|
||||
|
||||
// Fungsi Edit Tabel sesuai data Edit
|
||||
$updatestock = [
|
||||
'BARANG_ID' => $id_barang,
|
||||
'GUDANG_ID' => $id_gudang,
|
||||
'QTY' => $qty
|
||||
];
|
||||
$actionstock = $this->MP->update('stock',$updatestock,'ID_STOCK',$id_stock);
|
||||
|
||||
$after = $this->MP->getStockID($id_stock);
|
||||
$typejenis = $after[0]['TYPE_JENIS'];
|
||||
$idbarangAfter = $after[0]['BARANG_ID'];
|
||||
$qtyBarang = $after[0]['QTY_REAL'];
|
||||
if ($typejenis=="SN") {
|
||||
$updatestock = [
|
||||
'BLOCKADDSN' => '0'
|
||||
];
|
||||
$actionstock = $this->MP->update('stock',$updatestock,'ID_STOCK',$id_stock);
|
||||
|
||||
$updatebarang = [
|
||||
'QTY_REAL' => $qtyBarang
|
||||
];
|
||||
$actionbarang = $this->MB->update('barang',$updatebarang,'ID_BARANG',$idbarangAfter);
|
||||
|
||||
} else {
|
||||
$updatestock = [
|
||||
'BLOCKADDSN' => NULL
|
||||
];
|
||||
$actionstock = $this->MP->update('stock',$updatestock,'ID_STOCK',$id_stock);
|
||||
|
||||
$qtyrealOnBarangAfter = $qtyBarang+$qty;
|
||||
$updatebarang = [
|
||||
'QTY_REAL' => $qtyrealOnBarangAfter
|
||||
];
|
||||
$actionbarang = $this->MB->update('barang',$updatebarang,'ID_BARANG',$idbarangAfter);
|
||||
}
|
||||
|
||||
if ($actionstock) {
|
||||
$this->session->set_flashdata('flash', 'diedit');
|
||||
redirect($_SERVER['HTTP_REFERER']);
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'diedit');
|
||||
redirect($_SERVER['HTTP_REFERER']);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function hapusstock()
|
||||
{
|
||||
$id = $this->input->post('id');
|
||||
$id_barang = $this->input->post('id_barang');
|
||||
|
||||
$qty_barangID = $this->MB->getDataBarangQtyReal($id_barang);
|
||||
$qty_stockID = $this->MB->getDataStockQty($id);
|
||||
$qtystock = $qty_stockID[0]['QTY'];
|
||||
$qtybarang = $qty_barangID[0]['QTY_REAL'];
|
||||
$qty_real = $qtybarang-$qtystock;
|
||||
$deletebarang = [
|
||||
'QTY_REAL' => $qty_real
|
||||
];
|
||||
|
||||
$action = $this ->MP->delete('stock',$id,'ID_STOCK');
|
||||
$actiondelete = $this->MB->update('barang', $deletebarang, 'ID_BARANG', $id_barang);
|
||||
$actiondeletesn = $this->MP->delSN($id);
|
||||
|
||||
$this->session->set_flashdata('flash', 'dihapus');
|
||||
redirect($_SERVER['HTTP_REFERER']);
|
||||
}
|
||||
|
||||
public function tambahSn($id)
|
||||
{
|
||||
$stock = $this->MP->getStockID($id);
|
||||
$title = $this->MP->getStockTitle($id);
|
||||
$max = $this->MP->getQtyPembelianSn($id);
|
||||
|
||||
$data = [
|
||||
'sidebar' => "menu pembelian",
|
||||
'navChild' => "",
|
||||
'stock' => $stock,
|
||||
'id_stock' => $id,
|
||||
'qty' => $stock[0]['QTY'],
|
||||
'title' => $title[0]['NAMA_BARANG'],
|
||||
'max' => $max,
|
||||
];
|
||||
|
||||
$this->load->view('proses/PembelianSN', $data);
|
||||
}
|
||||
|
||||
public function datasn()
|
||||
{
|
||||
$id = $this->input->post('id');
|
||||
$data = $this->MP->getDataSn($id);
|
||||
$this->output_json(['value' => 1, 'total' => sizeof($data), 'data' => $data]);
|
||||
}
|
||||
|
||||
public function jumlahdatasn()
|
||||
{
|
||||
$id = $this->input->post('id');
|
||||
$data = $this->MP->getDataSn($id);
|
||||
$this->output_json(['value' => 1, 'jumlah_data' => sizeof($data)]);
|
||||
}
|
||||
|
||||
public function savesn()
|
||||
{
|
||||
$id = $this->input->post('id_sn');
|
||||
$nama_sn = $this->input->post('nama_sn');
|
||||
$id_stock = $this->input->post('id_stock');
|
||||
$qty = $this->MP->getQtyPembelian($id_stock);
|
||||
$qtySn = $this->MP->getQtyPembelianSn($id_stock);
|
||||
|
||||
if ($qtySn>=$qty[0]['QTY']){
|
||||
$this->output_json(['value' => 2, 'id' => $id, 'nama_sn' => $nama_sn]);
|
||||
} else if ($id != null) {
|
||||
$data = [
|
||||
'NAMA_SN' => $nama_sn,
|
||||
'STOCK_ID' => $id_stock,
|
||||
'STATUS_SN' => 'Ready'
|
||||
];
|
||||
$action = $this->MP->update('sn', $data, 'ID_SN', $id);
|
||||
$gudang = $this->MP->getGudangStock($id);
|
||||
$updatesn = [
|
||||
'GUDANG_ID' => $gudang[0]['GUDANG_ID']
|
||||
];
|
||||
$actiongudang = $this->MP->update('sn', $updatesn, 'ID_SN', $id);
|
||||
|
||||
if ($actiongudang) {
|
||||
$this->output_json(['value' => 1, 'id' => $id, 'nama_sn' => $nama_sn]);
|
||||
} else {
|
||||
$this->output_json(['value' => 0, 'id' => $id, 'nama_sn' => $nama_sn]);
|
||||
}
|
||||
} else {
|
||||
//Fungsi Tambah SN
|
||||
$data = [
|
||||
'NAMA_SN' => $nama_sn,
|
||||
'STOCK_ID' => $id_stock,
|
||||
'STATUS_SN' => 'Ready'
|
||||
];
|
||||
$action = $this->MP->create('sn', $data);
|
||||
$gudsn = $this->MP->getGudangSN();
|
||||
$gudang = $this->MP->getGudangStock($gudsn[0]['ID_SN']);
|
||||
$updatesn = [
|
||||
'GUDANG_ID' => $gudang[0]['GUDANG_ID']
|
||||
];
|
||||
$actiongudang = $this->MP->update('sn', $updatesn, 'ID_SN', $gudsn[0]['ID_SN']);
|
||||
|
||||
$blockadd = $this->MP->getBlockAddSn($id_stock);
|
||||
$update = [
|
||||
'BLOCKADDSN' => $blockadd
|
||||
];
|
||||
$block = $this->MP->update('stock', $update, 'ID_STOCK', $id_stock);
|
||||
|
||||
//Fungsi update Qty Real Tabel Barang
|
||||
$barangStockAfter = $this->MP->getBarangStock($id_stock);
|
||||
$id_barangAfter = $barangStockAfter[0]['BARANG_ID'];
|
||||
$qty_realAfter = $barangStockAfter[0]['QTY_REAL'];
|
||||
$blockaddsnAfter = $barangStockAfter[0]['BLOCKADDSN'];
|
||||
|
||||
$barang_qty_real = $qty_realAfter+1;
|
||||
$updatebarang = [
|
||||
'QTY_REAL' => $barang_qty_real
|
||||
];
|
||||
$actionbarang = $this->MP->update('barang', $updatebarang, 'ID_BARANG', $id_barangAfter);
|
||||
|
||||
if ($actionbarang) {
|
||||
$this->output_json(['value' => 1, 'id' => $id, 'nama_sn' => $nama_sn]);
|
||||
} else {
|
||||
$this->output_json(['value' => 0, 'id' => $id, 'nama_sn' => $nama_sn]);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function hapussn()
|
||||
{
|
||||
$id = $this->input->post('id_sn');
|
||||
$datPDID = $this->MP->getDetailPembelianID($id);
|
||||
$id_stock = $datPDID[0]['STOCK_ID'];
|
||||
$qty = $this->MP->getQtyPembelian($datPDID[0]['STOCK_ID']);
|
||||
$real = $this->MP->getQtyPembelianSn($datPDID[0]['STOCK_ID']);
|
||||
|
||||
$action = $this->MP->delete('sn', $id, 'ID_SN');
|
||||
|
||||
$blockadd = $this->MP->getBlockAddSn($datPDID[0]['STOCK_ID']);
|
||||
$update = [
|
||||
'BLOCKADDSN' => $blockadd
|
||||
];
|
||||
$block = $this->MP->update('stock', $update, 'ID_STOCK', $datPDID[0]['STOCK_ID']);
|
||||
|
||||
//Fungsi update Qty Real Tabel Barang
|
||||
$barangStockAfter = $this->MP->getBarangStock($id_stock);
|
||||
$id_barangAfter = $barangStockAfter[0]['BARANG_ID'];
|
||||
$qty_realAfter = $barangStockAfter[0]['QTY_REAL'];
|
||||
$blockaddsnAfter = $barangStockAfter[0]['BLOCKADDSN'];
|
||||
|
||||
$barang_qty_real = $qty_realAfter-1;
|
||||
$updatebarang = [
|
||||
'QTY_REAL' => $barang_qty_real
|
||||
];
|
||||
$actionbarang = $this->MP->update('barang', $updatebarang, 'ID_BARANG', $id_barangAfter);
|
||||
|
||||
if ($real==$qty[0]['QTY']){
|
||||
$this->output_json(['value' => 2, 'message' => 'Berhasil', 'dt' => $action]);
|
||||
} else {
|
||||
if ($action) {
|
||||
$this->output_json(['value' => 1, 'message' => 'Berhasil', 'dt' => $action]);
|
||||
} else {
|
||||
$this->output_json(['value' => 0, 'message' => "gagal", 'dt' => $action]);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function konfirmasi()
|
||||
{
|
||||
$method = $this->input->post('method');
|
||||
$id_pembelian = $this->input->post('id_pembelian');
|
||||
|
||||
$update = [
|
||||
'STATUS_PEMBELIAN' => "SJ SUDAH PROSES"
|
||||
];
|
||||
|
||||
$action = $this->MP->update('pembelian', $update, 'ID_PEMBELIAN', $id_pembelian);
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('flash', 'ditambah');
|
||||
redirect('ManagePembelianSJ');
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'ditambah');
|
||||
redirect('ManagePembelianSJ');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function kodePembelian() {
|
||||
$kk = $this->MP->getKodePembelian();
|
||||
if (is_array($kk) || is_object($kk)) {
|
||||
foreach ($kk as $row) {
|
||||
if ($row['KODE'] == null) {
|
||||
return "PB/000001";
|
||||
} else {
|
||||
$str = (string) $row['KODE'];
|
||||
$panjang = 6;
|
||||
$data = substr($str, 3, $panjang);
|
||||
|
||||
$ko = (int) $data + 1;
|
||||
$str = (string) $ko;
|
||||
|
||||
$panjang = 9 - strlen($str);
|
||||
$data = "PB/000000";
|
||||
$data = substr($data, 0, $panjang) . $str;
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,462 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
class ManagePenjualan extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('ModelSn', 'MSn');
|
||||
$this->load->model('ModelStatusPenjualan', 'MSPenjualan');
|
||||
$this->load->model('ModelPenjualan', 'MPenjualan');
|
||||
$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("Login");
|
||||
} elseif ($jabatan != "ADMIN") {
|
||||
redirect("Login");
|
||||
}
|
||||
|
||||
$datSn = $this->MSn->getDataSn();
|
||||
$datSPenjualan = $this->MSPenjualan->getDataSPenjualan();
|
||||
$datPenjualan = $this->MPenjualan->getDataPenjualan();
|
||||
|
||||
$data = [
|
||||
'sidebar' => "data master",
|
||||
'navChild' => "data penjualan",
|
||||
'sn' => $datSn,
|
||||
'spenjualan' => $datSPenjualan,
|
||||
'penjualan' => $datPenjualan
|
||||
];
|
||||
|
||||
$this->load->view('penjualan/table-penjualan', $data);
|
||||
}
|
||||
|
||||
public function add()
|
||||
{
|
||||
$username = $this->session->userdata('username');
|
||||
if ($username == null) {
|
||||
redirect("Login");
|
||||
}
|
||||
$datSn = $this->MSn->getDataSnBelumLaku();
|
||||
$datPenjualan = $this->MPenjualan->getDataPenjualan();
|
||||
$data = [
|
||||
'sidebar' => "data master",
|
||||
'navChild' => "data penjualan",
|
||||
'sn' => $datSn,
|
||||
'penjualan' => $datPenjualan
|
||||
|
||||
];
|
||||
$this->load->view('penjualan/penjualan-tambah', $data);
|
||||
}
|
||||
|
||||
public function add5()
|
||||
{
|
||||
$username = $this->session->userdata('username');
|
||||
if ($username == null) {
|
||||
redirect("Login");
|
||||
}
|
||||
$datSn = $this->MSn->getDataSnBelumLaku();
|
||||
$datPenjualan = $this->MPenjualan->getDataPenjualan();
|
||||
$data = [
|
||||
'sidebar' => "data master",
|
||||
'navChild' => "data penjualan",
|
||||
'sn' => $datSn,
|
||||
'penjualan' => $datPenjualan
|
||||
|
||||
];
|
||||
$this->load->view('penjualan/penjualan-tambah5', $data);
|
||||
}
|
||||
|
||||
public function add10()
|
||||
{
|
||||
$username = $this->session->userdata('username');
|
||||
if ($username == null) {
|
||||
redirect("Login");
|
||||
}
|
||||
$datSn = $this->MSn->getDataSnBelumLaku();
|
||||
$datPenjualan = $this->MPenjualan->getDataPenjualan();
|
||||
$data = [
|
||||
'sidebar' => "data master",
|
||||
'navChild' => "data penjualan",
|
||||
'sn' => $datSn,
|
||||
'penjualan' => $datPenjualan
|
||||
|
||||
];
|
||||
$this->load->view('penjualan/penjualan-tambah10', $data);
|
||||
}
|
||||
|
||||
public function save()
|
||||
{
|
||||
$method = $this->input->post('method');
|
||||
$tgl_penjualan = $this->input->post('tgl_penjualan');
|
||||
$nama_customer = $this->input->post('nama_customer');
|
||||
$no_sn = $this->input->post('no_sn');
|
||||
|
||||
$this->form_validation->set_rules('tgl_penjualan', 'Tanggal Penjualan', 'required');
|
||||
$this->form_validation->set_rules('nama_customer', 'Nama Customer', 'required');
|
||||
$this->form_validation->set_rules('no_sn', 'Serial Number', 'required');
|
||||
|
||||
if ($this->form_validation->run() == FALSE) {
|
||||
$data = [
|
||||
'status' => false,
|
||||
'errors' => [
|
||||
'tgl_penjualan' => form_error('tgl_penjualan'),
|
||||
'nama_customer' => form_error('nama_customer'),
|
||||
'no_sn' => form_error('no_sn')
|
||||
]
|
||||
];
|
||||
$this->output_json($data);
|
||||
} else {
|
||||
$input = [
|
||||
'TGL_PENJUALAN' => $tgl_penjualan,
|
||||
'NAMA_CUSTOMER' => $nama_customer,
|
||||
'ID_SN' => $no_sn
|
||||
];
|
||||
|
||||
$input2 = [
|
||||
'ID_SN' => $no_sn,
|
||||
'ID_STATUSPENJUALAN' => '2'
|
||||
];
|
||||
|
||||
$action = $this->MPenjualan->create('penjualan', $input);
|
||||
$action = $this->MSn->update('sn', $input2, 'ID_SN', $no_sn);
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('flash', 'ditambah');
|
||||
redirect('ManagePenjualan');
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'ditambah');
|
||||
redirect('ManagePenjualan');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function save5()
|
||||
{
|
||||
$method = $this->input->post('method');
|
||||
$tgl_penjualan = $this->input->post('tgl_penjualan');
|
||||
$nama_customer = $this->input->post('nama_customer');
|
||||
$no_sn1 = $this->input->post('no_sn1');
|
||||
$no_sn2 = $this->input->post('no_sn2');
|
||||
$no_sn3 = $this->input->post('no_sn3');
|
||||
$no_sn4 = $this->input->post('no_sn4');
|
||||
$no_sn5 = $this->input->post('no_sn5');
|
||||
|
||||
$this->form_validation->set_rules('tgl_penjualan', 'Tanggal Penjualan', 'required');
|
||||
$this->form_validation->set_rules('nama_customer', 'Nama Customer', 'required');
|
||||
$this->form_validation->set_rules('no_sn1', 'Serial Number 1', 'required');
|
||||
$this->form_validation->set_rules('no_sn2', 'Serial Number 2', 'required');
|
||||
$this->form_validation->set_rules('no_sn3', 'Serial Number 3', 'required');
|
||||
$this->form_validation->set_rules('no_sn4', 'Serial Number 4', 'required');
|
||||
$this->form_validation->set_rules('no_sn5', 'Serial Number 5', 'required');
|
||||
|
||||
if ($this->form_validation->run() == FALSE) {
|
||||
$data = [
|
||||
'status' => false,
|
||||
'errors' => [
|
||||
'tgl_penjualan' => form_error('tgl_penjualan'),
|
||||
'nama_customer' => form_error('nama_customer'),
|
||||
'no_sn1' => form_error('no_sn1'),
|
||||
'no_sn2' => form_error('no_sn2'),
|
||||
'no_sn3' => form_error('no_sn3'),
|
||||
'no_sn4' => form_error('no_sn4'),
|
||||
'no_sn5' => form_error('no_sn5')
|
||||
]
|
||||
];
|
||||
$this->output_json($data);
|
||||
} else {
|
||||
|
||||
$inputPenjualan1 = [
|
||||
'TGL_PENJUALAN' => $tgl_penjualan,
|
||||
'NAMA_CUSTOMER' => $nama_customer,
|
||||
'ID_SN' => $no_sn1
|
||||
];
|
||||
|
||||
$inputPenjualan2 = [
|
||||
'TGL_PENJUALAN' => $tgl_penjualan,
|
||||
'NAMA_CUSTOMER' => $nama_customer,
|
||||
'ID_SN' => $no_sn2
|
||||
];
|
||||
|
||||
$inputPenjualan3 = [
|
||||
'TGL_PENJUALAN' => $tgl_penjualan,
|
||||
'NAMA_CUSTOMER' => $nama_customer,
|
||||
'ID_SN' => $no_sn3
|
||||
];
|
||||
|
||||
$inputPenjualan4 = [
|
||||
'TGL_PENJUALAN' => $tgl_penjualan,
|
||||
'NAMA_CUSTOMER' => $nama_customer,
|
||||
'ID_SN' => $no_sn4
|
||||
];
|
||||
|
||||
$inputPenjualan5 = [
|
||||
'TGL_PENJUALAN' => $tgl_penjualan,
|
||||
'NAMA_CUSTOMER' => $nama_customer,
|
||||
'ID_SN' => $no_sn5
|
||||
];
|
||||
|
||||
$inputStatus1 = [
|
||||
'ID_SN' => $no_sn1,
|
||||
'ID_STATUSPENJUALAN' => '2'
|
||||
];
|
||||
|
||||
$inputStatus2 = [
|
||||
'ID_SN' => $no_sn2,
|
||||
'ID_STATUSPENJUALAN' => '2'
|
||||
];
|
||||
|
||||
$inputStatus3 = [
|
||||
'ID_SN' => $no_sn3,
|
||||
'ID_STATUSPENJUALAN' => '2'
|
||||
];
|
||||
|
||||
$inputStatus4 = [
|
||||
'ID_SN' => $no_sn4,
|
||||
'ID_STATUSPENJUALAN' => '2'
|
||||
];
|
||||
|
||||
$inputStatus5 = [
|
||||
'ID_SN' => $no_sn5,
|
||||
'ID_STATUSPENJUALAN' => '2'
|
||||
];
|
||||
|
||||
$action = $this->MPenjualan->create('penjualan', $inputPenjualan1);
|
||||
$action = $this->MPenjualan->create('penjualan', $inputPenjualan2);
|
||||
$action = $this->MPenjualan->create('penjualan', $inputPenjualan3);
|
||||
$action = $this->MPenjualan->create('penjualan', $inputPenjualan4);
|
||||
$action = $this->MPenjualan->create('penjualan', $inputPenjualan5);
|
||||
$action = $this->MSn->update('sn', $inputStatus1, 'ID_SN', $no_sn1);
|
||||
$action = $this->MSn->update('sn', $inputStatus2, 'ID_SN', $no_sn2);
|
||||
$action = $this->MSn->update('sn', $inputStatus3, 'ID_SN', $no_sn3);
|
||||
$action = $this->MSn->update('sn', $inputStatus4, 'ID_SN', $no_sn4);
|
||||
$action = $this->MSn->update('sn', $inputStatus5, 'ID_SN', $no_sn5);
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('flash', 'ditambah');
|
||||
redirect('ManagePenjualan');
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'ditambah');
|
||||
redirect('ManagePenjualan');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function save10()
|
||||
{
|
||||
$method = $this->input->post('method');
|
||||
$tgl_penjualan = $this->input->post('tgl_penjualan');
|
||||
$nama_customer = $this->input->post('nama_customer');
|
||||
$no_sn1 = $this->input->post('no_sn1');
|
||||
$no_sn2 = $this->input->post('no_sn2');
|
||||
$no_sn3 = $this->input->post('no_sn3');
|
||||
$no_sn4 = $this->input->post('no_sn4');
|
||||
$no_sn5 = $this->input->post('no_sn5');
|
||||
$no_sn6 = $this->input->post('no_sn6');
|
||||
$no_sn7 = $this->input->post('no_sn7');
|
||||
$no_sn8 = $this->input->post('no_sn8');
|
||||
$no_sn9 = $this->input->post('no_sn9');
|
||||
$no_sn10 = $this->input->post('no_sn10');
|
||||
|
||||
$this->form_validation->set_rules('tgl_penjualan', 'Tanggal Penjualan', 'required');
|
||||
$this->form_validation->set_rules('nama_customer', 'Nama Customer', 'required');
|
||||
$this->form_validation->set_rules('no_sn1', 'Serial Number 1', 'required');
|
||||
$this->form_validation->set_rules('no_sn2', 'Serial Number 2', 'required');
|
||||
$this->form_validation->set_rules('no_sn3', 'Serial Number 3', 'required');
|
||||
$this->form_validation->set_rules('no_sn4', 'Serial Number 4', 'required');
|
||||
$this->form_validation->set_rules('no_sn5', 'Serial Number 5', 'required');
|
||||
$this->form_validation->set_rules('no_sn6', 'Serial Number 6', 'required');
|
||||
$this->form_validation->set_rules('no_sn7', 'Serial Number 7', 'required');
|
||||
$this->form_validation->set_rules('no_sn8', 'Serial Number 8', 'required');
|
||||
$this->form_validation->set_rules('no_sn9', 'Serial Number 9', 'required');
|
||||
$this->form_validation->set_rules('no_sn10', 'Serial Number 10', 'required');
|
||||
|
||||
if ($this->form_validation->run() == FALSE) {
|
||||
$data = [
|
||||
'status' => false,
|
||||
'errors' => [
|
||||
'tgl_penjualan' => form_error('tgl_penjualan'),
|
||||
'nama_customer' => form_error('nama_customer'),
|
||||
'no_sn1' => form_error('no_sn1'),
|
||||
'no_sn2' => form_error('no_sn2'),
|
||||
'no_sn3' => form_error('no_sn3'),
|
||||
'no_sn4' => form_error('no_sn4'),
|
||||
'no_sn5' => form_error('no_sn5'),
|
||||
'no_sn6' => form_error('no_sn6'),
|
||||
'no_sn7' => form_error('no_sn7'),
|
||||
'no_sn8' => form_error('no_sn8'),
|
||||
'no_sn9' => form_error('no_sn9'),
|
||||
'no_sn10' => form_error('no_sn10')
|
||||
]
|
||||
];
|
||||
$this->output_json($data);
|
||||
} else {
|
||||
|
||||
$inputPenjualan1 = [
|
||||
'TGL_PENJUALAN' => $tgl_penjualan,
|
||||
'NAMA_CUSTOMER' => $nama_customer,
|
||||
'ID_SN' => $no_sn1
|
||||
];
|
||||
|
||||
$inputPenjualan2 = [
|
||||
'TGL_PENJUALAN' => $tgl_penjualan,
|
||||
'NAMA_CUSTOMER' => $nama_customer,
|
||||
'ID_SN' => $no_sn2
|
||||
];
|
||||
|
||||
$inputPenjualan3 = [
|
||||
'TGL_PENJUALAN' => $tgl_penjualan,
|
||||
'NAMA_CUSTOMER' => $nama_customer,
|
||||
'ID_SN' => $no_sn3
|
||||
];
|
||||
|
||||
$inputPenjualan4 = [
|
||||
'TGL_PENJUALAN' => $tgl_penjualan,
|
||||
'NAMA_CUSTOMER' => $nama_customer,
|
||||
'ID_SN' => $no_sn4
|
||||
];
|
||||
|
||||
$inputPenjualan5 = [
|
||||
'TGL_PENJUALAN' => $tgl_penjualan,
|
||||
'NAMA_CUSTOMER' => $nama_customer,
|
||||
'ID_SN' => $no_sn5
|
||||
];
|
||||
|
||||
$inputPenjualan6 = [
|
||||
'TGL_PENJUALAN' => $tgl_penjualan,
|
||||
'NAMA_CUSTOMER' => $nama_customer,
|
||||
'ID_SN' => $no_sn6
|
||||
];
|
||||
|
||||
$inputPenjualan7 = [
|
||||
'TGL_PENJUALAN' => $tgl_penjualan,
|
||||
'NAMA_CUSTOMER' => $nama_customer,
|
||||
'ID_SN' => $no_sn7
|
||||
];
|
||||
|
||||
$inputPenjualan8 = [
|
||||
'TGL_PENJUALAN' => $tgl_penjualan,
|
||||
'NAMA_CUSTOMER' => $nama_customer,
|
||||
'ID_SN' => $no_sn8
|
||||
];
|
||||
|
||||
$inputPenjualan9 = [
|
||||
'TGL_PENJUALAN' => $tgl_penjualan,
|
||||
'NAMA_CUSTOMER' => $nama_customer,
|
||||
'ID_SN' => $no_sn9
|
||||
];
|
||||
|
||||
$inputPenjualan10 = [
|
||||
'TGL_PENJUALAN' => $tgl_penjualan,
|
||||
'NAMA_CUSTOMER' => $nama_customer,
|
||||
'ID_SN' => $no_sn10
|
||||
];
|
||||
|
||||
$inputStatus1 = [
|
||||
'ID_SN' => $no_sn1,
|
||||
'ID_STATUSPENJUALAN' => '2'
|
||||
];
|
||||
|
||||
$inputStatus2 = [
|
||||
'ID_SN' => $no_sn2,
|
||||
'ID_STATUSPENJUALAN' => '2'
|
||||
];
|
||||
|
||||
$inputStatus3 = [
|
||||
'ID_SN' => $no_sn3,
|
||||
'ID_STATUSPENJUALAN' => '2'
|
||||
];
|
||||
|
||||
$inputStatus4 = [
|
||||
'ID_SN' => $no_sn4,
|
||||
'ID_STATUSPENJUALAN' => '2'
|
||||
];
|
||||
|
||||
$inputStatus5 = [
|
||||
'ID_SN' => $no_sn5,
|
||||
'ID_STATUSPENJUALAN' => '2'
|
||||
];
|
||||
|
||||
$inputStatus6 = [
|
||||
'ID_SN' => $no_sn6,
|
||||
'ID_STATUSPENJUALAN' => '2'
|
||||
];
|
||||
|
||||
$inputStatus7 = [
|
||||
'ID_SN' => $no_sn7,
|
||||
'ID_STATUSPENJUALAN' => '2'
|
||||
];
|
||||
|
||||
$inputStatus8 = [
|
||||
'ID_SN' => $no_sn8,
|
||||
'ID_STATUSPENJUALAN' => '2'
|
||||
];
|
||||
|
||||
$inputStatus9 = [
|
||||
'ID_SN' => $no_sn9,
|
||||
'ID_STATUSPENJUALAN' => '2'
|
||||
];
|
||||
|
||||
$inputStatus10 = [
|
||||
'ID_SN' => $no_sn10,
|
||||
'ID_STATUSPENJUALAN' => '2'
|
||||
];
|
||||
|
||||
$action = $this->MPenjualan->create('penjualan', $inputPenjualan1);
|
||||
$action = $this->MPenjualan->create('penjualan', $inputPenjualan2);
|
||||
$action = $this->MPenjualan->create('penjualan', $inputPenjualan3);
|
||||
$action = $this->MPenjualan->create('penjualan', $inputPenjualan4);
|
||||
$action = $this->MPenjualan->create('penjualan', $inputPenjualan5);
|
||||
$action = $this->MPenjualan->create('penjualan', $inputPenjualan6);
|
||||
$action = $this->MPenjualan->create('penjualan', $inputPenjualan7);
|
||||
$action = $this->MPenjualan->create('penjualan', $inputPenjualan8);
|
||||
$action = $this->MPenjualan->create('penjualan', $inputPenjualan9);
|
||||
$action = $this->MPenjualan->create('penjualan', $inputPenjualan10);
|
||||
$action = $this->MSn->update('sn', $inputStatus1, 'ID_SN', $no_sn1);
|
||||
$action = $this->MSn->update('sn', $inputStatus2, 'ID_SN', $no_sn2);
|
||||
$action = $this->MSn->update('sn', $inputStatus3, 'ID_SN', $no_sn3);
|
||||
$action = $this->MSn->update('sn', $inputStatus4, 'ID_SN', $no_sn4);
|
||||
$action = $this->MSn->update('sn', $inputStatus5, 'ID_SN', $no_sn5);
|
||||
$action = $this->MSn->update('sn', $inputStatus6, 'ID_SN', $no_sn6);
|
||||
$action = $this->MSn->update('sn', $inputStatus7, 'ID_SN', $no_sn7);
|
||||
$action = $this->MSn->update('sn', $inputStatus8, 'ID_SN', $no_sn8);
|
||||
$action = $this->MSn->update('sn', $inputStatus9, 'ID_SN', $no_sn9);
|
||||
$action = $this->MSn->update('sn', $inputStatus10, 'ID_SN', $no_sn10);
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('flash', 'ditambah');
|
||||
redirect('ManagePenjualan');
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'ditambah');
|
||||
redirect('ManagePenjualan');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function hapus()
|
||||
{
|
||||
$id = $this->input->post('id');
|
||||
$no_sn = $this->input->post('no_sn');
|
||||
if ($this->MPenjualan->delete('penjualan', $id, 'ID_PENJUALAN')) {
|
||||
$inputStatus = [
|
||||
'ID_SN' => $no_sn,
|
||||
'ID_STATUSPENJUALAN' => '1'
|
||||
];
|
||||
$action = $this->MSn->update('sn', $inputStatus, 'ID_SN', $no_sn);
|
||||
$this->session->set_flashdata('flash', 'dihapus');
|
||||
redirect('ManagePenjualan');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,448 @@
|
||||
<?php
|
||||
|
||||
use Restserver\Libraries\REST_Controller;
|
||||
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
require APPPATH . 'libraries/REST_Controller.php';
|
||||
require APPPATH . 'libraries/Format.php';
|
||||
|
||||
class ManagePenjualanSO extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('ModelPenjualan', 'Penjualan');
|
||||
$this->load->model('ModelBarang', 'Barang');
|
||||
$this->load->model('ModelCorp', 'Corp');
|
||||
$this->load->model('ModelKaryawan', 'Karyawan');
|
||||
$this->load->model('ModelNeraca', 'Neraca');
|
||||
$this->load->model('ModelPelanggan', 'Pelanggan');
|
||||
$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() {
|
||||
$datPenjualan = $this->Penjualan->getDataPenjualan();
|
||||
$datCorp = $this->Corp->getData_Corp();
|
||||
$datSales = $this->Karyawan->getDataSales();
|
||||
$datPelanggan = $this->Pelanggan->getData_Pelanggan();
|
||||
$tgl = date('m/d/Y');
|
||||
|
||||
$data = [
|
||||
'sidebar' => "menu penjualan",
|
||||
'navChild' => "",
|
||||
'penjualan' => $datPenjualan,
|
||||
'corp' => $datCorp,
|
||||
'sales' => $datSales,
|
||||
'pelanggan' => $datPelanggan,
|
||||
'tgl' => $tgl
|
||||
];
|
||||
|
||||
$this->load->view('proses/PenjualanSO', $data);
|
||||
}
|
||||
|
||||
public function kodePenjualan() {
|
||||
$kk = $this->Penjualan->getKodePenjualan();
|
||||
if (is_array($kk) || is_object($kk)) {
|
||||
foreach ($kk as $row) {
|
||||
if ($row['KODE'] == null) {
|
||||
return "PJ/000001";
|
||||
} else {
|
||||
$str = (string) $row['KODE'];
|
||||
$panjang = 6;
|
||||
$data = substr($str, 3, $panjang);
|
||||
|
||||
$ko = (int) $data + 1;
|
||||
$str = (string) $ko;
|
||||
|
||||
$panjang = 9 - strlen($str);
|
||||
$data = "PJ/000000";
|
||||
$data = substr($data, 0, $panjang) . $str;
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function save() {
|
||||
$method = $this->input->post('method');
|
||||
$id_penjualan = $this->input->post('id');
|
||||
$id_sales = $this->input->post('id_sales');
|
||||
$id_corp = $this->input->post('id_corp');
|
||||
$id_pelanggan = $this->input->post('id_pelanggan');
|
||||
$po_penjualan = $this->input->post('po_penjualan');
|
||||
$tgl_penjualan = $this->input->post('tgl_penjualan');
|
||||
$tempo_penjualan = $this->input->post('tempo_penjualan');
|
||||
$radio_ppn = $this->input->post('radio_ppn');
|
||||
$radio_gp = $this->input->post('radio_gp');
|
||||
$kode_penjualan = $this->kodePenjualan();
|
||||
|
||||
$po_penjualan = strtoupper($po_penjualan);
|
||||
$tgl = date('Y-m-d H:i:s');
|
||||
|
||||
if ($tempo_penjualan=="") {
|
||||
$tempo_penjualan = '0';
|
||||
$tempo_penjualan = $this->Penjualan->addTempo($tgl,$tempo_penjualan);
|
||||
} else {
|
||||
$tempo_penjualan = $this->Penjualan->addTempo($tgl,$tempo_penjualan);
|
||||
}
|
||||
|
||||
$input = [
|
||||
'SALES_ID' => $id_sales,
|
||||
'CORP_ID' => $id_corp,
|
||||
'PELANGGAN_ID' => $id_pelanggan,
|
||||
'PO_PENJUALAN' => $po_penjualan,
|
||||
'KODE_PENJUALAN' => $kode_penjualan,
|
||||
'TGL_PENJUALAN' => $tgl_penjualan,
|
||||
'TEMPO_PENJUALAN' => $tempo_penjualan,
|
||||
'PPN_PENJUALAN' => $radio_ppn,
|
||||
'GP_PENJUALAN' => $radio_gp
|
||||
];
|
||||
|
||||
$action = $this->Penjualan->create('penjualan', $input);
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('flash', 'ditambah');
|
||||
redirect('ManagePenjualanSO');
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'ditambah');
|
||||
redirect('ManagePenjualanSO');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function edit() {
|
||||
$method = $this->input->post('method');
|
||||
$id_penjualan = $this->input->post('id_penjualan');
|
||||
$id_sales = $this->input->post('id_salesed');
|
||||
$id_corp = $this->input->post('id_corped');
|
||||
$id_pelanggan = $this->input->post('id_pelangganed');
|
||||
$po_penjualan = $this->input->post('po_penjualaned');
|
||||
$tgl_penjualan = $this->input->post('tgl_penjualaned');
|
||||
$tempo_penjualan = $this->input->post('tempo_penjualaned');
|
||||
$radio_ppn = $this->input->post('radio_ppn');
|
||||
$radio_gp = $this->input->post('radio_gp');
|
||||
|
||||
$po_penjualan = strtoupper($po_penjualan);
|
||||
|
||||
$update = [
|
||||
'SALES_ID' => $id_sales,
|
||||
'CORP_ID' => $id_corp,
|
||||
'PELANGGAN_ID' => $id_pelanggan,
|
||||
'PO_PENJUALAN' => $po_penjualan,
|
||||
'TGL_PENJUALAN' => $tgl_penjualan,
|
||||
'TEMPO_PENJUALAN' => $tempo_penjualan,
|
||||
'PPN_PENJUALAN' => $radio_ppn,
|
||||
'GP_PENJUALAN' => $radio_gp
|
||||
];
|
||||
|
||||
$action = $this->Penjualan->update('penjualan', $update,'ID_PENJUALAN',$id_penjualan);
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('flash', 'diubah');
|
||||
redirect('ManagePenjualanSO');
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'diubah');
|
||||
redirect('ManagePenjualanSO');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function hapus() {
|
||||
$id = $this->input->post('id');
|
||||
$action = $this->Penjualan->delete('penjualan',$id,'ID_PENJUALAN');
|
||||
$this->session->set_flashdata('flash', 'dihapus');
|
||||
redirect('ManagePenjualanSO');
|
||||
}
|
||||
|
||||
public function tambahPesanan($id) {
|
||||
$pesanan = $this->Penjualan->getPenjualanPesanan($id);
|
||||
$title = $this->Penjualan->getTitlePesanan($id);
|
||||
$barang = $this->Barang->getBarangPenjualan();
|
||||
$cabutan = $this->Barang->getBarangCabutan();
|
||||
|
||||
$id_pelanggan = $title[0]['PELANGGAN_ID'];
|
||||
$limit = $this->Penjualan->getSisaLimit($id_pelanggan);
|
||||
|
||||
$limitAktif = '0';
|
||||
foreach ($limit as $key) {
|
||||
$piutang = $key['NOMINAL_PDA'];
|
||||
$limitAktif = $limitAktif+$piutang;
|
||||
}
|
||||
|
||||
$cicilanAktif = '0';
|
||||
foreach ($limit as $key) {
|
||||
$cicilan = $this->Penjualan->getCicilanPiutang($key['ID_PDA']);
|
||||
$nominal_dpda = '0';
|
||||
foreach ($cicilan as $key) {
|
||||
$nominal_dpda = $nominal_dpda+$key['NOMINAL_DPDA'];
|
||||
}
|
||||
$cicilanAktif = $cicilanAktif+$nominal_dpda;
|
||||
}
|
||||
|
||||
$pelanggan = $this->Penjualan->getDataPelanggan($id_pelanggan);
|
||||
$limit_pelanggan = $pelanggan[0]['LIMIT_PELANGGAN'];
|
||||
$limit = $limit_pelanggan-$limitAktif+$cicilanAktif;
|
||||
|
||||
$nominal_pda='0';
|
||||
foreach ($pesanan as $key) {
|
||||
$piutang = $key['HARGA_DJ']*$key['QTY_DJ'];
|
||||
$nominal_pda = $nominal_pda+$piutang;
|
||||
}
|
||||
|
||||
$data = [
|
||||
'sidebar' => "menu penjualan",
|
||||
'navChild' => "",
|
||||
'pesanan' => $pesanan,
|
||||
'id_penjualan' => $id,
|
||||
'limit' => $limit,
|
||||
'nominal_pda' => $nominal_pda,
|
||||
'title' => $title[0]['KODE_PENJUALAN'],
|
||||
'barang' => $barang,
|
||||
'cabutan' => $cabutan,
|
||||
];
|
||||
|
||||
$this->load->view('proses/PenjualanPesanan', $data);
|
||||
}
|
||||
|
||||
public function savepesanan() {
|
||||
$method = $this->input->post('method');
|
||||
$id_penjualan = $this->input->post('id_penjualan');
|
||||
$id = $this->input->post('id_dj');
|
||||
$id_barang = $this->input->post('id_barang');
|
||||
$qty_dj = $this->input->post('qty_dj');
|
||||
$jenis_dj = $this->input->post('jenis_dj');
|
||||
$ket_dj = $this->input->post('ket_dj');
|
||||
|
||||
$kuantiti = $this->Penjualan->getKuantitiBarang($id_barang);
|
||||
$id_kuantiti = $kuantiti[0]['ID_KUANTITI'];
|
||||
$pcm_kuantiti = $kuantiti[0]['PCM_KUANTITI'];
|
||||
$proses_kuantiti = $kuantiti[0]['PROSES_KUANTITI'];
|
||||
|
||||
if ($qty_dj>$pcm_kuantiti) {
|
||||
$this->session->set_flashdata('flashkuantiti', 'ditambah');
|
||||
redirect($_SERVER['HTTP_REFERER']);
|
||||
}
|
||||
|
||||
if ($qty_dj==0 OR $qty_dj=="") {
|
||||
$this->session->set_flashdata('flashzero', 'ditambah');
|
||||
redirect($_SERVER['HTTP_REFERER']);
|
||||
}
|
||||
|
||||
$temp = $proses_kuantiti+$qty_dj;
|
||||
$pcm = $pcm_kuantiti-$qty_dj;
|
||||
|
||||
$input = [
|
||||
'PENJUALAN_ID' => $id_penjualan,
|
||||
'BARANG_ID' => $id_barang,
|
||||
'QTY_DJ' => $qty_dj,
|
||||
'JENIS_DJ' => $jenis_dj,
|
||||
'KET_DJ' => $ket_dj
|
||||
];
|
||||
|
||||
$action = $this->Penjualan->create('daftar_jual', $input);
|
||||
|
||||
$update = [
|
||||
'PROSES_KUANTITI' => $temp,
|
||||
'PCM_KUANTITI' => $pcm
|
||||
];
|
||||
|
||||
$action = $this->Penjualan->update('kuantiti', $update, 'ID_KUANTITI', $id_kuantiti);
|
||||
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('flash', 'ditambah');
|
||||
redirect($_SERVER['HTTP_REFERER']);
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'ditambah');
|
||||
redirect($_SERVER['HTTP_REFERER']);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function hargapesanan() {
|
||||
$method = $this->input->post('method');
|
||||
$id_dj = $this->input->post('id_dj');
|
||||
$id_penjualan = $this->input->post('id_penjualan');
|
||||
$harga_dj = $this->input->post('harga_dj');
|
||||
$limit = $this->input->post('limit');
|
||||
$nominal_pda = $this->input->post('nominal_pda');
|
||||
|
||||
$dj = $this->Penjualan->getDataDaftarJual($id_dj);
|
||||
$qty_dj = $dj[0]['QTY_DJ'];
|
||||
$total = $qty_dj*$harga_dj;
|
||||
$totalAkhir = $total+$nominal_pda;
|
||||
|
||||
if ($limit<$totalAkhir) {
|
||||
$this->session->set_flashdata('flashlimit', 'ditambah');
|
||||
redirect($_SERVER['HTTP_REFERER']);
|
||||
}
|
||||
|
||||
$update = [
|
||||
'HARGA_DJ' => $harga_dj
|
||||
];
|
||||
|
||||
$action = $this->Penjualan->update('daftar_jual', $update, 'ID_DJ', $id_dj);
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('flashharga', 'ditambah');
|
||||
redirect($_SERVER['HTTP_REFERER']);
|
||||
} else {
|
||||
$this->session->set_flashdata('flashhargagagal', 'ditambah');
|
||||
redirect($_SERVER['HTTP_REFERER']);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function resetharga() {
|
||||
$method = $this->input->post('method');
|
||||
$id_dj = $this->input->post('id');
|
||||
|
||||
$update = [
|
||||
'HARGA_DJ' => NULL
|
||||
];
|
||||
|
||||
$action = $this->Penjualan->update('daftar_jual', $update, 'ID_DJ', $id_dj);
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('flashharga', 'direset');
|
||||
redirect($_SERVER['HTTP_REFERER']);
|
||||
} else {
|
||||
$this->session->set_flashdata('flashhargagagal', 'direset');
|
||||
redirect($_SERVER['HTTP_REFERER']);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function hapuspesanan() {
|
||||
$method = $this->input->post('method');
|
||||
$id_dj = $this->input->post('id');
|
||||
|
||||
$daftar_jual = $this->Penjualan->getDataDaftarJual($id_dj);
|
||||
$id_barang = $daftar_jual[0]['BARANG_ID'];
|
||||
$qty_dj = $daftar_jual[0]['QTY_DJ'];
|
||||
|
||||
$kuantiti = $this->Penjualan->getKuantitiBarang($id_barang);
|
||||
$id_kuantiti = $kuantiti[0]['ID_KUANTITI'];
|
||||
$pcm_kuantiti = $kuantiti[0]['PCM_KUANTITI'];
|
||||
$proses_kuantiti = $kuantiti[0]['PROSES_KUANTITI'];
|
||||
|
||||
$temp = $proses_kuantiti-$qty_dj;
|
||||
$pcm = $pcm_kuantiti+$qty_dj;
|
||||
|
||||
$update = [
|
||||
'PROSES_KUANTITI' => $temp,
|
||||
'PCM_KUANTITI' => $pcm
|
||||
];
|
||||
|
||||
$action = $this->Penjualan->update('kuantiti', $update, 'ID_KUANTITI', $id_kuantiti);
|
||||
|
||||
$action = $this->Penjualan->delete('daftar_jual', $id_dj ,'ID_DJ');
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('flash', 'dihapus');
|
||||
redirect($_SERVER['HTTP_REFERER']);
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'dihapus');
|
||||
redirect($_SERVER['HTTP_REFERER']);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function kodePiutangDagang() {
|
||||
$kk = $this->Penjualan->getKodePDA();
|
||||
if (is_array($kk) || is_object($kk)) {
|
||||
foreach ($kk as $row) {
|
||||
if ($row['KODE'] == null) {
|
||||
return "PDA/000001";
|
||||
} else {
|
||||
$str = (string) $row['KODE'];
|
||||
$panjang = 6;
|
||||
$data = substr($str, 4, $panjang);
|
||||
|
||||
$ko = (int) $data + 1;
|
||||
$str = (string) $ko;
|
||||
|
||||
$panjang = 10 - strlen($str);
|
||||
$data = "PDA/000000";
|
||||
$data = substr($data, 0, $panjang) . $str;
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function konfirmasi() {
|
||||
$method = $this->input->post('method');
|
||||
$id_penjualan = $this->input->post('id_penjualan');
|
||||
$tgl = date('m/d/Y');
|
||||
|
||||
$harga = $this->Penjualan->getPenjualanPesanan($id_penjualan);
|
||||
$tempo_penjualan = $harga[0]['TEMPO_PENJUALAN'];
|
||||
|
||||
foreach ($harga as $key) {
|
||||
if ($key['HARGA_DJ']==NULL) {
|
||||
$this->session->set_flashdata('flashharga', 'diproses');
|
||||
redirect($_SERVER['HTTP_REFERER']);
|
||||
}
|
||||
}
|
||||
|
||||
$nominal_pda='0';
|
||||
foreach ($harga as $key) {
|
||||
$piutang = $key['HARGA_DJ']*$key['QTY_DJ'];
|
||||
$nominal_pda = $nominal_pda+$piutang;
|
||||
}
|
||||
|
||||
$kode_pda = $this->kodePiutangDagang();
|
||||
|
||||
$input = [
|
||||
'KODE_PDA' => $kode_pda,
|
||||
'PENJUALAN_ID' => $id_penjualan,
|
||||
'NOMINAL_PDA' => $nominal_pda,
|
||||
'TGL_PDA' => $tgl,
|
||||
'TEMPO_PDA' => $tempo_penjualan
|
||||
];
|
||||
$action = $this->Penjualan->create('piutang_dagang', $input);
|
||||
|
||||
$id_setdata = $this->Neraca->getSetdata_ID();
|
||||
$id_setdata = $id_setdata[0]['SETDATA_ID'];
|
||||
|
||||
$neraca = $this->Neraca->getDataNilaiNeraca($id_setdata,3);
|
||||
$id_neraca = $neraca[0]['ID_NERACA'];
|
||||
$nilai_neraca = $neraca[0]['NILAI_NERACA'];
|
||||
$nilai = $nilai_neraca+$nominal_pda;
|
||||
$update = [
|
||||
'NILAI_NERACA' => $nilai
|
||||
];
|
||||
$action = $this->Neraca->update('neraca', $update, 'ID_NERACA', $id_neraca);
|
||||
|
||||
$neraca = $this->Neraca->getDataNilaiNeraca($id_setdata,23);
|
||||
$id_neraca = $neraca[0]['ID_NERACA'];
|
||||
$nilai_neraca = $neraca[0]['NILAI_NERACA'];
|
||||
$nilai = $nilai_neraca+$nominal_pda;
|
||||
$update = [
|
||||
'NILAI_NERACA' => $nilai
|
||||
];
|
||||
$action = $this->Neraca->update('neraca', $update, 'ID_NERACA', $id_neraca);
|
||||
|
||||
$update = [
|
||||
'STATUS_PENJUALAN' => '0'
|
||||
];
|
||||
$action = $this->Penjualan->update('penjualan', $update, 'ID_PENJUALAN', $id_penjualan);
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('flash', 'diproses');
|
||||
redirect('ManagePenjualanSO');
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'diproses');
|
||||
redirect('ManagePenjualanSO');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,462 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
class ManagePenjualanTambah extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('ModelSn', 'MSn');
|
||||
$this->load->model('ModelStatusPenjualan', 'MSPenjualan');
|
||||
$this->load->model('ModelPenjualanTambah', 'MPTambah');
|
||||
$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("Login");
|
||||
} elseif ($jabatan != "ADMIN") {
|
||||
redirect("Login");
|
||||
}
|
||||
|
||||
$datSn = $this->MSn->getDataSn();
|
||||
$datSPenjualan = $this->MSPenjualan->getDataSPenjualan();
|
||||
$datPTambah = $this->MPTambah->getDataPTambah();
|
||||
|
||||
$data = [
|
||||
'sidebar' => "data penjualan",
|
||||
'navChild' => "data penjualan tambah",
|
||||
'sn' => $datSn,
|
||||
'spenjualan' => $datSPenjualan,
|
||||
'ptambah' => $datPTambah
|
||||
];
|
||||
|
||||
$this->load->view('penjualan/table-penjualantambah', $data);
|
||||
}
|
||||
|
||||
public function add()
|
||||
{
|
||||
$username = $this->session->userdata('username');
|
||||
if ($username == null) {
|
||||
redirect("Login");
|
||||
}
|
||||
$datSn = $this->MSn->getDataSnBelumLaku();
|
||||
$datPTambah = $this->MPTambah->getDataPTambah();
|
||||
$data = [
|
||||
'sidebar' => "data penjualan",
|
||||
'navChild' => "data penjualan tambah",
|
||||
'sn' => $datSn,
|
||||
'ptambah' => $datPTambah
|
||||
|
||||
];
|
||||
$this->load->view('penjualan/penjualan-tambah', $data);
|
||||
}
|
||||
|
||||
public function add5()
|
||||
{
|
||||
$username = $this->session->userdata('username');
|
||||
if ($username == null) {
|
||||
redirect("Login");
|
||||
}
|
||||
$datSn = $this->MSn->getDataSnBelumLaku();
|
||||
$datPTambah = $this->MPTambah->getDataPTambah();
|
||||
$data = [
|
||||
'sidebar' => "data penjualan",
|
||||
'navChild' => "data penjualan tambah",
|
||||
'sn' => $datSn,
|
||||
'ptambah' => $datPTambah
|
||||
|
||||
];
|
||||
$this->load->view('penjualan/penjualan-tambah5', $data);
|
||||
}
|
||||
|
||||
public function add10()
|
||||
{
|
||||
$username = $this->session->userdata('username');
|
||||
if ($username == null) {
|
||||
redirect("Login");
|
||||
}
|
||||
$datSn = $this->MSn->getDataSnBelumLaku();
|
||||
$datPTambah = $this->MPTambah->getDataPTambah();
|
||||
$data = [
|
||||
'sidebar' => "data penjualan",
|
||||
'navChild' => "data penjualan tambah",
|
||||
'sn' => $datSn,
|
||||
'ptambah' => $datPTambah
|
||||
|
||||
];
|
||||
$this->load->view('penjualan/penjualan-tambah10', $data);
|
||||
}
|
||||
|
||||
public function save()
|
||||
{
|
||||
$method = $this->input->post('method');
|
||||
$tgl_penjualan = $this->input->post('tgl_penjualan');
|
||||
$nama_customer = $this->input->post('nama_customer');
|
||||
$no_sn = $this->input->post('no_sn');
|
||||
|
||||
$this->form_validation->set_rules('tgl_penjualan', 'Tanggal Penjualan', 'required');
|
||||
$this->form_validation->set_rules('nama_customer', 'Nama Customer', 'required');
|
||||
$this->form_validation->set_rules('no_sn', 'Serial Number', 'required');
|
||||
|
||||
if ($this->form_validation->run() == FALSE) {
|
||||
$data = [
|
||||
'status' => false,
|
||||
'errors' => [
|
||||
'tgl_penjualan' => form_error('tgl_penjualan'),
|
||||
'nama_customer' => form_error('nama_customer'),
|
||||
'no_sn' => form_error('no_sn')
|
||||
]
|
||||
];
|
||||
$this->output_json($data);
|
||||
} else {
|
||||
$input = [
|
||||
'TGL_PENJUALAN' => $tgl_penjualan,
|
||||
'NAMA_CUSTOMER' => $nama_customer,
|
||||
'ID_SN' => $no_sn
|
||||
];
|
||||
|
||||
$input2 = [
|
||||
'ID_SN' => $no_sn,
|
||||
'ID_STATUSPENJUALAN' => '2'
|
||||
];
|
||||
|
||||
$action = $this->MPTambah->create('penjualan', $input);
|
||||
$action = $this->MSn->update('sn', $input2, 'ID_SN', $no_sn);
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('flash', 'ditambah');
|
||||
redirect('ManagePenjualanTambah');
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'ditambah');
|
||||
redirect('ManagePenjualanTambah');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function save5()
|
||||
{
|
||||
$method = $this->input->post('method');
|
||||
$tgl_penjualan = $this->input->post('tgl_penjualan');
|
||||
$nama_customer = $this->input->post('nama_customer');
|
||||
$no_sn1 = $this->input->post('no_sn1');
|
||||
$no_sn2 = $this->input->post('no_sn2');
|
||||
$no_sn3 = $this->input->post('no_sn3');
|
||||
$no_sn4 = $this->input->post('no_sn4');
|
||||
$no_sn5 = $this->input->post('no_sn5');
|
||||
|
||||
$this->form_validation->set_rules('tgl_penjualan', 'Tanggal Penjualan', 'required');
|
||||
$this->form_validation->set_rules('nama_customer', 'Nama Customer', 'required');
|
||||
$this->form_validation->set_rules('no_sn1', 'Serial Number 1', 'required');
|
||||
$this->form_validation->set_rules('no_sn2', 'Serial Number 2', 'required');
|
||||
$this->form_validation->set_rules('no_sn3', 'Serial Number 3', 'required');
|
||||
$this->form_validation->set_rules('no_sn4', 'Serial Number 4', 'required');
|
||||
$this->form_validation->set_rules('no_sn5', 'Serial Number 5', 'required');
|
||||
|
||||
if ($this->form_validation->run() == FALSE) {
|
||||
$data = [
|
||||
'status' => false,
|
||||
'errors' => [
|
||||
'tgl_penjualan' => form_error('tgl_penjualan'),
|
||||
'nama_customer' => form_error('nama_customer'),
|
||||
'no_sn1' => form_error('no_sn1'),
|
||||
'no_sn2' => form_error('no_sn2'),
|
||||
'no_sn3' => form_error('no_sn3'),
|
||||
'no_sn4' => form_error('no_sn4'),
|
||||
'no_sn5' => form_error('no_sn5')
|
||||
]
|
||||
];
|
||||
$this->output_json($data);
|
||||
} else {
|
||||
|
||||
$inputPenjualan1 = [
|
||||
'TGL_PENJUALAN' => $tgl_penjualan,
|
||||
'NAMA_CUSTOMER' => $nama_customer,
|
||||
'ID_SN' => $no_sn1
|
||||
];
|
||||
|
||||
$inputPenjualan2 = [
|
||||
'TGL_PENJUALAN' => $tgl_penjualan,
|
||||
'NAMA_CUSTOMER' => $nama_customer,
|
||||
'ID_SN' => $no_sn2
|
||||
];
|
||||
|
||||
$inputPenjualan3 = [
|
||||
'TGL_PENJUALAN' => $tgl_penjualan,
|
||||
'NAMA_CUSTOMER' => $nama_customer,
|
||||
'ID_SN' => $no_sn3
|
||||
];
|
||||
|
||||
$inputPenjualan4 = [
|
||||
'TGL_PENJUALAN' => $tgl_penjualan,
|
||||
'NAMA_CUSTOMER' => $nama_customer,
|
||||
'ID_SN' => $no_sn4
|
||||
];
|
||||
|
||||
$inputPenjualan5 = [
|
||||
'TGL_PENJUALAN' => $tgl_penjualan,
|
||||
'NAMA_CUSTOMER' => $nama_customer,
|
||||
'ID_SN' => $no_sn5
|
||||
];
|
||||
|
||||
$inputStatus1 = [
|
||||
'ID_SN' => $no_sn1,
|
||||
'ID_STATUSPENJUALAN' => '2'
|
||||
];
|
||||
|
||||
$inputStatus2 = [
|
||||
'ID_SN' => $no_sn2,
|
||||
'ID_STATUSPENJUALAN' => '2'
|
||||
];
|
||||
|
||||
$inputStatus3 = [
|
||||
'ID_SN' => $no_sn3,
|
||||
'ID_STATUSPENJUALAN' => '2'
|
||||
];
|
||||
|
||||
$inputStatus4 = [
|
||||
'ID_SN' => $no_sn4,
|
||||
'ID_STATUSPENJUALAN' => '2'
|
||||
];
|
||||
|
||||
$inputStatus5 = [
|
||||
'ID_SN' => $no_sn5,
|
||||
'ID_STATUSPENJUALAN' => '2'
|
||||
];
|
||||
|
||||
$action = $this->MPTambah->create('penjualan', $inputPenjualan1);
|
||||
$action = $this->MPTambah->create('penjualan', $inputPenjualan2);
|
||||
$action = $this->MPTambah->create('penjualan', $inputPenjualan3);
|
||||
$action = $this->MPTambah->create('penjualan', $inputPenjualan4);
|
||||
$action = $this->MPTambah->create('penjualan', $inputPenjualan5);
|
||||
$action = $this->MSn->update('sn', $inputStatus1, 'ID_SN', $no_sn1);
|
||||
$action = $this->MSn->update('sn', $inputStatus2, 'ID_SN', $no_sn2);
|
||||
$action = $this->MSn->update('sn', $inputStatus3, 'ID_SN', $no_sn3);
|
||||
$action = $this->MSn->update('sn', $inputStatus4, 'ID_SN', $no_sn4);
|
||||
$action = $this->MSn->update('sn', $inputStatus5, 'ID_SN', $no_sn5);
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('flash', 'ditambah');
|
||||
redirect('ManagePenjualanTambah');
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'ditambah');
|
||||
redirect('ManagePenjualanTambah');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function save10()
|
||||
{
|
||||
$method = $this->input->post('method');
|
||||
$tgl_penjualan = $this->input->post('tgl_penjualan');
|
||||
$nama_customer = $this->input->post('nama_customer');
|
||||
$no_sn1 = $this->input->post('no_sn1');
|
||||
$no_sn2 = $this->input->post('no_sn2');
|
||||
$no_sn3 = $this->input->post('no_sn3');
|
||||
$no_sn4 = $this->input->post('no_sn4');
|
||||
$no_sn5 = $this->input->post('no_sn5');
|
||||
$no_sn6 = $this->input->post('no_sn6');
|
||||
$no_sn7 = $this->input->post('no_sn7');
|
||||
$no_sn8 = $this->input->post('no_sn8');
|
||||
$no_sn9 = $this->input->post('no_sn9');
|
||||
$no_sn10 = $this->input->post('no_sn10');
|
||||
|
||||
$this->form_validation->set_rules('tgl_penjualan', 'Tanggal Penjualan', 'required');
|
||||
$this->form_validation->set_rules('nama_customer', 'Nama Customer', 'required');
|
||||
$this->form_validation->set_rules('no_sn1', 'Serial Number 1', 'required');
|
||||
$this->form_validation->set_rules('no_sn2', 'Serial Number 2', 'required');
|
||||
$this->form_validation->set_rules('no_sn3', 'Serial Number 3', 'required');
|
||||
$this->form_validation->set_rules('no_sn4', 'Serial Number 4', 'required');
|
||||
$this->form_validation->set_rules('no_sn5', 'Serial Number 5', 'required');
|
||||
$this->form_validation->set_rules('no_sn6', 'Serial Number 6', 'required');
|
||||
$this->form_validation->set_rules('no_sn7', 'Serial Number 7', 'required');
|
||||
$this->form_validation->set_rules('no_sn8', 'Serial Number 8', 'required');
|
||||
$this->form_validation->set_rules('no_sn9', 'Serial Number 9', 'required');
|
||||
$this->form_validation->set_rules('no_sn10', 'Serial Number 10', 'required');
|
||||
|
||||
if ($this->form_validation->run() == FALSE) {
|
||||
$data = [
|
||||
'status' => false,
|
||||
'errors' => [
|
||||
'tgl_penjualan' => form_error('tgl_penjualan'),
|
||||
'nama_customer' => form_error('nama_customer'),
|
||||
'no_sn1' => form_error('no_sn1'),
|
||||
'no_sn2' => form_error('no_sn2'),
|
||||
'no_sn3' => form_error('no_sn3'),
|
||||
'no_sn4' => form_error('no_sn4'),
|
||||
'no_sn5' => form_error('no_sn5'),
|
||||
'no_sn6' => form_error('no_sn6'),
|
||||
'no_sn7' => form_error('no_sn7'),
|
||||
'no_sn8' => form_error('no_sn8'),
|
||||
'no_sn9' => form_error('no_sn9'),
|
||||
'no_sn10' => form_error('no_sn10')
|
||||
]
|
||||
];
|
||||
$this->output_json($data);
|
||||
} else {
|
||||
|
||||
$inputPenjualan1 = [
|
||||
'TGL_PENJUALAN' => $tgl_penjualan,
|
||||
'NAMA_CUSTOMER' => $nama_customer,
|
||||
'ID_SN' => $no_sn1
|
||||
];
|
||||
|
||||
$inputPenjualan2 = [
|
||||
'TGL_PENJUALAN' => $tgl_penjualan,
|
||||
'NAMA_CUSTOMER' => $nama_customer,
|
||||
'ID_SN' => $no_sn2
|
||||
];
|
||||
|
||||
$inputPenjualan3 = [
|
||||
'TGL_PENJUALAN' => $tgl_penjualan,
|
||||
'NAMA_CUSTOMER' => $nama_customer,
|
||||
'ID_SN' => $no_sn3
|
||||
];
|
||||
|
||||
$inputPenjualan4 = [
|
||||
'TGL_PENJUALAN' => $tgl_penjualan,
|
||||
'NAMA_CUSTOMER' => $nama_customer,
|
||||
'ID_SN' => $no_sn4
|
||||
];
|
||||
|
||||
$inputPenjualan5 = [
|
||||
'TGL_PENJUALAN' => $tgl_penjualan,
|
||||
'NAMA_CUSTOMER' => $nama_customer,
|
||||
'ID_SN' => $no_sn5
|
||||
];
|
||||
|
||||
$inputPenjualan6 = [
|
||||
'TGL_PENJUALAN' => $tgl_penjualan,
|
||||
'NAMA_CUSTOMER' => $nama_customer,
|
||||
'ID_SN' => $no_sn6
|
||||
];
|
||||
|
||||
$inputPenjualan7 = [
|
||||
'TGL_PENJUALAN' => $tgl_penjualan,
|
||||
'NAMA_CUSTOMER' => $nama_customer,
|
||||
'ID_SN' => $no_sn7
|
||||
];
|
||||
|
||||
$inputPenjualan8 = [
|
||||
'TGL_PENJUALAN' => $tgl_penjualan,
|
||||
'NAMA_CUSTOMER' => $nama_customer,
|
||||
'ID_SN' => $no_sn8
|
||||
];
|
||||
|
||||
$inputPenjualan9 = [
|
||||
'TGL_PENJUALAN' => $tgl_penjualan,
|
||||
'NAMA_CUSTOMER' => $nama_customer,
|
||||
'ID_SN' => $no_sn9
|
||||
];
|
||||
|
||||
$inputPenjualan10 = [
|
||||
'TGL_PENJUALAN' => $tgl_penjualan,
|
||||
'NAMA_CUSTOMER' => $nama_customer,
|
||||
'ID_SN' => $no_sn10
|
||||
];
|
||||
|
||||
$inputStatus1 = [
|
||||
'ID_SN' => $no_sn1,
|
||||
'ID_STATUSPENJUALAN' => '2'
|
||||
];
|
||||
|
||||
$inputStatus2 = [
|
||||
'ID_SN' => $no_sn2,
|
||||
'ID_STATUSPENJUALAN' => '2'
|
||||
];
|
||||
|
||||
$inputStatus3 = [
|
||||
'ID_SN' => $no_sn3,
|
||||
'ID_STATUSPENJUALAN' => '2'
|
||||
];
|
||||
|
||||
$inputStatus4 = [
|
||||
'ID_SN' => $no_sn4,
|
||||
'ID_STATUSPENJUALAN' => '2'
|
||||
];
|
||||
|
||||
$inputStatus5 = [
|
||||
'ID_SN' => $no_sn5,
|
||||
'ID_STATUSPENJUALAN' => '2'
|
||||
];
|
||||
|
||||
$inputStatus6 = [
|
||||
'ID_SN' => $no_sn6,
|
||||
'ID_STATUSPENJUALAN' => '2'
|
||||
];
|
||||
|
||||
$inputStatus7 = [
|
||||
'ID_SN' => $no_sn7,
|
||||
'ID_STATUSPENJUALAN' => '2'
|
||||
];
|
||||
|
||||
$inputStatus8 = [
|
||||
'ID_SN' => $no_sn8,
|
||||
'ID_STATUSPENJUALAN' => '2'
|
||||
];
|
||||
|
||||
$inputStatus9 = [
|
||||
'ID_SN' => $no_sn9,
|
||||
'ID_STATUSPENJUALAN' => '2'
|
||||
];
|
||||
|
||||
$inputStatus10 = [
|
||||
'ID_SN' => $no_sn10,
|
||||
'ID_STATUSPENJUALAN' => '2'
|
||||
];
|
||||
|
||||
$action = $this->MPTambah->create('penjualan', $inputPenjualan1);
|
||||
$action = $this->MPTambah->create('penjualan', $inputPenjualan2);
|
||||
$action = $this->MPTambah->create('penjualan', $inputPenjualan3);
|
||||
$action = $this->MPTambah->create('penjualan', $inputPenjualan4);
|
||||
$action = $this->MPTambah->create('penjualan', $inputPenjualan5);
|
||||
$action = $this->MPTambah->create('penjualan', $inputPenjualan6);
|
||||
$action = $this->MPTambah->create('penjualan', $inputPenjualan7);
|
||||
$action = $this->MPTambah->create('penjualan', $inputPenjualan8);
|
||||
$action = $this->MPTambah->create('penjualan', $inputPenjualan9);
|
||||
$action = $this->MPTambah->create('penjualan', $inputPenjualan10);
|
||||
$action = $this->MSn->update('sn', $inputStatus1, 'ID_SN', $no_sn1);
|
||||
$action = $this->MSn->update('sn', $inputStatus2, 'ID_SN', $no_sn2);
|
||||
$action = $this->MSn->update('sn', $inputStatus3, 'ID_SN', $no_sn3);
|
||||
$action = $this->MSn->update('sn', $inputStatus4, 'ID_SN', $no_sn4);
|
||||
$action = $this->MSn->update('sn', $inputStatus5, 'ID_SN', $no_sn5);
|
||||
$action = $this->MSn->update('sn', $inputStatus6, 'ID_SN', $no_sn6);
|
||||
$action = $this->MSn->update('sn', $inputStatus7, 'ID_SN', $no_sn7);
|
||||
$action = $this->MSn->update('sn', $inputStatus8, 'ID_SN', $no_sn8);
|
||||
$action = $this->MSn->update('sn', $inputStatus9, 'ID_SN', $no_sn9);
|
||||
$action = $this->MSn->update('sn', $inputStatus10, 'ID_SN', $no_sn10);
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('flash', 'ditambah');
|
||||
redirect('ManagePenjualanTambah');
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'ditambah');
|
||||
redirect('ManagePenjualanTambah');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function hapus()
|
||||
{
|
||||
$id = $this->input->post('id');
|
||||
$no_sn = $this->input->post('no_sn');
|
||||
if ($this->MPenjualan->delete('penjualan', $id, 'ID_PENJUALAN')) {
|
||||
$inputStatus = [
|
||||
'ID_SN' => $no_sn,
|
||||
'ID_STATUSPENJUALAN' => '1'
|
||||
];
|
||||
$action = $this->MSn->update('sn', $inputStatus, 'ID_SN', $no_sn);
|
||||
$this->session->set_flashdata('flash', 'dihapus');
|
||||
redirect('ManagePenjualan');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,77 @@
|
||||
<?php
|
||||
|
||||
use Restserver\Libraries\REST_Controller;
|
||||
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
require APPPATH . 'libraries/REST_Controller.php';
|
||||
require APPPATH . 'libraries/Format.php';
|
||||
|
||||
class ManagePiutangDagang extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('ModelPiutangDagang', 'PiutangDagang');
|
||||
$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()
|
||||
{
|
||||
|
||||
$datPiutangDagang = $this->PiutangDagang->getDataPiutangDagang();
|
||||
|
||||
$data = [
|
||||
'sidebar' => "menu accounting",
|
||||
'navChild' => "",
|
||||
'piutangdagang' => $datPiutangDagang
|
||||
];
|
||||
|
||||
$this->load->view('proses/PiutangDagang', $data);
|
||||
}
|
||||
|
||||
public function konfirmasi()
|
||||
{
|
||||
$method = $this->input->post('method');
|
||||
$id_pda = $this->input->post('id_pda');
|
||||
|
||||
$update = [
|
||||
'STATUS_PDA' => "LUNAS"
|
||||
];
|
||||
|
||||
$action = $this->PiutangDagang->update('piutang_dagang', $update, 'ID_PDA', $id_pda);
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('flash', 'dikunci');
|
||||
redirect('ManagePiutangDagang');
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'dikunci');
|
||||
redirect('ManagePiutangDagang');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function viewDeskripsi($id)
|
||||
{
|
||||
$deskripsi = $this->PiutangDagang->getDataDeskripsiPDA($id);
|
||||
$title = $this->PiutangDagang->getTitlePDA($id);
|
||||
|
||||
$data = [
|
||||
'sidebar' => "menu accounting",
|
||||
'navChild' => "",
|
||||
'deskripsi' => $deskripsi,
|
||||
'id_pda' => $id,
|
||||
'title1' => $title[0]['KODE_PDA'],
|
||||
'title2' => $title[0]['DEBIT'],
|
||||
'title3' => $title[0]['KREDIT']
|
||||
];
|
||||
|
||||
$this->load->view('proses/DeskripsiPDA', $data);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
<?php
|
||||
|
||||
use Restserver\Libraries\REST_Controller;
|
||||
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
require APPPATH . 'libraries/REST_Controller.php';
|
||||
require APPPATH . 'libraries/Format.php';
|
||||
|
||||
class ManagePiutangKaryawan extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('ModelPiutangKaryawan', 'PiutangKaryawan');
|
||||
$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()
|
||||
{
|
||||
|
||||
$datPiutangKaryawan = $this->PiutangKaryawan->getDataPiutangKaryawan();
|
||||
|
||||
$data = [
|
||||
'sidebar' => "menu accounting",
|
||||
'navChild' => "",
|
||||
'piutangkaryawan' => $datPiutangKaryawan
|
||||
];
|
||||
|
||||
$this->load->view('proses/PiutangKaryawan', $data);
|
||||
}
|
||||
|
||||
public function konfirmasi()
|
||||
{
|
||||
$method = $this->input->post('method');
|
||||
$id_pkar = $this->input->post('id_pkar');
|
||||
|
||||
$update = [
|
||||
'STATUS_PKAR' => "LUNAS"
|
||||
];
|
||||
|
||||
$action = $this->PiutangKaryawan->update('piutang_karyawan', $update, 'ID_PKAR', $id_pkar);
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('flash', 'dikunci');
|
||||
redirect('ManagePiutangKaryawan');
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'dikunci');
|
||||
redirect('ManagePiutangKaryawan');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function viewDeskripsi($id)
|
||||
{
|
||||
$deskripsi = $this->PiutangKaryawan->getDataDeskripsiPKAR($id);
|
||||
$title = $this->PiutangKaryawan->getTitlePKAR($id);
|
||||
|
||||
$data = [
|
||||
'sidebar' => "menu accounting",
|
||||
'navChild' => "",
|
||||
'deskripsi' => $deskripsi,
|
||||
'id_pkar' => $id,
|
||||
'title1' => $title[0]['KODE_PKAR'],
|
||||
'title2' => $title[0]['DEBIT'],
|
||||
'title3' => $title[0]['KREDIT']
|
||||
];
|
||||
|
||||
$this->load->view('proses/DeskripsiPKAR', $data);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
<?php
|
||||
|
||||
use Restserver\Libraries\REST_Controller;
|
||||
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
require APPPATH . 'libraries/REST_Controller.php';
|
||||
require APPPATH . 'libraries/Format.php';
|
||||
|
||||
class ManagePiutangPihakKe3 extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('ModelPiutangPihakKe3', 'PiutangPihakKe3');
|
||||
$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);
|
||||
}
|
||||
|
||||
//Step One, Input Piutang PihakKe3
|
||||
public function index()
|
||||
{
|
||||
|
||||
$datPiutangPihakKe3 = $this->PiutangPihakKe3->getDataPiutangPihakKe3();
|
||||
|
||||
$data = [
|
||||
'sidebar' => "menu accounting",
|
||||
'navChild' => "",
|
||||
'piutangpihakke3' => $datPiutangPihakKe3
|
||||
];
|
||||
|
||||
$this->load->view('proses/PiutangPihakKe3', $data);
|
||||
}
|
||||
|
||||
public function konfirmasi()
|
||||
{
|
||||
$method = $this->input->post('method');
|
||||
$id_ppi = $this->input->post('id_ppi');
|
||||
|
||||
$update = [
|
||||
'STATUS_PPI' => "LUNAS"
|
||||
];
|
||||
|
||||
$action = $this->PiutangPihakKe3->update('piutang_pihakke3', $update, 'ID_PPI', $id_ppi);
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('flash', 'dikunci');
|
||||
redirect('ManagePiutangPihakKe3');
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'dikunci');
|
||||
redirect('ManagePiutangPihakKe3');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//Step Two, View Deskripsi
|
||||
public function viewDeskripsi($id)
|
||||
{
|
||||
$deskripsi = $this->PiutangPihakKe3->getDataDeskripsiPPI($id);
|
||||
$title = $this->PiutangPihakKe3->getTitlePPI($id);
|
||||
|
||||
$data = [
|
||||
'sidebar' => "menu accounting",
|
||||
'navChild' => "",
|
||||
'deskripsi' => $deskripsi,
|
||||
'id_ppi' => $id,
|
||||
'title1' => $title[0]['KODE_PPI'],
|
||||
'title2' => $title[0]['DEBIT'],
|
||||
'title3' => $title[0]['KREDIT']
|
||||
];
|
||||
|
||||
$this->load->view('proses/DeskripsiPPI', $data);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
class ManageProcessor extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('ModelProcessor', '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()
|
||||
{
|
||||
|
||||
$datProcessor = $this->MP->getDataProcessor();
|
||||
|
||||
$data = [
|
||||
'sidebar' => "master data",
|
||||
'navChild' => "",
|
||||
'processor' => $datProcessor
|
||||
];
|
||||
|
||||
$this->load->view('master/Processor', $data);
|
||||
}
|
||||
|
||||
public function save()
|
||||
{
|
||||
$method = $this->input->post('method');
|
||||
$id_processor = $this->input->post('id');
|
||||
$nama_processor = $this->input->post('nama_processor');
|
||||
|
||||
$input = [
|
||||
'NAMA_PROCESSOR' => $nama_processor
|
||||
];
|
||||
|
||||
$action = $this->MP->create('processor', $input);
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('flash', 'ditambah');
|
||||
redirect('ManageProcessor');
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'ditambah');
|
||||
redirect('ManageProcessor');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function edit()
|
||||
{
|
||||
$method = $this->input->post('method');
|
||||
$id_processor = $this->input->post('id_processor');
|
||||
$nama_processor = $this->input->post('nama_processored');
|
||||
|
||||
$update = [
|
||||
'NAMA_PROCESSOR' => $nama_processor
|
||||
];
|
||||
|
||||
$action = $this->MP->update('processor', $update,'ID_PROCESSOR',$id_processor);
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('flash', 'diedit');
|
||||
redirect('ManageProcessor');
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'diedit');
|
||||
redirect('ManageProcessor');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function hapus()
|
||||
{
|
||||
$id = $this->input->post('id');
|
||||
if ($this->MP->delete('processor', $id, 'ID_PROCESSOR')) {
|
||||
$action = $this ->MP->delete('processor',$id,'ID_PROCESSOR');
|
||||
$this->session->set_flashdata('flash', 'dihapus');
|
||||
redirect('ManageProcessor');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,134 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
class ManageProgress 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()
|
||||
{
|
||||
$username = $this->session->userdata('username');
|
||||
$jabatan = $this->session->userdata('jabatan');
|
||||
if ($username == null) {
|
||||
redirect("Authority");
|
||||
} elseif ($jabatan != "ADMIN") {
|
||||
redirect("Authority");
|
||||
}
|
||||
|
||||
$datProgress = $this->MP->getDataProgressView();
|
||||
$datService = $this->MS->getDataService();
|
||||
$datTeknisi = $this->MT->getDataTeknisi();
|
||||
|
||||
$data = [
|
||||
'sidebar' => "data proses service",
|
||||
'navChild' => "data proses pengerjaan",
|
||||
'progress' => $datProgress,
|
||||
'service' => $datService,
|
||||
'teknisi' => $datTeknisi
|
||||
];
|
||||
|
||||
$this->load->view('master/Progress', $data);
|
||||
}
|
||||
|
||||
public function add()
|
||||
{
|
||||
$username = $this->session->userdata('username');
|
||||
$jabatan = $this->session->userdata('jabatan');
|
||||
if ($username == null) {
|
||||
redirect("Action");
|
||||
} elseif ($jabatan != "ADMIN") {
|
||||
redirect("Action");
|
||||
}
|
||||
|
||||
$datProgress = $this->MP->getDataProgress();
|
||||
$datService = $this->MS->getDataServiceNull();
|
||||
$datTeknisi = $this->MT->getDataTeknisi();
|
||||
|
||||
$data = [
|
||||
'sidebar' => "data proses service",
|
||||
'navChild' => "data proses pengerjaan",
|
||||
'progress' => $datProgress,
|
||||
'service' => $datService,
|
||||
'teknisi' => $datTeknisi
|
||||
];
|
||||
|
||||
$this->load->view('proses/UpdateService', $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');
|
||||
|
||||
$input = [
|
||||
'TEKNISI_ID' => $id_teknisi,
|
||||
'STATUS_PROGRESS' => $status_progress,
|
||||
'KERUSAKAN_PROGRESS' => $kerusakan_progress,
|
||||
'TANGGAL_PROGRESS' => date('Y-m-d H:i:s')
|
||||
];
|
||||
|
||||
$action = $this->MP->update('progress', $input,'ID_PROGRESS',$id_progress);
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('flash', 'ditambah');
|
||||
redirect('ManageProgress');
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'ditambah');
|
||||
redirect('ManageProgress');
|
||||
}
|
||||
}
|
||||
|
||||
public function save()
|
||||
{
|
||||
$method = $this->input->post('method');
|
||||
$id_progress = $this->input->post('id');
|
||||
$id_service = $this->input->post('id_service');
|
||||
$id_teknisi = $this->input->post('id_teknisi');
|
||||
$status_progress = $this->input->post('status_progress');
|
||||
$kerusakan_progress = $this->input->post('kerusakan_progress');
|
||||
|
||||
$input = [
|
||||
'TEKNISI_ID' => $id_teknisi,
|
||||
'STATUS_PROGRESS' => $status_progress,
|
||||
'KERUSAKAN_PROGRESS' => $kerusakan_progress,
|
||||
'TANGGAL_PROGRESS' => date('Y-m-d H:i:s')
|
||||
];
|
||||
|
||||
$action = $this->MP->create('progress', $input);
|
||||
|
||||
$datID = $this->MP->getDataProgressID();
|
||||
|
||||
if (is_array($datID)||is_object($$datID)) {
|
||||
$update = [
|
||||
'PROGRESS_ID' => $datID[0]['ID_PROGRESS']
|
||||
];
|
||||
$actionupdate = $this->MS->update('service', $update, 'ID_SERVICE',$id_service);
|
||||
}
|
||||
|
||||
if ($actionupdate) {
|
||||
$this->session->set_flashdata('flash', 'ditambah');
|
||||
redirect('ManageProgress');
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'ditambah');
|
||||
redirect('ManageProgress');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
class ManagePromo extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('ModelPromo', 'MPromo');
|
||||
$this->load->model('ModelInvoice', 'MInvoice');
|
||||
$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("Login");
|
||||
} elseif ($jabatan != "ADMIN") {
|
||||
redirect("Login");
|
||||
}
|
||||
|
||||
$datPromo = $this->MPromo->getDataPromo();
|
||||
|
||||
$data = [
|
||||
'sidebar' => "data master",
|
||||
'navChild' => "data promo",
|
||||
'promo' => $datPromo
|
||||
];
|
||||
|
||||
$this->load->view('promo/table-promo', $data);
|
||||
}
|
||||
|
||||
public function add()
|
||||
{
|
||||
$username = $this->session->userdata('username');
|
||||
if ($username == null) {
|
||||
redirect("Login");
|
||||
}
|
||||
$datPromo = $this->MPromo->getDataPromo();
|
||||
$datInvoice = $this->MInvoice->getDataInvoice();
|
||||
$data = [
|
||||
'sidebar' => "data master",
|
||||
'navChild' => "data promo",
|
||||
'invoice' => $datInvoice,
|
||||
'promo' => $datPromo
|
||||
|
||||
];
|
||||
$this->load->view('promo/promo-tambah', $data);
|
||||
}
|
||||
|
||||
public function save()
|
||||
{
|
||||
$method = $this->input->post('method');
|
||||
$nama_promo = $this->input->post('nama_promo');
|
||||
$tgl_promo = $this->input->post('tgl_promo');
|
||||
$potongan = $this->input->post('potongan');
|
||||
$no_invoice = $this->input->post('no_invoice');
|
||||
|
||||
$this->form_validation->set_rules('nama_promo', 'Nama Promo', 'required');
|
||||
$this->form_validation->set_rules('tgl_promo', 'Tanggal Promo', 'required');
|
||||
$this->form_validation->set_rules('potongan', 'Potongan', 'required');
|
||||
$this->form_validation->set_rules('no_invoice', 'Nomor Invoice', 'required');
|
||||
|
||||
if ($this->form_validation->run() == FALSE) {
|
||||
$data = [
|
||||
'status' => false,
|
||||
'errors' => [
|
||||
'nama_promo' => form_error('nama_promo'),
|
||||
'tgl_promo' => form_error('tgl_promo'),
|
||||
'potongan' => form_error('potongan'),
|
||||
'no_invoice' => form_error('no_invoice')
|
||||
]
|
||||
];
|
||||
$this->output_json($data);
|
||||
} else {
|
||||
$input = [
|
||||
'NAMA_PROMO' => $nama_promo,
|
||||
'TGL_PROMO' => $tgl_promo,
|
||||
'POTONGAN' => $potongan,
|
||||
'ID_INVOICE' => $no_invoice
|
||||
];
|
||||
|
||||
$action = $this->MPromo->create('promo', $input);
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('flash', 'ditambah');
|
||||
redirect('ManagePromo');
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'ditambah');
|
||||
redirect('ManagePromo');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function hapus()
|
||||
{
|
||||
$id = $this->input->post('id');
|
||||
if ($this->MPromo->delete('promo', $id, 'ID_PROMO')) {
|
||||
$this->session->set_flashdata('flash', 'dihapus');
|
||||
redirect('ManagePromo');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
class ManageRaid extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('ModelRaid', 'MR');
|
||||
$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()
|
||||
{
|
||||
|
||||
$datRaid = $this->MR->getDataRaid();
|
||||
|
||||
$data = [
|
||||
'sidebar' => "master data",
|
||||
'navChild' => "",
|
||||
'raid' => $datRaid
|
||||
];
|
||||
|
||||
$this->load->view('master/Raid', $data);
|
||||
}
|
||||
|
||||
public function save()
|
||||
{
|
||||
$method = $this->input->post('method');
|
||||
$id_raid = $this->input->post('id');
|
||||
$nama_raid = $this->input->post('nama_raid');
|
||||
|
||||
$input = [
|
||||
'NAMA_RAID' => $nama_raid
|
||||
];
|
||||
|
||||
$action = $this->MR->create('raid', $input);
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('flash', 'ditambah');
|
||||
redirect('ManageRaid');
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'ditambah');
|
||||
redirect('ManageRaid');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function edit()
|
||||
{
|
||||
$method = $this->input->post('method');
|
||||
$id_raid = $this->input->post('id_raid');
|
||||
$nama_raid = $this->input->post('nama_raided');
|
||||
|
||||
$update = [
|
||||
'NAMA_RAID' => $nama_raid
|
||||
];
|
||||
|
||||
$action = $this->MR->update('raid', $update,'ID_RAID',$id_raid);
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('flash', 'diedit');
|
||||
redirect('ManageRaid');
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'diedit');
|
||||
redirect('ManageRaid');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function hapus()
|
||||
{
|
||||
$id = $this->input->post('id');
|
||||
if ($this->MR->delete('raid', $id, 'ID_RAID')) {
|
||||
$action = $this ->MR->delete('raid',$id,'ID_RAID');
|
||||
$this->session->set_flashdata('flash', 'dihapus');
|
||||
redirect('ManageRaid');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
class ManageRam extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('ModelRam', 'MR');
|
||||
$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()
|
||||
{
|
||||
|
||||
$datRam = $this->MR->getDataRam();
|
||||
|
||||
$data = [
|
||||
'sidebar' => "master data",
|
||||
'navChild' => "",
|
||||
'ram' => $datRam
|
||||
];
|
||||
|
||||
$this->load->view('master/Ram', $data);
|
||||
}
|
||||
|
||||
public function save()
|
||||
{
|
||||
$method = $this->input->post('method');
|
||||
$id_ram = $this->input->post('id');
|
||||
$nama_ram = $this->input->post('nama_ram');
|
||||
|
||||
$input = [
|
||||
'NAMA_RAM' => $nama_ram
|
||||
];
|
||||
|
||||
$action = $this->MR->create('ram', $input);
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('flash', 'ditambah');
|
||||
redirect('ManageRam');
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'ditambah');
|
||||
redirect('ManageRam');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function edit()
|
||||
{
|
||||
$method = $this->input->post('method');
|
||||
$id_ram = $this->input->post('id_ram');
|
||||
$nama_ram = $this->input->post('nama_ramed');
|
||||
|
||||
$update = [
|
||||
'NAMA_RAM' => $nama_ram
|
||||
];
|
||||
|
||||
$action = $this->MR->update('ram', $update,'ID_RAM',$id_ram);
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('flash', 'diedit');
|
||||
redirect('ManageRam');
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'diedit');
|
||||
redirect('ManageRam');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function hapus()
|
||||
{
|
||||
$id = $this->input->post('id');
|
||||
if ($this->MR->delete('ram', $id, 'ID_RAM')) {
|
||||
$action = $this ->MR->delete('ram',$id,'ID_RAM');
|
||||
$this->session->set_flashdata('flash', 'dihapus');
|
||||
redirect('ManageRam');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
class ManageRelasi extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('ModelRelasi', 'MR');
|
||||
$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()
|
||||
{
|
||||
|
||||
$datRelasi = $this->MR->getDataRelasi();
|
||||
|
||||
$data = [
|
||||
'sidebar' => "master data",
|
||||
'navChild' => "",
|
||||
'relasi' => $datRelasi
|
||||
];
|
||||
|
||||
$this->load->view('master/Relasi', $data);
|
||||
}
|
||||
|
||||
public function save()
|
||||
{
|
||||
$method = $this->input->post('method');
|
||||
$id_relasi = $this->input->post('id');
|
||||
$nama_relasi = $this->input->post('nama_relasi');
|
||||
$kode_relasi = $this->input->post('kode_relasi');
|
||||
|
||||
$input = [
|
||||
'NAMA_RELASI' => $nama_relasi,
|
||||
'KODE_RELASI' => $kode_relasi
|
||||
];
|
||||
|
||||
$action = $this->MR->create('relasi', $input);
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('flash', 'ditambah');
|
||||
redirect('ManageRelasi');
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'ditambah');
|
||||
redirect('ManageRelasi');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function edit()
|
||||
{
|
||||
$method = $this->input->post('method');
|
||||
$id_relasi = $this->input->post('id_relasi');
|
||||
$nama_relasi = $this->input->post('nama_relasied');
|
||||
$kode_relasi = $this->input->post('kode_relasied');
|
||||
|
||||
$update = [
|
||||
'NAMA_RELASI' => $nama_relasi,
|
||||
'KODE_RELASI' => $kode_relasi
|
||||
];
|
||||
|
||||
$action = $this->MR->update('relasi', $update,'ID_RELASI',$id_relasi);
|
||||
|
||||
if ($action) {
|
||||
$this->session->set_flashdata('flash', 'diedit');
|
||||
redirect('ManageRelasi');
|
||||
} else {
|
||||
$this->session->set_flashdata('flashgagal', 'diedit');
|
||||
redirect('ManageRelasi');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function hapus()
|
||||
{
|
||||
$id = $this->input->post('id');
|
||||
if ($this->MR->delete('relasi', $id, 'ID_RELASI')) {
|
||||
$action = $this ->MR->delete('relasi',$id,'ID_RELASI');
|
||||
$this->session->set_flashdata('flash', 'dihapus');
|
||||
redirect('ManageRelasi');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user