70496 lines
2.2 MiB
Plaintext
70496 lines
2.2 MiB
Plaintext
<?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 Menu extends CI_Controller {
|
|
|
|
function __construct() {
|
|
parent::__construct();
|
|
$this->load->model('AllModels', 'Amod');
|
|
$this->load->library(['datatables', 'form_validation']);
|
|
$this->load->helper('download');
|
|
$this->form_validation->set_error_delimiters('', '');
|
|
$this->periksaLogin();
|
|
}
|
|
|
|
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 periksaLogin() {
|
|
$username = $this->session->userdata('username');
|
|
if ($username == null) {
|
|
redirect("Login");
|
|
}
|
|
}
|
|
|
|
public function download($verse, $filename, $specific) {
|
|
if ($verse==1) { // Lampiran Penjualan
|
|
$path = FCPATH . "uploads/lampiranjual/$specific/".rawurldecode($filename);
|
|
if (file_exists($path)) {
|
|
force_download($path, NULL);
|
|
} else {
|
|
show_404();
|
|
}
|
|
} else if ($verse==2) { // PO Penjualan
|
|
$datSo = $this->Amod->getData_SalesOrder_byKODE($specific);
|
|
$po_so = preg_replace('/[^A-Za-z0-9_\-\.]/', '_', $datSo[0]['PO_SO']);
|
|
$ekstensi = pathinfo($datSo[0]['FILEPO_SO'], PATHINFO_EXTENSION);
|
|
$namabaru = "$po_so.$ekstensi";
|
|
$path = FCPATH . "uploads/pojual/".rawurldecode($datSo[0]['FILEPO_SO']);
|
|
if (file_exists($path)) {
|
|
force_download($namabaru, file_get_contents($path));
|
|
} else {
|
|
show_404();
|
|
}
|
|
}
|
|
}
|
|
|
|
public function do_upload_pojual() {
|
|
if (!is_dir(FCPATH . 'uploads/pojual/')) {
|
|
mkdir(FCPATH . 'uploads/pojual/', 0755, true);
|
|
}
|
|
|
|
$config['upload_path'] = FCPATH . 'uploads/pojual/';
|
|
$config['allowed_types'] = 'jpg|jpeg|png|pdf|doc|docx';
|
|
$config['max_size'] = 10240; // dalam KB (10MB)
|
|
$config['encrypt_name'] = TRUE; // biar nama file unik
|
|
|
|
$this->load->library('upload', $config);
|
|
|
|
header('Content-Type: application/json');
|
|
|
|
if (!$this->upload->do_upload('file')) {
|
|
$status = strip_tags($this->upload->display_errors());
|
|
if ($status=="You did not select a file to upload.") {
|
|
$text = "Data belum dipilih. Pastikan sudah Browse file.";
|
|
} else if ($status=="The filetype you are attempting to upload is not allowed.") {
|
|
$text = "Ekstensi File tidak sesuai dengan Kriteria.";
|
|
} else if ($status=="The file you are attempting to upload is larger than the permitted size.") {
|
|
$text = "Ukuran File melebihi 10MB. Tidak dapat Upload.";
|
|
} else {
|
|
$text = "Hubungi Administrator.";
|
|
}
|
|
|
|
echo json_encode([
|
|
'status' => false,
|
|
'message' => $text
|
|
]);
|
|
} else {
|
|
// jika berhasil upload
|
|
$data = $this->upload->data();
|
|
echo json_encode([
|
|
'status' => true,
|
|
'filename' => $data['file_name']
|
|
]);
|
|
}
|
|
}
|
|
|
|
public function do_upload_lampiranjual() {
|
|
$jumlah_file = count($_FILES['lampiran']['name']);
|
|
$kode_so = $this->input->post('kodeSoUpload');
|
|
|
|
if (!is_dir(FCPATH . "uploads/lampiranjual/$kode_so/")) {
|
|
mkdir(FCPATH . "uploads/lampiranjual/$kode_so/", 0755, true);
|
|
}
|
|
|
|
$config['upload_path'] = FCPATH . "uploads/lampiranjual/$kode_so/";
|
|
$config['allowed_types'] = 'jpg|jpeg|png|gif|pdf|doc|docx|xls|xlsx|zip|rar|mp4|mp3|txt';
|
|
$this->load->library('upload');
|
|
header('Content-Type: application/json');
|
|
|
|
$hasil = [];
|
|
for ($i = 0; $i < $jumlah_file; $i++) {
|
|
if ($_FILES['lampiran']['name'][$i] != '') {
|
|
$_FILES['file']['name'] = $_FILES['lampiran']['name'][$i];
|
|
$_FILES['file']['type'] = $_FILES['lampiran']['type'][$i];
|
|
$_FILES['file']['tmp_name'] = $_FILES['lampiran']['tmp_name'][$i];
|
|
$_FILES['file']['error'] = $_FILES['lampiran']['error'][$i];
|
|
$_FILES['file']['size'] = $_FILES['lampiran']['size'][$i];
|
|
|
|
$this->upload->initialize($config);
|
|
|
|
if (!$this->upload->do_upload('file')) {
|
|
$status = strip_tags($this->upload->display_errors());
|
|
if ($status=="You did not select a file to upload.") {
|
|
$text = "Data belum dipilih. Pastikan sudah Browse file.";
|
|
} else if ($status=="The filetype you are attempting to upload is not allowed.") {
|
|
$text = "Ekstensi File tidak sesuai dengan Kriteria.";
|
|
} else if ($status=="The file you are attempting to upload is larger than the permitted size.") {
|
|
$text = "Ukuran File melebihi 10MB. Tidak dapat Upload.";
|
|
} else {
|
|
$text = "Hubungi Administrator.";
|
|
}
|
|
echo json_encode([
|
|
'status' => false,
|
|
'message' => $text
|
|
]);
|
|
return;
|
|
} else {
|
|
$hasil[] = $this->upload->data();
|
|
}
|
|
} else {
|
|
echo json_encode([
|
|
'status' => false,
|
|
'message' => "Data belum dipilih. Pastikan sudah Browse file."
|
|
]);
|
|
return;
|
|
}
|
|
}
|
|
|
|
echo json_encode([
|
|
'status' => true,
|
|
'data' => $hasil
|
|
]);
|
|
}
|
|
|
|
public function del_upload() {
|
|
$id_so = $this->input->post('id_so');
|
|
$kode_so = $this->input->post('kode_so');
|
|
$filename = $this->input->post('filename');
|
|
$verse = $this->input->post('verse');
|
|
|
|
$value = 0;
|
|
if ($verse==1) { // PO Penjualan
|
|
$datSo = $this->Amod->getData_SalesOrder_byID($id_so);
|
|
$filename = $datSo[0]['FILEPO_SO'];
|
|
if ($filename==NULL) {
|
|
|
|
} else {
|
|
$path = FCPATH . 'uploads/pojual/' . $filename;
|
|
|
|
if (is_file($path)) {
|
|
unlink($path);
|
|
|
|
$update = [
|
|
'PO_SO' => "",
|
|
'FILEPO_SO' => NULL
|
|
];
|
|
$action = $this->Amod->update('sales_order', $update, 'ID_SO', $id_so);
|
|
}
|
|
$value = 1;
|
|
}
|
|
} else if ($verse==2) { // Lampiran Penjualan
|
|
$path = FCPATH . "uploads/lampiranjual/$kode_so/" . $filename;
|
|
if (is_file($path)) {
|
|
unlink($path);
|
|
$value = 1;
|
|
|
|
$folder = FCPATH . "uploads/lampiranjual/$kode_so/";
|
|
$qtyfile = sizeof(array_values(array_diff(scandir($folder), array('.', '..'))));
|
|
if ($qtyfile==0) {
|
|
rmdir($folder);
|
|
}
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value
|
|
]);
|
|
}
|
|
|
|
public function see_upload_lampiranjual() {
|
|
$kode_so = $this->input->post('kode_so');
|
|
|
|
$path = FCPATH . "uploads/lampiranjual/$kode_so/";
|
|
$data = [];
|
|
if (is_dir($path)) {
|
|
$files = array_values(array_diff(scandir($path), array('.', '..')));
|
|
$no = 0;
|
|
foreach ($files as $key) {
|
|
$panjang = strlen($key);
|
|
if ($panjang>33) {
|
|
$text = substr($key, 0, 33);
|
|
$text = "$text...";
|
|
} else {
|
|
$text = $key;
|
|
}
|
|
$data[$no++] = [
|
|
'files' => $key,
|
|
'text' => $text
|
|
];
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'data' => $data,
|
|
'total' => sizeof($data)
|
|
]);
|
|
}
|
|
|
|
public function see_upload_pojual() {
|
|
$kode_so = $this->input->post('kode_so');
|
|
|
|
$datSo = $this->Amod->getData_SalesOrder_byKODE($kode_so);
|
|
$filepo_so = $datSo[0]['FILEPO_SO'];
|
|
$ekstensi = pathinfo($datSo[0]['FILEPO_SO'], PATHINFO_EXTENSION);
|
|
|
|
$data = [];
|
|
if ($filepo_so!=NULL OR $filepo_so!="") {
|
|
$data[0] = [
|
|
'files' => $filepo_so,
|
|
'text' => $datSo[0]['PO_SO'].".".$ekstensi
|
|
];
|
|
}
|
|
|
|
$this->output_json([
|
|
'data' => $data,
|
|
'total' => sizeof($data)
|
|
]);
|
|
}
|
|
|
|
// Daftar Menu Software PCM // || Penulisan Submenu berdasarkan Konsep berikut : || Daftar Action Software PCM
|
|
// 1) GE [General/Umum] // || 1) Kode Software => Contoh : Proyek [PR] || 1) Simpan
|
|
// 2) MD [Master Data] // || 2) Urutan Submenu => Contoh : [Sub1] || 2) Ubah
|
|
// 3) DA [Dashboard] // || 3) Nama Submenu => Contoh : [Sales Proyek] || 3) Hapus
|
|
// 4) KO [Konfigurasi] // || 4) Tampilan ke Berapa => Contoh : [1] || 4) Proses [Untuk Pindah Step ke Divisi Lain]
|
|
// 5) PB [Pembelian] // || Hasil Akhir : PR_Sub1_SalesProyek_1 || 5) Kunci [Untuk Mengakhiri/Finalisasi Step]
|
|
// 6) PJ [Penjualan] // || || 6) Batal
|
|
// 7) KU [Keuangan] // || ||
|
|
// 8) PR [Proyek] // || ||
|
|
// 9) SP [Sales Produk] // || ||
|
|
// 10) SV [Service] // || ||
|
|
// 11) SB [Stok Barang] // || ||
|
|
// 12) IN [Informasi/Header] // || ||
|
|
|
|
// Index Program - Dashboard Utama
|
|
public function DA_Sub0_Dashboard() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$jabatan = $this->session->userdata('jabatan');
|
|
$username = $this->session->userdata('username');
|
|
$tgl = date('Y-m-d');
|
|
$time_now = date('H:i:s');
|
|
$time_limit = date('17:00:00');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
$monthNow = strtoupper($this->Amod->generate_inisialMonth(date('m')));
|
|
|
|
$id_setdata = $this->Amod->getMax_ID_Setdata();
|
|
$id_setdata = $id_setdata[0]['ID_SETDATA'];
|
|
|
|
$datStema = $this->Amod->getData_SetTema_byKARYAWAN($id_karyawan);
|
|
if ($datStema==FALSE) {
|
|
$mode = 1;
|
|
$modeReverse = 2;
|
|
$input = [
|
|
'KARYAWAN_ID' => $id_karyawan,
|
|
'MODE_STEMA' => $mode,
|
|
'TIMESTAMP' => $timestamp
|
|
];
|
|
$action = $this->Amod->create('set_tema', $input);
|
|
} else {
|
|
$mode = $datStema[0]['MODE_STEMA'];
|
|
if ($mode==1) {
|
|
$modeReverse = 2;
|
|
} else if ($mode==2) {
|
|
$modeReverse = 1;
|
|
}
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, 'DA', 'DASHBOARD - Monitoring User');
|
|
if ($datShm==FALSE) {
|
|
$hak = 0;
|
|
} else {
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
}
|
|
|
|
$datStpos = $this->Amod->getData_SetTogglePosisi_byKARYAWAN_byMENU($id_karyawan, 0);
|
|
if ($datStpos==FALSE) { $posisiToggle = 0; } else { $posisiToggle = $datStpos[0]['AKTIF_STPOS']; }
|
|
|
|
$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'];
|
|
}
|
|
|
|
$countFk = 0;
|
|
$countFfp = 0;
|
|
if (strpos($jabatan,"KADIV SALES")!==FALSE) {
|
|
$countFk1 = $this->Amod->getCount_FormKaryawan_byACC_byKARYAWAN(1, $id_karyawan, NULL);
|
|
$countFk2 = $this->Amod->getCount_FormKaryawan_byACC_byKARYAWAN(2, NULL, $jabatan);
|
|
$countFk = $countFk1+$countFk2;
|
|
} else if ($jabatan=="KADIV KEUANGAN" OR $jabatan=="KADIV GUDANG" OR $jabatan=="KADIV ICT" OR $jabatan=="KADIV SERVICE") {
|
|
$countFk = $this->Amod->getCount_FormKaryawan_byACC_byKARYAWAN(2, NULL, $jabatan);
|
|
if ($jabatan=="KADIV KEUANGAN") {
|
|
$countFfp = $this->Amod->getCount_FormFeePelanggan_byACC(1);
|
|
}
|
|
} else if ($jabatan=="PIMPINAN") {
|
|
$countFk = $this->Amod->getCount_FormKaryawan_byACC_byKARYAWAN(3, NULL, NULL);
|
|
$countFfp = $this->Amod->getCount_FormFeePelanggan_byACC(2);
|
|
} else if (strpos($jabatan,"SALES")!==FALSE) {
|
|
$countFk = $this->Amod->getCount_FormKaryawan_byACC_byKARYAWAN(1, $id_karyawan, NULL);
|
|
}
|
|
|
|
if ($jabatan=="ADMINISTRATOR" OR $jabatan=="PIMPINAN" OR strpos($jabatan,"SALES")!==FALSE) {
|
|
if ($id_merk==0) {
|
|
$merk_id = NULL;
|
|
} else {
|
|
$merk_id = $id_merk;
|
|
}
|
|
|
|
$datPc = $this->Amod->getData_PromoClearance_bySTATUS_byMERK(1, $merk_id);
|
|
$totalPc = 0;
|
|
foreach ($datPc as $key) {
|
|
$totalPc = $totalPc+$key['PERSEDIAAN_KUANTITI'];
|
|
}
|
|
|
|
if ($jabatan=="ADMINISTRATOR" OR $jabatan=="PIMPINAN") {
|
|
$id_karyawan = NULL;
|
|
}
|
|
$countDpc = $this->Amod->getCount_DaftarPromoClearance_byKARYAWAN_bySTATUS_NotStpc($id_karyawan, 0);
|
|
$datDpc = $this->Amod->getData_DaftarPromoClearance_byKARYAWAN_bySTATUS($id_karyawan, 0);
|
|
$dpc = "";
|
|
foreach ($datDpc as $key) {
|
|
$so = $key['KODE_SO'];
|
|
$pel = $key['NAMA_PELANGGAN'];
|
|
$dpc .= "$so | $pel<br>";
|
|
}
|
|
} else {
|
|
$datPc = NULL;
|
|
$dpc = "";
|
|
$countDpc = 0;
|
|
$totalPc = 0;
|
|
}
|
|
|
|
$datPak = $this->Amod->getData_PeriodeAkuntansi_status0();
|
|
$akhirPak = $datPak[0]['AKHIR_PAK'];
|
|
if (strtotime($akhirPak)<=strtotime($tgl)) {
|
|
$kunciTombol = 0;
|
|
} else {
|
|
$kunciTombol = 1;
|
|
}
|
|
|
|
$datAbsensi = $this->Amod->getData_Absensi_byKARYAWAN_byTGL($id_karyawan, $tgl, $username);
|
|
$datMerk = $this->Amod->getData_KlaimProgram_groupMERK();
|
|
|
|
$data = array(
|
|
'sidebar' => "dashboard",
|
|
'navChild' => "",
|
|
'kunciTombol' => $kunciTombol,
|
|
'posisiToggle' => $posisiToggle,
|
|
'merk' => $datMerk,
|
|
'monthNow' => $monthNow,
|
|
'id_merk' => $id_merk,
|
|
'tgl' => $tgl,
|
|
'time_now' => $time_now,
|
|
'time_limit' => $time_limit,
|
|
'id_setdata' => $id_setdata,
|
|
'hak' => $hak,
|
|
'mode' => $mode,
|
|
'modeReverse' => $modeReverse,
|
|
'pc' => $datPc,
|
|
'dpc' => $dpc,
|
|
'countFk' => $countFk,
|
|
'countFfp' => $countFfp,
|
|
'countDpc' => $countDpc,
|
|
'totalPc' => number_format($totalPc,2),
|
|
'absensi' => $datAbsensi,
|
|
);
|
|
$this->load->view('proses/DA_Sub0_Dashboard', $data);
|
|
}
|
|
|
|
// Daftar Menu GE [General/Umum]
|
|
// KHUSUS KALKULASI
|
|
public function GE_Kalkulasi_HanyaAdministrator() { // Hanya Administrator yang dapat Menjalankan
|
|
//$datPenjualan = $this->Amod->getData_Penjualan_statusUntil1();
|
|
//foreach ($datPenjualan as $key) {
|
|
// if ($key['STATUS_PENJUALAN']==0) {
|
|
// $input = [
|
|
// 'CORP_ID' => $key['KOP_ID'],
|
|
// 'TGL_SJPJ' => $key['TGL_PENJUALAN'],
|
|
// 'KODE_SJPJ' => $key['SJ_PENJUALAN'],
|
|
// 'STATUS_SJPJ' => '9',
|
|
// 'CIPTA_SJPJ' => $key['KUNCI_SO'],
|
|
// 'PROSES_SJPJ' => $key['KUNCI_SO'],
|
|
// 'KUNCI_SJPJ' => $key['KUNCI_SO'],
|
|
// 'BATAL_SJPJ' => $key['BATAL_SO'],
|
|
// 'KET_BATAL' => $key['KET_BATAL'],
|
|
// 'TGL_BATAL' => $key['TGL_BATAL']
|
|
// ];
|
|
// $action = $this->Amod->create('sj_penjualan', $input);
|
|
// } else if ($key['STATUS_PENJUALAN']==1) {
|
|
// $input = [
|
|
// 'CORP_ID' => $key['KOP_ID'],
|
|
// 'TGL_SJPJ' => $key['TGL_PENJUALAN'],
|
|
// 'KODE_SJPJ' => $key['SJ_PENJUALAN'],
|
|
// 'STATUS_SJPJ' => '2',
|
|
// 'CIPTA_SJPJ' => $key['KUNCI_SO'],
|
|
// 'PROSES_SJPJ' => $key['KUNCI_SO'],
|
|
// 'KUNCI_SJPJ' => $key['KUNCI_SO']
|
|
// ];
|
|
// $action = $this->Amod->create('sj_penjualan', $input);
|
|
// }
|
|
//
|
|
// $id_sjpj = $this->Amod->getMax_ID_SjPenjualan();
|
|
// $id_sjpj = $id_sjpj[0]['ID_SJPJ'];
|
|
//
|
|
// $input = [
|
|
// 'SJPJ_ID' => $id_sjpj,
|
|
// 'SO_ID' => $key['SO_ID']
|
|
// ];
|
|
// $action = $this->Amod->create('so_sjpenjualan', $input);
|
|
//
|
|
// $datDo = $this->Amod->getData_DaftarOrder_bySO($key['SO_ID']);
|
|
// foreach ($datDo as $dat) {
|
|
// $input = [
|
|
// 'SJPJ_ID' => $id_sjpj,
|
|
// 'DO_ID' => $dat['ID_DO'],
|
|
// 'QTY_DFSJPJ' => $dat['QTY_DO'],
|
|
// 'RETUR_DFSJPJ' => $dat['RETUR_DO'],
|
|
// 'NAMA_DFSJPJ' => $dat['NAMA_DO'],
|
|
// 'UBAH_DFSJPJ' => $dat['UBAH_DO']
|
|
// ];
|
|
// $action = $this->Amod->create('daftar_sjpenjualan', $input);
|
|
// }
|
|
//}
|
|
}
|
|
|
|
public function GE_Kalkulasi_HanyaKadiv() { // Hanya dijalankan di semua Kadiv (Efisiensi)
|
|
$limit = date('Y-m-26');
|
|
$now = date('Y-m-d');
|
|
|
|
$datPab = $this->Amod->getData_PeriodeAbsensi_orderDESC_limit1();
|
|
if (strtotime($limit)>strtotime($datPab[0]['AKHIR_PAB'])) {
|
|
$awalNew = $this->Amod->generate_addMonth($datPab[0]['AWAL_PAB'], 1);
|
|
$akhirNew = $this->Amod->generate_addMonth($datPab[0]['AKHIR_PAB'], 1);
|
|
$monthNew = date_format(date_create($akhirNew), "m");
|
|
$yearNew = date_format(date_create($akhirNew), "Y");
|
|
$bulan = $this->Amod->generate_inisialMonth($monthNew);
|
|
$bulan = strtoupper($bulan);
|
|
|
|
$input = [
|
|
'NAMA_PAB' => "$bulan $yearNew",
|
|
'AWAL_PAB' => $awalNew,
|
|
'AKHIR_PAB' => $akhirNew
|
|
];
|
|
$action = $this->Amod->create('periode_absensi', $input);
|
|
}
|
|
|
|
//$datPkpi = $this->Amod->getData_PeriodeKpi_orderDESC_limit1();
|
|
//if (strtotime($limit)<=strtotime($now) AND strtotime($limit)>strtotime($datPkpi[0]['AWAL_PKPI'])) {
|
|
// $awalNew = date('Y-m-01');
|
|
// $awalNew = $this->Amod->generate_addMonth($awalNew, 1);
|
|
// $akhirNew = $this->Amod->generate_addMonth($awalNew, 1);
|
|
// $akhirNew = $this->Amod->generate_subDay($akhirNew, 1);
|
|
// $monthNew = date_format(date_create($awalNew), "m");
|
|
// $yearNew = date_format(date_create($awalNew), "Y");
|
|
// $bulan = $this->Amod->generate_inisialMonth($monthNew);
|
|
// $bulan = strtoupper($bulan);
|
|
//
|
|
// $input = [
|
|
// 'NAMA_PKPI' => "$bulan $yearNew",
|
|
// 'AWAL_PKPI' => $awalNew,
|
|
// 'AKHIR_PKPI' => $akhirNew
|
|
// ];
|
|
// $action = $this->Amod->create('periode_kpi', $input);
|
|
//
|
|
// $id_pkpinew = $this->Amod->getMax_ID_PeriodeKpi();
|
|
// $id_pkpinew = $id_pkpinew[0]['ID_PKPI'];
|
|
//
|
|
// $datDkpi = $this->Amod->getData_DaftarKpi_byPKPI($datPkpi[0]['ID_PKPI']);
|
|
// foreach ($datDkpi as $key) {
|
|
// $input = [
|
|
// 'KPI_ID' => $key['KPI_ID'],
|
|
// 'PKPI_ID' => $id_pkpinew,
|
|
// 'KARYAWAN_ID' => $key['KARYAWAN_ID'],
|
|
// 'TARGET_DKPI' => $key['TARGET_DKPI'],
|
|
// 'BOBOT_DKPI' => $key['BOBOT_DKPI'],
|
|
// 'URUTAN_DKPI' => $key['URUTAN_DKPI']
|
|
// ];
|
|
// $action = $this->Amod->create('daftar_kpi', $input);
|
|
// }
|
|
//}
|
|
}
|
|
|
|
public function GE_Kalkulasi_HanyaKadivKeuangan() { // Hanya dijalankan di Kadiv Keuangan (Efisiensi)
|
|
$now = date('Y-m-d');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
$thisYear = date('y');
|
|
$thisMonth = date('m');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$datSojs = $this->Amod->getData_SetOtomasiJs();
|
|
|
|
$lastPak = $this->Amod->getData_PeriodeAkuntansi_status0();
|
|
$datPak = $this->Amod->getData_PeriodeAkuntansi_byPERIODE($now);
|
|
|
|
if ($datPak==TRUE) {
|
|
if ($lastPak[0]['ID_PAK']==$datPak[0]['ID_PAK'] AND $now!=$datSojs[0]['TGL_SOJS']) {
|
|
$bawah = round($datSojs[0]['BAWAH_SOJS'],0);
|
|
$atas = round($datSojs[0]['ATAS_SOJS'],0);
|
|
|
|
$datHdaPendapatan = $this->Amod->getSum_HasilHitungHda_Pendapatan($bawah, $atas);
|
|
if ($datHdaPendapatan==TRUE) {
|
|
$totalSelisih = 0;
|
|
$id_perkiraan = 15;
|
|
$kode_akuntansi = "JS/$thisYear/$thisMonth/00002";
|
|
$datAkuntansi = $this->Amod->getData_Akuntansi_byKODE($kode_akuntansi);
|
|
$id_akuntansi = $datAkuntansi[0]['ID_AKUNTANSI'];
|
|
|
|
foreach ($datHdaPendapatan as $key) {
|
|
$datPembelian = $this->Amod->getData_Pembelian_byID($key['PEMBELIAN_ID']);
|
|
$inv_pembelian = $datPembelian[0]['INV_PEMBELIAN'];
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byPEMBELIAN_byPERKIRAAN($key['PEMBELIAN_ID'], $id_perkiraan);
|
|
$debet_dak = $sumDak[0]['KREDIT']-$sumDak[0]['DEBET'];
|
|
$totalSelisih = $totalSelisih+round($debet_dak, 2);
|
|
$ket_dak = "Jurnal Sistem u/ Koreksi Hutang - Pendapatan Diluar Usaha [$inv_pembelian]";
|
|
|
|
$input = [
|
|
'AKUNTANSI_ID' => $id_akuntansi,
|
|
'PERKIRAAN_ID' => $id_perkiraan,
|
|
'CIPTA_DAK' => "Oleh $panggilan pada $timestamp",
|
|
'JENIS_DAK' => '0',
|
|
'DEBET_DAK' => $debet_dak,
|
|
'KREDIT_DAK' => '0',
|
|
'KET_DAK' => $ket_dak,
|
|
'PEMBELIAN_ID' => $key['PEMBELIAN_ID'],
|
|
'PAK_ID' => $datPak[0]['ID_PAK'],
|
|
'SUPPLIER_ID' => $datPembelian[0]['SUPPLIER_ID'],
|
|
];
|
|
$action = $this->Amod->create('daftar_akuntansi', $input);
|
|
|
|
$sumDakNew = $this->Amod->getSum_DaftarAkuntansi_byPEMBELIAN_byPERKIRAAN($key['PEMBELIAN_ID'], $id_perkiraan);
|
|
$this->GE_Kalkulasi_HasilHitungHda("Nilai DEBET JurnalSistem", $key['PEMBELIAN_ID'], $sumDakNew[0]['DEBET']);
|
|
}
|
|
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byAKUNTANSI($id_akuntansi);
|
|
$kreditLama = $datDak[0]['KREDIT_DAK'];
|
|
$kreditBaru = $kreditLama+$totalSelisih;
|
|
|
|
$update = [
|
|
'CIPTA_DAK' => "Oleh $panggilan pada $timestamp",
|
|
'KREDIT_DAK'=> $kreditBaru,
|
|
];
|
|
$action = $this->Amod->update('daftar_akuntansi', $update, 'ID_DAK', $datDak[0]['ID_DAK']);
|
|
}
|
|
|
|
$datPdaBeban = $this->Amod->getSum_HasilHitungPda_BebanSelisih($bawah, $atas);
|
|
if ($datPdaBeban==TRUE) {
|
|
$totalSelisih = 0;
|
|
$id_perkiraan = 3;
|
|
$kode_akuntansi = "JS/$thisYear/$thisMonth/00003";
|
|
$datAkuntansi = $this->Amod->getData_Akuntansi_byKODE($kode_akuntansi);
|
|
$id_akuntansi = $datAkuntansi[0]['ID_AKUNTANSI'];
|
|
|
|
foreach ($datPdaBeban as $key) {
|
|
$datPenjualan = $this->Amod->getData_Penjualan_byID($key['PENJUALAN_ID']);
|
|
$inv_penjualan = $datPenjualan[0]['INV_PENJUALAN'];
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byPENJUALAN_byPERKIRAAN($key['PENJUALAN_ID'], $id_perkiraan);
|
|
$kredit_dak = $sumDak[0]['DEBET']-$sumDak[0]['KREDIT'];
|
|
$totalSelisih = $totalSelisih+round($kredit_dak, 2);
|
|
$ket_dak = "Jurnal Sistem u/ Koreksi Piutang - Beban Selisih Nilai [$inv_penjualan]";
|
|
|
|
$input = [
|
|
'AKUNTANSI_ID' => $id_akuntansi,
|
|
'PERKIRAAN_ID' => $id_perkiraan,
|
|
'JENIS_PDA' => '1',
|
|
'CIPTA_DAK' => "Oleh $panggilan pada $timestamp",
|
|
'JENIS_DAK' => '0',
|
|
'DEBET_DAK' => '0',
|
|
'KREDIT_DAK' => $kredit_dak,
|
|
'KET_DAK' => $ket_dak,
|
|
'PENJUALAN_ID' => $key['PENJUALAN_ID'],
|
|
'PAK_ID' => $datPak[0]['ID_PAK'],
|
|
'PELANGGAN_ID' => $datPenjualan[0]['PEL_ID'],
|
|
];
|
|
$action = $this->Amod->create('daftar_akuntansi', $input);
|
|
|
|
$sumDakNew = $this->Amod->getSum_DaftarAkuntansi_byPENJUALAN_byPERKIRAAN($key['PENJUALAN_ID'], $id_perkiraan);
|
|
$this->GE_Kalkulasi_HasilHitungPda("Nilai KREDIT JurnalSistem", $key['PENJUALAN_ID'], $sumDakNew[0]['KREDIT']);
|
|
}
|
|
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byAKUNTANSI($id_akuntansi);
|
|
$debetLama = $datDak[0]['DEBET_DAK'];
|
|
$debetBaru = $debetLama+$totalSelisih;
|
|
|
|
$update = [
|
|
'CIPTA_DAK' => "Oleh $panggilan pada $timestamp",
|
|
'DEBET_DAK' => $debetBaru,
|
|
];
|
|
$action = $this->Amod->update('daftar_akuntansi', $update, 'ID_DAK', $datDak[0]['ID_DAK']);
|
|
}
|
|
|
|
$update = [
|
|
'TGL_SOJS' => $now,
|
|
'TIMESTAMP' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('set_otomasijs', $update, 'ID_SOJS', $datSojs[0]['ID_SOJS']);
|
|
}
|
|
}
|
|
}
|
|
|
|
public function GE_Kalkulasi_HasilHitungHda($jenis, $id_pembelian, $nilai, $kode=null) {
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
$now = date('Y-m-d');
|
|
$thisYear = date('y');
|
|
$thisMonth = date('m');
|
|
|
|
$datHhhda = $this->Amod->getData_HasilHitungHda_byPEMBELIAN($id_pembelian);
|
|
if ($jenis=="Nilai DEBET JurnalSistem") {
|
|
if ($datHhhda[0]['KREDIT_HHHDA']==$nilai) {
|
|
$status_hhhda = 1;
|
|
$tgllock_hhhda = $now;
|
|
$lunas_hhhda = "JS/$thisYear/$thisMonth/00002";
|
|
} else {
|
|
if ($datHhhda[0]['KREDIT_HHHDA']<$nilai) {
|
|
$status_hhhda = 2;
|
|
} else {
|
|
$status_hhhda = 0;
|
|
}
|
|
$tgllock_hhhda = NULL;
|
|
$lunas_hhhda = NULL;
|
|
}
|
|
|
|
$update = [
|
|
'STATUS_HHHDA' => $status_hhhda,
|
|
'DEBET_HHHDA' => $nilai,
|
|
'LAST_HHHDA' => $timestamp,
|
|
'TGLLOCK_HHHDA' => $tgllock_hhhda,
|
|
'LUNAS_HHHDA' => $lunas_hhhda,
|
|
];
|
|
$action = $this->Amod->update('hasil_hitunghda', $update, 'ID_HHHDA', $datHhhda[0]['ID_HHHDA']);
|
|
} else if ($jenis=="Nilai DEBET Tambah Kasbank") {
|
|
$debet_hhhda = $datHhhda[0]['DEBET_HHHDA']+$nilai;
|
|
if ($datHhhda[0]['KREDIT_HHHDA']==$debet_hhhda) {
|
|
$datAkuntansi = $this->Amod->getData_Akuntansi_byKODE($kode);
|
|
$status_hhhda = 1;
|
|
$tgllock_hhhda = $datAkuntansi[0]['TGL_AKUNTANSI'];
|
|
$lunas_hhhda = $kode;
|
|
} else {
|
|
if ($datHhhda[0]['KREDIT_HHHDA']<$debet_hhhda) {
|
|
$status_hhhda = 2;
|
|
} else {
|
|
$status_hhhda = 0;
|
|
}
|
|
$tgllock_hhhda = NULL;
|
|
$lunas_hhhda = NULL;
|
|
}
|
|
|
|
$update = [
|
|
'STATUS_HHHDA' => $status_hhhda,
|
|
'DEBET_HHHDA' => $debet_hhhda,
|
|
'LAST_HHHDA' => $timestamp,
|
|
'TGLLOCK_HHHDA' => $tgllock_hhhda,
|
|
'LUNAS_HHHDA' => $lunas_hhhda,
|
|
];
|
|
$action = $this->Amod->update('hasil_hitunghda', $update, 'ID_HHHDA', $datHhhda[0]['ID_HHHDA']);
|
|
} else if ($jenis=="Nilai DEBET Hapus Kasbank") {
|
|
$debet_hhhda = $datHhhda[0]['DEBET_HHHDA']-$nilai;
|
|
if ($datHhhda[0]['KREDIT_HHHDA']<$debet_hhhda) {
|
|
$status_hhhda = 2;
|
|
} else {
|
|
$status_hhhda = 0;
|
|
}
|
|
$tgllock_hhhda = NULL;
|
|
$lunas_hhhda = NULL;
|
|
|
|
$update = [
|
|
'STATUS_HHHDA' => $status_hhhda,
|
|
'DEBET_HHHDA' => $debet_hhhda,
|
|
'LAST_HHHDA' => $timestamp,
|
|
'TGLLOCK_HHHDA' => $tgllock_hhhda,
|
|
'LUNAS_HHHDA' => $lunas_hhhda,
|
|
];
|
|
$action = $this->Amod->update('hasil_hitunghda', $update, 'ID_HHHDA', $datHhhda[0]['ID_HHHDA']);
|
|
} else if ($jenis=="Nilai KREDIT Pembelian") {
|
|
if ($datHhhda[0]['DEBET_HHHDA']==$nilai) {
|
|
$status_hhhda = 1;
|
|
$tgllock_hhhda = $now;
|
|
$lunas_hhhda = $datHhhda[0]['KODE_PEMBELIAN'];
|
|
} else {
|
|
if ($datHhhda[0]['DEBET_HHHDA']>$nilai) {
|
|
$status_hhhda = 2;
|
|
} else {
|
|
$status_hhhda = 0;
|
|
}
|
|
$tgllock_hhhda = NULL;
|
|
$lunas_hhhda = NULL;
|
|
}
|
|
|
|
$update = [
|
|
'STATUS_HHHDA' => $status_hhhda,
|
|
'KREDIT_HHHDA' => $nilai,
|
|
'LAST_HHHDA' => $timestamp,
|
|
'TGLLOCK_HHHDA' => $tgllock_hhhda,
|
|
'LUNAS_HHHDA' => $lunas_hhhda,
|
|
];
|
|
$action = $this->Amod->update('hasil_hitunghda', $update, 'ID_HHHDA', $datHhhda[0]['ID_HHHDA']);
|
|
} else if ($jenis=="PEMBELIAN - Retur") {
|
|
$sumHda = $this->Amod->getSum_DaftarAkuntansi_byPEMBELIAN_byPERKIRAAN($id_pembelian, 15);
|
|
$debet_hhhda = $sumHda[0]['DEBET'];
|
|
$kredit_hhhda = $sumHda[0]['KREDIT'];
|
|
if ($debet_hhhda==$kredit_hhhda) {
|
|
$status_hhhda = 1;
|
|
} else if ($kredit_hhhda<$debet_hhhda) {
|
|
$status_hhhda = 2;
|
|
} else {
|
|
$status_hhhda = 0;
|
|
}
|
|
|
|
if ($datHhhda[0]['STATUS_HHHDA']!=$status_hhhda) {
|
|
$historiHda = $this->Amod->getData_DaftarAkuntansi_byPEMBELIAN_byPERKIRAAN_orderDESC_limit1($id_pembelian, 15);
|
|
$update = [
|
|
'DEBET_HHHDA' => $debet_hhhda,
|
|
'KREDIT_HHHDA' => $kredit_hhhda,
|
|
'STATUS_HHHDA' => $status_hhhda,
|
|
'LAST_HHHDA' => $timestamp,
|
|
'TGLLOCK_HHHDA' => $historiHda[0]['TGL_AKUNTANSI'],
|
|
'LUNAS_HHHDA' => $historiHda[0]['KODE_AKUNTANSI']
|
|
];
|
|
$action = $this->Amod->update('hasil_hitunghda', $update, 'ID_HHHDA', $datHhhda[0]['ID_HHHDA']);
|
|
} else if ($datHhhda[0]['DEBET_HHHDA']!=$debet_hhhda OR $datHhhda[0]['KREDIT_HHHDA']!=$kredit_hhhda) {
|
|
$update = [
|
|
'DEBET_HHHDA' => $debet_hhhda,
|
|
'KREDIT_HHHDA' => $kredit_hhhda,
|
|
'LAST_HHHDA' => $timestamp
|
|
];
|
|
$action = $this->Amod->update('hasil_hitunghda', $update, 'ID_HHHDA', $datHhhda[0]['ID_HHHDA']);
|
|
}
|
|
}
|
|
}
|
|
|
|
public function GE_Kalkulasi_HasilHitungKpr($id_merk, $id_produk) {
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
|
|
$datKpr = $this->Amod->getData_KlaimProgram_byMERK_byPRODUK_groupBARANG_status0($id_merk, $id_produk);
|
|
foreach ($datKpr as $key) {
|
|
$dataKpr = $this->Amod->getData_KlaimProgram_byBARANG_bySTATUS($key['BARANG_ID'], 0);
|
|
$qty_hhkpr = 0;
|
|
$persediaan_hhkpr = 0;
|
|
$pp_hhkpr = 0;
|
|
$rebate_hhkpr = 0;
|
|
$support_hhkpr = 0;
|
|
foreach ($dataKpr as $dat) {
|
|
$countSnkpr = $this->Amod->getCount_SnKlaimProgram_byKPR_status0($dat['ID_KPR']);
|
|
$sumPp = $this->Amod->getSum_LinkKlaimProgram_byKPR_byPROGRAM_bySTATUS($dat['ID_KPR'], 2, 0);
|
|
if ($sumPp[0]['TOTAL']!=NULL) {
|
|
$pp_hhkpr = $pp_hhkpr+$sumPp[0]['TOTAL'];
|
|
}
|
|
|
|
$sumRebate = $this->Amod->getSum_LinkKlaimProgram_byKPR_byPROGRAM_bySTATUS($dat['ID_KPR'], 3, 0);
|
|
if ($sumRebate[0]['TOTAL']!=NULL) {
|
|
$rebate_hhkpr = $rebate_hhkpr+$sumRebate[0]['TOTAL'];
|
|
}
|
|
|
|
$sumSupport = $this->Amod->getSum_LinkKlaimProgram_byKPR_byPROGRAM_bySTATUS($dat['ID_KPR'], 5, 0);
|
|
if ($sumSupport[0]['TOTAL']!=NULL) {
|
|
$support_hhkpr = $support_hhkpr+$sumSupport[0]['TOTAL'];
|
|
}
|
|
|
|
$qty_hhkpr = $qty_hhkpr+$countSnkpr;
|
|
$persediaan_hhkpr = $persediaan_hhkpr+round(($countSnkpr*$dat['HARGA_KPR']),2);
|
|
}
|
|
|
|
$datHhkpr = $this->Amod->getData_HasilHitungKpr_byBARANG($key['BARANG_ID']);
|
|
if ($datHhkpr==TRUE) {
|
|
$update = [
|
|
'QTY_HHKPR' => $qty_hhkpr,
|
|
'PERSEDIAAN_HHKPR' => $persediaan_hhkpr,
|
|
'PP_HHKPR' => $pp_hhkpr,
|
|
'REBATE_HHKPR' => $rebate_hhkpr,
|
|
'SUPPORT_HHKPR' => $support_hhkpr,
|
|
'TIMESTAMP' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('hasil_hitungkpr', $update, 'ID_HHKPR', $datHhkpr[0]['ID_HHKPR']);
|
|
} else {
|
|
$input = [
|
|
'BARANG_ID' => $key['BARANG_ID'],
|
|
'QTY_HHKPR' => $qty_hhkpr,
|
|
'PERSEDIAAN_HHKPR' => $persediaan_hhkpr,
|
|
'PP_HHKPR' => $pp_hhkpr,
|
|
'REBATE_HHKPR' => $rebate_hhkpr,
|
|
'SUPPORT_HHKPR' => $support_hhkpr,
|
|
'TIMESTAMP' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungkpr', $input);
|
|
}
|
|
}
|
|
}
|
|
|
|
public function GE_Kalkulasi_HasilHitungPda($jenis, $id_penjualan, $nilai, $kode=null) {
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
$now = date('Y-m-d');
|
|
$thisYear = date('y');
|
|
$thisMonth = date('m');
|
|
|
|
$datHhpda = $this->Amod->getData_HasilHitungPda_byPENJUALAN($id_penjualan);
|
|
if ($jenis=="Nilai KREDIT JurnalSistem") {
|
|
if ($datHhpda[0]['DEBET_HHPDA']==$nilai) {
|
|
$status_hhpda = 1;
|
|
$tgllock_hhpda = $now;
|
|
$lunas_hhpda = "JS/$thisYear/$thisMonth/00003";
|
|
} else {
|
|
if ($datHhpda[0]['DEBET_HHPDA']<$nilai) {
|
|
$status_hhpda = 2;
|
|
} else {
|
|
$status_hhpda = 0;
|
|
}
|
|
$tgllock_hhpda = NULL;
|
|
$lunas_hhpda = NULL;
|
|
}
|
|
|
|
$update = [
|
|
'STATUS_HHPDA' => $status_hhpda,
|
|
'KREDIT_HHPDA' => $nilai,
|
|
'LAST_HHPDA' => $timestamp,
|
|
'TGLLOCK_HHPDA' => $tgllock_hhpda,
|
|
'LUNAS_HHPDA' => $lunas_hhpda,
|
|
];
|
|
$action = $this->Amod->update('hasil_hitungpda', $update, 'ID_HHPDA', $datHhpda[0]['ID_HHPDA']);
|
|
} else if ($jenis=="Nilai KREDIT Tambah Kasbank") {
|
|
$kredit_hhpda = $datHhpda[0]['KREDIT_HHPDA']+$nilai;
|
|
if ($datHhpda[0]['DEBET_HHPDA']==$kredit_hhpda) {
|
|
$datAkuntansi = $this->Amod->getData_Akuntansi_byKODE($kode);
|
|
$status_hhpda = 1;
|
|
$tgllock_hhpda = $datAkuntansi[0]['TGL_AKUNTANSI'];
|
|
$lunas_hhpda = $kode;
|
|
} else {
|
|
if ($datHhpda[0]['DEBET_HHPDA']<$kredit_hhpda) {
|
|
$status_hhpda = 2;
|
|
} else {
|
|
$status_hhpda = 0;
|
|
}
|
|
$tgllock_hhpda = NULL;
|
|
$lunas_hhpda = NULL;
|
|
}
|
|
|
|
$update = [
|
|
'STATUS_HHPDA' => $status_hhpda,
|
|
'KREDIT_HHPDA' => $kredit_hhpda,
|
|
'LAST_HHPDA' => $timestamp,
|
|
'TGLLOCK_HHPDA' => $tgllock_hhpda,
|
|
'LUNAS_HHPDA' => $lunas_hhpda,
|
|
];
|
|
$action = $this->Amod->update('hasil_hitungpda', $update, 'ID_HHPDA', $datHhpda[0]['ID_HHPDA']);
|
|
} else if ($jenis=="Nilai KREDIT Hapus Kasbank") {
|
|
$kredit_hhpda = $datHhpda[0]['KREDIT_HHPDA']-$nilai;
|
|
if ($datHhpda[0]['DEBET_HHPDA']<$kredit_hhpda) {
|
|
$status_hhpda = 2;
|
|
} else {
|
|
$status_hhpda = 0;
|
|
}
|
|
$tgllock_hhpda = NULL;
|
|
$lunas_hhpda = NULL;
|
|
|
|
$update = [
|
|
'STATUS_HHPDA' => $status_hhpda,
|
|
'KREDIT_HHPDA' => $kredit_hhpda,
|
|
'LAST_HHPDA' => $timestamp,
|
|
'TGLLOCK_HHPDA' => $tgllock_hhpda,
|
|
'LUNAS_HHPDA' => $lunas_hhpda,
|
|
];
|
|
$action = $this->Amod->update('hasil_hitungpda', $update, 'ID_HHPDA', $datHhpda[0]['ID_HHPDA']);
|
|
}
|
|
}
|
|
|
|
public function GE_Kalkulasi_HasilHitungTb($id_pak) {
|
|
$datPak = $this->Amod->getData_PeriodeAkuntansi_byID($id_pak);
|
|
$limit = $this->Amod->generate_subDay($datPak[0]['AWAL_PAK'], 1);
|
|
$awal = $datPak[0]['AWAL_PAK'];
|
|
$akhir = $datPak[0]['AKHIR_PAK'];
|
|
|
|
//Ciptakan Nilai Dasar
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byKAS_byPERKIRAAN_byPERIODE(1, 1, $limit);
|
|
if ($sumDak[0]['DEBET']==NULL) { $nilai = 0; } else { $nilai = $sumDak[0]['DEBET']-$sumDak[0]['KREDIT']; }
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => "1111",
|
|
'KOLOM_HHTB' => "C",
|
|
'NILAI_HHTB' => $nilai
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byKAS_byPERKIRAAN_byPERIODE(2, 1, $limit);
|
|
if ($sumDak[0]['DEBET']==NULL) { $nilai = 0; } else { $nilai = $sumDak[0]['DEBET']-$sumDak[0]['KREDIT']; }
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => "1112",
|
|
'KOLOM_HHTB' => "C",
|
|
'NILAI_HHTB' => $nilai
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byBANK_byPERKIRAAN_byPERIODE(1, 2, $limit);
|
|
if ($sumDak[0]['DEBET']==NULL) { $nilai = 0; } else { $nilai = $sumDak[0]['DEBET']-$sumDak[0]['KREDIT']; }
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => "1113",
|
|
'KOLOM_HHTB' => "C",
|
|
'NILAI_HHTB' => $nilai
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byBANK_byPERKIRAAN_byPERIODE(2, 2, $limit);
|
|
if ($sumDak[0]['DEBET']==NULL) { $nilai = 0; } else { $nilai = $sumDak[0]['DEBET']-$sumDak[0]['KREDIT']; }
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => "1114",
|
|
'KOLOM_HHTB' => "C",
|
|
'NILAI_HHTB' => $nilai
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byBANK_byPERKIRAAN_byPERIODE(3, 2, $limit);
|
|
if ($sumDak[0]['DEBET']==NULL) { $nilai = 0; } else { $nilai = $sumDak[0]['DEBET']-$sumDak[0]['KREDIT']; }
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => "1115",
|
|
'KOLOM_HHTB' => "C",
|
|
'NILAI_HHTB' => $nilai
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byBANK_byPERKIRAAN_byPERIODE(4, 2, $limit);
|
|
if ($sumDak[0]['DEBET']==NULL) { $nilai = 0; } else { $nilai = $sumDak[0]['DEBET']-$sumDak[0]['KREDIT']; }
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => "1116",
|
|
'KOLOM_HHTB' => "C",
|
|
'NILAI_HHTB' => $nilai
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byBANK_byPERKIRAAN_byPERIODE(5, 2, $limit);
|
|
if ($sumDak[0]['DEBET']==NULL) { $nilai = 0; } else { $nilai = $sumDak[0]['DEBET']-$sumDak[0]['KREDIT']; }
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => "1117",
|
|
'KOLOM_HHTB' => "C",
|
|
'NILAI_HHTB' => $nilai
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byBANK_byPERKIRAAN_byPERIODE(6, 2, $limit);
|
|
if ($sumDak[0]['DEBET']==NULL) { $nilai = 0; } else { $nilai = $sumDak[0]['DEBET']-$sumDak[0]['KREDIT']; }
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => "1118",
|
|
'KOLOM_HHTB' => "C",
|
|
'NILAI_HHTB' => $nilai
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byBANK_byPERKIRAAN_byPERIODE(7, 2, $limit);
|
|
if ($sumDak[0]['DEBET']==NULL) { $nilai = 0; } else { $nilai = $sumDak[0]['DEBET']-$sumDak[0]['KREDIT']; }
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => "1119",
|
|
'KOLOM_HHTB' => "C",
|
|
'NILAI_HHTB' => $nilai
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byBANK_byPERKIRAAN_byPERIODE(8, 2, $limit);
|
|
if ($sumDak[0]['DEBET']==NULL) { $nilai = 0; } else { $nilai = $sumDak[0]['DEBET']-$sumDak[0]['KREDIT']; }
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => "1120",
|
|
'KOLOM_HHTB' => "C",
|
|
'NILAI_HHTB' => $nilai
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byBANK_byPERKIRAAN_byPERIODE(9, 2, $limit);
|
|
if ($sumDak[0]['DEBET']==NULL) { $nilai = 0; } else { $nilai = $sumDak[0]['DEBET']-$sumDak[0]['KREDIT']; }
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => "1121",
|
|
'KOLOM_HHTB' => "C",
|
|
'NILAI_HHTB' => $nilai
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byBANK_byPERKIRAAN_byPERIODE(10, 2, $limit);
|
|
if ($sumDak[0]['DEBET']==NULL) { $nilai = 0; } else { $nilai = $sumDak[0]['DEBET']-$sumDak[0]['KREDIT']; }
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => "1122",
|
|
'KOLOM_HHTB' => "C",
|
|
'NILAI_HHTB' => $nilai
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byBANK_byPERKIRAAN_byPERIODE(11, 2, $limit);
|
|
if ($sumDak[0]['DEBET']==NULL) { $nilai = 0; } else { $nilai = $sumDak[0]['DEBET']-$sumDak[0]['KREDIT']; }
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => "1123",
|
|
'KOLOM_HHTB' => "C",
|
|
'NILAI_HHTB' => $nilai
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byBANK_byPERKIRAAN_byPERIODE(12, 2, $limit);
|
|
if ($sumDak[0]['DEBET']==NULL) { $nilai = 0; } else { $nilai = $sumDak[0]['DEBET']-$sumDak[0]['KREDIT']; }
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => "1124",
|
|
'KOLOM_HHTB' => "C",
|
|
'NILAI_HHTB' => $nilai
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byBANK_byPERKIRAAN_byPERIODE(13, 2, $limit);
|
|
if ($sumDak[0]['DEBET']==NULL) { $nilai = 0; } else { $nilai = $sumDak[0]['DEBET']-$sumDak[0]['KREDIT']; }
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => "1125",
|
|
'KOLOM_HHTB' => "C",
|
|
'NILAI_HHTB' => $nilai
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byBANK_byPERKIRAAN_byPERIODE(14, 2, $limit);
|
|
if ($sumDak[0]['DEBET']==NULL) { $nilai = 0; } else { $nilai = $sumDak[0]['DEBET']-$sumDak[0]['KREDIT']; }
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => "1126",
|
|
'KOLOM_HHTB' => "C",
|
|
'NILAI_HHTB' => $nilai
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byBANK_byPERKIRAAN_byPERIODE(15, 2, $limit);
|
|
if ($sumDak[0]['DEBET']==NULL) { $nilai = 0; } else { $nilai = $sumDak[0]['DEBET']-$sumDak[0]['KREDIT']; }
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => "1127",
|
|
'KOLOM_HHTB' => "C",
|
|
'NILAI_HHTB' => $nilai
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byBANK_byPERKIRAAN_byPERIODE(16, 2, $limit);
|
|
if ($sumDak[0]['DEBET']==NULL) { $nilai = 0; } else { $nilai = $sumDak[0]['DEBET']-$sumDak[0]['KREDIT']; }
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => "1128",
|
|
'KOLOM_HHTB' => "C",
|
|
'NILAI_HHTB' => $nilai
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byBANK_byPERKIRAAN_byPERIODE(17, 2, $limit);
|
|
if ($sumDak[0]['DEBET']==NULL) { $nilai = 0; } else { $nilai = $sumDak[0]['DEBET']-$sumDak[0]['KREDIT']; }
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => "1129",
|
|
'KOLOM_HHTB' => "C",
|
|
'NILAI_HHTB' => $nilai
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_beforeTGL(3, $limit);
|
|
if ($sumDak[0]['DEBET']==NULL) { $nilai = 0; } else { $nilai = $sumDak[0]['DEBET']-$sumDak[0]['KREDIT']; }
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => "1130",
|
|
'KOLOM_HHTB' => "C",
|
|
'NILAI_HHTB' => $nilai
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_beforeTGL(5, $limit);
|
|
if ($sumDak[0]['DEBET']==NULL) { $nilai = 0; } else { $nilai = $sumDak[0]['DEBET']-$sumDak[0]['KREDIT']; }
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => "1150",
|
|
'KOLOM_HHTB' => "C",
|
|
'NILAI_HHTB' => $nilai
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_beforeTGL(6, $limit);
|
|
if ($sumDak[0]['DEBET']==NULL) { $nilai = 0; } else { $nilai = $sumDak[0]['DEBET']-$sumDak[0]['KREDIT']; }
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => "1160",
|
|
'KOLOM_HHTB' => "C",
|
|
'NILAI_HHTB' => $nilai
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_beforeTGL(7, $limit);
|
|
if ($sumDak[0]['DEBET']==NULL) { $nilai = 0; } else { $nilai = $sumDak[0]['DEBET']-$sumDak[0]['KREDIT']; }
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => "1170",
|
|
'KOLOM_HHTB' => "C",
|
|
'NILAI_HHTB' => $nilai
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_beforeTGL(8, $limit);
|
|
if ($sumDak[0]['DEBET']==NULL) { $nilai = 0; } else { $nilai = $sumDak[0]['DEBET']-$sumDak[0]['KREDIT']; }
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => "1180",
|
|
'KOLOM_HHTB' => "C",
|
|
'NILAI_HHTB' => $nilai
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_beforeTGL(9, $limit);
|
|
if ($sumDak[0]['DEBET']==NULL) { $nilai = 0; } else { $nilai = $sumDak[0]['DEBET']-$sumDak[0]['KREDIT']; }
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => "1210",
|
|
'KOLOM_HHTB' => "C",
|
|
'NILAI_HHTB' => $nilai
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_beforeTGL(10, $limit);
|
|
if ($sumDak[0]['DEBET']==NULL) { $nilai = 0; } else { $nilai = $sumDak[0]['DEBET']-$sumDak[0]['KREDIT']; }
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => "1211",
|
|
'KOLOM_HHTB' => "C",
|
|
'NILAI_HHTB' => $nilai
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_beforeTGL(11, $limit);
|
|
if ($sumDak[0]['DEBET']==NULL) { $nilai = 0; } else { $nilai = $sumDak[0]['DEBET']-$sumDak[0]['KREDIT']; }
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => "1220",
|
|
'KOLOM_HHTB' => "C",
|
|
'NILAI_HHTB' => $nilai
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_beforeTGL(12, $limit);
|
|
if ($sumDak[0]['DEBET']==NULL) { $nilai = 0; } else { $nilai = $sumDak[0]['DEBET']-$sumDak[0]['KREDIT']; }
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => "1221",
|
|
'KOLOM_HHTB' => "C",
|
|
'NILAI_HHTB' => $nilai
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_beforeTGL(13, $limit);
|
|
if ($sumDak[0]['DEBET']==NULL) { $nilai = 0; } else { $nilai = $sumDak[0]['DEBET']-$sumDak[0]['KREDIT']; }
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => "1230",
|
|
'KOLOM_HHTB' => "C",
|
|
'NILAI_HHTB' => $nilai
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_beforeTGL(14, $limit);
|
|
if ($sumDak[0]['DEBET']==NULL) { $nilai = 0; } else { $nilai = $sumDak[0]['DEBET']-$sumDak[0]['KREDIT']; }
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => "1231",
|
|
'KOLOM_HHTB' => "C",
|
|
'NILAI_HHTB' => $nilai
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_beforeTGL(15, $limit);
|
|
if ($sumDak[0]['KREDIT']==NULL) { $nilai = 0; } else { $nilai = $sumDak[0]['KREDIT']-$sumDak[0]['DEBET']; }
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => "2110",
|
|
'KOLOM_HHTB' => "D",
|
|
'NILAI_HHTB' => $nilai
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_beforeTGL(16, $limit);
|
|
if ($sumDak[0]['KREDIT']==NULL) { $nilai = 0; } else { $nilai = $sumDak[0]['KREDIT']-$sumDak[0]['DEBET']; }
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => "2120",
|
|
'KOLOM_HHTB' => "D",
|
|
'NILAI_HHTB' => $nilai
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_beforeTGL(17, $limit);
|
|
if ($sumDak[0]['KREDIT']==NULL) { $nilai = 0; } else { $nilai = $sumDak[0]['KREDIT']-$sumDak[0]['DEBET']; }
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => "2130",
|
|
'KOLOM_HHTB' => "D",
|
|
'NILAI_HHTB' => $nilai
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_beforeTGL(18, $limit);
|
|
if ($sumDak[0]['KREDIT']==NULL) { $nilai = 0; } else { $nilai = $sumDak[0]['KREDIT']-$sumDak[0]['DEBET']; }
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => "2140",
|
|
'KOLOM_HHTB' => "D",
|
|
'NILAI_HHTB' => $nilai
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_beforeTGL(19, $limit);
|
|
if ($sumDak[0]['KREDIT']==NULL) { $nilai = 0; } else { $nilai = $sumDak[0]['KREDIT']-$sumDak[0]['DEBET']; }
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => "2150",
|
|
'KOLOM_HHTB' => "D",
|
|
'NILAI_HHTB' => $nilai
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_beforeTGL(20, $limit);
|
|
if ($sumDak[0]['KREDIT']==NULL) { $nilai = 0; } else { $nilai = $sumDak[0]['KREDIT']-$sumDak[0]['DEBET']; }
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => "3100",
|
|
'KOLOM_HHTB' => "D",
|
|
'NILAI_HHTB' => $nilai
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
|
|
// Hasilkan KAS PCM
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byKAS_byPERIODE_groupPERKIRAAN_kasbankOnly(1, $awal, $akhir);
|
|
foreach ($datDak as $key) {
|
|
if ($key['KODE_PERKIRAAN']==1110) {
|
|
// Terima Ayat Silang
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byASKAS_byPERIODE(1, $awal, $akhir);
|
|
if ($sumDak[0]['DEBET']==NULL) { $tras = 0; } else { $tras = $sumDak[0]['DEBET']; }
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => "1111",
|
|
'KOLOM_HHTB' => "E",
|
|
'NILAI_HHTB' => $key['DEBET']+$tras
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
|
|
if ($tras>0) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => "9999",
|
|
'KOLOM_HHTB' => "F",
|
|
'NILAI_HHTB' => $tras
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
|
|
// Kirim Ayat Silang
|
|
$sumAs = $this->Amod->getSum_DaftarAkuntansi_byKAS_byPERIODE_asNotNull(1, $awal, $akhir);
|
|
if ($sumAs[0]['DEBET']==NULL) { $kras = 0; } else { $kras = $sumAs[0]['DEBET']; }
|
|
|
|
if ($key['AS_BANK']!=NULL) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => "1111",
|
|
'KOLOM_HHTB' => "F",
|
|
'NILAI_HHTB' => $key['KREDIT']-$kras
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
} else {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => "1111",
|
|
'KOLOM_HHTB' => "F",
|
|
'NILAI_HHTB' => $key['KREDIT']
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
|
|
if ($kras>0) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => "9999",
|
|
'KOLOM_HHTB' => "E",
|
|
'NILAI_HHTB' => $kras
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
} else if ($key['KODE_PERKIRAAN']==1120) {
|
|
|
|
} else {
|
|
if ($key['DEBET']>0) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => $key['KODE_PERKIRAAN'],
|
|
'KOLOM_HHTB' => "E",
|
|
'NILAI_HHTB' => $key['DEBET']
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
if ($key['KREDIT']>0) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => $key['KODE_PERKIRAAN'],
|
|
'KOLOM_HHTB' => "F",
|
|
'NILAI_HHTB' => $key['KREDIT']
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
}
|
|
}
|
|
|
|
// Hasilkan KAS ITP
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byKAS_byPERIODE_groupPERKIRAAN_kasbankOnly(2, $awal, $akhir);
|
|
foreach ($datDak as $key) {
|
|
if ($key['KODE_PERKIRAAN']==1110) {
|
|
// Terima Ayat Silang
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byASKAS_byPERIODE(2, $awal, $akhir);
|
|
if ($sumDak[0]['DEBET']==NULL) { $tras = 0; } else { $tras = $sumDak[0]['DEBET']; }
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => "1112",
|
|
'KOLOM_HHTB' => "G",
|
|
'NILAI_HHTB' => $key['DEBET']+$tras
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
|
|
if ($tras>0) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => "9999",
|
|
'KOLOM_HHTB' => "H",
|
|
'NILAI_HHTB' => $tras
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
|
|
// Kirim Ayat Silang
|
|
$sumAs = $this->Amod->getSum_DaftarAkuntansi_byKAS_byPERIODE_asNotNull(2, $awal, $akhir);
|
|
if ($sumAs[0]['DEBET']==NULL) { $kras = 0; } else { $kras = $sumAs[0]['DEBET']; }
|
|
|
|
if ($key['AS_BANK']!=NULL) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => "1112",
|
|
'KOLOM_HHTB' => "H",
|
|
'NILAI_HHTB' => $key['KREDIT']-$kras
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
} else {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => "1112",
|
|
'KOLOM_HHTB' => "H",
|
|
'NILAI_HHTB' => $key['KREDIT']
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
|
|
if ($kras>0) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => "9999",
|
|
'KOLOM_HHTB' => "G",
|
|
'NILAI_HHTB' => $kras
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
} else if ($key['KODE_PERKIRAAN']==1120) {
|
|
|
|
} else {
|
|
if ($key['DEBET']>0) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => $key['KODE_PERKIRAAN'],
|
|
'KOLOM_HHTB' => "G",
|
|
'NILAI_HHTB' => $key['DEBET']
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
if ($key['KREDIT']>0) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => $key['KODE_PERKIRAAN'],
|
|
'KOLOM_HHTB' => "H",
|
|
'NILAI_HHTB' => $key['KREDIT']
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
}
|
|
}
|
|
|
|
//Hasilkan BCA DMT
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byBANK_byPERIODE_groupPERKIRAAN_kasbankOnly(1, $awal, $akhir);
|
|
foreach ($datDak as $key) {
|
|
if ($key['KODE_PERKIRAAN']==1120) {
|
|
// Terima Ayat Silang
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byASBANK_byPERIODE(1, $awal, $akhir);
|
|
if ($sumDak[0]['DEBET']==NULL) { $tras = 0; } else { $tras = $sumDak[0]['DEBET']; }
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => "1113",
|
|
'KOLOM_HHTB' => "I",
|
|
'NILAI_HHTB' => $key['DEBET']+$tras
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
|
|
if ($tras>0) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => "9999",
|
|
'KOLOM_HHTB' => "J",
|
|
'NILAI_HHTB' => $tras
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
|
|
// Kirim Ayat Silang
|
|
$sumAs = $this->Amod->getSum_DaftarAkuntansi_byBANK_byPERIODE_asNotNull(1, $awal, $akhir);
|
|
if ($sumAs[0]['DEBET']==NULL) { $kras = 0; } else { $kras = $sumAs[0]['DEBET']; }
|
|
|
|
if ($key['AS_KAS']!=NULL) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => "1113",
|
|
'KOLOM_HHTB' => "J",
|
|
'NILAI_HHTB' => $key['KREDIT']-$kras
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
} else {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => "1113",
|
|
'KOLOM_HHTB' => "J",
|
|
'NILAI_HHTB' => $key['KREDIT']
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
|
|
if ($kras>0) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => "9999",
|
|
'KOLOM_HHTB' => "I",
|
|
'NILAI_HHTB' => $kras
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
} else if ($key['KODE_PERKIRAAN']==1110) {
|
|
|
|
} else {
|
|
if ($key['DEBET']>0) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => $key['KODE_PERKIRAAN'],
|
|
'KOLOM_HHTB' => "I",
|
|
'NILAI_HHTB' => $key['DEBET']
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
if ($key['KREDIT']>0) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => $key['KODE_PERKIRAAN'],
|
|
'KOLOM_HHTB' => "J",
|
|
'NILAI_HHTB' => $key['KREDIT']
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
}
|
|
}
|
|
|
|
//Hasilkan BCA HW
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byBANK_byPERIODE_groupPERKIRAAN_kasbankOnly(2, $awal, $akhir);
|
|
foreach ($datDak as $key) {
|
|
if ($key['KODE_PERKIRAAN']==1120) {
|
|
// Terima Ayat Silang
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byASBANK_byPERIODE(2, $awal, $akhir);
|
|
if ($sumDak[0]['DEBET']==NULL) { $tras = 0; } else { $tras = $sumDak[0]['DEBET']; }
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => "1114",
|
|
'KOLOM_HHTB' => "K",
|
|
'NILAI_HHTB' => $key['DEBET']+$tras
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
|
|
if ($tras>0) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => "9999",
|
|
'KOLOM_HHTB' => "L",
|
|
'NILAI_HHTB' => $tras
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
|
|
// Kirim Ayat Silang
|
|
$sumAs = $this->Amod->getSum_DaftarAkuntansi_byBANK_byPERIODE_asNotNull(2, $awal, $akhir);
|
|
if ($sumAs[0]['DEBET']==NULL) { $kras = 0; } else { $kras = $sumAs[0]['DEBET']; }
|
|
|
|
if ($key['AS_KAS']!=NULL) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => "1114",
|
|
'KOLOM_HHTB' => "L",
|
|
'NILAI_HHTB' => $key['KREDIT']-$kras
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
} else {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => "1114",
|
|
'KOLOM_HHTB' => "L",
|
|
'NILAI_HHTB' => $key['KREDIT']
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
|
|
if ($kras>0) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => "9999",
|
|
'KOLOM_HHTB' => "K",
|
|
'NILAI_HHTB' => $kras
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
} else if ($key['KODE_PERKIRAAN']==1110) {
|
|
|
|
} else {
|
|
if ($key['DEBET']>0) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => $key['KODE_PERKIRAAN'],
|
|
'KOLOM_HHTB' => "K",
|
|
'NILAI_HHTB' => $key['DEBET']
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
if ($key['KREDIT']>0) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => $key['KODE_PERKIRAAN'],
|
|
'KOLOM_HHTB' => "L",
|
|
'NILAI_HHTB' => $key['KREDIT']
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
}
|
|
}
|
|
|
|
//Hasilkan BCA TMP
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byBANK_byPERIODE_groupPERKIRAAN_kasbankOnly(3, $awal, $akhir);
|
|
foreach ($datDak as $key) {
|
|
if ($key['KODE_PERKIRAAN']==1120) {
|
|
// Terima Ayat Silang
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byASBANK_byPERIODE(3, $awal, $akhir);
|
|
if ($sumDak[0]['DEBET']==NULL) { $tras = 0; } else { $tras = $sumDak[0]['DEBET']; }
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => "1115",
|
|
'KOLOM_HHTB' => "M",
|
|
'NILAI_HHTB' => $key['DEBET']+$tras
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
|
|
if ($tras>0) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => "9999",
|
|
'KOLOM_HHTB' => "N",
|
|
'NILAI_HHTB' => $tras
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
|
|
// Kirim Ayat Silang
|
|
$sumAs = $this->Amod->getSum_DaftarAkuntansi_byBANK_byPERIODE_asNotNull(3, $awal, $akhir);
|
|
if ($sumAs[0]['DEBET']==NULL) { $kras = 0; } else { $kras = $sumAs[0]['DEBET']; }
|
|
|
|
if ($key['AS_KAS']!=NULL) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => "1115",
|
|
'KOLOM_HHTB' => "N",
|
|
'NILAI_HHTB' => $key['KREDIT']-$kras
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
} else {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => "1115",
|
|
'KOLOM_HHTB' => "N",
|
|
'NILAI_HHTB' => $key['KREDIT']
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
|
|
if ($kras>0) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => "9999",
|
|
'KOLOM_HHTB' => "M",
|
|
'NILAI_HHTB' => $kras
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
} else if ($key['KODE_PERKIRAAN']==1110) {
|
|
|
|
} else {
|
|
if ($key['DEBET']>0) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => $key['KODE_PERKIRAAN'],
|
|
'KOLOM_HHTB' => "M",
|
|
'NILAI_HHTB' => $key['DEBET']
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
if ($key['KREDIT']>0) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => $key['KODE_PERKIRAAN'],
|
|
'KOLOM_HHTB' => "N",
|
|
'NILAI_HHTB' => $key['KREDIT']
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
}
|
|
}
|
|
|
|
//Hasilkan BCA YAP
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byBANK_byPERIODE_groupPERKIRAAN_kasbankOnly(4, $awal, $akhir);
|
|
foreach ($datDak as $key) {
|
|
if ($key['KODE_PERKIRAAN']==1120) {
|
|
// Terima Ayat Silang
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byASBANK_byPERIODE(4, $awal, $akhir);
|
|
if ($sumDak[0]['DEBET']==NULL) { $tras = 0; } else { $tras = $sumDak[0]['DEBET']; }
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => "1116",
|
|
'KOLOM_HHTB' => "O",
|
|
'NILAI_HHTB' => $key['DEBET']+$tras
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
|
|
if ($tras>0) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => "9999",
|
|
'KOLOM_HHTB' => "P",
|
|
'NILAI_HHTB' => $tras
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
|
|
// Kirim Ayat Silang
|
|
$sumAs = $this->Amod->getSum_DaftarAkuntansi_byBANK_byPERIODE_asNotNull(4, $awal, $akhir);
|
|
if ($sumAs[0]['DEBET']==NULL) { $kras = 0; } else { $kras = $sumAs[0]['DEBET']; }
|
|
|
|
if ($key['AS_KAS']!=NULL) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => "1116",
|
|
'KOLOM_HHTB' => "P",
|
|
'NILAI_HHTB' => $key['KREDIT']-$kras
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
} else {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => "1116",
|
|
'KOLOM_HHTB' => "P",
|
|
'NILAI_HHTB' => $key['KREDIT']
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
|
|
if ($kras>0) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => "9999",
|
|
'KOLOM_HHTB' => "O",
|
|
'NILAI_HHTB' => $kras
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
} else if ($key['KODE_PERKIRAAN']==1110) {
|
|
|
|
} else {
|
|
if ($key['DEBET']>0) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => $key['KODE_PERKIRAAN'],
|
|
'KOLOM_HHTB' => "O",
|
|
'NILAI_HHTB' => $key['DEBET']
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
if ($key['KREDIT']>0) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => $key['KODE_PERKIRAAN'],
|
|
'KOLOM_HHTB' => "P",
|
|
'NILAI_HHTB' => $key['KREDIT']
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
}
|
|
}
|
|
|
|
//Hasilkan JATIM TMP
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byBANK_byPERIODE_groupPERKIRAAN_kasbankOnly(5, $awal, $akhir);
|
|
foreach ($datDak as $key) {
|
|
if ($key['KODE_PERKIRAAN']==1120) {
|
|
// Terima Ayat Silang
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byASBANK_byPERIODE(5, $awal, $akhir);
|
|
if ($sumDak[0]['DEBET']==NULL) { $tras = 0; } else { $tras = $sumDak[0]['DEBET']; }
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => "1117",
|
|
'KOLOM_HHTB' => "Q",
|
|
'NILAI_HHTB' => $key['DEBET']+$tras
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
|
|
if ($tras>0) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => "9999",
|
|
'KOLOM_HHTB' => "R",
|
|
'NILAI_HHTB' => $tras
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
|
|
// Kirim Ayat Silang
|
|
$sumAs = $this->Amod->getSum_DaftarAkuntansi_byBANK_byPERIODE_asNotNull(5, $awal, $akhir);
|
|
if ($sumAs[0]['DEBET']==NULL) { $kras = 0; } else { $kras = $sumAs[0]['DEBET']; }
|
|
|
|
if ($key['AS_KAS']!=NULL) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => "1117",
|
|
'KOLOM_HHTB' => "R",
|
|
'NILAI_HHTB' => $key['KREDIT']-$kras
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
} else {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => "1117",
|
|
'KOLOM_HHTB' => "R",
|
|
'NILAI_HHTB' => $key['KREDIT']
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
|
|
if ($kras>0) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => "9999",
|
|
'KOLOM_HHTB' => "Q",
|
|
'NILAI_HHTB' => $kras
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
} else if ($key['KODE_PERKIRAAN']==1110) {
|
|
|
|
} else {
|
|
if ($key['DEBET']>0) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => $key['KODE_PERKIRAAN'],
|
|
'KOLOM_HHTB' => "Q",
|
|
'NILAI_HHTB' => $key['DEBET']
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
if ($key['KREDIT']>0) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => $key['KODE_PERKIRAAN'],
|
|
'KOLOM_HHTB' => "R",
|
|
'NILAI_HHTB' => $key['KREDIT']
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
}
|
|
}
|
|
|
|
//Hasilkan MANDIRI 1400
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byBANK_byPERIODE_groupPERKIRAAN_kasbankOnly(6, $awal, $akhir);
|
|
foreach ($datDak as $key) {
|
|
if ($key['KODE_PERKIRAAN']==1120) {
|
|
// Terima Ayat Silang
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byASBANK_byPERIODE(6, $awal, $akhir);
|
|
if ($sumDak[0]['DEBET']==NULL) { $tras = 0; } else { $tras = $sumDak[0]['DEBET']; }
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => "1118",
|
|
'KOLOM_HHTB' => "S",
|
|
'NILAI_HHTB' => $key['DEBET']+$tras
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
|
|
if ($tras>0) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => "9999",
|
|
'KOLOM_HHTB' => "T",
|
|
'NILAI_HHTB' => $tras
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
|
|
// Kirim Ayat Silang
|
|
$sumAs = $this->Amod->getSum_DaftarAkuntansi_byBANK_byPERIODE_asNotNull(6, $awal, $akhir);
|
|
if ($sumAs[0]['DEBET']==NULL) { $kras = 0; } else { $kras = $sumAs[0]['DEBET']; }
|
|
|
|
if ($key['AS_KAS']!=NULL) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => "1118",
|
|
'KOLOM_HHTB' => "T",
|
|
'NILAI_HHTB' => $key['KREDIT']-$kras
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
} else {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => "1118",
|
|
'KOLOM_HHTB' => "T",
|
|
'NILAI_HHTB' => $key['KREDIT']
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
|
|
if ($kras>0) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => "9999",
|
|
'KOLOM_HHTB' => "S",
|
|
'NILAI_HHTB' => $kras
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
} else if ($key['KODE_PERKIRAAN']==1110) {
|
|
|
|
} else {
|
|
if ($key['DEBET']>0) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => $key['KODE_PERKIRAAN'],
|
|
'KOLOM_HHTB' => "S",
|
|
'NILAI_HHTB' => $key['DEBET']
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
if ($key['KREDIT']>0) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => $key['KODE_PERKIRAAN'],
|
|
'KOLOM_HHTB' => "T",
|
|
'NILAI_HHTB' => $key['KREDIT']
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
}
|
|
}
|
|
|
|
//Hasilkan MANDIRI 1420
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byBANK_byPERIODE_groupPERKIRAAN_kasbankOnly(7, $awal, $akhir);
|
|
foreach ($datDak as $key) {
|
|
if ($key['KODE_PERKIRAAN']==1120) {
|
|
// Terima Ayat Silang
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byASBANK_byPERIODE(7, $awal, $akhir);
|
|
if ($sumDak[0]['DEBET']==NULL) { $tras = 0; } else { $tras = $sumDak[0]['DEBET']; }
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => "1119",
|
|
'KOLOM_HHTB' => "U",
|
|
'NILAI_HHTB' => $key['DEBET']+$tras
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
|
|
if ($tras>0) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => "9999",
|
|
'KOLOM_HHTB' => "V",
|
|
'NILAI_HHTB' => $tras
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
|
|
// Kirim Ayat Silang
|
|
$sumAs = $this->Amod->getSum_DaftarAkuntansi_byBANK_byPERIODE_asNotNull(7, $awal, $akhir);
|
|
if ($sumAs[0]['DEBET']==NULL) { $kras = 0; } else { $kras = $sumAs[0]['DEBET']; }
|
|
|
|
if ($key['AS_KAS']!=NULL) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => "1119",
|
|
'KOLOM_HHTB' => "V",
|
|
'NILAI_HHTB' => $key['KREDIT']-$kras
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
} else {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => "1119",
|
|
'KOLOM_HHTB' => "V",
|
|
'NILAI_HHTB' => $key['KREDIT']
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
|
|
if ($kras>0) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => "9999",
|
|
'KOLOM_HHTB' => "U",
|
|
'NILAI_HHTB' => $kras
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
} else if ($key['KODE_PERKIRAAN']==1110) {
|
|
|
|
} else {
|
|
if ($key['DEBET']>0) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => $key['KODE_PERKIRAAN'],
|
|
'KOLOM_HHTB' => "U",
|
|
'NILAI_HHTB' => $key['DEBET']
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
if ($key['KREDIT']>0) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => $key['KODE_PERKIRAAN'],
|
|
'KOLOM_HHTB' => "V",
|
|
'NILAI_HHTB' => $key['KREDIT']
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
}
|
|
}
|
|
|
|
//Hasilkan MANDIRI TMP 237
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byBANK_byPERIODE_groupPERKIRAAN_kasbankOnly(8, $awal, $akhir);
|
|
foreach ($datDak as $key) {
|
|
if ($key['KODE_PERKIRAAN']==1120) {
|
|
// Terima Ayat Silang
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byASBANK_byPERIODE(8, $awal, $akhir);
|
|
if ($sumDak[0]['DEBET']==NULL) { $tras = 0; } else { $tras = $sumDak[0]['DEBET']; }
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => "1120",
|
|
'KOLOM_HHTB' => "W",
|
|
'NILAI_HHTB' => $key['DEBET']+$tras
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
|
|
if ($tras>0) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => "9999",
|
|
'KOLOM_HHTB' => "X",
|
|
'NILAI_HHTB' => $tras
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
|
|
// Kirim Ayat Silang
|
|
$sumAs = $this->Amod->getSum_DaftarAkuntansi_byBANK_byPERIODE_asNotNull(8, $awal, $akhir);
|
|
if ($sumAs[0]['DEBET']==NULL) { $kras = 0; } else { $kras = $sumAs[0]['DEBET']; }
|
|
|
|
if ($key['AS_KAS']!=NULL) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => "1120",
|
|
'KOLOM_HHTB' => "X",
|
|
'NILAI_HHTB' => $key['KREDIT']-$kras
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
} else {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => "1120",
|
|
'KOLOM_HHTB' => "X",
|
|
'NILAI_HHTB' => $key['KREDIT']
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
|
|
if ($kras>0) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => "9999",
|
|
'KOLOM_HHTB' => "W",
|
|
'NILAI_HHTB' => $kras
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
} else if ($key['KODE_PERKIRAAN']==1110) {
|
|
|
|
} else {
|
|
if ($key['DEBET']>0) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => $key['KODE_PERKIRAAN'],
|
|
'KOLOM_HHTB' => "W",
|
|
'NILAI_HHTB' => $key['DEBET']
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
if ($key['KREDIT']>0) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => $key['KODE_PERKIRAAN'],
|
|
'KOLOM_HHTB' => "X",
|
|
'NILAI_HHTB' => $key['KREDIT']
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
}
|
|
}
|
|
|
|
//Hasilkan JATIM DMT
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byBANK_byPERIODE_groupPERKIRAAN_kasbankOnly(9, $awal, $akhir);
|
|
foreach ($datDak as $key) {
|
|
if ($key['KODE_PERKIRAAN']==1120) {
|
|
// Terima Ayat Silang
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byASBANK_byPERIODE(9, $awal, $akhir);
|
|
if ($sumDak[0]['DEBET']==NULL) { $tras = 0; } else { $tras = $sumDak[0]['DEBET']; }
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => "1121",
|
|
'KOLOM_HHTB' => "Y",
|
|
'NILAI_HHTB' => $key['DEBET']+$tras
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
|
|
if ($tras>0) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => "9999",
|
|
'KOLOM_HHTB' => "Z",
|
|
'NILAI_HHTB' => $tras
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
|
|
// Kirim Ayat Silang
|
|
$sumAs = $this->Amod->getSum_DaftarAkuntansi_byBANK_byPERIODE_asNotNull(9, $awal, $akhir);
|
|
if ($sumAs[0]['DEBET']==NULL) { $kras = 0; } else { $kras = $sumAs[0]['DEBET']; }
|
|
|
|
if ($key['AS_KAS']!=NULL) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => "1121",
|
|
'KOLOM_HHTB' => "Z",
|
|
'NILAI_HHTB' => $key['KREDIT']-$kras
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
} else {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => "1121",
|
|
'KOLOM_HHTB' => "Z",
|
|
'NILAI_HHTB' => $key['KREDIT']
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
|
|
if ($kras>0) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => "9999",
|
|
'KOLOM_HHTB' => "Y",
|
|
'NILAI_HHTB' => $kras
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
} else if ($key['KODE_PERKIRAAN']==1110) {
|
|
|
|
} else {
|
|
if ($key['DEBET']>0) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => $key['KODE_PERKIRAAN'],
|
|
'KOLOM_HHTB' => "Y",
|
|
'NILAI_HHTB' => $key['DEBET']
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
if ($key['KREDIT']>0) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => $key['KODE_PERKIRAAN'],
|
|
'KOLOM_HHTB' => "Z",
|
|
'NILAI_HHTB' => $key['KREDIT']
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
}
|
|
}
|
|
|
|
//Hasilkan BCA YSS 222
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byBANK_byPERIODE_groupPERKIRAAN_kasbankOnly(10, $awal, $akhir);
|
|
foreach ($datDak as $key) {
|
|
if ($key['KODE_PERKIRAAN']==1120) {
|
|
// Terima Ayat Silang
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byASBANK_byPERIODE(10, $awal, $akhir);
|
|
if ($sumDak[0]['DEBET']==NULL) { $tras = 0; } else { $tras = $sumDak[0]['DEBET']; }
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => "1122",
|
|
'KOLOM_HHTB' => "AA",
|
|
'NILAI_HHTB' => $key['DEBET']+$tras
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
|
|
if ($tras>0) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => "9999",
|
|
'KOLOM_HHTB' => "AB",
|
|
'NILAI_HHTB' => $tras
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
|
|
// Kirim Ayat Silang
|
|
$sumAs = $this->Amod->getSum_DaftarAkuntansi_byBANK_byPERIODE_asNotNull(10, $awal, $akhir);
|
|
if ($sumAs[0]['DEBET']==NULL) { $kras = 0; } else { $kras = $sumAs[0]['DEBET']; }
|
|
|
|
if ($key['AS_KAS']!=NULL) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => "1122",
|
|
'KOLOM_HHTB' => "AB",
|
|
'NILAI_HHTB' => $key['KREDIT']-$kras
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
} else {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => "1122",
|
|
'KOLOM_HHTB' => "AB",
|
|
'NILAI_HHTB' => $key['KREDIT']
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
|
|
if ($kras>0) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => "9999",
|
|
'KOLOM_HHTB' => "AA",
|
|
'NILAI_HHTB' => $kras
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
} else if ($key['KODE_PERKIRAAN']==1110) {
|
|
|
|
} else {
|
|
if ($key['DEBET']>0) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => $key['KODE_PERKIRAAN'],
|
|
'KOLOM_HHTB' => "AA",
|
|
'NILAI_HHTB' => $key['DEBET']
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
if ($key['KREDIT']>0) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => $key['KODE_PERKIRAAN'],
|
|
'KOLOM_HHTB' => "AB",
|
|
'NILAI_HHTB' => $key['KREDIT']
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
}
|
|
}
|
|
|
|
//Hasilkan BCA YAS 1199
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byBANK_byPERIODE_groupPERKIRAAN_kasbankOnly(11, $awal, $akhir);
|
|
foreach ($datDak as $key) {
|
|
if ($key['KODE_PERKIRAAN']==1120) {
|
|
// Terima Ayat Silang
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byASBANK_byPERIODE(11, $awal, $akhir);
|
|
if ($sumDak[0]['DEBET']==NULL) { $tras = 0; } else { $tras = $sumDak[0]['DEBET']; }
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => "1123",
|
|
'KOLOM_HHTB' => "AC",
|
|
'NILAI_HHTB' => $key['DEBET']+$tras
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
|
|
if ($tras>0) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => "9999",
|
|
'KOLOM_HHTB' => "AD",
|
|
'NILAI_HHTB' => $tras
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
|
|
// Kirim Ayat Silang
|
|
$sumAs = $this->Amod->getSum_DaftarAkuntansi_byBANK_byPERIODE_asNotNull(11, $awal, $akhir);
|
|
if ($sumAs[0]['DEBET']==NULL) { $kras = 0; } else { $kras = $sumAs[0]['DEBET']; }
|
|
|
|
if ($key['AS_KAS']!=NULL) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => "1123",
|
|
'KOLOM_HHTB' => "AD",
|
|
'NILAI_HHTB' => $key['KREDIT']-$kras
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
} else {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => "1123",
|
|
'KOLOM_HHTB' => "AD",
|
|
'NILAI_HHTB' => $key['KREDIT']
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
|
|
if ($kras>0) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => "9999",
|
|
'KOLOM_HHTB' => "AC",
|
|
'NILAI_HHTB' => $kras
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
} else if ($key['KODE_PERKIRAAN']==1110) {
|
|
|
|
} else {
|
|
if ($key['DEBET']>0) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => $key['KODE_PERKIRAAN'],
|
|
'KOLOM_HHTB' => "AC",
|
|
'NILAI_HHTB' => $key['DEBET']
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
if ($key['KREDIT']>0) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => $key['KODE_PERKIRAAN'],
|
|
'KOLOM_HHTB' => "AD",
|
|
'NILAI_HHTB' => $key['KREDIT']
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
}
|
|
}
|
|
|
|
//Hasilkan YSS 6666
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byBANK_byPERIODE_groupPERKIRAAN_kasbankOnly(12, $awal, $akhir);
|
|
foreach ($datDak as $key) {
|
|
if ($key['KODE_PERKIRAAN']==1120) {
|
|
// Terima Ayat Silang
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byASBANK_byPERIODE(12, $awal, $akhir);
|
|
if ($sumDak[0]['DEBET']==NULL) { $tras = 0; } else { $tras = $sumDak[0]['DEBET']; }
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => "1124",
|
|
'KOLOM_HHTB' => "AE",
|
|
'NILAI_HHTB' => $key['DEBET']+$tras
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
|
|
if ($tras>0) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => "9999",
|
|
'KOLOM_HHTB' => "AF",
|
|
'NILAI_HHTB' => $tras
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
|
|
// Kirim Ayat Silang
|
|
$sumAs = $this->Amod->getSum_DaftarAkuntansi_byBANK_byPERIODE_asNotNull(12, $awal, $akhir);
|
|
if ($sumAs[0]['DEBET']==NULL) { $kras = 0; } else { $kras = $sumAs[0]['DEBET']; }
|
|
|
|
if ($key['AS_KAS']!=NULL) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => "1124",
|
|
'KOLOM_HHTB' => "AF",
|
|
'NILAI_HHTB' => $key['KREDIT']-$kras
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
} else {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => "1124",
|
|
'KOLOM_HHTB' => "AF",
|
|
'NILAI_HHTB' => $key['KREDIT']
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
|
|
if ($kras>0) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => "9999",
|
|
'KOLOM_HHTB' => "AE",
|
|
'NILAI_HHTB' => $kras
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
} else if ($key['KODE_PERKIRAAN']==1110) {
|
|
|
|
} else {
|
|
if ($key['DEBET']>0) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => $key['KODE_PERKIRAAN'],
|
|
'KOLOM_HHTB' => "AE",
|
|
'NILAI_HHTB' => $key['DEBET']
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
if ($key['KREDIT']>0) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => $key['KODE_PERKIRAAN'],
|
|
'KOLOM_HHTB' => "AF",
|
|
'NILAI_HHTB' => $key['KREDIT']
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
}
|
|
}
|
|
|
|
//Hasilkan BNI YSS
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byBANK_byPERIODE_groupPERKIRAAN_kasbankOnly(13, $awal, $akhir);
|
|
foreach ($datDak as $key) {
|
|
if ($key['KODE_PERKIRAAN']==1120) {
|
|
// Terima Ayat Silang
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byASBANK_byPERIODE(13, $awal, $akhir);
|
|
if ($sumDak[0]['DEBET']==NULL) { $tras = 0; } else { $tras = $sumDak[0]['DEBET']; }
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => "1125",
|
|
'KOLOM_HHTB' => "AG",
|
|
'NILAI_HHTB' => $key['DEBET']+$tras
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
|
|
if ($tras>0) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => "9999",
|
|
'KOLOM_HHTB' => "AH",
|
|
'NILAI_HHTB' => $tras
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
|
|
// Kirim Ayat Silang
|
|
$sumAs = $this->Amod->getSum_DaftarAkuntansi_byBANK_byPERIODE_asNotNull(13, $awal, $akhir);
|
|
if ($sumAs[0]['DEBET']==NULL) { $kras = 0; } else { $kras = $sumAs[0]['DEBET']; }
|
|
|
|
if ($key['AS_KAS']!=NULL) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => "1125",
|
|
'KOLOM_HHTB' => "AH",
|
|
'NILAI_HHTB' => $key['KREDIT']-$kras
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
} else {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => "1125",
|
|
'KOLOM_HHTB' => "AH",
|
|
'NILAI_HHTB' => $key['KREDIT']
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
|
|
if ($kras>0) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => "9999",
|
|
'KOLOM_HHTB' => "AG",
|
|
'NILAI_HHTB' => $kras
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
} else if ($key['KODE_PERKIRAAN']==1110) {
|
|
|
|
} else {
|
|
if ($key['DEBET']>0) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => $key['KODE_PERKIRAAN'],
|
|
'KOLOM_HHTB' => "AG",
|
|
'NILAI_HHTB' => $key['DEBET']
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
if ($key['KREDIT']>0) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => $key['KODE_PERKIRAAN'],
|
|
'KOLOM_HHTB' => "AH",
|
|
'NILAI_HHTB' => $key['KREDIT']
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
}
|
|
}
|
|
|
|
//Hasilkan MANDIRI YSS
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byBANK_byPERIODE_groupPERKIRAAN_kasbankOnly(14, $awal, $akhir);
|
|
foreach ($datDak as $key) {
|
|
if ($key['KODE_PERKIRAAN']==1120) {
|
|
// Terima Ayat Silang
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byASBANK_byPERIODE(14, $awal, $akhir);
|
|
if ($sumDak[0]['DEBET']==NULL) { $tras = 0; } else { $tras = $sumDak[0]['DEBET']; }
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => "1126",
|
|
'KOLOM_HHTB' => "AI",
|
|
'NILAI_HHTB' => $key['DEBET']+$tras
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
|
|
if ($tras>0) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => "9999",
|
|
'KOLOM_HHTB' => "AJ",
|
|
'NILAI_HHTB' => $tras
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
|
|
// Kirim Ayat Silang
|
|
$sumAs = $this->Amod->getSum_DaftarAkuntansi_byBANK_byPERIODE_asNotNull(14, $awal, $akhir);
|
|
if ($sumAs[0]['DEBET']==NULL) { $kras = 0; } else { $kras = $sumAs[0]['DEBET']; }
|
|
|
|
if ($key['AS_KAS']!=NULL) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => "1126",
|
|
'KOLOM_HHTB' => "AJ",
|
|
'NILAI_HHTB' => $key['KREDIT']-$kras
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
} else {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => "1126",
|
|
'KOLOM_HHTB' => "AJ",
|
|
'NILAI_HHTB' => $key['KREDIT']
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
|
|
if ($kras>0) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => "9999",
|
|
'KOLOM_HHTB' => "AI",
|
|
'NILAI_HHTB' => $kras
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
} else if ($key['KODE_PERKIRAAN']==1110) {
|
|
|
|
} else {
|
|
if ($key['DEBET']>0) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => $key['KODE_PERKIRAAN'],
|
|
'KOLOM_HHTB' => "AI",
|
|
'NILAI_HHTB' => $key['DEBET']
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
if ($key['KREDIT']>0) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => $key['KODE_PERKIRAAN'],
|
|
'KOLOM_HHTB' => "AJ",
|
|
'NILAI_HHTB' => $key['KREDIT']
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
}
|
|
}
|
|
|
|
//Hasilkan BCA SFTR
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byBANK_byPERIODE_groupPERKIRAAN_kasbankOnly(15, $awal, $akhir);
|
|
foreach ($datDak as $key) {
|
|
if ($key['KODE_PERKIRAAN']==1120) {
|
|
// Terima Ayat Silang
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byASBANK_byPERIODE(15, $awal, $akhir);
|
|
if ($sumDak[0]['DEBET']==NULL) { $tras = 0; } else { $tras = $sumDak[0]['DEBET']; }
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => "1127",
|
|
'KOLOM_HHTB' => "AK",
|
|
'NILAI_HHTB' => $key['DEBET']+$tras
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
|
|
if ($tras>0) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => "9999",
|
|
'KOLOM_HHTB' => "AL",
|
|
'NILAI_HHTB' => $tras
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
|
|
// Kirim Ayat Silang
|
|
$sumAs = $this->Amod->getSum_DaftarAkuntansi_byBANK_byPERIODE_asNotNull(15, $awal, $akhir);
|
|
if ($sumAs[0]['DEBET']==NULL) { $kras = 0; } else { $kras = $sumAs[0]['DEBET']; }
|
|
|
|
if ($key['AS_KAS']!=NULL) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => "1127",
|
|
'KOLOM_HHTB' => "AL",
|
|
'NILAI_HHTB' => $key['KREDIT']-$kras
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
} else {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => "1127",
|
|
'KOLOM_HHTB' => "AL",
|
|
'NILAI_HHTB' => $key['KREDIT']
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
|
|
if ($kras>0) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => "9999",
|
|
'KOLOM_HHTB' => "AK",
|
|
'NILAI_HHTB' => $kras
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
} else if ($key['KODE_PERKIRAAN']==1110) {
|
|
|
|
} else {
|
|
if ($key['DEBET']>0) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => $key['KODE_PERKIRAAN'],
|
|
'KOLOM_HHTB' => "AK",
|
|
'NILAI_HHTB' => $key['DEBET']
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
if ($key['KREDIT']>0) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => $key['KODE_PERKIRAAN'],
|
|
'KOLOM_HHTB' => "AL",
|
|
'NILAI_HHTB' => $key['KREDIT']
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
}
|
|
}
|
|
|
|
//Hasilkan BCA LOUIS
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byBANK_byPERIODE_groupPERKIRAAN_kasbankOnly(16, $awal, $akhir);
|
|
foreach ($datDak as $key) {
|
|
if ($key['KODE_PERKIRAAN']==1120) {
|
|
// Terima Ayat Silang
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byASBANK_byPERIODE(16, $awal, $akhir);
|
|
if ($sumDak[0]['DEBET']==NULL) { $tras = 0; } else { $tras = $sumDak[0]['DEBET']; }
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => "1128",
|
|
'KOLOM_HHTB' => "AM",
|
|
'NILAI_HHTB' => $key['DEBET']+$tras
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
|
|
if ($tras>0) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => "9999",
|
|
'KOLOM_HHTB' => "AN",
|
|
'NILAI_HHTB' => $tras
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
|
|
// Kirim Ayat Silang
|
|
$sumAs = $this->Amod->getSum_DaftarAkuntansi_byBANK_byPERIODE_asNotNull(16, $awal, $akhir);
|
|
if ($sumAs[0]['DEBET']==NULL) { $kras = 0; } else { $kras = $sumAs[0]['DEBET']; }
|
|
|
|
if ($key['AS_KAS']!=NULL) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => "1128",
|
|
'KOLOM_HHTB' => "AN",
|
|
'NILAI_HHTB' => $key['KREDIT']-$kras
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
} else {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => "1128",
|
|
'KOLOM_HHTB' => "AN",
|
|
'NILAI_HHTB' => $key['KREDIT']
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
|
|
if ($kras>0) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => "9999",
|
|
'KOLOM_HHTB' => "AM",
|
|
'NILAI_HHTB' => $kras
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
} else if ($key['KODE_PERKIRAAN']==1110) {
|
|
|
|
} else {
|
|
if ($key['DEBET']>0) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => $key['KODE_PERKIRAAN'],
|
|
'KOLOM_HHTB' => "AM",
|
|
'NILAI_HHTB' => $key['DEBET']
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
if ($key['KREDIT']>0) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => $key['KODE_PERKIRAAN'],
|
|
'KOLOM_HHTB' => "AN",
|
|
'NILAI_HHTB' => $key['KREDIT']
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
}
|
|
}
|
|
|
|
//Hasilkan BCA JASON
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byBANK_byPERIODE_groupPERKIRAAN_kasbankOnly(17, $awal, $akhir);
|
|
foreach ($datDak as $key) {
|
|
if ($key['KODE_PERKIRAAN']==1120) {
|
|
// Terima Ayat Silang
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byASBANK_byPERIODE(17, $awal, $akhir);
|
|
if ($sumDak[0]['DEBET']==NULL) { $tras = 0; } else { $tras = $sumDak[0]['DEBET']; }
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => "1129",
|
|
'KOLOM_HHTB' => "AO",
|
|
'NILAI_HHTB' => $key['DEBET']+$tras
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
|
|
if ($tras>0) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => "9999",
|
|
'KOLOM_HHTB' => "AP",
|
|
'NILAI_HHTB' => $tras
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
|
|
// Kirim Ayat Silang
|
|
$sumAs = $this->Amod->getSum_DaftarAkuntansi_byBANK_byPERIODE_asNotNull(17, $awal, $akhir);
|
|
if ($sumAs[0]['DEBET']==NULL) { $kras = 0; } else { $kras = $sumAs[0]['DEBET']; }
|
|
|
|
if ($key['AS_KAS']!=NULL) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => "1129",
|
|
'KOLOM_HHTB' => "AP",
|
|
'NILAI_HHTB' => $key['KREDIT']-$kras
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
} else {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => "1129",
|
|
'KOLOM_HHTB' => "AP",
|
|
'NILAI_HHTB' => $key['KREDIT']
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
|
|
if ($kras>0) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => "9999",
|
|
'KOLOM_HHTB' => "AO",
|
|
'NILAI_HHTB' => $kras
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
} else if ($key['KODE_PERKIRAAN']==1110) {
|
|
|
|
} else {
|
|
if ($key['DEBET']>0) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => $key['KODE_PERKIRAAN'],
|
|
'KOLOM_HHTB' => "AO",
|
|
'NILAI_HHTB' => $key['DEBET']
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
if ($key['KREDIT']>0) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => $key['KODE_PERKIRAAN'],
|
|
'KOLOM_HHTB' => "AP",
|
|
'NILAI_HHTB' => $key['KREDIT']
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
}
|
|
}
|
|
|
|
// Jurnal Memo
|
|
$datKas = $this->Amod->getData_DaftarAkuntansi_byKAS_byPERIODE_groupPERKIRAAN_jurnalMemoOnly(1, $awal, $akhir);
|
|
if ($datKas[0]['DEBET']!=NULL) {
|
|
if ($datKas[0]['DEBET']>0) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => '1111',
|
|
'KOLOM_HHTB' => "AQ",
|
|
'NILAI_HHTB' => $datKas[0]['DEBET']
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
if ($datKas[0]['KREDIT']>0) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => '1111',
|
|
'KOLOM_HHTB' => "AR",
|
|
'NILAI_HHTB' => $datKas[0]['KREDIT']
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
}
|
|
|
|
$dakKas = $this->Amod->getData_DaftarAkuntansi_byKAS_byPERIODE_groupPERKIRAAN_jurnalMemoOnly(2, $awal, $akhir);
|
|
if ($datKas[0]['DEBET']!=NULL) {
|
|
if ($datKas[0]['DEBET']>0) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => '1112',
|
|
'KOLOM_HHTB' => "AQ",
|
|
'NILAI_HHTB' => $datKas[0]['DEBET']
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
if ($datKas[0]['KREDIT']>0) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => '1112',
|
|
'KOLOM_HHTB' => "AR",
|
|
'NILAI_HHTB' => $datKas[0]['KREDIT']
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
}
|
|
|
|
$dakBank = $this->Amod->getData_DaftarAkuntansi_byBANK_byPERIODE_groupPERKIRAAN_jurnalMemoOnly(1, $awal, $akhir);
|
|
if ($dakBank[0]['DEBET']!=NULL) {
|
|
if ($dakBank[0]['DEBET']>0) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => '1113',
|
|
'KOLOM_HHTB' => "AQ",
|
|
'NILAI_HHTB' => $dakBank[0]['DEBET']
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
if ($dakBank[0]['KREDIT']>0) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => '1113',
|
|
'KOLOM_HHTB' => "AR",
|
|
'NILAI_HHTB' => $dakBank[0]['KREDIT']
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
}
|
|
|
|
$dakBank = $this->Amod->getData_DaftarAkuntansi_byBANK_byPERIODE_groupPERKIRAAN_jurnalMemoOnly(2, $awal, $akhir);
|
|
if ($dakBank[0]['DEBET']!=NULL) {
|
|
if ($dakBank[0]['DEBET']>0) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => '1114',
|
|
'KOLOM_HHTB' => "AQ",
|
|
'NILAI_HHTB' => $dakBank[0]['DEBET']
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
if ($dakBank[0]['KREDIT']>0) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => '1114',
|
|
'KOLOM_HHTB' => "AR",
|
|
'NILAI_HHTB' => $dakBank[0]['KREDIT']
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
}
|
|
|
|
$dakBank = $this->Amod->getData_DaftarAkuntansi_byBANK_byPERIODE_groupPERKIRAAN_jurnalMemoOnly(3, $awal, $akhir);
|
|
if ($dakBank[0]['DEBET']!=NULL) {
|
|
if ($dakBank[0]['DEBET']>0) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => '1115',
|
|
'KOLOM_HHTB' => "AQ",
|
|
'NILAI_HHTB' => $dakBank[0]['DEBET']
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
if ($dakBank[0]['KREDIT']>0) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => '1115',
|
|
'KOLOM_HHTB' => "AR",
|
|
'NILAI_HHTB' => $dakBank[0]['KREDIT']
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
}
|
|
|
|
$dakBank = $this->Amod->getData_DaftarAkuntansi_byBANK_byPERIODE_groupPERKIRAAN_jurnalMemoOnly(4, $awal, $akhir);
|
|
if ($dakBank[0]['DEBET']!=NULL) {
|
|
if ($dakBank[0]['DEBET']>0) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => '1116',
|
|
'KOLOM_HHTB' => "AQ",
|
|
'NILAI_HHTB' => $dakBank[0]['DEBET']
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
if ($dakBank[0]['KREDIT']>0) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => '1116',
|
|
'KOLOM_HHTB' => "AR",
|
|
'NILAI_HHTB' => $dakBank[0]['KREDIT']
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
}
|
|
|
|
$dakBank = $this->Amod->getData_DaftarAkuntansi_byBANK_byPERIODE_groupPERKIRAAN_jurnalMemoOnly(5, $awal, $akhir);
|
|
if ($dakBank[0]['DEBET']!=NULL) {
|
|
if ($dakBank[0]['DEBET']>0) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => '1117',
|
|
'KOLOM_HHTB' => "AQ",
|
|
'NILAI_HHTB' => $dakBank[0]['DEBET']
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
if ($dakBank[0]['KREDIT']>0) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => '1117',
|
|
'KOLOM_HHTB' => "AR",
|
|
'NILAI_HHTB' => $dakBank[0]['KREDIT']
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
}
|
|
|
|
$dakBank = $this->Amod->getData_DaftarAkuntansi_byBANK_byPERIODE_groupPERKIRAAN_jurnalMemoOnly(6, $awal, $akhir);
|
|
if ($dakBank[0]['DEBET']!=NULL) {
|
|
if ($dakBank[0]['DEBET']>0) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => '1118',
|
|
'KOLOM_HHTB' => "AQ",
|
|
'NILAI_HHTB' => $dakBank[0]['DEBET']
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
if ($dakBank[0]['KREDIT']>0) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => '1118',
|
|
'KOLOM_HHTB' => "AR",
|
|
'NILAI_HHTB' => $dakBank[0]['KREDIT']
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
}
|
|
|
|
$dakBank = $this->Amod->getData_DaftarAkuntansi_byBANK_byPERIODE_groupPERKIRAAN_jurnalMemoOnly(7, $awal, $akhir);
|
|
if ($dakBank[0]['DEBET']!=NULL) {
|
|
if ($dakBank[0]['DEBET']>0) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => '1119',
|
|
'KOLOM_HHTB' => "AQ",
|
|
'NILAI_HHTB' => $dakBank[0]['DEBET']
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
if ($dakBank[0]['KREDIT']>0) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => '1119',
|
|
'KOLOM_HHTB' => "AR",
|
|
'NILAI_HHTB' => $dakBank[0]['KREDIT']
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
}
|
|
|
|
$dakBank = $this->Amod->getData_DaftarAkuntansi_byBANK_byPERIODE_groupPERKIRAAN_jurnalMemoOnly(8, $awal, $akhir);
|
|
if ($dakBank[0]['DEBET']!=NULL) {
|
|
if ($dakBank[0]['DEBET']>0) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => '1120',
|
|
'KOLOM_HHTB' => "AQ",
|
|
'NILAI_HHTB' => $dakBank[0]['DEBET']
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
if ($dakBank[0]['KREDIT']>0) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => '1120',
|
|
'KOLOM_HHTB' => "AR",
|
|
'NILAI_HHTB' => $dakBank[0]['KREDIT']
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
}
|
|
|
|
$dakBank = $this->Amod->getData_DaftarAkuntansi_byBANK_byPERIODE_groupPERKIRAAN_jurnalMemoOnly(9, $awal, $akhir);
|
|
if ($dakBank[0]['DEBET']!=NULL) {
|
|
if ($dakBank[0]['DEBET']>0) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => '1121',
|
|
'KOLOM_HHTB' => "AQ",
|
|
'NILAI_HHTB' => $dakBank[0]['DEBET']
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
if ($dakBank[0]['KREDIT']>0) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => '1121',
|
|
'KOLOM_HHTB' => "AR",
|
|
'NILAI_HHTB' => $dakBank[0]['KREDIT']
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
}
|
|
|
|
$dakBank = $this->Amod->getData_DaftarAkuntansi_byBANK_byPERIODE_groupPERKIRAAN_jurnalMemoOnly(10, $awal, $akhir);
|
|
if ($dakBank[0]['DEBET']!=NULL) {
|
|
if ($dakBank[0]['DEBET']>0) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => '1122',
|
|
'KOLOM_HHTB' => "AQ",
|
|
'NILAI_HHTB' => $dakBank[0]['DEBET']
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
if ($dakBank[0]['KREDIT']>0) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => '1122',
|
|
'KOLOM_HHTB' => "AR",
|
|
'NILAI_HHTB' => $dakBank[0]['KREDIT']
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
}
|
|
|
|
$dakBank = $this->Amod->getData_DaftarAkuntansi_byBANK_byPERIODE_groupPERKIRAAN_jurnalMemoOnly(11, $awal, $akhir);
|
|
if ($dakBank[0]['DEBET']!=NULL) {
|
|
if ($dakBank[0]['DEBET']>0) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => '1123',
|
|
'KOLOM_HHTB' => "AQ",
|
|
'NILAI_HHTB' => $dakBank[0]['DEBET']
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
if ($dakBank[0]['KREDIT']>0) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => '1123',
|
|
'KOLOM_HHTB' => "AR",
|
|
'NILAI_HHTB' => $dakBank[0]['KREDIT']
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
}
|
|
|
|
$dakBank = $this->Amod->getData_DaftarAkuntansi_byBANK_byPERIODE_groupPERKIRAAN_jurnalMemoOnly(12, $awal, $akhir);
|
|
if ($dakBank[0]['DEBET']!=NULL) {
|
|
if ($dakBank[0]['DEBET']>0) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => '1124',
|
|
'KOLOM_HHTB' => "AQ",
|
|
'NILAI_HHTB' => $dakBank[0]['DEBET']
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
if ($dakBank[0]['KREDIT']>0) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => '1124',
|
|
'KOLOM_HHTB' => "AR",
|
|
'NILAI_HHTB' => $dakBank[0]['KREDIT']
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
}
|
|
|
|
$dakBank = $this->Amod->getData_DaftarAkuntansi_byBANK_byPERIODE_groupPERKIRAAN_jurnalMemoOnly(13, $awal, $akhir);
|
|
if ($dakBank[0]['DEBET']!=NULL) {
|
|
if ($dakBank[0]['DEBET']>0) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => '1125',
|
|
'KOLOM_HHTB' => "AQ",
|
|
'NILAI_HHTB' => $dakBank[0]['DEBET']
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
if ($dakBank[0]['KREDIT']>0) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => '1125',
|
|
'KOLOM_HHTB' => "AR",
|
|
'NILAI_HHTB' => $dakBank[0]['KREDIT']
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
}
|
|
|
|
$dakBank = $this->Amod->getData_DaftarAkuntansi_byBANK_byPERIODE_groupPERKIRAAN_jurnalMemoOnly(14, $awal, $akhir);
|
|
if ($dakBank[0]['DEBET']!=NULL) {
|
|
if ($dakBank[0]['DEBET']>0) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => '1126',
|
|
'KOLOM_HHTB' => "AQ",
|
|
'NILAI_HHTB' => $dakBank[0]['DEBET']
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
if ($dakBank[0]['KREDIT']>0) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => '1126',
|
|
'KOLOM_HHTB' => "AR",
|
|
'NILAI_HHTB' => $dakBank[0]['KREDIT']
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
}
|
|
|
|
$dakBank = $this->Amod->getData_DaftarAkuntansi_byBANK_byPERIODE_groupPERKIRAAN_jurnalMemoOnly(15, $awal, $akhir);
|
|
if ($dakBank[0]['DEBET']!=NULL) {
|
|
if ($dakBank[0]['DEBET']>0) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => '1127',
|
|
'KOLOM_HHTB' => "AQ",
|
|
'NILAI_HHTB' => $dakBank[0]['DEBET']
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
if ($dakBank[0]['KREDIT']>0) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => '1127',
|
|
'KOLOM_HHTB' => "AR",
|
|
'NILAI_HHTB' => $dakBank[0]['KREDIT']
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
}
|
|
|
|
$dakBank = $this->Amod->getData_DaftarAkuntansi_byBANK_byPERIODE_groupPERKIRAAN_jurnalMemoOnly(16, $awal, $akhir);
|
|
if ($dakBank[0]['DEBET']!=NULL) {
|
|
if ($dakBank[0]['DEBET']>0) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => '1128',
|
|
'KOLOM_HHTB' => "AQ",
|
|
'NILAI_HHTB' => $dakBank[0]['DEBET']
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
if ($dakBank[0]['KREDIT']>0) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => '1128',
|
|
'KOLOM_HHTB' => "AR",
|
|
'NILAI_HHTB' => $dakBank[0]['KREDIT']
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
}
|
|
|
|
$dakBank = $this->Amod->getData_DaftarAkuntansi_byBANK_byPERIODE_groupPERKIRAAN_jurnalMemoOnly(17, $awal, $akhir);
|
|
if ($dakBank[0]['DEBET']!=NULL) {
|
|
if ($dakBank[0]['DEBET']>0) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => '1129',
|
|
'KOLOM_HHTB' => "AQ",
|
|
'NILAI_HHTB' => $dakBank[0]['DEBET']
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
if ($dakBank[0]['KREDIT']>0) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => '1129',
|
|
'KOLOM_HHTB' => "AR",
|
|
'NILAI_HHTB' => $dakBank[0]['KREDIT']
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
}
|
|
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byPERIODE_groupPERKIRAAN_jurnalMemoOnly_notKasbank($awal, $akhir);
|
|
foreach ($datDak as $key) {
|
|
if ($key['DEBET']>0) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => $key['KODE_PERKIRAAN'],
|
|
'KOLOM_HHTB' => "AQ",
|
|
'NILAI_HHTB' => $key['DEBET']
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
if ($key['KREDIT']>0) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => $key['KODE_PERKIRAAN'],
|
|
'KOLOM_HHTB' => "AR",
|
|
'NILAI_HHTB' => $key['KREDIT']
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
}
|
|
|
|
//Jurnal Sistem
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byPERIODE_groupPERKIRAAN_penjualanOnly($awal, $akhir);
|
|
foreach ($datDak as $key) {
|
|
if ($key['DEBET']>0) {
|
|
$datHhtb = $this->Amod->getData_HasilHitungTb_byPAK_byAKUN_byKOLOM($id_pak, $key['KODE_PERKIRAAN'], "AS");
|
|
if ($datHhtb==FALSE) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => $key['KODE_PERKIRAAN'],
|
|
'KOLOM_HHTB' => "AS",
|
|
'NILAI_HHTB' => $key['DEBET']
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
} else {
|
|
$nilaiBaru = $datHhtb[0]['NILAI_HHTB']+$key['DEBET'];
|
|
$update = [
|
|
'NILAI_HHTB' => $nilaiBaru
|
|
];
|
|
$action = $this->Amod->update('hasil_hitungtb', $update, 'ID_HHTB', $datHhtb[0]['ID_HHTB']);
|
|
}
|
|
}
|
|
if ($key['KREDIT']>0) {
|
|
$datHhtb = $this->Amod->getData_HasilHitungTb_byPAK_byAKUN_byKOLOM($id_pak, $key['KODE_PERKIRAAN'], "AT");
|
|
if ($datHhtb==FALSE) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => $key['KODE_PERKIRAAN'],
|
|
'KOLOM_HHTB' => "AT",
|
|
'NILAI_HHTB' => $key['KREDIT']
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
} else {
|
|
$nilaiBaru = $datHhtb[0]['NILAI_HHTB']+$key['KREDIT'];
|
|
$update = [
|
|
'NILAI_HHTB' => $nilaiBaru
|
|
];
|
|
$action = $this->Amod->update('hasil_hitungtb', $update, 'ID_HHTB', $datHhtb[0]['ID_HHTB']);
|
|
}
|
|
}
|
|
}
|
|
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byPERIODE_groupPERKIRAAN_returJualOnly($awal, $akhir);
|
|
foreach ($datDak as $key) {
|
|
if ($key['DEBET']>0) {
|
|
$datHhtb = $this->Amod->getData_HasilHitungTb_byPAK_byAKUN_byKOLOM($id_pak, $key['KODE_PERKIRAAN'], "AS");
|
|
if ($datHhtb==FALSE) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => $key['KODE_PERKIRAAN'],
|
|
'KOLOM_HHTB' => "AS",
|
|
'NILAI_HHTB' => $key['DEBET']
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
} else {
|
|
$nilaiBaru = $datHhtb[0]['NILAI_HHTB']+$key['DEBET'];
|
|
$update = [
|
|
'NILAI_HHTB' => $nilaiBaru
|
|
];
|
|
$action = $this->Amod->update('hasil_hitungtb', $update, 'ID_HHTB', $datHhtb[0]['ID_HHTB']);
|
|
}
|
|
}
|
|
if ($key['KREDIT']>0) {
|
|
$datHhtb = $this->Amod->getData_HasilHitungTb_byPAK_byAKUN_byKOLOM($id_pak, $key['KODE_PERKIRAAN'], "AT");
|
|
if ($datHhtb==FALSE) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => $key['KODE_PERKIRAAN'],
|
|
'KOLOM_HHTB' => "AT",
|
|
'NILAI_HHTB' => $key['KREDIT']
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
} else {
|
|
$nilaiBaru = $datHhtb[0]['NILAI_HHTB']+$key['KREDIT'];
|
|
$update = [
|
|
'NILAI_HHTB' => $nilaiBaru
|
|
];
|
|
$action = $this->Amod->update('hasil_hitungtb', $update, 'ID_HHTB', $datHhtb[0]['ID_HHTB']);
|
|
}
|
|
}
|
|
}
|
|
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byPERIODE_groupPERKIRAAN_pembelianOnly($awal, $akhir);
|
|
foreach ($datDak as $key) {
|
|
if ($key['DEBET']>0) {
|
|
$datHhtb = $this->Amod->getData_HasilHitungTb_byPAK_byAKUN_byKOLOM($id_pak, $key['KODE_PERKIRAAN'], "AS");
|
|
if ($datHhtb==FALSE) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => $key['KODE_PERKIRAAN'],
|
|
'KOLOM_HHTB' => "AS",
|
|
'NILAI_HHTB' => $key['DEBET']
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
} else {
|
|
$nilaiBaru = $datHhtb[0]['NILAI_HHTB']+$key['DEBET'];
|
|
$update = [
|
|
'NILAI_HHTB' => $nilaiBaru
|
|
];
|
|
$action = $this->Amod->update('hasil_hitungtb', $update, 'ID_HHTB', $datHhtb[0]['ID_HHTB']);
|
|
}
|
|
}
|
|
if ($key['KREDIT']>0) {
|
|
$datHhtb = $this->Amod->getData_HasilHitungTb_byPAK_byAKUN_byKOLOM($id_pak, $key['KODE_PERKIRAAN'], "AT");
|
|
if ($datHhtb==FALSE) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => $key['KODE_PERKIRAAN'],
|
|
'KOLOM_HHTB' => "AT",
|
|
'NILAI_HHTB' => $key['KREDIT']
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
} else {
|
|
$nilaiBaru = $datHhtb[0]['NILAI_HHTB']+$key['KREDIT'];
|
|
$update = [
|
|
'NILAI_HHTB' => $nilaiBaru
|
|
];
|
|
$action = $this->Amod->update('hasil_hitungtb', $update, 'ID_HHTB', $datHhtb[0]['ID_HHTB']);
|
|
}
|
|
}
|
|
}
|
|
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byPERIODE_groupPERKIRAAN_returBeliOnly($awal, $akhir);
|
|
foreach ($datDak as $key) {
|
|
if ($key['DEBET']>0) {
|
|
$datHhtb = $this->Amod->getData_HasilHitungTb_byPAK_byAKUN_byKOLOM($id_pak, $key['KODE_PERKIRAAN'], "AS");
|
|
if ($datHhtb==FALSE) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => $key['KODE_PERKIRAAN'],
|
|
'KOLOM_HHTB' => "AS",
|
|
'NILAI_HHTB' => $key['DEBET']
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
} else {
|
|
$nilaiBaru = $datHhtb[0]['NILAI_HHTB']+$key['DEBET'];
|
|
$update = [
|
|
'NILAI_HHTB' => $nilaiBaru
|
|
];
|
|
$action = $this->Amod->update('hasil_hitungtb', $update, 'ID_HHTB', $datHhtb[0]['ID_HHTB']);
|
|
}
|
|
}
|
|
if ($key['KREDIT']>0) {
|
|
$datHhtb = $this->Amod->getData_HasilHitungTb_byPAK_byAKUN_byKOLOM($id_pak, $key['KODE_PERKIRAAN'], "AT");
|
|
if ($datHhtb==FALSE) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => $key['KODE_PERKIRAAN'],
|
|
'KOLOM_HHTB' => "AT",
|
|
'NILAI_HHTB' => $key['KREDIT']
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
} else {
|
|
$nilaiBaru = $datHhtb[0]['NILAI_HHTB']+$key['KREDIT'];
|
|
$update = [
|
|
'NILAI_HHTB' => $nilaiBaru
|
|
];
|
|
$action = $this->Amod->update('hasil_hitungtb', $update, 'ID_HHTB', $datHhtb[0]['ID_HHTB']);
|
|
}
|
|
}
|
|
}
|
|
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byPERIODE_groupPERKIRAAN_jurnalSistemOnly($awal, $akhir);
|
|
foreach ($datDak as $key) {
|
|
if ($key['DEBET']>0) {
|
|
$datHhtb = $this->Amod->getData_HasilHitungTb_byPAK_byAKUN_byKOLOM($id_pak, $key['KODE_PERKIRAAN'], "AS");
|
|
if ($datHhtb==FALSE) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => $key['KODE_PERKIRAAN'],
|
|
'KOLOM_HHTB' => "AS",
|
|
'NILAI_HHTB' => $key['DEBET']
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
} else {
|
|
$nilaiBaru = $datHhtb[0]['NILAI_HHTB']+$key['DEBET'];
|
|
$update = [
|
|
'NILAI_HHTB' => $nilaiBaru
|
|
];
|
|
$action = $this->Amod->update('hasil_hitungtb', $update, 'ID_HHTB', $datHhtb[0]['ID_HHTB']);
|
|
}
|
|
}
|
|
if ($key['KREDIT']>0) {
|
|
$datHhtb = $this->Amod->getData_HasilHitungTb_byPAK_byAKUN_byKOLOM($id_pak, $key['KODE_PERKIRAAN'], "AT");
|
|
if ($datHhtb==FALSE) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => $key['KODE_PERKIRAAN'],
|
|
'KOLOM_HHTB' => "AT",
|
|
'NILAI_HHTB' => $key['KREDIT']
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
} else {
|
|
$nilaiBaru = $datHhtb[0]['NILAI_HHTB']+$key['KREDIT'];
|
|
$update = [
|
|
'NILAI_HHTB' => $nilaiBaru
|
|
];
|
|
$action = $this->Amod->update('hasil_hitungtb', $update, 'ID_HHTB', $datHhtb[0]['ID_HHTB']);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
public function GE_Kalkulasi_HistoriKuantiti($barang, $jenis, $transaksi, $qty, $kode, $inv, $spesifikId) {
|
|
$now = date('Y-m-d');
|
|
|
|
if ($jenis=="Step 2 - KELUARMASUK - Proses Barang") {
|
|
if ($transaksi==0) {
|
|
$datHq = $this->Amod->getData_HistoriKuantiti_byBARANG_orderDESC_limit1($barang);
|
|
$sisa_hq = $datHq[0]['SISA_HQ']-$qty;
|
|
if ($sisa_hq==0) {
|
|
$persediaan_hq = 0;
|
|
} else {
|
|
$persediaan_hq = round(($datHq[0]['PERSEDIAAN_HQ']-($datHq[0]['AVG_HQ']*$qty)),2);
|
|
}
|
|
|
|
$input = [
|
|
'TGL_HQ' => $now,
|
|
'KODE_BUKTI' => $kode,
|
|
'PERSEDIAAN_HQ' => $persediaan_hq,
|
|
'SISA_HQ' => $sisa_hq,
|
|
'AVG_HQ' => $datHq[0]['AVG_HQ'],
|
|
'BARANG_ID' => $barang,
|
|
'MASUK_HQ' => '0',
|
|
'KELUAR_HQ' => $qty,
|
|
'IO_ID' => $spesifikId
|
|
];
|
|
$action = $this->Amod->create('histori_kuantiti', $input);
|
|
|
|
$update = [
|
|
'PERSEDIAAN_KUANTITI' => $persediaan_hq
|
|
];
|
|
$action = $this->Amod->update('kuantiti', $update, 'ID_KUANTITI', $barang);
|
|
} else if ($transaksi==1) {
|
|
$datIo = $this->Amod->getData_TransaksiStock_byID($spesifikId);
|
|
$harga_io = $datIo[0]['HARGA_IO'];
|
|
|
|
$nilai_hq = $qty*$harga_io;
|
|
$datHq = $this->Amod->getData_HistoriKuantiti_byBARANG_orderDESC_limit1($barang);
|
|
if ($datHq==FALSE) {
|
|
$persediaan_hq = $nilai_hq;
|
|
$sisa_hq = $qty;
|
|
$avg_hq = $harga_io;
|
|
} else {
|
|
$persediaan_hq = $datHq[0]['PERSEDIAAN_HQ']+$nilai_hq;
|
|
$sisa_hq = $datHq[0]['SISA_HQ']+$qty;
|
|
$avg_hq = round(($persediaan_hq/$sisa_hq),2);
|
|
}
|
|
|
|
$input = [
|
|
'TGL_HQ' => $now,
|
|
'KODE_BUKTI' => $kode,
|
|
'PERSEDIAAN_HQ' => $persediaan_hq,
|
|
'SISA_HQ' => $sisa_hq,
|
|
'AVG_HQ' => $avg_hq,
|
|
'NILAI_HQ' => $nilai_hq,
|
|
'BARANG_ID' => $barang,
|
|
'KELUAR_HQ' => '0',
|
|
'MASUK_HQ' => $qty,
|
|
'IO_ID' => $spesifikId
|
|
];
|
|
$action = $this->Amod->create('histori_kuantiti', $input);
|
|
|
|
$update = [
|
|
'PERSEDIAAN_KUANTITI' => $persediaan_hq
|
|
];
|
|
$action = $this->Amod->update('kuantiti', $update, 'ID_KUANTITI', $barang);
|
|
}
|
|
} else if ($jenis=="Step 1 - PEMBELIAN - Proses Barang") {
|
|
$datDb = $this->Amod->getData_DaftarBeli_byID($spesifikId);
|
|
$harga_db = $datDb[0]['HARGA_DB'];
|
|
|
|
$nilai_hq = $qty*$harga_db;
|
|
$datHq = $this->Amod->getData_HistoriKuantiti_byBARANG_orderDESC_limit1($barang);
|
|
if ($datHq==FALSE) {
|
|
$persediaan_hq = $nilai_hq;
|
|
$sisa_hq = $qty;
|
|
$avg_hq = $harga_db;
|
|
} else {
|
|
$sisa_hq = $datHq[0]['SISA_HQ']+$qty;
|
|
$persediaan_hq = $datHq[0]['PERSEDIAAN_HQ']+$nilai_hq;
|
|
$avg_hq = round(($persediaan_hq/$sisa_hq),2);
|
|
}
|
|
|
|
$input = [
|
|
'TGL_HQ' => $now,
|
|
'KODE_BUKTI' => $kode,
|
|
'SJ_HQ' => $datDb[0]['SJ_PEMBELIAN'],
|
|
'INV_HQ' => $inv,
|
|
'PERSEDIAAN_HQ' => $persediaan_hq,
|
|
'NILAI_HQ' => $nilai_hq,
|
|
'SISA_HQ' => $sisa_hq,
|
|
'AVG_HQ' => $avg_hq,
|
|
'BARANG_ID' => $barang,
|
|
'KELUAR_HQ' => '0',
|
|
'MASUK_HQ' => $qty
|
|
];
|
|
$action = $this->Amod->create('histori_kuantiti', $input);
|
|
|
|
$update = [
|
|
'PERSEDIAAN_KUANTITI' => $persediaan_hq
|
|
];
|
|
$action = $this->Amod->update('kuantiti', $update, 'ID_KUANTITI', $barang);
|
|
} else if ($jenis=="Step 1 - PEMBELIAN - Ubah Barang") {
|
|
$sumDb = $this->Amod->getSum_DaftarBeli_byID($spesifikId);
|
|
if ($sumDb==FALSE OR $sumDb[0]['TOTAL']==NULL) {
|
|
$nilai_hq = 0;
|
|
} else {
|
|
$nilai_hq = $sumDb[0]['TOTAL'];
|
|
}
|
|
|
|
$datDb = $this->Amod->getData_DaftarBeli_byID($spesifikId);
|
|
|
|
$datHqUtama = $this->Amod->getData_HistoriKuantiti_byBARANG_byKODEBUKTI($barang, $kode);
|
|
$datHqBefore = $this->Amod->getData_HistoriKuantiti_byBARANG_orderDESC_limit1_beforeID($barang, $datHqUtama[0]['ID_HQ']);
|
|
if ($datHqBefore==FALSE) {
|
|
$persediaan_hq = $nilai_hq;
|
|
$avg_hq = $datDb[0]['HARGA_DB'];
|
|
} else {
|
|
$persediaan_hq = round(($nilai_hq+$datHqBefore[0]['PERSEDIAAN_HQ']),2);
|
|
$avg_hq = round(($persediaan_hq/$datHqUtama[0]['SISA_HQ']),2);
|
|
}
|
|
$update = [
|
|
'NILAI_HQ' => $nilai_hq,
|
|
'PERSEDIAAN_HQ' => $persediaan_hq,
|
|
'AVG_HQ' => $avg_hq
|
|
];
|
|
$action = $this->Amod->update('histori_kuantiti', $update, 'ID_HQ', $datHqUtama[0]['ID_HQ']);
|
|
|
|
$datHqAfter = $this->Amod->getData_HistoriKuantiti_byBARANG_afterID($barang, $datHqUtama[0]['ID_HQ']);
|
|
foreach ($datHqAfter as $dat) {
|
|
$datHqBeforeAfter = $this->Amod->getData_HistoriKuantiti_byBARANG_orderDESC_limit1_beforeID($dat['BARANG_ID'], $dat['ID_HQ']);
|
|
if ($dat['MASUK_HQ']==0) { // Transaksi Keluar
|
|
if ($datHqBeforeAfter[0]['SISA_HQ']==$dat['KELUAR_HQ']) {
|
|
$persediaan_hq = 0;
|
|
} else {
|
|
$persediaan_hq = round(($datHqBeforeAfter[0]['PERSEDIAAN_HQ']-($datHqBeforeAfter[0]['AVG_HQ']*$dat['KELUAR_HQ'])),2);
|
|
}
|
|
$update = [
|
|
'PERSEDIAAN_HQ' => $persediaan_hq,
|
|
'AVG_HQ' => $datHqBeforeAfter[0]['AVG_HQ']
|
|
];
|
|
} else if ($dat['KELUAR_HQ']==0) { // Transaksi Masuk
|
|
$sisa_hq = $datHqBeforeAfter[0]['SISA_HQ']+$dat['MASUK_HQ'];
|
|
$persediaan_hq = $datHqBeforeAfter[0]['PERSEDIAAN_HQ']+$dat['NILAI_HQ'];
|
|
$avg_hq = round(($persediaan_hq/$sisa_hq),2);
|
|
|
|
$update = [
|
|
'PERSEDIAAN_HQ' => $persediaan_hq,
|
|
'AVG_HQ' => $avg_hq,
|
|
];
|
|
}
|
|
$action = $this->Amod->update('histori_kuantiti', $update, 'ID_HQ', $dat['ID_HQ']);
|
|
}
|
|
|
|
$update = [
|
|
'PERSEDIAAN_KUANTITI' => $persediaan_hq
|
|
];
|
|
$action = $this->Amod->update('kuantiti', $update, 'ID_KUANTITI', $barang);
|
|
} else if ($jenis=="Step 1 - PEMBELIAN - Revisi Barang") {
|
|
$datHq = $this->Amod->getData_HistoriKuantiti_byKODE($kode);
|
|
$action = $this->Amod->delete('histori_kuantiti', $kode, 'KODE_BUKTI');
|
|
foreach ($datHq as $key) {
|
|
$datHqAfter = $this->Amod->getData_HistoriKuantiti_byBARANG_afterID($key['BARANG_ID'], $key['ID_HQ']);
|
|
foreach ($datHqAfter as $dat) {
|
|
$datHqBeforeTwo = $this->Amod->getData_HistoriKuantiti_byBARANG_orderDESC_limit1_beforeID($dat['BARANG_ID'], $dat['ID_HQ']);
|
|
if ($dat['MASUK_HQ']==0) { // Transaksi Keluar
|
|
$sisa_hq = $datHqBeforeTwo[0]['SISA_HQ']-$dat['KELUAR_HQ'];
|
|
if ($datHqBeforeTwo[0]['SISA_HQ']==$dat['KELUAR_HQ']) {
|
|
$persediaan_hq = 0;
|
|
} else {
|
|
$persediaan_hq = round(($datHqBeforeTwo[0]['PERSEDIAAN_HQ']-($datHqBeforeTwo[0]['AVG_HQ']*$dat['KELUAR_HQ'])),2);
|
|
}
|
|
$avg_hq = $datHqBeforeTwo[0]['AVG_HQ'];
|
|
|
|
$update = [
|
|
'SISA_HQ' => $sisa_hq,
|
|
'PERSEDIAAN_HQ' => $persediaan_hq,
|
|
'AVG_HQ' => $avg_hq
|
|
];
|
|
} else if ($dat['KELUAR_HQ']==0) { // Transaksi Masuk
|
|
$sisa_hq = $datHqBeforeTwo[0]['SISA_HQ']+$dat['MASUK_HQ'];
|
|
$persediaan_hq = $datHqBeforeTwo[0]['PERSEDIAAN_HQ']+$dat['NILAI_HQ'];
|
|
$avg_hq = round(($persediaan_hq/$sisa_hq),2);
|
|
|
|
$update = [
|
|
'SISA_HQ' => $sisa_hq,
|
|
'PERSEDIAAN_HQ' => $persediaan_hq,
|
|
'AVG_HQ' => $avg_hq,
|
|
];
|
|
}
|
|
$action = $this->Amod->update('histori_kuantiti', $update, 'ID_HQ', $dat['ID_HQ']);
|
|
|
|
$update = [
|
|
'PERSEDIAAN_KUANTITI' => $persediaan_hq
|
|
];
|
|
$action = $this->Amod->update('kuantiti', $update, 'ID_KUANTITI', $dat['BARANG_ID']);
|
|
}
|
|
}
|
|
} else if ($jenis=="Step 2 - PEMBELIAN - Kunci Retur") {
|
|
$datRb = $this->Amod->getData_ReturPembelian_byID_bySTATUS($spesifikId, 0);
|
|
|
|
$datHq = $this->Amod->getData_HistoriKuantiti_byBARANG_orderDESC_limit1($barang);
|
|
$sisa_hq = $datHq[0]['SISA_HQ']-$qty;
|
|
if ($sisa_hq==0) {
|
|
$persediaan_hq = 0;
|
|
} else {
|
|
$persediaan_hq = round(($datHq[0]['PERSEDIAAN_HQ']-($datHq[0]['AVG_HQ']*$qty)),2);
|
|
}
|
|
$input = [
|
|
'TGL_HQ' => $now,
|
|
'KODE_BUKTI' => $datRb[0]['KODE_RB'],
|
|
'INV_HQ' => $kode,
|
|
'PERSEDIAAN_HQ' => $persediaan_hq,
|
|
'SISA_HQ' => $sisa_hq,
|
|
'AVG_HQ' => $datHq[0]['AVG_HQ'],
|
|
'BARANG_ID' => $barang,
|
|
'KELUAR_HQ' => $qty,
|
|
'MASUK_HQ' => '0'
|
|
];
|
|
$action = $this->Amod->create('histori_kuantiti', $input);
|
|
|
|
$update = [
|
|
'PERSEDIAAN_KUANTITI' => $persediaan_hq
|
|
];
|
|
$action = $this->Amod->update('kuantiti', $update, 'ID_KUANTITI', $barang);
|
|
} else if ($jenis=="Step 2 - PENJUALAN - Kunci Retur") {
|
|
$datRj = $this->Amod->getData_ReturPenjualan_byID_bySTATUS($spesifikId, 0);
|
|
|
|
$datHqKode = $this->Amod->getData_HistoriKuantiti_byBARANG_byKODEBUKTI($barang, $datRj[0]['KODE_PENJUALAN']);
|
|
$nilai_hq = $datHqKode[0]['AVG_HQ']*$qty;
|
|
|
|
$datHq = $this->Amod->getData_HistoriKuantiti_byBARANG_orderDESC_limit1($barang);
|
|
$sisa_hq = $datHq[0]['SISA_HQ']+$qty;
|
|
$persediaan_hq = $datHq[0]['PERSEDIAAN_HQ']+$nilai_hq;
|
|
$avg_hq = round(($persediaan_hq/$sisa_hq), 2);
|
|
|
|
$input = [
|
|
'TGL_HQ' => $now,
|
|
'KODE_BUKTI' => $datRj[0]['KODE_RJ'],
|
|
'INV_HQ' => $kode,
|
|
'PERSEDIAAN_HQ' => $persediaan_hq,
|
|
'NILAI_HQ' => $nilai_hq,
|
|
'SISA_HQ' => $sisa_hq,
|
|
'AVG_HQ' => $avg_hq,
|
|
'BARANG_ID' => $barang,
|
|
'MASUK_HQ' => $qty,
|
|
'KELUAR_HQ' => '0'
|
|
];
|
|
$action = $this->Amod->create('histori_kuantiti', $input);
|
|
|
|
$update = [
|
|
'PERSEDIAAN_KUANTITI' => $persediaan_hq
|
|
];
|
|
$action = $this->Amod->update('kuantiti', $update, 'ID_KUANTITI', $barang);
|
|
} else if ($jenis=="Step 2 - PROYEK - Proses Barang") {
|
|
$datHq = $this->Amod->getData_HistoriKuantiti_byBARANG_orderDESC_limit1($barang);
|
|
$sisa_hq = $datHq[0]['SISA_HQ']-$qty;
|
|
if ($sisa_hq==0) {
|
|
$persediaan_hq = 0;
|
|
} else {
|
|
$persediaan_hq = round(($datHq[0]['PERSEDIAAN_HQ']-($datHq[0]['AVG_HQ']*$qty)),2);
|
|
}
|
|
$input = [
|
|
'TGL_HQ' => $now,
|
|
'KODE_BUKTI' => $kode,
|
|
'PERSEDIAAN_HQ' => $persediaan_hq,
|
|
'SISA_HQ' => $sisa_hq,
|
|
'AVG_HQ' => $datHq[0]['AVG_HQ'],
|
|
'BARANG_ID' => $barang,
|
|
'KELUAR_HQ' => $qty,
|
|
'MASUK_HQ' => '0',
|
|
'IO_ID' => $spesifikId,
|
|
];
|
|
$action = $this->Amod->create('histori_kuantiti', $input);
|
|
|
|
$update = [
|
|
'PERSEDIAAN_KUANTITI' => $persediaan_hq
|
|
];
|
|
$action = $this->Amod->update('kuantiti', $update, 'ID_KUANTITI', $barang);
|
|
} else if ($jenis=="Step 2 - PROYEK - Revisi Barang") {
|
|
$datHq = $this->Amod->getData_HistoriKuantiti_byKODE($kode);
|
|
$action = $this->Amod->delete('histori_kuantiti', $kode, 'KODE_BUKTI');
|
|
foreach ($datHq as $key) {
|
|
$datHqAfter = $this->Amod->getData_HistoriKuantiti_byBARANG_afterID($key['BARANG_ID'], $key['ID_HQ']);
|
|
foreach ($datHqAfter as $dat) {
|
|
$datHqBeforeTwo = $this->Amod->getData_HistoriKuantiti_byBARANG_orderDESC_limit1_beforeID($dat['BARANG_ID'], $dat['ID_HQ']);
|
|
if ($dat['MASUK_HQ']==0) { // Transaksi Keluar
|
|
$sisa_hq = $datHqBeforeTwo[0]['SISA_HQ']-$dat['KELUAR_HQ'];
|
|
if ($datHqBeforeTwo[0]['SISA_HQ']==$dat['KELUAR_HQ']) {
|
|
$persediaan_hq = 0;
|
|
} else {
|
|
$persediaan_hq = round(($datHqBeforeTwo[0]['PERSEDIAAN_HQ']-($datHqBeforeTwo[0]['AVG_HQ']*$dat['KELUAR_HQ'])),2);
|
|
}
|
|
$avg_hq = $datHqBeforeTwo[0]['AVG_HQ'];
|
|
$update = [
|
|
'SISA_HQ' => $sisa_hq,
|
|
'PERSEDIAAN_HQ' => $persediaan_hq,
|
|
'AVG_HQ' => $avg_hq
|
|
];
|
|
} else if ($dat['KELUAR_HQ']==0) { // Transaksi Masuk
|
|
$sisa_hq = $datHqBeforeTwo[0]['SISA_HQ']+$dat['MASUK_HQ'];
|
|
$persediaan_hq = $datHqBeforeTwo[0]['PERSEDIAAN_HQ']+$dat['NILAI_HQ'];
|
|
$avg_hq = round(($persediaan_hq/$sisa_hq),2);
|
|
|
|
$update = [
|
|
'SISA_HQ' => $sisa_hq,
|
|
'PERSEDIAAN_HQ' => $persediaan_hq,
|
|
'AVG_HQ' => $avg_hq,
|
|
];
|
|
}
|
|
$action = $this->Amod->update('histori_kuantiti', $update, 'ID_HQ', $dat['ID_HQ']);
|
|
|
|
$update = [
|
|
'PERSEDIAAN_KUANTITI' => $persediaan_hq
|
|
];
|
|
$action = $this->Amod->update('kuantiti', $update, 'ID_KUANTITI', $dat['BARANG_ID']);
|
|
}
|
|
}
|
|
} else if ($jenis=="Step 1 - PENJUALAN - Terbit Nota" OR $jenis=="Step 2 - PENJUALAN - Kunci Barang") {
|
|
$datPenjualan = $this->Amod->getData_Penjualan_byKODE($kode);
|
|
|
|
if ($transaksi==0) {
|
|
$datHq = $this->Amod->getData_HistoriKuantiti_byBARANG_orderDESC_limit1($barang);
|
|
$sisa_hq = $datHq[0]['SISA_HQ']-$qty;
|
|
if ($sisa_hq==0) {
|
|
$persediaan_hq = 0;
|
|
} else {
|
|
$persediaan_hq = round(($datHq[0]['PERSEDIAAN_HQ']-($datHq[0]['AVG_HQ']*$qty)),2);
|
|
}
|
|
|
|
$input = [
|
|
'TGL_HQ' => $now,
|
|
'KODE_BUKTI' => $kode,
|
|
'SJ_HQ' => $datPenjualan[0]['SJ_PENJUALAN'],
|
|
'INV_HQ' => $datPenjualan[0]['INV_PENJUALAN'],
|
|
'PERSEDIAAN_HQ' => $persediaan_hq,
|
|
'SISA_HQ' => $sisa_hq,
|
|
'AVG_HQ' => $datHq[0]['AVG_HQ'],
|
|
'BARANG_ID' => $barang,
|
|
'KELUAR_HQ' => $qty,
|
|
'MASUK_HQ' => '0',
|
|
];
|
|
$action = $this->Amod->create('histori_kuantiti', $input);
|
|
|
|
$update = [
|
|
'PERSEDIAAN_KUANTITI' => $persediaan_hq
|
|
];
|
|
$action = $this->Amod->update('kuantiti', $update, 'ID_KUANTITI', $barang);
|
|
} else if ($transaksi==1) {
|
|
$datIo = $this->Amod->getData_TransaksiStock_byID($spesifikId);
|
|
$harga_io = $datIo[0]['HARGA_IO'];
|
|
|
|
$nilai_hq = $qty*$harga_io;
|
|
$datHq = $this->Amod->getData_HistoriKuantiti_byBARANG_orderDESC_limit1($barang);
|
|
if ($datHq==FALSE) {
|
|
$persediaan_hq = $nilai_hq;
|
|
$sisa_hq = $qty;
|
|
$avg_hq = $harga_io;
|
|
} else {
|
|
$persediaan_hq = $datHq[0]['PERSEDIAAN_HQ']+$nilai_hq;
|
|
$sisa_hq = $datHq[0]['SISA_HQ']+$qty;
|
|
$avg_hq = round(($persediaan_hq/$sisa_hq),2);
|
|
}
|
|
|
|
$input = [
|
|
'TGL_HQ' => $now,
|
|
'KODE_BUKTI' => $kode,
|
|
'SJ_HQ' => $datPenjualan[0]['SJ_PENJUALAN'],
|
|
'INV_HQ' => $datPenjualan[0]['INV_PENJUALAN'],
|
|
'PERSEDIAAN_HQ' => $persediaan_hq,
|
|
'SISA_HQ' => $sisa_hq,
|
|
'AVG_HQ' => $avg_hq,
|
|
'NILAI_HQ' => $nilai_hq,
|
|
'BARANG_ID' => $barang,
|
|
'KELUAR_HQ' => '0',
|
|
'MASUK_HQ' => $qty,
|
|
'IO_ID' => $spesifikId
|
|
];
|
|
$action = $this->Amod->create('histori_kuantiti', $input);
|
|
|
|
$update = [
|
|
'PERSEDIAAN_KUANTITI' => $persediaan_hq
|
|
];
|
|
$action = $this->Amod->update('kuantiti', $update, 'ID_KUANTITI', $barang);
|
|
}
|
|
} else if ($jenis=="Step 1 - STOK BARANG - Kunci Modifikasi") {
|
|
if ($transaksi==0) {
|
|
$datHq = $this->Amod->getData_HistoriKuantiti_byBARANG_orderDESC_limit1($barang);
|
|
$sisa_hq = $datHq[0]['SISA_HQ']-$qty;
|
|
if ($sisa_hq==0) {
|
|
$persediaan_hq = 0;
|
|
} else {
|
|
$persediaan_hq = round(($datHq[0]['PERSEDIAAN_HQ']-($datHq[0]['AVG_HQ']*$qty)),2);
|
|
}
|
|
|
|
$input = [
|
|
'TGL_HQ' => $now,
|
|
'KODE_BUKTI' => $kode,
|
|
'PERSEDIAAN_HQ' => $persediaan_hq,
|
|
'SISA_HQ' => $sisa_hq,
|
|
'AVG_HQ' => $datHq[0]['AVG_HQ'],
|
|
'BARANG_ID' => $barang,
|
|
'KELUAR_HQ' => $qty,
|
|
'MASUK_HQ' => '0',
|
|
];
|
|
$action = $this->Amod->create('histori_kuantiti', $input);
|
|
|
|
$update = [
|
|
'PERSEDIAAN_KUANTITI' => $persediaan_hq
|
|
];
|
|
$action = $this->Amod->update('kuantiti', $update, 'ID_KUANTITI', $barang);
|
|
} else if ($transaksi==1) {
|
|
$datIo = $this->Amod->getData_TransaksiStock_byID($spesifikId);
|
|
$harga_io = $datIo[0]['HARGA_IO'];
|
|
|
|
$nilai_hq = $qty*$harga_io;
|
|
$datHq = $this->Amod->getData_HistoriKuantiti_byBARANG_orderDESC_limit1($barang);
|
|
if ($datHq==FALSE) {
|
|
$persediaan_hq = $nilai_hq;
|
|
$sisa_hq = $qty;
|
|
$avg_hq = $harga_io;
|
|
} else {
|
|
$persediaan_hq = $datHq[0]['PERSEDIAAN_HQ']+$nilai_hq;
|
|
$sisa_hq = $datHq[0]['SISA_HQ']+$qty;
|
|
$avg_hq = round(($persediaan_hq/$sisa_hq),2);
|
|
}
|
|
|
|
$input = [
|
|
'TGL_HQ' => $now,
|
|
'KODE_BUKTI' => $kode,
|
|
'PERSEDIAAN_HQ' => $persediaan_hq,
|
|
'SISA_HQ' => $sisa_hq,
|
|
'AVG_HQ' => $avg_hq,
|
|
'NILAI_HQ' => $nilai_hq,
|
|
'BARANG_ID' => $barang,
|
|
'KELUAR_HQ' => '0',
|
|
'MASUK_HQ' => $qty,
|
|
'IO_ID' => $spesifikId
|
|
];
|
|
$action = $this->Amod->create('histori_kuantiti', $input);
|
|
|
|
$update = [
|
|
'PERSEDIAAN_KUANTITI' => $persediaan_hq
|
|
];
|
|
$action = $this->Amod->update('kuantiti', $update, 'ID_KUANTITI', $barang);
|
|
}
|
|
} else if ($jenis=="Kunci Cabutan") {
|
|
if ($transaksi==0) {
|
|
$datHq = $this->Amod->getData_HistoriKuantiti_byBARANG_orderDESC_limit1($barang);
|
|
$sisa_hq = $datHq[0]['SISA_HQ']-$qty;
|
|
if ($sisa_hq==0) {
|
|
$persediaan_hq = 0;
|
|
} else {
|
|
$persediaan_hq = round(($datHq[0]['PERSEDIAAN_HQ']-($datHq[0]['AVG_HQ']*$qty)),2);
|
|
}
|
|
|
|
$input = [
|
|
'TGL_HQ' => $now,
|
|
'KODE_BUKTI' => $kode,
|
|
'PERSEDIAAN_HQ' => $persediaan_hq,
|
|
'SISA_HQ' => $sisa_hq,
|
|
'AVG_HQ' => $datHq[0]['AVG_HQ'],
|
|
'BARANG_ID' => $barang,
|
|
'KELUAR_HQ' => $qty,
|
|
'MASUK_HQ' => '0',
|
|
];
|
|
$action = $this->Amod->create('histori_kuantiti', $input);
|
|
|
|
$update = [
|
|
'PERSEDIAAN_KUANTITI' => $persediaan_hq
|
|
];
|
|
$action = $this->Amod->update('kuantiti', $update, 'ID_KUANTITI', $barang);
|
|
} else if ($transaksi==1) {
|
|
$datIo = $this->Amod->getData_TransaksiStock_byID($spesifikId);
|
|
$harga_io = $datIo[0]['HARGA_IO'];
|
|
|
|
$nilai_hq = $qty*$harga_io;
|
|
$datHq = $this->Amod->getData_HistoriKuantiti_byBARANG_orderDESC_limit1($barang);
|
|
if ($datHq==FALSE) {
|
|
$persediaan_hq = $nilai_hq;
|
|
$sisa_hq = $qty;
|
|
$avg_hq = $harga_io;
|
|
} else {
|
|
$persediaan_hq = $datHq[0]['PERSEDIAAN_HQ']+$nilai_hq;
|
|
$sisa_hq = $datHq[0]['SISA_HQ']+$qty;
|
|
$avg_hq = round(($persediaan_hq/$sisa_hq),2);
|
|
}
|
|
|
|
$input = [
|
|
'TGL_HQ' => $now,
|
|
'KODE_BUKTI' => $kode,
|
|
'PERSEDIAAN_HQ' => $persediaan_hq,
|
|
'SISA_HQ' => $sisa_hq,
|
|
'AVG_HQ' => $avg_hq,
|
|
'NILAI_HQ' => $nilai_hq,
|
|
'BARANG_ID' => $barang,
|
|
'KELUAR_HQ' => '0',
|
|
'MASUK_HQ' => $qty,
|
|
'IO_ID' => $spesifikId
|
|
];
|
|
$action = $this->Amod->create('histori_kuantiti', $input);
|
|
|
|
$update = [
|
|
'PERSEDIAAN_KUANTITI' => $persediaan_hq
|
|
];
|
|
$action = $this->Amod->update('kuantiti', $update, 'ID_KUANTITI', $barang);
|
|
}
|
|
}
|
|
}
|
|
|
|
public function GE_Kalkulasi_HistoriOtomasiBooster($id_penjualan) {
|
|
$now = date('Y-m-d');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$datPenjualanAktif = $this->Amod->getData_Penjualan_byID_bySTATUS($id_penjualan, 1);
|
|
if ($datPenjualanAktif==TRUE) {
|
|
$datDo = $this->Amod->getData_DaftarOrder_bySO_jenis1($datPenjualanAktif[0]['SO_ID']);
|
|
foreach ($datDo as $key) {
|
|
$datDob = $this->Amod->getData_DaftarOtomasiBooster_byBARANG_bySTATUS_byLIMIT($key['BARANG_ID'], 1, $now);
|
|
$countDob = count($datDob);
|
|
if ($countDob>=1) {
|
|
$datSnkpr = $this->Amod->getData_SnKlaimProgram_byBARANG_byDO_forOtomasiBooster($key['BARANG_ID'],$key['ID_DO']);
|
|
|
|
$nohob = 1;
|
|
foreach ($datDob as $dat) {
|
|
foreach ($datSnkpr as $dit) {
|
|
$input = [
|
|
'CIPTA_LKPR' => "Oleh Sistem pada $timestamp",
|
|
'TGL_LKPR' => $now,
|
|
'PROGRAM_ID' => $dat['JENIS_OB'],
|
|
'SNKPR_ID' => $dit['ID_SNKPR'],
|
|
'PKPR_ID' => $dat['PKPR_ID'],
|
|
'NILAI_LKPR' => $dat['NILAI_DOB']
|
|
];
|
|
$action = $this->Amod->create('link_klaimprogram', $input);
|
|
|
|
$id_lkpr = $this->Amod->getMax_ID_LinkKlaimProgram();
|
|
$id_lkpr = $id_lkpr[0]['ID_LKPR'];
|
|
|
|
$input = [
|
|
'OB_ID' => $dat['OB_ID'],
|
|
'LKPR_ID' => $id_lkpr,
|
|
'TIMESTAMP' => $timestamp
|
|
];
|
|
$action = $this->Amod->create('histori_otomasibooster', $input);
|
|
|
|
if ($dat['JENIS_OB']==1) {
|
|
$update = [
|
|
'STATUS_SNKPR' => '1'
|
|
];
|
|
$action = $this->Amod->update('sn_klaimprogram', $update, 'ID_SNKPR', $dit['ID_SNKPR']);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
$datPenjualanBatal = $this->Amod->getData_Penjualan_byID_bySTATUS($id_penjualan, 0);
|
|
if ($datPenjualanBatal==TRUE) {
|
|
$datDo = $this->Amod->getData_DaftarOrder_bySO_jenis1($datPenjualanBatal[0]['SO_ID']);
|
|
foreach ($datDo as $key) {
|
|
$datSnj = $this->Amod->getData_SnJual_byDO_forBatalOtomasi($key['ID_DO']);
|
|
foreach ($datSnj as $dat) {
|
|
$datHob = $this->Amod->getData_HistoriOtomasiBooster_bySNKPR_batalNull($dat['ID_SNKPR']);
|
|
foreach ($datHob as $dit) {
|
|
$update = [
|
|
'BATAL_HOB' => $timestamp
|
|
];
|
|
$action = $this->Amod->update('histori_otomasibooster', $update, 'ID_HOB', $dit['ID_HOB']);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
public function GE_Kalkulasi_KuantitiBarang($barang, $gudang, $jenis, $transaksi, $qty) {
|
|
$datKuantiti = $this->Amod->getData_Kuantiti_byBARANG($barang);
|
|
$global = $datKuantiti[0]['GLOBAL_KUANTITI'];
|
|
$pcm = $datKuantiti[0]['PCM_KUANTITI'];
|
|
$itp = $datKuantiti[0]['ITP_KUANTITI'];
|
|
$proses = $datKuantiti[0]['PROSES_KUANTITI'];
|
|
$antik = $datKuantiti[0]['ANTIK_KUANTITI'];
|
|
$konsinyasi = $datKuantiti[0]['KONSINYASI_KUANTITI'];
|
|
$mutasi = $datKuantiti[0]['MUTASI_KUANTITI'];
|
|
$peminjaman = $datKuantiti[0]['PEMINJAMAN_KUANTITI'];
|
|
$pending = $datKuantiti[0]['PENDING_KUANTITI'];
|
|
$proyek = $datKuantiti[0]['PROYEK_KUANTITI'];
|
|
$service = $datKuantiti[0]['SERVICE_KUANTITI'];
|
|
$sewa = $datKuantiti[0]['SEWA_KUANTITI'];
|
|
$tercabut = $datKuantiti[0]['TERCABUT_KUANTITI'];
|
|
|
|
//Persediaan Keluar Masuk Stok
|
|
if ($jenis=="Step 1 - KELUARMASUK - Tambah Barang") {
|
|
if ($transaksi==0) {
|
|
if ($gudang==1) {
|
|
$pcm = $pcm-$qty;
|
|
$proses = $proses+$qty;
|
|
} else if ($gudang==2) {
|
|
$itp = $itp-$qty;
|
|
$proses = $proses+$qty;
|
|
} else if ($gudang==3) {
|
|
$service = $service-$qty;
|
|
$proses = $proses+$qty;
|
|
}
|
|
}
|
|
} else if ($jenis=="Step 1 - KELUARMASUK - Hapus Barang") {
|
|
if ($transaksi==0) {
|
|
if ($gudang==1) {
|
|
$pcm = $pcm+$qty;
|
|
$proses = $proses-$qty;
|
|
} else if ($gudang==2) {
|
|
$itp = $itp+$qty;
|
|
$proses = $proses-$qty;
|
|
}
|
|
}
|
|
} else if ($jenis=="Step 2 - KELUARMASUK - Proses Barang") {
|
|
if ($transaksi==0) {
|
|
$global = $global-$qty;
|
|
$proses = $proses-$qty;
|
|
} else if ($transaksi==1) {
|
|
if ($gudang==1) {
|
|
$pcm = $pcm+$qty;
|
|
$global = $global+$qty;
|
|
} else if ($gudang==2) {
|
|
$itp = $itp+$qty;
|
|
$global = $global+$qty;
|
|
}
|
|
}
|
|
} else if ($jenis=="Step 1 - MUTASIBARANG - Tambah Barang") {
|
|
if ($gudang==1) {
|
|
$pcm = $pcm-$qty;
|
|
$proses = $proses+$qty;
|
|
} else if ($gudang==2) {
|
|
$itp = $itp-$qty;
|
|
$proses = $proses+$qty;
|
|
} else if ($gudang==10) {
|
|
$service = $service-$qty;
|
|
$proses = $proses+$qty;
|
|
}
|
|
} else if ($jenis=="Step 1 - MUTASIBARANG - Hapus Barang") {
|
|
if ($gudang==1) {
|
|
$pcm = $pcm+$qty;
|
|
$proses = $proses-$qty;
|
|
} else if ($gudang==2) {
|
|
$itp = $itp+$qty;
|
|
$proses = $proses-$qty;
|
|
} else if ($gudang==10) {
|
|
$service = $service+$qty;
|
|
$proses = $proses-$qty;
|
|
}
|
|
} else if ($jenis=="Step 2 - MUTASIBARANG - Proses Barang") {
|
|
$proses = $proses-$qty;
|
|
$mutasi = $mutasi+$qty;
|
|
} else if ($jenis=="Step 3 - MUTASIBARANG - Terima Barang") {
|
|
if ($gudang==1) {
|
|
$pcm = $pcm+$qty;
|
|
$mutasi = $mutasi-$qty;
|
|
} else if ($gudang==2) {
|
|
$itp = $itp+$qty;
|
|
$mutasi = $mutasi-$qty;
|
|
} else if ($gudang==3) {
|
|
$service = $service+$qty;
|
|
$mutasi = $mutasi-$qty;
|
|
}
|
|
} else if ($jenis=="Step 1 - PENDING - Tambah Barang") {
|
|
if ($gudang==1) {
|
|
$pcm = $pcm-$qty;
|
|
$pending = $pending+$qty;
|
|
} else if ($gudang==2) {
|
|
$itp = $itp-$qty;
|
|
$pending = $pending+$qty;
|
|
}
|
|
} else if ($jenis=="Step 2 - PENDING - Proses Barang") {
|
|
if ($gudang==1) {
|
|
$pcm = $pcm+$qty;
|
|
$pending = $pending-$qty;
|
|
} else if ($gudang==2) {
|
|
$itp = $itp+$qty;
|
|
$pending = $pending-$qty;
|
|
}
|
|
} else if ($jenis=="Step 1 - PEMINJAMAN - Tambah Barang") {
|
|
if ($gudang==1) {
|
|
$pcm = $pcm-$qty;
|
|
$proses = $proses+$qty;
|
|
} else if ($gudang==2) {
|
|
$itp = $itp-$qty;
|
|
$proses = $proses+$qty;
|
|
}
|
|
} else if ($jenis=="Step 1 - PEMINJAMAN - Hapus Barang") {
|
|
if ($gudang==1) {
|
|
$pcm = $pcm+$qty;
|
|
$proses = $proses-$qty;
|
|
} else if ($gudang==2) {
|
|
$itp = $itp+$qty;
|
|
$proses = $proses-$qty;
|
|
}
|
|
} else if ($jenis=="Step 2 - PEMINJAMAN - Proses Barang") {
|
|
$proses = $proses-$qty;
|
|
$peminjaman = $peminjaman+$qty;
|
|
} else if ($jenis=="Step 3 - PEMINJAMAN - Kembalikan Barang") {
|
|
if ($gudang==1) {
|
|
$pcm = $pcm+$qty;
|
|
$peminjaman = $peminjaman-$qty;
|
|
} else if ($gudang==2) {
|
|
$itp = $itp+$qty;
|
|
$peminjaman = $peminjaman-$qty;
|
|
}
|
|
} else if ($jenis=="Step 1 - KONSINYASI - Tambah Barang") {
|
|
if ($gudang==1) {
|
|
$pcm = $pcm-$qty;
|
|
$proses = $proses+$qty;
|
|
} else if ($gudang==2) {
|
|
$itp = $itp-$qty;
|
|
$proses = $proses+$qty;
|
|
}
|
|
} else if ($jenis=="Step 1 - KONSINYASI - Hapus Barang") {
|
|
if ($gudang==1) {
|
|
$pcm = $pcm+$qty;
|
|
$proses = $proses-$qty;
|
|
} else if ($gudang==2) {
|
|
$itp = $itp+$qty;
|
|
$proses = $proses-$qty;
|
|
}
|
|
} else if ($jenis=="Step 2 - KONSINYASI - Proses Barang") {
|
|
$proses = $proses-$qty;
|
|
$konsinyasi = $konsinyasi+$qty;
|
|
} else if ($jenis=="Step 3 - KONSINYASI - Tarik Barang") {
|
|
if ($gudang==1) {
|
|
$pcm = $pcm+$qty;
|
|
$konsinyasi = $konsinyasi-$qty;
|
|
} else if ($gudang==2) {
|
|
$itp = $itp+$qty;
|
|
$konsinyasi = $konsinyasi-$qty;
|
|
}
|
|
} else if ($jenis=="Step 1 - SEWA - Tambah Barang") {
|
|
$pcm = $pcm-$qty;
|
|
$proses = $proses+$qty;
|
|
} else if ($jenis=="Step 1 - SEWA - Hapus Barang") {
|
|
$pcm = $pcm+$qty;
|
|
$proses = $proses-$qty;
|
|
} else if ($jenis=="Step 2 - SEWA - Proses Barang") {
|
|
$proses = $proses-$qty;
|
|
$sewa = $sewa+$qty;
|
|
} else if ($jenis=="Step 3 - SEWA - Tarik Barang") {
|
|
$pcm = $pcm+$qty;
|
|
$sewa = $sewa-$qty;
|
|
} else if ($jenis=="Step 1 - STOK ANTIK - Tambah Barang") {
|
|
$pcm = $pcm-$qty;
|
|
$proses = $proses+$qty;
|
|
} else if ($jenis=="Step 1 - STOK ANTIK - Tarik Barang") {
|
|
$antik = $antik-$qty;
|
|
$proses = $proses+$qty;
|
|
} else if ($jenis=="Step 1 - STOK ANTIK - Hapus Barang") {
|
|
if ($transaksi==1) {
|
|
$pcm = $pcm+$qty;
|
|
$proses = $proses-$qty;
|
|
} else if ($transaksi==0) {
|
|
$antik = $antik+$qty;
|
|
$proses = $proses-$qty;
|
|
}
|
|
} else if ($jenis=="Step 2 - STOK ANTIK - Proses Barang") {
|
|
if ($transaksi==1) {
|
|
$proses = $proses-$qty;
|
|
$antik = $antik+$qty;
|
|
} else if ($transaksi==0) {
|
|
$proses = $proses-$qty;
|
|
$pcm = $pcm+$qty;
|
|
}
|
|
} else if ($jenis=="Step 1 - SERVICE - Tambah Barang") {
|
|
if ($gudang==1) {
|
|
$pcm = $pcm-$qty;
|
|
$proses = $proses+$qty;
|
|
} else if ($gudang==2) {
|
|
$itp = $itp-$qty;
|
|
$proses = $proses+$qty;
|
|
}
|
|
} else if ($jenis=="Step 1 - SERVICE - Hapus Barang") {
|
|
if ($gudang==1) {
|
|
$pcm = $pcm+$qty;
|
|
$proses = $proses-$qty;
|
|
} else if ($gudang==2) {
|
|
$itp = $itp+$qty;
|
|
$proses = $proses-$qty;
|
|
}
|
|
} else if ($jenis=="Step 2 - SERVICE - Proses Barang") {
|
|
$proses = $proses-$qty;
|
|
$service = $service+$qty;
|
|
} else if ($jenis=="Step 3 - SERVICE - Batalkan Barang") {
|
|
if ($gudang==1) {
|
|
$pcm = $pcm+$qty;
|
|
$service = $service-$qty;
|
|
} else if ($gudang==2) {
|
|
$itp = $itp+$qty;
|
|
$service = $service-$qty;
|
|
}
|
|
} else if ($jenis=="Step 3 - SERVICE - Tarik Barang") {
|
|
if ($gudang==1) {
|
|
$pcm = $pcm+$qty;
|
|
$service = $service-$qty;
|
|
} else if ($gudang==2) {
|
|
$itp = $itp+$qty;
|
|
$service = $service-$qty;
|
|
}
|
|
} else if ($jenis=="Step 2 - PROYEK - Proses Barang") {
|
|
$proyek = $proyek-$qty;
|
|
$global = $global-$qty;
|
|
} else if ($jenis=="Step 2 - PROYEK - Revisi Barang") {
|
|
$proyek = $proyek+$qty;
|
|
$global = $global+$qty;
|
|
} else if ($jenis=="Step 1 - PEMBELIAN - Proses Barang") {
|
|
if ($gudang==1) {
|
|
$pcm = $pcm+$qty;
|
|
$global = $global+$qty;
|
|
} else if ($gudang==2) {
|
|
$itp = $itp+$qty;
|
|
$global = $global+$qty;
|
|
} else if ($gudang==3) {
|
|
$service = $service+$qty;
|
|
$global = $global+$qty;
|
|
}
|
|
} else if ($jenis=="Step 1 - PEMBELIAN - Revisi Barang") {
|
|
if ($gudang==1) {
|
|
$pcm = $pcm-$qty;
|
|
$global = $global-$qty;
|
|
} else if ($gudang==2) {
|
|
$itp = $itp-$qty;
|
|
$global = $global-$qty;
|
|
} else if ($gudang==3) {
|
|
$service = $service-$qty;
|
|
$global = $global-$qty;
|
|
}
|
|
} else if ($jenis=="Step 2 - PEMBELIAN - Kunci Retur") {
|
|
if ($gudang==1) {
|
|
$pcm = $pcm-$qty;
|
|
$global = $global-$qty;
|
|
} else if ($gudang==2) {
|
|
$itp = $itp-$qty;
|
|
$global = $global-$qty;
|
|
} else if ($gudang==3) {
|
|
$service = $service-$qty;
|
|
$global = $global-$qty;
|
|
}
|
|
} else if ($jenis=="Step 1 - PENJUALAN - Revisi Barang") {
|
|
if ($gudang==1) {
|
|
$pcm = $pcm+$qty;
|
|
$proses = $proses-$qty;
|
|
} else if ($gudang==2) {
|
|
$itp = $itp+$qty;
|
|
$proses = $proses-$qty;
|
|
} else if ($gudang==3) {
|
|
$service = $service+$qty;
|
|
$proses = $proses-$qty;
|
|
}
|
|
} else if ($jenis=="Step 1 - PENJUALAN - Terbit Nota") {
|
|
if ($transaksi==0) {
|
|
$proses = $proses-$qty;
|
|
$global = $global-$qty;
|
|
} else if ($transaksi==1) {
|
|
if ($gudang==1) {
|
|
$pcm = $pcm+$qty;
|
|
$global = $global+$qty;
|
|
} else if ($gudang==2) {
|
|
$itp = $itp+$qty;
|
|
$global = $global+$qty;
|
|
} else if ($gudang==3) {
|
|
$service = $service+$qty;
|
|
$global = $global+$qty;
|
|
}
|
|
}
|
|
} else if ($jenis=="Step 2 - PENJUALAN - Tambah Barang") {
|
|
if ($gudang==1) {
|
|
$pcm = $pcm-$qty;
|
|
$proses = $proses+$qty;
|
|
} else if ($gudang==2) {
|
|
$itp = $itp-$qty;
|
|
$proses = $proses+$qty;
|
|
} else if ($gudang==3) {
|
|
$service = $service-$qty;
|
|
$proses = $proses+$qty;
|
|
}
|
|
} else if ($jenis=="Step 2 - PENJUALAN - Hapus Barang") {
|
|
if ($gudang==1) {
|
|
$pcm = $pcm+$qty;
|
|
$proses = $proses-$qty;
|
|
} else if ($gudang==2) {
|
|
$itp = $itp+$qty;
|
|
$proses = $proses-$qty;
|
|
} else if ($gudang==3) {
|
|
$service = $service+$qty;
|
|
$proses = $proses-$qty;
|
|
}
|
|
} else if ($jenis=="Step 2 - PENJUALAN - Kunci Barang") {
|
|
if ($transaksi==1) {
|
|
$proses = $proses-$qty;
|
|
$global = $global-$qty;
|
|
} else if ($transaksi==0) {
|
|
if ($gudang==1) {
|
|
$pcm = $pcm-$qty;
|
|
$global = $global-$qty;
|
|
} else if ($gudang==2) {
|
|
$itp = $itp-$qty;
|
|
$global = $global-$qty;
|
|
} else if ($gudang==3) {
|
|
$service = $service-$qty;
|
|
$global = $global-$qty;
|
|
}
|
|
} else if ($transaksi==2) {
|
|
if ($gudang==1) {
|
|
$pcm = $pcm+$qty;
|
|
$global = $global+$qty;
|
|
} else if ($gudang==2) {
|
|
$itp = $itp+$qty;
|
|
$global = $global+$qty;
|
|
} else if ($gudang==3) {
|
|
$service = $service+$qty;
|
|
$global = $global+$qty;
|
|
}
|
|
}
|
|
} else if ($jenis=="Step 2 - PENJUALAN - Kunci Retur") {
|
|
if ($gudang==1) {
|
|
$pcm = $pcm+$qty;
|
|
$global = $global+$qty;
|
|
} else if ($gudang==2) {
|
|
$itp = $itp+$qty;
|
|
$global = $global+$qty;
|
|
} else if ($gudang==3) {
|
|
$service = $service+$qty;
|
|
$global = $global+$qty;
|
|
}
|
|
} else if ($jenis=="PENJUALAN - Batal Penjualan") {
|
|
if ($transaksi==0) {
|
|
if ($gudang==1) {
|
|
$pcm = $pcm+$qty;
|
|
$global = $global+$qty;
|
|
} else if ($gudang==2) {
|
|
$itp = $itp+$qty;
|
|
$global = $global+$qty;
|
|
} else if ($gudang==3) {
|
|
$service = $service+$qty;
|
|
$global = $global+$qty;
|
|
}
|
|
} else if ($transaksi==1) {
|
|
if ($gudang==1) {
|
|
$pcm = $pcm-$qty;
|
|
$global = $global-$qty;
|
|
} else if ($gudang==2) {
|
|
$itp = $itp-$qty;
|
|
$global = $global-$qty;
|
|
} else if ($gudang==3) {
|
|
$service = $service-$qty;
|
|
$global = $global-$qty;
|
|
}
|
|
}
|
|
} else if ($jenis=="Step 1 - PROYEK - Tambah Data") {
|
|
if ($transaksi==0) {
|
|
$pcm = $pcm-$qty;
|
|
$proyek = $proyek+$qty;
|
|
} else if ($transaksi==1) {
|
|
$pcm = $pcm+$qty;
|
|
$proyek = $proyek-$qty;
|
|
}
|
|
} else if ($jenis=="Step 1 - PROYEK - Hapus Data") {
|
|
if ($transaksi==0) {
|
|
$pcm = $pcm+$qty;
|
|
$proyek = $proyek-$qty;
|
|
} else if ($transaksi==1) {
|
|
$pcm = $pcm-$qty;
|
|
$proyek = $proyek+$qty;
|
|
}
|
|
} else if ($jenis=="Step 1 - STOK BARANG - Kunci Modifikasi") {
|
|
if ($transaksi==0) {
|
|
$proses = $proses-$qty;
|
|
$global = $global-$qty;
|
|
} else if ($transaksi==1) {
|
|
if ($gudang==1) {
|
|
$pcm = $pcm+$qty;
|
|
$global = $global+$qty;
|
|
} else if ($gudang==2) {
|
|
$itp = $itp+$qty;
|
|
$global = $global+$qty;
|
|
} else if ($gudang==3) {
|
|
$service = $service+$qty;
|
|
$global = $global+$qty;
|
|
}
|
|
}
|
|
} else if ($jenis=="Kunci Cabutan") {
|
|
if ($transaksi==0) { // Barang Keluar
|
|
$proses = $proses-$qty;
|
|
$global = $global-$qty;
|
|
} else if ($transaksi==1) { // Barang Masuk
|
|
if ($gudang==1) {
|
|
$pcm = $pcm+$qty;
|
|
$global = $global+$qty;
|
|
} else if ($gudang==2) {
|
|
$itp = $itp+$qty;
|
|
$global = $global+$qty;
|
|
} else if ($gudang==3) {
|
|
$service = $service+$qty;
|
|
$global = $global+$qty;
|
|
}
|
|
} else if ($transaksi==2) { // Barang SN Utama Pindah ke Tercabut
|
|
if ($gudang==1) {
|
|
$pcm = $pcm-$qty;
|
|
$tercabut = $tercabut+$qty;
|
|
} else if ($gudang==2) {
|
|
$itp = $itp-$qty;
|
|
$tercabut = $tercabut+$qty;
|
|
} else if ($gudang==3) {
|
|
$service = $service-$qty;
|
|
$tercabut = $tercabut+$qty;
|
|
}
|
|
} else if ($transaksi==3) { // Barang Bypass Keluar
|
|
if ($gudang==1) {
|
|
$pcm = $pcm-$qty;
|
|
$global = $global-$qty;
|
|
} else if ($gudang==2) {
|
|
$itp = $itp-$qty;
|
|
$global = $global-$qty;
|
|
} else if ($gudang==3) {
|
|
$service = $service-$qty;
|
|
$global = $global-$qty;
|
|
}
|
|
} else if ($transaksi==4) { // Barang Bypass Masuk
|
|
if ($gudang==1) {
|
|
$pcm = $pcm+$qty;
|
|
$global = $global+$qty;
|
|
} else if ($gudang==2) {
|
|
$itp = $itp+$qty;
|
|
$global = $global+$qty;
|
|
} else if ($gudang==3) {
|
|
$service = $service+$qty;
|
|
$global = $global+$qty;
|
|
}
|
|
} else if ($transaksi==5) { // Barang SN Utama Pindah ke Stok Ready
|
|
if ($gudang==1) {
|
|
$pcm = $pcm+$qty;
|
|
$tercabut = $tercabut-$qty;
|
|
} else if ($gudang==2) {
|
|
$itp = $itp+$qty;
|
|
$tercabut = $tercabut-$qty;
|
|
} else if ($gudang==3) {
|
|
$service = $service+$qty;
|
|
$tercabut = $tercabut-$qty;
|
|
}
|
|
}
|
|
}
|
|
|
|
$update = [
|
|
'GLOBAL_KUANTITI' => $global,
|
|
'PCM_KUANTITI' => $pcm,
|
|
'ITP_KUANTITI' => $itp,
|
|
'PROSES_KUANTITI' => $proses,
|
|
'ANTIK_KUANTITI' => $antik,
|
|
'KONSINYASI_KUANTITI' => $konsinyasi,
|
|
'MUTASI_KUANTITI' => $mutasi,
|
|
'PEMINJAMAN_KUANTITI' => $peminjaman,
|
|
'PENDING_KUANTITI' => $pending,
|
|
'PROYEK_KUANTITI' => $proyek,
|
|
'SERVICE_KUANTITI' => $service,
|
|
'SEWA_KUANTITI' => $sewa,
|
|
'TERCABUT_KUANTITI' => $tercabut,
|
|
];
|
|
$action = $this->Amod->update('kuantiti', $update, 'ID_KUANTITI', $barang);
|
|
}
|
|
|
|
public function GE_Kalkulasi_NilaiFormKaryawan() {
|
|
$jabatan = $this->input->post('jabatan');
|
|
$tgl = $this->input->post('tgl');
|
|
$jenis = $this->input->post('jenis');
|
|
$inap = $this->input->post('inap');
|
|
$mulai = $this->input->post('mulai');
|
|
$selesai = $this->input->post('selesai');
|
|
|
|
if ($jenis==1 OR $jenis==2 OR $jenis==5) {
|
|
$nilai = $this->Amod->generate_hasilLembur($jabatan, $mulai, $selesai, $jenis, $tgl);
|
|
} else if ($jenis==3 OR $jenis==4 OR $jenis==6) {
|
|
$nilai = $this->Amod->generate_hasilLuarKota($mulai, $selesai, $jenis, $inap);
|
|
}
|
|
|
|
$this->output_json([
|
|
'nilai' => $nilai
|
|
]);
|
|
}
|
|
|
|
public function GE_Kalkulasi_NilaiJamBaru() {
|
|
$jam_awal = $this->input->post('jam_awal');
|
|
|
|
if (strtotime($jam_awal)<=strtotime("08:30")) {
|
|
$jam_baru = "08:30";
|
|
$jam_akhir = "11:00";
|
|
} else if (strtotime($jam_awal)>strtotime("08:30") AND strtotime($jam_awal)<strtotime("12:00")) {
|
|
$jam_akhir = $this->Amod->generate_addHour($jam_awal, 3);
|
|
$jam_baru = $jam_awal;
|
|
if (strtotime($jam_awal)>=strtotime("09:00")) {
|
|
$jam_akhir = $this->Amod->generate_addHour($jam_akhir, 1);
|
|
}
|
|
} else if (strtotime($jam_awal)>=strtotime("12:00") AND strtotime($jam_awal)<=strtotime("13:00")) {
|
|
$jam_baru = "13:00";
|
|
$jam_akhir = $this->Amod->generate_addHour($jam_baru, 3);
|
|
} else if (strtotime($jam_awal)<=strtotime("14:00")) {
|
|
$jam_akhir = $this->Amod->generate_addHour($jam_awal, 3);
|
|
$jam_baru = $jam_awal;
|
|
} else {
|
|
$jam_baru = "14:00";
|
|
$jam_akhir = "17:00";
|
|
}
|
|
|
|
$this->output_json([
|
|
'jam_akhir' => $jam_akhir,
|
|
'jam_baru' => $jam_baru
|
|
]);
|
|
}
|
|
|
|
public function GE_Kalkulasi_PerbandinganTanggal() {
|
|
$tgl_awal = $this->input->post('tgl_awal');
|
|
$tgl_akhir = $this->input->post('tgl_akhir');
|
|
|
|
if (strtotime($tgl_awal)>strtotime($tgl_akhir)) {
|
|
$value = 1;
|
|
} else {
|
|
$value = 0;
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value
|
|
]);
|
|
}
|
|
|
|
public function GE_Kalkulasi_RingkasanHomeDashboard() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$jabatan = $this->session->userdata('jabatan');
|
|
$now = date('Y-m-d');
|
|
|
|
if ($id_karyawan==53) {
|
|
$id_karyawan = 22;
|
|
}
|
|
|
|
$datPab = $this->Amod->getData_PeriodeAbsensi_byTGL($now);
|
|
$totalTelatPeriode = $this->Amod->getCount_Absensi_byKARYAWAN_bySTATUS($id_karyawan, $datPab[0]['AWAL_PAB'], $datPab[0]['AKHIR_PAB'], 2);
|
|
$totalCutiPeriode = $this->Amod->getCount_DaftarFormKaryawan_byKARYAWAN_byJFK_byPERIODE($id_karyawan, 5, $datPab[0]['AWAL_PAB'], $datPab[0]['AKHIR_PAB'], 3);
|
|
|
|
//Menghitung Sisa Cuti Tahunan
|
|
$limitAtas = date('Y-01-01');
|
|
$limitBawah = date('Y-12-31');
|
|
$cutiDipakai = $this->Amod->getCount_DaftarFormKaryawan_byKARYAWAN_byJFK_byPERIODE($id_karyawan, 5, $limitAtas, $limitBawah);
|
|
$cutiBersama = $this->Amod->getCount_SetHariLibur_byJENIS_byPERIODE(2, $limitAtas, $limitBawah);
|
|
$totalSisaCuti = 12-$cutiDipakai-$cutiBersama;
|
|
|
|
//Menghitung Sisa Izin Sementara
|
|
$month = (int) date('m');
|
|
if ($month<=6) {
|
|
$limitAtas = date('Y-01-01');
|
|
$limitBawah = date('Y-06-30');
|
|
} else if ($month>6) {
|
|
$limitAtas = date('Y-07-01');
|
|
$limitBawah = date('Y-12-31');
|
|
}
|
|
$izinDipakai = $this->Amod->getCount_DaftarFormKaryawan_byKARYAWAN_byJFK_byPERIODE($id_karyawan, 7, $limitAtas, $limitBawah);
|
|
$totalSisaIzin = 3-$izinDipakai;
|
|
|
|
$totalFormAccFfp = 0;
|
|
$totalFormSoProses = 0;
|
|
$totalFormBelum = $this->Amod->getCount_FormKaryawan_byKARYAWAN_byVERSE($id_karyawan, 0);
|
|
$totalFormSudah = $this->Amod->getCount_FormKaryawan_byKARYAWAN_byVERSE($id_karyawan, 1);
|
|
$totalFormTolak = $this->Amod->getCount_FormKaryawan_byKARYAWAN_byVERSE($id_karyawan, 2);
|
|
$totalFormAccFk = $this->Amod->getCount_FormKaryawan_byKARYAWAN_cariStatus($id_karyawan, 3, $jabatan);
|
|
if ($jabatan=="ADMINISTRATOR" OR $jabatan=="PIMPINAN" OR $jabatan=="KADIV KEUANGAN") {
|
|
$totalFormAccFfp = $this->Amod->getCount_FormFeePelanggan_ACC($jabatan);
|
|
}
|
|
|
|
if (strpos($jabatan,"SALES")!==FALSE) {
|
|
$datShas = $this->Amod->getData_SetHakAdminSo_byKARYAWAN($id_karyawan);
|
|
foreach ($datShas as $key) {
|
|
$countSo = $this->Amod->getCount_SalesOrder_bySALES_0_2_3($key['HAK_ID']);
|
|
$totalFormSoProses = $totalFormSoProses+$countSo;
|
|
}
|
|
} else if ($jabatan=="ADMINISTRATOR") {
|
|
$totalFormSoProses = $this->Amod->getCount_SalesOrder_status0_2_3();
|
|
}
|
|
|
|
$this->output_json([
|
|
'totalTelatPeriode' => $totalTelatPeriode,
|
|
'totalCutiPeriode' => $totalCutiPeriode,
|
|
'totalSisaCuti' => $totalSisaCuti,
|
|
'totalSisaIzin' => $totalSisaIzin,
|
|
'totalFormBelum' => $totalFormBelum,
|
|
'totalFormSudah' => $totalFormSudah,
|
|
'totalFormTolak' => $totalFormTolak,
|
|
'totalFormAccFk' => $totalFormAccFk,
|
|
'totalFormAccFfp' => $totalFormAccFfp,
|
|
'totalFormSoProses' => $totalFormSoProses,
|
|
]);
|
|
}
|
|
|
|
public function GE_Kalkulasi_RingkasanJumlahKuantiti() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$username = $this->session->userdata('username');
|
|
$jabatan = $this->session->userdata('jabatan');
|
|
$timestamp = date('Y-m-d H:i:s');
|
|
$now = date('Y-m-d');
|
|
$awalMonth = date('Y-m-01');
|
|
|
|
//Proses untuk Dapatkan Karyawan yang sedang Akses Server
|
|
$nama_hat = $this->GE_AmbilData_IPAddress();
|
|
$datHat = $this->Amod->getData_HistoriAktifTerakhir($id_karyawan);
|
|
if ($datHat==FALSE) {
|
|
$input = [
|
|
'KARYAWAN_ID' => $id_karyawan,
|
|
'NAMA_HAT' => $nama_hat,
|
|
'LAST_HAT' => $timestamp,
|
|
];
|
|
$action = $this->Amod->create('histori_aktifterakhir', $input);
|
|
} else {
|
|
$update = [
|
|
'NAMA_HAT' => $nama_hat,
|
|
'LAST_HAT' => $timestamp
|
|
];
|
|
$action = $this->Amod->update('histori_aktifterakhir', $update, 'ID_HAT', $datHat[0]['ID_HAT']);
|
|
}
|
|
|
|
$ip3awal = substr($nama_hat, 0, 3);
|
|
if ($ip3awal=="200") {
|
|
|
|
$datSales = $this->Amod->getData_SetHakAdminSo_byKARYAWAN($id_karyawan);
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "PJ", "TRANSAKSI - Sales Order");
|
|
if ($datShm==FALSE) {
|
|
$countPjSub1_1 = 0;
|
|
} else {
|
|
$countPjSub1_1 = 0;
|
|
if ($datShm[0]['AKSES_ID']>0) {
|
|
foreach ($datSales as $key) {
|
|
$totSales = $this->Amod->getCount_SalesOrder_bySALES_statusNull_0_2_3($key['HAK_ID']);
|
|
$countPjSub1_1 = $countPjSub1_1+$totSales;
|
|
}
|
|
}
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "PJ", "TRANSAKSI - Proses Barang");
|
|
if ($datShm==FALSE) {
|
|
$countPjSub1_2 = 0;
|
|
} else {
|
|
if ($datShm[0]['AKSES_ID']==0) {
|
|
$countPjSub1_2 = 0;
|
|
} else {
|
|
$countPjSub1_2 = $this->Amod->getCount_SalesOrder_status0_2_3();
|
|
}
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "PJ", "TRANSAKSI - Penjadwalan");
|
|
if ($datShm==FALSE) {
|
|
$countPjSub1_3 = 0;
|
|
} else {
|
|
if ($datShm[0]['AKSES_ID']==0) {
|
|
$countPjSub1_3 = 0;
|
|
} else {
|
|
$countPjSub1_3 = $this->Amod->getCount_SalesOrder_status1_terkirimNull();
|
|
}
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "PJ", "TRANSAKSI - Retur Penjualan");
|
|
if ($datShm==FALSE) {
|
|
$countPjSub1_4 = 0;
|
|
} else {
|
|
if ($datShm[0]['AKSES_ID']==0) {
|
|
$countPjSub1_4 = 0;
|
|
} else {
|
|
$countPjSub1_4 = $this->Amod->getCount_ReturPenjualan_status0();
|
|
}
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "PJ", "TRANSAKSI - Batal Penjualan");
|
|
if ($datShm==FALSE) {
|
|
$countPjSub1_5 = 0;
|
|
} else {
|
|
if ($datShm[0]['AKSES_ID']==0) {
|
|
$countPjSub1_5 = 0;
|
|
} else {
|
|
$countPjSub1_5 = $this->Amod->getCount_Penjualan_status1_forBatal();
|
|
}
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "PJ", "TRANSAKSI - Olah Penjualan");
|
|
if ($datShm==FALSE) {
|
|
$countPjSub1_6 = 0;
|
|
} else {
|
|
if ($datShm[0]['AKSES_ID']==3) {
|
|
$awal = $this->Amod->generate_subYear($awalMonth, 1);
|
|
} else {
|
|
$awal = $this->Amod->generate_subMonth($awalMonth, 2);
|
|
}
|
|
$countPjSub1_6 = $this->Amod->getCount_Penjualan_bySTATUS_byPERIODE(1, $awal, $now);
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "KU", "ADMINISTRASI - Pengingat Piutang");
|
|
if ($datShm==FALSE) {
|
|
$countKuSub3_5 = 0;
|
|
} else {
|
|
$countKuSub3_5 = $this->Amod->getCount_PengingatPiutang_bySTATUS_beforeTGL(1, $now);
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "PR", "TRANSAKSI - Sales Proyek");
|
|
if ($datShm==FALSE) {
|
|
$countPrSub1_1 = 0;
|
|
} else {
|
|
if ($datShm[0]['AKSES_ID']==2) {
|
|
$countPrSub1_1 = $this->Amod->getCount_Proyek_byKARYAWAN_bySTATUS($id_karyawan, 0);
|
|
} else if ($datShm[0]['AKSES_ID']==3) {
|
|
$countPrSub1_1 = $this->Amod->getCount_Proyek_bySTATUS(0);
|
|
} else {
|
|
$countPrSub1_1 = 0;
|
|
}
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "PR", "TRANSAKSI - Olah Barang");
|
|
if ($datShm==FALSE) {
|
|
$countPrSub1_2 = 0;
|
|
} else {
|
|
if ($datShm[0]['AKSES_ID']>=1) {
|
|
$countPrSub1_2 = $this->Amod->getCount_Proyek_bySTATUS(0);
|
|
} else {
|
|
$countPrSub1_2 = 0;
|
|
}
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "PR", "TRANSAKSI - Administrasi");
|
|
if ($datShm==FALSE) {
|
|
$countPrSub1_3 = 0;
|
|
} else {
|
|
if ($datShm[0]['AKSES_ID']>=1) {
|
|
$countPrSub1_3 = $this->Amod->getCount_RekapProyek_bySTATUS(1);
|
|
} else {
|
|
$countPrSub1_3 = 0;
|
|
}
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "PR", "TRANSAKSI - Pengawasan");
|
|
if ($datShm==FALSE) {
|
|
$countPrSub1_4 = 0;
|
|
} else {
|
|
if ($datShm[0]['AKSES_ID']>=2) {
|
|
$countPrSub1_4 = $this->Amod->getCount_Proyek_status9_tglBatalNull();
|
|
} else {
|
|
$countPrSub1_4 = 0;
|
|
}
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "SP", "TRANSAKSI - Administrasi");
|
|
if ($datShm==FALSE) {
|
|
$countSpSub1_5 = 0;
|
|
} else {
|
|
if ($datShm[0]['AKSES_ID']==0) {
|
|
$countSpSub1_5 = 0;
|
|
} else {
|
|
$countSpSub1_5 = $this->Amod->getCount_CreditNote_bySTATUS(0);
|
|
}
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "SV", "TRANSAKSI - Stok Internal");
|
|
if ($datShm==FALSE) {
|
|
$countSvSub1_1 = 0;
|
|
} else {
|
|
if ($datShm[0]['AKSES_ID']==0) {
|
|
$countSvSub1_1 = 0;
|
|
} else {
|
|
$countSvSub1_1 = $this->Amod->getCount_Service_status1_jenisNot0();
|
|
}
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "SV", "TRANSAKSI - Pengerjaan");
|
|
if ($datShm==FALSE) {
|
|
$countSvSub1_3 = 0;
|
|
} else {
|
|
if ($datShm[0]['AKSES_ID']==0) {
|
|
$countSvSub1_3 = 0;
|
|
} else {
|
|
$countSvSub1_3 = $this->Amod->getCount_SnService_statusNull_selesaiNull();
|
|
}
|
|
}
|
|
|
|
if ($id_karyawan==1 OR strpos($jabatan,"PIMPINAN")!==FALSE OR $username=="helda" OR $username=="venny" OR $username=="suvi" OR $username=="anita") {
|
|
$countKuSub2_1 = $this->Amod->getCount_PajakDibayarDimuka_PPH22Only();
|
|
$countKuSub2_2 = $this->Amod->getCount_PajakDibayarDimuka_PPH23Only();
|
|
$countKuSub2_3 = $this->Amod->getCount_Penjualan_PPNOnly();
|
|
} else {
|
|
$countKuSub2_1 = 0;
|
|
$countKuSub2_2 = 0;
|
|
$countKuSub2_3 = 0;
|
|
}
|
|
|
|
$codeRed = 0;
|
|
if ($id_karyawan==1) {
|
|
$countKuantiti = $this->Amod->getCount_Kuantiti_proseslessthan0();
|
|
$countHq = $this->Amod->getCount_HistoriKuantiti_lessthan0();
|
|
$countHhhda = $this->Amod->getCount_HasilHitungHda_bySTATUS(2);
|
|
$countHhpda = $this->Amod->getCount_HasilHitungPda_bySTATUS(2);
|
|
|
|
if ($countKuantiti>0) {
|
|
$codeRed = 1;
|
|
} else if ($countHq>0) {
|
|
$codeRed = 2;
|
|
} else if ($countHhhda>0) {
|
|
$codeRed = 3;
|
|
} else if ($countHhpda>0) {
|
|
$codeRed = 4;
|
|
}
|
|
}
|
|
} else {
|
|
$countPjSub1_1 = 0;
|
|
$countPjSub1_2 = 0;
|
|
$countPjSub1_3 = 0;
|
|
$countPjSub1_4 = 0;
|
|
$countPjSub1_5 = 0;
|
|
$countPjSub1_6 = 0;
|
|
$countKuSub3_5 = 0;
|
|
$countPrSub1_1 = 0;
|
|
$countPrSub1_2 = 0;
|
|
$countPrSub1_3 = 0;
|
|
$countPrSub1_4 = 0;
|
|
$countSpSub1_5 = 0;
|
|
$countSvSub1_1 = 0;
|
|
$countSvSub1_3 = 0;
|
|
$countKuSub2_1 = 0;
|
|
$countKuSub2_2 = 0;
|
|
$countKuSub2_3 = 0;
|
|
$codeRed = 0;
|
|
}
|
|
|
|
$data = array(
|
|
'codeRed' => $codeRed,
|
|
'countPjSub1_1' => $countPjSub1_1,
|
|
'countPjSub1_2' => $countPjSub1_2,
|
|
'countPjSub1_3' => $countPjSub1_3,
|
|
'countPjSub1_4' => $countPjSub1_4,
|
|
'countPjSub1_5' => $countPjSub1_5,
|
|
'countPjSub1_6' => $countPjSub1_6,
|
|
'countKuSub3_5' => $countKuSub3_5,
|
|
'countPrSub1_1' => $countPrSub1_1,
|
|
'countPrSub1_2' => $countPrSub1_2,
|
|
'countPrSub1_3' => $countPrSub1_3,
|
|
'countPrSub1_4' => $countPrSub1_4,
|
|
'countSpSub1_5' => $countSpSub1_5,
|
|
'countSvSub1_1' => $countSvSub1_1,
|
|
'countSvSub1_3' => $countSvSub1_3,
|
|
'countKuSub2_1' => $countKuSub2_1,
|
|
'countKuSub2_2' => $countKuSub2_2,
|
|
'countKuSub2_3' => $countKuSub2_3,
|
|
);
|
|
$this->output_json($data);
|
|
}
|
|
|
|
public function GE_Kalkulasi_RingkasanKasbank() {
|
|
$now = date('Y-m-d');
|
|
$jabatan = $this->session->userdata('jabatan');
|
|
|
|
if (strpos($jabatan,"KEUANGAN")!==FALSE OR $jabatan=="ADMINISTRATOR" OR $jabatan=="PIMPINAN") {
|
|
$kas01 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byKAS_dataNow(1, 1, $now);
|
|
$kas01 = $kas01[0]['DEBET']-$kas01[0]['KREDIT'];
|
|
|
|
$kas02 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byKAS_dataNow(1, 2, $now);
|
|
$kas02 = $kas02[0]['DEBET']-$kas02[0]['KREDIT'];
|
|
|
|
$bank01 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byBANK_dataNow(2, 1, $now);
|
|
$bank01 = $bank01[0]['DEBET']-$bank01[0]['KREDIT'];
|
|
|
|
$bank03 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byBANK_dataNow(2, 3, $now);
|
|
$bank03 = $bank03[0]['DEBET']-$bank03[0]['KREDIT'];
|
|
|
|
$bank04 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byBANK_dataNow(2, 4, $now);
|
|
$bank04 = $bank04[0]['DEBET']-$bank04[0]['KREDIT'];
|
|
|
|
$bank05 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byBANK_dataNow(2, 5, $now);
|
|
$bank05 = $bank05[0]['DEBET']-$bank05[0]['KREDIT'];
|
|
|
|
$bank06 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byBANK_dataNow(2, 6, $now);
|
|
$bank06 = $bank06[0]['DEBET']-$bank06[0]['KREDIT'];
|
|
|
|
$bank07 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byBANK_dataNow(2, 7, $now);
|
|
$bank07 = $bank07[0]['DEBET']-$bank07[0]['KREDIT'];
|
|
|
|
$bank08 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byBANK_dataNow(2, 8, $now);
|
|
$bank08 = $bank08[0]['DEBET']-$bank08[0]['KREDIT'];
|
|
|
|
$bank09 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byBANK_dataNow(2, 9, $now);
|
|
$bank09 = $bank09[0]['DEBET']-$bank09[0]['KREDIT'];
|
|
|
|
$bank10 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byBANK_dataNow(2, 10, $now);
|
|
$bank10 = $bank10[0]['DEBET']-$bank10[0]['KREDIT'];
|
|
|
|
$bank11 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byBANK_dataNow(2, 11, $now);
|
|
$bank11 = $bank11[0]['DEBET']-$bank11[0]['KREDIT'];
|
|
|
|
$bank12 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byBANK_dataNow(2, 12, $now);
|
|
$bank12 = $bank12[0]['DEBET']-$bank12[0]['KREDIT'];
|
|
|
|
$bank13 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byBANK_dataNow(2, 13, $now);
|
|
$bank13 = $bank13[0]['DEBET']-$bank13[0]['KREDIT'];
|
|
|
|
$bank14 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byBANK_dataNow(2, 14, $now);
|
|
$bank14 = $bank14[0]['DEBET']-$bank14[0]['KREDIT'];
|
|
|
|
$bank15 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byBANK_dataNow(2, 15, $now);
|
|
$bank15 = $bank15[0]['DEBET']-$bank15[0]['KREDIT'];
|
|
|
|
$bank16 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byBANK_dataNow(2, 16, $now);
|
|
$bank16 = $bank16[0]['DEBET']-$bank16[0]['KREDIT'];
|
|
|
|
$bank17 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byBANK_dataNow(2, 17, $now);
|
|
$bank17 = $bank17[0]['DEBET']-$bank17[0]['KREDIT'];
|
|
} else {
|
|
$kas01 = 0;
|
|
$kas02 = 0;
|
|
$bank01 = 0;
|
|
$bank03 = 0;
|
|
$bank04 = 0;
|
|
$bank05 = 0;
|
|
$bank06 = 0;
|
|
$bank07 = 0;
|
|
$bank08 = 0;
|
|
$bank09 = 0;
|
|
$bank10 = 0;
|
|
$bank11 = 0;
|
|
$bank12 = 0;
|
|
$bank13 = 0;
|
|
$bank14 = 0;
|
|
$bank15 = 0;
|
|
$bank16 = 0;
|
|
$bank17 = 0;
|
|
}
|
|
|
|
$data = array(
|
|
'kas01' => number_format($kas01,2),
|
|
'kas02' => number_format($kas02,2),
|
|
'bank01' => number_format($bank01,2),
|
|
'bank03' => number_format($bank03,2),
|
|
'bank04' => number_format($bank04,2),
|
|
'bank05' => number_format($bank05,2),
|
|
'bank06' => number_format($bank06,2),
|
|
'bank07' => number_format($bank07,2),
|
|
'bank08' => number_format($bank08,2),
|
|
'bank09' => number_format($bank09,2),
|
|
'bank10' => number_format($bank10,2),
|
|
'bank11' => number_format($bank11,2),
|
|
'bank12' => number_format($bank12,2),
|
|
'bank13' => number_format($bank13,2),
|
|
'bank14' => number_format($bank14,2),
|
|
'bank15' => number_format($bank15,2),
|
|
'bank16' => number_format($bank16,2),
|
|
'bank17' => number_format($bank17,2),
|
|
);
|
|
$this->output_json($data);
|
|
}
|
|
|
|
public function GE_Kalkulasi_RingkasanKpiSales() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$jabatan = $this->session->userdata('jabatan');
|
|
|
|
$datPkpi = $this->Amod->getData_PeriodeKpi_orderDESC_limit1();
|
|
$limit = $datPkpi[0]['AWAL_PKPI'];
|
|
$atas = $datPkpi[0]['AKHIR_PKPI'];
|
|
|
|
if ($jabatan=="ADMINISTRATOR" OR $jabatan=="KADIV SALES" OR $jabatan=="PIMPINAN") {
|
|
$id_karyawan = NULL;
|
|
}
|
|
|
|
$kpiVisit = 0;
|
|
$datKunjungan = $this->Amod->getData_Kunjungan_byPERIODE_statusNot9($limit, $atas);
|
|
foreach ($datKunjungan as $key) {
|
|
$listSales = explode(',', $key['SALES_KUNJUNGAN']);
|
|
foreach ($listSales as $dat) {
|
|
if ($dat==$id_karyawan) {
|
|
$kpiVisit++;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
$kpiPenawaran = 0;
|
|
$datPenawaran = $this->Amod->getData_Penawaran_byPERIODE_statusAktif($limit, $atas);
|
|
foreach ($datPenawaran as $key) {
|
|
if ($id_karyawan==NULL) {
|
|
$kpiPenawaran = $kpiPenawaran+round($key['NILAI_PENAWARAN'], 2);
|
|
} else {
|
|
$listSales = explode(',', $key['SALES_PENAWARAN']);
|
|
foreach ($listSales as $dat) {
|
|
if ($id_karyawan==$dat) {
|
|
$datKaryawan = $this->Amod->getData_Karyawan_byID($dat);
|
|
if ($datKaryawan[0]['NAMA_JABATAN']=="SALES CHANNEL" OR $datKaryawan[0]['NAMA_PANGGILAN_KARYAWAN']=="Anton") {
|
|
$kpiPenawaran = $kpiPenawaran+round($key['NILAI_PENAWARAN'], 2);
|
|
} else if (sizeof($listSales)==1) {
|
|
$kpiPenawaran = $kpiPenawaran+round($key['NILAI_PENAWARAN'], 2);
|
|
} else {
|
|
$sumDpne = $this->Amod->getSum_DaftarPenawaran_byPENAWARAN_byVERSI_bySALES($key['ID_PENAWARAN'], $key['AKTIF_PENAWARAN'], $dat);
|
|
if ($sumDpne==FALSE OR $sumDpne[0]['TOTAL']==NULL) {
|
|
|
|
} else {
|
|
$kpiPenawaran = $kpiPenawaran+round($sumDpne[0]['TOTAL'], 2);
|
|
}
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
if ($id_karyawan==NULL) {
|
|
$kpiVisit = count($datKunjungan);
|
|
}
|
|
|
|
$sumHhpda = $this->Amod->getSum_HasilHitungPda_byKARYAWAN_byPERIODE_status1($id_karyawan, $limit);
|
|
if ($sumHhpda==FALSE OR $sumHhpda[0]['TOTAL']==NULL) {
|
|
$kpiOmzet = "0.00";
|
|
} else {
|
|
$kpiOmzet = number_format($sumHhpda[0]['TOTAL'], 2);
|
|
}
|
|
|
|
$datDpcNb = $this->Amod->getData_DaftarPromoClearance_bySALES_byPERIODE_byJENIS($id_karyawan, $limit, 2);
|
|
$kpiNb = 0;
|
|
foreach ($datDpcNb as $key) {
|
|
$nilaiSo = round(($key['QTY_DO']*$key['HARGA_DO'])*(($key['PPN_SO']+100)/100),2);
|
|
$kpiNb = $kpiNb+$nilaiSo;
|
|
}
|
|
|
|
$datDpcAio = $this->Amod->getData_DaftarPromoClearance_bySALES_byPERIODE_byJENIS($id_karyawan, $limit, 3);
|
|
$kpiAio = 0;
|
|
foreach ($datDpcAio as $key) {
|
|
$nilaiSo = round(($key['QTY_DO']*$key['HARGA_DO'])*(($key['PPN_SO']+100)/100),2);
|
|
$kpiAio = $kpiAio+$nilaiSo;
|
|
}
|
|
|
|
$data = array(
|
|
'kpiOmzet' => $kpiOmzet,
|
|
'kpiPenawaran' => number_format($kpiPenawaran,2),
|
|
'kpiVisit' => $kpiVisit,
|
|
'kpiAio' => number_format($kpiAio,2),
|
|
'kpiNb' => number_format($kpiNb,2),
|
|
);
|
|
$this->output_json($data);
|
|
}
|
|
|
|
public function GE_Kalkulasi_RingkasanLogin() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$jabatan = $this->session->userdata('jabatan');
|
|
$username = $this->session->userdata('username');
|
|
$now = date('Y-m-d');
|
|
|
|
$active = 0;
|
|
$countMb = 0;
|
|
$countPb = 0;
|
|
if (strpos($jabatan,"GUDANG")!==FALSE OR $jabatan=="ADMIN ITP" OR $username=="service" OR $id_karyawan==18) {
|
|
if (strpos($jabatan,"GUDANG")!==FALSE) {
|
|
$countMb = $this->Amod->getCount_MutasiBarang_HQOnly();
|
|
} else if (strpos($jabatan,"ADMIN ITP")!==FALSE) {
|
|
$countMb = $this->Amod->getCount_MutasiBarang_ITPOnly();
|
|
} else if ($username=="service") {
|
|
$countMb = $this->Amod->getCount_MutasiBarang_ServiceOnly();
|
|
} else if ($id_karyawan==18) {
|
|
$countPb = $this->Amod->getCount_Pembelian_bySTATUS(0);
|
|
}
|
|
$active = 1;
|
|
}
|
|
|
|
$data = array(
|
|
'countPb' => $countPb,
|
|
'countMb' => $countMb,
|
|
'active' => $active,
|
|
);
|
|
$this->output_json($data);
|
|
}
|
|
|
|
public function GE_Kalkulasi_RingkasanOmzetSales() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$awal = date('Y-01-01');
|
|
$akhir = date('Y-12-31');
|
|
|
|
$getJumlahNota = $this->Amod->getCount_SalesOrder_status1_TargetSales($id_karyawan);
|
|
$getTotalNilai = $this->Amod->getSum_DaftarAkuntansi_bySALES_BrutoOnly($id_karyawan, $awal, $akhir);
|
|
$getTotalRetur = $this->Amod->getSum_DaftarAkuntansi_bySALES_ReturOnly($id_karyawan, $awal, $akhir);
|
|
$getTotalTerbayar = $this->Amod->getSum_DaftarAkuntansi_bySALES_TerbayarOnly($id_karyawan, $awal, $akhir);
|
|
$getTotalBelumLunas = $this->Amod->getSum_DaftarAkuntansi_bySALES_BelumLunasOnly($id_karyawan, $awal, $akhir);
|
|
$getTotalTahunLalu = $this->Amod->getSum_DaftarAkuntansi_bySALES_TahunBeforeOnly($id_karyawan);
|
|
|
|
if ($getTotalNilai==FALSE OR $getTotalNilai[0]['TOTAL']==NULL) {
|
|
$omzet2 = "0.00";
|
|
} else {
|
|
$omzet2 = number_format($getTotalNilai[0]['TOTAL'],2);
|
|
}
|
|
|
|
if ($getTotalRetur==FALSE OR $getTotalRetur[0]['TOTAL']==NULL) {
|
|
$omzet3 = "0.00";
|
|
} else {
|
|
$omzet3 = number_format($getTotalRetur[0]['TOTAL'],2);
|
|
}
|
|
|
|
if ($getTotalTerbayar==FALSE OR $getTotalTerbayar[0]['TOTAL']==NULL) {
|
|
$omzet4 = "0.00";
|
|
} else {
|
|
$omzet4 = number_format($getTotalTerbayar[0]['TOTAL'],2);
|
|
}
|
|
|
|
if ($getTotalBelumLunas==FALSE OR $getTotalBelumLunas[0]['TOTAL']==NULL) {
|
|
$omzet5 = "0.00";
|
|
} else {
|
|
$omzet5 = number_format($getTotalBelumLunas[0]['TOTAL'],2);
|
|
}
|
|
|
|
if ($getTotalTahunLalu==FALSE OR $getTotalTahunLalu[0]['TOTAL']==NULL) {
|
|
$omzet6 = "0.00";
|
|
} else {
|
|
$omzet6 = number_format($getTotalTahunLalu[0]['TOTAL'],2);
|
|
}
|
|
|
|
$data = array(
|
|
'omzet1' => $getJumlahNota,
|
|
'omzet2' => $omzet2,
|
|
'omzet3' => $omzet3,
|
|
'omzet4' => $omzet4,
|
|
'omzet5' => $omzet5,
|
|
'omzet6' => $omzet6,
|
|
);
|
|
$this->output_json($data);
|
|
}
|
|
|
|
public function GE_Kalkulasi_TrialBalanceTahunan() {
|
|
$id_pak = date('Y');
|
|
|
|
$cekHhtb = $this->Amod->getData_HasilHitungTb_byPAK($id_pak);
|
|
if ($cekHhtb==FALSE) {
|
|
$datPak = $this->Amod->getData_PeriodeAkuntansi_likeYear_orderASC_limit1($id_pak);
|
|
$limit = $datPak[0]['ID_PAK'];
|
|
|
|
$datHhtb = $this->Amod->getData_HasilHitungTb_byPAK_byKOLOM($limit, "C");
|
|
foreach ($datHhtb as $key) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => $key['AKUN_HHTB'],
|
|
'KOLOM_HHTB' => "C",
|
|
'NILAI_HHTB' => $key['NILAI_HHTB']
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
|
|
$datHhtb = $this->Amod->getData_HasilHitungTb_byPAK_byKOLOM($limit, "D");
|
|
foreach ($datHhtb as $key) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => $key['AKUN_HHTB'],
|
|
'KOLOM_HHTB' => "D",
|
|
'NILAI_HHTB' => $key['NILAI_HHTB']
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
|
|
$sumHhtb = $this->Amod->getSum_HasilHitungTb_byYEAR_notC_notD($id_pak);
|
|
foreach ($sumHhtb as $key) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => $key['AKUN_HHTB'],
|
|
'KOLOM_HHTB' => $key['KOLOM_HHTB'],
|
|
'NILAI_HHTB' => $key['NILAI']
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
}
|
|
} else {
|
|
$sumHhtb = $this->Amod->getSum_HasilHitungTb_byYEAR_notC_notD($id_pak);
|
|
foreach ($sumHhtb as $key) {
|
|
$recheck = $this->Amod->getData_HasilHitungTb_byPAK_byAKUN_byKOLOM($id_pak, $key['AKUN_HHTB'], $key['KOLOM_HHTB']);
|
|
if ($recheck==FALSE) {
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'AKUN_HHTB' => $key['AKUN_HHTB'],
|
|
'KOLOM_HHTB' => $key['KOLOM_HHTB'],
|
|
'NILAI_HHTB' => $key['NILAI']
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungtb', $input);
|
|
} else {
|
|
$update = [
|
|
'NILAI_HHTB' => $key['NILAI']
|
|
];
|
|
$action = $this->Amod->update('hasil_hitungtb', $update, 'ID_HHTB', $recheck[0]['ID_HHTB']);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// FUNGSI LAINNYA
|
|
public function GE_AmbilData_IPAddress() {
|
|
// Check for shared internet/ISP IP
|
|
if (!empty($_SERVER['HTTP_CLIENT_IP']) && $this->GE_AmbilData_ValidasiIP($_SERVER['HTTP_CLIENT_IP']))
|
|
return $_SERVER['HTTP_CLIENT_IP'];
|
|
|
|
// Check for IPs passing through proxies
|
|
if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
|
|
// Check if multiple IP addresses exist in var
|
|
$iplist = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']);
|
|
foreach ($iplist as $ip) {
|
|
if ($this->GE_AmbilData_ValidasiIP($ip))
|
|
return $ip;
|
|
}
|
|
}
|
|
|
|
if (!empty($_SERVER['HTTP_X_FORWARDED']) && $this->GE_AmbilData_ValidasiIP($_SERVER['HTTP_X_FORWARDED']))
|
|
return $_SERVER['HTTP_X_FORWARDED'];
|
|
if (!empty($_SERVER['HTTP_X_CLUSTER_CLIENT_IP']) && $this->GE_AmbilData_ValidasiIP($_SERVER['HTTP_X_CLUSTER_CLIENT_IP']))
|
|
return $_SERVER['HTTP_X_CLUSTER_CLIENT_IP'];
|
|
if (!empty($_SERVER['HTTP_FORWARDED_FOR']) && $this->GE_AmbilData_ValidasiIP($_SERVER['HTTP_FORWARDED_FOR']))
|
|
return $_SERVER['HTTP_FORWARDED_FOR'];
|
|
if (!empty($_SERVER['HTTP_FORWARDED']) && $this->GE_AmbilData_ValidasiIP($_SERVER['HTTP_FORWARDED']))
|
|
return $_SERVER['HTTP_FORWARDED'];
|
|
|
|
// Return unreliable IP address since all else failed
|
|
return $_SERVER['REMOTE_ADDR'];
|
|
}
|
|
|
|
public function GE_AmbilData_DaftarPromoClearance() {
|
|
$id_karyawan = $this->input->post('id_karyawan');
|
|
|
|
$countDpc = $this->Amod->getCount_DaftarPromoClearance_byKARYAWAN_bySTATUS_NotStpc($id_karyawan, 0);
|
|
|
|
$this->output_json([
|
|
'countDpc' => $countDpc
|
|
]);
|
|
}
|
|
|
|
public function GE_AmbilData_DataKuantiti($id, $jenis) {
|
|
$datKuantiti = $this->Amod->getData_Kuantiti_byID($id);
|
|
if ($jenis==0) {
|
|
$qty = $datKuantiti[0]['GLOBAL_KUANTITI'];
|
|
} else if ($jenis==1) {
|
|
$qty = $datKuantiti[0]['PCM_KUANTITI'];
|
|
} else if ($jenis==2) {
|
|
$qty = $datKuantiti[0]['ITP_KUANTITI'];
|
|
} else if ($jenis==3) {
|
|
$qty = $datKuantiti[0]['PROSES_KUANTITI'];
|
|
} else if ($jenis==4) {
|
|
$qty = $datKuantiti[0]['ANTIK_KUANTITI'];
|
|
} else if ($jenis==5) {
|
|
$qty = $datKuantiti[0]['KONSINYASI_KUANTITI'];
|
|
} else if ($jenis==6) {
|
|
$qty = $datKuantiti[0]['MUTASI_KUANTITI'];
|
|
} else if ($jenis==7) {
|
|
$qty = $datKuantiti[0]['PEMINJAMAN_KUANTITI'];
|
|
} else if ($jenis==8) {
|
|
$qty = $datKuantiti[0]['PENDING_KUANTITI'];
|
|
} else if ($jenis==9) {
|
|
$qty = $datKuantiti[0]['PROYEK_KUANTITI'];
|
|
} else if ($jenis==10) {
|
|
$qty = $datKuantiti[0]['SERVICE_KUANTITI'];
|
|
} else if ($jenis==11) {
|
|
$qty = $datKuantiti[0]['SEWA_KUANTITI'];
|
|
}
|
|
|
|
return $qty;
|
|
}
|
|
|
|
public function GE_AmbilData_ValidasiIP($ip) {
|
|
if (filter_var($ip, FILTER_VALIDATE_IP,
|
|
FILTER_FLAG_IPV4 |
|
|
FILTER_FLAG_IPV6 |
|
|
FILTER_FLAG_NO_PRIV_RANGE |
|
|
FILTER_FLAG_NO_RES_RANGE) === false)
|
|
return false;
|
|
self::$ip = $ip;
|
|
return true;
|
|
}
|
|
|
|
public function GE_AmbilData_SetOtomasiJs() {
|
|
$datSojs = $this->Amod->getData_SetOtomasiJs();
|
|
|
|
$this->output_json([
|
|
'bawah_sojs' => $datSojs[0]['BAWAH_SOJS'],
|
|
'atas_sojs' => $datSojs[0]['ATAS_SOJS'],
|
|
]);
|
|
}
|
|
|
|
public function GE_AmbilData_MasterBarang() {
|
|
$search = $this->input->post('search');
|
|
$mode = $this->input->post('mode');
|
|
// Mode 1 adalah hanya Stok Barang (Punya Kuantiti) yang muncul
|
|
// Mode 2 adalah semua Kode Barang (Termasuk Jasa)
|
|
|
|
$data = $this->Amod->getData_Barang_bySEARCH_byMODE_status1_limit20($search, $mode);
|
|
|
|
$this->output_json([
|
|
'data' => $data
|
|
]);
|
|
}
|
|
|
|
public function GE_AmbilData_MasterPelanggan() {
|
|
$search = $this->input->post('search');
|
|
|
|
$data = $this->Amod->getData_Pelanggan_bySEARCH_status1_limit10($search);
|
|
|
|
$this->output_json([
|
|
'data' => $data
|
|
]);
|
|
}
|
|
|
|
public function GE_AmbilData_MasterSupplier() {
|
|
$search = $this->input->post('search');
|
|
|
|
$data = $this->Amod->getData_Supplier_bySEARCH_status1_limit20($search);
|
|
|
|
$this->output_json([
|
|
'data' => $data
|
|
]);
|
|
}
|
|
|
|
public function GE_AmbilData_MasterJenis() {
|
|
$search = $this->input->post('search');
|
|
$mode = $this->input->post('mode');
|
|
|
|
if ($mode==1) { // Tanpa Jenis NonQty
|
|
$data = $this->Amod->getData_Jenis_bySEARCH_status1_limit20_typeNotNonQty($search);
|
|
}
|
|
|
|
$this->output_json([
|
|
'data' => $data
|
|
]);
|
|
}
|
|
|
|
public function GE_AmbilData_MasterKelompok() {
|
|
$search = $this->input->post('search');
|
|
|
|
$data = $this->Amod->getData_Kelompok_bySEARCH_status1_limit20($search);
|
|
|
|
$this->output_json([
|
|
'data' => $data
|
|
]);
|
|
}
|
|
|
|
public function GE_AmbilData_MasterKota() {
|
|
$search = $this->input->post('search');
|
|
|
|
$data = $this->Amod->getData_Kota_bySEARCH_status1_limit20($search);
|
|
|
|
$this->output_json([
|
|
'data' => $data
|
|
]);
|
|
}
|
|
|
|
public function GE_AmbilData_MasterJabatan() {
|
|
$search = $this->input->post('search');
|
|
|
|
$data = $this->Amod->getData_Jabatan_bySEARCH_status1_limit20($search);
|
|
|
|
$this->output_json([
|
|
'data' => $data
|
|
]);
|
|
}
|
|
|
|
public function GE_AmbilData_MasterUnitService() {
|
|
$search = $this->input->post('search');
|
|
|
|
$data = $this->Amod->getData_UnitService_bySEARCH_status1_limit10($search);
|
|
|
|
$this->output_json([
|
|
'data' => $data
|
|
]);
|
|
}
|
|
|
|
public function GE_AmbilData_DataSnService() {
|
|
$search = $this->input->post('search');
|
|
|
|
$data = $this->Amod->getData_SnService_bySEARCH_status1_limit20($search);
|
|
|
|
$this->output_json([
|
|
'data' => $data
|
|
]);
|
|
}
|
|
|
|
public function GE_AmbilData_SalesProduk() {
|
|
$data = $this->Amod->getData_SetSalesProduk_groupSALES();
|
|
|
|
$this->output_json([
|
|
'data' => $data
|
|
]);
|
|
}
|
|
|
|
public function GE_AmbilData_Barang() {
|
|
$id_barang = $this->input->post('id_barang');
|
|
|
|
$data = $this->Amod->getData_Barang_byID_bySTATUS($id_barang, 1);
|
|
|
|
$this->output_json([
|
|
'kode_barang' => $data[0]['KODE_BARANG']
|
|
]);
|
|
}
|
|
|
|
public function GE_AmbilData_PilihPelanggan() {
|
|
$id_pelanggan = $this->input->post('id_pelanggan');
|
|
|
|
$data = $this->Amod->getData_Pelanggan_byID_bySTATUS($id_pelanggan, 1);
|
|
|
|
$this->output_json([
|
|
'nama_pelanggan' => $data[0]['NAMA_PELANGGAN'],
|
|
'telp_pelanggan' => $data[0]['TELP_PELANGGAN']
|
|
]);
|
|
}
|
|
|
|
public function GE_AmbilData_CariSnKlaimProgram() {
|
|
$search = $this->input->post('search');
|
|
|
|
$data = $this->Amod->getData_SnKlaimProgram_bySEARCH_limit20($search);
|
|
|
|
$this->output_json([
|
|
'data' => $data
|
|
]);
|
|
}
|
|
|
|
public function GE_AmbilData_CariAkuntansiKas() {
|
|
$search = $this->input->post('search');
|
|
$id_kas = $this->input->post('id_kas');
|
|
|
|
$data = $this->Amod->getData_Akuntansi_byKAS_bySEARCH_limit20_status1_thisMonth($id_kas, $search);
|
|
|
|
$this->output_json([
|
|
'data' => $data
|
|
]);
|
|
}
|
|
|
|
public function GE_AmbilData_CariAkuntansiBank() {
|
|
$search = $this->input->post('search');
|
|
$id_bank = $this->input->post('id_bank');
|
|
|
|
$data = $this->Amod->getData_Akuntansi_byBANK_bySEARCH_limit20_status1_thisMonth($id_bank, $search);
|
|
|
|
$this->output_json([
|
|
'data' => $data
|
|
]);
|
|
}
|
|
|
|
public function GE_AmbilData_CariPeriodeAkuntansi() {
|
|
$search = $this->input->post('search');
|
|
|
|
$data = $this->Amod->getData_PeriodeAkuntansi_bySEARCH_status1($search);
|
|
|
|
$this->output_json([
|
|
'data' => $data
|
|
]);
|
|
}
|
|
|
|
public function GE_AmbilData_CariAkuntansiKasbank() {
|
|
$search = $this->input->post('search');
|
|
|
|
$data = $this->Amod->getData_Akuntansi_bySEARCH_limit20_status1_status2_forKasbank($search);
|
|
|
|
$this->output_json([
|
|
'data' => $data
|
|
]);
|
|
}
|
|
|
|
public function GE_AmbilData_CariAkuntansiJurnalMemo() {
|
|
$search = $this->input->post('search');
|
|
$verse = $this->input->post('verse');
|
|
|
|
$data = $this->Amod->getData_Akuntansi_bySEARCH_limit20_status1_status2_forJM($search, $verse);
|
|
|
|
$this->output_json([
|
|
'data' => $data
|
|
]);
|
|
}
|
|
|
|
public function GE_AmbilData_CariAkuntansiJurnalSistem() {
|
|
$search = $this->input->post('search');
|
|
|
|
$data = $this->Amod->getData_Akuntansi_bySEARCH_limit20_status1_status2_forJS($search);
|
|
|
|
$this->output_json([
|
|
'data' => $data
|
|
]);
|
|
}
|
|
|
|
public function GE_AmbilData_CariSnStock() {
|
|
$search = $this->input->post('search');
|
|
$verse = $this->input->post('verse');
|
|
|
|
if ($verse==1) {
|
|
$data = $this->Amod->getData_SnStock_bySEARCH_allStatus_limit20($search);
|
|
$count = $this->Amod->getCount_SnStock_allStatus();
|
|
}
|
|
|
|
$this->output_json([
|
|
'data' => $data,
|
|
'count' => $count,
|
|
]);
|
|
}
|
|
|
|
public function GE_AmbilData_CariTransaksiStock() {
|
|
$search = $this->input->post('search');
|
|
$verse = $this->input->post('verse');
|
|
|
|
if ($verse==1) {
|
|
$data = $this->Amod->getData_TransaksiStock_bySEARCH_allStatus_limit20($search);
|
|
$count = $this->Amod->getCount_TransaksiStock_status1_groupKODE();
|
|
}
|
|
|
|
$this->output_json([
|
|
'data' => $data,
|
|
'count' => $count,
|
|
]);
|
|
}
|
|
|
|
public function GE_AmbilData_CariKaryawan() {
|
|
$search = $this->input->post('search');
|
|
$verse = $this->input->post('verse');
|
|
|
|
if ($verse==1) {
|
|
$data = $this->Amod->getData_Karyawan_bySEARCH_allStatus_limit30($search, $verse);
|
|
|
|
}
|
|
|
|
$this->output_json([
|
|
'data' => $data,
|
|
]);
|
|
}
|
|
|
|
public function GE_AmbilData_CariKonsinyasi() {
|
|
$search = $this->input->post('search');
|
|
$verse = $this->input->post('verse');
|
|
|
|
if ($verse==1) {
|
|
$data = $this->Amod->getData_Konsinyasi_bySEARCH_allStatus_limit20($search);
|
|
$count = $this->Amod->getCount_Konsinyasi_allStatus();
|
|
}
|
|
|
|
$this->output_json([
|
|
'data' => $data,
|
|
'count' => $count
|
|
]);
|
|
}
|
|
|
|
public function GE_AmbilData_CariMutasiBarang() {
|
|
$search = $this->input->post('search');
|
|
$verse = $this->input->post('verse');
|
|
|
|
if ($verse==1) {
|
|
$data = $this->Amod->getData_MutasiBarang_bySEARCH_allStatus_limit20($search);
|
|
$count = $this->Amod->getCount_MutasiBarang_allStatus();
|
|
}
|
|
|
|
$this->output_json([
|
|
'data' => $data,
|
|
'count' => $count
|
|
]);
|
|
}
|
|
|
|
public function GE_AmbilData_CariPenarikanKonsi() {
|
|
$search = $this->input->post('search');
|
|
$verse = $this->input->post('verse');
|
|
|
|
if ($verse==1) {
|
|
$data = $this->Amod->getData_PenarikanKonsi_bySEARCH_allStatus_limit20($search);
|
|
$count = $this->Amod->getCount_PenarikanKonsi_allStatus();
|
|
}
|
|
|
|
$this->output_json([
|
|
'data' => $data,
|
|
'count' => $count
|
|
]);
|
|
}
|
|
|
|
public function GE_AmbilData_CariPenjualan() {
|
|
$search = $this->input->post('search');
|
|
$verse = $this->input->post('verse');
|
|
$hak = $this->input->post('hak');
|
|
$now = date('Y-m-d');
|
|
$limit = date('Y-m-01');
|
|
|
|
if ($hak>=3) {
|
|
$awal = $this->Amod->generate_subYear($limit, 1);
|
|
$ketMenu = "Penjualan 1 Tahun Kebelakang";
|
|
} else if ($hak>0) {
|
|
$awal = $this->Amod->generate_subMonth($limit, 2);
|
|
$ketMenu = "Penjualan 2 Bulan Kebelakang";
|
|
} else {
|
|
$awal = $limit;
|
|
$ketMenu = "Penjualan Bulan ini";
|
|
}
|
|
|
|
if ($verse==1) {
|
|
$data = $this->Amod->getData_Penjualan_bySEARCH_statusNot3_limit20($search);
|
|
} else {
|
|
$data = $this->Amod->getData_Penjualan_byPERIODE_bySEARCH_status1_limit20($awal, $now, $search);
|
|
}
|
|
|
|
$this->output_json([
|
|
'data' => $data,
|
|
'ketMenu' => $ketMenu
|
|
]);
|
|
}
|
|
|
|
public function GE_AmbilData_CariProyek() {
|
|
$search = $this->input->post('search');
|
|
$verse = $this->input->post('verse');
|
|
$hak = $this->input->post('hak');
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$now = date('Y-m-d');
|
|
$limit = date('Y-m-01');
|
|
|
|
if ($verse==1) {
|
|
if ($hak<=1) {
|
|
$data = $this->Amod->getData_Proyek_bySALES_bySEARCH_allStatus_limit20($id_karyawan, $search);
|
|
} else {
|
|
$data = $this->Amod->getData_Proyek_bySEARCH_allStatus_limit20($search);
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'data' => $data,
|
|
]);
|
|
}
|
|
|
|
public function GE_AmbilData_CariService() {
|
|
$search = $this->input->post('search');
|
|
$verse = $this->input->post('verse');
|
|
|
|
if ($verse==1) {
|
|
$data = $this->Amod->getData_Service_bySEARCH_allStatus_limit20($search);
|
|
}
|
|
|
|
$this->output_json([
|
|
'data' => $data,
|
|
]);
|
|
}
|
|
|
|
public function GE_AmbilData_CariSo() {
|
|
$search = $this->input->post('search');
|
|
$verse = $this->input->post('verse');
|
|
|
|
if ($verse==1) { // Cari SO yang sudah muncul SJ dan Nota
|
|
$data = $this->Amod->getData_SalesOrder_bySEARCH_limit20_status1($search);
|
|
} else if ($verse==2) { // Cari SO semua statusnya
|
|
$data = $this->Amod->getData_SalesOrder_bySEARCH_limit20_allStatus($search);
|
|
}
|
|
|
|
$this->output_json([
|
|
'data' => $data
|
|
]);
|
|
}
|
|
|
|
public function GE_AmbilData_CariRj() {
|
|
$search = $this->input->post('search');
|
|
|
|
$data = $this->Amod->getData_ReturPenjualan_bySEARCH_limit20($search);
|
|
|
|
$this->output_json([
|
|
'data' => $data
|
|
]);
|
|
}
|
|
|
|
public function GE_AmbilData_CariFfp() {
|
|
$search = $this->input->post('search');
|
|
$hak = $this->input->post('hak');
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
|
|
if ($hak>=2) {
|
|
$data = $this->Amod->getData_FormFeePelanggan_bySEARCH_limit20($search);
|
|
} else {
|
|
$data = $this->Amod->getData_FormFeePelanggan_bySALES_bySEARCH_limit20($id_karyawan, $search);
|
|
}
|
|
|
|
$this->output_json([
|
|
'data' => $data
|
|
]);
|
|
}
|
|
|
|
public function GE_AmbilData_CariFk() {
|
|
$search = $this->input->post('search');
|
|
|
|
$data = $this->Amod->getData_FormKaryawan_bySEARCH_limit20($search);
|
|
|
|
$this->output_json([
|
|
'data' => $data
|
|
]);
|
|
}
|
|
|
|
public function GE_AmbilData_PilihBiayaProyek() {
|
|
$id_bpry = $this->input->post('id_bpry');
|
|
|
|
$datBpry = $this->Amod->getData_BiayaProyek_byID($id_bpry);
|
|
|
|
$this->output_json([
|
|
'nama_bpry' => $datBpry[0]['NAMA_BPRY'],
|
|
'nilai_bpry' => $datBpry[0]['NILAI_BPRY'],
|
|
]);
|
|
}
|
|
|
|
public function GE_AmbilData_PilihMutasiBarang() {
|
|
$id_mb = $this->input->post('id_mb');
|
|
|
|
$datMb = $this->Amod->getData_MutasiBarang_byID($id_mb);
|
|
if ($datMb[0]['STATUS_MB']==1) {
|
|
$status = "Tunggu ACC";
|
|
} else if ($datMb[0]['STATUS_MB']==2) {
|
|
$status = "Sudah Diterima";
|
|
}
|
|
|
|
$this->output_json([
|
|
'kode_mb' => $datMb[0]['KODE_MB'],
|
|
'cipta_mb' => $datMb[0]['CIPTA_MB'],
|
|
'nama_jmb' => $datMb[0]['NAMA_JMB'],
|
|
'status' => $status,
|
|
]);
|
|
}
|
|
|
|
public function GE_AmbilData_PilihSo() {
|
|
$id_so = $this->input->post('id_so');
|
|
|
|
$datSo = $this->Amod->getData_SalesOrder_byID($id_so);
|
|
$datPenjualan = $this->Amod->getData_Penjualan_bySO($id_so);
|
|
if ($datPenjualan==FALSE) {
|
|
$id_penjualan = 0;
|
|
} else {
|
|
$id_penjualan = $datPenjualan[0]['ID_PENJUALAN'];
|
|
}
|
|
|
|
$this->output_json([
|
|
'kode_so' => $datSo[0]['KODE_SO'],
|
|
'id_penjualan' => $id_penjualan
|
|
]);
|
|
}
|
|
|
|
public function GE_AmbilData_PilihProyek() {
|
|
$id_proyek = $this->input->post('id_proyek');
|
|
|
|
$datProyek = $this->Amod->getData_Proyek_byID($id_proyek);
|
|
|
|
if ($datProyek[0]['JENIS_PROYEK']==1) {
|
|
$jenis = "KUARTAL";
|
|
} else if ($datProyek[0]['JENIS_PROYEK']==2) {
|
|
$jenis = "BULANAN";
|
|
} else if ($datProyek[0]['JENIS_PROYEK']==3) {
|
|
$jenis = "TAHUNAN";
|
|
}
|
|
|
|
if ($datProyek[0]['STATUS_PROYEK']==0) {
|
|
$status = "PROYEK BERJALAN";
|
|
} else if ($datProyek[0]['STATUS_PROYEK']==1 AND $datProyek[0]['RP_ID']==NULL) {
|
|
$status = "SELESAI PROYEK - BELUM LAPORAN";
|
|
} else if ($datProyek[0]['STATUS_PROYEK']==1 AND $datProyek[0]['RP_ID']!=NULL) {
|
|
$status = "SELESAI PROYEK - SUDAH LAPORAN";
|
|
} else if ($datProyek[0]['STATUS_PROYEK']==2) {
|
|
$status = "SELESAI LAPORAN";
|
|
} else if ($datProyek[0]['STATUS_PROYEK']==9) {
|
|
$status = "BATAL PROYEK";
|
|
}
|
|
|
|
$this->output_json([
|
|
'kode_proyek' => $datProyek[0]['KODE_PROYEK'],
|
|
'jenis_proyek' => $datProyek[0]['JENIS_PROYEK'],
|
|
'nama_pelanggan' => $datProyek[0]['NAMA_PELANGGAN'],
|
|
'nama_sales' => $datProyek[0]['NAMA_PANGGILAN_KARYAWAN'],
|
|
'po_proyek' => $datProyek[0]['PO_PROYEK'],
|
|
'cipta_proyek' => $datProyek[0]['CIPTA_PROYEK'],
|
|
'tgl_proyek' => $datProyek[0]['TGL_PROYEK'],
|
|
'tempo_proyek' => $datProyek[0]['TEMPO_PROYEK'],
|
|
'ket_proyek' => $datProyek[0]['KET_PROYEK'],
|
|
'jenis' => $jenis,
|
|
'status' => $status,
|
|
]);
|
|
}
|
|
|
|
public function GE_AmbilData_PilihRekapProyek() {
|
|
$id_rp = $this->input->post('id_rp');
|
|
|
|
$datRp = $this->Amod->getData_RekapProyek_byID($id_rp);
|
|
$datProyek = $this->Amod->getData_Proyek_bySALES_bySEWA($datRp[0]['SAL_ID'], $datRp[0]['PP_ID']);
|
|
|
|
$this->output_json([
|
|
'id_proyek' => $datProyek[0]['ID_PROYEK'],
|
|
]);
|
|
}
|
|
|
|
public function GE_AmbilData_PilihKonsinyasi() {
|
|
$id_konsinyasi = $this->input->post('id_konsinyasi');
|
|
|
|
$datKonsinyasi = $this->Amod->getData_Konsinyasi_byID($id_konsinyasi);
|
|
if ($datKonsinyasi[0]['JENIS_KONSINYASI']==1) {
|
|
$gudang = "[Gudang 1] PC MASTER";
|
|
} else if ($datKonsinyasi[0]['JENIS_KONSINYASI']==2) {
|
|
$gudang = "[Gudang 2] IT POINT";
|
|
}
|
|
|
|
$this->output_json([
|
|
'kode_konsinyasi' => $datKonsinyasi[0]['KODE_KONSINYASI'],
|
|
'cipta_konsinyasi' => $datKonsinyasi[0]['CIPTA_KONSINYASI'],
|
|
'nama_pelanggan' => $datKonsinyasi[0]['NAMA_PELANGGAN'],
|
|
'nasal' => $datKonsinyasi[0]['NAMA_PANGGILAN_KARYAWAN'],
|
|
'status' => $datKonsinyasi[0]['NAMA_SKON'],
|
|
'gudang' => $gudang,
|
|
]);
|
|
}
|
|
|
|
public function GE_AmbilData_PilihPenarikanKonsi() {
|
|
$id_pk = $this->input->post('id_pk');
|
|
|
|
$datPk = $this->Amod->getData_PenarikanKonsi_byID($id_pk);
|
|
if ($datPk[0]['JENIS_PK']==1) {
|
|
$gudang = "[Gudang 1] PC MASTER";
|
|
} else if ($datPk[0]['JENIS_PK']==2) {
|
|
$gudang = "[Gudang 2] IT POINT";
|
|
}
|
|
|
|
$this->output_json([
|
|
'kode_pk' => $datPk[0]['KODE_PK'],
|
|
'cipta_pk' => $datPk[0]['CIPTA_PK'],
|
|
'nama_pelanggan' => $datPk[0]['NAMA_PELANGGAN'],
|
|
'gudang' => $gudang,
|
|
]);
|
|
}
|
|
|
|
public function GE_AmbilData_PilihPenjualan() {
|
|
$id_penjualan = $this->input->post('id_penjualan');
|
|
$search = $this->input->post('search');
|
|
$limit = date('Y-m-01');
|
|
|
|
$datPenjualan = $this->Amod->getData_Penjualan_byID($id_penjualan);
|
|
$datDo = $this->Amod->getData_DaftarOrder_byPENJUALAN($id_penjualan);
|
|
$sumDo = $this->Amod->getSum_DaftarOrder_byPENJUALAN($id_penjualan);
|
|
|
|
if ($datPenjualan==FALSE) {
|
|
$gudang_so = "";
|
|
$dppDo = 0;
|
|
$ppnDo = 0;
|
|
$totDo = 0;
|
|
$lockUbah = 0;
|
|
} else {
|
|
if ($datPenjualan[0]['GUDANG_SO']==0) {
|
|
$gudang_so = "[Gudang 0] OPNAME";
|
|
} else if ($datPenjualan[0]['GUDANG_SO']==1) {
|
|
$gudang_so = "[Gudang 1] PC MASTER";
|
|
} else if ($datPenjualan[0]['GUDANG_SO']==2) {
|
|
$gudang_so = "[Gudang 2] IT POINT";
|
|
} else if ($datPenjualan[0]['GUDANG_SO']==3) {
|
|
$gudang_so = "[Gudang 3] SERVICE";
|
|
}
|
|
|
|
$dppDo = $sumDo[0]['TOTAL'];
|
|
$ppnDo = round((($datPenjualan[0]['PPN_SO']/100)*$dppDo),2);
|
|
$totDo = round(($dppDo+$ppnDo),2);
|
|
|
|
if (strtotime($datPenjualan[0]['TGL_PENJUALAN'])<strtotime($limit)) {
|
|
$lockUbah = 1;
|
|
} else {
|
|
$lockUbah = 0;
|
|
}
|
|
}
|
|
|
|
|
|
$this->output_json([
|
|
'inv_penjualan' => $datPenjualan[0]['INV_PENJUALAN'],
|
|
'sj_penjualan' => $datPenjualan[0]['SJ_PENJUALAN'],
|
|
'kode_penjualan' => $datPenjualan[0]['KODE_PENJUALAN'],
|
|
'tgl_penjualan' => $datPenjualan[0]['TGL_PENJUALAN'],
|
|
'kode_so' => $datPenjualan[0]['KODE_SO'],
|
|
'nama_corp' => $datPenjualan[0]['NAMA_CORP'],
|
|
'gudang_so' => $gudang_so,
|
|
'id_so' => $datPenjualan[0]['SID'],
|
|
'id_pelanggan' => $datPenjualan[0]['PEL_ID'],
|
|
'nama_pelanggan' => $datPenjualan[0]['NAMA_PELANGGAN'],
|
|
'id_sales' => $datPenjualan[0]['SALES_ID'],
|
|
'ppn_so' => $datPenjualan[0]['PPN_SO'],
|
|
'gp_so' => $datPenjualan[0]['GP_SO'],
|
|
'fee_so' => $datPenjualan[0]['FEE_SO'],
|
|
'po_so' => $datPenjualan[0]['PO_SO'],
|
|
'fp_penjualan' => $datPenjualan[0]['FP_PENJUALAN'],
|
|
'tempo_penjualan' => $datPenjualan[0]['TEMPO_PENJUALAN'],
|
|
'tt_penjualan' => $datPenjualan[0]['TT_PENJUALAN'],
|
|
'ket_so_o' => $datPenjualan[0]['KET_SO_O'],
|
|
'lockUbah' => $lockUbah,
|
|
'datDo' => $datDo,
|
|
'dppDo' => number_format($dppDo,2),
|
|
'ppnDo' => number_format($ppnDo,2),
|
|
'totDo' => number_format($totDo,2),
|
|
]);
|
|
}
|
|
|
|
public function GE_AmbilData_PilihAkuntansi() {
|
|
$id_akuntansi = $this->input->post('id_akuntansi');
|
|
|
|
$datAkuntansi = $this->Amod->getData_Akuntansi_byID($id_akuntansi);
|
|
|
|
$this->output_json([
|
|
'kode_akuntansi' => $datAkuntansi[0]['KODE_AKUNTANSI']
|
|
]);
|
|
}
|
|
|
|
public function GE_AmbilData_PilihPeriodeAkuntansi() {
|
|
$id_pak = $this->input->post('id_pak');
|
|
$verse = $this->input->post('verse');
|
|
|
|
$datPak = $this->Amod->getData_PeriodeAkuntansi_byID($id_pak);
|
|
$start = $datPak[0]['AWAL_PAK'];
|
|
$end = $datPak[0]['AKHIR_PAK'];
|
|
$nama_pak = $datPak[0]['NAMA_PAK'];
|
|
|
|
if ($verse==1) {
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 1);
|
|
$al01 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 2);
|
|
$al02 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 3);
|
|
$al03 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 4);
|
|
$al04 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 5);
|
|
$al05 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 6);
|
|
$al06 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 7);
|
|
$al07 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 8);
|
|
$al08 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 82);
|
|
$al09 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 9);
|
|
$inventaris1 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 10);
|
|
$inventaris2 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 11);
|
|
$gedung1 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 12);
|
|
$gedung2 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 13);
|
|
$kendaraan1 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 14);
|
|
$kendaraan2 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$at01 = $inventaris1-$inventaris2;
|
|
$at02 = $gedung1-$gedung2;
|
|
$at03 = $kendaraan1-$kendaraan2;
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 15);
|
|
$kl01 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 16);
|
|
$kl02 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 17);
|
|
$kl03 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 18);
|
|
$kl04 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 19);
|
|
$kl05 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 83);
|
|
$kl06 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 20);
|
|
$mo01 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 21);
|
|
$mo02 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 22);
|
|
$mo03 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 23);
|
|
$tp01 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 24);
|
|
$tp02 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 25);
|
|
$tp03 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 26);
|
|
$hpp01 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 27);
|
|
$hpp02 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 28);
|
|
$hpp03 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 29);
|
|
$hpp04 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 30);
|
|
$hpp05 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 31);
|
|
$bp01 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 32);
|
|
$bp02 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 33);
|
|
$bp03 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 34);
|
|
$bp04 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 35);
|
|
$bp05 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 36);
|
|
$bp06 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 37);
|
|
$bp07 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 81);
|
|
$bp08 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 38);
|
|
$bua01 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 39);
|
|
$bua02 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 40);
|
|
$bua03 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 41);
|
|
$bua04 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 42);
|
|
$bua05 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 43);
|
|
$bua06 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 44);
|
|
$bua07 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 45);
|
|
$bua08 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 46);
|
|
$bua09 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 80);
|
|
$bua10 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 47);
|
|
$bua11 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 48);
|
|
$bua12 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 49);
|
|
$bua13 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 50);
|
|
$bua14 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 51);
|
|
$bua15 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 52);
|
|
$bua16 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 53);
|
|
$bua17 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 54);
|
|
$bua18 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 55);
|
|
$bua19 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 56);
|
|
$bua20 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 57);
|
|
$bua21 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 58);
|
|
$bua22 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 59);
|
|
$bua23 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 60);
|
|
$bua24 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 61);
|
|
$bua25 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 62);
|
|
$bua26 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 63);
|
|
$bua27 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 64);
|
|
$bua28 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 65);
|
|
$bua29 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 66);
|
|
$bua30 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 67);
|
|
$bua31 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 68);
|
|
$bua32 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 69);
|
|
$bua33 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 70);
|
|
$bua34 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 71);
|
|
$bua35 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 72);
|
|
$bua36 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 73);
|
|
$bua37 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 86);
|
|
$bua38 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 74);
|
|
$bua39 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 75);
|
|
$plu01 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 76);
|
|
$plu02 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 77);
|
|
$plu03 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 78);
|
|
$plu04 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 87);
|
|
$plu05 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 79);
|
|
$pph01 = $datHne[0]['NILAI_HNE'];
|
|
} else if ($verse==2) {
|
|
//$sumKuantiti = $this->Amod->getSum_Kuantiti_moreThan0();
|
|
//$totalPersediaan = $sumKuantiti[0]['TOTAL'];
|
|
|
|
$datHqPersediaan = $this->Amod->getSum_HistoriKuantiti_groupBARANG_beforeTGL_morethan0($end);
|
|
$no = 0;
|
|
$totalPersediaan = 0;
|
|
foreach ($datHqPersediaan as $key) {
|
|
$cekHq = $this->Amod->getData_HistoriKuantiti_byBARANG_beforeTGL_orderDESC_limit1($key['BARANG_ID'], $end);
|
|
$totalPersediaan = $totalPersediaan+round($cekHq[0]['PERSEDIAAN_HQ'],2);
|
|
}
|
|
|
|
$datDak01 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(1, NULL, $end);
|
|
$datDak02 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(2, NULL, $end);
|
|
$datDak03 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(3, NULL, $end);
|
|
$datDak05 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(5, NULL, $end);
|
|
$datDak06 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(6, NULL, $end);
|
|
$datDak07 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(7, NULL, $end);
|
|
$datDak08 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(8, NULL, $end);
|
|
$datDak09 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(9, NULL, $end);
|
|
$datDak10 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(10, NULL, $end);
|
|
$datDak11 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(11, NULL, $end);
|
|
$datDak12 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(12, NULL, $end);
|
|
$datDak13 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(13, NULL, $end);
|
|
$datDak14 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(14, NULL, $end);
|
|
$datDak15 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(15, NULL, $end);
|
|
$datDak16 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(16, NULL, $end);
|
|
$datDak17 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(17, NULL, $end);
|
|
$datDak18 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(18, NULL, $end);
|
|
$datDak19 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(19, NULL, $end);
|
|
$datDak20 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(20, NULL, $end);
|
|
$datDak21 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(21, NULL, $end);
|
|
$datDak23 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(23, $start, $end);
|
|
$datDak24 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(24, $start, $end);
|
|
$datDak25 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(25, $start, $end);
|
|
$datDak26 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(26, NULL, $end);
|
|
$datDak27 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(27, $start, $end);
|
|
$datDak28 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(28, $start, $end);
|
|
$datDak29 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(29, $start, $end);
|
|
$datDak31 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(31, $start, $end);
|
|
$datDak32 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(32, $start, $end);
|
|
$datDak33 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(33, $start, $end);
|
|
$datDak34 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(34, $start, $end);
|
|
$datDak35 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(35, $start, $end);
|
|
$datDak36 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(36, $start, $end);
|
|
$datDak37 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(37, $start, $end);
|
|
$datDak38 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(38, $start, $end);
|
|
$datDak39 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(39, $start, $end);
|
|
$datDak40 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(40, $start, $end);
|
|
$datDak41 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(41, $start, $end);
|
|
$datDak42 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(42, $start, $end);
|
|
$datDak43 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(43, $start, $end);
|
|
$datDak44 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(44, $start, $end);
|
|
$datDak45 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(45, $start, $end);
|
|
$datDak46 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(46, $start, $end);
|
|
$datDak47 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(47, $start, $end);
|
|
$datDak48 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(48, $start, $end);
|
|
$datDak49 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(49, $start, $end);
|
|
$datDak50 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(50, $start, $end);
|
|
$datDak51 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(51, $start, $end);
|
|
$datDak52 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(52, $start, $end);
|
|
$datDak53 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(53, $start, $end);
|
|
$datDak54 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(54, $start, $end);
|
|
$datDak55 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(55, $start, $end);
|
|
$datDak56 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(56, $start, $end);
|
|
$datDak57 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(57, $start, $end);
|
|
$datDak58 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(58, $start, $end);
|
|
$datDak59 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(59, $start, $end);
|
|
$datDak60 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(60, $start, $end);
|
|
$datDak61 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(61, $start, $end);
|
|
$datDak62 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(62, $start, $end);
|
|
$datDak63 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(63, $start, $end);
|
|
$datDak64 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(64, $start, $end);
|
|
$datDak65 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(65, $start, $end);
|
|
$datDak66 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(66, $start, $end);
|
|
$datDak67 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(67, $start, $end);
|
|
$datDak68 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(68, $start, $end);
|
|
$datDak69 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(69, $start, $end);
|
|
$datDak70 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(70, $start, $end);
|
|
$datDak71 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(71, $start, $end);
|
|
$datDak72 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(72, $start, $end);
|
|
$datDak73 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(73, $start, $end);
|
|
$datDak74 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(74, $start, $end);
|
|
$datDak75 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(75, $start, $end);
|
|
$datDak76 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(76, $start, $end);
|
|
$datDak77 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(77, $start, $end);
|
|
$datDak78 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(78, $start, $end);
|
|
$datDak79 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(79, $start, $end);
|
|
$datDak80 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(80, $start, $end);
|
|
$datDak81 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(81, $start, $end);
|
|
$datDak82 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(82, NULL, $end);
|
|
$datDak83 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(83, NULL, $end);
|
|
$datDak86 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(86, $start, $end);
|
|
$datDak87 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(87, $start, $end);
|
|
|
|
if ($datDak01[0]['DEBET']==NULL OR $datDak01[0]['KREDIT']==NULL) { $al01 = 0; } else { $al01 = $datDak01[0]['DEBET']-$datDak01[0]['KREDIT']; }
|
|
if ($datDak02[0]['DEBET']==NULL OR $datDak02[0]['KREDIT']==NULL) { $al02 = 0; } else { $al02 = $datDak02[0]['DEBET']-$datDak02[0]['KREDIT']; }
|
|
if ($datDak03[0]['DEBET']==NULL OR $datDak03[0]['KREDIT']==NULL) { $al03 = 0; } else { $al03 = $datDak03[0]['DEBET']-$datDak03[0]['KREDIT']; }
|
|
if ($datDak05[0]['DEBET']==NULL OR $datDak05[0]['KREDIT']==NULL) { $al05 = 0; } else { $al05 = $datDak05[0]['DEBET']-$datDak05[0]['KREDIT']; }
|
|
if ($datDak06[0]['DEBET']==NULL OR $datDak06[0]['KREDIT']==NULL) { $al06 = 0; } else { $al06 = $datDak06[0]['DEBET']-$datDak06[0]['KREDIT']; }
|
|
if ($datDak07[0]['DEBET']==NULL OR $datDak07[0]['KREDIT']==NULL) { $al07 = 0; } else { $al07 = $datDak07[0]['DEBET']-$datDak07[0]['KREDIT']; }
|
|
if ($datDak08[0]['DEBET']==NULL OR $datDak08[0]['KREDIT']==NULL) { $al08 = 0; } else { $al08 = $datDak08[0]['DEBET']-$datDak08[0]['KREDIT']; }
|
|
if ($datDak82[0]['DEBET']==NULL OR $datDak82[0]['KREDIT']==NULL) { $al09 = 0; } else { $al09 = $datDak82[0]['DEBET']-$datDak82[0]['KREDIT']; }
|
|
if ($datDak15[0]['DEBET']==NULL OR $datDak15[0]['KREDIT']==NULL) { $kl01 = 0; } else { $kl01 = $datDak15[0]['KREDIT']-$datDak15[0]['DEBET']; }
|
|
if ($datDak16[0]['DEBET']==NULL OR $datDak16[0]['KREDIT']==NULL) { $kl02 = 0; } else { $kl02 = $datDak16[0]['KREDIT']-$datDak16[0]['DEBET']; }
|
|
if ($datDak17[0]['DEBET']==NULL OR $datDak17[0]['KREDIT']==NULL) { $kl03 = 0; } else { $kl03 = $datDak17[0]['KREDIT']-$datDak17[0]['DEBET']; }
|
|
if ($datDak18[0]['DEBET']==NULL OR $datDak18[0]['KREDIT']==NULL) { $kl04 = 0; } else { $kl04 = $datDak18[0]['KREDIT']-$datDak18[0]['DEBET']; }
|
|
if ($datDak19[0]['DEBET']==NULL OR $datDak19[0]['KREDIT']==NULL) { $kl05 = 0; } else { $kl05 = $datDak19[0]['KREDIT']-$datDak19[0]['DEBET']; }
|
|
if ($datDak83[0]['DEBET']==NULL OR $datDak83[0]['KREDIT']==NULL) { $kl06 = 0; } else { $kl06 = $datDak83[0]['KREDIT']-$datDak83[0]['DEBET']; }
|
|
if ($datDak09[0]['DEBET']==NULL OR $datDak09[0]['KREDIT']==NULL) { $inventaris1 = 0; } else { $inventaris1 = ($datDak09[0]['DEBET']-$datDak09[0]['KREDIT']); }
|
|
if ($datDak10[0]['DEBET']==NULL OR $datDak10[0]['KREDIT']==NULL) { $inventaris2 = 0; } else { $inventaris2 = ($datDak10[0]['KREDIT']-$datDak10[0]['DEBET']); }
|
|
if ($datDak11[0]['DEBET']==NULL OR $datDak11[0]['KREDIT']==NULL) { $gedung1 = 0; } else { $gedung1 = ($datDak11[0]['DEBET']-$datDak11[0]['KREDIT']); }
|
|
if ($datDak12[0]['DEBET']==NULL OR $datDak12[0]['KREDIT']==NULL) { $gedung2 = 0; } else { $gedung2 = ($datDak12[0]['KREDIT']-$datDak12[0]['DEBET']); }
|
|
if ($datDak13[0]['DEBET']==NULL OR $datDak13[0]['KREDIT']==NULL) { $kendaraan1 = 0; } else { $kendaraan1 = ($datDak13[0]['DEBET']-$datDak13[0]['KREDIT']); }
|
|
if ($datDak14[0]['DEBET']==NULL OR $datDak14[0]['KREDIT']==NULL) { $kendaraan2 = 0; } else { $kendaraan2 = ($datDak14[0]['KREDIT']-$datDak14[0]['DEBET']); }
|
|
if ($datDak20[0]['DEBET']==NULL OR $datDak20[0]['KREDIT']==NULL) { $mo01 = 0; } else { $mo01 = $datDak20[0]['KREDIT']-$datDak20[0]['DEBET']; }
|
|
if ($datDak21[0]['DEBET']==NULL OR $datDak21[0]['KREDIT']==NULL) { $mo02 = 0; } else { $mo02 = $datDak21[0]['KREDIT']-$datDak21[0]['DEBET']; }
|
|
if ($datDak23[0]['DEBET']==NULL OR $datDak23[0]['KREDIT']==NULL) { $tp01 = 0; } else { $tp01 = $datDak23[0]['KREDIT']-$datDak23[0]['DEBET']; }
|
|
if ($datDak24[0]['DEBET']==NULL OR $datDak24[0]['KREDIT']==NULL) { $tp02 = 0; } else { $tp02 = $datDak24[0]['DEBET']-$datDak24[0]['KREDIT']; }
|
|
if ($datDak25[0]['DEBET']==NULL OR $datDak25[0]['KREDIT']==NULL) { $tp03 = 0; } else { $tp03 = $datDak25[0]['DEBET']-$datDak25[0]['KREDIT']; }
|
|
if ($datDak26[0]['DEBET']==NULL OR $datDak26[0]['KREDIT']==NULL) { $hpp01 = 0; } else { $hpp01 = $datDak26[0]['DEBET']-$datDak26[0]['KREDIT']; }
|
|
if ($datDak27[0]['DEBET']==NULL OR $datDak27[0]['KREDIT']==NULL) { $hpp02 = 0; } else { $hpp02 = $datDak27[0]['DEBET']-$datDak27[0]['KREDIT']; }
|
|
if ($datDak28[0]['DEBET']==NULL OR $datDak28[0]['KREDIT']==NULL) { $hpp03 = 0; } else { $hpp03 = $datDak28[0]['KREDIT']-$datDak28[0]['DEBET']; }
|
|
if ($datDak29[0]['DEBET']==NULL OR $datDak29[0]['KREDIT']==NULL) { $hpp04 = 0; } else { $hpp04 = $datDak29[0]['KREDIT']-$datDak29[0]['DEBET']; }
|
|
if ($datDak31[0]['DEBET']==NULL OR $datDak31[0]['KREDIT']==NULL) { $bp01 = 0; } else { $bp01 = $datDak31[0]['DEBET']-$datDak31[0]['KREDIT']; }
|
|
if ($datDak32[0]['DEBET']==NULL OR $datDak32[0]['KREDIT']==NULL) { $bp02 = 0; } else { $bp02 = $datDak32[0]['DEBET']-$datDak32[0]['KREDIT']; }
|
|
if ($datDak33[0]['DEBET']==NULL OR $datDak33[0]['KREDIT']==NULL) { $bp03 = 0; } else { $bp03 = $datDak33[0]['DEBET']-$datDak33[0]['KREDIT']; }
|
|
if ($datDak34[0]['DEBET']==NULL OR $datDak34[0]['KREDIT']==NULL) { $bp04 = 0; } else { $bp04 = $datDak34[0]['DEBET']-$datDak34[0]['KREDIT']; }
|
|
if ($datDak35[0]['DEBET']==NULL OR $datDak35[0]['KREDIT']==NULL) { $bp05 = 0; } else { $bp05 = $datDak35[0]['DEBET']-$datDak35[0]['KREDIT']; }
|
|
if ($datDak36[0]['DEBET']==NULL OR $datDak36[0]['KREDIT']==NULL) { $bp06 = 0; } else { $bp06 = $datDak36[0]['DEBET']-$datDak36[0]['KREDIT']; }
|
|
if ($datDak37[0]['DEBET']==NULL OR $datDak37[0]['KREDIT']==NULL) { $bp07 = 0; } else { $bp07 = $datDak37[0]['DEBET']-$datDak37[0]['KREDIT']; }
|
|
if ($datDak81[0]['DEBET']==NULL OR $datDak81[0]['KREDIT']==NULL) { $bp08 = 0; } else { $bp08 = $datDak81[0]['DEBET']-$datDak81[0]['KREDIT']; }
|
|
if ($datDak38[0]['DEBET']==NULL OR $datDak38[0]['KREDIT']==NULL) { $bua01 = 0; } else { $bua01 = $datDak38[0]['DEBET']-$datDak38[0]['KREDIT']; }
|
|
if ($datDak39[0]['DEBET']==NULL OR $datDak39[0]['KREDIT']==NULL) { $bua02 = 0; } else { $bua02 = $datDak39[0]['DEBET']-$datDak39[0]['KREDIT']; }
|
|
if ($datDak40[0]['DEBET']==NULL OR $datDak40[0]['KREDIT']==NULL) { $bua03 = 0; } else { $bua03 = $datDak40[0]['DEBET']-$datDak40[0]['KREDIT']; }
|
|
if ($datDak41[0]['DEBET']==NULL OR $datDak41[0]['KREDIT']==NULL) { $bua04 = 0; } else { $bua04 = $datDak41[0]['DEBET']-$datDak41[0]['KREDIT']; }
|
|
if ($datDak42[0]['DEBET']==NULL OR $datDak42[0]['KREDIT']==NULL) { $bua05 = 0; } else { $bua05 = $datDak42[0]['DEBET']-$datDak42[0]['KREDIT']; }
|
|
if ($datDak43[0]['DEBET']==NULL OR $datDak43[0]['KREDIT']==NULL) { $bua06 = 0; } else { $bua06 = $datDak43[0]['DEBET']-$datDak43[0]['KREDIT']; }
|
|
if ($datDak44[0]['DEBET']==NULL OR $datDak44[0]['KREDIT']==NULL) { $bua07 = 0; } else { $bua07 = $datDak44[0]['DEBET']-$datDak44[0]['KREDIT']; }
|
|
if ($datDak45[0]['DEBET']==NULL OR $datDak45[0]['KREDIT']==NULL) { $bua08 = 0; } else { $bua08 = $datDak45[0]['DEBET']-$datDak45[0]['KREDIT']; }
|
|
if ($datDak46[0]['DEBET']==NULL OR $datDak46[0]['KREDIT']==NULL) { $bua09 = 0; } else { $bua09 = $datDak46[0]['DEBET']-$datDak46[0]['KREDIT']; }
|
|
if ($datDak80[0]['DEBET']==NULL OR $datDak80[0]['KREDIT']==NULL) { $bua10 = 0; } else { $bua10 = $datDak80[0]['DEBET']-$datDak80[0]['KREDIT']; }
|
|
if ($datDak47[0]['DEBET']==NULL OR $datDak47[0]['KREDIT']==NULL) { $bua11 = 0; } else { $bua11 = $datDak47[0]['DEBET']-$datDak47[0]['KREDIT']; }
|
|
if ($datDak48[0]['DEBET']==NULL OR $datDak48[0]['KREDIT']==NULL) { $bua12 = 0; } else { $bua12 = $datDak48[0]['DEBET']-$datDak48[0]['KREDIT']; }
|
|
if ($datDak49[0]['DEBET']==NULL OR $datDak49[0]['KREDIT']==NULL) { $bua13 = 0; } else { $bua13 = $datDak49[0]['DEBET']-$datDak49[0]['KREDIT']; }
|
|
if ($datDak50[0]['DEBET']==NULL OR $datDak50[0]['KREDIT']==NULL) { $bua14 = 0; } else { $bua14 = $datDak50[0]['DEBET']-$datDak50[0]['KREDIT']; }
|
|
if ($datDak51[0]['DEBET']==NULL OR $datDak51[0]['KREDIT']==NULL) { $bua15 = 0; } else { $bua15 = $datDak51[0]['DEBET']-$datDak51[0]['KREDIT']; }
|
|
if ($datDak52[0]['DEBET']==NULL OR $datDak52[0]['KREDIT']==NULL) { $bua16 = 0; } else { $bua16 = $datDak52[0]['DEBET']-$datDak52[0]['KREDIT']; }
|
|
if ($datDak53[0]['DEBET']==NULL OR $datDak53[0]['KREDIT']==NULL) { $bua17 = 0; } else { $bua17 = $datDak53[0]['DEBET']-$datDak53[0]['KREDIT']; }
|
|
if ($datDak54[0]['DEBET']==NULL OR $datDak54[0]['KREDIT']==NULL) { $bua18 = 0; } else { $bua18 = $datDak54[0]['DEBET']-$datDak54[0]['KREDIT']; }
|
|
if ($datDak55[0]['DEBET']==NULL OR $datDak55[0]['KREDIT']==NULL) { $bua19 = 0; } else { $bua19 = $datDak55[0]['DEBET']-$datDak55[0]['KREDIT']; }
|
|
if ($datDak56[0]['DEBET']==NULL OR $datDak56[0]['KREDIT']==NULL) { $bua20 = 0; } else { $bua20 = $datDak56[0]['DEBET']-$datDak56[0]['KREDIT']; }
|
|
if ($datDak57[0]['DEBET']==NULL OR $datDak57[0]['KREDIT']==NULL) { $bua21 = 0; } else { $bua21 = $datDak57[0]['DEBET']-$datDak57[0]['KREDIT']; }
|
|
if ($datDak58[0]['DEBET']==NULL OR $datDak58[0]['KREDIT']==NULL) { $bua22 = 0; } else { $bua22 = $datDak58[0]['DEBET']-$datDak58[0]['KREDIT']; }
|
|
if ($datDak59[0]['DEBET']==NULL OR $datDak59[0]['KREDIT']==NULL) { $bua23 = 0; } else { $bua23 = $datDak59[0]['DEBET']-$datDak59[0]['KREDIT']; }
|
|
if ($datDak60[0]['DEBET']==NULL OR $datDak60[0]['KREDIT']==NULL) { $bua24 = 0; } else { $bua24 = $datDak60[0]['DEBET']-$datDak60[0]['KREDIT']; }
|
|
if ($datDak61[0]['DEBET']==NULL OR $datDak61[0]['KREDIT']==NULL) { $bua25 = 0; } else { $bua25 = $datDak61[0]['DEBET']-$datDak61[0]['KREDIT']; }
|
|
if ($datDak62[0]['DEBET']==NULL OR $datDak62[0]['KREDIT']==NULL) { $bua26 = 0; } else { $bua26 = $datDak62[0]['DEBET']-$datDak62[0]['KREDIT']; }
|
|
if ($datDak63[0]['DEBET']==NULL OR $datDak63[0]['KREDIT']==NULL) { $bua27 = 0; } else { $bua27 = $datDak63[0]['DEBET']-$datDak63[0]['KREDIT']; }
|
|
if ($datDak64[0]['DEBET']==NULL OR $datDak64[0]['KREDIT']==NULL) { $bua28 = 0; } else { $bua28 = $datDak64[0]['DEBET']-$datDak64[0]['KREDIT']; }
|
|
if ($datDak65[0]['DEBET']==NULL OR $datDak65[0]['KREDIT']==NULL) { $bua29 = 0; } else { $bua29 = $datDak65[0]['DEBET']-$datDak65[0]['KREDIT']; }
|
|
if ($datDak66[0]['DEBET']==NULL OR $datDak66[0]['KREDIT']==NULL) { $bua30 = 0; } else { $bua30 = $datDak66[0]['DEBET']-$datDak66[0]['KREDIT']; }
|
|
if ($datDak67[0]['DEBET']==NULL OR $datDak67[0]['KREDIT']==NULL) { $bua31 = 0; } else { $bua31 = $datDak67[0]['DEBET']-$datDak67[0]['KREDIT']; }
|
|
if ($datDak68[0]['DEBET']==NULL OR $datDak68[0]['KREDIT']==NULL) { $bua32 = 0; } else { $bua32 = $datDak68[0]['DEBET']-$datDak68[0]['KREDIT']; }
|
|
if ($datDak69[0]['DEBET']==NULL OR $datDak69[0]['KREDIT']==NULL) { $bua33 = 0; } else { $bua33 = $datDak69[0]['DEBET']-$datDak69[0]['KREDIT']; }
|
|
if ($datDak70[0]['DEBET']==NULL OR $datDak70[0]['KREDIT']==NULL) { $bua34 = 0; } else { $bua34 = $datDak70[0]['DEBET']-$datDak70[0]['KREDIT']; }
|
|
if ($datDak71[0]['DEBET']==NULL OR $datDak71[0]['KREDIT']==NULL) { $bua35 = 0; } else { $bua35 = $datDak71[0]['DEBET']-$datDak71[0]['KREDIT']; }
|
|
if ($datDak72[0]['DEBET']==NULL OR $datDak72[0]['KREDIT']==NULL) { $bua36 = 0; } else { $bua36 = $datDak72[0]['DEBET']-$datDak72[0]['KREDIT']; }
|
|
if ($datDak73[0]['DEBET']==NULL OR $datDak73[0]['KREDIT']==NULL) { $bua37 = 0; } else { $bua37 = $datDak73[0]['DEBET']-$datDak73[0]['KREDIT']; }
|
|
if ($datDak86[0]['DEBET']==NULL OR $datDak86[0]['KREDIT']==NULL) { $bua38 = 0; } else { $bua38 = $datDak86[0]['DEBET']-$datDak86[0]['KREDIT']; }
|
|
if ($datDak74[0]['DEBET']==NULL OR $datDak74[0]['KREDIT']==NULL) { $bua39 = 0; } else { $bua39 = $datDak74[0]['DEBET']-$datDak74[0]['KREDIT']; }
|
|
if ($datDak75[0]['DEBET']==NULL OR $datDak75[0]['KREDIT']==NULL) { $plu01 = 0; } else { $plu01 = $datDak75[0]['KREDIT']-$datDak75[0]['DEBET']; }
|
|
if ($datDak76[0]['DEBET']==NULL OR $datDak76[0]['KREDIT']==NULL) { $plu02 = 0; } else { $plu02 = $datDak76[0]['KREDIT']-$datDak76[0]['DEBET']; }
|
|
if ($datDak77[0]['DEBET']==NULL OR $datDak77[0]['KREDIT']==NULL) { $plu03 = 0; } else { $plu03 = $datDak77[0]['DEBET']-$datDak77[0]['KREDIT']; }
|
|
if ($datDak78[0]['DEBET']==NULL OR $datDak78[0]['KREDIT']==NULL) { $plu04 = 0; } else { $plu04 = $datDak78[0]['DEBET']-$datDak78[0]['KREDIT']; }
|
|
if ($datDak87[0]['DEBET']==NULL OR $datDak87[0]['KREDIT']==NULL) { $plu05 = 0; } else { $plu05 = $datDak87[0]['DEBET']-$datDak87[0]['KREDIT']; }
|
|
if ($datDak79[0]['DEBET']==NULL OR $datDak79[0]['KREDIT']==NULL) { $pph01 = 0; } else { $pph01 = $datDak79[0]['DEBET']-$datDak79[0]['KREDIT']; }
|
|
|
|
if ($al09==$kl06) {
|
|
$sisaPm = 0;
|
|
$sisaPk = 0;
|
|
} else if ($al09<$kl06) {
|
|
$sisaPm = 0;
|
|
$sisaPk = $kl06-$al09;
|
|
} else if ($kl06<$al09) {
|
|
$sisaPk = 0;
|
|
$sisaPm = $al09-$kl06;
|
|
}
|
|
|
|
$al04 = $totalPersediaan;
|
|
$al09 = $sisaPm;
|
|
$at01 = $inventaris1-$inventaris2;
|
|
$at02 = $gedung1-$gedung2;
|
|
$at03 = $kendaraan1-$kendaraan2;
|
|
$kl06 = $sisaPk;
|
|
$hpp05 = $totalPersediaan;
|
|
}
|
|
|
|
$totalPenjualan = $tp01-$tp02-$tp03;
|
|
$hargaPokokPenjualan1 = $hpp01+$hpp02-$hpp03-$hpp04;
|
|
$hargaPokokPenjualan2 = $hargaPokokPenjualan1-$hpp05;
|
|
$labaKotor = $totalPenjualan-$hargaPokokPenjualan2;
|
|
$biayaPenjualan = $bp01+$bp02+$bp03+$bp04+$bp05+$bp06+$bp07+$bp08;
|
|
$biayaUmumAdministrasi = $bua01+$bua02+$bua03+$bua04+$bua05+$bua06+$bua07+$bua08+$bua09+$bua10+$bua11+$bua12+$bua13+$bua14+$bua15+$bua16
|
|
+$bua17+$bua18+$bua19+$bua20+$bua21+$bua22+$bua23+$bua24+$bua25+$bua26+$bua27+$bua28+$bua29+$bua30+$bua31+$bua32
|
|
+$bua33+$bua34+$bua35+$bua36+$bua37+$bua38+$bua39;
|
|
$totalBiaya = $biayaPenjualan+$biayaUmumAdministrasi;
|
|
$labaUsaha = $labaKotor-$totalBiaya;
|
|
$pendapatanLuarUsaha1 = $plu01+$plu02;
|
|
$pendapatanLuarUsaha2 = $plu03+$plu04+$plu05;
|
|
$pajakPenghasilan = $pph01;
|
|
$totalPendapatanLuarUsaha = $pendapatanLuarUsaha1-$pendapatanLuarUsaha2;
|
|
$labaBersihSebelumPajak = $labaUsaha+$totalPendapatanLuarUsaha;
|
|
$labaBersihSetelahPajak = $labaBersihSebelumPajak-$pajakPenghasilan;
|
|
|
|
if ($verse==2) {
|
|
$mo03 = $labaBersihSetelahPajak;
|
|
}
|
|
|
|
$aktivaLancar = $al01+$al02+$al03+$al04+$al05+$al06+$al07+$al08+$al09;
|
|
$kewajibanLancar = $kl01+$kl02+$kl03+$kl04+$kl05+$kl06;
|
|
$aktivaTetap = $at01+$at02+$at03;
|
|
$modalNeraca = $mo01+$mo02+$mo03;
|
|
$totalAktiva = $aktivaLancar+$aktivaTetap;
|
|
$totalPasiva = $kewajibanLancar+$modalNeraca;
|
|
|
|
$this->output_json([
|
|
'al01' => number_format($al01,2),
|
|
'al02' => number_format($al02,2),
|
|
'al03' => number_format($al03,2),
|
|
'al04' => number_format($al04,2),
|
|
'al05' => number_format($al05,2),
|
|
'al06' => number_format($al06,2),
|
|
'al07' => number_format($al07,2),
|
|
'al08' => number_format($al08,2),
|
|
'al09' => number_format($al09,2),
|
|
'kl01' => number_format($kl01,2),
|
|
'kl02' => number_format($kl02,2),
|
|
'kl03' => number_format($kl03,2),
|
|
'kl04' => number_format($kl04,2),
|
|
'kl05' => number_format($kl05,2),
|
|
'kl06' => number_format($kl06,2),
|
|
'at01' => number_format($at01,2),
|
|
'at02' => number_format($at02,2),
|
|
'at03' => number_format($at03,2),
|
|
'mo01' => number_format($mo01,2),
|
|
'mo02' => number_format($mo02,2),
|
|
'mo03' => number_format($mo03,2),
|
|
'tp01' => number_format($tp01,2),
|
|
'tp02' => number_format($tp02,2),
|
|
'tp03' => number_format($tp03,2),
|
|
'hpp01' => number_format($hpp01,2),
|
|
'hpp02' => number_format($hpp02,2),
|
|
'hpp03' => number_format($hpp03,2),
|
|
'hpp04' => number_format($hpp04,2),
|
|
'hpp05' => number_format($hpp05,2),
|
|
'bp01' => number_format($bp01,2),
|
|
'bp02' => number_format($bp02,2),
|
|
'bp03' => number_format($bp03,2),
|
|
'bp04' => number_format($bp04,2),
|
|
'bp05' => number_format($bp05,2),
|
|
'bp06' => number_format($bp06,2),
|
|
'bp07' => number_format($bp07,2),
|
|
'bp08' => number_format($bp08,2),
|
|
'bua01' => number_format($bua01,2),
|
|
'bua02' => number_format($bua02,2),
|
|
'bua03' => number_format($bua03,2),
|
|
'bua04' => number_format($bua04,2),
|
|
'bua05' => number_format($bua05,2),
|
|
'bua06' => number_format($bua06,2),
|
|
'bua07' => number_format($bua07,2),
|
|
'bua08' => number_format($bua08,2),
|
|
'bua09' => number_format($bua09,2),
|
|
'bua10' => number_format($bua10,2),
|
|
'bua11' => number_format($bua11,2),
|
|
'bua12' => number_format($bua12,2),
|
|
'bua13' => number_format($bua13,2),
|
|
'bua14' => number_format($bua14,2),
|
|
'bua15' => number_format($bua15,2),
|
|
'bua16' => number_format($bua16,2),
|
|
'bua17' => number_format($bua17,2),
|
|
'bua18' => number_format($bua18,2),
|
|
'bua19' => number_format($bua19,2),
|
|
'bua20' => number_format($bua20,2),
|
|
'bua21' => number_format($bua21,2),
|
|
'bua22' => number_format($bua22,2),
|
|
'bua23' => number_format($bua23,2),
|
|
'bua24' => number_format($bua24,2),
|
|
'bua25' => number_format($bua25,2),
|
|
'bua26' => number_format($bua26,2),
|
|
'bua27' => number_format($bua27,2),
|
|
'bua28' => number_format($bua28,2),
|
|
'bua29' => number_format($bua29,2),
|
|
'bua30' => number_format($bua30,2),
|
|
'bua31' => number_format($bua31,2),
|
|
'bua32' => number_format($bua32,2),
|
|
'bua33' => number_format($bua33,2),
|
|
'bua34' => number_format($bua34,2),
|
|
'bua35' => number_format($bua35,2),
|
|
'bua36' => number_format($bua36,2),
|
|
'bua37' => number_format($bua37,2),
|
|
'bua38' => number_format($bua38,2),
|
|
'bua39' => number_format($bua39,2),
|
|
'plu01' => number_format($plu01,2),
|
|
'plu02' => number_format($plu02,2),
|
|
'plu03' => number_format($plu03,2),
|
|
'plu04' => number_format($plu04,2),
|
|
'plu05' => number_format($plu05,2),
|
|
'pph01' => number_format($pph01,2),
|
|
'aktivaLancar' => number_format($aktivaLancar,2),
|
|
'kewajibanLancar' => number_format($kewajibanLancar,2),
|
|
'aktivaTetap' => number_format($aktivaTetap,2),
|
|
'modalNeraca' => number_format($modalNeraca,2),
|
|
'totalAktiva' => number_format($totalAktiva,2),
|
|
'totalPasiva' => number_format($totalPasiva,2),
|
|
'totalPenjualan' => number_format($totalPenjualan,2),
|
|
'hargaPokokPenjualan1' => number_format($hargaPokokPenjualan1,2),
|
|
'hargaPokokPenjualan2' => number_format($hargaPokokPenjualan2,2),
|
|
'labaKotor' => number_format($labaKotor,2),
|
|
'biayaPenjualan' => number_format($biayaPenjualan,2),
|
|
'biayaUmumAdministrasi' => number_format($biayaUmumAdministrasi,2),
|
|
'totalBiaya' => number_format($totalBiaya,2),
|
|
'labaUsaha' => number_format($labaUsaha,2),
|
|
'pendapatanLuarUsaha1' => number_format($pendapatanLuarUsaha1,2),
|
|
'pendapatanLuarUsaha2' => number_format($pendapatanLuarUsaha2,2),
|
|
'pajakPenghasilan' => number_format($pajakPenghasilan,2),
|
|
'totalPendapatanLuarUsaha' => number_format($totalPendapatanLuarUsaha,2),
|
|
'labaBersihSebelumPajak' => number_format($labaBersihSebelumPajak,2),
|
|
'labaBersihSetelahPajak' => number_format($labaBersihSetelahPajak,2),
|
|
'nama_pak' => $nama_pak
|
|
]);
|
|
}
|
|
|
|
public function GE_AmbilData_PilihSnKlaimProgram() {
|
|
$id_snkpr = $this->input->post('id_snkpr');
|
|
|
|
$datSnkpr = $this->Amod->getData_SnKlaimProgram_byID($id_snkpr);
|
|
|
|
$this->output_json([
|
|
'nama_snkpr' => $datSnkpr[0]['NAMA_SNKPR'],
|
|
]);
|
|
}
|
|
|
|
public function GE_AmbilData_PilihFfp() {
|
|
$id_ffp = $this->input->post('id_ffp');
|
|
|
|
$datFfp = $this->Amod->getData_FormFeePelanggan_byID_allStatus($id_ffp);
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byPENJUALAN_byPERKIRAAN_orderDESC_limit1($datFfp[0]['PENJUALAN_ID'], 64);
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byPENJUALAN_byPERKIRAAN($datFfp[0]['PENJUALAN_ID'], 64);
|
|
if ($sumDak==FALSE OR $sumDak[0]['DEBET']==NULL OR $sumDak[0]['KREDIT']==NULL) {
|
|
$terbayar = 0;
|
|
} else {
|
|
$terbayar = $sumDak[0]['DEBET']-$sumDak[0]['KREDIT'];
|
|
}
|
|
|
|
if ($datFfp[0]['NILAI_FFP']<=$terbayar) {
|
|
$status = "FEE TERBAYAR LUNAS";
|
|
} else if ($datFfp[0]['NILAI_FFP']>$terbayar AND $terbayar>0) {
|
|
$status = "FEE TERBAYAR SEBAGIAN";
|
|
} else {
|
|
if ($datFfp[0]['STATUS_FFP']==2) {
|
|
$status = "FEE BATAL";
|
|
} else {
|
|
$status = "FEE BELUM TERBAYAR";
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'kode_ffp' => $datFfp[0]['KODE_FFP'],
|
|
'tgl_ffp' => $datFfp[0]['TGL_FFP'],
|
|
'ket_ffp' => $datFfp[0]['KET_FFP'],
|
|
'nakar' => $datFfp[0]['NAMA_PANGGILAN_KARYAWAN'],
|
|
'nilai' => $datFfp[0]['NILAI'],
|
|
'jenis' => $datFfp[0]['NAMA_JFP'],
|
|
'status' => $status,
|
|
]);
|
|
}
|
|
|
|
public function GE_AmbilData_PilihFk() {
|
|
$id_fk = $this->input->post('id_fk');
|
|
|
|
$datFk = $this->Amod->getData_FormKaryawan_byID($id_fk);
|
|
if ($datFk[0]['STATUS_FK']==0) {
|
|
$status = "PROSES";
|
|
$cipta_dak = "";
|
|
} else if ($datFk[0]['STATUS_FK']==1) {
|
|
$status = "TERBAYAR";
|
|
$cipta_dak = $datFk[0]['CIPTA_DAK'];
|
|
} else if ($datFk[0]['STATUS_FK']==2) {
|
|
$status = "BATAL";
|
|
$cipta_dak = "";
|
|
}
|
|
|
|
$this->output_json([
|
|
'kode_fk' => $datFk[0]['KODE_FK'],
|
|
'tgl_fk' => $datFk[0]['TGL_FK'],
|
|
'nakar' => $datFk[0]['NAKAR'],
|
|
'nasal' => $datFk[0]['NASAL'],
|
|
'nilai' => $datFk[0]['NILAI'],
|
|
'jenis' => $datFk[0]['NAMA_JFK'],
|
|
'status' => $status,
|
|
'cipta_dak' => $cipta_dak,
|
|
]);
|
|
}
|
|
|
|
public function GE_AmbilData_PilihRj() {
|
|
$id_rj = $this->input->post('id_rj');
|
|
|
|
$datRj = $this->Amod->getData_ReturPenjualan_byID($id_rj);
|
|
|
|
$this->output_json([
|
|
'kode_rj' => $datRj[0]['KODE_RJ']
|
|
]);
|
|
}
|
|
|
|
public function GE_AmbilData_PilihSupplier() {
|
|
$id_supplier = $this->input->post('id_supplier');
|
|
|
|
$data = $this->Amod->getData_Supplier_byID_bySTATUS($id_supplier, 1);
|
|
|
|
$this->output_json([
|
|
'nama_supplier' => $data[0]['NAMA_SUPPLIER']
|
|
]);
|
|
}
|
|
|
|
public function GE_AmbilData_PilihService() {
|
|
$id_service = $this->input->post('id_service');
|
|
|
|
$datService = $this->Amod->getData_Service_byID($id_service);
|
|
|
|
$this->output_json([
|
|
'kode_service' => $datService[0]['KODE_SERVICE']
|
|
]);
|
|
}
|
|
|
|
public function GE_AmbilData_PilihKelompok() {
|
|
$id_kelompok = $this->input->post('id_kelompok');
|
|
|
|
$data = $this->Amod->getData_Kelompok_byID_bySTATUS($id_kelompok, 1);
|
|
|
|
$this->output_json([
|
|
'nama_kelompok' => $data[0]['NAMA_KELOMPOK']
|
|
]);
|
|
}
|
|
|
|
public function GE_AmbilData_PilihKota() {
|
|
$id_kota = $this->input->post('id_kota');
|
|
|
|
$data = $this->Amod->getData_Kota_byID_bySTATUS($id_kota, 1);
|
|
|
|
$this->output_json([
|
|
'nama_kota' => $data[0]['NAMA_KOTA']
|
|
]);
|
|
}
|
|
|
|
public function GE_AmbilData_PilihJabatan() {
|
|
$id_jabatan = $this->input->post('id_jabatan');
|
|
|
|
$data = $this->Amod->getData_Jabatan_byID_bySTATUS($id_jabatan, 1);
|
|
|
|
$this->output_json([
|
|
'nama_jabatan' => $data[0]['NAMA_JABATAN']
|
|
]);
|
|
}
|
|
|
|
public function GE_AmbilData_PilihJenis() {
|
|
$id_jenis = $this->input->post('id_jenis');
|
|
|
|
$data = $this->Amod->getData_Jenis_byID_bySTATUS($id_jenis, 1);
|
|
|
|
$this->output_json([
|
|
'nama_jenis' => $data[0]['NAMA_JENIS']
|
|
]);
|
|
}
|
|
|
|
public function GE_AmbilData_PilihUnitService() {
|
|
$id_unitservice = $this->input->post('id_unitservice');
|
|
|
|
$data = $this->Amod->getData_UnitService_byID_bySTATUS($id_unitservice, 1);
|
|
|
|
$this->output_json([
|
|
'nama_unitservice' => $data[0]['NAMA_UNITSERVICE']
|
|
]);
|
|
}
|
|
|
|
public function GE_AmbilData_PilihSnService() {
|
|
$id_sns = $this->input->post('id_sns');
|
|
|
|
$datSns = $this->Amod->getData_SnService_byID($id_sns);
|
|
|
|
$data = $this->Amod->getData_SnService_byNAMA_orderDESC($datSns[0]['NAMA_SNS']);
|
|
$no = 0;
|
|
foreach ($data as $key) {
|
|
$datHsv = $this->Amod->getData_HistoriService_bySNS_orderDESC_limit1($key['ID_SNS']);
|
|
if ($datHsv==FALSE) {
|
|
$info = "Unit Diterima";
|
|
$ket = "-";
|
|
} else {
|
|
if ($datHsv[0]['STATUS_HSV']==1) {
|
|
$info = "Selesai Service";
|
|
} else if ($datHsv[0]['STATUS_HSV']==2) {
|
|
$info = "Proses Cek Unit";
|
|
} else if ($datHsv[0]['STATUS_HSV']==3) {
|
|
$info = "Klaim Garansi";
|
|
} else if ($datHsv[0]['STATUS_HSV']==4) {
|
|
$info = "Order Sparepart";
|
|
} else if ($datHsv[0]['STATUS_HSV']==5) {
|
|
$info = "Penawaran";
|
|
} else if ($datHsv[0]['STATUS_HSV']==6) {
|
|
$info = "Extend Warranty";
|
|
} else if ($datHsv[0]['STATUS_HSV']==7) {
|
|
$info = "Gagal Service";
|
|
} else if ($datHsv[0]['STATUS_HSV']==8) {
|
|
$info = "Dibatalkan User";
|
|
}
|
|
$ket = $datHsv[0]['KET_HSV'];
|
|
}
|
|
|
|
if ($key['GARANSI_SNS']==1) {
|
|
$status = "Garansi Barang";
|
|
} else if ($key['GARANSI_SNS']==2) {
|
|
$status = "Garansi Service";
|
|
} else if ($key['GARANSI_SNS']==3) {
|
|
$status = "Tidak Garansi";
|
|
}
|
|
|
|
$data[$no] += ['KET' => $ket];
|
|
$data[$no] += ['INFO' => $info];
|
|
$data[$no++] += ['STATUS' => $status];
|
|
}
|
|
|
|
$this->output_json([
|
|
'nama_sns' => $datSns[0]['NAMA_SNS'],
|
|
'data' => $data
|
|
]);
|
|
}
|
|
|
|
public function GE_AmbilData_DuplikasiNomor() {
|
|
$verse = $this->input->post('verse');
|
|
$id_pembelian = $this->input->post('id_pembelian');
|
|
$id_proyek = $this->input->post('id_proyek');
|
|
$sj_pembelian = $this->input->post('sj_pembelian');
|
|
$inv_pembelian = $this->input->post('inv_pembelian');
|
|
$po_proyek = $this->input->post('po_proyek');
|
|
$sj_pembelian = strtoupper($sj_pembelian);
|
|
$inv_pembelian = strtoupper($inv_pembelian);
|
|
$po_proyek = strtoupper($po_proyek);
|
|
|
|
//Koreksi SJ Pembelian
|
|
if ($verse==1) {
|
|
if ($id_pembelian==0) {
|
|
$id_pembelian = NULL;
|
|
}
|
|
|
|
$cekDuplikasi = $this->Amod->getData_Pembelian_bySJ($sj_pembelian, $id_pembelian);
|
|
if ($cekDuplikasi==TRUE) {
|
|
$value = 1;
|
|
} else {
|
|
$value = 0;
|
|
}
|
|
//Koreksi INV Pembelian
|
|
} else if ($verse==2) {
|
|
if ($id_pembelian==0) {
|
|
$id_pembelian = NULL;
|
|
}
|
|
|
|
$cekDuplikasi = $this->Amod->getData_Pembelian_byINV($inv_pembelian, $id_pembelian);
|
|
if ($cekDuplikasi==TRUE) {
|
|
$value = 1;
|
|
} else {
|
|
$value = 0;
|
|
}
|
|
//Koreksi PO Proyek
|
|
} else if ($verse==3) {
|
|
if ($id_proyek==0) {
|
|
$id_proyek = NULL;
|
|
}
|
|
|
|
$cekDuplikasi = $this->Amod->getData_Proyek_byPO($po_proyek, $id_proyek);
|
|
if ($cekDuplikasi==TRUE) {
|
|
$value = 1;
|
|
} else {
|
|
$value = 0;
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
}
|
|
|
|
public function GE_AmbilData_CekTanggal() {
|
|
$tgl_input = $this->input->post('tgl_input');
|
|
$id_pembelian = $this->input->post('id_pembelian');
|
|
$tgl_sjbeli = $this->input->post('tgl_sjbeli');
|
|
$tgl_invbeli = $this->input->post('tgl_invbeli');
|
|
$tertentu = $this->input->post('tertentu');
|
|
$now = date('Y-m-d');
|
|
$limit = date('Y-m-01');
|
|
|
|
if ($tgl_input==NULL) {
|
|
$datPembelian = $this->Amod->getData_Pembelian_byID($id_pembelian);
|
|
$limit = date_format(date_create($datPembelian[0]['TGL_PEMBELIAN']), "Y-m-01");
|
|
$now = $this->Amod->generate_addMonth($limit, 1);
|
|
$now = $this->Amod->generate_subDay($now, 1);
|
|
$value = 0;
|
|
if (strtotime($tgl_sjbeli)>strtotime($now) OR strtotime($tgl_invbeli)>strtotime($now)) {
|
|
$value = 1;
|
|
} else {
|
|
if (strtotime($tgl_sjbeli)<strtotime($limit) OR strtotime($tgl_invbeli)<strtotime($limit)) {
|
|
$value = 2;
|
|
}
|
|
}
|
|
} else {
|
|
$value = 0;
|
|
//Cek apakah melebihi hari ini
|
|
if (strtotime($tgl_input)>strtotime($now)) {
|
|
$value = 1;
|
|
} else {
|
|
if (strtotime($tgl_input)<strtotime($limit)) {
|
|
$value = 2;
|
|
}
|
|
if ($tertentu!="") {
|
|
if (strtotime($tgl_input)<strtotime($tertentu)) {
|
|
$value = 3;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
}
|
|
|
|
public function GE_AmbilData_DataCetakDokumen() {
|
|
$id_penjualan = $this->input->post('id_penjualan');
|
|
$verse = $this->input->post('verse');
|
|
|
|
if ($verse==1) { // Ambil Cetak Dokumen dari Penjualan (SJ/INV)
|
|
$data = $this->Amod->getData_CetakDokumen_byPENJUALAN($id_penjualan);
|
|
$no = 0;
|
|
foreach ($data as $key) {
|
|
$countHcd = $this->Amod->getCount_HistoriCetakDokumen_byCD($key['ID_CD']);
|
|
if ($countHcd==0) {
|
|
$last = "<b style='color:DarkSlateGray'>*Belum Tercetak*</b>";
|
|
} else {
|
|
$datHcd = $this->Amod->getData_HistoriCetakDokumen_byCD_orderDESC_limit1($key['ID_CD']);
|
|
$lastCetak = $datHcd[0]['CETAK_HCD'];
|
|
$last = "<b style='color:Tomato'>$lastCetak</b>";
|
|
}
|
|
$data[$no++] += ['LAST' => $last];
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'total' => sizeof($data),
|
|
'data' => $data,
|
|
]);
|
|
}
|
|
|
|
public function GE_AmbilData_DataDakPelunasanPiutang() {
|
|
$id_so = $this->input->post('id_so');
|
|
|
|
$datPenjualan = $this->Amod->getData_Penjualan_bySO($id_so);
|
|
$kop = $this->Amod->generate_inisialCorp($datPenjualan[0]['KOP_ID']);
|
|
|
|
$no = 0;
|
|
$data = $this->Amod->getData_DaftarAkuntansi_byPERKIRAAN_byPENJUALAN(3, $datPenjualan[0]['ID_PENJUALAN']);
|
|
foreach ($data as $key) {
|
|
if (strpos($key['KODE_AKUNTANSI'],"RJ")!==FALSE) {
|
|
$no++;
|
|
}
|
|
}
|
|
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byPENJUALAN_byPERKIRAAN($datPenjualan[0]['ID_PENJUALAN'], 3);
|
|
if ($sumDak==FALSE OR $sumDak[0]['DEBET']==NULL OR $sumDak[0]['KREDIT']==NULL) {
|
|
$debetDak = 0;
|
|
$kreditDak = 0;
|
|
} else {
|
|
$debetDak = $sumDak[0]['DEBET'];
|
|
$kreditDak = $sumDak[0]['KREDIT'];
|
|
}
|
|
|
|
if ($debetDak==$kreditDak AND $no==0) {
|
|
$status = "LUNAS";
|
|
} else if ($no>0) {
|
|
$status = "RETUR";
|
|
} else {
|
|
$status = "BELUM LUNAS";
|
|
}
|
|
|
|
$this->output_json([
|
|
'total' => sizeof($data),
|
|
'data' => $data,
|
|
'kop' => $kop,
|
|
'status' => $status,
|
|
'nama_pelanggan' => $datPenjualan[0]['NAMA_PELANGGAN'],
|
|
'inv_penjualan' => $datPenjualan[0]['INV_PENJUALAN'],
|
|
'tgl_penjualan' => $datPenjualan[0]['TGL_PENJUALAN'],
|
|
'debetDak' => number_format($debetDak,2),
|
|
'kreditDak' => number_format($kreditDak,2),
|
|
]);
|
|
}
|
|
|
|
public function GE_AmbilData_Pembelian() {
|
|
$id_pembelian = $this->input->post('id_pembelian');
|
|
|
|
$datPembelian = $this->Amod->getData_Pembelian_byID($id_pembelian);
|
|
if ($datPembelian[0]['CORP_ID']==0) {
|
|
$kop = "OPNAME";
|
|
} else {
|
|
$kop = $this->Amod->generate_inisialCorp($datPembelian[0]['CORP_ID']);
|
|
}
|
|
|
|
if ($datPembelian[0]['GUDANG_PEMBELIAN']==1) {
|
|
$gudang_pembelian = "[Gudang 1] PC MASTER";
|
|
} else if ($datPembelian[0]['GUDANG_PEMBELIAN']==2) {
|
|
$gudang_pembelian = "[Gudang 2] IT POINT";
|
|
} else if ($datPembelian[0]['GUDANG_PEMBELIAN']==3) {
|
|
$gudang_pembelian = "[Gudang 3] SERVICE";
|
|
}
|
|
|
|
$this->output_json([
|
|
'kop' => $kop,
|
|
'gudang_pembelian' => $gudang_pembelian,
|
|
'nama_supplier' => $datPembelian[0]['NAMA_SUPPLIER'],
|
|
'kode_pembelian' => $datPembelian[0]['KODE_PEMBELIAN'],
|
|
'fp_pembelian' => $datPembelian[0]['FP_PEMBELIAN'],
|
|
'inv_pembelian' => $datPembelian[0]['INV_PEMBELIAN'],
|
|
'tt_pembelian' => $datPembelian[0]['TT_PEMBELIAN'],
|
|
'sj_pembelian' => $datPembelian[0]['SJ_PEMBELIAN'],
|
|
'po_pembelian' => $datPembelian[0]['PO_PEMBELIAN'],
|
|
'id_supplier' => $datPembelian[0]['SUPPLIER_ID'],
|
|
'tgl_sjbeli' => $datPembelian[0]['TGL_SJBELI'],
|
|
'tgl_invbeli' => $datPembelian[0]['TGL_INVBELI'],
|
|
'tempo_invbeli' => $datPembelian[0]['TEMPO_INVBELI'],
|
|
'id_corp' => $datPembelian[0]['CORP_ID'],
|
|
'ket_pembelian' => $datPembelian[0]['KET_PEMBELIAN'],
|
|
'status_pembelian' => $datPembelian[0]['STATUS_PEMBELIAN'],
|
|
]);
|
|
}
|
|
|
|
public function GE_AmbilData_Penjualan() {
|
|
$id_penjualan = $this->input->post('id_penjualan');
|
|
|
|
$datPenjualan = $this->Amod->getData_Penjualan_byID($id_penjualan);
|
|
if ($datPenjualan[0]['KOP_ID']==0 OR $datPenjualan[0]['KOP_ID']==NULL) {
|
|
$kop = "OPNAME";
|
|
} else {
|
|
$kop = $this->Amod->generate_inisialCorp($datPenjualan[0]['KOP_ID']);
|
|
}
|
|
|
|
if ($datPenjualan[0]['SO_ID']==NULL OR $datPenjualan[0]['GUDANG_SO']==0) {
|
|
$gudang_so = "[Gudang 0] OPNAME";
|
|
} else if ($datPenjualan[0]['GUDANG_SO']==1) {
|
|
$gudang_so = "[Gudang 1] PC MASTER";
|
|
} else if ($datPenjualan[0]['GUDANG_SO']==2) {
|
|
$gudang_so = "[Gudang 2] IT POINT";
|
|
} else if ($datPenjualan[0]['GUDANG_SO']==3) {
|
|
$gudang_so = "[Gudang 3] SERVICE";
|
|
}
|
|
|
|
$this->output_json([
|
|
'kop' => $kop,
|
|
'gudang_so' => $gudang_so,
|
|
'nama_pelanggan' => $datPenjualan[0]['NAMA_PELANGGAN'],
|
|
'kode_penjualan' => $datPenjualan[0]['KODE_PENJUALAN'],
|
|
'fp_penjualan' => $datPenjualan[0]['FP_PENJUALAN'],
|
|
'inv_penjualan' => $datPenjualan[0]['INV_PENJUALAN'],
|
|
'tt_penjualan' => $datPenjualan[0]['TT_PENJUALAN'],
|
|
'sj_penjualan' => $datPenjualan[0]['SJ_PENJUALAN'],
|
|
'po_so' => $datPenjualan[0]['PO_SO'],
|
|
'id_pelanggan' => $datPenjualan[0]['PEL_ID'],
|
|
'tgl_penjualan' => $datPenjualan[0]['TGL_PENJUALAN'],
|
|
'tempo_penjualan' => $datPenjualan[0]['TEMPO_PENJUALAN'],
|
|
'id_corp' => $datPenjualan[0]['KOP_ID'],
|
|
'ket_penjualan' => $datPenjualan[0]['KET_PENJUALAN'],
|
|
'status_penjualan' => $datPenjualan[0]['STATUS_PENJUALAN'],
|
|
]);
|
|
}
|
|
|
|
public function GE_AmbilData_LihatStok() {
|
|
$search = $this->input->post('search');
|
|
$filter1 = $this->input->post('filter1');
|
|
$filter2 = $this->input->post('filter2');
|
|
$filter3 = $this->input->post('filter3');
|
|
$filter4 = $this->input->post('filter4');
|
|
$filter5 = $this->input->post('filter5');
|
|
$filter6 = $this->input->post('filter6');
|
|
$ts = date('d/m/Y H:i:s');
|
|
|
|
if ($search=="") {
|
|
$list = NULL;
|
|
} else {
|
|
$list = explode(" ", $search);
|
|
}
|
|
|
|
$data = $this->Amod->getData_Kuantiti_bySEARCH_allStatus_limit100($list, $filter1, $filter2, $filter3, $filter4, $filter5, $filter6);
|
|
|
|
$this->output_json([
|
|
'data' => $data,
|
|
'ts' => $ts,
|
|
'find' => count($data),
|
|
]);
|
|
}
|
|
|
|
public function GE_AmbilData_DataDaftarService() {
|
|
$id_service = $this->input->post('id_service');
|
|
|
|
$datService = $this->Amod->getData_Service_byID($id_service);
|
|
if ($datService[0]['PELANGGAN_ID']==NULL) {
|
|
$atasnama = $datService[0]['NAMA_PANGGILAN_KARYAWAN'];
|
|
} else {
|
|
$atasnama = $datService[0]['NAMA_PELANGGAN'];
|
|
}
|
|
|
|
if ($datService[0]['JENIS_SERVICE']==0) {
|
|
$jenis = "Eksternal";
|
|
} else {
|
|
$jenis = "Internal";
|
|
}
|
|
|
|
$data = $this->Amod->getData_SnService_bySERVICE($id_service);
|
|
$no = 0;
|
|
foreach ($data as $key) {
|
|
$datHsv = $this->Amod->getData_HistoriService_bySNS_orderDESC_limit1($key['ID_SNS']);
|
|
if ($datHsv==FALSE) {
|
|
$info = "Unit Diterima";
|
|
$ket = "-";
|
|
} else {
|
|
if ($datHsv[0]['STATUS_HSV']==1) {
|
|
$info = "Selesai Service";
|
|
} else if ($datHsv[0]['STATUS_HSV']==2) {
|
|
$info = "Proses Cek Unit";
|
|
} else if ($datHsv[0]['STATUS_HSV']==3) {
|
|
$info = "Klaim Garansi";
|
|
} else if ($datHsv[0]['STATUS_HSV']==4) {
|
|
$info = "Order Sparepart";
|
|
} else if ($datHsv[0]['STATUS_HSV']==5) {
|
|
$info = "Penawaran";
|
|
} else if ($datHsv[0]['STATUS_HSV']==6) {
|
|
$info = "Extend Warranty";
|
|
} else if ($datHsv[0]['STATUS_HSV']==7) {
|
|
$info = "Gagal Service";
|
|
} else if ($datHsv[0]['STATUS_HSV']==8) {
|
|
$info = "Dibatalkan User";
|
|
}
|
|
$ket = $datHsv[0]['KET_HSV'];
|
|
}
|
|
$data[$no] += ['KET' => $ket];
|
|
$data[$no++] += ['INFO' => $info];
|
|
}
|
|
|
|
$this->output_json([
|
|
'total' => sizeof($data),
|
|
'data' => $data,
|
|
'jenis' => $jenis,
|
|
'atasnama' => $atasnama,
|
|
'paket' => $datService[0]['NAMA_BS'],
|
|
'cipta_service' => $datService[0]['CIPTA_SERVICE'],
|
|
'telp_service' => $datService[0]['TELP_SERVICE'],
|
|
'status_service' => $datService[0]['STATUS_SERVICE'],
|
|
'ket_batal' => $datService[0]['KET_BATAL'],
|
|
]);
|
|
}
|
|
|
|
public function GE_AmbilData_DataLinkKlaimProgram() {
|
|
$versi = $this->input->post('versi');
|
|
$id_snkpr = $this->input->post('id_snkpr');
|
|
|
|
$hargaAwal = NULL;
|
|
$hargaAkhir = NULL;
|
|
$status = NULL;
|
|
$datLnkpr = NULL;
|
|
$datHsn = NULL;
|
|
$potongan = 0;
|
|
|
|
if ($versi==1) {
|
|
$datLnkpr = $this->Amod->getData_LinkKlaimProgram_bySNKPR($id_snkpr);
|
|
$datHsn = $this->Amod->getData_HistoriSn_bySNKPR_bySTATUS_limit1_forKlaim($id_snkpr, 1);
|
|
|
|
$datSnkpr = $this->Amod->getData_SnKlaimProgram_byID($id_snkpr);
|
|
if ($datSnkpr[0]['STATUS_SNKPR']==1) {
|
|
$status = "SALEOUT";
|
|
} else if ($datSnkpr[0]['STATUS_SNKPR']==2) {
|
|
$status = "RETURBELI";
|
|
} else if ($datSnkpr[0]['STATUS_SNKPR']==3) {
|
|
$status = "KELUARSTOK";
|
|
} else if ($datSnkpr[0]['STATUS_SNKPR']==4) {
|
|
$status = "PROMOTOR";
|
|
} else if ($datSnkpr[0]['STATUS_SNKPR']==9) {
|
|
$status = "DISEMBUNYIKAN";
|
|
} else {
|
|
$status = "READY";
|
|
}
|
|
|
|
$sumLnkpr = $this->Amod->getSum_LinkKlaimProgram_bySNKPR($id_snkpr);
|
|
if ($sumLnkpr==FALSE OR $sumLnkpr[0]['TOTAL']==NULL) {
|
|
$totalPotongan = 0;
|
|
$hargaAkhir = $datSnkpr[0]['HARGA'];
|
|
} else {
|
|
$totalPotongan = $sumLnkpr[0]['TOTAL'];
|
|
$hargaAkhir = number_format(($datSnkpr[0]['HARGA_KPR']-$totalPotongan),2);
|
|
}
|
|
|
|
$hargaAwal = $datSnkpr[0]['HARGA'];
|
|
}
|
|
|
|
$this->output_json([
|
|
'hargaAwal' => $hargaAwal,
|
|
'hargaAkhir' => $hargaAkhir,
|
|
'status' => $status,
|
|
'program' => $datLnkpr,
|
|
'hsn' => $datHsn,
|
|
'potongan' => number_format($totalPotongan,2),
|
|
]);
|
|
}
|
|
|
|
public function GE_AmbilData_DataDaftarAkuntansi() {
|
|
$id_akuntansi = $this->input->post('id_akuntansi');
|
|
|
|
$data = $this->Amod->getData_DaftarAkuntansi_byAKUNTANSI($id_akuntansi);
|
|
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byAKUNTANSI($id_akuntansi);
|
|
if ($sumDak==FALSE OR $sumDak[0]['DEBET']==NULL) {
|
|
$debetDak = 0;
|
|
$kreditDak = 0;
|
|
} else {
|
|
$debetDak = $sumDak[0]['DEBET'];
|
|
$kreditDak = $sumDak[0]['KREDIT'];
|
|
}
|
|
|
|
$datAkuntansi = $this->Amod->getData_Akuntansi_byID($id_akuntansi);
|
|
if ($datAkuntansi[0]['KAS_AKUNTANSI']!=NULL) {
|
|
$datKas = $this->Amod->getData_Kas_byID($datAkuntansi[0]['KAS_AKUNTANSI']);
|
|
$sumber = $datKas[0]['KODE_KAS'];
|
|
} else if ($datAkuntansi[0]['BANK_AKUNTANSI']!=NULL) {
|
|
$datBank = $this->Amod->getData_Bank_byID($datAkuntansi[0]['BANK_AKUNTANSI']);
|
|
$sumber = $datBank[0]['KODE_BANK'];
|
|
} else {
|
|
$sumber = "Kosong";
|
|
}
|
|
|
|
$this->output_json([
|
|
'total' => sizeof($data),
|
|
'data' => $data,
|
|
'sumber' => $sumber,
|
|
'debetDak' => number_format($debetDak,2),
|
|
'kreditDak' => number_format($kreditDak,2),
|
|
]);
|
|
}
|
|
|
|
public function GE_AmbilData_DetailDaftarAkuntansi() {
|
|
$id_perkiraan = $this->input->post('id_perkiraan');
|
|
$id_pak = $this->input->post('id_pak');
|
|
$detail_id = $this->input->post('detail_id');
|
|
$search = $this->input->post('search');
|
|
|
|
$datPerkiraan = $this->Amod->getData_Perkiraan_byID($id_perkiraan);
|
|
$datPak = $this->Amod->getData_PeriodeAkuntansi_byID($id_pak);
|
|
if ($datPak[0]['STATUS_PAK']==0) {
|
|
$now = date('Y-m-d');
|
|
$limit = date('Y-m-01');
|
|
} else if ($datPak[0]['STATUS_PAK']==1) {
|
|
$now = $datPak[0]['AKHIR_PAK'];
|
|
$limit = $datPak[0]['AWAL_PAK'];
|
|
}
|
|
$awal = $this->Amod->generate_subDay($limit, 1);
|
|
|
|
$data = [];
|
|
$no = 0;
|
|
if ($id_perkiraan==1) {
|
|
$datKas = $this->Amod->getData_Kas_byID($detail_id);
|
|
$detail_ket = $datKas[0]['KODE_KAS'];
|
|
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byKAS_beforeTGL($id_perkiraan, $detail_id, $awal);
|
|
$saldoAwal = $sumDak[0]['DEBET']-$sumDak[0]['KREDIT'];
|
|
|
|
$data[$no++] = [
|
|
'KODE' => "SALDO AWAL",
|
|
'TANGGAL' => date_format(date_create($awal), "d/m/Y"),
|
|
'DEBET' => "",
|
|
'KREDIT' => "",
|
|
'SALDO' => number_format($saldoAwal, 2),
|
|
'KET' => "Saldo Awal"
|
|
];
|
|
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byPERKIRAAN_byKAS_byPERIODE_bySEARCH($id_perkiraan, $detail_id, $limit, $now, $search);
|
|
foreach ($datDak as $key) {
|
|
$saldoAwal = $saldoAwal+$key['DEBET_DAK']-$key['KREDIT_DAK'];
|
|
$data[$no++] = [
|
|
'KODE' => $key['KODE_AKUNTANSI'],
|
|
'TANGGAL' => $key['CIPTA_DAK'],
|
|
'DEBET' => $key['DEBET'],
|
|
'KREDIT' => $key['KREDIT'],
|
|
'SALDO' => number_format($saldoAwal, 2),
|
|
'KET' => $key['KET_DAK']
|
|
];
|
|
}
|
|
} else if ($id_perkiraan==2) {
|
|
$datBank = $this->Amod->getData_Bank_byID($detail_id);
|
|
$detail_ket = $datBank[0]['KODE_BANK'];
|
|
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byBANK_beforeTGL($id_perkiraan, $detail_id, $awal);
|
|
$saldoAwal = $sumDak[0]['DEBET']-$sumDak[0]['KREDIT'];
|
|
|
|
$data[$no++] = [
|
|
'KODE' => "SALDO AWAL",
|
|
'TANGGAL' => date_format(date_create($awal), "d/m/Y"),
|
|
'DEBET' => "",
|
|
'KREDIT' => "",
|
|
'SALDO' => number_format($saldoAwal, 2),
|
|
'KET' => "Saldo Awal"
|
|
];
|
|
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byPERKIRAAN_byBANK_byPERIODE_bySEARCH($id_perkiraan, $detail_id, $limit, $now, $search);
|
|
foreach ($datDak as $key) {
|
|
$saldoAwal = $saldoAwal+$key['DEBET_DAK']-$key['KREDIT_DAK'];
|
|
$data[$no++] = [
|
|
'KODE' => $key['KODE_AKUNTANSI'],
|
|
'TANGGAL' => $key['CIPTA_DAK'],
|
|
'DEBET' => $key['DEBET'],
|
|
'KREDIT' => $key['KREDIT'],
|
|
'SALDO' => number_format($saldoAwal, 2),
|
|
'KET' => $key['KET_DAK']
|
|
];
|
|
}
|
|
} else if ($id_perkiraan==3) {
|
|
$datPelanggan = $this->Amod->getData_Pelanggan_byID($detail_id);
|
|
$detail_ket = $datPelanggan[0]['NAMA_PELANGGAN'];
|
|
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPELANGGAN_beforeTGL($id_perkiraan, $detail_id, $awal);
|
|
$saldoAwal = $sumDak[0]['DEBET']-$sumDak[0]['KREDIT'];
|
|
|
|
$data[$no++] = [
|
|
'KODE' => "SALDO AWAL",
|
|
'TANGGAL' => date_format(date_create($awal), "d/m/Y"),
|
|
'DEBET' => "",
|
|
'KREDIT' => "",
|
|
'SALDO' => number_format($saldoAwal, 2),
|
|
'KET' => "Saldo Awal"
|
|
];
|
|
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byPERKIRAAN_byPELANGGAN_byPERIODE_bySEARCH($id_perkiraan, $detail_id, $limit, $now, $search);
|
|
foreach ($datDak as $key) {
|
|
$saldoAwal = $saldoAwal+$key['DEBET_DAK']-$key['KREDIT_DAK'];
|
|
$data[$no++] = [
|
|
'KODE' => $key['KODE_AKUNTANSI'],
|
|
'TANGGAL' => $key['CIPTA_DAK'],
|
|
'DEBET' => $key['DEBET'],
|
|
'KREDIT' => $key['KREDIT'],
|
|
'SALDO' => number_format($saldoAwal, 2),
|
|
'KET' => $key['KET_DAK']
|
|
];
|
|
}
|
|
} else if ($id_perkiraan==5) {
|
|
$datKaryawan = $this->Amod->getData_Karyawan_byID($detail_id);
|
|
$detail_ket = $datKaryawan[0]['NAMA_PANGGILAN_KARYAWAN'];
|
|
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byKARYAWAN_beforeTGL($id_perkiraan, $detail_id, $awal);
|
|
$saldoAwal = $sumDak[0]['DEBET']-$sumDak[0]['KREDIT'];
|
|
|
|
$data[$no++] = [
|
|
'KODE' => "SALDO AWAL",
|
|
'TANGGAL' => date_format(date_create($awal), "d/m/Y"),
|
|
'DEBET' => "",
|
|
'KREDIT' => "",
|
|
'SALDO' => number_format($saldoAwal, 2),
|
|
'KET' => "Saldo Awal"
|
|
];
|
|
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byPERKIRAAN_byKARYAWAN_byPERIODE_bySEARCH($id_perkiraan, $detail_id, $limit, $now, $search);
|
|
foreach ($datDak as $key) {
|
|
$saldoAwal = $saldoAwal+$key['DEBET_DAK']-$key['KREDIT_DAK'];
|
|
$data[$no++] = [
|
|
'KODE' => $key['KODE_AKUNTANSI'],
|
|
'TANGGAL' => $key['CIPTA_DAK'],
|
|
'DEBET' => $key['DEBET'],
|
|
'KREDIT' => $key['KREDIT'],
|
|
'SALDO' => number_format($saldoAwal, 2),
|
|
'KET' => $key['KET_DAK']
|
|
];
|
|
}
|
|
} else if ($id_perkiraan==6) {
|
|
$datPihakke3 = $this->Amod->getData_Pihakke3_byID($detail_id);
|
|
$detail_ket = $datPihakke3[0]['NAMA_PIHAKKE3'];
|
|
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPIHAKKE3_beforeTGL($id_perkiraan, $detail_id, $awal);
|
|
$saldoAwal = $sumDak[0]['DEBET']-$sumDak[0]['KREDIT'];
|
|
|
|
$data[$no++] = [
|
|
'KODE' => "SALDO AWAL",
|
|
'TANGGAL' => date_format(date_create($awal), "d/m/Y"),
|
|
'DEBET' => "",
|
|
'KREDIT' => "",
|
|
'SALDO' => number_format($saldoAwal, 2),
|
|
'KET' => "Saldo Awal"
|
|
];
|
|
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byPERKIRAAN_byPIHAKKE3_byPERIODE_bySEARCH($id_perkiraan, $detail_id, $limit, $now, $search);
|
|
foreach ($datDak as $key) {
|
|
$saldoAwal = $saldoAwal+$key['DEBET_DAK']-$key['KREDIT_DAK'];
|
|
$data[$no++] = [
|
|
'KODE' => $key['KODE_AKUNTANSI'],
|
|
'TANGGAL' => $key['CIPTA_DAK'],
|
|
'DEBET' => $key['DEBET'],
|
|
'KREDIT' => $key['KREDIT'],
|
|
'SALDO' => number_format($saldoAwal, 2),
|
|
'KET' => $key['KET_DAK']
|
|
];
|
|
}
|
|
} else if ($id_perkiraan==7) {
|
|
$datSupplier = $this->Amod->getData_Supplier_byID($detail_id);
|
|
$detail_ket = $datSupplier[0]['NAMA_SUPPLIER'];
|
|
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_bySUPPLIER_beforeTGL($id_perkiraan, $detail_id, $awal);
|
|
$saldoAwal = $sumDak[0]['DEBET']-$sumDak[0]['KREDIT'];
|
|
|
|
$data[$no++] = [
|
|
'KODE' => "SALDO AWAL",
|
|
'TANGGAL' => date_format(date_create($awal), "d/m/Y"),
|
|
'DEBET' => "",
|
|
'KREDIT' => "",
|
|
'SALDO' => number_format($saldoAwal, 2),
|
|
'KET' => "Saldo Awal"
|
|
];
|
|
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byPERKIRAAN_bySUPPLIER_byPERIODE_bySEARCH($id_perkiraan, $detail_id, $limit, $now, $search);
|
|
foreach ($datDak as $key) {
|
|
$saldoAwal = $saldoAwal+$key['DEBET_DAK']-$key['KREDIT_DAK'];
|
|
$data[$no++] = [
|
|
'KODE' => $key['KODE_AKUNTANSI'],
|
|
'TANGGAL' => $key['CIPTA_DAK'],
|
|
'DEBET' => $key['DEBET'],
|
|
'KREDIT' => $key['KREDIT'],
|
|
'SALDO' => number_format($saldoAwal, 2),
|
|
'KET' => $key['KET_DAK']
|
|
];
|
|
}
|
|
} else if ($id_perkiraan==15) {
|
|
$datSupplier = $this->Amod->getData_Supplier_byID($detail_id);
|
|
$detail_ket = $datSupplier[0]['NAMA_SUPPLIER'];
|
|
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_bySUPPLIER_beforeTGL($id_perkiraan, $detail_id, $awal);
|
|
$saldoAwal = $sumDak[0]['KREDIT']-$sumDak[0]['DEBET'];
|
|
|
|
$data[$no++] = [
|
|
'KODE' => "SALDO AWAL",
|
|
'TANGGAL' => date_format(date_create($awal), "d/m/Y"),
|
|
'DEBET' => "",
|
|
'KREDIT' => "",
|
|
'SALDO' => number_format($saldoAwal, 2),
|
|
'KET' => "Saldo Awal"
|
|
];
|
|
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byPERKIRAAN_bySUPPLIER_byPERIODE_bySEARCH($id_perkiraan, $detail_id, $limit, $now, $search);
|
|
foreach ($datDak as $key) {
|
|
$saldoAwal = $saldoAwal+$key['KREDIT_DAK']-$key['DEBET_DAK'];
|
|
$data[$no++] = [
|
|
'KODE' => $key['KODE_AKUNTANSI'],
|
|
'TANGGAL' => $key['CIPTA_DAK'],
|
|
'DEBET' => $key['DEBET'],
|
|
'KREDIT' => $key['KREDIT'],
|
|
'SALDO' => number_format($saldoAwal, 2),
|
|
'KET' => $key['KET_DAK']
|
|
];
|
|
}
|
|
} else if ($id_perkiraan==19) {
|
|
$datPelanggan = $this->Amod->getData_Pelanggan_byID($detail_id);
|
|
$detail_ket = $datPelanggan[0]['NAMA_PELANGGAN'];
|
|
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPELANGGAN_beforeTGL($id_perkiraan, $detail_id, $awal);
|
|
$saldoAwal = $sumDak[0]['KREDIT']-$sumDak[0]['DEBET'];
|
|
|
|
$data[$no++] = [
|
|
'KODE' => "SALDO AWAL",
|
|
'TANGGAL' => date_format(date_create($awal), "d/m/Y"),
|
|
'DEBET' => "",
|
|
'KREDIT' => "",
|
|
'SALDO' => number_format($saldoAwal, 2),
|
|
'KET' => "Saldo Awal"
|
|
];
|
|
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byPERKIRAAN_byPELANGGAN_byPERIODE_bySEARCH($id_perkiraan, $detail_id, $limit, $now, $search);
|
|
foreach ($datDak as $key) {
|
|
$saldoAwal = $saldoAwal+$key['KREDIT_DAK']-$key['DEBET_DAK'];
|
|
$data[$no++] = [
|
|
'KODE' => $key['KODE_AKUNTANSI'],
|
|
'TANGGAL' => $key['CIPTA_DAK'],
|
|
'DEBET' => $key['DEBET'],
|
|
'KREDIT' => $key['KREDIT'],
|
|
'SALDO' => number_format($saldoAwal, 2),
|
|
'KET' => $key['KET_DAK']
|
|
];
|
|
}
|
|
} else if ($id_perkiraan==33 OR $id_perkiraan==34) {
|
|
$datKendaraan = $this->Amod->getData_Kendaraan_byID($detail_id);
|
|
$detail_ket = $datKendaraan[0]['NAMA_KENDARAAN'];
|
|
|
|
$saldoAwal = 0;
|
|
|
|
$data[$no++] = [
|
|
'KODE' => "SALDO AWAL",
|
|
'TANGGAL' => date_format(date_create($limit), "d/m/Y"),
|
|
'DEBET' => "",
|
|
'KREDIT' => "",
|
|
'SALDO' => number_format($saldoAwal, 2),
|
|
'KET' => "Saldo Awal"
|
|
];
|
|
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byPERKIRAAN_byKENDARAAN_byPERIODE_bySEARCH($id_perkiraan, $detail_id, $limit, $now, $search);
|
|
foreach ($datDak as $key) {
|
|
$saldoAwal = $saldoAwal+$key['DEBET_DAK']-$key['KREDIT_DAK'];
|
|
$data[$no++] = [
|
|
'KODE' => $key['KODE_AKUNTANSI'],
|
|
'TANGGAL' => $key['CIPTA_DAK'],
|
|
'DEBET' => $key['DEBET'],
|
|
'KREDIT' => $key['KREDIT'],
|
|
'SALDO' => number_format($saldoAwal, 2),
|
|
'KET' => $key['KET_DAK']
|
|
];
|
|
}
|
|
} else if ($id_perkiraan==64 OR $id_perkiraan==70) {
|
|
$datPelanggan = $this->Amod->getData_Pelanggan_byID($detail_id);
|
|
$detail_ket = $datPelanggan[0]['NAMA_PELANGGAN'];
|
|
|
|
$saldoAwal = 0;
|
|
|
|
$data[$no++] = [
|
|
'KODE' => "SALDO AWAL",
|
|
'TANGGAL' => date_format(date_create($limit), "d/m/Y"),
|
|
'DEBET' => "",
|
|
'KREDIT' => "",
|
|
'SALDO' => number_format($saldoAwal, 2),
|
|
'KET' => "Saldo Awal"
|
|
];
|
|
|
|
if ($id_perkiraan==64) {
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byPERKIRAAN_byPELANGGAN_byPERIODE_bySEARCH($id_perkiraan, $detail_id, $limit, $now, $search);
|
|
} else if ($id_perkiraan==70) {
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byPERKIRAAN_byPELANGGAN_byPERIODE_bySEARCH_forProyek($id_perkiraan, $detail_id, $limit, $now, $search);
|
|
}
|
|
foreach ($datDak as $key) {
|
|
$saldoAwal = $saldoAwal+$key['DEBET_DAK']-$key['KREDIT_DAK'];
|
|
$data[$no++] = [
|
|
'KODE' => $key['KODE_AKUNTANSI'],
|
|
'TANGGAL' => $key['CIPTA_DAK'],
|
|
'DEBET' => $key['DEBET'],
|
|
'KREDIT' => $key['KREDIT'],
|
|
'SALDO' => number_format($saldoAwal, 2),
|
|
'KET' => $key['KET_DAK']
|
|
];
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'total' => sizeof($data),
|
|
'data' => $data,
|
|
'nama' => $datPerkiraan[0]['NAMA_PERKIRAAN'],
|
|
'det' => $detail_ket,
|
|
]);
|
|
}
|
|
|
|
public function GE_AmbilData_DataDakFee() {
|
|
$id_penjualan = $this->input->post('id_penjualan');
|
|
|
|
$datSo = $this->Amod->getData_SalesOrder_byPENJUALAN($id_penjualan);
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byPERKIRAAN_byPENJUALAN(64, $id_penjualan);
|
|
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byPENJUALAN_byPERKIRAAN($id_penjualan, 64);
|
|
if ($sumDak==FALSE OR $sumDak[0]['DEBET']==NULL) {
|
|
$terbayar = 0;
|
|
} else {
|
|
$terbayar = $sumDak[0]['DEBET'];
|
|
}
|
|
|
|
$no = 0;
|
|
$feeTotal = $datSo[0]['FEE_SO'];
|
|
$data[$no++] = [
|
|
'KODE' => $datSo[0]['KODE_SO'],
|
|
'TANGGAL' => $datSo[0]['TANGGAL'],
|
|
'TS' => "",
|
|
'FEE' => number_format($feeTotal, 2),
|
|
'TERBAYAR' => "0.00",
|
|
'SUBTOTAL' => number_format($feeTotal, 2),
|
|
];
|
|
|
|
foreach ($datDak as $key) {
|
|
$feeTotal = $feeTotal-$key['DEBET_DAK'];
|
|
$data[$no++] = [
|
|
'KODE' => $key['KODE_AKUNTANSI'],
|
|
'TANGGAL' => $key['TANGGAL'],
|
|
'TS' => $key['CIPTA_DAK'],
|
|
'FEE' => "0.00",
|
|
'TERBAYAR' => number_format($key['DEBET_DAK'],2),
|
|
'SUBTOTAL' => number_format($feeTotal, 2),
|
|
];
|
|
}
|
|
|
|
$this->output_json([
|
|
'total' => sizeof($data),
|
|
'data' => $data,
|
|
'kode_so' => $datSo[0]['KODE_SO'],
|
|
'nama_pelanggan' => $datSo[0]['NAMA_PELANGGAN'],
|
|
'sisaFee' => number_format($feeTotal,2),
|
|
]);
|
|
}
|
|
|
|
public function GE_AmbilData_DataDakHutangDagang() {
|
|
$id_supplier = $this->input->post('id_supplier');
|
|
$search = $this->input->post('search');
|
|
|
|
$datSupplier = $this->Amod->getData_Supplier_byID($id_supplier);
|
|
$data = $this->Amod->getData_HasilHitungHda_bySUPPLIER_belumLunasOnly($id_supplier, $search);
|
|
|
|
$this->output_json([
|
|
'total' => sizeof($data),
|
|
'data' => $data,
|
|
'nama_supplier' => $datSupplier[0]['NAMA_SUPPLIER'],
|
|
]);
|
|
}
|
|
|
|
public function GE_AmbilData_DataDakPiutangKaryawan() {
|
|
$id_karyawan = $this->input->post('id_karyawan');
|
|
$search = $this->input->post('search');
|
|
|
|
$datKaryawan = $this->Amod->getData_Karyawan_byID($id_karyawan);
|
|
$data = $this->Amod->getData_DaftarAkuntansi_byKARYAWAN_forPiutangKaryawan($id_karyawan, $search);
|
|
$no = 0;
|
|
$subtotal = 0;
|
|
foreach ($data as $key) {
|
|
$subtotal = $subtotal+$key['DEBET_DAK']-$key['KREDIT_DAK'];
|
|
$data[$no++] += ['SUBTOTAL' => number_format($subtotal, 2)];
|
|
}
|
|
|
|
$this->output_json([
|
|
'total' => sizeof($data),
|
|
'data' => $data,
|
|
'panggilanKaryawan' => $datKaryawan[0]['NAMA_PANGGILAN_KARYAWAN'],
|
|
'sisaPiutang' => number_format($subtotal,2),
|
|
]);
|
|
}
|
|
|
|
public function GE_AmbilData_DataDakPiutangPihakke3() {
|
|
$id_pihakke3 = $this->input->post('id_pihakke3');
|
|
$search = $this->input->post('search');
|
|
|
|
$datPihakke3 = $this->Amod->getData_Pihakke3_byID($id_pihakke3);
|
|
$data = $this->Amod->getData_DaftarAkuntansi_byPIHAKKE3_forPiutangPihakke3($id_pihakke3, $search);
|
|
$no = 0;
|
|
$subtotal = 0;
|
|
foreach ($data as $key) {
|
|
$subtotal = $subtotal+$key['DEBET_DAK']-$key['KREDIT_DAK'];
|
|
$data[$no++] += ['SUBTOTAL' => number_format($subtotal, 2)];
|
|
}
|
|
|
|
$this->output_json([
|
|
'total' => sizeof($data),
|
|
'data' => $data,
|
|
'nama_pihakke3' => $datPihakke3[0]['NAMA_PIHAKKE3'],
|
|
'sisaPiutang' => number_format($subtotal,2),
|
|
]);
|
|
}
|
|
|
|
public function GE_AmbilData_DataDakDpPembelian() {
|
|
$id_supplier = $this->input->post('id_supplier');
|
|
|
|
$datSupplier = $this->Amod->getData_Supplier_byID($id_supplier);
|
|
$data = $this->Amod->getData_DaftarAkuntansi_bySUPPLIER_forDpPembelian($id_supplier);
|
|
|
|
$this->output_json([
|
|
'total' => sizeof($data),
|
|
'data' => $data,
|
|
'nama_supplier' => $datSupplier[0]['NAMA_SUPPLIER'],
|
|
]);
|
|
}
|
|
|
|
public function GE_AmbilData_DataDakDpPenjualan() {
|
|
$id_pelanggan = $this->input->post('id_pelanggan');
|
|
|
|
$datPelanggan = $this->Amod->getData_Pelanggan_byID($id_pelanggan);
|
|
$data = $this->Amod->getData_DaftarAkuntansi_byPELANGGAN_forDpPenjualan($id_pelanggan);
|
|
|
|
$this->output_json([
|
|
'total' => sizeof($data),
|
|
'data' => $data,
|
|
'nama_pelanggan' => $datPelanggan[0]['NAMA_PELANGGAN'],
|
|
]);
|
|
}
|
|
|
|
public function GE_AmbilData_DataDaftarReturJual() {
|
|
$id_rj = $this->input->post('id_rj');
|
|
|
|
$datRj = $this->Amod->getData_ReturPenjualan_byID($id_rj);
|
|
$kop = $this->Amod->generate_inisialCorp($datRj[0]['CORP_ID']);
|
|
|
|
$data = $this->Amod->getData_DaftarReturJual_byRJ($id_rj);
|
|
$no = 0;
|
|
$sn = "";
|
|
foreach ($data as $key) {
|
|
$datSnrj = $this->Amod->getData_SnReturJual_byDRJ($key['ID_DRJ']);
|
|
foreach ($datSnrj as $dat) {
|
|
$nama_snrj = $dat['NAMA_SNRJ'];
|
|
$sn .= "$nama_snrj, ";
|
|
}
|
|
|
|
$satuan = $key['HARGA_DRJ'];
|
|
$subtotal = $key['HARGA_DRJ']*$key['QTY_DRJ'];
|
|
|
|
$data[$no] += ['SN' => $sn];
|
|
$data[$no] += ['SATUAN' => number_format($satuan,2)];
|
|
$data[$no++] += ['SUBTOTAL' => number_format($subtotal,2)];
|
|
|
|
$sn = "";
|
|
}
|
|
|
|
$sumPda = $this->Amod->getSum_DaftarReturJual_byRJ($id_rj);
|
|
if ($sumPda[0]['TOTAL']==NULL) {
|
|
$dppDrj = 0;
|
|
$ppnDrj = 0;
|
|
$totDrj = 0;
|
|
} else {
|
|
$dppDrj = round($sumPda[0]['TOTAL'],2);
|
|
$ppnDrj = round(($sumPda[0]['TOTAL']*($datRj[0]['PPN_SO']/100)),2);
|
|
$totDrj = round(($dppDrj+$ppnDrj),2);
|
|
}
|
|
|
|
$this->output_json([
|
|
'total' => sizeof($data),
|
|
'data' => $data,
|
|
'kop' => $kop,
|
|
'nama_pelanggan' => $datRj[0]['NAMA_PELANGGAN'],
|
|
'nama_sales' => $datRj[0]['NAMA_PANGGILAN_KARYAWAN'],
|
|
'kode_rj' => $datRj[0]['KODE_RJ'],
|
|
'fp_penjualan' => $datRj[0]['FP_PENJUALAN'],
|
|
'id_pelanggan' => $datRj[0]['PELANGGAN_ID'],
|
|
'inv_rj' => $datRj[0]['INV_RJ'],
|
|
'tgl_input' => $datRj[0]['TGL_INPUT'],
|
|
'tgl_penjualan' => $datRj[0]['TGL_PENJUALAN'],
|
|
'tempo_penjualan' => $datRj[0]['TEMPO_PENJUALAN'],
|
|
'inv_penjualan' => $datRj[0]['INV_PENJUALAN'],
|
|
'tt_penjualan' => $datRj[0]['TT_PENJUALAN'],
|
|
'id_corp' => $datRj[0]['CORP_ID'],
|
|
'ket_rj' => $datRj[0]['KET_RJ'],
|
|
'status_rj' => $datRj[0]['STATUS_RJ'],
|
|
'dppDrj' => number_format($dppDrj,2),
|
|
'ppnDrj' => number_format($ppnDrj,2),
|
|
'totDrj' => number_format($totDrj,2),
|
|
]);
|
|
}
|
|
|
|
public function GE_AmbilData_PilihSnStock() {
|
|
$jenis = $this->input->post('jenis');
|
|
$id_snstock = $this->input->post('id_snstock');
|
|
$nama_snstock = $this->input->post('nama_snstock');
|
|
$nama_snstock = strtoupper($nama_snstock);
|
|
|
|
$value = 0;
|
|
if ($jenis==1) {
|
|
$datSnStock = $this->Amod->getData_SnStock_byNAMA_allStatus($nama_snstock);
|
|
if ($datSnStock==TRUE) {
|
|
$value = 1;
|
|
}
|
|
} else if ($jenis==2) {
|
|
$datSnStock = $this->Amod->getData_SnStock_byID($id_snstock);
|
|
if ($datSnStock==TRUE) {
|
|
$value = 1;
|
|
$nama_snstock = $datSnStock[0]['NAMA_SNSTOCK'];
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
'nama_snstock' => $nama_snstock,
|
|
]);
|
|
}
|
|
|
|
public function GE_AmbilData_DataKas() {
|
|
$id_kas = $this->input->post('id_kas');
|
|
$now = date('Y-m-d');
|
|
$limit = date('Y-m-01');
|
|
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byKAS_byPERKIRAAN_byPERIODE($id_kas, 1, $now);
|
|
if ($sumDak==FALSE OR $sumDak[0]['DEBET']==NULL) {
|
|
$totSaldo = 0;
|
|
} else {
|
|
$totSaldo = $sumDak[0]['DEBET']-$sumDak[0]['KREDIT'];
|
|
}
|
|
|
|
$countSelesai = $this->Amod->getCount_Akuntansi_byKAS_bySTATUS_byPERIODE($id_kas, 1, $limit, $now);
|
|
|
|
$datKas = $this->Amod->getData_Kas_bySTATUS(1);
|
|
$no = 0;
|
|
foreach ($datKas as $key) {
|
|
$count = $this->Amod->getCount_Akuntansi_byKAS_bySTATUS_byPERIODE($key['ID_KAS'], 0, $limit, $now);
|
|
$datKas[$no++] += ['COUNT' => $count];
|
|
}
|
|
|
|
$this->output_json([
|
|
'totSaldo' => number_format($totSaldo, 2),
|
|
'countSelesai' => $countSelesai,
|
|
'kas' => $datKas
|
|
]);
|
|
}
|
|
|
|
public function GE_AmbilData_DataBank() {
|
|
$id_bank = $this->input->post('id_bank');
|
|
$now = date('Y-m-d');
|
|
$limit = date('Y-m-01');
|
|
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byBANK_byPERKIRAAN_byPERIODE($id_bank, 2, $now);
|
|
if ($sumDak==FALSE OR $sumDak[0]['DEBET']==NULL) {
|
|
$totSaldo = 0;
|
|
} else {
|
|
$totSaldo = $sumDak[0]['DEBET']-$sumDak[0]['KREDIT'];
|
|
}
|
|
|
|
$countSelesai = $this->Amod->getCount_Akuntansi_byBANK_bySTATUS_byPERIODE($id_bank, 1, $limit, $now);
|
|
|
|
$datBank = $this->Amod->getData_Bank_bySTATUS(1);
|
|
$no = 0;
|
|
foreach ($datBank as $key) {
|
|
$count = $this->Amod->getCount_Akuntansi_byBANK_bySTATUS_byPERIODE($key['ID_BANK'], 0, $limit, $now);
|
|
$datBank[$no++] += ['COUNT' => $count];
|
|
}
|
|
|
|
$this->output_json([
|
|
'totSaldo' => number_format($totSaldo, 2),
|
|
'countSelesai' => $countSelesai,
|
|
'bank' => $datBank
|
|
]);
|
|
}
|
|
|
|
public function GE_AmbilData_DataJurnalMemo() {
|
|
$now = date('Y-m-d');
|
|
$limit = date('Y-m-01');
|
|
|
|
$countSelesai = $this->Amod->getCount_Akuntansi_bySTATUS_byPERIODE_forJM(1, $limit, $now);
|
|
|
|
$this->output_json([
|
|
'countSelesai' => $countSelesai
|
|
]);
|
|
}
|
|
|
|
public function GE_Ambil_DataAbsensi() {
|
|
$verse = $this->input->post('verse');
|
|
$id_pab = $this->input->post('id_pab');
|
|
$id_karyawan = $this->input->post('id_karyawan');
|
|
$karyawan_id = $this->session->userdata('id_karyawan');
|
|
|
|
$data = [];
|
|
$totWeeks = 0;
|
|
$totTelat = 0;
|
|
$totCuti = 0;
|
|
$totSakit = 0;
|
|
$noawal = 0;
|
|
if ($verse==1) { // Ambil keseluruhan Absensi versi Kalender
|
|
if ($id_pab>0) {
|
|
$datPab = $this->Amod->getData_PeriodeAbsensi($id_pab);
|
|
$diffawal = new DateTime($datPab[0]['AWAL_PAB']);
|
|
$diffakhir = new DateTime($datPab[0]['AKHIR_PAB']);
|
|
$diff = date_diff($diffawal, $diffakhir);
|
|
$diff = $diff->format("%a");
|
|
$tglstart = $datPab[0]['AWAL_PAB'];
|
|
$tglloop = $datPab[0]['AWAL_PAB'];
|
|
$tgllimit = $datPab[0]['AKHIR_PAB'];
|
|
|
|
$data = [];
|
|
$cekAwal = date_format(date_create($tglloop),"w");
|
|
$nilaiAwal = (int)$cekAwal;
|
|
|
|
//Minggu Pertama sebelum Periode Absensi
|
|
$selisih = $nilaiAwal;
|
|
for ($no = 0; $no<=$selisih; $no++) {
|
|
$tglBefore = $this->Amod->generate_subDay($tglstart, ($selisih-$no));
|
|
$monthNew = date_format(date_create($tglBefore),"m");
|
|
$monthNew = substr(($this->Amod->generate_inisialMonth($monthNew)),0,3);
|
|
$tglNew = (int) date_format(date_create($tglBefore),"d");
|
|
$tglBaru = "$tglNew $monthNew";
|
|
|
|
$cekMinggu = date_format(date_create($tglBefore),"w");
|
|
$shl = "Libur";
|
|
if ($cekMinggu==0) {
|
|
$weekend = 1;
|
|
} else {
|
|
$cekLibur = $this->Amod->getData_SetHariLibur_byTGL($tglBefore);
|
|
if ($cekLibur==TRUE) {
|
|
$weekend = 1;
|
|
$shl = $cekLibur[0]['NAMA_SHL'];
|
|
} else {
|
|
$weekend = 0;
|
|
}
|
|
}
|
|
|
|
$data[$no] = [
|
|
'TANGGAL' => $tglBaru,
|
|
'SEKARANG' => $tglBefore,
|
|
'WEEKEND' => $weekend,
|
|
'SHL' => $shl,
|
|
'SABS' => "",
|
|
'STAT' => '9',
|
|
'MASUK' => "",
|
|
'KELUAR' => "",
|
|
'LOKASI' => "",
|
|
'FADE' => '1'
|
|
];
|
|
}
|
|
|
|
//Minggu Pertama sesuai Periode Absensi
|
|
for ($no = $nilaiAwal; $no<=6; $no++) {
|
|
$monthNew = date_format(date_create($tglloop),"m");
|
|
$monthNew = substr(($this->Amod->generate_inisialMonth($monthNew)),0,3);
|
|
$tglNew = (int) date_format(date_create($tglloop),"d");
|
|
$tglBaru = "$tglNew $monthNew";
|
|
|
|
$cekMinggu = date_format(date_create($tglloop),"w");
|
|
$shl = "Libur";
|
|
if ($cekMinggu==0) {
|
|
$weekend = 1;
|
|
} else {
|
|
$cekLibur = $this->Amod->getData_SetHariLibur_byTGL($tglloop);
|
|
if ($cekLibur==TRUE) {
|
|
$weekend = 1;
|
|
$shl = $cekLibur[0]['NAMA_SHL'];
|
|
} else {
|
|
$weekend = 0;
|
|
}
|
|
}
|
|
|
|
$datAbsensi = $this->Amod->getData_Absensi_byKARYAWAN_byTGL($id_karyawan, $tglloop);
|
|
$jam_masuk = "";
|
|
$jam_keluar = "";
|
|
$lokasi = "";
|
|
$status_absensi = 9;
|
|
if ($datAbsensi==TRUE) {
|
|
$nama_sabs = $datAbsensi[0]['NAMA_SABS'];
|
|
$status_absensi = $datAbsensi[0]['STATUS_ABSENSI'];
|
|
$lokasi = $datAbsensi[0]['LOKASI_ABSENSI'];
|
|
if ($lokasi==NULL) {
|
|
$lokasi = "";
|
|
}
|
|
if ($status_absensi<=2) {
|
|
$jam_masuk = $datAbsensi[0]['JAM_MASUK'];
|
|
$jam_keluar = $datAbsensi[0]['JAM_KELUAR'];
|
|
if ($status_absensi==2) {
|
|
$totTelat++;
|
|
}
|
|
} else if ($status_absensi==3) {
|
|
$totCuti++;
|
|
} else if ($status_absensi==4) {
|
|
$totSakit++;
|
|
}
|
|
} else {
|
|
$nama_sabs = "<b style='color:Hotpink'>TIDAK MASUK</b>";
|
|
}
|
|
|
|
$data[$cekMinggu] = [
|
|
'TANGGAL' => $tglBaru,
|
|
'SEKARANG' => $tglloop,
|
|
'WEEKEND' => $weekend,
|
|
'SHL' => $shl,
|
|
'SABS' => $nama_sabs,
|
|
'STAT' => $status_absensi,
|
|
'MASUK' => $jam_masuk,
|
|
'KELUAR' => $jam_keluar,
|
|
'LOKASI' => $lokasi,
|
|
'FADE' => '0'
|
|
];
|
|
|
|
$tglloop = strtotime(date("Y-m-d", strtotime($tglloop)) . " +1 days");
|
|
$tglloop = date('Y-m-d',$tglloop);
|
|
}
|
|
|
|
//Minggu Lanjutan sampai akhir Bulan
|
|
$noawal = $no;
|
|
for ($no = $noawal; $no<=$diff+$nilaiAwal; $no++) {
|
|
$monthNew = date_format(date_create($tglloop),"m");
|
|
$monthNew = substr(($this->Amod->generate_inisialMonth($monthNew)),0,3);
|
|
$tglNew = (int) date_format(date_create($tglloop),"d");
|
|
$tglBaru = "$tglNew $monthNew";
|
|
|
|
$cekMinggu = date_format(date_create($tglloop),"w");
|
|
$shl = "Libur";
|
|
if ($cekMinggu=="0") {
|
|
$weekend = 1;
|
|
} else {
|
|
$cekLibur = $this->Amod->getData_SetHariLibur_byTGL($tglloop);
|
|
if ($cekLibur==TRUE) {
|
|
$weekend = 1;
|
|
$shl = $cekLibur[0]['NAMA_SHL'];
|
|
} else {
|
|
$weekend = 0;
|
|
}
|
|
}
|
|
|
|
$datAbsensi = $this->Amod->getData_Absensi_byKARYAWAN_byTGL($id_karyawan, $tglloop);
|
|
$jam_masuk = "";
|
|
$jam_keluar = "";
|
|
$lokasi = "";
|
|
$status_absensi = 9;
|
|
if ($datAbsensi==TRUE) {
|
|
$nama_sabs = $datAbsensi[0]['NAMA_SABS'];
|
|
$status_absensi = $datAbsensi[0]['STATUS_ABSENSI'];
|
|
$lokasi = $datAbsensi[0]['LOKASI_ABSENSI'];
|
|
if ($lokasi==NULL) {
|
|
$lokasi = "";
|
|
}
|
|
if ($status_absensi<=2) {
|
|
$jam_masuk = $datAbsensi[0]['JAM_MASUK'];
|
|
$jam_keluar = $datAbsensi[0]['JAM_KELUAR'];
|
|
if ($status_absensi==2) {
|
|
$totTelat++;
|
|
}
|
|
} else if ($status_absensi==3) {
|
|
$totCuti++;
|
|
} else if ($status_absensi==4) {
|
|
$totSakit++;
|
|
}
|
|
} else {
|
|
$nama_sabs = "<b style='color:Hotpink'>TIDAK MASUK</b>";
|
|
}
|
|
|
|
$data[$no] = [
|
|
'TANGGAL' => $tglBaru,
|
|
'SEKARANG' => $tglloop,
|
|
'WEEKEND' => $weekend,
|
|
'SHL' => $shl,
|
|
'SABS' => $nama_sabs,
|
|
'STAT' => $status_absensi,
|
|
'MASUK' => $jam_masuk,
|
|
'KELUAR' => $jam_keluar,
|
|
'LOKASI' => $lokasi,
|
|
'FADE' => '0'
|
|
];
|
|
|
|
$tglloop = strtotime(date("Y-m-d", strtotime($tglloop)) . " +1 days");
|
|
$tglloop = date('Y-m-d',$tglloop);
|
|
}
|
|
|
|
//Minggu setelah akhir Bulan
|
|
$limitAkhir = $diff+$selisih;
|
|
if ($limitAkhir>=28 AND $limitAkhir<=34) {
|
|
$totWeeks = 1;
|
|
$batas = 34;
|
|
} else if ($limitAkhir>=35) {
|
|
$totWeeks = 2;
|
|
$batas = 41;
|
|
}
|
|
|
|
$noawal = $no;
|
|
if ($totWeeks>0) {
|
|
for ($no = $noawal; $no<=$batas; $no++) {
|
|
$monthNew = date_format(date_create($tglloop),"m");
|
|
$monthNew = substr(($this->Amod->generate_inisialMonth($monthNew)),0,3);
|
|
$tglNew = (int) date_format(date_create($tglloop),"d");
|
|
$tglBaru = "$tglNew $monthNew";
|
|
|
|
$cekMinggu = date_format(date_create($tglloop),"w");
|
|
$shl = "Libur";
|
|
if ($cekMinggu=="0") {
|
|
$weekend = 1;
|
|
} else {
|
|
$cekLibur = $this->Amod->getData_SetHariLibur_byTGL($tglloop);
|
|
if ($cekLibur==TRUE) {
|
|
$weekend = 1;
|
|
$shl = $cekLibur[0]['NAMA_SHL'];
|
|
} else {
|
|
$weekend = 0;
|
|
}
|
|
}
|
|
|
|
$datAbsensi = $this->Amod->getData_Absensi_byKARYAWAN_byTGL($id_karyawan, $tglloop);
|
|
$jam_masuk = "";
|
|
$jam_keluar = "";
|
|
$lokasi = "";
|
|
$status_absensi = 9;
|
|
if ($datAbsensi==TRUE) {
|
|
$nama_sabs = $datAbsensi[0]['NAMA_SABS'];
|
|
$status_absensi = $datAbsensi[0]['STATUS_ABSENSI'];
|
|
$lokasi = $datAbsensi[0]['LOKASI_ABSENSI'];
|
|
if ($lokasi==NULL) {
|
|
$lokasi = "";
|
|
}
|
|
if ($status_absensi<=2) {
|
|
$jam_masuk = $datAbsensi[0]['JAM_MASUK'];
|
|
$jam_keluar = $datAbsensi[0]['JAM_KELUAR'];
|
|
}
|
|
} else {
|
|
$nama_sabs = "<b style='color:Hotpink'>TIDAK MASUK</b>";
|
|
}
|
|
|
|
if (strtotime($tglloop)>strtotime($tgllimit)) {
|
|
$fade = 1;
|
|
} else {
|
|
$fade = 0;
|
|
if ($status_absensi==2) {
|
|
$totTelat++;
|
|
} else if ($status_absensi==3) {
|
|
$totCuti++;
|
|
} else if ($status_absensi==4) {
|
|
$totSakit++;
|
|
}
|
|
}
|
|
|
|
$data[$no] = [
|
|
'TANGGAL' => $tglBaru,
|
|
'SEKARANG' => $tglloop,
|
|
'WEEKEND' => $weekend,
|
|
'SHL' => $shl,
|
|
'SABS' => $nama_sabs,
|
|
'STAT' => $status_absensi,
|
|
'MASUK' => $jam_masuk,
|
|
'KELUAR' => $jam_keluar,
|
|
'LOKASI' => $lokasi,
|
|
'FADE' => $fade
|
|
];
|
|
|
|
if ($cekMinggu==6) {
|
|
break;
|
|
}
|
|
|
|
$tglloop = strtotime(date("Y-m-d", strtotime($tglloop)) . " +1 days");
|
|
$tglloop = date('Y-m-d',$tglloop);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'data' => $data,
|
|
'total' => sizeof($data),
|
|
'totWeeks' => $totWeeks,
|
|
'totTelat' => $totTelat,
|
|
'totCuti' => $totCuti,
|
|
'totSakit' => $totSakit,
|
|
]);
|
|
}
|
|
|
|
public function GE_Ambil_DataAbsensiCutiOnly() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
if ($id_karyawan==53) {
|
|
$id_karyawan = 22;
|
|
}
|
|
|
|
$limitAtas = date('Y-01-01');
|
|
$limitBawah = date('Y-12-31');
|
|
|
|
$data1 = $this->Amod->getData_DaftarFormKaryawan_byKARYAWAN_byJENIS_byPERIODE($id_karyawan, 5, $limitAtas, $limitBawah);
|
|
$data2 = $this->Amod->getData_SetHariLibur_byJENIS_byPERIODE(2, $limitAtas, $limitBawah);
|
|
|
|
$this->output_json([
|
|
'data1' => $data1,
|
|
'data2' => $data2,
|
|
'total1' => sizeof($data1),
|
|
'total2' => sizeof($data2),
|
|
]);
|
|
}
|
|
|
|
public function GE_Ambil_DataAbsensiIzinOnly() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$month = (int) date('m');
|
|
if ($month<=6) {
|
|
$limitAtas = date('Y-01-01');
|
|
$limitBawah = date('Y-06-30');
|
|
} else if ($month>6) {
|
|
$limitAtas = date('Y-07-01');
|
|
$limitBawah = date('Y-12-31');
|
|
}
|
|
|
|
$data = $this->Amod->getData_DaftarFormKaryawan_byKARYAWAN_byJENIS_byPERIODE($id_karyawan, 7, $limitAtas, $limitBawah);
|
|
|
|
$this->output_json([
|
|
'data' => $data,
|
|
'total' => sizeof($data),
|
|
]);
|
|
}
|
|
|
|
public function GE_Ambil_DataAbsensiStatusOnly() {
|
|
$status = $this->input->post('status');
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$now = date('Y-m-d');
|
|
$datPab = $this->Amod->getData_PeriodeAbsensi_byTGL($now);
|
|
$limitAtas = $datPab[0]['AWAL_PAB'];
|
|
$limitBawah = $datPab[0]['AKHIR_PAB'];
|
|
|
|
if ($id_karyawan==53) {
|
|
$id_karyawan = 22;
|
|
}
|
|
if ($status==2) {
|
|
$data = $this->Amod->getData_Absensi_byKARYAWAN_bySTATUS_byPERIODE($id_karyawan, $status, $limitAtas, $limitBawah);
|
|
} else if ($status==3) {
|
|
if ($limitAtas=="2025-12-26") {
|
|
$limitAtas = "2026-01-01";
|
|
}
|
|
$data = $this->Amod->getData_DaftarFormKaryawan_byKARYAWAN_byJENIS_byPERIODE($id_karyawan, 5, $limitAtas, $limitBawah);
|
|
}
|
|
|
|
$this->output_json([
|
|
'data' => $data,
|
|
'total' => sizeof($data),
|
|
]);
|
|
}
|
|
|
|
public function GE_Ambil_DataBarang() { // Validasi
|
|
$verse = $this->input->post('verse');
|
|
$search = $this->input->post('search');
|
|
$mode = $this->input->post('mode');
|
|
$tipe = $this->input->post('tipe');
|
|
$id_barang = $this->input->post('id_barang');
|
|
|
|
if ($verse==1) { // Ambil Barang sesuai dengan Mode yang dibutuhkan
|
|
if ($mode==1) {
|
|
$tipe = NULL;
|
|
}
|
|
$data = $this->Amod->getData_Barang_bySEARCH_byMODE_status1_limit20($search, $mode, $tipe);
|
|
} else if ($verse==2) { // Ambil Barang spesifik sesuai ID
|
|
$data = $this->Amod->getData_Barang_byID($id_barang);
|
|
}
|
|
|
|
$this->output_json([
|
|
'data' => $data,
|
|
]);
|
|
}
|
|
|
|
public function GE_Ambil_DataCabutan() { // Validasi
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$verse = $this->input->post('verse');
|
|
$now = date('Y-m-d');
|
|
|
|
$id_cabutan = 0;
|
|
$kode_cabutan = "";
|
|
$id_snstock = null;
|
|
$nama_snstock = "Klik pada Icon dikanan";
|
|
$data = [];
|
|
if ($verse==1) { //Ambil Data Cabutan Baru
|
|
$datCabutan = $this->Amod->getData_Cabutan_byGUDANG_bySTATUS($id_karyawan, 0);
|
|
if ($datCabutan==TRUE) {
|
|
$id_cabutan = $datCabutan[0]['ID_CABUTAN'];
|
|
$kode_cabutan = $datCabutan[0]['KODE_CABUTAN'];
|
|
$id_snstock = $datCabutan[0]['SNSTOCK_ID'];
|
|
$nama_snstock = $datCabutan[0]['NAMA_SNSTOCK'];
|
|
}
|
|
} else if ($verse==2) { // Ambil Semua Data dengan Status 1 - Tercabut
|
|
$data = $this->Amod->getData_Cabutan_bySTATUS(1);
|
|
$no = 0;
|
|
foreach ($data as $key) {
|
|
if ($key['KET_CABUTAN']==NULL) {
|
|
$datIo = $this->Amod->getData_TransaksiStock_byCABUTAN($key['ID_CABUTAN']);
|
|
$detail = "";
|
|
$nodet = 1;
|
|
foreach ($datIo as $dat) {
|
|
if ($dat['JENIS_IO']==0) {
|
|
$jenis = "KELUAR";
|
|
} else if ($dat['JENIS_IO']==1) {
|
|
$jenis = "MASUK";
|
|
}
|
|
$korang = $dat['KODE_BARANG'];
|
|
$qty = $dat['QTY_IO'];
|
|
$ket = $dat['KET_IO'];
|
|
|
|
$detail .= "<b style='color:Teal'>[$nodet]</b> <b style='color:Tomato'>$jenis</b> | <b style='color:DarkKhaki'>$qty EA $korang</b> | <b style='color:DarkSlateGray'>$ket</b><br>";
|
|
$nodet++;
|
|
}
|
|
} else {
|
|
$ket = $key['KET_CABUTAN'];
|
|
$detail = "<b style='color:Teal'>[1]</b> <b style='color:Tomato'>OPNAME</b> | <b style='color:DarkSlateGray'>$ket</b>";
|
|
}
|
|
$data[$no++] += ['DETAIL' => $detail];
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'data' => $data,
|
|
'total' => sizeof($data),
|
|
'id_cabutan' => $id_cabutan,
|
|
'kode_cabutan' => $kode_cabutan,
|
|
'id_snstock' => $id_snstock,
|
|
'nama_snstock' => $nama_snstock,
|
|
]);
|
|
}
|
|
|
|
public function GE_Ambil_DataCetakDokumen() { // Validasi
|
|
$verse = $this->input->post('verse');
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$now = date('Y-m-d');
|
|
$limit = date('Y-m-01');
|
|
|
|
if ($verse==1) { // Retur Pembelian
|
|
$data = $this->Amod->getData_CetakDokumen_byVERSE_byPERIODE($verse, $limit, $now);
|
|
}
|
|
|
|
$this->output_json([
|
|
'data' => $data,
|
|
'total' => sizeof($data),
|
|
]);
|
|
}
|
|
|
|
public function GE_Ambil_DataCorp() { // Validasi
|
|
$verse = $this->input->post('verse');
|
|
$id_corp = $this->input->post('id_corp');
|
|
|
|
if ($verse==2) { // Ambil Data Spesifik ID
|
|
$data = $this->Amod->getData_Corp_byID($id_corp);
|
|
}
|
|
|
|
$this->output_json([
|
|
'data' => $data,
|
|
'total' => sizeof($data),
|
|
]);
|
|
}
|
|
|
|
public function GE_Ambil_DataDaftarBeli() { // Validasi
|
|
$verse = $this->input->post('verse');
|
|
$id_pembelian = $this->input->post('id_pembelian');
|
|
$id_db = $this->input->post('id_db');
|
|
$limit = date('Y-m-01');
|
|
|
|
$kodePembelian = "";
|
|
$sjPembelian = "";
|
|
$alurPembelian = "";
|
|
$pengadaanPembelian = "-";
|
|
$namaSupplier = "";
|
|
$lockPengadaan = 0;
|
|
$lockUbah = 0;
|
|
$nilaiDpp = 0;
|
|
$nilaiPpn = 0;
|
|
$nilaiTotal = 0;
|
|
if ($verse==1) { // Detail Daftar Beli
|
|
$datPembelian = $this->Amod->getData_Pembelian_byID($id_pembelian);
|
|
$kodePembelian = $datPembelian[0]['KODE_PEMBELIAN'];
|
|
$sjPembelian = $datPembelian[0]['SJ_PEMBELIAN'];
|
|
$alurPembelian = $datPembelian[0]['ALUR_PEMBELIAN'];
|
|
$namaSupplier = $datPembelian[0]['NAMA_SUPPLIER'];
|
|
|
|
$cekPengadaan = $this->Amod->getData_Pengadaan_byPEMBELIAN($id_pembelian);
|
|
if ($cekPengadaan==TRUE) {
|
|
$lockPengadaan = 1;
|
|
$pengadaanPembelian = $cekPengadaan[0]['KODE_PENGADAAN'];
|
|
}
|
|
|
|
if (strtotime($datPembelian[0]['TGL_PEMBELIAN'])<strtotime($limit)) {
|
|
$lockUbah = 1;
|
|
}
|
|
|
|
$data = $this->Amod->getData_DaftarBeli_byPEMBELIAN($id_pembelian);
|
|
$no = 0;
|
|
$sn = "";
|
|
foreach ($data as $key) {
|
|
$datSnb = $this->Amod->getData_SnBeli_byDB($key['ID_DB']);
|
|
$counter = 1;
|
|
foreach ($datSnb as $dat) {
|
|
$nama_snb = $dat['NAMA_SNB'];
|
|
if ($counter==count($datSnb)) {
|
|
$sn .= "$nama_snb";
|
|
} else {
|
|
$sn .= "$nama_snb, ";
|
|
}
|
|
$counter++;
|
|
}
|
|
|
|
$data[$no] += ['REAL' => count($datSnb)];
|
|
$data[$no++] += ['SN' => $sn];
|
|
|
|
$sn = "";
|
|
|
|
$nilaiDpp = $nilaiDpp+round(($key['HARGA_DB']*$key['QTY_DB']),2);
|
|
$nilaiPpn = $nilaiPpn+round(($key['HARGA_DB']*$key['QTY_DB']*($key['PPN_PEMBELIAN']/100)),2);
|
|
$nilaiTotal = $nilaiTotal+round(($key['HARGA_DB']*$key['QTY_DB']*(($key['PPN_PEMBELIAN']+100)/100)),2);
|
|
}
|
|
} else if ($verse==2) { // Ambil Data Spesifik ID
|
|
$data = $this->Amod->getData_DaftarBeli_byID($id_db);
|
|
} else if ($verse==3) { // Ambil Data untuk Retur Pembelian
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
|
|
$datRb = $this->Amod->getData_ReturPembelian_byKARYAWAN_statusNull($id_karyawan);
|
|
if ($datRb==TRUE) {
|
|
$id_rb = $datRb[0]['ID_RB'];
|
|
} else {
|
|
$id_rb = NULL;
|
|
}
|
|
|
|
$data = $this->Amod->getData_DaftarBeli_byPEMBELIAN_kembaliNotFull($id_pembelian);
|
|
$no = 0;
|
|
foreach ($data as $key) {
|
|
$datDrb = $this->Amod->getData_DaftarReturBeli_byRB_byBARANG($id_rb, $key['BARANG_ID']);
|
|
if ($datDrb==TRUE) {
|
|
$lock = 1;
|
|
} else {
|
|
$lock = 0;
|
|
}
|
|
$data[$no++] += ['LOCK' => $lock];
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'total' => sizeof($data),
|
|
'data' => $data,
|
|
'alurPembelian' => $alurPembelian,
|
|
'kodePembelian' => $kodePembelian,
|
|
'sjPembelian' => $sjPembelian,
|
|
'pengadaanPembelian' => $pengadaanPembelian,
|
|
'lockUbah' => $lockUbah,
|
|
'lockPengadaan' => $lockPengadaan,
|
|
'namaSupplier' => $namaSupplier,
|
|
'nilaiDpp' => number_format($nilaiDpp, 2),
|
|
'nilaiPpn' => number_format($nilaiPpn, 2),
|
|
'nilaiTotal' => number_format($nilaiTotal, 2),
|
|
]);
|
|
}
|
|
|
|
public function GE_Ambil_DataDaftarFormKaryawan() {
|
|
$id_fk = $this->input->post('id_fk');
|
|
|
|
if ($id_fk=="") {
|
|
$data = [];
|
|
$kode_fk = "";
|
|
$nama_kar = "";
|
|
$nilai = 0;
|
|
} else {
|
|
$data = $this->Amod->getData_DaftarFormKaryawan_byFK($id_fk);
|
|
$datFk = $this->Amod->getData_FormKaryawan_byID($id_fk);
|
|
$kode_fk = $datFk[0]['KODE_FK'];
|
|
$nama_kar = $datFk[0]['NAKAR'];
|
|
$nilai = $datFk[0]['NILAI'];
|
|
}
|
|
|
|
$this->output_json([
|
|
'total' => sizeof($data),
|
|
'data' => $data,
|
|
'kode_fk' => $kode_fk,
|
|
'namaKar' => $nama_kar,
|
|
'totalFk' => $nilai,
|
|
]);
|
|
}
|
|
|
|
public function GE_Ambil_DataDaftarKpi() { // Validasi
|
|
$verse = $this->input->post('verse');
|
|
$id_pum = $this->input->post('id_pum');
|
|
$id_divisi = $this->input->post('id_divisi');
|
|
$id_sales = $this->input->post('id_sales');
|
|
$id_dkpi = $this->input->post('id_dkpi');
|
|
|
|
$totalBobot = 0;
|
|
$totalNilai = 0;
|
|
if ($verse==1) { // Ambil Detail semua data sesuai yang di Pilih
|
|
if ($id_sales=="Tim ICT") {
|
|
$id_tim = 1;
|
|
} else {
|
|
$id_tim = 0;
|
|
}
|
|
if ($id_tim==0) {
|
|
$datSales = $this->Amod->getData_Karyawan_byID($id_sales);
|
|
$nama_panggilan = $datSales[0]['NAMA_PANGGILAN_KARYAWAN'];
|
|
$data = $this->Amod->getData_DaftarKpi_byDIVISI_byPUM_byKARYAWAN_orderURUTAN($id_divisi, $id_pum, $id_sales);
|
|
} else {
|
|
$datTim = $this->Amod->getData_Tim_byID($id_tim);
|
|
$nama_panggilan = $datTim[0]['NAMA_TIM'];
|
|
$data = $this->Amod->getData_DaftarKpi_byDIVISI_byPUM_byTIM_orderURUTAN($id_divisi, $id_pum, $id_tim);
|
|
}
|
|
$no = 0;
|
|
foreach ($data as $key) {
|
|
$pencapaian = 0;
|
|
$presentase = 0;
|
|
$nilai = 0;
|
|
if ($key['KPI_ID']==1) {
|
|
$datKaryawan = $this->Amod->getData_Karyawan_byDIVISI_byKADIV(1, $id_sales);
|
|
foreach ($datKaryawan as $dat) {
|
|
$sumHhpda = $this->Amod->getSum_HasilHitungPda_byKARYAWAN_byAWAL_byAKHIR_status1($dat['ID_KARYAWAN'], $key['AWAL_PUM'], $key['AKHIR_PUM']);
|
|
if ($sumHhpda==FALSE OR $sumHhpda[0]['TOTAL']==NULL) {
|
|
$omzet = 0;
|
|
} else {
|
|
$omzet = round($sumHhpda[0]['TOTAL'],2);
|
|
}
|
|
$sumDrj = $this->Amod->getSum_DaftarReturJual_byKARYAWAN_byAWAL_byAKHIR_status1($dat['ID_KARYAWAN'], $key['AWAL_PUM'], $key['AKHIR_PUM']);
|
|
if ($sumDrj==FALSE OR $sumDrj[0]['TOTAL']==NULL) {
|
|
$retur = 0;
|
|
} else {
|
|
$retur = round($sumDrj[0]['TOTAL'],2);
|
|
}
|
|
$pencapaian = $pencapaian+$omzet-$retur;
|
|
}
|
|
$presentase = round(($pencapaian/$key['TARGET_DKPI'])*100, 0);
|
|
$kpi = (($presentase/100)*$key['BOBOT_DKPI']);
|
|
$totalNilai = $totalNilai+round($kpi,0);
|
|
$nilai = number_format($kpi, 0);
|
|
$pencapaian = number_format($pencapaian, 2);
|
|
} else if ($key['KPI_ID']==2) {
|
|
$datKaryawan = $this->Amod->getData_Karyawan_byDIVISI_byKADIV(1, $id_sales);
|
|
$score = 0;
|
|
$totalAnggota = 0;
|
|
foreach ($datKaryawan as $dat) {
|
|
if ($dat['ID_KARYAWAN']!=$dat['ANGGOTA_KARYAWAN']) {
|
|
$datDkpi = $this->Amod->getData_DaftarKpi_byDIVISI_byPUM_byKARYAWAN_orderURUTAN($id_divisi, $id_pum, $dat['ID_KARYAWAN']);
|
|
if ($datDkpi==TRUE) {
|
|
$totalAnggota++;
|
|
}
|
|
foreach ($datDkpi as $keydat) {
|
|
if ($keydat['KPI_ID']==3) {
|
|
$sumHhpda = $this->Amod->getSum_HasilHitungPda_byKARYAWAN_byAWAL_byAKHIR_status1($dat['ID_KARYAWAN'], $key['AWAL_PUM'], $key['AKHIR_PUM']);
|
|
if ($sumHhpda==FALSE OR $sumHhpda[0]['TOTAL']==NULL) {
|
|
$omzet = 0;
|
|
} else {
|
|
$omzet = round($sumHhpda[0]['TOTAL'],2);
|
|
}
|
|
$sumDrj = $this->Amod->getSum_DaftarReturJual_byKARYAWAN_byAWAL_byAKHIR_status1($dat['ID_KARYAWAN'], $key['AWAL_PUM'], $key['AKHIR_PUM']);
|
|
if ($sumDrj==FALSE OR $sumDrj[0]['TOTAL']==NULL) {
|
|
$retur = 0;
|
|
} else {
|
|
$retur = round($sumDrj[0]['TOTAL'],2);
|
|
}
|
|
$score = $score+round((($omzet-$retur)/$keydat['TARGET_DKPI']*$keydat['BOBOT_DKPI']), 0);
|
|
} else if ($keydat['KPI_ID']==4) {
|
|
$datPenawaran = $this->Amod->getData_Penawaran_byPERIODE_statusAktif($key['AWAL_PUM'], $key['AKHIR_PUM'], NULL);
|
|
$penawaran = 0;
|
|
foreach ($datPenawaran as $datkey) {
|
|
$listSales = explode(',', $datkey['SALES_PENAWARAN']);
|
|
foreach ($listSales as $keydut) {
|
|
$dataKaryawan = $this->Amod->getData_Karyawan_byID($keydut);
|
|
if ($dataKaryawan[0]['NAMA_PANGGILAN_KARYAWAN']==$dat['NAMA_PANGGILAN_KARYAWAN']) {
|
|
if ($dataKaryawan[0]['NAMA_JABATAN']=="SALES CHANNEL") {
|
|
$nilai_penawaran = $datkey['NILAI_PENAWARAN'];
|
|
} else if (sizeof($listSales)==1) {
|
|
$nilai_penawaran = $datkey['NILAI_PENAWARAN'];
|
|
} else {
|
|
$sumDpne = $this->Amod->getSum_DaftarPenawaran_byPENAWARAN_byVERSI_bySALES($datkey['ID_PENAWARAN'], $datkey['AKTIF_PENAWARAN'], $dat['ID_KARYAWAN']);
|
|
if ($sumDpne==FALSE OR $sumDpne[0]['TOTAL']==NULL) {
|
|
$nilai_penawaran = 0;
|
|
} else {
|
|
$nilai_penawaran = $sumDpne[0]['TOTAL'];
|
|
}
|
|
}
|
|
|
|
$penawaran = $penawaran+round($nilai_penawaran,2);
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
$score = $score+round(($penawaran/$keydat['TARGET_DKPI']*$keydat['BOBOT_DKPI']), 0);
|
|
} else if ($keydat['KPI_ID']==5) {
|
|
$datKunjungan = $this->Amod->getData_Kunjungan_byPERIODE_statusNot9($key['AWAL_PUM'], $key['AKHIR_PUM'], NULL);
|
|
$visit = 0;
|
|
foreach ($datKunjungan as $datkey) {
|
|
$listSales = explode(',', $datkey['SALES_KUNJUNGAN']);
|
|
foreach ($listSales as $keydut) {
|
|
if ($keydut==$dat['ID_KARYAWAN']) {
|
|
$visit++;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
$score = $score+round(($visit/$keydat['TARGET_DKPI']*$keydat['BOBOT_DKPI']), 0);
|
|
} else if ($keydat['KPI_ID']==6) {
|
|
$datDpc = $this->Amod->getData_DaftarPromoClearance_bySALES_byAWAL_byAKHIR_byJENIS($dat['ID_KARYAWAN'], $key['AWAL_PUM'], $key['AKHIR_PUM'], 3);
|
|
$omzet = 0;
|
|
foreach ($datDpc as $datkey) {
|
|
$nilaiSo = round(($datkey['QTY_DO']*$datkey['HARGA_DO'])*(($datkey['PPN_SO']+100)/100),2);
|
|
$omzet = $omzet+$nilaiSo;
|
|
}
|
|
$score = $score+round(($omzet/$keydat['TARGET_DKPI']*$keydat['BOBOT_DKPI']), 0);
|
|
} else if ($keydat['KPI_ID']==7) {
|
|
$datDpc = $this->Amod->getData_DaftarPromoClearance_bySALES_byAWAL_byAKHIR_byJENIS($dat['ID_KARYAWAN'], $key['AWAL_PUM'], $key['AKHIR_PUM'], 2);
|
|
$omzet = 0;
|
|
foreach ($datDpc as $datkey) {
|
|
$nilaiSo = round(($datkey['QTY_DO']*$datkey['HARGA_DO'])*(($datkey['PPN_SO']+100)/100),2);
|
|
$omzet = $omzet+$nilaiSo;
|
|
}
|
|
$score = $score+round(($omzet/$keydat['TARGET_DKPI']*$keydat['BOBOT_DKPI']), 0);
|
|
} else if ($keydat['KPI_ID']==8) {
|
|
$datProyek = $this->Amod->getSum_Proyek_bySALES_byPERIODE_status12($dat['ID_KARYAWAN'], $key['AWAL_PUM'], $key['AKHIR_PUM']);
|
|
if ($datProyek==FALSE OR $datProyek[0]['GP']==NULL) {
|
|
$omzet = 0;
|
|
} else {
|
|
$omzet = $datProyek[0]['GP'];
|
|
}
|
|
$score = $score+round(($omzet/$keydat['TARGET_DKPI']*$keydat['BOBOT_DKPI']), 0);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
$pencapaian = round(($score/$totalAnggota), 0);
|
|
$presentase = round(($pencapaian/$key['TARGET_DKPI'])*100, 0);
|
|
$kpi = (($presentase/100)*$key['BOBOT_DKPI']);
|
|
$totalNilai = $totalNilai+round($kpi,0);
|
|
$nilai = number_format($kpi, 0);
|
|
} else if ($key['KPI_ID']==3) {
|
|
$sumHhpda = $this->Amod->getSum_HasilHitungPda_byKARYAWAN_byAWAL_byAKHIR_status1($id_sales, $key['AWAL_PUM'], $key['AKHIR_PUM']);
|
|
if ($sumHhpda==FALSE OR $sumHhpda[0]['TOTAL']==NULL) {
|
|
$omzet = 0;
|
|
} else {
|
|
$omzet = round($sumHhpda[0]['TOTAL'],2);
|
|
}
|
|
|
|
$sumDrj = $this->Amod->getSum_DaftarReturJual_byKARYAWAN_byAWAL_byAKHIR_status1($id_sales, $key['AWAL_PUM'], $key['AKHIR_PUM']);
|
|
if ($sumDrj==FALSE OR $sumDrj[0]['TOTAL']==NULL) {
|
|
$retur = 0;
|
|
} else {
|
|
$retur = round($sumDrj[0]['TOTAL'],2);
|
|
}
|
|
|
|
$pencapaian = number_format(($omzet-$retur), 2);
|
|
$presentase = round((($omzet-$retur)/$key['TARGET_DKPI'])*100, 0);
|
|
$kpi = (($presentase/100)*$key['BOBOT_DKPI']);
|
|
$totalNilai = $totalNilai+round($kpi,0);
|
|
$nilai = number_format($kpi, 0);
|
|
} else if ($key['KPI_ID']==4) {
|
|
$datPenawaran = $this->Amod->getData_Penawaran_byPERIODE_statusAktif($key['AWAL_PUM'], $key['AKHIR_PUM'], NULL);
|
|
foreach ($datPenawaran as $dat) {
|
|
$listSales = explode(',', $dat['SALES_PENAWARAN']);
|
|
foreach ($listSales as $keydat) {
|
|
$datKaryawan = $this->Amod->getData_Karyawan_byID($keydat);
|
|
if ($datKaryawan[0]['NAMA_PANGGILAN_KARYAWAN']==$nama_panggilan) {
|
|
if ($datKaryawan[0]['NAMA_JABATAN']=="SALES CHANNEL") {
|
|
$nilai_penawaran = $dat['NILAI_PENAWARAN'];
|
|
} else if (sizeof($listSales)==1) {
|
|
$nilai_penawaran = $dat['NILAI_PENAWARAN'];
|
|
} else {
|
|
$sumDpne = $this->Amod->getSum_DaftarPenawaran_byPENAWARAN_byVERSI_bySALES($dat['ID_PENAWARAN'], $dat['AKTIF_PENAWARAN'], $id_sales);
|
|
if ($sumDpne==FALSE OR $sumDpne[0]['TOTAL']==NULL) {
|
|
$nilai_penawaran = 0;
|
|
} else {
|
|
$nilai_penawaran = $sumDpne[0]['TOTAL'];
|
|
}
|
|
}
|
|
|
|
$pencapaian = $pencapaian+round($nilai_penawaran,2);
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
$presentase = round(($pencapaian/$key['TARGET_DKPI'])*100, 0);
|
|
$kpi = (($presentase/100)*$key['BOBOT_DKPI']);
|
|
$totalNilai = $totalNilai+round($kpi,0);
|
|
$pencapaian = number_format($pencapaian, 2);
|
|
$nilai = number_format($kpi, 0);
|
|
} else if ($key['KPI_ID']==5) {
|
|
$datKunjungan = $this->Amod->getData_Kunjungan_byPERIODE_statusNot9($key['AWAL_PUM'], $key['AKHIR_PUM'], NULL);
|
|
foreach ($datKunjungan as $dat) {
|
|
$listSales = explode(',', $dat['SALES_KUNJUNGAN']);
|
|
foreach ($listSales as $keydat) {
|
|
if ($keydat==$id_sales) {
|
|
$pencapaian++;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
$presentase = round(($pencapaian/$key['TARGET_DKPI'])*100, 0);
|
|
$kpi = (($presentase/100)*$key['BOBOT_DKPI']);
|
|
$totalNilai = $totalNilai+round($kpi,0);
|
|
$nilai = number_format($kpi, 0);
|
|
} else if ($key['KPI_ID']==6) {
|
|
$datDpcAio = $this->Amod->getData_DaftarPromoClearance_bySALES_byAWAL_byAKHIR_byJENIS($id_sales, $key['AWAL_PUM'], $key['AKHIR_PUM'], 3);
|
|
foreach ($datDpcAio as $dat) {
|
|
$nilaiSo = round(($dat['QTY_DO']*$dat['HARGA_DO'])*(($dat['PPN_SO']+100)/100),2);
|
|
$pencapaian = $pencapaian+$nilaiSo;
|
|
}
|
|
$presentase = round(($pencapaian/$key['TARGET_DKPI'])*100, 0);
|
|
$kpi = (($presentase/100)*$key['BOBOT_DKPI']);
|
|
$totalNilai = $totalNilai+round($kpi,0);
|
|
$pencapaian = number_format($pencapaian, 2);
|
|
$nilai = number_format($kpi, 0);
|
|
} else if ($key['KPI_ID']==7) {
|
|
$datDpcNb = $this->Amod->getData_DaftarPromoClearance_bySALES_byAWAL_byAKHIR_byJENIS($id_sales, $key['AWAL_PUM'], $key['AKHIR_PUM'], 2);
|
|
foreach ($datDpcNb as $dat) {
|
|
$nilaiSo = round(($dat['QTY_DO']*$dat['HARGA_DO'])*(($dat['PPN_SO']+100)/100),2);
|
|
$pencapaian = $pencapaian+$nilaiSo;
|
|
}
|
|
$presentase = round(($pencapaian/$key['TARGET_DKPI'])*100, 0);
|
|
$kpi = (($presentase/100)*$key['BOBOT_DKPI']);
|
|
$totalNilai = $totalNilai+round($kpi,0);
|
|
$pencapaian = number_format($pencapaian, 2);
|
|
$nilai = number_format($kpi, 0);
|
|
} else if ($key['KPI_ID']==8) {
|
|
$datProyek = $this->Amod->getSum_Proyek_bySALES_byPERIODE_status12($id_sales, $key['AWAL_PUM'], $key['AKHIR_PUM']);
|
|
if ($datProyek==FALSE OR $datProyek[0]['GP']==NULL) {
|
|
$pencapaian = 0;
|
|
} else {
|
|
$pencapaian = $datProyek[0]['GP'];
|
|
}
|
|
$presentase = round(($pencapaian/$key['TARGET_DKPI'])*100, 0);
|
|
$kpi = (($presentase/100)*$key['BOBOT_DKPI']);
|
|
$totalNilai = $totalNilai+round($kpi,0);
|
|
$pencapaian = number_format($pencapaian, 2);
|
|
$nilai = number_format($kpi, 0);
|
|
}
|
|
|
|
$totalBobot = $totalBobot+$key['BOBOT_DKPI'];
|
|
|
|
$data[$no] += ['NILAI' => $nilai];
|
|
$data[$no] += ['PRESENTASE' => $presentase];
|
|
$data[$no++] += ['PENCAPAIAN' => $pencapaian];
|
|
}
|
|
} else if ($verse==2) { // Ambil Data spesifik 1 ID saja
|
|
$data = $this->Amod->getData_DaftarKpi_byID($id_dkpi);
|
|
}
|
|
|
|
$this->output_json([
|
|
'total' => sizeof($data),
|
|
'data' => $data,
|
|
'totalBobot' => $totalBobot,
|
|
'totalNilai' => $totalNilai,
|
|
]);
|
|
}
|
|
|
|
public function GE_Ambil_DataDaftarOrder() {
|
|
$verse = $this->input->post('verse');
|
|
$id_so = $this->input->post('id_so');
|
|
$id_do = $this->input->post('id_do');
|
|
|
|
// verse 1 - Ambil Daftar Order secara Umum
|
|
|
|
$datSo = $this->Amod->getData_SalesOrder_byID($id_so);
|
|
$kop = $this->Amod->getData_Kop_byID($datSo[0]['CORP_ID']);
|
|
|
|
if ($datSo[0]['GUDANG_SO']==0) {
|
|
$gudang_so = "OPNAME";
|
|
} else if ($datSo[0]['GUDANG_SO']==1) {
|
|
$gudang_so = "PC MASTER";
|
|
} else if ($datSo[0]['GUDANG_SO']==2) {
|
|
$gudang_so = "IT POINT";
|
|
} else if ($datSo[0]['GUDANG_SO']==3) {
|
|
$gudang_so = "SERVICE";
|
|
}
|
|
|
|
if ($datSo[0]['GP_SO']==0) {
|
|
$gp = "Non-GP";
|
|
} else if ($datSo[0]['GP_SO']==1) {
|
|
$gp = "GP";
|
|
}
|
|
|
|
if ($verse==1 OR $verse==2) {
|
|
$data = $this->Amod->getData_DaftarOrder_bySO($id_so);
|
|
} else if ($verse==3) {
|
|
$data = $this->Amod->getData_DaftarOrder_byID($id_do);
|
|
}
|
|
$no = 0;
|
|
$sn = "";
|
|
foreach ($data as $key) {
|
|
$datSnj = $this->Amod->getData_SnJual_byDO($key['ID_DO']);
|
|
foreach ($datSnj as $dat) {
|
|
$nama_snj = $dat['NAMA_SNJ'];
|
|
$sn .= "$nama_snj, ";
|
|
}
|
|
|
|
$countSnj = $this->Amod->getCount_SnJual_byDO($key['ID_DO']);
|
|
|
|
$satuan = $key['HARGA_DO'];
|
|
$subtotal = $key['HARGA_DO']*$key['QTY_DO'];
|
|
|
|
$data[$no] += ['COUNT' => $countSnj];
|
|
$data[$no] += ['SN' => $sn];
|
|
$data[$no] += ['SATUAN' => number_format($satuan,2)];
|
|
$data[$no++] += ['SUBTOTAL' => number_format($subtotal,2)];
|
|
|
|
$sn = "";
|
|
}
|
|
|
|
$sumDo = $this->Amod->getSum_DaftarOrder_bySO($id_so);
|
|
if ($sumDo[0]['TOTAL']==NULL) {
|
|
$dppDo = 0;
|
|
$ppnDo = 0;
|
|
$totDo = 0;
|
|
} else {
|
|
$dppDo = round($sumDo[0]['TOTAL'],2);
|
|
$ppnDo = round(($sumDo[0]['TOTAL']*($datSo[0]['PPN_SO']/100)),2);
|
|
$totDo = round(($dppDo+$ppnDo),2);
|
|
}
|
|
|
|
$sumHhpda = $this->Amod->getSum_HasilHitungPda_byPELANGGAN($datSo[0]['PELANGGAN_ID']);
|
|
if ($sumHhpda==FALSE) {
|
|
$debet_pda = 0;
|
|
$kredit_pda = 0;
|
|
} else {
|
|
$debet_pda = $sumHhpda[0]['DEBET'];
|
|
$kredit_pda = $sumHhpda[0]['KREDIT'];
|
|
}
|
|
|
|
$sumDoAktif = $this->Amod->getSum_DaftarOrder_byPELANGGAN_status0_2_3($datSo[0]['PELANGGAN_ID'], $id_so);
|
|
if ($sumDoAktif[0]['TOTAL']==NULL) {
|
|
$doAktif = 0;
|
|
} else {
|
|
$doAktif = round($sumDoAktif[0]['TOTAL']);
|
|
}
|
|
|
|
$limit = $datSo[0]['LIMIT_PELANGGAN']-$totDo-$doAktif-$debet_pda+$kredit_pda;
|
|
if ($verse==2) {
|
|
$datPenjualan = $this->Amod->getData_Penjualan_bySO($id_so);
|
|
$sj_penjualan = $datPenjualan[0]['SJ_PENJUALAN'];
|
|
$inv_penjualan = $datPenjualan[0]['INV_PENJUALAN'];
|
|
$fp_penjualan = $datPenjualan[0]['FP_PENJUALAN'];
|
|
$tt_penjualan = $datPenjualan[0]['TT_PENJUALAN'];
|
|
$tgl_penjualan = $datPenjualan[0]['TGL_PENJUALAN'];
|
|
$tempo_penjualan = $datPenjualan[0]['TEMPO_PENJUALAN'];
|
|
$status_penjualan = $datPenjualan[0]['STATUS_PENJUALAN'];
|
|
$ket_batal = $datPenjualan[0]['KET_BATAL'];
|
|
$tgl_batal = $datPenjualan[0]['TGL_BATAL'];
|
|
|
|
$datQc = $this->Amod->getData_QualityControl_bySO($id_so);
|
|
$qc = "";
|
|
$noqc = 1;
|
|
foreach ($datQc as $key) {
|
|
$panggilan = $key['NAMA_PANGGILAN_KARYAWAN'];
|
|
if ($noqc==count($datQc)) {
|
|
$qc .= "$panggilan";
|
|
} else {
|
|
$qc .= "$panggilan, ";
|
|
$noqc++;
|
|
}
|
|
}
|
|
|
|
$datJp = $this->Amod->getData_JadwalPengiriman_bySO($id_so);
|
|
$jp = "";
|
|
$nojp = 1;
|
|
foreach ($datJp as $key) {
|
|
$panggilan = $key['NAMA_PANGGILAN_KARYAWAN'];
|
|
if ($nojp==count($datJp)) {
|
|
$jp .= "$panggilan";
|
|
} else {
|
|
$jp .= "$panggilan, ";
|
|
$nojp++;
|
|
}
|
|
}
|
|
|
|
$datSpr = $this->Amod->getData_SoProyek_bySO($id_so);
|
|
if ($datSpr==FALSE) {
|
|
$spr = "";
|
|
$id_proyek = 0;
|
|
$jenis_proyek = 0;
|
|
} else {
|
|
$spr = $datSpr[0]['KODE_PROYEK'];
|
|
$id_proyek = $datSpr[0]['ID_PROYEK'];
|
|
$jenis_proyek = $datSpr[0]['JENIS_PROYEK'];
|
|
}
|
|
} else {
|
|
$sj_penjualan = "";
|
|
$inv_penjualan = "";
|
|
$fp_penjualan = "";
|
|
$tt_penjualan = "";
|
|
$tgl_penjualan = "";
|
|
$tempo_penjualan = "";
|
|
$status_penjualan = "";
|
|
$ket_batal = "";
|
|
$tgl_batal = "";
|
|
$qc = "";
|
|
$jp = "";
|
|
$spr = "";
|
|
$id_proyek = "";
|
|
$jenis_proyek = "";
|
|
}
|
|
|
|
if ($datSo[0]['FILEPO_SO']==NULL OR $datSo[0]['FILEPO_SO']=="") {
|
|
$ekstensi = "";
|
|
} else {
|
|
$ekstensi = pathinfo($datSo[0]['FILEPO_SO'], PATHINFO_EXTENSION);
|
|
}
|
|
|
|
$this->output_json([
|
|
'total' => sizeof($data),
|
|
'data' => $data,
|
|
'kop' => $kop,
|
|
'qc' => $qc,
|
|
'jp' => $jp,
|
|
'spr' => $spr,
|
|
'id_proyek' => $id_proyek,
|
|
'jenis_proyek' => $jenis_proyek,
|
|
'alias_corp' => $datSo[0]['ALIAS_CORP'],
|
|
'alur_so' => $datSo[0]['ALUR_SO'],
|
|
'nama_pelanggan' => $datSo[0]['NAMA_PELANGGAN'],
|
|
'kode_so' => $datSo[0]['KODE_SO'],
|
|
'id_pelanggan' => $datSo[0]['PELANGGAN_ID'],
|
|
'tgl_so' => $datSo[0]['TGL_SO'],
|
|
'po_so' => $datSo[0]['PO_SO'],
|
|
'ppn_so' => $datSo[0]['PPN_SO'],
|
|
'ket_so_o' => $datSo[0]['KET_SO_O'],
|
|
'ket_so_g' => $datSo[0]['KET_SO_G'],
|
|
'ket_so_k' => $datSo[0]['KET_SO_K'],
|
|
'ket_so_t' => $datSo[0]['KET_SO_T'],
|
|
'ket_so_p' => $datSo[0]['KET_SO_P'],
|
|
'ket_so_all' => $datSo[0]['KET_SO_ALL'],
|
|
'status_so' => $datSo[0]['STATUS_SO'],
|
|
'nama_sales' => $datSo[0]['NAMA_PANGGILAN_KARYAWAN'],
|
|
'gudang_so' => $gudang_so,
|
|
'ekstensi' => $ekstensi,
|
|
'sj_penjualan' => $sj_penjualan,
|
|
'inv_penjualan' => $inv_penjualan,
|
|
'fp_penjualan' => $fp_penjualan,
|
|
'tt_penjualan' => $tt_penjualan,
|
|
'tgl_penjualan' => $tgl_penjualan,
|
|
'tempo_penjualan' => $tempo_penjualan,
|
|
'status_penjualan' => $status_penjualan,
|
|
'ket_batal' => $ket_batal,
|
|
'tgl_batal' => $tgl_batal,
|
|
'gp' => $gp,
|
|
'limitPel' => number_format($limit,2),
|
|
'dppDo' => number_format($dppDo,2),
|
|
'ppnDo' => number_format($ppnDo,2),
|
|
'totDo' => number_format($totDo,2),
|
|
]);
|
|
}
|
|
|
|
public function GE_Ambil_DataDaftarOtomasiBooster() {
|
|
$id_ob = $this->input->post('id_ob');
|
|
|
|
$data = $this->Amod->getData_DaftarOtomasiBooster_byOB($id_ob);
|
|
$datOb = $this->Amod->getData_OtomasiBooster_byID_bySTATUS($id_ob, 0);
|
|
|
|
$this->output_json([
|
|
'total' => sizeof($data),
|
|
'data' => $data,
|
|
'namaPromo' => $datOb[0]['NAMA_PKPR'],
|
|
]);
|
|
}
|
|
|
|
public function GE_Ambil_DataDaftarPenawaran() { // Validasi
|
|
$verse = $this->input->post('verse');
|
|
$id_penawaran = $this->input->post('id_penawaran');
|
|
$id_dpne = $this->input->post('id_dpne');
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
|
|
$dppDpne = 0;
|
|
$ppnDpne = 0;
|
|
$totDpne = 0;
|
|
$kode_penawaran = "";
|
|
$jenis_penawaran = "";
|
|
$listOther = [];
|
|
|
|
if ($verse==1) { // Buat Data Penawaran
|
|
$datPenawaran = $this->Amod->getData_Penawaran_byKARYAWAN_bySTATUS($id_karyawan, 0);
|
|
if ($datPenawaran==TRUE) {
|
|
$id_penawaran = $datPenawaran[0]['ID_PENAWARAN'];
|
|
$jenis_penawaran = $datPenawaran[0]['JENIS_PENAWARAN'];
|
|
} else {
|
|
$id_penawaran = NULL;
|
|
}
|
|
} else if ($verse==2 OR $verse==4) { // Lihat Data Existing
|
|
$datPenawaran = $this->Amod->getData_Penawaran_byID_bySTATUS($id_penawaran, 1);
|
|
$kode_penawaran = $datPenawaran[0]['KODE_PENAWARAN'];
|
|
$jenis_penawaran = $datPenawaran[0]['JENIS_PENAWARAN'];
|
|
if ($verse==4) {
|
|
$sales_penawaran = $datPenawaran[0]['SALES_PENAWARAN'];
|
|
$listSales = explode(',', $sales_penawaran);
|
|
$notim = 0;
|
|
foreach ($listSales as $key) {
|
|
$datKaryawan = $this->Amod->getData_Karyawan_byID($key);
|
|
if ($datKaryawan[0]['NAMA_JABATAN']!="SALES CHANNEL") {
|
|
if ($datKaryawan[0]['NAMA_PANGGILAN_KARYAWAN']!="Anton") {
|
|
$listOther[$notim++] = [
|
|
'ID_KARYAWAN' => $key,
|
|
'NAMA_PANGGILAN_KARYAWAN' => $datKaryawan[0]['NAMA_PANGGILAN_KARYAWAN']
|
|
];
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} else if ($verse==3) { // Cetak Dokumen Penawaran
|
|
$id_cd = $this->input->post('id_cd');
|
|
$datCd = $this->Amod->getData_CetakDokumen_byID($id_cd);
|
|
|
|
$datPenawaran = $this->Amod->getData_Penawaran_byID($id_penawaran);
|
|
$urutan = $this->Amod->generate_textUrutan($datCd[0]['SJ_INV']);
|
|
$jenis_penawaran = $datCd[0]['STATUS_CD'];
|
|
$kode_penawaran = $datPenawaran[0]['KODE_PENAWARAN'];
|
|
$kode_penawaran = "$kode_penawaran - Versi $urutan";
|
|
}
|
|
|
|
if ($id_penawaran==NULL) {
|
|
$ppn_penawaran = '0.00';
|
|
if ($verse==5) {
|
|
$data = $this->Amod->getData_DaftarPenawaran_byID($id_dpne);
|
|
} else {
|
|
$data = [];
|
|
}
|
|
} else {
|
|
$datPenawaran = $this->Amod->getData_Penawaran_byID($id_penawaran);
|
|
$ppn_penawaran = $datPenawaran[0]['PPN_PENAWARAN'];
|
|
|
|
if ($verse==1 OR $verse==2 OR $verse==4) {
|
|
$data = $this->Amod->getData_DaftarPenawaran_byPENAWARAN_byVERSI($id_penawaran, $datPenawaran[0]['AKTIF_PENAWARAN']);
|
|
} else if ($verse==3) {
|
|
$data = $this->Amod->getData_DaftarPenawaran_byPENAWARAN_byVERSI($id_penawaran, $datCd[0]['SJ_INV']);
|
|
}
|
|
foreach ($data as $key) {
|
|
$dpp = round(($key['QTY_DPNE']*$key['HARGA_DPNE']),2);
|
|
$ppn = round($dpp*($ppn_penawaran/100),2);
|
|
$dppDpne = $dppDpne+$dpp;
|
|
$ppnDpne = $ppnDpne+$ppn;
|
|
$totDpne = $totDpne+$dpp+$ppn;
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'total' => sizeof($data),
|
|
'data' => $data,
|
|
'kode_penawaran' => $kode_penawaran,
|
|
'jenis_penawaran' => $jenis_penawaran,
|
|
'listOther' => $listOther,
|
|
'dppDpne' => number_format($dppDpne,2),
|
|
'ppnDpne' => number_format($ppnDpne,2),
|
|
'totDpne' => number_format($totDpne,2),
|
|
]);
|
|
}
|
|
|
|
public function GE_Ambil_DataDaftarPengadaan() {
|
|
$verse = $this->input->post('verse');
|
|
$id_pengadaan = $this->input->post('id_pengadaan');
|
|
$id_ssp = $this->input->post('id_ssp');
|
|
$id_dpg = $this->input->post('id_dpg');
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
|
|
$dppDpg = 0;
|
|
$ppnDpg = 0;
|
|
$totDpg = 0;
|
|
$kode_pengadaan = "";
|
|
|
|
if ($verse==1) { // Buat Data Pengadaan
|
|
$datPengadaan = $this->Amod->getData_Pengadaan_byKARYAWAN_bySTATUS_bySSP($id_karyawan, 0, $id_ssp);
|
|
if ($datPengadaan==TRUE) {
|
|
$id_pengadaan = $datPengadaan[0]['ID_PENGADAAN'];
|
|
} else {
|
|
$id_pengadaan = NULL;
|
|
}
|
|
} else if ($verse==2) { // Lihat Data Existing
|
|
$datPengadaan = $this->Amod->getData_Pengadaan_byID_bySTATUS($id_pengadaan, 1);
|
|
$kode_pengadaan = $datPengadaan[0]['KODE_PENGADAAN'];
|
|
} else if ($verse==3) { // Lihat Data Berjalan, Paket Mix
|
|
$datPengadaan = $this->Amod->getData_Pengadaan_byID_bySTATUS($id_pengadaan, 0);
|
|
$kode_pengadaan = $datPengadaan[0]['KODE_PENGADAAN'];
|
|
}
|
|
|
|
if ($id_pengadaan==NULL) {
|
|
$data = [];
|
|
} else {
|
|
$data = $this->Amod->getData_DaftarPengadaan_byPENGADAAN($id_pengadaan);
|
|
$no = 0;
|
|
foreach ($data as $key) {
|
|
$datDpmx = $this->Amod->getData_DetailPengadaanMix_byDPG_forMix($key['ID_DPG']);
|
|
$detail = "";
|
|
$nomx = 1;
|
|
foreach ($datDpmx as $dat) {
|
|
$nama = $dat['NAMA_BARANG'];
|
|
$qty = $dat['QTY_DPMX'];
|
|
|
|
$detail .= "<b style='color:FireBrick'>$nomx) $qty EA | $nama</b><br>";
|
|
$nomx++;
|
|
}
|
|
|
|
$cekDpmx = $this->Amod->getData_DetailPengadaanMix_byMIX($key['ID_DPG']);
|
|
if ($cekDpmx==TRUE) {
|
|
$lock = 1;
|
|
} else {
|
|
$lock = 0;
|
|
}
|
|
|
|
$data[$no] += ['LOCK' => $lock];
|
|
$data[$no++] += ['DETAIL' => $detail];
|
|
|
|
$dpp = round(($key['QTY_DPG']*($key['HARGA_DPG']-$key['DISKON_DPG'])),2);
|
|
$ppn = round($dpp*(11/100),2);
|
|
$dppDpg = $dppDpg+$dpp;
|
|
$ppnDpg = $ppnDpg+$ppn;
|
|
$totDpg = $totDpg+$dpp+$ppn;
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'total' => sizeof($data),
|
|
'data' => $data,
|
|
'kode_pengadaan' => $kode_pengadaan,
|
|
'dppDpg' => number_format($dppDpg,2),
|
|
'ppnDpg' => number_format($ppnDpg,2),
|
|
'totDpg' => number_format($totDpg,2),
|
|
]);
|
|
}
|
|
|
|
public function GE_Ambil_DataDaftarPricelist() {
|
|
$id_smpl = $this->input->post('id_smpl');
|
|
$id_dfpl = $this->input->post('id_dfpl');
|
|
$id_pricelist = $this->input->post('id_pricelist');
|
|
$id_search = $this->input->post('id_search');
|
|
$filter_search = $this->input->post('filter_search');
|
|
$verse = $this->input->post('verse');
|
|
|
|
if ($id_search=="") {
|
|
$list = NULL;
|
|
} else {
|
|
$list = explode(" ", $id_search);
|
|
}
|
|
|
|
if ($verse==1) {
|
|
$data = $this->Amod->getData_DaftarPricelist_bySMPL_orderURUTAN($id_smpl, $list, $filter_search);
|
|
$no = 0;
|
|
foreach ($data as $key) {
|
|
$color = $key['COLMODEL_DFPL'];
|
|
$listColor = explode(',', $color);
|
|
$coltext = $listColor[0];
|
|
$colbg = $listColor[1];
|
|
|
|
$data[$no++] += [
|
|
'COLTEXT' => $coltext,
|
|
'COLBG' => $colbg
|
|
];
|
|
}
|
|
} else if ($verse==2) {
|
|
$data = $this->Amod->getData_DaftarPricelist_byID($id_dfpl);
|
|
$color = $data[0]['COLMODEL_DFPL'];
|
|
$listColor = explode(',', $color);
|
|
$coltext = $listColor[0];
|
|
$colbg = $listColor[1];
|
|
|
|
$data[0] += [
|
|
'COLTEXT' => $coltext,
|
|
'COLBG' => $colbg
|
|
];
|
|
} else if ($verse==3) {
|
|
$data = $this->Amod->getData_DaftarPricelist_byPRICELIST($id_pricelist, $list, $filter_search);
|
|
$no = 0;
|
|
foreach ($data as $key) {
|
|
$color = $key['COLMODEL_DFPL'];
|
|
$listColor = explode(',', $color);
|
|
$coltext = $listColor[0];
|
|
$colbg = $listColor[1];
|
|
|
|
$data[$no++] += [
|
|
'COLTEXT' => $coltext,
|
|
'COLBG' => $colbg
|
|
];
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'total' => sizeof($data),
|
|
'data' => $data,
|
|
]);
|
|
}
|
|
|
|
public function GE_Ambil_DataDaftarKlaimProgram() {
|
|
$id_kpr = $this->input->post('id_kpr');
|
|
|
|
$data = $this->Amod->getData_DaftarKlaimProgram_byKPR($id_kpr);
|
|
$datKpr = $this->Amod->getData_KlaimProgram_byID($id_kpr);
|
|
$datDb = $this->Amod->getData_DaftarBeli_byID($datKpr[0]['DB_ID']);
|
|
if ($datDb==TRUE) {
|
|
$limit = $datDb[0]['QTY_DB'];
|
|
} else {
|
|
$limit = 0;
|
|
}
|
|
|
|
$this->output_json([
|
|
'total' => sizeof($data),
|
|
'data' => $data,
|
|
'namaSku' => $datKpr[0]['NAMA_BARANG'],
|
|
'limit' => $limit,
|
|
]);
|
|
}
|
|
|
|
public function GE_Ambil_DataDaftarPromoClearance() {
|
|
$id_karyawan = $this->input->post('id_karyawan');
|
|
|
|
$countDpc = $this->Amod->getCount_DaftarPromoClearance_byKARYAWAN_bySTATUS_NotStpc($id_karyawan, 0);
|
|
|
|
$this->output_json([
|
|
'countDpc' => $countDpc
|
|
]);
|
|
}
|
|
|
|
public function GE_Ambil_DataDaftarReturBeli() { // Validasi
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$verse = $this->input->post('verse');
|
|
$id_rb = $this->input->post('id_rb');
|
|
|
|
$id_pembelian = 0;
|
|
$kode_rb = "";
|
|
$nama_supplier = "";
|
|
$sj_pembelian = "Klik pada Icon dikanan";
|
|
$dppDrb = 0;
|
|
$ppnDrb = 0;
|
|
$totDrb = 0;
|
|
$data = [];
|
|
if ($verse==1) { //Ambil Data Retur Pembelian Kosong
|
|
$datRb = $this->Amod->getData_ReturPembelian_byKARYAWAN_statusNull($id_karyawan);
|
|
if ($datRb==FALSE) {
|
|
$id_rb = 0;
|
|
} else {
|
|
$id_rb = $datRb[0]['ID_RB'];
|
|
$id_pembelian = $datRb[0]['PEMBELIAN_ID'];
|
|
$kode_rb = $datRb[0]['KODE_RB'];
|
|
$sj_pembelian = $datRb[0]['SJ_PEMBELIAN'];
|
|
}
|
|
} else if ($verse==2) { //Ambil Data Spesifik ID
|
|
$data = $this->Amod->getData_DaftarReturBeli_byRB($id_rb);
|
|
$no = 0;
|
|
foreach ($data as $key) {
|
|
$sn = "";
|
|
$nosn = 1;
|
|
$datSnrb = $this->Amod->getData_SnReturBeli_byDRB($key['ID_DRB']);
|
|
foreach ($datSnrb as $dat) {
|
|
$nama = $dat['NAMA_SNRB'];
|
|
if ($nosn==count($datSnrb)) {
|
|
$sn .= "$nama";
|
|
} else {
|
|
$sn .= "$nama, ";
|
|
}
|
|
$nosn++;
|
|
}
|
|
$data[$no++] += ['SN' => $sn];
|
|
}
|
|
|
|
$datRb = $this->Amod->getData_ReturPembelian_byID($id_rb);
|
|
$nama_supplier = $datRb[0]['NAMA_SUPPLIER'];
|
|
|
|
$sumDrb = $this->Amod->getSum_DaftarReturBeli_byRB($id_rb);
|
|
$dppDrb = $sumDrb[0]['TOTAL'];
|
|
$ppnDrb = round($dppDrb*($datRb[0]['PPN_PEMBELIAN']/100),2);
|
|
$totDrb = $dppDrb+$ppnDrb;
|
|
}
|
|
|
|
$this->output_json([
|
|
'data' => $data,
|
|
'total' => sizeof($data),
|
|
'id_rb' => $id_rb,
|
|
'id_pembelian' => $id_pembelian,
|
|
'kode_rb' => $kode_rb,
|
|
'sj_pembelian' => $sj_pembelian,
|
|
'nama_supplier' => $nama_supplier,
|
|
'dppDrb' => number_format($dppDrb, 2),
|
|
'ppnDrb' => number_format($ppnDrb, 2),
|
|
'totDrb' => number_format($totDrb, 2),
|
|
'dppRaw' => $dppDrb,
|
|
'ppnRaw' => $ppnDrb,
|
|
'totRaw' => $totDrb,
|
|
]);
|
|
}
|
|
|
|
public function GE_Ambil_DataDakFeePelanggan() {
|
|
$id_penjualan = $this->input->post('id_penjualan');
|
|
|
|
$datSo = $this->Amod->getData_SalesOrder_byPENJUALAN($id_penjualan);
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byPERKIRAAN_byPENJUALAN(64, $id_penjualan);
|
|
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byPENJUALAN_byPERKIRAAN($id_penjualan, 64);
|
|
if ($sumDak==FALSE OR $sumDak[0]['DEBET']==NULL) {
|
|
$terbayar = 0;
|
|
} else {
|
|
$terbayar = $sumDak[0]['DEBET'];
|
|
}
|
|
|
|
$no = 0;
|
|
$feeTotal = $datSo[0]['FEE_SO'];
|
|
$data[$no++] = [
|
|
'KODE' => $datSo[0]['KODE_SO'],
|
|
'TANGGAL' => $datSo[0]['TANGGAL'],
|
|
'TS' => "",
|
|
'FEE' => number_format($feeTotal, 2),
|
|
'TERBAYAR' => "0.00",
|
|
'SUBTOTAL' => number_format($feeTotal, 2),
|
|
];
|
|
|
|
foreach ($datDak as $key) {
|
|
$feeTotal = $feeTotal-$key['DEBET_DAK'];
|
|
$data[$no++] = [
|
|
'KODE' => $key['KODE_AKUNTANSI'],
|
|
'TANGGAL' => $key['TANGGAL'],
|
|
'TS' => $key['CIPTA_DAK'],
|
|
'FEE' => "0.00",
|
|
'TERBAYAR' => number_format($key['DEBET_DAK'],2),
|
|
'SUBTOTAL' => number_format($feeTotal, 2),
|
|
];
|
|
}
|
|
|
|
$this->output_json([
|
|
'total' => sizeof($data),
|
|
'data' => $data,
|
|
'kode_so' => $datSo[0]['KODE_SO'],
|
|
'nama_pelanggan' => $datSo[0]['NAMA_PELANGGAN'],
|
|
'sisaFee' => number_format($feeTotal,2),
|
|
]);
|
|
}
|
|
|
|
public function GE_Ambil_DataDakPiutangDagang() {
|
|
$id_pelanggan = $this->input->post('id_pelanggan');
|
|
$id_sales = $this->input->post('id_sales');
|
|
$verse = $this->input->post('verse');
|
|
$search = $this->input->post('search');
|
|
|
|
$datPelanggan = $this->Amod->getData_Pelanggan_byID($id_pelanggan);
|
|
if ($id_sales=="") {
|
|
$data = $this->Amod->getData_HasilHitungPda_byPELANGGAN_belumLunasOnly($id_pelanggan, $search);
|
|
} else {
|
|
$data = $this->Amod->getData_HasilHitungPda_byPELANGGAN_bySALES_belumLunasOnly($id_pelanggan, $id_sales, $search);
|
|
}
|
|
$this->output_json([
|
|
'total' => sizeof($data),
|
|
'data' => $data,
|
|
'nama_pelanggan' => $datPelanggan[0]['NAMA_PELANGGAN'],
|
|
]);
|
|
}
|
|
|
|
public function GE_Ambil_DataDetailPengadaanMix() {
|
|
$id_dpg = $this->input->post('id_dpg');
|
|
|
|
$data = $this->Amod->getData_DetailPengadaanMix_byDPG_forMix($id_dpg);
|
|
$datDpg = $this->Amod->getData_DaftarPengadaan_byID($id_dpg);
|
|
|
|
$this->output_json([
|
|
'total' => sizeof($data),
|
|
'data' => $data,
|
|
'limit' => $datDpg[0]['QTY_DPG'],
|
|
'namaSku' => $datDpg[0]['NAMA_BARANG'],
|
|
]);
|
|
}
|
|
|
|
public function GE_Ambil_DataFormFeePelanggan() {
|
|
$verse = $this->input->post('verse');
|
|
$id_ffp = $this->input->post('id_ffp');
|
|
$search = $this->input->post('search');
|
|
$jabatan = $this->session->userdata('jabatan');
|
|
|
|
if ($verse==1) { // Ambil Tampilan Form
|
|
if ($jabatan=="ADMINISTRATOR" OR $jabatan=="PIMPINAN" OR $jabatan=="KADIV KEUANGAN") {
|
|
$data = $this->Amod->getData_FormFeePelanggan_ACC($jabatan);
|
|
} else {
|
|
$data = [];
|
|
}
|
|
} else if ($verse==2) { // Ambil Detail Barang dan Piutang
|
|
$datFfp = $this->Amod->getData_FormFeePelanggan_byID($id_ffp);
|
|
$dataDo = $this->Amod->getData_DaftarOrder_byPENJUALAN($datFfp[0]['PENJUALAN_ID']);
|
|
$dataDak = $this->Amod->getData_DaftarAkuntansi_byPERKIRAAN_byPENJUALAN(3, $datFfp[0]['PENJUALAN_ID']);
|
|
|
|
$sumDo = $this->Amod->getSum_DaftarOrder_byPENJUALAN($datFfp[0]['PENJUALAN_ID']);
|
|
$dppDo = $sumDo[0]['TOTAL'];
|
|
$ppnDo = round($dppDo*($dataDo[0]['PPN_SO']/100),2);
|
|
$totDo = $dppDo+$ppnDo;
|
|
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byPENJUALAN_byPERKIRAAN($datFfp[0]['PENJUALAN_ID'], 3);
|
|
$debetDak = $sumDak[0]['DEBET'];
|
|
$kreditDak = $sumDak[0]['KREDIT'];
|
|
$sisaDak = $debetDak-$kreditDak;
|
|
|
|
$this->output_json([
|
|
'totalDo' => sizeof($dataDo),
|
|
'totalDak' => sizeof($dataDak),
|
|
'dataDo' => $dataDo,
|
|
'dataDak' => $dataDak,
|
|
'kode_ffp' => $datFfp[0]['KODE_FFP'],
|
|
'jenis_ffp' => $datFfp[0]['JENIS_FFP'],
|
|
'tgl_ffp' => $datFfp[0]['TGL_FFP'],
|
|
'ket_ffp' => $datFfp[0]['KET_FFP'],
|
|
'nama_jfp' => $datFfp[0]['NAMA_JFP'],
|
|
'nilai_ffp' => $datFfp[0]['NILAI'],
|
|
'status_ffp' => $datFfp[0]['STATUS_FFP'],
|
|
'dppDo' => number_format($dppDo,2),
|
|
'ppnDo' => number_format($ppnDo,2),
|
|
'totDo' => number_format($totDo,2),
|
|
'debetDak' => number_format($debetDak,2),
|
|
'kreditDak' => number_format($kreditDak,2),
|
|
'sisaDak' => number_format($sisaDak,2),
|
|
]);
|
|
} else if ($verse==3) { // Ambil Data Form 0 dan 1
|
|
$data = $this->Amod->getData_FormFeePelanggan_bySEARCH_statusUntil1_limit20($search);
|
|
} else if ($verse==4) { // Ambil Data Pengecekan Pembayaran
|
|
$data = [];
|
|
|
|
$datFfp = $this->Amod->getData_FormFeePelanggan_byID($id_ffp);
|
|
$data[0] = [
|
|
'KODE' => $datFfp[0]['KODE_FFP'],
|
|
'DEBET' => "0.00",
|
|
'KREDIT' => $datFfp[0]['NILAI'],
|
|
'KET' => $datFfp[0]['KET_FFP'],
|
|
];
|
|
|
|
$no = 1;
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byPERKIRAAN_byPENJUALAN(64, $datFfp[0]['PENJUALAN_ID']);
|
|
foreach ($datDak as $key) {
|
|
$data[$no++] = [
|
|
'KODE' => $key['KODE_AKUNTANSI'],
|
|
'DEBET' => $key['DEBET'],
|
|
'KREDIT' => "0.00",
|
|
'KET' => $key['KET_DAK'],
|
|
];
|
|
}
|
|
}
|
|
|
|
if ($verse==1 OR $verse==3 OR $verse==4) {
|
|
$this->output_json([
|
|
'data' => $data,
|
|
'total' => sizeof($data),
|
|
]);
|
|
}
|
|
}
|
|
|
|
public function GE_Ambil_DataFormKaryawanStatusOnly() {
|
|
$verse = $this->input->post('verse');
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$jabatan = $this->session->userdata('jabatan');
|
|
|
|
$data = $this->Amod->getData_FormKaryawan_byKARYAWAN_cariStatus($id_karyawan, $verse, $jabatan);
|
|
$no = 0;
|
|
foreach ($data as $key) {
|
|
if ($key['JENIS_FK']==5 OR $key['JENIS_FK']==6 OR $key['JENIS_FK']==7) {
|
|
$datDffk = $this->Amod->getData_DaftarFormKaryawan_byFK($key['ID_FK']);
|
|
$awal = date_format(date_create($datDffk[0]['TGL_DFFK']),"d/m/Y");
|
|
if (count($datDffk)>1) {
|
|
$akhir = date_format(date_create($datDffk[count($datDffk)-1]['TGL_DFFK']),"d/m/Y");
|
|
$ket = "Dari $awal s/d $akhir";
|
|
} else {
|
|
$ket = "Pada $awal";
|
|
}
|
|
} else {
|
|
$ket = "";
|
|
}
|
|
$data[$no++] += ['KET' => $ket];
|
|
}
|
|
|
|
$this->output_json([
|
|
'data' => $data,
|
|
'total' => sizeof($data),
|
|
]);
|
|
}
|
|
|
|
public function GE_Ambil_DataHargaPart() {
|
|
$verse = $this->input->post('verse');
|
|
|
|
if ($verse==1) {
|
|
$datHpar = $this->Amod->getData_HargaPart_byID();
|
|
$data = [];
|
|
$no = 0;
|
|
$nama_part = NULL;
|
|
foreach ($datHpar as $key) {
|
|
if ($key['NAMA_PART']!=$nama_part) {
|
|
$nama_part = $key['NAMA_PART'];
|
|
$hpp = ($key['HPP_HPAR']/2);
|
|
|
|
$data[$no++] = [
|
|
'ID_HPAR' => $key['ID_HPAR'],
|
|
'NAMA_PART' => $nama_part,
|
|
'HPP' => number_format($hpp,2)
|
|
];
|
|
}
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'total' => sizeof($data),
|
|
'data' => $data,
|
|
]);
|
|
}
|
|
|
|
public function GE_Ambil_DataHasilHitungBfe() {
|
|
$verse = $this->input->post('verse');
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
|
|
$data = [];
|
|
$no = 0;
|
|
if ($verse==1) { // Ambil Data Biaya Fee belum diproses
|
|
$datShas = $this->Amod->getData_SetHakAdminSo_byKARYAWAN($id_karyawan);
|
|
foreach ($datShas as $key) {
|
|
$datHhbfe = $this->Amod->getData_HasilHitungBfe_bySALES_bySTATUS($key['HAK_ID'], 0);
|
|
foreach ($datHhbfe as $dat) {
|
|
$datHhpda = $this->Amod->getData_HasilHitungPda_byPENJUALAN_linkFormFee($dat['PID']);
|
|
$tglLunas = "";
|
|
$kodeLunas = "";
|
|
$jenisFfp = "";
|
|
if ($datHhpda==FALSE OR $datHhpda[0]['STATUS_HHPDA']==0) {
|
|
$statLunas = "Belum Lunas";
|
|
} else {
|
|
if (strpos($datHhpda[0]['LUNAS_HHPDA'],"RJ")!==FALSE) {
|
|
$statLunas = "Retur Jual";
|
|
} else {
|
|
$statLunas = "Lunas";
|
|
}
|
|
$tglLunas = $datHhpda[0]['TGLLOCK'];
|
|
$kodeLunas = $datHhpda[0]['LUNAS_HHPDA'];
|
|
if ($datHhpda[0]['JENIS_FFP']==1) {
|
|
$jenisFfp = "Kasbank";
|
|
} else if ($datHhpda[0]['JENIS_FFP']==2) {
|
|
$jenisFfp = "Potong Nota";
|
|
} else if ($datHhpda[0]['JENIS_FFP']==3) {
|
|
$jenisFfp = "Campur";
|
|
} else {
|
|
$jenisFfp = "Belum dibuat";
|
|
}
|
|
}
|
|
|
|
$data[$no] = [
|
|
'PJ_ID' => $dat['PID'],
|
|
'KODE_SO' => $dat['KODE_SO'],
|
|
'PO_SO' => $dat['PO_SO'],
|
|
'NISO' => $dat['NISO'],
|
|
'FEE' => $dat['FEE'],
|
|
'ALIAS_CORP' => $dat['ALIAS_CORP'],
|
|
'TANGGAL' => $dat['TANGGAL'],
|
|
'TYPE_PELANGGAN' => $dat['TYPE_PELANGGAN'],
|
|
'NAMA_PELANGGAN' => $dat['NAMA_PELANGGAN'],
|
|
'ALIAS_PELANGGAN' => $dat['ALIAS_PELANGGAN'],
|
|
'NAMA_KOTA' => $dat['NAMA_KOTA'],
|
|
'NAMA_PANGGILAN_KARYAWAN' => $dat['NAMA_PANGGILAN_KARYAWAN'],
|
|
];
|
|
if ($datHhpda==TRUE AND $datHhpda[0]['ID_FFP']!=NULL) {
|
|
$data[$no] += ['ID_FFP' => $datHhpda[0]['ID_FFP']];
|
|
$data[$no] += ['JENIS_FFP' => $datHhpda[0]['JENIS_FFP']];
|
|
$data[$no] += ['CONFFPK' => $datHhpda[0]['CON_FFP_K']];
|
|
$data[$no] += ['CONFFPP' => $datHhpda[0]['CON_FFP_P']];
|
|
$data[$no] += ['KODEFFP' => $datHhpda[0]['KODE_FFP']];
|
|
$data[$no] += ['TGLFFP' => $datHhpda[0]['TGLFFP']];
|
|
$data[$no] += ['KETFFP' => $datHhpda[0]['KET_FFP']];
|
|
} else {
|
|
$data[$no] += ['ID_FFP' => NULL];
|
|
$data[$no] += ['JENIS_FFP' => NULL];
|
|
$data[$no] += ['CONFFPK' => NULL];
|
|
$data[$no] += ['CONFFPP' => NULL];
|
|
$data[$no] += ['KODEFFP' => NULL];
|
|
$data[$no] += ['TGLFFP' => NULL];
|
|
$data[$no] += ['KETFFP' => NULL];
|
|
}
|
|
$data[$no] += ['JENISFFP' => $jenisFfp];
|
|
$data[$no] += ['STATLUNAS' => $statLunas];
|
|
$data[$no] += ['TGLLUNAS' => $tglLunas];
|
|
$data[$no++] += ['KODELUNAS' => $kodeLunas];
|
|
}
|
|
}
|
|
sort($data);
|
|
}
|
|
|
|
$this->output_json([
|
|
'total' => sizeof($data),
|
|
'data' => $data,
|
|
]);
|
|
}
|
|
|
|
public function GE_Ambil_DataHasilHitungHda() {
|
|
$verse = $this->input->post('verse');
|
|
$search = $this->input->post('search');
|
|
$id_hhhda = $this->input->post('id_hhpda');
|
|
|
|
if ($verse==1) { // Ambil Data Informasi Hutang Dagang belum Terbayar
|
|
$data = $this->Amod->getData_HasilHitungHda_belumLunasOnly($search);
|
|
}
|
|
|
|
$this->output_json([
|
|
'total' => sizeof($data),
|
|
'data' => $data,
|
|
]);
|
|
}
|
|
|
|
public function GE_Ambil_DataHasilHitungKpr() {
|
|
$id_barang = $this->input->post('id_barang');
|
|
|
|
$datHhkpr = $this->Amod->getData_HasilHitungKpr_byBARANG($id_barang);
|
|
if ($datHhkpr==FALSE) {
|
|
$hasil = "~";
|
|
} else {
|
|
if ($datHhkpr[0]['QTY_HHKPR']==0) {
|
|
$hasil = "0.00";
|
|
} else {
|
|
$hasil = number_format((($datHhkpr[0]['PERSEDIAAN_HHKPR']-$datHhkpr[0]['PP_HHKPR']-$datHhkpr[0]['REBATE_HHKPR']-$datHhkpr[0]['SUPPORT_HHKPR'])/$datHhkpr[0]['QTY_HHKPR']),0);
|
|
}
|
|
}
|
|
|
|
$datBarang = $this->Amod->getData_Barang_byID($id_barang);
|
|
|
|
$this->output_json([
|
|
'hasil' => $hasil,
|
|
'kode' => $datBarang[0]['KODE_BARANG'],
|
|
'nama' => $datBarang[0]['NAMA_BARANG'],
|
|
'total' => $datBarang[0]['PCM_KUANTITI']+$datBarang[0]['ITP_KUANTITI']
|
|
]);
|
|
}
|
|
|
|
public function GE_Ambil_DataHasilHitungPda() {
|
|
$verse = $this->input->post('verse');
|
|
$mode = $this->input->post('mode');
|
|
$id_pelanggan = $this->input->post('id_pelanggan');
|
|
$id_corp = $this->input->post('id_corp');
|
|
$id_sales = $this->input->post('id_sales');
|
|
$id_kelompok = $this->input->post('id_kelompok');
|
|
$id_hhpda = $this->input->post('id_hhpda');
|
|
$now = date('Y-m-d');
|
|
|
|
$nama = "";
|
|
if ($verse==1) { // Ambil Data untuk Pengingat Tagihan
|
|
if ($id_pelanggan=="") {
|
|
$id_pelanggan = NULL;
|
|
}
|
|
|
|
if ($id_corp=="") {
|
|
$id_corp = NULL;
|
|
}
|
|
|
|
if ($id_sales=="") {
|
|
$id_sales = NULL;
|
|
}
|
|
|
|
$data = $this->Amod->getData_HasilHitungPda_byPELANGGAN_bySALES_byCORP_forDokumenTagihan($id_pelanggan, $id_sales, $id_corp);
|
|
} else if ($verse==2) { // Ambil Data Informasi Piutang Dagang
|
|
if ($id_kelompok=="NoFilter") {
|
|
$id_kelompok = NULL;
|
|
}
|
|
|
|
$data = $this->Amod->getData_HasilHitungPda_byKELOMPOK_groupPELANGGAN_belumLunasOnly($id_kelompok, $mode);
|
|
$no = 0;
|
|
foreach ($data as $key) {
|
|
$datPda = $this->Amod->getSum_HasilHitungPda_byPELANGGAN_byTEMPO_forPiutangDagang($key['PELANGGAN_ID'], $now, $mode);
|
|
$list = "";
|
|
foreach ($datPda as $dat) {
|
|
$id = $dat['ID_HHPDA'];
|
|
$kop = $dat['NAMA_KOP'];
|
|
$tempo = $dat['TEMPO'];
|
|
$inv = $dat['INV_PENJUALAN'];
|
|
$selisih = $dat['SELISIH'];
|
|
|
|
$list .= "<b style='color:DarkSlateGray'>[<b style='color:Teal'>$kop</b> | $tempo] <b style='color:Crimson'>$inv</b> | <b style='color:Olive'>$selisih</b></b> <a onclick='isiDataHasilHitungPda(6, $id)' data-toggle='modal' data-target='#modalLihatHasilHitungPda'> <i class='fa fa-search'></i></a><br>";
|
|
}
|
|
|
|
$data[$no] += ['LIST' => $list];
|
|
$data[$no++] += ['PDA' => $datPda];
|
|
}
|
|
} else if ($verse==3) { // Ambil Data Spesifik ID
|
|
if ($mode==1) {
|
|
$data = $this->Amod->getData_HasilHitungPda_byID($id_hhpda);
|
|
$nama = $data[0]['NAMA_PELANGGAN'];
|
|
} else if ($mode==2) {
|
|
$data = $this->Amod->getData_HasilHitungPda_byPELANGGAN_belumLunasOnly($id_pelanggan);
|
|
$datPelanggan = $this->Amod->getData_Pelanggan_byID($id_pelanggan);
|
|
$nama = $datPelanggan[0]['NAMA_PELANGGAN'];
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'total' => sizeof($data),
|
|
'data' => $data,
|
|
'nama' => $nama,
|
|
]);
|
|
}
|
|
|
|
public function GE_Ambil_DataHistoriCetakDokumen() { // Validasi
|
|
$id_cd = $this->input->post('id_cd');
|
|
|
|
$datHcd = $this->Amod->getData_HistoriCetakDokumen_byCD_orderDESC_limit1($id_cd);
|
|
if ($datHcd==FALSE) {
|
|
$tgl_hcd = date('Y-m-d');
|
|
$kertas_hcd = "";
|
|
$sn_hcd = "";
|
|
$ppn_hcd = "";
|
|
$dp_hcd = "";
|
|
$ket_hcd = "";
|
|
} else {
|
|
$tgl_hcd = $datHcd[0]['TGL_HCD'];
|
|
$kertas_hcd = $datHcd[0]['KERTAS_HCD'];
|
|
$sn_hcd = $datHcd[0]['SN_HCD'];
|
|
$ppn_hcd = $datHcd[0]['PPN_HCD'];
|
|
$dp_hcd = $datHcd[0]['DP_HCD'];
|
|
$ket_hcd = $datHcd[0]['KET_HCD'];
|
|
}
|
|
|
|
$this->output_json([
|
|
'tgl_hcd' => $tgl_hcd,
|
|
'kertas_hcd' => $kertas_hcd,
|
|
'sn_hcd' => $sn_hcd,
|
|
'ppn_hcd' => $ppn_hcd,
|
|
'dp_hcd' => $dp_hcd,
|
|
'ket_hcd' => $ket_hcd,
|
|
]);
|
|
}
|
|
|
|
public function GE_Ambil_DataHistoriPenawaran() { // Validasi
|
|
$verse = $this->input->post('verse');
|
|
$id_penawaran = $this->input->post('id_penawaran');
|
|
|
|
$kode = "";
|
|
if ($verse==1) {
|
|
$data = $this->Amod->getData_HistoriPenawaran_byPENAWARAN($id_penawaran);
|
|
$datPenawaran = $this->Amod->getData_Penawaran_byID($id_penawaran);
|
|
$kode = $datPenawaran[0]['KODE_PENAWARAN'];
|
|
}
|
|
|
|
$this->output_json([
|
|
'data' => $data,
|
|
'total' => sizeof($data),
|
|
'kode' => $kode,
|
|
]);
|
|
}
|
|
|
|
public function GE_Ambil_DataKaryawan() { // Validasi
|
|
$verse = $this->input->post('verse');
|
|
$id_karyawan = $this->input->post('id_karyawan');
|
|
|
|
if ($verse==1) { // Ambil Anggota Tim dari Kadiv
|
|
$data = $this->Amod->getData_Karyawan_byDIVISI_byKADIV(1, $id_karyawan);
|
|
if ($id_karyawan==31) { // Khusus Tim Mas Anton
|
|
$data[count($data)] = [
|
|
'ID_KARYAWAN' => "Tim ICT",
|
|
'NAMA_PANGGILAN_KARYAWAN' => "Tim ICT",
|
|
'NAMA_JABATAN' => "Tim ICT",
|
|
];
|
|
}
|
|
} else if ($verse==2) { // Ambil Data sesuai ID
|
|
$data = $this->Amod->getData_Karyawan_byID($id_karyawan);
|
|
}
|
|
|
|
$this->output_json([
|
|
'data' => $data,
|
|
'total' => sizeof($data),
|
|
]);
|
|
}
|
|
|
|
public function GE_Ambil_DataKlaimProgram() {
|
|
$verse = $this->input->post('verse');
|
|
$search = $this->input->post('search');
|
|
$id_merk = $this->input->post('id_merk');
|
|
$id_produk = $this->input->post('id_produk');
|
|
$id_kpr = $this->input->post('id_kpr');
|
|
|
|
if ($verse==1) { // Ambil Klaim Program max 20 Baris
|
|
$data = $this->Amod->getData_KlaimProgram_byMERK_byPRODUK_bySEARCH_limit20($id_merk, $id_produk, $search);
|
|
$no = 0;
|
|
foreach ($data as $key) {
|
|
$countSnkprAll = $this->Amod->getCount_SnKlaimProgram_byKPR($key['ID_KPR']);
|
|
$countSnkprDone = $this->Amod->getCount_SnKlaimProgram_byKPR_statusNot0($key['ID_KPR']);
|
|
|
|
$data[$no] += ['COUNT' => $countSnkprAll];
|
|
$data[$no++] += ['REAL' => $countSnkprDone];
|
|
}
|
|
} else if ($verse==2) {
|
|
$datKpr = $this->Amod->getData_KlaimProgram_byID($id_kpr);
|
|
$awal = $this->Amod->generate_subDay($datKpr[0]['TGL_KPR'], 60);
|
|
$akhir = $this->Amod->generate_addDay($datKpr[0]['TGL_KPR'], 60);
|
|
$data = $this->Amod->getData_KlaimProgram_byMERK_byPRODUK_byPERIODE($id_merk, $id_produk, $awal, $akhir);
|
|
}
|
|
|
|
$this->output_json([
|
|
'data' => $data
|
|
]);
|
|
}
|
|
|
|
public function GE_Ambil_DataKpi() { // Validasi
|
|
$verse = $this->input->post('verse');
|
|
$id_karyawan = $this->input->post('id_karyawan');
|
|
$id_pum = $this->input->post('id_pum');
|
|
$id_divisi = $this->input->post('id_divisi');
|
|
|
|
if ($verse==1) { // Ambil Data Kpi yang belum dipilih
|
|
if ($id_karyawan=="Tim ICT") {
|
|
$id_tim = 1;
|
|
} else {
|
|
$id_tim = 0;
|
|
}
|
|
|
|
$data = $this->Amod->getData_Kpi_byDIVISI($id_divisi);
|
|
$no = 0;
|
|
foreach ($data as $key) {
|
|
if ($id_tim==0) {
|
|
$cekDkpi = $this->Amod->getData_DaftarKpi_byKPI_byPUM_byKARYAWAN($key['ID_KPI'], $id_pum, $id_karyawan);
|
|
} else {
|
|
$cekDkpi = $this->Amod->getData_DaftarKpi_byKPI_byPUM_byTIM($key['ID_KPI'], $id_pum, $id_tim);
|
|
}
|
|
if ($cekDkpi==TRUE) {
|
|
$lock = 1;
|
|
} else {
|
|
$lock = 0;
|
|
}
|
|
$data[$no++] += ['LOCK' => $lock];
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'data' => $data,
|
|
'total' => sizeof($data),
|
|
]);
|
|
}
|
|
|
|
public function GE_Ambil_DataKunjungan() { // Validasi
|
|
$verse = $this->input->post('verse');
|
|
$id = $this->input->post('id');
|
|
$karyawan_id = $this->input->post('karyawan_id');
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
|
|
$data = [];
|
|
$totWeeks = 0;
|
|
if ($verse==1) { // Ambil keseluruhan Data versi Tabel
|
|
if ($id>0) {
|
|
$datPkpi = $this->Amod->getData_PeriodeKpi_byID($id);
|
|
$diffawal = new DateTime($datPkpi[0]['AWAL_PKPI']);
|
|
$diffakhir = new DateTime($datPkpi[0]['AKHIR_PKPI']);
|
|
$diff = date_diff($diffawal, $diffakhir);
|
|
$diff = $diff->format("%a");
|
|
$diff = $diff+1;
|
|
$tglloop = $datPkpi[0]['AWAL_PKPI'];
|
|
|
|
$noarr = 0;
|
|
for ($no = 1; $no<=$diff; $no++) {
|
|
$cekMinggu = date_format(date_create($tglloop),"w");
|
|
if ($cekMinggu=="0") {
|
|
$weekend = 1;
|
|
} else {
|
|
$cekLibur = $this->Amod->getData_SetHariLibur_byTGL($tglloop);
|
|
if ($cekLibur==TRUE) {
|
|
$weekend = 1;
|
|
} else {
|
|
$weekend = 0;
|
|
}
|
|
}
|
|
|
|
$countKunjungan = $this->Amod->getCount_Kunjungan_byTGL_statusNot9($tglloop);
|
|
if ($countKunjungan==0) {
|
|
$datKunjungan = NULL;
|
|
} else {
|
|
$datKunjungan = $this->Amod->getData_Kunjungan_byTGL_statusNot9($tglloop);
|
|
$nokun = 0;
|
|
foreach ($datKunjungan as $key) {
|
|
$tim = "";
|
|
$sales_kunjungan = $key['SALES_KUNJUNGAN'];
|
|
$listSales = explode(',', $sales_kunjungan);
|
|
$notim = 1;
|
|
$me = 0;
|
|
foreach ($listSales as $dat) {
|
|
$datKaryawan = $this->Amod->getData_Karyawan_byID($dat);
|
|
$nama = $datKaryawan[0]['NAMA_PANGGILAN_KARYAWAN'];
|
|
if ($notim==count($listSales)) {
|
|
$tim .= "$nama";
|
|
} else {
|
|
$tim .= "$nama, ";
|
|
$notim++;
|
|
}
|
|
|
|
if ($id_karyawan==$dat) {
|
|
$me++;
|
|
}
|
|
}
|
|
|
|
$datKunjungan[$nokun] += ['ME' => $me];
|
|
$datKunjungan[$nokun++] += ['TIM' => $tim];
|
|
}
|
|
}
|
|
|
|
$data[$noarr++] = [
|
|
'TANGGAL' => $no,
|
|
'SEKARANG' => $tglloop,
|
|
'WEEKEND' => $weekend,
|
|
'JUMLAH' => $countKunjungan,
|
|
'KUNJUNGAN' => $datKunjungan,
|
|
];
|
|
|
|
$tglloop = strtotime(date("Y-m-d", strtotime($tglloop)) . " +1 days");
|
|
$tglloop = date('Y-m-d',$tglloop);
|
|
}
|
|
}
|
|
} else if ($verse==2) { // Ambil Spesifik ID
|
|
$data = $this->Amod->getData_Kunjungan_byID($id);
|
|
|
|
$salesNew = [];
|
|
$no = 0;
|
|
$listSales = explode(",", $data[0]['SALES_KUNJUNGAN']);
|
|
foreach ($listSales as $key) {
|
|
$salesNew[$no++] = $key;
|
|
}
|
|
|
|
$data[0] += ['SALESNEW' => $salesNew];
|
|
} else if ($verse==3) { // Ambil keseluruhan versi Kalender
|
|
if ($id>0) {
|
|
$datPkpi = $this->Amod->getData_PeriodeKpi_byID($id);
|
|
$diffawal = new DateTime($datPkpi[0]['AWAL_PKPI']);
|
|
$diffakhir = new DateTime($datPkpi[0]['AKHIR_PKPI']);
|
|
$diff = date_diff($diffawal, $diffakhir);
|
|
$diff = $diff->format("%a");
|
|
$diff = $diff+1;
|
|
$tglstart = $datPkpi[0]['AWAL_PKPI'];
|
|
$tglloop = $datPkpi[0]['AWAL_PKPI'];
|
|
|
|
$data = [];
|
|
$cekAwal = date_format(date_create($tglloop),"w");
|
|
$nilaiAwal = (int)$cekAwal;
|
|
|
|
$selisih = $nilaiAwal;
|
|
for ($no = 0; $no<=$selisih; $no++) {
|
|
$tglBefore = $this->Amod->generate_subDay($tglstart, ($selisih-$no));
|
|
$tglNew = date_format(date_create($tglBefore),"d");
|
|
|
|
$cekMinggu = date_format(date_create($tglBefore),"w");
|
|
$shl = "Libur";
|
|
if ($cekMinggu==0) {
|
|
$weekend = 1;
|
|
} else {
|
|
$cekLibur = $this->Amod->getData_SetHariLibur_byTGL($tglBefore);
|
|
if ($cekLibur==TRUE) {
|
|
$weekend = 1;
|
|
$shl = $cekLibur[0]['NAMA_SHL'];
|
|
} else {
|
|
$weekend = 0;
|
|
}
|
|
}
|
|
|
|
$datKunjungan = $this->Amod->getData_Kunjungan_byTGL_statusNot9($tglBefore);
|
|
$namaPelanggan = "";
|
|
foreach ($datKunjungan as $key) {
|
|
$sales_kunjungan = $key['SALES_KUNJUNGAN'];
|
|
$listSales = explode(',', $sales_kunjungan);
|
|
foreach ($listSales as $dat) {
|
|
if ($karyawan_id==$dat) {
|
|
if (strlen($key['PELANGGAN_KUNJUNGAN'])>24) {
|
|
$namaPel = substr($key['PELANGGAN_KUNJUNGAN'],0,22);
|
|
$namaPel = "$namaPel..";
|
|
} else {
|
|
$namaPel = $key['PELANGGAN_KUNJUNGAN'];
|
|
}
|
|
$namaPelanggan .= "$namaPel";
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
$data[$no] = [
|
|
'TANGGAL' => (int)$tglNew,
|
|
'SEKARANG' => $tglBefore,
|
|
'WEEKEND' => $weekend,
|
|
'SHL' => $shl,
|
|
'PEL' => $namaPelanggan,
|
|
'FADE' => '1'
|
|
];
|
|
}
|
|
|
|
//Minggu Pertama sesuai Bulan
|
|
$tglAwal = 1;
|
|
for ($no = $nilaiAwal; $no<=6; $no++) {
|
|
$cekMinggu = date_format(date_create($tglloop),"w");
|
|
$shl = "Libur";
|
|
if ($cekMinggu==0) {
|
|
$weekend = 1;
|
|
} else {
|
|
$cekLibur = $this->Amod->getData_SetHariLibur_byTGL($tglloop);
|
|
if ($cekLibur==TRUE) {
|
|
$weekend = 1;
|
|
$shl = $cekLibur[0]['NAMA_SHL'];
|
|
} else {
|
|
$weekend = 0;
|
|
}
|
|
}
|
|
|
|
$datKunjungan = $this->Amod->getData_Kunjungan_byTGL_statusNot9($tglloop);
|
|
$namaPelanggan = "";
|
|
$nokun = 1;
|
|
foreach ($datKunjungan as $key) {
|
|
$sales_kunjungan = $key['SALES_KUNJUNGAN'];
|
|
$listSales = explode(',', $sales_kunjungan);
|
|
foreach ($listSales as $dat) {
|
|
if ($karyawan_id==$dat OR $karyawan_id==0) {
|
|
$namaPel = $key['PELANGGAN_KUNJUNGAN'];
|
|
$idKun = $key['ID_KUNJUNGAN'];
|
|
$ciptaKun = $key['CIPTA_KUNJUNGAN'];
|
|
$ubahKun = $key['UBAH_KUNJUNGAN'];
|
|
$namaPelanggan .= "<p class='text-left' style='font-size:10px;border:1px solid black; padding:2px;background-color:DarkCyan'><b style='color:White'>[$nokun] $namaPel</b> <a onclick='isiDataInfoKunjungan($idKun, `$ciptaKun`, `$ubahKun`)' data-toggle='modal' data-target='#modalInfoKunjungan'><i class='fa fa-search text-info'></i></a>
|
|
 <a onclick='isiDataUbahKunjungan($idKun)' data-toggle='modal' data-target='#modalUbahKunjungan'><i class='fa fa-pencil text-warning'></i></a> <a onclick='isiDataHapusKunjungan($idKun)' data-toggle='modal' data-target='#modalHapusKunjungan'><i class='fa fa-times' style='color:Red'></i></a></p>";
|
|
$nokun++;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
$data[$cekMinggu] = [
|
|
'TANGGAL' => $tglAwal++,
|
|
'SEKARANG' => $tglloop,
|
|
'WEEKEND' => $weekend,
|
|
'SHL' => $shl,
|
|
'PEL' => $namaPelanggan,
|
|
'FADE' => '0'
|
|
];
|
|
|
|
$tglloop = strtotime(date("Y-m-d", strtotime($tglloop)) . " +1 days");
|
|
$tglloop = date('Y-m-d',$tglloop);
|
|
}
|
|
|
|
//Minggu Lanjutan sampai akhir Bulan
|
|
$noawal = $no;
|
|
for ($no = $noawal; $no<=$diff+$nilaiAwal-1; $no++) {
|
|
$cekMinggu = date_format(date_create($tglloop),"w");
|
|
$shl = "Libur";
|
|
if ($cekMinggu=="0") {
|
|
$weekend = 1;
|
|
} else {
|
|
$cekLibur = $this->Amod->getData_SetHariLibur_byTGL($tglloop);
|
|
if ($cekLibur==TRUE) {
|
|
$weekend = 1;
|
|
$shl = $cekLibur[0]['NAMA_SHL'];
|
|
} else {
|
|
$weekend = 0;
|
|
}
|
|
}
|
|
|
|
$datKunjungan = $this->Amod->getData_Kunjungan_byTGL_statusNot9($tglloop);
|
|
$namaPelanggan = "";
|
|
$nokun = 1;
|
|
foreach ($datKunjungan as $key) {
|
|
$sales_kunjungan = $key['SALES_KUNJUNGAN'];
|
|
$listSales = explode(',', $sales_kunjungan);
|
|
foreach ($listSales as $dat) {
|
|
if ($karyawan_id==$dat OR $karyawan_id==0) {
|
|
$namaPel = $key['PELANGGAN_KUNJUNGAN'];
|
|
$idKun = $key['ID_KUNJUNGAN'];
|
|
$ciptaKun = $key['CIPTA_KUNJUNGAN'];
|
|
$ubahKun = $key['UBAH_KUNJUNGAN'];
|
|
$namaPelanggan .= "<p class='text-left' style='font-size:10px;border:1px solid black; padding:2px;background-color:DarkCyan'><b style='color:White'>[$nokun] $namaPel</b> <a onclick='isiInfoKunjungan($idKun, `$ciptaKun`, `$ubahKun`)' data-toggle='modal' data-target='#modalInfo'><i class='fa fa-search text-info'></i></a>
|
|
 <a onclick='isiUbahKunjungan($idKun)' data-toggle='modal' data-target='#modalUbah'><i class='fa fa-pencil text-warning'></i></a> <a onclick='isiHapusKunjungan($idKun)' data-toggle='modal' data-target='#modalHapus'><i class='fa fa-times' style='color:Red'></i></a></p>";
|
|
$nokun++;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
$data[$no] = [
|
|
'TANGGAL' => $tglAwal++,
|
|
'SEKARANG' => $tglloop,
|
|
'WEEKEND' => $weekend,
|
|
'SHL' => $shl,
|
|
'PEL' => $namaPelanggan,
|
|
'FADE' => '0'
|
|
];
|
|
|
|
$tglloop = strtotime(date("Y-m-d", strtotime($tglloop)) . " +1 days");
|
|
$tglloop = date('Y-m-d',$tglloop);
|
|
}
|
|
|
|
//Minggu setelah akhir Bulan
|
|
if ($no>34) {
|
|
$totWeeks++;
|
|
}
|
|
|
|
$noawal = $no;
|
|
for ($no = $noawal; $no<=41; $no++) {
|
|
$tglNew = date_format(date_create($tglloop),"d");
|
|
$cekMinggu = date_format(date_create($tglloop),"w");
|
|
$shl = "Libur";
|
|
if ($cekMinggu=="0") {
|
|
$weekend = 1;
|
|
} else {
|
|
$cekLibur = $this->Amod->getData_SetHariLibur_byTGL($tglloop);
|
|
if ($cekLibur==TRUE) {
|
|
$weekend = 1;
|
|
$shl = $cekLibur[0]['NAMA_SHL'];
|
|
} else {
|
|
$weekend = 0;
|
|
}
|
|
}
|
|
|
|
$datKunjungan = $this->Amod->getData_Kunjungan_byTGL_statusNot9($tglloop);
|
|
$namaPelanggan = "";
|
|
foreach ($datKunjungan as $key) {
|
|
$sales_kunjungan = $key['SALES_KUNJUNGAN'];
|
|
$listSales = explode(',', $sales_kunjungan);
|
|
foreach ($listSales as $dat) {
|
|
if ($karyawan_id==$dat) {
|
|
$namaPel = $key['PELANGGAN_KUNJUNGAN'];
|
|
$namaPelanggan .= "$namaPel";
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
$data[$no] = [
|
|
'TANGGAL' => (int)$tglNew,
|
|
'SEKARANG' => $tglloop,
|
|
'WEEKEND' => $weekend,
|
|
'SHL' => $shl,
|
|
'PEL' => $namaPelanggan,
|
|
'FADE' => '1'
|
|
];
|
|
|
|
if ($cekMinggu==6) {
|
|
break;
|
|
}
|
|
|
|
$tglloop = strtotime(date("Y-m-d", strtotime($tglloop)) . " +1 days");
|
|
$tglloop = date('Y-m-d',$tglloop);
|
|
}
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'data' => $data,
|
|
'total' => sizeof($data),
|
|
'totWeeks' => $totWeeks,
|
|
]);
|
|
}
|
|
|
|
public function GE_Ambil_DataLinkKlaimProgram() {
|
|
$id_pkpr = $this->input->post('id_pkpr');
|
|
$id_merk = $this->input->post('id_merk');
|
|
$id_produk = $this->input->post('id_produk');
|
|
$search = $this->input->post('search');
|
|
|
|
$data = $this->Amod->getData_LinkKlaimProgram_byPKPR_byMERK_byPRODUK_RKPRNull($id_pkpr, $id_merk, $id_produk, $search);
|
|
$datPkpr = $this->Amod->getData_PotonganKlaimProgram_byID($id_pkpr);
|
|
|
|
$this->output_json([
|
|
'total' => sizeof($data),
|
|
'data' => $data,
|
|
'namaPromo' => $datPkpr[0]['NAMA_PKPR'],
|
|
]);
|
|
}
|
|
|
|
public function GE_Ambil_DataPelanggan() { // Validasi
|
|
$verse = $this->input->post('verse');
|
|
$id_pelanggan = $this->input->post('id_pelanggan');
|
|
|
|
if ($verse==1) { // Ambil Data sebagai Autocomplete
|
|
$datPelanggan = $this->Amod->getData_Pelanggan_bySTATUS(1);
|
|
|
|
$data = [];
|
|
foreach ($datPelanggan as $key) {
|
|
$nama_pelanggan = $key['NAMA_PELANGGAN'];
|
|
$hasil = "$nama_pelanggan";
|
|
array_push($data, $hasil);
|
|
}
|
|
} else if ($verse==2) { // Ambil Data Spesifik ID
|
|
$data = $this->Amod->getData_Pelanggan_byID($id_pelanggan);
|
|
}
|
|
|
|
$this->output_json([
|
|
'data' => $data,
|
|
]);
|
|
}
|
|
|
|
public function GE_Ambil_DataPembelian() { // Validasi
|
|
$verse = $this->input->post('verse');
|
|
$id_pembelian = $this->input->post('id_pembelian');
|
|
$hak = $this->input->post('hak');
|
|
$search = $this->input->post('search');
|
|
$limit = date('Y-m-01');
|
|
$now = date('Y-m-d');
|
|
|
|
if ($verse!=2) {
|
|
$peng = 0;
|
|
if ($verse==1) { // Ambil Data yang Belum diproses oleh gudang
|
|
$data = $this->Amod->getData_Pembelian_statusNull();
|
|
} else if ($verse==3) { // Ambil Data yang menunggu Proses Gudang
|
|
$data = $this->Amod->getData_Pembelian_bySTATUS(0);
|
|
} else if ($verse==4) { // Ambil Data yang Stok Ditahan
|
|
$data = $this->Amod->getData_Pembelian_tahanNotNull();
|
|
} else if ($verse==5) { // Ambil Data selesai Kunci Periode Bulan ini
|
|
$data = $this->Amod->getData_Pembelian_bySTATUS_byLIMIT_orderDESC(1, $limit);
|
|
} else if ($verse==6) { // Ambil Data dengan Potongan Pembelian Terisi Periode Bulan ini
|
|
$data = $this->Amod->getData_Pembelian_bySTATUS_byLIMIT_potonganNotNull(1, $limit);
|
|
} else if ($verse==7) { // Ambil Data dengan Potongan Pembelian Kosong Periode Bulan ini
|
|
$data = $this->Amod->getData_Pembelian_bySTATUS_byLIMIT_potonganNull(1, $limit);
|
|
} else if ($verse==8 OR $verse==9) {
|
|
if ($hak<=1) {
|
|
$awal = $limit;
|
|
} else if ($hak==2) {
|
|
$awal = $this->Amod->generate_subMonth($limit, 3);
|
|
} else if ($hak>=3) {
|
|
$awal = $this->Amod->generate_subYear($limit, 1);
|
|
}
|
|
if ($verse==8) { // Ambil Data Selesai dengan Limit Tertentu sesuai Hak
|
|
$data = $this->Amod->getData_Pembelian_byPERIODE_bySEARCH_status1_limit10($awal, $now, $search);
|
|
} else if ($verse==9) { // Ambil Data Selesai yang TT/FP belum terisi dengan Limit Tertentu
|
|
$data = $this->Amod->getData_Pembelian_byPERIODE_fpNull_ttNull($awal, $now);
|
|
}
|
|
$peng++;
|
|
} else if ($verse==10) { // Ambil Data semua Status
|
|
$data = $this->Amod->getData_Pembelian_bySEARCH_allStatus_limit10($search);
|
|
} else if ($verse==11) { // Ambil Data Periode 2 Minggu kebelakang - Stok Datang
|
|
$limit = $this->Amod->generate_subDay($now, 14);
|
|
$data = $this->Amod->getData_Pembelian_bySTATUS_byLIMIT_orderDESC(1, $limit);
|
|
$no = 0;
|
|
foreach ($data as $key) {
|
|
$datDb = $this->Amod->getData_DaftarBeli_byPEMBELIAN($key['ID_PEMBELIAN']);
|
|
$bar = "";
|
|
foreach ($datDb as $dat) {
|
|
$qty = $dat['QTY_DB'];
|
|
$korang = $dat['KODE_BARANG'];
|
|
$narang = $dat['NAMA_BARANG'];
|
|
$bar .= "<b style='color:Teal'>$qty EA $korang</b><br>$narang<br>";
|
|
}
|
|
$data[$no++] += ['BARANG' => $bar];
|
|
}
|
|
}
|
|
if ($peng==0) {
|
|
$no = 0;
|
|
foreach ($data as $key) {
|
|
$datPengadaan = $this->Amod->getData_Pengadaan_byPEMBELIAN($key['ID_PEMBELIAN']);
|
|
if ($datPengadaan==TRUE) {
|
|
$link = $datPengadaan[0]['KODE_PENGADAAN'];
|
|
} else {
|
|
$link = "";
|
|
}
|
|
$data[$no++] += ['LINK' => $link];
|
|
}
|
|
}
|
|
} else if ($verse==2) { // Ambil Data yang Spesifik ID
|
|
$data = $this->Amod->getData_Pembelian_byID($id_pembelian);
|
|
}
|
|
|
|
$this->output_json([
|
|
'data' => $data,
|
|
'total' => sizeof($data)
|
|
]);
|
|
}
|
|
|
|
public function GE_Ambil_DataPenawaran() { // Validasi
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$verse = $this->input->post('verse');
|
|
$now = date('Y-m-d');
|
|
|
|
$id_penawaran = 0;
|
|
$kode_penawaran = "";
|
|
$aktif_penawaran = "";
|
|
$jenis_penawaran = "";
|
|
$nilai_penawaran = null;
|
|
$tgl_penawaran = $now;
|
|
$salesNew = [];
|
|
$data = [];
|
|
$id_corp = "";
|
|
$ppn_penawaran = "";
|
|
$lampiran_penawaran = "";
|
|
$pelanggan_penawaran = "";
|
|
$up_penawaran = "";
|
|
$perihal_penawaran = "";
|
|
if ($verse==1) { //Ambil Data Penawaran Kosong
|
|
$datPenawaran = $this->Amod->getData_Penawaran_byKARYAWAN_bySTATUS($id_karyawan, 0);
|
|
if ($datPenawaran==FALSE) {
|
|
$aktif_penawaran = "Pertama";
|
|
} else {
|
|
$id_penawaran = $datPenawaran[0]['ID_PENAWARAN'];
|
|
$kode_penawaran = $datPenawaran[0]['KODE_PENAWARAN'];
|
|
$aktif_penawaran = $datPenawaran[0]['AKTIF_PENAWARAN'];
|
|
$jenis_penawaran = $datPenawaran[0]['JENIS_PENAWARAN'];
|
|
$tgl_penawaran = $datPenawaran[0]['TGL_PENAWARAN'];
|
|
$nilai_penawaran = $datPenawaran[0]['NILAI_PENAWARAN'];
|
|
$sales_penawaran = $datPenawaran[0]['SALES_PENAWARAN'];
|
|
$id_corp = $datPenawaran[0]['CORP_ID'];
|
|
$ppn_penawaran = round($datPenawaran[0]['PPN_PENAWARAN'],0);
|
|
$lampiran_penawaran = $datPenawaran[0]['LAMPIRAN_PENAWARAN'];
|
|
$pelanggan_penawaran = $datPenawaran[0]['PELANGGAN_PENAWARAN'];
|
|
$up_penawaran = $datPenawaran[0]['UP_PENAWARAN'];
|
|
$perihal_penawaran = $datPenawaran[0]['PERIHAL_PENAWARAN'];
|
|
|
|
$urutan = $this->Amod->generate_textUrutan($aktif_penawaran);
|
|
$aktif_penawaran = "$urutan";
|
|
|
|
$no = 0;
|
|
$listSales = explode(",", $sales_penawaran);
|
|
foreach ($listSales as $key) {
|
|
$salesNew[$no++] = $key;
|
|
}
|
|
}
|
|
} else if ($verse==2) { //Ambil Data Penawaran Existing
|
|
$id_penawaran = $this->input->post('id_penawaran');
|
|
$datPenawaran = $this->Amod->getData_Penawaran_byID($id_penawaran);
|
|
$salesNew = $datPenawaran[0]['NAMA_PANGGILAN_KARYAWAN'];
|
|
} else if ($verse==3) { // Ambil Data Grouping sesuai Tendensi
|
|
$hak = $this->input->post('hak');
|
|
$mode = $this->input->post('mode');
|
|
$id_sales = $this->input->post('id_sales');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
if ($mode>=1 AND $mode<=3) {
|
|
$datPenawaran = $this->Amod->getData_Penawaran_bySTATUS(1);
|
|
} else if ($mode==6 OR $mode==7) {
|
|
$limit = date('Y-m-01');
|
|
$limit = $this->Amod->generate_subMonth($limit, 3);
|
|
$datPenawaran = $this->Amod->getData_Penawaran_byLIMIT_allStatus_orderDESC($limit);
|
|
}
|
|
$no = 0;
|
|
foreach ($datPenawaran as $key) {
|
|
$skip = 0;
|
|
$salesChannel = "";
|
|
$salesOther = "";
|
|
$sales_penawaran = $key['SALES_PENAWARAN'];
|
|
$listSales = explode(',', $sales_penawaran);
|
|
foreach ($listSales as $dat) {
|
|
$datKaryawan = $this->Amod->getData_Karyawan_byID($dat);
|
|
$nama = $datKaryawan[0]['NAMA_PANGGILAN_KARYAWAN'];
|
|
if ($nama=="Service" OR $panggilan=="Service") {
|
|
if ($mode==6) {
|
|
$salesOther .= "$nama, ";
|
|
} else {
|
|
$skip = 1;
|
|
break;
|
|
}
|
|
} else if (strpos($datKaryawan[0]['NAMA_JABATAN'],"CHANNEL")!==FALSE OR $nama=="Anton") {
|
|
$salesChannel .= "$nama, ";
|
|
} else {
|
|
$salesOther .= "$nama, ";
|
|
}
|
|
}
|
|
if ($salesChannel!="") {
|
|
$salesChannel = substr($salesChannel, 0, -2);
|
|
}
|
|
if ($salesOther!="") {
|
|
$salesOther = substr($salesOther, 0, -2);
|
|
}
|
|
|
|
if ($hak<=2) {
|
|
if ($skip==1) {
|
|
$show = 0;
|
|
} else if (strpos($salesChannel,$panggilan)!==FALSE OR strpos($salesOther,$panggilan)!==FALSE) {
|
|
$show = 1;
|
|
if ($mode==7) {
|
|
if (strpos($salesOther,$panggilan)!==FALSE) {
|
|
if (sizeof($listSales)>1) {
|
|
$show = 1;
|
|
} else {
|
|
$show = 0;
|
|
}
|
|
}
|
|
}
|
|
} else {
|
|
$show = 0;
|
|
}
|
|
} else {
|
|
if ($skip==1) {
|
|
$show = 0;
|
|
} else {
|
|
$show = 1;
|
|
if ($mode==7) {
|
|
if ($salesChannel!="") {
|
|
if ($salesOther!="") {
|
|
$show = 1;
|
|
} else {
|
|
$show = 0;
|
|
}
|
|
} else if ($salesChannel=="" AND $salesOther!="") {
|
|
if (substr_count($salesOther, ",")>0) {
|
|
$show = 1;
|
|
} else {
|
|
$show = 0;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
if ($show==1) {
|
|
$datHpne = $this->Amod->getData_HistoriPenawaran_byPENAWARAN_orderDESC_limit1($key['ID_PENAWARAN']);
|
|
$ketLast = $datHpne[0]['KET_HPNE'];
|
|
$statLast = $datHpne[0]['NAMA_SPE'];
|
|
$tglLast = $datHpne[0]['TANGGAL'];
|
|
|
|
if ($key['JENIS_PENAWARAN']==1) {
|
|
$jenis = "PILIHAN (Tidak ada GrandTotal)";
|
|
} else if ($key['JENIS_PENAWARAN']==2) {
|
|
$jenis = "PAKET (Ada GrandTotal)";
|
|
} else if ($key['JENIS_PENAWARAN']==3) {
|
|
$jenis = "BYPASS (Langsung Nilai)";
|
|
}
|
|
|
|
if ($mode==1) {
|
|
if ($datHpne[0]['STATUS_HPNE']>=0 AND $datHpne[0]['STATUS_HPNE']<=5) {
|
|
if (strtotime($now)>=strtotime($datHpne[0]['FU_HPNE'])) {
|
|
$data[$no++] = [
|
|
'ID' => $key['ID_PENAWARAN'],
|
|
'TANGGAL' => $key['TANGGAL'],
|
|
'KOP' => $key['NAMA_KOP'],
|
|
'JENIS' => $jenis,
|
|
'KODE' => $key['KODE_PENAWARAN'],
|
|
'CIPTA' => $key['CIPTA_PENAWARAN'],
|
|
'CHANNEL' => $salesChannel,
|
|
'OTHER' => $salesOther,
|
|
'PELANGGAN' => $key['PELANGGAN_PENAWARAN'],
|
|
'UP' => $key['UP_PENAWARAN'],
|
|
'PERIHAL' => $key['PERIHAL_PENAWARAN'],
|
|
'NILAI' => $key['NILAI'],
|
|
'TGL' => $tglLast,
|
|
'KET' => $ketLast,
|
|
'STAT' => $statLast,
|
|
];
|
|
}
|
|
}
|
|
} else if ($mode==2) {
|
|
if ($datHpne[0]['STATUS_HPNE']>=0 AND $datHpne[0]['STATUS_HPNE']<=5 AND $datHpne[0]['STATUS_HPNE']!=3) {
|
|
if (strtotime($now)<strtotime($datHpne[0]['FU_HPNE'])) {
|
|
$data[$no++] = [
|
|
'ID' => $key['ID_PENAWARAN'],
|
|
'TANGGAL' => $key['TANGGAL'],
|
|
'KOP' => $key['NAMA_KOP'],
|
|
'JENIS' => $jenis,
|
|
'KODE' => $key['KODE_PENAWARAN'],
|
|
'CIPTA' => $key['CIPTA_PENAWARAN'],
|
|
'CHANNEL' => $salesChannel,
|
|
'OTHER' => $salesOther,
|
|
'PELANGGAN' => $key['PELANGGAN_PENAWARAN'],
|
|
'UP' => $key['UP_PENAWARAN'],
|
|
'PERIHAL' => $key['PERIHAL_PENAWARAN'],
|
|
'NILAI' => $key['NILAI'],
|
|
'TGL' => $tglLast,
|
|
'KET' => $ketLast,
|
|
'STAT' => $statLast,
|
|
];
|
|
}
|
|
}
|
|
} else if ($mode==3) {
|
|
if ($datHpne[0]['STATUS_HPNE']==3 AND strtotime($now)<strtotime($datHpne[0]['FU_HPNE'])) {
|
|
$data[$no++] = [
|
|
'ID' => $key['ID_PENAWARAN'],
|
|
'TANGGAL' => $key['TANGGAL'],
|
|
'KOP' => $key['NAMA_KOP'],
|
|
'JENIS' => $jenis,
|
|
'KODE' => $key['KODE_PENAWARAN'],
|
|
'CIPTA' => $key['CIPTA_PENAWARAN'],
|
|
'CHANNEL' => $salesChannel,
|
|
'OTHER' => $salesOther,
|
|
'PELANGGAN' => $key['PELANGGAN_PENAWARAN'],
|
|
'UP' => $key['UP_PENAWARAN'],
|
|
'PERIHAL' => $key['PERIHAL_PENAWARAN'],
|
|
'NILAI' => $key['NILAI'],
|
|
'TGL' => $tglLast,
|
|
'KET' => $ketLast,
|
|
'STAT' => $statLast,
|
|
];
|
|
}
|
|
} else if ($mode==6) {
|
|
if ($datHpne[0]['STATUS_HPNE']>=0 AND $datHpne[0]['STATUS_HPNE']<=5) {
|
|
$data[$no++] = [
|
|
'ID' => $key['ID_PENAWARAN'],
|
|
'TANGGAL' => $key['TANGGAL'],
|
|
'KOP' => $key['NAMA_KOP'],
|
|
'JENIS' => $jenis,
|
|
'KODE' => $key['KODE_PENAWARAN'],
|
|
'CIPTA' => $key['CIPTA_PENAWARAN'],
|
|
'CHANNEL' => $salesChannel,
|
|
'OTHER' => $salesOther,
|
|
'PELANGGAN' => $key['PELANGGAN_PENAWARAN'],
|
|
'UP' => $key['UP_PENAWARAN'],
|
|
'PERIHAL' => $key['PERIHAL_PENAWARAN'],
|
|
'NILAI' => $key['NILAI'],
|
|
];
|
|
}
|
|
} else if ($mode==7) {
|
|
$sumDpne = $this->Amod->getSum_DaftarPenawaran_byPENAWARAN_byVERSI_groupSALES($key['ID_PENAWARAN'], $key['AKTIF_PENAWARAN']);
|
|
$noklaim = 1;
|
|
$klaim = "";
|
|
foreach ($sumDpne as $keydat) {
|
|
$nasal = $keydat['NAMA_PANGGILAN_KARYAWAN'];
|
|
$tosal = number_format($keydat['TOTAL'], 2);
|
|
$klaim .= "<b style='color:DarkSlateGray'>[$noklaim]</b> <b style='color:Chocolate'>$nasal</b> <b style='color:Crimson'>($tosal)</b><br>";
|
|
$noklaim++;
|
|
}
|
|
|
|
$data[$no++] = [
|
|
'ID' => $key['ID_PENAWARAN'],
|
|
'TANGGAL' => $key['TANGGAL'],
|
|
'KOP' => $key['NAMA_KOP'],
|
|
'JENIS' => $jenis,
|
|
'KODE' => $key['KODE_PENAWARAN'],
|
|
'CIPTA' => $key['CIPTA_PENAWARAN'],
|
|
'CHANNEL' => $salesChannel,
|
|
'OTHER' => $salesOther,
|
|
'PELANGGAN' => $key['PELANGGAN_PENAWARAN'],
|
|
'UP' => $key['UP_PENAWARAN'],
|
|
'PERIHAL' => $key['PERIHAL_PENAWARAN'],
|
|
'NILAI' => $key['NILAI'],
|
|
'KLAIM' => $klaim,
|
|
];
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'data' => $data,
|
|
'total' => sizeof($data),
|
|
'id_penawaran' => $id_penawaran,
|
|
'kode_penawaran' => $kode_penawaran,
|
|
'aktif_penawaran' => $aktif_penawaran,
|
|
'jenis_penawaran' => $jenis_penawaran,
|
|
'tgl_penawaran' => $tgl_penawaran,
|
|
'nilai_penawaran' => $nilai_penawaran,
|
|
'sales_penawaran' => $salesNew,
|
|
'id_corp' => $id_corp,
|
|
'ppn_penawaran' => $ppn_penawaran,
|
|
'lampiran_penawaran' => $lampiran_penawaran,
|
|
'pelanggan_penawaran' => $pelanggan_penawaran,
|
|
'up_penawaran' => $up_penawaran,
|
|
'perihal_penawaran' => $perihal_penawaran,
|
|
]);
|
|
}
|
|
|
|
public function GE_Ambil_DataPengadaan() { // Validasi
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$verse = $this->input->post('verse');
|
|
$id_ssp = $this->input->post('id_ssp');
|
|
$id_pengadaan = $this->input->post('id_pengadaan');
|
|
$status_pengadaan = $this->input->post('status_pengadaan');
|
|
$mode = $this->input->post('mode');
|
|
|
|
$kode_pengadaan = "";
|
|
$id_supplier = "";
|
|
$id_corp = "";
|
|
$po_pengadaan = "";
|
|
$potongan_pengadaan = "";
|
|
$potongan = "";
|
|
$data = [];
|
|
if ($verse==1) { //Ambil Data Pengadaan Kosong
|
|
$datPengadaan = $this->Amod->getData_Pengadaan_byKARYAWAN_bySTATUS_bySSP($id_karyawan, 0, $id_ssp);
|
|
if ($datPengadaan==FALSE) {
|
|
$id_pengadaan = 0;
|
|
} else {
|
|
$id_pengadaan = $datPengadaan[0]['ID_PENGADAAN'];
|
|
$kode_pengadaan = $datPengadaan[0]['KODE_PENGADAAN'];
|
|
$id_supplier = $datPengadaan[0]['SUPPLIER_ID'];
|
|
$id_corp = $datPengadaan[0]['CORP_ID'];
|
|
$po_pengadaan = $datPengadaan[0]['PO_PENGADAAN'];
|
|
$potongan_pengadaan = $datPengadaan[0]['POTONGAN_PENGADAAN'];
|
|
$potongan = $datPengadaan[0]['POTONGAN'];
|
|
}
|
|
} else if ($verse==2) { //Ambil Data Spesifik ID
|
|
$datPengadaan = $this->Amod->getData_Pengadaan_byID($id_pengadaan);
|
|
$kode_pengadaan = $datPengadaan[0]['KODE_PENGADAAN'];
|
|
$id_supplier = $datPengadaan[0]['SUPPLIER_ID'];
|
|
$id_corp = $datPengadaan[0]['CORP_ID'];
|
|
$po_pengadaan = $datPengadaan[0]['PO_PENGADAAN'];
|
|
$potongan_pengadaan = $datPengadaan[0]['POTONGAN_PENGADAAN'];
|
|
$potongan = $datPengadaan[0]['POTONGAN'];
|
|
} else if ($verse==3) { //Ambil Data Semua Data dengan status tertentu
|
|
$data = $this->Amod->getData_Pengadaan_bySTATUS($status_pengadaan);
|
|
$no = 0;
|
|
foreach ($data as $key) {
|
|
$datDpg = $this->Amod->getData_DaftarPengadaan_byPENGADAAN($key['ID_PENGADAAN']);
|
|
$list = "";
|
|
$nolist = 1;
|
|
foreach ($datDpg as $dat) {
|
|
$qty = $dat['QTY_DPG'];
|
|
$kode = $dat['KODE_BARANG'];
|
|
$nama = $dat['NAMA_BARANG'];
|
|
if ($nolist==count($datDpg)) {
|
|
if ($mode==1) {
|
|
$list .= "<b style='color:SlateBlue'>[$qty EA]</b> <b style='color:Crimson'>$kode</b><br>$nama<br>";
|
|
} else if ($mode==2) {
|
|
$list .= "[$qty EA] $kode";
|
|
}
|
|
} else {
|
|
if ($mode==1) {
|
|
$list .= "<b style='color:SlateBlue'>[$qty EA]</b> <b style='color:Crimson'>$kode</b><br>$nama<br><br>";
|
|
} else if ($mode==2) {
|
|
$list .= "[$qty EA] $kode, ";
|
|
}
|
|
$nolist++;
|
|
}
|
|
}
|
|
$data[$no++] += ['LIST' => $list];
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'data' => $data,
|
|
'total' => sizeof($data),
|
|
'id_pengadaan' => $id_pengadaan,
|
|
'kode_pengadaan' => $kode_pengadaan,
|
|
'id_supplier' => $id_supplier,
|
|
'id_corp' => $id_corp,
|
|
'po_pengadaan' => $po_pengadaan,
|
|
'potongan_pengadaan' => $potongan_pengadaan,
|
|
'potongan' => $potongan
|
|
]);
|
|
}
|
|
|
|
public function GE_Ambil_DataPengingatPiutang() {
|
|
$data = $this->Amod->getData_PengingatPiutang_bySTATUS(0);
|
|
$no = 0;
|
|
$now = date('Y-m-d');
|
|
foreach ($data as $key) {
|
|
$datPda = $this->Amod->getSum_HasilHitungPda_byPELANGGAN_byTEMPO_forPiutangDagang($key['PELANGGAN_ID'], $now);
|
|
$textPda = "";
|
|
foreach ($datPda as $dat) {
|
|
$corp = $this->Amod->generate_inisialCorp($dat['KOP_ID']);
|
|
$tempo = $dat['TEMPO'];
|
|
$inv = $dat['INV_PENJUALAN'];
|
|
$nilai = $dat['SELISIH'];
|
|
$textPda .= "<b style='color:Black'>[<b style='color:DarkOrchid'>$corp</b> | <b style='color:DarkSlateGray'>$tempo</b>] <b style='color:Teal'>$inv</b> | <b style='color:Chocolate'>$nilai</b></b><br>";
|
|
}
|
|
|
|
$data[$no++] += ['PDA' => $textPda];
|
|
}
|
|
|
|
$this->output_json([
|
|
'data' => $data,
|
|
'total' => sizeof($data),
|
|
]);
|
|
}
|
|
|
|
public function GE_Ambil_DataPricelist() {
|
|
$verse = $this->input->post('verse');
|
|
$id_pricelist = $this->input->post('id_pricelist');
|
|
$id_ssp = $this->input->post('id_ssp');
|
|
|
|
$kolom = [];
|
|
if ($verse==1) { // Ambil Kolom terinput
|
|
$data = $this->Amod->getData_Pricelist_byID($id_pricelist);
|
|
$listKolom = explode(",",$data[0]['KOLOM_PRICELIST']);
|
|
$no = 0;
|
|
foreach ($listKolom as $key) {
|
|
$kolom[$no++] = $key;
|
|
}
|
|
} else if ($verse==2) { // Ambil Data berdasarkan id_ssp
|
|
$data = $this->Amod->getData_Pricelist_bySSP($id_ssp);
|
|
}
|
|
|
|
$this->output_json([
|
|
'data' => $data,
|
|
'total' => sizeof($data),
|
|
'kolom' => $kolom,
|
|
]);
|
|
}
|
|
|
|
public function GE_Ambil_DataPotonganKlaimProgram() {
|
|
$datPkpr = $this->Amod->getData_PotonganKlaimProgram();
|
|
|
|
$potPromo = [];
|
|
foreach ($datPkpr as $key) {
|
|
$nama_pkpr = $key['NAMA_PKPR'];
|
|
$hasil = "$nama_pkpr";
|
|
array_push($potPromo, $hasil);
|
|
}
|
|
|
|
$this->output_json([
|
|
'potPromo' => $potPromo,
|
|
]);
|
|
}
|
|
|
|
public function GE_Ambil_DataReturPembelian() { // Validasi
|
|
$verse = $this->input->post('verse');
|
|
$id_rb = $this->input->post('id_rb');
|
|
$search = $this->input->post('search');
|
|
|
|
if ($verse==1) { // Ambil Data sesuai Status
|
|
$data = $this->Amod->getData_ReturPembelian_bySTATUS(0);
|
|
$no = 0;
|
|
foreach ($data as $key) {
|
|
$sumDrb = $this->Amod->getSum_DaftarReturBeli_byRB($key['ID_RB']);
|
|
$dppDrb = $sumDrb[0]['TOTAL'];
|
|
$ppnDrb = round($dppDrb*($key['PPN_PEMBELIAN']/100),2);
|
|
$nilai = $dppDrb+$ppnDrb;
|
|
|
|
$data[$no++] += ['NILAI' => number_format($nilai, 2)];
|
|
}
|
|
} else if ($verse==2) { // Ambil Spesifik ID
|
|
$data = $this->Amod->getData_ReturPembelian_byID($id_rb);
|
|
} else if ($verse==3) { // Ambil Data semua Status
|
|
$data = $this->Amod->getData_ReturPembelian_bySEARCH_limit10($search);
|
|
} else if ($verse==4) { // Ambil Spesifik ID, Link Cetak Dokumen
|
|
$data = $this->Amod->getData_ReturPembelian_byID_linkCetakDokumen($id_rb);
|
|
}
|
|
|
|
$this->output_json([
|
|
'data' => $data,
|
|
'total' => sizeof($data),
|
|
]);
|
|
}
|
|
|
|
public function GE_Ambil_DataSalesOrder() { // Validasi
|
|
$verse = $this->input->post('verse');
|
|
$search = $this->input->post('search');
|
|
$mode = $this->input->post('mode');
|
|
$id_so = $this->input->post('id_so');
|
|
$alur_so = $this->input->post('alur_so');
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$now = date('Y-m-d');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
if ($verse==1) { // Cari SO yang kondisinya Tidak Batal untuk Cetak Penjualan
|
|
if ($mode==1) {
|
|
$awal = date('Y-m-01');
|
|
$akhir = date('Y-m-d');
|
|
} else if ($mode==2) {
|
|
$awal = date('Y-m-01');
|
|
$akhir = date('Y-m-d');
|
|
}
|
|
$data = $this->Amod->getData_SalesOrder_byPERIODE_bySEARCH_limit20_forCetak($awal, $akhir, $search);
|
|
} else if ($verse==2) { // Cari SO semua statusnya
|
|
$data = $this->Amod->getData_SalesOrder_bySEARCH_limit20_allStatus($search);
|
|
} else if ($verse==3) { // Munculkan Data sesuai Hak Admin SO, yang Belum Proses
|
|
$datShas = $this->Amod->getData_SetHakAdminSo_byKARYAWAN($id_karyawan);
|
|
$data = [];
|
|
$no = 0;
|
|
foreach ($datShas as $key) {
|
|
$datSo = $this->Amod->getData_SalesOrder_bySALES_statusNull($key['HAK_ID']);
|
|
foreach ($datSo as $dat) {
|
|
$data[$no++] = $dat;
|
|
}
|
|
}
|
|
sort($data);
|
|
} else if ($verse==4) { // Ambil data sesuai ID
|
|
$data = $this->Amod->getData_SalesOrder_byID($id_so);
|
|
} else if ($verse==5) { // Munculkan Data sesuai Hak Admin SO, yang Disiapkan Gudang
|
|
$datShas = $this->Amod->getData_SetHakAdminSo_byKARYAWAN($id_karyawan);
|
|
$data = [];
|
|
$no = 0;
|
|
foreach ($datShas as $key) {
|
|
$datSo = $this->Amod->getData_SalesOrder_bySALES_bySTATUS($key['HAK_ID'], 0);
|
|
foreach ($datSo as $dat) {
|
|
$datDo = $this->Amod->getData_DaftarOrder_bySO($dat['ID_SO']);
|
|
$nodo = 0;
|
|
$listdo = "";
|
|
foreach ($datDo as $dit) {
|
|
$sumDo = $this->Amod->getSum_DaftarOrder_byBARANG_status0_2_3($dit['BARANG_ID']);
|
|
$qty_hhbso = $sumDo[0]['TOTAL'];
|
|
$kuantitiNow = $this->GE_AmbilData_DataKuantiti($dit['BARANG_ID'], 0);
|
|
|
|
if ($dit['TYPE_JENIS']==2) {
|
|
$status_hhbso = 1;
|
|
} else if ($kuantitiNow==0) {
|
|
$status_hhbso = 0;
|
|
} else if ($kuantitiNow==$qty_hhbso) {
|
|
$status_hhbso = 3;
|
|
} else if ($kuantitiNow<$qty_hhbso) {
|
|
$status_hhbso = 2;
|
|
} else {
|
|
$status_hhbso = 1;
|
|
}
|
|
|
|
$datHhbso = $this->Amod->getData_HasilHitungBarangSo_byBARANG($dit['BARANG_ID']);
|
|
if ($datHhbso==FALSE) {
|
|
$input = [
|
|
'BARANG_ID' => $dit['BARANG_ID'],
|
|
'QTY_HHBSO' => $qty_hhbso,
|
|
'STOK_HHBSO' => $kuantitiNow,
|
|
'STATUS_HHBSO' => $status_hhbso,
|
|
'LAST_HHBSO' => $timestamp
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungbarangso', $input);
|
|
} else {
|
|
$update = [
|
|
'QTY_HHBSO' => $qty_hhbso,
|
|
'STOK_HHBSO' => $kuantitiNow,
|
|
'STATUS_HHBSO' => $status_hhbso,
|
|
'LAST_HHBSO' => $timestamp
|
|
];
|
|
$action = $this->Amod->update('hasil_hitungbarangso', $update, 'ID_HHBSO', $datHhbso[0]['ID_HHBSO']);
|
|
}
|
|
$qtydo = $dit['QTY_DO'];
|
|
$korang = $dit['KODE_BARANG'];
|
|
if ($status_hhbso==0) {
|
|
$listdo .= "<b style='color:Red'><i class='fa fa-ban'></i> $qtydo $korang</b><br>";
|
|
} else if ($status_hhbso==1) {
|
|
$listdo .= "<b style='color:DarkSlateGray'><i class='fa fa-check'></i> $qtydo $korang</b><br>";
|
|
} else if ($status_hhbso==2) {
|
|
$listdo .= "<b style='color:DarkOrchid'><i class='fa fa-exclamation'></i> $qtydo $korang</b><br>";
|
|
} else if ($status_hhbso==3) {
|
|
$listdo .= "<b style='color:DarkKhaki'><i class='fa fa-refresh'></i> $qtydo $korang</b><br>";
|
|
}
|
|
}
|
|
$data[$no] = $dat;
|
|
$data[$no++] += ['LISTDO' => $listdo];
|
|
}
|
|
}
|
|
sort($data);
|
|
} else if ($verse==6) { // Ambil data sesuai Status Tertentu
|
|
$data = $this->Amod->getData_SalesOrder_bySTATUS(0);
|
|
$no = 0;
|
|
foreach ($data as $key) {
|
|
$diffawal = new DateTime($key['TGL_SO']);
|
|
$diffakhir = new DateTime($now);
|
|
$diff = date_diff($diffawal, $diffakhir);
|
|
$diff = $diff->format("%a");
|
|
|
|
$datDo = $this->Amod->getData_DaftarOrder_bySO($key['ID_SO']);
|
|
$listdo = "";
|
|
foreach ($datDo as $dat) {
|
|
$sumDo = $this->Amod->getSum_DaftarOrder_byBARANG_status0_2_3($dat['BARANG_ID']);
|
|
$qty_hhbso = $sumDo[0]['TOTAL'];
|
|
$kuantitiNow = $this->GE_AmbilData_DataKuantiti($dat['BARANG_ID'], 0);
|
|
|
|
if ($dat['TYPE_JENIS']==2) {
|
|
$status_hhbso = 1;
|
|
} else if ($kuantitiNow==0) {
|
|
$status_hhbso = 0;
|
|
} else if ($kuantitiNow==$qty_hhbso) {
|
|
$status_hhbso = 3;
|
|
} else if ($kuantitiNow<$qty_hhbso) {
|
|
$status_hhbso = 2;
|
|
} else {
|
|
$status_hhbso = 1;
|
|
}
|
|
|
|
$datHhbso = $this->Amod->getData_HasilHitungBarangSo_byBARANG($dat['BARANG_ID']);
|
|
if ($datHhbso==FALSE) {
|
|
$input = [
|
|
'BARANG_ID' => $dat['BARANG_ID'],
|
|
'QTY_HHBSO' => $qty_hhbso,
|
|
'STOK_HHBSO' => $kuantitiNow,
|
|
'STATUS_HHBSO' => $status_hhbso,
|
|
'LAST_HHBSO' => $timestamp
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungbarangso', $input);
|
|
} else {
|
|
$update = [
|
|
'QTY_HHBSO' => $qty_hhbso,
|
|
'STOK_HHBSO' => $kuantitiNow,
|
|
'STATUS_HHBSO' => $status_hhbso,
|
|
'LAST_HHBSO' => $timestamp
|
|
];
|
|
$action = $this->Amod->update('hasil_hitungbarangso', $update, 'ID_HHBSO', $datHhbso[0]['ID_HHBSO']);
|
|
}
|
|
$qtydo = $dat['QTY_DO'];
|
|
$korang = $dat['KODE_BARANG'];
|
|
if ($status_hhbso==0) {
|
|
$listdo .= "<b style='color:Red'><i class='fa fa-ban'></i> $qtydo $korang</b><br>";
|
|
} else if ($status_hhbso==1) {
|
|
$listdo .= "<b style='color:DarkSlateGray'><i class='fa fa-check'></i> $qtydo $korang</b><br>";
|
|
} else if ($status_hhbso==2) {
|
|
$listdo .= "<b style='color:DarkOrchid'><i class='fa fa-exclamation'></i> $qtydo $korang</b><br>";
|
|
} else if ($status_hhbso==3) {
|
|
$listdo .= "<b style='color:DarkKhaki'><i class='fa fa-refresh'></i> $qtydo $korang</b><br>";
|
|
}
|
|
}
|
|
|
|
$data[$no] += ['LISTDO' => $listdo];
|
|
$data[$no++] += ['DIFF' => $diff];
|
|
}
|
|
} else if ($verse==7) { // Ambil data SO Siap Kirim, belum terbit SJ
|
|
$data = $this->Amod->getData_SalesOrder_bySTATUS_afterTGL(1, "2026-06-01");
|
|
$no = 0;
|
|
foreach ($data as $key) {
|
|
$datQc = $this->Amod->getData_QualityControl_bySO($key['ID_SO']);
|
|
$listqc = "";
|
|
$noqc = 1;
|
|
foreach ($datQc as $qc) {
|
|
$qckar = $qc['NAMA_PANGGILAN_KARYAWAN'];
|
|
if ($noqc==count($datQc)) {
|
|
$listqc .= "$qckar";
|
|
} else {
|
|
$listqc .= "$qckar, ";
|
|
$noqc++;
|
|
}
|
|
}
|
|
|
|
$datDo = $this->Amod->getData_DaftarOrder_bySO($key['ID_SO']);
|
|
$listdo = "";
|
|
foreach ($datDo as $dat) {
|
|
$qtydo = $dat['QTY_DO'];
|
|
$korang = $dat['KODE_BARANG'];
|
|
$listdo .= "<b style='color:Olive'><i class='fa fa-check'></i> $qtydo $korang</b><br>";
|
|
}
|
|
|
|
$data[$no] += ['LISTQC' => $listqc];
|
|
$data[$no++] += ['LISTDO' => $listdo];
|
|
}
|
|
} else if ($verse==8) { // Ambil data SO berdasarkan Alur dan Status yang dipilih
|
|
$data = $this->Amod->getData_SalesOrder_byALUR_statusUntil1($alur_so);
|
|
}
|
|
|
|
$this->output_json([
|
|
'data' => $data,
|
|
'total' => sizeof($data),
|
|
]);
|
|
}
|
|
|
|
public function GE_Ambil_DataSatuan() {
|
|
$id_satuan = $this->input->post('id_satuan');
|
|
|
|
$data = $this->Amod->getData_Satuan_byID($id_satuan);
|
|
|
|
$this->output_json([
|
|
'data' => $data,
|
|
]);
|
|
}
|
|
|
|
public function GE_Ambil_DataSetHakAdminSo() { // Validasi
|
|
$verse = $this->input->post('verse');
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
|
|
if ($verse==1) { // Ambil Semua Data yang sesuai dengan ID Karyawan
|
|
$data = $this->Amod->getData_SetHakAdminSo_byKARYAWAN($id_karyawan);
|
|
}
|
|
|
|
$this->output_json([
|
|
'data' => $data,
|
|
'total' => sizeof($data),
|
|
]);
|
|
}
|
|
|
|
public function GE_Ambil_DataSjPenjualan() { // Validasi
|
|
$verse = $this->input->post('verse');
|
|
$limit = date('Y-m-01');
|
|
|
|
if ($verse==1) { // Ambil Semua Data yang belum ditarik SJ
|
|
$data = $this->Amod->getData_SjPenjualan_bySTATUS_byTGL(1, $limit);
|
|
}
|
|
|
|
$this->output_json([
|
|
'data' => $data,
|
|
'total' => sizeof($data),
|
|
]);
|
|
}
|
|
|
|
public function GE_Ambil_DataSnBeli() {
|
|
$verse = $this->input->post('verse');
|
|
$id_db = $this->input->post('id_db');
|
|
$id_barang = $this->input->post('id_barang');
|
|
$id_pembelian = $this->input->post('id_pembelian');
|
|
|
|
$tipe = "";
|
|
$max = 0;
|
|
if ($verse==1) { // Ambil Data SN sesuai DB
|
|
$data = $this->Amod->getData_SnBeli_byDB($id_db);
|
|
$datDb = $this->Amod->getData_DaftarBeli_byID($id_db);
|
|
$max = $datDb[0]['QTY_DB'];
|
|
} else if ($verse==2) { // Ambil Data SN sesuai Pembelian dan Kode Barang
|
|
$data = $this->Amod->getData_SnBeli_byBARANG_byPEMBELIAN_bySTATUS_status0($id_barang, $id_pembelian, 1);
|
|
$datBarang = $this->Amod->getData_Barang_byID($id_barang);
|
|
$tipe = $datBarang[0]['TYPE_JENIS'];
|
|
}
|
|
|
|
$this->output_json([
|
|
'data' => $data,
|
|
'total' => sizeof($data),
|
|
'max' => $max,
|
|
'tipe' => $tipe,
|
|
]);
|
|
}
|
|
|
|
public function GE_Ambil_DataSnIo() {
|
|
$verse = $this->input->post('verse');
|
|
$id_io = $this->input->post('id_io');
|
|
|
|
$max = 0;
|
|
if ($verse==1) { // Ambil Data SN sesuai IO
|
|
$datIo = $this->Amod->getData_TransaksiStock_byID($id_io);
|
|
$datSnStock = $this->Amod->getData_SnStock_byBARANG_byGUDANG_bySTATUS($datIo[0]['BARANG_ID'], $datIo[0]['GUDANG_IO'], 0);
|
|
$datSnio = $this->Amod->getData_SnIo_byIO($id_io);
|
|
$max = $datIo[0]['QTY_IO'];
|
|
|
|
$snStockReady = [];
|
|
$no = 0;
|
|
foreach ($datSnStock as $key) {
|
|
$nama_snstock = $key['NAMA_SNSTOCK'];
|
|
$hasil = "$nama_snstock";
|
|
array_push($snStockReady, $hasil);
|
|
|
|
$datSnBeli = $this->Amod->getData_SnBeli_byNAMA($nama_snstock);
|
|
if ($datSnBeli==TRUE) {
|
|
$datDb = $this->Amod->getData_DaftarBeli_byID($datSnBeli[0]['DB_ID']);
|
|
$kop = $this->Amod->generate_inisialCorp($datDb[0]['CORP_ID']);
|
|
} else {
|
|
$kop = "OPNAME";
|
|
}
|
|
$datSnStock[$no++] += ['KOP' => $kop];
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'dataSnio' => $datSnio,
|
|
'dataSnStock' => $datSnStock,
|
|
'totalSnio' => sizeof($datSnio),
|
|
'totalSnStock' => sizeof($datSnStock),
|
|
'max' => $max,
|
|
'snStockReady' => $snStockReady,
|
|
]);
|
|
}
|
|
|
|
public function GE_Ambil_DataSnJual() {
|
|
$verse = $this->input->post('verse');
|
|
$id_do = $this->input->post('id_do');
|
|
|
|
$max = 0;
|
|
if ($verse==1) { // Ambil Data SN sesuai DO
|
|
$datDo = $this->Amod->getData_DaftarOrder_byID($id_do);
|
|
$datSo = $this->Amod->getData_SalesOrder_byID($datDo[0]['SO_ID']);
|
|
$datSnStock = $this->Amod->getData_SnStock_byBARANG_byGUDANG_bySTATUS($datDo[0]['BARANG_ID'], $datSo[0]['GUDANG_SO'], 0);
|
|
$datSnj = $this->Amod->getData_SnJual_byDO($id_do);
|
|
$max = $datDo[0]['QTY_DO'];
|
|
|
|
$no = 0;
|
|
foreach ($datSnj as $key) {
|
|
$kop = $this->Amod->generate_inisialCorp($key['KOP_SNJ']);
|
|
$datSnj[$no++] += ['KOP' => $kop];
|
|
}
|
|
|
|
$snStockReady = [];
|
|
$no = 0;
|
|
foreach ($datSnStock as $key) {
|
|
$nama_snstock = $key['NAMA_SNSTOCK'];
|
|
$hasil = "$nama_snstock";
|
|
array_push($snStockReady, $hasil);
|
|
|
|
$datSnBeli = $this->Amod->getData_SnBeli_byNAMA($nama_snstock);
|
|
if ($datSnBeli==TRUE) {
|
|
$datDb = $this->Amod->getData_DaftarBeli_byID($datSnBeli[0]['DB_ID']);
|
|
$kop = $this->Amod->generate_inisialCorp($datDb[0]['CORP_ID']);
|
|
} else {
|
|
$kop = "OPNAME";
|
|
}
|
|
$datSnStock[$no++] += ['KOP' => $kop];
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'dataSnj' => $datSnj,
|
|
'dataSnStock' => $datSnStock,
|
|
'totalSnj' => sizeof($datSnj),
|
|
'totalSnStock' => sizeof($datSnStock),
|
|
'max' => $max,
|
|
'snStockReady' => $snStockReady,
|
|
]);
|
|
}
|
|
|
|
public function GE_Ambil_DataSnStock() {
|
|
$verse = $this->input->post('verse');
|
|
$search = $this->input->post('search');
|
|
$id_snstock = $this->input->post('id_snstock');
|
|
|
|
if ($verse==1) { // Ambil Semua SN yang statusnya Ready Jual di PCM + ITP
|
|
$data = $this->Amod->getData_SnStock_byMODE_bySEARCH_allStatus_limit20($verse, $search);
|
|
} else if ($verse==2) { // Ambil Data Spesifik ID
|
|
$data = $this->Amod->getData_SnStock_byID($id_snstock);
|
|
}
|
|
|
|
$this->output_json([
|
|
'data' => $data,
|
|
'total' => sizeof($data),
|
|
]);
|
|
}
|
|
|
|
public function GE_Ambil_DataSubmenuPricelist() {
|
|
$verse = $this->input->post('verse');
|
|
$id_pricelist = $this->input->post('id_pricelist');
|
|
|
|
$namaPricelist = "";
|
|
$kolom = [];
|
|
if ($verse==1) { // Ambil Submenu dari id_pricelist
|
|
$datPricelist = $this->Amod->getData_Pricelist_byID($id_pricelist);
|
|
|
|
$listKolom = explode(",",$datPricelist[0]['KOLOM_PRICELIST']);
|
|
$no = 0;
|
|
foreach ($listKolom as $key) {
|
|
$kolom[$no++] = $key;
|
|
}
|
|
|
|
$data = $this->Amod->getData_SubmenuPricelist_byPRICELIST_orderURUTAN($id_pricelist);
|
|
$no = 0;
|
|
foreach ($data as $key) {
|
|
$datDfpl = $this->Amod->getData_DaftarPricelist_bySMPL($key['ID_SMPL']);
|
|
if ($datDfpl==TRUE) {
|
|
$lock = 1;
|
|
} else {
|
|
$lock = 0;
|
|
}
|
|
$data[$no++] += ['LOCK' => $lock];
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'data' => $data,
|
|
'total' => sizeof($data),
|
|
'namaPricelist' => $namaPricelist,
|
|
'kolom' => $kolom,
|
|
]);
|
|
}
|
|
|
|
public function GE_Ambil_DataSupplier() {
|
|
$verse = $this->input->post('verse');
|
|
$status = $this->input->post('status');
|
|
$search = $this->input->post('search');
|
|
|
|
if ($verse==1) { // Ambil Semua Supplier yang Statusnya sesuai
|
|
$data = $this->Amod->getData_Supplier_bySTATUS($status);
|
|
} else if ($verse==2) { // Ambil Supplier yang ada pilihan Cari
|
|
$data = $this->Amod->getData_Supplier_bySEARCH_status1_limit20($search);
|
|
}
|
|
|
|
$this->output_json([
|
|
'data' => $data,
|
|
]);
|
|
}
|
|
|
|
public function GE_Ambil_DataTransaksiStock() {
|
|
$verse = $this->input->post('verse');
|
|
$id_cabutan = $this->input->post('id_cabutan');
|
|
$id_so = $this->input->post('id_so');
|
|
$now = date('Y-m-d');
|
|
|
|
$kode = "";
|
|
$sn = "";
|
|
$limit = "";
|
|
if ($verse==1) { // Ambil Data Transaksi Stock Cabutan Baru
|
|
$data = $this->Amod->getData_TransaksiStock_byCABUTAN($id_cabutan);
|
|
$datCabutan = $this->Amod->getData_Cabutan_byID($id_cabutan);
|
|
if ($datCabutan[0]['KET_CABUTAN']!=NULL) {
|
|
$data[0] = [
|
|
'ID_IO' => '0',
|
|
'JENIS_IO' => '2',
|
|
'KODE_BARANG' => "",
|
|
'NAMA_BARANG' => "",
|
|
'QTY_IO' => "",
|
|
'KET_IO' => $datCabutan[0]['KET_CABUTAN']
|
|
];
|
|
}
|
|
} else if ($verse==2) { // Ambil Data Transaksi Stock Cabutan yang sudah ada
|
|
$datCabutan = $this->Amod->getData_Cabutan_byID($id_cabutan);
|
|
$kode = $datCabutan[0]['KODE_CABUTAN'];
|
|
$sn = $datCabutan[0]['NAMA_SNSTOCK'];
|
|
$limit = $datCabutan[0]['LIMIT_CABUTAN'];
|
|
$no = 0;
|
|
if ($datCabutan[0]['KET_CABUTAN']!=NULL) {
|
|
$data[$no++] = [
|
|
'ID_IO' => '0',
|
|
'JENIS_IO' => '2',
|
|
'KODE_BARANG' => "",
|
|
'NAMA_BARANG' => "",
|
|
'QTY_IO' => "",
|
|
'KET_IO' => $datCabutan[0]['KET_CABUTAN'],
|
|
];
|
|
}
|
|
|
|
$datIo = $this->Amod->getData_TransaksiStock_byCABUTAN($id_cabutan);
|
|
foreach ($datIo as $key) {
|
|
$data[$no++] = $key;
|
|
}
|
|
} else if ($verse==3) { // Ambil Data Transaksi Stock dari SO Berjalan
|
|
$data = $this->Amod->getData_TransaksiStock_bySO_statusNull($id_so);
|
|
$no = 0;
|
|
$sn = "";
|
|
foreach ($data as $key) {
|
|
$datSnio = $this->Amod->getData_SnIo_byIO($key['ID_IO']);
|
|
$nosn = 1;
|
|
foreach ($datSnio as $dat) {
|
|
$nama_snio = $dat['NAMA_SNIO'];
|
|
if ($key['QTY_IO']==$nosn) {
|
|
$sn .= "$nama_snio";
|
|
} else {
|
|
$sn .= "$nama_snio, ";
|
|
$nosn++;
|
|
}
|
|
}
|
|
|
|
$countSnio = $this->Amod->getCount_SnIo_byIO($key['ID_IO']);
|
|
$data[$no] += ['REAL' => $countSnio];
|
|
$data[$no++] += ['SN' => $sn];
|
|
|
|
$sn = "";
|
|
}
|
|
} else if ($verse==4) { // Ambil Data Transaksi Stock dari SO Terkunci
|
|
$data = $this->Amod->getData_TransaksiStock_bySO_bySTATUS($id_so, 1);
|
|
$no = 0;
|
|
$sn = "";
|
|
foreach ($data as $key) {
|
|
$datSnio = $this->Amod->getData_SnIo_byIO($key['ID_IO']);
|
|
$nosn = 1;
|
|
foreach ($datSnio as $dat) {
|
|
$nama_snio = $dat['NAMA_SNIO'];
|
|
if ($key['QTY_IO']==$nosn) {
|
|
$sn .= "$nama_snio";
|
|
} else {
|
|
$sn .= "$nama_snio, ";
|
|
$nosn++;
|
|
}
|
|
}
|
|
|
|
$countSnio = $this->Amod->getCount_SnIo_byIO($key['ID_IO']);
|
|
$data[$no] += ['REAL' => $countSnio];
|
|
$data[$no++] += ['SN' => $sn];
|
|
|
|
$sn = "";
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'data' => $data,
|
|
'total' => sizeof($data),
|
|
'kode' => $kode,
|
|
'sn' => $sn,
|
|
'limit' => $limit,
|
|
]);
|
|
}
|
|
|
|
public function GE_Ambil_MasterData() { // Validasi
|
|
$search = isset($_GET['search']) ? $_GET['search'] : '';
|
|
$verse = isset($_GET['verse']) ? $_GET['verse'] : '';
|
|
|
|
$data = [];
|
|
$no = 0;
|
|
if ($verse==1) { // Pelanggan
|
|
$datPelanggan = $this->Amod->getData_Pelanggan_bySEARCH_status1_limit10($search);
|
|
foreach ($datPelanggan as $key) {
|
|
$nama = $key['NAMA_PELANGGAN'];
|
|
$alias = $key['ALIAS_PELANGGAN'];
|
|
$top = $key['TOP_PELANGGAN'];
|
|
$kota = $key['NAMA_KOTA'];
|
|
if ($alias=="") {
|
|
$text = "$nama [$kota] - $top Hari";
|
|
} else {
|
|
$text = "$alias | $nama [$kota] - $top Hari";
|
|
}
|
|
$data[$no++] = [
|
|
'id' => $key['ID_PELANGGAN'],
|
|
'text' => $text
|
|
];
|
|
}
|
|
} else if ($verse==2) { // Barang dengan Kuantiti
|
|
|
|
} else if ($verse==3) { // Barang semua Data
|
|
$gudang = isset($_GET['gudang']) ? $_GET['gudang'] : '';
|
|
$datBarang = $this->Amod->getData_Barang_bySEARCH_byMODE_status1_limit10($search, 1, $gudang);
|
|
foreach ($datBarang as $key) {
|
|
$kode = $key['KODE_BARANG'];
|
|
$nama = $key['NAMA_BARANG'];
|
|
$jenis = $key['NAMA_JENIS'];
|
|
if ($key['TYPE_JENIS']==2) {
|
|
$qty = "Non-QTY";
|
|
} else {
|
|
$qty = $key['QTY'];
|
|
$qty = "$qty EA";
|
|
}
|
|
$data[$no++] = [
|
|
'id' => $key['ID_BARANG'],
|
|
'text' => "$qty | $kode ($nama) - $jenis"
|
|
];
|
|
}
|
|
}
|
|
|
|
echo json_encode($data);
|
|
}
|
|
|
|
public function GE_Buat_TandaTeks() {
|
|
$isi = $this->input->post('isi');
|
|
$awal = $this->input->post('awal');
|
|
$akhir = $this->input->post('akhir');
|
|
$verse = $this->input->post('verse');
|
|
|
|
if ($verse==1) {
|
|
if ($awal==$akhir) {
|
|
$hasil = $isi;
|
|
} else {
|
|
$panjang = strlen($isi);
|
|
if ($awal==0) {
|
|
$depan = "";
|
|
$tanda = substr($isi, $awal, $akhir);
|
|
if ($panjang==$akhir) {
|
|
$belakang = "";
|
|
} else {
|
|
$belakang = substr($isi, $akhir, $panjang);
|
|
}
|
|
} else {
|
|
if ($akhir==$panjang) {
|
|
$depan = substr($isi, 0, $awal);
|
|
$belakang = "";
|
|
$tanda = substr($isi, $awal, $belakang);
|
|
} else {
|
|
$depan = substr($isi, 0, $awal);
|
|
$belakang = substr($isi, $akhir, $panjang);
|
|
$tanda = substr($isi, $awal, $akhir-$awal);
|
|
}
|
|
}
|
|
$tanda = "<b style='color:Red'>$tanda</b>";
|
|
$hasil = "$depan$tanda$belakang";
|
|
}
|
|
} else if ($verse==2) {
|
|
$hasil = str_replace("<b style='color:Red'>","",$isi);
|
|
$hasil = str_replace("</b>","",$hasil);
|
|
}
|
|
|
|
$this->output_json([
|
|
'hasil' => $hasil,
|
|
]);
|
|
}
|
|
|
|
public function GE_Buat_KeteranganPenawaran() {
|
|
$verse = $this->input->post('verse');
|
|
$id = $this->input->post('id');
|
|
$cd = $this->input->post('cd');
|
|
|
|
$datPenawaran = $this->Amod->getData_Penawaran_byID($id);
|
|
if ($verse=="") {
|
|
$ket_penawaran = "";
|
|
} else {
|
|
if ($cd=="") {
|
|
$ppn_penawaran = round($datPenawaran[0]['PPN_PENAWARAN']);
|
|
if ($verse==0) {
|
|
$ppn = "belum";
|
|
} else if ($verse==1) {
|
|
$ppn = "sudah";
|
|
}
|
|
$ket_penawaran = "- <b>Harga Penawaran $ppn termasuk PPN $ppn_penawaran%</b><br>- Harga/Stok tidak mengikat, bisa berubah sewaktu-waktu tanpa pemberitahuan terlebih dahulu.<br>- Penawaran berlaku <b>1 Minggu</b> sejak tertanggal diterbitkan.<br>- Pemesanan berdasarkan PO atau Surat Pemesanan.";
|
|
} else {
|
|
$datHcd = $this->Amod->getData_HistoriCetakDokumen_byCD_orderDESC_limit1($cd);
|
|
$ket_penawaran = $datHcd[0]['KET_HCD'];
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'ket_penawaran' => $ket_penawaran,
|
|
]);
|
|
}
|
|
|
|
public function GE_Buat_ListSalesPenawaran() {
|
|
$id = $this->input->post('id');
|
|
|
|
$datPenawaran = $this->Amod->getData_Penawaran_byID($id);
|
|
|
|
$listSales = [];
|
|
$noSales = 0;
|
|
$sales = explode(",", $datPenawaran[0]['SALES_PENAWARAN']);
|
|
foreach ($sales as $key) {
|
|
$datKaryawan = $this->Amod->getData_Karyawan_byID($key);
|
|
$listSales[$noSales++] = [
|
|
'ID_KARYAWAN' => $key,
|
|
'NAMA_PANGGILAN_KARYAWAN' => $datKaryawan[0]['NAMA_PANGGILAN_KARYAWAN']
|
|
];
|
|
}
|
|
|
|
$this->output_json([
|
|
'listSales' => $listSales,
|
|
]);
|
|
}
|
|
|
|
public function GE_Ubah_SetGudang() {
|
|
$node = $this->input->post('node');
|
|
$menu = $this->input->post('menu');
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$datSgu = $this->Amod->getData_SetGudang_byKARYAWAN_byMENU($id_karyawan, $menu);
|
|
if ($datSgu==FALSE) {
|
|
$input = [
|
|
'KARYAWAN_ID' => $id_karyawan,
|
|
'MENU_ID' => $menu,
|
|
'AKTIF_SGU' => $node,
|
|
'TIMESTAMP' => $timestamp,
|
|
];
|
|
$action = $this->Amod->create('set_gudang', $input);
|
|
} else {
|
|
if ($node!=$datSgu[0]['AKTIF_SGU']) {
|
|
$update = [
|
|
'AKTIF_SGU' => $node,
|
|
'TIMESTAMP' => $timestamp,
|
|
];
|
|
$action = $this->Amod->update('set_gudang', $update, 'ID_SGU', $datSgu[0]['ID_SGU']);
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => '0',
|
|
]);
|
|
}
|
|
|
|
public function GE_Ubah_SetMerk() {
|
|
$id_merk = $this->input->post('id_merk');
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$datSme = $this->Amod->getData_SetMerk_byKARYAWAN($id_karyawan);
|
|
if ($datSme==FALSE) {
|
|
$input = [
|
|
'KARYAWAN_ID' => $id_karyawan,
|
|
'MERK_ID' => $id_merk,
|
|
'LAST_SME' => $timestamp,
|
|
];
|
|
$action = $this->Amod->create('set_merk', $input);
|
|
} else {
|
|
$update = [
|
|
'MERK_ID' => $id_merk,
|
|
'LAST_SME' => $timestamp,
|
|
];
|
|
$action = $this->Amod->update('set_merk', $update, 'ID_SME', $datSme[0]['ID_SME']);
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => '0',
|
|
]);
|
|
}
|
|
|
|
public function GE_Ubah_SetModeInclude() {
|
|
$mode = $this->input->post('mode');
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$datSmi = $this->Amod->getData_SetModeInclude_byKARYAWAN($id_karyawan);
|
|
if ($datSmi==FALSE) {
|
|
$input = [
|
|
'KARYAWAN_ID' => $id_karyawan,
|
|
'MODE_SMI' => '0',
|
|
'LAST_SMI' => $timestamp,
|
|
];
|
|
$action = $this->Amod->create('set_modeinclude', $input);
|
|
} else {
|
|
$update = [
|
|
'MODE_SMI' => $mode,
|
|
'LAST_SMI' => $timestamp,
|
|
];
|
|
$action = $this->Amod->update('set_modeinclude', $update, 'ID_SMI', $datSmi[0]['ID_SMI']);
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => '0',
|
|
]);
|
|
}
|
|
|
|
public function GE_Ubah_SetOtomasiJs() {
|
|
$atas = $this->input->post('atas');
|
|
$bawah = $this->input->post('bawah');
|
|
$verse = $this->input->post('verse');
|
|
|
|
$value = 0;
|
|
if ($verse==1 AND $bawah>$atas) {
|
|
$value = 2;
|
|
} else {
|
|
if ($verse==2 AND $atas<$bawah) {
|
|
$value = 3;
|
|
} else {
|
|
$datSojs = $this->Amod->getData_SetOtomasiJs();
|
|
$update = [
|
|
'BAWAH_SOJS' => $bawah,
|
|
'ATAS_SOJS' => $atas
|
|
];
|
|
$action = $this->Amod->update('set_otomasijs', $update, 'ID_SOJS', $datSojs[0]['ID_SOJS']);
|
|
$value = 1;
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
}
|
|
|
|
public function GE_Ubah_SetPengingatPiutang() {
|
|
$id = $this->input->post('id');
|
|
$jt = $this->input->post('jt');
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$datStpp = $this->Amod->getData_SetPengingatPiutang_byKARYAWAN($id_karyawan);
|
|
|
|
$update = [
|
|
'JT_STPP' => $jt,
|
|
'SALES_ID' => $id,
|
|
'TIMESTAMP' => $timestamp,
|
|
];
|
|
$action = $this->Amod->update('set_pengingatpiutang', $update, 'ID_STPP', $datStpp[0]['ID_STPP']);
|
|
|
|
$this->output_json([
|
|
'value' => '0',
|
|
]);
|
|
}
|
|
|
|
public function GE_Ubah_SetSalesProduk() {
|
|
$id_ssp = $this->input->post('id_ssp');
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
|
|
$datStsp = $this->Amod->getData_SetToggleSp_byKARYAWAN($id_karyawan, $id_ssp);
|
|
if ($datStsp==FALSE) {
|
|
$input = [
|
|
'KARYAWAN_ID' => $id_karyawan,
|
|
'SSP_ID' => $id_ssp
|
|
];
|
|
$action = $this->Amod->create('set_togglesp', $input);
|
|
} else {
|
|
$update = [
|
|
'SSP_ID' => $id_ssp
|
|
];
|
|
$action = $this->Amod->update('set_togglesp', $update, 'ID_STSP', $datStsp[0]['ID_STSP']);
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => '0',
|
|
]);
|
|
}
|
|
|
|
public function GE_Ubah_SetStokGudang() {
|
|
$jenis = $this->input->post('jenis');
|
|
$isi = $this->input->post('isi');
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$datSsg = $this->Amod->getData_SetStokGudang_byKARYAWAN($id_karyawan);
|
|
if ($jenis==1) {
|
|
$update = [
|
|
'KONDISI_SSG' => $isi,
|
|
'LAST_SSG' => $timestamp,
|
|
];
|
|
} else if ($jenis==2) {
|
|
$update = [
|
|
'GUDANG_SSG' => $isi,
|
|
'LAST_SSG' => $timestamp,
|
|
];
|
|
} else if ($jenis==3) {
|
|
$update = [
|
|
'CARI_SSG' => $isi,
|
|
'LAST_SSG' => $timestamp,
|
|
];
|
|
} else if ($jenis==4 OR $jenis==5) {
|
|
if ($isi=="") {
|
|
$isi = NULL;
|
|
}
|
|
|
|
if ($jenis==4) {
|
|
$update = [
|
|
'JENIS_SSG' => $isi,
|
|
'LAST_SSG' => $timestamp,
|
|
];
|
|
} else if ($jenis==5) {
|
|
$update = [
|
|
'MERK_SSG' => $isi,
|
|
'LAST_SSG' => $timestamp,
|
|
];
|
|
}
|
|
} else if ($jenis==6) {
|
|
$update = [
|
|
'URUTAN_SSG' => $isi,
|
|
'LAST_SSG' => $timestamp,
|
|
];
|
|
}
|
|
$action = $this->Amod->update('set_stokgudang', $update, 'ID_SSG', $datSsg[0]['ID_SSG']);
|
|
|
|
$this->output_json([
|
|
'value' => '0',
|
|
]);
|
|
}
|
|
|
|
public function GE_Ubah_SetSubToggle() {
|
|
$node = $this->input->post('node');
|
|
$menu = $this->input->post('menu');
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$datStgel = $this->Amod->getData_SetSubToggle_byKARYAWAN_byMENU($id_karyawan, $menu);
|
|
if ($datStgel==FALSE) {
|
|
$input = [
|
|
'KARYAWAN_ID' => $id_karyawan,
|
|
'MENU_ID' => $menu,
|
|
'AKTIF_STGEL' => $node,
|
|
'TIMESTAMP' => $timestamp,
|
|
];
|
|
$action = $this->Amod->create('set_subtoggle', $input);
|
|
} else {
|
|
if ($node==$datStgel[0]['AKTIF_STGEL']) {
|
|
$update = [
|
|
'AKTIF_STGEL' => '0',
|
|
'TIMESTAMP' => $timestamp,
|
|
];
|
|
} else {
|
|
$update = [
|
|
'AKTIF_STGEL' => $node,
|
|
'TIMESTAMP' => $timestamp,
|
|
];
|
|
}
|
|
$action = $this->Amod->update('set_subtoggle', $update, 'ID_STGEL', $datStgel[0]['ID_STGEL']);
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => '0',
|
|
]);
|
|
}
|
|
|
|
public function GE_Ubah_SetTema($id) {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$datStema = $this->Amod->getData_SetTema_byKARYAWAN($id_karyawan);
|
|
$update = [
|
|
'MODE_STEMA' => $id,
|
|
'TIMESTAMP' => $timestamp
|
|
];
|
|
$action = $this->Amod->update('set_tema', $update, 'ID_STEMA', $datStema[0]['ID_STEMA']);
|
|
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
public function GE_Ubah_SetToggleAs() {
|
|
$id_ssp = $this->input->post('id_ssp');
|
|
$status_stgas = $this->input->post('status_stgas');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$datStgas = $this->Amod->getData_SetToggleAs_bySSP($id_ssp);
|
|
if ($datStgas==FALSE) {
|
|
$input = [
|
|
'STATUS_STGAS' => $status_stgas,
|
|
'SSP_ID' => $id_ssp,
|
|
'LAST_STGAS' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->create('set_toggleas', $input);
|
|
} else {
|
|
$update = [
|
|
'STATUS_STGAS' => $status_stgas,
|
|
'LAST_STGAS' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('set_toggleas', $update, 'ID_STGAS', $datStgas[0]['ID_STGAS']);
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => '0',
|
|
]);
|
|
}
|
|
|
|
public function GE_Ubah_SetTogglePosisi() {
|
|
$node = $this->input->post('node');
|
|
$menu = $this->input->post('menu');
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$datStpos = $this->Amod->getData_SetTogglePosisi_byKARYAWAN_byMENU($id_karyawan, $menu);
|
|
if ($datStpos==FALSE) {
|
|
$input = [
|
|
'KARYAWAN_ID' => $id_karyawan,
|
|
'MENU_ID' => $menu,
|
|
'AKTIF_STPOS' => $node,
|
|
'TIMESTAMP' => $timestamp,
|
|
];
|
|
$action = $this->Amod->create('set_toggleposisi', $input);
|
|
} else {
|
|
$update = [
|
|
'AKTIF_STPOS' => $node,
|
|
'TIMESTAMP' => $timestamp,
|
|
];
|
|
$action = $this->Amod->update('set_toggleposisi', $update, 'ID_STPOS', $datStpos[0]['ID_STPOS']);
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => '0',
|
|
'node' => $node
|
|
]);
|
|
}
|
|
|
|
public function GE_CekTanggal() { // Validasi
|
|
$tgl_input = $this->input->post('tgl_input');
|
|
$id_pembelian = $this->input->post('id_pembelian');
|
|
$tgl_sjbeli = $this->input->post('tgl_sjbeli');
|
|
$tgl_invbeli = $this->input->post('tgl_invbeli');
|
|
$tertentu = $this->input->post('tertentu');
|
|
$verse = $this->input->post('verse');
|
|
$now = date('Y-m-d');
|
|
$limit = date('Y-m-01');
|
|
|
|
if ($tgl_input==NULL) {
|
|
$datPembelian = $this->Amod->getData_Pembelian_byID($id_pembelian);
|
|
$limit = date_format(date_create($datPembelian[0]['TGL_PEMBELIAN']), "Y-m-01");
|
|
$now = $this->Amod->generate_addMonth($limit, 1);
|
|
$now = $this->Amod->generate_subDay($now, 1);
|
|
$value = 0;
|
|
if (strtotime($tgl_sjbeli)>strtotime($now) OR strtotime($tgl_invbeli)>strtotime($now)) {
|
|
$value = 1;
|
|
} else {
|
|
if (strtotime($tgl_sjbeli)<strtotime($limit) OR strtotime($tgl_invbeli)<strtotime($limit)) {
|
|
$value = 2;
|
|
}
|
|
}
|
|
} else {
|
|
$value = 0;
|
|
//Cek apakah melebihi hari ini
|
|
if (strtotime($tgl_input)>strtotime($now)) {
|
|
$value = 1;
|
|
} else {
|
|
if (strtotime($tgl_input)<strtotime($limit)) {
|
|
$value = 2;
|
|
}
|
|
if ($tertentu!="") {
|
|
if (strtotime($tgl_input)<strtotime($tertentu)) {
|
|
$value = 3;
|
|
}
|
|
}
|
|
}
|
|
if ($verse==2) { // Penjadwalan
|
|
if (strtotime($tgl_input)<strtotime($now)) {
|
|
$value = 4;
|
|
}
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
}
|
|
|
|
public function GE_CekDuplikasi() { // Validasi
|
|
$verse = $this->input->post('verse');
|
|
$id_pembelian = $this->input->post('id_pembelian');
|
|
$id_proyek = $this->input->post('id_proyek');
|
|
$sj_pembelian = $this->input->post('sj_pembelian');
|
|
$inv_pembelian = $this->input->post('inv_pembelian');
|
|
$po_proyek = $this->input->post('po_proyek');
|
|
$sj_pembelian = strtoupper($sj_pembelian);
|
|
$inv_pembelian = strtoupper($inv_pembelian);
|
|
$po_proyek = strtoupper($po_proyek);
|
|
|
|
if ($verse==1) { //Koreksi Nomor SJ Pembelian
|
|
if ($id_pembelian==0) {
|
|
$id_pembelian = NULL;
|
|
}
|
|
|
|
$cekDuplikasi = $this->Amod->getData_Pembelian_bySJ($sj_pembelian, $id_pembelian);
|
|
if ($cekDuplikasi==TRUE) {
|
|
$value = 1;
|
|
} else {
|
|
$value = 0;
|
|
}
|
|
//Koreksi INV Pembelian
|
|
} else if ($verse==2) {
|
|
if ($id_pembelian==0) {
|
|
$id_pembelian = NULL;
|
|
}
|
|
|
|
$cekDuplikasi = $this->Amod->getData_Pembelian_byINV($inv_pembelian, $id_pembelian);
|
|
if ($cekDuplikasi==TRUE) {
|
|
$value = 1;
|
|
} else {
|
|
$value = 0;
|
|
}
|
|
//Koreksi PO Proyek
|
|
} else if ($verse==3) {
|
|
if ($id_proyek==0) {
|
|
$id_proyek = NULL;
|
|
}
|
|
|
|
$cekDuplikasi = $this->Amod->getData_Proyek_byPO($po_proyek, $id_proyek);
|
|
if ($cekDuplikasi==TRUE) {
|
|
$value = 1;
|
|
} else {
|
|
$value = 0;
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
}
|
|
|
|
public function GE_CetakDokumen() {
|
|
$spesifikId = $this->input->post('spesifikId');
|
|
$verse = $this->input->post('verse');
|
|
$jenis = $this->input->post('jenis');
|
|
$tgl_hcd = $this->input->post('tgl_hcd');
|
|
$kertas_hcd = $this->input->post('kertas_hcd');
|
|
$sn_hcd = $this->input->post('sn_hcd');
|
|
$ppn_hcd = $this->input->post('ppn_hcd');
|
|
$dp_hcd = $this->input->post('dp_hcd');
|
|
$dp_cd = $this->input->post('dp_cd');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
if ($jenis==0) {
|
|
$judul = "SURAT JALAN";
|
|
} else if ($jenis==1) {
|
|
$judul = "NOTA";
|
|
} else if ($jenis==2) {
|
|
$judul = "SALES ORDER";
|
|
} else if ($jenis==3) {
|
|
$judul = "MUTASI BARANG";
|
|
} else if ($jenis==4) {
|
|
$judul = "SLIP KONSINYASI";
|
|
} else if ($jenis==5) {
|
|
$judul = "SURAT PEMINJAMAN";
|
|
} else if ($jenis==6) {
|
|
$judul = "SLIP TARIK KONSI";
|
|
} else if ($jenis==7) {
|
|
$judul = "PROFORMA";
|
|
} else if ($jenis==8) {
|
|
$judul = "SJ SERVICE";
|
|
} else if ($jenis==9) {
|
|
$judul = "PENAWARAN";
|
|
}
|
|
$ttd = " ";
|
|
$tampil_hcd = "";
|
|
|
|
if ($verse==1) { // Nota Retur Pembelian
|
|
$data = $this->Amod->getData_ReturPembelian_byID($spesifikId);
|
|
$datCetak = $this->Amod->getData_CetakDokumen_byJENIS_byVERSE_byID($jenis, $verse, $spesifikId);
|
|
|
|
$barang = $this->Amod->getData_DaftarReturBeli_byRB($spesifikId);
|
|
$no = 0;
|
|
foreach ($barang as $key) {
|
|
$datSnrb = $this->Amod->getData_SnReturBeli_byDRB($key['ID_DRB']);
|
|
$barang[$no++] += ['SN' => $datSnrb];
|
|
}
|
|
|
|
$sumDrb = $this->Amod->getSum_DaftarReturBeli_byRB($spesifikId);
|
|
$dpp = round($sumDrb[0]['TOTAL'], 2);
|
|
$ppn = round((($data[0]['PPN_PEMBELIAN']/100)*$dpp),2);
|
|
$tot = $dpp+$ppn;
|
|
$dp = 0;
|
|
$sisa = 0;
|
|
|
|
$subjudul = "RETUR";
|
|
$kodeBukti = $data[0]['INV_RB'];
|
|
$kop = $data[0]['CORP_ID'];
|
|
$nama = $data[0]['NAMA_SUPPLIER'];
|
|
$pic = $data[0]['PIC_SUPPLIER'];
|
|
$alamat = $data[0]['ALAMAT_SUPPLIER'];
|
|
$telp = $data[0]['TELP_SUPPLIER'];
|
|
$ref = $data[0]['INV_PEMBELIAN'];
|
|
$po = "";
|
|
$tempo = "";
|
|
$sales = "";
|
|
$ket = substr($data[0]['KET_RB'], 0, 70);
|
|
$nilaiDp = $datCetak[0]['DP_CD'];
|
|
$tanggal = date_format(date_create($tgl_hcd), "d/m/Y");
|
|
} else if ($verse==2) { // Nota Bebas
|
|
$data = $this->Amod->getData_NotaBebas_byID($spesifikId);
|
|
$datCetak = $this->Amod->getData_CetakDokumen_byJENIS_byVERSE_byID($jenis, $verse, $spesifikId);
|
|
|
|
$barang = $this->Amod->getData_DaftarNotaBebas_byNB($spesifikId);
|
|
|
|
$sumDnb = $this->Amod->getSum_DaftarNotaBebas_byNB($spesifikId);
|
|
$dpp = round($sumDnb[0]['TOTAL'], 2);
|
|
$ppn = round((($data[0]['PPN_NB']/100)*$dpp),2);
|
|
$tot = $dpp+$ppn;
|
|
$dp = 0;
|
|
$sisa = 0;
|
|
|
|
$subjudul = "";
|
|
$kodeBukti = $data[0]['KODE_NB'];
|
|
$kop = $data[0]['CORP_ID'];
|
|
$nama = $data[0]['NAMA_PELANGGAN'];
|
|
$pic = $data[0]['PIC_PELANGGAN'];
|
|
$alamat = $data[0]['ALAMAT_PELANGGAN'];
|
|
$telp = $data[0]['TELP_PELANGGAN'];
|
|
$po = "";
|
|
$tempo = "";
|
|
$sales = "";
|
|
$ref = "";
|
|
$ket = "";
|
|
$nilaiDp = "";
|
|
$tanggal = date_format(date_create($tgl_hcd), "d/m/Y");
|
|
} else if ($verse==3) { // Nota Penjualan
|
|
$data = $this->Amod->getData_Penjualan_byID($spesifikId);
|
|
$datCetak = $this->Amod->getData_CetakDokumen_byJENIS_byVERSE_byID($jenis, $verse, $spesifikId);
|
|
|
|
$datSttd = $this->Amod->getData_SetTertanda_byMODE("NOTA PENJUALAN");
|
|
$ttd = $datSttd[0]['NAMA_PANGGILAN_KARYAWAN'];
|
|
|
|
$barang = $this->Amod->getData_DaftarOrder_byPENJUALAN($spesifikId);
|
|
$no = 0;
|
|
foreach ($barang as $key) {
|
|
$datSnj = $this->Amod->getData_SnJual_byDO($key['ID_DO']);
|
|
$barang[$no++] += ['SN' => $datSnj];
|
|
}
|
|
|
|
$sumDo = $this->Amod->getSum_DaftarOrder_byPENJUALAN($spesifikId);
|
|
$dpp = round($sumDo[0]['TOTAL'], 2);
|
|
$ppn = round((($data[0]['PPN_SO']/100)*$dpp),2);
|
|
$tot = $dpp+$ppn;
|
|
if ($dp_hcd==0) {
|
|
$dp = 0;
|
|
$sisa = 0;
|
|
} else if ($dp_hcd==1) {
|
|
if ($dp_cd==NULL OR $dp_cd=="") {
|
|
$dp = 0;
|
|
$sisa = $tot;
|
|
} else {
|
|
$dp = $dp_cd;
|
|
$sisa = $tot-$dp;
|
|
}
|
|
|
|
$update = [
|
|
'DP_CD' => $dp
|
|
];
|
|
$action = $this->Amod->update('cetak_dokumen', $update, 'ID_CD', $datCetak[0]['ID_CD']);
|
|
}
|
|
|
|
$subjudul = "PENJUALAN";
|
|
$kodeBukti = $data[0]['INV_PENJUALAN'];
|
|
$kop = $data[0]['KOP_ID'];
|
|
$nama = $data[0]['NAMA_PELANGGAN'];
|
|
$pic = $data[0]['PIC_PELANGGAN'];
|
|
$alamat = $data[0]['ALAMAT_PELANGGAN'];
|
|
$telp = $data[0]['TELP_PELANGGAN'];
|
|
$ref = $data[0]['KODE_SO'];
|
|
$tempo = $data[0]['TEMPO'];
|
|
$po = $data[0]['PO_SO'];
|
|
$sales = $data[0]['NAMA_PANGGILAN_KARYAWAN'];
|
|
$ket = substr($data[0]['KET_SO_O'], 0, 70);
|
|
$nilaiDp = $datCetak[0]['DP_CD'];
|
|
$tanggal = date_format(date_create($tgl_hcd), "d/m/Y");
|
|
} else if ($verse==4) { // SJ Penjualan
|
|
$data = $this->Amod->getData_Penjualan_byID($spesifikId);
|
|
$datCetak = $this->Amod->getData_CetakDokumen_byJENIS_byVERSE_byID($jenis, $verse, $spesifikId);
|
|
|
|
$datSttd = $this->Amod->getData_SetTertanda_byMODE("SJ PENJUALAN");
|
|
$ttd = $datSttd[0]['NAMA_PANGGILAN_KARYAWAN'];
|
|
|
|
$barang = $this->Amod->getData_DaftarOrder_byPENJUALAN($spesifikId);
|
|
$no = 0;
|
|
foreach ($barang as $key) {
|
|
$datSnj = $this->Amod->getData_SnJual_byDO($key['ID_DO']);
|
|
$barang[$no++] += ['SN' => $datSnj];
|
|
}
|
|
|
|
$dpp = 0;
|
|
$ppn = 0;
|
|
$tot = 0;
|
|
$dp = 0;
|
|
$sisa = 0;
|
|
|
|
$subjudul = "";
|
|
$kodeBukti = $data[0]['SJ_PENJUALAN'];
|
|
$kop = $data[0]['KOP_ID'];
|
|
$nama = $data[0]['NAMA_PELANGGAN'];
|
|
$pic = $data[0]['PIC_PELANGGAN'];
|
|
$alamat = $data[0]['ALAMAT_PELANGGAN'];
|
|
$telp = $data[0]['TELP_PELANGGAN'];
|
|
$ref = $data[0]['KODE_SO'];
|
|
$tempo = "";
|
|
$po = $data[0]['PO_SO'];
|
|
$sales = $data[0]['NAMA_PANGGILAN_KARYAWAN'];
|
|
$ket = substr($data[0]['KET_SO_O'], 0, 70);
|
|
$nilaiDp = "";
|
|
$tanggal = date_format(date_create($tgl_hcd), "d/m/Y");
|
|
} else if ($verse==5) { // SJ Parsial
|
|
$barang = $this->Amod->getData_DaftarSjParsial_byCD($spesifikId);
|
|
$no = 0;
|
|
foreach ($barang as $key) {
|
|
$datSnsj = $this->Amod->getData_SnSjParsial_bySJP($key['ID_SJP']);
|
|
$barang[$no++] += ['SN' => $datSnsj];
|
|
}
|
|
|
|
$dpp = 0;
|
|
$ppn = 0;
|
|
$tot = 0;
|
|
$dp = 0;
|
|
$sisa = 0;
|
|
|
|
$subjudul = "";
|
|
$kodeBukti = $barang[0]['KODE_BUKTI'];
|
|
$kop = $barang[0]['CORP_ID'];
|
|
$nama = $barang[0]['NAMA_PELANGGAN'];
|
|
$pic = $barang[0]['PIC_PELANGGAN'];
|
|
$alamat = $barang[0]['ALAMAT_PELANGGAN'];
|
|
$telp = $barang[0]['TELP_PELANGGAN'];
|
|
$ref = $barang[0]['KODE_SO'];
|
|
$tempo = "";
|
|
$po = $barang[0]['PO_SO'];
|
|
$sales = $barang[0]['NAMA_PANGGILAN_KARYAWAN'];
|
|
$ket = substr($barang[0]['KET_SO_O'], 0, 70);
|
|
$nilaiDp = "";
|
|
$tanggal = date_format(date_create($tgl_hcd), "d/m/Y");
|
|
} else if ($verse==6) { // Sales Order
|
|
$data = $this->Amod->getData_SalesOrder_byID($spesifikId);
|
|
|
|
$barang = $this->Amod->getData_DaftarOrder_bySO($spesifikId);
|
|
$no = 0;
|
|
foreach ($barang as $key) {
|
|
$datSnj = $this->Amod->getData_SnJual_byDO($key['ID_DO']);
|
|
$barang[$no++] += ['SN' => $datSnj];
|
|
}
|
|
|
|
$sumDo = $this->Amod->getSum_DaftarOrder_bySO($spesifikId);
|
|
$dpp = round($sumDo[0]['TOTAL'], 2);
|
|
$ppn = round((($data[0]['PPN_SO']/100)*$dpp),2);
|
|
$tot = $dpp+$ppn;
|
|
$dp = 0;
|
|
$sisa = 0;
|
|
|
|
$subjudul = "";
|
|
$kodeBukti = $data[0]['KODE_SO'];
|
|
$kop = $data[0]['CORP_ID'];
|
|
$nama = $data[0]['NAMA_PELANGGAN'];
|
|
$pic = $data[0]['PIC_PELANGGAN'];
|
|
$alamat = $data[0]['ALAMAT_PELANGGAN'];
|
|
$telp = $data[0]['TELP_PELANGGAN'];
|
|
$ref = "";
|
|
$tempo = "";
|
|
$po = $data[0]['PO_SO'];
|
|
$sales = $data[0]['NAMA_PANGGILAN_KARYAWAN'];
|
|
$ket = substr($data[0]['KET_SO_O'], 0, 70);
|
|
$nilaiDp = 0;
|
|
$tanggal = date_format(date_create($tgl_hcd), "d/m/Y");
|
|
} else if ($verse==7) { // Mutasi Barang
|
|
$data = $this->Amod->getData_MutasiBarang_byID($spesifikId);
|
|
|
|
$barang = $this->Amod->getData_DaftarMutasiBarang_byMB($spesifikId);
|
|
$no = 0;
|
|
foreach ($barang as $key) {
|
|
$datSnmb = $this->Amod->getData_SnMutasiBarang_byDMB($key['ID_DMB']);
|
|
$barang[$no++] += ['SN' => $datSnmb];
|
|
}
|
|
|
|
if ($data[0]['JENIS_MB']==0) {
|
|
$ref = "PCM ke ITP";
|
|
} else if ($data[0]['JENIS_MB']==1) {
|
|
$ref = "ITP ke PCM";
|
|
} else if ($data[0]['JENIS_MB']==2) {
|
|
$ref = "PCM ke SERVICE";
|
|
} else if ($data[0]['JENIS_MB']==3) {
|
|
$ref = "SERVICE ke PCM";
|
|
}
|
|
|
|
$dpp = 0;
|
|
$ppn = 0;
|
|
$tot = 0;
|
|
$dp = 0;
|
|
$sisa = 0;
|
|
|
|
$subjudul = "";
|
|
$kodeBukti = $data[0]['KODE_MB'];
|
|
$kop = "";
|
|
$nama = "";
|
|
$pic = "";
|
|
$alamat = "";
|
|
$telp = "";
|
|
$tempo = "";
|
|
$po = "";
|
|
$sales = "";
|
|
$ket = "";
|
|
$nilaiDp = "";
|
|
$tanggal = date_format(date_create($tgl_hcd), "d/m/Y");
|
|
} else if ($verse==8) { // Konsinyasi
|
|
$data = $this->Amod->getData_Konsinyasi_byID($spesifikId);
|
|
|
|
$barang = $this->Amod->getData_DaftarKonsi_byKONSINYASI($spesifikId);
|
|
$no = 0;
|
|
foreach ($barang as $key) {
|
|
$datSnk = $this->Amod->getData_SnKonsi_byDFK($key['ID_DFK']);
|
|
$barang[$no++] += ['SN' => $datSnk];
|
|
}
|
|
|
|
$dpp = 0;
|
|
$ppn = 0;
|
|
$tot = 0;
|
|
$dp = 0;
|
|
$sisa = 0;
|
|
|
|
$subjudul = "";
|
|
$kodeBukti = $data[0]['KODE_KONSINYASI'];
|
|
$kop = "";
|
|
$nama = $data[0]['NAMA_PELANGGAN'];
|
|
$pic = $data[0]['PIC_PELANGGAN'];
|
|
$alamat = $data[0]['ALAMAT_PELANGGAN'];
|
|
$telp = $data[0]['TELP_PELANGGAN'];
|
|
$tempo = "";
|
|
$po = "";
|
|
$ref = "";
|
|
$sales = "";
|
|
$ket = "";
|
|
$nilaiDp = "";
|
|
$tanggal = date_format(date_create($tgl_hcd), "d/m/Y");
|
|
} else if ($verse==9) { // Peminjaman
|
|
$data = $this->Amod->getData_Peminjaman_byID($spesifikId);
|
|
|
|
$barang = $this->Amod->getData_DaftarPinjam_byPEMINJAMAN($spesifikId);
|
|
$no = 0;
|
|
foreach ($barang as $key) {
|
|
$datSnp = $this->Amod->getData_SnPinjam_byDFP($key['ID_DFP']);
|
|
$barang[$no++] += ['SN' => $datSnp];
|
|
}
|
|
|
|
|
|
$dpp = 0;
|
|
$ppn = 0;
|
|
$tot = 0;
|
|
$dp = 0;
|
|
$sisa = 0;
|
|
|
|
$subjudul = "";
|
|
$kodeBukti = $data[0]['KODE_PEMINJAMAN'];
|
|
$kop = "";
|
|
$nama = $data[0]['NAMA_PELANGGAN'];
|
|
$pic = $data[0]['PIC_PELANGGAN'];
|
|
$alamat = $data[0]['ALAMAT_PELANGGAN'];
|
|
$telp = $data[0]['TELP_PELANGGAN'];
|
|
$tempo = "";
|
|
$po = "";
|
|
$ref = "";
|
|
$sales = "";
|
|
$ket = "";
|
|
$nilaiDp = "";
|
|
$tanggal = date_format(date_create($tgl_hcd), "d/m/Y");
|
|
} else if ($verse==10) { // Penarikan Konsi
|
|
$data = $this->Amod->getData_PenarikanKonsi_byID($spesifikId);
|
|
|
|
$barang = $this->Amod->getData_DaftarPenarikanKonsi_byPK($spesifikId);
|
|
$no = 0;
|
|
foreach ($barang as $key) {
|
|
$datSnk = $this->Amod->getData_SnKonsi_byPK_byBARANG_bySTATUS($spesifikId, $key['BARANG_ID'], 1);
|
|
$barang[$no++] += ['SN' => $datSnk];
|
|
}
|
|
|
|
|
|
$dpp = 0;
|
|
$ppn = 0;
|
|
$tot = 0;
|
|
$dp = 0;
|
|
$sisa = 0;
|
|
|
|
$subjudul = "";
|
|
$kodeBukti = $data[0]['KODE_PK'];
|
|
$kop = "";
|
|
$nama = $data[0]['NAMA_PELANGGAN'];
|
|
$pic = $data[0]['PIC_PELANGGAN'];
|
|
$alamat = $data[0]['ALAMAT_PELANGGAN'];
|
|
$telp = $data[0]['TELP_PELANGGAN'];
|
|
$tempo = "";
|
|
$po = "";
|
|
$ref = "";
|
|
$sales = "";
|
|
$ket = "";
|
|
$nilaiDp = "";
|
|
$tanggal = date_format(date_create($tgl_hcd), "d/m/Y");
|
|
} else if ($verse==11) { // Proforma
|
|
$data = $this->Amod->getData_Proforma_byID($spesifikId);
|
|
|
|
$barang = $this->Amod->getData_DaftarProforma_byPF($spesifikId);
|
|
|
|
$sumDnb = $this->Amod->getSum_DaftarProforma_byPF($spesifikId);
|
|
$dpp = round($sumDnb[0]['TOTAL'], 2);
|
|
$ppn = round((($data[0]['PPN_PF']/100)*$dpp),2);
|
|
$tot = $dpp+$ppn;
|
|
$dp = 0;
|
|
$sisa = 0;
|
|
|
|
$subjudul = "";
|
|
$kodeBukti = $data[0]['KODE_PF'];
|
|
$kop = $data[0]['CORP_ID'];
|
|
$nama = $data[0]['NAMA_PELANGGAN'];
|
|
$pic = $data[0]['PIC_PELANGGAN'];
|
|
$alamat = $data[0]['ALAMAT_PELANGGAN'];
|
|
$telp = $data[0]['TELP_PELANGGAN'];
|
|
$po = "";
|
|
$tempo = "";
|
|
$sales = "";
|
|
$ref = "";
|
|
$ket = "";
|
|
$nilaiDp = "";
|
|
$tanggal = date_format(date_create($tgl_hcd), "d/m/Y");
|
|
} else if ($verse==12) { // SJ Service
|
|
$data = $this->Amod->getData_SjService_byID($spesifikId);
|
|
|
|
$barang = $this->Amod->getData_DaftarSjService_bySJS($spesifikId);
|
|
$no = 0;
|
|
foreach ($barang as $key) {
|
|
$sn[0] = [
|
|
'ID_SNS' => 1,
|
|
'NAMA_SNS' => $key['NAMA_SNS']
|
|
];
|
|
$barang[$no++] += ['SN' => $sn];
|
|
}
|
|
|
|
$datSttd = $this->Amod->getData_SetTertanda_byMODE("SJ SERVICE");
|
|
$ttd = $datSttd[0]['NAMA_PANGGILAN_KARYAWAN'];
|
|
|
|
$dpp = 0;
|
|
$ppn = 0;
|
|
$tot = 0;
|
|
$dp = 0;
|
|
$sisa = 0;
|
|
|
|
$subjudul = "";
|
|
$kodeBukti = $data[0]['KODE_SJS'];
|
|
$kop = "1";
|
|
$nama = $data[0]['NAMA_PELANGGAN'];
|
|
$pic = $data[0]['PIC_PELANGGAN'];
|
|
$alamat = $data[0]['ALAMAT_PELANGGAN'];
|
|
$telp = $data[0]['TELP_PELANGGAN'];
|
|
$tempo = "";
|
|
$po = "";
|
|
$ref = "";
|
|
$sales = "";
|
|
$ket = $data[0]['KET_SJS'];
|
|
$nilaiDp = "";
|
|
$tanggal = date_format(date_create($tgl_hcd), "d/m/Y");
|
|
} else if ($verse==13) { // Penawaran Sales
|
|
$kertas_hcd = $this->input->post('id_salesprint');
|
|
$dp_hcd = $this->input->post('satuan_print');
|
|
$tampil_hcd = $this->input->post('tampil_hcd');
|
|
$ket = $this->input->post('ket_penawaran');
|
|
$ket = ltrim(rtrim(preg_replace('/\R/', "<br>" , $ket)));
|
|
|
|
$datCd = $this->Amod->getData_CetakDokumen_byID($spesifikId);
|
|
$data = $this->Amod->getData_Penawaran_byID($datCd[0]['PENAWARAN_ID']);
|
|
$barang = $this->Amod->getData_DaftarPenawaran_byPENAWARAN_byVERSI($datCd[0]['PENAWARAN_ID'], $data[0]['AKTIF_PENAWARAN']);
|
|
|
|
$sumDpne = $this->Amod->getSum_DaftarPenawaran_byPENAWARAN_byVERSI($datCd[0]['PENAWARAN_ID'], $data[0]['AKTIF_PENAWARAN']);
|
|
$dpp = round($sumDpne[0]['TOTAL'], 2);
|
|
$ppn = round((($data[0]['PPN_PENAWARAN']/100)*$dpp),2);
|
|
$tot = $dpp+$ppn;
|
|
$dp = 0;
|
|
$sisa = 0;
|
|
|
|
$sn_hcd = $datCd[0]['STATUS_CD'];
|
|
$kodeBukti = $data[0]['KODE_PENAWARAN'];
|
|
$kop = $data[0]['CORP_ID'];
|
|
$nama = $data[0]['PELANGGAN_PENAWARAN'];
|
|
$pic = $data[0]['UP_PENAWARAN'];
|
|
$subjudul = $data[0]['PERIHAL_PENAWARAN'];
|
|
|
|
$lampiran = $data[0]['LAMPIRAN_PENAWARAN'];
|
|
$angka = $this->Amod->generate_textAngka($lampiran);
|
|
$po = "$lampiran ($angka) Bendel";
|
|
$alamat = str_ireplace("penawaran", " " , $subjudul);
|
|
$alamat = ltrim(rtrim($alamat));
|
|
|
|
$hari = date_format(date_create($tgl_hcd), "d");
|
|
$bulan = date_format(date_create($tgl_hcd), "m");
|
|
$tahun = date_format(date_create($tgl_hcd), "Y");
|
|
$bulan = $this->Amod->generate_inisialMonth($bulan);
|
|
$tanggal = "Surabaya, $hari $bulan $tahun";
|
|
|
|
$datCorp = $this->Amod->getData_Corp_byID($kop);
|
|
$ref = $datCorp[0]['NAMA_CORP'];
|
|
|
|
$datSales = $this->Amod->getData_Karyawan_byID($kertas_hcd);
|
|
$sales = $datSales[0]['NAMA_PANGGILAN_KARYAWAN'];
|
|
$tempo = $datSales[0]['LABEL_KARYAWAN'];
|
|
$email = $datSales[0]['EMAIL_KARYAWAN'];
|
|
$telp = $datSales[0]['TELP_KARYAWAN'];
|
|
$telp = "$email | $telp";
|
|
|
|
$nilaiDp = "";
|
|
}
|
|
|
|
if ($verse==5 OR $verse==13) {
|
|
$id_cd = $spesifikId;
|
|
} else if ($verse==6 OR $verse==7 OR $verse==8 OR $verse==9 OR $verse==10 OR $verse==11 OR $verse==12 OR $verse==13) {
|
|
$id_cd = NULL;
|
|
} else {
|
|
$id_cd = $datCetak[0]['ID_CD'];
|
|
}
|
|
|
|
if ($verse==11) {
|
|
if ($data[0]['CETAK_PF']==NULL) {
|
|
$update = [
|
|
'CETAK_PF' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
} else {
|
|
$update = [
|
|
'ULANG_PF' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
}
|
|
$action = $this->Amod->update('proforma', $update, 'ID_PF', $spesifikId);
|
|
} else if ($verse==12) {
|
|
if ($data[0]['CETAK_SJS']==NULL) {
|
|
$update = [
|
|
'CETAK_SJS' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
} else {
|
|
$update = [
|
|
'ULANG_SJS' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
}
|
|
$action = $this->Amod->update('sj_service', $update, 'ID_SJS', $spesifikId);
|
|
} else if ($verse==13) {
|
|
$input = [
|
|
'CD_ID' => $id_cd,
|
|
'TGL_HCD' => $tgl_hcd,
|
|
'KERTAS_HCD' => $kertas_hcd,
|
|
'SN_HCD' => $sn_hcd,
|
|
'PPN_HCD' => $ppn_hcd,
|
|
'DP_HCD' => $dp_hcd,
|
|
'CETAK_HCD' => "Oleh $panggilan pada $timestamp",
|
|
'KET_HCD' => $ket,
|
|
];
|
|
$action = $this->Amod->create('histori_cetakdokumen', $input);
|
|
} else if ($verse!=6 AND $verse!=7 AND $verse!=8 AND $verse!=9 AND $verse!=10 AND $verse!=13) {
|
|
$input = [
|
|
'CD_ID' => $id_cd,
|
|
'TGL_HCD' => $tgl_hcd,
|
|
'KERTAS_HCD' => $kertas_hcd,
|
|
'SN_HCD' => $sn_hcd,
|
|
'PPN_HCD' => $ppn_hcd,
|
|
'DP_HCD' => $dp_hcd,
|
|
'CETAK_HCD' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->create('histori_cetakdokumen', $input);
|
|
}
|
|
|
|
$data = [
|
|
'jenis' => $jenis,
|
|
'verse' => $verse,
|
|
'kertas' => $kertas_hcd,
|
|
'judul' => $judul,
|
|
'subjudul' => $subjudul,
|
|
'tampilIn' => $tampil_hcd,
|
|
'tampilSn' => $sn_hcd,
|
|
'tampilPpn' => $ppn_hcd,
|
|
'tampilDp' => $dp_hcd,
|
|
'kodeBukti' => $kodeBukti,
|
|
'kop' => $kop,
|
|
'nama' => $nama,
|
|
'pic' => $pic,
|
|
'alamat' => $alamat,
|
|
'telp' => $telp,
|
|
'po' => $po,
|
|
'tempo' => $tempo,
|
|
'sales' => $sales,
|
|
'ref' => $ref,
|
|
'tanggal' => $tanggal,
|
|
'ket' => $ket,
|
|
'nilaiDp' => $nilaiDp,
|
|
'barang' => $barang,
|
|
'ttd' => $ttd,
|
|
'dpp' => number_format($dpp, 2),
|
|
'ppn' => number_format($ppn, 2),
|
|
'tot' => number_format($tot, 2),
|
|
'dp' => number_format($dp, 2),
|
|
'sisa' => number_format($sisa, 2),
|
|
];
|
|
if ($jenis==0 OR $jenis==3 OR $jenis==4 OR $jenis==5 OR $jenis==6 OR $jenis==8) {
|
|
$this->load->view('cetak/SJ_Cetak', $data);
|
|
} else if ($jenis==1 OR $jenis==2 OR $jenis==7) {
|
|
$this->load->view('cetak/INV_Cetak', $data);
|
|
} else if ($jenis==9) {
|
|
$this->load->view('cetak/QL_Cetak', $data);
|
|
}
|
|
}
|
|
|
|
// Daftar Menu MD [Master Data]
|
|
public function MD_MasterBank() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "MD", "MASTER - Bank");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$datBank = $this->Amod->getData_Bank_bySTATUS(1);
|
|
|
|
$data = array(
|
|
'sidebar' => "dashboard",
|
|
'navChild' => "",
|
|
'bank' => $datBank,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil
|
|
);
|
|
$this->load->view('proses/MD_MasterBank', $data);
|
|
}
|
|
|
|
public function MD_Ambil_DataBank() {
|
|
$id_bank = $this->input->post('id_bank');
|
|
|
|
$datBank = $this->Amod->getData_Bank_byID($id_bank);
|
|
|
|
$this->output_json([
|
|
'kode_bank' => $datBank[0]['KODE_BANK'],
|
|
'nama_bank' => $datBank[0]['NAMA_BANK'],
|
|
]);
|
|
}
|
|
|
|
public function MD_Tambah_DataBank() {
|
|
$kode_bank = $this->input->post('kode_bank');
|
|
$nama_bank = $this->input->post('nama_bank');
|
|
$kode_bank = strtoupper(ltrim(rtrim(preg_replace('/\R+/', " " , $kode_bank))));
|
|
$nama_bank = strtoupper(ltrim(rtrim(preg_replace('/\R+/', " " , $nama_bank))));
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$value = 0;
|
|
$datBank = $this->Amod->getData_Bank_byKODE_bySTATUS($kode_bank, 1);
|
|
if ($datBank==TRUE) {
|
|
$value = 2;
|
|
} else {
|
|
$cekBank = $this->Amod->getData_Bank_byKODE_bySTATUS($kode_bank, 0);
|
|
if ($cekBank==TRUE) {
|
|
$update = [
|
|
'NAMA_BANK' => $nama_bank,
|
|
'STATUS_BANK' => '1',
|
|
'UBAH_BANK' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('bank', $update, 'ID_BANK', $cekBank[0]['ID_BANK']);
|
|
} else {
|
|
$input = [
|
|
'KODE_BANK' => $kode_bank,
|
|
'NAMA_BANK' => $nama_bank,
|
|
'STATUS_BANK' => '1',
|
|
'TAMBAH_BANK' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->create('bank', $input);
|
|
}
|
|
$value = 1;
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
}
|
|
|
|
public function MD_Ubah_DataBank() {
|
|
$id_bank = $this->input->post('id_bank');
|
|
$kode_bank = $this->input->post('kode_bank');
|
|
$nama_bank = $this->input->post('nama_bank');
|
|
$menu = $this->input->post('menu');
|
|
$kode_bank = strtoupper(ltrim(rtrim(preg_replace('/\R+/', " " , $kode_bank))));
|
|
$nama_bank = strtoupper(ltrim(rtrim(preg_replace('/\R+/', " " , $nama_bank))));
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$value = 0;
|
|
$datBank = $this->Amod->getData_Bank_byID($id_bank);
|
|
if ($datBank==FALSE) {
|
|
$value = 3;
|
|
} else {
|
|
$cekBank = $this->Amod->getData_Bank_byKODE_bySTATUS($kode_bank, 1, $id_bank);
|
|
if ($cekBank==TRUE) {
|
|
$value = 2;
|
|
} else {
|
|
if ($menu==1) {
|
|
$update = [
|
|
'KODE_BANK' => $kode_bank,
|
|
'UBAH_BANK' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
} else if ($menu==2) {
|
|
$update = [
|
|
'NAMA_BANK' => $nama_bank,
|
|
'UBAH_BANK' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
}
|
|
|
|
$action = $this->Amod->update('bank', $update, 'ID_BANK', $id_bank);
|
|
|
|
$value = 1;
|
|
}
|
|
}
|
|
|
|
$datBankNew = $this->Amod->getData_Bank_bySTATUS(1);
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
'bank' => $datBankNew,
|
|
]);
|
|
}
|
|
|
|
public function MD_Hapus_DataBank() {
|
|
$id_bank = $this->input->post('id_bankdel');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$datBank = $this->Amod->getData_Bank_byID_bySTATUS($id_bank, 1);
|
|
if ($datBank==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$countDak = $this->Amod->getCount_DaftarAkuntansi_byBANK($id_bank);
|
|
if ($countDak>0) {
|
|
$this->session->set_flashdata('data_used', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$update = [
|
|
'STATUS_BANK' => '0',
|
|
'HAPUS_BANK' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('bank', $update, 'ID_BANK', $id_bank);
|
|
|
|
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 MD_Excel_DataBank() {
|
|
$datBank = $this->Amod->getData_Bank_bySTATUS(1);
|
|
$nama_tabel = array('NO', 'KODE', 'NAMA');
|
|
|
|
$data = [
|
|
'sekarang' => date('d/m/Y H:i:s'),
|
|
'laporan' => $datBank,
|
|
'jumlah' => count($datBank),
|
|
'nama_tabel' => $nama_tabel,
|
|
'jumlah_kolom' => count($nama_tabel),
|
|
'judul' => "Semua Data"
|
|
];
|
|
$this->load->view('cetak/MD_Excel_DataBank', $data);
|
|
}
|
|
|
|
public function MD_MasterBarang() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "MD", "MASTER - Barang");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$datJenis = $this->Amod->getData_Jenis_bySTATUS(1);
|
|
$datMerk = $this->Amod->getData_Merk_bySTATUS(1);
|
|
$datModel = $this->Amod->getData_Model_bySTATUS(1);
|
|
$datProduk = $this->Amod->getData_Produk_bySTATUS(1);
|
|
|
|
$data = array(
|
|
'sidebar' => "dashboard",
|
|
'navChild' => "",
|
|
'jenis' => $datJenis,
|
|
'merk' => $datMerk,
|
|
'model' => $datModel,
|
|
'produk' => $datProduk,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil
|
|
);
|
|
$this->load->view('proses/MD_MasterBarang', $data);
|
|
}
|
|
|
|
public function MD_Ambil_DataBarang() {
|
|
$id_barang = $this->input->post('id_barang');
|
|
|
|
$datBarang = $this->Amod->getData_Barang_byID($id_barang);
|
|
|
|
$this->output_json([
|
|
'kode_barang' => $datBarang[0]['KODE_BARANG'],
|
|
'nama_barang' => $datBarang[0]['NAMA_BARANG'],
|
|
'garansi_barang' => $datBarang[0]['GARANSI_BARANG'],
|
|
'id_jenis' => $datBarang[0]['JENIS_ID'],
|
|
'id_merk' => $datBarang[0]['MERK_ID'],
|
|
'id_model' => $datBarang[0]['MODEL_ID'],
|
|
'id_produk' => $datBarang[0]['PRODUK_ID'],
|
|
]);
|
|
}
|
|
|
|
public function MD_Tambah_DataBarang() {
|
|
$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');
|
|
$garansi_barang = $this->input->post('garansi_barang');
|
|
$kode_barang = strtoupper(ltrim(rtrim(preg_replace('/\R+/', " " , $kode_barang))));
|
|
$kode_barang = preg_replace('/\\*/', "x" , $kode_barang);
|
|
$nama_barang = ltrim(rtrim(preg_replace('/\R+/', " " , $nama_barang)));
|
|
$nama_barang = preg_replace('/\\*/', "x" , $nama_barang);
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$value = 0;
|
|
$datBarang1 = $this->Amod->getData_Barang_byKODE_bySTATUS($kode_barang, 1);
|
|
if ($datBarang1==TRUE) {
|
|
$value = 3;
|
|
} else {
|
|
$datBarang2 = $this->Amod->getData_Barang_byNAMA_bySTATUS($nama_barang, 1);
|
|
if ($datBarang2==TRUE) {
|
|
$value = 2;
|
|
} else {
|
|
$cekBarang = $this->Amod->getData_Barang_byKODE_bySTATUS($kode_barang, 0);
|
|
if ($cekBarang==TRUE) {
|
|
$update = [
|
|
'NAMA_BARANG' => $nama_barang,
|
|
'JENIS_ID' => $id_jenis,
|
|
'MERK_ID' => $id_merk,
|
|
'MODEL_ID' => $id_model,
|
|
'PRODUK_ID' => $id_produk,
|
|
'GARANSI_BARANG' => $garansi_barang,
|
|
'STATUS_BARANG' => '1',
|
|
'UBAH_BARANG' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('barang', $update, 'ID_BARANG', $cekBarang[0]['ID_BARANG']);
|
|
} else {
|
|
$input = [
|
|
'KODE_BARANG' => $kode_barang,
|
|
'NAMA_BARANG' => $nama_barang,
|
|
'JENIS_ID' => $id_jenis,
|
|
'MERK_ID' => $id_merk,
|
|
'MODEL_ID' => $id_model,
|
|
'PRODUK_ID' => $id_produk,
|
|
'GARANSI_BARANG' => $garansi_barang,
|
|
'STATUS_BARANG' => '1',
|
|
'TAMBAH_BARANG' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->create('barang', $input);
|
|
|
|
$id_barang = $this->Amod->getMax_ID_Barang();
|
|
$id_barang = $id_barang[0]['ID_BARANG'];
|
|
|
|
$input = [
|
|
'ID_KUANTITI' => $id_barang,
|
|
'GLOBAL_KUANTITI' => '0',
|
|
'PCM_KUANTITI' => '0',
|
|
'ITP_KUANTITI' => '0',
|
|
'PROSES_KUANTITI' => '0',
|
|
'ANTIK_KUANTITI' => '0',
|
|
'KONSINYASI_KUANTITI' => '0',
|
|
'MUTASI_KUANTITI' => '0',
|
|
'PEMINJAMAN_KUANTITI' => '0',
|
|
'PENDING_KUANTITI' => '0',
|
|
'PROYEK_KUANTITI' => '0',
|
|
'SERVICE_KUANTITI' => '0',
|
|
'SEWA_KUANTITI' => '0',
|
|
'TERCABUT_KUANTITI' => '0',
|
|
'PERSEDIAAN_KUANTITI' => '0'
|
|
];
|
|
$action = $this->Amod->create('kuantiti', $input);
|
|
|
|
}
|
|
$value = 1;
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
}
|
|
|
|
public function MD_Ubah_DataBarang() {
|
|
$id_barang = $this->input->post('id_barang');
|
|
$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');
|
|
$garansi_barang = $this->input->post('garansi_barang');
|
|
$menu = $this->input->post('menu');
|
|
$kode_barang = strtoupper(ltrim(rtrim(preg_replace('/\R+/', " " , $kode_barang))));
|
|
$kode_barang = preg_replace('/\\*/', "x" , $kode_barang);
|
|
$nama_barang = ltrim(rtrim(preg_replace('/\R+/', " " , $nama_barang)));
|
|
$nama_barang = preg_replace('/\\*/', "x" , $nama_barang);
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$value = 0;
|
|
$datBarang = $this->Amod->getData_Barang_byID($id_barang);
|
|
if ($datBarang==FALSE) {
|
|
$value = 5;
|
|
} else {
|
|
$datJenisNew = $this->Amod->getData_Jenis_byID($id_jenis);
|
|
$datJenisOld = $this->Amod->getData_Jenis_byID($datBarang[0]['JENIS_ID']);
|
|
if ($menu==3 AND $datJenisNew[0]['TYPE_JENIS']!=$datJenisOld[0]['TYPE_JENIS']) {
|
|
$value = 4;
|
|
} else {
|
|
$cekBarang1 = $this->Amod->getData_Barang_byKODE_bySTATUS($kode_barang, 1, $id_barang);
|
|
if ($cekBarang1==TRUE) {
|
|
$value = 3;
|
|
} else {
|
|
$cekBarang2 = $this->Amod->getData_Barang_byNAMA_bySTATUS($nama_barang, 1, $id_barang);
|
|
if ($cekBarang2==TRUE) {
|
|
$value = 2;
|
|
} else {
|
|
$ubah_barang = "Oleh $panggilan pada $timestamp";
|
|
if ($menu==1) {
|
|
$update = [
|
|
'KODE_BARANG' => $kode_barang,
|
|
'UBAH_BARANG' => $ubah_barang
|
|
];
|
|
} else if ($menu==2) {
|
|
$update = [
|
|
'NAMA_BARANG' => $nama_barang,
|
|
'UBAH_BARANG' => $ubah_barang
|
|
];
|
|
} else if ($menu==3) {
|
|
if ($id_jenis!=$datBarang[0]['JENIS_ID']) {
|
|
$update = [
|
|
'JENIS_ID' => $id_jenis,
|
|
'UBAH_BARANG' => $ubah_barang
|
|
];
|
|
}
|
|
} else if ($menu==4) {
|
|
if ($id_merk!=$datBarang[0]['MERK_ID']) {
|
|
$update = [
|
|
'MERK_ID' => $id_merk,
|
|
'UBAH_BARANG' => $ubah_barang
|
|
];
|
|
}
|
|
} else if ($menu==5) {
|
|
if ($id_model!=$datBarang[0]['MODEL_ID']) {
|
|
$update = [
|
|
'MODEL_ID' => $id_model,
|
|
'UBAH_BARANG' => $ubah_barang
|
|
];
|
|
}
|
|
} else if ($menu==6) {
|
|
if ($id_produk!=$datBarang[0]['PRODUK_ID']) {
|
|
$update = [
|
|
'PRODUK_ID' => $id_produk,
|
|
'UBAH_BARANG' => $ubah_barang
|
|
];
|
|
}
|
|
} else if ($menu==7) {
|
|
$update = [
|
|
'GARANSI_BARANG' => $garansi_barang,
|
|
'UBAH_BARANG' => $ubah_barang
|
|
];
|
|
}
|
|
|
|
if ($id_jenis==$datBarang[0]['JENIS_ID'] AND $menu==3) {
|
|
$value = 6;
|
|
} else if ($id_merk==$datBarang[0]['MERK_ID'] AND $menu==4) {
|
|
$value = 6;
|
|
} else if ($id_model==$datBarang[0]['MODEL_ID'] AND $menu==5) {
|
|
$value = 6;
|
|
} else if ($id_produk==$datBarang[0]['PRODUK_ID'] AND $menu==6) {
|
|
$value = 6;
|
|
} else {
|
|
$action = $this->Amod->update('barang', $update, 'ID_BARANG', $id_barang);
|
|
$value = 1;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
}
|
|
|
|
public function MD_Hapus_DataBarang() {
|
|
$id_barang = $this->input->post('id_barangdel');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$datBarang = $this->Amod->getData_Barang_byID_bySTATUS($id_barang, 1);
|
|
if ($datBarang==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$countDb = $this->Amod->getCount_DaftarBeli_byBARANG($id_barang);
|
|
$countDo = $this->Amod->getCount_DaftarOrder_byBARANG($id_barang);
|
|
$countIo = $this->Amod->getCount_TransaksiStock_byBARANG($id_barang);
|
|
$countHq = $this->Amod->getCount_HistoriKuantiti_byBARANG($id_barang);
|
|
if ($countDb>0 OR $countDo>0 OR $countIo>0 OR $countHq>0) {
|
|
$this->session->set_flashdata('data_used', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$update = [
|
|
'STATUS_BARANG' => '0',
|
|
'HAPUS_BARANG' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('barang', $update, 'ID_BARANG', $id_barang);
|
|
|
|
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 MD_Excel_DataBarang() {
|
|
$id_jenis = $this->input->post('id_jenisfill');
|
|
$id_merk = $this->input->post('id_merkfill');
|
|
$id_model = $this->input->post('id_modelfill');
|
|
$id_produk = $this->input->post('id_produkfill');
|
|
|
|
if ($id_jenis=="") {
|
|
$id_jenis = NULL;
|
|
}
|
|
|
|
if ($id_merk=="") {
|
|
$id_merk = NULL;
|
|
}
|
|
|
|
if ($id_model=="") {
|
|
$id_model = NULL;
|
|
}
|
|
|
|
if ($id_produk=="") {
|
|
$id_produk = NULL;
|
|
}
|
|
|
|
$datBarang = $this->Amod->getData_Barang_byJENIS_byMERK_byMODEL_byPRODUK_bySTATUS($id_jenis, $id_merk, $id_model, $id_produk, 1);
|
|
$nama_tabel = array('NO', 'JENIS', 'MERK', 'MODEL', 'PRODUK', 'KODE', 'NAMA');
|
|
|
|
$data = [
|
|
'sekarang' => date('d/m/Y H:i:s'),
|
|
'laporan' => $datBarang,
|
|
'jumlah' => count($datBarang),
|
|
'nama_tabel' => $nama_tabel,
|
|
'jumlah_kolom' => count($nama_tabel)
|
|
];
|
|
$this->load->view('cetak/MD_Excel_DataBarang', $data);
|
|
}
|
|
|
|
public function MD_MasterJabatan() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "MD", "MASTER - Jabatan");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$datJabatan = $this->Amod->getData_Jabatan_bySTATUS(1);
|
|
|
|
$data = array(
|
|
'sidebar' => "dashboard",
|
|
'navChild' => "",
|
|
'jabatan' => $datJabatan,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil
|
|
);
|
|
$this->load->view('proses/MD_MasterJabatan', $data);
|
|
}
|
|
|
|
public function MD_Ambil_DataJabatan() {
|
|
$id_jabatan = $this->input->post('id_jabatan');
|
|
|
|
$datJabatan = $this->Amod->getData_Jabatan_byID($id_jabatan);
|
|
|
|
$this->output_json([
|
|
'nama_jabatan' => $datJabatan[0]['NAMA_JABATAN'],
|
|
]);
|
|
}
|
|
|
|
public function MD_Tambah_DataJabatan() {
|
|
$nama_jabatan = $this->input->post('nama_jabatan');
|
|
$nama_jabatan = strtoupper(ltrim(rtrim(preg_replace('/\R+/', " " , $nama_jabatan))));
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$value = 0;
|
|
$datJabatan = $this->Amod->getData_Jabatan_byNAMA_bySTATUS($nama_jabatan, 1);
|
|
if ($datJabatan==TRUE) {
|
|
$value = 2;
|
|
} else {
|
|
$cekJabatan = $this->Amod->getData_Jabatan_byNAMA_bySTATUS($nama_jabatan, 0);
|
|
if ($cekJabatan==TRUE) {
|
|
$update = [
|
|
'STATUS_JABATAN' => '1',
|
|
'UBAH_JABATAN' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('jabatan', $update, 'ID_JABATAN', $cekJabatan[0]['ID_JABATAN']);
|
|
} else {
|
|
$input = [
|
|
'NAMA_JABATAN' => $nama_jabatan,
|
|
'STATUS_JABATAN' => '1',
|
|
'TAMBAH_JABATAN' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->create('jabatan', $input);
|
|
}
|
|
$value = 1;
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
}
|
|
|
|
public function MD_Ubah_DataJabatan() {
|
|
$id_jabatan = $this->input->post('id_jabatan');
|
|
$nama_jabatan = $this->input->post('nama_jabatan');
|
|
$menu = $this->input->post('menu');
|
|
$nama_jabatan = strtoupper(ltrim(rtrim(preg_replace('/\R+/', " " , $nama_jabatan))));
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$value = 0;
|
|
$datJabatan = $this->Amod->getData_Jabatan_byID($id_jabatan);
|
|
if ($datJabatan==FALSE) {
|
|
$value = 3;
|
|
} else {
|
|
$cekJabatan = $this->Amod->getData_Jabatan_byNAMA_bySTATUS($nama_jabatan, 1, $id_jabatan);
|
|
if ($cekJabatan==TRUE) {
|
|
$value = 2;
|
|
} else {
|
|
if ($menu==1) {
|
|
$update = [
|
|
'NAMA_JABATAN' => $nama_jabatan,
|
|
'UBAH_JABATAN' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
}
|
|
|
|
$action = $this->Amod->update('jabatan', $update, 'ID_JABATAN', $id_jabatan);
|
|
|
|
$value = 1;
|
|
}
|
|
}
|
|
|
|
$datJabatanNew = $this->Amod->getData_Jabatan_bySTATUS(1);
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
'jabatan' => $datJabatanNew,
|
|
]);
|
|
}
|
|
|
|
public function MD_Hapus_DataJabatan() {
|
|
$id_jabatan = $this->input->post('id_jabatandel');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$datJabatan = $this->Amod->getData_Jabatan_byID_bySTATUS($id_jabatan, 1);
|
|
if ($datJabatan==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$countKaryawan = $this->Amod->getCount_Karyawan_byJABATAN($id_jabatan);
|
|
if ($countKaryawan>0) {
|
|
$this->session->set_flashdata('data_used', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$update = [
|
|
'STATUS_JABATAN'=> '0',
|
|
'HAPUS_JABATAN' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('jabatan', $update, 'ID_JABATAN', $id_jabatan);
|
|
|
|
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 MD_Excel_DataJabatan() {
|
|
$datJabatan = $this->Amod->getData_Jabatan_bySTATUS(1);
|
|
$nama_tabel = array('NO', 'NAMA');
|
|
|
|
$data = [
|
|
'sekarang' => date('d/m/Y H:i:s'),
|
|
'laporan' => $datJabatan,
|
|
'jumlah' => count($datJabatan),
|
|
'nama_tabel' => $nama_tabel,
|
|
'jumlah_kolom' => count($nama_tabel),
|
|
'judul' => "Semua Data"
|
|
];
|
|
$this->load->view('cetak/MD_Excel_DataJabatan', $data);
|
|
}
|
|
|
|
public function MD_MasterJenis() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "MD", "MASTER - Jenis");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$datJenis = $this->Amod->getData_Jenis_bySTATUS(1);
|
|
|
|
$data = array(
|
|
'sidebar' => "dashboard",
|
|
'navChild' => "",
|
|
'jenis' => $datJenis,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil
|
|
);
|
|
$this->load->view('proses/MD_MasterJenis', $data);
|
|
}
|
|
|
|
public function MD_Ambil_DataJenis() {
|
|
$id_jenis = $this->input->post('id_jenis');
|
|
|
|
$datJenis = $this->Amod->getData_Jenis_byID($id_jenis);
|
|
|
|
$this->output_json([
|
|
'type_jenis' => $datJenis[0]['TYPE_JENIS'],
|
|
'nama_jenis' => $datJenis[0]['NAMA_JENIS'],
|
|
'sku_jenis' => $datJenis[0]['SKU_JENIS'],
|
|
]);
|
|
}
|
|
|
|
public function MD_Tambah_DataJenis() {
|
|
$nama_jenis = $this->input->post('nama_jenis');
|
|
$type_jenis = $this->input->post('type_jenis');
|
|
$sku_jenis = $this->input->post('sku_jenis');
|
|
$nama_jenis = strtoupper(ltrim(rtrim(preg_replace('/\R+/', " " , $nama_jenis))));
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$value = 0;
|
|
$datJenis = $this->Amod->getData_Jenis_byNAMA_bySTATUS($nama_jenis, 1);
|
|
if ($datJenis==TRUE) {
|
|
$value = 2;
|
|
} else {
|
|
$cekJenis = $this->Amod->getData_Jenis_byNAMA_bySTATUS($nama_jenis, 0);
|
|
if ($cekJenis==TRUE) {
|
|
$update = [
|
|
'TYPE_JENIS' => $type_jenis,
|
|
'SKU_JENIS' => $sku_jenis,
|
|
'STATUS_JENIS' => '1',
|
|
'UBAH_JENIS' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('jenis', $update, 'ID_JENIS', $cekJenis[0]['ID_JENIS']);
|
|
} else {
|
|
$input = [
|
|
'NAMA_JENIS' => $nama_jenis,
|
|
'TYPE_JENIS' => $type_jenis,
|
|
'SKU_JENIS' => $sku_jenis,
|
|
'STATUS_JENIS' => '1',
|
|
'KOMISI_DEALER' => '0',
|
|
'KOMISI_USER' => '0',
|
|
'BIAYA_SERVICE' => '0',
|
|
'TAMBAH_JENIS' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->create('jenis', $input);
|
|
}
|
|
$value = 1;
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
}
|
|
|
|
public function MD_Ubah_DataJenis() {
|
|
$id_jenis = $this->input->post('id_jenis');
|
|
$nama_jenis = $this->input->post('nama_jenis');
|
|
$menu = $this->input->post('menu');
|
|
$nama_jenis = strtoupper(ltrim(rtrim(preg_replace('/\R+/', " " , $nama_jenis))));
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$value = 0;
|
|
$datJenis = $this->Amod->getData_Jenis_byID($id_jenis);
|
|
if ($datJenis==FALSE) {
|
|
$value = 3;
|
|
} else {
|
|
$cekJenis = $this->Amod->getData_Jenis_byNAMA_bySTATUS($nama_jenis, 1, $id_jenis);
|
|
if ($cekJenis==TRUE) {
|
|
$value = 2;
|
|
} else {
|
|
if ($menu==1) {
|
|
$update = [
|
|
'NAMA_JENIS' => $nama_jenis,
|
|
'UBAH_JENIS' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
}
|
|
|
|
$action = $this->Amod->update('jenis', $update, 'ID_JENIS', $id_jenis);
|
|
|
|
$value = 1;
|
|
}
|
|
}
|
|
|
|
$datJenisNew = $this->Amod->getData_Jenis_bySTATUS(1);
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
'jenis' => $datJenisNew,
|
|
]);
|
|
}
|
|
|
|
public function MD_Hapus_DataJenis() {
|
|
$id_jenis = $this->input->post('id_jenisdel');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$datJenis = $this->Amod->getData_Jenis_byID_bySTATUS($id_jenis, 1);
|
|
if ($datJenis==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$countBarang = $this->Amod->getCount_Barang_byJENIS($id_jenis);
|
|
if ($countBarang>0) {
|
|
$this->session->set_flashdata('data_used', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$update = [
|
|
'STATUS_JENIS' => '0',
|
|
'HAPUS_JENIS' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('jenis', $update, 'ID_JENIS', $id_jenis);
|
|
|
|
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 MD_Excel_DataJenis() {
|
|
$type_jenis = $this->input->post('type_jenisfill');
|
|
|
|
if ($type_jenis=="") {
|
|
$type_jenis = NULL;
|
|
$judul = "Semua Data";
|
|
} else {
|
|
if ($type_jenis==0) {
|
|
$judul = "NON-SN";
|
|
} else if ($type_jenis==1) {
|
|
$judul = "SN";
|
|
} else if ($type_jenis==2) {
|
|
$judul = "NON-QTY";
|
|
}
|
|
}
|
|
|
|
$datJenis = $this->Amod->getData_Jenis_byTYPE_bySTATUS($type_jenis,1);
|
|
$nama_tabel = array('NO', 'NAMA', 'TIPE');
|
|
|
|
$data = [
|
|
'sekarang' => date('d/m/Y H:i:s'),
|
|
'laporan' => $datJenis,
|
|
'jumlah' => count($datJenis),
|
|
'nama_tabel' => $nama_tabel,
|
|
'jumlah_kolom' => count($nama_tabel),
|
|
'judul' => $judul
|
|
];
|
|
$this->load->view('cetak/MD_Excel_DataJenis', $data);
|
|
}
|
|
|
|
public function MD_MasterKaryawan() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$now = date('Y-m-d');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "MD", "MASTER - Karyawan");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$datKaryawan = $this->Amod->getData_Karyawan_bySTATUS(1);
|
|
|
|
$data = array(
|
|
'sidebar' => "dashboard",
|
|
'navChild' => "",
|
|
'karyawan' => $datKaryawan,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil,
|
|
'tgl' => $now,
|
|
);
|
|
$this->load->view('proses/MD_MasterKaryawan', $data);
|
|
}
|
|
|
|
public function MD_Ambil_DataKaryawan() {
|
|
$id_karyawan = $this->input->post('id_karyawan');
|
|
|
|
$datKaryawan = $this->Amod->getData_Karyawan_byID($id_karyawan);
|
|
|
|
$this->output_json([
|
|
'nama_karyawan' => $datKaryawan[0]['NAMA_KARYAWAN'],
|
|
'nama_panggilan_karyawan' => $datKaryawan[0]['NAMA_PANGGILAN_KARYAWAN'],
|
|
'username' => $datKaryawan[0]['USERNAME'],
|
|
'id_jabatan' => $datKaryawan[0]['JABATAN_ID'],
|
|
'nama_jabatan' => $datKaryawan[0]['NAMA_JABATAN'],
|
|
'password' => $datKaryawan[0]['PASSWORD'],
|
|
'tgl_masuk' => $datKaryawan[0]['TGL_MASUK'],
|
|
'password_absen' => $datKaryawan[0]['PASSWORD_ABSEN'],
|
|
'tgl_lahir' => $datKaryawan[0]['TGL_LAHIR'],
|
|
]);
|
|
}
|
|
|
|
public function MD_Tambah_DataKaryawan() {
|
|
$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');
|
|
$password_absen = $this->input->post('password_absen');
|
|
$tgl_masuk = $this->input->post('tgl_masuk');
|
|
$tgl_lahir = $this->input->post('tgl_lahir');
|
|
$nama_karyawan = strtoupper(ltrim(rtrim(preg_replace('/\R+/', " " , $nama_karyawan))));
|
|
$nama_panggilan_karyawan = ltrim(rtrim(preg_replace('/\R+/', " " , $nama_panggilan_karyawan)));
|
|
$username = ltrim(rtrim(preg_replace('/\R+/', " " , $username)));
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$value = 0;
|
|
$datKaryawan = $this->Amod->getData_Karyawan_byNAMA_bySTATUS($nama_karyawan, 1);
|
|
if ($datKaryawan==TRUE) {
|
|
$value = 2;
|
|
} else {
|
|
$cekKaryawan = $this->Amod->getData_Karyawan_byNAMA_bySTATUS($nama_karyawan, 0);
|
|
if ($cekKaryawan==TRUE) {
|
|
$update = [
|
|
'NAMA_PANGGILAN_KARYAWAN' => $nama_panggilan_karyawan,
|
|
'USERNAME' => $username,
|
|
'JABATAN_ID' => $id_jabatan,
|
|
'PASSWORD' => $password,
|
|
'PASSWORD_ABSEN' => $password_absen,
|
|
'TGL_MASUK' => $tgl_masuk,
|
|
'TGL_LAHIR' => $tgl_lahir,
|
|
'STATUS_KARYAWAN' => '1',
|
|
'UBAH_KARYAWAN' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('karyawan', $update, 'ID_KARYAWAN', $cekKaryawan[0]['ID_KARYAWAN']);
|
|
} else {
|
|
$input = [
|
|
'NAMA_KARYAWAN' => $nama_karyawan,
|
|
'NAMA_PANGGILAN_KARYAWAN' => $nama_panggilan_karyawan,
|
|
'USERNAME' => $username,
|
|
'JABATAN_ID' => $id_jabatan,
|
|
'PASSWORD' => $password,
|
|
'PASSWORD_ABSEN' => $password_absen,
|
|
'TGL_MASUK' => $tgl_masuk,
|
|
'TGL_LAHIR' => $tgl_lahir,
|
|
'STATUS_KARYAWAN' => '1',
|
|
'TAMBAH_KARYAWAN' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->create('karyawan', $input);
|
|
}
|
|
$value = 1;
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
}
|
|
|
|
public function MD_Ubah_DataKaryawan() {
|
|
$id_karyawan = $this->input->post('id_karyawan');
|
|
$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');
|
|
$password_absen = $this->input->post('password_absen');
|
|
$tgl_masuk = $this->input->post('tgl_masuk');
|
|
$tgl_lahir = $this->input->post('tgl_lahir');
|
|
$menu = $this->input->post('menu');
|
|
$nama_karyawan = strtoupper(ltrim(rtrim(preg_replace('/\R+/', " " , $nama_karyawan))));
|
|
$nama_panggilan_karyawan = ltrim(rtrim(preg_replace('/\R+/', " " , $nama_panggilan_karyawan)));
|
|
$username = ltrim(rtrim(preg_replace('/\R+/', " " , $username)));
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$value = 0;
|
|
$datKaryawan = $this->Amod->getData_Karyawan_byID($id_karyawan);
|
|
if ($datKaryawan==FALSE) {
|
|
$value = 3;
|
|
} else {
|
|
$cekKaryawan = $this->Amod->getData_Karyawan_byNAMA_bySTATUS($nama_karyawan, 1, $id_karyawan);
|
|
if ($cekKaryawan==TRUE) {
|
|
$value = 2;
|
|
} else {
|
|
$ubah_karyawan = "Oleh $panggilan pada $timestamp";
|
|
if ($menu==1) {
|
|
$update = [
|
|
'NAMA_KARYAWAN' => $nama_karyawan,
|
|
'UBAH_KARYAWAN' => $ubah_karyawan
|
|
];
|
|
} else if ($menu==2) {
|
|
$update = [
|
|
'NAMA_PANGGILAN_KARYAWAN' => $nama_panggilan_karyawan,
|
|
'UBAH_KARYAWAN' => $ubah_karyawan
|
|
];
|
|
} else if ($menu==3) {
|
|
$update = [
|
|
'USERNAME' => $username,
|
|
'UBAH_KARYAWAN' => $ubah_karyawan
|
|
];
|
|
} else if ($menu==4) {
|
|
if ($id_jabatan!=$datKaryawan[0]['JABATAN_ID']) {
|
|
$update = [
|
|
'JABATAN_ID' => $id_jabatan,
|
|
'UBAH_KARYAWAN' => $ubah_karyawan
|
|
];
|
|
}
|
|
} else if ($menu==5) {
|
|
$update = [
|
|
'PASSWORD' => $password,
|
|
'UBAH_KARYAWAN' => $ubah_karyawan
|
|
];
|
|
} else if ($menu==6) {
|
|
$update = [
|
|
'TGL_MASUK' => $tgl_masuk,
|
|
'UBAH_KARYAWAN' => $ubah_karyawan
|
|
];
|
|
} else if ($menu==7) {
|
|
$update = [
|
|
'PASSWORD_ABSEN' => $password_absen,
|
|
'UBAH_KARYAWAN' => $ubah_karyawan
|
|
];
|
|
} else if ($menu==8) {
|
|
$update = [
|
|
'TGL_LAHIR' => $tgl_lahir,
|
|
'UBAH_KARYAWAN' => $ubah_karyawan
|
|
];
|
|
}
|
|
|
|
if ($id_jabatan==$datKaryawan[0]['JABATAN_ID'] AND $menu==4) {
|
|
$value = 4;
|
|
} else {
|
|
$action = $this->Amod->update('karyawan', $update, 'ID_KARYAWAN', $id_karyawan);
|
|
$value = 1;
|
|
}
|
|
}
|
|
}
|
|
|
|
$datKaryawanNew = $this->Amod->getData_Karyawan_bySTATUS(1);
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
'karyawan' => $datKaryawanNew,
|
|
]);
|
|
}
|
|
|
|
public function MD_Hapus_DataKaryawan() {
|
|
$id_karyawan = $this->input->post('id_karyawandel');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$datKaryawan = $this->Amod->getData_Karyawan_byID_bySTATUS($id_karyawan, 1);
|
|
if ($datKaryawan==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$countAbsensi = $this->Amod->getCount_Absensi_byKARYAWAN($id_karyawan);
|
|
$countDak = $this->Amod->getCount_DaftarAkuntansi_byKARYAWAN($id_karyawan);
|
|
$countSo = $this->Amod->getCount_SalesOrder_bySALES($id_karyawan);
|
|
if ($countAbsensi>0 OR $countDak>0 OR $countSo>0) {
|
|
$this->session->set_flashdata('data_used', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$update = [
|
|
'STATUS_KARYAWAN' => '0',
|
|
'HAPUS_KARYAWAN' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('karyawan', $update, 'ID_KARYAWAN', $id_karyawan);
|
|
|
|
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 MD_Excel_DataKaryawan() {
|
|
$id_jabatan = $this->input->post('id_jabatanfill');
|
|
|
|
if ($id_jabatan=="") {
|
|
$id_jabatan = NULL;
|
|
$judul = "Semua Data";
|
|
} else {
|
|
$datJabatan = $this->Amod->getData_Jabatan_byID($id_jabatan);
|
|
$nama_jabatan = $datJabatan[0]['NAMA_JABATAN'];
|
|
$judul = "$nama_jabatan";
|
|
}
|
|
|
|
$datKaryawan = $this->Amod->getData_Karyawan_byJABATAN_bySTATUS($id_jabatan, 1);
|
|
$nama_tabel = array('NO', 'JABATAN', 'NAMA LENGKAP', 'PANGGILAN', 'MASUK', 'LAHIR');
|
|
|
|
$data = [
|
|
'sekarang' => date('d/m/Y H:i:s'),
|
|
'laporan' => $datKaryawan,
|
|
'jumlah' => count($datKaryawan),
|
|
'nama_tabel' => $nama_tabel,
|
|
'jumlah_kolom' => count($nama_tabel),
|
|
'judul' => $judul,
|
|
];
|
|
$this->load->view('cetak/MD_Excel_DataKaryawan', $data);
|
|
}
|
|
|
|
public function MD_MasterKas() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "MD", "MASTER - Kas");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$datKas = $this->Amod->getData_Kas_bySTATUS(1);
|
|
|
|
$data = array(
|
|
'sidebar' => "dashboard",
|
|
'navChild' => "",
|
|
'kas' => $datKas,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil
|
|
);
|
|
$this->load->view('proses/MD_MasterKas', $data);
|
|
}
|
|
|
|
public function MD_Ambil_DataKas() {
|
|
$id_kas = $this->input->post('id_kas');
|
|
|
|
$datKas = $this->Amod->getData_Kas_byID($id_kas);
|
|
|
|
$this->output_json([
|
|
'kode_kas' => $datKas[0]['KODE_KAS'],
|
|
'nama_kas' => $datKas[0]['NAMA_KAS'],
|
|
]);
|
|
}
|
|
|
|
public function MD_Tambah_DataKas() {
|
|
$kode_kas = $this->input->post('kode_kas');
|
|
$nama_kas = $this->input->post('nama_kas');
|
|
$kode_kas = strtoupper(ltrim(rtrim(preg_replace('/\R+/', " " , $kode_kas))));
|
|
$nama_kas = strtoupper(ltrim(rtrim(preg_replace('/\R+/', " " , $nama_kas))));
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$value = 0;
|
|
$datKas = $this->Amod->getData_Kas_byKODE_bySTATUS($kode_kas, 1);
|
|
if ($datKas==TRUE) {
|
|
$value = 2;
|
|
} else {
|
|
$cekKas = $this->Amod->getData_Kas_byKODE_bySTATUS($kode_kas, 0);
|
|
if ($cekKas==TRUE) {
|
|
$update = [
|
|
'NAMA_KAS' => $nama_kas,
|
|
'STATUS_KAS' => '1',
|
|
'UBAH_KAS' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('kas', $update, 'ID_KAS', $cekKas[0]['ID_KAS']);
|
|
} else {
|
|
$input = [
|
|
'KODE_KAS' => $kode_kas,
|
|
'NAMA_KAS' => $nama_kas,
|
|
'STATUS_KAS' => '1',
|
|
'TAMBAH_KAS' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->create('kas', $input);
|
|
}
|
|
$value = 1;
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
}
|
|
|
|
public function MD_Ubah_DataKas() {
|
|
$id_kas = $this->input->post('id_kas');
|
|
$kode_kas = $this->input->post('kode_kas');
|
|
$nama_kas = $this->input->post('nama_kas');
|
|
$menu = $this->input->post('menu');
|
|
$kode_kas = strtoupper(ltrim(rtrim(preg_replace('/\R+/', " " , $kode_kas))));
|
|
$nama_kas = strtoupper(ltrim(rtrim(preg_replace('/\R+/', " " , $nama_kas))));
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$value = 0;
|
|
$datKas = $this->Amod->getData_Kas_byID($id_kas);
|
|
if ($datKas==FALSE) {
|
|
$value = 3;
|
|
} else {
|
|
$cekKas = $this->Amod->getData_Kas_byKODE_bySTATUS($kode_kas, 1, $id_kas);
|
|
if ($cekKas==TRUE) {
|
|
$value = 2;
|
|
} else {
|
|
if ($menu==1) {
|
|
$update = [
|
|
'KODE_KAS' => $kode_kas,
|
|
'UBAH_KAS' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
} else if ($menu==2) {
|
|
$update = [
|
|
'NAMA_KAS' => $nama_kas,
|
|
'UBAH_KAS' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
}
|
|
|
|
$action = $this->Amod->update('kas', $update, 'ID_KAS', $id_kas);
|
|
|
|
$value = 1;
|
|
}
|
|
}
|
|
|
|
$datKasNew = $this->Amod->getData_Kas_bySTATUS(1);
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
'kas' => $datKasNew,
|
|
]);
|
|
}
|
|
|
|
public function MD_Hapus_DataKas() {
|
|
$id_kas = $this->input->post('id_kasdel');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$datKas = $this->Amod->getData_Kas_byID_bySTATUS($id_kas, 1);
|
|
if ($datKas==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$countDak = $this->Amod->getCount_DaftarAkuntansi_byKAS($id_kas);
|
|
if ($countDak>0) {
|
|
$this->session->set_flashdata('data_used', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$update = [
|
|
'STATUS_KAS' => '0',
|
|
'HAPUS_KAS' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('kas', $update, 'ID_KAS', $id_kas);
|
|
|
|
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 MD_Excel_DataKas() {
|
|
$datKas = $this->Amod->getData_Kas_bySTATUS(1);
|
|
$nama_tabel = array('NO', 'KODE', 'NAMA');
|
|
|
|
$data = [
|
|
'sekarang' => date('d/m/Y H:i:s'),
|
|
'laporan' => $datKas,
|
|
'jumlah' => count($datKas),
|
|
'nama_tabel' => $nama_tabel,
|
|
'jumlah_kolom' => count($nama_tabel),
|
|
'judul' => "Semua Data"
|
|
];
|
|
$this->load->view('cetak/MD_Excel_DataKas', $data);
|
|
}
|
|
|
|
public function MD_MasterKelompok() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "MD", "MASTER - Kelompok");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$datKelompok = $this->Amod->getData_Kelompok_bySTATUS(1);
|
|
|
|
$data = array(
|
|
'sidebar' => "dashboard",
|
|
'navChild' => "",
|
|
'kelompok' => $datKelompok,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil
|
|
);
|
|
$this->load->view('proses/MD_MasterKelompok', $data);
|
|
}
|
|
|
|
public function MD_Ambil_DataKelompok() {
|
|
$id_kelompok = $this->input->post('id_kelompok');
|
|
|
|
$datKelompok = $this->Amod->getData_Kelompok_byID($id_kelompok);
|
|
|
|
$this->output_json([
|
|
'nama_kelompok' => $datKelompok[0]['NAMA_KELOMPOK'],
|
|
]);
|
|
}
|
|
|
|
public function MD_Tambah_DataKelompok() {
|
|
$nama_kelompok = $this->input->post('nama_kelompok');
|
|
$nama_kelompok = strtoupper(ltrim(rtrim(preg_replace('/\R+/', " " , $nama_kelompok))));
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$value = 0;
|
|
$datKelompok = $this->Amod->getData_Kelompok_byNAMA_bySTATUS($nama_kelompok, 1);
|
|
if ($datKelompok==TRUE) {
|
|
$value = 2;
|
|
} else {
|
|
$cekKelompok = $this->Amod->getData_Kelompok_byNAMA_bySTATUS($nama_kelompok, 0);
|
|
if ($cekKelompok==TRUE) {
|
|
$update = [
|
|
'STATUS_KELOMPOK' => '1',
|
|
'UBAH_KELOMPOK' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('kelompok', $update, 'ID_KELOMPOK', $cekKelompok[0]['ID_KELOMPOK']);
|
|
} else {
|
|
$input = [
|
|
'NAMA_KELOMPOK' => $nama_kelompok,
|
|
'STATUS_KELOMPOK' => '1',
|
|
'TAMBAH_KELOMPOK' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->create('kelompok', $input);
|
|
}
|
|
$value = 1;
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
}
|
|
|
|
public function MD_Ubah_DataKelompok() {
|
|
$id_kelompok = $this->input->post('id_kelompok');
|
|
$nama_kelompok = $this->input->post('nama_kelompok');
|
|
$menu = $this->input->post('menu');
|
|
$nama_kelompok = strtoupper(ltrim(rtrim(preg_replace('/\R+/', " " , $nama_kelompok))));
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$value = 0;
|
|
$datKelompok = $this->Amod->getData_Kelompok_byID($id_kelompok);
|
|
if ($datKelompok==FALSE) {
|
|
$value = 3;
|
|
} else {
|
|
$cekKelompok = $this->Amod->getData_Kelompok_byNAMA_bySTATUS($nama_kelompok, 1, $id_kelompok);
|
|
if ($cekKelompok==TRUE) {
|
|
$value = 2;
|
|
} else {
|
|
if ($menu==1) {
|
|
$update = [
|
|
'NAMA_KELOMPOK' => $nama_kelompok,
|
|
'UBAH_KELOMPOK' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
}
|
|
|
|
$action = $this->Amod->update('kelompok', $update, 'ID_KELOMPOK', $id_kelompok);
|
|
|
|
$value = 1;
|
|
}
|
|
}
|
|
|
|
$datKelompokNew = $this->Amod->getData_Kelompok_bySTATUS(1);
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
'kelompok' => $datKelompokNew,
|
|
]);
|
|
}
|
|
|
|
public function MD_Hapus_DataKelompok() {
|
|
$id_kelompok = $this->input->post('id_kelompokdel');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$datKelompok = $this->Amod->getData_Kelompok_byID_bySTATUS($id_kelompok, 1);
|
|
if ($datKelompok==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$countPelanggan = $this->Amod->getCount_Pelanggan_byKELOMPOK($id_kelompok);
|
|
if ($countPelanggan>0) {
|
|
$this->session->set_flashdata('data_used', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$update = [
|
|
'STATUS_KELOMPOK' => '0',
|
|
'HAPUS_KELOMPOK' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('kelompok', $update, 'ID_KELOMPOK', $id_kelompok);
|
|
|
|
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 MD_Excel_DataKelompok() {
|
|
$datKelompok = $this->Amod->getData_Kelompok_bySTATUS(1);
|
|
$nama_tabel = array('NO', 'NAMA');
|
|
|
|
$data = [
|
|
'sekarang' => date('d/m/Y H:i:s'),
|
|
'laporan' => $datKelompok,
|
|
'jumlah' => count($datKelompok),
|
|
'nama_tabel' => $nama_tabel,
|
|
'jumlah_kolom' => count($nama_tabel),
|
|
'judul' => "Semua Data"
|
|
];
|
|
$this->load->view('cetak/MD_Excel_DataKelompok', $data);
|
|
}
|
|
|
|
public function MD_MasterKendaraan() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "MD", "MASTER - Kas");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$datKendaraan = $this->Amod->getData_Kendaraan_bySTATUS(1);
|
|
|
|
$data = array(
|
|
'sidebar' => "dashboard",
|
|
'navChild' => "",
|
|
'kendaraan' => $datKendaraan,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil
|
|
);
|
|
$this->load->view('proses/MD_MasterKendaraan', $data);
|
|
}
|
|
|
|
public function MD_Ambil_DataKendaraan() {
|
|
$id_kendaraan = $this->input->post('id_kendaraan');
|
|
|
|
$datKendaraan = $this->Amod->getData_Kendaraan_byID($id_kendaraan);
|
|
|
|
$this->output_json([
|
|
'type_kendaraan' => $datKendaraan[0]['TYPE_KENDARAAN'],
|
|
'nama_kendaraan' => $datKendaraan[0]['NAMA_KENDARAAN'],
|
|
'nopol_kendaraan' => $datKendaraan[0]['NOPOL_KENDARAAN'],
|
|
]);
|
|
}
|
|
|
|
public function MD_Tambah_DataKendaraan() {
|
|
$nama_kendaraan = $this->input->post('nama_kendaraan');
|
|
$nopol_kendaraan = $this->input->post('nopol_kendaraan');
|
|
$type_kendaraan = $this->input->post('type_kendaraan');
|
|
$nama_kendaraan = strtoupper(ltrim(rtrim(preg_replace('/\R+/', " " , $nama_kendaraan))));
|
|
$nopol_kendaraan = strtoupper(ltrim(rtrim(preg_replace('/\R+/', " " , $nopol_kendaraan))));
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$value = 0;
|
|
$datKendaraan = $this->Amod->getData_Kendaraan_byNOPOL_bySTATUS($nopol_kendaraan, 1);
|
|
if ($datKendaraan==TRUE) {
|
|
$value = 2;
|
|
} else {
|
|
$cekKendaraan = $this->Amod->getData_Kendaraan_byNOPOL_bySTATUS($nopol_kendaraan, 0);
|
|
if ($cekKendaraan==TRUE) {
|
|
$update = [
|
|
'NAMA_KENDARAAN' => $nama_kendaraan,
|
|
'TYPE_KENDARAAN' => $type_kendaraan,
|
|
'STATUS_KENDARAAN' => '1',
|
|
'UBAH_KENDARAAN' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('kendaraan', $update, 'ID_KENDARAAN', $cekKendaraan[0]['ID_KENDARAAN']);
|
|
} else {
|
|
$input = [
|
|
'NOPOL_KENDARAAN' => $nopol_kendaraan,
|
|
'NAMA_KENDARAAN' => $nama_kendaraan,
|
|
'TYPE_KENDARAAN' => $type_kendaraan,
|
|
'STATUS_KENDARAAN' => '1',
|
|
'TAMBAH_KENDARAAN' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->create('kendaraan', $input);
|
|
}
|
|
$value = 1;
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
}
|
|
|
|
public function MD_Ubah_DataKendaraan() {
|
|
$id_kendaraan = $this->input->post('id_kendaraan');
|
|
$nopol_kendaraan = $this->input->post('nopol_kendaraan');
|
|
$nama_kendaraan = $this->input->post('nama_kendaraan');
|
|
$type_kendaraan = $this->input->post('type_kendaraan');
|
|
$menu = $this->input->post('menu');
|
|
$nopol_kendaraan = strtoupper(ltrim(rtrim(preg_replace('/\R+/', " " , $nopol_kendaraan))));
|
|
$nama_kendaraan = strtoupper(ltrim(rtrim(preg_replace('/\R+/', " " , $nama_kendaraan))));
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$value = 0;
|
|
$datKendaraan = $this->Amod->getData_Kendaraan_byID($id_kendaraan);
|
|
if ($datKendaraan==FALSE) {
|
|
$value = 3;
|
|
} else {
|
|
$cekKendaraan = $this->Amod->getData_Kendaraan_byNOPOL_bySTATUS($nopol_kendaraan, 1, $id_kendaraan);
|
|
if ($cekKendaraan==TRUE) {
|
|
$value = 2;
|
|
} else {
|
|
if ($menu==1) {
|
|
$update = [
|
|
'NOPOL_KENDARAAN' => $nopol_kendaraan,
|
|
'UBAH_KENDARAAN' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
} else if ($menu==2) {
|
|
$update = [
|
|
'NAMA_KENDARAAN' => $nama_kendaraan,
|
|
'UBAH_KENDARAAN' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
} else if ($menu==3) {
|
|
$update = [
|
|
'TYPE_KENDARAAN' => $type_kendaraan,
|
|
'UBAH_KENDARAAN' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
}
|
|
|
|
$action = $this->Amod->update('kendaraan', $update, 'ID_KENDARAAN', $id_kendaraan);
|
|
|
|
$value = 1;
|
|
}
|
|
}
|
|
|
|
$datKendaraanNew = $this->Amod->getData_Kendaraan_bySTATUS(1);
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
'kendaraan' => $datKendaraanNew,
|
|
]);
|
|
}
|
|
|
|
public function MD_Hapus_DataKendaraan() {
|
|
$id_kendaraan = $this->input->post('id_kendaraandel');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$datKendaraan = $this->Amod->getData_Kendaraan_byID_bySTATUS($id_kendaraan, 1);
|
|
if ($datKendaraan==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$countDak = $this->Amod->getCount_DaftarAkuntansi_byKENDARAAN($id_kendaraan);
|
|
if ($countDak>0) {
|
|
$this->session->set_flashdata('data_used', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$update = [
|
|
'STATUS_KENDARAAN' => '0',
|
|
'HAPUS_KENDARAAN' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('kendaraan', $update, 'ID_KENDARAAN', $id_kendaraan);
|
|
|
|
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 MD_Excel_DataKendaraan() {
|
|
$type_kendaraan = $this->input->post('type_kendaraanfill');
|
|
|
|
if ($type_kendaraan=="") {
|
|
$type_kendaraan = NULL;
|
|
$judul = "Semua Data";
|
|
} else {
|
|
if ($type_kendaraan==1) {
|
|
$judul = "MOTOR";
|
|
} else if ($type_kendaraan==2) {
|
|
$judul = "MOBIL";
|
|
}
|
|
}
|
|
|
|
$datKendaraan = $this->Amod->getData_Kendaraan_byTYPE_bySTATUS($type_kendaraan,1);
|
|
$nama_tabel = array('NO', 'TIPE', 'NOPOL', 'NAMA');
|
|
|
|
$data = [
|
|
'sekarang' => date('d/m/Y H:i:s'),
|
|
'laporan' => $datKendaraan,
|
|
'jumlah' => count($datKendaraan),
|
|
'nama_tabel' => $nama_tabel,
|
|
'jumlah_kolom' => count($nama_tabel),
|
|
'judul' => $judul
|
|
];
|
|
$this->load->view('cetak/MD_Excel_DataKendaraan', $data);
|
|
}
|
|
|
|
public function MD_MasterKota() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "MD", "MASTER - Kota");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$datKota = $this->Amod->getData_Kota_bySTATUS(1);
|
|
|
|
$data = array(
|
|
'sidebar' => "dashboard",
|
|
'navChild' => "",
|
|
'kota' => $datKota,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil
|
|
);
|
|
$this->load->view('proses/MD_MasterKota', $data);
|
|
}
|
|
|
|
public function MD_Ambil_DataKota() {
|
|
$id_kota = $this->input->post('id_kota');
|
|
|
|
$datKota = $this->Amod->getData_Kota_byID($id_kota);
|
|
|
|
$this->output_json([
|
|
'nama_kota' => $datKota[0]['NAMA_KOTA'],
|
|
]);
|
|
}
|
|
|
|
public function MD_Tambah_DataKota() {
|
|
$nama_kota = $this->input->post('nama_kota');
|
|
$nama_kota = strtoupper(ltrim(rtrim(preg_replace('/\R+/', " " , $nama_kota))));
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$value = 0;
|
|
$datKota = $this->Amod->getData_Kota_byNAMA_bySTATUS($nama_kota, 1);
|
|
if ($datKota==TRUE) {
|
|
$value = 2;
|
|
} else {
|
|
$cekKota = $this->Amod->getData_Kota_byNAMA_bySTATUS($nama_kota, 0);
|
|
if ($cekKota==TRUE) {
|
|
$update = [
|
|
'STATUS_KOTA' => '1',
|
|
'UBAH_KOTA' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('kota', $update, 'ID_KOTA', $cekKota[0]['ID_KOTA']);
|
|
} else {
|
|
$input = [
|
|
'NAMA_KOTA' => $nama_kota,
|
|
'STATUS_KOTA' => '1',
|
|
'TAMBAH_KOTA' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->create('kota', $input);
|
|
}
|
|
$value = 1;
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
}
|
|
|
|
public function MD_Ubah_DataKota() {
|
|
$id_kota = $this->input->post('id_kota');
|
|
$nama_kota = $this->input->post('nama_kota');
|
|
$menu = $this->input->post('menu');
|
|
$nama_kota = strtoupper(ltrim(rtrim(preg_replace('/\R+/', " " , $nama_kota))));
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$value = 0;
|
|
$datKota = $this->Amod->getData_Kota_byID($id_kota);
|
|
if ($datKota==FALSE) {
|
|
$value = 3;
|
|
} else {
|
|
$cekKota = $this->Amod->getData_Kota_byNAMA_bySTATUS($nama_kota, 1, $id_kota);
|
|
if ($cekKota==TRUE) {
|
|
$value = 2;
|
|
} else {
|
|
if ($menu==1) {
|
|
$update = [
|
|
'NAMA_KOTA' => $nama_kota,
|
|
'UBAH_KOTA' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
}
|
|
|
|
$action = $this->Amod->update('kota', $update, 'ID_KOTA', $id_kota);
|
|
|
|
$value = 1;
|
|
}
|
|
}
|
|
|
|
$datKotaNew = $this->Amod->getData_Kota_bySTATUS(1);
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
'kota' => $datKotaNew,
|
|
]);
|
|
}
|
|
|
|
public function MD_Hapus_DataKota() {
|
|
$id_kota = $this->input->post('id_kotadel');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$datKota = $this->Amod->getData_Kota_byID_bySTATUS($id_kota, 1);
|
|
if ($datKota==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$countPelanggan = $this->Amod->getCount_Pelanggan_byKOTA($id_kota);
|
|
$countPihakke3 = $this->Amod->getCount_Pihakke3_byKOTA($id_kota);
|
|
$countSupplier = $this->Amod->getCount_Supplier_byKOTA($id_kota);
|
|
if ($countPelanggan>0 OR $countPihakke3>0 OR $countSupplier>0) {
|
|
$this->session->set_flashdata('data_used', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$update = [
|
|
'STATUS_KOTA' => '0',
|
|
'HAPUS_KOTA' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('kota', $update, 'ID_KOTA', $id_kota);
|
|
|
|
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 MD_Excel_DataKota() {
|
|
$datKota = $this->Amod->getData_Kota_bySTATUS(1);
|
|
$nama_tabel = array('NO', 'NAMA');
|
|
|
|
$data = [
|
|
'sekarang' => date('d/m/Y H:i:s'),
|
|
'laporan' => $datKota,
|
|
'jumlah' => count($datKota),
|
|
'nama_tabel' => $nama_tabel,
|
|
'jumlah_kolom' => count($nama_tabel),
|
|
'judul' => "Semua Data"
|
|
];
|
|
$this->load->view('cetak/MD_Excel_DataKota', $data);
|
|
}
|
|
|
|
public function MD_MasterMerk() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "MD", "MASTER - Merk");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$datMerk = $this->Amod->getData_Merk_bySTATUS(1);
|
|
|
|
$data = array(
|
|
'sidebar' => "dashboard",
|
|
'navChild' => "",
|
|
'merk' => $datMerk,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil
|
|
);
|
|
$this->load->view('proses/MD_MasterMerk', $data);
|
|
}
|
|
|
|
public function MD_Ambil_DataMerk() {
|
|
$id_merk = $this->input->post('id_merk');
|
|
|
|
$datMerk = $this->Amod->getData_Merk_byID($id_merk);
|
|
|
|
$this->output_json([
|
|
'nama_merk' => $datMerk[0]['NAMA_MERK'],
|
|
]);
|
|
}
|
|
|
|
public function MD_Tambah_DataMerk() {
|
|
$nama_merk = $this->input->post('nama_merk');
|
|
$nama_merk = strtoupper(ltrim(rtrim(preg_replace('/\R+/', " " , $nama_merk))));
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$value = 0;
|
|
$datMerk = $this->Amod->getData_Merk_byNAMA_bySTATUS($nama_merk, 1);
|
|
if ($datMerk==TRUE) {
|
|
$value = 2;
|
|
} else {
|
|
$cekMerk = $this->Amod->getData_Merk_byNAMA_bySTATUS($nama_merk, 0);
|
|
if ($cekMerk==TRUE) {
|
|
$update = [
|
|
'STATUS_MERK' => '1',
|
|
'UBAH_MERK' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('merk', $update, 'ID_MERK', $cekMerk[0]['ID_MERK']);
|
|
} else {
|
|
$input = [
|
|
'NAMA_MERK' => $nama_merk,
|
|
'STATUS_MERK' => '1',
|
|
'TAMBAH_MERK' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->create('merk', $input);
|
|
}
|
|
$value = 1;
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
}
|
|
|
|
public function MD_Ubah_DataMerk() {
|
|
$id_merk = $this->input->post('id_merk');
|
|
$nama_merk = $this->input->post('nama_merk');
|
|
$menu = $this->input->post('menu');
|
|
$nama_merk = strtoupper(ltrim(rtrim(preg_replace('/\R+/', " " , $nama_merk))));
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$value = 0;
|
|
$datMerk = $this->Amod->getData_Merk_byID($id_merk);
|
|
if ($datMerk==FALSE) {
|
|
$value = 3;
|
|
} else {
|
|
$cekMerk = $this->Amod->getData_Merk_byNAMA_bySTATUS($nama_merk, 1, $id_merk);
|
|
if ($cekMerk==TRUE) {
|
|
$value = 2;
|
|
} else {
|
|
if ($menu==1) {
|
|
$update = [
|
|
'NAMA_MERK' => $nama_merk,
|
|
'UBAH_MERK' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
}
|
|
|
|
$action = $this->Amod->update('merk', $update, 'ID_MERK', $id_merk);
|
|
|
|
$value = 1;
|
|
}
|
|
}
|
|
|
|
$datMerkNew = $this->Amod->getData_Merk_bySTATUS(1);
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
'merk' => $datMerkNew,
|
|
]);
|
|
}
|
|
|
|
public function MD_Hapus_DataMerk() {
|
|
$id_merk = $this->input->post('id_merkdel');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$datMerk = $this->Amod->getData_Merk_byID_bySTATUS($id_merk, 1);
|
|
if ($datMerk==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$countBarang = $this->Amod->getCount_Barang_byMERK($id_merk);
|
|
$countRkpr = $this->Amod->getCount_RekapKlaimProgram_byMERK($id_merk);
|
|
$countSsp = $this->Amod->getCount_SetSalesProduk_byMERK($id_merk);
|
|
if ($countBarang>0 OR $countRkpr>0 OR $countSsp>0) {
|
|
$this->session->set_flashdata('data_used', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$update = [
|
|
'STATUS_MERK' => '0',
|
|
'HAPUS_MERK' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('merk', $update, 'ID_MERK', $id_merk);
|
|
|
|
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 MD_Excel_DataMerk() {
|
|
$datMerk = $this->Amod->getData_Merk_bySTATUS(1);
|
|
$nama_tabel = array('NO', 'NAMA');
|
|
|
|
$data = [
|
|
'sekarang' => date('d/m/Y H:i:s'),
|
|
'laporan' => $datMerk,
|
|
'jumlah' => count($datMerk),
|
|
'nama_tabel' => $nama_tabel,
|
|
'jumlah_kolom' => count($nama_tabel),
|
|
'judul' => "Semua Data"
|
|
];
|
|
$this->load->view('cetak/MD_Excel_DataMerk', $data);
|
|
}
|
|
|
|
public function MD_MasterModel() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "MD", "MASTER - Model");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$datModel = $this->Amod->getData_Model_bySTATUS(1);
|
|
|
|
$data = array(
|
|
'sidebar' => "dashboard",
|
|
'navChild' => "",
|
|
'model' => $datModel,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil
|
|
);
|
|
$this->load->view('proses/MD_MasterModel', $data);
|
|
}
|
|
|
|
public function MD_Ambil_DataModel() {
|
|
$id_model = $this->input->post('id_model');
|
|
|
|
$datModel = $this->Amod->getData_Model_byID($id_model);
|
|
|
|
$this->output_json([
|
|
'nama_model' => $datModel[0]['NAMA_MODEL'],
|
|
]);
|
|
}
|
|
|
|
public function MD_Tambah_DataModel() {
|
|
$nama_model = $this->input->post('nama_model');
|
|
$nama_model = strtoupper(ltrim(rtrim(preg_replace('/\R+/', " " , $nama_model))));
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$value = 0;
|
|
$datModel = $this->Amod->getData_Model_byNAMA_bySTATUS($nama_model, 1);
|
|
if ($datModel==TRUE) {
|
|
$value = 2;
|
|
} else {
|
|
$cekModel = $this->Amod->getData_Model_byNAMA_bySTATUS($nama_model, 0);
|
|
if ($cekModel==TRUE) {
|
|
$update = [
|
|
'STATUS_MODEL' => '1',
|
|
'UBAH_MODEL' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('model', $update, 'ID_MODEL', $cekModel[0]['ID_MODEL']);
|
|
} else {
|
|
$input = [
|
|
'NAMA_MODEL' => $nama_model,
|
|
'STATUS_MODEL' => '1',
|
|
'TAMBAH_MODEL' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->create('model', $input);
|
|
}
|
|
$value = 1;
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
}
|
|
|
|
public function MD_Ubah_DataModel() {
|
|
$id_model = $this->input->post('id_model');
|
|
$nama_model = $this->input->post('nama_model');
|
|
$menu = $this->input->post('menu');
|
|
$nama_model = strtoupper(ltrim(rtrim(preg_replace('/\R+/', " " , $nama_model))));
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$value = 0;
|
|
$datModel = $this->Amod->getData_Model_byID($id_model);
|
|
if ($datModel==FALSE) {
|
|
$value = 3;
|
|
} else {
|
|
$cekModel = $this->Amod->getData_Model_byNAMA_bySTATUS($nama_model, 1, $id_model);
|
|
if ($cekModel==TRUE) {
|
|
$value = 2;
|
|
} else {
|
|
if ($menu==1) {
|
|
$update = [
|
|
'NAMA_MODEL' => $nama_model,
|
|
'UBAH_MODEL' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
}
|
|
|
|
$action = $this->Amod->update('model', $update, 'ID_MODEL', $id_model);
|
|
|
|
$value = 1;
|
|
}
|
|
}
|
|
|
|
$datModelNew = $this->Amod->getData_Model_bySTATUS(1);
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
'model' => $datModelNew,
|
|
]);
|
|
}
|
|
|
|
public function MD_Hapus_DataModel() {
|
|
$id_model = $this->input->post('id_modeldel');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$datModel = $this->Amod->getData_Model_byID_bySTATUS($id_model, 1);
|
|
if ($datModel==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$countBarang = $this->Amod->getCount_Barang_byMODEL($id_model);
|
|
if ($countBarang>0) {
|
|
$this->session->set_flashdata('data_used', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$update = [
|
|
'STATUS_MODEL' => '0',
|
|
'HAPUS_MODEL' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('model', $update, 'ID_MODEL', $id_model);
|
|
|
|
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 MD_Excel_DataModel() {
|
|
$datModel = $this->Amod->getData_Model_bySTATUS(1);
|
|
$nama_tabel = array('NO', 'NAMA');
|
|
|
|
$data = [
|
|
'sekarang' => date('d/m/Y H:i:s'),
|
|
'laporan' => $datModel,
|
|
'jumlah' => count($datModel),
|
|
'nama_tabel' => $nama_tabel,
|
|
'jumlah_kolom' => count($nama_tabel),
|
|
'judul' => "Semua Data"
|
|
];
|
|
$this->load->view('cetak/MD_Excel_DataModel', $data);
|
|
}
|
|
|
|
public function MD_MasterPart() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "MD", "MASTER - Model");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$datPart = $this->Amod->getData_Part_bySTATUS(1);
|
|
$no = 0;
|
|
foreach ($datPart as $key) {
|
|
$datHpar = $this->Amod->getData_HargaPart_byPART_orderDESC_limit1($key['ID_PART']);
|
|
$datPart[$no] += ['HPP' => $datHpar[0]['HPP']];
|
|
$datPart[$no] += ['TANGGAL' => $datHpar[0]['TANGGAL']];
|
|
$datPart[$no] += ['HPP_HPAR' => $datHpar[0]['HPP_HPAR']];
|
|
$datPart[$no++] += ['TGL_HPAR' => $datHpar[0]['TGL_HPAR']];
|
|
}
|
|
|
|
$data = array(
|
|
'sidebar' => "dashboard",
|
|
'navChild' => "",
|
|
'part' => $datPart,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil
|
|
);
|
|
$this->load->view('proses/MD_MasterPart', $data);
|
|
}
|
|
|
|
public function MD_Ambil_DataPart() {
|
|
$id_part = $this->input->post('id_part');
|
|
|
|
$datHpar = $this->Amod->getData_HargaPart_byPART_orderDESC_limit1($id_part);
|
|
$tanggal = $datHpar[0]['TANGGAL'];
|
|
$hpp = $datHpar[0]['HPP'];
|
|
|
|
$this->output_json([
|
|
'nama_part' => $datHpar[0]['NAMA_PART'],
|
|
'hpp_hpar' => $datHpar[0]['HPP_HPAR'],
|
|
'dataLama' => "$hpp [$tanggal]",
|
|
]);
|
|
}
|
|
|
|
public function MD_Tambah_DataPart() {
|
|
$nama_part = $this->input->post('nama_part');
|
|
$hpp_hpar = $this->input->post('hpp_hpar');
|
|
$nama_part = strtoupper(ltrim(rtrim(preg_replace('/\R+/', " " , $nama_part))));
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
$now = date('Y-m-d');
|
|
|
|
$value = 0;
|
|
$datPart = $this->Amod->getData_Part_byNAMA_bySTATUS($nama_part, 1);
|
|
if ($datPart==TRUE) {
|
|
$value = 2;
|
|
} else {
|
|
$cekPart = $this->Amod->getData_Part_byNAMA_bySTATUS($nama_part, 0);
|
|
if ($cekPart==TRUE) {
|
|
$update = [
|
|
'STATUS_PART' => '1',
|
|
'UBAH_PART' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('part', $update, 'ID_PART', $cekPart[0]['ID_PART']);
|
|
|
|
$id_part = $cekPart[0]['ID_PART'];
|
|
} else {
|
|
$input = [
|
|
'NAMA_PART' => $nama_part,
|
|
'STATUS_PART' => '1',
|
|
'TAMBAH_PART' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->create('part', $input);
|
|
|
|
$id_part = $this->Amod->getMax_ID_Part();
|
|
$id_part = $id_part[0]['ID_PART'];
|
|
}
|
|
|
|
$input = [
|
|
'PART_ID' => $id_part,
|
|
'TGL_HPAR' => $now,
|
|
'HPP_HPAR' => $hpp_hpar
|
|
];
|
|
$action = $this->Amod->create('harga_part', $input);
|
|
$value = 1;
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
}
|
|
|
|
public function MD_Ubah_DataPart() {
|
|
$id_part = $this->input->post('id_part');
|
|
$nama_part = $this->input->post('nama_part');
|
|
$hpp_hpar = $this->input->post('hpp_hpar');
|
|
$menu = $this->input->post('menu');
|
|
$nama_part = strtoupper(ltrim(rtrim(preg_replace('/\R+/', " " , $nama_part))));
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
$now = date('Y-m-d');
|
|
|
|
$value = 0;
|
|
$datPart = $this->Amod->getData_Part_byID($id_part);
|
|
if ($datPart==FALSE) {
|
|
$value = 3;
|
|
} else {
|
|
$cekPart = $this->Amod->getData_Part_byNAMA_bySTATUS($nama_part, 1, $id_part);
|
|
if ($cekPart==TRUE) {
|
|
$value = 2;
|
|
} else {
|
|
if ($menu==1) {
|
|
$update = [
|
|
'NAMA_PART' => $nama_part,
|
|
'UBAH_PART' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
} else if ($menu==2) {
|
|
$input = [
|
|
'PART_ID' => $id_part,
|
|
'TGL_HPAR' => $now,
|
|
'HPP_HPAR' => $hpp_hpar
|
|
];
|
|
$action = $this->Amod->create('harga_part', $input);
|
|
|
|
$update = [
|
|
'UBAH_PART' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
}
|
|
|
|
$action = $this->Amod->update('part', $update, 'ID_PART', $id_part);
|
|
|
|
$value = 1;
|
|
}
|
|
}
|
|
|
|
$datPartNew = $this->Amod->getData_Part_bySTATUS(1);
|
|
$no = 0;
|
|
foreach ($datPartNew as $key) {
|
|
$datHpar = $this->Amod->getData_HargaPart_byPART_orderDESC_limit1($key['ID_PART']);
|
|
$datPartNew[$no] += ['HPP' => $datHpar[0]['HPP']];
|
|
$datPartNew[$no] += ['TANGGAL' => $datHpar[0]['TANGGAL']];
|
|
$datPartNew[$no] += ['HPP_HPAR' => $datHpar[0]['HPP_HPAR']];
|
|
$datPartNew[$no++] += ['TGL_HPAR' => $datHpar[0]['TGL_HPAR']];
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
'part' => $datPartNew,
|
|
]);
|
|
}
|
|
|
|
public function MD_Hapus_DataPart() {
|
|
$id_part = $this->input->post('id_partdel');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$datPart = $this->Amod->getData_Part_byID_bySTATUS($id_part, 1);
|
|
if ($datPart==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$countIo = $this->Amod->getCount_TransaksiStock_byPART($id_part);
|
|
if ($countIo>0) {
|
|
$this->session->set_flashdata('data_used', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$update = [
|
|
'STATUS_PART' => '0',
|
|
'HAPUS_PART' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('part', $update, 'ID_PART', $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']);
|
|
}
|
|
|
|
}
|
|
|
|
public function MD_Excel_DataPart() {
|
|
$datPart = $this->Amod->getData_Part_bySTATUS(1);
|
|
$no = 0;
|
|
foreach ($datPart as $key) {
|
|
$datHpar = $this->Amod->getData_HargaPart_byPART_orderDESC_limit1($key['ID_PART']);
|
|
|
|
$datPart[$no] += ['HPP' => $datHpar[0]['HPP']];
|
|
$datPart[$no++] += ['TANGGAL' => $datHpar[0]['TANGGAL']];
|
|
}
|
|
|
|
$nama_tabel = array('NO', 'NAMA', 'TANGGAL', 'HPP');
|
|
|
|
$data = [
|
|
'sekarang' => date('d/m/Y H:i:s'),
|
|
'laporan' => $datPart,
|
|
'jumlah' => count($datPart),
|
|
'nama_tabel' => $nama_tabel,
|
|
'jumlah_kolom' => count($nama_tabel),
|
|
'judul' => "Semua Data"
|
|
];
|
|
$this->load->view('cetak/MD_Excel_DataPart', $data);
|
|
}
|
|
|
|
public function MD_MasterPelanggan() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "MD", "MASTER - Pelanggan");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$data = array(
|
|
'sidebar' => "dashboard",
|
|
'navChild' => "",
|
|
'hak' => $hak,
|
|
'tampil' => $tampil
|
|
);
|
|
$this->load->view('proses/MD_MasterPelanggan', $data);
|
|
}
|
|
|
|
public function MD_Ambil_DataPelanggan() {
|
|
$id_pelanggan = $this->input->post('id_pelanggan');
|
|
|
|
$datPelanggan = $this->Amod->getData_Pelanggan_byID($id_pelanggan);
|
|
|
|
$this->output_json([
|
|
'nama_pelanggan' => $datPelanggan[0]['NAMA_PELANGGAN'],
|
|
'alias_pelanggan' => $datPelanggan[0]['ALIAS_PELANGGAN'],
|
|
'pic_pelanggan' => $datPelanggan[0]['PIC_PELANGGAN'],
|
|
'alamat_pelanggan' => $datPelanggan[0]['ALAMAT_PELANGGAN'],
|
|
'kirim_pelanggan' => $datPelanggan[0]['KIRIM_PELANGGAN'],
|
|
'telp_pelanggan' => $datPelanggan[0]['TELP_PELANGGAN'],
|
|
'type_pelanggan' => $datPelanggan[0]['TYPE_PELANGGAN'],
|
|
'email_pelanggan' => $datPelanggan[0]['EMAIL_PELANGGAN'],
|
|
'npwp_pelanggan' => $datPelanggan[0]['NPWP_PELANGGAN'],
|
|
'limit_pelanggan' => $datPelanggan[0]['LIMIT_PELANGGAN'],
|
|
'top_pelanggan' => $datPelanggan[0]['TOP_PELANGGAN'],
|
|
'jangka_pelanggan' => $datPelanggan[0]['JANGKA_PELANGGAN'],
|
|
'id_kota' => $datPelanggan[0]['KOTA_ID'],
|
|
'nama_kota' => $datPelanggan[0]['NAMA_KOTA'],
|
|
'nama_kelompok' => $datPelanggan[0]['NAMA_KELOMPOK'],
|
|
'id_kelompok' => $datPelanggan[0]['KELOMPOK_ID'],
|
|
]);
|
|
}
|
|
|
|
public function MD_Tambah_DataPelanggan() {
|
|
$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');
|
|
$pic_pelanggan = $this->input->post('pic_pelanggan');
|
|
$alamat_pelanggan = $this->input->post('alamat_pelanggan');
|
|
$kirim_pelanggan = $this->input->post('kirim_pelanggan');
|
|
$telp_pelanggan = $this->input->post('telp_pelanggan');
|
|
$type_pelanggan = $this->input->post('type_pelanggan');
|
|
$email_pelanggan = $this->input->post('email_pelanggan');
|
|
$npwp_pelanggan = $this->input->post('npwp_pelanggan');
|
|
$top_pelanggan = $this->input->post('top_pelanggan');
|
|
$jangka_pelanggan = $this->input->post('jangka_pelanggan');
|
|
$nama_pelanggan = strtoupper(ltrim(rtrim(preg_replace('/\R+/', " " , $nama_pelanggan))));
|
|
$alias_pelanggan = strtoupper(ltrim(rtrim(preg_replace('/\R+/', " " , $alias_pelanggan))));
|
|
$pic_pelanggan = ltrim(rtrim(preg_replace('/\R+/', " " , $pic_pelanggan)));
|
|
$alamat_pelanggan = strtoupper(ltrim(rtrim(preg_replace('/\R+/', " " , $alamat_pelanggan))));
|
|
$kirim_pelanggan = strtoupper(ltrim(rtrim(preg_replace('/\R+/', " " , $kirim_pelanggan))));
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
if ($type_pelanggan==2) {
|
|
$limit_pelanggan=25000000;
|
|
} else if ($type_pelanggan==1) {
|
|
$limit_pelanggan=100000000;
|
|
} else if ($type_pelanggan==0) {
|
|
$limit_pelanggan=300000000;
|
|
}
|
|
|
|
$value = 0;
|
|
$datPelanggan = $this->Amod->getData_Pelanggan_byNAMA_bySTATUS($nama_pelanggan, 1);
|
|
if ($datPelanggan==TRUE) {
|
|
$value = 2;
|
|
} else {
|
|
$cekPelanggan = $this->Amod->getData_Pelanggan_byNAMA_bySTATUS($nama_pelanggan, 0);
|
|
if ($cekPelanggan==TRUE) {
|
|
$update = [
|
|
'ALIAS_PELANGGAN' => $alias_pelanggan,
|
|
'PIC_PELANGGAN' => $pic_pelanggan,
|
|
'ALAMAT_PELANGGAN' => $alamat_pelanggan,
|
|
'KIRIM_PELANGGAN' => $kirim_pelanggan,
|
|
'KELOMPOK_ID' => $id_kelompok,
|
|
'KOTA_ID' => $id_kota,
|
|
'TELP_PELANGGAN' => $telp_pelanggan,
|
|
'TYPE_PELANGGAN' => $type_pelanggan,
|
|
'EMAIL_PELANGGAN' => $email_pelanggan,
|
|
'NPWP_PELANGGAN' => $npwp_pelanggan,
|
|
'LIMIT_PELANGGAN' => $limit_pelanggan,
|
|
'TOP_PELANGGAN' => $top_pelanggan,
|
|
'JANGKA_PELANGGAN' => $jangka_pelanggan,
|
|
'STATUS_PELANGGAN' => '1',
|
|
'UBAH_PELANGGAN' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('pelanggan', $update, 'ID_PELANGGAN', $cekPelanggan[0]['ID_PELANGGAN']);
|
|
} else {
|
|
$input = [
|
|
'NAMA_PELANGGAN' => $nama_pelanggan,
|
|
'ALIAS_PELANGGAN' => $alias_pelanggan,
|
|
'PIC_PELANGGAN' => $pic_pelanggan,
|
|
'ALAMAT_PELANGGAN' => $alamat_pelanggan,
|
|
'KIRIM_PELANGGAN' => $kirim_pelanggan,
|
|
'KELOMPOK_ID' => $id_kelompok,
|
|
'KOTA_ID' => $id_kota,
|
|
'TELP_PELANGGAN' => $telp_pelanggan,
|
|
'TYPE_PELANGGAN' => $type_pelanggan,
|
|
'EMAIL_PELANGGAN' => $email_pelanggan,
|
|
'NPWP_PELANGGAN' => $npwp_pelanggan,
|
|
'LIMIT_PELANGGAN' => $limit_pelanggan,
|
|
'TOP_PELANGGAN' => $top_pelanggan,
|
|
'JANGKA_PELANGGAN' => $jangka_pelanggan,
|
|
'BLOKIR_PELANGGAN' => '0',
|
|
'STATUS_PELANGGAN' => '1',
|
|
'TAMBAH_PELANGGAN' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->create('pelanggan', $input);
|
|
}
|
|
$value = 1;
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
}
|
|
|
|
public function MD_Ubah_DataPelanggan() {
|
|
$id_pelanggan = $this->input->post('id_pelanggan');
|
|
$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');
|
|
$pic_pelanggan = $this->input->post('pic_pelanggan');
|
|
$alamat_pelanggan = $this->input->post('alamat_pelanggan');
|
|
$kirim_pelanggan = $this->input->post('kirim_pelanggan');
|
|
$telp_pelanggan = $this->input->post('telp_pelanggan');
|
|
$type_pelanggan = $this->input->post('type_pelanggan');
|
|
$email_pelanggan = $this->input->post('email_pelanggan');
|
|
$npwp_pelanggan = $this->input->post('npwp_pelanggan');
|
|
$top_pelanggan = $this->input->post('top_pelanggan');
|
|
$limit_pelanggan = $this->input->post('limit_pelanggan');
|
|
$jangka_pelanggan = $this->input->post('jangka_pelanggan');
|
|
$menu = $this->input->post('menu');
|
|
$nama_pelanggan = strtoupper(ltrim(rtrim(preg_replace('/\R+/', " " , $nama_pelanggan))));
|
|
$alias_pelanggan = strtoupper(ltrim(rtrim(preg_replace('/\R+/', " " , $alias_pelanggan))));
|
|
$pic_pelanggan = ltrim(rtrim(preg_replace('/\R+/', " " , $pic_pelanggan)));
|
|
$alamat_pelanggan = strtoupper(ltrim(rtrim(preg_replace('/\R+/', " " , $alamat_pelanggan))));
|
|
$kirim_pelanggan = strtoupper(ltrim(rtrim(preg_replace('/\R+/', " " , $kirim_pelanggan))));
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$value = 0;
|
|
$datPelanggan = $this->Amod->getData_Pelanggan_byID($id_pelanggan);
|
|
if ($datPelanggan==FALSE) {
|
|
$value = 3;
|
|
} else {
|
|
$cekPelanggan = $this->Amod->getData_Pelanggan_byNAMA_bySTATUS($nama_pelanggan, 1, $id_pelanggan);
|
|
if ($cekPelanggan==TRUE) {
|
|
$value = 2;
|
|
} else {
|
|
$ubah_pelanggan = "Oleh $panggilan pada $timestamp";
|
|
if ($menu==1) {
|
|
$update = [
|
|
'NAMA_PELANGGAN' => $nama_pelanggan,
|
|
'UBAH_PELANGGAN' => $ubah_pelanggan
|
|
];
|
|
} else if ($menu==2) {
|
|
$update = [
|
|
'ALIAS_PELANGGAN' => $alias_pelanggan,
|
|
'UBAH_PELANGGAN' => $ubah_pelanggan
|
|
];
|
|
} else if ($menu==3) {
|
|
$update = [
|
|
'TYPE_PELANGGAN' => $type_pelanggan,
|
|
'UBAH_PELANGGAN' => $ubah_pelanggan
|
|
];
|
|
} else if ($menu==4) {
|
|
$update = [
|
|
'LIMIT_PELANGGAN' => $limit_pelanggan,
|
|
'UBAH_PELANGGAN' => $ubah_pelanggan
|
|
];
|
|
} else if ($menu==5) {
|
|
$update = [
|
|
'TOP_PELANGGAN' => $top_pelanggan,
|
|
'UBAH_PELANGGAN' => $ubah_pelanggan
|
|
];
|
|
} else if ($menu==6) {
|
|
$update = [
|
|
'JANGKA_PELANGGAN' => $jangka_pelanggan,
|
|
'UBAH_PELANGGAN' => $ubah_pelanggan
|
|
];
|
|
} else if ($menu==7) {
|
|
if ($id_kota!=$datPelanggan[0]['KOTA_ID']) {
|
|
$update = [
|
|
'KOTA_ID' => $id_kota,
|
|
'UBAH_PELANGGAN' => $ubah_pelanggan
|
|
];
|
|
}
|
|
} else if ($menu==8) {
|
|
if ($id_kelompok!=$datPelanggan[0]['KELOMPOK_ID']) {
|
|
$update = [
|
|
'KELOMPOK_ID' => $id_kelompok,
|
|
'UBAH_PELANGGAN' => $ubah_pelanggan
|
|
];
|
|
}
|
|
} else if ($menu==9) {
|
|
$update = [
|
|
'PIC_PELANGGAN' => $pic_pelanggan,
|
|
'UBAH_PELANGGAN'=> $ubah_pelanggan
|
|
];
|
|
} else if ($menu==10) {
|
|
$update = [
|
|
'TELP_PELANGGAN' => $telp_pelanggan,
|
|
'UBAH_PELANGGAN' => $ubah_pelanggan
|
|
];
|
|
} else if ($menu==11) {
|
|
$update = [
|
|
'ALAMAT_PELANGGAN' => $alamat_pelanggan,
|
|
'UBAH_PELANGGAN' => $ubah_pelanggan
|
|
];
|
|
} else if ($menu==12) {
|
|
$update = [
|
|
'KIRIM_PELANGGAN' => $kirim_pelanggan,
|
|
'UBAH_PELANGGAN' => $ubah_pelanggan
|
|
];
|
|
} else if ($menu==13) {
|
|
$update = [
|
|
'EMAIL_PELANGGAN' => $email_pelanggan,
|
|
'UBAH_PELANGGAN' => $ubah_pelanggan
|
|
];
|
|
} else if ($menu==14) {
|
|
$update = [
|
|
'NPWP_PELANGGAN' => $npwp_pelanggan,
|
|
'UBAH_PELANGGAN' => $ubah_pelanggan
|
|
];
|
|
}
|
|
|
|
if ($id_kelompok==$datPelanggan[0]['KELOMPOK_ID'] AND $menu==8) {
|
|
$value = 4;
|
|
} else if ($id_kota==$datPelanggan[0]['KOTA_ID'] AND $menu==7) {
|
|
$value = 4;
|
|
} else {
|
|
$action = $this->Amod->update('pelanggan', $update, 'ID_PELANGGAN', $id_pelanggan);
|
|
$value = 1;
|
|
}
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
}
|
|
|
|
public function MD_Hapus_DataPelanggan() {
|
|
$id_pelanggan = $this->input->post('id_pelanggandel');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$datPelanggan = $this->Amod->getData_Pelanggan_byID_bySTATUS($id_pelanggan, 1);
|
|
if ($datPelanggan==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$countDak = $this->Amod->getCount_DaftarAkuntansi_byPELANGGAN($id_pelanggan);
|
|
$countHhpda = $this->Amod->getCount_HasilHitungPda_byPELANGGAN($id_pelanggan);
|
|
$countProyek = $this->Amod->getCount_Proyek_byPELANGGAN($id_pelanggan);
|
|
$countSo = $this->Amod->getCount_SalesOrder_byPELANGGAN($id_pelanggan);
|
|
$countPf = $this->Amod->getCount_Proforma_byPELANGGAN($id_pelanggan);
|
|
if ($countDak>0 OR $countHhpda>0 OR $countProyek>0 OR $countSo>0 OR $countPf>0) {
|
|
$this->session->set_flashdata('data_used', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$update = [
|
|
'STATUS_PELANGGAN' => '0',
|
|
'HAPUS_PELANGGAN' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('pelanggan', $update, 'ID_PELANGGAN', $id_pelanggan);
|
|
|
|
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 MD_Excel_DataPelanggan() {
|
|
$type_pelanggan = $this->input->post('type_pelangganfill');
|
|
$id_kelompok = $this->input->post('id_kelompokfill');
|
|
$id_kota = $this->input->post('id_kotafill');
|
|
|
|
if ($type_pelanggan=="") {
|
|
$type_pelanggan = NULL;
|
|
}
|
|
|
|
if ($id_kelompok=="") {
|
|
$id_kelompok = NULL;
|
|
}
|
|
|
|
if ($id_kota=="") {
|
|
$id_kota = NULL;
|
|
}
|
|
|
|
$datPelanggan = $this->Amod->getData_Pelanggan_byTYPE_byKELOMPOK_byKOTA_bySTATUS($type_pelanggan, $id_kelompok, $id_kota, 1);
|
|
$nama_tabel = array('NO', 'TIPE', 'KOTA', 'KELOMPOK', 'NAMA', 'ALIAS', 'ALAMAT', 'PENGIRIMAN', 'NPWP', 'PIC', 'TELEPON', 'TOP', 'LIMIT', 'JANGKA', 'EMAIL');
|
|
|
|
$data = [
|
|
'sekarang' => date('d/m/Y H:i:s'),
|
|
'laporan' => $datPelanggan,
|
|
'jumlah' => count($datPelanggan),
|
|
'nama_tabel' => $nama_tabel,
|
|
'jumlah_kolom' => count($nama_tabel)
|
|
];
|
|
$this->load->view('cetak/MD_Excel_DataPelanggan', $data);
|
|
}
|
|
|
|
public function MD_MasterPerkiraan() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "MD", "MASTER - Perkiraan");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$datPerkiraan = $this->Amod->getData_Perkiraan_bySTATUS(1);
|
|
|
|
$data = array(
|
|
'sidebar' => "dashboard",
|
|
'navChild' => "",
|
|
'perkiraan' => $datPerkiraan,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil
|
|
);
|
|
$this->load->view('proses/MD_MasterPerkiraan', $data);
|
|
}
|
|
|
|
public function MD_Ambil_DataPerkiraan() {
|
|
$id_perkiraan = $this->input->post('id_perkiraan');
|
|
|
|
$datPerkiraan = $this->Amod->getData_Perkiraan_byID($id_perkiraan);
|
|
|
|
$this->output_json([
|
|
'type_perkiraan' => $datPerkiraan[0]['TYPE_PERKIRAAN'],
|
|
'kode_perkiraan' => $datPerkiraan[0]['KODE_PERKIRAAN'],
|
|
'nama_perkiraan' => $datPerkiraan[0]['NAMA_PERKIRAAN'],
|
|
]);
|
|
}
|
|
|
|
public function MD_Tambah_DataPerkiraan() {
|
|
$kode_perkiraan = $this->input->post('kode_perkiraan');
|
|
$nama_perkiraan = $this->input->post('nama_perkiraan');
|
|
$type_perkiraan = $this->input->post('type_perkiraan');
|
|
$nama_perkiraan = ltrim(rtrim(preg_replace('/\R+/', " " , $nama_perkiraan)));
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$value = 0;
|
|
$datPerkiraan = $this->Amod->getData_Perkiraan_byKODE_bySTATUS($kode_perkiraan, 1);
|
|
if ($datPerkiraan==TRUE) {
|
|
$value = 2;
|
|
} else {
|
|
$cekPerkiraan = $this->Amod->getData_Perkiraan_byKODE_bySTATUS($kode_perkiraan, 0);
|
|
if ($cekPerkiraan==TRUE) {
|
|
$update = [
|
|
'NAMA_PERKIRAAN' => $nama_perkiraan,
|
|
'TYPE_PERKIRAAN' => $type_perkiraan,
|
|
'STATUS_PERKIRAAN' => '1',
|
|
'UBAH_PERKIRAAN' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('perkiraan', $update, 'ID_PERKIRAAN', $cekPerkiraan[0]['ID_PERKIRAAN']);
|
|
} else {
|
|
$input = [
|
|
'KODE_PERKIRAAN' => $kode_perkiraan,
|
|
'NAMA_PERKIRAAN' => $nama_perkiraan,
|
|
'TYPE_PERKIRAAN' => $type_perkiraan,
|
|
'STATUS_PERKIRAAN' => '1',
|
|
'TAMBAH_PERKIRAAN' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->create('perkiraan', $input);
|
|
}
|
|
$value = 1;
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
}
|
|
|
|
public function MD_Ubah_DataPerkiraan() {
|
|
$id_perkiraan = $this->input->post('id_perkiraan');
|
|
$kode_perkiraan = $this->input->post('kode_perkiraan');
|
|
$nama_perkiraan = $this->input->post('nama_perkiraan');
|
|
$menu = $this->input->post('menu');
|
|
$nama_perkiraan = ltrim(rtrim(preg_replace('/\R+/', " " , $nama_perkiraan)));
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$value = 0;
|
|
$datPerkiraan = $this->Amod->getData_Perkiraan_byID($id_perkiraan);
|
|
if ($datPerkiraan==FALSE) {
|
|
$value = 3;
|
|
} else {
|
|
$cekPerkiraan = $this->Amod->getData_Perkiraan_byKODE_bySTATUS($kode_perkiraan, 1, $id_perkiraan);
|
|
if ($cekPerkiraan==TRUE) {
|
|
$value = 2;
|
|
} else {
|
|
if ($menu==1) {
|
|
$update = [
|
|
'KODE_PERKIRAAN' => $kode_perkiraan,
|
|
'UBAH_PERKIRAAN' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
} else if ($menu==2) {
|
|
$update = [
|
|
'NAMA_PERKIRAAN' => $nama_perkiraan,
|
|
'UBAH_PERKIRAAN' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
}
|
|
|
|
$action = $this->Amod->update('perkiraan', $update, 'ID_PERKIRAAN', $id_perkiraan);
|
|
|
|
$value = 1;
|
|
}
|
|
}
|
|
|
|
$datPerkiraanNew = $this->Amod->getData_Perkiraan_bySTATUS(1);
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
'perkiraan' => $datPerkiraanNew,
|
|
]);
|
|
}
|
|
|
|
public function MD_Hapus_DataPerkiraan() {
|
|
$id_perkiraan = $this->input->post('id_perkiraandel');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$datPerkiraan = $this->Amod->getData_Perkiraan_byID_bySTATUS($id_perkiraan, 1);
|
|
if ($datPerkiraan==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$countDak = $this->Amod->getCount_DaftarAkuntansi_byPERKIRAAN($id_perkiraan);
|
|
if ($countDak>0) {
|
|
$this->session->set_flashdata('data_used', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$update = [
|
|
'STATUS_PERKIRAAN' => '0',
|
|
'HAPUS_PERKIRAAN' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('perkiraan', $update, 'ID_PERKIRAAN', $id_perkiraan);
|
|
|
|
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 MD_Excel_DataPerkiraan() {
|
|
$type_perkiraan = $this->input->post('type_perkiraanfill');
|
|
|
|
if ($type_perkiraan=="") {
|
|
$type_perkiraan = NULL;
|
|
$judul = "Semua Data";
|
|
} else {
|
|
if ($type_perkiraan==0) {
|
|
$judul = "NON AKTIF";
|
|
} else if ($type_perkiraan==1) {
|
|
$judul = "BEBAS";
|
|
} else if ($type_perkiraan==2) {
|
|
$judul = "HANYA JURNAL";
|
|
} else if ($type_perkiraan==3) {
|
|
$judul = "HANYA SISTEM";
|
|
}
|
|
}
|
|
|
|
$datPerkiraan = $this->Amod->getData_Perkiraan_byTYPE_bySTATUS($type_perkiraan, 1);
|
|
$nama_tabel = array('NO', 'KODE', 'NAMA', 'TIPE');
|
|
|
|
$data = [
|
|
'sekarang' => date('d/m/Y H:i:s'),
|
|
'laporan' => $datPerkiraan,
|
|
'jumlah' => count($datPerkiraan),
|
|
'nama_tabel' => $nama_tabel,
|
|
'jumlah_kolom' => count($nama_tabel),
|
|
'judul' => $judul
|
|
];
|
|
$this->load->view('cetak/MD_Excel_DataPerkiraan', $data);
|
|
}
|
|
|
|
public function MD_MasterPerusahaan() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "MD", "MASTER - Perusahaan");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$datCorp = $this->Amod->getData_Corp_bySTATUS(1);
|
|
|
|
$data = array(
|
|
'sidebar' => "dashboard",
|
|
'navChild' => "",
|
|
'corp' => $datCorp,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil
|
|
);
|
|
$this->load->view('proses/MD_MasterPerusahaan', $data);
|
|
}
|
|
|
|
public function MD_Ambil_DataPerusahaan() {
|
|
$id_corp = $this->input->post('id_corp');
|
|
|
|
$datCorp = $this->Amod->getData_Corp_byID($id_corp);
|
|
|
|
$this->output_json([
|
|
'nama_corp' => $datCorp[0]['NAMA_CORP'],
|
|
'alamat_corp' => $datCorp[0]['ALAMAT_CORP'],
|
|
'telp_corp' => $datCorp[0]['TELP_CORP'],
|
|
'npwp_corp' => $datCorp[0]['NPWP_CORP'],
|
|
]);
|
|
}
|
|
|
|
public function MD_Tambah_DataPerusahaan() {
|
|
$nama_corp = $this->input->post('nama_corp');
|
|
$alamat_corp = $this->input->post('alamat_corp');
|
|
$telp_corp = $this->input->post('telp_corp');
|
|
$npwp_corp = $this->input->post('npwp_corp');
|
|
$nama_corp = strtoupper(ltrim(rtrim(preg_replace('/\R+/', " " , $nama_corp))));
|
|
$alamat_corp = strtoupper(ltrim(rtrim(preg_replace('/\R+/', " " , $alamat_corp))));
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$value = 0;
|
|
$datCorp = $this->Amod->getData_Corp_byNAMA_bySTATUS($nama_corp, 1);
|
|
if ($datCorp==TRUE) {
|
|
$value = 2;
|
|
} else {
|
|
$cekCorp = $this->Amod->getData_Corp_byNAMA_bySTATUS($nama_corp, 0);
|
|
if ($cekCorp==TRUE) {
|
|
$update = [
|
|
'ALAMAT_CORP' => $alamat_corp,
|
|
'TELP_CORP' => $telp_corp,
|
|
'NPWP_CORP' => $npwp_corp,
|
|
'STATUS_CORP' => '1',
|
|
'UBAH_CORP' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('corp', $update, 'ID_CORP', $cekCorp[0]['ID_CORP']);
|
|
} else {
|
|
$input = [
|
|
'NAMA_CORP' => $nama_corp,
|
|
'ALAMAT_CORP' => $alamat_corp,
|
|
'TELP_CORP' => $telp_corp,
|
|
'NPWP_CORP' => $npwp_corp,
|
|
'STATUS_CORP' => '1',
|
|
'TAMBAH_CORP' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->create('corp', $input);
|
|
}
|
|
$value = 1;
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
}
|
|
|
|
public function MD_Ubah_DataPerusahaan() {
|
|
$id_corp = $this->input->post('id_corp');
|
|
$nama_corp = $this->input->post('nama_corp');
|
|
$alamat_corp = $this->input->post('alamat_corp');
|
|
$telp_corp = $this->input->post('telp_corp');
|
|
$npwp_corp = $this->input->post('npwp_corp');
|
|
$menu = $this->input->post('menu');
|
|
$nama_corp = strtoupper(ltrim(rtrim(preg_replace('/\R+/', " " , $nama_corp))));
|
|
$alamat_corp = strtoupper(ltrim(rtrim(preg_replace('/\R+/', " " , $alamat_corp))));
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$value = 0;
|
|
$datCorp = $this->Amod->getData_Corp_byID($id_corp);
|
|
if ($datCorp==FALSE) {
|
|
$value = 3;
|
|
} else {
|
|
$cekCorp = $this->Amod->getData_Corp_byNAMA_bySTATUS($nama_corp, 1, $id_corp);
|
|
if ($cekCorp==TRUE) {
|
|
$value = 2;
|
|
} else {
|
|
if ($menu==1) {
|
|
$update = [
|
|
'NAMA_CORP' => $nama_corp,
|
|
'UBAH_CORP' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
} else if ($menu==2) {
|
|
$update = [
|
|
'ALAMAT_CORP' => $alamat_corp,
|
|
'UBAH_CORP' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
} else if ($menu==3) {
|
|
$update = [
|
|
'TELP_CORP' => $telp_corp,
|
|
'UBAH_CORP' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
} else if ($menu==4) {
|
|
$update = [
|
|
'NPWP_CORP' => $npwp_corp,
|
|
'UBAH_CORP' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
}
|
|
|
|
$action = $this->Amod->update('corp', $update, 'ID_CORP', $id_corp);
|
|
|
|
$value = 1;
|
|
}
|
|
}
|
|
|
|
$datCorpNew = $this->Amod->getData_Corp_bySTATUS(1);
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
'corp' => $datCorpNew,
|
|
]);
|
|
}
|
|
|
|
public function MD_Hapus_DataPerusahaan() {
|
|
$id_corp = $this->input->post('id_corpdel');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$datCorp = $this->Amod->getData_Corp_byID_bySTATUS($id_corp, 1);
|
|
if ($datCorp==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$countHhhda = $this->Amod->getCount_HasilHitungHda_byCORP($id_corp);
|
|
$countHhpda = $this->Amod->getCount_HasilHitungPda_byCORP($id_corp);
|
|
$countPembelian = $this->Amod->getCount_Pembelian_byCORP($id_corp);
|
|
$countPenjualan = $this->Amod->getCount_Penjualan_byKOP($id_corp);
|
|
$countRpj = $this->Amod->getCount_RekapPajak_byCORP($id_corp);
|
|
$countSo = $this->Amod->getCount_SalesOrder_byCORP($id_corp);
|
|
$countUm = $this->Amod->getCount_UangMuka_byCORP($id_corp);
|
|
if ($countHhhda>0 OR $countHhpda>0 OR $countPembelian>0 OR $countPenjualan>0 OR $countRpj>0 OR $countSo>0 OR $countUm>0) {
|
|
$this->session->set_flashdata('data_used', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$update = [
|
|
'STATUS_CORP' => '0',
|
|
'HAPUS_CORP' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('corp', $update, 'ID_CORP', $id_corp);
|
|
|
|
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 MD_Excel_DataPerusahaan() {
|
|
$datCorp = $this->Amod->getData_Corp_bySTATUS(1);
|
|
$nama_tabel = array('NO', 'NAMA', 'NPWP', 'TELEPON', 'ALAMAT');
|
|
|
|
$data = [
|
|
'sekarang' => date('d/m/Y H:i:s'),
|
|
'laporan' => $datCorp,
|
|
'jumlah' => count($datCorp),
|
|
'nama_tabel' => $nama_tabel,
|
|
'jumlah_kolom' => count($nama_tabel),
|
|
'judul' => "Semua Data"
|
|
];
|
|
$this->load->view('cetak/MD_Excel_DataPerusahaan', $data);
|
|
}
|
|
|
|
public function MD_MasterPeriodeProduk() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "MD", "MASTER - Periode Produk");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$datPkl = $this->Amod->getData_PeriodeKlaimProgram_bySTATUS(1);
|
|
$datMerk = $this->Amod->getData_Merk_bySTATUS(1);
|
|
$now = date('Y-m-d');
|
|
|
|
$data = array(
|
|
'sidebar' => "dashboard",
|
|
'navChild' => "",
|
|
'pkl' => $datPkl,
|
|
'merk' => $datMerk,
|
|
'tgl' => $now,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil
|
|
);
|
|
$this->load->view('proses/MD_MasterPeriodeProduk', $data);
|
|
}
|
|
|
|
public function MD_Ambil_DataPeriodeProduk() {
|
|
$id_pkl = $this->input->post('id_pkl');
|
|
|
|
$datPkl = $this->Amod->getData_PeriodeKlaimProgram_byID($id_pkl);
|
|
|
|
$this->output_json([
|
|
'nama_pkl' => $datPkl[0]['NAMA_PKL'],
|
|
'awal_pkl' => $datPkl[0]['AWAL_PKL'],
|
|
'akhir_pkl' => $datPkl[0]['AKHIR_PKL'],
|
|
'id_merk' => $datPkl[0]['MERK_ID'],
|
|
]);
|
|
}
|
|
|
|
public function MD_Tambah_DataPeriodeProduk() {
|
|
$id_merk = $this->input->post('id_merk');
|
|
$nama_pkl = $this->input->post('nama_pkl');
|
|
$awal_pkl = $this->input->post('awal_pkl');
|
|
$akhir_pkl = $this->input->post('akhir_pkl');
|
|
$nama_pkl = strtoupper(ltrim(rtrim(preg_replace('/\R+/', " " , $nama_pkl))));
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$value = 0;
|
|
$datPkl = $this->Amod->getData_PeriodeKlaimProgram_byNAMA_bySTATUS($nama_pkl, 1);
|
|
if ($datPkl==TRUE) {
|
|
$value = 2;
|
|
} else {
|
|
$cekPkl = $this->Amod->getData_PeriodeKlaimProgram_byNAMA_bySTATUS($nama_pkl, 0);
|
|
if ($cekPkl==TRUE) {
|
|
$update = [
|
|
'MERK_ID' => $id_merk,
|
|
'AWAL_PKL' => $awal_pkl,
|
|
'AKHIR_PKL' => $akhir_pkl,
|
|
'STATUS_PKL' => '1',
|
|
'UBAH_PKL' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('periode_klaimprogram', $update, 'ID_PKL', $cekPkl[0]['ID_PKL']);
|
|
} else {
|
|
$input = [
|
|
'MERK_ID' => $id_merk,
|
|
'NAMA_PKL' => $nama_pkl,
|
|
'AWAL_PKL' => $awal_pkl,
|
|
'AKHIR_PKL' => $akhir_pkl,
|
|
'STATUS_PKL' => '1',
|
|
'TAMBAH_PKL' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->create('periode_klaimprogram', $input);
|
|
}
|
|
$value = 1;
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
}
|
|
|
|
public function MD_Ubah_DataPeriodeProduk() {
|
|
$id_pkl = $this->input->post('id_pkl');
|
|
$id_merk = $this->input->post('id_merk');
|
|
$nama_pkl = $this->input->post('nama_pkl');
|
|
$awal_pkl = $this->input->post('awal_pkl');
|
|
$akhir_pkl = $this->input->post('akhir_pkl');
|
|
$menu = $this->input->post('menu');
|
|
$nama_pkl = strtoupper(ltrim(rtrim(preg_replace('/\R+/', " " , $nama_pkl))));
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$value = 0;
|
|
$datPkl = $this->Amod->getData_PeriodeKlaimProgram_byID($id_pkl);
|
|
if ($datPkl==FALSE) {
|
|
$value = 3;
|
|
} else {
|
|
$cekPkl = $this->Amod->getData_PeriodeKlaimProgram_byNAMA_bySTATUS($nama_pkl, 1, $id_pkl);
|
|
if ($cekPkl==TRUE) {
|
|
$value = 2;
|
|
} else {
|
|
$ubah_pkl = "Oleh $panggilan pada $timestamp";
|
|
if ($menu==1) {
|
|
$update = [
|
|
'NAMA_PKL' => $nama_pkl,
|
|
'UBAH_PKL' => $ubah_pkl
|
|
];
|
|
} else if ($menu==2) {
|
|
$update = [
|
|
'AWAL_PKL' => $awal_pkl,
|
|
'UBAH_PKL' => $ubah_pkl
|
|
];
|
|
} else if ($menu==3) {
|
|
$update = [
|
|
'AKHIR_PKL' => $akhir_pkl,
|
|
'UBAH_PKL' => $ubah_pkl
|
|
];
|
|
} else if ($menu==4) {
|
|
if ($id_merk!=$datPkl[0]['MERK_ID']) {
|
|
$update = [
|
|
'MERK_ID' => $id_merk,
|
|
'UBAH_PKL' => $ubah_pkl
|
|
];
|
|
}
|
|
}
|
|
|
|
if ($id_merk==$datPkl[0]['MERK_ID'] AND $menu==4) {
|
|
$value = 4;
|
|
} else {
|
|
$action = $this->Amod->update('periode_klaimprogram', $update, 'ID_PKL', $id_pkl);
|
|
$value = 1;
|
|
}
|
|
}
|
|
}
|
|
|
|
$datPklNew = $this->Amod->getData_PeriodeKlaimProgram_bySTATUS(1);
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
'pkl' => $datPklNew,
|
|
]);
|
|
}
|
|
|
|
public function MD_Hapus_DataPeriodeProduk() {
|
|
$id_pkl = $this->input->post('id_pkldel');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$datPkl = $this->Amod->getData_PeriodeKlaimProgram_byID_bySTATUS($id_pkl, 1);
|
|
if ($datPkl==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$countRkpr = $this->Amod->getCount_RekapKlaimProgram_byPKL($id_pkl);
|
|
if ($countRkpr>0) {
|
|
$this->session->set_flashdata('data_used', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$update = [
|
|
'STATUS_PKL'=> '0',
|
|
'HAPUS_PKL' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('periode_klaimprogram', $update, 'ID_PKL', $id_pkl);
|
|
|
|
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 MD_Excel_DataPeriodeProduk() {
|
|
$id_merk = $this->input->post('id_merkfill');
|
|
|
|
if ($id_merk=="") {
|
|
$id_merk = NULL;
|
|
$judul = "Semua Data";
|
|
} else {
|
|
$datMerk = $this->Amod->getData_Merk_byID($id_merk);
|
|
$nama_merk = $datMerk[0]['NAMA_MERK'];
|
|
$judul = "$nama_merk";
|
|
}
|
|
|
|
$datPkl = $this->Amod->getData_PeriodeKlaimProgram_byMERK_bySTATUS($id_merk, 1);
|
|
$nama_tabel = array('NO', 'MERK', 'NAMA', 'AWAL', 'AKHIR');
|
|
|
|
$data = [
|
|
'sekarang' => date('d/m/Y H:i:s'),
|
|
'laporan' => $datPkl,
|
|
'jumlah' => count($datPkl),
|
|
'nama_tabel' => $nama_tabel,
|
|
'jumlah_kolom' => count($nama_tabel),
|
|
'judul' => $judul
|
|
];
|
|
$this->load->view('cetak/MD_Excel_DataPeriodeProduk', $data);
|
|
}
|
|
|
|
public function MD_MasterPeriodeProyek() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$now = date('Y-m-d');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "MD", "MASTER - Periode Proyek");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$datPp = $this->Amod->getData_PeriodeProyek_bySTATUS(1);
|
|
|
|
$data = array(
|
|
'sidebar' => "dashboard",
|
|
'navChild' => "",
|
|
'pp' => $datPp,
|
|
'tgl' => $now,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil
|
|
);
|
|
$this->load->view('proses/MD_MasterPeriodeProyek', $data);
|
|
}
|
|
|
|
public function MD_Ambil_DataPeriodeProyek() {
|
|
$id_pp = $this->input->post('id_pp');
|
|
|
|
$datPp = $this->Amod->getData_PeriodeProyek_byID($id_pp);
|
|
|
|
$this->output_json([
|
|
'nama_pp' => $datPp[0]['NAMA_PP'],
|
|
'awal_pp' => $datPp[0]['AWAL_PP'],
|
|
'akhir_pp' => $datPp[0]['AKHIR_PP'],
|
|
'jenis_pp' => $datPp[0]['JENIS_PP'],
|
|
]);
|
|
}
|
|
|
|
public function MD_Tambah_DataPeriodeProyek() {
|
|
$jenis_pp = $this->input->post('jenis_pp');
|
|
$nama_pp = $this->input->post('nama_pp');
|
|
$awal_pp = $this->input->post('awal_pp');
|
|
$akhir_pp = $this->input->post('akhir_pp');
|
|
$nama_pp = strtoupper(ltrim(rtrim(preg_replace('/\R+/', " " , $nama_pp))));
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$value = 0;
|
|
$datPp = $this->Amod->getData_PeriodeProyek_byNAMA_bySTATUS($nama_pp, 1);
|
|
if ($datPp==TRUE) {
|
|
$value = 2;
|
|
} else {
|
|
$cekPp = $this->Amod->getData_PeriodeProyek_byNAMA_bySTATUS($nama_pp, 0);
|
|
if ($cekPp==TRUE) {
|
|
$update = [
|
|
'JENIS_PP' => $jenis_pp,
|
|
'AWAL_PP' => $awal_pp,
|
|
'AKHIR_PP' => $akhir_pp,
|
|
'STATUS_PP' => '1',
|
|
'UBAH_PP' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('periode_proyek', $update, 'ID_PP', $cekPp[0]['ID_PP']);
|
|
} else {
|
|
$input = [
|
|
'JENIS_PP' => $jenis_pp,
|
|
'NAMA_PP' => $nama_pp,
|
|
'AWAL_PP' => $awal_pp,
|
|
'AKHIR_PP' => $akhir_pp,
|
|
'STATUS_PP' => '1',
|
|
'TAMBAH_PP' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->create('periode_proyek', $input);
|
|
}
|
|
$value = 1;
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
}
|
|
|
|
public function MD_Ubah_DataPeriodeProyek() {
|
|
$id_pp = $this->input->post('id_pp');
|
|
$jenis_pp = $this->input->post('jenis_pp');
|
|
$nama_pp = $this->input->post('nama_pp');
|
|
$awal_pp = $this->input->post('awal_pp');
|
|
$akhir_pp = $this->input->post('akhir_pp');
|
|
$menu = $this->input->post('menu');
|
|
$nama_pp = strtoupper(ltrim(rtrim(preg_replace('/\R+/', " " , $nama_pp))));
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$value = 0;
|
|
$datPp = $this->Amod->getData_PeriodeProyek_byID($id_pp);
|
|
if ($datPp==FALSE) {
|
|
$value = 4;
|
|
} else {
|
|
$cekPp = $this->Amod->getData_PeriodeProyek_byNAMA_bySTATUS($nama_pp, 1, $id_pp);
|
|
if ($cekPp==TRUE) {
|
|
$value = 3;
|
|
} else {
|
|
$datRp = $this->Amod->getData_RekapProyek_byPP($id_pp);
|
|
if ($datRp==TRUE) {
|
|
$value = 2;
|
|
} else {
|
|
$ubah_pp = "Oleh $panggilan pada $timestamp";
|
|
if ($menu==1) {
|
|
$update = [
|
|
'NAMA_PP' => $nama_pp,
|
|
'UBAH_PP' => $ubah_pp
|
|
];
|
|
} else if ($menu==2) {
|
|
$update = [
|
|
'AWAL_PP' => $awal_pp,
|
|
'UBAH_PP' => $ubah_pp
|
|
];
|
|
} else if ($menu==3) {
|
|
$update = [
|
|
'AKHIR_PP' => $akhir_pp,
|
|
'UBAH_PP' => $ubah_pp
|
|
];
|
|
} else if ($menu==4) {
|
|
if ($jenis_pp!=$datPp[0]['JENIS_PP']) {
|
|
$update = [
|
|
'JENIS_PP' => $jenis_pp,
|
|
'UBAH_PP' => $ubah_pp
|
|
];
|
|
}
|
|
}
|
|
|
|
if ($jenis_pp==$datPp[0]['JENIS_PP'] AND $menu==4) {
|
|
$value = 5;
|
|
} else {
|
|
$action = $this->Amod->update('periode_proyek', $update, 'ID_PP', $id_pp);
|
|
$value = 1;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
$datPpNew = $this->Amod->getData_PeriodeProyek_bySTATUS(1);
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
'pp' => $datPpNew,
|
|
]);
|
|
}
|
|
|
|
public function MD_Hapus_DataPeriodeProyek() {
|
|
$id_pp = $this->input->post('id_ppdel');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$datPp = $this->Amod->getData_PeriodeProyek_byID_bySTATUS($id_pp, 1);
|
|
if ($datPp==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$countRp = $this->Amod->getCount_RekapProyek_byPP($id_pp);
|
|
if ($countRp>0) {
|
|
$this->session->set_flashdata('data_used', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$update = [
|
|
'STATUS_PP'=> '0',
|
|
'HAPUS_PP' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('periode_proyek', $update, 'ID_PP', $id_pp);
|
|
|
|
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 MD_Excel_DataPeriodeProyek() {
|
|
$jenis_pp = $this->input->post('jenis_ppfill');
|
|
|
|
if ($jenis_pp=="") {
|
|
$jenis_pp = NULL;
|
|
$judul = "Semua Data";
|
|
} else {
|
|
if ($jenis_pp==1) {
|
|
$judul = "KUARTAL";
|
|
} else if ($jenis_pp==2) {
|
|
$judul = "BULANAN";
|
|
}
|
|
}
|
|
|
|
$datPp = $this->Amod->getData_PeriodeProyek_byJENIS_bySTATUS($jenis_pp, 1);
|
|
$nama_tabel = array('NO', 'JENIS', 'NAMA', 'AWAL', 'AKHIR');
|
|
|
|
$data = [
|
|
'sekarang' => date('d/m/Y H:i:s'),
|
|
'laporan' => $datPp,
|
|
'jumlah' => count($datPp),
|
|
'nama_tabel' => $nama_tabel,
|
|
'jumlah_kolom' => count($nama_tabel),
|
|
'judul' => $judul
|
|
];
|
|
$this->load->view('cetak/MD_Excel_DataPeriodeProyek', $data);
|
|
}
|
|
|
|
public function MD_MasterPihakke3() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "MD", "MASTER - Pihakke3");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$datPihakke3 = $this->Amod->getData_Pihakke3_bySTATUS(1);
|
|
|
|
$data = array(
|
|
'sidebar' => "dashboard",
|
|
'navChild' => "",
|
|
'pihakke3' => $datPihakke3,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil
|
|
);
|
|
$this->load->view('proses/MD_MasterPihakke3', $data);
|
|
}
|
|
|
|
public function MD_Ambil_DataPihakke3() {
|
|
$id_pihakke3 = $this->input->post('id_pihakke3');
|
|
|
|
$datPihakke3 = $this->Amod->getData_Pihakke3_byID($id_pihakke3);
|
|
|
|
$this->output_json([
|
|
'nama_pihakke3' => $datPihakke3[0]['NAMA_PIHAKKE3'],
|
|
'alamat_pihakke3' => $datPihakke3[0]['ALAMAT_PIHAKKE3'],
|
|
'telp_pihakke3' => $datPihakke3[0]['TELP_PIHAKKE3'],
|
|
'id_kota' => $datPihakke3[0]['KOTA_ID'],
|
|
'nama_kota' => $datPihakke3[0]['NAMA_KOTA'],
|
|
]);
|
|
}
|
|
|
|
public function MD_Tambah_DataPihakke3() {
|
|
$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');
|
|
$nama_pihakke3 = strtoupper(ltrim(rtrim(preg_replace('/\R+/', " " , $nama_pihakke3))));
|
|
$alamat_pihakke3 = strtoupper(ltrim(rtrim(preg_replace('/\R+/', " " , $alamat_pihakke3))));
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$value = 0;
|
|
$datPihakke3 = $this->Amod->getData_Pihakke3_byNAMA_bySTATUS($nama_pihakke3, 1);
|
|
if ($datPihakke3==TRUE) {
|
|
$value = 2;
|
|
} else {
|
|
$cekPihakke3 = $this->Amod->getData_Pihakke3_byNAMA_bySTATUS($nama_pihakke3, 0);
|
|
if ($cekPihakke3==TRUE) {
|
|
$update = [
|
|
'KOTA_ID' => $id_kota,
|
|
'ALAMAT_PIHAKKE3' => $alamat_pihakke3,
|
|
'TELP_PIHAKKE3' => $telp_pihakke3,
|
|
'STATUS_PIHAKKE3' => '1',
|
|
'UBAH_PIHAKKE3' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('pihakke3', $update, 'ID_PIHAKKE3', $cekPihakke3[0]['ID_PIHAKKE3']);
|
|
} else {
|
|
$input = [
|
|
'KOTA_ID' => $id_kota,
|
|
'NAMA_PIHAKKE3' => $nama_pihakke3,
|
|
'ALAMAT_PIHAKKE3' => $alamat_pihakke3,
|
|
'TELP_PIHAKKE3' => $telp_pihakke3,
|
|
'STATUS_PIHAKKE3' => '1',
|
|
'TAMBAH_PIHAKKE3' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->create('pihakke3', $input);
|
|
}
|
|
$value = 1;
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
}
|
|
|
|
public function MD_Ubah_DataPihakke3() {
|
|
$id_pihakke3 = $this->input->post('id_pihakke3');
|
|
$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');
|
|
$menu = $this->input->post('menu');
|
|
$nama_pihakke3 = strtoupper(ltrim(rtrim(preg_replace('/\R+/', " " , $nama_pihakke3))));
|
|
$alamat_pihakke3 = strtoupper(ltrim(rtrim(preg_replace('/\R+/', " " , $alamat_pihakke3))));
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$value = 0;
|
|
$datPihakke3 = $this->Amod->getData_Pihakke3_byID($id_pihakke3);
|
|
if ($datPihakke3==FALSE) {
|
|
$value = 3;
|
|
} else {
|
|
$cekPihakke3 = $this->Amod->getData_Pihakke3_byNAMA_bySTATUS($nama_pihakke3, 1, $id_pihakke3);
|
|
if ($cekPihakke3==TRUE) {
|
|
$value = 2;
|
|
} else {
|
|
$ubah_pihakke3 = "Oleh $panggilan pada $timestamp";
|
|
if ($menu==1) {
|
|
$update = [
|
|
'NAMA_PIHAKKE3' => $nama_pihakke3,
|
|
'UBAH_PIHAKKE3' => $ubah_pihakke3
|
|
];
|
|
} else if ($menu==2) {
|
|
$update = [
|
|
'ALAMAT_PIHAKKE3' => $alamat_pihakke3,
|
|
'UBAH_PIHAKKE3' => $ubah_pihakke3
|
|
];
|
|
} else if ($menu==3) {
|
|
$update = [
|
|
'TELP_PIHAKKE3' => $telp_pihakke3,
|
|
'UBAH_PIHAKKE3' => $ubah_pihakke3
|
|
];
|
|
} else if ($menu==4) {
|
|
if ($id_kota!=$datPihakke3[0]['KOTA_ID']) {
|
|
$update = [
|
|
'KOTA_ID' => $id_kota,
|
|
'UBAH_PIHAKKE3' => $ubah_pihakke3
|
|
];
|
|
}
|
|
}
|
|
|
|
if ($id_kota==$datPihakke3[0]['KOTA_ID'] AND $menu==4) {
|
|
$value = 4;
|
|
} else {
|
|
$action = $this->Amod->update('pihakke3', $update, 'ID_PIHAKKE3', $id_pihakke3);
|
|
$value = 1;
|
|
}
|
|
}
|
|
}
|
|
|
|
$datPihakke3New = $this->Amod->getData_Pihakke3_bySTATUS(1);
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
'pihakke3' => $datPihakke3New,
|
|
]);
|
|
}
|
|
|
|
public function MD_Hapus_DataPihakke3() {
|
|
$id_pihakke3 = $this->input->post('id_pihakke3del');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$datPihakke3 = $this->Amod->getData_Pihakke3_byID_bySTATUS($id_pihakke3, 1);
|
|
if ($datPihakke3==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$countDak = $this->Amod->getCount_DaftarAkuntansi_byPIHAKKE3($id_pihakke3);
|
|
if ($countDak>0) {
|
|
$this->session->set_flashdata('data_used', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$update = [
|
|
'STATUS_PIHAKKE3' => '0',
|
|
'HAPUS_PIHAKKE3' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('pihakke3', $update, 'ID_PIHAKKE3', $id_pihakke3);
|
|
|
|
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 MD_Excel_DataPihakke3() {
|
|
$id_kota = $this->input->post('id_kotafill');
|
|
|
|
if ($id_kota=="") {
|
|
$id_kota = NULL;
|
|
$judul = "Semua Data";
|
|
} else {
|
|
$datKota = $this->Amod->getData_Kota_byID($id_kota);
|
|
$nama_kota = $datKota[0]['NAMA_KOTA'];
|
|
$judul = "$nama_kota";
|
|
}
|
|
|
|
$datPihakke3 = $this->Amod->getData_Pihakke3_byKOTA_bySTATUS($id_kota, 1);
|
|
$nama_tabel = array('NO', 'KOTA', 'NAMA', 'ALAMAT', 'TELEPON');
|
|
|
|
$data = [
|
|
'sekarang' => date('d/m/Y H:i:s'),
|
|
'laporan' => $datPihakke3,
|
|
'jumlah' => count($datPihakke3),
|
|
'nama_tabel' => $nama_tabel,
|
|
'jumlah_kolom' => count($nama_tabel),
|
|
'judul' => $judul
|
|
];
|
|
$this->load->view('cetak/MD_Excel_DataPihakke3', $data);
|
|
}
|
|
|
|
public function MD_MasterProduk() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "MD", "MASTER - Produk");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$datProduk = $this->Amod->getData_Produk_bySTATUS(1);
|
|
|
|
$data = array(
|
|
'sidebar' => "dashboard",
|
|
'navChild' => "",
|
|
'produk' => $datProduk,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil
|
|
);
|
|
$this->load->view('proses/MD_MasterProduk', $data);
|
|
}
|
|
|
|
public function MD_Ambil_DataProduk() {
|
|
$id_produk = $this->input->post('id_produk');
|
|
|
|
$datProduk = $this->Amod->getData_Produk_byID($id_produk);
|
|
|
|
$this->output_json([
|
|
'nama_produk' => $datProduk[0]['NAMA_PRODUK'],
|
|
]);
|
|
}
|
|
|
|
public function MD_Tambah_DataProduk() {
|
|
$nama_produk = $this->input->post('nama_produk');
|
|
$nama_produk = strtoupper(ltrim(rtrim(preg_replace('/\R+/', " " , $nama_produk))));
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$value = 0;
|
|
$datProduk = $this->Amod->getData_Produk_byNAMA_bySTATUS($nama_produk, 1);
|
|
if ($datProduk==TRUE) {
|
|
$value = 2;
|
|
} else {
|
|
$cekProduk = $this->Amod->getData_Produk_byNAMA_bySTATUS($nama_produk, 0);
|
|
if ($cekProduk==TRUE) {
|
|
$update = [
|
|
'STATUS_PRODUK' => '1',
|
|
'UBAH_PRODUK' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('produk', $update, 'ID_PRODUK', $cekProduk[0]['ID_PRODUK']);
|
|
} else {
|
|
$input = [
|
|
'NAMA_PRODUK' => $nama_produk,
|
|
'STATUS_PRODUK' => '1',
|
|
'TAMBAH_PRODUK' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->create('produk', $input);
|
|
}
|
|
$value = 1;
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
}
|
|
|
|
public function MD_Ubah_DataProduk() {
|
|
$id_produk = $this->input->post('id_produk');
|
|
$nama_produk = $this->input->post('nama_produk');
|
|
$menu = $this->input->post('menu');
|
|
$nama_produk = strtoupper(ltrim(rtrim(preg_replace('/\R+/', " " , $nama_produk))));
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$value = 0;
|
|
$datProduk = $this->Amod->getData_Produk_byID($id_produk);
|
|
if ($datProduk==FALSE) {
|
|
$value = 3;
|
|
} else {
|
|
$cekProduk = $this->Amod->getData_Produk_byNAMA_bySTATUS($nama_produk, 1, $id_produk);
|
|
if ($cekProduk==TRUE) {
|
|
$value = 2;
|
|
} else {
|
|
if ($menu==1) {
|
|
$update = [
|
|
'NAMA_PRODUK' => $nama_produk,
|
|
'UBAH_PRODUK' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
}
|
|
|
|
$action = $this->Amod->update('produk', $update, 'ID_PRODUK', $id_produk);
|
|
|
|
$value = 1;
|
|
}
|
|
}
|
|
|
|
$datProdukNew = $this->Amod->getData_Produk_bySTATUS(1);
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
'produk' => $datProdukNew,
|
|
]);
|
|
}
|
|
|
|
public function MD_Hapus_DataProduk() {
|
|
$id_produk = $this->input->post('id_produkdel');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$datProduk = $this->Amod->getData_Produk_byID_bySTATUS($id_produk, 1);
|
|
if ($datProduk==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$countBarang = $this->Amod->getCount_Barang_byPRODUK($id_produk);
|
|
$countRkpr = $this->Amod->getCount_RekapKlaimProgram_byPRODUK($id_produk);
|
|
if ($countBarang>0 OR $countRkpr>0) {
|
|
$this->session->set_flashdata('data_used', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$update = [
|
|
'STATUS_PRODUK' => '0',
|
|
'HAPUS_PRODUK' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('produk', $update, 'ID_PRODUK', $id_produk);
|
|
|
|
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 MD_Excel_DataProduk() {
|
|
$datProduk = $this->Amod->getData_Produk_bySTATUS(1);
|
|
$nama_tabel = array('NO', 'NAMA');
|
|
|
|
$data = [
|
|
'sekarang' => date('d/m/Y H:i:s'),
|
|
'laporan' => $datProduk,
|
|
'jumlah' => count($datProduk),
|
|
'nama_tabel' => $nama_tabel,
|
|
'jumlah_kolom' => count($nama_tabel),
|
|
'judul' => "Semua Data"
|
|
];
|
|
$this->load->view('cetak/MD_Excel_DataProduk', $data);
|
|
}
|
|
|
|
public function MD_MasterSatuan() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "MD", "MASTER - Satuan");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$datSatuan = $this->Amod->getData_Satuan_bySTATUS(1);
|
|
|
|
$data = array(
|
|
'sidebar' => "dashboard",
|
|
'navChild' => "",
|
|
'satuan' => $datSatuan,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil
|
|
);
|
|
$this->load->view('proses/MD_MasterSatuan', $data);
|
|
}
|
|
|
|
public function MD_Tambah_DataSatuan() {
|
|
$nama_satuan = $this->input->post('nama_satuan');
|
|
$nama_satuan = ltrim(rtrim(preg_replace('/\R+/', " " , $nama_satuan)));
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$value = 0;
|
|
$datSatuan = $this->Amod->getData_Satuan_byNAMA_bySTATUS($nama_satuan, 1);
|
|
if ($datSatuan==TRUE) {
|
|
$value = 2;
|
|
} else {
|
|
$cekSatuan = $this->Amod->getData_Satuan_byNAMA_bySTATUS($nama_satuan, 0);
|
|
if ($cekSatuan==TRUE) {
|
|
$update = [
|
|
'NAMA_SATUAN' => $nama_satuan,
|
|
'STATUS_SATUAN' => '1',
|
|
'UBAH_SATUAN' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('satuan', $update, 'ID_SATUAN', $cekSatuan[0]['ID_SATUAN']);
|
|
} else {
|
|
$input = [
|
|
'NAMA_SATUAN' => $nama_satuan,
|
|
'STATUS_SATUAN' => '1',
|
|
'TAMBAH_SATUAN' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->create('satuan', $input);
|
|
}
|
|
$value = 1;
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
}
|
|
|
|
public function MD_Ubah_DataSatuan() {
|
|
$id_satuan = $this->input->post('id_satuan');
|
|
$nama_satuan = $this->input->post('nama_satuan');
|
|
$menu = $this->input->post('menu');
|
|
$nama_satuan = strtoupper(ltrim(rtrim(preg_replace('/\R+/', " " , $nama_satuan))));
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$value = 0;
|
|
$datSatuan = $this->Amod->getData_Satuan_byID($id_satuan);
|
|
if ($datSatuan==FALSE) {
|
|
$value = 3;
|
|
} else {
|
|
$cekSatuan = $this->Amod->getData_Satuan_byNAMA_bySTATUS($nama_satuan, 1, $id_satuan);
|
|
if ($cekSatuan==TRUE) {
|
|
$value = 2;
|
|
} else {
|
|
if ($menu==1) {
|
|
$update = [
|
|
'NAMA_SATUAN' => $nama_satuan,
|
|
'UBAH_SATUAN' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
}
|
|
|
|
$action = $this->Amod->update('satuan', $update, 'ID_SATUAN', $id_satuan);
|
|
|
|
$value = 1;
|
|
}
|
|
}
|
|
|
|
$datSatuanNew = $this->Amod->getData_Satuan_bySTATUS(1);
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
'satuan' => $datSatuanNew,
|
|
]);
|
|
}
|
|
|
|
public function MD_Hapus_DataSatuan() {
|
|
$id_satuan = $this->input->post('id_satuandel');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$datSatuan = $this->Amod->getData_Satuan_byID_bySTATUS($id_satuan, 1);
|
|
if ($datSatuan==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$countDpne = $this->Amod->getCount_DaftarPenawaran_bySATUAN($id_satuan);
|
|
if ($countDpne>0) {
|
|
$this->session->set_flashdata('data_used', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$update = [
|
|
'STATUS_SATUAN' => '0',
|
|
'HAPUS_SATUAN' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('satuan', $update, 'ID_SATUAN', $id_satuan);
|
|
|
|
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 MD_Excel_DataSatuan() {
|
|
$datSatuan = $this->Amod->getData_Satuan_bySTATUS(1);
|
|
$nama_tabel = array('NO', 'NAMA');
|
|
|
|
$data = [
|
|
'sekarang' => date('d/m/Y H:i:s'),
|
|
'laporan' => $datSatuan,
|
|
'jumlah' => count($datSatuan),
|
|
'nama_tabel' => $nama_tabel,
|
|
'jumlah_kolom' => count($nama_tabel),
|
|
'judul' => "Semua Data"
|
|
];
|
|
$this->load->view('cetak/MD_Excel_DataSatuan', $data);
|
|
}
|
|
|
|
public function MD_MasterSupplier() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "MD", "MASTER - Supplier");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$data = array(
|
|
'sidebar' => "dashboard",
|
|
'navChild' => "",
|
|
'hak' => $hak,
|
|
'tampil' => $tampil
|
|
);
|
|
$this->load->view('proses/MD_MasterSupplier', $data);
|
|
}
|
|
|
|
public function MD_Ambil_DataSupplier() {
|
|
$id_supplier = $this->input->post('id_supplier');
|
|
|
|
$datSupplier = $this->Amod->getData_Supplier_byID($id_supplier);
|
|
|
|
$this->output_json([
|
|
'nama_supplier' => $datSupplier[0]['NAMA_SUPPLIER'],
|
|
'alias_supplier' => $datSupplier[0]['ALIAS_SUPPLIER'],
|
|
'alamat_supplier' => $datSupplier[0]['ALAMAT_SUPPLIER'],
|
|
'top_supplier' => $datSupplier[0]['TOP_SUPPLIER'],
|
|
'pic_supplier' => $datSupplier[0]['PIC_SUPPLIER'],
|
|
'npwp_supplier' => $datSupplier[0]['NPWP_SUPPLIER'],
|
|
'email_supplier' => $datSupplier[0]['EMAIL_SUPPLIER'],
|
|
'telp_supplier' => $datSupplier[0]['TELP_SUPPLIER'],
|
|
'id_kota' => $datSupplier[0]['KOTA_ID'],
|
|
'nama_kota' => $datSupplier[0]['NAMA_KOTA'],
|
|
]);
|
|
}
|
|
|
|
public function MD_Tambah_DataSupplier() {
|
|
$id_kota = $this->input->post('id_kota');
|
|
$nama_supplier = $this->input->post('nama_supplier');
|
|
$alias_supplier = $this->input->post('alias_supplier');
|
|
$alamat_supplier = $this->input->post('alamat_supplier');
|
|
$top_supplier = $this->input->post('top_supplier');
|
|
$pic_supplier = $this->input->post('pic_supplier');
|
|
$npwp_supplier = $this->input->post('npwp_supplier');
|
|
$email_supplier = $this->input->post('email_supplier');
|
|
$telp_supplier = $this->input->post('telp_supplier');
|
|
$nama_supplier = strtoupper(ltrim(rtrim(preg_replace('/\R+/', " " , $nama_supplier))));
|
|
$alias_supplier = strtoupper(ltrim(rtrim(preg_replace('/\R+/', " " , $alias_supplier))));
|
|
$alamat_supplier = strtoupper(ltrim(rtrim(preg_replace('/\R+/', " " , $alamat_supplier))));
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$value = 0;
|
|
$datSupplier = $this->Amod->getData_Supplier_byNAMA_bySTATUS($nama_supplier, 1);
|
|
if ($datSupplier==TRUE) {
|
|
$value = 2;
|
|
} else {
|
|
$cekSupplier = $this->Amod->getData_Supplier_byNAMA_bySTATUS($nama_supplier, 0);
|
|
if ($cekSupplier==TRUE) {
|
|
$update = [
|
|
'KOTA_ID' => $id_kota,
|
|
'ALIAS_SUPPLIER' => $alias_supplier,
|
|
'ALAMAT_SUPPLIER' => $alamat_supplier,
|
|
'TOP_SUPPLIER' => $top_supplier,
|
|
'PIC_SUPPLIER' => $pic_supplier,
|
|
'NPWP_SUPPLIER' => $npwp_supplier,
|
|
'EMAIL_SUPPLIER' => $email_supplier,
|
|
'TELP_SUPPLIER' => $telp_supplier,
|
|
'STATUS_SUPPLIER' => '1',
|
|
'UBAH_SUPPLIER' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('supplier', $update, 'ID_SUPPLIER', $cekSupplier[0]['ID_SUPPLIER']);
|
|
} else {
|
|
$input = [
|
|
'KOTA_ID' => $id_kota,
|
|
'NAMA_SUPPLIER' => $nama_supplier,
|
|
'ALIAS_SUPPLIER' => $alias_supplier,
|
|
'ALAMAT_SUPPLIER' => $alamat_supplier,
|
|
'TOP_SUPPLIER' => $top_supplier,
|
|
'PIC_SUPPLIER' => $pic_supplier,
|
|
'NPWP_SUPPLIER' => $npwp_supplier,
|
|
'EMAIL_SUPPLIER' => $email_supplier,
|
|
'TELP_SUPPLIER' => $telp_supplier,
|
|
'STATUS_SUPPLIER' => '1',
|
|
'TAMBAH_SUPPLIER' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->create('supplier', $input);
|
|
}
|
|
$value = 1;
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
}
|
|
|
|
public function MD_Ubah_DataSupplier() {
|
|
$id_supplier = $this->input->post('id_supplier');
|
|
$id_kota = $this->input->post('id_kota');
|
|
$nama_supplier = $this->input->post('nama_supplier');
|
|
$alias_supplier = $this->input->post('alias_supplier');
|
|
$alamat_supplier = $this->input->post('alamat_supplier');
|
|
$top_supplier = $this->input->post('top_supplier');
|
|
$pic_supplier = $this->input->post('pic_supplier');
|
|
$npwp_supplier = $this->input->post('npwp_supplier');
|
|
$email_supplier = $this->input->post('email_supplier');
|
|
$telp_supplier = $this->input->post('telp_supplier');
|
|
$menu = $this->input->post('menu');
|
|
$nama_supplier = strtoupper(ltrim(rtrim(preg_replace('/\R+/', " " , $nama_supplier))));
|
|
$alias_supplier = strtoupper(ltrim(rtrim(preg_replace('/\R+/', " " , $alias_supplier))));
|
|
$alamat_supplier = strtoupper(ltrim(rtrim(preg_replace('/\R+/', " " , $alamat_supplier))));
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$value = 0;
|
|
$datSupplier = $this->Amod->getData_Supplier_byID($id_supplier);
|
|
if ($datSupplier==FALSE) {
|
|
$value = 3;
|
|
} else {
|
|
$cekSupplier = $this->Amod->getData_Supplier_byNAMA_bySTATUS($nama_supplier, 1, $id_supplier);
|
|
if ($cekSupplier==TRUE) {
|
|
$value = 2;
|
|
} else {
|
|
$ubah_supplier = "Oleh $panggilan pada $timestamp";
|
|
if ($menu==1) {
|
|
$update = [
|
|
'NAMA_SUPPLIER' => $nama_supplier,
|
|
'UBAH_SUPPLIER' => $ubah_supplier
|
|
];
|
|
} else if ($menu==2) {
|
|
$update = [
|
|
'ALAMAT_SUPPLIER' => $alamat_supplier,
|
|
'UBAH_SUPPLIER' => $ubah_supplier
|
|
];
|
|
} else if ($menu==3) {
|
|
$update = [
|
|
'TOP_SUPPLIER' => $top_supplier,
|
|
'UBAH_SUPPLIER' => $ubah_supplier
|
|
];
|
|
} else if ($menu==4) {
|
|
if ($id_kota!=$datSupplier[0]['KOTA_ID']) {
|
|
$update = [
|
|
'KOTA_ID' => $id_kota,
|
|
'UBAH_SUPPLIER' => $ubah_supplier
|
|
];
|
|
}
|
|
} else if ($menu==5) {
|
|
$update = [
|
|
'PIC_SUPPLIER' => $pic_supplier,
|
|
'UBAH_SUPPLIER' => $ubah_supplier
|
|
];
|
|
} else if ($menu==6) {
|
|
$update = [
|
|
'NPWP_SUPPLIER' => $npwp_supplier,
|
|
'UBAH_SUPPLIER' => $ubah_supplier
|
|
];
|
|
} else if ($menu==7) {
|
|
$update = [
|
|
'EMAIL_SUPPLIER' => $email_supplier,
|
|
'UBAH_SUPPLIER' => $ubah_supplier
|
|
];
|
|
} else if ($menu==8) {
|
|
$update = [
|
|
'TELP_SUPPLIER' => $telp_supplier,
|
|
'UBAH_SUPPLIER' => $ubah_supplier
|
|
];
|
|
} else if ($menu==9) {
|
|
$update = [
|
|
'ALIAS_SUPPLIER' => $alias_supplier,
|
|
'UBAH_SUPPLIER' => $ubah_supplier
|
|
];
|
|
}
|
|
|
|
if ($id_kota==$datSupplier[0]['KOTA_ID'] AND $menu==4) {
|
|
$value = 4;
|
|
} else {
|
|
$action = $this->Amod->update('supplier', $update, 'ID_SUPPLIER', $id_supplier);
|
|
$value = 1;
|
|
}
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
}
|
|
|
|
public function MD_Hapus_DataSupplier() {
|
|
$id_supplier = $this->input->post('id_supplierdel');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$datSupplier = $this->Amod->getData_Supplier_byID_bySTATUS($id_supplier, 1);
|
|
if ($datSupplier==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$countDak = $this->Amod->getCount_DaftarAkuntansi_bySUPPLIER($id_supplier);
|
|
$countHhhda = $this->Amod->getCount_HasilHitungHda_bySUPPLIER($id_supplier);
|
|
$countKpr = $this->Amod->getCount_KlaimProgram_bySUPPLIER($id_supplier);
|
|
$countPembelian = $this->Amod->getCount_Pembelian_bySUPPLIER($id_supplier);
|
|
if ($countDak>0 OR $countHhhda>0 OR $countKpr>0 OR $countPembelian>0) {
|
|
$this->session->set_flashdata('data_used', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$update = [
|
|
'STATUS_SUPPLIER' => '0',
|
|
'HAPUS_SUPPLIER' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('supplier', $update, 'ID_SUPPLIER', $id_supplier);
|
|
|
|
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 MD_Excel_DataSupplier() {
|
|
$id_kota = $this->input->post('id_kotafill');
|
|
|
|
if ($id_kota=="") {
|
|
$id_kota = NULL;
|
|
$judul = "Semua Data";
|
|
} else {
|
|
$datKota = $this->Amod->getData_Kota_byID($id_kota);
|
|
$nama_kota = $datKota[0]['NAMA_KOTA'];
|
|
$judul = "$nama_kota";
|
|
}
|
|
|
|
$datSupplier = $this->Amod->getData_Supplier_byKOTA_bySTATUS($id_kota, 1);
|
|
$nama_tabel = array('NO', 'KOTA', 'NAMA', 'ALAMAT', 'TOP', 'PIC', 'NPWP', 'EMAIL', 'TELEPON');
|
|
|
|
$data = [
|
|
'sekarang' => date('d/m/Y H:i:s'),
|
|
'laporan' => $datSupplier,
|
|
'jumlah' => count($datSupplier),
|
|
'nama_tabel' => $nama_tabel,
|
|
'jumlah_kolom' => count($nama_tabel),
|
|
'judul' => $judul
|
|
];
|
|
$this->load->view('cetak/MD_Excel_DataSupplier', $data);
|
|
}
|
|
|
|
public function MD_MasterUnitProyek() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "MD", "MASTER - UnitProyek");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$datUnitProyek = $this->Amod->getData_UnitProyek_bySTATUS(1);
|
|
|
|
$data = array(
|
|
'sidebar' => "dashboard",
|
|
'navChild' => "",
|
|
'unitproyek' => $datUnitProyek,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil
|
|
);
|
|
$this->load->view('proses/MD_MasterUnitProyek', $data);
|
|
}
|
|
|
|
public function MD_Ambil_DataUnitProyek() {
|
|
$id_unitproyek = $this->input->post('id_unitproyek');
|
|
|
|
$datUnitProyek = $this->Amod->getData_UnitProyek_byID($id_unitproyek);
|
|
|
|
$this->output_json([
|
|
'nama_unitproyek' => $datUnitProyek[0]['NAMA_UNITPROYEK'],
|
|
]);
|
|
}
|
|
|
|
public function MD_Tambah_DataUnitProyek() {
|
|
$nama_unitproyek = $this->input->post('nama_unitproyek');
|
|
$nama_unitproyek = strtoupper(ltrim(rtrim(preg_replace('/\R+/', " " , $nama_unitproyek))));
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$value = 0;
|
|
$datUnitProyek = $this->Amod->getData_UnitProyek_byNAMA_bySTATUS($nama_unitproyek, 1);
|
|
if ($datUnitProyek==TRUE) {
|
|
$value = 2;
|
|
} else {
|
|
$cekUnitProyek = $this->Amod->getData_UnitProyek_byNAMA_bySTATUS($nama_unitproyek, 0);
|
|
if ($cekUnitProyek==TRUE) {
|
|
$update = [
|
|
'STATUS_UNITPROYEK' => '1',
|
|
'UBAH_UNITPROYEK' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('unitproyek', $update, 'ID_UNITPROYEK', $cekUnitProyek[0]['ID_UNITPROYEK']);
|
|
} else {
|
|
$input = [
|
|
'NAMA_UNITPROYEK' => $nama_unitproyek,
|
|
'STATUS_UNITPROYEK' => '1',
|
|
'TAMBAH_UNITPROYEK' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->create('unitproyek', $input);
|
|
}
|
|
$value = 1;
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
}
|
|
|
|
public function MD_Ubah_DataUnitProyek() {
|
|
$id_unitproyek = $this->input->post('id_unitproyek');
|
|
$nama_unitproyek = $this->input->post('nama_unitproyek');
|
|
$menu = $this->input->post('menu');
|
|
$nama_unitproyek = strtoupper(ltrim(rtrim(preg_replace('/\R+/', " " , $nama_unitproyek))));
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$value = 0;
|
|
$datUnitProyek = $this->Amod->getData_UnitProyek_byID($id_unitproyek);
|
|
if ($datUnitProyek==FALSE) {
|
|
$value = 3;
|
|
} else {
|
|
$cekUnitProyek = $this->Amod->getData_UnitProyek_byNAMA_bySTATUS($nama_unitproyek, 1, $id_unitproyek);
|
|
if ($cekUnitProyek==TRUE) {
|
|
$value = 2;
|
|
} else {
|
|
if ($menu==1) {
|
|
$update = [
|
|
'NAMA_UNITPROYEK' => $nama_unitproyek,
|
|
'UBAH_UNITPROYEK' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
}
|
|
|
|
$action = $this->Amod->update('unitproyek', $update, 'ID_UNITPROYEK', $id_unitproyek);
|
|
|
|
$value = 1;
|
|
}
|
|
}
|
|
|
|
$datUnitProyekNew = $this->Amod->getData_UnitProyek_bySTATUS(1);
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
'unitproyek' => $datUnitProyekNew,
|
|
]);
|
|
}
|
|
|
|
public function MD_Hapus_DataUnitProyek() {
|
|
$id_unitproyek = $this->input->post('id_unitproyekdel');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$datUnitProyek = $this->Amod->getData_UnitProyek_byID_bySTATUS($id_unitproyek, 1);
|
|
if ($datUnitProyek==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$countDak = $this->Amod->getCount_DaftarAkuntansi_byUNITPROYEK($id_unitproyek);
|
|
if ($countDak>0) {
|
|
$this->session->set_flashdata('data_used', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$update = [
|
|
'STATUS_UNITPROYEK' => '0',
|
|
'HAPUS_UNITPROYEK' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('unitproyek', $update, 'ID_UNITPROYEK', $id_unitproyek);
|
|
|
|
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 MD_Excel_DataUnitProyek() {
|
|
$datUnitProyek = $this->Amod->getData_UnitProyek_bySTATUS(1);
|
|
$nama_tabel = array('NO', 'NAMA');
|
|
|
|
$data = [
|
|
'sekarang' => date('d/m/Y H:i:s'),
|
|
'laporan' => $datUnitProyek,
|
|
'jumlah' => count($datUnitProyek),
|
|
'nama_tabel' => $nama_tabel,
|
|
'jumlah_kolom' => count($nama_tabel),
|
|
'judul' => "Semua Data"
|
|
];
|
|
$this->load->view('cetak/MD_Excel_DataUnitProyek', $data);
|
|
}
|
|
|
|
public function MD_MasterUnitService() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "MD", "MASTER - UnitService");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$datUnitService = $this->Amod->getData_UnitService_bySTATUS(1);
|
|
|
|
$data = array(
|
|
'sidebar' => "dashboard",
|
|
'navChild' => "",
|
|
'unitservice' => $datUnitService,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil
|
|
);
|
|
$this->load->view('proses/MD_MasterUnitService', $data);
|
|
}
|
|
|
|
public function MD_Ambil_DataUnitService() {
|
|
$id_unitservice = $this->input->post('id_unitservice');
|
|
|
|
$datUnitService = $this->Amod->getData_UnitService_byID($id_unitservice);
|
|
|
|
$this->output_json([
|
|
'nama_unitservice' => $datUnitService[0]['NAMA_UNITSERVICE'],
|
|
'nama_jenis' => $datUnitService[0]['NAMA_JENIS'],
|
|
'id_jenis' => $datUnitService[0]['JENIS_ID'],
|
|
]);
|
|
}
|
|
|
|
public function MD_Tambah_DataUnitService() {
|
|
$id_jenis = $this->input->post('id_jenis');
|
|
$nama_unitservice = $this->input->post('nama_unitservice');
|
|
$nama_unitservice = strtoupper(ltrim(rtrim(preg_replace('/\R+/', " " , $nama_unitservice))));
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$value = 0;
|
|
$datUnitService = $this->Amod->getData_UnitService_byNAMA_bySTATUS($nama_unitservice, 1);
|
|
if ($datUnitService==TRUE) {
|
|
$value = 2;
|
|
} else {
|
|
$cekUnitService = $this->Amod->getData_UnitService_byNAMA_bySTATUS($nama_unitservice, 0);
|
|
if ($cekUnitService==TRUE) {
|
|
$update = [
|
|
'JENIS_ID' => $id_jenis,
|
|
'STATUS_UNITSERVICE' => '1',
|
|
'UBAH_UNITSERVICE' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('unitservice', $update, 'ID_UNITSERVICE', $cekUnitService[0]['ID_UNITSERVICE']);
|
|
} else {
|
|
$input = [
|
|
'JENIS_ID' => $id_jenis,
|
|
'NAMA_UNITSERVICE' => $nama_unitservice,
|
|
'STATUS_UNITSERVICE' => '1',
|
|
'TAMBAH_UNITSERVICE' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->create('unitservice', $input);
|
|
}
|
|
$value = 1;
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
}
|
|
|
|
public function MD_Ubah_DataUnitService() {
|
|
$id_unitservice = $this->input->post('id_unitservice');
|
|
$id_jenis = $this->input->post('id_jenis');
|
|
$nama_unitservice = $this->input->post('nama_unitservice');
|
|
$menu = $this->input->post('menu');
|
|
$nama_unitservice = strtoupper(ltrim(rtrim(preg_replace('/\R+/', " " , $nama_unitservice))));
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$value = 0;
|
|
$datUnitService = $this->Amod->getData_UnitService_byID($id_unitservice);
|
|
if ($datUnitService==FALSE) {
|
|
$value = 3;
|
|
} else {
|
|
$cekUnitService = $this->Amod->getData_UnitService_byNAMA_bySTATUS($nama_unitservice, 1, $id_unitservice);
|
|
if ($cekUnitService==TRUE) {
|
|
$value = 2;
|
|
} else {
|
|
$ubah_unitservice = "Oleh $panggilan pada $timestamp";
|
|
if ($menu==1) {
|
|
$update = [
|
|
'NAMA_UNITSERVICE' => $nama_unitservice,
|
|
'UBAH_UNITSERVICE' => $ubah_unitservice
|
|
];
|
|
} else if ($menu==2) {
|
|
if ($id_jenis!=$datUnitService[0]['JENIS_ID']) {
|
|
$update = [
|
|
'JENIS_ID' => $id_jenis,
|
|
'UBAH_UNITSERVICE' => $ubah_unitservice
|
|
];
|
|
}
|
|
}
|
|
|
|
if ($id_jenis==$datUnitService[0]['JENIS_ID'] AND $menu==2) {
|
|
$value = 4;
|
|
} else {
|
|
$action = $this->Amod->update('unitservice', $update, 'ID_UNITSERVICE', $id_unitservice);
|
|
$value = 1;
|
|
}
|
|
}
|
|
}
|
|
|
|
$datUnitServiceNew = $this->Amod->getData_UnitService_bySTATUS(1);
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
'unitservice' => $datUnitServiceNew,
|
|
]);
|
|
}
|
|
|
|
public function MD_Hapus_DataUnitService() {
|
|
$id_unitservice = $this->input->post('id_unitservicedel');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$datUnitService = $this->Amod->getData_UnitService_byID_bySTATUS($id_unitservice, 1);
|
|
if ($datUnitService==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$countSns = $this->Amod->getCount_SnService_byUNITSERVICE($id_unitservice);
|
|
if ($countSns>0) {
|
|
$this->session->set_flashdata('data_used', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$update = [
|
|
'STATUS_UNITSERVICE' => '0',
|
|
'HAPUS_UNITSERVICE' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('unitservice', $update, 'ID_UNITSERVICE', $id_unitservice);
|
|
|
|
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 MD_Excel_DataUnitService() {
|
|
$id_jenis = $this->input->post('id_jenisfill');
|
|
|
|
if ($id_jenis=="") {
|
|
$id_jenis = NULL;
|
|
$judul = "Semua Data";
|
|
} else {
|
|
$datJenis = $this->Amod->getData_Jenis_byID($id_jenis);
|
|
$nama_jenis = $datJenis[0]['NAMA_JENIS'];
|
|
$judul = "$nama_jenis";
|
|
}
|
|
|
|
$datUnitService = $this->Amod->getData_UnitService_byJENIS_bySTATUS($id_jenis, 1);
|
|
$nama_tabel = array('NO', 'JENIS', 'NAMA');
|
|
|
|
$data = [
|
|
'sekarang' => date('d/m/Y H:i:s'),
|
|
'laporan' => $datUnitService,
|
|
'jumlah' => count($datUnitService),
|
|
'nama_tabel' => $nama_tabel,
|
|
'jumlah_kolom' => count($nama_tabel),
|
|
'judul' => $judul
|
|
];
|
|
$this->load->view('cetak/MD_Excel_DataUnitService', $data);
|
|
}
|
|
|
|
public function MD_MasterWajibPajak() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "MD", "MASTER - WajibPajak");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$datWajibPajak = $this->Amod->getData_WajibPajak_bySTATUS(1);
|
|
|
|
$data = array(
|
|
'sidebar' => "dashboard",
|
|
'navChild' => "",
|
|
'wajibpajak' => $datWajibPajak,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil
|
|
);
|
|
$this->load->view('proses/MD_MasterWajibPajak', $data);
|
|
}
|
|
|
|
public function MD_Ambil_DataWajibPajak() {
|
|
$id_wajibpajak = $this->input->post('id_wajibpajak');
|
|
|
|
$datWajibPajak = $this->Amod->getData_WajibPajak_byID($id_wajibpajak);
|
|
|
|
$this->output_json([
|
|
'nama_wajibpajak' => $datWajibPajak[0]['NAMA_WAJIBPAJAK'],
|
|
'alamat_wajibpajak' => $datWajibPajak[0]['ALAMAT_WAJIBPAJAK'],
|
|
'npwp_wajibpajak' => $datWajibPajak[0]['NPWP_WAJIBPAJAK'],
|
|
]);
|
|
}
|
|
|
|
public function MD_Tambah_DataWajibPajak() {
|
|
$nama_wajibpajak = $this->input->post('nama_wajibpajak');
|
|
$alamat_wajibpajak = $this->input->post('alamat_wajibpajak');
|
|
$npwp_wajibpajak = $this->input->post('npwp_wajibpajak');
|
|
$nama_wajibpajak = strtoupper(ltrim(rtrim(preg_replace('/\R+/', " " , $nama_wajibpajak))));
|
|
$alamat_wajibpajak = strtoupper(ltrim(rtrim(preg_replace('/\R+/', " " , $alamat_wajibpajak))));
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$value = 0;
|
|
$datWajibPajak = $this->Amod->getData_WajibPajak_byNAMA_bySTATUS($nama_wajibpajak, 1);
|
|
if ($datWajibPajak==TRUE) {
|
|
$value = 2;
|
|
} else {
|
|
$cekWajibPajak = $this->Amod->getData_WajibPajak_byNAMA_bySTATUS($nama_wajibpajak, 0);
|
|
if ($cekWajibPajak==TRUE) {
|
|
$update = [
|
|
'ALAMAT_WAJIBPAJAK' => $alamat_wajibpajak,
|
|
'NPWP_WAJIBPAJAK' => $npwp_wajibpajak,
|
|
'STATUS_WAJIBPAJAK' => '1',
|
|
'UBAH_WAJIBPAJAK' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('wajibpajak', $update, 'ID_WAJIBPAJAK', $cekWajibPajak[0]['ID_WAJIBPAJAK']);
|
|
} else {
|
|
$input = [
|
|
'NAMA_WAJIBPAJAK' => $nama_wajibpajak,
|
|
'ALAMAT_WAJIBPAJAK' => $alamat_wajibpajak,
|
|
'NPWP_WAJIBPAJAK' => $npwp_wajibpajak,
|
|
'STATUS_WAJIBPAJAK' => '1',
|
|
'TAMBAH_WAJIBPAJAK' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->create('wajibpajak', $input);
|
|
}
|
|
$value = 1;
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
}
|
|
|
|
public function MD_Ubah_DataWajibPajak() {
|
|
$id_wajibpajak = $this->input->post('id_wajibpajak');
|
|
$nama_wajibpajak = $this->input->post('nama_wajibpajak');
|
|
$alamat_wajibpajak = $this->input->post('alamat_wajibpajak');
|
|
$npwp_wajibpajak = $this->input->post('npwp_wajibpajak');
|
|
$menu = $this->input->post('menu');
|
|
$nama_wajibpajak = strtoupper(ltrim(rtrim(preg_replace('/\R+/', " " , $nama_wajibpajak))));
|
|
$alamat_wajibpajak = strtoupper(ltrim(rtrim(preg_replace('/\R+/', " " , $alamat_wajibpajak))));
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$value = 0;
|
|
$datWajibPajak = $this->Amod->getData_WajibPajak_byID($id_wajibpajak);
|
|
if ($datWajibPajak==FALSE) {
|
|
$value = 3;
|
|
} else {
|
|
$cekWajibPajak = $this->Amod->getData_WajibPajak_byNAMA_bySTATUS($nama_wajibpajak, 1, $id_wajibpajak);
|
|
if ($cekWajibPajak==TRUE) {
|
|
$value = 2;
|
|
} else {
|
|
if ($menu==1) {
|
|
$update = [
|
|
'NAMA_WAJIBPAJAK' => $nama_wajibpajak,
|
|
'UBAH_WAJIBPAJAK' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
} else if ($menu==2) {
|
|
$update = [
|
|
'ALAMAT_WAJIBPAJAK' => $alamat_wajibpajak,
|
|
'UBAH_WAJIBPAJAK' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
} else if ($menu==2) {
|
|
$update = [
|
|
'NPWP_WAJIBPAJAK' => $npwp_wajibpajak,
|
|
'UBAH_WAJIBPAJAK' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
}
|
|
|
|
$action = $this->Amod->update('wajibpajak', $update, 'ID_WAJIBPAJAK', $id_wajibpajak);
|
|
|
|
$value = 1;
|
|
}
|
|
}
|
|
|
|
$datWajibPajakNew = $this->Amod->getData_WajibPajak_bySTATUS(1);
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
'wajibpajak' => $datWajibPajakNew,
|
|
]);
|
|
}
|
|
|
|
public function MD_Hapus_DataWajibPajak() {
|
|
$id_wajibpajak = $this->input->post('id_wajibpajakdel');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$datWajibPajak = $this->Amod->getData_WajibPajak_byID_bySTATUS($id_wajibpajak, 1);
|
|
if ($datWajibPajak==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$countRpj = $this->Amod->getCount_RekapPajak_byWAJIBPAJAK($id_wajibpajak);
|
|
if ($countRpj>0) {
|
|
$this->session->set_flashdata('data_used', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$update = [
|
|
'STATUS_WAJIBPAJAK' => '0',
|
|
'HAPUS_WAJIBPAJAK' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('wajibpajak', $update, 'ID_WAJIBPAJAK', $id_wajibpajak);
|
|
|
|
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 MD_Excel_DataWajibPajak() {
|
|
$datWajibPajak = $this->Amod->getData_WajibPajak_bySTATUS(1);
|
|
$nama_tabel = array('NO', 'NAMA', 'NPWP', 'ALAMAT');
|
|
|
|
$data = [
|
|
'sekarang' => date('d/m/Y H:i:s'),
|
|
'laporan' => $datWajibPajak,
|
|
'jumlah' => count($datWajibPajak),
|
|
'nama_tabel' => $nama_tabel,
|
|
'jumlah_kolom' => count($nama_tabel),
|
|
'judul' => "Semua Data"
|
|
];
|
|
$this->load->view('cetak/MD_Excel_DataWajibPajak', $data);
|
|
}
|
|
|
|
//Daftar Menu DA [Dashboard]
|
|
//SUBMENU Status Karyawan masing-masing
|
|
public function index() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$now = date('Y-m-d');
|
|
$time = date('00:00');
|
|
|
|
//Menghitung Sisa Cuti Tahunan
|
|
$limitAtas = date('Y-01-01');
|
|
$limitBawah = date('Y-12-31');
|
|
$cutiDipakai = $this->Amod->getCount_DaftarFormKaryawan_byKARYAWAN_byJFK_byPERIODE($id_karyawan, 5, $limitAtas, $limitBawah);
|
|
$cutiBersama = $this->Amod->getCount_SetHariLibur_byJENIS_byPERIODE(2, $limitAtas, $limitBawah);
|
|
$sisaCuti = 12-$cutiDipakai-$cutiBersama;
|
|
|
|
//Menghitung Sisa Izin Sementara
|
|
$month = (int) date('m');
|
|
if ($month<=6) {
|
|
$limitAtas = date('Y-01-01');
|
|
$limitBawah = date('Y-06-30');
|
|
$semester = 1;
|
|
} else if ($month>6) {
|
|
$limitAtas = date('Y-07-01');
|
|
$limitBawah = date('Y-12-31');
|
|
$semester = 2;
|
|
}
|
|
$izinDipakai = $this->Amod->getCount_DaftarFormKaryawan_byKARYAWAN_byJFK_byPERIODE($id_karyawan, 7, $limitAtas, $limitBawah);
|
|
$sisaIzin = 3-$izinDipakai;
|
|
|
|
$datStpos = $this->Amod->getData_SetTogglePosisi_byKARYAWAN_byMENU($id_karyawan, 0);
|
|
if ($datStpos==FALSE) { $posisiToggle = 0; } else { $posisiToggle = $datStpos[0]['AKTIF_STPOS']; }
|
|
|
|
$datJfk = $this->Amod->getData_JenisFk();
|
|
$datKaryawan = $this->Amod->getData_Karyawan_forAbsensi();
|
|
$datPab = $this->Amod->getData_PeriodeAbsensi();
|
|
$datPum = $this->Amod->getData_PeriodeUmum_byJENIS_orderDESC(2); // Kuartal
|
|
$datSales = $this->Amod->getData_Karyawan_allSalesKpi();
|
|
|
|
$cekFk = $this->Amod->getData_FormKaryawan_byKARYAWAN_statusNull($id_karyawan);
|
|
$id_fk = 0;
|
|
$jenis_fk = 0;
|
|
$id_sales = 0;
|
|
if ($cekFk==TRUE) {
|
|
if (strtotime($now)>strtotime($cekFk[0]['TGL_FK'])) {
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
$update = [
|
|
'STATUS_FK' => 2,
|
|
'BATAL_FK' => "Oleh Admin pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('form_karyawan', $update, 'ID_FK', $cekFk[0]['ID_FK']);
|
|
} else {
|
|
$id_fk = $cekFk[0]['ID_FK'];
|
|
$jenis_fk = $cekFk[0]['JENIS_FK'];
|
|
$id_sales = $cekFk[0]['SALES_ID'];
|
|
}
|
|
}
|
|
|
|
$cekPab = $this->Amod->getData_PeriodeAbsensi_byTGL($now);
|
|
if ($cekPab==TRUE) {
|
|
$id_pab = $cekPab[0]['ID_PAB'];
|
|
$nama_pab = $cekPab[0]['NAMA_PAB'];
|
|
} else {
|
|
$id_pab = $datPab[0]['ID_PAB'];
|
|
$nama_pab = $datPab[0]['NAMA_PAB'];
|
|
}
|
|
|
|
$cekPum = $this->Amod->getData_PeriodeUmum_byJENIS_byTGL(2, $now);
|
|
if ($cekPum==FALSE) {
|
|
$id_pum = 0;
|
|
$nama_pum = "Kosong";
|
|
} else {
|
|
$id_pum = $cekPum[0]['ID_PUM'];
|
|
$nama_pum = $cekPum[0]['NAMA_PUM'];
|
|
}
|
|
|
|
if ($id_karyawan==1) {
|
|
$datProyek = $this->Amod->getData_Proyek_bySTATUS_rpNull_jenisLess2(0);
|
|
} else {
|
|
$datProyek = $this->Amod->getData_Proyek_bySALES_bySTATUS($id_karyawan, 0);
|
|
}
|
|
|
|
$day_check = date_format(date_create($now), "l");
|
|
$hariIni = $this->Amod->generate_inisialDay($day_check);
|
|
|
|
$data = array(
|
|
'sidebar' => "dashboard",
|
|
'navChild' => "",
|
|
'posisiToggle' => $posisiToggle,
|
|
'jfk' => $datJfk,
|
|
'karyawan' => $datKaryawan,
|
|
'pab' => $datPab,
|
|
'pum' => $datPum,
|
|
'proyek' => $datProyek,
|
|
'sales' => $datSales,
|
|
'id_fk' => $id_fk,
|
|
'id_pab' => $id_pab,
|
|
'id_pum' => $id_pum,
|
|
'nama_pum' => $nama_pum,
|
|
'id_karyawan' => $id_karyawan,
|
|
'panggilan' => $panggilan,
|
|
'id_sales' => $id_sales,
|
|
'nama_pab' => $nama_pab,
|
|
'jenis_fk' => $jenis_fk,
|
|
'semester' => $semester,
|
|
'sisaCuti' => $sisaCuti,
|
|
'sisaIzin' => $sisaIzin,
|
|
'tgl' => $now,
|
|
'time' => $time,
|
|
'timestamp' => date('H:i:s'),
|
|
'hariIni' => $hariIni,
|
|
);
|
|
$this->load->view('proses/DA_Sub0_Karyawan_1', $data);
|
|
}
|
|
|
|
public function DA_Simpan_DataDaftarFormKaryawan() {
|
|
$id_fk = $this->input->post('id_fk');
|
|
$id_jfk = $this->input->post('id_jfk');
|
|
$id_sales = $this->input->post('id_sales');
|
|
$tgl_dffk = $this->input->post('tgl_dffk');
|
|
$jenis_dffk = $this->input->post('jenis_dffk');
|
|
$inap_dffk = $this->input->post('inap_dffk');
|
|
$mulai_dffk = $this->input->post('mulai_dffk');
|
|
$selesai_dffk = $this->input->post('selesai_dffk');
|
|
$ket_dffk = $this->input->post('ket_dffk');
|
|
$nilai_dffk = $this->input->post('nilai_dffk');
|
|
$ket_dffk = rtrim(ltrim(preg_replace('/\R+/', " " , $ket_dffk)));
|
|
$now = date('Y-m-d');
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
|
|
if ($id_fk==0) {
|
|
$nilai_fk = 0;
|
|
$kode_fk = $this->Amod->generate_kodeFormKaryawan();
|
|
$input = [
|
|
'KODE_FK' => $kode_fk,
|
|
'JENIS_FK' => $id_jfk,
|
|
'TGL_FK' => $now,
|
|
'KARYAWAN_ID' => $id_karyawan,
|
|
'SALES_ID' => $id_sales,
|
|
'NILAI_FK' => $nilai_fk
|
|
];
|
|
$action = $this->Amod->create('form_karyawan', $input);
|
|
|
|
$id_fk = $this->Amod->getMax_ID_FormKaryawan();
|
|
$id_fk = $id_fk[0]['ID_FK'];
|
|
} else {
|
|
$datFk = $this->Amod->getData_FormKaryawan_byID($id_fk);
|
|
$nilai_fk = $datFk[0]['NILAI_FK'];
|
|
}
|
|
|
|
if ($mulai_dffk=="00.00") {
|
|
$mulai_dffk = "";
|
|
$selesai_dffk = "";
|
|
}
|
|
|
|
if ($inap_dffk=="") {
|
|
$inap_dffk = NULL;
|
|
}
|
|
|
|
$input = [
|
|
'JENIS_DFFK' => $jenis_dffk,
|
|
'FK_ID' => $id_fk,
|
|
'TGL_DFFK' => $tgl_dffk,
|
|
'MULAI_DFFK' => $mulai_dffk,
|
|
'SELESAI_DFFK' => $selesai_dffk,
|
|
'KET_DFFK' => $ket_dffk,
|
|
'NILAI_DFFK' => $nilai_dffk,
|
|
'INAP_DFFK' => $inap_dffk
|
|
];
|
|
$action = $this->Amod->create('daftar_formkaryawan', $input);
|
|
|
|
$update = [
|
|
'NILAI_FK' => $nilai_fk+$nilai_dffk
|
|
];
|
|
$action = $this->Amod->update('form_karyawan', $update, 'ID_FK', $id_fk);
|
|
|
|
$this->output_json([
|
|
'value' => 1
|
|
]);
|
|
}
|
|
|
|
public function DA_Hapus_DataDaftarFormKaryawan() {
|
|
$id_fk = $this->input->post('id_fk');
|
|
$id_dffk = $this->input->post('id_dffk');
|
|
|
|
$value = 0;
|
|
$datFk = $this->Amod->getData_FormKaryawan_byID($id_fk);
|
|
$datDffk = $this->Amod->getData_DaftarFormKaryawan_byID($id_dffk);
|
|
if ($datFk==FALSE OR $datDffk==FALSE) {
|
|
$value = 2;
|
|
} else {
|
|
$nilai_fk = $datFk[0]['NILAI_FK'];
|
|
$nilai_dffk = $datDffk[0]['NILAI_DFFK'];
|
|
|
|
$update = [
|
|
'NILAI_FK' => $nilai_fk-$nilai_dffk
|
|
];
|
|
$action = $this->Amod->update('form_karyawan', $update, 'ID_FK', $id_fk);
|
|
|
|
$action = $this->Amod->delete('daftar_formkaryawan', $id_dffk, 'ID_DFFK');
|
|
|
|
$value = 1;
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value
|
|
]);
|
|
}
|
|
|
|
public function DA_Batal_DataFormKaryawan() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$id_fk = $this->input->post('fk_id');
|
|
$verse = $this->input->post('verse');
|
|
$ket_batal = $this->input->post('ket_batal');
|
|
$ket_batal = rtrim(ltrim(preg_replace('/\R+/', " " , $ket_batal)));
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
$now = date('Y-m-d');
|
|
|
|
$value = 0;
|
|
if ($verse==1) {
|
|
$datFk = $this->Amod->getData_FormKaryawan_byKARYAWAN_statusNull($id_karyawan);
|
|
} else if ($verse==2) {
|
|
$datFk = $this->Amod->getData_FormKaryawan_byID_bySTATUS($id_fk, 0);
|
|
}
|
|
if ($datFk==FALSE) {
|
|
$value = 2;
|
|
} else {
|
|
if ($verse==1) {
|
|
$update = [
|
|
'BATAL_FK' => "Oleh $panggilan pada $timestamp",
|
|
'STATUS_FK' => '2',
|
|
];
|
|
$action = $this->Amod->update('form_karyawan', $update, 'ID_FK', $datFk[0]['ID_FK']);
|
|
} else if ($verse==2) {
|
|
$update = [
|
|
'BATAL_FK' => "Oleh $panggilan pada $timestamp",
|
|
'STATUS_FK' => '2',
|
|
'TGL_BATAL' => $now,
|
|
'KET_BATAL' => $ket_batal
|
|
];
|
|
$action = $this->Amod->update('form_karyawan', $update, 'ID_FK', $id_fk);
|
|
}
|
|
$value = 1;
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value
|
|
]);
|
|
}
|
|
|
|
public function DA_Kunci_DataFormKaryawan() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$now = date('Y-m-d');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$value = 0;
|
|
$datFk = $this->Amod->getData_FormKaryawan_byKARYAWAN_statusNull($id_karyawan);
|
|
if ($datFk==FALSE) {
|
|
$value = 2;
|
|
} else {
|
|
if ($datFk[0]['KARYAWAN_ID']==$datFk[0]['SALES_ID'] AND $datFk[0]['JENIS_FK']==2) {
|
|
$confirm_fk_s = "Oleh $panggilan pada $timestamp";
|
|
} else {
|
|
$confirm_fk_s = NULL;
|
|
}
|
|
if ($datFk[0]['ANGGOTA_KARYAWAN']==$datFk[0]['SALES_ID']) {
|
|
$confirm_fk_o = "Oleh $panggilan pada $timestamp";
|
|
} else {
|
|
$confirm_fk_o = NULL;
|
|
}
|
|
|
|
|
|
$update = [
|
|
'TGL_FK' => $now,
|
|
'CONFIRM_FK_S' => $confirm_fk_s,
|
|
'CONFIRM_FK_O' => $confirm_fk_o,
|
|
'STATUS_FK' => '0',
|
|
];
|
|
$action = $this->Amod->update('form_karyawan', $update, 'ID_FK', $datFk[0]['ID_FK']);
|
|
|
|
$value = 1;
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value
|
|
]);
|
|
}
|
|
|
|
public function DA_Acc_DataFormKaryawan() {
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$jabatan = $this->session->userdata('jabatan');
|
|
$id_fk = $this->input->post('id_fk');
|
|
$id_proyek = $this->input->post('id_proyek');
|
|
$verse = $this->input->post('verse');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
$now = date('Y-m-d');
|
|
|
|
$value = 0;
|
|
$datFk = $this->Amod->getData_FormKaryawan_byID_bySTATUS($id_fk, 0);
|
|
if ($datFk==FALSE) {
|
|
$value = 2;
|
|
} else {
|
|
if ($verse==1) {
|
|
if ($jabatan=="PIMPINAN") {
|
|
$update = [
|
|
'CONFIRM_FK_P' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('form_karyawan', $update, 'ID_FK', $id_fk);
|
|
} else if (strpos($jabatan,"KADIV")!==FALSE) {
|
|
if ($datFk[0]['JENIS_FK']<=4) {
|
|
$update = [
|
|
'CONFIRM_FK_O' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('form_karyawan', $update, 'ID_FK', $id_fk);
|
|
} else if ($datFk[0]['JENIS_FK']>=5 AND $datFk[0]['JENIS_FK']<=6) {
|
|
if ($panggilan=="Arifin") {
|
|
if (strpos($datFk[0]['NAMA_JABATAN'],"GUDANG")!==FALSE OR strpos($datFk[0]['NAMA_JABATAN'],"UMUM")!==FALSE) {
|
|
$update = [
|
|
'CONFIRM_FK_O' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('form_karyawan', $update, 'ID_FK', $id_fk);
|
|
}
|
|
$update = [
|
|
'CONFIRM_FK_P' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('form_karyawan', $update, 'ID_FK', $id_fk);
|
|
} else {
|
|
$update = [
|
|
'CONFIRM_FK_O' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('form_karyawan', $update, 'ID_FK', $id_fk);
|
|
}
|
|
|
|
$cekFk = $this->Amod->getData_FormKaryawan_byID($id_fk);
|
|
if ($cekFk[0]['CONFIRM_FK_O']!=NULL AND $cekFk[0]['CONFIRM_FK_P']!=NULL) {
|
|
$datDffk = $this->Amod->getData_DaftarFormKaryawan_byFK($id_fk);
|
|
foreach ($datDffk as $key) {
|
|
$input = [
|
|
'KARYAWAN_ID' => $cekFk[0]['KID'],
|
|
'TGL_ABSENSI' => $key['TGL_DFFK'],
|
|
'STATUS_ABSENSI' => '3',
|
|
'KET_ABSENSI' => $key['KET_DFFK'],
|
|
'FK_ID' => $id_fk
|
|
];
|
|
$action = $this->Amod->create('absensi', $input);
|
|
}
|
|
|
|
$update = [
|
|
'STATUS_FK' => '1'
|
|
];
|
|
$action = $this->Amod->update('form_karyawan', $update, 'ID_FK', $id_fk);
|
|
}
|
|
} else if ($datFk[0]['JENIS_FK']==7) {
|
|
$update = [
|
|
'CONFIRM_FK_O' => "Oleh $panggilan pada $timestamp",
|
|
'CONFIRM_FK_P' => "Oleh $panggilan pada $timestamp",
|
|
];
|
|
$action = $this->Amod->update('form_karyawan', $update, 'ID_FK', $id_fk);
|
|
|
|
$datDffk = $this->Amod->getData_DaftarFormKaryawan_byFK($id_fk);
|
|
if ($datDffk[0]['TGL_DFFK']==$now AND $datDffk[0]['SELESAI_DFFK']=="17:00") {
|
|
$datAbsensi = $this->Amod->getData_Absensi_byKARYAWAN_byTGL($datFk[0]['KARYAWAN_ID'], $now);
|
|
if ($datAbsensi==TRUE) {
|
|
$update = [
|
|
'FK_ID' => $id_fk,
|
|
'JAM_KELUAR' => $datDffk[0]['SELESAI_DFFK']
|
|
];
|
|
$action = $this->Amod->update('absensi', $update, 'ID_ABSENSI', $datAbsensi[0]['ID_ABSENSI']);
|
|
|
|
$update = [
|
|
'STATUS_FK' => '1'
|
|
];
|
|
$action = $this->Amod->update('form_karyawan', $update, 'ID_FK', $id_fk);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} else if ($verse==2) {
|
|
$update = [
|
|
'CONFIRM_FK_S' => "Oleh $panggilan pada $timestamp",
|
|
'PROYEK_ID' => $id_proyek
|
|
];
|
|
$action = $this->Amod->update('form_karyawan', $update, 'ID_FK', $id_fk);
|
|
}
|
|
$value = 1;
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value
|
|
]);
|
|
}
|
|
|
|
public function DA_Simpan_DataFormKaryawan() {
|
|
$id_jfk = $this->input->post('id_jfk');
|
|
$id_insentif = $this->input->post('id_insentif');
|
|
$id_karyawan = $this->input->post('id_karyawan');
|
|
$nilai_dffk = $this->input->post('nilai_dffk');
|
|
$id_proyek = $this->input->post('id_proyek');
|
|
$ket_dffk = $this->input->post('ket_dffk');
|
|
$tgl_awal = $this->input->post('tgl_awal');
|
|
$tgl_akhir = $this->input->post('tgl_akhir');
|
|
$jam_awal = $this->input->post('jam_awal');
|
|
$jam_akhir = $this->input->post('jam_akhir');
|
|
$tgl_fk = $this->input->post('tgl_fk');
|
|
$ket_dffk = rtrim(ltrim(preg_replace('/\R+/', " " , $ket_dffk)));
|
|
$karyawan_id = $this->session->userdata('id_karyawan');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$now = date('Y-m-d');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
if ($karyawan_id==53) {
|
|
$karyawan_id = 22;
|
|
}
|
|
|
|
$value = 0;
|
|
if ($id_jfk==4) {
|
|
if ($id_insentif==1) {
|
|
$kode_fk = $this->Amod->generate_kodeFormKaryawan();
|
|
$input = [
|
|
'KODE_FK' => $kode_fk,
|
|
'JENIS_FK' => $id_jfk,
|
|
'TGL_FK' => $now,
|
|
'KARYAWAN_ID' => $id_karyawan,
|
|
'SALES_ID' => $karyawan_id,
|
|
'PROYEK_ID' => $id_proyek,
|
|
'NILAI_FK' => $nilai_dffk,
|
|
'STATUS_FK' => '0',
|
|
'CONFIRM_FK_S' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->create('form_karyawan', $input);
|
|
|
|
$id_fk = $this->Amod->getMax_ID_FormKaryawan();
|
|
$id_fk = $id_fk[0]['ID_FK'];
|
|
|
|
$input = [
|
|
'FK_ID' => $id_fk,
|
|
'JENIS_DFFK' => '0',
|
|
'TGL_DFFK' => $now,
|
|
'MULAI_DFFK' => "00:00",
|
|
'SELESAI_DFFK' => "00:00",
|
|
'KET_DFFK' => $ket_dffk,
|
|
'NILAI_DFFK' => $nilai_dffk,
|
|
'INAP_DFFK' => '0'
|
|
];
|
|
$action = $this->Amod->create('daftar_formkaryawan', $input);
|
|
|
|
$value = 1;
|
|
} else if ($id_insentif==2) {
|
|
$countDpc = $this->Amod->getCount_DaftarPromoClearance_byKARYAWAN_bySTATUS_NotStpc($karyawan_id, 0);
|
|
if ($countDpc==0) {
|
|
$value = 2;
|
|
} else {
|
|
$datDpc = $this->Amod->getData_DaftarPromoClearance_byKARYAWAN_bySTATUS($karyawan_id, 0);
|
|
foreach ($datDpc as $key) {
|
|
$kode_fk = $this->Amod->generate_kodeFormKaryawan();
|
|
$nilai_dffk = $this->Amod->generate_nilaiInsentifPromoClearance($key['ID_DPC']);
|
|
$datDo = $this->Amod->getData_DaftarOrder_byPENJUALAN_byBARANG($key['PENJUALAN_ID'], $key['BARANG_ID']);
|
|
$qty_do = $datDo[0]['QTY_DO'];
|
|
$kode_so = $datDo[0]['KODE_SO'];
|
|
$kode_barang = $datDo[0]['KODE_BARANG'];
|
|
$ket_dffk = "Promo Clearance - $kode_so - $qty_do EA $kode_barang";
|
|
|
|
$input = [
|
|
'JENIS_FK' => $id_jfk,
|
|
'KODE_FK' => $kode_fk,
|
|
'TGL_FK' => $now,
|
|
'NILAI_FK' => $nilai_dffk,
|
|
'SALES_ID' => $karyawan_id,
|
|
'KARYAWAN_ID' => $karyawan_id,
|
|
'CONFIRM_FK_S' => "Oleh $panggilan pada $timestamp",
|
|
'PROYEK_ID' => '0',
|
|
'STATUS_FK' => '0'
|
|
];
|
|
$action = $this->Amod->create('form_karyawan', $input);
|
|
|
|
$id_fk = $this->Amod->getMax_ID_FormKaryawan();
|
|
$id_fk = $id_fk[0]['ID_FK'];
|
|
|
|
$input = [
|
|
'FK_ID' => $id_fk,
|
|
'TGL_DFFK' => $now,
|
|
'KET_DFFK' => $ket_dffk,
|
|
'MULAI_DFFK' => "00:00",
|
|
'SELESAI_DFFK' => "00:00",
|
|
'NILAI_DFFK' => $nilai_dffk,
|
|
'JENIS_DFFK' => '0',
|
|
'INAP_DFFK' => '0'
|
|
];
|
|
$action = $this->Amod->create('daftar_formkaryawan', $input);
|
|
|
|
$update = [
|
|
'STATUS_DPC' => '1',
|
|
'FK_ID' => $id_fk
|
|
];
|
|
$action = $this->Amod->update('daftar_promoclearance', $update, 'ID_DPC', $key['ID_DPC']);
|
|
}
|
|
|
|
$value = 1;
|
|
}
|
|
}
|
|
} else if ($id_jfk==5 OR $id_jfk==6 OR $id_jfk==7 OR $id_jfk==8 OR $id_jfk==9) {
|
|
$kode_fk = $this->Amod->generate_kodeFormKaryawan();
|
|
if ($id_jfk==5 OR $id_jfk==6 OR $id_jfk==7) {
|
|
$input = [
|
|
'KODE_FK' => $kode_fk,
|
|
'JENIS_FK' => $id_jfk,
|
|
'TGL_FK' => $now,
|
|
'KARYAWAN_ID' => $karyawan_id,
|
|
'SALES_ID' => $karyawan_id,
|
|
'STATUS_FK' => '0',
|
|
'CONFIRM_FK_S' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
} else if ($id_jfk==8 OR $id_jfk==9) {
|
|
if ($id_jfk==8) {
|
|
$jfk_id = 5;
|
|
} else if ($id_jfk==9) {
|
|
$jfk_id = 7;
|
|
}
|
|
$input = [
|
|
'KODE_FK' => $kode_fk,
|
|
'JENIS_FK' => $jfk_id,
|
|
'TGL_FK' => $now,
|
|
'KARYAWAN_ID' => $id_karyawan,
|
|
'SALES_ID' => $id_karyawan,
|
|
'STATUS_FK' => '0',
|
|
'CONFIRM_FK_S' => "Oleh $panggilan pada $timestamp",
|
|
'CONFIRM_FK_O' => "Oleh $panggilan pada $timestamp",
|
|
'CONFIRM_FK_P' => "Oleh $panggilan pada $timestamp",
|
|
];
|
|
}
|
|
$action = $this->Amod->create('form_karyawan', $input);
|
|
|
|
$id_fk = $this->Amod->getMax_ID_FormKaryawan();
|
|
$id_fk = $id_fk[0]['ID_FK'];
|
|
|
|
if ($id_jfk==5 OR $id_jfk==6) {
|
|
$diffawal = new DateTime($tgl_awal);
|
|
$diffakhir = new DateTime($tgl_akhir);
|
|
$diff = date_diff($diffawal, $diffakhir);
|
|
$diff = $diff->format("%a");
|
|
$tglstart = $tgl_awal;
|
|
$nilai_fk = 0;
|
|
for ($i = 0; $i<=$diff; $i++) {
|
|
$tglloop = $this->Amod->generate_addDay($tglstart, $i);
|
|
|
|
$cekMinggu = date_format(date_create($tglloop),"w");
|
|
if ($cekMinggu>0) {
|
|
$cekLibur = $this->Amod->getData_SetHariLibur_byTGL($tglloop);
|
|
if ($cekLibur==FALSE) {
|
|
$input = [
|
|
'FK_ID' => $id_fk,
|
|
'JENIS_DFFK' => '0',
|
|
'TGL_DFFK' => $tglloop,
|
|
'MULAI_DFFK' => "00:00",
|
|
'SELESAI_DFFK' => "00:00",
|
|
'KET_DFFK' => $ket_dffk,
|
|
'NILAI_DFFK' => '0',
|
|
'INAP_DFFK' => '0'
|
|
];
|
|
$action = $this->Amod->create('daftar_formkaryawan', $input);
|
|
|
|
$nilai_fk++;
|
|
}
|
|
}
|
|
}
|
|
|
|
if ($nilai_fk>0) {
|
|
$update = [
|
|
'NILAI_FK' => $nilai_fk
|
|
];
|
|
$action = $this->Amod->update('form_karyawan', $update, 'ID_FK', $id_fk);
|
|
}
|
|
$value = 1;
|
|
} else if ($id_jfk==7 OR $id_jfk==9) {
|
|
$input = [
|
|
'FK_ID' => $id_fk,
|
|
'JENIS_DFFK' => '0',
|
|
'TGL_DFFK' => $tgl_fk,
|
|
'MULAI_DFFK' => $jam_awal,
|
|
'SELESAI_DFFK' => $jam_akhir,
|
|
'KET_DFFK' => $ket_dffk,
|
|
'NILAI_DFFK' => '0',
|
|
'INAP_DFFK' => '0'
|
|
];
|
|
$action = $this->Amod->create('daftar_formkaryawan', $input);
|
|
$value = 1;
|
|
|
|
if ($id_jfk==9) {
|
|
if ($jam_akhir=="17:00") {
|
|
$update = [
|
|
'STATUS_FK' => '1'
|
|
];
|
|
$action = $this->Amod->update('form_karyawan', $update, 'ID_FK', $id_fk);
|
|
|
|
$datAbsensi = $this->Amod->getData_Absensi_byKARYAWAN_byTGL($id_karyawan, $tgl_fk);
|
|
if ($datAbsensi==TRUE) {
|
|
$update = [
|
|
'JAM_KELUAR' => $jam_akhir,
|
|
'KET_ABSENSI' => $ket_dffk,
|
|
'FK_ID' => $id_fk
|
|
];
|
|
$action = $this->Amod->update('absensi', $update, 'ID_ABSENSI', $datAbsensi[0]['ID_ABSENSI']);
|
|
}
|
|
}
|
|
}
|
|
} else if ($id_jfk==8) {
|
|
$input = [
|
|
'FK_ID' => $id_fk,
|
|
'JENIS_DFFK' => '0',
|
|
'TGL_DFFK' => $tgl_fk,
|
|
'MULAI_DFFK' => "00:00",
|
|
'SELESAI_DFFK' => "00:00",
|
|
'KET_DFFK' => $ket_dffk,
|
|
'NILAI_DFFK' => '0',
|
|
'INAP_DFFK' => '0'
|
|
];
|
|
$action = $this->Amod->create('daftar_formkaryawan', $input);
|
|
|
|
$input = [
|
|
'KARYAWAN_ID' => $id_karyawan,
|
|
'TGL_ABSENSI' => $tgl_fk,
|
|
'STATUS_ABSENSI' => '3',
|
|
'KET_ABSENSI' => $ket_dffk,
|
|
'FK_ID' => $id_fk
|
|
];
|
|
$action = $this->Amod->create('absensi', $input);
|
|
|
|
$update = [
|
|
'NILAI_FK' => '1',
|
|
'STATUS_FK' => '1'
|
|
];
|
|
$action = $this->Amod->update('form_karyawan', $update, 'ID_FK', $id_fk);
|
|
$value = 1;
|
|
}
|
|
}
|
|
|
|
if ($id_jfk==5) {
|
|
$dataKaryawan = $this->Amod->getData_Karyawan_byID($karyawan_id);
|
|
if (strpos($dataKaryawan[0]['NAMA_JABATAN'],"KADIV")!==FALSE) {
|
|
$update = [
|
|
'CONFIRM_FK_O' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('form_karyawan', $update, 'ID_FK', $id_fk);
|
|
}
|
|
} else if ($id_jfk==8) {
|
|
$dataKaryawan = $this->Amod->getData_Karyawan_byID($id_karyawan);
|
|
if (strpos($dataKaryawan[0]['NAMA_JABATAN'],"KADIV")!==FALSE) {
|
|
$update = [
|
|
'CONFIRM_FK_O' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('form_karyawan', $update, 'ID_FK', $id_fk);
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value
|
|
]);
|
|
}
|
|
|
|
public function DA_Acc_DataFormFeePelanggan() {
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$jabatan = $this->session->userdata('jabatan');
|
|
$id_ffp = $this->input->post('id_ffp');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
$now = date('Y-m-d');
|
|
|
|
$value = 0;
|
|
$datFfp = $this->Amod->getData_FormFeePelanggan_byID_bySTATUS($id_ffp, 0);
|
|
if ($datFfp==FALSE) {
|
|
$value = 2;
|
|
} else {
|
|
if ($jabatan=="PIMPINAN") {
|
|
$update = [
|
|
'CON_FFP_P' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('form_feepelanggan', $update, 'ID_FFP', $id_ffp);
|
|
} else if ($jabatan=="KADIV KEUANGAN") {
|
|
$update = [
|
|
'CON_FFP_K' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('form_feepelanggan', $update, 'ID_FFP', $id_ffp);
|
|
}
|
|
|
|
$cekFfp = $this->Amod->getData_FormFeePelanggan_byID_bySTATUS($id_ffp, 0);
|
|
if ($cekFfp[0]['CON_FFP_P']!=NULL AND $cekFfp[0]['CON_FFP_K']!=NULL AND $cekFfp[0]['JENIS_FFP']==2) {
|
|
$datHhbfe = $this->Amod->getData_HasilHitungBfe_byPENJUALAN($cekFfp[0]['PENJUALAN_ID']);
|
|
if ($datHhbfe[0]['KREDIT_HHBFE']==$cekFfp[0]['NILAI_FFP'] AND $datHhbfe[0]['DEBET_HHBFE']==0) {
|
|
$datHhpda = $this->Amod->getData_HasilHitungPda_byPENJUALAN($cekFfp[0]['PENJUALAN_ID']);
|
|
if (($datHhpda[0]['DEBET_HHPDA']-$datHhpda[0]['KREDIT_HHPDA'])==$cekFfp[0]['NILAI_FFP']) {
|
|
$kode_akuntansi = $this->Amod->generate_kodeJurnalMemo();
|
|
$input = [
|
|
'CIPTA_AKUNTANSI' => "Oleh Sistem pada $timestamp",
|
|
'TGL_AKUNTANSI' => $now,
|
|
'KODE_AKUNTANSI' => $kode_akuntansi,
|
|
'STATUS_AKUNTANSI' => '0',
|
|
];
|
|
$action = $this->Amod->create('akuntansi', $input);
|
|
|
|
$id_akuntansi = $this->Amod->getMax_ID_Akuntansi();
|
|
$id_akuntansi = $id_akuntansi[0]['ID_AKUNTANSI'];
|
|
|
|
$kode_ffp = $cekFfp[0]['KODE_FFP'];
|
|
$namaPel = $cekFfp[0]['NAMA_PELANGGAN'];
|
|
$invPenjualan = $cekFfp[0]['INV_PENJUALAN'];
|
|
|
|
$input = [
|
|
'AKUNTANSI_ID' => $id_akuntansi,
|
|
'PERKIRAAN_ID' => '64',
|
|
'CIPTA_DAK' => "Oleh Sistem pada $timestamp",
|
|
'JENIS_DAK' => '2',
|
|
'DEBET_DAK' => $cekFfp[0]['NILAI_FFP'],
|
|
'KREDIT_DAK' => '0',
|
|
'KET_DAK' => "FEE $kode_ffp - $namaPel - $invPenjualan",
|
|
'PENJUALAN_ID' => $cekFfp[0]['PENJUALAN_ID'],
|
|
'PELANGGAN_ID' => $datHhpda[0]['PELANGGAN_ID'],
|
|
];
|
|
$action = $this->Amod->create('daftar_akuntansi', $input);
|
|
|
|
$input = [
|
|
'AKUNTANSI_ID' => $id_akuntansi,
|
|
'PERKIRAAN_ID' => '3',
|
|
'CIPTA_DAK' => "Oleh Sistem pada $timestamp",
|
|
'JENIS_DAK' => '2',
|
|
'JENIS_PDA' => '1',
|
|
'DEBET_DAK' => '0',
|
|
'KREDIT_DAK' => $cekFfp[0]['NILAI_FFP'],
|
|
'KET_DAK' => "FEE $kode_ffp - $namaPel - $invPenjualan",
|
|
'PENJUALAN_ID' => $cekFfp[0]['PENJUALAN_ID'],
|
|
'PELANGGAN_ID' => $datHhpda[0]['PELANGGAN_ID'],
|
|
];
|
|
$action = $this->Amod->create('daftar_akuntansi', $input);
|
|
|
|
$this->GE_Kalkulasi_HasilHitungPda("Nilai KREDIT Tambah Kasbank", $cekFfp[0]['PENJUALAN_ID'], $cekFfp[0]['NILAI_FFP'], $kode_akuntansi);
|
|
|
|
$update = [
|
|
'DEBET_HHBFE' => $cekFfp[0]['NILAI_FFP'],
|
|
'STATUS_HHBFE' => '1',
|
|
'LAST_HHBFE' => $timestamp,
|
|
'TGLLOCK_HHBFE' => $now,
|
|
'LUNAS_HHBFE' => $kode_akuntansi
|
|
];
|
|
$action = $this->Amod->update('hasil_hitungbfe', $update, 'ID_HHBFE', $datHhbfe[0]['ID_HHBFE']);
|
|
|
|
$update = [
|
|
'STATUS_FFP' => '1'
|
|
];
|
|
$action = $this->Amod->update('form_feepelanggan', $update, 'ID_FFP', $id_ffp);
|
|
}
|
|
}
|
|
}
|
|
|
|
$value = 1;
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value
|
|
]);
|
|
}
|
|
|
|
public function DA_Batal_DataFormFeePelanggan() {
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$id_ffp = $this->input->post('id_ffp');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$value = 0;
|
|
$datFfp = $this->Amod->getData_FormFeePelanggan_byID_bySTATUS($id_ffp, 0);
|
|
if ($datFfp==FALSE) {
|
|
$value = 2;
|
|
} else {
|
|
$update = [
|
|
'BATAL_FFP' => "Oleh $panggilan pada $timestamp",
|
|
'STATUS_FFP' => '2',
|
|
'SOVOID_FFP' => $datFfp[0]['KODE_SO'],
|
|
'PENJUALAN_ID' => NULL
|
|
];
|
|
$action = $this->Amod->update('form_feepelanggan', $update, 'ID_FFP', $id_ffp);
|
|
$value = 1;
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value
|
|
]);
|
|
}
|
|
|
|
//SUBMENU Cek Absensi
|
|
public function DA_Sub0_Absensi_1() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$datKaryawan = $this->Amod->getData_Karyawan_status1_syncNULL_orderPANGGILAN();
|
|
|
|
$data = array(
|
|
'sidebar' => "dashboard",
|
|
'navChild' => "",
|
|
'tgl' => date('Y-m-d'),
|
|
'jam_masuk' => date('H:i'),
|
|
'id_karyawan' => $id_karyawan,
|
|
'karyawan' => $datKaryawan,
|
|
);
|
|
$this->load->view('proses/DA_Sub0_Absensi_1', $data);
|
|
}
|
|
|
|
public function DA_Ambil_Sub0_DataAbsensi() {
|
|
$now = date('Y-m-d');
|
|
|
|
$data = $this->Amod->getData_Karyawan_status1_syncNULL_orderPANGGILAN();
|
|
$no = 0;
|
|
foreach ($data as $key) {
|
|
$datAbsensi = $this->Amod->getData_Absensi_byKARYAWAN_byTGL($key['ID_KARYAWAN'], $now);
|
|
if ($datAbsensi==FALSE) {
|
|
$stat = "TIDAK ABSEN";
|
|
$masuk = "";
|
|
$keluar = "";
|
|
$lokasi = "";
|
|
$pulang = "";
|
|
$link = "";
|
|
} else {
|
|
$link = "";
|
|
if ($datAbsensi[0]['STATUS_ABSENSI']==1) {
|
|
$stat = "ONTIME";
|
|
if ($datAbsensi[0]['FK_ID']!=NULL) {
|
|
$link = "Izin";
|
|
}
|
|
} else if ($datAbsensi[0]['STATUS_ABSENSI']==2) {
|
|
$stat = "TERLAMBAT";
|
|
if ($datAbsensi[0]['FK_ID']!=NULL) {
|
|
$link = "Izin";
|
|
}
|
|
} else if ($datAbsensi[0]['STATUS_ABSENSI']==3) {
|
|
$stat = "CUTI";
|
|
} else if ($datAbsensi[0]['STATUS_ABSENSI']==4) {
|
|
$stat = "SAKIT";
|
|
}
|
|
$masuk = $datAbsensi[0]['JAM_MASUK'];
|
|
$keluar = $datAbsensi[0]['JAM_KELUAR'];
|
|
$lokasi = $datAbsensi[0]['LOKASI_ABSENSI'];
|
|
$pulang = $datAbsensi[0]['PULANG_ABSENSI'];
|
|
}
|
|
|
|
$data[$no] += ['LINK' => $link];
|
|
$data[$no] += ['LOKASI' => $lokasi];
|
|
$data[$no] += ['PULANG' => $pulang];
|
|
$data[$no] += ['STAT' => $stat];
|
|
$data[$no] += ['KELUAR' => $keluar];
|
|
$data[$no++] += ['MASUK' => $masuk];
|
|
}
|
|
|
|
$this->output_json([
|
|
'total' => sizeof($data),
|
|
'data' => $data
|
|
]);
|
|
}
|
|
|
|
public function DA_Ambil_Sub0_DataCuti() {
|
|
$data = $this->Amod->getData_Absensi_status3_groupKARYAWAN();
|
|
|
|
$no = 0;
|
|
foreach ($data as $key) {
|
|
$datAbsensi = $this->Amod->getData_Absensi_byKARYAWAN_moreNow($key['KARYAWAN_ID']);
|
|
|
|
$data[$no] += ['ABSEN' => $datAbsensi];
|
|
$data[$no++] += ['COAB' => count($datAbsensi)];
|
|
}
|
|
$this->output_json([
|
|
'total' => sizeof($data),
|
|
'data' => $data
|
|
]);
|
|
}
|
|
|
|
public function DA_Ambil_Sub0_DataIzin() {
|
|
$data = $this->Amod->getData_FormKaryawan_byJENIS_bySTATUS_allAcc(7, 0);
|
|
|
|
$this->output_json([
|
|
'total' => sizeof($data),
|
|
'data' => $data
|
|
]);
|
|
}
|
|
|
|
public function DA_Tambah_Sub0_DataAbsensi() {
|
|
$tgl_absensi = $this->input->post('tgl_absensi');
|
|
$id_karyawan = $this->input->post('id_karyawan');
|
|
$status_absensi = $this->input->post('status_absensi');
|
|
$jam_masuk = $this->input->post('jam_masuk');
|
|
|
|
$value = 0;
|
|
$datAbsensi = $this->Amod->getData_Absensi_byKARYAWAN_byTGL($id_karyawan, $tgl_absensi);
|
|
if ($datAbsensi==TRUE) {
|
|
$value = 2;
|
|
} else {
|
|
$input = [
|
|
'KARYAWAN_ID' => $id_karyawan,
|
|
'TGL_ABSENSI' => $tgl_absensi,
|
|
'JAM_MASUK' => $jam_masuk,
|
|
'STATUS_ABSENSI' => $status_absensi
|
|
];
|
|
$action = $this->Amod->create('absensi', $input);
|
|
|
|
$value = 1;
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value
|
|
]);
|
|
}
|
|
|
|
//SUBMENU Cek User yang sedang aktif
|
|
public function DA_Sub0_HistoriAktif_1() {
|
|
$tgl = date('d/m/Y');
|
|
|
|
$data = array(
|
|
'sidebar' => "dashboard",
|
|
'navChild' => "",
|
|
'tgl' => $tgl,
|
|
);
|
|
$this->load->view('proses/DA_Sub0_HistoriAktif_1', $data);
|
|
}
|
|
|
|
public function DA_Ambil_Sub0_JumlahLogin() {
|
|
$data = $this->Amod->getData_HistoriAktifTerakhir_checkNow();
|
|
|
|
$this->output_json(['value' => 1, 'jumlah_data' => sizeof($data)]);
|
|
}
|
|
|
|
public function DA_Ambil_Sub0_DataLogin() {
|
|
$data = $this->Amod->getData_HistoriAktifTerakhir_checkNow();
|
|
$this->output_json(['value' => 1, 'total' => sizeof($data), 'data' => $data]);
|
|
}
|
|
|
|
//SUBMENU Cek Omzet Sales
|
|
public function DA_Sub0_TotalNota_1($id_karyawan, $id_pkpi) {
|
|
$datPkpi = $this->Amod->getData_PeriodeKpi_byID($id_pkpi);
|
|
if ($datPkpi==TRUE) {
|
|
$awal = $datPkpi[0]['AWAL_PKPI'];
|
|
$akhir = $datPkpi[0]['AKHIR_PKPI'];
|
|
} else {
|
|
$awal = date('Y-01-01');
|
|
$akhir = date('Y-12-31');
|
|
}
|
|
|
|
$datKaryawan = $this->Amod->getData_Karyawan_byID($id_karyawan);
|
|
$datSales = $this->Amod->getData_Karyawan_allSales();
|
|
$listPkpi = $this->Amod->getData_PeriodeKpi_tahunIni_orderDESC();
|
|
|
|
if ($id_karyawan==1) {
|
|
$id_karyawan = NULL;
|
|
$nama = "Semua Sales";
|
|
} else {
|
|
$nama = $datKaryawan[0]['NAMA_PANGGILAN_KARYAWAN'];
|
|
}
|
|
$datSo = $this->Amod->getData_SalesOrder_bySALES_byPERIODE($id_karyawan, $awal, $akhir);
|
|
$no = 0;
|
|
$countSelesai = 0;
|
|
$countProses = 0;
|
|
$countBatal = 0;
|
|
foreach ($datSo as $key) {
|
|
if ($key['STATUS_SO']==1) {
|
|
$datQc = $this->Amod->getData_QualityControl_bySO($key['ID_SO']);
|
|
$datJp = $this->Amod->getData_JadwalPengiriman_bySO($key['ID_SO']);
|
|
$datSo[$no] += ['QC' => $datQc];
|
|
$datSo[$no++] += ['JP' => $datJp];
|
|
|
|
$countSelesai++;
|
|
} else {
|
|
if ($key['STATUS_SO']==5 OR $key['STATUS_SO']==9) {
|
|
$countBatal++;
|
|
} else {
|
|
$countProses++;
|
|
}
|
|
$no++;
|
|
}
|
|
}
|
|
|
|
$data = array(
|
|
'sidebar' => "dashboard",
|
|
'navChild' => "",
|
|
'pkpi' => $listPkpi,
|
|
'so' => $datSo,
|
|
'sales' => $datSales,
|
|
'nama' => $nama,
|
|
'countSelesai' => $countSelesai,
|
|
'countProses' => $countProses,
|
|
'countBatal' => $countBatal,
|
|
'id_sales' => $id_karyawan,
|
|
'id_pkpi' => $id_pkpi,
|
|
);
|
|
$this->load->view('proses/DA_Sub0_TotalNota_1', $data);
|
|
}
|
|
|
|
public function DA_Sub0_TotalNilai_1($id_karyawan, $id_pkpi) {
|
|
$datPkpi = $this->Amod->getData_PeriodeKpi_byID($id_pkpi);
|
|
if ($datPkpi==TRUE) {
|
|
$awal = $datPkpi[0]['AWAL_PKPI'];
|
|
$akhir = $datPkpi[0]['AKHIR_PKPI'];
|
|
} else {
|
|
$awal = date('Y-01-01');
|
|
$akhir = date('Y-12-31');
|
|
}
|
|
|
|
$datKaryawan = $this->Amod->getData_Karyawan_byID($id_karyawan);
|
|
$datSales = $this->Amod->getData_Karyawan_allSales();
|
|
$listPkpi = $this->Amod->getData_PeriodeKpi_tahunIni_orderDESC();
|
|
|
|
if ($id_karyawan==1) {
|
|
$nama = "Semua Sales";
|
|
} else {
|
|
$nama = $datKaryawan[0]['NAMA_PANGGILAN_KARYAWAN'];
|
|
}
|
|
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_bySALES_BrutoOnly($id_karyawan, $awal, $akhir);
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_bySALES_BrutoOnly($id_karyawan, $awal, $akhir);
|
|
if ($sumDak==FALSE OR $sumDak[0]['TOTAL']==NULL) {
|
|
$nilaiDak = 0;
|
|
} else {
|
|
$nilaiDak = $sumDak[0]['TOTAL'];
|
|
}
|
|
|
|
$data = array(
|
|
'sidebar' => "dashboard",
|
|
'navChild' => "",
|
|
'dak' => $datDak,
|
|
'pkpi' => $listPkpi,
|
|
'sales' => $datSales,
|
|
'nama' => $nama,
|
|
'id_sales' => $id_karyawan,
|
|
'id_pkpi' => $id_pkpi,
|
|
'nilaiDak' => number_format($nilaiDak,2),
|
|
);
|
|
$this->load->view('proses/DA_Sub0_TotalNilai_1', $data);
|
|
}
|
|
|
|
public function DA_Sub0_TotalRetur_1($id_karyawan, $id_pkpi) {
|
|
$datPkpi = $this->Amod->getData_PeriodeKpi_byID($id_pkpi);
|
|
if ($datPkpi==TRUE) {
|
|
$awal = $datPkpi[0]['AWAL_PKPI'];
|
|
$akhir = $datPkpi[0]['AKHIR_PKPI'];
|
|
} else {
|
|
$awal = date('Y-01-01');
|
|
$akhir = date('Y-12-31');
|
|
}
|
|
|
|
$datKaryawan = $this->Amod->getData_Karyawan_byID($id_karyawan);
|
|
$datSales = $this->Amod->getData_Karyawan_allSales();
|
|
$listPkpi = $this->Amod->getData_PeriodeKpi_tahunIni_orderDESC();
|
|
|
|
if ($id_karyawan==1) {
|
|
$nama = "Semua Sales";
|
|
} else {
|
|
$nama = $datKaryawan[0]['NAMA_PANGGILAN_KARYAWAN'];
|
|
}
|
|
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_bySALES_ReturOnly($id_karyawan, $awal, $akhir);
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_bySALES_ReturOnly($id_karyawan, $awal, $akhir);
|
|
if ($sumDak==FALSE OR $sumDak[0]['TOTAL']==NULL) {
|
|
$nilaiDak = 0;
|
|
} else {
|
|
$nilaiDak = $sumDak[0]['TOTAL'];
|
|
}
|
|
|
|
$data = array(
|
|
'sidebar' => "dashboard",
|
|
'navChild' => "",
|
|
'dak' => $datDak,
|
|
'pkpi' => $listPkpi,
|
|
'sales' => $datSales,
|
|
'nama' => $nama,
|
|
'id_sales' => $id_karyawan,
|
|
'id_pkpi' => $id_pkpi,
|
|
'nilaiDak' => number_format($nilaiDak,2),
|
|
);
|
|
$this->load->view('proses/DA_Sub0_TotalRetur_1', $data);
|
|
}
|
|
|
|
public function DA_Sub0_TotalTerbayar_1($id_karyawan, $id_pkpi) {
|
|
$datPkpi = $this->Amod->getData_PeriodeKpi_byID($id_pkpi);
|
|
if ($datPkpi==TRUE) {
|
|
$awal = $datPkpi[0]['AWAL_PKPI'];
|
|
$akhir = $datPkpi[0]['AKHIR_PKPI'];
|
|
} else {
|
|
$awal = date('Y-01-01');
|
|
$akhir = date('Y-12-31');
|
|
}
|
|
|
|
$datKaryawan = $this->Amod->getData_Karyawan_byID($id_karyawan);
|
|
$datSales = $this->Amod->getData_Karyawan_allSales();
|
|
$listPkpi = $this->Amod->getData_PeriodeKpi_tahunIni_orderDESC();
|
|
|
|
if ($id_karyawan==1) {
|
|
$nama = "Semua Sales";
|
|
} else {
|
|
$nama = $datKaryawan[0]['NAMA_PANGGILAN_KARYAWAN'];
|
|
}
|
|
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_bySALES_TerbayarOnly($id_karyawan, $awal, $akhir);
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_bySALES_TerbayarOnly($id_karyawan, $awal, $akhir);
|
|
if ($sumDak==FALSE OR $sumDak[0]['TOTAL']==NULL) {
|
|
$nilaiDak = 0;
|
|
} else {
|
|
$nilaiDak = $sumDak[0]['TOTAL'];
|
|
}
|
|
|
|
$data = array(
|
|
'sidebar' => "dashboard",
|
|
'navChild' => "",
|
|
'dak' => $datDak,
|
|
'pkpi' => $listPkpi,
|
|
'sales' => $datSales,
|
|
'nama' => $nama,
|
|
'id_sales' => $id_karyawan,
|
|
'id_pkpi' => $id_pkpi,
|
|
'nilaiDak' => number_format($nilaiDak,2),
|
|
);
|
|
$this->load->view('proses/DA_Sub0_TotalTerbayar_1', $data);
|
|
}
|
|
|
|
public function DA_Sub0_TotalBelum_1($id_karyawan, $id_pkpi) {
|
|
$datPkpi = $this->Amod->getData_PeriodeKpi_byID($id_pkpi);
|
|
if ($datPkpi==TRUE) {
|
|
$awal = $datPkpi[0]['AWAL_PKPI'];
|
|
$akhir = $datPkpi[0]['AKHIR_PKPI'];
|
|
} else {
|
|
$awal = date('Y-01-01');
|
|
$akhir = date('Y-12-31');
|
|
}
|
|
|
|
$datKaryawan = $this->Amod->getData_Karyawan_byID($id_karyawan);
|
|
$datSales = $this->Amod->getData_Karyawan_allSales();
|
|
$listPkpi = $this->Amod->getData_PeriodeKpi_tahunIni_orderDESC();
|
|
|
|
if ($id_karyawan==1) {
|
|
$nama = "Semua Sales";
|
|
} else {
|
|
$nama = $datKaryawan[0]['NAMA_PANGGILAN_KARYAWAN'];
|
|
}
|
|
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_bySALES_BelumLunasOnly($id_karyawan, $awal, $akhir);
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_bySALES_BelumLunasOnly($id_karyawan, $awal, $akhir);
|
|
if ($sumDak==FALSE OR $sumDak[0]['TOTAL']==NULL) {
|
|
$nilaiDak = 0;
|
|
} else {
|
|
$nilaiDak = $sumDak[0]['TOTAL'];
|
|
}
|
|
|
|
$data = array(
|
|
'sidebar' => "dashboard",
|
|
'navChild' => "",
|
|
'dak' => $datDak,
|
|
'pkpi' => $listPkpi,
|
|
'sales' => $datSales,
|
|
'nama' => $nama,
|
|
'id_sales' => $id_karyawan,
|
|
'id_pkpi' => $id_pkpi,
|
|
'nilaiDak' => number_format($nilaiDak,2),
|
|
);
|
|
$this->load->view('proses/DA_Sub0_TotalBelum_1', $data);
|
|
}
|
|
|
|
public function DA_Sub0_TotalTertinggal_1($id_karyawan) {
|
|
$datKaryawan = $this->Amod->getData_Karyawan_byID($id_karyawan);
|
|
$datSales = $this->Amod->getData_Karyawan_allSales();
|
|
|
|
if ($id_karyawan==1) {
|
|
$nama = "Semua Sales";
|
|
} else {
|
|
$nama = $datKaryawan[0]['NAMA_PANGGILAN_KARYAWAN'];
|
|
}
|
|
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_bySALES_TahunBeforeOnly($id_karyawan);
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_bySALES_TahunBeforeOnly($id_karyawan);
|
|
if ($sumDak==FALSE OR $sumDak[0]['TOTAL']==NULL) {
|
|
$nilaiDak = 0;
|
|
} else {
|
|
$nilaiDak = $sumDak[0]['TOTAL'];
|
|
}
|
|
|
|
$data = array(
|
|
'sidebar' => "dashboard",
|
|
'navChild' => "",
|
|
'dak' => $datDak,
|
|
'sales' => $datSales,
|
|
'nama' => $nama,
|
|
'id_sales' => $id_karyawan,
|
|
'nilaiDak' => number_format($nilaiDak,2),
|
|
);
|
|
$this->load->view('proses/DA_Sub0_TotalTertinggal_1', $data);
|
|
}
|
|
|
|
public function DA_Sub2_KpiOmzet_1($id=null) {
|
|
if ($id==1) {
|
|
$id_karyawan = NULL;
|
|
$nama = "Semua Sales";
|
|
} else {
|
|
if ($id==null) {
|
|
$jabatan = $this->session->userdata('jabatan');
|
|
if (strpos($jabatan,"ADMINISTRATOR")!==FALSE OR strpos($jabatan,"KADIV SALES")!==FALSE OR strpos($jabatan,"PIMPINAN")!==FALSE) {
|
|
$id_karyawan = NULL;
|
|
$nama = "Semua Sales";
|
|
} else {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$datKaryawan = $this->Amod->getData_Karyawan_byID($id_karyawan);
|
|
$nama = $datKaryawan[0]['NAMA_PANGGILAN_KARYAWAN'];
|
|
}
|
|
} else {
|
|
$id_karyawan = $id;
|
|
$datKaryawan = $this->Amod->getData_Karyawan_byID($id_karyawan);
|
|
$nama = $datKaryawan[0]['NAMA_PANGGILAN_KARYAWAN'];
|
|
}
|
|
}
|
|
|
|
$limit = date('Y-m-01');
|
|
$monthNow = strtoupper($this->Amod->generate_inisialMonth(date('m')));
|
|
|
|
$datHhpda = $this->Amod->getData_HasilHitungPda_byKARYAWAN_byPERIODE_status1($id_karyawan, $limit);
|
|
$omzet = 0;
|
|
$no = 0;
|
|
foreach ($datHhpda as $key) {
|
|
$datDo = $this->Amod->getData_DaftarOrder_bySO($key['SO_ID']);
|
|
$barang = "";
|
|
foreach ($datDo as $dat) {
|
|
$kode_barang = $dat['KODE_BARANG'];
|
|
$qty_do = $dat['QTY_DO'];
|
|
$barang .= "<b style='color:Olive'>[$qty_do EA]</b> $kode_barang<br>";
|
|
}
|
|
$datHhpda[$no++] += ['BARANG' => $barang];
|
|
|
|
$omzet = $omzet+$key['DEBET_HHPDA'];
|
|
}
|
|
|
|
$datSales = $this->Amod->getData_Karyawan_allSalesKpi();
|
|
|
|
$data = array(
|
|
'sidebar' => "dashboard",
|
|
'navChild' => "",
|
|
'hhpda' => $datHhpda,
|
|
'omzet' => number_format($omzet,2),
|
|
'sales' => $datSales,
|
|
'nama' => $nama,
|
|
'id_sales' => $id_karyawan,
|
|
'monthNow' => $monthNow,
|
|
);
|
|
$this->load->view('proses/DA_Sub2_KpiOmzet_1', $data);
|
|
}
|
|
|
|
public function DA_Sub2_KpiPenawaran_1($id=null) {
|
|
if ($id==1) {
|
|
$id_karyawan = NULL;
|
|
$nama = "Semua Sales";
|
|
} else {
|
|
if ($id==null) {
|
|
$jabatan = $this->session->userdata('jabatan');
|
|
if (strpos($jabatan,"ADMINISTRATOR")!==FALSE OR strpos($jabatan,"KADIV SALES")!==FALSE OR strpos($jabatan,"PIMPINAN")!==FALSE) {
|
|
$id_karyawan = NULL;
|
|
$nama = "Semua Sales";
|
|
} else {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$datKaryawan = $this->Amod->getData_Karyawan_byID($id_karyawan);
|
|
$nama = $datKaryawan[0]['NAMA_PANGGILAN_KARYAWAN'];
|
|
$jabatan = $datKaryawan[0]['NAMA_JABATAN'];
|
|
}
|
|
} else {
|
|
$id_karyawan = $id;
|
|
$datKaryawan = $this->Amod->getData_Karyawan_byID($id_karyawan);
|
|
$nama = $datKaryawan[0]['NAMA_PANGGILAN_KARYAWAN'];
|
|
$jabatan = $datKaryawan[0]['NAMA_JABATAN'];
|
|
}
|
|
}
|
|
|
|
$limit = date('Y-m-01');
|
|
$now = date('Y-m-d');
|
|
$monthNow = strtoupper($this->Amod->generate_inisialMonth(date('m')));
|
|
|
|
$datPenawaran = $this->Amod->getData_Penawaran_byPERIODE_statusAktif($limit, $now);
|
|
$totPenawaran = 0;
|
|
$no = 0;
|
|
foreach ($datPenawaran as $key) {
|
|
$salesChannel = "";
|
|
$salesOther = "";
|
|
$sales_penawaran = $key['SALES_PENAWARAN'];
|
|
$listSales = explode(',', $sales_penawaran);
|
|
foreach ($listSales as $dat) {
|
|
$datKaryawan = $this->Amod->getData_Karyawan_byID($dat);
|
|
$panggil = $datKaryawan[0]['NAMA_PANGGILAN_KARYAWAN'];
|
|
if (strpos($datKaryawan[0]['NAMA_JABATAN'],"CHANNEL")!==FALSE OR $panggil=="Anton") {
|
|
$salesChannel .= "$panggil, ";
|
|
} else {
|
|
$salesOther .= "$panggil, ";
|
|
}
|
|
}
|
|
if ($salesChannel!="") {
|
|
$salesChannel = substr($salesChannel, 0, -2);
|
|
}
|
|
if ($salesOther!="") {
|
|
$salesOther = substr($salesOther, 0, -2);
|
|
}
|
|
|
|
if ($id_karyawan!=NULL) {
|
|
if (strpos($salesChannel,$nama)!==FALSE OR strpos($salesOther,$nama)!==FALSE) {
|
|
$show = 1;
|
|
if ($jabatan=="SALES CHANNEL" OR $nama=="Anton") {
|
|
$totPenawaran = $totPenawaran+round($key['NILAI_PENAWARAN'],2);
|
|
} else if (sizeof($listSales)==1) {
|
|
$totPenawaran = $totPenawaran+round($key['NILAI_PENAWARAN'],2);
|
|
} else {
|
|
$ambilDpne = $this->Amod->getSum_DaftarPenawaran_byPENAWARAN_byVERSI_bySALES($key['ID_PENAWARAN'], $key['AKTIF_PENAWARAN'], $id_karyawan);
|
|
if ($ambilDpne==FALSE OR $ambilDpne[0]['TOTAL']==NULL) {
|
|
$show = 0;
|
|
} else {
|
|
$totPenawaran = $totPenawaran+round($ambilDpne[0]['TOTAL'],2);
|
|
}
|
|
}
|
|
} else {
|
|
$show = 0;
|
|
}
|
|
} else {
|
|
$show = 1;
|
|
$totPenawaran = $totPenawaran+round($key['NILAI_PENAWARAN'],2);
|
|
}
|
|
|
|
$sumDpne = $this->Amod->getSum_DaftarPenawaran_byPENAWARAN_byVERSI_groupSALES($key['ID_PENAWARAN'], $key['AKTIF_PENAWARAN']);
|
|
|
|
$datPenawaran[$no] += ['KLAIM' => $sumDpne];
|
|
$datPenawaran[$no] += ['SHOW' => $show];
|
|
$datPenawaran[$no] += ['CHANNEL' => $salesChannel];
|
|
$datPenawaran[$no++] += ['OTHER' => $salesOther];
|
|
}
|
|
|
|
$datSales = $this->Amod->getData_Karyawan_allSalesKpi();
|
|
|
|
$data = array(
|
|
'sidebar' => "dashboard",
|
|
'navChild' => "",
|
|
'penawaran' => $datPenawaran,
|
|
'totPenawaran' => number_format($totPenawaran, 2),
|
|
'sales' => $datSales,
|
|
'nama' => $nama,
|
|
'id_sales' => $id_karyawan,
|
|
'monthNow' => $monthNow,
|
|
);
|
|
$this->load->view('proses/DA_Sub2_KpiPenawaran_1', $data);
|
|
}
|
|
|
|
public function DA_Sub2_KpiVisit_1($id=null) {
|
|
if ($id==1) {
|
|
$id_karyawan = NULL;
|
|
$nama = "Semua Sales";
|
|
} else {
|
|
if ($id==null) {
|
|
$jabatan = $this->session->userdata('jabatan');
|
|
if (strpos($jabatan,"ADMINISTRATOR")!==FALSE OR strpos($jabatan,"KADIV SALES")!==FALSE OR strpos($jabatan,"PIMPINAN")!==FALSE) {
|
|
$id_karyawan = NULL;
|
|
$nama = "Semua Sales";
|
|
} else {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$datKaryawan = $this->Amod->getData_Karyawan_byID($id_karyawan);
|
|
$nama = $datKaryawan[0]['NAMA_PANGGILAN_KARYAWAN'];
|
|
}
|
|
} else {
|
|
$id_karyawan = $id;
|
|
$datKaryawan = $this->Amod->getData_Karyawan_byID($id_karyawan);
|
|
$nama = $datKaryawan[0]['NAMA_PANGGILAN_KARYAWAN'];
|
|
}
|
|
}
|
|
|
|
$limit = date('Y-m-01');
|
|
$atas = $this->Amod->generate_addMonth($limit, 1);
|
|
$atas = $this->Amod->generate_subDay($atas, 1);
|
|
$monthNow = strtoupper($this->Amod->generate_inisialMonth(date('m')));
|
|
|
|
$datKunjungan = $this->Amod->getData_Kunjungan_byPERIODE_statusNot9($limit, $atas);
|
|
if ($id_karyawan==NULL) {
|
|
$visit = count($datKunjungan);
|
|
$no = 0;
|
|
$me = 1;
|
|
foreach ($datKunjungan as $key) {
|
|
$listSales = explode(',', $key['SALES_KUNJUNGAN']);
|
|
$nosal = 1;
|
|
$nasal = "";
|
|
foreach ($listSales as $dat) {
|
|
$datKaryawan = $this->Amod->getData_Karyawan_byID($dat);
|
|
$nama_panggilan = $datKaryawan[0]['NAMA_PANGGILAN_KARYAWAN'];
|
|
|
|
if ($nosal==count($listSales)) {
|
|
$nasal .= "$nama_panggilan";
|
|
} else {
|
|
$nasal .= "$nama_panggilan, ";
|
|
$nosal++;
|
|
}
|
|
}
|
|
$datKunjungan[$no] += ['ME' => $me];
|
|
$datKunjungan[$no++] += ['SALES' => $nasal];
|
|
}
|
|
} else {
|
|
$visit = 0;
|
|
$no = 0;
|
|
foreach ($datKunjungan as $key) {
|
|
$me = 0;
|
|
$nosal = 1;
|
|
$nasal = "";
|
|
$listSales = explode(',', $key['SALES_KUNJUNGAN']);
|
|
foreach ($listSales as $dat) {
|
|
if ($dat==$id_karyawan) {
|
|
$visit++;
|
|
$me++;
|
|
}
|
|
$datKaryawan = $this->Amod->getData_Karyawan_byID($dat);
|
|
$nama_panggilan = $datKaryawan[0]['NAMA_PANGGILAN_KARYAWAN'];
|
|
|
|
if ($nosal==count($listSales)) {
|
|
$nasal .= "$nama_panggilan";
|
|
} else {
|
|
$nasal .= "$nama_panggilan, ";
|
|
$nosal++;
|
|
}
|
|
}
|
|
$datKunjungan[$no] += ['ME' => $me];
|
|
$datKunjungan[$no++] += ['SALES' => $nasal];
|
|
}
|
|
}
|
|
|
|
$datSales = $this->Amod->getData_Karyawan_allSalesKpi();
|
|
|
|
$data = array(
|
|
'sidebar' => "dashboard",
|
|
'navChild' => "",
|
|
'kunjungan' => $datKunjungan,
|
|
'visit' => $visit,
|
|
'sales' => $datSales,
|
|
'nama' => $nama,
|
|
'id_sales' => $id_karyawan,
|
|
'monthNow' => $monthNow,
|
|
);
|
|
$this->load->view('proses/DA_Sub2_KpiVisit_1', $data);
|
|
}
|
|
|
|
public function DA_Sub2_KpiNb_1($id=null) {
|
|
if ($id==1) {
|
|
$id_karyawan = NULL;
|
|
$nama = "Semua Sales";
|
|
} else {
|
|
if ($id==null) {
|
|
$jabatan = $this->session->userdata('jabatan');
|
|
if (strpos($jabatan,"ADMINISTRATOR")!==FALSE OR strpos($jabatan,"KADIV SALES")!==FALSE OR strpos($jabatan,"PIMPINAN")!==FALSE) {
|
|
$id_karyawan = NULL;
|
|
$nama = "Semua Sales";
|
|
} else {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$datKaryawan = $this->Amod->getData_Karyawan_byID($id_karyawan);
|
|
$nama = $datKaryawan[0]['NAMA_PANGGILAN_KARYAWAN'];
|
|
}
|
|
} else {
|
|
$id_karyawan = $id;
|
|
$datKaryawan = $this->Amod->getData_Karyawan_byID($id_karyawan);
|
|
$nama = $datKaryawan[0]['NAMA_PANGGILAN_KARYAWAN'];
|
|
}
|
|
}
|
|
|
|
$limit = date('Y-m-01');
|
|
$monthNow = strtoupper($this->Amod->generate_inisialMonth(date('m')));
|
|
$datSales = $this->Amod->getData_Karyawan_allSalesKpi();
|
|
|
|
$datDpc = $this->Amod->getData_DaftarPromoClearance_bySALES_byPERIODE_byJENIS($id_karyawan, $limit, 2);
|
|
$omzet = 0;
|
|
$no = 0;
|
|
foreach ($datDpc as $key) {
|
|
$omzet = $omzet+round(($key['HARGA_DO']*$key['QTY_DO'])*(($key['PPN_SO']+100)/100),2);
|
|
}
|
|
|
|
$data = array(
|
|
'sidebar' => "dashboard",
|
|
'navChild' => "",
|
|
'dpc' => $datDpc,
|
|
'omzet' => number_format($omzet,2),
|
|
'sales' => $datSales,
|
|
'nama' => $nama,
|
|
'id_sales' => $id_karyawan,
|
|
'monthNow' => $monthNow,
|
|
);
|
|
$this->load->view('proses/DA_Sub2_KpiNb_1', $data);
|
|
}
|
|
|
|
public function DA_Sub2_KpiAio_1($id=null) {
|
|
if ($id==1) {
|
|
$id_karyawan = NULL;
|
|
$nama = "Semua Sales";
|
|
} else {
|
|
if ($id==null) {
|
|
$jabatan = $this->session->userdata('jabatan');
|
|
if (strpos($jabatan,"ADMINISTRATOR")!==FALSE OR strpos($jabatan,"KADIV SALES")!==FALSE OR strpos($jabatan,"PIMPINAN")!==FALSE) {
|
|
$id_karyawan = NULL;
|
|
$nama = "Semua Sales";
|
|
} else {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$datKaryawan = $this->Amod->getData_Karyawan_byID($id_karyawan);
|
|
$nama = $datKaryawan[0]['NAMA_PANGGILAN_KARYAWAN'];
|
|
}
|
|
} else {
|
|
$id_karyawan = $id;
|
|
$datKaryawan = $this->Amod->getData_Karyawan_byID($id_karyawan);
|
|
$nama = $datKaryawan[0]['NAMA_PANGGILAN_KARYAWAN'];
|
|
}
|
|
}
|
|
|
|
$limit = date('Y-m-01');
|
|
$monthNow = strtoupper($this->Amod->generate_inisialMonth(date('m')));
|
|
$datSales = $this->Amod->getData_Karyawan_allSalesKpi();
|
|
|
|
$datDpc = $this->Amod->getData_DaftarPromoClearance_bySALES_byPERIODE_byJENIS($id_karyawan, $limit, 3);
|
|
$omzet = 0;
|
|
$no = 0;
|
|
foreach ($datDpc as $key) {
|
|
$omzet = $omzet+round(($key['HARGA_DO']*$key['QTY_DO'])*(($key['PPN_SO']+100)/100),2);
|
|
}
|
|
|
|
$data = array(
|
|
'sidebar' => "dashboard",
|
|
'navChild' => "",
|
|
'dpc' => $datDpc,
|
|
'omzet' => number_format($omzet,2),
|
|
'sales' => $datSales,
|
|
'nama' => $nama,
|
|
'id_sales' => $id_karyawan,
|
|
'monthNow' => $monthNow,
|
|
);
|
|
$this->load->view('proses/DA_Sub2_KpiAio_1', $data);
|
|
}
|
|
|
|
public function DA_Sub3_AbsensiKaryawan_1() {
|
|
$datKaryawan = $this->Amod->getData_Karyawan_forAkuntansi();
|
|
$now = date('Y-m-d');
|
|
$datPab = $this->Amod->getData_PeriodeAbsensi_byTGL($now);
|
|
|
|
$data = array(
|
|
'sidebar' => "dashboard",
|
|
'navChild' => "",
|
|
'tgl_awal' => $datPab[0]['AWAL_PAB'],
|
|
'tgl_akhir' => $datPab[0]['AKHIR_PAB'],
|
|
'karyawan' => $datKaryawan,
|
|
);
|
|
$this->load->view('proses/DA_Sub3_AbsensiKaryawan_1', $data);
|
|
}
|
|
|
|
public function DA_Sub3_AbsensiKaryawan_2() {
|
|
$now = date('Y-m-d');
|
|
|
|
$datPab = $this->Amod->getData_PeriodeAbsensi();
|
|
$cekPab = $this->Amod->getData_PeriodeAbsensi_byTGL($now);
|
|
|
|
$data = [
|
|
'sidebar' => "dashboard",
|
|
'navChild' => "",
|
|
'pab' => $datPab,
|
|
'id_pab' => $cekPab[0]['ID_PAB']
|
|
];
|
|
$this->load->view('proses/DA_Sub3_AbsensiKaryawan_2', $data);
|
|
}
|
|
|
|
public function DA_Sub3_AbsensiKaryawan_3($id_karyawan=null) {
|
|
$awal = date('Y-01-01');
|
|
$akhir = date('Y-12-31');
|
|
|
|
if ($id_karyawan==0) {
|
|
$title = "Semua Karyawan";
|
|
} else {
|
|
$dataKaryawan = $this->Amod->getData_Karyawan_byID($id_karyawan);
|
|
$nama_panggilan = $dataKaryawan[0]['NAMA_PANGGILAN_KARYAWAN'];
|
|
$title = "$nama_panggilan";
|
|
}
|
|
|
|
$datAbsensi = $this->Amod->getData_Absensi_byKARYAWAN_bySTATUS_byPERIODE($id_karyawan, 3, $awal, $akhir);
|
|
$datKaryawan = $this->Amod->getData_Karyawan_forAbsensi();
|
|
|
|
$data = [
|
|
'sidebar' => "dashboard",
|
|
'navChild' => "",
|
|
'absensi' => $datAbsensi,
|
|
'karyawan' => $datKaryawan,
|
|
'id_karyawan' => $id_karyawan,
|
|
'title' => $title
|
|
];
|
|
$this->load->view('proses/DA_Sub3_AbsensiKaryawan_3', $data);
|
|
}
|
|
|
|
public function DA_Excel_Sub3_DataRekapAbsensi() {
|
|
$id_pab = $this->input->post('id_pabfill');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$datPab = $this->Amod->getData_PeriodeAbsensi($id_pab);
|
|
$awal = $datPab[0]['AWAL_PAB'];
|
|
$akhir = $datPab[0]['AKHIR_PAB'];
|
|
|
|
$datKaryawan = $this->Amod->getData_Karyawan_forAbsensi();
|
|
$no = 0;
|
|
$datLaporan = [];
|
|
foreach ($datKaryawan as $key) {
|
|
$diffawal = new DateTime($awal);
|
|
$diffakhir = new DateTime($akhir);
|
|
$diff = date_diff($diffawal, $diffakhir);
|
|
$diff = $diff->format("%a");
|
|
|
|
$tgl_check = $awal;
|
|
$absensi = [];
|
|
$noi = 0;
|
|
$count8 = 0;
|
|
for ($i=0; $i<=$diff; $i++) {
|
|
//Cek Bukan Hari Minggu
|
|
$day_check = date_format(date_create($tgl_check), "l");
|
|
|
|
//Cek Bukan Hari Libur
|
|
$datShl = $this->Amod->getData_SetHariLibur_byTGL($tgl_check);
|
|
|
|
if ($day_check=="Sunday") {
|
|
$tgl_check = $this->Amod->generate_addDay($tgl_check, 1);
|
|
} else if (strtotime($tgl_check)>=strtotime($awal) AND strtotime($tgl_check)<=strtotime($akhir) AND $datShl==FALSE) {
|
|
$datAbsensi = $this->Amod->getData_Absensi_byKARYAWAN_byTGL($key['ID_KARYAWAN'], $tgl_check);
|
|
if ($datAbsensi==NULL) {
|
|
$absensi[$noi++] = [
|
|
'TGL' => $tgl_check,
|
|
'TANGGAL' => date_format(date_create($tgl_check), "d-M"),
|
|
'LIBUR' => '0',
|
|
'TELAT' => '8',
|
|
];
|
|
$tgl_check = $this->Amod->generate_addDay($tgl_check, 1);
|
|
|
|
$count8++;
|
|
} else {
|
|
$absensi[$noi++] = [
|
|
'TGL' => $tgl_check,
|
|
'TANGGAL' => date_format(date_create($tgl_check), "d-M"),
|
|
'LIBUR' => '0',
|
|
'TELAT' => $datAbsensi[0]['STATUS_ABSENSI'],
|
|
];
|
|
$tgl_check = $this->Amod->generate_addDay($tgl_check, 1);
|
|
}
|
|
} else if (strtotime($tgl_check)>=strtotime($awal) AND strtotime($tgl_check)<=strtotime($akhir) AND $datShl==TRUE) {
|
|
$absensi[$noi++] = [
|
|
'TGL' => $tgl_check,
|
|
'TANGGAL' => date_format(date_create($tgl_check), "d-M"),
|
|
'LIBUR' => '1',
|
|
'TELAT' => '9',
|
|
];
|
|
$tgl_check = $this->Amod->generate_addDay($tgl_check, 1);
|
|
}
|
|
}
|
|
|
|
$count2 = $this->Amod->getCount_Absensi_byKARYAWAN_bySTATUS($key['ID_KARYAWAN'], $awal, $akhir, 2);
|
|
$count3 = $this->Amod->getCount_Absensi_byKARYAWAN_bySTATUS($key['ID_KARYAWAN'], $awal, $akhir, 3);
|
|
$count4 = $this->Amod->getCount_Absensi_byKARYAWAN_bySTATUS($key['ID_KARYAWAN'], $awal, $akhir, 4);
|
|
|
|
$datLaporan[$no++] = [
|
|
'NAMAKAR' => $key['NAMA_PANGGILAN_KARYAWAN'],
|
|
'REKAPALL' => $absensi,
|
|
'COUNT2' => $count2,
|
|
'COUNT3' => $count3,
|
|
'COUNT4' => $count4,
|
|
'COUNT8' => $count8
|
|
];
|
|
}
|
|
|
|
$data = [
|
|
'awal' => $datPab[0]['AWAL'],
|
|
'akhir' => $datPab[0]['AKHIR'],
|
|
'nama_pab' => $datPab[0]['NAMA_PAB'],
|
|
'diff' => count($absensi),
|
|
'laporan' => $datLaporan,
|
|
'karyawan' => $datKaryawan,
|
|
'ts' => $timestamp,
|
|
];
|
|
$this->load->view('cetak/DA_Excel_Sub3_DataRekapAbsensi', $data);
|
|
}
|
|
|
|
public function DA_Ambil_Sub3_A1_DataAbsensi() {
|
|
$id_karyawan = $this->input->post('id_karyawan');
|
|
$awal = $this->input->post('awal');
|
|
$akhir = $this->input->post('akhir');
|
|
|
|
$diffawal = new DateTime($awal);
|
|
$diffakhir = new DateTime($akhir);
|
|
$diff = date_diff($diffawal, $diffakhir);
|
|
$diff = $diff->format("%a");
|
|
$tgl_check = $awal;
|
|
$noab = 0;
|
|
$count8 = 0;
|
|
$count9 = 0;
|
|
$absensi = [];
|
|
for ($i=0; $i<=$diff; $i++) {
|
|
//Cek Bukan Hari Minggu
|
|
$day_check = date_format(date_create($tgl_check), "l");
|
|
$hari = $this->Amod->generate_inisialDay($day_check);
|
|
|
|
//Cek Bukan Hari Libur
|
|
$datShl = $this->Amod->getData_SetHariLibur_byTGL($tgl_check);
|
|
|
|
if ($day_check=="Sunday") {
|
|
$tgl_check = $this->Amod->generate_addDay($tgl_check, 1);
|
|
} else if (strtotime($tgl_check)>=strtotime($awal) AND strtotime($tgl_check)<=strtotime($akhir) AND $datShl==FALSE) {
|
|
$datAbsensi = $this->Amod->getData_Absensi_byKARYAWAN_byTGL($id_karyawan, $tgl_check);
|
|
if ($datAbsensi==NULL) {
|
|
$absensi[$noab++] = [
|
|
'LOKASI' => NULL,
|
|
'HARI' => $hari,
|
|
'TANGGAL' => date_format(date_create($tgl_check), "d/m/Y"),
|
|
'MASUK' => NULL,
|
|
'STATUS' => '8',
|
|
];
|
|
$tgl_check = $this->Amod->generate_addDay($tgl_check, 1);
|
|
|
|
$count8++;
|
|
} else {
|
|
$absensi[$noab++] = [
|
|
'LOKASI' => $datAbsensi[0]['LOKASI_ABSENSI'],
|
|
'HARI' => $hari,
|
|
'TANGGAL' => date_format(date_create($tgl_check), "d/m/Y"),
|
|
'MASUK' => $datAbsensi[0]['JAM_MASUK'],
|
|
'STATUS' => $datAbsensi[0]['STATUS_ABSENSI'],
|
|
];
|
|
$tgl_check = $this->Amod->generate_addDay($tgl_check, 1);
|
|
}
|
|
} else if (strtotime($tgl_check)>=strtotime($awal) AND strtotime($tgl_check)<=strtotime($akhir) AND $datShl==TRUE) {
|
|
$absensi[$noab++] = [
|
|
'LOKASI' => NULL,
|
|
'HARI' => $hari,
|
|
'TANGGAL' => date_format(date_create($tgl_check), "d/m/Y"),
|
|
'MASUK' => $datShl[0]['NAMA_SHL'],
|
|
'STATUS' => '9',
|
|
];
|
|
$tgl_check = $this->Amod->generate_addDay($tgl_check, 1);
|
|
|
|
$count9++;
|
|
}
|
|
}
|
|
|
|
$count1 = $this->Amod->getCount_Absensi_byKARYAWAN_bySTATUS($id_karyawan, $awal, $akhir, 1);
|
|
$count2 = $this->Amod->getCount_Absensi_byKARYAWAN_bySTATUS($id_karyawan, $awal, $akhir, 2);
|
|
$count3 = $this->Amod->getCount_Absensi_byKARYAWAN_bySTATUS($id_karyawan, $awal, $akhir, 3);
|
|
$count4 = $this->Amod->getCount_Absensi_byKARYAWAN_bySTATUS($id_karyawan, $awal, $akhir, 4);
|
|
$count5 = $this->Amod->getCount_Absensi_byKARYAWAN_bySTATUS($id_karyawan, $awal, $akhir, 5);
|
|
|
|
$this->output_json([
|
|
'data' => $absensi,
|
|
'total' => count($absensi),
|
|
'count1' => $count1,
|
|
'count2' => $count2,
|
|
'count3' => $count3,
|
|
'count4' => $count4,
|
|
'count5' => $count5,
|
|
'count8' => $count8,
|
|
'count9' => $count9
|
|
]);
|
|
}
|
|
|
|
public function DA_Ubah_Sub3_A1_DataAbsensi() {
|
|
$id_absensi = $this->input->post('id_absensied');
|
|
$ket_absensi = $this->input->post('ket_absensied');
|
|
$ket_absensi = ltrim(rtrim(preg_replace('/\R+/', " " , $ket_absensi)));
|
|
|
|
$update = [
|
|
'KET_ABSENSI' => $ket_absensi
|
|
];
|
|
$action = $this->Amod->update('absensi', $update, 'ID_ABSENSI', $id_absensi);
|
|
|
|
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 DA_Ubah_Sub3_DataKaryawan() {
|
|
$method = $this->input->post('method');
|
|
$password = $this->input->post('passwordBaru');
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
|
|
$update = [
|
|
'PASSWORD' => $password
|
|
];
|
|
$action = $this->Amod->update('karyawan', $update, 'ID_KARYAWAN', $id_karyawan);
|
|
|
|
$this->session->sess_destroy();
|
|
redirect('Login');
|
|
}
|
|
|
|
public function DA_Proses_Sub3_DataNeraca() {
|
|
$datPak = $this->Amod->getData_PeriodeAkuntansi_status0();
|
|
$id_pak = $datPak[0]['ID_PAK'];
|
|
$nama_pak = $datPak[0]['NAMA_PAK'];
|
|
$awal = $datPak[0]['AWAL_PAK'];
|
|
$limit = $datPak[0]['AKHIR_PAK'];
|
|
$akhir = date_format(date_create($limit), "d/m/Y");
|
|
$kodeJs = date_format(date_create($limit), "y/m");
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = "$akhir 18:00:00";
|
|
|
|
$datPembelian = $this->Amod->getData_Pembelian_byPERIODE_bySTATUS($awal, $limit, 0);
|
|
if ($datPembelian==TRUE) {
|
|
$this->session->set_flashdata('pembelian_notfinished', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$datAkuntansi = $this->Amod->getData_Akuntansi_byPERIODE_bySTATUS($awal, $limit, 0);
|
|
if ($datAkuntansi==TRUE) {
|
|
$this->session->set_flashdata('akuntansi_notfinished', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
//Hapus semua Transaksi Gudang yang belum diproses ke Admin
|
|
$datPembelianNull = $this->Amod->getData_Pembelian_byPERIODE_statusNull($awal, $limit);
|
|
$newTs = date('d/m/Y H:i:s');
|
|
foreach ($datPembelianNull as $key) {
|
|
$datDb = $this->Amod->getData_DaftarBeli_byPEMBELIAN($key['ID_PEMBELIAN']);
|
|
foreach ($datDb as $dat) {
|
|
$action = $this->Amod->delete('sn_beli', $dat['ID_DB'], 'DB_ID');
|
|
}
|
|
|
|
$action = $this->Amod->delete('daftar_beli', $key['ID_PEMBELIAN'], 'PEMBELIAN_ID');
|
|
|
|
$update = [
|
|
'SJ_PEMBELIAN' => NULL,
|
|
'STATUS_PEMBELIAN' => '9',
|
|
'REVISI_PEMBELIAN' => "Oleh $panggilan pada $newTs"
|
|
];
|
|
$action = $this->Amod->update('pembelian', $update, 'ID_PEMBELIAN', $key['ID_PEMBELIAN']);
|
|
}
|
|
|
|
//Ubah Semua yang selesai Proses menjadi Status 2
|
|
$datAkuntansiSelesai = $this->Amod->getData_Akuntansi_bySTATUS_byPERIODE_groupID_forProsesNeraca(1, $awal, $limit);
|
|
foreach ($datAkuntansiSelesai as $key) {
|
|
$update = [
|
|
'STATUS_AKUNTANSI' => '2'
|
|
];
|
|
$action = $this->Amod->update('akuntansi', $update, 'ID_AKUNTANSI', $key['ID_AKUNTANSI']);
|
|
}
|
|
|
|
$input = [
|
|
'CIPTA_AKUNTANSI' => "Oleh $panggilan pada $timestamp",
|
|
'TGL_AKUNTANSI' => $limit,
|
|
'KODE_AKUNTANSI' => "JS/$kodeJs/00004",
|
|
'STATUS_AKUNTANSI' => '2'
|
|
];
|
|
$action = $this->Amod->create('akuntansi', $input);
|
|
|
|
$id_akuntansi = $this->Amod->getMax_ID_Akuntansi();
|
|
$id_akuntansi = $id_akuntansi[0]['ID_AKUNTANSI'];
|
|
|
|
//Hitung Persediaan di Periode ini
|
|
$datHq = $this->Amod->getSum_HistoriKuantiti_groupBARANG_beforeTGL_morethan0($limit);
|
|
$subtotal = 0;
|
|
foreach ($datHq as $key) {
|
|
$cekHq = $this->Amod->getData_HistoriKuantiti_byBARANG_beforeTGL_orderDESC_limit1($key['BARANG_ID'], $limit);
|
|
$subtotal = round(($subtotal+$cekHq[0]['PERSEDIAAN_HQ']),2);
|
|
}
|
|
|
|
$datDak = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(4, NULL, $limit);
|
|
if ($datDak[0]['DEBET']==NULL OR $datDak[0]['KREDIT']==NULL) {
|
|
$nilaiLama = 0;
|
|
} else {
|
|
$nilaiLama = $datDak[0]['DEBET']-$datDak[0]['KREDIT'];
|
|
}
|
|
|
|
if ($subtotal==$nilaiLama) {
|
|
$debet_dak = 0;
|
|
$kredit_dak = 0;
|
|
} else if ($subtotal!=$nilaiLama) {
|
|
$debet_dak = $subtotal-$nilaiLama;
|
|
$kredit_dak = 0;
|
|
}
|
|
|
|
$input = [
|
|
'AKUNTANSI_ID' => $id_akuntansi,
|
|
'PERKIRAAN_ID' => '4',
|
|
'CIPTA_DAK' => "Oleh $panggilan pada $timestamp",
|
|
'JENIS_DAK' => '0',
|
|
'DEBET_DAK' => $debet_dak,
|
|
'KREDIT_DAK' => $kredit_dak,
|
|
'KET_DAK' => "Jurnal Sistem u/ Perkiraan [1140 | Persediaan | $nama_pak]",
|
|
'PAK_ID' => $id_pak,
|
|
];
|
|
$action = $this->Amod->create('daftar_akuntansi', $input);
|
|
|
|
$input = [
|
|
'AKUNTANSI_ID' => $id_akuntansi,
|
|
'PERKIRAAN_ID' => '30',
|
|
'CIPTA_DAK' => "Oleh $panggilan pada $timestamp",
|
|
'JENIS_DAK' => '0',
|
|
'DEBET_DAK' => $debet_dak,
|
|
'KREDIT_DAK' => $kredit_dak,
|
|
'KET_DAK' => "Jurnal Sistem u/ Perkiraan [5130 | Persediaan Akhir | $nama_pak]",
|
|
'PAK_ID' => $id_pak,
|
|
];
|
|
$action = $this->Amod->create('daftar_akuntansi', $input);
|
|
|
|
$datDak01 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(1, NULL, $limit);
|
|
$datDak02 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(2, NULL, $limit);
|
|
$datDak03 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(3, NULL, $limit);
|
|
$datDak04 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(4, NULL, $limit);
|
|
$datDak05 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(5, NULL, $limit);
|
|
$datDak06 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(6, NULL, $limit);
|
|
$datDak07 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(7, NULL, $limit);
|
|
$datDak08 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(8, NULL, $limit);
|
|
$datDak82 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(82, NULL, $limit);
|
|
$datDak09 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(9, NULL, $limit);
|
|
$datDak10 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(10, NULL, $limit);
|
|
$datDak11 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(11, NULL, $limit);
|
|
$datDak12 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(12, NULL, $limit);
|
|
$datDak13 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(13, NULL, $limit);
|
|
$datDak14 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(14, NULL, $limit);
|
|
$datDak15 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(15, NULL, $limit);
|
|
$datDak16 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(16, NULL, $limit);
|
|
$datDak17 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(17, NULL, $limit);
|
|
$datDak18 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(18, NULL, $limit);
|
|
$datDak19 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(19, NULL, $limit);
|
|
$datDak83 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(83, NULL, $limit);
|
|
$datDak20 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(20, NULL, $limit);
|
|
$datDak21 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(21, NULL, $limit);
|
|
$datDak22 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(22, NULL, $limit);
|
|
$datDak23 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(23, $awal, $limit);
|
|
$datDak24 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(24, $awal, $limit);
|
|
$datDak25 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(25, $awal, $limit);
|
|
$datDak26 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(26, NULL, $limit);
|
|
$datDak27 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(27, $awal, $limit);
|
|
$datDak28 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(28, $awal, $limit);
|
|
$datDak29 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(29, $awal, $limit);
|
|
$datDak30 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(30, NULL, $limit);
|
|
$datDak31 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(31, $awal, $limit);
|
|
$datDak32 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(32, $awal, $limit);
|
|
$datDak33 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(33, $awal, $limit);
|
|
$datDak34 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(34, $awal, $limit);
|
|
$datDak35 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(35, $awal, $limit);
|
|
$datDak36 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(36, $awal, $limit);
|
|
$datDak37 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(37, $awal, $limit);
|
|
$datDak38 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(38, $awal, $limit);
|
|
$datDak39 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(39, $awal, $limit);
|
|
$datDak40 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(40, $awal, $limit);
|
|
$datDak41 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(41, $awal, $limit);
|
|
$datDak42 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(42, $awal, $limit);
|
|
$datDak43 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(43, $awal, $limit);
|
|
$datDak44 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(44, $awal, $limit);
|
|
$datDak45 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(45, $awal, $limit);
|
|
$datDak46 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(46, $awal, $limit);
|
|
$datDak47 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(47, $awal, $limit);
|
|
$datDak48 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(48, $awal, $limit);
|
|
$datDak49 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(49, $awal, $limit);
|
|
$datDak50 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(50, $awal, $limit);
|
|
$datDak51 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(51, $awal, $limit);
|
|
$datDak52 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(52, $awal, $limit);
|
|
$datDak53 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(53, $awal, $limit);
|
|
$datDak54 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(54, $awal, $limit);
|
|
$datDak55 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(55, $awal, $limit);
|
|
$datDak56 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(56, $awal, $limit);
|
|
$datDak57 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(57, $awal, $limit);
|
|
$datDak58 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(58, $awal, $limit);
|
|
$datDak59 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(59, $awal, $limit);
|
|
$datDak60 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(60, $awal, $limit);
|
|
$datDak61 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(61, $awal, $limit);
|
|
$datDak62 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(62, $awal, $limit);
|
|
$datDak63 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(63, $awal, $limit);
|
|
$datDak64 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(64, $awal, $limit);
|
|
$datDak65 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(65, $awal, $limit);
|
|
$datDak66 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(66, $awal, $limit);
|
|
$datDak67 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(67, $awal, $limit);
|
|
$datDak68 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(68, $awal, $limit);
|
|
$datDak69 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(69, $awal, $limit);
|
|
$datDak70 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(70, $awal, $limit);
|
|
$datDak71 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(71, $awal, $limit);
|
|
$datDak72 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(72, $awal, $limit);
|
|
$datDak73 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(73, $awal, $limit);
|
|
$datDak74 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(74, $awal, $limit);
|
|
$datDak75 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(75, $awal, $limit);
|
|
$datDak76 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(76, $awal, $limit);
|
|
$datDak77 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(77, $awal, $limit);
|
|
$datDak78 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(78, $awal, $limit);
|
|
$datDak79 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(79, $awal, $limit);
|
|
$datDak80 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(80, $awal, $limit);
|
|
$datDak86 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(86, $awal, $limit);
|
|
$datDak87 = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPERIODE(87, $awal, $limit);
|
|
|
|
if ($datDak01[0]['DEBET']==NULL OR $datDak01[0]['KREDIT']==NULL) { $al01 = 0; } else { $al01 = $datDak01[0]['DEBET']-$datDak01[0]['KREDIT']; }
|
|
if ($datDak02[0]['DEBET']==NULL OR $datDak02[0]['KREDIT']==NULL) { $al02 = 0; } else { $al02 = $datDak02[0]['DEBET']-$datDak02[0]['KREDIT']; }
|
|
if ($datDak03[0]['DEBET']==NULL OR $datDak03[0]['KREDIT']==NULL) { $al03 = 0; } else { $al03 = $datDak03[0]['DEBET']-$datDak03[0]['KREDIT']; }
|
|
if ($datDak04[0]['DEBET']==NULL OR $datDak04[0]['KREDIT']==NULL) { $al04 = 0; } else { $al04 = $datDak04[0]['DEBET']-$datDak04[0]['KREDIT']; }
|
|
if ($datDak05[0]['DEBET']==NULL OR $datDak05[0]['KREDIT']==NULL) { $al05 = 0; } else { $al05 = $datDak05[0]['DEBET']-$datDak05[0]['KREDIT']; }
|
|
if ($datDak06[0]['DEBET']==NULL OR $datDak06[0]['KREDIT']==NULL) { $al06 = 0; } else { $al06 = $datDak06[0]['DEBET']-$datDak06[0]['KREDIT']; }
|
|
if ($datDak07[0]['DEBET']==NULL OR $datDak07[0]['KREDIT']==NULL) { $al07 = 0; } else { $al07 = $datDak07[0]['DEBET']-$datDak07[0]['KREDIT']; }
|
|
if ($datDak08[0]['DEBET']==NULL OR $datDak08[0]['KREDIT']==NULL) { $al08 = 0; } else { $al08 = $datDak08[0]['DEBET']-$datDak08[0]['KREDIT']; }
|
|
if ($datDak82[0]['DEBET']==NULL OR $datDak82[0]['KREDIT']==NULL) { $al09 = 0; } else { $al09 = $datDak82[0]['DEBET']-$datDak82[0]['KREDIT']; }
|
|
if ($datDak15[0]['DEBET']==NULL OR $datDak15[0]['KREDIT']==NULL) { $kl01 = 0; } else { $kl01 = $datDak15[0]['KREDIT']-$datDak15[0]['DEBET']; }
|
|
if ($datDak16[0]['DEBET']==NULL OR $datDak16[0]['KREDIT']==NULL) { $kl02 = 0; } else { $kl02 = $datDak16[0]['KREDIT']-$datDak16[0]['DEBET']; }
|
|
if ($datDak17[0]['DEBET']==NULL OR $datDak17[0]['KREDIT']==NULL) { $kl03 = 0; } else { $kl03 = $datDak17[0]['KREDIT']-$datDak17[0]['DEBET']; }
|
|
if ($datDak18[0]['DEBET']==NULL OR $datDak18[0]['KREDIT']==NULL) { $kl04 = 0; } else { $kl04 = $datDak18[0]['KREDIT']-$datDak18[0]['DEBET']; }
|
|
if ($datDak19[0]['DEBET']==NULL OR $datDak19[0]['KREDIT']==NULL) { $kl05 = 0; } else { $kl05 = $datDak19[0]['KREDIT']-$datDak19[0]['DEBET']; }
|
|
if ($datDak83[0]['DEBET']==NULL OR $datDak83[0]['KREDIT']==NULL) { $kl06 = 0; } else { $kl06 = $datDak83[0]['KREDIT']-$datDak83[0]['DEBET']; }
|
|
if ($datDak09[0]['DEBET']==NULL OR $datDak09[0]['KREDIT']==NULL) { $inventaris1 = 0; } else { $inventaris1 = ($datDak09[0]['DEBET']-$datDak09[0]['KREDIT']); }
|
|
if ($datDak10[0]['DEBET']==NULL OR $datDak10[0]['KREDIT']==NULL) { $inventaris2 = 0; } else { $inventaris2 = ($datDak10[0]['KREDIT']-$datDak10[0]['DEBET']); }
|
|
if ($datDak11[0]['DEBET']==NULL OR $datDak11[0]['KREDIT']==NULL) { $gedung1 = 0; } else { $gedung1 = ($datDak11[0]['DEBET']-$datDak11[0]['KREDIT']); }
|
|
if ($datDak12[0]['DEBET']==NULL OR $datDak12[0]['KREDIT']==NULL) { $gedung2 = 0; } else { $gedung2 = ($datDak12[0]['KREDIT']-$datDak12[0]['DEBET']); }
|
|
if ($datDak13[0]['DEBET']==NULL OR $datDak13[0]['KREDIT']==NULL) { $kendaraan1 = 0; } else { $kendaraan1 = ($datDak13[0]['DEBET']-$datDak13[0]['KREDIT']); }
|
|
if ($datDak14[0]['DEBET']==NULL OR $datDak14[0]['KREDIT']==NULL) { $kendaraan2 = 0; } else { $kendaraan2 = ($datDak14[0]['KREDIT']-$datDak14[0]['DEBET']); }
|
|
if ($datDak20[0]['DEBET']==NULL OR $datDak20[0]['KREDIT']==NULL) { $mo01 = 0; } else { $mo01 = $datDak20[0]['KREDIT']-$datDak20[0]['DEBET']; }
|
|
if ($datDak21[0]['DEBET']==NULL OR $datDak21[0]['KREDIT']==NULL) { $mo02 = 0; } else { $mo02 = $datDak21[0]['KREDIT']-$datDak21[0]['DEBET']; }
|
|
|
|
if ($al09==$kl06) {
|
|
$sisaPm = 0;
|
|
$sisaPk = 0;
|
|
} else if ($al09<$kl06) {
|
|
$sisaPm = 0;
|
|
$sisaPk = $kl06-$al09;
|
|
} else if ($kl06<$al09) {
|
|
$sisaPk = 0;
|
|
$sisaPm = $al09-$kl06;
|
|
}
|
|
|
|
$al09 = $sisaPm;
|
|
$at01 = $inventaris1-$inventaris2;
|
|
$at02 = $gedung1-$gedung2;
|
|
$at03 = $kendaraan1-$kendaraan2;
|
|
$kl06 = $sisaPk;
|
|
|
|
//Modal
|
|
if ($datDak22[0]['DEBET']==NULL OR $datDak22[0]['KREDIT']==NULL) { $mo03 = 0; } else { $mo03 = $datDak22[0]['KREDIT']-$datDak22[0]['DEBET']; }
|
|
|
|
//Total Penjualan
|
|
if ($datDak23[0]['DEBET']==NULL OR $datDak23[0]['KREDIT']==NULL) { $tp01 = 0; } else { $tp01 = $datDak23[0]['KREDIT']-$datDak23[0]['DEBET']; }
|
|
if ($datDak24[0]['DEBET']==NULL OR $datDak24[0]['KREDIT']==NULL) { $tp02 = 0; } else { $tp02 = $datDak24[0]['DEBET']-$datDak24[0]['KREDIT']; }
|
|
if ($datDak25[0]['DEBET']==NULL OR $datDak25[0]['KREDIT']==NULL) { $tp03 = 0; } else { $tp03 = $datDak25[0]['DEBET']-$datDak25[0]['KREDIT']; }
|
|
|
|
//Harga Pokok Penjualan
|
|
if ($datDak26[0]['DEBET']==NULL OR $datDak26[0]['KREDIT']==NULL) { $hpp01 = 0; } else { $hpp01 = $datDak26[0]['DEBET']-$datDak26[0]['KREDIT']; }
|
|
if ($datDak27[0]['DEBET']==NULL OR $datDak27[0]['KREDIT']==NULL) { $hpp02 = 0; } else { $hpp02 = $datDak27[0]['DEBET']-$datDak27[0]['KREDIT']; }
|
|
if ($datDak28[0]['DEBET']==NULL OR $datDak28[0]['KREDIT']==NULL) { $hpp03 = 0; } else { $hpp03 = $datDak28[0]['KREDIT']-$datDak28[0]['DEBET']; }
|
|
if ($datDak29[0]['DEBET']==NULL OR $datDak29[0]['KREDIT']==NULL) { $hpp04 = 0; } else { $hpp04 = $datDak29[0]['KREDIT']-$datDak29[0]['DEBET']; }
|
|
if ($datDak30[0]['DEBET']==NULL OR $datDak30[0]['KREDIT']==NULL) { $hpp05 = 0; } else { $hpp05 = $datDak30[0]['DEBET']-$datDak30[0]['KREDIT']; }
|
|
|
|
//Biaya Penjualan
|
|
if ($datDak31[0]['DEBET']==NULL OR $datDak31[0]['KREDIT']==NULL) { $bp01 = 0; } else { $bp01 = $datDak31[0]['DEBET']-$datDak31[0]['KREDIT']; }
|
|
if ($datDak32[0]['DEBET']==NULL OR $datDak32[0]['KREDIT']==NULL) { $bp02 = 0; } else { $bp02 = $datDak32[0]['DEBET']-$datDak32[0]['KREDIT']; }
|
|
if ($datDak33[0]['DEBET']==NULL OR $datDak33[0]['KREDIT']==NULL) { $bp03 = 0; } else { $bp03 = $datDak33[0]['DEBET']-$datDak33[0]['KREDIT']; }
|
|
if ($datDak34[0]['DEBET']==NULL OR $datDak34[0]['KREDIT']==NULL) { $bp04 = 0; } else { $bp04 = $datDak34[0]['DEBET']-$datDak34[0]['KREDIT']; }
|
|
if ($datDak35[0]['DEBET']==NULL OR $datDak35[0]['KREDIT']==NULL) { $bp05 = 0; } else { $bp05 = $datDak35[0]['DEBET']-$datDak35[0]['KREDIT']; }
|
|
if ($datDak36[0]['DEBET']==NULL OR $datDak36[0]['KREDIT']==NULL) { $bp06 = 0; } else { $bp06 = $datDak36[0]['DEBET']-$datDak36[0]['KREDIT']; }
|
|
if ($datDak37[0]['DEBET']==NULL OR $datDak37[0]['KREDIT']==NULL) { $bp07 = 0; } else { $bp07 = $datDak37[0]['DEBET']-$datDak37[0]['KREDIT']; }
|
|
|
|
//Biaya Umum & Administrasi
|
|
if ($datDak38[0]['DEBET']==NULL OR $datDak38[0]['KREDIT']==NULL) { $bua01 = 0; } else { $bua01 = $datDak38[0]['DEBET']-$datDak38[0]['KREDIT']; }
|
|
if ($datDak39[0]['DEBET']==NULL OR $datDak39[0]['KREDIT']==NULL) { $bua02 = 0; } else { $bua02 = $datDak39[0]['DEBET']-$datDak39[0]['KREDIT']; }
|
|
if ($datDak40[0]['DEBET']==NULL OR $datDak40[0]['KREDIT']==NULL) { $bua03 = 0; } else { $bua03 = $datDak40[0]['DEBET']-$datDak40[0]['KREDIT']; }
|
|
if ($datDak41[0]['DEBET']==NULL OR $datDak41[0]['KREDIT']==NULL) { $bua04 = 0; } else { $bua04 = $datDak41[0]['DEBET']-$datDak41[0]['KREDIT']; }
|
|
if ($datDak42[0]['DEBET']==NULL OR $datDak42[0]['KREDIT']==NULL) { $bua05 = 0; } else { $bua05 = $datDak42[0]['DEBET']-$datDak42[0]['KREDIT']; }
|
|
if ($datDak43[0]['DEBET']==NULL OR $datDak43[0]['KREDIT']==NULL) { $bua06 = 0; } else { $bua06 = $datDak43[0]['DEBET']-$datDak43[0]['KREDIT']; }
|
|
if ($datDak44[0]['DEBET']==NULL OR $datDak44[0]['KREDIT']==NULL) { $bua07 = 0; } else { $bua07 = $datDak44[0]['DEBET']-$datDak44[0]['KREDIT']; }
|
|
if ($datDak45[0]['DEBET']==NULL OR $datDak45[0]['KREDIT']==NULL) { $bua08 = 0; } else { $bua08 = $datDak45[0]['DEBET']-$datDak45[0]['KREDIT']; }
|
|
if ($datDak46[0]['DEBET']==NULL OR $datDak46[0]['KREDIT']==NULL) { $bua09 = 0; } else { $bua09 = $datDak46[0]['DEBET']-$datDak46[0]['KREDIT']; }
|
|
if ($datDak80[0]['DEBET']==NULL OR $datDak80[0]['KREDIT']==NULL) { $bua10 = 0; } else { $bua10 = $datDak80[0]['DEBET']-$datDak80[0]['KREDIT']; }
|
|
if ($datDak47[0]['DEBET']==NULL OR $datDak47[0]['KREDIT']==NULL) { $bua11 = 0; } else { $bua11 = $datDak47[0]['DEBET']-$datDak47[0]['KREDIT']; }
|
|
if ($datDak48[0]['DEBET']==NULL OR $datDak48[0]['KREDIT']==NULL) { $bua12 = 0; } else { $bua12 = $datDak48[0]['DEBET']-$datDak48[0]['KREDIT']; }
|
|
if ($datDak49[0]['DEBET']==NULL OR $datDak49[0]['KREDIT']==NULL) { $bua13 = 0; } else { $bua13 = $datDak49[0]['DEBET']-$datDak49[0]['KREDIT']; }
|
|
if ($datDak50[0]['DEBET']==NULL OR $datDak50[0]['KREDIT']==NULL) { $bua14 = 0; } else { $bua14 = $datDak50[0]['DEBET']-$datDak50[0]['KREDIT']; }
|
|
if ($datDak51[0]['DEBET']==NULL OR $datDak51[0]['KREDIT']==NULL) { $bua15 = 0; } else { $bua15 = $datDak51[0]['DEBET']-$datDak51[0]['KREDIT']; }
|
|
if ($datDak52[0]['DEBET']==NULL OR $datDak52[0]['KREDIT']==NULL) { $bua16 = 0; } else { $bua16 = $datDak52[0]['DEBET']-$datDak52[0]['KREDIT']; }
|
|
if ($datDak53[0]['DEBET']==NULL OR $datDak53[0]['KREDIT']==NULL) { $bua17 = 0; } else { $bua17 = $datDak53[0]['DEBET']-$datDak53[0]['KREDIT']; }
|
|
if ($datDak54[0]['DEBET']==NULL OR $datDak54[0]['KREDIT']==NULL) { $bua18 = 0; } else { $bua18 = $datDak54[0]['DEBET']-$datDak54[0]['KREDIT']; }
|
|
if ($datDak55[0]['DEBET']==NULL OR $datDak55[0]['KREDIT']==NULL) { $bua19 = 0; } else { $bua19 = $datDak55[0]['DEBET']-$datDak55[0]['KREDIT']; }
|
|
if ($datDak56[0]['DEBET']==NULL OR $datDak56[0]['KREDIT']==NULL) { $bua20 = 0; } else { $bua20 = $datDak56[0]['DEBET']-$datDak56[0]['KREDIT']; }
|
|
if ($datDak57[0]['DEBET']==NULL OR $datDak57[0]['KREDIT']==NULL) { $bua21 = 0; } else { $bua21 = $datDak57[0]['DEBET']-$datDak57[0]['KREDIT']; }
|
|
if ($datDak58[0]['DEBET']==NULL OR $datDak58[0]['KREDIT']==NULL) { $bua22 = 0; } else { $bua22 = $datDak58[0]['DEBET']-$datDak58[0]['KREDIT']; }
|
|
if ($datDak59[0]['DEBET']==NULL OR $datDak59[0]['KREDIT']==NULL) { $bua23 = 0; } else { $bua23 = $datDak59[0]['DEBET']-$datDak59[0]['KREDIT']; }
|
|
if ($datDak60[0]['DEBET']==NULL OR $datDak60[0]['KREDIT']==NULL) { $bua24 = 0; } else { $bua24 = $datDak60[0]['DEBET']-$datDak60[0]['KREDIT']; }
|
|
if ($datDak61[0]['DEBET']==NULL OR $datDak61[0]['KREDIT']==NULL) { $bua25 = 0; } else { $bua25 = $datDak61[0]['DEBET']-$datDak61[0]['KREDIT']; }
|
|
if ($datDak62[0]['DEBET']==NULL OR $datDak62[0]['KREDIT']==NULL) { $bua26 = 0; } else { $bua26 = $datDak62[0]['DEBET']-$datDak62[0]['KREDIT']; }
|
|
if ($datDak63[0]['DEBET']==NULL OR $datDak63[0]['KREDIT']==NULL) { $bua27 = 0; } else { $bua27 = $datDak63[0]['DEBET']-$datDak63[0]['KREDIT']; }
|
|
if ($datDak64[0]['DEBET']==NULL OR $datDak64[0]['KREDIT']==NULL) { $bua28 = 0; } else { $bua28 = $datDak64[0]['DEBET']-$datDak64[0]['KREDIT']; }
|
|
if ($datDak65[0]['DEBET']==NULL OR $datDak65[0]['KREDIT']==NULL) { $bua29 = 0; } else { $bua29 = $datDak65[0]['DEBET']-$datDak65[0]['KREDIT']; }
|
|
if ($datDak66[0]['DEBET']==NULL OR $datDak66[0]['KREDIT']==NULL) { $bua30 = 0; } else { $bua30 = $datDak66[0]['DEBET']-$datDak66[0]['KREDIT']; }
|
|
if ($datDak67[0]['DEBET']==NULL OR $datDak67[0]['KREDIT']==NULL) { $bua31 = 0; } else { $bua31 = $datDak67[0]['DEBET']-$datDak67[0]['KREDIT']; }
|
|
if ($datDak68[0]['DEBET']==NULL OR $datDak68[0]['KREDIT']==NULL) { $bua32 = 0; } else { $bua32 = $datDak68[0]['DEBET']-$datDak68[0]['KREDIT']; }
|
|
if ($datDak69[0]['DEBET']==NULL OR $datDak69[0]['KREDIT']==NULL) { $bua33 = 0; } else { $bua33 = $datDak69[0]['DEBET']-$datDak69[0]['KREDIT']; }
|
|
if ($datDak70[0]['DEBET']==NULL OR $datDak70[0]['KREDIT']==NULL) { $bua34 = 0; } else { $bua34 = $datDak70[0]['DEBET']-$datDak70[0]['KREDIT']; }
|
|
if ($datDak71[0]['DEBET']==NULL OR $datDak71[0]['KREDIT']==NULL) { $bua35 = 0; } else { $bua35 = $datDak71[0]['DEBET']-$datDak71[0]['KREDIT']; }
|
|
if ($datDak72[0]['DEBET']==NULL OR $datDak72[0]['KREDIT']==NULL) { $bua36 = 0; } else { $bua36 = $datDak72[0]['DEBET']-$datDak72[0]['KREDIT']; }
|
|
if ($datDak73[0]['DEBET']==NULL OR $datDak73[0]['KREDIT']==NULL) { $bua37 = 0; } else { $bua37 = $datDak73[0]['DEBET']-$datDak73[0]['KREDIT']; }
|
|
if ($datDak86[0]['DEBET']==NULL OR $datDak86[0]['KREDIT']==NULL) { $bua38 = 0; } else { $bua38 = $datDak86[0]['DEBET']-$datDak86[0]['KREDIT']; }
|
|
if ($datDak74[0]['DEBET']==NULL OR $datDak74[0]['KREDIT']==NULL) { $bua39 = 0; } else { $bua39 = $datDak74[0]['DEBET']-$datDak74[0]['KREDIT']; }
|
|
|
|
//Pendapatan & (Beban) Luar Usaha
|
|
if ($datDak75[0]['DEBET']==NULL OR $datDak75[0]['KREDIT']==NULL) { $plu01 = 0; } else { $plu01 = $datDak75[0]['KREDIT']-$datDak75[0]['DEBET']; }
|
|
if ($datDak76[0]['DEBET']==NULL OR $datDak76[0]['KREDIT']==NULL) { $plu02 = 0; } else { $plu02 = $datDak76[0]['KREDIT']-$datDak76[0]['DEBET']; }
|
|
if ($datDak77[0]['DEBET']==NULL OR $datDak77[0]['KREDIT']==NULL) { $plu03 = 0; } else { $plu03 = $datDak77[0]['DEBET']-$datDak77[0]['KREDIT']; }
|
|
if ($datDak78[0]['DEBET']==NULL OR $datDak78[0]['KREDIT']==NULL) { $plu04 = 0; } else { $plu04 = $datDak78[0]['DEBET']-$datDak78[0]['KREDIT']; }
|
|
if ($datDak87[0]['DEBET']==NULL OR $datDak87[0]['KREDIT']==NULL) { $plu05 = 0; } else { $plu05 = $datDak87[0]['DEBET']-$datDak87[0]['KREDIT']; }
|
|
|
|
//Pajak Penghasilan
|
|
if ($datDak79[0]['DEBET']==NULL OR $datDak79[0]['KREDIT']==NULL) { $pph01 = 0; } else { $pph01 = $datDak79[0]['DEBET']-$datDak79[0]['KREDIT']; }
|
|
|
|
$labaBersih = $tp01-$tp02-$tp03-$hpp01-$hpp02+$hpp03+$hpp04+$hpp05+$plu01+$plu02-$plu03-$plu04
|
|
-$plu05-$pph01-$bp01-$bp02-$bp03-$bp04-$bp05-$bp06-$bp07-$bua01-$bua02-$bua03
|
|
-$bua04-$bua05-$bua06-$bua07-$bua08-$bua09-$bua10-$bua11-$bua12-$bua13-$bua14-$bua15
|
|
-$bua16-$bua17-$bua18-$bua19-$bua20-$bua21-$bua22-$bua23-$bua24-$bua25-$bua26-$bua27
|
|
-$bua28-$bua29-$bua30-$bua31-$bua32-$bua33-$bua34-$bua35-$bua36-$bua37-$bua38-$bua39;
|
|
|
|
$labaTerakhir = round($labaBersih,2);
|
|
|
|
//Hasil Perhitungan Neraca Terakhir
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'PERKIRAAN_ID' => 1,
|
|
'NILAI_HNE' => $al01
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungneraca', $input);
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'PERKIRAAN_ID' => 2,
|
|
'NILAI_HNE' => $al02
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungneraca', $input);
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'PERKIRAAN_ID' => 3,
|
|
'NILAI_HNE' => $al03
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungneraca', $input);
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'PERKIRAAN_ID' => 4,
|
|
'NILAI_HNE' => $al04
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungneraca', $input);
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'PERKIRAAN_ID' => 5,
|
|
'NILAI_HNE' => $al05
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungneraca', $input);
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'PERKIRAAN_ID' => 6,
|
|
'NILAI_HNE' => $al06
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungneraca', $input);
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'PERKIRAAN_ID' => 7,
|
|
'NILAI_HNE' => $al07
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungneraca', $input);
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'PERKIRAAN_ID' => 8,
|
|
'NILAI_HNE' => $al08
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungneraca', $input);
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'PERKIRAAN_ID' => 82,
|
|
'NILAI_HNE' => $al09
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungneraca', $input);
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'PERKIRAAN_ID' => 9,
|
|
'NILAI_HNE' => $inventaris1
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungneraca', $input);
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'PERKIRAAN_ID' => 10,
|
|
'NILAI_HNE' => $inventaris2
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungneraca', $input);
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'PERKIRAAN_ID' => 11,
|
|
'NILAI_HNE' => $gedung1
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungneraca', $input);
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'PERKIRAAN_ID' => 12,
|
|
'NILAI_HNE' => $gedung2
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungneraca', $input);
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'PERKIRAAN_ID' => 13,
|
|
'NILAI_HNE' => $kendaraan1
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungneraca', $input);
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'PERKIRAAN_ID' => 14,
|
|
'NILAI_HNE' => $kendaraan2
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungneraca', $input);
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'PERKIRAAN_ID' => 15,
|
|
'NILAI_HNE' => $kl01
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungneraca', $input);
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'PERKIRAAN_ID' => 16,
|
|
'NILAI_HNE' => $kl02
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungneraca', $input);
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'PERKIRAAN_ID' => 17,
|
|
'NILAI_HNE' => $kl03
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungneraca', $input);
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'PERKIRAAN_ID' => 18,
|
|
'NILAI_HNE' => $kl04
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungneraca', $input);
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'PERKIRAAN_ID' => 19,
|
|
'NILAI_HNE' => $kl05
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungneraca', $input);
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'PERKIRAAN_ID' => 83,
|
|
'NILAI_HNE' => $kl06
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungneraca', $input);
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'PERKIRAAN_ID' => 20,
|
|
'NILAI_HNE' => $mo01
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungneraca', $input);
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'PERKIRAAN_ID' => 21,
|
|
'NILAI_HNE' => $mo02
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungneraca', $input);
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'PERKIRAAN_ID' => 22,
|
|
'NILAI_HNE' => $labaTerakhir
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungneraca', $input);
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'PERKIRAAN_ID' => 23,
|
|
'NILAI_HNE' => $tp01
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungneraca', $input);
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'PERKIRAAN_ID' => 24,
|
|
'NILAI_HNE' => $tp02
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungneraca', $input);
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'PERKIRAAN_ID' => 25,
|
|
'NILAI_HNE' => $tp03
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungneraca', $input);
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'PERKIRAAN_ID' => 26,
|
|
'NILAI_HNE' => $hpp01
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungneraca', $input);
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'PERKIRAAN_ID' => 27,
|
|
'NILAI_HNE' => $hpp02
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungneraca', $input);
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'PERKIRAAN_ID' => 28,
|
|
'NILAI_HNE' => $hpp03
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungneraca', $input);
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'PERKIRAAN_ID' => 29,
|
|
'NILAI_HNE' => $hpp04
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungneraca', $input);
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'PERKIRAAN_ID' => 30,
|
|
'NILAI_HNE' => $hpp05
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungneraca', $input);
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'PERKIRAAN_ID' => 31,
|
|
'NILAI_HNE' => $bp01
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungneraca', $input);
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'PERKIRAAN_ID' => 32,
|
|
'NILAI_HNE' => $bp02
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungneraca', $input);
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'PERKIRAAN_ID' => 33,
|
|
'NILAI_HNE' => $bp03
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungneraca', $input);
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'PERKIRAAN_ID' => 34,
|
|
'NILAI_HNE' => $bp04
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungneraca', $input);
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'PERKIRAAN_ID' => 35,
|
|
'NILAI_HNE' => $bp05
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungneraca', $input);
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'PERKIRAAN_ID' => 36,
|
|
'NILAI_HNE' => $bp06
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungneraca', $input);
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'PERKIRAAN_ID' => 37,
|
|
'NILAI_HNE' => $bp07
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungneraca', $input);
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'PERKIRAAN_ID' => 38,
|
|
'NILAI_HNE' => $bua01
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungneraca', $input);
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'PERKIRAAN_ID' => 39,
|
|
'NILAI_HNE' => $bua02
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungneraca', $input);
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'PERKIRAAN_ID' => 40,
|
|
'NILAI_HNE' => $bua03
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungneraca', $input);
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'PERKIRAAN_ID' => 41,
|
|
'NILAI_HNE' => $bua04
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungneraca', $input);
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'PERKIRAAN_ID' => 42,
|
|
'NILAI_HNE' => $bua05
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungneraca', $input);
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'PERKIRAAN_ID' => 43,
|
|
'NILAI_HNE' => $bua06
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungneraca', $input);
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'PERKIRAAN_ID' => 44,
|
|
'NILAI_HNE' => $bua07
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungneraca', $input);
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'PERKIRAAN_ID' => 45,
|
|
'NILAI_HNE' => $bua08
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungneraca', $input);
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'PERKIRAAN_ID' => 46,
|
|
'NILAI_HNE' => $bua09
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungneraca', $input);
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'PERKIRAAN_ID' => 80,
|
|
'NILAI_HNE' => $bua10
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungneraca', $input);
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'PERKIRAAN_ID' => 47,
|
|
'NILAI_HNE' => $bua11
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungneraca', $input);
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'PERKIRAAN_ID' => 48,
|
|
'NILAI_HNE' => $bua12
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungneraca', $input);
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'PERKIRAAN_ID' => 49,
|
|
'NILAI_HNE' => $bua13
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungneraca', $input);
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'PERKIRAAN_ID' => 50,
|
|
'NILAI_HNE' => $bua14
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungneraca', $input);
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'PERKIRAAN_ID' => 51,
|
|
'NILAI_HNE' => $bua15
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungneraca', $input);
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'PERKIRAAN_ID' => 52,
|
|
'NILAI_HNE' => $bua16
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungneraca', $input);
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'PERKIRAAN_ID' => 53,
|
|
'NILAI_HNE' => $bua17
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungneraca', $input);
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'PERKIRAAN_ID' => 54,
|
|
'NILAI_HNE' => $bua18
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungneraca', $input);
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'PERKIRAAN_ID' => 55,
|
|
'NILAI_HNE' => $bua19
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungneraca', $input);
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'PERKIRAAN_ID' => 56,
|
|
'NILAI_HNE' => $bua20
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungneraca', $input);
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'PERKIRAAN_ID' => 57,
|
|
'NILAI_HNE' => $bua21
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungneraca', $input);
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'PERKIRAAN_ID' => 58,
|
|
'NILAI_HNE' => $bua22
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungneraca', $input);
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'PERKIRAAN_ID' => 59,
|
|
'NILAI_HNE' => $bua23
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungneraca', $input);
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'PERKIRAAN_ID' => 60,
|
|
'NILAI_HNE' => $bua24
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungneraca', $input);
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'PERKIRAAN_ID' => 61,
|
|
'NILAI_HNE' => $bua25
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungneraca', $input);
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'PERKIRAAN_ID' => 62,
|
|
'NILAI_HNE' => $bua26
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungneraca', $input);
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'PERKIRAAN_ID' => 63,
|
|
'NILAI_HNE' => $bua27
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungneraca', $input);
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'PERKIRAAN_ID' => 64,
|
|
'NILAI_HNE' => $bua28
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungneraca', $input);
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'PERKIRAAN_ID' => 65,
|
|
'NILAI_HNE' => $bua29
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungneraca', $input);
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'PERKIRAAN_ID' => 66,
|
|
'NILAI_HNE' => $bua30
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungneraca', $input);
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'PERKIRAAN_ID' => 67,
|
|
'NILAI_HNE' => $bua31
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungneraca', $input);
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'PERKIRAAN_ID' => 68,
|
|
'NILAI_HNE' => $bua32
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungneraca', $input);
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'PERKIRAAN_ID' => 69,
|
|
'NILAI_HNE' => $bua33
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungneraca', $input);
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'PERKIRAAN_ID' => 70,
|
|
'NILAI_HNE' => $bua34
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungneraca', $input);
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'PERKIRAAN_ID' => 71,
|
|
'NILAI_HNE' => $bua35
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungneraca', $input);
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'PERKIRAAN_ID' => 72,
|
|
'NILAI_HNE' => $bua36
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungneraca', $input);
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'PERKIRAAN_ID' => 73,
|
|
'NILAI_HNE' => $bua37
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungneraca', $input);
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'PERKIRAAN_ID' => 86,
|
|
'NILAI_HNE' => $bua38
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungneraca', $input);
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'PERKIRAAN_ID' => 74,
|
|
'NILAI_HNE' => $bua39
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungneraca', $input);
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'PERKIRAAN_ID' => 75,
|
|
'NILAI_HNE' => $plu01
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungneraca', $input);
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'PERKIRAAN_ID' => 76,
|
|
'NILAI_HNE' => $plu02
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungneraca', $input);
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'PERKIRAAN_ID' => 77,
|
|
'NILAI_HNE' => $plu03
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungneraca', $input);
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'PERKIRAAN_ID' => 78,
|
|
'NILAI_HNE' => $plu04
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungneraca', $input);
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'PERKIRAAN_ID' => 87,
|
|
'NILAI_HNE' => $plu05
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungneraca', $input);
|
|
|
|
$input = [
|
|
'PAK_ID' => $id_pak,
|
|
'PERKIRAAN_ID' => 79,
|
|
'NILAI_HNE' => $pph01
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungneraca', $input);
|
|
|
|
//Rentetan Pembuatan Transaksi Daftar Akuntansi
|
|
if ($labaTerakhir==$mo03) {
|
|
$kreditLaba = 0;
|
|
} else {
|
|
$kreditLaba = $labaTerakhir-$mo03;
|
|
}
|
|
$input = [
|
|
'AKUNTANSI_ID' => $id_akuntansi,
|
|
'PERKIRAAN_ID' => '22',
|
|
'CIPTA_DAK' => "Oleh $panggilan pada $timestamp",
|
|
'JENIS_DAK' => '0',
|
|
'DEBET_DAK' => '0',
|
|
'KREDIT_DAK' => $kreditLaba,
|
|
'KET_DAK' => "Jurnal Sistem u/ Perkiraan [3210 | Laba Thn. Berjalan | $nama_pak]",
|
|
'PAK_ID' => $id_pak
|
|
];
|
|
$action = $this->Amod->create('daftar_akuntansi', $input);
|
|
|
|
$update = [
|
|
'STATUS_PAK' => '1'
|
|
];
|
|
$action = $this->Amod->update('periode_akuntansi', $update, 'ID_PAK', $id_pak);
|
|
|
|
$this->GE_Kalkulasi_HasilHitungTb($id_pak);
|
|
$this->GE_Kalkulasi_TrialBalanceTahunan();
|
|
|
|
//Masuk Periode Baru
|
|
$awalPakNew = $this->Amod->generate_addDay($limit, 1);
|
|
$bulanBaru = date_format(date_create($awalPakNew),"m");
|
|
$year = date_format(date_create($awalPakNew),"Y");
|
|
$month = $this->Amod->generate_inisialMonth($bulanBaru);
|
|
$month = strtoupper($month);
|
|
$namaPakNew = "PERIODE $month $year";
|
|
$akhirPakNew = $this->Amod->generate_addMonth($awalPakNew, 1);
|
|
$akhirPakNew = $this->Amod->generate_subDay($akhirPakNew, 1);
|
|
|
|
$input = [
|
|
'NAMA_PAK' => $namaPakNew,
|
|
'AWAL_PAK' => $awalPakNew,
|
|
'AKHIR_PAK' => $akhirPakNew,
|
|
'STATUS_PAK' => '0'
|
|
];
|
|
$action = $this->Amod->create('periode_akuntansi', $input);
|
|
|
|
$id_pak = $this->Amod->getMax_ID_PeriodeAkuntansi();
|
|
$id_pak = $id_pak[0]['ID_PAK'];
|
|
|
|
$tgl_createNew = date_format(date_create($awalPakNew),"d/m/Y 07:00:00");
|
|
$year_createNew = date_format(date_create($awalPakNew),"y/m");
|
|
$kodeakuntansiNew = "JS/$year_createNew/00001";
|
|
|
|
$input = [
|
|
'CIPTA_AKUNTANSI' => "Oleh $panggilan pada $tgl_createNew",
|
|
'TGL_AKUNTANSI' => $awalPakNew,
|
|
'KODE_AKUNTANSI' => $kodeakuntansiNew,
|
|
'STATUS_AKUNTANSI' => '2'
|
|
];
|
|
$action = $this->Amod->create('akuntansi', $input);
|
|
|
|
$id_akuntansiNew = $this->Amod->getMax_ID_Akuntansi();
|
|
$id_akuntansiNew = $id_akuntansiNew[0]['ID_AKUNTANSI'];
|
|
|
|
if ($labaTerakhir==0) {
|
|
$kreLaba = 0;
|
|
} else {
|
|
$kreLaba = $labaTerakhir;
|
|
}
|
|
|
|
$input = [
|
|
'AKUNTANSI_ID' => $id_akuntansiNew,
|
|
'PERKIRAAN_ID' => '21',
|
|
'CIPTA_DAK' => "Oleh $panggilan pada $tgl_createNew",
|
|
'JENIS_DAK' => '0',
|
|
'DEBET_DAK' => '0',
|
|
'KREDIT_DAK' => $kreLaba,
|
|
'KET_DAK' => "Jurnal Sistem u/ Perkiraan [3200 | Akumulasi Laba Ditahan | $namaPakNew]",
|
|
'PAK_ID' => $id_pak
|
|
];
|
|
$action = $this->Amod->create('daftar_akuntansi', $input);
|
|
|
|
$input = [
|
|
'AKUNTANSI_ID' => $id_akuntansiNew,
|
|
'PERKIRAAN_ID' => '26',
|
|
'CIPTA_DAK' => "Oleh $panggilan pada $tgl_createNew",
|
|
'JENIS_DAK' => '0',
|
|
'DEBET_DAK' => $debet_dak,
|
|
'KREDIT_DAK' => $kredit_dak,
|
|
'KET_DAK' => "Jurnal Sistem u/ Perkiraan [5110 | Persediaan Awal | $namaPakNew]",
|
|
'PAK_ID' => $id_pak
|
|
];
|
|
$action = $this->Amod->create('daftar_akuntansi', $input);
|
|
|
|
$input = [
|
|
'CIPTA_AKUNTANSI' => "Oleh $panggilan pada $tgl_createNew",
|
|
'TGL_AKUNTANSI' => $awalPakNew,
|
|
'KODE_AKUNTANSI' => "JS/$year_createNew/00002",
|
|
'STATUS_AKUNTANSI' => '1'
|
|
];
|
|
$action = $this->Amod->create('akuntansi', $input);
|
|
|
|
$id_akuntansiJs2 = $this->Amod->getMax_ID_Akuntansi();
|
|
$id_akuntansiJs2 = $id_akuntansiJs2[0]['ID_AKUNTANSI'];
|
|
|
|
$input = [
|
|
'AKUNTANSI_ID' => $id_akuntansiJs2,
|
|
'PERKIRAAN_ID' => '75',
|
|
'CIPTA_DAK' => "Oleh $panggilan pada $tgl_createNew",
|
|
'JENIS_DAK' => '0',
|
|
'DEBET_DAK' => '0',
|
|
'KREDIT_DAK' => '0',
|
|
'KET_DAK' => "Jurnal Sistem u/ Pendapatan Diluar Usaha Koreksi Hutang [$namaPakNew]",
|
|
'PAK_ID' => $id_pak
|
|
];
|
|
$action = $this->Amod->create('daftar_akuntansi', $input);
|
|
|
|
$input = [
|
|
'CIPTA_AKUNTANSI' => "Oleh $panggilan pada $tgl_createNew",
|
|
'TGL_AKUNTANSI' => $awalPakNew,
|
|
'KODE_AKUNTANSI' => "JS/$year_createNew/00003",
|
|
'STATUS_AKUNTANSI' => '1'
|
|
];
|
|
$action = $this->Amod->create('akuntansi', $input);
|
|
|
|
$id_akuntansiJs3 = $this->Amod->getMax_ID_Akuntansi();
|
|
$id_akuntansiJs3 = $id_akuntansiJs3[0]['ID_AKUNTANSI'];
|
|
|
|
$input = [
|
|
'AKUNTANSI_ID' => $id_akuntansiJs3,
|
|
'PERKIRAAN_ID' => '87',
|
|
'CIPTA_DAK' => "Oleh $panggilan pada $tgl_createNew",
|
|
'JENIS_DAK' => '0',
|
|
'DEBET_DAK' => '0',
|
|
'KREDIT_DAK' => '0',
|
|
'KET_DAK' => "Jurnal Sistem u/ Beban Selisih Nilai Koreksi Piutang [$namaPakNew]",
|
|
'PAK_ID' => $id_pak
|
|
];
|
|
$action = $this->Amod->create('daftar_akuntansi', $input);
|
|
|
|
if ($action) {
|
|
$this->session->set_flashdata('success', 'diproses');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
} else {
|
|
$this->session->set_flashdata('failed', 'diproses');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
}
|
|
|
|
// Daftar Menu KO [Konfigurasi]
|
|
// SUBMENU TRANSAKSI - Hak Menu
|
|
public function KO_Sub1_HakMenu_1() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "KO", "TRANSAKSI - Hak Menu");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$datKaryawan = $this->Amod->getData_Karyawan_bySTATUS(1);
|
|
|
|
$data = array(
|
|
'sidebar' => "menu konfigurasi",
|
|
'navChild' => "konfigurasi hakmenu",
|
|
'shm' => $datShm,
|
|
'karyawan' => $datKaryawan,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil,
|
|
);
|
|
$this->load->view('proses/KO_Sub1_HakMenu_1', $data);
|
|
}
|
|
|
|
public function KO_Ambil_Sub1_DataSetHakMenu() {
|
|
$id_karyawan = $this->input->post('id_karyawan');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "KO", "TRANSAKSI - Hak Menu");
|
|
if ($datShm==FALSE) {
|
|
$ko_Sub1_A = 0;
|
|
} else {
|
|
$ko_Sub1_A = $datShm[0]['AKSES_ID'];
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "KO", "TRANSAKSI - Hak SO");
|
|
if ($datShm==FALSE) {
|
|
$ko_Sub1_B = 0;
|
|
} else {
|
|
$ko_Sub1_B = $datShm[0]['AKSES_ID'];
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "KO", "TRANSAKSI - Hari Libur");
|
|
if ($datShm==FALSE) {
|
|
$ko_Sub1_C = 0;
|
|
} else {
|
|
$ko_Sub1_C = $datShm[0]['AKSES_ID'];
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "KO", "TRANSAKSI - Komisi NonGp");
|
|
if ($datShm==FALSE) {
|
|
$ko_Sub1_D = 0;
|
|
} else {
|
|
$ko_Sub1_D = $datShm[0]['AKSES_ID'];
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "KO", "TRANSAKSI - Rumus Gp");
|
|
if ($datShm==FALSE) {
|
|
$ko_Sub1_E = 0;
|
|
} else {
|
|
$ko_Sub1_E = $datShm[0]['AKSES_ID'];
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "KO", "TRANSAKSI - Sales Produk");
|
|
if ($datShm==FALSE) {
|
|
$ko_Sub1_F = 0;
|
|
} else {
|
|
$ko_Sub1_F = $datShm[0]['AKSES_ID'];
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "KO", "TRANSAKSI - Tertanda");
|
|
if ($datShm==FALSE) {
|
|
$ko_Sub1_G = 0;
|
|
} else {
|
|
$ko_Sub1_G = $datShm[0]['AKSES_ID'];
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "DA", "DASHBOARD - Monitoring User");
|
|
if ($datShm==FALSE) {
|
|
$da_Sub1_A = 0;
|
|
} else {
|
|
$da_Sub1_A = $datShm[0]['AKSES_ID'];
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "DA", "DASHBOARD - Form Karyawan");
|
|
if ($datShm==FALSE) {
|
|
$da_Sub1_B = 0;
|
|
} else {
|
|
$da_Sub1_B = $datShm[0]['AKSES_ID'];
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "IN", "KEUANGAN - Biaya Fee");
|
|
if ($datShm==FALSE) {
|
|
$in_Sub1_A = 0;
|
|
} else {
|
|
$in_Sub1_A = $datShm[0]['AKSES_ID'];
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "IN", "KEUANGAN - DP Pembelian");
|
|
if ($datShm==FALSE) {
|
|
$in_Sub1_B = 0;
|
|
} else {
|
|
$in_Sub1_B = $datShm[0]['AKSES_ID'];
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "IN", "KEUANGAN - DP Penjualan");
|
|
if ($datShm==FALSE) {
|
|
$in_Sub1_C = 0;
|
|
} else {
|
|
$in_Sub1_C = $datShm[0]['AKSES_ID'];
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "IN", "KEUANGAN - Hutang Dagang");
|
|
if ($datShm==FALSE) {
|
|
$in_Sub1_D = 0;
|
|
} else {
|
|
$in_Sub1_D = $datShm[0]['AKSES_ID'];
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "IN", "KEUANGAN - Piutang Dagang");
|
|
if ($datShm==FALSE) {
|
|
$in_Sub1_E = 0;
|
|
} else {
|
|
$in_Sub1_E = $datShm[0]['AKSES_ID'];
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "IN", "KEUANGAN - Piutang Karyawan");
|
|
if ($datShm==FALSE) {
|
|
$in_Sub1_F = 0;
|
|
} else {
|
|
$in_Sub1_F = $datShm[0]['AKSES_ID'];
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "IN", "KEUANGAN - Piutang Pihakke3");
|
|
if ($datShm==FALSE) {
|
|
$in_Sub1_G = 0;
|
|
} else {
|
|
$in_Sub1_G = $datShm[0]['AKSES_ID'];
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "IN", "PEMBELIAN - Stok Datang");
|
|
if ($datShm==FALSE) {
|
|
$in_Sub2_A = 0;
|
|
} else {
|
|
$in_Sub2_A = $datShm[0]['AKSES_ID'];
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "IN", "STOK BARANG - Konsinyasi");
|
|
if ($datShm==FALSE) {
|
|
$in_Sub3_A = 0;
|
|
} else {
|
|
$in_Sub3_A = $datShm[0]['AKSES_ID'];
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "IN", "STOK BARANG - Peminjaman");
|
|
if ($datShm==FALSE) {
|
|
$in_Sub3_B = 0;
|
|
} else {
|
|
$in_Sub3_B = $datShm[0]['AKSES_ID'];
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "IN", "STOK BARANG - Pending");
|
|
if ($datShm==FALSE) {
|
|
$in_Sub3_C = 0;
|
|
} else {
|
|
$in_Sub3_C = $datShm[0]['AKSES_ID'];
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "IN", "STOK BARANG - Sewa");
|
|
if ($datShm==FALSE) {
|
|
$in_Sub3_D = 0;
|
|
} else {
|
|
$in_Sub3_D = $datShm[0]['AKSES_ID'];
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "IN", "STOK BARANG - Stok Gudang");
|
|
if ($datShm==FALSE) {
|
|
$in_Sub3_E = 0;
|
|
} else {
|
|
$in_Sub3_E = $datShm[0]['AKSES_ID'];
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "IN", "STOK BARANG - Operasional");
|
|
if ($datShm==FALSE) {
|
|
$in_Sub3_F = 0;
|
|
} else {
|
|
$in_Sub3_F = $datShm[0]['AKSES_ID'];
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "MD", "MASTER - Bank");
|
|
if ($datShm==FALSE) {
|
|
$md_Sub1_A = 0;
|
|
} else {
|
|
$md_Sub1_A = $datShm[0]['AKSES_ID'];
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "MD", "MASTER - Barang");
|
|
if ($datShm==FALSE) {
|
|
$md_Sub1_B = 0;
|
|
} else {
|
|
$md_Sub1_B = $datShm[0]['AKSES_ID'];
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "MD", "MASTER - Jabatan");
|
|
if ($datShm==FALSE) {
|
|
$md_Sub1_C = 0;
|
|
} else {
|
|
$md_Sub1_C = $datShm[0]['AKSES_ID'];
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "MD", "MASTER - Jenis");
|
|
if ($datShm==FALSE) {
|
|
$md_Sub1_D = 0;
|
|
} else {
|
|
$md_Sub1_D = $datShm[0]['AKSES_ID'];
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "MD", "MASTER - Karyawan");
|
|
if ($datShm==FALSE) {
|
|
$md_Sub1_E = 0;
|
|
} else {
|
|
$md_Sub1_E = $datShm[0]['AKSES_ID'];
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "MD", "MASTER - Kas");
|
|
if ($datShm==FALSE) {
|
|
$md_Sub1_F = 0;
|
|
} else {
|
|
$md_Sub1_F = $datShm[0]['AKSES_ID'];
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "MD", "MASTER - Kelompok");
|
|
if ($datShm==FALSE) {
|
|
$md_Sub1_G = 0;
|
|
} else {
|
|
$md_Sub1_G = $datShm[0]['AKSES_ID'];
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "MD", "MASTER - Kendaraan");
|
|
if ($datShm==FALSE) {
|
|
$md_Sub1_H = 0;
|
|
} else {
|
|
$md_Sub1_H = $datShm[0]['AKSES_ID'];
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "MD", "MASTER - Kota");
|
|
if ($datShm==FALSE) {
|
|
$md_Sub1_I = 0;
|
|
} else {
|
|
$md_Sub1_I = $datShm[0]['AKSES_ID'];
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "MD", "MASTER - Merk");
|
|
if ($datShm==FALSE) {
|
|
$md_Sub1_J = 0;
|
|
} else {
|
|
$md_Sub1_J = $datShm[0]['AKSES_ID'];
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "MD", "MASTER - Model");
|
|
if ($datShm==FALSE) {
|
|
$md_Sub1_K = 0;
|
|
} else {
|
|
$md_Sub1_K = $datShm[0]['AKSES_ID'];
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "MD", "MASTER - Part");
|
|
if ($datShm==FALSE) {
|
|
$md_Sub1_L = 0;
|
|
} else {
|
|
$md_Sub1_L = $datShm[0]['AKSES_ID'];
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "MD", "MASTER - Pelanggan");
|
|
if ($datShm==FALSE) {
|
|
$md_Sub1_M = 0;
|
|
} else {
|
|
$md_Sub1_M = $datShm[0]['AKSES_ID'];
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "MD", "MASTER - Periode Produk");
|
|
if ($datShm==FALSE) {
|
|
$md_Sub1_N = 0;
|
|
} else {
|
|
$md_Sub1_N = $datShm[0]['AKSES_ID'];
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "MD", "MASTER - Periode Proyek");
|
|
if ($datShm==FALSE) {
|
|
$md_Sub1_O = 0;
|
|
} else {
|
|
$md_Sub1_O = $datShm[0]['AKSES_ID'];
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "MD", "MASTER - Perkiraan");
|
|
if ($datShm==FALSE) {
|
|
$md_Sub1_P = 0;
|
|
} else {
|
|
$md_Sub1_P = $datShm[0]['AKSES_ID'];
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "MD", "MASTER - Perusahaan");
|
|
if ($datShm==FALSE) {
|
|
$md_Sub1_Q = 0;
|
|
} else {
|
|
$md_Sub1_Q = $datShm[0]['AKSES_ID'];
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "MD", "MASTER - Pihakke3");
|
|
if ($datShm==FALSE) {
|
|
$md_Sub1_R = 0;
|
|
} else {
|
|
$md_Sub1_R = $datShm[0]['AKSES_ID'];
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "MD", "MASTER - Produk");
|
|
if ($datShm==FALSE) {
|
|
$md_Sub1_S = 0;
|
|
} else {
|
|
$md_Sub1_S = $datShm[0]['AKSES_ID'];
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "MD", "MASTER - Program");
|
|
if ($datShm==FALSE) {
|
|
$md_Sub1_T = 0;
|
|
} else {
|
|
$md_Sub1_T = $datShm[0]['AKSES_ID'];
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "MD", "MASTER - Supplier");
|
|
if ($datShm==FALSE) {
|
|
$md_Sub1_U = 0;
|
|
} else {
|
|
$md_Sub1_U = $datShm[0]['AKSES_ID'];
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "MD", "MASTER - UnitProyek");
|
|
if ($datShm==FALSE) {
|
|
$md_Sub1_V = 0;
|
|
} else {
|
|
$md_Sub1_V = $datShm[0]['AKSES_ID'];
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "MD", "MASTER - UnitService");
|
|
if ($datShm==FALSE) {
|
|
$md_Sub1_W = 0;
|
|
} else {
|
|
$md_Sub1_W = $datShm[0]['AKSES_ID'];
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "MD", "MASTER - WajibPajak");
|
|
if ($datShm==FALSE) {
|
|
$md_Sub1_X = 0;
|
|
} else {
|
|
$md_Sub1_X = $datShm[0]['AKSES_ID'];
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "PB", "TRANSAKSI - Surat Jalan");
|
|
if ($datShm==FALSE) {
|
|
$pb_Sub1_A = 0;
|
|
} else {
|
|
$pb_Sub1_A = $datShm[0]['AKSES_ID'];
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "PB", "TRANSAKSI - Nota Pembelian");
|
|
if ($datShm==FALSE) {
|
|
$pb_Sub1_B = 0;
|
|
} else {
|
|
$pb_Sub1_B = $datShm[0]['AKSES_ID'];
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "PB", "TRANSAKSI - Retur Pembelian");
|
|
if ($datShm==FALSE) {
|
|
$pb_Sub1_C = 0;
|
|
} else {
|
|
$pb_Sub1_C = $datShm[0]['AKSES_ID'];
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "PB", "TRANSAKSI - Olah Pembelian");
|
|
if ($datShm==FALSE) {
|
|
$pb_Sub1_D = 0;
|
|
} else {
|
|
$pb_Sub1_D = $datShm[0]['AKSES_ID'];
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "PB", "PUSAT DATA - Cetak Dokumen");
|
|
if ($datShm==FALSE) {
|
|
$pb_Sub2_A = 0;
|
|
} else {
|
|
$pb_Sub2_A = $datShm[0]['AKSES_ID'];
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "PB", "PUSAT DATA - Informasi");
|
|
if ($datShm==FALSE) {
|
|
$pb_Sub2_B = 0;
|
|
} else {
|
|
$pb_Sub2_B = $datShm[0]['AKSES_ID'];
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "PB", "PUSAT DATA - Laporan");
|
|
if ($datShm==FALSE) {
|
|
$pb_Sub2_C = 0;
|
|
} else {
|
|
$pb_Sub2_C = $datShm[0]['AKSES_ID'];
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "PJ", "TRANSAKSI - Sales Order");
|
|
if ($datShm==FALSE) {
|
|
$pj_Sub1_A = 0;
|
|
} else {
|
|
$pj_Sub1_A = $datShm[0]['AKSES_ID'];
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "PJ", "TRANSAKSI - Proses Barang");
|
|
if ($datShm==FALSE) {
|
|
$pj_Sub1_B = 0;
|
|
} else {
|
|
$pj_Sub1_B = $datShm[0]['AKSES_ID'];
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "PJ", "TRANSAKSI - Penjadwalan");
|
|
if ($datShm==FALSE) {
|
|
$pj_Sub1_C = 0;
|
|
} else {
|
|
$pj_Sub1_C = $datShm[0]['AKSES_ID'];
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "PJ", "TRANSAKSI - Retur Penjualan");
|
|
if ($datShm==FALSE) {
|
|
$pj_Sub1_D = 0;
|
|
} else {
|
|
$pj_Sub1_D = $datShm[0]['AKSES_ID'];
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "PJ", "TRANSAKSI - Batal Penjualan");
|
|
if ($datShm==FALSE) {
|
|
$pj_Sub1_E = 0;
|
|
} else {
|
|
$pj_Sub1_E = $datShm[0]['AKSES_ID'];
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "PJ", "TRANSAKSI - Olah Penjualan");
|
|
if ($datShm==FALSE) {
|
|
$pj_Sub1_F = 0;
|
|
} else {
|
|
$pj_Sub1_F = $datShm[0]['AKSES_ID'];
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "PJ", "PUSAT DATA - Cetak Dokumen");
|
|
if ($datShm==FALSE) {
|
|
$pj_Sub2_A = 0;
|
|
} else {
|
|
$pj_Sub2_A = $datShm[0]['AKSES_ID'];
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "PJ", "PUSAT DATA - Informasi");
|
|
if ($datShm==FALSE) {
|
|
$pj_Sub2_B = 0;
|
|
} else {
|
|
$pj_Sub2_B = $datShm[0]['AKSES_ID'];
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "PJ", "PUSAT DATA - Laporan");
|
|
if ($datShm==FALSE) {
|
|
$pj_Sub2_C = 0;
|
|
} else {
|
|
$pj_Sub2_C = $datShm[0]['AKSES_ID'];
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "PJ", "ADMINISTRASI - Proforma");
|
|
if ($datShm==FALSE) {
|
|
$pj_Sub3_A = 0;
|
|
} else {
|
|
$pj_Sub3_A = $datShm[0]['AKSES_ID'];
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "PJ", "ADMINISTRASI - Promo Clearance");
|
|
if ($datShm==FALSE) {
|
|
$pj_Sub3_B = 0;
|
|
} else {
|
|
$pj_Sub3_B = $datShm[0]['AKSES_ID'];
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "KP", "TRANSAKSI - Kunjungan");
|
|
if ($datShm==FALSE) {
|
|
$kp_Sub1_A = 0;
|
|
} else {
|
|
$kp_Sub1_A = $datShm[0]['AKSES_ID'];
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "KP", "TRANSAKSI - Penawaran");
|
|
if ($datShm==FALSE) {
|
|
$kp_Sub1_B = 0;
|
|
} else {
|
|
$kp_Sub1_B = $datShm[0]['AKSES_ID'];
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "KP", "TRANSAKSI - Tindak Lanjut");
|
|
if ($datShm==FALSE) {
|
|
$kp_Sub1_C = 0;
|
|
} else {
|
|
$kp_Sub1_C = $datShm[0]['AKSES_ID'];
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "KP", "PUSAT DATA - Cetak Dokumen");
|
|
if ($datShm==FALSE) {
|
|
$kp_Sub2_A = 0;
|
|
} else {
|
|
$kp_Sub2_A = $datShm[0]['AKSES_ID'];
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "KP", "PUSAT DATA - Informasi");
|
|
if ($datShm==FALSE) {
|
|
$kp_Sub2_B = 0;
|
|
} else {
|
|
$kp_Sub2_B = $datShm[0]['AKSES_ID'];
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "KP", "PUSAT DATA - Laporan");
|
|
if ($datShm==FALSE) {
|
|
$kp_Sub2_C = 0;
|
|
} else {
|
|
$kp_Sub2_C = $datShm[0]['AKSES_ID'];
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "KU", "TRANSAKSI - Kas");
|
|
if ($datShm==FALSE) {
|
|
$ku_Sub1_A = 0;
|
|
} else {
|
|
$ku_Sub1_A = $datShm[0]['AKSES_ID'];
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "KU", "TRANSAKSI - Bank");
|
|
if ($datShm==FALSE) {
|
|
$ku_Sub1_B = 0;
|
|
} else {
|
|
$ku_Sub1_B = $datShm[0]['AKSES_ID'];
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "KU", "TRANSAKSI - Jurnal Memo");
|
|
if ($datShm==FALSE) {
|
|
$ku_Sub1_C = 0;
|
|
} else {
|
|
$ku_Sub1_C = $datShm[0]['AKSES_ID'];
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "KU", "TRANSAKSI - Jurnal Sistem");
|
|
if ($datShm==FALSE) {
|
|
$ku_Sub1_D = 0;
|
|
} else {
|
|
$ku_Sub1_D = $datShm[0]['AKSES_ID'];
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "KU", "PERPAJAKAN - PPH 22");
|
|
if ($datShm==FALSE) {
|
|
$ku_Sub2_A = 0;
|
|
} else {
|
|
$ku_Sub2_A = $datShm[0]['AKSES_ID'];
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "KU", "PERPAJAKAN - PPH 23");
|
|
if ($datShm==FALSE) {
|
|
$ku_Sub2_B = 0;
|
|
} else {
|
|
$ku_Sub2_B = $datShm[0]['AKSES_ID'];
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "KU", "PERPAJAKAN - PPN");
|
|
if ($datShm==FALSE) {
|
|
$ku_Sub2_C = 0;
|
|
} else {
|
|
$ku_Sub2_C = $datShm[0]['AKSES_ID'];
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "KU", "ADMINISTRASI - Kwitansi");
|
|
if ($datShm==FALSE) {
|
|
$ku_Sub3_A = 0;
|
|
} else {
|
|
$ku_Sub3_A = $datShm[0]['AKSES_ID'];
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "KU", "ADMINISTRASI - Nota Bebas");
|
|
if ($datShm==FALSE) {
|
|
$ku_Sub3_B = 0;
|
|
} else {
|
|
$ku_Sub3_B = $datShm[0]['AKSES_ID'];
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "KU", "ADMINISTRASI - TT Nota");
|
|
if ($datShm==FALSE) {
|
|
$ku_Sub3_C = 0;
|
|
} else {
|
|
$ku_Sub3_C = $datShm[0]['AKSES_ID'];
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "KU", "ADMINISTRASI - TT Kosong");
|
|
if ($datShm==FALSE) {
|
|
$ku_Sub3_D = 0;
|
|
} else {
|
|
$ku_Sub3_D = $datShm[0]['AKSES_ID'];
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "KU", "ADMINISTRASI - Pengingat Piutang");
|
|
if ($datShm==FALSE) {
|
|
$ku_Sub3_E = 0;
|
|
} else {
|
|
$ku_Sub3_E = $datShm[0]['AKSES_ID'];
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "KU", "PUSAT DATA - Informasi");
|
|
if ($datShm==FALSE) {
|
|
$ku_Sub4_A = 0;
|
|
} else {
|
|
$ku_Sub4_A = $datShm[0]['AKSES_ID'];
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "KU", "PUSAT DATA - Laporan");
|
|
if ($datShm==FALSE) {
|
|
$ku_Sub4_B = 0;
|
|
} else {
|
|
$ku_Sub4_B = $datShm[0]['AKSES_ID'];
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "KU", "PUSAT DATA - Neraca Berjalan");
|
|
if ($datShm==FALSE) {
|
|
$ku_Sub4_C = 0;
|
|
} else {
|
|
$ku_Sub4_C = $datShm[0]['AKSES_ID'];
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "KU", "PUSAT DATA - Persediaan Berjalan");
|
|
if ($datShm==FALSE) {
|
|
$ku_Sub4_D = 0;
|
|
} else {
|
|
$ku_Sub4_D = $datShm[0]['AKSES_ID'];
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "PR", "TRANSAKSI - Sales Proyek");
|
|
if ($datShm==FALSE) {
|
|
$pr_Sub1_A = 0;
|
|
} else {
|
|
$pr_Sub1_A = $datShm[0]['AKSES_ID'];
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "PR", "TRANSAKSI - Olah Barang");
|
|
if ($datShm==FALSE) {
|
|
$pr_Sub1_B = 0;
|
|
} else {
|
|
$pr_Sub1_B = $datShm[0]['AKSES_ID'];
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "PR", "TRANSAKSI - Administrasi");
|
|
if ($datShm==FALSE) {
|
|
$pr_Sub1_C = 0;
|
|
} else {
|
|
$pr_Sub1_C = $datShm[0]['AKSES_ID'];
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "PR", "TRANSAKSI - Pengawasan");
|
|
if ($datShm==FALSE) {
|
|
$pr_Sub1_D = 0;
|
|
} else {
|
|
$pr_Sub1_D = $datShm[0]['AKSES_ID'];
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "PR", "PUSAT DATA - Informasi");
|
|
if ($datShm==FALSE) {
|
|
$pr_Sub2_A = 0;
|
|
} else {
|
|
$pr_Sub2_A = $datShm[0]['AKSES_ID'];
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "PR", "PUSAT DATA - Laporan");
|
|
if ($datShm==FALSE) {
|
|
$pr_Sub2_B = 0;
|
|
} else {
|
|
$pr_Sub2_B = $datShm[0]['AKSES_ID'];
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "SP", "TRANSAKSI - Stok Gudang");
|
|
if ($datShm==FALSE) {
|
|
$sp_Sub1_A = 0;
|
|
} else {
|
|
$sp_Sub1_A = $datShm[0]['AKSES_ID'];
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "SP", "TRANSAKSI - Klaim Produk");
|
|
if ($datShm==FALSE) {
|
|
$sp_Sub1_B = 0;
|
|
} else {
|
|
$sp_Sub1_B = $datShm[0]['AKSES_ID'];
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "SP", "TRANSAKSI - Otomasi Booster");
|
|
if ($datShm==FALSE) {
|
|
$sp_Sub1_C = 0;
|
|
} else {
|
|
$sp_Sub1_C = $datShm[0]['AKSES_ID'];
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "SP", "TRANSAKSI - Credit Note");
|
|
if ($datShm==FALSE) {
|
|
$sp_Sub1_D = 0;
|
|
} else {
|
|
$sp_Sub1_D = $datShm[0]['AKSES_ID'];
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "SP", "TRANSAKSI - Administrasi");
|
|
if ($datShm==FALSE) {
|
|
$sp_Sub1_E = 0;
|
|
} else {
|
|
$sp_Sub1_E = $datShm[0]['AKSES_ID'];
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "SP", "TRANSAKSI - Pricelist");
|
|
if ($datShm==FALSE) {
|
|
$sp_Sub1_F = 0;
|
|
} else {
|
|
$sp_Sub1_F = $datShm[0]['AKSES_ID'];
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "SP", "PUSAT DATA - Cetak Dokumen");
|
|
if ($datShm==FALSE) {
|
|
$sp_Sub2_A = 0;
|
|
} else {
|
|
$sp_Sub2_A = $datShm[0]['AKSES_ID'];
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "SP", "PUSAT DATA - Informasi");
|
|
if ($datShm==FALSE) {
|
|
$sp_Sub2_B = 0;
|
|
} else {
|
|
$sp_Sub2_B = $datShm[0]['AKSES_ID'];
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "SP", "PUSAT DATA - Laporan");
|
|
if ($datShm==FALSE) {
|
|
$sp_Sub2_C = 0;
|
|
} else {
|
|
$sp_Sub2_C = $datShm[0]['AKSES_ID'];
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "SV", "TRANSAKSI - Stok Internal");
|
|
if ($datShm==FALSE) {
|
|
$sv_Sub1_A = 0;
|
|
} else {
|
|
$sv_Sub1_A = $datShm[0]['AKSES_ID'];
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "SV", "TRANSAKSI - Terima Service");
|
|
if ($datShm==FALSE) {
|
|
$sv_Sub1_B = 0;
|
|
} else {
|
|
$sv_Sub1_B = $datShm[0]['AKSES_ID'];
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "SV", "TRANSAKSI - Pengerjaan");
|
|
if ($datShm==FALSE) {
|
|
$sv_Sub1_C = 0;
|
|
} else {
|
|
$sv_Sub1_C = $datShm[0]['AKSES_ID'];
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "SV", "ADMINISTRASI - SJ Service");
|
|
if ($datShm==FALSE) {
|
|
$sv_Sub2_A = 0;
|
|
} else {
|
|
$sv_Sub2_A = $datShm[0]['AKSES_ID'];
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "SV", "PUSAT DATA - Cetak Dokumen");
|
|
if ($datShm==FALSE) {
|
|
$sv_Sub3_A = 0;
|
|
} else {
|
|
$sv_Sub3_A = $datShm[0]['AKSES_ID'];
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "SV", "PUSAT DATA - Informasi");
|
|
if ($datShm==FALSE) {
|
|
$sv_Sub3_B = 0;
|
|
} else {
|
|
$sv_Sub3_B = $datShm[0]['AKSES_ID'];
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "SV", "PUSAT DATA - Laporan");
|
|
if ($datShm==FALSE) {
|
|
$sv_Sub3_C = 0;
|
|
} else {
|
|
$sv_Sub3_C = $datShm[0]['AKSES_ID'];
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "SB", "TRANSAKSI - Keluar Masuk");
|
|
if ($datShm==FALSE) {
|
|
$sb_Sub1_A = 0;
|
|
} else {
|
|
$sb_Sub1_A = $datShm[0]['AKSES_ID'];
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "SB", "TRANSAKSI - Konsinyasi");
|
|
if ($datShm==FALSE) {
|
|
$sb_Sub1_B = 0;
|
|
} else {
|
|
$sb_Sub1_B = $datShm[0]['AKSES_ID'];
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "SB", "TRANSAKSI - Modifikasi");
|
|
if ($datShm==FALSE) {
|
|
$sb_Sub1_C = 0;
|
|
} else {
|
|
$sb_Sub1_C = $datShm[0]['AKSES_ID'];
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "SB", "TRANSAKSI - Mutasi Barang");
|
|
if ($datShm==FALSE) {
|
|
$sb_Sub1_D = 0;
|
|
} else {
|
|
$sb_Sub1_D = $datShm[0]['AKSES_ID'];
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "SB", "TRANSAKSI - Peminjaman");
|
|
if ($datShm==FALSE) {
|
|
$sb_Sub1_E = 0;
|
|
} else {
|
|
$sb_Sub1_E = $datShm[0]['AKSES_ID'];
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "SB", "TRANSAKSI - Pending");
|
|
if ($datShm==FALSE) {
|
|
$sb_Sub1_F = 0;
|
|
} else {
|
|
$sb_Sub1_F = $datShm[0]['AKSES_ID'];
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "SB", "TRANSAKSI - Penggantian");
|
|
if ($datShm==FALSE) {
|
|
$sb_Sub1_G = 0;
|
|
} else {
|
|
$sb_Sub1_G = $datShm[0]['AKSES_ID'];
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "SB", "TRANSAKSI - Service");
|
|
if ($datShm==FALSE) {
|
|
$sb_Sub1_H = 0;
|
|
} else {
|
|
$sb_Sub1_H = $datShm[0]['AKSES_ID'];
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "SB", "TRANSAKSI - Sewa");
|
|
if ($datShm==FALSE) {
|
|
$sb_Sub1_I = 0;
|
|
} else {
|
|
$sb_Sub1_I = $datShm[0]['AKSES_ID'];
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "SB", "TRANSAKSI - Stok Antik");
|
|
if ($datShm==FALSE) {
|
|
$sb_Sub1_J = 0;
|
|
} else {
|
|
$sb_Sub1_J = $datShm[0]['AKSES_ID'];
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "SB", "TRANSAKSI - Stok Opname");
|
|
if ($datShm==FALSE) {
|
|
$sb_Sub1_K = 0;
|
|
} else {
|
|
$sb_Sub1_K = $datShm[0]['AKSES_ID'];
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "SB", "TRANSAKSI - Ubah SN Beli");
|
|
if ($datShm==FALSE) {
|
|
$sb_Sub1_L = 0;
|
|
} else {
|
|
$sb_Sub1_L = $datShm[0]['AKSES_ID'];
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "SB", "PUSAT DATA - Cetak Dokumen");
|
|
if ($datShm==FALSE) {
|
|
$sb_Sub2_A = 0;
|
|
} else {
|
|
$sb_Sub2_A = $datShm[0]['AKSES_ID'];
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "SB", "PUSAT DATA - Informasi");
|
|
if ($datShm==FALSE) {
|
|
$sb_Sub2_B = 0;
|
|
} else {
|
|
$sb_Sub2_B = $datShm[0]['AKSES_ID'];
|
|
}
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "SB", "PUSAT DATA - Laporan");
|
|
if ($datShm==FALSE) {
|
|
$sb_Sub2_C = 0;
|
|
} else {
|
|
$sb_Sub2_C = $datShm[0]['AKSES_ID'];
|
|
}
|
|
|
|
$this->output_json([
|
|
'ko_Sub1_A' => $ko_Sub1_A,
|
|
'ko_Sub1_B' => $ko_Sub1_B,
|
|
'ko_Sub1_C' => $ko_Sub1_C,
|
|
'ko_Sub1_D' => $ko_Sub1_D,
|
|
'ko_Sub1_E' => $ko_Sub1_E,
|
|
'ko_Sub1_F' => $ko_Sub1_F,
|
|
'ko_Sub1_G' => $ko_Sub1_G,
|
|
'da_Sub1_A' => $da_Sub1_A,
|
|
'da_Sub1_B' => $da_Sub1_B,
|
|
'in_Sub1_A' => $in_Sub1_A,
|
|
'in_Sub1_B' => $in_Sub1_B,
|
|
'in_Sub1_C' => $in_Sub1_C,
|
|
'in_Sub1_D' => $in_Sub1_D,
|
|
'in_Sub1_E' => $in_Sub1_E,
|
|
'in_Sub1_F' => $in_Sub1_F,
|
|
'in_Sub1_G' => $in_Sub1_G,
|
|
'in_Sub2_A' => $in_Sub2_A,
|
|
'in_Sub3_A' => $in_Sub3_A,
|
|
'in_Sub3_B' => $in_Sub3_B,
|
|
'in_Sub3_C' => $in_Sub3_C,
|
|
'in_Sub3_D' => $in_Sub3_D,
|
|
'in_Sub3_E' => $in_Sub3_E,
|
|
'in_Sub3_F' => $in_Sub3_F,
|
|
'md_Sub1_A' => $md_Sub1_A,
|
|
'md_Sub1_B' => $md_Sub1_B,
|
|
'md_Sub1_C' => $md_Sub1_C,
|
|
'md_Sub1_D' => $md_Sub1_D,
|
|
'md_Sub1_E' => $md_Sub1_E,
|
|
'md_Sub1_F' => $md_Sub1_F,
|
|
'md_Sub1_G' => $md_Sub1_G,
|
|
'md_Sub1_H' => $md_Sub1_H,
|
|
'md_Sub1_I' => $md_Sub1_I,
|
|
'md_Sub1_J' => $md_Sub1_J,
|
|
'md_Sub1_K' => $md_Sub1_K,
|
|
'md_Sub1_L' => $md_Sub1_L,
|
|
'md_Sub1_M' => $md_Sub1_M,
|
|
'md_Sub1_N' => $md_Sub1_N,
|
|
'md_Sub1_O' => $md_Sub1_O,
|
|
'md_Sub1_P' => $md_Sub1_P,
|
|
'md_Sub1_Q' => $md_Sub1_Q,
|
|
'md_Sub1_R' => $md_Sub1_R,
|
|
'md_Sub1_S' => $md_Sub1_S,
|
|
'md_Sub1_T' => $md_Sub1_T,
|
|
'md_Sub1_U' => $md_Sub1_U,
|
|
'md_Sub1_V' => $md_Sub1_V,
|
|
'md_Sub1_W' => $md_Sub1_W,
|
|
'md_Sub1_X' => $md_Sub1_X,
|
|
'pb_Sub1_A' => $pb_Sub1_A,
|
|
'pb_Sub1_B' => $pb_Sub1_B,
|
|
'pb_Sub1_C' => $pb_Sub1_C,
|
|
'pb_Sub1_D' => $pb_Sub1_D,
|
|
'pb_Sub2_A' => $pb_Sub2_A,
|
|
'pb_Sub2_B' => $pb_Sub2_B,
|
|
'pb_Sub2_C' => $pb_Sub2_C,
|
|
'pj_Sub1_A' => $pj_Sub1_A,
|
|
'pj_Sub1_B' => $pj_Sub1_B,
|
|
'pj_Sub1_C' => $pj_Sub1_C,
|
|
'pj_Sub1_D' => $pj_Sub1_D,
|
|
'pj_Sub1_E' => $pj_Sub1_E,
|
|
'pj_Sub1_F' => $pj_Sub1_F,
|
|
'pj_Sub2_A' => $pj_Sub2_A,
|
|
'pj_Sub2_B' => $pj_Sub2_B,
|
|
'pj_Sub2_C' => $pj_Sub2_C,
|
|
'pj_Sub3_A' => $pj_Sub3_A,
|
|
'pj_Sub3_B' => $pj_Sub3_B,
|
|
'kp_Sub1_A' => $kp_Sub1_A,
|
|
'kp_Sub1_B' => $kp_Sub1_B,
|
|
'kp_Sub1_C' => $kp_Sub1_C,
|
|
'kp_Sub2_A' => $kp_Sub2_A,
|
|
'kp_Sub2_B' => $kp_Sub2_B,
|
|
'kp_Sub2_C' => $kp_Sub2_C,
|
|
'ku_Sub1_A' => $ku_Sub1_A,
|
|
'ku_Sub1_B' => $ku_Sub1_B,
|
|
'ku_Sub1_C' => $ku_Sub1_C,
|
|
'ku_Sub1_D' => $ku_Sub1_D,
|
|
'ku_Sub2_A' => $ku_Sub2_A,
|
|
'ku_Sub2_B' => $ku_Sub2_B,
|
|
'ku_Sub2_C' => $ku_Sub2_C,
|
|
'ku_Sub3_A' => $ku_Sub3_A,
|
|
'ku_Sub3_B' => $ku_Sub3_B,
|
|
'ku_Sub3_C' => $ku_Sub3_C,
|
|
'ku_Sub3_D' => $ku_Sub3_D,
|
|
'ku_Sub3_E' => $ku_Sub3_E,
|
|
'ku_Sub4_A' => $ku_Sub4_A,
|
|
'ku_Sub4_B' => $ku_Sub4_B,
|
|
'ku_Sub4_C' => $ku_Sub4_C,
|
|
'ku_Sub4_D' => $ku_Sub4_D,
|
|
'pr_Sub1_A' => $pr_Sub1_A,
|
|
'pr_Sub1_B' => $pr_Sub1_B,
|
|
'pr_Sub1_C' => $pr_Sub1_C,
|
|
'pr_Sub1_D' => $pr_Sub1_D,
|
|
'pr_Sub2_A' => $pr_Sub2_A,
|
|
'pr_Sub2_B' => $pr_Sub2_B,
|
|
'sp_Sub1_A' => $sp_Sub1_A,
|
|
'sp_Sub1_B' => $sp_Sub1_B,
|
|
'sp_Sub1_C' => $sp_Sub1_C,
|
|
'sp_Sub1_D' => $sp_Sub1_D,
|
|
'sp_Sub1_E' => $sp_Sub1_E,
|
|
'sp_Sub1_F' => $sp_Sub1_F,
|
|
'sp_Sub2_A' => $sp_Sub2_A,
|
|
'sp_Sub2_B' => $sp_Sub2_B,
|
|
'sp_Sub2_C' => $sp_Sub2_C,
|
|
'sv_Sub1_A' => $sv_Sub1_A,
|
|
'sv_Sub1_B' => $sv_Sub1_B,
|
|
'sv_Sub1_C' => $sv_Sub1_C,
|
|
'sv_Sub2_A' => $sv_Sub2_A,
|
|
'sv_Sub3_A' => $sv_Sub3_A,
|
|
'sv_Sub3_B' => $sv_Sub3_B,
|
|
'sv_Sub3_C' => $sv_Sub3_C,
|
|
'sb_Sub1_A' => $sb_Sub1_A,
|
|
'sb_Sub1_B' => $sb_Sub1_B,
|
|
'sb_Sub1_C' => $sb_Sub1_C,
|
|
'sb_Sub1_D' => $sb_Sub1_D,
|
|
'sb_Sub1_E' => $sb_Sub1_E,
|
|
'sb_Sub1_F' => $sb_Sub1_F,
|
|
'sb_Sub1_G' => $sb_Sub1_G,
|
|
'sb_Sub1_H' => $sb_Sub1_H,
|
|
'sb_Sub1_I' => $sb_Sub1_I,
|
|
'sb_Sub1_J' => $sb_Sub1_J,
|
|
'sb_Sub1_K' => $sb_Sub1_K,
|
|
'sb_Sub1_L' => $sb_Sub1_L,
|
|
'sb_Sub2_A' => $sb_Sub2_A,
|
|
'sb_Sub2_B' => $sb_Sub2_B,
|
|
'sb_Sub2_C' => $sb_Sub2_C,
|
|
]);
|
|
}
|
|
|
|
public function KO_Ubah_Sub1_A1_DataSetHakMenu() {
|
|
$id_karyawan = $this->input->post('id_karyawan');
|
|
$kode = $this->input->post('kode');
|
|
$verse = $this->input->post('verse');
|
|
$akses = $this->input->post('akses');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
if ($kode=="KO") {
|
|
if ($verse==1) {
|
|
$nama = "TRANSAKSI - Hak Menu";
|
|
} else if ($verse==2) {
|
|
$nama = "TRANSAKSI - Hak SO";
|
|
} else if ($verse==3) {
|
|
$nama = "TRANSAKSI - Hari Libur";
|
|
} else if ($verse==4) {
|
|
$nama = "TRANSAKSI - Komisi NonGp";
|
|
} else if ($verse==5) {
|
|
$nama = "TRANSAKSI - Rumus Gp";
|
|
} else if ($verse==6) {
|
|
$nama = "TRANSAKSI - Sales Produk";
|
|
} else if ($verse==7) {
|
|
$nama = "TRANSAKSI - Tertanda";
|
|
}
|
|
} else if ($kode=="DA") {
|
|
if ($verse==1) {
|
|
$nama = "DASHBOARD - Monitoring User";
|
|
} else if ($verse==2) {
|
|
$nama = "DASHBOARD - Form Karyawan";
|
|
}
|
|
} else if ($kode=="IN") {
|
|
if ($verse==1) {
|
|
$nama = "KEUANGAN - Biaya Fee";
|
|
} else if ($verse==2) {
|
|
$nama = "KEUANGAN - DP Pembelian";
|
|
} else if ($verse==3) {
|
|
$nama = "KEUANGAN - DP Penjualan";
|
|
} else if ($verse==4) {
|
|
$nama = "KEUANGAN - Hutang Dagang";
|
|
} else if ($verse==5) {
|
|
$nama = "KEUANGAN - Piutang Dagang";
|
|
} else if ($verse==6) {
|
|
$nama = "KEUANGAN - Piutang Karyawan";
|
|
} else if ($verse==7) {
|
|
$nama = "KEUANGAN - Piutang Pihakke3";
|
|
} else if ($verse==8) {
|
|
$nama = "PEMBELIAN - Stok Datang";
|
|
} else if ($verse==9) {
|
|
$nama = "STOK BARANG - Konsinyasi";
|
|
} else if ($verse==10) {
|
|
$nama = "STOK BARANG - Peminjaman";
|
|
} else if ($verse==11) {
|
|
$nama = "STOK BARANG - Pending";
|
|
} else if ($verse==12) {
|
|
$nama = "STOK BARANG - Sewa";
|
|
} else if ($verse==13) {
|
|
$nama = "STOK BARANG - Stok Gudang";
|
|
} else if ($verse==14) {
|
|
$nama = "STOK BARANG - Operasional";
|
|
}
|
|
} else if ($kode=="MD") {
|
|
if ($verse==1) {
|
|
$nama = "MASTER - Bank";
|
|
} else if ($verse==2) {
|
|
$nama = "MASTER - Barang";
|
|
} else if ($verse==3) {
|
|
$nama = "MASTER - Jabatan";
|
|
} else if ($verse==4) {
|
|
$nama = "MASTER - Jenis";
|
|
} else if ($verse==5) {
|
|
$nama = "MASTER - Karyawan";
|
|
} else if ($verse==6) {
|
|
$nama = "MASTER - Kas";
|
|
} else if ($verse==7) {
|
|
$nama = "MASTER - Kelompok";
|
|
} else if ($verse==8) {
|
|
$nama = "MASTER - Kendaraan";
|
|
} else if ($verse==9) {
|
|
$nama = "MASTER - Kota";
|
|
} else if ($verse==10) {
|
|
$nama = "MASTER - Merk";
|
|
} else if ($verse==11) {
|
|
$nama = "MASTER - Model";
|
|
} else if ($verse==12) {
|
|
$nama = "MASTER - Part";
|
|
} else if ($verse==13) {
|
|
$nama = "MASTER - Pelanggan";
|
|
} else if ($verse==14) {
|
|
$nama = "MASTER - Periode Produk";
|
|
} else if ($verse==15) {
|
|
$nama = "MASTER - Periode Proyek";
|
|
} else if ($verse==16) {
|
|
$nama = "MASTER - Perkiraan";
|
|
} else if ($verse==17) {
|
|
$nama = "MASTER - Perusahaan";
|
|
} else if ($verse==18) {
|
|
$nama = "MASTER - Pihakke3";
|
|
} else if ($verse==19) {
|
|
$nama = "MASTER - Produk";
|
|
} else if ($verse==20) {
|
|
$nama = "MASTER - Program";
|
|
} else if ($verse==21) {
|
|
$nama = "MASTER - Supplier";
|
|
} else if ($verse==22) {
|
|
$nama = "MASTER - UnitProyek";
|
|
} else if ($verse==23) {
|
|
$nama = "MASTER - UnitService";
|
|
} else if ($verse==24) {
|
|
$nama = "MASTER - WajibPajak";
|
|
}
|
|
} else if ($kode=="PB") {
|
|
if ($verse==1) {
|
|
$nama = "TRANSAKSI - Surat Jalan";
|
|
} else if ($verse==2) {
|
|
$nama = "TRANSAKSI - Nota Pembelian";
|
|
} else if ($verse==3) {
|
|
$nama = "TRANSAKSI - Retur Pembelian";
|
|
} else if ($verse==4) {
|
|
$nama = "TRANSAKSI - Olah Pembelian";
|
|
} else if ($verse==5) {
|
|
$nama = "PUSAT DATA - Cetak Dokumen";
|
|
} else if ($verse==6) {
|
|
$nama = "PUSAT DATA - Informasi";
|
|
} else if ($verse==7) {
|
|
$nama = "PUSAT DATA - Laporan";
|
|
}
|
|
} else if ($kode=="PJ") {
|
|
if ($verse==1) {
|
|
$nama = "TRANSAKSI - Sales Order";
|
|
} else if ($verse==2) {
|
|
$nama = "TRANSAKSI - Proses Barang";
|
|
} else if ($verse==3) {
|
|
$nama = "TRANSAKSI - Penjadwalan";
|
|
} else if ($verse==4) {
|
|
$nama = "TRANSAKSI - Retur Penjualan";
|
|
} else if ($verse==5) {
|
|
$nama = "TRANSAKSI - Batal Penjualan";
|
|
} else if ($verse==6) {
|
|
$nama = "TRANSAKSI - Olah Penjualan";
|
|
} else if ($verse==7) {
|
|
$nama = "PUSAT DATA - Cetak Dokumen";
|
|
} else if ($verse==8) {
|
|
$nama = "PUSAT DATA - Informasi";
|
|
} else if ($verse==9) {
|
|
$nama = "PUSAT DATA - Laporan";
|
|
} else if ($verse==10) {
|
|
$nama = "ADMINISTRASI - Proforma";
|
|
} else if ($verse==11) {
|
|
$nama = "ADMINISTRASI - Promo Clearance";
|
|
}
|
|
} else if ($kode=="KP") {
|
|
if ($verse==1) {
|
|
$nama = "TRANSAKSI - Kunjungan";
|
|
} else if ($verse==2) {
|
|
$nama = "TRANSAKSI - Penawaran";
|
|
} else if ($verse==3) {
|
|
$nama = "TRANSAKSI - Tindak Lanjut";
|
|
} else if ($verse==4) {
|
|
$nama = "PUSAT DATA - Cetak Dokumen";
|
|
} else if ($verse==5) {
|
|
$nama = "PUSAT DATA - Informasi";
|
|
} else if ($verse==6) {
|
|
$nama = "PUSAT DATA - Laporan";
|
|
}
|
|
} else if ($kode=="KU") {
|
|
if ($verse==1) {
|
|
$nama = "TRANSAKSI - Kas";
|
|
} else if ($verse==2) {
|
|
$nama = "TRANSAKSI - Bank";
|
|
} else if ($verse==3) {
|
|
$nama = "TRANSAKSI - Jurnal Memo";
|
|
} else if ($verse==4) {
|
|
$nama = "TRANSAKSI - Jurnal Sistem";
|
|
} else if ($verse==5) {
|
|
$nama = "ADMINISTRASI - Kwitansi";
|
|
} else if ($verse==6) {
|
|
$nama = "ADMINISTRASI - Nota Bebas";
|
|
} else if ($verse==7) {
|
|
$nama = "ADMINISTRASI - TT Nota";
|
|
} else if ($verse==8) {
|
|
$nama = "ADMINISTRASI - TT Kosong";
|
|
} else if ($verse==9) {
|
|
$nama = "ADMINISTRASI - Pengingat Piutang";
|
|
} else if ($verse==10) {
|
|
$nama = "PERPAJAKAN - PPH 22";
|
|
} else if ($verse==11) {
|
|
$nama = "PERPAJAKAN - PPH 23";
|
|
} else if ($verse==12) {
|
|
$nama = "PERPAJAKAN - PPN";
|
|
} else if ($verse==13) {
|
|
$nama = "PUSAT DATA - Informasi";
|
|
} else if ($verse==14) {
|
|
$nama = "PUSAT DATA - Laporan";
|
|
} else if ($verse==15) {
|
|
$nama = "PUSAT DATA - Neraca Berjalan";
|
|
} else if ($verse==16) {
|
|
$nama = "PUSAT DATA - Persediaan Berjalan";
|
|
}
|
|
} else if ($kode=="PR") {
|
|
if ($verse==1) {
|
|
$nama = "TRANSAKSI - Sales Proyek";
|
|
} else if ($verse==2) {
|
|
$nama = "TRANSAKSI - Olah Barang";
|
|
} else if ($verse==3) {
|
|
$nama = "TRANSAKSI - Administrasi";
|
|
} else if ($verse==4) {
|
|
$nama = "TRANSAKSI - Pengawasan";
|
|
} else if ($verse==5) {
|
|
$nama = "PUSAT DATA - Informasi";
|
|
} else if ($verse==6) {
|
|
$nama = "PUSAT DATA - Laporan";
|
|
}
|
|
} else if ($kode=="SP") {
|
|
if ($verse==1) {
|
|
$nama = "TRANSAKSI - Stok Gudang";
|
|
} else if ($verse==2) {
|
|
$nama = "TRANSAKSI - Klaim Produk";
|
|
} else if ($verse==3) {
|
|
$nama = "TRANSAKSI - Otomasi Booster";
|
|
} else if ($verse==4) {
|
|
$nama = "TRANSAKSI - Credit Note";
|
|
} else if ($verse==5) {
|
|
$nama = "TRANSAKSI - Administrasi";
|
|
} else if ($verse==6) {
|
|
$nama = "TRANSAKSI - Pricelist";
|
|
} else if ($verse==7) {
|
|
$nama = "PUSAT DATA - Cetak Dokumen";
|
|
} else if ($verse==8) {
|
|
$nama = "PUSAT DATA - Informasi";
|
|
} else if ($verse==9) {
|
|
$nama = "PUSAT DATA - Laporan";
|
|
}
|
|
} else if ($kode=="SV") {
|
|
if ($verse==1) {
|
|
$nama = "TRANSAKSI - Stok Internal";
|
|
} else if ($verse==2) {
|
|
$nama = "TRANSAKSI - Terima Service";
|
|
} else if ($verse==3) {
|
|
$nama = "TRANSAKSI - Pengerjaan";
|
|
} else if ($verse==4) {
|
|
$nama = "ADMINISTRASI - SJ Service";
|
|
} else if ($verse==5) {
|
|
$nama = "PUSAT DATA - Cetak Dokumen";
|
|
} else if ($verse==6) {
|
|
$nama = "PUSAT DATA - Informasi";
|
|
} else if ($verse==7) {
|
|
$nama = "PUSAT DATA - Laporan";
|
|
}
|
|
} else if ($kode=="SB") {
|
|
if ($verse==1) {
|
|
$nama = "TRANSAKSI - Keluar Masuk";
|
|
} else if ($verse==2) {
|
|
$nama = "TRANSAKSI - Konsinyasi";
|
|
} else if ($verse==3) {
|
|
$nama = "TRANSAKSI - Modifikasi";
|
|
} else if ($verse==4) {
|
|
$nama = "TRANSAKSI - Mutasi Barang";
|
|
} else if ($verse==5) {
|
|
$nama = "TRANSAKSI - Peminjaman";
|
|
} else if ($verse==6) {
|
|
$nama = "TRANSAKSI - Pending";
|
|
} else if ($verse==7) {
|
|
$nama = "TRANSAKSI - Penggantian";
|
|
} else if ($verse==8) {
|
|
$nama = "TRANSAKSI - Service";
|
|
} else if ($verse==9) {
|
|
$nama = "TRANSAKSI - Sewa";
|
|
} else if ($verse==10) {
|
|
$nama = "TRANSAKSI - Stok Antik";
|
|
} else if ($verse==11) {
|
|
$nama = "TRANSAKSI - Stok Opname";
|
|
} else if ($verse==12) {
|
|
$nama = "TRANSAKSI - Ubah SN Beli";
|
|
} else if ($verse==13) {
|
|
$nama = "PUSAT DATA - Cetak Dokumen";
|
|
} else if ($verse==14) {
|
|
$nama = "PUSAT DATA - Informasi";
|
|
} else if ($verse==15) {
|
|
$nama = "PUSAT DATA - Laporan";
|
|
}
|
|
}
|
|
|
|
$value = 0;
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, $kode, $nama);
|
|
if ($datShm==FALSE) {
|
|
$cekShm = $this->Amod->getData_Menu_byKODE_byNAMA($kode, $nama);
|
|
if ($cekShm==TRUE) {
|
|
$input = [
|
|
'KARYAWAN_ID' => $id_karyawan,
|
|
'MENU_ID' => $cekShm[0]['ID_MENU'],
|
|
'AKSES_ID' => $akses,
|
|
'TIMESTAMP' => $timestamp
|
|
];
|
|
$action = $this->Amod->create('set_hakmenu', $input);
|
|
$value = 1;
|
|
} else {
|
|
$value = 2;
|
|
}
|
|
} else {
|
|
$update = [
|
|
'AKSES_ID' => $akses,
|
|
'TIMESTAMP' => $timestamp
|
|
];
|
|
$action = $this->Amod->update('set_hakmenu', $update, 'ID_SHM', $datShm[0]['ID_SHM']);
|
|
|
|
$value = 1;
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
}
|
|
|
|
// SUBMENU TRANSAKSI - Hak SO
|
|
public function KO_Sub1_HakSo_1() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$tgl = date('Y-m-d');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "KO", "TRANSAKSI - Hak SO");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$datShas = $this->Amod->getData_SetHakAdminSo_groupKARYAWAN();
|
|
$no = 0;
|
|
foreach ($datShas as $key) {
|
|
$detailShas = $this->Amod->getData_SetHakAdminSo_byKARYAWAN($key['KARYAWAN_ID']);
|
|
$datShas[$no++] += ['LIST' => $detailShas];
|
|
}
|
|
|
|
$datKaryawan = $this->Amod->getData_Karyawan_bySTATUS(1);
|
|
$datSales = $this->Amod->getData_Karyawan_allSales();
|
|
|
|
$data = array(
|
|
'sidebar' => "menu konfigurasi",
|
|
'navChild' => "konfigurasi hakso",
|
|
'shas' => $datShas,
|
|
'karyawan' => $datKaryawan,
|
|
'sales' => $datSales,
|
|
'tgl' => $tgl,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil,
|
|
);
|
|
$this->load->view('proses/KO_Sub1_HakSo_1', $data);
|
|
}
|
|
|
|
public function KO_Tambah_Sub1_B1_DataSetHakAdminSo() {
|
|
$id_karyawan = $this->input->post('id_karyawannew');
|
|
$id_sales = $this->input->post('id_salesnew');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
foreach ($id_sales as $key) {
|
|
$datShas = $this->Amod->getData_SetHakAdminSo_byKARYAWAN_byHAK($id_karyawan, $key);
|
|
if ($datShas==TRUE) {
|
|
$update = [
|
|
'TS_SHAS' => $timestamp
|
|
];
|
|
$action = $this->Amod->update('set_hakadminso', $update, 'ID_SHAS', $datShas[0]['ID_SHAS']);
|
|
} else {
|
|
$input = [
|
|
'KARYAWAN_ID' => $id_karyawan,
|
|
'HAK_ID' => $key,
|
|
'TS_SHAS' => $timestamp
|
|
];
|
|
$action = $this->Amod->create('set_hakadminso', $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 KO_Hapus_Sub1_B1_DataSetHakAdminSo() {
|
|
$id_karyawan = $this->input->post('id_karyawandel');
|
|
$id_hak = $this->input->post('id_hakdel');
|
|
|
|
$datShas = $this->Amod->getData_SetHakAdminSo_byKARYAWAN_byHAK($id_karyawan, $id_hak);
|
|
if ($datShas==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$action = $this->Amod->delete('set_hakadminso', $datShas[0]['ID_SHAS'], 'ID_SHAS');
|
|
|
|
if ($action) {
|
|
$this->session->set_flashdata('success', 'dihapus');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
} else {
|
|
$this->session->set_flashdata('failed', 'dihapus');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
}
|
|
|
|
// SUBMENU TRANSAKSI - Hari Libur
|
|
public function KO_Sub1_HariLibur_1() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$tgl = date('Y-m-d');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "KO", "TRANSAKSI - Hari Libur");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$datShl = $this->Amod->getData_SetHariLibur();
|
|
$no = 0;
|
|
foreach ($datShl as $key) {
|
|
if (strtotime($key['TGL_SHL'])<strtotime($tgl)) {
|
|
$lock = 1;
|
|
} else {
|
|
$lock = 0;
|
|
}
|
|
$datShl[$no++] += ['LOCK' => $lock];
|
|
}
|
|
|
|
$data = array(
|
|
'sidebar' => "menu konfigurasi",
|
|
'navChild' => "konfigurasi harilibur",
|
|
'shl' => $datShl,
|
|
'tgl' => $tgl,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil,
|
|
);
|
|
$this->load->view('proses/KO_Sub1_HariLibur_1', $data);
|
|
}
|
|
|
|
public function KO_Tambah_Sub1_C1_DataSetHariLibur() {
|
|
$tgl_shl = $this->input->post('tgl_shlnew');
|
|
$jenis_shl = $this->input->post('jenis_shlnew');
|
|
$nama_shl = $this->input->post('nama_shlnew');
|
|
|
|
$input = [
|
|
'TGL_SHL' => $tgl_shl,
|
|
'JENIS_SHL' => $jenis_shl,
|
|
'NAMA_SHL' => $nama_shl
|
|
];
|
|
$action = $this->Amod->create('set_harilibur', $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 KO_Ubah_Sub1_C1_DataSetHariLibur() {
|
|
$id_shl = $this->input->post('id_shled');
|
|
$tgl_shl = $this->input->post('tgl_shled');
|
|
$jenis_shl = $this->input->post('jenis_shled');
|
|
$nama_shl = $this->input->post('nama_shled');
|
|
|
|
$datShl = $this->Amod->getData_SetHariLibur_byID($id_shl);
|
|
if ($datShl==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$update = [
|
|
'TGL_SHL' => $tgl_shl,
|
|
'JENIS_SHL' => $jenis_shl,
|
|
'NAMA_SHL' => $nama_shl
|
|
];
|
|
$action = $this->Amod->update('set_harilibur', $update, 'ID_SHL', $id_shl);
|
|
|
|
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 KO_Hapus_Sub1_C1_DataSetHariLibur() {
|
|
$id_shl = $this->input->post('id_shldel');
|
|
|
|
$datShl = $this->Amod->getData_SetHariLibur_byID($id_shl);
|
|
if ($datShl==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$action = $this->Amod->delete('set_harilibur', $id_shl, 'ID_SHL');
|
|
|
|
if ($action) {
|
|
$this->session->set_flashdata('success', 'dihapus');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
} else {
|
|
$this->session->set_flashdata('failed', 'dihapus');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
}
|
|
|
|
// SUBMENU TRANSAKSI - Komisi NonGp
|
|
public function KO_Sub1_KomisiNonGp_1() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "KO", "TRANSAKSI - Komisi NonGP");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$datJenis = $this->Amod->getData_Jenis_bySTATUS(1);
|
|
|
|
$data = array(
|
|
'sidebar' => "menu konfigurasi",
|
|
'navChild' => "konfigurasi komisinongp",
|
|
'jenis' => $datJenis,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil,
|
|
);
|
|
$this->load->view('proses/KO_Sub1_KomisiNonGp_1', $data);
|
|
}
|
|
|
|
public function KO_Ubah_Sub1_D1_DataJenis() {
|
|
$id_jenis = $this->input->post('id_jenised');
|
|
$komisi_dealer = $this->input->post('komisi_dealered');
|
|
$komisi_user = $this->input->post('komisi_usered');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$datJenis = $this->Amod->getData_Jenis_byID($id_jenis);
|
|
if ($datJenis==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$cekNilai = is_numeric($komisi_dealer);
|
|
if ($cekNilai==FALSE) {
|
|
$komisi_dealer = 0;
|
|
}
|
|
|
|
$cekNilai = is_numeric($komisi_user);
|
|
if ($cekNilai==FALSE) {
|
|
$komisi_user = 0;
|
|
}
|
|
|
|
$update = [
|
|
'KOMISI_DEALER' => $komisi_dealer,
|
|
'KOMISI_USER' => $komisi_user,
|
|
'UBAH_JENIS' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('jenis', $update, 'ID_JENIS', $id_jenis);
|
|
|
|
if ($action) {
|
|
$this->session->set_flashdata('success', 'diubah');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
} else {
|
|
$this->session->set_flashdata('failed', 'diubah');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
}
|
|
|
|
// SUBMENU TRANSAKSI - Rumus GP
|
|
public function KO_Sub1_RumusGp_1() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "KO", "TRANSAKSI - Rumus Gp");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$datRgp = $this->Amod->getData_RumusGp_bySTATUS(1);
|
|
$no = 0;
|
|
foreach ($datRgp as $key) {
|
|
$countDrgp = $this->Amod->getCount_DaftarRumusGp_byRGP($key['ID_RGP']);
|
|
if ($countDrgp>0) {
|
|
$lock = 1;
|
|
} else {
|
|
$lock = 0;
|
|
}
|
|
$datRgp[$no++] += ['LOCK' => $lock];
|
|
}
|
|
|
|
$data = array(
|
|
'sidebar' => "menu konfigurasi",
|
|
'navChild' => "konfigurasi rumusgp",
|
|
'rgp' => $datRgp,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil,
|
|
);
|
|
$this->load->view('proses/KO_Sub1_RumusGp_1', $data);
|
|
}
|
|
|
|
public function KO_Ambil_Sub1_DataDaftarRumusGp() {
|
|
$id_rgp = $this->input->post('id_rgp');
|
|
|
|
$data = $this->Amod->getData_DaftarRumusGp_byRGP($id_rgp);
|
|
$datRgp = $this->Amod->getData_RumusGp_byID($id_rgp);
|
|
|
|
$this->output_json([
|
|
'value' => 1,
|
|
'total' => sizeof($data),
|
|
'data' => $data,
|
|
'nama_rgp' => $datRgp[0]['NAMA_RGP'],
|
|
]);
|
|
}
|
|
|
|
public function KO_Tambah_Sub1_E1_DataRumusGp() {
|
|
$jenis_rgp = $this->input->post('jenis_rgpnew');
|
|
$nama_rgp = $this->input->post('nama_rgpnew');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$datRgp = $this->Amod->getData_RumusGp_byNAMA($nama_rgp);
|
|
if ($datRgp==TRUE AND $datRgp[0]['STATUS_RGP']==1) {
|
|
$this->session->set_flashdata('duplicate_data', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
if ($datRgp==FALSE) {
|
|
$input = [
|
|
'JENIS_RGP' => $jenis_rgp,
|
|
'NAMA_RGP' => $nama_rgp,
|
|
'STATUS_RGP' => '1',
|
|
'TAMBAH_RGP' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->create('rumus_gp', $input);
|
|
} else {
|
|
$update = [
|
|
'JENIS_RGP' => $jenis_rgp,
|
|
'STATUS_RGP' => '1',
|
|
'TAMBAH_RGP' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('rumus_gp', $update, 'ID_RGP', $datRgp[0]['ID_RGP']);
|
|
}
|
|
|
|
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 KO_Ubah_Sub1_E1_DataRumusGp() {
|
|
$id_rgp = $this->input->post('id_rgped');
|
|
$jenis_rgp = $this->input->post('jenis_rgped');
|
|
$nama_rgp = $this->input->post('nama_rgped');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$datRgp = $this->Amod->getData_RumusGp_byID($id_rgp);
|
|
if ($datRgp==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$cekRgp = $this->Amod->getData_RumusGp_byNAMA($nama_rgp, $id_rgp);
|
|
if ($cekRgp==TRUE AND $cekRgp[0]['STATUS_RGP']==1) {
|
|
$this->session->set_flashdata('duplicate_data', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$update = [
|
|
'JENIS_RGP' => $jenis_rgp,
|
|
'NAMA_RGP' => $nama_rgp,
|
|
'UBAH_RGP' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('rumus_gp', $update, 'ID_RGP', $id_rgp);
|
|
|
|
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 KO_Sembunyi_Sub1_E1_DataRumusGp() {
|
|
$id_rgp = $this->input->post('id_rgphid');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$datRgp = $this->Amod->getData_RumusGp_byID_bySTATUS($id_rgp, 1);
|
|
if ($datRgp==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$update = [
|
|
'STATUS_RGP' => '0',
|
|
'SEMBUNYI_RGP' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('rumus_gp', $update, 'ID_RGP', $id_rgp);
|
|
|
|
if ($action) {
|
|
$this->session->set_flashdata('success', 'disembunyikan');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
} else {
|
|
$this->session->set_flashdata('failed', 'disembunyikan');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
}
|
|
|
|
public function KO_Simpan_Sub1_E1_DataDaftarRumusGp() {
|
|
$id_rgp = $this->input->post('id_rgp');
|
|
$bawah_drgp = $this->input->post('bawah_drgp');
|
|
$atas_drgp = $this->input->post('atas_drgp');
|
|
$rate_drgp = $this->input->post('rate_drgp');
|
|
$bawah_drgp = str_replace(',', '.', $bawah_drgp);
|
|
$atas_drgp = str_replace(',', '.', $atas_drgp);
|
|
$rate_drgp = str_replace(',', '.', $rate_drgp);
|
|
|
|
//Check Konsistensi Data
|
|
$value = 0;
|
|
$datRgp = $this->Amod->getData_RumusGp_byID($id_rgp);
|
|
if ($datRgp==FALSE) {
|
|
$value = 5;
|
|
} else {
|
|
if ($bawah_drgp>$atas_drgp) {
|
|
$value = 4;
|
|
} else {
|
|
$countDrgp = $this->Amod->getCount_DaftarRumusGp_byRGP($id_rgp);
|
|
if ($countDrgp==0) {
|
|
if ($bawah_drgp>0) {
|
|
$value = 3;
|
|
}
|
|
}
|
|
if ($value==0) {
|
|
if ($countDrgp>0) {
|
|
$datDrgp = $this->Amod->getData_DaftarRumusGp_byRGP_orderDESC_limit1($id_rgp);
|
|
if ($bawah_drgp<$datDrgp[0]['ATAS_DRGP']) {
|
|
$value = 2;
|
|
}
|
|
}
|
|
if ($value==0) {
|
|
$rate_drgp = ($rate_drgp/100);
|
|
$input = [
|
|
'BAWAH_DRGP' => $bawah_drgp,
|
|
'ATAS_DRGP' => $atas_drgp,
|
|
'RATE_DRGP' => $rate_drgp,
|
|
'RGP_ID' => $id_rgp
|
|
];
|
|
$action = $this->Amod->create('daftar_rumusgp', $input);
|
|
|
|
$value = 1;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
|
|
}
|
|
|
|
public function KO_Ubah_Sub1_E1_DataDaftarRumusGp() {
|
|
$id_rgp = $this->input->post('id_rgp');
|
|
$id_drgp = $this->input->post('id_drgp');
|
|
$bawah_drgp = $this->input->post('bawah_drgp');
|
|
$atas_drgp = $this->input->post('atas_drgp');
|
|
$rate_drgp = $this->input->post('rate_drgp');
|
|
$bawah_drgp = str_replace(',', '.', $bawah_drgp);
|
|
$atas_drgp = str_replace(',', '.', $atas_drgp);
|
|
$rate_drgp = str_replace(',', '.', $rate_drgp);
|
|
|
|
//Check Konsistensi Data
|
|
$value = 0;
|
|
$datRgp = $this->Amod->getData_RumusGp_byID($id_rgp);
|
|
if ($datRgp==FALSE) {
|
|
$value = 6;
|
|
} else {
|
|
$cekDrgp = $this->Amod->getData_DaftarRumusGp_byID($id_drgp);
|
|
if ($cekDrgp==FALSE) {
|
|
$value = 5;
|
|
} else {
|
|
if ($bawah_drgp>$atas_drgp) {
|
|
$value = 4;
|
|
} else {
|
|
$countDrgp = $this->Amod->getCount_DaftarRumusGp_byRGP($id_rgp);
|
|
if ($countDrgp==0) {
|
|
if ($bawah_drgp>0) {
|
|
$value = 3;
|
|
}
|
|
}
|
|
if ($value==0) {
|
|
if ($countDrgp>0) {
|
|
$datDrgp = $this->Amod->getData_DaftarRumusGp_byRGP_orderDESC_limit1($id_rgp, $id_drgp);
|
|
if ($bawah_drgp<$datDrgp[0]['ATAS_DRGP']) {
|
|
$value = 2;
|
|
}
|
|
}
|
|
if ($value==0) {
|
|
$rate_drgp = ($rate_drgp/100);
|
|
$update = [
|
|
'BAWAH_DRGP' => $bawah_drgp,
|
|
'ATAS_DRGP' => $atas_drgp,
|
|
'RATE_DRGP' => $rate_drgp
|
|
];
|
|
$action = $this->Amod->update('daftar_rumusgp', $update, 'ID_DRGP', $id_drgp);
|
|
|
|
$value = 1;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
|
|
}
|
|
|
|
public function KO_Hapus_Sub1_E1_DataDaftarRumusGp() {
|
|
$id_rgp = $this->input->post('id_rgp');
|
|
$id_drgp = $this->input->post('id_drgp');
|
|
|
|
//Check Konsistensi Data
|
|
$value = 0;
|
|
$datRgp = $this->Amod->getData_RumusGp_byID($id_rgp);
|
|
if ($datRgp==FALSE) {
|
|
$value = 3;
|
|
} else {
|
|
$datDrgp = $this->Amod->getData_DaftarRumusGp_byID($id_drgp);
|
|
if ($datDrgp==FALSE) {
|
|
$value = 2;
|
|
} else {
|
|
$action = $this->Amod->delete('daftar_rumusgp', $id_drgp, 'ID_DRGP');
|
|
$value = 1;
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
|
|
}
|
|
|
|
// SUBMENU TRANSAKSI - Sales Produk
|
|
public function KO_Sub1_SalesProduk_1() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "KO", "TRANSAKSI - Sales Produk");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$datSales = $this->Amod->getData_Karyawan_allSales();
|
|
$datMerk = $this->Amod->getData_Merk_bySTATUS(1);
|
|
$datProduk = $this->Amod->getData_Produk_bySTATUS(1);
|
|
$datSp = $this->Amod->getData_SetSalesProduk();
|
|
|
|
$data = array(
|
|
'sidebar' => "menu konfigurasi",
|
|
'navChild' => "konfigurasi salesproduk",
|
|
'sales' => $datSales,
|
|
'merk' => $datMerk,
|
|
'produk' => $datProduk,
|
|
'sp' => $datSp,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil,
|
|
);
|
|
$this->load->view('proses/KO_Sub1_SalesProduk_1', $data);
|
|
}
|
|
|
|
public function KO_Tambah_Sub1_F1_DataSetSalesProduk() {
|
|
$id_sales = $this->input->post('id_salesnew');
|
|
$id_merk = $this->input->post('id_merknew');
|
|
$id_produk = $this->input->post('id_produknew');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$datSsp = $this->Amod->getData_SetSalesProduk_byMERK_byPRODUK($id_merk, $id_produk);
|
|
if ($datSsp==TRUE) {
|
|
$this->session->set_flashdata('salesproduk_same', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
if ($id_sales=="") {
|
|
$id_sales = NULL;
|
|
}
|
|
|
|
$input = [
|
|
'MERK_ID' => $id_merk,
|
|
'PRODUK_ID' => $id_produk,
|
|
'SALES_ID' => $id_sales,
|
|
'LAST_SSP' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->create('set_salesproduk', $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 KO_Ubah_Sub1_F1_DataSetSalesProduk() {
|
|
$id_ssp = $this->input->post('id_ssped');
|
|
$id_sales = $this->input->post('id_salesed');
|
|
$id_merk = $this->input->post('id_merked');
|
|
$id_produk = $this->input->post('id_produked');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$datSsp = $this->Amod->getData_SetSalesProduk_byID($id_ssp);
|
|
if ($datSsp==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$cekSsp = $this->Amod->getData_SetSalesProduk_byMERK_byPRODUK($id_merk, $id_produk, $id_ssp);
|
|
if ($cekSsp==TRUE) {
|
|
$this->session->set_flashdata('salesproduk_same', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
if ($id_sales=="") {
|
|
$id_sales = NULL;
|
|
}
|
|
|
|
$update = [
|
|
'MERK_ID' => $id_merk,
|
|
'PRODUK_ID' => $id_produk,
|
|
'SALES_ID' => $id_sales,
|
|
'LAST_SSP' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('set_salesproduk', $update, 'ID_SSP', $id_ssp);
|
|
|
|
if ($action) {
|
|
$this->session->set_flashdata('success', 'diubah');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
} else {
|
|
$this->session->set_flashdata('failed', 'diubah');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
}
|
|
|
|
// SUBMENU TRANSAKSI - Tertanda
|
|
public function KO_Sub1_Tertanda_1() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "KO", "TRANSAKSI - Tertanda");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$datKaryawan = $this->Amod->getData_Karyawan_bySTATUS(1);
|
|
$datSttd = $this->Amod->getData_SetTertanda();
|
|
|
|
$data = array(
|
|
'sidebar' => "menu konfigurasi",
|
|
'navChild' => "konfigurasi tertanda",
|
|
'karyawan' => $datKaryawan,
|
|
'sttd' => $datSttd,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil,
|
|
);
|
|
$this->load->view('proses/KO_Sub1_Tertanda_1', $data);
|
|
}
|
|
|
|
public function KO_Ubah_Sub1_G1_DataSetTertanda() {
|
|
$id_sttd = $this->input->post('id_sttded');
|
|
$id_karyawan = $this->input->post('id_karyawaned');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$update = [
|
|
'KARYAWAN_ID' => $id_karyawan,
|
|
'TERAKHIR_STTD' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('set_tertanda', $update, 'ID_STTD', $id_sttd);
|
|
|
|
if ($action) {
|
|
$this->session->set_flashdata('success', 'diubah');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
} else {
|
|
$this->session->set_flashdata('failed', 'diubah');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
}
|
|
|
|
//Daftar Menu PB [Pembelian]
|
|
//SUBMENU TAMPILAN
|
|
public function PB_Transaksi_SuratJalan_1() { // Validasi
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$now = date('Y-m-d');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "PB", "TRANSAKSI - Surat Jalan");
|
|
if ($datShm==TRUE) {
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
$id_menu = $datShm[0]['MENU_ID'];
|
|
} else {
|
|
$hak = 0;
|
|
$id_menu = 0;
|
|
$tampil = "TIDAK BERHAK";
|
|
}
|
|
|
|
$datPak = $this->Amod->getData_PeriodeAkuntansi_byPERIODE_bySTATUS($now, 0);
|
|
if ($datPak==TRUE) {
|
|
$kunciTombol = 0;
|
|
} else {
|
|
$kunciTombol = 1;
|
|
}
|
|
|
|
$datSupplier = $this->Amod->getData_Supplier_bySTATUS(1);
|
|
$datCorp = $this->Amod->getData_Corp_bySTATUS(1);
|
|
|
|
$datStpos = $this->Amod->getData_SetTogglePosisi_byKARYAWAN_byMENU($id_karyawan, $id_menu);
|
|
if ($datStpos==FALSE) { $posisiToggle = 0; } else { $posisiToggle = $datStpos[0]['AKTIF_STPOS']; }
|
|
|
|
$data = array(
|
|
'sidebar' => "menu pembelian",
|
|
'navChild' => "pembelian suratjalan",
|
|
'hak' => $hak,
|
|
'tampil' => $tampil,
|
|
'kunciTombol' => $kunciTombol,
|
|
'tgl' => $now,
|
|
'corp' => $datCorp,
|
|
'supplier' => $datSupplier,
|
|
'id_menu' => $id_menu,
|
|
'posisiToggle' => $posisiToggle,
|
|
);
|
|
$this->load->view('proses/PB_Transaksi_SuratJalan_1', $data);
|
|
}
|
|
|
|
public function PB_Transaksi_NotaPembelian_1() { // Validasi
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$now = date('Y-m-d');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "PB", "TRANSAKSI - Nota Pembelian");
|
|
if ($datShm==TRUE) {
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
$id_menu = $datShm[0]['MENU_ID'];
|
|
} else {
|
|
$hak = 0;
|
|
$id_menu = 0;
|
|
$tampil = "TIDAK BERHAK";
|
|
}
|
|
|
|
$cekPak = $this->Amod->getData_PeriodeAkuntansi_byPERIODE($now, 0);
|
|
if ($cekPak==TRUE) {
|
|
$datPak = $this->Amod->getData_PeriodeAkuntansi_status0();
|
|
$batas = $datPak[0]['AKHIR_PAK'];
|
|
} else {
|
|
$batas = $cekPak[0]['AKHIR_PAK'];
|
|
}
|
|
$batas = $this->Amod->generate_subDay($batas, 3);
|
|
if (strtotime($now)>=strtotime($batas)) {
|
|
$mutasi = 1;
|
|
} else {
|
|
$mutasi = 0;
|
|
}
|
|
|
|
$datCorp = $this->Amod->getData_Corp_bySTATUS(1);
|
|
$datKaryawan = $this->Amod->getData_Karyawan_forAkuntansi();
|
|
$datSupplier = $this->Amod->getData_Supplier_bySTATUS(1);
|
|
|
|
$datStpos = $this->Amod->getData_SetTogglePosisi_byKARYAWAN_byMENU($id_karyawan, $id_menu);
|
|
if ($datStpos==FALSE) { $posisiToggle = 0; } else { $posisiToggle = $datStpos[0]['AKTIF_STPOS']; }
|
|
|
|
$data = array(
|
|
'sidebar' => "menu pembelian",
|
|
'navChild' => "pembelian notapembelian",
|
|
'hak' => $hak,
|
|
'tampil' => $tampil,
|
|
'mutasi' => $mutasi,
|
|
'tgl' => $now,
|
|
'corp' => $datCorp,
|
|
'karyawan' => $datKaryawan,
|
|
'supplier' => $datSupplier,
|
|
'id_menu' => $id_menu,
|
|
'posisiToggle' => $posisiToggle,
|
|
);
|
|
$this->load->view('proses/PB_Transaksi_NotaPembelian_1', $data);
|
|
}
|
|
|
|
public function PB_Transaksi_ReturPembelian_1() { // Validasi
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$now = date('Y-m-d');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "PB", "TRANSAKSI - Retur Pembelian");
|
|
if ($datShm==TRUE) {
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
$id_menu = $datShm[0]['MENU_ID'];
|
|
} else {
|
|
$hak = 0;
|
|
$id_menu = 0;
|
|
$tampil = "TIDAK BERHAK";
|
|
}
|
|
|
|
$cekRb = $this->Amod->getData_ReturPembelian_byKARYAWAN_beforeTGL_statusNull($id_karyawan, $now);
|
|
if ($cekRb==TRUE) {
|
|
$datDrb = $this->Amod->getData_DaftarReturBeli_byRB($cekRb[0]['ID_RB']);
|
|
foreach ($datDrb as $key) {
|
|
if ($key['TYPE_JENIS']==1) {
|
|
$datSnrb = $this->Amod->getData_SnReturBeli_byDRB($key['ID_DRB']);
|
|
foreach ($datSnrb as $dat) {
|
|
$datSnStock = $this->Amod->getData_SnStock_byNAMA_bySTATUS($dat['NAMA_SNRB'], 12);
|
|
if ($datSnStock==TRUE) {
|
|
$update = [
|
|
'STATUS_SNSTOCK' => '0'
|
|
];
|
|
$action = $this->Amod->update('sn_stock', $update, 'ID_SNSTOCK', $datSnStock[0]['ID_SNSTOCK']);
|
|
}
|
|
}
|
|
}
|
|
|
|
$datDb = $this->Amod->getData_DaftarBeli_byID($key['DB_ID']);
|
|
$retur_dbLama = $datDb[0]['RETUR_DB'];
|
|
$retur_dbBaru = $retur_dbLama-$key['QTY_DRB'];
|
|
|
|
$update = [
|
|
'RETUR_DB' => $retur_dbBaru
|
|
];
|
|
$action = $this->Amod->update('daftar_beli', $update, 'ID_DB', $key['DB_ID']);
|
|
}
|
|
|
|
$action = $this->Amod->delete('sn_returbeli', $cekRb[0]['ID_RB'], 'RB_ID');
|
|
$action = $this->Amod->delete('daftar_returbeli', $cekRb[0]['ID_RB'], 'RB_ID');
|
|
|
|
$id_rb = $this->Amod->getMax_ID_ReturPembelian();
|
|
$id_rb = $id_rb[0]['ID_RB'];
|
|
|
|
if ($id_rb==$cekRb[0]['ID_RB']) {
|
|
$action = $this->Amod->delete('retur_pembelian', $id_rb, 'ID_RB');
|
|
} else {
|
|
$update = [
|
|
'BATAL_RB' => "Oleh Sistem pada $timestamp",
|
|
'STATUS_RB' => '9'
|
|
];
|
|
$action = $this->Amod->update('retur_pembelian', $update, 'ID_RB', $cekRb[0]['ID_RB']);
|
|
}
|
|
}
|
|
|
|
$datStpos = $this->Amod->getData_SetTogglePosisi_byKARYAWAN_byMENU($id_karyawan, $id_menu);
|
|
if ($datStpos==FALSE) { $posisiToggle = 0; } else { $posisiToggle = $datStpos[0]['AKTIF_STPOS']; }
|
|
|
|
$data = array(
|
|
'sidebar' => "menu pembelian",
|
|
'navChild' => "pembelian retur",
|
|
'hak' => $hak,
|
|
'tampil' => $tampil,
|
|
'tgl' => $now,
|
|
'id_menu' => $id_menu,
|
|
'posisiToggle' => $posisiToggle,
|
|
);
|
|
$this->load->view('proses/PB_Transaksi_ReturPembelian_1', $data);
|
|
}
|
|
|
|
public function PB_Transaksi_OlahPembelian_1() { // Validasi
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$now = date('Y-m-d');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "PB", "TRANSAKSI - Olah Pembelian");
|
|
if ($datShm==TRUE) {
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
$id_menu = $datShm[0]['MENU_ID'];
|
|
} else {
|
|
$hak = 0;
|
|
$id_menu = 0;
|
|
$tampil = "TIDAK BERHAK";
|
|
}
|
|
|
|
$datCorp = $this->Amod->getData_Corp_bySTATUS(1);
|
|
$datStpos = $this->Amod->getData_SetTogglePosisi_byKARYAWAN_byMENU($id_karyawan, $id_menu);
|
|
if ($datStpos==FALSE) { $posisiToggle = 0; } else { $posisiToggle = $datStpos[0]['AKTIF_STPOS']; }
|
|
|
|
$data = array(
|
|
'sidebar' => "menu pembelian",
|
|
'navChild' => "pembelian olah",
|
|
'hak' => $hak,
|
|
'tampil' => $tampil,
|
|
'tgl' => $now,
|
|
'corp' => $datCorp,
|
|
'id_menu' => $id_menu,
|
|
'posisiToggle' => $posisiToggle,
|
|
);
|
|
$this->load->view('proses/PB_Transaksi_OlahPembelian_1', $data);
|
|
}
|
|
|
|
//FUNGSI PEMBELIAN
|
|
public function PB_Ambil_BarangSoBelumMasuk() { // Validasi
|
|
$datHhbso = $this->Amod->getData_HasilHitungBarangSo_status0_2();
|
|
foreach ($datHhbso as $key) {
|
|
$cekDo = $this->Amod->getData_DaftarOrder_byBARANG_status0_3($key['BARANG_ID']);
|
|
if ($cekDo==FALSE) {
|
|
$action = $this->Amod->delete('hasil_hitungbarangso', $key['ID_HHBSO'], 'ID_HHBSO');
|
|
}
|
|
}
|
|
|
|
$datHhbso = $this->Amod->getData_HasilHitungBarangSo_status0_2_orderASC();
|
|
$countHhbso = round((count($datHhbso)/2), 0, PHP_ROUND_HALF_UP);
|
|
$barang01 = "";
|
|
$barang02 = "";
|
|
$no = 1;
|
|
foreach ($datHhbso as $key) {
|
|
$kode = $key['KODE_BARANG'];
|
|
if ($no<=$countHhbso) {
|
|
$barang01 .= "[$no] $kode</br>";
|
|
} else {
|
|
$barang02 .= "[$no] $kode</br>";
|
|
}
|
|
$no++;
|
|
}
|
|
|
|
$this->output_json([
|
|
'barang01' => $barang01,
|
|
'barang02' => $barang02,
|
|
]);
|
|
}
|
|
|
|
public function PB_Ambil_JumlahData() { // Validasi
|
|
$awal = date('Y-m-01');
|
|
$now = date('Y-m-d');
|
|
$akhir = $this->Amod->generate_addMonth($awal, 1);
|
|
$akhir = $this->Amod->generate_subDay($akhir, 1);
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$hak = $this->input->post('hak');
|
|
|
|
$datRb = $this->Amod->getData_ReturPembelian_byKARYAWAN_statusNull($id_karyawan);
|
|
if ($datRb==FALSE) {
|
|
$kode = "Kosong";
|
|
} else {
|
|
$kode = $datRb[0]['KODE_RB'];
|
|
}
|
|
|
|
$pengadaan = $this->Amod->getCount_Pengadaan_bySTATUS(1);
|
|
$gudangbelum = $this->Amod->getCount_Pembelian_statusNull();
|
|
$gudangsudah = $this->Amod->getCount_Pembelian_bySTATUS(0);
|
|
$keusudah = $this->Amod->getCount_Pembelian_bySTATUS_byPERIODE(1, $awal, $akhir);
|
|
$keupotongan = $this->Amod->getCount_Pembelian_bySTATUS_byPERIODE_potonganNotNull(1, $awal, $akhir);
|
|
$returbelum = $this->Amod->getCount_ReturPembelian_bySTATUS(0);
|
|
$returcetak = $this->Amod->getCount_CetakDokumen_byVERSE_byPERIODE(1, $awal, $now);
|
|
$stoktahan = $this->Amod->getCount_Pembelian_tahanNotNull();
|
|
|
|
if ($hak==NULL OR $hak<=1) {
|
|
$olahbeli = $this->Amod->getCount_Pembelian_bySTATUS_byPERIODE(1, $awal, $now);
|
|
$olahfptt = $this->Amod->getCount_Pembelian_bySTATUS_byPERIODE_fpNull_ttNull(1, $awal, $now);
|
|
} else {
|
|
if ($hak==2) {
|
|
$limit = $this->Amod->generate_subMonth($awal, 3);
|
|
} else if ($hak>=3) {
|
|
$limit = $this->Amod->generate_subYear($awal, 1);
|
|
}
|
|
$olahbeli = $this->Amod->getCount_Pembelian_bySTATUS_byPERIODE(1, $limit, $now);
|
|
$olahfptt = $this->Amod->getCount_Pembelian_bySTATUS_byPERIODE_fpNull_ttNull(1, $limit, $now);
|
|
}
|
|
|
|
$this->output_json([
|
|
'kode' => $kode,
|
|
'pengadaan' => $pengadaan,
|
|
'gudangbelum' => $gudangbelum,
|
|
'gudangsudah' => $gudangsudah,
|
|
'keusudah' => $keusudah,
|
|
'keupotongan' => $keupotongan,
|
|
'returbelum' => $returbelum,
|
|
'returcetak' => $returcetak,
|
|
'stoktahan' => $stoktahan,
|
|
'olahbeli' => $olahbeli,
|
|
'olahfptt' => $olahfptt,
|
|
]);
|
|
}
|
|
|
|
public function PB_Ambil_JumlahSnBeli() { // Validasi
|
|
$id_db = $this->input->post('id_db');
|
|
|
|
$countSnb = $this->Amod->getCount_SnBeli_byDB($id_db);
|
|
|
|
$this->output_json([
|
|
'total' => $countSnb
|
|
]);
|
|
}
|
|
|
|
public function PB_Ambil_NilaiPotonganPembelian() { // Validasi
|
|
$id_pembelian = $this->input->post('id_pembelian');
|
|
$potongan_pembelian = $this->input->post('potongan_pembelian');
|
|
$jenis = $this->input->post('jenis');
|
|
|
|
$datPembelian = $this->Amod->getData_Pembelian_byID($id_pembelian);
|
|
$sumHda = $this->Amod->getSum_DaftarBeli_byPEMBELIAN($id_pembelian);
|
|
if ($sumHda[0]['TOTAL']==NULL) {
|
|
$nilaiDpp = 0;
|
|
if ($jenis==1) {
|
|
$potongan_pembelian = 0;
|
|
} else if ($jenis==2) {
|
|
$potongan_pembelian = $datPembelian[0]['POTONGAN_PEMBELIAN'];
|
|
}
|
|
} else {
|
|
$nilaiDpp = $sumHda[0]['TOTAL'];
|
|
if ($potongan_pembelian==NULL) {
|
|
$potongan_pembelian = 0;
|
|
}
|
|
if ($jenis==2) {
|
|
$potongan_pembelian = $datPembelian[0]['POTONGAN_PEMBELIAN'];
|
|
}
|
|
}
|
|
|
|
$nilai_pm = round((($datPembelian[0]['PPN_PEMBELIAN']/100)*$nilaiDpp),2);
|
|
$nilai_pk = round((($datPembelian[0]['PPN_PEMBELIAN']/100)*$potongan_pembelian),2);
|
|
$nilai_hda = $nilaiDpp-$potongan_pembelian+$nilai_pm-$nilai_pk;
|
|
|
|
$this->output_json([
|
|
'nilaiPembelian' => number_format($nilaiDpp,2),
|
|
'nilaiPm' => number_format($nilai_pm,2),
|
|
'nilaiPk' => number_format($nilai_pk,2),
|
|
'nilaiPotongan' => number_format($potongan_pembelian,2),
|
|
'nilaiHda' => number_format($nilai_hda,2),
|
|
]);
|
|
}
|
|
|
|
public function PB_Batal_DataReturPembelian() { // Validasi
|
|
$verse = $this->input->post('verse');
|
|
$id_rb = $this->input->post('id_rb');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$value = 0;
|
|
if ($verse==1) {
|
|
$datRb = $this->Amod->getData_ReturPembelian_byID_statusNull($id_rb);
|
|
} else if ($verse==2) {
|
|
$datRb = $this->Amod->getData_ReturPembelian_byID_bySTATUS($id_rb, 0);
|
|
}
|
|
if ($datRb==FALSE) {
|
|
$value = 2;
|
|
} else {
|
|
$datDrb = $this->Amod->getData_DaftarReturBeli_byRB($id_rb);
|
|
foreach ($datDrb as $key) {
|
|
if ($key['TYPE_JENIS']==1) {
|
|
$datSnrb = $this->Amod->getData_SnReturBeli_byDRB($key['ID_DRB']);
|
|
foreach ($datSnrb as $dat) {
|
|
$datSnStock = $this->Amod->getData_SnStock_byNAMA_bySTATUS($dat['NAMA_SNRB'], 12);
|
|
if ($datSnStock==TRUE) {
|
|
$update = [
|
|
'STATUS_SNSTOCK' => '0'
|
|
];
|
|
$action = $this->Amod->update('sn_stock', $update, 'ID_SNSTOCK', $datSnStock[0]['ID_SNSTOCK']);
|
|
}
|
|
}
|
|
}
|
|
|
|
$datDb = $this->Amod->getData_DaftarBeli_byID($key['DB_ID']);
|
|
$retur_dbLama = $datDb[0]['RETUR_DB'];
|
|
$retur_dbBaru = $retur_dbLama-$key['QTY_DRB'];
|
|
|
|
$update = [
|
|
'RETUR_DB' => $retur_dbBaru
|
|
];
|
|
$action = $this->Amod->update('daftar_beli', $update, 'ID_DB', $key['DB_ID']);
|
|
}
|
|
|
|
$action = $this->Amod->delete('sn_returbeli', $id_rb, 'RB_ID');
|
|
$action = $this->Amod->delete('daftar_returbeli', $id_rb, 'RB_ID');
|
|
|
|
$id_rbMax = $this->Amod->getMax_ID_ReturPembelian();
|
|
$id_rbMax = $id_rbMax[0]['ID_RB'];
|
|
|
|
if ($id_rbMax==$id_rb) {
|
|
$action = $this->Amod->delete('retur_pembelian', $id_rb, 'ID_RB');
|
|
} else {
|
|
$update = [
|
|
'BATAL_RB' => "Oleh $panggilan pada $timestamp",
|
|
'STATUS_RB' => '9'
|
|
];
|
|
$action = $this->Amod->update('retur_pembelian', $update, 'ID_RB', $id_rb);
|
|
}
|
|
|
|
$value = 1;
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value
|
|
]);
|
|
}
|
|
|
|
public function PB_Batal_LinkPengadaan() { // Validasi
|
|
$id_pembelian = $this->input->post('id_pembelian');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$value = 0;
|
|
$datPembelian = $this->Amod->getData_Pembelian_byID($id_pembelian);
|
|
if ($datPembelian==FALSE) {
|
|
$value = 2;
|
|
} else {
|
|
$datDb = $this->Amod->getData_DaftarBeli_byPEMBELIAN($id_pembelian);
|
|
foreach ($datDb as $key) {
|
|
$action = $this->Amod->delete('sn_beli', $key['ID_DB'], 'DB_ID');
|
|
}
|
|
|
|
$action = $this->Amod->delete('daftar_beli', $id_pembelian, 'PEMBELIAN_ID');
|
|
|
|
$update = [
|
|
'REVISI_PEMBELIAN' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('pembelian', $update, 'ID_PEMBELIAN', $id_pembelian);
|
|
|
|
$datPengadaan = $this->Amod->getData_Pengadaan_byPEMBELIAN($id_pembelian);
|
|
$update = [
|
|
'LINK_PENGADAAN' => NULL,
|
|
'PEMBELIAN_ID' => NULL,
|
|
'STATUS_PENGADAAN' => '1'
|
|
];
|
|
$action = $this->Amod->update('pengadaan', $update, 'ID_PENGADAAN', $datPengadaan[0]['ID_PENGADAAN']);
|
|
|
|
$value = 1;
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value
|
|
]);
|
|
}
|
|
|
|
public function PB_Hapus_DataDaftarBeli() { // Validasi
|
|
$id_db = $this->input->post('id_db');
|
|
$id_pembelian = $this->input->post('id_pembelian');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$value = 0;
|
|
$datPembelian = $this->Amod->getData_Pembelian_byID($id_pembelian);
|
|
if ($datPembelian==FALSE) {
|
|
$value = 3;
|
|
} else {
|
|
if ($datPembelian[0]['STATUS_PEMBELIAN']==NULL OR $datPembelian[0]['STATUS_PEMBELIAN']==0) {
|
|
$datDb = $this->Amod->getData_DaftarBeli_byID($id_db);
|
|
if ($datDb==FALSE) {
|
|
$value = 2;
|
|
} else {
|
|
if ($datDb[0]['TYPE_JENIS']==1) {
|
|
$action = $this->Amod->delete('sn_beli', $id_db, 'DB_ID');
|
|
}
|
|
$action = $this->Amod->delete('daftar_beli', $id_db, 'ID_DB');
|
|
|
|
if ($datPembelian[0]['STATUS_PEMBELIAN']==NULL) {
|
|
|
|
} else if ($datPembelian[0]['STATUS_PEMBELIAN']==0) {
|
|
$update = [
|
|
'REVISI_PEMBELIAN' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('pembelian', $update, 'ID_PEMBELIAN', $id_pembelian);
|
|
}
|
|
$value = 1;
|
|
}
|
|
} else {
|
|
$value = 3;
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value
|
|
]);
|
|
}
|
|
|
|
public function PB_Hapus_DataDaftarReturBeli() { // Validasi
|
|
$id_rb = $this->input->post('id_rb');
|
|
$id_drb = $this->input->post('id_drb');
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
|
|
$value = 0;
|
|
$datRb = $this->Amod->getData_ReturPembelian_byID_byKARYAWAN_statusNull($id_rb, $id_karyawan);
|
|
if ($datRb==FALSE) {
|
|
$value = 3;
|
|
} else {
|
|
$datDrb = $this->Amod->getData_DaftarReturBeli_byID($id_drb);
|
|
if ($datDrb==FALSE) {
|
|
$value = 2;
|
|
} else {
|
|
if ($datDrb[0]['TYPE_JENIS']==0) {
|
|
$datDb = $this->Amod->getData_DaftarBeli_byID($datDrb[0]['DB_ID']);
|
|
$retur_db = $datDb[0]['RETUR_DB']-$datDrb[0]['QTY_DRB'];
|
|
$update = [
|
|
'RETUR_DB' => $retur_db
|
|
];
|
|
$action = $this->Amod->update('daftar_beli', $update, 'ID_DB', $datDrb[0]['DB_ID']);
|
|
} else if ($datDrb[0]['TYPE_JENIS']==1) {
|
|
$datSnrb = $this->Amod->getData_SnReturBeli_byDRB($id_drb);
|
|
foreach ($datSnrb as $key) {
|
|
$datSnStock = $this->Amod->getData_SnStock_byNAMA_bySTATUS($key['NAMA_SNRB'], 12);
|
|
if ($datSnStock==TRUE) {
|
|
$update = [
|
|
'STATUS_SNSTOCK' => '0'
|
|
];
|
|
$action = $this->Amod->update('sn_stock', $update, 'ID_SNSTOCK', $datSnStock[0]['ID_SNSTOCK']);
|
|
|
|
$datDbNew = $this->Amod->getData_DaftarBeli_byID($datDrb[0]['DB_ID']);
|
|
$kembaliLama = $datDbNew[0]['RETUR_DB'];
|
|
$kembaliBaru = $kembaliLama-1;
|
|
|
|
$update = [
|
|
'RETUR_DB' => $kembaliBaru
|
|
];
|
|
$action = $this->Amod->update('daftar_beli', $update, 'ID_DB', $datDrb[0]['DB_ID']);
|
|
}
|
|
}
|
|
$action = $this->Amod->delete('sn_returbeli', $id_drb, 'DRB_ID');
|
|
}
|
|
|
|
$action = $this->Amod->delete('daftar_returbeli', $id_drb, 'ID_DRB');
|
|
|
|
$value = 1;
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value
|
|
]);
|
|
}
|
|
|
|
public function PB_Hapus_DataPembelian() { // Validasi
|
|
$id_pembelian = $this->input->post('id_pembelian');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$value = 0;
|
|
$datPembelian = $this->Amod->getData_Pembelian_statusNull($id_pembelian);
|
|
if ($datPembelian==FALSE) {
|
|
$value = 2;
|
|
} else {
|
|
$datPengadaan = $this->Amod->getData_Pengadaan_byPEMBELIAN($id_pembelian);
|
|
if ($datPengadaan==TRUE) {
|
|
$update = [
|
|
'PEMBELIAN_ID' => NULL,
|
|
'LINK_PENGADAAN' => NULL,
|
|
'STATUS_PENGADAAN' => '1'
|
|
];
|
|
$action = $this->Amod->update('pengadaan', $update, 'ID_PENGADAAN', $datPengadaan[0]['ID_PENGADAAN']);
|
|
}
|
|
|
|
$datDb = $this->Amod->getData_DaftarBeli_byPEMBELIAN($id_pembelian);
|
|
foreach ($datDb as $key) {
|
|
$action = $this->Amod->delete('sn_beli', $key['ID_DB'], 'DB_ID');
|
|
}
|
|
|
|
$action = $this->Amod->delete('daftar_beli', $id_pembelian, 'PEMBELIAN_ID');
|
|
|
|
$update = [
|
|
'SJ_PEMBELIAN' => NULL,
|
|
'STATUS_PEMBELIAN' => '9',
|
|
'REVISI_PEMBELIAN' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('pembelian', $update, 'ID_PEMBELIAN', $id_pembelian);
|
|
|
|
$value = 1;
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value
|
|
]);
|
|
}
|
|
|
|
public function PB_Hapus_DataSnBeli() { // Validasi
|
|
$id_snb = $this->input->post('id_snb');
|
|
$id_db = $this->input->post('id_db');
|
|
$id_pembelian = $this->input->post('id_pembelian');
|
|
|
|
$value = 0;
|
|
$datPembelian = $this->Amod->getData_Pembelian_byID($id_pembelian);
|
|
if ($datPembelian==FALSE) {
|
|
$value = 5;
|
|
} else {
|
|
$datDb = $this->Amod->getData_DaftarBeli_byID($id_db);
|
|
if ($datDb==FALSE) {
|
|
$value = 4;
|
|
} else {
|
|
$datSnb = $this->Amod->getData_SnBeli_byID($id_snb);
|
|
if ($datSnb==FALSE) {
|
|
$value = 3;
|
|
} else {
|
|
$countBefore = $this->Amod->getCount_SnBeli_byDB($id_db);
|
|
$action = $this->Amod->delete('sn_beli', $id_snb, 'ID_SNB');
|
|
|
|
if ($countBefore==$datDb[0]['QTY_DB']) {
|
|
$value = 2;
|
|
} else {
|
|
$value = 1;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
}
|
|
|
|
public function PB_Hapus_PotonganPembelian() { // Validasi
|
|
$id_pembelian = $this->input->post('id_pembelian');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
$limit = date('Y-m-01');
|
|
|
|
$value = 0;
|
|
$datPembelian = $this->Amod->getData_Pembelian_byID_bySTATUS($id_pembelian, 1);
|
|
if ($datPembelian==FALSE) {
|
|
$value = 3;
|
|
} else {
|
|
if (strtotime($datPembelian[0]['TGL_PEMBELIAN'])<strtotime($limit)) {
|
|
$value = 2;
|
|
} else {
|
|
$kode_pembelian = $datPembelian[0]['KODE_PEMBELIAN'];
|
|
$sumDb = $this->Amod->getSum_DaftarBeli_byPEMBELIAN($id_pembelian);
|
|
if ($sumDb[0]['TOTAL']==NULL) {
|
|
$nilaiDpp = 0;
|
|
} else {
|
|
$nilaiDpp = $sumDb[0]['TOTAL'];
|
|
}
|
|
|
|
$ppnDpp = round((($datPembelian[0]['PPN_PEMBELIAN']/100)*$nilaiDpp),2);
|
|
$nilaiHda = round(($nilaiDpp+$ppnDpp),2);
|
|
|
|
//Ubah Nilai Hutang Dagang
|
|
$datAkuntansi = $this->Amod->getData_Akuntansi_byKODE($kode_pembelian);
|
|
$datDak1 = $this->Amod->getData_DaftarAkuntansi_byAKUNTANSI_byPEMBELIAN_byPERKIRAAN($datAkuntansi[0]['ID_AKUNTANSI'], $id_pembelian, 15);
|
|
$update = [
|
|
'CIPTA_DAK' => "Oleh $panggilan pada $timestamp",
|
|
'KREDIT_DAK' => $nilaiHda
|
|
];
|
|
$action = $this->Amod->update('daftar_akuntansi', $update, 'ID_DAK', $datDak1[0]['ID_DAK']);
|
|
|
|
$datDak2 = $this->Amod->getData_DaftarAkuntansi_byAKUNTANSI_byPEMBELIAN_byPERKIRAAN($datAkuntansi[0]['ID_AKUNTANSI'], $id_pembelian, 29);
|
|
$action = $this->Amod->delete('daftar_akuntansi', $datDak2[0]['ID_DAK'], 'ID_DAK');
|
|
|
|
$datDak3 = $this->Amod->getData_DaftarAkuntansi_byAKUNTANSI_byPEMBELIAN_byPERKIRAAN($datAkuntansi[0]['ID_AKUNTANSI'], $id_pembelian, 83);
|
|
$action = $this->Amod->delete('daftar_akuntansi', $datDak3[0]['ID_DAK'], 'ID_DAK');
|
|
|
|
//Update Nilai Hasil Hitung Hda
|
|
$this->GE_Kalkulasi_HasilHitungHda("Nilai KREDIT Pembelian", $id_pembelian, $nilaiHda);
|
|
|
|
//Update Nilai Potongan Pembelian
|
|
$update = [
|
|
'POTONGAN_PEMBELIAN' => NULL
|
|
];
|
|
$action = $this->Amod->update('pembelian', $update, 'ID_PEMBELIAN', $id_pembelian);
|
|
|
|
$value = 1;
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
}
|
|
|
|
public function PB_Kunci_DataPembelian() { // Validasi
|
|
$verse = $this->input->post('verse');
|
|
$id_pembelian = $this->input->post('id_pembelian');
|
|
$inv_pembelian = $this->input->post('inv_pembelian');
|
|
$tgl_invbeli = $this->input->post('tgl_invbeli');
|
|
$tt_pembelian = $this->input->post('tt_pembelian');
|
|
$fp_pembelian = $this->input->post('fp_pembelian');
|
|
$ket_hda = $this->input->post('ket_hda');
|
|
$id_karyawan = $this->input->post('id_karyawan');
|
|
$inv_pembelian = strtoupper($inv_pembelian);
|
|
$ket_hda = strtoupper(ltrim(rtrim(preg_replace('/\R+/', " " , $ket_hda))));
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
$now = date('Y-m-d');
|
|
$limit = date('Y-m-01');
|
|
|
|
$value = 0;
|
|
$datPembelian = $this->Amod->getData_Pembelian_byID($id_pembelian);
|
|
if ($verse==1) { // Kunci Stok Normal
|
|
if ($datPembelian==FALSE OR $datPembelian[0]['STATUS_PEMBELIAN']!=0) {
|
|
$value = 3;
|
|
}
|
|
if (strtotime($limit)>strtotime($datPembelian[0]['TGL_PEMBELIAN'])) {
|
|
$value = 3;
|
|
}
|
|
if ($value==0) {
|
|
if ($fp_pembelian=="") {
|
|
if ($datPembelian[0]['NPWP_CORP']==NULL) {
|
|
$fp_pembelian = "00000000000000000";
|
|
} else {
|
|
$fp_pembelian = NULL;
|
|
}
|
|
}
|
|
if ($tt_pembelian=="") {
|
|
if ($datPembelian[0]['NPWP_CORP']==NULL) {
|
|
$tt_pembelian = $now;
|
|
} else {
|
|
$tt_pembelian = NULL;
|
|
}
|
|
}
|
|
}
|
|
} else if ($verse==2) { // Kunci Stok Ditahan
|
|
if ($datPembelian==FALSE OR $datPembelian[0]['ALUR_PEMBELIAN']!=2) {
|
|
$value = 3;
|
|
}
|
|
}
|
|
|
|
if ($value==0) {
|
|
if ($verse==1 AND $datPembelian[0]['ALUR_PEMBELIAN']==1) {
|
|
$pro = 1;
|
|
} else if ($verse==2) {
|
|
$pro = 1;
|
|
} else {
|
|
$pro = 0;
|
|
}
|
|
$datDb = $this->Amod->getData_DaftarBeli_byPEMBELIAN($id_pembelian);
|
|
if ($pro==1) {
|
|
foreach ($datDb as $key) {
|
|
if ($key['TYPE_JENIS']==1) {
|
|
$countSnb = $this->Amod->getCount_SnBeli_byDB($key['ID_DB']);
|
|
if ($countSnb<$key['QTY_DB']) {
|
|
$value = 2;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if ($value==0) {
|
|
foreach ($datDb as $key) {
|
|
if ($pro==1) {
|
|
if ($key['TYPE_JENIS']==1) {
|
|
$datSsp = $this->Amod->getData_SetSalesProduk_byMERK_byPRODUK($key['MERK_ID'], $key['PRODUK_ID']);
|
|
if ($datSsp==TRUE) {
|
|
if ($verse==1) {
|
|
$input = [
|
|
'DB_ID' => $key['ID_DB'],
|
|
'BARANG_ID' => $key['BARANG_ID'],
|
|
'SUPPLIER_ID' => $key['SUPPLIER_ID'],
|
|
'TGL_KPR' => $tgl_invbeli,
|
|
'NOTA_KPR' => $inv_pembelian,
|
|
'TS_KPR' => $timestamp,
|
|
'HARGA_KPR' => round($key['HARGA_DB']*(($key['PPN_PEMBELIAN']+100)/100),2),
|
|
'STATUS_KPR' => '0',
|
|
];
|
|
$action = $this->Amod->create('klaim_program', $input);
|
|
} else if ($verse==2) {
|
|
$input = [
|
|
'DB_ID' => $key['ID_DB'],
|
|
'BARANG_ID' => $key['BARANG_ID'],
|
|
'SUPPLIER_ID' => $key['SUPPLIER_ID'],
|
|
'TGL_KPR' => $key['TGL_INVBELI'],
|
|
'NOTA_KPR' => $key['INV_PEMBELIAN'],
|
|
'TS_KPR' => $timestamp,
|
|
'HARGA_KPR' => round($key['HARGA_DB']*(($key['PPN_PEMBELIAN']+100)/100),2),
|
|
'STATUS_KPR' => '0',
|
|
];
|
|
$action = $this->Amod->create('klaim_program', $input);
|
|
}
|
|
|
|
$id_kpr = $this->Amod->getMax_ID_KlaimProgram();
|
|
$id_kpr = $id_kpr[0]['ID_KPR'];
|
|
} else {
|
|
$id_kpr = NULL;
|
|
}
|
|
|
|
$datSnb = $this->Amod->getData_SnBeli_byDB($key['ID_DB']);
|
|
foreach ($datSnb as $dat) {
|
|
$input = [
|
|
'NAMA_SNSTOCK' => $dat['NAMA_SNB'],
|
|
'GUDANG_SNSTOCK' => $key['GUDANG_PEMBELIAN'],
|
|
'KOP_SNSTOCK' => $key['CORP_ID'],
|
|
'BARANG_ID' => $key['BARANG_ID'],
|
|
'STATUS_SNSTOCK' => '0'
|
|
];
|
|
$action = $this->Amod->create('sn_stock', $input);
|
|
|
|
$id_snstock = $this->Amod->getMax_ID_SnStock();
|
|
$id_snstock = $id_snstock[0]['ID_SNSTOCK'];
|
|
|
|
if ($verse==1) {
|
|
$input = [
|
|
'TGL_HSN' => $now,
|
|
'KODE_BUKTI' => $key['KODE_PEMBELIAN'],
|
|
'SJ_HSN' => $key['SJ_PEMBELIAN'],
|
|
'INV_HSN' => $inv_pembelian,
|
|
'SUPPLIER_ID' => $key['SUPPLIER_ID'],
|
|
'SNSTOCK_ID' => $id_snstock
|
|
];
|
|
} else if ($verse==2) {
|
|
$input = [
|
|
'TGL_HSN' => $now,
|
|
'KODE_BUKTI' => $key['KODE_PEMBELIAN'],
|
|
'SJ_HSN' => $key['SJ_PEMBELIAN'],
|
|
'INV_HSN' => $key['INV_PEMBELIAN'],
|
|
'SUPPLIER_ID' => $key['SUPPLIER_ID'],
|
|
'SNSTOCK_ID' => $id_snstock
|
|
];
|
|
}
|
|
$action = $this->Amod->create('histori_sn', $input);
|
|
|
|
if ($id_kpr!=NULL) {
|
|
$datSnkpr = $this->Amod->getData_SnKlaimProgram_bySNSTOCK($id_snstock);
|
|
if ($datSnkpr==FALSE) {
|
|
$input = [
|
|
'KPR_ID' => $id_kpr,
|
|
'SNSTOCK_ID' => $id_snstock,
|
|
'NAMA_SNKPR' => $dat['NAMA_SNB'],
|
|
'STATUS_SNKPR' => '0'
|
|
];
|
|
$action = $this->Amod->create('sn_klaimprogram', $input);
|
|
} else {
|
|
$update = [
|
|
'KPR_ID' => $id_kpr
|
|
];
|
|
$action = $this->Amod->update('sn_klaimprogram', $update, 'ID_SNKPR', $datSnkpr[0]['ID_SNKPR']);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
$this->GE_Kalkulasi_KuantitiBarang($key['BARANG_ID'], $key['GUDANG_PEMBELIAN'], "Step 1 - PEMBELIAN - Proses Barang", 0, $key['QTY_DB']);
|
|
}
|
|
if ($verse==1) {
|
|
$this->GE_Kalkulasi_HistoriKuantiti($key['BARANG_ID'], "Step 1 - PEMBELIAN - Proses Barang", 0, $key['QTY_DB'], $key['KODE_PEMBELIAN'], $inv_pembelian, $key['ID_DB']);
|
|
}
|
|
}
|
|
|
|
if ($verse==1) {
|
|
$sumHda = $this->Amod->getSum_DaftarBeli_byPEMBELIAN($id_pembelian);
|
|
if ($sumHda[0]['TOTAL']==NULL) {
|
|
$dpp = 0;
|
|
} else {
|
|
$dpp = $sumHda[0]['TOTAL'];
|
|
}
|
|
|
|
$pajak_masukan = round(($dpp*($datPembelian[0]['PPN_PEMBELIAN']/100)),2);
|
|
$kredit_dak = round(($dpp+$pajak_masukan),2);
|
|
|
|
if ($kredit_dak==0) {
|
|
$input = [
|
|
'PEMBELIAN_ID' => $id_pembelian,
|
|
'SUPPLIER_ID' => $datPembelian[0]['SUPPLIER_ID'],
|
|
'CORP_ID' => $datPembelian[0]['CORP_ID'],
|
|
'DEBET_HHHDA' => '0',
|
|
'KREDIT_HHHDA' => '0',
|
|
'STATUS_HHHDA' => '1',
|
|
'LAST_HHHDA' => $timestamp,
|
|
'TGLLOCK_HHHDA' => $now,
|
|
'LUNAS_HHHDA' => $datPembelian[0]['KODE_PEMBELIAN'],
|
|
];
|
|
$action = $this->Amod->create('hasil_hitunghda', $input);
|
|
} else {
|
|
$input = [
|
|
'PEMBELIAN_ID' => $id_pembelian,
|
|
'SUPPLIER_ID' => $datPembelian[0]['SUPPLIER_ID'],
|
|
'CORP_ID' => $datPembelian[0]['CORP_ID'],
|
|
'DEBET_HHHDA' => '0',
|
|
'KREDIT_HHHDA' => $kredit_dak,
|
|
'STATUS_HHHDA' => '0',
|
|
'LAST_HHHDA' => $timestamp
|
|
];
|
|
$action = $this->Amod->create('hasil_hitunghda', $input);
|
|
}
|
|
|
|
$input = [
|
|
'CIPTA_AKUNTANSI' => "Oleh $panggilan pada $timestamp",
|
|
'TGL_AKUNTANSI' => $now,
|
|
'KODE_AKUNTANSI' => $datPembelian[0]['KODE_PEMBELIAN'],
|
|
'STATUS_AKUNTANSI' => '1',
|
|
];
|
|
$action = $this->Amod->create('akuntansi', $input);
|
|
|
|
$id_akuntansi = $this->Amod->getMax_ID_Akuntansi();
|
|
$id_akuntansi = $id_akuntansi[0]['ID_AKUNTANSI'];
|
|
|
|
$input = [
|
|
'AKUNTANSI_ID' => $id_akuntansi,
|
|
'CIPTA_DAK' => "Oleh $panggilan pada $timestamp",
|
|
'JENIS_DAK' => '0',
|
|
'PERKIRAAN_ID' => '15',
|
|
'DEBET_DAK' => '0',
|
|
'KREDIT_DAK' => $kredit_dak,
|
|
'KET_DAK' => $ket_hda,
|
|
'SUPPLIER_ID' => $datPembelian[0]['SUPPLIER_ID'],
|
|
'PEMBELIAN_ID' => $id_pembelian
|
|
];
|
|
$action = $this->Amod->create('daftar_akuntansi', $input);
|
|
|
|
$input = [
|
|
'AKUNTANSI_ID' => $id_akuntansi,
|
|
'CIPTA_DAK' => "Oleh $panggilan pada $timestamp",
|
|
'JENIS_DAK' => '0',
|
|
'PERKIRAAN_ID' => '27',
|
|
'DEBET_DAK' => $dpp,
|
|
'KREDIT_DAK' => '0',
|
|
'KET_DAK' => $ket_hda,
|
|
'SUPPLIER_ID' => $datPembelian[0]['SUPPLIER_ID'],
|
|
'PEMBELIAN_ID' => $id_pembelian
|
|
];
|
|
$action = $this->Amod->create('daftar_akuntansi', $input);
|
|
|
|
if ($datPembelian[0]['PPN_PEMBELIAN']>0) {
|
|
$kode_pembelian = $datPembelian[0]['KODE_PEMBELIAN'];
|
|
$input = [
|
|
'AKUNTANSI_ID' => $id_akuntansi,
|
|
'CIPTA_DAK' => "Oleh $panggilan pada $timestamp",
|
|
'JENIS_DAK' => '0',
|
|
'PERKIRAAN_ID' => '82',
|
|
'DEBET_DAK' => $pajak_masukan,
|
|
'KREDIT_DAK' => '0',
|
|
'KET_DAK' => "Pajak Masukan Kode : [$kode_pembelian]",
|
|
'SUPPLIER_ID' => $datPembelian[0]['SUPPLIER_ID'],
|
|
'PEMBELIAN_ID' => $id_pembelian
|
|
];
|
|
$action = $this->Amod->create('daftar_akuntansi', $input);
|
|
}
|
|
|
|
$datSupplier = $this->Amod->getData_Supplier_byID($datPembelian[0]['SUPPLIER_ID']);
|
|
$tempo_invbeli = $this->Amod->generate_addDay($tgl_invbeli, $datSupplier[0]['TOP_SUPPLIER']);
|
|
|
|
if ($datPembelian[0]['ALUR_PEMBELIAN']==1) {
|
|
$pic = NULL;
|
|
} else if ($datPembelian[0]['ALUR_PEMBELIAN']==2) {
|
|
$datKaryawan = $this->Amod->getData_Karyawan_byID($id_karyawan);
|
|
$pic = $datKaryawan[0]['NAMA_PANGGILAN_KARYAWAN'];
|
|
}
|
|
|
|
$update = [
|
|
'INV_PEMBELIAN' => $inv_pembelian,
|
|
'TGL_INVBELI' => $tgl_invbeli,
|
|
'TT_PEMBELIAN' => $tt_pembelian,
|
|
'TEMPO_INVBELI' => $tempo_invbeli,
|
|
'FP_PEMBELIAN' => $fp_pembelian,
|
|
'KET_PEMBELIAN' => $ket_hda,
|
|
'TGL_PEMBELIAN' => $now,
|
|
'TAHAN_PEMBELIAN' => $pic,
|
|
'KUNCI_PEMBELIAN' => "Oleh $panggilan pada $timestamp",
|
|
'STATUS_PEMBELIAN' => '1'
|
|
];
|
|
$action = $this->Amod->update('pembelian', $update, 'ID_PEMBELIAN', $id_pembelian);
|
|
|
|
$datPengadaan = $this->Amod->getData_Pengadaan_byPEMBELIAN($id_pembelian);
|
|
if ($datPengadaan==TRUE) {
|
|
if ($datPengadaan[0]['POTONGAN_PENGADAAN']!=NULL) {
|
|
$potongan_pembelian = $datPengadaan[0]['POTONGAN_PENGADAAN'];
|
|
$this->PB_Tambah_PotonganPembelian($id_pembelian, $potongan_pembelian);
|
|
}
|
|
}
|
|
} else if ($verse==2) {
|
|
$update = [
|
|
'TAHAN_PEMBELIAN' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('pembelian', $update, 'ID_PEMBELIAN', $id_pembelian);
|
|
}
|
|
|
|
$value = 1;
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value
|
|
]);
|
|
}
|
|
|
|
public function PB_Kunci_DataReturPembelian() { // Validasi
|
|
$id_rb = $this->input->post('id_rb');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
$now = date('Y-m-d');
|
|
|
|
$value = 0;
|
|
$datRb = $this->Amod->getData_ReturPembelian_byID_bySTATUS($id_rb, 0);
|
|
if ($datRb==FALSE) {
|
|
$value = 3;
|
|
} else {
|
|
$sumDrb = $this->Amod->getSum_DaftarReturBeli_byRB($id_rb);
|
|
$dppDrb = $sumDrb[0]['TOTAL'];
|
|
$ppnDrb = round($dppDrb*($datRb[0]['PPN_PEMBELIAN']/100),2);
|
|
$totDrb = $dppDrb+$ppnDrb;
|
|
$datHhhda = $this->Amod->getData_HasilHitungHda_byPEMBELIAN($datRb[0]['PEMBELIAN_ID']);
|
|
if (($datHhhda[0]['DEBET_HHHDA']+$totDrb)>$datHhhda[0]['KREDIT_HHHDA']) {
|
|
$value = 2;
|
|
} else {
|
|
$inv_rb = $this->Amod->generate_INVReturPembelian($datRb[0]['CORP_ID']);
|
|
$datDrb = $this->Amod->getData_DaftarReturBeli_byRB($id_rb);
|
|
foreach ($datDrb as $key) {
|
|
if ($key['TYPE_JENIS']==1) {
|
|
$datSnrb = $this->Amod->getData_SnReturBeli_byDRB($key['ID_DRB']);
|
|
foreach ($datSnrb as $dat) {
|
|
$datSnStock = $this->Amod->getData_SnStock_byNAMA_bySTATUS($dat['NAMA_SNRB'], 12);
|
|
if ($datSnStock==TRUE) {
|
|
$update = [
|
|
'STATUS_SNSTOCK' => '2'
|
|
];
|
|
$action = $this->Amod->update('sn_stock', $update, 'ID_SNSTOCK', $datSnStock[0]['ID_SNSTOCK']);
|
|
|
|
$input = [
|
|
'SUPPLIER_ID' => $datRb[0]['SUPPLIER_ID'],
|
|
'SNSTOCK_ID' => $datSnStock[0]['ID_SNSTOCK'],
|
|
'INV_HSN' => $inv_rb,
|
|
'KODE_BUKTI' => $datRb[0]['KODE_RB'],
|
|
'TGL_HSN' => $now
|
|
];
|
|
$action = $this->Amod->create('histori_sn', $input);
|
|
}
|
|
}
|
|
}
|
|
|
|
if ($key['TYPE_JENIS']!=2) {
|
|
$this->GE_Kalkulasi_KuantitiBarang($key['BARANG_ID'], $datRb[0]['GUDANG_PEMBELIAN'], "Step 2 - PEMBELIAN - Kunci Retur", 0, $key['QTY_DRB']);
|
|
$this->GE_Kalkulasi_HistoriKuantiti($key['BARANG_ID'], "Step 2 - PEMBELIAN - Kunci Retur", 0, $key['QTY_DRB'], $inv_rb, 0, $id_rb);
|
|
}
|
|
}
|
|
|
|
$kode_pembelian = $datRb[0]['KODE_PEMBELIAN'];
|
|
$kode_rb = $datRb[0]['KODE_RB'];
|
|
$input = [
|
|
'CIPTA_AKUNTANSI' => "Oleh $panggilan pada $timestamp",
|
|
'TGL_AKUNTANSI' => $now,
|
|
'KODE_AKUNTANSI' => $kode_rb,
|
|
'STATUS_AKUNTANSI' => '1',
|
|
];
|
|
$action = $this->Amod->create('akuntansi', $input);
|
|
|
|
$id_akuntansi = $this->Amod->getMax_ID_Akuntansi();
|
|
$id_akuntansi = $id_akuntansi[0]['ID_AKUNTANSI'];
|
|
|
|
$input = [
|
|
'AKUNTANSI_ID' => $id_akuntansi,
|
|
'PERKIRAAN_ID' => '15',
|
|
'CIPTA_DAK' => "Oleh $panggilan pada $timestamp",
|
|
'JENIS_DAK' => '0',
|
|
'DEBET_DAK' => $totDrb,
|
|
'KREDIT_DAK' => '0',
|
|
'KET_DAK' => $datRb[0]['KET_RB'],
|
|
'SUPPLIER_ID' => $datRb[0]['SUPPLIER_ID'],
|
|
'PEMBELIAN_ID' => $datRb[0]['PEMBELIAN_ID']
|
|
];
|
|
$action = $this->Amod->create('daftar_akuntansi', $input);
|
|
|
|
$input = [
|
|
'AKUNTANSI_ID' => $id_akuntansi,
|
|
'PERKIRAAN_ID' => '28',
|
|
'CIPTA_DAK' => "Oleh $panggilan pada $timestamp",
|
|
'JENIS_DAK' => '0',
|
|
'DEBET_DAK' => '0',
|
|
'KREDIT_DAK' => $dppDrb,
|
|
'KET_DAK' => $datRb[0]['KET_RB'],
|
|
'SUPPLIER_ID' => $datRb[0]['SUPPLIER_ID'],
|
|
'PEMBELIAN_ID' => $datRb[0]['PEMBELIAN_ID']
|
|
];
|
|
$action = $this->Amod->create('daftar_akuntansi', $input);
|
|
|
|
if ($datRb[0]['PPN_PEMBELIAN']>0) {
|
|
$input = [
|
|
'AKUNTANSI_ID' => $id_akuntansi,
|
|
'PERKIRAAN_ID' => '82',
|
|
'CIPTA_DAK' => "Oleh $panggilan pada $timestamp",
|
|
'JENIS_DAK' => '0',
|
|
'DEBET_DAK' => '0',
|
|
'KREDIT_DAK' => $ppnDrb,
|
|
'KET_DAK' => "Retur Pajak Masukan, Kode : [$kode_rb] untuk Pembelian [$kode_pembelian]",
|
|
'SUPPLIER_ID' => $datRb[0]['SUPPLIER_ID'],
|
|
'PEMBELIAN_ID' => $datRb[0]['PEMBELIAN_ID']
|
|
];
|
|
$action = $this->Amod->create('daftar_akuntansi', $input);
|
|
}
|
|
|
|
$this->GE_Kalkulasi_HasilHitungHda("PEMBELIAN - Retur", $datRb[0]['PEMBELIAN_ID'], 0, 0);
|
|
|
|
$update = [
|
|
'STATUS_RB' => '1',
|
|
'INV_RB' => $inv_rb,
|
|
'TGL_RB' => $now,
|
|
'KUNCI_RB' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('retur_pembelian', $update, 'ID_RB', $id_rb);
|
|
|
|
$input = [
|
|
'SJ_INV' => '1',
|
|
'TGL_CD' => $now,
|
|
'KODE_BUKTI' => $inv_rb,
|
|
'RB_ID' => $id_rb
|
|
];
|
|
$action = $this->Amod->create('cetak_dokumen', $input);
|
|
|
|
$value = 1;
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value
|
|
]);
|
|
}
|
|
|
|
public function PB_Link_DataPengadaan() { // Validasi
|
|
$id_pembelian = $this->input->post('id_pembelian');
|
|
$id_pengadaan = $this->input->post('id_pengadaan');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$value = 0;
|
|
$datPembelian = $this->Amod->getData_Pembelian_byID($id_pembelian);
|
|
if ($datPembelian==FALSE OR $datPembelian[0]['STATUS_PEMBELIAN']==1) {
|
|
$value = 2;
|
|
} else {
|
|
$datPengadaan = $this->Amod->getData_Pengadaan_byID_bySTATUS($id_pengadaan, 1);
|
|
if ($datPengadaan==FALSE) {
|
|
$value = 2;
|
|
} else {
|
|
//Cek apakah Kode Barang dan Kuantiti sama
|
|
$datDb = $this->Amod->getData_DaftarBeli_byPEMBELIAN($id_pembelian);
|
|
$match = 0;
|
|
foreach ($datDb as $key) {
|
|
$cekDpg = $this->Amod->getData_DaftarPengadaan_byPENGADAAN_byBARANG($id_pengadaan, $key['BARANG_ID']);
|
|
if ($cekDpg==TRUE) {
|
|
if ($cekDpg[0]['QTY_DPG']==$key['QTY_DB']) {
|
|
$match++;
|
|
}
|
|
}
|
|
}
|
|
|
|
if ($match==count($datDb)) {
|
|
foreach ($datDb as $key) {
|
|
$datDpg = $this->Amod->getData_DaftarPengadaan_byPENGADAAN_byBARANG($id_pengadaan, $key['BARANG_ID']);
|
|
|
|
$update = [
|
|
'DPG_ID' => $datDpg[0]['ID_DPG'],
|
|
'HARGA_DB' => $datDpg[0]['HARGA_DPG']-$datDpg[0]['DISKON_DPG']
|
|
];
|
|
$action = $this->Amod->update('daftar_beli', $update, 'ID_DB', $key['ID_DB']);
|
|
}
|
|
} else {
|
|
foreach ($datDb as $key) {
|
|
$action = $this->Amod->delete('sn_beli', $key['ID_DB'], 'DB_ID');
|
|
}
|
|
$action = $this->Amod->delete('daftar_beli', $id_pembelian, 'PEMBELIAN_ID');
|
|
|
|
$datDpg = $this->Amod->getData_DaftarPengadaan_byPENGADAAN($id_pengadaan);
|
|
foreach ($datDpg as $key) {
|
|
$input = [
|
|
'DPG_ID' => $key['ID_DPG'],
|
|
'PEMBELIAN_ID' => $id_pembelian,
|
|
'BARANG_ID' => $key['BARANG_ID'],
|
|
'QTY_DB' => $key['QTY_DPG'],
|
|
'RETUR_DB' => '0',
|
|
'HARGA_DB' => $key['HARGA_DPG']-$key['DISKON_DPG']
|
|
];
|
|
$action = $this->Amod->create('daftar_beli', $input);
|
|
}
|
|
}
|
|
|
|
$update = [
|
|
'REVISI_PEMBELIAN' => "Oleh $panggilan pada $timestamp",
|
|
'SUPPLIER_ID' => $datPengadaan[0]['SUPPLIER_ID'],
|
|
'CORP_ID' => $datPengadaan[0]['CORP_ID'],
|
|
'PO_PEMBELIAN' => $datPengadaan[0]['PO_PENGADAAN']
|
|
];
|
|
$action = $this->Amod->update('pembelian', $update, 'ID_PEMBELIAN', $id_pembelian);
|
|
|
|
$update = [
|
|
'LINK_PENGADAAN' => "Oleh $panggilan pada $timestamp",
|
|
'PEMBELIAN_ID' => $id_pembelian,
|
|
'STATUS_PENGADAAN' => '2'
|
|
];
|
|
$action = $this->Amod->update('pengadaan', $update, 'ID_PENGADAAN', $id_pengadaan);
|
|
|
|
$value = 1;
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value
|
|
]);
|
|
}
|
|
|
|
public function PB_Mutasi_DataPembelian() { // Validasi
|
|
$id_pembelian = $this->input->post('id_pembelian');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$value = 0;
|
|
$datPembelian = $this->Amod->getData_Pembelian_byID_bySTATUS($id_pembelian, 0);
|
|
if ($datPembelian==FALSE) {
|
|
$value = 2;
|
|
} else {
|
|
$id_corp = $datPembelian[0]['CORP_ID'];
|
|
$id_supplier = $datPembelian[0]['SUPPLIER_ID'];
|
|
$sj_pembelian = $datPembelian[0]['SJ_PEMBELIAN'];
|
|
$alur_pembelian = $datPembelian[0]['ALUR_PEMBELIAN'];
|
|
$kode_pembelian = $datPembelian[0]['KODE_PEMBELIAN'];
|
|
$gudang_pembelian = $datPembelian[0]['GUDANG_PEMBELIAN'];
|
|
$po_pembelian = $datPembelian[0]['PO_PEMBELIAN'];
|
|
$ppn_pembelian = $datPembelian[0]['PPN_PEMBELIAN'];
|
|
$cipta_pembelian = $datPembelian[0]['CIPTA_PEMBELIAN'];
|
|
$proses_pembelian = $datPembelian[0]['PROSES_PEMBELIAN'];
|
|
$revisi_pembelian = $datPembelian[0]['REVISI_PEMBELIAN'];
|
|
$tgl_sjbeli = $datPembelian[0]['TGL_SJBELI'];
|
|
|
|
$datPak = $this->Amod->getData_PeriodeAkuntansi_status0();
|
|
$tglNew = $this->Amod->generate_addDay($datPak[0]['AKHIR_PAK'], 1);
|
|
$limitBawah = date_format(date_create($tglNew), "m");
|
|
|
|
$kode_pembelianNew = $this->Amod->generate_kodePembelian(2, $limitBawah);
|
|
|
|
$update = [
|
|
'TGL_PEMBELIAN' => $tglNew,
|
|
'SJ_PEMBELIAN' => "$sj_pembelian [Dimutasi]",
|
|
'KET_PEMBELIAN' => "Dimutasi ke Kode : [$kode_pembelianNew]",
|
|
'STATUS_PEMBELIAN' => '8',
|
|
'MUTASI_PEMBELIAN' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('pembelian', $update, 'ID_PEMBELIAN', $id_pembelian);
|
|
|
|
$input = [
|
|
'KODE_PEMBELIAN' => $kode_pembelianNew,
|
|
'ALUR_PEMBELIAN' => $alur_pembelian,
|
|
'GUDANG_PEMBELIAN' => $gudang_pembelian,
|
|
'TGL_PEMBELIAN' => $tglNew,
|
|
'CORP_ID' => $id_corp,
|
|
'SUPPLIER_ID' => $id_supplier,
|
|
'TGL_SJBELI' => $tgl_sjbeli,
|
|
'SJ_PEMBELIAN' => $sj_pembelian,
|
|
'PO_PEMBELIAN' => $po_pembelian,
|
|
'PPN_PEMBELIAN' => $ppn_pembelian,
|
|
'CIPTA_PEMBELIAN' => $cipta_pembelian,
|
|
'PROSES_PEMBELIAN' => $proses_pembelian,
|
|
'REVISI_PEMBELIAN' => $revisi_pembelian,
|
|
'STATUS_PEMBELIAN' => '0'
|
|
];
|
|
$action = $this->Amod->create('pembelian', $input);
|
|
|
|
$id_pembelianNew = $this->Amod->getMax_ID_Pembelian();
|
|
$id_pembelianNew = $id_pembelianNew[0]['ID_PEMBELIAN'];
|
|
|
|
$datDb = $this->Amod->getData_DaftarBeli_byPEMBELIAN($id_pembelian);
|
|
foreach ($datDb as $key) {
|
|
$update = [
|
|
'PEMBELIAN_ID' => $id_pembelianNew
|
|
];
|
|
$action = $this->Amod->update('daftar_beli', $update, 'ID_DB', $key['ID_DB']);
|
|
}
|
|
|
|
$cekPengadaan = $this->Amod->getData_Pengadaan_byPEMBELIAN($id_pembelian);
|
|
if ($cekPengadaan==TRUE) {
|
|
$update = [
|
|
'PEMBELIAN_ID' => $id_pembelianNew
|
|
];
|
|
$action = $this->Amod->update('pengadaan', $update, 'ID_PENGADAAN', $cekPengadaan[0]['ID_PENGADAAN']);
|
|
}
|
|
|
|
$value = 1;
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value
|
|
]);
|
|
}
|
|
|
|
public function PB_Olah_DataDaftarBeli() { // Validasi
|
|
$id_pembelian = $this->input->post('id_pembelian');
|
|
$id_db = $this->input->post('id_db');
|
|
$harga_db = $this->input->post('harga_db');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$limit = date('Y-m-01');
|
|
$now = date('Y-m-d');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$value = 0;
|
|
$datPembelian = $this->Amod->getData_Pembelian_byID_bySTATUS($id_pembelian, 1);
|
|
if ($datPembelian==FALSE) {
|
|
$value = 6;
|
|
} else {
|
|
if ($datPembelian[0]['POTONGAN_PEMBELIAN']!=NULL) {
|
|
$value = 5;
|
|
} else {
|
|
$datDb = $this->Amod->getData_DaftarBeli_byID($id_db);
|
|
if ($datDb==FALSE) {
|
|
$value = 4;
|
|
} else {
|
|
if (strtotime($datPembelian[0]['TGL_PEMBELIAN'])<strtotime($limit) AND $datDb[0]['HARGA_DB']!=$harga_db) {
|
|
$value = 3;
|
|
} else {
|
|
$datHhhda = $this->Amod->getData_HasilHitungHda_byPEMBELIAN($id_pembelian);
|
|
$harga_db = round($harga_db, 2);
|
|
$harga_old = $datDb[0]['HARGA_DB'];
|
|
if ($harga_old>$harga_db AND $datHhhda[0]['DEBET_HHHDA']>0) {
|
|
$value = 2;
|
|
} else {
|
|
if ($harga_old!=$harga_db) {
|
|
$update = [
|
|
'HARGA_DB' => $harga_db
|
|
];
|
|
$action = $this->Amod->update('daftar_beli', $update, 'ID_DB', $id_db);
|
|
|
|
$sumDb = $this->Amod->getSum_DaftarBeli_byPEMBELIAN($id_pembelian);
|
|
if ($sumDb[0]['TOTAL']==NULL) {
|
|
$dpp = 0;
|
|
} else {
|
|
$dpp = $sumDb[0]['TOTAL'];
|
|
}
|
|
$pm = round(((($datPembelian[0]['PPN_PEMBELIAN'])/100)*$dpp),2);
|
|
$totDb = round(($dpp+$pm),2);
|
|
|
|
if (strpos($datHhhda[0]['LUNAS_HHHDA'],"PB")!==FALSE) {
|
|
$update = [
|
|
'KREDIT_HHHDA' => $totDb,
|
|
'STATUS_HHHDA' => '0',
|
|
'TGLLOCK_HHHDA' => NULL,
|
|
'LUNAS_HHHDA' => NULL
|
|
];
|
|
} else {
|
|
if ($totDb==0) {
|
|
$update = [
|
|
'KREDIT_HHHDA' => $totDb,
|
|
'STATUS_HHHDA' => '1',
|
|
'LAST_HHHDA' => $timestamp,
|
|
'TGLLOCK_HHHDA' => $now,
|
|
'LUNAS_HHHDA' => $datPembelian[0]['KODE_PEMBELIAN']
|
|
];
|
|
} else {
|
|
$update = [
|
|
'KREDIT_HHHDA' => $totDb,
|
|
'LAST_HHHDA' => $timestamp,
|
|
];
|
|
}
|
|
}
|
|
$action = $this->Amod->update('hasil_hitunghda', $update, 'ID_HHHDA', $datHhhda[0]['ID_HHHDA']);
|
|
|
|
$datDak1 = $this->Amod->getData_DaftarAkuntansi_byPERKIRAAN_byPEMBELIAN(15, $id_pembelian);
|
|
$update = [
|
|
'KREDIT_DAK' => $totDb
|
|
];
|
|
$action = $this->Amod->update('daftar_akuntansi', $update, 'ID_DAK', $datDak1[0]['ID_DAK']);
|
|
|
|
$datDak2 = $this->Amod->getData_DaftarAkuntansi_byPERKIRAAN_byPEMBELIAN(27, $id_pembelian);
|
|
$update = [
|
|
'DEBET_DAK' => $dpp
|
|
];
|
|
$action = $this->Amod->update('daftar_akuntansi', $update, 'ID_DAK', $datDak2[0]['ID_DAK']);
|
|
|
|
$datDak3 = $this->Amod->getData_DaftarAkuntansi_byPERKIRAAN_byPEMBELIAN(82, $id_pembelian);
|
|
if ($datDak3==TRUE) {
|
|
$update = [
|
|
'DEBET_DAK' => $pm
|
|
];
|
|
$action = $this->Amod->update('daftar_akuntansi', $update, 'ID_DAK', $datDak3[0]['ID_DAK']);
|
|
}
|
|
|
|
$this->GE_Kalkulasi_HistoriKuantiti($datDb[0]['BARANG_ID'], "Step 1 - PEMBELIAN - Ubah Barang", 0, 0, $datPembelian[0]['KODE_PEMBELIAN'], 0, $id_db);
|
|
|
|
$datKpr = $this->Amod->getData_KlaimProgram_byDB($id_db);
|
|
if ($datKpr==TRUE) {
|
|
$harga_kpr = round(((($datPembelian[0]['PPN_PEMBELIAN']+100)/100)*$harga_db),2);
|
|
$update = [
|
|
'HARGA_KPR' => $harga_kpr
|
|
];
|
|
$action = $this->Amod->update('klaim_program', $update, 'ID_KPR', $datKpr[0]['ID_KPR']);
|
|
}
|
|
|
|
$update = [
|
|
'REVISI_PEMBELIAN' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('pembelian', $update, 'ID_PEMBELIAN', $id_pembelian);
|
|
}
|
|
|
|
$value = 1;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
}
|
|
|
|
public function PB_Olah_DataPembelian() { // Validasi
|
|
$id_pembelian = $this->input->post('id_pembelian');
|
|
$id_supplier = $this->input->post('id_supplier');
|
|
$id_corp = $this->input->post('id_corp');
|
|
$sj_pembelian = $this->input->post('sj_pembelian');
|
|
$tgl_sjbeli = $this->input->post('tgl_sjbeli');
|
|
$inv_pembelian = $this->input->post('inv_pembelian');
|
|
$tgl_invbeli = $this->input->post('tgl_invbeli');
|
|
$ppn_pembelian = $this->input->post('ppn_pembelian');
|
|
$tempo_invbeli = $this->input->post('tempo_invbeli');
|
|
$po_pembelian = $this->input->post('po_pembelian');
|
|
$tt_pembelian = $this->input->post('tt_pembelian');
|
|
$fp_pembelian = $this->input->post('fp_pembelian');
|
|
$ket_pembelian = $this->input->post('ket_pembelian');
|
|
$ket_pembelian = strtoupper(ltrim(rtrim(preg_replace('/\R+/', " " , $ket_pembelian))));
|
|
$sj_pembelian = strtoupper($sj_pembelian);
|
|
$inv_pembelian = strtoupper($inv_pembelian);
|
|
$po_pembelian = strtoupper($po_pembelian);
|
|
$hak = $this->input->post('hak');
|
|
$menu = $this->input->post('menu');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
$now = date('Y-m-d');
|
|
$limit = date('Y-m-01');
|
|
|
|
if ($hak>=3) {
|
|
$awal = $this->Amod->generate_subYear($limit, 1);
|
|
} else if ($hak>0) {
|
|
$awal = $this->Amod->generate_subMonth($limit, 3);
|
|
} else {
|
|
$awal = $limit;
|
|
}
|
|
|
|
if ($fp_pembelian=="") {
|
|
$fp_pembelian = NULL;
|
|
}
|
|
|
|
if ($tt_pembelian=="") {
|
|
$tt_pembelian = NULL;
|
|
}
|
|
|
|
$value = 0;
|
|
$datPembelian = $this->Amod->getData_Pembelian_byID_bySTATUS($id_pembelian, 1);
|
|
if ($datPembelian==FALSE) {
|
|
$value = 8;
|
|
} else {
|
|
if ($hak<3 AND strtotime($datPembelian[0]['TGL_PEMBELIAN'])<strtotime($limit) AND $menu==2) {
|
|
$value = 7;
|
|
} else if ($hak<3 AND strtotime($datPembelian[0]['TGL_PEMBELIAN'])<strtotime($limit) AND $menu==7) {
|
|
$value = 7;
|
|
} else if (strtotime($datPembelian[0]['TGL_PEMBELIAN'])<strtotime($awal)) {
|
|
$value = 6;
|
|
} else {
|
|
$cekSj = $this->Amod->getData_Pembelian_bySJ($sj_pembelian, $id_pembelian);
|
|
if ($cekSj==TRUE) {
|
|
$value = 5;
|
|
} else {
|
|
$cekInv = $this->Amod->getData_Pembelian_byINV($inv_pembelian, $id_pembelian);
|
|
if ($cekInv==TRUE) {
|
|
$value = 4;
|
|
} else {
|
|
$datDakHda = $this->Amod->getData_DaftarAkuntansi_byPERKIRAAN_byPEMBELIAN(15, $id_pembelian);
|
|
if (count($datDakHda)>1 AND $menu==7) {
|
|
$value = 3;
|
|
} else {
|
|
$kode_pembelian = $datPembelian[0]['KODE_PEMBELIAN'];
|
|
$revisi_pembelian = "Oleh $panggilan pada $timestamp";
|
|
if ($menu==1) {
|
|
$datHhhda = $this->Amod->getData_HasilHitungHda_byPEMBELIAN($id_pembelian);
|
|
$update = [
|
|
'SUPPLIER_ID' => $id_supplier
|
|
];
|
|
$action = $this->Amod->update('hasil_hitunghda', $update, 'ID_HHHDA', $datHhhda[0]['ID_HHHDA']);
|
|
|
|
$datHsn = $this->Amod->getData_HistoriSn_byKODEBUKTI($kode_pembelian);
|
|
foreach ($datHsn as $key) {
|
|
$update = [
|
|
'SUPPLIER_ID' => $id_supplier
|
|
];
|
|
$action = $this->Amod->update('histori_sn', $update, 'ID_HSN', $key['ID_HSN']);
|
|
}
|
|
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byPEMBELIAN($id_pembelian);
|
|
foreach ($datDak as $key) {
|
|
if ($key['SUPPLIER_ID']!=NULL) {
|
|
$update = [
|
|
'SUPPLIER_ID' => $id_supplier
|
|
];
|
|
$action = $this->Amod->update('daftar_akuntansi', $update, 'ID_DAK', $key['ID_DAK']);
|
|
}
|
|
}
|
|
|
|
$update = [
|
|
'SUPPLIER_ID' => $id_supplier,
|
|
'REVISI_PEMBELIAN' => $revisi_pembelian,
|
|
];
|
|
} else if ($menu==2) {
|
|
$datHhhda = $this->Amod->getData_HasilHitungHda_byPEMBELIAN($id_pembelian);
|
|
$update = [
|
|
'CORP_ID' => $id_corp
|
|
];
|
|
$action = $this->Amod->update('hasil_hitunghda', $update, 'ID_HHHDA', $datHhhda[0]['ID_HHHDA']);
|
|
|
|
$update = [
|
|
'CORP_ID' => $id_corp,
|
|
'REVISI_PEMBELIAN' => $revisi_pembelian,
|
|
];
|
|
} else if ($menu==3) {
|
|
$datHq = $this->Amod->getData_HistoriKuantiti_byKODE($kode_pembelian);
|
|
foreach ($datHq as $key) {
|
|
$update = [
|
|
'SJ_HQ' => $sj_pembelian
|
|
];
|
|
$action = $this->Amod->update('histori_kuantiti', $update, 'ID_HQ', $key['ID_HQ']);
|
|
}
|
|
|
|
$datHsn = $this->Amod->getData_HistoriSn_byKODEBUKTI($kode_pembelian);
|
|
foreach ($datHsn as $key) {
|
|
$update = [
|
|
'SJ_HSN' => $sj_pembelian
|
|
];
|
|
$action = $this->Amod->update('histori_sn', $update, 'ID_HSN', $key['ID_HSN']);
|
|
}
|
|
|
|
$update = [
|
|
'SJ_PEMBELIAN' => $sj_pembelian,
|
|
'REVISI_PEMBELIAN' => $revisi_pembelian,
|
|
];
|
|
} else if ($menu==5) {
|
|
$datHq = $this->Amod->getData_HistoriKuantiti_byKODE($kode_pembelian);
|
|
foreach ($datHq as $key) {
|
|
$update = [
|
|
'INV_HQ' => $inv_pembelian
|
|
];
|
|
$action = $this->Amod->update('histori_kuantiti', $update, 'ID_HQ', $key['ID_HQ']);
|
|
}
|
|
|
|
$datHsn = $this->Amod->getData_HistoriSn_byKODEBUKTI($kode_pembelian);
|
|
foreach ($datHsn as $key) {
|
|
$update = [
|
|
'INV_HSN' => $inv_pembelian
|
|
];
|
|
$action = $this->Amod->update('histori_sn', $update, 'ID_HSN', $key['ID_HSN']);
|
|
}
|
|
|
|
$datKpr = $this->Amod->getData_KlaimProgram_byNOTA($datPembelian[0]['INV_PEMBELIAN']);
|
|
foreach ($datKpr as $key) {
|
|
$update = [
|
|
'NOTA_KPR' => $inv_pembelian
|
|
];
|
|
$action = $this->Amod->update('klaim_program', $update, 'ID_KPR', $key['ID_KPR']);
|
|
}
|
|
|
|
$update = [
|
|
'INV_PEMBELIAN' => $inv_pembelian,
|
|
'REVISI_PEMBELIAN' => $revisi_pembelian,
|
|
];
|
|
} else if ($menu==4 OR $menu==6) {
|
|
$tgl_pembelian = $datPembelian[0]['TGL_PEMBELIAN'];
|
|
$limitBawah = date_format(date_create($tgl_pembelian), "Y-m-01");
|
|
$limitAtas = $this->Amod->generate_addMonth($limitBawah, 1);
|
|
$limitAtas = $this->Amod->generate_subDay($limitAtas, 1);
|
|
if (strtotime($tgl_sjbeli)<strtotime($limitBawah) OR strtotime($tgl_sjbeli)>strtotime($limitAtas)) {
|
|
$value = 2;
|
|
} else if (strtotime($tgl_invbeli)<strtotime($limitBawah) OR strtotime($tgl_invbeli)>strtotime($limitAtas)) {
|
|
$value = 2;
|
|
} else {
|
|
if ($menu==4) {
|
|
$update = [
|
|
'TGL_SJBELI' => $tgl_sjbeli,
|
|
'REVISI_PEMBELIAN' => $revisi_pembelian,
|
|
];
|
|
} else if ($menu==6) {
|
|
$update = [
|
|
'TGL_INVBELI' => $tgl_invbeli,
|
|
'REVISI_PEMBELIAN' => $revisi_pembelian,
|
|
];
|
|
}
|
|
}
|
|
} else if ($menu==7) {
|
|
$sumDb = $this->Amod->getSum_DaftarBeli_byPEMBELIAN($id_pembelian);
|
|
$dpp = $sumDb[0]['TOTAL'];
|
|
if ($ppn_pembelian!=$datPembelian[0]['PPN_PEMBELIAN']) {
|
|
$datHhhda = $this->Amod->getData_HasilHitungHda_byPEMBELIAN($id_pembelian);
|
|
$datDakPm = $this->Amod->getData_DaftarAkuntansi_byPERKIRAAN_byPEMBELIAN(82, $id_pembelian);
|
|
if ($datPembelian[0]['PPN_PEMBELIAN']>0 AND $ppn_pembelian==0) {
|
|
$action = $this->Amod->delete('daftar_akuntansi', $datDakPm[0]['ID_DAK'], 'ID_DAK');
|
|
$pm = 0;
|
|
} else {
|
|
$pm = round((($ppn_pembelian/100)*$dpp),2);
|
|
if ($datPembelian[0]['PPN_PEMBELIAN']==0 AND $ppn_pembelian>0) {
|
|
$input = [
|
|
'AKUNTANSI_ID' => $datDakHda[0]['AKUNTANSI_ID'],
|
|
'PERKIRAAN_ID' => '82',
|
|
'CIPTA_DAK' => "Oleh $panggilan pada $timestamp",
|
|
'JENIS_DAK' => '0',
|
|
'DEBET_DAK' => $pm,
|
|
'KREDIT_DAK' => '0',
|
|
'KET_DAK' => "Pajak Masukan Kode : [$kode_pembelian]",
|
|
'PEMBELIAN_ID' => $id_pembelian,
|
|
'SUPPLIER_ID' => $datPembelian[0]['SUPPLIER_ID']
|
|
];
|
|
$action = $this->Amod->create('daftar_akuntansi', $input);
|
|
} else {
|
|
$updatePm = [
|
|
'DEBET_DAK' => $pm
|
|
];
|
|
$action = $this->Amod->update('daftar_akuntansi', $updatePm, 'ID_DAK', $datDakPm[0]['ID_DAK']);
|
|
}
|
|
}
|
|
|
|
$hdaNew = $pm+$dpp;
|
|
$updateHda = [
|
|
'KREDIT_DAK' => $hdaNew
|
|
];
|
|
$action = $this->Amod->update('daftar_akuntansi', $updateHda, 'ID_DAK', $datDakHda[0]['ID_DAK']);
|
|
|
|
$updateHhhda = [
|
|
'KREDIT_HHHDA' => $hdaNew
|
|
];
|
|
$action = $this->Amod->update('hasil_hitunghda', $updateHhhda, 'ID_HHHDA', $datHhhda[0]['ID_HHHDA']);
|
|
|
|
$this->GE_Kalkulasi_HasilHitungHda("Nilai KREDIT Pembelian", $id_pembelian, $hdaNew);
|
|
|
|
$update = [
|
|
'PPN_PEMBELIAN' => $ppn_pembelian,
|
|
'REVISI_PEMBELIAN' => $revisi_pembelian,
|
|
];
|
|
}
|
|
} else if ($menu==8) {
|
|
$update = [
|
|
'TEMPO_INVBELI' => $tempo_invbeli,
|
|
'REVISI_PEMBELIAN' => $revisi_pembelian
|
|
];
|
|
} else if ($menu==9) {
|
|
$update = [
|
|
'PO_PEMBELIAN' => $po_pembelian,
|
|
'REVISI_PEMBELIAN' => $revisi_pembelian,
|
|
];
|
|
} else if ($menu==10) {
|
|
$datSupplier = $this->Amod->getData_Supplier_byID($datPembelian[0]['SUPPLIER_ID']);
|
|
if ($tt_pembelian==NULL) {
|
|
$tempo_invbeli = $this->Amod->generate_addDay($datPembelian[0]['TGL_PEMBELIAN'], $datSupplier[0]['TOP_SUPPLIER']);
|
|
} else {
|
|
$tempo_invbeli = $this->Amod->generate_addDay($tt_pembelian, $datSupplier[0]['TOP_SUPPLIER']);
|
|
}
|
|
$update = [
|
|
'TT_PEMBELIAN' => $tt_pembelian,
|
|
'TEMPO_INVBELI' => $tempo_invbeli,
|
|
'REVISI_PEMBELIAN' => $revisi_pembelian
|
|
];
|
|
} else if ($menu==11) {
|
|
$update = [
|
|
'FP_PEMBELIAN' => $fp_pembelian,
|
|
'REVISI_PEMBELIAN' => $revisi_pembelian,
|
|
];
|
|
} else if ($menu==12) {
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byPEMBELIAN($id_pembelian);
|
|
$update = [
|
|
'KET_DAK' => $ket_pembelian
|
|
];
|
|
$action = $this->Amod->update('daftar_akuntansi', $update, 'ID_DAK', $datDak[0]['ID_DAK']);
|
|
$action = $this->Amod->update('daftar_akuntansi', $update, 'ID_DAK', $datDak[1]['ID_DAK']);
|
|
|
|
$update = [
|
|
'KET_PEMBELIAN' => $ket_pembelian,
|
|
'REVISI_PEMBELIAN' => $revisi_pembelian,
|
|
];
|
|
}
|
|
|
|
if ($value==0) {
|
|
$action = $this->Amod->update('pembelian', $update, 'ID_PEMBELIAN', $id_pembelian);
|
|
$value = 1;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
}
|
|
|
|
public function PB_Proses_DataPembelian() { // Validasi
|
|
$id_pembelian = $this->input->post('id_pembelian');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
$limit = date('Y-m-01');
|
|
$now = date('Y-m-d');
|
|
|
|
$value = 0;
|
|
$datPembelian = $this->Amod->getData_Pembelian_byID($id_pembelian);
|
|
if ($datPembelian==FALSE OR $datPembelian[0]['STATUS_PEMBELIAN']==1) {
|
|
$value = 4;
|
|
} else {
|
|
if (strtotime($datPembelian[0]['TGL_PEMBELIAN'])<strtotime($limit)) {
|
|
$value = 3;
|
|
} else {
|
|
$datDb = $this->Amod->getData_DaftarBeli_byPEMBELIAN($id_pembelian);
|
|
foreach ($datDb as $key) {
|
|
if ($key['TYPE_JENIS']==1 AND $key['ALUR_PEMBELIAN']==1) {
|
|
$qtyReal = $this->Amod->getCount_SnBeli_byDB($key['ID_DB']);
|
|
if ($qtyReal<$key['QTY_DB']) {
|
|
$value = 2;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
if ($value==0) {
|
|
$update = [
|
|
'STATUS_PEMBELIAN' => '0',
|
|
'TGL_PEMBELIAN' => $now,
|
|
'PROSES_PEMBELIAN' => "Oleh $panggilan pada $timestamp",
|
|
'REVISI_PEMBELIAN' => NULL
|
|
];
|
|
$action = $this->Amod->update('pembelian', $update, 'ID_PEMBELIAN', $id_pembelian);
|
|
|
|
$value = 1;
|
|
}
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value
|
|
]);
|
|
}
|
|
|
|
public function PB_Proses_DataReturPembelian() { // Validasi
|
|
$id_rb = $this->input->post('id_rb');
|
|
$tgl_input = $this->input->post('tgl_input');
|
|
$ket_rb = $this->input->post('ket_rb');
|
|
$ket_rb = ltrim(rtrim(preg_replace('/\R+/', " " , $ket_rb)));
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$now = date('Y-m-d');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$value = 0;
|
|
$datRb = $this->Amod->getData_ReturPembelian_byID_byKARYAWAN_statusNull($id_rb, $id_karyawan);
|
|
if ($datRb==FALSE) {
|
|
$value = 2;
|
|
} else {
|
|
$update = [
|
|
'STATUS_RB' => '0',
|
|
'TGL_RB' => $now,
|
|
'TGL_INPUT' => $tgl_input,
|
|
'KET_RB' => $ket_rb,
|
|
'PROSES_RB' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('retur_pembelian', $update, 'ID_RB', $id_rb);
|
|
|
|
$value = 1;
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value
|
|
]);
|
|
}
|
|
|
|
public function PB_Revisi_DataPembelian() { // Validasi
|
|
$id_pembelian = $this->input->post('id_pembelian');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
$limit = date('Y-m-01');
|
|
$tgl = date('Y-m-d');
|
|
|
|
$value = 0;
|
|
$datPembelian = $this->Amod->getData_Pembelian_byID_bySTATUS($id_pembelian, 1);
|
|
if ($datPembelian==FALSE) {
|
|
$value = 10;
|
|
} else {
|
|
if ($datPembelian[0]['POTONGAN_PEMBELIAN']!=NULL) {
|
|
$value = 9;
|
|
} else {
|
|
if (strtotime($limit)>strtotime($datPembelian[0]['TGL_PEMBELIAN'])) {
|
|
$value = 8;
|
|
} else {
|
|
if ($datPembelian[0]['PPN_PEMBELIAN']==0) {
|
|
$limitDak = 2;
|
|
} else {
|
|
$limitDak = 3;
|
|
}
|
|
|
|
$countDak = $this->Amod->getCount_DaftarAkuntansi_byPEMBELIAN($id_pembelian);
|
|
if ($countDak>$limitDak) {
|
|
$value = 7;
|
|
} else {
|
|
if ($datPembelian[0]['GUDANG_PEMBELIAN']==3) {
|
|
$gudangQty = 10;
|
|
} else {
|
|
$gudangQty = $datPembelian[0]['GUDANG_PEMBELIAN'];
|
|
}
|
|
|
|
$datDb = $this->Amod->getData_DaftarBeli_byPEMBELIAN($id_pembelian);
|
|
foreach ($datDb as $key) {
|
|
if ($key['TYPE_JENIS']==1) {
|
|
$datSnb = $this->Amod->getData_SnBeli_byDB($key['ID_DB']);
|
|
foreach ($datSnb as $dat) {
|
|
$datSnStock = $this->Amod->getData_SnStock_byNAMA_bySTATUS($dat['NAMA_SNB'], 0);
|
|
if ($datSnStock==FALSE) {
|
|
$value = 6;
|
|
break;
|
|
}
|
|
|
|
$datSnRj = $this->Amod->getData_SnReturJual_byNAMA($dat['NAMA_SNB']);
|
|
if ($datSnRj==TRUE) {
|
|
$value = 5;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
if ($datPembelian[0]['ALUR_PEMBELIAN']==1) {
|
|
$cekKuantiti = $this->GE_AmbilData_DataKuantiti($key['BARANG_ID'], $gudangQty);
|
|
if ($cekKuantiti<$key['QTY_DB']) {
|
|
if ($gudangQty==1) {
|
|
$value = 4;
|
|
} else if ($gudangQty==2) {
|
|
$value = 3;
|
|
} else if ($gudangQty==10) {
|
|
$value = 2;
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
if ($value==0) {
|
|
foreach ($datDb as $key) {
|
|
if ($key['TYPE_JENIS']==1) {
|
|
$datSnb = $this->Amod->getData_SnBeli_byDB($key['ID_DB']);
|
|
foreach ($datSnb as $dat) {
|
|
$datSnStock = $this->Amod->getData_SnStock_byNAMA_bySTATUS($dat['NAMA_SNB'], 0);
|
|
if ($datSnStock==TRUE) {
|
|
$action = $this->Amod->delete('histori_sn', $datSnStock[0]['ID_SNSTOCK'], 'SNSTOCK_ID');
|
|
$action = $this->Amod->delete('sn_stock', $datSnStock[0]['ID_SNSTOCK'], 'ID_SNSTOCK');
|
|
$action = $this->Amod->delete('sn_klaimprogram', $datSnStock[0]['ID_SNSTOCK'], 'SNSTOCK_ID');
|
|
}
|
|
}
|
|
$action = $this->Amod->delete('klaim_program', $key['ID_DB'], 'DB_ID');
|
|
}
|
|
|
|
$this->GE_Kalkulasi_KuantitiBarang($key['BARANG_ID'], $datPembelian[0]['GUDANG_PEMBELIAN'], "Step 1 - PEMBELIAN - Revisi Barang", 0, $key['QTY_DB']);
|
|
}
|
|
|
|
$this->GE_Kalkulasi_HistoriKuantiti(0, "Step 1 - PEMBELIAN - Revisi Barang", 0, 0, $datPembelian[0]['KODE_PEMBELIAN'], 0, 0);
|
|
|
|
$datAkuntansi = $this->Amod->getData_Akuntansi_byKODE_bySTATUS($datPembelian[0]['KODE_PEMBELIAN'], 1);
|
|
$id_akuntansi = $datAkuntansi[0]['ID_AKUNTANSI'];
|
|
$action = $this->Amod->delete('daftar_akuntansi', $id_akuntansi, 'AKUNTANSI_ID');
|
|
$action = $this->Amod->delete('akuntansi', $id_akuntansi, 'ID_AKUNTANSI');
|
|
$action = $this->Amod->delete('hasil_hitunghda', $id_pembelian, 'PEMBELIAN_ID');
|
|
|
|
$update = [
|
|
'INV_PEMBELIAN' => NULL,
|
|
'TGL_INVBELI' => NULL,
|
|
'TEMPO_INVBELI' => NULL,
|
|
'TT_PEMBELIAN' => NULL,
|
|
'FP_PEMBELIAN' => NULL,
|
|
'KET_PEMBELIAN' => NULL,
|
|
'REVISI_PEMBELIAN' => "Oleh $panggilan pada $timestamp",
|
|
'KUNCI_PEMBELIAN' => NULL,
|
|
'STATUS_PEMBELIAN' => '0'
|
|
];
|
|
$action = $this->Amod->update('pembelian', $update, 'ID_PEMBELIAN', $id_pembelian);
|
|
|
|
$value = 1;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value
|
|
]);
|
|
}
|
|
|
|
public function PB_Tambah_DataDaftarBeli() { // Validasi
|
|
$id_pembelian = $this->input->post('id_pembelian');
|
|
$id_barang = $this->input->post('id_barang');
|
|
$qty_db = $this->input->post('qty_db');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$value = 0;
|
|
$datPembelian = $this->Amod->getData_Pembelian_byID($id_pembelian);
|
|
if ($datPembelian==FALSE) {
|
|
$value = 3;
|
|
} else {
|
|
if ($datPembelian[0]['STATUS_PEMBELIAN']==NULL OR $datPembelian[0]['STATUS_PEMBELIAN']==0) {
|
|
$datDb = $this->Amod->getData_DaftarBeli_byPEMBELIAN_byBARANG($id_pembelian, $id_barang);
|
|
if ($datDb==TRUE) {
|
|
$value = 2;
|
|
} else {
|
|
$input = [
|
|
'PEMBELIAN_ID' => $id_pembelian,
|
|
'BARANG_ID' => $id_barang,
|
|
'QTY_DB' => $qty_db,
|
|
'RETUR_DB' => '0',
|
|
'HARGA_DB' => '0',
|
|
];
|
|
$action = $this->Amod->create('daftar_beli', $input);
|
|
|
|
if ($datPembelian[0]['STATUS_PEMBELIAN']==NULL) {
|
|
|
|
} else if ($datPembelian[0]['STATUS_PEMBELIAN']==0) {
|
|
$update = [
|
|
'REVISI_PEMBELIAN' => "Oleh $panggilan pada $timestamp",
|
|
];
|
|
$action = $this->Amod->update('pembelian', $update, 'ID_PEMBELIAN', $id_pembelian);
|
|
}
|
|
$value = 1;
|
|
}
|
|
} else {
|
|
$value = 3;
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value
|
|
]);
|
|
}
|
|
|
|
public function PB_Tambah_DataDaftarReturBeli() { // Validasi
|
|
$id_rb = $this->input->post('id_rb');
|
|
$id_barang = $this->input->post('id_barang');
|
|
$qty_drb = $this->input->post('qty_drb');
|
|
$snretur = $this->input->post('snretur');
|
|
$tipe = $this->input->post('tipe');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$value = 0;
|
|
$datRb = $this->Amod->getData_ReturPembelian_byID_statusNull($id_rb);
|
|
if ($datRb==FALSE) {
|
|
$value = 8;
|
|
} else {
|
|
$datDrb = $this->Amod->getData_DaftarReturBeli_byRB_byBARANG($id_rb, $id_barang);
|
|
if ($datDrb==TRUE) {
|
|
$value = 7;
|
|
} else {
|
|
if ($tipe==1) {
|
|
$qty_drb = count($snretur);
|
|
|
|
foreach ($snretur as $key) {
|
|
$datSnBeli = $this->Amod->getData_SnBeli_byID_bySTATUS($key, 0);
|
|
if ($datSnBeli==FALSE) {
|
|
$value = 6;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
if ($value==0) {
|
|
$datPembelian = $this->Amod->getData_Pembelian_byID_bySTATUS($datRb[0]['PEMBELIAN_ID'], 1);
|
|
if ($datPembelian[0]['GUDANG_PEMBELIAN']==3) {
|
|
$gudangQty = 10;
|
|
} else {
|
|
$gudangQty = $datPembelian[0]['GUDANG_PEMBELIAN'];
|
|
}
|
|
|
|
$cekKuantiti = $this->GE_AmbilData_DataKuantiti($id_barang, $gudangQty);
|
|
if ($cekKuantiti<$qty_drb) {
|
|
if ($gudangQty==1) {
|
|
$value = 5;
|
|
} else if ($gudangQty==2) {
|
|
$value = 4;
|
|
} else if ($gudangQty==10) {
|
|
$value = 3;
|
|
}
|
|
}
|
|
|
|
if ($value==0) {
|
|
$sumDb = $this->Amod->getSum_DaftarBeli_byPEMBELIAN_byBARANG($datRb[0]['PEMBELIAN_ID'], $id_barang);
|
|
if ($sumDb[0]['TOTAL']<$qty_drb) {
|
|
$value = 2;
|
|
} else {
|
|
$datDb = $this->Amod->getData_DaftarBeli_byPEMBELIAN_byBARANG($datRb[0]['PEMBELIAN_ID'], $id_barang);
|
|
|
|
$input = [
|
|
'RB_ID' => $id_rb,
|
|
'BARANG_ID' => $id_barang,
|
|
'QTY_DRB' => $qty_drb,
|
|
'DB_ID' => $datDb[0]['ID_DB'],
|
|
'HARGA_DRB' => $datDb[0]['HARGA_DB']
|
|
];
|
|
$action = $this->Amod->create('daftar_returbeli', $input);
|
|
|
|
$id_drb = $this->Amod->getMax_ID_DaftarReturBeli();
|
|
$id_drb = $id_drb[0]['ID_DRB'];
|
|
|
|
if ($tipe==0) {
|
|
$retur_db = $datDb[0]['RETUR_DB']+$qty_drb;
|
|
$update = [
|
|
'RETUR_DB' => $retur_db
|
|
];
|
|
$action = $this->Amod->update('daftar_beli', $update, 'ID_DB', $datDb[0]['ID_DB']);
|
|
} else if ($tipe==1) {
|
|
foreach ($snretur as $key) {
|
|
$datSnBeli = $this->Amod->getData_SnBeli_byID_bySTATUS($key, 0);
|
|
if ($datSnBeli==TRUE) {
|
|
$input = [
|
|
'RB_ID' => $id_rb,
|
|
'DRB_ID' => $id_drb,
|
|
'SNB_ID' => $key,
|
|
'NAMA_SNRB' => $datSnBeli[0]['NAMA_SNB'],
|
|
];
|
|
$action = $this->Amod->create('sn_returbeli', $input);
|
|
|
|
$update = [
|
|
'STATUS_SNSTOCK' => '12'
|
|
];
|
|
$action = $this->Amod->update('sn_stock', $update, 'ID_SNSTOCK', $datSnBeli[0]['ID_SNSTOCK']);
|
|
|
|
$datDbNew = $this->Amod->getData_DaftarBeli_byID($datDb[0]['ID_DB']);
|
|
$kembaliLama = $datDbNew[0]['RETUR_DB'];
|
|
$kembaliBaru = $kembaliLama+1;
|
|
|
|
$update = [
|
|
'RETUR_DB' => $kembaliBaru
|
|
];
|
|
$action = $this->Amod->update('daftar_beli', $update, 'ID_DB', $datDb[0]['ID_DB']);
|
|
}
|
|
}
|
|
}
|
|
|
|
$value = 1;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value
|
|
]);
|
|
}
|
|
|
|
public function PB_Tambah_DataPembelian() { // Validasi
|
|
$id_pengadaan = $this->input->post('id_pengadaan');
|
|
$tgl_sjbeli = $this->input->post('tgl_sjbeli');
|
|
$id_supplier = $this->input->post('id_supplier');
|
|
$id_corp = $this->input->post('id_corp');
|
|
$gudang_pembelian = $this->input->post('gudang_pembelian');
|
|
$alur_pembelian = $this->input->post('alur_pembelian');
|
|
$sj_pembelian = $this->input->post('sj_pembelian');
|
|
$po_pembelian = $this->input->post('po_pembelian');
|
|
$sj_pembelian = strtoupper($sj_pembelian);
|
|
$po_pembelian = strtoupper($po_pembelian);
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$now = date('Y-m-d');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$value = 0;
|
|
$datPembelian = $this->Amod->getData_Pembelian_bySJ($sj_pembelian);
|
|
if ($datPembelian==TRUE) {
|
|
$value = 3;
|
|
} else {
|
|
if ($id_pengadaan!="") {
|
|
$datPengadaan = $this->Amod->getData_Pengadaan_byID_bySTATUS($id_pengadaan, 1);
|
|
if ($datPengadaan==FALSE) {
|
|
$value = 2;
|
|
}
|
|
}
|
|
if ($value==0) {
|
|
if ($id_corp==3 OR $id_corp==5) {
|
|
$ppn_pembelian = 0;
|
|
} else if ($id_corp==1 OR $id_corp==2 OR $id_corp==4) {
|
|
$ppn_pembelian = 11;
|
|
}
|
|
|
|
$kode_pembelian = $this->Amod->generate_kodePembelian(1);
|
|
$input = [
|
|
'CIPTA_PEMBELIAN' => "Oleh $panggilan pada $timestamp",
|
|
'KODE_PEMBELIAN' => $kode_pembelian,
|
|
'TGL_PEMBELIAN' => $now,
|
|
'GUDANG_PEMBELIAN' => $gudang_pembelian,
|
|
'ALUR_PEMBELIAN' => $alur_pembelian,
|
|
'CORP_ID' => $id_corp,
|
|
'SUPPLIER_ID' => $id_supplier,
|
|
'TGL_SJBELI' => $tgl_sjbeli,
|
|
'SJ_PEMBELIAN' => $sj_pembelian,
|
|
'PO_PEMBELIAN' => $po_pembelian,
|
|
'PPN_PEMBELIAN' => $ppn_pembelian
|
|
];
|
|
$action = $this->Amod->create('pembelian', $input);
|
|
|
|
if ($id_pengadaan!="") {
|
|
$id_pembelian = $this->Amod->getMax_ID_Pembelian();
|
|
$id_pembelian = $id_pembelian[0]['ID_PEMBELIAN'];
|
|
|
|
$datDpg = $this->Amod->getData_DaftarPengadaan_byPENGADAAN($id_pengadaan);
|
|
foreach ($datDpg as $key) {
|
|
$input = [
|
|
'DPG_ID' => $key['ID_DPG'],
|
|
'PEMBELIAN_ID' => $id_pembelian,
|
|
'BARANG_ID' => $key['BARANG_ID'],
|
|
'QTY_DB' => $key['QTY_DPG'],
|
|
'RETUR_DB' => '0',
|
|
'HARGA_DB' => $key['HARGA_DPG']-$key['DISKON_DPG']
|
|
];
|
|
$action = $this->Amod->create('daftar_beli', $input);
|
|
}
|
|
|
|
$update = [
|
|
'PEMBELIAN_ID' => $id_pembelian,
|
|
'STATUS_PENGADAAN' => '2',
|
|
'LINK_PENGADAAN' => "Oleh $panggilan pada $timestamp",
|
|
];
|
|
$action = $this->Amod->update('pengadaan', $update, 'ID_PENGADAAN', $id_pengadaan);
|
|
}
|
|
$value = 1;
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value
|
|
]);
|
|
}
|
|
|
|
public function PB_Tambah_DataReturPembelian() { // Validasi
|
|
$id_pembelian = $this->input->post('id_pembelian');
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
$now = date('Y-m-d');
|
|
|
|
$datRb = $this->Amod->getData_ReturPembelian_byKARYAWAN_statusNull($id_karyawan);
|
|
if ($datRb==FALSE) {
|
|
$kode_rb = $this->Amod->generate_kodeReturPembelian();
|
|
$input = [
|
|
'KODE_RB' => $kode_rb,
|
|
'PEMBELIAN_ID' => $id_pembelian,
|
|
'ADMIN_ID' => $id_karyawan,
|
|
'TGL_RB' => $now,
|
|
'CIPTA_RB' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->create('retur_pembelian', $input);
|
|
|
|
$id_rb = $this->Amod->getMax_ID_ReturPembelian();
|
|
$id_rb = $id_rb[0]['ID_RB'];
|
|
} else {
|
|
$id_rb = $datRb[0]['ID_RB'];
|
|
$kode_rb = $datRb[0]['KODE_RB'];
|
|
if ($id_pembelian!=$datRb[0]['PEMBELIAN_ID']) {
|
|
$datDrb = $this->Amod->getData_DaftarReturBeli_byRB($id_rb);
|
|
foreach ($datDrb as $key) {
|
|
if ($key['TYPE_JENIS']==1) {
|
|
$datSnrb = $this->Amod->getData_SnReturBeli_byDRB($key['ID_DRB']);
|
|
foreach ($datSnrb as $dat) {
|
|
$datSnStock = $this->Amod->getData_SnStock_byNAMA_bySTATUS($dat['NAMA_SNRB'], 12);
|
|
if ($datSnStock==TRUE) {
|
|
$update = [
|
|
'STATUS_SNSTOCK' => '0'
|
|
];
|
|
$action = $this->Amod->update('sn_stock', $update, 'ID_SNSTOCK', $datSnStock[0]['ID_SNSTOCK']);
|
|
}
|
|
}
|
|
}
|
|
|
|
$datDb = $this->Amod->getData_DaftarBeli_byID($key['DB_ID']);
|
|
$retur_dbLama = $datDb[0]['RETUR_DB'];
|
|
$retur_dbBaru = $retur_dbLama-$key['QTY_DRB'];
|
|
|
|
$update = [
|
|
'RETUR_DB' => $retur_dbBaru
|
|
];
|
|
$action = $this->Amod->update('daftar_beli', $update, 'ID_DB', $key['DB_ID']);
|
|
}
|
|
|
|
$action = $this->Amod->delete('sn_returbeli', $id_rb, 'RB_ID');
|
|
$action = $this->Amod->delete('daftar_returbeli', $id_rb, 'RB_ID');
|
|
|
|
$update = [
|
|
'CIPTA_RB' => "Oleh $panggilan pada $timestamp",
|
|
'PEMBELIAN_ID' => $id_pembelian
|
|
];
|
|
$action = $this->Amod->update('retur_pembelian', $update, 'ID_RB', $id_rb);
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'id_rb' => $id_rb,
|
|
'kode_rb' => $kode_rb
|
|
]);
|
|
}
|
|
|
|
public function PB_Tambah_DataSnBeli() { // Validasi
|
|
$id_db = $this->input->post('id_db');
|
|
$id_pembelian = $this->input->post('id_pembelian');
|
|
$nama_snb = $this->input->post('nama_snb');
|
|
$nama_snb = strtoupper($nama_snb);
|
|
|
|
$value = 0;
|
|
$datPembelian = $this->Amod->getData_Pembelian_byID($id_pembelian);
|
|
if ($datPembelian==FALSE) {
|
|
$value = 6;
|
|
} else {
|
|
$datDb = $this->Amod->getData_DaftarBeli_byID($id_db);
|
|
if ($datDb==FALSE) {
|
|
$value = 5;
|
|
} else {
|
|
$datSnStock = $this->Amod->getData_SnStock_byNAMA_allStatus($nama_snb);
|
|
if ($datSnStock==TRUE) {
|
|
$value = 4;
|
|
} else {
|
|
$countBefore = $this->Amod->getCount_SnBeli_byDB($id_db);
|
|
if ($countBefore>=$datDb[0]['QTY_DB']) {
|
|
$value = 3;
|
|
} else {
|
|
$input = [
|
|
'NAMA_SNB' => $nama_snb,
|
|
'DB_ID' => $id_db,
|
|
];
|
|
$action = $this->Amod->create('sn_beli', $input);
|
|
|
|
$countAfter = $this->Amod->getCount_SnBeli_byDB($id_db);
|
|
if ($countAfter==$datDb[0]['QTY_DB']) {
|
|
$value = 2;
|
|
} else {
|
|
$value = 1;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
}
|
|
|
|
public function PB_Tambah_PotonganPembelian($id_pembelian=null, $potongan_pembelian=null) { // Validasi
|
|
if ($id_pembelian==NULL) {
|
|
$id_pembelian = $this->input->post('id_pembelian');
|
|
$potongan_pembelian = $this->input->post('potongan_pembelian');
|
|
}
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
$limit = date('Y-m-01');
|
|
|
|
$value = 0;
|
|
$datPembelian = $this->Amod->getData_Pembelian_byID_bySTATUS($id_pembelian, 1);
|
|
if ($datPembelian==FALSE) {
|
|
$value = 3;
|
|
} else {
|
|
if (strtotime($datPembelian[0]['TGL_PEMBELIAN'])<strtotime($limit)) {
|
|
$value = 2;
|
|
} else {
|
|
$kode_pembelian = $datPembelian[0]['KODE_PEMBELIAN'];
|
|
$inv_pembelian = $datPembelian[0]['INV_PEMBELIAN'];
|
|
$sumDb = $this->Amod->getSum_DaftarBeli_byPEMBELIAN($id_pembelian);
|
|
if ($sumDb[0]['TOTAL']==NULL) {
|
|
$nilaiDpp = 0;
|
|
} else {
|
|
$nilaiDpp = $sumDb[0]['TOTAL'];
|
|
}
|
|
|
|
$nilaiPm = round((($datPembelian[0]['PPN_PEMBELIAN']/100)*$nilaiDpp),2);
|
|
$nilaiPk = round((($datPembelian[0]['PPN_PEMBELIAN']/100)*$potongan_pembelian),2);
|
|
$nilaiHda = $nilaiDpp-$potongan_pembelian+$nilaiPm-$nilaiPk;
|
|
|
|
//Ubah Nilai Hutang Dagang
|
|
$datAkuntansi = $this->Amod->getData_Akuntansi_byKODE($kode_pembelian);
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byAKUNTANSI_byPEMBELIAN_byPERKIRAAN($datAkuntansi[0]['ID_AKUNTANSI'], $id_pembelian, 15);
|
|
$update = [
|
|
'CIPTA_DAK' => "Oleh $panggilan pada $timestamp",
|
|
'KREDIT_DAK' => $nilaiHda
|
|
];
|
|
$action = $this->Amod->update('daftar_akuntansi', $update, 'ID_DAK', $datDak[0]['ID_DAK']);
|
|
|
|
//Buat Nilai Potongan Pembelian
|
|
$input = [
|
|
'AKUNTANSI_ID' => $datDak[0]['AKUNTANSI_ID'],
|
|
'CIPTA_DAK' => "Oleh $panggilan pada $timestamp",
|
|
'JENIS_DAK' => '0',
|
|
'PERKIRAAN_ID' => '29',
|
|
'DEBET_DAK' => '0',
|
|
'KREDIT_DAK' => $potongan_pembelian,
|
|
'KET_DAK' => "Potongan Pembelian Untuk Invoice : [$inv_pembelian]",
|
|
'PEMBELIAN_ID' => $id_pembelian,
|
|
'SUPPLIER_ID' => $datPembelian[0]['SUPPLIER_ID'],
|
|
];
|
|
$action = $this->Amod->create('daftar_akuntansi', $input);
|
|
|
|
//Buat Nilai Pajak Keluaran
|
|
$input = [
|
|
'AKUNTANSI_ID' => $datDak[0]['AKUNTANSI_ID'],
|
|
'CIPTA_DAK' => "Oleh $panggilan pada $timestamp",
|
|
'JENIS_DAK' => '0',
|
|
'PERKIRAAN_ID' => '83',
|
|
'DEBET_DAK' => '0',
|
|
'KREDIT_DAK' => $nilaiPk,
|
|
'KET_DAK' => "Pajak Keluaran Kode : [$kode_pembelian]",
|
|
'PEMBELIAN_ID' => $id_pembelian,
|
|
'SUPPLIER_ID' => $datPembelian[0]['SUPPLIER_ID'],
|
|
];
|
|
$action = $this->Amod->create('daftar_akuntansi', $input);
|
|
|
|
//Update Nilai Hasil Hitung Hda
|
|
$this->GE_Kalkulasi_HasilHitungHda("Nilai KREDIT Pembelian", $id_pembelian, $nilaiHda);
|
|
|
|
//Update Nilai Potongan Pembelian
|
|
$update = [
|
|
'POTONGAN_PEMBELIAN' => $potongan_pembelian
|
|
];
|
|
$action = $this->Amod->update('pembelian', $update, 'ID_PEMBELIAN', $id_pembelian);
|
|
|
|
$value = 1;
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
}
|
|
|
|
public function PB_Tarik_DataPembelian() { // Validasi
|
|
$id_pembelian = $this->input->post('id_pembelian');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
$limit = date('Y-m-01');
|
|
$now = date('Y-m-d');
|
|
|
|
$value = 0;
|
|
$datPembelian = $this->Amod->getData_Pembelian_byID_bySTATUS($id_pembelian, 0);
|
|
if ($datPembelian==FALSE) {
|
|
$value = 3;
|
|
} else {
|
|
if (strtotime($datPembelian[0]['TGL_PEMBELIAN'])<strtotime($limit)) {
|
|
$value = 2;
|
|
} else {
|
|
$update = [
|
|
'STATUS_PEMBELIAN' => NULL,
|
|
'PROSES_PEMBELIAN' => NULL,
|
|
'TGL_PEMBELIAN' => $now,
|
|
'REVISI_PEMBELIAN' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('pembelian', $update, 'ID_PEMBELIAN', $id_pembelian);
|
|
|
|
$value = 1;
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value
|
|
]);
|
|
}
|
|
|
|
public function PB_Ubah_DataDaftarBeli() { // Validasi
|
|
$verse = $this->input->post('verse');
|
|
$id_pembelian = $this->input->post('id_pembelian');
|
|
$id_db = $this->input->post('id_db');
|
|
$specific = $this->input->post('specific');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$value = 0;
|
|
$datPembelian = $this->Amod->getData_Pembelian_byID($id_pembelian);
|
|
if ($datPembelian==FALSE) {
|
|
$value = 3;
|
|
} else {
|
|
if ($datPembelian[0]['STATUS_PEMBELIAN']==1) {
|
|
$cekPembelian = $this->Amod->getData_Pembelian_tahanNotNull($id_pembelian);
|
|
if ($cekPembelian==FALSE) {
|
|
$value = 3;
|
|
}
|
|
} else if ($datPembelian[0]['STATUS_PEMBELIAN']>0 AND $verse==3) {
|
|
$value = 3;
|
|
}
|
|
if ($value==0) {
|
|
$datDb = $this->Amod->getData_DaftarBeli_byID($id_db);
|
|
if ($datDb==FALSE) {
|
|
$value = 2;
|
|
} else {
|
|
if ($verse==1) {
|
|
$update = [
|
|
'BARANG_ID' => $specific,
|
|
];
|
|
} else if ($verse==2) {
|
|
$update = [
|
|
'QTY_DB' => $specific,
|
|
];
|
|
} else if ($verse==3) {
|
|
$update = [
|
|
'HARGA_DB' => $specific,
|
|
];
|
|
}
|
|
$action = $this->Amod->update('daftar_beli', $update, 'ID_DB', $id_db);
|
|
|
|
if ($verse==1 AND $datPembelian[0]['STATUS_PEMBELIAN']==1 AND $specific!=$datDb[0]['BARANG_ID']) {
|
|
$datHqAwal = $this->Amod->getData_HistoriKuantiti_byBARANG_byKODEBUKTI($datDb[0]['BARANG_ID'], $datPembelian[0]['KODE_PEMBELIAN']);
|
|
$id_hqAwal = $datHqAwal[0]['ID_HQ'];
|
|
|
|
//Cek apakah Histori Barang Lama adalah yang paling terakhir dari Kode Barang tersebut
|
|
$cekHqAwal = $this->Amod->getData_HistoriKuantiti_byBARANG_orderDESC_limit1($datDb[0]['BARANG_ID']);
|
|
$valueCek = 0;
|
|
if ($id_hqAwal!=$cekHqAwal[0]['ID_HQ']) {
|
|
$valueCek = 1;
|
|
}
|
|
|
|
//Cek apakah Barang pengganti belum pernah ada Transaksi
|
|
$datHqPengganti = $this->Amod->getData_HistoriKuantiti_byBARANG_orderDESC_limit1($specific);
|
|
if ($datHqPengganti==FALSE) {
|
|
$persediaan_hq = $datHqAwal[0]['NILAI_HQ'];
|
|
$update = [
|
|
'BARANG_ID' => $specific,
|
|
'PERSEDIAAN_HQ' => $persediaan_hq,
|
|
'SISA_HQ' => $datHqAwal[0]['MASUK_HQ'],
|
|
'AVG_HQ' => $datDb[0]['HARGA_DB']
|
|
];
|
|
$action = $this->Amod->update('histori_kuantiti', $update, 'ID_HQ', $id_hqAwal);
|
|
} else {
|
|
//Cek apakah diatas ID awal masih ada transaksi lanjutannya
|
|
$cekHqPengganti = $this->Amod->getData_HistoriKuantiti_byBARANG_afterID($specific, $id_hqAwal);
|
|
if ($cekHqPengganti==TRUE) {
|
|
$datHqSebelum = $this->Amod->getData_HistoriKuantiti_byBARANG_orderDESC_limit1_beforeID($specific, $id_hqAwal);
|
|
if ($datHqSebelum==FALSE) {
|
|
$persediaan_hq = $datHqAwal[0]['NILAI_HQ'];
|
|
$sisa_hq = $datHqAwal[0]['MASUK_HQ'];
|
|
$avg_hq = $datDb[0]['HARGA_DB'];
|
|
} else {
|
|
$persediaan_hq = round(($datHqSebelum[0]['PERSEDIAAN_HQ']+$datHqAwal[0]['NILAI_HQ']),2);
|
|
$sisa_hq = $datHqSebelum[0]['SISA_HQ']+$datDb[0]['QTY_DB'];
|
|
$avg_hq = round(($persediaan_hq/$sisa_hq),2);
|
|
}
|
|
|
|
$update = [
|
|
'BARANG_ID' => $specific,
|
|
'PERSEDIAAN_HQ' => $persediaan_hq,
|
|
'SISA_HQ' => $sisa_hq,
|
|
'AVG_HQ' => $avg_hq,
|
|
];
|
|
$action = $this->Amod->update('histori_kuantiti', $update, 'ID_HQ', $id_hqAwal);
|
|
|
|
foreach ($cekHqPengganti as $key) {
|
|
$datHqBeforeAfter = $this->Amod->getData_HistoriKuantiti_byBARANG_orderDESC_limit1_beforeID($key['BARANG_ID'], $key['ID_HQ']);
|
|
if ($key['MASUK_HQ']==0) { // Transaksi Keluar
|
|
if ($datHqBeforeAfter[0]['SISA_HQ']==$key['KELUAR_HQ']) {
|
|
$persediaan_hq = 0;
|
|
$sisa_hq = 0;
|
|
} else {
|
|
$sisa_hq = $datHqBeforeAfter[0]['SISA_HQ']-$key['KELUAR_HQ'];
|
|
$persediaan_hq = round(($datHqBeforeAfter[0]['PERSEDIAAN_HQ']-($datHqBeforeAfter[0]['AVG_HQ']*$key['KELUAR_HQ'])),2);
|
|
}
|
|
|
|
$update = [
|
|
'PERSEDIAAN_HQ' => $persediaan_hq,
|
|
'AVG_HQ' => $datHqBeforeAfter[0]['AVG_HQ'],
|
|
'SISA_HQ' => $sisa_hq,
|
|
];
|
|
} else if ($key['KELUAR_HQ']==0) { // Transaksi Masuk
|
|
$sisa_hq = $datHqBeforeAfter[0]['SISA_HQ']+$key['MASUK_HQ'];
|
|
$persediaan_hq = $datHqBeforeAfter[0]['PERSEDIAAN_HQ']+$key['NILAI_HQ'];
|
|
$avg_hq = round(($persediaan_hq/$sisa_hq),2);
|
|
|
|
$update = [
|
|
'PERSEDIAAN_HQ' => $persediaan_hq,
|
|
'AVG_HQ' => $avg_hq,
|
|
'SISA_HQ' => $sisa_hq,
|
|
];
|
|
}
|
|
$action = $this->Amod->update('histori_kuantiti', $update, 'ID_HQ', $key['ID_HQ']);
|
|
}
|
|
} else {
|
|
$persediaan_hq = $datHqPengganti[0]['PERSEDIAAN_HQ']+round(($datDb[0]['HARGA_DB']*$datDb[0]['QTY_DB']),2);
|
|
$sisa_hq = $datHqPengganti[0]['SISA_HQ']+$datDb[0]['QTY_DB'];
|
|
$avg_hq = round(($persediaan_hq/$sisa_hq), 2);
|
|
|
|
$update = [
|
|
'BARANG_ID' => $specific,
|
|
'PERSEDIAAN_HQ' => $persediaan_hq,
|
|
'SISA_HQ' => $sisa_hq,
|
|
'AVG_HQ' => $avg_hq,
|
|
];
|
|
$action = $this->Amod->update('histori_kuantiti', $update, 'ID_HQ', $id_hqAwal);
|
|
}
|
|
}
|
|
|
|
$update = [
|
|
'PERSEDIAAN_KUANTITI' => $persediaan_hq
|
|
];
|
|
$action = $this->Amod->update('kuantiti', $update, 'ID_KUANTITI', $specific);
|
|
|
|
//Ubah Data Barang lama menggunakan Persediaan Lama
|
|
if ($valueCek==0) {
|
|
$datHqLama = $this->Amod->getData_HistoriKuantiti_byBARANG_orderDESC_limit1_beforeID($datDb[0]['BARANG_ID'], $id_hqAwal);
|
|
if ($datHqLama==FALSE) {
|
|
$persediaanLama = 0;
|
|
} else {
|
|
$persediaanLama = $datHqLama[0]['PERSEDIAAN_HQ'];
|
|
}
|
|
} else if ($valueCek==1) {
|
|
$datHqLama = $this->Amod->getData_HistoriKuantiti_byBARANG_afterID($datDb[0]['BARANG_ID'], $id_hqAwal);
|
|
$persediaanLama = 0;
|
|
foreach ($datHqLama as $key) {
|
|
$datHqBeforeAfter = $this->Amod->getData_HistoriKuantiti_byBARANG_orderDESC_limit1_beforeID($key['BARANG_ID'], $key['ID_HQ']);
|
|
if ($key['MASUK_HQ']==0) { // Transaksi Keluar
|
|
if ($datHqBeforeAfter[0]['SISA_HQ']==$key['KELUAR_HQ']) {
|
|
$persediaanLama = 0;
|
|
$sisa_hq = 0;
|
|
} else {
|
|
$sisa_hq = $datHqBeforeAfter[0]['SISA_HQ']-$key['KELUAR_HQ'];
|
|
$persediaanLama = round(($datHqBeforeAfter[0]['PERSEDIAAN_HQ']-($datHqBeforeAfter[0]['AVG_HQ']*$key['KELUAR_HQ'])),2);
|
|
}
|
|
|
|
$update = [
|
|
'PERSEDIAAN_HQ' => $persediaanLama,
|
|
'AVG_HQ' => $datHqBeforeAfter[0]['AVG_HQ'],
|
|
'SISA_HQ' => $sisa_hq,
|
|
];
|
|
} else if ($key['KELUAR_HQ']==0) { // Transaksi Masuk
|
|
$sisa_hq = $datHqBeforeAfter[0]['SISA_HQ']+$key['MASUK_HQ'];
|
|
$persediaanLama = $datHqBeforeAfter[0]['PERSEDIAAN_HQ']+$key['NILAI_HQ'];
|
|
$avg_hq = round(($persediaanLama/$sisa_hq),2);
|
|
|
|
$update = [
|
|
'PERSEDIAAN_HQ' => $persediaanLama,
|
|
'AVG_HQ' => $avg_hq,
|
|
'SISA_HQ' => $sisa_hq,
|
|
];
|
|
}
|
|
$action = $this->Amod->update('histori_kuantiti', $update, 'ID_HQ', $key['ID_HQ']);
|
|
}
|
|
}
|
|
|
|
$update = [
|
|
'PERSEDIAAN_KUANTITI' => $persediaanLama
|
|
];
|
|
$action = $this->Amod->update('kuantiti', $update, 'ID_KUANTITI', $datDb[0]['BARANG_ID']);
|
|
|
|
$action = $this->Amod->delete('sn_beli', $id_db, 'DB_ID');
|
|
|
|
$update = [
|
|
'BARANG_ID' => $specific,
|
|
];
|
|
$action = $this->Amod->update('daftar_beli', $update, 'ID_DB', $id_db);
|
|
}
|
|
$value = 1;
|
|
}
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value
|
|
]);
|
|
}
|
|
|
|
public function PB_Ubah_DataDaftarReturBeli() { // Validasi
|
|
$verse = $this->input->post('verse');
|
|
$id_drb = $this->input->post('id_drb');
|
|
$id_rb = $this->input->post('id_rb');
|
|
$harga_drb = $this->input->post('harga_drb');
|
|
$harga_drb = round($harga_drb, 2);
|
|
|
|
$value = 0;
|
|
$datRb = $this->Amod->getData_ReturPembelian_byID_bySTATUS($id_rb, 0);
|
|
if ($datRb==FALSE) {
|
|
$value = 3;
|
|
} else {
|
|
$datDrb = $this->Amod->getData_DaftarReturBeli_byID($id_drb);
|
|
if ($datDrb==FALSE) {
|
|
$value = 2;
|
|
} else {
|
|
$update = [
|
|
'HARGA_DRB' => $harga_drb
|
|
];
|
|
$action = $this->Amod->update('daftar_returbeli', $update, 'ID_DRB', $id_drb);
|
|
|
|
$value = 1;
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value
|
|
]);
|
|
}
|
|
|
|
public function PB_Ubah_DataPembelian() { // Validasi
|
|
$id_pembelian = $this->input->post('id_pembelian');
|
|
$verse = $this->input->post('verse');
|
|
$tgl_sjbeli = $this->input->post('tgl_sjbeli');
|
|
$id_supplier = $this->input->post('id_supplier');
|
|
$id_corp = $this->input->post('id_corp');
|
|
$gudang_pembelian = $this->input->post('gudang_pembelian');
|
|
$alur_pembelian = $this->input->post('alur_pembelian');
|
|
$ppn_pembelian = $this->input->post('ppn_pembelian');
|
|
$sj_pembelian = $this->input->post('sj_pembelian');
|
|
$po_pembelian = $this->input->post('po_pembelian');
|
|
$ket_pembelian = $this->input->post('ket_pembelian');
|
|
$sj_pembelian = strtoupper($sj_pembelian);
|
|
$po_pembelian = strtoupper($po_pembelian);
|
|
$ket_pembelian = ltrim(rtrim(preg_replace('/\R+/', " " , $ket_pembelian)));
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$now = date('Y-m-d');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$value = 0;
|
|
$datPembelian = $this->Amod->getData_Pembelian_byID($id_pembelian);
|
|
if ($datPembelian==FALSE) {
|
|
$value = 3;
|
|
} else {
|
|
if ($datPembelian[0]['STATUS_PEMBELIAN']==NULL OR $datPembelian[0]['STATUS_PEMBELIAN']==0) {
|
|
$datDb = $this->Amod->getData_DaftarBeli_byPEMBELIAN($id_pembelian);
|
|
foreach ($datDb as $key) {
|
|
$countSnb = $this->Amod->getCount_SnBeli_byDB($key['ID_DB']);
|
|
if ($countSnb>0 AND $alur_pembelian==2) {
|
|
$value = 2;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
if ($value==0) {
|
|
if ($datPembelian[0]['STATUS_PEMBELIAN']==NULL) {
|
|
$update = [
|
|
'TGL_PEMBELIAN' => $now,
|
|
'CORP_ID' => $id_corp,
|
|
'SUPPLIER_ID' => $id_supplier,
|
|
'TGL_SJBELI' => $tgl_sjbeli,
|
|
'GUDANG_PEMBELIAN' => $gudang_pembelian,
|
|
'ALUR_PEMBELIAN' => $alur_pembelian,
|
|
'SJ_PEMBELIAN' => $sj_pembelian,
|
|
'PO_PEMBELIAN' => $po_pembelian,
|
|
];
|
|
$action = $this->Amod->update('pembelian', $update, 'ID_PEMBELIAN', $id_pembelian);
|
|
} else if ($datPembelian[0]['STATUS_PEMBELIAN']==0) {
|
|
if ($verse==1) {
|
|
$update = [
|
|
'TGL_PEMBELIAN' => $now,
|
|
'CORP_ID' => $id_corp,
|
|
'SUPPLIER_ID' => $id_supplier,
|
|
'TGL_SJBELI' => $tgl_sjbeli,
|
|
'GUDANG_PEMBELIAN' => $gudang_pembelian,
|
|
'ALUR_PEMBELIAN' => $alur_pembelian,
|
|
'SJ_PEMBELIAN' => $sj_pembelian,
|
|
'PO_PEMBELIAN' => $po_pembelian,
|
|
'REVISI_PEMBELIAN' => "Oleh $panggilan pada $timestamp",
|
|
];
|
|
} else if ($verse==2) {
|
|
$update = [
|
|
'CORP_ID' => $id_corp,
|
|
'SUPPLIER_ID' => $id_supplier,
|
|
'PPN_PEMBELIAN' => $ppn_pembelian,
|
|
'KET_PEMBELIAN' => $ket_pembelian,
|
|
'PO_PEMBELIAN' => $po_pembelian,
|
|
];
|
|
}
|
|
$action = $this->Amod->update('pembelian', $update, 'ID_PEMBELIAN', $id_pembelian);
|
|
} else if ($datPembelian[0]['STATUS_PEMBELIAN']==1) {
|
|
$update = [
|
|
'TGL_PEMBELIAN' => $now,
|
|
'TGL_SJBELI' => $tgl_sjbeli,
|
|
'SJ_PEMBELIAN' => $sj_pembelian,
|
|
'PO_PEMBELIAN' => $po_pembelian,
|
|
'REVISI_PEMBELIAN' => "Oleh $panggilan pada $timestamp",
|
|
];
|
|
$action = $this->Amod->update('pembelian', $update, 'ID_PEMBELIAN', $id_pembelian);
|
|
}
|
|
$value = 1;
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value
|
|
]);
|
|
}
|
|
|
|
//Daftar Menu PJ [Penjualan]
|
|
//SUBMENU TAMPILAN
|
|
public function PJ_Transaksi_SalesOrder_1() { // Validasi
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$now = date('Y-m-d');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "PJ", "TRANSAKSI - Sales Order");
|
|
if ($datShm==TRUE) {
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
$id_menu = $datShm[0]['MENU_ID'];
|
|
} else {
|
|
$hak = 0;
|
|
$id_menu = 0;
|
|
$tampil = "TIDAK BERHAK";
|
|
}
|
|
|
|
$datSmi = $this->Amod->getData_SetModeInclude_byKARYAWAN($id_karyawan);
|
|
if ($datSmi==FALSE) {
|
|
$mode_ppn = 0;
|
|
} else {
|
|
$mode_ppn = $datSmi[0]['MODE_SMI'];
|
|
}
|
|
|
|
$datCorp = $this->Amod->getData_Corp_bySTATUS(1);
|
|
|
|
$datStpos = $this->Amod->getData_SetTogglePosisi_byKARYAWAN_byMENU($id_karyawan, $id_menu);
|
|
if ($datStpos==FALSE) { $posisiToggle = 0; } else { $posisiToggle = $datStpos[0]['AKTIF_STPOS']; }
|
|
|
|
$data = array(
|
|
'sidebar' => "menu penjualan",
|
|
'navChild' => "penjualan salesorder",
|
|
'hak' => $hak,
|
|
'tampil' => $tampil,
|
|
'tgl' => $now,
|
|
'corp' => $datCorp,
|
|
'id_menu' => $id_menu,
|
|
'mode_ppn' => $mode_ppn,
|
|
'posisiToggle' => $posisiToggle,
|
|
);
|
|
$this->load->view('proses/PJ_Transaksi_SalesOrder_1', $data);
|
|
}
|
|
|
|
public function PJ_Transaksi_ProsesBarang_1() { // Validasi
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$now = date('Y-m-d');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "PJ", "TRANSAKSI - Proses Barang");
|
|
if ($datShm==TRUE) {
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
$id_menu = $datShm[0]['MENU_ID'];
|
|
} else {
|
|
$hak = 0;
|
|
$id_menu = 0;
|
|
$tampil = "TIDAK BERHAK";
|
|
}
|
|
|
|
$datKaryawan = $this->Amod->getData_Karyawan_Penjadwalan();
|
|
|
|
$datStpos = $this->Amod->getData_SetTogglePosisi_byKARYAWAN_byMENU($id_karyawan, $id_menu);
|
|
if ($datStpos==FALSE) { $posisiToggle = 0; } else { $posisiToggle = $datStpos[0]['AKTIF_STPOS']; }
|
|
|
|
$data = array(
|
|
'sidebar' => "menu penjualan",
|
|
'navChild' => "penjualan prosesbarang",
|
|
'hak' => $hak,
|
|
'tampil' => $tampil,
|
|
'tgl' => $now,
|
|
'qc' => $datKaryawan,
|
|
'id_menu' => $id_menu,
|
|
'posisiToggle' => $posisiToggle,
|
|
);
|
|
$this->load->view('proses/PJ_Transaksi_ProsesBarang_1', $data);
|
|
}
|
|
|
|
//FUNGSI PENJUALAN
|
|
public function PJ_Ambil_JumlahData() { // Validasi
|
|
$awal = date('Y-m-01');
|
|
$now = date('Y-m-d');
|
|
$akhir = $this->Amod->generate_addMonth($awal, 1);
|
|
$akhir = $this->Amod->generate_subDay($akhir, 1);
|
|
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$hak = $this->input->post('hak');
|
|
|
|
$datShas = $this->Amod->getData_SetHakAdminSo_byKARYAWAN($id_karyawan);
|
|
$salesbelum = 0;
|
|
$gudangproses = 0;
|
|
$olahfee = 0;
|
|
foreach ($datShas as $key) {
|
|
$belum = $this->Amod->getCount_SalesOrder_bySALES_statusNull($key['HAK_ID']);
|
|
$proses = $this->Amod->getCount_SalesOrder_bySALES_bySTATUS($key['HAK_ID'], 0);
|
|
$fee = $this->Amod->getCount_HasilHitungBfe_bySALES_bySTATUS($key['HAK_ID'], 0);
|
|
$salesbelum = $salesbelum+$belum;
|
|
$gudangproses = $gudangproses+$proses;
|
|
$olahfee = $olahfee+$fee;
|
|
}
|
|
|
|
$antrian = $this->Amod->getCount_SalesOrder_bySTATUS(0);
|
|
$siapkirim = $this->Amod->getCount_SalesOrder_bySTATUS_afterTGL(1, "2026-06-01");
|
|
|
|
$this->output_json([
|
|
'salesbelum' => $salesbelum,
|
|
'gudangproses' => $gudangproses,
|
|
'olahfee' => $olahfee,
|
|
'antrian' => $antrian,
|
|
'siapkirim' => $siapkirim,
|
|
]);
|
|
}
|
|
|
|
public function PJ_Ambil_JumlahSnIo() { // Validasi
|
|
$id_io = $this->input->post('id_io');
|
|
|
|
$countSnio = $this->Amod->getCount_SnIo_byIO($id_io);
|
|
|
|
$this->output_json([
|
|
'total' => $countSnio
|
|
]);
|
|
}
|
|
|
|
public function PJ_Ambil_JumlahSnJual() { // Validasi
|
|
$id_do = $this->input->post('id_do');
|
|
|
|
$countSnj = $this->Amod->getCount_SnJual_byDO($id_do);
|
|
|
|
$this->output_json([
|
|
'total' => $countSnj
|
|
]);
|
|
}
|
|
|
|
public function PJ_Batal_DataFormFeePelanggan() { // Validasi
|
|
$id_ffp = $this->input->post('id_ffp');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
//Check Konsistensi Data
|
|
$value = 0;
|
|
$datFfp = $this->Amod->getData_FormFeePelanggan_byID_bySTATUS($id_ffp, 0);
|
|
if ($datFfp==FALSE) {
|
|
$value = 2;
|
|
} else {
|
|
$update = [
|
|
'SOVOID_FFP' => $datFfp[0]['KODE_SO'],
|
|
'BATAL_FFP' => "Oleh $panggilan pada $timestamp",
|
|
'STATUS_FFP' => '2',
|
|
'PENJUALAN_ID' => NULL
|
|
];
|
|
$action = $this->Amod->update('form_feepelanggan', $update, 'ID_FFP', $datFfp[0]['ID_FFP']);
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
|
|
}
|
|
|
|
public function PJ_Hapus_DataDaftarOrder() { // Validasi
|
|
$id_do = $this->input->post('id_do');
|
|
$id_so = $this->input->post('id_so');
|
|
$verse = $this->input->post('verse');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$value = 0;
|
|
if ($verse==1) {
|
|
$datSo = $this->Amod->getData_SalesOrder_byID_statusNull($id_so);
|
|
} else if ($verse==2) {
|
|
$datSo = $this->Amod->getData_SalesOrder_byID_bySTATUS($id_so, 0);
|
|
}
|
|
if ($datSo==FALSE) {
|
|
$value = 3;
|
|
} else {
|
|
$datDo = $this->Amod->getData_DaftarOrder_byID($id_do);
|
|
if ($datDo==FALSE) {
|
|
$value = 2;
|
|
} else {
|
|
if ($datDo[0]['TYPE_JENIS']==1 AND $verse==2) {
|
|
$datSnj = $this->Amod->getData_SnJual_byDO($id_do);
|
|
foreach ($datSnj as $key) {
|
|
$datSnStock = $this->Amod->getData_SnStock_byNAMA_bySTATUS($key['NAMA_SNJ'], 10);
|
|
if ($datSnStock==TRUE) {
|
|
$update = [
|
|
'STATUS_SNSTOCK' => '0'
|
|
];
|
|
$action = $this->Amod->update('sn_stock', $update, 'ID_SNSTOCK', $datSnStock[0]['ID_SNSTOCK']);
|
|
$this->GE_Kalkulasi_KuantitiBarang($datDo[0]['BARANG_ID'], $datSo[0]['GUDANG_SO'], "Step 2 - PENJUALAN - Hapus Barang", 0, 1);
|
|
}
|
|
}
|
|
$action = $this->Amod->delete('sn_jual', $id_do, 'DO_ID');
|
|
}
|
|
$action = $this->Amod->delete('daftar_order', $id_do, 'ID_DO');
|
|
|
|
$sumDoAkhir = $this->Amod->getSum_DaftarOrder_bySO($id_so);
|
|
if ($sumDoAkhir==FALSE OR $sumDoAkhir[0]['TOTAL']==NULL) {
|
|
$dppAkhir = 0;
|
|
} else {
|
|
$dppAkhir = $sumDoAkhir[0]['TOTAL'];
|
|
}
|
|
$ppnAkhir = round((($datSo[0]['PPN_SO']/100)*$dppAkhir),2);
|
|
$totAkhir = round(($dppAkhir+$ppnAkhir),2);
|
|
|
|
if ($verse==1) {
|
|
$update = [
|
|
'NILAI_SO' => $totAkhir
|
|
];
|
|
} else if ($verse==2) {
|
|
$input = [
|
|
'SO_ID' => $id_so,
|
|
'STATUS_HPSO' => '1',
|
|
'LAST_HPSO' => $timestamp
|
|
];
|
|
$action = $this->Amod->create('histori_persiapanso', $input);
|
|
|
|
$ket_so_rev = $datSo[0]['KET_SO_REV'];
|
|
$kode_barang = $datDo[0]['KODE_BARANG'];
|
|
if ($ket_so_rev==NULL OR $ket_so_rev=="") {
|
|
$ket_so_rev = "Hapus Barang $kode_barang,";
|
|
} else {
|
|
$ket_so_rev .= " Hapus Barang $kode_barang,";
|
|
}
|
|
$update = [
|
|
'PERSIAPAN_SO' => '0',
|
|
'NILAI_SO' => $totAkhir,
|
|
'KET_SO_REV' => $ket_so_rev,
|
|
'REVISI_SO' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
}
|
|
$action = $this->Amod->update('sales_order', $update, 'ID_SO', $id_so);
|
|
$value = 1;
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value
|
|
]);
|
|
}
|
|
|
|
public function PJ_Hapus_DataSalesOrder() { // Validasi
|
|
$id_so = $this->input->post('id_so');
|
|
$verse = $this->input->post('verse');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$value = 0;
|
|
if ($verse==1) {
|
|
$datSo = $this->Amod->getData_SalesOrder_byID_statusNull($id_so);
|
|
} else if ($verse==2) {
|
|
$datSo = $this->Amod->getData_SalesOrder_byID_bySTATUS($id_so, 0);
|
|
}
|
|
if ($datSo==FALSE) {
|
|
$value = 2;
|
|
} else {
|
|
if ($verse==2) {
|
|
$datDo = $this->Amod->getData_DaftarOrder_bySO($id_so);
|
|
foreach ($datDo as $key) {
|
|
if ($key['TYPE_JENIS']==1) {
|
|
$datSnj = $this->Amod->getData_SnJual_byDO($key['ID_DO']);
|
|
foreach ($datSnj as $dat) {
|
|
$datSnStock = $this->Amod->getData_SnStock_byNAMA_bySTATUS($dat['NAMA_SNJ'], 10);
|
|
if ($datSnStock==TRUE) {
|
|
$update = [
|
|
'STATUS_SNSTOCK' => '0'
|
|
];
|
|
$action = $this->Amod->update('sn_stock', $update, 'ID_SNSTOCK', $datSnStock[0]['ID_SNSTOCK']);
|
|
|
|
$this->GE_Kalkulasi_KuantitiBarang($key['BARANG_ID'], $datSo[0]['GUDANG_SO'], "Step 2 - PENJUALAN - Hapus Barang", 0, 1);
|
|
}
|
|
}
|
|
$action = $this->Amod->delete('sn_jual', $key['ID_DO'], 'DO_ID');
|
|
}
|
|
}
|
|
|
|
$datIo = $this->Amod->getData_TransaksiStock_bySO_statusNull($id_so);
|
|
foreach ($datIo as $key) {
|
|
if ($key['JENIS_IO']==0) {
|
|
if ($key['TYPE_JENIS']==1) {
|
|
$datSnio = $this->Amod->getData_SnIo_byIO($key['ID_IO']);
|
|
foreach ($datSnio as $dat) {
|
|
$datSnStock = $this->Amod->getData_SnStock_byNAMA_bySTATUS($dat['NAMA_SNIO'], 10);
|
|
if ($datSnStock==TRUE) {
|
|
$update = [
|
|
'STATUS_SNSTOCK' => '0'
|
|
];
|
|
$action = $this->Amod->update('sn_stock', $update, 'ID_SNSTOCK', $datSnStock[0]['ID_SNSTOCK']);
|
|
}
|
|
}
|
|
$action = $this->Amod->delete('sn_io', $key['ID_IO'], 'IO_ID');
|
|
}
|
|
|
|
$this->GE_Kalkulasi_KuantitiBarang($key['BARANG_ID'], $datSo[0]['GUDANG_SO'], "Step 2 - PENJUALAN - Hapus Barang", 0, $key['QTY_IO']);
|
|
} else if ($key['JENIS_IO']==1) {
|
|
if ($key['TYPE_JENIS']==1) {
|
|
$datSnio = $this->Amod->getData_SnIo_byIO($key['ID_IO']);
|
|
foreach ($datSnio as $dat) {
|
|
$datSnStock = $this->Amod->getData_SnStock_byNAMA_statusNull($dat['NAMA_SNIO']);
|
|
if ($datSnStock==TRUE) {
|
|
$action = $this->Amod->delete('sn_stock', $datSnStock[0]['ID_SNSTOCK'], 'ID_SNSTOCK');
|
|
}
|
|
}
|
|
$action = $this->Amod->delete('sn_io', $key['ID_IO'], 'IO_ID');
|
|
}
|
|
}
|
|
}
|
|
|
|
$action = $this->Amod->delete('transaksi_stock', $id_so, 'SO_ID');
|
|
}
|
|
|
|
$action = $this->Amod->delete('daftar_order', $id_so, 'SO_ID');
|
|
|
|
// Hapus PO Jual
|
|
$filename = $datSo[0]['FILEPO_SO'];
|
|
if ($filename==NULL) {
|
|
|
|
} else {
|
|
$path = FCPATH . 'uploads/pojual/' . $filename;
|
|
if (is_file($path)) {
|
|
unlink($path);
|
|
|
|
$update = [
|
|
'PO_SO' => "",
|
|
'FILEPO_SO' => NULL
|
|
];
|
|
$action = $this->Amod->update('sales_order', $update, 'ID_SO', $id_so);
|
|
}
|
|
}
|
|
|
|
// Hapus Lampiran Jual
|
|
$kode_so = $datSo[0]['KODE_SO'];
|
|
$pathatt = glob("uploads/lampiranjual/$kode_so/*");
|
|
foreach ($pathatt as $file) {
|
|
if (is_file($file)) {
|
|
unlink($file);
|
|
}
|
|
}
|
|
rmdir("uploads/lampiranjual/$kode_so/");
|
|
|
|
$update = [
|
|
'STATUS_SO' => '9',
|
|
'NILAI_SO' => '0',
|
|
'HAPUS_SO' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('sales_order', $update, 'ID_SO', $id_so);
|
|
$value = 1;
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value
|
|
]);
|
|
}
|
|
|
|
public function PJ_Hapus_DataSnIo() { // Validasi
|
|
$id_snio = $this->input->post('id_snio');
|
|
$id_io = $this->input->post('id_io');
|
|
$id_so = $this->input->post('id_so');
|
|
|
|
$value = 0;
|
|
$datSo = $this->Amod->getData_SalesOrder_byID_bySTATUS($id_so, 0);
|
|
if ($datSo==FALSE) {
|
|
$value = 5;
|
|
} else {
|
|
$datIo = $this->Amod->getData_TransaksiStock_byID_statusNull($id_io);
|
|
if ($datIo==FALSE) {
|
|
$value = 4;
|
|
} else {
|
|
if ($datIo[0]['JENIS_IO']==0) {
|
|
$datSnIo = $this->Amod->getData_SnIo_byID_bySTATUS($id_snio, 10);
|
|
if ($datSnIo==FALSE) {
|
|
$value = 3;
|
|
} else {
|
|
$countBefore = $this->Amod->getCount_SnIo_byIO($id_io);
|
|
|
|
$update = [
|
|
'STATUS_SNSTOCK' => '0'
|
|
];
|
|
$action = $this->Amod->update('sn_stock', $update, 'ID_SNSTOCK', $datSnIo[0]['ID_SNSTOCK']);
|
|
$action = $this->Amod->delete('sn_io', $id_snio, 'ID_SNIO');
|
|
|
|
if ($countBefore==$datIo[0]['QTY_IO']) {
|
|
$value = 2;
|
|
} else {
|
|
$value = 1;
|
|
}
|
|
}
|
|
} else if ($datIo[0]['JENIS_IO']==1) {
|
|
$datSnIo = $this->Amod->getData_SnIo_byID_statusNull($id_snio);
|
|
if ($datSnIo==FALSE) {
|
|
$value = 3;
|
|
} else {
|
|
$countBefore = $this->Amod->getCount_SnIo_byIO($id_io);
|
|
|
|
$action = $this->Amod->delete('sn_stock', $datSnIo[0]['ID_SNSTOCK'], 'ID_SNSTOCK');
|
|
$action = $this->Amod->delete('sn_io', $id_snio, 'ID_SNIO');
|
|
|
|
if ($countBefore==$datIo[0]['QTY_IO']) {
|
|
$value = 2;
|
|
} else {
|
|
$value = 1;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
}
|
|
|
|
public function PJ_Hapus_DataSnJual() { // Validasi
|
|
$id_snj = $this->input->post('id_snj');
|
|
$id_do = $this->input->post('id_do');
|
|
$id_so = $this->input->post('id_so');
|
|
|
|
$value = 0;
|
|
$datSo = $this->Amod->getData_SalesOrder_byID_bySTATUS($id_so, 0);
|
|
if ($datSo==FALSE) {
|
|
$value = 5;
|
|
} else {
|
|
$datDo = $this->Amod->getData_DaftarOrder_byID($id_do);
|
|
if ($datDo==FALSE) {
|
|
$value = 4;
|
|
} else {
|
|
$datSnj = $this->Amod->getData_SnJual_byID_bySTATUS($id_snj, 10);
|
|
if ($datSnj==FALSE) {
|
|
$value = 3;
|
|
} else {
|
|
$countBefore = $this->Amod->getCount_SnJual_byDO($id_do);
|
|
|
|
$update = [
|
|
'STATUS_SNSTOCK' => '0'
|
|
];
|
|
$action = $this->Amod->update('sn_stock', $update, 'ID_SNSTOCK', $datSnj[0]['ID_SNSTOCK']);
|
|
$action = $this->Amod->delete('sn_jual', $id_snj, 'ID_SNJ');
|
|
|
|
$this->GE_Kalkulasi_KuantitiBarang($datDo[0]['BARANG_ID'], $datSo[0]['GUDANG_SO'], "Step 2 - PENJUALAN - Hapus Barang", 0, 1);
|
|
|
|
if ($countBefore==$datDo[0]['QTY_DO']) {
|
|
$value = 2;
|
|
} else {
|
|
$value = 1;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
}
|
|
|
|
public function PJ_Hapus_DataTransaksiStock() { // Validasi
|
|
$id_io = $this->input->post('id_io');
|
|
$id_so = $this->input->post('id_so');
|
|
|
|
$value = 0;
|
|
$datSo = $this->Amod->getData_SalesOrder_byID_bySTATUS($id_so, 0);
|
|
if ($datSo==FALSE) {
|
|
$value = 3;
|
|
} else {
|
|
$datIo = $this->Amod->getData_TransaksiStock_byID_statusNull($id_io);
|
|
if ($datIo==FALSE) {
|
|
$value = 2;
|
|
} else {
|
|
if ($datIo[0]['JENIS_IO']==0) {
|
|
if ($datIo[0]['TYPE_JENIS']==1) {
|
|
$datSnio = $this->Amod->getData_SnIo_byIO($id_io);
|
|
foreach ($datSnio as $key) {
|
|
$datSnStock = $this->Amod->getData_SnStock_byNAMA_bySTATUS($key['NAMA_SNIO'], 10);
|
|
if ($datSnStock==TRUE) {
|
|
$update = [
|
|
'STATUS_SNSTOCK' => '0'
|
|
];
|
|
$action = $this->Amod->update('sn_stock', $update, 'ID_SNSTOCK', $datSnStock[0]['ID_SNSTOCK']);
|
|
}
|
|
}
|
|
$action = $this->Amod->delete('sn_io', $id_io, 'IO_ID');
|
|
}
|
|
|
|
$this->GE_Kalkulasi_KuantitiBarang($datIo[0]['BARANG_ID'], $datIo[0]['GUDANG_IO'], "Step 2 - PENJUALAN - Hapus Barang", 0, $datIo[0]['QTY_IO']);
|
|
} else if ($datIo[0]['JENIS_IO']==1) {
|
|
if ($datIo[0]['TYPE_JENIS']==1) {
|
|
$datSnio = $this->Amod->getData_SnIo_byIO($id_io);
|
|
foreach ($datSnio as $key) {
|
|
$datSnStock = $this->Amod->getData_SnStock_byNAMA_statusNull($key['NAMA_SNIO']);
|
|
if ($datSnStock==TRUE) {
|
|
$action = $this->Amod->delete('sn_stock', $datSnStock[0]['ID_SNSTOCK'], 'ID_SNSTOCK');
|
|
}
|
|
}
|
|
$action = $this->Amod->delete('sn_io', $id_io, 'IO_ID');
|
|
}
|
|
}
|
|
$action = $this->Amod->delete('transaksi_stock', $id_io, 'ID_IO');
|
|
$value = 1;
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value
|
|
]);
|
|
}
|
|
|
|
public function PJ_Kunci_DataSalesOrder() { // Validasi
|
|
$id_so = $this->input->post('id_so');
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
$now = date('Y-m-d');
|
|
|
|
//Check Konsistensi Data
|
|
$value = 0;
|
|
$datSo = $this->Amod->getData_SalesOrder_byID_bySTATUS($id_so, 1);
|
|
if ($datSo==FALSE) {
|
|
$value = 3;
|
|
} else {
|
|
$datSosjpj = $this->Amod->getData_SoSjPenjualan_bySO($id_so);
|
|
if ($datSosjpj==TRUE) {
|
|
$value = 2;
|
|
} else {
|
|
if ($datSo[0]['ALUR_SO']==1) {
|
|
$datPelanggan = $this->Amod->getData_Pelanggan_byID($datSo[0]['PELANGGAN_ID']);
|
|
$tempo_penjualan = $this->Amod->generate_addDay($now, $datPelanggan[0]['TOP_PELANGGAN']);
|
|
|
|
$sj_penjualan = $this->Amod->generate_SJPenjualan($datSo[0]['CORP_ID']);
|
|
$inv_penjualan = $this->Amod->generate_INVPenjualan($datSo[0]['CORP_ID']);
|
|
$kode_penjualan = $this->Amod->generate_kodePenjualan();
|
|
$ket_pda = "No Nota : $inv_penjualan";
|
|
|
|
if ($datSo[0]['NPWP_CORP']==NULL) {
|
|
$fp_penjualan = "00000000000000000";
|
|
$tt_penjualan = $now;
|
|
} else {
|
|
$fp_penjualan = NULL;
|
|
$tt_penjualan = NULL;
|
|
}
|
|
|
|
//Buat SJ Baru
|
|
$input = [
|
|
'CORP_ID' => $datSo[0]['CORP_ID'],
|
|
'PELANGGAN_ID' => $datSo[0]['PELANGGAN_ID'],
|
|
'TGL_SJPJ' => $now,
|
|
'KODE_SJPJ' => $sj_penjualan,
|
|
'STATUS_SJPJ' => '2',
|
|
'CIPTA_SJPJ' => "Oleh $panggilan pada $timestamp",
|
|
'PROSES_SJPJ' => "Oleh $panggilan pada $timestamp",
|
|
'KUNCI_SJPJ' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->create('sj_penjualan', $input);
|
|
|
|
$id_sjpj = $this->Amod->getMax_ID_SjPenjualan();
|
|
$id_sjpj = $id_sjpj[0]['ID_SJPJ'];
|
|
|
|
$input = [
|
|
'SJPJ_ID' => $id_sjpj,
|
|
'SO_ID' => $id_so
|
|
];
|
|
$action = $this->Amod->create('so_sjpenjualan', $input);
|
|
|
|
//Buat INV Baru
|
|
$input = [
|
|
'KOP_ID' => $datSo[0]['CORP_ID'],
|
|
'PEL_ID' => $datSo[0]['PELANGGAN_ID'],
|
|
'TGL_PENJUALAN' => $now,
|
|
'KODE_PENJUALAN' => $kode_penjualan,
|
|
'INV_PENJUALAN' => $inv_penjualan,
|
|
'FP_PENJUALAN' => $fp_penjualan,
|
|
'TT_PENJUALAN' => $tt_penjualan,
|
|
'TEMPO_PENJUALAN' => $tempo_penjualan,
|
|
'KET_PENJUALAN' => $ket_pda,
|
|
'STATUS_PENJUALAN' => '1'
|
|
];
|
|
$action = $this->Amod->create('penjualan', $input);
|
|
|
|
$id_penjualan = $this->Amod->getMax_ID_Penjualan();
|
|
$id_penjualan = $id_penjualan[0]['ID_PENJUALAN'];
|
|
|
|
$input = [
|
|
'PENJUALAN_ID' => $id_penjualan,
|
|
'SJPJ_ID' => $id_sjpj
|
|
];
|
|
$action = $this->Amod->create('sj_invpenjualan', $input);
|
|
|
|
$input = [
|
|
'SJ_INV' => '0',
|
|
'TGL_CD' => $now,
|
|
'KODE_BUKTI' => $sj_penjualan,
|
|
'SJPJ_ID' => $id_sjpj
|
|
];
|
|
$action = $this->Amod->create('cetak_dokumen', $input);
|
|
|
|
$input = [
|
|
'SJ_INV' => '1',
|
|
'TGL_CD' => $now,
|
|
'KODE_BUKTI' => $inv_penjualan,
|
|
'PENJUALAN_ID' => $id_penjualan
|
|
];
|
|
$action = $this->Amod->create('cetak_dokumen', $input);
|
|
|
|
$sumSo = $this->Amod->getSum_DaftarOrder_bySO($id_so);
|
|
$dpp = $sumSo[0]['TOTAL'];
|
|
$pajak_keluaran = round(($dpp*($datSo[0]['PPN_SO']/100)),2);
|
|
$debet_dak = round(($dpp+$pajak_keluaran),2);
|
|
|
|
if ($debet_dak==0) {
|
|
$status_hhpda = 1;
|
|
$tgllock_hhpda = $now;
|
|
$lunas_hhpda = $kode_penjualan;
|
|
} else {
|
|
$status_hhpda = 0;
|
|
$tgllock_hhpda = NULL;
|
|
$lunas_hhpda = NULL;
|
|
}
|
|
|
|
$input = [
|
|
'PENJUALAN_ID' => $id_penjualan,
|
|
'PELANGGAN_ID' => $datSo[0]['PELANGGAN_ID'],
|
|
'CORP_ID' => $datSo[0]['CORP_ID'],
|
|
'DEBET_HHPDA' => $debet_dak,
|
|
'KREDIT_HHPDA' => '0',
|
|
'STATUS_HHPDA' => $status_hhpda,
|
|
'LAST_HHPDA' => $timestamp,
|
|
'TGLLOCK_HHPDA' => $tgllock_hhpda,
|
|
'LUNAS_HHPDA' => $lunas_hhpda
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungpda', $input);
|
|
|
|
$input = [
|
|
'CIPTA_AKUNTANSI' => "Oleh $panggilan pada $timestamp",
|
|
'TGL_AKUNTANSI' => $now,
|
|
'KODE_AKUNTANSI' => $kode_penjualan,
|
|
'STATUS_AKUNTANSI' => '1',
|
|
];
|
|
$action = $this->Amod->create('akuntansi', $input);
|
|
|
|
$id_akuntansi = $this->Amod->getMax_ID_Akuntansi();
|
|
$id_akuntansi = $id_akuntansi[0]['ID_AKUNTANSI'];
|
|
|
|
$input = [
|
|
'AKUNTANSI_ID' => $id_akuntansi,
|
|
'PERKIRAAN_ID' => '3',
|
|
'JENIS_PDA' => '0',
|
|
'CIPTA_DAK' => "Oleh $panggilan pada $timestamp",
|
|
'JENIS_DAK' => '0',
|
|
'DEBET_DAK' => $debet_dak,
|
|
'KREDIT_DAK' => '0',
|
|
'KET_DAK' => $ket_pda,
|
|
'PELANGGAN_ID' => $datSo[0]['PELANGGAN_ID'],
|
|
'PENJUALAN_ID' => $id_penjualan
|
|
];
|
|
$action = $this->Amod->create('daftar_akuntansi', $input);
|
|
|
|
$input = [
|
|
'AKUNTANSI_ID' => $id_akuntansi,
|
|
'PERKIRAAN_ID' => '23',
|
|
'CIPTA_DAK' => "Oleh $panggilan pada $timestamp",
|
|
'JENIS_DAK' => '0',
|
|
'DEBET_DAK' => '0',
|
|
'KREDIT_DAK' => $dpp,
|
|
'KET_DAK' => $ket_pda,
|
|
'PELANGGAN_ID' => $datSo[0]['PELANGGAN_ID'],
|
|
'PENJUALAN_ID' => $id_penjualan
|
|
];
|
|
$action = $this->Amod->create('daftar_akuntansi', $input);
|
|
|
|
if ($datSo[0]['PPN_SO']>0) {
|
|
$input = [
|
|
'AKUNTANSI_ID' => $id_akuntansi,
|
|
'PERKIRAAN_ID' => '83',
|
|
'CIPTA_DAK' => "Oleh $panggilan pada $timestamp",
|
|
'JENIS_DAK' => '0',
|
|
'DEBET_DAK' => '0',
|
|
'KREDIT_DAK' => $pajak_keluaran,
|
|
'KET_DAK' => "Pajak Keluaran Kode : [$kode_penjualan]",
|
|
'PELANGGAN_ID' => $datSo[0]['PELANGGAN_ID'],
|
|
'PENJUALAN_ID' => $id_penjualan
|
|
];
|
|
$action = $this->Amod->create('daftar_akuntansi', $input);
|
|
}
|
|
|
|
if ($datSo[0]['FEE_SO']>0) {
|
|
$input = [
|
|
'PENJUALAN_ID' => $id_penjualan,
|
|
'PEL_ID' => $datSo[0]['PELANGGAN_ID'],
|
|
'DEBET_HHBFE' => '0',
|
|
'KREDIT_HHBFE' => $datSo[0]['FEE_SO'],
|
|
'STATUS_HHBFE' => '0',
|
|
'LAST_HHBFE' => $timestamp
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungbfe', $input);
|
|
}
|
|
|
|
if ($datSo[0]['KIRIM_SO']==1) {
|
|
$input = [
|
|
'KARYAWAN_ID' => $id_karyawan,
|
|
'SO_ID' => $id_so
|
|
];
|
|
$action = $this->Amod->create('jadwal_pengiriman', $input);
|
|
|
|
$terkirim_so = "Oleh $panggilan pada $timestamp";
|
|
$tgl_kirim = $now;
|
|
$tgl_ket = date('d/m/Y');
|
|
$ket_so_send = "Sudah diproses oleh $panggilan Tanggal $tgl_ket";
|
|
} else {
|
|
$terkirim_so = NULL;
|
|
$tgl_kirim = NULL;
|
|
$ket_so_send = NULL;
|
|
}
|
|
|
|
$update = [
|
|
'STATUS_SO' => '2',
|
|
'TGL_SO' => $now,
|
|
'NILAI_SO' => $debet_dak,
|
|
'KUNCI_SO' => "Oleh $panggilan pada $timestamp",
|
|
'TERKIRIM_SO' => $terkirim_so,
|
|
'TGL_KIRIM' => $tgl_kirim,
|
|
'KET_SO_SEND' => $ket_so_send
|
|
];
|
|
$action = $this->Amod->update('sales_order', $update, 'ID_SO', $id_so);
|
|
|
|
//Isi Jabaran SJ & Nota
|
|
$datDo = $this->Amod->getData_DaftarOrder_bySO($id_so);
|
|
foreach ($datDo as $key) {
|
|
$input = [
|
|
'SJPJ_ID' => $id_sjpj,
|
|
'DO_ID' => $key['ID_DO'],
|
|
'QTY_DFSJPJ' => $key['QTY_DO'],
|
|
'RETUR_DFSJPJ' => '0',
|
|
'NAMA_DFSJPJ' => $key['NAMA_BARANG']
|
|
];
|
|
$action = $this->Amod->create('daftar_sjpenjualan', $input);
|
|
|
|
$input = [
|
|
'PENJUALAN_ID' => $id_penjualan,
|
|
'DO_ID' => $key['ID_DO'],
|
|
'QTY_DFINVPJ' => $key['QTY_DO'],
|
|
'RETUR_DFINVPJ' => '0',
|
|
'HARGA_DFINVPJ' => $key['HARGA_DO'],
|
|
'NAMA_DFINVPJ' => $key['NAMA_BARANG'],
|
|
'STATUS_DFINVPJ' => '1',
|
|
];
|
|
$action = $this->Amod->create('daftar_invpenjualan', $input);
|
|
|
|
if ($key['TYPE_JENIS']==1) {
|
|
$year = date('Y');
|
|
$bulan = $this->Amod->generate_inisialMonth(date('m'));
|
|
$bulan = strtoupper("$bulan $year");
|
|
|
|
//Cek apakah Auto Sellout Aktif
|
|
$datStgas = $this->Amod->getData_SetToggleAs_byMERK_byPRODUK_bySTATUS($key['MERK_ID'], $key['PRODUK_ID'], 1);
|
|
if ($datStgas==TRUE) {
|
|
$nama_pkpr = "[AUTO SELLOUT] $bulan";
|
|
$datPkpr = $this->Amod->getData_PotonganKlaimProgram_byNAMA($nama_pkpr);
|
|
if ($datPkpr==TRUE) {
|
|
$id_pkpr = $datPkpr[0]['ID_PKPR'];
|
|
} else {
|
|
$input = [
|
|
'NAMA_PKPR' => $nama_pkpr
|
|
];
|
|
$action = $this->Amod->create('potongan_klaimprogram', $input);
|
|
|
|
$id_pkpr = $this->Amod->getMax_ID_PotonganKlaimProgram();
|
|
$id_pkpr = $id_pkpr[0]['ID_PKPR'];
|
|
}
|
|
}
|
|
|
|
//Cek apakah ada Promo Clearance
|
|
$datPc = $this->Amod->getData_PromoClearance_byBARANG_bySTATUS($key['BARANG_ID'], 1);
|
|
$clearSp = 0;
|
|
if ($datPc==TRUE) {
|
|
$clearSp = 1;
|
|
$datStpcPel = $this->Amod->getData_SetPelangganClearance_byPELANGGAN($datSo[0]['PELANGGAN_ID']);
|
|
$datStpcSal = $this->Amod->getData_SetPelangganClearance_bySALES($datSo[0]['SALES_ID']);
|
|
if ($datStpcPel==FALSE) {
|
|
if ($datStpcSal==TRUE) {
|
|
$status_dpc = 2;
|
|
} else {
|
|
$status_dpc = 0;
|
|
}
|
|
$input = [
|
|
'PC_ID' => $datPc[0]['ID_PC'],
|
|
'STATUS_DPC' => $status_dpc,
|
|
'PENJUALAN_ID' => $id_penjualan
|
|
];
|
|
$action = $this->Amod->create('daftar_promoclearance', $input);
|
|
}
|
|
}
|
|
|
|
$datSnj = $this->Amod->getData_SnJual_byDO($key['ID_DO']);
|
|
foreach ($datSnj as $dat) {
|
|
$datSnStock = $this->Amod->getData_SnStock_byNAMA_bySTATUS($dat['NAMA_SNJ'], 10);
|
|
if ($datSnStock==TRUE) {
|
|
$input = [
|
|
'TGL_HSN' => $now,
|
|
'KODE_BUKTI' => $kode_penjualan,
|
|
'SJ_HSN' => $sj_penjualan,
|
|
'INV_HSN' => $inv_penjualan,
|
|
'SNSTOCK_ID' => $datSnStock[0]['ID_SNSTOCK'],
|
|
'PELANGGAN_ID' => $datSo[0]['PELANGGAN_ID'],
|
|
];
|
|
$action = $this->Amod->create('histori_sn', $input);
|
|
|
|
$update = [
|
|
'STATUS_SNSTOCK' => '1'
|
|
];
|
|
$action = $this->Amod->update('sn_stock', $update, 'ID_SNSTOCK', $datSnStock[0]['ID_SNSTOCK']);
|
|
|
|
if ($datStgas==TRUE) {
|
|
$cekBarang = $this->Amod->getData_DaftarOtomasiBooster_byBARANG_bySTATUS_byLIMIT($key['BARANG_ID'], 1, $now);
|
|
if ($cekBarang==FALSE) {
|
|
$datSnkpr = $this->Amod->getData_SnKlaimProgram_bySNSTOCK($datSnStock[0]['ID_SNSTOCK']);
|
|
if ($datSnkpr==TRUE) {
|
|
$input = [
|
|
'CIPTA_LKPR' => "Oleh Sistem pada $timestamp",
|
|
'TGL_LKPR' => $now,
|
|
'PROGRAM_ID' => '1',
|
|
'SNKPR_ID' => $datSnkpr[0]['ID_SNKPR'],
|
|
'PKPR_ID' => $id_pkpr,
|
|
'NILAI_LKPR' => '0'
|
|
];
|
|
$action = $this->Amod->create('link_klaimprogram', $input);
|
|
|
|
$id_lkpr = $this->Amod->getMax_ID_LinkKlaimProgram();
|
|
$id_lkpr = $id_lkpr[0]['ID_LKPR'];
|
|
|
|
$input = [
|
|
'STGAS_ID' => $datStgas[0]['ID_STGAS'],
|
|
'LKPR_ID' => $id_lkpr,
|
|
'TIMESTAMP' => $timestamp
|
|
];
|
|
$action = $this->Amod->create('histori_otomasisellout', $input);
|
|
|
|
$update = [
|
|
'STATUS_SNKPR' => '1'
|
|
];
|
|
$action = $this->Amod->update('sn_klaimprogram', $update, 'ID_SNKPR', $datSnkpr[0]['ID_SNKPR']);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
$this->GE_Kalkulasi_KuantitiBarang($key['BARANG_ID'], $datSo[0]['GUDANG_SO'], "Step 2 - PENJUALAN - Kunci Barang", $key['TYPE_JENIS'], $key['QTY_DO']);
|
|
} else if ($key['TYPE_JENIS']==0) {
|
|
$this->GE_Kalkulasi_KuantitiBarang($key['BARANG_ID'], $datSo[0]['GUDANG_SO'], "Step 2 - PENJUALAN - Kunci Barang", $key['TYPE_JENIS'], $key['QTY_DO']);
|
|
}
|
|
|
|
if ($key['TYPE_JENIS']!=2) {
|
|
$this->GE_Kalkulasi_HistoriKuantiti($key['BARANG_ID'], "Step 2 - PENJUALAN - Kunci Barang", 0, $key['QTY_DO'], $kode_penjualan, 0, 0);
|
|
}
|
|
|
|
if ($datPelanggan[0]['TYPE_PELANGGAN']=="1") {
|
|
$komisi_do = $key['KOMISI_DEALER'];
|
|
} else {
|
|
$komisi_do = $key['KOMISI_USER'];
|
|
}
|
|
|
|
$datSsp = $this->Amod->getData_SetSalesProduk_byMERK_byPRODUK($key['MERK_ID'], $key['PRODUK_ID']);
|
|
if ($datSsp==FALSE) {
|
|
$sp_do = NULL;
|
|
} else {
|
|
if ($datSsp[0]['SALES_ID']==NULL) {
|
|
$sp_do = NULL;
|
|
} else {
|
|
$datSales = $this->Amod->getData_Karyawan_byID($datSsp[0]['SALES_ID']);
|
|
$sp_do = $datSales[0]['NAMA_PANGGILAN_KARYAWAN'];
|
|
if ($clearSp==1) {
|
|
$sp_do = NULL;
|
|
}
|
|
}
|
|
}
|
|
|
|
$update = [
|
|
'KOMISI_DO' => $komisi_do,
|
|
'SP_DO' => $sp_do,
|
|
];
|
|
$action = $this->Amod->update('daftar_order', $update, 'ID_DO', $key['ID_DO']);
|
|
}
|
|
|
|
//Transaksi Keluar Masuk Barang
|
|
$datIo = $this->Amod->getData_TransaksiStock_bySO_statusNull($id_so);
|
|
foreach ($datIo as $key) {
|
|
if ($key['JENIS_IO']==0) {
|
|
if ($key['TYPE_JENIS']==1) {
|
|
$datSnIo = $this->Amod->getData_SnIo_byIO($key['ID_IO']);
|
|
foreach ($datSnIo as $dat) {
|
|
$datSnStock = $this->Amod->getData_SnStock_byNAMA_bySTATUS($dat['NAMA_SNIO'], 10);
|
|
if ($datSnStock==TRUE) {
|
|
$input = [
|
|
'TGL_HSN' => $now,
|
|
'KODE_BUKTI' => $kode_penjualan,
|
|
'SJ_HSN' => $sj_penjualan,
|
|
'INV_HSN' => $inv_penjualan,
|
|
'PELANGGAN_ID' => $datSo[0]['PELANGGAN_ID'],
|
|
'SNSTOCK_ID' => $datSnStock[0]['ID_SNSTOCK']
|
|
];
|
|
$action = $this->Amod->create('histori_sn', $input);
|
|
|
|
$update = [
|
|
'STATUS_SNSTOCK' => '1'
|
|
];
|
|
$action = $this->Amod->update('sn_stock', $update, 'ID_SNSTOCK', $datSnStock[0]['ID_SNSTOCK']);
|
|
}
|
|
}
|
|
}
|
|
|
|
if ($key['TYPE_JENIS']!=2) {
|
|
$this->GE_Kalkulasi_KuantitiBarang($key['BARANG_ID'], $datSo[0]['GUDANG_SO'], "Step 2 - PENJUALAN - Kunci Barang", 1, $key['QTY_IO']);
|
|
$this->GE_Kalkulasi_HistoriKuantiti($key['BARANG_ID'], "Step 2 - PENJUALAN - Kunci Barang", $key['JENIS_IO'], $key['QTY_IO'], $kode_penjualan, 0, 0);
|
|
|
|
$update = [
|
|
'STATUS_IO' => '1',
|
|
'JIO_ID' => '2',
|
|
'PROSES_IO' => "Oleh $panggilan pada $timestamp",
|
|
'KODE_BUKTI' => $kode_penjualan
|
|
];
|
|
$action = $this->Amod->update('transaksi_stock', $update, 'ID_IO', $key['ID_IO']);
|
|
}
|
|
} else if ($key['JENIS_IO']==1) {
|
|
if ($key['TYPE_JENIS']==1) {
|
|
$datSnIo = $this->Amod->getData_SnIo_byIO($key['ID_IO']);
|
|
foreach ($datSnIo as $dat) {
|
|
$datSnStock = $this->Amod->getData_SnStock_byNAMA_statusNull($dat['NAMA_SNIO']);
|
|
if ($datSnStock==TRUE) {
|
|
$input = [
|
|
'TGL_HSN' => $now,
|
|
'KODE_BUKTI' => $datSo[0]['KODE_SO'],
|
|
'SNSTOCK_ID' => $datSnStock[0]['ID_SNSTOCK']
|
|
];
|
|
$action = $this->Amod->create('histori_sn', $input);
|
|
|
|
$update = [
|
|
'STATUS_SNSTOCK' => '0'
|
|
];
|
|
$action = $this->Amod->update('sn_stock', $update, 'ID_SNSTOCK', $datSnStock[0]['ID_SNSTOCK']);
|
|
}
|
|
}
|
|
}
|
|
|
|
if ($key['TYPE_JENIS']!=2) {
|
|
$this->GE_Kalkulasi_KuantitiBarang($key['BARANG_ID'], $datSo[0]['GUDANG_SO'], "Step 2 - PENJUALAN - Kunci Barang", 2, $key['QTY_IO']);
|
|
$this->GE_Kalkulasi_HistoriKuantiti($key['BARANG_ID'], "Step 2 - PENJUALAN - Kunci Barang", $key['JENIS_IO'], $key['QTY_IO'], $kode_penjualan, 0, $key['ID_IO']);
|
|
|
|
$update = [
|
|
'STATUS_IO' => '1',
|
|
'JIO_ID' => '2',
|
|
'PROSES_IO' => "Oleh $panggilan pada $timestamp",
|
|
'KODE_BUKTI' => $kode_penjualan
|
|
];
|
|
$action = $this->Amod->update('transaksi_stock', $update, 'ID_IO', $key['ID_IO']);
|
|
}
|
|
}
|
|
}
|
|
|
|
$this->GE_Kalkulasi_HistoriOtomasiBooster($id_penjualan);
|
|
|
|
$value = 1;
|
|
}
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
|
|
}
|
|
|
|
public function PJ_Proses_DataSalesOrder() { // Validasi
|
|
$id_so = $this->input->post('id_so');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
$now = date('Y-m-d');
|
|
|
|
//Check Konsistensi Data
|
|
$value = 0;
|
|
$datSo = $this->Amod->getData_SalesOrder_byID_statusNull($id_so);
|
|
if ($datSo==FALSE) {
|
|
$value = 2;
|
|
} else {
|
|
$sumDo = $this->Amod->getSum_DaftarOrder_bySO($id_so);
|
|
$nilai_so = round(($sumDo[0]['TOTAL']+(($datSo[0]['PPN_SO']/100)*$sumDo[0]['TOTAL'])),2);
|
|
|
|
$update = [
|
|
'TGL_SO' => $now,
|
|
'NILAI_SO' => $nilai_so,
|
|
'PERSIAPAN_SO' => '1',
|
|
'PROSES_SO' => "Oleh $panggilan pada $timestamp",
|
|
'STATUS_SO' => '0'
|
|
];
|
|
$action = $this->Amod->update('sales_order', $update, 'ID_SO', $id_so);
|
|
|
|
$input = [
|
|
'SO_ID' => $id_so,
|
|
'STATUS_HPSO' => '1',
|
|
'LAST_HPSO' => $timestamp
|
|
];
|
|
$action = $this->Amod->create('histori_persiapanso', $input);
|
|
$value = 1;
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
|
|
}
|
|
|
|
public function PJ_Revisi_DataSalesOrder() { // Validasi
|
|
$id_so = $this->input->post('id_so');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
$now = date('Y-m-d');
|
|
|
|
//Check Konsistensi Data
|
|
$value = 0;
|
|
$datSo = $this->Amod->getData_SalesOrder_byID_bySTATUS($id_so, 1);
|
|
if ($datSo==FALSE) {
|
|
$value = 3;
|
|
} else {
|
|
$datSosjpj = $this->Amod->getData_SoSjPenjualan_bySO($id_so);
|
|
if ($datSosjpj==TRUE) {
|
|
$value = 2;
|
|
} else {
|
|
$datDo = $this->Amod->getData_DaftarOrder_bySO($id_so);
|
|
foreach ($datDo as $key) {
|
|
if ($key['TYPE_JENIS']==0) {
|
|
$this->GE_Kalkulasi_KuantitiBarang($key['BARANG_ID'], $datSo[0]['GUDANG_SO'], "Step 2 - PENJUALAN - Hapus Barang", 0, $key['QTY_DO']);
|
|
}
|
|
}
|
|
|
|
$update = [
|
|
'TGL_SO' => $now,
|
|
'STATUS_SO' => '0',
|
|
'PERSIAPAN_SO' => '3',
|
|
'BUKA_SO' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('sales_order', $update, 'ID_SO', $id_so);
|
|
|
|
$input = [
|
|
'SO_ID' => $id_so,
|
|
'STATUS_HPSO' => '3',
|
|
'LAST_HPSO' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->create('histori_persiapanso', $input);
|
|
|
|
$action = $this->Amod->delete('quality_control', $id_so, 'SO_ID');
|
|
$value = 1;
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
|
|
}
|
|
|
|
public function PJ_Siap_DataSalesOrder() { // Validasi
|
|
$id_so = $this->input->post('id_so');
|
|
$qc = $this->input->post('qc');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
$now = date('Y-m-d');
|
|
|
|
//Check Konsistensi Data
|
|
$value = 0;
|
|
$datSo = $this->Amod->getData_SalesOrder_byID_bySTATUS($id_so, 0);
|
|
if ($datSo==FALSE) {
|
|
$value = 7;
|
|
} else {
|
|
if ($datSo[0]['GUDANG_SO']==3) {
|
|
$jenis_kuantiti = 10;
|
|
} else {
|
|
$jenis_kuantiti = $datSo[0]['GUDANG_SO'];
|
|
}
|
|
$datDo = $this->Amod->getData_DaftarOrder_bySO($id_so);
|
|
foreach ($datDo as $key) {
|
|
if ($key['TYPE_JENIS']==0) {
|
|
$cekQty = $this->GE_AmbilData_DataKuantiti($key['BARANG_ID'], $jenis_kuantiti);
|
|
if ($cekQty<$key['QTY_DO'] AND $datSo[0]['GUDANG_SO']==3) {
|
|
$value = 6;
|
|
break;
|
|
} else if ($cekQty<$key['QTY_DO'] AND $datSo[0]['GUDANG_SO']==2) {
|
|
$value = 5;
|
|
break;
|
|
} else if ($cekQty<$key['QTY_DO'] AND $datSo[0]['GUDANG_SO']==1) {
|
|
$value = 4;
|
|
break;
|
|
}
|
|
} else if ($key['TYPE_JENIS']==1) {
|
|
$cekQty = $this->GE_AmbilData_DataKuantiti($key['BARANG_ID'], 3);
|
|
if ($cekQty<$key['QTY_DO']) {
|
|
$value = 3;
|
|
break;
|
|
}
|
|
|
|
$countSnj = $this->Amod->getCount_SnJual_byDO($key['ID_DO']);
|
|
if ($countSnj<$key['QTY_DO']) {
|
|
$value = 2;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
if ($value==0) {
|
|
$datIo = $this->Amod->getData_TransaksiStock_bySO_statusNull($id_so);
|
|
foreach ($datIo as $key) {
|
|
if ($key['JENIS_IO']==0) {
|
|
$cekQty = $this->GE_AmbilData_DataKuantiti($key['BARANG_ID'], 3);
|
|
if ($cekQty<$key['QTY_IO']) {
|
|
$value = 3;
|
|
break;
|
|
}
|
|
} else if ($key['JENIS_IO']==1) {
|
|
$countSnio = $this->Amod->getCount_SnIo_byIO($key['ID_IO']);
|
|
if ($countSnio<$key['QTY_IO']) {
|
|
$value = 2;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if ($value==0) {
|
|
foreach ($qc as $key) {
|
|
$input = [
|
|
'KARYAWAN_ID' => $key,
|
|
'SO_ID' => $id_so,
|
|
'TGL_QC' => $now
|
|
];
|
|
$action = $this->Amod->create('quality_control', $input);
|
|
}
|
|
|
|
foreach ($datDo as $key) {
|
|
if ($key['TYPE_JENIS']==0) {
|
|
$this->GE_Kalkulasi_KuantitiBarang($key['BARANG_ID'], $datSo[0]['GUDANG_SO'], "Step 2 - PENJUALAN - Tambah Barang", 0, $key['QTY_DO']);
|
|
}
|
|
}
|
|
|
|
$update = [
|
|
'TGL_SO' => $now,
|
|
'STATUS_SO' => '1',
|
|
'PERSIAPAN_SO' => '4',
|
|
'SIAP_SO' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('sales_order', $update, 'ID_SO', $id_so);
|
|
|
|
$input = [
|
|
'SO_ID' => $id_so,
|
|
'STATUS_HPSO' => '4',
|
|
'LAST_HPSO' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->create('histori_persiapanso', $input);
|
|
$value = 1;
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
|
|
}
|
|
|
|
public function PJ_Tambah_DataDaftarOrder() { // Validasi
|
|
$id_so = $this->input->post('id_so');
|
|
$id_barang = $this->input->post('id_barang');
|
|
$qty_do = $this->input->post('qty_do');
|
|
$harga_do = $this->input->post('harga_do');
|
|
$verse = $this->input->post('verse');
|
|
$mode = $this->input->post('mode');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$value = 0;
|
|
if ($verse==1) {
|
|
$datSo = $this->Amod->getData_SalesOrder_byID_statusNull($id_so);
|
|
} else if ($verse==2) {
|
|
$datSo = $this->Amod->getData_SalesOrder_byID_bySTATUS($id_so, 0);
|
|
}
|
|
if ($mode==1) {
|
|
$harga_do = round($harga_do/(($datSo[0]['PPN_SO']+100)/100),2);
|
|
}
|
|
if ($datSo==FALSE) {
|
|
$value = 3;
|
|
} else {
|
|
$sumDo = $this->Amod->getSum_DaftarOrder_bySO($id_so);
|
|
if ($sumDo[0]['TOTAL']==NULL) {
|
|
$tot = 0;
|
|
} else {
|
|
$dpp = $sumDo[0]['TOTAL'];
|
|
$ppn = round((($datSo[0]['PPN_SO']/100)*$dpp),2);
|
|
$tot = round(($dpp+$ppn),2);
|
|
}
|
|
|
|
$sumPda = $this->Amod->getSum_HasilHitungPda_byPELANGGAN($datSo[0]['PELANGGAN_ID']);
|
|
if ($sumPda==FALSE) {
|
|
$debet_pda = 0;
|
|
$kredit_pda = 0;
|
|
} else {
|
|
$debet_pda = $sumPda[0]['DEBET'];
|
|
$kredit_pda = $sumPda[0]['KREDIT'];
|
|
}
|
|
|
|
$sumDoAktif = $this->Amod->getSum_DaftarOrder_byPELANGGAN_status0_2_3($datSo[0]['PELANGGAN_ID'], $id_so);
|
|
if ($sumDoAktif[0]['TOTAL']==NULL) {
|
|
$doAktif = 0;
|
|
} else {
|
|
$doAktif = round($sumDoAktif[0]['TOTAL'],2);
|
|
}
|
|
|
|
$limit = $datSo[0]['LIMIT_PELANGGAN']-($harga_do*$qty_do)-$tot-$doAktif-$debet_pda+$kredit_pda;
|
|
if ($limit<0) {
|
|
$value = 2;
|
|
} else {
|
|
$datBarang = $this->Amod->getData_Barang_byID($id_barang);
|
|
$input = [
|
|
'SO_ID' => $id_so,
|
|
'BARANG_ID' => $id_barang,
|
|
'QTY_DO' => $qty_do,
|
|
'RETUR_DO' => '0',
|
|
'HARGA_DO' => $harga_do,
|
|
'NAMA_DO' => $datBarang[0]['NAMA_BARANG']
|
|
];
|
|
$action = $this->Amod->create('daftar_order', $input);
|
|
|
|
$sumDoAkhir = $this->Amod->getSum_DaftarOrder_bySO($id_so);
|
|
$dppAkhir = $sumDoAkhir[0]['TOTAL'];
|
|
$ppnAkhir = round((($datSo[0]['PPN_SO']/100)*$dppAkhir),2);
|
|
$totAkhir = round(($dppAkhir+$ppnAkhir),2);
|
|
|
|
if ($verse==1) {
|
|
$update = [
|
|
'NILAI_SO' => $totAkhir
|
|
];
|
|
} else if ($verse==2) {
|
|
$input = [
|
|
'SO_ID' => $id_so,
|
|
'STATUS_HPSO' => '1',
|
|
'LAST_HPSO' => $timestamp
|
|
];
|
|
$action = $this->Amod->create('histori_persiapanso', $input);
|
|
|
|
$ket_so_rev = $datSo[0]['KET_SO_REV'];
|
|
$kode_barang = $datBarang[0]['KODE_BARANG'];
|
|
if ($ket_so_rev==NULL OR $ket_so_rev=="") {
|
|
$ket_so_rev = "Tambah Barang $kode_barang,";
|
|
} else {
|
|
$ket_so_rev .= " Tambah Barang $kode_barang,";
|
|
}
|
|
$update = [
|
|
'PERSIAPAN_SO' => '0',
|
|
'NILAI_SO' => $totAkhir,
|
|
'KET_SO_REV' => $ket_so_rev,
|
|
'REVISI_SO' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
}
|
|
$action = $this->Amod->update('sales_order', $update, 'ID_SO', $id_so);
|
|
|
|
$value = 1;
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
|
|
}
|
|
|
|
public function PJ_Tambah_DataFormFeePelanggan() { // Validasi
|
|
$id_penjualan = $this->input->post('id_penjualan');
|
|
$jenis_ffp = $this->input->post('jenis_ffp');
|
|
$ket_ffp = $this->input->post('ket_ffp');
|
|
$ket_ffp = preg_replace('/\R+/', " " , $ket_ffp);
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
$now = date('Y-m-d');
|
|
|
|
$value = 0;
|
|
$datPenjualan = $this->Amod->getData_Penjualan_byID($id_penjualan);
|
|
if ($datPenjualan==FALSE) {
|
|
$value = 4;
|
|
} else {
|
|
$datHhbfe = $this->Amod->getData_HasilHitungBfe_byPENJUALAN($id_penjualan);
|
|
if ($datHhbfe==FALSE OR $datHhbfe[0]['STATUS_HHBFE']>0) {
|
|
$value = 3;
|
|
} else {
|
|
$datFfp = $this->Amod->getData_FormFeePelanggan_byPENJUALAN_bySTATUS($id_penjualan, 0);
|
|
if ($datFfp==TRUE) {
|
|
$value = 2;
|
|
} else {
|
|
$kode_ffp = $this->Amod->generate_kodeFormFeePelanggan();
|
|
if ($datPenjualan[0]['SALES_ID']==50) {
|
|
$input = [
|
|
'KODE_FFP' => $kode_ffp,
|
|
'TGL_FFP' => $now,
|
|
'KARYAWAN_ID' => $datPenjualan[0]['SALES_ID'],
|
|
'PENJUALAN_ID' => $id_penjualan,
|
|
'NILAI_FFP' => $datPenjualan[0]['FEE_SO'],
|
|
'JENIS_FFP' => $jenis_ffp,
|
|
'KET_FFP' => $ket_ffp,
|
|
'CON_FFP_P' => $timestamp,
|
|
'STATUS_FFP' => '0',
|
|
];
|
|
} else {
|
|
$input = [
|
|
'KODE_FFP' => $kode_ffp,
|
|
'TGL_FFP' => $now,
|
|
'KARYAWAN_ID' => $datPenjualan[0]['SALES_ID'],
|
|
'PENJUALAN_ID' => $id_penjualan,
|
|
'NILAI_FFP' => $datPenjualan[0]['FEE_SO'],
|
|
'JENIS_FFP' => $jenis_ffp,
|
|
'KET_FFP' => $ket_ffp,
|
|
'STATUS_FFP' => '0',
|
|
];
|
|
}
|
|
$action = $this->Amod->create('form_feepelanggan', $input);
|
|
$value = 1;
|
|
}
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
}
|
|
|
|
public function PJ_Tambah_DataSalesOrder() { // Validasi
|
|
$id_sales = $this->input->post('id_sales');
|
|
$id_corp = $this->input->post('id_corp');
|
|
$gudang_so = $this->input->post('gudang_so');
|
|
$id_pelanggan = $this->input->post('id_pelanggan');
|
|
$alur_so = $this->input->post('alur_so');
|
|
$kirim_so = $this->input->post('kirim_so');
|
|
$gp_so = $this->input->post('gp_so');
|
|
$ppn_so = $this->input->post('ppn_so');
|
|
$qc_so = $this->input->post('qc_so');
|
|
$pic_so = $this->input->post('pic_so');
|
|
$fee_so = $this->input->post('fee_so');
|
|
$tgl_request = $this->input->post('tgl_request');
|
|
$now = date('Y-m-d');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
|
|
if ($fee_so=="") {
|
|
$fee_so = 0;
|
|
}
|
|
|
|
if ($tgl_request=="") {
|
|
$tgl_request = NULL;
|
|
}
|
|
|
|
$value = 0;
|
|
$datPelanggan = $this->Amod->getData_Pelanggan_byID($id_pelanggan);
|
|
if ($datPelanggan[0]['BLOKIR_PELANGGAN']==1) {
|
|
$value = 2;
|
|
} else {
|
|
$kode_so = $this->Amod->generate_kodeSalesOrder();
|
|
$input = [
|
|
'TGL_SO' => $now,
|
|
'KODE_SO' => $kode_so,
|
|
'CORP_ID' => $id_corp,
|
|
'SALES_ID' => $id_sales,
|
|
'PELANGGAN_ID' => $id_pelanggan,
|
|
'GUDANG_SO' => $gudang_so,
|
|
'PPN_SO' => $ppn_so,
|
|
'GP_SO' => $gp_so,
|
|
'FEE_SO' => $fee_so,
|
|
'ALUR_SO' => $alur_so,
|
|
'QC_SO' => $qc_so,
|
|
'KIRIM_SO' => $kirim_so,
|
|
'TGL_REQUEST' => $tgl_request,
|
|
'PIC_SO' => $pic_so,
|
|
'ONGKIR_SO' => '0',
|
|
'NILAI_SO' => '0',
|
|
'CIPTA_SO' => "Oleh $panggilan pada $timestamp",
|
|
];
|
|
$action = $this->Amod->create('sales_order', $input);
|
|
$value = 1;
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value
|
|
]);
|
|
}
|
|
|
|
public function PJ_Tambah_DataSjPenjualan() { // Validasi
|
|
$id_so = $this->input->post('id_so');
|
|
$alur_so = $this->input->post('alur_so');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$now = date('Y-m-d');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$value = 0;
|
|
if ($alur_so==2) { // SO Parsial
|
|
if (count($id_so)>1) {
|
|
$value = 3;
|
|
}
|
|
} else if ($alur_so==3) { // SO Gabungan
|
|
if (count($id_so)<2) {
|
|
$value = 3;
|
|
}
|
|
}
|
|
if ($value==0) {
|
|
if ($alur_so==3) {
|
|
$pelanggan_id = NULL;
|
|
foreach ($id_so as $key) {
|
|
$datSo = $this->Amod->getData_SalesOrder_byID($key);
|
|
if ($pelanggan_id==NULL) {
|
|
$pelanggan_id = $datSo[0]['PELANGGAN_ID'];
|
|
} else {
|
|
if ($pelanggan_id!=$datSo[0]['PELANGGAN_ID']) {
|
|
$value = 2;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if ($value==0) {
|
|
$datSo = $this->Amod->getData_SalesOrder_byID($id_so[0]);
|
|
$kode_sjpj = $this->Amod->generate_SJPenjualan($datSo[0]['CORP_ID']);
|
|
$input = [
|
|
'CORP_ID' => $datSo[0]['CORP_ID'],
|
|
'PELANGGAN_ID' => $datSo[0]['PELANGGAN_ID'],
|
|
'TGL_SJPJ' => $now,
|
|
'KODE_SJPJ' => $kode_sjpj,
|
|
'STATUS_SJPJ' => '0',
|
|
'CIPTA_SJPJ' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->create('sj_penjualan', $input);
|
|
|
|
$id_sjpj = $this->Amod->getMax_ID_SjPenjualan();
|
|
$id_sjpj = $id_sjpj[0]['ID_SJPJ'];
|
|
if ($alur_so==2) {
|
|
$input = [
|
|
'SJPJ_ID' => $id_sjpj,
|
|
'SO_ID' => $id_so[0]
|
|
];
|
|
$action = $this->Amod->create('so_penjualan', $input);
|
|
} else if ($alur_so==3) {
|
|
foreach ($id_so as $key) {
|
|
$input = [
|
|
'SJPJ_ID' => $id_sjpj,
|
|
'SO_ID' => $key
|
|
];
|
|
$action = $this->Amod->create('so_penjualan', $input);
|
|
|
|
$datDo = $this->Amod->getData_DaftarOrder_bySO($key);
|
|
foreach ($datDo as $dat) {
|
|
$input = [
|
|
'SJPJ_ID' => $id_sjpj,
|
|
'DO_ID' => $dat['ID_DO'],
|
|
'QTY_DFSJPJ' => $dat['QTY_DO'],
|
|
'RETUR_DFSJPJ' => '0',
|
|
'NAMA_DFSJPJ' => $dat['NAMA_BARANG'],
|
|
'STATUS_DFSJPJ' => '1'
|
|
];
|
|
$action = $this->Amod->create('daftar_sjpenjualan', $input);
|
|
}
|
|
}
|
|
}
|
|
$value = 1;
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value
|
|
]);
|
|
}
|
|
|
|
public function PJ_Tambah_DataSnIo() { // Validasi
|
|
$verse = $this->input->post('verse');
|
|
$id_io = $this->input->post('id_io');
|
|
$id_so = $this->input->post('id_so');
|
|
$id_snstock = $this->input->post('id_snstock');
|
|
$nama_snio = $this->input->post('nama_snio');
|
|
$nama_snio = strtoupper($nama_snio);
|
|
|
|
$value = 0;
|
|
$datSo = $this->Amod->getData_SalesOrder_byID_bySTATUS($id_so, 0);
|
|
if ($datSo==FALSE) {
|
|
$value = 11;
|
|
} else {
|
|
$datIo = $this->Amod->getData_TransaksiStock_byID_statusNull($id_io);
|
|
if ($datIo==FALSE) {
|
|
$value = 10;
|
|
} else {
|
|
if ($datIo[0]['JENIS_IO']==0) {
|
|
if ($verse==1) {
|
|
$datSnStock = $this->Amod->getData_SnStock_byID_bySTATUS($id_snstock, 0);
|
|
} else if ($verse==2) {
|
|
$datSnStock = $this->Amod->getData_SnStock_byNAMA_allStatus($nama_snio);
|
|
}
|
|
if ($datSnStock==FALSE) {
|
|
$value = 9;
|
|
} else {
|
|
if ($datSnStock[0]['STATUS_SNSTOCK']!=0) {
|
|
$value = 8;
|
|
} else {
|
|
if ($datSnStock[0]['BARANG_ID']!=$datIo[0]['BARANG_ID']) {
|
|
$value = 7;
|
|
} else {
|
|
if ($datIo[0]['GUDANG_IO']==3 AND $datSnStock[0]['GUDANG_SNSTOCK']!=3) {
|
|
$value = 6;
|
|
} else if ($datIo[0]['GUDANG_IO']==2 AND $datSnStock[0]['GUDANG_SNSTOCK']!=2) {
|
|
$value = 5;
|
|
} else if ($datIo[0]['GUDANG_IO']==1 AND $datSnStock[0]['GUDANG_SNSTOCK']!=1) {
|
|
$value = 4;
|
|
} else {
|
|
$countBefore = $this->Amod->getCount_SnIo_byIO($id_io);
|
|
if ($countBefore>=$datIo[0]['QTY_IO']) {
|
|
$value = 3;
|
|
} else {
|
|
if ($verse==1) {
|
|
$nama_snio = $datSnStock[0]['NAMA_SNSTOCK'];
|
|
}
|
|
$input = [
|
|
'NAMA_SNIO' => $nama_snio,
|
|
'JENIS_SNIO' => '0',
|
|
'IO_ID' => $id_io,
|
|
];
|
|
$action = $this->Amod->create('sn_io', $input);
|
|
|
|
$update = [
|
|
'STATUS_SNSTOCK' => '10'
|
|
];
|
|
$action = $this->Amod->update('sn_stock', $update, 'ID_SNSTOCK', $datSnStock[0]['ID_SNSTOCK']);
|
|
|
|
$countAfter = $this->Amod->getCount_SnIo_byIO($id_io);
|
|
if ($countAfter==$datIo[0]['QTY_IO']) {
|
|
$value = 2;
|
|
} else {
|
|
$value = 1;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} else if ($datIo[0]['JENIS_IO']==1) {
|
|
if ($verse==2) {
|
|
$datSnStock = $this->Amod->getData_SnStock_byNAMA_allStatus($nama_snio);
|
|
}
|
|
if ($datSnStock==TRUE) {
|
|
$value = 12;
|
|
} else {
|
|
$countBefore = $this->Amod->getCount_SnIo_byIO($id_io);
|
|
if ($countBefore>=$datIo[0]['QTY_IO']) {
|
|
$value = 3;
|
|
} else {
|
|
$input = [
|
|
'NAMA_SNIO' => $nama_snio,
|
|
'JENIS_SNIO' => '1',
|
|
'IO_ID' => $id_io,
|
|
];
|
|
$action = $this->Amod->create('sn_io', $input);
|
|
|
|
$input = [
|
|
'NAMA_SNSTOCK' => $nama_snio,
|
|
'KOP_SNSTOCK' => '1',
|
|
'BARANG_ID' => $datIo[0]['BARANG_ID'],
|
|
'GUDANG_SNSTOCK' => $datIo[0]['GUDANG_IO'],
|
|
'STATUS_SNSTOCK' => NULL
|
|
];
|
|
$action = $this->Amod->create('sn_stock', $input);
|
|
|
|
$countAfter = $this->Amod->getCount_SnIo_byIO($id_io);
|
|
if ($countAfter==$datIo[0]['QTY_IO']) {
|
|
$value = 2;
|
|
} else {
|
|
$value = 1;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
}
|
|
|
|
public function PJ_Tambah_DataSnJual() { // Validasi
|
|
$verse = $this->input->post('verse');
|
|
$id_do = $this->input->post('id_do');
|
|
$id_so = $this->input->post('id_so');
|
|
$id_snstock = $this->input->post('id_snstock');
|
|
$nama_snj = $this->input->post('nama_snj');
|
|
$nama_snj = strtoupper($nama_snj);
|
|
|
|
$value = 0;
|
|
$datSo = $this->Amod->getData_SalesOrder_byID_bySTATUS($id_so, 0);
|
|
if ($datSo==FALSE) {
|
|
$value = 12;
|
|
} else {
|
|
$datDo = $this->Amod->getData_DaftarOrder_byID($id_do);
|
|
if ($datDo==FALSE) {
|
|
$value = 11;
|
|
} else {
|
|
if ($datSo[0]['GUDANG_SO']==3) {
|
|
$jenis_kuantiti = 10;
|
|
} else {
|
|
$jenis_kuantiti = $datSo[0]['GUDANG_SO'];
|
|
}
|
|
$qtyBefore = $this->GE_AmbilData_DataKuantiti($datDo[0]['BARANG_ID'], $jenis_kuantiti);
|
|
if ($qtyBefore<=0) {
|
|
$value = 10;
|
|
} else {
|
|
if ($verse==1) {
|
|
$datSnStock = $this->Amod->getData_SnStock_byID_bySTATUS($id_snstock, 0);
|
|
} else if ($verse==2) {
|
|
$datSnStock = $this->Amod->getData_SnStock_byNAMA_allStatus($nama_snj);
|
|
}
|
|
if ($datSnStock==FALSE) {
|
|
$value = 9;
|
|
} else {
|
|
if ($datSnStock[0]['STATUS_SNSTOCK']!=0) {
|
|
$value = 8;
|
|
} else {
|
|
if ($datSnStock[0]['BARANG_ID']!=$datDo[0]['BARANG_ID']) {
|
|
$value = 7;
|
|
} else {
|
|
if ($datSo[0]['GUDANG_SO']==3 AND $datSnStock[0]['GUDANG_SNSTOCK']!=3) {
|
|
$value = 6;
|
|
} else if ($datSo[0]['GUDANG_SO']==2 AND $datSnStock[0]['GUDANG_SNSTOCK']!=2) {
|
|
$value = 5;
|
|
} else if ($datSo[0]['GUDANG_SO']==1 AND $datSnStock[0]['GUDANG_SNSTOCK']!=1) {
|
|
$value = 4;
|
|
} else {
|
|
$countBefore = $this->Amod->getCount_SnJual_byDO($id_do);
|
|
if ($countBefore>=$datDo[0]['QTY_DO']) {
|
|
$value = 3;
|
|
} else {
|
|
if ($verse==1) {
|
|
$nama_snj = $datSnStock[0]['NAMA_SNSTOCK'];
|
|
}
|
|
$datSnBeli = $this->Amod->getData_SnBeli_byNAMA($nama_snj);
|
|
if ($datSnBeli==TRUE) {
|
|
$datDb = $this->Amod->getData_DaftarBeli_byID($datSnBeli[0]['DB_ID']);
|
|
$kop = $datDb[0]['CORP_ID'];
|
|
} else {
|
|
$kop = 0;
|
|
}
|
|
|
|
$input = [
|
|
'NAMA_SNJ' => $nama_snj,
|
|
'KOP_SNJ' => $kop,
|
|
'DO_ID' => $id_do,
|
|
];
|
|
$action = $this->Amod->create('sn_jual', $input);
|
|
|
|
$update = [
|
|
'STATUS_SNSTOCK' => '10'
|
|
];
|
|
$action = $this->Amod->update('sn_stock', $update, 'ID_SNSTOCK', $datSnStock[0]['ID_SNSTOCK']);
|
|
|
|
$this->GE_Kalkulasi_KuantitiBarang($datDo[0]['BARANG_ID'], $datSo[0]['GUDANG_SO'], "Step 2 - PENJUALAN - Tambah Barang", 0, 1);
|
|
|
|
$countAfter = $this->Amod->getCount_SnJual_byDO($id_do);
|
|
if ($countAfter==$datDo[0]['QTY_DO']) {
|
|
$value = 2;
|
|
} else {
|
|
$value = 1;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
}
|
|
|
|
public function PJ_Tambah_DataTransaksiStock() { // Validasi
|
|
$id_so = $this->input->post('id_so');
|
|
$jenis_io = $this->input->post('jenis_io');
|
|
$id_barang = $this->input->post('id_barang');
|
|
$qty_io = $this->input->post('qty_io');
|
|
$ket_io = $this->input->post('ket_io');
|
|
$id_hpar = $this->input->post('id_hpar');
|
|
$ket_io = preg_replace('/\R+/', " " , $ket_io);
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
$now = date('Y-m-d');
|
|
|
|
$value = 0;
|
|
$datSo = $this->Amod->getData_SalesOrder_byID_bySTATUS($id_so, 0);
|
|
if ($datSo==FALSE) {
|
|
$value = 4;
|
|
} else {
|
|
if ($datSo[0]['GUDANG_SO']==3) {
|
|
$gudang = 10;
|
|
} else {
|
|
$gudang = $datSo[0]['GUDANG_SO'];
|
|
}
|
|
$cekQty = $this->GE_AmbilData_DataKuantiti($id_barang, $gudang);
|
|
if ($cekQty<$qty_io AND $jenis_io==0) {
|
|
$value = 3;
|
|
} else {
|
|
$datIo = $this->Amod->getData_TransaksiStock_bySO_byBARANG_statusNull($id_so, $id_barang);
|
|
if ($datIo==TRUE) {
|
|
$value = 2;
|
|
} else {
|
|
if ($jenis_io==0) {
|
|
$input = [
|
|
'CIPTA_IO' => "Oleh $panggilan pada $timestamp",
|
|
'KARYAWAN_ID' => $id_karyawan,
|
|
'TGL_IO' => $now,
|
|
'SO_ID' => $id_so,
|
|
'BARANG_ID' => $id_barang,
|
|
'QTY_IO' => $qty_io,
|
|
'KET_IO' => $ket_io,
|
|
'JENIS_IO' => $jenis_io,
|
|
'GUDANG_IO' => $datSo[0]['GUDANG_SO'],
|
|
'KODE_BUKTI' => $datSo[0]['KODE_SO'],
|
|
];
|
|
$action = $this->Amod->create('transaksi_stock', $input);
|
|
|
|
$this->GE_Kalkulasi_KuantitiBarang($id_barang, $datSo[0]['GUDANG_SO'], "Step 2 - PENJUALAN - Tambah Barang", 0, $qty_io);
|
|
} else if ($jenis_io==1) {
|
|
$datHpar = $this->Amod->getData_HargaPart_byID($id_hpar);
|
|
$harga_io = $datHpar[0]['HPP_HPAR']/2;
|
|
$input = [
|
|
'CIPTA_IO' => "Oleh $panggilan pada $timestamp",
|
|
'KARYAWAN_ID' => $id_karyawan,
|
|
'TGL_IO' => $now,
|
|
'SO_ID' => $id_so,
|
|
'HPAR_ID' => $id_hpar,
|
|
'BARANG_ID' => $id_barang,
|
|
'HARGA_IO' => $harga_io,
|
|
'QTY_IO' => $qty_io,
|
|
'KET_IO' => $ket_io,
|
|
'JENIS_IO' => $jenis_io,
|
|
'GUDANG_IO' => $datSo[0]['GUDANG_SO'],
|
|
'KODE_BUKTI' => $datSo[0]['KODE_SO'],
|
|
];
|
|
$action = $this->Amod->create('transaksi_stock', $input);
|
|
}
|
|
$value = 1;
|
|
}
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value
|
|
]);
|
|
}
|
|
|
|
public function PJ_Ubah_DataDaftarOrder() { // Validasi
|
|
$id_so = $this->input->post('id_so');
|
|
$id_do = $this->input->post('id_do');
|
|
$id_barang = $this->input->post('id_barang');
|
|
$qty_do = $this->input->post('qty_do');
|
|
$harga_do = $this->input->post('harga_do');
|
|
$verse = $this->input->post('verse');
|
|
$mode = $this->input->post('mode');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$value = 0;
|
|
if ($verse==1) {
|
|
$datSo = $this->Amod->getData_SalesOrder_byID_statusNull($id_so);
|
|
} else if ($verse==2) {
|
|
$datSo = $this->Amod->getData_SalesOrder_byID_bySTATUS($id_so, 0);
|
|
}
|
|
if ($mode==1) {
|
|
$harga_do = round($harga_do/(($datSo[0]['PPN_SO']+100)/100),2);
|
|
}
|
|
if ($datSo==FALSE) {
|
|
$value = 5;
|
|
} else {
|
|
$datDo = $this->Amod->getData_DaftarOrder_byID($id_do);
|
|
if ($datDo==FALSE) {
|
|
$value = 4;
|
|
} else {
|
|
$sumDo = $this->Amod->getSum_DaftarOrder_bySO($id_so, $id_do);
|
|
if ($sumDo[0]['TOTAL']==NULL) {
|
|
$tot = 0;
|
|
} else {
|
|
$dpp = $sumDo[0]['TOTAL'];
|
|
$ppn = round((($datSo[0]['PPN_SO']/100)*$dpp),2);
|
|
$tot = round(($dpp+$ppn),2);
|
|
}
|
|
|
|
$sumPda = $this->Amod->getSum_HasilHitungPda_byPELANGGAN($datSo[0]['PELANGGAN_ID']);
|
|
if ($sumPda==FALSE) {
|
|
$debet_pda = 0;
|
|
$kredit_pda = 0;
|
|
} else {
|
|
$debet_pda = $sumPda[0]['DEBET'];
|
|
$kredit_pda = $sumPda[0]['KREDIT'];
|
|
}
|
|
|
|
$sumDoAktif = $this->Amod->getSum_DaftarOrder_byPELANGGAN_status0_2_3($datSo[0]['PELANGGAN_ID'], $id_so);
|
|
if ($sumDoAktif[0]['TOTAL']==NULL) {
|
|
$doAktif = 0;
|
|
} else {
|
|
$doAktif = round($sumDoAktif[0]['TOTAL'],2);
|
|
}
|
|
|
|
$limit = $datSo[0]['LIMIT_PELANGGAN']-($harga_do*$qty_do)-$tot-$doAktif-$debet_pda+$kredit_pda;
|
|
if ($limit<0) {
|
|
$value = 3;
|
|
} else {
|
|
if ($datDo[0]['TYPE_JENIS']==1) {
|
|
$countSnj = $this->Amod->getCount_SnJual_byDO($id_do);
|
|
if ($countSnj>$qty_do) {
|
|
$value = 2;
|
|
}
|
|
}
|
|
if ($value==0) {
|
|
if ($datDo[0]['BARANG_ID']!=$id_barang) {
|
|
if ($datDo[0]['TYPE_JENIS']==1) {
|
|
$datSnj = $this->Amod->getData_SnJual_byDO($id_do);
|
|
foreach ($datSnj as $key) {
|
|
$datSnStock = $this->Amod->getData_SnStock_byNAMA_bySTATUS($key['NAMA_SNJ'], 10);
|
|
if ($datSnStock==TRUE) {
|
|
$update = [
|
|
'STATUS_SNSTOCK' => '0'
|
|
];
|
|
$action = $this->Amod->update('sn_stock', $update, 'ID_SNSTOCK', $datSnStock[0]['ID_SNSTOCK']);
|
|
}
|
|
$this->GE_Kalkulasi_KuantitiBarang($datDo[0]['BARANG_ID'], $datSo[0]['GUDANG_SO'], "Step 1 - PENJUALAN - Revisi Barang", '0', 1);
|
|
}
|
|
$action = $this->Amod->delete('sn_jual', $id_do, 'DO_ID');
|
|
}
|
|
}
|
|
|
|
$datBarang = $this->Amod->getData_Barang_byID($id_barang);
|
|
$update = [
|
|
'BARANG_ID' => $id_barang,
|
|
'QTY_DO' => $qty_do,
|
|
'HARGA_DO' => $harga_do,
|
|
'NAMA_DO' => $datBarang[0]['NAMA_BARANG']
|
|
];
|
|
$action = $this->Amod->update('daftar_order', $update, 'ID_DO', $id_do);
|
|
|
|
$sumDoAkhir = $this->Amod->getSum_DaftarOrder_bySO($id_so);
|
|
$dppAkhir = $sumDoAkhir[0]['TOTAL'];
|
|
$ppnAkhir = round((($datSo[0]['PPN_SO']/100)*$dppAkhir),2);
|
|
$totAkhir = round(($dppAkhir+$ppnAkhir),2);
|
|
|
|
if ($verse==1) {
|
|
$update = [
|
|
'NILAI_SO' => $totAkhir
|
|
];
|
|
} else if ($verse==2) {
|
|
$input = [
|
|
'SO_ID' => $id_so,
|
|
'STATUS_HPSO' => '1',
|
|
'LAST_HPSO' => $timestamp
|
|
];
|
|
$action = $this->Amod->create('histori_persiapanso', $input);
|
|
|
|
$ket_so_rev = $datSo[0]['KET_SO_REV'];
|
|
$kode_barang = $datBarang[0]['KODE_BARANG'];
|
|
if ($ket_so_rev==NULL OR $ket_so_rev=="") {
|
|
$ket_so_rev = "Ubah Barang $kode_barang,";
|
|
} else {
|
|
$ket_so_rev .= " Ubah Barang $kode_barang,";
|
|
}
|
|
$update = [
|
|
'PERSIAPAN_SO' => '0',
|
|
'NILAI_SO' => $totAkhir,
|
|
'KET_SO_REV' => $ket_so_rev,
|
|
'REVISI_SO' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
}
|
|
$action = $this->Amod->update('sales_order', $update, 'ID_SO', $id_so);
|
|
|
|
$value = 1;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
|
|
}
|
|
|
|
public function PJ_Ubah_DataFormFeePelanggan() { // Validasi
|
|
$id_ffp = $this->input->post('id_ffp');
|
|
$jenis_ffp = $this->input->post('jenis_ffp');
|
|
$ket_ffp = $this->input->post('ket_ffp');
|
|
$ket_ffp = preg_replace('/\R+/', " " , $ket_ffp);
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
$now = date('Y-m-d');
|
|
|
|
$value = 0;
|
|
$datFfp = $this->Amod->getData_FormFeePelanggan_byID($id_ffp);
|
|
if ($datFfp==FALSE) {
|
|
$value = 2;
|
|
} else {
|
|
$update = [
|
|
'JENIS_FFP' => $jenis_ffp,
|
|
'KET_FFP' => $ket_ffp
|
|
];
|
|
$action = $this->Amod->update('form_feepelanggan', $update, 'ID_FFP', $id_ffp);
|
|
$value = 1;
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
}
|
|
|
|
public function PJ_Ubah_DataKeteranganSalesOrder() { // Validasi
|
|
$id_so = $this->input->post('id_so');
|
|
$ket_so_all = $this->input->post('ket_so_all');
|
|
$ket_so_all = preg_replace('/\R+/', " " , $ket_so_all);
|
|
|
|
$value = 0;
|
|
$datSo = $this->Amod->getData_SalesOrder_byID($id_so);
|
|
if ($datSo==FALSE) {
|
|
$value = 2;
|
|
} else {
|
|
$update = [
|
|
'KET_SO_ALL' => $ket_so_all,
|
|
];
|
|
$action = $this->Amod->update('sales_order', $update, 'ID_SO', $id_so);
|
|
$value = 1;
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
}
|
|
|
|
public function PJ_Ubah_DataPersiapanSalesOrder() { // Validasi
|
|
$id_so = $this->input->post('id_so');
|
|
$persiapan_so = $this->input->post('persiapan_so');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
if ($persiapan_so==NULL) {
|
|
$persiapan_so = 0;
|
|
}
|
|
|
|
$value = 0;
|
|
$datSo = $this->Amod->getData_SalesOrder_byID_bySTATUS($id_so, 0);
|
|
if ($datSo==FALSE) {
|
|
$value = 2;
|
|
} else {
|
|
$update = [
|
|
'PERSIAPAN_SO' => $persiapan_so
|
|
];
|
|
$action = $this->Amod->update('sales_order', $update, 'ID_SO', $id_so);
|
|
|
|
$input = [
|
|
'SO_ID' => $id_so,
|
|
'STATUS_HPSO' => $persiapan_so,
|
|
'LAST_HPSO' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->create('histori_persiapanso', $input);
|
|
$value = 1;
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
}
|
|
|
|
public function PJ_Ubah_DataPoSalesOrder() { // Validasi
|
|
$id_so = $this->input->post('id_so');
|
|
$po_so = $this->input->post('po_so');
|
|
$filepo_so = $this->input->post('filepo_so');
|
|
$po_so = strtoupper($po_so);
|
|
|
|
$value = 0;
|
|
$datSo = $this->Amod->getData_SalesOrder_byID($id_so);
|
|
if ($datSo==FALSE) {
|
|
$value = 2;
|
|
} else {
|
|
$update = [
|
|
'PO_SO' => $po_so,
|
|
'FILEPO_SO' => $filepo_so
|
|
];
|
|
$action = $this->Amod->update('sales_order', $update, 'ID_SO', $id_so);
|
|
$value = 1;
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
}
|
|
|
|
public function PJ_Ubah_DataSalesOrder() { // Validasi
|
|
$verse = $this->input->post('verse');
|
|
$id_so = $this->input->post('id_so');
|
|
$id_sales = $this->input->post('id_sales');
|
|
$id_corp = $this->input->post('id_corp');
|
|
$gudang_so = $this->input->post('gudang_so');
|
|
$id_pelanggan = $this->input->post('id_pelanggan');
|
|
$alur_so = $this->input->post('alur_so');
|
|
$kirim_so = $this->input->post('kirim_so');
|
|
$gp_so = $this->input->post('gp_so');
|
|
$ppn_so = $this->input->post('ppn_so');
|
|
$qc_so = $this->input->post('qc_so');
|
|
$pic_so = $this->input->post('pic_so');
|
|
$fee_so = $this->input->post('fee_so');
|
|
$tgl_request = $this->input->post('tgl_request');
|
|
$now = date('Y-m-d');
|
|
|
|
if ($fee_so=="") {
|
|
$fee_so = 0;
|
|
}
|
|
|
|
if ($tgl_request=="") {
|
|
$tgl_request = NULL;
|
|
}
|
|
|
|
$value = 0;
|
|
if ($verse==1) {
|
|
$datSo = $this->Amod->getData_SalesOrder_byID_statusNull($id_so);
|
|
} else if ($verse==2) {
|
|
$datSo = $this->Amod->getData_SalesOrder_byID_bySTATUS($id_so, 0);
|
|
}
|
|
if ($datSo==FALSE) {
|
|
$value = 6;
|
|
} else {
|
|
if ($datSo[0]['GUDANG_SO']!=$gudang_so AND $verse==2) {
|
|
$datDo = $this->Amod->getData_DaftarOrder_bySO($id_so);
|
|
foreach ($datDo as $key) {
|
|
$countSnj = $this->Amod->getData_SnJual_byDO($key['ID_DO']);
|
|
if ($countSnj>0) {
|
|
$value = 5;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
if ($value==0) {
|
|
if ($datSo[0]['ALUR_SO']==2 AND $datSo[0]['ALUR_SO']!=$alur_so) {
|
|
$datSosjpj = $this->Amod->getData_SoSjPenjualan_bySO($id_so);
|
|
if ($datSosjpj==TRUE) {
|
|
$value = 4;
|
|
}
|
|
}
|
|
}
|
|
if ($value==0) {
|
|
if ($id_pelanggan!=$datSo[0]['PELANGGAN_ID']) {
|
|
$datPelanggan = $this->Amod->getData_Pelanggan_byID($id_pelanggan);
|
|
if ($datPelanggan[0]['BLOKIR_PELANGGAN']==1) {
|
|
$value = 3;
|
|
} else {
|
|
$sumDo = $this->Amod->getSum_DaftarOrder_bySO($id_so);
|
|
if ($sumDo[0]['TOTAL']==NULL) {
|
|
$tot = 0;
|
|
} else {
|
|
$dpp = $sumDo[0]['TOTAL'];
|
|
$pp = round((($datSo[0]['PPN_SO']/100)*$dpp),2);
|
|
$tot = round(($dpp+$pp),2);
|
|
}
|
|
|
|
$sumPda = $this->Amod->getSum_DaftarAkuntansi_byPELANGGAN_byPERKIRAAN($id_pelanggan, 3);
|
|
if ($sumPda[0]['DEBET']==NULL) {
|
|
$debet_pda = 0;
|
|
$kredit_pda = 0;
|
|
} else {
|
|
$debet_pda = $sumPda[0]['DEBET'];
|
|
$kredit_pda = $sumPda[0]['KREDIT'];
|
|
}
|
|
|
|
$sumDoAktif = $this->Amod->getSum_DaftarOrder_byPELANGGAN_status0_2_3($id_pelanggan, $id_so);
|
|
if ($sumDoAktif[0]['TOTAL']==NULL) {
|
|
$doAktif = 0;
|
|
} else {
|
|
$doAktif = round($sumDoAktif[0]['TOTAL']);
|
|
}
|
|
|
|
$limit = $datPelanggan[0]['LIMIT_PELANGGAN']-$tot-$doAktif-$debet_pda+$kredit_pda;
|
|
if ($limit<0) {
|
|
$value = 2;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if ($value==0) {
|
|
if ($datSo[0]['PPN_SO']!=$ppn_so) {
|
|
$sumDoAkhir = $this->Amod->getSum_DaftarOrder_bySO($id_so);
|
|
if ($sumDoAkhir[0]['TOTAL']==NULL) {
|
|
$nilai_so = 0;
|
|
} else {
|
|
$dppAkhir = $sumDoAkhir[0]['TOTAL'];
|
|
$ppnAkhir = round((($ppn_so/100)*$dppAkhir),2);
|
|
$nilai_so = round(($dppAkhir+$ppnAkhir),2);
|
|
}
|
|
} else {
|
|
$nilai_so = $datSo[0]['NILAI_SO'];
|
|
}
|
|
$update = [
|
|
'TGL_SO' => $now,
|
|
'SALES_ID' => $id_sales,
|
|
'CORP_ID' => $id_corp,
|
|
'GUDANG_SO' => $gudang_so,
|
|
'PELANGGAN_ID' => $id_pelanggan,
|
|
'ALUR_SO' => $alur_so,
|
|
'KIRIM_SO' => $kirim_so,
|
|
'GP_SO' => $gp_so,
|
|
'PPN_SO' => $ppn_so,
|
|
'QC_SO' => $qc_so,
|
|
'PIC_SO' => $pic_so,
|
|
'FEE_SO' => $fee_so,
|
|
'TGL_REQUEST' => $tgl_request,
|
|
'NILAI_SO' => $nilai_so,
|
|
];
|
|
$action = $this->Amod->update('sales_order', $update, 'ID_SO', $id_so);
|
|
$value = 1;
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value
|
|
]);
|
|
}
|
|
|
|
//Daftar Menu PJ [Penjualan]
|
|
//SUBMENU TRANSAKSI - SALES ORDER
|
|
public function PJ_Sub1_SalesOrder_1() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "PJ", "TRANSAKSI - Sales Order");
|
|
$id_menu = $datShm[0]['MENU_ID'];
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$datPelanggan = $this->Amod->getData_Pelanggan_bySTATUS(1);
|
|
$datCorp = $this->Amod->getData_Corp_bySTATUS(1);
|
|
$datSales = $this->Amod->getData_SetHakAdminSo_byKARYAWAN($id_karyawan);
|
|
|
|
$datStpos = $this->Amod->getData_SetTogglePosisi_byKARYAWAN_byMENU($id_karyawan, $id_menu);
|
|
if ($datStpos==FALSE) { $posisiToggle = 0; } else { $posisiToggle = $datStpos[0]['AKTIF_STPOS']; }
|
|
|
|
$soBelum = $this->Amod->getData_SalesOrder_statusNull();
|
|
$no = 0;
|
|
foreach ($soBelum as $key) {
|
|
$sumDo = $this->Amod->getSum_DaftarOrder_bySO($key['ID_SO']);
|
|
if ($sumDo[0]['TOTAL']==NULL) {
|
|
$totdo = 0;
|
|
} else {
|
|
$ppndo = round((($key['PPN_SO']/100)*$sumDo[0]['TOTAL']),2);
|
|
$totdo = round(($ppndo+$sumDo[0]['TOTAL']),2);
|
|
}
|
|
$soBelum[$no++] += ['TOTDO' => $totdo];
|
|
}
|
|
|
|
$soProses = $this->Amod->getData_SalesOrder_status0_2_3();
|
|
$no = 0;
|
|
foreach ($soProses as $key) {
|
|
$datDo = $this->Amod->getData_DaftarOrder_bySO($key['ID_SO']);
|
|
$nodo = 0;
|
|
foreach ($datDo as $dat) {
|
|
$sumDo = $this->Amod->getSum_DaftarOrder_byBARANG_status0_2_3($dat['BARANG_ID']);
|
|
$qty_hhbso = $sumDo[0]['TOTAL'];
|
|
$kuantitiNow = $this->GE_AmbilData_DataKuantiti($dat['BARANG_ID'], 0);
|
|
|
|
if ($dat['TYPE_JENIS']==2) {
|
|
$status_hhbso = 1;
|
|
} else if ($kuantitiNow==0) {
|
|
$status_hhbso = 0;
|
|
} else if ($kuantitiNow==$qty_hhbso) {
|
|
$status_hhbso = 3;
|
|
} else if ($kuantitiNow<$qty_hhbso) {
|
|
$status_hhbso = 2;
|
|
} else {
|
|
$status_hhbso = 1;
|
|
}
|
|
|
|
$datHhbso = $this->Amod->getData_HasilHitungBarangSo_byBARANG($dat['BARANG_ID']);
|
|
if ($datHhbso==FALSE) {
|
|
$input = [
|
|
'BARANG_ID' => $dat['BARANG_ID'],
|
|
'QTY_HHBSO' => $qty_hhbso,
|
|
'STOK_HHBSO' => $kuantitiNow,
|
|
'STATUS_HHBSO' => $status_hhbso,
|
|
'LAST_HHBSO' => $timestamp
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungbarangso', $input);
|
|
} else {
|
|
$update = [
|
|
'QTY_HHBSO' => $qty_hhbso,
|
|
'STOK_HHBSO' => $kuantitiNow,
|
|
'STATUS_HHBSO' => $status_hhbso,
|
|
'LAST_HHBSO' => $timestamp
|
|
];
|
|
$action = $this->Amod->update('hasil_hitungbarangso', $update, 'ID_HHBSO', $datHhbso[0]['ID_HHBSO']);
|
|
}
|
|
$datDo[$nodo++] += ['STAT' => $status_hhbso];
|
|
}
|
|
|
|
$datQc = $this->Amod->getData_QualityControl_bySO($key['ID_SO']);
|
|
|
|
$soProses[$no] += ['QC' => $datQc];
|
|
$soProses[$no++] += ['DATDO' => $datDo];
|
|
}
|
|
|
|
$soFee = $this->Amod->getData_HasilHitungBfe_bySTATUS(0);
|
|
$no = 0;
|
|
foreach ($soFee as $key) {
|
|
$datHhpda = $this->Amod->getData_HasilHitungPda_byPENJUALAN_linkFormFee($key['PID']);
|
|
if ($datHhpda==FALSE OR $datHhpda[0]['STATUS_HHPDA']==0) {
|
|
$statLunas = "Belum Lunas";
|
|
$tglLunas = "";
|
|
$kodeLunas = "";
|
|
$jenisFfp = "";
|
|
} else {
|
|
if (strpos($datHhpda[0]['LUNAS_HHPDA'],"RJ")!==FALSE) {
|
|
$statLunas = "Retur Jual";
|
|
} else {
|
|
$statLunas = "Lunas";
|
|
}
|
|
$tglLunas = $datHhpda[0]['TGLLOCK'];
|
|
$kodeLunas = $datHhpda[0]['LUNAS_HHPDA'];
|
|
if ($datHhpda[0]['JENIS_FFP']==1) {
|
|
$jenisFfp = "Kasbank";
|
|
} else if ($datHhpda[0]['JENIS_FFP']==2) {
|
|
$jenisFfp = "Potong Nota";
|
|
} else if ($datHhpda[0]['JENIS_FFP']==3) {
|
|
$jenisFfp = "Campur";
|
|
} else {
|
|
$jenisFfp = "";
|
|
}
|
|
}
|
|
|
|
if ($datHhpda==TRUE) {
|
|
$soFee[$no] += ['ID_FFP' => $datHhpda[0]['ID_FFP']];
|
|
$soFee[$no] += ['JENIS_FFP' => $datHhpda[0]['JENIS_FFP']];
|
|
$soFee[$no] += ['CONFFPK' => $datHhpda[0]['CON_FFP_K']];
|
|
$soFee[$no] += ['CONFFPP' => $datHhpda[0]['CON_FFP_P']];
|
|
$soFee[$no] += ['KODEFFP' => $datHhpda[0]['KODE_FFP']];
|
|
$soFee[$no] += ['TGLFFP' => $datHhpda[0]['TGLFFP']];
|
|
$soFee[$no] += ['KETFFP' => $datHhpda[0]['KET_FFP']];
|
|
} else {
|
|
$soFee[$no] += ['ID_FFP' => NULL];
|
|
$soFee[$no] += ['JENIS_FFP' => NULL];
|
|
$soFee[$no] += ['CONFFPK' => NULL];
|
|
$soFee[$no] += ['CONFFPP' => NULL];
|
|
$soFee[$no] += ['KODEFFP' => NULL];
|
|
$soFee[$no] += ['TGLFFP' => NULL];
|
|
$soFee[$no] += ['KETFFP' => NULL];
|
|
}
|
|
|
|
$soFee[$no] += ['JENISFFP' => $jenisFfp];
|
|
$soFee[$no] += ['STATLUNAS' => $statLunas];
|
|
$soFee[$no] += ['TGLLUNAS' => $tglLunas];
|
|
$soFee[$no++] += ['KODELUNAS' => $kodeLunas];
|
|
}
|
|
|
|
$data = array(
|
|
'sidebar' => "menu penjualan",
|
|
'navChild' => "penjualan salesorder",
|
|
'corp' => $datCorp,
|
|
'pelanggan' => $datPelanggan,
|
|
'sales' => $datSales,
|
|
'soBelum' => $soBelum,
|
|
'soProses' => $soProses,
|
|
'soFee' => $soFee,
|
|
'posisiToggle' => $posisiToggle,
|
|
'id_menu' => $id_menu,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil
|
|
);
|
|
$this->load->view('proses/PJ_Sub1_SalesOrder_1', $data);
|
|
}
|
|
|
|
public function PJ_Ambil_Sub1_A1_MasterData() {
|
|
$id_so = $this->input->post('id_so');
|
|
|
|
$datSo = $this->Amod->getData_SalesOrder_byID($id_so);
|
|
$barangKeluar = $this->Amod->getData_Barang_byGUDANG_bySTATUS($datSo[0]['GUDANG_SO'], 1);
|
|
|
|
$barKel = [];
|
|
foreach ($barangKeluar as $key) {
|
|
$qty = $key['QTY'];
|
|
$id_barang = $key['ID_BARANG'];
|
|
$kode_barang = $key['KODE_BARANG'];
|
|
$nama_barang = $key['NAMA_BARANG'];
|
|
$type_jenis = $key['TYPE_JENIS'];
|
|
if ($type_jenis==2) {
|
|
$hasil = "NONQTY | $kode_barang ($nama_barang) *ID$id_barang*";
|
|
} else {
|
|
$hasil = "$qty EA | $kode_barang ($nama_barang) *ID$id_barang*";
|
|
}
|
|
array_push($barKel, $hasil);
|
|
}
|
|
|
|
$this->output_json([
|
|
'barangKeluar' => $barKel,
|
|
'datSo' => $datSo,
|
|
]);
|
|
}
|
|
|
|
public function PJ_Ambil_Sub1_A1_DataDaftarOrder() {
|
|
$id_so = $this->input->post('id_so');
|
|
|
|
$data = $this->Amod->getData_DaftarOrder_bySO($id_so);
|
|
|
|
$datSo = $this->Amod->getData_SalesOrder_byID($id_so);
|
|
$sumDo = $this->Amod->getSum_DaftarOrder_bySO($id_so);
|
|
if ($sumDo[0]['TOTAL']==NULL) {
|
|
$dpp = 0;
|
|
$ppn = 0;
|
|
$tot = 0;
|
|
} else {
|
|
$dpp = $sumDo[0]['TOTAL'];
|
|
$ppn = round((($datSo[0]['PPN_SO']/100)*$dpp),2);
|
|
$tot = round(($dpp+$ppn),2);
|
|
}
|
|
|
|
$sumHhpda = $this->Amod->getSum_HasilHitungPda_byPELANGGAN($datSo[0]['PELANGGAN_ID']);
|
|
if ($sumHhpda==FALSE) {
|
|
$debet_pda = 0;
|
|
$kredit_pda = 0;
|
|
} else {
|
|
$debet_pda = $sumHhpda[0]['DEBET'];
|
|
$kredit_pda = $sumHhpda[0]['KREDIT'];
|
|
}
|
|
|
|
$sumDoAktif = $this->Amod->getSum_DaftarOrder_byPELANGGAN_status0_2_3($datSo[0]['PELANGGAN_ID'], $id_so);
|
|
if ($sumDoAktif[0]['TOTAL']==NULL) {
|
|
$doAktif = 0;
|
|
} else {
|
|
$doAktif = round($sumDoAktif[0]['TOTAL']);
|
|
}
|
|
|
|
$limit = $datSo[0]['LIMIT_PELANGGAN']-$tot-$doAktif-$debet_pda+$kredit_pda;
|
|
|
|
if ($datSo[0]['GUDANG_SO']==1) {
|
|
$gud = "GUDANG PCM";
|
|
} else if ($datSo[0]['GUDANG_SO']==2) {
|
|
$gud = "GUDANG ITP";
|
|
} else if ($datSo[0]['GUDANG_SO']==3) {
|
|
$gud = "GUDANG SERVICE";
|
|
}
|
|
|
|
$blok = [
|
|
'DPP' => number_format($dpp,2),
|
|
'PPN' => number_format($ppn,2),
|
|
'TOT' => number_format($tot,2),
|
|
'LIMIT' => number_format($limit,2),
|
|
'KODSO' => $datSo[0]['KODE_SO'],
|
|
'NAPEL' => $datSo[0]['NAMA_PELANGGAN'],
|
|
'GUDSO' => $gud,
|
|
];
|
|
|
|
$this->output_json([
|
|
'data' => $data,
|
|
'total' => sizeof($data),
|
|
'blok' => $blok
|
|
]);
|
|
}
|
|
|
|
public function PJ_Ambil_Sub1_A1_DataKonversiBarang() {
|
|
$id_so = $this->input->post('id_so');
|
|
$id_barang = $this->input->post('id_barang');
|
|
|
|
$datSo = $this->Amod->getData_SalesOrder_byID($id_so);
|
|
$datKuantiti = $this->Amod->getData_Kuantiti_byBARANG($id_barang);
|
|
if ($datKuantiti[0]['TYPE_JENIS']==2) {
|
|
$qty = "NONQTY";
|
|
} else if ($datSo[0]['GUDANG_SO']==3) {
|
|
$qty = $datKuantiti[0]['SERVICE_KUANTITI'];
|
|
} else if ($datSo[0]['GUDANG_SO']==1) {
|
|
$qty = $datKuantiti[0]['PCM_KUANTITI'];
|
|
} else if ($datSo[0]['GUDANG_SO']==2) {
|
|
$qty = $datKuantiti[0]['ITP_KUANTITI'];
|
|
}
|
|
|
|
$kode_barang = $datKuantiti[0]['KODE_BARANG'];
|
|
$nama_barang = $datKuantiti[0]['NAMA_BARANG'];
|
|
if ($datKuantiti[0]['TYPE_JENIS']==2) {
|
|
$hasil = "$qty | $kode_barang ($nama_barang) *ID$id_barang*";
|
|
} else {
|
|
$hasil = "$qty EA | $kode_barang ($nama_barang) *ID$id_barang*";
|
|
}
|
|
|
|
$data = array(
|
|
'hasil' => $hasil,
|
|
);
|
|
$this->output_json($data);
|
|
}
|
|
|
|
public function PJ_Tambah_Sub1_A1_DataSalesOrder() {
|
|
$id_sales = $this->input->post('id_salesnew');
|
|
$id_corp = $this->input->post('id_corpnew');
|
|
$id_pelanggan = $this->input->post('id_pelanggannew');
|
|
$gudang_so = $this->input->post('gudang_sonew');
|
|
$ppn_so = $this->input->post('ppn_sonew');
|
|
$fee_so = $this->input->post('fee_sonew');
|
|
$gp_so = $this->input->post('gp_sonew');
|
|
$ongkir_so = $this->input->post('ongkir_sonew');
|
|
$po_so = $this->input->post('po_sonew');
|
|
$po_so = strtoupper($po_so);
|
|
$now = date('Y-m-d');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
|
|
//Check apakah nilai Fee Numeric
|
|
$check_fee = is_numeric($fee_so);
|
|
if ($check_fee==FALSE) {
|
|
$fee_so = 0;
|
|
}
|
|
|
|
//Check apakah nilai PPN Numeric
|
|
$check_ppn = is_numeric($ppn_so);
|
|
if ($check_ppn==FALSE) {
|
|
$ppn_so = 0;
|
|
}
|
|
|
|
//Set Fee jika dikosongi
|
|
if ($fee_so=="") {
|
|
$fee_so = 0;
|
|
}
|
|
|
|
//Check apakah PPN atau Fee nilainya dibawah 0
|
|
if ($ppn_so<0 OR $fee_so<0) {
|
|
$this->session->set_flashdata('not_zero_negative', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$kode_so = $this->Amod->generate_kodeSalesOrder();
|
|
$input = [
|
|
'SALES_ID' => $id_sales,
|
|
'CORP_ID' => $id_corp,
|
|
'PELANGGAN_ID' => $id_pelanggan,
|
|
'GUDANG_SO' => $gudang_so,
|
|
'KODE_SO' => $kode_so,
|
|
'CIPTA_SO' => "Oleh $panggilan pada $timestamp",
|
|
'TGL_SO' => $now,
|
|
'FEE_SO' => $fee_so,
|
|
'PO_SO' => $po_so,
|
|
'PPN_SO' => $ppn_so,
|
|
'GP_SO' => $gp_so,
|
|
'ONGKIR_SO' => $ongkir_so,
|
|
'ALUR_SO' => '1',
|
|
];
|
|
$action = $this->Amod->create('sales_order', $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 PJ_Ubah_Sub1_A1_DataSalesOrder() {
|
|
$id_so = $this->input->post('id_soed');
|
|
$id_sales = $this->input->post('id_salesed');
|
|
$id_pelanggan = $this->input->post('id_pelangganed');
|
|
$id_corp = $this->input->post('id_corped');
|
|
$gudang_so = $this->input->post('gudang_soed');
|
|
$ppn_so = $this->input->post('ppn_soed');
|
|
$gp_so = $this->input->post('gp_soed');
|
|
$ongkir_so = $this->input->post('ongkir_soed');
|
|
$fee_so = $this->input->post('fee_soed');
|
|
$po_so = $this->input->post('po_soed');
|
|
$po_so = strtoupper($po_so);
|
|
$now = date('Y-m-d');
|
|
|
|
//Check Konsistensi Data
|
|
$datSo = $this->Amod->getData_SalesOrder_Null($id_so);
|
|
if ($datSo==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
//Check apakah nilai Fee Numeric
|
|
$check_fee = is_numeric($fee_so);
|
|
if ($check_fee==FALSE) {
|
|
$fee_so = 0;
|
|
}
|
|
|
|
//Check apakah nilai PPN Numeric
|
|
$check_ppn = is_numeric($ppn_so);
|
|
if ($check_ppn==FALSE) {
|
|
$ppn_so = 0;
|
|
}
|
|
|
|
//Set Fee jika dikosongi
|
|
if ($fee_so=="") {
|
|
$fee_so = 0;
|
|
}
|
|
|
|
//Check apakah PPN atau Fee nilainya dibawah 0
|
|
if ($ppn_so<0 OR $fee_so<0) {
|
|
$this->session->set_flashdata('not_zero_negative', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$sumDo = $this->Amod->getSum_DaftarOrder_bySO($id_so);
|
|
if ($sumDo[0]['TOTAL']==NULL) {
|
|
$tot = 0;
|
|
} else {
|
|
$dpp = $sumDo[0]['TOTAL'];
|
|
$pp = round((($datSo[0]['PPN_SO']/100)*$dpp),2);
|
|
$tot = round(($dpp+$pp),2);
|
|
}
|
|
|
|
$sumPda = $this->Amod->getSum_DaftarAkuntansi_byPELANGGAN_byPERKIRAAN($id_pelanggan, 3);
|
|
if ($sumPda[0]['DEBET']==NULL) {
|
|
$debet_pda = 0;
|
|
$kredit_pda = 0;
|
|
} else {
|
|
$debet_pda = $sumPda[0]['DEBET'];
|
|
$kredit_pda = $sumPda[0]['KREDIT'];
|
|
}
|
|
|
|
$sumDoAktif = $this->Amod->getSum_DaftarOrder_byPELANGGAN_status0_2_3($id_pelanggan, $id_so);
|
|
if ($sumDoAktif[0]['TOTAL']==NULL) {
|
|
$doAktif = 0;
|
|
} else {
|
|
$doAktif = round($sumDoAktif[0]['TOTAL']);
|
|
}
|
|
|
|
if ($id_pelanggan!=$datSo[0]['PELANGGAN_ID']) {
|
|
$datPelanggan = $this->Amod->getData_Pelanggan_byID($id_pelanggan);
|
|
$limit = $datPelanggan[0]['LIMIT_PELANGGAN']-$tot-$doAktif-$debet_pda+$kredit_pda;
|
|
if ($limit<0) {
|
|
$this->session->set_flashdata('limit_pelbaru_check', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
}
|
|
|
|
$update = [
|
|
'SALES_ID' => $id_sales,
|
|
'CORP_ID' => $id_corp,
|
|
'PELANGGAN_ID' => $id_pelanggan,
|
|
'GUDANG_SO' => $gudang_so,
|
|
'PPN_SO' => $ppn_so,
|
|
'FEE_SO' => $fee_so,
|
|
'PO_SO' => $po_so,
|
|
'GP_SO' => $gp_so,
|
|
'ONGKIR_SO' => $ongkir_so,
|
|
'TGL_SO' => $now,
|
|
];
|
|
$action = $this->Amod->update('sales_order', $update, 'ID_SO', $id_so);
|
|
|
|
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 PJ_Hapus_Sub1_A1_DataSalesOrder() {
|
|
$id_so = $this->input->post('id_sodel');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
//Check Konsistensi Data
|
|
$datSo = $this->Amod->getData_SalesOrder_Null($id_so);
|
|
if ($datSo==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$action = $this->Amod->delete('daftar_order', $id_so, 'SO_ID');
|
|
|
|
$update = [
|
|
'STATUS_SO' => '9',
|
|
'HAPUS_SO' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('sales_order', $update, 'ID_SO', $id_so);
|
|
|
|
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 PJ_Proses_Sub1_A1_DataSalesOrder() {
|
|
$id_so = $this->input->post('id_so');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
$now = date('Y-m-d');
|
|
|
|
//Check Konsistensi Data
|
|
$value = 0;
|
|
$datSo = $this->Amod->getData_SalesOrder_Null($id_so);
|
|
if ($datSo==FALSE) {
|
|
$value = 2;
|
|
} else {
|
|
$sumDo = $this->Amod->getSum_DaftarOrder_bySO($id_so);
|
|
$nilai_so = round(($sumDo[0]['TOTAL']+(($datSo[0]['PPN_SO']/100)*$sumDo[0]['TOTAL'])),2);
|
|
$update = [
|
|
'TGL_SO' => $now,
|
|
'NILAI_SO' => $nilai_so,
|
|
'PROSES_SO' => "Oleh $panggilan pada $timestamp",
|
|
'STATUS_SO' => '0'
|
|
];
|
|
$action = $this->Amod->update('sales_order', $update, 'ID_SO', $id_so);
|
|
$value = 1;
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
|
|
}
|
|
|
|
public function PJ_Hapus_Sub1_A1_DataDaftarOrder() {
|
|
$id_so = $this->input->post('id_so');
|
|
$id_do = $this->input->post('id_do');
|
|
|
|
//Check Konsistensi Data
|
|
$value = 0;
|
|
$datSo = $this->Amod->getData_SalesOrder_Null($id_so);
|
|
if ($datSo==FALSE) {
|
|
$value = 2;
|
|
} else {
|
|
$action = $this->Amod->delete('daftar_order', $id_do, 'ID_DO');
|
|
$value = 1;
|
|
}
|
|
|
|
$barangKeluar = $this->Amod->getData_Barang_byGUDANG_bySTATUS($datSo[0]['GUDANG_SO'], 1);
|
|
$barKel = [];
|
|
foreach ($barangKeluar as $key) {
|
|
$qty = $key['QTY'];
|
|
$id_barang = $key['ID_BARANG'];
|
|
$kode_barang = $key['KODE_BARANG'];
|
|
$nama_barang = $key['NAMA_BARANG'];
|
|
$type_jenis = $key['TYPE_JENIS'];
|
|
if ($type_jenis==2) {
|
|
$hasil = "NONQTY | $kode_barang ($nama_barang) *ID$id_barang*";
|
|
} else {
|
|
$hasil = "$qty EA | $kode_barang ($nama_barang) *ID$id_barang*";
|
|
}
|
|
array_push($barKel, $hasil);
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
'barangKeluar' => $barKel
|
|
]);
|
|
|
|
}
|
|
|
|
public function PJ_Simpan_Sub1_A1_DataDaftarOrder() {
|
|
$id_so = $this->input->post('id_so');
|
|
$id_barang = $this->input->post('id_barang');
|
|
$qty_do = $this->input->post('qty_do');
|
|
$harga_do = $this->input->post('harga_do');
|
|
|
|
//Check Konsistensi Data
|
|
$value = 0;
|
|
$datSo = $this->Amod->getData_SalesOrder_Null($id_so);
|
|
if ($datSo==FALSE) {
|
|
$value = 4;
|
|
} else {
|
|
$datDo = $this->Amod->getData_DaftarOrder_bySO_byBARANG($id_so, $id_barang);
|
|
if ($datDo==TRUE) {
|
|
$value = 3;
|
|
} else {
|
|
$sumDo = $this->Amod->getSum_DaftarOrder_bySO($id_so);
|
|
if ($sumDo[0]['TOTAL']==NULL) {
|
|
$tot = 0;
|
|
} else {
|
|
$dpp = $sumDo[0]['TOTAL'];
|
|
$ppn = round((($datSo[0]['PPN_SO']/100)*$dpp),2);
|
|
$tot = round(($dpp+$ppn),2);
|
|
}
|
|
|
|
$sumPda = $this->Amod->getSum_HasilHitungPda_byPELANGGAN($datSo[0]['PELANGGAN_ID']);
|
|
if ($sumPda==FALSE) {
|
|
$debet_pda = 0;
|
|
$kredit_pda = 0;
|
|
} else {
|
|
$debet_pda = $sumPda[0]['DEBET'];
|
|
$kredit_pda = $sumPda[0]['KREDIT'];
|
|
}
|
|
|
|
$sumDoAktif = $this->Amod->getSum_DaftarOrder_byPELANGGAN_status0_2_3($datSo[0]['PELANGGAN_ID'], $id_so);
|
|
if ($sumDoAktif[0]['TOTAL']==NULL) {
|
|
$doAktif = 0;
|
|
} else {
|
|
$doAktif = round($sumDoAktif[0]['TOTAL'],2);
|
|
}
|
|
|
|
$limit = $datSo[0]['LIMIT_PELANGGAN']-($harga_do*$qty_do)-$tot-$doAktif-$debet_pda+$kredit_pda;
|
|
if ($limit<0) {
|
|
$value = 2;
|
|
} else {
|
|
$datBarang = $this->Amod->getData_Barang_byID($id_barang);
|
|
$input = [
|
|
'SO_ID' => $id_so,
|
|
'BARANG_ID' => $id_barang,
|
|
'QTY_DO' => $qty_do,
|
|
'RETUR_DO' => '0',
|
|
'HARGA_DO' => $harga_do,
|
|
'NAMA_DO' => $datBarang[0]['NAMA_BARANG']
|
|
];
|
|
$action = $this->Amod->create('daftar_order', $input);
|
|
$value = 1;
|
|
}
|
|
}
|
|
}
|
|
|
|
$barangKeluar = $this->Amod->getData_Barang_byGUDANG_bySTATUS($datSo[0]['GUDANG_SO'], 1);
|
|
$barKel = [];
|
|
foreach ($barangKeluar as $key) {
|
|
$qty = $key['QTY'];
|
|
$id_barang = $key['ID_BARANG'];
|
|
$kode_barang = $key['KODE_BARANG'];
|
|
$nama_barang = $key['NAMA_BARANG'];
|
|
$type_jenis = $key['TYPE_JENIS'];
|
|
if ($type_jenis==2) {
|
|
$hasil = "NONQTY | $kode_barang ($nama_barang) *ID$id_barang*";
|
|
} else {
|
|
$hasil = "$qty EA | $kode_barang ($nama_barang) *ID$id_barang*";
|
|
}
|
|
array_push($barKel, $hasil);
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
'barangKeluar' => $barKel
|
|
]);
|
|
|
|
}
|
|
|
|
public function PJ_Ubah_Sub1_A1_DataDaftarOrder() {
|
|
$id_so = $this->input->post('id_so');
|
|
$id_do = $this->input->post('id_do');
|
|
$id_barang = $this->input->post('id_barang');
|
|
$qty_do = $this->input->post('qty_do');
|
|
$harga_do = $this->input->post('harga_do');
|
|
|
|
//Check Konsistensi Data
|
|
$value = 0;
|
|
$datSo = $this->Amod->getData_SalesOrder_Null($id_so);
|
|
if ($datSo==FALSE) {
|
|
$value = 4;
|
|
} else {
|
|
$datDo = $this->Amod->getData_DaftarOrder_bySO_byBARANG($id_so, $id_barang, $id_do);
|
|
if ($datDo==TRUE) {
|
|
$value = 3;
|
|
} else {
|
|
$sumDo = $this->Amod->getSum_DaftarOrder_bySO($id_so, $id_do);
|
|
if ($sumDo[0]['TOTAL']==NULL) {
|
|
$tot = 0;
|
|
} else {
|
|
$dpp = $sumDo[0]['TOTAL'];
|
|
$ppn = round((($datSo[0]['PPN_SO']/100)*$dpp),2);
|
|
$tot = round(($ppn+$dpp),2);
|
|
}
|
|
|
|
$sumPda = $this->Amod->getSum_HasilHitungPda_byPELANGGAN($datSo[0]['PELANGGAN_ID']);
|
|
if ($sumPda==FALSE) {
|
|
$debet_pda = 0;
|
|
$kredit_pda = 0;
|
|
} else {
|
|
$debet_pda = $sumPda[0]['DEBET'];
|
|
$kredit_pda = $sumPda[0]['KREDIT'];
|
|
}
|
|
|
|
$sumDoAktif = $this->Amod->getSum_DaftarOrder_byPELANGGAN_status0_2_3($datSo[0]['PELANGGAN_ID'], $id_so);
|
|
if ($sumDoAktif[0]['TOTAL']==NULL) {
|
|
$doAktif = 0;
|
|
} else {
|
|
$doAktif = round($sumDoAktif[0]['TOTAL'],2);
|
|
}
|
|
|
|
$limit = $datSo[0]['LIMIT_PELANGGAN']-($harga_do*$qty_do)-$tot-$doAktif-$debet_pda+$kredit_pda;
|
|
if ($limit<0) {
|
|
$value = 2;
|
|
} else {
|
|
$datBarang = $this->Amod->getData_Barang_byID($id_barang);
|
|
$update = [
|
|
'BARANG_ID' => $id_barang,
|
|
'QTY_DO' => $qty_do,
|
|
'HARGA_DO' => $harga_do,
|
|
'NAMA_DO' => $datBarang[0]['NAMA_BARANG'],
|
|
];
|
|
$action = $this->Amod->update('daftar_order', $update, 'ID_DO', $id_do);
|
|
$value = 1;
|
|
}
|
|
}
|
|
}
|
|
|
|
$barangKeluar = $this->Amod->getData_Barang_byGUDANG_bySTATUS($datSo[0]['GUDANG_SO'], 1);
|
|
$barKel = [];
|
|
foreach ($barangKeluar as $key) {
|
|
$qty = $key['QTY'];
|
|
$id_barang = $key['ID_BARANG'];
|
|
$kode_barang = $key['KODE_BARANG'];
|
|
$nama_barang = $key['NAMA_BARANG'];
|
|
$type_jenis = $key['TYPE_JENIS'];
|
|
if ($type_jenis==2) {
|
|
$hasil = "NONQTY | $kode_barang ($nama_barang) *ID$id_barang*";
|
|
} else {
|
|
$hasil = "$qty EA | $kode_barang ($nama_barang) *ID$id_barang*";
|
|
}
|
|
array_push($barKel, $hasil);
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
'barangKeluar' => $barKel
|
|
]);
|
|
}
|
|
|
|
public function PJ_Ubah_Sub1_A1_DataSoKeterangan() {
|
|
$id_so = $this->input->post('id_so');
|
|
$menu = $this->input->post('menu');
|
|
$ket = $this->input->post('ket');
|
|
$ket = preg_replace('/\R+/', " " , $ket);
|
|
|
|
//Check Konsistensi Data
|
|
$value = 0;
|
|
$datSo = $this->Amod->getData_SalesOrder_Null($id_so);
|
|
if ($datSo==FALSE) {
|
|
$value = 2;
|
|
} else {
|
|
if ($menu==1) {
|
|
$update = [
|
|
'PO_SO' => $ket
|
|
];
|
|
} else if ($menu==2) {
|
|
$update = [
|
|
'KET_SO_O' => $ket
|
|
];
|
|
} else if ($menu==3) {
|
|
$update = [
|
|
'KET_SO_G' => $ket
|
|
];
|
|
} else if ($menu==4) {
|
|
$update = [
|
|
'KET_SO_K' => $ket
|
|
];
|
|
} else if ($menu==5) {
|
|
$update = [
|
|
'KET_SO_T' => $ket
|
|
];
|
|
} else if ($menu==6) {
|
|
$update = [
|
|
'KET_SO_P' => $ket
|
|
];
|
|
}
|
|
$action = $this->Amod->update('sales_order', $update, 'ID_SO', $id_so);
|
|
$value = 1;
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
}
|
|
|
|
public function PJ_Tambah_Sub1_A1_FeePelanggan() {
|
|
$id_penjualan = $this->input->post('id_soformfee');
|
|
$jenis_ffp = $this->input->post('id_jenisformfee');
|
|
$ket_ffp = $this->input->post('ket_formfee');
|
|
$ket_ffp = preg_replace('/\R+/', " " , $ket_ffp);
|
|
$now = date('Y-m-d');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$datPenjualan = $this->Amod->getData_Penjualan_byID($id_penjualan);
|
|
if ($datPenjualan==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$datHhbfe = $this->Amod->getData_HasilHitungBfe_byPENJUALAN($id_penjualan);
|
|
if ($datHhbfe==FALSE OR $datHhbfe[0]['STATUS_HHBFE']>0) {
|
|
$this->session->set_flashdata('fee_lunas', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$datFfp = $this->Amod->getData_FormFeePelanggan_byPENJUALAN_bySTATUS($id_penjualan, 0);
|
|
if ($datFfp==TRUE) {
|
|
$this->session->set_flashdata('formfee_already', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$kode_ffp = $this->Amod->generate_kodeFormFeePelanggan();
|
|
if ($datPenjualan[0]['SALES_ID']==50) {
|
|
$input = [
|
|
'KODE_FFP' => $kode_ffp,
|
|
'TGL_FFP' => $now,
|
|
'KARYAWAN_ID' => $datPenjualan[0]['SALES_ID'],
|
|
'PENJUALAN_ID' => $id_penjualan,
|
|
'NILAI_FFP' => $datPenjualan[0]['FEE_SO'],
|
|
'JENIS_FFP' => $jenis_ffp,
|
|
'KET_FFP' => $ket_ffp,
|
|
'CON_FFP_P' => $timestamp,
|
|
'STATUS_FFP' => '0',
|
|
];
|
|
} else {
|
|
$input = [
|
|
'KODE_FFP' => $kode_ffp,
|
|
'TGL_FFP' => $now,
|
|
'KARYAWAN_ID' => $datPenjualan[0]['SALES_ID'],
|
|
'PENJUALAN_ID' => $id_penjualan,
|
|
'NILAI_FFP' => $datPenjualan[0]['FEE_SO'],
|
|
'JENIS_FFP' => $jenis_ffp,
|
|
'KET_FFP' => $ket_ffp,
|
|
'STATUS_FFP' => '0',
|
|
];
|
|
}
|
|
$action = $this->Amod->create('form_feepelanggan', $input);
|
|
|
|
if ($action) {
|
|
$this->session->set_flashdata('success', 'dibuat');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
} else {
|
|
$this->session->set_flashdata('failed', 'dibuat');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
}
|
|
|
|
public function PJ_Batal_Sub1_A1_FeePelanggan() {
|
|
$id_penjualan = $this->input->post('id_formfeevoid');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$datPenjualan = $this->Amod->getData_Penjualan_byID($id_penjualan);
|
|
if ($datPenjualan==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$datHhbfe = $this->Amod->getData_HasilHitungBfe_byPENJUALAN($id_penjualan);
|
|
if ($datHhbfe==FALSE OR $datHhbfe[0]['STATUS_HHBFE']==0) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$datFfp = $this->Amod->getData_FormFeePelanggan_byPENJUALAN_statusNot2($id_penjualan);
|
|
if ($datFfp==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$update = [
|
|
'SOVOID_FFP' => $datPenjualan[0]['KODE_SO'],
|
|
'BATAL_FFP' => "Oleh $panggilan pada $timestamp",
|
|
'STATUS_FFP' => '2',
|
|
];
|
|
$action = $this->Amod->update('form_feepelanggan', $update, 'ID_FFP', $datFfp[0]['ID_FFP']);
|
|
|
|
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 PJ_Ubah_Sub1_A1_FeePelanggan() {
|
|
$id_ffp = $this->input->post('id_ffped');
|
|
$jenis_ffp = $this->input->post('jenis_ffped');
|
|
$ket_ffp = $this->input->post('ket_ffped');
|
|
$ket_ffp = preg_replace('/\R+/', " " , $ket_ffp);
|
|
|
|
$datFfp = $this->Amod->getData_FormFeePelanggan_byID($id_ffp);
|
|
if ($datFfp==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$update = [
|
|
'JENIS_FFP' => $jenis_ffp,
|
|
'KET_FFP' => $ket_ffp
|
|
];
|
|
$action = $this->Amod->update('form_feepelanggan', $update, 'ID_FFP', $id_ffp);
|
|
|
|
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 PJ_Sub1_SalesOrder_2($id) {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "PJ", "TRANSAKSI - Sales Order");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
|
|
$datSo = $this->Amod->getData_SalesOrder_byID($id);
|
|
|
|
if ($datSo[0]['GUDANG_SO']==1) {
|
|
$gudangSo = "GUDANG PCM";
|
|
} else if ($datSo[0]['GUDANG_SO']==2) {
|
|
$gudangSo = "GUDANG ITP";
|
|
} else if ($datSo[0]['GUDANG_SO']==3) {
|
|
$gudangSo = "GUDANG SERVICE";
|
|
}
|
|
|
|
$datBarang = $this->Amod->getData_Barang_byGUDANG_bySTATUS($datSo[0]['GUDANG_SO'], 1);
|
|
$datPelanggan = $this->Amod->getData_Pelanggan_bySTATUS(1);
|
|
$datCorp = $this->Amod->getData_Corp_bySTATUS(1);
|
|
$datSales = $this->Amod->getData_SetHakAdminSo_byKARYAWAN($id_karyawan);
|
|
|
|
$data = array(
|
|
'sidebar' => "menu penjualan",
|
|
'navChild' => "penjualan salesorder",
|
|
'barang' => $datBarang,
|
|
'pelanggan' => $datPelanggan,
|
|
'corp' => $datCorp,
|
|
'sales' => $datSales,
|
|
'gudangSo' => $gudangSo,
|
|
'sales_id' => $datSo[0]['SALES_ID'],
|
|
'pelanggan_id' => $datSo[0]['PELANGGAN_ID'],
|
|
'corp_id' => $datSo[0]['CORP_ID'],
|
|
'gudang_so' => $datSo[0]['GUDANG_SO'],
|
|
'ppn_so' => $datSo[0]['PPN_SO'],
|
|
'gp_so' => $datSo[0]['GP_SO'],
|
|
'ongkir_so' => $datSo[0]['ONGKIR_SO'],
|
|
'po_so' => $datSo[0]['PO_SO'],
|
|
'fee_so' => $datSo[0]['FEE_SO'],
|
|
'status_so' => $datSo[0]['STATUS_SO'],
|
|
'kode_so' => $datSo[0]['KODE_SO'],
|
|
'ket_so_g' => $datSo[0]['KET_SO_G'],
|
|
'ket_so_k' => $datSo[0]['KET_SO_K'],
|
|
'ket_so_t' => $datSo[0]['KET_SO_T'],
|
|
'ket_so_p' => $datSo[0]['KET_SO_P'],
|
|
'nama_pelanggan' => $datSo[0]['NAMA_PELANGGAN'],
|
|
'nama_sales' => $datSo[0]['NAMA_PANGGILAN_KARYAWAN'],
|
|
'id_so' => $id,
|
|
'hak' => $hak,
|
|
);
|
|
$this->load->view('proses/PJ_Sub1_SalesOrder_2', $data);
|
|
}
|
|
|
|
public function PJ_Simpan_Sub1_A2_DataDaftarOrder() {
|
|
$id_so = $this->input->post('id_so');
|
|
$id_barang = $this->input->post('id_barang');
|
|
$qty_do = $this->input->post('qty_do');
|
|
$harga_do = $this->input->post('harga_do');
|
|
$status_so = $this->input->post('status_so');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
//Check Konsistensi Data
|
|
$value = 0;
|
|
$datSo = $this->Amod->getData_SalesOrder_byID_bySTATUS($id_so, $status_so);
|
|
if ($datSo==FALSE) {
|
|
$value = 4;
|
|
} else {
|
|
$datDo = $this->Amod->getData_DaftarOrder_bySO_byBARANG($id_so, $id_barang);
|
|
if ($datDo==TRUE) {
|
|
$value = 3;
|
|
} else {
|
|
$sumDo = $this->Amod->getSum_DaftarOrder_bySO($id_so);
|
|
if ($sumDo[0]['TOTAL']==NULL) {
|
|
$tot = 0;
|
|
} else {
|
|
$dpp = $sumDo[0]['TOTAL'];
|
|
$ppn = round((($datSo[0]['PPN_SO']/100)*$dpp),2);
|
|
$tot = round(($dpp+$ppn),2);
|
|
}
|
|
|
|
$sumPda = $this->Amod->getSum_HasilHitungPda_byPELANGGAN($datSo[0]['PELANGGAN_ID']);
|
|
if ($sumPda==FALSE) {
|
|
$debet_pda = 0;
|
|
$kredit_pda = 0;
|
|
} else {
|
|
$debet_pda = $sumPda[0]['DEBET'];
|
|
$kredit_pda = $sumPda[0]['KREDIT'];
|
|
}
|
|
|
|
$sumDoAktif = $this->Amod->getSum_DaftarOrder_byPELANGGAN_status0_2_3($datSo[0]['PELANGGAN_ID'], $id_so);
|
|
if ($sumDoAktif[0]['TOTAL']==NULL) {
|
|
$doAktif = 0;
|
|
} else {
|
|
$doAktif = round($sumDoAktif[0]['TOTAL'],2);
|
|
}
|
|
|
|
$datPelanggan = $this->Amod->getData_Pelanggan_byID($datSo[0]['PELANGGAN_ID']);
|
|
$limit = $datPelanggan[0]['LIMIT_PELANGGAN']-($harga_do*$qty_do)-$tot-$doAktif-$debet_pda+$kredit_pda;
|
|
if ($limit<0) {
|
|
$value = 2;
|
|
} else {
|
|
$datBarang = $this->Amod->getData_Barang_byID($id_barang);
|
|
$input = [
|
|
'SO_ID' => $id_so,
|
|
'BARANG_ID' => $id_barang,
|
|
'QTY_DO' => $qty_do,
|
|
'RETUR_DO' => '0',
|
|
'HARGA_DO' => $harga_do,
|
|
'NAMA_DO' => $datBarang[0]['NAMA_BARANG']
|
|
];
|
|
$action = $this->Amod->create('daftar_order', $input);
|
|
|
|
$kode_barang = $datBarang[0]['KODE_BARANG'];
|
|
$ket_so_a = $datSo[0]['KET_SO_A'];
|
|
if ($ket_so_a==NULL OR $ket_so_a=="") {
|
|
$ket_so_a = "Tambah Barang $kode_barang,";
|
|
} else {
|
|
$ket_so_a .= " Tambah Barang $kode_barang,";
|
|
}
|
|
|
|
$sumDo = $this->Amod->getSum_DaftarOrder_bySO($id_so);
|
|
$nilaiDo = $sumDo[0]['TOTAL'];
|
|
|
|
$ppnSo = round(($nilaiDo*($datSo[0]['PPN_SO']/100)),2);
|
|
$nilai_so = $ppnSo+$nilaiDo;
|
|
|
|
$update = [
|
|
'KET_SO_A' => $ket_so_a,
|
|
'NILAI_SO' => $nilai_so,
|
|
'REVISI_SO' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('sales_order', $update, 'ID_SO', $id_so);
|
|
|
|
$value = 1;
|
|
}
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
|
|
}
|
|
|
|
public function PJ_Ubah_Sub1_A2_DataDaftarOrder() {
|
|
$id_do = $this->input->post('id_do');
|
|
$qty_do = $this->input->post('qty_do');
|
|
$harga_do = $this->input->post('harga_do');
|
|
$id_so = $this->input->post('id_so');
|
|
$status_so = $this->input->post('status_so');
|
|
$id_barang = $this->input->post('id_barang');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
if ($id_barang=="") {
|
|
$id_barang = NULL;
|
|
}
|
|
|
|
//Check Konsistensi Data
|
|
$value = 0;
|
|
$datSo = $this->Amod->getData_SalesOrder_byID_bySTATUS($id_so, $status_so);
|
|
if ($datSo==FALSE) {
|
|
$value = 6;
|
|
} else {
|
|
$datDo = $this->Amod->getData_DaftarOrder_byID($id_do);
|
|
if ($datDo==FALSE) {
|
|
$value = 5;
|
|
} else {
|
|
$sumDoOld = $this->Amod->getSum_DaftarOrder_bySO($id_so, $id_do);
|
|
if ($sumDoOld[0]['TOTAL']==NULL) {
|
|
$tot = 0;
|
|
} else {
|
|
$dpp = $sumDoOld[0]['TOTAL'];
|
|
$ppn = round((($datSo[0]['PPN_SO']/100)*$dpp),2);
|
|
$tot = round(($ppn+$dpp),2);
|
|
}
|
|
|
|
$sumPda = $this->Amod->getSum_HasilHitungPda_byPELANGGAN($datSo[0]['PELANGGAN_ID']);
|
|
if ($sumPda==FALSE) {
|
|
$debet_pda = 0;
|
|
$kredit_pda = 0;
|
|
} else {
|
|
$debet_pda = $sumPda[0]['DEBET'];
|
|
$kredit_pda = $sumPda[0]['KREDIT'];
|
|
}
|
|
|
|
$sumDoAktif = $this->Amod->getSum_DaftarOrder_byPELANGGAN_status0_2_3($datSo[0]['PELANGGAN_ID'], $id_so);
|
|
if ($sumDoAktif[0]['TOTAL']==NULL) {
|
|
$doAktif = 0;
|
|
} else {
|
|
$doAktif = round($sumDoAktif[0]['TOTAL'],2);
|
|
}
|
|
|
|
$datPelanggan = $this->Amod->getData_Pelanggan_byID($datSo[0]['PELANGGAN_ID']);
|
|
$limit = $datPelanggan[0]['LIMIT_PELANGGAN']-($harga_do*$qty_do)-$tot-$doAktif-$debet_pda+$kredit_pda;
|
|
if ($limit<0) {
|
|
$value = 4;
|
|
} else {
|
|
if ($datDo[0]['TYPE_JENIS']==1) {
|
|
$countSnj = $this->Amod->getCount_SnJual_byDO($id_do);
|
|
} else {
|
|
$countSnj = $datDo[0]['QTY_DO'];
|
|
}
|
|
if ($countSnj>$qty_do AND $datDo[0]['TYPE_JENIS']==1) {
|
|
$value = 3;
|
|
} else {
|
|
$ket_so_a = $datSo[0]['KET_SO_A'];
|
|
if ($id_barang!=$datDo[0]['BARANG_ID'] AND $id_barang!=NULL) {
|
|
if ($datDo[0]['TYPE_JENIS']==1) {
|
|
$datSnj = $this->Amod->getData_SnJual_byDO($id_do);
|
|
foreach ($datSnj as $key) {
|
|
$datSnStock = $this->Amod->getData_SnStock_byNAMA_bySTATUS($key['NAMA_SNJ'], 10);
|
|
if ($datSnStock==TRUE) {
|
|
$update = [
|
|
'STATUS_SNSTOCK' => '0'
|
|
];
|
|
$action = $this->Amod->update('sn_stock', $update, 'ID_SNSTOCK', $datSnStock[0]['ID_SNSTOCK']);
|
|
}
|
|
$this->GE_Kalkulasi_KuantitiBarang($datDo[0]['BARANG_ID'], $datSo[0]['GUDANG_SO'], "Step 1 - PENJUALAN - Revisi Barang", '0', 1);
|
|
}
|
|
$action = $this->Amod->delete('sn_jual', $id_do, 'DO_ID');
|
|
}
|
|
|
|
$datBarang = $this->Amod->getData_Barang_byID($id_barang);
|
|
$kode_barang = $datBarang[0]['KODE_BARANG'];
|
|
if ($ket_so_a==NULL OR $ket_so_a=="") {
|
|
$ket_so_a = "Ubah Barang $kode_barang,";
|
|
} else {
|
|
$ket_so_a .= " Ubah Barang $kode_barang,";
|
|
}
|
|
|
|
$update = [
|
|
'QTY_DO' => $qty_do,
|
|
'HARGA_DO' => $harga_do,
|
|
'BARANG_ID' => $id_barang,
|
|
'NAMA_DO' => $datBarang[0]['NAMA_BARANG'],
|
|
];
|
|
$action = $this->Amod->update('daftar_order', $update, 'ID_DO', $id_do);
|
|
|
|
$value = 2;
|
|
} else {
|
|
$update = [
|
|
'QTY_DO' => $qty_do,
|
|
'HARGA_DO' => $harga_do
|
|
];
|
|
$action = $this->Amod->update('daftar_order', $update, 'ID_DO', $id_do);
|
|
|
|
$kode_barang = $datDo[0]['KODE_BARANG'];
|
|
if ($ket_so_a==NULL OR $ket_so_a=="") {
|
|
$ket_so_a = "Ubah Data $kode_barang,";
|
|
} else {
|
|
$ket_so_a .= " Ubah Data $kode_barang,";
|
|
}
|
|
|
|
$value = 1;
|
|
}
|
|
|
|
$sumDoNew = $this->Amod->getSum_DaftarOrder_bySO($id_so);
|
|
$nilaiDo = $sumDoNew[0]['TOTAL'];
|
|
|
|
$ppnSo = round(($nilaiDo*($datSo[0]['PPN_SO']/100)),2);
|
|
$nilai_so = $ppnSo+$nilaiDo;
|
|
|
|
$update = [
|
|
'KET_SO_A' => $ket_so_a,
|
|
'NILAI_SO' => $nilai_so,
|
|
'REVISI_SO' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('sales_order', $update, 'ID_SO', $id_so);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
|
|
}
|
|
|
|
public function PJ_Ubah_Sub1_A2_DataSalesOrder() {
|
|
$id_so = $this->input->post('id_soed');
|
|
$status_so = $this->input->post('status_soed');
|
|
$id_sales = $this->input->post('id_salesed');
|
|
$id_pelanggan = $this->input->post('id_pelangganed');
|
|
$id_corp = $this->input->post('id_corped');
|
|
$gudang_so = $this->input->post('gudang_soed');
|
|
$ppn_so = $this->input->post('ppn_soed');
|
|
$gp_so = $this->input->post('gp_soed');
|
|
$ongkir_so = $this->input->post('ongkir_soed');
|
|
$fee_so = $this->input->post('fee_soed');
|
|
$po_so = $this->input->post('po_soed');
|
|
$ket_so_g = $this->input->post('ket_so_ged');
|
|
$ket_so_k = $this->input->post('ket_so_ked');
|
|
$ket_so_t = $this->input->post('ket_so_ted');
|
|
$ket_so_p = $this->input->post('ket_so_ped');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$po_so = strtoupper($po_so);
|
|
$ket_so_g = preg_replace('/\R+/', " " , $ket_so_g);
|
|
$ket_so_k = preg_replace('/\R+/', " " , $ket_so_k);
|
|
$ket_so_t = preg_replace('/\R+/', " " , $ket_so_t);
|
|
$ket_so_p = preg_replace('/\R+/', " " , $ket_so_p);
|
|
$now = date('Y-m-d');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
//Check Konsistensi Data
|
|
$datSo = $this->Amod->getData_SalesOrder_byID_bySTATUS($id_so, $status_so);
|
|
if ($datSo==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
//Check apakah nilai Fee Numeric
|
|
$check_fee = is_numeric($fee_so);
|
|
if ($check_fee==FALSE) {
|
|
$fee_so = 0;
|
|
}
|
|
|
|
//Check apakah nilai PPN Numeric
|
|
$check_ppn = is_numeric($ppn_so);
|
|
if ($check_ppn==FALSE) {
|
|
$ppn_so = 0;
|
|
}
|
|
|
|
//Set Fee jika dikosongi
|
|
if ($fee_so=="") {
|
|
$fee_so = 0;
|
|
}
|
|
|
|
//Check apakah PPN atau Fee nilainya dibawah 0
|
|
if ($ppn_so<0 OR $fee_so<0) {
|
|
$this->session->set_flashdata('not_zero_negative', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$sumDo = $this->Amod->getSum_DaftarOrder_bySO($id_so);
|
|
if ($sumDo[0]['TOTAL']==NULL) {
|
|
$tot = 0;
|
|
} else {
|
|
$dpp = $sumDo[0]['TOTAL'];
|
|
$pp = round((($datSo[0]['PPN_SO']/100)*$dpp),2);
|
|
$tot = round(($dpp+$pp),2);
|
|
}
|
|
|
|
$sumPda = $this->Amod->getSum_DaftarAkuntansi_byPELANGGAN_byPERKIRAAN($id_pelanggan, 3);
|
|
if ($sumPda[0]['DEBET']==NULL) {
|
|
$debet_pda = 0;
|
|
$kredit_pda = 0;
|
|
} else {
|
|
$debet_pda = $sumPda[0]['DEBET'];
|
|
$kredit_pda = $sumPda[0]['KREDIT'];
|
|
}
|
|
|
|
$sumDoAktif = $this->Amod->getSum_DaftarOrder_byPELANGGAN_status0_2_3($id_pelanggan, $id_so);
|
|
if ($sumDoAktif[0]['TOTAL']==NULL) {
|
|
$doAktif = 0;
|
|
} else {
|
|
$doAktif = round($sumDoAktif[0]['TOTAL']);
|
|
}
|
|
|
|
if ($id_pelanggan!=$datSo[0]['PELANGGAN_ID']) {
|
|
$datPelanggan = $this->Amod->getData_Pelanggan_byID($id_pelanggan);
|
|
$limit = $datPelanggan[0]['LIMIT_PELANGGAN']-$tot-$doAktif-$debet_pda+$kredit_pda;
|
|
if ($limit<0) {
|
|
$this->session->set_flashdata('limit_pelbaru_check', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
}
|
|
|
|
$ket_so_a = $datSo[0]['KET_SO_A'];
|
|
if ($gudang_so!=$datSo[0]['GUDANG_SO'] AND $status_so==0) {
|
|
$datDo = $this->Amod->getData_DaftarOrder_bySO($id_so);
|
|
foreach ($datDo as $key) {
|
|
if ($key['TYPE_JENIS']==1) {
|
|
$datSnj = $this->Amod->getData_SnJual_byDO($key['ID_DO']);
|
|
foreach ($datSnj as $dat) {
|
|
$datSnStock = $this->Amod->getData_SnStock_byNAMA_bySTATUS($dat['NAMA_SNJ'], 10);
|
|
if ($datSnStock==TRUE) {
|
|
$update = [
|
|
'STATUS_SNSTOCK' => '0'
|
|
];
|
|
$action = $this->Amod->update('sn_stock', $update, 'ID_SNSTOCK', $datSnStock[0]['ID_SNSTOCK']);
|
|
}
|
|
$this->GE_Kalkulasi_KuantitiBarang($datDo[0]['BARANG_ID'], $datSo[0]['GUDANG_SO'], "Step 1 - PENJUALAN - Revisi Barang", 0, 1);
|
|
}
|
|
$action = $this->Amod->delete('sn_jual', $key['ID_DO'], 'DO_ID');
|
|
}
|
|
}
|
|
|
|
if ($datSo[0]['GUDANG_SO']==1) {
|
|
$gudangSo = "GUDANG PCM";
|
|
} else if ($datSo[0]['GUDANG_SO']==2) {
|
|
$gudangSo = "GUDANG ITP";
|
|
} else if ($datSo[0]['GUDANG_SO']==3) {
|
|
$gudangSo = "GUDANG SERVICE";
|
|
}
|
|
|
|
if ($ket_so_a==NULL OR $ket_so_a=="") {
|
|
$ket_so_a = "Ubah Gudang ke $gudangSo,";
|
|
} else {
|
|
$ket_so_a .= " Ubah Gudang ke $gudangSo,";
|
|
}
|
|
}
|
|
|
|
if ($ppn_so!=$datSo[0]['PPN_SO']) {
|
|
$sumDo = $this->Amod->getSum_DaftarOrder_bySO($id_so);
|
|
$dpp = $sumDo[0]['TOTAL'];
|
|
$pp = round((($ppn_so/100)*$dpp),2);
|
|
$nilai_so = round(($dpp+$pp),2);
|
|
|
|
$update = [
|
|
'SALES_ID' => $id_sales,
|
|
'CORP_ID' => $id_corp,
|
|
'PELANGGAN_ID' => $id_pelanggan,
|
|
'GUDANG_SO' => $gudang_so,
|
|
'PPN_SO' => $ppn_so,
|
|
'FEE_SO' => $fee_so,
|
|
'PO_SO' => $po_so,
|
|
'NILAI_SO' => $nilai_so,
|
|
'GP_SO' => $gp_so,
|
|
'ONGKIR_SO' => $ongkir_so,
|
|
'KET_SO_G' => $ket_so_g,
|
|
'KET_SO_K' => $ket_so_k,
|
|
'KET_SO_T' => $ket_so_t,
|
|
'KET_SO_P' => $ket_so_p,
|
|
'KET_SO_A' => $ket_so_a,
|
|
'TGL_SO' => $now,
|
|
'REVISI_SO' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
} else {
|
|
$update = [
|
|
'SALES_ID' => $id_sales,
|
|
'CORP_ID' => $id_corp,
|
|
'PELANGGAN_ID' => $id_pelanggan,
|
|
'GUDANG_SO' => $gudang_so,
|
|
'PPN_SO' => $ppn_so,
|
|
'FEE_SO' => $fee_so,
|
|
'PO_SO' => $po_so,
|
|
'GP_SO' => $gp_so,
|
|
'ONGKIR_SO' => $ongkir_so,
|
|
'KET_SO_G' => $ket_so_g,
|
|
'KET_SO_K' => $ket_so_k,
|
|
'KET_SO_T' => $ket_so_t,
|
|
'KET_SO_P' => $ket_so_p,
|
|
'KET_SO_A' => $ket_so_a,
|
|
'TGL_SO' => $now,
|
|
'REVISI_SO' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
}
|
|
$action = $this->Amod->update('sales_order', $update, 'ID_SO', $id_so);
|
|
|
|
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 PJ_Hapus_Sub1_A2_DataDaftarOrder() {
|
|
$id_do = $this->input->post('id_do');
|
|
$id_so = $this->input->post('id_so');
|
|
$status_so = $this->input->post('status_so');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
//Check Konsistensi Data
|
|
$value = 0;
|
|
$datSo = $this->Amod->getData_SalesOrder_byID_bySTATUS($id_so, $status_so);
|
|
if ($datSo==FALSE) {
|
|
$value = 3;
|
|
} else {
|
|
$datDo = $this->Amod->getData_DaftarOrder_byID($id_do);
|
|
if ($datDo==FALSE) {
|
|
$value = 2;
|
|
} else {
|
|
$kode_barang = $datDo[0]['KODE_BARANG'];
|
|
|
|
if ($datDo[0]['TYPE_JENIS']==1) {
|
|
$datSnj = $this->Amod->getData_SnJual_byDO($id_do);
|
|
foreach ($datSnj as $key) {
|
|
$datSnStock = $this->Amod->getData_SnStock_byNAMA_bySTATUS($key['NAMA_SNJ'], 10);
|
|
if ($datSnStock==TRUE) {
|
|
$update = [
|
|
'STATUS_SNSTOCK' => '0'
|
|
];
|
|
$action = $this->Amod->update('sn_stock', $update, 'ID_SNSTOCK', $datSnStock[0]['ID_SNSTOCK']);
|
|
|
|
$this->GE_Kalkulasi_KuantitiBarang($datDo[0]['BARANG_ID'], $datSo[0]['GUDANG_SO'], "Step 2 - PENJUALAN - Hapus Barang", 0, 1);
|
|
}
|
|
}
|
|
$action = $this->Amod->delete('sn_jual', $id_do, 'DO_ID');
|
|
}
|
|
|
|
$action = $this->Amod->delete('daftar_order', $id_do, 'ID_DO');
|
|
|
|
$ket_so_a = $datSo[0]['KET_SO_A'];
|
|
if ($ket_so_a==NULL OR $ket_so_a=="") {
|
|
$ket_so_a = "Hapus Barang $kode_barang,";
|
|
} else {
|
|
$ket_so_a .= " Hapus Barang $kode_barang,";
|
|
}
|
|
|
|
$sumDo = $this->Amod->getSum_DaftarOrder_bySO($id_so);
|
|
if ($sumDo[0]['TOTAL']==NULL) {
|
|
$nilaiDo = 0;
|
|
} else {
|
|
$nilaiDo = $sumDo[0]['TOTAL'];
|
|
}
|
|
|
|
$ppnSo = round(($nilaiDo*($datSo[0]['PPN_SO']/100)),2);
|
|
$nilai_so = $ppnSo+$nilaiDo;
|
|
|
|
$update = [
|
|
'KET_SO_A' => $ket_so_a,
|
|
'NILAI_SO' => $nilai_so,
|
|
'REVISI_SO' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('sales_order', $update, 'ID_SO', $id_so);
|
|
|
|
$value = 1;
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
|
|
}
|
|
|
|
public function PJ_Hapus_Sub1_A2_DataSalesOrder() {
|
|
$id_so = $this->input->post('id_sodel');
|
|
$status_so = $this->input->post('status_sodel');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
//Check Konsistensi Data
|
|
$datSo = $this->Amod->getData_SalesOrder_byID_bySTATUS($id_so, $status_so);
|
|
if ($datSo==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
if ($status_so==3) {
|
|
$datSjpNull = $this->Amod->getData_DaftarSjParsial_bySO_CDNull($id_so);
|
|
$datSjpNot = $this->Amod->getData_DaftarSjParsial_bySO_CDNotNull_groupCD($id_so);
|
|
if ($datSjpNull==TRUE OR $datSjpNot==TRUE) {
|
|
$this->session->set_flashdata('sjparsial_used', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
}
|
|
|
|
$datDo = $this->Amod->getData_DaftarOrder_bySO($id_so);
|
|
foreach ($datDo as $key) {
|
|
if ($key['TYPE_JENIS']==1) {
|
|
$datSnj = $this->Amod->getData_SnJual_byDO($key['ID_DO']);
|
|
foreach ($datSnj as $dat) {
|
|
$datSnStock = $this->Amod->getData_SnStock_byNAMA_bySTATUS($dat['NAMA_SNJ'], 10);
|
|
if ($datSnStock==TRUE) {
|
|
$update = [
|
|
'STATUS_SNSTOCK' => '0'
|
|
];
|
|
$action = $this->Amod->update('sn_stock', $update, 'ID_SNSTOCK', $datSnStock[0]['ID_SNSTOCK']);
|
|
|
|
$this->GE_Kalkulasi_KuantitiBarang($key['BARANG_ID'], $datSo[0]['GUDANG_SO'], "Step 2 - PENJUALAN - Hapus Barang", 0, 1);
|
|
}
|
|
}
|
|
$action = $this->Amod->delete('sn_jual', $key['ID_DO'], 'DO_ID');
|
|
}
|
|
}
|
|
|
|
$datIo = $this->Amod->getData_TransaksiStock_bySO_statusNull($id_so);
|
|
foreach ($datIo as $key) {
|
|
if ($key['JENIS_IO']==0) {
|
|
if ($key['TYPE_JENIS']==1) {
|
|
$datSnio = $this->Amod->getData_SnIo_byIO($key['ID_IO']);
|
|
foreach ($datSnio as $dat) {
|
|
$datSnStock = $this->Amod->getData_SnStock_byNAMA_bySTATUS($dat['NAMA_SNIO'], 10);
|
|
if ($datSnStock==TRUE) {
|
|
$update = [
|
|
'STATUS_SNSTOCK' => '0'
|
|
];
|
|
$action = $this->Amod->update('sn_stock', $update, 'ID_SNSTOCK', $datSnStock[0]['ID_SNSTOCK']);
|
|
}
|
|
}
|
|
$action = $this->Amod->delete('sn_io', $key['ID_IO'], 'IO_ID');
|
|
}
|
|
|
|
$this->GE_Kalkulasi_KuantitiBarang($key['BARANG_ID'], $datSo[0]['GUDANG_SO'], "Step 2 - PENJUALAN - Hapus Barang", 0, $key['QTY_IO']);
|
|
} else if ($key['JENIS_IO']==1) {
|
|
if ($key['TYPE_JENIS']==1) {
|
|
$datSnio = $this->Amod->getData_SnIo_byIO($key['ID_IO']);
|
|
foreach ($datSnio as $dat) {
|
|
$datSnStock = $this->Amod->getData_SnStock_byNAMA_statusNull($dat['NAMA_SNIO']);
|
|
if ($datSnStock==TRUE) {
|
|
$action = $this->Amod->delete('sn_stock', $datSnStock[0]['ID_SNSTOCK'], 'ID_SNSTOCK');
|
|
}
|
|
}
|
|
$action = $this->Amod->delete('sn_io', $key['ID_IO'], 'IO_ID');
|
|
}
|
|
}
|
|
}
|
|
|
|
$action = $this->Amod->delete('daftar_order', $id_so, 'SO_ID');
|
|
$action = $this->Amod->delete('transaksi_stock', $id_so, 'SO_ID');
|
|
|
|
$update = [
|
|
'STATUS_SO' => '9',
|
|
'HAPUS_SO' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('sales_order', $update, 'ID_SO', $id_so);
|
|
|
|
if ($action) {
|
|
$this->session->set_flashdata('data_lock', 'dihapus');
|
|
redirect('Menu/PJ_Sub1_SalesOrder_1');
|
|
} else {
|
|
$this->session->set_flashdata('failed', 'dihapus');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
}
|
|
|
|
//SUBMENU TRANSAKSI - PROSES BARANG
|
|
public function PJ_Sub1_ProsesBarang_1() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$tgl = date('Y-m-d');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "PJ", "TRANSAKSI - Proses Barang");
|
|
$id_menu = $datShm[0]['MENU_ID'];
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$datPak = $this->Amod->getData_PeriodeAkuntansi_byPERIODE_bySTATUS($tgl, 0);
|
|
if ($datPak==TRUE) {
|
|
$kunciTombol = 0;
|
|
|
|
$datSoTahan = $this->Amod->getData_SalesOrder_bySTATUS(4);
|
|
$no = 0;
|
|
foreach ($datSoTahan as $key) {
|
|
$datDo = $this->Amod->getData_DaftarOrder_bySO($key['ID_SO']);
|
|
$datQc = $this->Amod->getData_QualityControl_bySO($key['ID_SO']);
|
|
$datSoTahan[$no] += ['QC' => $datQc];
|
|
$datSoTahan[$no++] += ['DATDO' => $datDo];
|
|
}
|
|
|
|
$datSoProses = $this->Amod->getData_SalesOrder_status0_3();
|
|
$no = 0;
|
|
foreach ($datSoProses as $key) {
|
|
$datDo = $this->Amod->getData_DaftarOrder_bySO($key['ID_SO']);
|
|
$nodo = 0;
|
|
foreach ($datDo as $dat) {
|
|
$sumDo = $this->Amod->getSum_DaftarOrder_byBARANG_status0_3($dat['BARANG_ID']);
|
|
$qty_hhbso = $sumDo[0]['TOTAL'];
|
|
$kuantitiNow = $this->GE_AmbilData_DataKuantiti($dat['BARANG_ID'], 0);
|
|
|
|
if ($dat['TYPE_JENIS']==2) {
|
|
$status_hhbso = 1;
|
|
} else if ($kuantitiNow==0) {
|
|
$status_hhbso = 0;
|
|
} else if ($kuantitiNow==$qty_hhbso) {
|
|
$status_hhbso = 3;
|
|
} else if ($kuantitiNow<$qty_hhbso) {
|
|
$status_hhbso = 2;
|
|
} else {
|
|
$status_hhbso = 1;
|
|
}
|
|
|
|
$datHhbso = $this->Amod->getData_HasilHitungBarangSo_byBARANG($dat['BARANG_ID']);
|
|
if ($datHhbso==FALSE) {
|
|
$input = [
|
|
'BARANG_ID' => $dat['BARANG_ID'],
|
|
'QTY_HHBSO' => $qty_hhbso,
|
|
'STOK_HHBSO' => $kuantitiNow,
|
|
'STATUS_HHBSO' => $status_hhbso,
|
|
'LAST_HHBSO' => $timestamp
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungbarangso', $input);
|
|
} else {
|
|
$update = [
|
|
'QTY_HHBSO' => $qty_hhbso,
|
|
'STOK_HHBSO' => $kuantitiNow,
|
|
'STATUS_HHBSO' => $status_hhbso,
|
|
'LAST_HHBSO' => $timestamp
|
|
];
|
|
$action = $this->Amod->update('hasil_hitungbarangso', $update, 'ID_HHBSO', $datHhbso[0]['ID_HHBSO']);
|
|
}
|
|
$datDo[$nodo++] += ['STAT' => $status_hhbso];
|
|
}
|
|
$datSoProses[$no++] += ['DATDO' => $datDo];
|
|
}
|
|
|
|
$countTahan = count($datSoTahan);
|
|
$countProses = count($datSoProses);
|
|
} else {
|
|
$kunciTombol = 1;
|
|
$datSoTahan = NULL;
|
|
$datSoProses = NULL;
|
|
$countTahan = 0;
|
|
$countProses = 0;
|
|
}
|
|
|
|
$datStpos = $this->Amod->getData_SetTogglePosisi_byKARYAWAN_byMENU($id_karyawan, $id_menu);
|
|
if ($datStpos==FALSE) { $posisiToggle = 0; } else { $posisiToggle = $datStpos[0]['AKTIF_STPOS']; }
|
|
|
|
$data = array(
|
|
'sidebar' => "menu penjualan",
|
|
'navChild' => "penjualan prosesbarang",
|
|
'soTahan' => $datSoTahan,
|
|
'soProses' => $datSoProses,
|
|
'countTahan' => $countTahan,
|
|
'countProses' => $countProses,
|
|
'posisiToggle' => $posisiToggle,
|
|
'tgl' => $tgl,
|
|
'id_menu' => $id_menu,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil,
|
|
'kunciTombol' => $kunciTombol,
|
|
);
|
|
$this->load->view('proses/PJ_Sub1_ProsesBarang_1', $data);
|
|
}
|
|
|
|
public function PJ_Ambil_Sub1_B1_DataSalesOrder() {
|
|
$countTahan = $this->input->post('countTahan');
|
|
$countProses = $this->input->post('countProses');
|
|
|
|
$newTahan = $this->Amod->getCount_SalesOrder_bySTATUS(4);
|
|
$newProses = $this->Amod->getCount_SalesOrder_status0_3();
|
|
|
|
if ($countTahan!=$newTahan OR $countProses!=$newProses) {
|
|
$value = 1;
|
|
} else {
|
|
$value = 0;
|
|
}
|
|
|
|
$this->output_json(['value' => $value]);
|
|
}
|
|
|
|
public function PJ_Kunci_Sub1_B1_DataSalesOrder() {
|
|
$id_so = $this->input->post('id_solock');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$now = date('Y-m-d');
|
|
$month = date('m');
|
|
$year = date('Y');
|
|
$bulan = $this->Amod->generate_inisialMonth($month);
|
|
$bulan = strtoupper("$bulan $year");
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$value = 0;
|
|
$datSo = $this->Amod->getData_SalesOrder_byID_bySTATUS($id_so, 4);
|
|
if ($datSo==FALSE) {
|
|
$value = 2;
|
|
} else {
|
|
$datDo = $this->Amod->getData_DaftarOrder_bySO($id_so);
|
|
$datIo0 = $this->Amod->getData_TransaksiStock_bySO_byJENIS_statusNull($id_so, 0);
|
|
$datIo1 = $this->Amod->getData_TransaksiStock_bySO_byJENIS_statusNull($id_so, 1);
|
|
|
|
$kode_penjualan = $this->Amod->generate_kodePenjualan();
|
|
$sj_penjualan = $this->Amod->generate_SJPenjualan($datSo[0]['CORP_ID']);
|
|
$inv_penjualan = $this->Amod->generate_INVPenjualan($datSo[0]['CORP_ID']);
|
|
$datPelanggan = $this->Amod->getData_Pelanggan_byID($datSo[0]['PELANGGAN_ID']);
|
|
$tempo_penjualan = $this->Amod->generate_addDay($now, $datPelanggan[0]['TOP_PELANGGAN']);
|
|
$ket_pda = "No Nota : $inv_penjualan";
|
|
|
|
if ($datSo[0]['CORP_ID']==3 OR $datSo[0]['CORP_ID']==5) {
|
|
$input = [
|
|
'SO_ID' => $id_so,
|
|
'TGL_PENJUALAN' => $now,
|
|
'KODE_PENJUALAN' => $kode_penjualan,
|
|
'SJ_PENJUALAN' => $sj_penjualan,
|
|
'INV_PENJUALAN' => $inv_penjualan,
|
|
'FP_PENJUALAN' => "00000000000000000",
|
|
'TT_PENJUALAN' => $now,
|
|
'TEMPO_PENJUALAN' => $tempo_penjualan,
|
|
'KET_PENJUALAN' => $ket_pda,
|
|
'PEL_ID' => $datSo[0]['PELANGGAN_ID'],
|
|
'KOP_ID' => $datSo[0]['CORP_ID'],
|
|
'STATUS_PENJUALAN' => '1'
|
|
];
|
|
} else {
|
|
$input = [
|
|
'SO_ID' => $id_so,
|
|
'TGL_PENJUALAN' => $now,
|
|
'KODE_PENJUALAN' => $kode_penjualan,
|
|
'SJ_PENJUALAN' => $sj_penjualan,
|
|
'INV_PENJUALAN' => $inv_penjualan,
|
|
'TEMPO_PENJUALAN' => $tempo_penjualan,
|
|
'KET_PENJUALAN' => $ket_pda,
|
|
'PEL_ID' => $datSo[0]['PELANGGAN_ID'],
|
|
'KOP_ID' => $datSo[0]['CORP_ID'],
|
|
'STATUS_PENJUALAN' => '1'
|
|
];
|
|
}
|
|
$action = $this->Amod->create('penjualan', $input);
|
|
|
|
$id_penjualan = $this->Amod->getMax_ID_Penjualan();
|
|
$id_penjualan = $id_penjualan[0]['ID_PENJUALAN'];
|
|
|
|
$input = [
|
|
'SJ_INV' => '0',
|
|
'TGL_CD' => $now,
|
|
'KODE_BUKTI' => $sj_penjualan,
|
|
'PENJUALAN_ID' => $id_penjualan
|
|
];
|
|
$action = $this->Amod->create('cetak_dokumen', $input);
|
|
|
|
$input = [
|
|
'SJ_INV' => '1',
|
|
'TGL_CD' => $now,
|
|
'KODE_BUKTI' => $inv_penjualan,
|
|
'PENJUALAN_ID' => $id_penjualan
|
|
];
|
|
$action = $this->Amod->create('cetak_dokumen', $input);
|
|
|
|
$sumSo = $this->Amod->getSum_DaftarOrder_bySO($id_so);
|
|
$dpp = $sumSo[0]['TOTAL'];
|
|
$pajak_keluaran = round(($dpp*($datSo[0]['PPN_SO']/100)),2);
|
|
$debet_dak = round(($dpp+$pajak_keluaran),2);
|
|
|
|
if ($debet_dak==0) {
|
|
$input = [
|
|
'PENJUALAN_ID' => $id_penjualan,
|
|
'PELANGGAN_ID' => $datSo[0]['PELANGGAN_ID'],
|
|
'CORP_ID' => $datSo[0]['CORP_ID'],
|
|
'DEBET_HHPDA' => $debet_dak,
|
|
'KREDIT_HHPDA' => '0',
|
|
'STATUS_HHPDA' => '1',
|
|
'TGLLOCK_HHPDA' => $now,
|
|
'LAST_HHPDA' => $timestamp,
|
|
'LUNAS_HHPDA' => $kode_penjualan,
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungpda', $input);
|
|
} else {
|
|
$input = [
|
|
'PENJUALAN_ID' => $id_penjualan,
|
|
'PELANGGAN_ID' => $datSo[0]['PELANGGAN_ID'],
|
|
'CORP_ID' => $datSo[0]['CORP_ID'],
|
|
'DEBET_HHPDA' => $debet_dak,
|
|
'KREDIT_HHPDA' => '0',
|
|
'STATUS_HHPDA' => '0',
|
|
'LAST_HHPDA' => $timestamp,
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungpda', $input);
|
|
}
|
|
|
|
$input = [
|
|
'CIPTA_AKUNTANSI' => "Oleh $panggilan pada $timestamp",
|
|
'TGL_AKUNTANSI' => $now,
|
|
'KODE_AKUNTANSI' => $kode_penjualan,
|
|
'STATUS_AKUNTANSI' => '1',
|
|
];
|
|
$action = $this->Amod->create('akuntansi', $input);
|
|
|
|
$id_akuntansi = $this->Amod->getMax_ID_Akuntansi();
|
|
$id_akuntansi = $id_akuntansi[0]['ID_AKUNTANSI'];
|
|
|
|
$input = [
|
|
'AKUNTANSI_ID' => $id_akuntansi,
|
|
'PERKIRAAN_ID' => '3',
|
|
'JENIS_PDA' => '0',
|
|
'CIPTA_DAK' => "Oleh $panggilan pada $timestamp",
|
|
'JENIS_DAK' => '0',
|
|
'DEBET_DAK' => $debet_dak,
|
|
'KREDIT_DAK' => '0',
|
|
'KET_DAK' => $ket_pda,
|
|
'PELANGGAN_ID' => $datSo[0]['PELANGGAN_ID'],
|
|
'PENJUALAN_ID' => $id_penjualan
|
|
];
|
|
$action = $this->Amod->create('daftar_akuntansi', $input);
|
|
|
|
$input = [
|
|
'AKUNTANSI_ID' => $id_akuntansi,
|
|
'PERKIRAAN_ID' => '23',
|
|
'CIPTA_DAK' => "Oleh $panggilan pada $timestamp",
|
|
'JENIS_DAK' => '0',
|
|
'DEBET_DAK' => '0',
|
|
'KREDIT_DAK' => $dpp,
|
|
'KET_DAK' => $ket_pda,
|
|
'PELANGGAN_ID' => $datSo[0]['PELANGGAN_ID'],
|
|
'PENJUALAN_ID' => $id_penjualan
|
|
];
|
|
$action = $this->Amod->create('daftar_akuntansi', $input);
|
|
|
|
if ($datSo[0]['PPN_SO']>0) {
|
|
$input = [
|
|
'AKUNTANSI_ID' => $id_akuntansi,
|
|
'PERKIRAAN_ID' => '83',
|
|
'CIPTA_DAK' => "Oleh $panggilan pada $timestamp",
|
|
'JENIS_DAK' => '0',
|
|
'DEBET_DAK' => '0',
|
|
'KREDIT_DAK' => $pajak_keluaran,
|
|
'KET_DAK' => "Pajak Keluaran Kode : [$kode_penjualan]",
|
|
'PELANGGAN_ID' => $datSo[0]['PELANGGAN_ID'],
|
|
'PENJUALAN_ID' => $id_penjualan
|
|
];
|
|
$action = $this->Amod->create('daftar_akuntansi', $input);
|
|
}
|
|
|
|
if ($datSo[0]['FEE_SO']>0) {
|
|
$input = [
|
|
'PENJUALAN_ID' => $id_penjualan,
|
|
'PEL_ID' => $datSo[0]['PELANGGAN_ID'],
|
|
'DEBET_HHBFE' => '0',
|
|
'KREDIT_HHBFE' => $datSo[0]['FEE_SO'],
|
|
'STATUS_HHBFE' => '0',
|
|
'LAST_HHBFE' => $timestamp
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungbfe', $input);
|
|
}
|
|
|
|
$tgl_ket = date('d/m/Y');
|
|
$ket_so_a = "Sudah diproses oleh $panggilan Tanggal $tgl_ket";
|
|
|
|
$update = [
|
|
'STATUS_SO' => '1',
|
|
'TGL_SO' => $now,
|
|
'NILAI_SO' => $debet_dak,
|
|
'KUNCI_SO' => "Oleh $panggilan pada $timestamp",
|
|
'KET_SO_A' => $ket_so_a,
|
|
];
|
|
$action = $this->Amod->update('sales_order', $update, 'ID_SO', $id_so);
|
|
|
|
foreach ($datDo as $key) {
|
|
if ($key['TYPE_JENIS']==1) {
|
|
$datStgas = $this->Amod->getData_SetToggleAs_byMERK_byPRODUK_bySTATUS($key['MERK_ID'], $key['PRODUK_ID'], 1);
|
|
if ($datStgas==TRUE) {
|
|
$nama_pkpr = "[AUTO SELLOUT] $bulan";
|
|
$datPkpr = $this->Amod->getData_PotonganKlaimProgram_byNAMA($nama_pkpr);
|
|
if ($datPkpr==TRUE) {
|
|
$id_pkpr = $datPkpr[0]['ID_PKPR'];
|
|
} else {
|
|
$input = [
|
|
'NAMA_PKPR' => $nama_pkpr
|
|
];
|
|
$action = $this->Amod->create('potongan_klaimprogram', $input);
|
|
|
|
$id_pkpr = $this->Amod->getMax_ID_PotonganKlaimProgram();
|
|
$id_pkpr = $id_pkpr[0]['ID_PKPR'];
|
|
}
|
|
}
|
|
|
|
$datPc = $this->Amod->getData_PromoClearance_byBARANG_bySTATUS($key['BARANG_ID'], 1);
|
|
$clearSp = 0;
|
|
if ($datPc==TRUE) {
|
|
$clearSp = 1;
|
|
$datStpcPel = $this->Amod->getData_SetPelangganClearance_byPELANGGAN($datSo[0]['PELANGGAN_ID']);
|
|
$datStpcSal = $this->Amod->getData_SetPelangganClearance_bySALES($datSo[0]['SALES_ID']);
|
|
if ($datStpcPel==FALSE) {
|
|
if ($datStpcSal==TRUE) {
|
|
$status_dpc = 2;
|
|
} else {
|
|
$status_dpc = 0;
|
|
}
|
|
$input = [
|
|
'PC_ID' => $datPc[0]['ID_PC'],
|
|
'STATUS_DPC' => $status_dpc,
|
|
'PENJUALAN_ID' => $id_penjualan
|
|
];
|
|
$action = $this->Amod->create('daftar_promoclearance', $input);
|
|
}
|
|
}
|
|
|
|
$datSnj = $this->Amod->getData_SnJual_byDO($key['ID_DO']);
|
|
foreach ($datSnj as $dat) {
|
|
$datSnStock = $this->Amod->getData_SnStock_byNAMA_bySTATUS($dat['NAMA_SNJ'], 10);
|
|
$input = [
|
|
'TGL_HSN' => $now,
|
|
'KODE_BUKTI' => $kode_penjualan,
|
|
'SJ_HSN' => $sj_penjualan,
|
|
'INV_HSN' => $inv_penjualan,
|
|
'SNSTOCK_ID' => $datSnStock[0]['ID_SNSTOCK'],
|
|
'PELANGGAN_ID' => $datSo[0]['PELANGGAN_ID'],
|
|
];
|
|
$action = $this->Amod->create('histori_sn', $input);
|
|
|
|
$update = [
|
|
'STATUS_SNSTOCK' => '1'
|
|
];
|
|
$action = $this->Amod->update('sn_stock', $update, 'ID_SNSTOCK', $datSnStock[0]['ID_SNSTOCK']);
|
|
|
|
if ($datStgas==TRUE) {
|
|
$cekBarang = $this->Amod->getData_DaftarOtomasiBooster_byBARANG_bySTATUS_byLIMIT($key['BARANG_ID'], 1, $now);
|
|
if ($cekBarang==FALSE) {
|
|
$datSnkpr = $this->Amod->getData_SnKlaimProgram_bySNSTOCK($datSnStock[0]['ID_SNSTOCK']);
|
|
if ($datSnkpr==TRUE) {
|
|
$input = [
|
|
'CIPTA_LKPR' => "Oleh Sistem pada $timestamp",
|
|
'TGL_LKPR' => $now,
|
|
'PROGRAM_ID' => '1',
|
|
'SNKPR_ID' => $datSnkpr[0]['ID_SNKPR'],
|
|
'PKPR_ID' => $id_pkpr,
|
|
'NILAI_LKPR' => '0'
|
|
];
|
|
$action = $this->Amod->create('link_klaimprogram', $input);
|
|
|
|
$id_lkpr = $this->Amod->getMax_ID_LinkKlaimProgram();
|
|
$id_lkpr = $id_lkpr[0]['ID_LKPR'];
|
|
|
|
$input = [
|
|
'STGAS_ID' => $datStgas[0]['ID_STGAS'],
|
|
'LKPR_ID' => $id_lkpr,
|
|
'TIMESTAMP' => $timestamp
|
|
];
|
|
$action = $this->Amod->create('histori_otomasisellout', $input);
|
|
|
|
$update = [
|
|
'STATUS_SNKPR' => '1'
|
|
];
|
|
$action = $this->Amod->update('sn_klaimprogram', $update, 'ID_SNKPR', $datSnkpr[0]['ID_SNKPR']);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
if ($key['TYPE_JENIS']!=2) {
|
|
$this->GE_Kalkulasi_KuantitiBarang($key['BARANG_ID'], $datSo[0]['GUDANG_SO'], "Step 1 - PENJUALAN - Terbit Nota", '0', $key['QTY_DO']);
|
|
$this->GE_Kalkulasi_HistoriKuantiti($key['BARANG_ID'], "Step 1 - PENJUALAN - Terbit Nota", '0', $key['QTY_DO'], $kode_penjualan, '0', '0');
|
|
}
|
|
|
|
if ($datPelanggan[0]['TYPE_PELANGGAN']=="1") {
|
|
$komisi_do = $key['KOMISI_DEALER'];
|
|
} else {
|
|
$komisi_do = $key['KOMISI_USER'];
|
|
}
|
|
|
|
$datSsp = $this->Amod->getData_SetSalesProduk_byMERK_byPRODUK($key['MERK_ID'], $key['PRODUK_ID']);
|
|
if ($datSsp==FALSE) {
|
|
$sp_do = NULL;
|
|
} else {
|
|
if ($datSsp[0]['SALES_ID']==NULL) {
|
|
$sp_do = NULL;
|
|
} else {
|
|
$datSales = $this->Amod->getData_Karyawan_byID($datSsp[0]['SALES_ID']);
|
|
$sp_do = $datSales[0]['NAMA_PANGGILAN_KARYAWAN'];
|
|
}
|
|
}
|
|
|
|
if ($clearSp==1) {
|
|
$sp_do = NULL;
|
|
}
|
|
|
|
$update = [
|
|
'SP_DO' => $sp_do,
|
|
'NAMA_DO' => $key['NAMA_BARANG'],
|
|
'KOMISI_DO' => $komisi_do,
|
|
];
|
|
$action = $this->Amod->update('daftar_order', $update, 'ID_DO', $key['ID_DO']);
|
|
}
|
|
|
|
foreach ($datIo0 as $key) {
|
|
if ($key['TYPE_JENIS']==1) {
|
|
$datSnio = $this->Amod->getData_SnIo_byIO($key['ID_IO']);
|
|
foreach ($datSnio as $dat) {
|
|
$datSnStock = $this->Amod->getData_SnStock_byNAMA_bySTATUS($dat['NAMA_SNIO'], 10);
|
|
$input = [
|
|
'TGL_HSN' => $now,
|
|
'KODE_BUKTI' => $kode_penjualan,
|
|
'SJ_HSN' => $sj_penjualan,
|
|
'INV_HSN' => $inv_penjualan,
|
|
'PELANGGAN_ID' => $datSo[0]['PELANGGAN_ID'],
|
|
'SNSTOCK_ID' => $datSnStock[0]['ID_SNSTOCK']
|
|
];
|
|
$action = $this->Amod->create('histori_sn', $input);
|
|
|
|
$update = [
|
|
'STATUS_SNSTOCK' => '1'
|
|
];
|
|
$action = $this->Amod->update('sn_stock', $update, 'ID_SNSTOCK', $datSnStock[0]['ID_SNSTOCK']);
|
|
}
|
|
}
|
|
|
|
if ($key['TYPE_JENIS']!=2) {
|
|
$this->GE_Kalkulasi_KuantitiBarang($key['BARANG_ID'], $datSo[0]['GUDANG_SO'], "Step 1 - PENJUALAN - Terbit Nota", '0', $key['QTY_IO']);
|
|
$this->GE_Kalkulasi_HistoriKuantiti($key['BARANG_ID'], "Step 1 - PENJUALAN - Terbit Nota", '0', $key['QTY_IO'], $kode_penjualan, '0', '0');
|
|
|
|
$update = [
|
|
'STATUS_IO' => '1',
|
|
'JIO_ID' => '2',
|
|
'PROSES_IO' => "Oleh $panggilan pada $timestamp",
|
|
'KODE_BUKTI' => $kode_penjualan
|
|
];
|
|
$action = $this->Amod->update('transaksi_stock', $update, 'ID_IO', $key['ID_IO']);
|
|
}
|
|
}
|
|
|
|
foreach ($datIo1 as $key) {
|
|
if ($key['TYPE_JENIS']==1) {
|
|
$datSnio = $this->Amod->getData_SnIo_byIO($key['ID_IO']);
|
|
foreach ($datSnio as $dat) {
|
|
$datSnStock = $this->Amod->getData_SnStock_byNAMA_bySTATUS($dat['NAMA_SNIO'], 0);
|
|
$input = [
|
|
'TGL_HSN' => $now,
|
|
'KODE_BUKTI' => $datSo[0]['KODE_SO'],
|
|
'SNSTOCK_ID' => $datSnStock[0]['ID_SNSTOCK']
|
|
];
|
|
$action = $this->Amod->create('histori_sn', $input);
|
|
}
|
|
}
|
|
|
|
$this->GE_Kalkulasi_KuantitiBarang($key['BARANG_ID'], $datSo[0]['GUDANG_SO'], "Step 1 - PENJUALAN - Terbit Nota", '1', $key['QTY_IO']);
|
|
$this->GE_Kalkulasi_HistoriKuantiti($key['BARANG_ID'], "Step 1 - PENJUALAN - Terbit Nota", '1', $key['QTY_IO'], $kode_penjualan, '0', $key['ID_IO']);
|
|
|
|
$update = [
|
|
'STATUS_IO' => '1',
|
|
'JIO_ID' => '2',
|
|
'PROSES_IO' => "Oleh $panggilan pada $timestamp",
|
|
'KODE_BUKTI' => $kode_penjualan
|
|
];
|
|
$action = $this->Amod->update('transaksi_stock', $update, 'ID_IO', $key['ID_IO']);
|
|
}
|
|
|
|
$this->GE_Kalkulasi_HistoriOtomasiBooster($id_penjualan);
|
|
|
|
$value = 1;
|
|
}
|
|
|
|
if ($value==1) {
|
|
$this->session->set_flashdata('success', 'membuat Nota');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
} else if ($value==2) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
} else {
|
|
$this->session->set_flashdata('failed', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
}
|
|
|
|
public function PJ_Revisi_Sub1_B1_DataSalesOrder() {
|
|
$id_so = $this->input->post('id_sorev');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$value = 0;
|
|
$datSo = $this->Amod->getData_SalesOrder_byID_bySTATUS($id_so, 4);
|
|
if ($datSo==FALSE) {
|
|
$value = 2;
|
|
} else {
|
|
$datDo = $this->Amod->getData_DaftarOrder_bySO($id_so);
|
|
foreach ($datDo as $key) {
|
|
if ($key['TYPE_JENIS']==0) {
|
|
$this->GE_Kalkulasi_KuantitiBarang($key['BARANG_ID'], $datSo[0]['GUDANG_SO'], "Step 1 - PENJUALAN - Revisi Barang", '0', $key['QTY_DO']);
|
|
}
|
|
}
|
|
|
|
$action = $this->Amod->delete('quality_control', $id_so, 'SO_ID');
|
|
|
|
$update = [
|
|
'STATUS_SO' => '0',
|
|
'REVISI_SO' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('sales_order', $update, 'ID_SO', $id_so);
|
|
|
|
$value = 1;
|
|
}
|
|
|
|
if ($value==1) {
|
|
$this->session->set_flashdata('success', 'revisi');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
} else if ($value==2) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
} else {
|
|
$this->session->set_flashdata('failed', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
}
|
|
|
|
public function PJ_Sub1_ProsesBarang_2($id) {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$tgl = date('Y-m-d');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "PJ", "TRANSAKSI - Proses Barang");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
|
|
$datKaryawan = $this->Amod->getData_Karyawan_Penjadwalan();
|
|
$datSo = $this->Amod->getData_SalesOrder_byID($id);
|
|
$datHpar = $this->Amod->getData_HargaPart_byID();
|
|
$datPak = $this->Amod->getData_PeriodeAkuntansi_byPERIODE_bySTATUS($tgl, 0);
|
|
if ($datPak==TRUE) {
|
|
$kunciTombol = 0;
|
|
} else {
|
|
$kunciTombol = 1;
|
|
}
|
|
|
|
if ($datSo[0]['GUDANG_SO']==1) {
|
|
$gudangSo = "GUDANG PCM";
|
|
} else if ($datSo[0]['GUDANG_SO']==2) {
|
|
$gudangSo = "GUDANG ITP";
|
|
} else if ($datSo[0]['GUDANG_SO']==3) {
|
|
$gudangSo = "GUDANG SERVICE";
|
|
}
|
|
|
|
if ($datSo[0]['CORP_ID']==1) {
|
|
$kopSo = "KOP TMP";
|
|
} else if ($datSo[0]['CORP_ID']==2) {
|
|
$kopSo = "KOP DMT";
|
|
} else if ($datSo[0]['CORP_ID']==3) {
|
|
$kopSo = "KOP PCM";
|
|
} else if ($datSo[0]['CORP_ID']==4) {
|
|
$kopSo = "KOP SFTR";
|
|
} else if ($datSo[0]['CORP_ID']==5) {
|
|
$kopSo = "KOP ITP";
|
|
}
|
|
|
|
$data = array(
|
|
'sidebar' => "menu penjualan",
|
|
'navChild' => "penjualan step2",
|
|
'qc' => $datKaryawan,
|
|
'potong_part' => $datHpar,
|
|
'gudangSo' => $gudangSo,
|
|
'kopSo' => $kopSo,
|
|
'gudang_so' => $datSo[0]['GUDANG_SO'],
|
|
'status_so' => $datSo[0]['STATUS_SO'],
|
|
'kode_so' => $datSo[0]['KODE_SO'],
|
|
'nama_pelanggan' => $datSo[0]['NAMA_PELANGGAN'],
|
|
'nama_sales' => $datSo[0]['NAMA_PANGGILAN_KARYAWAN'],
|
|
'id_so' => $id,
|
|
'hak' => $hak,
|
|
'kunciTombol' => $kunciTombol,
|
|
);
|
|
$this->load->view('proses/PJ_Sub1_ProsesBarang_2', $data);
|
|
}
|
|
|
|
public function PJ_Sub1_ProsesParsial_2($id) {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$tgl = date('Y-m-d');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "PJ", "TRANSAKSI - Proses Barang");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
|
|
$datKaryawan = $this->Amod->getData_Karyawan_Penjadwalan();
|
|
$datSo = $this->Amod->getData_SalesOrder_byID($id);
|
|
$datHpar = $this->Amod->getData_HargaPart_byID();
|
|
$datPak = $this->Amod->getData_PeriodeAkuntansi_byPERIODE_bySTATUS($tgl, 0);
|
|
if ($datPak==TRUE) {
|
|
$kunciTombol = 0;
|
|
} else {
|
|
$kunciTombol = 1;
|
|
}
|
|
|
|
if ($datSo[0]['GUDANG_SO']==1) {
|
|
$gudangSo = "GUDANG PCM";
|
|
} else if ($datSo[0]['GUDANG_SO']==2) {
|
|
$gudangSo = "GUDANG ITP";
|
|
} else if ($datSo[0]['GUDANG_SO']==3) {
|
|
$gudangSo = "GUDANG SERVICE";
|
|
} else {
|
|
$gudangSo = "GUDANG LALU";
|
|
}
|
|
|
|
$data = array(
|
|
'sidebar' => "menu penjualan",
|
|
'navChild' => "penjualan step2",
|
|
'qc' => $datKaryawan,
|
|
'potong_part' => $datHpar,
|
|
'gudang_so' => $datSo[0]['GUDANG_SO'],
|
|
'status_so' => $datSo[0]['STATUS_SO'],
|
|
'kode_so' => $datSo[0]['KODE_SO'],
|
|
'nama_pelanggan' => $datSo[0]['NAMA_PELANGGAN'],
|
|
'nama_sales' => $datSo[0]['NAMA_PANGGILAN_KARYAWAN'],
|
|
'id_so' => $id,
|
|
'gudangSo' => $gudangSo,
|
|
'hak' => $hak,
|
|
'kunciTombol' => $kunciTombol,
|
|
);
|
|
$this->load->view('proses/PJ_Sub1_ProsesParsial_2', $data);
|
|
}
|
|
|
|
public function PJ_Ganti_Sub1_B2_ModeParsial() {
|
|
$id_so = $this->input->post('id_so');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$value = 0;
|
|
$datSo = $this->Amod->getData_SalesOrder_byID_bySTATUS($id_so, 0);
|
|
if ($datSo==FALSE) {
|
|
$value = 2;
|
|
} else {
|
|
$datDo = $this->Amod->getData_DaftarOrder_bySO($id_so);
|
|
foreach ($datDo as $key) {
|
|
$countSnj = $this->Amod->getCount_SnJual_byDO($key['ID_DO']);
|
|
if ($countSnj>0) {
|
|
$input = [
|
|
'SO_ID' => $key['SO_ID'],
|
|
'DO_ID' => $key['ID_DO'],
|
|
'BARANG_ID' => $key['BARANG_ID'],
|
|
'QTY_SJP' => $countSnj,
|
|
'NAMA_SJP' => $key['NAMA_BARANG'],
|
|
];
|
|
$action = $this->Amod->create('daftar_sjparsial', $input);
|
|
|
|
$id_sjp = $this->Amod->getMax_ID_DaftarSjParsial();
|
|
$id_sjp = $id_sjp[0]['ID_SJP'];
|
|
|
|
$datSnj = $this->Amod->getData_SnJual_byDO($key['ID_DO']);
|
|
foreach ($datSnj as $dat) {
|
|
$input = [
|
|
'SJP_ID' => $id_sjp,
|
|
'NAMA_SNSJ' => $dat['NAMA_SNJ']
|
|
];
|
|
$action = $this->Amod->create('sn_sjparsial', $input);
|
|
}
|
|
|
|
$action = $this->Amod->delete('sn_jual', $key['ID_DO'], 'DO_ID');
|
|
}
|
|
}
|
|
|
|
$update = [
|
|
'STATUS_SO' => '3',
|
|
'MODE_SO' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('sales_order', $update, 'ID_SO', $id_so);
|
|
|
|
$value = 1;
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
}
|
|
|
|
public function PJ_Ganti_Sub1_B2_ModeUmum() {
|
|
$id_so = $this->input->post('id_so');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
$now = date('Y-m-d');
|
|
|
|
$value = 0;
|
|
$datSo = $this->Amod->getData_SalesOrder_byID_bySTATUS($id_so, 3);
|
|
if ($datSo==FALSE) {
|
|
$value = 2;
|
|
} else {
|
|
$datSjp = $this->Amod->getData_DaftarSjParsial_bySO($id_so);
|
|
foreach ($datSjp as $key) {
|
|
if ($key['TYPE_JENIS']==0) {
|
|
$this->GE_Kalkulasi_KuantitiBarang($key['BARANG_ID'], $datSo[0]['GUDANG_SO'], "Step 2 - PENJUALAN - Hapus Barang", 0, $key['QTY_SJP']);
|
|
} else if ($key['TYPE_JENIS']==1) {
|
|
$datSnsj = $this->Amod->getData_SnSjParsial_bySJP($key['ID_SJP']);
|
|
foreach ($datSnsj as $dat) {
|
|
$datSnStock = $this->Amod->getData_SnStock_byNAMA_bySTATUS($dat['NAMA_SNSJ'], 10);
|
|
if ($datSnStock==TRUE) {
|
|
$update = [
|
|
'STATUS_SNSTOCK' => '0'
|
|
];
|
|
$action = $this->Amod->update('sn_stock', $update, 'ID_SNSTOCK', $datSnStock[0]['ID_SNSTOCK']);
|
|
|
|
$this->GE_Kalkulasi_KuantitiBarang($key['BARANG_ID'], $datSo[0]['GUDANG_SO'], "Step 2 - PENJUALAN - Hapus Barang", 0, 1);
|
|
}
|
|
}
|
|
|
|
$action = $this->Amod->delete('sn_sjparsial', $key['ID_SJP'], 'SJP_ID');
|
|
}
|
|
|
|
if ($key['CD_ID']!=NULL) {
|
|
$datCd = $this->Amod->getData_CetakDokumen_byID($key['CD_ID']);
|
|
if ($datCd==TRUE) {
|
|
$action = $this->Amod->delete('cetak_dokumen', $key['CD_ID'], 'ID_CD');
|
|
}
|
|
}
|
|
}
|
|
|
|
$action = $this->Amod->delete('daftar_sjparsial', $id_so, 'SO_ID');
|
|
|
|
$update = [
|
|
'STATUS_SO' => '0',
|
|
'MODE_SO' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('sales_order', $update, 'ID_SO', $id_so);
|
|
|
|
$datPenjualan = $this->Amod->getData_Penjualan_bySO($id_so);
|
|
if ($datPenjualan==TRUE) {
|
|
$id_penjualan = $datPenjualan[0]['ID_PENJUALAN'];
|
|
$kode_so = $datSo[0]['KODE_SO'];
|
|
$update = [
|
|
'SO_ID' => NULL,
|
|
'STATUS_PENJUALAN' => '3',
|
|
'KET_BATAL' => "Batal SJ Parsial untuk $kode_so",
|
|
'TGL_BATAL' => $now
|
|
];
|
|
$action = $this->Amod->update('penjualan', $update, 'ID_PENJUALAN', $id_penjualan);
|
|
}
|
|
|
|
$value = 1;
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
}
|
|
|
|
public function PJ_Ambil_Sub1_B2_JumlahSalesOrder() {
|
|
$id_so = $this->input->post('id_so');
|
|
|
|
$datSo = $this->Amod->getData_SalesOrder_byID($id_so);
|
|
|
|
$countDo = $this->Amod->getCount_DaftarOrder_bySO($id_so);
|
|
$countIo = $this->Amod->getCount_TransaksiStock_bySO($id_so);
|
|
$countSjpNot = $this->Amod->getCount_DaftarSjParsial_bySO_groupCD($id_so);
|
|
$countSjpNull = $this->Amod->getCount_DaftarSjParsial_bySO_CDNull($id_so);
|
|
|
|
$this->output_json([
|
|
'total1' => $countDo,
|
|
'total2' => $countIo,
|
|
'total3' => $countSjpNot,
|
|
'total4' => $countSjpNull,
|
|
'ket_so_a' => $datSo[0]['KET_SO_A'],
|
|
]);
|
|
}
|
|
|
|
public function PJ_Ambil_Sub1_B2_JumlahSnJual() {
|
|
$id_do = $this->input->post('id_do');
|
|
|
|
$countSnj = $this->Amod->getCount_SnJual_byDO($id_do);
|
|
|
|
$this->output_json([
|
|
'total' => $countSnj
|
|
]);
|
|
}
|
|
|
|
public function PJ_Ambil_Sub1_B2_JumlahSnIo() {
|
|
$id_io = $this->input->post('id_io');
|
|
|
|
$countSnio = $this->Amod->getCount_SnIo_byIO($id_io);
|
|
|
|
$this->output_json([
|
|
'total' => $countSnio
|
|
]);
|
|
}
|
|
|
|
public function PJ_Ambil_Sub1_B2_JumlahSnSjParsial() {
|
|
$id_sjp = $this->input->post('id_sjp');
|
|
|
|
$countSnsj = $this->Amod->getCount_SnSjParsial_bySJP($id_sjp);
|
|
|
|
$this->output_json([
|
|
'total' => $countSnsj
|
|
]);
|
|
}
|
|
|
|
public function PJ_Ambil_Sub1_B2_DataDaftarOrder() {
|
|
$id_so = $this->input->post('id_so');
|
|
|
|
$data = $this->Amod->getData_DaftarOrder_bySO($id_so);
|
|
$no = 0;
|
|
$sn = "";
|
|
foreach ($data as $key) {
|
|
$datSnj = $this->Amod->getData_SnJual_byDO($key['ID_DO']);
|
|
$nosn = 1;
|
|
foreach ($datSnj as $dat) {
|
|
$nama_snj = $dat['NAMA_SNJ'];
|
|
if ($key['QTY_DO']==$nosn) {
|
|
$sn .= "$nama_snj";
|
|
} else {
|
|
$sn .= "$nama_snj, ";
|
|
$nosn++;
|
|
}
|
|
}
|
|
|
|
$countSnj = $this->Amod->getCount_SnJual_byDO($key['ID_DO']);
|
|
$data[$no] += ['COUNT' => $countSnj];
|
|
$data[$no++] += ['SN' => $sn];
|
|
|
|
$sn = "";
|
|
}
|
|
|
|
$datSo = $this->Amod->getData_SalesOrder_byID($id_so);
|
|
$sumDo = $this->Amod->getSum_DaftarOrder_bySO($id_so);
|
|
if ($sumDo[0]['TOTAL']==NULL) {
|
|
$dpp = 0;
|
|
$ppn = 0;
|
|
$tot = 0;
|
|
} else {
|
|
$dpp = $sumDo[0]['TOTAL'];
|
|
$ppn = round((($datSo[0]['PPN_SO']/100)*$dpp),2);
|
|
$tot = round(($dpp+$ppn),2);
|
|
}
|
|
|
|
$sumHhpda = $this->Amod->getSum_HasilHitungPda_byPELANGGAN($datSo[0]['PELANGGAN_ID']);
|
|
if ($sumHhpda==FALSE) {
|
|
$debet_pda = 0;
|
|
$kredit_pda = 0;
|
|
} else {
|
|
$debet_pda = $sumHhpda[0]['DEBET'];
|
|
$kredit_pda = $sumHhpda[0]['KREDIT'];
|
|
}
|
|
|
|
$sumDoAktif = $this->Amod->getSum_DaftarOrder_byPELANGGAN_status0_2_3($datSo[0]['PELANGGAN_ID'], $id_so);
|
|
if ($sumDoAktif[0]['TOTAL']==NULL) {
|
|
$doAktif = 0;
|
|
} else {
|
|
$doAktif = round($sumDoAktif[0]['TOTAL']);
|
|
}
|
|
|
|
$limit = $datSo[0]['LIMIT_PELANGGAN']-$tot-$doAktif-$debet_pda+$kredit_pda;
|
|
$limit = $datSo[0]['LIMIT_PELANGGAN']-$tot-$doAktif;
|
|
|
|
$blok = [
|
|
'DPP' => number_format($dpp,2),
|
|
'PPN' => number_format($ppn,2),
|
|
'TOT' => number_format($tot,2),
|
|
'LIMIT' => number_format($limit,2),
|
|
];
|
|
|
|
$this->output_json([
|
|
'total' => sizeof($data),
|
|
'data' => $data,
|
|
'blok' => $blok,
|
|
'ket_so_a' => $datSo[0]['KET_SO_A'],
|
|
]);
|
|
}
|
|
|
|
public function PJ_Ambil_Sub1_B2_DataTransaksiStock() {
|
|
$id_so = $this->input->post('id_so');
|
|
|
|
$data = $this->Amod->getData_TransaksiStock_bySO_statusNull($id_so);
|
|
$no = 0;
|
|
$sn = "";
|
|
foreach ($data as $key) {
|
|
$datSnio = $this->Amod->getData_SnIo_byIO($key['ID_IO']);
|
|
$nosn = 1;
|
|
foreach ($datSnio as $dat) {
|
|
$nama_snio = $dat['NAMA_SNIO'];
|
|
if ($key['QTY_IO']==$nosn) {
|
|
$sn .= "$nama_snio";
|
|
} else {
|
|
$sn .= "$nama_snio, ";
|
|
$nosn++;
|
|
}
|
|
}
|
|
|
|
$countSnio = $this->Amod->getCount_SnIo_byIO($key['ID_IO']);
|
|
$data[$no] += ['COUNT' => $countSnio];
|
|
$data[$no++] += ['SN' => $sn];
|
|
|
|
$sn = "";
|
|
}
|
|
|
|
$this->output_json([
|
|
'total' => sizeof($data),
|
|
'data' => $data
|
|
]);
|
|
}
|
|
|
|
public function PJ_Ambil_Sub1_B2_DataDaftarOrderParsial() {
|
|
$id_so = $this->input->post('id_so');
|
|
|
|
$datSo = $this->Amod->getData_SalesOrder_byID($id_so);
|
|
if ($datSo[0]['GUDANG_SO']==3) {
|
|
$jenis_gudang = 10;
|
|
} else {
|
|
$jenis_gudang = $datSo[0]['GUDANG_SO'];
|
|
}
|
|
|
|
$datDo = $this->Amod->getData_DaftarOrder_bySO($id_so);
|
|
$no = 0;
|
|
$data1 = [];
|
|
foreach ($datDo as $key) {
|
|
$siap = $this->GE_AmbilData_DataKuantiti($key['BARANG_ID'], $jenis_gudang);
|
|
|
|
$sumSjp = $this->Amod->getSum_DaftarSjParsial_bySO_byDO($id_so, $key['ID_DO']);
|
|
if ($sumSjp[0]['QTY']==NULL) {
|
|
$sudah = 0;
|
|
} else {
|
|
$sudah = $sumSjp[0]['QTY'];
|
|
}
|
|
|
|
$sisa = $key['QTY_DO']-$sudah;
|
|
$data1[$no++] = [
|
|
'ID_BARANG' => $key['BARANG_ID'],
|
|
'KODE_BARANG' => $key['KODE_BARANG'],
|
|
'NAMA_BARANG' => $key['NAMA_BARANG'],
|
|
'TYPE_JENIS' => $key['TYPE_JENIS'],
|
|
'GUDANG' => $datSo[0]['GUDANG_SO'],
|
|
'QTYAKHIR' => $sisa,
|
|
'QTYSIAP' => $siap,
|
|
];
|
|
}
|
|
|
|
$data2 = $this->Amod->getData_DaftarSjParsial_bySO_CDNotNull_groupCD($id_so);
|
|
$no = 0;
|
|
foreach ($data2 as $key) {
|
|
$datHcd = $this->Amod->getData_HistoriCetakDokumen_byKODE_orderDESC_limit1($key['KODE_BUKTI']);
|
|
if ($datHcd==FALSE) {
|
|
$cetak = "";
|
|
} else {
|
|
$cetak = $datHcd[0]['CETAK_HCD'];
|
|
}
|
|
|
|
$data2[$no++] += ['CETAK' => $cetak];
|
|
}
|
|
|
|
$data3 = $this->Amod->getData_DaftarSjParsial_bySO_CDNull($id_so);
|
|
$no = 0;
|
|
$sn = "";
|
|
foreach ($data3 as $key) {
|
|
$datSnsj = $this->Amod->getData_SnSjParsial_bySJP($key['ID_SJP']);
|
|
$nosn = 1;
|
|
foreach ($datSnsj as $dat) {
|
|
$nama_snsj = $dat['NAMA_SNSJ'];
|
|
if ($key['QTY_SJP']==$nosn) {
|
|
$sn .= "$nama_snsj";
|
|
} else {
|
|
$sn .= "$nama_snsj, ";
|
|
$nosn++;
|
|
}
|
|
}
|
|
|
|
$countSnsj = $this->Amod->getCount_SnSjParsial_bySJP($key['ID_SJP']);
|
|
$data3[$no] += ['COUNT' => $countSnsj];
|
|
$data3[$no++] += ['SN' => $sn];
|
|
|
|
$sn = "";
|
|
}
|
|
|
|
$this->output_json([
|
|
'total1' => sizeof($data1),
|
|
'total2' => sizeof($data2),
|
|
'total3' => sizeof($data3),
|
|
'data1' => $data1,
|
|
'data2' => $data2,
|
|
'data3' => $data3
|
|
]);
|
|
}
|
|
|
|
public function PJ_Ambil_Sub1_B2_DataSnJual() {
|
|
$id_do = $this->input->post('id_do');
|
|
$id_so = $this->input->post('id_so');
|
|
|
|
$datSo = $this->Amod->getData_SalesOrder_byID($id_so);
|
|
$datDo = $this->Amod->getData_DaftarOrder_byID($id_do);
|
|
$datSnStock = $this->Amod->getData_SnStock_byBARANG_byGUDANG_bySTATUS($datDo[0]['BARANG_ID'], $datSo[0]['GUDANG_SO'], 0);
|
|
$datSnj = $this->Amod->getData_SnJual_byDO($id_do);
|
|
|
|
$no = 0;
|
|
foreach ($datSnj as $key) {
|
|
$kop = $this->Amod->generate_inisialCorp($key['KOP_SNJ']);
|
|
$datSnj[$no++] += ['KOP' => $kop];
|
|
}
|
|
|
|
$snStockReady = [];
|
|
$no = 0;
|
|
foreach ($datSnStock as $key) {
|
|
$nama_snstock = $key['NAMA_SNSTOCK'];
|
|
$hasil = "$nama_snstock";
|
|
array_push($snStockReady, $hasil);
|
|
|
|
$datSnBeli = $this->Amod->getData_SnBeli_byNAMA($nama_snstock);
|
|
if ($datSnBeli==TRUE) {
|
|
$datDb = $this->Amod->getData_DaftarBeli_byID($datSnBeli[0]['DB_ID']);
|
|
$kop = $this->Amod->generate_inisialCorp($datDb[0]['CORP_ID']);
|
|
} else {
|
|
$kop = "OPNAME";
|
|
}
|
|
$datSnStock[$no++] += ['KOP' => $kop];
|
|
}
|
|
|
|
$kopSo = $this->Amod->generate_inisialCorp($datSo[0]['CORP_ID']);
|
|
|
|
$this->output_json([
|
|
'dataSnj' => $datSnj,
|
|
'dataSnStock' => $datSnStock,
|
|
'totalSnj' => sizeof($datSnj),
|
|
'totalSnStock' => sizeof($datSnStock),
|
|
'qty' => $datDo[0]['QTY_DO'],
|
|
'kop' => $kopSo,
|
|
'snStockReady' => $snStockReady,
|
|
]);
|
|
}
|
|
|
|
public function PJ_Ambil_Sub1_B2_DataSnIo() {
|
|
$id_io = $this->input->post('id_io');
|
|
$id_so = $this->input->post('id_so');
|
|
|
|
$datSo = $this->Amod->getData_SalesOrder_byID($id_so);
|
|
$datIo = $this->Amod->getData_TransaksiStock_byID($id_io);
|
|
$datSnStock = $this->Amod->getData_SnStock_byBARANG_byGUDANG_bySTATUS($datIo[0]['BARANG_ID'], $datSo[0]['GUDANG_SO'], 0);
|
|
$datSnio = $this->Amod->getData_SnIo_byIO($id_io);
|
|
|
|
$snStockReady = [];
|
|
foreach ($datSnStock as $key) {
|
|
$nama_snstock = $key['NAMA_SNSTOCK'];
|
|
$hasil = "$nama_snstock";
|
|
array_push($snStockReady, $hasil);
|
|
}
|
|
|
|
$this->output_json([
|
|
'dataSnio' => $datSnio,
|
|
'dataSnStock' => $datSnStock,
|
|
'totalSnio' => sizeof($datSnio),
|
|
'totalSnStock' => sizeof($datSnStock),
|
|
'qty' => $datIo[0]['QTY_IO'],
|
|
'snStockReady' => $snStockReady,
|
|
]);
|
|
}
|
|
|
|
public function PJ_Ambil_Sub1_B2_DataSnSjParsial() {
|
|
$id_sjp = $this->input->post('id_sjp');
|
|
$id_so = $this->input->post('id_so');
|
|
|
|
$datSo = $this->Amod->getData_SalesOrder_byID($id_so);
|
|
$datSjp = $this->Amod->getData_DaftarSjParsial_byID($id_sjp);
|
|
$datSnStock = $this->Amod->getData_SnStock_byBARANG_byGUDANG_bySTATUS($datSjp[0]['BARANG_ID'], $datSo[0]['GUDANG_SO'], 0);
|
|
$datSnsj = $this->Amod->getData_SnSjParsial_bySJP($id_sjp);
|
|
|
|
$snStockReady = [];
|
|
foreach ($datSnStock as $key) {
|
|
$nama_snstock = $key['NAMA_SNSTOCK'];
|
|
$hasil = "$nama_snstock";
|
|
array_push($snStockReady, $hasil);
|
|
}
|
|
|
|
$this->output_json([
|
|
'dataSnsj' => $datSnsj,
|
|
'dataSnStock' => $datSnStock,
|
|
'totalSnsj' => sizeof($datSnsj),
|
|
'totalSnStock' => sizeof($datSnStock),
|
|
'qty' => $datSjp[0]['QTY_SJP'],
|
|
'snStockReady' => $snStockReady,
|
|
]);
|
|
}
|
|
|
|
public function PJ_Simpan_Sub1_B2_DataTransaksiStock() {
|
|
$id_so = $this->input->post('id_so');
|
|
$jenis_io = $this->input->post('jenis_io');
|
|
$id_barang = $this->input->post('id_barang');
|
|
$qty_io = $this->input->post('qty_io');
|
|
$ket_io = $this->input->post('ket_io');
|
|
$id_hpar = $this->input->post('id_hpar');
|
|
$ket_io = preg_replace('/\R+/', " " , $ket_io);
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
$now = date('Y-m-d');
|
|
|
|
$value = 0;
|
|
$datSo = $this->Amod->getData_SalesOrder_byID_status0_3($id_so);
|
|
if ($datSo==FALSE) {
|
|
$value = 4;
|
|
} else {
|
|
if ($datSo[0]['GUDANG_SO']==3) {
|
|
$gudang = 10;
|
|
} else {
|
|
$gudang = $datSo[0]['GUDANG_SO'];
|
|
}
|
|
$cekQty = $this->GE_AmbilData_DataKuantiti($id_barang, $gudang);
|
|
if ($cekQty<$qty_io AND $jenis_io==0) {
|
|
$value = 3;
|
|
} else {
|
|
$datIo = $this->Amod->getData_TransaksiStock_bySO_byBARANG_statusNull($id_so, $id_barang);
|
|
if ($datIo==TRUE) {
|
|
$value = 2;
|
|
} else {
|
|
if ($jenis_io==0) {
|
|
$input = [
|
|
'CIPTA_IO' => "Oleh $panggilan pada $timestamp",
|
|
'KARYAWAN_ID' => $id_karyawan,
|
|
'TGL_IO' => $now,
|
|
'SO_ID' => $id_so,
|
|
'BARANG_ID' => $id_barang,
|
|
'QTY_IO' => $qty_io,
|
|
'KET_IO' => $ket_io,
|
|
'JENIS_IO' => $jenis_io,
|
|
'GUDANG_IO' => $datSo[0]['GUDANG_SO'],
|
|
'KODE_BUKTI' => $datSo[0]['KODE_SO'],
|
|
];
|
|
$action = $this->Amod->create('transaksi_stock', $input);
|
|
|
|
$this->GE_Kalkulasi_KuantitiBarang($id_barang, $datSo[0]['GUDANG_SO'], "Step 2 - PENJUALAN - Tambah Barang", 0, $qty_io);
|
|
} else if ($jenis_io==1) {
|
|
$datHpar = $this->Amod->getData_HargaPart_byID($id_hpar);
|
|
$harga_io = $datHpar[0]['HPP_HPAR']/2;
|
|
$input = [
|
|
'CIPTA_IO' => "Oleh $panggilan pada $timestamp",
|
|
'KARYAWAN_ID' => $id_karyawan,
|
|
'TGL_IO' => $now,
|
|
'SO_ID' => $id_so,
|
|
'HPAR_ID' => $id_hpar,
|
|
'BARANG_ID' => $id_barang,
|
|
'HARGA_IO' => $harga_io,
|
|
'QTY_IO' => $qty_io,
|
|
'KET_IO' => $ket_io,
|
|
'JENIS_IO' => $jenis_io,
|
|
'GUDANG_IO' => $datSo[0]['GUDANG_SO'],
|
|
'KODE_BUKTI' => $datSo[0]['KODE_SO'],
|
|
];
|
|
$action = $this->Amod->create('transaksi_stock', $input);
|
|
}
|
|
$value = 1;
|
|
}
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value
|
|
]);
|
|
}
|
|
|
|
public function PJ_Simpan_Sub1_B2_DataDaftarSjParsial() {
|
|
$id_so = $this->input->post('id_so');
|
|
$id_barang = $this->input->post('id_barang');
|
|
$qty_sjp = $this->input->post('qty_sjp');
|
|
|
|
//Check Konsistensi Data
|
|
$value = 0;
|
|
$datSo = $this->Amod->getData_SalesOrder_byID_bySTATUS($id_so, 3);
|
|
if ($datSo==FALSE) {
|
|
$value = 7;
|
|
} else {
|
|
$datSjpNull = $this->Amod->getData_DaftarSjParsial_bySO_byBARANG_CDNull($id_so, $id_barang);
|
|
if ($datSjpNull==TRUE) {
|
|
$value = 6;
|
|
} else {
|
|
$datDo = $this->Amod->getData_DaftarOrder_bySO_byBARANG($id_so, $id_barang);
|
|
$target = $datDo[0]['QTY_DO'];
|
|
|
|
$sumSjp = $this->Amod->getSum_DaftarSjParsial_bySO_byBARANG($id_so, $id_barang);
|
|
if ($sumSjp[0]['QTY']==NULL) {
|
|
$sudah = 0;
|
|
} else {
|
|
$sudah = $sumSjp[0]['QTY'];
|
|
}
|
|
|
|
$sisa = $target-$sudah;
|
|
if ($qty_sjp>$sisa) {
|
|
$value = 5;
|
|
} else {
|
|
if ($datSo[0]['GUDANG_SO']==3) {
|
|
$jenis_gudang = 10;
|
|
} else {
|
|
$jenis_gudang = $datSo[0]['GUDANG_SO'];
|
|
}
|
|
|
|
$qtyReal = $this->GE_AmbilData_DataKuantiti($id_barang, $jenis_gudang);
|
|
if ($qtyReal<$qty_sjp AND $datDo[0]['TYPE_JENIS']!=2) {
|
|
if ($jenis_gudang==10) {
|
|
$value = 4;
|
|
} else if ($jenis_gudang==2) {
|
|
$value = 3;
|
|
} else if ($jenis_gudang==1) {
|
|
$value = 2;
|
|
}
|
|
} else {
|
|
if ($datDo[0]['TYPE_JENIS']==0) {
|
|
$this->GE_Kalkulasi_KuantitiBarang($id_barang, $datSo[0]['GUDANG_SO'], "Step 2 - PENJUALAN - Tambah Barang", 0, $qty_sjp);
|
|
}
|
|
|
|
$input = [
|
|
'SO_ID' => $id_so,
|
|
'DO_ID' => $datDo[0]['ID_DO'],
|
|
'BARANG_ID' => $id_barang,
|
|
'QTY_SJP' => $qty_sjp,
|
|
'NAMA_SJP' => $datDo[0]['NAMA_BARANG'],
|
|
];
|
|
$action = $this->Amod->create('daftar_sjparsial', $input);
|
|
$value = 1;
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value
|
|
]);
|
|
|
|
}
|
|
|
|
public function PJ_Simpan_Sub1_B2_DataSnJual() {
|
|
$id_snstock = $this->input->post('id_snstock');
|
|
$id_do = $this->input->post('id_do');
|
|
$id_so = $this->input->post('id_so');
|
|
|
|
$value = 0;
|
|
$datSo = $this->Amod->getData_SalesOrder_byID_bySTATUS($id_so, 0);
|
|
if ($datSo==FALSE) {
|
|
$value = 7;
|
|
} else {
|
|
$datDo = $this->Amod->getData_DaftarOrder_byID($id_do);
|
|
if ($datDo==FALSE) {
|
|
$value = 6;
|
|
} else {
|
|
if ($datSo[0]['GUDANG_SO']==3) {
|
|
$jenis_kuantiti = 10;
|
|
} else {
|
|
$jenis_kuantiti = $datSo[0]['GUDANG_SO'];
|
|
}
|
|
$qtyBefore = $this->GE_AmbilData_DataKuantiti($datDo[0]['BARANG_ID'], $jenis_kuantiti);
|
|
if ($qtyBefore<=0) {
|
|
$value = 5;
|
|
} else {
|
|
$datSnStock = $this->Amod->getData_SnStock_byID_bySTATUS($id_snstock, 0);
|
|
if ($datSnStock==FALSE) {
|
|
$value = 4;
|
|
} else {
|
|
$countBefore = $this->Amod->getCount_SnJual_byDO($id_do);
|
|
if ($countBefore>=$datDo[0]['QTY_DO']) {
|
|
$value = 3;
|
|
} else {
|
|
$datSnBeli = $this->Amod->getData_SnBeli_byNAMA($datSnStock[0]['NAMA_SNSTOCK']);
|
|
if ($datSnBeli==TRUE) {
|
|
$datDb = $this->Amod->getData_DaftarBeli_byID($datSnBeli[0]['DB_ID']);
|
|
$kop = $datDb[0]['CORP_ID'];
|
|
} else {
|
|
$kop = 0;
|
|
}
|
|
|
|
$input = [
|
|
'NAMA_SNJ' => $datSnStock[0]['NAMA_SNSTOCK'],
|
|
'KOP_SNJ' => $kop,
|
|
'DO_ID' => $id_do,
|
|
];
|
|
$action = $this->Amod->create('sn_jual', $input);
|
|
|
|
$update = [
|
|
'STATUS_SNSTOCK' => '10'
|
|
];
|
|
$action = $this->Amod->update('sn_stock', $update, 'ID_SNSTOCK', $id_snstock);
|
|
|
|
$this->GE_Kalkulasi_KuantitiBarang($datDo[0]['BARANG_ID'], $datSo[0]['GUDANG_SO'], "Step 2 - PENJUALAN - Tambah Barang", 0, 1);
|
|
|
|
$countAfter = $this->Amod->getCount_SnJual_byDO($id_do);
|
|
if ($countAfter==$datDo[0]['QTY_DO']) {
|
|
$value = 2;
|
|
} else {
|
|
$value = 1;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
}
|
|
|
|
public function PJ_Simpan_Sub1_B2_DataSnIo() {
|
|
$id_snstock = $this->input->post('id_snstock');
|
|
$id_io = $this->input->post('id_io');
|
|
$id_so = $this->input->post('id_so');
|
|
|
|
$value = 0;
|
|
$datSo = $this->Amod->getData_SalesOrder_byID_status0_3($id_so);
|
|
if ($datSo==FALSE) {
|
|
$value = 6;
|
|
} else {
|
|
$datIo = $this->Amod->getData_TransaksiStock_byID_statusNull($id_io);
|
|
if ($datIo==FALSE) {
|
|
$value = 5;
|
|
} else {
|
|
$datSnStock = $this->Amod->getData_SnStock_byID_bySTATUS($id_snstock, 0);
|
|
if ($datSnStock==FALSE) {
|
|
$value = 4;
|
|
} else {
|
|
$countBefore = $this->Amod->getCount_SnIo_byIO($id_io);
|
|
if ($countBefore>=$datIo[0]['QTY_IO']) {
|
|
$value = 3;
|
|
} else {
|
|
$input = [
|
|
'NAMA_SNIO' => $datSnStock[0]['NAMA_SNSTOCK'],
|
|
'JENIS_SNIO' => '0',
|
|
'IO_ID' => $id_io,
|
|
];
|
|
$action = $this->Amod->create('sn_io', $input);
|
|
|
|
$update = [
|
|
'STATUS_SNSTOCK' => '10'
|
|
];
|
|
$action = $this->Amod->update('sn_stock', $update, 'ID_SNSTOCK', $id_snstock);
|
|
|
|
$countAfter = $this->Amod->getCount_SnIo_byIO($id_io);
|
|
if ($countAfter==$datIo[0]['QTY_IO']) {
|
|
$value = 2;
|
|
} else {
|
|
$value = 1;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
}
|
|
|
|
public function PJ_Simpan_Sub1_B2_DataSnSjParsial() {
|
|
$id_snstock = $this->input->post('id_snstock');
|
|
$id_sjp = $this->input->post('id_sjp');
|
|
$id_so = $this->input->post('id_so');
|
|
|
|
$value = 0;
|
|
$datSo = $this->Amod->getData_SalesOrder_byID_bySTATUS($id_so, 3);
|
|
if ($datSo==FALSE) {
|
|
$value = 7;
|
|
} else {
|
|
$datSjp = $this->Amod->getData_DaftarSjParsial_byID($id_sjp);
|
|
if ($datSjp==FALSE) {
|
|
$value = 6;
|
|
} else {
|
|
if ($datSo[0]['GUDANG_SO']==3) {
|
|
$jenis_gudang = 10;
|
|
} else {
|
|
$jenis_gudang = $datSo[0]['GUDANG_SO'];
|
|
}
|
|
$qtyBefore = $this->GE_AmbilData_DataKuantiti($datSjp[0]['BARANG_ID'], $jenis_gudang);
|
|
if ($qtyBefore<=0) {
|
|
$value = 5;
|
|
} else {
|
|
$datSnStock = $this->Amod->getData_SnStock_byID_bySTATUS($id_snstock, 0);
|
|
if ($datSnStock==FALSE) {
|
|
$value = 4;
|
|
} else {
|
|
$countBefore = $this->Amod->getCount_SnSjParsial_bySJP($id_sjp);
|
|
if ($countBefore>=$datSjp[0]['QTY_SJP']) {
|
|
$value = 3;
|
|
} else {
|
|
$input = [
|
|
'NAMA_SNSJ' => $datSnStock[0]['NAMA_SNSTOCK'],
|
|
'SJP_ID' => $id_sjp,
|
|
];
|
|
$action = $this->Amod->create('sn_sjparsial', $input);
|
|
|
|
$update = [
|
|
'STATUS_SNSTOCK' => '10'
|
|
];
|
|
$action = $this->Amod->update('sn_stock', $update, 'ID_SNSTOCK', $id_snstock);
|
|
|
|
$this->GE_Kalkulasi_KuantitiBarang($datSjp[0]['BARANG_ID'], $datSo[0]['GUDANG_SO'], "Step 2 - PENJUALAN - Tambah Barang", 0, 1);
|
|
|
|
$countAfter = $this->Amod->getCount_SnSjParsial_bySJP($id_sjp);
|
|
if ($countAfter==$datSjp[0]['QTY_SJP']) {
|
|
$value = 2;
|
|
} else {
|
|
$value = 1;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
}
|
|
|
|
public function PJ_Simpan_Sub1_B2_DataSnjBarcode() {
|
|
$id_snj = $this->input->post('id_snj');
|
|
$id_do = $this->input->post('id_do');
|
|
$id_so = $this->input->post('id_so');
|
|
$nama_snj = $this->input->post('nama_snj');
|
|
$nama_snj = strtoupper($nama_snj);
|
|
|
|
$value = 0;
|
|
$datSo = $this->Amod->getData_SalesOrder_byID_bySTATUS($id_so, 0);
|
|
if ($datSo==FALSE) {
|
|
$value = 12;
|
|
} else {
|
|
$datDo = $this->Amod->getData_DaftarOrder_byID($id_do);
|
|
if ($datDo==FALSE) {
|
|
$value = 11;
|
|
} else {
|
|
if ($datSo[0]['GUDANG_SO']==3) {
|
|
$jenis_kuantiti = 10;
|
|
} else {
|
|
$jenis_kuantiti = $datSo[0]['GUDANG_SO'];
|
|
}
|
|
$qtyBefore = $this->GE_AmbilData_DataKuantiti($datDo[0]['BARANG_ID'], $jenis_kuantiti);
|
|
if ($qtyBefore<=0) {
|
|
$value = 10;
|
|
} else {
|
|
$datSnStock = $this->Amod->getData_SnStock_byNAMA_allStatus($nama_snj);
|
|
if ($datSnStock==FALSE) {
|
|
$value = 9;
|
|
} else {
|
|
if ($datSnStock[0]['STATUS_SNSTOCK']!=0) {
|
|
$value = 8;
|
|
} else {
|
|
if ($datSnStock[0]['BARANG_ID']!=$datDo[0]['BARANG_ID']) {
|
|
$value = 7;
|
|
} else {
|
|
if ($datSo[0]['GUDANG_SO']==3 AND $datSnStock[0]['GUDANG_SNSTOCK']!=3) {
|
|
$value = 6;
|
|
} else if ($datSo[0]['GUDANG_SO']==2 AND $datSnStock[0]['GUDANG_SNSTOCK']!=2) {
|
|
$value = 5;
|
|
} else if ($datSo[0]['GUDANG_SO']==1 AND $datSnStock[0]['GUDANG_SNSTOCK']!=1) {
|
|
$value = 4;
|
|
} else {
|
|
$countBefore = $this->Amod->getCount_SnJual_byDO($id_do);
|
|
if ($countBefore>=$datDo[0]['QTY_DO']) {
|
|
$value = 3;
|
|
} else {
|
|
$datSnBeli = $this->Amod->getData_SnBeli_byNAMA($nama_snj);
|
|
if ($datSnBeli==TRUE) {
|
|
$datDb = $this->Amod->getData_DaftarBeli_byID($datSnBeli[0]['DB_ID']);
|
|
$kop = $datDb[0]['CORP_ID'];
|
|
} else {
|
|
$kop = 0;
|
|
}
|
|
|
|
$input = [
|
|
'NAMA_SNJ' => $nama_snj,
|
|
'KOP_SNJ' => $kop,
|
|
'DO_ID' => $id_do,
|
|
];
|
|
$action = $this->Amod->create('sn_jual', $input);
|
|
|
|
$update = [
|
|
'STATUS_SNSTOCK' => '10'
|
|
];
|
|
$action = $this->Amod->update('sn_stock', $update, 'ID_SNSTOCK', $datSnStock[0]['ID_SNSTOCK']);
|
|
|
|
$this->GE_Kalkulasi_KuantitiBarang($datDo[0]['BARANG_ID'], $datSo[0]['GUDANG_SO'], "Step 2 - PENJUALAN - Tambah Barang", 0, 1);
|
|
|
|
$countAfter = $this->Amod->getCount_SnJual_byDO($id_do);
|
|
if ($countAfter==$datDo[0]['QTY_DO']) {
|
|
$value = 2;
|
|
} else {
|
|
$value = 1;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
}
|
|
|
|
public function PJ_Simpan_Sub1_B2_DataSnio0Barcode() {
|
|
$id_snio = $this->input->post('id_snio');
|
|
$id_io = $this->input->post('id_io');
|
|
$id_so = $this->input->post('id_so');
|
|
$nama_snio = $this->input->post('nama_snio');
|
|
$nama_snio = strtoupper($nama_snio);
|
|
|
|
$value = 0;
|
|
$datSo = $this->Amod->getData_SalesOrder_byID_status0_3($id_so);
|
|
if ($datSo==FALSE) {
|
|
$value = 11;
|
|
} else {
|
|
$datIo = $this->Amod->getData_TransaksiStock_byID_statusNull($id_io);
|
|
if ($datIo==FALSE) {
|
|
$value = 10;
|
|
} else {
|
|
$datSnStock = $this->Amod->getData_SnStock_byNAMA_allStatus($nama_snio);
|
|
if ($datSnStock==FALSE) {
|
|
$value = 9;
|
|
} else {
|
|
if ($datSnStock[0]['STATUS_SNSTOCK']!=0) {
|
|
$value = 8;
|
|
} else {
|
|
if ($datSnStock[0]['BARANG_ID']!=$datIo[0]['BARANG_ID']) {
|
|
$value = 7;
|
|
} else {
|
|
if ($datIo[0]['GUDANG_IO']==3 AND $datSnStock[0]['GUDANG_SNSTOCK']!=3) {
|
|
$value = 6;
|
|
} else if ($datIo[0]['GUDANG_IO']==2 AND $datSnStock[0]['GUDANG_SNSTOCK']!=2) {
|
|
$value = 5;
|
|
} else if ($datIo[0]['GUDANG_IO']==1 AND $datSnStock[0]['GUDANG_SNSTOCK']!=1) {
|
|
$value = 4;
|
|
} else {
|
|
$countBefore = $this->Amod->getCount_SnIo_byIO($id_io);
|
|
if ($countBefore>=$datIo[0]['QTY_IO']) {
|
|
$value = 3;
|
|
} else {
|
|
$input = [
|
|
'NAMA_SNIO' => $nama_snio,
|
|
'JENIS_SNIO' => '0',
|
|
'IO_ID' => $id_io,
|
|
];
|
|
$action = $this->Amod->create('sn_io', $input);
|
|
|
|
$update = [
|
|
'STATUS_SNSTOCK' => '10'
|
|
];
|
|
$action = $this->Amod->update('sn_stock', $update, 'ID_SNSTOCK', $datSnStock[0]['ID_SNSTOCK']);
|
|
|
|
$countAfter = $this->Amod->getCount_SnIo_byIO($id_io);
|
|
if ($countAfter==$datIo[0]['QTY_IO']) {
|
|
$value = 2;
|
|
} else {
|
|
$value = 1;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
}
|
|
|
|
public function PJ_Simpan_Sub1_B2_DataSnio1Barcode() {
|
|
$id_snio = $this->input->post('id_snio');
|
|
$id_io = $this->input->post('id_io');
|
|
$id_so = $this->input->post('id_so');
|
|
$nama_snio = $this->input->post('nama_snio');
|
|
$nama_snio = strtoupper($nama_snio);
|
|
|
|
$value = 0;
|
|
$datSo = $this->Amod->getData_SalesOrder_byID_status0_3($id_so);
|
|
if ($datSo==FALSE) {
|
|
$value = 6;
|
|
} else {
|
|
$datIo = $this->Amod->getData_TransaksiStock_byID_statusNull($id_io);
|
|
if ($datIo==FALSE) {
|
|
$value = 5;
|
|
} else {
|
|
$datSnStock = $this->Amod->getData_SnStock_byNAMA_allStatus($nama_snio);
|
|
if ($datSnStock==TRUE) {
|
|
$value = 4;
|
|
} else {
|
|
$countBefore = $this->Amod->getCount_SnIo_byIO($id_io);
|
|
if ($countBefore>=$datIo[0]['QTY_IO']) {
|
|
$value = 3;
|
|
} else {
|
|
$input = [
|
|
'NAMA_SNIO' => $nama_snio,
|
|
'IO_ID' => $id_io,
|
|
'JENIS_SNIO' => '1'
|
|
];
|
|
$action = $this->Amod->create('sn_io', $input);
|
|
|
|
$input = [
|
|
'NAMA_SNSTOCK' => $nama_snio,
|
|
'KOP_SNSTOCK' => '1',
|
|
'BARANG_ID' => $datIo[0]['BARANG_ID'],
|
|
'GUDANG_SNSTOCK' => $datIo[0]['GUDANG_IO'],
|
|
'STATUS_SNSTOCK' => NULL
|
|
];
|
|
$action = $this->Amod->create('sn_stock', $input);
|
|
|
|
$countAfter = $this->Amod->getCount_SnIo_byIO($id_io);
|
|
if ($countAfter==$datIo[0]['QTY_IO']) {
|
|
$value = 2;
|
|
} else {
|
|
$value = 1;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
}
|
|
|
|
public function PJ_Simpan_Sub1_B2_DataSnsjBarcode() {
|
|
$id_snsj = $this->input->post('id_snsj');
|
|
$id_sjp = $this->input->post('id_sjp');
|
|
$id_so = $this->input->post('id_so');
|
|
$nama_snsj = $this->input->post('nama_snsj');
|
|
$nama_snsj = strtoupper($nama_snsj);
|
|
|
|
$value = 0;
|
|
$datSo = $this->Amod->getData_SalesOrder_byID_bySTATUS($id_so, 3);
|
|
if ($datSo==FALSE) {
|
|
$value = 12;
|
|
} else {
|
|
$datSjp = $this->Amod->getData_DaftarSjParsial_byID($id_sjp);
|
|
if ($datSjp==FALSE) {
|
|
$value = 11;
|
|
} else {
|
|
if ($datSo[0]['GUDANG_SO']==3) {
|
|
$jenis_gudang = 10;
|
|
} else {
|
|
$jenis_gudang = $datSo[0]['GUDANG_SO'];
|
|
}
|
|
$qtyBefore = $this->GE_AmbilData_DataKuantiti($datSjp[0]['BARANG_ID'], $jenis_gudang);
|
|
if ($qtyBefore<=0) {
|
|
$value = 10;
|
|
} else {
|
|
$datSnStock = $this->Amod->getData_SnStock_byNAMA_allStatus($nama_snsj);
|
|
if ($datSnStock==FALSE) {
|
|
$value = 9;
|
|
} else {
|
|
if ($datSnStock[0]['STATUS_SNSTOCK']!=0) {
|
|
$value = 8;
|
|
} else {
|
|
if ($datSnStock[0]['BARANG_ID']!=$datSjp[0]['BARANG_ID']) {
|
|
$value = 7;
|
|
} else {
|
|
if ($datSo[0]['GUDANG_SO']==3 AND $datSnStock[0]['GUDANG_SNSTOCK']!=3) {
|
|
$value = 6;
|
|
} else if ($datSo[0]['GUDANG_SO']==2 AND $datSnStock[0]['GUDANG_SNSTOCK']!=2) {
|
|
$value = 5;
|
|
} else if ($datSo[0]['GUDANG_SO']==1 AND $datSnStock[0]['GUDANG_SNSTOCK']!=1) {
|
|
$value = 4;
|
|
} else {
|
|
$countBefore = $this->Amod->getCount_SnSjParsial_bySJP($id_sjp);
|
|
if ($countBefore>=$datSjp[0]['QTY_SJP']) {
|
|
$value = 3;
|
|
} else {
|
|
$input = [
|
|
'NAMA_SNSJ' => $nama_snsj,
|
|
'SJP_ID' => $id_sjp,
|
|
];
|
|
$action = $this->Amod->create('sn_sjparsial', $input);
|
|
|
|
$update = [
|
|
'STATUS_SNSTOCK' => '10'
|
|
];
|
|
$action = $this->Amod->update('sn_stock', $update, 'ID_SNSTOCK', $datSnStock[0]['ID_SNSTOCK']);
|
|
|
|
$this->GE_Kalkulasi_KuantitiBarang($datSjp[0]['BARANG_ID'], $datSo[0]['GUDANG_SO'], "Step 2 - PENJUALAN - Tambah Barang", 0, 1);
|
|
|
|
$countAfter = $this->Amod->getCount_SnSjParsial_bySJP($id_sjp);
|
|
if ($countAfter==$datSjp[0]['QTY_SJP']) {
|
|
$value = 2;
|
|
} else {
|
|
$value = 1;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
}
|
|
|
|
public function PJ_Hapus_Sub1_B2_DataTransaksiStock() {
|
|
$id_io = $this->input->post('id_io');
|
|
$id_so = $this->input->post('id_so');
|
|
|
|
$value = 0;
|
|
$datSo = $this->Amod->getData_SalesOrder_byID_status0_3($id_so);
|
|
if ($datSo==FALSE) {
|
|
$value = 3;
|
|
} else {
|
|
$datIo = $this->Amod->getData_TransaksiStock_byID_statusNull($id_io);
|
|
if ($datIo==FALSE) {
|
|
$value = 2;
|
|
} else {
|
|
if ($datIo[0]['JENIS_IO']==0) {
|
|
if ($datIo[0]['TYPE_JENIS']==1) {
|
|
$datSnio = $this->Amod->getData_SnIo_byIO($id_io);
|
|
foreach ($datSnio as $key) {
|
|
$datSnstock = $this->Amod->getData_SnStock_byNAMA_bySTATUS($key['NAMA_SNIO'], 10);
|
|
if ($datSnstock==TRUE) {
|
|
$update = [
|
|
'STATUS_SNSTOCK' => '0'
|
|
];
|
|
$action = $this->Amod->update('sn_stock', $update, 'ID_SNSTOCK', $datSnstock[0]['ID_SNSTOCK']);
|
|
}
|
|
}
|
|
$action = $this->Amod->delete('sn_io', $id_io, 'IO_ID');
|
|
}
|
|
|
|
$this->GE_Kalkulasi_KuantitiBarang($datIo[0]['BARANG_ID'], $datIo[0]['GUDANG_IO'], "Step 2 - PENJUALAN - Hapus Barang", 0, $datIo[0]['QTY_IO']);
|
|
} else if ($datIo[0]['JENIS_IO']==1) {
|
|
if ($datIo[0]['TYPE_JENIS']==1) {
|
|
$datSnio = $this->Amod->getData_SnIo_byIO($id_io);
|
|
foreach ($datSnio as $key) {
|
|
$datSnstock = $this->Amod->getData_SnStock_byNAMA_statusNull($key['NAMA_SNIO']);
|
|
if ($datSnstock==TRUE) {
|
|
$action = $this->Amod->delete('sn_stock', $datSnstock[0]['ID_SNSTOCK'], 'ID_SNSTOCK');
|
|
}
|
|
}
|
|
$action = $this->Amod->delete('sn_io', $id_io, 'IO_ID');
|
|
}
|
|
}
|
|
$action = $this->Amod->delete('transaksi_stock', $id_io, 'ID_IO');
|
|
$value = 1;
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value
|
|
]);
|
|
}
|
|
|
|
public function PJ_Hapus_Sub1_B2_DataDaftarSjParsial() {
|
|
$id_sjp = $this->input->post('id_sjp');
|
|
$id_so = $this->input->post('id_so');
|
|
|
|
$value = 0;
|
|
$datSo = $this->Amod->getData_SalesOrder_byID_bySTATUS($id_so, 3);
|
|
if ($datSo==FALSE) {
|
|
$value = 3;
|
|
} else {
|
|
$datSjp = $this->Amod->getData_DaftarSjParsial_byID_CDNull($id_sjp);
|
|
if ($datSjp==FALSE) {
|
|
$value = 2;
|
|
} else {
|
|
if ($datSjp[0]['TYPE_JENIS']==1) {
|
|
$datSnsj = $this->Amod->getData_SnSjParsial_bySJP($id_sjp);
|
|
foreach ($datSnsj as $key) {
|
|
$datSnstock = $this->Amod->getData_SnStock_byNAMA_bySTATUS($key['NAMA_SNSJ'], 10);
|
|
if ($datSnstock==TRUE) {
|
|
$update = [
|
|
'STATUS_SNSTOCK' => '0'
|
|
];
|
|
$action = $this->Amod->update('sn_stock', $update, 'ID_SNSTOCK', $datSnstock[0]['ID_SNSTOCK']);
|
|
|
|
$this->GE_Kalkulasi_KuantitiBarang($datSjp[0]['BARANG_ID'], $datSo[0]['GUDANG_SO'], "Step 2 - PENJUALAN - Hapus Barang", 0, 1);
|
|
}
|
|
}
|
|
$action = $this->Amod->delete('sn_sjparsial', $id_sjp, 'SJP_ID');
|
|
} else if ($datSjp[0]['TYPE_JENIS']==0) {
|
|
$this->GE_Kalkulasi_KuantitiBarang($datSjp[0]['BARANG_ID'], $datSo[0]['GUDANG_SO'], "Step 2 - PENJUALAN - Hapus Barang", 0, $datSjp[0]['QTY_SJP']);
|
|
}
|
|
|
|
$action = $this->Amod->delete('daftar_sjparsial', $id_sjp, 'ID_SJP');
|
|
$value = 1;
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value
|
|
]);
|
|
}
|
|
|
|
public function PJ_Hapus_Sub1_B2_DataSnJual() {
|
|
$id_snj = $this->input->post('id_snj');
|
|
$id_do = $this->input->post('id_do');
|
|
$id_so = $this->input->post('id_so');
|
|
|
|
$value = 0;
|
|
$datSo = $this->Amod->getData_SalesOrder_byID_bySTATUS($id_so, 0);
|
|
if ($datSo==FALSE) {
|
|
$value = 5;
|
|
} else {
|
|
$datDo = $this->Amod->getData_DaftarOrder_byID($id_do);
|
|
if ($datDo==FALSE) {
|
|
$value = 4;
|
|
} else {
|
|
$datSnj = $this->Amod->getData_SnJual_byID_bySTATUS($id_snj, 10);
|
|
if ($datSnj==FALSE) {
|
|
$value = 3;
|
|
} else {
|
|
$countBefore = $this->Amod->getCount_SnJual_byDO($id_do);
|
|
|
|
$update = [
|
|
'STATUS_SNSTOCK' => '0'
|
|
];
|
|
$action = $this->Amod->update('sn_stock', $update, 'ID_SNSTOCK', $datSnj[0]['ID_SNSTOCK']);
|
|
$action = $this->Amod->delete('sn_jual', $id_snj, 'ID_SNJ');
|
|
|
|
$this->GE_Kalkulasi_KuantitiBarang($datDo[0]['BARANG_ID'], $datSo[0]['GUDANG_SO'], "Step 2 - PENJUALAN - Hapus Barang", 0, 1);
|
|
|
|
if ($countBefore==$datDo[0]['QTY_DO']) {
|
|
$value = 2;
|
|
} else {
|
|
$value = 1;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
}
|
|
|
|
public function PJ_Hapus_Sub1_B2_DataSnIo() {
|
|
$id_snio = $this->input->post('id_snio');
|
|
$id_io = $this->input->post('id_io');
|
|
$id_so = $this->input->post('id_so');
|
|
$jenis_io = $this->input->post('jenis_io');
|
|
|
|
$value = 0;
|
|
$datSo = $this->Amod->getData_SalesOrder_byID_status0_3($id_so);
|
|
if ($datSo==FALSE) {
|
|
$value = 5;
|
|
} else {
|
|
$datIo = $this->Amod->getData_TransaksiStock_byID_statusNull($id_io);
|
|
if ($datIo==FALSE) {
|
|
$value = 4;
|
|
} else {
|
|
if ($jenis_io==0) {
|
|
$datSnio = $this->Amod->getData_SnIo_byID_bySTATUS($id_snio, 10);
|
|
if ($datSnio==FALSE) {
|
|
$value = 3;
|
|
} else {
|
|
$countBefore = $this->Amod->getCount_SnIo_byIO($id_io);
|
|
|
|
$update = [
|
|
'STATUS_SNSTOCK' => '0'
|
|
];
|
|
$action = $this->Amod->update('sn_stock', $update, 'ID_SNSTOCK', $datSnio[0]['ID_SNSTOCK']);
|
|
$action = $this->Amod->delete('sn_io', $id_snio, 'ID_SNIO');
|
|
|
|
if ($countBefore==$datIo[0]['QTY_IO']) {
|
|
$value = 2;
|
|
} else {
|
|
$value = 1;
|
|
}
|
|
}
|
|
} else if ($jenis_io==1) {
|
|
$datSnio = $this->Amod->getData_SnIo_byID_statusNull($id_snio);
|
|
if ($datSnio==FALSE) {
|
|
$value = 3;
|
|
} else {
|
|
$countBefore = $this->Amod->getCount_SnIo_byIO($id_io);
|
|
|
|
$action = $this->Amod->delete('sn_stock', $datSnio[0]['ID_SNSTOCK'], 'ID_SNSTOCK');
|
|
$action = $this->Amod->delete('sn_io', $id_snio, 'ID_SNIO');
|
|
|
|
if ($countBefore==$datIo[0]['QTY_IO']) {
|
|
$value = 2;
|
|
} else {
|
|
$value = 1;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
}
|
|
|
|
public function PJ_Hapus_Sub1_B2_DataSnSjParsial() {
|
|
$id_snsj = $this->input->post('id_snsj');
|
|
$id_sjp = $this->input->post('id_sjp');
|
|
$id_so = $this->input->post('id_so');
|
|
|
|
$value = 0;
|
|
$datSo = $this->Amod->getData_SalesOrder_byID_bySTATUS($id_so, 3);
|
|
if ($datSo==FALSE) {
|
|
$value = 5;
|
|
} else {
|
|
$datSjp = $this->Amod->getData_DaftarSjParsial_byID($id_sjp);
|
|
if ($datSjp==FALSE) {
|
|
$value = 4;
|
|
} else {
|
|
$datSnsj = $this->Amod->getData_SnSjParsial_byID_bySTATUS($id_snsj, 10);
|
|
if ($datSnsj==FALSE) {
|
|
$value = 3;
|
|
} else {
|
|
$countBefore = $this->Amod->getCount_SnSjParsial_bySJP($id_sjp);
|
|
|
|
$update = [
|
|
'STATUS_SNSTOCK' => '0'
|
|
];
|
|
$action = $this->Amod->update('sn_stock', $update, 'ID_SNSTOCK', $datSnsj[0]['ID_SNSTOCK']);
|
|
$action = $this->Amod->delete('sn_sjparsial', $id_snsj, 'ID_SNSJ');
|
|
|
|
$this->GE_Kalkulasi_KuantitiBarang($datSjp[0]['BARANG_ID'], $datSo[0]['GUDANG_SO'], "Step 2 - PENJUALAN - Hapus Barang", 0, 1);
|
|
|
|
if ($countBefore==$datSjp[0]['QTY_SJP']) {
|
|
$value = 2;
|
|
} else {
|
|
$value = 1;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
}
|
|
|
|
public function PJ_Proses_Sub1_B2_DataDaftarParsial() {
|
|
$id_so = $this->input->post('id_so');
|
|
$now = date('Y-m-d');
|
|
|
|
$value = 0;
|
|
$datSo = $this->Amod->getData_SalesOrder_byID_bySTATUS($id_so, 3);
|
|
if ($datSo==FALSE) {
|
|
$value = 5;
|
|
} else {
|
|
$datSjp = $this->Amod->getData_DaftarSjParsial_bySO_CDNull($id_so);
|
|
if ($datSjp==FALSE) {
|
|
$value = 4;
|
|
} else {
|
|
$errsn = 0;
|
|
$errqty = 0;
|
|
foreach ($datSjp as $key) {
|
|
if ($key['TYPE_JENIS']==1) {
|
|
$countSnsj = $this->Amod->getCount_SnSjParsial_bySJP($key['ID_SJP']);
|
|
if ($countSnsj!=$key['QTY_SJP']) {
|
|
$errsn++;
|
|
}
|
|
}
|
|
|
|
if ($key['TYPE_JENIS']!=2) {
|
|
$qtyNow = $this->GE_AmbilData_DataKuantiti($key['BARANG_ID'], 3);
|
|
if ($qtyNow<$key['QTY_SJP']) {
|
|
$errqty++;
|
|
}
|
|
}
|
|
}
|
|
|
|
if ($errsn>0) {
|
|
$value = 3;
|
|
} else if ($errqty>0) {
|
|
$value = 2;
|
|
} else {
|
|
$datPenjualan = $this->Amod->getData_Penjualan_bySO($id_so);
|
|
if ($datPenjualan==FALSE) {
|
|
$kode_penjualan = $this->Amod->generate_kodePenjualan();
|
|
$sj_penjualan = $this->Amod->generate_SJPenjualan($datSo[0]['CORP_ID']);
|
|
$inv_penjualan = $this->Amod->generate_INVPenjualan($datSo[0]['CORP_ID']);
|
|
|
|
$input = [
|
|
'SO_ID' => $id_so,
|
|
'KODE_PENJUALAN' => $kode_penjualan,
|
|
'SJ_PENJUALAN' => $sj_penjualan,
|
|
'INV_PENJUALAN' => $inv_penjualan,
|
|
'STATUS_PENJUALAN' => '2'
|
|
];
|
|
$action = $this->Amod->create('penjualan', $input);
|
|
|
|
$id_penjualan = $this->Amod->getMax_ID_Penjualan();
|
|
$id_penjualan = $id_penjualan[0]['ID_PENJUALAN'];
|
|
$kode_bukti = "$sj_penjualan.01";
|
|
} else {
|
|
$id_penjualan = $datPenjualan[0]['ID_PENJUALAN'];
|
|
$sj_penjualan = $datPenjualan[0]['SJ_PENJUALAN'];
|
|
$parsial = $this->Amod->getData_DaftarSjParsial_bySO_CDNotNull_groupCD($id_so);
|
|
$index = count($parsial);
|
|
$index = $index+1;
|
|
if ($index<10) {
|
|
$kode_bukti = "$sj_penjualan.0$index";
|
|
} else {
|
|
$kode_bukti = "$sj_penjualan.$index";
|
|
}
|
|
}
|
|
|
|
$input = [
|
|
'SJ_INV' => '0',
|
|
'KODE_BUKTI' => $kode_bukti,
|
|
'PENJUALAN_ID' => $id_penjualan,
|
|
'TGL_CD' => $now
|
|
];
|
|
$action = $this->Amod->create('cetak_dokumen', $input);
|
|
|
|
$id_cd = $this->Amod->getMax_ID_CetakDokumen();
|
|
$id_cd = $id_cd[0]['ID_CD'];
|
|
|
|
foreach ($datSjp as $key) {
|
|
$update = [
|
|
'CD_ID' => $id_cd
|
|
];
|
|
$action = $this->Amod->update('daftar_sjparsial', $update, 'ID_SJP', $key['ID_SJP']);
|
|
}
|
|
|
|
$value = 1;
|
|
}
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
|
|
}
|
|
|
|
public function PJ_Batal_Sub1_B2_DataDaftarParsial() {
|
|
$id_cd = $this->input->post('id_cd');
|
|
$id_so = $this->input->post('id_so');
|
|
$now = date('Y-m-d');
|
|
|
|
$value = 0;
|
|
$datSo = $this->Amod->getData_SalesOrder_byID_bySTATUS($id_so, 3);
|
|
if ($datSo==FALSE) {
|
|
$value = 4;
|
|
} else {
|
|
$datSjpNull = $this->Amod->getData_DaftarSjParsial_bySO_CDNull($id_so);
|
|
if ($datSjpNull==TRUE) {
|
|
$value = 3;
|
|
} else {
|
|
$datSjp = $this->Amod->getData_DaftarSjParsial_byCD($id_cd);
|
|
if ($datSjp==FALSE) {
|
|
$value = 2;
|
|
} else {
|
|
foreach ($datSjp as $key) {
|
|
if ($key['TYPE_JENIS']!=2) {
|
|
$this->GE_Kalkulasi_KuantitiBarang($key['BARANG_ID'], $datSo[0]['GUDANG_SO'], "Step 2 - PENJUALAN - Hapus Barang", 0, $key['QTY_SJP']);
|
|
}
|
|
|
|
if ($key['TYPE_JENIS']==1) {
|
|
$datSnsj = $this->Amod->getData_SnSjParsial_bySJP($key['ID_SJP']);
|
|
foreach ($datSnsj as $dat) {
|
|
$datSnStock = $this->Amod->getData_SnSjParsial_byID_bySTATUS($dat['ID_SNSJ'], 10);
|
|
if ($datSnStock==TRUE) {
|
|
$update = [
|
|
'STATUS_SNSTOCK' => '0'
|
|
];
|
|
$action = $this->Amod->update('sn_stock', $update, 'ID_SNSTOCK', $datSnStock[0]['ID_SNSTOCK']);
|
|
|
|
$action = $this->Amod->delete('sn_sjparsial', $dat['ID_SNSJ'], 'ID_SNSJ');
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
$action = $this->Amod->delete('cetak_dokumen', $id_cd, 'ID_CD');
|
|
$action = $this->Amod->delete('daftar_sjparsial', $id_cd, 'CD_ID');
|
|
|
|
$countAfter = $this->Amod->getCount_DaftarSjParsial_bySO_groupCD($id_so);
|
|
if ($countAfter==0) {
|
|
$datPenjualan = $this->Amod->getData_Penjualan_bySO($id_so);
|
|
$kode_so = $datSo[0]['KODE_SO'];
|
|
|
|
$update = [
|
|
'SO_ID' => NULL,
|
|
'STATUS_PENJUALAN' => '3',
|
|
'KET_BATAL' => "Batal SJ Parsial untuk $kode_so",
|
|
'TGL_BATAL' => $now
|
|
];
|
|
$action = $this->Amod->update('penjualan', $update, 'ID_PENJUALAN', $datPenjualan[0]['ID_PENJUALAN']);
|
|
}
|
|
|
|
$value = 1;
|
|
}
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
|
|
}
|
|
|
|
public function PJ_Kunci_Sub1_B2_DataSalesOrder() {
|
|
$id_so = $this->input->post('id_solock');
|
|
$transaksi_so = $this->input->post('transaksi_so');
|
|
$id_karyawan = $this->input->post('id_karyawanlock');
|
|
$now = date('Y-m-d');
|
|
$month = date('m');
|
|
$year = date('Y');
|
|
$bulan = $this->Amod->generate_inisialMonth($month);
|
|
$bulan = strtoupper("$bulan $year");
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$karyawan_id = $this->session->userdata('id_karyawan');
|
|
|
|
if ($transaksi_so==1 OR $transaksi_so==2) {
|
|
$datSo = $this->Amod->getData_SalesOrder_byID_bySTATUS($id_so, 0);
|
|
} else if ($transaksi_so==3) {
|
|
$datSo = $this->Amod->getData_SalesOrder_byID_bySTATUS($id_so, 3);
|
|
}
|
|
if ($datSo==FALSE) {
|
|
$this->session->set_flashdata('not_valid', 'error');
|
|
redirect('Menu/PJ_Sub1_ProsesBarang_1');
|
|
}
|
|
|
|
if ($datSo[0]['GUDANG_SO']==3) {
|
|
$jenis_kuantiti = 10;
|
|
} else {
|
|
$jenis_kuantiti = $datSo[0]['GUDANG_SO'];
|
|
}
|
|
|
|
$datDo = $this->Amod->getData_DaftarOrder_bySO($id_so);
|
|
if ($transaksi_so==1 OR $transaksi_so==2) {
|
|
foreach ($datDo as $key) {
|
|
if ($key['TYPE_JENIS']==0) {
|
|
$cekQty = $this->GE_AmbilData_DataKuantiti($key['BARANG_ID'], $jenis_kuantiti);
|
|
if ($cekQty<$key['QTY_DO']) {
|
|
if ($datSo[0]['GUDANG_SO']==1) {
|
|
$this->session->set_flashdata('qty_pcm_less', 'error');
|
|
} else if ($datSo[0]['GUDANG_SO']==2) {
|
|
$this->session->set_flashdata('qty_itp_less', 'error');
|
|
} else if ($datSo[0]['GUDANG_SO']==3) {
|
|
$this->session->set_flashdata('qty_srv_less', 'error');
|
|
}
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
} else if ($key['TYPE_JENIS']==1) {
|
|
$cekQty = $this->GE_AmbilData_DataKuantiti($key['BARANG_ID'], 3);
|
|
if ($cekQty<$key['QTY_DO']) {
|
|
$this->session->set_flashdata('qty_pro_less', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$countSnj = $this->Amod->getCount_SnJual_byDO($key['ID_DO']);
|
|
if ($countSnj<$key['QTY_DO']) {
|
|
$this->session->set_flashdata('sncount_less', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
}
|
|
}
|
|
} else if ($transaksi_so==3) {
|
|
$datSjpNull = $this->Amod->getData_DaftarSjParsial_bySO_CDNull($id_so);
|
|
if ($datSjpNull==TRUE) {
|
|
$this->session->set_flashdata('dataparsial_cdnull', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
foreach ($datDo as $key) {
|
|
$sumSjp = $this->Amod->getSum_DaftarSjParsial_bySO_byDO($id_so, $key['ID_DO']);
|
|
if ($sumSjp[0]['QTY']==NULL) {
|
|
$totSjp = 0;
|
|
} else {
|
|
$totSjp = $sumSjp[0]['QTY'];
|
|
}
|
|
|
|
if ($totSjp!=$key['QTY_DO']) {
|
|
$this->session->set_flashdata('sjparsial_nullready', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
if ($key['TYPE_JENIS']!=2) {
|
|
$cekQty = $this->GE_AmbilData_DataKuantiti($key['BARANG_ID'], 3);
|
|
if ($cekQty<$key['QTY_DO']) {
|
|
$this->session->set_flashdata('qty_pro_less', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
$datIo = $this->Amod->getData_TransaksiStock_bySO_statusNull($id_so);
|
|
foreach ($datIo as $key) {
|
|
if ($key['JENIS_IO']==0) {
|
|
$cekQty = $this->GE_AmbilData_DataKuantiti($key['BARANG_ID'], 3);
|
|
if ($cekQty<$key['QTY_IO']) {
|
|
$this->session->set_flashdata('qty_pro_less', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
}
|
|
|
|
if ($key['TYPE_JENIS']==1) {
|
|
$countSnio = $this->Amod->getCount_SnIo_byIO($key['ID_IO']);
|
|
if ($countSnio<$key['QTY_IO']) {
|
|
$this->session->set_flashdata('sncount_less', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
}
|
|
}
|
|
|
|
foreach ($id_karyawan as $key) {
|
|
$input = [
|
|
'KARYAWAN_ID' => $key,
|
|
'SO_ID' => $id_so,
|
|
'TGL_QC' => $now
|
|
];
|
|
$action = $this->Amod->create('quality_control', $input);
|
|
}
|
|
|
|
//Pemisahan Antara Transaksi Siap Kirim dan Ambil Langsung
|
|
if ($transaksi_so==1) {
|
|
foreach ($datDo as $key) {
|
|
if ($key['TYPE_JENIS']==0) {
|
|
$this->GE_Kalkulasi_KuantitiBarang($key['BARANG_ID'], $datSo[0]['GUDANG_SO'], "Step 2 - PENJUALAN - Tambah Barang", 0, $key['QTY_DO']);
|
|
}
|
|
}
|
|
|
|
$update = [
|
|
'STATUS_SO' => '4',
|
|
'SIAP_SO' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('sales_order', $update, 'ID_SO', $id_so);
|
|
} else if ($transaksi_so==2 OR $transaksi_so==3) {
|
|
$datPelanggan = $this->Amod->getData_Pelanggan_byID($datSo[0]['PELANGGAN_ID']);
|
|
$tempo_penjualan = $this->Amod->generate_addDay($now, $datPelanggan[0]['TOP_PELANGGAN']);
|
|
|
|
if ($transaksi_so==2) {
|
|
$kode_penjualan = $this->Amod->generate_kodePenjualan();
|
|
$sj_penjualan = $this->Amod->generate_SJPenjualan($datSo[0]['CORP_ID']);
|
|
$inv_penjualan = $this->Amod->generate_INVPenjualan($datSo[0]['CORP_ID']);
|
|
$ket_pda = "No Nota : $inv_penjualan";
|
|
|
|
if ($datSo[0]['CORP_ID']==3 OR $datSo[0]['CORP_ID']==5) {
|
|
$input = [
|
|
'SO_ID' => $id_so,
|
|
'TGL_PENJUALAN' => $now,
|
|
'KODE_PENJUALAN' => $kode_penjualan,
|
|
'SJ_PENJUALAN' => $sj_penjualan,
|
|
'INV_PENJUALAN' => $inv_penjualan,
|
|
'TEMPO_PENJUALAN' => $tempo_penjualan,
|
|
'TT_PENJUALAN' => $now,
|
|
'FP_PENJUALAN' => "00000000000000000",
|
|
'KET_PENJUALAN' => $ket_pda,
|
|
'KOP_ID' => $datSo[0]['CORP_ID'],
|
|
'PEL_ID' => $datSo[0]['PELANGGAN_ID'],
|
|
'STATUS_PENJUALAN' => '1'
|
|
];
|
|
} else {
|
|
$input = [
|
|
'SO_ID' => $id_so,
|
|
'TGL_PENJUALAN' => $now,
|
|
'KODE_PENJUALAN' => $kode_penjualan,
|
|
'SJ_PENJUALAN' => $sj_penjualan,
|
|
'INV_PENJUALAN' => $inv_penjualan,
|
|
'TEMPO_PENJUALAN' => $tempo_penjualan,
|
|
'KET_PENJUALAN' => $ket_pda,
|
|
'KOP_ID' => $datSo[0]['CORP_ID'],
|
|
'PEL_ID' => $datSo[0]['PELANGGAN_ID'],
|
|
'STATUS_PENJUALAN' => '1'
|
|
];
|
|
}
|
|
$action = $this->Amod->create('penjualan', $input);
|
|
|
|
$id_penjualan = $this->Amod->getMax_ID_Penjualan();
|
|
$id_penjualan = $id_penjualan[0]['ID_PENJUALAN'];
|
|
} else if ($transaksi_so==3) {
|
|
$datPenjualan = $this->Amod->getData_Penjualan_bySO($id_so);
|
|
$id_penjualan = $datPenjualan[0]['ID_PENJUALAN'];
|
|
$kode_penjualan = $datPenjualan[0]['KODE_PENJUALAN'];
|
|
$sj_penjualan = $datPenjualan[0]['SJ_PENJUALAN'];
|
|
$inv_penjualan = $datPenjualan[0]['INV_PENJUALAN'];
|
|
$ket_pda = "No Nota : $inv_penjualan";
|
|
|
|
if ($datSo[0]['CORP_ID']==3 OR $datSo[0]['CORP_ID']==5) {
|
|
$update = [
|
|
'PEL_ID' => $datSo[0]['PELANGGAN_ID'],
|
|
'KOP_ID' => $datSo[0]['CORP_ID'],
|
|
'TGL_PENJUALAN' => $now,
|
|
'TT_PENJUALAN' => $now,
|
|
'FP_PENJUALAN' => "00000000000000000",
|
|
'TEMPO_PENJUALAN' => $tempo_penjualan,
|
|
'KET_PENJUALAN' => $ket_pda,
|
|
'STATUS_PENJUALAN' => '1'
|
|
];
|
|
} else {
|
|
$update = [
|
|
'PEL_ID' => $datSo[0]['PELANGGAN_ID'],
|
|
'KOP_ID' => $datSo[0]['CORP_ID'],
|
|
'TGL_PENJUALAN' => $now,
|
|
'TEMPO_PENJUALAN' => $tempo_penjualan,
|
|
'KET_PENJUALAN' => $ket_pda,
|
|
'STATUS_PENJUALAN' => '1'
|
|
];
|
|
}
|
|
$action = $this->Amod->update('penjualan', $update, 'ID_PENJUALAN', $id_penjualan);
|
|
}
|
|
|
|
$input = [
|
|
'SJ_INV' => '0',
|
|
'TGL_CD' => $now,
|
|
'KODE_BUKTI' => $sj_penjualan,
|
|
'PENJUALAN_ID' => $id_penjualan
|
|
];
|
|
$action = $this->Amod->create('cetak_dokumen', $input);
|
|
|
|
$input = [
|
|
'SJ_INV' => '1',
|
|
'TGL_CD' => $now,
|
|
'KODE_BUKTI' => $inv_penjualan,
|
|
'PENJUALAN_ID' => $id_penjualan
|
|
];
|
|
$action = $this->Amod->create('cetak_dokumen', $input);
|
|
|
|
$sumSo = $this->Amod->getSum_DaftarOrder_bySO($id_so);
|
|
$dpp = $sumSo[0]['TOTAL'];
|
|
$pajak_keluaran = round(($dpp*($datSo[0]['PPN_SO']/100)),2);
|
|
$debet_dak = round(($dpp+$pajak_keluaran),2);
|
|
|
|
if ($debet_dak==0) {
|
|
$input = [
|
|
'PENJUALAN_ID' => $id_penjualan,
|
|
'PELANGGAN_ID' => $datSo[0]['PELANGGAN_ID'],
|
|
'CORP_ID' => $datSo[0]['CORP_ID'],
|
|
'DEBET_HHPDA' => $debet_dak,
|
|
'KREDIT_HHPDA' => '0',
|
|
'STATUS_HHPDA' => '1',
|
|
'LAST_HHPDA' => $timestamp,
|
|
'TGLLOCK_HHPDA' => $now,
|
|
'LUNAS_HHPDA' => $kode_penjualan,
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungpda', $input);
|
|
} else {
|
|
$input = [
|
|
'PENJUALAN_ID' => $id_penjualan,
|
|
'PELANGGAN_ID' => $datSo[0]['PELANGGAN_ID'],
|
|
'CORP_ID' => $datSo[0]['CORP_ID'],
|
|
'DEBET_HHPDA' => $debet_dak,
|
|
'KREDIT_HHPDA' => '0',
|
|
'STATUS_HHPDA' => '0',
|
|
'LAST_HHPDA' => $timestamp,
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungpda', $input);
|
|
}
|
|
|
|
$input = [
|
|
'CIPTA_AKUNTANSI' => "Oleh $panggilan pada $timestamp",
|
|
'TGL_AKUNTANSI' => $now,
|
|
'KODE_AKUNTANSI' => $kode_penjualan,
|
|
'STATUS_AKUNTANSI' => '1',
|
|
];
|
|
$action = $this->Amod->create('akuntansi', $input);
|
|
|
|
$id_akuntansi = $this->Amod->getMax_ID_Akuntansi();
|
|
$id_akuntansi = $id_akuntansi[0]['ID_AKUNTANSI'];
|
|
|
|
$input = [
|
|
'AKUNTANSI_ID' => $id_akuntansi,
|
|
'PERKIRAAN_ID' => '3',
|
|
'JENIS_PDA' => '0',
|
|
'CIPTA_DAK' => "Oleh $panggilan pada $timestamp",
|
|
'JENIS_DAK' => '0',
|
|
'DEBET_DAK' => $debet_dak,
|
|
'KREDIT_DAK' => '0',
|
|
'KET_DAK' => $ket_pda,
|
|
'PELANGGAN_ID' => $datSo[0]['PELANGGAN_ID'],
|
|
'PENJUALAN_ID' => $id_penjualan
|
|
];
|
|
$action = $this->Amod->create('daftar_akuntansi', $input);
|
|
|
|
$input = [
|
|
'AKUNTANSI_ID' => $id_akuntansi,
|
|
'PERKIRAAN_ID' => '23',
|
|
'CIPTA_DAK' => "Oleh $panggilan pada $timestamp",
|
|
'JENIS_DAK' => '0',
|
|
'DEBET_DAK' => '0',
|
|
'KREDIT_DAK' => $dpp,
|
|
'KET_DAK' => $ket_pda,
|
|
'PELANGGAN_ID' => $datSo[0]['PELANGGAN_ID'],
|
|
'PENJUALAN_ID' => $id_penjualan
|
|
];
|
|
$action = $this->Amod->create('daftar_akuntansi', $input);
|
|
|
|
if ($datSo[0]['PPN_SO']>0) {
|
|
$input = [
|
|
'AKUNTANSI_ID' => $id_akuntansi,
|
|
'PERKIRAAN_ID' => '83',
|
|
'CIPTA_DAK' => "Oleh $panggilan pada $timestamp",
|
|
'JENIS_DAK' => '0',
|
|
'DEBET_DAK' => '0',
|
|
'KREDIT_DAK' => $pajak_keluaran,
|
|
'KET_DAK' => "Pajak Keluaran Kode : [$kode_penjualan]",
|
|
'PELANGGAN_ID' => $datSo[0]['PELANGGAN_ID'],
|
|
'PENJUALAN_ID' => $id_penjualan
|
|
];
|
|
$action = $this->Amod->create('daftar_akuntansi', $input);
|
|
}
|
|
|
|
if ($datSo[0]['FEE_SO']>0) {
|
|
$input = [
|
|
'PENJUALAN_ID' => $id_penjualan,
|
|
'PEL_ID' => $datSo[0]['PELANGGAN_ID'],
|
|
'DEBET_HHBFE' => '0',
|
|
'KREDIT_HHBFE' => $datSo[0]['FEE_SO'],
|
|
'STATUS_HHBFE' => '0',
|
|
'LAST_HHBFE' => $timestamp
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungbfe', $input);
|
|
}
|
|
|
|
if ($transaksi_so==2) {
|
|
$tgl_ket = date('d/m/Y');
|
|
$ket_so_a = "Sudah diproses oleh $panggilan Tanggal $tgl_ket";
|
|
|
|
$update = [
|
|
'STATUS_SO' => '1',
|
|
'TGL_SO' => $now,
|
|
'NILAI_SO' => $debet_dak,
|
|
'SIAP_SO' => "Oleh $panggilan pada $timestamp",
|
|
'KUNCI_SO' => "Oleh $panggilan pada $timestamp",
|
|
'TERKIRIM_SO' => "Oleh $panggilan pada $timestamp",
|
|
'TGL_KIRIM' => $now,
|
|
'KET_SO_A' => $ket_so_a,
|
|
];
|
|
$action = $this->Amod->update('sales_order', $update, 'ID_SO', $id_so);
|
|
|
|
$input = [
|
|
'KARYAWAN_ID' => $karyawan_id,
|
|
'SO_ID' => $id_so
|
|
];
|
|
$action = $this->Amod->create('jadwal_pengiriman', $input);
|
|
} else if ($transaksi_so==3) {
|
|
$update = [
|
|
'STATUS_SO' => '1',
|
|
'TGL_SO' => $now,
|
|
'NILAI_SO' => $debet_dak,
|
|
'SIAP_SO' => "Oleh $panggilan pada $timestamp",
|
|
'KUNCI_SO' => "Oleh $panggilan pada $timestamp",
|
|
'KET_SO_A' => NULL
|
|
];
|
|
$action = $this->Amod->update('sales_order', $update, 'ID_SO', $id_so);
|
|
}
|
|
|
|
foreach ($datDo as $key) {
|
|
if ($key['TYPE_JENIS']==1) {
|
|
if ($transaksi_so==3) {
|
|
$datSnsj = $this->Amod->getData_SnSjParsial_byDO($key['ID_DO']);
|
|
foreach ($datSnsj as $mon) {
|
|
$datSnBeli = $this->Amod->getData_SnBeli_byNAMA($mon['NAMA_SNSJ']);
|
|
if ($datSnBeli==TRUE) {
|
|
$datDb = $this->Amod->getData_DaftarBeli_byID($datSnBeli[0]['DB_ID']);
|
|
$kop = $datDb[0]['CORP_ID'];
|
|
} else {
|
|
$kop = 0;
|
|
}
|
|
|
|
$input = [
|
|
'DO_ID' => $key['ID_DO'],
|
|
'NAMA_SNJ' => $mon['NAMA_SNSJ'],
|
|
'KOP_SNJ' => $kop
|
|
];
|
|
$action = $this->Amod->create('sn_jual', $input);
|
|
}
|
|
}
|
|
|
|
$datStgas = $this->Amod->getData_SetToggleAs_byMERK_byPRODUK_bySTATUS($key['MERK_ID'], $key['PRODUK_ID'], 1);
|
|
if ($datStgas==TRUE) {
|
|
$nama_pkpr = "[AUTO SELLOUT] $bulan";
|
|
$datPkpr = $this->Amod->getData_PotonganKlaimProgram_byNAMA($nama_pkpr);
|
|
if ($datPkpr==TRUE) {
|
|
$id_pkpr = $datPkpr[0]['ID_PKPR'];
|
|
} else {
|
|
$input = [
|
|
'NAMA_PKPR' => $nama_pkpr
|
|
];
|
|
$action = $this->Amod->create('potongan_klaimprogram', $input);
|
|
|
|
$id_pkpr = $this->Amod->getMax_ID_PotonganKlaimProgram();
|
|
$id_pkpr = $id_pkpr[0]['ID_PKPR'];
|
|
}
|
|
}
|
|
|
|
$datPc = $this->Amod->getData_PromoClearance_byBARANG_bySTATUS($key['BARANG_ID'], 1);
|
|
$clearSp = 0;
|
|
if ($datPc==TRUE) {
|
|
$clearSp = 1;
|
|
$datStpcPel = $this->Amod->getData_SetPelangganClearance_byPELANGGAN($datSo[0]['PELANGGAN_ID']);
|
|
$datStpcSal = $this->Amod->getData_SetPelangganClearance_bySALES($datSo[0]['SALES_ID']);
|
|
if ($datStpcPel==FALSE) {
|
|
if ($datStpcSal==TRUE) {
|
|
$status_dpc = 2;
|
|
} else {
|
|
$status_dpc = 0;
|
|
}
|
|
$input = [
|
|
'PC_ID' => $datPc[0]['ID_PC'],
|
|
'STATUS_DPC' => $status_dpc,
|
|
'PENJUALAN_ID' => $id_penjualan
|
|
];
|
|
$action = $this->Amod->create('daftar_promoclearance', $input);
|
|
}
|
|
}
|
|
|
|
$datSnj = $this->Amod->getData_SnJual_byDO($key['ID_DO']);
|
|
foreach ($datSnj as $dat) {
|
|
$datSnStock = $this->Amod->getData_SnStock_byNAMA_bySTATUS($dat['NAMA_SNJ'], 10);
|
|
if ($datSnStock==TRUE) {
|
|
$input = [
|
|
'TGL_HSN' => $now,
|
|
'KODE_BUKTI' => $kode_penjualan,
|
|
'SJ_HSN' => $sj_penjualan,
|
|
'INV_HSN' => $inv_penjualan,
|
|
'SNSTOCK_ID' => $datSnStock[0]['ID_SNSTOCK'],
|
|
'PELANGGAN_ID' => $datSo[0]['PELANGGAN_ID'],
|
|
];
|
|
$action = $this->Amod->create('histori_sn', $input);
|
|
|
|
$update = [
|
|
'STATUS_SNSTOCK' => '1'
|
|
];
|
|
$action = $this->Amod->update('sn_stock', $update, 'ID_SNSTOCK', $datSnStock[0]['ID_SNSTOCK']);
|
|
|
|
if ($datStgas==TRUE) {
|
|
$cekBarang = $this->Amod->getData_DaftarOtomasiBooster_byBARANG_bySTATUS_byLIMIT($key['BARANG_ID'], 1, $now);
|
|
if ($cekBarang==FALSE) {
|
|
$datSnkpr = $this->Amod->getData_SnKlaimProgram_bySNSTOCK($datSnStock[0]['ID_SNSTOCK']);
|
|
if ($datSnkpr==TRUE) {
|
|
$input = [
|
|
'CIPTA_LKPR' => "Oleh Sistem pada $timestamp",
|
|
'TGL_LKPR' => $now,
|
|
'PROGRAM_ID' => '1',
|
|
'SNKPR_ID' => $datSnkpr[0]['ID_SNKPR'],
|
|
'PKPR_ID' => $id_pkpr,
|
|
'NILAI_LKPR' => '0'
|
|
];
|
|
$action = $this->Amod->create('link_klaimprogram', $input);
|
|
|
|
$id_lkpr = $this->Amod->getMax_ID_LinkKlaimProgram();
|
|
$id_lkpr = $id_lkpr[0]['ID_LKPR'];
|
|
|
|
$input = [
|
|
'STGAS_ID' => $datStgas[0]['ID_STGAS'],
|
|
'LKPR_ID' => $id_lkpr,
|
|
'TIMESTAMP' => $timestamp
|
|
];
|
|
$action = $this->Amod->create('histori_otomasisellout', $input);
|
|
|
|
$update = [
|
|
'STATUS_SNKPR' => '1'
|
|
];
|
|
$action = $this->Amod->update('sn_klaimprogram', $update, 'ID_SNKPR', $datSnkpr[0]['ID_SNKPR']);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
$this->GE_Kalkulasi_KuantitiBarang($key['BARANG_ID'], $datSo[0]['GUDANG_SO'], "Step 2 - PENJUALAN - Kunci Barang", $key['TYPE_JENIS'], $key['QTY_DO']);
|
|
} else if ($key['TYPE_JENIS']==0) {
|
|
if ($transaksi_so==2) {
|
|
$this->GE_Kalkulasi_KuantitiBarang($key['BARANG_ID'], $datSo[0]['GUDANG_SO'], "Step 2 - PENJUALAN - Kunci Barang", $key['TYPE_JENIS'], $key['QTY_DO']);
|
|
} else if ($transaksi_so==3) {
|
|
$this->GE_Kalkulasi_KuantitiBarang($key['BARANG_ID'], $datSo[0]['GUDANG_SO'], "Step 2 - PENJUALAN - Kunci Barang", 1, $key['QTY_DO']);
|
|
}
|
|
}
|
|
|
|
if ($key['TYPE_JENIS']!=2) {
|
|
$this->GE_Kalkulasi_HistoriKuantiti($key['BARANG_ID'], "Step 2 - PENJUALAN - Kunci Barang", 0, $key['QTY_DO'], $kode_penjualan, 0, 0);
|
|
}
|
|
|
|
if ($datPelanggan[0]['TYPE_PELANGGAN']=="1") {
|
|
$komisi_do = $key['KOMISI_DEALER'];
|
|
} else {
|
|
$komisi_do = $key['KOMISI_USER'];
|
|
}
|
|
|
|
$datSsp = $this->Amod->getData_SetSalesProduk_byMERK_byPRODUK($key['MERK_ID'], $key['PRODUK_ID']);
|
|
if ($datSsp==FALSE) {
|
|
$sp_do = NULL;
|
|
} else {
|
|
if ($datSsp[0]['SALES_ID']==NULL) {
|
|
$sp_do = NULL;
|
|
} else {
|
|
$datSales = $this->Amod->getData_Karyawan_byID($datSsp[0]['SALES_ID']);
|
|
$sp_do = $datSales[0]['NAMA_PANGGILAN_KARYAWAN'];
|
|
}
|
|
}
|
|
|
|
if ($clearSp==1) {
|
|
$sp_do = NULL;
|
|
}
|
|
|
|
$update = [
|
|
'NAMA_DO' => $key['NAMA_BARANG'],
|
|
'KOMISI_DO' => $komisi_do,
|
|
'SP_DO' => $sp_do,
|
|
];
|
|
$action = $this->Amod->update('daftar_order', $update, 'ID_DO', $key['ID_DO']);
|
|
}
|
|
|
|
foreach ($datIo as $key) {
|
|
if ($key['JENIS_IO']==0) {
|
|
if ($key['TYPE_JENIS']==1) {
|
|
$datSnIo = $this->Amod->getData_SnIo_byIO($key['ID_IO']);
|
|
foreach ($datSnIo as $dat) {
|
|
$datSnStock = $this->Amod->getData_SnStock_byNAMA_bySTATUS($dat['NAMA_SNIO'], 10);
|
|
if ($datSnStock==TRUE) {
|
|
$input = [
|
|
'TGL_HSN' => $now,
|
|
'KODE_BUKTI' => $kode_penjualan,
|
|
'SJ_HSN' => $sj_penjualan,
|
|
'INV_HSN' => $inv_penjualan,
|
|
'PELANGGAN_ID' => $datSo[0]['PELANGGAN_ID'],
|
|
'SNSTOCK_ID' => $datSnStock[0]['ID_SNSTOCK']
|
|
];
|
|
$action = $this->Amod->create('histori_sn', $input);
|
|
|
|
$update = [
|
|
'STATUS_SNSTOCK' => '1'
|
|
];
|
|
$action = $this->Amod->update('sn_stock', $update, 'ID_SNSTOCK', $datSnStock[0]['ID_SNSTOCK']);
|
|
}
|
|
}
|
|
}
|
|
|
|
if ($key['TYPE_JENIS']!=2) {
|
|
$this->GE_Kalkulasi_KuantitiBarang($key['BARANG_ID'], $datSo[0]['GUDANG_SO'], "Step 2 - PENJUALAN - Kunci Barang", 1, $key['QTY_IO']);
|
|
$this->GE_Kalkulasi_HistoriKuantiti($key['BARANG_ID'], "Step 2 - PENJUALAN - Kunci Barang", $key['JENIS_IO'], $key['QTY_IO'], $kode_penjualan, 0, 0);
|
|
|
|
$update = [
|
|
'STATUS_IO' => '1',
|
|
'JIO_ID' => '2',
|
|
'PROSES_IO' => "Oleh $panggilan pada $timestamp",
|
|
'KODE_BUKTI' => $kode_penjualan
|
|
];
|
|
$action = $this->Amod->update('transaksi_stock', $update, 'ID_IO', $key['ID_IO']);
|
|
}
|
|
} else if ($key['JENIS_IO']==1) {
|
|
if ($key['TYPE_JENIS']==1) {
|
|
$datSnIo = $this->Amod->getData_SnIo_byIO($key['ID_IO']);
|
|
foreach ($datSnIo as $dat) {
|
|
$datSnStock = $this->Amod->getData_SnStock_byNAMA_statusNull($dat['NAMA_SNIO']);
|
|
if ($datSnStock==TRUE) {
|
|
$input = [
|
|
'TGL_HSN' => $now,
|
|
'KODE_BUKTI' => $datSo[0]['KODE_SO'],
|
|
'SNSTOCK_ID' => $datSnStock[0]['ID_SNSTOCK']
|
|
];
|
|
$action = $this->Amod->create('histori_sn', $input);
|
|
|
|
$update = [
|
|
'STATUS_SNSTOCK' => '0'
|
|
];
|
|
$action = $this->Amod->update('sn_stock', $update, 'ID_SNSTOCK', $datSnStock[0]['ID_SNSTOCK']);
|
|
}
|
|
}
|
|
}
|
|
|
|
if ($key['TYPE_JENIS']!=2) {
|
|
$this->GE_Kalkulasi_KuantitiBarang($key['BARANG_ID'], $datSo[0]['GUDANG_SO'], "Step 2 - PENJUALAN - Kunci Barang", 2, $key['QTY_IO']);
|
|
$this->GE_Kalkulasi_HistoriKuantiti($key['BARANG_ID'], "Step 2 - PENJUALAN - Kunci Barang", $key['JENIS_IO'], $key['QTY_IO'], $kode_penjualan, 0, $key['ID_IO']);
|
|
|
|
$update = [
|
|
'STATUS_IO' => '1',
|
|
'JIO_ID' => '2',
|
|
'PROSES_IO' => "Oleh $panggilan pada $timestamp",
|
|
'KODE_BUKTI' => $kode_penjualan
|
|
];
|
|
$action = $this->Amod->update('transaksi_stock', $update, 'ID_IO', $key['ID_IO']);
|
|
}
|
|
}
|
|
}
|
|
|
|
$this->GE_Kalkulasi_HistoriOtomasiBooster($id_penjualan);
|
|
}
|
|
|
|
if ($action) {
|
|
$this->session->set_flashdata('data_lock', 'dikunci');
|
|
redirect('Menu/PJ_Sub1_ProsesBarang_1');
|
|
} else {
|
|
$this->session->set_flashdata('failed', 'dikunci');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
}
|
|
|
|
//SUBMENU TRANSAKSI - PENJADWALAN
|
|
public function PJ_Sub1_Penjadwalan_1() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$now = date('Y-m-d');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "PJ", "TRANSAKSI - Penjadwalan");
|
|
$id_menu = $datShm[0]['MENU_ID'];
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$soSiap = $this->Amod->getData_SalesOrder_status1_tglKirimNull();
|
|
$no = 0;
|
|
foreach ($soSiap as $key) {
|
|
$datDo = $this->Amod->getData_DaftarOrder_bySO($key['ID_SO']);
|
|
$datQc = $this->Amod->getData_QualityControl_bySO($key['ID_SO']);
|
|
|
|
$soSiap[$no] += ['DATDO' => $datDo];
|
|
$soSiap[$no++] += ['QC' => $datQc];
|
|
}
|
|
|
|
$soHariIni = $this->Amod->getData_JadwalPengiriman_tglKirimNow();
|
|
$no = 0;
|
|
foreach ($soHariIni as $key) {
|
|
$datDo = $this->Amod->getData_DaftarOrder_bySO($key['ID_SO']);
|
|
$datJp = $this->Amod->getData_JadwalPengiriman_bySO($key['ID_SO']);
|
|
|
|
$soHariIni[$no] += ['DATDO' => $datDo];
|
|
$soHariIni[$no++] += ['JP' => $datJp];
|
|
}
|
|
|
|
$soSudah = $this->Amod->getData_SalesOrder_status1_tglKirimNotNull_yearNow();
|
|
$datKaryawan = $this->Amod->getData_Karyawan_Penjadwalan();
|
|
|
|
$datStpos = $this->Amod->getData_SetTogglePosisi_byKARYAWAN_byMENU($id_karyawan, $id_menu);
|
|
if ($datStpos==FALSE) { $posisiToggle = 0; } else { $posisiToggle = $datStpos[0]['AKTIF_STPOS']; }
|
|
|
|
$data = array(
|
|
'sidebar' => "menu penjualan",
|
|
'navChild' => "penjualan penjadwalan",
|
|
'soSiap' => $soSiap,
|
|
'soHariIni' => $soHariIni,
|
|
'soSudah' => $soSudah,
|
|
'countSiap' => count($soSiap),
|
|
'countHariIni' => count($soHariIni),
|
|
'countSudah' => count($soSudah),
|
|
'karyawan' => $datKaryawan,
|
|
'posisiToggle' => $posisiToggle,
|
|
'id_menu' => $id_menu,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil,
|
|
'tgl' => $now,
|
|
);
|
|
$this->load->view('proses/PJ_Sub1_Penjadwalan_1', $data);
|
|
}
|
|
|
|
public function PJ_Tambah_Sub1_C1_DataJadwalPengiriman() {
|
|
$tgl_kirim = $this->input->post('tgl_kirimnew');
|
|
$karyawanjp = $this->input->post('karyawanjp');
|
|
$sojp = $this->input->post('sojp');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
foreach ($sojp as $key) {
|
|
$datSo = $this->Amod->getData_SalesOrder_byID_bySTATUS($key, 1);
|
|
if ($datSo==FALSE OR $datSo[0]['TGL_KIRIM']!=NULL) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
}
|
|
|
|
foreach ($sojp as $key) {
|
|
foreach ($karyawanjp as $dat) {
|
|
$input = [
|
|
'SO_ID' => $key,
|
|
'KARYAWAN_ID' => $dat,
|
|
];
|
|
$action = $this->Amod->create('jadwal_pengiriman', $input);
|
|
}
|
|
|
|
$update = [
|
|
'TGL_KIRIM' => $tgl_kirim,
|
|
'TERKIRIM_SO' => "Oleh $panggilan pada $timestamp",
|
|
];
|
|
$action = $this->Amod->update('sales_order', $update, 'ID_SO', $key);
|
|
}
|
|
|
|
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 PJ_Revisi_Sub1_C1_DataJadwalPengiriman() {
|
|
$id_so = $this->input->post('id_sorev');
|
|
|
|
$datSo = $this->Amod->getData_SalesOrder_byID_bySTATUS($id_so, 1);
|
|
if ($datSo==FALSE OR $datSo[0]['TGL_KIRIM']==NULL) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$update = [
|
|
'KET_SO_A' => NULL,
|
|
'TGL_KIRIM' => NULL,
|
|
'TERKIRIM_SO' => NULL,
|
|
];
|
|
$action = $this->Amod->update('sales_order', $update, 'ID_SO', $id_so);
|
|
|
|
$action = $this->Amod->delete('jadwal_pengiriman', $id_so, 'SO_ID');
|
|
|
|
if ($action) {
|
|
$this->session->set_flashdata('success', 'direvisi');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
} else {
|
|
$this->session->set_flashdata('failed', 'direvisi');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
}
|
|
|
|
public function PJ_Ulang_Sub1_C1_DataJadwalPengiriman() {
|
|
$sojp = $this->input->post('sojpul');
|
|
|
|
foreach ($sojp as $key) {
|
|
$datSo = $this->Amod->getData_SalesOrder_byID_bySTATUS($key, 1);
|
|
if ($datSo==FALSE OR $datSo[0]['TGL_KIRIM']==NULL) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
}
|
|
|
|
foreach ($sojp as $key) {
|
|
$update = [
|
|
'KET_SO_A' => NULL,
|
|
'TGL_KIRIM' => NULL,
|
|
'TERKIRIM_SO' => NULL,
|
|
];
|
|
$action = $this->Amod->update('sales_order', $update, 'ID_SO', $key);
|
|
|
|
$action = $this->Amod->delete('jadwal_pengiriman', $key, 'SO_ID');
|
|
}
|
|
|
|
if ($action) {
|
|
$this->session->set_flashdata('success', 'dikirim ulang');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
} else {
|
|
$this->session->set_flashdata('failed', 'dikirim ulang');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
}
|
|
|
|
//SUBMENU TRANSAKSI - RETUR PENJUALAN
|
|
public function PJ_Sub1_ReturPenjualan_1() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$now = date('Y-m-d');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "PJ", "TRANSAKSI - Retur Penjualan");
|
|
$id_menu = $datShm[0]['MENU_ID'];
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$datRj = $this->Amod->getData_ReturPenjualan_byKARYAWAN_statusNull($id_karyawan);
|
|
if ($datRj==TRUE) {
|
|
$id_rj = $datRj[0]['ID_RJ'];
|
|
$id_penjualan = $datRj[0]['PENJUALAN_ID'];
|
|
$datDrj = $this->Amod->getData_DaftarReturJual_byRJ($id_rj);
|
|
$no = 0;
|
|
$sn = "";
|
|
foreach ($datDrj as $key) {
|
|
$datSnrj = $this->Amod->getData_SnReturJual_byDRJ_byRJ($key['ID_DRJ'], $id_rj);
|
|
foreach ($datSnrj as $dat) {
|
|
$nama_snrj = $dat['NAMA_SNRJ'];
|
|
$sn .= "$nama_snrj, ";
|
|
}
|
|
$datDrj[$no++] += ['SN' => $sn];
|
|
$sn = "";
|
|
}
|
|
$countProses = count($datDrj);
|
|
} else {
|
|
$datDrj = NULL;
|
|
$id_rj = NULL;
|
|
$id_penjualan = 0;
|
|
$countProses = 0;
|
|
}
|
|
|
|
$datRjKunci = $this->Amod->getData_ReturPenjualan_bySTATUS(0);
|
|
$no = 0;
|
|
foreach ($datRjKunci as $key) {
|
|
$sumDrj = $this->Amod->getSum_DaftarReturJual_byRJ($key['ID_RJ']);
|
|
$datRjKunci[$no++] += ['NILAI' => number_format($sumDrj[0]['TOTAL'], 2)];
|
|
}
|
|
|
|
$datStpos = $this->Amod->getData_SetTogglePosisi_byKARYAWAN_byMENU($id_karyawan, $id_menu);
|
|
if ($datStpos==FALSE) { $posisiToggle = 0; } else { $posisiToggle = $datStpos[0]['AKTIF_STPOS']; }
|
|
|
|
$datHhpda = $this->Amod->getData_HasilHitungPda_belumLunasOnly();
|
|
|
|
$data = array(
|
|
'sidebar' => "menu penjualan",
|
|
'navChild' => "penjualan retur",
|
|
'hhpda' => $datHhpda,
|
|
'id_rj' => $id_rj,
|
|
'id_penjualan' => $id_penjualan,
|
|
'drj' => $datDrj,
|
|
'returKunci' => $datRjKunci,
|
|
'countProses' => $countProses,
|
|
'countKunci' => count($datRjKunci),
|
|
'posisiToggle' => $posisiToggle,
|
|
'id_menu' => $id_menu,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil,
|
|
'tgl' => $now,
|
|
);
|
|
$this->load->view('proses/PJ_Sub1_ReturPenjualan_1', $data);
|
|
}
|
|
|
|
public function PJ_Ambil_Sub1_D1_DataDaftarReturJualBerjalan() {
|
|
$id_penjualan = $this->input->post('id_penjualan');
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
|
|
$datRj = $this->Amod->getData_ReturPenjualan_byKARYAWAN_statusNull($id_karyawan);
|
|
if ($datRj==TRUE) {
|
|
$id_rj = $datRj[0]['ID_RJ'];
|
|
} else {
|
|
$id_rj = NULL;
|
|
}
|
|
|
|
$data = $this->Amod->getData_DaftarOrder_byPENJUALAN_kembaliNotFull($id_penjualan);
|
|
$no = 0;
|
|
foreach ($data as $key) {
|
|
$datDrj = $this->Amod->getData_DaftarReturJual_byRJ_byBARANG($id_rj, $key['BARANG_ID']);
|
|
if ($datDrj==TRUE) {
|
|
$lock = 1;
|
|
} else {
|
|
$lock = 0;
|
|
}
|
|
$data[$no++] += ['LOCK' => $lock];
|
|
}
|
|
|
|
$this->output_json([
|
|
'data' => $data,
|
|
]);
|
|
}
|
|
|
|
public function PJ_Ambil_Sub1_D1_DataSnReturBerjalan() {
|
|
$id_barang = $this->input->post('id_barang');
|
|
$id_penjualan = $this->input->post('id_penjualan');
|
|
|
|
$data = $this->Amod->getData_SnJual_byBARANG_byPENJUALAN_bySTATUS_status1($id_barang, $id_penjualan, 1);
|
|
$datBarang = $this->Amod->getData_Barang_byID($id_barang);
|
|
|
|
$this->output_json([
|
|
'data' => $data,
|
|
'tipe' => $datBarang[0]['TYPE_JENIS'],
|
|
]);
|
|
}
|
|
|
|
public function PJ_Ambil_Sub1_D1_DataDaftarReturJual() {
|
|
$id_rj = $this->input->post('id_rj');
|
|
$limit = date('Y-m-01');
|
|
|
|
$datRj = $this->Amod->getData_ReturPenjualan_byID_bySTATUS($id_rj, 0);
|
|
$datHhpda = $this->Amod->getData_HasilHitungPda_byPENJUALAN($datRj[0]['PENJUALAN_ID']);
|
|
if (strtotime($limit)>strtotime($datRj[0]['TGL_RJ'])) {
|
|
$kunciUbah = 1;
|
|
} else if ($datHhpda[0]['STATUS_HHPDA']>0) {
|
|
$kunciUbah = 1;
|
|
} else {
|
|
$kunciUbah = 0;
|
|
}
|
|
|
|
$data = $this->Amod->getData_DaftarReturJual_byRJ($id_rj);
|
|
$no = 0;
|
|
foreach ($data as $key) {
|
|
$satuan = $key['HARGA_DRJ'];
|
|
$subtotal = $key['HARGA_DRJ']*$key['QTY_DRJ'];
|
|
|
|
$data[$no] += ['SATUAN' => number_format($satuan,2)];
|
|
$data[$no++] += ['SUBTOTAL' => number_format($subtotal,2)];
|
|
}
|
|
|
|
$sumPda = $this->Amod->getSum_DaftarReturJual_byRJ($id_rj);
|
|
if ($sumPda[0]['TOTAL']==NULL) {
|
|
$dppDrj = 0;
|
|
$ppnDrj = 0;
|
|
$totDrj = 0;
|
|
} else {
|
|
$dppDrj = round($sumPda[0]['TOTAL'],2);
|
|
$ppnDrj = round(($sumPda[0]['TOTAL']*($datRj[0]['PPN_SO']/100)),2);
|
|
$totDrj = round(($dppDrj+$ppnDrj),2);
|
|
}
|
|
|
|
$this->output_json([
|
|
'total' => sizeof($data),
|
|
'data' => $data,
|
|
'kunciUbah' => $kunciUbah,
|
|
'nama_pelanggan' => $datRj[0]['NAMA_PELANGGAN'],
|
|
'dppDrj' => number_format($dppDrj,2),
|
|
'ppnDrj' => number_format($ppnDrj,2),
|
|
'totDrj' => number_format($totDrj,2),
|
|
]);
|
|
}
|
|
|
|
public function PJ_Tambah_Sub1_D1_DataDaftarReturJual() {
|
|
$tipe = $this->input->post('tipe');
|
|
$id_penjualan = $this->input->post('id_penjualannew');
|
|
$id_barang = $this->input->post('id_barangnew');
|
|
$qty_drj = $this->input->post('qty_drjnew');
|
|
$snretur = $this->input->post('id_snreturnew');
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
$now = date('Y-m-d');
|
|
|
|
if ($tipe==1) {
|
|
$qty_drj = count($snretur);
|
|
|
|
foreach ($snretur as $key) {
|
|
$datSnJual = $this->Amod->getData_SnJual_byID_bySTATUS($key, 1);
|
|
if ($datSnJual==FALSE) {
|
|
$this->session->set_flashdata('sn_used', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
}
|
|
}
|
|
|
|
$datPenjualan = $this->Amod->getData_Penjualan_byID_bySTATUS($id_penjualan, 1);
|
|
if ($datPenjualan==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$sumDo = $this->Amod->getSum_DaftarOrder_byPENJUALAN_byBARANG($id_penjualan, $id_barang);
|
|
if ($sumDo[0]['TOTAL']<$qty_drj) {
|
|
$this->session->set_flashdata('qty_sisapenjualan_less', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$datRj = $this->Amod->getData_ReturPenjualan_byKARYAWAN_statusNull($id_karyawan);
|
|
if ($datRj==FALSE) {
|
|
$kode_rj = $this->Amod->generate_kodeReturPenjualan();
|
|
$input = [
|
|
'CIPTA_RJ' => "Oleh $panggilan pada $timestamp",
|
|
'KODE_RJ' => $kode_rj,
|
|
'ADMIN_ID' => $id_karyawan,
|
|
'PENJUALAN_ID' => $id_penjualan,
|
|
'TGL_RJ' => $now
|
|
];
|
|
$action = $this->Amod->create('retur_penjualan', $input);
|
|
|
|
$id_rj = $this->Amod->getMax_ID_ReturPenjualan();
|
|
$id_rj = $id_rj[0]['ID_RJ'];
|
|
} else {
|
|
$id_rj = $datRj[0]['ID_RJ'];
|
|
|
|
$datDrj = $this->Amod->getData_DaftarReturJual_byRJ_byBARANG($id_rj, $id_barang);
|
|
if ($datDrj==TRUE) {
|
|
$this->session->set_flashdata('barangid_same', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
}
|
|
|
|
$datDo = $this->Amod->getData_DaftarOrder_byPENJUALAN_byBARANG($id_penjualan, $id_barang);
|
|
|
|
$input = [
|
|
'RJ_ID' => $id_rj,
|
|
'BARANG_ID' => $id_barang,
|
|
'QTY_DRJ' => $qty_drj,
|
|
'DO_ID' => $datDo[0]['ID_DO'],
|
|
'HARGA_DRJ' => $datDo[0]['HARGA_DO']
|
|
];
|
|
$action = $this->Amod->create('daftar_returjual', $input);
|
|
|
|
$id_drj = $this->Amod->getMax_ID_DaftarReturJual();
|
|
$id_drj = $id_drj[0]['ID_DRJ'];
|
|
|
|
if ($tipe==1) {
|
|
foreach ($snretur as $key) {
|
|
$datSnJual = $this->Amod->getData_SnJual_byID_bySTATUS($key, 1);
|
|
if ($datSnJual==TRUE) {
|
|
$input = [
|
|
'RJ_ID' => $id_rj,
|
|
'DRJ_ID' => $id_drj,
|
|
'SNJ_ID' => $key,
|
|
'NAMA_SNRJ' => $datSnJual[0]['NAMA_SNJ'],
|
|
];
|
|
$action = $this->Amod->create('sn_returjual', $input);
|
|
|
|
$update = [
|
|
'STATUS_SNSTOCK' => '11'
|
|
];
|
|
$action = $this->Amod->update('sn_stock', $update, 'ID_SNSTOCK', $datSnJual[0]['ID_SNSTOCK']);
|
|
|
|
$datDoNew = $this->Amod->getData_DaftarOrder_byID($datDo[0]['ID_DO']);
|
|
$kembaliLama = $datDoNew[0]['RETUR_DO'];
|
|
$kembaliBaru = $kembaliLama+1;
|
|
|
|
$update = [
|
|
'RETUR_DO' => $kembaliBaru
|
|
];
|
|
$action = $this->Amod->update('daftar_order', $update, 'ID_DO', $datDo[0]['ID_DO']);
|
|
}
|
|
}
|
|
} else {
|
|
$retur_do = $datDo[0]['RETUR_DO']+$qty_drj;
|
|
$update = [
|
|
'RETUR_DO' => $retur_do
|
|
];
|
|
$action = $this->Amod->update('daftar_order', $update, 'ID_DO', $datDo[0]['ID_DO']);
|
|
}
|
|
|
|
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 PJ_Ubah_Sub1_D1_DataDaftarReturJual() {
|
|
$id_drj = $this->input->post('id_drj');
|
|
$id_rj = $this->input->post('id_rj');
|
|
$harga_drj = $this->input->post('harga_drj');
|
|
$harga_drj = round($harga_drj, 2);
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$value = 0;
|
|
$datRj = $this->Amod->getData_ReturPenjualan_byID_bySTATUS($id_rj, 0);
|
|
if ($datRj==FALSE) {
|
|
$value = 3;
|
|
} else {
|
|
$datDrj = $this->Amod->getData_DaftarReturJual_byID($id_drj);
|
|
if ($datDrj==FALSE) {
|
|
$value = 2;
|
|
} else {
|
|
$update = [
|
|
'HARGA_DRJ' => $harga_drj
|
|
];
|
|
$action = $this->Amod->update('daftar_returjual', $update, 'ID_DRJ', $id_drj);
|
|
|
|
$value = 1;
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value
|
|
]);
|
|
}
|
|
|
|
public function PJ_Hapus_Sub1_D1_DataDaftarReturJual() {
|
|
$id_drj = $this->input->post('id_drjdel');
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
|
|
$datDrj = $this->Amod->getData_DaftarReturJual_byID($id_drj);
|
|
if ($datDrj==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$id_rj = $datDrj[0]['RJ_ID'];
|
|
$datRj = $this->Amod->getData_ReturPenjualan_byID_byKARYAWAN_statusNull($id_rj, $id_karyawan);
|
|
if ($datRj==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
if ($datDrj[0]['TYPE_JENIS']==1) {
|
|
$datSnrj = $this->Amod->getData_SnReturJual_byDRJ($id_drj);
|
|
foreach ($datSnrj as $key) {
|
|
$datSnStock = $this->Amod->getData_SnStock_byNAMA_bySTATUS($key['NAMA_SNRJ'], 11);
|
|
if ($datSnStock==TRUE) {
|
|
$update = [
|
|
'STATUS_SNSTOCK' => '1'
|
|
];
|
|
$action = $this->Amod->update('sn_stock', $update, 'ID_SNSTOCK', $datSnStock[0]['ID_SNSTOCK']);
|
|
|
|
$datDoNew = $this->Amod->getData_DaftarOrder_byID($datDrj[0]['DO_ID']);
|
|
$kembaliLama = $datDoNew[0]['RETUR_DO'];
|
|
$kembaliBaru = $kembaliLama-1;
|
|
|
|
$update = [
|
|
'RETUR_DO' => $kembaliBaru
|
|
];
|
|
$action = $this->Amod->update('daftar_order', $update, 'ID_DO', $datDrj[0]['DO_ID']);
|
|
}
|
|
}
|
|
$action = $this->Amod->delete('sn_returjual', $id_drj, 'DRJ_ID');
|
|
} else {
|
|
$datDo = $this->Amod->getData_DaftarOrder_byID($datDrj[0]['DO_ID']);
|
|
$retur_do = $datDo[0]['RETUR_DO']-$datDrj[0]['QTY_DRJ'];
|
|
$update = [
|
|
'RETUR_DO' => $retur_do
|
|
];
|
|
$action = $this->Amod->update('daftar_order', $update, 'ID_DO', $datDrj[0]['DO_ID']);
|
|
}
|
|
|
|
$action = $this->Amod->delete('daftar_returjual', $id_drj, 'ID_DRJ');
|
|
|
|
$countAfter = $this->Amod->getCount_DaftarReturJual_byRJ($id_rj);
|
|
if ($countAfter==0) {
|
|
$action = $this->Amod->delete('retur_penjualan', $id_rj, 'ID_RJ');
|
|
}
|
|
|
|
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 PJ_Proses_Sub1_D1_DataDaftarReturJual() {
|
|
$id_rj = $this->input->post('id_rjpro');
|
|
$tgl_input = $this->input->post('tgl_inputpro');
|
|
$ket_rj = $this->input->post('ket_rjpro');
|
|
$ket_rj = ltrim(rtrim(preg_replace('/\R+/', " " , $ket_rj)));
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$now = date('Y-m-d');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$datRj = $this->Amod->getData_ReturPenjualan_byID_byKARYAWAN_statusNull($id_rj, $id_karyawan);
|
|
if ($datRj==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$update = [
|
|
'STATUS_RJ' => '0',
|
|
'TGL_RJ' => $now,
|
|
'TGL_INPUT' => $tgl_input,
|
|
'KET_RJ' => $ket_rj,
|
|
'PROSES_RJ' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('retur_penjualan', $update, 'ID_RJ', $id_rj);
|
|
|
|
if ($action) {
|
|
$this->session->set_flashdata('success', 'diproses');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
} else {
|
|
$this->session->set_flashdata('failed', 'diproses');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
}
|
|
|
|
public function PJ_Batal_Sub1_D1_DataReturPenjualan() {
|
|
$id_rj = $this->input->post('id_rjvoid');
|
|
|
|
$datRj = $this->Amod->getData_ReturPenjualan_byID_bySTATUS($id_rj, 0);
|
|
$datDrj = $this->Amod->getData_DaftarReturJual_byRJ($id_rj);
|
|
if ($datRj==FALSE OR $datDrj==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
foreach ($datDrj as $key) {
|
|
if ($key['TYPE_JENIS']==1) {
|
|
$datSnrj = $this->Amod->getData_SnReturJual_byDRJ($key['ID_DRJ']);
|
|
foreach ($datSnrj as $dat) {
|
|
$datSnStock = $this->Amod->getData_SnReturJual_byID_11($dat['ID_SNRJ']);
|
|
if ($datSnStock==TRUE) {
|
|
$update = [
|
|
'STATUS_SNSTOCK' => '1'
|
|
];
|
|
$action = $this->Amod->update('sn_stock', $update, 'ID_SNSTOCK', $datSnStock[0]['ID_SNSTOCK']);
|
|
|
|
$datDoNew = $this->Amod->getData_DaftarOrder_byID($key['DO_ID']);
|
|
$kembaliLama = $datDoNew[0]['RETUR_DO'];
|
|
$kembaliBaru = $kembaliLama-1;
|
|
|
|
$update = [
|
|
'RETUR_DO' => $kembaliBaru
|
|
];
|
|
$action = $this->Amod->update('daftar_order', $update, 'ID_DO', $key['DO_ID']);
|
|
}
|
|
}
|
|
} else {
|
|
$datDo = $this->Amod->getData_DaftarOrder_byID($key['DO_ID']);
|
|
$retur_do = $datDo[0]['RETUR_DO']-$key['QTY_DRJ'];
|
|
$update = [
|
|
'RETUR_DO' => $retur_do
|
|
];
|
|
$action = $this->Amod->update('daftar_order', $update, 'ID_DO', $key['DO_ID']);
|
|
}
|
|
}
|
|
|
|
$action = $this->Amod->delete('sn_returjual', $id_rj, 'RJ_ID');
|
|
$action = $this->Amod->delete('daftar_returjual', $id_rj, 'RJ_ID');
|
|
$action = $this->Amod->delete('retur_penjualan', $id_rj, 'ID_RJ');
|
|
|
|
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 PJ_Kunci_Sub1_D1_DataReturPenjualan() {
|
|
$id_rj = $this->input->post('id_rjlock');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$now = date('Y-m-d');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$datRj = $this->Amod->getData_ReturPenjualan_byID_bySTATUS($id_rj, 0);
|
|
if ($datRj==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$inv_rj = $this->Amod->generate_INVReturPenjualan();
|
|
$datDrj = $this->Amod->getData_DaftarReturJual_byRJ($id_rj);
|
|
foreach ($datDrj as $key) {
|
|
if ($key['TYPE_JENIS']==1) {
|
|
$datSnrj = $this->Amod->getData_SnReturJual_byDRJ($key['ID_DRJ']);
|
|
foreach ($datSnrj as $dat) {
|
|
$datSnStock = $this->Amod->getData_SnStock_byNAMA_bySTATUS($dat['NAMA_SNRJ'], 11);
|
|
if ($datSnStock==TRUE) {
|
|
$update = [
|
|
'STATUS_SNSTOCK' => '0'
|
|
];
|
|
$action = $this->Amod->update('sn_stock', $update, 'ID_SNSTOCK', $datSnStock[0]['ID_SNSTOCK']);
|
|
|
|
$input = [
|
|
'PELANGGAN_ID' => $datRj[0]['PEL_ID'],
|
|
'SNSTOCK_ID' => $datSnStock[0]['ID_SNSTOCK'],
|
|
'INV_HSN' => $inv_rj,
|
|
'KODE_BUKTI' => $datRj[0]['KODE_RJ'],
|
|
'TGL_HSN' => $now
|
|
];
|
|
$action = $this->Amod->create('histori_sn', $input);
|
|
}
|
|
}
|
|
}
|
|
|
|
if ($key['TYPE_JENIS']!=2) {
|
|
$this->GE_Kalkulasi_KuantitiBarang($key['BARANG_ID'], $datRj[0]['GUDANG_SO'], "Step 2 - PENJUALAN - Kunci Retur", 0, $key['QTY_DRJ']);
|
|
$this->GE_Kalkulasi_HistoriKuantiti($key['BARANG_ID'], "Step 2 - PENJUALAN - Kunci Retur", 0, $key['QTY_DRJ'], $inv_rj, 0, $id_rj);
|
|
}
|
|
}
|
|
|
|
$sumDrj = $this->Amod->getSum_DaftarReturJual_byRJ($id_rj);
|
|
if ($sumDrj[0]['TOTAL']==NULL) {
|
|
$dpp = 0;
|
|
} else {
|
|
$dpp = round($sumDrj[0]['TOTAL'],2);
|
|
}
|
|
|
|
$pajak_keluaran = round(($dpp*($datRj[0]['PPN_SO']/100)),2);
|
|
$kredit_dak = round(($dpp+$pajak_keluaran),2);
|
|
|
|
$kode_penjualan = $datRj[0]['KODE_PENJUALAN'];
|
|
$kode_rj = $datRj[0]['KODE_RJ'];
|
|
|
|
$input = [
|
|
'CIPTA_AKUNTANSI' => "Oleh $panggilan pada $timestamp",
|
|
'TGL_AKUNTANSI' => $now,
|
|
'KODE_AKUNTANSI' => $kode_rj,
|
|
'STATUS_AKUNTANSI' => '1',
|
|
];
|
|
$action = $this->Amod->create('akuntansi', $input);
|
|
|
|
$id_akuntansi = $this->Amod->getMax_ID_Akuntansi();
|
|
$id_akuntansi = $id_akuntansi[0]['ID_AKUNTANSI'];
|
|
|
|
$input = [
|
|
'AKUNTANSI_ID' => $id_akuntansi,
|
|
'PERKIRAAN_ID' => '3',
|
|
'CIPTA_DAK' => "Oleh $panggilan pada $timestamp",
|
|
'JENIS_DAK' => '0',
|
|
'JENIS_PDA' => '2',
|
|
'KREDIT_DAK' => $kredit_dak,
|
|
'DEBET_DAK' => '0',
|
|
'KET_DAK' => $datRj[0]['KET_RJ'],
|
|
'PELANGGAN_ID' => $datRj[0]['PEL_ID'],
|
|
'PENJUALAN_ID' => $datRj[0]['PENJUALAN_ID']
|
|
];
|
|
$action = $this->Amod->create('daftar_akuntansi', $input);
|
|
|
|
$input = [
|
|
'AKUNTANSI_ID' => $id_akuntansi,
|
|
'PERKIRAAN_ID' => '24',
|
|
'CIPTA_DAK' => "Oleh $panggilan pada $timestamp",
|
|
'JENIS_DAK' => '0',
|
|
'KREDIT_DAK' => '0',
|
|
'DEBET_DAK' => $dpp,
|
|
'KET_DAK' => $datRj[0]['KET_RJ'],
|
|
'PELANGGAN_ID' => $datRj[0]['PEL_ID'],
|
|
'PENJUALAN_ID' => $datRj[0]['PENJUALAN_ID']
|
|
];
|
|
$action = $this->Amod->create('daftar_akuntansi', $input);
|
|
|
|
if ($datRj[0]['PPN_SO']>0) {
|
|
$input = [
|
|
'AKUNTANSI_ID' => $id_akuntansi,
|
|
'PERKIRAAN_ID' => '83',
|
|
'CIPTA_DAK' => "Oleh $panggilan pada $timestamp",
|
|
'JENIS_DAK' => '0',
|
|
'KREDIT_DAK' => '0',
|
|
'DEBET_DAK' => $pajak_keluaran,
|
|
'KET_DAK' => "Retur Pajak Keluaran, Kode : [$kode_rj] untuk Penjualan [$kode_penjualan]",
|
|
'PELANGGAN_ID' => $datRj[0]['PEL_ID'],
|
|
'PENJUALAN_ID' => $datRj[0]['PENJUALAN_ID']
|
|
];
|
|
$action = $this->Amod->create('daftar_akuntansi', $input);
|
|
}
|
|
|
|
$sumPda = $this->Amod->getSum_DaftarAkuntansi_byPENJUALAN_byPERKIRAAN($datRj[0]['PENJUALAN_ID'], 3);
|
|
$debet_hhpda = $sumPda[0]['DEBET'];
|
|
$kredit_hhpda = $sumPda[0]['KREDIT'];
|
|
if ($debet_hhpda==$kredit_hhpda) {
|
|
$status_hhpda = 1;
|
|
} else if ($kredit_hhpda>$debet_hhpda) {
|
|
$status_hhpda = 2;
|
|
} else {
|
|
$status_hhpda = 0;
|
|
}
|
|
|
|
$datHhpda = $this->Amod->getData_HasilHitungPda_byPENJUALAN($datRj[0]['PENJUALAN_ID']);
|
|
if ($datHhpda[0]['STATUS_HHPDA']!=$status_hhpda) {
|
|
$historiPda = $this->Amod->getData_DaftarAkuntansi_byPENJUALAN_byPERKIRAAN_orderDESC_limit1($datRj[0]['PENJUALAN_ID'], 3);
|
|
$update = [
|
|
'DEBET_HHPDA' => $debet_hhpda,
|
|
'KREDIT_HHPDA' => $kredit_hhpda,
|
|
'STATUS_HHPDA' => $status_hhpda,
|
|
'LAST_HHPDA' => $timestamp,
|
|
'TGLLOCK_HHPDA' => $historiPda[0]['TGL_AKUNTANSI'],
|
|
'LUNAS_HHPDA' => $historiPda[0]['KODE_AKUNTANSI'],
|
|
];
|
|
$action = $this->Amod->update('hasil_hitungpda', $update, 'ID_HHPDA', $datHhpda[0]['ID_HHPDA']);
|
|
} else if ($datHhpda[0]['DEBET_HHPDA']!=$debet_hhpda OR $datHhpda[0]['KREDIT_HHPDA']!=$kredit_hhpda) {
|
|
$update = [
|
|
'DEBET_HHPDA' => $debet_hhpda,
|
|
'KREDIT_HHPDA' => $kredit_hhpda,
|
|
'LAST_HHPDA' => $timestamp,
|
|
];
|
|
$action = $this->Amod->update('hasil_hitungpda', $update, 'ID_HHPDA', $datHhpda[0]['ID_HHPDA']);
|
|
}
|
|
|
|
$update = [
|
|
'STATUS_RJ' => '1',
|
|
'INV_RJ' => $inv_rj,
|
|
'TGL_RJ' => $now,
|
|
'KUNCI_RJ' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('retur_penjualan', $update, 'ID_RJ', $id_rj);
|
|
|
|
if ($action) {
|
|
$this->session->set_flashdata('success', 'dikunci');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
} else {
|
|
$this->session->set_flashdata('failed', 'dikunci');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
}
|
|
|
|
//SUBMENU TRANSAKSI - BATAL PENJUALAN
|
|
public function PJ_Sub1_BatalPenjualan_1() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$month = date('m');
|
|
$year = date('Y');
|
|
$bulan_ini = $this->Amod->generate_inisialMonth($month);
|
|
$bulan_ini = "$bulan_ini $year";
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "PJ", "TRANSAKSI - Batal Penjualan");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$datPenjualan = $this->Amod->getData_Penjualan_status1_forBatal();
|
|
|
|
$data = array(
|
|
'sidebar' => "menu penjualan",
|
|
'navChild' => "penjualan batal",
|
|
'bulan_ini' => $bulan_ini,
|
|
'penjualan' => $datPenjualan,
|
|
'countSiap' => count($datPenjualan),
|
|
'hak' => $hak,
|
|
'tampil' => $tampil,
|
|
);
|
|
$this->load->view('proses/PJ_Sub1_BatalPenjualan_1', $data);
|
|
}
|
|
|
|
public function PJ_Ambil_Sub1_E1_DataDaftarOrder() {
|
|
$id_penjualan = $this->input->post('id_penjualan');
|
|
|
|
$datDo = $this->Amod->getData_DaftarOrder_byPENJUALAN($id_penjualan);
|
|
$datPenjualan = $this->Amod->getData_Penjualan_byID($id_penjualan);
|
|
$sumPenjualan = $this->Amod->getSum_DaftarOrder_byPENJUALAN($id_penjualan);
|
|
if ($sumPenjualan[0]['TOTAL']==NULL) {
|
|
$dpp = 0;
|
|
} else {
|
|
$dpp = $sumPenjualan[0]['TOTAL'];
|
|
}
|
|
|
|
$ppn_penjualan = round(($dpp*($datPenjualan[0]['PPN_SO']/100)),2);
|
|
$tot_penjualan = round(($dpp+$ppn_penjualan),2);
|
|
|
|
$this->output_json([
|
|
'data' => $datDo,
|
|
'total' => sizeof($datDo),
|
|
'dppJual' => number_format($dpp,2),
|
|
'ppnJual' => number_format($ppn_penjualan,2),
|
|
'totJual' => number_format($tot_penjualan,2),
|
|
'namaPel' => $datPenjualan[0]['NAMA_PELANGGAN'],
|
|
'noNota' => $datPenjualan[0]['INV_PENJUALAN']
|
|
]);
|
|
}
|
|
|
|
public function PJ_Batal_Sub1_E1_DataPenjualan() {
|
|
$id_penjualan = $this->input->post('id_penjualanvoid');
|
|
$ket_batal = $this->input->post('ket_batal');
|
|
$ket_batal = preg_replace('/\R+/', " " , $ket_batal);
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
$now = date('Y-m-d');
|
|
|
|
$datHhbfe = $this->Amod->getData_HasilHitungBfe_byPENJUALAN($id_penjualan);
|
|
if ($datHhbfe[0]['STATUS_HHBFE']>0 OR $datHhbfe[0]['DEBET_HHBFE']>0) {
|
|
$this->session->set_flashdata('data_used_fee', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$datPenjualan = $this->Amod->getData_Penjualan_status1_forBatal($id_penjualan);
|
|
if ($datPenjualan==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$datSpr = $this->Amod->getData_SoProyek_bySO($datPenjualan[0]['SO_ID']);
|
|
if ($datSpr==TRUE) {
|
|
$this->session->set_flashdata('soproyek_used', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$datRj = $this->Amod->getData_ReturPenjualan_byPENJUALAN($id_penjualan);
|
|
if ($datRj==TRUE) {
|
|
$this->session->set_flashdata('data_used_retur', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byPERKIRAAN_byPENJUALAN(3, $id_penjualan);
|
|
if (count($datDak)>=2) {
|
|
$this->session->set_flashdata('data_used_kasbank', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$datIo = $this->Amod->getData_TransaksiStock_byPENJUALAN($id_penjualan);
|
|
foreach ($datIo as $key) {
|
|
if ($key['JENIS_IO']==1) {
|
|
if ($key['TYPE_JENIS']==1) {
|
|
$datSnio = $this->Amod->getData_SnIo_byIO($key['ID_IO']);
|
|
foreach ($datSnio as $dat) {
|
|
$datSnStock = $this->Amod->getData_SnStock_byNAMA_bySTATUS($dat['NAMA_SNIO'], 0);
|
|
if ($datSnStock==FALSE) {
|
|
$this->session->set_flashdata('data_used_io', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
$datDpc = $this->Amod->getData_DaftarPromoClearance_byPENJUALAN($id_penjualan);
|
|
foreach ($datDpc as $key) {
|
|
if ($key['STATUS_DPC']==1) {
|
|
$datFk = $this->Amod->getData_FormKaryawan_byID_bySTATUS($key['FK_ID'], 1);
|
|
if ($datFk==TRUE) {
|
|
$this->session->set_flashdata('formkaryawan_kasbankused', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
}
|
|
}
|
|
|
|
//Proses Pembatalan Data
|
|
foreach ($datIo as $key) {
|
|
if ($key['JENIS_IO']==0) {
|
|
if ($key['TYPE_JENIS']==1) {
|
|
$datSnio = $this->Amod->getData_SnIo_byIO($key['ID_IO']);
|
|
foreach ($datSnio as $dat) {
|
|
$datSnStock = $this->Amod->getData_SnStock_byNAMA_bySTATUS($dat['NAMA_SNIO'], 1);
|
|
if ($datSnStock==TRUE) {
|
|
$update = [
|
|
'STATUS_SNSTOCK' => '0'
|
|
];
|
|
$action = $this->Amod->update('sn_stock', $update, 'ID_SNSTOCK', $datSnStock[0]['ID_SNSTOCK']);
|
|
}
|
|
}
|
|
$action = $this->Amod->delete('sn_io', $key['ID_IO'], 'IO_ID');
|
|
}
|
|
|
|
$this->GE_Kalkulasi_KuantitiBarang($key['BARANG_ID'], $datPenjualan[0]['GUDANG_SO'], "PENJUALAN - Batal Penjualan", 0, $key['QTY_IO']);
|
|
} else if ($key['JENIS_IO']==1) {
|
|
if ($key['TYPE_JENIS']==1) {
|
|
$datSnio = $this->Amod->getData_SnIo_byIO($key['ID_IO']);
|
|
foreach ($datSnio as $dat) {
|
|
$datSnStock = $this->Amod->getData_SnStock_byNAMA_bySTATUS($dat['NAMA_SNIO'], 0);
|
|
if ($datSnStock==TRUE) {
|
|
$action = $this->Amod->delete('sn_stock', $datSnStock[0]['ID_SNSTOCK'], 'ID_SNSTOCK');
|
|
}
|
|
}
|
|
$action = $this->Amod->delete('sn_io', $key['ID_IO'], 'IO_ID');
|
|
}
|
|
|
|
$this->GE_Kalkulasi_KuantitiBarang($key['BARANG_ID'], $datPenjualan[0]['GUDANG_SO'], "PENJUALAN - Batal Penjualan", 1, $key['QTY_IO']);
|
|
}
|
|
}
|
|
|
|
$datDo = $this->Amod->getData_DaftarOrder_byPENJUALAN($id_penjualan);
|
|
foreach ($datDo as $key) {
|
|
if ($key['TYPE_JENIS']==1) {
|
|
$datStgas = $this->Amod->getData_SetToggleAs_byMERK_byPRODUK_bySTATUS($key['MERK_ID'], $key['PRODUK_ID'], 1);
|
|
|
|
$datSnj = $this->Amod->getData_SnJual_byDO($key['ID_DO']);
|
|
foreach ($datSnj as $dat) {
|
|
$datSnStock = $this->Amod->getData_SnStock_byNAMA_bySTATUS($dat['NAMA_SNJ'], 1);
|
|
if ($datSnStock==TRUE) {
|
|
$update = [
|
|
'STATUS_SNSTOCK' => '0'
|
|
];
|
|
$action = $this->Amod->update('sn_stock', $update, 'ID_SNSTOCK', $datSnStock[0]['ID_SNSTOCK']);
|
|
}
|
|
|
|
if ($datStgas==TRUE) {
|
|
$datSnkpr = $this->Amod->getData_SnKlaimProgram_bySNSTOCK($datSnStock[0]['ID_SNSTOCK']);
|
|
if ($datSnkpr==TRUE) {
|
|
$datHos = $this->Amod->getData_HistoriOtomasiSellout_bySNKPR_batalNull($datSnkpr[0]['ID_SNKPR']);
|
|
if ($datHos==TRUE) {
|
|
$id_lkpr = $datHos[0]['LKPR_ID'];
|
|
|
|
$update = [
|
|
'BATAL_HOS' => "Oleh $panggilan pada $timestamp",
|
|
'LKPR_ID' => NULL
|
|
];
|
|
$action = $this->Amod->update('histori_otomasisellout', $update, 'ID_HOS', $datHos[0]['ID_HOS']);
|
|
|
|
$action = $this->Amod->delete('link_klaimprogram', $id_lkpr, 'ID_LKPR');
|
|
}
|
|
|
|
$update = [
|
|
'STATUS_SNKPR' => '0'
|
|
];
|
|
$action = $this->Amod->update('sn_klaimprogram', $update, 'ID_SNKPR', $datSnkpr[0]['ID_SNKPR']);
|
|
}
|
|
}
|
|
}
|
|
$action = $this->Amod->delete('sn_jual', $key['ID_DO'], 'DO_ID');
|
|
}
|
|
|
|
if ($key['TYPE_JENIS']!=2) {
|
|
$this->GE_Kalkulasi_KuantitiBarang($key['BARANG_ID'], $datPenjualan[0]['GUDANG_SO'], "PENJUALAN - Batal Penjualan", 0, $key['QTY_DO']);
|
|
}
|
|
}
|
|
|
|
$datHq = $this->Amod->getData_HistoriKuantiti_byKODE($datPenjualan[0]['KODE_PENJUALAN']);
|
|
$action = $this->Amod->delete('histori_kuantiti', $datPenjualan[0]['KODE_PENJUALAN'], 'KODE_BUKTI');
|
|
foreach ($datHq as $key) {
|
|
$datHqAfter = $this->Amod->getData_HistoriKuantiti_byBARANG_afterID($key['BARANG_ID'], $key['ID_HQ']);
|
|
foreach ($datHqAfter as $dat) {
|
|
$datHqBeforeTwo = $this->Amod->getData_HistoriKuantiti_byBARANG_orderDESC_limit1_beforeID($dat['BARANG_ID'], $dat['ID_HQ']);
|
|
if ($dat['MASUK_HQ']==0) { // Transaksi Keluar
|
|
$sisa_hq = $datHqBeforeTwo[0]['SISA_HQ']-$dat['KELUAR_HQ'];
|
|
if ($datHqBeforeTwo[0]['SISA_HQ']==$dat['KELUAR_HQ']) {
|
|
$persediaan_hq = 0;
|
|
} else {
|
|
$persediaan_hq = round(($datHqBeforeTwo[0]['PERSEDIAAN_HQ']-($datHqBeforeTwo[0]['AVG_HQ']*$dat['KELUAR_HQ'])),2);
|
|
}
|
|
|
|
$update = [
|
|
'SISA_HQ' => $sisa_hq,
|
|
'PERSEDIAAN_HQ' => $persediaan_hq,
|
|
'AVG_HQ' => $datHqBeforeTwo[0]['AVG_HQ']
|
|
];
|
|
} else if ($dat['KELUAR_HQ']==0) { // Transaksi Masuk
|
|
$sisa_hq = $datHqBeforeTwo[0]['SISA_HQ']+$dat['MASUK_HQ'];
|
|
$persediaan_hq = $datHqBeforeTwo[0]['PERSEDIAAN_HQ']+$dat['NILAI_HQ'];
|
|
$avg_hq = round(($persediaan_hq/$sisa_hq),2);
|
|
|
|
$update = [
|
|
'SISA_HQ' => $sisa_hq,
|
|
'PERSEDIAAN_HQ' => $persediaan_hq,
|
|
'AVG_HQ' => $avg_hq,
|
|
];
|
|
}
|
|
$action = $this->Amod->update('histori_kuantiti', $update, 'ID_HQ', $dat['ID_HQ']);
|
|
}
|
|
}
|
|
|
|
$datSjp = $this->Amod->getData_DaftarSjParsial_bySO($datPenjualan[0]['SO_ID']);
|
|
foreach ($datSjp as $key) {
|
|
$action = $this->Amod->delete('sn_sjparsial', $key['ID_SJP'], 'SJP_ID');
|
|
}
|
|
|
|
$datDpc = $this->Amod->getData_DaftarPromoClearance_byPENJUALAN($id_penjualan);
|
|
foreach ($datDpc as $key) {
|
|
if ($key['STATUS_DPC']==1) {
|
|
$datFk = $this->Amod->getData_FormKaryawan_byID_bySTATUS($key['FK_ID'], 0);
|
|
if ($datFk==TRUE) {
|
|
$update = [
|
|
'STATUS_FK' => '2',
|
|
'BATAL_FK' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('form_karyawan', $update, 'ID_FK', $key['FK_ID']);
|
|
}
|
|
}
|
|
}
|
|
|
|
$datAkuntansi = $this->Amod->getData_Akuntansi_byKODE_bySTATUS($datPenjualan[0]['KODE_PENJUALAN'], 1);
|
|
$id_akuntansi = $datAkuntansi[0]['ID_AKUNTANSI'];
|
|
|
|
$action = $this->Amod->delete('daftar_akuntansi', $id_akuntansi, 'AKUNTANSI_ID');
|
|
$action = $this->Amod->delete('akuntansi', $id_akuntansi, 'ID_AKUNTANSI');
|
|
$action = $this->Amod->delete('histori_sn', $datPenjualan[0]['KODE_PENJUALAN'], 'KODE_BUKTI');
|
|
$action = $this->Amod->delete('histori_sn', $datPenjualan[0]['KODE_SO'], 'KODE_BUKTI');
|
|
$action = $this->Amod->delete('transaksi_stock', $datPenjualan[0]['SO_ID'], 'SO_ID');
|
|
$action = $this->Amod->delete('quality_control', $datPenjualan[0]['SO_ID'], 'SO_ID');
|
|
$action = $this->Amod->delete('daftar_sjparsial', $datPenjualan[0]['SO_ID'], 'SO_ID');
|
|
$action = $this->Amod->delete('cetak_dokumen', $id_penjualan, 'PENJUALAN_ID');
|
|
$action = $this->Amod->delete('hasil_hitungpda', $id_penjualan, 'PENJUALAN_ID');
|
|
$action = $this->Amod->delete('hasil_hitungbfe', $id_penjualan, 'PENJUALAN_ID');
|
|
$action = $this->Amod->delete('daftar_promoclearance', $id_penjualan, 'PENJUALAN_ID');
|
|
$action = $this->Amod->delete('jadwal_pengiriman', $datPenjualan[0]['SO_ID'], 'SO_ID');
|
|
|
|
$update = [
|
|
'STATUS_SO' => '5',
|
|
'KET_SO_A' => $ket_batal,
|
|
'SIAP_SO' => NULL,
|
|
'KUNCI_SO' => NULL,
|
|
'TERKIRIM_SO' => NULL,
|
|
'TGL_KIRIM' => NULL,
|
|
'BATAL_SO' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('sales_order', $update, 'ID_SO', $datPenjualan[0]['SO_ID']);
|
|
|
|
$update = [
|
|
'KET_BATAL' => $ket_batal,
|
|
'STATUS_PENJUALAN' => '0',
|
|
'TGL_BATAL' => $now
|
|
];
|
|
$action = $this->Amod->update('penjualan', $update, 'ID_PENJUALAN', $id_penjualan);
|
|
|
|
$update = [
|
|
'STATUS_FFP' => '2',
|
|
'SOVOID_FFP' => $datPenjualan[0]['KODE_SO'],
|
|
'BATAL_FFP' => "Oleh $panggilan pada $timestamp",
|
|
'PENJUALAN_ID' => NULL
|
|
];
|
|
$action = $this->Amod->update('form_feepelanggan', $update, 'PENJUALAN_ID', $id_penjualan);
|
|
|
|
$this->GE_Kalkulasi_HistoriOtomasiBooster($id_penjualan);
|
|
|
|
if ($action) {
|
|
$this->session->set_flashdata('success', 'dibatalkan');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
} else {
|
|
$this->session->set_flashdata('failed', 'dibatalkan');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
}
|
|
|
|
//SUBMENU TRANSAKSI - OLAH PENJUALAN
|
|
public function PJ_Sub1_OlahPenjualan_1() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$now = date('Y-m-d');
|
|
$limit = date('Y-m-01');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "PJ", "TRANSAKSI - Olah Penjualan");
|
|
$id_menu = $datShm[0]['MENU_ID'];
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
if ($hak>=3) {
|
|
$awal = $this->Amod->generate_subYear($limit, 1);
|
|
} else if ($hak==1 OR $hak==2) {
|
|
$awal = $this->Amod->generate_subMonth($limit, 2);
|
|
} else {
|
|
$awal = $now;
|
|
}
|
|
|
|
$fpNull = $this->Amod->getData_Penjualan_byPERIODE_fpNull_ttNull($awal, $now);
|
|
|
|
$datStpos = $this->Amod->getData_SetTogglePosisi_byKARYAWAN_byMENU($id_karyawan, $id_menu);
|
|
if ($datStpos==FALSE) { $posisiToggle = 0; } else { $posisiToggle = $datStpos[0]['AKTIF_STPOS']; }
|
|
|
|
$datSales = $this->Amod->getData_Karyawan_allSales();
|
|
|
|
$data = array(
|
|
'sidebar' => "menu penjualan",
|
|
'navChild' => "penjualan olah",
|
|
'sales' => $datSales,
|
|
'id_menu' => $id_menu,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil,
|
|
'posisiToggle' => $posisiToggle,
|
|
'tgl' => $now,
|
|
'fpNull' => $fpNull,
|
|
'countFp' => count($fpNull),
|
|
);
|
|
$this->load->view('proses/PJ_Sub1_OlahPenjualan_1', $data);
|
|
}
|
|
|
|
public function PJ_Ambil_Sub1_F1_JumlahPenjualan() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$now = date('Y-m-d');
|
|
$limit = date('Y-m-01');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "PJ", "TRANSAKSI - Olah Penjualan");
|
|
if ($datShm==FALSE) {
|
|
$akses = 0;
|
|
} else {
|
|
$akses = $datShm[0]['AKSES_ID'];
|
|
if ($akses==3) {
|
|
$awal = $this->Amod->generate_subYear($limit, 1);
|
|
$ketData = "Penjualan 1 Tahun Kebelakang";
|
|
} else if ($akses==1 OR $akses==2) {
|
|
$awal = $this->Amod->generate_subMonth($limit, 2);
|
|
$ketData = "Penjualan 2 Bulan Kebelakang";
|
|
} else {
|
|
$awal = $now;
|
|
$ketData = "Penjualan Bulan ini";
|
|
}
|
|
}
|
|
|
|
$countPenjualan = $this->Amod->getCount_Penjualan_bySTATUS_byPERIODE(1, $awal, $now);
|
|
|
|
$this->output_json([
|
|
'countPenjualan' => $countPenjualan,
|
|
'ketData' => $ketData,
|
|
]);
|
|
}
|
|
|
|
public function PJ_Ubah_Sub1_F1_DataPenjualan() {
|
|
$id_penjualan = $this->input->post('id_penjualan');
|
|
$id_pelanggan = $this->input->post('id_pelanggan');
|
|
$id_sales = $this->input->post('id_sales');
|
|
$ppn_so = $this->input->post('ppn_so');
|
|
$fee_so = $this->input->post('fee_so');
|
|
$gp_so = $this->input->post('gp_so');
|
|
$po_so = $this->input->post('po_so');
|
|
$fp_penjualan = $this->input->post('fp_penjualan');
|
|
$tt_penjualan = $this->input->post('tt_penjualan');
|
|
$ket_so_o = $this->input->post('ket_so_o');
|
|
$ket_so_o = preg_replace('/\R+/', " " , $ket_so_o);
|
|
$po_so = strtoupper($po_so);
|
|
$hak = $this->input->post('hak');
|
|
$menu = $this->input->post('menu');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
$now = date('Y-m-d');
|
|
$limit = date('Y-m-01');
|
|
|
|
if ($hak>=3) {
|
|
$awal = $this->Amod->generate_subYear($limit, 1);
|
|
} else if ($hak>0) {
|
|
$awal = $this->Amod->generate_subMonth($limit, 2);
|
|
} else {
|
|
$awal = $now;
|
|
}
|
|
|
|
$value = 0;
|
|
$datPenjualan = $this->Amod->getData_Penjualan_byID_bySTATUS($id_penjualan, 1);
|
|
if ($datPenjualan==FALSE) {
|
|
$value = 8;
|
|
} else {
|
|
$datSpr = $this->Amod->getData_SoProyek_bySO($datPenjualan[0]['SO_ID']);
|
|
if ($datSpr==TRUE AND $datPenjualan[0]['GP_SO']==1 AND $gp_so==0) {
|
|
$value = 7;
|
|
} else if ($datSpr==TRUE AND $menu==4) {
|
|
$value = 7;
|
|
} else {
|
|
if ($hak<3 AND strtotime($datPenjualan[0]['TGL_PENJUALAN'])<strtotime($limit) AND $menu<=4) {
|
|
$value = 6;
|
|
} else if (strtotime($datPenjualan[0]['TGL_PENJUALAN'])<strtotime($awal)) {
|
|
$value = 5;
|
|
} else {
|
|
$datPelanggan = $this->Amod->getData_Pelanggan_byID($id_pelanggan);
|
|
if ($datPenjualan[0]['PEL_ID']!=$id_pelanggan) {
|
|
$sumDo = $this->Amod->getSum_DaftarOrder_byPENJUALAN($id_penjualan);
|
|
if ($sumDo[0]['TOTAL']==NULL) {
|
|
$tot = 0;
|
|
} else {
|
|
$dpp = $sumDo[0]['TOTAL'];
|
|
$pp = round((($datPenjualan[0]['PPN_SO']/100)*$dpp),2);
|
|
$tot = round(($dpp+$pp),2);
|
|
}
|
|
|
|
$sumPda = $this->Amod->getSum_DaftarAkuntansi_byPELANGGAN_byPERKIRAAN($id_pelanggan, 3);
|
|
if ($sumPda[0]['DEBET']==NULL) {
|
|
$debet_pda = 0;
|
|
$kredit_pda = 0;
|
|
} else {
|
|
$debet_pda = $sumPda[0]['DEBET'];
|
|
$kredit_pda = $sumPda[0]['KREDIT'];
|
|
}
|
|
|
|
$sumDoAktif = $this->Amod->getSum_DaftarOrder_byPELANGGAN_status0_2_3($id_pelanggan);
|
|
if ($sumDoAktif[0]['TOTAL']==NULL) {
|
|
$doAktif = 0;
|
|
} else {
|
|
$doAktif = round($sumDoAktif[0]['TOTAL']);
|
|
}
|
|
|
|
$limit = $datPelanggan[0]['LIMIT_PELANGGAN']-$tot-$doAktif-$debet_pda+$kredit_pda;
|
|
if ($limit<0) {
|
|
$value = 4;
|
|
} else {
|
|
$value = 0;
|
|
}
|
|
}
|
|
if ($value==0) {
|
|
$datHhbfe = $this->Amod->getData_HasilHitungBfe_byPENJUALAN($id_penjualan);
|
|
if ($datHhbfe==FALSE) {
|
|
$feePaid = 0;
|
|
} else {
|
|
$feePaid = $datHhbfe[0]['DEBET_HHBFE'];
|
|
}
|
|
if ($fee_so<$feePaid) {
|
|
$value = 3;
|
|
} else {
|
|
$datDakPda = $this->Amod->getData_DaftarAkuntansi_byPERKIRAAN_byPENJUALAN(3, $id_penjualan);
|
|
if (count($datDakPda)>1 AND $menu==3) {
|
|
$value = 2;
|
|
} else {
|
|
if ($menu==1) {
|
|
if ($datHhbfe==TRUE) {
|
|
$update = [
|
|
'PEL_ID' => $id_pelanggan
|
|
];
|
|
$action = $this->Amod->update('hasil_hitungbfe', $update, 'ID_HHBFE', $datHhbfe[0]['ID_HHBFE']);
|
|
}
|
|
|
|
$datHhpda = $this->Amod->getData_HasilHitungPda_byPENJUALAN($id_penjualan);
|
|
$update = [
|
|
'PELANGGAN_ID' => $id_pelanggan
|
|
];
|
|
$action = $this->Amod->update('hasil_hitungpda', $update, 'ID_HHPDA', $datHhpda[0]['ID_HHPDA']);
|
|
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byPENJUALAN($id_penjualan);
|
|
foreach ($datDak as $key) {
|
|
if ($key['PELANGGAN_ID']!=NULL) {
|
|
$update = [
|
|
'PELANGGAN_ID' => $id_pelanggan
|
|
];
|
|
$action = $this->Amod->update('daftar_akuntansi', $update, 'ID_DAK', $key['ID_DAK']);
|
|
}
|
|
}
|
|
|
|
$update = [
|
|
'PELANGGAN_ID' => $id_pelanggan
|
|
];
|
|
$action = $this->Amod->update('sales_order', $update, 'ID_SO', $datPenjualan[0]['SO_ID']);
|
|
} else if ($menu==2) {
|
|
$update = [
|
|
'SALES_ID' => $id_sales
|
|
];
|
|
$action = $this->Amod->update('sales_order', $update, 'ID_SO', $datPenjualan[0]['SO_ID']);
|
|
} else if ($menu==3) {
|
|
$sumDo = $this->Amod->getSum_DaftarOrder_byPENJUALAN($id_penjualan);
|
|
$dpp = $sumDo[0]['TOTAL'];
|
|
if ($ppn_so!=$datPenjualan[0]['PPN_SO']) {
|
|
$datHhpda = $this->Amod->getData_HasilHitungPda_byPENJUALAN($id_penjualan);
|
|
$datDakPk = $this->Amod->getData_DaftarAkuntansi_byPERKIRAAN_byPENJUALAN(83, $id_penjualan);
|
|
if ($datDakPk==TRUE) {
|
|
if ($datPenjualan[0]['PPN_SO']>0 AND $ppn_so==0) {
|
|
$action = $this->Amod->delete('daftar_akuntansi', $datDakPk[0]['ID_DAK'], 'ID_DAK');
|
|
$pk = 0;
|
|
} else {
|
|
$pk = round((($ppn_so/100)*$dpp),2);
|
|
|
|
$updatePk = [
|
|
'KREDIT_DAK' => $pk
|
|
];
|
|
$action = $this->Amod->update('daftar_akuntansi', $updatePk, 'ID_DAK', $datDakPk[0]['ID_DAK']);
|
|
}
|
|
} else {
|
|
$kode_penjualan = $datPenjualan[0]['KODE_PENJUALAN'];
|
|
$datAkuntansi = $this->Amod->getData_Akuntansi_byKODE($kode_penjualan);
|
|
$pk = round((($ppn_so/100)*$dpp),2);
|
|
|
|
$input = [
|
|
'AKUNTANSI_ID' => $datAkuntansi[0]['ID_AKUNTANSI'],
|
|
'PERKIRAAN_ID' => '83',
|
|
'CIPTA_DAK' => "Oleh $panggilan pada $timestamp",
|
|
'JENIS_DAK' => '0',
|
|
'DEBET_DAK' => '0',
|
|
'KREDIT_DAK' => $pk,
|
|
'KET_DAK' => "Pajak Keluaran Kode : [$kode_penjualan]",
|
|
'PELANGGAN_ID' => $datPenjualan[0]['PEL_ID'],
|
|
'PENJUALAN_ID' => $id_penjualan
|
|
];
|
|
$action = $this->Amod->create('daftar_akuntansi', $input);
|
|
}
|
|
|
|
$datDakPda0 = $this->Amod->getData_DaftarAkuntansi_byPENJUALAN_byPERKIRAAN_jenis0($id_penjualan, 3);
|
|
|
|
$pdaNew = $pk+$dpp;
|
|
$updatePda = [
|
|
'DEBET_DAK' => $pdaNew
|
|
];
|
|
$action = $this->Amod->update('daftar_akuntansi', $updatePda, 'ID_DAK', $datDakPda0[0]['ID_DAK']);
|
|
|
|
$updateHhpda = [
|
|
'DEBET_HHPDA' => $pdaNew
|
|
];
|
|
$action = $this->Amod->update('hasil_hitungpda', $updateHhpda, 'ID_HHPDA', $datHhpda[0]['ID_HHPDA']);
|
|
|
|
$update = [
|
|
'PPN_SO' => $ppn_so,
|
|
'NILAI_SO' => $pdaNew,
|
|
];
|
|
$action = $this->Amod->update('sales_order', $update, 'ID_SO', $datPenjualan[0]['SO_ID']);
|
|
}
|
|
} else if ($menu==4) {
|
|
if ($fee_so==0) {
|
|
$action = $this->Amod->delete('hasil_hitungbfe', $id_penjualan, 'PENJUALAN_ID');
|
|
} else {
|
|
if ($datHhbfe==FALSE) {
|
|
$input = [
|
|
'PENJUALAN_ID' => $id_penjualan,
|
|
'PEL_ID' => $datPenjualan[0]['PEL_ID'],
|
|
'KREDIT_HHBFE' => $fee_so,
|
|
'DEBET_HHBFE' => '0',
|
|
'STATUS_HHBFE' => '0',
|
|
'LAST_HHBFE' => $timestamp
|
|
];
|
|
$action = $this->Amod->create('hasil_hitungbfe', $input);
|
|
} else {
|
|
$debet_hhbfe = $datHhbfe[0]['DEBET_HHBFE'];
|
|
if ($fee_so==$debet_hhbfe) {
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byPENJUALAN_byPERKIRAAN_orderDESC_limit1($id_penjualan, 64);
|
|
$update = [
|
|
'KREDIT_HHBFE' => $fee_so,
|
|
'STATUS_HHBFE' => '1',
|
|
'LAST_HHBFE' => $timestamp,
|
|
'TGLLOCK_HHBFE' => $now,
|
|
'LUNAS_HHBFE' => $datDak[0]['KODE_AKUNTANSI']
|
|
];
|
|
} else {
|
|
if ($fee_so<$debet_hhbfe) {
|
|
$status_hhbfe = 2;
|
|
} else {
|
|
$status_hhbfe = 0;
|
|
}
|
|
$update = [
|
|
'KREDIT_HHBFE' => $fee_so,
|
|
'STATUS_HHBFE' => $status_hhbfe,
|
|
'LAST_HHBFE' => $timestamp,
|
|
'TGLLOCK_HHBFE' => NULL,
|
|
'LUNAS_HHBFE' => NULL
|
|
];
|
|
}
|
|
$action = $this->Amod->update('hasil_hitungbfe', $update, 'ID_HHBFE', $datHhbfe[0]['ID_HHBFE']);
|
|
}
|
|
}
|
|
|
|
$update = [
|
|
'FEE_SO' => $fee_so
|
|
];
|
|
$action = $this->Amod->update('sales_order', $update, 'ID_SO', $datPenjualan[0]['SO_ID']);
|
|
|
|
$datFfp = $this->Amod->getData_FormFeePelanggan_byPENJUALAN($id_penjualan);
|
|
if ($datFfp==TRUE) {
|
|
$update = [
|
|
'NILAI_FFP' => $fee_so,
|
|
];
|
|
$action = $this->Amod->update('form_feepelanggan', $update, 'ID_FFP', $datFfp[0]['ID_FFP']);
|
|
}
|
|
} else if ($menu==5) {
|
|
$update = [
|
|
'GP_SO' => $gp_so
|
|
];
|
|
$action = $this->Amod->update('sales_order', $update, 'ID_SO', $datPenjualan[0]['SO_ID']);
|
|
} else if ($menu==6) {
|
|
$update = [
|
|
'PO_SO' => $po_so
|
|
];
|
|
$action = $this->Amod->update('sales_order', $update, 'ID_SO', $datPenjualan[0]['SO_ID']);
|
|
} else if ($menu==9) {
|
|
$update = [
|
|
'KET_SO_O' => $ket_so_o
|
|
];
|
|
$action = $this->Amod->update('sales_order', $update, 'ID_SO', $datPenjualan[0]['SO_ID']);
|
|
}
|
|
|
|
if ($menu==1) {
|
|
$update = [
|
|
'REVISI_PENJUALAN' => "Oleh $panggilan pada $timestamp",
|
|
'PEL_ID' => $id_pelanggan
|
|
];
|
|
} else if ($menu==7) {
|
|
$update = [
|
|
'REVISI_PENJUALAN' => "Oleh $panggilan pada $timestamp",
|
|
'FP_PENJUALAN' => $fp_penjualan
|
|
];
|
|
} else if ($menu==8) {
|
|
$tempo_penjualan = $this->Amod->generate_addDay($tt_penjualan, $datPelanggan[0]['TOP_PELANGGAN']);
|
|
$update = [
|
|
'REVISI_PENJUALAN' => "Oleh $panggilan pada $timestamp",
|
|
'TT_PENJUALAN' => $tt_penjualan,
|
|
'TEMPO_PENJUALAN' => $tempo_penjualan
|
|
];
|
|
} else {
|
|
$update = [
|
|
'REVISI_PENJUALAN' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
}
|
|
$action = $this->Amod->update('penjualan', $update, 'ID_PENJUALAN', $id_penjualan);
|
|
|
|
$value = 1;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
}
|
|
|
|
public function PJ_Ubah_Sub1_F1_DataDaftarOrder() {
|
|
$id_do = $this->input->post('id_do');
|
|
$id_so = $this->input->post('id_so');
|
|
$harga_do = $this->input->post('harga_do');
|
|
$komisi_do = $this->input->post('komisi_do');
|
|
$sp_do = $this->input->post('sp_do');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$limit = date('Y-m-01');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
if ($sp_do=="") {
|
|
$sp_do = NULL;
|
|
}
|
|
|
|
$value = 0;
|
|
$datPenjualan = $this->Amod->getData_Penjualan_bySO_bySTATUS($id_so, 1);
|
|
if ($datPenjualan==FALSE) {
|
|
$value = 4;
|
|
} else {
|
|
$datDo = $this->Amod->getData_DaftarOrder_byID($id_do);
|
|
if ($datDo==FALSE) {
|
|
$value = 3;
|
|
} else {
|
|
if (strtotime($datPenjualan[0]['TGL_PENJUALAN'])<strtotime($limit) AND $datDo[0]['HARGA_DO']!=$harga_do) {
|
|
$value = 2;
|
|
} else {
|
|
$harga_do = round($harga_do, 2);
|
|
$komisi_do = round($komisi_do, 2);
|
|
if ($datDo[0]['HARGA_DO']!=$harga_do) {
|
|
$update = [
|
|
'HARGA_DO' => $harga_do
|
|
];
|
|
$action = $this->Amod->update('daftar_order', $update, 'ID_DO', $id_do);
|
|
|
|
$sumDo = $this->Amod->getSum_DaftarOrder_bySO($id_so);
|
|
if ($sumDo[0]['TOTAL']==NULL) {
|
|
$dpp = 0;
|
|
} else {
|
|
$dpp = $sumDo[0]['TOTAL'];
|
|
}
|
|
$pk = round(((($datPenjualan[0]['PPN_SO'])/100)*$dpp),2);
|
|
$totDo = round(($dpp+$pk),2);
|
|
|
|
$datHhpda = $this->Amod->getData_HasilHitungPda_byPENJUALAN($datPenjualan[0]['ID_PENJUALAN']);
|
|
$update = [
|
|
'DEBET_HHPDA' => $totDo
|
|
];
|
|
$action = $this->Amod->update('hasil_hitungpda', $update, 'ID_HHPDA', $datHhpda[0]['ID_HHPDA']);
|
|
|
|
$datDak1 = $this->Amod->getData_DaftarAkuntansi_byPERKIRAAN_byPENJUALAN(3, $datPenjualan[0]['ID_PENJUALAN']);
|
|
$update = [
|
|
'DEBET_DAK' => $totDo
|
|
];
|
|
$action = $this->Amod->update('daftar_akuntansi', $update, 'ID_DAK', $datDak1[0]['ID_DAK']);
|
|
|
|
$datDak2 = $this->Amod->getData_DaftarAkuntansi_byPERKIRAAN_byPENJUALAN(23, $datPenjualan[0]['ID_PENJUALAN']);
|
|
$update = [
|
|
'KREDIT_DAK' => $dpp
|
|
];
|
|
$action = $this->Amod->update('daftar_akuntansi', $update, 'ID_DAK', $datDak2[0]['ID_DAK']);
|
|
|
|
$datDak3 = $this->Amod->getData_DaftarAkuntansi_byPERKIRAAN_byPENJUALAN(83, $datPenjualan[0]['ID_PENJUALAN']);
|
|
if ($datDak3==TRUE) {
|
|
$update = [
|
|
'KREDIT_DAK' => $pk
|
|
];
|
|
$action = $this->Amod->update('daftar_akuntansi', $update, 'ID_DAK', $datDak3[0]['ID_DAK']);
|
|
}
|
|
|
|
$update = [
|
|
'NILAI_SO' => $totDo
|
|
];
|
|
$acton = $this->Amod->update('sales_order', $update, 'ID_SO', $id_so);
|
|
}
|
|
|
|
if ($datDo[0]['KOMISI_DO']!=$komisi_do) {
|
|
$update = [
|
|
'KOMISI_DO' => $komisi_do
|
|
];
|
|
$action = $this->Amod->update('daftar_order', $update, 'ID_DO', $id_do);
|
|
}
|
|
|
|
if ($datDo[0]['SP_DO']!=$sp_do) {
|
|
$update = [
|
|
'SP_DO' => $sp_do
|
|
];
|
|
$action = $this->Amod->update('daftar_order', $update, 'ID_DO', $id_do);
|
|
}
|
|
|
|
if ($datDo[0]['HARGA_DO']!=$harga_do OR $datDo[0]['KOMISI_DO']!=$komisi_do OR $datDo[0]['SP_DO']!=$sp_do) {
|
|
$update = [
|
|
'REVISI_PENJUALAN' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('penjualan', $update, 'ID_PENJUALAN', $datPenjualan[0]['ID_PENJUALAN']);
|
|
}
|
|
|
|
$value = 1;
|
|
}
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
}
|
|
|
|
public function PJ_Ubah_Sub1_F1_DataPenjualanNull() {
|
|
$id_penjualan = $this->input->post('id_penjualanfpNull');
|
|
$fp_penjualan = $this->input->post('fp_penjualanNull');
|
|
$tt_penjualan = $this->input->post('tt_penjualanNull');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$now = date('Y-m-d');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$datPenjualan = $this->Amod->getData_Penjualan_byID_bySTATUS($id_penjualan, 1);
|
|
if ($datPenjualan==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
if ($fp_penjualan=="") {
|
|
$fp_penjualan = NULL;
|
|
}
|
|
|
|
if ($tt_penjualan=="") {
|
|
$tt_penjualan = NULL;
|
|
|
|
$update = [
|
|
'FP_PENJUALAN' => $fp_penjualan,
|
|
'TT_PENJUALAN' => $tt_penjualan,
|
|
'REVISI_PENJUALAN' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
} else {
|
|
$datPelanggan = $this->Amod->getData_Pelanggan_byID($datPenjualan[0]['PEL_ID']);
|
|
$tempo_penjualan = $this->Amod->generate_addDay($tt_penjualan, $datPelanggan[0]['TOP_PELANGGAN']);
|
|
|
|
$update = [
|
|
'FP_PENJUALAN' => $fp_penjualan,
|
|
'TT_PENJUALAN' => $tt_penjualan,
|
|
'TEMPO_PENJUALAN' => $tempo_penjualan,
|
|
'REVISI_PENJUALAN' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
}
|
|
|
|
$action = $this->Amod->update('penjualan', $update, 'ID_PENJUALAN', $id_penjualan);
|
|
|
|
if ($action) {
|
|
$this->session->set_flashdata('success', 'diubah');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
} else {
|
|
$this->session->set_flashdata('failed', 'diubah');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
}
|
|
|
|
//SUBMENU PUSAT DATA - CETAK DOKUMEN
|
|
public function PJ_Sub2_CetakDokumen_1() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$now = date('Y-m-d');
|
|
$limit = date('Y-m-01');
|
|
$month = $this->Amod->generate_inisialMonth(date('m'));
|
|
$year = date('Y');
|
|
$timelimit = strtoupper("$month $year");
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "PJ", "PUSAT DATA - Cetak Dokumen");
|
|
$id_menu = $datShm[0]['MENU_ID'];
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
if ($hak>0) {
|
|
$salesOrder = $this->Amod->getData_SalesOrder_byPERIODE_orderDESC($limit, $now);
|
|
$countSo = count($salesOrder);
|
|
} else {
|
|
$salesOrder = NULL;
|
|
$countSo = 0;
|
|
}
|
|
|
|
if ($hak>1) {
|
|
$sjPenjualan = $this->Amod->getData_Penjualan_bySJINV_byPERIODE_notCetak_orderDESC(0, $limit, $now);
|
|
$sjParsial = $this->Amod->getData_DaftarSjParsial_byPERIODE_notCetak_groupCD($limit, $now);
|
|
$countSjPenjualan = count($sjPenjualan);
|
|
$countSjParsial = count($sjParsial);
|
|
} else {
|
|
$sjPenjualan = NULL;
|
|
$sjParsial = NULL;
|
|
$countSjPenjualan = 0;
|
|
$countSjParsial = 0;
|
|
}
|
|
|
|
if ($hak>2) {
|
|
$invPenjualan = $this->Amod->getData_Penjualan_bySJINV_byPERIODE_notCetak_orderDESC(1, $limit, $now);
|
|
$countInvPenjualan = count($invPenjualan);
|
|
} else {
|
|
$invPenjualan = NULL;
|
|
$countInvPenjualan = 0;
|
|
}
|
|
|
|
$datStpos = $this->Amod->getData_SetTogglePosisi_byKARYAWAN_byMENU($id_karyawan, $id_menu);
|
|
if ($datStpos==FALSE) { $posisiToggle = 0; } else { $posisiToggle = $datStpos[0]['AKTIF_STPOS']; }
|
|
|
|
$data = array(
|
|
'sidebar' => "menu penjualan",
|
|
'navChild' => "penjualan cetak",
|
|
'tgl' => $now,
|
|
'sjPenjualan' => $sjPenjualan,
|
|
'sjParsial' => $sjParsial,
|
|
'invPenjualan' => $invPenjualan,
|
|
'salesOrder' => $salesOrder,
|
|
'countSjPenjualan' => $countSjPenjualan,
|
|
'countSjParsial' => $countSjParsial,
|
|
'countInvPenjualan' => $countInvPenjualan,
|
|
'countSo' => $countSo,
|
|
'posisiToggle' => $posisiToggle,
|
|
'id_menu' => $id_menu,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil,
|
|
'timelimit' => $timelimit,
|
|
);
|
|
$this->load->view('proses/PJ_Sub2_CetakDokumen_1', $data);
|
|
}
|
|
|
|
public function PJ_Ambil_Sub2_A1_DataDaftarOrder() {
|
|
$verse = $this->input->post('verse');
|
|
$id_penjualan = $this->input->post('id_penjualan');
|
|
$id_so = $this->input->post('id_so');
|
|
|
|
if ($verse==0 OR $verse==1) {
|
|
$datPenjualan = $this->Amod->getData_Penjualan_byID_bySTATUS($id_penjualan, 1);
|
|
$data = $this->Amod->getData_DaftarOrder_byPENJUALAN($id_penjualan);
|
|
$no = 0;
|
|
if ($verse==0) {
|
|
foreach ($data as $key) {
|
|
$datSnj = $this->Amod->getData_SnJual_byDO($key['ID_DO']);
|
|
$sn = "";
|
|
$nosn = 1;
|
|
foreach ($datSnj as $dat) {
|
|
$nama_snj = $dat['NAMA_SNJ'];
|
|
if ($nosn==count($datSnj)) {
|
|
$sn .= "$nama_snj";
|
|
} else {
|
|
$sn .= "$nama_snj, ";
|
|
$nosn++;
|
|
}
|
|
}
|
|
$data[$no++] += ['SN' => $sn];
|
|
}
|
|
|
|
$dppDo = 0;
|
|
$ppnDo = 0;
|
|
$totDo = 0;
|
|
} else if ($verse==1) {
|
|
foreach ($data as $key) {
|
|
$satuan = $key['HARGA_DO'];
|
|
$subtotal = $key['HARGA_DO']*$key['QTY_DO'];
|
|
|
|
$data[$no] += ['SATUAN' => number_format($satuan,2)];
|
|
$data[$no++] += ['SUBTOTAL' => number_format($subtotal,2)];
|
|
}
|
|
|
|
$sumPda = $this->Amod->getSum_DaftarOrder_byPENJUALAN($id_penjualan);
|
|
if ($sumPda[0]['TOTAL']==NULL) {
|
|
$dppDo = 0;
|
|
$ppnDo = 0;
|
|
$totDo = 0;
|
|
} else {
|
|
$dppDo = round($sumPda[0]['TOTAL'],2);
|
|
$ppnDo = round(($sumPda[0]['TOTAL']*($datPenjualan[0]['PPN_SO']/100)),2);
|
|
$totDo = round(($dppDo+$ppnDo),2);
|
|
}
|
|
}
|
|
$nama_pelanggan = $datPenjualan[0]['NAMA_PELANGGAN'];
|
|
} else if ($verse==2) {
|
|
$datSo = $this->Amod->getData_SalesOrder_byID($id_so);
|
|
$data = $this->Amod->getData_DaftarOrder_bySO($id_so);
|
|
$nama_pelanggan = $datSo[0]['NAMA_PELANGGAN'];
|
|
$no = 0;
|
|
|
|
foreach ($data as $key) {
|
|
$satuan = $key['HARGA_DO'];
|
|
$subtotal = $key['HARGA_DO']*$key['QTY_DO'];
|
|
|
|
$data[$no] += ['SATUAN' => number_format($satuan,2)];
|
|
$data[$no++] += ['SUBTOTAL' => number_format($subtotal,2)];
|
|
}
|
|
|
|
$sumPda = $this->Amod->getSum_DaftarOrder_bySO($id_so);
|
|
if ($sumPda[0]['TOTAL']==NULL) {
|
|
$dppDo = 0;
|
|
$ppnDo = 0;
|
|
$totDo = 0;
|
|
} else {
|
|
$dppDo = round($sumPda[0]['TOTAL'],2);
|
|
$ppnDo = round(($sumPda[0]['TOTAL']*($datSo[0]['PPN_SO']/100)),2);
|
|
$totDo = round(($dppDo+$ppnDo),2);
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'total' => sizeof($data),
|
|
'data' => $data,
|
|
'nama_pelanggan' => $nama_pelanggan,
|
|
'dppDo' => number_format($dppDo,2),
|
|
'ppnDo' => number_format($ppnDo,2),
|
|
'totDo' => number_format($totDo,2),
|
|
]);
|
|
}
|
|
|
|
public function PJ_Ambil_Sub2_A1_DataDaftarSjParsial() {
|
|
$id_cd = $this->input->post('id_cd');
|
|
|
|
$datCd = $this->Amod->getData_CetakDokumen_byID($id_cd);
|
|
|
|
$data = $this->Amod->getData_DaftarSjParsial_byCD($id_cd);
|
|
$no = 0;
|
|
foreach ($data as $key) {
|
|
$datSnsj = $this->Amod->getData_SnSjParsial_bySJP($key['ID_SJP']);
|
|
$sn = "";
|
|
$nosn = 1;
|
|
foreach ($datSnsj as $dat) {
|
|
$nama_snsj = $dat['NAMA_SNSJ'];
|
|
if ($nosn==count($datSnsj)) {
|
|
$sn .= "$nama_snsj";
|
|
} else {
|
|
$sn .= "$nama_snsj, ";
|
|
$nosn++;
|
|
}
|
|
}
|
|
$data[$no++] += ['SN' => $sn];
|
|
}
|
|
|
|
$this->output_json([
|
|
'total' => sizeof($data),
|
|
'data' => $data,
|
|
'nama_pelanggan' => $data[0]['NAMA_PELANGGAN'],
|
|
'kode_bukti' => $datCd[0]['KODE_BUKTI'],
|
|
]);
|
|
}
|
|
|
|
public function PJ_Ubah_Sub2_A1_DataDaftarOrder() {
|
|
$id_penjualan = $this->input->post('id_penjualan');
|
|
$id_do = $this->input->post('id_do');
|
|
$nama_do = $this->input->post('nama_do');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$value = 0;
|
|
$datPenjualan = $this->Amod->getData_Penjualan_byID_bySTATUS($id_penjualan, 1);
|
|
if ($datPenjualan==FALSE) {
|
|
$value = 3;
|
|
} else {
|
|
$datDo = $this->Amod->getData_DaftarOrder_byID($id_do);
|
|
if ($datDo==FALSE) {
|
|
$value = 2;
|
|
} else {
|
|
if ($datDo[0]['NAMA_DO']!=$nama_do) {
|
|
$update = [
|
|
'UBAH_DO' => "Oleh $panggilan pada $timestamp",
|
|
'NAMA_DO' => $nama_do
|
|
];
|
|
$action = $this->Amod->update('daftar_order', $update, 'ID_DO', $id_do);
|
|
}
|
|
|
|
$value = 1;
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
}
|
|
|
|
public function PJ_Ubah_Sub2_A1_DataDaftarSjParsial() {
|
|
$id_cd = $this->input->post('id_cd');
|
|
$id_sjp = $this->input->post('id_sjp');
|
|
$nama_sjp = $this->input->post('nama_sjp');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$value = 0;
|
|
$datCd = $this->Amod->getData_CetakDokumen_byID($id_cd);
|
|
if ($datCd==FALSE) {
|
|
$value = 3;
|
|
} else {
|
|
$datSjp = $this->Amod->getData_DaftarSjParsial_byID($id_sjp);
|
|
if ($datSjp==FALSE) {
|
|
$value = 2;
|
|
} else {
|
|
if ($datSjp[0]['NAMA_SJP']!=$nama_sjp) {
|
|
$update = [
|
|
'UBAH_SJP' => "Oleh $panggilan pada $timestamp",
|
|
'NAMA_SJP' => $nama_sjp
|
|
];
|
|
$action = $this->Amod->update('daftar_sjparsial', $update, 'ID_SJP', $id_sjp);
|
|
}
|
|
|
|
$value = 1;
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
}
|
|
|
|
public function PJ_Sub2_CetakDokumen_2() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$now = date('Y-m-d');
|
|
$limit = date('Y-m-01');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "PJ", "PUSAT DATA - Cetak Dokumen");
|
|
$id_menu = $datShm[0]['MENU_ID'];
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
if ($hak<=3) {
|
|
$limit = $this->Amod->generate_subMonth($limit, 12);
|
|
$timelimit = strtoupper("1 Tahun Kebelakang");
|
|
} else {
|
|
$limit = $this->Amod->generate_subMonth($limit, 6);
|
|
$timelimit = strtoupper("6 Bulan Kebelakang");
|
|
}
|
|
|
|
if ($hak>1) {
|
|
$sjPenjualan = $this->Amod->getData_Penjualan_bySJINV_byPERIODE_orderDESC(0, $limit, $now);
|
|
$no = 0;
|
|
foreach ($sjPenjualan as $key) {
|
|
$countHcd = $this->Amod->getCount_HistoriCetakDokumen_byCD($key['ID_CD']);
|
|
if ($countHcd==0) {
|
|
$lastCetak = "";
|
|
} else {
|
|
$datHcd = $this->Amod->getData_HistoriCetakDokumen_byCD_orderDESC_limit1($key['ID_CD']);
|
|
$lastCetak = $datHcd[0]['CETAK_HCD'];
|
|
}
|
|
$sjPenjualan[$no++] += ['LAST' => $lastCetak];
|
|
}
|
|
|
|
$sjParsial = $this->Amod->getData_DaftarSjParsial_byPERIODE_groupCD($limit, $now);
|
|
$no = 0;
|
|
foreach ($sjParsial as $key) {
|
|
$countHcd = $this->Amod->getCount_HistoriCetakDokumen_byCD($key['CD_ID']);
|
|
if ($countHcd==0) {
|
|
$lastCetak = "";
|
|
} else {
|
|
$datHcd = $this->Amod->getData_HistoriCetakDokumen_byCD_orderDESC_limit1($key['CD_ID']);
|
|
$lastCetak = $datHcd[0]['CETAK_HCD'];
|
|
}
|
|
$sjParsial[$no++] += ['LAST' => $lastCetak];
|
|
}
|
|
|
|
$countSjPenjualan = count($sjPenjualan);
|
|
$countSjParsial = count($sjParsial);
|
|
} else {
|
|
$sjPenjualan = NULL;
|
|
$sjParsial = NULL;
|
|
$countSjPenjualan = 0;
|
|
$countSjParsial = 0;
|
|
}
|
|
|
|
if ($hak>2) {
|
|
$invPenjualan = $this->Amod->getData_Penjualan_bySJINV_byPERIODE_orderDESC(1, $limit, $now);
|
|
$no = 0;
|
|
foreach ($invPenjualan as $key) {
|
|
$countHcd = $this->Amod->getCount_HistoriCetakDokumen_byCD($key['ID_CD']);
|
|
if ($countHcd==0) {
|
|
$lastCetak = "";
|
|
} else {
|
|
$datHcd = $this->Amod->getData_HistoriCetakDokumen_byCD_orderDESC_limit1($key['ID_CD']);
|
|
$lastCetak = $datHcd[0]['CETAK_HCD'];
|
|
}
|
|
$invPenjualan[$no++] += ['LAST' => $lastCetak];
|
|
}
|
|
|
|
$countInvPenjualan = count($invPenjualan);
|
|
} else {
|
|
$invPenjualan = NULL;
|
|
$countInvPenjualan = 0;
|
|
}
|
|
|
|
if ($hak>0) {
|
|
$salesOrder = $this->Amod->getData_SalesOrder_byPERIODE_orderDESC($limit, $now);
|
|
$countSo = count($salesOrder);
|
|
} else {
|
|
$salesOrder = NULL;
|
|
$countSo = 0;
|
|
}
|
|
|
|
$datStpos = $this->Amod->getData_SetTogglePosisi_byKARYAWAN_byMENU($id_karyawan, $id_menu);
|
|
if ($datStpos==FALSE) { $posisiToggle = 0; } else { $posisiToggle = $datStpos[0]['AKTIF_STPOS']; }
|
|
|
|
$data = array(
|
|
'sidebar' => "menu penjualan",
|
|
'navChild' => "penjualan cetak",
|
|
'tgl' => $now,
|
|
'sjPenjualan' => $sjPenjualan,
|
|
'sjParsial' => $sjParsial,
|
|
'invPenjualan' => $invPenjualan,
|
|
'salesOrder' => $salesOrder,
|
|
'countSjPenjualan' => $countSjPenjualan,
|
|
'countSjParsial' => $countSjParsial,
|
|
'countInvPenjualan' => $countInvPenjualan,
|
|
'countSo' => $countSo,
|
|
'posisiToggle' => $posisiToggle,
|
|
'id_menu' => $id_menu,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil,
|
|
'timelimit' => $timelimit,
|
|
);
|
|
$this->load->view('proses/PJ_Sub2_CetakDokumen_2', $data);
|
|
}
|
|
|
|
public function PJ_Ambil_Sub2_A2_DataHistoriCetakDokumen() {
|
|
$id_cd = $this->input->post('id_cd');
|
|
$verse = $this->input->post('verse');
|
|
|
|
$datCd = $this->Amod->getData_CetakDokumen_byID($id_cd);
|
|
$datHcd = $this->Amod->getData_HistoriCetakDokumen_byCD_orderDESC_limit1($id_cd);
|
|
if ($datHcd==FALSE) {
|
|
$tgl_hcd = date('Y-m-d');
|
|
$kertas_hcd = 1;
|
|
$dp_hcd = 0;
|
|
if ($verse==1 OR $verse==2) {
|
|
$sn_hcd = 1;
|
|
$ppn_hcd = 0;
|
|
} else if ($verse==3) {
|
|
$sn_hcd = 0;
|
|
$ppn_hcd = 1;
|
|
}
|
|
} else {
|
|
$tgl_hcd = $datHcd[0]['TGL_HCD'];
|
|
$kertas_hcd = $datHcd[0]['KERTAS_HCD'];
|
|
$sn_hcd = $datHcd[0]['SN_HCD'];
|
|
$ppn_hcd = $datHcd[0]['PPN_HCD'];
|
|
$dp_hcd = $datHcd[0]['DP_HCD'];
|
|
}
|
|
|
|
if ($datCd[0]['DP_CD']==NULL) {
|
|
$dp_cd = 0;
|
|
} else {
|
|
$dp_cd = $datCd[0]['DP_CD'];
|
|
}
|
|
|
|
$this->output_json([
|
|
'tgl_hcd' => $tgl_hcd,
|
|
'kertas_hcd' => $kertas_hcd,
|
|
'sn_hcd' => $sn_hcd,
|
|
'ppn_hcd' => $ppn_hcd,
|
|
'dp_hcd' => $dp_hcd,
|
|
'dp_cd' => $dp_cd,
|
|
]);
|
|
}
|
|
|
|
public function PJ_Sub2_Cetak_1($mode) {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "PJ", "PUSAT DATA - Cetak Dokumen");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
if ($mode==1) {
|
|
$month = $this->Amod->generate_inisialMonth(date('m'));
|
|
$year = date('Y');
|
|
$timelimit = strtoupper("$month $year");
|
|
} else if ($mode==2) {
|
|
$timelimit = "SELURUH DATA";
|
|
}
|
|
|
|
$data = array(
|
|
'sidebar' => "menu penjualan",
|
|
'navChild' => "penjualan cetak",
|
|
'hak' => $hak,
|
|
'tampil' => $tampil,
|
|
'timelimit' => $timelimit,
|
|
'mode' => $mode,
|
|
'tgl' => date('Y-m-d'),
|
|
);
|
|
$this->load->view('proses/PJ_Sub2_Cetak_1', $data);
|
|
}
|
|
|
|
public function PJ_Ambil_RingkasanCetak() {
|
|
$mode = $this->input->post('mode');
|
|
if ($mode==1) {
|
|
$awal = date('Y-m-01');
|
|
$akhir = date('Y-m-d');
|
|
} else if ($mode==2) {
|
|
$awal = date('Y-m-01');
|
|
$akhir = date('Y-m-d');
|
|
}
|
|
|
|
$countSalesOrder = $this->Amod->getCount_SalesOrder_byPERIODE_forCetak($awal, $akhir);
|
|
$countSjPenjualan = $this->Amod->getCount_Penjualan_bySJINV_byPERIODE_notCetak_orderDESC(0, $awal, $akhir);
|
|
$countSjParsial = $this->Amod->getCount_DaftarSjParsial_byPERIODE_notCetak_groupCD($awal, $akhir);
|
|
$countInvPenjualan = $this->Amod->getCount_Penjualan_bySJINV_byPERIODE_notCetak_orderDESC(1, $awal, $akhir);
|
|
|
|
$this->output_json([
|
|
'countSalesOrder' => $countSalesOrder,
|
|
'countSjPenjualan' => $countSjPenjualan,
|
|
'countSjParsial' => $countSjParsial,
|
|
'countInvPenjualan' => $countInvPenjualan,
|
|
]);
|
|
}
|
|
|
|
//SUBMENU PUSAT DATA - INFORMASI
|
|
public function PJ_Sub2_Informasi_1($id=null, $mode) {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "PJ", "PUSAT DATA - Informasi");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
if ($id==null) {
|
|
$posisiToggle = 0;
|
|
} else {
|
|
$posisiToggle = $id;
|
|
}
|
|
|
|
$data = array(
|
|
'sidebar' => "menu penjualan",
|
|
'navChild' => "penjualan informasi",
|
|
'posisiToggle' => $posisiToggle,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil,
|
|
'mode' => $mode
|
|
);
|
|
$this->load->view('proses/PJ_Sub2_Informasi_1', $data);
|
|
}
|
|
|
|
//SUBMENU PUSAT DATA - LAPORAN
|
|
public function PJ_Sub2_Laporan_1() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "PJ", "PUSAT DATA - Laporan");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$data = array(
|
|
'sidebar' => "menu penjualan",
|
|
'navChild' => "penjualan laporan",
|
|
'hak' => $hak,
|
|
'tampil' => $tampil
|
|
);
|
|
$this->load->view('proses/PJ_Sub2_Laporan_1', $data);
|
|
}
|
|
|
|
public function PJ_Sub2_Penjualan_2() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$now = date('Y-m-d');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "PJ", "PUSAT DATA - Laporan");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$datPelanggan = $this->Amod->getData_Pelanggan_bySTATUS(1);
|
|
$datCorp = $this->Amod->getData_Corp_bySTATUS(1);
|
|
$datSales = $this->Amod->getData_Karyawan_allSales();
|
|
|
|
$data = array(
|
|
'sidebar' => "menu penjualan",
|
|
'navChild' => "penjualan laporan",
|
|
'tgl' => $now,
|
|
'pelanggan' => $datPelanggan,
|
|
'corp' => $datCorp,
|
|
'sales' => $datSales,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil
|
|
);
|
|
$this->load->view('proses/PJ_Sub2_Penjualan_2', $data);
|
|
}
|
|
|
|
public function PJ_Sub2_Retur_2() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$now = date('Y-m-d');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "PJ", "PUSAT DATA - Laporan");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$datPelanggan = $this->Amod->getData_Pelanggan_bySTATUS(1);
|
|
$datCorp = $this->Amod->getData_Corp_bySTATUS(1);
|
|
$datSales = $this->Amod->getData_Karyawan_allSales();
|
|
|
|
$data = array(
|
|
'sidebar' => "menu penjualan",
|
|
'navChild' => "penjualan laporan",
|
|
'tgl' => $now,
|
|
'pelanggan' => $datPelanggan,
|
|
'corp' => $datCorp,
|
|
'sales' => $datSales,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil
|
|
);
|
|
$this->load->view('proses/PJ_Sub2_Retur_2', $data);
|
|
}
|
|
|
|
public function PJ_Sub2_Batal_2() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$now = date('Y-m-d');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "PJ", "PUSAT DATA - Laporan");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$datPelanggan = $this->Amod->getData_Pelanggan_bySTATUS(1);
|
|
$datCorp = $this->Amod->getData_Corp_bySTATUS(1);
|
|
$datSales = $this->Amod->getData_Karyawan_allSales();
|
|
|
|
$data = array(
|
|
'sidebar' => "menu penjualan",
|
|
'navChild' => "penjualan laporan",
|
|
'tgl' => $now,
|
|
'pelanggan' => $datPelanggan,
|
|
'corp' => $datCorp,
|
|
'sales' => $datSales,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil
|
|
);
|
|
$this->load->view('proses/PJ_Sub2_Batal_2', $data);
|
|
}
|
|
|
|
public function PJ_Sub2_BarangSupplier_2() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$now = date('Y-m-d');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "PJ", "PUSAT DATA - Laporan");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$datSupplier = $this->Amod->getData_Supplier_bySTATUS(1);
|
|
$datCorp = $this->Amod->getData_Corp_bySTATUS(1);
|
|
|
|
$data = array(
|
|
'sidebar' => "menu penjualan",
|
|
'navChild' => "penjualan laporan",
|
|
'tgl' => $now,
|
|
'supplier' => $datSupplier,
|
|
'corp' => $datCorp,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil
|
|
);
|
|
$this->load->view('proses/PJ_Sub2_BarangSupplier_2', $data);
|
|
}
|
|
|
|
public function PJ_Sub2_KomisiGp_2() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$now = date('Y-m-d');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "PJ", "PUSAT DATA - Laporan");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$data = array(
|
|
'sidebar' => "menu penjualan",
|
|
'navChild' => "penjualan laporan",
|
|
'tgl' => $now,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil
|
|
);
|
|
$this->load->view('proses/PJ_Sub2_KomisiGp_2', $data);
|
|
}
|
|
|
|
public function PJ_Sub2_KomisiNonGp_2() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$now = date('Y-m-d');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "PJ", "PUSAT DATA - Laporan");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$datSales = $this->Amod->getData_Karyawan_allSales();
|
|
|
|
$data = array(
|
|
'sidebar' => "menu penjualan",
|
|
'navChild' => "penjualan laporan",
|
|
'tgl' => $now,
|
|
'sales' => $datSales,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil
|
|
);
|
|
$this->load->view('proses/PJ_Sub2_KomisiNonGp_2', $data);
|
|
}
|
|
|
|
public function PJ_Sub2_MarginPenjualan_2() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$now = date('Y-m-d');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "PJ", "PUSAT DATA - Laporan");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$datPelanggan = $this->Amod->getData_Pelanggan_bySTATUS(1);
|
|
$datCorp = $this->Amod->getData_Corp_bySTATUS(1);
|
|
$datSales = $this->Amod->getData_Karyawan_allSales();
|
|
|
|
$data = array(
|
|
'sidebar' => "menu penjualan",
|
|
'navChild' => "penjualan laporan",
|
|
'tgl' => $now,
|
|
'pelanggan' => $datPelanggan,
|
|
'corp' => $datCorp,
|
|
'sales' => $datSales,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil
|
|
);
|
|
$this->load->view('proses/PJ_Sub2_MarginPenjualan_2', $data);
|
|
}
|
|
|
|
public function PJ_Sub2_PencapaianSales_2() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$now = date('Y-m-d');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "PJ", "PUSAT DATA - Laporan");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$datSales = $this->Amod->getData_Karyawan_allSales();
|
|
|
|
$data = array(
|
|
'sidebar' => "menu penjualan",
|
|
'navChild' => "penjualan laporan",
|
|
'tgl' => $now,
|
|
'sales' => $datSales,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil
|
|
);
|
|
$this->load->view('proses/PJ_Sub2_PencapaianSales_2', $data);
|
|
}
|
|
|
|
public function PJ_Sub2_PenjualanHarian_2() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$now = date('Y-m-d');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "PJ", "PUSAT DATA - Laporan");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$datSales = $this->Amod->getData_Karyawan_allSales();
|
|
$datCorp = $this->Amod->getData_Corp_bySTATUS(1);
|
|
|
|
$data = array(
|
|
'sidebar' => "menu penjualan",
|
|
'navChild' => "penjualan laporan",
|
|
'tgl' => $now,
|
|
'sales' => $datSales,
|
|
'corp' => $datCorp,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil
|
|
);
|
|
$this->load->view('proses/PJ_Sub2_PenjualanHarian_2', $data);
|
|
}
|
|
|
|
public function PJ_Sub2_StokClearance_2() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$now = date('Y-m-d');
|
|
$setawal = date('2025-08-01');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "PJ", "PUSAT DATA - Laporan");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$data = array(
|
|
'sidebar' => "menu penjualan",
|
|
'navChild' => "penjualan laporan",
|
|
'tgl' => $now,
|
|
'awal' => $setawal,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil
|
|
);
|
|
$this->load->view('proses/PJ_Sub2_StokClearance_2', $data);
|
|
}
|
|
|
|
public function PJ_Sub2_StokTerjual_2() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$now = date('Y-m-d');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "PJ", "PUSAT DATA - Laporan");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$datPelanggan = $this->Amod->getData_Pelanggan_bySTATUS(1);
|
|
$datCorp = $this->Amod->getData_Corp_bySTATUS(1);
|
|
$datSales = $this->Amod->getData_Karyawan_allSales();
|
|
$datJenis = $this->Amod->getData_Jenis_bySTATUS(1);
|
|
$datMerk = $this->Amod->getData_Merk_bySTATUS(1);
|
|
$datModel = $this->Amod->getData_Model_bySTATUS(1);
|
|
$datProduk = $this->Amod->getData_Produk_bySTATUS(1);
|
|
|
|
$data = array(
|
|
'sidebar' => "menu penjualan",
|
|
'navChild' => "penjualan laporan",
|
|
'tgl' => $now,
|
|
'pelanggan' => $datPelanggan,
|
|
'corp' => $datCorp,
|
|
'sales' => $datSales,
|
|
'jenis' => $datJenis,
|
|
'merk' => $datMerk,
|
|
'model' => $datModel,
|
|
'produk' => $datProduk,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil
|
|
);
|
|
$this->load->view('proses/PJ_Sub2_StokTerjual_2', $data);
|
|
}
|
|
|
|
public function PJ_Sub2_TransaksiPelanggan_2() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$now = date('Y-m-d');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "PJ", "PUSAT DATA - Laporan");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$datPelanggan = $this->Amod->getData_Pelanggan_bySTATUS(1);
|
|
$datCorp = $this->Amod->getData_Corp_bySTATUS(1);
|
|
$datSales = $this->Amod->getData_Karyawan_allSales();
|
|
|
|
$data = array(
|
|
'sidebar' => "menu penjualan",
|
|
'navChild' => "penjualan laporan",
|
|
'tgl' => $now,
|
|
'pelanggan' => $datPelanggan,
|
|
'corp' => $datCorp,
|
|
'sales' => $datSales,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil
|
|
);
|
|
$this->load->view('proses/PJ_Sub2_TransaksiPelanggan_2', $data);
|
|
}
|
|
|
|
public function PJ_Ambil_Sub2_DataPembukuanPenjualan() {
|
|
$id_pelanggan = $this->input->post('id_pelanggan');
|
|
$id_corp = $this->input->post('id_corp');
|
|
$id_sales = $this->input->post('id_sales');
|
|
$awal = $this->input->post('awal');
|
|
$akhir = $this->input->post('akhir');
|
|
$search = $this->input->post('search');
|
|
|
|
if ($id_pelanggan=="") {
|
|
$id_pelanggan = NULL;
|
|
}
|
|
|
|
if ($id_corp=="") {
|
|
$id_corp = NULL;
|
|
}
|
|
|
|
if ($id_sales=="") {
|
|
$id_sales = NULL;
|
|
}
|
|
|
|
$data = $this->Amod->getData_Penjualan_byCORP_bySALES_byPELANGGAN_byPERIODE_status1_forSearch($id_corp, $id_sales, $id_pelanggan, $awal, $akhir, $search);
|
|
$no = 0;
|
|
$totDpp = 0;
|
|
foreach ($data as $key) {
|
|
$sumDo = $this->Amod->getSum_DaftarOrder_byPENJUALAN($key['ID_PENJUALAN']);
|
|
$dppDo = round($sumDo[0]['TOTAL'],2);
|
|
|
|
$ppnDo = round((($key['PPN_SO']/100)*$dppDo),2);
|
|
$totDo = $dppDo+$ppnDo;
|
|
|
|
$totDpp = $totDpp+$dppDo;
|
|
|
|
$data[$no] += ['PPNRATE' => round($key['PPN_SO'])];
|
|
$data[$no] += ['DPP' => number_format($dppDo, 2)];
|
|
$data[$no] += ['PPN' => number_format($ppnDo, 2)];
|
|
$data[$no++] += ['TOT' => number_format($totDo, 2)];
|
|
}
|
|
|
|
$this->output_json([
|
|
'data' => $data,
|
|
'totDpp' => number_format($totDpp,2),
|
|
]);
|
|
}
|
|
|
|
public function PJ_Ambil_Sub2_DataPembukuanRetur() {
|
|
$id_pelanggan = $this->input->post('id_pelanggan');
|
|
$id_corp = $this->input->post('id_corp');
|
|
$id_sales = $this->input->post('id_sales');
|
|
$awal = $this->input->post('awal');
|
|
$akhir = $this->input->post('akhir');
|
|
$search = $this->input->post('search');
|
|
|
|
if ($id_pelanggan=="") {
|
|
$id_pelanggan = NULL;
|
|
}
|
|
|
|
if ($id_corp=="") {
|
|
$id_corp = NULL;
|
|
}
|
|
|
|
if ($id_sales=="") {
|
|
$id_sales = NULL;
|
|
}
|
|
|
|
$data = $this->Amod->getData_ReturPenjualan_byCORP_bySALES_byPELANGGAN_byPERIODE_forSearch($id_corp, $id_sales, $id_pelanggan, $awal, $akhir, $search);
|
|
$no = 0;
|
|
$totDpp = 0;
|
|
foreach ($data as $key) {
|
|
$sumDrj = $this->Amod->getSum_DaftarReturJual_byRJ($key['ID_RJ']);
|
|
$dppDo = round($sumDrj[0]['TOTAL'],2);
|
|
|
|
$ppnDo = round((($key['PPN_SO']/100)*$dppDo),2);
|
|
$totDo = $dppDo+$ppnDo;
|
|
|
|
$totDpp = $totDpp+$dppDo;
|
|
|
|
$data[$no] += ['PPNRATE' => round($key['PPN_SO'])];
|
|
$data[$no] += ['DPP' => number_format($dppDo, 2)];
|
|
$data[$no] += ['PPN' => number_format($ppnDo, 2)];
|
|
$data[$no++] += ['TOT' => number_format($totDo, 2)];
|
|
}
|
|
|
|
$this->output_json([
|
|
'data' => $data,
|
|
'totDpp' => number_format($totDpp,2),
|
|
]);
|
|
}
|
|
|
|
public function PJ_Ambil_Sub2_DataPembukuanBatal() {
|
|
$id_pelanggan = $this->input->post('id_pelanggan');
|
|
$id_corp = $this->input->post('id_corp');
|
|
$id_sales = $this->input->post('id_sales');
|
|
$awal = $this->input->post('awal');
|
|
$akhir = $this->input->post('akhir');
|
|
$search = $this->input->post('search');
|
|
|
|
if ($id_pelanggan=="") {
|
|
$id_pelanggan = NULL;
|
|
}
|
|
|
|
if ($id_corp=="") {
|
|
$id_corp = NULL;
|
|
}
|
|
|
|
if ($id_sales=="") {
|
|
$id_sales = NULL;
|
|
}
|
|
|
|
$data = $this->Amod->getData_Penjualan_byCORP_bySALES_byPELANGGAN_byPERIODE_status0_forSearch($id_corp, $id_sales, $id_pelanggan, $awal, $akhir, $search);
|
|
|
|
$this->output_json([
|
|
'data' => $data,
|
|
]);
|
|
}
|
|
|
|
public function PJ_Ambil_Sub2_DataAnalisaBarangSupplier() {
|
|
$id_supplier = $this->input->post('id_supplier');
|
|
$id_corp = $this->input->post('id_corp');
|
|
$awal = $this->input->post('awal');
|
|
$akhir = $this->input->post('akhir');
|
|
$search = $this->input->post('search');
|
|
|
|
if ($id_corp == "") {
|
|
$id_corp = NULL;
|
|
}
|
|
|
|
$datPenjualan = $this->Amod->getData_Penjualan_byCORP_byPERIODE_status1($id_corp, $awal, $akhir, $search);
|
|
$no = 0;
|
|
$data = [];
|
|
foreach ($datPenjualan as $key) {
|
|
$list = "";
|
|
$sn = "";
|
|
$show = 0;
|
|
$datDo = $this->Amod->getData_DaftarOrder_bySO_jenis1($key['SO_ID']);
|
|
foreach ($datDo as $dat) {
|
|
$qty = 0;
|
|
$datSnj = $this->Amod->getData_SnJual_byDO($dat['ID_DO']);
|
|
foreach ($datSnj as $luca) {
|
|
$datSnb = $this->Amod->getData_SnBeli_byNAMA($luca['NAMA_SNJ']);
|
|
if ($datSnb==TRUE AND $datSnb[0]['SUPPLIER_ID']==$id_supplier) {
|
|
$qty++;
|
|
$show++;
|
|
$nama_snj = $luca['NAMA_SNJ'];
|
|
$sn .= "$nama_snj, ";
|
|
}
|
|
}
|
|
|
|
if ($qty>0) {
|
|
$kode = $dat['KODE_BARANG'];
|
|
$list .= "<b>[$qty EA]</b> <b style='color:Chocolate'>$kode</b> <br \><b style='color:Blue'>$sn</b><br \>";
|
|
}
|
|
}
|
|
|
|
if ($show>0) {
|
|
$data[$no++] = [
|
|
'LIST' => $list,
|
|
'SN' => $sn,
|
|
'KODE' => $key['KODE_PENJUALAN'],
|
|
'TGL' => $key['TANGGAL'],
|
|
'CORP' => $key['KOP_ID'],
|
|
'SJ' => $key['SJ_PENJUALAN'],
|
|
'INV' => $key['INV_PENJUALAN'],
|
|
];
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'data' => $data,
|
|
]);
|
|
}
|
|
|
|
public function PJ_Ambil_Sub2_DataAnalisaMarginPenjualan() {
|
|
$id_pelanggan = $this->input->post('id_pelanggan');
|
|
$id_corp = $this->input->post('id_corp');
|
|
$id_sales = $this->input->post('id_sales');
|
|
$awal = $this->input->post('awal');
|
|
$akhir = $this->input->post('akhir');
|
|
|
|
if ($id_corp=="") {
|
|
$id_corp = NULL;
|
|
}
|
|
|
|
if ($id_sales=="") {
|
|
$id_sales = NULL;
|
|
}
|
|
|
|
if ($id_pelanggan=="") {
|
|
$id_pelanggan = NULL;
|
|
}
|
|
|
|
$datPenjualan = $this->Amod->getData_Penjualan_byCORP_bySALES_byPELANGGAN_byPERIODE_status1($id_corp, $id_sales, $id_pelanggan, $awal, $akhir);
|
|
$datRj = $this->Amod->getData_ReturPenjualan_byCORP_bySALES_byPELANGGAN_byPERIODE_status1($id_corp, $id_sales, $id_pelanggan, $awal, $akhir);
|
|
|
|
$data = [];
|
|
$no = 0;
|
|
$totDpp = 0;
|
|
$totHpp = 0;
|
|
$totMargin = 0;
|
|
foreach ($datPenjualan as $key) {
|
|
$sumDo = $this->Amod->getSum_DaftarOrder_byPENJUALAN($key['ID_PENJUALAN']);
|
|
if ($sumDo[0]['TOTAL']==NULL) {
|
|
$dpp = 0;
|
|
} else {
|
|
$dpp = $sumDo[0]['TOTAL'];
|
|
}
|
|
$totDpp = $totDpp+$dpp;
|
|
|
|
$datHq1 = $this->Amod->getData_HistoriKuantiti_byKODE($key['KODE_PENJUALAN']);
|
|
$datHq2 = $this->Amod->getData_HistoriKuantiti_byKODE($key['KODE_SO']);
|
|
$hpp = 0;
|
|
foreach ($datHq1 as $dat) {
|
|
if ($dat['MASUK_HQ']>0) {
|
|
$sub = $dat['MASUK_HQ']*$dat['AVG_HQ'];
|
|
$add = 0;
|
|
} else if ($dat['KELUAR_HQ']>0) {
|
|
$add = $dat['KELUAR_HQ']*$dat['AVG_HQ'];
|
|
$sub = 0;
|
|
}
|
|
$hpp = $hpp+$add-$sub;
|
|
}
|
|
|
|
foreach ($datHq2 as $det) {
|
|
if ($det['MASUK_HQ']>0) {
|
|
$sub = $det['MASUK_HQ']*$det['AVG_HQ'];
|
|
$add = 0;
|
|
} else if ($det['KELUAR_HQ']>0) {
|
|
$add = $det['KELUAR_HQ']*$det['AVG_HQ'];
|
|
$sub = 0;
|
|
}
|
|
$hpp = $hpp+$add-$sub;
|
|
}
|
|
$totHpp = $totHpp+$hpp;
|
|
|
|
$margin = $dpp-$hpp;
|
|
$totMargin = $totMargin+$margin;
|
|
|
|
$naco = $this->Amod->generate_inisialCorp($key['CORP_ID']);
|
|
|
|
$data[$no++] = [
|
|
'KODE' => $key['KODE_PENJUALAN'],
|
|
'TANGGAL' => $key['TANGGAL'],
|
|
'NOTA' => $key['INV_PENJUALAN'],
|
|
'CORP' => $naco,
|
|
'SALES' => $key['NAMA_PANGGILAN_KARYAWAN'],
|
|
'NAPEL' => $key['NAMA_PELANGGAN'],
|
|
'NAKO' => $key['NAMA_KOTA'],
|
|
'DPP' => number_format($dpp, 2),
|
|
'HPP' => number_format($hpp, 2),
|
|
'MARGIN' => number_format($margin, 2),
|
|
];
|
|
}
|
|
|
|
foreach ($datRj as $key) {
|
|
$sumDrj = $this->Amod->getSum_DaftarReturJual_byRJ($key['ID_RJ']);
|
|
if ($sumDrj[0]['TOTAL']==NULL) {
|
|
$dpp = 0;
|
|
} else {
|
|
$dpp = $sumDrj[0]['TOTAL'];
|
|
}
|
|
$dpp = $dpp * -1;
|
|
$totDpp = $totDpp+$dpp;
|
|
|
|
$datHq3 = $this->Amod->getData_HistoriKuantiti_byKODE($key['KODE_RJ']);
|
|
$hpp = 0;
|
|
foreach ($datHq3 as $dat) {
|
|
$sub = $dat['MASUK_HQ']*$dat['AVG_HQ'];
|
|
$hpp = $hpp-$sub;
|
|
}
|
|
$totHpp = $totHpp+$hpp;
|
|
|
|
$margin = $dpp-$hpp;
|
|
$totMargin = $totMargin+$margin;
|
|
|
|
$naco = $this->Amod->generate_inisialCorp($key['CORP_ID']);
|
|
|
|
$data[$no++] = [
|
|
'KODE' => $key['KODE_RJ'],
|
|
'TANGGAL' => $key['TANGGAL'],
|
|
'NOTA' => $key['INV_RJ'],
|
|
'CORP' => $naco,
|
|
'SALES' => $key['NAMA_PANGGILAN_KARYAWAN'],
|
|
'NAPEL' => $key['NAMA_PELANGGAN'],
|
|
'NAKO' => $key['NAMA_KOTA'],
|
|
'DPP' => number_format($dpp, 2),
|
|
'HPP' => number_format($hpp, 2),
|
|
'MARGIN' => number_format($margin, 2),
|
|
];
|
|
}
|
|
|
|
$this->output_json([
|
|
'data' => $data,
|
|
'totDpp' => number_format($totDpp,2),
|
|
'totHpp' => number_format($totHpp,2),
|
|
'totMargin' => number_format($totMargin,2),
|
|
]);
|
|
}
|
|
|
|
public function PJ_Ambil_Sub2_DataAnalisaPencapaianSales() {
|
|
$id_sales = $this->input->post('id_sales');
|
|
$jenis_analisa = $this->input->post('jenis_analisa');
|
|
$awal = $this->input->post('awal');
|
|
$akhir = $this->input->post('akhir');
|
|
|
|
$listSales = [];
|
|
if ($id_sales=="") {
|
|
$datSales = $this->Amod->getData_Karyawan_allSales();
|
|
$no = 0;
|
|
foreach ($datSales as $key) {
|
|
$listSales[$no++] = [
|
|
'IDKAR' => $key['ID_KARYAWAN'],
|
|
'NAKAR' => $key['NAMA_PANGGILAN_KARYAWAN'],
|
|
];
|
|
}
|
|
} else {
|
|
$datSales = $this->Amod->getData_Karyawan_byID($id_sales);
|
|
$listSales[0] = [
|
|
'IDKAR' => $id_sales,
|
|
'NAKAR' => $datSales[0]['NAMA_PANGGILAN_KARYAWAN'],
|
|
];
|
|
}
|
|
|
|
$no = 0;
|
|
foreach ($listSales as $key) {
|
|
$totDpp = 0;
|
|
$totNota = 0;
|
|
|
|
$datDo = $this->Amod->getData_DaftarOrder_bySALES_byPERIODE_status1($key['IDKAR'], $awal, $akhir);
|
|
$datDrj = $this->Amod->getData_DaftarReturJual_bySALES_byPERIODE_status1($key['IDKAR'], $awal, $akhir);
|
|
|
|
foreach ($datDo as $dat) {
|
|
$dpp = $dat['QTY_DO']*$dat['HARGA_DO'];
|
|
$sub = round(($dpp*((100+$dat['PPN_SO'])/100)),2);
|
|
|
|
$totDpp = $totDpp+$dpp;
|
|
$totNota = $totNota+$sub;
|
|
}
|
|
|
|
foreach ($datDrj as $det) {
|
|
$dpp = $det['QTY_DRJ']*$det['HARGA_DRJ'];
|
|
$sub = round(($dpp*((100+$det['PPN_SO'])/100)),2);
|
|
|
|
$totDpp = $totDpp-$dpp;
|
|
$totNota = $totNota-$sub;
|
|
}
|
|
|
|
if ($jenis_analisa==1) {
|
|
$totalFull = number_format($totDpp, 2);
|
|
} else if ($jenis_analisa==2) {
|
|
$totalFull = number_format($totNota, 2);
|
|
}
|
|
|
|
$listSales[$no++] += ['TOTAL' => $totalFull];
|
|
}
|
|
|
|
$this->output_json([
|
|
'data' => $listSales,
|
|
'total' => sizeof($listSales),
|
|
]);
|
|
|
|
}
|
|
|
|
public function PJ_Ambil_Sub2_DataAnalisaStokTerjual() {
|
|
$kondisi = $this->input->post('kondisi');
|
|
$id_pelanggan = $this->input->post('id_pelanggan');
|
|
$id_corp = $this->input->post('id_corp');
|
|
$id_sales = $this->input->post('id_sales');
|
|
$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');
|
|
$awal = $this->input->post('awal');
|
|
$akhir = $this->input->post('akhir');
|
|
$id_barang = $this->input->post('id_barang');
|
|
|
|
if ($id_pelanggan=="") {
|
|
$id_pelanggan = NULL;
|
|
}
|
|
|
|
if ($id_corp=="") {
|
|
$id_corp = NULL;
|
|
}
|
|
|
|
if ($id_sales=="") {
|
|
$id_sales = NULL;
|
|
}
|
|
|
|
if ($id_jenis=="") {
|
|
$id_jenis = NULL;
|
|
}
|
|
|
|
if ($id_merk=="") {
|
|
$id_merk = NULL;
|
|
}
|
|
|
|
if ($id_model=="") {
|
|
$id_model = NULL;
|
|
}
|
|
|
|
if ($id_produk=="") {
|
|
$id_produk = NULL;
|
|
}
|
|
|
|
if ($id_barang=="") {
|
|
$id_barang = NULL;
|
|
}
|
|
|
|
$data = $this->Amod->getData_DaftarOrder_byCORP_bySALES_byPELANGGAN_byJENIS_byMERK_byMODEL_byPRODUK_byKONDISI_byPERIODE_groupBARANG_status1_forSearch($id_corp, $id_sales, $id_pelanggan, $id_jenis, $id_merk, $id_model, $id_produk, $kondisi, $awal, $akhir, $id_barang);
|
|
$total = 0;
|
|
foreach ($data as $key) {
|
|
$total = $total+$key['TOTAL'];
|
|
}
|
|
|
|
$this->output_json([
|
|
'data' => $data,
|
|
'total' => $total,
|
|
]);
|
|
}
|
|
|
|
public function PJ_Ambil_Sub2_DataRumusGp() {
|
|
$jenis = $this->input->post('jenis');
|
|
|
|
$datRp = $this->Amod->getData_RekapProyek_byJENIS_bySTATUS_orderDESC($jenis, 2);
|
|
$datRgp = $this->Amod->getData_RumusGp_byJENIS_bySTATUS($jenis, 1);
|
|
|
|
$this->output_json([
|
|
'rp' => $datRp,
|
|
'rgp' => $datRgp,
|
|
]);
|
|
}
|
|
|
|
public function PJ_Excel_Sub2_DataPembukuanPenjualan() {
|
|
$awal = $this->input->post('tgl_awalfill');
|
|
$akhir = $this->input->post('tgl_akhirfill');
|
|
$jenis = $this->input->post('jenis_fill');
|
|
$id_pelanggan = $this->input->post('id_pelangganfill');
|
|
$id_corp = $this->input->post('id_corpfill');
|
|
$id_sales = $this->input->post('id_salesfill');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$hasil = [];
|
|
$noAwal = 0;
|
|
$noAkhir = 0;
|
|
|
|
if ($jenis==1) { // Campur jadi satu Laporan
|
|
$hasil[$noAwal] = [
|
|
'IDSHEET' => '0',
|
|
'FASHEET' => "CAMPUR",
|
|
'NASHEET' => "Sesuai Filter"
|
|
];
|
|
if ($id_corp=="") {
|
|
if ($id_sales=="") {
|
|
if ($id_pelanggan=="") {
|
|
$datPenjualan = $this->Amod->getData_Penjualan_byCORP_bySALES_byPELANGGAN_byPERIODE_status1(NULL, NULL, NULL, $awal, $akhir);
|
|
$no = 0;
|
|
$subDpp = 0;
|
|
$subPpn = 0;
|
|
$subTot = 0;
|
|
foreach ($datPenjualan as $dat) {
|
|
$sumDo = $this->Amod->getSum_DaftarOrder_byPENJUALAN($dat['ID_PENJUALAN']);
|
|
if ($sumDo[0]['TOTAL']==NULL) {
|
|
$dpp = 0;
|
|
} else {
|
|
$dpp = round($sumDo[0]['TOTAL'],2);
|
|
}
|
|
|
|
$ppnPen = round($dpp*($dat['PPN_SO']/100),2);
|
|
$totPen = round(($dpp+$ppnPen),2);
|
|
|
|
$subDpp = $subDpp+$dpp;
|
|
$subPpn = $subPpn+$ppnPen;
|
|
$subTot = $subTot+$totPen;
|
|
|
|
$datPenjualan[$no] += ['DPPPEN' => number_format($dpp, 2)];
|
|
$datPenjualan[$no] += ['PPNPEN' => number_format($ppnPen, 2)];
|
|
$datPenjualan[$no] += ['TOTPEN' => number_format($totPen, 2)];
|
|
$datPenjualan[$no++] += ['PPN' => round($dat['PPN_SO'])];
|
|
}
|
|
$hasil[$noAkhir] += ['SUBDPP' => number_format($subDpp,2)];
|
|
$hasil[$noAkhir] += ['SUBPPN' => number_format($subPpn,2)];
|
|
$hasil[$noAkhir] += ['SUBTOT' => number_format($subTot,2)];
|
|
$hasil[$noAkhir] += ['ISI' => $datPenjualan];
|
|
} else {
|
|
$listPelanggan = explode(",", $id_pelanggan);
|
|
$subPen = [];
|
|
$noPen = 0;
|
|
$subDpp = 0;
|
|
$subPpn = 0;
|
|
$subTot = 0;
|
|
foreach ($listPelanggan as $dat) {
|
|
$datPenjualan = $this->Amod->getData_Penjualan_byCORP_bySALES_byPELANGGAN_byPERIODE_status1(NULL, NULL, $dat, $awal, $akhir);
|
|
$no = 0;
|
|
foreach ($datPenjualan as $dut) {
|
|
$sumDo = $this->Amod->getSum_DaftarOrder_byPENJUALAN($dut['ID_PENJUALAN']);
|
|
if ($sumDo[0]['TOTAL']==NULL) {
|
|
$dpp = 0;
|
|
} else {
|
|
$dpp = round($sumDo[0]['TOTAL'],2);
|
|
}
|
|
|
|
$ppnPen = round($dpp*($dut['PPN_SO']/100),2);
|
|
$totPen = round(($dpp+$ppnPen),2);
|
|
|
|
$subDpp = $subDpp+$dpp;
|
|
$subPpn = $subPpn+$ppnPen;
|
|
$subTot = $subTot+$totPen;
|
|
|
|
$datPenjualan[$no] += ['DPPPEN' => number_format($dpp, 2)];
|
|
$datPenjualan[$no] += ['PPNPEN' => number_format($ppnPen, 2)];
|
|
$datPenjualan[$no] += ['TOTPEN' => number_format($totPen, 2)];
|
|
$datPenjualan[$no++] += ['PPN' => round($dut['PPN_SO'])];
|
|
}
|
|
foreach ($datPenjualan as $det) {
|
|
$subPen[$noPen++] = $det;
|
|
}
|
|
}
|
|
$hasil[$noAkhir] += ['SUBDPP' => number_format($subDpp,2)];
|
|
$hasil[$noAkhir] += ['SUBPPN' => number_format($subPpn,2)];
|
|
$hasil[$noAkhir] += ['SUBTOT' => number_format($subTot,2)];
|
|
$hasil[$noAkhir] += ['ISI' => $subPen];
|
|
}
|
|
} else {
|
|
$listSales = explode(",", $id_sales);
|
|
$subPen = [];
|
|
$noPen = 0;
|
|
$subDpp = 0;
|
|
$subPpn = 0;
|
|
$subTot = 0;
|
|
if ($id_pelanggan=="") {
|
|
foreach ($listSales as $dat) {
|
|
$datPenjualan = $this->Amod->getData_Penjualan_byCORP_bySALES_byPELANGGAN_byPERIODE_status1(NULL, $dat, NULL, $awal, $akhir);
|
|
$no = 0;
|
|
foreach ($datPenjualan as $det) {
|
|
$sumDo = $this->Amod->getSum_DaftarOrder_byPENJUALAN($det['ID_PENJUALAN']);
|
|
if ($sumDo[0]['TOTAL']==NULL) {
|
|
$dpp = 0;
|
|
} else {
|
|
$dpp = round($sumDo[0]['TOTAL'],2);
|
|
}
|
|
|
|
$ppnPen = round($dpp*($det['PPN_SO']/100),2);
|
|
$totPen = round(($dpp+$ppnPen),2);
|
|
|
|
$subDpp = $subDpp+$dpp;
|
|
$subPpn = $subPpn+$ppnPen;
|
|
$subTot = $subTot+$totPen;
|
|
|
|
$datPenjualan[$no] += ['DPPPEN' => number_format($dpp, 2)];
|
|
$datPenjualan[$no] += ['PPNPEN' => number_format($ppnPen, 2)];
|
|
$datPenjualan[$no] += ['TOTPEN' => number_format($totPen, 2)];
|
|
$datPenjualan[$no++] += ['PPN' => round($det['PPN_SO'])];
|
|
}
|
|
foreach ($datPenjualan as $dut) {
|
|
$subPen[$noPen++] = $dut;
|
|
}
|
|
}
|
|
|
|
$hasil[$noAkhir] += ['SUBDPP' => number_format($subDpp,2)];
|
|
$hasil[$noAkhir] += ['SUBPPN' => number_format($subPpn,2)];
|
|
$hasil[$noAkhir] += ['SUBTOT' => number_format($subTot,2)];
|
|
$hasil[$noAkhir] += ['ISI' => $subPen];
|
|
} else {
|
|
$listPelanggan = explode(",", $id_pelanggan);
|
|
foreach ($listPelanggan as $dot) {
|
|
foreach ($listSales as $dat) {
|
|
$datPenjualan = $this->Amod->getData_Penjualan_byCORP_bySALES_byPELANGGAN_byPERIODE_status1(NULL, $dat, $dot, $awal, $akhir);
|
|
$no = 0;
|
|
foreach ($datPenjualan as $det) {
|
|
$sumDo = $this->Amod->getSum_DaftarOrder_byPENJUALAN($det['ID_PENJUALAN']);
|
|
if ($sumDo[0]['TOTAL']==NULL) {
|
|
$dpp = 0;
|
|
} else {
|
|
$dpp = round($sumDo[0]['TOTAL'],2);
|
|
}
|
|
|
|
$ppnPen = round($dpp*($det['PPN_SO']/100),2);
|
|
$totPen = round(($dpp+$ppnPen),2);
|
|
|
|
$subDpp = $subDpp+$dpp;
|
|
$subPpn = $subPpn+$ppnPen;
|
|
$subTot = $subTot+$totPen;
|
|
|
|
$datPenjualan[$no] += ['DPPPEN' => number_format($dpp, 2)];
|
|
$datPenjualan[$no] += ['PPNPEN' => number_format($ppnPen, 2)];
|
|
$datPenjualan[$no] += ['TOTPEN' => number_format($totPen, 2)];
|
|
$datPenjualan[$no++] += ['PPN' => round($det['PPN_SO'])];
|
|
}
|
|
foreach ($datPenjualan as $dut) {
|
|
$subPen[$noPen++] = $dut;
|
|
}
|
|
}
|
|
}
|
|
$hasil[$noAkhir] += ['SUBDPP' => number_format($subDpp,2)];
|
|
$hasil[$noAkhir] += ['SUBPPN' => number_format($subPpn,2)];
|
|
$hasil[$noAkhir] += ['SUBTOT' => number_format($subTot,2)];
|
|
$hasil[$noAkhir] += ['ISI' => $subPen];
|
|
}
|
|
}
|
|
} else {
|
|
$listCorp = explode(",", $id_corp);
|
|
$subPen = [];
|
|
$noPen = 0;
|
|
$subDpp = 0;
|
|
$subPpn = 0;
|
|
$subTot = 0;
|
|
foreach ($listCorp as $keydat) {
|
|
if ($id_sales=="") {
|
|
if ($id_pelanggan=="") {
|
|
$datPenjualan = $this->Amod->getData_Penjualan_byCORP_bySALES_byPELANGGAN_byPERIODE_status1($keydat, NULL, NULL, $awal, $akhir);
|
|
$no = 0;
|
|
foreach ($datPenjualan as $dat) {
|
|
$sumDo = $this->Amod->getSum_DaftarOrder_byPENJUALAN($dat['ID_PENJUALAN']);
|
|
if ($sumDo[0]['TOTAL']==NULL) {
|
|
$dpp = 0;
|
|
} else {
|
|
$dpp = round($sumDo[0]['TOTAL'],2);
|
|
}
|
|
|
|
$ppnPen = round($dpp*($dat['PPN_SO']/100),2);
|
|
$totPen = round(($dpp+$ppnPen),2);
|
|
|
|
$subDpp = $subDpp+$dpp;
|
|
$subPpn = $subPpn+$ppnPen;
|
|
$subTot = $subTot+$totPen;
|
|
|
|
$datPenjualan[$no] += ['DPPPEN' => number_format($dpp, 2)];
|
|
$datPenjualan[$no] += ['PPNPEN' => number_format($ppnPen, 2)];
|
|
$datPenjualan[$no] += ['TOTPEN' => number_format($totPen, 2)];
|
|
$datPenjualan[$no++] += ['PPN' => round($dat['PPN_SO'])];
|
|
}
|
|
foreach ($datPenjualan as $det) {
|
|
$subPen[$noPen++] = $det;
|
|
}
|
|
} else {
|
|
$listPelanggan = explode(",", $id_pelanggan);
|
|
foreach ($listPelanggan as $dot) {
|
|
$datPenjualan = $this->Amod->getData_Penjualan_byCORP_bySALES_byPELANGGAN_byPERIODE_status1($keydat, NULL, $dot, $awal, $akhir);
|
|
$no = 0;
|
|
foreach ($datPenjualan as $dut) {
|
|
$sumDo = $this->Amod->getSum_DaftarOrder_byPENJUALAN($dut['ID_PENJUALAN']);
|
|
if ($sumDo[0]['TOTAL']==NULL) {
|
|
$dpp = 0;
|
|
} else {
|
|
$dpp = round($sumDo[0]['TOTAL'],2);
|
|
}
|
|
|
|
$ppnPen = round($dpp*($dut['PPN_SO']/100),2);
|
|
$totPen = round(($dpp+$ppnPen),2);
|
|
|
|
$subDpp = $subDpp+$dpp;
|
|
$subPpn = $subPpn+$ppnPen;
|
|
$subTot = $subTot+$totPen;
|
|
|
|
$datPenjualan[$no] += ['DPPPEN' => number_format($dpp, 2)];
|
|
$datPenjualan[$no] += ['PPNPEN' => number_format($ppnPen, 2)];
|
|
$datPenjualan[$no] += ['TOTPEN' => number_format($totPen, 2)];
|
|
$datPenjualan[$no++] += ['PPN' => round($dut['PPN_SO'])];
|
|
}
|
|
foreach ($datPenjualan as $det) {
|
|
$subPen[$noPen++] = $det;
|
|
}
|
|
}
|
|
}
|
|
} else {
|
|
$listSales = explode(",", $id_sales);
|
|
if ($id_pelanggan=="") {
|
|
foreach ($listSales as $dat) {
|
|
$datPenjualan = $this->Amod->getData_Penjualan_byCORP_bySALES_byPELANGGAN_byPERIODE_status1($keydat, $dat, NULL, $awal, $akhir);
|
|
$no = 0;
|
|
foreach ($datPenjualan as $det) {
|
|
$sumDo = $this->Amod->getSum_DaftarOrder_byPENJUALAN($det['ID_PENJUALAN']);
|
|
if ($sumDo[0]['TOTAL']==NULL) {
|
|
$dpp = 0;
|
|
} else {
|
|
$dpp = round($sumDo[0]['TOTAL'],2);
|
|
}
|
|
|
|
$ppnPen = round($dpp*($det['PPN_SO']/100),2);
|
|
$totPen = round(($dpp+$ppnPen),2);
|
|
|
|
$subDpp = $subDpp+$dpp;
|
|
$subPpn = $subPpn+$ppnPen;
|
|
$subTot = $subTot+$totPen;
|
|
|
|
$datPenjualan[$no] += ['DPPPEN' => number_format($dpp, 2)];
|
|
$datPenjualan[$no] += ['PPNPEN' => number_format($ppnPen, 2)];
|
|
$datPenjualan[$no] += ['TOTPEN' => number_format($totPen, 2)];
|
|
$datPenjualan[$no++] += ['PPN' => round($det['PPN_SO'])];
|
|
}
|
|
foreach ($datPenjualan as $dut) {
|
|
$subPen[$noPen++] = $dut;
|
|
}
|
|
}
|
|
} else {
|
|
$listPelanggan = explode(",", $id_pelanggan);
|
|
foreach ($listPelanggan as $dot) {
|
|
foreach ($listSales as $dat) {
|
|
$datPenjualan = $this->Amod->getData_Penjualan_byCORP_bySALES_byPELANGGAN_byPERIODE_status1($keydat, $dat, $dot, $awal, $akhir);
|
|
$no = 0;
|
|
foreach ($datPenjualan as $det) {
|
|
$sumDo = $this->Amod->getSum_DaftarOrder_byPENJUALAN($det['ID_PENJUALAN']);
|
|
if ($sumDo[0]['TOTAL']==NULL) {
|
|
$dpp = 0;
|
|
} else {
|
|
$dpp = round($sumDo[0]['TOTAL'],2);
|
|
}
|
|
|
|
$ppnPen = round($dpp*($det['PPN_SO']/100),2);
|
|
$totPen = round(($dpp+$ppnPen),2);
|
|
|
|
$subDpp = $subDpp+$dpp;
|
|
$subPpn = $subPpn+$ppnPen;
|
|
$subTot = $subTot+$totPen;
|
|
|
|
$datPenjualan[$no] += ['DPPPEN' => number_format($dpp, 2)];
|
|
$datPenjualan[$no] += ['PPNPEN' => number_format($ppnPen, 2)];
|
|
$datPenjualan[$no] += ['TOTPEN' => number_format($totPen, 2)];
|
|
$datPenjualan[$no++] += ['PPN' => round($det['PPN_SO'])];
|
|
}
|
|
foreach ($datPenjualan as $dut) {
|
|
$subPen[$noPen++] = $dut;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
$hasil[$noAkhir] += ['SUBDPP' => number_format($subDpp,2)];
|
|
$hasil[$noAkhir] += ['SUBPPN' => number_format($subPpn,2)];
|
|
$hasil[$noAkhir] += ['SUBTOT' => number_format($subTot,2)];
|
|
$hasil[$noAkhir] += ['ISI' => $subPen];
|
|
}
|
|
} else if ($jenis==2) { // Dipisah Pelanggan
|
|
$salPel = explode(",", $id_pelanggan);
|
|
foreach ($salPel as $key) {
|
|
$datPelanggan = $this->Amod->getData_Pelanggan_byID($key);
|
|
$nama_pelanggan = $datPelanggan[0]['NAMA_PELANGGAN'];
|
|
if (strlen($nama_pelanggan)>20) {
|
|
$namaPel = substr($nama_pelanggan, 0, 20);
|
|
$namaPel = "$namaPel..";
|
|
} else {
|
|
$namaPel = $nama_pelanggan;
|
|
}
|
|
$hasil[$noAwal++] = [
|
|
'IDSHEET' => $key,
|
|
'FASHEET' => $nama_pelanggan,
|
|
'NASHEET' => $namaPel
|
|
];
|
|
}
|
|
|
|
if ($id_corp=="") {
|
|
if ($id_sales=="") {
|
|
foreach ($hasil as $key) {
|
|
$datPenjualan = $this->Amod->getData_Penjualan_byCORP_bySALES_byPELANGGAN_byPERIODE_status1(NULL, NULL, $key['IDSHEET'], $awal, $akhir);
|
|
$no = 0;
|
|
$subDpp = 0;
|
|
$subPpn = 0;
|
|
$subTot = 0;
|
|
foreach ($datPenjualan as $dat) {
|
|
$sumDo = $this->Amod->getSum_DaftarOrder_byPENJUALAN($dat['ID_PENJUALAN']);
|
|
if ($sumDo[0]['TOTAL']==NULL) {
|
|
$dpp = 0;
|
|
} else {
|
|
$dpp = round($sumDo[0]['TOTAL'],2);
|
|
}
|
|
|
|
$ppnPen = round($dpp*($dat['PPN_SO']/100),2);
|
|
$totPen = round(($dpp+$ppnPen),2);
|
|
|
|
$subDpp = $subDpp+$dpp;
|
|
$subPpn = $subPpn+$ppnPen;
|
|
$subTot = $subTot+$totPen;
|
|
|
|
$datPenjualan[$no] += ['DPPPEN' => number_format($dpp, 2)];
|
|
$datPenjualan[$no] += ['PPNPEN' => number_format($ppnPen, 2)];
|
|
$datPenjualan[$no] += ['TOTPEN' => number_format($totPen, 2)];
|
|
$datPenjualan[$no++] += ['PPN' => round($dat['PPN_SO'])];
|
|
}
|
|
$hasil[$noAkhir] += ['SUBDPP' => number_format($subDpp,2)];
|
|
$hasil[$noAkhir] += ['SUBPPN' => number_format($subPpn,2)];
|
|
$hasil[$noAkhir] += ['SUBTOT' => number_format($subTot,2)];
|
|
$hasil[$noAkhir++] += ['ISI' => $datPenjualan];
|
|
}
|
|
} else {
|
|
foreach ($hasil as $key) {
|
|
$salSales = explode(",", $id_sales);
|
|
$subPen = [];
|
|
$noPen = 0;
|
|
$subDpp = 0;
|
|
$subPpn = 0;
|
|
$subTot = 0;
|
|
foreach ($salSales as $keydat) {
|
|
$datPenjualan = $this->Amod->getData_Penjualan_byCORP_bySALES_byPELANGGAN_byPERIODE_status1(NULL, $keydat, $key['IDSHEET'], $awal, $akhir);
|
|
$no = 0;
|
|
foreach ($datPenjualan as $dat) {
|
|
$sumDo = $this->Amod->getSum_DaftarOrder_byPENJUALAN($dat['ID_PENJUALAN']);
|
|
if ($sumDo[0]['TOTAL']==NULL) {
|
|
$dpp = 0;
|
|
} else {
|
|
$dpp = round($sumDo[0]['TOTAL'],2);
|
|
}
|
|
|
|
$ppnPen = round($dpp*($dat['PPN_SO']/100),2);
|
|
$totPen = round(($dpp+$ppnPen),2);
|
|
|
|
$subDpp = $subDpp+$dpp;
|
|
$subPpn = $subPpn+$ppnPen;
|
|
$subTot = $subTot+$totPen;
|
|
|
|
$datPenjualan[$no] += ['DPPPEN' => number_format($dpp, 2)];
|
|
$datPenjualan[$no] += ['PPNPEN' => number_format($ppnPen, 2)];
|
|
$datPenjualan[$no] += ['TOTPEN' => number_format($totPen, 2)];
|
|
$datPenjualan[$no++] += ['PPN' => round($dat['PPN_SO'])];
|
|
}
|
|
foreach ($datPenjualan as $det) {
|
|
$subPen[$noPen++] = $det;
|
|
}
|
|
}
|
|
$hasil[$noAkhir] += ['SUBDPP' => number_format($subDpp,2)];
|
|
$hasil[$noAkhir] += ['SUBPPN' => number_format($subPpn,2)];
|
|
$hasil[$noAkhir] += ['SUBTOT' => number_format($subTot,2)];
|
|
$hasil[$noAkhir++] += ['ISI' => $subPen];
|
|
}
|
|
}
|
|
} else {
|
|
$listKop = explode(",", $id_corp);
|
|
if ($id_sales=="") {
|
|
foreach ($hasil as $key) {
|
|
$subPen = [];
|
|
$noPen = 0;
|
|
$subDpp = 0;
|
|
$subPpn = 0;
|
|
$subTot = 0;
|
|
foreach ($listKop as $dat) {
|
|
$datPenjualan = $this->Amod->getData_Penjualan_byCORP_bySALES_byPELANGGAN_byPERIODE_status1($dat, NULL, $key['IDSHEET'], $awal, $akhir);
|
|
$no = 0;
|
|
foreach ($datPenjualan as $dut) {
|
|
$sumDo = $this->Amod->getSum_DaftarOrder_byPENJUALAN($dut['ID_PENJUALAN']);
|
|
if ($sumDo[0]['TOTAL']==NULL) {
|
|
$dpp = 0;
|
|
} else {
|
|
$dpp = round($sumDo[0]['TOTAL'],2);
|
|
}
|
|
|
|
$ppnPen = round($dpp*($dut['PPN_SO']/100),2);
|
|
$totPen = round(($dpp+$ppnPen),2);
|
|
|
|
$subDpp = $subDpp+$dpp;
|
|
$subPpn = $subPpn+$ppnPen;
|
|
$subTot = $subTot+$totPen;
|
|
|
|
$datPenjualan[$no] += ['DPPPEN' => number_format($dpp, 2)];
|
|
$datPenjualan[$no] += ['PPNPEN' => number_format($ppnPen, 2)];
|
|
$datPenjualan[$no] += ['TOTPEN' => number_format($totPen, 2)];
|
|
$datPenjualan[$no++] += ['PPN' => round($dut['PPN_SO'])];
|
|
}
|
|
foreach ($datPenjualan as $det) {
|
|
$subPen[$noPen++] = $det;
|
|
}
|
|
}
|
|
$hasil[$noAkhir] += ['SUBDPP' => number_format($subDpp,2)];
|
|
$hasil[$noAkhir] += ['SUBPPN' => number_format($subPpn,2)];
|
|
$hasil[$noAkhir] += ['SUBTOT' => number_format($subTot,2)];
|
|
$hasil[$noAkhir++] += ['ISI' => $subPen];
|
|
}
|
|
} else {
|
|
$listSales = explode(",", $id_sales);
|
|
foreach ($hasil as $key) {
|
|
$subPen = [];
|
|
$noPen = 0;
|
|
$subDpp = 0;
|
|
$subPpn = 0;
|
|
$subTot = 0;
|
|
foreach ($listSales as $keydat) {
|
|
foreach ($listKop as $dat) {
|
|
$datPenjualan = $this->Amod->getData_Penjualan_byCORP_bySALES_byPELANGGAN_byPERIODE_status1($dat, $keydat, $key['IDSHEET'], $awal, $akhir);
|
|
$no = 0;
|
|
foreach ($datPenjualan as $dut) {
|
|
$sumDo = $this->Amod->getSum_DaftarOrder_byPENJUALAN($dut['ID_PENJUALAN']);
|
|
if ($sumDo[0]['TOTAL']==NULL) {
|
|
$dpp = 0;
|
|
} else {
|
|
$dpp = round($sumDo[0]['TOTAL'],2);
|
|
}
|
|
|
|
$ppnPen = round($dpp*($dut['PPN_SO']/100),2);
|
|
$totPen = round(($dpp+$ppnPen),2);
|
|
|
|
$subDpp = $subDpp+$dpp;
|
|
$subPpn = $subPpn+$ppnPen;
|
|
$subTot = $subTot+$totPen;
|
|
|
|
$datPenjualan[$no] += ['DPPPEN' => number_format($dpp, 2)];
|
|
$datPenjualan[$no] += ['PPNPEN' => number_format($ppnPen, 2)];
|
|
$datPenjualan[$no] += ['TOTPEN' => number_format($totPen, 2)];
|
|
$datPenjualan[$no++] += ['PPN' => round($dut['PPN_SO'])];
|
|
}
|
|
foreach ($datPenjualan as $det) {
|
|
$subPen[$noPen++] = $det;
|
|
}
|
|
}
|
|
}
|
|
$hasil[$noAkhir] += ['SUBDPP' => number_format($subDpp,2)];
|
|
$hasil[$noAkhir] += ['SUBPPN' => number_format($subPpn,2)];
|
|
$hasil[$noAkhir] += ['SUBTOT' => number_format($subTot,2)];
|
|
$hasil[$noAkhir++] += ['ISI' => $subPen];
|
|
}
|
|
}
|
|
}
|
|
} else if ($jenis==3) { // Dipisah Kop
|
|
if ($id_corp=="") {
|
|
$salKop = $this->Amod->getData_Corp_bySTATUS(1);
|
|
foreach ($salKop as $key) {
|
|
$kop = $this->Amod->generate_inisialCorp($key['ID_CORP']);
|
|
$hasil[$noAwal++] = [
|
|
'IDSHEET' => $key['ID_CORP'],
|
|
'FASHEET' => $kop,
|
|
'NASHEET' => $kop
|
|
];
|
|
}
|
|
} else {
|
|
$salKop = explode(",", $id_corp);
|
|
foreach ($salKop as $key) {
|
|
$kop = $this->Amod->generate_inisialCorp($key);
|
|
$hasil[$noAwal++] = [
|
|
'IDSHEET' => $key,
|
|
'FASHEET' => $kop,
|
|
'NASHEET' => $kop
|
|
];
|
|
}
|
|
}
|
|
|
|
if ($id_pelanggan=="") {
|
|
if ($id_sales=="") {
|
|
foreach ($hasil as $key) {
|
|
$datPenjualan = $this->Amod->getData_Penjualan_byCORP_bySALES_byPELANGGAN_byPERIODE_status1($key['IDSHEET'], NULL, NULL, $awal, $akhir);
|
|
$no = 0;
|
|
$subDpp = 0;
|
|
$subPpn = 0;
|
|
$subTot = 0;
|
|
foreach ($datPenjualan as $dat) {
|
|
$sumDo = $this->Amod->getSum_DaftarOrder_byPENJUALAN($dat['ID_PENJUALAN']);
|
|
if ($sumDo[0]['TOTAL']==NULL) {
|
|
$dpp = 0;
|
|
} else {
|
|
$dpp = round($sumDo[0]['TOTAL'],2);
|
|
}
|
|
|
|
$ppnPen = round($dpp*($dat['PPN_SO']/100),2);
|
|
$totPen = round(($dpp+$ppnPen),2);
|
|
|
|
$subDpp = $subDpp+$dpp;
|
|
$subPpn = $subPpn+$ppnPen;
|
|
$subTot = $subTot+$totPen;
|
|
|
|
$datPenjualan[$no] += ['DPPPEN' => number_format($dpp, 2)];
|
|
$datPenjualan[$no] += ['PPNPEN' => number_format($ppnPen, 2)];
|
|
$datPenjualan[$no] += ['TOTPEN' => number_format($totPen, 2)];
|
|
$datPenjualan[$no++] += ['PPN' => round($dat['PPN_SO'])];
|
|
}
|
|
$hasil[$noAkhir] += ['SUBDPP' => number_format($subDpp,2)];
|
|
$hasil[$noAkhir] += ['SUBPPN' => number_format($subPpn,2)];
|
|
$hasil[$noAkhir] += ['SUBTOT' => number_format($subTot,2)];
|
|
$hasil[$noAkhir++] += ['ISI' => $datPenjualan];
|
|
}
|
|
} else {
|
|
foreach ($hasil as $key) {
|
|
$salSales = explode(",", $id_sales);
|
|
$subPen = [];
|
|
$noPen = 0;
|
|
$subDpp = 0;
|
|
$subPpn = 0;
|
|
$subTot = 0;
|
|
foreach ($salSales as $keydat) {
|
|
$datPenjualan = $this->Amod->getData_Penjualan_byCORP_bySALES_byPELANGGAN_byPERIODE_status1($key['IDSHEET'], $keydat, NULL, $awal, $akhir);
|
|
$no = 0;
|
|
foreach ($datPenjualan as $dat) {
|
|
$sumDo = $this->Amod->getSum_DaftarOrder_byPENJUALAN($dat['ID_PENJUALAN']);
|
|
if ($sumDo[0]['TOTAL']==NULL) {
|
|
$dpp = 0;
|
|
} else {
|
|
$dpp = round($sumDo[0]['TOTAL'],2);
|
|
}
|
|
|
|
$ppnPen = round($dpp*($dat['PPN_SO']/100),2);
|
|
$totPen = round(($dpp+$ppnPen),2);
|
|
|
|
$subDpp = $subDpp+$dpp;
|
|
$subPpn = $subPpn+$ppnPen;
|
|
$subTot = $subTot+$totPen;
|
|
|
|
$datPenjualan[$no] += ['DPPPEN' => number_format($dpp, 2)];
|
|
$datPenjualan[$no] += ['PPNPEN' => number_format($ppnPen, 2)];
|
|
$datPenjualan[$no] += ['TOTPEN' => number_format($totPen, 2)];
|
|
$datPenjualan[$no++] += ['PPN' => round($dat['PPN_SO'])];
|
|
}
|
|
foreach ($datPenjualan as $det) {
|
|
$subPen[$noPen++] = $det;
|
|
}
|
|
}
|
|
$hasil[$noAkhir] += ['SUBDPP' => number_format($subDpp,2)];
|
|
$hasil[$noAkhir] += ['SUBPPN' => number_format($subPpn,2)];
|
|
$hasil[$noAkhir] += ['SUBTOT' => number_format($subTot,2)];
|
|
$hasil[$noAkhir++] += ['ISI' => $subPen];
|
|
}
|
|
}
|
|
} else {
|
|
$listPelanggan = explode(",", $id_pelanggan);
|
|
if ($id_sales=="") {
|
|
foreach ($hasil as $key) {
|
|
$subPen = [];
|
|
$noPen = 0;
|
|
$subDpp = 0;
|
|
$subPpn = 0;
|
|
$subTot = 0;
|
|
foreach ($listPelanggan as $dat) {
|
|
$datPenjualan = $this->Amod->getData_Penjualan_byCORP_bySALES_byPELANGGAN_byPERIODE_status1($key['IDSHEET'], NULL, $dat, $awal, $akhir);
|
|
$no = 0;
|
|
foreach ($datPenjualan as $dut) {
|
|
$sumDo = $this->Amod->getSum_DaftarOrder_byPENJUALAN($dut['ID_PENJUALAN']);
|
|
if ($sumDo[0]['TOTAL']==NULL) {
|
|
$dpp = 0;
|
|
} else {
|
|
$dpp = round($sumDo[0]['TOTAL'],2);
|
|
}
|
|
|
|
$ppnPen = round($dpp*($dut['PPN_SO']/100),2);
|
|
$totPen = round(($dpp+$ppnPen),2);
|
|
|
|
$subDpp = $subDpp+$dpp;
|
|
$subPpn = $subPpn+$ppnPen;
|
|
$subTot = $subTot+$totPen;
|
|
|
|
$datPenjualan[$no] += ['DPPPEN' => number_format($dpp, 2)];
|
|
$datPenjualan[$no] += ['PPNPEN' => number_format($ppnPen, 2)];
|
|
$datPenjualan[$no] += ['TOTPEN' => number_format($totPen, 2)];
|
|
$datPenjualan[$no++] += ['PPN' => round($dut['PPN_SO'])];
|
|
}
|
|
foreach ($datPenjualan as $det) {
|
|
$subPen[$noPen++] = $det;
|
|
}
|
|
}
|
|
$hasil[$noAkhir] += ['SUBDPP' => number_format($subDpp,2)];
|
|
$hasil[$noAkhir] += ['SUBPPN' => number_format($subPpn,2)];
|
|
$hasil[$noAkhir] += ['SUBTOT' => number_format($subTot,2)];
|
|
$hasil[$noAkhir++] += ['ISI' => $subPen];
|
|
}
|
|
} else {
|
|
$listSales = explode(",", $id_sales);
|
|
foreach ($hasil as $key) {
|
|
$subPen = [];
|
|
$noPen = 0;
|
|
$subDpp = 0;
|
|
$subPpn = 0;
|
|
$subTot = 0;
|
|
foreach ($listSales as $keydat) {
|
|
foreach ($listPelanggan as $dat) {
|
|
$datPenjualan = $this->Amod->getData_Penjualan_byCORP_bySALES_byPELANGGAN_byPERIODE_status1($key['IDSHEET'], $keydat, $dat, $awal, $akhir);
|
|
$no = 0;
|
|
foreach ($datPenjualan as $dut) {
|
|
$sumDo = $this->Amod->getSum_DaftarOrder_byPENJUALAN($dut['ID_PENJUALAN']);
|
|
if ($sumDo[0]['TOTAL']==NULL) {
|
|
$dpp = 0;
|
|
} else {
|
|
$dpp = round($sumDo[0]['TOTAL'],2);
|
|
}
|
|
|
|
$ppnPen = round($dpp*($dut['PPN_SO']/100),2);
|
|
$totPen = round(($dpp+$ppnPen),2);
|
|
|
|
$subDpp = $subDpp+$dpp;
|
|
$subPpn = $subPpn+$ppnPen;
|
|
$subTot = $subTot+$totPen;
|
|
|
|
$datPenjualan[$no] += ['DPPPEN' => number_format($dpp, 2)];
|
|
$datPenjualan[$no] += ['PPNPEN' => number_format($ppnPen, 2)];
|
|
$datPenjualan[$no] += ['TOTPEN' => number_format($totPen, 2)];
|
|
$datPenjualan[$no++] += ['PPN' => round($dut['PPN_SO'])];
|
|
}
|
|
foreach ($datPenjualan as $det) {
|
|
$subPen[$noPen++] = $det;
|
|
}
|
|
}
|
|
}
|
|
$hasil[$noAkhir] += ['SUBDPP' => number_format($subDpp,2)];
|
|
$hasil[$noAkhir] += ['SUBPPN' => number_format($subPpn,2)];
|
|
$hasil[$noAkhir] += ['SUBTOT' => number_format($subTot,2)];
|
|
$hasil[$noAkhir++] += ['ISI' => $subPen];
|
|
}
|
|
}
|
|
}
|
|
} else if ($jenis==4) { // Dipisah Sales
|
|
if ($id_sales=="") {
|
|
$salSales = $this->Amod->getData_Karyawan_allSales();
|
|
foreach ($salSales as $key) {
|
|
$hasil[$noAwal++] = [
|
|
'IDSHEET' => $key['ID_KARYAWAN'],
|
|
'FASHEET' => $key['NAMA_PANGGILAN_KARYAWAN'],
|
|
'NASHEET' => $key['NAMA_PANGGILAN_KARYAWAN']
|
|
];
|
|
}
|
|
} else {
|
|
$salSales = explode(",", $id_sales);
|
|
foreach ($salSales as $key) {
|
|
$datKaryawan = $this->Amod->getData_Karyawan_byID($key);
|
|
$hasil[$noAwal++] = [
|
|
'IDSHEET' => $key,
|
|
'FASHEET' => $datKaryawan[0]['NAMA_PANGGILAN_KARYAWAN'],
|
|
'NASHEET' => $datKaryawan[0]['NAMA_PANGGILAN_KARYAWAN']
|
|
];
|
|
}
|
|
}
|
|
|
|
if ($id_corp=="") {
|
|
if ($id_pelanggan=="") {
|
|
foreach ($hasil as $key) {
|
|
$datPenjualan = $this->Amod->getData_Penjualan_byCORP_bySALES_byPELANGGAN_byPERIODE_status1(NULL, $key['IDSHEET'], NULL, $awal, $akhir);
|
|
$no = 0;
|
|
$subDpp = 0;
|
|
$subPpn = 0;
|
|
$subTot = 0;
|
|
foreach ($datPenjualan as $dat) {
|
|
$sumDo = $this->Amod->getSum_DaftarOrder_byPENJUALAN($dat['ID_PENJUALAN']);
|
|
if ($sumDo[0]['TOTAL']==NULL) {
|
|
$dpp = 0;
|
|
} else {
|
|
$dpp = round($sumDo[0]['TOTAL'],2);
|
|
}
|
|
|
|
$ppnPen = round($dpp*($dat['PPN_SO']/100),2);
|
|
$totPen = round(($dpp+$ppnPen),2);
|
|
|
|
$subDpp = $subDpp+$dpp;
|
|
$subPpn = $subPpn+$ppnPen;
|
|
$subTot = $subTot+$totPen;
|
|
|
|
$datPenjualan[$no] += ['DPPPEN' => number_format($dpp, 2)];
|
|
$datPenjualan[$no] += ['PPNPEN' => number_format($ppnPen, 2)];
|
|
$datPenjualan[$no] += ['TOTPEN' => number_format($totPen, 2)];
|
|
$datPenjualan[$no++] += ['PPN' => round($dat['PPN_SO'])];
|
|
}
|
|
$hasil[$noAkhir] += ['SUBDPP' => number_format($subDpp,2)];
|
|
$hasil[$noAkhir] += ['SUBPPN' => number_format($subPpn,2)];
|
|
$hasil[$noAkhir] += ['SUBTOT' => number_format($subTot,2)];
|
|
$hasil[$noAkhir++] += ['ISI' => $datPenjualan];
|
|
}
|
|
} else {
|
|
foreach ($hasil as $key) {
|
|
$salPel = explode(",", $id_pelanggan);
|
|
$subPen = [];
|
|
$noPen = 0;
|
|
$subDpp = 0;
|
|
$subPpn = 0;
|
|
$subTot = 0;
|
|
foreach ($salPel as $keydat) {
|
|
$datPenjualan = $this->Amod->getData_Penjualan_byCORP_bySALES_byPELANGGAN_byPERIODE_status1(NULL, $key['IDSHEET'], $keydat, $awal, $akhir);
|
|
$no = 0;
|
|
foreach ($datPenjualan as $dat) {
|
|
$sumDo = $this->Amod->getSum_DaftarOrder_byPENJUALAN($dat['ID_PENJUALAN']);
|
|
if ($sumDo[0]['TOTAL']==NULL) {
|
|
$dpp = 0;
|
|
} else {
|
|
$dpp = round($sumDo[0]['TOTAL'],2);
|
|
}
|
|
|
|
$ppnPen = round($dpp*($dat['PPN_SO']/100),2);
|
|
$totPen = round(($dpp+$ppnPen),2);
|
|
|
|
$subDpp = $subDpp+$dpp;
|
|
$subPpn = $subPpn+$ppnPen;
|
|
$subTot = $subTot+$totPen;
|
|
|
|
$datPenjualan[$no] += ['DPPPEN' => number_format($dpp, 2)];
|
|
$datPenjualan[$no] += ['PPNPEN' => number_format($ppnPen, 2)];
|
|
$datPenjualan[$no] += ['TOTPEN' => number_format($totPen, 2)];
|
|
$datPenjualan[$no++] += ['PPN' => round($dat['PPN_SO'])];
|
|
}
|
|
foreach ($datPenjualan as $det) {
|
|
$subPen[$noPen++] = $det;
|
|
}
|
|
}
|
|
$hasil[$noAkhir] += ['SUBDPP' => number_format($subDpp,2)];
|
|
$hasil[$noAkhir] += ['SUBPPN' => number_format($subPpn,2)];
|
|
$hasil[$noAkhir] += ['SUBTOT' => number_format($subTot,2)];
|
|
$hasil[$noAkhir++] += ['ISI' => $subPen];
|
|
}
|
|
}
|
|
} else {
|
|
$listKop = explode(",", $id_corp);
|
|
if ($id_pelanggan=="") {
|
|
foreach ($hasil as $key) {
|
|
$subPen = [];
|
|
$noPen = 0;
|
|
$subDpp = 0;
|
|
$subPpn = 0;
|
|
$subTot = 0;
|
|
foreach ($listKop as $dat) {
|
|
$datPenjualan = $this->Amod->getData_Penjualan_byCORP_bySALES_byPELANGGAN_byPERIODE_status1($dat, $key['IDSHEET'], NULL, $awal, $akhir);
|
|
$no = 0;
|
|
foreach ($datPenjualan as $dut) {
|
|
$sumDo = $this->Amod->getSum_DaftarOrder_byPENJUALAN($dut['ID_PENJUALAN']);
|
|
if ($sumDo[0]['TOTAL']==NULL) {
|
|
$dpp = 0;
|
|
} else {
|
|
$dpp = round($sumDo[0]['TOTAL'],2);
|
|
}
|
|
|
|
$ppnPen = round($dpp*($dut['PPN_SO']/100),2);
|
|
$totPen = round(($dpp+$ppnPen),2);
|
|
|
|
$subDpp = $subDpp+$dpp;
|
|
$subPpn = $subPpn+$ppnPen;
|
|
$subTot = $subTot+$totPen;
|
|
|
|
$datPenjualan[$no] += ['DPPPEN' => number_format($dpp, 2)];
|
|
$datPenjualan[$no] += ['PPNPEN' => number_format($ppnPen, 2)];
|
|
$datPenjualan[$no] += ['TOTPEN' => number_format($totPen, 2)];
|
|
$datPenjualan[$no++] += ['PPN' => round($dut['PPN_SO'])];
|
|
}
|
|
foreach ($datPenjualan as $det) {
|
|
$subPen[$noPen++] = $det;
|
|
}
|
|
}
|
|
$hasil[$noAkhir] += ['SUBDPP' => number_format($subDpp,2)];
|
|
$hasil[$noAkhir] += ['SUBPPN' => number_format($subPpn,2)];
|
|
$hasil[$noAkhir] += ['SUBTOT' => number_format($subTot,2)];
|
|
$hasil[$noAkhir++] += ['ISI' => $subPen];
|
|
}
|
|
} else {
|
|
$listPelanggan = explode(",", $id_pelanggan);
|
|
foreach ($hasil as $key) {
|
|
$subPen = [];
|
|
$noPen = 0;
|
|
$subDpp = 0;
|
|
$subPpn = 0;
|
|
$subTot = 0;
|
|
foreach ($listPelanggan as $keydat) {
|
|
foreach ($listKop as $dat) {
|
|
$datPenjualan = $this->Amod->getData_Penjualan_byCORP_bySALES_byPELANGGAN_byPERIODE_status1($dat, $key['IDSHEET'], $keydat, $awal, $akhir);
|
|
$no = 0;
|
|
foreach ($datPenjualan as $dut) {
|
|
$sumDo = $this->Amod->getSum_DaftarOrder_byPENJUALAN($dut['ID_PENJUALAN']);
|
|
if ($sumDo[0]['TOTAL']==NULL) {
|
|
$dpp = 0;
|
|
} else {
|
|
$dpp = round($sumDo[0]['TOTAL'],2);
|
|
}
|
|
|
|
$ppnPen = round($dpp*($dut['PPN_SO']/100),2);
|
|
$totPen = round(($dpp+$ppnPen),2);
|
|
|
|
$subDpp = $subDpp+$dpp;
|
|
$subPpn = $subPpn+$ppnPen;
|
|
$subTot = $subTot+$totPen;
|
|
|
|
$datPenjualan[$no] += ['DPPPEN' => number_format($dpp, 2)];
|
|
$datPenjualan[$no] += ['PPNPEN' => number_format($ppnPen, 2)];
|
|
$datPenjualan[$no] += ['TOTPEN' => number_format($totPen, 2)];
|
|
$datPenjualan[$no++] += ['PPN' => round($dut['PPN_SO'])];
|
|
}
|
|
foreach ($datPenjualan as $det) {
|
|
$subPen[$noPen++] = $det;
|
|
}
|
|
}
|
|
}
|
|
$hasil[$noAkhir] += ['SUBDPP' => number_format($subDpp,2)];
|
|
$hasil[$noAkhir] += ['SUBPPN' => number_format($subPpn,2)];
|
|
$hasil[$noAkhir] += ['SUBTOT' => number_format($subTot,2)];
|
|
$hasil[$noAkhir++] += ['ISI' => $subPen];
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
$pilih_tabel = array('No', 'Kode', 'Tanggal', 'Kop', 'Pelanggan', 'Sales', 'Nomor SJ', 'Nomor Nota', 'Nomor SO', 'Nomor PO', 'Rate PPN', 'TOP', 'Tukar TT', 'Jatuh Tempo', 'Nilai DPP', 'Nilai PPN', 'Nilai TOTAL');
|
|
|
|
$data = [
|
|
'awal_nota' => date_format(date_create($awal), "d/m/Y"),
|
|
'akhir_nota' => date_format(date_create($akhir), "d/m/Y"),
|
|
'jumlah_kolom' => count($pilih_tabel),
|
|
'nama_tabel' => $pilih_tabel,
|
|
'jenis' => $jenis,
|
|
'hasil' => $hasil,
|
|
'ts' => $timestamp,
|
|
];
|
|
$this->load->view('cetak/PJ_Excel_Sub2_DataPembukuanPenjualan', $data);
|
|
}
|
|
|
|
public function PJ_Excel_Sub2_DataPembukuanRetur() {
|
|
$awal = $this->input->post('tgl_awalfill');
|
|
$akhir = $this->input->post('tgl_akhirfill');
|
|
$jenis = $this->input->post('jenis_fill');
|
|
$id_pelanggan = $this->input->post('id_pelangganfill');
|
|
$id_corp = $this->input->post('id_corpfill');
|
|
$id_sales = $this->input->post('id_salesfill');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$hasil = [];
|
|
$noAwal = 0;
|
|
$noAkhir = 0;
|
|
|
|
if ($jenis==1) { // Campur jadi satu Laporan
|
|
$hasil[$noAwal] = [
|
|
'IDSHEET' => '0',
|
|
'FASHEET' => "CAMPUR",
|
|
'NASHEET' => "Sesuai Filter"
|
|
];
|
|
if ($id_corp=="") {
|
|
if ($id_sales=="") {
|
|
if ($id_pelanggan=="") {
|
|
$datPenjualan = $this->Amod->getData_ReturPenjualan_byCORP_bySALES_byPELANGGAN_byPERIODE_status1(NULL, NULL, NULL, $awal, $akhir);
|
|
$no = 0;
|
|
$subDpp = 0;
|
|
$subPpn = 0;
|
|
$subTot = 0;
|
|
foreach ($datPenjualan as $dat) {
|
|
$sumDo = $this->Amod->getSum_DaftarOrder_byPENJUALAN($dat['ID_PENJUALAN']);
|
|
if ($sumDo[0]['TOTAL']==NULL) {
|
|
$dpp = 0;
|
|
} else {
|
|
$dpp = round($sumDo[0]['TOTAL'],2);
|
|
}
|
|
|
|
$ppnPen = round($dpp*($dat['PPN_SO']/100),2);
|
|
$totPen = round(($dpp+$ppnPen),2);
|
|
|
|
$subDpp = $subDpp+$dpp;
|
|
$subPpn = $subPpn+$ppnPen;
|
|
$subTot = $subTot+$totPen;
|
|
|
|
$datPenjualan[$no] += ['DPPPEN' => number_format($dpp, 2)];
|
|
$datPenjualan[$no] += ['PPNPEN' => number_format($ppnPen, 2)];
|
|
$datPenjualan[$no] += ['TOTPEN' => number_format($totPen, 2)];
|
|
$datPenjualan[$no++] += ['PPN' => round($dat['PPN_SO'])];
|
|
}
|
|
$hasil[$noAkhir] += ['SUBDPP' => number_format($subDpp,2)];
|
|
$hasil[$noAkhir] += ['SUBPPN' => number_format($subPpn,2)];
|
|
$hasil[$noAkhir] += ['SUBTOT' => number_format($subTot,2)];
|
|
$hasil[$noAkhir] += ['ISI' => $datPenjualan];
|
|
} else {
|
|
$listPelanggan = explode(",", $id_pelanggan);
|
|
$subPen = [];
|
|
$noPen = 0;
|
|
$subDpp = 0;
|
|
$subPpn = 0;
|
|
$subTot = 0;
|
|
foreach ($listPelanggan as $dat) {
|
|
$datPenjualan = $this->Amod->getData_ReturPenjualan_byCORP_bySALES_byPELANGGAN_byPERIODE_status1(NULL, NULL, $dat, $awal, $akhir);
|
|
$no = 0;
|
|
foreach ($datPenjualan as $dut) {
|
|
$sumDo = $this->Amod->getSum_DaftarOrder_byPENJUALAN($dut['ID_PENJUALAN']);
|
|
if ($sumDo[0]['TOTAL']==NULL) {
|
|
$dpp = 0;
|
|
} else {
|
|
$dpp = round($sumDo[0]['TOTAL'],2);
|
|
}
|
|
|
|
$ppnPen = round($dpp*($dut['PPN_SO']/100),2);
|
|
$totPen = round(($dpp+$ppnPen),2);
|
|
|
|
$subDpp = $subDpp+$dpp;
|
|
$subPpn = $subPpn+$ppnPen;
|
|
$subTot = $subTot+$totPen;
|
|
|
|
$datPenjualan[$no] += ['DPPPEN' => number_format($dpp, 2)];
|
|
$datPenjualan[$no] += ['PPNPEN' => number_format($ppnPen, 2)];
|
|
$datPenjualan[$no] += ['TOTPEN' => number_format($totPen, 2)];
|
|
$datPenjualan[$no++] += ['PPN' => round($dut['PPN_SO'])];
|
|
}
|
|
foreach ($datPenjualan as $det) {
|
|
$subPen[$noPen++] = $det;
|
|
}
|
|
}
|
|
$hasil[$noAkhir] += ['SUBDPP' => number_format($subDpp,2)];
|
|
$hasil[$noAkhir] += ['SUBPPN' => number_format($subPpn,2)];
|
|
$hasil[$noAkhir] += ['SUBTOT' => number_format($subTot,2)];
|
|
$hasil[$noAkhir] += ['ISI' => $subPen];
|
|
}
|
|
} else {
|
|
$listSales = explode(",", $id_sales);
|
|
$subPen = [];
|
|
$noPen = 0;
|
|
$subDpp = 0;
|
|
$subPpn = 0;
|
|
$subTot = 0;
|
|
if ($id_pelanggan=="") {
|
|
foreach ($listSales as $dat) {
|
|
$datPenjualan = $this->Amod->getData_ReturPenjualan_byCORP_bySALES_byPELANGGAN_byPERIODE_status1(NULL, $dat, NULL, $awal, $akhir);
|
|
$no = 0;
|
|
foreach ($datPenjualan as $det) {
|
|
$sumDo = $this->Amod->getSum_DaftarOrder_byPENJUALAN($det['ID_PENJUALAN']);
|
|
if ($sumDo[0]['TOTAL']==NULL) {
|
|
$dpp = 0;
|
|
} else {
|
|
$dpp = round($sumDo[0]['TOTAL'],2);
|
|
}
|
|
|
|
$ppnPen = round($dpp*($det['PPN_SO']/100),2);
|
|
$totPen = round(($dpp+$ppnPen),2);
|
|
|
|
$subDpp = $subDpp+$dpp;
|
|
$subPpn = $subPpn+$ppnPen;
|
|
$subTot = $subTot+$totPen;
|
|
|
|
$datPenjualan[$no] += ['DPPPEN' => number_format($dpp, 2)];
|
|
$datPenjualan[$no] += ['PPNPEN' => number_format($ppnPen, 2)];
|
|
$datPenjualan[$no] += ['TOTPEN' => number_format($totPen, 2)];
|
|
$datPenjualan[$no++] += ['PPN' => round($det['PPN_SO'])];
|
|
}
|
|
foreach ($datPenjualan as $dut) {
|
|
$subPen[$noPen++] = $dut;
|
|
}
|
|
}
|
|
|
|
$hasil[$noAkhir] += ['SUBDPP' => number_format($subDpp,2)];
|
|
$hasil[$noAkhir] += ['SUBPPN' => number_format($subPpn,2)];
|
|
$hasil[$noAkhir] += ['SUBTOT' => number_format($subTot,2)];
|
|
$hasil[$noAkhir] += ['ISI' => $subPen];
|
|
} else {
|
|
$listPelanggan = explode(",", $id_pelanggan);
|
|
foreach ($listPelanggan as $dot) {
|
|
foreach ($listSales as $dat) {
|
|
$datPenjualan = $this->Amod->getData_ReturPenjualan_byCORP_bySALES_byPELANGGAN_byPERIODE_status1(NULL, $dat, $dot, $awal, $akhir);
|
|
$no = 0;
|
|
foreach ($datPenjualan as $det) {
|
|
$sumDo = $this->Amod->getSum_DaftarOrder_byPENJUALAN($det['ID_PENJUALAN']);
|
|
if ($sumDo[0]['TOTAL']==NULL) {
|
|
$dpp = 0;
|
|
} else {
|
|
$dpp = round($sumDo[0]['TOTAL'],2);
|
|
}
|
|
|
|
$ppnPen = round($dpp*($det['PPN_SO']/100),2);
|
|
$totPen = round(($dpp+$ppnPen),2);
|
|
|
|
$subDpp = $subDpp+$dpp;
|
|
$subPpn = $subPpn+$ppnPen;
|
|
$subTot = $subTot+$totPen;
|
|
|
|
$datPenjualan[$no] += ['DPPPEN' => number_format($dpp, 2)];
|
|
$datPenjualan[$no] += ['PPNPEN' => number_format($ppnPen, 2)];
|
|
$datPenjualan[$no] += ['TOTPEN' => number_format($totPen, 2)];
|
|
$datPenjualan[$no++] += ['PPN' => round($det['PPN_SO'])];
|
|
}
|
|
foreach ($datPenjualan as $dut) {
|
|
$subPen[$noPen++] = $dut;
|
|
}
|
|
}
|
|
}
|
|
$hasil[$noAkhir] += ['SUBDPP' => number_format($subDpp,2)];
|
|
$hasil[$noAkhir] += ['SUBPPN' => number_format($subPpn,2)];
|
|
$hasil[$noAkhir] += ['SUBTOT' => number_format($subTot,2)];
|
|
$hasil[$noAkhir] += ['ISI' => $subPen];
|
|
}
|
|
}
|
|
} else {
|
|
$listCorp = explode(",", $id_corp);
|
|
$subPen = [];
|
|
$noPen = 0;
|
|
$subDpp = 0;
|
|
$subPpn = 0;
|
|
$subTot = 0;
|
|
foreach ($listCorp as $keydat) {
|
|
if ($id_sales=="") {
|
|
if ($id_pelanggan=="") {
|
|
$datPenjualan = $this->Amod->getData_ReturPenjualan_byCORP_bySALES_byPELANGGAN_byPERIODE_status1($keydat, NULL, NULL, $awal, $akhir);
|
|
$no = 0;
|
|
foreach ($datPenjualan as $dat) {
|
|
$sumDo = $this->Amod->getSum_DaftarOrder_byPENJUALAN($dat['ID_PENJUALAN']);
|
|
if ($sumDo[0]['TOTAL']==NULL) {
|
|
$dpp = 0;
|
|
} else {
|
|
$dpp = round($sumDo[0]['TOTAL'],2);
|
|
}
|
|
|
|
$ppnPen = round($dpp*($dat['PPN_SO']/100),2);
|
|
$totPen = round(($dpp+$ppnPen),2);
|
|
|
|
$subDpp = $subDpp+$dpp;
|
|
$subPpn = $subPpn+$ppnPen;
|
|
$subTot = $subTot+$totPen;
|
|
|
|
$datPenjualan[$no] += ['DPPPEN' => number_format($dpp, 2)];
|
|
$datPenjualan[$no] += ['PPNPEN' => number_format($ppnPen, 2)];
|
|
$datPenjualan[$no] += ['TOTPEN' => number_format($totPen, 2)];
|
|
$datPenjualan[$no++] += ['PPN' => round($dat['PPN_SO'])];
|
|
}
|
|
foreach ($datPenjualan as $det) {
|
|
$subPen[$noPen++] = $det;
|
|
}
|
|
} else {
|
|
$listPelanggan = explode(",", $id_pelanggan);
|
|
foreach ($listPelanggan as $dot) {
|
|
$datPenjualan = $this->Amod->getData_ReturPenjualan_byCORP_bySALES_byPELANGGAN_byPERIODE_status1($keydat, NULL, $dot, $awal, $akhir);
|
|
$no = 0;
|
|
foreach ($datPenjualan as $dut) {
|
|
$sumDo = $this->Amod->getSum_DaftarOrder_byPENJUALAN($dut['ID_PENJUALAN']);
|
|
if ($sumDo[0]['TOTAL']==NULL) {
|
|
$dpp = 0;
|
|
} else {
|
|
$dpp = round($sumDo[0]['TOTAL'],2);
|
|
}
|
|
|
|
$ppnPen = round($dpp*($dut['PPN_SO']/100),2);
|
|
$totPen = round(($dpp+$ppnPen),2);
|
|
|
|
$subDpp = $subDpp+$dpp;
|
|
$subPpn = $subPpn+$ppnPen;
|
|
$subTot = $subTot+$totPen;
|
|
|
|
$datPenjualan[$no] += ['DPPPEN' => number_format($dpp, 2)];
|
|
$datPenjualan[$no] += ['PPNPEN' => number_format($ppnPen, 2)];
|
|
$datPenjualan[$no] += ['TOTPEN' => number_format($totPen, 2)];
|
|
$datPenjualan[$no++] += ['PPN' => round($dut['PPN_SO'])];
|
|
}
|
|
foreach ($datPenjualan as $det) {
|
|
$subPen[$noPen++] = $det;
|
|
}
|
|
}
|
|
}
|
|
} else {
|
|
$listSales = explode(",", $id_sales);
|
|
if ($id_pelanggan=="") {
|
|
foreach ($listSales as $dat) {
|
|
$datPenjualan = $this->Amod->getData_ReturPenjualan_byCORP_bySALES_byPELANGGAN_byPERIODE_status1($keydat, $dat, NULL, $awal, $akhir);
|
|
$no = 0;
|
|
foreach ($datPenjualan as $det) {
|
|
$sumDo = $this->Amod->getSum_DaftarOrder_byPENJUALAN($det['ID_PENJUALAN']);
|
|
if ($sumDo[0]['TOTAL']==NULL) {
|
|
$dpp = 0;
|
|
} else {
|
|
$dpp = round($sumDo[0]['TOTAL'],2);
|
|
}
|
|
|
|
$ppnPen = round($dpp*($det['PPN_SO']/100),2);
|
|
$totPen = round(($dpp+$ppnPen),2);
|
|
|
|
$subDpp = $subDpp+$dpp;
|
|
$subPpn = $subPpn+$ppnPen;
|
|
$subTot = $subTot+$totPen;
|
|
|
|
$datPenjualan[$no] += ['DPPPEN' => number_format($dpp, 2)];
|
|
$datPenjualan[$no] += ['PPNPEN' => number_format($ppnPen, 2)];
|
|
$datPenjualan[$no] += ['TOTPEN' => number_format($totPen, 2)];
|
|
$datPenjualan[$no++] += ['PPN' => round($det['PPN_SO'])];
|
|
}
|
|
foreach ($datPenjualan as $dut) {
|
|
$subPen[$noPen++] = $dut;
|
|
}
|
|
}
|
|
} else {
|
|
$listPelanggan = explode(",", $id_pelanggan);
|
|
foreach ($listPelanggan as $dot) {
|
|
foreach ($listSales as $dat) {
|
|
$datPenjualan = $this->Amod->getData_ReturPenjualan_byCORP_bySALES_byPELANGGAN_byPERIODE_status1($keydat, $dat, $dot, $awal, $akhir);
|
|
$no = 0;
|
|
foreach ($datPenjualan as $det) {
|
|
$sumDo = $this->Amod->getSum_DaftarOrder_byPENJUALAN($det['ID_PENJUALAN']);
|
|
if ($sumDo[0]['TOTAL']==NULL) {
|
|
$dpp = 0;
|
|
} else {
|
|
$dpp = round($sumDo[0]['TOTAL'],2);
|
|
}
|
|
|
|
$ppnPen = round($dpp*($det['PPN_SO']/100),2);
|
|
$totPen = round(($dpp+$ppnPen),2);
|
|
|
|
$subDpp = $subDpp+$dpp;
|
|
$subPpn = $subPpn+$ppnPen;
|
|
$subTot = $subTot+$totPen;
|
|
|
|
$datPenjualan[$no] += ['DPPPEN' => number_format($dpp, 2)];
|
|
$datPenjualan[$no] += ['PPNPEN' => number_format($ppnPen, 2)];
|
|
$datPenjualan[$no] += ['TOTPEN' => number_format($totPen, 2)];
|
|
$datPenjualan[$no++] += ['PPN' => round($det['PPN_SO'])];
|
|
}
|
|
foreach ($datPenjualan as $dut) {
|
|
$subPen[$noPen++] = $dut;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
$hasil[$noAkhir] += ['SUBDPP' => number_format($subDpp,2)];
|
|
$hasil[$noAkhir] += ['SUBPPN' => number_format($subPpn,2)];
|
|
$hasil[$noAkhir] += ['SUBTOT' => number_format($subTot,2)];
|
|
$hasil[$noAkhir] += ['ISI' => $subPen];
|
|
}
|
|
} else if ($jenis==2) { // Dipisah Pelanggan
|
|
$salPel = explode(",", $id_pelanggan);
|
|
foreach ($salPel as $key) {
|
|
$datPelanggan = $this->Amod->getData_Pelanggan_byID($key);
|
|
$nama_pelanggan = $datPelanggan[0]['NAMA_PELANGGAN'];
|
|
if (strlen($nama_pelanggan)>20) {
|
|
$namaPel = substr($nama_pelanggan, 0, 20);
|
|
$namaPel = "$namaPel..";
|
|
} else {
|
|
$namaPel = $nama_pelanggan;
|
|
}
|
|
$hasil[$noAwal++] = [
|
|
'IDSHEET' => $key,
|
|
'FASHEET' => $nama_pelanggan,
|
|
'NASHEET' => $namaPel
|
|
];
|
|
}
|
|
|
|
if ($id_corp=="") {
|
|
if ($id_sales=="") {
|
|
foreach ($hasil as $key) {
|
|
$datPenjualan = $this->Amod->getData_ReturPenjualan_byCORP_bySALES_byPELANGGAN_byPERIODE_status1(NULL, NULL, $key['IDSHEET'], $awal, $akhir);
|
|
$no = 0;
|
|
$subDpp = 0;
|
|
$subPpn = 0;
|
|
$subTot = 0;
|
|
foreach ($datPenjualan as $dat) {
|
|
$sumDo = $this->Amod->getSum_DaftarOrder_byPENJUALAN($dat['ID_PENJUALAN']);
|
|
if ($sumDo[0]['TOTAL']==NULL) {
|
|
$dpp = 0;
|
|
} else {
|
|
$dpp = round($sumDo[0]['TOTAL'],2);
|
|
}
|
|
|
|
$ppnPen = round($dpp*($dat['PPN_SO']/100),2);
|
|
$totPen = round(($dpp+$ppnPen),2);
|
|
|
|
$subDpp = $subDpp+$dpp;
|
|
$subPpn = $subPpn+$ppnPen;
|
|
$subTot = $subTot+$totPen;
|
|
|
|
$datPenjualan[$no] += ['DPPPEN' => number_format($dpp, 2)];
|
|
$datPenjualan[$no] += ['PPNPEN' => number_format($ppnPen, 2)];
|
|
$datPenjualan[$no] += ['TOTPEN' => number_format($totPen, 2)];
|
|
$datPenjualan[$no++] += ['PPN' => round($dat['PPN_SO'])];
|
|
}
|
|
$hasil[$noAkhir] += ['SUBDPP' => number_format($subDpp,2)];
|
|
$hasil[$noAkhir] += ['SUBPPN' => number_format($subPpn,2)];
|
|
$hasil[$noAkhir] += ['SUBTOT' => number_format($subTot,2)];
|
|
$hasil[$noAkhir++] += ['ISI' => $datPenjualan];
|
|
}
|
|
} else {
|
|
foreach ($hasil as $key) {
|
|
$salSales = explode(",", $id_sales);
|
|
$subPen = [];
|
|
$noPen = 0;
|
|
$subDpp = 0;
|
|
$subPpn = 0;
|
|
$subTot = 0;
|
|
foreach ($salSales as $keydat) {
|
|
$datPenjualan = $this->Amod->getData_ReturPenjualan_byCORP_bySALES_byPELANGGAN_byPERIODE_status1(NULL, $keydat, $key['IDSHEET'], $awal, $akhir);
|
|
$no = 0;
|
|
foreach ($datPenjualan as $dat) {
|
|
$sumDo = $this->Amod->getSum_DaftarOrder_byPENJUALAN($dat['ID_PENJUALAN']);
|
|
if ($sumDo[0]['TOTAL']==NULL) {
|
|
$dpp = 0;
|
|
} else {
|
|
$dpp = round($sumDo[0]['TOTAL'],2);
|
|
}
|
|
|
|
$ppnPen = round($dpp*($dat['PPN_SO']/100),2);
|
|
$totPen = round(($dpp+$ppnPen),2);
|
|
|
|
$subDpp = $subDpp+$dpp;
|
|
$subPpn = $subPpn+$ppnPen;
|
|
$subTot = $subTot+$totPen;
|
|
|
|
$datPenjualan[$no] += ['DPPPEN' => number_format($dpp, 2)];
|
|
$datPenjualan[$no] += ['PPNPEN' => number_format($ppnPen, 2)];
|
|
$datPenjualan[$no] += ['TOTPEN' => number_format($totPen, 2)];
|
|
$datPenjualan[$no++] += ['PPN' => round($dat['PPN_SO'])];
|
|
}
|
|
foreach ($datPenjualan as $det) {
|
|
$subPen[$noPen++] = $det;
|
|
}
|
|
}
|
|
$hasil[$noAkhir] += ['SUBDPP' => number_format($subDpp,2)];
|
|
$hasil[$noAkhir] += ['SUBPPN' => number_format($subPpn,2)];
|
|
$hasil[$noAkhir] += ['SUBTOT' => number_format($subTot,2)];
|
|
$hasil[$noAkhir++] += ['ISI' => $subPen];
|
|
}
|
|
}
|
|
} else {
|
|
$listKop = explode(",", $id_corp);
|
|
if ($id_sales=="") {
|
|
foreach ($hasil as $key) {
|
|
$subPen = [];
|
|
$noPen = 0;
|
|
$subDpp = 0;
|
|
$subPpn = 0;
|
|
$subTot = 0;
|
|
foreach ($listKop as $dat) {
|
|
$datPenjualan = $this->Amod->getData_ReturPenjualan_byCORP_bySALES_byPELANGGAN_byPERIODE_status1($dat, NULL, $key['IDSHEET'], $awal, $akhir);
|
|
$no = 0;
|
|
foreach ($datPenjualan as $dut) {
|
|
$sumDo = $this->Amod->getSum_DaftarOrder_byPENJUALAN($dut['ID_PENJUALAN']);
|
|
if ($sumDo[0]['TOTAL']==NULL) {
|
|
$dpp = 0;
|
|
} else {
|
|
$dpp = round($sumDo[0]['TOTAL'],2);
|
|
}
|
|
|
|
$ppnPen = round($dpp*($dut['PPN_SO']/100),2);
|
|
$totPen = round(($dpp+$ppnPen),2);
|
|
|
|
$subDpp = $subDpp+$dpp;
|
|
$subPpn = $subPpn+$ppnPen;
|
|
$subTot = $subTot+$totPen;
|
|
|
|
$datPenjualan[$no] += ['DPPPEN' => number_format($dpp, 2)];
|
|
$datPenjualan[$no] += ['PPNPEN' => number_format($ppnPen, 2)];
|
|
$datPenjualan[$no] += ['TOTPEN' => number_format($totPen, 2)];
|
|
$datPenjualan[$no++] += ['PPN' => round($dut['PPN_SO'])];
|
|
}
|
|
foreach ($datPenjualan as $det) {
|
|
$subPen[$noPen++] = $det;
|
|
}
|
|
}
|
|
$hasil[$noAkhir] += ['SUBDPP' => number_format($subDpp,2)];
|
|
$hasil[$noAkhir] += ['SUBPPN' => number_format($subPpn,2)];
|
|
$hasil[$noAkhir] += ['SUBTOT' => number_format($subTot,2)];
|
|
$hasil[$noAkhir++] += ['ISI' => $subPen];
|
|
}
|
|
} else {
|
|
$listSales = explode(",", $id_sales);
|
|
foreach ($hasil as $key) {
|
|
$subPen = [];
|
|
$noPen = 0;
|
|
$subDpp = 0;
|
|
$subPpn = 0;
|
|
$subTot = 0;
|
|
foreach ($listSales as $keydat) {
|
|
foreach ($listKop as $dat) {
|
|
$datPenjualan = $this->Amod->getData_ReturPenjualan_byCORP_bySALES_byPELANGGAN_byPERIODE_status1($dat, $keydat, $key['IDSHEET'], $awal, $akhir);
|
|
$no = 0;
|
|
foreach ($datPenjualan as $dut) {
|
|
$sumDo = $this->Amod->getSum_DaftarOrder_byPENJUALAN($dut['ID_PENJUALAN']);
|
|
if ($sumDo[0]['TOTAL']==NULL) {
|
|
$dpp = 0;
|
|
} else {
|
|
$dpp = round($sumDo[0]['TOTAL'],2);
|
|
}
|
|
|
|
$ppnPen = round($dpp*($dut['PPN_SO']/100),2);
|
|
$totPen = round(($dpp+$ppnPen),2);
|
|
|
|
$subDpp = $subDpp+$dpp;
|
|
$subPpn = $subPpn+$ppnPen;
|
|
$subTot = $subTot+$totPen;
|
|
|
|
$datPenjualan[$no] += ['DPPPEN' => number_format($dpp, 2)];
|
|
$datPenjualan[$no] += ['PPNPEN' => number_format($ppnPen, 2)];
|
|
$datPenjualan[$no] += ['TOTPEN' => number_format($totPen, 2)];
|
|
$datPenjualan[$no++] += ['PPN' => round($dut['PPN_SO'])];
|
|
}
|
|
foreach ($datPenjualan as $det) {
|
|
$subPen[$noPen++] = $det;
|
|
}
|
|
}
|
|
}
|
|
$hasil[$noAkhir] += ['SUBDPP' => number_format($subDpp,2)];
|
|
$hasil[$noAkhir] += ['SUBPPN' => number_format($subPpn,2)];
|
|
$hasil[$noAkhir] += ['SUBTOT' => number_format($subTot,2)];
|
|
$hasil[$noAkhir++] += ['ISI' => $subPen];
|
|
}
|
|
}
|
|
}
|
|
} else if ($jenis==3) { // Dipisah Kop
|
|
if ($id_corp=="") {
|
|
$salKop = $this->Amod->getData_Corp_bySTATUS(1);
|
|
foreach ($salKop as $key) {
|
|
$kop = $this->Amod->generate_inisialCorp($key['ID_CORP']);
|
|
$hasil[$noAwal++] = [
|
|
'IDSHEET' => $key['ID_CORP'],
|
|
'FASHEET' => $kop,
|
|
'NASHEET' => $kop
|
|
];
|
|
}
|
|
} else {
|
|
$salKop = explode(",", $id_corp);
|
|
foreach ($salKop as $key) {
|
|
$kop = $this->Amod->generate_inisialCorp($key);
|
|
$hasil[$noAwal++] = [
|
|
'IDSHEET' => $key,
|
|
'FASHEET' => $kop,
|
|
'NASHEET' => $kop
|
|
];
|
|
}
|
|
}
|
|
|
|
if ($id_pelanggan=="") {
|
|
if ($id_sales=="") {
|
|
foreach ($hasil as $key) {
|
|
$datPenjualan = $this->Amod->getData_ReturPenjualan_byCORP_bySALES_byPELANGGAN_byPERIODE_status1($key['IDSHEET'], NULL, NULL, $awal, $akhir);
|
|
$no = 0;
|
|
$subDpp = 0;
|
|
$subPpn = 0;
|
|
$subTot = 0;
|
|
foreach ($datPenjualan as $dat) {
|
|
$sumDo = $this->Amod->getSum_DaftarOrder_byPENJUALAN($dat['ID_PENJUALAN']);
|
|
if ($sumDo[0]['TOTAL']==NULL) {
|
|
$dpp = 0;
|
|
} else {
|
|
$dpp = round($sumDo[0]['TOTAL'],2);
|
|
}
|
|
|
|
$ppnPen = round($dpp*($dat['PPN_SO']/100),2);
|
|
$totPen = round(($dpp+$ppnPen),2);
|
|
|
|
$subDpp = $subDpp+$dpp;
|
|
$subPpn = $subPpn+$ppnPen;
|
|
$subTot = $subTot+$totPen;
|
|
|
|
$datPenjualan[$no] += ['DPPPEN' => number_format($dpp, 2)];
|
|
$datPenjualan[$no] += ['PPNPEN' => number_format($ppnPen, 2)];
|
|
$datPenjualan[$no] += ['TOTPEN' => number_format($totPen, 2)];
|
|
$datPenjualan[$no++] += ['PPN' => round($dat['PPN_SO'])];
|
|
}
|
|
$hasil[$noAkhir] += ['SUBDPP' => number_format($subDpp,2)];
|
|
$hasil[$noAkhir] += ['SUBPPN' => number_format($subPpn,2)];
|
|
$hasil[$noAkhir] += ['SUBTOT' => number_format($subTot,2)];
|
|
$hasil[$noAkhir++] += ['ISI' => $datPenjualan];
|
|
}
|
|
} else {
|
|
foreach ($hasil as $key) {
|
|
$salSales = explode(",", $id_sales);
|
|
$subPen = [];
|
|
$noPen = 0;
|
|
$subDpp = 0;
|
|
$subPpn = 0;
|
|
$subTot = 0;
|
|
foreach ($salSales as $keydat) {
|
|
$datPenjualan = $this->Amod->getData_ReturPenjualan_byCORP_bySALES_byPELANGGAN_byPERIODE_status1($key['IDSHEET'], $keydat, NULL, $awal, $akhir);
|
|
$no = 0;
|
|
foreach ($datPenjualan as $dat) {
|
|
$sumDo = $this->Amod->getSum_DaftarOrder_byPENJUALAN($dat['ID_PENJUALAN']);
|
|
if ($sumDo[0]['TOTAL']==NULL) {
|
|
$dpp = 0;
|
|
} else {
|
|
$dpp = round($sumDo[0]['TOTAL'],2);
|
|
}
|
|
|
|
$ppnPen = round($dpp*($dat['PPN_SO']/100),2);
|
|
$totPen = round(($dpp+$ppnPen),2);
|
|
|
|
$subDpp = $subDpp+$dpp;
|
|
$subPpn = $subPpn+$ppnPen;
|
|
$subTot = $subTot+$totPen;
|
|
|
|
$datPenjualan[$no] += ['DPPPEN' => number_format($dpp, 2)];
|
|
$datPenjualan[$no] += ['PPNPEN' => number_format($ppnPen, 2)];
|
|
$datPenjualan[$no] += ['TOTPEN' => number_format($totPen, 2)];
|
|
$datPenjualan[$no++] += ['PPN' => round($dat['PPN_SO'])];
|
|
}
|
|
foreach ($datPenjualan as $det) {
|
|
$subPen[$noPen++] = $det;
|
|
}
|
|
}
|
|
$hasil[$noAkhir] += ['SUBDPP' => number_format($subDpp,2)];
|
|
$hasil[$noAkhir] += ['SUBPPN' => number_format($subPpn,2)];
|
|
$hasil[$noAkhir] += ['SUBTOT' => number_format($subTot,2)];
|
|
$hasil[$noAkhir++] += ['ISI' => $subPen];
|
|
}
|
|
}
|
|
} else {
|
|
$listPelanggan = explode(",", $id_pelanggan);
|
|
if ($id_sales=="") {
|
|
foreach ($hasil as $key) {
|
|
$subPen = [];
|
|
$noPen = 0;
|
|
$subDpp = 0;
|
|
$subPpn = 0;
|
|
$subTot = 0;
|
|
foreach ($listPelanggan as $dat) {
|
|
$datPenjualan = $this->Amod->getData_ReturPenjualan_byCORP_bySALES_byPELANGGAN_byPERIODE_status1($key['IDSHEET'], NULL, $dat, $awal, $akhir);
|
|
$no = 0;
|
|
foreach ($datPenjualan as $dut) {
|
|
$sumDo = $this->Amod->getSum_DaftarOrder_byPENJUALAN($dut['ID_PENJUALAN']);
|
|
if ($sumDo[0]['TOTAL']==NULL) {
|
|
$dpp = 0;
|
|
} else {
|
|
$dpp = round($sumDo[0]['TOTAL'],2);
|
|
}
|
|
|
|
$ppnPen = round($dpp*($dut['PPN_SO']/100),2);
|
|
$totPen = round(($dpp+$ppnPen),2);
|
|
|
|
$subDpp = $subDpp+$dpp;
|
|
$subPpn = $subPpn+$ppnPen;
|
|
$subTot = $subTot+$totPen;
|
|
|
|
$datPenjualan[$no] += ['DPPPEN' => number_format($dpp, 2)];
|
|
$datPenjualan[$no] += ['PPNPEN' => number_format($ppnPen, 2)];
|
|
$datPenjualan[$no] += ['TOTPEN' => number_format($totPen, 2)];
|
|
$datPenjualan[$no++] += ['PPN' => round($dut['PPN_SO'])];
|
|
}
|
|
foreach ($datPenjualan as $det) {
|
|
$subPen[$noPen++] = $det;
|
|
}
|
|
}
|
|
$hasil[$noAkhir] += ['SUBDPP' => number_format($subDpp,2)];
|
|
$hasil[$noAkhir] += ['SUBPPN' => number_format($subPpn,2)];
|
|
$hasil[$noAkhir] += ['SUBTOT' => number_format($subTot,2)];
|
|
$hasil[$noAkhir++] += ['ISI' => $subPen];
|
|
}
|
|
} else {
|
|
$listSales = explode(",", $id_sales);
|
|
foreach ($hasil as $key) {
|
|
$subPen = [];
|
|
$noPen = 0;
|
|
$subDpp = 0;
|
|
$subPpn = 0;
|
|
$subTot = 0;
|
|
foreach ($listSales as $keydat) {
|
|
foreach ($listPelanggan as $dat) {
|
|
$datPenjualan = $this->Amod->getData_ReturPenjualan_byCORP_bySALES_byPELANGGAN_byPERIODE_status1($key['IDSHEET'], $keydat, $dat, $awal, $akhir);
|
|
$no = 0;
|
|
foreach ($datPenjualan as $dut) {
|
|
$sumDo = $this->Amod->getSum_DaftarOrder_byPENJUALAN($dut['ID_PENJUALAN']);
|
|
if ($sumDo[0]['TOTAL']==NULL) {
|
|
$dpp = 0;
|
|
} else {
|
|
$dpp = round($sumDo[0]['TOTAL'],2);
|
|
}
|
|
|
|
$ppnPen = round($dpp*($dut['PPN_SO']/100),2);
|
|
$totPen = round(($dpp+$ppnPen),2);
|
|
|
|
$subDpp = $subDpp+$dpp;
|
|
$subPpn = $subPpn+$ppnPen;
|
|
$subTot = $subTot+$totPen;
|
|
|
|
$datPenjualan[$no] += ['DPPPEN' => number_format($dpp, 2)];
|
|
$datPenjualan[$no] += ['PPNPEN' => number_format($ppnPen, 2)];
|
|
$datPenjualan[$no] += ['TOTPEN' => number_format($totPen, 2)];
|
|
$datPenjualan[$no++] += ['PPN' => round($dut['PPN_SO'])];
|
|
}
|
|
foreach ($datPenjualan as $det) {
|
|
$subPen[$noPen++] = $det;
|
|
}
|
|
}
|
|
}
|
|
$hasil[$noAkhir] += ['SUBDPP' => number_format($subDpp,2)];
|
|
$hasil[$noAkhir] += ['SUBPPN' => number_format($subPpn,2)];
|
|
$hasil[$noAkhir] += ['SUBTOT' => number_format($subTot,2)];
|
|
$hasil[$noAkhir++] += ['ISI' => $subPen];
|
|
}
|
|
}
|
|
}
|
|
} else if ($jenis==4) { // Dipisah Sales
|
|
if ($id_sales=="") {
|
|
$salSales = $this->Amod->getData_Karyawan_allSales();
|
|
foreach ($salSales as $key) {
|
|
$hasil[$noAwal++] = [
|
|
'IDSHEET' => $key['ID_KARYAWAN'],
|
|
'FASHEET' => $key['NAMA_PANGGILAN_KARYAWAN'],
|
|
'NASHEET' => $key['NAMA_PANGGILAN_KARYAWAN']
|
|
];
|
|
}
|
|
} else {
|
|
$salSales = explode(",", $id_sales);
|
|
foreach ($salSales as $key) {
|
|
$datKaryawan = $this->Amod->getData_Karyawan_byID($key);
|
|
$hasil[$noAwal++] = [
|
|
'IDSHEET' => $key,
|
|
'FASHEET' => $datKaryawan[0]['NAMA_PANGGILAN_KARYAWAN'],
|
|
'NASHEET' => $datKaryawan[0]['NAMA_PANGGILAN_KARYAWAN']
|
|
];
|
|
}
|
|
}
|
|
|
|
if ($id_corp=="") {
|
|
if ($id_pelanggan=="") {
|
|
foreach ($hasil as $key) {
|
|
$datPenjualan = $this->Amod->getData_ReturPenjualan_byCORP_bySALES_byPELANGGAN_byPERIODE_status1(NULL, $key['IDSHEET'], NULL, $awal, $akhir);
|
|
$no = 0;
|
|
$subDpp = 0;
|
|
$subPpn = 0;
|
|
$subTot = 0;
|
|
foreach ($datPenjualan as $dat) {
|
|
$sumDo = $this->Amod->getSum_DaftarOrder_byPENJUALAN($dat['ID_PENJUALAN']);
|
|
if ($sumDo[0]['TOTAL']==NULL) {
|
|
$dpp = 0;
|
|
} else {
|
|
$dpp = round($sumDo[0]['TOTAL'],2);
|
|
}
|
|
|
|
$ppnPen = round($dpp*($dat['PPN_SO']/100),2);
|
|
$totPen = round(($dpp+$ppnPen),2);
|
|
|
|
$subDpp = $subDpp+$dpp;
|
|
$subPpn = $subPpn+$ppnPen;
|
|
$subTot = $subTot+$totPen;
|
|
|
|
$datPenjualan[$no] += ['DPPPEN' => number_format($dpp, 2)];
|
|
$datPenjualan[$no] += ['PPNPEN' => number_format($ppnPen, 2)];
|
|
$datPenjualan[$no] += ['TOTPEN' => number_format($totPen, 2)];
|
|
$datPenjualan[$no++] += ['PPN' => round($dat['PPN_SO'])];
|
|
}
|
|
$hasil[$noAkhir] += ['SUBDPP' => number_format($subDpp,2)];
|
|
$hasil[$noAkhir] += ['SUBPPN' => number_format($subPpn,2)];
|
|
$hasil[$noAkhir] += ['SUBTOT' => number_format($subTot,2)];
|
|
$hasil[$noAkhir++] += ['ISI' => $datPenjualan];
|
|
}
|
|
} else {
|
|
foreach ($hasil as $key) {
|
|
$salPel = explode(",", $id_pelanggan);
|
|
$subPen = [];
|
|
$noPen = 0;
|
|
$subDpp = 0;
|
|
$subPpn = 0;
|
|
$subTot = 0;
|
|
foreach ($salPel as $keydat) {
|
|
$datPenjualan = $this->Amod->getData_ReturPenjualan_byCORP_bySALES_byPELANGGAN_byPERIODE_status1(NULL, $key['IDSHEET'], $keydat, $awal, $akhir);
|
|
$no = 0;
|
|
foreach ($datPenjualan as $dat) {
|
|
$sumDo = $this->Amod->getSum_DaftarOrder_byPENJUALAN($dat['ID_PENJUALAN']);
|
|
if ($sumDo[0]['TOTAL']==NULL) {
|
|
$dpp = 0;
|
|
} else {
|
|
$dpp = round($sumDo[0]['TOTAL'],2);
|
|
}
|
|
|
|
$ppnPen = round($dpp*($dat['PPN_SO']/100),2);
|
|
$totPen = round(($dpp+$ppnPen),2);
|
|
|
|
$subDpp = $subDpp+$dpp;
|
|
$subPpn = $subPpn+$ppnPen;
|
|
$subTot = $subTot+$totPen;
|
|
|
|
$datPenjualan[$no] += ['DPPPEN' => number_format($dpp, 2)];
|
|
$datPenjualan[$no] += ['PPNPEN' => number_format($ppnPen, 2)];
|
|
$datPenjualan[$no] += ['TOTPEN' => number_format($totPen, 2)];
|
|
$datPenjualan[$no++] += ['PPN' => round($dat['PPN_SO'])];
|
|
}
|
|
foreach ($datPenjualan as $det) {
|
|
$subPen[$noPen++] = $det;
|
|
}
|
|
}
|
|
$hasil[$noAkhir] += ['SUBDPP' => number_format($subDpp,2)];
|
|
$hasil[$noAkhir] += ['SUBPPN' => number_format($subPpn,2)];
|
|
$hasil[$noAkhir] += ['SUBTOT' => number_format($subTot,2)];
|
|
$hasil[$noAkhir++] += ['ISI' => $subPen];
|
|
}
|
|
}
|
|
} else {
|
|
$listKop = explode(",", $id_corp);
|
|
if ($id_pelanggan=="") {
|
|
foreach ($hasil as $key) {
|
|
$subPen = [];
|
|
$noPen = 0;
|
|
$subDpp = 0;
|
|
$subPpn = 0;
|
|
$subTot = 0;
|
|
foreach ($listKop as $dat) {
|
|
$datPenjualan = $this->Amod->getData_ReturPenjualan_byCORP_bySALES_byPELANGGAN_byPERIODE_status1($dat, $key['IDSHEET'], NULL, $awal, $akhir);
|
|
$no = 0;
|
|
foreach ($datPenjualan as $dut) {
|
|
$sumDo = $this->Amod->getSum_DaftarOrder_byPENJUALAN($dut['ID_PENJUALAN']);
|
|
if ($sumDo[0]['TOTAL']==NULL) {
|
|
$dpp = 0;
|
|
} else {
|
|
$dpp = round($sumDo[0]['TOTAL'],2);
|
|
}
|
|
|
|
$ppnPen = round($dpp*($dut['PPN_SO']/100),2);
|
|
$totPen = round(($dpp+$ppnPen),2);
|
|
|
|
$subDpp = $subDpp+$dpp;
|
|
$subPpn = $subPpn+$ppnPen;
|
|
$subTot = $subTot+$totPen;
|
|
|
|
$datPenjualan[$no] += ['DPPPEN' => number_format($dpp, 2)];
|
|
$datPenjualan[$no] += ['PPNPEN' => number_format($ppnPen, 2)];
|
|
$datPenjualan[$no] += ['TOTPEN' => number_format($totPen, 2)];
|
|
$datPenjualan[$no++] += ['PPN' => round($dut['PPN_SO'])];
|
|
}
|
|
foreach ($datPenjualan as $det) {
|
|
$subPen[$noPen++] = $det;
|
|
}
|
|
}
|
|
$hasil[$noAkhir] += ['SUBDPP' => number_format($subDpp,2)];
|
|
$hasil[$noAkhir] += ['SUBPPN' => number_format($subPpn,2)];
|
|
$hasil[$noAkhir] += ['SUBTOT' => number_format($subTot,2)];
|
|
$hasil[$noAkhir++] += ['ISI' => $subPen];
|
|
}
|
|
} else {
|
|
$listPelanggan = explode(",", $id_pelanggan);
|
|
foreach ($hasil as $key) {
|
|
$subPen = [];
|
|
$noPen = 0;
|
|
$subDpp = 0;
|
|
$subPpn = 0;
|
|
$subTot = 0;
|
|
foreach ($listPelanggan as $keydat) {
|
|
foreach ($listKop as $dat) {
|
|
$datPenjualan = $this->Amod->getData_ReturPenjualan_byCORP_bySALES_byPELANGGAN_byPERIODE_status1($dat, $key['IDSHEET'], $keydat, $awal, $akhir);
|
|
$no = 0;
|
|
foreach ($datPenjualan as $dut) {
|
|
$sumDo = $this->Amod->getSum_DaftarOrder_byPENJUALAN($dut['ID_PENJUALAN']);
|
|
if ($sumDo[0]['TOTAL']==NULL) {
|
|
$dpp = 0;
|
|
} else {
|
|
$dpp = round($sumDo[0]['TOTAL'],2);
|
|
}
|
|
|
|
$ppnPen = round($dpp*($dut['PPN_SO']/100),2);
|
|
$totPen = round(($dpp+$ppnPen),2);
|
|
|
|
$subDpp = $subDpp+$dpp;
|
|
$subPpn = $subPpn+$ppnPen;
|
|
$subTot = $subTot+$totPen;
|
|
|
|
$datPenjualan[$no] += ['DPPPEN' => number_format($dpp, 2)];
|
|
$datPenjualan[$no] += ['PPNPEN' => number_format($ppnPen, 2)];
|
|
$datPenjualan[$no] += ['TOTPEN' => number_format($totPen, 2)];
|
|
$datPenjualan[$no++] += ['PPN' => round($dut['PPN_SO'])];
|
|
}
|
|
foreach ($datPenjualan as $det) {
|
|
$subPen[$noPen++] = $det;
|
|
}
|
|
}
|
|
}
|
|
$hasil[$noAkhir] += ['SUBDPP' => number_format($subDpp,2)];
|
|
$hasil[$noAkhir] += ['SUBPPN' => number_format($subPpn,2)];
|
|
$hasil[$noAkhir] += ['SUBTOT' => number_format($subTot,2)];
|
|
$hasil[$noAkhir++] += ['ISI' => $subPen];
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
$pilih_tabel = array('No', 'Kode', 'Tanggal', 'Kop', 'Pelanggan', 'Sales', 'Nomor Retur', 'Nomor Nota', 'Keterangan Retur', 'Rate PPN', 'Nilai DPP', 'Nilai PPN', 'Nilai TOTAL');
|
|
|
|
$data = [
|
|
'awal_nota' => date_format(date_create($awal), "d/m/Y"),
|
|
'akhir_nota' => date_format(date_create($akhir), "d/m/Y"),
|
|
'jumlah_kolom' => count($pilih_tabel),
|
|
'nama_tabel' => $pilih_tabel,
|
|
'jenis' => $jenis,
|
|
'hasil' => $hasil,
|
|
'ts' => $timestamp,
|
|
];
|
|
$this->load->view('cetak/PJ_Excel_Sub2_DataPembukuanRetur', $data);
|
|
}
|
|
|
|
public function PJ_Excel_Sub2_DataPembukuanBatal() {
|
|
$awal = $this->input->post('tgl_awalfill');
|
|
$akhir = $this->input->post('tgl_akhirfill');
|
|
$jenis = $this->input->post('jenis_fill');
|
|
$id_pelanggan = $this->input->post('id_pelangganfill');
|
|
$id_corp = $this->input->post('id_corpfill');
|
|
$id_sales = $this->input->post('id_salesfill');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$hasil = [];
|
|
$noAwal = 0;
|
|
$noAkhir = 0;
|
|
|
|
if ($jenis==1) { // Campur jadi satu Laporan
|
|
$hasil[$noAwal] = [
|
|
'IDSHEET' => '0',
|
|
'FASHEET' => "CAMPUR",
|
|
'NASHEET' => "Sesuai Filter"
|
|
];
|
|
if ($id_corp=="") {
|
|
if ($id_sales=="") {
|
|
if ($id_pelanggan=="") {
|
|
$datPenjualan = $this->Amod->getData_Penjualan_byCORP_bySALES_byPELANGGAN_byPERIODE_status0(NULL, NULL, NULL, $awal, $akhir);
|
|
$hasil[$noAkhir] += ['ISI' => $datPenjualan];
|
|
} else {
|
|
$listPelanggan = explode(",", $id_pelanggan);
|
|
$subPen = [];
|
|
$noPen = 0;
|
|
foreach ($listPelanggan as $dat) {
|
|
$datPenjualan = $this->Amod->getData_Penjualan_byCORP_bySALES_byPELANGGAN_byPERIODE_status0(NULL, NULL, $dat, $awal, $akhir);
|
|
|
|
foreach ($datPenjualan as $det) {
|
|
$subPen[$noPen++] = $det;
|
|
}
|
|
}
|
|
$hasil[$noAkhir] += ['ISI' => $subPen];
|
|
}
|
|
} else {
|
|
$listSales = explode(",", $id_sales);
|
|
$subPen = [];
|
|
$noPen = 0;
|
|
if ($id_pelanggan=="") {
|
|
foreach ($listSales as $dat) {
|
|
$datPenjualan = $this->Amod->getData_Penjualan_byCORP_bySALES_byPELANGGAN_byPERIODE_status0(NULL, $dat, NULL, $awal, $akhir);
|
|
|
|
foreach ($datPenjualan as $dut) {
|
|
$subPen[$noPen++] = $dut;
|
|
}
|
|
}
|
|
$hasil[$noAkhir] += ['ISI' => $subPen];
|
|
} else {
|
|
$listPelanggan = explode(",", $id_pelanggan);
|
|
foreach ($listPelanggan as $dot) {
|
|
foreach ($listSales as $dat) {
|
|
$datPenjualan = $this->Amod->getData_Penjualan_byCORP_bySALES_byPELANGGAN_byPERIODE_status0(NULL, $dat, $dot, $awal, $akhir);
|
|
|
|
foreach ($datPenjualan as $dut) {
|
|
$subPen[$noPen++] = $dut;
|
|
}
|
|
}
|
|
}
|
|
$hasil[$noAkhir] += ['ISI' => $subPen];
|
|
}
|
|
}
|
|
} else {
|
|
$listCorp = explode(",", $id_corp);
|
|
$subPen = [];
|
|
$noPen = 0;
|
|
foreach ($listCorp as $keydat) {
|
|
if ($id_sales=="") {
|
|
if ($id_pelanggan=="") {
|
|
$datPenjualan = $this->Amod->getData_Penjualan_byCORP_bySALES_byPELANGGAN_byPERIODE_status0($keydat, NULL, NULL, $awal, $akhir);
|
|
|
|
foreach ($datPenjualan as $det) {
|
|
$subPen[$noPen++] = $det;
|
|
}
|
|
} else {
|
|
$listPelanggan = explode(",", $id_pelanggan);
|
|
foreach ($listPelanggan as $dot) {
|
|
$datPenjualan = $this->Amod->getData_Penjualan_byCORP_bySALES_byPELANGGAN_byPERIODE_status0($keydat, NULL, $dot, $awal, $akhir);
|
|
|
|
foreach ($datPenjualan as $det) {
|
|
$subPen[$noPen++] = $det;
|
|
}
|
|
}
|
|
}
|
|
} else {
|
|
$listSales = explode(",", $id_sales);
|
|
if ($id_pelanggan=="") {
|
|
foreach ($listSales as $dat) {
|
|
$datPenjualan = $this->Amod->getData_Penjualan_byCORP_bySALES_byPELANGGAN_byPERIODE_status0($keydat, $dat, NULL, $awal, $akhir);
|
|
|
|
foreach ($datPenjualan as $dut) {
|
|
$subPen[$noPen++] = $dut;
|
|
}
|
|
}
|
|
} else {
|
|
$listPelanggan = explode(",", $id_pelanggan);
|
|
foreach ($listPelanggan as $dot) {
|
|
foreach ($listSales as $dat) {
|
|
$datPenjualan = $this->Amod->getData_Penjualan_byCORP_bySALES_byPELANGGAN_byPERIODE_status0($keydat, $dat, $dot, $awal, $akhir);
|
|
|
|
foreach ($datPenjualan as $dut) {
|
|
$subPen[$noPen++] = $dut;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
$hasil[$noAkhir] += ['ISI' => $subPen];
|
|
}
|
|
} else if ($jenis==2) { // Dipisah Pelanggan
|
|
$salPel = explode(",", $id_pelanggan);
|
|
foreach ($salPel as $key) {
|
|
$datPelanggan = $this->Amod->getData_Pelanggan_byID($key);
|
|
$nama_pelanggan = $datPelanggan[0]['NAMA_PELANGGAN'];
|
|
if (strlen($nama_pelanggan)>20) {
|
|
$namaPel = substr($nama_pelanggan, 0, 20);
|
|
$namaPel = "$namaPel..";
|
|
} else {
|
|
$namaPel = $nama_pelanggan;
|
|
}
|
|
$hasil[$noAwal++] = [
|
|
'IDSHEET' => $key,
|
|
'FASHEET' => $nama_pelanggan,
|
|
'NASHEET' => $namaPel
|
|
];
|
|
}
|
|
|
|
if ($id_corp=="") {
|
|
if ($id_sales=="") {
|
|
foreach ($hasil as $key) {
|
|
$datPenjualan = $this->Amod->getData_Penjualan_byCORP_bySALES_byPELANGGAN_byPERIODE_status0(NULL, NULL, $key['IDSHEET'], $awal, $akhir);
|
|
|
|
$hasil[$noAkhir++] += ['ISI' => $datPenjualan];
|
|
}
|
|
} else {
|
|
foreach ($hasil as $key) {
|
|
$salSales = explode(",", $id_sales);
|
|
$subPen = [];
|
|
$noPen = 0;
|
|
foreach ($salSales as $keydat) {
|
|
$datPenjualan = $this->Amod->getData_Penjualan_byCORP_bySALES_byPELANGGAN_byPERIODE_status0(NULL, $keydat, $key['IDSHEET'], $awal, $akhir);
|
|
|
|
foreach ($datPenjualan as $det) {
|
|
$subPen[$noPen++] = $det;
|
|
}
|
|
}
|
|
$hasil[$noAkhir++] += ['ISI' => $subPen];
|
|
}
|
|
}
|
|
} else {
|
|
$listKop = explode(",", $id_corp);
|
|
if ($id_sales=="") {
|
|
foreach ($hasil as $key) {
|
|
$subPen = [];
|
|
$noPen = 0;
|
|
foreach ($listKop as $dat) {
|
|
$datPenjualan = $this->Amod->getData_Penjualan_byCORP_bySALES_byPELANGGAN_byPERIODE_status0($dat, NULL, $key['IDSHEET'], $awal, $akhir);
|
|
|
|
foreach ($datPenjualan as $det) {
|
|
$subPen[$noPen++] = $det;
|
|
}
|
|
}
|
|
$hasil[$noAkhir++] += ['ISI' => $subPen];
|
|
}
|
|
} else {
|
|
$listSales = explode(",", $id_sales);
|
|
foreach ($hasil as $key) {
|
|
$subPen = [];
|
|
$noPen = 0;
|
|
foreach ($listSales as $keydat) {
|
|
foreach ($listKop as $dat) {
|
|
$datPenjualan = $this->Amod->getData_Penjualan_byCORP_bySALES_byPELANGGAN_byPERIODE_status0($dat, $keydat, $key['IDSHEET'], $awal, $akhir);
|
|
|
|
foreach ($datPenjualan as $det) {
|
|
$subPen[$noPen++] = $det;
|
|
}
|
|
}
|
|
}
|
|
$hasil[$noAkhir++] += ['ISI' => $subPen];
|
|
}
|
|
}
|
|
}
|
|
} else if ($jenis==3) { // Dipisah Kop
|
|
if ($id_corp=="") {
|
|
$salKop = $this->Amod->getData_Corp_bySTATUS(1);
|
|
foreach ($salKop as $key) {
|
|
$kop = $this->Amod->generate_inisialCorp($key['ID_CORP']);
|
|
$hasil[$noAwal++] = [
|
|
'IDSHEET' => $key['ID_CORP'],
|
|
'FASHEET' => $kop,
|
|
'NASHEET' => $kop
|
|
];
|
|
}
|
|
} else {
|
|
$salKop = explode(",", $id_corp);
|
|
foreach ($salKop as $key) {
|
|
$kop = $this->Amod->generate_inisialCorp($key);
|
|
$hasil[$noAwal++] = [
|
|
'IDSHEET' => $key,
|
|
'FASHEET' => $kop,
|
|
'NASHEET' => $kop
|
|
];
|
|
}
|
|
}
|
|
|
|
if ($id_pelanggan=="") {
|
|
if ($id_sales=="") {
|
|
foreach ($hasil as $key) {
|
|
$datPenjualan = $this->Amod->getData_Penjualan_byCORP_bySALES_byPELANGGAN_byPERIODE_status0($key['IDSHEET'], NULL, NULL, $awal, $akhir);
|
|
|
|
$hasil[$noAkhir++] += ['ISI' => $datPenjualan];
|
|
}
|
|
} else {
|
|
foreach ($hasil as $key) {
|
|
$salSales = explode(",", $id_sales);
|
|
$subPen = [];
|
|
$noPen = 0;
|
|
foreach ($salSales as $keydat) {
|
|
$datPenjualan = $this->Amod->getData_Penjualan_byCORP_bySALES_byPELANGGAN_byPERIODE_status0($key['IDSHEET'], $keydat, NULL, $awal, $akhir);
|
|
|
|
foreach ($datPenjualan as $det) {
|
|
$subPen[$noPen++] = $det;
|
|
}
|
|
}
|
|
$hasil[$noAkhir++] += ['ISI' => $subPen];
|
|
}
|
|
}
|
|
} else {
|
|
$listPelanggan = explode(",", $id_pelanggan);
|
|
if ($id_sales=="") {
|
|
foreach ($hasil as $key) {
|
|
$subPen = [];
|
|
$noPen = 0;
|
|
foreach ($listPelanggan as $dat) {
|
|
$datPenjualan = $this->Amod->getData_Penjualan_byCORP_bySALES_byPELANGGAN_byPERIODE_status0($key['IDSHEET'], NULL, $dat, $awal, $akhir);
|
|
|
|
foreach ($datPenjualan as $det) {
|
|
$subPen[$noPen++] = $det;
|
|
}
|
|
}
|
|
$hasil[$noAkhir++] += ['ISI' => $subPen];
|
|
}
|
|
} else {
|
|
$listSales = explode(",", $id_sales);
|
|
foreach ($hasil as $key) {
|
|
$subPen = [];
|
|
$noPen = 0;
|
|
foreach ($listSales as $keydat) {
|
|
foreach ($listPelanggan as $dat) {
|
|
$datPenjualan = $this->Amod->getData_Penjualan_byCORP_bySALES_byPELANGGAN_byPERIODE_status0($key['IDSHEET'], $keydat, $dat, $awal, $akhir);
|
|
|
|
foreach ($datPenjualan as $det) {
|
|
$subPen[$noPen++] = $det;
|
|
}
|
|
}
|
|
}
|
|
$hasil[$noAkhir++] += ['ISI' => $subPen];
|
|
}
|
|
}
|
|
}
|
|
} else if ($jenis==4) { // Dipisah Sales
|
|
if ($id_sales=="") {
|
|
$salSales = $this->Amod->getData_Karyawan_allSales();
|
|
foreach ($salSales as $key) {
|
|
$hasil[$noAwal++] = [
|
|
'IDSHEET' => $key['ID_KARYAWAN'],
|
|
'FASHEET' => $key['NAMA_PANGGILAN_KARYAWAN'],
|
|
'NASHEET' => $key['NAMA_PANGGILAN_KARYAWAN']
|
|
];
|
|
}
|
|
} else {
|
|
$salSales = explode(",", $id_sales);
|
|
foreach ($salSales as $key) {
|
|
$datKaryawan = $this->Amod->getData_Karyawan_byID($key);
|
|
$hasil[$noAwal++] = [
|
|
'IDSHEET' => $key,
|
|
'FASHEET' => $datKaryawan[0]['NAMA_PANGGILAN_KARYAWAN'],
|
|
'NASHEET' => $datKaryawan[0]['NAMA_PANGGILAN_KARYAWAN']
|
|
];
|
|
}
|
|
}
|
|
|
|
if ($id_corp=="") {
|
|
if ($id_pelanggan=="") {
|
|
foreach ($hasil as $key) {
|
|
$datPenjualan = $this->Amod->getData_Penjualan_byCORP_bySALES_byPELANGGAN_byPERIODE_status0(NULL, $key['IDSHEET'], NULL, $awal, $akhir);
|
|
|
|
$hasil[$noAkhir++] += ['ISI' => $datPenjualan];
|
|
}
|
|
} else {
|
|
foreach ($hasil as $key) {
|
|
$salPel = explode(",", $id_pelanggan);
|
|
$subPen = [];
|
|
$noPen = 0;
|
|
foreach ($salPel as $keydat) {
|
|
$datPenjualan = $this->Amod->getData_Penjualan_byCORP_bySALES_byPELANGGAN_byPERIODE_status0(NULL, $key['IDSHEET'], $keydat, $awal, $akhir);
|
|
|
|
foreach ($datPenjualan as $det) {
|
|
$subPen[$noPen++] = $det;
|
|
}
|
|
}
|
|
$hasil[$noAkhir++] += ['ISI' => $subPen];
|
|
}
|
|
}
|
|
} else {
|
|
$listKop = explode(",", $id_corp);
|
|
if ($id_pelanggan=="") {
|
|
foreach ($hasil as $key) {
|
|
$subPen = [];
|
|
$noPen = 0;
|
|
foreach ($listKop as $dat) {
|
|
$datPenjualan = $this->Amod->getData_Penjualan_byCORP_bySALES_byPELANGGAN_byPERIODE_status0($dat, $key['IDSHEET'], NULL, $awal, $akhir);
|
|
|
|
foreach ($datPenjualan as $det) {
|
|
$subPen[$noPen++] = $det;
|
|
}
|
|
}
|
|
$hasil[$noAkhir++] += ['ISI' => $subPen];
|
|
}
|
|
} else {
|
|
$listPelanggan = explode(",", $id_pelanggan);
|
|
foreach ($hasil as $key) {
|
|
$subPen = [];
|
|
$noPen = 0;
|
|
foreach ($listPelanggan as $keydat) {
|
|
foreach ($listKop as $dat) {
|
|
$datPenjualan = $this->Amod->getData_Penjualan_byCORP_bySALES_byPELANGGAN_byPERIODE_status0($dat, $key['IDSHEET'], $keydat, $awal, $akhir);
|
|
|
|
foreach ($datPenjualan as $det) {
|
|
$subPen[$noPen++] = $det;
|
|
}
|
|
}
|
|
}
|
|
$hasil[$noAkhir++] += ['ISI' => $subPen];
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
$pilih_tabel = array('No', 'Tanggal Batal', 'Kop', 'Pelanggan', 'Sales', 'Tanggal Nota', 'Nomor Nota', 'Nomor SO', 'Nilai Nota', 'Keterangan');
|
|
|
|
$data = [
|
|
'awal_nota' => date_format(date_create($awal), "d/m/Y"),
|
|
'akhir_nota' => date_format(date_create($akhir), "d/m/Y"),
|
|
'jumlah_kolom' => count($pilih_tabel),
|
|
'nama_tabel' => $pilih_tabel,
|
|
'jenis' => $jenis,
|
|
'hasil' => $hasil,
|
|
'ts' => $timestamp,
|
|
];
|
|
$this->load->view('cetak/PJ_Excel_Sub2_DataPembukuanBatal', $data);
|
|
}
|
|
|
|
public function PJ_Excel_Sub2_DataAnalisaBarangSupplier() {
|
|
$awal = $this->input->post('tgl_awalfill');
|
|
$akhir = $this->input->post('tgl_akhirfill');
|
|
$id_supplier = $this->input->post('id_supplierfill');
|
|
$id_corp = $this->input->post('id_corpfill');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
if ($id_corp=="") {
|
|
$id_corp = NULL;
|
|
}
|
|
|
|
$datPenjualan = $this->Amod->getData_Penjualan_byCORP_byPERIODE_status1($id_corp, $awal, $akhir, NULL);
|
|
$no = 0;
|
|
$data = [];
|
|
foreach ($datPenjualan as $key) {
|
|
$list = "";
|
|
$sn = "";
|
|
$show = 0;
|
|
$datDo = $this->Amod->getData_DaftarOrder_bySO_jenis1($key['SO_ID']);
|
|
foreach ($datDo as $dat) {
|
|
$qty = 0;
|
|
$datSnj = $this->Amod->getData_SnJual_byDO($dat['ID_DO']);
|
|
foreach ($datSnj as $luca) {
|
|
$datSnb = $this->Amod->getData_SnBeli_byNAMA($luca['NAMA_SNJ']);
|
|
if ($datSnb==TRUE AND $datSnb[0]['SUPPLIER_ID']==$id_supplier) {
|
|
$qty++;
|
|
$show++;
|
|
$nama_snj = $luca['NAMA_SNJ'];
|
|
$sn .= "$nama_snj, ";
|
|
}
|
|
}
|
|
|
|
if ($qty>0) {
|
|
$kode = $dat['KODE_BARANG'];
|
|
if ($list=="") {
|
|
$list .= "[$qty EA] $kode\n$sn";
|
|
} else {
|
|
$list .= "\n[$qty EA] $kode\n$sn";
|
|
}
|
|
}
|
|
}
|
|
|
|
if ($show>0) {
|
|
$kop = $this->Amod->generate_inisialCorp($key['KOP_ID']);
|
|
$data[$no++] = [
|
|
'LIST' => $list,
|
|
'KODE' => $key['KODE_PENJUALAN'],
|
|
'TGL' => $key['TANGGAL'],
|
|
'CORP' => $kop,
|
|
'SJ' => $key['SJ_PENJUALAN'],
|
|
'INV' => $key['INV_PENJUALAN'],
|
|
];
|
|
}
|
|
}
|
|
|
|
$datSupplier = $this->Amod->getData_Supplier_byID($id_supplier);
|
|
|
|
$pilih_tabel = array('No', 'Kop', 'Kode', 'Tanggal', 'Nomor SJ', 'Nomor Nota', 'List Barang');
|
|
|
|
$data = [
|
|
'awal_nota' => date_format(date_create($awal), "d/m/Y"),
|
|
'akhir_nota' => date_format(date_create($akhir), "d/m/Y"),
|
|
'jumlah_kolom' => count($pilih_tabel),
|
|
'nama_tabel' => $pilih_tabel,
|
|
'nama_supplier' => $datSupplier[0]['NAMA_SUPPLIER'],
|
|
'hasil' => $data,
|
|
'ts' => $timestamp,
|
|
];
|
|
$this->load->view('cetak/PJ_Excel_Sub2_DataAnalisaBarangSupplier', $data);
|
|
}
|
|
|
|
public function PJ_Excel_Sub2_DataAnalisaKomisiGp() {
|
|
$id_rp = $this->input->post('id_rpfill');
|
|
$id_rgp = $this->input->post('id_rgpfill');
|
|
$awal = $this->input->post('tgl_awalfill');
|
|
$akhir = $this->input->post('tgl_akhirfill');
|
|
$transaksi = $this->input->post('transaksifill');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$datRp = $this->Amod->getData_RekapProyek_byID_bySTATUS($id_rp, 2);
|
|
$datRgp = $this->Amod->getData_RumusGp_byID($id_rgp);
|
|
|
|
$nama_jenis = $datRp[0]['NAMA_JPP'];
|
|
$nama_periode = $datRp[0]['NAMA_PP'];
|
|
$jenis_periode = $datRp[0]['JENIS_PP'];
|
|
$judul = "PERIODE $nama_jenis | $nama_periode";
|
|
|
|
$datDrgp = $this->Amod->getData_DaftarRumusGp_byRGP_byGP($id_rgp, $datRp[0]['GP_RP']);
|
|
if ($datDrgp==FALSE) {
|
|
$rateKomisi = 0;
|
|
} else {
|
|
$rateKomisi = $datDrgp[0]['RATE'];
|
|
}
|
|
|
|
$laporan = $this->Amod->getData_SoProyek_byRP($id_rp);
|
|
$no = 0;
|
|
$totDpp = 0;
|
|
$totFee = 0;
|
|
$totBiaya = 0;
|
|
$totGp = 0;
|
|
$totKomisiFix = 0;
|
|
$totKomisiAwal = 0;
|
|
$totKomisiAkhir = 0;
|
|
$id_proyek = NULL;
|
|
foreach ($laporan as $key) {
|
|
if ($jenis_periode==1) {
|
|
$status = "";
|
|
$show = 1;
|
|
} else if ($jenis_periode==2) {
|
|
if ($key['STATUS_HHPDA']==0) {
|
|
$status = "BELUM LUNAS";
|
|
if ($transaksi==1 OR $transaksi==3) {
|
|
$show = 1;
|
|
} else if ($transaksi==2) {
|
|
$show = 0;
|
|
}
|
|
} else {
|
|
if (strtotime($key['TGLLOCK_HHPDA'])>=strtotime($awal) AND strtotime($key['TGLLOCK_HHPDA'])<=strtotime($akhir)) {
|
|
$status = "SUDAH LUNAS";
|
|
if ($transaksi==1 OR $transaksi==2) {
|
|
$show = 1;
|
|
} else if ($transaksi==3) {
|
|
$show = 0;
|
|
}
|
|
} else {
|
|
$status = "BELUM LUNAS";
|
|
if ($transaksi==1 OR $transaksi==3) {
|
|
$show = 1;
|
|
} else if ($transaksi==2) {
|
|
$show = 0;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
if ($show==1) {
|
|
$sumDo = $this->Amod->getSum_DaftarOrder_byPENJUALAN($key['ID_PENJUALAN']);
|
|
$dpp = $sumDo[0]['TOTAL'];
|
|
$fee = $key['FEE_SO'];
|
|
|
|
if ($key['STATUS_HHPDA']==0) {
|
|
$jarak = "";
|
|
} else {
|
|
if (strtotime($key['TGLLOCK_HHPDA'])>=strtotime($awal) AND strtotime($key['TGLLOCK_HHPDA'])<=strtotime($akhir)) {
|
|
$diffawal = new DateTime($key['TGL_PENJUALAN']);
|
|
$diffakhir = new DateTime($key['TGLLOCK_HHPDA']);
|
|
$diff = date_diff($diffawal, $diffakhir);
|
|
$diff = $diff->format("%a");
|
|
$jarak = "$diff Hari";
|
|
} else {
|
|
$jarak = "";
|
|
}
|
|
}
|
|
|
|
if ($id_proyek!=$key['PROYEK_ID']) {
|
|
$id_proyek = $key['PROYEK_ID'];
|
|
$biaya = $key['BIAYA_PROYEK'];
|
|
$gp = $key['GP_PROYEK'];
|
|
$totBiaya = $totBiaya+$biaya;
|
|
$totGp = $totGp+$gp;
|
|
if ($jenis_periode==1) {
|
|
$komisiFix = $gp*($rateKomisi/100);
|
|
$totKomisiFix = $totKomisiFix+$komisiFix;
|
|
} else if ($jenis_periode==2) {
|
|
$komisiAwal = $gp*($rateKomisi/100);
|
|
if ($jarak=="" OR $diff>$key['JANGKA_PELANGGAN']) {
|
|
$komisiAkhir = 0;
|
|
} else {
|
|
$komisiAkhir = $komisiAwal;
|
|
}
|
|
$totKomisiAwal = $totKomisiAwal+$komisiAwal;
|
|
$totKomisiAkhir = $totKomisiAkhir+$komisiAkhir;
|
|
}
|
|
}
|
|
|
|
$laporan[$no] += ['SHOW' => $show];
|
|
$laporan[$no] += ['STATUS' => $status];
|
|
$laporan[$no] += ['JARAK' => $jarak];
|
|
$laporan[$no] += ['SUBDPP' => number_format($dpp,2)];
|
|
$laporan[$no] += ['SUBFEE' => number_format($fee,2)];
|
|
if ($jenis_periode==1) {
|
|
$laporan[$no] += ['SUBBIAYA' => number_format($biaya,2)];
|
|
$laporan[$no] += ['SUBKOMISIFIX' => number_format($komisiFix,2)];
|
|
} else if ($jenis_periode==2) {
|
|
$laporan[$no] += ['SUBKOMISIAWAL' => number_format($komisiAwal,2)];
|
|
$laporan[$no] += ['SUBKOMISIAKHIR' => number_format($komisiAkhir,2)];
|
|
}
|
|
$laporan[$no++] += ['SUBGP' => number_format($gp,2)];
|
|
|
|
$totDpp = $totDpp+$dpp;
|
|
$totFee = $totFee+$fee;
|
|
} else {
|
|
$laporan[$no++] += ['SHOW' => $show];
|
|
}
|
|
}
|
|
|
|
if ($jenis_periode==1) {
|
|
$pilih_tabel = array('No', 'Nomor PO', 'Nomor SO', 'Pelanggan', 'Nama Proyek', 'Nilai DPP', 'Nilai FEE', 'Nilai BIAYA', 'Nilai GP', 'Nilai KOMISI');
|
|
} else if ($jenis_periode==2) {
|
|
$pilih_tabel = array('No', 'Nomor PO', 'Nomor SO', 'Tanggal Nota', 'Pelanggan', 'Nama Proyek', 'Nilai DPP', 'Nilai FEE', 'Nilai GP', 'Komisi Awal', 'Komisi Akhir', 'Status', 'Tanggal Lunas', 'Jarak');
|
|
}
|
|
|
|
$data = [
|
|
'awal' => date_format(date_create($awal), "d/m/Y"),
|
|
'akhir' => date_format(date_create($akhir), "d/m/Y"),
|
|
'jumlah_kolom' => count($pilih_tabel),
|
|
'nama_tabel' => $pilih_tabel,
|
|
'laporan' => $laporan,
|
|
'ts' => $timestamp,
|
|
'judul' => $judul,
|
|
'jenis_periode' => $jenis_periode,
|
|
'rumus' => $datRgp[0]['NAMA_RGP'],
|
|
'nama_sales' => $datRp[0]['NAMA_PANGGILAN_KARYAWAN'],
|
|
'rateKomisi' => $rateKomisi,
|
|
'totGpAll' => number_format($datRp[0]['GP_RP'],2),
|
|
'totDpp' => number_format($totDpp,2),
|
|
'totFee' => number_format($totFee,2),
|
|
'totBiaya' => number_format($totBiaya,2),
|
|
'totGp' => number_format($totGp,2),
|
|
'totKomisiFix' => number_format($totKomisiFix,2),
|
|
'totKomisiAwal' => number_format($totKomisiAwal,2),
|
|
'totKomisiAkhir' => number_format($totKomisiAkhir,2),
|
|
];
|
|
$this->load->view('cetak/PJ_Excel_Sub2_DataAnalisaKomisiGp', $data);
|
|
}
|
|
|
|
public function PJ_Excel_Sub2_DataAnalisaKomisiNonGp() {
|
|
$awal_nota = $this->input->post('tgl_awalnotafill');
|
|
$akhir_nota = $this->input->post('tgl_akhirnotafill');
|
|
$awal_lunas = $this->input->post('tgl_awallunasfill');
|
|
$akhir_lunas = $this->input->post('tgl_akhirlunasfill');
|
|
$id_sales = $this->input->post('id_salesfill');
|
|
$jenis_analisa = $this->input->post('jenis_analisafill');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$datSales = $this->Amod->getData_Karyawan_byID($id_sales);
|
|
$nama_sales = $datSales[0]['NAMA_PANGGILAN_KARYAWAN'];
|
|
|
|
if ($jenis_analisa==1 OR $jenis_analisa==3) {
|
|
$laporan = $this->Amod->getData_DaftarOrder_forKomisiNonGp($id_sales, 1, $awal_nota, $akhir_nota, $awal_lunas, $akhir_lunas);
|
|
} else if ($jenis_analisa==2) {
|
|
$laporan = $this->Amod->getData_DaftarOrder_forKomisiNonGp($id_sales, $jenis_analisa, $awal_nota, $akhir_nota, $awal_lunas, $akhir_lunas);
|
|
}
|
|
|
|
$no = 0;
|
|
$totDpp = 0;
|
|
$totFee = 0;
|
|
$totKomisiAwal = 0;
|
|
$totKomisiAkhir = 0;
|
|
$subDpp = 0;
|
|
$subFee = 0;
|
|
$subKomisiAwal = 0;
|
|
$subKomisiAkhir = 0;
|
|
$fee = 0;
|
|
$id_so = NULL;
|
|
foreach ($laporan as $key) {
|
|
if ($id_so!=$key['ID_SO']) {
|
|
$fee = $key['FEE_SO'];
|
|
$id_so = $key['ID_SO'];
|
|
}
|
|
|
|
$qty_do = $key['QTY_DO'];
|
|
$kode_barang = $key['KODE_BARANG'];
|
|
$nama_jenis = $key['NAMA_JENIS'];
|
|
$keterangan = "$qty_do EA $kode_barang";
|
|
|
|
$rate_komisi = $key['KOMISI_DO'];
|
|
if ($key['TYPE_PELANGGAN']==1) {
|
|
$jenis = "DEALER : [$rate_komisi %] | $nama_jenis";
|
|
} else {
|
|
$jenis = "USER : [$rate_komisi %] | $nama_jenis";
|
|
}
|
|
|
|
if ($fee>0) {
|
|
if ($jenis_analisa==1 OR $jenis_analisa==3) {
|
|
$totFee = $totFee+$fee;
|
|
} else if ($jenis_analisa==2) {
|
|
$subFee = $subFee+$fee;
|
|
}
|
|
$sisa_dpp = $key['TOTAL']-$fee;
|
|
} else {
|
|
$sisa_dpp = $key['TOTAL'];
|
|
}
|
|
|
|
$diffawal = new DateTime($key['TGL_PENJUALAN']);
|
|
$diffakhir = new DateTime($key['TGLLOCK_HHPDA']);
|
|
$diff = date_diff($diffawal, $diffakhir);
|
|
$diff = $diff->format("%a");
|
|
$jarak = "$diff Hari";
|
|
|
|
if ($jenis_analisa==1 OR $jenis_analisa==3) {
|
|
$komisiAwal = round((($rate_komisi/100)*$sisa_dpp),2);
|
|
if ($diff>$key['JANGKA_PELANGGAN']) {
|
|
$komisiAkhir = 0;
|
|
} else {
|
|
$komisiAkhir = $komisiAwal;
|
|
}
|
|
|
|
$laporan[$no] += ['JARAK' => $jarak];
|
|
$laporan[$no] += ['JENIS' => $jenis];
|
|
$laporan[$no] += ['KETERANGAN' => $keterangan];
|
|
$laporan[$no] += ['BEBAN' => number_format($fee,2)];
|
|
$laporan[$no] += ['KOMISIAWAL' => number_format($komisiAwal,2)];
|
|
$laporan[$no++] += ['KOMISIAKHIR' => number_format($komisiAkhir,2)];
|
|
} else if ($jenis_analisa==2) {
|
|
if ($key['SP_DO']==NULL) {
|
|
$komisiAwal = round((($rate_komisi/100)*$sisa_dpp),2);
|
|
} else {
|
|
if (strtotime($key['TGL_PENJUALAN'])>=strtotime('2026-01-01')) {
|
|
$komisiAwal = round(((($rate_komisi/100)*$sisa_dpp)*0.5),2);
|
|
} else {
|
|
$komisiAwal = round(((($rate_komisi/100)*$sisa_dpp)*0.1),2);
|
|
}
|
|
}
|
|
if ($diff>$key['JANGKA_PELANGGAN']) {
|
|
$komisiAkhir = 0;
|
|
} else {
|
|
$komisiAkhir = $komisiAwal;
|
|
}
|
|
|
|
$laporan[$no] += ['JARAK' => $jarak];
|
|
$laporan[$no] += ['JENIS' => $jenis];
|
|
$laporan[$no] += ['KETERANGAN' => $keterangan];
|
|
$laporan[$no] += ['BEBAN' => number_format($fee,2)];
|
|
$laporan[$no] += ['KOMISIAWAL' => number_format($komisiAwal,2)];
|
|
$laporan[$no++] += ['KOMISIAKHIR' => number_format($komisiAkhir,2)];
|
|
}
|
|
|
|
if ($sisa_dpp>=0) {
|
|
$fee = 0;
|
|
} else {
|
|
$fee = $fee-$sisa_dpp;
|
|
}
|
|
|
|
$totKomisiAwal = $totKomisiAwal+$komisiAwal;
|
|
$totKomisiAkhir = $totKomisiAkhir+$komisiAkhir;
|
|
$totDpp = $totDpp+$key['TOTAL'];
|
|
}
|
|
|
|
if ($jenis_analisa==1) {
|
|
$pilih_tabel = array('No', 'Tanggal', 'Nota', 'Pelanggan', 'Jenis', 'Keterangan', 'Total DPP', 'Beban Fee', 'Komisi Awal', 'Komisi Akhir', 'Tanggal Lunas', 'Kode Bukti', 'Jarak');
|
|
$pilih_sub = "";
|
|
$subtema = "";
|
|
$sublaporan = "";
|
|
} else if ($jenis_analisa==2) {
|
|
$pilih_tabel = array('No', 'Tanggal', 'Nota', 'Pelanggan', 'Jenis', 'Keterangan', 'Produk', 'Total DPP', 'Beban Fee', 'Komisi Awal', 'Komisi Akhir', 'Tanggal Lunas', 'Kode Bukti', 'Jarak');
|
|
$pilih_sub = "";
|
|
$sublaporan = "";
|
|
$subtema = "Relasi Channel - Sales Produk";
|
|
} else if ($jenis_analisa==3) {
|
|
$pilih_tabel = array('No', 'Tanggal', 'Nota', 'Pelanggan', 'Jenis', 'Keterangan', 'Total DPP', 'Beban Fee', 'Komisi Awal', 'Komisi Akhir', 'Tanggal Lunas', 'Kode Bukti', 'Jarak');
|
|
$pilih_sub = array('No', 'Tanggal', 'Nota', 'Pelanggan', 'Jenis', 'Keterangan', 'Channel', 'Total DPP', 'Beban Fee', 'Komisi Awal', 'Komisi Akhir', 'Tanggal Lunas', 'Kode Bukti', 'Jarak');
|
|
$subtema = "Relasi Sales Produk - Channel";
|
|
$sublaporan = $this->Amod->getData_DaftarOrder_forKomisiNonGp($id_sales, $jenis_analisa, $awal_nota, $akhir_nota, $awal_lunas, $akhir_lunas, $nama_sales);
|
|
$no = 0;
|
|
$fee = 0;
|
|
$id_so = NULL;
|
|
foreach ($sublaporan as $key) {
|
|
if ($id_so!=$key['ID_SO']) {
|
|
$fee = $key['FEE_SO'];
|
|
$id_so = $key['ID_SO'];
|
|
}
|
|
|
|
$qty_do = $key['QTY_DO'];
|
|
$kode_barang = $key['KODE_BARANG'];
|
|
$nama_jenis = $key['NAMA_JENIS'];
|
|
$keterangan = "$qty_do EA $kode_barang";
|
|
$rate_komisi = $key['KOMISI_DO'];
|
|
|
|
if ($key['TYPE_PELANGGAN']==1) {
|
|
$jenis = "DEALER : [$rate_komisi %] | $nama_jenis";
|
|
} else {
|
|
$jenis = "USER : [$rate_komisi %] | $nama_jenis";
|
|
}
|
|
|
|
if ($fee>0) {
|
|
$subFee = $subFee+$fee;
|
|
$sisa_dpp = $key['TOTAL']-$fee;
|
|
} else {
|
|
$sisa_dpp = $key['TOTAL'];
|
|
}
|
|
|
|
$diffawal = new DateTime($key['TGL_PENJUALAN']);
|
|
$diffakhir = new DateTime($key['TGLLOCK_HHPDA']);
|
|
$diff = date_diff($diffawal, $diffakhir);
|
|
$diff = $diff->format("%a");
|
|
$jarak = "$diff Hari";
|
|
|
|
if (strtotime($key['TGL_PENJUALAN'])>=strtotime('2026-01-01')) {
|
|
$komisiAwal = round(((($rate_komisi/100)*$sisa_dpp)*0.5),2);
|
|
} else {
|
|
$komisiAwal = round(((($rate_komisi/100)*$sisa_dpp)*0.9),2);
|
|
}
|
|
|
|
if ($diff>$key['JANGKA_PELANGGAN']) {
|
|
$komisiAkhir = 0;
|
|
} else {
|
|
$komisiAkhir = $komisiAwal;
|
|
}
|
|
|
|
$sublaporan[$no] += ['JARAK' => $jarak];
|
|
$sublaporan[$no] += ['JENIS' => $jenis];
|
|
$sublaporan[$no] += ['KETERANGAN' => $keterangan];
|
|
$sublaporan[$no] += ['BEBAN' => number_format($fee,2)];
|
|
$sublaporan[$no] += ['KOMISIAWAL' => number_format($komisiAwal,2)];
|
|
$sublaporan[$no++] += ['KOMISIAKHIR' => number_format($komisiAkhir,2)];
|
|
|
|
if ($sisa_dpp>=0) {
|
|
$fee = 0;
|
|
} else {
|
|
$fee = $fee-$sisa_dpp;
|
|
}
|
|
|
|
$subKomisiAwal = $subKomisiAwal+$komisiAwal;
|
|
$subKomisiAkhir = $subKomisiAkhir+$komisiAkhir;
|
|
$subDpp = $subDpp+$key['TOTAL'];
|
|
}
|
|
}
|
|
|
|
$data = [
|
|
'awal_nota' => date_format(date_create($awal_nota), "d/m/Y"),
|
|
'akhir_nota' => date_format(date_create($akhir_nota), "d/m/Y"),
|
|
'awal_lunas' => date_format(date_create($awal_lunas), "d/m/Y"),
|
|
'akhir_lunas' => date_format(date_create($akhir_lunas), "d/m/Y"),
|
|
'jumlah_kolom' => count($pilih_tabel),
|
|
'nama_tabel' => $pilih_tabel,
|
|
'pilih_sub' => $pilih_sub,
|
|
'laporan' => $laporan,
|
|
'sublaporan' => $sublaporan,
|
|
'ts' => $timestamp,
|
|
'jenis_analisa' => $jenis_analisa,
|
|
'subtema' => $subtema,
|
|
'nama_sales' => $nama_sales,
|
|
'totDpp' => number_format($totDpp,2),
|
|
'totFee' => number_format($totFee,2),
|
|
'totKomisiAwal' => number_format($totKomisiAwal,2),
|
|
'totKomisiAkhir' => number_format($totKomisiAkhir,2),
|
|
'subDpp' => number_format($subDpp,2),
|
|
'subFee' => number_format($subFee,2),
|
|
'subKomisiAwal' => number_format($subKomisiAwal,2),
|
|
'subKomisiAkhir' => number_format($subKomisiAkhir,2),
|
|
];
|
|
$this->load->view('cetak/PJ_Excel_Sub2_DataAnalisaKomisiNonGp', $data);
|
|
}
|
|
|
|
public function PJ_Excel_Sub2_DataAnalisaMarginPenjualan() {
|
|
$awal = $this->input->post('tgl_awalfill');
|
|
$akhir = $this->input->post('tgl_akhirfill');
|
|
$id_pelanggan = $this->input->post('id_pelangganfill');
|
|
$id_corp = $this->input->post('id_corpfill');
|
|
$id_sales = $this->input->post('id_salesfill');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
if ($id_pelanggan=="") {
|
|
$id_pelanggan = NULL;
|
|
}
|
|
|
|
if ($id_corp=="") {
|
|
$id_corp = NULL;
|
|
}
|
|
|
|
if ($id_sales=="") {
|
|
$id_sales = NULL;
|
|
}
|
|
|
|
$datPenjualan = $this->Amod->getData_Penjualan_byCORP_bySALES_byPELANGGAN_byPERIODE_status1($id_corp, $id_sales, $id_pelanggan, $awal, $akhir);
|
|
$datRj = $this->Amod->getData_ReturPenjualan_byCORP_bySALES_byPELANGGAN_byPERIODE_status1($id_corp, $id_sales, $id_pelanggan, $awal, $akhir);
|
|
|
|
$hasil = [];
|
|
$no = 0;
|
|
$totDpp = 0;
|
|
$totHpp = 0;
|
|
$totMargin = 0;
|
|
foreach ($datPenjualan as $key) {
|
|
$sumDo = $this->Amod->getSum_DaftarOrder_byPENJUALAN($key['ID_PENJUALAN']);
|
|
if ($sumDo[0]['TOTAL']==NULL) {
|
|
$dpp = 0;
|
|
} else {
|
|
$dpp = $sumDo[0]['TOTAL'];
|
|
}
|
|
$totDpp = $totDpp+$dpp;
|
|
|
|
$datHq1 = $this->Amod->getData_HistoriKuantiti_byKODE($key['KODE_PENJUALAN']);
|
|
$datHq2 = $this->Amod->getData_HistoriKuantiti_byKODE($key['KODE_SO']);
|
|
$hpp = 0;
|
|
foreach ($datHq1 as $dat) {
|
|
if ($dat['MASUK_HQ']>0) {
|
|
$sub = $dat['MASUK_HQ']*$dat['AVG_HQ'];
|
|
$add = 0;
|
|
} else if ($dat['KELUAR_HQ']>0) {
|
|
$add = $dat['KELUAR_HQ']*$dat['AVG_HQ'];
|
|
$sub = 0;
|
|
}
|
|
$hpp = $hpp+$add-$sub;
|
|
}
|
|
|
|
foreach ($datHq2 as $det) {
|
|
if ($det['MASUK_HQ']>0) {
|
|
$sub = $det['MASUK_HQ']*$det['AVG_HQ'];
|
|
$add = 0;
|
|
} else if ($det['KELUAR_HQ']>0) {
|
|
$add = $det['KELUAR_HQ']*$det['AVG_HQ'];
|
|
$sub = 0;
|
|
}
|
|
$hpp = $hpp+$add-$sub;
|
|
}
|
|
$totHpp = $totHpp+$hpp;
|
|
|
|
$margin = $dpp-$hpp;
|
|
$totMargin = $totMargin+$margin;
|
|
|
|
$naco = $this->Amod->generate_inisialCorp($key['CORP_ID']);
|
|
|
|
$hasil[$no++] = [
|
|
'KODE' => $key['KODE_PENJUALAN'],
|
|
'TANGGAL' => $key['TANGGAL'],
|
|
'NOTA' => $key['INV_PENJUALAN'],
|
|
'CORP' => $naco,
|
|
'SALES' => $key['NAMA_PANGGILAN_KARYAWAN'],
|
|
'NAPEL' => $key['NAMA_PELANGGAN'],
|
|
'NAKO' => $key['NAMA_KOTA'],
|
|
'DPP' => number_format($dpp, 2),
|
|
'HPP' => number_format($hpp, 2),
|
|
'MARGIN' => number_format($margin, 2),
|
|
];
|
|
}
|
|
|
|
foreach ($datRj as $key) {
|
|
$sumDrj = $this->Amod->getSum_DaftarReturJual_byRJ($key['ID_RJ']);
|
|
if ($sumDrj[0]['TOTAL']==NULL) {
|
|
$dpp = 0;
|
|
} else {
|
|
$dpp = $sumDrj[0]['TOTAL'];
|
|
}
|
|
$dpp = $dpp * -1;
|
|
$totDpp = $totDpp+$dpp;
|
|
|
|
$datHq3 = $this->Amod->getData_HistoriKuantiti_byKODE($key['KODE_RJ']);
|
|
$hpp = 0;
|
|
foreach ($datHq3 as $dat) {
|
|
$sub = $dat['MASUK_HQ']*$dat['AVG_HQ'];
|
|
$hpp = $hpp-$sub;
|
|
}
|
|
$totHpp = $totHpp+$hpp;
|
|
|
|
$margin = $dpp-$hpp;
|
|
$totMargin = $totMargin+$margin;
|
|
|
|
$naco = $this->Amod->generate_inisialCorp($key['CORP_ID']);
|
|
|
|
$hasil[$no++] = [
|
|
'KODE' => $key['KODE_RJ'],
|
|
'TANGGAL' => $key['TANGGAL'],
|
|
'NOTA' => $key['INV_RJ'],
|
|
'CORP' => $naco,
|
|
'SALES' => $key['NAMA_PANGGILAN_KARYAWAN'],
|
|
'NAPEL' => $key['NAMA_PELANGGAN'],
|
|
'NAKO' => $key['NAMA_KOTA'],
|
|
'DPP' => number_format($dpp, 2),
|
|
'HPP' => number_format($hpp, 2),
|
|
'MARGIN' => number_format($margin, 2),
|
|
];
|
|
}
|
|
|
|
$pilih_tabel = array('No', 'Kode', 'Tanggal', 'Kop', 'Sales', 'Pelanggan', 'Nota', 'Nilai DPP', 'Nilai HPP', 'Nilai MARGIN');
|
|
|
|
$data = [
|
|
'awal_nota' => date_format(date_create($awal), "d/m/Y"),
|
|
'akhir_nota' => date_format(date_create($akhir), "d/m/Y"),
|
|
'jumlah_kolom' => count($pilih_tabel),
|
|
'nama_tabel' => $pilih_tabel,
|
|
'ts' => $timestamp,
|
|
'hasil' => $hasil,
|
|
'totDpp' => number_format($totDpp,2),
|
|
'totHpp' => number_format($totHpp,2),
|
|
'totMargin' => number_format($totMargin,2),
|
|
];
|
|
$this->load->view('cetak/PJ_Excel_Sub2_DataAnalisaMarginPenjualan', $data);
|
|
}
|
|
|
|
public function PJ_Excel_Sub2_DataAnalisaPencapaianSales() {
|
|
$tgl_awal = $this->input->post('tgl_awalfill');
|
|
$tgl_akhir = $this->input->post('tgl_akhirfill');
|
|
$id_sales = $this->input->post('id_salesfill');
|
|
$jenis_analisa = $this->input->post('jenis_analisafill');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
if ($id_sales=="") {
|
|
$datSales = $this->Amod->getData_Karyawan_allSales();
|
|
$no = 0;
|
|
foreach ($datSales as $key) {
|
|
$listSales[$no++] = [
|
|
'IDKAR' => $key['ID_KARYAWAN'],
|
|
'NAKAR' => $key['NAMA_PANGGILAN_KARYAWAN'],
|
|
];
|
|
}
|
|
} else {
|
|
$datSales = $this->Amod->getData_Karyawan_byID($id_sales);
|
|
$listSales[0] = [
|
|
'IDKAR' => $id_sales,
|
|
'NAKAR' => $datSales[0]['NAMA_PANGGILAN_KARYAWAN'],
|
|
];
|
|
}
|
|
|
|
$laporan = [];
|
|
$noarr = 0;
|
|
foreach ($listSales as $key) {
|
|
$hasil = [];
|
|
$totDpp = 0;
|
|
$totPpn = 0;
|
|
$totNota = 0;
|
|
$nocol = 0;
|
|
|
|
$datDo = $this->Amod->getData_DaftarOrder_bySALES_byPERIODE_status1($key['IDKAR'], $tgl_awal, $tgl_akhir);
|
|
$datDrj = $this->Amod->getData_DaftarReturJual_bySALES_byPERIODE_status1($key['IDKAR'], $tgl_awal, $tgl_akhir);
|
|
|
|
foreach ($datDo as $dat) {
|
|
$qty = $dat['QTY_DO'];
|
|
$kode = $dat['KODE_BARANG'];
|
|
$ket = "$qty EA $kode";
|
|
|
|
$dpp = $qty*$dat['HARGA_DO'];
|
|
$ppndo = round($dpp*($dat['PPN_SO']/100),2);
|
|
$nodo = round(($dpp+$ppndo),2);
|
|
|
|
$totDpp = $totDpp+$dpp;
|
|
$totPpn = $totPpn+$ppndo;
|
|
$totNota = $totNota+$nodo;
|
|
|
|
$hasil[$nocol++] = [
|
|
'KODEBUKTI' => $dat['INV_PENJUALAN'],
|
|
'TANGGAL' => $dat['TANGGAL'],
|
|
'KET' => $ket,
|
|
'DPP' => number_format($dpp,2),
|
|
'PPN' => number_format($ppndo,2),
|
|
'NOTA' => number_format($nodo,2),
|
|
];
|
|
}
|
|
|
|
foreach ($datDrj as $det) {
|
|
$qty = $det['QTY_DRJ'];
|
|
$kode = $det['KODE_BARANG'];
|
|
$ket = "$qty EA $kode";
|
|
|
|
$dpp = $qty*$det['HARGA_DRJ'];
|
|
$ppndrj = round($dpp*($det['PPN_SO']/100),2);
|
|
$nodrj = round(($dpp+$ppndrj),2);
|
|
$dpp = $dpp * -1;
|
|
$ppndrj = $ppndrj * -1;
|
|
$nodrj = $nodrj * -1;
|
|
|
|
$totDpp = $totDpp+$dpp;
|
|
$totPpn = $totPpn+$ppndrj;
|
|
$totNota = $totNota+$nodrj;
|
|
|
|
$hasil[$nocol++] = [
|
|
'KODEBUKTI' => $det['INV_RJ'],
|
|
'TANGGAL' => $det['TANGGAL'],
|
|
'KET' => $ket,
|
|
'DPP' => number_format($dpp,2),
|
|
'PPN' => number_format($ppndrj,2),
|
|
'NOTA' => number_format($nodrj,2),
|
|
];
|
|
}
|
|
|
|
$laporan[$noarr++] = [
|
|
'hasil' => $hasil,
|
|
'namaSales' => $key['NAKAR'],
|
|
'totDpp' => number_format($totDpp,2),
|
|
'totPpn' => number_format($totPpn,2),
|
|
'totNota' => number_format($totNota,2),
|
|
];
|
|
}
|
|
|
|
if ($jenis_analisa==1) {
|
|
$pilih_tabel = array('No', 'Kode Bukti', 'Tanggal', 'Keterangan', 'Total DPP');
|
|
} else if ($jenis_analisa==2) {
|
|
$pilih_tabel = array('No', 'Kode Bukti', 'Tanggal', 'Keterangan', 'Total DPP', 'Total PPN', 'Total NOTA');
|
|
}
|
|
|
|
$data = [
|
|
'awal_nota' => date_format(date_create($tgl_awal), "d/m/Y"),
|
|
'akhir_nota' => date_format(date_create($tgl_akhir), "d/m/Y"),
|
|
'jumlah_kolom' => count($pilih_tabel),
|
|
'nama_tabel' => $pilih_tabel,
|
|
'laporan' => $laporan,
|
|
'ts' => $timestamp,
|
|
'jenis_analisa' => $jenis_analisa,
|
|
];
|
|
$this->load->view('cetak/PJ_Excel_Sub2_DataAnalisaPencapaianSales', $data);
|
|
}
|
|
|
|
public function PJ_Excel_Sub2_DataAnalisaPenjualanHarian() {
|
|
$tgl = $this->input->post('tgl_notafill');
|
|
$id_corp = $this->input->post('id_corpfill');
|
|
$id_sales = $this->input->post('id_salesfill');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
if ($id_corp=="") {
|
|
$id_corp = NULL;
|
|
}
|
|
|
|
$hasil = [];
|
|
$noPen = 0;
|
|
$totPen = 0;
|
|
$listSales = explode(",", $id_sales);
|
|
foreach ($listSales as $key) {
|
|
$datDo = $this->Amod->getData_DaftarOrder_byCORP_bySALES_byTGL_status1($id_corp, $key, $tgl);
|
|
foreach ($datDo as $dat) {
|
|
$totPen = $totPen+round(((($dat['PPN_SO']+100)/100)*$dat['NILAI']),2);
|
|
$hasil[$noPen++] = $dat;
|
|
}
|
|
}
|
|
|
|
$pilih_tabel = array('No', 'Nota', 'Tanggal', 'Kop', 'Sales', 'Pelanggan', 'Jenis Harga', 'Barang', 'Kuantiti', 'Nilai SATUAN', 'Nilai SUBTOTAL');
|
|
|
|
$data = [
|
|
'tgl_nota' => date_format(date_create($tgl), "d/m/Y"),
|
|
'jumlah_kolom' => count($pilih_tabel),
|
|
'nama_tabel' => $pilih_tabel,
|
|
'ts' => $timestamp,
|
|
'hasil' => $hasil,
|
|
'total' => number_format($totPen,2),
|
|
];
|
|
$this->load->view('cetak/PJ_Excel_Sub2_DataAnalisaPenjualanHarian', $data);
|
|
}
|
|
|
|
public function PJ_Excel_Sub2_DataAnalisaStokClearance() {
|
|
$awal = $this->input->post('tgl_awalfill');
|
|
$akhir = $this->input->post('tgl_akhirfill');
|
|
$jenis = $this->input->post('jenisfill');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
$batas = $this->Amod->generate_addDay($akhir, 1);
|
|
|
|
$pilih_tabel = array('No', 'Kode Barang', 'Nama Barang', 'Incentive', 'HPP (Include)', 'Kuantiti Awal', 'Persediaan Awal', 'Kuantiti Akhir', 'Persediaan Akhir');
|
|
|
|
if ($jenis==0) {
|
|
$totSheet = 2;
|
|
} else {
|
|
$totSheet = 1;
|
|
}
|
|
|
|
if ($jenis==0 OR $jenis==3) {
|
|
if ($jenis==3) {
|
|
$totQtyAwalNb = 0;
|
|
$totQtyAkhirNb = 0;
|
|
$totPerAwalNb = 0;
|
|
$totPerAkhirNb = 0;
|
|
$dataPcNb = NULL;
|
|
}
|
|
|
|
$dataPcAio = $this->Amod->getData_PromoClearance_byJENIS_bySTATUS(3, 1);
|
|
$no = 0;
|
|
$totQtyAwalAio = 0;
|
|
$totQtyAkhirAio = 0;
|
|
$totPerAwalAio = 0;
|
|
$totPerAkhirAio = 0;
|
|
foreach ($dataPcAio as $key) {
|
|
$datHqAwal = $this->Amod->getData_HistoriKuantiti_byBARANG_beforeTGL_orderDESC_limit1($key['BARANG_ID'], $awal);
|
|
$dpp = round(($datHqAwal[0]['AVG_HQ']*1.11),2);
|
|
$qtyAwal = $datHqAwal[0]['SISA_HQ'];
|
|
$perAwal = $dpp*$qtyAwal;
|
|
|
|
$datHqAkhir = $this->Amod->getData_HistoriKuantiti_byBARANG_beforeTGL_orderDESC_limit1($key['BARANG_ID'], $batas);
|
|
$qtyAkhir = $datHqAkhir[0]['SISA_HQ'];
|
|
$perAkhir = $datHqAkhir[0]['AVG_HQ']*$qtyAkhir;
|
|
|
|
$totQtyAwalAio = $totQtyAwalAio+$qtyAwal;
|
|
$totQtyAkhirAio = $totQtyAkhirAio+$qtyAkhir;
|
|
$totPerAwalAio = $totPerAwalAio+$perAwal;
|
|
$totPerAkhirAio = $totPerAkhirAio+$perAkhir;
|
|
|
|
$dataPcAio[$no] += ['DPP' => number_format($dpp, 2)];
|
|
$dataPcAio[$no] += ['QTYAWAL' => $qtyAwal];
|
|
$dataPcAio[$no] += ['PERAWAL' => number_format($perAwal, 2)];
|
|
$dataPcAio[$no] += ['QTYAKHIR' => $qtyAkhir];
|
|
$dataPcAio[$no++] += ['PERAKHIR' => number_format($perAkhir, 2)];
|
|
}
|
|
}
|
|
|
|
if ($jenis==0 OR $jenis==2) {
|
|
if ($jenis==2) {
|
|
$totQtyAwalAio = 0;
|
|
$totQtyAkhirAio = 0;
|
|
$totPerAwalAio = 0;
|
|
$totPerAkhirAio = 0;
|
|
$dataPcAio = NULL;
|
|
}
|
|
|
|
$dataPcNb = $this->Amod->getData_PromoClearance_byJENIS_bySTATUS(2, 1);
|
|
$no = 0;
|
|
$totQtyAwalNb = 0;
|
|
$totQtyAkhirNb = 0;
|
|
$totPerAwalNb = 0;
|
|
$totPerAkhirNb = 0;
|
|
foreach ($dataPcNb as $key) {
|
|
$datHqAwal = $this->Amod->getData_HistoriKuantiti_byBARANG_beforeTGL_orderDESC_limit1($key['BARANG_ID'], $awal);
|
|
$dpp = round(($datHqAwal[0]['AVG_HQ']*1.11),2);
|
|
$qtyAwal = $datHqAwal[0]['SISA_HQ'];
|
|
$perAwal = $dpp*$qtyAwal;
|
|
|
|
$datHqAkhir = $this->Amod->getData_HistoriKuantiti_byBARANG_beforeTGL_orderDESC_limit1($key['BARANG_ID'], $batas);
|
|
$qtyAkhir = $datHqAkhir[0]['SISA_HQ'];
|
|
$perAkhir = $datHqAkhir[0]['AVG_HQ']*$qtyAkhir;
|
|
|
|
$totQtyAwalNb = $totQtyAwalNb+$qtyAwal;
|
|
$totQtyAkhirNb = $totQtyAkhirNb+$qtyAkhir;
|
|
$totPerAwalNb = $totPerAwalNb+$perAwal;
|
|
$totPerAkhirNb = $totPerAkhirNb+$perAkhir;
|
|
|
|
$dataPcNb[$no] += ['DPP' => number_format($dpp, 2)];
|
|
$dataPcNb[$no] += ['QTYAWAL' => $qtyAwal];
|
|
$dataPcNb[$no] += ['PERAWAL' => number_format($perAwal, 2)];
|
|
$dataPcNb[$no] += ['QTYAKHIR' => $qtyAkhir];
|
|
$dataPcNb[$no++] += ['PERAKHIR' => number_format($perAkhir, 2)];
|
|
}
|
|
}
|
|
|
|
$data = [
|
|
'awal_nota' => date_format(date_create($awal), "d/m/Y"),
|
|
'akhir_nota' => date_format(date_create($akhir), "d/m/Y"),
|
|
'jumlah_kolom' => count($pilih_tabel),
|
|
'nama_tabel' => $pilih_tabel,
|
|
'ts' => $timestamp,
|
|
'jenis' => $jenis,
|
|
'totSheet' => $totSheet,
|
|
'aio' => $dataPcAio,
|
|
'totQtyAwalAio' => $totQtyAwalAio,
|
|
'totQtyAkhirAio' => $totQtyAkhirAio,
|
|
'totPerAwalAio' => number_format($totPerAwalAio,2),
|
|
'totPerAkhirAio' => number_format($totPerAkhirAio,2),
|
|
'nb' => $dataPcNb,
|
|
'totQtyAwalNb' => $totQtyAwalNb,
|
|
'totQtyAkhirNb' => $totQtyAkhirNb,
|
|
'totPerAwalNb' => number_format($totPerAwalNb,2),
|
|
'totPerAkhirNb' => number_format($totPerAkhirNb,2),
|
|
];
|
|
$this->load->view('cetak/PJ_Excel_Sub2_DataAnalisaStokClearance', $data);
|
|
}
|
|
|
|
public function PJ_Excel_Sub2_DataAnalisaStokTerjual() {
|
|
$awal = $this->input->post('tgl_awalfill');
|
|
$akhir = $this->input->post('tgl_akhirfill');
|
|
$kondisi = $this->input->post('kondisifill');
|
|
$id_pelanggan = $this->input->post('id_pelangganfill');
|
|
$id_corp = $this->input->post('id_corpfill');
|
|
$id_sales = $this->input->post('id_salesfill');
|
|
$id_jenis = $this->input->post('id_jenisfill');
|
|
$id_merk = $this->input->post('id_merkfill');
|
|
$id_model = $this->input->post('id_modelfill');
|
|
$id_produk = $this->input->post('id_produkfill');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
if ($id_pelanggan=="") {
|
|
$id_pelanggan = NULL;
|
|
}
|
|
|
|
if ($id_corp=="") {
|
|
$id_corp = NULL;
|
|
}
|
|
|
|
if ($id_sales=="") {
|
|
$id_sales = NULL;
|
|
}
|
|
|
|
if ($id_jenis=="") {
|
|
$id_jenis = NULL;
|
|
}
|
|
|
|
if ($id_merk=="") {
|
|
$id_merk = NULL;
|
|
}
|
|
|
|
if ($id_model=="") {
|
|
$id_model = NULL;
|
|
}
|
|
|
|
if ($id_produk=="") {
|
|
$id_produk = NULL;
|
|
}
|
|
|
|
$data = $this->Amod->getData_DaftarOrder_byCORP_bySALES_byPELANGGAN_byJENIS_byMERK_byMODEL_byPRODUK_byKONDISI_byPERIODE_groupBARANG_status1_forSearch($id_corp, $id_sales, $id_pelanggan, $id_jenis, $id_merk, $id_model, $id_produk, $kondisi, $awal, $akhir, null);
|
|
$total = 0;
|
|
foreach ($data as $key) {
|
|
$total = $total+$key['TOTAL'];
|
|
}
|
|
|
|
$pilih_tabel = array('No', 'Jenis', 'Merk', 'Model', 'Produk', 'Kode', 'Nama', 'Total');
|
|
|
|
$data = [
|
|
'awal_nota' => date_format(date_create($awal), "d/m/Y"),
|
|
'akhir_nota' => date_format(date_create($akhir), "d/m/Y"),
|
|
'jumlah_kolom' => count($pilih_tabel),
|
|
'nama_tabel' => $pilih_tabel,
|
|
'ts' => $timestamp,
|
|
'hasil' => $data,
|
|
'total' => $total,
|
|
];
|
|
$this->load->view('cetak/PJ_Excel_Sub2_DataAnalisaStokTerjual', $data);
|
|
}
|
|
|
|
public function PJ_Excel_Sub2_DataAnalisaTransaksiPelanggan() {
|
|
$awal = $this->input->post('tgl_awalfill');
|
|
$akhir = $this->input->post('tgl_akhirfill');
|
|
$id_pelanggan = $this->input->post('id_pelangganfill');
|
|
$id_corp = $this->input->post('id_corpfill');
|
|
$id_sales = $this->input->post('id_salesfill');
|
|
$mode = $this->input->post('modefill');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
if ($id_pelanggan=="") {
|
|
$id_pelanggan = NULL;
|
|
}
|
|
|
|
if ($id_corp=="") {
|
|
$id_corp = NULL;
|
|
}
|
|
|
|
if ($id_sales=="") {
|
|
$id_sales = NULL;
|
|
}
|
|
|
|
$data = $this->Amod->getSum_Penjualan_byKOP_byPELANGGAN_bySALES_byMODE_byPERIODE_groupKOP_groupPELANGGAN($id_corp, $id_pelanggan, $id_sales, $mode, $awal, $akhir);
|
|
$total = 0;
|
|
$totret = 0;
|
|
$totwal = 0;
|
|
$no = 0;
|
|
foreach ($data as $key) {
|
|
$sumDrj = $this->Amod->getSum_DaftarReturJual_byPELANGGAN_byAWAL_byAKHIR_status1($key['PEL_ID'], $awal, $akhir);
|
|
if ($sumDrj==FALSE OR $sumDrj[0]['TOTAL']==NULL) {
|
|
$retur = 0;
|
|
} else {
|
|
$retur = $sumDrj[0]['TOTAL'];
|
|
}
|
|
$totwal = $totwal+$key['NILAI'];
|
|
$totret = $totret+$retur;
|
|
$total = $total+$key['NILAI']-$retur;
|
|
|
|
$data[$no] += ['SUBTOTAL' => number_format(($key['NILAI']-$retur),2)];
|
|
$data[$no++] += ['RETUR' => number_format($retur,2)];
|
|
}
|
|
|
|
$pilih_tabel = array('No', 'Pelanggan', 'Nilai TRANSAKSI', 'Nilai RETUR', 'Nilai TOTAL');
|
|
|
|
$data = [
|
|
'awal_nota' => date_format(date_create($awal), "d/m/Y"),
|
|
'akhir_nota' => date_format(date_create($akhir), "d/m/Y"),
|
|
'jumlah_kolom' => count($pilih_tabel),
|
|
'nama_tabel' => $pilih_tabel,
|
|
'ts' => $timestamp,
|
|
'hasil' => $data,
|
|
'totwal' => number_format($totwal,2),
|
|
'total' => number_format($total,2),
|
|
'totret' => number_format($totret,2),
|
|
];
|
|
$this->load->view('cetak/PJ_Excel_Sub2_DataAnalisaTransaksiPelanggan', $data);
|
|
}
|
|
|
|
public function PJ_Ambil_Sub2_DataAnalisaTransaksiPelanggan() {
|
|
$awal = $this->input->post('awal');
|
|
$akhir = $this->input->post('akhir');
|
|
$id_pelanggan = $this->input->post('id_pelanggan');
|
|
$id_corp = $this->input->post('id_corp');
|
|
$id_sales = $this->input->post('id_sales');
|
|
$mode = $this->input->post('mode');
|
|
$search = $this->input->post('search');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
if ($id_pelanggan=="") {
|
|
$id_pelanggan = NULL;
|
|
}
|
|
|
|
if ($id_corp=="") {
|
|
$id_corp = NULL;
|
|
}
|
|
|
|
if ($id_sales=="") {
|
|
$id_sales = NULL;
|
|
}
|
|
|
|
$data = $this->Amod->getSum_Penjualan_byKOP_byPELANGGAN_bySALES_byMODE_byPERIODE_groupKOP_groupPELANGGAN($id_corp, $id_pelanggan, $id_sales, $mode, $awal, $akhir, $search);
|
|
$total = 0;
|
|
$no = 0;
|
|
foreach ($data as $key) {
|
|
$sumDrj = $this->Amod->getSum_DaftarReturJual_byPELANGGAN_byAWAL_byAKHIR_status1($key['PEL_ID'], $awal, $akhir);
|
|
if ($sumDrj==FALSE OR $sumDrj[0]['TOTAL']==NULL) {
|
|
$retur = 0;
|
|
} else {
|
|
$retur = $sumDrj[0]['TOTAL'];
|
|
}
|
|
$total = $total+$key['NILAI']-$retur;
|
|
|
|
$data[$no++] += ['RETUR' => number_format($retur,2)];
|
|
}
|
|
|
|
$this->output_json([
|
|
'data' => $data,
|
|
'totDpp' => number_format($total,2),
|
|
]);
|
|
}
|
|
|
|
//SUBMENU ADMINISTRASI - PROFORMA
|
|
public function PJ_Sub3_Proforma_1() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$now = date('Y-m-d');
|
|
$limit = date('Y-m-01');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "PJ", "ADMINISTRASI - Proforma");
|
|
$id_menu = $datShm[0]['MENU_ID'];
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$datPf = $this->Amod->getData_Proforma_byKARYAWAN_bySTATUS($id_karyawan, 0);
|
|
if ($datPf==FALSE) {
|
|
$id_pf = 0;
|
|
$datDpf = NULL;
|
|
} else {
|
|
$id_pf = $datPf[0]['ID_PF'];
|
|
$datDpf = $this->Amod->getData_DaftarProforma_byPF($id_pf);
|
|
}
|
|
|
|
if ($hak>=3) {
|
|
$awal = $this->Amod->generate_subMonth($limit, 6);
|
|
$ket = "6 Bulan Kebelakang";
|
|
$datPfList = $this->Amod->getData_Proforma_bySTATUS_byPERIODE_orderDESC(1, $awal, $now);
|
|
$datPfVoid = $this->Amod->getData_Proforma_bySTATUS_byPERIODE_orderDESC(2, $awal, $now);
|
|
} else {
|
|
$awal = $this->Amod->generate_subMonth($limit, 3);
|
|
$ket = "3 Bulan Kebelakang";
|
|
$datPfList = $this->Amod->getData_Proforma_byKARYAWAN_bySTATUS_byPERIODE_orderDESC($id_karyawan, 1, $awal, $now);
|
|
$datPfVoid = $this->Amod->getData_Proforma_byKARYAWAN_bySTATUS_byPERIODE_orderDESC($id_karyawan, 2, $awal, $now);
|
|
}
|
|
$datCorp = $this->Amod->getData_Corp_bySTATUS(1);
|
|
|
|
$datStpos = $this->Amod->getData_SetTogglePosisi_byKARYAWAN_byMENU($id_karyawan, $id_menu);
|
|
if ($datStpos==FALSE) { $posisiToggle = 0; } else { $posisiToggle = $datStpos[0]['AKTIF_STPOS']; }
|
|
|
|
$data = array(
|
|
'sidebar' => "menu penjualan",
|
|
'navChild' => "penjualan proforma",
|
|
'tgl' => $now,
|
|
'corp' => $datCorp,
|
|
'dpf' => $datDpf,
|
|
'pf' => $datPfList,
|
|
'void' => $datPfVoid,
|
|
'pf_id' => $id_pf,
|
|
'countPf' => count($datPfList),
|
|
'countVoid' => count($datPfVoid),
|
|
'posisiToggle' => $posisiToggle,
|
|
'id_menu' => $id_menu,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil,
|
|
'ket' => $ket,
|
|
);
|
|
$this->load->view('proses/PJ_Sub3_Proforma_1', $data);
|
|
}
|
|
|
|
public function PJ_Ambil_Sub3_DataNamaBarang() {
|
|
$datBarang = $this->Amod->getData_Barang_bySTATUS(1);
|
|
|
|
$detail = [];
|
|
foreach ($datBarang as $key) {
|
|
$nama_barang = $key['NAMA_BARANG'];
|
|
$hasil = "$nama_barang";
|
|
array_push($detail, $hasil);
|
|
}
|
|
|
|
$this->output_json([
|
|
'detail' => $detail,
|
|
]);
|
|
}
|
|
|
|
public function PJ_Ambil_Sub3_A1_DataDaftarProforma() {
|
|
$id_pf = $this->input->post('id_pf');
|
|
$verse = $this->input->post('verse');
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
|
|
if ($verse==1) {
|
|
$datPf = $this->Amod->getData_Proforma_byKARYAWAN_bySTATUS($id_karyawan, 0);
|
|
if ($datPf==TRUE) {
|
|
$id_pf = $datPf[0]['ID_PF'];
|
|
} else {
|
|
$id_pf = NULL;
|
|
}
|
|
}
|
|
|
|
if ($id_pf==NULL) {
|
|
$datPf = NULL;
|
|
$id_pelanggan = "";
|
|
$id_corp = "";
|
|
$nama_pelanggan = "";
|
|
$ppn_pf = 0;
|
|
$tgl_pf = date('Y-m-d');
|
|
} else {
|
|
$datPf = $this->Amod->getData_Proforma_byID($id_pf);
|
|
$nama_pelanggan = $datPf[0]['NAMA_PELANGGAN'];
|
|
$id_pelanggan = $datPf[0]['PELANGGAN_ID'];
|
|
$id_corp = $datPf[0]['CORP_ID'];
|
|
$ppn_pf = $datPf[0]['PPN_PF'];
|
|
$tgl_pf = $datPf[0]['TGL_PF'];
|
|
}
|
|
|
|
$data = $this->Amod->getData_DaftarProforma_byPF($id_pf);
|
|
$no = 0;
|
|
foreach ($data as $key) {
|
|
$satuan = $key['HARGA_DPF'];
|
|
$subtotal = $key['HARGA_DPF']*$key['QTY_DPF'];
|
|
|
|
$data[$no] += ['SATUAN' => number_format($satuan,2)];
|
|
$data[$no++] += ['SUBTOTAL' => number_format($subtotal,2)];
|
|
}
|
|
|
|
$sumDpp = $this->Amod->getSum_DaftarProforma_byPF($id_pf);
|
|
if ($sumDpp[0]['TOTAL']==NULL) {
|
|
$dpp = 0;
|
|
$ppn = 0;
|
|
$tot = 0;
|
|
} else {
|
|
$dpp = round($sumDpp[0]['TOTAL'],2);
|
|
$ppn = round(($sumDpp[0]['TOTAL']*($ppn_pf/100)),2);
|
|
$tot = round(($dpp+$ppn),2);
|
|
}
|
|
|
|
$this->output_json([
|
|
'total' => sizeof($data),
|
|
'data' => $data,
|
|
'id_pelanggan' => $id_pelanggan,
|
|
'id_corp' => $id_corp,
|
|
'nama_pelanggan' => $nama_pelanggan,
|
|
'ppn_pf' => $ppn_pf,
|
|
'tgl_pf' => $tgl_pf,
|
|
'dpp' => number_format($dpp,2),
|
|
'ppn' => number_format($ppn,2),
|
|
'tot' => number_format($tot,2),
|
|
]);
|
|
}
|
|
|
|
public function PJ_Tambah_Sub3_A1_DataDaftarProforma() {
|
|
$id_pelanggan = $this->input->post('id_pelanggan');
|
|
$id_corp = $this->input->post('id_corp');
|
|
$tgl_pf = $this->input->post('tgl_pf');
|
|
$ppn_pf = $this->input->post('ppn_pf');
|
|
$nama_dpf = $this->input->post('nama');
|
|
$qty_dpf = $this->input->post('qty');
|
|
$harga_dpf = $this->input->post('harga');
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$value = 0;
|
|
$datPf = $this->Amod->getData_Proforma_byKARYAWAN_bySTATUS($id_karyawan, 0);
|
|
if ($datPf==TRUE) {
|
|
$id_pf = $datPf[0]['ID_PF'];
|
|
if ($tgl_pf==NULL) {
|
|
$tgl_pf = $datPf[0]['TGL_PF'];
|
|
}
|
|
if ($id_corp==NULL) {
|
|
$id_corp = $datPf[0]['CORP_ID'];
|
|
}
|
|
if ($id_pelanggan==NULL) {
|
|
$id_pelanggan = $datPf[0]['PELANGGAN_ID'];
|
|
}
|
|
if ($ppn_pf==NULL) {
|
|
$ppn_pf = $datPf[0]['PPN_PF'];
|
|
}
|
|
|
|
$update = [
|
|
'TGL_PF' => $tgl_pf,
|
|
'CORP_ID' => $id_corp,
|
|
'PELANGGAN_ID' => $id_pelanggan,
|
|
'PPN_PF' => $ppn_pf
|
|
];
|
|
$action = $this->Amod->update('proforma', $update, 'ID_PF', $id_pf);
|
|
} else {
|
|
$input = [
|
|
'CIPTA_PF' => "Oleh $panggilan pada $timestamp",
|
|
'KARYAWAN_ID' => $id_karyawan,
|
|
'TGL_PF' => $tgl_pf,
|
|
'CORP_ID' => $id_corp,
|
|
'PELANGGAN_ID' => $id_pelanggan,
|
|
'PPN_PF' => $ppn_pf,
|
|
'STATUS_PF' => '0'
|
|
];
|
|
$action = $this->Amod->create('proforma', $input);
|
|
|
|
$id_pf = $this->Amod->getMax_ID_Proforma();
|
|
$id_pf = $id_pf[0]['ID_PF'];
|
|
}
|
|
|
|
$input = [
|
|
'PF_ID' => $id_pf,
|
|
'QTY_DPF' => $qty_dpf,
|
|
'HARGA_DPF' => $harga_dpf,
|
|
'NAMA_DPF' => $nama_dpf
|
|
];
|
|
$action = $this->Amod->create('daftar_proforma', $input);
|
|
|
|
if ($action) {
|
|
$value = 1;
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value
|
|
]);
|
|
}
|
|
|
|
public function PJ_Ubah_Sub3_A1_DataDaftarProforma() {
|
|
$id_pelanggan = $this->input->post('id_pelanggan');
|
|
$id_corp = $this->input->post('id_corp');
|
|
$tgl_pf = $this->input->post('tgl_pf');
|
|
$ppn_pf = $this->input->post('ppn_pf');
|
|
$id_dpf = $this->input->post('id_dpf');
|
|
$nama_dpf = $this->input->post('nama_dpf');
|
|
$qty_dpf = $this->input->post('qty_dpf');
|
|
$harga_dpf = $this->input->post('harga_dpf');
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$value = 0;
|
|
$datDpf = $this->Amod->getData_DaftarProforma_byID($id_dpf);
|
|
if ($datDpf==FALSE) {
|
|
$value = 3;
|
|
} else {
|
|
$datPf = $this->Amod->getData_Proforma_byID_bySTATUS($datDpf[0]['PF_ID'], 0);
|
|
if ($datPf==FALSE) {
|
|
$value = 2;
|
|
} else {
|
|
$id_pf = $datPf[0]['ID_PF'];
|
|
if ($tgl_pf==NULL) {
|
|
$tgl_pf = $datPf[0]['TGL_PF'];
|
|
}
|
|
if ($id_corp==NULL) {
|
|
$id_corp = $datPf[0]['CORP_ID'];
|
|
}
|
|
if ($id_pelanggan==NULL) {
|
|
$id_pelanggan = $datPf[0]['PELANGGAN_ID'];
|
|
}
|
|
if ($ppn_pf==NULL) {
|
|
$ppn_pf = $datPf[0]['PPN_PF'];
|
|
}
|
|
|
|
$update = [
|
|
'TGL_PF' => $tgl_pf,
|
|
'CORP_ID' => $id_corp,
|
|
'PELANGGAN_ID' => $id_pelanggan,
|
|
'PPN_PF' => $ppn_pf
|
|
];
|
|
$action = $this->Amod->update('proforma', $update, 'ID_PF', $id_pf);
|
|
|
|
$update = [
|
|
'NAMA_DPF' => $nama_dpf,
|
|
'QTY_DPF' => $qty_dpf,
|
|
'HARGA_DPF' => $harga_dpf
|
|
];
|
|
$action = $this->Amod->update('daftar_proforma', $update, 'ID_DPF', $id_dpf);
|
|
|
|
$value = 1;
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value
|
|
]);
|
|
}
|
|
|
|
public function PJ_Hapus_Sub3_A1_DataDaftarProforma() {
|
|
$id_dpf = $this->input->post('id_dpf');
|
|
|
|
$value = 0;
|
|
$datDpf = $this->Amod->getData_DaftarProforma_byID($id_dpf);
|
|
if ($datDpf==FALSE) {
|
|
$value = 3;
|
|
} else {
|
|
$datPf = $this->Amod->getData_Proforma_byID_bySTATUS($datDpf[0]['PF_ID'], 0);
|
|
if ($datPf==FALSE) {
|
|
$value = 2;
|
|
} else {
|
|
$action = $this->Amod->delete('daftar_proforma', $id_dpf, 'ID_DPF');
|
|
$value = 1;
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value
|
|
]);
|
|
}
|
|
|
|
public function PJ_Kunci_Sub3_A1_DataProforma() {
|
|
$id_pelanggan = $this->input->post('id_pelanggan');
|
|
$id_corp = $this->input->post('id_corp');
|
|
$tgl_pf = $this->input->post('tgl_pf');
|
|
$ppn_pf = $this->input->post('ppn_pf');
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$now = date('Y-m-d');
|
|
|
|
$value = 0;
|
|
$datPf = $this->Amod->getData_Proforma_byKARYAWAN_bySTATUS($id_karyawan, 0);
|
|
if ($datPf==FALSE) {
|
|
$value = 2;
|
|
} else {
|
|
if ($tgl_pf==NULL) {
|
|
$tgl_pf = $datPf[0]['TGL_PF'];
|
|
}
|
|
if ($id_corp==NULL) {
|
|
$id_corp = $datPf[0]['CORP_ID'];
|
|
}
|
|
if ($id_pelanggan==NULL) {
|
|
$id_pelanggan = $datPf[0]['PELANGGAN_ID'];
|
|
}
|
|
if ($ppn_pf==NULL) {
|
|
$ppn_pf = $datPf[0]['PPN_PF'];
|
|
}
|
|
if ($datPf[0]['KODE_PF']!=NULL AND $datPf[0]['CORP_ID']==$id_corp) {
|
|
$kode_pf = $datPf[0]['KODE_PF'];
|
|
} else {
|
|
$kode_pf = $this->Amod->generate_kodeProforma($id_corp);
|
|
}
|
|
|
|
$update = [
|
|
'TGL_PF' => $tgl_pf,
|
|
'CORP_ID' => $id_corp,
|
|
'PELANGGAN_ID' => $id_pelanggan,
|
|
'PPN_PF' => $ppn_pf,
|
|
'KODE_PF' => $kode_pf,
|
|
'STATUS_PF' => '1'
|
|
];
|
|
$action = $this->Amod->update('proforma', $update, 'ID_PF', $datPf[0]['ID_PF']);
|
|
|
|
$value = 1;
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value
|
|
]);
|
|
}
|
|
|
|
public function PJ_Revisi_Sub3_A1_DataProforma() {
|
|
$id_pf = $this->input->post('id_pfrev');
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$datPf = $this->Amod->getData_Proforma_byID_bySTATUS($id_pf, 1);
|
|
if ($datPf==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$cekPf = $this->Amod->getData_Proforma_byKARYAWAN_bySTATUS($id_karyawan, 0);
|
|
if ($cekPf==TRUE) {
|
|
$update = [
|
|
'STATUS_PF' => '9'
|
|
];
|
|
$action = $this->Amod->update('proforma', $update, 'ID_PF', $cekPf[0]['ID_PF']);
|
|
}
|
|
|
|
$update = [
|
|
'REVISI_PF' => "Oleh $panggilan pada $timestamp",
|
|
'STATUS_PF' => '0'
|
|
];
|
|
$action = $this->Amod->update('proforma', $update, 'ID_PF', $id_pf);
|
|
|
|
if ($action) {
|
|
$this->session->set_flashdata('success', 'direvisi');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
} else {
|
|
$this->session->set_flashdata('failed', 'direvisi');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
}
|
|
|
|
public function PJ_Batal_Sub3_A1_DataProforma() {
|
|
$id_pf = $this->input->post('id_pfvoid');
|
|
$verse = $this->input->post('verse');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$datPf = $this->Amod->getData_Proforma_byID_bySTATUS($id_pf, $verse);
|
|
if ($datPf==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$status_pf = 2;
|
|
$countDpf = $this->Amod->getCount_DaftarProforma_byPF($id_pf);
|
|
if ($verse==0 AND $countDpf==0) {
|
|
$status_pf = 9;
|
|
}
|
|
|
|
$update = [
|
|
'BATAL_PF' => "Oleh $panggilan pada $timestamp",
|
|
'STATUS_PF' => $status_pf
|
|
];
|
|
$action = $this->Amod->update('proforma', $update, 'ID_PF', $id_pf);
|
|
|
|
if ($action) {
|
|
$this->session->set_flashdata('success', 'dibatalkan');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
} else {
|
|
$this->session->set_flashdata('failed', 'dibatalkan');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
}
|
|
|
|
//SUBMENU ADMINISTRASI - PROMO CLEARANCE
|
|
public function PJ_Sub3_PromoClearance_1() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$now = date('Y-m-d');
|
|
$limit = date('Y-m-01');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "PJ", "ADMINISTRASI - Promo Clearance");
|
|
$id_menu = $datShm[0]['MENU_ID'];
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$datStpos = $this->Amod->getData_SetTogglePosisi_byKARYAWAN_byMENU($id_karyawan, $id_menu);
|
|
if ($datStpos==FALSE) { $posisiToggle = 0; } else { $posisiToggle = $datStpos[0]['AKTIF_STPOS']; }
|
|
|
|
$datBarang = $this->Amod->getData_Barang_jenisOnly1_moreThan1_linkPC();
|
|
$datPc = $this->Amod->getData_PromoClearance_bySTATUS(1);
|
|
$datStpc = $this->Amod->getData_SetPelangganClearance();
|
|
$datPelanggan = $this->Amod->getData_Pelanggan_bySTATUS(1);
|
|
$datSales = $this->Amod->getData_Karyawan_allSales();
|
|
|
|
$data = array(
|
|
'sidebar' => "menu penjualan",
|
|
'navChild' => "penjualan promoclearance",
|
|
'barang' => $datBarang,
|
|
'pelanggan' => $datPelanggan,
|
|
'sales' => $datSales,
|
|
'pc' => $datPc,
|
|
'stpc' => $datStpc,
|
|
'countPc' => count($datPc),
|
|
'countStpc' => count($datStpc),
|
|
'id_menu' => $id_menu,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil,
|
|
'posisiToggle' => $posisiToggle,
|
|
);
|
|
$this->load->view('proses/PJ_Sub3_PromoClearance_1', $data);
|
|
}
|
|
|
|
public function PJ_Tambah_Sub3_B1_DataPromoClearance() {
|
|
$id_barang = $this->input->post('id_barangnew');
|
|
$nilai_pc = $this->input->post('nilai_pcnew');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
$now = date('Y-m-d');
|
|
|
|
$datPc = $this->Amod->getData_PromoClearance_byBARANG_bySTATUS($id_barang, 1);
|
|
if ($datPc==TRUE) {
|
|
$this->session->set_flashdata('duplicate_data', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$input = [
|
|
'CIPTA_PC' => "Oleh $panggilan pada $timestamp",
|
|
'BARANG_ID' => $id_barang,
|
|
'NILAI_PC' => $nilai_pc,
|
|
'TGL_PC' => $now,
|
|
'STATUS_PC' => '1'
|
|
];
|
|
$action = $this->Amod->create('promo_clearance', $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 PJ_Tambah_Sub3_B1_DataSetPelangganClearance() {
|
|
$id_pelanggan = $this->input->post('id_pelanggannew');
|
|
$id_sales = $this->input->post('id_salesnew');
|
|
$verse = $this->input->post('verse');
|
|
|
|
if ($verse==1) {
|
|
$datStpc = $this->Amod->getData_SetPelangganClearance_byPELANGGAN($id_pelanggan);
|
|
} else if ($verse==2) {
|
|
$datStpc = $this->Amod->getData_SetPelangganClearance_bySALES($id_sales);
|
|
}
|
|
|
|
if ($datStpc==TRUE) {
|
|
$this->session->set_flashdata('duplicate_data', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
if ($verse==1) {
|
|
$input = [
|
|
'PELANGGAN_ID' => $id_pelanggan
|
|
];
|
|
} else if ($verse==2) {
|
|
$input = [
|
|
'SALES_ID' => $id_sales
|
|
];
|
|
}
|
|
$action = $this->Amod->create('set_pelanggan_clearance', $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 PJ_Ubah_Sub3_B1_DataPromoClearance() {
|
|
$id_pc = $this->input->post('id_pced');
|
|
$id_barang = $this->input->post('id_baranged');
|
|
$nilai_pc = $this->input->post('nilai_pced');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
$now = date('Y-m-d');
|
|
|
|
$datPc = $this->Amod->getData_PromoClearance_byID($id_pc);
|
|
if ($datPc==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
if ($id_barang!=NULL) {
|
|
$cekPc = $this->Amod->getData_PromoClearance_byBARANG_bySTATUS($id_barang, 1);
|
|
if ($cekPc==TRUE) {
|
|
$this->session->set_flashdata('duplicate_data', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$update = [
|
|
'UBAH_PC' => "Oleh $panggilan pada $timestamp",
|
|
'NILAI_PC' => $nilai_pc,
|
|
'BARANG_ID' => $id_barang,
|
|
];
|
|
$action = $this->Amod->update('promo_clearance', $update, 'ID_PC', $id_pc);
|
|
} else {
|
|
$update = [
|
|
'UBAH_PC' => "Oleh $panggilan pada $timestamp",
|
|
'NILAI_PC' => $nilai_pc,
|
|
];
|
|
$action = $this->Amod->update('promo_clearance', $update, 'ID_PC', $id_pc);
|
|
}
|
|
|
|
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 PJ_Hapus_Sub3_B1_DataPromoClearance() {
|
|
$id_pc = $this->input->post('id_pcdel');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$datPc = $this->Amod->getData_PromoClearance_byID_bySTATUS($id_pc, 1);
|
|
if ($datPc==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$update = [
|
|
'STATUS_PC' => '0',
|
|
'HAPUS_PC' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('promo_clearance', $update, 'ID_PC', $id_pc);
|
|
|
|
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 PJ_Hapus_Sub3_B1_DataSetPelangganClearance() {
|
|
$id_stpc = $this->input->post('id_stpcdel');
|
|
|
|
$datStpc = $this->Amod->getData_SetPelangganClearance_byID($id_stpc);
|
|
if ($datStpc==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$action = $this->Amod->delete('set_pelanggan_clearance', $id_stpc, 'ID_STPC');
|
|
|
|
if ($action) {
|
|
$this->session->set_flashdata('success', 'dihapus');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
} else {
|
|
$this->session->set_flashdata('failed', 'dihapus');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
}
|
|
|
|
//Daftar Menu KU [Keuangan]
|
|
//SUBMENU AKUNTANSI - TRANSAKSI KAS
|
|
public function KU_Sub1_Kas_1() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$limit = date('Y-m-01');
|
|
$now = date('Y-m-d');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "KU", "TRANSAKSI - Kas");
|
|
$id_menu = $datShm[0]['MENU_ID'];
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$datSkk = $this->Amod->getData_SetKasbankAktif_byKARYAWAN_byNAMA($id_karyawan, "KAS");
|
|
if ($datSkk==FALSE) {
|
|
$aktif = 0;
|
|
if ($aktif==0) {
|
|
$kode_kas = "Tidak Berhak*";
|
|
} else {
|
|
$dataKas = $this->Amod->getData_Kas_byID($aktif);
|
|
$kode_kas = $dataKas[0]['KODE_KAS'];
|
|
}
|
|
} else {
|
|
$aktif = $datSkk[0]['AKTIF_SKK'];
|
|
$dataKas = $this->Amod->getData_Kas_byID($aktif);
|
|
$kode_kas = $dataKas[0]['KODE_KAS'];
|
|
}
|
|
|
|
$datAkuntansi = $this->Amod->getData_Akuntansi_byKAS_bySTATUS_joinDak($aktif, 0);
|
|
$datBank = $this->Amod->getData_Bank_bySTATUS(1);
|
|
$datCorp = $this->Amod->getData_Corp_forPPH();
|
|
$datFk = $this->Amod->getData_FormKaryawan_ACC();
|
|
$datKaryProyek = $this->Amod->getData_Karyawan_forAbsensi();
|
|
$datKas = $this->Amod->getData_Kas_bySTATUS(1);
|
|
$datKwitansi = $this->Amod->getData_Kwitansi_joinUMNull_orderDESC();
|
|
$datKendProyek = $this->Amod->getData_Kendaraan_bySTATUS(1);
|
|
$datPelanggan = $this->Amod->getData_Pelanggan_bySTATUS(1);
|
|
$datPerkFormKaryawan = $this->Amod->getData_Perkiraan_FormLemburLuarKota();
|
|
$datPerkKeluar = $this->Amod->getData_Perkiraan_KasbankKeluarOnly();
|
|
$datPerkMasuk = $this->Amod->getData_Perkiraan_KasbankMasukOnly();
|
|
$datProyek = $this->Amod->getData_Proyek_forBerjalan();
|
|
$datPph = $this->Amod->getData_PajakPenghasilan_NotNull();
|
|
$datUnitProyek = $this->Amod->getData_UnitProyek_bySTATUS(1);
|
|
$datUm = $this->Amod->getData_UangMuka_bySTATUS(0);
|
|
|
|
$datNb = $this->Amod->getData_NotaBebas_joinUMNull_dpOnly_orderDESC();
|
|
$no = 0;
|
|
foreach ($datNb as $key) {
|
|
$sumDnb = $this->Amod->getSum_DaftarNotaBebas_byNB($key['ID_NB']);
|
|
if ($sumDnb==FALSE OR $sumDnb[0]['TOTAL']==NULL) {
|
|
$nilaiDpp = 0;
|
|
} else {
|
|
$nilaiDpp = $sumDnb[0]['TOTAL'];
|
|
}
|
|
$ppnUm = round((($key['PPN_NB']/100)*$nilaiDpp),2);
|
|
$nilaiUm = $nilaiDpp+$ppnUm;
|
|
$datNb[$no++] += ['NILAI' => number_format($nilaiUm,2)];
|
|
}
|
|
|
|
$datStpos = $this->Amod->getData_SetTogglePosisi_byKARYAWAN_byMENU($id_karyawan, $id_menu);
|
|
if ($datStpos==FALSE) { $posisiToggle = 0; } else { $posisiToggle = $datStpos[0]['AKTIF_STPOS']; }
|
|
|
|
$data = array(
|
|
'sidebar' => "menu keuangan",
|
|
'navChild' => "keuangan kas",
|
|
'kode_kas' => $kode_kas,
|
|
'id_menu' => $id_menu,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil,
|
|
'posisiToggle' => $posisiToggle,
|
|
'tgl' => $now,
|
|
'aktif' => $aktif,
|
|
'akuntansi' => $datAkuntansi,
|
|
'bank' => $datBank,
|
|
'countBelum' => count($datAkuntansi),
|
|
'fk' => $datFk,
|
|
'perFk' => $datPerkFormKaryawan,
|
|
'perKeluar' => $datPerkKeluar,
|
|
'perMasuk' => $datPerkMasuk,
|
|
'unitproyek' => $datUnitProyek,
|
|
'kas' => $datKas,
|
|
'karyawanproyek' => $datKaryProyek,
|
|
'kendaraanproyek' => $datKendProyek,
|
|
'kwitansi' => $datKwitansi,
|
|
'nb' => $datNb,
|
|
'proyek' => $datProyek,
|
|
'pph' => $datPph,
|
|
'pelanggan' => $datPelanggan,
|
|
'um' => $datUm,
|
|
'corp' => $datCorp,
|
|
);
|
|
$this->load->view('proses/KU_Sub1_Kas_1', $data);
|
|
}
|
|
|
|
public function KU_Ganti_Sub1_DataKas() {
|
|
$id_kas = $this->input->post('id_kas');
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
|
|
$datSkk = $this->Amod->getData_SetKasbankAktif_byKARYAWAN_byNAMA($id_karyawan, "KAS");
|
|
if ($datSkk==FALSE) {
|
|
$input = [
|
|
'KARYAWAN_ID' => $id_karyawan,
|
|
'NAMA_SKK' => "KAS",
|
|
'AKTIF_SKK' => $id_kas,
|
|
];
|
|
$action = $this->Amod->create('set_kasbankaktif', $input);
|
|
} else {
|
|
$update = [
|
|
'AKTIF_SKK' => $id_kas
|
|
];
|
|
$action = $this->Amod->update('set_kasbankaktif', $update, 'ID_SKK', $datSkk[0]['ID_SKK']);
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => '0',
|
|
]);
|
|
}
|
|
|
|
public function KU_Ambil_Sub1_DataPiutangDagang() {
|
|
$id_penjualan = $this->input->post('id_penjualan');
|
|
|
|
$maxPda = 0;
|
|
foreach ($id_penjualan as $key) {
|
|
$sumPda = $this->Amod->getSum_DaftarAkuntansi_byPENJUALAN_byPERKIRAAN($key, 3);
|
|
$sisaPda = $sumPda[0]['DEBET']-$sumPda[0]['KREDIT'];
|
|
$maxPda = round(($maxPda+$sisaPda),2);
|
|
}
|
|
|
|
$this->output_json([
|
|
'totalPda' => $maxPda,
|
|
]);
|
|
}
|
|
|
|
public function KU_Ambil_Sub1_DataHutangDagang() {
|
|
$id_pembelian = $this->input->post('id_pembelian');
|
|
|
|
$maxHda = 0;
|
|
foreach ($id_pembelian as $key) {
|
|
$sumHda = $this->Amod->getSum_DaftarAkuntansi_byPEMBELIAN_byPERKIRAAN($key, 15);
|
|
$sisaHda = $sumHda[0]['KREDIT']-$sumHda[0]['DEBET'];
|
|
$maxHda = round(($maxHda+$sisaHda),2);
|
|
}
|
|
|
|
$this->output_json([
|
|
'totalHda' => $maxHda,
|
|
]);
|
|
}
|
|
|
|
public function KU_Ambil_Sub1_DataKwitansi() {
|
|
$id_kwitansi = $this->input->post('id_kwitansi');
|
|
|
|
$datKwitansi = $this->Amod->getData_Kwitansi_byID($id_kwitansi);
|
|
|
|
$this->output_json([
|
|
'nilaiAsli' => $datKwitansi[0]['NILAI_KWITANSI'],
|
|
'nilaiKwitansi' => $datKwitansi[0]['NILAI'],
|
|
'nilaiPk' => '0.00',
|
|
'nilaiPph' => '0.00',
|
|
]);
|
|
}
|
|
|
|
public function KU_Ambil_Sub1_DataNotaDp() {
|
|
$id_nb = $this->input->post('id_nb');
|
|
|
|
$datNb = $this->Amod->getData_NotaBebas_byID($id_nb);
|
|
$sumDnb = $this->Amod->getSum_DaftarNotaBebas_byNB($id_nb);
|
|
if ($sumDnb==FALSE OR $sumDnb[0]['TOTAL']==NULL) {
|
|
$dppUm = 0;
|
|
} else {
|
|
$dppUm = round($sumDnb[0]['TOTAL'],2);
|
|
}
|
|
|
|
$ppnUm = round((($datNb[0]['PPN_NB']/100)*$dppUm),2);
|
|
|
|
$this->output_json([
|
|
'dppAsli' => $dppUm,
|
|
'dppUm' => number_format($dppUm,2),
|
|
'ppnUm' => number_format($ppnUm,2),
|
|
'pphUm' => number_format(0, 2),
|
|
]);
|
|
}
|
|
|
|
public function KU_Ambil_Sub1_DataNilaiPPH() {
|
|
$nilai_pph = $this->input->post('nilai_pph');
|
|
$nilai_dpLama = $this->input->post('nilai_dpLama');
|
|
|
|
$nilai_dpBaru = $nilai_dpLama-$nilai_pph;
|
|
|
|
$this->output_json([
|
|
'nilai_dpBaru' => number_format($nilai_dpBaru,2),
|
|
]);
|
|
}
|
|
|
|
public function KU_Ambil_Sub1_DataDaftarAkuntansi() {
|
|
$id_akuntansi = $this->input->post('id_akuntansi');
|
|
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byAKUNTANSI($id_akuntansi);
|
|
$no = 0;
|
|
foreach ($datDak as $key) {
|
|
$debet = number_format($key['DEBET_DAK'],2);
|
|
$kredit = number_format($key['KREDIT_DAK'],2);
|
|
|
|
$datDak[$no] += ['DEBET' => $debet];
|
|
$datDak[$no++] += ['KREDIT' => $kredit];
|
|
}
|
|
|
|
$datAkuntansi = $this->Amod->getData_Akuntansi_byID($id_akuntansi);
|
|
$kode_akuntansi = $datAkuntansi[0]['KODE_AKUNTANSI'];
|
|
$kunciHapus = $datAkuntansi[0]['KUNCI'];
|
|
|
|
if (strpos($kode_akuntansi,"JM")!==FALSE) {
|
|
if ($datAkuntansi[0]['KARYAWAN_AKUNTANSI']==NULL) {
|
|
$jurnalkhusus = " | Jurnal Umum";
|
|
} else {
|
|
$jurnalkhusus = " | Jurnal Khusus";
|
|
}
|
|
} else {
|
|
$jurnalkhusus = "";
|
|
}
|
|
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byAKUNTANSI($id_akuntansi);
|
|
if ($sumDak[0]['DEBET']==NULL) {
|
|
$debetLihat = 0;
|
|
$kreditLihat = 0;
|
|
$readyLock = 0;
|
|
} else {
|
|
$debetLihat = $sumDak[0]['DEBET'];
|
|
$kreditLihat = $sumDak[0]['KREDIT'];
|
|
if ($debetLihat==$kreditLihat) {
|
|
$readyLock = 1;
|
|
} else {
|
|
$readyLock = 0;
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'data' => $datDak,
|
|
'deleteLock' => $kunciHapus,
|
|
'readyLock' => $readyLock,
|
|
'debetLihat' => number_format($debetLihat,2),
|
|
'kreditLihat' => number_format($kreditLihat,2),
|
|
'kode_akuntansi' => $kode_akuntansi,
|
|
'jurnalkhusus' => $jurnalkhusus,
|
|
'tanggal' => $datAkuntansi[0]['TANGGAL'],
|
|
'total' => sizeof($datDak)
|
|
]);
|
|
}
|
|
|
|
public function KU_Ambil_Sub1_DataPenjualan() {
|
|
$id_pelanggan = $this->input->post('id_pelanggan');
|
|
|
|
$data = $this->Amod->getData_Penjualan_byPELANGGAN_forPPH($id_pelanggan);
|
|
|
|
$this->output_json([
|
|
'data' => $data,
|
|
]);
|
|
}
|
|
|
|
public function KU_Ambil_Sub1_A1_DataMaster() {
|
|
$id_perkiraan = $this->input->post('id_perkiraan');
|
|
$id_akuntansi = $this->input->post('id_akuntansi');
|
|
|
|
$datAkuntansi = $this->Amod->getData_Akuntansi_byID($id_akuntansi);
|
|
|
|
if ($id_perkiraan==1) {
|
|
$data = $this->Amod->getData_Kas_notThis($datAkuntansi[0]['KAS_AKUNTANSI']);
|
|
} else if ($id_perkiraan==2) {
|
|
$data = $this->Amod->getData_Bank_bySTATUS(1);
|
|
} else if ($id_perkiraan==3) {
|
|
$data = $this->Amod->getData_DaftarAkuntansi_byPERKIRAAN_groupPENJUALAN_belumLunas($id_perkiraan);
|
|
} else if ($id_perkiraan==5) {
|
|
if (strpos($datAkuntansi[0]['KODE_AKUNTANSI'],"KK")!==FALSE) {
|
|
$data = $this->Amod->getData_Karyawan_forAkuntansi();
|
|
} else if (strpos($datAkuntansi[0]['KODE_AKUNTANSI'],"KM")!==FALSE) {
|
|
$data = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_groupKARYAWAN(5);
|
|
}
|
|
} else if ($id_perkiraan==6) {
|
|
if (strpos($datAkuntansi[0]['KODE_AKUNTANSI'],"KK")!==FALSE) {
|
|
$data = $this->Amod->getData_Pihakke3_bySTATUS(1);
|
|
} else if (strpos($datAkuntansi[0]['KODE_AKUNTANSI'],"KM")!==FALSE) {
|
|
$data = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_groupPIHAKKE3(6);
|
|
}
|
|
} else if ($id_perkiraan==7) {
|
|
if (strpos($datAkuntansi[0]['KODE_AKUNTANSI'],"KK")!==FALSE) {
|
|
$data = $this->Amod->getData_Supplier_bySTATUS(1);
|
|
} else if (strpos($datAkuntansi[0]['KODE_AKUNTANSI'],"KM")!==FALSE) {
|
|
$data = $this->Amod->getData_DaftarAkuntansi_byPERKIRAAN_groupMAINDPB_belumLunas($id_perkiraan);
|
|
}
|
|
} else if ($id_perkiraan==15) {
|
|
$data = $this->Amod->getData_DaftarAkuntansi_byPERKIRAAN_groupPEMBELIAN_belumLunas($id_perkiraan);
|
|
} else if ($id_perkiraan==33 OR $id_perkiraan==34) {
|
|
$data = $this->Amod->getData_Kendaraan_bySTATUS(1);
|
|
} else if ($id_perkiraan==64) {
|
|
$data = $this->Amod->getData_HasilHitungBfe_bySTATUS(0);
|
|
} else if ($id_perkiraan==70) {
|
|
$data = $this->Amod->getData_Proyek_forBerjalan();
|
|
}
|
|
|
|
$this->output_json([
|
|
'data' => $data,
|
|
]);
|
|
}
|
|
|
|
public function KU_Simpan_Sub1_DataAkuntansiUmum() {
|
|
$jenis_akuntansi = $this->input->post('jenis_akuntansinew');
|
|
$tgl_akuntansi = $this->input->post('tgl_akuntansinew');
|
|
$debet_dak = $this->input->post('debet_daknew');
|
|
$kredit_dak = $this->input->post('kredit_daknew');
|
|
$id_bank = $this->input->post('id_banknew');
|
|
$id_kas = $this->input->post('id_kasnew');
|
|
$id_perkiraan = $this->input->post('id_perkiraannew');
|
|
$ket_dak = $this->input->post('ket_daknew');
|
|
$ket_dak = preg_replace('/\R+/', " " , $ket_dak);
|
|
$now = date('Y-m-d');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
|
|
$datPak = $this->Amod->getData_PeriodeAkuntansi_bySTATUS(0);
|
|
if (strtotime($tgl_akuntansi)>strtotime($datPak[0]['AKHIR_PAK'])) {
|
|
$this->session->set_flashdata('tgl_limitperiod', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
} else {
|
|
if (strtotime($tgl_akuntansi)<strtotime($datPak[0]['AWAL_PAK'])) {
|
|
$this->session->set_flashdata('tgl_diffmonth', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
} else if (strtotime($tgl_akuntansi)>strtotime($now)) {
|
|
$this->session->set_flashdata('tgl_moreday', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
}
|
|
|
|
//Set Koma menjadi titik
|
|
$debet_dak = str_replace(',', '.', $debet_dak);
|
|
$kredit_dak = str_replace(',', '.', $kredit_dak);
|
|
|
|
$cekDebet = is_numeric($debet_dak);
|
|
if ($cekDebet==FALSE) {
|
|
$debet_dak = 0;
|
|
}
|
|
|
|
$cekKredit = is_numeric($kredit_dak);
|
|
if ($cekKredit==FALSE) {
|
|
$kredit_dak = 0;
|
|
}
|
|
|
|
if ($debet_dak<0 OR $kredit_dak<0) {
|
|
$this->session->set_flashdata('less_zero', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$cekDak = $this->Amod->getData_DaftarAkuntansi_cekDak($id_perkiraan, $debet_dak, $kredit_dak, $ket_dak, $tgl_akuntansi);
|
|
if ($cekDak==TRUE) {
|
|
$this->session->set_flashdata('duplicate_data', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$kode_akuntansi = $this->Amod->generate_kodeKasbank($id_perkiraan, $jenis_akuntansi);
|
|
$input = [
|
|
'CIPTA_AKUNTANSI' => "Oleh $panggilan pada $timestamp",
|
|
'TGL_AKUNTANSI' => $tgl_akuntansi,
|
|
'KODE_AKUNTANSI' => $kode_akuntansi,
|
|
'KAS_AKUNTANSI' => $id_kas,
|
|
'BANK_AKUNTANSI' => $id_bank,
|
|
'STATUS_AKUNTANSI' => '0',
|
|
];
|
|
$action = $this->Amod->create('akuntansi', $input);
|
|
|
|
$id_akuntansi = $this->Amod->getMax_ID_Akuntansi();
|
|
$id_akuntansi = $id_akuntansi[0]['ID_AKUNTANSI'];
|
|
|
|
$input = [
|
|
'AKUNTANSI_ID' => $id_akuntansi,
|
|
'CIPTA_DAK' => "Oleh $panggilan pada $timestamp",
|
|
'JENIS_DAK' => '1',
|
|
'PERKIRAAN_ID' => $id_perkiraan,
|
|
'DEBET_DAK' => $debet_dak,
|
|
'KREDIT_DAK' => $kredit_dak,
|
|
'KET_DAK' => $ket_dak,
|
|
'BANK_ID' => $id_bank,
|
|
'KAS_ID' => $id_kas,
|
|
];
|
|
$action = $this->Amod->create('daftar_akuntansi', $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 KU_Simpan_Sub1_DataAkuntansiKhusus() {
|
|
$jenis_akuntansi = $this->input->post('jenis_akuntansi');
|
|
$jenis_um = $this->input->post('jenis_um');
|
|
$nilai_dak = $this->input->post('nilai_dak');
|
|
$nilai_pphum = $this->input->post('nilai_pphum');
|
|
$ket_dak = $this->input->post('ket_dak');
|
|
$id_bank = $this->input->post('id_bank');
|
|
$id_kas = $this->input->post('id_kas');
|
|
$id_kwitansi = $this->input->post('id_kwitansi');
|
|
$id_nb = $this->input->post('id_nb');
|
|
$id_perkiraan = $this->input->post('id_perkiraan');
|
|
$id_corp = $this->input->post('id_corp');
|
|
$id_fk = $this->input->post('id_fk');
|
|
$id_penjualan = $this->input->post('id_penjualan');
|
|
$id_pph = $this->input->post('id_pph');
|
|
$id_proyek = $this->input->post('id_proyek');
|
|
$id_um = $this->input->post('id_um');
|
|
$bank_id = $this->input->post('bank_id');
|
|
$kas_id = $this->input->post('kas_id');
|
|
$jenis_dpp = $this->input->post('jenis_dpp');
|
|
$ket_dak = preg_replace('/\R+/', " " , $ket_dak);
|
|
$tgl_akuntansi = date('Y-m-d');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
|
|
if ($id_perkiraan==1 OR $id_perkiraan==2 OR $id_perkiraan==8) {
|
|
$nilai_dak = str_replace(',', '.', $nilai_dak);
|
|
|
|
$cekNilai = is_numeric($nilai_dak);
|
|
if ($cekNilai==FALSE) {
|
|
$nilai_dak = 0;
|
|
}
|
|
|
|
if ($nilai_dak<0) {
|
|
$this->session->set_flashdata('less_zero', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
if ($jenis_dpp==1 AND $id_pph==2 AND $id_penjualan=="") {
|
|
$this->session->set_flashdata('nota_null', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
} else if ($id_perkiraan==19) {
|
|
if ($jenis_um==1) {
|
|
$datKwitansi = $this->Amod->getData_Kwitansi_byID($id_kwitansi);
|
|
if ($datKwitansi==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$nilai_ppnUm = 0;
|
|
$nilai_dppUm = $datKwitansi[0]['NILAI_KWITANSI'];
|
|
$nilai_dak = $datKwitansi[0]['NILAI_KWITANSI'];
|
|
$kode_um = $datKwitansi[0]['KODE_KWITANSI'];
|
|
$nama_pelanggan = $datKwitansi[0]['NAMA_PELANGGAN'];
|
|
$corp_id = $datKwitansi[0]['CORP_ID'];
|
|
$pelanggan_id = $datKwitansi[0]['PELANGGAN_ID'];
|
|
$id_nb = NULL;
|
|
} else if ($jenis_um==2) {
|
|
$datNb = $this->Amod->getData_NotaBebas_byID($id_nb);
|
|
if ($datNb==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
if ($id_pph!=NULL OR $id_pph!="") {
|
|
$cekNilai = is_numeric($nilai_pphum);
|
|
if ($cekNilai==FALSE) {
|
|
$nilai_pphum = 0;
|
|
}
|
|
|
|
if ($nilai_pphum<=0) {
|
|
$this->session->set_flashdata('less_same_zero', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$datPph = $this->Amod->getData_PajakPenghasilan_byID($id_pph);
|
|
if ($datPph==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
}
|
|
|
|
$sumDnb = $this->Amod->getSum_DaftarNotaBebas_byNB($id_nb);
|
|
if ($sumDnb==FALSE OR $sumDnb[0]['TOTAL']==NULL) {
|
|
$nilai_dppUm = 0;
|
|
} else {
|
|
$nilai_dppUm = $sumDnb[0]['TOTAL'];
|
|
}
|
|
|
|
if ($nilai_dppUm<=0) {
|
|
$this->session->set_flashdata('less_same_zero', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
if ($nilai_pphum>$nilai_dppUm) {
|
|
$this->session->set_flashdata('pph_dpvaluemorethan', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$nilai_ppnUm = round((($datNb[0]['PPN_NB']/100)*$nilai_dppUm),2);
|
|
$nilai_dak = $nilai_dppUm+$nilai_ppnUm;
|
|
$kode_um = $datNb[0]['KODE_NB'];
|
|
$nama_pelanggan = $datNb[0]['NAMA_PELANGGAN'];
|
|
$corp_id = $datNb[0]['CORP_ID'];
|
|
$pelanggan_id = $datNb[0]['PELANGGAN_ID'];
|
|
$id_kwitansi = NULL;
|
|
} else if ($jenis_um==9) {
|
|
$datUm = $this->Amod->getData_UangMuka_byID_bySTATUS($id_um, 0);
|
|
if ($datUm==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
$kode_um = $datUm[0]['KODE_UM'];
|
|
$pelanggan_id = $datUm[0]['PEL_ID'];
|
|
$nilai_dak = $datUm[0]['NILAI_UM'];
|
|
}
|
|
} else {
|
|
$datFk = $this->Amod->getData_FormKaryawan_byID($id_fk);
|
|
if ($datFk==FALSE OR $datFk[0]['STATUS_FK']!=0) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$nilai_dak = $datFk[0]['NILAI_FK'];
|
|
}
|
|
|
|
$cekDak = $this->Amod->getData_DaftarAkuntansi_cekDak($id_perkiraan, NULL, NULL, $ket_dak, $tgl_akuntansi);
|
|
if ($cekDak==TRUE) {
|
|
$this->session->set_flashdata('duplicate_data', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
if ($id_bank!=null) {
|
|
$kode_akuntansi = $this->Amod->generate_kodeKasbank(2, $jenis_akuntansi);
|
|
} else if ($id_kas!=null) {
|
|
$kode_akuntansi = $this->Amod->generate_kodeKasbank(1, $jenis_akuntansi);
|
|
}
|
|
|
|
$input = [
|
|
'CIPTA_AKUNTANSI' => "Oleh $panggilan pada $timestamp",
|
|
'TGL_AKUNTANSI' => $tgl_akuntansi,
|
|
'KODE_AKUNTANSI' => $kode_akuntansi,
|
|
'KAS_AKUNTANSI' => $id_kas,
|
|
'BANK_AKUNTANSI' => $id_bank,
|
|
'STATUS_AKUNTANSI' => '0',
|
|
'KUNCI' => '1',
|
|
];
|
|
$action = $this->Amod->create('akuntansi', $input);
|
|
|
|
$id_akuntansi = $this->Amod->getMax_ID_Akuntansi();
|
|
$id_akuntansi = $id_akuntansi[0]['ID_AKUNTANSI'];
|
|
|
|
if ($id_bank!=null) {
|
|
if ($jenis_akuntansi==0) {
|
|
$input = [
|
|
'AKUNTANSI_ID' => $id_akuntansi,
|
|
'PERKIRAAN_ID' => '2',
|
|
'CIPTA_DAK' => "Oleh $panggilan pada $timestamp",
|
|
'JENIS_DAK' => '1',
|
|
'DEBET_DAK' => '0',
|
|
'KREDIT_DAK' => $nilai_dak,
|
|
'KET_DAK' => $ket_dak,
|
|
'BANK_ID' => $id_bank,
|
|
];
|
|
$action = $this->Amod->create('daftar_akuntansi', $input);
|
|
} else if ($jenis_akuntansi==1) {
|
|
$input = [
|
|
'AKUNTANSI_ID' => $id_akuntansi,
|
|
'PERKIRAAN_ID' => '2',
|
|
'CIPTA_DAK' => "Oleh $panggilan pada $timestamp",
|
|
'JENIS_DAK' => '1',
|
|
'KREDIT_DAK' => '0',
|
|
'DEBET_DAK' => $nilai_dak,
|
|
'KET_DAK' => $ket_dak,
|
|
'BANK_ID' => $id_bank,
|
|
];
|
|
$action = $this->Amod->create('daftar_akuntansi', $input);
|
|
}
|
|
} else if ($id_kas!=null) {
|
|
if ($jenis_akuntansi==0) {
|
|
$input = [
|
|
'AKUNTANSI_ID' => $id_akuntansi,
|
|
'PERKIRAAN_ID' => '1',
|
|
'CIPTA_DAK' => "Oleh $panggilan pada $timestamp",
|
|
'JENIS_DAK' => '1',
|
|
'DEBET_DAK' => '0',
|
|
'KREDIT_DAK' => $nilai_dak,
|
|
'KET_DAK' => $ket_dak,
|
|
'KAS_ID' => $id_kas,
|
|
];
|
|
$action = $this->Amod->create('daftar_akuntansi', $input);
|
|
} else if ($jenis_akuntansi==1) {
|
|
$input = [
|
|
'AKUNTANSI_ID' => $id_akuntansi,
|
|
'PERKIRAAN_ID' => '1',
|
|
'CIPTA_DAK' => "Oleh $panggilan pada $timestamp",
|
|
'JENIS_DAK' => '1',
|
|
'KREDIT_DAK' => '0',
|
|
'DEBET_DAK' => $nilai_dak,
|
|
'KET_DAK' => $ket_dak,
|
|
'KAS_ID' => $id_kas,
|
|
];
|
|
$action = $this->Amod->create('daftar_akuntansi', $input);
|
|
}
|
|
}
|
|
|
|
if ($id_perkiraan==1) {
|
|
if ($id_kas!=null) {
|
|
$datKas = $this->Amod->getData_Kas_byID($id_kas);
|
|
$sumberAs = $datKas[0]['KODE_KAS'];
|
|
} else if ($id_bank!=null) {
|
|
$datBank = $this->Amod->getData_Bank_byID($id_bank);
|
|
$sumberAs = $datBank[0]['KODE_BANK'];
|
|
}
|
|
|
|
$dataKas = $this->Amod->getData_Kas_byID($kas_id);
|
|
$tujuanAs = $dataKas[0]['KODE_KAS'];
|
|
|
|
$input = [
|
|
'AKUNTANSI_ID' => $id_akuntansi,
|
|
'PERKIRAAN_ID' => $id_perkiraan,
|
|
'CIPTA_DAK' => "Oleh $panggilan pada $timestamp",
|
|
'JENIS_DAK' => '2',
|
|
'BANK_ID' => $id_bank,
|
|
'KAS_ID' => $id_kas,
|
|
'DEBET_DAK' => $nilai_dak,
|
|
'KREDIT_DAK' => '0',
|
|
'KET_DAK' => "Ayat Silang u/ $tujuanAs, dari $sumberAs",
|
|
'AS_KAS' => $kas_id
|
|
];
|
|
$action = $this->Amod->create('daftar_akuntansi', $input);
|
|
} else if ($id_perkiraan==2) {
|
|
if ($id_kas!=null) {
|
|
$datKas = $this->Amod->getData_Kas_byID($id_kas);
|
|
$sumberAs = $datKas[0]['KODE_KAS'];
|
|
} else if ($id_bank!=null) {
|
|
$datBank = $this->Amod->getData_Bank_byID($id_bank);
|
|
$sumberAs = $datBank[0]['KODE_BANK'];
|
|
}
|
|
|
|
$dataBank = $this->Amod->getData_Bank_byID($bank_id);
|
|
$tujuanAs = $dataBank[0]['KODE_BANK'];
|
|
|
|
$input = [
|
|
'AKUNTANSI_ID' => $id_akuntansi,
|
|
'PERKIRAAN_ID' => $id_perkiraan,
|
|
'CIPTA_DAK' => "Oleh $panggilan pada $timestamp",
|
|
'JENIS_DAK' => '2',
|
|
'BANK_ID' => $id_bank,
|
|
'KAS_ID' => $id_kas,
|
|
'DEBET_DAK' => $nilai_dak,
|
|
'KREDIT_DAK' => '0',
|
|
'KET_DAK' => "Ayat Silang u/ $tujuanAs, dari $sumberAs",
|
|
'AS_BANK' => $bank_id
|
|
];
|
|
$action = $this->Amod->create('daftar_akuntansi', $input);
|
|
} else if ($id_perkiraan==8) {
|
|
$datPph = $this->Amod->getData_PajakPenghasilan_byID($id_pph);
|
|
$kode_pph = $datPph[0]['KODE_PPH'];
|
|
if ($jenis_dpp==1) {
|
|
$datPenjualan = $this->Amod->getData_Penjualan_byID($id_penjualan);
|
|
$inv = $datPenjualan[0]['INV_PENJUALAN'];
|
|
$nama_pelanggan = $datPenjualan[0]['NAMA_PELANGGAN'];
|
|
$corp_id = $datPenjualan[0]['KOP_ID'];
|
|
|
|
$input = [
|
|
'PPH_ID' => $id_pph,
|
|
'PEN_ID' => $id_penjualan,
|
|
'CORP_ID' => $corp_id,
|
|
];
|
|
$action = $this->Amod->create('pajak_dibayardimuka', $input);
|
|
|
|
$id_pdd = $this->Amod->getMax_ID_PajakDibayarDimuka();
|
|
$id_pdd = $id_pdd[0]['ID_PDD'];
|
|
|
|
$nilai_pph = $datPph[0]['NILAI_PPH'];
|
|
$ket_new = "PPH PASAL $kode_pph $nilai_pph - $inv a/n $nama_pelanggan";
|
|
|
|
if ($id_bank!=null) {
|
|
$input = [
|
|
'AKUNTANSI_ID' => $id_akuntansi,
|
|
'PERKIRAAN_ID' => $id_perkiraan,
|
|
'CIPTA_DAK' => "Oleh $panggilan pada $timestamp",
|
|
'JENIS_DAK' => '2',
|
|
'DEBET_DAK' => $nilai_dak,
|
|
'KREDIT_DAK' => '0',
|
|
'KET_DAK' => $ket_new,
|
|
'PDD_ID' => $id_pdd,
|
|
'BANK_ID' => $id_bank
|
|
];
|
|
$action = $this->Amod->create('daftar_akuntansi', $input);
|
|
} else if ($id_kas!=null) {
|
|
$input = [
|
|
'AKUNTANSI_ID' => $id_akuntansi,
|
|
'PERKIRAAN_ID' => $id_perkiraan,
|
|
'CIPTA_DAK' => "Oleh $panggilan pada $timestamp",
|
|
'JENIS_DAK' => '2',
|
|
'DEBET_DAK' => $nilai_dak,
|
|
'KREDIT_DAK' => '0',
|
|
'KET_DAK' => $ket_new,
|
|
'PDD_ID' => $id_pdd,
|
|
'KAS_ID' => $id_kas
|
|
];
|
|
$action = $this->Amod->create('daftar_akuntansi', $input);
|
|
}
|
|
|
|
$id_dak = $this->Amod->getMax_ID_DaftarAkuntansi();
|
|
$id_dak = $id_dak[0]['ID_DAK'];
|
|
|
|
$update = [
|
|
'DAK_ID' => $id_dak
|
|
];
|
|
$action = $this->Amod->update('pajak_dibayardimuka', $update, 'ID_PDD', $id_pdd);
|
|
} else if ($jenis_dpp==2) {
|
|
$input = [
|
|
'PPH_ID' => $id_pph,
|
|
'CORP_ID' => $id_corp,
|
|
];
|
|
$action = $this->Amod->create('pajak_dibayardimuka', $input);
|
|
|
|
$id_pdd = $this->Amod->getMax_ID_PajakDibayarDimuka();
|
|
$id_pdd = $id_pdd[0]['ID_PDD'];
|
|
|
|
$nama_corp = $this->Amod->generate_inisialCorp($id_corp);
|
|
$ket_new = "PPH PASAL $kode_pph a/n $nama_corp";
|
|
|
|
if ($id_bank!=null) {
|
|
$input = [
|
|
'AKUNTANSI_ID' => $id_akuntansi,
|
|
'PERKIRAAN_ID' => $id_perkiraan,
|
|
'CIPTA_DAK' => "Oleh $panggilan pada $timestamp",
|
|
'JENIS_DAK' => '2',
|
|
'DEBET_DAK' => $nilai_dak,
|
|
'KREDIT_DAK' => '0',
|
|
'KET_DAK' => $ket_new,
|
|
'PDD_ID' => $id_pdd,
|
|
'BANK_ID' => $id_bank,
|
|
];
|
|
$action = $this->Amod->create('daftar_akuntansi', $input);
|
|
} else if ($id_kas!=null) {
|
|
$input = [
|
|
'AKUNTANSI_ID' => $id_akuntansi,
|
|
'PERKIRAAN_ID' => $id_perkiraan,
|
|
'CIPTA_DAK' => "Oleh $panggilan pada $timestamp",
|
|
'JENIS_DAK' => '2',
|
|
'DEBET_DAK' => $nilai_dak,
|
|
'KREDIT_DAK' => '0',
|
|
'KET_DAK' => $ket_new,
|
|
'PDD_ID' => $id_pdd,
|
|
'KAS_ID' => $id_kas,
|
|
];
|
|
$action = $this->Amod->create('daftar_akuntansi', $input);
|
|
}
|
|
|
|
$id_dak = $this->Amod->getMax_ID_DaftarAkuntansi();
|
|
$id_dak = $id_dak[0]['ID_DAK'];
|
|
|
|
$update = [
|
|
'DAK_ID' => $id_dak
|
|
];
|
|
$action = $this->Amod->update('pajak_dibayardimuka', $update, 'ID_PDD', $id_pdd);
|
|
}
|
|
} else if ($id_perkiraan==19) {
|
|
if ($jenis_um==1 OR $jenis_um==2) {
|
|
//Buat Uang Muka
|
|
$input = [
|
|
'JENIS_UM' => $jenis_um,
|
|
'KODE_UM' => $kode_um,
|
|
'NILAI_UM' => $nilai_dak,
|
|
'KWITANSI_ID' => $id_kwitansi,
|
|
'NB_ID' => $id_nb,
|
|
'PEL_ID' => $pelanggan_id,
|
|
'STATUS_UM' => '0'
|
|
];
|
|
$action = $this->Amod->create('uang_muka', $input);
|
|
|
|
$id_um = $this->Amod->getMax_ID_UangMuka();
|
|
$id_um = $id_um[0]['ID_UM'];
|
|
|
|
//Buat Akun DP Penjualan
|
|
if ($id_bank!=null) {
|
|
$input = [
|
|
'AKUNTANSI_ID' => $id_akuntansi,
|
|
'PERKIRAAN_ID' => $id_perkiraan,
|
|
'CIPTA_DAK' => "Oleh $panggilan pada $timestamp",
|
|
'JENIS_DAK' => '2',
|
|
'DEBET_DAK' => '0',
|
|
'KREDIT_DAK' => $nilai_dppUm,
|
|
'KET_DAK' => $ket_dak,
|
|
'UM_ID' => $id_um,
|
|
'PELANGGAN_ID' => $pelanggan_id,
|
|
'BANK_ID' => $id_bank,
|
|
];
|
|
$action = $this->Amod->create('daftar_akuntansi', $input);
|
|
} else if ($id_kas!=null) {
|
|
$input = [
|
|
'AKUNTANSI_ID' => $id_akuntansi,
|
|
'PERKIRAAN_ID' => $id_perkiraan,
|
|
'CIPTA_DAK' => "Oleh $panggilan pada $timestamp",
|
|
'JENIS_DAK' => '2',
|
|
'DEBET_DAK' => '0',
|
|
'KREDIT_DAK' => $nilai_dppUm,
|
|
'KET_DAK' => $ket_dak,
|
|
'UM_ID' => $id_um,
|
|
'PELANGGAN_ID' => $pelanggan_id,
|
|
'KAS_ID' => $id_kas,
|
|
];
|
|
$action = $this->Amod->create('daftar_akuntansi', $input);
|
|
}
|
|
|
|
if ($jenis_um==1) {
|
|
//Ubah Link Kasbank di Kwitansi
|
|
$update = [
|
|
'KASBANK_KWITANSI' => $kode_akuntansi
|
|
];
|
|
$action = $this->Amod->update('kwitansi', $update, 'ID_KWITANSI', $id_kwitansi);
|
|
} else if ($jenis_um==2) {
|
|
//Buat Akun Pajak Keluaran
|
|
if ($nilai_ppnUm>0) {
|
|
if ($id_bank!=null) {
|
|
$input = [
|
|
'AKUNTANSI_ID' => $id_akuntansi,
|
|
'PERKIRAAN_ID' => '83',
|
|
'CIPTA_DAK' => "Oleh $panggilan pada $timestamp",
|
|
'JENIS_DAK' => '2',
|
|
'DEBET_DAK' => '0',
|
|
'KREDIT_DAK' => $nilai_ppnUm,
|
|
'KET_DAK' => "Pajak Keluaran DP Kode : [$kode_um]",
|
|
'UM_ID' => $id_um,
|
|
'PELANGGAN_ID' => $pelanggan_id,
|
|
'BANK_ID' => $id_bank,
|
|
];
|
|
$action = $this->Amod->create('daftar_akuntansi', $input);
|
|
} else if ($id_kas!=null) {
|
|
$input = [
|
|
'AKUNTANSI_ID' => $id_akuntansi,
|
|
'PERKIRAAN_ID' => '83',
|
|
'CIPTA_DAK' => "Oleh $panggilan pada $timestamp",
|
|
'JENIS_DAK' => '2',
|
|
'DEBET_DAK' => '0',
|
|
'KREDIT_DAK' => $nilai_ppnUm,
|
|
'KET_DAK' => "Pajak Keluaran DP Kode : [$kode_um]",
|
|
'UM_ID' => $id_um,
|
|
'PELANGGAN_ID' => $pelanggan_id,
|
|
'KAS_ID' => $id_kas,
|
|
];
|
|
$action = $this->Amod->create('daftar_akuntansi', $input);
|
|
}
|
|
}
|
|
|
|
//Buat Akun Pajak Dibayar Dimuka
|
|
if ($id_pph!=NULL OR $id_pph!="") {
|
|
$kode_pph = $datPph[0]['KODE_PPH'];
|
|
$nilai_pph = $datPph[0]['NILAI_PPH'];
|
|
$ket_new1 = "PPH PASAL $kode_pph $nilai_pph - $kode_um a/n $nama_pelanggan";
|
|
$ket_new2 = "Pembayaran PPH PASAL $kode_pph $nilai_pph - $kode_um a/n $nama_pelanggan";
|
|
|
|
$input = [
|
|
'PPH_ID' => $id_pph,
|
|
'UM_ID' => $id_um,
|
|
'CORP_ID' => $corp_id,
|
|
];
|
|
$action = $this->Amod->create('pajak_dibayardimuka', $input);
|
|
|
|
$id_pdd = $this->Amod->getMax_ID_PajakDibayarDimuka();
|
|
$id_pdd = $id_pdd[0]['ID_PDD'];
|
|
|
|
if ($id_bank!=null) {
|
|
$input = [
|
|
'AKUNTANSI_ID' => $id_akuntansi,
|
|
'PERKIRAAN_ID' => '8',
|
|
'CIPTA_DAK' => "Oleh $panggilan pada $timestamp",
|
|
'JENIS_DAK' => '2',
|
|
'DEBET_DAK' => $nilai_pphum,
|
|
'KREDIT_DAK' => '0',
|
|
'KET_DAK' => $ket_new1,
|
|
'PDD_ID' => $id_pdd,
|
|
'UM_ID' => $id_um,
|
|
'BANK_ID' => $id_bank,
|
|
];
|
|
$action = $this->Amod->create('daftar_akuntansi', $input);
|
|
} else if ($id_kas!=null) {
|
|
$input = [
|
|
'AKUNTANSI_ID' => $id_akuntansi,
|
|
'PERKIRAAN_ID' => '8',
|
|
'CIPTA_DAK' => "Oleh $panggilan pada $timestamp",
|
|
'JENIS_DAK' => '2',
|
|
'DEBET_DAK' => $nilai_pphum,
|
|
'KREDIT_DAK' => '0',
|
|
'KET_DAK' => $ket_new1,
|
|
'PDD_ID' => $id_pdd,
|
|
'UM_ID' => $id_um,
|
|
'KAS_ID' => $id_kas,
|
|
];
|
|
$action = $this->Amod->create('daftar_akuntansi', $input);
|
|
}
|
|
|
|
$id_dak = $this->Amod->getMax_ID_DaftarAkuntansi();
|
|
$id_dak = $id_dak[0]['ID_DAK'];
|
|
|
|
$update = [
|
|
'DAK_ID' => $id_dak
|
|
];
|
|
$action = $this->Amod->update('pajak_dibayardimuka', $update, 'ID_PDD', $id_pdd);
|
|
|
|
if ($id_bank!=NULL) {
|
|
$input = [
|
|
'AKUNTANSI_ID' => $id_akuntansi,
|
|
'PERKIRAAN_ID' => '2',
|
|
'CIPTA_DAK' => "Oleh $panggilan pada $timestamp",
|
|
'JENIS_DAK' => '1',
|
|
'KREDIT_DAK' => $nilai_pphum,
|
|
'DEBET_DAK' => '0',
|
|
'KET_DAK' => $ket_new2,
|
|
'UM_ID' => $id_um,
|
|
'BANK_ID' => $id_bank,
|
|
];
|
|
$action = $this->Amod->create('daftar_akuntansi', $input);
|
|
} else if ($id_kas!=NULL) {
|
|
$input = [
|
|
'AKUNTANSI_ID' => $id_akuntansi,
|
|
'PERKIRAAN_ID' => '1',
|
|
'CIPTA_DAK' => "Oleh $panggilan pada $timestamp",
|
|
'JENIS_DAK' => '1',
|
|
'KREDIT_DAK' => $nilai_pphum,
|
|
'DEBET_DAK' => '0',
|
|
'KET_DAK' => $ket_new2,
|
|
'UM_ID' => $id_um,
|
|
'KAS_ID' => $id_kas,
|
|
];
|
|
$action = $this->Amod->create('daftar_akuntansi', $input);
|
|
}
|
|
}
|
|
|
|
//Ubah Link Kasbank di Nota BEBAS
|
|
$update = [
|
|
'KASBANK_NB' => $kode_akuntansi
|
|
];
|
|
$action = $this->Amod->update('nota_bebas', $update, 'ID_NB', $id_nb);
|
|
}
|
|
} else if ($jenis_um==9) {
|
|
$datDak19 = $this->Amod->getData_DaftarAkuntansi_byPERKIRAAN_byUM_orderASC(19, $id_um);
|
|
if ($id_bank!=null) {
|
|
$input = [
|
|
'AKUNTANSI_ID' => $id_akuntansi,
|
|
'PERKIRAAN_ID' => '19',
|
|
'CIPTA_DAK' => "Oleh $panggilan pada $timestamp",
|
|
'JENIS_DAK' => '2',
|
|
'KREDIT_DAK' => '0',
|
|
'DEBET_DAK' => $datDak19[0]['KREDIT_DAK'],
|
|
'KET_DAK' => $ket_dak,
|
|
'UM_ID' => $id_um,
|
|
'PELANGGAN_ID' => $pelanggan_id,
|
|
'BANK_ID' => $id_bank,
|
|
];
|
|
$action = $this->Amod->create('daftar_akuntansi', $input);
|
|
} else if ($id_kas!=null) {
|
|
$input = [
|
|
'AKUNTANSI_ID' => $id_akuntansi,
|
|
'PERKIRAAN_ID' => '19',
|
|
'CIPTA_DAK' => "Oleh $panggilan pada $timestamp",
|
|
'JENIS_DAK' => '2',
|
|
'KREDIT_DAK' => '0',
|
|
'DEBET_DAK' => $datDak19[0]['KREDIT_DAK'],
|
|
'KET_DAK' => $ket_dak,
|
|
'UM_ID' => $id_um,
|
|
'PELANGGAN_ID' => $pelanggan_id,
|
|
'KAS_ID' => $id_kas,
|
|
];
|
|
$action = $this->Amod->create('daftar_akuntansi', $input);
|
|
}
|
|
|
|
if ($datUm[0]['JENIS_UM']==2) {
|
|
$datNb = $this->Amod->getData_NotaBebas_byUM($id_um);
|
|
if ($datNb[0]['PPN_NB']>0) {
|
|
$datDak83 = $this->Amod->getData_DaftarAkuntansi_byPERKIRAAN_byUM_orderASC(83, $id_um);
|
|
if ($id_bank!=null) {
|
|
$input = [
|
|
'AKUNTANSI_ID' => $id_akuntansi,
|
|
'PERKIRAAN_ID' => '83',
|
|
'CIPTA_DAK' => "Oleh $panggilan pada $timestamp",
|
|
'JENIS_DAK' => '2',
|
|
'KREDIT_DAK' => '0',
|
|
'DEBET_DAK' => $datDak83[0]['KREDIT_DAK'],
|
|
'KET_DAK' => "Retur Pajak Keluaran DP Kode : [$kode_um]",
|
|
'UM_ID' => $id_um,
|
|
'PELANGGAN_ID' => $pelanggan_id,
|
|
'BANK_ID' => $id_bank,
|
|
];
|
|
$action = $this->Amod->create('daftar_akuntansi', $input);
|
|
} else if ($id_kas!=null) {
|
|
$input = [
|
|
'AKUNTANSI_ID' => $id_akuntansi,
|
|
'PERKIRAAN_ID' => '83',
|
|
'CIPTA_DAK' => "Oleh $panggilan pada $timestamp",
|
|
'JENIS_DAK' => '2',
|
|
'KREDIT_DAK' => '0',
|
|
'DEBET_DAK' => $datDak83[0]['KREDIT_DAK'],
|
|
'KET_DAK' => "Retur Pajak Keluaran DP Kode : [$kode_um]",
|
|
'UM_ID' => $id_um,
|
|
'PELANGGAN_ID' => $pelanggan_id,
|
|
'KAS_ID' => $id_kas,
|
|
];
|
|
$action = $this->Amod->create('daftar_akuntansi', $input);
|
|
}
|
|
}
|
|
|
|
$datPdd = $this->Amod->getData_PajakDibayarDimuka_byUM($id_um);
|
|
if ($datPdd==TRUE) {
|
|
$datDak8 = $this->Amod->getData_DaftarAkuntansi_byPERKIRAAN_byUM_orderASC(8, $id_um);
|
|
$ket_pph = $datDak8[0]['KET_DAK'];
|
|
$ket_new1 = "Retur $ket_pph";
|
|
if ($id_bank!=null) {
|
|
$input = [
|
|
'AKUNTANSI_ID' => $id_akuntansi,
|
|
'PERKIRAAN_ID' => '8',
|
|
'CIPTA_DAK' => "Oleh $panggilan pada $timestamp",
|
|
'JENIS_DAK' => '2',
|
|
'KREDIT_DAK' => $datDak8[0]['DEBET_DAK'],
|
|
'DEBET_DAK' => '0',
|
|
'KET_DAK' => $ket_new1,
|
|
'PDD_ID' => $datPdd[0]['ID_PDD'],
|
|
'UM_ID' => $id_um,
|
|
'BANK_ID' => $id_bank,
|
|
];
|
|
$action = $this->Amod->create('daftar_akuntansi', $input);
|
|
} else if ($id_kas!=null) {
|
|
$input = [
|
|
'AKUNTANSI_ID' => $id_akuntansi,
|
|
'PERKIRAAN_ID' => '8',
|
|
'CIPTA_DAK' => "Oleh $panggilan pada $timestamp",
|
|
'JENIS_DAK' => '2',
|
|
'KREDIT_DAK' => $datDak8[0]['DEBET_DAK'],
|
|
'DEBET_DAK' => '0',
|
|
'KET_DAK' => $ket_new1,
|
|
'PDD_ID' => $datPdd[0]['ID_PDD'],
|
|
'UM_ID' => $id_um,
|
|
'KAS_ID' => $id_kas,
|
|
];
|
|
$action = $this->Amod->create('daftar_akuntansi', $input);
|
|
}
|
|
|
|
$datAsal = $this->Amod->getData_DaftarAkuntansi_byAKUNTANSI_orderASC_limit1($datDak8[0]['AKUNTANSI_ID']);
|
|
$perasal = $datAsal[0]['PERKIRAAN_ID'];
|
|
|
|
$datDakBalik = $this->Amod->getData_DaftarAkuntansi_byPERKIRAAN_byUM_orderASC($perasal, $id_um);
|
|
$ket_balik = $datDakBalik[0]['KET_DAK'];
|
|
$ket_new2 = "Retur $ket_balik";
|
|
|
|
if ($id_bank!=NULL) {
|
|
$input = [
|
|
'AKUNTANSI_ID' => $id_akuntansi,
|
|
'PERKIRAAN_ID' => '2',
|
|
'CIPTA_DAK' => "Oleh $panggilan pada $timestamp",
|
|
'JENIS_DAK' => '2',
|
|
'DEBET_DAK' => $datDakBalik[0]['KREDIT_DAK'],
|
|
'KREDIT_DAK' => '0',
|
|
'BANK_ID' => $id_bank,
|
|
'KET_DAK' => $ket_new2,
|
|
'UM_ID' => $id_um,
|
|
];
|
|
$action = $this->Amod->create('daftar_akuntansi', $input);
|
|
} else if ($id_kas!=NULL) {
|
|
$input = [
|
|
'AKUNTANSI_ID' => $id_akuntansi,
|
|
'PERKIRAAN_ID' => '1',
|
|
'CIPTA_DAK' => "Oleh $panggilan pada $timestamp",
|
|
'JENIS_DAK' => '2',
|
|
'DEBET_DAK' => $datDakBalik[0]['KREDIT_DAK'],
|
|
'KREDIT_DAK' => '0',
|
|
'KAS_ID' => $id_kas,
|
|
'KET_DAK' => $ket_new2,
|
|
'UM_ID' => $id_um,
|
|
];
|
|
$action = $this->Amod->create('daftar_akuntansi', $input);
|
|
}
|
|
|
|
$update = [
|
|
'BATAL_PDD' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('pajak_dibayardimuka', $update, 'ID_PDD', $datPdd[0]['ID_PDD']);
|
|
}
|
|
}
|
|
|
|
$update = [
|
|
'STATUS_UM' => '1'
|
|
];
|
|
$action = $this->Amod->update('uang_muka', $update, 'ID_UM', $id_um);
|
|
}
|
|
} else if ($id_fk!=null) {
|
|
if ($id_perkiraan==70) {
|
|
if ($datFk[0]['JENIS_FK']==1) {
|
|
$id_unitproyek = 2;
|
|
} else if ($datFk[0]['JENIS_FK']==2 OR $datFk[0]['JENIS_FK']==3) {
|
|
$id_unitproyek = 3;
|
|
} else if ($datFk[0]['JENIS_FK']==4) {
|
|
$id_unitproyek = 13;
|
|
}
|
|
if ($id_bank!=null) {
|
|
$input = [
|
|
'AKUNTANSI_ID' => $id_akuntansi,
|
|
'PERKIRAAN_ID' => $id_perkiraan,
|
|
'CIPTA_DAK' => "Oleh $panggilan pada $timestamp",
|
|
'JENIS_DAK' => '2',
|
|
'DEBET_DAK' => $nilai_dak,
|
|
'KREDIT_DAK' => '0',
|
|
'KET_DAK' => $ket_dak,
|
|
'FK_ID' => $id_fk,
|
|
'PROYEK_ID' => $id_proyek,
|
|
'UNITPROYEK_ID' => $id_unitproyek,
|
|
'KARYAWAN_ID' => $datFk[0]['KARYAWAN_ID'],
|
|
'KENDARAAN_ID' => '0',
|
|
'BANK_ID' => $id_bank,
|
|
];
|
|
$action = $this->Amod->create('daftar_akuntansi', $input);
|
|
} else if ($id_kas!=null) {
|
|
$input = [
|
|
'AKUNTANSI_ID' => $id_akuntansi,
|
|
'PERKIRAAN_ID' => $id_perkiraan,
|
|
'CIPTA_DAK' => "Oleh $panggilan pada $timestamp",
|
|
'JENIS_DAK' => '2',
|
|
'DEBET_DAK' => $nilai_dak,
|
|
'KREDIT_DAK' => '0',
|
|
'KET_DAK' => $ket_dak,
|
|
'FK_ID' => $id_fk,
|
|
'PROYEK_ID' => $id_proyek,
|
|
'UNITPROYEK_ID' => $id_unitproyek,
|
|
'KARYAWAN_ID' => $datFk[0]['KARYAWAN_ID'],
|
|
'KENDARAAN_ID' => '0',
|
|
'KAS_ID' => $id_kas,
|
|
];
|
|
$action = $this->Amod->create('daftar_akuntansi', $input);
|
|
}
|
|
|
|
$update = [
|
|
'STATUS_FK' => '1',
|
|
];
|
|
$action = $this->Amod->update('form_karyawan', $update, 'ID_FK', $id_fk);
|
|
} else {
|
|
if ($id_bank!=null) {
|
|
$input = [
|
|
'AKUNTANSI_ID' => $id_akuntansi,
|
|
'PERKIRAAN_ID' => $id_perkiraan,
|
|
'CIPTA_DAK' => "Oleh $panggilan pada $timestamp",
|
|
'JENIS_DAK' => '2',
|
|
'DEBET_DAK' => $nilai_dak,
|
|
'KREDIT_DAK' => '0',
|
|
'KET_DAK' => $ket_dak,
|
|
'FK_ID' => $id_fk,
|
|
'BANK_ID' => $id_bank,
|
|
];
|
|
$action = $this->Amod->create('daftar_akuntansi', $input);
|
|
} else if ($id_kas!=null) {
|
|
$input = [
|
|
'AKUNTANSI_ID' => $id_akuntansi,
|
|
'PERKIRAAN_ID' => $id_perkiraan,
|
|
'CIPTA_DAK' => "Oleh $panggilan pada $timestamp",
|
|
'JENIS_DAK' => '2',
|
|
'DEBET_DAK' => $nilai_dak,
|
|
'KREDIT_DAK' => '0',
|
|
'KET_DAK' => $ket_dak,
|
|
'FK_ID' => $id_fk,
|
|
'KAS_ID' => $id_kas,
|
|
];
|
|
$action = $this->Amod->create('daftar_akuntansi', $input);
|
|
}
|
|
|
|
$update = [
|
|
'STATUS_FK' => '1',
|
|
];
|
|
$action = $this->Amod->update('form_karyawan', $update, 'ID_FK', $id_fk);
|
|
}
|
|
}
|
|
|
|
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 KU_Simpan_Sub1_DataDaftarAkuntansiKeluar() {
|
|
$id_akuntansi = $this->input->post('id_akuntansi');
|
|
$id_perkiraan = $this->input->post('id_perkiraan');
|
|
$id_bank = $this->input->post('id_bank');
|
|
$id_kas = $this->input->post('id_kas');
|
|
$id_karyawan = $this->input->post('id_karyawan');
|
|
$id_kendaraan = $this->input->post('id_kendaraan');
|
|
$id_pihakke3 = $this->input->post('id_pihakke3');
|
|
$id_proyek = $this->input->post('id_proyek');
|
|
$id_unitproyek = $this->input->post('id_unitproyek');
|
|
$id_karyawanproyek = $this->input->post('id_karyawanproyek');
|
|
$id_kendaraanproyek = $this->input->post('id_kendaraanproyek');
|
|
$id_penjualan = $this->input->post('id_penjualan');
|
|
$id_supplier = $this->input->post('id_supplier');
|
|
$id_pembelian = $this->input->post('selectedPembelian');
|
|
$debet_dak = $this->input->post('debet_dak');
|
|
$kredit_dak = $this->input->post('kredit_dak');
|
|
$ket_dak = $this->input->post('ket_dak');
|
|
$ket_dak = preg_replace('/\R+/', " " , $ket_dak);
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
$limit = date('Y-m-01');
|
|
|
|
//Check Konsistensi Data
|
|
$value = 0;
|
|
$datAkuntansi = $this->Amod->getData_Akuntansi_byID_bySTATUS($id_akuntansi, 0);
|
|
if ($datAkuntansi==FALSE OR strtotime($datAkuntansi[0]['TGL_AKUNTANSI'])<strtotime($limit)) {
|
|
$value = 7;
|
|
} else {
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byAKUNTANSI_byPERKIRAAN_byDEBET_byKREDIT_byKET($id_akuntansi, $id_perkiraan, $debet_dak, $kredit_dak, $ket_dak);
|
|
if ($datDak==TRUE) {
|
|
$value = 6;
|
|
} else {
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byAKUNTANSI($id_akuntansi);
|
|
if ($sumDak[0]['KREDIT']==NULL) {
|
|
$sisakreditOld = 0;
|
|
} else {
|
|
$sisakreditOld = $sumDak[0]['KREDIT']-$sumDak[0]['DEBET'];
|
|
}
|
|
|
|
if ($debet_dak==0) {
|
|
$debet_dak = $sisakreditOld;
|
|
}
|
|
|
|
if ($debet_dak>$sisakreditOld) {
|
|
$value = 5;
|
|
} else {
|
|
if ($id_perkiraan==15) {
|
|
$maxHda = 0;
|
|
$jumlahPembelian = 0;
|
|
foreach ($id_pembelian as $key) {
|
|
$sumHda = $this->Amod->getSum_DaftarAkuntansi_byPEMBELIAN_byPERKIRAAN($key, 15);
|
|
$sisaHda = $sumHda[0]['KREDIT']-$sumHda[0]['DEBET'];
|
|
$maxHda = round(($maxHda+$sisaHda),2);
|
|
$jumlahPembelian++;
|
|
}
|
|
if ($debet_dak>$maxHda) {
|
|
$value = 4;
|
|
} else if ($jumlahPembelian>1 AND $debet_dak<$maxHda) {
|
|
$value = 3;
|
|
}
|
|
}
|
|
if ($value==0) {
|
|
if ($id_perkiraan==64) {
|
|
$datHhbfe = $this->Amod->getData_HasilHitungBfe_byPENJUALAN($id_penjualan);
|
|
$sisaFee = $datHhbfe[0]['KREDIT_HHBFE']-$datHhbfe[0]['DEBET_HHBFE'];
|
|
if ($debet_dak>$sisaFee) {
|
|
$value = 2;
|
|
}
|
|
}
|
|
if ($value==0) {
|
|
if ($id_perkiraan==15) {
|
|
if (count($id_pembelian)>1) {
|
|
foreach ($id_pembelian as $key) {
|
|
$sumHda = $this->Amod->getSum_DaftarAkuntansi_byPEMBELIAN_byPERKIRAAN($key, $id_perkiraan);
|
|
$sisaHda = $sumHda[0]['KREDIT']-$sumHda[0]['DEBET'];
|
|
|
|
$datPembelian = $this->Amod->getData_Pembelian_byID_bySTATUS($key, 1);
|
|
$inv_pembelian = $datPembelian[0]['INV_PENJUALAN'];
|
|
$nama_supplier = $datPembelian[0]['NAMA_SUPPLIER'];
|
|
$kop = $this->Amod->generate_inisialCorp($datPembelian[0]['CORP_ID']);
|
|
$input = [
|
|
'AKUNTANSI_ID' => $id_akuntansi,
|
|
'PERKIRAAN_ID' => $id_perkiraan,
|
|
'CIPTA_DAK' => "Oleh $panggilan pada $timestamp",
|
|
'JENIS_DAK' => '2',
|
|
'DEBET_DAK' => $sisaHda,
|
|
'KREDIT_DAK' => $kredit_dak,
|
|
'BANK_ID' => $datAkuntansi[0]['BANK_AKUNTANSI'],
|
|
'KAS_ID' => $datAkuntansi[0]['KAS_AKUNTANSI'],
|
|
'KET_DAK' => "Bayar Nota ($kop) - $inv_pembelian [a/n : $nama_supplier]",
|
|
'SUPPLIER_ID' => $datPembelian[0]['SUPPLIER_ID'],
|
|
'PEMBELIAN_ID' => $key
|
|
];
|
|
$action = $this->Amod->create('daftar_akuntansi', $input);
|
|
|
|
$this->GE_Kalkulasi_HasilHitungHda("Nilai DEBET Tambah Kasbank", $key, $sisaHda, $datAkuntansi[0]['KODE_AKUNTANSI']);
|
|
}
|
|
} else {
|
|
$datPembelian = $this->Amod->getData_Pembelian_byID_bySTATUS($id_pembelian[0], 1);
|
|
$inv_pembelian = $datPembelian[0]['INV_PEMBELIAN'];
|
|
$nama_supplier = $datPembelian[0]['NAMA_SUPPLIER'];
|
|
$kop = $this->Amod->generate_inisialCorp($datPembelian[0]['CORP_ID']);
|
|
$input = [
|
|
'AKUNTANSI_ID' => $id_akuntansi,
|
|
'PERKIRAAN_ID' => $id_perkiraan,
|
|
'CIPTA_DAK' => "Oleh $panggilan pada $timestamp",
|
|
'JENIS_DAK' => '2',
|
|
'BANK_ID' => $datAkuntansi[0]['BANK_AKUNTANSI'],
|
|
'KAS_ID' => $datAkuntansi[0]['KAS_AKUNTANSI'],
|
|
'DEBET_DAK' => $debet_dak,
|
|
'KREDIT_DAK' => $kredit_dak,
|
|
'KET_DAK' => "Bayar Nota ($kop) - $inv_pembelian [a/n : $nama_supplier]",
|
|
'SUPPLIER_ID' => $datPembelian[0]['SUPPLIER_ID'],
|
|
'PEMBELIAN_ID' => $id_pembelian[0]
|
|
];
|
|
$action = $this->Amod->create('daftar_akuntansi', $input);
|
|
|
|
$this->GE_Kalkulasi_HasilHitungHda("Nilai DEBET Tambah Kasbank", $id_pembelian[0], $debet_dak, $datAkuntansi[0]['KODE_AKUNTANSI']);
|
|
}
|
|
} else if ($id_perkiraan==1) {
|
|
if ($datAkuntansi[0]['KAS_AKUNTANSI']!=NULL) {
|
|
$datKas = $this->Amod->getData_Kas_byID($datAkuntansi[0]['KAS_AKUNTANSI']);
|
|
$sumberAs = $datKas[0]['KODE_KAS'];
|
|
} else if ($datAkuntansi[0]['BANK_AKUNTANSI']!=NULL) {
|
|
$datBank = $this->Amod->getData_Bank_byID($datAkuntansi[0]['BANK_AKUNTANSI']);
|
|
$sumberAs = $datBank[0]['KODE_BANK'];
|
|
}
|
|
|
|
$dataKas = $this->Amod->getData_Kas_byID($id_kas);
|
|
$tujuanAs = $dataKas[0]['KODE_KAS'];
|
|
|
|
$input = [
|
|
'AKUNTANSI_ID' => $id_akuntansi,
|
|
'PERKIRAAN_ID' => $id_perkiraan,
|
|
'CIPTA_DAK' => "Oleh $panggilan pada $timestamp",
|
|
'JENIS_DAK' => '2',
|
|
'BANK_ID' => $datAkuntansi[0]['BANK_AKUNTANSI'],
|
|
'KAS_ID' => $datAkuntansi[0]['KAS_AKUNTANSI'],
|
|
'DEBET_DAK' => $debet_dak,
|
|
'KREDIT_DAK' => $kredit_dak,
|
|
'KET_DAK' => "Ayat Silang u/ $tujuanAs, dari $sumberAs",
|
|
'AS_KAS' => $id_kas
|
|
];
|
|
$action = $this->Amod->create('daftar_akuntansi', $input);
|
|
} else if ($id_perkiraan==2) {
|
|
if ($datAkuntansi[0]['KAS_AKUNTANSI']!=NULL) {
|
|
$datKas = $this->Amod->getData_Kas_byID($datAkuntansi[0]['KAS_AKUNTANSI']);
|
|
$sumberAs = $datKas[0]['KODE_KAS'];
|
|
} else if ($datAkuntansi[0]['BANK_AKUNTANSI']!=NULL) {
|
|
$datBank = $this->Amod->getData_Bank_byID($datAkuntansi[0]['BANK_AKUNTANSI']);
|
|
$sumberAs = $datBank[0]['KODE_BANK'];
|
|
}
|
|
|
|
$dataBank = $this->Amod->getData_Bank_byID($id_bank);
|
|
$tujuanAs = $dataBank[0]['KODE_BANK'];
|
|
|
|
$input = [
|
|
'AKUNTANSI_ID' => $id_akuntansi,
|
|
'PERKIRAAN_ID' => $id_perkiraan,
|
|
'CIPTA_DAK' => "Oleh $panggilan pada $timestamp",
|
|
'JENIS_DAK' => '2',
|
|
'BANK_ID' => $datAkuntansi[0]['BANK_AKUNTANSI'],
|
|
'KAS_ID' => $datAkuntansi[0]['KAS_AKUNTANSI'],
|
|
'DEBET_DAK' => $debet_dak,
|
|
'KREDIT_DAK' => $kredit_dak,
|
|
'KET_DAK' => "Ayat Silang u/ $tujuanAs, dari $sumberAs",
|
|
'AS_BANK' => $id_bank
|
|
];
|
|
$action = $this->Amod->create('daftar_akuntansi', $input);
|
|
} else if ($id_perkiraan==5) {
|
|
$input = [
|
|
'AKUNTANSI_ID' => $id_akuntansi,
|
|
'PERKIRAAN_ID' => $id_perkiraan,
|
|
'CIPTA_DAK' => "Oleh $panggilan pada $timestamp",
|
|
'JENIS_DAK' => '2',
|
|
'BANK_ID' => $datAkuntansi[0]['BANK_AKUNTANSI'],
|
|
'KAS_ID' => $datAkuntansi[0]['KAS_AKUNTANSI'],
|
|
'DEBET_DAK' => $debet_dak,
|
|
'KREDIT_DAK' => $kredit_dak,
|
|
'KET_DAK' => $ket_dak,
|
|
'KARYAWAN_ID' => $id_karyawan
|
|
];
|
|
$action = $this->Amod->create('daftar_akuntansi', $input);
|
|
} else if ($id_perkiraan==6) {
|
|
$input = [
|
|
'AKUNTANSI_ID' => $id_akuntansi,
|
|
'PERKIRAAN_ID' => $id_perkiraan,
|
|
'CIPTA_DAK' => "Oleh $panggilan pada $timestamp",
|
|
'JENIS_DAK' => '2',
|
|
'BANK_ID' => $datAkuntansi[0]['BANK_AKUNTANSI'],
|
|
'KAS_ID' => $datAkuntansi[0]['KAS_AKUNTANSI'],
|
|
'DEBET_DAK' => $debet_dak,
|
|
'KREDIT_DAK' => $kredit_dak,
|
|
'KET_DAK' => $ket_dak,
|
|
'PIHAKKE3_ID' => $id_pihakke3
|
|
];
|
|
$action = $this->Amod->create('daftar_akuntansi', $input);
|
|
} else if ($id_perkiraan==7) {
|
|
$input = [
|
|
'AKUNTANSI_ID' => $id_akuntansi,
|
|
'PERKIRAAN_ID' => $id_perkiraan,
|
|
'CIPTA_DAK' => "Oleh $panggilan pada $timestamp",
|
|
'JENIS_DAK' => '2',
|
|
'BANK_ID' => $datAkuntansi[0]['BANK_AKUNTANSI'],
|
|
'KAS_ID' => $datAkuntansi[0]['KAS_AKUNTANSI'],
|
|
'DEBET_DAK' => $debet_dak,
|
|
'KREDIT_DAK' => $kredit_dak,
|
|
'KET_DAK' => $ket_dak,
|
|
'SUPPLIER_ID' => $id_supplier
|
|
];
|
|
$action = $this->Amod->create('daftar_akuntansi', $input);
|
|
|
|
$id_dak = $this->Amod->getMax_ID_DaftarAkuntansi();
|
|
$id_dak = $id_dak[0]['ID_DAK'];
|
|
|
|
$update = [
|
|
'MAIN_DPB' => $id_dak
|
|
];
|
|
$action = $this->Amod->update('daftar_akuntansi', $update, 'ID_DAK', $id_dak);
|
|
} else if ($id_perkiraan==33 OR $id_perkiraan==34) {
|
|
$input = [
|
|
'AKUNTANSI_ID' => $id_akuntansi,
|
|
'PERKIRAAN_ID' => $id_perkiraan,
|
|
'CIPTA_DAK' => "Oleh $panggilan pada $timestamp",
|
|
'JENIS_DAK' => '2',
|
|
'BANK_ID' => $datAkuntansi[0]['BANK_AKUNTANSI'],
|
|
'KAS_ID' => $datAkuntansi[0]['KAS_AKUNTANSI'],
|
|
'DEBET_DAK' => $debet_dak,
|
|
'KREDIT_DAK' => $kredit_dak,
|
|
'KET_DAK' => $ket_dak,
|
|
'KENDARAAN_ID' => $id_kendaraan
|
|
];
|
|
$action = $this->Amod->create('daftar_akuntansi', $input);
|
|
} else if ($id_perkiraan==64) {
|
|
$datSo = $this->Amod->getData_SalesOrder_byPENJUALAN($id_penjualan);
|
|
|
|
$input = [
|
|
'AKUNTANSI_ID' => $id_akuntansi,
|
|
'PERKIRAAN_ID' => $id_perkiraan,
|
|
'CIPTA_DAK' => "Oleh $panggilan pada $timestamp",
|
|
'JENIS_DAK' => '2',
|
|
'BANK_ID' => $datAkuntansi[0]['BANK_AKUNTANSI'],
|
|
'KAS_ID' => $datAkuntansi[0]['KAS_AKUNTANSI'],
|
|
'DEBET_DAK' => $debet_dak,
|
|
'KREDIT_DAK' => $kredit_dak,
|
|
'KET_DAK' => $ket_dak,
|
|
'PENJUALAN_ID' => $id_penjualan,
|
|
'PELANGGAN_ID' => $datSo[0]['PELANGGAN_ID']
|
|
];
|
|
$action = $this->Amod->create('daftar_akuntansi', $input);
|
|
|
|
$debet_hhbfe = $datHhbfe[0]['DEBET_HHBFE']+$debet_dak;
|
|
$kredit_hhbfe = $datHhbfe[0]['KREDIT_HHBFE'];
|
|
if ($debet_hhbfe==$kredit_hhbfe) {
|
|
$status_hhbfe = 1;
|
|
} else if ($debet_hhbfe>$kredit_hhbfe) {
|
|
$status_hhbfe = 2;
|
|
} else {
|
|
$status_hhbfe = 0;
|
|
}
|
|
|
|
if ($status_hhbfe==1) {
|
|
$update = [
|
|
'DEBET_HHBFE' => $debet_hhbfe,
|
|
'STATUS_HHBFE' => $status_hhbfe,
|
|
'LAST_HHBFE' => $timestamp,
|
|
'TGLLOCK_HHBFE' => date('Y-m-d'),
|
|
'LUNAS_HHBFE' => $datAkuntansi[0]['KODE_AKUNTANSI']
|
|
];
|
|
$action = $this->Amod->update('hasil_hitungbfe', $update, 'ID_HHBFE', $datHhbfe[0]['ID_HHBFE']);
|
|
} else {
|
|
$update = [
|
|
'DEBET_HHBFE' => $debet_hhbfe,
|
|
'STATUS_HHBFE' => $status_hhbfe,
|
|
'LAST_HHBFE' => $timestamp
|
|
];
|
|
$action = $this->Amod->update('hasil_hitungbfe', $update, 'ID_HHBFE', $datHhbfe[0]['ID_HHBFE']);
|
|
}
|
|
|
|
if ($status_hhbfe>0) {
|
|
$datFfp = $this->Amod->getData_FormFeePelanggan_byPENJUALAN_bySTATUS($id_penjualan, 0);
|
|
$update = [
|
|
'STATUS_FFP' => '1'
|
|
];
|
|
$action = $this->Amod->update('form_feepelanggan', $update, 'ID_FFP', $datFfp[0]['ID_FFP']);
|
|
}
|
|
} else if ($id_perkiraan==70) {
|
|
$input = [
|
|
'AKUNTANSI_ID' => $id_akuntansi,
|
|
'PERKIRAAN_ID' => $id_perkiraan,
|
|
'CIPTA_DAK' => "Oleh $panggilan pada $timestamp",
|
|
'JENIS_DAK' => '2',
|
|
'BANK_ID' => $datAkuntansi[0]['BANK_AKUNTANSI'],
|
|
'KAS_ID' => $datAkuntansi[0]['KAS_AKUNTANSI'],
|
|
'DEBET_DAK' => $debet_dak,
|
|
'KREDIT_DAK' => $kredit_dak,
|
|
'KET_DAK' => $ket_dak,
|
|
'PROYEK_ID' => $id_proyek,
|
|
'UNITPROYEK_ID' => $id_unitproyek,
|
|
'KARYAWAN_ID' => $id_karyawanproyek,
|
|
'KENDARAAN_ID' => $id_kendaraanproyek
|
|
];
|
|
$action = $this->Amod->create('daftar_akuntansi', $input);
|
|
} else {
|
|
$input = [
|
|
'AKUNTANSI_ID' => $id_akuntansi,
|
|
'PERKIRAAN_ID' => $id_perkiraan,
|
|
'CIPTA_DAK' => "Oleh $panggilan pada $timestamp",
|
|
'JENIS_DAK' => '2',
|
|
'BANK_ID' => $datAkuntansi[0]['BANK_AKUNTANSI'],
|
|
'KAS_ID' => $datAkuntansi[0]['KAS_AKUNTANSI'],
|
|
'DEBET_DAK' => $debet_dak,
|
|
'KREDIT_DAK' => $kredit_dak,
|
|
'KET_DAK' => $ket_dak
|
|
];
|
|
$action = $this->Amod->create('daftar_akuntansi', $input);
|
|
}
|
|
$value = 1;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
}
|
|
|
|
public function KU_Simpan_Sub1_DataDaftarAkuntansiMasuk() {
|
|
$id_akuntansi = $this->input->post('id_akuntansi');
|
|
$id_perkiraan = $this->input->post('id_perkiraan');
|
|
$id_karyawan = $this->input->post('id_karyawan');
|
|
$id_maindpb = $this->input->post('id_maindpb');
|
|
$id_pihakke3 = $this->input->post('id_pihakke3');
|
|
$id_pelanggan = $this->input->post('id_pelanggan');
|
|
$id_penjualan = $this->input->post('selectedPenjualan');
|
|
$debet_dak = $this->input->post('debet_dak');
|
|
$kredit_dak = $this->input->post('kredit_dak');
|
|
$ket_dak = $this->input->post('ket_dak');
|
|
$ket_dak = preg_replace('/\R+/', " " , $ket_dak);
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
$limit = date('Y-m-01');
|
|
|
|
//Check Konsistensi Data
|
|
$value = 0;
|
|
$datAkuntansi = $this->Amod->getData_Akuntansi_byID_bySTATUS($id_akuntansi, 0);
|
|
if ($datAkuntansi==FALSE OR strtotime($datAkuntansi[0]['TGL_AKUNTANSI'])<strtotime($limit)) {
|
|
$value = 9;
|
|
} else {
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byAKUNTANSI_byPERKIRAAN_byDEBET_byKREDIT_byKET($id_akuntansi, $id_perkiraan, $debet_dak, $kredit_dak, $ket_dak);
|
|
if ($datDak==TRUE) {
|
|
$value = 8;
|
|
} else {
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byAKUNTANSI($id_akuntansi);
|
|
if ($sumDak[0]['DEBET']==NULL) {
|
|
$sisadebetOld = 0;
|
|
} else {
|
|
$sisadebetOld = $sumDak[0]['DEBET']-$sumDak[0]['KREDIT'];
|
|
}
|
|
|
|
if ($kredit_dak==0) {
|
|
$kredit_dak = $sisadebetOld;
|
|
}
|
|
|
|
if ($kredit_dak>$sisadebetOld) {
|
|
$value = 7;
|
|
} else {
|
|
if ($id_perkiraan==3) {
|
|
$maxPda = 0;
|
|
$jumlahPenjualan = 0;
|
|
foreach ($id_penjualan as $key) {
|
|
$sumPda = $this->Amod->getSum_DaftarAkuntansi_byPENJUALAN_byPERKIRAAN($key, 3);
|
|
$sisaPda = $sumPda[0]['DEBET']-$sumPda[0]['KREDIT'];
|
|
$maxPda = round(($maxPda+$sisaPda),2);
|
|
$jumlahPenjualan++;
|
|
}
|
|
if ($kredit_dak>$maxPda) {
|
|
$value = 6;
|
|
} else if ($jumlahPenjualan>1 AND $kredit_dak<$maxPda) {
|
|
$value = 5;
|
|
}
|
|
}
|
|
if ($value==0) {
|
|
$sumPka = $this->Amod->getSum_DaftarAkuntansi_byKARYAWAN_byPERKIRAAN($id_karyawan, 5);
|
|
if ($sumPka[0]['DEBET']==NULL) {
|
|
$sisaPka = $kredit_dak;
|
|
} else {
|
|
$sisaPka = $sumPka[0]['DEBET']-$sumPka[0]['KREDIT'];
|
|
}
|
|
if ($kredit_dak>$sisaPka) {
|
|
$value = 4;
|
|
} else {
|
|
$sumPpk = $this->Amod->getSum_DaftarAkuntansi_byPIHAKKE3_byPERKIRAAN($id_pihakke3, 6);
|
|
if ($sumPpk[0]['DEBET']==NULL) {
|
|
$sisaPpk = $kredit_dak;
|
|
} else {
|
|
$sisaPpk = $sumPpk[0]['DEBET']-$sumPpk[0]['KREDIT'];
|
|
}
|
|
if ($kredit_dak>$sisaPpk) {
|
|
$value = 3;
|
|
} else {
|
|
$sumDpb = $this->Amod->getSum_DaftarAkuntansi_byMAINDPB($id_maindpb);
|
|
if ($sumDpb[0]['DEBET']==NULL) {
|
|
$sisaDpb = $kredit_dak;
|
|
} else {
|
|
$sisaDpb = $sumDpb[0]['DEBET']-$sumDpb[0]['KREDIT'];
|
|
}
|
|
if ($kredit_dak>$sisaDpb) {
|
|
$value = 2;
|
|
} else {
|
|
if ($id_perkiraan==3) {
|
|
if (count($id_penjualan)>1) {
|
|
foreach ($id_penjualan as $key) {
|
|
$sumPda = $this->Amod->getSum_DaftarAkuntansi_byPENJUALAN_byPERKIRAAN($key, $id_perkiraan);
|
|
$sisaPda = $sumPda[0]['DEBET']-$sumPda[0]['KREDIT'];
|
|
|
|
$datSo = $this->Amod->getData_Penjualan_byID($key);
|
|
$inv_penjualan = $datSo[0]['INV_PENJUALAN'];
|
|
$nama_pelanggan = $datSo[0]['NAMA_PELANGGAN'];
|
|
$input = [
|
|
'AKUNTANSI_ID' => $id_akuntansi,
|
|
'PERKIRAAN_ID' => $id_perkiraan,
|
|
'JENIS_PDA' => '1',
|
|
'CIPTA_DAK' => "Oleh $panggilan pada $timestamp",
|
|
'JENIS_DAK' => '2',
|
|
'BANK_ID' => $datAkuntansi[0]['BANK_AKUNTANSI'],
|
|
'KAS_ID' => $datAkuntansi[0]['KAS_AKUNTANSI'],
|
|
'DEBET_DAK' => $debet_dak,
|
|
'KREDIT_DAK' => $sisaPda,
|
|
'KET_DAK' => "Pembayaran Nota $inv_penjualan [a/n : $nama_pelanggan]",
|
|
'PELANGGAN_ID' => $datSo[0]['PEL_ID'],
|
|
'PENJUALAN_ID' => $key
|
|
];
|
|
$action = $this->Amod->create('daftar_akuntansi', $input);
|
|
|
|
$this->GE_Kalkulasi_HasilHitungPda("Nilai KREDIT Tambah Kasbank", $key, $sisaPda, $datAkuntansi[0]['KODE_AKUNTANSI']);
|
|
}
|
|
} else {
|
|
$datSo = $this->Amod->getData_Penjualan_byID($id_penjualan[0]);
|
|
$inv_penjualan = $datSo[0]['INV_PENJUALAN'];
|
|
$nama_pelanggan = $datSo[0]['NAMA_PELANGGAN'];
|
|
$input = [
|
|
'AKUNTANSI_ID' => $id_akuntansi,
|
|
'PERKIRAAN_ID' => $id_perkiraan,
|
|
'JENIS_PDA' => '1',
|
|
'CIPTA_DAK' => "Oleh $panggilan pada $timestamp",
|
|
'JENIS_DAK' => '2',
|
|
'BANK_ID' => $datAkuntansi[0]['BANK_AKUNTANSI'],
|
|
'KAS_ID' => $datAkuntansi[0]['KAS_AKUNTANSI'],
|
|
'DEBET_DAK' => $debet_dak,
|
|
'KREDIT_DAK' => $kredit_dak,
|
|
'KET_DAK' => "Pembayaran Nota $inv_penjualan [a/n : $nama_pelanggan]",
|
|
'PELANGGAN_ID' => $datSo[0]['PEL_ID'],
|
|
'PENJUALAN_ID' => $id_penjualan[0]
|
|
];
|
|
$action = $this->Amod->create('daftar_akuntansi', $input);
|
|
|
|
$this->GE_Kalkulasi_HasilHitungPda("Nilai KREDIT Tambah Kasbank", $id_penjualan[0], $kredit_dak, $datAkuntansi[0]['KODE_AKUNTANSI']);
|
|
}
|
|
} else if ($id_perkiraan==5) {
|
|
$input = [
|
|
'AKUNTANSI_ID' => $id_akuntansi,
|
|
'PERKIRAAN_ID' => $id_perkiraan,
|
|
'CIPTA_DAK' => "Oleh $panggilan pada $timestamp",
|
|
'JENIS_DAK' => '2',
|
|
'BANK_ID' => $datAkuntansi[0]['BANK_AKUNTANSI'],
|
|
'KAS_ID' => $datAkuntansi[0]['KAS_AKUNTANSI'],
|
|
'DEBET_DAK' => $debet_dak,
|
|
'KREDIT_DAK' => $kredit_dak,
|
|
'KET_DAK' => $ket_dak,
|
|
'KARYAWAN_ID' => $id_karyawan
|
|
];
|
|
$action = $this->Amod->create('daftar_akuntansi', $input);
|
|
} else if ($id_perkiraan==6) {
|
|
$input = [
|
|
'AKUNTANSI_ID' => $id_akuntansi,
|
|
'PERKIRAAN_ID' => $id_perkiraan,
|
|
'CIPTA_DAK' => "Oleh $panggilan pada $timestamp",
|
|
'JENIS_DAK' => '2',
|
|
'BANK_ID' => $datAkuntansi[0]['BANK_AKUNTANSI'],
|
|
'KAS_ID' => $datAkuntansi[0]['KAS_AKUNTANSI'],
|
|
'DEBET_DAK' => $debet_dak,
|
|
'KREDIT_DAK' => $kredit_dak,
|
|
'KET_DAK' => $ket_dak,
|
|
'PIHAKKE3_ID' => $id_pihakke3
|
|
];
|
|
$action = $this->Amod->create('daftar_akuntansi', $input);
|
|
} else if ($id_perkiraan==7) {
|
|
$dataDak = $this->Amod->getData_DaftarAkuntansi_byID($id_maindpb);
|
|
$input = [
|
|
'AKUNTANSI_ID' => $id_akuntansi,
|
|
'PERKIRAAN_ID' => $id_perkiraan,
|
|
'CIPTA_DAK' => "Oleh $panggilan pada $timestamp",
|
|
'JENIS_DAK' => '2',
|
|
'BANK_ID' => $datAkuntansi[0]['BANK_AKUNTANSI'],
|
|
'KAS_ID' => $datAkuntansi[0]['KAS_AKUNTANSI'],
|
|
'DEBET_DAK' => $debet_dak,
|
|
'KREDIT_DAK' => $kredit_dak,
|
|
'KET_DAK' => $ket_dak,
|
|
'MAIN_DPB' => $id_maindpb,
|
|
'SUPPLIER_ID' => $dataDak[0]['SUPPLIER_ID']
|
|
];
|
|
$action = $this->Amod->create('daftar_akuntansi', $input);
|
|
} else if ($id_perkiraan==19) {
|
|
$kode_um = $this->Amod->generate_kodeUangMuka();
|
|
|
|
$input = [
|
|
'JENIS_UM' => '3',
|
|
'KODE_UM' => $kode_um,
|
|
'NILAI_UM' => $kredit_dak,
|
|
'PEL_ID' => $id_pelanggan,
|
|
'STATUS_UM' => '0'
|
|
];
|
|
$action = $this->Amod->create('uang_muka', $input);
|
|
|
|
$id_um = $this->Amod->getMax_ID_UangMuka();
|
|
$id_um = $id_um[0]['ID_UM'];
|
|
|
|
$input = [
|
|
'AKUNTANSI_ID' => $id_akuntansi,
|
|
'PERKIRAAN_ID' => $id_perkiraan,
|
|
'CIPTA_DAK' => "Oleh $panggilan pada $timestamp",
|
|
'JENIS_DAK' => '2',
|
|
'BANK_ID' => $datAkuntansi[0]['BANK_AKUNTANSI'],
|
|
'KAS_ID' => $datAkuntansi[0]['KAS_AKUNTANSI'],
|
|
'DEBET_DAK' => $debet_dak,
|
|
'KREDIT_DAK' => $kredit_dak,
|
|
'KET_DAK' => $ket_dak,
|
|
'PELANGGAN_ID' => $id_pelanggan,
|
|
'UM_ID' => $id_um
|
|
];
|
|
$action = $this->Amod->create('daftar_akuntansi', $input);
|
|
} else {
|
|
$input = [
|
|
'AKUNTANSI_ID' => $id_akuntansi,
|
|
'PERKIRAAN_ID' => $id_perkiraan,
|
|
'CIPTA_DAK' => "Oleh $panggilan pada $timestamp",
|
|
'JENIS_DAK' => '2',
|
|
'BANK_ID' => $datAkuntansi[0]['BANK_AKUNTANSI'],
|
|
'KAS_ID' => $datAkuntansi[0]['KAS_AKUNTANSI'],
|
|
'DEBET_DAK' => $debet_dak,
|
|
'KREDIT_DAK' => $kredit_dak,
|
|
'KET_DAK' => $ket_dak,
|
|
];
|
|
$action = $this->Amod->create('daftar_akuntansi', $input);
|
|
}
|
|
$value = 1;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
}
|
|
|
|
public function KU_Ubah_Sub1_DataAkuntansiUmum() {
|
|
$id_akuntansi = $this->input->post('id_akuntansied');
|
|
$tgl_akuntansi = $this->input->post('tgl_akuntansied');
|
|
$debet_dak = $this->input->post('debet_daked');
|
|
$kredit_dak = $this->input->post('kredit_daked');
|
|
$ket_dak = $this->input->post('ket_daked');
|
|
$ket_dak = preg_replace('/\R+/', " " , $ket_dak);
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$limit = date('Y-m-01');
|
|
$now = date('Y-m-d');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$datAkuntansi = $this->Amod->getData_Akuntansi_byID_bySTATUS($id_akuntansi, 0);
|
|
if ($datAkuntansi==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$datPak = $this->Amod->getData_PeriodeAkuntansi_bySTATUS(0);
|
|
if (strtotime($tgl_akuntansi)>strtotime($datPak[0]['AKHIR_PAK'])) {
|
|
$this->session->set_flashdata('tgl_limitperiod', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
} else {
|
|
if (strtotime($tgl_akuntansi)<strtotime($limit)) {
|
|
$this->session->set_flashdata('tgl_diffmonth', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
} else if (strtotime($tgl_akuntansi)>strtotime($now)) {
|
|
$this->session->set_flashdata('tgl_moreday', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
}
|
|
|
|
if (strpos($datAkuntansi[0]['KODE_AKUNTANSI'],"BM")!==FALSE OR strpos($datAkuntansi[0]['KODE_AKUNTANSI'],"BK")!==FALSE) {
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byAKUNTANSI_byBANK($id_akuntansi, $datAkuntansi[0]['BANK_AKUNTANSI']);
|
|
} else if (strpos($datAkuntansi[0]['KODE_AKUNTANSI'],"KM")!==FALSE OR strpos($datAkuntansi[0]['KODE_AKUNTANSI'],"KK")!==FALSE) {
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byAKUNTANSI_byKAS($id_akuntansi, $datAkuntansi[0]['KAS_AKUNTANSI']);
|
|
}
|
|
|
|
//Set Koma menjadi titik
|
|
$debet_dak = str_replace(',', '.', $debet_dak);
|
|
$kredit_dak = str_replace(',', '.', $kredit_dak);
|
|
|
|
$cekDebet = is_numeric($debet_dak);
|
|
if ($cekDebet==FALSE) {
|
|
$debet_dak = 0;
|
|
}
|
|
|
|
$cekKredit = is_numeric($kredit_dak);
|
|
if ($cekKredit==FALSE) {
|
|
$kredit_dak = 0;
|
|
}
|
|
|
|
if ($debet_dak<0 OR $kredit_dak<0) {
|
|
$this->session->set_flashdata('less_zero', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byAKUNTANSI($id_akuntansi);
|
|
if ($sumDak[0]['DEBET']==NULL OR $sumDak[0]['KREDIT']==NULL) {
|
|
$debetOld = 0;
|
|
$kreditOld = 0;
|
|
} else {
|
|
$debetOld = $sumDak[0]['DEBET'];
|
|
$kreditOld = $sumDak[0]['KREDIT'];
|
|
}
|
|
|
|
if (strpos($datAkuntansi[0]['KODE_AKUNTANSI'],"BM")!==FALSE OR strpos($datAkuntansi[0]['KODE_AKUNTANSI'],"KM")!==FALSE) {
|
|
if ($debet_dak<$kreditOld) {
|
|
$this->session->set_flashdata('debet_less', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
} else if (strpos($datAkuntansi[0]['KODE_AKUNTANSI'],"BK")!==FALSE OR strpos($datAkuntansi[0]['KODE_AKUNTANSI'],"KK")!==FALSE) {
|
|
if ($kredit_dak<$debetOld) {
|
|
$this->session->set_flashdata('kredit_less', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
}
|
|
|
|
$update = [
|
|
'TGL_AKUNTANSI' => $tgl_akuntansi,
|
|
];
|
|
$action = $this->Amod->update('akuntansi', $update, 'ID_AKUNTANSI', $id_akuntansi);
|
|
|
|
$update = [
|
|
'CIPTA_DAK' => "Oleh $panggilan pada $timestamp",
|
|
'DEBET_DAK' => $debet_dak,
|
|
'KREDIT_DAK' => $kredit_dak,
|
|
'KET_DAK' => $ket_dak,
|
|
];
|
|
$action = $this->Amod->update('daftar_akuntansi', $update, 'ID_DAK', $datDak[0]['ID_DAK']);
|
|
|
|
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 KU_Ubah_Sub1_KeteranganDak() {
|
|
$id_akuntansi = $this->input->post('id_akuntansi');
|
|
$id_dak = $this->input->post('id_dak');
|
|
$ket_dak = $this->input->post('ket_dak');
|
|
$ket_dak = preg_replace('/\R+/', " " , $ket_dak);
|
|
$limit = date('Y-m-01');
|
|
|
|
//Check Konsistensi Data
|
|
$value = 0;
|
|
$datAkuntansi = $this->Amod->getData_Akuntansi_byID_bySTATUS($id_akuntansi, 0);
|
|
if ($datAkuntansi==FALSE OR strtotime($datAkuntansi[0]['TGL_AKUNTANSI'])<strtotime($limit)) {
|
|
$value = 3;
|
|
} else {
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byID($id_dak);
|
|
if ($datDak==FALSE) {
|
|
$value = 2;
|
|
} else {
|
|
$update = [
|
|
'KET_DAK' => $ket_dak
|
|
];
|
|
$action = $this->Amod->update('daftar_akuntansi', $update, 'ID_DAK', $id_dak);
|
|
$value = 1;
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
|
|
}
|
|
|
|
public function KU_Hapus_Sub1_DataAkuntansi() {
|
|
$id_akuntansi = $this->input->post('id_akuntansidel');
|
|
$limit = date('Y-m-01');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$datAkuntansi = $this->Amod->getData_Akuntansi_byID_bySTATUS($id_akuntansi, 0);
|
|
if ($datAkuntansi==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
if (strtotime($datAkuntansi[0]['TGL_AKUNTANSI'])<strtotime($limit)) {
|
|
$this->session->set_flashdata('tgl_diffmonth', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byAKUNTANSI($id_akuntansi);
|
|
//Cek PPH sudah link atau Belum
|
|
foreach ($datDak as $key) {
|
|
if ($key['PDD_ID']!=NULL) {
|
|
$datDrpj = $this->Amod->getData_DaftarRekapPajak_byPDD($key['PDD_ID']);
|
|
if ($datDrpj==TRUE) {
|
|
$this->session->set_flashdata('pdd_used', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
} else if ($key['UM_ID']!=NULL) {
|
|
if ($key['KREDIT_DAK']>0) {
|
|
$countUm = $this->Amod->getCount_DaftarAkuntansi_byPERKIRAAN_byUM($key['PERKIRAAN_ID'], $key['UM_ID']);
|
|
if ($countUm>1) {
|
|
$this->session->set_flashdata('um_used', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
//Proses
|
|
foreach ($datDak as $key) {
|
|
if ($key['PERKIRAAN_ID']==64 AND $key['PENJUALAN_ID']!=NULL) {
|
|
$datFfp = $this->Amod->getData_FormFeePelanggan_byPENJUALAN_bySTATUS($key['PENJUALAN_ID'], 1);
|
|
if ($datFfp==TRUE) {
|
|
$update = [
|
|
'STATUS_FFP' => '0'
|
|
];
|
|
$action = $this->Amod->update('form_feepelanggan', $update, 'ID_FFP', $datFfp[0]['ID_FFP']);
|
|
}
|
|
|
|
$datHhbfe = $this->Amod->getData_HasilHitungBfe_byPENJUALAN($key['PENJUALAN_ID']);
|
|
$debet_hhbfe = $datHhbfe[0]['DEBET_HHBFE']-$key['DEBET_DAK'];
|
|
|
|
$update = [
|
|
'DEBET_HHBFE' => $debet_hhbfe,
|
|
'STATUS_HHBFE' => '0',
|
|
'LAST_HHBFE' => $timestamp,
|
|
'TGLLOCK_HHBFE' => NULL,
|
|
'LUNAS_HHBFE' => NULL
|
|
];
|
|
$action = $this->Amod->update('hasil_hitungbfe', $update, 'ID_HHBFE', $datHhbfe[0]['ID_HHBFE']);
|
|
} else if ($key['FK_ID']!=NULL) {
|
|
$update = [
|
|
'STATUS_FK' => '0',
|
|
];
|
|
$action = $this->Amod->update('form_karyawan', $update, 'ID_FK', $key['FK_ID']);
|
|
} else if ($key['PDD_ID']!=NULL) {
|
|
$action = $this->Amod->delete('pajak_dibayardimuka', $key['PDD_ID'], 'ID_PDD');
|
|
} else if ($key['PERKIRAAN_ID']==19 AND $key['UM_ID']!=NULL) {
|
|
$countUm = $this->Amod->getCount_DaftarAkuntansi_byPERKIRAAN_byUM($key['PERKIRAAN_ID'], $key['UM_ID']);
|
|
$datUm = $this->Amod->getData_UangMuka_byID($key['UM_ID']);
|
|
if ($countUm==0) {
|
|
|
|
} else if ($countUm==1) {
|
|
if ($datUm[0]['JENIS_UM']==1) {
|
|
$update = [
|
|
'KASBANK_KWITANSI' => NULL
|
|
];
|
|
$action = $this->Amod->update('kwitansi', $update, 'ID_KWITANSI', $datUm[0]['KWITANSI_ID']);
|
|
} else if ($datUm[0]['JENIS_UM']==2) {
|
|
$update = [
|
|
'KASBANK_NB' => NULL
|
|
];
|
|
$action = $this->Amod->update('nota_bebas', $update, 'ID_NB', $datUm[0]['NB_ID']);
|
|
}
|
|
$action = $this->Amod->delete('uang_muka', $key['UM_ID'], 'ID_UM');
|
|
} else {
|
|
$update = [
|
|
'STATUS_UM' => '0'
|
|
];
|
|
$action = $this->Amod->update('uang_muka', $update, 'ID_UM', $key['UM_ID']);
|
|
}
|
|
}
|
|
|
|
if ($key['PERKIRAAN_ID']==3 AND $key['PENJUALAN_ID']!=NULL) {
|
|
$this->GE_Kalkulasi_HasilHitungPda("Nilai KREDIT Hapus Kasbank", $key['PENJUALAN_ID'], $key['KREDIT_DAK']);
|
|
} else if ($key['PERKIRAAN_ID']==15 AND $key['PEMBELIAN_ID']!=NULL) {
|
|
$this->GE_Kalkulasi_HasilHitungHda("Nilai DEBET Hapus Kasbank", $key['PEMBELIAN_ID'], $key['DEBET_DAK']);
|
|
}
|
|
$action = $this->Amod->delete('daftar_akuntansi', $key['ID_DAK'], 'ID_DAK');
|
|
}
|
|
|
|
$action = $this->Amod->delete('akuntansi', $id_akuntansi, 'ID_AKUNTANSI');
|
|
|
|
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 KU_Hapus_Sub1_DataDaftarAkuntansi() {
|
|
$id_akuntansi = $this->input->post('id_akuntansi');
|
|
$id_dak = $this->input->post('id_dak');
|
|
$limit = date('Y-m-01');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
//Check Konsistensi Data
|
|
$value = 0;
|
|
$datAkuntansi = $this->Amod->getData_Akuntansi_byID_bySTATUS($id_akuntansi, 0);
|
|
if ($datAkuntansi==FALSE OR strtotime($datAkuntansi[0]['TGL_AKUNTANSI'])<strtotime($limit)) {
|
|
$value = 4;
|
|
} else {
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byID($id_dak);
|
|
if ($datDak==FALSE) {
|
|
$value = 3;
|
|
} else {
|
|
if ($datDak[0]['PERKIRAAN_ID']==19 AND $datDak[0]['UM_ID']!=NULL) {
|
|
$countUm = $this->Amod->getCount_DaftarAkuntansi_byPERKIRAAN_byUM($datDak[0]['PERKIRAAN_ID'], $datDak[0]['UM_ID']);
|
|
if ($countUm>1) {
|
|
$value = 2;
|
|
}
|
|
}
|
|
if ($value==0) {
|
|
if ($datDak[0]['PERKIRAAN_ID']==64 AND $datDak[0]['PENJUALAN_ID']!=NULL) {
|
|
$datFfp = $this->Amod->getData_FormFeePelanggan_byPENJUALAN_bySTATUS($datDak[0]['PENJUALAN_ID'], 1);
|
|
if ($datFfp==TRUE) {
|
|
$update = [
|
|
'STATUS_FFP' => '0'
|
|
];
|
|
$action = $this->Amod->update('form_feepelanggan', $update, 'ID_FFP', $datFfp[0]['ID_FFP']);
|
|
}
|
|
|
|
$datHhbfe = $this->Amod->getData_HasilHitungBfe_byPENJUALAN($datDak[0]['PENJUALAN_ID']);
|
|
$debet_hhbfe = $datHhbfe[0]['DEBET_HHBFE']-$datDak[0]['DEBET_DAK'];
|
|
|
|
$update = [
|
|
'DEBET_HHBFE' => $debet_hhbfe,
|
|
'STATUS_HHBFE' => '0',
|
|
'LAST_HHBFE' => $timestamp,
|
|
'TGLLOCK_HHBFE' => NULL,
|
|
'LUNAS_HHBFE' => NULL
|
|
];
|
|
$action = $this->Amod->update('hasil_hitungbfe', $update, 'ID_HHBFE', $datHhbfe[0]['ID_HHBFE']);
|
|
}
|
|
|
|
if ($datDak[0]['PERKIRAAN_ID']==3 AND $datDak[0]['PENJUALAN_ID']!=NULL) {
|
|
$this->GE_Kalkulasi_HasilHitungPda("Nilai KREDIT Hapus Kasbank", $datDak[0]['PENJUALAN_ID'], $datDak[0]['KREDIT_DAK']);
|
|
} else if ($datDak[0]['PERKIRAAN_ID']==15 AND $datDak[0]['PEMBELIAN_ID']!=NULL) {
|
|
$this->GE_Kalkulasi_HasilHitungHda("Nilai DEBET Hapus Kasbank", $datDak[0]['PEMBELIAN_ID'], $datDak[0]['DEBET_DAK']);
|
|
} else if ($datDak[0]['PERKIRAAN_ID']==19 AND $datDak[0]['UM_ID']!=NULL) {
|
|
$action = $this->Amod->delete('uang_muka', $datDak[0]['UM_ID'], 'ID_UM');
|
|
}
|
|
|
|
$action = $this->Amod->delete('daftar_akuntansi', $id_dak, 'ID_DAK');
|
|
|
|
$value = 1;
|
|
}
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
}
|
|
|
|
public function KU_Kunci_Sub1_DataAkuntansi() {
|
|
$id_akuntansi = $this->input->post('id_akuntansi');
|
|
|
|
$datPak = $this->Amod->getData_PeriodeAkuntansi_bySTATUS(0);
|
|
|
|
//Check Konsistensi Data
|
|
$value = 0;
|
|
$datAkuntansi = $this->Amod->getData_Akuntansi_byID_bySTATUS($id_akuntansi, 0);
|
|
if ($datAkuntansi==FALSE OR strtotime($datAkuntansi[0]['TGL_AKUNTANSI'])<strtotime($datPak[0]['AWAL_PAK'])) {
|
|
$value = 3;
|
|
} else {
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byAKUNTANSI($id_akuntansi);
|
|
if ($sumDak==FALSE OR $sumDak[0]['DEBET']==NULL OR $sumDak[0]['KREDIT']==NULL OR $sumDak[0]['DEBET']!=$sumDak[0]['KREDIT']) {
|
|
$value = 2;
|
|
} else {
|
|
$update = [
|
|
'STATUS_AKUNTANSI' => '1'
|
|
];
|
|
$action = $this->Amod->update('akuntansi', $update, 'ID_AKUNTANSI', $id_akuntansi);
|
|
$value = 1;
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
|
|
}
|
|
|
|
public function KU_Buka_Sub1_DataAkuntansi() {
|
|
$id_akuntansi = $this->input->post('id_akuntansi');
|
|
|
|
$datPak = $this->Amod->getData_PeriodeAkuntansi_bySTATUS(0);
|
|
|
|
//Check Konsistensi Data
|
|
$value = 0;
|
|
$datAkuntansi = $this->Amod->getData_Akuntansi_byID_bySTATUS($id_akuntansi, 1);
|
|
if ($datAkuntansi==FALSE) {
|
|
$value = 2;
|
|
} else {
|
|
if (strtotime($datAkuntansi[0]['TGL_AKUNTANSI'])<strtotime($datPak[0]['AWAL_PAK'])) {
|
|
$value = 3;
|
|
} else {
|
|
$update = [
|
|
'STATUS_AKUNTANSI' => '0'
|
|
];
|
|
$action = $this->Amod->update('akuntansi', $update, 'ID_AKUNTANSI', $id_akuntansi);
|
|
$value = 1;
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
}
|
|
|
|
//SUBMENU AKUNTANSI - TRANSAKSI BANK
|
|
public function KU_Sub1_Bank_1() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$limit = date('Y-m-01');
|
|
$now = date('Y-m-d');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "KU", "TRANSAKSI - Bank");
|
|
$id_menu = $datShm[0]['MENU_ID'];
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$datStpos = $this->Amod->getData_SetTogglePosisi_byKARYAWAN_byMENU($id_karyawan, $id_menu);
|
|
if ($datStpos==FALSE) { $posisiToggle = 0; } else { $posisiToggle = $datStpos[0]['AKTIF_STPOS']; }
|
|
|
|
$datSkk = $this->Amod->getData_SetKasbankAktif_byKARYAWAN_byNAMA($id_karyawan, "BANK");
|
|
if ($datSkk==FALSE) {
|
|
$aktif = 0;
|
|
if ($aktif==0) {
|
|
$kode_bank = "Tidak Berhak*";
|
|
} else {
|
|
$dataBank = $this->Amod->getData_Bank_byID($aktif);
|
|
$kode_bank = $dataBank[0]['KODE_BANK'];
|
|
}
|
|
} else {
|
|
$aktif = $datSkk[0]['AKTIF_SKK'];
|
|
$dataBank = $this->Amod->getData_Bank_byID($aktif);
|
|
$kode_bank = $dataBank[0]['KODE_BANK'];
|
|
}
|
|
|
|
$datAkuntansi = $this->Amod->getData_Akuntansi_byBANK_bySTATUS_joinDak($aktif, 0);
|
|
$datBank = $this->Amod->getData_Bank_bySTATUS(1);
|
|
$datCorp = $this->Amod->getData_Corp_forPPH();
|
|
$datFk = $this->Amod->getData_FormKaryawan_ACC();
|
|
$datKas = $this->Amod->getData_Kas_bySTATUS(1);
|
|
$datKaryProyek = $this->Amod->getData_Karyawan_forAbsensi();
|
|
$datKendProyek = $this->Amod->getData_Kendaraan_bySTATUS(1);
|
|
$datKwitansi = $this->Amod->getData_Kwitansi_joinUMNull_orderDESC();
|
|
$datPelanggan = $this->Amod->getData_Pelanggan_bySTATUS(1);
|
|
$datPerkFormKaryawan = $this->Amod->getData_Perkiraan_FormLemburLuarKota();
|
|
$datPerkKeluar = $this->Amod->getData_Perkiraan_KasbankKeluarOnly();
|
|
$datPerkMasuk = $this->Amod->getData_Perkiraan_KasbankMasukOnly();
|
|
$datProyek = $this->Amod->getData_Proyek_forBerjalan();
|
|
$datUnitProyek = $this->Amod->getData_UnitProyek_bySTATUS(1);
|
|
$datPph = $this->Amod->getData_PajakPenghasilan_NotNull();
|
|
$datUm = $this->Amod->getData_UangMuka_bySTATUS(0);
|
|
|
|
$datNb = $this->Amod->getData_NotaBebas_joinUMNull_dpOnly_orderDESC();
|
|
$no = 0;
|
|
foreach ($datNb as $key) {
|
|
$sumDnb = $this->Amod->getSum_DaftarNotaBebas_byNB($key['ID_NB']);
|
|
if ($sumDnb==FALSE OR $sumDnb[0]['TOTAL']==NULL) {
|
|
$nilaiDpp = 0;
|
|
} else {
|
|
$nilaiDpp = $sumDnb[0]['TOTAL'];
|
|
}
|
|
$ppnUm = round((($key['PPN_NB']/100)*$nilaiDpp),2);
|
|
$nilaiUm = $nilaiDpp+$ppnUm;
|
|
$datNb[$no++] += ['NILAI' => number_format($nilaiUm,2)];
|
|
}
|
|
|
|
$data = array(
|
|
'sidebar' => "menu keuangan",
|
|
'navChild' => "keuangan bank",
|
|
'kode_bank' => $kode_bank,
|
|
'id_menu' => $id_menu,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil,
|
|
'posisiToggle' => $posisiToggle,
|
|
'tgl' => $now,
|
|
'aktif' => $aktif,
|
|
'akuntansi' => $datAkuntansi,
|
|
'bank' => $datBank,
|
|
'countBelum' => count($datAkuntansi),
|
|
'fk' => $datFk,
|
|
'kas' => $datKas,
|
|
'kwitansi' => $datKwitansi,
|
|
'nb' => $datNb,
|
|
'perFk' => $datPerkFormKaryawan,
|
|
'perKeluar' => $datPerkKeluar,
|
|
'perMasuk' => $datPerkMasuk,
|
|
'unitproyek' => $datUnitProyek,
|
|
'karyawanproyek' => $datKaryProyek,
|
|
'kendaraanproyek' => $datKendProyek,
|
|
'proyek' => $datProyek,
|
|
'pph' => $datPph,
|
|
'pelanggan' => $datPelanggan,
|
|
'um' => $datUm,
|
|
'corp' => $datCorp,
|
|
);
|
|
$this->load->view('proses/KU_Sub1_Bank_1', $data);
|
|
}
|
|
|
|
public function KU_Ganti_Sub1_DataBank() {
|
|
$id_bank = $this->input->post('id_bank');
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
|
|
$datSkk = $this->Amod->getData_SetKasbankAktif_byKARYAWAN_byNAMA($id_karyawan, "BANK");
|
|
if ($datSkk==FALSE) {
|
|
$input = [
|
|
'KARYAWAN_ID' => $id_karyawan,
|
|
'NAMA_SKK' => "BANK",
|
|
'AKTIF_SKK' => $id_bank,
|
|
];
|
|
$action = $this->Amod->create('set_kasbankaktif', $input);
|
|
} else {
|
|
$update = [
|
|
'AKTIF_SKK' => $id_bank
|
|
];
|
|
$action = $this->Amod->update('set_kasbankaktif', $update, 'ID_SKK', $datSkk[0]['ID_SKK']);
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => '0',
|
|
]);
|
|
}
|
|
|
|
public function KU_Ambil_Sub1_B1_DataMaster() {
|
|
$id_perkiraan = $this->input->post('id_perkiraan');
|
|
$id_akuntansi = $this->input->post('id_akuntansi');
|
|
|
|
$datAkuntansi = $this->Amod->getData_Akuntansi_byID($id_akuntansi);
|
|
|
|
if ($id_perkiraan==1) {
|
|
$data = $this->Amod->getData_Kas_bySTATUS(1);
|
|
} else if ($id_perkiraan==2) {
|
|
$data = $this->Amod->getData_Bank_notThis($datAkuntansi[0]['BANK_AKUNTANSI']);
|
|
} else if ($id_perkiraan==3) {
|
|
$data = $this->Amod->getData_DaftarAkuntansi_byPERKIRAAN_groupPENJUALAN_belumLunas($id_perkiraan);
|
|
} else if ($id_perkiraan==5) {
|
|
if (strpos($datAkuntansi[0]['KODE_AKUNTANSI'],"BK")!==FALSE) {
|
|
$data = $this->Amod->getData_Karyawan_forAkuntansi();
|
|
} else if (strpos($datAkuntansi[0]['KODE_AKUNTANSI'],"BM")!==FALSE) {
|
|
$data = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_groupKARYAWAN(5);
|
|
}
|
|
} else if ($id_perkiraan==6) {
|
|
if (strpos($datAkuntansi[0]['KODE_AKUNTANSI'],"BK")!==FALSE) {
|
|
$data = $this->Amod->getData_Pihakke3_bySTATUS(1);
|
|
} else if (strpos($datAkuntansi[0]['KODE_AKUNTANSI'],"BM")!==FALSE) {
|
|
$data = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_groupPIHAKKE3(6);
|
|
}
|
|
} else if ($id_perkiraan==7) {
|
|
if (strpos($datAkuntansi[0]['KODE_AKUNTANSI'],"BK")!==FALSE) {
|
|
$data = $this->Amod->getData_Supplier_bySTATUS(1);
|
|
} else if (strpos($datAkuntansi[0]['KODE_AKUNTANSI'],"BM")!==FALSE) {
|
|
$data = $this->Amod->getData_DaftarAkuntansi_byPERKIRAAN_groupMAINDPB_belumLunas($id_perkiraan);
|
|
}
|
|
} else if ($id_perkiraan==15) {
|
|
if (strpos($datAkuntansi[0]['KODE_AKUNTANSI'],"BK")!==FALSE) {
|
|
$data = $this->Amod->getData_DaftarAkuntansi_byPERKIRAAN_groupPEMBELIAN_belumLunas($id_perkiraan);
|
|
}
|
|
} else if ($id_perkiraan==33 OR $id_perkiraan==34) {
|
|
$data = $this->Amod->getData_Kendaraan_bySTATUS(1);
|
|
} else if ($id_perkiraan==64) {
|
|
$data = $this->Amod->getData_HasilHitungBfe_bySTATUS(0);
|
|
} else if ($id_perkiraan==70) {
|
|
$data = $this->Amod->getData_Proyek_forBerjalan();
|
|
}
|
|
|
|
$this->output_json([
|
|
'data' => $data,
|
|
]);
|
|
}
|
|
|
|
//SUBMENU AKUNTANSI - JURNAL MEMO
|
|
public function KU_Sub1_JurnalMemo_1() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$now = date('Y-m-d');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "KU", "TRANSAKSI - Jurnal Memo");
|
|
$id_menu = $datShm[0]['MENU_ID'];
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$datStpos = $this->Amod->getData_SetTogglePosisi_byKARYAWAN_byMENU($id_karyawan, $id_menu);
|
|
if ($datStpos==FALSE) { $posisiToggle = 0; } else { $posisiToggle = $datStpos[0]['AKTIF_STPOS']; }
|
|
|
|
$datAkuntansi = $this->Amod->getData_Akuntansi_JMOnly_bySTATUS_groupID(0);
|
|
$datPerkiraan = $this->Amod->getData_Perkiraan_JurnalMemoOnly();
|
|
$datDpb = $this->Amod->getData_DaftarAkuntansi_byPERKIRAAN_groupMAINDPB_belumLunas(7);
|
|
$datUm = $this->Amod->getData_UangMuka_bySTATUS(0);
|
|
$datHhbfe = $this->Amod->getData_HasilHitungBfe_bySTATUS(0);
|
|
$datKaryawan = $this->Amod->getData_Karyawan_forAkuntansi();
|
|
$datPihakke3 = $this->Amod->getData_Pihakke3_bySTATUS(1);
|
|
|
|
$datKhusus = $this->Amod->getData_DaftarAkuntansi_byKARYAWAN_bySTATUS($id_karyawan, 9);
|
|
if ($datKhusus==TRUE) {
|
|
$kode_jm = $datKhusus[0]['KODE_AKUNTANSI'];
|
|
$id_akuntansi = $datKhusus[0]['ID_AKUNTANSI'];
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byAKUNTANSI($id_akuntansi);
|
|
$debet_jm = $sumDak[0]['DEBET'];
|
|
$kredit_jm = $sumDak[0]['KREDIT'];
|
|
} else {
|
|
$kode_jm = "Kosong";
|
|
$debet_jm = 0;
|
|
$kredit_jm = 0;
|
|
$id_akuntansi = NULL;
|
|
}
|
|
|
|
//Hapus Jurnal yang masih nyantol dan berbeda Hari
|
|
$cekAkuntansi = $this->Amod->getData_Akuntansi_byKARYAWAN_bySTATUS($id_karyawan, 9);
|
|
if ($cekAkuntansi==TRUE) {
|
|
$dateCheck = substr($cekAkuntansi[0]['CIPTA_AKUNTANSI'],-19,-9);
|
|
$dateCheck = preg_split("/[\/]|[-]+/", $dateCheck);
|
|
$dateCheck = $dateCheck[2]."-".$dateCheck[1]."-".$dateCheck[0];
|
|
|
|
if (strtotime($dateCheck)<strtotime($now)) {
|
|
$cekDak = $this->Amod->getData_DaftarAkuntansi_byAKUNTANSI($cekAkuntansi[0]['ID_AKUNTANSI']);
|
|
foreach ($cekDak as $key) {
|
|
if ($key['PERKIRAAN_ID']==3) {
|
|
$this->GE_Kalkulasi_HasilHitungPda("Nilai KREDIT Hapus Kasbank", $key['PENJUALAN_ID'], $key['KREDIT_DAK']);
|
|
} else if ($key['PERKIRAAN_ID']==15) {
|
|
$this->GE_Kalkulasi_HasilHitungHda("Nilai DEBET Hapus Kasbank", $key['PEMBELIAN_ID'], $key['DEBET_DAK']);
|
|
}
|
|
}
|
|
$action = $this->Amod->delete('daftar_akuntansi', $cekAkuntansi[0]['ID_AKUNTANSI'], 'AKUNTANSI_ID');
|
|
$action = $this->Amod->delete('akuntansi', $cekAkuntansi[0]['ID_AKUNTANSI'], 'ID_AKUNTANSI');
|
|
}
|
|
}
|
|
|
|
$data = array(
|
|
'sidebar' => "menu keuangan",
|
|
'navChild' => "keuangan jurnalmemo",
|
|
'id_menu' => $id_menu,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil,
|
|
'posisiToggle' => $posisiToggle,
|
|
'tgl' => $now,
|
|
'akuntansi' => $datAkuntansi,
|
|
'jmkhusus' => $datKhusus,
|
|
'countBelum' => count($datAkuntansi),
|
|
'kode_jm' => $kode_jm,
|
|
'debet_jm' => $debet_jm,
|
|
'kredit_jm' => $kredit_jm,
|
|
'id_akuntansi' => $id_akuntansi,
|
|
'perkiraan' => $datPerkiraan,
|
|
'dpb' => $datDpb,
|
|
'um' => $datUm,
|
|
'hhbfe' => $datHhbfe,
|
|
'karyawan' => $datKaryawan,
|
|
'pihakke3' => $datPihakke3,
|
|
);
|
|
$this->load->view('proses/KU_Sub1_JurnalMemo_1', $data);
|
|
}
|
|
|
|
public function KU_Ambil_Sub1_C1_DataMasterJurnalMemoUmum() {
|
|
$jenis = $this->input->post('jenis');
|
|
$master = $this->input->post('master');
|
|
|
|
if ($jenis==1) {
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byMAINDPB($master);
|
|
$data = $this->Amod->getData_DaftarAkuntansi_bySUPPLIER_groupPEMBELIAN_belumLunas($datDak[0]['SUPPLIER_ID']);
|
|
} else if ($jenis==2) {
|
|
$datUm = $this->Amod->getData_UangMuka_byID($master);
|
|
$data = $this->Amod->getData_DaftarAkuntansi_byPELANGGAN_groupPENJUALAN_belumLunas($datUm[0]['PEL_ID']);
|
|
} else if ($jenis==3) {
|
|
$datSo = $this->Amod->getData_SalesOrder_byPENJUALAN($master);
|
|
$data = $this->Amod->getData_DaftarAkuntansi_byPELANGGAN_groupPENJUALAN_belumLunas($datSo[0]['PELANGGAN_ID']);
|
|
}
|
|
|
|
$this->output_json([
|
|
'data' => $data,
|
|
]);
|
|
}
|
|
|
|
public function KU_Ambil_Sub1_C1_DataMasterJurnalMemoKhusus() {
|
|
$id_perkiraan = $this->input->post('id_perkiraan');
|
|
|
|
if ($id_perkiraan==3) {
|
|
$data = $this->Amod->getData_DaftarAkuntansi_perkiraan3_groupPENJUALAN_belumLunas();
|
|
} else if ($id_perkiraan==15) {
|
|
$data = $this->Amod->getData_DaftarAkuntansi_perkiraan15_groupPEMBELIAN_belumLunas();
|
|
}
|
|
|
|
$this->output_json([
|
|
'data' => $data,
|
|
]);
|
|
}
|
|
|
|
public function KU_Simpan_Sub1_DataJurnalMemoUmum() {
|
|
$jenis_jurnal = $this->input->post('jenis_jurnal');
|
|
$nilai_dak = $this->input->post('nilai_dak');
|
|
$ket_dak = $this->input->post('ket_dak');
|
|
$main_dpb = $this->input->post('main_dpb');
|
|
$id_um = $this->input->post('id_um');
|
|
$id_pembelian = $this->input->post('id_pembelian');
|
|
$id_penjualan1 = $this->input->post('id_penjualan1');
|
|
$id_penjualan2 = $this->input->post('id_penjualan2');
|
|
$id_penjualan3 = $this->input->post('id_penjualan3');
|
|
$ket_dak = preg_replace('/\R+/', " " , $ket_dak);
|
|
$tgl_akuntansi = date('Y-m-d');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
|
|
if ($jenis_jurnal==1 OR $jenis_jurnal==3) {
|
|
$nilai_dak = str_replace(',', '.', $nilai_dak);
|
|
$cekNilai = is_numeric($nilai_dak);
|
|
if ($cekNilai==FALSE) {
|
|
$nilai_dak = 0;
|
|
}
|
|
|
|
if ($nilai_dak<0) {
|
|
$this->session->set_flashdata('less_zero', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
}
|
|
|
|
if ($jenis_jurnal==1) {
|
|
$sumDak1 = $this->Amod->getSum_DaftarAkuntansi_byMAINDPB($main_dpb);
|
|
if (($sumDak1[0]['DEBET']-$sumDak1[0]['KREDIT'])<$nilai_dak) {
|
|
$this->session->set_flashdata('dp_overscore', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$sumDak2 = $this->Amod->getSum_DaftarAkuntansi_byPEMBELIAN_byPERKIRAAN($id_pembelian, 15);
|
|
if (($sumDak2[0]['KREDIT']-$sumDak2[0]['DEBET'])<$nilai_dak) {
|
|
$this->session->set_flashdata('hutang_overscore', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$id_perkiraan1 = 7;
|
|
$id_perkiraan2 = 15;
|
|
$maxNilai = $sumDak1[0]['DEBET']-$sumDak1[0]['KREDIT'];
|
|
|
|
if ($nilai_dak==0) {
|
|
$nilai_dak = $maxNilai;
|
|
}
|
|
} else if ($jenis_jurnal==2) {
|
|
$datUm = $this->Amod->getData_UangMuka_byID_bySTATUS($id_um, 0);
|
|
if ($datUm==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byPENJUALAN_byPERKIRAAN($id_penjualan1, 3);
|
|
if (($sumDak[0]['DEBET']-$sumDak[0]['KREDIT'])<$datUm[0]['NILAI_UM']) {
|
|
$this->session->set_flashdata('piutang_overscore', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$id_perkiraan1 = 19;
|
|
$id_perkiraan2 = 3;
|
|
} else if ($jenis_jurnal==3) {
|
|
$datFfp = $this->Amod->getData_FormFeePelanggan_byPENJUALAN_bySTATUS($id_penjualan2, 0);
|
|
$datSo = $this->Amod->getData_SalesOrder_byPENJUALAN($id_penjualan2);
|
|
$sumDak1 = $this->Amod->getSum_DaftarAkuntansi_byPENJUALAN_byPERKIRAAN($id_penjualan2, 64);
|
|
|
|
if ($datFfp==FALSE OR $datFfp[0]['CON_FFP_K']==NULL OR $datFfp[0]['CON_FFP_P']==NULL) {
|
|
$this->session->set_flashdata('formfee_error', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
if (($datSo[0]['FEE_SO']-$sumDak1[0]['DEBET']+$sumDak1[0]['KREDIT'])<$nilai_dak) {
|
|
$this->session->set_flashdata('fee_overscore', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$sumDak2 = $this->Amod->getSum_DaftarAkuntansi_byPENJUALAN_byPERKIRAAN($id_penjualan3, 3);
|
|
if (($sumDak2[0]['DEBET']-$sumDak2[0]['KREDIT'])<$nilai_dak) {
|
|
$this->session->set_flashdata('piutang_overscore', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$id_perkiraan1 = 64;
|
|
$id_perkiraan2 = 3;
|
|
$maxNilai = $datSo[0]['FEE_SO']-$sumDak1[0]['DEBET']+$sumDak1[0]['KREDIT'];
|
|
|
|
if ($nilai_dak==0) {
|
|
$nilai_dak = $maxNilai;
|
|
}
|
|
}
|
|
|
|
$cekDak1 = $this->Amod->getData_DaftarAkuntansi_cekDak($id_perkiraan1, NULL, NULL, $ket_dak, $tgl_akuntansi);
|
|
if ($cekDak1==TRUE) {
|
|
$this->session->set_flashdata('duplicate_data', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$cekDak2 = $this->Amod->getData_DaftarAkuntansi_cekDak($id_perkiraan2, NULL, NULL, $ket_dak, $tgl_akuntansi);
|
|
if ($cekDak2==TRUE) {
|
|
$this->session->set_flashdata('duplicate_data', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$kode_akuntansi = $this->Amod->generate_kodeJurnalMemo();
|
|
|
|
$input = [
|
|
'CIPTA_AKUNTANSI' => "Oleh $panggilan pada $timestamp",
|
|
'TGL_AKUNTANSI' => $tgl_akuntansi,
|
|
'KODE_AKUNTANSI' => $kode_akuntansi,
|
|
'STATUS_AKUNTANSI' => '0',
|
|
];
|
|
$action = $this->Amod->create('akuntansi', $input);
|
|
|
|
$id_akuntansi = $this->Amod->getMax_ID_Akuntansi();
|
|
$id_akuntansi = $id_akuntansi[0]['ID_AKUNTANSI'];
|
|
|
|
if ($jenis_jurnal==1) {
|
|
$datDak1 = $this->Amod->getData_DaftarAkuntansi_byMAINDPB($main_dpb);
|
|
$datDak2 = $this->Amod->getData_DaftarAkuntansi_byPERKIRAAN_byPEMBELIAN(15, $id_pembelian);
|
|
$datPembelian = $this->Amod->getData_Pembelian_byID($id_pembelian);
|
|
$input = [
|
|
'AKUNTANSI_ID' => $id_akuntansi,
|
|
'PERKIRAAN_ID' => $id_perkiraan1,
|
|
'CIPTA_DAK' => "Oleh $panggilan pada $timestamp",
|
|
'JENIS_DAK' => '2',
|
|
'DEBET_DAK' => '0',
|
|
'KREDIT_DAK' => $nilai_dak,
|
|
'KET_DAK' => $ket_dak,
|
|
'MAIN_DPB' => $main_dpb,
|
|
'SUPPLIER_ID' => $datDak1[0]['SUPPLIER_ID'],
|
|
];
|
|
$action = $this->Amod->create('daftar_akuntansi', $input);
|
|
|
|
$input = [
|
|
'AKUNTANSI_ID' => $id_akuntansi,
|
|
'PERKIRAAN_ID' => $id_perkiraan2,
|
|
'CIPTA_DAK' => "Oleh $panggilan pada $timestamp",
|
|
'JENIS_DAK' => '2',
|
|
'DEBET_DAK' => $nilai_dak,
|
|
'KREDIT_DAK' => '0',
|
|
'KET_DAK' => $ket_dak,
|
|
'PEMBELIAN_ID' => $id_pembelian,
|
|
'SUPPLIER_ID' => $datPembelian[0]['SUPPLIER_ID'],
|
|
];
|
|
$action = $this->Amod->create('daftar_akuntansi', $input);
|
|
|
|
$this->GE_Kalkulasi_HasilHitungHda("Nilai DEBET Tambah Kasbank", $id_pembelian, $nilai_dak, $kode_akuntansi);
|
|
} else if ($jenis_jurnal==2) {
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byPERKIRAAN_byPENJUALAN(3, $id_penjualan1);
|
|
|
|
$input = [
|
|
'AKUNTANSI_ID' => $id_akuntansi,
|
|
'PERKIRAAN_ID' => $id_perkiraan2,
|
|
'CIPTA_DAK' => "Oleh $panggilan pada $timestamp",
|
|
'JENIS_DAK' => '2',
|
|
'JENIS_PDA' => '1',
|
|
'DEBET_DAK' => '0',
|
|
'KREDIT_DAK' => $datUm[0]['NILAI_UM'],
|
|
'KET_DAK' => $ket_dak,
|
|
'PENJUALAN_ID' => $id_penjualan1,
|
|
'PELANGGAN_ID' => $datDak[0]['PELANGGAN_ID'],
|
|
];
|
|
$action = $this->Amod->create('daftar_akuntansi', $input);
|
|
|
|
$this->GE_Kalkulasi_HasilHitungPda("Nilai KREDIT Tambah Kasbank", $id_penjualan1, $datUm[0]['NILAI_UM'], $kode_akuntansi);
|
|
|
|
$kode_um = $datUm[0]['KODE_UM'];
|
|
$datDakUm = $this->Amod->getData_DaftarAkuntansi_byPERKIRAAN_byUM_orderASC(83, $id_um);
|
|
if ($datDakUm==TRUE) {
|
|
$nilai_ppnUm = $datDakUm[0]['KREDIT_DAK'];
|
|
$nilai_ppnUm = $nilai_ppnUm*-1;
|
|
|
|
$input = [
|
|
'AKUNTANSI_ID' => $id_akuntansi,
|
|
'PERKIRAAN_ID' => '83',
|
|
'CIPTA_DAK' => "Oleh $panggilan pada $timestamp",
|
|
'JENIS_DAK' => '2',
|
|
'DEBET_DAK' => '0',
|
|
'KREDIT_DAK' => $nilai_ppnUm,
|
|
'KET_DAK' => "JurnalMemo Kelebihan Pajak Keluaran dari DP Kode : [$kode_um]",
|
|
'UM_ID' => $id_um,
|
|
'PELANGGAN_ID' => $datUm[0]['PEL_ID'],
|
|
];
|
|
$action = $this->Amod->create('daftar_akuntansi', $input);
|
|
} else {
|
|
$nilai_ppnUm = 0;
|
|
}
|
|
|
|
$sisaNilai = $datUm[0]['NILAI_UM']+$nilai_ppnUm;
|
|
$input = [
|
|
'AKUNTANSI_ID' => $id_akuntansi,
|
|
'PERKIRAAN_ID' => $id_perkiraan1,
|
|
'CIPTA_DAK' => "Oleh $panggilan pada $timestamp",
|
|
'JENIS_DAK' => '2',
|
|
'DEBET_DAK' => $sisaNilai,
|
|
'KREDIT_DAK' => '0',
|
|
'KET_DAK' => $ket_dak,
|
|
'UM_ID' => $id_um,
|
|
'PELANGGAN_ID' => $datUm[0]['PEL_ID'],
|
|
];
|
|
$action = $this->Amod->create('daftar_akuntansi', $input);
|
|
|
|
$update = [
|
|
'STATUS_UM' => '1'
|
|
];
|
|
$action = $this->Amod->update('uang_muka', $update, 'ID_UM', $id_um);
|
|
} else if ($jenis_jurnal==3) {
|
|
$datDak2 = $this->Amod->getData_DaftarAkuntansi_byPERKIRAAN_byPENJUALAN(3, $id_penjualan3);
|
|
$input = [
|
|
'AKUNTANSI_ID' => $id_akuntansi,
|
|
'PERKIRAAN_ID' => $id_perkiraan1,
|
|
'CIPTA_DAK' => "Oleh $panggilan pada $timestamp",
|
|
'JENIS_DAK' => '2',
|
|
'DEBET_DAK' => $nilai_dak,
|
|
'KREDIT_DAK' => '0',
|
|
'KET_DAK' => $ket_dak,
|
|
'PENJUALAN_ID' => $id_penjualan2,
|
|
'PELANGGAN_ID' => $datSo[0]['PELANGGAN_ID'],
|
|
];
|
|
$action = $this->Amod->create('daftar_akuntansi', $input);
|
|
|
|
$input = [
|
|
'AKUNTANSI_ID' => $id_akuntansi,
|
|
'PERKIRAAN_ID' => $id_perkiraan2,
|
|
'CIPTA_DAK' => "Oleh $panggilan pada $timestamp",
|
|
'JENIS_DAK' => '2',
|
|
'JENIS_PDA' => '1',
|
|
'DEBET_DAK' => '0',
|
|
'KREDIT_DAK' => $nilai_dak,
|
|
'KET_DAK' => $ket_dak,
|
|
'PENJUALAN_ID' => $id_penjualan3,
|
|
'PELANGGAN_ID' => $datDak2[0]['PELANGGAN_ID'],
|
|
];
|
|
$action = $this->Amod->create('daftar_akuntansi', $input);
|
|
|
|
$this->GE_Kalkulasi_HasilHitungPda("Nilai KREDIT Tambah Kasbank", $id_penjualan3, $nilai_dak, $kode_akuntansi);
|
|
|
|
$datHhbfe = $this->Amod->getData_HasilHitungBfe_byPENJUALAN($id_penjualan2);
|
|
$debetHhbfe = $datHhbfe[0]['DEBET_HHBFE']+$nilai_dak;
|
|
|
|
if ($datHhbfe[0]['KREDIT_HHBFE']==$debetHhbfe) {
|
|
$update = [
|
|
'DEBET_HHBFE' => $debetHhbfe,
|
|
'STATUS_HHBFE' => '1',
|
|
'LAST_HHBFE' => $timestamp,
|
|
'TGLLOCK_HHBFE' => $tgl_akuntansi,
|
|
'LUNAS_HHBFE' => $kode_akuntansi
|
|
];
|
|
$action = $this->Amod->update('hasil_hitungbfe', $update, 'ID_HHBFE', $datHhbfe[0]['ID_HHBFE']);
|
|
|
|
$update = [
|
|
'STATUS_FFP' => '1'
|
|
];
|
|
$action = $this->Amod->update('form_feepelanggan', $update, 'ID_FFP', $datFfp[0]['ID_FFP']);
|
|
} else {
|
|
if ($datHhbfe[0]['KREDIT_HHBFE']<$debetHhbfe) {
|
|
$status_hhbfe = 2;
|
|
} else {
|
|
$status_hhbfe = 0;
|
|
}
|
|
$update = [
|
|
'DEBET_HHBFE' => $debetHhbfe,
|
|
'STATUS_HHBFE' => $status_hhbfe,
|
|
'LAST_HHBFE' => $timestamp,
|
|
'TGLLOCK_HHBFE' => NULL,
|
|
'LUNAS_HHBFE' => NULL
|
|
];
|
|
$action = $this->Amod->update('hasil_hitungbfe', $update, 'ID_HHBFE', $datHhbfe[0]['ID_HHBFE']);
|
|
}
|
|
}
|
|
|
|
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 KU_Simpan_Sub1_DataJurnalMemoKhusus() {
|
|
$debet_dak = $this->input->post('debet_dak');
|
|
$kredit_dak = $this->input->post('kredit_dak');
|
|
$ket_dak = $this->input->post('ket_dak');
|
|
$tgl_akuntansi = $this->input->post('tgl_akuntansi');
|
|
$id_perkiraan = $this->input->post('id_perkiraan');
|
|
$id_pda = $this->input->post('id_pda');
|
|
$id_hda = $this->input->post('id_hda');
|
|
$id_pka = $this->input->post('id_pka');
|
|
$id_ppk = $this->input->post('id_ppk');
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
$limitDay = date('Y-m-01');
|
|
$now = date('Y-m-d');
|
|
|
|
$ket_dak = preg_replace('/\R+/', " " , $ket_dak);
|
|
$debet_dak = str_replace(',', '.', $debet_dak);
|
|
$kredit_dak = str_replace(',', '.', $kredit_dak);
|
|
|
|
if (strtotime($tgl_akuntansi)<strtotime($limitDay)) {
|
|
$this->session->set_flashdata('tgl_diffmonth', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
} else if (strtotime($tgl_akuntansi)>strtotime($now)) {
|
|
$this->session->set_flashdata('tgl_moreday', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$cekDebet = is_numeric($debet_dak);
|
|
if ($cekDebet==FALSE) {
|
|
$debet_dak = 0;
|
|
}
|
|
|
|
$cekKredit = is_numeric($kredit_dak);
|
|
if ($cekKredit==FALSE) {
|
|
$kredit_dak = 0;
|
|
}
|
|
|
|
if ($debet_dak<=0 AND $kredit_dak<=0) {
|
|
$this->session->set_flashdata('less_same_zero', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$cekDak = $this->Amod->getData_DaftarAkuntansi_cekDak($id_perkiraan, NULL, NULL, $ket_dak, $now);
|
|
if ($cekDak==TRUE) {
|
|
$this->session->set_flashdata('duplicate_data', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
if ($id_perkiraan==3) {
|
|
if ($id_pda=="") {
|
|
$this->session->set_flashdata('piutang_null', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byPENJUALAN_byPERKIRAAN($id_pda, $id_perkiraan);
|
|
if ($kredit_dak>($sumDak[0]['DEBET']-$sumDak[0]['KREDIT'])) {
|
|
$this->session->set_flashdata('piutang_overscore', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
} else if ($id_perkiraan==5) {
|
|
if ($id_pka=="") {
|
|
$this->session->set_flashdata('karyawan_null', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
} else if ($id_perkiraan==6) {
|
|
if ($id_pka=="") {
|
|
$this->session->set_flashdata('pihakke3_null', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
} else if ($id_perkiraan==15) {
|
|
if ($id_hda=="") {
|
|
$this->session->set_flashdata('hutang_null', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byPEMBELIAN_byPERKIRAAN($id_hda, $id_perkiraan);
|
|
if ($debet_dak>($sumDak[0]['KREDIT']-$sumDak[0]['DEBET'])) {
|
|
$this->session->set_flashdata('hutang_overscore', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
}
|
|
|
|
$datAkuntansi = $this->Amod->getData_Akuntansi_byKARYAWAN_bySTATUS($id_karyawan, 9);
|
|
if ($datAkuntansi==TRUE) {
|
|
$id_akuntansi = $datAkuntansi[0]['ID_AKUNTANSI'];
|
|
$kode_akuntansi = $datAkuntansi[0]['KODE_AKUNTANSI'];
|
|
} else {
|
|
$kode_akuntansi = $this->Amod->generate_kodeJurnalMemo();
|
|
|
|
$input = [
|
|
'CIPTA_AKUNTANSI' => "Oleh $panggilan pada $timestamp",
|
|
'TGL_AKUNTANSI' => $tgl_akuntansi,
|
|
'KODE_AKUNTANSI' => $kode_akuntansi,
|
|
'KARYAWAN_AKUNTANSI' => $id_karyawan,
|
|
'STATUS_AKUNTANSI' => '9',
|
|
];
|
|
$action = $this->Amod->create('akuntansi', $input);
|
|
|
|
$id_akuntansi = $this->Amod->getMax_ID_Akuntansi();
|
|
$id_akuntansi = $id_akuntansi[0]['ID_AKUNTANSI'];
|
|
}
|
|
|
|
if ($id_perkiraan==3) {
|
|
$datPenjualan = $this->Amod->getData_Penjualan_byID($id_pda);
|
|
$input = [
|
|
'AKUNTANSI_ID' => $id_akuntansi,
|
|
'PERKIRAAN_ID' => $id_perkiraan,
|
|
'CIPTA_DAK' => "Oleh $panggilan pada $timestamp",
|
|
'JENIS_DAK' => '2',
|
|
'DEBET_DAK' => $debet_dak,
|
|
'KREDIT_DAK' => $kredit_dak,
|
|
'KET_DAK' => $ket_dak,
|
|
'PELANGGAN_ID' => $datPenjualan[0]['PEL_ID'],
|
|
'PENJUALAN_ID' => $id_pda,
|
|
];
|
|
$action = $this->Amod->create('daftar_akuntansi', $input);
|
|
|
|
$this->GE_Kalkulasi_HasilHitungPda("Nilai KREDIT Tambah Kasbank", $id_pda, $kredit_dak, $kode_akuntansi);
|
|
} else if ($id_perkiraan==5) {
|
|
$input = [
|
|
'AKUNTANSI_ID' => $id_akuntansi,
|
|
'PERKIRAAN_ID' => $id_perkiraan,
|
|
'CIPTA_DAK' => "Oleh $panggilan pada $timestamp",
|
|
'JENIS_DAK' => '2',
|
|
'DEBET_DAK' => $debet_dak,
|
|
'KREDIT_DAK' => $kredit_dak,
|
|
'KET_DAK' => $ket_dak,
|
|
'KARYAWAN_ID' => $id_pka,
|
|
];
|
|
$action = $this->Amod->create('daftar_akuntansi', $input);
|
|
} else if ($id_perkiraan==6) {
|
|
$input = [
|
|
'AKUNTANSI_ID' => $id_akuntansi,
|
|
'PERKIRAAN_ID' => $id_perkiraan,
|
|
'CIPTA_DAK' => "Oleh $panggilan pada $timestamp",
|
|
'JENIS_DAK' => '2',
|
|
'DEBET_DAK' => $debet_dak,
|
|
'KREDIT_DAK' => $kredit_dak,
|
|
'KET_DAK' => $ket_dak,
|
|
'PIHAKKE3_ID' => $id_ppk,
|
|
];
|
|
$action = $this->Amod->create('daftar_akuntansi', $input);
|
|
} else if ($id_perkiraan==15) {
|
|
$datPembelian = $this->Amod->getData_Pembelian_byID_bySTATUS($id_hda, 1);
|
|
$input = [
|
|
'AKUNTANSI_ID' => $id_akuntansi,
|
|
'PERKIRAAN_ID' => $id_perkiraan,
|
|
'CIPTA_DAK' => "Oleh $panggilan pada $timestamp",
|
|
'JENIS_DAK' => '2',
|
|
'DEBET_DAK' => $debet_dak,
|
|
'KREDIT_DAK' => $kredit_dak,
|
|
'KET_DAK' => $ket_dak,
|
|
'SUPPLIER_ID' => $datPembelian[0]['SUPPLIER_ID'],
|
|
'PEMBELIAN_ID' => $id_hda,
|
|
];
|
|
$action = $this->Amod->create('daftar_akuntansi', $input);
|
|
|
|
$this->GE_Kalkulasi_HasilHitungHda("Nilai DEBET Tambah Kasbank", $id_hda, $debet_dak, $kode_akuntansi);
|
|
} else {
|
|
$input = [
|
|
'AKUNTANSI_ID' => $id_akuntansi,
|
|
'PERKIRAAN_ID' => $id_perkiraan,
|
|
'CIPTA_DAK' => "Oleh $panggilan pada $timestamp",
|
|
'JENIS_DAK' => '2',
|
|
'DEBET_DAK' => $debet_dak,
|
|
'KREDIT_DAK' => $kredit_dak,
|
|
'KET_DAK' => $ket_dak,
|
|
];
|
|
$action = $this->Amod->create('daftar_akuntansi', $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 KU_Ubah_Sub1_DataJurnalMemoKhusus() {
|
|
$id_dak = $this->input->post('id_daked');
|
|
$id_akuntansi = $this->input->post('id_akuntansied');
|
|
$ket_dak = $this->input->post('ket_daked');
|
|
$ket_dak = preg_replace('/\R+/', " " , $ket_dak);
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
$limit = date('Y-m-01');
|
|
|
|
$datAkuntansi = $this->Amod->getData_Akuntansi_byID_bySTATUS($id_akuntansi, 9);
|
|
if ($datAkuntansi==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byID($id_dak);
|
|
if ($datDak==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
if (strtotime($datAkuntansi[0]['TGL_AKUNTANSI'])<strtotime($limit)) {
|
|
$this->session->set_flashdata('tgl_diffmonth', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$update = [
|
|
'KET_DAK' => $ket_dak,
|
|
'CIPTA_DAK' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('daftar_akuntansi', $update, 'ID_DAK', $id_dak);
|
|
|
|
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 KU_Hapus_Sub1_DataJurnalMemoKhusus() {
|
|
$id_dak = $this->input->post('id_dakdel');
|
|
$limit = date('Y-m-01');
|
|
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byID($id_dak);
|
|
if ($datDak==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$id_akuntansi = $datDak[0]['AKUNTANSI_ID'];
|
|
$id_perkiraan = $datDak[0]['PERKIRAAN_ID'];
|
|
$id_pembelian = $datDak[0]['PEMBELIAN_ID'];
|
|
$id_penjualan = $datDak[0]['PENJUALAN_ID'];
|
|
$datAkuntansi = $this->Amod->getData_Akuntansi_byID_bySTATUS($id_akuntansi, 9);
|
|
if ($datAkuntansi==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
if (strtotime($datAkuntansi[0]['TGL_AKUNTANSI'])<strtotime($limit)) {
|
|
$this->session->set_flashdata('tgl_diffmonth', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
if ($id_perkiraan==3 AND $id_penjualan!=NULL) {
|
|
$this->GE_Kalkulasi_HasilHitungPda("Nilai KREDIT Hapus Kasbank", $id_penjualan, $datDak[0]['KREDIT_DAK']);
|
|
} else if ($id_perkiraan==15 AND $id_pembelian!=NULL) {
|
|
$this->GE_Kalkulasi_HasilHitungHda("Nilai DEBET Hapus Kasbank", $id_pembelian, $datDak[0]['DEBET_DAK']);
|
|
}
|
|
|
|
$action = $this->Amod->delete('daftar_akuntansi', $id_dak, 'ID_DAK');
|
|
|
|
$countDak = $this->Amod->getCount_DaftarAkuntansi_byAKUNTANSI($id_akuntansi);
|
|
if ($countDak==0) {
|
|
$action = $this->Amod->delete('akuntansi', $id_akuntansi, 'ID_AKUNTANSI');
|
|
}
|
|
|
|
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 KU_Kunci_Sub1_DataJurnalMemoKhusus() {
|
|
$id_akuntansi = $this->input->post('id_akuntansi');
|
|
$limitDay = date('Y-m-01');
|
|
|
|
$datAkuntansi = $this->Amod->getData_Akuntansi_byID_bySTATUS($id_akuntansi, 9);
|
|
if ($datAkuntansi==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
if (strtotime($datAkuntansi[0]['TGL_AKUNTANSI'])<strtotime($limitDay)) {
|
|
$this->session->set_flashdata('tgl_diffmonth', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byAKUNTANSI($id_akuntansi);
|
|
if ($sumDak[0]['DEBET']==NULL OR $sumDak[0]['KREDIT']==NULL OR $sumDak[0]['DEBET']!=$sumDak[0]['KREDIT']) {
|
|
$this->session->set_flashdata('transaksi_notbalanced', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$update = [
|
|
'STATUS_AKUNTANSI' => '1',
|
|
];
|
|
$action = $this->Amod->update('akuntansi', $update, 'ID_AKUNTANSI', $id_akuntansi);
|
|
|
|
if ($action) {
|
|
$this->session->set_flashdata('success', 'dikunci');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
} else {
|
|
$this->session->set_flashdata('failed', 'dikunci');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
}
|
|
|
|
//SUBMENU AKUNTANSI - JURNAL SISTEM
|
|
public function KU_Sub1_JurnalSistem_1() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$limit = date('Y-m-01');
|
|
$now = date('Y-m-d');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "KU", "TRANSAKSI - Jurnal Sistem");
|
|
$id_menu = $datShm[0]['MENU_ID'];
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$datStpos = $this->Amod->getData_SetTogglePosisi_byKARYAWAN_byMENU($id_karyawan, $id_menu);
|
|
if ($datStpos==FALSE) { $posisiToggle = 0; } else { $posisiToggle = $datStpos[0]['AKTIF_STPOS']; }
|
|
|
|
$datHdaPendapatan = $this->Amod->getSum_HasilHitungHda_Pendapatan(0,1000);
|
|
$datPdaBeban = $this->Amod->getSum_HasilHitungPda_BebanSelisih(0,1000);
|
|
$datAkuntansi = $this->Amod->getData_Akuntansi_JSOnly_bySTATUS_groupID(1);
|
|
|
|
$data = array(
|
|
'sidebar' => "menu keuangan",
|
|
'navChild' => "keuangan jurnalsistem",
|
|
'id_menu' => $id_menu,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil,
|
|
'posisiToggle' => $posisiToggle,
|
|
'tgl' => $now,
|
|
'hdapendapatan' => $datHdaPendapatan,
|
|
'pdabeban' => $datPdaBeban,
|
|
'akuntansi' => $datAkuntansi,
|
|
);
|
|
$this->load->view('proses/KU_Sub1_JurnalSistem_1', $data);
|
|
}
|
|
|
|
public function KU_Simpan_Sub1_DataJurnalSistem() {
|
|
$jenis_jurnal = $this->input->post('jenis_jurnal');
|
|
$penjualan_id = $this->input->post('penjualan_id');
|
|
$pembelian_id = $this->input->post('pembelian_id');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$now = date('Y-m-d');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
$thisYear = date('y');
|
|
$thisMonth = date('m');
|
|
|
|
$totalSelisih = 0;
|
|
if ($jenis_jurnal==1) {
|
|
$id_perkiraan = 15;
|
|
foreach ($pembelian_id as $key) {
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byPEMBELIAN_byPERKIRAAN($key, $id_perkiraan);
|
|
$selisih = $sumDak[0]['KREDIT']-$sumDak[0]['DEBET'];
|
|
if ($selisih<=0) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
$totalSelisih = $totalSelisih+round($selisih, 2);
|
|
}
|
|
} else if ($jenis_jurnal==2) {
|
|
$id_perkiraan = 3;
|
|
foreach ($penjualan_id as $key) {
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byPENJUALAN_byPERKIRAAN($key, $id_perkiraan);
|
|
$selisih = $sumDak[0]['DEBET']-$sumDak[0]['KREDIT'];
|
|
if ($selisih<=0) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
$totalSelisih = $totalSelisih+round($selisih, 2);
|
|
}
|
|
}
|
|
|
|
if ($jenis_jurnal==1) {
|
|
$kode_akuntansi = "JS/$thisYear/$thisMonth/00002";
|
|
} else if ($jenis_jurnal==2) {
|
|
$kode_akuntansi = "JS/$thisYear/$thisMonth/00003";
|
|
}
|
|
$datAkuntansi = $this->Amod->getData_Akuntansi_byKODE($kode_akuntansi);
|
|
$id_akuntansi = $datAkuntansi[0]['ID_AKUNTANSI'];
|
|
|
|
$datPak = $this->Amod->getData_PeriodeAkuntansi_byPERIODE($now);
|
|
if ($jenis_jurnal==1) {
|
|
foreach ($pembelian_id as $key) {
|
|
$datPembelian = $this->Amod->getData_Pembelian_byID($key);
|
|
$inv_pembelian = $datPembelian[0]['INV_PEMBELIAN'];
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byPEMBELIAN_byPERKIRAAN($key, $id_perkiraan);
|
|
$debet_dak = $sumDak[0]['KREDIT']-$sumDak[0]['DEBET'];
|
|
$ket_dak = "Jurnal Sistem u/ Koreksi Hutang - Pendapatan Diluar Usaha [$inv_pembelian]";
|
|
|
|
$input = [
|
|
'AKUNTANSI_ID' => $id_akuntansi,
|
|
'PERKIRAAN_ID' => $id_perkiraan,
|
|
'CIPTA_DAK' => "Oleh $panggilan pada $timestamp",
|
|
'JENIS_DAK' => '0',
|
|
'DEBET_DAK' => $debet_dak,
|
|
'KREDIT_DAK' => '0',
|
|
'KET_DAK' => $ket_dak,
|
|
'PEMBELIAN_ID' => $key,
|
|
'PAK_ID' => $datPak[0]['ID_PAK'],
|
|
'SUPPLIER_ID' => $datPembelian[0]['SUPPLIER_ID'],
|
|
];
|
|
$action = $this->Amod->create('daftar_akuntansi', $input);
|
|
|
|
$sumDakNew = $this->Amod->getSum_DaftarAkuntansi_byPEMBELIAN_byPERKIRAAN($key, $id_perkiraan);
|
|
$this->GE_Kalkulasi_HasilHitungHda("Nilai DEBET JurnalSistem", $key, $sumDakNew[0]['DEBET']);
|
|
}
|
|
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byAKUNTANSI($id_akuntansi);
|
|
$kreditLama = $datDak[0]['KREDIT_DAK'];
|
|
$kreditBaru = $kreditLama+$totalSelisih;
|
|
|
|
$update = [
|
|
'CIPTA_DAK' => "Oleh $panggilan pada $timestamp",
|
|
'KREDIT_DAK'=> $kreditBaru,
|
|
];
|
|
$action = $this->Amod->update('daftar_akuntansi', $update, 'ID_DAK', $datDak[0]['ID_DAK']);
|
|
} else if ($jenis_jurnal==2) {
|
|
foreach ($penjualan_id as $key) {
|
|
$datPenjualan = $this->Amod->getData_Penjualan_byID($key);
|
|
$inv_penjualan = $datPenjualan[0]['INV_PENJUALAN'];
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byPENJUALAN_byPERKIRAAN($key, $id_perkiraan);
|
|
$kredit_dak = $sumDak[0]['DEBET']-$sumDak[0]['KREDIT'];
|
|
$ket_dak = "Jurnal Sistem u/ Koreksi Piutang - Beban Selisih Nilai [$inv_penjualan]";
|
|
|
|
$input = [
|
|
'AKUNTANSI_ID' => $id_akuntansi,
|
|
'PERKIRAAN_ID' => $id_perkiraan,
|
|
'JENIS_PDA' => '1',
|
|
'CIPTA_DAK' => "Oleh $panggilan pada $timestamp",
|
|
'JENIS_DAK' => '0',
|
|
'DEBET_DAK' => '0',
|
|
'KREDIT_DAK' => $kredit_dak,
|
|
'KET_DAK' => $ket_dak,
|
|
'PENJUALAN_ID' => $key,
|
|
'PAK_ID' => $datPak[0]['ID_PAK'],
|
|
'PELANGGAN_ID' => $datPenjualan[0]['PEL_ID'],
|
|
];
|
|
$action = $this->Amod->create('daftar_akuntansi', $input);
|
|
|
|
$sumDakNew = $this->Amod->getSum_DaftarAkuntansi_byPENJUALAN_byPERKIRAAN($key, $id_perkiraan);
|
|
$this->GE_Kalkulasi_HasilHitungPda("Nilai KREDIT JurnalSistem", $key, $sumDakNew[0]['KREDIT']);
|
|
}
|
|
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byAKUNTANSI($id_akuntansi);
|
|
$debetLama = $datDak[0]['DEBET_DAK'];
|
|
$debetBaru = $debetLama+$totalSelisih;
|
|
|
|
$update = [
|
|
'CIPTA_DAK' => "Oleh $panggilan pada $timestamp",
|
|
'DEBET_DAK' => $debetBaru,
|
|
];
|
|
$action = $this->Amod->update('daftar_akuntansi', $update, 'ID_DAK', $datDak[0]['ID_DAK']);
|
|
}
|
|
|
|
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 KU_Hapus_Sub1_DataJurnalSistem() {
|
|
$id_dak = $this->input->post('id_dak');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$value = 0;
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byID($id_dak);
|
|
if ($datDak==FALSE) {
|
|
$value = 3;
|
|
} else {
|
|
$datAkuntansi = $this->Amod->getData_Akuntansi_byID_bySTATUS($datDak[0]['AKUNTANSI_ID'], 1);
|
|
if ($datAkuntansi==FALSE) {
|
|
$value = 2;
|
|
} else {
|
|
$id_perkiraan = $datDak[0]['PERKIRAAN_ID'];
|
|
$id_pembelian = $datDak[0]['PEMBELIAN_ID'];
|
|
$id_penjualan = $datDak[0]['PENJUALAN_ID'];
|
|
$ubahDak = $this->Amod->getData_DaftarAkuntansi_byAKUNTANSI($datDak[0]['AKUNTANSI_ID']);
|
|
if ($id_perkiraan==15) {
|
|
$kreditLama = $ubahDak[0]['KREDIT_DAK'];
|
|
$kreditBaru = $kreditLama-$datDak[0]['DEBET_DAK'];
|
|
$update = [
|
|
'KREDIT_DAK' => $kreditBaru,
|
|
'CIPTA_DAK' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('daftar_akuntansi', $update, 'ID_DAK', $ubahDak[0]['ID_DAK']);
|
|
|
|
$action = $this->Amod->delete('daftar_akuntansi', $id_dak, 'ID_DAK');
|
|
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byPEMBELIAN_byPERKIRAAN($id_pembelian, $id_perkiraan);
|
|
|
|
$this->GE_Kalkulasi_HasilHitungHda("Nilai DEBET JurnalSistem", $id_pembelian, $sumDak[0]['DEBET']);
|
|
} else if ($id_perkiraan==3) {
|
|
$debetLama = $ubahDak[0]['DEBET_DAK'];
|
|
$debetBaru = $debetLama-$datDak[0]['KREDIT_DAK'];
|
|
$update = [
|
|
'DEBET_DAK' => $debetBaru,
|
|
'CIPTA_DAK' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('daftar_akuntansi', $update, 'ID_DAK', $ubahDak[0]['ID_DAK']);
|
|
|
|
$action = $this->Amod->delete('daftar_akuntansi', $id_dak, 'ID_DAK');
|
|
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byPENJUALAN_byPERKIRAAN($id_penjualan, $id_perkiraan);
|
|
|
|
$this->GE_Kalkulasi_HasilHitungPda("Nilai KREDIT JurnalSistem", $id_penjualan, $sumDak[0]['KREDIT']);
|
|
}
|
|
$value = 1;
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value
|
|
]);
|
|
}
|
|
|
|
//SUBMENU PERPAJAKAN - PPH 22
|
|
public function KU_Sub2_PajakPph22_1() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$limit = date('Y-m-01');
|
|
$now = date('Y-m-d');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "KU", "PERPAJAKAN - PPH 22");
|
|
$id_menu = $datShm[0]['MENU_ID'];
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$datStpos = $this->Amod->getData_SetTogglePosisi_byKARYAWAN_byMENU($id_karyawan, $id_menu);
|
|
if ($datStpos==FALSE) { $posisiToggle = 0; } else { $posisiToggle = $datStpos[0]['AKTIF_STPOS']; }
|
|
|
|
$datStk = $this->Amod->getData_SetToggleKop_byKARYAWAN_byNAMA($id_karyawan, "KU_Sub2_PajakPph22_1");
|
|
if ($datStk==FALSE) { $kop_id = 0; } else { $kop_id = $datStk[0]['KOP_ID']; }
|
|
|
|
$datPddBelum = $this->Amod->getData_PajakDibayarDimuka_PPH22Only();
|
|
$countPilih = $this->Amod->getCount_DaftarRekapPajak_PPH22Selected();
|
|
$datWajibPajak = $this->Amod->getData_WajibPajak_bySTATUS(1);
|
|
$datCorp = $this->Amod->getData_Corp_forPPH();
|
|
$no = 0;
|
|
foreach ($datPddBelum as $key) {
|
|
if ($key['ID_DRPJ']!=NULL) {
|
|
$nilaisub = $key['DPP_DRPJ']*$key['RATE_PPH'];
|
|
$dpp = number_format($key['DPP_DRPJ'],2);
|
|
$subtotal = number_format($nilaisub,2);
|
|
} else {
|
|
$nilaisub = $key['DEBET_DAK']/$key['RATE_PPH'];
|
|
$dpp = number_format($nilaisub,2);
|
|
$subtotal = number_format($key['DEBET_DAK'],2);
|
|
}
|
|
$datPddBelum[$no] += ['DPP' => $dpp];
|
|
$datPddBelum[$no++] += ['SUBTOTAL' => $subtotal];
|
|
}
|
|
|
|
$datRpjSudah = $this->Amod->getData_RekapPajak_byCORP_byJENIS_bySTATUS($kop_id, 1, 1);
|
|
$no = 0;
|
|
foreach ($datRpjSudah as $key) {
|
|
$datDrpj = $this->Amod->getData_DaftarRekapPajak_byRPJ_DPPNotNull($key['ID_RPJ']);
|
|
$datRpjSudah[$no++] += ['DETAIL' => $datDrpj];
|
|
}
|
|
|
|
$data = array(
|
|
'sidebar' => "menu keuangan",
|
|
'navChild' => "keuangan pajakpph22",
|
|
'id_menu' => $id_menu,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil,
|
|
'posisiToggle' => $posisiToggle,
|
|
'tgl' => $now,
|
|
'pddBelum' => $datPddBelum,
|
|
'rpjSudah' => $datRpjSudah,
|
|
'countBelum' => count($datPddBelum),
|
|
'countSelesai' => count($datRpjSudah),
|
|
'countPilih' => $countPilih,
|
|
'wajibpajak' => $datWajibPajak,
|
|
'corp' => $datCorp,
|
|
'kop_id' => $kop_id,
|
|
);
|
|
$this->load->view('proses/KU_Sub2_PajakPph22_1', $data);
|
|
}
|
|
|
|
public function KU_Ganti_Sub2_Kop() {
|
|
$id_kop = $this->input->post('id_kop');
|
|
$verse = $this->input->post('verse');
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
|
|
if ($verse==1) {
|
|
$detail = "KU_Sub2_PajakPph22_1";
|
|
} else if ($verse==2) {
|
|
$detail = "KU_Sub2_PajakPph23_1";
|
|
} else if ($verse==3) {
|
|
$detail = "KU_Sub2_PajakPpn_1";
|
|
}
|
|
|
|
$datStk = $this->Amod->getData_SetToggleKop_byKARYAWAN_byNAMA($id_karyawan, $detail);
|
|
if ($datStk==FALSE) {
|
|
$input = [
|
|
'KARYAWAN_ID' => $id_karyawan,
|
|
'NAMA_STK' => $detail,
|
|
'KOP_ID' => $id_kop
|
|
];
|
|
$action = $this->Amod->create('set_togglekop', $input);
|
|
} else {
|
|
$update = [
|
|
'KOP_ID' => $id_kop
|
|
];
|
|
$action = $this->Amod->update('set_togglekop', $update, 'ID_STK', $datStk[0]['ID_STK']);
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => '0',
|
|
]);
|
|
}
|
|
|
|
public function KU_Ubah_Sub2_KeteranganPdd() {
|
|
$id_pdd = $this->input->post('id_pdd');
|
|
$ket_pdd = $this->input->post('ket_pdd');
|
|
$ket_pdd = preg_replace('/\R+/', " " , $ket_pdd);
|
|
|
|
//Check Konsistensi Data
|
|
$value = 0;
|
|
$datPdd = $this->Amod->getData_PajakDibayarDimuka_byID($id_pdd);
|
|
if ($datPdd==FALSE) {
|
|
$value = 2;
|
|
} else {
|
|
$update = [
|
|
'KET_PDD' => $ket_pdd,
|
|
];
|
|
$action = $this->Amod->update('pajak_dibayardimuka', $update, 'ID_PDD', $id_pdd);
|
|
|
|
$value = 1;
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
|
|
}
|
|
|
|
public function KU_Pilih_Sub2_A1_DataPajakDibayarDimuka() {
|
|
$id_pdd = $this->input->post('id_pddset');
|
|
|
|
$datPdd = $this->Amod->getData_PajakDibayarDimuka_byID($id_pdd);
|
|
if ($datPdd==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$datDrpj = $this->Amod->getData_DaftarRekapPajak_byPDD($id_pdd);
|
|
if ($datDrpj==TRUE) {
|
|
$this->session->set_flashdata('data_used', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$cekDrpj = $this->Amod->getData_DaftarRekapPajak_RPJNull_PPH22Only();
|
|
foreach ($cekDrpj as $key) {
|
|
if ($key['CORP_ID']!=$datPdd[0]['CORP_ID']) {
|
|
$this->session->set_flashdata('pkp_error', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
}
|
|
|
|
$dpp_drpj = round(($datPdd[0]['DEBET_DAK']/$datPdd[0]['RATE_PPH']),2);
|
|
$input = [
|
|
'DPP_DRPJ' => $dpp_drpj,
|
|
'PDD_ID' => $id_pdd,
|
|
];
|
|
$action = $this->Amod->create('daftar_rekappajak', $input);
|
|
|
|
if ($action) {
|
|
$this->session->set_flashdata('success', 'dipilih');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
} else {
|
|
$this->session->set_flashdata('failed', 'dipilih');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
}
|
|
|
|
public function KU_Ubah_Sub2_AB1_DataPajakDibayarDimuka() {
|
|
$id_drpj = $this->input->post('id_drpjed');
|
|
$dpp_drpj = $this->input->post('dpp_drpjed');
|
|
$id_pdd = $this->input->post('id_pdded');
|
|
|
|
$datDrpj = $this->Amod->getData_DaftarRekapPajak_byID($id_drpj);
|
|
if ($datDrpj==FALSE OR $datDrpj[0]['RPJ_ID']!=NULL) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$datPdd = $this->Amod->getData_PajakDibayarDimuka_byID($id_pdd);
|
|
if ($datPdd==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$dpp_drpj = str_replace(',', '.', $dpp_drpj);
|
|
$check_nilai = is_numeric($dpp_drpj);
|
|
if ($check_nilai==FALSE) {
|
|
$dpp_drpj = 0;
|
|
}
|
|
|
|
if ($dpp_drpj<=0) {
|
|
$this->session->set_flashdata('not_zero_negative', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$update = [
|
|
'DPP_DRPJ' => $dpp_drpj
|
|
];
|
|
$action = $this->Amod->update('daftar_rekappajak', $update, 'ID_DRPJ', $id_drpj);
|
|
|
|
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 KU_Reset_Sub2_DataPajakDibayarDimuka() {
|
|
$id_drpj = $this->input->post('id_drpjres');
|
|
|
|
$datDrpj = $this->Amod->getData_DaftarRekapPajak_byID($id_drpj);
|
|
if ($datDrpj==FALSE OR $datDrpj[0]['RPJ_ID']!=NULL) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$action = $this->Amod->delete('daftar_rekappajak', $id_drpj, 'ID_DRPJ');
|
|
|
|
if ($action) {
|
|
$this->session->set_flashdata('success', 'direset');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
} else {
|
|
$this->session->set_flashdata('failed', 'direset');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
}
|
|
|
|
public function KU_Proses_Sub2_A1_DataPajakDibayarDimuka() {
|
|
$id_wajibpajak = $this->input->post('id_wajibpajakpro');
|
|
$tgl_rpj = $this->input->post('tgl_rpjpro');
|
|
$ntpn_rpj = $this->input->post('ntpn_rpjpro');
|
|
$billing_rpj = $this->input->post('billing_rpjpro');
|
|
$bupot_rpj = $this->input->post('bupot_rpjpro');
|
|
$sp2d_rpj = $this->input->post('sp2d_rpjpro');
|
|
$tgl = date('Y-m-d');
|
|
|
|
if ($ntpn_rpj=="") {
|
|
$ntpn_rpj = NULL;
|
|
}
|
|
|
|
if ($billing_rpj=="") {
|
|
$billing_rpj = NULL;
|
|
}
|
|
|
|
if ($bupot_rpj=="") {
|
|
$bupot_rpj = NULL;
|
|
}
|
|
|
|
if ($sp2d_rpj=="") {
|
|
$sp2d_rpj = NULL;
|
|
}
|
|
|
|
$ntpn_rpj = strtoupper($ntpn_rpj);
|
|
$billing_rpj = strtoupper($billing_rpj);
|
|
$bupot_rpj = strtoupper($bupot_rpj);
|
|
$sp2d_rpj = strtoupper($sp2d_rpj);
|
|
|
|
if (strtotime($tgl_rpj)>strtotime($tgl)) {
|
|
$this->session->set_flashdata('date_morethan', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
if ($ntpn_rpj==NULL AND $billing_rpj==NULL AND $bupot_rpj==NULL AND $sp2d_rpj==NULL) {
|
|
$this->session->set_flashdata('minimum_one_pajak', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$datDrpj = $this->Amod->getData_DaftarRekapPajak_RPJNull_PPH22Only();
|
|
if ($datDrpj==FALSE) {
|
|
$this->session->set_flashdata('input_check', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$input = [
|
|
'JENIS_RPJ' => '1',
|
|
'STATUS_RPJ' => '1',
|
|
'WAJIBPAJAK_ID' => $id_wajibpajak,
|
|
'CORP_ID' => $datDrpj[0]['CORP_ID'],
|
|
'TGL_RPJ' => $tgl_rpj,
|
|
'NTPN_RPJ' => $ntpn_rpj,
|
|
'BILLING_RPJ' => $billing_rpj,
|
|
'BUPOT_RPJ' => $bupot_rpj,
|
|
'SP2D_RPJ' => $sp2d_rpj,
|
|
];
|
|
$action = $this->Amod->create('rekap_pajak', $input);
|
|
|
|
$id_rpj = $this->Amod->getMax_ID_RekapPajak();
|
|
$id_rpj = $id_rpj[0]['ID_RPJ'];
|
|
|
|
foreach ($datDrpj as $key) {
|
|
$update = [
|
|
'RPJ_ID' => $id_rpj
|
|
];
|
|
$action = $this->Amod->update('daftar_rekappajak', $update, 'ID_DRPJ', $key['ID_DRPJ']);
|
|
}
|
|
|
|
if ($action) {
|
|
$this->session->set_flashdata('success', 'diproses');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
} else {
|
|
$this->session->set_flashdata('failed', 'diproses');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
}
|
|
|
|
public function KU_Void_Sub2_DataPajakDibayarDimuka() {
|
|
$jenis_rpj = $this->input->post('jenis_rpj');
|
|
$void_rpj = $this->input->post('void_rpj');
|
|
$tgl = date('Y-m-d');
|
|
|
|
$void_rpj = strtoupper($void_rpj);
|
|
$void_rpj = preg_replace('/\R+/', " " , $void_rpj);
|
|
|
|
if ($jenis_rpj==1) {
|
|
$datDrpj = $this->Amod->getData_DaftarRekapPajak_RPJNull_PPH22Only();
|
|
} else if ($jenis_rpj==2) {
|
|
$datDrpj = $this->Amod->getData_DaftarRekapPajak_RPJNull_PPH23Only();
|
|
} else if ($jenis_rpj==3) {
|
|
$datDrpj = $this->Amod->getData_DaftarRekapPajak_RPJNull_PPNOnly();
|
|
}
|
|
|
|
if ($datDrpj==FALSE) {
|
|
$this->session->set_flashdata('input_check', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$input = [
|
|
'JENIS_RPJ' => $jenis_rpj,
|
|
'CORP_ID' => $datDrpj[0]['CORP_ID'],
|
|
'TGL_RPJ' => $tgl,
|
|
'STATUS_RPJ' => '0',
|
|
'VOID_RPJ' => $void_rpj,
|
|
];
|
|
$action = $this->Amod->create('rekap_pajak', $input);
|
|
|
|
$id_rpj = $this->Amod->getMax_ID_RekapPajak();
|
|
$id_rpj = $id_rpj[0]['ID_RPJ'];
|
|
|
|
foreach ($datDrpj as $key) {
|
|
$update = [
|
|
'RPJ_ID' => $id_rpj
|
|
];
|
|
$action = $this->Amod->update('daftar_rekappajak', $update, 'ID_DRPJ', $key['ID_DRPJ']);
|
|
}
|
|
|
|
if ($action) {
|
|
$this->session->set_flashdata('success', 'divoid');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
} else {
|
|
$this->session->set_flashdata('failed', 'divoid');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
}
|
|
|
|
public function KU_Ubah_Sub2_DataRekapPajak() {
|
|
$id_rpj = $this->input->post('id_rpjed');
|
|
$id_wajibpajak = $this->input->post('id_wajibpajaked');
|
|
$tgl_rpj = $this->input->post('tgl_rpjed');
|
|
$ntpn_rpj = $this->input->post('ntpn_rpjed');
|
|
$billing_rpj = $this->input->post('billing_rpjed');
|
|
$bupot_rpj = $this->input->post('bupot_rpjed');
|
|
$sp2d_rpj = $this->input->post('sp2d_rpjed');
|
|
$tgl = date('Y-m-d');
|
|
|
|
if ($ntpn_rpj=="") {
|
|
$ntpn_rpj = NULL;
|
|
}
|
|
|
|
if ($billing_rpj=="") {
|
|
$billing_rpj = NULL;
|
|
}
|
|
|
|
if ($bupot_rpj=="") {
|
|
$bupot_rpj = NULL;
|
|
}
|
|
|
|
if ($sp2d_rpj=="") {
|
|
$sp2d_rpj = NULL;
|
|
}
|
|
|
|
$ntpn_rpj = strtoupper($ntpn_rpj);
|
|
$billing_rpj = strtoupper($billing_rpj);
|
|
$bupot_rpj = strtoupper($bupot_rpj);
|
|
$sp2d_rpj = strtoupper($sp2d_rpj);
|
|
|
|
if (strtotime($tgl_rpj)>strtotime($tgl)) {
|
|
$this->session->set_flashdata('date_morethan', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
if ($ntpn_rpj==NULL AND $billing_rpj==NULL AND $bupot_rpj==NULL AND $sp2d_rpj==NULL) {
|
|
$this->session->set_flashdata('minimum_one_pajak', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$datRpj = $this->Amod->getData_RekapPajak_byID($id_rpj);
|
|
if ($datRpj==FALSE OR $datRpj[0]['STATUS_RPJ']!=1) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$update = [
|
|
'TGL_RPJ' => $tgl_rpj,
|
|
'WAJIBPAJAK_ID' => $id_wajibpajak,
|
|
'NTPN_RPJ' => $ntpn_rpj,
|
|
'BILLING_RPJ' => $billing_rpj,
|
|
'BUPOT_RPJ' => $bupot_rpj,
|
|
'SP2D_RPJ' => $sp2d_rpj
|
|
];
|
|
$action = $this->Amod->update('rekap_pajak', $update, 'ID_RPJ', $id_rpj);
|
|
|
|
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 KU_Revisi_Sub2_DataRekapPajak() {
|
|
$id_rpj = $this->input->post('id_rpjrev');
|
|
|
|
$datRpj = $this->Amod->getData_RekapPajak_byID($id_rpj);
|
|
if ($datRpj==FALSE OR $datRpj[0]['STATUS_RPJ']=="2") {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$action = $this->Amod->delete('daftar_rekappajak', $id_rpj, 'RPJ_ID');
|
|
$action = $this->Amod->delete('rekap_pajak', $id_rpj, 'ID_RPJ');
|
|
|
|
if ($action) {
|
|
$this->session->set_flashdata('success', 'direvisi');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
} else {
|
|
$this->session->set_flashdata('failed', 'direvisi');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
}
|
|
|
|
//SUBMENU PERPAJAKAN - PPH 23
|
|
public function KU_Sub2_PajakPph23_1() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$limit = date('Y-m-01');
|
|
$now = date('Y-m-d');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "KU", "PERPAJAKAN - PPH 23");
|
|
$id_menu = $datShm[0]['MENU_ID'];
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$datStpos = $this->Amod->getData_SetTogglePosisi_byKARYAWAN_byMENU($id_karyawan, $id_menu);
|
|
if ($datStpos==FALSE) { $posisiToggle = 0; } else { $posisiToggle = $datStpos[0]['AKTIF_STPOS']; }
|
|
|
|
$datStk = $this->Amod->getData_SetToggleKop_byKARYAWAN_byNAMA($id_karyawan, "KU_Sub2_PajakPph23_1");
|
|
if ($datStk==FALSE) { $kop_id = 0; } else { $kop_id = $datStk[0]['KOP_ID']; }
|
|
|
|
$datPddBelum = $this->Amod->getData_PajakDibayarDimuka_PPH23Only();
|
|
$countPilih = $this->Amod->getCount_DaftarRekapPajak_PPH23Selected();
|
|
$datWajibPajak = $this->Amod->getData_WajibPajak_bySTATUS(1);
|
|
$datCorp = $this->Amod->getData_Corp_forPPH();
|
|
$no = 0;
|
|
foreach ($datPddBelum as $key) {
|
|
if ($key['ID_DRPJ']!=NULL) {
|
|
$nilaisub = $key['DPP_DRPJ']*$key['RATE_PPH'];
|
|
$dpp = number_format($key['DPP_DRPJ'],2);
|
|
$subtotal = number_format($nilaisub,2);
|
|
} else {
|
|
$nilaisub = $key['DEBET_DAK']/$key['RATE_PPH'];
|
|
$dpp = number_format($nilaisub,2);
|
|
$subtotal = number_format($key['DEBET_DAK'],2);
|
|
}
|
|
|
|
$datPddBelum[$no] += ['DPP' => $dpp];
|
|
$datPddBelum[$no++] += ['SUBTOTAL' => $subtotal];
|
|
}
|
|
|
|
$datRpjSudah = $this->Amod->getData_RekapPajak_byCORP_byJENIS_bySTATUS($kop_id, 2, 1);
|
|
$no = 0;
|
|
foreach ($datRpjSudah as $key) {
|
|
$datDrpj = $this->Amod->getData_DaftarRekapPajak_byRPJ_DPPNotNull($key['ID_RPJ']);
|
|
$datRpjSudah[$no++] += ['DETAIL' => $datDrpj];
|
|
}
|
|
|
|
$data = array(
|
|
'sidebar' => "menu keuangan",
|
|
'navChild' => "keuangan pajakpph23",
|
|
'id_menu' => $id_menu,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil,
|
|
'posisiToggle' => $posisiToggle,
|
|
'tgl' => $now,
|
|
'pddBelum' => $datPddBelum,
|
|
'rpjSudah' => $datRpjSudah,
|
|
'countBelum' => count($datPddBelum),
|
|
'countSelesai' => count($datRpjSudah),
|
|
'countPilih' => $countPilih,
|
|
'wajibpajak' => $datWajibPajak,
|
|
'corp' => $datCorp,
|
|
'kop_id' => $kop_id,
|
|
);
|
|
$this->load->view('proses/KU_Sub2_PajakPph23_1', $data);
|
|
}
|
|
|
|
public function KU_Pilih_Sub2_B1_DataPajakDibayarDimuka() {
|
|
$id_pdd = $this->input->post('id_pddset');
|
|
|
|
$datPdd = $this->Amod->getData_PajakDibayarDimuka_byID($id_pdd);
|
|
if ($datPdd==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$datDrpj = $this->Amod->getData_DaftarRekapPajak_byPDD($id_pdd);
|
|
if ($datDrpj==TRUE) {
|
|
$this->session->set_flashdata('data_used', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$cekDrpj = $this->Amod->getData_DaftarRekapPajak_RPJNull_PPH23Only();
|
|
foreach ($cekDrpj as $key) {
|
|
if ($key['CORP_ID']!=$datPdd[0]['CORP_ID']) {
|
|
$this->session->set_flashdata('pkp_error', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
}
|
|
|
|
$dpp_drpj = round(($datPdd[0]['DEBET_DAK']/$datPdd[0]['RATE_PPH']),2);
|
|
$input = [
|
|
'DPP_DRPJ' => $dpp_drpj,
|
|
'PDD_ID' => $id_pdd,
|
|
];
|
|
$action = $this->Amod->create('daftar_rekappajak', $input);
|
|
|
|
if ($action) {
|
|
$this->session->set_flashdata('success', 'dipilih');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
} else {
|
|
$this->session->set_flashdata('failed', 'dipilih');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
}
|
|
|
|
public function KU_Proses_Sub2_B1_DataPajakDibayarDimuka() {
|
|
$id_wajibpajak = $this->input->post('id_wajibpajakpro');
|
|
$tgl_rpj = $this->input->post('tgl_rpjpro');
|
|
$ntpn_rpj = $this->input->post('ntpn_rpjpro');
|
|
$billing_rpj = $this->input->post('billing_rpjpro');
|
|
$bupot_rpj = $this->input->post('bupot_rpjpro');
|
|
$sp2d_rpj = $this->input->post('sp2d_rpjpro');
|
|
$tgl = date('Y-m-d');
|
|
|
|
if ($ntpn_rpj=="") {
|
|
$ntpn_rpj = NULL;
|
|
}
|
|
|
|
if ($billing_rpj=="") {
|
|
$billing_rpj = NULL;
|
|
}
|
|
|
|
if ($bupot_rpj=="") {
|
|
$bupot_rpj = NULL;
|
|
}
|
|
|
|
if ($sp2d_rpj=="") {
|
|
$sp2d_rpj = NULL;
|
|
}
|
|
|
|
$ntpn_rpj = strtoupper($ntpn_rpj);
|
|
$billing_rpj = strtoupper($billing_rpj);
|
|
$bupot_rpj = strtoupper($bupot_rpj);
|
|
$sp2d_rpj = strtoupper($sp2d_rpj);
|
|
|
|
if (strtotime($tgl_rpj)>strtotime($tgl)) {
|
|
$this->session->set_flashdata('date_morethan', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
if ($ntpn_rpj==NULL AND $billing_rpj==NULL AND $bupot_rpj==NULL AND $sp2d_rpj==NULL) {
|
|
$this->session->set_flashdata('minimum_one_pajak', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$datDrpj = $this->Amod->getData_DaftarRekapPajak_RPJNull_PPH23Only();
|
|
if ($datDrpj==FALSE) {
|
|
$this->session->set_flashdata('input_check', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$input = [
|
|
'JENIS_RPJ' => '2',
|
|
'STATUS_RPJ' => '1',
|
|
'WAJIBPAJAK_ID' => $id_wajibpajak,
|
|
'CORP_ID' => $datDrpj[0]['CORP_ID'],
|
|
'TGL_RPJ' => $tgl_rpj,
|
|
'NTPN_RPJ' => $ntpn_rpj,
|
|
'BILLING_RPJ' => $billing_rpj,
|
|
'BUPOT_RPJ' => $bupot_rpj,
|
|
'SP2D_RPJ' => $sp2d_rpj,
|
|
];
|
|
$action = $this->Amod->create('rekap_pajak', $input);
|
|
|
|
$id_rpj = $this->Amod->getMax_ID_RekapPajak();
|
|
$id_rpj = $id_rpj[0]['ID_RPJ'];
|
|
|
|
foreach ($datDrpj as $key) {
|
|
$update = [
|
|
'RPJ_ID' => $id_rpj
|
|
];
|
|
$action = $this->Amod->update('daftar_rekappajak', $update, 'ID_DRPJ', $key['ID_DRPJ']);
|
|
}
|
|
|
|
if ($action) {
|
|
$this->session->set_flashdata('success', 'diproses');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
} else {
|
|
$this->session->set_flashdata('failed', 'diproses');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
}
|
|
|
|
//SUBMENU PERPAJAKAN - PPN
|
|
public function KU_Sub2_PajakPpn_1() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$limit = date('Y-m-01');
|
|
$now = date('Y-m-d');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "KU", "PERPAJAKAN - PPN");
|
|
$id_menu = $datShm[0]['MENU_ID'];
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$datStpos = $this->Amod->getData_SetTogglePosisi_byKARYAWAN_byMENU($id_karyawan, $id_menu);
|
|
if ($datStpos==FALSE) { $posisiToggle = 0; } else { $posisiToggle = $datStpos[0]['AKTIF_STPOS']; }
|
|
|
|
$datStk = $this->Amod->getData_SetToggleKop_byKARYAWAN_byNAMA($id_karyawan, "KU_Sub2_PajakPpn_1");
|
|
if ($datStk==FALSE) { $kop_id = 0; } else { $kop_id = $datStk[0]['KOP_ID']; }
|
|
|
|
$datPddBelum = $this->Amod->getData_Penjualan_PPNOnly();
|
|
$countPilih = $this->Amod->getCount_Penjualan_PPNSelected();
|
|
$datWajibPajak = $this->Amod->getData_WajibPajak_bySTATUS(1);
|
|
$datCorp = $this->Amod->getData_Corp_forPPH();
|
|
$no = 0;
|
|
foreach ($datPddBelum as $key) {
|
|
if ($key['ID_DRPJ']!=NULL) {
|
|
$nilaisub = $key['DPP_DRPJ']*($key['PPN_SO']/100);
|
|
$dpp = number_format($key['DPP_DRPJ'],2);
|
|
$subtotal = number_format($nilaisub,2);
|
|
} else {
|
|
$sumDo = $this->Amod->getSum_DaftarOrder_byPENJUALAN($key['ID_PENJUALAN']);
|
|
$nilaidpp = round($sumDo[0]['ALLTOTAL'],2);
|
|
$nilaisub = $nilaidpp*($key['PPN_SO']/100);
|
|
|
|
$dpp = number_format($nilaidpp,2);
|
|
$subtotal = number_format($nilaisub,2);
|
|
}
|
|
$datPddBelum[$no] += ['DPP' => $dpp];
|
|
$datPddBelum[$no++] += ['SUBTOTAL' => $subtotal];
|
|
}
|
|
|
|
$datRpjSudah = $this->Amod->getData_RekapPajak_byCORP_byJENIS_bySTATUS($kop_id, 3, 1);
|
|
$no = 0;
|
|
foreach ($datRpjSudah as $key) {
|
|
$datDrpj = $this->Amod->getData_DaftarRekapPajak_byRPJ_PenjualanNotNull($key['ID_RPJ']);
|
|
$datRpjSudah[$no++] += ['DETAIL' => $datDrpj];
|
|
}
|
|
|
|
$data = array(
|
|
'sidebar' => "menu keuangan",
|
|
'navChild' => "keuangan pajakppn",
|
|
'id_menu' => $id_menu,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil,
|
|
'posisiToggle' => $posisiToggle,
|
|
'tgl' => $now,
|
|
'pddBelum' => $datPddBelum,
|
|
'rpjSudah' => $datRpjSudah,
|
|
'countBelum' => count($datPddBelum),
|
|
'countSelesai' => count($datRpjSudah),
|
|
'countPilih' => $countPilih,
|
|
'wajibpajak' => $datWajibPajak,
|
|
'corp' => $datCorp,
|
|
'kop_id' => $kop_id,
|
|
);
|
|
$this->load->view('proses/KU_Sub2_PajakPpn_1', $data);
|
|
}
|
|
|
|
public function KU_Ubah_Sub2_KeteranganPajak() {
|
|
$id_penjualan = $this->input->post('id_penjualan');
|
|
$ket_pajak = $this->input->post('ket_pajak');
|
|
$ket_pajak = preg_replace('/\R+/', " " , $ket_pajak);
|
|
|
|
//Check Konsistensi Data
|
|
$value = 0;
|
|
$datPenjualan = $this->Amod->getData_Penjualan_byID_bySTATUS($id_penjualan, 1);
|
|
if ($datPenjualan==FALSE) {
|
|
$value = 2;
|
|
} else {
|
|
$update = [
|
|
'KET_PAJAK' => $ket_pajak,
|
|
];
|
|
$action = $this->Amod->update('penjualan', $update, 'ID_PENJUALAN', $id_penjualan);
|
|
|
|
$value = 1;
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
|
|
}
|
|
|
|
public function KU_Pilih_Sub2_C1_DataPenjualan() {
|
|
$id_penjualan = $this->input->post('id_penjualanset');
|
|
|
|
$datPenjualan = $this->Amod->getData_Penjualan_byID($id_penjualan);
|
|
if ($datPenjualan==FALSE OR $datPenjualan[0]['STATUS_PENJUALAN']!=1) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$datDrpj = $this->Amod->getData_DaftarRekapPajak_byPENJUALAN($id_penjualan);
|
|
if ($datDrpj==TRUE) {
|
|
$this->session->set_flashdata('data_used', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$cekDrpj = $this->Amod->getData_DaftarRekapPajak_RPJNull_PPNOnly();
|
|
foreach ($cekDrpj as $key) {
|
|
if ($key['KOP_ID']!=$datPenjualan[0]['KOP_ID']) {
|
|
$this->session->set_flashdata('pkp_error', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
}
|
|
|
|
$sumDo = $this->Amod->getSum_DaftarOrder_byPENJUALAN($id_penjualan);
|
|
$input = [
|
|
'DPP_DRPJ' => $sumDo[0]['ALLTOTAL'],
|
|
'PENJUALAN_ID' => $id_penjualan,
|
|
];
|
|
$action = $this->Amod->create('daftar_rekappajak', $input);
|
|
|
|
if ($action) {
|
|
$this->session->set_flashdata('success', 'dipilih');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
} else {
|
|
$this->session->set_flashdata('failed', 'dipilih');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
}
|
|
|
|
public function KU_Ubah_Sub2_C1_DataPenjualan() {
|
|
$id_drpj = $this->input->post('id_drpjed');
|
|
$dpp_drpj = $this->input->post('dpp_drpjed');
|
|
$id_penjualan = $this->input->post('id_penjualaned');
|
|
|
|
$datDrpj = $this->Amod->getData_DaftarRekapPajak_byID($id_drpj);
|
|
if ($datDrpj==FALSE OR $datDrpj[0]['RPJ_ID']!=NULL) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$datPenjualan = $this->Amod->getData_Penjualan_byID($id_penjualan);
|
|
if ($datPenjualan==FALSE OR $datPenjualan[0]['STATUS_PENJUALAN']!=1) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$dpp_drpj = str_replace(',', '.', $dpp_drpj);
|
|
$check_nilai = is_numeric($dpp_drpj);
|
|
if ($check_nilai==FALSE) {
|
|
$dpp_drpj = 0;
|
|
}
|
|
|
|
if ($dpp_drpj<=0) {
|
|
$this->session->set_flashdata('not_zero_negative', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$update = [
|
|
'DPP_DRPJ' => $dpp_drpj
|
|
];
|
|
$action = $this->Amod->update('daftar_rekappajak', $update, 'ID_DRPJ', $id_drpj);
|
|
|
|
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 KU_Proses_Sub2_C1_DataPenjualan() {
|
|
$id_wajibpajak = $this->input->post('id_wajibpajakpro');
|
|
$tgl_rpj = $this->input->post('tgl_rpjpro');
|
|
$ntpn_rpj = $this->input->post('ntpn_rpjpro');
|
|
$billing_rpj = $this->input->post('billing_rpjpro');
|
|
$bupot_rpj = $this->input->post('bupot_rpjpro');
|
|
$sp2d_rpj = $this->input->post('sp2d_rpjpro');
|
|
$tgl = date('Y-m-d');
|
|
|
|
if ($ntpn_rpj=="") {
|
|
$ntpn_rpj = NULL;
|
|
}
|
|
|
|
if ($billing_rpj=="") {
|
|
$billing_rpj = NULL;
|
|
}
|
|
|
|
if ($bupot_rpj=="") {
|
|
$bupot_rpj = NULL;
|
|
}
|
|
|
|
if ($sp2d_rpj=="") {
|
|
$sp2d_rpj = NULL;
|
|
}
|
|
|
|
$ntpn_rpj = strtoupper($ntpn_rpj);
|
|
$billing_rpj = strtoupper($billing_rpj);
|
|
$bupot_rpj = strtoupper($bupot_rpj);
|
|
$sp2d_rpj = strtoupper($sp2d_rpj);
|
|
|
|
if (strtotime($tgl_rpj)>strtotime($tgl)) {
|
|
$this->session->set_flashdata('date_morethan', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
if ($ntpn_rpj==NULL AND $billing_rpj==NULL AND $bupot_rpj==NULL AND $sp2d_rpj==NULL) {
|
|
$this->session->set_flashdata('minimum_one_pajak', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$datDrpj = $this->Amod->getData_DaftarRekapPajak_RPJNull_PPNOnly();
|
|
if ($datDrpj==FALSE) {
|
|
$this->session->set_flashdata('input_check', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$input = [
|
|
'JENIS_RPJ' => '3',
|
|
'STATUS_RPJ' => '1',
|
|
'WAJIBPAJAK_ID' => $id_wajibpajak,
|
|
'CORP_ID' => $datDrpj[0]['CORP_ID'],
|
|
'TGL_RPJ' => $tgl_rpj,
|
|
'NTPN_RPJ' => $ntpn_rpj,
|
|
'BILLING_RPJ' => $billing_rpj,
|
|
'BUPOT_RPJ' => $bupot_rpj,
|
|
'SP2D_RPJ' => $sp2d_rpj,
|
|
];
|
|
$action = $this->Amod->create('rekap_pajak', $input);
|
|
|
|
$id_rpj = $this->Amod->getMax_ID_RekapPajak();
|
|
$id_rpj = $id_rpj[0]['ID_RPJ'];
|
|
|
|
foreach ($datDrpj as $key) {
|
|
$update = [
|
|
'RPJ_ID' => $id_rpj
|
|
];
|
|
$action = $this->Amod->update('daftar_rekappajak', $update, 'ID_DRPJ', $key['ID_DRPJ']);
|
|
}
|
|
|
|
if ($action) {
|
|
$this->session->set_flashdata('success', 'diproses');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
} else {
|
|
$this->session->set_flashdata('failed', 'diproses');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
}
|
|
|
|
//SUBMENU ADMINISTRASI - KWITANSI
|
|
public function KU_Sub3_Kwitansi_1() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$now = date('Y-m-d');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "KU", "ADMINISTRASI - Kwitansi");
|
|
$id_menu = $datShm[0]['MENU_ID'];
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$datStpos = $this->Amod->getData_SetTogglePosisi_byKARYAWAN_byMENU($id_karyawan, $id_menu);
|
|
if ($datStpos==FALSE) { $posisiToggle = 0; } else { $posisiToggle = $datStpos[0]['AKTIF_STPOS']; }
|
|
|
|
$datCorp = $this->Amod->getData_Corp_bySTATUS(1);
|
|
if ($hak>=3) {
|
|
$datKwitansiTerpakai = $this->Amod->getData_Kwitansi_bySTATUS_orderDESC(1);
|
|
$datKwitansiBatal = $this->Amod->getData_Kwitansi_bySTATUS_orderDESC(2);
|
|
} else {
|
|
$datKwitansiTerpakai = $this->Amod->getData_Kwitansi_byKARYAWAN_bySTATUS_orderDESC($id_karyawan, 1);
|
|
$datKwitansiBatal = $this->Amod->getData_Kwitansi_byKARYAWAN_bySTATUS_orderDESC($id_karyawan, 2);
|
|
}
|
|
|
|
$data = array(
|
|
'sidebar' => "menu keuangan",
|
|
'navChild' => "keuangan kwitansi",
|
|
'tgl' => $now,
|
|
'corp' => $datCorp,
|
|
'kwitansiTerpakai' => $datKwitansiTerpakai,
|
|
'kwitansiBatal' => $datKwitansiBatal,
|
|
'countTerpakai' => count($datKwitansiTerpakai),
|
|
'countBatal' => count($datKwitansiBatal),
|
|
'posisiToggle' => $posisiToggle,
|
|
'id_menu' => $id_menu,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil
|
|
);
|
|
$this->load->view('proses/KU_Sub3_Kwitansi_1', $data);
|
|
}
|
|
|
|
public function KU_Kunci_Sub3_A1_DataKwitansi() {
|
|
$id_pelanggan = $this->input->post('id_pelangganfill');
|
|
$id_corp = $this->input->post('id_corpfill');
|
|
$jenis_kwitansi = $this->input->post('jenis_kwitansifill');
|
|
$tgl_kwitansi = $this->input->post('tgl_kwitansifill');
|
|
$nilai_kwitansi = $this->input->post('nilai_kwitansifill');
|
|
$ket_kwitansi = $this->input->post('ket_kwitansifill');
|
|
$ket_kwitansi = ltrim(rtrim(preg_replace('/\R+/', " " , $ket_kwitansi)));
|
|
$now = date('Y-m-d');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
|
|
if ($id_pelanggan==NULL OR $id_pelanggan=="") {
|
|
$this->session->set_flashdata('pelanggan_null', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
if ($id_corp==NULL OR $id_corp=="") {
|
|
$this->session->set_flashdata('pelanggan_null', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
if ($ket_kwitansi==NULL OR $ket_kwitansi=="") {
|
|
$this->session->set_flashdata('ket_null', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
if ($nilai_kwitansi==NULL OR $nilai_kwitansi=="") {
|
|
$this->session->set_flashdata('less_same_zero', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
if ($jenis_kwitansi==NULL OR $jenis_kwitansi=="") {
|
|
$jenis_kwitansi = 1;
|
|
}
|
|
|
|
if ($tgl_kwitansi==NULL OR $tgl_kwitansi=="") {
|
|
$tgl_kwitansi = $now;
|
|
}
|
|
|
|
$kode_kwitansi = $this->Amod->generate_kodeKwitansi($id_corp);
|
|
|
|
$input = [
|
|
'CIPTA_KWITANSI' => "Oleh $panggilan pada $timestamp",
|
|
'KODE_KWITANSI' => $kode_kwitansi,
|
|
'TGL_KWITANSI' => $tgl_kwitansi,
|
|
'JENIS_KWITANSI' => $jenis_kwitansi,
|
|
'KARYAWAN_ID' => $id_karyawan,
|
|
'CORP_ID' => $id_corp,
|
|
'PELANGGAN_ID' => $id_pelanggan,
|
|
'NILAI_KWITANSI' => $nilai_kwitansi,
|
|
'KET_KWITANSI' => $ket_kwitansi,
|
|
'STATUS_KWITANSI' => '1'
|
|
];
|
|
$action = $this->Amod->create('kwitansi', $input);
|
|
|
|
if ($action) {
|
|
$this->session->set_flashdata('success', 'dikunci');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
} else {
|
|
$this->session->set_flashdata('failed', 'dikunci');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
}
|
|
|
|
public function KU_Batal_Sub3_A1_DataKwitansi() {
|
|
$id_kwitansi = $this->input->post('id_kwitansivoid');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$datKwitansi = $this->Amod->getData_Kwitansi_byID_bySTATUS($id_kwitansi, 1);
|
|
if ($datKwitansi==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
} else if ($datKwitansi[0]['KASBANK_KWITANSI']!=NULL) {
|
|
$this->session->set_flashdata('data_used', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$cekKwitansi = $this->Amod->getData_PajakDibayarDimuka_byKWITANSI($id_kwitansi);
|
|
if ($cekKwitansi==TRUE) {
|
|
$this->session->set_flashdata('data_used', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$update = [
|
|
'BATAL_KWITANSI' => "Oleh $panggilan pada $timestamp",
|
|
'STATUS_KWITANSI' => '2'
|
|
];
|
|
$action = $this->Amod->update('kwitansi', $update, 'ID_KWITANSI', $id_kwitansi);
|
|
|
|
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 KU_Buka_Sub3_A1_DataKwitansi() {
|
|
$id_kwitansi = $this->input->post('id_kwitansiopen');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$datKwitansi = $this->Amod->getData_Kwitansi_byID_bySTATUS($id_kwitansi, 2);
|
|
if ($datKwitansi==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$update = [
|
|
'BUKA_KWITANSI' => "Oleh $panggilan pada $timestamp",
|
|
'STATUS_KWITANSI' => '1'
|
|
];
|
|
$action = $this->Amod->update('kwitansi', $update, 'ID_KWITANSI', $id_kwitansi);
|
|
|
|
if ($action) {
|
|
$this->session->set_flashdata('success', 'dibuka');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
} else {
|
|
$this->session->set_flashdata('failed', 'dibuka');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
}
|
|
|
|
public function KU_Cetak_Sub3_A1_DataKwitansi($id) {
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$datKwitansi = $this->Amod->getData_Kwitansi_byID($id);
|
|
|
|
$update = [
|
|
'CETAK_KWITANSI' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('kwitansi', $update, 'ID_KWITANSI', $id);
|
|
|
|
$data = [
|
|
'kwitansi' => $datKwitansi
|
|
];
|
|
$this->load->view('cetak/KWITANSI_Cetak', $data);
|
|
}
|
|
|
|
//SUBMENU ADMINISTRASI - NOTA BEBAS
|
|
public function KU_Sub3_NotaBebas_1() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$now = date('Y-m-d');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "KU", "ADMINISTRASI - Nota Bebas");
|
|
$id_menu = $datShm[0]['MENU_ID'];
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$datCorp = $this->Amod->getData_Corp_bySTATUS(1);
|
|
|
|
$datNb = $this->Amod->getData_NotaBebas_byKARYAWAN_bySTATUS($id_karyawan, 0);
|
|
if ($datNb==FALSE) {
|
|
$id_nb = 0;
|
|
$datDnb = NULL;
|
|
} else {
|
|
$id_nb = $datNb[0]['ID_NB'];
|
|
$datDnb = $this->Amod->getData_DaftarNotaBebas_byNB($id_nb);
|
|
}
|
|
|
|
if ($hak>=3) {
|
|
$datNbList = $this->Amod->getData_NotaBebas_bySTATUS_orderDESC(1);
|
|
$datNbVoid = $this->Amod->getData_NotaBebas_bySTATUS_orderDESC(2);
|
|
} else {
|
|
$datNbList = $this->Amod->getData_NotaBebas_byKARYAWAN_bySTATUS_orderDESC($id_karyawan, 1);
|
|
$datNbVoid = $this->Amod->getData_NotaBebas_byKARYAWAN_bySTATUS_orderDESC($id_karyawan, 2);
|
|
}
|
|
|
|
$no = 0;
|
|
foreach ($datNbList as $key) {
|
|
$datHcd = $this->Amod->getData_HistoriCetakDokumen_byKODE_orderDESC_limit1($key['KODE_NB']);
|
|
if ($datHcd==FALSE) {
|
|
$histori = "<i style='color:Blue'>*Belum dicetak*</i>";
|
|
} else {
|
|
$histori = $datHcd[0]['CETAK_HCD'];
|
|
}
|
|
$datNbList[$no++] += ['HISTORI' => $histori];
|
|
}
|
|
|
|
$no = 0;
|
|
foreach ($datNbVoid as $key) {
|
|
$datHcd = $this->Amod->getData_HistoriCetakDokumen_byKODE_orderDESC_limit1($key['KODE_NB']);
|
|
if ($datHcd==FALSE) {
|
|
$histori = "<i style='color:Blue'>*Belum dicetak*</i>";
|
|
} else {
|
|
$histori = $datHcd[0]['CETAK_HCD'];
|
|
}
|
|
$datNbVoid[$no++] += ['HISTORI' => $histori];
|
|
}
|
|
|
|
$datStpos = $this->Amod->getData_SetTogglePosisi_byKARYAWAN_byMENU($id_karyawan, $id_menu);
|
|
if ($datStpos==FALSE) { $posisiToggle = 0; } else { $posisiToggle = $datStpos[0]['AKTIF_STPOS']; }
|
|
|
|
$data = array(
|
|
'sidebar' => "menu keuangan",
|
|
'navChild' => "keuangan notabebas",
|
|
'tgl' => $now,
|
|
'corp' => $datCorp,
|
|
'dnb' => $datDnb,
|
|
'nb' => $datNbList,
|
|
'void' => $datNbVoid,
|
|
'countNb' => count($datNbList),
|
|
'countVoid' => count($datNbVoid),
|
|
'posisiToggle' => $posisiToggle,
|
|
'id_menu' => $id_menu,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil
|
|
);
|
|
$this->load->view('proses/KU_Sub3_NotaBebas_1', $data);
|
|
}
|
|
|
|
public function KU_Ambil_Sub3_B1_DataDaftarNotaBebas() {
|
|
$verse = $this->input->post('verse');
|
|
$id_nb = $this->input->post('id_nb');
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
|
|
if ($verse==1) {
|
|
$datNb = $this->Amod->getData_NotaBebas_byKARYAWAN_bySTATUS($id_karyawan, 0);
|
|
if ($datNb==TRUE) {
|
|
$id_nb = $datNb[0]['ID_NB'];
|
|
} else {
|
|
$id_nb = NULL;
|
|
}
|
|
}
|
|
|
|
if ($id_nb==NULL) {
|
|
$datNb = NULL;
|
|
$id_pelanggan = "";
|
|
$id_corp = "";
|
|
$nama_pelanggan = "";
|
|
$jenis_nb = 1;
|
|
$ppn_nb = 0;
|
|
$tgl_nb = date('Y-m-d');
|
|
} else {
|
|
$datNb = $this->Amod->getData_NotaBebas_byID($id_nb);
|
|
$nama_pelanggan = $datNb[0]['NAMA_PELANGGAN'];
|
|
$id_pelanggan = $datNb[0]['PELANGGAN_ID'];
|
|
$id_corp = $datNb[0]['CORP_ID'];
|
|
$ppn_nb = $datNb[0]['PPN_NB'];
|
|
$tgl_nb = $datNb[0]['TGL_NB'];
|
|
$jenis_nb = $datNb[0]['JENIS_NB'];
|
|
}
|
|
|
|
$data = $this->Amod->getData_DaftarNotaBebas_byNB($id_nb);
|
|
$no = 0;
|
|
foreach ($data as $key) {
|
|
$satuan = $key['HARGA_DNB'];
|
|
$subtotal = $key['HARGA_DNB']*$key['QTY_DNB'];
|
|
|
|
$data[$no] += ['SATUAN' => number_format($satuan,2)];
|
|
$data[$no++] += ['SUBTOTAL' => number_format($subtotal,2)];
|
|
}
|
|
|
|
$sumDpp = $this->Amod->getSum_DaftarNotaBebas_byNB($id_nb);
|
|
if ($sumDpp[0]['TOTAL']==NULL) {
|
|
$dpp = 0;
|
|
$ppn = 0;
|
|
$tot = 0;
|
|
} else {
|
|
$dpp = round($sumDpp[0]['TOTAL'],2);
|
|
$ppn = round(($sumDpp[0]['TOTAL']*($ppn_nb/100)),2);
|
|
$tot = round(($dpp+$ppn),2);
|
|
}
|
|
|
|
$this->output_json([
|
|
'total' => sizeof($data),
|
|
'data' => $data,
|
|
'id_pelanggan' => $id_pelanggan,
|
|
'id_corp' => $id_corp,
|
|
'nama_pelanggan' => $nama_pelanggan,
|
|
'ppn_nb' => $ppn_nb,
|
|
'tgl_nb' => $tgl_nb,
|
|
'jenis_nb' => $jenis_nb,
|
|
'dpp' => number_format($dpp,2),
|
|
'ppn' => number_format($ppn,2),
|
|
'tot' => number_format($tot,2),
|
|
]);
|
|
}
|
|
|
|
public function KU_Tambah_Sub3_B1_DataDaftarNotaBebas() {
|
|
$id_pelanggan = $this->input->post('id_pelanggan');
|
|
$id_corp = $this->input->post('id_corp');
|
|
$jenis_nb = $this->input->post('jenis_nb');
|
|
$tgl_nb = $this->input->post('tgl_nb');
|
|
$ppn_nb = $this->input->post('ppn_nb');
|
|
$nama_dnb = $this->input->post('nama');
|
|
$qty_dnb = $this->input->post('qty');
|
|
$harga_dnb = $this->input->post('harga');
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$value = 0;
|
|
$datNb = $this->Amod->getData_NotaBebas_byKARYAWAN_bySTATUS($id_karyawan, 0);
|
|
if ($datNb==TRUE) {
|
|
$id_nb = $datNb[0]['ID_NB'];
|
|
if ($jenis_nb==NULL) {
|
|
$jenis_nb = $datNb[0]['JENIS_NB'];
|
|
}
|
|
if ($tgl_nb==NULL) {
|
|
$tgl_nb = $datNb[0]['TGL_NB'];
|
|
}
|
|
if ($id_corp==NULL) {
|
|
$id_corp = $datNb[0]['CORP_ID'];
|
|
}
|
|
if ($id_pelanggan==NULL) {
|
|
$id_pelanggan = $datNb[0]['PELANGGAN_ID'];
|
|
}
|
|
if ($ppn_nb==NULL) {
|
|
$ppn_nb = $datNb[0]['PPN_NB'];
|
|
}
|
|
$update = [
|
|
'JENIS_NB' => $jenis_nb,
|
|
'TGL_NB' => $tgl_nb,
|
|
'CORP_ID' => $id_corp,
|
|
'PELANGGAN_ID' => $id_pelanggan,
|
|
'PPN_NB' => $ppn_nb
|
|
];
|
|
$action = $this->Amod->update('nota_bebas', $update, 'ID_NB', $id_nb);
|
|
} else {
|
|
$input = [
|
|
'CIPTA_NB' => "Oleh $panggilan pada $timestamp",
|
|
'KARYAWAN_ID' => $id_karyawan,
|
|
'JENIS_NB' => $jenis_nb,
|
|
'TGL_NB' => $tgl_nb,
|
|
'CORP_ID' => $id_corp,
|
|
'PELANGGAN_ID' => $id_pelanggan,
|
|
'PPN_NB' => $ppn_nb,
|
|
'STATUS_NB' => '0'
|
|
];
|
|
$action = $this->Amod->create('nota_bebas', $input);
|
|
|
|
$id_nb = $this->Amod->getMax_ID_NotaBebas();
|
|
$id_nb = $id_nb[0]['ID_NB'];
|
|
}
|
|
|
|
$input = [
|
|
'NB_ID' => $id_nb,
|
|
'QTY_DNB' => $qty_dnb,
|
|
'HARGA_DNB' => $harga_dnb,
|
|
'NAMA_DNB' => $nama_dnb
|
|
];
|
|
$action = $this->Amod->create('daftar_notabebas', $input);
|
|
|
|
if ($action) {
|
|
$value = 1;
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value
|
|
]);
|
|
}
|
|
|
|
public function KU_Ubah_Sub3_B1_DataDaftarNotaBebas() {
|
|
$id_pelanggan = $this->input->post('id_pelanggan');
|
|
$id_corp = $this->input->post('id_corp');
|
|
$jenis_nb = $this->input->post('jenis_nb');
|
|
$tgl_nb = $this->input->post('tgl_nb');
|
|
$ppn_nb = $this->input->post('ppn_nb');
|
|
$id_dnb = $this->input->post('id_dnb');
|
|
$nama_dnb = $this->input->post('nama_dnb');
|
|
$qty_dnb = $this->input->post('qty_dnb');
|
|
$harga_dnb = $this->input->post('harga_dnb');
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$value = 0;
|
|
$datDnb = $this->Amod->getData_DaftarNotaBebas_byID($id_dnb);
|
|
if ($datDnb==FALSE) {
|
|
$value = 3;
|
|
} else {
|
|
$datNb = $this->Amod->getData_NotaBebas_byID_bySTATUS($datDnb[0]['NB_ID'], 0);
|
|
if ($datNb==FALSE) {
|
|
$value = 2;
|
|
} else {
|
|
$id_nb = $datNb[0]['ID_NB'];
|
|
if ($jenis_nb==NULL) {
|
|
$jenis_nb = $datNb[0]['JENIS_NB'];
|
|
}
|
|
if ($tgl_nb==NULL) {
|
|
$tgl_nb = $datNb[0]['TGL_NB'];
|
|
}
|
|
if ($id_corp==NULL) {
|
|
$id_corp = $datNb[0]['CORP_ID'];
|
|
}
|
|
if ($id_pelanggan==NULL) {
|
|
$id_pelanggan = $datNb[0]['PELANGGAN_ID'];
|
|
}
|
|
if ($ppn_nb==NULL) {
|
|
$ppn_nb = $datNb[0]['PPN_NB'];
|
|
}
|
|
$update = [
|
|
'JENIS_NB' => $jenis_nb,
|
|
'TGL_NB' => $tgl_nb,
|
|
'CORP_ID' => $id_corp,
|
|
'PELANGGAN_ID' => $id_pelanggan,
|
|
'PPN_NB' => $ppn_nb
|
|
];
|
|
$action = $this->Amod->update('nota_bebas', $update, 'ID_NB', $id_nb);
|
|
|
|
$update = [
|
|
'NAMA_DNB' => $nama_dnb,
|
|
'QTY_DNB' => $qty_dnb,
|
|
'HARGA_DNB' => $harga_dnb
|
|
];
|
|
$action = $this->Amod->update('daftar_notabebas', $update, 'ID_DNB', $id_dnb);
|
|
|
|
$value = 1;
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value
|
|
]);
|
|
}
|
|
|
|
public function KU_Hapus_Sub3_B1_DataDaftarNotaBebas() {
|
|
$id_dnb = $this->input->post('id_dnb');
|
|
|
|
$value = 0;
|
|
$datDnb = $this->Amod->getData_DaftarNotaBebas_byID($id_dnb);
|
|
if ($datDnb==FALSE) {
|
|
$value = 3;
|
|
} else {
|
|
$datNb = $this->Amod->getData_NotaBebas_byID_bySTATUS($datDnb[0]['NB_ID'], 0);
|
|
if ($datNb==FALSE) {
|
|
$value = 2;
|
|
} else {
|
|
$action = $this->Amod->delete('daftar_notabebas', $id_dnb, 'ID_DNB');
|
|
$value = 1;
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value
|
|
]);
|
|
}
|
|
|
|
public function KU_Kunci_Sub3_B1_DataNotaBebas() {
|
|
$id_pelanggan = $this->input->post('id_pelanggan');
|
|
$id_corp = $this->input->post('id_corp');
|
|
$jenis_nb = $this->input->post('jenis_nb');
|
|
$tgl_nb = $this->input->post('tgl_nb');
|
|
$ppn_nb = $this->input->post('ppn_nb');
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$value = 0;
|
|
$datNb = $this->Amod->getData_NotaBebas_byKARYAWAN_bySTATUS($id_karyawan, 0);
|
|
if ($datNb==FALSE) {
|
|
$value = 2;
|
|
} else {
|
|
if ($jenis_nb==NULL) {
|
|
$jenis_nb = $datNb[0]['JENIS_NB'];
|
|
}
|
|
if ($tgl_nb==NULL) {
|
|
$tgl_nb = $datNb[0]['TGL_NB'];
|
|
}
|
|
if ($id_corp==NULL) {
|
|
$id_corp = $datNb[0]['CORP_ID'];
|
|
}
|
|
if ($id_pelanggan==NULL) {
|
|
$id_pelanggan = $datNb[0]['PELANGGAN_ID'];
|
|
}
|
|
if ($ppn_nb==NULL) {
|
|
$ppn_nb = $datNb[0]['PPN_NB'];
|
|
}
|
|
if ($datNb[0]['KODE_NB']!=NULL AND $datNb[0]['CORP_ID']==$id_corp) {
|
|
$kode_nb = $datNb[0]['KODE_NB'];
|
|
} else {
|
|
$kode_nb = $this->Amod->generate_kodeNotaBebas($jenis_nb, $id_corp);
|
|
}
|
|
|
|
$update = [
|
|
'JENIS_NB' => $jenis_nb,
|
|
'TGL_NB' => $tgl_nb,
|
|
'CORP_ID' => $id_corp,
|
|
'PELANGGAN_ID' => $id_pelanggan,
|
|
'PPN_NB' => $ppn_nb,
|
|
'KODE_NB' => $kode_nb,
|
|
'KUNCI_NB' => "Oleh $panggilan pada $timestamp",
|
|
'STATUS_NB' => '1'
|
|
];
|
|
$action = $this->Amod->update('nota_bebas', $update, 'ID_NB', $datNb[0]['ID_NB']);
|
|
|
|
$input = [
|
|
'SJ_INV' => '1',
|
|
'KODE_BUKTI' => $kode_nb,
|
|
'TGL_CD' => $tgl_nb,
|
|
'NB_ID' => $datNb[0]['ID_NB']
|
|
];
|
|
$action = $this->Amod->create('cetak_dokumen', $input);
|
|
|
|
$value = 1;
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value
|
|
]);
|
|
}
|
|
|
|
public function KU_Revisi_Sub3_B1_DataNotaBebas() {
|
|
$id_nb = $this->input->post('id_nbrev');
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$datNb = $this->Amod->getData_NotaBebas_byID_bySTATUS($id_nb, 1);
|
|
if ($datNb==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$cekNb = $this->Amod->getData_NotaBebas_byKARYAWAN_bySTATUS($id_karyawan, 0);
|
|
if ($cekNb==TRUE) {
|
|
$update = [
|
|
'STATUS_NB' => '9'
|
|
];
|
|
$action = $this->Amod->update('nota_bebas', $update, 'ID_NB', $cekNb[0]['ID_NB']);
|
|
}
|
|
|
|
$update = [
|
|
'REVISI_NB' => "Oleh $panggilan pada $timestamp",
|
|
'STATUS_NB' => '0'
|
|
];
|
|
$action = $this->Amod->update('nota_bebas', $update, 'ID_NB', $id_nb);
|
|
|
|
if ($action) {
|
|
$this->session->set_flashdata('success', 'direvisi');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
} else {
|
|
$this->session->set_flashdata('failed', 'direvisi');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
}
|
|
|
|
public function KU_Batal_Sub3_B1_DataNotaBebas() {
|
|
$id_nb = $this->input->post('id_nbvoid');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$datNb = $this->Amod->getData_NotaBebas_byID_bySTATUS($id_nb, 1);
|
|
if ($datNb==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
} else if ($datNb[0]['KASBANK_NB']!=NULL) {
|
|
$this->session->set_flashdata('data_used', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$cekNb = $this->Amod->getData_PajakDibayarDimuka_byNB($id_nb);
|
|
if ($cekNb==TRUE) {
|
|
$this->session->set_flashdata('data_used', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$update = [
|
|
'BATAL_NB' => "Oleh $panggilan pada $timestamp",
|
|
'STATUS_NB' => '2'
|
|
];
|
|
$action = $this->Amod->update('nota_bebas', $update, 'ID_NB', $id_nb);
|
|
|
|
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 KU_Buka_Sub3_B1_DataNotaBebas() {
|
|
$id_nb = $this->input->post('id_nbopen');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$datNb = $this->Amod->getData_NotaBebas_byID_bySTATUS($id_nb, 2);
|
|
if ($datNb==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$update = [
|
|
'BUKA_NB' => "Oleh $panggilan pada $timestamp",
|
|
'STATUS_NB' => '1'
|
|
];
|
|
$action = $this->Amod->update('nota_bebas', $update, 'ID_NB', $id_nb);
|
|
|
|
if ($action) {
|
|
$this->session->set_flashdata('success', 'dibuka');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
} else {
|
|
$this->session->set_flashdata('failed', 'dibuka');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
}
|
|
|
|
//SUBMENU ADMINISTRASI - TANDA TERIMA NOTA
|
|
public function KU_Sub3_TtNota_1() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$now = date('Y-m-d');
|
|
$limit = date('Y-m-01');
|
|
$limit = $this->Amod->generate_subMonth($limit, 2);
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "KU", "ADMINISTRASI - TT Nota");
|
|
$id_menu = $datShm[0]['MENU_ID'];
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
if ($hak>=3) {
|
|
$datTn = $this->Amod->getData_TtNota_bySTATUS_byLIMIT_orderDESC(1, $limit);
|
|
} else {
|
|
$datTn = $this->Amod->getData_TtNota_byKARYAWAN_bySTATUS_byLIMIT_orderDESC($id_karyawan, 1, $limit);
|
|
}
|
|
|
|
$datStpos = $this->Amod->getData_SetTogglePosisi_byKARYAWAN_byMENU($id_karyawan, $id_menu);
|
|
if ($datStpos==FALSE) { $posisiToggle = 0; } else { $posisiToggle = $datStpos[0]['AKTIF_STPOS']; }
|
|
|
|
$data = array(
|
|
'sidebar' => "menu keuangan",
|
|
'navChild' => "keuangan ttnota",
|
|
'tgl' => $now,
|
|
'id_menu' => $id_menu,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil,
|
|
'posisiToggle' => $posisiToggle,
|
|
'tn' => $datTn,
|
|
'countTn' => count($datTn),
|
|
);
|
|
$this->load->view('proses/KU_Sub3_TtNota_1', $data);
|
|
}
|
|
|
|
public function KU_Ambil_Sub3_C1_DataDaftarTtNota() {
|
|
$verse = $this->input->post('verse');
|
|
$id_tn = $this->input->post('id_tn');
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
|
|
if ($verse==1) {
|
|
$datTn = $this->Amod->getData_TtNota_byKARYAWAN_bySTATUS($id_karyawan, 0);
|
|
if ($datTn==TRUE) {
|
|
$id_tn = $datTn[0]['ID_TN'];
|
|
} else {
|
|
$id_tn = NULL;
|
|
}
|
|
}
|
|
|
|
if ($id_tn==NULL) {
|
|
$datTn = NULL;
|
|
$id_penjualan = "";
|
|
$inv_penjualan = "";
|
|
$ket_tn = "";
|
|
$tgl_tn = date('Y-m-d');
|
|
} else {
|
|
$datTn = $this->Amod->getData_TtNota_byID($id_tn);
|
|
$inv_penjualan = $datTn[0]['INV_PENJUALAN'];
|
|
$id_penjualan = $datTn[0]['PENJUALAN_ID'];
|
|
$ket_tn = $datTn[0]['KET_TN'];
|
|
$tgl_tn = $datTn[0]['TGL_TN'];
|
|
}
|
|
|
|
$data = $this->Amod->getData_DaftarTtNota_byTN_orderASC($id_tn);
|
|
|
|
$this->output_json([
|
|
'total' => sizeof($data),
|
|
'data' => $data,
|
|
'id_penjualan' => $id_penjualan,
|
|
'inv_penjualan' => $inv_penjualan,
|
|
'ket_tn' => $ket_tn,
|
|
'tgl_tn' => $tgl_tn,
|
|
]);
|
|
}
|
|
|
|
public function KU_Tambah_Sub3_C1_DataTtNota() {
|
|
$id_penjualan = $this->input->post('id_penjualan');
|
|
$tgl_tn = $this->input->post('tgl_tn');
|
|
$ket_tn = $this->input->post('ket_tn');
|
|
$ket_tn = ltrim(rtrim(preg_replace('/\R+/', " " , $ket_tn)));
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$value = 0;
|
|
$id_tn = NULL;
|
|
$datPenjualan = $this->Amod->getData_Penjualan_byID_bySTATUS($id_penjualan, 1);
|
|
if ($datPenjualan==FALSE) {
|
|
$value = 3;
|
|
} else {
|
|
$datSo = $this->Amod->getData_SalesOrder_byID_bySTATUS($datPenjualan[0]['SO_ID'], 1);
|
|
$nilaiSo = number_format($datSo[0]['NILAI_SO'], 2);
|
|
$sj_penjualan = $datPenjualan[0]['SJ_PENJUALAN'];
|
|
$inv_penjualan = $datPenjualan[0]['INV_PENJUALAN'];
|
|
|
|
$datTn = $this->Amod->getData_TtNota_byKARYAWAN_bySTATUS($id_karyawan, 0);
|
|
if ($datTn==TRUE) {
|
|
$id_tn = $datTn[0]['ID_TN'];
|
|
|
|
if ($id_penjualan==NULL) {
|
|
$id_penjualan = $datTn[0]['PENJUALAN_ID'];
|
|
}
|
|
if ($tgl_tn==NULL) {
|
|
$tgl_tn = $datTn[0]['TGL_TN'];
|
|
}
|
|
if ($ket_tn==NULL) {
|
|
$ket_tn = $datTn[0]['KET_TN'];
|
|
}
|
|
|
|
$update = [
|
|
'PENJUALAN_ID' => $id_penjualan,
|
|
'TGL_TN' => $tgl_tn,
|
|
'KET_TN' => $ket_tn
|
|
];
|
|
$action = $this->Amod->update('tt_nota', $update, 'ID_TN', $id_tn);
|
|
|
|
if ($id_penjualan!=$datTn[0]['PENJUALAN_ID']) {
|
|
$datDtn = $this->Amod->getData_DaftarTtNota_byTN_orderASC($id_tn);
|
|
$update1 = [
|
|
'NAMA_DTN' => "1 Lembar Nota $inv_penjualan senilai Rp $nilaiSo"
|
|
];
|
|
$action = $this->Amod->update('daftar_ttnota', $update1, 'ID_DTN', $datDtn[0]['ID_DTN']);
|
|
|
|
$update2 = [
|
|
'NAMA_DTN' => "1 Lembar Surat Jalan $sj_penjualan"
|
|
];
|
|
$action = $this->Amod->update('daftar_ttnota', $update2, 'ID_DTN', $datDtn[1]['ID_DTN']);
|
|
}
|
|
|
|
$value = 2;
|
|
} else {
|
|
$input = [
|
|
'CIPTA_TN' => "Oleh $panggilan pada $timestamp",
|
|
'KARYAWAN_ID' => $id_karyawan,
|
|
'TGL_TN' => $tgl_tn,
|
|
'PENJUALAN_ID' => $id_penjualan,
|
|
'KET_TN' => $ket_tn,
|
|
'STATUS_TN' => '0'
|
|
];
|
|
$action = $this->Amod->create('tt_nota', $input);
|
|
|
|
$id_tn = $this->Amod->getMax_ID_TtNota();
|
|
$id_tn = $id_tn[0]['ID_TN'];
|
|
|
|
$input1 = [
|
|
'TN_ID' => $id_tn,
|
|
'NAMA_DTN' => "1 Lembar Nota $inv_penjualan senilai Rp $nilaiSo",
|
|
'STATUS_DTN' => '1'
|
|
];
|
|
$action = $this->Amod->create('daftar_ttnota', $input1);
|
|
|
|
$input2 = [
|
|
'TN_ID' => $id_tn,
|
|
'NAMA_DTN' => "1 Lembar Surat Jalan $sj_penjualan",
|
|
'STATUS_DTN' => '1'
|
|
];
|
|
$action = $this->Amod->create('daftar_ttnota', $input2);
|
|
|
|
$input3 = [
|
|
'TN_ID' => $id_tn,
|
|
'NAMA_DTN' => "1 Lembar Faktur Pajak",
|
|
'STATUS_DTN' => '1'
|
|
];
|
|
$action = $this->Amod->create('daftar_ttnota', $input3);
|
|
|
|
$input4 = [
|
|
'TN_ID' => $id_tn,
|
|
'NAMA_DTN' => "1 Lembar Purchase Order",
|
|
'STATUS_DTN' => '1'
|
|
];
|
|
$action = $this->Amod->create('daftar_ttnota', $input4);
|
|
|
|
$input5 = [
|
|
'TN_ID' => $id_tn,
|
|
'NAMA_DTN' => "1 Lembar Lainnya..",
|
|
'STATUS_DTN' => '1'
|
|
];
|
|
$action = $this->Amod->create('daftar_ttnota', $input5);
|
|
$value = 1;
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
}
|
|
|
|
public function KU_Pilih_Sub3_C1_DataDaftarTtNota() {
|
|
$id_dtn = $this->input->post('id_dtn');
|
|
|
|
$value = 0;
|
|
$datDtn = $this->Amod->getData_DaftarTtNota_byID($id_dtn);
|
|
$datTn = $this->Amod->getData_TtNota_byID_bySTATUS($datDtn[0]['TN_ID'], 0);
|
|
if ($datTn==FALSE) {
|
|
$value = 2;
|
|
} else {
|
|
if ($datDtn[0]['STATUS_DTN']==1) {
|
|
$status = 2;
|
|
} else if ($datDtn[0]['STATUS_DTN']==2) {
|
|
$status = 1;
|
|
}
|
|
|
|
$update = [
|
|
'STATUS_DTN' => $status
|
|
];
|
|
$action = $this->Amod->update('daftar_ttnota', $update, 'ID_DTN', $id_dtn);
|
|
$value = 1;
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
}
|
|
|
|
public function KU_Ubah_Sub3_C1_DataDaftarTtNota() {
|
|
$id_dtn = $this->input->post('id_dtn');
|
|
$nama_dtn = $this->input->post('nama_dtn');
|
|
|
|
$value = 0;
|
|
$datDtn = $this->Amod->getData_DaftarTtNota_byID($id_dtn);
|
|
if ($datDtn==FALSE) {
|
|
$value = 3;
|
|
} else {
|
|
$datTn = $this->Amod->getData_TtNota_byID_bySTATUS($datDtn[0]['TN_ID'], 0);
|
|
if ($datTn==FALSE) {
|
|
$value = 2;
|
|
} else {
|
|
if ($nama_dtn==NULL) {
|
|
$nama_dtn = $datDtn[0]['NAMA_DTN'];
|
|
}
|
|
$update = [
|
|
'NAMA_DTN' => $nama_dtn
|
|
];
|
|
$action = $this->Amod->update('daftar_ttnota', $update, 'ID_DTN', $id_dtn);
|
|
|
|
$value = 1;
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value
|
|
]);
|
|
}
|
|
|
|
public function KU_Kunci_Sub3_C1_DataTtNota() {
|
|
$id_penjualan = $this->input->post('id_penjualan');
|
|
$tgl_tn = $this->input->post('tgl_tn');
|
|
$ket_tn = $this->input->post('ket_tn');
|
|
$ket_tn = ltrim(rtrim(preg_replace('/\R+/', " " , $ket_tn)));
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$now = date('Y-m-d');
|
|
|
|
$value = 0;
|
|
$datTn = $this->Amod->getData_TtNota_byKARYAWAN_bySTATUS($id_karyawan, 0);
|
|
if ($datTn==FALSE) {
|
|
$value = 2;
|
|
} else {
|
|
if ($id_penjualan==NULL) {
|
|
$id_penjualan = $datTn[0]['PENJUALAN_ID'];
|
|
}
|
|
if ($tgl_tn==NULL) {
|
|
$tgl_tn = $datTn[0]['TGL_TN'];
|
|
}
|
|
if ($ket_tn==NULL) {
|
|
$ket_tn = $datTn[0]['KET_TN'];
|
|
}
|
|
|
|
$update = [
|
|
'TGL_TN' => $tgl_tn,
|
|
'PENJUALAN_ID' => $id_penjualan,
|
|
'KET_TN' => $ket_tn,
|
|
'STATUS_TN' => '1'
|
|
];
|
|
$action = $this->Amod->update('tt_nota', $update, 'ID_TN', $datTn[0]['ID_TN']);
|
|
|
|
$value = 1;
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value
|
|
]);
|
|
}
|
|
|
|
public function KU_Revisi_Sub3_C1_DataTtNota() {
|
|
$id_tn = $this->input->post('id_tnrev');
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$datTn = $this->Amod->getData_TtNota_byID_bySTATUS($id_tn, 1);
|
|
if ($datTn==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$cekTt = $this->Amod->getData_TtNota_byKARYAWAN_bySTATUS($id_karyawan, 0);
|
|
if ($cekTt==TRUE) {
|
|
$update = [
|
|
'STATUS_TN' => '9'
|
|
];
|
|
$action = $this->Amod->update('tt_nota', $update, 'ID_TN', $cekTt[0]['ID_TN']);
|
|
}
|
|
|
|
$update = [
|
|
'REVISI_TN' => "Oleh $panggilan pada $timestamp",
|
|
'STATUS_TN' => '0'
|
|
];
|
|
$action = $this->Amod->update('tt_nota', $update, 'ID_TN', $id_tn);
|
|
|
|
if ($action) {
|
|
$this->session->set_flashdata('success', 'direvisi');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
} else {
|
|
$this->session->set_flashdata('failed', 'direvisi');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
}
|
|
|
|
public function KU_Cetak_Sub3_C1_DataTtNota($id) {
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$datTn = $this->Amod->getData_TtNota_byID($id);
|
|
$datDtn = $this->Amod->getData_DaftarTtNota_byTN_orderASC_cetakOnly($id);
|
|
|
|
$update = [
|
|
'CETAK_TN' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('tt_nota', $update, 'ID_TN', $id);
|
|
|
|
$data = [
|
|
'tt' => $datTn,
|
|
'dtt' => $datDtn,
|
|
'count' => count($datDtn),
|
|
'kop' => $datTn[0]['KOP_ID'],
|
|
'jenis' => '1'
|
|
];
|
|
$this->load->view('cetak/TT_Cetak', $data);
|
|
}
|
|
|
|
//SUBMENU ADMINISTRASI - TANDA TERIMA KOSONG
|
|
public function KU_Sub3_TtKosong_1() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$now = date('Y-m-d');
|
|
$limit = date('Y-m-01');
|
|
$limit = $this->Amod->generate_subMonth($limit, 2);
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "KU", "ADMINISTRASI - TT Kosong");
|
|
$id_menu = $datShm[0]['MENU_ID'];
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
if ($hak>=3) {
|
|
$datTk = $this->Amod->getData_TtKosong_bySTATUS_byLIMIT_orderDESC(1, $limit);
|
|
} else {
|
|
$datTk = $this->Amod->getData_TtKosong_byKARYAWAN_bySTATUS_byLIMIT_orderDESC($id_karyawan, 1, $limit);
|
|
}
|
|
|
|
$datCorp = $this->Amod->getData_Corp_bySTATUS(1);
|
|
|
|
$datStpos = $this->Amod->getData_SetTogglePosisi_byKARYAWAN_byMENU($id_karyawan, $id_menu);
|
|
if ($datStpos==FALSE) { $posisiToggle = 0; } else { $posisiToggle = $datStpos[0]['AKTIF_STPOS']; }
|
|
|
|
$data = array(
|
|
'sidebar' => "menu keuangan",
|
|
'navChild' => "keuangan ttkosong",
|
|
'tgl' => $now,
|
|
'id_menu' => $id_menu,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil,
|
|
'posisiToggle' => $posisiToggle,
|
|
'corp' => $datCorp,
|
|
'tk' => $datTk,
|
|
'countTk' => count($datTk),
|
|
);
|
|
$this->load->view('proses/KU_Sub3_TtKosong_1', $data);
|
|
}
|
|
|
|
public function KU_Ambil_Sub3_D1_DataDaftarTtKosong() {
|
|
$verse = $this->input->post('verse');
|
|
$id_tk = $this->input->post('id_tk');
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
|
|
if ($verse==1) {
|
|
$datTk = $this->Amod->getData_TtKosong_byKARYAWAN_bySTATUS($id_karyawan, 0);
|
|
if ($datTk==TRUE) {
|
|
$id_tk = $datTk[0]['ID_TK'];
|
|
} else {
|
|
$id_tk = NULL;
|
|
}
|
|
}
|
|
|
|
if ($id_tk==NULL) {
|
|
$datTk = NULL;
|
|
$id_pelanggan = "";
|
|
$id_corp = "";
|
|
$nama_pelanggan = "";
|
|
$ket_tk = "";
|
|
$tgl_tk = date('Y-m-d');
|
|
} else {
|
|
$datTk = $this->Amod->getData_TtKosong_byID($id_tk);
|
|
$nama_pelanggan = $datTk[0]['NAMA_PELANGGAN'];
|
|
$id_pelanggan = $datTk[0]['PELANGGAN_ID'];
|
|
$id_corp = $datTk[0]['CORP_ID'];
|
|
$ket_tk = $datTk[0]['KET_TK'];
|
|
$tgl_tk = $datTk[0]['TGL_TK'];
|
|
}
|
|
|
|
$data = $this->Amod->getData_DaftarTtKosong_byTK_orderASC($id_tk);
|
|
|
|
$this->output_json([
|
|
'total' => sizeof($data),
|
|
'data' => $data,
|
|
'id_corp' => $id_corp,
|
|
'id_pelanggan' => $id_pelanggan,
|
|
'nama_pelanggan' => $nama_pelanggan,
|
|
'ket_tk' => $ket_tk,
|
|
'tgl_tk' => $tgl_tk,
|
|
]);
|
|
}
|
|
|
|
public function KU_Tambah_Sub3_D1_DataDaftarTtKosong() {
|
|
$id_pelanggan = $this->input->post('id_pelanggan');
|
|
$id_corp = $this->input->post('id_corp');
|
|
$tgl_tk = $this->input->post('tgl_tk');
|
|
$ket_tk = $this->input->post('ket_tk');
|
|
$ket_tk = ltrim(rtrim(preg_replace('/\R+/', " " , $ket_tk)));
|
|
$nama_dtk = $this->input->post('nama');
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$value = 0;
|
|
$datTk = $this->Amod->getData_TtKosong_byKARYAWAN_bySTATUS($id_karyawan, 0);
|
|
if ($datTk==TRUE) {
|
|
$id_tk = $datTk[0]['ID_TK'];
|
|
if ($tgl_tk==NULL) {
|
|
$tgl_tk = $datTk[0]['TGL_TK'];
|
|
}
|
|
if ($id_corp==NULL) {
|
|
$id_corp = $datTk[0]['CORP_ID'];
|
|
}
|
|
if ($id_pelanggan==NULL) {
|
|
$id_pelanggan = $datTk[0]['PELANGGAN_ID'];
|
|
}
|
|
if ($ket_tk==NULL) {
|
|
$ket_tk = $datTk[0]['KET_TK'];
|
|
}
|
|
$update = [
|
|
'TGL_TK' => $tgl_tk,
|
|
'CORP_ID' => $id_corp,
|
|
'PELANGGAN_ID' => $id_pelanggan,
|
|
'KET_TK' => $ket_tk
|
|
];
|
|
$action = $this->Amod->update('tt_kosong', $update, 'ID_TK', $id_tk);
|
|
} else {
|
|
$input = [
|
|
'CIPTA_TK' => "Oleh $panggilan pada $timestamp",
|
|
'KARYAWAN_ID' => $id_karyawan,
|
|
'TGL_TK' => $tgl_tk,
|
|
'CORP_ID' => $id_corp,
|
|
'PELANGGAN_ID' => $id_pelanggan,
|
|
'KET_TK' => $ket_tk,
|
|
'STATUS_TK' => '0'
|
|
];
|
|
$action = $this->Amod->create('tt_kosong', $input);
|
|
|
|
$id_tk = $this->Amod->getMax_ID_TtKosong();
|
|
$id_tk = $id_tk[0]['ID_TK'];
|
|
}
|
|
|
|
$input = [
|
|
'TK_ID' => $id_tk,
|
|
'NAMA_DTK' => $nama_dtk
|
|
];
|
|
$action = $this->Amod->create('daftar_ttkosong', $input);
|
|
|
|
if ($action) {
|
|
$value = 1;
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value
|
|
]);
|
|
}
|
|
|
|
public function KU_Ubah_Sub3_D1_DataDaftarTtKosong() {
|
|
$id_dtk = $this->input->post('id_dtk');
|
|
$nama_dtk = $this->input->post('nama_dtk');
|
|
|
|
$value = 0;
|
|
$datDtk = $this->Amod->getData_DaftarTtKosong_byID($id_dtk);
|
|
if ($datDtk==FALSE) {
|
|
$value = 3;
|
|
} else {
|
|
$datTk = $this->Amod->getData_TtKosong_byID_bySTATUS($datDtk[0]['TK_ID'], 0);
|
|
if ($datTk==FALSE) {
|
|
$value = 2;
|
|
} else {
|
|
if ($nama_dtk==NULL) {
|
|
$nama_dtk = $datDtk[0]['NAMA_DTK'];
|
|
}
|
|
$update = [
|
|
'NAMA_DTK' => $nama_dtk
|
|
];
|
|
$action = $this->Amod->update('daftar_ttkosong', $update, 'ID_DTK', $id_dtk);
|
|
|
|
$value = 1;
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value
|
|
]);
|
|
}
|
|
|
|
public function KU_Hapus_Sub3_D1_DataDaftarTtKosong() {
|
|
$id_dtk = $this->input->post('id_dtk');
|
|
|
|
$value = 0;
|
|
$datDtk = $this->Amod->getData_DaftarTtKosong_byID($id_dtk);
|
|
if ($datDtk==FALSE) {
|
|
$value = 3;
|
|
} else {
|
|
$datTk = $this->Amod->getData_TtKosong_byID_bySTATUS($datDtk[0]['TK_ID'], 0);
|
|
if ($datTk==FALSE) {
|
|
$value = 2;
|
|
} else {
|
|
$action = $this->Amod->delete('daftar_ttkosong', $id_dtk, 'ID_DTK');
|
|
$value = 1;
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value
|
|
]);
|
|
}
|
|
|
|
public function KU_Kunci_Sub3_D1_DataTtKosong() {
|
|
$id_pelanggan = $this->input->post('id_pelanggan');
|
|
$id_corp = $this->input->post('id_corp');
|
|
$tgl_tk = $this->input->post('tgl_tk');
|
|
$ket_tk = $this->input->post('ket_tk');
|
|
$ket_tk = ltrim(rtrim(preg_replace('/\R+/', " " , $ket_tk)));
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$now = date('Y-m-d');
|
|
|
|
$value = 0;
|
|
$datTk = $this->Amod->getData_TtKosong_byKARYAWAN_bySTATUS($id_karyawan, 0);
|
|
if ($datTk==FALSE) {
|
|
$value = 2;
|
|
} else {
|
|
if ($id_pelanggan==NULL) {
|
|
$id_pelanggan = $datTk[0]['PELANGGAN_ID'];
|
|
}
|
|
if ($id_corp==NULL) {
|
|
$id_corp = $datTk[0]['CORP_ID'];
|
|
}
|
|
if ($tgl_tk==NULL) {
|
|
$tgl_tk = $datTk[0]['TGL_TK'];
|
|
}
|
|
if ($ket_tk==NULL) {
|
|
$ket_tk = $datTk[0]['KET_TK'];
|
|
}
|
|
|
|
$update = [
|
|
'TGL_TK' => $tgl_tk,
|
|
'PELANGGAN_ID' => $id_pelanggan,
|
|
'CORP_ID' => $id_corp,
|
|
'KET_TK' => $ket_tk,
|
|
'STATUS_TK' => '1'
|
|
];
|
|
$action = $this->Amod->update('tt_kosong', $update, 'ID_TK', $datTk[0]['ID_TK']);
|
|
|
|
$value = 1;
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value
|
|
]);
|
|
}
|
|
|
|
public function KU_Revisi_Sub3_D1_DataTtKosong() {
|
|
$id_tk = $this->input->post('id_tkrev');
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$datTk = $this->Amod->getData_TtKosong_byID_bySTATUS($id_tk, 1);
|
|
if ($datTk==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$cekTt = $this->Amod->getData_TtKosong_byKARYAWAN_bySTATUS($id_karyawan, 0);
|
|
if ($cekTt==TRUE) {
|
|
$update = [
|
|
'STATUS_TK' => '9'
|
|
];
|
|
$action = $this->Amod->update('tt_kosong', $update, 'ID_TK', $cekTt[0]['ID_TK']);
|
|
}
|
|
|
|
$update = [
|
|
'REVISI_TK' => "Oleh $panggilan pada $timestamp",
|
|
'STATUS_TK' => '0'
|
|
];
|
|
$action = $this->Amod->update('tt_kosong', $update, 'ID_TK', $id_tk);
|
|
|
|
if ($action) {
|
|
$this->session->set_flashdata('success', 'direvisi');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
} else {
|
|
$this->session->set_flashdata('failed', 'direvisi');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
}
|
|
|
|
public function KU_Cetak_Sub3_D1_DataTtKosong($id) {
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$datTk = $this->Amod->getData_TtKosong_byID($id);
|
|
$datDtk = $this->Amod->getData_DaftarTtKosong_byTK_orderASC($id);
|
|
|
|
$update = [
|
|
'CETAK_TK' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('tt_kosong', $update, 'ID_TK', $id);
|
|
|
|
$data = [
|
|
'tt' => $datTk,
|
|
'dtt' => $datDtk,
|
|
'count' => count($datDtk),
|
|
'kop' => $datTk[0]['CORP_ID'],
|
|
'jenis' => '2'
|
|
];
|
|
$this->load->view('cetak/TT_Cetak', $data);
|
|
}
|
|
|
|
//SUBMENU ADMINISTRASI - PENGINGAT PIUTANG
|
|
public function KU_Sub3_PengingatPiutang_1() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$now = date('Y-m-d');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "KU", "ADMINISTRASI - Pengingat Piutang");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$id_menu = $datShm[0]['MENU_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$datStpp = $this->Amod->getData_SetPengingatPiutang_byKARYAWAN($id_karyawan);
|
|
if ($datStpp==FALSE) {
|
|
$sales_id = 0;
|
|
$jt_stpp = $now;
|
|
$input = [
|
|
'KARYAWAN_ID' => $id_karyawan,
|
|
'SALES_ID' => $sales_id,
|
|
'JT_STPP' => $jt_stpp,
|
|
'TIMESTAMP' => $timestamp
|
|
];
|
|
$action = $this->Amod->create('set_pengingatpiutang', $input);
|
|
} else {
|
|
$jt_stpp = $datStpp[0]['JT_STPP'];
|
|
$sales_id = $datStpp[0]['SALES_ID'];
|
|
}
|
|
|
|
$datHhpda = $this->Amod->getData_HasilHitungPda_byKARYAWAN_byTEMPO_belumLunasOnly($sales_id, $jt_stpp);
|
|
$no = 0;
|
|
foreach ($datHhpda as $key) {
|
|
$datPda = $this->Amod->getSum_HasilHitungPda_byPELANGGAN_bySALES_byTEMPO_forPiutangDagang($key['PELANGGAN_ID'], $sales_id, $jt_stpp);
|
|
$datHhpda[$no++] += ['PDA' => $datPda];
|
|
}
|
|
|
|
$datSekarang = $this->Amod->getData_PengingatPiutang_beforeTGL_bySTATUS($now, 1);
|
|
$no = 0;
|
|
foreach ($datSekarang as $key) {
|
|
$datPda = $this->Amod->getSum_HasilHitungPda_byPELANGGAN_bySALES_byTEMPO_forPiutangDagang($key['PELANGGAN_ID'], $key['SALES_ID'], $key['FU_PPIU']);
|
|
$totNow = 0;
|
|
foreach ($datPda as $dat) {
|
|
$totNow = $totNow+round($dat['TOTAL'],2);
|
|
}
|
|
|
|
$datSekarang[$no] += ['TOT' => number_format($totNow,2)];
|
|
$datSekarang[$no++] += ['PDA' => $datPda];
|
|
}
|
|
|
|
$datTunggu = $this->Amod->getData_PengingatPiutang_afterTGL_bySTATUS($now, 1);
|
|
$no = 0;
|
|
foreach ($datTunggu as $key) {
|
|
$datPda = $this->Amod->getSum_HasilHitungPda_byPELANGGAN_bySALES_byTEMPO_forPiutangDagang($key['PELANGGAN_ID'], $key['SALES_ID'], $key['FU_PPIU']);
|
|
$totWait = 0;
|
|
foreach ($datPda as $dat) {
|
|
$totWait = $totWait+round($dat['TOTAL'],2);
|
|
}
|
|
|
|
$datTunggu[$no] += ['TOT' => number_format($totWait,2)];
|
|
$datTunggu[$no++] += ['PDA' => $datPda];
|
|
}
|
|
|
|
$datDt = $this->Amod->getData_DokumenTagihan_orderDESC();
|
|
|
|
$datSales = $this->Amod->getData_Karyawan_allSales();
|
|
$datPelanggan = $this->Amod->getData_Pelanggan_bySTATUS(1);
|
|
$datCorp = $this->Amod->getData_Corp_forPPH();
|
|
|
|
$datStpos = $this->Amod->getData_SetTogglePosisi_byKARYAWAN_byMENU($id_karyawan, $id_menu);
|
|
if ($datStpos==FALSE) { $posisiToggle = 0; } else { $posisiToggle = $datStpos[0]['AKTIF_STPOS']; }
|
|
|
|
$data = array(
|
|
'sidebar' => "menu keuangan",
|
|
'navChild' => "keuangan pengingatpiutang",
|
|
'hak' => $hak,
|
|
'id_menu' => $id_menu,
|
|
'tampil' => $tampil,
|
|
'posisiToggle' => $posisiToggle,
|
|
'jt_stpp' => $jt_stpp,
|
|
'tgl' => $now,
|
|
'sales_id' => $sales_id,
|
|
'sales' => $datSales,
|
|
'pelanggan' => $datPelanggan,
|
|
'corp' => $datCorp,
|
|
'hhpda' => $datHhpda,
|
|
'sekarang' => $datSekarang,
|
|
'tunggu' => $datTunggu,
|
|
'dt' => $datDt,
|
|
'countHhpda' => count($datHhpda),
|
|
'countSekarang' => count($datSekarang),
|
|
'countTunggu' => count($datTunggu),
|
|
);
|
|
$this->load->view('proses/KU_Sub3_PengingatPiutang_1', $data);
|
|
}
|
|
|
|
public function KU_Tambah_Sub3_E1_DataPengingatPiutang() {
|
|
$id_pelanggan = $this->input->post('id_pelanggannew');
|
|
$id_sales = $this->input->post('id_salesnew');
|
|
$fu_ppiu = $this->input->post('fu_ppiunew');
|
|
$ket_ppiu = $this->input->post('ket_ppiunew');
|
|
$ket_ppiu = preg_replace('/\R+/', " " , $ket_ppiu);
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$input = [
|
|
'CIPTA_PPIU' => "Oleh $panggilan pada $timestamp",
|
|
'PELANGGAN_ID' => $id_pelanggan,
|
|
'SALES_ID' => $id_sales,
|
|
'FU_PPIU' => $fu_ppiu,
|
|
'KET_PPIU' => $ket_ppiu,
|
|
'STATUS_PPIU' => '1'
|
|
];
|
|
$action = $this->Amod->create('pengingat_piutang', $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 KU_Ubah_Sub3_E1_DataPengingatPiutang() {
|
|
$id_ppiu = $this->input->post('id_ppiued');
|
|
$id_sales = $this->input->post('id_salesed');
|
|
$fu_ppiu = $this->input->post('fu_ppiued');
|
|
$ket_ppiu = $this->input->post('ket_ppiued');
|
|
$ket_ppiu = preg_replace('/\R+/', " " , $ket_ppiu);
|
|
|
|
$datPpiu = $this->Amod->getData_PengingatPiutang_byID_bySTATUS($id_ppiu, 1);
|
|
if ($datPpiu==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$update = [
|
|
'SALES_ID' => $id_sales,
|
|
'FU_PPIU' => $fu_ppiu,
|
|
'KET_PPIU' => $ket_ppiu
|
|
];
|
|
$action = $this->Amod->update('pengingat_piutang', $update, 'ID_PPIU', $id_ppiu);
|
|
|
|
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 KU_Hapus_Sub3_E1_DataPengingatPiutang() {
|
|
$id_ppiu = $this->input->post('id_ppiudel');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$datPpiu = $this->Amod->getData_PengingatPiutang_byID_bySTATUS($id_ppiu, 1);
|
|
if ($datPpiu==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$update = [
|
|
'STATUS_PPIU' => '0',
|
|
'HAPUS_PPIU' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('pengingat_piutang', $update, 'ID_PPIU', $id_ppiu);
|
|
|
|
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 KU_Kunci_Sub3_E1_DataPengingatPiutang() {
|
|
$id_ppiu = $this->input->post('id_ppiulock');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$datPpiu = $this->Amod->getData_PengingatPiutang_byID_bySTATUS($id_ppiu, 1);
|
|
if ($datPpiu==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$update = [
|
|
'STATUS_PPIU' => '2',
|
|
'KUNCI_PPIU' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('pengingat_piutang', $update, 'ID_PPIU', $id_ppiu);
|
|
|
|
if ($action) {
|
|
$this->session->set_flashdata('success', 'dikunci');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
} else {
|
|
$this->session->set_flashdata('failed', 'dikunci');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
}
|
|
|
|
public function KU_Simpan_Sub3_E1_DataDaftarDokumenTagihan() {
|
|
$id_hhpda = $this->input->post('id_hhpda');
|
|
|
|
//Check Konsistensi Data
|
|
$value = 0;
|
|
$datHhpda = $this->Amod->getData_HasilHitungPda_byID($id_hhpda);
|
|
if ($datHhpda==FALSE) {
|
|
$value = 2;
|
|
} else {
|
|
$input = [
|
|
'HHPDA_ID' => $id_hhpda
|
|
];
|
|
$action = $this->Amod->create('daftar_dokumentagihan', $input);
|
|
$value = 1;
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
|
|
}
|
|
|
|
public function KU_Simpan_Sub3_E1_DataDokumenTagihan() {
|
|
$id_pelanggan = $this->input->post('id_pelanggan');
|
|
$id_corp = $this->input->post('id_corp');
|
|
$id_sales = $this->input->post('id_sales');
|
|
$jt = $this->input->post('jt');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
//Check Konsistensi Data
|
|
$value = 0;
|
|
|
|
if ($id_sales=="") {
|
|
$id_sales = NULL;
|
|
}
|
|
|
|
$input = [
|
|
'CIPTA_DT' => "Oleh $panggilan pada $timestamp",
|
|
'PELANGGAN_ID' => $id_pelanggan,
|
|
'CORP_ID' => $id_corp,
|
|
'SALES_ID' => $id_sales,
|
|
'JT_DT' => $jt
|
|
];
|
|
$action = $this->Amod->create('dokumen_tagihan', $input);
|
|
|
|
$id_dt = $this->Amod->getMax_ID_DokumenTagihan();
|
|
$id_dt = $id_dt[0]['ID_DT'];
|
|
|
|
$datDdt = $this->Amod->getData_DaftarDokumenTagihan_DTNull();
|
|
foreach ($datDdt as $key) {
|
|
$update = [
|
|
'DT_ID' => $id_dt
|
|
];
|
|
$action = $this->Amod->update('daftar_dokumentagihan', $update, 'ID_DDT', $key['ID_DDT']);
|
|
}
|
|
|
|
if ($action) {
|
|
$value = 1;
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
|
|
}
|
|
|
|
public function KU_Cetak_Sub3_E1_DataDokumenTagihan($id) {
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$datDt = $this->Amod->getData_DokumenTagihan_byID($id);
|
|
|
|
$update = [
|
|
'CETAK_DT' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('dokumen_tagihan', $update, 'ID_DT', $id);
|
|
|
|
$hari = date_format(date_create($datDt[0]['JT_DT']), "d");
|
|
$bulan = date_format(date_create($datDt[0]['JT_DT']), "m");
|
|
$tahun = date_format(date_create($datDt[0]['JT_DT']), "Y");
|
|
$bulan = $this->Amod->generate_inisialMonth($bulan);
|
|
$tanggal = "Surabaya, $hari $bulan $tahun";
|
|
|
|
$tot = 0;
|
|
$barang = $this->Amod->getData_DaftarDokumenTagihan_byDT($id);
|
|
foreach ($barang as $key) {
|
|
$tot = $tot+round($key['TOTAL'],2);
|
|
}
|
|
|
|
if ($datDt[0]['CORP_ID']==1) {
|
|
$norek = "1070492233";
|
|
} else if ($datDt[0]['CORP_ID']==2) {
|
|
$norek = "1077111999";
|
|
} else if ($datDt[0]['CORP_ID']==4) {
|
|
$norek = "1070700111";
|
|
}
|
|
|
|
$data = [
|
|
'kodeBukti' => "",
|
|
'kop' => $datDt[0]['CORP_ID'],
|
|
'ref' => $datDt[0]['NAMA_CORP'],
|
|
'nama' => $datDt[0]['NAMA_PELANGGAN'],
|
|
'tempo' => $norek,
|
|
'pic' => "Finance/Account Payable",
|
|
'tanggal' => $tanggal,
|
|
'barang' => $barang,
|
|
'tot' => number_format($tot,2),
|
|
'tampilSn' => '2',
|
|
'tampilDp' => '2',
|
|
'tampilPpn' => '1',
|
|
'tampilJt' => $datDt[0]['JT']
|
|
];
|
|
$this->load->view('cetak/QL_Cetak', $data);
|
|
}
|
|
|
|
//SUBMENU PUSAT DATA - INFORMASI
|
|
public function KU_Informasi_PiutangDagang_1($id_kelompok) { // Validasi
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "KU", "PUSAT DATA - Informasi");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$datKelompok = $this->Amod->getData_Kelompok_bySTATUS(1);
|
|
|
|
$data = array(
|
|
'sidebar' => "menu keuangan",
|
|
'navChild' => "keuangan informasi",
|
|
'hak' => $hak,
|
|
'tampil' => $tampil,
|
|
'kelompok' => $datKelompok,
|
|
'id_kelompok' => $id_kelompok,
|
|
);
|
|
$this->load->view('proses/KU_Informasi_PiutangDagang_1', $data);
|
|
}
|
|
|
|
public function KU_Informasi_PiutangDagang_2($id) { // Validasi
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "KU", "PUSAT DATA - Informasi");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byPERKIRAAN_byPENJUALAN(3, $id);
|
|
$datPenjualan = $this->Amod->getData_Penjualan_byID($id);
|
|
|
|
$data = array(
|
|
'sidebar' => "dashboard",
|
|
'navChild' => "",
|
|
'hak' => $hak,
|
|
'dak' => $datDak,
|
|
'inv_penjualan' => $datPenjualan[0]['INV_PENJUALAN'],
|
|
);
|
|
$this->load->view('proses/KU_Informasi_PiutangDagang_2', $data);
|
|
}
|
|
|
|
public function KU_Ambil_JumlahData_InformasiPiutangDagang() { // Validasi
|
|
$id_kelompok = $this->input->post('id_kelompok');
|
|
|
|
if ($id_kelompok=="NoFilter") {
|
|
$id_kelompok = NULL;
|
|
}
|
|
|
|
$hmin3 = $this->Amod->getCount_HasilHitungPda_byKELOMPOK_belumLunasOnly($id_kelompok, 1);
|
|
$opname = $this->Amod->getCount_HasilHitungPda_byKELOMPOK_belumLunasOnly($id_kelompok, 2);
|
|
$sedang = $this->Amod->getCount_HasilHitungPda_byKELOMPOK_belumLunasOnly($id_kelompok, 3);
|
|
$belum = $this->Amod->getCount_HasilHitungPda_byKELOMPOK_belumLunasOnly($id_kelompok, 4);
|
|
$semua = $this->Amod->getCount_HasilHitungPda_byKELOMPOK_belumLunasOnly($id_kelompok, 5);
|
|
|
|
$sumhmin3 = $this->Amod->getSum_HasilHitungPda_byKELOMPOK_belumLunasOnly($id_kelompok, 1);
|
|
if ($sumhmin3==FALSE OR $sumhmin3[0]['SISA']==NULL) {
|
|
$sumhmin3 = 0;
|
|
} else {
|
|
$sumhmin3 = $sumhmin3[0]['SISA'];
|
|
}
|
|
|
|
$sumopname = $this->Amod->getSum_HasilHitungPda_byKELOMPOK_belumLunasOnly($id_kelompok, 2);
|
|
if ($sumopname==FALSE OR $sumopname[0]['SISA']==NULL) {
|
|
$sumopname = 0;
|
|
} else {
|
|
$sumopname = $sumopname[0]['SISA'];
|
|
}
|
|
|
|
$sumsedang = $this->Amod->getSum_HasilHitungPda_byKELOMPOK_belumLunasOnly($id_kelompok, 3);
|
|
if ($sumsedang==FALSE OR $sumsedang[0]['SISA']==NULL) {
|
|
$sumsedang = 0;
|
|
} else {
|
|
$sumsedang = $sumsedang[0]['SISA'];
|
|
}
|
|
|
|
$sumbelum = $this->Amod->getSum_HasilHitungPda_byKELOMPOK_belumLunasOnly($id_kelompok, 4);
|
|
if ($sumbelum==FALSE OR $sumbelum[0]['SISA']==NULL) {
|
|
$sumbelum = 0;
|
|
} else {
|
|
$sumbelum = $sumbelum[0]['SISA'];
|
|
}
|
|
|
|
$sumsemua = $this->Amod->getSum_HasilHitungPda_byKELOMPOK_belumLunasOnly($id_kelompok, 5);
|
|
if ($sumsemua==FALSE OR $sumsemua[0]['SISA']==NULL) {
|
|
$sumsemua = 0;
|
|
} else {
|
|
$sumsemua = $sumsemua[0]['SISA'];
|
|
}
|
|
|
|
$this->output_json([
|
|
'hmin3' => $hmin3,
|
|
'opname' => $opname,
|
|
'sedang' => $sedang,
|
|
'belum' => $belum,
|
|
'semua' => $semua,
|
|
'sumhmin3' => number_format($sumhmin3, 2),
|
|
'sumopname' => number_format($sumopname, 2),
|
|
'sumsedang' => number_format($sumsedang, 2),
|
|
'sumbelum' => number_format($sumbelum, 2),
|
|
'sumsemua' => number_format($sumsemua, 2),
|
|
]);
|
|
}
|
|
|
|
public function KU_Sub4_Informasi_1($id=null, $mode) {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "KU", "PUSAT DATA - Informasi");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
if ($id==null) {
|
|
$posisiToggle = 0;
|
|
} else {
|
|
$posisiToggle = $id;
|
|
}
|
|
|
|
$data = array(
|
|
'sidebar' => "menu keuangan",
|
|
'navChild' => "keuangan informasi",
|
|
'posisiToggle' => $posisiToggle,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil,
|
|
'mode' => $mode,
|
|
);
|
|
$this->load->view('proses/KU_Sub4_Informasi_1', $data);
|
|
}
|
|
|
|
//SUBMENU PUSAT DATA - LAPORAN
|
|
public function KU_Sub4_Laporan_1() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "KU", "PUSAT DATA - Laporan");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$data = array(
|
|
'sidebar' => "menu keuangan",
|
|
'navChild' => "keuangan laporan",
|
|
'hak' => $hak,
|
|
'tampil' => $tampil
|
|
);
|
|
$this->load->view('proses/KU_Sub4_Laporan_1', $data);
|
|
}
|
|
|
|
public function KU_Sub4_BiayaBensin_2() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$now = date('Y-m-d');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "KU", "PUSAT DATA - Laporan");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$datKendaraan = $this->Amod->getData_Kendaraan_bySTATUS(1);
|
|
|
|
$data = array(
|
|
'sidebar' => "menu keuangan",
|
|
'navChild' => "keuangan laporan",
|
|
'tgl' => $now,
|
|
'kendaraan' => $datKendaraan,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil
|
|
);
|
|
$this->load->view('proses/KU_Sub4_BiayaBensin_2', $data);
|
|
}
|
|
|
|
public function KU_Sub4_BiayaFee_2() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$now = date('Y-m-d');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "KU", "PUSAT DATA - Laporan");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$datPelanggan = $this->Amod->getData_Pelanggan_bySTATUS(1);
|
|
|
|
$data = array(
|
|
'sidebar' => "menu keuangan",
|
|
'navChild' => "keuangan laporan",
|
|
'tgl' => $now,
|
|
'pelanggan' => $datPelanggan,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil
|
|
);
|
|
$this->load->view('proses/KU_Sub4_BiayaFee_2', $data);
|
|
}
|
|
|
|
public function KU_Sub4_BiayaProyek_2() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$now = date('Y-m-d');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "KU", "PUSAT DATA - Laporan");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$datPelanggan = $this->Amod->getData_Pelanggan_bySTATUS(1);
|
|
$datUnitProyek = $this->Amod->getData_UnitProyek_bySTATUS(1);
|
|
$datKaryawan = $this->Amod->getData_Karyawan_forAkuntansi();
|
|
$datKendaraan = $this->Amod->getData_Kendaraan_bySTATUS(1);
|
|
|
|
$data = array(
|
|
'sidebar' => "menu keuangan",
|
|
'navChild' => "keuangan laporan",
|
|
'tgl' => $now,
|
|
'pelanggan' => $datPelanggan,
|
|
'unitproyek' => $datUnitProyek,
|
|
'karyawan' => $datKaryawan,
|
|
'kendaraan' => $datKendaraan,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil
|
|
);
|
|
$this->load->view('proses/KU_Sub4_BiayaProyek_2', $data);
|
|
}
|
|
|
|
public function KU_Sub4_BiayaServiceKendaraan_2() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$now = date('Y-m-d');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "KU", "PUSAT DATA - Laporan");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$datKendaraan = $this->Amod->getData_Kendaraan_bySTATUS(1);
|
|
|
|
$data = array(
|
|
'sidebar' => "menu keuangan",
|
|
'navChild' => "keuangan laporan",
|
|
'tgl' => $now,
|
|
'kendaraan' => $datKendaraan,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil
|
|
);
|
|
$this->load->view('proses/KU_Sub4_BiayaServiceKendaraan_2', $data);
|
|
}
|
|
|
|
public function KU_Sub4_DpPembelian_2() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$now = date('Y-m-d');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "KU", "PUSAT DATA - Laporan");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$datSupplier = $this->Amod->getData_Supplier_bySTATUS(1);
|
|
|
|
$data = array(
|
|
'sidebar' => "menu keuangan",
|
|
'navChild' => "keuangan laporan",
|
|
'tgl' => $now,
|
|
'supplier' => $datSupplier,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil
|
|
);
|
|
$this->load->view('proses/KU_Sub4_DpPembelian_2', $data);
|
|
}
|
|
|
|
public function KU_Sub4_DpPenjualan_2() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$now = date('Y-m-d');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "KU", "PUSAT DATA - Laporan");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$datPelanggan = $this->Amod->getData_Pelanggan_bySTATUS(1);
|
|
|
|
$data = array(
|
|
'sidebar' => "menu keuangan",
|
|
'navChild' => "keuangan laporan",
|
|
'tgl' => $now,
|
|
'pelanggan' => $datPelanggan,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil
|
|
);
|
|
$this->load->view('proses/KU_Sub4_DpPenjualan_2', $data);
|
|
}
|
|
|
|
public function KU_Sub4_FormFee_2() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$now = date('Y-m-d');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "KU", "PUSAT DATA - Laporan");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$datSales = $this->Amod->getData_Karyawan_allSales();
|
|
$datPelanggan = $this->Amod->getData_Pelanggan_bySTATUS(1);
|
|
|
|
$data = array(
|
|
'sidebar' => "menu keuangan",
|
|
'navChild' => "keuangan laporan",
|
|
'tgl' => $now,
|
|
'sales' => $datSales,
|
|
'pelanggan' => $datPelanggan,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil
|
|
);
|
|
$this->load->view('proses/KU_Sub4_FormFee_2', $data);
|
|
}
|
|
|
|
public function KU_Sub4_FormKaryawan_2() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$now = date('Y-m-d');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "KU", "PUSAT DATA - Laporan");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$datSales = $this->Amod->getData_Karyawan_SalesFormKaryawan();
|
|
$datKaryawan = $this->Amod->getData_Karyawan_forAkuntansi();
|
|
$datJfk = $this->Amod->getData_JenisFk();
|
|
|
|
$data = array(
|
|
'sidebar' => "menu keuangan",
|
|
'navChild' => "keuangan laporan",
|
|
'tgl' => $now,
|
|
'sales' => $datSales,
|
|
'karyawan' => $datKaryawan,
|
|
'jfk' => $datJfk,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil
|
|
);
|
|
$this->load->view('proses/KU_Sub4_FormKaryawan_2', $data);
|
|
}
|
|
|
|
public function KU_Sub4_HutangDagang_2() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$now = date('Y-m-d');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "KU", "PUSAT DATA - Laporan");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$datSupplier = $this->Amod->getData_Supplier_bySTATUS(1);
|
|
|
|
$data = array(
|
|
'sidebar' => "menu keuangan",
|
|
'navChild' => "keuangan laporan",
|
|
'tgl' => $now,
|
|
'supplier' => $datSupplier,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil
|
|
);
|
|
$this->load->view('proses/KU_Sub4_HutangDagang_2', $data);
|
|
}
|
|
|
|
public function KU_Sub4_PiutangDagang_2() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$now = date('Y-m-d');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "KU", "PUSAT DATA - Laporan");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$datPelanggan = $this->Amod->getData_Pelanggan_bySTATUS(1);
|
|
|
|
$data = array(
|
|
'sidebar' => "menu keuangan",
|
|
'navChild' => "keuangan laporan",
|
|
'tgl' => $now,
|
|
'pelanggan' => $datPelanggan,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil
|
|
);
|
|
$this->load->view('proses/KU_Sub4_PiutangDagang_2', $data);
|
|
}
|
|
|
|
public function KU_Sub4_PiutangKaryawan_2() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$now = date('Y-m-d');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "KU", "PUSAT DATA - Laporan");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$datKaryawan = $this->Amod->getData_Karyawan_forAkuntansi();
|
|
|
|
$data = array(
|
|
'sidebar' => "menu keuangan",
|
|
'navChild' => "keuangan laporan",
|
|
'tgl' => $now,
|
|
'karyawan' => $datKaryawan,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil
|
|
);
|
|
$this->load->view('proses/KU_Sub4_PiutangKaryawan_2', $data);
|
|
}
|
|
|
|
public function KU_Sub4_PiutangPihakke3_2() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$now = date('Y-m-d');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "KU", "PUSAT DATA - Laporan");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$datPihakke3 = $this->Amod->getData_Pihakke3_bySTATUS(1);
|
|
|
|
$data = array(
|
|
'sidebar' => "menu keuangan",
|
|
'navChild' => "keuangan laporan",
|
|
'tgl' => $now,
|
|
'pihakke3' => $datPihakke3,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil
|
|
);
|
|
$this->load->view('proses/KU_Sub4_PiutangPihakke3_2', $data);
|
|
}
|
|
|
|
public function KU_Sub4_SaldoBank_2() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$now = date('Y-m-d');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "KU", "PUSAT DATA - Laporan");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$datBank = $this->Amod->getData_Bank_bySTATUS(1);
|
|
|
|
$data = array(
|
|
'sidebar' => "menu keuangan",
|
|
'navChild' => "keuangan laporan",
|
|
'tgl' => $now,
|
|
'bank' => $datBank,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil
|
|
);
|
|
$this->load->view('proses/KU_Sub4_SaldoBank_2', $data);
|
|
}
|
|
|
|
public function KU_Sub4_SaldoKas_2() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$now = date('Y-m-d');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "KU", "PUSAT DATA - Laporan");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$datKas = $this->Amod->getData_Kas_bySTATUS(1);
|
|
|
|
$data = array(
|
|
'sidebar' => "menu keuangan",
|
|
'navChild' => "keuangan laporan",
|
|
'tgl' => $now,
|
|
'kas' => $datKas,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil
|
|
);
|
|
$this->load->view('proses/KU_Sub4_SaldoKas_2', $data);
|
|
}
|
|
|
|
public function KU_Sub4_Neraca_2() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$now = date('Y-m-d');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "KU", "PUSAT DATA - Laporan");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$datPak = $this->Amod->getData_PeriodeAkuntansi_bySTATUS(1);
|
|
|
|
$data = array(
|
|
'sidebar' => "menu keuangan",
|
|
'navChild' => "keuangan laporan",
|
|
'tgl' => $now,
|
|
'pak' => $datPak,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil
|
|
);
|
|
$this->load->view('proses/KU_Sub4_Neraca_2', $data);
|
|
}
|
|
|
|
public function KU_Sub4_Perkiraan_2() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$now = date('Y-m-d');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "KU", "PUSAT DATA - Laporan");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$datPerkiraan = $this->Amod->getData_Perkiraan_bySTATUS(1);
|
|
|
|
$data = array(
|
|
'sidebar' => "menu keuangan",
|
|
'navChild' => "keuangan laporan",
|
|
'tgl' => $now,
|
|
'perkiraan' => $datPerkiraan,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil
|
|
);
|
|
$this->load->view('proses/KU_Sub4_Perkiraan_2', $data);
|
|
}
|
|
|
|
public function KU_Sub4_RekapPajak_2() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$now = date('Y-m-d');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "KU", "PUSAT DATA - Laporan");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$datCorp = $this->Amod->getData_Corp_forPPH();
|
|
|
|
$data = array(
|
|
'sidebar' => "menu keuangan",
|
|
'navChild' => "keuangan laporan",
|
|
'tgl' => $now,
|
|
'corp' => $datCorp,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil
|
|
);
|
|
$this->load->view('proses/KU_Sub4_RekapPajak_2', $data);
|
|
}
|
|
|
|
public function KU_Sub4_RincianHutang_2() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$now = date('Y-m-d');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "KU", "PUSAT DATA - Laporan");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$datSupplier = $this->Amod->getData_Supplier_bySTATUS(1);
|
|
$datCorp = $this->Amod->getData_Kop();
|
|
|
|
$data = array(
|
|
'sidebar' => "menu keuangan",
|
|
'navChild' => "keuangan laporan",
|
|
'tgl' => $now,
|
|
'supplier' => $datSupplier,
|
|
'corp' => $datCorp,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil
|
|
);
|
|
$this->load->view('proses/KU_Sub4_RincianHutang_2', $data);
|
|
}
|
|
|
|
public function KU_Sub4_RincianPiutang_2() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$now = date('Y-m-d');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "KU", "PUSAT DATA - Laporan");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$datPelanggan = $this->Amod->getData_Pelanggan_bySTATUS(1);
|
|
$datSales = $this->Amod->getData_Karyawan_allSales();
|
|
$datCorp = $this->Amod->getData_Kop();
|
|
|
|
$data = array(
|
|
'sidebar' => "menu keuangan",
|
|
'navChild' => "keuangan laporan",
|
|
'tgl' => $now,
|
|
'pelanggan' => $datPelanggan,
|
|
'sales' => $datSales,
|
|
'corp' => $datCorp,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil
|
|
);
|
|
$this->load->view('proses/KU_Sub4_RincianPiutang_2', $data);
|
|
}
|
|
|
|
public function KU_Sub4_TransaksiKeuangan_2() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$now = date('Y-m-d');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "KU", "PUSAT DATA - Laporan");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$data = array(
|
|
'sidebar' => "menu keuangan",
|
|
'navChild' => "keuangan laporan",
|
|
'tgl' => $now,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil
|
|
);
|
|
$this->load->view('proses/KU_Sub4_TransaksiKeuangan_2', $data);
|
|
}
|
|
|
|
public function KU_Sub4_TrialBalance_2() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$now = date('Y-m-d');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "KU", "PUSAT DATA - Laporan");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$data = array(
|
|
'sidebar' => "menu keuangan",
|
|
'navChild' => "keuangan laporan",
|
|
'tgl' => $now,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil
|
|
);
|
|
$this->load->view('proses/KU_Sub4_TrialBalance_2', $data);
|
|
}
|
|
|
|
public function KU_Ambil_Sub4_PeriodeTrialBalance() {
|
|
$model = $this->input->post('model');
|
|
$year = date('Y');
|
|
|
|
if ($model==1) {
|
|
$data = $this->Amod->getData_PeriodeAkuntansi_bySTATUS(1);
|
|
} else if ($model==2) {
|
|
$data = [];
|
|
$no = 0;
|
|
for ($i=2022; $i<=$year; $i++) {
|
|
$data[$no++] = [
|
|
'ID_PAK' => $i,
|
|
'NAMA_PAK' => "PERIODE TAHUN $i",
|
|
'AWAL' => "01/01/$i",
|
|
'AKHIR' => "31/12/$i"
|
|
];
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'data' => $data,
|
|
]);
|
|
}
|
|
|
|
public function KU_Ambil_Sub4_DataPembukuanBiayaBensin() {
|
|
$id_kendaraan = $this->input->post('id_kendaraan');
|
|
$awal = $this->input->post('awal');
|
|
$akhir = $this->input->post('akhir');
|
|
$search = $this->input->post('search');
|
|
|
|
if ($id_kendaraan=="") {
|
|
$id_kendaraan = NULL;
|
|
}
|
|
|
|
$data = $this->Amod->getData_DaftarAkuntansi_byPERKIRAAN_byKENDARAAN_byPERIODE_forSearch(34, $id_kendaraan, $awal, $akhir, $search);
|
|
$no = 0;
|
|
$totDebet = 0;
|
|
$totKredit = 0;
|
|
$totBiaya = 0;
|
|
foreach ($data as $key) {
|
|
$totDebet = $totDebet+$key['DEBET_DAK'];
|
|
$totKredit = $totKredit+$key['KREDIT_DAK'];
|
|
$totBiaya = $totBiaya+$key['DEBET_DAK']-$key['KREDIT_DAK'];
|
|
|
|
$data[$no] += ['DEBET' => number_format($key['DEBET_DAK'], 2)];
|
|
$data[$no] += ['KREDIT' => number_format($key['KREDIT_DAK'], 2)];
|
|
$data[$no++] += ['SUBTOTAL' => number_format($totBiaya, 2)];
|
|
}
|
|
|
|
$this->output_json([
|
|
'data' => $data,
|
|
'totBiaya' => number_format($totBiaya,2),
|
|
]);
|
|
}
|
|
|
|
public function KU_Ambil_Sub4_DataPembukuanBiayaFee() {
|
|
$id_pelanggan = $this->input->post('id_pelanggan');
|
|
$awal = $this->input->post('awal');
|
|
$akhir = $this->input->post('akhir');
|
|
$search = $this->input->post('search');
|
|
|
|
if ($id_pelanggan=="") {
|
|
$id_pelanggan = NULL;
|
|
}
|
|
|
|
$data = $this->Amod->getData_DaftarAkuntansi_byPERKIRAAN_byPELANGGAN_byPERIODE_forSearch(64, $id_pelanggan, $awal, $akhir, $search);
|
|
$no = 0;
|
|
$totDebet = 0;
|
|
$totKredit = 0;
|
|
$totBiaya = 0;
|
|
foreach ($data as $key) {
|
|
$totDebet = $totDebet+$key['DEBET_DAK'];
|
|
$totKredit = $totKredit+$key['KREDIT_DAK'];
|
|
$totBiaya = $totBiaya+$key['DEBET_DAK']-$key['KREDIT_DAK'];
|
|
|
|
$data[$no] += ['DEBET' => number_format($key['DEBET_DAK'], 2)];
|
|
$data[$no] += ['KREDIT' => number_format($key['KREDIT_DAK'], 2)];
|
|
$data[$no++] += ['SUBTOTAL' => number_format($totBiaya, 2)];
|
|
}
|
|
|
|
$this->output_json([
|
|
'data' => $data,
|
|
'totBiaya' => number_format($totBiaya,2),
|
|
]);
|
|
}
|
|
|
|
public function KU_Ambil_Sub4_DataPembukuanBiayaProyek() {
|
|
$id_pelanggan = $this->input->post('id_pelanggan');
|
|
$id_unitproyek = $this->input->post('id_unitproyek');
|
|
$id_karyawan = $this->input->post('id_karyawan');
|
|
$id_kendaraan = $this->input->post('id_kendaraan');
|
|
$awal = $this->input->post('awal');
|
|
$akhir = $this->input->post('akhir');
|
|
$search = $this->input->post('search');
|
|
|
|
if ($id_pelanggan=="") {
|
|
$id_pelanggan = NULL;
|
|
}
|
|
|
|
if ($id_unitproyek=="") {
|
|
$id_unitproyek = NULL;
|
|
}
|
|
|
|
if ($id_karyawan=="") {
|
|
$id_karyawan = NULL;
|
|
}
|
|
|
|
if ($id_kendaraan=="") {
|
|
$id_kendaraan = NULL;
|
|
}
|
|
|
|
$data = $this->Amod->getData_DaftarAkuntansi_byPELANGGAN_byUNITPROYEK_byKARYAWAN_byKENDARAAN_byPERIODE_forSearchProyek($id_pelanggan, $id_unitproyek, $id_karyawan, $id_kendaraan, $awal, $akhir, $search);
|
|
$no = 0;
|
|
$totDebet = 0;
|
|
$totKredit = 0;
|
|
$totBiaya = 0;
|
|
foreach ($data as $key) {
|
|
$totDebet = $totDebet+$key['DEBET_DAK'];
|
|
$totKredit = $totKredit+$key['KREDIT_DAK'];
|
|
$totBiaya = $totBiaya+$key['DEBET_DAK']-$key['KREDIT_DAK'];
|
|
|
|
$data[$no] += ['DEBET' => number_format($key['DEBET_DAK'], 2)];
|
|
$data[$no] += ['KREDIT' => number_format($key['KREDIT_DAK'], 2)];
|
|
$data[$no++] += ['SUBTOTAL' => number_format($totBiaya, 2)];
|
|
}
|
|
|
|
$this->output_json([
|
|
'data' => $data,
|
|
'totBiaya' => number_format($totBiaya,2),
|
|
]);
|
|
}
|
|
|
|
public function KU_Ambil_Sub4_DataPembukuanBiayaServiceKendaraan() {
|
|
$id_kendaraan = $this->input->post('id_kendaraan');
|
|
$awal = $this->input->post('awal');
|
|
$akhir = $this->input->post('akhir');
|
|
$search = $this->input->post('search');
|
|
|
|
if ($id_kendaraan=="") {
|
|
$id_kendaraan = NULL;
|
|
}
|
|
|
|
$data = $this->Amod->getData_DaftarAkuntansi_byPERKIRAAN_byKENDARAAN_byPERIODE_forSearch(33, $id_kendaraan, $awal, $akhir, $search);
|
|
$no = 0;
|
|
$totDebet = 0;
|
|
$totKredit = 0;
|
|
$totBiaya = 0;
|
|
foreach ($data as $key) {
|
|
$totDebet = $totDebet+$key['DEBET_DAK'];
|
|
$totKredit = $totKredit+$key['KREDIT_DAK'];
|
|
$totBiaya = $totBiaya+$key['DEBET_DAK']-$key['KREDIT_DAK'];
|
|
|
|
$data[$no] += ['DEBET' => number_format($key['DEBET_DAK'], 2)];
|
|
$data[$no] += ['KREDIT' => number_format($key['KREDIT_DAK'], 2)];
|
|
$data[$no++] += ['SUBTOTAL' => number_format($totBiaya, 2)];
|
|
}
|
|
|
|
$this->output_json([
|
|
'data' => $data,
|
|
'totBiaya' => number_format($totBiaya,2),
|
|
]);
|
|
}
|
|
|
|
public function KU_Ambil_Sub4_DataPembukuanDpPembelian() {
|
|
$id_supplier = $this->input->post('id_supplier');
|
|
$awal = $this->input->post('awal');
|
|
$akhir = $this->input->post('akhir');
|
|
$search = $this->input->post('search');
|
|
$limit = $this->Amod->generate_subDay($awal, 1);
|
|
|
|
if ($id_supplier=="") {
|
|
$id_supplier = NULL;
|
|
}
|
|
|
|
if ($id_supplier==NULL) {
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_beforeTGL(7, $limit);
|
|
} else {
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_bySUPPLIER_beforeTGL(7, $id_supplier, $limit);
|
|
}
|
|
|
|
if ($sumDak==FALSE OR $sumDak[0]['DEBET']==NULL OR $sumDak[0]['KREDIT']==NULL) {
|
|
$totDebet = 0;
|
|
$totKredit = 0;
|
|
$totDp = 0;
|
|
} else {
|
|
$totDebet = $sumDak[0]['DEBET'];
|
|
$totKredit = $sumDak[0]['KREDIT'];
|
|
$totDp = $totDebet-$totKredit;
|
|
}
|
|
|
|
$data = [];
|
|
$noData = 0;
|
|
|
|
$data[$noData++] = [
|
|
'KODE_AKUNTANSI' => "Saldo Awal",
|
|
'TANGGAL' => date_format(date_create($limit), "d/m/Y"),
|
|
'NAMA_SUPPLIER' => "",
|
|
'NAMA_KOTA' => "",
|
|
'CIPTA_DAK' => "",
|
|
'KET_DAK' => "~",
|
|
'DEBET' => number_format($totDebet,2),
|
|
'KREDIT' => number_format($totKredit,2),
|
|
'SUBTOTAL' => number_format($totDp,2),
|
|
];
|
|
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byPERKIRAAN_bySUPPLIER_byPERIODE_forSearch(7, $id_supplier, $awal, $akhir, $search);
|
|
$no = 0;
|
|
foreach ($datDak as $key) {
|
|
$totDebet = $totDebet+$key['DEBET_DAK'];
|
|
$totKredit = $totKredit+$key['KREDIT_DAK'];
|
|
$totDp = $totDp+$key['DEBET_DAK']-$key['KREDIT_DAK'];
|
|
|
|
$datDak[$no] += ['DEBET' => number_format($key['DEBET_DAK'], 2)];
|
|
$datDak[$no] += ['KREDIT' => number_format($key['KREDIT_DAK'], 2)];
|
|
$datDak[$no++] += ['SUBTOTAL' => number_format($totDp, 2)];
|
|
}
|
|
|
|
foreach ($datDak as $key) {
|
|
$data[$noData++] = $key;
|
|
}
|
|
|
|
$this->output_json([
|
|
'data' => $data,
|
|
'totDp' => number_format($totDp,2),
|
|
]);
|
|
}
|
|
|
|
public function KU_Ambil_Sub4_DataPembukuanDpPenjualan() {
|
|
$id_pelanggan = $this->input->post('id_pelanggan');
|
|
$awal = $this->input->post('awal');
|
|
$akhir = $this->input->post('akhir');
|
|
$search = $this->input->post('search');
|
|
$limit = $this->Amod->generate_subDay($awal, 1);
|
|
|
|
if ($id_pelanggan=="") {
|
|
$id_pelanggan = NULL;
|
|
}
|
|
|
|
if ($id_pelanggan==NULL) {
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_beforeTGL(19, $limit);
|
|
} else {
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPELANGGAN_beforeTGL(19, $id_pelanggan, $limit);
|
|
}
|
|
|
|
if ($sumDak==FALSE OR $sumDak[0]['DEBET']==NULL OR $sumDak[0]['KREDIT']==NULL) {
|
|
$totDebet = 0;
|
|
$totKredit = 0;
|
|
$totDp = 0;
|
|
} else {
|
|
$totDebet = $sumDak[0]['DEBET'];
|
|
$totKredit = $sumDak[0]['KREDIT'];
|
|
$totDp = $totKredit-$totDebet;
|
|
}
|
|
|
|
$data = [];
|
|
$noData = 0;
|
|
|
|
$data[$noData++] = [
|
|
'KODE_AKUNTANSI' => "Saldo Awal",
|
|
'TANGGAL' => date_format(date_create($limit), "d/m/Y"),
|
|
'NAMA_PELANGGAN' => "",
|
|
'NAMA_KOTA' => "",
|
|
'CIPTA_DAK' => "",
|
|
'KET_DAK' => "~",
|
|
'DEBET' => number_format($totDebet,2),
|
|
'KREDIT' => number_format($totKredit,2),
|
|
'SUBTOTAL' => number_format($totDp,2),
|
|
];
|
|
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byPERKIRAAN_byPELANGGAN_byPERIODE_forSearch(19, $id_pelanggan, $awal, $akhir, $search);
|
|
$no = 0;
|
|
foreach ($datDak as $key) {
|
|
$totDebet = $totDebet+$key['DEBET_DAK'];
|
|
$totKredit = $totKredit+$key['KREDIT_DAK'];
|
|
$totDp = $totDp+$key['KREDIT_DAK']-$key['DEBET_DAK'];
|
|
|
|
$datDak[$no] += ['DEBET' => number_format($key['DEBET_DAK'], 2)];
|
|
$datDak[$no] += ['KREDIT' => number_format($key['KREDIT_DAK'], 2)];
|
|
$datDak[$no++] += ['SUBTOTAL' => number_format($totDp, 2)];
|
|
}
|
|
|
|
foreach ($datDak as $key) {
|
|
$data[$noData++] = $key;
|
|
}
|
|
|
|
$this->output_json([
|
|
'data' => $data,
|
|
'totDp' => number_format($totDp,2),
|
|
]);
|
|
}
|
|
|
|
public function KU_Ambil_Sub4_DataPembukuanFormFee() {
|
|
$id_sales = $this->input->post('id_sales');
|
|
$id_pelanggan = $this->input->post('id_pelanggan');
|
|
$jenis = $this->input->post('jenis');
|
|
$awal = $this->input->post('awal');
|
|
$akhir = $this->input->post('akhir');
|
|
$search = $this->input->post('search');
|
|
|
|
if ($id_sales=="") {
|
|
$id_sales = NULL;
|
|
}
|
|
|
|
if ($id_pelanggan=="") {
|
|
$id_pelanggan = NULL;
|
|
}
|
|
|
|
if ($jenis=="") {
|
|
$jenis = NULL;
|
|
}
|
|
|
|
$data = $this->Amod->getData_FormFeePelanggan_bySALES_byPELANGGAN_byJENIS_byPERIODE_bySEARCH_status01($id_sales, $id_pelanggan, $jenis, $awal, $akhir, $search);
|
|
$totFee = 0;
|
|
foreach ($data as $key) {
|
|
$totFee = $totFee+$key['NILAI_FFP'];
|
|
}
|
|
|
|
$this->output_json([
|
|
'data' => $data,
|
|
'totFee' => number_format($totFee,2),
|
|
]);
|
|
}
|
|
|
|
public function KU_Ambil_Sub4_DataPembukuanFormKaryawan() {
|
|
$id_sales = $this->input->post('id_sales');
|
|
$id_karyawan = $this->input->post('id_karyawan');
|
|
$jenis = $this->input->post('jenis');
|
|
$awal = $this->input->post('awal');
|
|
$akhir = $this->input->post('akhir');
|
|
$search = $this->input->post('search');
|
|
|
|
if ($id_sales=="") {
|
|
$id_sales = NULL;
|
|
}
|
|
|
|
if ($id_karyawan=="") {
|
|
$id_karyawan = NULL;
|
|
}
|
|
|
|
if ($jenis=="") {
|
|
$jenis = NULL;
|
|
}
|
|
|
|
$data = $this->Amod->getData_FormKaryawan_bySALES_byKARYAWAN_byJENIS_byPERIODE_bySEARCH_status1($id_sales, $id_karyawan, $jenis, $awal, $akhir, $search);
|
|
$totNilai = 0;
|
|
$no = 0;
|
|
foreach ($data as $key) {
|
|
$datDffk = $this->Amod->getData_DaftarFormKaryawan_byFK($key['ID_FK']);
|
|
$noket = 1;
|
|
$list = "";
|
|
foreach ($datDffk as $dat) {
|
|
$nilai = $dat['NILAI'];
|
|
$ket = $dat['KET_DFFK'];
|
|
$list .= "[$noket] <b style='color:Chocolate'>$ket</b> ($nilai)<br \>";
|
|
$noket++;
|
|
}
|
|
|
|
$data[$no++] += ['LIST' => $list];
|
|
$totNilai = $totNilai+$key['NILAI_FK'];
|
|
}
|
|
|
|
$this->output_json([
|
|
'data' => $data,
|
|
'totNilai' => number_format($totNilai,2),
|
|
]);
|
|
}
|
|
|
|
public function KU_Ambil_Sub4_DataPembukuanHutangDagang() {
|
|
$id_supplier = $this->input->post('id_supplier');
|
|
$awal = $this->input->post('awal');
|
|
$akhir = $this->input->post('akhir');
|
|
$search = $this->input->post('search');
|
|
$limit = $this->Amod->generate_subDay($awal, 1);
|
|
|
|
if ($id_supplier=="") {
|
|
$id_supplier = NULL;
|
|
}
|
|
|
|
if ($id_supplier==NULL) {
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_beforeTGL(15, $limit);
|
|
} else {
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_bySUPPLIER_beforeTGL(15, $id_supplier, $limit);
|
|
}
|
|
|
|
if ($sumDak==FALSE OR $sumDak[0]['DEBET']==NULL OR $sumDak[0]['KREDIT']==NULL) {
|
|
$totDebet = 0;
|
|
$totKredit = 0;
|
|
$totHutang = 0;
|
|
} else {
|
|
$totDebet = $sumDak[0]['DEBET'];
|
|
$totKredit = $sumDak[0]['KREDIT'];
|
|
$totHutang = $totKredit-$totDebet;
|
|
}
|
|
|
|
$data = [];
|
|
$noData = 0;
|
|
|
|
$data[$noData++] = [
|
|
'KODE_AKUNTANSI' => "Saldo Awal",
|
|
'TANGGAL' => date_format(date_create($limit), "d/m/Y"),
|
|
'NAMA_SUPPLIER' => "",
|
|
'NAMA_KOTA' => "",
|
|
'CIPTA_DAK' => "",
|
|
'KET_DAK' => "~",
|
|
'DEBET' => number_format($totDebet,2),
|
|
'KREDIT' => number_format($totKredit,2),
|
|
'SUBTOTAL' => number_format($totHutang,2),
|
|
];
|
|
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byPERKIRAAN_bySUPPLIER_byPERIODE_forSearch(15, $id_supplier, $awal, $akhir, $search);
|
|
$no = 0;
|
|
foreach ($datDak as $key) {
|
|
$totDebet = $totDebet+$key['DEBET_DAK'];
|
|
$totKredit = $totKredit+$key['KREDIT_DAK'];
|
|
$totHutang = $totHutang+$key['KREDIT_DAK']-$key['DEBET_DAK'];
|
|
|
|
$datDak[$no] += ['DEBET' => number_format($key['DEBET_DAK'], 2)];
|
|
$datDak[$no] += ['KREDIT' => number_format($key['KREDIT_DAK'], 2)];
|
|
$datDak[$no++] += ['SUBTOTAL' => number_format($totHutang, 2)];
|
|
}
|
|
|
|
foreach ($datDak as $key) {
|
|
$data[$noData++] = $key;
|
|
}
|
|
|
|
$this->output_json([
|
|
'data' => $data,
|
|
'totHutang' => number_format($totHutang,2),
|
|
]);
|
|
}
|
|
|
|
public function KU_Ambil_Sub4_DataPembukuanPiutangDagang() {
|
|
$id_pelanggan = $this->input->post('id_pelanggan');
|
|
$awal = $this->input->post('awal');
|
|
$akhir = $this->input->post('akhir');
|
|
$search = $this->input->post('search');
|
|
$limit = $this->Amod->generate_subDay($awal, 1);
|
|
|
|
if ($id_pelanggan=="") {
|
|
$id_pelanggan = NULL;
|
|
}
|
|
|
|
if ($id_pelanggan==NULL) {
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_beforeTGL(3, $limit);
|
|
} else {
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPELANGGAN_beforeTGL(3, $id_pelanggan, $limit);
|
|
}
|
|
|
|
if ($sumDak==FALSE OR $sumDak[0]['DEBET']==NULL OR $sumDak[0]['KREDIT']==NULL) {
|
|
$totDebet = 0;
|
|
$totKredit = 0;
|
|
$totPiutang = 0;
|
|
} else {
|
|
$totDebet = $sumDak[0]['DEBET'];
|
|
$totKredit = $sumDak[0]['KREDIT'];
|
|
$totPiutang = $totDebet-$totKredit;
|
|
}
|
|
|
|
$data = [];
|
|
$noData = 0;
|
|
|
|
$data[$noData++] = [
|
|
'KODE_AKUNTANSI' => "Saldo Awal",
|
|
'TANGGAL' => date_format(date_create($limit), "d/m/Y"),
|
|
'NAMA_PELANGGAN' => "",
|
|
'NAMA_KOTA' => "",
|
|
'CIPTA_DAK' => "",
|
|
'KET_DAK' => "~",
|
|
'DEBET' => number_format($totDebet,2),
|
|
'KREDIT' => number_format($totKredit,2),
|
|
'SUBTOTAL' => number_format($totPiutang,2),
|
|
];
|
|
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byPERKIRAAN_byPELANGGAN_byPERIODE_forSearch(3, $id_pelanggan, $awal, $akhir, $search);
|
|
$no = 0;
|
|
foreach ($datDak as $key) {
|
|
$totDebet = $totDebet+$key['DEBET_DAK'];
|
|
$totKredit = $totKredit+$key['KREDIT_DAK'];
|
|
$totPiutang = $totPiutang+$key['DEBET_DAK']-$key['KREDIT_DAK'];
|
|
|
|
$datDak[$no] += ['DEBET' => number_format($key['DEBET_DAK'], 2)];
|
|
$datDak[$no] += ['KREDIT' => number_format($key['KREDIT_DAK'], 2)];
|
|
$datDak[$no++] += ['SUBTOTAL' => number_format($totPiutang, 2)];
|
|
}
|
|
|
|
foreach ($datDak as $key) {
|
|
$data[$noData++] = $key;
|
|
}
|
|
|
|
$this->output_json([
|
|
'data' => $data,
|
|
'totPiutang' => number_format($totPiutang,2),
|
|
]);
|
|
}
|
|
|
|
public function KU_Ambil_Sub4_DataPembukuanPiutangKaryawan() {
|
|
$id_karyawan = $this->input->post('id_karyawan');
|
|
$awal = $this->input->post('awal');
|
|
$akhir = $this->input->post('akhir');
|
|
$search = $this->input->post('search');
|
|
$limit = $this->Amod->generate_subDay($awal, 1);
|
|
|
|
if ($id_karyawan=="") {
|
|
$id_karyawan = NULL;
|
|
}
|
|
|
|
if ($id_karyawan==NULL) {
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_beforeTGL(5, $limit);
|
|
} else {
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byKARYAWAN_beforeTGL(5, $id_karyawan, $limit);
|
|
}
|
|
|
|
if ($sumDak==FALSE OR $sumDak[0]['DEBET']==NULL OR $sumDak[0]['KREDIT']==NULL) {
|
|
$totDebet = 0;
|
|
$totKredit = 0;
|
|
$totPiutang = 0;
|
|
} else {
|
|
$totDebet = $sumDak[0]['DEBET'];
|
|
$totKredit = $sumDak[0]['KREDIT'];
|
|
$totPiutang = $totDebet-$totKredit;
|
|
}
|
|
|
|
$data = [];
|
|
$noData = 0;
|
|
|
|
$data[$noData++] = [
|
|
'KODE_AKUNTANSI' => "Saldo Awal",
|
|
'TANGGAL' => date_format(date_create($limit), "d/m/Y"),
|
|
'NAMA_PANGGILAN_KARYAWAN' => "",
|
|
'NAMA_JABATAN' => "",
|
|
'CIPTA_DAK' => "",
|
|
'KET_DAK' => "~",
|
|
'DEBET' => number_format($totDebet,2),
|
|
'KREDIT' => number_format($totKredit,2),
|
|
'SUBTOTAL' => number_format($totPiutang,2),
|
|
];
|
|
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byPERKIRAAN_byKARYAWAN_byPERIODE_forSearch(5, $id_karyawan, $awal, $akhir, $search);
|
|
$no = 0;
|
|
foreach ($datDak as $key) {
|
|
$totDebet = $totDebet+$key['DEBET_DAK'];
|
|
$totKredit = $totKredit+$key['KREDIT_DAK'];
|
|
$totPiutang = $totPiutang+$key['DEBET_DAK']-$key['KREDIT_DAK'];
|
|
|
|
$datDak[$no] += ['DEBET' => number_format($key['DEBET_DAK'], 2)];
|
|
$datDak[$no] += ['KREDIT' => number_format($key['KREDIT_DAK'], 2)];
|
|
$datDak[$no++] += ['SUBTOTAL' => number_format($totPiutang, 2)];
|
|
}
|
|
|
|
foreach ($datDak as $key) {
|
|
$data[$noData++] = $key;
|
|
}
|
|
|
|
$this->output_json([
|
|
'data' => $data,
|
|
'totPiutang' => number_format($totPiutang,2),
|
|
]);
|
|
}
|
|
|
|
public function KU_Ambil_Sub4_DataPembukuanPiutangPihakke3() {
|
|
$id_pihakke3 = $this->input->post('id_pihakke3');
|
|
$awal = $this->input->post('awal');
|
|
$akhir = $this->input->post('akhir');
|
|
$search = $this->input->post('search');
|
|
$limit = $this->Amod->generate_subDay($awal, 1);
|
|
|
|
if ($id_pihakke3=="") {
|
|
$id_pihakke3 = NULL;
|
|
}
|
|
|
|
if ($id_pihakke3==NULL) {
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_beforeTGL(6, $limit);
|
|
} else {
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPIHAKKE3_beforeTGL(6, $id_pihakke3, $limit);
|
|
}
|
|
|
|
if ($sumDak==FALSE OR $sumDak[0]['DEBET']==NULL OR $sumDak[0]['KREDIT']==NULL) {
|
|
$totDebet = 0;
|
|
$totKredit = 0;
|
|
$totPiutang = 0;
|
|
} else {
|
|
$totDebet = $sumDak[0]['DEBET'];
|
|
$totKredit = $sumDak[0]['KREDIT'];
|
|
$totPiutang = $totDebet-$totKredit;
|
|
}
|
|
|
|
$data = [];
|
|
$noData = 0;
|
|
|
|
$data[$noData++] = [
|
|
'KODE_AKUNTANSI' => "Saldo Awal",
|
|
'TANGGAL' => date_format(date_create($limit), "d/m/Y"),
|
|
'NAMA_PIHAKKE3' => "",
|
|
'NAMA_KOTA' => "",
|
|
'CIPTA_DAK' => "",
|
|
'KET_DAK' => "~",
|
|
'DEBET' => number_format($totDebet,2),
|
|
'KREDIT' => number_format($totKredit,2),
|
|
'SUBTOTAL' => number_format($totPiutang,2),
|
|
];
|
|
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byPERKIRAAN_byPIHAKKE3_byPERIODE_forSearch(6, $id_pihakke3, $awal, $akhir, $search);
|
|
$no = 0;
|
|
foreach ($datDak as $key) {
|
|
$totDebet = $totDebet+$key['DEBET_DAK'];
|
|
$totKredit = $totKredit+$key['KREDIT_DAK'];
|
|
$totPiutang = $totPiutang+$key['DEBET_DAK']-$key['KREDIT_DAK'];
|
|
|
|
$datDak[$no] += ['DEBET' => number_format($key['DEBET_DAK'], 2)];
|
|
$datDak[$no] += ['KREDIT' => number_format($key['KREDIT_DAK'], 2)];
|
|
$datDak[$no++] += ['SUBTOTAL' => number_format($totPiutang, 2)];
|
|
}
|
|
|
|
foreach ($datDak as $key) {
|
|
$data[$noData++] = $key;
|
|
}
|
|
|
|
$this->output_json([
|
|
'data' => $data,
|
|
'totPiutang' => number_format($totPiutang,2),
|
|
]);
|
|
}
|
|
|
|
public function KU_Ambil_Sub4_DataPembukuanSaldoBank() {
|
|
$id_bank = $this->input->post('id_bank');
|
|
$awal = $this->input->post('awal');
|
|
$akhir = $this->input->post('akhir');
|
|
$search = $this->input->post('search');
|
|
$limit = $this->Amod->generate_subDay($awal, 1);
|
|
|
|
if ($id_bank=="") {
|
|
$id_bank = NULL;
|
|
}
|
|
|
|
if ($id_bank==NULL) {
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_beforeTGL(2, $limit);
|
|
} else {
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byBANK_beforeTGL(2, $id_bank, $limit);
|
|
}
|
|
|
|
if ($sumDak==FALSE OR $sumDak[0]['DEBET']==NULL OR $sumDak[0]['KREDIT']==NULL) {
|
|
$totDebet = 0;
|
|
$totKredit = 0;
|
|
$totSaldo = 0;
|
|
} else {
|
|
$totDebet = $sumDak[0]['DEBET'];
|
|
$totKredit = $sumDak[0]['KREDIT'];
|
|
$totSaldo = $totDebet-$totKredit;
|
|
}
|
|
|
|
$data = [];
|
|
$noData = 0;
|
|
|
|
$data[$noData++] = [
|
|
'KODE_AKUNTANSI' => "Saldo Awal",
|
|
'TANGGAL' => date_format(date_create($limit), "d/m/Y"),
|
|
'DKOBA' => "",
|
|
'DNABA' => "",
|
|
'EKOBA' => "",
|
|
'ENABA' => "",
|
|
'CIPTA_DAK' => "",
|
|
'KET_DAK' => "~",
|
|
'DEBET' => number_format($totDebet,2),
|
|
'KREDIT' => number_format($totKredit,2),
|
|
'SUBTOTAL' => number_format($totSaldo,2),
|
|
];
|
|
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byPERKIRAAN_byBANK_byPERIODE_forSearch(2, $id_bank, $awal, $akhir, $search);
|
|
$no = 0;
|
|
foreach ($datDak as $key) {
|
|
$totDebet = $totDebet+$key['DEBET_DAK'];
|
|
$totKredit = $totKredit+$key['KREDIT_DAK'];
|
|
$totSaldo = $totSaldo+$key['DEBET_DAK']-$key['KREDIT_DAK'];
|
|
|
|
$datDak[$no] += ['DEBET' => number_format($key['DEBET_DAK'], 2)];
|
|
$datDak[$no] += ['KREDIT' => number_format($key['KREDIT_DAK'], 2)];
|
|
$datDak[$no++] += ['SUBTOTAL' => number_format($totSaldo, 2)];
|
|
}
|
|
|
|
foreach ($datDak as $key) {
|
|
$data[$noData++] = $key;
|
|
}
|
|
|
|
$this->output_json([
|
|
'data' => $data,
|
|
'totSaldo' => number_format($totSaldo,2),
|
|
]);
|
|
}
|
|
|
|
public function KU_Ambil_Sub4_DataPembukuanSaldoKas() {
|
|
$id_kas = $this->input->post('id_kas');
|
|
$awal = $this->input->post('awal');
|
|
$akhir = $this->input->post('akhir');
|
|
$search = $this->input->post('search');
|
|
$limit = $this->Amod->generate_subDay($awal, 1);
|
|
|
|
if ($id_kas=="") {
|
|
$id_kas = NULL;
|
|
}
|
|
|
|
if ($id_kas==NULL) {
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_beforeTGL(1, $limit);
|
|
} else {
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byKAS_beforeTGL(1, $id_kas, $limit);
|
|
}
|
|
|
|
if ($sumDak==FALSE OR $sumDak[0]['DEBET']==NULL OR $sumDak[0]['KREDIT']==NULL) {
|
|
$totDebet = 0;
|
|
$totKredit = 0;
|
|
$totSaldo = 0;
|
|
} else {
|
|
$totDebet = $sumDak[0]['DEBET'];
|
|
$totKredit = $sumDak[0]['KREDIT'];
|
|
$totSaldo = $totDebet-$totKredit;
|
|
}
|
|
|
|
$data = [];
|
|
$noData = 0;
|
|
|
|
$data[$noData++] = [
|
|
'KODE_AKUNTANSI' => "Saldo Awal",
|
|
'TANGGAL' => date_format(date_create($limit), "d/m/Y"),
|
|
'DKOKAS' => "",
|
|
'DNAKAS' => "",
|
|
'EKOKAS' => "",
|
|
'ENAKAS' => "",
|
|
'KODE_PERKIRAAN' => "",
|
|
'NAMA_PERKIRAAN' => "",
|
|
'CIPTA_DAK' => "",
|
|
'KET_DAK' => "~",
|
|
'DEBET' => number_format($totDebet,2),
|
|
'KREDIT' => number_format($totKredit,2),
|
|
'SUBTOTAL' => number_format($totSaldo,2),
|
|
];
|
|
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byPERKIRAAN_byKAS_byPERIODE_forSearch(1, $id_kas, $awal, $akhir, $search);
|
|
$no = 0;
|
|
foreach ($datDak as $key) {
|
|
$totDebet = $totDebet+$key['DEBET_DAK'];
|
|
$totKredit = $totKredit+$key['KREDIT_DAK'];
|
|
$totSaldo = $totSaldo+$key['DEBET_DAK']-$key['KREDIT_DAK'];
|
|
|
|
$datDak[$no] += ['DEBET' => number_format($key['DEBET_DAK'], 2)];
|
|
$datDak[$no] += ['KREDIT' => number_format($key['KREDIT_DAK'], 2)];
|
|
$datDak[$no++] += ['SUBTOTAL' => number_format($totSaldo, 2)];
|
|
}
|
|
|
|
foreach ($datDak as $key) {
|
|
$data[$noData++] = $key;
|
|
}
|
|
|
|
$this->output_json([
|
|
'data' => $data,
|
|
'totSaldo' => number_format($totSaldo,2),
|
|
]);
|
|
}
|
|
|
|
public function KU_Ambil_Sub4_DataAnalisaPerkiraan() {
|
|
$id_perkiraan = $this->input->post('id_perkiraan');
|
|
$awal = $this->input->post('awal');
|
|
$akhir = $this->input->post('akhir');
|
|
$search = $this->input->post('search');
|
|
|
|
if ($id_perkiraan=="") {
|
|
$id_perkiraan = NULL;
|
|
}
|
|
|
|
$data = $this->Amod->getData_DaftarAkuntansi_byPERKIRAAN_byPERIODE_forSearchPerkiraan($id_perkiraan, $awal, $akhir, $search);
|
|
$no = 0;
|
|
$totDebet = 0;
|
|
$totKredit = 0;
|
|
$totPerkiraan = 0;
|
|
foreach ($data as $key) {
|
|
$totDebet = $totDebet+$key['DEBET_DAK'];
|
|
$totKredit = $totKredit+$key['KREDIT_DAK'];
|
|
$totPerkiraan = $totPerkiraan+$key['DEBET_DAK']-$key['KREDIT_DAK'];
|
|
|
|
$data[$no] += ['DEBET' => number_format($key['DEBET_DAK'], 2)];
|
|
$data[$no] += ['KREDIT' => number_format($key['KREDIT_DAK'], 2)];
|
|
$data[$no++] += ['SUBTOTAL' => number_format($totPerkiraan, 2)];
|
|
}
|
|
|
|
$this->output_json([
|
|
'data' => $data,
|
|
'totPerkiraan' => number_format($totPerkiraan,2),
|
|
]);
|
|
}
|
|
|
|
public function KU_Excel_Sub4_DataPembukuanBiayaBensin() {
|
|
$awal = $this->input->post('tgl_awalfill');
|
|
$akhir = $this->input->post('tgl_akhirfill');
|
|
$jenis = $this->input->post('jenis_fill');
|
|
$id_kendaraan = $this->input->post('id_kendaraanfill');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$hasil = [];
|
|
$noAwal = 0;
|
|
$noAkhir = 0;
|
|
|
|
if ($jenis==1) { // Campur jadi satu Laporan
|
|
$hasil[$noAwal] = [
|
|
'IDSHEET' => '0',
|
|
'FASHEET' => "CAMPUR",
|
|
'NASHEET' => "Sesuai Filter"
|
|
];
|
|
if ($id_kendaraan=="") {
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byPERKIRAAN_byKENDARAAN_byPERIODE_forSearch(34, NULL, $awal, $akhir);
|
|
$no = 0;
|
|
$subDebet = 0;
|
|
$subKredit = 0;
|
|
$subTotal = 0;
|
|
foreach ($datDak as $dat) {
|
|
$subDebet = $subDebet+$dat['DEBET_DAK'];
|
|
$subKredit = $subKredit+$dat['KREDIT_DAK'];
|
|
$subTotal = $subTotal+$dat['DEBET_DAK']-$dat['KREDIT_DAK'];
|
|
|
|
$datDak[$no] += ['DEBET' => number_format($dat['DEBET_DAK'], 2)];
|
|
$datDak[$no] += ['KREDIT' => number_format($dat['KREDIT_DAK'], 2)];
|
|
$datDak[$no++] += ['SUBTOTAL' => number_format($subTotal, 2)];
|
|
}
|
|
$hasil[$noAkhir] += ['SUBDEBET' => number_format($subDebet,2)];
|
|
$hasil[$noAkhir] += ['SUBKREDIT' => number_format($subKredit,2)];
|
|
$hasil[$noAkhir] += ['SUBTOTALALL' => number_format($subTotal,2)];
|
|
$hasil[$noAkhir] += ['ISI' => $datDak];
|
|
} else {
|
|
$subDebet = 0;
|
|
$subKredit = 0;
|
|
$subTotal = 0;
|
|
$noKen = 0;
|
|
$isiKen = [];
|
|
$salKen = explode(",", $id_kendaraan);
|
|
foreach ($salKen as $key) {
|
|
$no = 0;
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byPERKIRAAN_byKENDARAAN_byPERIODE_forSearch(34, $key, $awal, $akhir);
|
|
foreach ($datDak as $dat) {
|
|
$subDebet = $subDebet+$dat['DEBET_DAK'];
|
|
$subKredit = $subKredit+$dat['KREDIT_DAK'];
|
|
$subTotal = $subTotal+$dat['DEBET_DAK']-$dat['KREDIT_DAK'];
|
|
|
|
$datDak[$no] += ['DEBET' => number_format($dat['DEBET_DAK'], 2)];
|
|
$datDak[$no] += ['KREDIT' => number_format($dat['KREDIT_DAK'], 2)];
|
|
$datDak[$no++] += ['SUBTOTAL' => number_format($subTotal, 2)];
|
|
}
|
|
foreach ($datDak as $det) {
|
|
$isiKen[$noKen++] = $det;
|
|
}
|
|
}
|
|
$hasil[$noAkhir] += ['SUBDEBET' => number_format($subDebet,2)];
|
|
$hasil[$noAkhir] += ['SUBKREDIT' => number_format($subKredit,2)];
|
|
$hasil[$noAkhir] += ['SUBTOTALALL' => number_format($subTotal,2)];
|
|
$hasil[$noAkhir] += ['ISI' => $isiKen];
|
|
}
|
|
} else if ($jenis==2) { // Dipisah Kendaraan
|
|
$salKen = explode(",", $id_kendaraan);
|
|
foreach ($salKen as $key) {
|
|
$subDebet = 0;
|
|
$subKredit = 0;
|
|
$subTotal = 0;
|
|
|
|
$no = 0;
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byPERKIRAAN_byKENDARAAN_byPERIODE_forSearch(34, $key, $awal, $akhir);
|
|
foreach ($datDak as $dat) {
|
|
$subDebet = $subDebet+$dat['DEBET_DAK'];
|
|
$subKredit = $subKredit+$dat['KREDIT_DAK'];
|
|
$subTotal = $subTotal+$dat['DEBET_DAK']-$dat['KREDIT_DAK'];
|
|
|
|
$datDak[$no] += ['DEBET' => number_format($dat['DEBET_DAK'], 2)];
|
|
$datDak[$no] += ['KREDIT' => number_format($dat['KREDIT_DAK'], 2)];
|
|
$datDak[$no++] += ['SUBTOTAL' => number_format($subTotal, 2)];
|
|
}
|
|
|
|
$datKendaraan = $this->Amod->getData_Kendaraan_byID($key);
|
|
$nama_kendaraan = $datKendaraan[0]['NAMA_KENDARAAN'];
|
|
if (strlen($nama_kendaraan)>20) {
|
|
$namaKen = substr($nama_kendaraan, 0, 20);
|
|
$namaKen = "$namaKen..";
|
|
} else {
|
|
$namaKen = $nama_kendaraan;
|
|
}
|
|
$hasil[$noAwal++] = [
|
|
'IDSHEET' => $key,
|
|
'FASHEET' => $nama_kendaraan,
|
|
'NASHEET' => $namaKen,
|
|
'SUBDEBET' => number_format($subDebet,2),
|
|
'SUBKREDIT' => number_format($subKredit,2),
|
|
'SUBTOTALALL' => number_format($subTotal,2),
|
|
'ISI' => $datDak
|
|
];
|
|
}
|
|
}
|
|
|
|
$pilih_tabel = array('No', 'Kode', 'Tanggal', 'Timestamp', 'Kendaraan', 'Nilai DEBET', 'Nilai KREDIT', 'Nilai SUBTOTAL', 'Keterangan');
|
|
|
|
$data = [
|
|
'awal_nota' => date_format(date_create($awal), "d/m/Y"),
|
|
'akhir_nota' => date_format(date_create($akhir), "d/m/Y"),
|
|
'jumlah_kolom' => count($pilih_tabel),
|
|
'nama_tabel' => $pilih_tabel,
|
|
'jenis' => $jenis,
|
|
'hasil' => $hasil,
|
|
'ts' => $timestamp,
|
|
];
|
|
$this->load->view('cetak/KU_Excel_Sub4_DataPembukuanBiayaBensin', $data);
|
|
}
|
|
|
|
public function KU_Excel_Sub4_DataPembukuanBiayaFee() {
|
|
$awal = $this->input->post('tgl_awalfill');
|
|
$akhir = $this->input->post('tgl_akhirfill');
|
|
$jenis = $this->input->post('jenis_fill');
|
|
$id_pelanggan = $this->input->post('id_pelangganfill');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$hasil = [];
|
|
$noAwal = 0;
|
|
$noAkhir = 0;
|
|
|
|
if ($jenis==1) { // Campur jadi satu Laporan
|
|
$hasil[$noAwal] = [
|
|
'IDSHEET' => '0',
|
|
'FASHEET' => "CAMPUR",
|
|
'NASHEET' => "Sesuai Filter"
|
|
];
|
|
if ($id_pelanggan=="") {
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byPERKIRAAN_byPELANGGAN_byPERIODE_forSearch(64, NULL, $awal, $akhir);
|
|
$no = 0;
|
|
$subDebet = 0;
|
|
$subKredit = 0;
|
|
$subTotal = 0;
|
|
foreach ($datDak as $dat) {
|
|
$subDebet = $subDebet+$dat['DEBET_DAK'];
|
|
$subKredit = $subKredit+$dat['KREDIT_DAK'];
|
|
$subTotal = $subTotal+$dat['DEBET_DAK']-$dat['KREDIT_DAK'];
|
|
|
|
$datDak[$no] += ['DEBET' => number_format($dat['DEBET_DAK'], 2)];
|
|
$datDak[$no] += ['KREDIT' => number_format($dat['KREDIT_DAK'], 2)];
|
|
$datDak[$no++] += ['SUBTOTAL' => number_format($subTotal, 2)];
|
|
}
|
|
$hasil[$noAkhir] += ['SUBDEBET' => number_format($subDebet,2)];
|
|
$hasil[$noAkhir] += ['SUBKREDIT' => number_format($subKredit,2)];
|
|
$hasil[$noAkhir] += ['SUBTOTALALL' => number_format($subTotal,2)];
|
|
$hasil[$noAkhir] += ['ISI' => $datDak];
|
|
} else {
|
|
$subDebet = 0;
|
|
$subKredit = 0;
|
|
$subTotal = 0;
|
|
$noPel = 0;
|
|
$isiPel = [];
|
|
$salPel = explode(",", $id_pelanggan);
|
|
foreach ($salPel as $key) {
|
|
$no = 0;
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byPERKIRAAN_byPELANGGAN_byPERIODE_forSearch(64, $key, $awal, $akhir);
|
|
foreach ($datDak as $dat) {
|
|
$subDebet = $subDebet+$dat['DEBET_DAK'];
|
|
$subKredit = $subKredit+$dat['KREDIT_DAK'];
|
|
$subTotal = $subTotal+$dat['DEBET_DAK']-$dat['KREDIT_DAK'];
|
|
|
|
$datDak[$no] += ['DEBET' => number_format($dat['DEBET_DAK'], 2)];
|
|
$datDak[$no] += ['KREDIT' => number_format($dat['KREDIT_DAK'], 2)];
|
|
$datDak[$no++] += ['SUBTOTAL' => number_format($subTotal, 2)];
|
|
}
|
|
foreach ($datDak as $det) {
|
|
$isiPel[$noPel++] = $det;
|
|
}
|
|
}
|
|
$hasil[$noAkhir] += ['SUBDEBET' => number_format($subDebet,2)];
|
|
$hasil[$noAkhir] += ['SUBKREDIT' => number_format($subKredit,2)];
|
|
$hasil[$noAkhir] += ['SUBTOTALALL' => number_format($subTotal,2)];
|
|
$hasil[$noAkhir] += ['ISI' => $isiPel];
|
|
}
|
|
} else if ($jenis==2) { // Dipisah Pelanggan
|
|
$salPel = explode(",", $id_pelanggan);
|
|
foreach ($salPel as $key) {
|
|
$subDebet = 0;
|
|
$subKredit = 0;
|
|
$subTotal = 0;
|
|
|
|
$no = 0;
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byPERKIRAAN_byPELANGGAN_byPERIODE_forSearch(64, $key, $awal, $akhir);
|
|
foreach ($datDak as $dat) {
|
|
$subDebet = $subDebet+$dat['DEBET_DAK'];
|
|
$subKredit = $subKredit+$dat['KREDIT_DAK'];
|
|
$subTotal = $subTotal+$dat['DEBET_DAK']-$dat['KREDIT_DAK'];
|
|
|
|
$datDak[$no] += ['DEBET' => number_format($dat['DEBET_DAK'], 2)];
|
|
$datDak[$no] += ['KREDIT' => number_format($dat['KREDIT_DAK'], 2)];
|
|
$datDak[$no++] += ['SUBTOTAL' => number_format($subTotal, 2)];
|
|
}
|
|
|
|
$datPelanggan = $this->Amod->getData_Pelanggan_byID($key);
|
|
$nama_pelanggan = $datPelanggan[0]['NAMA_PELANGGAN'];
|
|
if (strlen($nama_pelanggan)>20) {
|
|
$namaPel = substr($nama_pelanggan, 0, 20);
|
|
$namaPel = "$namaPel..";
|
|
} else {
|
|
$namaPel = $nama_pelanggan;
|
|
}
|
|
$hasil[$noAwal++] = [
|
|
'IDSHEET' => $key,
|
|
'FASHEET' => $nama_pelanggan,
|
|
'NASHEET' => $namaPel,
|
|
'SUBDEBET' => number_format($subDebet,2),
|
|
'SUBKREDIT' => number_format($subKredit,2),
|
|
'SUBTOTALALL' => number_format($subTotal,2),
|
|
'ISI' => $datDak
|
|
];
|
|
}
|
|
}
|
|
|
|
$pilih_tabel = array('No', 'Kode', 'Tanggal', 'Timestamp', 'Pelanggan', 'Nilai DEBET', 'Nilai KREDIT', 'Nilai SUBTOTAL', 'Keterangan');
|
|
|
|
$data = [
|
|
'awal_nota' => date_format(date_create($awal), "d/m/Y"),
|
|
'akhir_nota' => date_format(date_create($akhir), "d/m/Y"),
|
|
'jumlah_kolom' => count($pilih_tabel),
|
|
'nama_tabel' => $pilih_tabel,
|
|
'jenis' => $jenis,
|
|
'hasil' => $hasil,
|
|
'ts' => $timestamp,
|
|
];
|
|
$this->load->view('cetak/KU_Excel_Sub4_DataPembukuanBiayaFee', $data);
|
|
}
|
|
|
|
public function KU_Excel_Sub4_DataPembukuanBiayaProyek() {
|
|
$awal = $this->input->post('tgl_awalfill');
|
|
$akhir = $this->input->post('tgl_akhirfill');
|
|
$jenis = $this->input->post('jenis_fill');
|
|
$id_pelanggan = $this->input->post('id_pelangganfill');
|
|
$id_unitproyek = $this->input->post('id_unitproyekfill');
|
|
$id_karyawan = $this->input->post('id_karyawanfill');
|
|
$id_kendaraan = $this->input->post('id_kendaraanfill');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
if ($id_unitproyek=="") {
|
|
$id_unitproyek = NULL;
|
|
}
|
|
|
|
if ($id_karyawan=="") {
|
|
$id_karyawan = NULL;
|
|
}
|
|
|
|
if ($id_kendaraan=="") {
|
|
$id_kendaraan = NULL;
|
|
}
|
|
|
|
$hasil = [];
|
|
$noAwal = 0;
|
|
$noAkhir = 0;
|
|
|
|
if ($jenis==1) { // Campur jadi satu Laporan
|
|
$hasil[$noAwal] = [
|
|
'IDSHEET' => '0',
|
|
'FASHEET' => "CAMPUR",
|
|
'NASHEET' => "Sesuai Filter"
|
|
];
|
|
if ($id_pelanggan=="") {
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byPELANGGAN_byUNITPROYEK_byKARYAWAN_byKENDARAAN_byPERIODE_forSearchProyek(NULL, $id_unitproyek, $id_karyawan, $id_kendaraan, $awal, $akhir);
|
|
$no = 0;
|
|
$subDebet = 0;
|
|
$subKredit = 0;
|
|
$subTotal = 0;
|
|
foreach ($datDak as $dat) {
|
|
$subDebet = $subDebet+$dat['DEBET_DAK'];
|
|
$subKredit = $subKredit+$dat['KREDIT_DAK'];
|
|
$subTotal = $subTotal+$dat['DEBET_DAK']-$dat['KREDIT_DAK'];
|
|
|
|
$datDak[$no] += ['DEBET' => number_format($dat['DEBET_DAK'], 2)];
|
|
$datDak[$no] += ['KREDIT' => number_format($dat['KREDIT_DAK'], 2)];
|
|
$datDak[$no++] += ['SUBTOTAL' => number_format($subTotal, 2)];
|
|
}
|
|
$hasil[$noAkhir] += ['SUBDEBET' => number_format($subDebet,2)];
|
|
$hasil[$noAkhir] += ['SUBKREDIT' => number_format($subKredit,2)];
|
|
$hasil[$noAkhir] += ['SUBTOTALALL' => number_format($subTotal,2)];
|
|
$hasil[$noAkhir] += ['ISI' => $datDak];
|
|
} else {
|
|
$subDebet = 0;
|
|
$subKredit = 0;
|
|
$subTotal = 0;
|
|
$noPel = 0;
|
|
$isiPel = [];
|
|
$salPel = explode(",", $id_pelanggan);
|
|
foreach ($salPel as $key) {
|
|
$no = 0;
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byPELANGGAN_byUNITPROYEK_byKARYAWAN_byKENDARAAN_byPERIODE_forSearchProyek($key, $id_unitproyek, $id_karyawan, $id_kendaraan, $awal, $akhir);
|
|
foreach ($datDak as $dat) {
|
|
$subDebet = $subDebet+$dat['DEBET_DAK'];
|
|
$subKredit = $subKredit+$dat['KREDIT_DAK'];
|
|
$subTotal = $subTotal+$dat['DEBET_DAK']-$dat['KREDIT_DAK'];
|
|
|
|
$datDak[$no] += ['DEBET' => number_format($dat['DEBET_DAK'], 2)];
|
|
$datDak[$no] += ['KREDIT' => number_format($dat['KREDIT_DAK'], 2)];
|
|
$datDak[$no++] += ['SUBTOTAL' => number_format($subTotal, 2)];
|
|
}
|
|
foreach ($datDak as $det) {
|
|
$isiPel[$noPel++] = $det;
|
|
}
|
|
}
|
|
$hasil[$noAkhir] += ['SUBDEBET' => number_format($subDebet,2)];
|
|
$hasil[$noAkhir] += ['SUBKREDIT' => number_format($subKredit,2)];
|
|
$hasil[$noAkhir] += ['SUBTOTALALL' => number_format($subTotal,2)];
|
|
$hasil[$noAkhir] += ['ISI' => $isiPel];
|
|
}
|
|
} else if ($jenis==2) { // Dipisah Pelanggan
|
|
$salPel = explode(",", $id_pelanggan);
|
|
foreach ($salPel as $key) {
|
|
$subDebet = 0;
|
|
$subKredit = 0;
|
|
$subTotal = 0;
|
|
|
|
$no = 0;
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byPELANGGAN_byUNITPROYEK_byKARYAWAN_byKENDARAAN_byPERIODE_forSearchProyek($key, $id_unitproyek, $id_karyawan, $id_kendaraan, $awal, $akhir);
|
|
foreach ($datDak as $dat) {
|
|
$subDebet = $subDebet+$dat['DEBET_DAK'];
|
|
$subKredit = $subKredit+$dat['KREDIT_DAK'];
|
|
$subTotal = $subTotal+$dat['DEBET_DAK']-$dat['KREDIT_DAK'];
|
|
|
|
$datDak[$no] += ['DEBET' => number_format($dat['DEBET_DAK'], 2)];
|
|
$datDak[$no] += ['KREDIT' => number_format($dat['KREDIT_DAK'], 2)];
|
|
$datDak[$no++] += ['SUBTOTAL' => number_format($subTotal, 2)];
|
|
}
|
|
|
|
$datPelanggan = $this->Amod->getData_Pelanggan_byID($key);
|
|
$nama_pelanggan = $datPelanggan[0]['NAMA_PELANGGAN'];
|
|
if (strlen($nama_pelanggan)>20) {
|
|
$namaPel = substr($nama_pelanggan, 0, 20);
|
|
$namaPel = "$namaPel..";
|
|
} else {
|
|
$namaPel = $nama_pelanggan;
|
|
}
|
|
$hasil[$noAwal++] = [
|
|
'IDSHEET' => $key,
|
|
'FASHEET' => $nama_pelanggan,
|
|
'NASHEET' => $namaPel,
|
|
'SUBDEBET' => number_format($subDebet,2),
|
|
'SUBKREDIT' => number_format($subKredit,2),
|
|
'SUBTOTALALL' => number_format($subTotal,2),
|
|
'ISI' => $datDak
|
|
];
|
|
}
|
|
}
|
|
|
|
$pilih_tabel = array('No', 'Kode', 'Tanggal', 'Timestamp', 'Pelanggan', 'Proyek', 'Detail', 'Karyawan', 'Nilai DEBET', 'Nilai KREDIT', 'Nilai SUBTOTAL', 'Keterangan');
|
|
|
|
$data = [
|
|
'awal_nota' => date_format(date_create($awal), "d/m/Y"),
|
|
'akhir_nota' => date_format(date_create($akhir), "d/m/Y"),
|
|
'jumlah_kolom' => count($pilih_tabel),
|
|
'nama_tabel' => $pilih_tabel,
|
|
'jenis' => $jenis,
|
|
'hasil' => $hasil,
|
|
'ts' => $timestamp,
|
|
];
|
|
$this->load->view('cetak/KU_Excel_Sub4_DataPembukuanBiayaProyek', $data);
|
|
}
|
|
|
|
public function KU_Excel_Sub4_DataPembukuanBiayaServiceKendaraan() {
|
|
$awal = $this->input->post('tgl_awalfill');
|
|
$akhir = $this->input->post('tgl_akhirfill');
|
|
$jenis = $this->input->post('jenis_fill');
|
|
$id_kendaraan = $this->input->post('id_kendaraanfill');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$hasil = [];
|
|
$noAwal = 0;
|
|
$noAkhir = 0;
|
|
|
|
if ($jenis==1) { // Campur jadi satu Laporan
|
|
$hasil[$noAwal] = [
|
|
'IDSHEET' => '0',
|
|
'FASHEET' => "CAMPUR",
|
|
'NASHEET' => "Sesuai Filter"
|
|
];
|
|
if ($id_kendaraan=="") {
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byPERKIRAAN_byKENDARAAN_byPERIODE_forSearch(33, NULL, $awal, $akhir);
|
|
$no = 0;
|
|
$subDebet = 0;
|
|
$subKredit = 0;
|
|
$subTotal = 0;
|
|
foreach ($datDak as $dat) {
|
|
$subDebet = $subDebet+$dat['DEBET_DAK'];
|
|
$subKredit = $subKredit+$dat['KREDIT_DAK'];
|
|
$subTotal = $subTotal+$dat['DEBET_DAK']-$dat['KREDIT_DAK'];
|
|
|
|
$datDak[$no] += ['DEBET' => number_format($dat['DEBET_DAK'], 2)];
|
|
$datDak[$no] += ['KREDIT' => number_format($dat['KREDIT_DAK'], 2)];
|
|
$datDak[$no++] += ['SUBTOTAL' => number_format($subTotal, 2)];
|
|
}
|
|
$hasil[$noAkhir] += ['SUBDEBET' => number_format($subDebet,2)];
|
|
$hasil[$noAkhir] += ['SUBKREDIT' => number_format($subKredit,2)];
|
|
$hasil[$noAkhir] += ['SUBTOTALALL' => number_format($subTotal,2)];
|
|
$hasil[$noAkhir] += ['ISI' => $datDak];
|
|
} else {
|
|
$subDebet = 0;
|
|
$subKredit = 0;
|
|
$subTotal = 0;
|
|
$noKen = 0;
|
|
$isiKen = [];
|
|
$salKen = explode(",", $id_kendaraan);
|
|
foreach ($salKen as $key) {
|
|
$no = 0;
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byPERKIRAAN_byKENDARAAN_byPERIODE_forSearch(33, $key, $awal, $akhir);
|
|
foreach ($datDak as $dat) {
|
|
$subDebet = $subDebet+$dat['DEBET_DAK'];
|
|
$subKredit = $subKredit+$dat['KREDIT_DAK'];
|
|
$subTotal = $subTotal+$dat['DEBET_DAK']-$dat['KREDIT_DAK'];
|
|
|
|
$datDak[$no] += ['DEBET' => number_format($dat['DEBET_DAK'], 2)];
|
|
$datDak[$no] += ['KREDIT' => number_format($dat['KREDIT_DAK'], 2)];
|
|
$datDak[$no++] += ['SUBTOTAL' => number_format($subTotal, 2)];
|
|
}
|
|
foreach ($datDak as $det) {
|
|
$isiKen[$noKen++] = $det;
|
|
}
|
|
}
|
|
$hasil[$noAkhir] += ['SUBDEBET' => number_format($subDebet,2)];
|
|
$hasil[$noAkhir] += ['SUBKREDIT' => number_format($subKredit,2)];
|
|
$hasil[$noAkhir] += ['SUBTOTALALL' => number_format($subTotal,2)];
|
|
$hasil[$noAkhir] += ['ISI' => $isiKen];
|
|
}
|
|
} else if ($jenis==2) { // Dipisah Kendaraan
|
|
$salKen = explode(",", $id_kendaraan);
|
|
foreach ($salKen as $key) {
|
|
$subDebet = 0;
|
|
$subKredit = 0;
|
|
$subTotal = 0;
|
|
|
|
$no = 0;
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byPERKIRAAN_byKENDARAAN_byPERIODE_forSearch(33, $key, $awal, $akhir);
|
|
foreach ($datDak as $dat) {
|
|
$subDebet = $subDebet+$dat['DEBET_DAK'];
|
|
$subKredit = $subKredit+$dat['KREDIT_DAK'];
|
|
$subTotal = $subTotal+$dat['DEBET_DAK']-$dat['KREDIT_DAK'];
|
|
|
|
$datDak[$no] += ['DEBET' => number_format($dat['DEBET_DAK'], 2)];
|
|
$datDak[$no] += ['KREDIT' => number_format($dat['KREDIT_DAK'], 2)];
|
|
$datDak[$no++] += ['SUBTOTAL' => number_format($subTotal, 2)];
|
|
}
|
|
|
|
$datKendaraan = $this->Amod->getData_Kendaraan_byID($key);
|
|
$nama_kendaraan = $datKendaraan[0]['NAMA_KENDARAAN'];
|
|
if (strlen($nama_kendaraan)>20) {
|
|
$namaKen = substr($nama_kendaraan, 0, 20);
|
|
$namaKen = "$namaKen..";
|
|
} else {
|
|
$namaKen = $nama_kendaraan;
|
|
}
|
|
$hasil[$noAwal++] = [
|
|
'IDSHEET' => $key,
|
|
'FASHEET' => $nama_kendaraan,
|
|
'NASHEET' => $namaKen,
|
|
'SUBDEBET' => number_format($subDebet,2),
|
|
'SUBKREDIT' => number_format($subKredit,2),
|
|
'SUBTOTALALL' => number_format($subTotal,2),
|
|
'ISI' => $datDak
|
|
];
|
|
}
|
|
}
|
|
|
|
$pilih_tabel = array('No', 'Kode', 'Tanggal', 'Timestamp', 'Kendaraan', 'Nilai DEBET', 'Nilai KREDIT', 'Nilai SUBTOTAL', 'Keterangan');
|
|
|
|
$data = [
|
|
'awal_nota' => date_format(date_create($awal), "d/m/Y"),
|
|
'akhir_nota' => date_format(date_create($akhir), "d/m/Y"),
|
|
'jumlah_kolom' => count($pilih_tabel),
|
|
'nama_tabel' => $pilih_tabel,
|
|
'jenis' => $jenis,
|
|
'hasil' => $hasil,
|
|
'ts' => $timestamp,
|
|
];
|
|
$this->load->view('cetak/KU_Excel_Sub4_DataPembukuanBiayaServiceKendaraan', $data);
|
|
}
|
|
|
|
public function KU_Excel_Sub4_DataPembukuanDpPembelian() {
|
|
$awal = $this->input->post('tgl_awalfill');
|
|
$akhir = $this->input->post('tgl_akhirfill');
|
|
$jenis = $this->input->post('jenis_fill');
|
|
$id_supplier = $this->input->post('id_supplierfill');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
$limit = $this->Amod->generate_subDay($awal, 1);
|
|
|
|
$hasil = [];
|
|
$noAwal = 0;
|
|
$noAkhir = 0;
|
|
|
|
if ($jenis==1) { // Campur jadi satu Laporan
|
|
$hasil[$noAwal] = [
|
|
'IDSHEET' => '0',
|
|
'FASHEET' => "CAMPUR",
|
|
'NASHEET' => "Sesuai Filter"
|
|
];
|
|
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_beforeTGL(7, $limit);
|
|
if ($sumDak==FALSE OR $sumDak[0]['DEBET']==NULL OR $sumDak[0]['KREDIT']==NULL) {
|
|
$subDebet = 0;
|
|
$subKredit = 0;
|
|
$subTotal = 0;
|
|
} else {
|
|
$subDebet = $sumDak[0]['DEBET'];
|
|
$subKredit = $sumDak[0]['KREDIT'];
|
|
$subTotal = $subDebet-$subKredit;
|
|
}
|
|
|
|
$data = [];
|
|
$noData = 0;
|
|
|
|
$data[$noData++] = [
|
|
'KODE_AKUNTANSI' => "Saldo Awal",
|
|
'TANGGAL' => date_format(date_create($limit), "d/m/Y"),
|
|
'NAMA_SUPPLIER' => "",
|
|
'NAMA_KOTA' => "",
|
|
'CIPTA_DAK' => "",
|
|
'KET_DAK' => "~",
|
|
'DEBET' => number_format($subDebet,2),
|
|
'KREDIT' => number_format($subKredit,2),
|
|
'SUBTOTAL' => number_format($subTotal,2),
|
|
];
|
|
|
|
if ($id_supplier=="") {
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byPERKIRAAN_bySUPPLIER_byPERIODE_forSearch(7, NULL, $awal, $akhir);
|
|
$no = 0;
|
|
foreach ($datDak as $dat) {
|
|
$subDebet = $subDebet+$dat['DEBET_DAK'];
|
|
$subKredit = $subKredit+$dat['KREDIT_DAK'];
|
|
$subTotal = $subTotal+$dat['DEBET_DAK']-$dat['KREDIT_DAK'];
|
|
|
|
$datDak[$no] += ['DEBET' => number_format($dat['DEBET_DAK'], 2)];
|
|
$datDak[$no] += ['KREDIT' => number_format($dat['KREDIT_DAK'], 2)];
|
|
$datDak[$no++] += ['SUBTOTAL' => number_format($subTotal, 2)];
|
|
}
|
|
foreach ($datDak as $det) {
|
|
$data[$noData++] = $det;
|
|
}
|
|
$hasil[$noAkhir] += ['SUBDEBET' => number_format($subDebet,2)];
|
|
$hasil[$noAkhir] += ['SUBKREDIT' => number_format($subKredit,2)];
|
|
$hasil[$noAkhir] += ['SUBTOTALALL' => number_format($subTotal,2)];
|
|
$hasil[$noAkhir] += ['ISI' => $data];
|
|
} else {
|
|
$salSup = explode(",", $id_supplier);
|
|
foreach ($salSup as $key) {
|
|
$no = 0;
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byPERKIRAAN_bySUPPLIER_byPERIODE_forSearch(7, $key, $awal, $akhir);
|
|
foreach ($datDak as $dat) {
|
|
$subDebet = $subDebet+$dat['DEBET_DAK'];
|
|
$subKredit = $subKredit+$dat['KREDIT_DAK'];
|
|
$subTotal = $subTotal+$dat['DEBET_DAK']-$dat['KREDIT_DAK'];
|
|
|
|
$datDak[$no] += ['DEBET' => number_format($dat['DEBET_DAK'], 2)];
|
|
$datDak[$no] += ['KREDIT' => number_format($dat['KREDIT_DAK'], 2)];
|
|
$datDak[$no++] += ['SUBTOTAL' => number_format($subTotal, 2)];
|
|
}
|
|
foreach ($datDak as $det) {
|
|
$data[$noData++] = $det;
|
|
}
|
|
}
|
|
$hasil[$noAkhir] += ['SUBDEBET' => number_format($subDebet,2)];
|
|
$hasil[$noAkhir] += ['SUBKREDIT' => number_format($subKredit,2)];
|
|
$hasil[$noAkhir] += ['SUBTOTALALL' => number_format($subTotal,2)];
|
|
$hasil[$noAkhir] += ['ISI' => $data];
|
|
}
|
|
} else if ($jenis==2) { // Dipisah Supplier
|
|
$salSup = explode(",", $id_supplier);
|
|
foreach ($salSup as $key) {
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_bySUPPLIER_beforeTGL(7, $key, $limit);
|
|
if ($sumDak==FALSE OR $sumDak[0]['DEBET']==NULL OR $sumDak[0]['KREDIT']==NULL) {
|
|
$subDebet = 0;
|
|
$subKredit = 0;
|
|
$subTotal = 0;
|
|
} else {
|
|
$subDebet = $sumDak[0]['DEBET'];
|
|
$subKredit = $sumDak[0]['KREDIT'];
|
|
$subTotal = $subDebet-$subKredit;
|
|
}
|
|
|
|
$data = [];
|
|
$noData = 0;
|
|
|
|
$data[$noData++] = [
|
|
'KODE_AKUNTANSI' => "Saldo Awal",
|
|
'TANGGAL' => date_format(date_create($limit), "d/m/Y"),
|
|
'NAMA_SUPPLIER' => "",
|
|
'NAMA_KOTA' => "",
|
|
'CIPTA_DAK' => "",
|
|
'KET_DAK' => "~",
|
|
'DEBET' => number_format($subDebet,2),
|
|
'KREDIT' => number_format($subKredit,2),
|
|
'SUBTOTAL' => number_format($subTotal,2),
|
|
];
|
|
|
|
$no = 0;
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byPERKIRAAN_bySUPPLIER_byPERIODE_forSearch(7, $key, $awal, $akhir);
|
|
foreach ($datDak as $dat) {
|
|
$subDebet = $subDebet+$dat['DEBET_DAK'];
|
|
$subKredit = $subKredit+$dat['KREDIT_DAK'];
|
|
$subTotal = $subTotal+$dat['DEBET_DAK']-$dat['KREDIT_DAK'];
|
|
|
|
$datDak[$no] += ['DEBET' => number_format($dat['DEBET_DAK'], 2)];
|
|
$datDak[$no] += ['KREDIT' => number_format($dat['KREDIT_DAK'], 2)];
|
|
$datDak[$no++] += ['SUBTOTAL' => number_format($subTotal, 2)];
|
|
}
|
|
|
|
foreach ($datDak as $det) {
|
|
$data[$noData++] = $det;
|
|
}
|
|
|
|
$datSupplier = $this->Amod->getData_Supplier_byID($key);
|
|
$nama_supplier = $datSupplier[0]['NAMA_SUPPLIER'];
|
|
if (strlen($nama_supplier)>20) {
|
|
$namaSup = substr($nama_supplier, 0, 20);
|
|
$namaSup = "$namaSup..";
|
|
} else {
|
|
$namaSup = $nama_supplier;
|
|
}
|
|
$hasil[$noAwal++] = [
|
|
'IDSHEET' => $key,
|
|
'FASHEET' => $nama_supplier,
|
|
'NASHEET' => $namaSup,
|
|
'SUBDEBET' => number_format($subDebet,2),
|
|
'SUBKREDIT' => number_format($subKredit,2),
|
|
'SUBTOTALALL' => number_format($subTotal,2),
|
|
'ISI' => $data
|
|
];
|
|
}
|
|
}
|
|
|
|
$pilih_tabel = array('No', 'Kode', 'Tanggal', 'Timestamp', 'Supplier', 'Nilai DEBET', 'Nilai KREDIT', 'Nilai SUBTOTAL', 'Keterangan');
|
|
|
|
$data = [
|
|
'awal_nota' => date_format(date_create($awal), "d/m/Y"),
|
|
'akhir_nota' => date_format(date_create($akhir), "d/m/Y"),
|
|
'jumlah_kolom' => count($pilih_tabel),
|
|
'nama_tabel' => $pilih_tabel,
|
|
'jenis' => $jenis,
|
|
'hasil' => $hasil,
|
|
'ts' => $timestamp,
|
|
];
|
|
$this->load->view('cetak/KU_Excel_Sub4_DataPembukuanDpPembelian', $data);
|
|
}
|
|
|
|
public function KU_Excel_Sub4_DataPembukuanDpPenjualan() {
|
|
$awal = $this->input->post('tgl_awalfill');
|
|
$akhir = $this->input->post('tgl_akhirfill');
|
|
$jenis = $this->input->post('jenis_fill');
|
|
$id_pelanggan = $this->input->post('id_pelangganfill');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
$limit = $this->Amod->generate_subDay($awal, 1);
|
|
|
|
$hasil = [];
|
|
$noAwal = 0;
|
|
$noAkhir = 0;
|
|
|
|
if ($jenis==1) { // Campur jadi satu Laporan
|
|
$hasil[$noAwal] = [
|
|
'IDSHEET' => '0',
|
|
'FASHEET' => "CAMPUR",
|
|
'NASHEET' => "Sesuai Filter"
|
|
];
|
|
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_beforeTGL(19, $limit);
|
|
if ($sumDak==FALSE OR $sumDak[0]['DEBET']==NULL OR $sumDak[0]['KREDIT']==NULL) {
|
|
$subDebet = 0;
|
|
$subKredit = 0;
|
|
$subTotal = 0;
|
|
} else {
|
|
$subDebet = $sumDak[0]['DEBET'];
|
|
$subKredit = $sumDak[0]['KREDIT'];
|
|
$subTotal = $subKredit-$subDebet;
|
|
}
|
|
|
|
$data = [];
|
|
$noData = 0;
|
|
|
|
$data[$noData++] = [
|
|
'KODE_AKUNTANSI' => "Saldo Awal",
|
|
'TANGGAL' => date_format(date_create($limit), "d/m/Y"),
|
|
'NAMA_PELANGGAN' => "",
|
|
'NAMA_KOTA' => "",
|
|
'CIPTA_DAK' => "",
|
|
'KET_DAK' => "~",
|
|
'DEBET' => number_format($subDebet,2),
|
|
'KREDIT' => number_format($subKredit,2),
|
|
'SUBTOTAL' => number_format($subTotal,2),
|
|
];
|
|
|
|
if ($id_pelanggan=="") {
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byPERKIRAAN_byPELANGGAN_byPERIODE_forSearch(19, NULL, $awal, $akhir);
|
|
$no = 0;
|
|
foreach ($datDak as $dat) {
|
|
$subDebet = $subDebet+$dat['DEBET_DAK'];
|
|
$subKredit = $subKredit+$dat['KREDIT_DAK'];
|
|
$subTotal = $subTotal+$dat['KREDIT_DAK']-$dat['DEBET_DAK'];
|
|
|
|
$datDak[$no] += ['DEBET' => number_format($dat['DEBET_DAK'], 2)];
|
|
$datDak[$no] += ['KREDIT' => number_format($dat['KREDIT_DAK'], 2)];
|
|
$datDak[$no++] += ['SUBTOTAL' => number_format($subTotal, 2)];
|
|
}
|
|
foreach ($datDak as $det) {
|
|
$data[$noData++] = $det;
|
|
}
|
|
$hasil[$noAkhir] += ['SUBDEBET' => number_format($subDebet,2)];
|
|
$hasil[$noAkhir] += ['SUBKREDIT' => number_format($subKredit,2)];
|
|
$hasil[$noAkhir] += ['SUBTOTALALL' => number_format($subTotal,2)];
|
|
$hasil[$noAkhir] += ['ISI' => $data];
|
|
} else {
|
|
$salPel = explode(",", $id_pelanggan);
|
|
foreach ($salPel as $key) {
|
|
$no = 0;
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byPERKIRAAN_byPELANGGAN_byPERIODE_forSearch(19, $key, $awal, $akhir);
|
|
foreach ($datDak as $dat) {
|
|
$subDebet = $subDebet+$dat['DEBET_DAK'];
|
|
$subKredit = $subKredit+$dat['KREDIT_DAK'];
|
|
$subTotal = $subTotal+$dat['KREDIT_DAK']-$dat['DEBET_DAK'];
|
|
|
|
$datDak[$no] += ['DEBET' => number_format($dat['DEBET_DAK'], 2)];
|
|
$datDak[$no] += ['KREDIT' => number_format($dat['KREDIT_DAK'], 2)];
|
|
$datDak[$no++] += ['SUBTOTAL' => number_format($subTotal, 2)];
|
|
}
|
|
foreach ($datDak as $det) {
|
|
$data[$noData++] = $det;
|
|
}
|
|
}
|
|
$hasil[$noAkhir] += ['SUBDEBET' => number_format($subDebet,2)];
|
|
$hasil[$noAkhir] += ['SUBKREDIT' => number_format($subKredit,2)];
|
|
$hasil[$noAkhir] += ['SUBTOTALALL' => number_format($subTotal,2)];
|
|
$hasil[$noAkhir] += ['ISI' => $data];
|
|
}
|
|
} else if ($jenis==2) { // Dipisah Pelanggan
|
|
$salPel = explode(",", $id_pelanggan);
|
|
foreach ($salPel as $key) {
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPELANGGAN_beforeTGL(19, $key, $limit);
|
|
if ($sumDak==FALSE OR $sumDak[0]['DEBET']==NULL OR $sumDak[0]['KREDIT']==NULL) {
|
|
$subDebet = 0;
|
|
$subKredit = 0;
|
|
$subTotal = 0;
|
|
} else {
|
|
$subDebet = $sumDak[0]['DEBET'];
|
|
$subKredit = $sumDak[0]['KREDIT'];
|
|
$subTotal = $subKredit-$subDebet;
|
|
}
|
|
|
|
$data = [];
|
|
$noData = 0;
|
|
|
|
$data[$noData++] = [
|
|
'KODE_AKUNTANSI' => "Saldo Awal",
|
|
'TANGGAL' => date_format(date_create($limit), "d/m/Y"),
|
|
'NAMA_PELANGGAN' => "",
|
|
'NAMA_KOTA' => "",
|
|
'CIPTA_DAK' => "",
|
|
'KET_DAK' => "~",
|
|
'DEBET' => number_format($subDebet,2),
|
|
'KREDIT' => number_format($subKredit,2),
|
|
'SUBTOTAL' => number_format($subTotal,2),
|
|
];
|
|
|
|
$no = 0;
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byPERKIRAAN_byPELANGGAN_byPERIODE_forSearch(19, $key, $awal, $akhir);
|
|
foreach ($datDak as $dat) {
|
|
$subDebet = $subDebet+$dat['DEBET_DAK'];
|
|
$subKredit = $subKredit+$dat['KREDIT_DAK'];
|
|
$subTotal = $subTotal+$dat['KREDIT_DAK']-$dat['DEBET_DAK'];
|
|
|
|
$datDak[$no] += ['DEBET' => number_format($dat['DEBET_DAK'], 2)];
|
|
$datDak[$no] += ['KREDIT' => number_format($dat['KREDIT_DAK'], 2)];
|
|
$datDak[$no++] += ['SUBTOTAL' => number_format($subTotal, 2)];
|
|
}
|
|
|
|
foreach ($datDak as $det) {
|
|
$data[$noData++] = $det;
|
|
}
|
|
|
|
$datPelanggan = $this->Amod->getData_Pelanggan_byID($key);
|
|
$nama_pelanggan = $datPelanggan[0]['NAMA_PELANGGAN'];
|
|
if (strlen($nama_pelanggan)>20) {
|
|
$namaPel = substr($nama_pelanggan, 0, 20);
|
|
$namaPel = "$namaPel..";
|
|
} else {
|
|
$namaPel = $nama_pelanggan;
|
|
}
|
|
$hasil[$noAwal++] = [
|
|
'IDSHEET' => $key,
|
|
'FASHEET' => $nama_pelanggan,
|
|
'NASHEET' => $namaPel,
|
|
'SUBDEBET' => number_format($subDebet,2),
|
|
'SUBKREDIT' => number_format($subKredit,2),
|
|
'SUBTOTALALL' => number_format($subTotal,2),
|
|
'ISI' => $data
|
|
];
|
|
}
|
|
}
|
|
|
|
$pilih_tabel = array('No', 'Kode', 'Tanggal', 'Timestamp', 'Pelanggan', 'Nilai DEBET', 'Nilai KREDIT', 'Nilai SUBTOTAL', 'Keterangan');
|
|
|
|
$data = [
|
|
'awal_nota' => date_format(date_create($awal), "d/m/Y"),
|
|
'akhir_nota' => date_format(date_create($akhir), "d/m/Y"),
|
|
'jumlah_kolom' => count($pilih_tabel),
|
|
'nama_tabel' => $pilih_tabel,
|
|
'jenis' => $jenis,
|
|
'hasil' => $hasil,
|
|
'ts' => $timestamp,
|
|
];
|
|
$this->load->view('cetak/KU_Excel_Sub4_DataPembukuanDpPenjualan', $data);
|
|
}
|
|
|
|
public function KU_Excel_Sub4_DataPembukuanFormFee() {
|
|
$awal = $this->input->post('tgl_awalfill');
|
|
$akhir = $this->input->post('tgl_akhirfill');
|
|
$jenis = $this->input->post('jenis_fill');
|
|
$id_pelanggan = $this->input->post('id_pelangganfill');
|
|
$id_sales = $this->input->post('id_salesfill');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
if ($id_sales=="") {
|
|
$id_sales = NULL;
|
|
}
|
|
|
|
if ($id_pelanggan=="") {
|
|
$id_pelanggan = NULL;
|
|
}
|
|
|
|
if ($jenis=="") {
|
|
$jenis = NULL;
|
|
}
|
|
|
|
$data = $this->Amod->getData_FormFeePelanggan_bySALES_byPELANGGAN_byJENIS_byPERIODE_bySEARCH_status01($id_sales, $id_pelanggan, $jenis, $awal, $akhir, NULL);
|
|
$totFee = 0;
|
|
foreach ($data as $key) {
|
|
$totFee = $totFee+$key['NILAI_FFP'];
|
|
}
|
|
|
|
$hasil[0] = $data;
|
|
|
|
$pilih_tabel = array('No', 'Kode', 'Tanggal', 'Jenis', 'Sales', 'Pelanggan', 'Nomor Nota', 'Nomor PO', 'Nilai FEE', 'Keterangan');
|
|
|
|
$data = [
|
|
'awal_nota' => date_format(date_create($awal), "d/m/Y"),
|
|
'akhir_nota' => date_format(date_create($akhir), "d/m/Y"),
|
|
'jumlah_kolom' => count($pilih_tabel),
|
|
'nama_tabel' => $pilih_tabel,
|
|
'totFee' => number_format($totFee,2),
|
|
'hasil' => $hasil,
|
|
'ts' => $timestamp,
|
|
];
|
|
$this->load->view('cetak/KU_Excel_Sub4_DataPembukuanFormFee', $data);
|
|
}
|
|
|
|
public function KU_Excel_Sub4_DataPembukuanFormKaryawan() {
|
|
$awal = $this->input->post('tgl_awalfill');
|
|
$akhir = $this->input->post('tgl_akhirfill');
|
|
$jenis = $this->input->post('jenis_fill');
|
|
$id_karyawan = $this->input->post('id_karyawanfill');
|
|
$id_sales = $this->input->post('id_salesfill');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
if ($id_sales=="") {
|
|
$id_sales = NULL;
|
|
}
|
|
|
|
if ($id_karyawan=="") {
|
|
$id_karyawan = NULL;
|
|
}
|
|
|
|
if ($jenis=="") {
|
|
$jenis = NULL;
|
|
}
|
|
|
|
$data = $this->Amod->getData_FormKaryawan_bySALES_byKARYAWAN_byJENIS_byPERIODE_bySEARCH_status1($id_sales, $id_karyawan, $jenis, $awal, $akhir, NULL);
|
|
$totNilai = 0;
|
|
$no = 0;
|
|
foreach ($data as $key) {
|
|
$datDffk = $this->Amod->getData_DaftarFormKaryawan_byFK($key['ID_FK']);
|
|
$noket = 1;
|
|
$list = "";
|
|
foreach ($datDffk as $dat) {
|
|
$nilai = $dat['NILAI'];
|
|
$ket = $dat['KET_DFFK'];
|
|
if ($noket==count($datDffk)) {
|
|
$list .= "[$noket] $ket ($nilai)";
|
|
} else {
|
|
$list .= "[$noket] $ket ($nilai)\r";
|
|
$noket++;
|
|
}
|
|
}
|
|
|
|
$data[$no++] += ['LIST' => $list];
|
|
$totNilai = $totNilai+$key['NILAI_FK'];
|
|
}
|
|
|
|
$hasil[0] = $data;
|
|
|
|
$pilih_tabel = array('No', 'Kode', 'Tanggal', 'Jenis', 'Sales', 'Karyawan', 'Nilai', 'Keterangan');
|
|
|
|
$data = [
|
|
'awal_nota' => date_format(date_create($awal), "d/m/Y"),
|
|
'akhir_nota' => date_format(date_create($akhir), "d/m/Y"),
|
|
'jumlah_kolom' => count($pilih_tabel),
|
|
'nama_tabel' => $pilih_tabel,
|
|
'totNilai' => number_format($totNilai,2),
|
|
'hasil' => $hasil,
|
|
'ts' => $timestamp,
|
|
];
|
|
$this->load->view('cetak/KU_Excel_Sub4_DataPembukuanFormKaryawan', $data);
|
|
}
|
|
|
|
public function KU_Excel_Sub4_DataPembukuanHutangDagang() {
|
|
$awal = $this->input->post('tgl_awalfill');
|
|
$akhir = $this->input->post('tgl_akhirfill');
|
|
$jenis = $this->input->post('jenis_fill');
|
|
$id_supplier = $this->input->post('id_supplierfill');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
$limit = $this->Amod->generate_subDay($awal, 1);
|
|
|
|
$hasil = [];
|
|
$noAwal = 0;
|
|
$noAkhir = 0;
|
|
|
|
if ($jenis==1) { // Campur jadi satu Laporan
|
|
$hasil[$noAwal] = [
|
|
'IDSHEET' => '0',
|
|
'FASHEET' => "CAMPUR",
|
|
'NASHEET' => "Sesuai Filter"
|
|
];
|
|
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_beforeTGL(15, $limit);
|
|
if ($sumDak==FALSE OR $sumDak[0]['DEBET']==NULL OR $sumDak[0]['KREDIT']==NULL) {
|
|
$subDebet = 0;
|
|
$subKredit = 0;
|
|
$subTotal = 0;
|
|
} else {
|
|
$subDebet = $sumDak[0]['DEBET'];
|
|
$subKredit = $sumDak[0]['KREDIT'];
|
|
$subTotal = $subKredit-$subDebet;
|
|
}
|
|
|
|
$data = [];
|
|
$noData = 0;
|
|
|
|
$data[$noData++] = [
|
|
'KODE_AKUNTANSI' => "Saldo Awal",
|
|
'TANGGAL' => date_format(date_create($limit), "d/m/Y"),
|
|
'NAMA_SUPPLIER' => "",
|
|
'NAMA_KOTA' => "",
|
|
'CIPTA_DAK' => "",
|
|
'KET_DAK' => "~",
|
|
'DEBET' => number_format($subDebet,2),
|
|
'KREDIT' => number_format($subKredit,2),
|
|
'SUBTOTAL' => number_format($subTotal,2),
|
|
];
|
|
|
|
if ($id_supplier=="") {
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byPERKIRAAN_bySUPPLIER_byPERIODE_forSearch(15, NULL, $awal, $akhir);
|
|
$no = 0;
|
|
foreach ($datDak as $dat) {
|
|
$subDebet = $subDebet+$dat['DEBET_DAK'];
|
|
$subKredit = $subKredit+$dat['KREDIT_DAK'];
|
|
$subTotal = $subTotal+$dat['KREDIT_DAK']-$dat['DEBET_DAK'];
|
|
|
|
$datDak[$no] += ['DEBET' => number_format($dat['DEBET_DAK'], 2)];
|
|
$datDak[$no] += ['KREDIT' => number_format($dat['KREDIT_DAK'], 2)];
|
|
$datDak[$no++] += ['SUBTOTAL' => number_format($subTotal, 2)];
|
|
}
|
|
foreach ($datDak as $det) {
|
|
$data[$noData++] = $det;
|
|
}
|
|
$hasil[$noAkhir] += ['SUBDEBET' => number_format($subDebet,2)];
|
|
$hasil[$noAkhir] += ['SUBKREDIT' => number_format($subKredit,2)];
|
|
$hasil[$noAkhir] += ['SUBTOTALALL' => number_format($subTotal,2)];
|
|
$hasil[$noAkhir] += ['ISI' => $data];
|
|
} else {
|
|
$salSup = explode(",", $id_supplier);
|
|
foreach ($salSup as $key) {
|
|
$no = 0;
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byPERKIRAAN_bySUPPLIER_byPERIODE_forSearch(15, $key, $awal, $akhir);
|
|
foreach ($datDak as $dat) {
|
|
$subDebet = $subDebet+$dat['DEBET_DAK'];
|
|
$subKredit = $subKredit+$dat['KREDIT_DAK'];
|
|
$subTotal = $subTotal+$dat['KREDIT_DAK']-$dat['DEBET_DAK'];
|
|
|
|
$datDak[$no] += ['DEBET' => number_format($dat['DEBET_DAK'], 2)];
|
|
$datDak[$no] += ['KREDIT' => number_format($dat['KREDIT_DAK'], 2)];
|
|
$datDak[$no++] += ['SUBTOTAL' => number_format($subTotal, 2)];
|
|
}
|
|
foreach ($datDak as $det) {
|
|
$data[$noData++] = $det;
|
|
}
|
|
}
|
|
$hasil[$noAkhir] += ['SUBDEBET' => number_format($subDebet,2)];
|
|
$hasil[$noAkhir] += ['SUBKREDIT' => number_format($subKredit,2)];
|
|
$hasil[$noAkhir] += ['SUBTOTALALL' => number_format($subTotal,2)];
|
|
$hasil[$noAkhir] += ['ISI' => $data];
|
|
}
|
|
} else if ($jenis==2) { // Dipisah Supplier
|
|
$salSup = explode(",", $id_supplier);
|
|
foreach ($salSup as $key) {
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_bySUPPLIER_beforeTGL(15, $key, $limit);
|
|
if ($sumDak==FALSE OR $sumDak[0]['DEBET']==NULL OR $sumDak[0]['KREDIT']==NULL) {
|
|
$subDebet = 0;
|
|
$subKredit = 0;
|
|
$subTotal = 0;
|
|
} else {
|
|
$subDebet = $sumDak[0]['DEBET'];
|
|
$subKredit = $sumDak[0]['KREDIT'];
|
|
$subTotal = $subKredit-$subDebet;
|
|
}
|
|
|
|
$data = [];
|
|
$noData = 0;
|
|
|
|
$data[$noData++] = [
|
|
'KODE_AKUNTANSI' => "Saldo Awal",
|
|
'TANGGAL' => date_format(date_create($limit), "d/m/Y"),
|
|
'NAMA_SUPPLIER' => "",
|
|
'NAMA_KOTA' => "",
|
|
'CIPTA_DAK' => "",
|
|
'KET_DAK' => "~",
|
|
'DEBET' => number_format($subDebet,2),
|
|
'KREDIT' => number_format($subKredit,2),
|
|
'SUBTOTAL' => number_format($subTotal,2),
|
|
];
|
|
|
|
$no = 0;
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byPERKIRAAN_bySUPPLIER_byPERIODE_forSearch(15, $key, $awal, $akhir);
|
|
foreach ($datDak as $dat) {
|
|
$subDebet = $subDebet+$dat['DEBET_DAK'];
|
|
$subKredit = $subKredit+$dat['KREDIT_DAK'];
|
|
$subTotal = $subTotal+$dat['KREDIT_DAK']-$dat['DEBET_DAK'];
|
|
|
|
$datDak[$no] += ['DEBET' => number_format($dat['DEBET_DAK'], 2)];
|
|
$datDak[$no] += ['KREDIT' => number_format($dat['KREDIT_DAK'], 2)];
|
|
$datDak[$no++] += ['SUBTOTAL' => number_format($subTotal, 2)];
|
|
}
|
|
|
|
foreach ($datDak as $det) {
|
|
$data[$noData++] = $det;
|
|
}
|
|
|
|
$datSupplier = $this->Amod->getData_Supplier_byID($key);
|
|
$nama_supplier = $datSupplier[0]['NAMA_SUPPLIER'];
|
|
if (strlen($nama_supplier)>20) {
|
|
$namaSup = substr($nama_supplier, 0, 20);
|
|
$namaSup = "$namaSup..";
|
|
} else {
|
|
$namaSup = $nama_supplier;
|
|
}
|
|
$hasil[$noAwal++] = [
|
|
'IDSHEET' => $key,
|
|
'FASHEET' => $nama_supplier,
|
|
'NASHEET' => $namaSup,
|
|
'SUBDEBET' => number_format($subDebet,2),
|
|
'SUBKREDIT' => number_format($subKredit,2),
|
|
'SUBTOTALALL' => number_format($subTotal,2),
|
|
'ISI' => $data
|
|
];
|
|
}
|
|
}
|
|
|
|
$pilih_tabel = array('No', 'Kode', 'Tanggal', 'Timestamp', 'Supplier', 'Nilai DEBET', 'Nilai KREDIT', 'Nilai SUBTOTAL', 'Keterangan');
|
|
|
|
$data = [
|
|
'awal_nota' => date_format(date_create($awal), "d/m/Y"),
|
|
'akhir_nota' => date_format(date_create($akhir), "d/m/Y"),
|
|
'jumlah_kolom' => count($pilih_tabel),
|
|
'nama_tabel' => $pilih_tabel,
|
|
'jenis' => $jenis,
|
|
'hasil' => $hasil,
|
|
'ts' => $timestamp,
|
|
];
|
|
$this->load->view('cetak/KU_Excel_Sub4_DataPembukuanHutangDagang', $data);
|
|
}
|
|
|
|
public function KU_Excel_Sub4_DataPembukuanPiutangDagang() {
|
|
$awal = $this->input->post('tgl_awalfill');
|
|
$akhir = $this->input->post('tgl_akhirfill');
|
|
$jenis = $this->input->post('jenis_fill');
|
|
$id_pelanggan = $this->input->post('id_pelangganfill');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
$limit = $this->Amod->generate_subDay($awal, 1);
|
|
|
|
$hasil = [];
|
|
$noAwal = 0;
|
|
$noAkhir = 0;
|
|
|
|
if ($jenis==1) { // Campur jadi satu Laporan
|
|
$hasil[$noAwal] = [
|
|
'IDSHEET' => '0',
|
|
'FASHEET' => "CAMPUR",
|
|
'NASHEET' => "Sesuai Filter"
|
|
];
|
|
|
|
$data = [];
|
|
$noData = 0;
|
|
|
|
if ($id_pelanggan=="") {
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_beforeTGL(3, $limit);
|
|
if ($sumDak==FALSE OR $sumDak[0]['DEBET']==NULL OR $sumDak[0]['KREDIT']==NULL) {
|
|
$subDebet = 0;
|
|
$subKredit = 0;
|
|
$subTotal = 0;
|
|
} else {
|
|
$subDebet = $sumDak[0]['DEBET'];
|
|
$subKredit = $sumDak[0]['KREDIT'];
|
|
$subTotal = $subDebet-$subKredit;
|
|
}
|
|
|
|
$data[$noData++] = [
|
|
'KODE_AKUNTANSI' => "Saldo Awal",
|
|
'TANGGAL' => date_format(date_create($limit), "d/m/Y"),
|
|
'NAMA_PELANGGAN' => "",
|
|
'NAMA_KOTA' => "",
|
|
'CIPTA_DAK' => "",
|
|
'KET_DAK' => "~",
|
|
'DEBET' => number_format($subDebet,2),
|
|
'KREDIT' => number_format($subKredit,2),
|
|
'SUBTOTAL' => number_format($subTotal,2),
|
|
];
|
|
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byPERKIRAAN_byPELANGGAN_byPERIODE_forSearch(3, NULL, $awal, $akhir);
|
|
$no = 0;
|
|
foreach ($datDak as $dat) {
|
|
$subDebet = $subDebet+$dat['DEBET_DAK'];
|
|
$subKredit = $subKredit+$dat['KREDIT_DAK'];
|
|
$subTotal = $subTotal+$dat['DEBET_DAK']-$dat['KREDIT_DAK'];
|
|
|
|
$datDak[$no] += ['DEBET' => number_format($dat['DEBET_DAK'], 2)];
|
|
$datDak[$no] += ['KREDIT' => number_format($dat['KREDIT_DAK'], 2)];
|
|
$datDak[$no++] += ['SUBTOTAL' => number_format($subTotal, 2)];
|
|
}
|
|
foreach ($datDak as $det) {
|
|
$data[$noData++] = $det;
|
|
}
|
|
$hasil[$noAkhir] += ['SUBDEBET' => number_format($subDebet,2)];
|
|
$hasil[$noAkhir] += ['SUBKREDIT' => number_format($subKredit,2)];
|
|
$hasil[$noAkhir] += ['SUBTOTALALL' => number_format($subTotal,2)];
|
|
$hasil[$noAkhir] += ['ISI' => $data];
|
|
} else {
|
|
$totDebet = 0;
|
|
$totKredit = 0;
|
|
$totSubtotal = 0;
|
|
|
|
$salPel = explode(",", $id_pelanggan);
|
|
foreach ($salPel as $key) {
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPELANGGAN_beforeTGL(3, $key, $limit);
|
|
if ($sumDak==FALSE OR $sumDak[0]['DEBET']==NULL OR $sumDak[0]['KREDIT']==NULL) {
|
|
$subDebet = 0;
|
|
$subKredit = 0;
|
|
} else {
|
|
$subDebet = $sumDak[0]['DEBET'];
|
|
$subKredit = $sumDak[0]['KREDIT'];
|
|
}
|
|
$totDebet = $totDebet+$subDebet;
|
|
$totKredit = $totKredit+$subKredit;
|
|
$totSubtotal = $totSubtotal+$subDebet-$subKredit;
|
|
}
|
|
|
|
$data[$noData++] = [
|
|
'KODE_AKUNTANSI' => "Saldo Awal",
|
|
'TANGGAL' => date_format(date_create($limit), "d/m/Y"),
|
|
'NAMA_PELANGGAN' => "",
|
|
'NAMA_KOTA' => "",
|
|
'CIPTA_DAK' => "",
|
|
'KET_DAK' => "~",
|
|
'DEBET' => number_format($totDebet,2),
|
|
'KREDIT' => number_format($totKredit,2),
|
|
'SUBTOTAL' => number_format($totSubtotal,2),
|
|
];
|
|
|
|
foreach ($salPel as $key) {
|
|
$no = 0;
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byPERKIRAAN_byPELANGGAN_byPERIODE_forSearch(3, $key, $awal, $akhir);
|
|
foreach ($datDak as $dat) {
|
|
$totSubtotal = $totSubtotal+$dat['DEBET_DAK']-$dat['KREDIT_DAK'];
|
|
|
|
$datDak[$no] += ['DEBET' => number_format($dat['DEBET_DAK'], 2)];
|
|
$datDak[$no] += ['KREDIT' => number_format($dat['KREDIT_DAK'], 2)];
|
|
$datDak[$no++] += ['SUBTOTAL' => number_format($totSubtotal, 2)];
|
|
}
|
|
foreach ($datDak as $det) {
|
|
$data[$noData++] = $det;
|
|
}
|
|
}
|
|
|
|
$hasil[$noAkhir] += ['SUBDEBET' => number_format($totDebet,2)];
|
|
$hasil[$noAkhir] += ['SUBKREDIT' => number_format($totKredit,2)];
|
|
$hasil[$noAkhir] += ['SUBTOTALALL' => number_format($totSubtotal,2)];
|
|
$hasil[$noAkhir] += ['ISI' => $data];
|
|
}
|
|
} else if ($jenis==2) { // Dipisah Pelanggan
|
|
$salPel = explode(",", $id_pelanggan);
|
|
foreach ($salPel as $key) {
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPELANGGAN_beforeTGL(3, $key, $limit);
|
|
if ($sumDak==FALSE OR $sumDak[0]['DEBET']==NULL OR $sumDak[0]['KREDIT']==NULL) {
|
|
$subDebet = 0;
|
|
$subKredit = 0;
|
|
$subTotal = 0;
|
|
} else {
|
|
$subDebet = $sumDak[0]['DEBET'];
|
|
$subKredit = $sumDak[0]['KREDIT'];
|
|
$subTotal = $subDebet-$subKredit;
|
|
}
|
|
|
|
$data = [];
|
|
$noData = 0;
|
|
|
|
$data[$noData++] = [
|
|
'KODE_AKUNTANSI' => "Saldo Awal",
|
|
'TANGGAL' => date_format(date_create($limit), "d/m/Y"),
|
|
'NAMA_PELANGGAN' => "",
|
|
'NAMA_KOTA' => "",
|
|
'CIPTA_DAK' => "",
|
|
'KET_DAK' => "~",
|
|
'DEBET' => number_format($subDebet,2),
|
|
'KREDIT' => number_format($subKredit,2),
|
|
'SUBTOTAL' => number_format($subTotal,2),
|
|
];
|
|
|
|
$no = 0;
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byPERKIRAAN_byPELANGGAN_byPERIODE_forSearch(3, $key, $awal, $akhir);
|
|
foreach ($datDak as $dat) {
|
|
$subDebet = $subDebet+$dat['DEBET_DAK'];
|
|
$subKredit = $subKredit+$dat['KREDIT_DAK'];
|
|
$subTotal = $subTotal+$dat['DEBET_DAK']-$dat['KREDIT_DAK'];
|
|
|
|
$datDak[$no] += ['DEBET' => number_format($dat['DEBET_DAK'], 2)];
|
|
$datDak[$no] += ['KREDIT' => number_format($dat['KREDIT_DAK'], 2)];
|
|
$datDak[$no++] += ['SUBTOTAL' => number_format($subTotal, 2)];
|
|
}
|
|
|
|
foreach ($datDak as $det) {
|
|
$data[$noData++] = $det;
|
|
}
|
|
|
|
$datPelanggan = $this->Amod->getData_Pelanggan_byID($key);
|
|
$nama_pelanggan = $datPelanggan[0]['NAMA_PELANGGAN'];
|
|
if (strlen($nama_pelanggan)>20) {
|
|
$namaPel = substr($nama_pelanggan, 0, 20);
|
|
$namaPel = "$namaPel..";
|
|
} else {
|
|
$namaPel = $nama_pelanggan;
|
|
}
|
|
$hasil[$noAwal++] = [
|
|
'IDSHEET' => $key,
|
|
'FASHEET' => $nama_pelanggan,
|
|
'NASHEET' => $namaPel,
|
|
'SUBDEBET' => number_format($subDebet,2),
|
|
'SUBKREDIT' => number_format($subKredit,2),
|
|
'SUBTOTALALL' => number_format($subTotal,2),
|
|
'ISI' => $data
|
|
];
|
|
}
|
|
}
|
|
|
|
$pilih_tabel = array('No', 'Kode', 'Tanggal', 'Timestamp', 'Pelanggan', 'Nilai DEBET', 'Nilai KREDIT', 'Nilai SUBTOTAL', 'Keterangan');
|
|
|
|
$data = [
|
|
'awal_nota' => date_format(date_create($awal), "d/m/Y"),
|
|
'akhir_nota' => date_format(date_create($akhir), "d/m/Y"),
|
|
'jumlah_kolom' => count($pilih_tabel),
|
|
'nama_tabel' => $pilih_tabel,
|
|
'jenis' => $jenis,
|
|
'hasil' => $hasil,
|
|
'ts' => $timestamp,
|
|
];
|
|
$this->load->view('cetak/KU_Excel_Sub4_DataPembukuanPiutangDagang', $data);
|
|
}
|
|
|
|
public function KU_Excel_Sub4_DataPembukuanPiutangKaryawan() {
|
|
$awal = $this->input->post('tgl_awalfill');
|
|
$akhir = $this->input->post('tgl_akhirfill');
|
|
$jenis = $this->input->post('jenis_fill');
|
|
$id_karyawan = $this->input->post('id_karyawanfill');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
$limit = $this->Amod->generate_subDay($awal, 1);
|
|
|
|
$hasil = [];
|
|
$noAwal = 0;
|
|
$noAkhir = 0;
|
|
|
|
if ($jenis==1) { // Campur jadi satu Laporan
|
|
$hasil[$noAwal] = [
|
|
'IDSHEET' => '0',
|
|
'FASHEET' => "CAMPUR",
|
|
'NASHEET' => "Sesuai Filter"
|
|
];
|
|
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_beforeTGL(5, $limit);
|
|
if ($sumDak==FALSE OR $sumDak[0]['DEBET']==NULL OR $sumDak[0]['KREDIT']==NULL) {
|
|
$subDebet = 0;
|
|
$subKredit = 0;
|
|
$subTotal = 0;
|
|
} else {
|
|
$subDebet = $sumDak[0]['DEBET'];
|
|
$subKredit = $sumDak[0]['KREDIT'];
|
|
$subTotal = $subDebet-$subKredit;
|
|
}
|
|
|
|
$data = [];
|
|
$noData = 0;
|
|
|
|
$data[$noData++] = [
|
|
'KODE_AKUNTANSI' => "Saldo Awal",
|
|
'TANGGAL' => date_format(date_create($limit), "d/m/Y"),
|
|
'NAMA_PANGGILAN_KARYAWAN' => "",
|
|
'CIPTA_DAK' => "",
|
|
'KET_DAK' => "~",
|
|
'DEBET' => number_format($subDebet,2),
|
|
'KREDIT' => number_format($subKredit,2),
|
|
'SUBTOTAL' => number_format($subTotal,2),
|
|
];
|
|
|
|
if ($id_karyawan=="") {
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byPERKIRAAN_byKARYAWAN_byPERIODE_forSearch(5, NULL, $awal, $akhir);
|
|
$no = 0;
|
|
foreach ($datDak as $dat) {
|
|
$subDebet = $subDebet+$dat['DEBET_DAK'];
|
|
$subKredit = $subKredit+$dat['KREDIT_DAK'];
|
|
$subTotal = $subTotal+$dat['DEBET_DAK']-$dat['KREDIT_DAK'];
|
|
|
|
$datDak[$no] += ['DEBET' => number_format($dat['DEBET_DAK'], 2)];
|
|
$datDak[$no] += ['KREDIT' => number_format($dat['KREDIT_DAK'], 2)];
|
|
$datDak[$no++] += ['SUBTOTAL' => number_format($subTotal, 2)];
|
|
}
|
|
foreach ($datDak as $det) {
|
|
$data[$noData++] = $det;
|
|
}
|
|
$hasil[$noAkhir] += ['SUBDEBET' => number_format($subDebet,2)];
|
|
$hasil[$noAkhir] += ['SUBKREDIT' => number_format($subKredit,2)];
|
|
$hasil[$noAkhir] += ['SUBTOTALALL' => number_format($subTotal,2)];
|
|
$hasil[$noAkhir] += ['ISI' => $data];
|
|
} else {
|
|
$salKar = explode(",", $id_karyawan);
|
|
foreach ($salKar as $key) {
|
|
$no = 0;
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byPERKIRAAN_byKARYAWAN_byPERIODE_forSearch(5, $key, $awal, $akhir);
|
|
foreach ($datDak as $dat) {
|
|
$subDebet = $subDebet+$dat['DEBET_DAK'];
|
|
$subKredit = $subKredit+$dat['KREDIT_DAK'];
|
|
$subTotal = $subTotal+$dat['DEBET_DAK']-$dat['KREDIT_DAK'];
|
|
|
|
$datDak[$no] += ['DEBET' => number_format($dat['DEBET_DAK'], 2)];
|
|
$datDak[$no] += ['KREDIT' => number_format($dat['KREDIT_DAK'], 2)];
|
|
$datDak[$no++] += ['SUBTOTAL' => number_format($subTotal, 2)];
|
|
}
|
|
foreach ($datDak as $det) {
|
|
$data[$noData++] = $det;
|
|
}
|
|
}
|
|
$hasil[$noAkhir] += ['SUBDEBET' => number_format($subDebet,2)];
|
|
$hasil[$noAkhir] += ['SUBKREDIT' => number_format($subKredit,2)];
|
|
$hasil[$noAkhir] += ['SUBTOTALALL' => number_format($subTotal,2)];
|
|
$hasil[$noAkhir] += ['ISI' => $data];
|
|
}
|
|
} else if ($jenis==2) { // Dipisah Karyawan
|
|
$salKar = explode(",", $id_karyawan);
|
|
foreach ($salKar as $key) {
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byKARYAWAN_beforeTGL(5, $key, $limit);
|
|
if ($sumDak==FALSE OR $sumDak[0]['DEBET']==NULL OR $sumDak[0]['KREDIT']==NULL) {
|
|
$subDebet = 0;
|
|
$subKredit = 0;
|
|
$subTotal = 0;
|
|
} else {
|
|
$subDebet = $sumDak[0]['DEBET'];
|
|
$subKredit = $sumDak[0]['KREDIT'];
|
|
$subTotal = $subDebet-$subKredit;
|
|
}
|
|
|
|
$data = [];
|
|
$noData = 0;
|
|
|
|
$data[$noData++] = [
|
|
'KODE_AKUNTANSI' => "Saldo Awal",
|
|
'TANGGAL' => date_format(date_create($limit), "d/m/Y"),
|
|
'NAMA_PANGGILAN_KARYAWAN' => "",
|
|
'CIPTA_DAK' => "",
|
|
'KET_DAK' => "~",
|
|
'DEBET' => number_format($subDebet,2),
|
|
'KREDIT' => number_format($subKredit,2),
|
|
'SUBTOTAL' => number_format($subTotal,2),
|
|
];
|
|
|
|
$no = 0;
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byPERKIRAAN_byKARYAWAN_byPERIODE_forSearch(5, $key, $awal, $akhir);
|
|
foreach ($datDak as $dat) {
|
|
$subDebet = $subDebet+$dat['DEBET_DAK'];
|
|
$subKredit = $subKredit+$dat['KREDIT_DAK'];
|
|
$subTotal = $subTotal+$dat['DEBET_DAK']-$dat['KREDIT_DAK'];
|
|
|
|
$datDak[$no] += ['DEBET' => number_format($dat['DEBET_DAK'], 2)];
|
|
$datDak[$no] += ['KREDIT' => number_format($dat['KREDIT_DAK'], 2)];
|
|
$datDak[$no++] += ['SUBTOTAL' => number_format($subTotal, 2)];
|
|
}
|
|
|
|
foreach ($datDak as $det) {
|
|
$data[$noData++] = $det;
|
|
}
|
|
|
|
$datKaryawan = $this->Amod->getData_Karyawan_byID($key);
|
|
$nama_karyawan = $datKaryawan[0]['NAMA_PANGGILAN_KARYAWAN'];
|
|
if (strlen($nama_karyawan)>20) {
|
|
$namaKar = substr($nama_karyawan, 0, 20);
|
|
$namaKar = "$namaKar..";
|
|
} else {
|
|
$namaKar = $nama_karyawan;
|
|
}
|
|
$hasil[$noAwal++] = [
|
|
'IDSHEET' => $key,
|
|
'FASHEET' => $nama_karyawan,
|
|
'NASHEET' => $namaKar,
|
|
'SUBDEBET' => number_format($subDebet,2),
|
|
'SUBKREDIT' => number_format($subKredit,2),
|
|
'SUBTOTALALL' => number_format($subTotal,2),
|
|
'ISI' => $data
|
|
];
|
|
}
|
|
}
|
|
|
|
$pilih_tabel = array('No', 'Kode', 'Tanggal', 'Timestamp', 'Karyawan', 'Nilai DEBET', 'Nilai KREDIT', 'Nilai SUBTOTAL', 'Keterangan');
|
|
|
|
$data = [
|
|
'awal_nota' => date_format(date_create($awal), "d/m/Y"),
|
|
'akhir_nota' => date_format(date_create($akhir), "d/m/Y"),
|
|
'jumlah_kolom' => count($pilih_tabel),
|
|
'nama_tabel' => $pilih_tabel,
|
|
'jenis' => $jenis,
|
|
'hasil' => $hasil,
|
|
'ts' => $timestamp,
|
|
];
|
|
$this->load->view('cetak/KU_Excel_Sub4_DataPembukuanPiutangKaryawan', $data);
|
|
}
|
|
|
|
public function KU_Excel_Sub4_DataPembukuanPiutangPihakke3() {
|
|
$awal = $this->input->post('tgl_awalfill');
|
|
$akhir = $this->input->post('tgl_akhirfill');
|
|
$jenis = $this->input->post('jenis_fill');
|
|
$id_pihakke3 = $this->input->post('id_pihakke3fill');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
$limit = $this->Amod->generate_subDay($awal, 1);
|
|
|
|
$hasil = [];
|
|
$noAwal = 0;
|
|
$noAkhir = 0;
|
|
|
|
if ($jenis==1) { // Campur jadi satu Laporan
|
|
$hasil[$noAwal] = [
|
|
'IDSHEET' => '0',
|
|
'FASHEET' => "CAMPUR",
|
|
'NASHEET' => "Sesuai Filter"
|
|
];
|
|
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_beforeTGL(6, $limit);
|
|
if ($sumDak==FALSE OR $sumDak[0]['DEBET']==NULL OR $sumDak[0]['KREDIT']==NULL) {
|
|
$subDebet = 0;
|
|
$subKredit = 0;
|
|
$subTotal = 0;
|
|
} else {
|
|
$subDebet = $sumDak[0]['DEBET'];
|
|
$subKredit = $sumDak[0]['KREDIT'];
|
|
$subTotal = $subDebet-$subKredit;
|
|
}
|
|
|
|
$data = [];
|
|
$noData = 0;
|
|
|
|
$data[$noData++] = [
|
|
'KODE_AKUNTANSI' => "Saldo Awal",
|
|
'TANGGAL' => date_format(date_create($limit), "d/m/Y"),
|
|
'NAMA_PIHAKKE3' => "",
|
|
'NAMA_KOTA' => "",
|
|
'CIPTA_DAK' => "",
|
|
'KET_DAK' => "~",
|
|
'DEBET' => number_format($subDebet,2),
|
|
'KREDIT' => number_format($subKredit,2),
|
|
'SUBTOTAL' => number_format($subTotal,2),
|
|
];
|
|
|
|
if ($id_pihakke3=="") {
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byPERKIRAAN_byPIHAKKE3_byPERIODE_forSearch(6, NULL, $awal, $akhir);
|
|
$no = 0;
|
|
foreach ($datDak as $dat) {
|
|
$subDebet = $subDebet+$dat['DEBET_DAK'];
|
|
$subKredit = $subKredit+$dat['KREDIT_DAK'];
|
|
$subTotal = $subTotal+$dat['DEBET_DAK']-$dat['KREDIT_DAK'];
|
|
|
|
$datDak[$no] += ['DEBET' => number_format($dat['DEBET_DAK'], 2)];
|
|
$datDak[$no] += ['KREDIT' => number_format($dat['KREDIT_DAK'], 2)];
|
|
$datDak[$no++] += ['SUBTOTAL' => number_format($subTotal, 2)];
|
|
}
|
|
foreach ($datDak as $det) {
|
|
$data[$noData++] = $det;
|
|
}
|
|
$hasil[$noAkhir] += ['SUBDEBET' => number_format($subDebet,2)];
|
|
$hasil[$noAkhir] += ['SUBKREDIT' => number_format($subKredit,2)];
|
|
$hasil[$noAkhir] += ['SUBTOTALALL' => number_format($subTotal,2)];
|
|
$hasil[$noAkhir] += ['ISI' => $data];
|
|
} else {
|
|
$salPih = explode(",", $id_pihakke3);
|
|
foreach ($salPih as $key) {
|
|
$no = 0;
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byPERKIRAAN_byPIHAKKE3_byPERIODE_forSearch(6, $key, $awal, $akhir);
|
|
foreach ($datDak as $dat) {
|
|
$subDebet = $subDebet+$dat['DEBET_DAK'];
|
|
$subKredit = $subKredit+$dat['KREDIT_DAK'];
|
|
$subTotal = $subTotal+$dat['DEBET_DAK']-$dat['KREDIT_DAK'];
|
|
|
|
$datDak[$no] += ['DEBET' => number_format($dat['DEBET_DAK'], 2)];
|
|
$datDak[$no] += ['KREDIT' => number_format($dat['KREDIT_DAK'], 2)];
|
|
$datDak[$no++] += ['SUBTOTAL' => number_format($subTotal, 2)];
|
|
}
|
|
foreach ($datDak as $det) {
|
|
$data[$noData++] = $det;
|
|
}
|
|
}
|
|
$hasil[$noAkhir] += ['SUBDEBET' => number_format($subDebet,2)];
|
|
$hasil[$noAkhir] += ['SUBKREDIT' => number_format($subKredit,2)];
|
|
$hasil[$noAkhir] += ['SUBTOTALALL' => number_format($subTotal,2)];
|
|
$hasil[$noAkhir] += ['ISI' => $data];
|
|
}
|
|
} else if ($jenis==2) { // Dipisah Pihakke3
|
|
$salPih = explode(",", $id_pihakke3);
|
|
foreach ($salPih as $key) {
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPIHAKKE3_beforeTGL(6, $key, $limit);
|
|
if ($sumDak==FALSE OR $sumDak[0]['DEBET']==NULL OR $sumDak[0]['KREDIT']==NULL) {
|
|
$subDebet = 0;
|
|
$subKredit = 0;
|
|
$subTotal = 0;
|
|
} else {
|
|
$subDebet = $sumDak[0]['DEBET'];
|
|
$subKredit = $sumDak[0]['KREDIT'];
|
|
$subTotal = $subDebet-$subKredit;
|
|
}
|
|
|
|
$data = [];
|
|
$noData = 0;
|
|
|
|
$data[$noData++] = [
|
|
'KODE_AKUNTANSI' => "Saldo Awal",
|
|
'TANGGAL' => date_format(date_create($limit), "d/m/Y"),
|
|
'NAMA_PIHAKKE3' => "",
|
|
'NAMA_KOTA' => "",
|
|
'CIPTA_DAK' => "",
|
|
'KET_DAK' => "~",
|
|
'DEBET' => number_format($subDebet,2),
|
|
'KREDIT' => number_format($subKredit,2),
|
|
'SUBTOTAL' => number_format($subTotal,2),
|
|
];
|
|
|
|
$no = 0;
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byPERKIRAAN_byPIHAKKE3_byPERIODE_forSearch(6, $key, $awal, $akhir);
|
|
foreach ($datDak as $dat) {
|
|
$subDebet = $subDebet+$dat['DEBET_DAK'];
|
|
$subKredit = $subKredit+$dat['KREDIT_DAK'];
|
|
$subTotal = $subTotal+$dat['DEBET_DAK']-$dat['KREDIT_DAK'];
|
|
|
|
$datDak[$no] += ['DEBET' => number_format($dat['DEBET_DAK'], 2)];
|
|
$datDak[$no] += ['KREDIT' => number_format($dat['KREDIT_DAK'], 2)];
|
|
$datDak[$no++] += ['SUBTOTAL' => number_format($subTotal, 2)];
|
|
}
|
|
|
|
foreach ($datDak as $det) {
|
|
$data[$noData++] = $det;
|
|
}
|
|
|
|
$datPihakke3 = $this->Amod->getData_Pihakke3_byID($key);
|
|
$nama_pihakke3 = $datPihakke3[0]['NAMA_PIHAKKE3'];
|
|
if (strlen($nama_pihakke3)>20) {
|
|
$namaPih = substr($nama_pihakke3, 0, 20);
|
|
$namaPih = "$namaPih..";
|
|
} else {
|
|
$namaPih = $nama_pihakke3;
|
|
}
|
|
$hasil[$noAwal++] = [
|
|
'IDSHEET' => $key,
|
|
'FASHEET' => $nama_pihakke3,
|
|
'NASHEET' => $namaPih,
|
|
'SUBDEBET' => number_format($subDebet,2),
|
|
'SUBKREDIT' => number_format($subKredit,2),
|
|
'SUBTOTALALL' => number_format($subTotal,2),
|
|
'ISI' => $data
|
|
];
|
|
}
|
|
}
|
|
|
|
$pilih_tabel = array('No', 'Kode', 'Tanggal', 'Timestamp', 'Pihakke3', 'Nilai DEBET', 'Nilai KREDIT', 'Nilai SUBTOTAL', 'Keterangan');
|
|
|
|
$data = [
|
|
'awal_nota' => date_format(date_create($awal), "d/m/Y"),
|
|
'akhir_nota' => date_format(date_create($akhir), "d/m/Y"),
|
|
'jumlah_kolom' => count($pilih_tabel),
|
|
'nama_tabel' => $pilih_tabel,
|
|
'jenis' => $jenis,
|
|
'hasil' => $hasil,
|
|
'ts' => $timestamp,
|
|
];
|
|
$this->load->view('cetak/KU_Excel_Sub4_DataPembukuanPiutangPihakke3', $data);
|
|
}
|
|
|
|
public function KU_Excel_Sub4_DataPembukuanSaldoBank() {
|
|
$awal = $this->input->post('tgl_awalfill');
|
|
$akhir = $this->input->post('tgl_akhirfill');
|
|
$versi = $this->input->post('versi_fill');
|
|
$jenis = $this->input->post('jenis_fill');
|
|
$id_bank = $this->input->post('id_bankfill');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
$limit = $this->Amod->generate_subDay($awal, 1);
|
|
|
|
$hasil = [];
|
|
$noAwal = 0;
|
|
$noAkhir = 0;
|
|
|
|
if ($jenis==1) { // Campur jadi satu Laporan
|
|
$hasil[$noAwal] = [
|
|
'IDSHEET' => '0',
|
|
'VESHEET' => $versi,
|
|
'FASHEET' => "CAMPUR",
|
|
'NASHEET' => "Sesuai Filter"
|
|
];
|
|
|
|
if ($id_bank=="") {
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_beforeTGL(2, $limit);
|
|
if ($sumDak==FALSE OR $sumDak[0]['DEBET']==NULL OR $sumDak[0]['KREDIT']==NULL) {
|
|
$subDebet = 0;
|
|
$subKredit = 0;
|
|
$subTotal = 0;
|
|
} else {
|
|
$subDebet = 0;
|
|
$subKredit = 0;
|
|
$subTotal = $sumDak[0]['DEBET']-$sumDak[0]['KREDIT'];
|
|
}
|
|
} else {
|
|
$subDebet = 0;
|
|
$subKredit = 0;
|
|
$subTotal = 0;
|
|
$salBank = explode(",", $id_bank);
|
|
foreach ($salBank as $key) {
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byBANK_beforeTGL(2, $key, $limit);
|
|
if ($sumDak==FALSE OR $sumDak[0]['DEBET']==NULL OR $sumDak[0]['KREDIT']==NULL) {
|
|
|
|
} else {
|
|
$subTotal = $subTotal+$sumDak[0]['DEBET']-$sumDak[0]['KREDIT'];
|
|
}
|
|
}
|
|
}
|
|
|
|
$data = [];
|
|
$noData = 0;
|
|
|
|
$data[$noData++] = [
|
|
'KODE_AKUNTANSI' => "Saldo Awal",
|
|
'TANGGAL' => date_format(date_create($limit), "d/m/Y"),
|
|
'JENIS_DAK' => 0,
|
|
'DKOBA' => "",
|
|
'DNABA' => "",
|
|
'EKOBA' => "",
|
|
'ENABA' => "",
|
|
'KODE_PERKIRAAN' => "",
|
|
'NAMA_PERKIRAAN' => "",
|
|
'CIPTA_DAK' => "",
|
|
'KET_DAK' => "~",
|
|
'DEBET' => "",
|
|
'KREDIT' => "",
|
|
'SUBTOTAL' => number_format($subTotal,2),
|
|
];
|
|
|
|
if ($id_bank=="") {
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byPERKIRAAN_byBANK_byPERIODE_forSearch(2, NULL, $awal, $akhir);
|
|
$no = 0;
|
|
foreach ($datDak as $dat) {
|
|
$subDebet = $subDebet+$dat['DEBET_DAK'];
|
|
$subKredit = $subKredit+$dat['KREDIT_DAK'];
|
|
$subTotal = $subTotal+$dat['DEBET_DAK']-$dat['KREDIT_DAK'];
|
|
|
|
$datDak[$no] += ['DEBET' => number_format($dat['DEBET_DAK'], 2)];
|
|
$datDak[$no] += ['KREDIT' => number_format($dat['KREDIT_DAK'], 2)];
|
|
$datDak[$no++] += ['SUBTOTAL' => number_format($subTotal, 2)];
|
|
}
|
|
foreach ($datDak as $det) {
|
|
$data[$noData++] = $det;
|
|
}
|
|
|
|
$hasil[$noAkhir] += ['SUBDEBET' => number_format($subDebet,2)];
|
|
$hasil[$noAkhir] += ['SUBKREDIT' => number_format($subKredit,2)];
|
|
$hasil[$noAkhir] += ['SUBTOTALALL' => number_format($subTotal,2)];
|
|
$hasil[$noAkhir] += ['ISI' => $data];
|
|
} else {
|
|
$salBank = explode(",", $id_bank);
|
|
foreach ($salBank as $key) {
|
|
if ($versi==1) {
|
|
$no = 0;
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byPERKIRAAN_byBANK_byPERIODE_forSearch(2, $key, $awal, $akhir);
|
|
foreach ($datDak as $dat) {
|
|
$subDebet = $subDebet+$dat['DEBET_DAK'];
|
|
$subKredit = $subKredit+$dat['KREDIT_DAK'];
|
|
$subTotal = $subTotal+$dat['DEBET_DAK']-$dat['KREDIT_DAK'];
|
|
|
|
$datDak[$no] += ['DEBET' => number_format($dat['DEBET_DAK'], 2)];
|
|
$datDak[$no] += ['KREDIT' => number_format($dat['KREDIT_DAK'], 2)];
|
|
$datDak[$no++] += ['SUBTOTAL' => number_format($subTotal, 2)];
|
|
}
|
|
foreach ($datDak as $det) {
|
|
$data[$noData++] = $det;
|
|
}
|
|
} else if ($versi==2) {
|
|
$no = 0;
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byBANK_byPERIODE_forSaldoBank($key, $awal, $akhir);
|
|
foreach ($datDak as $dat) {
|
|
if ($dat['AS_BANK']==NULL AND $dat['AS_KAS']==NULL) {
|
|
$subDebet = $subDebet+$dat['KREDIT_DAK'];
|
|
$subKredit = $subKredit+$dat['DEBET_DAK'];
|
|
$subTotal = $subTotal+$dat['KREDIT_DAK']-$dat['DEBET_DAK'];
|
|
|
|
$datDak[$no] += ['DEBET' => number_format($dat['KREDIT_DAK'], 2)];
|
|
$datDak[$no] += ['KREDIT' => number_format($dat['DEBET_DAK'], 2)];
|
|
} else if ($dat['AS_BANK']!=NULL AND $dat['BANK_ID']==$key) {
|
|
$subDebet = $subDebet+$dat['KREDIT_DAK'];
|
|
$subKredit = $subKredit+$dat['DEBET_DAK'];
|
|
$subTotal = $subTotal+$dat['KREDIT_DAK']-$dat['DEBET_DAK'];
|
|
|
|
$datDak[$no] += ['DEBET' => number_format($dat['KREDIT_DAK'], 2)];
|
|
$datDak[$no] += ['KREDIT' => number_format($dat['DEBET_DAK'], 2)];
|
|
} else if ($dat['AS_KAS']!=NULL AND $dat['BANK_ID']==$key) {
|
|
$subDebet = $subDebet+$dat['KREDIT_DAK'];
|
|
$subKredit = $subKredit+$dat['DEBET_DAK'];
|
|
$subTotal = $subTotal+$dat['KREDIT_DAK']-$dat['DEBET_DAK'];
|
|
|
|
$datDak[$no] += ['DEBET' => number_format($dat['KREDIT_DAK'], 2)];
|
|
$datDak[$no] += ['KREDIT' => number_format($dat['DEBET_DAK'], 2)];
|
|
} else {
|
|
$subDebet = $subDebet+$dat['DEBET_DAK'];
|
|
$subKredit = $subKredit+$dat['KREDIT_DAK'];
|
|
$subTotal = $subTotal+$dat['DEBET_DAK']-$dat['KREDIT_DAK'];
|
|
|
|
$datDak[$no] += ['DEBET' => number_format($dat['DEBET_DAK'], 2)];
|
|
$datDak[$no] += ['KREDIT' => number_format($dat['KREDIT_DAK'], 2)];
|
|
}
|
|
$datDak[$no++] += ['SUBTOTAL' => number_format($subTotal, 2)];
|
|
}
|
|
foreach ($datDak as $det) {
|
|
$data[$noData++] = $det;
|
|
}
|
|
}
|
|
}
|
|
|
|
$hasil[$noAkhir] += ['SUBDEBET' => number_format($subDebet,2)];
|
|
$hasil[$noAkhir] += ['SUBKREDIT' => number_format($subKredit,2)];
|
|
$hasil[$noAkhir] += ['SUBTOTALALL' => number_format($subTotal,2)];
|
|
$hasil[$noAkhir] += ['ISI' => $data];
|
|
}
|
|
} else if ($jenis==2) { // Dipisah Bank
|
|
$salBank = explode(",", $id_bank);
|
|
foreach ($salBank as $key) {
|
|
$datBank = $this->Amod->getData_Bank_byID($key);
|
|
$kode_bank = $datBank[0]['KODE_BANK'];
|
|
$nama_bank = $datBank[0]['NAMA_BANK'];
|
|
$kona_bank = "$kode_bank | $nama_bank";
|
|
if (strlen($kona_bank)>20) {
|
|
$namaBank = substr($kona_bank, 0, 20);
|
|
$namaBank = "$namaBank..";
|
|
} else {
|
|
$namaBank = $kona_bank;
|
|
}
|
|
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byBANK_beforeTGL(2, $key, $limit);
|
|
if ($sumDak==FALSE OR $sumDak[0]['DEBET']==NULL OR $sumDak[0]['KREDIT']==NULL) {
|
|
$subDebet = 0;
|
|
$subKredit = 0;
|
|
$subTotal = 0;
|
|
} else {
|
|
$subDebet = 0;
|
|
$subKredit = 0;
|
|
$subTotal = $sumDak[0]['DEBET']-$sumDak[0]['KREDIT'];
|
|
}
|
|
|
|
$data = [];
|
|
$noData = 0;
|
|
|
|
$data[$noData++] = [
|
|
'KODE_AKUNTANSI' => "Saldo Awal",
|
|
'TANGGAL' => date_format(date_create($limit), "d/m/Y"),
|
|
'JENIS_DAK' => 0,
|
|
'DKOBA' => "",
|
|
'DNABA' => "",
|
|
'EKOBA' => "",
|
|
'ENABA' => "",
|
|
'KODE_PERKIRAAN' => "",
|
|
'NAMA_PERKIRAAN' => "",
|
|
'CIPTA_DAK' => "",
|
|
'KET_DAK' => "~",
|
|
'DEBET' => "",
|
|
'KREDIT' => "",
|
|
'SUBTOTAL' => number_format($subTotal,2),
|
|
];
|
|
|
|
if ($versi==1) {
|
|
$no = 0;
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byPERKIRAAN_byBANK_byPERIODE_forSearch(2, $key, $awal, $akhir);
|
|
foreach ($datDak as $dat) {
|
|
$subDebet = $subDebet+$dat['DEBET_DAK'];
|
|
$subKredit = $subKredit+$dat['KREDIT_DAK'];
|
|
$subTotal = $subTotal+$dat['DEBET_DAK']-$dat['KREDIT_DAK'];
|
|
|
|
$datDak[$no] += ['DEBET' => number_format($dat['DEBET_DAK'], 2)];
|
|
$datDak[$no] += ['KREDIT' => number_format($dat['KREDIT_DAK'], 2)];
|
|
$datDak[$no++] += ['SUBTOTAL' => number_format($subTotal, 2)];
|
|
}
|
|
|
|
foreach ($datDak as $det) {
|
|
$data[$noData++] = $det;
|
|
}
|
|
} else if ($versi==2) {
|
|
$no = 0;
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byBANK_byPERIODE_forSaldoBank($key, $awal, $akhir);
|
|
foreach ($datDak as $dat) {
|
|
if ($dat['AS_BANK']==NULL AND $dat['AS_KAS']==NULL) {
|
|
$subDebet = $subDebet+$dat['KREDIT_DAK'];
|
|
$subKredit = $subKredit+$dat['DEBET_DAK'];
|
|
$subTotal = $subTotal+$dat['KREDIT_DAK']-$dat['DEBET_DAK'];
|
|
|
|
$datDak[$no] += ['DEBET' => number_format($dat['KREDIT_DAK'], 2)];
|
|
$datDak[$no] += ['KREDIT' => number_format($dat['DEBET_DAK'], 2)];
|
|
} else if ($dat['AS_BANK']!=NULL AND $dat['BANK_ID']==$key) {
|
|
$subDebet = $subDebet+$dat['KREDIT_DAK'];
|
|
$subKredit = $subKredit+$dat['DEBET_DAK'];
|
|
$subTotal = $subTotal+$dat['KREDIT_DAK']-$dat['DEBET_DAK'];
|
|
|
|
$datDak[$no] += ['DEBET' => number_format($dat['KREDIT_DAK'], 2)];
|
|
$datDak[$no] += ['KREDIT' => number_format($dat['DEBET_DAK'], 2)];
|
|
} else if ($dat['AS_KAS']!=NULL AND $dat['BANK_ID']==$key) {
|
|
$subDebet = $subDebet+$dat['KREDIT_DAK'];
|
|
$subKredit = $subKredit+$dat['DEBET_DAK'];
|
|
$subTotal = $subTotal+$dat['KREDIT_DAK']-$dat['DEBET_DAK'];
|
|
|
|
$datDak[$no] += ['DEBET' => number_format($dat['KREDIT_DAK'], 2)];
|
|
$datDak[$no] += ['KREDIT' => number_format($dat['DEBET_DAK'], 2)];
|
|
} else {
|
|
$subDebet = $subDebet+$dat['DEBET_DAK'];
|
|
$subKredit = $subKredit+$dat['KREDIT_DAK'];
|
|
$subTotal = $subTotal+$dat['DEBET_DAK']-$dat['KREDIT_DAK'];
|
|
|
|
$datDak[$no] += ['DEBET' => number_format($dat['DEBET_DAK'], 2)];
|
|
$datDak[$no] += ['KREDIT' => number_format($dat['KREDIT_DAK'], 2)];
|
|
}
|
|
$datDak[$no++] += ['SUBTOTAL' => number_format($subTotal, 2)];
|
|
}
|
|
foreach ($datDak as $det) {
|
|
$data[$noData++] = $det;
|
|
}
|
|
}
|
|
|
|
$hasil[$noAwal++] = [
|
|
'IDSHEET' => $key,
|
|
'VESHEET' => $versi,
|
|
'FASHEET' => $kona_bank,
|
|
'NASHEET' => $namaBank,
|
|
'SUBDEBET' => number_format($subDebet,2),
|
|
'SUBKREDIT' => number_format($subKredit,2),
|
|
'SUBTOTALALL' => number_format($subTotal,2),
|
|
'ISI' => $data
|
|
];
|
|
}
|
|
}
|
|
|
|
$pilih_tabel = array('No', 'Kode', 'Tanggal', 'Timestamp', 'Bank', 'Akun', 'Nilai DEBET', 'Nilai KREDIT', 'Nilai SUBTOTAL', 'Keterangan');
|
|
|
|
$data = [
|
|
'awal_nota' => date_format(date_create($awal), "d/m/Y"),
|
|
'akhir_nota' => date_format(date_create($akhir), "d/m/Y"),
|
|
'jumlah_kolom' => count($pilih_tabel),
|
|
'nama_tabel' => $pilih_tabel,
|
|
'jenis' => $jenis,
|
|
'hasil' => $hasil,
|
|
'ts' => $timestamp,
|
|
];
|
|
$this->load->view('cetak/KU_Excel_Sub4_DataPembukuanSaldoBank', $data);
|
|
}
|
|
|
|
public function KU_Excel_Sub4_DataPembukuanSaldoKas() {
|
|
$awal = $this->input->post('tgl_awalfill');
|
|
$akhir = $this->input->post('tgl_akhirfill');
|
|
$versi = $this->input->post('versi_fill');
|
|
$jenis = $this->input->post('jenis_fill');
|
|
$id_kas = $this->input->post('id_kasfill');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
$limit = $this->Amod->generate_subDay($awal, 1);
|
|
|
|
$hasil = [];
|
|
$noAwal = 0;
|
|
$noAkhir = 0;
|
|
|
|
if ($jenis==1) { // Campur jadi satu Laporan
|
|
$hasil[$noAwal] = [
|
|
'IDSHEET' => '0',
|
|
'VESHEET' => $versi,
|
|
'FASHEET' => "CAMPUR",
|
|
'NASHEET' => "Sesuai Filter"
|
|
];
|
|
|
|
if ($id_kas=="") {
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_beforeTGL(1, $limit);
|
|
if ($sumDak==FALSE OR $sumDak[0]['DEBET']==NULL OR $sumDak[0]['KREDIT']==NULL) {
|
|
$subDebet = 0;
|
|
$subKredit = 0;
|
|
$subTotal = 0;
|
|
} else {
|
|
$subDebet = 0;
|
|
$subKredit = 0;
|
|
$subTotal = $sumDak[0]['DEBET']-$sumDak[0]['KREDIT'];
|
|
}
|
|
} else {
|
|
$subDebet = 0;
|
|
$subKredit = 0;
|
|
$subTotal = 0;
|
|
$salKas = explode(",", $id_kas);
|
|
foreach ($salKas as $key) {
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byKAS_beforeTGL(1, $key, $limit);
|
|
if ($sumDak==FALSE OR $sumDak[0]['DEBET']==NULL OR $sumDak[0]['KREDIT']==NULL) {
|
|
|
|
} else {
|
|
$subTotal = $subTotal+$sumDak[0]['DEBET']-$sumDak[0]['KREDIT'];
|
|
}
|
|
}
|
|
}
|
|
|
|
$data = [];
|
|
$noData = 0;
|
|
|
|
$data[$noData++] = [
|
|
'KODE_AKUNTANSI' => "Saldo Awal",
|
|
'TANGGAL' => date_format(date_create($limit), "d/m/Y"),
|
|
'JENIS_DAK' => 0,
|
|
'DKOKAS' => "",
|
|
'DNAKAS' => "",
|
|
'EKOKAS' => "",
|
|
'ENAKAS' => "",
|
|
'KODE_PERKIRAAN' => "",
|
|
'NAMA_PERKIRAAN' => "",
|
|
'CIPTA_DAK' => "",
|
|
'KET_DAK' => "~",
|
|
'DEBET' => "",
|
|
'KREDIT' => "",
|
|
'SUBTOTAL' => number_format($subTotal,2),
|
|
];
|
|
|
|
if ($id_kas=="") {
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byPERKIRAAN_byKAS_byPERIODE_forSearch(1, NULL, $awal, $akhir);
|
|
$no = 0;
|
|
foreach ($datDak as $dat) {
|
|
$subDebet = $subDebet+$dat['DEBET_DAK'];
|
|
$subKredit = $subKredit+$dat['KREDIT_DAK'];
|
|
$subTotal = $subTotal+$dat['DEBET_DAK']-$dat['KREDIT_DAK'];
|
|
|
|
$datDak[$no] += ['DEBET' => number_format($dat['DEBET_DAK'], 2)];
|
|
$datDak[$no] += ['KREDIT' => number_format($dat['KREDIT_DAK'], 2)];
|
|
$datDak[$no++] += ['SUBTOTAL' => number_format($subTotal, 2)];
|
|
}
|
|
foreach ($datDak as $det) {
|
|
$data[$noData++] = $det;
|
|
}
|
|
|
|
$hasil[$noAkhir] += ['SUBDEBET' => number_format($subDebet,2)];
|
|
$hasil[$noAkhir] += ['SUBKREDIT' => number_format($subKredit,2)];
|
|
$hasil[$noAkhir] += ['SUBTOTALALL' => number_format($subTotal,2)];
|
|
$hasil[$noAkhir] += ['ISI' => $data];
|
|
} else {
|
|
$salKas = explode(",", $id_kas);
|
|
foreach ($salKas as $key) {
|
|
if ($versi==1) {
|
|
$no = 0;
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byPERKIRAAN_byKAS_byPERIODE_forSearch(1, $key, $awal, $akhir);
|
|
foreach ($datDak as $dat) {
|
|
$subDebet = $subDebet+$dat['DEBET_DAK'];
|
|
$subKredit = $subKredit+$dat['KREDIT_DAK'];
|
|
$subTotal = $subTotal+$dat['DEBET_DAK']-$dat['KREDIT_DAK'];
|
|
|
|
$datDak[$no] += ['DEBET' => number_format($dat['DEBET_DAK'], 2)];
|
|
$datDak[$no] += ['KREDIT' => number_format($dat['KREDIT_DAK'], 2)];
|
|
$datDak[$no++] += ['SUBTOTAL' => number_format($subTotal, 2)];
|
|
}
|
|
foreach ($datDak as $det) {
|
|
$data[$noData++] = $det;
|
|
}
|
|
} else if ($versi==2) {
|
|
$no = 0;
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byKAS_byPERIODE_forSaldoKas($key, $awal, $akhir);
|
|
foreach ($datDak as $dat) {
|
|
if ($dat['AS_KAS']==NULL AND $dat['AS_BANK']==NULL) {
|
|
$subDebet = $subDebet+$dat['KREDIT_DAK'];
|
|
$subKredit = $subKredit+$dat['DEBET_DAK'];
|
|
$subTotal = $subTotal+$dat['KREDIT_DAK']-$dat['DEBET_DAK'];
|
|
|
|
$datDak[$no] += ['DEBET' => number_format($dat['KREDIT_DAK'], 2)];
|
|
$datDak[$no] += ['KREDIT' => number_format($dat['DEBET_DAK'], 2)];
|
|
} else if ($dat['AS_KAS']!=NULL AND $dat['KAS_ID']==$key) {
|
|
$subDebet = $subDebet+$dat['KREDIT_DAK'];
|
|
$subKredit = $subKredit+$dat['DEBET_DAK'];
|
|
$subTotal = $subTotal+$dat['KREDIT_DAK']-$dat['DEBET_DAK'];
|
|
|
|
$datDak[$no] += ['DEBET' => number_format($dat['KREDIT_DAK'], 2)];
|
|
$datDak[$no] += ['KREDIT' => number_format($dat['DEBET_DAK'], 2)];
|
|
} else if ($dat['AS_BANK']!=NULL AND $dat['KAS_ID']==$key) {
|
|
$subDebet = $subDebet+$dat['KREDIT_DAK'];
|
|
$subKredit = $subKredit+$dat['DEBET_DAK'];
|
|
$subTotal = $subTotal+$dat['KREDIT_DAK']-$dat['DEBET_DAK'];
|
|
|
|
$datDak[$no] += ['DEBET' => number_format($dat['KREDIT_DAK'], 2)];
|
|
$datDak[$no] += ['KREDIT' => number_format($dat['DEBET_DAK'], 2)];
|
|
} else {
|
|
$subDebet = $subDebet+$dat['DEBET_DAK'];
|
|
$subKredit = $subKredit+$dat['KREDIT_DAK'];
|
|
$subTotal = $subTotal+$dat['DEBET_DAK']-$dat['KREDIT_DAK'];
|
|
|
|
$datDak[$no] += ['DEBET' => number_format($dat['DEBET_DAK'], 2)];
|
|
$datDak[$no] += ['KREDIT' => number_format($dat['KREDIT_DAK'], 2)];
|
|
}
|
|
$datDak[$no++] += ['SUBTOTAL' => number_format($subTotal, 2)];
|
|
}
|
|
foreach ($datDak as $det) {
|
|
$data[$noData++] = $det;
|
|
}
|
|
}
|
|
}
|
|
|
|
$hasil[$noAkhir] += ['SUBDEBET' => number_format($subDebet,2)];
|
|
$hasil[$noAkhir] += ['SUBKREDIT' => number_format($subKredit,2)];
|
|
$hasil[$noAkhir] += ['SUBTOTALALL' => number_format($subTotal,2)];
|
|
$hasil[$noAkhir] += ['ISI' => $data];
|
|
}
|
|
} else if ($jenis==2) { // Dipisah Kas
|
|
$salKas = explode(",", $id_kas);
|
|
foreach ($salKas as $key) {
|
|
$datKas = $this->Amod->getData_Kas_byID($key);
|
|
$kode_kas = $datKas[0]['KODE_KAS'];
|
|
$nama_kas = $datKas[0]['NAMA_KAS'];
|
|
$kona_kas = "$kode_kas | $nama_kas";
|
|
if (strlen($kona_kas)>20) {
|
|
$namaKas = substr($kona_kas, 0, 20);
|
|
$namaKas = "$namaKas..";
|
|
} else {
|
|
$namaKas = $kona_kas;
|
|
}
|
|
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byKAS_beforeTGL(1, $key, $limit);
|
|
if ($sumDak==FALSE OR $sumDak[0]['DEBET']==NULL OR $sumDak[0]['KREDIT']==NULL) {
|
|
$subDebet = 0;
|
|
$subKredit = 0;
|
|
$subTotal = 0;
|
|
} else {
|
|
$subDebet = 0;
|
|
$subKredit = 0;
|
|
$subTotal = $sumDak[0]['DEBET']-$sumDak[0]['KREDIT'];
|
|
}
|
|
|
|
$data = [];
|
|
$noData = 0;
|
|
|
|
$data[$noData++] = [
|
|
'KODE_AKUNTANSI' => "Saldo Awal",
|
|
'TANGGAL' => date_format(date_create($limit), "d/m/Y"),
|
|
'JENIS_DAK' => 0,
|
|
'DKOKAS' => "",
|
|
'DNAKAS' => "",
|
|
'EKOKAS' => "",
|
|
'ENAKAS' => "",
|
|
'KODE_PERKIRAAN' => "",
|
|
'NAMA_PERKIRAAN' => "",
|
|
'CIPTA_DAK' => "",
|
|
'KET_DAK' => "~",
|
|
'DEBET' => "",
|
|
'KREDIT' => "",
|
|
'SUBTOTAL' => number_format($subTotal,2),
|
|
];
|
|
|
|
if ($versi==1) {
|
|
$no = 0;
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byPERKIRAAN_byKAS_byPERIODE_forSearch(1, $key, $awal, $akhir);
|
|
foreach ($datDak as $dat) {
|
|
$subDebet = $subDebet+$dat['DEBET_DAK'];
|
|
$subKredit = $subKredit+$dat['KREDIT_DAK'];
|
|
$subTotal = $subTotal+$dat['DEBET_DAK']-$dat['KREDIT_DAK'];
|
|
|
|
$datDak[$no] += ['DEBET' => number_format($dat['DEBET_DAK'], 2)];
|
|
$datDak[$no] += ['KREDIT' => number_format($dat['KREDIT_DAK'], 2)];
|
|
$datDak[$no++] += ['SUBTOTAL' => number_format($subTotal, 2)];
|
|
}
|
|
|
|
foreach ($datDak as $det) {
|
|
$data[$noData++] = $det;
|
|
}
|
|
} else if ($versi==2) {
|
|
$no = 0;
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byKAS_byPERIODE_forSaldoKas($key, $awal, $akhir);
|
|
foreach ($datDak as $dat) {
|
|
if ($dat['AS_KAS']==NULL AND $dat['AS_BANK']==NULL) {
|
|
$subDebet = $subDebet+$dat['KREDIT_DAK'];
|
|
$subKredit = $subKredit+$dat['DEBET_DAK'];
|
|
$subTotal = $subTotal+$dat['KREDIT_DAK']-$dat['DEBET_DAK'];
|
|
|
|
$datDak[$no] += ['DEBET' => number_format($dat['KREDIT_DAK'], 2)];
|
|
$datDak[$no] += ['KREDIT' => number_format($dat['DEBET_DAK'], 2)];
|
|
} else if ($dat['AS_KAS']!=NULL AND $dat['KAS_ID']==$key) {
|
|
$subDebet = $subDebet+$dat['KREDIT_DAK'];
|
|
$subKredit = $subKredit+$dat['DEBET_DAK'];
|
|
$subTotal = $subTotal+$dat['KREDIT_DAK']-$dat['DEBET_DAK'];
|
|
|
|
$datDak[$no] += ['DEBET' => number_format($dat['KREDIT_DAK'], 2)];
|
|
$datDak[$no] += ['KREDIT' => number_format($dat['DEBET_DAK'], 2)];
|
|
} else if ($dat['AS_BANK']!=NULL AND $dat['KAS_ID']==$key) {
|
|
$subDebet = $subDebet+$dat['KREDIT_DAK'];
|
|
$subKredit = $subKredit+$dat['DEBET_DAK'];
|
|
$subTotal = $subTotal+$dat['KREDIT_DAK']-$dat['DEBET_DAK'];
|
|
|
|
$datDak[$no] += ['DEBET' => number_format($dat['KREDIT_DAK'], 2)];
|
|
$datDak[$no] += ['KREDIT' => number_format($dat['DEBET_DAK'], 2)];
|
|
} else {
|
|
$subDebet = $subDebet+$dat['DEBET_DAK'];
|
|
$subKredit = $subKredit+$dat['KREDIT_DAK'];
|
|
$subTotal = $subTotal+$dat['DEBET_DAK']-$dat['KREDIT_DAK'];
|
|
|
|
$datDak[$no] += ['DEBET' => number_format($dat['DEBET_DAK'], 2)];
|
|
$datDak[$no] += ['KREDIT' => number_format($dat['KREDIT_DAK'], 2)];
|
|
}
|
|
$datDak[$no++] += ['SUBTOTAL' => number_format($subTotal, 2)];
|
|
}
|
|
foreach ($datDak as $det) {
|
|
$data[$noData++] = $det;
|
|
}
|
|
}
|
|
|
|
$hasil[$noAwal++] = [
|
|
'IDSHEET' => $key,
|
|
'VESHEET' => $versi,
|
|
'FASHEET' => $kona_kas,
|
|
'NASHEET' => $namaKas,
|
|
'SUBDEBET' => number_format($subDebet,2),
|
|
'SUBKREDIT' => number_format($subKredit,2),
|
|
'SUBTOTALALL' => number_format($subTotal,2),
|
|
'ISI' => $data
|
|
];
|
|
}
|
|
}
|
|
|
|
$pilih_tabel = array('No', 'Kode', 'Tanggal', 'Timestamp', 'Kas', 'Akun', 'Nilai DEBET', 'Nilai KREDIT', 'Nilai SUBTOTAL', 'Keterangan');
|
|
|
|
$data = [
|
|
'awal_nota' => date_format(date_create($awal), "d/m/Y"),
|
|
'akhir_nota' => date_format(date_create($akhir), "d/m/Y"),
|
|
'jumlah_kolom' => count($pilih_tabel),
|
|
'nama_tabel' => $pilih_tabel,
|
|
'jenis' => $jenis,
|
|
'hasil' => $hasil,
|
|
'ts' => $timestamp,
|
|
];
|
|
$this->load->view('cetak/KU_Excel_Sub4_DataPembukuanSaldoKas', $data);
|
|
}
|
|
|
|
public function KU_Excel_Sub4_DataAnalisaNeraca() {
|
|
$id_pak = $this->input->post('id_pakfill');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$datPak = $this->Amod->getData_PeriodeAkuntansi_byID($id_pak);
|
|
$start = $datPak[0]['AWAL_PAK'];
|
|
$end = $datPak[0]['AKHIR_PAK'];
|
|
$nama_pak = $datPak[0]['NAMA_PAK'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 1);
|
|
$al01 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 2);
|
|
$al02 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 3);
|
|
$al03 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 4);
|
|
$al04 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 5);
|
|
$al05 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 6);
|
|
$al06 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 7);
|
|
$al07 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 8);
|
|
$al08 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 82);
|
|
$al09 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 9);
|
|
$inventaris1 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 10);
|
|
$inventaris2 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 11);
|
|
$gedung1 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 12);
|
|
$gedung2 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 13);
|
|
$kendaraan1 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 14);
|
|
$kendaraan2 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$at01 = $inventaris1-$inventaris2;
|
|
$at02 = $gedung1-$gedung2;
|
|
$at03 = $kendaraan1-$kendaraan2;
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 15);
|
|
$kl01 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 16);
|
|
$kl02 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 17);
|
|
$kl03 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 18);
|
|
$kl04 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 19);
|
|
$kl05 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 83);
|
|
$kl06 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 20);
|
|
$mo01 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 21);
|
|
$mo02 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 22);
|
|
$mo03 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 23);
|
|
$tp01 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 24);
|
|
$tp02 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 25);
|
|
$tp03 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 26);
|
|
$hpp01 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 27);
|
|
$hpp02 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 28);
|
|
$hpp03 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 29);
|
|
$hpp04 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 30);
|
|
$hpp05 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 31);
|
|
$bp01 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 32);
|
|
$bp02 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 33);
|
|
$bp03 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 34);
|
|
$bp04 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 35);
|
|
$bp05 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 36);
|
|
$bp06 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 37);
|
|
$bp07 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 38);
|
|
$bua01 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 39);
|
|
$bua02 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 40);
|
|
$bua03 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 41);
|
|
$bua04 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 42);
|
|
$bua05 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 43);
|
|
$bua06 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 44);
|
|
$bua07 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 45);
|
|
$bua08 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 46);
|
|
$bua09 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 80);
|
|
$bua10 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 47);
|
|
$bua11 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 48);
|
|
$bua12 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 49);
|
|
$bua13 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 50);
|
|
$bua14 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 51);
|
|
$bua15 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 52);
|
|
$bua16 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 53);
|
|
$bua17 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 54);
|
|
$bua18 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 55);
|
|
$bua19 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 56);
|
|
$bua20 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 57);
|
|
$bua21 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 58);
|
|
$bua22 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 59);
|
|
$bua23 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 60);
|
|
$bua24 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 61);
|
|
$bua25 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 62);
|
|
$bua26 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 63);
|
|
$bua27 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 64);
|
|
$bua28 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 65);
|
|
$bua29 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 66);
|
|
$bua30 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 67);
|
|
$bua31 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 68);
|
|
$bua32 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 69);
|
|
$bua33 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 70);
|
|
$bua34 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 71);
|
|
$bua35 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 72);
|
|
$bua36 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 73);
|
|
$bua37 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 86);
|
|
$bua38 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 74);
|
|
$bua39 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 75);
|
|
$plu01 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 76);
|
|
$plu02 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 77);
|
|
$plu03 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 78);
|
|
$plu04 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 87);
|
|
$plu05 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$datHne = $this->Amod->getData_HasilHitungNeraca_byPAK_byPERKIRAAN($id_pak, 79);
|
|
$pph01 = $datHne[0]['NILAI_HNE'];
|
|
|
|
$aktivaLancar = $al01+$al02+$al03+$al04+$al05+$al06+$al07+$al08+$al09;
|
|
$kewajibanLancar = $kl01+$kl02+$kl03+$kl04+$kl05+$kl06;
|
|
$aktivaTetap = $at01+$at02+$at03;
|
|
$modalNeraca = $mo01+$mo02+$mo03;
|
|
$totalAktiva = $aktivaLancar+$aktivaTetap;
|
|
$totalPasiva = $kewajibanLancar+$modalNeraca;
|
|
|
|
$totalPenjualan = $tp01-$tp02-$tp03;
|
|
$hargaPokokPenjualan1 = $hpp01+$hpp02-$hpp03-$hpp04;
|
|
$hargaPokokPenjualan2 = $hargaPokokPenjualan1-$hpp05;
|
|
$labaKotor = $totalPenjualan-$hargaPokokPenjualan2;
|
|
$biayaPenjualan = $bp01+$bp02+$bp03+$bp04+$bp05+$bp06+$bp07;
|
|
$biayaUmumAdministrasi = $bua01+$bua02+$bua03+$bua04+$bua05+$bua06+$bua07+$bua08+$bua09+$bua10+$bua11+$bua12+$bua13+$bua14+$bua15+$bua16
|
|
+$bua17+$bua18+$bua19+$bua20+$bua21+$bua22+$bua23+$bua24+$bua25+$bua26+$bua27+$bua28+$bua29+$bua30+$bua31+$bua32
|
|
+$bua33+$bua34+$bua35+$bua36+$bua37+$bua38+$bua39;
|
|
$totalBiaya = $biayaPenjualan+$biayaUmumAdministrasi;
|
|
$labaUsaha = $labaKotor-$totalBiaya;
|
|
$pendapatanLuarUsaha1 = $plu01+$plu02;
|
|
$pendapatanLuarUsaha2 = $plu03+$plu04+$plu05;
|
|
$pajakPenghasilan = $pph01;
|
|
$totalPendapatanLuarUsaha = $pendapatanLuarUsaha1-$pendapatanLuarUsaha2;
|
|
$labaBersihSebelumPajak = $labaUsaha+$totalPendapatanLuarUsaha;
|
|
$labaBersihSetelahPajak = $labaBersihSebelumPajak-$pajakPenghasilan;
|
|
|
|
$datHqPersediaan = $this->Amod->getSum_HistoriKuantiti_groupBARANG_beforeTGL_morethan0($end);
|
|
$no = 0;
|
|
foreach ($datHqPersediaan as $key) {
|
|
$cekHq = $this->Amod->getData_HistoriKuantiti_byBARANG_beforeTGL_orderDESC_limit1($key['BARANG_ID'], $end);
|
|
$datHqPersediaan[$no] += ['KODE_BARANG' => $cekHq[0]['KODE_BARANG']];
|
|
$datHqPersediaan[$no] += ['NAMA_BARANG' => $cekHq[0]['NAMA_BARANG']];
|
|
$datHqPersediaan[$no] += ['AVG' => number_format($cekHq[0]['AVG_HQ'],2)];
|
|
$datHqPersediaan[$no++] += ['PERSEDIAAN' => number_format($cekHq[0]['PERSEDIAAN_HQ'],2)];
|
|
}
|
|
|
|
$data = [
|
|
'al01' => number_format($al01,2),
|
|
'al02' => number_format($al02,2),
|
|
'al03' => number_format($al03,2),
|
|
'al04' => number_format($al04,2),
|
|
'al05' => number_format($al05,2),
|
|
'al06' => number_format($al06,2),
|
|
'al07' => number_format($al07,2),
|
|
'al08' => number_format($al08,2),
|
|
'al09' => number_format($al09,2),
|
|
'kl01' => number_format($kl01,2),
|
|
'kl02' => number_format($kl02,2),
|
|
'kl03' => number_format($kl03,2),
|
|
'kl04' => number_format($kl04,2),
|
|
'kl05' => number_format($kl05,2),
|
|
'kl06' => number_format($kl06,2),
|
|
'at01' => number_format($at01,2),
|
|
'at02' => number_format($at02,2),
|
|
'at03' => number_format($at03,2),
|
|
'mo01' => number_format($mo01,2),
|
|
'mo02' => number_format($mo02,2),
|
|
'mo03' => number_format($mo03,2),
|
|
'tp01' => number_format($tp01,2),
|
|
'tp02' => number_format($tp02,2),
|
|
'tp03' => number_format($tp03,2),
|
|
'hpp01' => number_format($hpp01,2),
|
|
'hpp02' => number_format($hpp02,2),
|
|
'hpp03' => number_format($hpp03,2),
|
|
'hpp04' => number_format($hpp04,2),
|
|
'hpp05' => number_format($hpp05,2),
|
|
'bp01' => number_format($bp01,2),
|
|
'bp02' => number_format($bp02,2),
|
|
'bp03' => number_format($bp03,2),
|
|
'bp04' => number_format($bp04,2),
|
|
'bp05' => number_format($bp05,2),
|
|
'bp06' => number_format($bp06,2),
|
|
'bp07' => number_format($bp07,2),
|
|
'bua01' => number_format($bua01,2),
|
|
'bua02' => number_format($bua02,2),
|
|
'bua03' => number_format($bua03,2),
|
|
'bua04' => number_format($bua04,2),
|
|
'bua05' => number_format($bua05,2),
|
|
'bua06' => number_format($bua06,2),
|
|
'bua07' => number_format($bua07,2),
|
|
'bua08' => number_format($bua08,2),
|
|
'bua09' => number_format($bua09,2),
|
|
'bua10' => number_format($bua10,2),
|
|
'bua11' => number_format($bua11,2),
|
|
'bua12' => number_format($bua12,2),
|
|
'bua13' => number_format($bua13,2),
|
|
'bua14' => number_format($bua14,2),
|
|
'bua15' => number_format($bua15,2),
|
|
'bua16' => number_format($bua16,2),
|
|
'bua17' => number_format($bua17,2),
|
|
'bua18' => number_format($bua18,2),
|
|
'bua19' => number_format($bua19,2),
|
|
'bua20' => number_format($bua20,2),
|
|
'bua21' => number_format($bua21,2),
|
|
'bua22' => number_format($bua22,2),
|
|
'bua23' => number_format($bua23,2),
|
|
'bua24' => number_format($bua24,2),
|
|
'bua25' => number_format($bua25,2),
|
|
'bua26' => number_format($bua26,2),
|
|
'bua27' => number_format($bua27,2),
|
|
'bua28' => number_format($bua28,2),
|
|
'bua29' => number_format($bua29,2),
|
|
'bua30' => number_format($bua30,2),
|
|
'bua31' => number_format($bua31,2),
|
|
'bua32' => number_format($bua32,2),
|
|
'bua33' => number_format($bua33,2),
|
|
'bua34' => number_format($bua34,2),
|
|
'bua35' => number_format($bua35,2),
|
|
'bua36' => number_format($bua36,2),
|
|
'bua37' => number_format($bua37,2),
|
|
'bua38' => number_format($bua38,2),
|
|
'bua39' => number_format($bua39,2),
|
|
'plu01' => number_format($plu01,2),
|
|
'plu02' => number_format($plu02,2),
|
|
'plu03' => number_format($plu03,2),
|
|
'plu04' => number_format($plu04,2),
|
|
'plu05' => number_format($plu05,2),
|
|
'pph01' => number_format($pph01,2),
|
|
'aktivaLancar' => number_format($aktivaLancar,2),
|
|
'kewajibanLancar' => number_format($kewajibanLancar,2),
|
|
'aktivaTetap' => number_format($aktivaTetap,2),
|
|
'modalNeraca' => number_format($modalNeraca,2),
|
|
'totalAktiva' => number_format($totalAktiva,2),
|
|
'totalPasiva' => number_format($totalPasiva,2),
|
|
'totalPenjualan' => number_format($totalPenjualan,2),
|
|
'hargaPokokPenjualan1' => number_format($hargaPokokPenjualan1,2),
|
|
'hargaPokokPenjualan2' => number_format($hargaPokokPenjualan2,2),
|
|
'labaKotor' => number_format($labaKotor,2),
|
|
'biayaPenjualan' => number_format($biayaPenjualan,2),
|
|
'biayaUmumAdministrasi' => number_format($biayaUmumAdministrasi,2),
|
|
'totalBiaya' => number_format($totalBiaya,2),
|
|
'labaUsaha' => number_format($labaUsaha,2),
|
|
'pendapatanLuarUsaha1' => number_format($pendapatanLuarUsaha1,2),
|
|
'pendapatanLuarUsaha2' => number_format($pendapatanLuarUsaha2,2),
|
|
'pajakPenghasilan' => number_format($pajakPenghasilan,2),
|
|
'totalPendapatanLuarUsaha' => number_format($totalPendapatanLuarUsaha,2),
|
|
'labaBersihSebelumPajak' => number_format($labaBersihSebelumPajak,2),
|
|
'labaBersihSetelahPajak' => number_format($labaBersihSetelahPajak,2),
|
|
'persediaanDetail' => $datHqPersediaan,
|
|
'awal' => date_format(date_create($start),"d/m/Y"),
|
|
'akhir' => date_format(date_create($end),"d/m/Y"),
|
|
'nama_pak' => $nama_pak,
|
|
'ts' => $timestamp,
|
|
];
|
|
$this->load->view('cetak/KU_Excel_Sub4_DataAnalisaNeraca', $data);
|
|
|
|
}
|
|
|
|
public function KU_Excel_Sub4_DataAnalisaPerkiraan() {
|
|
$awal = $this->input->post('tgl_awalfill');
|
|
$akhir = $this->input->post('tgl_akhirfill');
|
|
$jenis = $this->input->post('jenis_fill');
|
|
$id_perkiraan = $this->input->post('id_perkiraanfill');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$hasil = [];
|
|
$noAwal = 0;
|
|
$noAkhir = 0;
|
|
|
|
if ($jenis==1) { // Campur jadi satu Laporan
|
|
$hasil[$noAwal] = [
|
|
'IDSHEET' => '0',
|
|
'FASHEET' => "CAMPUR",
|
|
'NASHEET' => "Sesuai Filter"
|
|
];
|
|
if ($id_perkiraan=="") {
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byPERKIRAAN_byPERIODE_forSearchPerkiraan(NULL, $awal, $akhir);
|
|
$no = 0;
|
|
$subDebet = 0;
|
|
$subKredit = 0;
|
|
$subTotal = 0;
|
|
foreach ($datDak as $dat) {
|
|
$subDebet = $subDebet+$dat['DEBET_DAK'];
|
|
$subKredit = $subKredit+$dat['KREDIT_DAK'];
|
|
$subTotal = $subTotal+$dat['DEBET_DAK']-$dat['KREDIT_DAK'];
|
|
|
|
$datDak[$no] += ['DEBET' => number_format($dat['DEBET_DAK'], 2)];
|
|
$datDak[$no] += ['KREDIT' => number_format($dat['KREDIT_DAK'], 2)];
|
|
$datDak[$no++] += ['SUBTOTAL' => number_format($subTotal, 2)];
|
|
}
|
|
$hasil[$noAkhir] += ['SUBDEBET' => number_format($subDebet,2)];
|
|
$hasil[$noAkhir] += ['SUBKREDIT' => number_format($subKredit,2)];
|
|
$hasil[$noAkhir] += ['SUBTOTALALL' => number_format($subTotal,2)];
|
|
$hasil[$noAkhir] += ['ISI' => $datDak];
|
|
} else {
|
|
$subDebet = 0;
|
|
$subKredit = 0;
|
|
$subTotal = 0;
|
|
$noPer = 0;
|
|
$isiPer = [];
|
|
$salPer = explode(",", $id_perkiraan);
|
|
foreach ($salPer as $key) {
|
|
$no = 0;
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byPERKIRAAN_byPERIODE_forSearchPerkiraan($key, $awal, $akhir);
|
|
foreach ($datDak as $dat) {
|
|
$subDebet = $subDebet+$dat['DEBET_DAK'];
|
|
$subKredit = $subKredit+$dat['KREDIT_DAK'];
|
|
$subTotal = $subTotal+$dat['DEBET_DAK']-$dat['KREDIT_DAK'];
|
|
|
|
$datDak[$no] += ['DEBET' => number_format($dat['DEBET_DAK'], 2)];
|
|
$datDak[$no] += ['KREDIT' => number_format($dat['KREDIT_DAK'], 2)];
|
|
$datDak[$no++] += ['SUBTOTAL' => number_format($subTotal, 2)];
|
|
}
|
|
foreach ($datDak as $det) {
|
|
$isiPer[$noPer++] = $det;
|
|
}
|
|
}
|
|
$hasil[$noAkhir] += ['SUBDEBET' => number_format($subDebet,2)];
|
|
$hasil[$noAkhir] += ['SUBKREDIT' => number_format($subKredit,2)];
|
|
$hasil[$noAkhir] += ['SUBTOTALALL' => number_format($subTotal,2)];
|
|
$hasil[$noAkhir] += ['ISI' => $isiPer];
|
|
}
|
|
} else if ($jenis==2) { // Dipisah Perkiraan
|
|
$salPer = explode(",", $id_perkiraan);
|
|
foreach ($salPer as $key) {
|
|
$subDebet = 0;
|
|
$subKredit = 0;
|
|
$subTotal = 0;
|
|
|
|
$no = 0;
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byPERKIRAAN_byPERIODE_forSearchPerkiraan($key, $awal, $akhir);
|
|
foreach ($datDak as $dat) {
|
|
$subDebet = $subDebet+$dat['DEBET_DAK'];
|
|
$subKredit = $subKredit+$dat['KREDIT_DAK'];
|
|
$subTotal = $subTotal+$dat['DEBET_DAK']-$dat['KREDIT_DAK'];
|
|
|
|
$datDak[$no] += ['DEBET' => number_format($dat['DEBET_DAK'], 2)];
|
|
$datDak[$no] += ['KREDIT' => number_format($dat['KREDIT_DAK'], 2)];
|
|
$datDak[$no++] += ['SUBTOTAL' => number_format($subTotal, 2)];
|
|
}
|
|
|
|
$datPerkiraan = $this->Amod->getData_Perkiraan_byID($key);
|
|
$kode_perkiraan = $datPerkiraan[0]['KODE_PERKIRAAN'];
|
|
$nama_perkiraan = $datPerkiraan[0]['NAMA_PERKIRAAN'];
|
|
$konaPerkiraan = "$kode_perkiraan | $nama_perkiraan";
|
|
if (strlen($konaPerkiraan)>20) {
|
|
$namaPer = substr($konaPerkiraan, 0, 20);
|
|
$namaPer = "$namaPer..";
|
|
} else {
|
|
$namaPer = $konaPerkiraan;
|
|
}
|
|
$hasil[$noAwal++] = [
|
|
'IDSHEET' => $key,
|
|
'FASHEET' => $konaPerkiraan,
|
|
'NASHEET' => $namaPer,
|
|
'SUBDEBET' => number_format($subDebet,2),
|
|
'SUBKREDIT' => number_format($subKredit,2),
|
|
'SUBTOTALALL' => number_format($subTotal,2),
|
|
'ISI' => $datDak
|
|
];
|
|
}
|
|
}
|
|
|
|
$pilih_tabel = array('No', 'Kode', 'Tanggal', 'Timestamp', 'Perkiraan', 'Nilai DEBET', 'Nilai KREDIT', 'Nilai SUBTOTAL', 'Keterangan');
|
|
|
|
$data = [
|
|
'awal_nota' => date_format(date_create($awal), "d/m/Y"),
|
|
'akhir_nota' => date_format(date_create($akhir), "d/m/Y"),
|
|
'jumlah_kolom' => count($pilih_tabel),
|
|
'nama_tabel' => $pilih_tabel,
|
|
'jenis' => $jenis,
|
|
'hasil' => $hasil,
|
|
'ts' => $timestamp,
|
|
];
|
|
$this->load->view('cetak/KU_Excel_Sub4_DataAnalisaPerkiraan', $data);
|
|
}
|
|
|
|
public function KU_Excel_Sub4_DataAnalisaRekapPajak() {
|
|
$awal = $this->input->post('tgl_awalfill');
|
|
$akhir = $this->input->post('tgl_akhirfill');
|
|
$jenis = $this->input->post('jenis_fill');
|
|
$transaksi = $this->input->post('transaksi_fill');
|
|
$id_corp = $this->input->post('id_corpfill');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
if ($jenis==0) {
|
|
$subtitle = "Tidak Terbayar";
|
|
} else if ($jenis==1) {
|
|
$subtitle = "Terbayar";
|
|
} else if ($jenis==9) {
|
|
$subtitle = "Semua Status";
|
|
}
|
|
|
|
$hasil = [];
|
|
$noData = 0;
|
|
if ($transaksi=="") {
|
|
if ($id_corp=="") {
|
|
$title = "PPH Ps22 - PT TMP";
|
|
$datDrpj = $this->Amod->getData_DaftarRekapPajak_byCORP_jenis1(1, $awal, $akhir, $jenis);
|
|
|
|
$hasil[$noData++] = [
|
|
'JENIS' => '1',
|
|
'TITLE' => $title,
|
|
'DRPJ' => $datDrpj,
|
|
];
|
|
|
|
$title = "PPH Ps22 - PT DMT";
|
|
$datDrpj = $this->Amod->getData_DaftarRekapPajak_byCORP_jenis1(2, $awal, $akhir, $jenis);
|
|
|
|
$hasil[$noData++] = [
|
|
'JENIS' => '1',
|
|
'TITLE' => $title,
|
|
'DRPJ' => $datDrpj,
|
|
];
|
|
|
|
$title = "PPH Ps22 - CV SFTR";
|
|
$datDrpj = $this->Amod->getData_DaftarRekapPajak_byCORP_jenis1(4, $awal, $akhir, $jenis);
|
|
|
|
$hasil[$noData++] = [
|
|
'JENIS' => '1',
|
|
'TITLE' => $title,
|
|
'DRPJ' => $datDrpj,
|
|
];
|
|
|
|
$title = "PPH Ps23 - PT TMP";
|
|
$datDrpj = $this->Amod->getData_DaftarRekapPajak_byCORP_jenis2(1, $awal, $akhir, $jenis);
|
|
|
|
$hasil[$noData++] = [
|
|
'JENIS' => '2',
|
|
'TITLE' => $title,
|
|
'DRPJ' => $datDrpj,
|
|
];
|
|
|
|
$title = "PPH Ps23 - PT DMT";
|
|
$datDrpj = $this->Amod->getData_DaftarRekapPajak_byCORP_jenis2(2, $awal, $akhir, $jenis);
|
|
|
|
$hasil[$noData++] = [
|
|
'JENIS' => '2',
|
|
'TITLE' => $title,
|
|
'DRPJ' => $datDrpj,
|
|
];
|
|
|
|
$title = "PPH Ps23 - CV SFTR";
|
|
$datDrpj = $this->Amod->getData_DaftarRekapPajak_byCORP_jenis2(4, $awal, $akhir, $jenis);
|
|
|
|
$hasil[$noData++] = [
|
|
'JENIS' => '2',
|
|
'TITLE' => $title,
|
|
'DRPJ' => $datDrpj,
|
|
];
|
|
|
|
$title = "PPN - PT TMP";
|
|
$datDrpj = $this->Amod->getData_DaftarRekapPajak_byCORP_jenis3(1, $awal, $akhir, $jenis);
|
|
|
|
$hasil[$noData++] = [
|
|
'JENIS' => '3',
|
|
'TITLE' => $title,
|
|
'DRPJ' => $datDrpj,
|
|
];
|
|
|
|
$title = "PPN - PT DMT";
|
|
$datDrpj = $this->Amod->getData_DaftarRekapPajak_byCORP_jenis3(2, $awal, $akhir, $jenis);
|
|
|
|
$hasil[$noData++] = [
|
|
'JENIS' => '3',
|
|
'TITLE' => $title,
|
|
'DRPJ' => $datDrpj,
|
|
];
|
|
|
|
$title = "PPN - CV SFTR";
|
|
$datDrpj = $this->Amod->getData_DaftarRekapPajak_byCORP_jenis3(4, $awal, $akhir, $jenis);
|
|
|
|
$hasil[$noData++] = [
|
|
'JENIS' => '3',
|
|
'TITLE' => $title,
|
|
'DRPJ' => $datDrpj,
|
|
];
|
|
} else {
|
|
if ($id_corp==1) { $corp = "PT TMP"; } else if ($id_corp==2) { $corp = "PT DMT"; } else if ($id_corp==4) { $corp = "CV SFTR"; }
|
|
$title = "PPH Ps22 - $corp";
|
|
$datDrpj = $this->Amod->getData_DaftarRekapPajak_byCORP_jenis1($id_corp, $awal, $akhir, $jenis);
|
|
|
|
$hasil[$noData++] = [
|
|
'JENIS' => '1',
|
|
'TITLE' => $title,
|
|
'DRPJ' => $datDrpj,
|
|
];
|
|
|
|
$title = "PPH Ps23 - $corp";
|
|
$datDrpj = $this->Amod->getData_DaftarRekapPajak_byCORP_jenis2($id_corp, $awal, $akhir, $jenis);
|
|
|
|
$hasil[$noData++] = [
|
|
'JENIS' => '2',
|
|
'TITLE' => $title,
|
|
'DRPJ' => $datDrpj,
|
|
];
|
|
|
|
$title = "PPN - $corp";
|
|
$datDrpj = $this->Amod->getData_DaftarRekapPajak_byCORP_jenis3($id_corp, $awal, $akhir, $jenis);
|
|
|
|
$hasil[$noData++] = [
|
|
'JENIS' => '3',
|
|
'TITLE' => $title,
|
|
'DRPJ' => $datDrpj,
|
|
];
|
|
}
|
|
} else if ($transaksi==1) {
|
|
if ($id_corp=="") {
|
|
$title = "PPH Ps22 - PT TMP";
|
|
$datDrpj = $this->Amod->getData_DaftarRekapPajak_byCORP_jenis1(1, $awal, $akhir, $jenis);
|
|
|
|
$hasil[$noData++] = [
|
|
'JENIS' => $transaksi,
|
|
'TITLE' => $title,
|
|
'DRPJ' => $datDrpj,
|
|
];
|
|
|
|
$title = "PPH Ps22 - PT DMT";
|
|
$datDrpj = $this->Amod->getData_DaftarRekapPajak_byCORP_jenis1(2, $awal, $akhir, $jenis);
|
|
|
|
$hasil[$noData++] = [
|
|
'JENIS' => $transaksi,
|
|
'TITLE' => $title,
|
|
'DRPJ' => $datDrpj,
|
|
];
|
|
|
|
$title = "PPH Ps22 - CV SFTR";
|
|
$datDrpj = $this->Amod->getData_DaftarRekapPajak_byCORP_jenis1(4, $awal, $akhir, $jenis);
|
|
|
|
$hasil[$noData++] = [
|
|
'JENIS' => $transaksi,
|
|
'TITLE' => $title,
|
|
'DRPJ' => $datDrpj,
|
|
];
|
|
} else {
|
|
if ($id_corp==1) { $corp = "PT TMP"; } else if ($id_corp==2) { $corp = "PT DMT"; } else if ($id_corp==4) { $corp = "CV SFTR"; }
|
|
$title = "PPH Ps22 - $corp";
|
|
$datDrpj = $this->Amod->getData_DaftarRekapPajak_byCORP_jenis1($id_corp, $awal, $akhir, $jenis);
|
|
|
|
$hasil[$noData] = [
|
|
'JENIS' => $transaksi,
|
|
'TITLE' => $title,
|
|
'DRPJ' => $datDrpj,
|
|
];
|
|
}
|
|
} else if ($transaksi==2) {
|
|
if ($id_corp=="") {
|
|
$title = "PPH Ps23 - PT TMP";
|
|
$datDrpj = $this->Amod->getData_DaftarRekapPajak_byCORP_jenis2(1, $awal, $akhir, $jenis);
|
|
|
|
$hasil[$noData++] = [
|
|
'JENIS' => $transaksi,
|
|
'TITLE' => $title,
|
|
'DRPJ' => $datDrpj,
|
|
];
|
|
|
|
$title = "PPH Ps23 - PT DMT";
|
|
$datDrpj = $this->Amod->getData_DaftarRekapPajak_byCORP_jenis2(2, $awal, $akhir, $jenis);
|
|
|
|
$hasil[$noData++] = [
|
|
'JENIS' => $transaksi,
|
|
'TITLE' => $title,
|
|
'DRPJ' => $datDrpj,
|
|
];
|
|
|
|
$title = "PPH Ps23 - CV SFTR";
|
|
$datDrpj = $this->Amod->getData_DaftarRekapPajak_byCORP_jenis2(4, $awal, $akhir, $jenis);
|
|
|
|
$hasil[$noData++] = [
|
|
'JENIS' => $transaksi,
|
|
'TITLE' => $title,
|
|
'DRPJ' => $datDrpj,
|
|
];
|
|
} else {
|
|
if ($id_corp==1) { $corp = "PT TMP"; } else if ($id_corp==2) { $corp = "PT DMT"; } else if ($id_corp==4) { $corp = "CV SFTR"; }
|
|
$title = "PPH Ps23 - $corp";
|
|
$datDrpj = $this->Amod->getData_DaftarRekapPajak_byCORP_jenis2($id_corp, $awal, $akhir, $jenis);
|
|
|
|
$hasil[$noData] = [
|
|
'JENIS' => $transaksi,
|
|
'TITLE' => $title,
|
|
'DRPJ' => $datDrpj,
|
|
];
|
|
}
|
|
} else if ($transaksi==3) {
|
|
if ($id_corp=="") {
|
|
$title = "PPN - PT TMP";
|
|
$datDrpj = $this->Amod->getData_DaftarRekapPajak_byCORP_jenis3(1, $awal, $akhir, $jenis);
|
|
|
|
$hasil[$noData++] = [
|
|
'JENIS' => $transaksi,
|
|
'TITLE' => $title,
|
|
'DRPJ' => $datDrpj,
|
|
];
|
|
|
|
$title = "PPN - PT DMT";
|
|
$datDrpj = $this->Amod->getData_DaftarRekapPajak_byCORP_jenis3(2, $awal, $akhir, $jenis);
|
|
|
|
$hasil[$noData++] = [
|
|
'JENIS' => $transaksi,
|
|
'TITLE' => $title,
|
|
'DRPJ' => $datDrpj,
|
|
];
|
|
|
|
$title = "PPN - CV SFTR";
|
|
$datDrpj = $this->Amod->getData_DaftarRekapPajak_byCORP_jenis3(4, $awal, $akhir, $jenis);
|
|
|
|
$hasil[$noData++] = [
|
|
'JENIS' => $transaksi,
|
|
'TITLE' => $title,
|
|
'DRPJ' => $datDrpj,
|
|
];
|
|
} else {
|
|
if ($id_corp==1) { $corp = "PT TMP"; } else if ($id_corp==2) { $corp = "PT DMT"; } else if ($id_corp==4) { $corp = "CV SFTR"; }
|
|
$title = "PPN - $corp";
|
|
$datDrpj = $this->Amod->getData_DaftarRekapPajak_byCORP_jenis3($id_corp, $awal, $akhir, $jenis);
|
|
|
|
$hasil[$noData] = [
|
|
'JENIS' => $transaksi,
|
|
'TITLE' => $title,
|
|
'DRPJ' => $datDrpj,
|
|
];
|
|
}
|
|
}
|
|
|
|
$data = [
|
|
'awal_nota' => date_format(date_create($awal), "d/m/Y"),
|
|
'akhir_nota' => date_format(date_create($akhir), "d/m/Y"),
|
|
'hasil' => $hasil,
|
|
'subtitle' => $subtitle,
|
|
'ts' => $timestamp,
|
|
];
|
|
$this->load->view('cetak/KU_Excel_Sub4_DataAnalisaRekapPajak', $data);
|
|
}
|
|
|
|
public function KU_Excel_Sub4_DataAnalisaRincianHutangDagang() {
|
|
$awal_jt = $this->input->post('awal_jtfill');
|
|
$akhir_jt = $this->input->post('akhir_jtfill');
|
|
$awal_nota = $this->input->post('awal_notafill');
|
|
$akhir_nota = $this->input->post('akhir_notafill');
|
|
$transaksi = $this->input->post('transaksi_fill');
|
|
$id_supplier = $this->input->post('id_supplierfill');
|
|
$id_corp = $this->input->post('id_corpfill');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
if ($transaksi==0) {
|
|
$status = "BELUM LUNAS";
|
|
} else if ($transaksi==1) {
|
|
$status = "SUDAH LUNAS";
|
|
} else if ($transaksi==2) {
|
|
$status = "CAMPUR";
|
|
}
|
|
|
|
if ($id_supplier=="") {
|
|
$id_supplier = NULL;
|
|
}
|
|
|
|
if ($id_corp=="") {
|
|
$id_corp = NULL;
|
|
}
|
|
|
|
$hasil = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_bySUPPLIER_byKOP_forRincianHutang(15, $id_supplier, $id_corp, $transaksi, $awal_nota, $akhir_nota, $awal_jt, $akhir_jt);
|
|
$no = 0;
|
|
$subDebet = 0;
|
|
$subKredit = 0;
|
|
$subTotal = 0;
|
|
foreach ($hasil as $key) {
|
|
$subDebet = $subDebet+$key['DEBET'];
|
|
$subKredit = $subKredit+$key['KREDIT'];
|
|
$subTotal = $subTotal+$key['KREDIT']-$key['DEBET'];
|
|
}
|
|
|
|
$pilih_tabel = array('No', 'Supplier', 'Kode', 'Kop', 'Nota', 'Tanggal Nota', 'Jatuh Tempo', 'Nilai DEBET', 'Nilai KREDIT', 'Nilai SUBTOTAL');
|
|
|
|
$data = [
|
|
'awal_jt' => date_format(date_create($awal_jt), "d/m/Y"),
|
|
'akhir_jt' => date_format(date_create($akhir_jt), "d/m/Y"),
|
|
'awal_nota' => date_format(date_create($awal_nota), "d/m/Y"),
|
|
'akhir_nota' => date_format(date_create($akhir_nota), "d/m/Y"),
|
|
'jumlah_kolom' => count($pilih_tabel),
|
|
'nama_tabel' => $pilih_tabel,
|
|
'status' => $status,
|
|
'hasil' => $hasil,
|
|
'ts' => $timestamp,
|
|
'subdebet' => number_format($subDebet,2),
|
|
'subkredit' => number_format($subKredit,2),
|
|
'subtotalall' => number_format($subTotal,2),
|
|
];
|
|
$this->load->view('cetak/KU_Excel_Sub4_DataAnalisaRincianHutangDagang', $data);
|
|
}
|
|
|
|
public function KU_Excel_Sub4_DataAnalisaRincianPiutangDagang() {
|
|
$awal_jt = $this->input->post('awal_jtfill');
|
|
$akhir_jt = $this->input->post('akhir_jtfill');
|
|
$awal_nota = $this->input->post('awal_notafill');
|
|
$akhir_nota = $this->input->post('akhir_notafill');
|
|
$transaksi = $this->input->post('transaksi_fill');
|
|
$id_pelanggan = $this->input->post('id_pelangganfill');
|
|
$id_sales = $this->input->post('id_salesfill');
|
|
$id_corp = $this->input->post('id_corpfill');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
if ($transaksi==0) {
|
|
$status = "BELUM LUNAS";
|
|
} else if ($transaksi==1) {
|
|
$status = "SUDAH LUNAS";
|
|
} else if ($transaksi==2) {
|
|
$status = "CAMPUR";
|
|
}
|
|
|
|
if ($id_pelanggan=="") {
|
|
$id_pelanggan = NULL;
|
|
}
|
|
|
|
if ($id_sales=="") {
|
|
$id_sales = NULL;
|
|
}
|
|
|
|
if ($id_corp=="") {
|
|
$id_corp = NULL;
|
|
}
|
|
|
|
$hasil = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPELANGGAN_byKOP_bySALES_forRincianPiutang(3, $id_pelanggan, $id_corp, $id_sales, $transaksi, $awal_nota, $akhir_nota, $awal_jt, $akhir_jt);
|
|
$no = 0;
|
|
$subDebet = 0;
|
|
$subKredit = 0;
|
|
$subTotal = 0;
|
|
foreach ($hasil as $key) {
|
|
$subDebet = $subDebet+$key['DEBET'];
|
|
$subKredit = $subKredit+$key['KREDIT'];
|
|
$subTotal = $subTotal+$key['DEBET']-$key['KREDIT'];
|
|
}
|
|
|
|
$pilih_tabel = array('No', 'Pelanggan', 'Sales', 'Kode', 'Kop', 'Nota', 'Tanggal Nota', 'Jatuh Tempo', 'Nilai DEBET', 'Nilai KREDIT', 'Nilai SUBTOTAL');
|
|
|
|
$data = [
|
|
'awal_jt' => date_format(date_create($awal_jt), "d/m/Y"),
|
|
'akhir_jt' => date_format(date_create($akhir_jt), "d/m/Y"),
|
|
'awal_nota' => date_format(date_create($awal_nota), "d/m/Y"),
|
|
'akhir_nota' => date_format(date_create($akhir_nota), "d/m/Y"),
|
|
'jumlah_kolom' => count($pilih_tabel),
|
|
'nama_tabel' => $pilih_tabel,
|
|
'status' => $status,
|
|
'hasil' => $hasil,
|
|
'ts' => $timestamp,
|
|
'subdebet' => number_format($subDebet,2),
|
|
'subkredit' => number_format($subKredit,2),
|
|
'subtotalall' => number_format($subTotal,2),
|
|
];
|
|
$this->load->view('cetak/KU_Excel_Sub4_DataAnalisaRincianPiutangDagang', $data);
|
|
}
|
|
|
|
public function KU_Excel_Sub4_DataAnalisaTransaksiKeuangan() {
|
|
$awal = $this->input->post('tgl_awalfill');
|
|
$akhir = $this->input->post('tgl_akhirfill');
|
|
$transaksi = $this->input->post('transaksi_fill');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
if ($transaksi=="ALL") {
|
|
$nama = "SEMUA TRANSAKSI";
|
|
} else if ($transaksi=="BK") {
|
|
$nama = "BANK KELUAR";
|
|
} else if ($transaksi=="BM") {
|
|
$nama = "BANK MASUK";
|
|
} else if ($transaksi=="KK") {
|
|
$nama = "KAS KELUAR";
|
|
} else if ($transaksi=="KM") {
|
|
$nama = "KAS MASUK";
|
|
} else if ($transaksi=="JM") {
|
|
$nama = "JURNAL MEMO";
|
|
} else if ($transaksi=="JS") {
|
|
$nama = "JURNAL SISTEM";
|
|
} else if ($transaksi=="PB") {
|
|
$nama = "PEMBELIAN";
|
|
} else if ($transaksi=="PJ") {
|
|
$nama = "PENJUALAN";
|
|
} else if ($transaksi=="RB") {
|
|
$nama = "RETUR PEMBELIAN";
|
|
} else if ($transaksi=="RJ") {
|
|
$nama = "RETUR PENJUALAN";
|
|
}
|
|
|
|
$hasil[0] = [
|
|
'IDSHEET' => '0',
|
|
'FASHEET' => $nama,
|
|
'NASHEET' => "Sesuai Filter"
|
|
];
|
|
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byKODE_byPERIODE($transaksi, $awal, $akhir);
|
|
$no = 0;
|
|
$subDebet = 0;
|
|
$subKredit = 0;
|
|
foreach ($datDak as $dat) {
|
|
$subDebet = $subDebet+$dat['DEBET_DAK'];
|
|
$subKredit = $subKredit+$dat['KREDIT_DAK'];
|
|
|
|
$datDak[$no] += ['DEBET' => number_format($dat['DEBET_DAK'], 2)];
|
|
$datDak[$no++] += ['KREDIT' => number_format($dat['KREDIT_DAK'], 2)];
|
|
}
|
|
$hasil[0] += ['SUBDEBET' => number_format($subDebet,2)];
|
|
$hasil[0] += ['SUBKREDIT' => number_format($subKredit,2)];
|
|
$hasil[0] += ['ISI' => $datDak];
|
|
|
|
$pilih_tabel = array('No', 'Kode', 'Tanggal', 'Timestamp', 'Perkiraan', 'Nilai DEBET', 'Nilai KREDIT', 'Keterangan');
|
|
|
|
$data = [
|
|
'awal_nota' => date_format(date_create($awal), "d/m/Y"),
|
|
'akhir_nota' => date_format(date_create($akhir), "d/m/Y"),
|
|
'jumlah_kolom' => count($pilih_tabel),
|
|
'nama_tabel' => $pilih_tabel,
|
|
'hasil' => $hasil,
|
|
'ts' => $timestamp,
|
|
];
|
|
$this->load->view('cetak/KU_Excel_Sub4_DataAnalisaTransaksiKeuangan', $data);
|
|
}
|
|
|
|
public function KU_Excel_Sub4_DataAnalisaTrialBalance() {
|
|
$id_pak = $this->input->post('id_pakfill');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$pilih_tabel1 = array('NO', 'KODE', 'NAMA');
|
|
$pilih_tabel2 = array('REKENING', 'KETERANGAN');
|
|
|
|
if ($id_pak>=2022) {
|
|
$nama_pak = "PERIODE TAHUN $id_pak";
|
|
} else {
|
|
$datPak = $this->Amod->getData_PeriodeAkuntansi_byID($id_pak);
|
|
$nama_pak = $datPak[0]['NAMA_PAK'];
|
|
}
|
|
|
|
$datAkuntb = $this->Amod->getData_AkunTrialBalance();
|
|
$no = 0;
|
|
foreach ($datAkuntb as $key) {
|
|
$datHhtbC = $this->Amod->getData_HasilHitungTb_byPAK_byAKUN_byKOLOM($id_pak, $key['KODE_AKUNTB'], "C");
|
|
$datHhtbD = $this->Amod->getData_HasilHitungTb_byPAK_byAKUN_byKOLOM($id_pak, $key['KODE_AKUNTB'], "D");
|
|
$datHhtbE = $this->Amod->getData_HasilHitungTb_byPAK_byAKUN_byKOLOM($id_pak, $key['KODE_AKUNTB'], "E");
|
|
$datHhtbF = $this->Amod->getData_HasilHitungTb_byPAK_byAKUN_byKOLOM($id_pak, $key['KODE_AKUNTB'], "F");
|
|
$datHhtbG = $this->Amod->getData_HasilHitungTb_byPAK_byAKUN_byKOLOM($id_pak, $key['KODE_AKUNTB'], "G");
|
|
$datHhtbH = $this->Amod->getData_HasilHitungTb_byPAK_byAKUN_byKOLOM($id_pak, $key['KODE_AKUNTB'], "H");
|
|
$datHhtbI = $this->Amod->getData_HasilHitungTb_byPAK_byAKUN_byKOLOM($id_pak, $key['KODE_AKUNTB'], "I");
|
|
$datHhtbJ = $this->Amod->getData_HasilHitungTb_byPAK_byAKUN_byKOLOM($id_pak, $key['KODE_AKUNTB'], "J");
|
|
$datHhtbK = $this->Amod->getData_HasilHitungTb_byPAK_byAKUN_byKOLOM($id_pak, $key['KODE_AKUNTB'], "K");
|
|
$datHhtbL = $this->Amod->getData_HasilHitungTb_byPAK_byAKUN_byKOLOM($id_pak, $key['KODE_AKUNTB'], "L");
|
|
$datHhtbM = $this->Amod->getData_HasilHitungTb_byPAK_byAKUN_byKOLOM($id_pak, $key['KODE_AKUNTB'], "M");
|
|
$datHhtbN = $this->Amod->getData_HasilHitungTb_byPAK_byAKUN_byKOLOM($id_pak, $key['KODE_AKUNTB'], "N");
|
|
$datHhtbO = $this->Amod->getData_HasilHitungTb_byPAK_byAKUN_byKOLOM($id_pak, $key['KODE_AKUNTB'], "O");
|
|
$datHhtbP = $this->Amod->getData_HasilHitungTb_byPAK_byAKUN_byKOLOM($id_pak, $key['KODE_AKUNTB'], "P");
|
|
$datHhtbQ = $this->Amod->getData_HasilHitungTb_byPAK_byAKUN_byKOLOM($id_pak, $key['KODE_AKUNTB'], "Q");
|
|
$datHhtbR = $this->Amod->getData_HasilHitungTb_byPAK_byAKUN_byKOLOM($id_pak, $key['KODE_AKUNTB'], "R");
|
|
$datHhtbS = $this->Amod->getData_HasilHitungTb_byPAK_byAKUN_byKOLOM($id_pak, $key['KODE_AKUNTB'], "S");
|
|
$datHhtbT = $this->Amod->getData_HasilHitungTb_byPAK_byAKUN_byKOLOM($id_pak, $key['KODE_AKUNTB'], "T");
|
|
$datHhtbU = $this->Amod->getData_HasilHitungTb_byPAK_byAKUN_byKOLOM($id_pak, $key['KODE_AKUNTB'], "U");
|
|
$datHhtbV = $this->Amod->getData_HasilHitungTb_byPAK_byAKUN_byKOLOM($id_pak, $key['KODE_AKUNTB'], "V");
|
|
$datHhtbW = $this->Amod->getData_HasilHitungTb_byPAK_byAKUN_byKOLOM($id_pak, $key['KODE_AKUNTB'], "W");
|
|
$datHhtbX = $this->Amod->getData_HasilHitungTb_byPAK_byAKUN_byKOLOM($id_pak, $key['KODE_AKUNTB'], "X");
|
|
$datHhtbY = $this->Amod->getData_HasilHitungTb_byPAK_byAKUN_byKOLOM($id_pak, $key['KODE_AKUNTB'], "Y");
|
|
$datHhtbZ = $this->Amod->getData_HasilHitungTb_byPAK_byAKUN_byKOLOM($id_pak, $key['KODE_AKUNTB'], "Z");
|
|
$datHhtbAA = $this->Amod->getData_HasilHitungTb_byPAK_byAKUN_byKOLOM($id_pak, $key['KODE_AKUNTB'], "AA");
|
|
$datHhtbAB = $this->Amod->getData_HasilHitungTb_byPAK_byAKUN_byKOLOM($id_pak, $key['KODE_AKUNTB'], "AB");
|
|
$datHhtbAC = $this->Amod->getData_HasilHitungTb_byPAK_byAKUN_byKOLOM($id_pak, $key['KODE_AKUNTB'], "AC");
|
|
$datHhtbAD = $this->Amod->getData_HasilHitungTb_byPAK_byAKUN_byKOLOM($id_pak, $key['KODE_AKUNTB'], "AD");
|
|
$datHhtbAE = $this->Amod->getData_HasilHitungTb_byPAK_byAKUN_byKOLOM($id_pak, $key['KODE_AKUNTB'], "AE");
|
|
$datHhtbAF = $this->Amod->getData_HasilHitungTb_byPAK_byAKUN_byKOLOM($id_pak, $key['KODE_AKUNTB'], "AF");
|
|
$datHhtbAG = $this->Amod->getData_HasilHitungTb_byPAK_byAKUN_byKOLOM($id_pak, $key['KODE_AKUNTB'], "AG");
|
|
$datHhtbAH = $this->Amod->getData_HasilHitungTb_byPAK_byAKUN_byKOLOM($id_pak, $key['KODE_AKUNTB'], "AH");
|
|
$datHhtbAI = $this->Amod->getData_HasilHitungTb_byPAK_byAKUN_byKOLOM($id_pak, $key['KODE_AKUNTB'], "AI");
|
|
$datHhtbAJ = $this->Amod->getData_HasilHitungTb_byPAK_byAKUN_byKOLOM($id_pak, $key['KODE_AKUNTB'], "AJ");
|
|
$datHhtbAK = $this->Amod->getData_HasilHitungTb_byPAK_byAKUN_byKOLOM($id_pak, $key['KODE_AKUNTB'], "AK");
|
|
$datHhtbAL = $this->Amod->getData_HasilHitungTb_byPAK_byAKUN_byKOLOM($id_pak, $key['KODE_AKUNTB'], "AL");
|
|
$datHhtbAM = $this->Amod->getData_HasilHitungTb_byPAK_byAKUN_byKOLOM($id_pak, $key['KODE_AKUNTB'], "AM");
|
|
$datHhtbAN = $this->Amod->getData_HasilHitungTb_byPAK_byAKUN_byKOLOM($id_pak, $key['KODE_AKUNTB'], "AN");
|
|
$datHhtbAO = $this->Amod->getData_HasilHitungTb_byPAK_byAKUN_byKOLOM($id_pak, $key['KODE_AKUNTB'], "AO");
|
|
$datHhtbAP = $this->Amod->getData_HasilHitungTb_byPAK_byAKUN_byKOLOM($id_pak, $key['KODE_AKUNTB'], "AP");
|
|
$datHhtbAQ = $this->Amod->getData_HasilHitungTb_byPAK_byAKUN_byKOLOM($id_pak, $key['KODE_AKUNTB'], "AQ");
|
|
$datHhtbAR = $this->Amod->getData_HasilHitungTb_byPAK_byAKUN_byKOLOM($id_pak, $key['KODE_AKUNTB'], "AR");
|
|
$datHhtbAS = $this->Amod->getData_HasilHitungTb_byPAK_byAKUN_byKOLOM($id_pak, $key['KODE_AKUNTB'], "AS");
|
|
$datHhtbAT = $this->Amod->getData_HasilHitungTb_byPAK_byAKUN_byKOLOM($id_pak, $key['KODE_AKUNTB'], "AT");
|
|
|
|
$datAkuntb[$no] += ['kolomC' => $datHhtbC];
|
|
$datAkuntb[$no] += ['kolomD' => $datHhtbD];
|
|
$datAkuntb[$no] += ['kolomE' => $datHhtbE];
|
|
$datAkuntb[$no] += ['kolomF' => $datHhtbF];
|
|
$datAkuntb[$no] += ['kolomG' => $datHhtbG];
|
|
$datAkuntb[$no] += ['kolomH' => $datHhtbH];
|
|
$datAkuntb[$no] += ['kolomI' => $datHhtbI];
|
|
$datAkuntb[$no] += ['kolomJ' => $datHhtbJ];
|
|
$datAkuntb[$no] += ['kolomK' => $datHhtbK];
|
|
$datAkuntb[$no] += ['kolomL' => $datHhtbL];
|
|
$datAkuntb[$no] += ['kolomM' => $datHhtbM];
|
|
$datAkuntb[$no] += ['kolomN' => $datHhtbN];
|
|
$datAkuntb[$no] += ['kolomO' => $datHhtbO];
|
|
$datAkuntb[$no] += ['kolomP' => $datHhtbP];
|
|
$datAkuntb[$no] += ['kolomQ' => $datHhtbQ];
|
|
$datAkuntb[$no] += ['kolomR' => $datHhtbR];
|
|
$datAkuntb[$no] += ['kolomS' => $datHhtbS];
|
|
$datAkuntb[$no] += ['kolomT' => $datHhtbT];
|
|
$datAkuntb[$no] += ['kolomU' => $datHhtbU];
|
|
$datAkuntb[$no] += ['kolomV' => $datHhtbV];
|
|
$datAkuntb[$no] += ['kolomW' => $datHhtbW];
|
|
$datAkuntb[$no] += ['kolomX' => $datHhtbX];
|
|
$datAkuntb[$no] += ['kolomY' => $datHhtbY];
|
|
$datAkuntb[$no] += ['kolomZ' => $datHhtbZ];
|
|
$datAkuntb[$no] += ['kolomAA' => $datHhtbAA];
|
|
$datAkuntb[$no] += ['kolomAB' => $datHhtbAB];
|
|
$datAkuntb[$no] += ['kolomAC' => $datHhtbAC];
|
|
$datAkuntb[$no] += ['kolomAD' => $datHhtbAD];
|
|
$datAkuntb[$no] += ['kolomAE' => $datHhtbAE];
|
|
$datAkuntb[$no] += ['kolomAF' => $datHhtbAF];
|
|
$datAkuntb[$no] += ['kolomAG' => $datHhtbAG];
|
|
$datAkuntb[$no] += ['kolomAH' => $datHhtbAH];
|
|
$datAkuntb[$no] += ['kolomAI' => $datHhtbAI];
|
|
$datAkuntb[$no] += ['kolomAJ' => $datHhtbAJ];
|
|
$datAkuntb[$no] += ['kolomAK' => $datHhtbAK];
|
|
$datAkuntb[$no] += ['kolomAL' => $datHhtbAL];
|
|
$datAkuntb[$no] += ['kolomAM' => $datHhtbAM];
|
|
$datAkuntb[$no] += ['kolomAN' => $datHhtbAN];
|
|
$datAkuntb[$no] += ['kolomAO' => $datHhtbAO];
|
|
$datAkuntb[$no] += ['kolomAP' => $datHhtbAP];
|
|
$datAkuntb[$no] += ['kolomAQ' => $datHhtbAQ];
|
|
$datAkuntb[$no] += ['kolomAR' => $datHhtbAR];
|
|
$datAkuntb[$no] += ['kolomAS' => $datHhtbAS];
|
|
$datAkuntb[$no++] += ['kolomAT' => $datHhtbAT];
|
|
}
|
|
|
|
$data = [
|
|
'akuntb' => $datAkuntb,
|
|
'nama_tabel1' => $pilih_tabel1,
|
|
'nama_tabel2' => $pilih_tabel2,
|
|
'jumlah_kolom1' => count($pilih_tabel1),
|
|
'jumlah_kolom2' => count($pilih_tabel2),
|
|
'ts' => $timestamp,
|
|
'nama_pak' => $nama_pak,
|
|
];
|
|
$this->load->view('cetak/KU_Excel_Sub4_DataAnalisaTrialBalance', $data);
|
|
}
|
|
|
|
//SUBMENU PUSAT DATA - NERACA BERJALAN
|
|
public function KU_Sub4_NeracaBerjalan_1() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$now = date('Y-m-d');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "KU", "PUSAT DATA - Neraca Berjalan");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$datPak = $this->Amod->getData_PeriodeAkuntansi_byPERIODE($now);
|
|
if ($datPak==FALSE) {
|
|
$datPak = $this->Amod->getData_PeriodeAkuntansi_status0();
|
|
}
|
|
|
|
$data = array(
|
|
'sidebar' => "menu keuangan",
|
|
'navChild' => "keuangan neraca",
|
|
'nama_pak' => $datPak[0]['NAMA_PAK'],
|
|
'id_pak' => $datPak[0]['ID_PAK'],
|
|
'hak' => $hak,
|
|
'tampil' => $tampil,
|
|
);
|
|
$this->load->view('proses/KU_Sub4_NeracaBerjalan_1', $data);
|
|
}
|
|
|
|
public function KU_Sub4_NeracaBerjalan_2($id, $verse, $pak) {
|
|
$datPak = $this->Amod->getData_PeriodeAkuntansi_byID($pak);
|
|
if ($datPak[0]['STATUS_PAK']==0) {
|
|
$limit = date('Y-m-01');
|
|
$now = date('Y-m-d');
|
|
} else if ($datPak[0]['STATUS_PAK']==1) {
|
|
$limit = $datPak[0]['AWAL_PAK'];
|
|
$now = $datPak[0]['AKHIR_PAK'];
|
|
}
|
|
$awal = $this->Amod->generate_subDay($limit, 1);
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$datPerkiraan = $this->Amod->getData_Perkiraan_byID($id);
|
|
$data = [];
|
|
$no = 0;
|
|
$akumulasi = 0;
|
|
$pm = 0;
|
|
$pk = 0;
|
|
if ($id==1) {
|
|
$datKas = $this->Amod->getData_Kas_bySTATUS(1);
|
|
foreach ($datKas as $key) {
|
|
$kode = $key['KODE_KAS'];
|
|
$nama = $key['NAMA_KAS'];
|
|
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byKAS_dataNow($id, $key['ID_KAS'], $now);
|
|
$total = $sumDak[0]['DEBET']-$sumDak[0]['KREDIT'];
|
|
|
|
$akumulasi = $akumulasi+$total;
|
|
|
|
$data[$no++] = [
|
|
'KODE' => $kode,
|
|
'NAMA' => $nama,
|
|
'TOTAL' => number_format($total, 2),
|
|
'ID' => $key['ID_KAS']
|
|
];
|
|
}
|
|
} else if ($id==2) {
|
|
$datBank = $this->Amod->getData_Bank_bySTATUS(1);
|
|
foreach ($datBank as $key) {
|
|
$kode = $key['KODE_BANK'];
|
|
$nama = $key['NAMA_BANK'];
|
|
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byBANK_dataNow($id, $key['ID_BANK'], $now);
|
|
$total = $sumDak[0]['DEBET']-$sumDak[0]['KREDIT'];
|
|
|
|
$akumulasi = $akumulasi+$total;
|
|
|
|
$data[$no++] = [
|
|
'KODE' => $kode,
|
|
'NAMA' => $nama,
|
|
'TOTAL' => number_format($total, 2),
|
|
'ID' => $key['ID_BANK']
|
|
];
|
|
}
|
|
} else if ($id==3) {
|
|
if ($datPak[0]['STATUS_PAK']==0) {
|
|
$datHhpda = $this->Amod->getData_HasilHitungPda_status0_groupPELANGGAN();
|
|
} else if ($datPak[0]['STATUS_PAK']==1) {
|
|
$datHhpda = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byARAH_groupPELANGGAN_beforeTGL_belumLunas($id, "DK", $now);
|
|
}
|
|
foreach ($datHhpda as $key) {
|
|
$kode = $key['NAMA_PELANGGAN'];
|
|
$nama = $key['NAMA_KOTA'];
|
|
|
|
$total = $key['TOTAL'];
|
|
$akumulasi = $akumulasi+$total;
|
|
|
|
$data[$no++] = [
|
|
'KODE' => $kode,
|
|
'NAMA' => $nama,
|
|
'TOTAL' => number_format($total, 2),
|
|
'ID' => $key['PELANGGAN_ID']
|
|
];
|
|
}
|
|
} else if ($id==4 OR $id==30) {
|
|
$datHqPersediaan = $this->Amod->getSum_HistoriKuantiti_groupBARANG_beforeTGL_morethan0($now);
|
|
$no = 0;
|
|
$akumulasi = 0;
|
|
foreach ($datHqPersediaan as $key) {
|
|
$cekHq = $this->Amod->getData_HistoriKuantiti_byBARANG_beforeTGL_orderDESC_limit1($key['BARANG_ID'], $now);
|
|
$akumulasi = $akumulasi+round($cekHq[0]['PERSEDIAAN_HQ'],2);
|
|
|
|
$data[$no++] = [
|
|
'KODE' => $key['KODE_BARANG'],
|
|
'NAMA' => $key['NAMA_BARANG'],
|
|
'TOTAL' => number_format($cekHq[0]['PERSEDIAAN_HQ'], 2),
|
|
'PERS' => number_format($key['PERSEDIAAN_KUANTITI'], 2),
|
|
'QTY' => $cekHq[0]['SISA_HQ'],
|
|
];
|
|
}
|
|
} else if ($id==5) {
|
|
if ($datPak[0]['STATUS_PAK']==0) {
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byPERKIRAAN_groupKARYAWAN_belumLunas($id);
|
|
} else if ($datPak[0]['STATUS_PAK']==1) {
|
|
$datDak = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_groupKARYAWAN_beforeTGL_belumLunas($id, $now);
|
|
}
|
|
foreach ($datDak as $key) {
|
|
$kode = $key['NAMA_PANGGILAN_KARYAWAN'];
|
|
$nama = $key['NAMA_JABATAN'];
|
|
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byKARYAWAN_dataNow($id, $key['KARYAWAN_ID'], $now);
|
|
$total = $sumDak[0]['DEBET']-$sumDak[0]['KREDIT'];
|
|
|
|
$akumulasi = $akumulasi+$total;
|
|
|
|
$data[$no++] = [
|
|
'KODE' => $kode,
|
|
'NAMA' => $nama,
|
|
'TOTAL' => number_format($total, 2),
|
|
'ID' => $key['KARYAWAN_ID']
|
|
];
|
|
}
|
|
} else if ($id==6) {
|
|
if ($datPak[0]['STATUS_PAK']==0) {
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byPERKIRAAN_groupPIHAKKE3_belumLunas($id);
|
|
} else if ($datPak[0]['STATUS_PAK']==1) {
|
|
$datDak = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_groupPIHAKKE3_beforeTGL_belumLunas($id, $now);
|
|
}
|
|
foreach ($datDak as $key) {
|
|
$kode = $key['NAMA_PIHAKKE3'];
|
|
$nama = $key['NAMA_KOTA'];
|
|
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPIHAKKE3_dataNow($id, $key['PIHAKKE3_ID'], $now);
|
|
$total = $sumDak[0]['DEBET']-$sumDak[0]['KREDIT'];
|
|
|
|
$akumulasi = $akumulasi+$total;
|
|
|
|
$data[$no++] = [
|
|
'KODE' => $kode,
|
|
'NAMA' => $nama,
|
|
'TOTAL' => number_format($total, 2),
|
|
'ID' => $key['PIHAKKE3_ID']
|
|
];
|
|
}
|
|
} else if ($id==7) {
|
|
if ($datPak[0]['STATUS_PAK']==0) {
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byPERKIRAAN_groupSUPPLIER_belumLunas($id);
|
|
} else if ($datPak[0]['STATUS_PAK']==1) {
|
|
$datDak = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byARAH_groupSUPPLIER_beforeTGL_belumLunas($id, "DK", $now);
|
|
}
|
|
foreach ($datDak as $key) {
|
|
$kode = $key['NAMA_SUPPLIER'];
|
|
$nama = $key['NAMA_KOTA'];
|
|
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_bySUPPLIER_dataNow($id, $key['SUPPLIER_ID'], $now);
|
|
$total = $sumDak[0]['DEBET']-$sumDak[0]['KREDIT'];
|
|
|
|
$akumulasi = $akumulasi+$total;
|
|
|
|
$data[$no++] = [
|
|
'KODE' => $kode,
|
|
'NAMA' => $nama,
|
|
'TOTAL' => number_format($total, 2),
|
|
'ID' => $key['SUPPLIER_ID']
|
|
];
|
|
}
|
|
} else if ($id==15) {
|
|
if ($datPak[0]['STATUS_PAK']==0) {
|
|
$datHhhda = $this->Amod->getData_HasilHitungHda_status0_groupSUPPLIER();
|
|
} else if ($datPak[0]['STATUS_PAK']==1) {
|
|
$datHhhda = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byARAH_groupSUPPLIER_beforeTGL_belumLunas($id, "KD", $now);
|
|
}
|
|
foreach ($datHhhda as $key) {
|
|
$kode = $key['NAMA_SUPPLIER'];
|
|
$nama = $key['NAMA_KOTA'];
|
|
|
|
$total = $key['TOTAL'];
|
|
$akumulasi = $akumulasi+$total;
|
|
|
|
$data[$no++] = [
|
|
'KODE' => $kode,
|
|
'NAMA' => $nama,
|
|
'TOTAL' => number_format($total, 2),
|
|
'ID' => $key['SUPPLIER_ID']
|
|
];
|
|
}
|
|
} else if ($id==19) {
|
|
if ($datPak[0]['STATUS_PAK']==0) {
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byPERKIRAAN_groupPELANGGAN_belumLunas($id);
|
|
} else if ($datPak[0]['STATUS_PAK']==1) {
|
|
$datDak = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byARAH_groupPELANGGAN_beforeTGL_belumLunas($id, "KD", $now);
|
|
}
|
|
foreach ($datDak as $key) {
|
|
$kode = $key['NAMA_PELANGGAN'];
|
|
$nama = $key['NAMA_KOTA'];
|
|
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPELANGGAN_dataNow($id, $key['PELANGGAN_ID'], $now);
|
|
$total = $sumDak[0]['KREDIT']-$sumDak[0]['DEBET'];
|
|
|
|
$akumulasi = $akumulasi+$total;
|
|
|
|
$data[$no++] = [
|
|
'KODE' => $kode,
|
|
'NAMA' => $nama,
|
|
'TOTAL' => number_format($total, 2),
|
|
'ID' => $key['PELANGGAN_ID']
|
|
];
|
|
}
|
|
} else if ($id==33 OR $id==34) {
|
|
$datKendaraan = $this->Amod->getData_Kendaraan_bySTATUS(1);
|
|
foreach ($datKendaraan as $key) {
|
|
$kode = $key['NAMA_KENDARAAN'];
|
|
$nama = $key['NOPOL_KENDARAAN'];
|
|
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byKENDARAAN_byPERIODE($id, $key['ID_KENDARAAN'], $limit, $now);
|
|
$total = $sumDak[0]['DEBET']-$sumDak[0]['KREDIT'];
|
|
|
|
$akumulasi = $akumulasi+$total;
|
|
|
|
$data[$no++] = [
|
|
'KODE' => $kode,
|
|
'NAMA' => $nama,
|
|
'TOTAL' => number_format($total, 2),
|
|
'ID' => $key['ID_KENDARAAN']
|
|
];
|
|
}
|
|
} else if ($id==64) {
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byPERKIRAAN_byPERIODE_groupPELANGGAN($id, $limit, $now);
|
|
foreach ($datDak as $key) {
|
|
$kode = $key['NAMA_PELANGGAN'];
|
|
$nama = $key['NAMA_KOTA'];
|
|
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPELANGGAN_byPERIODE($id, $key['PEL_ID'], $limit, $now);
|
|
$total = $sumDak[0]['DEBET']-$sumDak[0]['KREDIT'];
|
|
|
|
$akumulasi = $akumulasi+$total;
|
|
|
|
$data[$no++] = [
|
|
'KODE' => $kode,
|
|
'NAMA' => $nama,
|
|
'TOTAL' => number_format($total, 2),
|
|
'ID' => $key['PEL_ID']
|
|
];
|
|
}
|
|
} else if ($id==70) {
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byPERKIRAAN_byPERIODE_groupPELANGGAN_forProyek($id, $limit, $now);
|
|
foreach ($datDak as $key) {
|
|
$kode = $key['NAMA_PELANGGAN'];
|
|
$nama = $key['NAMA_KOTA'];
|
|
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_byPELANGGAN_byPERIODE_forProyek($id, $key['PELANGGAN_ID'], $limit, $now);
|
|
$total = $sumDak[0]['DEBET']-$sumDak[0]['KREDIT'];
|
|
|
|
$akumulasi = $akumulasi+$total;
|
|
|
|
$data[$no++] = [
|
|
'KODE' => $kode,
|
|
'NAMA' => $nama,
|
|
'TOTAL' => number_format($total, 2),
|
|
'ID' => $key['PELANGGAN_ID']
|
|
];
|
|
}
|
|
} else {
|
|
if ($id==8 OR $id==9 OR $id==11 OR $id==13 OR $id==16 OR $id==17 OR $id==18 OR $id==20 OR $id==21 OR $id==26 OR $id==82 OR $id==83) {
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_beforeTGL($id, $awal);
|
|
if ($id==8 OR $id==9 OR $id==11 OR $id==13 OR $id==26 OR $id==82) {
|
|
$total = $sumDak[0]['DEBET']-$sumDak[0]['KREDIT'];
|
|
if ($id==9 OR $id==11 OR $id==13) {
|
|
if ($id==9) {
|
|
$idrev = 10;
|
|
} else if ($id==11) {
|
|
$idrev = 12;
|
|
} else if ($id==13) {
|
|
$idrev = 14;
|
|
}
|
|
$sumDakReverse = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_beforeTGL($idrev, $awal);
|
|
$total = $total-$sumDakReverse[0]['KREDIT']+$sumDakReverse[0]['DEBET'];
|
|
} else if ($id==82) {
|
|
$sumDakReverse = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_beforeTGL(83, $awal);
|
|
$total = $total-$sumDakReverse[0]['KREDIT']+$sumDakReverse[0]['DEBET'];
|
|
}
|
|
} else if ($id==16 OR $id==17 OR $id==18 OR $id==20 OR $id==21 OR $id==83) {
|
|
$total = $sumDak[0]['KREDIT']-$sumDak[0]['DEBET'];
|
|
if ($id==83) {
|
|
$sumDakReverse = $this->Amod->getSum_DaftarAkuntansi_byPERKIRAAN_beforeTGL(82, $awal);
|
|
$total = $total-$sumDakReverse[0]['DEBET']+$sumDakReverse[0]['KREDIT'];
|
|
}
|
|
}
|
|
} else {
|
|
$total = 0;
|
|
}
|
|
|
|
$akumulasi = $akumulasi+$total;
|
|
|
|
$data[$no++] = [
|
|
'KODE_AKUNTANSI' => "Saldo Awal",
|
|
'TANGGAL' => "-",
|
|
'CIPTA_DAK' => "",
|
|
'DEBET' => "",
|
|
'KREDIT' => "",
|
|
'SALDO' => number_format($total, 2),
|
|
'KET_DAK' => "Saldo Awal"
|
|
];
|
|
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byPERKIRAAN_byPERIODE($id, $limit, $now);
|
|
foreach ($datDak as $key) {
|
|
if ($id==82) {
|
|
$akumulasi = $akumulasi+$key['DEBET_DAK']-$key['KREDIT_DAK'];
|
|
$pm = $pm+$key['DEBET_DAK']-$key['KREDIT_DAK'];
|
|
} else if ($id==83) {
|
|
$akumulasi = $akumulasi+$key['KREDIT_DAK']-$key['DEBET_DAK'];
|
|
$pk = $pk+$key['KREDIT_DAK']-$key['DEBET_DAK'];
|
|
} else if ($id==16 OR $id==17 OR $id==18 OR $id==20 OR $id==21 OR $id==23 OR $id==28 OR $id==29 OR $id==75 OR $id==76) {
|
|
$akumulasi = $akumulasi+$key['KREDIT_DAK']-$key['DEBET_DAK'];
|
|
} else {
|
|
$akumulasi = $akumulasi+$key['DEBET_DAK']-$key['KREDIT_DAK'];
|
|
}
|
|
$data[$no++] = [
|
|
'KODE_AKUNTANSI' => $key['KODE_AKUNTANSI'],
|
|
'TANGGAL' => $key['TANGGAL'],
|
|
'CIPTA_DAK' => $key['CIPTA_DAK'],
|
|
'DEBET' => $key['DEBET'],
|
|
'KREDIT' => $key['KREDIT'],
|
|
'SALDO' => number_format($akumulasi, 2),
|
|
'KET_DAK' => $key['KET_DAK'],
|
|
];
|
|
}
|
|
|
|
if ($id==9 OR $id==11 OR $id==13) {
|
|
$revDak = $this->Amod->getData_DaftarAkuntansi_byPERKIRAAN_byPERIODE($idrev, $limit, $now);
|
|
foreach ($revDak as $key) {
|
|
$akumulasi = $akumulasi+$key['DEBET_DAK']-$key['KREDIT_DAK'];
|
|
|
|
$data[$no++]= [
|
|
'KODE_AKUNTANSI' => $key['KODE_AKUNTANSI'],
|
|
'TANGGAL' => $key['TANGGAL'],
|
|
'CIPTA_DAK' => $key['CIPTA_DAK'],
|
|
'DEBET' => $key['DEBET'],
|
|
'KREDIT' => $key['KREDIT'],
|
|
'SALDO' => number_format($akumulasi, 2),
|
|
'KET_DAK' => $key['KET_DAK'],
|
|
];
|
|
}
|
|
} else if ($id==82) {
|
|
$revDak = $this->Amod->getData_DaftarAkuntansi_byPERKIRAAN_byPERIODE(83, $limit, $now);
|
|
$debet_pk = 0;
|
|
$kredit_pk = 0;
|
|
foreach ($revDak as $key) {
|
|
$akumulasi = $akumulasi+$key['DEBET_DAK']-$key['KREDIT_DAK'];
|
|
$pk = $pk+$key['KREDIT_DAK']-$key['DEBET_DAK'];
|
|
$debet_pk = $debet_pk+$key['DEBET_DAK'];
|
|
$kredit_pk = $kredit_pk+$key['KREDIT_DAK'];
|
|
}
|
|
$data[$no++] = [
|
|
'KODE_AKUNTANSI' => "Pajak Keluaran",
|
|
'TANGGAL' => "-",
|
|
'CIPTA_DAK' => "",
|
|
'DEBET' => number_format($debet_pk, 2),
|
|
'KREDIT' => number_format($kredit_pk, 2),
|
|
'SALDO' => number_format($akumulasi, 2),
|
|
'KET_DAK' => "Total Pajak Keluaran Terhitung <b style='color:Red'>$timestamp</b>"
|
|
];
|
|
if ($akumulasi<0) {
|
|
$data[$no++] = [
|
|
'KODE_AKUNTANSI' => "Set Nilai Akhir",
|
|
'TANGGAL' => "-",
|
|
'CIPTA_DAK' => "",
|
|
'DEBET' => "",
|
|
'KREDIT' => "",
|
|
'SALDO' => "0.00",
|
|
'KET_DAK' => "Hasil Akhir Neraca jika Akumulasi Pajak Masukan kurang dari Pajak Keluaran"
|
|
];
|
|
$akumulasi = 0;
|
|
}
|
|
} else if ($id==83) {
|
|
$revDak = $this->Amod->getData_DaftarAkuntansi_byPERKIRAAN_byPERIODE(82, $limit, $now);
|
|
$debet_pm = 0;
|
|
$kredit_pm = 0;
|
|
foreach ($revDak as $key) {
|
|
$akumulasi = $akumulasi+$key['KREDIT_DAK']-$key['DEBET_DAK'];
|
|
$pm = $pm+$key['DEBET_DAK']-$key['KREDIT_DAK'];
|
|
$debet_pm = $debet_pm+$key['DEBET_DAK'];
|
|
$kredit_pm = $kredit_pm+$key['KREDIT_DAK'];
|
|
}
|
|
$data[$no++] = [
|
|
'KODE_AKUNTANSI' => "Pajak Masukan",
|
|
'TANGGAL' => "-",
|
|
'CIPTA_DAK' => "",
|
|
'DEBET' => number_format($debet_pm, 2),
|
|
'KREDIT' => number_format($kredit_pm, 2),
|
|
'SALDO' => number_format($akumulasi, 2),
|
|
'KET_DAK' => "Total Pajak Masukan Terhitung <b style='color:Red'>$timestamp</b>"
|
|
];
|
|
if ($akumulasi<0) {
|
|
$data[$no++] = [
|
|
'KODE_AKUNTANSI' => "Set Nilai Akhir",
|
|
'TANGGAL' => "-",
|
|
'CIPTA_DAK' => "",
|
|
'DEBET' => "",
|
|
'KREDIT' => "",
|
|
'SALDO' => "0.00",
|
|
'KET_DAK' => "Hasil Akhir Neraca jika Akumulasi Pajak Keluaran kurang dari Pajak Masukan"
|
|
];
|
|
$akumulasi = 0;
|
|
}
|
|
}
|
|
}
|
|
|
|
$data = array(
|
|
'sidebar' => "menu keuangan",
|
|
'navChild' => "keuangan neraca",
|
|
'kode_perkiraan' => $datPerkiraan[0]['KODE_PERKIRAAN'],
|
|
'nama_perkiraan' => $datPerkiraan[0]['NAMA_PERKIRAAN'],
|
|
'id_perkiraan' => $id,
|
|
'id_pak' => $pak,
|
|
'verse' => $verse,
|
|
'data' => $data,
|
|
'akumulasi' => number_format($akumulasi, 2),
|
|
'pm' => number_format($pm, 2),
|
|
'pk' => number_format($pk, 2),
|
|
'timestamp' => $timestamp,
|
|
);
|
|
$this->load->view('proses/KU_Sub4_NeracaBerjalan_2', $data);
|
|
}
|
|
|
|
//SUBMENU PUSAT DATA - PERSEDIAAN BERJALAN
|
|
public function KU_Sub4_PersediaanBerjalan_1() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "KU", "PUSAT DATA - Persediaan Berjalan");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$sn = $this->Amod->getData_Kuantiti_byJENIS_more0(1);
|
|
$no = 0;
|
|
$totalSn = 0;
|
|
foreach ($sn as $key) {
|
|
$datHq = $this->Amod->getData_HistoriKuantiti_byBARANG_orderDESC_limit1($key['ID_KUANTITI']);
|
|
$sisa_hq = $datHq[0]['SISA_HQ'];
|
|
$persediaan_hq = $datHq[0]['PERSEDIAAN_HQ'];
|
|
$totalSn = $totalSn+$persediaan_hq;
|
|
|
|
$tmp = $this->Amod->getCount_SnStock_byBARANG_byKOP_status0_statusMore4($key['ID_KUANTITI'], 1);
|
|
$dmt = $this->Amod->getCount_SnStock_byBARANG_byKOP_status0_statusMore4($key['ID_KUANTITI'], 2);
|
|
$pcm = $this->Amod->getCount_SnStock_byBARANG_byKOP_status0_statusMore4($key['ID_KUANTITI'], 3);
|
|
$sft = $this->Amod->getCount_SnStock_byBARANG_byKOP_status0_statusMore4($key['ID_KUANTITI'], 4);
|
|
$itp = $this->Amod->getCount_SnStock_byBARANG_byKOP_status0_statusMore4($key['ID_KUANTITI'], 5);
|
|
|
|
$sn[$no] += ['TMP' => $tmp];
|
|
$sn[$no] += ['DMT' => $dmt];
|
|
$sn[$no] += ['PCM' => $pcm];
|
|
$sn[$no] += ['SFT' => $sft];
|
|
$sn[$no] += ['ITP' => $itp];
|
|
$sn[$no] += ['SISA_HQ' => $sisa_hq];
|
|
$sn[$no++] += ['PERSEDIAAN_HQ' => number_format($persediaan_hq,2)];
|
|
}
|
|
|
|
$nonSn = $this->Amod->getData_Kuantiti_byJENIS_more0(0);
|
|
$no = 0;
|
|
$totalNonSn = 0;
|
|
foreach ($nonSn as $key) {
|
|
$datHq = $this->Amod->getData_HistoriKuantiti_byBARANG_orderDESC_limit1($key['ID_KUANTITI']);
|
|
$sisa_hq = $datHq[0]['SISA_HQ'];
|
|
$persediaan_hq = $datHq[0]['PERSEDIAAN_HQ'];
|
|
$totalNonSn = $totalNonSn+$persediaan_hq;
|
|
|
|
$nonSn[$no] += ['SISA_HQ' => $sisa_hq];
|
|
$nonSn[$no++] += ['PERSEDIAAN_HQ' => number_format($persediaan_hq,2)];
|
|
}
|
|
|
|
$data = array(
|
|
'sidebar' => "menu keuangan",
|
|
'navChild' => "keuangan persediaan",
|
|
'timestamp' => $timestamp,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil,
|
|
'sn' => $sn,
|
|
'nonSn' => $nonSn,
|
|
'totalSn' => number_format($totalSn,2),
|
|
'totalNonSn' => number_format($totalNonSn,2),
|
|
'totalSemua' => number_format(($totalSn+$totalNonSn),2),
|
|
);
|
|
$this->load->view('proses/KU_Sub4_PersediaanBerjalan_1', $data);
|
|
}
|
|
|
|
// Daftar Menu PR [Proyek]
|
|
//SUBMENU TRANSAKSI - SALES PROYEK
|
|
public function PR_Sub1_SalesProyek_1() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$now = date('Y-m-d');
|
|
$limit = date('Y-m-01');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "PR", "TRANSAKSI - Sales Proyek");
|
|
$id_menu = $datShm[0]['MENU_ID'];
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
if ($hak>0) {
|
|
if ($hak>=3) {
|
|
$proyekBerjalan = $this->Amod->getData_Proyek_bySTATUS(0);
|
|
$proyekBatal = $this->Amod->getData_Proyek_batalThisMonth($limit);
|
|
$proyekSewa = $this->Amod->getData_Proyek_bySTATUS_rpNull_jenis3(1);
|
|
$proyekProses = $this->Amod->getData_Proyek_bySTATUS_rpNull_jenisLess2(1);
|
|
$proyekLaporan = $this->Amod->getData_RekapProyek_bySTATUS(1);
|
|
$proyekTarik = $this->Amod->getData_Proyek_bySTATUS_rpNotNull_beforeLimit(1, $limit);
|
|
} else {
|
|
$proyekBerjalan = $this->Amod->getData_Proyek_bySALES_bySTATUS($id_karyawan, 0);
|
|
$proyekBatal = $this->Amod->getData_Proyek_bySALES_batalThisMonth($id_karyawan, $limit);
|
|
$proyekSewa = $this->Amod->getData_Proyek_bySALES_bySTATUS_rpNull_jenis3($id_karyawan, 1);
|
|
$proyekProses = $this->Amod->getData_Proyek_bySALES_bySTATUS_rpNull_jenisLess2($id_karyawan, 1);
|
|
$proyekLaporan = $this->Amod->getData_RekapProyek_bySALES_bySTATUS($id_karyawan, 1);
|
|
$proyekTarik = $this->Amod->getData_Proyek_bySALES_bySTATUS_rpNotNull_beforeLimit($id_karyawan, 1, $limit);
|
|
}
|
|
|
|
$noBatal = 0;
|
|
foreach ($proyekBatal as $key) {
|
|
$penggantiProyek = $this->Amod->getData_Proyek_byID($key['PENGGANTI_PROYEK']);
|
|
|
|
$proyekBatal[$noBatal] += ['PENGGANTIKODE' => $penggantiProyek[0]['KODE_PROYEK']];
|
|
$proyekBatal[$noBatal] += ['PENGGANTITANGGAL' => $penggantiProyek[0]['TANGGAL']];
|
|
$proyekBatal[$noBatal] += ['PENGGANTINILAI' => $penggantiProyek[0]['NILAI']];
|
|
$proyekBatal[$noBatal] += ['PENGGANTISALES' => $penggantiProyek[0]['NAMA_PANGGILAN_KARYAWAN']];
|
|
$proyekBatal[$noBatal] += ['PENGGANTIPELANGGAN' => $penggantiProyek[0]['NAMA_PELANGGAN']];
|
|
$proyekBatal[$noBatal++] += ['PENGGANTIPO' => $penggantiProyek[0]['PO_PROYEK']];
|
|
}
|
|
|
|
foreach ($proyekProses as $key) {
|
|
if (strtotime($key['TGL_PROSES'])<strtotime($limit)) {
|
|
$datPp = $this->Amod->getData_PeriodeProyek_byJENIS_byPERIODE($key['JENIS_PROYEK'], $key['TGL_PROYEK']);
|
|
$datRp = $this->Amod->getData_RekapProyek_bySALES_byPP($key['SALES_ID'], $datPp[0]['ID_PP']);
|
|
if ($datRp==FALSE) {
|
|
$input = [
|
|
'PP_ID' => $datPp[0]['ID_PP'],
|
|
'SAL_ID' => $key['SALES_ID'],
|
|
'STATUS_RP' => '1'
|
|
];
|
|
$action = $this->Amod->create('rekap_proyek', $input);
|
|
|
|
$id_rp = $this->Amod->getMax_ID_RekapProyek();
|
|
$id_rp = $id_rp[0]['ID_RP'];
|
|
} else {
|
|
$id_rp = $datRp[0]['ID_RP'];
|
|
if ($datRp[0]['STATUS_RP']==0) {
|
|
$update = [
|
|
'STATUS_RP' => '1'
|
|
];
|
|
$action = $this->Amod->update('rekap_proyek', $update, 'ID_RP', $id_rp);
|
|
}
|
|
}
|
|
|
|
$sumSpr = $this->Amod->getSum_SoProyek_byPROYEK($key['ID_PROYEK']);
|
|
if ($sumSpr==FALSE OR $sumSpr[0]['NILAI']==NULL) {
|
|
$soTerbit = 0;
|
|
} else {
|
|
$soTerbit = $sumSpr[0]['NILAI'];
|
|
}
|
|
|
|
$sumFee = $this->Amod->getSum_SoProyek_byPROYEK_forFEE($key['ID_PROYEK']);
|
|
if ($sumFee==FALSE OR $sumFee[0]['FEE']==NULL) {
|
|
$biayaFee = 0;
|
|
} else {
|
|
$biayaFee = $sumFee[0]['FEE'];
|
|
}
|
|
|
|
$sumBpry = $this->Amod->getSum_BiayaProyek_byPROYEK($key['ID_PROYEK']);
|
|
if ($sumBpry==FALSE OR $sumBpry[0]['TOTAL']==NULL) {
|
|
$biayaProyek = 0;
|
|
} else {
|
|
$biayaProyek = $sumBpry[0]['TOTAL'];
|
|
}
|
|
|
|
$biayaBarangSo = 0;
|
|
$datSpr = $this->Amod->getData_SoProyek_byPROYEK($key['ID_PROYEK']);
|
|
foreach ($datSpr as $dat) {
|
|
$datHqProyek = $this->Amod->getData_HistoriKuantiti_byKODE($dat['KODE_PENJUALAN']);
|
|
foreach ($datHqProyek as $dar) {
|
|
if ($dar['MASUK_HQ']>0) {
|
|
$biayaBarangSo = $biayaBarangSo-round(($dar['MASUK_HQ']*$dar['AVG_HQ']),2);
|
|
} else if ($dar['KELUAR_HQ']>0) {
|
|
$biayaBarangSo = $biayaBarangSo+round(($dar['KELUAR_HQ']*$dar['AVG_HQ']),2);
|
|
}
|
|
}
|
|
}
|
|
|
|
$biayaBarangProyek = 0;
|
|
$datHqProyek = $this->Amod->getData_HistoriKuantiti_byKODE($key['KODE_PROYEK']);
|
|
foreach ($datHqProyek as $dat) {
|
|
if ($dat['MASUK_HQ']>0) {
|
|
$biayaBarangProyek = $biayaBarangProyek-round(($dat['MASUK_HQ']*$dat['AVG_HQ']),2);
|
|
} else if ($dat['KELUAR_HQ']>0) {
|
|
$biayaBarangProyek = $biayaBarangProyek+round(($dat['KELUAR_HQ']*$dat['AVG_HQ']),2);
|
|
}
|
|
}
|
|
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byPROYEK_byPERKIRAAN($key['ID_PROYEK'], 70);
|
|
if ($sumDak==FALSE OR $sumDak[0]['DEBET']==NULL) {
|
|
$biayaKasbank = 0;
|
|
} else {
|
|
$biayaKasbank = $sumDak[0]['DEBET']-$sumDak[0]['KREDIT'];
|
|
}
|
|
|
|
$biaya_proyek = $biayaFee+$biayaBarangSo+$biayaBarangProyek+$biayaProyek+$biayaKasbank;
|
|
$gp_proyek = $soTerbit-$biaya_proyek;
|
|
|
|
$update = [
|
|
'RP_ID' => $id_rp,
|
|
'BIAYA_PROYEK' => $biaya_proyek,
|
|
'GP_PROYEK' => $gp_proyek
|
|
];
|
|
$action = $this->Amod->update('proyek', $update, 'ID_PROYEK', $key['ID_PROYEK']);
|
|
}
|
|
}
|
|
|
|
$noLaporan = 0;
|
|
foreach ($proyekLaporan as $kay) {
|
|
if ($kay['GRUP_ID']==NULL) {
|
|
$awalPeriode = "";
|
|
$akhirPeriode = "";
|
|
} else {
|
|
$awalPeriode = $this->Amod->generate_addMonth($kay['AWAL_PP'],(($kay['GRUP_ID']-1)*3));
|
|
$akhirPeriode = $this->Amod->generate_addMonth($kay['AWAL_PP'],($kay['GRUP_ID']*3));
|
|
$akhirPeriode = $this->Amod->generate_subDay($akhirPeriode, 1);
|
|
}
|
|
|
|
$dppSo = 0;
|
|
$biayaProyek = 0;
|
|
$gpProyek = 0;
|
|
if ($kay['JENIS_PP']<=2) {
|
|
$countProyekLapor = $this->Amod->getCount_Proyek_byRP_orderPELANGGAN($kay['ID_RP']);
|
|
$countProyekAll = $this->Amod->getCount_Proyek_bySALES_byPERIODE_statusUntil1($kay['SAL_ID'], $kay['AWAL_PP'], $kay['AKHIR_PP']);
|
|
|
|
$sumSpr = $this->Amod->getSum_SoProyek_byRP($kay['ID_RP']);
|
|
if ($sumSpr==TRUE AND $sumSpr[0]['TOTAL']!=NULL) {
|
|
$dppSo = $sumSpr[0]['TOTAL'];
|
|
}
|
|
|
|
$sumProyek = $this->Amod->getSum_Proyek_byRP($kay['ID_RP']);
|
|
if ($sumProyek==TRUE AND $sumProyek[0]['BIAYA']!=NULL) {
|
|
$biayaProyek = $sumProyek[0]['BIAYA'];
|
|
$gpProyek = $sumProyek[0]['GP'];
|
|
}
|
|
} else if ($kay['JENIS_PP']==3) {
|
|
$countProyekLapor = 0;
|
|
$countProyekAll = 0;
|
|
$biayaProyek = $kay['BIAYA_RP'];
|
|
$gpProyek = $kay['GP_RP'];
|
|
$dppSo = $biayaProyek+$gpProyek;
|
|
}
|
|
|
|
$proyekLaporan[$noLaporan] += ['AWALPP'=> date_format(date_create($awalPeriode), "d/m/Y")];
|
|
$proyekLaporan[$noLaporan] += ['AKHIRPP'=> date_format(date_create($akhirPeriode), "d/m/Y")];
|
|
$proyekLaporan[$noLaporan] += ['COUNTLAP'=> $countProyekLapor];
|
|
$proyekLaporan[$noLaporan] += ['COUNTALL'=> $countProyekAll];
|
|
$proyekLaporan[$noLaporan] += ['NOTA'=> number_format($dppSo,2)];
|
|
$proyekLaporan[$noLaporan] += ['BIAYA'=> number_format($biayaProyek,2)];
|
|
$proyekLaporan[$noLaporan++] += ['GP'=> number_format($gpProyek,2)];
|
|
}
|
|
|
|
$countBerjalan = count($proyekBerjalan);
|
|
$countBatal = count($proyekBatal);
|
|
$countSewa = count($proyekSewa);
|
|
$countProses = count($proyekProses);
|
|
$countLaporan = count($proyekLaporan);
|
|
} else {
|
|
$proyekBerjalan = NULL;
|
|
$proyekBatal = NULL;
|
|
$proyekSewa = NULL;
|
|
$proyekProses = NULL;
|
|
$proyekLaporan = NULL;
|
|
$proyekTarik = NULL;
|
|
$countBerjalan = 0;
|
|
$countBatal = 0;
|
|
$countSewa = 0;
|
|
$countProses = 0;
|
|
$countLaporan = 0;
|
|
}
|
|
|
|
$datSales = $this->Amod->getData_Karyawan_allSalesProyek();
|
|
$datPelanggan = $this->Amod->getData_Pelanggan_bySTATUS(1);
|
|
|
|
$datStpos = $this->Amod->getData_SetTogglePosisi_byKARYAWAN_byMENU($id_karyawan, $id_menu);
|
|
if ($datStpos==FALSE) { $posisiToggle = 0; } else { $posisiToggle = $datStpos[0]['AKTIF_STPOS']; }
|
|
|
|
$data = array(
|
|
'sidebar' => "menu proyek",
|
|
'navChild' => "proyek salesproyek",
|
|
'sales' => $datSales,
|
|
'pelanggan' => $datPelanggan,
|
|
'proyekBerjalan' => $proyekBerjalan,
|
|
'proyekBatal' => $proyekBatal,
|
|
'proyekSewa' => $proyekSewa,
|
|
'proyekProses' => $proyekProses,
|
|
'proyekLaporan' => $proyekLaporan,
|
|
'proyekTarik' => $proyekTarik,
|
|
'countBerjalan' => $countBerjalan,
|
|
'countBatal' => $countBatal,
|
|
'countSewa' => $countSewa,
|
|
'countProses' => $countProses,
|
|
'countLaporan' => $countLaporan,
|
|
'posisiToggle' => $posisiToggle,
|
|
'id_menu' => $id_menu,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil,
|
|
'tgl' => $now,
|
|
'limit' => $limit,
|
|
);
|
|
$this->load->view('proses/PR_Sub1_SalesProyek_1', $data);
|
|
}
|
|
|
|
public function PR_Ambil_Sub1_DataSoProyek() {
|
|
$id_so = $this->input->post('id_so');
|
|
|
|
$datSo = $this->Amod->getData_SalesOrder_byID($id_so);
|
|
$datSoSpr = $this->Amod->getData_SalerOrder_bySALES_byPELANGGAN_status1_joinSpr_notUsed($datSo[0]['SALES_ID'], $datSo[0]['PELANGGAN_ID']);
|
|
|
|
$this->output_json([
|
|
'data' => $datSoSpr
|
|
]);
|
|
}
|
|
|
|
public function PR_Ambil_Sub1_DataBiayaProyek() {
|
|
$id_proyek = $this->input->post('id_proyek');
|
|
|
|
$datProyek = $this->Amod->getData_Proyek_byID($id_proyek);
|
|
$data = $this->Amod->getData_BiayaProyek_byPROYEK($id_proyek);
|
|
|
|
$this->output_json([
|
|
'kodeProyek' => $datProyek[0]['KODE_PROYEK'],
|
|
'data' => $data,
|
|
'total' => sizeof($data)
|
|
]);
|
|
}
|
|
|
|
public function PR_Tambah_Sub1_A1_DataProyek() {
|
|
$tgl_proyek = $this->input->post('tgl_proyeknew');
|
|
$jenis_proyek = $this->input->post('jenis_proyeknew');
|
|
$id_sales = $this->input->post('id_salesnew');
|
|
$id_pelanggan = $this->input->post('id_pelanggannew');
|
|
$nilai_proyek = $this->input->post('nilai_proyeknew');
|
|
$po_proyek = $this->input->post('po_proyeknew');
|
|
$po_proyek = strtoupper($po_proyek);
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$datProyek = $this->Amod->getData_Proyek_byPO($po_proyek);
|
|
if ($datProyek==TRUE) {
|
|
$this->session->set_flashdata('proyek_same', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$cekNilai = is_numeric($nilai_proyek);
|
|
if ($cekNilai==FALSE) {
|
|
$nilai_proyek = 0;
|
|
}
|
|
|
|
if ($nilai_proyek<0) {
|
|
$this->session->set_flashdata('less_zero', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$datPp = $this->Amod->getData_PeriodeProyek_byJENIS_byPERIODE($jenis_proyek, $tgl_proyek);
|
|
if ($datPp==FALSE) {
|
|
$this->session->set_flashdata('periodeproyek_error', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
if ($id_sales==NULL OR $id_sales=="") {
|
|
$id_sales = $id_karyawan;
|
|
}
|
|
|
|
$datRp = $this->Amod->getData_RekapProyek_bySALES_byPP_bySTATUS($id_sales, $datPp[0]['ID_PP'], 2);
|
|
if ($datRp==TRUE) {
|
|
$this->session->set_flashdata('rekapproyek_finish', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$tempo_proyek = $this->Amod->generate_addDay($tgl_proyek, 90);
|
|
$kode_proyek = $this->Amod->generate_kodeProyek();
|
|
$input = [
|
|
'CIPTA_PROYEK' => "Oleh $panggilan pada $timestamp",
|
|
'KODE_PROYEK' => $kode_proyek,
|
|
'TGL_PROYEK' => $tgl_proyek,
|
|
'JENIS_PROYEK' => $jenis_proyek,
|
|
'SALES_ID' => $id_sales,
|
|
'PELANGGAN_ID' => $id_pelanggan,
|
|
'PO_PROYEK' => $po_proyek,
|
|
'NILAI_PROYEK' => $nilai_proyek,
|
|
'TEMPO_PROYEK' => $tempo_proyek,
|
|
'STATUS_PROYEK' => '0'
|
|
];
|
|
$action = $this->Amod->create('proyek', $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 PR_Ubah_Sub1_A1_DataProyek() {
|
|
$id_proyek = $this->input->post('id_proyeked');
|
|
$id_sales = $this->input->post('id_salesed');
|
|
$id_pelanggan = $this->input->post('id_pelangganed');
|
|
$nilai_proyek = $this->input->post('nilai_proyeked');
|
|
$po_proyek = $this->input->post('po_proyeked');
|
|
$jenis_proyek = $this->input->post('jenis_proyeked');
|
|
$po_proyek = strtoupper($po_proyek);
|
|
|
|
$datProyek = $this->Amod->getData_Proyek_byID_bySTATUS($id_proyek, 0);
|
|
if ($datProyek==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$cekProyek = $this->Amod->getData_Proyek_byPO($po_proyek, $id_proyek);
|
|
if ($cekProyek==TRUE) {
|
|
$this->session->set_flashdata('proyek_same', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
if ($jenis_proyek!=3) {
|
|
$datPp = $this->Amod->getData_PeriodeProyek_byJENIS_byPERIODE($jenis_proyek, $datProyek[0]['TGL_PROYEK']);
|
|
if ($datPp==FALSE) {
|
|
$this->session->set_flashdata('periodeproyek_error', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
}
|
|
|
|
$datRp = $this->Amod->getData_RekapProyek_bySALES_byPP_bySTATUS($id_sales, $datPp[0]['ID_PP'], 2);
|
|
if ($datRp==TRUE) {
|
|
$this->session->set_flashdata('rekapproyek_finish', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$cekNilai = is_numeric($nilai_proyek);
|
|
if ($cekNilai==FALSE) {
|
|
$nilai_proyek = 0;
|
|
}
|
|
|
|
if ($nilai_proyek<0) {
|
|
$this->session->set_flashdata('less_zero', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
if ($id_pelanggan=="") {
|
|
$id_pelanggan = $datProyek[0]['PELANGGAN_ID'];
|
|
}
|
|
|
|
$update = [
|
|
'JENIS_PROYEK' => $jenis_proyek,
|
|
'SALES_ID' => $id_sales,
|
|
'PELANGGAN_ID' => $id_pelanggan,
|
|
'PO_PROYEK' => $po_proyek,
|
|
'NILAI_PROYEK' => $nilai_proyek,
|
|
];
|
|
$action = $this->Amod->update('proyek', $update, 'ID_PROYEK', $id_proyek);
|
|
|
|
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 PR_Hapus_Sub1_A1_DataProyek() {
|
|
$id_proyek = $this->input->post('id_proyekdel');
|
|
|
|
$datProyek = $this->Amod->getData_Proyek_byID_bySTATUS($id_proyek, 0);
|
|
if ($datProyek==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$countDak = $this->Amod->getCount_DaftarAkuntansi_byPROYEK($id_proyek);
|
|
if ($countDak>0) {
|
|
$this->session->set_flashdata('kasbank_used', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$countSpr = $this->Amod->getCount_SoProyek_byPROYEK($id_proyek);
|
|
if ($countSpr>0) {
|
|
$this->session->set_flashdata('spr_used', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$countIo = $this->Amod->getCount_TransaksiStock_byPROYEK($id_proyek);
|
|
if ($countIo>0) {
|
|
$this->session->set_flashdata('io_used', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$countBpry = $this->Amod->getCount_BiayaProyek_byPROYEK($id_proyek);
|
|
if ($countBpry>0) {
|
|
$this->session->set_flashdata('bpry_used', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$countDpr = $this->Amod->getCount_DaftarProyek_byPROYEK($id_proyek);
|
|
if ($countDpr>0) {
|
|
$this->session->set_flashdata('dpr_used', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$action = $this->Amod->delete('proyek', $id_proyek, 'ID_PROYEK');
|
|
|
|
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 PR_Batal_Sub1_A1_DataProyek() {
|
|
$id_proyek = $this->input->post('id_proyekvoid');
|
|
$pengganti_proyek = $this->input->post('id_proyekex');
|
|
$ket_proyek = $this->input->post('ket_proyek');
|
|
$ket_proyek = preg_replace('/\R+/', " " , $ket_proyek);
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$datProyek1 = $this->Amod->getData_Proyek_byID_bySTATUS($id_proyek, 0);
|
|
$datProyek2 = $this->Amod->getData_Proyek_byID_bySTATUS($pengganti_proyek, 0);
|
|
if ($datProyek1==FALSE OR $datProyek2==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
if ($id_proyek==$pengganti_proyek) {
|
|
$this->session->set_flashdata('project_mustdifferent', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$update = [
|
|
'KET_PROYEK' => $ket_proyek,
|
|
'BATAL_PROYEK' => "Oleh $panggilan pada $timestamp",
|
|
'PENGGANTI_PROYEK' => $pengganti_proyek,
|
|
'STATUS_PROYEK' => '9',
|
|
];
|
|
$action = $this->Amod->update('proyek', $update, 'ID_PROYEK', $id_proyek);
|
|
|
|
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 PR_Revisi_Sub1_A1_DataProyekBatal() {
|
|
$id_proyek = $this->input->post('id_proyekrevvoid');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$datProyek = $this->Amod->getData_Proyek_byID_tglBatalNull($id_proyek);
|
|
if ($datProyek==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$update = [
|
|
'KET_PROYEK' => NULL,
|
|
'BATAL_PROYEK' => NULL,
|
|
'PENGGANTI_PROYEK' => NULL,
|
|
'ACC_GUDANG' => NULL,
|
|
'ACC_KEUANGAN' => NULL,
|
|
'ACC_KADIV' => NULL,
|
|
'REVISI_PROYEK' => "Oleh $panggilan pada $timestamp",
|
|
'STATUS_PROYEK' => '0',
|
|
];
|
|
$action = $this->Amod->update('proyek', $update, 'ID_PROYEK', $id_proyek);
|
|
|
|
if ($action) {
|
|
$this->session->set_flashdata('success', 'direvisi');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
} else {
|
|
$this->session->set_flashdata('failed', 'direvisi');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
}
|
|
|
|
public function PR_Lapor_Sub1_A1_DataRekapProyek() {
|
|
$rekap = $this->input->post('rekapTambah');
|
|
|
|
foreach ($rekap as $key) {
|
|
$datProyek = $this->Amod->getData_Proyek_byID_bySTATUS_rpNull($key, 1);
|
|
if ($datProyek==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
}
|
|
|
|
foreach ($rekap as $key) {
|
|
$datProyek = $this->Amod->getData_Proyek_byID($key);
|
|
$datPp = $this->Amod->getData_PeriodeProyek_byJENIS_byPERIODE($datProyek[0]['JENIS_PROYEK'], $datProyek[0]['TGL_PROYEK']);
|
|
$datRp = $this->Amod->getData_RekapProyek_bySALES_byPP($datProyek[0]['SALES_ID'], $datPp[0]['ID_PP']);
|
|
if ($datRp==FALSE) {
|
|
$input = [
|
|
'PP_ID' => $datPp[0]['ID_PP'],
|
|
'SAL_ID' => $datProyek[0]['SALES_ID'],
|
|
'STATUS_RP' => '1'
|
|
];
|
|
$action = $this->Amod->create('rekap_proyek', $input);
|
|
|
|
$id_rp = $this->Amod->getMax_ID_RekapProyek();
|
|
$id_rp = $id_rp[0]['ID_RP'];
|
|
} else {
|
|
$id_rp = $datRp[0]['ID_RP'];
|
|
if ($datRp[0]['STATUS_RP']==0) {
|
|
$update = [
|
|
'STATUS_RP' => '1'
|
|
];
|
|
$action = $this->Amod->update('rekap_proyek', $update, 'ID_RP', $id_rp);
|
|
}
|
|
}
|
|
|
|
$sumSpr = $this->Amod->getSum_SoProyek_byPROYEK($key);
|
|
if ($sumSpr==FALSE OR $sumSpr[0]['NILAI']==NULL) {
|
|
$soTerbit = 0;
|
|
} else {
|
|
$soTerbit = $sumSpr[0]['NILAI'];
|
|
}
|
|
|
|
$sumFee = $this->Amod->getSum_SoProyek_byPROYEK_forFEE($key);
|
|
if ($sumFee==FALSE OR $sumFee[0]['FEE']==NULL) {
|
|
$biayaFee = 0;
|
|
} else {
|
|
$biayaFee = $sumFee[0]['FEE'];
|
|
}
|
|
|
|
$sumBpry = $this->Amod->getSum_BiayaProyek_byPROYEK($key);
|
|
if ($sumBpry==FALSE OR $sumBpry[0]['TOTAL']==NULL) {
|
|
$biayaProyek = 0;
|
|
} else {
|
|
$biayaProyek = $sumBpry[0]['TOTAL'];
|
|
}
|
|
|
|
$biayaBarangSo = 0;
|
|
$datSpr = $this->Amod->getData_SoProyek_byPROYEK($key);
|
|
foreach ($datSpr as $dat) {
|
|
$datHqProyek = $this->Amod->getData_HistoriKuantiti_byKODE($dat['KODE_PENJUALAN']);
|
|
foreach ($datHqProyek as $dar) {
|
|
if ($dar['MASUK_HQ']>0) {
|
|
$biayaBarangSo = $biayaBarangSo-round(($dar['MASUK_HQ']*$dar['AVG_HQ']),2);
|
|
} else if ($dar['KELUAR_HQ']>0) {
|
|
$biayaBarangSo = $biayaBarangSo+round(($dar['KELUAR_HQ']*$dar['AVG_HQ']),2);
|
|
}
|
|
}
|
|
}
|
|
|
|
$biayaBarangProyek = 0;
|
|
$datHqProyek = $this->Amod->getData_HistoriKuantiti_byKODE($key);
|
|
foreach ($datHqProyek as $dat) {
|
|
if ($dat['MASUK_HQ']>0) {
|
|
$biayaBarangProyek = $biayaBarangProyek-round(($dat['MASUK_HQ']*$dat['AVG_HQ']),2);
|
|
} else if ($dat['KELUAR_HQ']>0) {
|
|
$biayaBarangProyek = $biayaBarangProyek+round(($dat['KELUAR_HQ']*$dat['AVG_HQ']),2);
|
|
}
|
|
}
|
|
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byPROYEK_byPERKIRAAN($key, 70);
|
|
if ($sumDak==FALSE OR $sumDak[0]['DEBET']==NULL) {
|
|
$biayaKasbank = 0;
|
|
} else {
|
|
$biayaKasbank = $sumDak[0]['DEBET']-$sumDak[0]['KREDIT'];
|
|
}
|
|
|
|
$biaya_proyek = $biayaFee+$biayaBarangSo+$biayaBarangProyek+$biayaProyek+$biayaKasbank;
|
|
$gp_proyek = $soTerbit-$biaya_proyek;
|
|
|
|
$update = [
|
|
'RP_ID' => $id_rp,
|
|
'BIAYA_PROYEK' => $biaya_proyek,
|
|
'GP_PROYEK' => $gp_proyek
|
|
];
|
|
$action = $this->Amod->update('proyek', $update, 'ID_PROYEK', $key);
|
|
}
|
|
|
|
if ($action) {
|
|
$this->session->set_flashdata('success', 'dilaporkan');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
} else {
|
|
$this->session->set_flashdata('failed', 'dilaporkan');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
}
|
|
|
|
public function PR_Revisi_Sub1_A1_DataProyekProses() {
|
|
$id_proyek = $this->input->post('id_proyekrevpro');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
$limit = date('Y-m-01');
|
|
|
|
$datProyek = $this->Amod->getData_Proyek_byID_bySTATUS_rpNull($id_proyek, 1);
|
|
if ($datProyek==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
if (strtotime($datProyek[0]['TGL_PROSES'])<strtotime($limit)) {
|
|
$this->session->set_flashdata('datalock_month', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$datHsn = $this->Amod->getData_HistoriSn_byKODEBUKTI($datProyek[0]['KODE_PROYEK']);
|
|
foreach ($datHsn as $key) {
|
|
$datSnStock = $this->Amod->getData_SnStock_byID_bySTATUS($key['SNSTOCK_ID'], 3);
|
|
if ($datSnStock==TRUE) {
|
|
$update = [
|
|
'STATUS_SNSTOCK' => '9'
|
|
];
|
|
$action = $this->Amod->update('sn_stock', $update, 'ID_SNSTOCK', $datSnStock[0]['ID_SNSTOCK']);
|
|
}
|
|
}
|
|
|
|
$datIo = $this->Amod->getData_TransaksiStock_byPROYEK($id_proyek);
|
|
foreach ($datIo as $key) {
|
|
$this->GE_Kalkulasi_KuantitiBarang($key['BARANG_ID'], 1, "Step 2 - PROYEK - Revisi Barang", 0, $key['QTY_IO']);
|
|
}
|
|
|
|
$this->GE_Kalkulasi_HistoriKuantiti(0, "Step 2 - PROYEK - Revisi Barang", 0, 0, $datProyek[0]['KODE_PROYEK'], 0, 0);
|
|
|
|
$action = $this->Amod->delete('histori_sn', $datProyek[0]['KODE_PROYEK'], 'KODE_BUKTI');
|
|
$action = $this->Amod->delete('transaksi_stock', $id_proyek, 'PROYEK_ID');
|
|
|
|
$update = [
|
|
'TGL_PROSES' => NULL,
|
|
'PROSES_PROYEK' => NULL,
|
|
'REVISI_PROYEK' => "Oleh $panggilan pada $timestamp",
|
|
'STATUS_PROYEK' => '0',
|
|
];
|
|
$action = $this->Amod->update('proyek', $update, 'ID_PROYEK', $id_proyek);
|
|
|
|
if ($action) {
|
|
$this->session->set_flashdata('success', 'direvisi');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
} else {
|
|
$this->session->set_flashdata('failed', 'direvisi');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
}
|
|
|
|
public function PR_Revisi_Sub1_A1_DataProyekLapor() {
|
|
$rekap = $this->input->post('rekapHapus');
|
|
$limit = date('Y-m-01');
|
|
|
|
foreach ($rekap as $key) {
|
|
$datProyek = $this->Amod->getData_Proyek_byID_bySTATUS_beforeLimit_rpNotNull($key, 1, $limit);
|
|
if ($datProyek==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$datRq = $this->Amod->getData_Proyek_byID_statusRPNot2($key);
|
|
if ($datRq==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
}
|
|
|
|
foreach ($rekap as $key) {
|
|
$datProyek = $this->Amod->getData_Proyek_byID($key);
|
|
$update = [
|
|
'RP_ID' => NULL,
|
|
'BIAYA_PROYEK' => NULL,
|
|
'GP_PROYEK' => NULL,
|
|
];
|
|
$action = $this->Amod->update('proyek', $update, 'ID_PROYEK', $key);
|
|
|
|
$countRp = $this->Amod->getCount_Proyek_byKARYAWAN_byRP($datProyek[0]['SALES_ID'], $datProyek[0]['RP_ID']);
|
|
$datRp = $this->Amod->getData_RekapProyek_byID_bySTATUS($datProyek[0]['RP_ID'], 1);
|
|
if ($datRp==TRUE) {
|
|
if ($countRp==0) {
|
|
$update = [
|
|
'STATUS_RP' => '0'
|
|
];
|
|
$action = $this->Amod->update('rekap_proyek', $update, 'ID_RP', $datProyek[0]['RP_ID']);
|
|
}
|
|
}
|
|
}
|
|
|
|
if ($action) {
|
|
$this->session->set_flashdata('success', 'direvisi');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
} else {
|
|
$this->session->set_flashdata('failed', 'direvisi');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
}
|
|
|
|
public function PR_Excel_Sub1_DataRekapProyek() {
|
|
$id_rp = $this->input->post('id_rpprint');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$datRp = $this->Amod->getData_RekapProyek_byID($id_rp);
|
|
if ($datRp[0]['GRUP_ID']==NULL) {
|
|
$model = 1;
|
|
|
|
$datSpr = $this->Amod->getData_SoProyek_byRP($id_rp);
|
|
$no = 0;
|
|
$totNota = 0;
|
|
$totBiaya = 0;
|
|
$totGp = 0;
|
|
$kode_proyek = NULL;
|
|
|
|
foreach ($datSpr as $key) {
|
|
$datSoProyek = $this->Amod->getData_SoProyek_byPROYEK($key['PROYEK_ID']);
|
|
$datProyek = $this->Amod->getData_Proyek_byID($key['PROYEK_ID']);
|
|
$datHppKasbank = $this->Amod->getData_DaftarAkuntansi_byPROYEK_byPERKIRAAN_bySearch($key['PROYEK_ID'], 70);
|
|
$datBiayaProyek = $this->Amod->getData_BiayaProyek_byPROYEK($key['PROYEK_ID']);
|
|
|
|
$sumBiayaProyek = $this->Amod->getSum_BiayaProyek_byPROYEK($key['PROYEK_ID']);
|
|
if ($sumBiayaProyek[0]['TOTAL']==NULL) {
|
|
$totalBpr = 0;
|
|
} else {
|
|
$totalBpr = $sumBiayaProyek[0]['TOTAL'];
|
|
}
|
|
|
|
$sumBiayaKasbank = $this->Amod->getSum_DaftarAkuntansi_byPROYEK_byPERKIRAAN($key['PROYEK_ID'], 70);
|
|
if ($sumBiayaKasbank[0]['DEBET']==NULL) {
|
|
$totalBkb = 0;
|
|
} else {
|
|
$totalBkb = $sumBiayaKasbank[0]['DEBET'];
|
|
}
|
|
|
|
$nodit = 0;
|
|
$noso = 0;
|
|
$totalHppSo = 0;
|
|
$datHppSo = [];
|
|
foreach ($datSoProyek as $dit) {
|
|
$sumDo = $this->Amod->getSum_DaftarOrder_bySO($dit['SID']);
|
|
$subSo = $sumDo[0]['TOTAL']-$dit['FEE_SO'];
|
|
|
|
$datSoProyek[$nodit] += ['NILAISO' => number_format($sumDo[0]['TOTAL'],2)];
|
|
$datSoProyek[$nodit++] += ['NILAISUB' => number_format($subSo,2)];
|
|
|
|
$datDo = $this->Amod->getData_DaftarOrder_bySO_jenisNot2($dit['SID']);
|
|
$datIo0 = $this->Amod->getData_TransaksiStock_bySO_byJENIS($dit['SID'], 0);
|
|
$datIo1 = $this->Amod->getData_TransaksiStock_bySO_byJENIS($dit['SID'], 1);
|
|
|
|
foreach ($datDo as $dot) {
|
|
$datHq1 = $this->Amod->getData_HistoriKuantiti_byBARANG_byKODEBUKTI_byTGL($dot['BARANG_ID'], $dit['KODE_PENJUALAN'], $dot['TGL_PENJUALAN']);
|
|
$subBarang1 = round(($datHq1[0]['AVG_HQ']*$datHq1[0]['KELUAR_HQ']),2);
|
|
$totalHppSo = $totalHppSo+$subBarang1;
|
|
$datHppSo[$noso++] = [
|
|
'BARANG_ID' => $dot['BARANG_ID'],
|
|
'KODE' => $dot['KODE_BARANG'],
|
|
'JENIS' => "Keluar",
|
|
'QTY' => $dot['QTY_DO'],
|
|
'TGL' => $dot['TGL_PENJUALAN'],
|
|
'HARGA' => number_format($datHq1[0]['AVG_HQ'],2),
|
|
'TOTAVG' => number_format($subBarang1,2),
|
|
];
|
|
}
|
|
|
|
foreach ($datIo0 as $dot) {
|
|
if (strtotime($dit['TGL_PENJUALAN'])>=strtotime($dot['TGL_IO'])) {
|
|
$datHq2 = $this->Amod->getData_HistoriKuantiti_byBARANG_byKODEBUKTI_byTGL($dot['BARANG_ID'], $dit['KODE_PENJUALAN'], $dit['TGL_PENJUALAN']);
|
|
} else {
|
|
$datHq2 = $this->Amod->getData_HistoriKuantiti_byBARANG_byKODEBUKTI_byTGL($dot['BARANG_ID'], $dit['KODE_PENJUALAN'], $dot['TGL_IO']);
|
|
}
|
|
$subBarang2 = round(($datHq2[0]['AVG_HQ']*$datHq2[0]['KELUAR_HQ']),2);
|
|
$totalHppSo = $totalHppSo+$subBarang2;
|
|
$datHppSo[$noso++] = [
|
|
'BARANG_ID' => $dot['BARANG_ID'],
|
|
'KODE' => $dot['KODE_BARANG'],
|
|
'JENIS' => "Keluar",
|
|
'QTY' => $dot['QTY_IO'],
|
|
'TGL' => $dot['TGL_IO'],
|
|
'HARGA' => number_format($datHq2[0]['AVG_HQ'],2),
|
|
'TOTAVG' => number_format($subBarang2,2),
|
|
];
|
|
}
|
|
|
|
foreach ($datIo1 as $dot) {
|
|
if (strtotime($dit['TGL_PENJUALAN'])>=strtotime($dot['TGL_IO'])) {
|
|
$datHq3 = $this->Amod->getData_HistoriKuantiti_byBARANG_byKODEBUKTI_byTGL($dot['BARANG_ID'], $dit['KODE_PENJUALAN'], $dit['TGL_PENJUALAN']);
|
|
} else {
|
|
$datHq3 = $this->Amod->getData_HistoriKuantiti_byBARANG_byKODEBUKTI_byTGL($dot['BARANG_ID'], $dit['KODE_PENJUALAN'], $dot['TGL_IO']);
|
|
}
|
|
$subBarang3 = round(($datHq3[0]['AVG_HQ']*$datHq3[0]['MASUK_HQ']),2);
|
|
$totalHppSo = $totalHppSo-$subBarang3;
|
|
$datHppSo[$noso++] = [
|
|
'BARANG_ID' => $dot['BARANG_ID'],
|
|
'KODE' => $dot['KODE_BARANG'],
|
|
'JENIS' => "Masuk",
|
|
'QTY' => $dot['QTY_IO'],
|
|
'TGL' => $dot['TGL_IO'],
|
|
'HARGA' => number_format($datHq3[0]['AVG_HQ'],2),
|
|
'TOTAVG' => number_format($subBarang3,2),
|
|
];
|
|
}
|
|
}
|
|
|
|
$datHqProyek = $this->Amod->getData_HistoriKuantiti_byKODE($key['KODE_PROYEK']);
|
|
$totalDpr = 0;
|
|
$nodut = 0;
|
|
foreach ($datHqProyek as $dut) {
|
|
$subtotpro = round(($dut['AVG_HQ']*$dut['KELUAR_HQ']),2);
|
|
$totalDpr = $totalDpr + $subtotpro;
|
|
|
|
$datHqProyek[$nodut++] += ['SUBTOTPRO'=>number_format($subtotpro,2)];
|
|
}
|
|
|
|
$sumSo = $this->Amod->getSum_SoProyek_bySO($key['SOID']);
|
|
$dppNota = $sumSo[0]['NILAI'];
|
|
|
|
$sumSoProyek = $this->Amod->getSum_SoProyek_byPROYEK($key['PROYEK_ID']);
|
|
$sumSprFee = $this->Amod->getSum_SoProyek_byPROYEK_forFEE($key['PROYEK_ID']);
|
|
$soTotal = $sumSoProyek[0]['NILAI'];
|
|
$feeTotal = $sumSprFee[0]['FEE'];
|
|
|
|
$hppAkhir = $feeTotal+$totalHppSo+$totalDpr+$totalBpr+$totalBkb;
|
|
$gp = $soTotal-$hppAkhir;
|
|
|
|
if ($hppAkhir<=0) {
|
|
$percent = "~";
|
|
} else {
|
|
$percent = number_format(round((($gp/$hppAkhir)*100),2),2);
|
|
$percent = "$percent%";
|
|
}
|
|
|
|
$datSpr[$no] += ['NIPRO'=>$datSoProyek];
|
|
$datSpr[$no] += ['BASO'=>$datHppSo];
|
|
$datSpr[$no] += ['BAPRO'=>$datHqProyek];
|
|
$datSpr[$no] += ['BIPRO'=>$datHppKasbank];
|
|
$datSpr[$no] += ['BILAIN'=>$datBiayaProyek];
|
|
$datSpr[$no] += ['NILAIPREDI'=>number_format($datProyek[0]['NILAI_PROYEK'],2)];
|
|
$datSpr[$no] += ['NILAISOTOT'=>number_format($soTotal,2)];
|
|
$datSpr[$no] += ['BARANGSO'=>number_format($totalHppSo,2)];
|
|
$datSpr[$no] += ['BARANGPR'=>number_format($totalDpr,2)];
|
|
$datSpr[$no] += ['BIAYAFEE'=>number_format($feeTotal,2)];
|
|
$datSpr[$no] += ['BIAYAPR'=>number_format($totalBkb,2)];
|
|
$datSpr[$no] += ['BIAYALAIN'=>number_format($totalBpr,2)];
|
|
$datSpr[$no] += ['NOTA'=>number_format($dppNota,2)];
|
|
$datSpr[$no] += ['HPP'=>number_format($hppAkhir,2)];
|
|
$datSpr[$no] += ['GP'=>number_format($gp,2)];
|
|
$datSpr[$no++] += ['PERCENT'=>$percent];
|
|
|
|
if ($kode_proyek!=$key['KODE_PROYEK']) {
|
|
$kode_proyek = $key['KODE_PROYEK'];
|
|
$totBiaya = $totBiaya+$hppAkhir;
|
|
$totGp = $totGp+$gp;
|
|
}
|
|
|
|
$totNota = $totNota+$dppNota;
|
|
}
|
|
|
|
$data = [
|
|
'laporan' => $datSpr,
|
|
'sales' => $datRp[0]['NAMA_PANGGILAN_KARYAWAN'],
|
|
'nama_kuartal' => $datRp[0]['NAMA_PP'],
|
|
'awal' => $datRp[0]['AWAL'],
|
|
'akhir' => $datRp[0]['AKHIR'],
|
|
'totNota' => number_format($totNota,2),
|
|
'totBiaya' => number_format($totBiaya,2),
|
|
'totGp' => number_format($totGp,2),
|
|
'ts' => $timestamp,
|
|
'model' => $model,
|
|
];
|
|
} else {
|
|
$datProyek = $this->Amod->getData_Proyek_bySALES_bySEWA($datRp[0]['SAL_ID'], $datRp[0]['PP_ID']);
|
|
$datSpr = $this->Amod->getData_SoProyek_byRP_jenis3($id_rp);
|
|
$biayaKasbank = $this->Amod->getData_DaftarAkuntansi_byPROYEK_byRP($datProyek[0]['ID_PROYEK'], $id_rp);
|
|
$biayaLain = $this->Amod->getData_BiayaProyek_byPROYEK_byRP_jenis3($datProyek[0]['ID_PROYEK'], $id_rp);
|
|
|
|
$grupAktif = $datRp[0]['GRUP_ID'];
|
|
$barangSo = [];
|
|
$noBarang = 0;
|
|
$totSoTerbit = 0;
|
|
$totBarangSoAwal = 0;
|
|
$totBiayaFeeAwal = 0;
|
|
$totBarangProyekAwal = 0;
|
|
$totBiayaKasbankAwal = 0;
|
|
$totBiayaLainAwal = 0;
|
|
$totBarangSoAkhir = 0;
|
|
$totBiayaFeeAkhir = 0;
|
|
$totBarangProyekAkhir = 0;
|
|
$totBiayaKasbankAkhir = 0;
|
|
$totBiayaLainAkhir = 0;
|
|
|
|
if ($grupAktif==1) {
|
|
$verse = 1;
|
|
$barangProyek = $this->Amod->getData_HistoriKuantiti_byKODE_byTGL($datProyek[0]['KODE_PROYEK'], $datProyek[0]['TGL_PROSES']);
|
|
} else {
|
|
$verse = 2;
|
|
$grupBefore = $grupAktif-1;
|
|
$datRpBefore = $this->Amod->getData_RekapProyek_bySALES_byPP_byGRUP($datRp[0]['SAL_ID'], $datRp[0]['PP_ID'], $grupBefore);
|
|
$barangProyek = $this->Amod->getData_HistoriKuantiti_byKODE_afterTGL($datProyek[0]['KODE_PROYEK'], $datRpBefore[0]['SEWA_RP']);
|
|
}
|
|
|
|
$awalPeriode = $this->Amod->generate_addMonth($datRp[0]['AWAL_PP'],(($grupAktif-1)*3));
|
|
$akhirPeriode = $this->Amod->generate_addMonth($datRp[0]['AWAL_PP'],(($grupAktif)*3));
|
|
$akhirPeriode = $this->Amod->generate_subDay($akhirPeriode,1);
|
|
|
|
foreach ($datSpr as $key) {
|
|
$datHq = $this->Amod->getData_HistoriKuantiti_byKODE($key['KODE_PENJUALAN']);
|
|
foreach ($datHq as $dat) {
|
|
if ($dat['MASUK_HQ']>0) {
|
|
$jenis = "Masuk";
|
|
$qty = $dat['MASUK_HQ'];
|
|
$subtotal = $dat['MASUK_HQ']*$dat['AVG_HQ'];
|
|
if ($verse==1) {
|
|
$totBarangSoAwal = $totBarangSoAwal-$subtotal;
|
|
} else if ($verse==2) {
|
|
$totBarangSoAkhir = $totBarangSoAkhir-$subtotal;
|
|
}
|
|
} else if ($dat['KELUAR_HQ']>0) {
|
|
$jenis = "Keluar";
|
|
$qty = $dat['KELUAR_HQ'];
|
|
$subtotal = $dat['KELUAR_HQ']*$dat['AVG_HQ'];
|
|
if ($verse==1) {
|
|
$totBarangSoAwal = $totBarangSoAwal+$subtotal;
|
|
} else if ($verse==2) {
|
|
$totBarangSoAkhir = $totBarangSoAkhir+$subtotal;
|
|
}
|
|
}
|
|
|
|
$barangSo[$noBarang++] = [
|
|
'JENIS' => $jenis,
|
|
'BARANG' => $dat['KODE_BARANG'],
|
|
'QTY' => $qty,
|
|
'DPP' => number_format($dat['AVG_HQ'],2),
|
|
'SUBTOTAL' => number_format($subtotal,2)
|
|
];
|
|
}
|
|
|
|
if ($verse==1) {
|
|
$totBiayaFeeAwal = $totBiayaFeeAwal+$key['FEE_SO'];
|
|
} else if ($verse==2) {
|
|
$totBiayaFeeAkhir = $totBiayaFeeAkhir+$key['FEE_SO'];
|
|
}
|
|
$totSoTerbit = $totSoTerbit+$key['NILAI_SO'];
|
|
}
|
|
|
|
foreach ($barangProyek as $key) {
|
|
if ($verse==1) {
|
|
$totBarangProyekAwal = $totBarangProyekAwal+round(($key['AVG_HQ']*$key['KELUAR_HQ']),2);
|
|
} else if ($verse==2) {
|
|
$totBarangProyekAkhir = $totBarangProyekAkhir+round(($key['AVG_HQ']*$key['KELUAR_HQ']),2);
|
|
}
|
|
}
|
|
|
|
foreach ($biayaKasbank as $key) {
|
|
if ($verse==1) {
|
|
$totBiayaKasbankAwal = $totBiayaKasbankAwal+$key['DEBET_DAK']-$key['KREDIT_DAK'];
|
|
} else if ($verse==2) {
|
|
$totBiayaKasbankAkhir = $totBiayaKasbankAkhir+$key['DEBET_DAK']-$key['KREDIT_DAK'];
|
|
}
|
|
}
|
|
|
|
foreach ($biayaLain as $key) {
|
|
if ($verse==1) {
|
|
$totBiayaLainAwal = $totBiayaLainAwal+$key['NILAI_BPRY'];
|
|
} else if ($verse==2) {
|
|
$totBiayaLainAkhir = $totBiayaLainAkhir+$key['NILAI_BPRY'];
|
|
}
|
|
}
|
|
|
|
if ($verse==2) {
|
|
$datSprLama = $this->Amod->getData_SoProyek_byPROYEK_beforeRP($datProyek[0]['ID_PROYEK'], $id_rp);
|
|
foreach ($datSprLama as $key) {
|
|
$datHq = $this->Amod->getData_HistoriKuantiti_byKODE($key['KODE_PENJUALAN']);
|
|
foreach ($datHq as $dat) {
|
|
if ($dat['MASUK_HQ']>0) {
|
|
$jenis = "Masuk";
|
|
$qty = $dat['MASUK_HQ'];
|
|
$subtotal = $dat['MASUK_HQ']*$dat['AVG_HQ'];
|
|
$totBarangSoAwal = $totBarangSoAwal-$subtotal;
|
|
} else if ($dat['KELUAR_HQ']>0) {
|
|
$jenis = "Keluar";
|
|
$qty = $dat['KELUAR_HQ'];
|
|
$subtotal = $dat['KELUAR_HQ']*$dat['AVG_HQ'];
|
|
$totBarangSoAwal = $totBarangSoAwal+$subtotal;
|
|
}
|
|
}
|
|
$totBiayaFeeAwal = $totBiayaFeeAwal+$key['FEE_SO'];
|
|
}
|
|
|
|
$barangProyekLama = $this->Amod->getData_HistoriKuantiti_byKODE_beforesameTGL($datProyek[0]['KODE_PROYEK'], $datRpBefore[0]['SEWA_RP']);
|
|
foreach ($barangProyekLama as $key) {
|
|
$totBarangProyekAwal = $totBarangProyekAwal+round(($key['AVG_HQ']*$key['KELUAR_HQ']),2);
|
|
}
|
|
|
|
$biayaKasbankLama = $this->Amod->getData_DaftarAkuntansi_byPROYEK_beforeRP($datProyek[0]['ID_PROYEK'], $id_rp);
|
|
foreach ($biayaKasbankLama as $key) {
|
|
$totBiayaKasbankAwal = $totBiayaKasbankAwal+$key['DEBET_DAK']-$key['KREDIT_DAK'];
|
|
}
|
|
|
|
$biayaLainLama = $this->Amod->getData_BiayaProyek_byPROYEK_beforeRP($datProyek[0]['ID_PROYEK'], $id_rp);
|
|
foreach ($biayaLainLama as $key) {
|
|
$totBiayaLainAwal = $totBiayaLainAwal+$key['NILAI_BPRY'];
|
|
}
|
|
}
|
|
|
|
$totBiayaAwal = $totBarangSoAwal+$totBarangProyekAwal+$totBiayaFeeAwal+$totBiayaKasbankAwal+$totBiayaLainAwal;
|
|
$totBiayaAkhir = $totBarangSoAkhir+$totBarangProyekAkhir+$totBiayaFeeAkhir+$totBiayaKasbankAkhir+$totBiayaLainAkhir;
|
|
$totBiayaKeseluruhan = $totBiayaAwal+$totBiayaAkhir;
|
|
$totGp = $datProyek[0]['NILAI_PROYEK']-$totBiayaAwal-$totBiayaAkhir;
|
|
|
|
if ($totBiayaKeseluruhan<=0) {
|
|
$preGp = "~";
|
|
} else {
|
|
$preGp = number_format(round(($totGp/$totBiayaKeseluruhan*100),2),2);
|
|
$preGp = "$preGp%";
|
|
}
|
|
|
|
$data = [
|
|
'po_proyek' => $datProyek[0]['PO_PROYEK'],
|
|
'nama_pelanggan' => $datProyek[0]['NAMA_PELANGGAN'],
|
|
'sales' => $datRp[0]['NAMA_PANGGILAN_KARYAWAN'],
|
|
'awal' => date_format(date_create($awalPeriode), "d/m/Y"),
|
|
'akhir' => date_format(date_create($akhirPeriode), "d/m/Y"),
|
|
'nama_kuartal' => $datRp[0]['NAMA_PP'],
|
|
'grup' => $grupAktif,
|
|
'nama_grup' => "GP - Grup $grupAktif",
|
|
'nilaiProyek' => number_format($datProyek[0]['NILAI_PROYEK'],2),
|
|
'totSoTerbit' => number_format($totSoTerbit,2),
|
|
'totBarangSoAwal' => number_format($totBarangSoAwal,2),
|
|
'totBarangProyekAwal' => number_format($totBarangProyekAwal,2),
|
|
'totBiayaFeeAwal' => number_format($totBiayaFeeAwal,2),
|
|
'totBiayaKasbankAwal' => number_format($totBiayaKasbankAwal,2),
|
|
'totBiayaLainAwal' => number_format($totBiayaLainAwal,2),
|
|
'totBiayaAwal' => number_format($totBiayaAwal,2),
|
|
'totBarangSoAkhir' => number_format($totBarangSoAkhir,2),
|
|
'totBarangProyekAkhir' => number_format($totBarangProyekAkhir,2),
|
|
'totBiayaFeeAkhir' => number_format($totBiayaFeeAkhir,2),
|
|
'totBiayaKasbankAkhir' => number_format($totBiayaKasbankAkhir,2),
|
|
'totBiayaLainAkhir' => number_format($totBiayaLainAkhir,2),
|
|
'totBiayaAkhir' => number_format($totBiayaAkhir,2),
|
|
'totGp' => number_format($totGp,2),
|
|
'spr' => $datSpr,
|
|
'barangSo' => $barangSo,
|
|
'barangProyek' => $barangProyek,
|
|
'biayaKasbank' => $biayaKasbank,
|
|
'biayaLain' => $biayaLain,
|
|
'preGp' => $preGp,
|
|
'ts' => $timestamp,
|
|
'model' => '2',
|
|
];
|
|
|
|
}
|
|
$this->load->view('cetak/PR_Excel_Sub1_DataRekapProyek', $data);
|
|
}
|
|
|
|
public function PR_Sub1_SalesProyek_2($id, $verse) {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$jabatan = $this->session->userdata('jabatan');
|
|
$now = date('Y-m-d');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "PR", "TRANSAKSI - Sales Proyek");
|
|
if ($datShm==TRUE) {
|
|
$id_menu = $datShm[0]['MENU_ID'];
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
} else {
|
|
if (strpos($jabatan,"KEUANGAN")!==FALSE) {
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "PR", "TRANSAKSI - Administrasi");
|
|
$id_menu = $datShm[0]['MENU_ID'];
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
} else {
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "PR", "TRANSAKSI - Pengawasan");
|
|
$id_menu = $datShm[0]['MENU_ID'];
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
}
|
|
}
|
|
|
|
$datStgel = $this->Amod->getData_SetSubToggle_byKARYAWAN_byMENU($id_karyawan, $id_menu);
|
|
if ($datStgel==FALSE) { $posisiToggle = 0; } else { $posisiToggle = $datStgel[0]['AKTIF_STGEL']; }
|
|
|
|
$datProyek = $this->Amod->getData_Proyek_byID($id);
|
|
$datSpr = $this->Amod->getData_SoProyek_byPROYEK($id);
|
|
$datDpr = $this->Amod->getSum_DaftarProyek_byPROYEK_groupBARANG_CDNotNull($id);
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byPROYEK($id);
|
|
$datBpry = $this->Amod->getData_BiayaProyek_byPROYEK($id);
|
|
$datSoGp = $this->Amod->getData_SalesOrder_byPELANGGAN_bySALES_status1_forProyek($datProyek[0]['PELANGGAN_ID'], $datProyek[0]['SALES_ID']);
|
|
$noso = 0;
|
|
$nodo = 0;
|
|
$nodpr = 0;
|
|
$totSo = 0;
|
|
$totFee = 0;
|
|
$totDo = 0;
|
|
$totDpr = 0;
|
|
$barDo = [];
|
|
foreach ($datSpr as $key) {
|
|
$sumDo = $this->Amod->getSum_DaftarOrder_bySO($key['SID']);
|
|
if ($sumDo==FALSE OR $sumDo[0]['TOTAL']==NULL) {
|
|
$dpp = 0;
|
|
} else {
|
|
$dpp = $sumDo[0]['TOTAL'];
|
|
}
|
|
$sisa = $dpp-$key['FEE_SO'];
|
|
|
|
$totSo = $totSo+$dpp;
|
|
$totFee = $totFee+$key['FEE_SO'];
|
|
|
|
$datDo = $this->Amod->getData_DaftarOrder_bySO($key['SID']);
|
|
foreach ($datDo as $dat) {
|
|
if ($dat['TYPE_JENIS']!=2) {
|
|
$datHq = $this->Amod->getData_HistoriKuantiti_byBARANG_beforeTGL_orderDESC_limit1($dat['BARANG_ID'], $key['TGL_PENJUALAN']);
|
|
$hppBar = round($datHq[0]['AVG_HQ'],2);
|
|
} else {
|
|
$hppBar = 0;
|
|
}
|
|
$subtot = $hppBar*$dat['QTY_DO'];
|
|
$totDo = $totDo+round($subtot,2);
|
|
|
|
$barDo[$nodo++] = [
|
|
'KODE' => $key['KODE_SO'],
|
|
'TRANSAKSI' => "KELUAR",
|
|
'TANGGAL' => $key['TANGGAL'],
|
|
'QTY' => $dat['QTY_DO'],
|
|
'KORANG' => $dat['KODE_BARANG'],
|
|
'NARANG' => $dat['NAMA_BARANG'],
|
|
'SATUAN' => number_format($hppBar,2),
|
|
'SUBTOT' => number_format($subtot,2),
|
|
];
|
|
}
|
|
|
|
$datIo0 = $this->Amod->getData_TransaksiStock_bySO_byJENIS($key['SID'], 0);
|
|
foreach ($datIo0 as $dot) {
|
|
$datHq = $this->Amod->getData_HistoriKuantiti_byBARANG_beforeTGL_orderDESC_limit1($dot['BARANG_ID'], $dot['TGL_IO']);
|
|
$hppBar = round($datHq[0]['AVG_HQ'],2);
|
|
$subtot = $hppBar*$dot['QTY_IO'];
|
|
$totDo = $totDo+round($subtot,2);
|
|
|
|
$barDo[$nodo++] = [
|
|
'KODE' => $key['KODE_SO'],
|
|
'TRANSAKSI' => "KELUAR",
|
|
'TANGGAL' => $datHq[0]['TANGGAL'],
|
|
'QTY' => $dot['QTY_IO'],
|
|
'KORANG' => $dot['KODE_BARANG'],
|
|
'NARANG' => $dot['NAMA_BARANG'],
|
|
'SATUAN' => number_format($hppBar,2),
|
|
'SUBTOT' => number_format($subtot,2),
|
|
];
|
|
}
|
|
|
|
$datIo1 = $this->Amod->getData_TransaksiStock_bySO_byJENIS($key['SID'], 1);
|
|
foreach ($datIo1 as $det) {
|
|
$datHq = $this->Amod->getData_HistoriKuantiti_byBARANG_beforeTGL_orderDESC_limit1($det['BARANG_ID'], $det['TGL_IO']);
|
|
$hppBar = round($datHq[0]['AVG_HQ'],2);
|
|
$subtot = $hppBar*$det['QTY_IO'];
|
|
$totDo = $totDo-round($subtot,2);
|
|
|
|
$barDo[$nodo++] = [
|
|
'KODE' => $key['KODE_SO'],
|
|
'TRANSAKSI' => "MASUK",
|
|
'TANGGAL' => $datHq[0]['TANGGAL'],
|
|
'QTY' => $det['QTY_IO'],
|
|
'KORANG' => $det['KODE_BARANG'],
|
|
'NARANG' => $det['NAMA_BARANG'],
|
|
'SATUAN' => number_format($hppBar,2),
|
|
'SUBTOT' => number_format($subtot,2),
|
|
];
|
|
}
|
|
|
|
$datSpr[$noso] += ['DPP' => number_format($dpp,2)];
|
|
$datSpr[$noso++] += ['SISA' => number_format($sisa,2)];
|
|
}
|
|
|
|
if ($verse==3) {
|
|
if ($datProyek[0]['TGL_PROSES']==NULL) {
|
|
$limit = $now;
|
|
} else {
|
|
$limit = $datProyek[0]['TGL_PROSES'];
|
|
}
|
|
} else {
|
|
$limit = $now;
|
|
}
|
|
|
|
foreach ($datDpr as $key) {
|
|
$datSnpr = $this->Amod->getData_SnProyek_byBARANG_byPROYEK_status9_groupNAMASNPR($key['BARANG_ID'], $id);
|
|
$datHq = $this->Amod->getData_HistoriKuantiti_byBARANG_beforeTGL_orderDESC_limit1($key['BARANG_ID'], $limit);
|
|
$hppDpr = round($datHq[0]['AVG_HQ'],2);
|
|
$subtot = $hppDpr*$key['SISA'];
|
|
$totDpr = $totDpr+round($subtot,2);
|
|
|
|
$datDpr[$nodpr] += ['SNPR' => $datSnpr];
|
|
$datDpr[$nodpr] += ['SATUAN' => number_format($hppDpr,2)];
|
|
$datDpr[$nodpr++] += ['SUBTOT' => number_format(($hppDpr*$key['SISA']),2)];
|
|
}
|
|
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byPROYEK_byPERKIRAAN($id, 70);
|
|
if ($sumDak==FALSE OR $sumDak[0]['DEBET']==NULL) {
|
|
$totDak = 0;
|
|
} else {
|
|
$totDak = $sumDak[0]['DEBET'];
|
|
}
|
|
|
|
$sumBpry = $this->Amod->getSum_BiayaProyek_byPROYEK($id);
|
|
if ($sumBpry==FALSE OR $sumBpry[0]['TOTAL']==NULL) {
|
|
$totBpry = 0;
|
|
} else {
|
|
$totBpry = $sumBpry[0]['TOTAL'];
|
|
}
|
|
|
|
$hasilGp = $totSo-$totFee-$totDo-$totDpr-$totDak-$totBpry;
|
|
|
|
$data = array(
|
|
'sidebar' => "menu proyek",
|
|
'navChild' => "proyek salesproyek",
|
|
'id_proyek' => $id,
|
|
'verse' => $verse,
|
|
'id_menu' => $id_menu,
|
|
'tgl' => $now,
|
|
'posisiToggle' => $posisiToggle,
|
|
'status_proyek' => $datProyek[0]['STATUS_PROYEK'],
|
|
'kode_proyek' => $datProyek[0]['KODE_PROYEK'],
|
|
'po_proyek' => $datProyek[0]['PO_PROYEK'],
|
|
'jenis_proyek' => $datProyek[0]['JENIS_PROYEK'],
|
|
'nama_jpp' => $datProyek[0]['NAMA_JPP'],
|
|
'nilai_proyek' => number_format($datProyek[0]['NILAI_PROYEK'], 2),
|
|
'nama_pelanggan' => substr($datProyek[0]['NAMA_PELANGGAN'], 0, 32),
|
|
'nilaiSoTotal' => number_format($totSo,2),
|
|
'nilaiFeeTotal' => number_format($totFee,2),
|
|
'nilaiDoTotal' => number_format($totDo,2),
|
|
'nilaiDprTotal' => number_format($totDpr,2),
|
|
'nilaiDakTotal' => number_format($totDak,2),
|
|
'nilaiBpryTotal' => number_format($totBpry,2),
|
|
'nilaiGp' => number_format($hasilGp,2),
|
|
'spr' => $datSpr,
|
|
'sogp' => $datSoGp,
|
|
'bardo' => $barDo,
|
|
'dpr' => $datDpr,
|
|
'dak' => $datDak,
|
|
'bpry' => $datBpry,
|
|
'countSpr' => count($datSpr),
|
|
'countBardo' => count($barDo),
|
|
'countDpr' => count($datDpr),
|
|
'countDak' => count($datDak),
|
|
'countBpry' => count($datBpry)
|
|
);
|
|
$this->load->view('proses/PR_Sub1_SalesProyek_2', $data);
|
|
}
|
|
|
|
public function PR_Sub1_SewaProyek_2($id, $verse) {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$now = date('Y-m-d');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "PR", "TRANSAKSI - Sales Proyek");
|
|
if ($datShm==TRUE) {
|
|
$id_menu = $datShm[0]['MENU_ID'];
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
} else {
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "PR", "TRANSAKSI - Pengawasan");
|
|
$id_menu = $datShm[0]['MENU_ID'];
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
}
|
|
|
|
$datStgel = $this->Amod->getData_SetSubToggle_byKARYAWAN_byMENU($id_karyawan, $id_menu);
|
|
if ($datStgel==FALSE) { $posisiToggle = 0; } else { $posisiToggle = $datStgel[0]['AKTIF_STGEL']; }
|
|
|
|
$datProyek = $this->Amod->getData_Proyek_byID($id);
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byPROYEK($id);
|
|
$datBpry = $this->Amod->getData_BiayaProyek_byPROYEK($id);
|
|
$datPp = $this->Amod->getData_PeriodeProyek_byJENIS_bySTATUS(3,1);
|
|
$datDpr = $this->Amod->getSum_DaftarProyek_byPROYEK_groupBARANG_CDNotNull($id);
|
|
$nodpr = 0;
|
|
$totDpr = 0;
|
|
foreach ($datDpr as $key) {
|
|
if ($datProyek[0]['STATUS_PROYEK']==0) {
|
|
$datSnpr = $this->Amod->getData_SnProyek_byBARANG_byPROYEK_status9_groupNAMASNPR($key['BARANG_ID'], $id);
|
|
} else {
|
|
$datSnpr = $this->Amod->getData_SnProyek_byBARANG_byPROYEK($key['BARANG_ID'], $id);
|
|
}
|
|
$datHq = $this->Amod->getData_HistoriKuantiti_byBARANG_beforeTGL_orderDESC_limit1($key['BARANG_ID'], $now);
|
|
$hppDpr = round($datHq[0]['AVG_HQ'],2);
|
|
$subtot = $hppDpr*$key['SISA'];
|
|
$totDpr = $totDpr+round($subtot,2);
|
|
|
|
$datDpr[$nodpr] += ['SNPR' => $datSnpr];
|
|
$datDpr[$nodpr] += ['SATUAN' => number_format($hppDpr,2)];
|
|
$datDpr[$nodpr++] += ['SUBTOT' => number_format(($hppDpr*$key['SISA']),2)];
|
|
}
|
|
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byPROYEK_byPERKIRAAN($id, 70);
|
|
if ($sumDak==FALSE OR $sumDak[0]['DEBET']==NULL) {
|
|
$totDak = 0;
|
|
} else {
|
|
$totDak = $sumDak[0]['DEBET'];
|
|
}
|
|
|
|
$sumBpry = $this->Amod->getSum_BiayaProyek_byPROYEK($id);
|
|
if ($sumBpry==FALSE OR $sumBpry[0]['TOTAL']==NULL) {
|
|
$totBpry = 0;
|
|
} else {
|
|
$totBpry = $sumBpry[0]['TOTAL'];
|
|
}
|
|
|
|
$hasilGp = $datProyek[0]['NILAI_PROYEK']-$totDpr-$totDak-$totBpry;
|
|
$totalBiaya = $totDpr-$totDak-$totBpry;
|
|
|
|
$data = array(
|
|
'sidebar' => "menu proyek",
|
|
'navChild' => "proyek salesproyek",
|
|
'id_proyek' => $id,
|
|
'verse' => $verse,
|
|
'id_menu' => $id_menu,
|
|
'tgl' => $now,
|
|
'posisiToggle' => $posisiToggle,
|
|
'status_proyek' => $datProyek[0]['STATUS_PROYEK'],
|
|
'kode_proyek' => $datProyek[0]['KODE_PROYEK'],
|
|
'nilai_proyek' => $datProyek[0]['NILAI_PROYEK'],
|
|
'po_proyek' => $datProyek[0]['PO_PROYEK'],
|
|
'nama_jpp' => $datProyek[0]['NAMA_JPP'],
|
|
'nilaiProyek' => number_format($datProyek[0]['NILAI_PROYEK'], 2),
|
|
'nama_pelanggan' => substr($datProyek[0]['NAMA_PELANGGAN'], 0, 32),
|
|
'nilaiDprTotal' => number_format($totDpr,2),
|
|
'nilaiDakTotal' => number_format($totDak,2),
|
|
'nilaiBpryTotal' => number_format($totBpry,2),
|
|
'nilaiGp' => number_format($hasilGp,2),
|
|
'hasilGp' => $hasilGp,
|
|
'totalBiaya' => $totalBiaya,
|
|
'dpr' => $datDpr,
|
|
'dak' => $datDak,
|
|
'bpry' => $datBpry,
|
|
'pp' => $datPp,
|
|
'countDpr' => count($datDpr),
|
|
'countDak' => count($datDak),
|
|
'countBpry' => count($datBpry)
|
|
);
|
|
$this->load->view('proses/PR_Sub1_SewaProyek_2', $data);
|
|
}
|
|
|
|
public function PR_Proses_Sub1_A2_DataProyek() {
|
|
$id_proyek = $this->input->post('id_proyekpro');
|
|
$id_pp = $this->input->post('id_pppro');
|
|
$biaya_rp = $this->input->post('biaya_rppro');
|
|
$gp_rp = $this->input->post('gp_rppro');
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$now = date('Y-m-d');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$datProyek = $this->Amod->getData_Proyek_byID_bySTATUS($id_proyek, 0);
|
|
if ($datProyek==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
if ($datProyek[0]['NILAI_PROYEK']==0) {
|
|
$this->session->set_flashdata('nilaiproyek_null', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
if ($datProyek[0]['JENIS_PROYEK']<=2) {
|
|
$countSpr = $this->Amod->getCount_SoProyek_byPROYEK($id_proyek);
|
|
if ($countSpr<=0) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
} else if ($datProyek[0]['JENIS_PROYEK']==3) {
|
|
$datPp = $this->Amod->getData_PeriodeProyek_byID_bySTATUS($id_pp, 1);
|
|
if ($datPp==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
}
|
|
|
|
$cekDpr = $this->Amod->getData_DaftarProyek_byPROYEK_CDNull($id_proyek);
|
|
if ($cekDpr==TRUE) {
|
|
foreach ($cekDpr as $key) {
|
|
$action = $this->Amod->delete('daftar_proyek', $key['ID_DPR'], 'ID_DPR');
|
|
}
|
|
}
|
|
|
|
$kode_proyek = $datProyek[0]['KODE_PROYEK'];
|
|
$ket_io = "Plot Barang dari Kode Proyek $kode_proyek";
|
|
|
|
$datDpr = $this->Amod->getSum_DaftarProyek_byPROYEK_groupBARANG($id_proyek);
|
|
foreach ($datDpr as $key) {
|
|
if ($key['SISA']>0) {
|
|
$input = [
|
|
'CIPTA_IO' => "Oleh $panggilan pada $timestamp",
|
|
'PROSES_IO' => "Oleh $panggilan pada $timestamp",
|
|
'TGL_IO' => $now,
|
|
'KODE_BUKTI' => $kode_proyek,
|
|
'JIO_ID' => '3',
|
|
'JENIS_IO' => '0',
|
|
'GUDANG_IO' => '1',
|
|
'KARYAWAN_ID' => $id_karyawan,
|
|
'BARANG_ID' => $key['BARANG_ID'],
|
|
'QTY_IO' => $key['SISA'],
|
|
'PROYEK_ID' => $id_proyek,
|
|
'KET_IO' => $ket_io,
|
|
'STATUS_IO' => '1'
|
|
];
|
|
$action = $this->Amod->create('transaksi_stock', $input);
|
|
|
|
$id_io = $this->Amod->getMax_ID_TransaksiStock();
|
|
$id_io = $id_io[0]['ID_IO'];
|
|
|
|
if ($key['TYPE_JENIS']==1) {
|
|
$datSnpr = $this->Amod->getData_SnProyek_byBARANG_byPROYEK_status9_groupNAMASNPR($key['BARANG_ID'], $id_proyek);
|
|
foreach ($datSnpr as $dat) {
|
|
$datSnStock = $this->Amod->getData_SnStock_byNAMA_bySTATUS($dat['NAMA_SNPR'], 9);
|
|
if ($datSnStock==TRUE) {
|
|
$input = [
|
|
'TGL_HSN' => $now,
|
|
'KODE_BUKTI' => $kode_proyek,
|
|
'SNSTOCK_ID' => $datSnStock[0]['ID_SNSTOCK']
|
|
];
|
|
$action = $this->Amod->create('histori_sn', $input);
|
|
|
|
$update = [
|
|
'STATUS_SNSTOCK' => '3'
|
|
];
|
|
$action = $this->Amod->update('sn_stock', $update, 'ID_SNSTOCK', $datSnStock[0]['ID_SNSTOCK']);
|
|
}
|
|
}
|
|
}
|
|
|
|
$this->GE_Kalkulasi_KuantitiBarang($key['BARANG_ID'], 1, "Step 2 - PROYEK - Proses Barang", 0, $key['SISA']);
|
|
$this->GE_Kalkulasi_HistoriKuantiti($key['BARANG_ID'], "Step 2 - PROYEK - Proses Barang", 0, $key['SISA'], $kode_proyek, 0, $id_io);
|
|
}
|
|
}
|
|
|
|
if ($datProyek[0]['JENIS_PROYEK']<=2) {
|
|
$update = [
|
|
'STATUS_PROYEK' => '1',
|
|
'PROSES_PROYEK' => "Oleh $panggilan pada $timestamp",
|
|
'TGL_PROSES' => $now
|
|
];
|
|
$action = $this->Amod->update('proyek', $update, 'ID_PROYEK', $id_proyek);
|
|
} else if ($datProyek[0]['JENIS_PROYEK']==3) {
|
|
$update = [
|
|
'STATUS_PROYEK' => '1',
|
|
'PROSES_PROYEK' => "Oleh $panggilan pada $timestamp",
|
|
'TGL_PROSES' => $now,
|
|
'SEWA_PROYEK' => $id_pp
|
|
];
|
|
$action = $this->Amod->update('proyek', $update, 'ID_PROYEK', $id_proyek);
|
|
|
|
$input = [
|
|
'PP_ID' => $id_pp,
|
|
'SAL_ID' => $datProyek[0]['SALES_ID'],
|
|
'SEWA_RP' => $now,
|
|
'BIAYA_RP' => $biaya_rp,
|
|
'GP_RP' => $gp_rp,
|
|
'GRUP_ID' => '1',
|
|
'STATUS_RP' => '1'
|
|
];
|
|
$action = $this->Amod->create('rekap_proyek', $input);
|
|
|
|
$id_rp = $this->Amod->getMax_ID_RekapProyek();
|
|
$id_rp = $id_rp[0]['ID_RP'];
|
|
|
|
$datBpry = $this->Amod->getData_BiayaProyek_byPROYEK($id_proyek);
|
|
foreach ($datBpry as $key) {
|
|
$update = [
|
|
'RP_ID_BPRY' => $id_rp
|
|
];
|
|
$action = $this->Amod->update('biaya_proyek', $update, 'ID_BPRY', $key['ID_BPRY']);
|
|
}
|
|
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byPROYEK($id_proyek);
|
|
foreach ($datDak as $key) {
|
|
$update = [
|
|
'RP_ID_DAK' => $id_rp
|
|
];
|
|
$action = $this->Amod->update('daftar_akuntansi', $update, 'ID_DAK', $key['ID_DAK']);
|
|
}
|
|
|
|
$datDprNew = $this->Amod->getData_DaftarProyek_byPROYEK($id_proyek);
|
|
foreach ($datDprNew as $key) {
|
|
$update = [
|
|
'RP_ID_DPR' => $id_rp
|
|
];
|
|
$action = $this->Amod->update('daftar_proyek', $update, 'ID_DPR', $key['ID_DPR']);
|
|
}
|
|
}
|
|
|
|
if ($action) {
|
|
$this->session->set_flashdata('data_lock', 'diproses');
|
|
redirect('Menu/PR_Sub1_SalesProyek_1');
|
|
} else {
|
|
$this->session->set_flashdata('failed', 'diproses');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
}
|
|
|
|
public function PR_Tambah_Sub1_A2_DataSoProyek() {
|
|
$id_so = $this->input->post('id_sonew');
|
|
$id_proyek = $this->input->post('id_proyeknew');
|
|
|
|
$datSo = $this->Amod->getData_SalesOrder_byID($id_so);
|
|
if ($datSo==FALSE OR $datSo[0]['STATUS_SO']!=1) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$datProyek = $this->Amod->getData_Proyek_byID_bySTATUS($id_proyek, 0);
|
|
if ($datProyek==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$datSpr = $this->Amod->getData_SoProyek_bySO($id_so);
|
|
if ($datSpr==TRUE) {
|
|
$this->session->set_flashdata('spr_used', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$input = [
|
|
'PROYEK_ID' => $id_proyek,
|
|
'SO_ID' => $id_so,
|
|
];
|
|
$action = $this->Amod->create('so_proyek', $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 PR_Tambah_Sub1_A2_DataBiayaProyek() {
|
|
$id_proyek = $this->input->post('id_proyeknewbpry');
|
|
$nilai_bpry = $this->input->post('nilai_bprynew');
|
|
$nama_bpry = $this->input->post('nama_bprynew');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$datProyek = $this->Amod->getData_Proyek_byID_bySTATUS($id_proyek, 0);
|
|
if ($datProyek==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$cekNilai = is_numeric($nilai_bpry);
|
|
if ($cekNilai==FALSE) {
|
|
$nilai_bpry = 0;
|
|
}
|
|
|
|
if ($nilai_bpry<=0) {
|
|
$this->session->set_flashdata('less_same_zero', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$input = [
|
|
'NAMA_BPRY' => $nama_bpry,
|
|
'NILAI_BPRY' => $nilai_bpry,
|
|
'PROYEK_ID' => $id_proyek,
|
|
'TAMBAH_BPRY' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->create('biaya_proyek', $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 PR_Ubah_Sub1_A2_DataProyek() {
|
|
$id_proyek = $this->input->post('id_proyeked');
|
|
$nilai_proyek = $this->input->post('nilai_proyeked');
|
|
|
|
$datProyek = $this->Amod->getData_Proyek_byID_bySTATUS($id_proyek, 0);
|
|
if ($datProyek==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$cekNilai = is_numeric($nilai_proyek);
|
|
if ($cekNilai==FALSE) {
|
|
$nilai_proyek = 0;
|
|
}
|
|
|
|
if ($nilai_proyek<=0) {
|
|
$this->session->set_flashdata('less_same_zero', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$update = [
|
|
'NILAI_PROYEK' => $nilai_proyek
|
|
];
|
|
$action = $this->Amod->update('proyek', $update, 'ID_PROYEK', $id_proyek);
|
|
|
|
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 PR_Ubah_Sub1_A2_DataBiayaProyek() {
|
|
$id_proyek = $this->input->post('id_proyekedbpry');
|
|
$id_bpry = $this->input->post('id_bpryed');
|
|
$nilai_bpry = $this->input->post('nilai_bpryed');
|
|
$nama_bpry = $this->input->post('nama_bpryed');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$datBpry = $this->Amod->getData_BiayaProyek_byID($id_bpry);
|
|
if ($datBpry==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$datProyek = $this->Amod->getData_Proyek_byID_bySTATUS($id_proyek, 0);
|
|
if ($datProyek==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$cekNilai = is_numeric($nilai_bpry);
|
|
if ($cekNilai==FALSE) {
|
|
$nilai_bpry = 0;
|
|
}
|
|
|
|
if ($nilai_bpry<=0) {
|
|
$this->session->set_flashdata('less_same_zero', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$update = [
|
|
'NAMA_BPRY' => $nama_bpry,
|
|
'NILAI_BPRY' => $nilai_bpry,
|
|
'UBAH_BPRY' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('biaya_proyek', $update, 'ID_BPRY', $id_bpry);
|
|
|
|
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 PR_Hapus_Sub1_A2_DataSoProyek() {
|
|
$id_so = $this->input->post('id_sodelspr');
|
|
$id_proyek = $this->input->post('id_proyekdelspr');
|
|
|
|
$datProyek = $this->Amod->getData_Proyek_byID_bySTATUS($id_proyek, 0);
|
|
if ($datProyek==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$datSpr = $this->Amod->getData_SoProyek_bySO($id_so);
|
|
if ($datSpr==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$action = $this->Amod->delete('so_proyek', $id_so, 'SO_ID');
|
|
|
|
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 PR_Hapus_Sub1_A2_DataBiayaProyek() {
|
|
$id_bpry = $this->input->post('id_bprydel');
|
|
$id_proyek = $this->input->post('id_proyekdelbpry');
|
|
|
|
$datProyek = $this->Amod->getData_Proyek_byID_bySTATUS($id_proyek, 0);
|
|
if ($datProyek==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$datBpry = $this->Amod->getData_BiayaProyek_byID($id_bpry);
|
|
if ($datBpry==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$action = $this->Amod->delete('biaya_proyek', $id_bpry, 'ID_BPRY');
|
|
|
|
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 PR_Sub1_SalesProyek_3($id, $verse) {
|
|
$datRp = $this->Amod->getData_RekapProyek_byID($id);
|
|
$datProyek = $this->Amod->getData_Proyek_byRP_orderPELANGGAN($id);
|
|
$no = 0;
|
|
foreach ($datProyek as $key) {
|
|
$datSpr = $this->Amod->getData_SoProyek_byPROYEK($key['ID_PROYEK']);
|
|
$nocek = 0;
|
|
foreach ($datSpr as $dat) {
|
|
$datHhpda = $this->Amod->getData_HasilHitungPda_bySO($dat['SID']);
|
|
if ($datHhpda[0]['STATUS_HHPDA']==1) {
|
|
$lunasCek = "<b style='color:HotPink'>[LUNAS]</b>";
|
|
} else {
|
|
$lunasCek = "<b style='color:Red'>[BELUM LUNAS]</b>";
|
|
}
|
|
$datSpr[$nocek++] += ['LUNAS' => $lunasCek];
|
|
}
|
|
$datProyek[$no++] += ['SPR' => $datSpr];
|
|
}
|
|
$countProyek = $this->Amod->getCount_Proyek_bySALES_byPERIODE_statusUntil1($datRp[0]['SAL_ID'], $datRp[0]['AWAL_PP'], $datRp[0]['AKHIR_PP']);
|
|
|
|
$data = array(
|
|
'sidebar' => "menu proyek",
|
|
'navChild' => "proyek salesproyek",
|
|
'id_rp' => $id,
|
|
'verse' => $verse,
|
|
'proyek' => $datProyek,
|
|
'countLapor' => count($datProyek),
|
|
'countProyekAll' => $countProyek,
|
|
'status_rp' => $datRp[0]['STATUS_RP'],
|
|
'nama_pp' => $datRp[0]['NAMA_PP'],
|
|
'sales' => $datRp[0]['NAMA_PANGGILAN_KARYAWAN'],
|
|
'awal' => $datRp[0]['AWAL'],
|
|
'akhir' => $datRp[0]['AKHIR'],
|
|
);
|
|
$this->load->view('proses/PR_Sub1_SalesProyek_3', $data);
|
|
}
|
|
|
|
public function PR_Sub1_SewaProyek_3($id, $verse) {
|
|
$datProyek = $this->Amod->getData_Proyek_byID($id);
|
|
$datRp = $this->Amod->getData_RekapProyek_bySALES_byPP($datProyek[0]['SALES_ID'], $datProyek[0]['SEWA_PROYEK']);
|
|
$no = 0;
|
|
foreach ($datRp as $key) {
|
|
$awalPeriode = $this->Amod->generate_addMonth($key['AWAL_PP'],(($key['GRUP_ID']-1)*3));
|
|
$akhirPeriode = $this->Amod->generate_addMonth($key['AWAL_PP'],($key['GRUP_ID']*3));
|
|
$akhirPeriode = $this->Amod->generate_subDay($akhirPeriode, 1);
|
|
|
|
if ($no==0) {
|
|
$biayaLama = $key['BIAYA_RP'];
|
|
}
|
|
$datSpr = $this->Amod->getData_SoProyek_byRP_jenis3($key['ID_RP']);
|
|
$nospr = 0;
|
|
$totalNota = 0;
|
|
foreach ($datSpr as $dat) {
|
|
if ($dat['STATUS_HHPDA']==1) {
|
|
$lunas = "<b style='color:Hotpink'>LUNAS</b>";
|
|
} else {
|
|
$lunas = "<b style='color:Red'>BELUM LUNAS</b>";
|
|
}
|
|
$datSpr[$nospr++] += ['LUNAS' => $lunas];
|
|
|
|
$totalNota = $totalNota+$dat['NILAI_SO'];
|
|
}
|
|
if ($no>0) {
|
|
$biayaTambahan = $key['BIAYA_RP']-$biayaLama;
|
|
if ($biayaTambahan>0) {
|
|
$biayaLama = $key['BIAYA_RP'];
|
|
}
|
|
} else {
|
|
$biayaTambahan = 0;
|
|
}
|
|
$datRp[$no] += ['AWALPP' => date_format(date_create($awalPeriode), "d/m/Y")];
|
|
$datRp[$no] += ['AKHIRPP' => date_format(date_create($akhirPeriode), "d/m/Y")];
|
|
$datRp[$no] += ['BITAM' => number_format($biayaTambahan,2)];
|
|
$datRp[$no] += ['NISO' => number_format($totalNota,2)];
|
|
$datRp[$no++] += ['SPR' => $datSpr];
|
|
}
|
|
|
|
$data = array(
|
|
'sidebar' => "menu proyek",
|
|
'navChild' => "proyek salesproyek",
|
|
'id_proyek' => $id,
|
|
'verse' => $verse,
|
|
'rp' => $datRp,
|
|
'kode_proyek' => $datProyek[0]['KODE_PROYEK'],
|
|
'po_proyek' => $datProyek[0]['PO_PROYEK'],
|
|
'nama_pelanggan' => $datProyek[0]['NAMA_PELANGGAN'],
|
|
'nama_jpp' => $datProyek[0]['NAMA_JPP'],
|
|
);
|
|
$this->load->view('proses/PR_Sub1_SewaProyek_3', $data);
|
|
}
|
|
|
|
public function PR_Ambil_Sub1_A3_DataSoProyek() {
|
|
$id_rp = $this->input->post('id_rp');
|
|
$id_proyek = $this->input->post('id_proyek');
|
|
$search = $this->input->post('search');
|
|
|
|
$data = $this->Amod->getData_SoProyek_byRP_jenis3($id_rp, $search);
|
|
$no = 0;
|
|
$totSo = 0;
|
|
foreach ($data as $key) {
|
|
if ($key['STATUS_HHPDA']==1) {
|
|
$lunas = "<b style='color:Hotpink'>LUNAS</b>";
|
|
|
|
$diffawal = new DateTime($key['TGL_PENJUALAN']);
|
|
$diffakhir = new DateTime($key['TGLLOCK_HHPDA']);
|
|
$diff = date_diff($diffawal, $diffakhir);
|
|
$diff = $diff->format("%a");
|
|
|
|
if ($diff>90) {
|
|
$bayar = "<b style='color:Red'>*$diff Hari*</b>";
|
|
} else {
|
|
$bayar = "<b style='color:SaddleBrown'>$diff Hari</b>";
|
|
}
|
|
} else {
|
|
$lunas = "<b style='color:Red'>BELUM LUNAS</b>";
|
|
$bayar = "";
|
|
}
|
|
$data[$no] += ['BAYAR' => $bayar];
|
|
$data[$no++] += ['LUNAS' => $lunas];
|
|
|
|
$totSo = $totSo+$key['NILAI_SO'];
|
|
}
|
|
|
|
if ($id_proyek!="") {
|
|
$datProyek = $this->Amod->getData_Proyek_byID($id_proyek);
|
|
$datSoGp = $this->Amod->getData_SalesOrder_byPELANGGAN_bySALES_status1_forProyek($datProyek[0]['PELANGGAN_ID'], $datProyek[0]['SALES_ID']);
|
|
} else {
|
|
$datSoGp = NULL;
|
|
}
|
|
|
|
$this->output_json([
|
|
'data' => $data,
|
|
'total' => sizeof($data),
|
|
'totSo' => number_format($totSo,2),
|
|
'sogp' => $datSoGp,
|
|
]);
|
|
}
|
|
|
|
public function PR_Ambil_Sub1_A3_DataBiayaProyek() {
|
|
$id_rp = $this->input->post('id_rp');
|
|
$id_proyek = $this->input->post('id_proyek');
|
|
|
|
if ($id_proyek=="") {
|
|
$data = $this->Amod->getData_BiayaProyek_byRP_jenis3($id_rp);
|
|
} else {
|
|
$data = $this->Amod->getData_BiayaProyek_byPROYEK_byRP_jenis3($id_proyek, $id_rp);
|
|
}
|
|
$no = 0;
|
|
$totBiaya = 0;
|
|
foreach ($data as $key) {
|
|
$totBiaya = $totBiaya+$key['NILAI_BPRY'];
|
|
}
|
|
|
|
$this->output_json([
|
|
'data' => $data,
|
|
'total' => sizeof($data),
|
|
'totBiaya' => number_format($totBiaya,2),
|
|
]);
|
|
}
|
|
|
|
public function PR_Simpan_Sub1_A3_DataSoProyekSewa() {
|
|
$id_rp = $this->input->post('id_rp');
|
|
$id_so = $this->input->post('id_so');
|
|
$id_proyek = $this->input->post('id_proyek');
|
|
|
|
//Check Konsistensi Data
|
|
$value = 0;
|
|
$datProyek = $this->Amod->getData_Proyek_byID_bySTATUS($id_proyek, 1);
|
|
if ($datProyek==FALSE) {
|
|
$value = 5;
|
|
} else {
|
|
$datRp = $this->Amod->getData_RekapProyek_byID_bySTATUS($id_rp, 1);
|
|
if ($datRp==FALSE) {
|
|
$value = 4;
|
|
} else {
|
|
$datSo = $this->Amod->getData_SalesOrder_byID_bySTATUS($id_so, 1);
|
|
if ($datSo==FALSE) {
|
|
$value = 3;
|
|
} else {
|
|
$datSpr = $this->Amod->getData_SoProyek_bySO($id_so);
|
|
if ($datSpr==TRUE) {
|
|
$value = 2;
|
|
} else {
|
|
$input = [
|
|
'PROYEK_ID' => $id_proyek,
|
|
'SO_ID' => $id_so,
|
|
'RP_ID_SPR' => $id_rp
|
|
];
|
|
$action = $this->Amod->create('so_proyek', $input);
|
|
|
|
$biayaBaru = $datRp[0]['BIAYA_RP']+$datSo[0]['FEE_SO'];
|
|
$gpBaru = $datRp[0]['GP_RP']-$datSo[0]['FEE_SO'];
|
|
|
|
$update = [
|
|
'BIAYA_RP' => $biayaBaru,
|
|
'GP_RP' => $gpBaru
|
|
];
|
|
$action = $this->Amod->update('rekap_proyek', $update, 'ID_RP', $id_rp);
|
|
|
|
$value = 1;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
|
|
}
|
|
|
|
public function PR_Simpan_Sub1_A3_DataBiayaProyek() {
|
|
$id_proyek = $this->input->post('id_proyek');
|
|
$nama_bpry = $this->input->post('nama_bpry');
|
|
$nilai_bpry = $this->input->post('nilai_bpry');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$value = 0;
|
|
$datProyek = $this->Amod->getData_Proyek_byID_bySTATUS($id_proyek, 1);
|
|
if ($datProyek==FALSE) {
|
|
$value = 2;
|
|
} else {
|
|
$input = [
|
|
'PROYEK_ID' => $id_proyek,
|
|
'NAMA_BPRY' => $nama_bpry,
|
|
'NILAI_BPRY' => $nilai_bpry
|
|
];
|
|
$action = $this->Amod->create('biaya_proyek', $input);
|
|
|
|
$biaya_proyekOld = $datProyek[0]['BIAYA_PROYEK'];
|
|
$gp_proyekOld = $datProyek[0]['GP_PROYEK'];
|
|
$biaya_proyekNew = $biaya_proyekOld+$nilai_bpry;
|
|
$gp_proyekNew = $gp_proyekOld-$nilai_bpry;
|
|
|
|
$update = [
|
|
'REVISI_PROYEK' => "Oleh $panggilan pada $timestamp",
|
|
'BIAYA_PROYEK' => $biaya_proyekNew,
|
|
'GP_PROYEK' => $gp_proyekNew
|
|
];
|
|
$action = $this->Amod->update('proyek', $update, 'ID_PROYEK', $id_proyek);
|
|
|
|
$value = 1;
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value
|
|
]);
|
|
}
|
|
|
|
public function PR_Simpan_Sub1_A3_DataBiayaProyekSewa() {
|
|
$id_rp = $this->input->post('id_rp');
|
|
$id_proyek = $this->input->post('id_proyek');
|
|
$nama_bpry = $this->input->post('nama_bpry');
|
|
$nilai_bpry = $this->input->post('nilai_bpry');
|
|
$nama_bpry = preg_replace('/\R+/', " " , $nama_bpry);
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
//Check Konsistensi Data
|
|
$value = 0;
|
|
$datProyek = $this->Amod->getData_Proyek_byID_bySTATUS($id_proyek, 1);
|
|
if ($datProyek==FALSE) {
|
|
$value = 3;
|
|
} else {
|
|
$datRp = $this->Amod->getData_RekapProyek_byID_bySTATUS($id_rp, 1);
|
|
if ($datRp==FALSE) {
|
|
$value = 2;
|
|
} else {
|
|
$input = [
|
|
'PROYEK_ID' => $id_proyek,
|
|
'NAMA_BPRY' => $nama_bpry,
|
|
'NILAI_BPRY' => $nilai_bpry,
|
|
'TAMBAH_BPRY' => "Oleh $panggilan pada $timestamp",
|
|
'RP_ID_BPRY' => $id_rp
|
|
];
|
|
$action = $this->Amod->create('biaya_proyek', $input);
|
|
|
|
$biaya_rpNew = $datRp[0]['BIAYA_RP']+$nilai_bpry;
|
|
$gp_rpNew = $datRp[0]['GP_RP']-$nilai_bpry;
|
|
|
|
$update = [
|
|
'BIAYA_RP' => $biaya_rpNew,
|
|
'GP_RP' => $gp_rpNew
|
|
];
|
|
$action = $this->Amod->update('rekap_proyek', $update, 'ID_RP', $id_rp);
|
|
|
|
$value = 1;
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
|
|
}
|
|
|
|
public function PR_Ubah_Sub1_A3_DataBiayaProyek() {
|
|
$id_proyek = $this->input->post('id_proyek');
|
|
$id_bpry = $this->input->post('id_bpry');
|
|
$nama_bpry = $this->input->post('nama_bpry');
|
|
$nilai_bpry = $this->input->post('nilai_bpry');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$value = 0;
|
|
$datProyek = $this->Amod->getData_Proyek_byID_bySTATUS($id_proyek, 1);
|
|
if ($datProyek==FALSE) {
|
|
$value = 3;
|
|
} else {
|
|
$datBpry = $this->Amod->getData_BiayaProyek_byID($id_bpry);
|
|
if ($datBpry==FALSE) {
|
|
$value = 2;
|
|
} else {
|
|
$biaya_proyekOld = $datProyek[0]['BIAYA_PROYEK']-$datBpry[0]['NILAI_BPRY'];
|
|
$gp_proyekOld = $datProyek[0]['GP_PROYEK']+$datBpry[0]['NILAI_BPRY'];
|
|
|
|
$update = [
|
|
'NAMA_BPRY' => $nama_bpry,
|
|
'NILAI_BPRY'=> $nilai_bpry
|
|
];
|
|
$action = $this->Amod->update('biaya_proyek', $update, 'ID_BPRY', $id_bpry);
|
|
|
|
$biaya_proyekNew = $biaya_proyekOld+$nilai_bpry;
|
|
$gp_proyekNew = $gp_proyekOld-$nilai_bpry;
|
|
|
|
$update = [
|
|
'REVISI_PROYEK' => "Oleh $panggilan pada $timestamp",
|
|
'BIAYA_PROYEK' => $biaya_proyekNew,
|
|
'GP_PROYEK' => $gp_proyekNew
|
|
];
|
|
$action = $this->Amod->update('proyek', $update, 'ID_PROYEK', $id_proyek);
|
|
|
|
$value = 1;
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value
|
|
]);
|
|
}
|
|
|
|
public function PR_Ubah_Sub1_A3_DataBiayaProyekSewa() {
|
|
$id_rp = $this->input->post('id_rp');
|
|
$id_bpry = $this->input->post('id_bpry');
|
|
$id_proyek = $this->input->post('id_proyek');
|
|
$nama_bpry = $this->input->post('nama_bpry');
|
|
$nilai_bpry = $this->input->post('nilai_bpry');
|
|
$nama_bpry = preg_replace('/\R+/', " " , $nama_bpry);
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
//Check Konsistensi Data
|
|
$value = 0;
|
|
$datProyek = $this->Amod->getData_Proyek_byID_bySTATUS($id_proyek, 1);
|
|
if ($datProyek==FALSE) {
|
|
$value = 4;
|
|
} else {
|
|
$datRp = $this->Amod->getData_RekapProyek_byID_bySTATUS($id_rp, 1);
|
|
if ($datRp==FALSE) {
|
|
$value = 3;
|
|
} else {
|
|
$datBpry = $this->Amod->getData_BiayaProyek_byID($id_bpry);
|
|
if ($datBpry==FALSE) {
|
|
$value = 2;
|
|
} else {
|
|
$biayaLama = $datBpry[0]['NILAI_BPRY'];
|
|
$selisih = $nilai_bpry-$biayaLama;
|
|
|
|
$update = [
|
|
'NAMA_BPRY' => $nama_bpry,
|
|
'NILAI_BPRY' => $nilai_bpry,
|
|
'UBAH_BPRY' => "Oleh $panggilan pada $timestamp",
|
|
];
|
|
$action = $this->Amod->update('biaya_proyek', $update, 'ID_BPRY', $id_bpry);
|
|
|
|
$biaya_rpNew = $datRp[0]['BIAYA_RP']+$selisih;
|
|
$gp_rpNew = $datRp[0]['GP_RP']-$selisih;
|
|
|
|
$update = [
|
|
'BIAYA_RP' => $biaya_rpNew,
|
|
'GP_RP' => $gp_rpNew
|
|
];
|
|
$action = $this->Amod->update('rekap_proyek', $update, 'ID_RP', $id_rp);
|
|
|
|
$value = 1;
|
|
}
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
|
|
}
|
|
|
|
public function PR_Ubah_Sub1_A3_DataSoProyek() {
|
|
$id_rp = $this->input->post('id_rped');
|
|
$id_spr = $this->input->post('id_spred');
|
|
$id_so = $this->input->post('id_soed');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$datRp = $this->Amod->getData_RekapProyek_byID_bySTATUS($id_rp, 1);
|
|
$datSpr = $this->Amod->getData_SoProyek_byID($id_spr);
|
|
$datSo = $this->Amod->getData_SalesOrder_byID_bySTATUS($id_so, 1);
|
|
if ($datRp==FALSE OR $datSpr==FALSE OR $datSo==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$sumSoOld = $this->Amod->getSum_DaftarOrder_bySO($datSpr[0]['SO_ID']);
|
|
$dpp_soOld = $sumSoOld[0]['TOTAL'];
|
|
|
|
$kode_penjualanOld = $datSpr[0]['KODE_PENJUALAN'];
|
|
$fee_soOld = $datSpr[0]['FEE_SO'];
|
|
|
|
$biayaSoOld = 0;
|
|
$datHqOld = $this->Amod->getData_HistoriKuantiti_byKODE($kode_penjualanOld);
|
|
foreach ($datHqOld as $key) {
|
|
if ($key['MASUK_HQ']>0) {
|
|
$biayaSoOld = $biayaSoOld-round(($key['MASUK_HQ']*$key['AVG_HQ']),2);
|
|
} else if ($key['KELUAR_HQ']>0) {
|
|
$biayaSoOld = $biayaSoOld+round(($key['KELUAR_HQ']*$key['AVG_HQ']),2);
|
|
}
|
|
}
|
|
|
|
$datProyek = $this->Amod->getData_Proyek_byID($datSpr[0]['PROYEK_ID']);
|
|
$biaya_proyekOld = $datProyek[0]['BIAYA_PROYEK']-$biayaSoOld-$fee_soOld;
|
|
$gp_proyekOld = $datProyek[0]['GP_PROYEK']+$biayaSoOld+$fee_soOld-$dpp_soOld;
|
|
|
|
$sumSoNew = $this->Amod->getSum_DaftarOrder_bySO($id_so);
|
|
$dpp_soNew = $sumSoNew[0]['TOTAL'];
|
|
$fee_soNew = $datSo[0]['FEE_SO'];
|
|
|
|
$datPenjualan = $this->Amod->getData_Penjualan_bySO($id_so);
|
|
$kode_penjualanNew = $datPenjualan[0]['KODE_PENJUALAN'];
|
|
|
|
$biayaSoNew = 0;
|
|
$datHqNew = $this->Amod->getData_HistoriKuantiti_byKODE($kode_penjualanNew);
|
|
foreach ($datHqNew as $key) {
|
|
if ($key['MASUK_HQ']>0) {
|
|
$biayaSoNew = $biayaSoNew-round(($key['MASUK_HQ']*$key['AVG_HQ']),2);
|
|
} else if ($key['KELUAR_HQ']>0) {
|
|
$biayaSoNew = $biayaSoNew+round(($key['KELUAR_HQ']*$key['AVG_HQ']),2);
|
|
}
|
|
}
|
|
|
|
$biaya_proyekNew = $biaya_proyekOld+$fee_soNew+$biayaSoNew;
|
|
$gp_proyekNew = $gp_proyekOld-$fee_soNew-$biayaSoNew+$dpp_soNew;
|
|
|
|
$update = [
|
|
'REVISI_PROYEK' => "Oleh $panggilan pada $timestamp",
|
|
'BIAYA_PROYEK' => $biaya_proyekNew,
|
|
'GP_PROYEK' => $gp_proyekNew
|
|
];
|
|
$action = $this->Amod->update('proyek', $update, 'ID_PROYEK', $datSpr[0]['PROYEK_ID']);
|
|
|
|
$update = [
|
|
'SO_ID' => $id_so
|
|
];
|
|
$action = $this->Amod->update('so_proyek', $update, 'ID_SPR', $id_spr);
|
|
|
|
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 PR_Hapus_Sub1_A3_DataSoProyek() {
|
|
$id_rp = $this->input->post('id_rpdel');
|
|
$id_spr = $this->input->post('id_sprdel');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$datRp = $this->Amod->getData_RekapProyek_byID_bySTATUS($id_rp, 1);
|
|
$datSpr = $this->Amod->getData_SoProyek_byID($id_spr);
|
|
if ($datRp==FALSE OR $datSpr==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$sumSoOld = $this->Amod->getSum_DaftarOrder_bySO($datSpr[0]['SO_ID']);
|
|
$dpp_soOld = $sumSoOld[0]['TOTAL'];
|
|
|
|
$kode_penjualanOld = $datSpr[0]['KODE_PENJUALAN'];
|
|
$fee_soOld = $datSpr[0]['FEE_SO'];
|
|
|
|
$biayaSoOld = 0;
|
|
$datHqOld = $this->Amod->getData_HistoriKuantiti_byKODE($kode_penjualanOld);
|
|
foreach ($datHqOld as $key) {
|
|
if ($key['MASUK_HQ']>0) {
|
|
$biayaSoOld = $biayaSoOld-round(($key['MASUK_HQ']*$key['AVG_HQ']),2);
|
|
} else if ($key['KELUAR_HQ']>0) {
|
|
$biayaSoOld = $biayaSoOld+round(($key['KELUAR_HQ']*$key['AVG_HQ']),2);
|
|
}
|
|
}
|
|
|
|
$datProyek = $this->Amod->getData_Proyek_byID($datSpr[0]['PROYEK_ID']);
|
|
$biaya_proyekOld = $datProyek[0]['BIAYA_PROYEK']-$biayaSoOld-$fee_soOld;
|
|
$gp_proyekOld = $datProyek[0]['GP_PROYEK']+$biayaSoOld+$fee_soOld-$dpp_soOld;
|
|
|
|
$update = [
|
|
'REVISI_PROYEK' => "Oleh $panggilan pada $timestamp",
|
|
'BIAYA_PROYEK' => $biaya_proyekOld,
|
|
'GP_PROYEK' => $gp_proyekOld
|
|
];
|
|
$action = $this->Amod->update('proyek', $update, 'ID_PROYEK', $datSpr[0]['PROYEK_ID']);
|
|
|
|
$action = $this->Amod->delete('so_proyek', $id_spr, 'ID_SPR');
|
|
|
|
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 PR_Hapus_Sub1_A3_DataSoProyekSewa() {
|
|
$id_rp = $this->input->post('id_rp');
|
|
$id_spr = $this->input->post('id_spr');
|
|
|
|
//Check Konsistensi Data
|
|
$value = 0;
|
|
$datRp = $this->Amod->getData_RekapProyek_byID_bySTATUS($id_rp, 1);
|
|
if ($datRp==FALSE) {
|
|
$value = 3;
|
|
} else {
|
|
$datSpr = $this->Amod->getData_SoProyek_byID($id_spr);
|
|
if ($datSpr==FALSE) {
|
|
$value = 2;
|
|
} else {
|
|
$biayaBaru = $datRp[0]['BIAYA_RP']-$datSpr[0]['FEE_SO'];
|
|
$gpBaru = $datRp[0]['GP_RP']+$datSpr[0]['FEE_SO'];
|
|
|
|
$update = [
|
|
'BIAYA_RP' => $biayaBaru,
|
|
'GP_RP' => $gpBaru
|
|
];
|
|
$action = $this->Amod->update('rekap_proyek', $update, 'ID_RP', $id_rp);
|
|
|
|
$action = $this->Amod->delete('so_proyek', $id_spr, 'ID_SPR');
|
|
|
|
$value = 1;
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
|
|
}
|
|
|
|
public function PR_Hapus_Sub1_A3_DataBiayaProyek() {
|
|
$id_proyek = $this->input->post('id_proyek');
|
|
$id_bpry = $this->input->post('id_bpry');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$value = 0;
|
|
$datProyek = $this->Amod->getData_Proyek_byID_bySTATUS($id_proyek, 1);
|
|
if ($datProyek==FALSE) {
|
|
$value = 3;
|
|
} else {
|
|
$datBpry = $this->Amod->getData_BiayaProyek_byID($id_bpry);
|
|
if ($datBpry==FALSE) {
|
|
$value = 2;
|
|
} else {
|
|
$biaya_proyekNew = $datProyek[0]['BIAYA_PROYEK']-$datBpry[0]['NILAI_BPRY'];
|
|
$gp_proyekNew = $datProyek[0]['GP_PROYEK']+$datBpry[0]['NILAI_BPRY'];
|
|
|
|
$update = [
|
|
'REVISI_PROYEK' => "Oleh $panggilan pada $timestamp",
|
|
'BIAYA_PROYEK' => $biaya_proyekNew,
|
|
'GP_PROYEK' => $gp_proyekNew
|
|
];
|
|
$action = $this->Amod->update('proyek', $update, 'ID_PROYEK', $id_proyek);
|
|
|
|
$action = $this->Amod->delete('biaya_proyek', $id_bpry, 'ID_BPRY');
|
|
|
|
$value = 1;
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value
|
|
]);
|
|
}
|
|
|
|
public function PR_Hapus_Sub1_A3_DataBiayaProyekSewa() {
|
|
$id_rp = $this->input->post('id_rp');
|
|
$id_bpry = $this->input->post('id_bpry');
|
|
|
|
//Check Konsistensi Data
|
|
$value = 0;
|
|
$datRp = $this->Amod->getData_RekapProyek_byID_bySTATUS($id_rp, 1);
|
|
if ($datRp==FALSE) {
|
|
$value = 3;
|
|
} else {
|
|
$datBpry = $this->Amod->getData_BiayaProyek_byID($id_bpry);
|
|
if ($datBpry==FALSE) {
|
|
$value = 2;
|
|
} else {
|
|
$biayaLama = $datBpry[0]['NILAI_BPRY'];
|
|
|
|
$action = $this->Amod->delete('biaya_proyek', $id_bpry, 'ID_BPRY');
|
|
|
|
$biayaBaru = $datRp[0]['BIAYA_RP']-$biayaLama;
|
|
$gpBaru = $datRp[0]['GP_RP']+$biayaLama;
|
|
|
|
$update = [
|
|
'BIAYA_RP' => $biayaBaru,
|
|
'GP_RP' => $gpBaru
|
|
];
|
|
$action = $this->Amod->update('rekap_proyek', $update, 'ID_RP', $id_rp);
|
|
|
|
$value = 1;
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
|
|
}
|
|
|
|
public function PR_Kunci_Sub1_A3_DataRekapProyek() {
|
|
$id_rp = $this->input->post('id_rplock');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$tgl = date('Y-m-d');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$datRp = $this->Amod->getData_RekapProyek_byID_bySTATUS($id_rp, 1);
|
|
if ($datRp==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
if ($datRp[0]['GRUP_ID']==NULL) {
|
|
$cekProyek = $this->Amod->getData_Proyek_bySALES_byPERIODE_byJENIS_statusNot9_rpNull($datRp[0]['SAL_ID'], $datRp[0]['JENIS_PP'], $datRp[0]['AWAL_PP'], $datRp[0]['AKHIR_PP']);
|
|
if ($cekProyek==TRUE) {
|
|
$this->session->set_flashdata('proyekkuartal_notfinish', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$datProyek = $this->Amod->getData_Proyek_byRP($id_rp);
|
|
$biaya_rp = 0;
|
|
$gp_rp = 0;
|
|
foreach ($datProyek as $key) {
|
|
$update = [
|
|
'STATUS_PROYEK' => '2'
|
|
];
|
|
$action = $this->Amod->update('proyek', $update, 'ID_PROYEK', $key['ID_PROYEK']);
|
|
|
|
$biaya_rp = $biaya_rp+$key['BIAYA_PROYEK'];
|
|
$gp_rp = $gp_rp+$key['GP_PROYEK'];
|
|
}
|
|
|
|
$update = [
|
|
'STATUS_RP' => '2',
|
|
'TGL_KUNCI' => $tgl,
|
|
'BIAYA_RP' => $biaya_rp,
|
|
'GP_RP' => $gp_rp,
|
|
'KUNCI_RP' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('rekap_proyek', $update, 'ID_RP', $id_rp);
|
|
} else {
|
|
$grupBaru = $datRp[0]['GRUP_ID']+1;
|
|
$pp_id = $datRp[0]['PP_ID'];
|
|
$sal_id = $datRp[0]['SAL_ID'];
|
|
$biaya_rp = $datRp[0]['BIAYA_RP'];
|
|
$gp_rp = $datRp[0]['GP_RP'];
|
|
|
|
$update = [
|
|
'STATUS_RP' => '2',
|
|
'SEWA_RP' => $datRp[0]['SEWA_RP'],
|
|
'TGL_KUNCI' => $tgl,
|
|
'KUNCI_RP' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('rekap_proyek', $update, 'ID_RP', $id_rp);
|
|
|
|
$input = [
|
|
'PP_ID' => $pp_id,
|
|
'SAL_ID' => $sal_id,
|
|
'GRUP_ID' => $grupBaru,
|
|
'STATUS_RP' => '1',
|
|
'BIAYA_RP' => $biaya_rp,
|
|
'GP_RP' => $gp_rp
|
|
];
|
|
$action = $this->Amod->create('rekap_proyek', $input);
|
|
}
|
|
|
|
if ($action) {
|
|
$this->session->set_flashdata('success', 'dikunci');
|
|
redirect('Menu/PR_Sub1_Administrasi_1');
|
|
} else {
|
|
$this->session->set_flashdata('failed', 'dikunci');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
}
|
|
|
|
//SUBMENU TRANSAKSI - OLAH BARANG
|
|
public function PR_Sub1_OlahBarang_1() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$now = date('Y-m-d');
|
|
$limit = date('Y-m-01');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "PR", "TRANSAKSI - Olah Barang");
|
|
$id_menu = $datShm[0]['MENU_ID'];
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$datStpos = $this->Amod->getData_SetTogglePosisi_byKARYAWAN_byMENU($id_karyawan, $id_menu);
|
|
if ($datStpos==FALSE) { $posisiToggle = 0; } else { $posisiToggle = $datStpos[0]['AKTIF_STPOS']; }
|
|
|
|
if ($hak>=2) {
|
|
$proyekBerjalan = $this->Amod->getData_Proyek_forBerjalan();
|
|
$proyekBatal = $this->Amod->getData_Proyek_batalThisMonth($limit);
|
|
|
|
$noBatal = 0;
|
|
foreach ($proyekBatal as $key) {
|
|
$penggantiProyek = $this->Amod->getData_Proyek_byID($key['PENGGANTI_PROYEK']);
|
|
|
|
$proyekBatal[$noBatal] += ['PENGGANTIKODE' => $penggantiProyek[0]['KODE_PROYEK']];
|
|
$proyekBatal[$noBatal] += ['PENGGANTITANGGAL' => $penggantiProyek[0]['TANGGAL']];
|
|
$proyekBatal[$noBatal] += ['PENGGANTINILAI' => $penggantiProyek[0]['NILAI']];
|
|
$proyekBatal[$noBatal] += ['PENGGANTISALES' => $penggantiProyek[0]['NAMA_PANGGILAN_KARYAWAN']];
|
|
$proyekBatal[$noBatal] += ['PENGGANTIPELANGGAN' => $penggantiProyek[0]['NAMA_PELANGGAN']];
|
|
$proyekBatal[$noBatal++] += ['PENGGANTIPO' => $penggantiProyek[0]['PO_PROYEK']];
|
|
}
|
|
|
|
$countBerjalan = count($proyekBerjalan);
|
|
$countBatal = count($proyekBatal);
|
|
} else {
|
|
$proyekBerjalan = NULL;
|
|
$proyekBatal = NULL;
|
|
$countBerjalan = 0;
|
|
$countBatal = 0;
|
|
}
|
|
|
|
$data = array(
|
|
'sidebar' => "menu proyek",
|
|
'navChild' => "proyek olahbarang",
|
|
'proyekBerjalan' => $proyekBerjalan,
|
|
'proyekBatal' => $proyekBatal,
|
|
'countBerjalan' => $countBerjalan,
|
|
'countBatal' => $countBatal,
|
|
'id_menu' => $id_menu,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil,
|
|
'posisiToggle' => $posisiToggle,
|
|
'tgl' => $now,
|
|
);
|
|
$this->load->view('proses/PR_Sub1_OlahBarang_1', $data);
|
|
}
|
|
|
|
public function PR_Ubah_Sub1_DataProyek() {
|
|
$id_proyek = $this->input->post('id_proyeked');
|
|
$tgl_proyek = $this->input->post('tgl_proyeked');
|
|
$ket_proyek = $this->input->post('ket_proyeked');
|
|
$ket_proyek = preg_replace('/\R+/', " " , $ket_proyek);
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$datProyek = $this->Amod->getData_Proyek_byID_bySTATUS($id_proyek, 0);
|
|
if ($datProyek==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$datPp = $this->Amod->getData_PeriodeProyek_byJENIS_byPERIODE($datProyek[0]['JENIS_PROYEK'], $tgl_proyek);
|
|
if ($datPp==TRUE) {
|
|
$datRp = $this->Amod->getData_RekapProyek_bySALES_byPP($datProyek[0]['SALES_ID'], $datPp[0]['ID_PP']);
|
|
if ($datRp==TRUE AND $datRp[0]['STATUS_RP']==2) {
|
|
$this->session->set_flashdata('proyekkuartal_finish', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
}
|
|
|
|
$tempo_proyek = $this->Amod->generate_addDay($tgl_proyek, 90);
|
|
$update = [
|
|
'KET_PROYEK' => $ket_proyek,
|
|
'TGL_PROYEK' => $tgl_proyek,
|
|
'TEMPO_PROYEK' => $tempo_proyek,
|
|
'REVISI_PROYEK' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('proyek', $update, 'ID_PROYEK', $id_proyek);
|
|
|
|
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 PR_Sub1_OlahBarang_2($id) {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$now = date('Y-m-d');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "PR", "TRANSAKSI - Olah Barang");
|
|
$id_menu = $datShm[0]['MENU_ID'];
|
|
|
|
$datStgel = $this->Amod->getData_SetSubToggle_byKARYAWAN_byMENU($id_karyawan, $id_menu);
|
|
if ($datStgel==FALSE) { $posisiToggle = 0; } else { $posisiToggle = $datStgel[0]['AKTIF_STGEL']; }
|
|
|
|
$datProyek = $this->Amod->getData_Proyek_byID($id);
|
|
$datBarangOut = $this->Amod->getData_Barang_jenisNot2();
|
|
$datBarangIn = $this->Amod->getSum_DaftarProyek_byPROYEK_groupBARANG($id);
|
|
if ($datProyek[0]['STATUS_PROYEK']==1 AND $datProyek[0]['SEWA_PROYEK']!=NULL) {
|
|
$proyekTerkirim = $this->Amod->getSum_DaftarProyek_byPROYEK_groupBARANG_CDNotNull_groupRP($id);
|
|
} else {
|
|
$proyekTerkirim = $this->Amod->getSum_DaftarProyek_byPROYEK_groupBARANG_CDNotNull($id);
|
|
}
|
|
$proyekSurat = $this->Amod->getData_CetakDokumen_byPROYEK($id);
|
|
$proyekBuat = $this->Amod->getData_DaftarProyek_byPROYEK_CDNull($id);
|
|
|
|
if ($proyekBuat==TRUE) {
|
|
$lockJenisDpr = $proyekBuat[0]['JENIS_DPR'];
|
|
$no = 0;
|
|
foreach ($proyekBuat as $key) {
|
|
$countSnpr = $this->Amod->getCount_SnProyek_byDPR($key['ID_DPR']);
|
|
$proyekBuat[$no++] += ['REAL' => $countSnpr];
|
|
}
|
|
} else {
|
|
$lockJenisDpr = NULL;
|
|
}
|
|
|
|
$no = 0;
|
|
foreach ($proyekSurat as $key) {
|
|
$datDpr = $this->Amod->getData_DaftarProyek_byPROYEK_byCD($id, $key['ID_CD']);
|
|
|
|
$proyekSurat[$no] += ['LISTDPR' => $datDpr];
|
|
$proyekSurat[$no++] += ['JENIS_DPR' => $datDpr[0]['JENIS_DPR']];
|
|
}
|
|
|
|
$totDpr = 0;
|
|
$no = 0;
|
|
foreach ($proyekTerkirim as $key) {
|
|
if ($datProyek[0]['STATUS_PROYEK']==1 AND $datProyek[0]['SEWA_PROYEK']!=NULL) {
|
|
if ($key['SEWA_RP']==NULL) {
|
|
$datHq = $this->Amod->getData_HistoriKuantiti_byBARANG_byKODEBUKTI_beforeTGL_orderDESC_limit1($key['BARANG_ID'], $datProyek[0]['KODE_PROYEK'], $now);
|
|
} else {
|
|
$datHq = $this->Amod->getData_HistoriKuantiti_byBARANG_byKODEBUKTI_beforeTGL_orderDESC_limit1($key['BARANG_ID'], $datProyek[0]['KODE_PROYEK'], $key['SEWA_RP']);
|
|
}
|
|
} else {
|
|
$datHq = $this->Amod->getData_HistoriKuantiti_byBARANG_beforeTGL_orderDESC_limit1($key['BARANG_ID'], $now);
|
|
}
|
|
$hppDpr = round($datHq[0]['AVG_HQ'],2);
|
|
$subtot = $hppDpr*$key['SISA'];
|
|
$totDpr = $totDpr+round($subtot,2);
|
|
|
|
if ($datProyek[0]['STATUS_PROYEK']==0) {
|
|
$datSnpr = $this->Amod->getData_SnProyek_byBARANG_byPROYEK_status9_groupNAMASNPR($key['BARANG_ID'], $id);
|
|
} else {
|
|
$datSnpr = $this->Amod->getData_SnProyek_byBARANG_byPROYEK($key['BARANG_ID'], $id);
|
|
}
|
|
|
|
$proyekTerkirim[$no] += ['SNPR' => $datSnpr];
|
|
$proyekTerkirim[$no] += ['SATUAN' => number_format($hppDpr,2)];
|
|
$proyekTerkirim[$no++] += ['SUBTOT' => number_format(($hppDpr*$key['SISA']),2)];
|
|
}
|
|
|
|
$data = array(
|
|
'sidebar' => "menu proyek",
|
|
'navChild' => "proyek olahbarang",
|
|
'kode_proyek' => $datProyek[0]['KODE_PROYEK'],
|
|
'po_proyek' => $datProyek[0]['PO_PROYEK'],
|
|
'status_proyek' => $datProyek[0]['STATUS_PROYEK'],
|
|
'acc_gudang' => $datProyek[0]['ACC_GUDANG'],
|
|
'tgl_batal' => $datProyek[0]['TGL_BATAL'],
|
|
'nama_pelanggan' => substr($datProyek[0]['NAMA_PELANGGAN'],0,32),
|
|
'id_proyek' => $id,
|
|
'id_karyawan' => $id_karyawan,
|
|
'id_menu' => $id_menu,
|
|
'posisiToggle' => $posisiToggle,
|
|
'barangout' => $datBarangOut,
|
|
'barangin' => $datBarangIn,
|
|
'proyekBuat' => $proyekBuat,
|
|
'proyekTerkirim' => $proyekTerkirim,
|
|
'proyekSurat' => $proyekSurat,
|
|
'lockJenisDpr' => $lockJenisDpr,
|
|
'countTerkirim' => count($proyekTerkirim),
|
|
'nilaiDprTotal' => number_format($totDpr,2)
|
|
);
|
|
$this->load->view('proses/PR_Sub1_OlahBarang_2', $data);
|
|
}
|
|
|
|
public function PR_Ambil_Sub1_B2_DataSnStock() {
|
|
$id_dpr = $this->input->post('id_dpr');
|
|
|
|
$datDpr = $this->Amod->getData_DaftarProyek_byID($id_dpr);
|
|
$data = $this->Amod->getData_SnStock_byBARANG_byGUDANG_bySTATUS($datDpr[0]['BARANG_ID'], 1, 0);
|
|
$this->output_json(['value' => 1, 'total' => sizeof($data), 'data' => $data]);
|
|
}
|
|
|
|
public function PR_Ambil_Sub1_B2_DataSnprOut() {
|
|
$id_dpr = $this->input->post('id_dpr');
|
|
$id_proyek = $this->input->post('id_proyek');
|
|
|
|
$datDpr = $this->Amod->getData_DaftarProyek_byID($id_dpr);
|
|
$data = $this->Amod->getData_SnProyek_byDPR($id_dpr);
|
|
$snstock = $this->Amod->getData_SnStock_byBARANG_byGUDANG_bySTATUS($datDpr[0]['BARANG_ID'], 1, 0);
|
|
|
|
$barReady = [];
|
|
foreach ($snstock as $dat) {
|
|
$nama_snstock = $dat['NAMA_SNSTOCK'];
|
|
$hasil = "$nama_snstock";
|
|
array_push($barReady, $hasil);
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => 1,
|
|
'total' => sizeof($data),
|
|
'data' => $data,
|
|
'barangReady' => $barReady,
|
|
'qty' => $datDpr[0]['QTY_DPR']
|
|
]);
|
|
}
|
|
|
|
public function PR_Ambil_Sub1_B2_DataSnprAktif() {
|
|
$id_dpr = $this->input->post('id_dpr');
|
|
$id_proyek = $this->input->post('id_proyek');
|
|
|
|
$datDpr = $this->Amod->getData_DaftarProyek_byID($id_dpr);
|
|
$data = $this->Amod->getData_SnProyek_byBARANG_byPROYEK_status9_groupNAMASNPR($datDpr[0]['BARANG_ID'], $id_proyek);
|
|
$this->output_json(['value' => 1, 'total' => sizeof($data), 'data' => $data]);
|
|
}
|
|
|
|
public function PR_Ambil_Sub1_B2_DataSnprIn() {
|
|
$id_dpr = $this->input->post('id_dpr');
|
|
$id_proyek = $this->input->post('id_proyek');
|
|
|
|
$datDpr = $this->Amod->getData_DaftarProyek_byID($id_dpr);
|
|
$data = $this->Amod->getData_SnProyek_byDPR($id_dpr);
|
|
$datSnpr = $this->Amod->getData_SnProyek_byBARANG_byPROYEK_status9_groupNAMASNPR($datDpr[0]['BARANG_ID'], $id_proyek);
|
|
|
|
$barReady = [];
|
|
foreach ($datSnpr as $dat) {
|
|
$nama_snpr = $dat['NAMA_SNPR'];
|
|
$hasil = "$nama_snpr";
|
|
array_push($barReady, $hasil);
|
|
}
|
|
|
|
$this->output_json(['value' => 1, 'total' => sizeof($data), 'data' => $data, 'barangReady' => $barReady, 'qty' => $datDpr[0]['QTY_DPR']]);
|
|
}
|
|
|
|
public function PR_Tambah_Sub1_B2_DataDaftarProyek() {
|
|
$id_proyek = $this->input->post('id_proyeknew');
|
|
$jenis_dpr = $this->input->post('jenis_dprnew');
|
|
|
|
if ($jenis_dpr==0) {
|
|
$id_barang = $this->input->post('id_barangout');
|
|
$qty_dpr = $this->input->post('qty_dprout');
|
|
$gudangQty = 1;
|
|
} else if ($jenis_dpr==1) {
|
|
$id_barang = $this->input->post('id_barangin');
|
|
$qty_dpr = $this->input->post('qty_dprin');
|
|
$gudangQty = 9;
|
|
}
|
|
|
|
$datProyek = $this->Amod->getData_Proyek_byID($id_proyek);
|
|
if ($datProyek==FALSE OR $datProyek[0]['STATUS_PROYEK']>1) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$cekCDDpr = $this->Amod->getData_DaftarProyek_byPROYEK_CDNull($id_proyek);
|
|
if ($cekCDDpr==TRUE AND $cekCDDpr[0]['JENIS_DPR']!=$jenis_dpr) {
|
|
$this->session->set_flashdata('dpr_cdnull_differror', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$cekBarangDpr = $this->Amod->getData_DaftarProyek_byPROYEK_byBARANG_CDNull($id_proyek, $id_barang);
|
|
if ($cekBarangDpr==TRUE) {
|
|
$this->session->set_flashdata('barangid_same', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
if ($qty_dpr<=0) {
|
|
$this->session->set_flashdata('less_same_zero', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$cekKuantiti = $this->GE_AmbilData_DataKuantiti($id_barang, $gudangQty);
|
|
if ($cekKuantiti<$qty_dpr) {
|
|
if ($gudangQty==1) {
|
|
$this->session->set_flashdata('qty_pcm_less', 'error');
|
|
} else if ($gudangQty==9) {
|
|
$this->session->set_flashdata('qty_proyek_less', 'error');
|
|
}
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$sj_dpr = $this->Amod->getMax_SJDPR_DaftarProyek_byPROYEK_CDNotNull($id_proyek);
|
|
$sj_dprNew = $sj_dpr[0]['SJ_DPR']+1;
|
|
|
|
if ($jenis_dpr==0) {
|
|
$input = [
|
|
'JENIS_DPR' => $jenis_dpr,
|
|
'SJ_DPR' => $sj_dprNew,
|
|
'MASUK_DPR' => '0',
|
|
'BARANG_ID' => $id_barang,
|
|
'QTY_DPR' => $qty_dpr,
|
|
'KELUAR_DPR' => $qty_dpr,
|
|
'PROYEK_ID' => $id_proyek,
|
|
];
|
|
$action = $this->Amod->create('daftar_proyek', $input);
|
|
} else if ($jenis_dpr==1) {
|
|
$input = [
|
|
'JENIS_DPR' => $jenis_dpr,
|
|
'SJ_DPR' => $sj_dprNew,
|
|
'KELUAR_DPR' => '0',
|
|
'BARANG_ID' => $id_barang,
|
|
'QTY_DPR' => $qty_dpr,
|
|
'MASUK_DPR' => $qty_dpr,
|
|
'PROYEK_ID' => $id_proyek,
|
|
];
|
|
$action = $this->Amod->create('daftar_proyek', $input);
|
|
}
|
|
|
|
$this->GE_Kalkulasi_KuantitiBarang($id_barang, 1, "Step 1 - PROYEK - Tambah Data", $jenis_dpr, $qty_dpr);
|
|
|
|
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 PR_Hapus_Sub1_B2_DataDaftarProyek() {
|
|
$id_dpr = $this->input->post('id_dprdel');
|
|
$id_proyek = $this->input->post('id_proyekdel');
|
|
|
|
$datProyek = $this->Amod->getData_Proyek_byID_bySTATUS($id_proyek, 0);
|
|
if ($datProyek==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$datDpr = $this->Amod->getData_DaftarProyek_byID($id_dpr);
|
|
if ($datDpr==FALSE OR $datDpr[0]['CD_ID']!=NULL) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$this->GE_Kalkulasi_KuantitiBarang($datDpr[0]['BARANG_ID'], 1, "Step 1 - PROYEK - Hapus Data", $datDpr[0]['JENIS_DPR'], $datDpr[0]['QTY_DPR']);
|
|
|
|
if ($datDpr[0]['JENIS_DPR']==0) {
|
|
$datSnpr = $this->Amod->getData_SnProyek_byDPR($id_dpr);
|
|
foreach ($datSnpr as $key) {
|
|
$datSnStock = $this->Amod->getData_SnStock_byNAMA_bySTATUS($key['NAMA_SNPR'], 9);
|
|
if ($datSnStock==TRUE) {
|
|
$update = [
|
|
'STATUS_SNSTOCK' => '0'
|
|
];
|
|
$action = $this->Amod->update('sn_stock', $update, 'ID_SNSTOCK', $datSnStock[0]['ID_SNSTOCK']);
|
|
}
|
|
}
|
|
} else if ($datDpr[0]['JENIS_DPR']==1) {
|
|
$datSnpr = $this->Amod->getData_SnProyek_byDPR($id_dpr);
|
|
foreach ($datSnpr as $key) {
|
|
$datSnStock = $this->Amod->getData_SnStock_byNAMA_bySTATUS($key['NAMA_SNPR'], 0);
|
|
if ($datSnStock==TRUE) {
|
|
$update = [
|
|
'STATUS_SNSTOCK' => '19'
|
|
];
|
|
$action = $this->Amod->update('sn_stock', $update, 'ID_SNSTOCK', $datSnStock[0]['ID_SNSTOCK']);
|
|
}
|
|
}
|
|
}
|
|
|
|
$action = $this->Amod->delete('sn_proyek', $id_dpr, 'DPR_ID');
|
|
$action = $this->Amod->delete('daftar_proyek', $id_dpr, 'ID_DPR');
|
|
|
|
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 PR_Simpan_Sub1_B2_DataSnProyekKeluar() {
|
|
$id_snstock = $this->input->post('id_snstock');
|
|
$id_dpr = $this->input->post('id_dpr');
|
|
$id_proyek = $this->input->post('id_proyek');
|
|
|
|
$value = 0;
|
|
$datProyek = $this->Amod->getData_Proyek_byID($id_proyek);
|
|
if ($datProyek==FALSE) {
|
|
$value = 6;
|
|
} else {
|
|
$datDpr = $this->Amod->getData_DaftarProyek_byID($id_dpr);
|
|
if ($datDpr==FALSE) {
|
|
$value = 5;
|
|
} else {
|
|
$datSnStock = $this->Amod->getData_SnStock_byID_bySTATUS($id_snstock, 0);
|
|
if ($datSnStock==FALSE) {
|
|
$value = 4;
|
|
} else {
|
|
$countBefore = $this->Amod->getCount_SnProyek_byDPR($id_dpr);
|
|
if ($countBefore>=$datDpr[0]['QTY_DPR']) {
|
|
$value = 3;
|
|
} else {
|
|
$input = [
|
|
'NAMA_SNPR' => $datSnStock[0]['NAMA_SNSTOCK'],
|
|
'DPR_ID' => $id_dpr,
|
|
];
|
|
$action = $this->Amod->create('sn_proyek', $input);
|
|
|
|
$update = [
|
|
'STATUS_SNSTOCK' => '9'
|
|
];
|
|
$action = $this->Amod->update('sn_stock', $update, 'ID_SNSTOCK', $id_snstock);
|
|
|
|
$countAfter = $this->Amod->getCount_SnProyek_byDPR($id_dpr);
|
|
if ($countAfter==$datDpr[0]['QTY_DPR']) {
|
|
$value = 2;
|
|
} else {
|
|
$value = 1;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
}
|
|
|
|
public function PR_Simpan_Sub1_B2_DataSnProyekMasuk() {
|
|
$id_dpr = $this->input->post('id_dpr');
|
|
$id_proyek = $this->input->post('id_proyek');
|
|
$nama_snpr = $this->input->post('nama_snpr');
|
|
$nama_snpr = strtoupper($nama_snpr);
|
|
|
|
$value = 0;
|
|
$datProyek = $this->Amod->getData_Proyek_byID($id_proyek);
|
|
if ($datProyek==FALSE) {
|
|
$value = 6;
|
|
} else {
|
|
$datDpr = $this->Amod->getData_DaftarProyek_byID($id_dpr);
|
|
if ($datDpr==FALSE) {
|
|
$value = 5;
|
|
} else {
|
|
$datSnStock = $this->Amod->getData_SnStock_byNAMA_bySTATUS($nama_snpr, 9);
|
|
if ($datSnStock==FALSE) {
|
|
$value = 4;
|
|
} else {
|
|
$countBefore = $this->Amod->getCount_SnProyek_byDPR($id_dpr);
|
|
if ($countBefore>=$datDpr[0]['QTY_DPR']) {
|
|
$value = 3;
|
|
} else {
|
|
$input = [
|
|
'NAMA_SNPR' => $nama_snpr,
|
|
'DPR_ID' => $id_dpr,
|
|
];
|
|
$action = $this->Amod->create('sn_proyek', $input);
|
|
|
|
$update = [
|
|
'STATUS_SNSTOCK' => '0'
|
|
];
|
|
$action = $this->Amod->update('sn_stock', $update, 'ID_SNSTOCK', $datSnStock[0]['ID_SNSTOCK']);
|
|
|
|
$countAfter = $this->Amod->getCount_SnProyek_byDPR($id_dpr);
|
|
if ($countAfter==$datDpr[0]['QTY_DPR']) {
|
|
$value = 2;
|
|
} else {
|
|
$value = 1;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
}
|
|
|
|
public function PR_Simpan_Sub1_B2_DataSnProyekKeluarBarcode() {
|
|
$id_snpr = $this->input->post('id_snpr');
|
|
$id_dpr = $this->input->post('id_dpr');
|
|
$id_proyek = $this->input->post('id_proyek');
|
|
$nama_snpr = $this->input->post('nama_snpr');
|
|
$nama_snpr = strtoupper($nama_snpr);
|
|
|
|
$value = 0;
|
|
$datProyek = $this->Amod->getData_Proyek_byID($id_proyek);
|
|
if ($datProyek==FALSE) {
|
|
$value = 9;
|
|
} else {
|
|
$datDpr = $this->Amod->getData_DaftarProyek_byID($id_dpr);
|
|
if ($datDpr==FALSE) {
|
|
$value = 8;
|
|
} else {
|
|
$datSnStock = $this->Amod->getData_SnStock_byNAMA_allStatus($nama_snpr);
|
|
if ($datSnStock==FALSE) {
|
|
$value = 7;
|
|
} else {
|
|
if ($datSnStock[0]['STATUS_SNSTOCK']!=0) {
|
|
$value = 6;
|
|
} else {
|
|
if ($datSnStock[0]['BARANG_ID']!=$datDpr[0]['BARANG_ID']) {
|
|
$value = 5;
|
|
} else {
|
|
if ($datSnStock[0]['GUDANG_SNSTOCK']!="1") {
|
|
$value = 4;
|
|
} else {
|
|
$countBefore = $this->Amod->getCount_SnProyek_byDPR($id_dpr);
|
|
if ($countBefore>=$datDpr[0]['QTY_DPR']) {
|
|
$value = 3;
|
|
} else {
|
|
$input = [
|
|
'NAMA_SNPR' => $nama_snpr,
|
|
'DPR_ID' => $id_dpr,
|
|
];
|
|
$action = $this->Amod->create('sn_proyek', $input);
|
|
|
|
$update = [
|
|
'STATUS_SNSTOCK' => '9'
|
|
];
|
|
$action = $this->Amod->update('sn_stock', $update, 'ID_SNSTOCK', $datSnStock[0]['ID_SNSTOCK']);
|
|
|
|
$countAfter = $this->Amod->getCount_SnProyek_byDPR($id_dpr);
|
|
if ($countAfter==$datDpr[0]['QTY_DPR']) {
|
|
$value = 2;
|
|
} else {
|
|
$value = 1;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
}
|
|
|
|
public function PR_Simpan_Sub1_B2_DataSnProyekMasukBarcode() {
|
|
$id_snpr = $this->input->post('id_snpr');
|
|
$id_dpr = $this->input->post('id_dpr');
|
|
$id_proyek = $this->input->post('id_proyek');
|
|
$nama_snpr = $this->input->post('nama_snpr');
|
|
$nama_snpr = strtoupper($nama_snpr);
|
|
|
|
$value = 0;
|
|
$datProyek = $this->Amod->getData_Proyek_byID($id_proyek);
|
|
if ($datProyek==FALSE) {
|
|
$value = 9;
|
|
} else {
|
|
$datDpr = $this->Amod->getData_DaftarProyek_byID($id_dpr);
|
|
if ($datDpr==FALSE) {
|
|
$value = 8;
|
|
} else {
|
|
$datSnStock = $this->Amod->getData_SnStock_byNAMA_allStatus($nama_snpr);
|
|
if ($datSnStock==FALSE) {
|
|
$value = 7;
|
|
} else {
|
|
if ($datSnStock[0]['STATUS_SNSTOCK']!=9) {
|
|
$value = 6;
|
|
} else {
|
|
if ($datSnStock[0]['BARANG_ID']!=$datDpr[0]['BARANG_ID']) {
|
|
$value = 5;
|
|
} else {
|
|
if ($datSnStock[0]['GUDANG_SNSTOCK']!="1") {
|
|
$value = 4;
|
|
} else {
|
|
$countBefore = $this->Amod->getCount_SnProyek_byDPR($id_dpr);
|
|
if ($countBefore>=$datDpr[0]['QTY_DPR']) {
|
|
$value = 3;
|
|
} else {
|
|
$input = [
|
|
'NAMA_SNPR' => $nama_snpr,
|
|
'DPR_ID' => $id_dpr,
|
|
];
|
|
$action = $this->Amod->create('sn_proyek', $input);
|
|
|
|
$update = [
|
|
'STATUS_SNSTOCK' => '0'
|
|
];
|
|
$action = $this->Amod->update('sn_stock', $update, 'ID_SNSTOCK', $datSnStock[0]['ID_SNSTOCK']);
|
|
|
|
$countAfter = $this->Amod->getCount_SnProyek_byDPR($id_dpr);
|
|
if ($countAfter==$datDpr[0]['QTY_DPR']) {
|
|
$value = 2;
|
|
} else {
|
|
$value = 1;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
}
|
|
|
|
public function PR_Hapus_Sub1_B2_DataSnProyekKeluar() {
|
|
$id_snpr = $this->input->post('id_snpr');
|
|
$id_dpr = $this->input->post('id_dpr');
|
|
$id_proyek = $this->input->post('id_proyek');
|
|
|
|
$value = 0;
|
|
$datProyek = $this->Amod->getData_Proyek_byID($id_proyek);
|
|
if ($datProyek==FALSE) {
|
|
$value = 5;
|
|
} else {
|
|
$datDpr = $this->Amod->getData_DaftarProyek_byID($id_dpr);
|
|
if ($datDpr==FALSE) {
|
|
$value = 4;
|
|
} else {
|
|
$datSnpr = $this->Amod->getData_SnProyek_byID_bySTATUS($id_snpr, 9);
|
|
if ($datSnpr==FALSE) {
|
|
$value = 3;
|
|
} else {
|
|
$countBefore = $this->Amod->getCount_SnProyek_byDPR($id_dpr);
|
|
|
|
$update = [
|
|
'STATUS_SNSTOCK' => '0'
|
|
];
|
|
$action = $this->Amod->update('sn_stock', $update, 'ID_SNSTOCK', $datSnpr[0]['ID_SNSTOCK']);
|
|
$action = $this->Amod->delete('sn_proyek', $id_snpr, 'ID_SNPR');
|
|
|
|
if ($countBefore==$datDpr[0]['QTY_DPR']) {
|
|
$value = 2;
|
|
} else {
|
|
$value = 1;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
}
|
|
|
|
public function PR_Hapus_Sub1_B2_DataSnProyekMasuk() {
|
|
$id_snpr = $this->input->post('id_snpr');
|
|
$id_dpr = $this->input->post('id_dpr');
|
|
$id_proyek = $this->input->post('id_proyek');
|
|
|
|
$value = 0;
|
|
$datProyek = $this->Amod->getData_Proyek_byID($id_proyek);
|
|
if ($datProyek==FALSE) {
|
|
$value = 5;
|
|
} else {
|
|
$datDpr = $this->Amod->getData_DaftarProyek_byID($id_dpr);
|
|
if ($datDpr==FALSE) {
|
|
$value = 4;
|
|
} else {
|
|
$datSnpr = $this->Amod->getData_SnProyek_byID_bySTATUS($id_snpr, 0);
|
|
if ($datSnpr==FALSE) {
|
|
$value = 3;
|
|
} else {
|
|
$countBefore = $this->Amod->getCount_SnProyek_byDPR($id_dpr);
|
|
|
|
$update = [
|
|
'STATUS_SNSTOCK' => '9'
|
|
];
|
|
$action = $this->Amod->update('sn_stock', $update, 'ID_SNSTOCK', $datSnpr[0]['ID_SNSTOCK']);
|
|
$action = $this->Amod->delete('sn_proyek', $id_snpr, 'ID_SNPR');
|
|
|
|
if ($countBefore==$datDpr[0]['QTY_DPR']) {
|
|
$value = 2;
|
|
} else {
|
|
$value = 1;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
}
|
|
|
|
public function PR_Proses_Sub1_B2_DataProyek() {
|
|
$id_proyek = $this->input->post('id_proyekpro');
|
|
$now = date('Y-m-d');
|
|
|
|
$datProyek = $this->Amod->getData_Proyek_byID($id_proyek);
|
|
if ($datProyek==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$datDpr = $this->Amod->getData_DaftarProyek_byPROYEK_CDNull($id_proyek);
|
|
if ($datDpr==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
foreach ($datDpr as $key) {
|
|
$countSnpr = $this->Amod->getCount_SnProyek_byDPR($key['ID_DPR']);
|
|
if ($key['TYPE_JENIS']==1 AND $countSnpr<$key['QTY_DPR']) {
|
|
$this->session->set_flashdata('sncount_less', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
}
|
|
|
|
$kode_proyek = $datProyek[0]['KODE_PROYEK'];
|
|
$sj_dpr = $datDpr[0]['SJ_DPR'];
|
|
if ($sj_dpr<10) {
|
|
$ke = "0$sj_dpr";
|
|
} else {
|
|
$ke = "$sj_dpr";
|
|
}
|
|
|
|
if ($datDpr[0]['JENIS_DPR']==0) {
|
|
$sj = "SJK";
|
|
} else if ($datDpr[0]['JENIS_DPR']==1) {
|
|
$sj = "SJM";
|
|
}
|
|
|
|
$kode_bukti = "$kode_proyek/$ke/$sj";
|
|
|
|
$input = [
|
|
'SJ_INV' => '0',
|
|
'KODE_BUKTI' => $kode_bukti,
|
|
'PROYEK_ID' => $id_proyek,
|
|
'TGL_CD' => $now,
|
|
];
|
|
$action = $this->Amod->create('cetak_dokumen', $input);
|
|
|
|
$id_cd = $this->Amod->getMax_ID_CetakDokumen();
|
|
$id_cd = $id_cd[0]['ID_CD'];
|
|
|
|
foreach ($datDpr as $key) {
|
|
$update = [
|
|
'CD_ID' => $id_cd
|
|
];
|
|
$action = $this->Amod->update('daftar_proyek', $update, 'ID_DPR', $key['ID_DPR']);
|
|
}
|
|
|
|
if ($action) {
|
|
$this->session->set_flashdata('success', 'diproses');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
} else {
|
|
$this->session->set_flashdata('failed', 'diproses');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
}
|
|
|
|
public function PR_Cetak_Sub1_B2_SuratJalan($id) {
|
|
$datCetak = $this->Amod->getData_CetakDokumen_byID($id);
|
|
$datProyek = $this->Amod->getData_Proyek_byID($datCetak[0]['PROYEK_ID']);
|
|
$datDpr = $this->Amod->getData_DaftarProyek_byCD($id);
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
$now = date('Y-m-d');
|
|
|
|
$no = 0;
|
|
$wide = 0;
|
|
foreach ($datDpr as $key) {
|
|
$datSnpr = $this->Amod->getData_SnProyek_byDPR($key['ID_DPR']);
|
|
$datDpr[$no++] += ['SN' => $datSnpr];
|
|
if (count($datSnpr)>15) {
|
|
$wide++;
|
|
}
|
|
}
|
|
|
|
if (count($datDpr)>5) {
|
|
$wide++;
|
|
}
|
|
|
|
$input = [
|
|
'CD_ID' => $id,
|
|
'TGL_HCD' => $now,
|
|
'KERTAS_HCD' => 1,
|
|
'SN_HCD' => 1,
|
|
'PPN_HCD' => 0,
|
|
'DP_HCD' => 0,
|
|
'CETAK_HCD' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->create('histori_cetakdokumen', $input);
|
|
|
|
$data = [
|
|
'cetak' => $datCetak,
|
|
'proyek' => $datProyek,
|
|
'barang' => $datDpr,
|
|
'wide' => $wide
|
|
];
|
|
$this->load->view('cetak/SJ_BarangProyek', $data);
|
|
|
|
}
|
|
|
|
public function PR_Proses_Sub1_DataAccForm() {
|
|
$id_proyek = $this->input->post('id_proyekaccform');
|
|
$jenis_proyek = $this->input->post('jenis_proyekaccform');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
$now = date('Y-m-d');
|
|
|
|
$datProyek = $this->Amod->getData_Proyek_byID_bySTATUS($id_proyek, 9);
|
|
if ($datProyek==FALSE OR $datProyek[0]['TGL_BATAL']!=NULL) {
|
|
$this->session->set_flashdata('not_valid', 'error');
|
|
if ($jenis_proyek==1) {
|
|
redirect('Menu/PR_Sub1_OlahBarang_1');
|
|
} else if ($jenis_proyek==2) {
|
|
redirect('Menu/PR_Sub1_Administrasi_1');
|
|
} else if ($jenis_proyek==3) {
|
|
redirect('Menu/PR_Sub1_Pengawasan_1');
|
|
}
|
|
}
|
|
|
|
if ($jenis_proyek==1) {
|
|
if ($datProyek[0]['ACC_GUDANG']!=NULL) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
} else if ($jenis_proyek==2) {
|
|
if ($datProyek[0]['ACC_KEUANGAN']!=NULL) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
} else if ($jenis_proyek==3) {
|
|
if ($datProyek[0]['ACC_KADIV']!=NULL) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
}
|
|
|
|
if ($jenis_proyek==1) {
|
|
$update = [
|
|
'ACC_GUDANG' => $timestamp
|
|
];
|
|
} else if ($jenis_proyek==2) {
|
|
$update = [
|
|
'ACC_KEUANGAN' => $timestamp
|
|
];
|
|
} else if ($jenis_proyek==3) {
|
|
$update = [
|
|
'ACC_KADIV' => $timestamp
|
|
];
|
|
}
|
|
$action = $this->Amod->update('proyek', $update, 'ID_PROYEK', $id_proyek);
|
|
|
|
$datProyekOld = $this->Amod->getData_Proyek_byID_bySTATUS($id_proyek, 9);
|
|
|
|
if ($datProyekOld[0]['ACC_GUDANG']!=NULL AND $datProyekOld[0]['ACC_KEUANGAN']!=NULL AND $datProyekOld[0]['ACC_KADIV']!=NULL) {
|
|
$datProyekNew = $this->Amod->getData_Proyek_byID_bySTATUS($datProyekOld[0]['PENGGANTI_PROYEK'], 0);
|
|
$kode_proyekNew = $datProyekNew[0]['KODE_PROYEK'];
|
|
|
|
$sj_dprOld = $this->Amod->getMax_SJDPR_DaftarProyek_byPROYEK_CDNotNull($id_proyek);
|
|
$sj_dprOld = $sj_dprOld[0]['SJ_DPR'];
|
|
$sj_dprNew = $this->Amod->getMax_SJDPR_DaftarProyek_byPROYEK_CDNotNull($datProyekOld[0]['PENGGANTI_PROYEK']);
|
|
$sj_dprNew = $sj_dprNew[0]['SJ_DPR'];
|
|
for ($i=1 ; $i<=$sj_dprOld; $i++) {
|
|
$sj_dprNew++;
|
|
$datDprOld = $this->Amod->getData_DaftarProyek_byPROYEK_bySJ($id_proyek, $i);
|
|
|
|
if ($sj_dprNew<10) {
|
|
$ke = "0$sj_dprNew";
|
|
} else {
|
|
$ke = "$sj_dprNew";
|
|
}
|
|
|
|
if ($datDprOld[0]['JENIS_DPR']==0) {
|
|
$sj = "SJK";
|
|
} else if ($datDprOld[0]['JENIS_DPR']==1) {
|
|
$sj = "SJM";
|
|
}
|
|
|
|
$kode_bukti = "$kode_proyekNew/$ke/$sj";
|
|
|
|
$input = [
|
|
'SJ_INV' => '0',
|
|
'KODE_BUKTI' => $kode_bukti,
|
|
'PROYEK_ID' => $datProyekOld[0]['PENGGANTI_PROYEK'],
|
|
'TGL_CD' => $now,
|
|
];
|
|
$action = $this->Amod->create('cetak_dokumen', $input);
|
|
|
|
$id_cd = $this->Amod->getMax_ID_CetakDokumen();
|
|
$id_cd = $id_cd[0]['ID_CD'];
|
|
|
|
foreach ($datDprOld as $dat) {
|
|
$datSnprOld = $this->Amod->getData_SnProyek_byDPR($dat['ID_DPR']);
|
|
|
|
$input = [
|
|
'PROYEK_ID' => $datProyekOld[0]['PENGGANTI_PROYEK'],
|
|
'JENIS_DPR' => $dat['JENIS_DPR'],
|
|
'SJ_DPR' => $sj_dprNew,
|
|
'BARANG_ID' => $dat['BARANG_ID'],
|
|
'QTY_DPR' => $dat['QTY_DPR'],
|
|
'KELUAR_DPR' => $dat['KELUAR_DPR'],
|
|
'MASUK_DPR' => $dat['MASUK_DPR'],
|
|
'CD_ID' => $id_cd,
|
|
];
|
|
$action = $this->Amod->create('daftar_proyek', $input);
|
|
|
|
if ($datSnprOld==TRUE) {
|
|
$id_dpr = $this->Amod->getMax_ID_DaftarProyek();
|
|
$id_dpr = $id_dpr[0]['ID_DPR'];
|
|
|
|
foreach ($datSnprOld as $dit) {
|
|
$input = [
|
|
'DPR_ID' => $id_dpr,
|
|
'NAMA_SNPR' => $dit['NAMA_SNPR']
|
|
];
|
|
$action = $this->Amod->create('sn_proyek', $input);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byPROYEK_byPERKIRAAN_bySearch($id_proyek, 70);
|
|
foreach ($datDak as $dut) {
|
|
$update = [
|
|
'PROYEK_ID' => $datProyekOld[0]['PENGGANTI_PROYEK']
|
|
];
|
|
$action = $this->Amod->update('daftar_akuntansi', $update, 'ID_DAK', $dut['ID_DAK']);
|
|
}
|
|
|
|
$update = [
|
|
'TGL_BATAL' => $now
|
|
];
|
|
$action = $this->Amod->update('proyek', $update, 'ID_PROYEK', $id_proyek);
|
|
}
|
|
|
|
if ($action) {
|
|
$this->session->set_flashdata('success', 'diproses');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
} else {
|
|
$this->session->set_flashdata('failed', 'diproses');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
}
|
|
|
|
//SUBMENU TRANSAKSI - ADMINISTRASI
|
|
public function PR_Sub1_Administrasi_1() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$now = date('Y-m-d');
|
|
$limit = date('Y-m-01');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "PR", "TRANSAKSI - Administrasi");
|
|
$id_menu = $datShm[0]['MENU_ID'];
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$datStpos = $this->Amod->getData_SetTogglePosisi_byKARYAWAN_byMENU($id_karyawan, $id_menu);
|
|
if ($datStpos==FALSE) { $posisiToggle = 0; } else { $posisiToggle = $datStpos[0]['AKTIF_STPOS']; }
|
|
|
|
if ($hak>0) {
|
|
$proyekBerjalan = $this->Amod->getData_Proyek_statusUntil1();
|
|
$proyekBatal = $this->Amod->getData_Proyek_batalThisMonth($limit);
|
|
$proyekLaporan = $this->Amod->getData_RekapProyek_bySTATUS(1);
|
|
$proyekSiap = $this->Amod->getData_RekapProyek_bySTATUS_afterLimit(2, $limit);
|
|
|
|
$noBatal = 0;
|
|
foreach ($proyekBatal as $key) {
|
|
$penggantiProyek = $this->Amod->getData_Proyek_byID($key['PENGGANTI_PROYEK']);
|
|
|
|
$proyekBatal[$noBatal] += ['PENGGANTIKODE' => $penggantiProyek[0]['KODE_PROYEK']];
|
|
$proyekBatal[$noBatal] += ['PENGGANTITANGGAL' => $penggantiProyek[0]['TANGGAL']];
|
|
$proyekBatal[$noBatal] += ['PENGGANTINILAI' => $penggantiProyek[0]['NILAI']];
|
|
$proyekBatal[$noBatal] += ['PENGGANTISALES' => $penggantiProyek[0]['NAMA_PANGGILAN_KARYAWAN']];
|
|
$proyekBatal[$noBatal] += ['PENGGANTIPELANGGAN' => $penggantiProyek[0]['NAMA_PELANGGAN']];
|
|
$proyekBatal[$noBatal++] += ['PENGGANTIPO' => $penggantiProyek[0]['PO_PROYEK']];
|
|
}
|
|
|
|
$noLaporan = 0;
|
|
foreach ($proyekLaporan as $kay) {
|
|
if ($kay['GRUP_ID']==NULL) {
|
|
$awalPeriode = "";
|
|
$akhirPeriode = "";
|
|
} else {
|
|
$awalPeriode = $this->Amod->generate_addMonth($kay['AWAL_PP'],(($kay['GRUP_ID']-1)*3));
|
|
$akhirPeriode = $this->Amod->generate_addMonth($kay['AWAL_PP'],($kay['GRUP_ID']*3));
|
|
$akhirPeriode = $this->Amod->generate_subDay($akhirPeriode, 1);
|
|
}
|
|
|
|
$dppSo = 0;
|
|
$biayaProyek = 0;
|
|
$gpProyek = 0;
|
|
$kunciProyek = 0;
|
|
if ($kay['JENIS_PP']<=2) {
|
|
$countProyekLapor = $this->Amod->getCount_Proyek_byRP_orderPELANGGAN($kay['ID_RP']);
|
|
$countProyekAll = $this->Amod->getCount_Proyek_bySALES_byPERIODE_statusUntil1($kay['SAL_ID'], $kay['AWAL_PP'], $kay['AKHIR_PP']);
|
|
|
|
$sumSpr = $this->Amod->getSum_SoProyek_byRP($kay['ID_RP']);
|
|
if ($sumSpr==TRUE AND $sumSpr[0]['TOTAL']!=NULL) {
|
|
$dppSo = $sumSpr[0]['TOTAL'];
|
|
}
|
|
|
|
$sumProyek = $this->Amod->getSum_Proyek_byRP($kay['ID_RP']);
|
|
if ($sumProyek==TRUE AND $sumProyek[0]['BIAYA']!=NULL) {
|
|
$biayaProyek = $sumProyek[0]['BIAYA'];
|
|
$gpProyek = $sumProyek[0]['GP'];
|
|
}
|
|
} else if ($kay['JENIS_PP']==3) {
|
|
$grupDo = $kay['GRUP_ID']-1;
|
|
$cekRp = $this->Amod->getData_RekapProyek_bySALES_byPP_byGRUP($kay['SAL_ID'], $kay['PP_ID'], $grupDo);
|
|
if ($cekRp==TRUE AND strtotime($now)<strtotime($akhirPeriode)) {
|
|
$kunciProyek = 1;
|
|
}
|
|
|
|
$countProyekLapor = 0;
|
|
$countProyekAll = 0;
|
|
$biayaProyek = $kay['BIAYA_RP'];
|
|
$gpProyek = $kay['GP_RP'];
|
|
$dppSo = $biayaProyek+$gpProyek;
|
|
}
|
|
|
|
$proyekLaporan[$noLaporan] += ['AWALPP'=> date_format(date_create($awalPeriode), "d/m/Y")];
|
|
$proyekLaporan[$noLaporan] += ['AKHIRPP'=> date_format(date_create($akhirPeriode), "d/m/Y")];
|
|
$proyekLaporan[$noLaporan] += ['KUNCIPROYEK'=> $kunciProyek];
|
|
$proyekLaporan[$noLaporan] += ['COUNTLAP'=> $countProyekLapor];
|
|
$proyekLaporan[$noLaporan] += ['COUNTALL'=> $countProyekAll];
|
|
$proyekLaporan[$noLaporan] += ['NOTA'=> number_format($dppSo,2)];
|
|
$proyekLaporan[$noLaporan] += ['BIAYA'=> number_format($biayaProyek,2)];
|
|
$proyekLaporan[$noLaporan++] += ['GP'=> number_format($gpProyek,2)];
|
|
}
|
|
|
|
$noSiap = 0;
|
|
foreach ($proyekSiap as $kay) {
|
|
$dppSo = 0;
|
|
if ($kay['JENIS_PP']<=2) {
|
|
$sumSpr = $this->Amod->getSum_SoProyek_byRP($kay['ID_RP']);
|
|
if ($sumSpr==TRUE AND $sumSpr[0]['TOTAL']!=NULL) {
|
|
$dppSo = $sumSpr[0]['TOTAL'];
|
|
}
|
|
} else if ($kay['JENIS_PP']==3) {
|
|
$dppSo = $kay['BIAYA_RP']+$kay['GP_RP'];
|
|
}
|
|
|
|
$proyekSiap[$noSiap++] += ['NOTA'=> number_format($dppSo,2)];
|
|
}
|
|
|
|
$countBerjalan = count($proyekBerjalan);
|
|
$countBatal = count($proyekBatal);
|
|
$countLaporan = count($proyekLaporan);
|
|
$countSiap = count($proyekSiap);
|
|
} else {
|
|
$proyekBerjalan = NULL;
|
|
$proyekBatal = NULL;
|
|
$proyekLaporan = NULL;
|
|
$proyekSiap = NULL;
|
|
$countBerjalan = 0;
|
|
$countBatal = 0;
|
|
$countLaporan = 0;
|
|
$countSiap = 0;
|
|
}
|
|
|
|
$data = array(
|
|
'sidebar' => "menu proyek",
|
|
'navChild' => "proyek administrasi",
|
|
'proyekBerjalan' => $proyekBerjalan,
|
|
'proyekBatal' => $proyekBatal,
|
|
'proyekLaporan' => $proyekLaporan,
|
|
'proyekSiap' => $proyekSiap,
|
|
'countBerjalan' => $countBerjalan,
|
|
'countBatal' => $countBatal,
|
|
'countLaporan' => $countLaporan,
|
|
'countSiap' => $countSiap,
|
|
'id_menu' => $id_menu,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil,
|
|
'posisiToggle' => $posisiToggle,
|
|
'tgl' => $now,
|
|
);
|
|
$this->load->view('proses/PR_Sub1_Administrasi_1', $data);
|
|
}
|
|
|
|
public function PR_Revisi_Sub1_C1_DataRekapProyek() {
|
|
$id_rp = $this->input->post('id_rprev');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$datRp = $this->Amod->getData_RekapProyek_byID_bySTATUS($id_rp, 2);
|
|
if ($datRp==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
if ($datRp[0]['GRUP_ID']==NULL) {
|
|
$datProyek = $this->Amod->getData_Proyek_byRP($id_rp);
|
|
foreach ($datProyek as $key) {
|
|
$update = [
|
|
'STATUS_PROYEK' => '1'
|
|
];
|
|
$action = $this->Amod->update('proyek', $update, 'ID_PROYEK', $key['ID_PROYEK']);
|
|
}
|
|
|
|
$update = [
|
|
'STATUS_RP' => '1',
|
|
'KUNCI_RP' => NULL,
|
|
'TGL_KUNCI' => NULL,
|
|
'BIAYA_RP' => NULL,
|
|
'GP_RP' => NULL,
|
|
'REVISI_RP' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('rekap_proyek', $update, 'ID_RP', $id_rp);
|
|
} else {
|
|
$grupNew = $datRp[0]['GRUP_ID']+1;
|
|
$datRpNew = $this->Amod->getData_RekapProyek_bySALES_byPP_byGRUP($datRp[0]['SAL_ID'], $datRp[0]['PP_ID'], $grupNew);
|
|
$datSpr = $this->Amod->getData_SoProyek_byRP_jenis3($datRpNew[0]['ID_RP']);
|
|
$datBpry = $this->Amod->getData_BiayaProyek_byRP_jenis3($datRpNew[0]['ID_RP']);
|
|
if ($datSpr==TRUE OR $datBpry==TRUE) {
|
|
$this->session->set_flashdata('data_used', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$update = [
|
|
'STATUS_RP' => '1',
|
|
'KUNCI_RP' => NULL,
|
|
'TGL_KUNCI' => NULL,
|
|
'REVISI_RP' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('rekap_proyek', $update, 'ID_RP', $id_rp);
|
|
|
|
$action = $this->Amod->delete('rekap_proyek', $datRpNew[0]['ID_RP'], 'ID_RP');
|
|
}
|
|
|
|
if ($action) {
|
|
$this->session->set_flashdata('success', 'direvisi');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
} else {
|
|
$this->session->set_flashdata('failed', 'direvisi');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
}
|
|
|
|
public function PR_Sub1_Administrasi_2($id) {
|
|
$dataProyek = $this->Amod->getData_Proyek_byID($id);
|
|
|
|
$datProyek = $this->Amod->getData_Proyek_bySTATUS(0);
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byPROYEK($id);
|
|
$sumDak = $this->Amod->getSum_DaftarAkuntansi_byPROYEK_byPERKIRAAN($id, 70);
|
|
|
|
$data = array(
|
|
'sidebar' => "menu proyek",
|
|
'navChild' => "proyek keuangan",
|
|
'proyek' => $datProyek,
|
|
'id_proyek' => $id,
|
|
'kode_proyek' => $dataProyek[0]['KODE_PROYEK'],
|
|
'po_proyek' => $dataProyek[0]['PO_PROYEK'],
|
|
'status_proyek' => $dataProyek[0]['STATUS_PROYEK'],
|
|
'nama_pelanggan' => substr($dataProyek[0]['NAMA_PELANGGAN'], 0, 32),
|
|
'dak' => $datDak,
|
|
'totalDak' => number_format(($sumDak[0]['DEBET']-$sumDak[0]['KREDIT']),2),
|
|
);
|
|
$this->load->view('proses/PR_Sub1_Administrasi_2', $data);
|
|
}
|
|
|
|
public function PR_Ubah_Sub1_DataDaftarAkuntansi() {
|
|
$id_dak = $this->input->post('id_daked');
|
|
$id_proyek = $this->input->post('id_proyeked');
|
|
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byID($id_dak);
|
|
if ($datDak==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$datProyek = $this->Amod->getData_Proyek_byID_bySTATUS($id_proyek, 0);
|
|
if ($datProyek==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$update = [
|
|
'PROYEK_ID' => $id_proyek
|
|
];
|
|
$action = $this->Amod->update('daftar_akuntansi', $update, 'ID_DAK', $id_dak);
|
|
|
|
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 PR_Sub1_Administrasi_3($id) {
|
|
$datProyek1 = $this->Amod->getData_Proyek_byID($id);
|
|
$datProyek2 = $this->Amod->getData_Proyek_byID($datProyek1[0]['PENGGANTI_PROYEK']);
|
|
|
|
$datDak1 = $this->Amod->getData_DaftarAkuntansi_byPROYEK($id);
|
|
$datDak2 = $this->Amod->getData_DaftarAkuntansi_byPROYEK($datProyek1[0]['PENGGANTI_PROYEK']);
|
|
$sumDak1 = $this->Amod->getSum_DaftarAkuntansi_byPROYEK_byPERKIRAAN($id, 70);
|
|
$sumDak2 = $this->Amod->getSum_DaftarAkuntansi_byPROYEK_byPERKIRAAN($datProyek1[0]['PENGGANTI_PROYEK'], 70);
|
|
|
|
if ($sumDak1==FALSE OR $sumDak1[0]['DEBET']==NULL) { $nilaiDak1 = 0; } else { $nilaiDak1 = $sumDak1[0]['DEBET']; }
|
|
if ($sumDak2==FALSE OR $sumDak2[0]['DEBET']==NULL) { $nilaiDak2 = 0; } else { $nilaiDak2 = $sumDak2[0]['DEBET']; }
|
|
$nilaiDak3 = $nilaiDak1+$nilaiDak2;
|
|
|
|
$data = array(
|
|
'sidebar' => "menu proyek",
|
|
'navChild' => "proyek keuangan",
|
|
'id_proyek' => $id,
|
|
'kode_proyek' => $datProyek1[0]['KODE_PROYEK'],
|
|
'po_proyek' => $datProyek1[0]['PO_PROYEK'],
|
|
'status_proyek' => $datProyek1[0]['STATUS_PROYEK'],
|
|
'ket_proyek' => $datProyek1[0]['KET_PROYEK'],
|
|
'tgl_batal' => $datProyek1[0]['TGL_BATAL'],
|
|
'acc_keuangan' => $datProyek1[0]['ACC_KEUANGAN'],
|
|
'nama_pelanggan' => substr($datProyek1[0]['NAMA_PELANGGAN'], 0, 32),
|
|
'kode_pengganti' => $datProyek2[0]['KODE_PROYEK'],
|
|
'dak1' => $datDak1,
|
|
'dak2' => $datDak2,
|
|
'nilaiDak1' => number_format($nilaiDak1,2),
|
|
'nilaiDak2' => number_format($nilaiDak2,2),
|
|
'nilaiDak3' => number_format($nilaiDak3,2),
|
|
);
|
|
$this->load->view('proses/PR_Sub1_Administrasi_3', $data);
|
|
}
|
|
|
|
//SUBMENU TRANSAKSI - PENGAWASAN
|
|
public function PR_Sub1_Pengawasan_1() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$now = date('Y-m-d');
|
|
$limit = date('Y-m-01');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "PR", "TRANSAKSI - Pengawasan");
|
|
$id_menu = $datShm[0]['MENU_ID'];
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$datStpos = $this->Amod->getData_SetTogglePosisi_byKARYAWAN_byMENU($id_karyawan, $id_menu);
|
|
if ($datStpos==FALSE) { $posisiToggle = 0; } else { $posisiToggle = $datStpos[0]['AKTIF_STPOS']; }
|
|
|
|
if ($hak<=3 AND $hak>0) {
|
|
$proyekBerjalan = $this->Amod->getData_Proyek_statusUntil1();
|
|
$proyekBatal = $this->Amod->getData_Proyek_batalThisMonth($limit);
|
|
$proyekLaporan = $this->Amod->getData_RekapProyek_bySTATUS(1);
|
|
$proyekSiap = $this->Amod->getData_RekapProyek_bySTATUS_afterLimit(2, $limit);
|
|
|
|
$noBatal = 0;
|
|
foreach ($proyekBatal as $key) {
|
|
$penggantiProyek = $this->Amod->getData_Proyek_byID($key['PENGGANTI_PROYEK']);
|
|
|
|
$proyekBatal[$noBatal] += ['PENGGANTIKODE' => $penggantiProyek[0]['KODE_PROYEK']];
|
|
$proyekBatal[$noBatal] += ['PENGGANTITANGGAL' => $penggantiProyek[0]['TANGGAL']];
|
|
$proyekBatal[$noBatal] += ['PENGGANTINILAI' => $penggantiProyek[0]['NILAI']];
|
|
$proyekBatal[$noBatal] += ['PENGGANTISALES' => $penggantiProyek[0]['NAMA_PANGGILAN_KARYAWAN']];
|
|
$proyekBatal[$noBatal] += ['PENGGANTIPELANGGAN' => $penggantiProyek[0]['NAMA_PELANGGAN']];
|
|
$proyekBatal[$noBatal++] += ['PENGGANTIPO' => $penggantiProyek[0]['PO_PROYEK']];
|
|
}
|
|
|
|
$noLaporan = 0;
|
|
foreach ($proyekLaporan as $kay) {
|
|
$dppSo = 0;
|
|
$biayaProyek = 0;
|
|
$gpProyek = 0;
|
|
if ($kay['JENIS_PP']<=2) {
|
|
$countProyekLapor = $this->Amod->getCount_Proyek_byRP_orderPELANGGAN($kay['ID_RP']);
|
|
$countProyekAll = $this->Amod->getCount_Proyek_bySALES_byPERIODE_statusUntil1($kay['SAL_ID'], $kay['AWAL_PP'], $kay['AKHIR_PP']);
|
|
|
|
$sumSpr = $this->Amod->getSum_SoProyek_byRP($kay['ID_RP']);
|
|
if ($sumSpr==TRUE AND $sumSpr[0]['TOTAL']!=NULL) {
|
|
$dppSo = $sumSpr[0]['TOTAL'];
|
|
}
|
|
|
|
$sumProyek = $this->Amod->getSum_Proyek_byRP($kay['ID_RP']);
|
|
if ($sumProyek==TRUE AND $sumProyek[0]['BIAYA']!=NULL) {
|
|
$biayaProyek = $sumProyek[0]['BIAYA'];
|
|
$gpProyek = $sumProyek[0]['GP'];
|
|
}
|
|
} else if ($kay['JENIS_PP']==3) {
|
|
$countProyekLapor = 0;
|
|
$countProyekAll = 0;
|
|
$biayaProyek = $kay['BIAYA_RP'];
|
|
$gpProyek = $kay['GP_RP'];
|
|
$dppSo = $biayaProyek+$gpProyek;
|
|
}
|
|
|
|
$proyekLaporan[$noLaporan] += ['COUNTLAP'=> $countProyekLapor];
|
|
$proyekLaporan[$noLaporan] += ['COUNTALL'=> $countProyekAll];
|
|
$proyekLaporan[$noLaporan] += ['NOTA'=> number_format($dppSo,2)];
|
|
$proyekLaporan[$noLaporan] += ['BIAYA'=> number_format($biayaProyek,2)];
|
|
$proyekLaporan[$noLaporan++] += ['GP'=> number_format($gpProyek,2)];
|
|
}
|
|
|
|
$noSiap = 0;
|
|
foreach ($proyekSiap as $kay) {
|
|
$dppSo = 0;
|
|
if ($kay['JENIS_PP']<=2) {
|
|
$sumSpr = $this->Amod->getSum_SoProyek_byRP($kay['ID_RP']);
|
|
if ($sumSpr==TRUE AND $sumSpr[0]['TOTAL']!=NULL) {
|
|
$dppSo = $sumSpr[0]['TOTAL'];
|
|
}
|
|
} else if ($kay['JENIS_PP']==3) {
|
|
$dppSo = $kay['BIAYA_RP']+$kay['GP_RP'];
|
|
}
|
|
|
|
$proyekSiap[$noSiap++] += ['NOTA'=> number_format($dppSo,2)];
|
|
}
|
|
|
|
$countBerjalan = count($proyekBerjalan);
|
|
$countBatal = count($proyekBatal);
|
|
$countLaporan = count($proyekLaporan);
|
|
$countSiap = count($proyekSiap);
|
|
} else {
|
|
$proyekBerjalan = NULL;
|
|
$proyekBatal = NULL;
|
|
$proyekLaporan = NULL;
|
|
$proyekSiap = NULL;
|
|
$countBerjalan = 0;
|
|
$countBatal = 0;
|
|
$countLaporan = 0;
|
|
$countSiap = 0;
|
|
}
|
|
|
|
$data = array(
|
|
'sidebar' => "menu proyek",
|
|
'navChild' => "proyek pengawasan",
|
|
'proyekBerjalan' => $proyekBerjalan,
|
|
'proyekBatal' => $proyekBatal,
|
|
'proyekLaporan' => $proyekLaporan,
|
|
'proyekSiap' => $proyekSiap,
|
|
'countBerjalan' => $countBerjalan,
|
|
'countBatal' => $countBatal,
|
|
'countLaporan' => $countLaporan,
|
|
'countSiap' => $countSiap,
|
|
'id_menu' => $id_menu,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil,
|
|
'posisiToggle' => $posisiToggle,
|
|
'tgl' => $now,
|
|
);
|
|
$this->load->view('proses/PR_Sub1_Pengawasan_1', $data);
|
|
}
|
|
|
|
//SUBMENU PUSAT DATA - INFORMASI
|
|
public function PR_Sub2_Informasi_1($id=null) {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "PR", "PUSAT DATA - Informasi");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
if ($id==null) {
|
|
$posisiToggle = 0;
|
|
} else {
|
|
$posisiToggle = $id;
|
|
}
|
|
|
|
$data = array(
|
|
'sidebar' => "menu proyek",
|
|
'navChild' => "proyek informasi",
|
|
'posisiToggle' => $posisiToggle,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil
|
|
);
|
|
$this->load->view('proses/PR_Sub2_Informasi_1', $data);
|
|
}
|
|
|
|
//SUBMENU PUSAT DATA - LAPORAN
|
|
public function PR_Sub2_Laporan_1() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "PR", "PUSAT DATA - Laporan");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$data = array(
|
|
'sidebar' => "menu proyek",
|
|
'navChild' => "proyek laporan",
|
|
'hak' => $hak,
|
|
'tampil' => $tampil
|
|
);
|
|
$this->load->view('proses/PR_Sub2_Laporan_1', $data);
|
|
}
|
|
|
|
public function PR_Sub2_Proyek_2() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$now = date('Y-m-d');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "PR", "PUSAT DATA - Laporan");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$datPelanggan = $this->Amod->getData_Pelanggan_bySTATUS(1);
|
|
$datSales = $this->Amod->getData_Karyawan_allSales();
|
|
|
|
$data = array(
|
|
'sidebar' => "menu proyek",
|
|
'navChild' => "proyek laporan",
|
|
'tgl' => $now,
|
|
'pelanggan' => $datPelanggan,
|
|
'sales' => $datSales,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil
|
|
);
|
|
$this->load->view('proses/PR_Sub2_Proyek_2', $data);
|
|
}
|
|
|
|
public function PR_Sub2_BiayaProyek_2() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$now = date('Y-m-d');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "PR", "PUSAT DATA - Laporan");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$datUnitProyek = $this->Amod->getData_UnitProyek_bySTATUS(1);
|
|
$datKaryProyek = $this->Amod->getData_Karyawan_forAkuntansi();
|
|
$datPelanggan = $this->Amod->getData_Proyek_groupPELANGGAN_statusNot9();
|
|
|
|
$data = array(
|
|
'sidebar' => "menu proyek",
|
|
'navChild' => "proyek laporan",
|
|
'unitproyek' => $datUnitProyek,
|
|
'karyawanproyek' => $datKaryProyek,
|
|
'pelanggan' => $datPelanggan,
|
|
'hak' => $hak,
|
|
'tgl' => $now,
|
|
'tampil' => $tampil
|
|
);
|
|
$this->load->view('proses/PR_Sub2_BiayaProyek_2', $data);
|
|
}
|
|
|
|
public function PR_Sub2_RekapProyek_2() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$now = date('Y-m-d');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "PR", "PUSAT DATA - Laporan");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
if ($hak<=1) {
|
|
$datRp = $this->Amod->getData_RekapProyek_bySALES_bySTATUS($id_karyawan, 2);
|
|
} else {
|
|
$datRp = $this->Amod->getData_RekapProyek_bySTATUS(2);
|
|
}
|
|
|
|
$data = array(
|
|
'sidebar' => "menu proyek",
|
|
'navChild' => "proyek laporan",
|
|
'rp' => $datRp,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil
|
|
);
|
|
$this->load->view('proses/PR_Sub2_RekapProyek_2', $data);
|
|
}
|
|
|
|
public function PR_Ambil_Sub2_DataProyek() {
|
|
$id_pelanggan = $this->input->post('id_pelanggan');
|
|
|
|
$datProyek = $this->Amod->getData_Proyek_byPELANGGAN_statusNot9($id_pelanggan);
|
|
|
|
$this->output_json([
|
|
'data' => $datProyek,
|
|
]);
|
|
}
|
|
|
|
public function PR_Ambil_Sub2_DataAnalisaBiayaProyek() {
|
|
$id_pelanggan = $this->input->post('id_pelanggan');
|
|
$id_proyek = $this->input->post('id_proyek');
|
|
$id_unitproyek = $this->input->post('id_unitproyek');
|
|
$id_karyawan = $this->input->post('id_karyawan');
|
|
$awal = $this->input->post('awal');
|
|
$akhir = $this->input->post('akhir');
|
|
$search = $this->input->post('search');
|
|
|
|
if ($id_pelanggan=="") {
|
|
$id_pelanggan = NULL;
|
|
}
|
|
|
|
if ($id_proyek=="") {
|
|
$id_proyek = NULL;
|
|
}
|
|
|
|
if ($id_unitproyek=="") {
|
|
$id_unitproyek = NULL;
|
|
}
|
|
|
|
if ($id_karyawan=="") {
|
|
$id_karyawan = NULL;
|
|
}
|
|
|
|
$data = $this->Amod->getData_DaftarAkuntansi_byPELANGGAN_byPROYEK_byUNITPROYEK_byKARYAWAN_byPERIODE_forSearchProyek($id_pelanggan, $id_proyek, $id_unitproyek, $id_karyawan, $awal, $akhir, $search);
|
|
$no = 0;
|
|
$totDebet = 0;
|
|
$totKredit = 0;
|
|
$totBiaya = 0;
|
|
foreach ($data as $key) {
|
|
$totBiaya = $totBiaya+$key['DEBET_DAK'];
|
|
|
|
$data[$no++] += ['DEBET' => number_format($key['DEBET_DAK'], 2)];
|
|
}
|
|
|
|
$this->output_json([
|
|
'data' => $data,
|
|
'totBiaya' => number_format($totBiaya,2),
|
|
]);
|
|
}
|
|
|
|
public function PR_Excel_Sub2_DataPembukuanProyek() {
|
|
$awal = $this->input->post('tgl_awalfill');
|
|
$akhir = $this->input->post('tgl_akhirfill');
|
|
$jenis = $this->input->post('jenis_fill');
|
|
$kondisi = $this->input->post('kondisi_fill');
|
|
$id_pelanggan = $this->input->post('id_pelangganfill');
|
|
$id_sales = $this->input->post('id_salesfill');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$hasil = [];
|
|
$noAwal = 0;
|
|
$noAkhir = 0;
|
|
|
|
if ($jenis==1) { // Campur jadi satu Laporan
|
|
$hasil[$noAwal] = [
|
|
'IDSHEET' => '0',
|
|
'FASHEET' => "CAMPUR",
|
|
'NASHEET' => "Sesuai Filter"
|
|
];
|
|
if ($id_sales=="") {
|
|
if ($id_pelanggan=="") {
|
|
$subnilai = 0;
|
|
$subreal = 0;
|
|
$subbiaya = 0;
|
|
$subgp = 0;
|
|
$datProyek = $this->Amod->getData_Proyek_bySALES_byPELANGGAN_byKONDISI_byPERIODE(NULL, NULL, $kondisi, $awal, $akhir);
|
|
foreach ($datProyek as $key) {
|
|
$subnilai = $subnilai+$key['NILAI_PROYEK'];
|
|
$subreal = $subreal+$key['BIAYA_PROYEK']+$key['GP_PROYEK'];
|
|
$subbiaya = $subbiaya+$key['BIAYA_PROYEK'];
|
|
$subgp = $subgp+$key['GP_PROYEK'];
|
|
}
|
|
$hasil[$noAkhir] += ['SUBNILAI' => number_format($subnilai,2)];
|
|
$hasil[$noAkhir] += ['SUBREAL' => number_format($subreal,2)];
|
|
$hasil[$noAkhir] += ['SUBBIAYA' => number_format($subbiaya,2)];
|
|
$hasil[$noAkhir] += ['SUBGP' => number_format($subgp,2)];
|
|
$hasil[$noAkhir] += ['ISI' => $datProyek];
|
|
} else {
|
|
$listPelanggan = explode(",", $id_pelanggan);
|
|
$subPro = [];
|
|
$noPro = 0;
|
|
foreach ($listPelanggan as $dat) {
|
|
$datProyek = $this->Amod->getData_Proyek_bySALES_byPELANGGAN_byKONDISI_byPERIODE(NULL, $dat, $kondisi, $awal, $akhir);
|
|
foreach ($datProyek as $det) {
|
|
$subPro[$noPro++] = $det;
|
|
}
|
|
}
|
|
$hasil[$noAkhir] += ['ISI' => $subPro];
|
|
}
|
|
} else {
|
|
$listSales = explode(",", $id_sales);
|
|
$subPro = [];
|
|
$noPro = 0;
|
|
foreach ($listSales as $keydat) {
|
|
if ($id_pelanggan=="") {
|
|
$datProyek = $this->Amod->getData_Proyek_bySALES_byPELANGGAN_byKONDISI_byPERIODE($keydat, NULL, $kondisi, $awal, $akhir);
|
|
foreach ($datProyek as $det) {
|
|
$subPro[$noPro++] = $det;
|
|
}
|
|
} else {
|
|
$listPelanggan = explode(",", $id_pelanggan);
|
|
foreach ($listPelanggan as $dot) {
|
|
$datProyek = $this->Amod->getData_Proyek_bySALES_byPELANGGAN_byKONDISI_byPERIODE($keydat, $dot, $kondisi, $awal, $akhir);
|
|
foreach ($datProyek as $det) {
|
|
$subPro[$noPro++] = $det;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
$hasil[$noAkhir] += ['ISI' => $subPro];
|
|
}
|
|
} else if ($jenis==2) { // Dipisah Pelanggan
|
|
$salPel = explode(",", $id_pelanggan);
|
|
foreach ($salPel as $key) {
|
|
$datPelanggan = $this->Amod->getData_Pelanggan_byID($key);
|
|
$nama_pelanggan = $datPelanggan[0]['NAMA_PELANGGAN'];
|
|
if (strlen($nama_pelanggan)>20) {
|
|
$namaPel = substr($nama_pelanggan, 0, 20);
|
|
$namaPel = "$namaPel..";
|
|
} else {
|
|
$namaPel = $nama_pelanggan;
|
|
}
|
|
$hasil[$noAwal++] = [
|
|
'IDSHEET' => $key,
|
|
'FASHEET' => $nama_pelanggan,
|
|
'NASHEET' => $namaPel
|
|
];
|
|
}
|
|
|
|
if ($id_sales=="") {
|
|
foreach ($hasil as $key) {
|
|
$datProyek = $this->Amod->getData_Proyek_bySALES_byPELANGGAN_byKONDISI_byPERIODE(NULL, $key['IDSHEET'], $kondisi, $awal, $akhir);
|
|
$hasil[$noAkhir++] += ['ISI' => $datProyek];
|
|
}
|
|
} else {
|
|
$listSales = explode(",", $id_sales);
|
|
foreach ($hasil as $key) {
|
|
$subPro = [];
|
|
$noPro = 0;
|
|
foreach ($listSales as $dat) {
|
|
$datProyek = $this->Amod->getData_Proyek_bySALES_byPELANGGAN_byKONDISI_byPERIODE($dat, $key['IDSHEET'], $kondisi, $awal, $akhir);
|
|
foreach ($datProyek as $det) {
|
|
$subPro[$noPro++] = $det;
|
|
}
|
|
}
|
|
$hasil[$noAkhir++] += ['ISI' => $subPro];
|
|
}
|
|
}
|
|
} else if ($jenis==3) { // Dipisah Sales
|
|
if ($id_sales=="") {
|
|
$salSales = $this->Amod->getData_Karyawan_allSales();
|
|
foreach ($salSales as $key) {
|
|
$hasil[$noAwal++] = [
|
|
'IDSHEET' => $key['ID_KARYAWAN'],
|
|
'FASHEET' => $key['NAMA_PANGGILAN_KARYAWAN'],
|
|
'NASHEET' => $key['NAMA_PANGGILAN_KARYAWAN'],
|
|
];
|
|
}
|
|
} else {
|
|
$salSales = explode(",", $id_sales);
|
|
foreach ($salSales as $key) {
|
|
$datKaryawan = $this->Amod->getData_Karyawan_byID($key);
|
|
$hasil[$noAwal++] = [
|
|
'IDSHEET' => $key,
|
|
'FASHEET' => $datKaryawan[0]['NAMA_PANGGILAN_KARYAWAN'],
|
|
'NASHEET' => $datKaryawan[0]['NAMA_PANGGILAN_KARYAWAN']
|
|
];
|
|
}
|
|
}
|
|
|
|
if ($id_pelanggan=="") {
|
|
foreach ($hasil as $key) {
|
|
$datProyek = $this->Amod->getData_Proyek_bySALES_byPELANGGAN_byKONDISI_byPERIODE($key['IDSHEET'], NULL, $kondisi, $awal, $akhir);
|
|
$hasil[$noAkhir++] += ['ISI' => $datProyek];
|
|
}
|
|
} else {
|
|
$listPelanggan = explode(",", $id_pelanggan);
|
|
foreach ($hasil as $key) {
|
|
$subPro = [];
|
|
$noPro = 0;
|
|
foreach ($listPelanggan as $dat) {
|
|
$datProyek = $this->Amod->getData_Proyek_bySALES_byPELANGGAN_byKONDISI_byPERIODE($key['IDSHEET'], $dat, $kondisi, $awal, $akhir);
|
|
foreach ($datProyek as $det) {
|
|
$subPro[$noPro++] = $det;
|
|
}
|
|
}
|
|
$hasil[$noAkhir++] += ['ISI' => $subPro];
|
|
}
|
|
}
|
|
}
|
|
|
|
$pilih_tabel = array('No', 'Kode', 'Tanggal', 'Sales', 'Pelanggan', 'Nomor PO', 'Jatuh Tempo', 'Nilai Prediksi', 'Nilai Proyek', 'Biaya Proyek', 'Nilai GP');
|
|
|
|
$data = [
|
|
'awal_nota' => date_format(date_create($awal), "d/m/Y"),
|
|
'akhir_nota' => date_format(date_create($akhir), "d/m/Y"),
|
|
'jumlah_kolom' => count($pilih_tabel),
|
|
'nama_tabel' => $pilih_tabel,
|
|
'jenis' => $jenis,
|
|
'hasil' => $hasil,
|
|
'ts' => $timestamp,
|
|
];
|
|
$this->load->view('cetak/PR_Excel_Sub2_DataPembukuanProyek', $data);
|
|
}
|
|
|
|
public function PR_Excel_Sub2_DataAnalisaBiayaProyek() {
|
|
$awal = $this->input->post('tgl_awalfill');
|
|
$akhir = $this->input->post('tgl_akhirfill');
|
|
$id_pelanggan = $this->input->post('id_pelangganfill');
|
|
$id_proyek = $this->input->post('id_proyekfill');
|
|
$id_unitproyek = $this->input->post('id_unitproyekfill');
|
|
$id_karyawan = $this->input->post('id_karyawanfill');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
if ($id_pelanggan=="") {
|
|
$id_pelanggan = NULL;
|
|
}
|
|
|
|
if ($id_proyek=="") {
|
|
$id_proyek = NULL;
|
|
}
|
|
|
|
if ($id_unitproyek=="") {
|
|
$id_unitproyek = NULL;
|
|
}
|
|
|
|
if ($id_karyawan=="") {
|
|
$id_karyawan = NULL;
|
|
}
|
|
|
|
$hasil = [];
|
|
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byPELANGGAN_byPROYEK_byUNITPROYEK_byKARYAWAN_byPERIODE_forSearchProyek($id_pelanggan, $id_proyek, $id_unitproyek, $id_karyawan, $awal, $akhir);
|
|
$no = 0;
|
|
$subTotal = 0;
|
|
foreach ($datDak as $dat) {
|
|
$subTotal = $subTotal+$dat['DEBET_DAK'];
|
|
|
|
$datDak[$no++] += ['DEBET' => number_format($dat['DEBET_DAK'], 2)];
|
|
}
|
|
|
|
$hasil[0] = [
|
|
'ISI' => $datDak,
|
|
'SUBTOTALALL' => number_format($subTotal,2)
|
|
];
|
|
|
|
$pilih_tabel = array('No', 'Kode', 'Tanggal', 'Timestamp', 'Pelanggan', 'Proyek', 'Detail', 'Karyawan', 'Nilai BIAYA', 'Keterangan');
|
|
|
|
$data = [
|
|
'awal_nota' => date_format(date_create($awal), "d/m/Y"),
|
|
'akhir_nota' => date_format(date_create($akhir), "d/m/Y"),
|
|
'jumlah_kolom' => count($pilih_tabel),
|
|
'nama_tabel' => $pilih_tabel,
|
|
'hasil' => $hasil,
|
|
'ts' => $timestamp,
|
|
];
|
|
$this->load->view('cetak/PR_Excel_Sub2_DataAnalisaBiayaProyek', $data);
|
|
}
|
|
|
|
//Daftar Menu SP [Sales Produk]
|
|
//SUBMENU TRANSAKSI - PENGADAAN
|
|
public function SP_Sub1_Pengadaan_1() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "SP", "TRANSAKSI - Pengadaan");
|
|
$id_menu = $datShm[0]['MENU_ID'];
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
if ($hak>=3) {
|
|
$datSsp = $this->Amod->getData_SetSalesProduk();
|
|
} else {
|
|
$datSsp = $this->Amod->getData_SetSalesProduk_bySALES($id_karyawan);
|
|
}
|
|
|
|
$datStsp = $this->Amod->getData_SetToggleSp_byKARYAWAN($id_karyawan);
|
|
if ($datStsp==FALSE) {
|
|
$id_ssp = 0;
|
|
$id_merk = 0;
|
|
$id_produk = 0;
|
|
$datBarang = NULL;
|
|
$datPengadaan = NULL;
|
|
$datDipakai = NULL;
|
|
$countBarang = 0;
|
|
$countPengadaan = 0;
|
|
$countDipakai = 0;
|
|
$produkTampil = "Tidak Berhak";
|
|
} else {
|
|
$id_ssp = $datStsp[0]['SSP_ID'];
|
|
$id_merk = $datStsp[0]['MERK_ID'];
|
|
$id_produk = $datStsp[0]['PRODUK_ID'];
|
|
$nama_merk = $datStsp[0]['NAMA_MERK'];
|
|
$nama_produk = $datStsp[0]['NAMA_PRODUK'];
|
|
$produkTampil = "$nama_merk $nama_produk";
|
|
$datBarang = $this->Amod->getData_Barang_byMERK_byPRODUK_jenisSKU_spNull_orderASC($id_merk, $id_produk);
|
|
$datPengadaan = $this->Amod->getData_Pengadaan_bySSP_bySTATUS($id_ssp, 1);
|
|
$datDipakai = $this->Amod->getData_Pengadaan_bySSP_bySTATUS_linkTerpakai($id_ssp, 2);
|
|
|
|
$no = 0;
|
|
foreach ($datPengadaan as $key) {
|
|
$datDpg = $this->Amod->getData_DaftarPengadaan_byPENGADAAN($key['ID_PENGADAAN']);
|
|
$datPengadaan[$no++] += ['BARANG' => $datDpg];
|
|
}
|
|
|
|
$no = 0;
|
|
foreach ($datDipakai as $key) {
|
|
$datDpg = $this->Amod->getData_DaftarPengadaan_byPENGADAAN($key['ID_PENGADAAN']);
|
|
$datDipakai[$no++] += ['BARANG' => $datDpg];
|
|
}
|
|
$countBarang = count($datBarang);
|
|
$countPengadaan = count($datPengadaan);
|
|
$countDipakai = count($datDipakai);
|
|
}
|
|
|
|
$datStpos = $this->Amod->getData_SetTogglePosisi_byKARYAWAN_byMENU($id_karyawan, $id_menu);
|
|
if ($datStpos==FALSE) { $posisiToggle = 0; } else { $posisiToggle = $datStpos[0]['AKTIF_STPOS']; }
|
|
|
|
$datJenis = $this->Amod->getData_Jenis_bySKU_bySTATUS(1, 1);
|
|
$datModel = $this->Amod->getData_Model_bySTATUS(1);
|
|
$datCorp = $this->Amod->getData_Corp_forPPH();
|
|
$datSupplier = $this->Amod->getData_Supplier_bySTATUS(1);
|
|
|
|
$data = array(
|
|
'sidebar' => "menu salesproduk",
|
|
'navChild' => "salesproduk pengadaan",
|
|
'posisiToggle' => $posisiToggle,
|
|
'id_menu' => $id_menu,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil,
|
|
'produkTampil' => $produkTampil,
|
|
'id_ssp' => $id_ssp,
|
|
'ssp' => $datSsp,
|
|
'barang' => $datBarang,
|
|
'pengadaan' => $datPengadaan,
|
|
'dipakai' => $datDipakai,
|
|
'countBarang' => $countBarang,
|
|
'countPengadaan' => $countPengadaan,
|
|
'countDipakai' => $countDipakai,
|
|
'jenis' => $datJenis,
|
|
'model' => $datModel,
|
|
'corp' => $datCorp,
|
|
'supplier' => $datSupplier,
|
|
'id_merk' => $id_merk,
|
|
'id_produk' => $id_produk,
|
|
'nama_merk' => $nama_merk,
|
|
'nama_produk' => $nama_produk,
|
|
);
|
|
$this->load->view('proses/SP_Sub1_Pengadaan_1', $data);
|
|
}
|
|
|
|
public function SP_Tambah_Sub1_DataMasterBarang() {
|
|
$id_merk = $this->input->post('id_merknew');
|
|
$id_produk = $this->input->post('id_produknew');
|
|
$kode_barang = $this->input->post('kode_barangnew');
|
|
$nama_barang = $this->input->post('nama_barangnew');
|
|
$id_jenis = $this->input->post('id_jenisnew');
|
|
$id_model = $this->input->post('id_modelnew');
|
|
$garansi_barang = $this->input->post('garansi_barangnew');
|
|
$mtm_barang = $this->input->post('mtm_barangnew');
|
|
$kode_barang = strtoupper(ltrim(rtrim(preg_replace('/\R+/', " " , $kode_barang))));
|
|
$kode_barang = preg_replace('/\\*/', "x" , $kode_barang);
|
|
$nama_barang = ltrim(rtrim(preg_replace('/\R+/', " " , $nama_barang)));
|
|
$nama_barang = preg_replace('/\\*/', "x" , $nama_barang);
|
|
$mtm_barang = strtoupper($mtm_barang);
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$cekKode = $this->Amod->getData_Barang_byKODE_bySTATUS($kode_barang, 1);
|
|
if ($cekKode==TRUE) {
|
|
$this->session->set_flashdata('kode_same', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$cekNama = $this->Amod->getData_Barang_byNAMA_bySTATUS($nama_barang, 1);
|
|
if ($cekNama==TRUE) {
|
|
$this->session->set_flashdata('name_same', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$cekBarang = $this->Amod->getData_Barang_byKODE_bySTATUS($kode_barang, 0);
|
|
if ($cekBarang==TRUE) {
|
|
$update = [
|
|
'KODE_BARANG' => $kode_barang,
|
|
'NAMA_BARANG' => $nama_barang,
|
|
'JENIS_ID' => $id_jenis,
|
|
'MERK_ID' => $id_merk,
|
|
'MODEL_ID' => $id_model,
|
|
'PRODUK_ID' => $id_produk,
|
|
'GARANSI_BARANG' => $garansi_barang,
|
|
'MTM_BARANG' => $mtm_barang,
|
|
'STATUS_BARANG' => '1',
|
|
'UBAH_BARANG' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('barang', $update, 'ID_BARANG', $cekBarang[0]['ID_BARANG']);
|
|
} else {
|
|
$input = [
|
|
'KODE_BARANG' => $kode_barang,
|
|
'NAMA_BARANG' => $nama_barang,
|
|
'JENIS_ID' => $id_jenis,
|
|
'MERK_ID' => $id_merk,
|
|
'MODEL_ID' => $id_model,
|
|
'PRODUK_ID' => $id_produk,
|
|
'GARANSI_BARANG' => $garansi_barang,
|
|
'MTM_BARANG' => $mtm_barang,
|
|
'STATUS_BARANG' => '1',
|
|
'TAMBAH_BARANG' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->create('barang', $input);
|
|
|
|
$id_barang = $this->Amod->getMax_ID_Barang();
|
|
$id_barang = $id_barang[0]['ID_BARANG'];
|
|
|
|
$input = [
|
|
'ID_KUANTITI' => $id_barang,
|
|
'GLOBAL_KUANTITI' => '0',
|
|
'PCM_KUANTITI' => '0',
|
|
'ITP_KUANTITI' => '0',
|
|
'PROSES_KUANTITI' => '0',
|
|
'ANTIK_KUANTITI' => '0',
|
|
'KONSINYASI_KUANTITI' => '0',
|
|
'MUTASI_KUANTITI' => '0',
|
|
'PEMINJAMAN_KUANTITI' => '0',
|
|
'PENDING_KUANTITI' => '0',
|
|
'PROYEK_KUANTITI' => '0',
|
|
'SERVICE_KUANTITI' => '0',
|
|
'SEWA_KUANTITI' => '0',
|
|
'TERCABUT_KUANTITI' => '0',
|
|
'PERSEDIAAN_KUANTITI' => '0',
|
|
];
|
|
$action = $this->Amod->create('kuantiti', $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 SP_Ubah_Sub1_DataMasterBarang() {
|
|
$id_barang = $this->input->post('id_baranged');
|
|
$kode_barang = $this->input->post('kode_baranged');
|
|
$nama_barang = $this->input->post('nama_baranged');
|
|
$id_jenis = $this->input->post('id_jenised');
|
|
$id_model = $this->input->post('id_modeled');
|
|
$garansi_barang = $this->input->post('garansi_baranged');
|
|
$mtm_barang = $this->input->post('mtm_baranged');
|
|
$kode_barang = strtoupper(ltrim(rtrim(preg_replace('/\R+/', " " , $kode_barang))));
|
|
$kode_barang = preg_replace('/\\*/', "x" , $kode_barang);
|
|
$nama_barang = ltrim(rtrim(preg_replace('/\R+/', " " , $nama_barang)));
|
|
$nama_barang = preg_replace('/\\*/', "x" , $nama_barang);
|
|
$mtm_barang = strtoupper($mtm_barang);
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$cekKode = $this->Amod->getData_Barang_byKODE_bySTATUS($kode_barang, 1, $id_barang);
|
|
if ($cekKode==TRUE) {
|
|
$this->session->set_flashdata('kode_same', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$cekNama = $this->Amod->getData_Barang_byNAMA_bySTATUS($nama_barang, 1, $id_barang);
|
|
if ($cekNama==TRUE) {
|
|
$this->session->set_flashdata('name_same', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$datBarang = $this->Amod->getData_Barang_byID($id_barang);
|
|
$datJenis = $this->Amod->getData_Jenis_byID($id_jenis);
|
|
if ($datJenis[0]['TYPE_JENIS']!=$datBarang[0]['TYPE_JENIS']) {
|
|
$this->session->set_flashdata('jenisNotSame', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$datDb = $this->Amod->getData_DaftarBeli_byBARANG_bySTATUS_dbNull($id_barang, 1);
|
|
foreach ($datDb as $key) {
|
|
$input = [
|
|
'DB_ID' => $key['ID_DB'],
|
|
'BARANG_ID' => $id_barang,
|
|
'SUPPLIER_ID' => $key['SID'],
|
|
'TGL_KPR' => $key['TGL_INVBELI'],
|
|
'NOTA_KPR' => $key['INV_PEMBELIAN'],
|
|
'TS_KPR' => $timestamp,
|
|
'HARGA_KPR' => round($key['HARGA_DB']*(($key['PPN_PEMBELIAN']+100)/100),2),
|
|
'STATUS_KPR' => '0',
|
|
];
|
|
$action = $this->Amod->create('klaim_program', $input);
|
|
|
|
$id_kpr = $this->Amod->getMax_ID_KlaimProgram();
|
|
$id_kpr = $id_kpr[0]['ID_KPR'];
|
|
|
|
$datSnBeli = $this->Amod->getData_SnBeli_byDB($key['ID_DB']);
|
|
foreach ($datSnBeli as $dat) {
|
|
$datSnStock = $this->Amod->getData_SnStock_byNAMA_allStatus($dat['NAMA_SNB']);
|
|
$datSnkpr = $this->Amod->getData_SnKlaimProgram_bySNSTOCK($datSnStock[0]['ID_SNSTOCK']);
|
|
if ($datSnkpr==FALSE) {
|
|
$input = [
|
|
'KPR_ID' => $id_kpr,
|
|
'SNSTOCK_ID' => $datSnStock[0]['ID_SNSTOCK'],
|
|
'NAMA_SNKPR' => $dat['NAMA_SNB'],
|
|
'STATUS_SNKPR' => '0'
|
|
];
|
|
$action = $this->Amod->create('sn_klaimprogram', $input);
|
|
} else {
|
|
$update = [
|
|
'KPR_ID' => $id_kpr
|
|
];
|
|
$action = $this->Amod->update('sn_klaimprogram', $update, 'ID_SNKPR', $datSnkpr[0]['ID_SNKPR']);
|
|
}
|
|
}
|
|
}
|
|
|
|
$update = [
|
|
'KODE_BARANG' => $kode_barang,
|
|
'NAMA_BARANG' => $nama_barang,
|
|
'JENIS_ID' => $id_jenis,
|
|
'MODEL_ID' => $id_model,
|
|
'GARANSI_BARANG' => $garansi_barang,
|
|
'MTM_BARANG' => $mtm_barang,
|
|
'UBAH_BARANG' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('barang', $update, 'ID_BARANG', $id_barang);
|
|
|
|
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 SP_Hapus_Sub1_DataMasterBarang() {
|
|
$id_barang = $this->input->post('id_barangdel');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$datBarang = $this->Amod->getData_Barang_byID_bySTATUS($id_barang, 1);
|
|
if ($datBarang==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$countDpg = $this->Amod->getCount_DaftarPengadaan_byBARANG($id_barang);
|
|
$countDb = $this->Amod->getCount_DaftarBeli_byBARANG($id_barang);
|
|
$countDo = $this->Amod->getCount_DaftarOrder_byBARANG($id_barang);
|
|
$countIo = $this->Amod->getCount_TransaksiStock_byBARANG($id_barang);
|
|
$countHq = $this->Amod->getCount_HistoriKuantiti_byBARANG($id_barang);
|
|
if ($countDpg>0 OR $countDb>0 OR $countDo>0 OR $countIo>0 OR $countHq>0) {
|
|
$this->session->set_flashdata('data_used', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$update = [
|
|
'STATUS_BARANG' => '0',
|
|
'HAPUS_BARANG' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('barang', $update, 'ID_BARANG', $id_barang);
|
|
|
|
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 SP_Simpan_Sub1_DataPengadaan() {
|
|
$verse = $this->input->post('verse');
|
|
$id_supplier = $this->input->post('id_supplier');
|
|
$id_corp = $this->input->post('id_corp');
|
|
$po_pengadaan = $this->input->post('po_pengadaan');
|
|
$potongan_pengadaan = $this->input->post('potongan_pengadaan');
|
|
$id_ssp = $this->input->post('id_ssp');
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$value = 0;
|
|
$datPengadaan = $this->Amod->getData_Pengadaan_byKARYAWAN_bySTATUS_bySSP($id_karyawan, 0, $id_ssp);
|
|
if ($datPengadaan==TRUE) {
|
|
$id_pengadaan = $datPengadaan[0]['ID_PENGADAAN'];
|
|
$kode_pengadaan = $datPengadaan[0]['KODE_PENGADAAN'];
|
|
} else {
|
|
$kode_pengadaan = $this->Amod->generate_kodePengadaan();
|
|
$input = [
|
|
'CIPTA_PENGADAAN' => "Oleh $panggilan pada $timestamp",
|
|
'KODE_PENGADAAN' => $kode_pengadaan,
|
|
'KARYAWAN_ID' => $id_karyawan,
|
|
'SSP_ID' => $id_ssp,
|
|
'STATUS_PENGADAAN' => '0'
|
|
];
|
|
$action = $this->Amod->create('pengadaan', $input);
|
|
|
|
$id_pengadaan = $this->Amod->getMax_ID_Pengadaan();
|
|
$id_pengadaan = $id_pengadaan[0]['ID_PENGADAAN'];
|
|
}
|
|
|
|
if ($verse==1) {
|
|
$update = [
|
|
'SUPPLIER_ID' => $id_supplier
|
|
];
|
|
} else if ($verse==2) {
|
|
$update = [
|
|
'CORP_ID' => $id_corp
|
|
];
|
|
} else if ($verse==3) {
|
|
$update = [
|
|
'PO_PENGADAAN' => $po_pengadaan
|
|
];
|
|
} else if ($verse==4) {
|
|
if ($potongan_pengadaan==0) {
|
|
$potongan_pengadaan = NULL;
|
|
}
|
|
$update = [
|
|
'POTONGAN_PENGADAAN' => $potongan_pengadaan
|
|
];
|
|
}
|
|
$action = $this->Amod->update('pengadaan', $update, 'ID_PENGADAAN', $id_pengadaan);
|
|
|
|
if ($action) {
|
|
$value = 1;
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
'kode' => $kode_pengadaan,
|
|
'id' => $id_pengadaan
|
|
]);
|
|
}
|
|
|
|
public function SP_Tambah_Sub1_DataDaftarPengadaan() {
|
|
$id_pengadaan = $this->input->post('id_pengadaan');
|
|
$id_barang = $this->input->post('id_barang');
|
|
$qty_dpg = $this->input->post('qty_dpg');
|
|
$harga_dpg = $this->input->post('harga_dpg');
|
|
$diskon_dpg = $this->input->post('diskon_dpg');
|
|
|
|
$value = 0;
|
|
$datPengadaan = $this->Amod->getData_Pengadaan_byID_bySTATUS($id_pengadaan, 0);
|
|
if ($datPengadaan==FALSE) {
|
|
$value = 3;
|
|
} else {
|
|
$cekDpg = $this->Amod->getData_DaftarPengadaan_byPENGADAAN_byBARANG($id_pengadaan, $id_barang);
|
|
if ($cekDpg==TRUE) {
|
|
$value = 2;
|
|
} else {
|
|
if ($diskon_dpg=="") {
|
|
$diskon_dpg = 0;
|
|
}
|
|
$input = [
|
|
'PENGADAAN_ID' => $id_pengadaan,
|
|
'BARANG_ID' => $id_barang,
|
|
'QTY_DPG' => $qty_dpg,
|
|
'HARGA_DPG' => $harga_dpg,
|
|
'DISKON_DPG' => $diskon_dpg
|
|
];
|
|
$action = $this->Amod->create('daftar_pengadaan', $input);
|
|
|
|
$value = 1;
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value
|
|
]);
|
|
}
|
|
|
|
public function SP_Ubah_Sub1_DataDaftarPengadaan() {
|
|
$id_pengadaan = $this->input->post('id_pengadaan');
|
|
$id_dpg = $this->input->post('id_dpg');
|
|
$id_barang = $this->input->post('id_barang');
|
|
$qty_dpg = $this->input->post('qty_dpg');
|
|
$harga_dpg = $this->input->post('harga_dpg');
|
|
$diskon_dpg = $this->input->post('diskon_dpg');
|
|
$verse = $this->input->post('verse');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
if ($verse==1) {
|
|
$status_pengadaan = 0;
|
|
} else if ($verse==2) {
|
|
$status_pengadaan = 2;
|
|
}
|
|
|
|
$value = 0;
|
|
$datPengadaan = $this->Amod->getData_Pengadaan_byID_bySTATUS($id_pengadaan, $status_pengadaan);
|
|
if ($datPengadaan==FALSE) {
|
|
$value = 3;
|
|
} else {
|
|
$datDpg = $this->Amod->getData_DaftarPengadaan_byID($id_dpg);
|
|
if ($datDpg==FALSE) {
|
|
$value = 2;
|
|
} else {
|
|
$cekDpg = $this->Amod->getData_DaftarPengadaan_byPENGADAAN_byBARANG($id_pengadaan, $id_barang, $id_dpg);
|
|
if ($cekDpg==TRUE) {
|
|
$value = 2;
|
|
} else {
|
|
if ($diskon_dpg=="") {
|
|
$diskon_dpg = 0;
|
|
}
|
|
$update = [
|
|
'BARANG_ID' => $id_barang,
|
|
'QTY_DPG' => $qty_dpg,
|
|
'HARGA_DPG' => $harga_dpg,
|
|
'DISKON_DPG' => $diskon_dpg
|
|
];
|
|
$action = $this->Amod->update('daftar_pengadaan', $update, 'ID_DPG', $id_dpg);
|
|
|
|
if ($verse==2) {
|
|
$datDb = $this->Amod->getData_DaftarBeli_byDPG($id_dpg);
|
|
$update = [
|
|
'BARANG_ID' => $id_barang,
|
|
'QTY_DB' => $qty_dpg,
|
|
'HARGA_DB' => $harga_dpg-$diskon_dpg
|
|
];
|
|
$action = $this->Amod->update('daftar_beli', $update, 'ID_DB', $datDb[0]['ID_DB']);
|
|
|
|
$update = [
|
|
'UBAH_PENGADAAN' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('pengadaan', $update, 'ID_PENGADAAN', $id_pengadaan);
|
|
}
|
|
|
|
$value = 1;
|
|
}
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value
|
|
]);
|
|
}
|
|
|
|
public function SP_Hapus_Sub1_DataDaftarPengadaan() {
|
|
$id_pengadaan = $this->input->post('id_pengadaan');
|
|
$id_dpg = $this->input->post('id_dpg');
|
|
$verse = $this->input->post('verse');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
if ($verse==1) {
|
|
$status_pengadaan = 0;
|
|
} else if ($verse==2) {
|
|
$status_pengadaan = 2;
|
|
}
|
|
|
|
$value = 0;
|
|
$datPengadaan = $this->Amod->getData_Pengadaan_byID_bySTATUS($id_pengadaan, $status_pengadaan);
|
|
if ($datPengadaan==FALSE) {
|
|
$value = 3;
|
|
} else {
|
|
$datDpg = $this->Amod->getData_DaftarPengadaan_byID($id_dpg);
|
|
if ($datDpg==FALSE) {
|
|
$value = 2;
|
|
} else {
|
|
$action = $this->Amod->delete('daftar_pengadaan', $id_dpg, 'ID_DPG');
|
|
|
|
if ($verse==2) {
|
|
$datDb = $this->Amod->getData_DaftarBeli_byDPG($id_dpg);
|
|
$action = $this->Amod->delete('daftar_beli', $datDb[0]['ID_DB'], 'ID_DB');
|
|
|
|
$update = [
|
|
'UBAH_PENGADAAN' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('pengadaan', $update, 'ID_PENGADAAN', $id_pengadaan);
|
|
}
|
|
|
|
$value = 1;
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value
|
|
]);
|
|
}
|
|
|
|
public function SP_Batal_Sub1_DataPengadaan() {
|
|
$id_pengadaan = $this->input->post('id_pengadaan');
|
|
$verse = $this->input->post('verse');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$status = $verse-1;
|
|
$value = 0;
|
|
$datPengadaan = $this->Amod->getData_Pengadaan_byID_bySTATUS($id_pengadaan, $status);
|
|
if ($datPengadaan==FALSE) {
|
|
$value = 2;
|
|
} else {
|
|
$update = [
|
|
'BATAL_PENGADAAN' => "Oleh $panggilan pada $timestamp",
|
|
'STATUS_PENGADAAN' => '9'
|
|
];
|
|
$action = $this->Amod->update('pengadaan', $update, 'ID_PENGADAAN', $id_pengadaan);
|
|
|
|
$value = 1;
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value
|
|
]);
|
|
}
|
|
|
|
public function SP_Kunci_Sub1_DataPengadaan() {
|
|
$id_pengadaan = $this->input->post('id_pengadaan');
|
|
$diskon_pengadaan = $this->input->post('diskon_pengadaan');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$value = 0;
|
|
$datPengadaan = $this->Amod->getData_Pengadaan_byID_bySTATUS($id_pengadaan, 0);
|
|
if ($datPengadaan==FALSE) {
|
|
$value = 3;
|
|
} else {
|
|
$cekDpmx = $this->Amod->getSum_DetailPengadaanMix_byPENGADAAN($id_pengadaan);
|
|
if ($cekDpmx==FALSE OR $cekDpmx[0]['TOTAL']==NULL) {
|
|
|
|
} else {
|
|
foreach ($cekDpmx as $key) {
|
|
if ($key['QTY_DPG']!=$key['TOTAL']) {
|
|
$value = 2;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
if ($value==0) {
|
|
$sumDpg = $this->Amod->getSum_DaftarPengadaan_byPENGADAAN($id_pengadaan);
|
|
$diskonTotal = 0;
|
|
if ($diskon_pengadaan==2) {
|
|
$diskonTotal = $sumDpg[0]['TOTDISKON'];
|
|
}
|
|
|
|
$update = [
|
|
'STATUS_PENGADAAN' => '1',
|
|
'DISKON_PENGADAAN' => $diskonTotal,
|
|
'CIPTA_PENGADAAN' => "Oleh $panggilan pada $timestamp",
|
|
];
|
|
$action = $this->Amod->update('pengadaan', $update, 'ID_PENGADAAN', $id_pengadaan);
|
|
|
|
$value = 1;
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value
|
|
]);
|
|
}
|
|
|
|
public function SP_Revisi_Sub1_DataPengadaan() {
|
|
$id_pengadaan = $this->input->post('id_pengadaanrev');
|
|
$id_menu = $this->input->post('id_menurev');
|
|
$id_ssp = $this->input->post('id_ssprev');
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$datPengadaan = $this->Amod->getData_Pengadaan_byID_bySTATUS($id_pengadaan, 1);
|
|
if ($datPengadaan==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$cekPengadaan = $this->Amod->getData_Pengadaan_byKARYAWAN_bySTATUS_bySSP($id_karyawan, 0, $id_ssp);
|
|
if ($cekPengadaan==TRUE) {
|
|
$update = [
|
|
'STATUS_PENGADAAN' => '9',
|
|
'BATAL_PENGADAAN' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('pengadaan', $update, 'ID_PENGADAAN', $cekPengadaan[0]['ID_PENGADAAN']);
|
|
}
|
|
|
|
$update = [
|
|
'STATUS_PENGADAAN' => '0'
|
|
];
|
|
$action = $this->Amod->update('pengadaan', $update, 'ID_PENGADAAN', $id_pengadaan);
|
|
|
|
$datStpos = $this->Amod->getData_SetTogglePosisi_byKARYAWAN_byMENU($id_karyawan, $id_menu);
|
|
$update = [
|
|
'AKTIF_STPOS' => '2',
|
|
'TIMESTAMP' => $timestamp
|
|
];
|
|
$action = $this->Amod->update('set_toggleposisi', $update, 'ID_STPOS', $datStpos[0]['ID_STPOS']);
|
|
|
|
if ($action) {
|
|
$this->session->set_flashdata('success', 'direvisi');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
} else {
|
|
$this->session->set_flashdata('failed', 'direvisi');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
}
|
|
|
|
public function SP_Simpan_Sub1_DataDetailPengadaanMix() {
|
|
$id_dpg = $this->input->post('id_dpg');
|
|
$id_mix = $this->input->post('id_mix');
|
|
$limit = $this->input->post('limit');
|
|
|
|
$value = 0;
|
|
$datDpg = $this->Amod->getData_DaftarPengadaan_byID($id_dpg);
|
|
if ($datDpg==FALSE) {
|
|
$value = 4;
|
|
} else {
|
|
$cekDpg = $this->Amod->getData_DaftarPengadaan_byID($id_mix);
|
|
if ($cekDpg==FALSE) {
|
|
$value = 4;
|
|
} else {
|
|
$cekDpmx = $this->Amod->getData_DetailPengadaanMix_byDPG_byMIX($id_dpg, $id_mix);
|
|
if ($cekDpmx==TRUE) {
|
|
$value = 3;
|
|
} else {
|
|
$sumDpmx = $this->Amod->getSum_DetailPengadaanMix_byDPG($id_dpg);
|
|
if ($sumDpmx==FALSE OR $sumDpmx[0]['TOTAL']==NULL) {
|
|
$terpakai = 0;
|
|
} else {
|
|
$terpakai = $sumDpmx[0]['TOTAL'];
|
|
}
|
|
if (($terpakai+$cekDpg[0]['QTY_DPG'])>$limit) {
|
|
$value = 2;
|
|
} else {
|
|
$input = [
|
|
'DPG_ID' => $id_dpg,
|
|
'MIX_ID' => $id_mix,
|
|
'QTY_DPMX' => $cekDpg[0]['QTY_DPG'],
|
|
];
|
|
$action = $this->Amod->create('detail_pengadaan_mix', $input);
|
|
|
|
$value = 1;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
}
|
|
|
|
public function SP_Hapus_Sub1_DataDetailPengadaanMix() {
|
|
$id_dpmx = $this->input->post('id_dpmx');
|
|
$id_dpg = $this->input->post('id_dpg');
|
|
|
|
$value = 0;
|
|
$datDpmx = $this->Amod->getData_DetailPengadaanMix_byID($id_dpmx);
|
|
if ($datDpmx==FALSE) {
|
|
$value = 3;
|
|
} else {
|
|
$datDpg = $this->Amod->getData_DaftarPengadaan_byID($id_dpg);
|
|
if ($datDpg==FALSE) {
|
|
$value = 2;
|
|
} else {
|
|
$action = $this->Amod->delete('detail_pengadaan_mix', $id_dpmx, 'ID_DPMX');
|
|
$value = 1;
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
}
|
|
|
|
//SUBMENU TRANSAKSI - STOK GUDANG
|
|
public function SP_Sub1_StokGudang_1() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "SP", "TRANSAKSI - Stok Gudang");
|
|
$id_menu = $datShm[0]['MENU_ID'];
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
if ($hak>=3) {
|
|
$datSsp = $this->Amod->getData_SetSalesProduk();
|
|
} else {
|
|
$datSsp = $this->Amod->getData_SetSalesProduk_bySALES($id_karyawan);
|
|
}
|
|
|
|
$datStsp = $this->Amod->getData_SetToggleSp_byKARYAWAN($id_karyawan);
|
|
$countSiapQty = 0;
|
|
$mtmOk = 0;
|
|
if ($datStsp==FALSE) {
|
|
$id_ssp = 0;
|
|
$datBarang = NULL;
|
|
$datAktif = NULL;
|
|
$datPasif = NULL;
|
|
$datSiap = NULL;
|
|
$countBarang = 0;
|
|
$countAktif = 0;
|
|
$countPasif = 0;
|
|
$countSiapKode = 0;
|
|
$produkTampil = "Tidak Berhak";
|
|
} else {
|
|
$id_ssp = $datStsp[0]['SSP_ID'];
|
|
$id_merk = $datStsp[0]['MERK_ID'];
|
|
$id_produk = $datStsp[0]['PRODUK_ID'];
|
|
$nama_merk = $datStsp[0]['NAMA_MERK'];
|
|
$nama_produk = $datStsp[0]['NAMA_PRODUK'];
|
|
$produkTampil = "$nama_merk $nama_produk";
|
|
$datBarang = $this->Amod->getData_Barang_byMERK_produk0_jenisSKU_spNull_orderDESC($id_merk);
|
|
$datAktif = $this->Amod->getData_Barang_byMERK_byPRODUK_jenisSKU_spNull_orderASC($id_merk, $id_produk);
|
|
$datPasif = $this->Amod->getData_Barang_byMERK_jenisSKU_spNotNull_orderASC($id_merk);
|
|
$datSiap = $this->Amod->getData_Barang_byMERK_byPRODUK_jenisSKU_kuantitiMore0_spNull($id_merk, $id_produk);
|
|
$countBarang = count($datBarang);
|
|
$countAktif = count($datAktif);
|
|
$countPasif = count($datPasif);
|
|
$countSiapKode = count($datSiap);
|
|
|
|
if ($id_merk==3 AND $id_produk==1) {
|
|
$mtmOk = 1;
|
|
}
|
|
|
|
foreach ($datSiap as $key) {
|
|
$countSiapQty = $countSiapQty+$key['GLOBAL_KUANTITI'];
|
|
}
|
|
}
|
|
|
|
$datStpos = $this->Amod->getData_SetTogglePosisi_byKARYAWAN_byMENU($id_karyawan, $id_menu);
|
|
if ($datStpos==FALSE) { $posisiToggle = 0; } else { $posisiToggle = $datStpos[0]['AKTIF_STPOS']; }
|
|
|
|
$datProduk = $this->Amod->getData_Produk_bySTATUS(1);
|
|
|
|
$data = array(
|
|
'sidebar' => "menu salesproduk",
|
|
'navChild' => "salesproduk stokgudang",
|
|
'posisiToggle' => $posisiToggle,
|
|
'id_menu' => $id_menu,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil,
|
|
'produkTampil' => $produkTampil,
|
|
'id_ssp' => $id_ssp,
|
|
'mtmOk' => $mtmOk,
|
|
'ssp' => $datSsp,
|
|
'produk' => $datProduk,
|
|
'barang' => $datBarang,
|
|
'aktif' => $datAktif,
|
|
'pasif' => $datPasif,
|
|
'siap' => $datSiap,
|
|
'countBarang' => $countBarang,
|
|
'countAktif' => $countAktif,
|
|
'countPasif' => $countPasif,
|
|
'countSiapKode' => $countSiapKode,
|
|
'countSiapQty' => $countSiapQty,
|
|
);
|
|
$this->load->view('proses/SP_Sub1_StokGudang_1', $data);
|
|
}
|
|
|
|
public function SP_Perbaruhi_Sub1_A1_DataBarang() {
|
|
$id_barang = $this->input->post('id_barangup');
|
|
$id_produk = $this->input->post('id_produkup');
|
|
$garansi_barang = $this->input->post('garansi_barangup');
|
|
$mtm_barang = $this->input->post('mtm_barangup');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
$now = date('Y-m-d');
|
|
$limit = date('Y-m-01');
|
|
$awal = $this->Amod->generate_subMonth($limit, 3);
|
|
$mtm_barang = strtoupper($mtm_barang);
|
|
|
|
$datBarang = $this->Amod->getData_Barang_byID_bySTATUS($id_barang, 1);
|
|
if ($datBarang==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$datSsp = $this->Amod->getData_SetSalesProduk_byMERK_byPRODUK($datBarang[0]['MERK_ID'], $id_produk);
|
|
if ($datSsp[0]['SALES_ID']==NULL) {
|
|
$sp_do = NULL;
|
|
} else {
|
|
$datKaryawan = $this->Amod->getData_Karyawan_byID($datSsp[0]['SALES_ID']);
|
|
$sp_do = $datKaryawan[0]['NAMA_PANGGILAN_KARYAWAN'];
|
|
}
|
|
|
|
$datDb = $this->Amod->getData_DaftarBeli_byBARANG_bySTATUS_dbNull($id_barang, 1);
|
|
foreach ($datDb as $key) {
|
|
$input = [
|
|
'DB_ID' => $key['ID_DB'],
|
|
'BARANG_ID' => $id_barang,
|
|
'SUPPLIER_ID' => $key['SID'],
|
|
'TGL_KPR' => $key['TGL_INVBELI'],
|
|
'NOTA_KPR' => $key['INV_PEMBELIAN'],
|
|
'TS_KPR' => $timestamp,
|
|
'HARGA_KPR' => round($key['HARGA_DB']*(($key['PPN_PEMBELIAN']+100)/100),2),
|
|
'STATUS_KPR' => '0',
|
|
];
|
|
$action = $this->Amod->create('klaim_program', $input);
|
|
|
|
$id_kpr = $this->Amod->getMax_ID_KlaimProgram();
|
|
$id_kpr = $id_kpr[0]['ID_KPR'];
|
|
|
|
$datSnBeli = $this->Amod->getData_SnBeli_byDB($key['ID_DB']);
|
|
foreach ($datSnBeli as $dat) {
|
|
$datSnStock = $this->Amod->getData_SnStock_byNAMA_allStatus($dat['NAMA_SNB']);
|
|
$datSnkpr = $this->Amod->getData_SnKlaimProgram_bySNSTOCK($datSnStock[0]['ID_SNSTOCK']);
|
|
if ($datSnkpr==FALSE) {
|
|
$input = [
|
|
'KPR_ID' => $id_kpr,
|
|
'SNSTOCK_ID' => $datSnStock[0]['ID_SNSTOCK'],
|
|
'NAMA_SNKPR' => $dat['NAMA_SNB'],
|
|
'STATUS_SNKPR' => '0'
|
|
];
|
|
$action = $this->Amod->create('sn_klaimprogram', $input);
|
|
} else {
|
|
$update = [
|
|
'KPR_ID' => $id_kpr
|
|
];
|
|
$action = $this->Amod->update('sn_klaimprogram', $update, 'ID_SNKPR', $datSnkpr[0]['ID_SNKPR']);
|
|
}
|
|
}
|
|
}
|
|
|
|
$datDo = $this->Amod->getData_DaftarOrder_byBARANG_byPERIODE_status1($id_barang, $awal, $now);
|
|
foreach ($datDo as $key) {
|
|
$update = [
|
|
'SP_DO' => $sp_do
|
|
];
|
|
$action = $this->Amod->update('daftar_order', $update, 'ID_DO', $key['ID_DO']);
|
|
}
|
|
|
|
if ($mtm_barang=="") {
|
|
$mtm_barang = NULL;
|
|
}
|
|
|
|
$update = [
|
|
'PRODUK_ID' => $id_produk,
|
|
'GARANSI_BARANG' => $garansi_barang,
|
|
'MTM_BARANG' => $mtm_barang,
|
|
'UBAH_BARANG' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->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']);
|
|
}
|
|
|
|
}
|
|
|
|
public function SP_Sembunyi_Sub1_A1_DataBarang() {
|
|
$id_barang = $this->input->post('id_barangsp');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
foreach ($id_barang as $key) {
|
|
$datBarang = $this->Amod->getData_Barang_byID_bySTATUS($key, 1);
|
|
if ($datBarang==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
}
|
|
|
|
foreach ($id_barang as $key) {
|
|
$update = [
|
|
'SP_BARANG' => "Oleh $panggilan pada $timestamp",
|
|
];
|
|
$action = $this->Amod->update('barang', $update, 'ID_BARANG', $key);
|
|
}
|
|
|
|
if ($action) {
|
|
$this->session->set_flashdata('success', 'disembunyikan');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
} else {
|
|
$this->session->set_flashdata('failed', 'disembunyikan');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
}
|
|
|
|
public function SP_Kembali_Sub1_A1_DataBarang() {
|
|
$id_barang = $this->input->post('id_barangload');
|
|
|
|
foreach ($id_barang as $key) {
|
|
$datBarang = $this->Amod->getData_Barang_byID_bySTATUS_spNotNull($key, 1);
|
|
if ($datBarang==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
}
|
|
|
|
foreach ($id_barang as $key) {
|
|
$update = [
|
|
'SP_BARANG' => NULL
|
|
];
|
|
$action = $this->Amod->update('barang', $update, 'ID_BARANG', $key);
|
|
}
|
|
|
|
if ($action) {
|
|
$this->session->set_flashdata('success', 'dikembalikan');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
} else {
|
|
$this->session->set_flashdata('failed', 'dikembalikan');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
}
|
|
|
|
//SUBMENU TRANSAKSI - KLAIM PRODUK
|
|
public function SP_Sub1_KlaimProduk_1() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$now = date('Y-m-d');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "SP", "TRANSAKSI - Klaim Produk");
|
|
$id_menu = $datShm[0]['MENU_ID'];
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
if ($hak>=3) {
|
|
$datSsp = $this->Amod->getData_SetSalesProduk();
|
|
} else {
|
|
$datSsp = $this->Amod->getData_SetSalesProduk_bySALES($id_karyawan);
|
|
}
|
|
|
|
$datStsp = $this->Amod->getData_SetToggleSp_byKARYAWAN($id_karyawan);
|
|
$mtmOk = 0;
|
|
if ($datStsp==FALSE) {
|
|
$id_ssp = 0;
|
|
$id_merk = 0;
|
|
$id_produk = 0;
|
|
$countRekap = 0;
|
|
$countSnkpr = 0;
|
|
$countSnNot = 0;
|
|
$datSnNot = NULL;
|
|
$datSnkpr = NULL;
|
|
$datKpr = NULL;
|
|
$datPkl = NULL;
|
|
$datLkpr = NULL;
|
|
$produkTampil = "Tidak Berhak";
|
|
} else {
|
|
$id_ssp = $datStsp[0]['SSP_ID'];
|
|
$id_merk = $datStsp[0]['MERK_ID'];
|
|
$id_produk = $datStsp[0]['PRODUK_ID'];
|
|
$nama_merk = $datStsp[0]['NAMA_MERK'];
|
|
$nama_produk = $datStsp[0]['NAMA_PRODUK'];
|
|
$produkTampil = "$nama_merk $nama_produk";
|
|
|
|
if ($id_merk==3 AND $id_produk==1) {
|
|
$mtmOk = 1;
|
|
}
|
|
|
|
$datSnNot = $this->Amod->getData_SnKlaimProgram_byMERK_byPRODUK_status1_notSaleOut($id_merk, $id_produk);
|
|
$datSnkpr = $this->Amod->getData_SnKlaimProgram_byMERK_byPRODUK($id_merk, $id_produk);
|
|
$datKpr = $this->Amod->getData_KlaimProgram_byMERK_byPRODUK_bySTATUS_spNotNull($id_merk, $id_produk, 9);
|
|
$datPkl = $this->Amod->getData_PeriodeKlaimProgram_byMERK_bySTATUS($datStsp[0]['MERK_ID'], 1);
|
|
$datLkpr = $this->Amod->getData_LinkKlaimProgram_byMERK_byPRODUK_groupPKPR_forRekap($id_merk, $id_produk);
|
|
$countRekap = count($datLkpr);
|
|
$countSnNot = count($datSnNot);
|
|
$countSnkpr = count($datSnkpr);
|
|
}
|
|
|
|
$datStgas = $this->Amod->getData_SetToggleAs_bySSP($id_ssp);
|
|
$stas = 0;
|
|
if ($datStgas==TRUE) {
|
|
$stas = $datStgas[0]['STATUS_STGAS'];
|
|
}
|
|
|
|
$datStpos = $this->Amod->getData_SetTogglePosisi_byKARYAWAN_byMENU($id_karyawan, $id_menu);
|
|
if ($datStpos==FALSE) { $posisiToggle = 0; } else { $posisiToggle = $datStpos[0]['AKTIF_STPOS']; }
|
|
|
|
$data = array(
|
|
'sidebar' => "menu salesproduk",
|
|
'navChild' => "salesproduk klaimproduk",
|
|
'posisiToggle' => $posisiToggle,
|
|
'id_menu' => $id_menu,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil,
|
|
'produkTampil' => $produkTampil,
|
|
'id_ssp' => $id_ssp,
|
|
'id_merk' => $id_merk,
|
|
'id_produk' => $id_produk,
|
|
'stas' => $stas,
|
|
'tgl' => $now,
|
|
'mtmOk' => $mtmOk,
|
|
'ssp' => $datSsp,
|
|
'kpr' => $datKpr,
|
|
'pkl' => $datPkl,
|
|
'lkpr' => $datLkpr,
|
|
'snkpr' => $datSnkpr,
|
|
'snNot' => $datSnNot,
|
|
'countSnkpr' => $countSnkpr,
|
|
'countSnNot' => $countSnNot,
|
|
'countRekap' => $countRekap,
|
|
);
|
|
$this->load->view('proses/SP_Sub1_KlaimProduk_1', $data);
|
|
}
|
|
|
|
public function SP_Ubah_Sub1_B1_DataKlaimProgram() {
|
|
$id_kpr = $this->input->post('id_kpred');
|
|
$harga_kpr = $this->input->post('harga_kpred');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$datKpr = $this->Amod->getData_KlaimProgram_byID($id_kpr);
|
|
if ($datKpr==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
//Check apakah nilai Fee Numeric
|
|
$check_nilai = is_numeric($harga_kpr);
|
|
if ($check_nilai==FALSE) {
|
|
$harga_kpr = 0;
|
|
}
|
|
|
|
$update = [
|
|
'HARGA_KPR' => $harga_kpr,
|
|
'HPP_KPR' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('klaim_program', $update, 'ID_KPR', $id_kpr);
|
|
|
|
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 SP_Kembali_Sub1_B1_DataKlaimProgram() {
|
|
$id_kpr = $this->input->post('id_kprload');
|
|
|
|
foreach ($id_kpr as $key) {
|
|
$datKpr = $this->Amod->getData_KlaimProgram_byID_bySTATUS($key, 9);
|
|
if ($datKpr==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
}
|
|
|
|
foreach ($id_kpr as $key) {
|
|
$update = [
|
|
'SP_KPR' => NULL,
|
|
'STATUS_KPR' => '0'
|
|
];
|
|
$action = $this->Amod->update('klaim_program', $update, 'ID_KPR', $key);
|
|
|
|
$datSnkpr = $this->Amod->getData_SnKlaimProgram_byKPR($key);
|
|
foreach ($datSnkpr as $dat) {
|
|
$update = [
|
|
'STATUS_SNKPR' => '0'
|
|
];
|
|
$action = $this->Amod->update('sn_klaimprogram', $update, 'ID_SNKPR', $dat['ID_SNKPR']);
|
|
}
|
|
}
|
|
|
|
if ($action) {
|
|
$this->session->set_flashdata('success', 'dikembalikan');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
} else {
|
|
$this->session->set_flashdata('failed', 'dikembalikan');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
}
|
|
|
|
public function SP_Sembunyi_Sub1_B1_DataKlaimProgram() {
|
|
$id_kpr = $this->input->post('id_kprsp');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
$now = date('Y-m-d');
|
|
|
|
$datKpr = $this->Amod->getData_KlaimProgram_byID($id_kpr);
|
|
if ($datKpr==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$cekDkpr = $this->Amod->getData_DaftarKlaimProgram_byKPR($id_kpr);
|
|
if ($cekDkpr==TRUE) {
|
|
$this->session->set_flashdata('dkpr_used', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$countSnkpr = $this->Amod->getCount_SnKlaimProgram_byKPR_statusNot0($id_kpr);
|
|
if ($countSnkpr>0) {
|
|
$this->session->set_flashdata('sn_used', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$datSnkpr = $this->Amod->getData_SnKlaimProgram_byKPR($id_kpr);
|
|
foreach ($datSnkpr as $key) {
|
|
$update = [
|
|
'STATUS_SNKPR' => '9'
|
|
];
|
|
$action = $this->Amod->update('sn_klaimprogram', $update, 'ID_SNKPR', $key['ID_SNKPR']);
|
|
}
|
|
|
|
$update = [
|
|
'STATUS_KPR' => '9',
|
|
'SP_KPR' => "Oleh $panggilan pada $timestamp",
|
|
];
|
|
$action = $this->Amod->update('klaim_program', $update, 'ID_KPR', $id_kpr);
|
|
|
|
if ($action) {
|
|
$this->session->set_flashdata('success', 'disembunyikan');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
} else {
|
|
$this->session->set_flashdata('failed', 'disembunyikan');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
}
|
|
|
|
public function SP_Ubah_Sub1_B1_DataLinkKlaimProgram() {
|
|
$id_lkpr = $this->input->post('id_lkpr');
|
|
$nilai_lkpr = $this->input->post('nilai_lkpr');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$value = 0;
|
|
$nilaiPromo = 0;
|
|
$datLkpr = $this->Amod->getData_LinkKlaimProgram_byID_RKPRNull($id_lkpr);
|
|
if ($datLkpr==FALSE) {
|
|
$value = 3;
|
|
} else {
|
|
if ($nilai_lkpr==$datLkpr[0]['NILAI_LKPR']) {
|
|
$value = 2;
|
|
} else {
|
|
$update = [
|
|
'UBAH_LKPR' => "Oleh $panggilan pada $timestamp",
|
|
'NILAI_LKPR' => $nilai_lkpr
|
|
];
|
|
$action = $this->Amod->update('link_klaimprogram', $update, 'ID_LKPR', $id_lkpr);
|
|
|
|
$sumLkpr = $this->Amod->getSum_LinkKlaimProgram_byPKPR_byMERK_byPRODUK_RKPRNull($datLkpr[0]['PKPR_ID'], $datLkpr[0]['MERK_ID'], $datLkpr[0]['PRODUK_ID']);
|
|
$nilaiPromo = number_format($sumLkpr[0]['TOTAL'],2);
|
|
|
|
$value = 1;
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
'nilaiPromo' => $nilaiPromo,
|
|
]);
|
|
}
|
|
|
|
public function SP_Sellout_Sub1_B1_DataSnKlaimProgram() {
|
|
$id_merk = $this->input->post('id_merkst');
|
|
$id_produk = $this->input->post('id_produkst');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
$now = date('Y-m-d');
|
|
|
|
$datSnNot = $this->Amod->getData_SnKlaimProgram_byMERK_byPRODUK_status1_notSaleOut($id_merk, $id_produk);
|
|
foreach ($datSnNot as $key) {
|
|
$datHsn = $this->Amod->getData_HistoriSn_bySNKPR_bySTATUS_limit1_forKlaim($key['ID_SNKPR'], 1);
|
|
if ($datHsn==TRUE) {
|
|
$tgl_lkpr = $datHsn[0]['TGL_HSN'];
|
|
$month = date_format(date_create($tgl_lkpr), "m");
|
|
$year = date_format(date_create($tgl_lkpr), "Y");
|
|
$bulan = strtoupper($this->Amod->generate_inisialMonth($month));
|
|
$nama_pkpr = "[AUTO SELLOUT] $bulan $year";
|
|
|
|
$datPkpr = $this->Amod->getData_PotonganKlaimProgram_byNAMA($nama_pkpr);
|
|
if ($datPkpr==TRUE) {
|
|
$input = [
|
|
'CIPTA_LKPR' => "Oleh $panggilan pada $timestamp",
|
|
'PROGRAM_ID' => '1',
|
|
'SNKPR_ID' => $key['ID_SNKPR'],
|
|
'PKPR_ID' => $datPkpr[0]['ID_PKPR'],
|
|
'TGL_LKPR' => $tgl_lkpr,
|
|
'NILAI_LKPR' => '0'
|
|
];
|
|
$action = $this->Amod->create('link_klaimprogram', $input);
|
|
|
|
$update = [
|
|
'STATUS_SNKPR' => '1'
|
|
];
|
|
$action = $this->Amod->update('sn_klaimprogram', $update, 'ID_SNKPR', $key['ID_SNKPR']);
|
|
}
|
|
}
|
|
}
|
|
|
|
if ($action) {
|
|
$this->session->set_flashdata('success', 'disellout');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
} else {
|
|
$this->session->set_flashdata('failed', 'disellout');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
}
|
|
|
|
public function SP_Kunci_Sub1_B1_DataRekapKlaimProgram() {
|
|
$id_pkpr = $this->input->post('id_pkprlock');
|
|
$id_merk = $this->input->post('id_merklock');
|
|
$id_produk = $this->input->post('id_produklock');
|
|
$id_pkl = $this->input->post('id_pkllock');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$datPkpr = $this->Amod->getData_PotonganKlaimProgram_byID($id_pkpr);
|
|
if ($datPkpr==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$sumLkpr = $this->Amod->getSum_LinkKlaimProgram_byPKPR_byMERK_byPRODUK_RKPRNull($id_pkpr, $id_merk, $id_produk);
|
|
if ($sumLkpr==FALSE OR $sumLkpr[0]['TOTAL']==NULL) {
|
|
$nilai_rkpr = 0;
|
|
} else {
|
|
$nilai_rkpr = $sumLkpr[0]['TOTAL'];
|
|
}
|
|
|
|
$input = [
|
|
'CIPTA_RKPR' => "Oleh $panggilan pada $timestamp",
|
|
'PKPR_ID' => $id_pkpr,
|
|
'MERK_ID' => $id_merk,
|
|
'PRODUK_ID' => $id_produk,
|
|
'PKL_ID' => $id_pkl,
|
|
'NILAI_RKPR' => $nilai_rkpr,
|
|
'STATUS_RKPR' => '0'
|
|
];
|
|
$action = $this->Amod->create('rekap_klaimprogram', $input);
|
|
|
|
$id_rkpr = $this->Amod->getMax_ID_RekapKlaimProgram();
|
|
$id_rkpr = $id_rkpr[0]['ID_RKPR'];
|
|
|
|
$datLkpr = $this->Amod->getData_LinkKlaimProgram_byPKPR_byMERK_byPRODUK_RKPRNull($id_pkpr, $id_merk, $id_produk);
|
|
foreach ($datLkpr as $key) {
|
|
$update = [
|
|
'RKPR_ID' => $id_rkpr
|
|
];
|
|
$action = $this->Amod->update('link_klaimprogram', $update, 'ID_LKPR', $key['ID_LKPR']);
|
|
}
|
|
|
|
if ($action) {
|
|
$this->session->set_flashdata('success', 'dikunci');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
} else {
|
|
$this->session->set_flashdata('failed', 'dikunci');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
}
|
|
|
|
public function SP_Simpan_Sub1_DataDaftarKlaimProgram() {
|
|
$id_kpr = $this->input->post('id_kpr');
|
|
$id_mix = $this->input->post('id_mix');
|
|
$limit = $this->input->post('limit');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$value = 0;
|
|
$datKpr = $this->Amod->getData_KlaimProgram_byID_bySTATUS($id_kpr, 0);
|
|
if ($datKpr==FALSE) {
|
|
$value = 4;
|
|
} else {
|
|
$cekKpr = $this->Amod->getData_KlaimProgram_byID_bySTATUS($id_mix, 0);
|
|
if ($cekKpr==FALSE) {
|
|
$value = 4;
|
|
} else {
|
|
$cekDkpr = $this->Amod->getData_DaftarKlaimProgram_byKPR_byMIX($id_kpr, $id_mix);
|
|
if ($cekDkpr==TRUE) {
|
|
$value = 3;
|
|
} else {
|
|
$sumDkpr = $this->Amod->getSum_DaftarKlaimProgram_byKPR($id_kpr);
|
|
if ($sumDkpr==FALSE OR $sumDkpr[0]['TOTAL']==NULL) {
|
|
$terpakai = 0;
|
|
} else {
|
|
$terpakai = $sumDkpr[0]['TOTAL'];
|
|
}
|
|
$datDb = $this->Amod->getData_DaftarBeli_byID($cekKpr[0]['DB_ID']);
|
|
|
|
if (($terpakai+$datDb[0]['QTY_DB'])>$limit) {
|
|
$value = 2;
|
|
} else {
|
|
$input = [
|
|
'KPR_ID' => $id_kpr,
|
|
'MIX_ID' => $id_mix,
|
|
'QTY_DKPR' => $datDb[0]['QTY_DB'],
|
|
'CIPTA_DKPR' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->create('daftar_klaimprogram', $input);
|
|
|
|
$value = 1;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
}
|
|
|
|
public function SP_Hapus_Sub1_DataDaftarKlaimProgram() {
|
|
$id_dkpr = $this->input->post('id_dkpr');
|
|
$id_kpr = $this->input->post('id_kpr');
|
|
|
|
$value = 0;
|
|
$datDkpr = $this->Amod->getData_DaftarKlaimProgram_byID($id_dkpr);
|
|
if ($datDkpr==FALSE) {
|
|
$value = 3;
|
|
} else {
|
|
$datKpr = $this->Amod->getData_KlaimProgram_byID_bySTATUS($id_kpr, 0);
|
|
if ($datKpr==FALSE) {
|
|
$value = 2;
|
|
} else {
|
|
$action = $this->Amod->delete('daftar_klaimprogram', $id_dkpr, 'ID_DKPR');
|
|
$value = 1;
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
}
|
|
|
|
public function SP_Kunci_Sub1_DataDaftarKlaimProgram() {
|
|
$id_kpr = $this->input->post('id_kpr');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$value = 0;
|
|
$datKpr = $this->Amod->getData_KlaimProgram_byID_bySTATUS($id_kpr, 0);
|
|
if ($datKpr==FALSE) {
|
|
$value = 2;
|
|
} else {
|
|
$datDkpr = $this->Amod->getData_DaftarKlaimProgram_byKPR($id_kpr);
|
|
foreach ($datDkpr as $key) {
|
|
$cekKpr = $this->Amod->getData_KlaimProgram_byID($key['MIX_ID']);
|
|
$harga_kpr = $cekKpr[0]['HARGA_KPR']+$datKpr[0]['HARGA_KPR'];
|
|
|
|
$update = [
|
|
'HARGA_KPR' => $harga_kpr
|
|
];
|
|
$action = $this->Amod->update('klaim_program', $update, 'ID_KPR', $key['MIX_ID']);
|
|
}
|
|
|
|
$update = [
|
|
'STATUS_KPR' => '9',
|
|
'MIX_KPR' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('klaim_program', $update, 'ID_KPR', $id_kpr);
|
|
|
|
$value = 1;
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
}
|
|
|
|
public function SP_Sub1_KlaimProduk_2($id) {
|
|
$datKpr = $this->Amod->getData_KlaimProgram_byID($id);
|
|
$datSnkpr = $this->Amod->getData_SnKlaimProgram_byKPR_orderSTATUS($id);
|
|
$datProgram = $this->Amod->getData_Program();
|
|
$tgl = date('Y-m-d');
|
|
|
|
//foreach ($datSnkpr as $key) {
|
|
// if ($key['STATUS_SNSTOCK']==2 AND $key['STATUS_SNKPR']!=2) {
|
|
// $update = [
|
|
// 'STATUS_SNKPR' => '2'
|
|
// ];
|
|
// $action = $this->Amod->update('sn_klaimprogram', $update, 'ID_SNKPR', $key['ID_SNKPR']);
|
|
// } else if ($key['STATUS_SNSTOCK']==3 AND $key['STATUS_SNKPR']!=3 AND $key['ID_SNKPR']!=8550) {
|
|
// $update = [
|
|
// 'STATUS_SNKPR' => '3'
|
|
// ];
|
|
// $action = $this->Amod->update('sn_klaimprogram', $update, 'ID_SNKPR', $key['ID_SNKPR']);
|
|
// }
|
|
//}
|
|
//
|
|
//$datSnkpr = $this->Amod->getData_SnKlaimProgram_byKPR_orderSTATUS($id);
|
|
$no = 0;
|
|
foreach ($datSnkpr as $key) {
|
|
if ($key['BID']!=$key['CID']) {
|
|
$datBarang = $this->Amod->getData_Barang_byID($key['CID']);
|
|
$snModif = $datBarang[0]['NAMA_BARANG'];
|
|
} else {
|
|
$snModif = "";
|
|
}
|
|
|
|
$datLnkpr = $this->Amod->getData_LinkKlaimProgram_bySNKPR($key['ID_SNKPR']);
|
|
$datHsn = $this->Amod->getData_HistoriSn_bySNKPR_bySTATUS_limit1_forKlaim($key['ID_SNKPR'], 1);
|
|
if ($datHsn==TRUE) {
|
|
if (strlen($datHsn[0]['NAMA_PELANGGAN'])>=25) {
|
|
$nama_pelanggan = substr($datHsn[0]['NAMA_PELANGGAN'],0,25);
|
|
$nama_pelanggan = "$nama_pelanggan...";
|
|
} else {
|
|
$nama_pelanggan = $datHsn[0]['NAMA_PELANGGAN'];
|
|
}
|
|
$tgl_penjualan = $datHsn[0]['TANGGAL'];
|
|
} else {
|
|
$nama_pelanggan = NULL;
|
|
$tgl_penjualan = NULL;
|
|
}
|
|
|
|
$datSnkpr[$no] += ['SNMOD' => $snModif];
|
|
$datSnkpr[$no] += ['NAPEL' => $nama_pelanggan];
|
|
$datSnkpr[$no] += ['TGLJUAL' => $tgl_penjualan];
|
|
$datSnkpr[$no++] += ['LINK' => $datLnkpr];
|
|
}
|
|
|
|
$data = array(
|
|
'sidebar' => "menu salesproduk",
|
|
'navChild' => "salesproduk klaimproduk",
|
|
'snkpr' => $datSnkpr,
|
|
'program' => $datProgram,
|
|
'id_kpr' => $id,
|
|
'tgl' => $tgl,
|
|
'nama_supplier' => $datKpr[0]['NAMA_SUPPLIER'],
|
|
'nota_kpr' => $datKpr[0]['NOTA_KPR'],
|
|
'nama_barang' => $datKpr[0]['NAMA_BARANG'],
|
|
);
|
|
$this->load->view('proses/SP_Sub1_KlaimProduk_2', $data);
|
|
}
|
|
|
|
public function SP_Tambah_Sub1_B2_DataLinkKlaimProgram() {
|
|
$id_snkpr = $this->input->post('id_snkprnew');
|
|
$id_program = $this->input->post('id_programnew');
|
|
$nilai_lkpr = $this->input->post('nilai_lkprnew');
|
|
$tgl_lkpr = $this->input->post('tgl_lkprnew');
|
|
$nama_pkpr = $this->input->post('nama_pkprnew');
|
|
$nama_pkpr = strtoupper(ltrim(rtrim(preg_replace('/\R+/', " " , $nama_pkpr))));
|
|
$nilai_lkpr = str_replace(',', '.', $nilai_lkpr);
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
|
|
foreach ($id_snkpr as $key) {
|
|
$datSnkpr = $this->Amod->getData_SnKlaimProgram_byID($key);
|
|
if ($datSnkpr==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
}
|
|
|
|
$cekNilai = is_numeric($nilai_lkpr);
|
|
if ($cekNilai==FALSE) {
|
|
$nilai_lkpr = 0;
|
|
}
|
|
|
|
if ($nilai_lkpr<0) {
|
|
$this->session->set_flashdata('not_zero_negative', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$datPkpr = $this->Amod->getData_PotonganKlaimProgram_byNAMA($nama_pkpr);
|
|
if ($datPkpr==TRUE) {
|
|
$id_pkpr = $datPkpr[0]['ID_PKPR'];
|
|
} else {
|
|
$input = [
|
|
'NAMA_PKPR' => $nama_pkpr,
|
|
];
|
|
$action = $this->Amod->create('potongan_klaimprogram', $input);
|
|
|
|
$id_pkpr = $this->Amod->getMax_ID_PotonganKlaimProgram();
|
|
$id_pkpr = $id_pkpr[0]['ID_PKPR'];
|
|
}
|
|
|
|
foreach ($id_snkpr as $key) {
|
|
$input = [
|
|
'CIPTA_LKPR' => "Oleh $panggilan pada $timestamp",
|
|
'PROGRAM_ID' => $id_program,
|
|
'SNKPR_ID' => $key,
|
|
'PKPR_ID' => $id_pkpr,
|
|
'TGL_LKPR' => $tgl_lkpr,
|
|
'NILAI_LKPR' => $nilai_lkpr,
|
|
];
|
|
$action = $this->Amod->create('link_klaimprogram', $input);
|
|
|
|
if ($id_program==1) {
|
|
$update = [
|
|
'STATUS_SNKPR' => '1'
|
|
];
|
|
$action = $this->Amod->update('sn_klaimprogram', $update, 'ID_SNKPR', $key);
|
|
}
|
|
}
|
|
|
|
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 SP_Perbaruhi_Sub1_B2_DataSnKlaimProgram() {
|
|
$id_snkpr = $this->input->post('id_snkprstat');
|
|
$status_snkpr = $this->input->post('status_snkprstat');
|
|
|
|
foreach ($id_snkpr as $key) {
|
|
$datSnkpr = $this->Amod->getData_SnKlaimProgram_not123($key);
|
|
if ($datSnkpr==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
}
|
|
|
|
foreach ($id_snkpr as $key) {
|
|
$update = [
|
|
'STATUS_SNKPR' => $status_snkpr
|
|
];
|
|
$action = $this->Amod->update('sn_klaimprogram', $update, 'ID_SNKPR', $key);
|
|
}
|
|
|
|
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 SP_Ubah_Sub1_B2_DataLinkKlaimProgram() {
|
|
$id_lkpr = $this->input->post('id_lkpred');
|
|
$id_program = $this->input->post('id_programed');
|
|
$nilai_lkpr = $this->input->post('nilai_lkpred');
|
|
$nama_pkpr = $this->input->post('nama_pkpred');
|
|
$tgl_lkpr = $this->input->post('tgl_lkpred');
|
|
$nama_pkpr = strtoupper(rtrim(preg_replace('/\R+/', " " , $nama_pkpr)));
|
|
$nilai_lkpr = str_replace(',', '.', $nilai_lkpr);
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
|
|
$datLnkpr = $this->Amod->getData_LinkKlaimProgram_byID_RKPRNull($id_lkpr);
|
|
if ($datLnkpr==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$cekNilai = is_numeric($nilai_lkpr);
|
|
if ($cekNilai==FALSE) {
|
|
$nilai_lkpr = 0;
|
|
}
|
|
|
|
if ($nilai_lkpr<0) {
|
|
$this->session->set_flashdata('not_zero_negative', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$datPkpr = $this->Amod->getData_PotonganKlaimProgram_byNAMA($nama_pkpr);
|
|
if ($datPkpr==TRUE) {
|
|
$id_pkpr = $datPkpr[0]['ID_PKPR'];
|
|
} else {
|
|
$input = [
|
|
'NAMA_PKPR' => $nama_pkpr,
|
|
];
|
|
$action = $this->Amod->create('potongan_klaimprogram', $input);
|
|
|
|
$id_pkpr = $this->Amod->getMax_ID_PotonganKlaimProgram();
|
|
$id_pkpr = $id_pkpr[0]['ID_PKPR'];
|
|
}
|
|
|
|
if ($datLnkpr[0]['PROGRAM_ID']==1 AND $id_program!=1) {
|
|
$update = [
|
|
'STATUS_SNKPR' => '0'
|
|
];
|
|
$action = $this->Amod->update('sn_klaimprogram', $update, 'ID_SNKPR', $datLnkpr[0]['SNKPR_ID']);
|
|
}
|
|
|
|
$update = [
|
|
'UBAH_LKPR' => "Oleh $panggilan pada $timestamp",
|
|
'PROGRAM_ID' => $id_program,
|
|
'PKPR_ID' => $id_pkpr,
|
|
'TGL_LKPR' => $tgl_lkpr,
|
|
'NILAI_LKPR' => $nilai_lkpr,
|
|
];
|
|
$action = $this->Amod->update('link_klaimprogram', $update, 'ID_LKPR', $id_lkpr);
|
|
|
|
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 SP_Hapus_Sub1_B2_DataLinkKlaimProgram() {
|
|
$id_lkpr = $this->input->post('id_lkprdel');
|
|
|
|
$datLkpr = $this->Amod->getData_LinkKlaimProgram_byID_RKPRNull($id_lkpr);
|
|
if ($datLkpr==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
if ($datLkpr[0]['PROGRAM_ID']==1) {
|
|
$update = [
|
|
'STATUS_SNKPR' => '0'
|
|
];
|
|
$action = $this->Amod->update('sn_klaimprogram', $update, 'ID_SNKPR', $datLkpr[0]['SNKPR_ID']);
|
|
}
|
|
|
|
$datHob = $this->Amod->getData_HistoriOtomasiBooster_byLKPR($id_lkpr);
|
|
if ($datHob==TRUE) {
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$update = [
|
|
'HAPUS_HOB' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('histori_otomasibooster', $update, 'ID_HOB', $datHob[0]['ID_HOB']);
|
|
}
|
|
|
|
$action = $this->Amod->delete('link_klaimprogram', $id_lkpr, 'ID_LKPR');
|
|
|
|
if ($action) {
|
|
$this->session->set_flashdata('success', 'dihapus');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
} else {
|
|
$this->session->set_flashdata('failed', 'dihapus');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
}
|
|
|
|
//SUBMENU TRANSAKSI - OTOMASI BOOSTER
|
|
public function SP_Sub1_OtomasiBooster_1() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
$now = date('Y-m-d');
|
|
$limit = date('Y-m-01');
|
|
$limit = $this->Amod->generate_subMonth($limit, 1);
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "SP", "TRANSAKSI - Otomasi Booster");
|
|
$id_menu = $datShm[0]['MENU_ID'];
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
if ($hak>=3) {
|
|
$datSsp = $this->Amod->getData_SetSalesProduk();
|
|
} else {
|
|
$datSsp = $this->Amod->getData_SetSalesProduk_bySALES($id_karyawan);
|
|
}
|
|
|
|
$datStsp = $this->Amod->getData_SetToggleSp_byKARYAWAN($id_karyawan);
|
|
if ($datStsp==FALSE) {
|
|
$id_ssp = 0;
|
|
$countKosong = 0;
|
|
$countBerjalan = 0;
|
|
$countSelesai = 0;
|
|
$otomasiKosong = NULL;
|
|
$otomasiBerjalan = NULL;
|
|
$otomasiSelesai = NULL;
|
|
$datBarang = NULL;
|
|
$produkTampil = "Tidak Berhak";
|
|
} else {
|
|
$id_ssp = $datStsp[0]['SSP_ID'];
|
|
$nama_merk = $datStsp[0]['NAMA_MERK'];
|
|
$nama_produk = $datStsp[0]['NAMA_PRODUK'];
|
|
$produkTampil = "$nama_merk $nama_produk";
|
|
|
|
$otomasiKosong = $this->Amod->getData_OtomasiBooster_bySSP_bySTATUS($id_ssp, 0);
|
|
$no = 0;
|
|
foreach ($otomasiKosong as $key) {
|
|
$datDob = $this->Amod->getData_DaftarOtomasiBooster_byOB($key['ID_OB']);
|
|
$datHob = $this->Amod->getData_HistoriOtomasiBooster_byOB($key['ID_OB']);
|
|
if ($datHob==TRUE) {
|
|
$lock = 1;
|
|
} else {
|
|
$lock = 0;
|
|
}
|
|
|
|
$otomasiKosong[$no] += ['LOCK' => $lock];
|
|
$otomasiKosong[$no] += ['SKU' => $datDob];
|
|
$otomasiKosong[$no++] += ['REAL' => count($datDob)];
|
|
}
|
|
|
|
$otomasiBerjalan = $this->Amod->getData_OtomasiBooster_bySSP_bySTATUS($id_ssp, 1);
|
|
$no = 0;
|
|
foreach ($otomasiBerjalan as $key) {
|
|
$datDob = $this->Amod->getData_DaftarOtomasiBooster_byOB($key['ID_OB']);
|
|
$countHobAll = $this->Amod->getCount_HistoriOtomasiBooster_byOB($key['ID_OB']);
|
|
$countHobVoid = $this->Amod->getCount_HistoriOtomasiBooster_byOB_batalNotNull($key['ID_OB']);
|
|
|
|
$otomasiBerjalan[$no] += ['SKU' => $datDob];
|
|
$otomasiBerjalan[$no] += ['HOBALL' => $countHobAll];
|
|
$otomasiBerjalan[$no++] += ['HOBVOID' => $countHobVoid];
|
|
}
|
|
|
|
$otomasiSelesai = $this->Amod->getData_OtomasiBooster_bySSP_bySTATUS_byLIMIT($id_ssp, 2, $limit);
|
|
$no = 0;
|
|
foreach ($otomasiSelesai as $key) {
|
|
$datDob = $this->Amod->getData_DaftarOtomasiBooster_byOB($key['ID_OB']);
|
|
$countHobAll = $this->Amod->getCount_HistoriOtomasiBooster_byOB($key['ID_OB']);
|
|
$countHobVoid = $this->Amod->getCount_HistoriOtomasiBooster_byOB_batalNotNull($key['ID_OB']);
|
|
|
|
$otomasiSelesai[$no] += ['SKU' => $datDob];
|
|
$otomasiSelesai[$no] += ['HOBALL' => $countHobAll];
|
|
$otomasiSelesai[$no++] += ['HOBVOID' => $countHobVoid];
|
|
}
|
|
|
|
$countKosong = count($otomasiKosong);
|
|
$countBerjalan = count($otomasiBerjalan);
|
|
$countSelesai = count($otomasiSelesai);
|
|
$datBarang = $this->Amod->getData_KlaimProgram_byMERK_byPRODUK_groupBARANG($datStsp[0]['MERK_ID'], $datStsp[0]['PRODUK_ID']);
|
|
}
|
|
|
|
$datStpos = $this->Amod->getData_SetTogglePosisi_byKARYAWAN_byMENU($id_karyawan, $id_menu);
|
|
if ($datStpos==FALSE) { $posisiToggle = 0; } else { $posisiToggle = $datStpos[0]['AKTIF_STPOS']; }
|
|
|
|
$data = array(
|
|
'sidebar' => "menu salesproduk",
|
|
'navChild' => "salesproduk otomasibooster",
|
|
'posisiToggle' => $posisiToggle,
|
|
'id_menu' => $id_menu,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil,
|
|
'produkTampil' => $produkTampil,
|
|
'id_ssp' => $id_ssp,
|
|
'ssp' => $datSsp,
|
|
'tgl' => $now,
|
|
'barang' => $datBarang,
|
|
'otomasiKosong' => $otomasiKosong,
|
|
'otomasiBerjalan' => $otomasiBerjalan,
|
|
'otomasiSelesai' => $otomasiSelesai,
|
|
'countKosong' => $countKosong,
|
|
'countBerjalan' => $countBerjalan,
|
|
'countSelesai' => $countSelesai,
|
|
);
|
|
$this->load->view('proses/SP_Sub1_OtomasiBooster_1', $data);
|
|
}
|
|
|
|
public function SP_Tambah_Sub1_C1_DataOtomasiBooster() {
|
|
$jenis_ob = $this->input->post('jenis_obnew');
|
|
$awal_ob = $this->input->post('awal_obnew');
|
|
$akhir_ob = $this->input->post('akhir_obnew');
|
|
$nama_pkpr = $this->input->post('nama_pkprnew');
|
|
$id_ssp = $this->input->post('id_sspnew');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$nama_pkpr = strtoupper(ltrim(rtrim(preg_replace('/\R+/', " " , $nama_pkpr))));
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$datPkpr = $this->Amod->getData_PotonganKlaimProgram_byNAMA($nama_pkpr);
|
|
if ($datPkpr==TRUE) {
|
|
$id_pkpr = $datPkpr[0]['ID_PKPR'];
|
|
} else {
|
|
$input = [
|
|
'NAMA_PKPR' => $nama_pkpr,
|
|
];
|
|
$action = $this->Amod->create('potongan_klaimprogram', $input);
|
|
|
|
$id_pkpr = $this->Amod->getMax_ID_PotonganKlaimProgram();
|
|
$id_pkpr = $id_pkpr[0]['ID_PKPR'];
|
|
}
|
|
|
|
$input = [
|
|
'CIPTA_OB' => "Oleh $panggilan pada $timestamp",
|
|
'JENIS_OB' => $jenis_ob,
|
|
'AWAL_OB' => $awal_ob,
|
|
'AKHIR_OB' => $akhir_ob,
|
|
'SSP_ID' => $id_ssp,
|
|
'PKPR_ID' => $id_pkpr,
|
|
'STATUS_OB' => '0'
|
|
];
|
|
$action = $this->Amod->create('otomasi_booster', $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 SP_Simpan_Sub1_C1_DataDaftarOtomasiBooster() {
|
|
$id_ob = $this->input->post('id_ob');
|
|
$id_barang = $this->input->post('id_barang');
|
|
$nilai_dob = $this->input->post('nilai_dob');
|
|
|
|
//Check Konsistensi Data
|
|
$value = 0;
|
|
$datOb = $this->Amod->getData_OtomasiBooster_byID_bySTATUS($id_ob, 0);
|
|
if ($datOb==FALSE) {
|
|
$value = 4;
|
|
} else {
|
|
$datDob = $this->Amod->getData_DaftarOtomasiBooster_byOB_byBARANG($id_ob, $id_barang);
|
|
if ($datDob==TRUE) {
|
|
$value = 3;
|
|
} else {
|
|
$cekDob = $this->Amod->getData_DaftarOtomasiBooster_byBARANG_byJENIS_bySTATUS($id_barang, 1, 1);
|
|
if ($cekDob==FALSE) {
|
|
$value = 1;
|
|
} else {
|
|
if ($datOb[0]['JENIS_OB']==1) {
|
|
foreach ($cekDob as $key) {
|
|
$diffawal = new DateTime($key['AWAL_OB']);
|
|
$diffakhir = new DateTime($key['AKHIR_OB']);
|
|
$diff = date_diff($diffawal, $diffakhir);
|
|
$diff = $diff->format("%a");
|
|
|
|
$tglAwal = $key['AWAL_OB'];
|
|
for ($i=0; $i<=$diff; $i++) {
|
|
$tglCheck = $this->Amod->generate_addDay($tglAwal, 1);
|
|
if (strtotime($datOb[0]['AWAL_OB'])<=strtotime($tglCheck) OR strtotime($datOb[0]['AKHIR_OB'])>=strtotime($tglCheck)) {
|
|
$value = 2;
|
|
break;
|
|
}
|
|
}
|
|
|
|
if ($value==2) {
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
if ($value==0) {
|
|
$value = 1;
|
|
}
|
|
}
|
|
|
|
if ($value==1) {
|
|
$input = [
|
|
'OB_ID' => $id_ob,
|
|
'BARANG_ID' => $id_barang,
|
|
'NILAI_DOB' => $nilai_dob
|
|
];
|
|
$action = $this->Amod->create('daftar_otomasibooster', $input);
|
|
}
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
|
|
}
|
|
|
|
public function SP_Ubah_Sub1_C1_DataOtomasiBooster() {
|
|
$id_ob = $this->input->post('id_obed');
|
|
$jenis_ob = $this->input->post('jenis_obed');
|
|
$awal_ob = $this->input->post('awal_obed');
|
|
$akhir_ob = $this->input->post('akhir_obed');
|
|
$nama_pkpr = $this->input->post('nama_pkpred');
|
|
$nama_pkpr = strtoupper(ltrim(rtrim(preg_replace('/\R+/', " " , $nama_pkpr))));
|
|
|
|
$datOb = $this->Amod->getData_OtomasiBooster_byID_bySTATUS($id_ob, 0);
|
|
if ($datOb==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
if ($jenis_ob==1 AND $datOb[0]['JENIS_OB']==4) {
|
|
$datDob = $this->Amod->getData_DaftarOtomasiBooster_byOB($id_ob);
|
|
foreach ($datDob as $key) {
|
|
$cekDob = $this->Amod->getData_DaftarOtomasiBooster_byBARANG_byJENIS_bySTATUS($key['BARANG_ID'], 1, 1);
|
|
foreach ($cekDob as $dat) {
|
|
$diffawal = new DateTime($dat['AWAL_OB']);
|
|
$diffakhir = new DateTime($dat['AKHIR_OB']);
|
|
$diff = date_diff($diffawal, $diffakhir);
|
|
$diff = $diff->format("%a");
|
|
|
|
$tglAwal = $dat['AWAL_OB'];
|
|
for ($i=0; $i<=$diff; $i++) {
|
|
$tglCheck = $this->Amod->generate_addDay($tglAwal, $i);
|
|
if (strtotime($datOb[0]['AWAL_OB'])<=strtotime($tglCheck) OR strtotime($datOb[0]['AKHIR_OB'])>=strtotime($tglCheck)) {
|
|
$this->session->set_flashdata('saleout_activated', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
$datPkpr = $this->Amod->getData_PotonganKlaimProgram_byNAMA($nama_pkpr);
|
|
if ($datPkpr==TRUE) {
|
|
$id_pkpr = $datPkpr[0]['ID_PKPR'];
|
|
} else {
|
|
$input = [
|
|
'NAMA_PKPR' => $nama_pkpr,
|
|
];
|
|
$action = $this->Amod->create('potongan_klaimprogram', $input);
|
|
|
|
$id_pkpr = $this->Amod->getMax_ID_PotonganKlaimProgram();
|
|
$id_pkpr = $id_pkpr[0]['ID_PKPR'];
|
|
}
|
|
|
|
$update = [
|
|
'JENIS_OB' => $jenis_ob,
|
|
'AWAL_OB' => $awal_ob,
|
|
'AKHIR_OB' => $akhir_ob,
|
|
'PKPR_ID' => $id_pkpr
|
|
];
|
|
$action = $this->Amod->update('otomasi_booster', $update, 'ID_OB', $id_ob);
|
|
|
|
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 SP_Ubah_Sub1_C1_DataDaftarOtomasiBooster() {
|
|
$id_ob = $this->input->post('id_ob');
|
|
$id_dob = $this->input->post('id_dob');
|
|
$id_barang = $this->input->post('id_barang');
|
|
$nilai_dob = $this->input->post('nilai_dob');
|
|
|
|
//Check Konsistensi Data
|
|
$value = 0;
|
|
$datOb = $this->Amod->getData_OtomasiBooster_byID_bySTATUS($id_ob, 0);
|
|
if ($datOb==FALSE) {
|
|
$value = 5;
|
|
} else {
|
|
$cekDob = $this->Amod->getData_DaftarOtomasiBooster_byID($id_dob);
|
|
if ($cekDob==FALSE) {
|
|
$value = 4;
|
|
} else {
|
|
$datDob = $this->Amod->getData_DaftarOtomasiBooster_byOB_byBARANG($id_ob, $id_barang, $id_dob);
|
|
if ($datDob==TRUE) {
|
|
$value = 3;
|
|
} else {
|
|
$cekDob = $this->Amod->getData_DaftarOtomasiBooster_byBARANG_byJENIS_bySTATUS($id_barang, 1, 1);
|
|
if ($cekDob==FALSE) {
|
|
$value = 1;
|
|
} else {
|
|
foreach ($cekDob as $key) {
|
|
$diffawal = new DateTime($key['AWAL_OB']);
|
|
$diffakhir = new DateTime($key['AKHIR_OB']);
|
|
$diff = date_diff($diffawal, $diffakhir);
|
|
$diff = $diff->format("%a");
|
|
|
|
$tglAwal = $key['AWAL_OB'];
|
|
for ($i=0; $i<=$diff; $i++) {
|
|
$tglCheck = $this->Amod->generate_addDay($tglAwal);
|
|
if (strtotime($datOb[0]['AWAL_OB'])<=strtotime($tglCheck) OR strtotime($datOb[0]['AKHIR_OB'])>=strtotime($tglCheck)) {
|
|
$value = 2;
|
|
break;
|
|
}
|
|
}
|
|
|
|
if ($value==2) {
|
|
break;
|
|
}
|
|
}
|
|
|
|
if ($value==0) {
|
|
$value = 1;
|
|
}
|
|
}
|
|
|
|
if ($value==1) {
|
|
$update = [
|
|
'BARANG_ID' => $id_barang,
|
|
'NILAI_DOB' => $nilai_dob
|
|
];
|
|
$action = $this->Amod->update('daftar_otomasibooster', $update, 'ID_DOB', $id_dob);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
|
|
}
|
|
|
|
public function SP_Hapus_Sub1_C1_DataOtomasiBooster() {
|
|
$id_ob = $this->input->post('id_obdel');
|
|
|
|
$datOb = $this->Amod->getData_OtomasiBooster_byID_bySTATUS($id_ob, 0);
|
|
if ($datOb==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$datHob = $this->Amod->getData_HistoriOtomasiBooster_byOB($id_ob);
|
|
if ($datHob==TRUE) {
|
|
$this->session->set_flashdata('data_used', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$action = $this->Amod->delete('daftar_otomasibooster', $id_ob, 'OB_ID');
|
|
$action = $this->Amod->delete('otomasi_booster', $id_ob, 'ID_OB');
|
|
|
|
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 SP_Hapus_Sub1_C1_DataDaftarOtomasiBooster() {
|
|
$id_ob = $this->input->post('id_ob');
|
|
$id_dob = $this->input->post('id_dob');
|
|
|
|
//Check Konsistensi Data
|
|
$value = 0;
|
|
$datOb = $this->Amod->getData_OtomasiBooster_byID_bySTATUS($id_ob, 0);
|
|
if ($datOb==FALSE) {
|
|
$value = 3;
|
|
} else {
|
|
$datDob = $this->Amod->getData_DaftarOtomasiBooster_byID($id_dob);
|
|
if ($datDob==FALSE) {
|
|
$value = 2;
|
|
} else {
|
|
$action = $this->Amod->delete('daftar_otomasibooster', $id_dob, 'ID_DOB');
|
|
|
|
$value = 1;
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
|
|
}
|
|
|
|
public function SP_Proses_Sub1_C1_DataOtomasiBooster() {
|
|
$id_ob = $this->input->post('id_obpro');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$datOb = $this->Amod->getData_OtomasiBooster_byID_bySTATUS($id_ob, 0);
|
|
if ($datOb==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$update = [
|
|
'MULAI_OB' => "Oleh $panggilan pada $timestamp",
|
|
'STATUS_OB' => '1'
|
|
];
|
|
$action = $this->Amod->update('otomasi_booster', $update, 'ID_OB', $id_ob);
|
|
|
|
if ($action) {
|
|
$this->session->set_flashdata('success', 'diproses');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
} else {
|
|
$this->session->set_flashdata('failed', 'diproses');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
}
|
|
|
|
public function SP_Revisi_Sub1_C1_DataOtomasiBooster() {
|
|
$id_ob = $this->input->post('id_obrev');
|
|
|
|
$datOb = $this->Amod->getData_OtomasiBooster_byID_bySTATUS($id_ob, 1);
|
|
if ($datOb==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$update = [
|
|
'MULAI_OB' => NULL,
|
|
'STATUS_OB' => '0'
|
|
];
|
|
$action = $this->Amod->update('otomasi_booster', $update, 'ID_OB', $id_ob);
|
|
|
|
if ($action) {
|
|
$this->session->set_flashdata('success', 'direvisi');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
} else {
|
|
$this->session->set_flashdata('failed', 'direvisi');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
}
|
|
|
|
public function SP_Kunci_Sub1_C1_DataOtomasiBooster() {
|
|
$id_ob = $this->input->post('id_oblock');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
$now = date('Y-m-d');
|
|
|
|
$datOb = $this->Amod->getData_OtomasiBooster_byID_bySTATUS($id_ob, 1);
|
|
if ($datOb==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$update = [
|
|
'SELESAI_OB' => "Oleh $panggilan pada $timestamp",
|
|
'TGL_KUNCI' => $now,
|
|
'STATUS_OB' => '2'
|
|
];
|
|
$action = $this->Amod->update('otomasi_booster', $update, 'ID_OB', $id_ob);
|
|
|
|
if ($action) {
|
|
$this->session->set_flashdata('success', 'dikunci');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
} else {
|
|
$this->session->set_flashdata('failed', 'dikunci');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
}
|
|
|
|
public function SP_Buka_Sub1_C1_DataOtomasiBooster() {
|
|
$id_ob = $this->input->post('id_obun');
|
|
|
|
$datOb = $this->Amod->getData_OtomasiBooster_byID_bySTATUS($id_ob, 2);
|
|
if ($datOb==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$update = [
|
|
'SELESAI_OB' => NULL,
|
|
'TGL_KUNCI' => NULL,
|
|
'STATUS_OB' => '1'
|
|
];
|
|
$action = $this->Amod->update('otomasi_booster', $update, 'ID_OB', $id_ob);
|
|
|
|
if ($action) {
|
|
$this->session->set_flashdata('success', 'dibuka');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
} else {
|
|
$this->session->set_flashdata('failed', 'dibuka');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
}
|
|
|
|
public function SP_Sub1_OtomasiBooster_2($id) {
|
|
$datHob = $this->Amod->getData_HistoriOtomasiBooster_byOB($id);
|
|
$datOb = $this->Amod->getData_OtomasiBooster_byID_bySTATUS($id, 1);
|
|
$sumHob = $this->Amod->getSum_HistoriOtomasiBooster_byOB($id);
|
|
if ($sumHob==FALSE OR $sumHob[0]['TOTAL']==NULL) {
|
|
$nilaiTotal = 0;
|
|
} else {
|
|
$nilaiTotal = $sumHob[0]['TOTAL'];
|
|
}
|
|
|
|
$data = array(
|
|
'sidebar' => "menu salesproduk",
|
|
'navChild' => "salesproduk otomasibooster",
|
|
'histori' => $datHob,
|
|
'nama_pkpr' => $datOb[0]['NAMA_PKPR'],
|
|
'nilaiTotal' => number_format($nilaiTotal,2),
|
|
);
|
|
$this->load->view('proses/SP_Sub1_OtomasiBooster_2', $data);
|
|
}
|
|
|
|
//SUBMENU TRANSAKSI - CREDIT NOTE
|
|
public function SP_Sub1_CreditNote_1() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$now = date('Y-m-d');
|
|
$limit = date('Y-m-01');
|
|
$limit = $this->Amod->generate_subMonth($limit, 3);
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "SP", "TRANSAKSI - Credit Note");
|
|
$id_menu = $datShm[0]['MENU_ID'];
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
if ($hak>=3) {
|
|
$datSsp = $this->Amod->getData_SetSalesProduk();
|
|
} else {
|
|
$datSsp = $this->Amod->getData_SetSalesProduk_bySALES($id_karyawan);
|
|
}
|
|
|
|
$datStsp = $this->Amod->getData_SetToggleSp_byKARYAWAN($id_karyawan);
|
|
if ($datStsp==FALSE) {
|
|
$id_ssp = 0;
|
|
$id_merk = 0;
|
|
$id_produk = 0;
|
|
$datPkl = NULL;
|
|
$datRkpr = NULL;
|
|
$cnRekap = NULL;
|
|
$cnProses = NULL;
|
|
$cnSelesai = NULL;
|
|
$countRekap = 0;
|
|
$countProses = 0;
|
|
$countSelesai = 0;
|
|
$produkTampil = "Tidak Berhak";
|
|
} else {
|
|
$id_ssp = $datStsp[0]['ID_SSP'];
|
|
$id_merk = $datStsp[0]['MERK_ID'];
|
|
$id_produk = $datStsp[0]['PRODUK_ID'];
|
|
$nama_merk = $datStsp[0]['NAMA_MERK'];
|
|
$nama_produk = $datStsp[0]['NAMA_PRODUK'];
|
|
$produkTampil = "$nama_merk $nama_produk";
|
|
|
|
$cnRekap = $this->Amod->getData_RekapKlaimProgram_byMERK_byPRODUK_bySTATUS($id_merk, $id_produk, 0);
|
|
$no = 0;
|
|
foreach ($cnRekap as $key) {
|
|
$datCn = $this->Amod->getData_CreditNote_byRKPR($key['ID_RKPR']);
|
|
$sumCn = $this->Amod->getSum_CreditNote_byRKPR($key['ID_RKPR']);
|
|
if ($sumCn==FALSE OR $sumCn[0]['TOTAL']==NULL) {
|
|
$nilaiSisa = $key['NILAI_RKPR'];
|
|
} else {
|
|
$nilaiSisa = $key['NILAI_RKPR']-$sumCn[0]['TOTAL'];
|
|
}
|
|
|
|
$cnRekap[$no] += ['SISA' => number_format($nilaiSisa,2)];
|
|
$cnRekap[$no++] += ['LINK' => $datCn];
|
|
}
|
|
|
|
$cnProses = $this->Amod->getData_CreditNote_byMERK_byPRODUK_bySTATUS($id_merk, $id_produk, 0);
|
|
$no = 0;
|
|
foreach ($cnProses as $key) {
|
|
if ($key['JENIS_CN']==1) { // Nota Penjualan
|
|
if ($key['SO_ID']==NULL) {
|
|
$link = 1;
|
|
$kobuk = "";
|
|
$nibuk = "";
|
|
} else {
|
|
$datSo = $this->Amod->getData_SalesOrder_byID($key['SO_ID']);
|
|
$link = 0;
|
|
$kobuk = $datSo[0]['KODE_SO'];
|
|
if ($datSo[0]['NILAI_SO']==NULL) {
|
|
$nibuk = 0;
|
|
} else {
|
|
$nibuk = number_format($datSo[0]['NILAI_SO'],2);
|
|
}
|
|
}
|
|
} else if ($key['JENIS_CN']==2) { // Potongan Pembelian
|
|
if ($key['PEMBELIAN_ID']==NULL) {
|
|
$link = 1;
|
|
$kobuk = "";
|
|
$nibuk = "";
|
|
} else {
|
|
$datPembelian = $this->Amod->getData_Pembelian_byID($key['PEMBELIAN_ID']);
|
|
$kobuk = $datPembelian[0]['KODE_PEMBELIAN'];
|
|
$nibuk = number_format($datPembelian[0]['POTONGAN_PEMBELIAN'],2);
|
|
$link = 0;
|
|
}
|
|
} else if ($key['JENIS_CN']==3) { // Voucher
|
|
$link = 0;
|
|
$kobuk = "";
|
|
$nibuk = "";
|
|
} else if ($key['JENIS_CN']==9) { // Data Lama
|
|
$link = 0;
|
|
$kobuk = "";
|
|
$nibuk = "";
|
|
}
|
|
$cnProses[$no] += ['KOBUK' => $kobuk];
|
|
$cnProses[$no] += ['NIBUK' => $nibuk];
|
|
$cnProses[$no++] += ['LINK' => $link];
|
|
}
|
|
|
|
$cnSelesai = $this->Amod->getData_CreditNote_byMERK_byPRODUK_bySTATUS_byLIMIT($id_merk, $id_produk, 1, $limit);
|
|
$no = 0;
|
|
foreach ($cnSelesai as $key) {
|
|
if ($key['JENIS_CN']==1) {
|
|
$datSo = $this->Amod->getData_SalesOrder_byID($key['SO_ID']);
|
|
$kobuk = $datSo[0]['KODE_SO'];
|
|
if ($datSo[0]['NILAI_SO']==NULL) {
|
|
$nibuk = 0;
|
|
} else {
|
|
$nibuk = number_format($datSo[0]['NILAI_SO'],2);
|
|
}
|
|
} else if ($key['JENIS_CN']==2) {
|
|
$datPembelian = $this->Amod->getData_Pembelian_byID($key['PEMBELIAN_ID']);
|
|
$kobuk = $datPembelian[0]['KODE_PEMBELIAN'];
|
|
$nibuk = number_format($datPembelian[0]['POTONGAN_PEMBELIAN'],2);
|
|
} else if ($key['JENIS_CN']==3) {
|
|
$kobuk = "";
|
|
$nibuk = "";
|
|
} else if ($key['JENIS_CN']==9) {
|
|
$kobuk = "";
|
|
$nibuk = "";
|
|
}
|
|
$cnSelesai[$no] += ['KOBUK' => $kobuk];
|
|
$cnSelesai[$no++] += ['NIBUK' => $nibuk];
|
|
}
|
|
|
|
$countRekap = count($cnRekap);
|
|
$countProses = count($cnProses);
|
|
$countSelesai = count($cnSelesai);
|
|
|
|
$datPkl = $this->Amod->getData_PeriodeKlaimProgram_byMERK_bySTATUS($id_merk, 1);
|
|
$datRkpr = $this->Amod->getData_RekapKlaimProgram_byMERK_byPRODUK_bySTATUS($id_merk, $id_produk, 0);
|
|
$no = 0;
|
|
foreach ($datRkpr as $key) {
|
|
$sumCn = $this->Amod->getSum_CreditNote_byRKPR($key['ID_RKPR']);
|
|
if ($sumCn==FALSE OR $sumCn[0]['TOTAL']==NULL) {
|
|
$nilaiTerpakai = 0;
|
|
} else {
|
|
$nilaiTerpakai = $sumCn[0]['TOTAL'];
|
|
}
|
|
$datRkpr[$no++] += ['USED' => number_format($nilaiTerpakai,2)];
|
|
}
|
|
}
|
|
|
|
$datSupplier = $this->Amod->getData_Supplier_bySTATUS(1);
|
|
|
|
$datStpos = $this->Amod->getData_SetTogglePosisi_byKARYAWAN_byMENU($id_karyawan, $id_menu);
|
|
if ($datStpos==FALSE) { $posisiToggle = 0; } else { $posisiToggle = $datStpos[0]['AKTIF_STPOS']; }
|
|
|
|
$data = array(
|
|
'sidebar' => "menu salesproduk",
|
|
'navChild' => "salesproduk creditnote",
|
|
'id_ssp' => $id_ssp,
|
|
'id_merk' => $id_merk,
|
|
'id_produk' => $id_produk,
|
|
'ssp' => $datSsp,
|
|
'tgl' => $now,
|
|
'supplier' => $datSupplier,
|
|
'pkl' => $datPkl,
|
|
'rkpr' => $datRkpr,
|
|
'cnRekap' => $cnRekap,
|
|
'cnProses' => $cnProses,
|
|
'cnSelesai' => $cnSelesai,
|
|
'countRekap' => $countRekap,
|
|
'countProses' => $countProses,
|
|
'countSelesai' => $countSelesai,
|
|
'posisiToggle' => $posisiToggle,
|
|
'id_menu' => $id_menu,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil,
|
|
'produkTampil' => $produkTampil,
|
|
);
|
|
$this->load->view('proses/SP_Sub1_CreditNote_1', $data);
|
|
}
|
|
|
|
public function SP_Ambil_Sub1_DataRekapKlaimProgram() {
|
|
$id_rkpr = $this->input->post('id_rkpr');
|
|
|
|
$datRkpr = $this->Amod->getData_RekapKlaimProgram_byID($id_rkpr, 0);
|
|
|
|
$nama_pkpr = $datRkpr[0]['NAMA_PKPR'];
|
|
$nilai_rkpr = $datRkpr[0]['NILAI'];
|
|
|
|
$this->output_json([
|
|
'nama_pkpr' => $nama_pkpr,
|
|
'nama_promo' => "[$nilai_rkpr] $nama_pkpr",
|
|
]);
|
|
}
|
|
|
|
public function SP_Ambil_Sub1_DataCreditNote() {
|
|
$id_cn = $this->input->post('id_cn');
|
|
$now = date('Y-m-d');
|
|
$limit = $this->Amod->generate_subMonth($now, 12);
|
|
|
|
$datCn = $this->Amod->getData_CreditNote_byID($id_cn);
|
|
if ($datCn[0]['JENIS_CN']==1) {
|
|
$data = $this->Amod->getData_SalesOrder_byNAMAPEL_byPERIODE($datCn[0]['NAMA_SUPPLIER'], $limit, $now, 1);
|
|
} else if ($datCn[0]['JENIS_CN']==2) {
|
|
$data = $this->Amod->getData_Pembelian_bySUPPLIER_byPERIODE_bySTATUS_potonganNotNull($datCn[0]['SUPPLIER_ID'], $limit, $now, 1);
|
|
}
|
|
|
|
$this->output_json([
|
|
'data' => $data,
|
|
]);
|
|
}
|
|
|
|
public function SP_Batal_Sub1_D1_DataRekapKlaimProgram() {
|
|
$id_rkpr = $this->input->post('id_rkprvoid');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$datRkpr = $this->Amod->getData_RekapKlaimProgram_byID_bySTATUS($id_rkpr, 0);
|
|
if ($datRkpr==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$datLkpr = $this->Amod->getData_LinkKlaimProgram_byRKPR($id_rkpr);
|
|
foreach ($datLkpr as $key) {
|
|
$update = [
|
|
'RKPR_ID' => NULL
|
|
];
|
|
$action = $this->Amod->update('link_klaimprogram', $update, 'ID_LKPR', $key['ID_LKPR']);
|
|
}
|
|
|
|
$update = [
|
|
'STATUS_RKPR' => '9',
|
|
'BATAL_RKPR' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('rekap_klaimprogram', $update, 'ID_RKPR', $id_rkpr);
|
|
|
|
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 SP_Perbaruhi_Sub1_D1_DataRekapKlaimProgram() {
|
|
$id_rkpr = $this->input->post('id_rkprper');
|
|
$id_pkl = $this->input->post('id_pklper');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$datRkpr = $this->Amod->getData_RekapKlaimProgram_byID_bySTATUS($id_rkpr, 0);
|
|
$datPkl = $this->Amod->getData_PeriodeKlaimProgram_byID_bySTATUS($id_pkl, 1);
|
|
if ($datRkpr==FALSE OR $datPkl==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$update = [
|
|
'PKL_ID' => $id_pkl
|
|
];
|
|
$action = $this->Amod->update('rekap_klaimprogram', $update, 'ID_RKPR', $id_rkpr);
|
|
|
|
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 SP_Tambah_Sub1_D1_DataCreditNote() {
|
|
$id_merk = $this->input->post('id_merknew');
|
|
$id_produk = $this->input->post('id_produknew');
|
|
$tgl_cn = $this->input->post('tgl_cnnew');
|
|
$id_supplier = $this->input->post('id_suppliernew');
|
|
$jenis_cn = $this->input->post('jenis_cnnew');
|
|
$id_rkpr = $this->input->post('id_rkprnew');
|
|
$nama_cn = $this->input->post('nama_cnnew');
|
|
$nilai_cn = $this->input->post('nilai_cnnew');
|
|
$nama_cn = strtoupper($nama_cn);
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
$now = date('Y-m-d');
|
|
|
|
//Check apakah nilai Fee Numeric
|
|
$check_nilai = is_numeric($nilai_cn);
|
|
if ($check_nilai==FALSE) {
|
|
$nilai_cn = 0;
|
|
}
|
|
|
|
if ($nilai_cn<0) {
|
|
$this->session->set_flashdata('less_zero', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
if ($id_rkpr=="") {
|
|
$id_rkpr = NULL;
|
|
} else {
|
|
$datRkpr = $this->Amod->getData_RekapKlaimProgram_byID_bySTATUS($id_rkpr, 0);
|
|
if ($datRkpr==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
}
|
|
|
|
$cekCn = $this->Amod->getData_CreditNote_cekCn($jenis_cn, $id_merk, $id_produk, $id_rkpr, $id_supplier, $tgl_cn, $nama_cn, $nilai_cn);
|
|
if ($cekCn==TRUE) {
|
|
$this->session->set_flashdata('duplicate_data', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
if ($id_rkpr!=NULL) {
|
|
$sumCn = $this->Amod->getSum_CreditNote_byRKPR($id_rkpr);
|
|
if ($sumCn==FALSE OR $sumCn[0]['TOTAL']==NULL) {
|
|
$nilaiSisa = $datRkpr[0]['NILAI_RKPR'];
|
|
} else {
|
|
$nilaiSisa = $datRkpr[0]['NILAI_RKPR']-$sumCn[0]['TOTAL'];
|
|
}
|
|
}
|
|
|
|
if ($nilai_cn==0) {
|
|
$nilai_cn = $nilaiSisa;
|
|
}
|
|
|
|
$kode_cn = $this->Amod->generate_kodeCreditNote();
|
|
$input = [
|
|
'CIPTA_CN' => "Oleh $panggilan pada $timestamp",
|
|
'TGL_CN' => $tgl_cn,
|
|
'KODE_CN' => $kode_cn,
|
|
'JENIS_CN' => $jenis_cn,
|
|
'MERK_ID' => $id_merk,
|
|
'PRODUK_ID' => $id_produk,
|
|
'RKPR_ID' => $id_rkpr,
|
|
'SUPPLIER_ID' => $id_supplier,
|
|
'NAMA_CN' => $nama_cn,
|
|
'NILAI_CN' => $nilai_cn,
|
|
'STATUS_CN' => '0'
|
|
];
|
|
$action = $this->Amod->create('creditnote', $input);
|
|
|
|
if ($id_rkpr!=NULL) {
|
|
if ($jenis_cn==9) {
|
|
$update = [
|
|
'STATUS_RKPR' => '1',
|
|
'SELESAI_RKPR' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('rekap_klaimprogram', $update, 'ID_RKPR', $id_rkpr);
|
|
|
|
$id_cn = $this->Amod->getMax_ID_CreditNote();
|
|
$id_cn = $id_cn[0]['ID_CN'];
|
|
|
|
$update = [
|
|
'STATUS_CN' => '1',
|
|
'LOCK_CN' => $now,
|
|
'SELESAI_CN' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('creditnote', $update, 'ID_CN', $id_cn);
|
|
} else {
|
|
$sumCn = $this->Amod->getSum_CreditNote_byRKPR($id_rkpr);
|
|
if ($sumCn[0]['TOTAL']>=$datRkpr[0]['NILAI_RKPR']) {
|
|
$update = [
|
|
'STATUS_RKPR' => '1',
|
|
'SELESAI_RKPR' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('rekap_klaimprogram', $update, 'ID_RKPR', $id_rkpr);
|
|
}
|
|
}
|
|
}
|
|
|
|
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 SP_Ubah_Sub1_D1_DataCreditNote() {
|
|
$id_cn = $this->input->post('id_cned');
|
|
$jenis_cn = $this->input->post('jenis_cned');
|
|
$id_supplier = $this->input->post('id_suppliered');
|
|
$tgl_cn = $this->input->post('tgl_cned');
|
|
$nilai_cn = $this->input->post('nilai_cned');
|
|
$nama_cn = $this->input->post('nama_cned');
|
|
$nama_cn = strtoupper($nama_cn);
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
$now = date('Y-m-d');
|
|
|
|
$datCn = $this->Amod->getData_CreditNote_byID_bySTATUS($id_cn, 0);
|
|
if ($datCn==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$cekCn = $this->Amod->getData_CreditNote_cekCn($jenis_cn, $datCn[0]['MERK_ID'], $datCn[0]['PRODUK_ID'], $datCn[0]['RKPR_ID'], $id_supplier, $tgl_cn, $nama_cn, $nilai_cn, $id_cn);
|
|
if ($cekCn==TRUE) {
|
|
$this->session->set_flashdata('duplicate_data', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
//Check apakah nilai Fee Numeric
|
|
$check_nilai = is_numeric($nilai_cn);
|
|
if ($check_nilai==FALSE) {
|
|
$nilai_cn = 0;
|
|
}
|
|
|
|
$id_rkpr = $datCn[0]['RKPR_ID'];
|
|
if ($id_rkpr!=NULL) {
|
|
$datRkpr = $this->Amod->getData_RekapKlaimProgram_byID($id_rkpr);
|
|
}
|
|
|
|
if ($jenis_cn!=$datCn[0]['JENIS_CN'] AND $jenis_cn==9) {
|
|
$update = [
|
|
'TGL_CN' => $tgl_cn,
|
|
'JENIS_CN' => $jenis_cn,
|
|
'SUPPLIER_ID' => $id_supplier,
|
|
'NAMA_CN' => $nama_cn,
|
|
'NILAI_CN' => $nilai_cn,
|
|
'STATUS_CN' => '1',
|
|
'LOCK_CN' => $now,
|
|
'SELESAI_CN' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('creditnote', $update, 'ID_CN', $id_cn);
|
|
} else {
|
|
$update = [
|
|
'TGL_CN' => $tgl_cn,
|
|
'JENIS_CN' => $jenis_cn,
|
|
'SUPPLIER_ID' => $id_supplier,
|
|
'NAMA_CN' => $nama_cn,
|
|
'NILAI_CN' => $nilai_cn,
|
|
];
|
|
$action = $this->Amod->update('creditnote', $update, 'ID_CN', $id_cn);
|
|
}
|
|
|
|
if ($id_rkpr!=NULL) {
|
|
if ($jenis_cn==9) {
|
|
$update = [
|
|
'STATUS_RKPR' => '1',
|
|
'SELESAI_RKPR' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('rekap_klaimprogram', $update, 'ID_RKPR', $id_rkpr);
|
|
} else {
|
|
$sumCn = $this->Amod->getSum_CreditNote_byRKPR($id_rkpr);
|
|
if ($sumCn[0]['TOTAL']>=$datRkpr[0]['NILAI_RKPR']) {
|
|
$update = [
|
|
'STATUS_RKPR' => '1',
|
|
'SELESAI_RKPR' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
} else {
|
|
$update = [
|
|
'STATUS_RKPR' => '0',
|
|
'SELESAI_RKPR' => NULL
|
|
];
|
|
}
|
|
$action = $this->Amod->update('rekap_klaimprogram', $update, 'ID_RKPR', $id_rkpr);
|
|
}
|
|
}
|
|
|
|
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 SP_Link_Sub1_D1_DataCreditNote() {
|
|
$id_cn = $this->input->post('id_cnln');
|
|
$id_so = $this->input->post('id_soln');
|
|
|
|
$datCn = $this->Amod->getData_CreditNote_byID_bySTATUS($id_cn, 0);
|
|
if ($datCn==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
if ($id_so=="") { $id_so = NULL; }
|
|
|
|
if ($id_so==NULL) {
|
|
$this->session->set_flashdata('datainput_null', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$update = [
|
|
'SO_ID' => $id_so,
|
|
];
|
|
$action = $this->Amod->update('creditnote', $update, 'ID_CN', $id_cn);
|
|
|
|
if ($action) {
|
|
$this->session->set_flashdata('success', 'dilink');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
} else {
|
|
$this->session->set_flashdata('failed', 'dilink');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
}
|
|
|
|
public function SP_Unlink_Sub1_D1_DataCreditNote() {
|
|
$id_cn = $this->input->post('id_cnun');
|
|
|
|
$datCn = $this->Amod->getData_CreditNote_byID_bySTATUS($id_cn, 0);
|
|
if ($datCn==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$update = [
|
|
'SO_ID' => NULL,
|
|
'PEMBELIAN_ID' => NULL,
|
|
];
|
|
$action = $this->Amod->update('creditnote', $update, 'ID_CN', $id_cn);
|
|
|
|
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 SP_Batal_Sub1_D1_DataCreditNote() {
|
|
$id_cn = $this->input->post('id_cnvoid');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
$now = date('Y-m-d');
|
|
|
|
$datCn = $this->Amod->getData_CreditNote_byID_bySTATUS($id_cn, 0);
|
|
if ($datCn==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
if ($datCn[0]['RKPR_ID']!=NULL) {
|
|
$datRkpr = $this->Amod->getData_RekapKlaimProgram_byID_bySTATUS($datCn[0]['RKPR_ID'], 1);
|
|
if ($datRkpr==TRUE) {
|
|
$update = [
|
|
'STATUS_RKPR' => '0',
|
|
'SELESAI_RKPR' => NULL,
|
|
];
|
|
$action = $this->Amod->update('rekap_klaimprogram', $update, 'ID_RKPR', $datCn[0]['RKPR_ID']);
|
|
}
|
|
}
|
|
|
|
$update = [
|
|
'STATUS_CN' => '2',
|
|
'RKPR_ID' => NULL,
|
|
'SO_ID' => NULL,
|
|
'PEMBELIAN_ID' => NULL,
|
|
'BATAL_CN' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('creditnote', $update, 'ID_CN', $id_cn);
|
|
|
|
if ($action) {
|
|
$this->session->set_flashdata('success', 'dibatalkan');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
} else {
|
|
$this->session->set_flashdata('failed', 'dibatalkan');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
}
|
|
|
|
//SUBMENU TRANSAKSI - ADMINISTRASI
|
|
public function SP_Sub1_Administrasi_1() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$now = date('Y-m-d');
|
|
$limit = date('Y-m-01');
|
|
$limit = $this->Amod->generate_subMonth($limit, 3);
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "SP", "TRANSAKSI - Administrasi");
|
|
$id_menu = $datShm[0]['MENU_ID'];
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$cnSo = $this->Amod->getData_CreditNote_byJENIS_status0(1);
|
|
$no = 0;
|
|
foreach ($cnSo as $key) {
|
|
if ($key['SO_ID']==NULL) {
|
|
$link = 1;
|
|
$kobuk = "";
|
|
$nibuk = "";
|
|
} else {
|
|
$datSo = $this->Amod->getData_SalesOrder_byID($key['SO_ID']);
|
|
$kobuk = $datSo[0]['KODE_SO'];
|
|
if ($datSo[0]['NILAI_SO']==NULL) {
|
|
$nibuk = 0;
|
|
} else {
|
|
$nibuk = number_format($datSo[0]['NILAI_SO'],2);
|
|
}
|
|
$link = 0;
|
|
}
|
|
$cnSo[$no] += ['KOBUK' => $kobuk];
|
|
$cnSo[$no] += ['NIBUK' => $nibuk];
|
|
$cnSo[$no++] += ['LINK' => $link];
|
|
}
|
|
|
|
$cnPembelian = $this->Amod->getData_CreditNote_byJENIS_status0(2);
|
|
$cnVoucher = $this->Amod->getData_CreditNote_byJENIS_status0(3);
|
|
|
|
$cnSelesai = $this->Amod->getData_CreditNote_bySTATUS_byLIMIT(1, $limit);
|
|
$no = 0;
|
|
foreach ($cnSelesai as $key) {
|
|
if ($key['JENIS_CN']==1) {
|
|
$datSo = $this->Amod->getData_SalesOrder_byID($key['SO_ID']);
|
|
$kobuk = $datSo[0]['KODE_SO'];
|
|
if ($datSo[0]['NILAI_SO']==NULL) {
|
|
$nibuk = 0;
|
|
} else {
|
|
$nibuk = number_format($datSo[0]['NILAI_SO'],2);
|
|
}
|
|
} else if ($key['JENIS_CN']==2) {
|
|
$datPembelian = $this->Amod->getData_Pembelian_byID($key['PEMBELIAN_ID']);
|
|
$kobuk = $datPembelian[0]['KODE_PEMBELIAN'];
|
|
$nibuk = number_format($datPembelian[0]['POTONGAN_PEMBELIAN'],2);
|
|
} else if ($key['JENIS_CN']==3) {
|
|
$kobuk = "";
|
|
$nibuk = "";
|
|
} else if ($key['JENIS_CN']==9) {
|
|
$kobuk = "";
|
|
$nibuk = "";
|
|
}
|
|
$cnSelesai[$no] += ['KOBUK' => $kobuk];
|
|
$cnSelesai[$no++] += ['NIBUK' => $nibuk];
|
|
}
|
|
|
|
$datStpos = $this->Amod->getData_SetTogglePosisi_byKARYAWAN_byMENU($id_karyawan, $id_menu);
|
|
if ($datStpos==FALSE) { $posisiToggle = 0; } else { $posisiToggle = $datStpos[0]['AKTIF_STPOS']; }
|
|
|
|
$data = array(
|
|
'sidebar' => "menu salesproduk",
|
|
'navChild' => "salesproduk administrasi",
|
|
'tgl' => $now,
|
|
'cnSo' => $cnSo,
|
|
'cnPembelian' => $cnPembelian,
|
|
'cnVoucher' => $cnVoucher,
|
|
'cnSelesai' => $cnSelesai,
|
|
'countSo' => count($cnSo),
|
|
'countPembelian' => count($cnPembelian),
|
|
'countVoucher' => count($cnVoucher),
|
|
'countSelesai' => count($cnSelesai),
|
|
'posisiToggle' => $posisiToggle,
|
|
'id_menu' => $id_menu,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil,
|
|
);
|
|
$this->load->view('proses/SP_Sub1_Administrasi_1', $data);
|
|
}
|
|
|
|
public function SP_KunciBulk_Sub1_E1_DataCreditNote() {
|
|
$id_cn = $this->input->post('id_cnbulk');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
$now = date('Y-m-d');
|
|
|
|
foreach ($id_cn as $key) {
|
|
$datCn = $this->Amod->getData_CreditNote_byID_bySTATUS($key, 0);
|
|
if ($datCn==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
}
|
|
|
|
foreach ($id_cn as $key) {
|
|
$update = [
|
|
'LOCK_CN' => $now,
|
|
'SELESAI_CN' => "Oleh $panggilan pada $timestamp",
|
|
'STATUS_CN' => '1',
|
|
];
|
|
$action = $this->Amod->update('creditnote', $update, 'ID_CN', $key);
|
|
}
|
|
|
|
if ($action) {
|
|
$this->session->set_flashdata('success', 'dikunci');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
} else {
|
|
$this->session->set_flashdata('failed', 'dikunci');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
}
|
|
|
|
public function SP_Kunci_Sub1_E1_DataCreditNote() {
|
|
$jenis_cn = $this->input->post('jenis_cn');
|
|
$id_cn = $this->input->post('id_cn');
|
|
$id_pembelian = $this->input->post('id_pembelian');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
$now = date('Y-m-d');
|
|
|
|
$datCn = $this->Amod->getData_CreditNote_byID_bySTATUS($id_cn, 0);
|
|
if ($datCn==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
if ($jenis_cn==2) {
|
|
$datPembelian = $this->Amod->getData_Pembelian_byID_bySTATUS($id_pembelian, 1);
|
|
if ($datPembelian==FALSE OR $datPembelian[0]['POTONGAN_PEMBELIAN']==NULL) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
}
|
|
|
|
if ($jenis_cn==2) {
|
|
$update = [
|
|
'PEMBELIAN_ID' => $id_pembelian,
|
|
'LOCK_CN' => $now,
|
|
'SELESAI_CN' => "Oleh $panggilan pada $timestamp",
|
|
'STATUS_CN' => '1',
|
|
];
|
|
$action = $this->Amod->update('creditnote', $update, 'ID_CN', $id_cn);
|
|
} else {
|
|
$update = [
|
|
'LOCK_CN' => $now,
|
|
'SELESAI_CN' => "Oleh $panggilan pada $timestamp",
|
|
'STATUS_CN' => '1',
|
|
];
|
|
$action = $this->Amod->update('creditnote', $update, 'ID_CN', $id_cn);
|
|
}
|
|
|
|
if ($action) {
|
|
$this->session->set_flashdata('success', 'dikunci');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
} else {
|
|
$this->session->set_flashdata('failed', 'dikunci');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
}
|
|
|
|
public function SP_Revisi_Sub1_E1_DataCreditNote() {
|
|
$id_cn = $this->input->post('id_cnrev');
|
|
|
|
$datCn = $this->Amod->getData_CreditNote_byID_bySTATUS($id_cn, 1);
|
|
if ($datCn==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$update = [
|
|
'LOCK_CN' => NULL,
|
|
'SELESAI_CN' => NULL,
|
|
'STATUS_CN' => '0',
|
|
];
|
|
$action = $this->Amod->update('creditnote', $update, 'ID_CN', $id_cn);
|
|
|
|
if ($action) {
|
|
$this->session->set_flashdata('success', 'direvisi');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
} else {
|
|
$this->session->set_flashdata('failed', 'direvisi');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
}
|
|
|
|
//SUBMENU TRANSAKSI - PRICELIST
|
|
public function SP_Sub1_Pricelist_1() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
$now = date('Y-m-d');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "SP", "TRANSAKSI - Pricelist");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
if ($hak>=3) {
|
|
$datSsp = $this->Amod->getData_SetSalesProduk();
|
|
} else {
|
|
$datSsp = $this->Amod->getData_SetSalesProduk_bySALES($id_karyawan);
|
|
}
|
|
|
|
$datStsp = $this->Amod->getData_SetToggleSp_byKARYAWAN($id_karyawan);
|
|
if ($datStsp==FALSE) {
|
|
$id_ssp = 0;
|
|
$datPricelist = NULL;
|
|
$produkTampil = "Tidak Berhak";
|
|
} else {
|
|
$id_ssp = $datStsp[0]['SSP_ID'];
|
|
$nama_merk = $datStsp[0]['NAMA_MERK'];
|
|
$nama_produk = $datStsp[0]['NAMA_PRODUK'];
|
|
$produkTampil = "$nama_merk $nama_produk";
|
|
$datPricelist = $this->Amod->getData_Pricelist_bySSP($id_ssp);
|
|
$no = 0;
|
|
foreach ($datPricelist as $key) {
|
|
$listKolom = explode(',', $key['KOLOM_PRICELIST']);
|
|
$kolom = "";
|
|
foreach ($listKolom as $dat) {
|
|
if ($dat==1) {
|
|
$kolom .= "Datasheet | ";
|
|
} else if ($dat==2) {
|
|
$kolom .= "Model | ";
|
|
} else if ($dat==3) {
|
|
$kolom .= "MTM | ";
|
|
} else if ($dat==4) {
|
|
$kolom .= "PN | ";
|
|
} else if ($dat==5) {
|
|
$kolom .= "Deskripsi | ";
|
|
} else if ($dat==6) {
|
|
$kolom .= "Kuantiti | ";
|
|
} else if ($dat==7) {
|
|
$kolom .= "Dealer Price | ";
|
|
} else if ($dat==8) {
|
|
$kolom .= "SR Price | ";
|
|
} else if ($dat==9) {
|
|
$kolom .= "MSR Price | ";
|
|
} else if ($dat==10) {
|
|
$kolom .= "Ekatalog | ";
|
|
} else if ($dat==11) {
|
|
$kolom .= "MD Price | ";
|
|
}
|
|
}
|
|
|
|
$kolom = substr($kolom, 0, -3);
|
|
$datSmpl = $this->Amod->getData_SubmenuPricelist_byPRICELIST_orderURUTAN($key['ID_PRICELIST']);
|
|
|
|
$datPricelist[$no] += ['SUBMENU' => $datSmpl];
|
|
$datPricelist[$no++] += ['KOLOM' => $kolom];
|
|
}
|
|
}
|
|
|
|
$data = array(
|
|
'sidebar' => "menu salesproduk",
|
|
'navChild' => "salesproduk pricelist",
|
|
'id_ssp' => $id_ssp,
|
|
'ssp' => $datSsp,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil,
|
|
'produkTampil' => $produkTampil,
|
|
'pricelist' => $datPricelist,
|
|
);
|
|
$this->load->view('proses/SP_Sub1_Pricelist_1', $data);
|
|
}
|
|
|
|
public function SP_Tambah_Sub1_F1_DataPricelist() {
|
|
$id_ssp = $this->input->post('id_sspnew');
|
|
$nama_pricelist = $this->input->post('nama_pricelistnew');
|
|
$kolom_pricelist = $this->input->post('kolom_pricelistnew');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$cekPricelist = $this->Amod->getData_Pricelist_byNAMA($nama_pricelist);
|
|
if ($cekPricelist==TRUE) {
|
|
$this->session->set_flashdata('name_same', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$kolom = "";
|
|
$total = 1;
|
|
foreach ($kolom_pricelist as $key) {
|
|
if (count($kolom_pricelist)==$total) {
|
|
$kolom .= "$key";
|
|
} else {
|
|
$kolom .= "$key,";
|
|
$total++;
|
|
}
|
|
}
|
|
|
|
$input = [
|
|
'NAMA_PRICELIST' => $nama_pricelist,
|
|
'SSP_ID' => $id_ssp,
|
|
'KOLOM_PRICELIST' => $kolom,
|
|
'JEJAK_PRICELIST' => "Oleh $panggilan pada $timestamp",
|
|
'TERBARU_PRICELIST' => '1'
|
|
];
|
|
$action = $this->Amod->create('pricelist', $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 SP_Ubah_Sub1_F1_DataPricelist() {
|
|
$id_pricelist = $this->input->post('id_pricelisted');
|
|
$nama_pricelist = $this->input->post('nama_pricelisted');
|
|
$kolom_pricelist = $this->input->post('kolom_pricelisted');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$cekPricelist = $this->Amod->getData_Pricelist_byNAMA($nama_pricelist, $id_pricelist);
|
|
if ($cekPricelist==TRUE) {
|
|
$this->session->set_flashdata('name_same', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$kolom = "";
|
|
$total = 1;
|
|
foreach ($kolom_pricelist as $key) {
|
|
if (count($kolom_pricelist)==$total) {
|
|
$kolom .= "$key";
|
|
} else {
|
|
$kolom .= "$key,";
|
|
$total++;
|
|
}
|
|
}
|
|
|
|
$update = [
|
|
'NAMA_PRICELIST' => $nama_pricelist,
|
|
'KOLOM_PRICELIST' => $kolom,
|
|
'JEJAK_PRICELIST' => "Oleh $panggilan pada $timestamp",
|
|
'TERBARU_PRICELIST' => '1'
|
|
];
|
|
$action = $this->Amod->update('pricelist', $update, 'ID_PRICELIST', $id_pricelist);
|
|
|
|
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 SP_Hapus_Sub1_F1_DataPricelist() {
|
|
$id_pricelist = $this->input->post('id_pricelistdel');
|
|
|
|
$datPricelist = $this->Amod->getData_Pricelist_byID($id_pricelist);
|
|
if ($datPricelist==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$datSmpl = $this->Amod->getData_SubmenuPricelist_byPRICELIST($id_pricelist);
|
|
if ($datSmpl==TRUE) {
|
|
$this->session->set_flashdata('data_used', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$action = $this->Amod->delete('pricelist', $id_pricelist, 'ID_PRICELIST');
|
|
|
|
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 SP_Tambah_Sub1_F1_DataSubmenuPricelist() {
|
|
$id_pricelist = $this->input->post('id_pricelist');
|
|
$nama_smpl = $this->input->post('nama_smpl');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$value = 0;
|
|
$datPricelist = $this->Amod->getData_Pricelist_byID($id_pricelist);
|
|
if ($datPricelist==FALSE) {
|
|
$value = 2;
|
|
} else {
|
|
$maxUrutan = $this->Amod->getMax_Urutan_SubmenuPricelist($id_pricelist);
|
|
if ($maxUrutan[0]['URUTAN_SMPL']==NULL) {
|
|
$urutan_smpl = 1;
|
|
} else {
|
|
$urutan_smpl = $maxUrutan[0]['URUTAN_SMPL']+1;
|
|
}
|
|
|
|
$input = [
|
|
'PRICELIST_ID' => $id_pricelist,
|
|
'NAMA_SMPL' => $nama_smpl,
|
|
'URUTAN_SMPL' => $urutan_smpl,
|
|
'TIMESTAMP_SMPL' => "Oleh $panggilan pada $timestamp",
|
|
];
|
|
$action = $this->Amod->create('submenu_pricelist', $input);
|
|
|
|
$update = [
|
|
'SUBMENU_PRICELIST' => "Oleh $panggilan pada $timestamp",
|
|
'TERBARU_PRICELIST' => '2'
|
|
];
|
|
$action = $this->Amod->update('pricelist', $update, 'ID_PRICELIST', $id_pricelist);
|
|
|
|
$value = 1;
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value
|
|
]);
|
|
}
|
|
|
|
public function SP_Ubah_Sub1_F1_DataSubmenuPricelist() {
|
|
$id_pricelist = $this->input->post('id_pricelist');
|
|
$id_smpl = $this->input->post('id_smpl');
|
|
$nama_smpl = $this->input->post('nama_smpl');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$value = 0;
|
|
$datPricelist = $this->Amod->getData_Pricelist_byID($id_pricelist);
|
|
if ($datPricelist==FALSE) {
|
|
$value = 3;
|
|
} else {
|
|
$datSmpl = $this->Amod->getData_SubmenuPricelist_byID($id_smpl);
|
|
if ($datSmpl==FALSE) {
|
|
$value = 2;
|
|
} else {
|
|
$update = [
|
|
'TIMESTAMP_SMPL' => "Oleh $panggilan pada $timestamp",
|
|
'NAMA_SMPL' => $nama_smpl
|
|
];
|
|
$action = $this->Amod->update('submenu_pricelist', $update, 'ID_SMPL', $id_smpl);
|
|
|
|
$update = [
|
|
'SUBMENU_PRICELIST' => "Oleh $panggilan pada $timestamp",
|
|
'TERBARU_PRICELIST' => '2'
|
|
];
|
|
$action = $this->Amod->update('pricelist', $update, 'ID_PRICELIST', $id_pricelist);
|
|
|
|
$value = 1;
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value
|
|
]);
|
|
}
|
|
|
|
public function SP_Hapus_Sub1_F1_DataSubmenuPricelist() {
|
|
$id_pricelist = $this->input->post('id_pricelist');
|
|
$id_smpl = $this->input->post('id_smpl');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$value = 0;
|
|
$datPricelist = $this->Amod->getData_Pricelist_byID($id_pricelist);
|
|
if ($datPricelist==FALSE) {
|
|
$value = 4;
|
|
} else {
|
|
$datSmpl = $this->Amod->getData_SubmenuPricelist_byID($id_smpl);
|
|
if ($datSmpl==FALSE) {
|
|
$value = 3;
|
|
} else {
|
|
$datDfpl = $this->Amod->getData_DaftarPricelist_bySMPL($id_smpl);
|
|
if ($datDfpl==TRUE) {
|
|
$value = 2;
|
|
} else {
|
|
$action = $this->Amod->delete('submenu_pricelist', $id_smpl, 'ID_SMPL');
|
|
|
|
$update = [
|
|
'SUBMENU_PRICELIST' => "Oleh $panggilan pada $timestamp",
|
|
'TERBARU_PRICELIST' => '2'
|
|
];
|
|
$action = $this->Amod->update('pricelist', $update, 'ID_PRICELIST', $id_pricelist);
|
|
|
|
$value = 1;
|
|
}
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value
|
|
]);
|
|
}
|
|
|
|
public function SP_Sub1_Pricelist_2($id) {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "SP", "TRANSAKSI - Pricelist");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$datPricelist = $this->Amod->getData_Pricelist_byID($id);
|
|
$datSmpl = $this->Amod->getData_SubmenuPricelist_byPRICELIST_orderURUTAN($id);
|
|
$datSsp = $this->Amod->getData_SetSalesProduk_byID($datPricelist[0]['SSP_ID']);
|
|
$datBarang = $this->Amod->getData_Barang_byMERK_byPRODUK_jenisSKU_spNull_orderDESC_linkHhkpr($datSsp[0]['MERK_ID'], $datSsp[0]['PRODUK_ID']);
|
|
|
|
$datStti = $this->Amod->getData_SetTimitp_byKARYAWAN($id_karyawan);
|
|
if ($datStti==TRUE) {
|
|
$spesial = 1;
|
|
} else {
|
|
$spesial = 0;
|
|
}
|
|
|
|
$listKolom = explode(',', $datPricelist[0]['KOLOM_PRICELIST']);
|
|
$aktif = [];
|
|
for ($i=1; $i<=11; $i++) {
|
|
$j = 0;
|
|
foreach ($listKolom as $key) {
|
|
if ($key==$i) {
|
|
$j++;
|
|
break;
|
|
}
|
|
}
|
|
$aktif[$i] = $j;
|
|
}
|
|
|
|
$data = array(
|
|
'sidebar' => "menu salesproduk",
|
|
'navChild' => "salesproduk pricelist",
|
|
'barang' => $datBarang,
|
|
'smpl' => $datSmpl,
|
|
'countSmpl' => count($datSmpl),
|
|
'id_pricelist' => $id,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil,
|
|
'aktif' => $aktif,
|
|
'spesial' => $spesial,
|
|
'nama_pricelist' => $datPricelist[0]['NAMA_PRICELIST'],
|
|
);
|
|
$this->load->view('proses/SP_Sub1_Pricelist_2', $data);
|
|
}
|
|
|
|
public function SP_Tambah_Sub1_F2_DataDaftarPricelist() {
|
|
$id_pricelist = $this->input->post('id_pricelist');
|
|
$id_smpl = $this->input->post('id_smpl');
|
|
$datasheet_dfpl = $this->input->post('datasheet_dfpl');
|
|
$model_dfpl = $this->input->post('model_dfpl');
|
|
$mtm_dfpl = $this->input->post('mtm_dfpl');
|
|
$pn_dfpl = $this->input->post('pn_dfpl');
|
|
$deskripsi_dfpl = $this->input->post('deskripsi_dfpl');
|
|
$id_barang = $this->input->post('id_barang');
|
|
$mdp_dfpl = $this->input->post('mdp_dfpl');
|
|
$dealer_dfpl = $this->input->post('dealer_dfpl');
|
|
$srp_dfpl = $this->input->post('srp_dfpl');
|
|
$msrp_dfpl = $this->input->post('msrp_dfpl');
|
|
$ekatalog_dfpl = $this->input->post('ekatalog_dfpl');
|
|
$deskripsi_dfpl = ltrim(rtrim(preg_replace('/\x{2013}/u', "-" , $deskripsi_dfpl)));
|
|
$deskripsi_dfpl = preg_replace("/—/", "-" , $deskripsi_dfpl);
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$value = 0;
|
|
$datPricelist = $this->Amod->getData_Pricelist_byID($id_pricelist);
|
|
if ($datPricelist==FALSE) {
|
|
$value = 3;
|
|
} else {
|
|
$datSmpl = $this->Amod->getData_SubmenuPricelist_byID($id_smpl);
|
|
if ($datSmpl==FALSE) {
|
|
$value = 2;
|
|
} else {
|
|
$maxUrutan = $this->Amod->getMax_Urutan_DaftarPricelist($id_smpl);
|
|
if ($maxUrutan[0]['URUTAN_DFPL']==NULL) {
|
|
$urutan_dfpl = 1;
|
|
} else {
|
|
$urutan_dfpl = $maxUrutan[0]['URUTAN_DFPL']+1;
|
|
}
|
|
$input = [
|
|
'SMPL_ID' => $id_smpl,
|
|
'DATASHEET_DFPL' => $datasheet_dfpl,
|
|
'MODEL_DFPL' => $model_dfpl,
|
|
'MTM_DFPL' => $mtm_dfpl,
|
|
'PN_DFPL' => $pn_dfpl,
|
|
'DESKRIPSI_DFPL' => $deskripsi_dfpl,
|
|
'BARANG_ID' => $id_barang,
|
|
'MDP_DFPL' => $mdp_dfpl,
|
|
'DEALER_DFPL' => $dealer_dfpl,
|
|
'SRP_DFPL' => $srp_dfpl,
|
|
'MSRP_DFPL' => $msrp_dfpl,
|
|
'EKATALOG_DFPL' => $ekatalog_dfpl,
|
|
'URUTAN_DFPL' => $urutan_dfpl,
|
|
'COLMODEL_DFPL' => "#000000,#fdfdfd",
|
|
'TIMESTAMP_DFPL' => "Oleh $panggilan pada $timestamp",
|
|
];
|
|
$action = $this->Amod->create('daftar_pricelist', $input);
|
|
|
|
$update = [
|
|
'SUBMENU_PRICELIST' => "Oleh $panggilan pada $timestamp",
|
|
'TERBARU_PRICELIST' => '2'
|
|
];
|
|
$action = $this->Amod->update('pricelist', $update, 'ID_PRICELIST', $id_pricelist);
|
|
|
|
$value = 1;
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value
|
|
]);
|
|
}
|
|
|
|
public function SP_Ubah_Sub1_F2_DataDaftarPricelist() {
|
|
$id_pricelist = $this->input->post('id_pricelist');
|
|
$id_smpl = $this->input->post('id_smpl');
|
|
$id_dfpl = $this->input->post('id_dfpl');
|
|
$datasheet_dfpl = $this->input->post('datasheet_dfpl');
|
|
$model_dfpl = $this->input->post('model_dfpl');
|
|
$mtm_dfpl = $this->input->post('mtm_dfpl');
|
|
$pn_dfpl = $this->input->post('pn_dfpl');
|
|
$deskripsi_dfpl = $this->input->post('deskripsi_dfpl');
|
|
$id_barang = $this->input->post('id_barang');
|
|
$mdp_dfpl = $this->input->post('mdp_dfpl');
|
|
$dealer_dfpl = $this->input->post('dealer_dfpl');
|
|
$srp_dfpl = $this->input->post('srp_dfpl');
|
|
$msrp_dfpl = $this->input->post('msrp_dfpl');
|
|
$ekatalog_dfpl = $this->input->post('ekatalog_dfpl');
|
|
$deskripsi_dfpl = ltrim(rtrim(preg_replace('/\x{2013}/u', "-" , $deskripsi_dfpl)));
|
|
$deskripsi_dfpl = preg_replace("/—/", "-" , $deskripsi_dfpl);
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$value = 0;
|
|
$datPricelist = $this->Amod->getData_Pricelist_byID($id_pricelist);
|
|
if ($datPricelist==FALSE) {
|
|
$value = 4;
|
|
} else {
|
|
$datSmpl = $this->Amod->getData_SubmenuPricelist_byID($id_smpl);
|
|
if ($datSmpl==FALSE) {
|
|
$value = 3;
|
|
} else {
|
|
$datDfpl = $this->Amod->getData_DaftarPricelist_byID($id_dfpl);
|
|
if ($datDfpl==FALSE) {
|
|
$value = 2;
|
|
} else {
|
|
$update = [
|
|
'DATASHEET_DFPL' => $datasheet_dfpl,
|
|
'MODEL_DFPL' => $model_dfpl,
|
|
'MTM_DFPL' => $mtm_dfpl,
|
|
'PN_DFPL' => $pn_dfpl,
|
|
'DESKRIPSI_DFPL' => $deskripsi_dfpl,
|
|
'BARANG_ID' => $id_barang,
|
|
'MDP_DFPL' => $mdp_dfpl,
|
|
'DEALER_DFPL' => $dealer_dfpl,
|
|
'SRP_DFPL' => $srp_dfpl,
|
|
'MSRP_DFPL' => $msrp_dfpl,
|
|
'EKATALOG_DFPL' => $ekatalog_dfpl,
|
|
'TIMESTAMP_DFPL' => "Oleh $panggilan pada $timestamp",
|
|
];
|
|
$action = $this->Amod->update('daftar_pricelist', $update, 'ID_DFPL', $id_dfpl);
|
|
|
|
$update = [
|
|
'SUBMENU_PRICELIST' => "Oleh $panggilan pada $timestamp",
|
|
'TERBARU_PRICELIST' => '2'
|
|
];
|
|
$action = $this->Amod->update('pricelist', $update, 'ID_PRICELIST', $id_pricelist);
|
|
|
|
$value = 1;
|
|
}
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value
|
|
]);
|
|
}
|
|
|
|
public function SP_Ubah_Sub1_F2_WarnaDaftarPricelist() {
|
|
$id_pricelist = $this->input->post('id_pricelist');
|
|
$id_smpl = $this->input->post('id_smpl');
|
|
$id_dfpl = $this->input->post('id_dfpl');
|
|
$colmodel_dfplcoltext = $this->input->post('colmodel_dfplcoltext');
|
|
$colmodel_dfplcolbg = $this->input->post('colmodel_dfplcolbg');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$value = 0;
|
|
$datPricelist = $this->Amod->getData_Pricelist_byID($id_pricelist);
|
|
if ($datPricelist==FALSE) {
|
|
$value = 4;
|
|
} else {
|
|
$datSmpl = $this->Amod->getData_SubmenuPricelist_byID($id_smpl);
|
|
if ($datSmpl==FALSE) {
|
|
$value = 3;
|
|
} else {
|
|
$datDfpl = $this->Amod->getData_DaftarPricelist_byID($id_dfpl);
|
|
if ($datDfpl==FALSE) {
|
|
$value = 2;
|
|
} else {
|
|
$update = [
|
|
'COLMODEL_DFPL' => "$colmodel_dfplcoltext,$colmodel_dfplcolbg",
|
|
'TIMESTAMP_DFPL' => "Oleh $panggilan pada $timestamp",
|
|
];
|
|
$action = $this->Amod->update('daftar_pricelist', $update, 'ID_DFPL', $id_dfpl);
|
|
|
|
$update = [
|
|
'SUBMENU_PRICELIST' => "Oleh $panggilan pada $timestamp",
|
|
'TERBARU_PRICELIST' => '2'
|
|
];
|
|
$action = $this->Amod->update('pricelist', $update, 'ID_PRICELIST', $id_pricelist);
|
|
|
|
$value = 1;
|
|
}
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value
|
|
]);
|
|
}
|
|
|
|
public function SP_Ubah_Sub1_F2_HargaDaftarPricelist() {
|
|
$id_pricelist = $this->input->post('id_pricelist');
|
|
$id_smpl = $this->input->post('id_smpl');
|
|
$id_dfpl = $this->input->post('id_dfpl');
|
|
$off_compete_dfpl = $this->input->post('off_compete_dfpl');
|
|
$off_special_dfpl = $this->input->post('off_special_dfpl');
|
|
$on_compete_dfpl = $this->input->post('on_compete_dfpl');
|
|
$on_technosify_dfpl = $this->input->post('on_technosify_dfpl');
|
|
$on_itp_dfpl = $this->input->post('on_itp_dfpl');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$value = 0;
|
|
$datPricelist = $this->Amod->getData_Pricelist_byID($id_pricelist);
|
|
if ($datPricelist==FALSE) {
|
|
$value = 4;
|
|
} else {
|
|
$datSmpl = $this->Amod->getData_SubmenuPricelist_byID($id_smpl);
|
|
if ($datSmpl==FALSE) {
|
|
$value = 3;
|
|
} else {
|
|
$datDfpl = $this->Amod->getData_DaftarPricelist_byID($id_dfpl);
|
|
if ($datDfpl==FALSE) {
|
|
$value = 2;
|
|
} else {
|
|
$update = [
|
|
'OFF_COMPETE_DFPL' => $off_compete_dfpl,
|
|
'OFF_SPECIAL_DFPL' => $off_special_dfpl,
|
|
'ON_COMPETE_DFPL' => $on_compete_dfpl,
|
|
'ON_TECHNOSIFY_DFPL' => $on_technosify_dfpl,
|
|
'ON_ITP_DFPL' => $on_itp_dfpl,
|
|
'TIMESTAMP_DFPL' => "Oleh $panggilan pada $timestamp",
|
|
];
|
|
$action = $this->Amod->update('daftar_pricelist', $update, 'ID_DFPL', $id_dfpl);
|
|
|
|
$update = [
|
|
'SUBMENU_PRICELIST' => "Oleh $panggilan pada $timestamp",
|
|
'TERBARU_PRICELIST' => '2'
|
|
];
|
|
$action = $this->Amod->update('pricelist', $update, 'ID_PRICELIST', $id_pricelist);
|
|
|
|
$value = 1;
|
|
}
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value
|
|
]);
|
|
}
|
|
|
|
public function SP_Hapus_Sub1_F2_DataDaftarPricelist() {
|
|
$id_pricelist = $this->input->post('id_pricelist');
|
|
$id_smpl = $this->input->post('id_smpl');
|
|
$id_dfpl = $this->input->post('id_dfpl');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$value = 0;
|
|
$datPricelist = $this->Amod->getData_Pricelist_byID($id_pricelist);
|
|
if ($datPricelist==FALSE) {
|
|
$value = 4;
|
|
} else {
|
|
$datSmpl = $this->Amod->getData_SubmenuPricelist_byID($id_smpl);
|
|
if ($datSmpl==FALSE) {
|
|
$value = 3;
|
|
} else {
|
|
$datDfpl = $this->Amod->getData_DaftarPricelist_byID($id_dfpl);
|
|
if ($datDfpl==FALSE) {
|
|
$value = 2;
|
|
} else {
|
|
$action = $this->Amod->delete('daftar_pricelist', $id_dfpl, 'ID_DFPL');
|
|
|
|
$update = [
|
|
'SUBMENU_PRICELIST' => "Oleh $panggilan pada $timestamp",
|
|
'TERBARU_PRICELIST' => '2'
|
|
];
|
|
$action = $this->Amod->update('pricelist', $update, 'ID_PRICELIST', $id_pricelist);
|
|
|
|
$value = 1;
|
|
}
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value
|
|
]);
|
|
}
|
|
|
|
public function SP_Urutan_Sub1_F2_DataSubmenuPricelist() {
|
|
$id_pricelist = $this->input->post('id_pricelist');
|
|
$id_smpl = $this->input->post('id_smpl');
|
|
$urutan_smpl = $this->input->post('urutan_smpl');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$value = 0;
|
|
$datPricelist = $this->Amod->getData_Pricelist_byID($id_pricelist);
|
|
if ($datPricelist==FALSE) {
|
|
$value = 4;
|
|
} else {
|
|
$datSmpl = $this->Amod->getData_SubmenuPricelist_byID($id_smpl);
|
|
if ($datSmpl==FALSE) {
|
|
$value = 3;
|
|
} else {
|
|
$cekSmpl = $this->Amod->getData_SubmenuPricelist_byID($urutan_smpl);
|
|
if ($cekSmpl==FALSE) {
|
|
$value = 2;
|
|
} else {
|
|
$awalCount = $datSmpl[0]['URUTAN_SMPL'];
|
|
$akhirCount = $cekSmpl[0]['URUTAN_SMPL'];
|
|
|
|
$selisih = abs($awalCount-$akhirCount);
|
|
if ($selisih==1) {
|
|
$update = [
|
|
'URUTAN_SMPL' => $awalCount
|
|
];
|
|
$action = $this->Amod->update('submenu_pricelist', $update, 'ID_SMPL', $urutan_smpl);
|
|
} else {
|
|
//Ubah semua data sebelum atau sesudah pengganti
|
|
if ($awalCount<$akhirCount) {
|
|
$mulaiCount = $awalCount;
|
|
$smplBefore = $this->Amod->getData_SubmenuPricelist_byPRICELIST_afterAwal_beforePengganti($id_pricelist, $awalCount, $akhirCount);
|
|
foreach ($smplBefore as $key) {
|
|
$update = [
|
|
'URUTAN_SMPL' => $mulaiCount++
|
|
];
|
|
$action = $this->Amod->update('submenu_pricelist', $update, 'ID_SMPL', $key['ID_SMPL']);
|
|
}
|
|
} else if ($awalCount>$akhirCount) {
|
|
$mulaiCount = $akhirCount+1;
|
|
$smplBefore = $this->Amod->getData_SubmenuPricelist_byPRICELIST_beforeAwal_afterPengganti($id_pricelist, $awalCount, $akhirCount);
|
|
foreach ($smplBefore as $key) {
|
|
$update = [
|
|
'URUTAN_SMPL' => $mulaiCount++
|
|
];
|
|
$action = $this->Amod->update('submenu_pricelist', $update, 'ID_SMPL', $key['ID_SMPL']);
|
|
}
|
|
}
|
|
}
|
|
|
|
//Diganti sesuai pilihan
|
|
$update = [
|
|
'URUTAN_SMPL' => $akhirCount
|
|
];
|
|
$action = $this->Amod->update('submenu_pricelist', $update, 'ID_SMPL', $id_smpl);
|
|
|
|
$update = [
|
|
'SUBMENU_PRICELIST' => "Oleh $panggilan pada $timestamp",
|
|
'TERBARU_PRICELIST' => '2'
|
|
];
|
|
$action = $this->Amod->update('pricelist', $update, 'ID_PRICELIST', $id_pricelist);
|
|
|
|
$value = 1;
|
|
}
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value
|
|
]);
|
|
}
|
|
|
|
public function SP_Urutan_Sub1_F2_DataDaftarPricelist() {
|
|
$id_pricelist = $this->input->post('id_pricelist');
|
|
$id_smpl = $this->input->post('id_smpl');
|
|
$id_dfpl = $this->input->post('id_dfpl');
|
|
$urutan_dfpl = $this->input->post('urutan_dfpl');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$value = 0;
|
|
$datPricelist = $this->Amod->getData_Pricelist_byID($id_pricelist);
|
|
if ($datPricelist==FALSE) {
|
|
$value = 4;
|
|
} else {
|
|
$datSmpl = $this->Amod->getData_SubmenuPricelist_byID($id_smpl);
|
|
if ($datSmpl==FALSE) {
|
|
$value = 3;
|
|
} else {
|
|
$cekDfplAwal = $this->Amod->getData_DaftarPricelist_byID($id_dfpl);
|
|
$cekDfplAkhir = $this->Amod->getData_DaftarPricelist_byID($urutan_dfpl);
|
|
if ($cekDfplAwal==FALSE OR $cekDfplAkhir==FALSE) {
|
|
$value = 2;
|
|
} else {
|
|
$awalCount = $cekDfplAwal[0]['URUTAN_DFPL'];
|
|
$akhirCount = $cekDfplAkhir[0]['URUTAN_DFPL'];
|
|
|
|
$selisih = abs($awalCount-$akhirCount);
|
|
if ($selisih==1) {
|
|
$update = [
|
|
'URUTAN_DFPL' => $awalCount
|
|
];
|
|
$action = $this->Amod->update('daftar_pricelist', $update, 'ID_DFPL', $urutan_dfpl);
|
|
} else {
|
|
//Ubah semua data sebelum atau sesudah pengganti
|
|
if ($awalCount<$akhirCount) {
|
|
$mulaiCount = $awalCount;
|
|
$dfplBefore = $this->Amod->getData_DaftarPricelist_bySMPL_afterAwal_beforePengganti($id_smpl, $awalCount, $akhirCount);
|
|
foreach ($dfplBefore as $key) {
|
|
$update = [
|
|
'URUTAN_DFPL' => $mulaiCount++
|
|
];
|
|
$action = $this->Amod->update('daftar_pricelist', $update, 'ID_DFPL', $key['ID_DFPL']);
|
|
}
|
|
} else if ($awalCount>$akhirCount) {
|
|
$mulaiCount = $akhirCount+1;
|
|
$dfplBefore = $this->Amod->getData_DaftarPricelist_bySMPL_beforeAwal_afterPengganti($id_smpl, $awalCount, $akhirCount);
|
|
foreach ($dfplBefore as $key) {
|
|
$update = [
|
|
'URUTAN_DFPL' => $mulaiCount++
|
|
];
|
|
$action = $this->Amod->update('daftar_pricelist', $update, 'ID_DFPL', $key['ID_DFPL']);
|
|
}
|
|
}
|
|
}
|
|
|
|
//Diganti sesuai pilihan
|
|
$update = [
|
|
'URUTAN_DFPL' => $akhirCount
|
|
];
|
|
$action = $this->Amod->update('daftar_pricelist', $update, 'ID_DFPL', $id_dfpl);
|
|
|
|
$update = [
|
|
'SUBMENU_PRICELIST' => "Oleh $panggilan pada $timestamp",
|
|
'TERBARU_PRICELIST' => '2'
|
|
];
|
|
$action = $this->Amod->update('pricelist', $update, 'ID_PRICELIST', $id_pricelist);
|
|
|
|
$value = 1;
|
|
}
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value
|
|
]);
|
|
}
|
|
|
|
//SUBMENU PUSAT DATA - CETAK DOKUMEN
|
|
public function SP_Sub2_CetakDokumen_1() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$now = date('Y-m-d');
|
|
$limit = date('Y-m-01');
|
|
$month = $this->Amod->generate_inisialMonth(date('m'));
|
|
$year = date('Y');
|
|
$timelimit = strtoupper("$month $year");
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "SP", "PUSAT DATA - Cetak Dokumen");
|
|
$id_menu = $datShm[0]['MENU_ID'];
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$datSnkpr = $this->Amod->getData_SnKlaimProgram_byPERIODE_cetakNull($limit, $now);
|
|
|
|
$datStpos = $this->Amod->getData_SetTogglePosisi_byKARYAWAN_byMENU($id_karyawan, $id_menu);
|
|
if ($datStpos==FALSE) { $posisiToggle = 0; } else { $posisiToggle = $datStpos[0]['AKTIF_STPOS']; }
|
|
|
|
$data = array(
|
|
'sidebar' => "menu salesproduk",
|
|
'navChild' => "salesproduk cetak",
|
|
'snkpr' => $datSnkpr,
|
|
'countSnkpr' => count($datSnkpr),
|
|
'posisiToggle' => $posisiToggle,
|
|
'id_menu' => $id_menu,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil,
|
|
'timelimit' => $timelimit,
|
|
);
|
|
$this->load->view('proses/SP_Sub2_CetakDokumen_1', $data);
|
|
}
|
|
|
|
public function SP_Cetak_Sub2_A1_DataNotaKlaim($id) {
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$datSnkpr = $this->Amod->getData_SnKlaimProgram_byID_cetakNota($id);
|
|
|
|
$update = [
|
|
'CETAK_SNKPR' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('sn_klaimprogram', $update, 'ID_SNKPR', $id);
|
|
|
|
$data = [
|
|
'klaim' => $datSnkpr
|
|
];
|
|
$this->load->view('cetak/Nota_Klaim_ITP', $data);
|
|
}
|
|
|
|
public function SP_Sub2_CetakDokumen_2() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$now = date('Y-m-d');
|
|
$limit = date('Y-m-01');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "SP", "PUSAT DATA - Cetak Dokumen");
|
|
$id_menu = $datShm[0]['MENU_ID'];
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
if ($hak<=3) {
|
|
$limit = $this->Amod->generate_subMonth($limit, 3);
|
|
$timelimit = strtoupper("3 Bulan Kebelakang");
|
|
} else {
|
|
$limit = $this->Amod->generate_subMonth($limit, 6);
|
|
$timelimit = strtoupper("6 Bulan Kebelakang");
|
|
}
|
|
|
|
$datSnkpr = $this->Amod->getData_SnKlaimProgram_byPERIODE($limit, $now);
|
|
|
|
$datStpos = $this->Amod->getData_SetTogglePosisi_byKARYAWAN_byMENU($id_karyawan, $id_menu);
|
|
if ($datStpos==FALSE) { $posisiToggle = 0; } else { $posisiToggle = $datStpos[0]['AKTIF_STPOS']; }
|
|
|
|
$data = array(
|
|
'sidebar' => "menu salesproduk",
|
|
'navChild' => "salesproduk cetak",
|
|
'snkpr' => $datSnkpr,
|
|
'countSnkpr' => count($datSnkpr),
|
|
'posisiToggle' => $posisiToggle,
|
|
'id_menu' => $id_menu,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil,
|
|
'timelimit' => $timelimit,
|
|
);
|
|
$this->load->view('proses/SP_Sub2_CetakDokumen_2', $data);
|
|
}
|
|
|
|
//SUBMENU PUSAT DATA - INFORMASI
|
|
public function SP_Sub2_Informasi_1($id=null) {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "SP", "PUSAT DATA - Informasi");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
if ($id==null) {
|
|
$posisiToggle = 0;
|
|
} else {
|
|
$posisiToggle = $id;
|
|
}
|
|
|
|
$data = array(
|
|
'sidebar' => "menu salesproduk",
|
|
'navChild' => "salesproduk informasi",
|
|
'posisiToggle' => $posisiToggle,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil
|
|
);
|
|
$this->load->view('proses/SP_Sub2_Informasi_1', $data);
|
|
}
|
|
|
|
//SUBMENU PUSAT DATA - LAPORAN
|
|
public function SP_Sub2_Laporan_1() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "SP", "PUSAT DATA - Laporan");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$data = array(
|
|
'sidebar' => "menu salesproduk",
|
|
'navChild' => "salesproduk laporan",
|
|
'hak' => $hak,
|
|
'tampil' => $tampil
|
|
);
|
|
$this->load->view('proses/SP_Sub2_Laporan_1', $data);
|
|
}
|
|
|
|
public function SP_Sub2_StokKlaim_2() {
|
|
$datSupplier = $this->Amod->getData_Supplier_bySTATUS(1);
|
|
$datSsp = $this->Amod->getData_SetSalesProduk();
|
|
|
|
$data = array(
|
|
'sidebar' => "menu salesproduk",
|
|
'navChild' => "salesproduk laporan",
|
|
'supplier' => $datSupplier,
|
|
'ssp' => $datSsp,
|
|
);
|
|
$this->load->view('proses/SP_Sub2_StokKlaim_2', $data);
|
|
}
|
|
|
|
public function SP_Sub2_Promo_2() {
|
|
$now = date('Y-m-d');
|
|
$datSsp = $this->Amod->getData_SetSalesProduk();
|
|
$datProgram = $this->Amod->getData_Program();
|
|
|
|
$data = array(
|
|
'sidebar' => "menu salesproduk",
|
|
'navChild' => "salesproduk laporan",
|
|
'tgl' => $now,
|
|
'ssp' => $datSsp,
|
|
'program' => $datProgram,
|
|
);
|
|
$this->load->view('proses/SP_Sub2_Promo_2', $data);
|
|
}
|
|
|
|
public function SP_Sub2_RekapCn_2() {
|
|
$now = date('Y-m-d');
|
|
$datSsp = $this->Amod->getData_SetSalesProduk();
|
|
|
|
$data = array(
|
|
'sidebar' => "menu salesproduk",
|
|
'navChild' => "salesproduk laporan",
|
|
'tgl' => $now,
|
|
'ssp' => $datSsp,
|
|
);
|
|
$this->load->view('proses/SP_Sub2_RekapCn_2', $data);
|
|
}
|
|
|
|
public function SP_Sub2_Pricelist_2() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$now = date('Y-m-d');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "SP", "PUSAT DATA - Laporan");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
if ($hak>2) {
|
|
$datSsp = $this->Amod->getData_SetSalesProduk();
|
|
} else {
|
|
$datSsp = $this->Amod->getData_SetSalesProduk_bySALES($id_karyawan);
|
|
}
|
|
|
|
$data = array(
|
|
'sidebar' => "menu salesproduk",
|
|
'navChild' => "salesproduk laporan",
|
|
'tgl' => $now,
|
|
'ssp' => $datSsp,
|
|
);
|
|
$this->load->view('proses/SP_Sub2_Pricelist_2', $data);
|
|
}
|
|
|
|
public function SP_Sub2_TargetBeli_2() {
|
|
$now = date('Y-m-d');
|
|
$datSupplier = $this->Amod->getData_Supplier_bySTATUS(1);
|
|
$datCorp = $this->Amod->getData_Corp_bySTATUS(1);
|
|
$datSsp = $this->Amod->getData_SetSalesProduk();
|
|
|
|
$data = array(
|
|
'sidebar' => "menu salesproduk",
|
|
'navChild' => "salesproduk laporan",
|
|
'tgl' => $now,
|
|
'supplier' => $datSupplier,
|
|
'corp' => $datCorp,
|
|
'ssp' => $datSsp,
|
|
);
|
|
$this->load->view('proses/SP_Sub2_TargetBeli_2', $data);
|
|
}
|
|
|
|
public function SP_Sub2_TargetJual_2() {
|
|
$now = date('Y-m-d');
|
|
$datCorp = $this->Amod->getData_Corp_bySTATUS(1);
|
|
$datSsp = $this->Amod->getData_SetSalesProduk();
|
|
$datSales = $this->Amod->getData_Karyawan_SalesFormKaryawan();
|
|
|
|
$data = array(
|
|
'sidebar' => "menu salesproduk",
|
|
'navChild' => "salesproduk laporan",
|
|
'tgl' => $now,
|
|
'corp' => $datCorp,
|
|
'ssp' => $datSsp,
|
|
'sales' => $datSales,
|
|
);
|
|
$this->load->view('proses/SP_Sub2_TargetJual_2', $data);
|
|
}
|
|
|
|
public function SP_Sub2_StokAging_2() {
|
|
$now = date('Y-m-d');
|
|
$datCorp = $this->Amod->getData_Corp_bySTATUS(1);
|
|
$datSsp = $this->Amod->getData_SetSalesProduk();
|
|
|
|
$data = array(
|
|
'sidebar' => "menu salesproduk",
|
|
'navChild' => "salesproduk laporan",
|
|
'tgl' => $now,
|
|
'corp' => $datCorp,
|
|
'ssp' => $datSsp,
|
|
);
|
|
$this->load->view('proses/SP_Sub2_StokAging_2', $data);
|
|
}
|
|
|
|
public function SP_Sub2_StokTerjual_2() {
|
|
$now = date('Y-m-d');
|
|
$datSsp = $this->Amod->getData_SetSalesProduk();
|
|
|
|
$data = array(
|
|
'sidebar' => "menu salesproduk",
|
|
'navChild' => "salesproduk laporan",
|
|
'tgl' => $now,
|
|
'ssp' => $datSsp,
|
|
);
|
|
$this->load->view('proses/SP_Sub2_StokTerjual_2', $data);
|
|
}
|
|
|
|
public function SP_Ambil_Sub2_DataPotonganKlaimProgram() {
|
|
$id_program = $this->input->post('id_program');
|
|
|
|
$data = $this->Amod->getData_PotonganKlaimProgram_byPROGRAM_groupNAMA($id_program);
|
|
|
|
$this->output_json([
|
|
'data' => $data,
|
|
]);
|
|
}
|
|
|
|
public function SP_Ambil_Sub2_DataPeriodeKlaimProgram() {
|
|
$id_ssp = $this->input->post('id_ssp');
|
|
|
|
$datSsp = $this->Amod->getData_SetSalesProduk_byID($id_ssp);
|
|
|
|
$data = $this->Amod->getData_PeriodeKlaimProgram_byMERK_bySTATUS($datSsp[0]['MERK_ID'], 1);
|
|
|
|
$this->output_json([
|
|
'data' => $data,
|
|
]);
|
|
}
|
|
|
|
public function SP_Ambil_Sub2_DataAnalisaTargetBeli() {
|
|
$id_supplier = $this->input->post('id_supplier');
|
|
$id_corp = $this->input->post('id_corp');
|
|
$id_ssp = $this->input->post('id_ssp');
|
|
$awal = $this->input->post('awal');
|
|
$akhir = $this->input->post('akhir');
|
|
$search = $this->input->post('search');
|
|
|
|
if ($id_corp == "") {
|
|
$id_corp = NULL;
|
|
}
|
|
|
|
if ($id_supplier == "") {
|
|
$id_supplier = NULL;
|
|
}
|
|
|
|
if ($id_ssp == "") {
|
|
$id_merk = NULL;
|
|
$id_produk = NULL;
|
|
} else {
|
|
$datSsp = $this->Amod->getData_SetSalesProduk_byID($id_ssp);
|
|
$id_merk = $datSsp[0]['MERK_ID'];
|
|
$id_produk = $datSsp[0]['PRODUK_ID'];
|
|
}
|
|
|
|
$data = $this->Amod->getData_DaftarBeli_byCORP_bySUPPLIER_byMERK_byPRODUK_byPERIODE_status1($id_corp, $id_supplier, $id_merk, $id_produk, $awal, $akhir, $search);
|
|
$no = 0;
|
|
$totDpp = 0;
|
|
$totQty = 0;
|
|
foreach ($data as $key) {
|
|
$satuan = $key['HARGA_DB'];
|
|
$subtotal = $key['HARGA_DB']*$key['QTY_DB'];
|
|
$totDpp = round(($totDpp+$subtotal),2);
|
|
$kop = $this->Amod->generate_inisialCorp($key['CORP_ID']);
|
|
|
|
$data[$no] += ['KOP' => $kop];
|
|
$data[$no] += ['SATUAN' => number_format($satuan, 2)];
|
|
$data[$no++] += ['SUBTOTAL' => number_format($subtotal, 2)];
|
|
|
|
$totQty = $totQty+$key['QTY_DB'];
|
|
}
|
|
|
|
$this->output_json([
|
|
'data' => $data,
|
|
'totDpp' => number_format($totDpp,2),
|
|
'totQty' => $totQty,
|
|
]);
|
|
}
|
|
|
|
public function SP_Ambil_Sub2_DataAnalisaTargetJual() {
|
|
$id_corp = $this->input->post('id_corp');
|
|
$id_ssp = $this->input->post('id_ssp');
|
|
$id_sales = $this->input->post('id_sales');
|
|
$awal = $this->input->post('awal');
|
|
$akhir = $this->input->post('akhir');
|
|
$search = $this->input->post('search');
|
|
|
|
if ($id_corp == "") {
|
|
$id_corp = NULL;
|
|
}
|
|
|
|
if ($id_ssp == "") {
|
|
$id_merk = NULL;
|
|
$id_produk = NULL;
|
|
} else {
|
|
$datSsp = $this->Amod->getData_SetSalesProduk_byID($id_ssp);
|
|
$id_merk = $datSsp[0]['MERK_ID'];
|
|
$id_produk = $datSsp[0]['PRODUK_ID'];
|
|
}
|
|
|
|
if ($id_sales == "") {
|
|
$id_sales = NULL;
|
|
}
|
|
|
|
$data = $this->Amod->getData_DaftarOrder_byCORP_byMERK_byPRODUK_bySALES_byPERIODE_status1($id_corp, $id_merk, $id_produk, $id_sales, $awal, $akhir, $search);
|
|
$no = 0;
|
|
$totDpp = 0;
|
|
$totQty = 0;
|
|
foreach ($data as $key) {
|
|
$totDpp = round(($totDpp+$key['TOTALDPP']),2);
|
|
$totQty = $totQty+$key['TOTALQTY'];
|
|
}
|
|
|
|
$this->output_json([
|
|
'data' => $data,
|
|
'totDpp' => number_format($totDpp,2),
|
|
'totQty' => $totQty,
|
|
]);
|
|
}
|
|
|
|
public function SP_Ambil_Sub2_DataAnalisaStokAging() {
|
|
$id_corp = $this->input->post('id_corp');
|
|
$id_ssp = $this->input->post('id_ssp');
|
|
$awalbeli = $this->input->post('awalbeli');
|
|
$akhirbeli = $this->input->post('akhirbeli');
|
|
$awaljual = $this->input->post('awaljual');
|
|
$akhirjual = $this->input->post('akhirjual');
|
|
$search = $this->input->post('search');
|
|
|
|
if ($id_corp == "") {
|
|
$id_corp = NULL;
|
|
}
|
|
|
|
if ($id_ssp == "") {
|
|
$id_merk = NULL;
|
|
$id_produk = NULL;
|
|
} else {
|
|
$datSsp = $this->Amod->getData_SetSalesProduk_byID($id_ssp);
|
|
$id_merk = $datSsp[0]['MERK_ID'];
|
|
$id_produk = $datSsp[0]['PRODUK_ID'];
|
|
}
|
|
|
|
$data = $this->Amod->getData_DaftarBeli_forStokAging($awalbeli, $akhirbeli, $id_corp, $id_merk, $id_produk, $search);
|
|
$no = 0;
|
|
$totPer = 0;
|
|
$totSisa = 0;
|
|
foreach ($data as $key) {
|
|
$datSnb = $this->Amod->getData_SnBeli_forStokAging($awalbeli, $akhirbeli, $key['BARANG_ID'], $id_corp, $id_merk, $id_produk);
|
|
$terjual = 0;
|
|
$tersisa = 0;
|
|
foreach ($datSnb as $dat) {
|
|
$datSnStock = $this->Amod->getData_SnStock_byNAMA_allStatus($dat['NAMA_SNB']);
|
|
if ($datSnStock[0]['STATUS_SNSTOCK']==1 OR $datSnStock[0]['STATUS_SNSTOCK']==3 OR $datSnStock[0]['STATUS_SNSTOCK']==4) {
|
|
$datHsn = $this->Amod->getData_HistoriSn_bySNSTOCK_forStokAging($datSnStock[0]['ID_SNSTOCK'], $awaljual, $akhirjual);
|
|
if ($datHsn==TRUE) {
|
|
$terjual++;
|
|
} else {
|
|
$tersisa++;
|
|
}
|
|
} else {
|
|
$tersisa++;
|
|
}
|
|
}
|
|
$datHq = $this->Amod->getData_HistoriKuantiti_byBARANG_beforeTGL_orderDESC_limit1($key['BARANG_ID'], $akhirjual);
|
|
$persediaan = round(($tersisa*$datHq[0]['AVG_HQ']),2);
|
|
|
|
$data[$no] += ['PERSEDIAAN' => number_format($persediaan,2)];
|
|
$data[$no] += ['TOTALJUAL' => $terjual];
|
|
$data[$no++] += ['TOTALSISA' => $tersisa];
|
|
|
|
$totPer = $totPer+$persediaan;
|
|
$totSisa = $totSisa+$tersisa;
|
|
}
|
|
|
|
$this->output_json([
|
|
'data' => $data,
|
|
'totPer' => number_format($totPer,2),
|
|
'totSisa' => "$totSisa",
|
|
]);
|
|
}
|
|
|
|
public function SP_Excel_Sub2_DataPembukuanStokKlaim() {
|
|
$id_supplier = $this->input->post('id_supplierfill');
|
|
$id_ssp = $this->input->post('id_sspfill');
|
|
$status_snkpr = $this->input->post('status_snkprfill');
|
|
$jenis_barang = $this->input->post('jenis_barangfill');
|
|
$jenis_laporan = $this->input->post('jenis_laporanfill');
|
|
$ts = date('d/m/Y H:i:s');
|
|
|
|
if ($id_supplier=="") {
|
|
$id_supplier = NULL;
|
|
}
|
|
|
|
$mtmOk = 0;
|
|
if ($id_ssp=="") {
|
|
$id_merk = NULL;
|
|
$id_produk = NULL;
|
|
} else {
|
|
$datSsp = $this->Amod->getData_SetSalesProduk_byID($id_ssp);
|
|
$id_merk = $datSsp[0]['MERK_ID'];
|
|
$id_produk = $datSsp[0]['PRODUK_ID'];
|
|
if ($id_merk==3 AND $id_produk==1) {
|
|
$mtmOk = 1;
|
|
}
|
|
}
|
|
|
|
if ($jenis_laporan==1) {
|
|
$judul = "DATA NON-SN";
|
|
} else if ($jenis_laporan==2) {
|
|
$judul = "DATA SN Tanpa Harga";
|
|
} else if ($jenis_laporan==3) {
|
|
$judul = "DATA SN Dengan Harga";
|
|
}
|
|
|
|
if ($status_snkpr=="8") {
|
|
$transaksi = "SEMUA STATUS";
|
|
} else if ($status_snkpr==0) {
|
|
$transaksi = "READY";
|
|
} else if ($status_snkpr==1) {
|
|
$transaksi = "SELESAI";
|
|
} else if ($status_snkpr==2) {
|
|
$transaksi = "RETURBELI";
|
|
} else if ($status_snkpr==3) {
|
|
$transaksi = "KELUARSTOK";
|
|
} else if ($status_snkpr==4) {
|
|
$transaksi = "PROMOTOR";
|
|
} else if ($status_snkpr==9) {
|
|
$transaksi = "TERHAPUS";
|
|
}
|
|
|
|
if ($jenis_barang==1) {
|
|
$listJenis = $this->Amod->getData_KlaimProgram_byMERK_byPRODUK_groupJENIS($id_merk, $id_produk);
|
|
} else if ($jenis_barang==2) {
|
|
$listJenis[0] = [
|
|
'JENIS_ID' => NULL,
|
|
'NAMA_JENIS' => "Semua Jenis"
|
|
];
|
|
}
|
|
|
|
$hasil = [];
|
|
$no = 0;
|
|
foreach ($listJenis as $key) {
|
|
if ($jenis_laporan==1) {
|
|
if ($jenis_barang==1) {
|
|
if ($mtmOk==0) {
|
|
$pilih_tabel = array('No', 'Kode', 'SKU', 'Kuantiti');
|
|
} else if ($mtmOk==1) {
|
|
$pilih_tabel = array('No', 'Kode', 'MTM', 'SKU', 'Kuantiti');
|
|
}
|
|
} else if ($jenis_barang==2) {
|
|
if ($mtmOk==0) {
|
|
$pilih_tabel = array('No', 'Jenis', 'Kode', 'SKU', 'Kuantiti');
|
|
} else if ($mtmOk==1) {
|
|
$pilih_tabel = array('No', 'Jenis', 'Kode', 'MTM', 'SKU', 'Kuantiti');
|
|
}
|
|
}
|
|
} else if ($jenis_laporan==2) {
|
|
$pilih_tabel = array('No', 'SKU', 'Kuantiti', 'Serial Number', 'Status', 'Supplier');
|
|
} else if ($jenis_laporan==3) {
|
|
$pilih_tabel = array('No', 'SKU', 'Kuantiti', 'Serial Number', 'Status', 'Harga Awal', 'Potongan', 'Harga Akhir');
|
|
}
|
|
|
|
$datSnkpr = $this->Amod->getData_SnKlaimProgram_bySUPPLIER_byJENIS_byMERK_byPRODUK_bySTATUS($id_supplier, $key['JENIS_ID'], $id_merk, $id_produk, $status_snkpr, $jenis_barang, $jenis_laporan);
|
|
$total = 0;
|
|
$nodat = 0;
|
|
foreach ($datSnkpr as $dat) {
|
|
if ($jenis_laporan==3) {
|
|
$sumPkpr = $this->Amod->getSum_LinkKlaimProgram_bySNKPR($dat['ID_SNKPR']);
|
|
$hargabaru = $dat['HARGA_KPR']-$sumPkpr[0]['TOTAL'];
|
|
$potongan = number_format($sumPkpr[0]['TOTAL'],2);
|
|
|
|
$datSnkpr[$nodat] += ['HARGAAKHIR' => number_format($hargabaru,2)];
|
|
$datSnkpr[$nodat] += ['POTONGAN' => $potongan];
|
|
}
|
|
|
|
if ($jenis_laporan==2 OR $jenis_laporan==3) {
|
|
$countSnkpr = $this->Amod->getCount_SnKlaimProgram_byBARANG_bySUPPLIER_byMERK_byPRODUK_bySTATUS($dat['BARANG_ID'], $id_supplier, $id_merk, $id_produk, $status_snkpr);
|
|
|
|
if ($dat['STATUS_SNKPR']==0) {
|
|
$statussn = "READY";
|
|
} else if ($dat['STATUS_SNKPR']==1) {
|
|
$statussn = "SELESAI";
|
|
} else if ($dat['STATUS_SNKPR']==2) {
|
|
$statussn = "RETURBELI";
|
|
} else if ($dat['STATUS_SNKPR']==3) {
|
|
$statussn = "KELUARSTOK";
|
|
} else if ($dat['STATUS_SNKPR']==4) {
|
|
$statussn = "PROMOTOR";
|
|
} else if ($dat['STATUS_SNKPR']==9) {
|
|
$statussn = "TERHAPUS";
|
|
}
|
|
|
|
$datSnkpr[$nodat] += ['COUNT' => $countSnkpr];
|
|
$datSnkpr[$nodat++] += ['STATUSSN' => $statussn];
|
|
}
|
|
|
|
$total = $total+$dat['TOTAL'];
|
|
}
|
|
|
|
$hasil[$no++] = [
|
|
'subjudul' => $key['NAMA_JENIS'],
|
|
'barang' => $datSnkpr,
|
|
'nama_tabel' => $pilih_tabel,
|
|
'jumlah_kolom' => count($pilih_tabel),
|
|
'total' => $total,
|
|
];
|
|
}
|
|
|
|
$data = [
|
|
'ts' => $ts,
|
|
'hasil' => $hasil,
|
|
'judul' => $judul,
|
|
'transaksi' => $transaksi,
|
|
'jenis_barang' => $jenis_barang,
|
|
'jenis_laporan' => $jenis_laporan,
|
|
'mtmOk' => $mtmOk,
|
|
];
|
|
$this->load->view('cetak/SP_Excel_Sub2_DataPembukuanStokKlaim', $data);
|
|
}
|
|
|
|
public function SP_Excel_Sub2_DataPembukuanPromo() {
|
|
$id_ssp = $this->input->post('id_sspfill');
|
|
$id_program = $this->input->post('id_programfill');
|
|
$nama_pkpr = $this->input->post('nama_pkprfill');
|
|
$awal = $this->input->post('tgl_awalfill');
|
|
$akhir = $this->input->post('tgl_akhirfill');
|
|
$ts = date('d/m/Y H:i:s');
|
|
|
|
if ($id_program=="") {
|
|
$id_program = NULL;
|
|
} else {
|
|
if ($nama_pkpr=="") {
|
|
$nama_pkpr = NULL;
|
|
}
|
|
}
|
|
|
|
if ($id_ssp=="") {
|
|
$id_merk = NULL;
|
|
$id_produk = NULL;
|
|
} else {
|
|
$datSsp = $this->Amod->getData_SetSalesProduk_byID($id_ssp);
|
|
$id_merk = $datSsp[0]['MERK_ID'];
|
|
$id_produk = $datSsp[0]['PRODUK_ID'];
|
|
}
|
|
|
|
$datLnkpr = $this->Amod->getData_LinkKlaimProgram_byMERK_byPRODUK_byPROGRAM_byPERIODE($id_merk, $id_produk, $id_program, $nama_pkpr, $awal, $akhir);
|
|
$totalPromo = 0;
|
|
foreach ($datLnkpr as $key) {
|
|
$totalPromo = $totalPromo+$key['NILAI_LKPR'];
|
|
}
|
|
|
|
$hasil[0] = $datLnkpr;
|
|
$pilih_tabel = array('No', 'Tanggal', 'SKU', 'Serial Number', 'Promo', 'Nominal');
|
|
|
|
$data = [
|
|
'awal_nota' => date_format(date_create($awal), "d/m/Y"),
|
|
'akhir_nota' => date_format(date_create($akhir), "d/m/Y"),
|
|
'hasil' => $hasil,
|
|
'nama_tabel' => $pilih_tabel,
|
|
'jumlah_kolom' => count($pilih_tabel),
|
|
'totalPromo' => number_format($totalPromo, 2),
|
|
'ts' => $ts,
|
|
];
|
|
$this->load->view('cetak/SP_Excel_Sub2_DataPembukuanPromo', $data);
|
|
}
|
|
|
|
public function SP_Excel_Sub2_DataRekapCreditNote() {
|
|
$id_ssp = $this->input->post('id_sspfill');
|
|
$status_rkpr = $this->input->post('status_rkprfill');
|
|
$id_pkl = $this->input->post('id_pklfill');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$pilih_tabel = array('No', 'Periode', 'Merk', 'Produk', 'Promo', 'Nilai REKAP', 'Sudah TERPAKAI', 'Detail CN');
|
|
|
|
if ($id_ssp=="") {
|
|
$id_merk = NULL;
|
|
$id_produk = NULL;
|
|
} else {
|
|
$datSsp = $this->Amod->getData_SetSalesProduk_byID($id_ssp);
|
|
$id_merk = $datSsp[0]['MERK_ID'];
|
|
$id_produk = $datSsp[0]['PRODUK_ID'];
|
|
}
|
|
|
|
if ($status_rkpr=="") {
|
|
$status_rkpr = NULL;
|
|
$judul = "SEMUA STATUS";
|
|
} else if ($status_rkpr==0) {
|
|
$judul = "BELUM SELESAI";
|
|
} else if ($status_rkpr==1) {
|
|
$judul = "SUDAH SELESAI";
|
|
}
|
|
|
|
if ($id_pkl=="") {
|
|
$periode = "Semua Periode";
|
|
} else {
|
|
$datPkl = $this->Amod->getData_PeriodeKlaimProgram_byID($id_pkl);
|
|
$awal = $datPkl[0]['AWAL'];
|
|
$akhir = $datPkl[0]['AKHIR'];
|
|
$periode = "$awal s.d $akhir";
|
|
}
|
|
|
|
$datRkpr = $this->Amod->getData_RekapKlaimProgram_byMERK_byPRODUK_bySTATUS_byPERIODE($id_merk, $id_produk, $status_rkpr, $id_pkl);
|
|
$totalNilai = 0;
|
|
$totalTerpakai = 0;
|
|
$no = 0;
|
|
foreach ($datRkpr as $key) {
|
|
$sumCn = $this->Amod->getSum_CreditNote_byRKPR($key['ID_RKPR']);
|
|
if ($sumCn==FALSE) {
|
|
$terpakai = 0;
|
|
} else {
|
|
$terpakai = $sumCn[0]['TOTAL'];
|
|
}
|
|
|
|
$counter = 1;
|
|
$list = "";
|
|
$datCn = $this->Amod->getData_CreditNote_byRKPR($key['ID_RKPR']);
|
|
foreach ($datCn as $dat) {
|
|
if ($dat['JENIS_CN']==1) {
|
|
if ($dat['SO_ID']!=NULL) {
|
|
$link = $dat['KODE_SO'];
|
|
} else {
|
|
$link = "-";
|
|
}
|
|
} else if ($dat['JENIS_CN']==2) {
|
|
if ($dat['PEMBELIAN_ID']!=NULL) {
|
|
$link = $dat['KODE_PEMBELIAN'];
|
|
} else {
|
|
$link = "-";
|
|
}
|
|
} else if ($dat['JENIS_CN']==3) {
|
|
$link = "VOUCHER";
|
|
} else if ($dat['JENIS_CN']==9) {
|
|
$link = "DATA LAMA";
|
|
}
|
|
|
|
$kode = $dat['KODE_CN'];
|
|
$nilai = $dat['NILAI'];
|
|
if (count($datCn)==$counter) {
|
|
$list .= "$kode | $link | $nilai";
|
|
} else {
|
|
$list .= "$kode | $link | $nilai\r";
|
|
}
|
|
$counter++;
|
|
}
|
|
|
|
$awalPeriode = $key['AWAL'];
|
|
$akhirPeriode = $key['AKHIR'];
|
|
$namaPeriode = $key['NAMA_PKL'];
|
|
$periodeTampil = "[$awalPeriode s.d $akhirPeriode] $namaPeriode";
|
|
|
|
$datRkpr[$no] += ['LIST' => $list];
|
|
$datRkpr[$no] += ['PERIODE' => $periodeTampil];
|
|
$datRkpr[$no++] += ['TERPAKAI' => number_format($terpakai,2)];
|
|
|
|
$totalTerpakai = $totalTerpakai+$terpakai;
|
|
$totalNilai = $totalNilai+$key['NILAI_RKPR'];
|
|
}
|
|
|
|
$data = [
|
|
'periode' => $periode,
|
|
'jumlah_kolom' => count($pilih_tabel),
|
|
'nama_tabel' => $pilih_tabel,
|
|
'laporan' => $datRkpr,
|
|
'judul' => $judul,
|
|
'totalNilai' => number_format($totalNilai,2),
|
|
'totalTerpakai' => number_format($totalTerpakai,2),
|
|
'ts' => $timestamp,
|
|
];
|
|
$this->load->view('cetak/SP_Excel_Sub2_DataRekapCreditNote', $data);
|
|
}
|
|
|
|
public function SP_Excel_Sub2_DataPembukuanPricelist() {
|
|
$id_ssp = $this->input->post('id_sspfill');
|
|
$id_pricelist = $this->input->post('id_pricelistfill');
|
|
$id_smpl = $this->input->post('id_smplfill');
|
|
$id_dfpl = $this->input->post('id_dfplfill');
|
|
$kolom_pricelist = $this->input->post('kolom_pricelistfill');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$pilih_tabel = [];
|
|
$listKolom = explode(",",$kolom_pricelist);
|
|
$no = 0;
|
|
foreach ($listKolom as $key) {
|
|
if ($key==1) {
|
|
$nama = "Datasheet";
|
|
} else if ($key==2) {
|
|
$nama = "Model";
|
|
} else if ($key==3) {
|
|
$nama = "MTM";
|
|
} else if ($key==4) {
|
|
$nama = "PN";
|
|
} else if ($key==5) {
|
|
$nama = "Deskripsi";
|
|
} else if ($key==6) {
|
|
$nama = "Kuantiti";
|
|
} else if ($key==7) {
|
|
$nama = "Dealer Price";
|
|
} else if ($key==8) {
|
|
$nama = "SR Price";
|
|
} else if ($key==9) {
|
|
$nama = "MSR Price";
|
|
} else if ($key==10) {
|
|
$nama = "Ekatalog";
|
|
} else if ($key==11) {
|
|
$nama = "MD Price";
|
|
}
|
|
|
|
$pilih_tabel[$no++] = $nama;
|
|
}
|
|
|
|
$detail = [];
|
|
if ($id_dfpl!="") {
|
|
$listDetail = explode(",",$id_dfpl);
|
|
$no = 0;
|
|
foreach ($listDetail as $key) {
|
|
$detail[$no++] = $key;
|
|
}
|
|
}
|
|
|
|
if ($id_ssp=="") {
|
|
$datPricelist = $this->Amod->getData_Pricelist_orderNAMA();
|
|
} else {
|
|
if ($id_pricelist=="") {
|
|
$datPricelist = $this->Amod->getData_Pricelist_bySSP($id_ssp);
|
|
} else {
|
|
$datPricelist = $this->Amod->getData_Pricelist_byID($id_pricelist);
|
|
}
|
|
}
|
|
|
|
$data = [];
|
|
$no = 0;
|
|
foreach ($datPricelist as $key) {
|
|
if ($id_smpl=="") {
|
|
$datSmpl = $this->Amod->getData_SubmenuPricelist_byPRICELIST_orderURUTAN($key['ID_PRICELIST']);
|
|
} else {
|
|
$datSmpl = $this->Amod->getData_SubmenuPricelist_byID($id_smpl);
|
|
}
|
|
$nosmpl = 0;
|
|
foreach ($datSmpl as $dat) {
|
|
$datDfpl = $this->Amod->getData_DaftarPricelist_bySMPL_orderURUTAN($dat['ID_SMPL']);
|
|
if ($id_dfpl!="") {
|
|
$nodaf = 0;
|
|
if ($datDfpl==FALSE) {
|
|
$daftar = NULL;
|
|
} else {
|
|
$daftar = [];
|
|
foreach ($datDfpl as $keydat) {
|
|
foreach ($detail as $datkey) {
|
|
if ($keydat['ID_DFPL']==$datkey) {
|
|
$daftar[$nodaf++] = $keydat;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} else {
|
|
$daftar = $datDfpl;
|
|
}
|
|
|
|
$datSmpl[$nosmpl++] += ['DAFTAR' => $daftar];
|
|
}
|
|
|
|
$datPricelist[$no++] += ['SMPL' => $datSmpl];
|
|
}
|
|
|
|
$data = [
|
|
'jumlah_kolom' => count($pilih_tabel),
|
|
'nama_tabel' => $pilih_tabel,
|
|
'hasil' => $datPricelist,
|
|
'ts' => $timestamp,
|
|
];
|
|
$this->load->view('cetak/SP_Excel_Sub2_DataPembukuanPricelist', $data);
|
|
}
|
|
|
|
public function SP_Excel_Sub2_DataAnalisaTargetBeli() {
|
|
$awal = $this->input->post('tgl_awalfill');
|
|
$akhir = $this->input->post('tgl_akhirfill');
|
|
$id_supplier = $this->input->post('id_supplierfill');
|
|
$id_corp = $this->input->post('id_corpfill');
|
|
$id_ssp = $this->input->post('id_sspfill');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
if ($id_ssp == "") {
|
|
$id_merk = NULL;
|
|
$id_produk = NULL;
|
|
} else {
|
|
$datSsp = $this->Amod->getData_SetSalesProduk_byID($id_ssp);
|
|
$id_merk = $datSsp[0]['MERK_ID'];
|
|
$id_produk = $datSsp[0]['PRODUK_ID'];
|
|
}
|
|
|
|
$pilih_tabel = array('No', 'Nota', 'Tanggal', 'Kop', 'Supplier', 'Merk', 'Produk', 'Kode Barang', 'Nama Barang', 'Kuantiti', 'Nilai SATUAN', 'Nilai SUBTOTAL');
|
|
|
|
$data = $this->Amod->getData_DaftarBeli_byCORP_bySUPPLIER_byMERK_byPRODUK_byPERIODE_status1($id_corp, $id_supplier, $id_merk, $id_produk, $awal, $akhir);
|
|
$no = 0;
|
|
$totDpp = 0;
|
|
$totQty = 0;
|
|
foreach ($data as $key) {
|
|
$satuan = $key['HARGA_DB'];
|
|
$subtotal = $key['HARGA_DB']*$key['QTY_DB'];
|
|
$totDpp = round(($totDpp+$subtotal),2);
|
|
$kop = $this->Amod->generate_inisialCorp($key['CORP_ID']);
|
|
|
|
$data[$no] += ['KOP' => $kop];
|
|
$data[$no] += ['SATUAN' => number_format($satuan, 2)];
|
|
$data[$no++] += ['SUBTOTAL' => number_format($subtotal, 2)];
|
|
|
|
$totQty = $totQty+$key['QTY_DB'];
|
|
}
|
|
|
|
$hasil[0] = $data;
|
|
|
|
$data = [
|
|
'awal_nota' => date_format(date_create($awal), "d/m/Y"),
|
|
'akhir_nota' => date_format(date_create($akhir), "d/m/Y"),
|
|
'jumlah_kolom' => count($pilih_tabel),
|
|
'nama_tabel' => $pilih_tabel,
|
|
'hasil' => $hasil,
|
|
'ts' => $timestamp,
|
|
'totDpp' => number_format($totDpp,2),
|
|
'totQty' => $totQty,
|
|
];
|
|
$this->load->view('cetak/SP_Excel_Sub2_DataAnalisaTargetBeli', $data);
|
|
}
|
|
|
|
public function SP_Excel_Sub2_DataAnalisaTargetJual() {
|
|
$awal = $this->input->post('tgl_awalfill');
|
|
$akhir = $this->input->post('tgl_akhirfill');
|
|
$id_corp = $this->input->post('id_corpfill');
|
|
$id_ssp = $this->input->post('id_sspfill');
|
|
$id_sales = $this->input->post('id_salesfill');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
if ($id_ssp == "") {
|
|
$id_merk = NULL;
|
|
$id_produk = NULL;
|
|
} else {
|
|
$datSsp = $this->Amod->getData_SetSalesProduk_byID($id_ssp);
|
|
$id_merk = $datSsp[0]['MERK_ID'];
|
|
$id_produk = $datSsp[0]['PRODUK_ID'];
|
|
}
|
|
|
|
if ($id_corp=="") {
|
|
$id_corp = NULL;
|
|
}
|
|
|
|
if ($id_sales=="") {
|
|
$id_sales = NULL;
|
|
}
|
|
|
|
$pilih_tabel = array('No', 'Merk', 'Produk', 'Kode Barang', 'Nama Barang', 'Kuantiti', 'Nilai SUBTOTAL');
|
|
|
|
$data = $this->Amod->getData_DaftarOrder_byCORP_byMERK_byPRODUK_bySALES_byPERIODE_status1($id_corp, $id_merk, $id_produk, $id_sales, $awal, $akhir);
|
|
$no = 0;
|
|
$totDpp = 0;
|
|
$totQty = 0;
|
|
foreach ($data as $key) {
|
|
$totDpp = round(($totDpp+$key['TOTALDPP']),2);
|
|
$totQty = $totQty+$key['TOTALQTY'];
|
|
}
|
|
|
|
$hasil[0] = $data;
|
|
|
|
$data = [
|
|
'awal_nota' => date_format(date_create($awal), "d/m/Y"),
|
|
'akhir_nota' => date_format(date_create($akhir), "d/m/Y"),
|
|
'jumlah_kolom' => count($pilih_tabel),
|
|
'nama_tabel' => $pilih_tabel,
|
|
'hasil' => $hasil,
|
|
'ts' => $timestamp,
|
|
'totDpp' => number_format($totDpp,2),
|
|
'totQty' => $totQty,
|
|
];
|
|
$this->load->view('cetak/SP_Excel_Sub2_DataAnalisaTargetJual', $data);
|
|
}
|
|
|
|
public function SP_Excel_Sub2_DataAnalisaStokAging() {
|
|
$awalbeli = $this->input->post('tgl_awalbelifill');
|
|
$akhirbeli = $this->input->post('tgl_akhirbelifill');
|
|
$awaljual = $this->input->post('tgl_awaljualfill');
|
|
$akhirjual = $this->input->post('tgl_akhirjualfill');
|
|
$id_corp = $this->input->post('id_corpfill');
|
|
$id_ssp = $this->input->post('id_sspfill');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
if ($id_ssp == "") {
|
|
$id_merk = NULL;
|
|
$id_produk = NULL;
|
|
} else {
|
|
$datSsp = $this->Amod->getData_SetSalesProduk_byID($id_ssp);
|
|
$id_merk = $datSsp[0]['MERK_ID'];
|
|
$id_produk = $datSsp[0]['PRODUK_ID'];
|
|
}
|
|
|
|
$data = $this->Amod->getData_DaftarBeli_forStokAging($awalbeli, $akhirbeli, $id_corp, $id_merk, $id_produk);
|
|
$no = 0;
|
|
$totBeli = 0;
|
|
$totJual = 0;
|
|
$totSisa = 0;
|
|
$totPersediaan = 0;
|
|
foreach ($data as $key) {
|
|
$datSnb = $this->Amod->getData_SnBeli_forStokAging($awalbeli, $akhirbeli, $key['BARANG_ID'], $id_corp, $id_merk, $id_produk);
|
|
$terjual = 0;
|
|
$tersisa = 0;
|
|
foreach ($datSnb as $dat) {
|
|
$datSnStock = $this->Amod->getData_SnStock_byNAMA_allStatus($dat['NAMA_SNB']);
|
|
if ($datSnStock[0]['STATUS_SNSTOCK']==1 OR $datSnStock[0]['STATUS_SNSTOCK']==3 OR $datSnStock[0]['STATUS_SNSTOCK']==4) {
|
|
$datHsn = $this->Amod->getData_HistoriSn_bySNSTOCK_forStokAging($datSnStock[0]['ID_SNSTOCK'], $awaljual, $akhirjual);
|
|
if ($datHsn==TRUE) {
|
|
$terjual++;
|
|
} else {
|
|
$tersisa++;
|
|
}
|
|
} else {
|
|
$tersisa++;
|
|
}
|
|
}
|
|
$datHq = $this->Amod->getData_HistoriKuantiti_byBARANG_beforeTGL_orderDESC_limit1($key['BARANG_ID'], $akhirjual);
|
|
$persediaan = round(($tersisa*$datHq[0]['AVG_HQ']),2);
|
|
|
|
$data[$no] += ['PERSEDIAAN' => number_format($persediaan,2)];
|
|
$data[$no] += ['TOTALJUAL' => $terjual];
|
|
$data[$no++] += ['TOTALSISA' => $tersisa];
|
|
|
|
$totBeli = $totBeli+$key['TOTALQTY'];
|
|
$totJual = $totJual+$terjual;
|
|
$totSisa = $totSisa+$tersisa;
|
|
$totPersediaan = $totPersediaan+$persediaan;
|
|
}
|
|
|
|
$pilih_tabel = array('No', 'Merk', 'Produk', 'Kode Barang', 'Nama Barang', 'Stok Terbeli', 'Stok Terjual', 'Sisa Stok', 'Persediaan');
|
|
|
|
$hasil[0] = $data;
|
|
|
|
$data = [
|
|
'awal_beli' => date_format(date_create($awalbeli), "d/m/Y"),
|
|
'akhir_beli' => date_format(date_create($akhirbeli), "d/m/Y"),
|
|
'awal_jual' => date_format(date_create($awaljual), "d/m/Y"),
|
|
'akhir_jual' => date_format(date_create($akhirjual), "d/m/Y"),
|
|
'jumlah_kolom' => count($pilih_tabel),
|
|
'nama_tabel' => $pilih_tabel,
|
|
'hasil' => $hasil,
|
|
'ts' => $timestamp,
|
|
'totBeli' => $totBeli,
|
|
'totJual' => $totJual,
|
|
'totSisa' => $totSisa,
|
|
'totPersediaan' => number_format($totPersediaan,2),
|
|
];
|
|
$this->load->view('cetak/SP_Excel_Sub2_DataAnalisaStokAging', $data);
|
|
}
|
|
|
|
public function SP_Excel_Sub2_DataAnalisaStokTerjual() {
|
|
$awal = $this->input->post('tgl_awalfill');
|
|
$akhir = $this->input->post('tgl_akhirfill');
|
|
$id_ssp = $this->input->post('id_sspfill');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
if ($id_ssp == "") {
|
|
$id_merk = NULL;
|
|
$id_produk = NULL;
|
|
$judul = "Kosong";
|
|
} else {
|
|
$datSsp = $this->Amod->getData_SetSalesProduk_byID($id_ssp);
|
|
$id_merk = $datSsp[0]['MERK_ID'];
|
|
$id_produk = $datSsp[0]['PRODUK_ID'];
|
|
$nama_merk = $datSsp[0]['NAMA_MERK'];
|
|
$nama_produk = $datSsp[0]['NAMA_PRODUK'];
|
|
$judul = "$nama_merk | $nama_produk";
|
|
}
|
|
|
|
$hasil = [];
|
|
$datHsn = $this->Amod->getData_HistoriSn_byMERK_byPRODUK_byPERIODE_jenis1_likePJ_groupSNSTOCK_forSku($id_merk, $id_produk, $awal, $akhir);
|
|
$nohsn = 0;
|
|
foreach ($datHsn as $dat) {
|
|
$cekHsn = $this->Amod->getData_HistoriSn_bySNSTOCK_supplierNotNull_limit1($dat['SNSTOCK_ID']);
|
|
if ($cekHsn==FALSE) {
|
|
$nama_supplier = NULL;
|
|
$inv_pembelian = NULL;
|
|
$tgl_beli = NULL;
|
|
} else {
|
|
$nama_supplier = $cekHsn[0]['NAMA_SUPPLIER'];
|
|
$inv_pembelian = $cekHsn[0]['INV_PEMBELIAN'];
|
|
$tgl_beli = $cekHsn[0]['TANGGAL'];
|
|
}
|
|
$datHsn[$nohsn] += ['TGL_BELI' => $tgl_beli];
|
|
$datHsn[$nohsn] += ['NAMA_SUPPLIER' => $nama_supplier];
|
|
$datHsn[$nohsn++] += ['INV_PEMBELIAN' => $inv_pembelian];
|
|
}
|
|
$hasil[0] = ['ISI' => $datHsn];
|
|
$pilih_tabel = array('No', 'Kode Barang', 'Nama Barang', 'Serial Number', 'Supplier', 'Nota Pembelian', 'Tanggal Beli', 'Nama Pelanggan', 'Alamat Pelanggan', 'Nota Penjualan', 'Tanggal Jual');
|
|
|
|
$data = [
|
|
'awal_nota' => date_format(date_create($awal), "d/m/Y"),
|
|
'akhir_nota' => date_format(date_create($akhir), "d/m/Y"),
|
|
'jumlah_kolom' => count($pilih_tabel),
|
|
'nama_tabel' => $pilih_tabel,
|
|
'hasil' => $hasil,
|
|
'ts' => $timestamp,
|
|
'judul' => $judul,
|
|
];
|
|
$this->load->view('cetak/SP_Excel_Sub2_DataAnalisaStokTerjual', $data);
|
|
}
|
|
|
|
// Daftar Menu SV [Service]
|
|
//SUBMENU TRANSAKSI - STOK INTERNAL
|
|
public function SV_Sub1_StokInternal_1() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "SV", "TRANSAKSI - Stok Internal");
|
|
$id_menu = $datShm[0]['MENU_ID'];
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$datStpos = $this->Amod->getData_SetTogglePosisi_byKARYAWAN_byMENU($id_karyawan, $id_menu);
|
|
if ($datStpos==FALSE) { $posisiToggle = 0; } else { $posisiToggle = $datStpos[0]['AKTIF_STPOS']; }
|
|
|
|
$serviceTunggu = $this->Amod->getData_Service_bySTATUS_jenisNot0(1);
|
|
$no = 0;
|
|
foreach ($serviceTunggu as $key) {
|
|
$datDfsPro = $this->Amod->getData_DaftarService_bySERVICE($key['ID_SERVICE']);
|
|
$nose = 0;
|
|
$sn = "";
|
|
foreach ($datDfsPro as $dat) {
|
|
$datSns = $this->Amod->getData_SnService_byDFS($dat['ID_DFS']);
|
|
foreach ($datSns as $dat) {
|
|
$nama_sns = $dat['NAMA_SNS'];
|
|
$sn .= "$nama_sns, ";
|
|
}
|
|
$datDfsPro[$nose++] += ['SN' => $sn];
|
|
$sn = "";
|
|
}
|
|
$serviceTunggu[$no++] += ['BARANG' => $datDfsPro];
|
|
}
|
|
|
|
$snServiceSelesai = $this->Amod->getData_SnService_byJENIS_selesaiNotNull_psvNull();
|
|
$nonsnServiceSelesai = $this->Amod->getData_NonSnService_byJENIS_groupBARANG_havingMore0();
|
|
|
|
$data = array(
|
|
'sidebar' => "menu service",
|
|
'navChild' => "service stokinternal",
|
|
'id_menu' => $id_menu,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil,
|
|
'serviceTunggu' => $serviceTunggu,
|
|
'snServiceSelesai' => $snServiceSelesai,
|
|
'nonsnServiceSelesai' => $nonsnServiceSelesai,
|
|
'countTunggu' => count($serviceTunggu),
|
|
'countSnSelesai' => count($snServiceSelesai),
|
|
'countNonSnSelesai' => count($nonsnServiceSelesai),
|
|
'posisiToggle' => $posisiToggle,
|
|
);
|
|
$this->load->view('proses/SV_Sub1_StokInternal_1', $data);
|
|
}
|
|
|
|
public function SV_Terima_Sub1_A1_DataServiceInternal() {
|
|
$id_service = $this->input->post('id_serviceter');
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
$now = date('Y-m-d');
|
|
|
|
$datService = $this->Amod->getData_Service_byID_bySTATUS($id_service, 1);
|
|
if ($datService==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$datDfs = $this->Amod->getData_DaftarService_bySERVICE($id_service);
|
|
foreach ($datDfs as $key) {
|
|
if ($key['TYPE_JENIS']==0) {
|
|
$input = [
|
|
'JENIS_NONSNS' => $key['JENIS_SERVICE'],
|
|
'TGL_NONSNS' => $now,
|
|
'KODE_BUKTI' => $key['KODE_SERVICE'],
|
|
'BARANG_ID' => $key['BARANG_ID'],
|
|
'MASUK_NONSNS' => $key['QTY_DFS'],
|
|
'KELUAR_NONSNS' => '0',
|
|
'TERIMA_NONSNS' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->create('nonsn_service', $input);
|
|
}
|
|
}
|
|
|
|
$update = [
|
|
'TERIMA_SERVICE' => "Oleh $panggilan pada $timestamp",
|
|
'STATUS_SERVICE' => '2'
|
|
];
|
|
$action = $this->Amod->update('service', $update, 'ID_SERVICE', $id_service);
|
|
|
|
if ($action) {
|
|
$this->session->set_flashdata('success', 'diterima');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
} else {
|
|
$this->session->set_flashdata('failed', 'diterima');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
}
|
|
|
|
//SUBMENU TRANSAKSI - TERIMA SERVICE
|
|
public function SV_Sub1_TerimaService_1() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "SV", "TRANSAKSI - Terima Service");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$now = date('Y-m-d');
|
|
$limit = $this->Amod->generate_subDay($now, 3);
|
|
$datService = $this->Amod->getData_Service_byJENIS_bySTATUS_byTGL(0, 1, $limit);
|
|
$datBs = $this->Amod->getData_BiayaService();
|
|
|
|
$data = array(
|
|
'sidebar' => "menu service",
|
|
'navChild' => "service terimaservice",
|
|
'service' => $datService,
|
|
'biaya_service' => $datBs,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil,
|
|
);
|
|
$this->load->view('proses/SV_Sub1_TerimaService_1', $data);
|
|
}
|
|
|
|
public function SV_Ambil_Sub1_B1_DataService() {
|
|
$id_service = $this->input->post('id_service');
|
|
$now = date('Y-m-d');
|
|
$limit = $this->Amod->generate_subDay($now, 3);
|
|
|
|
$datService = $this->Amod->getData_Service_byJENIS_bySTATUS_byTGL(0, 1, $limit, $id_service);
|
|
|
|
$this->output_json([
|
|
'id_sns' => $datService[0]['ID_SNS'],
|
|
'nama_sns' => $datService[0]['NAMA_SNS'],
|
|
'kel_sns' => $datService[0]['KEL_SNS'],
|
|
'part_sns' => $datService[0]['PART_SNS'],
|
|
'garansi_sns' => $datService[0]['GARANSI_SNS'],
|
|
'telp_service' => $datService[0]['TELP_SERVICE'],
|
|
'paket_service' => $datService[0]['PAKET_SERVICE'],
|
|
'id_pelanggan' => $datService[0]['PELANGGAN_ID'],
|
|
'nama_pelanggan' => $datService[0]['NAMA_PELANGGAN'],
|
|
'id_unitservice' => $datService[0]['UNITSERVICE_ID'],
|
|
'nama_unitservice' => $datService[0]['NAMA_UNITSERVICE'],
|
|
]);
|
|
}
|
|
|
|
public function SV_Tambah_Sub1_B1_DataServiceEksternal() {
|
|
$id_pelanggan = $this->input->post('id_pelanggan');
|
|
$id_unitservice = $this->input->post('id_unitservice');
|
|
$garansi_sns = $this->input->post('garansi_sns');
|
|
$paket_service = $this->input->post('paket_service');
|
|
$nama_sns = $this->input->post('nama_sns');
|
|
$kel_sns = $this->input->post('kel_sns');
|
|
$part_sns = $this->input->post('part_sns');
|
|
$telp_service = $this->input->post('telp_service');
|
|
$nama_sns = strtoupper(ltrim(rtrim(preg_replace('/\R+/', " " , $nama_sns))));
|
|
$kel_sns = strtoupper(ltrim(rtrim(preg_replace('/\R+/', " " , $kel_sns))));
|
|
$part_sns = strtoupper(ltrim(rtrim(preg_replace('/\R+/', " " , $part_sns))));
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
$now = date('Y-m-d');
|
|
|
|
$value = 0;
|
|
$datPelanggan = $this->Amod->getData_Pelanggan_byID_bySTATUS($id_pelanggan, 1);
|
|
if ($datPelanggan==FALSE) {
|
|
$value = 4;
|
|
} else {
|
|
$datUnitService = $this->Amod->getData_UnitService_byID_bySTATUS($id_unitservice, 1);
|
|
if ($datUnitService==FALSE) {
|
|
$value = 3;
|
|
} else {
|
|
$datService = $this->Amod->getData_Service_byCIPTA("Oleh $panggilan pada $timestamp");
|
|
if ($datService==TRUE) {
|
|
$value = 2;
|
|
} else {
|
|
$kode_service = $this->Amod->generate_kodeService();
|
|
$input = [
|
|
'CIPTA_SERVICE' => "Oleh $panggilan pada $timestamp",
|
|
'KODE_SERVICE' => $kode_service,
|
|
'TGL_SERVICE' => $now,
|
|
'JENIS_SERVICE' => '0',
|
|
'PAKET_SERVICE' => $paket_service,
|
|
'PEMBUAT_ID' => $id_karyawan,
|
|
'PELANGGAN_ID' => $id_pelanggan,
|
|
'TELP_SERVICE' => $telp_service,
|
|
'TERIMA_SERVICE' => "Oleh $panggilan pada $timestamp",
|
|
'STATUS_SERVICE' => '1'
|
|
];
|
|
$action = $this->Amod->create('service', $input);
|
|
|
|
$id_service = $this->Amod->getMax_ID_Service();
|
|
$id_service = $id_service[0]['ID_SERVICE'];
|
|
|
|
$input = [
|
|
'SERVICE_ID' => $id_service,
|
|
'UNITSERVICE_ID' => $id_unitservice,
|
|
'NAMA_SNS' => $nama_sns,
|
|
'KEL_SNS' => $kel_sns,
|
|
'PART_SNS' => $part_sns,
|
|
'GARANSI_SNS' => $garansi_sns
|
|
];
|
|
$action = $this->Amod->create('sn_service', $input);
|
|
$value = 1;
|
|
|
|
$id_sns = $this->Amod->getMax_ID_SnService();
|
|
$id_sns = $id_sns[0]['ID_SNS'];
|
|
}
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
'id_sns' => $id_sns,
|
|
]);
|
|
}
|
|
|
|
public function SV_Ubah_Sub1_B1_DataServiceEksternal() {
|
|
$id_service = $this->input->post('id_service');
|
|
$id_pelanggan = $this->input->post('id_pelanggan');
|
|
$id_unitservice = $this->input->post('id_unitservice');
|
|
$garansi_sns = $this->input->post('garansi_sns');
|
|
$paket_service = $this->input->post('paket_service');
|
|
$nama_sns = $this->input->post('nama_sns');
|
|
$kel_sns = $this->input->post('kel_sns');
|
|
$part_sns = $this->input->post('part_sns');
|
|
$telp_service = $this->input->post('telp_service');
|
|
$menu = $this->input->post('menu');
|
|
$nama_sns = strtoupper(ltrim(rtrim(preg_replace('/\R+/', " " , $nama_sns))));
|
|
$kel_sns = strtoupper(ltrim(rtrim(preg_replace('/\R+/', " " , $kel_sns))));
|
|
$part_sns = strtoupper(ltrim(rtrim(preg_replace('/\R+/', " " , $part_sns))));
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
$now = date('Y-m-d');
|
|
$limit = $this->Amod->generate_subDay($now, 3);
|
|
|
|
$value = 0;
|
|
$telp = 0;
|
|
$datService = $this->Amod->getData_Service_byJENIS_bySTATUS_byTGL(0, 1, $limit, $id_service);
|
|
if ($datService==FALSE) {
|
|
$value = 2;
|
|
} else {
|
|
if ($menu==1) {
|
|
if ($id_pelanggan!=$datService[0]['PELANGGAN_ID']) {
|
|
$datPelanggan = $this->Amod->getData_Pelanggan_byID($id_pelanggan);
|
|
$telp_pelanggan = $datPelanggan[0]['TELP_PELANGGAN'];
|
|
|
|
$update = [
|
|
'PELANGGAN_ID' => $id_pelanggan,
|
|
'TELP_SERVICE' => $telp_pelanggan
|
|
];
|
|
$action = $this->Amod->update('service', $update, 'ID_SERVICE', $id_service);
|
|
|
|
$telp = 1;
|
|
}
|
|
} else if ($menu==2) {
|
|
$update = [
|
|
'NAMA_SNS' => $nama_sns
|
|
];
|
|
$action = $this->Amod->update('sn_service', $update, 'ID_SNS', $datService[0]['ID_SNS']);
|
|
} else if ($menu==3) {
|
|
if ($id_unitservice!=$datService[0]['UNITSERVICE_ID']) {
|
|
$update = [
|
|
'UNITSERVICE_ID' => $id_unitservice
|
|
];
|
|
$action = $this->Amod->update('sn_service', $update, 'ID_SNS', $datService[0]['ID_SNS']);
|
|
}
|
|
} else if ($menu==4) {
|
|
$update = [
|
|
'GARANSI_SNS' => $garansi_sns
|
|
];
|
|
$action = $this->Amod->update('sn_service', $update, 'ID_SNS', $datService[0]['ID_SNS']);
|
|
} else if ($menu==5) {
|
|
$update = [
|
|
'KEL_SNS' => $kel_sns
|
|
];
|
|
$action = $this->Amod->update('sn_service', $update, 'ID_SNS', $datService[0]['ID_SNS']);
|
|
} else if ($menu==6) {
|
|
$update = [
|
|
'PART_SNS' => $part_sns
|
|
];
|
|
$action = $this->Amod->update('sn_service', $update, 'ID_SNS', $datService[0]['ID_SNS']);
|
|
} else if ($menu==7) {
|
|
$update = [
|
|
'TELP_SERVICE' => $telp_service
|
|
];
|
|
$action = $this->Amod->update('service', $update, 'ID_SERVICE', $id_service);
|
|
} else if ($menu==8) {
|
|
$update = [
|
|
'PAKET_SERVICE' => $paket_service
|
|
];
|
|
$action = $this->Amod->update('service', $update, 'ID_SERVICE', $id_service);
|
|
}
|
|
|
|
if ($id_pelanggan==$datService[0]['PELANGGAN_ID'] AND $menu==1) {
|
|
$value = 4;
|
|
} else if ($id_unitservice==$datService[0]['UNITSERVICE_ID'] AND $menu==3) {
|
|
$value = 4;
|
|
} else {
|
|
$value = 1;
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
'telp' => $telp,
|
|
]);
|
|
}
|
|
|
|
public function SV_Batal_Sub1_B1_DataServiceEksternal() {
|
|
$id_service = $this->input->post('id_servicevoid');
|
|
$ket_batal = $this->input->post('ket_batalvoid');
|
|
$ket_batal = strtoupper(ltrim(rtrim(preg_replace('/\R+/', " " , $ket_batal))));
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$datService = $this->Amod->getData_Service_byID_bySTATUS($id_service, 1);
|
|
if ($datService==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$datSns = $this->Amod->getData_SnService_bySERVICE($id_service);
|
|
$update = [
|
|
'STATUS_SNS' => '9'
|
|
];
|
|
$action = $this->Amod->update('sn_service', $update, 'ID_SNS', $datSns[0]['ID_SNS']);
|
|
|
|
$update = [
|
|
'STATUS_SERVICE' => '9',
|
|
'KET_BATAL' => $ket_batal,
|
|
'BATAL_SERVICE' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('service', $update, 'ID_SERVICE', $id_service);
|
|
|
|
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 SV_Cetak_Sub1_B1_DataTandaTerimaService($id_sns) {
|
|
$datSns = $this->Amod->getData_SnService_byID($id_sns);
|
|
$datBs = $this->Amod->getData_BiayaService($datSns[0]['PAKET_SERVICE']);
|
|
|
|
$serFull = $datBs[0]['HARGA_BS'];
|
|
$serHalf = ($datBs[0]['HARGA_BS']/2);
|
|
$serFull = number_format($serFull,0);
|
|
$serHalf = number_format($serHalf,0);
|
|
$serFull = str_replace(',', '.', $serFull);
|
|
$serHalf = str_replace(',', '.', $serHalf);
|
|
|
|
$no = 0;
|
|
foreach ($datSns as $key) {
|
|
if ($key['GARANSI_SNS']==1) {
|
|
$status = "Garansi Barang";
|
|
} else if ($key['GARANSI_SNS']==2) {
|
|
$status = "Garansi Service";
|
|
} else if ($key['GARANSI_SNS']==3) {
|
|
$status = "Tidak Garansi";
|
|
}
|
|
$datSns[$no++] += ['STATUS' => $status];
|
|
}
|
|
|
|
$id_bs = $datBs[0]['ID_BS'];
|
|
if ($id_bs==0) {
|
|
$nama_bs = "-";
|
|
$jangka = "1. Proses Cek <i><b>2-3</b></i> Hari Kerja. Akan segera diinformasikan setelah muncul Hasil Analisa";
|
|
$masa = "3. <i><b>Tidak ada Garansi tambahan setelah proses Pengerjaan.</b></i>";
|
|
} else {
|
|
$nama_bs = $datBs[0]['NAMA_BS'];
|
|
if ($datBs[0]['JENIS_BS']==1) {
|
|
$jangka = "1. Proses Cek <i><b>2 Hari</b></i> Kerja. Akan segera diinformasikan setelah muncul Hasil Analisa";
|
|
$masa = "3. Garansi Service berlaku <i><b>7 Hari</b></i> sejak Barang diambil dengan <i><b>Kerusakan yang Sama</b></i>.";
|
|
} else if ($datBs[0]['JENIS_BS']==2) {
|
|
$jangka = "1. Proses Cek <i><b>1 Hari</b></i> Kerja. Akan segera diinformasikan setelah muncul Hasil Analisa";
|
|
$masa = "3. Garansi Service berlaku <i><b>30 Hari</b></i> sejak Barang diambil dengan <i><b>Kerusakan yang Berbeda</b></i>.";
|
|
} else if ($datBs[0]['JENIS_BS']==3) {
|
|
$jangka = "1. <i><b>Tidak ada Proses Pengecekan</b></i> untuk Paket Jasa ini.";
|
|
$masa = "3. <i><b>Tidak ada Garansi untuk Paket Jasa ini.</b></i>";
|
|
}
|
|
}
|
|
|
|
$data = [
|
|
'service' => $datSns,
|
|
'serFull' => $serFull,
|
|
'serHalf' => $serHalf,
|
|
'id_bs' => $id_bs,
|
|
'nama_bs' => $nama_bs,
|
|
'jangka' => $jangka,
|
|
'masa' => $masa,
|
|
];
|
|
$this->load->view('cetak/SJ_Service', $data);
|
|
}
|
|
|
|
//SUBMENU TRANSAKSI - PENGERJAAN
|
|
public function SV_Sub1_Pengerjaan_1() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "SV", "TRANSAKSI - Pengerjaan");
|
|
$id_menu = $datShm[0]['MENU_ID'];
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$datSns = $this->Amod->getData_SnService_statusNull_selesaiNull();
|
|
$serviceBelum = [];
|
|
$serviceProses = [];
|
|
$serviceAkhir = [];
|
|
$noBelum = 0;
|
|
$noProses = 0;
|
|
$noAkhir = 0;
|
|
$countBelum = 0;
|
|
$countProses = 0;
|
|
$countAkhir = 0;
|
|
foreach ($datSns as $key) {
|
|
if ($key['PELANGGAN_ID']==NULL) {
|
|
$in = 1;
|
|
$nama = $key['CIPTA_SERVICE'];
|
|
$model = $key['NAMA_BARANG'];
|
|
} else {
|
|
$in = 0;
|
|
$nama = $key['NAMA_PELANGGAN'];
|
|
$model = $key['NAMA_UNITSERVICE'];
|
|
}
|
|
if ($key['GARANSI_SNS']==1) {
|
|
$status = "Garansi Barang";
|
|
} else if ($key['GARANSI_SNS']==2) {
|
|
$status = "Garansi Service";
|
|
} else if ($key['GARANSI_SNS']==3) {
|
|
$status = "Tidak Garansi";
|
|
}
|
|
$datHsv = $this->Amod->getData_HistoriService_bySNS_orderDESC_limit1($key['ID_SNS']);
|
|
if ($datHsv==FALSE) {
|
|
$serviceBelum[$noBelum++] = [
|
|
'ID' => $key['ID_SNS'],
|
|
'KODE' => $key['KODE_SERVICE'],
|
|
'TGL' => $key['TGL_SERVICE'],
|
|
'TANGGAL' => $key['CIPTA_SERVICE'],
|
|
'BS' => $key['NAMA_BS'],
|
|
'IN' => $in,
|
|
'NAMA' => $nama,
|
|
'TELP' => $key['TELP_SERVICE'],
|
|
'STATUS' => $status,
|
|
'MODEL' => $model,
|
|
'SN' => $key['NAMA_SNS'],
|
|
'KELUHAN' => $key['KEL_SNS'],
|
|
'KETERANGAN' => $key['PART_SNS'],
|
|
'INFO' => "Unit Diterima",
|
|
'TIMESTAMP' => "-"
|
|
];
|
|
$countBelum++;
|
|
} else {
|
|
$status_hsv = $datHsv[0]['STATUS_HSV'];
|
|
$nama_hsv = $datHsv[0]['NAMA_PANGGILAN_KARYAWAN'];
|
|
$ts = $datHsv[0]['TIMESTAMP'];
|
|
$timestamp = "Oleh $nama_hsv pada $ts";
|
|
if ($status_hsv==1) {
|
|
$info = "Selesai Service";
|
|
} else if ($status_hsv==2) {
|
|
$info = "Proses Cek Unit";
|
|
} else if ($status_hsv==3) {
|
|
$info = "Klaim Garansi";
|
|
} else if ($status_hsv==4) {
|
|
$info = "Order Sparepart";
|
|
} else if ($status_hsv==5) {
|
|
$info = "Penawaran";
|
|
} else if ($status_hsv==6) {
|
|
$info = "Extend Warranty";
|
|
} else if ($status_hsv==7) {
|
|
$info = "Gagal Service";
|
|
} else if ($status_hsv==8) {
|
|
$info = "Dibatalkan User";
|
|
}
|
|
if ($datHsv[0]['STATUS_HSV']==1 OR $datHsv[0]['STATUS_HSV']==7 OR $datHsv[0]['STATUS_HSV']==8) {
|
|
$serviceAkhir[$noAkhir++] = [
|
|
'ID' => $key['ID_SNS'],
|
|
'KODE' => $key['KODE_SERVICE'],
|
|
'TGL' => $key['TGL_SERVICE'],
|
|
'TANGGAL' => $key['CIPTA_SERVICE'],
|
|
'BS' => $key['NAMA_BS'],
|
|
'IN' => $in,
|
|
'NAMA' => $nama,
|
|
'TELP' => $key['TELP_SERVICE'],
|
|
'STATUS' => $status,
|
|
'MODEL' => $model,
|
|
'SN' => $key['NAMA_SNS'],
|
|
'KELUHAN' => $key['KEL_SNS'],
|
|
'KETERANGAN' => $key['PART_SNS'],
|
|
'INFO' => $info,
|
|
'TIMESTAMP' => $timestamp
|
|
];
|
|
$countAkhir++;
|
|
} else {
|
|
$serviceProses[$noProses++] = [
|
|
'ID' => $key['ID_SNS'],
|
|
'KODE' => $key['KODE_SERVICE'],
|
|
'TGL' => $key['TGL_SERVICE'],
|
|
'TANGGAL' => $key['CIPTA_SERVICE'],
|
|
'BS' => $key['NAMA_BS'],
|
|
'IN' => $in,
|
|
'NAMA' => $nama,
|
|
'TELP' => $key['TELP_SERVICE'],
|
|
'STATUS' => $status,
|
|
'MODEL' => $model,
|
|
'SN' => $key['NAMA_SNS'],
|
|
'KELUHAN' => $key['KEL_SNS'],
|
|
'KETERANGAN' => $key['PART_SNS'],
|
|
'INFO' => $info,
|
|
'TIMESTAMP' => $timestamp
|
|
];
|
|
$countProses++;
|
|
}
|
|
}
|
|
}
|
|
|
|
$datStpos = $this->Amod->getData_SetTogglePosisi_byKARYAWAN_byMENU($id_karyawan, $id_menu);
|
|
if ($datStpos==FALSE) { $posisiToggle = 0; } else { $posisiToggle = $datStpos[0]['AKTIF_STPOS']; }
|
|
|
|
$data = array(
|
|
'sidebar' => "menu service",
|
|
'navChild' => "service pengerjaan",
|
|
'id_menu' => $id_menu,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil,
|
|
'posisiToggle' => $posisiToggle,
|
|
'serviceBelum' => $serviceBelum,
|
|
'serviceProses' => $serviceProses,
|
|
'serviceAkhir' => $serviceAkhir,
|
|
'countBelum' => $countBelum,
|
|
'countProses' => $countProses,
|
|
'countAkhir' => $countAkhir,
|
|
);
|
|
$this->load->view('proses/SV_Sub1_Pengerjaan_1', $data);
|
|
}
|
|
|
|
public function SV_Ambil_Sub1_C1_DataSnService() {
|
|
$versi = $this->input->post('versi');
|
|
|
|
if ($versi==1 OR $versi==2) {
|
|
$data = $this->Amod->getData_SnService_statusNull_externalOnly();
|
|
} else if ($versi==3) {
|
|
$data = $this->Amod->getData_SnService_statusNull_internalOnly();
|
|
} else if ($versi==4) {
|
|
$data = $this->Amod->getData_SnService_status1_externalOnly();
|
|
}
|
|
|
|
$this->output_json([
|
|
'data' => $data
|
|
]);
|
|
}
|
|
|
|
public function SV_Ambil_Sub1_C1_DataHistoriService() {
|
|
$id_sns = $this->input->post('id_sns');
|
|
|
|
$datSns = $this->Amod->getData_SnService_byID($id_sns);
|
|
$data = $this->Amod->getData_HistoriService_bySNS_orderASC($id_sns);
|
|
|
|
$datHsv = $this->Amod->getData_HistoriService_bySNS_orderDESC_limit1($id_sns);
|
|
if ($datHsv==FALSE) {
|
|
$value = 1;
|
|
} else {
|
|
if ($datHsv[0]['STATUS_HSV']==1 OR $datHsv[0]['STATUS_HSV']==7 OR $datHsv[0]['STATUS_HSV']==8) {
|
|
$value = 3;
|
|
} else {
|
|
$value = 2;
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
'total' => sizeof($data),
|
|
'data' => $data,
|
|
'nama_sns' => $datSns[0]['NAMA_SNS'],
|
|
]);
|
|
}
|
|
|
|
public function SV_Tambah_Sub1_C1_DataHistoriService() {
|
|
$id_sns = $this->input->post('id_sns');
|
|
$status_hsv = $this->input->post('status_hsv');
|
|
$ket_hsv = $this->input->post('ket_hsv');
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
$ket_hsv = preg_replace('/\R+/', " " , $ket_hsv);
|
|
|
|
$value = 0;
|
|
$datSns = $this->Amod->getData_SnService_byID($id_sns);
|
|
if ($datSns==FALSE) {
|
|
$value = 2;
|
|
} else {
|
|
$input = [
|
|
'SNS_ID' => $id_sns,
|
|
'TEKNISI_ID' => $id_karyawan,
|
|
'KET_HSV' => $ket_hsv,
|
|
'STATUS_HSV' => $status_hsv,
|
|
'TIMESTAMP' => $timestamp
|
|
];
|
|
$action = $this->Amod->create('histori_service', $input);
|
|
|
|
$value = 1;
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value
|
|
]);
|
|
}
|
|
|
|
public function SV_Ubah_Sub1_C1_DataHistoriService() {
|
|
$id_sns = $this->input->post('id_sns');
|
|
$id_hsv = $this->input->post('id_hsv');
|
|
$status_hsv = $this->input->post('status_hsv');
|
|
$ket_hsv = $this->input->post('ket_hsv');
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
$ket_hsv = ltrim(rtrim(preg_replace('/\R+/', " " , $ket_hsv)));
|
|
|
|
$value = 0;
|
|
$datSns = $this->Amod->getData_SnService_byID($id_sns);
|
|
if ($datSns==FALSE) {
|
|
$value = 3;
|
|
} else {
|
|
$datHsv = $this->Amod->getData_HistoriService_byID($id_hsv);
|
|
if ($datHsv==FALSE) {
|
|
$value = 2;
|
|
} else {
|
|
$update = [
|
|
'KET_HSV' => $ket_hsv,
|
|
'STATUS_HSV' => $status_hsv,
|
|
'TIMESTAMP' => $timestamp
|
|
];
|
|
$action = $this->Amod->update('histori_service', $update, 'ID_HSV', $id_hsv);
|
|
|
|
$value = 1;
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value
|
|
]);
|
|
}
|
|
|
|
public function SV_Hapus_Sub1_C1_DataHistoriService() {
|
|
$id_sns = $this->input->post('id_sns');
|
|
$id_hsv = $this->input->post('id_hsv');
|
|
|
|
$value = 0;
|
|
$datSns = $this->Amod->getData_SnService_byID($id_sns);
|
|
if ($datSns==FALSE) {
|
|
$value = 3;
|
|
} else {
|
|
$datHsv = $this->Amod->getData_HistoriService_byID($id_hsv);
|
|
if ($datHsv==FALSE) {
|
|
$value = 2;
|
|
} else {
|
|
$action = $this->Amod->delete('histori_service', $id_hsv, 'ID_HSV');
|
|
|
|
$value = 1;
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value
|
|
]);
|
|
}
|
|
|
|
public function SV_Proses_Sub1_C1_DataService() {
|
|
$jenis_transaksi = $this->input->post('jenis_transaksipro');
|
|
$id_sns = $this->input->post('id_snspro');
|
|
$ket_batal = $this->input->post('ket_batalpro');
|
|
$ket_batal = strtoupper(ltrim(rtrim(preg_replace('/\R+/', " " , $ket_batal))));
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
foreach ($id_sns as $key) {
|
|
$datSns = $this->Amod->getData_SnService_byID_statusNull($key);
|
|
if ($datSns==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
}
|
|
|
|
foreach ($id_sns as $key) {
|
|
if ($jenis_transaksi==1) {
|
|
$update = [
|
|
'STATUS_SNS' => '9'
|
|
];
|
|
$action = $this->Amod->update('sn_service', $update, 'ID_SNS', $key);
|
|
|
|
$datSns = $this->Amod->getData_SnService_byID($key);
|
|
$update = [
|
|
'KET_BATAL' => $ket_batal,
|
|
'STATUS_SERVICE' => '9',
|
|
'BATAL_SERVICE' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('service', $update, 'ID_SERVICE', $datSns[0]['SERVICE_ID']);
|
|
} else if ($jenis_transaksi==2) {
|
|
$update = [
|
|
'STATUS_SNS' => '1',
|
|
'SELESAI_SNS' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('sn_service', $update, 'ID_SNS', $key);
|
|
} else if ($jenis_transaksi==3) {
|
|
$update = [
|
|
'SELESAI_SNS' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('sn_service', $update, 'ID_SNS', $key);
|
|
} else if ($jenis_transaksi==4) {
|
|
$update = [
|
|
'STATUS_SNS' => NULL,
|
|
'SELESAI_SNS' => NULL
|
|
];
|
|
$action = $this->Amod->update('sn_service', $update, 'ID_SNS', $key);
|
|
|
|
$input = [
|
|
'SNS_ID' => $key,
|
|
'TEKNISI_ID' => $id_karyawan,
|
|
'KET_HSV' => $ket_batal,
|
|
'STATUS_HSV' => '2',
|
|
'TIMESTAMP' => $timestamp
|
|
];
|
|
$action = $this->Amod->create('histori_service', $input);
|
|
}
|
|
}
|
|
|
|
if ($action) {
|
|
$this->session->set_flashdata('success', 'diproses');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
} else {
|
|
$this->session->set_flashdata('failed', 'diproses');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
}
|
|
|
|
//SUBMENU ADMINISTRASI - SJ SERVICE
|
|
public function SV_Sub2_SjService_1() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$now = date('Y-m-d');
|
|
$limit = date('Y-m-01');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "SV", "ADMINISTRASI - SJ Service");
|
|
$id_menu = $datShm[0]['MENU_ID'];
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$datSjs = $this->Amod->getData_SjService_byKARYAWAN_bySTATUS($id_karyawan, 0);
|
|
if ($datSjs==FALSE) {
|
|
$id_sjs = 0;
|
|
$datDfsjs = NULL;
|
|
} else {
|
|
$id_sjs = $datSjs[0]['ID_SJS'];
|
|
$datDfsjs = $this->Amod->getData_DaftarSjService_bySJS($id_sjs);
|
|
}
|
|
|
|
if ($hak>=3) {
|
|
$awal = $this->Amod->generate_subMonth($limit, 6);
|
|
$ket = "6 Bulan Kebelakang";
|
|
$datSjsList = $this->Amod->getData_SjService_bySTATUS_byPERIODE_orderDESC(1, $awal, $now);
|
|
$datSjsVoid = $this->Amod->getData_SjService_bySTATUS_byPERIODE_orderDESC(2, $awal, $now);
|
|
} else {
|
|
$awal = $this->Amod->generate_subMonth($limit, 3);
|
|
$ket = "3 Bulan Kebelakang";
|
|
$datSjsList = $this->Amod->getData_SjService_byKARYAWAN_bySTATUS_byPERIODE_orderDESC($id_karyawan, 1, $awal, $now);
|
|
$datSjsVoid = $this->Amod->getData_SjService_byKARYAWAN_bySTATUS_byPERIODE_orderDESC($id_karyawan, 2, $awal, $now);
|
|
}
|
|
|
|
$datStpos = $this->Amod->getData_SetTogglePosisi_byKARYAWAN_byMENU($id_karyawan, $id_menu);
|
|
if ($datStpos==FALSE) { $posisiToggle = 0; } else { $posisiToggle = $datStpos[0]['AKTIF_STPOS']; }
|
|
|
|
$data = array(
|
|
'sidebar' => "menu service",
|
|
'navChild' => "service sjservice",
|
|
'tgl' => $now,
|
|
'dfsjs' => $datDfsjs,
|
|
'sjs' => $datSjsList,
|
|
'void' => $datSjsVoid,
|
|
'sjs_id' => $id_sjs,
|
|
'countSjs' => count($datSjsList),
|
|
'countVoid' => count($datSjsVoid),
|
|
'posisiToggle' => $posisiToggle,
|
|
'id_menu' => $id_menu,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil,
|
|
'ket' => $ket,
|
|
);
|
|
$this->load->view('proses/SV_Sub2_SjService_1', $data);
|
|
}
|
|
|
|
public function SV_Ambil_Sub2_A1_DataDaftarSjService() {
|
|
$id_sjs = $this->input->post('id_sjs');
|
|
$verse = $this->input->post('verse');
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
|
|
if ($verse==1) {
|
|
$datSjs = $this->Amod->getData_SjService_byKARYAWAN_bySTATUS($id_karyawan, 0);
|
|
if ($datSjs==TRUE) {
|
|
$id_sjs = $datSjs[0]['ID_SJS'];
|
|
} else {
|
|
$id_sjs = NULL;
|
|
}
|
|
}
|
|
|
|
if ($id_sjs==NULL) {
|
|
$datSjs = NULL;
|
|
$id_pelanggan = "";
|
|
$nama_pelanggan = "";
|
|
$ket_sjs = "";
|
|
$tgl_sjs = date('Y-m-d');
|
|
} else {
|
|
$datSjs = $this->Amod->getData_SjService_byID($id_sjs);
|
|
$nama_pelanggan = $datSjs[0]['NAMA_PELANGGAN'];
|
|
$id_pelanggan = $datSjs[0]['PELANGGAN_ID'];
|
|
$ket_sjs = $datSjs[0]['KET_SJS'];
|
|
$tgl_sjs = $datSjs[0]['TGL_SJS'];
|
|
}
|
|
|
|
$data = $this->Amod->getData_DaftarSjService_bySJS($id_sjs);
|
|
|
|
$this->output_json([
|
|
'total' => sizeof($data),
|
|
'data' => $data,
|
|
'id_pelanggan' => $id_pelanggan,
|
|
'nama_pelanggan' => $nama_pelanggan,
|
|
'ket_sjs' => $ket_sjs,
|
|
'tgl_sjs' => $tgl_sjs,
|
|
]);
|
|
}
|
|
|
|
public function SV_Ambil_Sub2_A1_DataSnService() {
|
|
$id_pelanggan = $this->input->post('id_pelanggan');
|
|
|
|
$data = $this->Amod->getData_SnService_byPELANGGAN_joinDfsjs($id_pelanggan);
|
|
|
|
$this->output_json([
|
|
'data' => $data,
|
|
]);
|
|
}
|
|
|
|
public function SV_Tambah_Sub2_A1_DataDaftarSjService() {
|
|
$id_pelanggan = $this->input->post('id_pelanggan');
|
|
$tgl_sjs = $this->input->post('tgl_sjs');
|
|
$ket_sjs = $this->input->post('ket_sjs');
|
|
$id_sns = $this->input->post('id_sns');
|
|
$ket_sjs = ltrim(rtrim(preg_replace('/\R+/', " " , $ket_sjs)));
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$value = 0;
|
|
$datSjs = $this->Amod->getData_SjService_byKARYAWAN_bySTATUS($id_karyawan, 0);
|
|
if ($datSjs==TRUE) {
|
|
$id_sjs = $datSjs[0]['ID_SJS'];
|
|
if ($tgl_sjs==NULL) {
|
|
$tgl_sjs = $datSjs[0]['TGL_SJS'];
|
|
}
|
|
if ($id_pelanggan==NULL) {
|
|
$id_pelanggan = $datSjs[0]['PELANGGAN_ID'];
|
|
}
|
|
if ($ket_sjs==NULL) {
|
|
$ket_sjs = $datSjs[0]['KET_SJS'];
|
|
}
|
|
|
|
$cekDfsjs = $this->Amod->getData_DaftarSjService_bySJS_bySNS($id_sjs, $id_sns);
|
|
if ($cekDfsjs==TRUE) {
|
|
$value = 2;
|
|
} else {
|
|
$update = [
|
|
'TGL_SJS' => $tgl_sjs,
|
|
'PELANGGAN_ID' => $id_pelanggan,
|
|
'KET_SJS' => $ket_sjs
|
|
];
|
|
$action = $this->Amod->update('sj_service', $update, 'ID_SJS', $id_sjs);
|
|
}
|
|
} else {
|
|
$input = [
|
|
'CIPTA_SJS' => "Oleh $panggilan pada $timestamp",
|
|
'KARYAWAN_ID' => $id_karyawan,
|
|
'TGL_SJS' => $tgl_sjs,
|
|
'PELANGGAN_ID' => $id_pelanggan,
|
|
'KET_SJS' => $ket_sjs,
|
|
'STATUS_SJS' => '0'
|
|
];
|
|
$action = $this->Amod->create('sj_service', $input);
|
|
|
|
$id_sjs = $this->Amod->getMax_ID_SjService();
|
|
$id_sjs = $id_sjs[0]['ID_SJS'];
|
|
}
|
|
|
|
if ($value==0) {
|
|
$datSns = $this->Amod->getData_SnService_byID($id_sns);
|
|
$input = [
|
|
'UNITSERVICE_ID' => $datSns[0]['UNITSERVICE_ID'],
|
|
'SJS_ID' => $id_sjs,
|
|
'SNS_ID' => $id_sns,
|
|
];
|
|
$action = $this->Amod->create('daftar_sjservice', $input);
|
|
|
|
$value = 1;
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value
|
|
]);
|
|
}
|
|
|
|
public function SV_Hapus_Sub2_A1_DataDaftarSjService() {
|
|
$id_dfsjs = $this->input->post('id_dfsjs');
|
|
|
|
$value = 0;
|
|
$datDfsjs = $this->Amod->getData_DaftarSjService_byID($id_dfsjs);
|
|
if ($datDfsjs==FALSE) {
|
|
$value = 3;
|
|
} else {
|
|
$datSjs = $this->Amod->getData_SjService_byID_bySTATUS($datDfsjs[0]['SJS_ID'], 0);
|
|
if ($datSjs==FALSE) {
|
|
$value = 2;
|
|
} else {
|
|
$action = $this->Amod->delete('daftar_sjservice', $id_dfsjs, 'ID_DFSJS');
|
|
$value = 1;
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value
|
|
]);
|
|
}
|
|
|
|
public function SV_Kunci_Sub2_A1_DataSjService() {
|
|
$id_pelanggan = $this->input->post('id_pelanggan');
|
|
$tgl_sjs = $this->input->post('tgl_sjs');
|
|
$ket_sjs = $this->input->post('ket_sjs');
|
|
$ket_sjs = ltrim(rtrim(preg_replace('/\R+/', " " , $ket_sjs)));
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$now = date('Y-m-d');
|
|
|
|
$value = 0;
|
|
$datSjs = $this->Amod->getData_SjService_byKARYAWAN_bySTATUS($id_karyawan, 0);
|
|
if ($datSjs==FALSE) {
|
|
$value = 2;
|
|
} else {
|
|
if ($tgl_sjs==NULL) {
|
|
$tgl_sjs = $datSjs[0]['TGL_SJS'];
|
|
}
|
|
if ($id_pelanggan==NULL) {
|
|
$id_pelanggan = $datSjs[0]['PELANGGAN_ID'];
|
|
}
|
|
if ($ket_sjs==NULL) {
|
|
$ket_sjs = $datSjs[0]['KET_SJS'];
|
|
}
|
|
if ($datSjs[0]['KODE_SJS']!=NULL) {
|
|
$kode_sjs = $datSjs[0]['KODE_SJS'];
|
|
} else {
|
|
$kode_sjs = $this->Amod->generate_kodeSjService();
|
|
}
|
|
|
|
$update = [
|
|
'TGL_SJS' => $tgl_sjs,
|
|
'PELANGGAN_ID' => $id_pelanggan,
|
|
'KET_SJS' => $ket_sjs,
|
|
'KODE_SJS' => $kode_sjs,
|
|
'STATUS_SJS' => '1'
|
|
];
|
|
$action = $this->Amod->update('sj_service', $update, 'ID_SJS', $datSjs[0]['ID_SJS']);
|
|
|
|
$value = 1;
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value
|
|
]);
|
|
}
|
|
|
|
public function SV_Batal_Sub2_A1_DataSjService() {
|
|
$id_sjs = $this->input->post('id_sjsvoid');
|
|
$verse = $this->input->post('verse');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$datSjs = $this->Amod->getData_SjService_byID_bySTATUS($id_sjs, $verse);
|
|
if ($datSjs==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$status_sjs = 2;
|
|
$countDfsjs = $this->Amod->getCount_DaftarSjService_bySJS($id_sjs);
|
|
if ($verse==0 AND $countDfsjs==0) {
|
|
$status_sjs = 9;
|
|
}
|
|
|
|
$update = [
|
|
'BATAL_SJS' => "Oleh $panggilan pada $timestamp",
|
|
'STATUS_SJS' => $status_sjs
|
|
];
|
|
$action = $this->Amod->update('sj_service', $update, 'ID_SJS', $id_sjs);
|
|
|
|
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 SV_Revisi_Sub2_A1_DataSjService() {
|
|
$id_sjs = $this->input->post('id_sjsrev');
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$datSjs = $this->Amod->getData_SjService_byID_bySTATUS($id_sjs, 1);
|
|
if ($datSjs==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$cekSjs = $this->Amod->getData_SjService_byKARYAWAN_bySTATUS($id_karyawan, 0);
|
|
if ($cekSjs==TRUE) {
|
|
$update = [
|
|
'STATUS_SJS' => '9'
|
|
];
|
|
$action = $this->Amod->update('sj_service', $update, 'ID_SJS', $cekSjs[0]['ID_SJS']);
|
|
}
|
|
|
|
$update = [
|
|
'REVISI_SJS' => "Oleh $panggilan pada $timestamp",
|
|
'STATUS_SJS' => '0'
|
|
];
|
|
$action = $this->Amod->update('sj_service', $update, 'ID_SJS', $id_sjs);
|
|
|
|
if ($action) {
|
|
$this->session->set_flashdata('success', 'direvisi');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
} else {
|
|
$this->session->set_flashdata('failed', 'direvisi');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
}
|
|
|
|
//SUBMENU PUSAT DATA - CETAK DOKUMEN
|
|
public function SV_Sub3_CetakDokumen_1() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$now = date('Y-m-d');
|
|
$limit = date('Y-m-01');
|
|
$month = $this->Amod->generate_inisialMonth(date('m'));
|
|
$year = date('Y');
|
|
$timelimit = strtoupper("$month $year");
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "SV", "PUSAT DATA - Cetak Dokumen");
|
|
$id_menu = $datShm[0]['MENU_ID'];
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$datService = $this->Amod->getData_Service_byPERIODE_byJENIS_bySTATUS($limit, $now, 0, 1);
|
|
|
|
$datStpos = $this->Amod->getData_SetTogglePosisi_byKARYAWAN_byMENU($id_karyawan, $id_menu);
|
|
if ($datStpos==FALSE) { $posisiToggle = 0; } else { $posisiToggle = $datStpos[0]['AKTIF_STPOS']; }
|
|
|
|
$data = array(
|
|
'sidebar' => "menu service",
|
|
'navChild' => "service cetak",
|
|
'tgl' => $now,
|
|
'service' => $datService,
|
|
'countService' => count($datService),
|
|
'posisiToggle' => $posisiToggle,
|
|
'id_menu' => $id_menu,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil,
|
|
'timelimit' => $timelimit,
|
|
);
|
|
$this->load->view('proses/SV_Sub3_CetakDokumen_1', $data);
|
|
}
|
|
|
|
public function SV_Sub3_CetakDokumen_2() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$now = date('Y-m-d');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "SV", "PUSAT DATA - Cetak Dokumen");
|
|
$id_menu = $datShm[0]['MENU_ID'];
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$datService = $this->Amod->getData_Service_byPERIODE_byJENIS_bySTATUS(NULL, $now, 0, 1);
|
|
|
|
$datStpos = $this->Amod->getData_SetTogglePosisi_byKARYAWAN_byMENU($id_karyawan, $id_menu);
|
|
if ($datStpos==FALSE) { $posisiToggle = 0; } else { $posisiToggle = $datStpos[0]['AKTIF_STPOS']; }
|
|
|
|
$data = array(
|
|
'sidebar' => "menu service",
|
|
'navChild' => "service cetak",
|
|
'tgl' => $now,
|
|
'service' => $datService,
|
|
'countService' => count($datService),
|
|
'posisiToggle' => $posisiToggle,
|
|
'id_menu' => $id_menu,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil,
|
|
'timelimit' => "SEMUA DATA",
|
|
);
|
|
$this->load->view('proses/SV_Sub3_CetakDokumen_2', $data);
|
|
}
|
|
|
|
//SUBMENU PUSAT DATA - INFORMASI
|
|
public function SV_Sub3_Informasi_1($id=null) {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "SV", "PUSAT DATA - Informasi");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
if ($id==null) {
|
|
$posisiToggle = 0;
|
|
} else {
|
|
$posisiToggle = $id;
|
|
}
|
|
|
|
$data = array(
|
|
'sidebar' => "menu service",
|
|
'navChild' => "service informasi",
|
|
'posisiToggle' => $posisiToggle,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil
|
|
);
|
|
$this->load->view('proses/SV_Sub3_Informasi_1', $data);
|
|
}
|
|
|
|
public function SV_Ambil_Sub3_DataHistoriService() {
|
|
$id_sns = $this->input->post('id_sns');
|
|
|
|
$datSns = $this->Amod->getData_SnService_byID($id_sns);
|
|
$data = $this->Amod->getData_HistoriService_bySNS_orderASC($id_sns);
|
|
|
|
$datHsv = $this->Amod->getData_HistoriService_bySNS_orderDESC_limit1($id_sns);
|
|
if ($datHsv==FALSE) {
|
|
$value = 1;
|
|
} else {
|
|
if ($datHsv[0]['STATUS_HSV']==1 OR $datHsv[0]['STATUS_HSV']==7 OR $datHsv[0]['STATUS_HSV']==8) {
|
|
$value = 3;
|
|
} else {
|
|
$value = 2;
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
'total' => sizeof($data),
|
|
'data' => $data,
|
|
'nama_sns' => $datSns[0]['NAMA_SNS'],
|
|
]);
|
|
}
|
|
|
|
//SUBMENU PUSAT DATA - LAPORAN
|
|
public function SV_Sub3_Laporan_1() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "SV", "PUSAT DATA - Laporan");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$data = array(
|
|
'sidebar' => "menu service",
|
|
'navChild' => "service laporan",
|
|
'hak' => $hak,
|
|
'tampil' => $tampil
|
|
);
|
|
$this->load->view('proses/SV_Sub3_Laporan_1', $data);
|
|
}
|
|
|
|
public function SV_Sub3_Service_2() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$now = date('Y-m-d');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "SV", "PUSAT DATA - Laporan");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$datPelanggan = $this->Amod->getData_Pelanggan_bySTATUS(1);
|
|
$datBs = $this->Amod->getData_BiayaService();
|
|
|
|
$data = array(
|
|
'sidebar' => "menu service",
|
|
'navChild' => "service laporan",
|
|
'tgl' => $now,
|
|
'pelanggan' => $datPelanggan,
|
|
'bs' => $datBs,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil
|
|
);
|
|
$this->load->view('proses/SV_Sub3_Service_2', $data);
|
|
}
|
|
|
|
public function SV_Ambil_Sub3_DataPembukuanService() {
|
|
$id_pelanggan = $this->input->post('id_pelanggan');
|
|
$paket = $this->input->post('paket');
|
|
$awal = $this->input->post('awal');
|
|
$akhir = $this->input->post('akhir');
|
|
$search = $this->input->post('search');
|
|
|
|
if ($id_pelanggan=="") {
|
|
$id_pelanggan = NULL;
|
|
}
|
|
|
|
if ($paket=="") {
|
|
$paket = NULL;
|
|
}
|
|
|
|
$data = $this->Amod->getData_Service_byPELANGGAN_byPAKET_byPERIODE_status1($id_pelanggan, $paket, $awal, $akhir, $search);
|
|
$totBiaya = 0;
|
|
foreach ($data as $key) {
|
|
$totBiaya = $totBiaya+$key['HARGA_BS'];
|
|
}
|
|
|
|
$this->output_json([
|
|
'data' => $data,
|
|
'totBiaya' => number_format($totBiaya,2),
|
|
]);
|
|
}
|
|
|
|
public function SV_Excel_Sub3_DataPembukuanService() {
|
|
$awal = $this->input->post('tgl_awalfill');
|
|
$akhir = $this->input->post('tgl_akhirfill');
|
|
$paket = $this->input->post('paket_fill');
|
|
$jenis = $this->input->post('jenis_fill');
|
|
$id_pelanggan = $this->input->post('id_pelangganfill');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
if ($paket=="") {
|
|
$paket = NULL;
|
|
}
|
|
|
|
$hasil = [];
|
|
$noAwal = 0;
|
|
$noAkhir = 0;
|
|
|
|
if ($jenis==1) { // Campur jadi satu Laporan
|
|
$hasil[$noAwal] = [
|
|
'IDSHEET' => '0',
|
|
'FASHEET' => "CAMPUR",
|
|
'NASHEET' => "Sesuai Filter"
|
|
];
|
|
if ($id_pelanggan=="") {
|
|
$datService = $this->Amod->getData_Service_byPELANGGAN_byPAKET_byPERIODE_status1(NULL, $paket, $awal, $akhir);
|
|
$subTot = 0;
|
|
foreach ($datService as $dat) {
|
|
$subTot = $subTot+$dat['HARGA_BS'];
|
|
}
|
|
$hasil[$noAkhir] += ['SUBTOT' => number_format($subTot,2)];
|
|
$hasil[$noAkhir] += ['ISI' => $datService];
|
|
} else {
|
|
$listPelanggan = explode(",", $id_pelanggan);
|
|
$subSer = [];
|
|
$noSer = 0;
|
|
$subTot = 0;
|
|
foreach ($listPelanggan as $dat) {
|
|
$datService = $this->Amod->getData_Service_byPELANGGAN_byPAKET_byPERIODE_status1($dat, $paket, $awal, $akhir);
|
|
foreach ($datService as $dut) {
|
|
$subTot = $subTot+$dut['HARGA_BS'];
|
|
}
|
|
foreach ($datService as $det) {
|
|
$subSer[$noSer++] = $det;
|
|
}
|
|
}
|
|
$hasil[$noAkhir] += ['SUBTOT' => number_format($subTot,2)];
|
|
$hasil[$noAkhir] += ['ISI' => $subSer];
|
|
}
|
|
} else if ($jenis==2) { // Dipisah Pelanggan
|
|
$salPel = explode(",", $id_pelanggan);
|
|
foreach ($salPel as $key) {
|
|
$datPelanggan = $this->Amod->getData_Pelanggan_byID($key);
|
|
$nama_pelanggan = $datPelanggan[0]['NAMA_PELANGGAN'];
|
|
if (strlen($nama_pelanggan)>20) {
|
|
$namaPel = substr($nama_pelanggan, 0, 20);
|
|
$namaPel = "$namaPel..";
|
|
} else {
|
|
$namaPel = $nama_pelanggan;
|
|
}
|
|
$hasil[$noAwal++] = [
|
|
'IDSHEET' => $key,
|
|
'FASHEET' => $nama_pelanggan,
|
|
'NASHEET' => $namaPel
|
|
];
|
|
}
|
|
|
|
foreach ($hasil as $key) {
|
|
$datService = $this->Amod->getData_Service_byPELANGGAN_byPAKET_byPERIODE_status1($key['IDSHEET'], $paket, $awal, $akhir);
|
|
$subTot = 0;
|
|
foreach ($datService as $dat) {
|
|
$subTot = $subTot+$dat['HARGA_BS'];
|
|
}
|
|
$hasil[$noAkhir] += ['SUBTOT' => number_format($subTot,2)];
|
|
$hasil[$noAkhir++] += ['ISI' => $datService];
|
|
}
|
|
}
|
|
|
|
$pilih_tabel = array('No', 'Kode', 'Tanggal', 'Pelanggan', 'Paket', 'Biaya Service', 'Serial Number', 'Keluhan');
|
|
|
|
$data = [
|
|
'awal_nota' => date_format(date_create($awal), "d/m/Y"),
|
|
'akhir_nota' => date_format(date_create($akhir), "d/m/Y"),
|
|
'jumlah_kolom' => count($pilih_tabel),
|
|
'nama_tabel' => $pilih_tabel,
|
|
'jenis' => $jenis,
|
|
'hasil' => $hasil,
|
|
'ts' => $timestamp,
|
|
];
|
|
$this->load->view('cetak/SV_Excel_Sub2_DataPembukuanService', $data);
|
|
}
|
|
|
|
//Daftar Menu SB [Stok Barang]
|
|
//SUBMENU TRANSAKSI - KELUARMASUK
|
|
public function SB_Sub1_KeluarMasuk_1() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
$now = date('Y-m-d');
|
|
$limit = $this->Amod->generate_subMonth($now, 12);
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "SB", "TRANSAKSI - Keluar Masuk");
|
|
$id_menu = $datShm[0]['MENU_ID'];
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$datSgu = $this->Amod->getData_SetGudang_byKARYAWAN_byMENU($id_karyawan, $id_menu);
|
|
if ($datSgu==FALSE) {
|
|
$aktif = 1;
|
|
$input = [
|
|
'KARYAWAN_ID' => $id_karyawan,
|
|
'MENU_ID' => $id_menu,
|
|
'AKTIF_SGU' => $aktif,
|
|
'TIMESTAMP' => $timestamp
|
|
];
|
|
$action = $this->Amod->create('set_gudang', $input);
|
|
} else {
|
|
$aktif = $datSgu[0]['AKTIF_SGU'];
|
|
}
|
|
|
|
$cekIo = $this->Amod->getData_TransaksiStock_byKARYAWAN_bySTATUS_beforeTGL_soNull($id_karyawan, 0, $now);
|
|
if ($cekIo==TRUE) {
|
|
foreach ($cekIo as $key) {
|
|
if ($key['JENIS_IO']==0) {
|
|
if ($key['TYPE_JENIS']==1) {
|
|
$datSnio = $this->Amod->getData_SnIo_byIO($key['ID_IO']);
|
|
foreach ($datSnio as $dat) {
|
|
$datSnStock = $this->Amod->getData_SnStock_byNAMA_bySTATUS($dat['NAMA_SNIO'], 13);
|
|
if ($datSnStock==TRUE) {
|
|
$update = [
|
|
'STATUS_SNSTOCK' => '0'
|
|
];
|
|
$action = $this->Amod->update('sn_stock', $update, 'ID_SNSTOCK', $datSnStock[0]['ID_SNSTOCK']);
|
|
}
|
|
}
|
|
$action = $this->Amod->delete('sn_io', $key['ID_IO'], 'IO_ID');
|
|
}
|
|
$this->GE_Kalkulasi_KuantitiBarang($key['BARANG_ID'], $aktif, "Step 1 - KELUARMASUK - Hapus Barang", 0, $key['QTY_IO']);
|
|
} else if ($key['JENIS_IO']==1) {
|
|
if ($key['TYPE_JENIS']==1) {
|
|
$action = $this->Amod->delete('sn_io', $key['ID_IO'], 'IO_ID');
|
|
}
|
|
}
|
|
$action = $this->Amod->delete('transaksi_stock', $key['ID_IO'], 'ID_IO');
|
|
}
|
|
}
|
|
|
|
$datIo = $this->Amod->getData_TransaksiStock_byKARYAWAN_bySTATUS_soNull($id_karyawan, 0);
|
|
$no = 0;
|
|
foreach ($datIo as $key) {
|
|
$countSnio = $this->Amod->getCount_SnIo_byIO($key['ID_IO']);
|
|
$datIo[$no++] += ['REAL' => $countSnio];
|
|
}
|
|
|
|
$datBarang0 = $this->Amod->getData_Barang_bySTATUS_jenisNot2(1, $aktif);
|
|
$datBarang1 = $this->Amod->getData_Barang_bySTATUS_jenisNot2(1);
|
|
$datJio = $this->Amod->getData_JenisIo();
|
|
$datSo = $this->Amod->getData_SalesOrder_bySTATUS_afterTGL(1, $limit);
|
|
|
|
$data = array(
|
|
'sidebar' => "menu stokbarang",
|
|
'navChild' => "stokbarang keluarmasuk",
|
|
'id_menu' => $id_menu,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil,
|
|
'aktif' => $aktif,
|
|
'io' => $datIo,
|
|
'barang0' => $datBarang0,
|
|
'barang1' => $datBarang1,
|
|
'jio' => $datJio,
|
|
'so' => $datSo,
|
|
);
|
|
$this->load->view('proses/SB_Sub1_KeluarMasuk_1', $data);
|
|
}
|
|
|
|
public function SB_Ambil_Sub1_A1_DataSnStock() {
|
|
$id_io = $this->input->post('id_io');
|
|
|
|
$datIo = $this->Amod->getData_TransaksiStock_byID_bySTATUS($id_io, 0);
|
|
$data = $this->Amod->getData_SnStock_byBARANG_byGUDANG_bySTATUS($datIo[0]['BARANG_ID'], $datIo[0]['GUDANG_IO'], 0);
|
|
|
|
$this->output_json([
|
|
'value' => 1,
|
|
'total' => sizeof($data),
|
|
'data' => $data
|
|
]);
|
|
}
|
|
|
|
public function SB_Ambil_Sub1_A1_DataSnIo0() {
|
|
$id_io = $this->input->post('id_io');
|
|
|
|
$data = $this->Amod->getData_SnIo_byIO($id_io);
|
|
$datIo = $this->Amod->getData_TransaksiStock_byID_bySTATUS($id_io, 0);
|
|
$datSnStock = $this->Amod->getData_SnStock_byBARANG_byGUDANG_bySTATUS($datIo[0]['BARANG_ID'], $datIo[0]['GUDANG_IO'], 0);
|
|
|
|
$snReady = [];
|
|
foreach ($datSnStock as $key) {
|
|
$nama_snstock = $key['NAMA_SNSTOCK'];
|
|
$hasil = "$nama_snstock";
|
|
array_push($snReady, $hasil);
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => 1,
|
|
'total' => sizeof($data),
|
|
'data' => $data,
|
|
'snReady' => $snReady,
|
|
'qty' => $datIo[0]['QTY_IO']
|
|
]);
|
|
}
|
|
|
|
public function SB_Ambil_Sub1_A1_DataSnIo1() {
|
|
$id_io = $this->input->post('id_io');
|
|
|
|
$datIo = $this->Amod->getData_TransaksiStock_byID_bySTATUS($id_io, 0);
|
|
$data = $this->Amod->getData_SnIo_byIO($id_io);
|
|
|
|
$this->output_json([
|
|
'value' => 1,
|
|
'total' => sizeof($data),
|
|
'data' => $data,
|
|
'qty' => $datIo[0]['QTY_IO']
|
|
]);
|
|
}
|
|
|
|
public function SB_Tambah_Sub1_A1_DataTransaksiStock() {
|
|
$jenis_io = $this->input->post('jenis_io');
|
|
$aktif = $this->input->post('aktif');
|
|
$id_barang = $this->input->post('id_barangnew');
|
|
$id_jio = $this->input->post('id_jionew');
|
|
$qty_io = $this->input->post('qty_ionew');
|
|
$harga_io = $this->input->post('harga_ionew');
|
|
$ket_io = $this->input->post('ket_ionew');
|
|
$ket_io = ltrim(rtrim(preg_replace('/\R+/', " " , $ket_io)));
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
$now = date('Y-m-d');
|
|
|
|
$cekKuantiti = $this->GE_AmbilData_DataKuantiti($id_barang, $aktif);
|
|
if ($jenis_io==0 AND $cekKuantiti<$qty_io) {
|
|
if ($aktif==1) {
|
|
$this->session->set_flashdata('qty_pcm_less', 'error');
|
|
} else if ($aktif==2) {
|
|
$this->session->set_flashdata('qty_itp_less', 'error');
|
|
} else if ($aktif==3) {
|
|
$this->session->set_flashdata('qty_srv_less', 'error');
|
|
}
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
if ($harga_io!=null) {
|
|
$harga_io = str_replace(',', '.', $harga_io);
|
|
$cekNilai = is_numeric($harga_io);
|
|
if ($cekNilai==FALSE) {
|
|
$harga_io = 0;
|
|
}
|
|
}
|
|
|
|
$datIo = $this->Amod->getData_TransaksiStock_byKARYAWAN_bySTATUS_byTGL_soNull($id_karyawan, 0, $now);
|
|
if ($datIo==TRUE) {
|
|
$kode_bukti = $datIo[0]['KODE_BUKTI'];
|
|
} else {
|
|
$kode_bukti = $this->Amod->generate_kodeTransaksiStock();
|
|
}
|
|
|
|
if ($jenis_io==0) {
|
|
$this->GE_Kalkulasi_KuantitiBarang($id_barang, $aktif, "Step 1 - KELUARMASUK - Tambah Barang", 0, $qty_io);
|
|
}
|
|
|
|
$input = [
|
|
'CIPTA_IO' => "Oleh $panggilan pada $timestamp",
|
|
'TGL_IO' => $now,
|
|
'KODE_BUKTI' => $kode_bukti,
|
|
'JENIS_IO' => $jenis_io,
|
|
'GUDANG_IO' => $aktif,
|
|
'KARYAWAN_ID' => $id_karyawan,
|
|
'BARANG_ID' => $id_barang,
|
|
'JIO_ID' => $id_jio,
|
|
'QTY_IO' => $qty_io,
|
|
'HARGA_IO' => $harga_io,
|
|
'KET_IO' => $ket_io,
|
|
'STATUS_IO' => '0',
|
|
];
|
|
$action = $this->Amod->create('transaksi_stock', $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 SB_Ubah_Sub1_A1_DataTransaksiStock() {
|
|
$id_io = $this->input->post('id_ioed');
|
|
$harga_io = $this->input->post('harga_ioed');
|
|
$ket_io = $this->input->post('ket_ioed');
|
|
$ket_io = ltrim(rtrim(preg_replace('/\R+/', " " , $ket_io)));
|
|
$now = date('Y-m-d');
|
|
|
|
$datIo = $this->Amod->getData_TransaksiStock_byID_bySTATUS($id_io, 0);
|
|
if ($datIo==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
if ($harga_io!=null) {
|
|
$harga_io = str_replace(',', '.', $harga_io);
|
|
$cekNilai = is_numeric($harga_io);
|
|
if ($cekNilai==FALSE) {
|
|
$harga_io = 0;
|
|
}
|
|
}
|
|
|
|
$update = [
|
|
'HARGA_IO' => $harga_io,
|
|
'KET_IO' => $ket_io
|
|
];
|
|
$action = $this->Amod->update('transaksi_stock', $update, 'ID_IO', $id_io);
|
|
|
|
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 SB_Hapus_Sub1_A1_DataTransaksiStock() {
|
|
$id_io = $this->input->post('id_iodel');
|
|
$now = date('Y-m-d');
|
|
|
|
$datIo = $this->Amod->getData_TransaksiStock_byID_bySTATUS($id_io, 0);
|
|
if ($datIo==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
if ($datIo[0]['JENIS_IO']==0) {
|
|
if ($datIo[0]['TYPE_JENIS']==1) {
|
|
$datSnio = $this->Amod->getData_SnIo_byIO($id_io);
|
|
foreach ($datSnio as $key) {
|
|
$datSnStock = $this->Amod->getData_SnStock_byNAMA_bySTATUS($key['NAMA_SNIO'], 13);
|
|
if ($datSnStock==TRUE) {
|
|
$update = [
|
|
'STATUS_SNSTOCK' => '0'
|
|
];
|
|
$action = $this->Amod->update('sn_stock', $update, 'ID_SNSTOCK', $datSnStock[0]['ID_SNSTOCK']);
|
|
}
|
|
}
|
|
$action = $this->Amod->delete('sn_io', $id_io, 'IO_ID');
|
|
}
|
|
$this->GE_Kalkulasi_KuantitiBarang($datIo[0]['BARANG_ID'], $datIo[0]['GUDANG_IO'], "Step 1 - KELUARMASUK - Hapus Barang", 0, $datIo[0]['QTY_IO']);
|
|
} else if ($datIo[0]['JENIS_IO']==1) {
|
|
if ($datIo[0]['TYPE_JENIS']==1) {
|
|
$action = $this->Amod->delete('sn_io', $id_io, 'IO_ID');
|
|
}
|
|
}
|
|
|
|
$action = $this->Amod->delete('transaksi_stock', $id_io, 'ID_IO');
|
|
|
|
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 SB_Proses_Sub1_A1_DataTransaksiStock() {
|
|
$id_so = $this->input->post('id_sopro');
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$now = date('Y-m-d');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
if ($id_so!="") {
|
|
$datSo = $this->Amod->getData_SalesOrder_byID_bySTATUS($id_so, 1);
|
|
if ($datSo==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
$datPenjualan = $this->Amod->getData_Penjualan_bySO($id_so);
|
|
}
|
|
|
|
$datIo = $this->Amod->getData_TransaksiStock_byKARYAWAN_bySTATUS_soNull($id_karyawan, 0);
|
|
if ($datIo==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$cekJio = 0;
|
|
foreach ($datIo as $key) {
|
|
if ($key['TYPE_JENIS']==1) {
|
|
$countSnio = $this->Amod->getCount_SnIo_byIO($key['ID_IO']);
|
|
if ($countSnio<$key['QTY_IO']) {
|
|
$this->session->set_flashdata('sncount_less', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
}
|
|
if ($key['JENIS_IO']==0) {
|
|
$qty = $this->GE_AmbilData_DataKuantiti($key['BARANG_ID'], 3);
|
|
if ($qty<$key['QTY_IO']) {
|
|
$this->session->set_flashdata('qty_pro_less', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
}
|
|
if ($key['JIO_ID']==13) {
|
|
$cekJio++;
|
|
}
|
|
}
|
|
|
|
if ($cekJio==0) {
|
|
$datSpr = $this->Amod->getData_SoProyek_bySO($id_so);
|
|
if ($datSpr==TRUE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
} else if ($cekJio>0) {
|
|
if ($cekJio==count($datIo)) {
|
|
$datSpr = $this->Amod->getData_SoProyek_bySO($id_so);
|
|
if ($datSpr==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
} else {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
}
|
|
|
|
foreach ($datIo as $key) {
|
|
if ($id_so!="") {
|
|
$kode = $datPenjualan[0]['KODE_PENJUALAN'];
|
|
} else {
|
|
$kode = $key['KODE_BUKTI'];
|
|
}
|
|
|
|
if ($key['JENIS_IO']==0) {
|
|
if ($key['TYPE_JENIS']==1) {
|
|
$datSnIo = $this->Amod->getData_SnIo_byIO($key['ID_IO']);
|
|
foreach ($datSnIo as $dat) {
|
|
$datSnStock = $this->Amod->getData_SnStock_byNAMA_bySTATUS($dat['NAMA_SNIO'], 13);
|
|
if ($datSnStock==TRUE) {
|
|
$update = [
|
|
'STATUS_SNSTOCK' => '3'
|
|
];
|
|
$action = $this->Amod->update('sn_stock', $update, 'ID_SNSTOCK', $datSnStock[0]['ID_SNSTOCK']);
|
|
|
|
$input = [
|
|
'TGL_HSN' => $now,
|
|
'KODE_BUKTI' => $kode,
|
|
'SNSTOCK_ID' => $datSnStock[0]['ID_SNSTOCK']
|
|
];
|
|
$action = $this->Amod->create('histori_sn', $input);
|
|
}
|
|
}
|
|
}
|
|
} else if ($key['JENIS_IO']==1) {
|
|
if ($key['TYPE_JENIS']==1) {
|
|
$datSnIo = $this->Amod->getData_SnIo_byIO($key['ID_IO']);
|
|
foreach ($datSnIo as $dat) {
|
|
$input = [
|
|
'NAMA_SNSTOCK' => $dat['NAMA_SNIO'],
|
|
'BARANG_ID' => $key['BARANG_ID'],
|
|
'GUDANG_SNSTOCK' => $key['GUDANG_IO'],
|
|
'KOP_SNSTOCK' => '1',
|
|
'STATUS_SNSTOCK' => '0'
|
|
];
|
|
$action = $this->Amod->create('sn_stock', $input);
|
|
|
|
$id_snstock = $this->Amod->getMax_ID_SnStock();
|
|
$id_snstock = $id_snstock[0]['ID_SNSTOCK'];
|
|
|
|
$input = [
|
|
'TGL_HSN' => $now,
|
|
'KODE_BUKTI' => $kode,
|
|
'SNSTOCK_ID' => $id_snstock
|
|
];
|
|
$action = $this->Amod->create('histori_sn', $input);
|
|
}
|
|
}
|
|
}
|
|
|
|
$this->GE_Kalkulasi_HistoriKuantiti($key['BARANG_ID'], "Step 2 - KELUARMASUK - Proses Barang", $key['JENIS_IO'], $key['QTY_IO'], $kode, 0, $key['ID_IO']);
|
|
$this->GE_Kalkulasi_KuantitiBarang($key['BARANG_ID'], $key['GUDANG_IO'], "Step 2 - KELUARMASUK - Proses Barang", $key['JENIS_IO'], $key['QTY_IO']);
|
|
|
|
if ($id_so!="") {
|
|
$update = [
|
|
'STATUS_IO' => '1',
|
|
'PROSES_IO' => "Oleh $panggilan pada $timestamp",
|
|
'SO_ID' => $id_so,
|
|
'KODE_BUKTI' => $kode
|
|
];
|
|
} else {
|
|
$update = [
|
|
'STATUS_IO' => '1',
|
|
'PROSES_IO' => "Oleh $panggilan pada $timestamp",
|
|
];
|
|
}
|
|
$action = $this->Amod->update('transaksi_stock', $update, 'ID_IO', $key['ID_IO']);
|
|
|
|
if ($key['JIO_ID']==13) {
|
|
$datProyek = $this->Amod->getData_Proyek_byID($datSpr[0]['PROYEK_ID']);
|
|
$biaya_proyek = $datProyek[0]['BIAYA_PROYEK'];
|
|
$gp_proyek = $datProyek[0]['GP_PROYEK'];
|
|
|
|
$datHq = $this->Amod->getData_HistoriKuantiti_byBARANG_byKODEBUKTI_byTGL($key['BARANG_ID'], $kode, $now);
|
|
if ($key['JENIS_IO']==0) {
|
|
$biayaBaru = $biaya_proyek+round(($datHq[0]['AVG_HQ']*$key['QTY_IO']),2);
|
|
$gpBaru = $gp_proyek-round(($datHq[0]['AVG_HQ']*$key['QTY_IO']),2);
|
|
} else if ($key['JENIS_IO']==1) {
|
|
$biayaBaru = $biaya_proyek-round(($datHq[0]['AVG_HQ']*$key['QTY_IO']),2);
|
|
$gpBaru = $gp_proyek+round(($datHq[0]['AVG_HQ']*$key['QTY_IO']),2);
|
|
}
|
|
|
|
$update = [
|
|
'BIAYA_PROYEK' => $biayaBaru,
|
|
'GP_PROYEK' => $gpBaru
|
|
];
|
|
$action = $this->Amod->update('proyek', $update, 'ID_PROYEK', $datSpr[0]['PROYEK_ID']);
|
|
}
|
|
}
|
|
|
|
if ($action) {
|
|
$this->session->set_flashdata('success', 'diproses');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
} else {
|
|
$this->session->set_flashdata('failed', 'diproses');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
}
|
|
|
|
public function SB_Simpan_Sub1_A1_DataSnIo0() {
|
|
$id_snstock = $this->input->post('id_snstock');
|
|
$id_io = $this->input->post('id_io');
|
|
|
|
$value = 0;
|
|
$datIo = $this->Amod->getData_TransaksiStock_byID_bySTATUS($id_io, 0);
|
|
if ($datIo==FALSE) {
|
|
$value = 8;
|
|
} else {
|
|
$datSnStock = $this->Amod->getData_SnStock_byID($id_snstock);
|
|
if ($datSnStock==FALSE) {
|
|
$value = 7;
|
|
} else {
|
|
if ($datSnStock[0]['STATUS_SNSTOCK']!=0) {
|
|
$value = 6;
|
|
} else {
|
|
if ($datSnStock[0]['BARANG_ID']!=$datIo[0]['BARANG_ID']) {
|
|
$value = 5;
|
|
} else {
|
|
if ($datSnStock[0]['GUDANG_SNSTOCK']!=$datIo[0]['GUDANG_IO']) {
|
|
$value = 4;
|
|
} else {
|
|
$countBefore = $this->Amod->getCount_SnIo_byIO($id_io);
|
|
if ($countBefore>=$datIo[0]['QTY_IO']) {
|
|
$value = 3;
|
|
} else {
|
|
$input = [
|
|
'JENIS_SNIO' => '0',
|
|
'IO_ID' => $id_io,
|
|
'NAMA_SNIO' => $datSnStock[0]['NAMA_SNSTOCK']
|
|
];
|
|
$action = $this->Amod->create('sn_io', $input);
|
|
|
|
$update = [
|
|
'STATUS_SNSTOCK' => '13'
|
|
];
|
|
$action = $this->Amod->update('sn_stock', $update, 'ID_SNSTOCK', $id_snstock);
|
|
|
|
$countAfter = $this->Amod->getCount_SnIo_byIO($id_io);
|
|
if ($countAfter==$datIo[0]['QTY_IO']) {
|
|
$value = 2;
|
|
} else {
|
|
$value = 1;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
}
|
|
|
|
public function SB_Simpan_Sub1_A1_DataSnIoBarcode0() {
|
|
$id_snio = $this->input->post('id_snio');
|
|
$id_io = $this->input->post('id_io');
|
|
$nama_snio = $this->input->post('nama_snio');
|
|
$nama_snio = strtoupper($nama_snio);
|
|
|
|
$value = 0;
|
|
$datIo = $this->Amod->getData_TransaksiStock_byID_bySTATUS($id_io, 0);
|
|
if ($datIo==FALSE) {
|
|
$value = 8;
|
|
} else {
|
|
$datSnStock = $this->Amod->getData_SnStock_byNAMA_allStatus($nama_snio);
|
|
if ($datSnStock==FALSE) {
|
|
$value = 7;
|
|
} else {
|
|
if ($datSnStock[0]['STATUS_SNSTOCK']!=0) {
|
|
$value = 6;
|
|
} else {
|
|
if ($datSnStock[0]['BARANG_ID']!=$datIo[0]['BARANG_ID']) {
|
|
$value = 5;
|
|
} else {
|
|
if ($datSnStock[0]['GUDANG_SNSTOCK']!=$datIo[0]['GUDANG_IO']) {
|
|
$value = 4;
|
|
} else {
|
|
$countBefore = $this->Amod->getCount_SnIo_byIO($id_io);
|
|
if ($countBefore>=$datIo[0]['QTY_IO']) {
|
|
$value = 3;
|
|
} else {
|
|
$input = [
|
|
'JENIS_SNIO' => '0',
|
|
'IO_ID' => $id_io,
|
|
'NAMA_SNIO' => $nama_snio
|
|
];
|
|
$action = $this->Amod->create('sn_io', $input);
|
|
|
|
$update = [
|
|
'STATUS_SNSTOCK' => '13'
|
|
];
|
|
$action = $this->Amod->update('sn_stock', $update, 'ID_SNSTOCK', $datSnStock[0]['ID_SNSTOCK']);
|
|
|
|
$countAfter = $this->Amod->getCount_SnIo_byIO($id_io);
|
|
if ($countAfter==$datIo[0]['QTY_IO']) {
|
|
$value = 2;
|
|
} else {
|
|
$value = 1;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
}
|
|
|
|
public function SB_Simpan_Sub1_A1_DataSnIoBarcode1() {
|
|
$id_snio = $this->input->post('id_snio');
|
|
$id_io = $this->input->post('id_io');
|
|
$nama_snio = $this->input->post('nama_snio');
|
|
$nama_snio = strtoupper($nama_snio);
|
|
|
|
$value = 0;
|
|
$datIo = $this->Amod->getData_TransaksiStock_byID_bySTATUS($id_io, 0);
|
|
if ($datIo==FALSE) {
|
|
$value = 5;
|
|
} else {
|
|
$datSnStock = $this->Amod->getData_SnStock_byNAMA_allStatus($nama_snio);
|
|
$datSnIo = $this->Amod->getData_SnIo_byNAMA_allJenis($nama_snio);
|
|
$datSnb = $this->Amod->getData_SnBeli_byNAMA($nama_snio);
|
|
if ($datSnStock==TRUE OR $datSnIo==TRUE OR $datSnb==TRUE) {
|
|
$value = 4;
|
|
} else {
|
|
$countBefore = $this->Amod->getCount_SnIo_byIO($id_io);
|
|
if ($countBefore>=$datIo[0]['QTY_IO']) {
|
|
$value = 3;
|
|
} else {
|
|
$input = [
|
|
'JENIS_SNIO' => '1',
|
|
'IO_ID' => $id_io,
|
|
'NAMA_SNIO' => $nama_snio
|
|
];
|
|
$action = $this->Amod->create('sn_io', $input);
|
|
|
|
$countAfter = $this->Amod->getCount_SnIo_byIO($id_io);
|
|
if ($countAfter==$datIo[0]['QTY_IO']) {
|
|
$value = 2;
|
|
} else {
|
|
$value = 1;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
}
|
|
|
|
public function SB_Hapus_Sub1_A1_DataSnIo0() {
|
|
$id_snio = $this->input->post('id_snio');
|
|
$id_io = $this->input->post('id_io');
|
|
|
|
$value = 0;
|
|
$datIo = $this->Amod->getData_TransaksiStock_byID_bySTATUS($id_io, 0);
|
|
if ($datIo==FALSE) {
|
|
$value = 4;
|
|
} else {
|
|
$datSnio = $this->Amod->getData_SnIo_byID_bySTATUS($id_snio, 13);
|
|
if ($datSnio==FALSE) {
|
|
$value = 3;
|
|
} else {
|
|
$countBefore = $this->Amod->getCount_SnIo_byIO($id_io);
|
|
|
|
$update = [
|
|
'STATUS_SNSTOCK' => '0'
|
|
];
|
|
$action = $this->Amod->update('sn_stock', $update, 'ID_SNSTOCK', $datSnio[0]['ID_SNSTOCK']);
|
|
$action = $this->Amod->delete('sn_io', $id_snio, 'ID_SNIO');
|
|
|
|
if ($countBefore==$datIo[0]['QTY_IO']) {
|
|
$value = 2;
|
|
} else {
|
|
$value = 1;
|
|
}
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
}
|
|
|
|
public function SB_Hapus_Sub1_A1_DataSnIo1() {
|
|
$id_snio = $this->input->post('id_snio');
|
|
$id_io = $this->input->post('id_io');
|
|
|
|
$value = 0;
|
|
$datIo = $this->Amod->getData_TransaksiStock_byID_bySTATUS($id_io, 0);
|
|
if ($datIo==FALSE) {
|
|
$value = 3;
|
|
} else {
|
|
$countBefore = $this->Amod->getCount_SnIo_byIO($id_io);
|
|
|
|
$action = $this->Amod->delete('sn_io', $id_snio, 'ID_SNIO');
|
|
|
|
if ($countBefore==$datIo[0]['QTY_IO']) {
|
|
$value = 2;
|
|
} else {
|
|
$value = 1;
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
}
|
|
|
|
//SUBMENU TRANSAKSI - CABUTAN
|
|
public function SB_Transaksi_Cabutan_1() { // Validasi
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$now = date('Y-m-d');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "SB", "TRANSAKSI - Cabutan");
|
|
$id_menu = $datShm[0]['MENU_ID'];
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$cekCabutan = $this->Amod->getData_Cabutan_byGUDANG_bySTATUS_beforeTGL($id_karyawan, 0, $now);
|
|
if ($cekCabutan==TRUE) {
|
|
if ($cekCabutan[0]['KET_CABUTAN']==NULL) {
|
|
$datIo = $this->Amod->getData_TransaksiStock_byCABUTAN_statusNull($cekCabutan[0]['ID_CABUTAN']);
|
|
foreach ($datIo as $key) {
|
|
if ($key['JENIS_IO']==0) {
|
|
$this->GE_Kalkulasi_KuantitiBarang($key['BARANG_ID'], $cekCabutan[0]['GUDANG_SNSTOCK'], "Step 1 - KELUARMASUK - Hapus Barang", 0, $key['QTY_IO']);
|
|
}
|
|
|
|
$action = $this->Amod->delete('transaksi_stock', $key['ID_IO'], 'ID_IO');
|
|
}
|
|
|
|
$update = [
|
|
'BATAL_CABUTAN' => "Oleh Sistem pada $timestamp",
|
|
'STATUS_CABUTAN'=> '9'
|
|
];
|
|
} else {
|
|
$update = [
|
|
'BATAL_CABUTAN' => "Oleh Sistem pada $timestamp",
|
|
'STATUS_CABUTAN'=> '9',
|
|
'KET_CABUTAN' => NULL
|
|
];
|
|
}
|
|
$action = $this->Amod->update('cabutan', $update, 'ID_CABUTAN', $cekCabutan[0]['ID_CABUTAN']);
|
|
}
|
|
|
|
$datHpar = $this->Amod->getData_HargaPart_byID();
|
|
|
|
$datStpos = $this->Amod->getData_SetTogglePosisi_byKARYAWAN_byMENU($id_karyawan, $id_menu);
|
|
if ($datStpos==FALSE) { $posisiToggle = 0; } else { $posisiToggle = $datStpos[0]['AKTIF_STPOS']; }
|
|
|
|
$data = array(
|
|
'sidebar' => "menu stokbarang",
|
|
'navChild' => "stokbarang cabutan",
|
|
'hak' => $hak,
|
|
'tampil' => $tampil,
|
|
'hpar' => $datHpar,
|
|
'id_menu' => $id_menu,
|
|
'posisiToggle' => $posisiToggle,
|
|
);
|
|
$this->load->view('proses/SB_Transaksi_Cabutan_1', $data);
|
|
}
|
|
|
|
public function SB_Ambil_JumlahData() { // Validasi
|
|
$verse = $this->input->post('verse');
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$now = date('Y-m-d');
|
|
|
|
$kode = "Kosong";
|
|
$stokcabutan = 0;
|
|
if ($verse==1) { // Cabutan
|
|
$cekCabutan = $this->Amod->getData_Cabutan_byGUDANG_bySTATUS($id_karyawan, 0);
|
|
if ($cekCabutan==TRUE) {
|
|
$kode = $cekCabutan[0]['KODE_CABUTAN'];
|
|
}
|
|
$stokcabutan = $this->Amod->getCount_Cabutan_bySTATUS(1);
|
|
}
|
|
|
|
|
|
$this->output_json([
|
|
'kode' => $kode,
|
|
'stokcabutan' => $stokcabutan,
|
|
]);
|
|
}
|
|
|
|
public function SB_Batal_DataCabutan() { // Validasi
|
|
$id_cabutan = $this->input->post('id_cabutan');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$value = 0;
|
|
$datCabutan = $this->Amod->getData_Cabutan_byID_bySTATUS($id_cabutan, 0);
|
|
if ($datCabutan==FALSE) {
|
|
$value = 2;
|
|
} else {
|
|
if ($datCabutan[0]['KET_CABUTAN']==NULL) {
|
|
$datIo = $this->Amod->getData_TransaksiStock_byCABUTAN_statusNull($datCabutan[0]['ID_CABUTAN']);
|
|
foreach ($datIo as $key) {
|
|
if ($key['JENIS_IO']==0) {
|
|
$this->GE_Kalkulasi_KuantitiBarang($key['BARANG_ID'], $datCabutan[0]['GUDANG_SNSTOCK'], "Step 1 - KELUARMASUK - Hapus Barang", 0, $key['QTY_IO']);
|
|
}
|
|
|
|
$action = $this->Amod->delete('transaksi_stock', $key['ID_IO'], 'ID_IO');
|
|
}
|
|
|
|
$update = [
|
|
'BATAL_CABUTAN' => "Oleh Sistem pada $timestamp",
|
|
'STATUS_CABUTAN'=> '9'
|
|
];
|
|
} else {
|
|
$update = [
|
|
'BATAL_CABUTAN' => "Oleh Sistem pada $timestamp",
|
|
'STATUS_CABUTAN'=> '9',
|
|
'KET_CABUTAN' => NULL
|
|
];
|
|
}
|
|
$action = $this->Amod->update('cabutan', $update, 'ID_CABUTAN', $id_cabutan);
|
|
|
|
$value = 1;
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value
|
|
]);
|
|
}
|
|
|
|
public function SB_Hapus_DataTransaksiStock() { // Validasi
|
|
$verse = $this->input->post('verse');
|
|
$id_io = $this->input->post('id_io');
|
|
$id_cabutan = $this->input->post('id_cabutan');
|
|
|
|
$value = 0;
|
|
if ($verse==1) { // Transaksi Cabutan Baru
|
|
$datCabutan = $this->Amod->getData_Cabutan_byID_bySTATUS($id_cabutan, 0);
|
|
if ($datCabutan==FALSE) {
|
|
$value = 3;
|
|
} else {
|
|
if ($datCabutan[0]['KET_CABUTAN']==NULL) {
|
|
$datIo = $this->Amod->getData_TransaksiStock_byID_byCABUTAN_statusNull($id_io, $id_cabutan);
|
|
if ($datIo==FALSE) {
|
|
$value = 2;
|
|
} else {
|
|
if ($datIo[0]['JENIS_IO']==0) {
|
|
$this->GE_Kalkulasi_KuantitiBarang($datIo[0]['BARANG_ID'], $datCabutan[0]['GUDANG_SNSTOCK'], "Step 1 - KELUARMASUK - Hapus Barang", 0, $datIo[0]['QTY_IO']);
|
|
}
|
|
|
|
$action = $this->Amod->delete('transaksi_stock', $id_io, 'ID_IO');
|
|
|
|
$value = 1;
|
|
}
|
|
} else {
|
|
$update = [
|
|
'KET_CABUTAN' => NULL
|
|
];
|
|
$action = $this->Amod->update('cabutan', $update, 'ID_CABUTAN', $id_cabutan);
|
|
|
|
$value = 1;
|
|
}
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value
|
|
]);
|
|
}
|
|
|
|
public function SB_Kembali_DataCabutan() { // Validasi
|
|
$id_cabutan = $this->input->post('id_cabutan');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$now = date('Y-m-d');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$value = 0;
|
|
$datCabutan = $this->Amod->getData_Cabutan_byID_bySTATUS($id_cabutan, 1);
|
|
if ($datCabutan==FALSE) {
|
|
$value = 2;
|
|
} else {
|
|
$datSnStock = $this->Amod->getData_SnStock_byID($datCabutan[0]['SNSTOCK_ID']);
|
|
$this->GE_Kalkulasi_KuantitiBarang($datSnStock[0]['BARANG_ID'], $datSnStock[0]['GUDANG_SNSTOCK'], "Kunci Cabutan", 5, 1);
|
|
|
|
$update = [
|
|
'STATUS_CABUTAN' => '2',
|
|
'KEMBALI_CABUTAN' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('cabutan', $update, 'ID_CABUTAN', $id_cabutan);
|
|
|
|
$update = [
|
|
'STATUS_SNSTOCK' => '0'
|
|
];
|
|
$action = $this->Amod->update('sn_stock', $update, 'ID_SNSTOCK', $datCabutan[0]['SNSTOCK_ID']);
|
|
|
|
$value = 1;
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value
|
|
]);
|
|
}
|
|
|
|
public function SB_Kunci_DataCabutan() { // Validasi
|
|
$id_cabutan = $this->input->post('id_cabutan');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$now = date('Y-m-d');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$value = 0;
|
|
$datCabutan = $this->Amod->getData_Cabutan_byID_bySTATUS($id_cabutan, 0);
|
|
if ($datCabutan==FALSE) {
|
|
$value = 2;
|
|
} else {
|
|
$datSnStock = $this->Amod->getData_SnStock_byID($datCabutan[0]['SNSTOCK_ID']);
|
|
if ($datCabutan[0]['KET_CABUTAN']==NULL) {
|
|
$datIo = $this->Amod->getData_TransaksiStock_byCABUTAN_statusNull($id_cabutan);
|
|
foreach ($datIo as $key) {
|
|
if ($key['JENIS_IO']==0) {
|
|
$this->GE_Kalkulasi_HistoriKuantiti($key['BARANG_ID'], "Kunci Cabutan", '0', $key['QTY_IO'], $datCabutan[0]['KODE_CABUTAN'], '0', '0');
|
|
} else if ($key['JENIS_IO']==1) {
|
|
$this->GE_Kalkulasi_HistoriKuantiti($key['BARANG_ID'], "Kunci Cabutan", '1', $key['QTY_IO'], $datCabutan[0]['KODE_CABUTAN'], '0', $key['ID_IO']);
|
|
}
|
|
|
|
$this->GE_Kalkulasi_KuantitiBarang($key['BARANG_ID'], $datSnStock[0]['GUDANG_SNSTOCK'], "Kunci Cabutan", $key['JENIS_IO'], $key['QTY_IO']);
|
|
$update = [
|
|
'STATUS_IO' => '1',
|
|
'PROSES_IO' => "Oleh $panggilan pada $timestamp",
|
|
];
|
|
$action = $this->Amod->update('transaksi_stock', $update, 'ID_IO', $key['ID_IO']);
|
|
}
|
|
$limit_cabutan = count($datIo);
|
|
} else {
|
|
$limit_cabutan = 1;
|
|
}
|
|
|
|
$this->GE_Kalkulasi_KuantitiBarang($datSnStock[0]['BARANG_ID'], $datSnStock[0]['GUDANG_SNSTOCK'], "Kunci Cabutan", 2, 1);
|
|
|
|
$update = [
|
|
'STATUS_CABUTAN' => '1',
|
|
'CIPTA_CABUTAN' => "Oleh $panggilan pada $timestamp",
|
|
'LIMIT_CABUTAN' => $limit_cabutan
|
|
];
|
|
$action = $this->Amod->update('cabutan', $update, 'ID_CABUTAN', $id_cabutan);
|
|
|
|
$update = [
|
|
'STATUS_SNSTOCK' => '21'
|
|
];
|
|
$action = $this->Amod->update('sn_stock', $update, 'ID_SNSTOCK', $datCabutan[0]['SNSTOCK_ID']);
|
|
|
|
$value = 1;
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value
|
|
]);
|
|
}
|
|
|
|
public function SB_Tambah_DataCabutan() { // Validasi
|
|
$id_snstock = $this->input->post('id_snstock');
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$now = date('Y-m-d');
|
|
|
|
$nama_snstock = "";
|
|
$value = 0;
|
|
$datCabutan = $this->Amod->getData_Cabutan_byGUDANG_bySTATUS($id_karyawan, 0);
|
|
if ($datCabutan==TRUE) {
|
|
$id_cabutan = $datCabutan[0]['ID_CABUTAN'];
|
|
$kode_cabutan = $datCabutan[0]['KODE_CABUTAN'];
|
|
|
|
$cekCabutan = $this->Amod->getData_Cabutan_bySNSTOCK_activeOnly($id_snstock, $id_cabutan);
|
|
if ($cekCabutan==TRUE) {
|
|
$value = 2;
|
|
$id_snstock = $datCabutan[0]['SNSTOCK_ID'];
|
|
$nama_snstock = $datCabutan[0]['NAMA_SNSTOCK'];
|
|
} else {
|
|
$update = [
|
|
'SNSTOCK_ID' => $id_snstock
|
|
];
|
|
$action = $this->Amod->update('cabutan', $update, 'ID_CABUTAN', $id_cabutan);
|
|
$value = 1;
|
|
}
|
|
} else {
|
|
$kode_cabutan = $this->Amod->generate_kodeCabutan();
|
|
$input = [
|
|
'KODE_CABUTAN' => $kode_cabutan,
|
|
'GUDANG_ID' => $id_karyawan,
|
|
'SNSTOCK_ID' => $id_snstock,
|
|
'TGL_CABUTAN' => $now,
|
|
'STATUS_CABUTAN' => '0'
|
|
];
|
|
$action = $this->Amod->create('cabutan', $input);
|
|
|
|
$id_cabutan = $this->Amod->getMax_ID_Cabutan();
|
|
$id_cabutan = $id_cabutan[0]['ID_CABUTAN'];
|
|
|
|
$value = 1;
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
'kode' => $kode_cabutan,
|
|
'id' => $id_cabutan,
|
|
'sn' => $id_snstock,
|
|
'nama' => $nama_snstock,
|
|
]);
|
|
}
|
|
|
|
public function SB_Tambah_DataTransaksiStock() { // Validasi
|
|
$verse = $this->input->post('verse');
|
|
$id_cabutan = $this->input->post('id_cabutan');
|
|
$jenis_io = $this->input->post('jenis_io');
|
|
$id_barang = $this->input->post('id_barang');
|
|
$qty_io = $this->input->post('qty_io');
|
|
$id_hpar = $this->input->post('id_hpar');
|
|
$ket_io = $this->input->post('ket_io');
|
|
$ket_io = ltrim(rtrim(preg_replace('/\R+/', " " , $ket_io)));
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
$now = date('Y-m-d');
|
|
|
|
$value = 0;
|
|
if ($verse==1) { // Transaksi Stock dari Menu Cabutan Baru
|
|
$datCabutan = $this->Amod->getData_Cabutan_byID_bySTATUS_byGUDANG($id_cabutan, 0, $id_karyawan);
|
|
if ($datCabutan==FALSE) {
|
|
$value = 4;
|
|
} else {
|
|
if ($jenis_io==0 OR $jenis_io==1) {
|
|
$cekKuantiti = $this->GE_AmbilData_DataKuantiti($id_barang, $datCabutan[0]['GUDANG_SNSTOCK']);
|
|
if ($jenis_io==0 AND $cekKuantiti<$qty_io) {
|
|
$value = 3;
|
|
} else {
|
|
$datIo = $this->Amod->getData_TransaksiStock_byCABUTAN_byBARANG_statusNull($id_cabutan, $id_barang);
|
|
if ($datIo==TRUE) {
|
|
$value = 2;
|
|
} else {
|
|
$datSnStock = $this->Amod->getData_SnStock_byID($datCabutan[0]['SNSTOCK_ID']);
|
|
if ($jenis_io==0) {
|
|
$input = [
|
|
'CIPTA_IO' => "Oleh $panggilan pada $timestamp",
|
|
'TGL_IO' => $now,
|
|
'KODE_BUKTI' => $datCabutan[0]['KODE_CABUTAN'],
|
|
'JENIS_IO' => $jenis_io,
|
|
'GUDANG_IO' => $datSnStock[0]['GUDANG_SNSTOCK'],
|
|
'JIO_ID' => '5',
|
|
'KARYAWAN_ID' => $id_karyawan,
|
|
'BARANG_ID' => $id_barang,
|
|
'QTY_IO' => $qty_io,
|
|
'KET_IO' => $ket_io,
|
|
'CABUTAN_ID' => $id_cabutan,
|
|
];
|
|
$action = $this->Amod->create('transaksi_stock', $input);
|
|
|
|
$this->GE_Kalkulasi_KuantitiBarang($id_barang, 1, "Step 1 - KELUARMASUK - Tambah Barang", 0, $qty_io);
|
|
} else if ($jenis_io==1) {
|
|
$datHpar = $this->Amod->getData_HargaPart_byID($id_hpar);
|
|
$harga_io = $datHpar[0]['HPP_HPAR']/2;
|
|
$input = [
|
|
'CIPTA_IO' => "Oleh $panggilan pada $timestamp",
|
|
'TGL_IO' => $now,
|
|
'KODE_BUKTI' => $datCabutan[0]['KODE_CABUTAN'],
|
|
'HPAR_ID' => $id_hpar,
|
|
'JENIS_IO' => $jenis_io,
|
|
'HARGA_IO' => $harga_io,
|
|
'GUDANG_IO' => $datSnStock[0]['GUDANG_SNSTOCK'],
|
|
'JIO_ID' => '5',
|
|
'KARYAWAN_ID' => $id_karyawan,
|
|
'BARANG_ID' => $id_barang,
|
|
'QTY_IO' => $qty_io,
|
|
'KET_IO' => $ket_io,
|
|
'CABUTAN_ID' => $id_cabutan,
|
|
];
|
|
$action = $this->Amod->create('transaksi_stock', $input);
|
|
}
|
|
|
|
$value = 1;
|
|
}
|
|
}
|
|
} else if ($jenis_io==2) {
|
|
$update = [
|
|
'KET_CABUTAN' => $ket_io
|
|
];
|
|
$action = $this->Amod->update('cabutan', $update, 'ID_CABUTAN', $id_cabutan);
|
|
|
|
$value = 1;
|
|
}
|
|
}
|
|
} else if ($verse==2) { // Transaksi Stock dari Menu Cabutan Berjalan
|
|
$datCabutan = $this->Amod->getData_Cabutan_byID_bySTATUS($id_cabutan, 1);
|
|
if ($datCabutan==FALSE) {
|
|
$value = 4;
|
|
} else {
|
|
if ($jenis_io==0) {
|
|
$cekKuantiti = $this->GE_AmbilData_DataKuantiti($id_barang, $datCabutan[0]['GUDANG_SNSTOCK']);
|
|
if ($cekKuantiti<$qty_io) {
|
|
$value = 3;
|
|
}
|
|
}
|
|
if ($value==0) {
|
|
if ($jenis_io==0) {
|
|
$input = [
|
|
'CIPTA_IO' => "Oleh $panggilan pada $timestamp",
|
|
'PROSES_IO' => "Oleh $panggilan pada $timestamp",
|
|
'TGL_IO' => $now,
|
|
'KODE_BUKTI' => $datCabutan[0]['KODE_CABUTAN'],
|
|
'JENIS_IO' => $jenis_io,
|
|
'GUDANG_IO' => $datCabutan[0]['GUDANG_SNSTOCK'],
|
|
'JIO_ID' => '5',
|
|
'KARYAWAN_ID' => $id_karyawan,
|
|
'BARANG_ID' => $id_barang,
|
|
'QTY_IO' => $qty_io,
|
|
'KET_IO' => $ket_io,
|
|
'CABUTAN_ID' => $id_cabutan,
|
|
'STATUS_IO' => '1',
|
|
];
|
|
$action = $this->Amod->create('transaksi_stock', $input);
|
|
|
|
$this->GE_Kalkulasi_HistoriKuantiti($id_barang, "Kunci Cabutan", '0', $qty_io, $datCabutan[0]['KODE_CABUTAN'], '0', '0');
|
|
$this->GE_Kalkulasi_KuantitiBarang($id_barang, $datCabutan[0]['GUDANG_SNSTOCK'], "Kunci Cabutan", '3', $qty_io);
|
|
} else if ($jenis_io==1) {
|
|
$datHpar = $this->Amod->getData_HargaPart_byID($id_hpar);
|
|
$harga_io = $datHpar[0]['HPP_HPAR']/2;
|
|
$input = [
|
|
'CIPTA_IO' => "Oleh $panggilan pada $timestamp",
|
|
'PROSES_IO' => "Oleh $panggilan pada $timestamp",
|
|
'TGL_IO' => $now,
|
|
'KODE_BUKTI' => $datCabutan[0]['KODE_CABUTAN'],
|
|
'HPAR_ID' => $id_hpar,
|
|
'JENIS_IO' => $jenis_io,
|
|
'HARGA_IO' => $harga_io,
|
|
'GUDANG_IO' => $datCabutan[0]['GUDANG_SNSTOCK'],
|
|
'JIO_ID' => '5',
|
|
'KARYAWAN_ID' => $id_karyawan,
|
|
'BARANG_ID' => $id_barang,
|
|
'QTY_IO' => $qty_io,
|
|
'KET_IO' => $ket_io,
|
|
'CABUTAN_ID' => $id_cabutan,
|
|
'STATUS_IO' => '1',
|
|
];
|
|
$action = $this->Amod->create('transaksi_stock', $input);
|
|
|
|
$id_io = $this->Amod->getMax_ID_TransaksiStock();
|
|
$id_io = $id_io[0]['ID_IO'];
|
|
|
|
$this->GE_Kalkulasi_HistoriKuantiti($id_barang, "Kunci Cabutan", '1', $qty_io, $datCabutan[0]['KODE_CABUTAN'], '0', $id_io);
|
|
$this->GE_Kalkulasi_KuantitiBarang($id_barang, $datCabutan[0]['GUDANG_SNSTOCK'], "Kunci Cabutan", '4', $qty_io);
|
|
}
|
|
|
|
$value = 1;
|
|
}
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
}
|
|
|
|
//SUBMENU TRANSAKSI - KONSINYASI
|
|
public function SB_Sub1_Konsinyasi_1() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
$now = date('Y-m-d');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "SB", "TRANSAKSI - Konsinyasi");
|
|
$id_menu = $datShm[0]['MENU_ID'];
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$datSgu = $this->Amod->getData_SetGudang_byKARYAWAN_byMENU($id_karyawan, $id_menu);
|
|
if ($datSgu==FALSE) {
|
|
$aktif = 1;
|
|
$input = [
|
|
'KARYAWAN_ID' => $id_karyawan,
|
|
'MENU_ID' => $id_menu,
|
|
'AKTIF_SGU' => $aktif,
|
|
'TIMESTAMP' => $timestamp
|
|
];
|
|
$action = $this->Amod->create('set_gudang', $input);
|
|
} else {
|
|
$aktif = $datSgu[0]['AKTIF_SGU'];
|
|
}
|
|
|
|
$datKonsinyasi = $this->Amod->getData_Konsinyasi_byGUDANG_bySTATUS($id_karyawan, 0);
|
|
if ($datKonsinyasi==TRUE) {
|
|
$id_konsinyasi = $datKonsinyasi[0]['ID_KONSINYASI'];
|
|
$datDfk = $this->Amod->getData_DaftarKonsi_byKONSINYASI($id_konsinyasi);
|
|
$no = 0;
|
|
foreach ($datDfk as $key) {
|
|
$count = $this->Amod->getCount_SnKonsi_byDFK($key['ID_DFK']);
|
|
$datDfk[$no++] += ['REAL' => $count];
|
|
}
|
|
$countProsesKonsi = count($datDfk);
|
|
} else {
|
|
$datDfk = NULL;
|
|
$id_konsinyasi = NULL;
|
|
$countProsesKonsi = 0;
|
|
}
|
|
|
|
$datKonsinyasiBerjalan = $this->Amod->getData_Konsinyasi_bySTATUS_byJENIS(1, $aktif);
|
|
$no = 0;
|
|
foreach ($datKonsinyasiBerjalan as $key) {
|
|
$datDfkPro = $this->Amod->getData_DaftarKonsi_byKONSINYASI($key['ID_KONSINYASI']);
|
|
$noko = 0;
|
|
$sn = "";
|
|
foreach ($datDfkPro as $dat) {
|
|
$datSnk = $this->Amod->getData_SnKonsi_byDFK_statusNull($dat['ID_DFK']);
|
|
foreach ($datSnk as $dit) {
|
|
$nama_snk = $dit['NAMA_SNK'];
|
|
$sn .= "$nama_snk, ";
|
|
}
|
|
$datDfkPro[$noko++] += ['SN' => $sn];
|
|
$sn = "";
|
|
}
|
|
$datKonsinyasiBerjalan[$no++] += ['BARANG' => $datDfkPro];
|
|
}
|
|
|
|
$datKonsinyasiSelesai = $this->Amod->getData_Konsinyasi_byJENIS_statusMore1($aktif);
|
|
$no = 0;
|
|
foreach ($datKonsinyasiSelesai as $key) {
|
|
$datDfkSel = $this->Amod->getData_DaftarKonsi_byKONSINYASI($key['ID_KONSINYASI']);
|
|
$noko = 0;
|
|
$sn = "";
|
|
foreach ($datDfkSel as $dat) {
|
|
$datSnk = $this->Amod->getData_SnKonsi_byDFK_bySTATUS($dat['ID_DFK'], 1);
|
|
foreach ($datSnk as $dit) {
|
|
$nama_snk = $dit['NAMA_SNK'];
|
|
$sn .= "$nama_snk, ";
|
|
}
|
|
$datDfkSel[$noko++] += ['SN' => $sn];
|
|
$sn = "";
|
|
}
|
|
$datKonsinyasiSelesai[$no++] += ['BARANG' => $datDfkSel];
|
|
}
|
|
|
|
$datPk = $this->Amod->getData_PenarikanKonsi_byGUDANG_bySTATUS($id_karyawan, 0);
|
|
if ($datPk==TRUE) {
|
|
$id_pk = $datPk[0]['ID_PK'];
|
|
$id_peltarik = $datPk[0]['PELANGGAN_ID'];
|
|
$nama_peltarik = $datPk[0]['NAMA_PELANGGAN'];
|
|
$datDpk = $this->Amod->getData_DaftarPenarikanKonsi_byPK($id_pk);
|
|
$no = 0;
|
|
$sn = "";
|
|
foreach ($datDpk as $key) {
|
|
$datSnk = $this->Amod->getData_SnKonsi_byBARANG_byPK($key['BARANG_ID'], $id_pk);
|
|
foreach ($datSnk as $dat) {
|
|
$nama_snk = $dat['NAMA_SNK'];
|
|
$sn .= "$nama_snk, ";
|
|
}
|
|
$datDpk[$no++] += ['SN' => $sn];
|
|
$sn = "";
|
|
}
|
|
$countProsesTarik = count($datDpk);
|
|
} else {
|
|
$datDpk = NULL;
|
|
$id_pk = NULL;
|
|
$nama_peltarik = NULL;
|
|
$id_peltarik = 0;
|
|
$countProsesTarik = 0;
|
|
}
|
|
|
|
$datStpos = $this->Amod->getData_SetTogglePosisi_byKARYAWAN_byMENU($id_karyawan, $id_menu);
|
|
if ($datStpos==FALSE) { $posisiToggle = 0; } else { $posisiToggle = $datStpos[0]['AKTIF_STPOS']; }
|
|
|
|
$datBarang = $this->Amod->getData_Barang_bySTATUS_jenisNot2(1, $aktif);
|
|
$datKaryawan = $this->Amod->getData_Karyawan_allSales();
|
|
$datPelanggan = $this->Amod->getData_Pelanggan_bySTATUS(1);
|
|
$datPelTarik = $this->Amod->getData_Konsinyasi_byJENIS_bySTATUS_groupPELANGGAN($aktif, 1);
|
|
|
|
$data = array(
|
|
'sidebar' => "menu stokbarang",
|
|
'navChild' => "stokbarang konsinyasi",
|
|
'id_menu' => $id_menu,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil,
|
|
'id_konsinyasi' => $id_konsinyasi,
|
|
'id_pk' => $id_pk,
|
|
'id_peltarik' => $id_peltarik,
|
|
'nama_peltarik' => $nama_peltarik,
|
|
'aktif' => $aktif,
|
|
'dfk' => $datDfk,
|
|
'dpk' => $datDpk,
|
|
'konsinyasi' => $datKonsinyasiBerjalan,
|
|
'selesai' => $datKonsinyasiSelesai,
|
|
'countProsesKonsi' => $countProsesKonsi,
|
|
'countBerjalan' => count($datKonsinyasiBerjalan),
|
|
'countSelesai' => count($datKonsinyasiSelesai),
|
|
'countProsesTarik' => $countProsesTarik,
|
|
'posisiToggle' => $posisiToggle,
|
|
'barang' => $datBarang,
|
|
'karyawan' => $datKaryawan,
|
|
'pelanggan' => $datPelanggan,
|
|
'peltarik' => $datPelTarik,
|
|
);
|
|
$this->load->view('proses/SB_Sub1_Konsinyasi_1', $data);
|
|
}
|
|
|
|
public function SB_Ambil_Sub1_B1_DataSnStock() {
|
|
$id_dfk = $this->input->post('id_dfk');
|
|
|
|
$datDfk = $this->Amod->getData_DaftarKonsi_byID($id_dfk);
|
|
$data = $this->Amod->getData_SnStock_byBARANG_byGUDANG_bySTATUS($datDfk[0]['BARANG_ID'], $datDfk[0]['JENIS_KONSINYASI'], 0);
|
|
|
|
$this->output_json([
|
|
'value' => 1,
|
|
'total' => sizeof($data),
|
|
'data' => $data
|
|
]);
|
|
}
|
|
|
|
public function SB_Ambil_Sub1_B1_DataSnKonsi() {
|
|
$id_dfk = $this->input->post('id_dfk');
|
|
|
|
$datDfk = $this->Amod->getData_DaftarKonsi_byID($id_dfk);
|
|
$data = $this->Amod->getData_SnKonsi_byDFK($id_dfk);
|
|
$snstock = $this->Amod->getData_SnStock_byBARANG_byGUDANG_bySTATUS($datDfk[0]['BARANG_ID'], $datDfk[0]['JENIS_KONSINYASI'], 0);
|
|
|
|
$snReady = [];
|
|
foreach ($snstock as $dat) {
|
|
$nama_snstock = $dat['NAMA_SNSTOCK'];
|
|
$hasil = "$nama_snstock";
|
|
array_push($snReady, $hasil);
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => 1,
|
|
'total' => sizeof($data),
|
|
'data' => $data,
|
|
'snReady' => $snReady,
|
|
'qty' => $datDfk[0]['QTY_DFK']
|
|
]);
|
|
}
|
|
|
|
public function SB_Ambil_Sub1_B1_DataDaftarKonsiBerjalan() {
|
|
$id_pelanggan = $this->input->post('id_pelanggan');
|
|
$jenis_konsinyasi = $this->input->post('jenis_konsinyasi');
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
|
|
$datPk = $this->Amod->getData_PenarikanKonsi_byGUDANG_bySTATUS($id_karyawan, 0);
|
|
if ($datPk==TRUE) {
|
|
$id_pk = $datPk[0]['ID_PK'];
|
|
} else {
|
|
$id_pk = NULL;
|
|
}
|
|
|
|
$data = $this->Amod->getData_DaftarKonsi_byPELANGGAN_byJENIS_bySTATUS_kembaliNotFull($id_pelanggan, $jenis_konsinyasi, 1);
|
|
$no = 0;
|
|
foreach ($data as $key) {
|
|
$datDpk = $this->Amod->getData_DaftarPenarikanKonsi_byPK_byBARANG($id_pk, $key['BARANG_ID']);
|
|
if ($datDpk==TRUE) {
|
|
$lock = 1;
|
|
} else {
|
|
$lock = 0;
|
|
}
|
|
$data[$no++] += ['LOCK' => $lock];
|
|
}
|
|
|
|
$this->output_json([
|
|
'data' => $data,
|
|
]);
|
|
}
|
|
|
|
public function SB_Ambil_Sub1_B1_DataSnKonsiBerjalan() {
|
|
$id_barang = $this->input->post('id_barang');
|
|
$id_pelanggan = $this->input->post('id_pelanggan');
|
|
$jenis_konsinyasi = $this->input->post('jenis_konsinyasi');
|
|
|
|
$data = $this->Amod->getData_SnKonsi_byBARANG_byPELANGGAN_byJENIS_bySTATUS_statusNull($id_barang, $id_pelanggan, $jenis_konsinyasi, 1);
|
|
$datBarang = $this->Amod->getData_Barang_byID($id_barang);
|
|
|
|
$this->output_json([
|
|
'data' => $data,
|
|
'tipe' => $datBarang[0]['TYPE_JENIS'],
|
|
]);
|
|
}
|
|
|
|
public function SB_Tambah_Sub1_B1_DataDaftarKonsi() {
|
|
$jenis_konsinyasi = $this->input->post('jenis_konsinyasinew');
|
|
$id_barang = $this->input->post('id_barangnew');
|
|
$qty_dfk = $this->input->post('qty_dfknew');
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
$now = date('Y-m-d');
|
|
|
|
$cekKuantiti = $this->GE_AmbilData_DataKuantiti($id_barang, $jenis_konsinyasi);
|
|
if ($cekKuantiti<$qty_dfk) {
|
|
if ($jenis_konsinyasi==1) {
|
|
$this->session->set_flashdata('qty_pcm_less', 'error');
|
|
} else if ($jenis_konsinyasi==2) {
|
|
$this->session->set_flashdata('qty_itp_less', 'error');
|
|
}
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$datKonsinyasi = $this->Amod->getData_Konsinyasi_byGUDANG_bySTATUS($id_karyawan, 0);
|
|
if ($datKonsinyasi==FALSE) {
|
|
$kode_konsinyasi = $this->Amod->generate_kodeKonsinyasi();
|
|
$input = [
|
|
'CIPTA_KONSINYASI' => "Oleh $panggilan pada $timestamp",
|
|
'JENIS_KONSINYASI' => $jenis_konsinyasi,
|
|
'GUDANG_ID' => $id_karyawan,
|
|
'KODE_KONSINYASI' => $kode_konsinyasi,
|
|
'TGL_KONSINYASI' => $now,
|
|
'STATUS_KONSINYASI' => '0',
|
|
];
|
|
$action = $this->Amod->create('konsinyasi', $input);
|
|
|
|
$id_konsinyasi = $this->Amod->getMax_ID_Konsinyasi();
|
|
$id_konsinyasi = $id_konsinyasi[0]['ID_KONSINYASI'];
|
|
} else {
|
|
$id_konsinyasi = $datKonsinyasi[0]['ID_KONSINYASI'];
|
|
|
|
$datDfk = $this->Amod->getData_DaftarKonsi_byKONSINYASI_byBARANG($id_konsinyasi, $id_barang);
|
|
if ($datDfk==TRUE) {
|
|
$this->session->set_flashdata('barangid_same', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
}
|
|
|
|
$input = [
|
|
'KONSINYASI_ID' => $id_konsinyasi,
|
|
'BARANG_ID' => $id_barang,
|
|
'QTY_DFK' => $qty_dfk,
|
|
'KEMBALI_DFK' => '0'
|
|
];
|
|
$action = $this->Amod->create('daftar_konsi', $input);
|
|
|
|
$this->GE_Kalkulasi_KuantitiBarang($id_barang, $jenis_konsinyasi, "Step 1 - KONSINYASI - Tambah Barang", 0, $qty_dfk);
|
|
|
|
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 SB_Tambah_Sub1_B1_DataDaftarPenarikanKonsi() {
|
|
$tipe = $this->input->post('tipe');
|
|
$jenis_pk = $this->input->post('jenis_pknew');
|
|
$id_pelanggan = $this->input->post('id_peltariknew');
|
|
$id_barang = $this->input->post('id_barangtariknew');
|
|
$qty_dpk = $this->input->post('qty_dpknew');
|
|
$sntarik = $this->input->post('id_sntariknew');
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
$now = date('Y-m-d');
|
|
|
|
if ($tipe==1) {
|
|
$qty_dpk = count($sntarik);
|
|
|
|
foreach ($sntarik as $key) {
|
|
$datSnk = $this->Amod->getData_SnKonsi_byID_bySTATUS($key, 6);
|
|
if ($datSnk==FALSE OR $datSnk[0]['STATUS_SNK']!=NULL OR $datSnk[0]['PK_ID']!=NULL) {
|
|
$this->session->set_flashdata('sn_used', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
}
|
|
}
|
|
|
|
$cekKuantiti = $this->GE_AmbilData_DataKuantiti($id_barang, 5);
|
|
if ($cekKuantiti<$qty_dpk) {
|
|
$this->session->set_flashdata('qty_konsi_less', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$sumDfk = $this->Amod->getSum_DaftarKonsi_byPELANGGAN_byBARANG_byJENIS($id_pelanggan, $id_barang, $jenis_pk);
|
|
if ($sumDfk[0]['TOTAL']<$qty_dpk) {
|
|
$this->session->set_flashdata('qty_sisakonsi_less', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$datPk = $this->Amod->getData_PenarikanKonsi_byGUDANG_bySTATUS($id_karyawan, 0);
|
|
if ($datPk==FALSE) {
|
|
$kode_pk = $this->Amod->generate_kodePenarikanKonsi();
|
|
$input = [
|
|
'CIPTA_PK' => "Oleh $panggilan pada $timestamp",
|
|
'JENIS_PK' => $jenis_pk,
|
|
'KODE_PK' => $kode_pk,
|
|
'GUDANG_ID' => $id_karyawan,
|
|
'PELANGGAN_ID' => $id_pelanggan,
|
|
'TGL_PK' => $now,
|
|
'STATUS_PK' => '0',
|
|
];
|
|
$action = $this->Amod->create('penarikan_konsi', $input);
|
|
|
|
$id_pk = $this->Amod->getMax_ID_PenarikanKonsi();
|
|
$id_pk = $id_pk[0]['ID_PK'];
|
|
} else {
|
|
$id_pk = $datPk[0]['ID_PK'];
|
|
|
|
$datDpk = $this->Amod->getData_DaftarPenarikanKonsi_byPK_byBARANG($id_pk, $id_barang);
|
|
if ($datDpk==TRUE) {
|
|
$this->session->set_flashdata('barangid_same', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
}
|
|
|
|
$input = [
|
|
'PK_ID' => $id_pk,
|
|
'BARANG_ID' => $id_barang,
|
|
'QTY_DPK' => $qty_dpk
|
|
];
|
|
$action = $this->Amod->create('daftar_penarikankonsi', $input);
|
|
|
|
if ($tipe==0) {
|
|
$datDfk = $this->Amod->getData_DaftarKonsi_byBARANG_byPELANGGAN_byJENIS_bySTATUS_byORDER($id_barang, $id_pelanggan, $jenis_pk, 1, 1);
|
|
$target = $qty_dpk;
|
|
foreach ($datDfk as $key) {
|
|
if ($target>0) {
|
|
if ($key['QTY_DFK']>$key['KEMBALI_DFK']) {
|
|
$selisih = $key['QTY_DFK']-$key['KEMBALI_DFK'];
|
|
if ($selisih>=$target) {
|
|
$kembali_dfk = $key['KEMBALI_DFK']+$target;
|
|
$target = 0;
|
|
} else {
|
|
$target = $target-$selisih;
|
|
$kembali_dfk = $key['QTY_DFK'];
|
|
}
|
|
$update = [
|
|
'KEMBALI_DFK' => $kembali_dfk
|
|
];
|
|
$action = $this->Amod->update('daftar_konsi', $update, 'ID_DFK', $key['ID_DFK']);
|
|
}
|
|
}
|
|
}
|
|
} else if ($tipe==1) {
|
|
foreach ($sntarik as $key) {
|
|
$datSnk = $this->Amod->getData_SnKonsi_byID_pkNull_statusNull($key);
|
|
if ($datSnk==TRUE) {
|
|
$update = [
|
|
'PK_ID' => $id_pk,
|
|
'STATUS_SNK' => '0'
|
|
];
|
|
$action = $this->Amod->update('sn_konsi', $update, 'ID_SNK', $key);
|
|
|
|
$datDfk = $this->Amod->getData_DaftarKonsi_byID($datSnk[0]['DFK_ID']);
|
|
$kembaliLama = $datDfk[0]['KEMBALI_DFK'];
|
|
$kembaliBaru = $kembaliLama+1;
|
|
|
|
$update = [
|
|
'KEMBALI_DFK' => $kembaliBaru
|
|
];
|
|
$action = $this->Amod->update('daftar_konsi', $update, 'ID_DFK', $datSnk[0]['DFK_ID']);
|
|
}
|
|
}
|
|
}
|
|
|
|
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 SB_Hapus_Sub1_B1_DataDaftarKonsi() {
|
|
$id_dfk = $this->input->post('id_dfkdel');
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
|
|
$datDfk = $this->Amod->getData_DaftarKonsi_byID($id_dfk);
|
|
if ($datDfk==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$id_konsinyasi = $datDfk[0]['KONSINYASI_ID'];
|
|
$datKonsinyasi = $this->Amod->getData_Konsinyasi_byID_byGUDANG_bySTATUS($id_konsinyasi, $id_karyawan, 0);
|
|
if ($datKonsinyasi==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$cekKuantiti = $this->GE_AmbilData_DataKuantiti($datDfk[0]['BARANG_ID'], 3);
|
|
if ($cekKuantiti<$datDfk[0]['QTY_DFK']) {
|
|
$this->session->set_flashdata('qty_pro_less', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
if ($datDfk[0]['TYPE_JENIS']==1) {
|
|
$datSnk = $this->Amod->getData_SnKonsi_byDFK($id_dfk);
|
|
foreach ($datSnk as $key) {
|
|
$datSnStock = $this->Amod->getData_SnStock_byNAMA_bySTATUS($key['NAMA_SNK'], 16);
|
|
if ($datSnStock==TRUE) {
|
|
$update = [
|
|
'STATUS_SNSTOCK' => '0'
|
|
];
|
|
$action = $this->Amod->update('sn_stock', $update, 'ID_SNSTOCK', $datSnStock[0]['ID_SNSTOCK']);
|
|
}
|
|
}
|
|
$action = $this->Amod->delete('sn_konsi', $id_dfk, 'DFK_ID');
|
|
}
|
|
$this->GE_Kalkulasi_KuantitiBarang($datDfk[0]['BARANG_ID'], $datKonsinyasi[0]['JENIS_KONSINYASI'], "Step 1 - KONSINYASI - Hapus Barang", 0, $datDfk[0]['QTY_DFK']);
|
|
|
|
$action = $this->Amod->delete('daftar_konsi', $id_dfk, 'ID_DFK');
|
|
|
|
$countAfter = $this->Amod->getCount_DaftarKonsi_byKONSINYASI($id_konsinyasi);
|
|
if ($countAfter==0) {
|
|
$action = $this->Amod->delete('konsinyasi', $id_konsinyasi, 'ID_KONSINYASI');
|
|
}
|
|
|
|
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 SB_Hapus_Sub1_B1_DataDaftarPenarikanKonsi() {
|
|
$id_dpk = $this->input->post('id_dpkdel');
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
|
|
$datDpk = $this->Amod->getData_DaftarPenarikanKonsi_byID($id_dpk);
|
|
if ($datDpk==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$id_pk = $datDpk[0]['PK_ID'];
|
|
$datPk = $this->Amod->getData_PenarikanKonsi_byID_byGUDANG_bySTATUS($id_pk, $id_karyawan, 0);
|
|
if ($datPk==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
if ($datDpk[0]['TYPE_JENIS']==0) {
|
|
$datDfk = $this->Amod->getData_DaftarKonsi_byBARANG_byPELANGGAN_byJENIS_bySTATUS_byORDER($datDpk[0]['BARANG_ID'], $datPk[0]['PELANGGAN_ID'], $datPk[0]['JENIS_PK'], 1, 2);
|
|
$target = $datDpk[0]['QTY_DPK'];
|
|
foreach ($datDfk as $key) {
|
|
if ($target>0) {
|
|
if ($key['KEMBALI_DFK']>0) {
|
|
if ($target>=$key['KEMBALI_DFK']) {
|
|
$target = $target-$key['KEMBALI_DFK'];
|
|
$kembali_dfk = 0;
|
|
} else {
|
|
$kembali_dfk = $key['KEMBALI_DFK']-$target;
|
|
$target = 0;
|
|
}
|
|
$update = [
|
|
'KEMBALI_DFK' => $kembali_dfk
|
|
];
|
|
$action = $this->Amod->update('daftar_konsi', $update, 'ID_DFK', $key['ID_DFK']);
|
|
}
|
|
}
|
|
}
|
|
} else if ($datDpk[0]['TYPE_JENIS']==1) {
|
|
$datSnk = $this->Amod->getData_SnKonsi_byPK_byBARANG_bySTATUS($id_pk, $datDpk[0]['BARANG_ID'], 0);
|
|
foreach ($datSnk as $key) {
|
|
$update = [
|
|
'PK_ID' => NULL,
|
|
'STATUS_SNK' => NULL
|
|
];
|
|
$action = $this->Amod->update('sn_konsi', $update, 'ID_SNK', $key['ID_SNK']);
|
|
|
|
$datDfk = $this->Amod->getData_DaftarKonsi_byID($key['DFK_ID']);
|
|
$kembaliLama = $datDfk[0]['KEMBALI_DFK'];
|
|
$kembaliBaru = $kembaliLama-1;
|
|
|
|
$update = [
|
|
'KEMBALI_DFK' => $kembaliBaru
|
|
];
|
|
$action = $this->Amod->update('daftar_konsi', $update, 'ID_DFK', $key['DFK_ID']);
|
|
}
|
|
}
|
|
|
|
$action = $this->Amod->delete('daftar_penarikankonsi', $id_dpk, 'ID_DPK');
|
|
|
|
$countAfter = $this->Amod->getCount_DaftarPenarikanKonsi_byPK($id_pk);
|
|
if ($countAfter==0) {
|
|
$action = $this->Amod->delete('penarikan_konsi', $id_pk, 'ID_PK');
|
|
}
|
|
|
|
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 SB_Proses_Sub1_B1_DataKonsinyasi() {
|
|
$id_konsinyasi = $this->input->post('id_konsinyasipro');
|
|
$id_sales = $this->input->post('id_salespro');
|
|
$id_pelanggan = $this->input->post('id_pelangganpro');
|
|
$id_gudang = $this->session->userdata('id_karyawan');
|
|
$now = date('Y-m-d');
|
|
|
|
$datKonsinyasi = $this->Amod->getData_Konsinyasi_byID_byGUDANG_bySTATUS($id_konsinyasi, $id_gudang, 0);
|
|
if ($datKonsinyasi==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$datDfk = $this->Amod->getData_DaftarKonsi_byKONSINYASI($id_konsinyasi);
|
|
foreach ($datDfk as $key) {
|
|
$cekKuantiti = $this->GE_AmbilData_DataKuantiti($key['BARANG_ID'], 3);
|
|
if ($cekKuantiti<$key['QTY_DFK']) {
|
|
$this->session->set_flashdata('qty_pro_less', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
if ($key['TYPE_JENIS']==1) {
|
|
$count = $this->Amod->getCount_SnKonsi_byDFK($key['ID_DFK']);
|
|
if ($count<$key['QTY_DFK']) {
|
|
$this->session->set_flashdata('sncount_less', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
}
|
|
}
|
|
|
|
foreach ($datDfk as $key) {
|
|
if ($key['TYPE_JENIS']==1) {
|
|
$datSnk = $this->Amod->getData_SnKonsi_byDFK($key['ID_DFK']);
|
|
foreach ($datSnk as $dat) {
|
|
$datSnStock = $this->Amod->getData_SnStock_byNAMA_bySTATUS($dat['NAMA_SNK'], 16);
|
|
if ($datSnStock==TRUE) {
|
|
$update = [
|
|
'STATUS_SNSTOCK' => '6'
|
|
];
|
|
$action = $this->Amod->update('sn_stock', $update, 'ID_SNSTOCK', $datSnStock[0]['ID_SNSTOCK']);
|
|
}
|
|
}
|
|
}
|
|
|
|
$this->GE_Kalkulasi_KuantitiBarang($key['BARANG_ID'], $datKonsinyasi[0]['JENIS_KONSINYASI'], "Step 2 - KONSINYASI - Proses Barang", 0, $key['QTY_DFK']);
|
|
}
|
|
|
|
$input = [
|
|
'SJ_INV' => '0',
|
|
'KODE_BUKTI' => $datKonsinyasi[0]['KODE_KONSINYASI'],
|
|
'KONSINYASI_ID' => $id_konsinyasi,
|
|
'TGL_CD' => $now
|
|
];
|
|
$action = $this->Amod->create('cetak_dokumen', $input);
|
|
|
|
$update = [
|
|
'SALES_ID' => $id_sales,
|
|
'PELANGGAN_ID' => $id_pelanggan,
|
|
'STATUS_KONSINYASI' => '1'
|
|
];
|
|
$action = $this->Amod->update('konsinyasi', $update, 'ID_KONSINYASI', $id_konsinyasi);
|
|
|
|
if ($action) {
|
|
$this->session->set_flashdata('success', 'diproses');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
} else {
|
|
$this->session->set_flashdata('failed', 'diproses');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
}
|
|
|
|
public function SB_Proses_Sub1_B1_DataDaftarPenarikanKonsi() {
|
|
$id_pk = $this->input->post('id_pkpro');
|
|
$id_gudang = $this->session->userdata('id_karyawan');
|
|
$now = date('Y-m-d');
|
|
|
|
$datPk = $this->Amod->getData_PenarikanKonsi_byID_byGUDANG_bySTATUS($id_pk, $id_gudang, 0);
|
|
if ($datPk==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$datDpk = $this->Amod->getData_DaftarPenarikanKonsi_byPK($id_pk);
|
|
foreach ($datDpk as $key) {
|
|
if ($key['TYPE_JENIS']==1) {
|
|
$datSnk = $this->Amod->getData_SnKonsi_byPK_byBARANG_bySTATUS($id_pk, $key['BARANG_ID'], 0);
|
|
foreach ($datSnk as $dat) {
|
|
$datSnStock = $this->Amod->getData_SnStock_byNAMA_bySTATUS($dat['NAMA_SNK'], 6);
|
|
if ($datSnStock==TRUE) {
|
|
$update = [
|
|
'STATUS_SNSTOCK' => '0'
|
|
];
|
|
$action = $this->Amod->update('sn_stock', $update, 'ID_SNSTOCK', $datSnStock[0]['ID_SNSTOCK']);
|
|
}
|
|
|
|
$update = [
|
|
'STATUS_SNK' => '1'
|
|
];
|
|
$action = $this->Amod->update('sn_konsi', $update, 'ID_SNK', $dat['ID_SNK']);
|
|
}
|
|
}
|
|
|
|
$this->GE_Kalkulasi_KuantitiBarang($key['BARANG_ID'], $datPk[0]['JENIS_PK'], "Step 3 - KONSINYASI - Tarik Barang", 0, $key['QTY_DPK']);
|
|
}
|
|
|
|
$update = [
|
|
'STATUS_PK' => '1'
|
|
];
|
|
$action = $this->Amod->update('penarikan_konsi', $update, 'ID_PK', $id_pk);
|
|
|
|
|
|
$cekPk = $this->Amod->getData_PenarikanKonsi_byPELANGGAN_bySTATUS($datPk[0]['PELANGGAN_ID'], 0);
|
|
if ($cekPk==FALSE) {
|
|
$datKonsinyasi = $this->Amod->getData_Konsinyasi_byPELANGGAN_bySTATUS($datPk[0]['PELANGGAN_ID'], 1);
|
|
foreach ($datKonsinyasi as $key) {
|
|
$datDfk = $this->Amod->getData_DaftarKonsi_byKONSINYASI($key['ID_KONSINYASI']);
|
|
$countDfk = $this->Amod->getCount_DaftarKonsi_byKONSINYASI($key['ID_KONSINYASI']);
|
|
$nocek = 0;
|
|
foreach ($datDfk as $dat) {
|
|
if ($dat['QTY_DFK']==$dat['KEMBALI_DFK']) {
|
|
$nocek++;
|
|
}
|
|
}
|
|
if ($countDfk==$nocek) {
|
|
$update = [
|
|
'STATUS_KONSINYASI' => '2'
|
|
];
|
|
$action = $this->Amod->update('konsinyasi', $update, 'ID_KONSINYASI', $key['ID_KONSINYASI']);
|
|
}
|
|
}
|
|
}
|
|
|
|
$input = [
|
|
'SJ_INV' => '0',
|
|
'KODE_BUKTI' => $datPk[0]['KODE_PK'],
|
|
'PK_ID' => $id_pk,
|
|
'TGL_CD' => $now
|
|
];
|
|
$action = $this->Amod->create('cetak_dokumen', $input);
|
|
|
|
if ($action) {
|
|
$this->session->set_flashdata('success', 'ditarik');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
} else {
|
|
$this->session->set_flashdata('failed', 'ditarik');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
}
|
|
|
|
public function SB_Simpan_Sub1_B1_DataSnKonsi() {
|
|
$id_snstock = $this->input->post('id_snstock');
|
|
$id_dfk = $this->input->post('id_dfk');
|
|
|
|
$value = 0;
|
|
$datDfk = $this->Amod->getData_DaftarKonsi_byID($id_dfk);
|
|
if ($datDfk==FALSE) {
|
|
$value = 8;
|
|
} else {
|
|
$datSnStock = $this->Amod->getData_SnStock_byID($id_snstock);
|
|
if ($datSnStock==FALSE) {
|
|
$value = 7;
|
|
} else {
|
|
if ($datSnStock[0]['STATUS_SNSTOCK']!=0) {
|
|
$value = 6;
|
|
} else {
|
|
if ($datSnStock[0]['BARANG_ID']!=$datDfk[0]['BARANG_ID']) {
|
|
$value = 5;
|
|
} else {
|
|
if ($datSnStock[0]['GUDANG_SNSTOCK']!=$datDfk[0]['JENIS_KONSINYASI']) {
|
|
$value = 4;
|
|
} else {
|
|
$countBefore = $this->Amod->getCount_SnKonsi_byDFK($id_dfk);
|
|
if ($countBefore>=$datDfk[0]['QTY_DFK']) {
|
|
$value = 3;
|
|
} else {
|
|
$input = [
|
|
'DFK_ID' => $id_dfk,
|
|
'NAMA_SNK' => $datSnStock[0]['NAMA_SNSTOCK']
|
|
];
|
|
$action = $this->Amod->create('sn_konsi', $input);
|
|
|
|
$update = [
|
|
'STATUS_SNSTOCK' => '16'
|
|
];
|
|
$action = $this->Amod->update('sn_stock', $update, 'ID_SNSTOCK', $id_snstock);
|
|
|
|
$countAfter = $this->Amod->getCount_SnKonsi_byDFK($id_dfk);
|
|
if ($countAfter==$datDfk[0]['QTY_DFK']) {
|
|
$value = 2;
|
|
} else {
|
|
$value = 1;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
}
|
|
|
|
public function SB_Simpan_Sub1_B1_DataSnKonsiBarcode() {
|
|
$id_snk = $this->input->post('id_snk');
|
|
$id_dfk = $this->input->post('id_dfk');
|
|
$nama_snk = $this->input->post('nama_snk');
|
|
$nama_snk = strtoupper($nama_snk);
|
|
|
|
$value = 0;
|
|
$datDfk = $this->Amod->getData_DaftarKonsi_byID($id_dfk);
|
|
if ($datDfk==FALSE) {
|
|
$value = 8;
|
|
} else {
|
|
$datSnStock = $this->Amod->getData_SnStock_byNAMA_allStatus($nama_snk);
|
|
if ($datSnStock==FALSE) {
|
|
$value = 7;
|
|
} else {
|
|
if ($datSnStock[0]['STATUS_SNSTOCK']!=0) {
|
|
$value = 6;
|
|
} else {
|
|
if ($datSnStock[0]['BARANG_ID']!=$datDfk[0]['BARANG_ID']) {
|
|
$value = 5;
|
|
} else {
|
|
if ($datSnStock[0]['GUDANG_SNSTOCK']!=$datDfk[0]['JENIS_KONSINYASI']) {
|
|
$value = 4;
|
|
} else {
|
|
$countBefore = $this->Amod->getCount_SnKonsi_byDFK($id_dfk);
|
|
if ($countBefore>=$datDfk[0]['QTY_DFK']) {
|
|
$value = 3;
|
|
} else {
|
|
$input = [
|
|
'DFK_ID' => $id_dfk,
|
|
'NAMA_SNK' => $nama_snk
|
|
];
|
|
$action = $this->Amod->create('sn_konsi', $input);
|
|
|
|
$update = [
|
|
'STATUS_SNSTOCK' => '16'
|
|
];
|
|
$action = $this->Amod->update('sn_stock', $update, 'ID_SNSTOCK', $datSnStock[0]['ID_SNSTOCK']);
|
|
|
|
$countAfter = $this->Amod->getCount_SnKonsi_byDFK($id_dfk);
|
|
if ($countAfter==$datDfk[0]['QTY_DFK']) {
|
|
$value = 2;
|
|
} else {
|
|
$value = 1;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
}
|
|
|
|
public function SB_Hapus_Sub1_B1_DataSnKonsi() {
|
|
$id_snk = $this->input->post('id_snk');
|
|
$id_dfk = $this->input->post('id_dfk');
|
|
|
|
$value = 0;
|
|
$datDfk = $this->Amod->getData_DaftarKonsi_byID($id_dfk);
|
|
if ($datDfk==FALSE) {
|
|
$value = 4;
|
|
} else {
|
|
$datSnk = $this->Amod->getData_SnKonsi_byID_bySTATUS($id_snk, 16);
|
|
if ($datSnk==FALSE) {
|
|
$value = 3;
|
|
} else {
|
|
$countBefore = $this->Amod->getCount_SnKonsi_byDFK($id_dfk);
|
|
|
|
$update = [
|
|
'STATUS_SNSTOCK' => '0'
|
|
];
|
|
$action = $this->Amod->update('sn_stock', $update, 'ID_SNSTOCK', $datSnk[0]['ID_SNSTOCK']);
|
|
$action = $this->Amod->delete('sn_konsi', $id_snk, 'ID_SNK');
|
|
|
|
if ($countBefore==$datDfk[0]['QTY_DFK']) {
|
|
$value = 2;
|
|
} else {
|
|
$value = 1;
|
|
}
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
}
|
|
|
|
//SUBMENU TRANSAKSI - MODIFIKASI
|
|
public function SB_Sub1_Modifikasi_1() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
$now = date('Y-m-d');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "SB", "TRANSAKSI - Modifikasi");
|
|
$id_menu = $datShm[0]['MENU_ID'];
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$datModifikasi = $this->Amod->getData_Modifikasi_byGUDANG_kunciNull($id_karyawan);
|
|
if ($datModifikasi==TRUE) {
|
|
$id_modifikasi = $datModifikasi[0]['ID_MODIFIKASI'];
|
|
$kode_modifikasi = $datModifikasi[0]['KODE_MODIFIKASI'];
|
|
$kode_asal = $datModifikasi[0]['CKODE'];
|
|
$kode_hasil = $datModifikasi[0]['DKODE'];
|
|
$nama_asal = $datModifikasi[0]['CNAMA'];
|
|
$nama_hasil = $datModifikasi[0]['DNAMA'];
|
|
$asal_modifikasi = $datModifikasi[0]['ASAL_MODIFIKASI'];
|
|
$hasil_modifikasi = $datModifikasi[0]['HASIL_MODIFIKASI'];
|
|
$qty_modifikasi = $datModifikasi[0]['QTY_MODIFIKASI'];
|
|
|
|
$datSnModifikasi0 = $this->Amod->getData_SnModifikasi_byMODIFIKASI_byJENIS($id_modifikasi, 0);
|
|
$sn0 = "";
|
|
$nosn0 = 1;
|
|
foreach ($datSnModifikasi0 as $key) {
|
|
$nama_snmd = $key['NAMA_SNMD'];
|
|
if ($qty_modifikasi==$nosn0) {
|
|
$sn0 .= "$nama_snmd";
|
|
} else {
|
|
$sn0 .= "$nama_snmd, ";
|
|
$nosn0++;
|
|
}
|
|
}
|
|
|
|
$datSnModifikasi1 = $this->Amod->getData_SnModifikasi_byMODIFIKASI_byJENIS($id_modifikasi, 1);
|
|
$sn1 = "";
|
|
$nosn1 = 1;
|
|
foreach ($datSnModifikasi1 as $key) {
|
|
$nama_snmd = $key['NAMA_SNMD'];
|
|
if ($qty_modifikasi==$nosn1) {
|
|
$sn1 .= "$nama_snmd";
|
|
} else {
|
|
$sn1 .= "$nama_snmd, ";
|
|
$nosn1++;
|
|
}
|
|
}
|
|
|
|
$datIo = $this->Amod->getData_TransaksiStock_byMODIFIKASI_statusNull($id_modifikasi);
|
|
|
|
$countSn0 = count($datSnModifikasi0);
|
|
$countSn1 = count($datSnModifikasi1);
|
|
$countIo = count($datIo);
|
|
} else {
|
|
$id_modifikasi = 0;
|
|
$kode_modifikasi = NULL;
|
|
$kode_asal = NULL;
|
|
$kode_hasil = NULL;
|
|
$nama_asal = NULL;
|
|
$nama_hasil = NULL;
|
|
$asal_modifikasi = 0;
|
|
$hasil_modifikasi = 0;
|
|
$qty_modifikasi = 0;
|
|
$datIo = NULL;
|
|
$sn0 = "";
|
|
$sn1 = "";
|
|
$countSn0 = 0;
|
|
$countSn1 = 0;
|
|
$countIo = 0;
|
|
}
|
|
|
|
$datStpos = $this->Amod->getData_SetTogglePosisi_byKARYAWAN_byMENU($id_karyawan, $id_menu);
|
|
if ($datStpos==FALSE) { $posisiToggle = 0; } else { $posisiToggle = $datStpos[0]['AKTIF_STPOS']; }
|
|
|
|
$datBarang = $this->Amod->getData_Barang_bySTATUS_byJENIS_forModifikasi(1, 1);
|
|
$barangIo = $this->Amod->getData_Barang_bySTATUS_byJENIS_forModifikasi(1, 0);
|
|
$datHpar = $this->Amod->getData_HargaPart_byID();
|
|
|
|
$data = array(
|
|
'sidebar' => "menu stokbarang",
|
|
'navChild' => "stokbarang modifikasi",
|
|
'id_menu' => $id_menu,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil,
|
|
'posisiToggle' => $posisiToggle,
|
|
'barang' => $datBarang,
|
|
'barangIo' => $barangIo,
|
|
'hpar' => $datHpar,
|
|
'io' => $datIo,
|
|
'id_modifikasi' => $id_modifikasi,
|
|
'kode_modifikasi' => $kode_modifikasi,
|
|
'kode_asal' => $kode_asal,
|
|
'kode_hasil' => $kode_hasil,
|
|
'nama_asal' => $nama_asal,
|
|
'nama_hasil' => $nama_hasil,
|
|
'countSn0' => $countSn0,
|
|
'countSn1' => $countSn1,
|
|
'countIo' => $countIo,
|
|
'asal_modifikasi' => $asal_modifikasi,
|
|
'hasil_modifikasi' => $hasil_modifikasi,
|
|
'qty_modifikasi' => $qty_modifikasi,
|
|
'sn0' => $sn0,
|
|
'sn1' => $sn1,
|
|
);
|
|
$this->load->view('proses/SB_Sub1_Modifikasi_1', $data);
|
|
}
|
|
|
|
public function SB_Ambil_Sub1_C1_DataSnStockAsal() {
|
|
$asal_modifikasi = $this->input->post('asal_modifikasi');
|
|
|
|
$data = $this->Amod->getData_SnStock_byBARANG_byGUDANG_bySTATUS_forModifikasiAsal($asal_modifikasi, 1, 0);
|
|
|
|
$this->output_json([
|
|
'value' => 1,
|
|
'total' => sizeof($data),
|
|
'data' => $data
|
|
]);
|
|
}
|
|
|
|
public function SB_Ambil_Sub1_C1_DataSnModifikasi() {
|
|
$id_modifikasi = $this->input->post('id_modifikasi');
|
|
$asal_modifikasi = $this->input->post('asal_modifikasi');
|
|
$qty_modifikasi = $this->input->post('qty_modifikasi');
|
|
|
|
$data = $this->Amod->getData_SnModifikasi_byMODIFIKASI_byJENIS($id_modifikasi, 0);
|
|
$snstock = $this->Amod->getData_SnStock_byBARANG_byGUDANG_bySTATUS($asal_modifikasi, 1, 0);
|
|
|
|
$snReady = [];
|
|
foreach ($snstock as $dat) {
|
|
$nama_snstock = $dat['NAMA_SNSTOCK'];
|
|
$hasil = "$nama_snstock";
|
|
array_push($snReady, $hasil);
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => 1,
|
|
'total' => sizeof($data),
|
|
'data' => $data,
|
|
'snReady' => $snReady,
|
|
'qty' => $qty_modifikasi
|
|
]);
|
|
}
|
|
|
|
public function SB_Tambah_Sub1_C1_DataModifikasiAsal() {
|
|
$asal_modifikasi = $this->input->post('asal_modifikasinew');
|
|
$qty_modifikasi = $this->input->post('qty_modifikasinew');
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
$now = date('Y-m-d');
|
|
|
|
$cekKuantiti = $this->GE_AmbilData_DataKuantiti($asal_modifikasi, 1);
|
|
if ($cekKuantiti<$qty_modifikasi) {
|
|
$this->session->set_flashdata('qty_pcm_less', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$datModifikasi = $this->Amod->getData_Modifikasi_byGUDANG_kunciNull($id_karyawan);
|
|
if ($datModifikasi==FALSE) {
|
|
$kode_modifikasi = $this->Amod->generate_kodeModifikasi();
|
|
$input = [
|
|
'CIPTA_MODIFIKASI' => "Oleh $panggilan pada $timestamp",
|
|
'GUDANG_ID' => $id_karyawan,
|
|
'KODE_MODIFIKASI' => $kode_modifikasi,
|
|
'ASAL_MODIFIKASI' => $asal_modifikasi,
|
|
'QTY_MODIFIKASI' => $qty_modifikasi
|
|
];
|
|
$action = $this->Amod->create('modifikasi', $input);
|
|
} else {
|
|
$cekModifikasi = $this->Amod->getData_Modifikasi_byGUDANG_byJENIS_byBARANG_kunciNull($id_karyawan, 0, $asal_modifikasi);
|
|
if ($cekModifikasi==TRUE) {
|
|
$this->session->set_flashdata('barangid_same', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
}
|
|
|
|
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 SB_Tambah_Sub1_C1_DataModifikasiHasil() {
|
|
$id_modifikasi = $this->input->post('id_modifikasinew');
|
|
$hasil_modifikasi = $this->input->post('hasil_modifikasinew');
|
|
$kode_baranghasil = $this->input->post('kode_baranghasil');
|
|
$nama_baranghasil = $this->input->post('nama_baranghasil');
|
|
$kode_baranghasil = strtoupper(ltrim(rtrim(preg_replace('/\R+/', " " , $kode_baranghasil))));
|
|
$nama_baranghasil = ltrim(rtrim(preg_replace('/\R+/', " " , $nama_baranghasil)));
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
$now = date('Y-m-d');
|
|
|
|
$datModifikasi = $this->Amod->getData_Modifikasi_byID_byGUDANG_kunciNull($id_modifikasi, $id_karyawan);
|
|
if ($datModifikasi==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
if ($hasil_modifikasi=="") {
|
|
$cekKode = $this->Amod->getData_Barang_byKODE_bySTATUS($kode_baranghasil, 1);
|
|
if ($cekKode==TRUE) {
|
|
$this->session->set_flashdata('kode_same', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$cekNama = $this->Amod->getData_Barang_byNAMA_bySTATUS($nama_baranghasil, 1);
|
|
if ($cekNama==TRUE) {
|
|
$this->session->set_flashdata('name_same', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$datBarang = $this->Amod->getData_Barang_byID($datModifikasi[0]['ASAL_MODIFIKASI']);
|
|
$cekBarang = $this->Amod->getData_Barang_byKODE_bySTATUS($kode_baranghasil, 0);
|
|
if ($cekBarang==TRUE) {
|
|
$hasil_modifikasi = $cekBarang[0]['ID_BARANG'];
|
|
$update = [
|
|
'KODE_BARANG' => $kode_baranghasil,
|
|
'NAMA_BARANG' => $nama_baranghasil,
|
|
'JENIS_ID' => $datBarang[0]['JENIS_ID'],
|
|
'MERK_ID' => $datBarang[0]['MERK_ID'],
|
|
'MODEL_ID' => $datBarang[0]['MODEL_ID'],
|
|
'PRODUK_ID' => $datBarang[0]['PRODUK_ID'],
|
|
'GARANSI_BARANG' => $datBarang[0]['GARANSI_BARANG'],
|
|
'STATUS_BARANG' => '1',
|
|
'TAMBAH_BARANG' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('barang', $update, 'ID_BARANG', $hasil_modifikasi);
|
|
} else {
|
|
$input = [
|
|
'KODE_BARANG' => $kode_baranghasil,
|
|
'NAMA_BARANG' => $nama_baranghasil,
|
|
'JENIS_ID' => $datBarang[0]['JENIS_ID'],
|
|
'MERK_ID' => $datBarang[0]['MERK_ID'],
|
|
'MODEL_ID' => $datBarang[0]['MODEL_ID'],
|
|
'PRODUK_ID' => $datBarang[0]['PRODUK_ID'],
|
|
'GARANSI_BARANG' => $datBarang[0]['GARANSI_BARANG'],
|
|
'STATUS_BARANG' => '1',
|
|
'TAMBAH_BARANG' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->create('barang', $input);
|
|
|
|
$hasil_modifikasi = $this->Amod->getMax_ID_Barang();
|
|
$hasil_modifikasi = $hasil_modifikasi[0]['ID_BARANG'];
|
|
|
|
$input = [
|
|
'ID_KUANTITI' => $hasil_modifikasi,
|
|
'GLOBAL_KUANTITI' => '0',
|
|
'PCM_KUANTITI' => '0',
|
|
'ITP_KUANTITI' => '0',
|
|
'PROSES_KUANTITI' => '0',
|
|
'ANTIK_KUANTITI' => '0',
|
|
'KONSINYASI_KUANTITI' => '0',
|
|
'MUTASI_KUANTITI' => '0',
|
|
'PEMINJAMAN_KUANTITI' => '0',
|
|
'PENDING_KUANTITI' => '0',
|
|
'PROYEK_KUANTITI' => '0',
|
|
'SERVICE_KUANTITI' => '0',
|
|
'SEWA_KUANTITI' => '0',
|
|
'TERCABUT_KUANTITI' => '0',
|
|
'PERSEDIAAN_KUANTITI' => '0',
|
|
];
|
|
$action = $this->Amod->create('kuantiti', $input);
|
|
}
|
|
} else {
|
|
$datBarang = $this->Amod->getData_Barang_byID_bySTATUS($hasil_modifikasi, 1);
|
|
if ($datBarang==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
}
|
|
|
|
$update = [
|
|
'HASIL_MODIFIKASI' => $hasil_modifikasi
|
|
];
|
|
$action = $this->Amod->update('modifikasi', $update, 'ID_MODIFIKASI', $id_modifikasi);
|
|
|
|
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 SB_Tambah_Sub1_C1_DataTransaksiStock() {
|
|
$id_modifikasi = $this->input->post('id_modifikasi');
|
|
$jenis_io = $this->input->post('jenis_io');
|
|
$id_barang = $this->input->post('id_barangnew');
|
|
$qty_io = $this->input->post('qty_ionew');
|
|
$id_hpar = $this->input->post('id_hparnew');
|
|
$ket_io = $this->input->post('ket_ionew');
|
|
$ket_io = ltrim(rtrim(preg_replace('/\R+/', " " , $ket_io)));
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
$now = date('Y-m-d');
|
|
|
|
$datModifikasi = $this->Amod->getData_Modifikasi_byID_byGUDANG_kunciNull($id_modifikasi, $id_karyawan);
|
|
if ($datModifikasi==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$cekKuantiti = $this->GE_AmbilData_DataKuantiti($id_barang, 1);
|
|
if ($jenis_io==0 AND $cekKuantiti<$qty_io) {
|
|
$this->session->set_flashdata('qty_pcm_less', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$datIo = $this->Amod->getData_TransaksiStock_byMODIFIKASI_byBARANG_statusNull($id_modifikasi, $id_barang);
|
|
if ($datIo==TRUE) {
|
|
$this->session->set_flashdata('barangid_same', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
if ($jenis_io==0) {
|
|
$this->GE_Kalkulasi_KuantitiBarang($id_barang, 1, "Step 1 - KELUARMASUK - Tambah Barang", 0, $qty_io);
|
|
}
|
|
|
|
if ($jenis_io==0) {
|
|
$input = [
|
|
'CIPTA_IO' => "Oleh $panggilan pada $timestamp",
|
|
'TGL_IO' => $now,
|
|
'KODE_BUKTI' => $datModifikasi[0]['KODE_MODIFIKASI'],
|
|
'JENIS_IO' => $jenis_io,
|
|
'GUDANG_IO' => '1',
|
|
'KARYAWAN_ID' => $id_karyawan,
|
|
'BARANG_ID' => $id_barang,
|
|
'QTY_IO' => $qty_io,
|
|
'KET_IO' => $ket_io,
|
|
'MODIFIKASI_ID' => $id_modifikasi,
|
|
];
|
|
$action = $this->Amod->create('transaksi_stock', $input);
|
|
} else if ($jenis_io==1) {
|
|
$datHpar = $this->Amod->getData_HargaPart_byID($id_hpar);
|
|
$harga_io = $datHpar[0]['HPP_HPAR']/2;
|
|
$input = [
|
|
'CIPTA_IO' => "Oleh $panggilan pada $timestamp",
|
|
'TGL_IO' => $now,
|
|
'KODE_BUKTI' => $datModifikasi[0]['KODE_MODIFIKASI'],
|
|
'HPAR_ID' => $id_hpar,
|
|
'JENIS_IO' => $jenis_io,
|
|
'HARGA_IO' => $harga_io,
|
|
'GUDANG_IO' => '1',
|
|
'KARYAWAN_ID' => $id_karyawan,
|
|
'BARANG_ID' => $id_barang,
|
|
'QTY_IO' => $qty_io,
|
|
'KET_IO' => $ket_io,
|
|
'MODIFIKASI_ID' => $id_modifikasi,
|
|
];
|
|
$action = $this->Amod->create('transaksi_stock', $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 SB_Simpan_Sub1_C1_DataSnModifikasi() {
|
|
$id_snstock = $this->input->post('id_snstock');
|
|
$asal_modifikasi = $this->input->post('asal_modifikasi');
|
|
$id_modifikasi = $this->input->post('id_modifikasi');
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
|
|
$value = 0;
|
|
$datModifikasi = $this->Amod->getData_Modifikasi_byID_byGUDANG_kunciNull($id_modifikasi, $id_karyawan);
|
|
if ($datModifikasi==FALSE) {
|
|
$value = 8;
|
|
} else {
|
|
$datSnStock = $this->Amod->getData_SnStock_byID($id_snstock);
|
|
if ($datSnStock==FALSE) {
|
|
$value = 7;
|
|
} else {
|
|
if ($datSnStock[0]['STATUS_SNSTOCK']!=0) {
|
|
$value = 6;
|
|
} else {
|
|
if ($datSnStock[0]['BARANG_ID']!=$asal_modifikasi) {
|
|
$value = 5;
|
|
} else {
|
|
if ($datSnStock[0]['GUDANG_SNSTOCK']!=1) {
|
|
$value = 4;
|
|
} else {
|
|
$countBefore = $this->Amod->getCount_SnModifikasi_byMODIFIKASI_byJENIS($id_modifikasi, 0);
|
|
if ($countBefore>=$datModifikasi[0]['QTY_MODIFIKASI']) {
|
|
$value = 3;
|
|
} else {
|
|
$nama_snmd = $datSnStock[0]['NAMA_SNSTOCK'];
|
|
$input = [
|
|
'MODIFIKASI_ID' => $id_modifikasi,
|
|
'NAMA_SNMD' => $nama_snmd,
|
|
'JENIS_SNMD' => '0'
|
|
];
|
|
$action = $this->Amod->create('sn_modifikasi', $input);
|
|
|
|
$input = [
|
|
'MODIFIKASI_ID' => $id_modifikasi,
|
|
'NAMA_SNMD' => "$nama_snmd.",
|
|
'JENIS_SNMD' => '1'
|
|
];
|
|
$action = $this->Amod->create('sn_modifikasi', $input);
|
|
|
|
$countAfter = $this->Amod->getCount_SnModifikasi_byMODIFIKASI_byJENIS($id_modifikasi, 0);
|
|
if ($countAfter==$datModifikasi[0]['QTY_MODIFIKASI']) {
|
|
$value = 2;
|
|
} else {
|
|
$value = 1;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
}
|
|
|
|
public function SB_Simpan_Sub1_C1_DataSnModifikasiBarcode() {
|
|
$id_snmd = $this->input->post('id_snmd');
|
|
$id_modifikasi = $this->input->post('id_modifikasi');
|
|
$nama_snmd = $this->input->post('nama_snmd');
|
|
$nama_snmd = strtoupper($nama_snmd);
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
|
|
$value = 0;
|
|
$datModifikasi = $this->Amod->getData_Modifikasi_byID_byGUDANG_kunciNull($id_modifikasi, $id_karyawan);
|
|
if ($datModifikasi==FALSE) {
|
|
$value = 8;
|
|
} else {
|
|
$datSnStock = $this->Amod->getData_SnStock_byNAMA_allStatus($nama_snmd);
|
|
if ($datSnStock==FALSE) {
|
|
$value = 7;
|
|
} else {
|
|
if ($datSnStock[0]['STATUS_SNSTOCK']!=0) {
|
|
$value = 6;
|
|
} else {
|
|
if ($datSnStock[0]['BARANG_ID']!=$datModifikasi[0]['ASAL_MODIFIKASI']) {
|
|
$value = 5;
|
|
} else {
|
|
if ($datSnStock[0]['GUDANG_SNSTOCK']!=1) {
|
|
$value = 4;
|
|
} else {
|
|
$countBefore = $this->Amod->getCount_SnModifikasi_byMODIFIKASI_byJENIS($id_modifikasi, 0);
|
|
if ($countBefore>=$datModifikasi[0]['QTY_MODIFIKASI']) {
|
|
$value = 3;
|
|
} else {
|
|
$input = [
|
|
'MODIFIKASI_ID' => $id_modifikasi,
|
|
'NAMA_SNMD' => $nama_snmd,
|
|
'JENIS_SNMD' => '0'
|
|
];
|
|
$action = $this->Amod->create('sn_modifikasi', $input);
|
|
|
|
$input = [
|
|
'MODIFIKASI_ID' => $id_modifikasi,
|
|
'NAMA_SNMD' => "$nama_snmd.",
|
|
'JENIS_SNMD' => '1'
|
|
];
|
|
$action = $this->Amod->create('sn_modifikasi', $input);
|
|
|
|
$countAfter = $this->Amod->getCount_SnModifikasi_byMODIFIKASI_byJENIS($id_modifikasi, 0);
|
|
if ($countAfter==$datModifikasi[0]['QTY_MODIFIKASI']) {
|
|
$value = 2;
|
|
} else {
|
|
$value = 1;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
}
|
|
|
|
public function SB_Ubah_Sub1_C1_DataModifikasi() {
|
|
$id_modifikasi = $this->input->post('id_modifikasied');
|
|
$asal_modifikasi = $this->input->post('asal_modifikasied');
|
|
$qty_modifikasi = $this->input->post('qty_modifikasied');
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
$now = date('Y-m-d');
|
|
|
|
$datModifikasi = $this->Amod->getData_Modifikasi_byID_byGUDANG_kunciNull($id_modifikasi, $id_karyawan);
|
|
if ($datModifikasi==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
if ($asal_modifikasi!="") {
|
|
$cekKuantiti = $this->GE_AmbilData_DataKuantiti($asal_modifikasi, 1);
|
|
if ($cekKuantiti<$qty_modifikasi) {
|
|
$this->session->set_flashdata('qty_pcm_less', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
$countSnmd = $this->Amod->getCount_SnModifikasi_byMODIFIKASI_byJENIS($id_modifikasi, 0);
|
|
if ($countSnmd>$qty_modifikasi) {
|
|
$this->session->set_flashdata('sncount_fillmore', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
} else {
|
|
$cekKuantiti = $this->GE_AmbilData_DataKuantiti($datModifikasi[0]['ASAL_MODIFIKASI'], 1);
|
|
if ($cekKuantiti<$qty_modifikasi) {
|
|
$this->session->set_flashdata('qty_pcm_less', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
}
|
|
|
|
if ($asal_modifikasi!="") {
|
|
$action = $this->Amod->delete('sn_modifikasi', $id_modifikasi, 'MODIFIKASI_ID');
|
|
} else {
|
|
$asal_modifikasi = $datModifikasi[0]['ASAL_MODIFIKASI'];
|
|
}
|
|
|
|
$update = [
|
|
'ASAL_MODIFIKASI' => $asal_modifikasi,
|
|
'QTY_MODIFIKASI' => $qty_modifikasi
|
|
];
|
|
$action = $this->Amod->update('modifikasi', $update, 'ID_MODIFIKASI', $id_modifikasi);
|
|
|
|
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 SB_Ubah_Sub1_C1_DataTransaksiStock() {
|
|
$id_modifikasi = $this->input->post('id_modifikasiioed');
|
|
$id_io = $this->input->post('id_ioed');
|
|
$id_hpar = $this->input->post('id_hpared');
|
|
$ket_io = $this->input->post('ket_ioed');
|
|
$ket_io = ltrim(rtrim(preg_replace('/\R+/', " " , $ket_io)));
|
|
$now = date('Y-m-d');
|
|
|
|
$datIo = $this->Amod->getData_TransaksiStock_byID_byMODIFIKASI_statusNull($id_io, $id_modifikasi);
|
|
if ($datIo==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
if ($datIo[0]['JENIS_IO']==0) {
|
|
$update = [
|
|
'KET_IO' => $ket_io
|
|
];
|
|
} else if ($datIo[0]['JENIS_IO']==1) {
|
|
$datHpar = $this->Amod->getData_HargaPart_byID($id_hpar);
|
|
$harga_io = $datHpar[0]['HPP_HPAR']/2;
|
|
|
|
$update = [
|
|
'HPAR_ID' => $id_hpar,
|
|
'HARGA_IO' => $harga_io,
|
|
'KET_IO' => $ket_io
|
|
];
|
|
}
|
|
$action = $this->Amod->update('transaksi_stock', $update, 'ID_IO', $id_io);
|
|
|
|
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 SB_Hapus_Sub1_C1_DataModifikasiAsal() {
|
|
$id_modifikasi = $this->input->post('id_modifikasidel');
|
|
$asal_modifikasi = $this->input->post('asal_modifikasidel');
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$datModifikasi = $this->Amod->getData_Modifikasi_byID_byGUDANG_kunciNull($id_modifikasi, $id_karyawan);
|
|
if ($datModifikasi==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$datIo = $this->Amod->getData_TransaksiStock_byMODIFIKASI_byJENIS_statusNull($id_modifikasi, 0);
|
|
foreach ($datIo as $key) {
|
|
$this->GE_Kalkulasi_KuantitiBarang($key['BARANG_ID'], 1, "Step 1 - KELUARMASUK - Hapus Barang", 0, $key['QTY_IO']);
|
|
}
|
|
|
|
$action = $this->Amod->delete('transaksi_stock', $id_modifikasi, 'MODIFIKASI_ID');
|
|
$action = $this->Amod->delete('sn_modifikasi', $id_modifikasi, 'MODIFIKASI_ID');
|
|
$action = $this->Amod->delete('modifikasi', $id_modifikasi, 'ID_MODIFIKASI');
|
|
|
|
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 SB_Hapus_Sub1_C1_DataModifikasiHasil() {
|
|
$id_modifikasi = $this->input->post('id_modifikasidel');
|
|
$hasil_modifikasi = $this->input->post('hasil_modifikasidel');
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$datModifikasi = $this->Amod->getData_Modifikasi_byID_byGUDANG_kunciNull($id_modifikasi, $id_karyawan);
|
|
if ($datModifikasi==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$datHq = $this->Amod->getData_HistoriKuantiti_byBARANG($datModifikasi[0]['HASIL_MODIFIKASI']);
|
|
$datDb = $this->Amod->getData_DaftarBeli_byBARANG($datModifikasi[0]['HASIL_MODIFIKASI']);
|
|
$datDo = $this->Amod->getData_DaftarOrder_byBARANG($datModifikasi[0]['HASIL_MODIFIKASI']);
|
|
$datIo = $this->Amod->getData_TransaksiStock_byBARANG($datModifikasi[0]['HASIL_MODIFIKASI']);
|
|
if ($datHq==FALSE AND $datDb==FALSE AND $datDo==FALSE AND $datIo==FALSE) {
|
|
$update = [
|
|
'STATUS_BARANG' => '0',
|
|
'HAPUS_BARANG' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('barang', $update, 'ID_BARANG', $datModifikasi[0]['HASIL_MODIFIKASI']);
|
|
}
|
|
|
|
$update = [
|
|
'HASIL_MODIFIKASI' => NULL
|
|
];
|
|
$action = $this->Amod->update('modifikasi', $update, 'ID_MODIFIKASI', $id_modifikasi);
|
|
|
|
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 SB_Hapus_Sub1_C1_DataSnModifikasi() {
|
|
$id_snmd = $this->input->post('id_snmd');
|
|
$id_modifikasi = $this->input->post('id_modifikasi');
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
|
|
$value = 0;
|
|
$datModifikasi = $this->Amod->getData_Modifikasi_byID_byGUDANG_kunciNull($id_modifikasi, $id_karyawan);
|
|
if ($datModifikasi==FALSE) {
|
|
$value = 4;
|
|
} else {
|
|
$datSnmd = $this->Amod->getData_SnModifikasi_byID($id_snmd);
|
|
if ($datSnmd==FALSE) {
|
|
$value = 3;
|
|
} else {
|
|
$countBefore = $this->Amod->getCount_SnModifikasi_byMODIFIKASI_byJENIS($id_modifikasi, 0);
|
|
|
|
$action = $this->Amod->delete('sn_modifikasi', $id_snmd, 'ID_SNMD');
|
|
|
|
if ($countBefore==$datModifikasi[0]['QTY_MODIFIKASI']) {
|
|
$value = 2;
|
|
} else {
|
|
$value = 1;
|
|
}
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
}
|
|
|
|
public function SB_Hapus_Sub1_C1_DataTransaksiStock() {
|
|
$id_io = $this->input->post('id_iodel');
|
|
$id_modifikasi = $this->input->post('id_modifikasiiodel');
|
|
|
|
$datIo = $this->Amod->getData_TransaksiStock_byID_byMODIFIKASI_statusNull($id_io, $id_modifikasi);
|
|
if ($datIo==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
if ($datIo[0]['JENIS_IO']==0) {
|
|
$this->GE_Kalkulasi_KuantitiBarang($datIo[0]['BARANG_ID'], 1, "Step 1 - KELUARMASUK - Hapus Barang", 0, $datIo[0]['QTY_IO']);
|
|
}
|
|
|
|
$action = $this->Amod->delete('transaksi_stock', $id_io, 'ID_IO');
|
|
|
|
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 SB_Kunci_Sub1_C1_DataModifikasi() {
|
|
$id_modifikasi = $this->input->post('id_modifikasilock');
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
$now = date('Y-m-d');
|
|
|
|
$datModifikasi = $this->Amod->getData_Modifikasi_byID_byGUDANG_kunciNull($id_modifikasi, $id_karyawan);
|
|
if ($datModifikasi==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$countSnmd = $this->Amod->getCount_SnModifikasi_byMODIFIKASI_byJENIS($id_modifikasi, 0);
|
|
if ($countSnmd<$datModifikasi[0]['QTY_MODIFIKASI']) {
|
|
$this->session->set_flashdata('sncount_less', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$cekKuantiti = $this->GE_AmbilData_DataKuantiti($datModifikasi[0]['ASAL_MODIFIKASI'], 1);
|
|
if ($cekKuantiti<$datModifikasi[0]['QTY_MODIFIKASI']) {
|
|
$this->session->set_flashdata('qty_pcm_less', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$kode_modifikasi = $datModifikasi[0]['KODE_MODIFIKASI'];
|
|
$kode_hasil = $datModifikasi[0]['DKODE'];
|
|
|
|
//Keluarkan Modifikasi Asal
|
|
$input = [
|
|
'CIPTA_IO' => "Oleh $panggilan pada $timestamp",
|
|
'TGL_IO' => $now,
|
|
'KODE_BUKTI' => $kode_modifikasi,
|
|
'JIO_ID' => '5',
|
|
'JENIS_IO' => '0',
|
|
'GUDANG_IO' => '1',
|
|
'KARYAWAN_ID' => $id_karyawan,
|
|
'BARANG_ID' => $datModifikasi[0]['ASAL_MODIFIKASI'],
|
|
'QTY_IO' => $datModifikasi[0]['QTY_MODIFIKASI'],
|
|
'KET_IO' => "Modifikasi Barang dari Kode $kode_modifikasi menjadi $kode_hasil",
|
|
'MODIFIKASI_ID' => $id_modifikasi
|
|
];
|
|
$action = $this->Amod->create('transaksi_stock', $input);
|
|
|
|
$id_io0 = $this->Amod->getMax_ID_TransaksiStock();
|
|
$id_io0 = $id_io0[0]['ID_IO'];
|
|
|
|
$datSnmd0 = $this->Amod->getData_SnModifikasi_byMODIFIKASI_byJENIS($id_modifikasi, 0);
|
|
foreach ($datSnmd0 as $key) {
|
|
$datSnStock = $this->Amod->getData_SnStock_byNAMA_bySTATUS($key['NAMA_SNMB'], 0);
|
|
if ($datSnStock==TRUE) {
|
|
$input = [
|
|
'JENIS_SNIO' => '0',
|
|
'IO_ID' => $id_io0,
|
|
'NAMA_SNIO' => $key['NAMA_SNMD']
|
|
];
|
|
$action = $this->Amod->create('sn_io', $input);
|
|
|
|
$update = [
|
|
'STATUS_SNSTOCK' => '13'
|
|
];
|
|
$action = $this->Amod->update('sn_stock', $update, 'ID_SNSTOCK', $datSnStock[0]['ID_SNSTOCK']);
|
|
}
|
|
}
|
|
|
|
$this->GE_Kalkulasi_KuantitiBarang($datModifikasi[0]['ASAL_MODIFIKASI'], 1, "Step 1 - KELUARMASUK - Tambah Barang", 0, $datModifikasi[0]['QTY_MODIFIKASI']);
|
|
|
|
//Masukkan Modifikasi Hasil
|
|
$datHq = $this->Amod->getData_HistoriKuantiti_byBARANG_orderDESC_limit1($datModifikasi[0]['ASAL_MODIFIKASI']);
|
|
if ($datHq==FALSE) {
|
|
$harga_io = 0;
|
|
} else {
|
|
$harga_io = $datHq[0]['AVG_HQ'];
|
|
}
|
|
|
|
$input = [
|
|
'CIPTA_IO' => "Oleh $panggilan pada $timestamp",
|
|
'TGL_IO' => $now,
|
|
'KODE_BUKTI' => $kode_modifikasi,
|
|
'JIO_ID' => '5',
|
|
'JENIS_IO' => '1',
|
|
'GUDANG_IO' => '1',
|
|
'KARYAWAN_ID' => $id_karyawan,
|
|
'HARGA_IO' => $harga_io,
|
|
'BARANG_ID' => $datModifikasi[0]['HASIL_MODIFIKASI'],
|
|
'QTY_IO' => $datModifikasi[0]['QTY_MODIFIKASI'],
|
|
'KET_IO' => "Hasil Modifikasi Barang dari Kode $kode_modifikasi",
|
|
'MODIFIKASI_ID' => $id_modifikasi
|
|
];
|
|
$action = $this->Amod->create('transaksi_stock', $input);
|
|
|
|
$id_io1 = $this->Amod->getMax_ID_TransaksiStock();
|
|
$id_io1 = $id_io1[0]['ID_IO'];
|
|
|
|
$datSnmd1 = $this->Amod->getData_SnModifikasi_byMODIFIKASI_byJENIS($id_modifikasi, 1);
|
|
foreach ($datSnmd1 as $key) {
|
|
$input = [
|
|
'JENIS_SNIO' => '1',
|
|
'IO_ID' => $id_io1,
|
|
'NAMA_SNIO' => $key['NAMA_SNMD']
|
|
];
|
|
$action = $this->Amod->create('sn_io', $input);
|
|
}
|
|
|
|
//Finishing Modifikasi
|
|
$datIo = $this->Amod->getData_TransaksiStock_byMODIFIKASI_statusNull($id_modifikasi);
|
|
foreach ($datIo as $key) {
|
|
if ($key['JENIS_IO']==0) {
|
|
if ($key['TYPE_JENIS']==1) {
|
|
$datSnio = $this->Amod->getData_SnIo_byIO($key['ID_IO']);
|
|
foreach ($datSnio as $dat) {
|
|
$datSnStock = $this->Amod->getData_SnStock_byNAMA_bySTATUS($dat['NAMA_SNIO'], 13);
|
|
$input = [
|
|
'TGL_HSN' => $now,
|
|
'KODE_BUKTI' => $kode_modifikasi,
|
|
'SNSTOCK_ID' => $datSnStock[0]['ID_SNSTOCK']
|
|
];
|
|
$action = $this->Amod->create('histori_sn', $input);
|
|
|
|
$update = [
|
|
'STATUS_SNSTOCK' => '3'
|
|
];
|
|
$action = $this->Amod->update('sn_stock', $update, 'ID_SNSTOCK', $datSnStock[0]['ID_SNSTOCK']);
|
|
}
|
|
}
|
|
$this->GE_Kalkulasi_KuantitiBarang($key['BARANG_ID'], 1, "Step 1 - STOK BARANG - Kunci Modifikasi", '0', $key['QTY_IO']);
|
|
$this->GE_Kalkulasi_HistoriKuantiti($key['BARANG_ID'], "Step 1 - STOK BARANG - Kunci Modifikasi", '0', $key['QTY_IO'], $kode_modifikasi, '0', '0');
|
|
} else if ($key['JENIS_IO']==1) {
|
|
if ($key['TYPE_JENIS']==1) {
|
|
$datSnio = $this->Amod->getData_SnIo_byIO($key['ID_IO']);
|
|
foreach ($datSnio as $dat) {
|
|
$snLama = substr($dat['NAMA_SNMD'], 0, -1);
|
|
$datSnStockOld = $this->Amod->getData_SnStock_byNAMA_allStatus($snLama);
|
|
if ($datSnStockOld==FALSE) {
|
|
$kop_snstock = 1;
|
|
} else {
|
|
$kop_snstock = $datSnStockOld[0]['KOP_SNSTOCK'];
|
|
}
|
|
|
|
$input = [
|
|
'BARANG_ID' => $key['BARANG_ID'],
|
|
'NAMA_SNSTOCK' => $dat['NAMA_SNMD'],
|
|
'KOP_SNSTOCK' => $kop_snstock,
|
|
'GUDANG_SNSTOCK' => '1',
|
|
'STATUS_SNSTOCK' => '0'
|
|
];
|
|
$action = $this->Amod->create('sn_stock', $input);
|
|
|
|
$id_snstock = $this->Amod->getMax_ID_SnStock();
|
|
$id_snstock = $id_snstock[0]['ID_SNSTOCK'];
|
|
|
|
$input = [
|
|
'TGL_HSN' => $now,
|
|
'KODE_BUKTI' => $kode_modifikasi,
|
|
'SNSTOCK_ID' => $id_snstock
|
|
];
|
|
$action = $this->Amod->create('histori_sn', $input);
|
|
|
|
$namaBaru = substr($dat['NAMA_SNMD'], 0, -1);
|
|
$datSnkpr = $this->Amod->getData_SnKlaimProgram_byNAMA($namaBaru);
|
|
if ($datSnkpr==TRUE) {
|
|
$update = [
|
|
'SNSTOCK_ID' => $id_snstock,
|
|
'NAMA_SNKPR' => $dat['NAMA_SNMD']
|
|
];
|
|
$action = $this->Amod->update('sn_klaimprogram', $update, 'ID_SNKPR', $datSnkpr[0]['ID_SNKPR']);
|
|
}
|
|
}
|
|
}
|
|
$this->GE_Kalkulasi_KuantitiBarang($key['BARANG_ID'], 1, "Step 1 - STOK BARANG - Kunci Modifikasi", '1', $key['QTY_IO']);
|
|
$this->GE_Kalkulasi_HistoriKuantiti($key['BARANG_ID'], "Step 1 - STOK BARANG - Kunci Modifikasi", '1', $key['QTY_IO'], $kode_modifikasi, '0', $key['ID_IO']);
|
|
}
|
|
|
|
$update = [
|
|
'STATUS_IO' => '1',
|
|
'PROSES_IO' => "Oleh $panggilan pada $timestamp",
|
|
];
|
|
$action = $this->Amod->update('transaksi_stock', $update, 'ID_IO', $key['ID_IO']);
|
|
}
|
|
|
|
$update = [
|
|
'KUNCI_MODIFIKASI' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('modifikasi', $update, 'ID_MODIFIKASI', $id_modifikasi);
|
|
|
|
if ($action) {
|
|
$this->session->set_flashdata('success', 'dikunci');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
} else {
|
|
$this->session->set_flashdata('failed', 'dikunci');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
}
|
|
|
|
//SUBMENU TRANSAKSI - MUTASI BARANG
|
|
public function SB_Sub1_MutasiBarang_1() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
$now = date('Y-m-d');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "SB", "TRANSAKSI - Mutasi Barang");
|
|
$id_menu = $datShm[0]['MENU_ID'];
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$datSgu = $this->Amod->getData_SetGudang_byKARYAWAN_byMENU($id_karyawan, $id_menu);
|
|
if ($datSgu==FALSE) {
|
|
$aktif = 0;
|
|
$input = [
|
|
'KARYAWAN_ID' => $id_karyawan,
|
|
'MENU_ID' => $id_menu,
|
|
'AKTIF_SGU' => $aktif,
|
|
'TIMESTAMP' => $timestamp
|
|
];
|
|
$action = $this->Amod->create('set_gudang', $input);
|
|
} else {
|
|
$aktif = $datSgu[0]['AKTIF_SGU'];
|
|
}
|
|
|
|
$datMb = $this->Amod->getData_MutasiBarang_byADMIN_bySTATUS($id_karyawan, 0);
|
|
if ($datMb==TRUE) {
|
|
$id_mb = $datMb[0]['ID_MB'];
|
|
$datDmb = $this->Amod->getData_DaftarMutasiBarang_byMB($id_mb);
|
|
$no = 0;
|
|
foreach ($datDmb as $key) {
|
|
$count = $this->Amod->getCount_SnMutasiBarang_byMB_byDMB($id_mb, $key['ID_DMB']);
|
|
$datDmb[$no++] += ['REAL' => $count];
|
|
}
|
|
$countProses = count($datDmb);
|
|
} else {
|
|
$datDmb = NULL;
|
|
$id_mb = NULL;
|
|
$countProses = 0;
|
|
}
|
|
|
|
$datMutasiTunggu = $this->Amod->getData_MutasiBarang_byMODE_byJENIS(1, $aktif);
|
|
$no = 0;
|
|
foreach ($datMutasiTunggu as $key) {
|
|
$datDmbPro = $this->Amod->getData_DaftarMutasiBarang_byMB($key['ID_MB']);
|
|
$nomb = 0;
|
|
$sn = "";
|
|
foreach ($datDmbPro as $dat) {
|
|
$datSnmb = $this->Amod->getData_SnMutasiBarang_byDMB_byMB($dat['ID_DMB'], $key['ID_MB']);
|
|
foreach ($datSnmb as $dit) {
|
|
$nama_snmb = $dit['NAMA_SNMB'];
|
|
$sn .= "$nama_snmb, ";
|
|
}
|
|
$datDmbPro[$nomb++] += ['SN' => $sn];
|
|
$sn = "";
|
|
}
|
|
$datMutasiTunggu[$no++] += ['BARANG' => $datDmbPro];
|
|
}
|
|
|
|
$datMutasiTerima = $this->Amod->getData_MutasiBarang_byMODE_byJENIS(2, $aktif);
|
|
$no = 0;
|
|
foreach ($datMutasiTerima as $key) {
|
|
$datDmbPro = $this->Amod->getData_DaftarMutasiBarang_byMB($key['ID_MB']);
|
|
$nomb = 0;
|
|
$sn = "";
|
|
foreach ($datDmbPro as $dat) {
|
|
$datSnmb = $this->Amod->getData_SnMutasiBarang_byDMB_byMB($dat['ID_DMB'], $key['ID_MB']);
|
|
foreach ($datSnmb as $dit) {
|
|
$nama_snmb = $dit['NAMA_SNMB'];
|
|
$sn .= "$nama_snmb, ";
|
|
}
|
|
$datDmbPro[$nomb++] += ['SN' => $sn];
|
|
$sn = "";
|
|
}
|
|
$datMutasiTerima[$no++] += ['BARANG' => $datDmbPro];
|
|
}
|
|
|
|
$datStpos = $this->Amod->getData_SetTogglePosisi_byKARYAWAN_byMENU($id_karyawan, $id_menu);
|
|
if ($datStpos==FALSE) { $posisiToggle = 0; } else { $posisiToggle = $datStpos[0]['AKTIF_STPOS']; }
|
|
|
|
|
|
if ($id_karyawan==21) { // ITP Only
|
|
$jenis = 2;
|
|
} else if ($id_karyawan==53) { // Service Only
|
|
$jenis = 3;
|
|
} else {
|
|
$jenis = 1;
|
|
}
|
|
|
|
$datBarang = $this->Amod->getData_Barang_bySTATUS_jenisNot2(1, $jenis);
|
|
|
|
$data = array(
|
|
'sidebar' => "menu stokbarang",
|
|
'navChild' => "stokbarang mutasibarang",
|
|
'id_menu' => $id_menu,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil,
|
|
'id_mb' => $id_mb,
|
|
'aktif' => $aktif,
|
|
'dmb' => $datDmb,
|
|
'mbTunggu' => $datMutasiTunggu,
|
|
'mbTerima' => $datMutasiTerima,
|
|
'countProses' => $countProses,
|
|
'countTunggu' => count($datMutasiTunggu),
|
|
'countTerima' => count($datMutasiTerima),
|
|
'posisiToggle' => $posisiToggle,
|
|
'barang' => $datBarang,
|
|
);
|
|
$this->load->view('proses/SB_Sub1_MutasiBarang_1', $data);
|
|
}
|
|
|
|
public function SB_Ambil_Sub1_D1_DataSnStock() {
|
|
$id_dmb = $this->input->post('id_dmb');
|
|
|
|
$datDmb = $this->Amod->getData_DaftarMutasiBarang_byID($id_dmb);
|
|
if ($datDmb[0]['JENIS_MB']==1) {
|
|
$gudang = 2;
|
|
} else if ($datDmb[0]['JENIS_MB']==3) {
|
|
$gudang = 3;
|
|
} else {
|
|
$gudang = 1;
|
|
}
|
|
$data = $this->Amod->getData_SnStock_byBARANG_byGUDANG_bySTATUS($datDmb[0]['BARANG_ID'], $gudang, 0);
|
|
|
|
$this->output_json([
|
|
'value' => 1,
|
|
'total' => sizeof($data),
|
|
'data' => $data
|
|
]);
|
|
}
|
|
|
|
public function SB_Ambil_Sub1_D1_DataSnMutasiBarang() {
|
|
$id_dmb = $this->input->post('id_dmb');
|
|
|
|
$datDmb = $this->Amod->getData_DaftarMutasiBarang_byID($id_dmb);
|
|
if ($datDmb[0]['JENIS_MB']==1) {
|
|
$gudang = 2;
|
|
} else if ($datDmb[0]['JENIS_MB']==3) {
|
|
$gudang = 3;
|
|
} else {
|
|
$gudang = 1;
|
|
}
|
|
|
|
$data = $this->Amod->getData_SnMutasiBarang_byDMB_byMB($id_dmb, $datDmb[0]['MB_ID']);
|
|
$snstock = $this->Amod->getData_SnStock_byBARANG_byGUDANG_bySTATUS($datDmb[0]['BARANG_ID'], $gudang, 0);
|
|
|
|
$snReady = [];
|
|
foreach ($snstock as $dat) {
|
|
$nama_snstock = $dat['NAMA_SNSTOCK'];
|
|
$hasil = "$nama_snstock";
|
|
array_push($snReady, $hasil);
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => 1,
|
|
'total' => sizeof($data),
|
|
'data' => $data,
|
|
'snReady' => $snReady,
|
|
'qty' => $datDmb[0]['QTY_DMB']
|
|
]);
|
|
}
|
|
|
|
public function SB_Tambah_Sub1_D1_DataDaftarMutasiBarang() {
|
|
$jenis_mb = $this->input->post('jenis_mbnew');
|
|
$id_barang = $this->input->post('id_barangnew');
|
|
$qty_dmb = $this->input->post('qty_dmbnew');
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
$now = date('Y-m-d');
|
|
|
|
if ($jenis_mb==1) {
|
|
$jenisGudang = 2;
|
|
} else if ($jenis_mb==3) {
|
|
$jenisGudang = 10;
|
|
} else {
|
|
$jenisGudang = 1;
|
|
}
|
|
|
|
$cekKuantiti = $this->GE_AmbilData_DataKuantiti($id_barang, $jenisGudang);
|
|
if ($cekKuantiti<$qty_dmb) {
|
|
if ($jenisGudang==1) {
|
|
$this->session->set_flashdata('qty_pcm_less', 'error');
|
|
} else if ($jenisGudang==2) {
|
|
$this->session->set_flashdata('qty_itp_less', 'error');
|
|
} else if ($jenisGudang==10) {
|
|
$this->session->set_flashdata('qty_srv_less', 'error');
|
|
}
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$datMb = $this->Amod->getData_MutasiBarang_byADMIN_bySTATUS($id_karyawan, 0);
|
|
if ($datMb==FALSE) {
|
|
$kode_mb = $this->Amod->generate_kodeMutasiBarang($jenis_mb);
|
|
$input = [
|
|
'CIPTA_MB' => "Oleh $panggilan pada $timestamp",
|
|
'JENIS_MB' => $jenis_mb,
|
|
'ADMIN_ID' => $id_karyawan,
|
|
'KODE_MB' => $kode_mb,
|
|
'TGL_MB' => $now,
|
|
'STATUS_MB' => '0',
|
|
];
|
|
$action = $this->Amod->create('mutasi_barang', $input);
|
|
|
|
$id_mb = $this->Amod->getMax_ID_MutasiBarang();
|
|
$id_mb = $id_mb[0]['ID_MB'];
|
|
} else {
|
|
$id_mb = $datMb[0]['ID_MB'];
|
|
|
|
$datDmb = $this->Amod->getData_DaftarMutasiBarang_byMB_byBARANG($id_mb, $id_barang);
|
|
if ($datDmb==TRUE) {
|
|
$this->session->set_flashdata('barangid_same', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
}
|
|
|
|
$input = [
|
|
'MB_ID' => $id_mb,
|
|
'BARANG_ID' => $id_barang,
|
|
'QTY_DMB' => $qty_dmb
|
|
];
|
|
$action = $this->Amod->create('daftar_mutasibarang', $input);
|
|
|
|
$this->GE_Kalkulasi_KuantitiBarang($id_barang, $jenisGudang, "Step 1 - MUTASIBARANG - Tambah Barang", 0, $qty_dmb);
|
|
|
|
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 SB_Hapus_Sub1_D1_DataDaftarMutasiBarang() {
|
|
$id_dmb = $this->input->post('id_dmbdel');
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
|
|
$datDmb = $this->Amod->getData_DaftarMutasiBarang_byID($id_dmb);
|
|
if ($datDmb==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
if ($datDmb[0]['JENIS_MB']==1) {
|
|
$jenisGudang = 2;
|
|
} else if ($datDmb[0]['JENIS_MB']==3) {
|
|
$jenisGudang = 10;
|
|
} else {
|
|
$jenisGudang = 1;
|
|
}
|
|
|
|
$id_mb = $datDmb[0]['MB_ID'];
|
|
$datMb = $this->Amod->getData_MutasiBarang_byID_byADMIN_bySTATUS($id_mb, $id_karyawan, 0);
|
|
if ($datMb==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$cekKuantiti = $this->GE_AmbilData_DataKuantiti($datDmb[0]['BARANG_ID'], 3);
|
|
if ($cekKuantiti<$datDmb[0]['QTY_DMB']) {
|
|
$this->session->set_flashdata('qty_pro_less', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
if ($datDmb[0]['TYPE_JENIS']==1) {
|
|
$datSnmb = $this->Amod->getData_SnMutasiBarang_byDMB_byMB($id_dmb, $id_mb);
|
|
foreach ($datSnmb as $key) {
|
|
$datSnStock = $this->Amod->getData_SnStock_byNAMA_bySTATUS($key['NAMA_SNMB'], 18);
|
|
if ($datSnStock==TRUE) {
|
|
$update = [
|
|
'STATUS_SNSTOCK' => '0'
|
|
];
|
|
$action = $this->Amod->update('sn_stock', $update, 'ID_SNSTOCK', $datSnStock[0]['ID_SNSTOCK']);
|
|
}
|
|
}
|
|
$action = $this->Amod->delete('sn_mutasibarang', $id_dmb, 'DMB_ID');
|
|
}
|
|
$this->GE_Kalkulasi_KuantitiBarang($datDmb[0]['BARANG_ID'], $jenisGudang, "Step 1 - MUTASIBARANG - Hapus Barang", 0, $datDmb[0]['QTY_DMB']);
|
|
|
|
$action = $this->Amod->delete('daftar_mutasibarang', $id_dmb, 'ID_DMB');
|
|
|
|
$countAfter = $this->Amod->getCount_DaftarMutasiBarang_byMB($id_mb);
|
|
if ($countAfter==0) {
|
|
$action = $this->Amod->delete('mutasi_barang', $id_mb, 'ID_MB');
|
|
}
|
|
|
|
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 SB_Proses_Sub1_D1_DataMutasiBarang() {
|
|
$id_mb = $this->input->post('id_mbpro');
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$now = date('Y-m-d');
|
|
|
|
$datMb = $this->Amod->getData_MutasiBarang_byID_byADMIN_bySTATUS($id_mb, $id_karyawan, 0);
|
|
if ($datMb==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$datDmb = $this->Amod->getData_DaftarMutasiBarang_byMB($id_mb);
|
|
foreach ($datDmb as $key) {
|
|
$cekKuantiti = $this->GE_AmbilData_DataKuantiti($key['BARANG_ID'], 3);
|
|
if ($cekKuantiti<$key['QTY_DMB']) {
|
|
$this->session->set_flashdata('qty_pro_less', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
if ($key['TYPE_JENIS']==1) {
|
|
$count = $this->Amod->getCount_SnMutasiBarang_byMB_byDMB($id_mb, $key['ID_DMB']);
|
|
if ($count<$key['QTY_DMB']) {
|
|
$this->session->set_flashdata('sncount_less', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
}
|
|
}
|
|
|
|
foreach ($datDmb as $key) {
|
|
if ($key['TYPE_JENIS']==1) {
|
|
$datSnmb = $this->Amod->getData_SnMutasiBarang_byDMB($key['ID_DMB']);
|
|
foreach ($datSnmb as $dat) {
|
|
$datSnStock = $this->Amod->getData_SnStock_byNAMA_bySTATUS($dat['NAMA_SNMB'], 18);
|
|
if ($datSnStock==TRUE) {
|
|
$update = [
|
|
'STATUS_SNSTOCK' => '8'
|
|
];
|
|
$action = $this->Amod->update('sn_stock', $update, 'ID_SNSTOCK', $datSnStock[0]['ID_SNSTOCK']);
|
|
}
|
|
}
|
|
}
|
|
$this->GE_Kalkulasi_KuantitiBarang($key['BARANG_ID'], 0, "Step 2 - MUTASIBARANG - Proses Barang", 0, $key['QTY_DMB']);
|
|
}
|
|
|
|
$input = [
|
|
'SJ_INV' => '0',
|
|
'KODE_BUKTI' => $datMb[0]['KODE_MB'],
|
|
'MB_ID' => $id_mb,
|
|
'TGL_CD' => $now
|
|
];
|
|
$action = $this->Amod->create('cetak_dokumen', $input);
|
|
|
|
$update = [
|
|
'STATUS_MB' => '1'
|
|
];
|
|
$action = $this->Amod->update('mutasi_barang', $update, 'ID_MB', $id_mb);
|
|
|
|
if ($action) {
|
|
$this->session->set_flashdata('success', 'diproses');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
} else {
|
|
$this->session->set_flashdata('failed', 'diproses');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
}
|
|
|
|
public function SB_Terima_Sub1_D1_DataMutasiBarang() {
|
|
$id_mb = $this->input->post('id_mbter');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$datMb = $this->Amod->getData_MutasiBarang_byID_bySTATUS($id_mb, 1);
|
|
if ($datMb==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
if ($datMb[0]['JENIS_MB']==0) {
|
|
$gudang = 2;
|
|
} else if ($datMb[0]['JENIS_MB']==2) {
|
|
$gudang = 3;
|
|
} else {
|
|
$gudang = 1;
|
|
}
|
|
|
|
$datDmb = $this->Amod->getData_DaftarMutasiBarang_byMB($id_mb);
|
|
foreach ($datDmb as $key) {
|
|
$cekKuantiti = $this->GE_AmbilData_DataKuantiti($key['BARANG_ID'], 6);
|
|
if ($cekKuantiti<$key['QTY_DMB']) {
|
|
$this->session->set_flashdata('qty_mb_less', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
}
|
|
|
|
foreach ($datDmb as $key) {
|
|
if ($key['TYPE_JENIS']==1) {
|
|
$datSnmb = $this->Amod->getData_SnMutasiBarang_byDMB($key['ID_DMB']);
|
|
foreach ($datSnmb as $dat) {
|
|
$datSnStock = $this->Amod->getData_SnStock_byNAMA_bySTATUS($dat['NAMA_SNMB'], 8);
|
|
if ($datSnStock==TRUE) {
|
|
$update = [
|
|
'STATUS_SNSTOCK' => '0',
|
|
'GUDANG_SNSTOCK' => $gudang,
|
|
];
|
|
$action = $this->Amod->update('sn_stock', $update, 'ID_SNSTOCK', $datSnStock[0]['ID_SNSTOCK']);
|
|
}
|
|
}
|
|
}
|
|
$this->GE_Kalkulasi_KuantitiBarang($key['BARANG_ID'], $gudang, "Step 3 - MUTASIBARANG - Terima Barang", 0, $key['QTY_DMB']);
|
|
}
|
|
|
|
$update = [
|
|
'STATUS_MB' => '2',
|
|
'TERIMA_MB' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('mutasi_barang', $update, 'ID_MB', $id_mb);
|
|
|
|
if ($action) {
|
|
$this->session->set_flashdata('success', 'diterima');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
} else {
|
|
$this->session->set_flashdata('failed', 'diterima');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
}
|
|
|
|
public function SB_Simpan_Sub1_D1_DataSnMutasiBarang() {
|
|
$id_snstock = $this->input->post('id_snstock');
|
|
$id_dmb = $this->input->post('id_dmb');
|
|
|
|
$value = 0;
|
|
$datDmb = $this->Amod->getData_DaftarMutasiBarang_byID($id_dmb);
|
|
if ($datDmb==FALSE) {
|
|
$value = 8;
|
|
} else {
|
|
$datSnStock = $this->Amod->getData_SnStock_byID($id_snstock);
|
|
if ($datSnStock==FALSE) {
|
|
$value = 7;
|
|
} else {
|
|
if ($datSnStock[0]['STATUS_SNSTOCK']!=0) {
|
|
$value = 6;
|
|
} else {
|
|
if ($datSnStock[0]['BARANG_ID']!=$datDmb[0]['BARANG_ID']) {
|
|
$value = 5;
|
|
} else {
|
|
if ($datDmb[0]['JENIS_MB']==1) {
|
|
$gudang = 2;
|
|
} else if ($datDmb[0]['JENIS_MB']==3) {
|
|
$gudang = 3;
|
|
} else {
|
|
$gudang = 1;
|
|
}
|
|
if ($datSnStock[0]['GUDANG_SNSTOCK']!=$gudang) {
|
|
$value = 4;
|
|
} else {
|
|
$countBefore = $this->Amod->getCount_SnMutasiBarang_byMB_byDMB($datDmb[0]['MB_ID'], $id_dmb);
|
|
if ($countBefore>=$datDmb[0]['QTY_DMB']) {
|
|
$value = 3;
|
|
} else {
|
|
$input = [
|
|
'MB_ID' => $datDmb[0]['MB_ID'],
|
|
'DMB_ID' => $id_dmb,
|
|
'NAMA_SNMB' => $datSnStock[0]['NAMA_SNSTOCK']
|
|
];
|
|
$action = $this->Amod->create('sn_mutasibarang', $input);
|
|
|
|
$update = [
|
|
'STATUS_SNSTOCK' => '18'
|
|
];
|
|
$action = $this->Amod->update('sn_stock', $update, 'ID_SNSTOCK', $id_snstock);
|
|
|
|
$countAfter = $this->Amod->getCount_SnMutasiBarang_byMB_byDMB($datDmb[0]['MB_ID'], $id_dmb);
|
|
if ($countAfter==$datDmb[0]['QTY_DMB']) {
|
|
$value = 2;
|
|
} else {
|
|
$value = 1;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
}
|
|
|
|
public function SB_Simpan_Sub1_D1_DataSnMutasiBarangBarcode() {
|
|
$id_snmb = $this->input->post('id_snmb');
|
|
$id_dmb = $this->input->post('id_dmb');
|
|
$nama_snmb = $this->input->post('nama_snmb');
|
|
$nama_snmb = strtoupper($nama_snmb);
|
|
|
|
$value = 0;
|
|
$datDmb = $this->Amod->getData_DaftarMutasiBarang_byID($id_dmb);
|
|
if ($datDmb==FALSE) {
|
|
$value = 8;
|
|
} else {
|
|
$datSnStock = $this->Amod->getData_SnStock_byNAMA_allStatus($nama_snmb);
|
|
if ($datSnStock==FALSE) {
|
|
$value = 7;
|
|
} else {
|
|
if ($datSnStock[0]['STATUS_SNSTOCK']!=0) {
|
|
$value = 6;
|
|
} else {
|
|
if ($datSnStock[0]['BARANG_ID']!=$datDmb[0]['BARANG_ID']) {
|
|
$value = 5;
|
|
} else {
|
|
if ($datDmb[0]['JENIS_MB']==1) {
|
|
$gudang = 2;
|
|
} else if ($datDmb[0]['JENIS_MB']==3) {
|
|
$gudang = 3;
|
|
} else {
|
|
$gudang = 1;
|
|
}
|
|
if ($datSnStock[0]['GUDANG_SNSTOCK']!=$gudang) {
|
|
$value = 4;
|
|
} else {
|
|
$countBefore = $this->Amod->getCount_SnMutasiBarang_byMB_byDMB($datDmb[0]['MB_ID'], $id_dmb);
|
|
if ($countBefore>=$datDmb[0]['QTY_DMB']) {
|
|
$value = 3;
|
|
} else {
|
|
$input = [
|
|
'MB_ID' => $datDmb[0]['MB_ID'],
|
|
'DMB_ID' => $id_dmb,
|
|
'NAMA_SNMB' => $nama_snmb
|
|
];
|
|
$action = $this->Amod->create('sn_mutasibarang', $input);
|
|
|
|
$update = [
|
|
'STATUS_SNSTOCK' => '18'
|
|
];
|
|
$action = $this->Amod->update('sn_stock', $update, 'ID_SNSTOCK', $datSnStock[0]['ID_SNSTOCK']);
|
|
|
|
$countAfter = $this->Amod->getCount_SnMutasiBarang_byMB_byDMB($datDmb[0]['MB_ID'], $id_dmb);
|
|
if ($countAfter==$datDmb[0]['QTY_DMB']) {
|
|
$value = 2;
|
|
} else {
|
|
$value = 1;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
}
|
|
|
|
public function SB_Hapus_Sub1_D1_DataSnMutasiBarang() {
|
|
$id_snmb = $this->input->post('id_snmb');
|
|
$id_dmb = $this->input->post('id_dmb');
|
|
|
|
$value = 0;
|
|
$datDmb = $this->Amod->getData_DaftarMutasiBarang_byID($id_dmb);
|
|
if ($datDmb==FALSE) {
|
|
$value = 4;
|
|
} else {
|
|
$datSnmb = $this->Amod->getData_SnMutasiBarang_byID_bySTATUS($id_snmb, 18);
|
|
if ($datSnmb==FALSE) {
|
|
$value = 3;
|
|
} else {
|
|
$countBefore = $this->Amod->getCount_SnMutasiBarang_byMB_byDMB($datDmb[0]['MB_ID'], $id_dmb);
|
|
|
|
$update = [
|
|
'STATUS_SNSTOCK' => '0'
|
|
];
|
|
$action = $this->Amod->update('sn_stock', $update, 'ID_SNSTOCK', $datSnmb[0]['ID_SNSTOCK']);
|
|
$action = $this->Amod->delete('sn_mutasibarang', $id_snmb, 'ID_SNMB');
|
|
|
|
if ($countBefore==$datDmb[0]['QTY_DMB']) {
|
|
$value = 2;
|
|
} else {
|
|
$value = 1;
|
|
}
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
}
|
|
|
|
//SUBMENU TRANSAKSI - PEMINJAMAN
|
|
public function SB_Sub1_Peminjaman_1() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
$now = date('Y-m-d');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "SB", "TRANSAKSI - Peminjaman");
|
|
$id_menu = $datShm[0]['MENU_ID'];
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$datSgu = $this->Amod->getData_SetGudang_byKARYAWAN_byMENU($id_karyawan, $id_menu);
|
|
if ($datSgu==FALSE) {
|
|
$aktif = 1;
|
|
$input = [
|
|
'KARYAWAN_ID' => $id_karyawan,
|
|
'MENU_ID' => $id_menu,
|
|
'AKTIF_SGU' => $aktif,
|
|
'TIMESTAMP' => $timestamp
|
|
];
|
|
$action = $this->Amod->create('set_gudang', $input);
|
|
} else {
|
|
$aktif = $datSgu[0]['AKTIF_SGU'];
|
|
}
|
|
|
|
$datPeminjaman = $this->Amod->getData_Peminjaman_byGUDANG_bySTATUS($id_karyawan, 0);
|
|
if ($datPeminjaman==TRUE) {
|
|
$id_peminjaman = $datPeminjaman[0]['ID_PEMINJAMAN'];
|
|
$datDfp = $this->Amod->getData_DaftarPinjam_byPEMINJAMAN($id_peminjaman);
|
|
$no = 0;
|
|
foreach ($datDfp as $key) {
|
|
$count = $this->Amod->getCount_SnPinjam_byDFP($key['ID_DFP']);
|
|
$datDfp[$no++] += ['REAL' => $count];
|
|
}
|
|
$countProses = count($datDfp);
|
|
} else {
|
|
$datDfp = NULL;
|
|
$id_peminjaman = NULL;
|
|
$countProses = 0;
|
|
}
|
|
|
|
$datPeminjamanBerjalan = $this->Amod->getData_Peminjaman_bySTATUS_byJENIS(1, $aktif);
|
|
$no = 0;
|
|
foreach ($datPeminjamanBerjalan as $key) {
|
|
$datDfpPro = $this->Amod->getData_DaftarPinjam_byPEMINJAMAN($key['ID_PEMINJAMAN']);
|
|
$nope = 0;
|
|
$sn = "";
|
|
foreach ($datDfpPro as $dat) {
|
|
$datSnp = $this->Amod->getData_SnPinjam_byDFP($dat['ID_DFP']);
|
|
foreach ($datSnp as $dit) {
|
|
$nama_snp = $dit['NAMA_SNP'];
|
|
$sn .= "$nama_snp, ";
|
|
}
|
|
$datDfpPro[$nope++] += ['SN' => $sn];
|
|
$sn = "";
|
|
}
|
|
$datPeminjamanBerjalan[$no++] += ['BARANG' => $datDfpPro];
|
|
}
|
|
|
|
$datPeminjamanSelesai = $this->Amod->getData_Peminjaman_bySTATUS_byJENIS(2, $aktif);
|
|
$no = 0;
|
|
foreach ($datPeminjamanSelesai as $key) {
|
|
$datDfpPro = $this->Amod->getData_DaftarPinjam_byPEMINJAMAN($key['ID_PEMINJAMAN']);
|
|
$nope = 0;
|
|
$sn = "";
|
|
foreach ($datDfpPro as $dat) {
|
|
$datSnp = $this->Amod->getData_SnPinjam_byDFP($dat['ID_DFP']);
|
|
foreach ($datSnp as $dit) {
|
|
$nama_snp = $dit['NAMA_SNP'];
|
|
$sn .= "$nama_snp, ";
|
|
}
|
|
$datDfpPro[$nope++] += ['SN' => $sn];
|
|
$sn = "";
|
|
}
|
|
$datPeminjamanSelesai[$no++] += ['BARANG' => $datDfpPro];
|
|
}
|
|
|
|
$datStpos = $this->Amod->getData_SetTogglePosisi_byKARYAWAN_byMENU($id_karyawan, $id_menu);
|
|
if ($datStpos==FALSE) { $posisiToggle = 0; } else { $posisiToggle = $datStpos[0]['AKTIF_STPOS']; }
|
|
|
|
$datBarang = $this->Amod->getData_Barang_bySTATUS_jenisNot2(1, $aktif);
|
|
$datKaryawan = $this->Amod->getData_Karyawan_bySTATUS(1);
|
|
$datPelanggan = $this->Amod->getData_Pelanggan_bySTATUS(1);
|
|
|
|
$data = array(
|
|
'sidebar' => "menu stokbarang",
|
|
'navChild' => "stokbarang peminjaman",
|
|
'id_menu' => $id_menu,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil,
|
|
'id_peminjaman' => $id_peminjaman,
|
|
'aktif' => $aktif,
|
|
'dfp' => $datDfp,
|
|
'peminjaman' => $datPeminjamanBerjalan,
|
|
'selesai' => $datPeminjamanSelesai,
|
|
'countProses' => $countProses,
|
|
'countBerjalan' => count($datPeminjamanBerjalan),
|
|
'countSelesai' => count($datPeminjamanSelesai),
|
|
'posisiToggle' => $posisiToggle,
|
|
'barang' => $datBarang,
|
|
'karyawan' => $datKaryawan,
|
|
'pelanggan' => $datPelanggan,
|
|
);
|
|
$this->load->view('proses/SB_Sub1_Peminjaman_1', $data);
|
|
}
|
|
|
|
public function SB_Ambil_Sub1_F1_DataSnStock() {
|
|
$id_dfp = $this->input->post('id_dfp');
|
|
|
|
$datDfp = $this->Amod->getData_DaftarPinjam_byID($id_dfp);
|
|
$data = $this->Amod->getData_SnStock_byBARANG_byGUDANG_bySTATUS($datDfp[0]['BARANG_ID'], $datDfp[0]['JENIS_PEMINJAMAN'], 0);
|
|
|
|
$this->output_json([
|
|
'value' => 1,
|
|
'total' => sizeof($data),
|
|
'data' => $data
|
|
]);
|
|
}
|
|
|
|
public function SB_Ambil_Sub1_F1_DataSnPinjam() {
|
|
$id_dfp = $this->input->post('id_dfp');
|
|
|
|
$datDfp = $this->Amod->getData_DaftarPinjam_byID($id_dfp);
|
|
$data = $this->Amod->getData_SnPinjam_byDFP($id_dfp);
|
|
$snstock = $this->Amod->getData_SnStock_byBARANG_byGUDANG_bySTATUS($datDfp[0]['BARANG_ID'], $datDfp[0]['JENIS_PEMINJAMAN'], 0);
|
|
|
|
$snReady = [];
|
|
foreach ($snstock as $dat) {
|
|
$nama_snstock = $dat['NAMA_SNSTOCK'];
|
|
$hasil = "$nama_snstock";
|
|
array_push($snReady, $hasil);
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => 1,
|
|
'total' => sizeof($data),
|
|
'data' => $data,
|
|
'snReady' => $snReady,
|
|
'qty' => $datDfp[0]['QTY_DFP']
|
|
]);
|
|
}
|
|
|
|
public function SB_Tambah_Sub1_F1_DataDaftarPinjam() {
|
|
$jenis_peminjaman = $this->input->post('jenis_peminjamannew');
|
|
$id_barang = $this->input->post('id_barangnew');
|
|
$qty_dfp = $this->input->post('qty_dfpnew');
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
$now = date('Y-m-d');
|
|
|
|
$cekKuantiti = $this->GE_AmbilData_DataKuantiti($id_barang, $jenis_peminjaman);
|
|
if ($cekKuantiti<$qty_dfp) {
|
|
if ($jenis_peminjaman==1) {
|
|
$this->session->set_flashdata('qty_pcm_less', 'error');
|
|
} else if ($jenis_peminjaman==2) {
|
|
$this->session->set_flashdata('qty_itp_less', 'error');
|
|
}
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$datPeminjaman = $this->Amod->getData_Peminjaman_byGUDANG_bySTATUS($id_karyawan, 0);
|
|
if ($datPeminjaman==FALSE) {
|
|
$kode_peminjaman = $this->Amod->generate_kodePeminjaman($jenis_peminjaman);
|
|
$input = [
|
|
'CIPTA_PEMINJAMAN' => "Oleh $panggilan pada $timestamp",
|
|
'JENIS_PEMINJAMAN' => $jenis_peminjaman,
|
|
'PEMBERI_ID' => $id_karyawan,
|
|
'KODE_PEMINJAMAN' => $kode_peminjaman,
|
|
'TGL_PEMINJAMAN' => $now,
|
|
'STATUS_PEMINJAMAN' => '0',
|
|
];
|
|
$action = $this->Amod->create('peminjaman', $input);
|
|
|
|
$id_peminjaman = $this->Amod->getMax_ID_Peminjaman();
|
|
$id_peminjaman = $id_peminjaman[0]['ID_PEMINJAMAN'];
|
|
} else {
|
|
$id_peminjaman = $datPeminjaman[0]['ID_PEMINJAMAN'];
|
|
|
|
$datDfp = $this->Amod->getData_DaftarPinjam_byPEMINJAMAN_byBARANG($id_peminjaman, $id_barang);
|
|
if ($datDfp==TRUE) {
|
|
$this->session->set_flashdata('barangid_same', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
}
|
|
|
|
$input = [
|
|
'PEMINJAMAN_ID' => $id_peminjaman,
|
|
'BARANG_ID' => $id_barang,
|
|
'QTY_DFP' => $qty_dfp
|
|
];
|
|
$action = $this->Amod->create('daftar_pinjam', $input);
|
|
|
|
$this->GE_Kalkulasi_KuantitiBarang($id_barang, $jenis_peminjaman, "Step 1 - PEMINJAMAN - Tambah Barang", 0, $qty_dfp);
|
|
|
|
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 SB_Hapus_Sub1_F1_DataDaftarPinjam() {
|
|
$id_dfp = $this->input->post('id_dfpdel');
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
|
|
$datDfp = $this->Amod->getData_DaftarPinjam_byID($id_dfp);
|
|
if ($datDfp==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$id_peminjaman = $datDfp[0]['PEMINJAMAN_ID'];
|
|
$datPeminjaman = $this->Amod->getData_Peminjaman_byID_byGUDANG_bySTATUS($id_peminjaman, $id_karyawan, 0);
|
|
if ($datPeminjaman==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$cekKuantiti = $this->GE_AmbilData_DataKuantiti($datDfp[0]['BARANG_ID'], 3);
|
|
if ($cekKuantiti<$datDfp[0]['QTY_DFP']) {
|
|
$this->session->set_flashdata('qty_pro_less', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
if ($datDfp[0]['TYPE_JENIS']==1) {
|
|
$datSnp = $this->Amod->getData_SnPinjam_byDFP($id_dfp);
|
|
foreach ($datSnp as $key) {
|
|
$datSnStock = $this->Amod->getData_SnStock_byNAMA_bySTATUS($key['NAMA_SNP'], 15);
|
|
if ($datSnStock==TRUE) {
|
|
$update = [
|
|
'STATUS_SNSTOCK' => '0'
|
|
];
|
|
$action = $this->Amod->update('sn_stock', $update, 'ID_SNSTOCK', $datSnStock[0]['ID_SNSTOCK']);
|
|
}
|
|
}
|
|
$action = $this->Amod->delete('sn_pinjam', $id_dfp, 'DFP_ID');
|
|
}
|
|
$this->GE_Kalkulasi_KuantitiBarang($datDfp[0]['BARANG_ID'], $datPeminjaman[0]['JENIS_PEMINJAMAN'], "Step 1 - PEMINJAMAN - Hapus Barang", 0, $datDfp[0]['QTY_DFP']);
|
|
|
|
$action = $this->Amod->delete('daftar_pinjam', $id_dfp, 'ID_DFP');
|
|
|
|
$countAfter = $this->Amod->getCount_DaftarPinjam_byPEMINJAMAN($id_peminjaman);
|
|
if ($countAfter==0) {
|
|
$action = $this->Amod->delete('peminjaman', $id_peminjaman, 'ID_PEMINJAMAN');
|
|
}
|
|
|
|
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 SB_Proses_Sub1_F1_DataPeminjaman() {
|
|
$id_peminjaman = $this->input->post('id_peminjamanpro');
|
|
$id_karyawan = $this->input->post('id_karyawanpro');
|
|
$id_pelanggan = $this->input->post('id_pelangganpro');
|
|
$ket_peminjaman = $this->input->post('ket_peminjamanpro');
|
|
$ket_peminjaman = ltrim(rtrim(preg_replace('/\R+/', " " , $ket_peminjaman)));
|
|
$id_gudang = $this->session->userdata('id_karyawan');
|
|
$now = date('Y-m-d');
|
|
|
|
$datPeminjaman = $this->Amod->getData_Peminjaman_byID_byGUDANG_bySTATUS($id_peminjaman, $id_gudang, 0);
|
|
if ($datPeminjaman==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$datDfp = $this->Amod->getData_DaftarPinjam_byPEMINJAMAN($id_peminjaman);
|
|
foreach ($datDfp as $key) {
|
|
$cekKuantiti = $this->GE_AmbilData_DataKuantiti($key['BARANG_ID'], 3);
|
|
if ($cekKuantiti<$key['QTY_DFP']) {
|
|
$this->session->set_flashdata('qty_pro_less', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
if ($key['TYPE_JENIS']==1) {
|
|
$count = $this->Amod->getCount_SnPinjam_byDFP($key['ID_DFP']);
|
|
if ($count<$key['QTY_DFP']) {
|
|
$this->session->set_flashdata('sncount_less', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
}
|
|
}
|
|
|
|
foreach ($datDfp as $key) {
|
|
if ($key['TYPE_JENIS']==1) {
|
|
$datSnp = $this->Amod->getData_SnPinjam_byDFP($key['ID_DFP']);
|
|
foreach ($datSnp as $dat) {
|
|
$datSnStock = $this->Amod->getData_SnStock_byNAMA_bySTATUS($dat['NAMA_SNP'], 15);
|
|
if ($datSnStock==TRUE) {
|
|
$update = [
|
|
'STATUS_SNSTOCK' => '5'
|
|
];
|
|
$action = $this->Amod->update('sn_stock', $update, 'ID_SNSTOCK', $datSnStock[0]['ID_SNSTOCK']);
|
|
}
|
|
}
|
|
}
|
|
|
|
$this->GE_Kalkulasi_KuantitiBarang($key['BARANG_ID'], $key['JENIS_PEMINJAMAN'], "Step 2 - PEMINJAMAN - Proses Barang", 0, $key['QTY_DFP']);
|
|
}
|
|
|
|
if ($datPeminjaman[0]['JENIS_PEMINJAMAN']==2) {
|
|
$input = [
|
|
'SJ_INV' => '0',
|
|
'KODE_BUKTI' => $datPeminjaman[0]['KODE_PEMINJAMAN'],
|
|
'PEMINJAMAN_ID' => $id_peminjaman,
|
|
'TGL_CD' => $now
|
|
];
|
|
$action = $this->Amod->create('cetak_dokumen', $input);
|
|
}
|
|
|
|
$update = [
|
|
'PEMINJAM_ID' => $id_karyawan,
|
|
'PELANGGAN_ID' => $id_pelanggan,
|
|
'KET_PEMINJAMAN' => $ket_peminjaman,
|
|
'STATUS_PEMINJAMAN' => '1'
|
|
];
|
|
$action = $this->Amod->update('peminjaman', $update, 'ID_PEMINJAMAN', $id_peminjaman);
|
|
|
|
if ($action) {
|
|
$this->session->set_flashdata('success', 'diproses');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
} else {
|
|
$this->session->set_flashdata('failed', 'diproses');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
}
|
|
|
|
public function SB_Kembali_Sub1_F1_DataPeminjaman() {
|
|
$id_peminjaman = $this->input->post('id_peminjamankem');
|
|
$id_pengembali = $this->input->post('id_pengembalikem');
|
|
$id_penerima = $this->session->userdata('id_karyawan');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
$now = date('Y-m-d');
|
|
|
|
$datPeminjaman = $this->Amod->getData_Peminjaman_byID_bySTATUS($id_peminjaman, 1);
|
|
if ($datPeminjaman==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$datDfp = $this->Amod->getData_DaftarPinjam_byPEMINJAMAN($id_peminjaman);
|
|
foreach ($datDfp as $key) {
|
|
if ($key['TYPE_JENIS']==1) {
|
|
$datSnp = $this->Amod->getData_SnPinjam_byDFP($key['ID_DFP']);
|
|
foreach ($datSnp as $dat) {
|
|
$datSnStock = $this->Amod->getData_SnStock_byNAMA_bySTATUS($dat['NAMA_SNP'], 5);
|
|
if ($datSnStock==TRUE) {
|
|
$update = [
|
|
'STATUS_SNSTOCK' => '0'
|
|
];
|
|
$action = $this->Amod->update('sn_stock', $update, 'ID_SNSTOCK', $datSnStock[0]['ID_SNSTOCK']);
|
|
}
|
|
}
|
|
}
|
|
|
|
$this->GE_Kalkulasi_KuantitiBarang($key['BARANG_ID'], $datPeminjaman[0]['JENIS_PEMINJAMAN'], "Step 3 - PEMINJAMAN - Kembalikan Barang", 0, $key['QTY_DFP']);
|
|
}
|
|
|
|
$update = [
|
|
'PENGEMBALI_ID' => $id_pengembali,
|
|
'PENERIMA_ID' => $id_penerima,
|
|
'TGL_KEMBALI' => $now,
|
|
'KEMBALI_PEMINJAMAN' => "Oleh $panggilan pada $timestamp",
|
|
'STATUS_PEMINJAMAN' => '2'
|
|
];
|
|
$action = $this->Amod->update('peminjaman', $update, 'ID_PEMINJAMAN', $id_peminjaman);
|
|
|
|
if ($action) {
|
|
$this->session->set_flashdata('success', 'dikembalikan');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
} else {
|
|
$this->session->set_flashdata('failed', 'dikembalikan');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
}
|
|
|
|
public function SB_Simpan_Sub1_F1_DataSnPinjam() {
|
|
$id_snstock = $this->input->post('id_snstock');
|
|
$id_dfp = $this->input->post('id_dfp');
|
|
|
|
$value = 0;
|
|
$datDfp = $this->Amod->getData_DaftarPinjam_byID($id_dfp);
|
|
if ($datDfp==FALSE) {
|
|
$value = 8;
|
|
} else {
|
|
$datSnStock = $this->Amod->getData_SnStock_byID($id_snstock);
|
|
if ($datSnStock==FALSE) {
|
|
$value = 7;
|
|
} else {
|
|
if ($datSnStock[0]['STATUS_SNSTOCK']!=0) {
|
|
$value = 6;
|
|
} else {
|
|
if ($datSnStock[0]['BARANG_ID']!=$datDfp[0]['BARANG_ID']) {
|
|
$value = 5;
|
|
} else {
|
|
if ($datSnStock[0]['GUDANG_SNSTOCK']!=$datDfp[0]['JENIS_PEMINJAMAN']) {
|
|
$value = 4;
|
|
} else {
|
|
$countBefore = $this->Amod->getCount_SnPinjam_byDFP($id_dfp);
|
|
if ($countBefore>=$datDfp[0]['QTY_DFP']) {
|
|
$value = 3;
|
|
} else {
|
|
$input = [
|
|
'DFP_ID' => $id_dfp,
|
|
'NAMA_SNP' => $datSnStock[0]['NAMA_SNSTOCK']
|
|
];
|
|
$action = $this->Amod->create('sn_pinjam', $input);
|
|
|
|
$update = [
|
|
'STATUS_SNSTOCK' => '15'
|
|
];
|
|
$action = $this->Amod->update('sn_stock', $update, 'ID_SNSTOCK', $id_snstock);
|
|
|
|
$countAfter = $this->Amod->getCount_SnPinjam_byDFP($id_dfp);
|
|
if ($countAfter==$datDfp[0]['QTY_DFP']) {
|
|
$value = 2;
|
|
} else {
|
|
$value = 1;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
}
|
|
|
|
public function SB_Simpan_Sub1_F1_DataSnPinjamBarcode() {
|
|
$id_snp = $this->input->post('id_snp');
|
|
$id_dfp = $this->input->post('id_dfp');
|
|
$nama_snp = $this->input->post('nama_snp');
|
|
$nama_snp = strtoupper($nama_snp);
|
|
|
|
$value = 0;
|
|
$datDfp = $this->Amod->getData_DaftarPinjam_byID($id_dfp);
|
|
if ($datDfp==FALSE) {
|
|
$value = 8;
|
|
} else {
|
|
$datSnStock = $this->Amod->getData_SnStock_byNAMA_allStatus($nama_snp);
|
|
if ($datSnStock==FALSE) {
|
|
$value = 7;
|
|
} else {
|
|
if ($datSnStock[0]['STATUS_SNSTOCK']!=0) {
|
|
$value = 6;
|
|
} else {
|
|
if ($datSnStock[0]['BARANG_ID']!=$datDfp[0]['BARANG_ID']) {
|
|
$value = 5;
|
|
} else {
|
|
if ($datSnStock[0]['GUDANG_SNSTOCK']!=$datDfp[0]['JENIS_PEMINJAMAN']) {
|
|
$value = 4;
|
|
} else {
|
|
$countBefore = $this->Amod->getCount_SnPinjam_byDFP($id_dfp);
|
|
if ($countBefore>=$datDfp[0]['QTY_DFP']) {
|
|
$value = 3;
|
|
} else {
|
|
$input = [
|
|
'DFP_ID' => $id_dfp,
|
|
'NAMA_SNP' => $nama_snp
|
|
];
|
|
$action = $this->Amod->create('sn_pinjam', $input);
|
|
|
|
$update = [
|
|
'STATUS_SNSTOCK' => '15'
|
|
];
|
|
$action = $this->Amod->update('sn_stock', $update, 'ID_SNSTOCK', $datSnStock[0]['ID_SNSTOCK']);
|
|
|
|
$countAfter = $this->Amod->getCount_SnPinjam_byDFP($id_dfp);
|
|
if ($countAfter==$datDfp[0]['QTY_DFP']) {
|
|
$value = 2;
|
|
} else {
|
|
$value = 1;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
}
|
|
|
|
public function SB_Hapus_Sub1_F1_DataSnPinjam() {
|
|
$id_snp = $this->input->post('id_snp');
|
|
$id_dfp = $this->input->post('id_dfp');
|
|
|
|
$value = 0;
|
|
$datDfp = $this->Amod->getData_DaftarPinjam_byID($id_dfp);
|
|
if ($datDfp==FALSE) {
|
|
$value = 4;
|
|
} else {
|
|
$datSnp = $this->Amod->getData_SnPinjam_byID_bySTATUS($id_snp, 15);
|
|
if ($datSnp==FALSE) {
|
|
$value = 3;
|
|
} else {
|
|
$countBefore = $this->Amod->getCount_SnPinjam_byDFP($id_dfp);
|
|
|
|
$update = [
|
|
'STATUS_SNSTOCK' => '0'
|
|
];
|
|
$action = $this->Amod->update('sn_stock', $update, 'ID_SNSTOCK', $datSnp[0]['ID_SNSTOCK']);
|
|
$action = $this->Amod->delete('sn_pinjam', $id_snp, 'ID_SNP');
|
|
|
|
if ($countBefore==$datDfp[0]['QTY_DFP']) {
|
|
$value = 2;
|
|
} else {
|
|
$value = 1;
|
|
}
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
}
|
|
|
|
//SUBMENU TRANSAKSI - PENDING
|
|
public function SB_Sub1_Pending_1() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$now = date('Y-m-d');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "SB", "TRANSAKSI - Pending");
|
|
$id_menu = $datShm[0]['MENU_ID'];
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$datSgu = $this->Amod->getData_SetGudang_byKARYAWAN_byMENU($id_karyawan, $id_menu);
|
|
if ($datSgu==FALSE) {
|
|
$aktif = 1;
|
|
$input = [
|
|
'KARYAWAN_ID' => $id_karyawan,
|
|
'MENU_ID' => $id_menu,
|
|
'AKTIF_SGU' => $aktif,
|
|
'TIMESTAMP' => $timestamp
|
|
];
|
|
$action = $this->Amod->create('set_gudang', $input);
|
|
} else {
|
|
$aktif = $datSgu[0]['AKTIF_SGU'];
|
|
}
|
|
|
|
$cekPending1 = $this->Amod->getData_Pending_byJENIS_bySTATUS(1, 0);
|
|
foreach ($cekPending1 as $key) {
|
|
if (strtotime($key['DURASI_PENDING'])<strtotime($now)) {
|
|
$update = [
|
|
'SELESAI_PENDING' => $now,
|
|
'STATUS_PENDING' => '1'
|
|
];
|
|
$action = $this->Amod->update('pending', $update, 'ID_PENDING', $key['ID_PENDING']);
|
|
|
|
$this->GE_Kalkulasi_KuantitiBarang($key['BARANG_ID'], $key['JENIS_PENDING'], "Step 2 - PENDING - Proses Barang", 0, $key['QTY_PENDING']);
|
|
}
|
|
}
|
|
|
|
$cekPending2 = $this->Amod->getData_Pending_byJENIS_bySTATUS(2, 0);
|
|
foreach ($cekPending2 as $key) {
|
|
if (strtotime($key['DURASI_PENDING'])<strtotime($now)) {
|
|
$update = [
|
|
'SELESAI_PENDING' => $now,
|
|
'STATUS_PENDING' => '1'
|
|
];
|
|
$action = $this->Amod->update('pending', $update, 'ID_PENDING', $key['ID_PENDING']);
|
|
|
|
$this->GE_Kalkulasi_KuantitiBarang($key['BARANG_ID'], $key['JENIS_PENDING'], "Step 2 - PENDING - Proses Barang", 0, $key['QTY_PENDING']);
|
|
}
|
|
}
|
|
|
|
$datPending1 = $this->Amod->getData_Pending_byJENIS_bySTATUS(1, 0);
|
|
$datPending2 = $this->Amod->getData_Pending_byJENIS_bySTATUS(2, 0);
|
|
|
|
$datBarang1 = $this->Amod->getData_Barang_bySTATUS_jenisNot2(1, 1);
|
|
$datBarang2 = $this->Amod->getData_Barang_bySTATUS_jenisNot2(1, 2);
|
|
$datKaryawan = $this->Amod->getData_Karyawan_SalesFormKaryawan();
|
|
$datPelanggan = $this->Amod->getData_Pelanggan_bySTATUS(1);
|
|
|
|
$data = array(
|
|
'sidebar' => "menu stokbarang",
|
|
'navChild' => "stokbarang pending",
|
|
'aktif' => $aktif,
|
|
'id_menu' => $id_menu,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil,
|
|
'pending1' => $datPending1,
|
|
'pending2' => $datPending2,
|
|
'count1' => count($datPending1),
|
|
'count2' => count($datPending2),
|
|
'barang1' => $datBarang1,
|
|
'barang2' => $datBarang2,
|
|
'karyawan' => $datKaryawan,
|
|
'pelanggan' => $datPelanggan,
|
|
);
|
|
$this->load->view('proses/SB_Sub1_Pending_1', $data);
|
|
}
|
|
|
|
public function SB_Tambah_Sub1_G1_DataPending() {
|
|
$jenis_pending = $this->input->post('jenis_pending');
|
|
$id_barang = $this->input->post('id_barangnew');
|
|
$id_sales = $this->input->post('id_salesnew');
|
|
$id_pelanggan = $this->input->post('id_pelanggannew');
|
|
$qty_pending = $this->input->post('qty_pendingnew');
|
|
$durasi_pending = $this->input->post('durasi_pendingnew');
|
|
$nama_pending = $this->input->post('nama_pendingnew');
|
|
$nama_pending = ltrim(rtrim(preg_replace('/\R+/', " " , $nama_pending)));
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
$now = date('Y-m-d');
|
|
$limit = $this->Amod->generate_addDay($now, $durasi_pending);
|
|
|
|
$cekKuantiti = $this->GE_AmbilData_DataKuantiti($id_barang, $jenis_pending);
|
|
if ($cekKuantiti<$qty_pending) {
|
|
if ($jenis_pending==1) {
|
|
$this->session->set_flashdata('qty_pcm_less', 'error');
|
|
} else if ($jenis_pending==2) {
|
|
$this->session->set_flashdata('qty_itp_less', 'error');
|
|
}
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$this->GE_Kalkulasi_KuantitiBarang($id_barang, $jenis_pending, "Step 1 - PENDING - Tambah Barang", 0, $qty_pending);
|
|
$kode_pending = $this->Amod->generate_kodePending();
|
|
|
|
$input = [
|
|
'CIPTA_PENDING' => "Oleh $panggilan pada $timestamp",
|
|
'KODE_PENDING' => $kode_pending,
|
|
'JENIS_PENDING' => $jenis_pending,
|
|
'TGL_PENDING' => $now,
|
|
'DURASI_PENDING' => $limit,
|
|
'BARANG_ID' => $id_barang,
|
|
'QTY_PENDING' => $qty_pending,
|
|
'GUDANG_ID' => $id_karyawan,
|
|
'SALES_ID' => $id_sales,
|
|
'PELANGGAN_ID' => $id_pelanggan,
|
|
'NAMA_PENDING' => $nama_pending,
|
|
'STATUS_PENDING' => '0',
|
|
];
|
|
$action = $this->Amod->create('pending', $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 SB_Proses_Sub1_G1_DataPending() {
|
|
$id_pending = $this->input->post('id_pendingpro');
|
|
$now = date('Y-m-d');
|
|
|
|
$datPending = $this->Amod->getData_Pending_byID_bySTATUS($id_pending, 0);
|
|
if ($datPending==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$cekKuantiti = $this->GE_AmbilData_DataKuantiti($datPending[0]['BARANG_ID'], 8);
|
|
if ($cekKuantiti<$datPending[0]['QTY_PENDING']) {
|
|
$this->session->set_flashdata('qty_pen_less', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$this->GE_Kalkulasi_KuantitiBarang($datPending[0]['BARANG_ID'], $datPending[0]['JENIS_PENDING'], "Step 2 - PENDING - Proses Barang", 0, $datPending[0]['QTY_PENDING']);
|
|
|
|
$update = [
|
|
'SELESAI_PENDING' => $now,
|
|
'STATUS_PENDING' => '1',
|
|
];
|
|
$action = $this->Amod->update('pending', $update, 'ID_PENDING', $id_pending);
|
|
|
|
if ($action) {
|
|
$this->session->set_flashdata('success', 'diproses');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
} else {
|
|
$this->session->set_flashdata('failed', 'diproses');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
}
|
|
|
|
public function SB_Perpanjang_Sub1_G1_DataPending() {
|
|
$id_pending = $this->input->post('id_pendingex');
|
|
$durasi_pending = $this->input->post('durasi_pendingex');
|
|
|
|
$datPending = $this->Amod->getData_Pending_byID_bySTATUS($id_pending, 0);
|
|
if ($datPending==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$durasiBaru = $this->Amod->generate_addDay($datPending[0]['DURASI_PENDING'], $durasi_pending);
|
|
$update = [
|
|
'DURASI_PENDING' => $durasiBaru
|
|
];
|
|
$action = $this->Amod->update('pending', $update, 'ID_PENDING', $id_pending);
|
|
|
|
if ($action) {
|
|
$this->session->set_flashdata('success', 'diperpanjang');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
} else {
|
|
$this->session->set_flashdata('failed', 'diperpanjang');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
}
|
|
|
|
//SUBMENU TRANSAKSI - PENGGANTIAN
|
|
public function SB_Sub1_Penggantian_1() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$now = date('Y-m-d');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "SB", "TRANSAKSI - Penggantian");
|
|
$id_menu = $datShm[0]['MENU_ID'];
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$datSgu = $this->Amod->getData_SetGudang_byKARYAWAN_byMENU($id_karyawan, $id_menu);
|
|
if ($datSgu==FALSE) {
|
|
$aktif = 1;
|
|
$input = [
|
|
'KARYAWAN_ID' => $id_karyawan,
|
|
'MENU_ID' => $id_menu,
|
|
'AKTIF_SGU' => $aktif,
|
|
'TIMESTAMP' => $timestamp
|
|
];
|
|
$action = $this->Amod->create('set_gudang', $input);
|
|
} else {
|
|
$aktif = $datSgu[0]['AKTIF_SGU'];
|
|
}
|
|
|
|
$datSnStock = $this->Amod->getData_SnStock_byGUDANG_bySTATUS($aktif, 1);
|
|
|
|
$data = array(
|
|
'sidebar' => "menu stokbarang",
|
|
'navChild' => "stokbarang penggantian",
|
|
'snstock' => $datSnStock,
|
|
'aktif' => $aktif,
|
|
'id_menu' => $id_menu,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil,
|
|
);
|
|
$this->load->view('proses/SB_Sub1_Penggantian_1', $data);
|
|
}
|
|
|
|
public function SB_Ambil_Sub1_H1_DataSnStock() {
|
|
$id_snstock = $this->input->post('id_snstock');
|
|
|
|
$datSnStock = $this->Amod->getData_SnStock_byID($id_snstock);
|
|
$datHsnAsc = $this->Amod->getData_HistoriSn_bySNSTOCK_orderASC($id_snstock);
|
|
$datBarang = $this->Amod->getData_Barang_byID($datSnStock[0]['BARANG_ID']);
|
|
|
|
if ($datSnStock[0]['GUDANG_SNSTOCK']==1) {
|
|
$posisiGudang = "PC MASTER";
|
|
} else if ($datSnStock[0]['GUDANG_SNSTOCK']==2) {
|
|
$posisiGudang = "IT POINT";
|
|
} else if ($datSnStock[0]['GUDANG_SNSTOCK']==3) {
|
|
$posisiGudang = "GUDANG SERVICE";
|
|
}
|
|
|
|
$status_snstock = $datSnStock[0]['STATUS_SNSTOCK'];
|
|
|
|
$limitHsn = 0;
|
|
foreach ($datHsnAsc as $key) {
|
|
if (strpos($key['KODE_BUKTI'],"SD")!==FALSE) {
|
|
$jenisTransaksiAsal = "STOK OPNAME";
|
|
$penyedia = "Sistem Program";
|
|
$kode_buktiAwal = $key['KODE_BUKTI'];
|
|
$tanggalAwal = $key['TANGGAL'];
|
|
break;
|
|
} else if (strpos($key['KODE_BUKTI'],"PB")!==FALSE) {
|
|
$dataSupplier = $this->Amod->getData_Supplier_byID($key['SUPPLIER_ID']);
|
|
$dataPembelian = $this->Amod->getData_Pembelian_byKODE($key['KODE_BUKTI']);
|
|
$inisial = $this->Amod->generate_inisialCorp($dataPembelian[0]['CORP_ID']);
|
|
$jenisTransaksiAsal = "PEMBELIAN [$inisial]";
|
|
$penyedia = $dataSupplier[0]['NAMA_SUPPLIER'];
|
|
$kode_buktiAwal = $key['KODE_BUKTI'];
|
|
$tanggalAwal = $key['TANGGAL'];
|
|
break;
|
|
} else if (strpos($key['KODE_BUKTI'],"SO")!==FALSE OR strpos($key['KODE_BUKTI'],"KM")!==FALSE) {
|
|
$jenisTransaksiAsal = "KELUAR MASUK";
|
|
$dataIo = $this->Amod->getData_TransaksiStock_byKODEBUKTI($key['KODE_BUKTI']);
|
|
$penyedia = $dataIo[0]['NAMA_PANGGILAN_KARYAWAN'];
|
|
$kode_buktiAwal = $key['KODE_BUKTI'];
|
|
$tanggalAwal = $key['TANGGAL'];
|
|
break;
|
|
}
|
|
$limitHsn++;
|
|
|
|
if ($limitHsn==count($datHsnAsc)) {
|
|
$jenisTransaksiAsal = "Dalam Perbaikan";
|
|
$penyedia = "Dalam Perbaikan";
|
|
$kode_buktiAwal = "Dalam Perbaikan";
|
|
$tanggalAwal = "Dalam Perbaikan";
|
|
}
|
|
}
|
|
|
|
foreach ($datHsnAsc as $key) {
|
|
if (strpos($key['KODE_BUKTI'],"PJ")!==FALSE) {
|
|
$dataPelanggan = $this->Amod->getData_Pelanggan_byID($key['PELANGGAN_ID']);
|
|
$dataPenjualan = $this->Amod->getData_Penjualan_byKODE($key['KODE_BUKTI']);
|
|
$inisial = $this->Amod->generate_inisialCorp($dataPenjualan[0]['KOP_ID']);
|
|
$jenisTransaksiAkhir = "PENJUALAN [$inisial]";
|
|
$kodeBuktiAkhir = $key['KODE_BUKTI'];
|
|
$tanggalBuktiAkhir = $key['TANGGAL'];
|
|
$atasNama = $dataPelanggan[0]['NAMA_PELANGGAN'];
|
|
break;
|
|
}
|
|
}
|
|
|
|
$dataSnStock = $this->Amod->getData_SnStock_byBARANG_byGUDANG_bySTATUS($datSnStock[0]['BARANG_ID'], $datSnStock[0]['GUDANG_SNSTOCK'], 0);
|
|
|
|
$data = [
|
|
'kodeBarang' => $datBarang[0]['KODE_BARANG'],
|
|
'namaBarang' => $datBarang[0]['NAMA_BARANG'],
|
|
'posisiGudang' => $posisiGudang,
|
|
'jenisTransaksiAsal' => $jenisTransaksiAsal,
|
|
'kodeBuktiAsal' => $kode_buktiAwal,
|
|
'tanggalBuktiAsal' => $tanggalAwal,
|
|
'penyedia' => $penyedia,
|
|
'jenisTransaksiAkhir' => $jenisTransaksiAkhir,
|
|
'kodeBuktiAkhir' => $kodeBuktiAkhir,
|
|
'tanggalBuktiAkhir' => $tanggalBuktiAkhir,
|
|
'atasNama' => $atasNama,
|
|
'snstockGanti' => $dataSnStock,
|
|
];
|
|
|
|
$this->output_json([
|
|
'data' => $data,
|
|
]);
|
|
}
|
|
|
|
public function SB_Ganti_Sub1_H1_DataPenggantianSn() {
|
|
$id_lama = $this->input->post('id_lama');
|
|
$id_pengganti = $this->input->post('id_pengganti');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
$now = date('Y-m-d');
|
|
|
|
$datSnStockLama = $this->Amod->getData_SnStock_byID_bySTATUS($id_lama, 1);
|
|
$datSnStockBaru = $this->Amod->getData_SnStock_byID_bySTATUS($id_pengganti, 0);
|
|
if ($datSnStockLama==FALSE OR $datSnStockBaru==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$datSnj = $this->Amod->getData_SnJual_byNAMA_orderDESC_limit1($datSnStockLama[0]['NAMA_SNSTOCK']);
|
|
$id_snj = $datSnj[0]['ID_SNJ'];
|
|
$nama_snjLama = $datSnStockLama[0]['NAMA_SNSTOCK'];
|
|
$nama_snjBaru = $datSnStockBaru[0]['NAMA_SNSTOCK'];
|
|
|
|
$datPenjualan = $this->Amod->getData_Penjualan_byDO($datSnj[0]['DO_ID']);
|
|
$datHsn = $this->Amod->getData_HistoriSn_byKODEBUKTI_bySNSTOCK($datPenjualan[0]['KODE_PENJUALAN'], $id_lama);
|
|
|
|
$update = [
|
|
'SNSTOCK_ID' => $id_pengganti
|
|
];
|
|
$action = $this->Amod->update('histori_sn', $update, 'ID_HSN', $datHsn[0]['ID_HSN']);
|
|
|
|
$update = [
|
|
'STATUS_SNSTOCK' => '0'
|
|
];
|
|
$action = $this->Amod->update('sn_stock', $update, 'ID_SNSTOCK', $id_lama);
|
|
|
|
$update = [
|
|
'STATUS_SNSTOCK' => '1'
|
|
];
|
|
$action = $this->Amod->update('sn_stock', $update, 'ID_SNSTOCK', $id_pengganti);
|
|
|
|
$datSnBeli = $this->Amod->getData_SnBeli_byNAMA($nama_snjBaru);
|
|
if ($datSnBeli==TRUE) {
|
|
$datDb = $this->Amod->getData_DaftarBeli_byID($datSnBeli[0]['DB_ID']);
|
|
$kop = $datDb[0]['CORP_ID'];
|
|
} else {
|
|
$kop = 0;
|
|
}
|
|
|
|
$update = [
|
|
'NAMA_SNJ' => $nama_snjBaru,
|
|
'LAMA_SNJ' => $nama_snjLama,
|
|
'KOP_SNJ' => $kop,
|
|
'UBAH_SNJ' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('sn_jual', $update, 'ID_SNJ', $id_snj);
|
|
|
|
if ($action) {
|
|
$this->session->set_flashdata('success', 'diganti');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
} else {
|
|
$this->session->set_flashdata('failed', 'diganti');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
}
|
|
|
|
//SUBMENU TRANSAKSI - SERVICE
|
|
public function SB_Sub1_Service_1() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
$now = date('Y-m-d');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "SB", "TRANSAKSI - Service");
|
|
$id_menu = $datShm[0]['MENU_ID'];
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$datSgu = $this->Amod->getData_SetGudang_byKARYAWAN_byMENU($id_karyawan, $id_menu);
|
|
if ($datSgu==FALSE) {
|
|
$aktif = 1;
|
|
$input = [
|
|
'KARYAWAN_ID' => $id_karyawan,
|
|
'MENU_ID' => $id_menu,
|
|
'AKTIF_SGU' => $aktif,
|
|
'TIMESTAMP' => $timestamp
|
|
];
|
|
$action = $this->Amod->create('set_gudang', $input);
|
|
} else {
|
|
$aktif = $datSgu[0]['AKTIF_SGU'];
|
|
}
|
|
|
|
$datService = $this->Amod->getData_Service_byPEMBUAT_bySTATUS($id_karyawan, 0);
|
|
if ($datService==TRUE) {
|
|
$id_service = $datService[0]['ID_SERVICE'];
|
|
$datDfs = $this->Amod->getData_DaftarService_bySERVICE($id_service);
|
|
$no = 0;
|
|
foreach ($datDfs as $key) {
|
|
$datSns = $this->Amod->getData_SnService_byDFS($key['ID_DFS']);
|
|
$count = $this->Amod->getCount_SnService_byDFS($key['ID_DFS']);
|
|
$datDfs[$no] += ['SN' => $datSns];
|
|
$datDfs[$no++] += ['REAL' => $count];
|
|
}
|
|
$countProsesService = count($datDfs);
|
|
} else {
|
|
$datDfs = NULL;
|
|
$id_service = NULL;
|
|
$countProsesService = 0;
|
|
}
|
|
|
|
$datServiceTunggu = $this->Amod->getData_Service_bySTATUS_byJENIS(1, $aktif);
|
|
$no = 0;
|
|
foreach ($datServiceTunggu as $key) {
|
|
$datDfsPro = $this->Amod->getData_DaftarService_bySERVICE($key['ID_SERVICE']);
|
|
$nose = 0;
|
|
$sn = "";
|
|
foreach ($datDfsPro as $dat) {
|
|
$datSns = $this->Amod->getData_SnService_byDFS_statusNull($dat['ID_DFS']);
|
|
foreach ($datSns as $dit) {
|
|
$nama_sns = $dit['NAMA_SNS'];
|
|
$sn .= "$nama_sns, ";
|
|
}
|
|
$datDfsPro[$nose++] += ['SN' => $sn];
|
|
$sn = "";
|
|
}
|
|
$datServiceTunggu[$no++] += ['BARANG' => $datDfsPro];
|
|
}
|
|
|
|
$datServiceBerjalan = $this->Amod->getData_Service_bySTATUS_byJENIS(2, $aktif);
|
|
$no = 0;
|
|
foreach ($datServiceBerjalan as $key) {
|
|
$datDfsPro = $this->Amod->getData_DaftarService_bySERVICE($key['ID_SERVICE']);
|
|
$nose = 0;
|
|
$sn = "";
|
|
foreach ($datDfsPro as $dat) {
|
|
$datSns = $this->Amod->getData_SnService_byDFS_statusNull($dat['ID_DFS']);
|
|
foreach ($datSns as $dit) {
|
|
$nama_sns = $dit['NAMA_SNS'];
|
|
$sn .= "$nama_sns, ";
|
|
}
|
|
$datDfsPro[$nose++] += ['SN' => $sn];
|
|
$sn = "";
|
|
}
|
|
$datServiceBerjalan[$no++] += ['BARANG' => $datDfsPro];
|
|
}
|
|
|
|
$datSnsSelesai = $this->Amod->getData_SnService_byJENIS_selesaiNotNull_psvNull($aktif);
|
|
$datNonsnService = $this->Amod->getData_NonSnService_byJENIS_groupBARANG_havingMore0($aktif);
|
|
|
|
$datPsv = $this->Amod->getData_PenarikanService_byPENGAMBIL_bySTATUS($id_karyawan, 0);
|
|
if ($datPsv==TRUE) {
|
|
$id_psv = $datPsv[0]['ID_PSV'];
|
|
$datDpsv = $this->Amod->getData_DaftarPenarikanService_byPSV($id_psv);
|
|
$no = 0;
|
|
$sn = "";
|
|
foreach ($datDpsv as $key) {
|
|
$datSns = $this->Amod->getData_SnService_byBARANG_byPSV($key['BARANG_ID'], $id_psv);
|
|
foreach ($datSns as $dat) {
|
|
$nama_sns = $dat['NAMA_SNS'];
|
|
$sn .= "$nama_sns, ";
|
|
}
|
|
$datDpsv[$no++] += ['SN' => $sn];
|
|
$sn = "";
|
|
}
|
|
$countProsesTarik = count($datDpsv);
|
|
} else {
|
|
$datDpsv = NULL;
|
|
$id_psv = NULL;
|
|
$countProsesTarik = 0;
|
|
}
|
|
|
|
$datStpos = $this->Amod->getData_SetTogglePosisi_byKARYAWAN_byMENU($id_karyawan, $id_menu);
|
|
if ($datStpos==FALSE) { $posisiToggle = 0; } else { $posisiToggle = $datStpos[0]['AKTIF_STPOS']; }
|
|
|
|
$datBarang = $this->Amod->getData_Barang_bySTATUS_jenisNot2(1, $aktif);
|
|
$datSiap = $this->Amod->getData_DaftarService_byJENIS_bySTATUS_groupBARANG($aktif, 2);
|
|
|
|
$data = array(
|
|
'sidebar' => "menu stokbarang",
|
|
'navChild' => "stokbarang service",
|
|
'id_menu' => $id_menu,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil,
|
|
'id_service' => $id_service,
|
|
'aktif' => $aktif,
|
|
'dfs' => $datDfs,
|
|
'serviceTunggu' => $datServiceTunggu,
|
|
'serviceBerjalan' => $datServiceBerjalan,
|
|
'snServiceSelesai' => $datSnsSelesai,
|
|
'nonsnServiceSelesai' => $datNonsnService,
|
|
'dpsv' => $datDpsv,
|
|
'countProsesService' => $countProsesService,
|
|
'countTunggu' => count($datServiceTunggu),
|
|
'countBerjalan' => count($datServiceBerjalan),
|
|
'countSnSelesai' => count($datSnsSelesai),
|
|
'countNonSnSelesai' => count($datNonsnService),
|
|
'countProsesTarik' => $countProsesTarik,
|
|
'posisiToggle' => $posisiToggle,
|
|
'barang' => $datBarang,
|
|
'siap' => $datSiap,
|
|
'id_psv' => $id_psv,
|
|
);
|
|
$this->load->view('proses/SB_Sub1_Service_1', $data);
|
|
}
|
|
|
|
public function SB_Ambil_Sub1_I1_DataTipeBarang() {
|
|
$id_barang = $this->input->post('id_barang');
|
|
|
|
$datBarang = $this->Amod->getData_Barang_byID($id_barang);
|
|
|
|
$this->output_json([
|
|
'tipe' => $datBarang[0]['TYPE_JENIS']
|
|
]);
|
|
}
|
|
|
|
public function SB_Ambil_Sub1_I1_DataSnStock() {
|
|
$id_dfs = $this->input->post('id_dfs');
|
|
|
|
$datDfs = $this->Amod->getData_DaftarService_byID($id_dfs);
|
|
$data = $this->Amod->getData_SnStock_byBARANG_byGUDANG_bySTATUS($datDfs[0]['BARANG_ID'], $datDfs[0]['JENIS_SERVICE'], 0);
|
|
$this->output_json([
|
|
'value' => 1,
|
|
'total' => sizeof($data),
|
|
'data' => $data
|
|
]);
|
|
}
|
|
|
|
public function SB_Ambil_Sub1_I1_DataSnService() {
|
|
$id_dfs = $this->input->post('id_dfs');
|
|
|
|
$datDfs = $this->Amod->getData_DaftarService_byID($id_dfs);
|
|
$data = $this->Amod->getData_SnService_byDFS($id_dfs);
|
|
$snstock = $this->Amod->getData_SnStock_byBARANG_byGUDANG_bySTATUS($datDfs[0]['BARANG_ID'], $datDfs[0]['JENIS_SERVICE'], 0);
|
|
|
|
$snReady = [];
|
|
foreach ($snstock as $dat) {
|
|
$nama_snstock = $dat['NAMA_SNSTOCK'];
|
|
$hasil = "$nama_snstock";
|
|
array_push($snReady, $hasil);
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => 1,
|
|
'total' => sizeof($data),
|
|
'data' => $data,
|
|
'snReady' => $snReady,
|
|
'qty' => $datDfs[0]['QTY_DFS']
|
|
]);
|
|
}
|
|
|
|
public function SB_Ambil_Sub1_I1_DataDaftarServiceBerjalan() {
|
|
$jenis_service = $this->input->post('jenis_service');
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
|
|
$datPsv = $this->Amod->getData_PenarikanService_byPENGAMBIL_bySTATUS($id_karyawan, 0);
|
|
if ($datPsv==TRUE) {
|
|
$id_psv = $datPsv[0]['ID_PSV'];
|
|
} else {
|
|
$id_psv = NULL;
|
|
}
|
|
|
|
$data = $this->Amod->getData_DaftarService_byJENIS_bySTATUS_kembaliNotFull($jenis_service, 2);
|
|
$no = 0;
|
|
foreach ($data as $key) {
|
|
$datDpsv = $this->Amod->getData_DaftarPenarikanService_byPSV_byBARANG($id_psv, $key['BARANG_ID']);
|
|
if ($datDpsv==TRUE) {
|
|
$lock = 1;
|
|
} else {
|
|
$lock = 0;
|
|
}
|
|
$data[$no++] += ['LOCK' => $lock];
|
|
}
|
|
|
|
$this->output_json([
|
|
'data' => $data,
|
|
]);
|
|
}
|
|
|
|
public function SB_Ambil_Sub1_I1_DataSnServiceBerjalan() {
|
|
$id_barang = $this->input->post('id_barang');
|
|
$jenis_service = $this->input->post('jenis_service');
|
|
|
|
$data = $this->Amod->getData_SnService_byBARANG_byJENIS_bySTATUS_statusNull($id_barang, $jenis_service, 2);
|
|
$datBarang = $this->Amod->getData_Barang_byID($id_barang);
|
|
|
|
$this->output_json([
|
|
'data' => $data,
|
|
'tipe' => $datBarang[0]['TYPE_JENIS'],
|
|
]);
|
|
}
|
|
|
|
public function SB_Tambah_Sub1_I1_DataDaftarService() {
|
|
$jenis_service = $this->input->post('jenis_servicenew');
|
|
$id_barang = $this->input->post('id_barangnew');
|
|
$qty_dfs = $this->input->post('qty_dfsnew');
|
|
$kel_dfs = $this->input->post('kel_dfsnew');
|
|
$kel_dfs = strtoupper(ltrim(rtrim(preg_replace('/\R+/', " " , $kel_dfs))));
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
$now = date('Y-m-d');
|
|
|
|
$cekKuantiti = $this->GE_AmbilData_DataKuantiti($id_barang, $jenis_service);
|
|
if ($cekKuantiti<$qty_dfs) {
|
|
if ($jenis_service==1) {
|
|
$this->session->set_flashdata('qty_pcm_less', 'error');
|
|
} else if ($jenis_service==2) {
|
|
$this->session->set_flashdata('qty_itp_less', 'error');
|
|
}
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$datService = $this->Amod->getData_Service_byPEMBUAT_bySTATUS($id_karyawan, 0);
|
|
if ($datService==FALSE) {
|
|
$kode_service = $this->Amod->generate_kodeService();
|
|
$input = [
|
|
'CIPTA_SERVICE' => "Oleh $panggilan pada $timestamp",
|
|
'KODE_SERVICE' => $kode_service,
|
|
'TGL_SERVICE' => $now,
|
|
'JENIS_SERVICE' => $jenis_service,
|
|
'PEMBUAT_ID' => $id_karyawan,
|
|
'PAKET_SERVICE' => '0',
|
|
'STATUS_SERVICE' => '0',
|
|
];
|
|
$action = $this->Amod->create('service', $input);
|
|
|
|
$id_service = $this->Amod->getMax_ID_Service();
|
|
$id_service = $id_service[0]['ID_SERVICE'];
|
|
} else {
|
|
$id_service = $datService[0]['ID_SERVICE'];
|
|
|
|
$datDfs = $this->Amod->getData_DaftarService_bySERVICE_byBARANG($id_service, $id_barang);
|
|
if ($datDfs==TRUE) {
|
|
$this->session->set_flashdata('barangid_same', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
}
|
|
|
|
$datBarang = $this->Amod->getData_Barang_byID($id_barang);
|
|
if ($datBarang[0]['TYPE_JENIS']==1) {
|
|
$kel_dfs = "";
|
|
}
|
|
|
|
$input = [
|
|
'SERVICE_ID' => $id_service,
|
|
'BARANG_ID' => $id_barang,
|
|
'QTY_DFS' => $qty_dfs,
|
|
'KEL_DFS' => $kel_dfs,
|
|
'KEMBALI_DFS' => '0'
|
|
];
|
|
$action = $this->Amod->create('daftar_service', $input);
|
|
|
|
$this->GE_Kalkulasi_KuantitiBarang($id_barang, $jenis_service, "Step 1 - SERVICE - Tambah Barang", 0, $qty_dfs);
|
|
|
|
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 SB_Tambah_Sub1_I1_DataDaftarPenarikanService() {
|
|
$tipe = $this->input->post('tipe');
|
|
$jenis_psv = $this->input->post('jenis_psvnew');
|
|
$id_barang = $this->input->post('id_barangtariknew');
|
|
$qty_dpsv = $this->input->post('qty_dpsvnew');
|
|
$sntarik = $this->input->post('id_sntariknew');
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
$now = date('Y-m-d');
|
|
|
|
if ($tipe==1) {
|
|
$qty_dpsv = count($sntarik);
|
|
|
|
foreach ($sntarik as $key) {
|
|
$datSns = $this->Amod->getData_SnService_byID_bySTATUS($key, 7);
|
|
if ($datSns==FALSE OR $datSns[0]['STATUS_SNS']!=NULL OR $datSns[0]['PSV_ID']!=NULL OR $datSns[0]['SELESAI_SNS']==NULL) {
|
|
$this->session->set_flashdata('sn_used', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
}
|
|
}
|
|
|
|
$cekKuantiti = $this->GE_AmbilData_DataKuantiti($id_barang, 10);
|
|
if ($cekKuantiti<$qty_dpsv) {
|
|
$this->session->set_flashdata('qty_srv_less', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$sumDfs = $this->Amod->getSum_DaftarService_byBARANG_byJENIS($id_barang, $jenis_psv);
|
|
if ($sumDfs[0]['TOTAL']<$qty_dpsv) {
|
|
$this->session->set_flashdata('qty_sisaservice_less', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$datPsv = $this->Amod->getData_PenarikanService_byPENGAMBIL_bySTATUS($id_karyawan, 0);
|
|
if ($datPsv==FALSE) {
|
|
$kode_psv = $this->Amod->generate_kodePenarikanService();
|
|
$input = [
|
|
'CIPTA_PSV' => "Oleh $panggilan pada $timestamp",
|
|
'JENIS_PSV' => $jenis_psv,
|
|
'KODE_PSV' => $kode_psv,
|
|
'PENGAMBIL_ID' => $id_karyawan,
|
|
'TGL_PSV' => $now,
|
|
'STATUS_PSV' => '0',
|
|
];
|
|
$action = $this->Amod->create('penarikan_service', $input);
|
|
|
|
$id_psv = $this->Amod->getMax_ID_PenarikanService();
|
|
$id_psv = $id_psv[0]['ID_PSV'];
|
|
} else {
|
|
$id_psv = $datPsv[0]['ID_PSV'];
|
|
|
|
$datDpsv = $this->Amod->getData_DaftarPenarikanService_byPSV_byBARANG($id_psv, $id_barang);
|
|
if ($datDpsv==TRUE) {
|
|
$this->session->set_flashdata('barangid_same', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
}
|
|
|
|
$input = [
|
|
'PSV_ID' => $id_psv,
|
|
'BARANG_ID' => $id_barang,
|
|
'QTY_DPSV' => $qty_dpsv
|
|
];
|
|
$action = $this->Amod->create('daftar_penarikanservice', $input);
|
|
|
|
if ($tipe==0) {
|
|
$datDfs = $this->Amod->getData_DaftarService_byBARANG_byJENIS_bySTATUS_byORDER($id_barang, $jenis_psv, 1, 1);
|
|
$target = $qty_dpsv;
|
|
foreach ($datDfs as $key) {
|
|
if ($target>0) {
|
|
if ($key['QTY_DFS']>$key['KEMBALI_DFS']) {
|
|
$selisih = $key['QTY_DFS']-$key['KEMBALI_DFS'];
|
|
if ($selisih>=$target) {
|
|
$kembali_dfs = $key['KEMBALI_DFS']+$target;
|
|
$target = 0;
|
|
} else {
|
|
$target = $target-$selisih;
|
|
$kembali_dfs = $key['QTY_DFS'];
|
|
}
|
|
$update = [
|
|
'KEMBALI_DFS' => $kembali_dfs
|
|
];
|
|
$action = $this->Amod->update('daftar_service', $update, 'ID_DFS', $key['ID_DFS']);
|
|
}
|
|
}
|
|
}
|
|
} else if ($tipe==1) {
|
|
foreach ($sntarik as $key) {
|
|
$datSns = $this->Amod->getData_SnService_byID_selesaiNotNull_psvNull_statusNull($key);
|
|
if ($datSns==TRUE) {
|
|
$update = [
|
|
'PSV_ID' => $id_psv,
|
|
'STATUS_SNS' => '0'
|
|
];
|
|
$action = $this->Amod->update('sn_service', $update, 'ID_SNS', $key);
|
|
|
|
$datDfs = $this->Amod->getData_DaftarService_byID($datSns[0]['DFS_ID']);
|
|
$kembaliLama = $datDfs[0]['KEMBALI_DFS'];
|
|
$kembaliBaru = $kembaliLama+1;
|
|
|
|
$update = [
|
|
'KEMBALI_DFS' => $kembaliBaru
|
|
];
|
|
$action = $this->Amod->update('daftar_service', $update, 'ID_DFS', $datSns[0]['DFS_ID']);
|
|
}
|
|
}
|
|
}
|
|
|
|
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 SB_Ubah_Sub1_I1_DataKeluhanSns() {
|
|
$id_sns = $this->input->post('id_snsed');
|
|
$kel_sns = $this->input->post('kel_snsed');
|
|
$kel_sns = strtoupper(ltrim(rtrim(preg_replace('/\R+/', " " , $kel_sns))));
|
|
|
|
$datSns = $this->Amod->getData_SnService_byID($id_sns);
|
|
if ($datSns==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$update = [
|
|
'KEL_SNS' => $kel_sns
|
|
];
|
|
$action = $this->Amod->update('sn_service', $update, 'ID_SNS', $id_sns);
|
|
|
|
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 SB_Hapus_Sub1_I1_DataDaftarService() {
|
|
$id_dfs = $this->input->post('id_dfsdel');
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
|
|
$datDfs = $this->Amod->getData_DaftarService_byID($id_dfs);
|
|
if ($datDfs==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$id_service = $datDfs[0]['SERVICE_ID'];
|
|
$datService = $this->Amod->getData_Service_byID_byPEMBUAT_bySTATUS($id_service, $id_karyawan, 0);
|
|
if ($datService==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$cekKuantiti = $this->GE_AmbilData_DataKuantiti($datDfs[0]['BARANG_ID'], 3);
|
|
if ($cekKuantiti<$datDfs[0]['QTY_DFS']) {
|
|
$this->session->set_flashdata('qty_pro_less', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
if ($datDfs[0]['TYPE_JENIS']==1) {
|
|
$datSns = $this->Amod->getData_SnService_byDFS($id_dfs);
|
|
foreach ($datSns as $key) {
|
|
$datSnStock = $this->Amod->getData_SnStock_byNAMA_bySTATUS($key['NAMA_SNS'], 17);
|
|
if ($datSnStock==TRUE) {
|
|
$update = [
|
|
'STATUS_SNSTOCK' => '0'
|
|
];
|
|
$action = $this->Amod->update('sn_stock', $update, 'ID_SNSTOCK', $datSnStock[0]['ID_SNSTOCK']);
|
|
}
|
|
}
|
|
$action = $this->Amod->delete('sn_service', $id_dfs, 'DFS_ID');
|
|
}
|
|
$this->GE_Kalkulasi_KuantitiBarang($datDfs[0]['BARANG_ID'], $datService[0]['JENIS_SERVICE'], "Step 1 - SERVICE - Hapus Barang", 0, $datDfs[0]['QTY_DFS']);
|
|
|
|
$action = $this->Amod->delete('daftar_service', $id_dfs, 'ID_DFS');
|
|
|
|
$countAfter = $this->Amod->getCount_DaftarService_bySERVICE($id_service);
|
|
if ($countAfter==0) {
|
|
$action = $this->Amod->delete('service', $id_service, 'ID_SERVICE');
|
|
}
|
|
|
|
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 SB_Hapus_Sub1_I1_DataDaftarPenarikanService() {
|
|
$id_dpsv = $this->input->post('id_dpsvdel');
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
|
|
$datDpsv = $this->Amod->getData_DaftarPenarikanService_byID($id_dpsv);
|
|
if ($datDpsv==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$id_psv = $datDpsv[0]['PSV_ID'];
|
|
$datPsv = $this->Amod->getData_PenarikanService_byID_byPENGAMBIL_bySTATUS($id_psv, $id_karyawan, 0);
|
|
if ($datPsv==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
if ($datDpsv[0]['TYPE_JENIS']==0) {
|
|
$datDfs = $this->Amod->getData_DaftarService_byBARANG_byJENIS_bySTATUS_byORDER($datDpsv[0]['BARANG_ID'], $datPsv[0]['JENIS_PSV'], 1, 2);
|
|
$target = $datDpsv[0]['QTY_DPSV'];
|
|
foreach ($datDfs as $key) {
|
|
if ($target>0) {
|
|
if ($key['KEMBALI_DFS']>0) {
|
|
if ($target>=$key['KEMBALI_DFS']) {
|
|
$target = $target-$key['KEMBALI_DFS'];
|
|
$kembali_dfs = 0;
|
|
} else {
|
|
$kembali_dfs = $key['KEMBALI_DFS']-$target;
|
|
$target = 0;
|
|
}
|
|
$update = [
|
|
'KEMBALI_DFS' => $kembali_dfs
|
|
];
|
|
$action = $this->Amod->update('daftar_service', $update, 'ID_DFS', $key['ID_DFS']);
|
|
}
|
|
}
|
|
}
|
|
} else if ($datDpsv[0]['TYPE_JENIS']==1) {
|
|
$datSns = $this->Amod->getData_SnService_byBARANG_byPSV_bySTATUS($datDpsv[0]['BARANG_ID'], $id_psv, 0);
|
|
foreach ($datSns as $key) {
|
|
$update = [
|
|
'PSV_ID' => NULL,
|
|
'STATUS_SNK' => NULL
|
|
];
|
|
$action = $this->Amod->update('sn_service', $update, 'ID_SNS', $key['ID_SNS']);
|
|
|
|
$datDfs = $this->Amod->getData_DaftarService_byID($key['DFS_ID']);
|
|
$kembaliLama = $datDfs[0]['KEMBALI_DFS'];
|
|
$kembaliBaru = $kembaliLama-1;
|
|
|
|
$update = [
|
|
'KEMBALI_DFS' => $kembaliBaru
|
|
];
|
|
$action = $this->Amod->update('daftar_service', $update, 'ID_DFS', $key['DFS_ID']);
|
|
}
|
|
}
|
|
|
|
$action = $this->Amod->delete('daftar_penarikanservice', $id_dpsv, 'ID_DPSV');
|
|
|
|
$countAfter = $this->Amod->getCount_DaftarPenarikanService_byPSV($id_psv);
|
|
if ($countAfter==0) {
|
|
$action = $this->Amod->delete('penarikan_service', $id_psv, 'ID_PSV');
|
|
}
|
|
|
|
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 SB_Proses_Sub1_I1_DataService() {
|
|
$id_service = $this->input->post('id_servicepro');
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$now = date('Y-m-d');
|
|
|
|
$datService = $this->Amod->getData_Service_byID_byPEMBUAT_bySTATUS($id_service, $id_karyawan, 0);
|
|
if ($datService==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$datDfs = $this->Amod->getData_DaftarService_bySERVICE($id_service);
|
|
foreach ($datDfs as $key) {
|
|
$cekKuantiti = $this->GE_AmbilData_DataKuantiti($key['BARANG_ID'], 3);
|
|
if ($cekKuantiti<$key['QTY_DFS']) {
|
|
$this->session->set_flashdata('qty_pro_less', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
if ($key['TYPE_JENIS']==0) {
|
|
if ($key['KEL_DFS']==NULL OR $key['KEL_DFS']=="") {
|
|
$this->session->set_flashdata('kel_null', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
} else if ($key['TYPE_JENIS']==1) {
|
|
$count = $this->Amod->getCount_SnService_byDFS($key['ID_DFS']);
|
|
if ($count<$key['QTY_DFS']) {
|
|
$this->session->set_flashdata('sncount_less', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$datSns = $this->Amod->getData_SnService_byDFS($key['ID_DFS']);
|
|
foreach ($datSns as $dat) {
|
|
if ($dat['KEL_SNS']==NULL OR $dat['KEL_SNS']=="") {
|
|
$this->session->set_flashdata('kel_null', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
foreach ($datDfs as $key) {
|
|
if ($key['TYPE_JENIS']==1) {
|
|
$datSns = $this->Amod->getData_SnService_byDFS($key['ID_DFS']);
|
|
foreach ($datSns as $dat) {
|
|
$datSnStock = $this->Amod->getData_SnStock_byNAMA_bySTATUS($dat['NAMA_SNS'], 17);
|
|
if ($datSnStock==TRUE) {
|
|
$update = [
|
|
'STATUS_SNSTOCK' => '7'
|
|
];
|
|
$action = $this->Amod->update('sn_stock', $update, 'ID_SNSTOCK', $datSnStock[0]['ID_SNSTOCK']);
|
|
}
|
|
}
|
|
}
|
|
|
|
$this->GE_Kalkulasi_KuantitiBarang($key['BARANG_ID'], $datService[0]['JENIS_SERVICE'], "Step 2 - SERVICE - Proses Barang", 0, $key['QTY_DFS']);
|
|
}
|
|
|
|
$update = [
|
|
'STATUS_SERVICE' => '1'
|
|
];
|
|
$action = $this->Amod->update('service', $update, 'ID_SERVICE', $id_service);
|
|
|
|
if ($action) {
|
|
$this->session->set_flashdata('success', 'diproses');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
} else {
|
|
$this->session->set_flashdata('failed', 'diproses');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
}
|
|
|
|
public function SB_Proses_Sub1_I1_DataPenarikanService() {
|
|
$id_psv = $this->input->post('id_psvpro');
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$now = date('Y-m-d');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$datPsv = $this->Amod->getData_PenarikanService_byID_byPENGAMBIL_bySTATUS($id_psv, $id_karyawan, 0);
|
|
if ($datPsv==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$datDpsv = $this->Amod->getData_DaftarPenarikanService_byPSV($id_psv);
|
|
foreach ($datDpsv as $key) {
|
|
if ($key['TYPE_JENIS']==0) {
|
|
$input = [
|
|
'JENIS_NONSNS' => $datPsv[0]['JENIS_PSV'],
|
|
'TGL_NONSNS' => $now,
|
|
'KODE_BUKTI' => $datPsv[0]['KODE_PSV'],
|
|
'BARANG_ID' => $key['BARANG_ID'],
|
|
'MASUK_NONSNS' => '0',
|
|
'KELUAR_NONSNS' => $key['QTY_DPSV'],
|
|
'TERIMA_NONSNS' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->create('nonsn_service', $input);
|
|
} else if ($key['TYPE_JENIS']==1) {
|
|
$datSns = $this->Amod->getData_SnService_byPSV_byBARANG_bySTATUS($id_psv, $key['BARANG_ID'], 0);
|
|
foreach ($datSns as $dat) {
|
|
$datSnStock = $this->Amod->getData_SnStock_byNAMA_bySTATUS($dat['NAMA_SNS'], 7);
|
|
if ($datSnStock==TRUE) {
|
|
$update = [
|
|
'STATUS_SNSTOCK' => '0'
|
|
];
|
|
$action = $this->Amod->update('sn_stock', $update, 'ID_SNSTOCK', $datSnStock[0]['ID_SNSTOCK']);
|
|
}
|
|
|
|
$update = [
|
|
'STATUS_SNS' => '1'
|
|
];
|
|
$action = $this->Amod->update('sn_service', $update, 'ID_SNS', $dat['ID_SNS']);
|
|
}
|
|
}
|
|
|
|
$this->GE_Kalkulasi_KuantitiBarang($key['BARANG_ID'], $datPsv[0]['JENIS_PSV'], "Step 3 - SERVICE - Tarik Barang", 0, $key['QTY_DPSV']);
|
|
}
|
|
|
|
$update = [
|
|
'STATUS_PSV' => '1'
|
|
];
|
|
$action = $this->Amod->update('penarikan_service', $update, 'ID_PSV', $id_psv);
|
|
|
|
$datService = $this->Amod->getData_Service_bySTATUS(2);
|
|
foreach ($datService as $key) {
|
|
$datDfs = $this->Amod->getData_DaftarService_bySERVICE($key['ID_SERVICE']);
|
|
$countDfs = $this->Amod->getCount_DaftarService_bySERVICE($key['ID_SERVICE']);
|
|
$nocek = 0;
|
|
foreach ($datDfs as $dat) {
|
|
if ($dat['QTY_DFS']==$dat['KEMBALI_DFS']) {
|
|
$nocek++;
|
|
}
|
|
}
|
|
if ($countDfs==$nocek) {
|
|
$update = [
|
|
'STATUS_SERVICE' => '3'
|
|
];
|
|
$action = $this->Amod->update('service', $update, 'ID_SERVICE', $key['ID_SERVICE']);
|
|
}
|
|
}
|
|
|
|
if ($action) {
|
|
$this->session->set_flashdata('success', 'ditarik');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
} else {
|
|
$this->session->set_flashdata('failed', 'ditarik');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
}
|
|
|
|
public function SB_Batal_Sub1_I1_DataService() {
|
|
$id_service = $this->input->post('id_servicevoid');
|
|
$ket_batal = $this->input->post('ket_batalvoid');
|
|
$ket_batal = strtoupper(ltrim(rtrim(preg_replace('/\R+/', " " , $ket_batal))));
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$now = date('Y-m-d');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$datService = $this->Amod->getData_Service_byID_bySTATUS($id_service, 1);
|
|
if ($datService==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$datDfs = $this->Amod->getData_DaftarService_bySERVICE($id_service);
|
|
foreach ($datDfs as $key) {
|
|
$cekKuantiti = $this->GE_AmbilData_DataKuantiti($key['BARANG_ID'], 10);
|
|
if ($cekKuantiti<$key['QTY_DFS']) {
|
|
$this->session->set_flashdata('qty_srv_less', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
}
|
|
|
|
foreach ($datDfs as $key) {
|
|
if ($key['TYPE_JENIS']==1) {
|
|
$datSns = $this->Amod->getData_SnService_byDFS($key['ID_DFS']);
|
|
foreach ($datSns as $dat) {
|
|
$datSnStock = $this->Amod->getData_SnStock_byNAMA_bySTATUS($dat['NAMA_SNS'], 7);
|
|
if ($datSnStock==TRUE) {
|
|
$update = [
|
|
'STATUS_SNSTOCK' => '0'
|
|
];
|
|
$action = $this->Amod->update('sn_stock', $update, 'ID_SNSTOCK', $datSnStock[0]['ID_SNSTOCK']);
|
|
}
|
|
|
|
$updat = [
|
|
'STATUS_SNS' => '9'
|
|
];
|
|
$action = $this->Amod->update('sn_service', $update, 'ID_SNS', $dat['ID_SNS']);
|
|
}
|
|
}
|
|
|
|
$this->GE_Kalkulasi_KuantitiBarang($key['BARANG_ID'], $datService[0]['JENIS_SERVICE'], "Step 3 - SERVICE - Batalkan Barang", 0, $key['QTY_DFS']);
|
|
}
|
|
|
|
$update = [
|
|
'STATUS_SERVICE' => '9',
|
|
'KET_BATAL' => $ket_batal,
|
|
'BATAL_SERVICE' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('service', $update, 'ID_SERVICE', $id_service);
|
|
|
|
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 SB_Simpan_Sub1_I1_DataSnService() {
|
|
$id_snstock = $this->input->post('id_snstock');
|
|
$id_dfs = $this->input->post('id_dfs');
|
|
|
|
$value = 0;
|
|
$datDfs = $this->Amod->getData_DaftarService_byID($id_dfs);
|
|
if ($datDfs==FALSE) {
|
|
$value = 8;
|
|
} else {
|
|
$datSnStock = $this->Amod->getData_SnStock_byID($id_snstock);
|
|
if ($datSnStock==FALSE) {
|
|
$value = 7;
|
|
} else {
|
|
if ($datSnStock[0]['STATUS_SNSTOCK']!=0) {
|
|
$value = 6;
|
|
} else {
|
|
if ($datSnStock[0]['BARANG_ID']!=$datDfs[0]['BARANG_ID']) {
|
|
$value = 5;
|
|
} else {
|
|
if ($datSnStock[0]['GUDANG_SNSTOCK']!=$datDfs[0]['JENIS_SERVICE']) {
|
|
$value = 4;
|
|
} else {
|
|
$countBefore = $this->Amod->getCount_SnService_byDFS($id_dfs);
|
|
if ($countBefore>=$datDfs[0]['QTY_DFS']) {
|
|
$value = 3;
|
|
} else {
|
|
$input = [
|
|
'DFS_ID' => $id_dfs,
|
|
'NAMA_SNS' => $datSnStock[0]['NAMA_SNSTOCK'],
|
|
'SERVICE_ID' => $datDfs[0]['SERVICE_ID'],
|
|
'GARANSI_SNS' => '1'
|
|
];
|
|
$action = $this->Amod->create('sn_service', $input);
|
|
|
|
$update = [
|
|
'STATUS_SNSTOCK' => '17'
|
|
];
|
|
$action = $this->Amod->update('sn_stock', $update, 'ID_SNSTOCK', $id_snstock);
|
|
|
|
$countAfter = $this->Amod->getCount_SnService_byDFS($id_dfs);
|
|
if ($countAfter==$datDfs[0]['QTY_DFS']) {
|
|
$value = 2;
|
|
} else {
|
|
$value = 1;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
}
|
|
|
|
public function SB_Simpan_Sub1_I1_DataSnServiceBarcode() {
|
|
$id_sns = $this->input->post('id_sns');
|
|
$id_dfs = $this->input->post('id_dfs');
|
|
$nama_sns = $this->input->post('nama_sns');
|
|
$nama_sns = strtoupper($nama_sns);
|
|
|
|
$value = 0;
|
|
$datDfs = $this->Amod->getData_DaftarService_byID($id_dfs);
|
|
if ($datDfs==FALSE) {
|
|
$value = 8;
|
|
} else {
|
|
$datSnStock = $this->Amod->getData_SnStock_byNAMA_allStatus($nama_sns);
|
|
if ($datSnStock==FALSE) {
|
|
$value = 7;
|
|
} else {
|
|
if ($datSnStock[0]['STATUS_SNSTOCK']!=0) {
|
|
$value = 6;
|
|
} else {
|
|
if ($datSnStock[0]['BARANG_ID']!=$datDfs[0]['BARANG_ID']) {
|
|
$value = 5;
|
|
} else {
|
|
if ($datSnStock[0]['GUDANG_SNSTOCK']!=$datDfs[0]['JENIS_SERVICE']) {
|
|
$value = 4;
|
|
} else {
|
|
$countBefore = $this->Amod->getCount_SnService_byDFS($id_dfs);
|
|
if ($countBefore>=$datDfs[0]['QTY_DFS']) {
|
|
$value = 3;
|
|
} else {
|
|
$input = [
|
|
'DFS_ID' => $id_dfs,
|
|
'NAMA_SNS' => $nama_sns,
|
|
'SERVICE_ID' => $datDfs[0]['SERVICE_ID'],
|
|
'GARANSI_SNS' => '1'
|
|
];
|
|
$action = $this->Amod->create('sn_service', $input);
|
|
|
|
$update = [
|
|
'STATUS_SNSTOCK' => '17'
|
|
];
|
|
$action = $this->Amod->update('sn_stock', $update, 'ID_SNSTOCK', $datSnStock[0]['ID_SNSTOCK']);
|
|
|
|
$countAfter = $this->Amod->getCount_SnService_byDFS($id_dfs);
|
|
if ($countAfter==$datDfs[0]['QTY_DFS']) {
|
|
$value = 2;
|
|
} else {
|
|
$value = 1;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
}
|
|
|
|
public function SB_Hapus_Sub1_I1_DataSnService() {
|
|
$id_sns = $this->input->post('id_sns');
|
|
$id_dfs = $this->input->post('id_dfs');
|
|
|
|
$value = 0;
|
|
$datDfs = $this->Amod->getData_DaftarService_byID($id_dfs);
|
|
if ($datDfs==FALSE) {
|
|
$value = 4;
|
|
} else {
|
|
$datSns = $this->Amod->getData_SnService_byID_bySTATUS($id_sns, 17);
|
|
if ($datSns==FALSE) {
|
|
$value = 3;
|
|
} else {
|
|
$countBefore = $this->Amod->getCount_SnService_byDFS($id_dfs);
|
|
|
|
$update = [
|
|
'STATUS_SNSTOCK' => '0'
|
|
];
|
|
$action = $this->Amod->update('sn_stock', $update, 'ID_SNSTOCK', $datSns[0]['ID_SNSTOCK']);
|
|
$action = $this->Amod->delete('sn_service', $id_sns, 'ID_SNS');
|
|
|
|
if ($countBefore==$datDfs[0]['QTY_DFS']) {
|
|
$value = 2;
|
|
} else {
|
|
$value = 1;
|
|
}
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
}
|
|
|
|
//SUBMENU TRANSAKSI - SEWA
|
|
public function SB_Sub1_Sewa_1() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
$now = date('Y-m-d');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "SB", "TRANSAKSI - Sewa");
|
|
$id_menu = $datShm[0]['MENU_ID'];
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$datSewa = $this->Amod->getData_Sewa_byGUDANG_bySTATUS($id_karyawan, 0);
|
|
if ($datSewa==TRUE) {
|
|
$id_sewa = $datSewa[0]['ID_SEWA'];
|
|
$datDfsw = $this->Amod->getData_DaftarSewa_bySEWA($id_sewa);
|
|
$no = 0;
|
|
foreach ($datDfsw as $key) {
|
|
$count = $this->Amod->getCount_SnSewa_byDFSW($key['ID_DFSW']);
|
|
$datDfsw[$no++] += ['REAL' => $count];
|
|
}
|
|
$countProsesSewa = count($datDfsw);
|
|
} else {
|
|
$datDfsw = NULL;
|
|
$id_sewa = NULL;
|
|
$countProsesSewa = 0;
|
|
}
|
|
|
|
$datSewaBerjalan = $this->Amod->getData_Sewa_bySTATUS(1);
|
|
$no = 0;
|
|
foreach ($datSewaBerjalan as $key) {
|
|
$datDfswPro = $this->Amod->getData_DaftarSewa_bySEWA($key['ID_SEWA']);
|
|
$nosw = 0;
|
|
$sn = "";
|
|
foreach ($datDfswPro as $dat) {
|
|
$datSnsw = $this->Amod->getData_SnSewa_byDFSW_statusNull($dat['ID_DFSW']);
|
|
foreach ($datSnsw as $dit) {
|
|
$nama_snsw = $dit['NAMA_SNSW'];
|
|
$sn .= "$nama_snsw, ";
|
|
}
|
|
$datDfswPro[$nosw++] += ['SN' => $sn];
|
|
$sn = "";
|
|
}
|
|
$datSewaBerjalan[$no++] += ['BARANG' => $datDfswPro];
|
|
}
|
|
|
|
$datPs = $this->Amod->getData_PenarikanSewa_byGUDANG_bySTATUS($id_karyawan, 0);
|
|
if ($datPs==TRUE) {
|
|
$id_ps = $datPs[0]['ID_PS'];
|
|
$id_peltarik = $datPs[0]['PELANGGAN_ID'];
|
|
$nama_peltarik = $datPs[0]['NAMA_PELANGGAN'];
|
|
$datDps = $this->Amod->getData_DaftarPenarikanSewa_byPS($id_ps);
|
|
$no = 0;
|
|
$sn = "";
|
|
foreach ($datDps as $key) {
|
|
$datSnsw = $this->Amod->getData_SnSewa_byBARANG_byPS($key['BARANG_ID'], $id_ps);
|
|
foreach ($datSnsw as $dat) {
|
|
$nama_snsw = $dat['NAMA_SNSW'];
|
|
$sn .= "$nama_snsw, ";
|
|
}
|
|
$datDps[$no++] += ['SN' => $sn];
|
|
$sn = "";
|
|
}
|
|
$countProsesTarik = count($datDps);
|
|
} else {
|
|
$datDps = NULL;
|
|
$id_ps = NULL;
|
|
$nama_peltarik = NULL;
|
|
$id_peltarik = 0;
|
|
$countProsesTarik = 0;
|
|
}
|
|
|
|
$datStpos = $this->Amod->getData_SetTogglePosisi_byKARYAWAN_byMENU($id_karyawan, $id_menu);
|
|
if ($datStpos==FALSE) { $posisiToggle = 0; } else { $posisiToggle = $datStpos[0]['AKTIF_STPOS']; }
|
|
|
|
$datBarang = $this->Amod->getData_Barang_bySTATUS_jenisNot2(1, 1);
|
|
$datKaryawan = $this->Amod->getData_Karyawan_allSales();
|
|
$datPelanggan = $this->Amod->getData_Pelanggan_bySTATUS(1);
|
|
$datPelTarik = $this->Amod->getData_Sewa_bySTATUS_groupPELANGGAN(1);
|
|
|
|
$data = array(
|
|
'sidebar' => "menu stokbarang",
|
|
'navChild' => "stokbarang sewa",
|
|
'tgl' => $now,
|
|
'id_menu' => $id_menu,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil,
|
|
'id_sewa' => $id_sewa,
|
|
'id_ps' => $id_ps,
|
|
'id_peltarik' => $id_peltarik,
|
|
'nama_peltarik' => $nama_peltarik,
|
|
'dfsw' => $datDfsw,
|
|
'dps' => $datDps,
|
|
'sewa' => $datSewaBerjalan,
|
|
'countProsesSewa' => $countProsesSewa,
|
|
'countBerjalan' => count($datSewaBerjalan),
|
|
'countProsesTarik' => $countProsesTarik,
|
|
'posisiToggle' => $posisiToggle,
|
|
'barang' => $datBarang,
|
|
'karyawan' => $datKaryawan,
|
|
'pelanggan' => $datPelanggan,
|
|
'peltarik' => $datPelTarik,
|
|
);
|
|
$this->load->view('proses/SB_Sub1_Sewa_1', $data);
|
|
}
|
|
|
|
public function SB_Ambil_Sub1_J1_DataSnStock() {
|
|
$id_dfsw = $this->input->post('id_dfsw');
|
|
|
|
$datDfsw = $this->Amod->getData_DaftarSewa_byID($id_dfsw);
|
|
$data = $this->Amod->getData_SnStock_byBARANG_byGUDANG_bySTATUS($datDfsw[0]['BARANG_ID'], 1, 0);
|
|
|
|
$this->output_json([
|
|
'value' => 1,
|
|
'total' => sizeof($data),
|
|
'data' => $data
|
|
]);
|
|
}
|
|
|
|
public function SB_Ambil_Sub1_J1_DataSnSewa() {
|
|
$id_dfsw = $this->input->post('id_dfsw');
|
|
|
|
$datDfsw = $this->Amod->getData_DaftarSewa_byID($id_dfsw);
|
|
$data = $this->Amod->getData_SnSewa_byDFSW($id_dfsw);
|
|
$snstock = $this->Amod->getData_SnStock_byBARANG_byGUDANG_bySTATUS($datDfsw[0]['BARANG_ID'], 1, 0);
|
|
|
|
$snReady = [];
|
|
foreach ($snstock as $dat) {
|
|
$nama_snstock = $dat['NAMA_SNSTOCK'];
|
|
$hasil = "$nama_snstock";
|
|
array_push($snReady, $hasil);
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => 1,
|
|
'total' => sizeof($data),
|
|
'data' => $data,
|
|
'snReady' => $snReady,
|
|
'qty' => $datDfsw[0]['QTY_DFSW']
|
|
]);
|
|
}
|
|
|
|
public function SB_Ambil_Sub1_J1_DataDaftarSewaBerjalan() {
|
|
$id_pelanggan = $this->input->post('id_pelanggan');
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
|
|
$datPs = $this->Amod->getData_PenarikanSewa_byGUDANG_bySTATUS($id_karyawan, 0);
|
|
if ($datPs==TRUE) {
|
|
$id_ps = $datPs[0]['ID_PS'];
|
|
} else {
|
|
$id_ps = NULL;
|
|
}
|
|
|
|
$data = $this->Amod->getData_DaftarSewa_byPELANGGAN_bySTATUS_kembaliNotFull($id_pelanggan, 1);
|
|
$no = 0;
|
|
foreach ($data as $key) {
|
|
$datDps = $this->Amod->getData_DaftarPenarikanSewa_byPS_byBARANG($id_ps, $key['BARANG_ID']);
|
|
if ($datDps==TRUE) {
|
|
$lock = 1;
|
|
} else {
|
|
$lock = 0;
|
|
}
|
|
$data[$no++] += ['LOCK' => $lock];
|
|
}
|
|
|
|
$this->output_json([
|
|
'data' => $data,
|
|
]);
|
|
}
|
|
|
|
public function SB_Ambil_Sub1_J1_DataSnSewaBerjalan() {
|
|
$id_barang = $this->input->post('id_barang');
|
|
$id_pelanggan = $this->input->post('id_pelanggan');
|
|
|
|
$data = $this->Amod->getData_SnSewa_byBARANG_byPELANGGAN_bySTATUS_statusNull($id_barang, $id_pelanggan, 1);
|
|
$datBarang = $this->Amod->getData_Barang_byID($id_barang);
|
|
|
|
$this->output_json([
|
|
'data' => $data,
|
|
'tipe' => $datBarang[0]['TYPE_JENIS'],
|
|
]);
|
|
}
|
|
|
|
public function SB_Tambah_Sub1_J1_DataDaftarSewa() {
|
|
$id_barang = $this->input->post('id_barangnew');
|
|
$qty_dfsw = $this->input->post('qty_dfswnew');
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
$now = date('Y-m-d');
|
|
|
|
$cekKuantiti = $this->GE_AmbilData_DataKuantiti($id_barang, 1);
|
|
if ($cekKuantiti<$qty_dfsw) {
|
|
$this->session->set_flashdata('qty_pcm_less', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$datSewa = $this->Amod->getData_Sewa_byGUDANG_bySTATUS($id_karyawan, 0);
|
|
if ($datSewa==FALSE) {
|
|
$kode_sewa = $this->Amod->generate_kodeSewa();
|
|
$input = [
|
|
'CIPTA_SEWA' => "Oleh $panggilan pada $timestamp",
|
|
'GUDANG_ID' => $id_karyawan,
|
|
'KODE_SEWA' => $kode_sewa,
|
|
'TGL_SEWA' => $now,
|
|
'STATUS_SEWA' => '0',
|
|
];
|
|
$action = $this->Amod->create('sewa', $input);
|
|
|
|
$id_sewa = $this->Amod->getMax_ID_Sewa();
|
|
$id_sewa = $id_sewa[0]['ID_SEWA'];
|
|
} else {
|
|
$id_sewa = $datSewa[0]['ID_SEWA'];
|
|
|
|
$datDfsw = $this->Amod->getData_DaftarSewa_bySEWA_byBARANG($id_sewa, $id_barang);
|
|
if ($datDfsw==TRUE) {
|
|
$this->session->set_flashdata('barangid_same', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
}
|
|
|
|
$input = [
|
|
'SEWA_ID' => $id_sewa,
|
|
'BARANG_ID' => $id_barang,
|
|
'QTY_DFSW' => $qty_dfsw,
|
|
'KEMBALI_DFSW' => '0'
|
|
];
|
|
$action = $this->Amod->create('daftar_sewa', $input);
|
|
|
|
$this->GE_Kalkulasi_KuantitiBarang($id_barang, 1, "Step 1 - SEWA - Tambah Barang", 0, $qty_dfsw);
|
|
|
|
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 SB_Tambah_Sub1_J1_DataDaftarPenarikanSewa() {
|
|
$tipe = $this->input->post('tipe');
|
|
$id_pelanggan = $this->input->post('id_peltariknew');
|
|
$id_barang = $this->input->post('id_barangtariknew');
|
|
$qty_dps = $this->input->post('qty_dpsnew');
|
|
$sntarik = $this->input->post('id_sntariknew');
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
$now = date('Y-m-d');
|
|
|
|
if ($tipe==1) {
|
|
$qty_dps = count($sntarik);
|
|
|
|
foreach ($sntarik as $key) {
|
|
$datSnsw = $this->Amod->getData_SnSewa_byID_bySTATUS($key, 20);
|
|
if ($datSnsw==FALSE OR $datSnsw[0]['STATUS_SNSW']!=NULL OR $datSnsw[0]['PS_ID']!=NULL) {
|
|
$this->session->set_flashdata('sn_used', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
}
|
|
}
|
|
|
|
$cekKuantiti = $this->GE_AmbilData_DataKuantiti($id_barang, 11);
|
|
if ($cekKuantiti<$qty_dps) {
|
|
$this->session->set_flashdata('qty_sewa_less', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$sumDfsw = $this->Amod->getSum_DaftarSewa_byPELANGGAN_byBARANG($id_pelanggan, $id_barang);
|
|
if ($sumDfsw[0]['TOTAL']<$qty_dps) {
|
|
$this->session->set_flashdata('qty_sisasewa_less', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$datPs = $this->Amod->getData_PenarikanSewa_byGUDANG_bySTATUS($id_karyawan, 0);
|
|
if ($datPs==FALSE) {
|
|
$kode_ps = $this->Amod->generate_kodePenarikanSewa();
|
|
$input = [
|
|
'CIPTA_PS' => "Oleh $panggilan pada $timestamp",
|
|
'KODE_PS' => $kode_ps,
|
|
'GUDANG_ID' => $id_karyawan,
|
|
'PELANGGAN_ID' => $id_pelanggan,
|
|
'TGL_PS' => $now,
|
|
'STATUS_PS' => '0',
|
|
];
|
|
$action = $this->Amod->create('penarikan_sewa', $input);
|
|
|
|
$id_ps = $this->Amod->getMax_ID_PenarikanSewa();
|
|
$id_ps = $id_ps[0]['ID_PS'];
|
|
} else {
|
|
$id_ps = $datPs[0]['ID_PS'];
|
|
|
|
$datDps = $this->Amod->getData_DaftarPenarikanSewa_byPS_byBARANG($id_ps, $id_barang);
|
|
if ($datDps==TRUE) {
|
|
$this->session->set_flashdata('barangid_same', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
}
|
|
|
|
$input = [
|
|
'PS_ID' => $id_ps,
|
|
'BARANG_ID' => $id_barang,
|
|
'QTY_DPS' => $qty_dps
|
|
];
|
|
$action = $this->Amod->create('daftar_penarikansewa', $input);
|
|
|
|
if ($tipe==0) {
|
|
$datDfsw = $this->Amod->getData_DaftarSewa_byBARANG_byPELANGGAN_bySTATUS_byORDER($id_barang, $id_pelanggan, 1, 1);
|
|
$target = $qty_dps;
|
|
foreach ($datDfsw as $key) {
|
|
if ($target>0) {
|
|
if ($key['QTY_DFSW']>$key['KEMBALI_DFSW']) {
|
|
$selisih = $key['QTY_DFSW']-$key['KEMBALI_DFSW'];
|
|
if ($selisih>=$target) {
|
|
$kembali_dfsw = $key['KEMBALI_DFSW']+$target;
|
|
$target = 0;
|
|
} else {
|
|
$target = $target-$selisih;
|
|
$kembali_dfsw = $key['QTY_DFSW'];
|
|
}
|
|
$update = [
|
|
'KEMBALI_DFSW' => $kembali_dfsw
|
|
];
|
|
$action = $this->Amod->update('daftar_sewa', $update, 'ID_DFSW', $key['ID_DFSW']);
|
|
}
|
|
}
|
|
}
|
|
} else if ($tipe==1) {
|
|
$no = 0;
|
|
foreach ($sntarik as $key) {
|
|
$datSnsw = $this->Amod->getData_SnSewa_byID_psNull_statusNull($key);
|
|
if ($datSnsw==TRUE) {
|
|
$update = [
|
|
'PS_ID' => $id_ps,
|
|
'STATUS_SNSW' => '0'
|
|
];
|
|
$action = $this->Amod->update('sn_sewa', $update, 'ID_SNSW', $key);
|
|
|
|
$datDfsw = $this->Amod->getData_DaftarSewa_byID($datSnsw[0]['DFSW_ID']);
|
|
$kembaliLama = $datDfsw[0]['KEMBALI_DFSW'];
|
|
$kembaliBaru = $kembaliLama+1;
|
|
|
|
$update = [
|
|
'KEMBALI_DFSW' => $kembaliBaru
|
|
];
|
|
$action = $this->Amod->update('daftar_sewa', $update, 'ID_DFSW', $datSnsw[0]['DFSW_ID']);
|
|
}
|
|
}
|
|
}
|
|
|
|
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 SB_Hapus_Sub1_J1_DataDaftarSewa() {
|
|
$id_dfsw = $this->input->post('id_dfswdel');
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
|
|
$datDfsw = $this->Amod->getData_DaftarSewa_byID($id_dfsw);
|
|
if ($datDfsw==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$id_sewa = $datDfsw[0]['SEWA_ID'];
|
|
$datSewa = $this->Amod->getData_Sewa_byID_byGUDANG_bySTATUS($id_sewa, $id_karyawan, 0);
|
|
if ($datSewa==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$cekKuantiti = $this->GE_AmbilData_DataKuantiti($datDfsw[0]['BARANG_ID'], 3);
|
|
if ($cekKuantiti<$datDfsw[0]['QTY_DFSW']) {
|
|
$this->session->set_flashdata('qty_pro_less', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
if ($datDfsw[0]['TYPE_JENIS']==1) {
|
|
$datSnsw = $this->Amod->getData_SnSewa_byDFSW($id_dfsw);
|
|
foreach ($datSnsw as $key) {
|
|
$datSnStock = $this->Amod->getData_SnStock_byNAMA_bySTATUS($key['NAMA_SNSW'], 20);
|
|
if ($datSnStock==TRUE) {
|
|
$update = [
|
|
'STATUS_SNSTOCK' => '0'
|
|
];
|
|
$action = $this->Amod->update('sn_stock', $update, 'ID_SNSTOCK', $datSnStock[0]['ID_SNSTOCK']);
|
|
}
|
|
}
|
|
$action = $this->Amod->delete('sn_sewa', $id_dfsw, 'DFSW_ID');
|
|
}
|
|
$this->GE_Kalkulasi_KuantitiBarang($datDfsw[0]['BARANG_ID'], 1, "Step 1 - SEWA - Hapus Barang", 0, $datDfsw[0]['QTY_DFSW']);
|
|
|
|
$action = $this->Amod->delete('daftar_sewa', $id_dfsw, 'ID_DFSW');
|
|
|
|
$countAfter = $this->Amod->getCount_DaftarSewa_bySEWA($id_sewa);
|
|
if ($countAfter==0) {
|
|
$action = $this->Amod->delete('sewa', $id_sewa, 'ID_SEWA');
|
|
}
|
|
|
|
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 SB_Hapus_Sub1_J1_DataDaftarPenarikanSewa() {
|
|
$id_dps = $this->input->post('id_dpsdel');
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
|
|
$datDps = $this->Amod->getData_DaftarPenarikanSewa_byID($id_dps);
|
|
if ($datDps==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$id_ps = $datDps[0]['PS_ID'];
|
|
$datPs = $this->Amod->getData_PenarikanSewa_byID_byGUDANG_bySTATUS($id_ps, $id_karyawan, 0);
|
|
if ($datPs==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
if ($datDps[0]['TYPE_JENIS']==0) {
|
|
$datDfsw = $this->Amod->getData_DaftarSewa_byBARANG_byPELANGGAN_bySTATUS_byORDER($datDps[0]['BARANG_ID'], $datPs[0]['PELANGGAN_ID'], 1, 2);
|
|
$target = $datDps[0]['QTY_DPS'];
|
|
foreach ($datDfsw as $key) {
|
|
if ($target>0) {
|
|
if ($key['KEMBALI_DFSW']>0) {
|
|
if ($target>=$key['KEMBALI_DFSW']) {
|
|
$target = $target-$key['KEMBALI_DFSW'];
|
|
$kembali_dfsw = 0;
|
|
} else {
|
|
$kembali_dfsw = $key['KEMBALI_DFSW']-$target;
|
|
$target = 0;
|
|
}
|
|
$update = [
|
|
'KEMBALI_DFSW' => $kembali_dfsw
|
|
];
|
|
$action = $this->Amod->update('daftar_sewa', $update, 'ID_DFSW', $key['ID_DFSW']);
|
|
}
|
|
}
|
|
}
|
|
} else if ($datDps[0]['TYPE_JENIS']==1) {
|
|
$datSnsw = $this->Amod->getData_SnSewa_byBARANG_byPS_bySTATUS($datDps[0]['BARANG_ID'], $id_ps, 0);
|
|
foreach ($datSnsw as $key) {
|
|
$update = [
|
|
'PS_ID' => NULL,
|
|
'STATUS_SNSW' => NULL
|
|
];
|
|
$action = $this->Amod->update('sn_sewa', $update, 'ID_SNSW', $key['ID_SNSW']);
|
|
|
|
$datDfsw = $this->Amod->getData_DaftarSewa_byID($key['DFSW_ID']);
|
|
$kembaliLama = $datDfsw[0]['KEMBALI_DFSW'];
|
|
$kembaliBaru = $kembaliLama-1;
|
|
|
|
$update = [
|
|
'KEMBALI_DFSW' => $kembaliBaru
|
|
];
|
|
$action = $this->Amod->update('daftar_sewa', $update, 'ID_DFSW', $key['DFSW_ID']);
|
|
}
|
|
}
|
|
|
|
$action = $this->Amod->delete('daftar_penarikansewa', $id_dps, 'ID_DPS');
|
|
|
|
$countAfter = $this->Amod->getCount_DaftarPenarikanSewa_byPS($id_ps);
|
|
if ($countAfter==0) {
|
|
$action = $this->Amod->delete('penarikan_sewa', $id_ps, 'ID_PS');
|
|
}
|
|
|
|
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 SB_Proses_Sub1_J1_DataSewa() {
|
|
$id_sewa = $this->input->post('id_sewapro');
|
|
$id_sales = $this->input->post('id_salespro');
|
|
$id_pelanggan = $this->input->post('id_pelangganpro');
|
|
$ket_sewa = $this->input->post('ket_sewapro');
|
|
$tgl_sewa = $this->input->post('tgl_sewapro');
|
|
$ket_sewa = ltrim(rtrim(preg_replace('/\R+/', " " , $ket_sewa)));
|
|
$id_gudang = $this->session->userdata('id_karyawan');
|
|
$now = date('Y-m-d');
|
|
|
|
$datSewa = $this->Amod->getData_Sewa_byID_byGUDANG_bySTATUS($id_sewa, $id_gudang, 0);
|
|
if ($datSewa==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$datDfsw = $this->Amod->getData_DaftarSewa_bySEWA($id_sewa);
|
|
foreach ($datDfsw as $key) {
|
|
$cekKuantiti = $this->GE_AmbilData_DataKuantiti($key['BARANG_ID'], 3);
|
|
if ($cekKuantiti<$key['QTY_DFSW']) {
|
|
$this->session->set_flashdata('qty_pro_less', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
if ($key['TYPE_JENIS']==1) {
|
|
$count = $this->Amod->getCount_SnSewa_byDFSW($key['ID_DFSW']);
|
|
if ($count<$key['QTY_DFSW']) {
|
|
$this->session->set_flashdata('sncount_less', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
}
|
|
}
|
|
|
|
foreach ($datDfsw as $key) {
|
|
$this->GE_Kalkulasi_KuantitiBarang($key['BARANG_ID'], 1, "Step 2 - SEWA - Proses Barang", 0, $key['QTY_DFSW']);
|
|
}
|
|
|
|
$input = [
|
|
'SJ_INV' => '0',
|
|
'KODE_BUKTI' => $datSewa[0]['KODE_SEWA'],
|
|
'SEWA_ID' => $id_sewa,
|
|
'TGL_CD' => $now
|
|
];
|
|
$action = $this->Amod->create('cetak_dokumen', $input);
|
|
|
|
$update = [
|
|
'SALES_ID' => $id_sales,
|
|
'PELANGGAN_ID' => $id_pelanggan,
|
|
'KET_SEWA' => $ket_sewa,
|
|
'TGL_SEWA' => $tgl_sewa,
|
|
'STATUS_SEWA' => '1'
|
|
];
|
|
$action = $this->Amod->update('sewa', $update, 'ID_SEWA', $id_sewa);
|
|
|
|
if ($action) {
|
|
$this->session->set_flashdata('success', 'diproses');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
} else {
|
|
$this->session->set_flashdata('failed', 'diproses');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
}
|
|
|
|
public function SB_Proses_Sub1_J1_DataPenarikanSewa() {
|
|
$id_ps = $this->input->post('id_pspro');
|
|
$id_gudang = $this->session->userdata('id_karyawan');
|
|
$now = date('Y-m-d');
|
|
|
|
$datPs = $this->Amod->getData_PenarikanSewa_byID_byGUDANG_bySTATUS($id_ps, $id_gudang, 0);
|
|
if ($datPs==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$datDps = $this->Amod->getData_DaftarPenarikanSewa_byPS($id_ps);
|
|
foreach ($datDps as $key) {
|
|
if ($key['TYPE_JENIS']==1) {
|
|
$datSnsw = $this->Amod->getData_SnSewa_byPS_byBARANG_bySTATUS($id_ps, $key['BARANG_ID'], 0);
|
|
foreach ($datSnsw as $dat) {
|
|
$datSnStock = $this->Amod->getData_SnStock_byNAMA_bySTATUS($dat['NAMA_SNSW'], 20);
|
|
if ($datSnStock==TRUE) {
|
|
$update = [
|
|
'STATUS_SNSTOCK' => '0'
|
|
];
|
|
$action = $this->Amod->update('sn_stock', $update, 'ID_SNSTOCK', $datSnStock[0]['ID_SNSTOCK']);
|
|
}
|
|
|
|
$update = [
|
|
'STATUS_SNSW' => '1'
|
|
];
|
|
$action = $this->Amod->update('sn_sewa', $update, 'ID_SNSW', $dat['ID_SNSW']);
|
|
}
|
|
}
|
|
|
|
$this->GE_Kalkulasi_KuantitiBarang($key['BARANG_ID'], 1, "Step 3 - SEWA - Tarik Barang", 0, $key['QTY_DPS']);
|
|
}
|
|
|
|
$update = [
|
|
'STATUS_PS' => '1'
|
|
];
|
|
$action = $this->Amod->update('penarikan_sewa', $update, 'ID_PS', $id_ps);
|
|
|
|
$datSewa = $this->Amod->getData_Sewa_byPELANGGAN_bySTATUS($datPs[0]['PELANGGAN_ID'], 1);
|
|
foreach ($datSewa as $key) {
|
|
$datDfsw = $this->Amod->getData_DaftarSewa_bySEWA($key['ID_SEWA']);
|
|
$countDfsw = $this->Amod->getCount_DaftarSewa_bySEWA($key['ID_SEWA']);
|
|
$nocek = 0;
|
|
foreach ($datDfsw as $dat) {
|
|
if ($dat['QTY_DFSW']==$dat['KEMBALI_DFSW']) {
|
|
$nocek++;
|
|
}
|
|
}
|
|
if ($countDfsw==$nocek) {
|
|
$update = [
|
|
'STATUS_SEWA' => '2'
|
|
];
|
|
$action = $this->Amod->update('sewa', $update, 'ID_SEWA', $key['ID_SEWA']);
|
|
}
|
|
}
|
|
|
|
$input = [
|
|
'SJ_INV' => '0',
|
|
'KODE_BUKTI' => $datPs[0]['KODE_PS'],
|
|
'PS_ID' => $id_ps,
|
|
'TGL_CD' => $now
|
|
];
|
|
$action = $this->Amod->create('cetak_dokumen', $input);
|
|
|
|
if ($action) {
|
|
$this->session->set_flashdata('success', 'ditarik');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
} else {
|
|
$this->session->set_flashdata('failed', 'ditarik');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
}
|
|
|
|
public function SB_Simpan_Sub1_J1_DataSnSewa() {
|
|
$id_snstock = $this->input->post('id_snstock');
|
|
$id_dfsw = $this->input->post('id_dfsw');
|
|
|
|
$value = 0;
|
|
$datDfsw = $this->Amod->getData_DaftarSewa_byID($id_dfsw);
|
|
if ($datDfsw==FALSE) {
|
|
$value = 8;
|
|
} else {
|
|
$datSnStock = $this->Amod->getData_SnStock_byID($id_snstock);
|
|
if ($datSnStock==FALSE) {
|
|
$value = 7;
|
|
} else {
|
|
if ($datSnStock[0]['STATUS_SNSTOCK']!=0) {
|
|
$value = 6;
|
|
} else {
|
|
if ($datSnStock[0]['BARANG_ID']!=$datDfsw[0]['BARANG_ID']) {
|
|
$value = 5;
|
|
} else {
|
|
if ($datSnStock[0]['GUDANG_SNSTOCK']!=1) {
|
|
$value = 4;
|
|
} else {
|
|
$countBefore = $this->Amod->getCount_SnSewa_byDFSW($id_dfsw);
|
|
if ($countBefore>=$datDfsw[0]['QTY_DFSW']) {
|
|
$value = 3;
|
|
} else {
|
|
$input = [
|
|
'DFSW_ID' => $id_dfsw,
|
|
'NAMA_SNSW' => $datSnStock[0]['NAMA_SNSTOCK']
|
|
];
|
|
$action = $this->Amod->create('sn_sewa', $input);
|
|
|
|
$update = [
|
|
'STATUS_SNSTOCK' => '20'
|
|
];
|
|
$action = $this->Amod->update('sn_stock', $update, 'ID_SNSTOCK', $id_snstock);
|
|
|
|
$countAfter = $this->Amod->getCount_SnSewa_byDFSW($id_dfsw);
|
|
if ($countAfter==$datDfsw[0]['QTY_DFSW']) {
|
|
$value = 2;
|
|
} else {
|
|
$value = 1;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
}
|
|
|
|
public function SB_Simpan_Sub1_J1_DataSnSewaBarcode() {
|
|
$id_snsw = $this->input->post('id_snsw');
|
|
$id_dfsw = $this->input->post('id_dfsw');
|
|
$nama_snsw = $this->input->post('nama_snsw');
|
|
$nama_snsw = strtoupper($nama_snsw);
|
|
|
|
$value = 0;
|
|
$datDfsw = $this->Amod->getData_DaftarSewa_byID($id_dfsw);
|
|
if ($datDfsw==FALSE) {
|
|
$value = 8;
|
|
} else {
|
|
$datSnStock = $this->Amod->getData_SnStock_byNAMA_allStatus($nama_snsw);
|
|
if ($datSnStock==FALSE) {
|
|
$value = 7;
|
|
} else {
|
|
if ($datSnStock[0]['STATUS_SNSTOCK']!=0) {
|
|
$value = 6;
|
|
} else {
|
|
if ($datSnStock[0]['BARANG_ID']!=$datDfsw[0]['BARANG_ID']) {
|
|
$value = 5;
|
|
} else {
|
|
if ($datSnStock[0]['GUDANG_SNSTOCK']!=1) {
|
|
$value = 4;
|
|
} else {
|
|
$countBefore = $this->Amod->getCount_SnSewa_byDFSW($id_dfsw);
|
|
if ($countBefore>=$datDfsw[0]['QTY_DFSW']) {
|
|
$value = 3;
|
|
} else {
|
|
$input = [
|
|
'DFSW_ID' => $id_dfsw,
|
|
'NAMA_SNSW' => $nama_snsw
|
|
];
|
|
$action = $this->Amod->create('sn_sewa', $input);
|
|
|
|
$update = [
|
|
'STATUS_SNSTOCK' => '20'
|
|
];
|
|
$action = $this->Amod->update('sn_stock', $update, 'ID_SNSTOCK', $datSnStock[0]['ID_SNSTOCK']);
|
|
|
|
$countAfter = $this->Amod->getCount_SnSewa_byDFSW($id_dfsw);
|
|
if ($countAfter==$datDfsw[0]['QTY_DFSW']) {
|
|
$value = 2;
|
|
} else {
|
|
$value = 1;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
}
|
|
|
|
public function SB_Hapus_Sub1_J1_DataSnSewa() {
|
|
$id_snsw = $this->input->post('id_snsw');
|
|
$id_dfsw = $this->input->post('id_dfsw');
|
|
|
|
$value = 0;
|
|
$datDfsw = $this->Amod->getData_DaftarSewa_byID($id_dfsw);
|
|
if ($datDfsw==FALSE) {
|
|
$value = 4;
|
|
} else {
|
|
$datSnsw = $this->Amod->getData_SnSewa_byID_bySTATUS($id_snsw, 20);
|
|
if ($datSnsw==FALSE) {
|
|
$value = 3;
|
|
} else {
|
|
$countBefore = $this->Amod->getCount_SnSewa_byDFSW($id_dfsw);
|
|
|
|
$update = [
|
|
'STATUS_SNSTOCK' => '0'
|
|
];
|
|
$action = $this->Amod->update('sn_stock', $update, 'ID_SNSTOCK', $datSnsw[0]['ID_SNSTOCK']);
|
|
$action = $this->Amod->delete('sn_sewa', $id_snsw, 'ID_SNSW');
|
|
|
|
if ($countBefore==$datDfsw[0]['QTY_DFSW']) {
|
|
$value = 2;
|
|
} else {
|
|
$value = 1;
|
|
}
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
}
|
|
|
|
//SUBMENU TRANSAKSI - STOK ANTIK
|
|
public function SB_Sub1_StokAntik_1() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$now = date('Y-m-d');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "SB", "TRANSAKSI - Stok Antik");
|
|
$id_menu = $datShm[0]['MENU_ID'];
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$datProsesSa = $this->Amod->getData_StokAntik_byGUDANG_bySTATUS($id_karyawan, 0);
|
|
if ($datProsesSa==TRUE) {
|
|
$no = 0;
|
|
$sn = "";
|
|
foreach ($datProsesSa as $key) {
|
|
$datSnAntik = $this->Amod->getData_SnAntik_bySA($key['ID_SA']);
|
|
foreach ($datSnAntik as $dat) {
|
|
$nama_sna = $dat['NAMA_SNA'];
|
|
$sn .= "$nama_sna, ";
|
|
}
|
|
$datProsesSa[$no++] += ['SN' => $sn];
|
|
$sn = "";
|
|
}
|
|
$kode_sa = $datProsesSa[0]['KODE_SA'];
|
|
} else {
|
|
$kode_sa = NULL;
|
|
}
|
|
|
|
$datBerjalanSa = $this->Amod->getSum_StokAntik_byJENIS_bySTATUS_groupBARANG(1, 1);
|
|
$no = 0;
|
|
$sn = "";
|
|
$countBerjalan = 0;
|
|
foreach ($datBerjalanSa as $key) {
|
|
$potonganSa = $this->Amod->getSum_StokAntik_byBARANG_byJENIS_bySTATUS_groupBARANG($key['BARANG_ID'], 0, 1);
|
|
if ($potonganSa==FALSE OR $potonganSa[0]['TOTAL']==NULL) {
|
|
$pot = 0;
|
|
} else {
|
|
$pot = $potonganSa[0]['TOTAL'];
|
|
}
|
|
|
|
$sisa = $key['TOTAL']-$pot;
|
|
if ($sisa>0) {
|
|
$countBerjalan++;
|
|
}
|
|
|
|
$datSnStock = $this->Amod->getData_SnStock_byBARANG_bySTATUS($key['BARANG_ID'], 19);
|
|
foreach ($datSnStock as $dat) {
|
|
$nama_snstock = $dat['NAMA_SNSTOCK'];
|
|
$sn .= "$nama_snstock, ";
|
|
}
|
|
$datBerjalanSa[$no] += ['SN' => $sn];
|
|
$datBerjalanSa[$no++] += ['SISA' => $sisa];
|
|
$sn = "";
|
|
|
|
}
|
|
|
|
$datBarang = $this->Amod->getData_Barang_bySTATUS_jenisNot2(1, 1);
|
|
|
|
$datStpos = $this->Amod->getData_SetTogglePosisi_byKARYAWAN_byMENU($id_karyawan, $id_menu);
|
|
if ($datStpos==FALSE) { $posisiToggle = 0; } else { $posisiToggle = $datStpos[0]['AKTIF_STPOS']; }
|
|
|
|
$data = array(
|
|
'sidebar' => "menu stokbarang",
|
|
'navChild' => "stokbarang stokantik",
|
|
'prosesSa' => $datProsesSa,
|
|
'berjalanSa' => $datBerjalanSa,
|
|
'countProsesSa' => count($datProsesSa),
|
|
'countBerjalan' => $countBerjalan,
|
|
'kode_sa' => $kode_sa,
|
|
'id_menu' => $id_menu,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil,
|
|
'barang' => $datBarang,
|
|
'posisiToggle' => $posisiToggle,
|
|
);
|
|
$this->load->view('proses/SB_Sub1_StokAntik_1', $data);
|
|
}
|
|
|
|
public function SB_Ambil_Sub1_K1_DataSnStock() {
|
|
$id_barang = $this->input->post('id_barang');
|
|
$versi = $this->input->post('versi');
|
|
|
|
if ($versi==1) {
|
|
$data = $this->Amod->getData_SnStock_byBARANG_byGUDANG_bySTATUS($id_barang, 1, 0);
|
|
} else if ($versi==2) {
|
|
$data = $this->Amod->getData_SnStock_byBARANG_byGUDANG_bySTATUS($id_barang, 1, 19);
|
|
}
|
|
|
|
$datBarang = $this->Amod->getData_Barang_byID($id_barang);
|
|
|
|
$this->output_json([
|
|
'data' => $data,
|
|
'tipe' => $datBarang[0]['TYPE_JENIS'],
|
|
]);
|
|
}
|
|
|
|
public function SB_Tambah_Sub1_K1_DataStokAntik() {
|
|
$kode_sa = $this->input->post('kode_sanew');
|
|
$tipe = $this->input->post('tipe');
|
|
$id_barang = $this->input->post('id_barangnew');
|
|
$qty_sa = $this->input->post('qty_sanew');
|
|
$snpilih = $this->input->post('id_snpilihnew');
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
$now = date('Y-m-d');
|
|
|
|
if ($tipe==1) {
|
|
$qty_sa = count($snpilih);
|
|
|
|
foreach ($snpilih as $key) {
|
|
$datSnStock = $this->Amod->getData_SnStock_byID_bySTATUS($key, 0);
|
|
if ($datSnStock==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
}
|
|
}
|
|
|
|
$cekKuantiti = $this->GE_AmbilData_DataKuantiti($id_barang, 1);
|
|
if ($cekKuantiti<$qty_sa) {
|
|
$this->session->set_flashdata('qty_pcm_less', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$datSa = $this->Amod->getData_StokAntik_byGUDANG_bySTATUS($id_karyawan, 0);
|
|
if ($datSa==FALSE) {
|
|
$kode_sa = $this->Amod->generate_kodeStokAntik();
|
|
} else {
|
|
$cekSa = $this->Amod->getData_StokAntik_byBARANG_byGUDANG_bySTATUS($id_barang, $id_karyawan, 0);
|
|
if ($cekSa==TRUE) {
|
|
$this->session->set_flashdata('barangid_same', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
}
|
|
|
|
$input = [
|
|
'CIPTA_SA' => "Oleh $panggilan pada $timestamp",
|
|
'KODE_SA' => $kode_sa,
|
|
'JENIS_SA' => '1',
|
|
'TGL_SA' => $now,
|
|
'GUDANG_ID' => $id_karyawan,
|
|
'BARANG_ID' => $id_barang,
|
|
'QTY_SA' => $qty_sa,
|
|
'STATUS_SA' => '0',
|
|
];
|
|
$action = $this->Amod->create('stok_antik', $input);
|
|
|
|
$this->GE_Kalkulasi_KuantitiBarang($id_barang, 1, "Step 1 - STOK ANTIK - Tambah Barang", 0, $qty_sa);
|
|
|
|
$id_sa = $this->Amod->getMax_ID_StokAntik();
|
|
$id_sa = $id_sa[0]['ID_SA'];
|
|
|
|
if ($tipe==1) {
|
|
foreach ($snpilih as $key) {
|
|
$datSnStock = $this->Amod->getData_SnStock_byID_bySTATUS($key, 0);
|
|
if ($datSnStock==TRUE) {
|
|
$input = [
|
|
'NAMA_SNA' => $datSnStock[0]['NAMA_SNSTOCK'],
|
|
'SA_ID' => $id_sa
|
|
];
|
|
$action = $this->Amod->create('sn_antik', $input);
|
|
|
|
$update = [
|
|
'STATUS_SNSTOCK' => '19'
|
|
];
|
|
$action = $this->Amod->update('sn_stock', $update, 'ID_SNSTOCK', $key);
|
|
}
|
|
}
|
|
}
|
|
|
|
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 SB_Tarik_Sub1_K1_DataStokAntik() {
|
|
$kode_sa = $this->input->post('kode_satar');
|
|
$tipe = $this->input->post('tipe');
|
|
$id_barang = $this->input->post('id_barangtar');
|
|
$qty_sa = $this->input->post('qty_satar');
|
|
$sntarik = $this->input->post('id_sntariknew');
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
$now = date('Y-m-d');
|
|
|
|
if ($tipe==1) {
|
|
$qty_sa = count($sntarik);
|
|
|
|
foreach ($sntarik as $key) {
|
|
$datSnStock = $this->Amod->getData_SnStock_byID_bySTATUS($key, 19);
|
|
if ($datSnStock==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
}
|
|
}
|
|
|
|
$cekKuantiti = $this->GE_AmbilData_DataKuantiti($id_barang, 4);
|
|
if ($cekKuantiti<$qty_sa) {
|
|
$this->session->set_flashdata('qty_antik_less', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$datSa = $this->Amod->getData_StokAntik_byGUDANG_bySTATUS($id_karyawan, 0);
|
|
if ($datSa==FALSE) {
|
|
$kode_sa = $this->Amod->generate_kodeStokAntik();
|
|
} else {
|
|
$cekSa = $this->Amod->getData_StokAntik_byBARANG_byGUDANG_bySTATUS($id_barang, $id_karyawan, 0);
|
|
if ($cekSa==TRUE) {
|
|
$this->session->set_flashdata('barangid_same', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
}
|
|
|
|
$input = [
|
|
'CIPTA_SA' => "Oleh $panggilan pada $timestamp",
|
|
'KODE_SA' => $kode_sa,
|
|
'JENIS_SA' => '0',
|
|
'TGL_SA' => $now,
|
|
'GUDANG_ID' => $id_karyawan,
|
|
'BARANG_ID' => $id_barang,
|
|
'QTY_SA' => $qty_sa,
|
|
'STATUS_SA' => '0',
|
|
];
|
|
$action = $this->Amod->create('stok_antik', $input);
|
|
|
|
$this->GE_Kalkulasi_KuantitiBarang($id_barang, 1, "Step 1 - STOK ANTIK - Tarik Barang", 0, $qty_sa);
|
|
|
|
$id_sa = $this->Amod->getMax_ID_StokAntik();
|
|
$id_sa = $id_sa[0]['ID_SA'];
|
|
|
|
if ($tipe==1) {
|
|
foreach ($sntarik as $key) {
|
|
$datSnStock = $this->Amod->getData_SnStock_byID_bySTATUS($key, 19);
|
|
if ($datSnStock==TRUE) {
|
|
$input = [
|
|
'NAMA_SNA' => $datSnStock[0]['NAMA_SNSTOCK'],
|
|
'SA_ID' => $id_sa
|
|
];
|
|
$action = $this->Amod->create('sn_antik', $input);
|
|
|
|
$update = [
|
|
'STATUS_SNSTOCK' => '0'
|
|
];
|
|
$action = $this->Amod->update('sn_stock', $update, 'ID_SNSTOCK', $key);
|
|
}
|
|
}
|
|
}
|
|
|
|
if ($action) {
|
|
$this->session->set_flashdata('success', 'ditarik');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
} else {
|
|
$this->session->set_flashdata('failed', 'ditarik');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
}
|
|
|
|
public function SB_Hapus_Sub1_K1_DataStokAntik() {
|
|
$id_sa = $this->input->post('id_sadel');
|
|
|
|
$datSa = $this->Amod->getData_StokAntik_byID_bySTATUS($id_sa, 0);
|
|
|
|
$cekKuantiti = $this->GE_AmbilData_DataKuantiti($datSa[0]['BARANG_ID'], 3);
|
|
if ($cekKuantiti<$datSa[0]['QTY_SA']) {
|
|
$this->session->set_flashdata('qty_pro_less', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
if ($datSa[0]['TYPE_JENIS']==1) {
|
|
$datSna = $this->Amod->getData_SnAntik_bySA($id_sa);
|
|
foreach ($datSna as $key) {
|
|
if ($datSa[0]['JENIS_SA']==1) {
|
|
$datSnStock = $this->Amod->getData_SnStock_byNAMA_bySTATUS($key['NAMA_SNA'], 19);
|
|
if ($datSnStock==TRUE) {
|
|
$update = [
|
|
'STATUS_SNSTOCK' => '0'
|
|
];
|
|
$action = $this->Amod->update('sn_stock', $update, 'ID_SNSTOCK', $datSnStock[0]['ID_SNSTOCK']);
|
|
}
|
|
} else if ($datSa[0]['JENIS_SA']==0) {
|
|
$datSnStock = $this->Amod->getData_SnStock_byNAMA_bySTATUS($key['NAMA_SNA'], 0);
|
|
if ($datSnStock==TRUE) {
|
|
$update = [
|
|
'STATUS_SNSTOCK' => '19'
|
|
];
|
|
$action = $this->Amod->update('sn_stock', $update, 'ID_SNSTOCK', $datSnStock[0]['ID_SNSTOCK']);
|
|
}
|
|
}
|
|
}
|
|
$action = $this->Amod->delete('sn_antik', $id_sa, 'SA_ID');
|
|
}
|
|
|
|
$action = $this->Amod->delete('stok_antik', $id_sa, 'ID_SA');
|
|
|
|
$this->GE_Kalkulasi_KuantitiBarang($datSa[0]['BARANG_ID'], 1, "Step 1 - STOK ANTIK - Hapus Barang", $datSa[0]['JENIS_SA'], $datSa[0]['QTY_SA']);
|
|
|
|
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 SB_Proses_Sub1_K1_DataStokAntik() {
|
|
$id_gudang = $this->session->userdata('id_karyawan');
|
|
|
|
$datSa = $this->Amod->getData_StokAntik_byGUDANG_bySTATUS($id_gudang, 0);
|
|
if ($datSa==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
foreach ($datSa as $key) {
|
|
$cekKuantiti = $this->GE_AmbilData_DataKuantiti($key['BARANG_ID'], 3);
|
|
if ($cekKuantiti<$key['QTY_SA']) {
|
|
$this->session->set_flashdata('qty_pro_less', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
}
|
|
|
|
foreach ($datSa as $key) {
|
|
$update = [
|
|
'STATUS_SA' => '1'
|
|
];
|
|
$action = $this->Amod->update('stok_antik', $update, 'ID_SA', $key['ID_SA']);
|
|
|
|
$this->GE_Kalkulasi_KuantitiBarang($key['BARANG_ID'], 1, "Step 2 - STOK ANTIK - Proses Barang", $key['JENIS_SA'], $key['QTY_SA']);
|
|
}
|
|
|
|
if ($action) {
|
|
$this->session->set_flashdata('success', 'diproses');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
} else {
|
|
$this->session->set_flashdata('failed', 'diproses');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
}
|
|
|
|
//SUBMENU TRANSAKSI - STOK OPNAME
|
|
public function SB_Sub1_StokOpname_1() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
$now = date('Y-m-d');
|
|
$limit = $this->Amod->generate_subMonth($now, 12);
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "SB", "TRANSAKSI - Stok Opname");
|
|
$id_menu = $datShm[0]['MENU_ID'];
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$datSgu = $this->Amod->getData_SetGudang_byKARYAWAN_byMENU($id_karyawan, $id_menu);
|
|
if ($datSgu==FALSE) {
|
|
$aktif = 1;
|
|
$input = [
|
|
'KARYAWAN_ID' => $id_karyawan,
|
|
'MENU_ID' => $id_menu,
|
|
'AKTIF_SGU' => $aktif,
|
|
'TIMESTAMP' => $timestamp
|
|
];
|
|
$action = $this->Amod->create('set_gudang', $input);
|
|
} else {
|
|
$aktif = $datSgu[0]['AKTIF_SGU'];
|
|
}
|
|
|
|
$datOpname = $this->Amod->getData_Opname_byKARYAWAN_bySTATUS($id_karyawan, 0);
|
|
if ($datOpname==TRUE) {
|
|
$id_opname = $datOpname[0]['ID_OPNAME'];
|
|
$datDop = $this->Amod->getData_DaftarOpname_byOPNAME($id_opname);
|
|
$countProsesOpname = count($datDop);
|
|
} else {
|
|
$datDop = NULL;
|
|
$id_opname = NULL;
|
|
$countProsesOpname = 0;
|
|
}
|
|
|
|
$datOpnameBerjalan = $this->Amod->getData_Opname_bySTATUS_byGUDANG(1, $aktif);
|
|
$no = 0;
|
|
foreach ($datOpnameBerjalan as $key) {
|
|
$datDopPro = $this->Amod->getData_DaftarOpname_byOPNAME($key['ID_OPNAME']);
|
|
$datOpnameBerjalan[$no++] += ['BARANG' => $datDopPro];
|
|
}
|
|
|
|
$datStpos = $this->Amod->getData_SetTogglePosisi_byKARYAWAN_byMENU($id_karyawan, $id_menu);
|
|
if ($datStpos==FALSE) { $posisiToggle = 0; } else { $posisiToggle = $datStpos[0]['AKTIF_STPOS']; }
|
|
|
|
$datBarang = $this->Amod->getData_Barang_bySTATUS_jenisNot2(1, $aktif);
|
|
$no = 0;
|
|
foreach ($datBarang as $key) {
|
|
$diff = 0;
|
|
$statUsed = 0;
|
|
|
|
$datOpname = $this->Amod->getData_DaftarOpname_byBARANG_byGUDANG_byLIMIT_statusNot2_orderDESC($key['ID_BARANG'], $aktif, $limit);
|
|
if ($datOpname==TRUE) {
|
|
$statUsed = 1;
|
|
$diffawal = new DateTime($datOpname[0]['TGL_OPNAME']);
|
|
$diffakhir = new DateTime($now);
|
|
$diff = date_diff($diffawal, $diffakhir);
|
|
$diff = $diff->format("%a");
|
|
}
|
|
$datBarang[$no] += ['STATUSED' => $statUsed];
|
|
$datBarang[$no++] += ['DATEUSED' => $diff];
|
|
}
|
|
|
|
$data = array(
|
|
'sidebar' => "menu stokbarang",
|
|
'navChild' => "stokbarang stokopname",
|
|
'id_menu' => $id_menu,
|
|
'tampil' => $tampil,
|
|
'hak' => $hak,
|
|
'id_opname' => $id_opname,
|
|
'aktif' => $aktif,
|
|
'dop' => $datDop,
|
|
'opnameBerjalan' => $datOpnameBerjalan,
|
|
'countProsesOpname' => $countProsesOpname,
|
|
'countBerjalan' => count($datOpnameBerjalan),
|
|
'posisiToggle' => $posisiToggle,
|
|
'barang' => $datBarang
|
|
);
|
|
$this->load->view('proses/SB_Sub1_StokOpname_1', $data);
|
|
}
|
|
|
|
public function SB_Ambil_Sub1_L1_DataSnOpname() {
|
|
$id_dop = $this->input->post('id_dop');
|
|
|
|
$countSop = $this->Amod->getCount_SnOpname_byDOP_bySTATUS($id_dop, 1);
|
|
$datDop = $this->Amod->getData_DaftarOpname_byID($id_dop);
|
|
$data = $this->Amod->getData_SnOpname_byDOP_statusNot2($id_dop);
|
|
$snAc = $this->Amod->getData_SnOpname_byDOP_bySTATUS($id_dop, 0);
|
|
$snSa = $this->Amod->getData_SnOpname_byDOP_bySTATUS($id_dop, 2);
|
|
|
|
$snSalah = "";
|
|
foreach ($snSa as $dat) {
|
|
$nama_sop = $dat['NAMA_SNSTOCK'];
|
|
$snSalah .= "$nama_sop, ";
|
|
}
|
|
|
|
$snReady = [];
|
|
foreach ($snAc as $dat) {
|
|
$nama_sop = $dat['NAMA_SNSTOCK'];
|
|
$hasil = "$nama_sop";
|
|
array_push($snReady, $hasil);
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => 1,
|
|
'total' => $countSop,
|
|
'data' => $data,
|
|
'snSalah' => $snSalah,
|
|
'snReady' => $snReady,
|
|
'qtyAwal' => $datDop[0]['AWAL_DOP'],
|
|
'qtyAkhir' => $datDop[0]['AKHIR_DOP']
|
|
]);
|
|
}
|
|
|
|
public function SB_Tambah_Sub1_L1_DataDaftarOpname() {
|
|
$gudang_opname = $this->input->post('gudang_opnamenew');
|
|
$id_barang = $this->input->post('id_barangnew');
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
$now = date('Y-m-d');
|
|
|
|
$datOpname = $this->Amod->getData_Opname_byKARYAWAN_bySTATUS($id_karyawan, 0);
|
|
if ($datOpname==FALSE) {
|
|
$kode_opname = $this->Amod->generate_kodeOpname();
|
|
$input = [
|
|
'CIPTA_OPNAME' => "Oleh $panggilan pada $timestamp",
|
|
'KODE_OPNAME' => $kode_opname,
|
|
'TGL_OPNAME' => $now,
|
|
'GUDANG_OPNAME' => $gudang_opname,
|
|
'KARYAWAN_ID' => $id_karyawan,
|
|
'STATUS_OPNAME' => '0',
|
|
];
|
|
$action = $this->Amod->create('opname', $input);
|
|
|
|
$id_opname = $this->Amod->getMax_ID_Opname();
|
|
$id_opname = $id_opname[0]['ID_OPNAME'];
|
|
} else {
|
|
$id_opname = $datOpname[0]['ID_OPNAME'];
|
|
|
|
foreach ($id_barang as $key) {
|
|
$datDop = $this->Amod->getData_DaftarOpname_byOPNAME_byBARANG($id_opname, $key);
|
|
if ($datDop==TRUE) {
|
|
$this->session->set_flashdata('barangid_same', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
}
|
|
}
|
|
|
|
foreach ($id_barang as $key) {
|
|
$qty_dop = $this->GE_AmbilData_DataKuantiti($key, $gudang_opname);
|
|
$input = [
|
|
'OPNAME_ID' => $id_opname,
|
|
'BARANG_ID' => $key,
|
|
'AWAL_DOP' => $qty_dop,
|
|
'AKHIR_DOP' => '0'
|
|
];
|
|
$action = $this->Amod->create('daftar_opname', $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 SB_Hapus_Sub1_L1_DataDaftarOpname() {
|
|
$id_dop = $this->input->post('id_dopdel');
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
|
|
$datDop = $this->Amod->getData_DaftarOpname_byID($id_dop);
|
|
if ($datDop==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$id_opname = $datDop[0]['OPNAME_ID'];
|
|
$datOpname = $this->Amod->getData_Opname_byID_byKARYAWAN_bySTATUS($id_opname, $id_karyawan, 0);
|
|
if ($datOpname==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$action = $this->Amod->delete('daftar_opname', $id_dop, 'ID_DOP');
|
|
|
|
$countAfter = $this->Amod->getCount_DaftarOpname_byOPNAME($id_opname);
|
|
if ($countAfter==0) {
|
|
$action = $this->Amod->delete('opname', $id_opname, 'ID_OPNAME');
|
|
}
|
|
|
|
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 SB_Proses_Sub1_L1_DataOpname() {
|
|
$id_opname = $this->input->post('id_opnamepro');
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$now = date('Y-m-d');
|
|
|
|
$datOpname = $this->Amod->getData_Opname_byID_byKARYAWAN_bySTATUS($id_opname, $id_karyawan, 0);
|
|
if ($datOpname==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$datDop = $this->Amod->getData_DaftarOpname_byOPNAME($id_opname);
|
|
foreach ($datDop as $key) {
|
|
$datSnStock = $this->Amod->getData_SnStock_byBARANG_byGUDANG_bySTATUS($key['BARANG_ID'], $key['GUDANG_OPNAME'], 0);
|
|
foreach ($datSnStock as $dat) {
|
|
$input = [
|
|
'DOP_ID' => $key['ID_DOP'],
|
|
'SNSTOCK_ID' => $dat['ID_SNSTOCK'],
|
|
'STATUS_SOP' => '0'
|
|
];
|
|
$action = $this->Amod->create('sn_opname', $input);
|
|
}
|
|
}
|
|
|
|
$update = [
|
|
'STATUS_OPNAME' => '1'
|
|
];
|
|
$action = $this->Amod->update('opname', $update, 'ID_OPNAME', $id_opname);
|
|
|
|
if ($action) {
|
|
$this->session->set_flashdata('success', 'diproses');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
} else {
|
|
$this->session->set_flashdata('failed', 'diproses');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
}
|
|
|
|
public function SB_Batal_Sub1_L1_DataOpname() {
|
|
$id_opname = $this->input->post('id_opnamevoid');
|
|
$ket_batal = $this->input->post('ket_batalvoid');
|
|
$ket_batal = strtoupper(ltrim(rtrim(preg_replace('/\R+/', " " , $ket_batal))));
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$datOpname = $this->Amod->getData_Opname_byID_bySTATUS($id_opname, 1);
|
|
if ($datOpname==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$update = [
|
|
'STATUS_OPNAME' => '9',
|
|
'SELESAI_OPNAME' => "Oleh $panggilan pada $timestamp",
|
|
'KET_BATAL' => $ket_batal
|
|
];
|
|
$action = $this->Amod->update('opname', $update, 'ID_OPNAME', $id_opname);
|
|
|
|
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 SB_Kunci_Sub1_L1_DataOpname() {
|
|
$id_opname = $this->input->post('id_opnamelock');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$datOpname = $this->Amod->getData_Operasional_byID_bySTATUS($id_opname, 1);
|
|
if ($datOpname==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$update = [
|
|
'STATUS_OPNAME' => '2',
|
|
'SELESAI_OPNAME' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('opname', $update, 'ID_OPNAME', $id_opname);
|
|
|
|
if ($action) {
|
|
$this->session->set_flashdata('success', 'dikunci');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
} else {
|
|
$this->session->set_flashdata('failed', 'dikunci');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
}
|
|
|
|
public function SB_Simpan_Sub1_L1_DataSnOpnameBarcode() {
|
|
$id_sop = $this->input->post('id_sop');
|
|
$id_dop = $this->input->post('id_dop');
|
|
$nama_sop = $this->input->post('nama_sop');
|
|
$nama_sop = strtoupper($nama_sop);
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$value = 0;
|
|
$datDop = $this->Amod->getData_DaftarOpname_byID_bySTATUS($id_dop, 1);
|
|
if ($datDop==FALSE) {
|
|
$value = 9;
|
|
} else {
|
|
$datSnStock = $this->Amod->getData_SnStock_byNAMA_allStatus($nama_sop);
|
|
if ($datSnStock==FALSE) {
|
|
$value = 8;
|
|
} else {
|
|
if ($datSnStock[0]['STATUS_SNSTOCK']!=0) {
|
|
$value = 7;
|
|
} else {
|
|
if ($datSnStock[0]['BARANG_ID']!=$datDop[0]['BARANG_ID']) {
|
|
$value = 6;
|
|
} else {
|
|
if ($datSnStock[0]['GUDANG_SNSTOCK']!=$datDop[0]['GUDANG_OPNAME']) {
|
|
$value = 5;
|
|
} else {
|
|
if ($datDop[0]['AKHIR_DOP']>=$datDop[0]['AWAL_DOP']) {
|
|
$value = 4;
|
|
} else {
|
|
$datSop = $this->Amod->getData_SnOpname_byDOP_bySNSTOCK_statusNot2($id_dop, $datSnStock[0]['ID_SNSTOCK']);
|
|
if ($datSop==FALSE) {
|
|
$cekSop = $this->Amod->getData_SnOpname_byDOP_bySNSTOCK_bySTATUS($id_dop, $datSnStock[0]['ID_SNSTOCK'], 2);
|
|
if ($cekSop==TRUE) {
|
|
$update = [
|
|
'HASIL_SOP' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('sn_opname', $update, 'ID_SOP', $cekSop[0]['ID_SOP']);
|
|
} else {
|
|
$input = [
|
|
'DOP_ID' => $id_dop,
|
|
'SNSTOCK_ID' => $datSnStock[0]['ID_SNSTOCK'],
|
|
'STATUS_SOP' => '2',
|
|
'HASIL_SOP' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->create('sn_opname', $input);
|
|
}
|
|
$value = 3;
|
|
} else {
|
|
$cekSop = $this->Amod->getData_SnOpname_byDOP_bySNSTOCK_bySTATUS($id_dop, $datSnStock[0]['ID_SNSTOCK'], 0);
|
|
if ($cekSop==TRUE) {
|
|
$update = [
|
|
'STATUS_SOP' => '1',
|
|
'HASIL_SOP' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('sn_opname', $update, 'ID_SOP', $datSop[0]['ID_SOP']);
|
|
|
|
$akhirLama = $datDop[0]['AKHIR_DOP'];
|
|
$akhirBaru = $akhirLama+1;
|
|
|
|
$update = [
|
|
'AKHIR_DOP' => $akhirBaru
|
|
];
|
|
$action = $this->Amod->update('daftar_opname', $update, 'ID_DOP', $id_dop);
|
|
} else {
|
|
$update = [
|
|
'HASIL_SOP' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('sn_opname', $update, 'ID_SOP', $datSop[0]['ID_SOP']);
|
|
}
|
|
|
|
$cekDop = $this->Amod->getData_DaftarOpname_byID_bySTATUS($id_dop, 1);
|
|
if ($cekDop[0]['AWAL_DOP']==$cekDop[0]['AKHIR_DOP']) {
|
|
$value = 2;
|
|
} else {
|
|
$value = 1;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
]);
|
|
}
|
|
|
|
//SUBMENU TRANSAKSI - UBAH SN BELI
|
|
public function SB_Sub1_UbahSnBeli_1() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "SB", "TRANSAKSI - Ubah SN Beli");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$datSnStock = $this->Amod->getData_SnStock_bySTATUS_joinSNB(0);
|
|
|
|
$data = array(
|
|
'sidebar' => "menu stokbarang",
|
|
'navChild' => "stokbarang ubahsnbeli",
|
|
'snstock' => $datSnStock,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil,
|
|
);
|
|
$this->load->view('proses/SB_Sub1_UbahSnBeli_1', $data);
|
|
}
|
|
|
|
public function SB_Ambil_Sub1_M1_DataSnStock() {
|
|
$id_snstock = $this->input->post('id_snstock');
|
|
|
|
$datSnStock = $this->Amod->getData_SnStock_byID_bySTATUS($id_snstock, 0);
|
|
$datBarang = $this->Amod->getData_Barang_byID($datSnStock[0]['BARANG_ID']);
|
|
$datHsn = $this->Amod->getData_HistoriSn_bySNSTOCK_orderASC_limit1($id_snstock);
|
|
|
|
if ($datSnStock[0]['GUDANG_SNSTOCK']==1) {
|
|
$posisiGudang = "PC MASTER";
|
|
} else if ($datSnStock[0]['GUDANG_SNSTOCK']==2) {
|
|
$posisiGudang = "IT POINT";
|
|
} else if ($datSnStock[0]['GUDANG_SNSTOCK']==3) {
|
|
$posisiGudang = "GUDANG SERVICE";
|
|
}
|
|
|
|
$datSupplier = $this->Amod->getData_Supplier_byID($datHsn[0]['SUPPLIER_ID']);
|
|
$dataPembelian = $this->Amod->getData_Pembelian_byKODE($datHsn[0]['KODE_BUKTI']);
|
|
$inisial = $this->Amod->generate_inisialCorp($dataPembelian[0]['CORP_ID']);
|
|
$jenisTransaksiAsal = "PEMBELIAN [$inisial]";
|
|
$penyedia = $datSupplier[0]['NAMA_SUPPLIER'];
|
|
$kodeBuktiAsal = $datHsn[0]['KODE_BUKTI'];
|
|
$tanggalBuktiAsal = $datHsn[0]['TANGGAL'];
|
|
|
|
$data = [
|
|
'kodeBarang' => $datBarang[0]['KODE_BARANG'],
|
|
'namaBarang' => $datBarang[0]['NAMA_BARANG'],
|
|
'posisiGudang' => $posisiGudang,
|
|
'jenisTransaksiAsal' => $jenisTransaksiAsal,
|
|
'penyedia' => $penyedia,
|
|
'kodeBuktiAsal' => $kodeBuktiAsal,
|
|
'tanggalBuktiAsal' => $tanggalBuktiAsal,
|
|
];
|
|
|
|
$this->output_json([
|
|
'data' => $data,
|
|
]);
|
|
}
|
|
|
|
public function SB_Ganti_Sub1_M1_DataPenggantianSn() {
|
|
$id_lama = $this->input->post('id_lama');
|
|
$baru_husnb = $this->input->post('baru_husnb');
|
|
$baru_husnb = strtoupper($baru_husnb);
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
$now = date('Y-m-d');
|
|
|
|
$datSnStock = $this->Amod->getData_SnStock_byID_bySTATUS($id_lama, 0);
|
|
if ($datSnStock==FALSE) {
|
|
$this->session->set_flashdata('latest', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$cekSnStock = $this->Amod->getData_SnStock_byNAMA_allStatus($baru_husnb);
|
|
if ($cekSnStock==TRUE) {
|
|
$this->session->set_flashdata('sn_already', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
|
|
$datSnb = $this->Amod->getData_SnBeli_byNAMA($datSnStock[0]['NAMA_SNSTOCK']);
|
|
$datSnkpr = $this->Amod->getData_SnKlaimProgram_bySNSTOCK($id_lama);
|
|
|
|
$input = [
|
|
'SNSTOCK_ID' => $id_lama,
|
|
'LAMA_HUSNB' => $datSnStock[0]['NAMA_SNSTOCK'],
|
|
'BARU_HUSNB' => $baru_husnb,
|
|
'KUNCI_HUSNB' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->create('histori_ubahsnbeli', $input);
|
|
|
|
if ($datSnkpr==TRUE) {
|
|
$input = [
|
|
'KPR_ID' => $datSnkpr[0]['KPR_ID'],
|
|
'SNSTOCK_ID' => $datSnkpr[0]['SNSTOCK_ID'],
|
|
'NAMA_SNKPR' => $baru_husnb,
|
|
'STATUS_SNKPR' => '0'
|
|
];
|
|
$action = $this->Amod->create('sn_klaimprogram', $input);
|
|
|
|
$update = [
|
|
'STATUS_SNKPR' => '3'
|
|
];
|
|
$action = $this->Amod->update('sn_klaimprogram', $update, 'ID_SNKPR', $datSnkpr[0]['ID_SNKPR']);
|
|
}
|
|
|
|
$update = [
|
|
'NAMA_SNB' => $baru_husnb
|
|
];
|
|
$action = $this->Amod->update('sn_beli', $update, 'ID_SNB', $datSnb[0]['ID_SNB']);
|
|
|
|
$update = [
|
|
'NAMA_SNSTOCK' => $baru_husnb
|
|
];
|
|
$action = $this->Amod->update('sn_stock', $update, 'ID_SNSTOCK', $id_lama);
|
|
|
|
if ($action) {
|
|
$this->session->set_flashdata('success', 'dikunci');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
} else {
|
|
$this->session->set_flashdata('failed', 'dikunci');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
}
|
|
|
|
//SUBMENU PUSAT DATA - CETAK DOKUMEN
|
|
public function SB_Sub2_CetakDokumen_1() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$now = date('Y-m-d');
|
|
$limit = date('Y-m-01');
|
|
$month = $this->Amod->generate_inisialMonth(date('m'));
|
|
$year = date('Y');
|
|
$timelimit = strtoupper("$month $year");
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "SB", "PUSAT DATA - Cetak Dokumen");
|
|
$id_menu = $datShm[0]['MENU_ID'];
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$datMb = $this->Amod->getData_CetakDokumen_byMB_byPERIODE_orderDESC($limit, $now);
|
|
$datKonsinyasi = $this->Amod->getData_CetakDokumen_byKONSINYASI_byPERIODE_orderDESC($limit, $now);
|
|
$datPeminjaman = $this->Amod->getData_CetakDokumen_byPEMINJAMAN_byPERIODE_orderDESC($limit, $now);
|
|
$datPk = $this->Amod->getData_CetakDokumen_byPK_byPERIODE_orderDESC($limit, $now);
|
|
|
|
$datStpos = $this->Amod->getData_SetTogglePosisi_byKARYAWAN_byMENU($id_karyawan, $id_menu);
|
|
if ($datStpos==FALSE) { $posisiToggle = 0; } else { $posisiToggle = $datStpos[0]['AKTIF_STPOS']; }
|
|
|
|
$data = array(
|
|
'sidebar' => "menu stokbarang",
|
|
'navChild' => "stokbarang cetak",
|
|
'tgl' => $now,
|
|
'mb' => $datMb,
|
|
'konsinyasi' => $datKonsinyasi,
|
|
'peminjaman' => $datPeminjaman,
|
|
'pk' => $datPk,
|
|
'countMb' => count($datMb),
|
|
'countKonsinyasi' => count($datKonsinyasi),
|
|
'countPeminjaman' => count($datPeminjaman),
|
|
'countPk' => count($datPk),
|
|
'posisiToggle' => $posisiToggle,
|
|
'id_menu' => $id_menu,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil,
|
|
'timelimit' => $timelimit,
|
|
);
|
|
$this->load->view('proses/SB_Sub2_CetakDokumen_1', $data);
|
|
}
|
|
|
|
public function SB_Ambil_Sub2_A1_DataDaftarMutasiBarang() {
|
|
$id_mb = $this->input->post('id_mb');
|
|
|
|
$datMb = $this->Amod->getData_MutasiBarang_byID($id_mb);
|
|
$data = $this->Amod->getData_DaftarMutasiBarang_byMB($id_mb);
|
|
$no = 0;
|
|
foreach ($data as $key) {
|
|
$datSnmb = $this->Amod->getData_SnMutasiBarang_byDMB($key['ID_DMB']);
|
|
$sn = "";
|
|
$nosn = 1;
|
|
foreach ($datSnmb as $dat) {
|
|
$nama_snmb = $dat['NAMA_SNMB'];
|
|
if ($nosn==count($datSnmb)) {
|
|
$sn .= "$nama_snmb";
|
|
} else {
|
|
$sn .= "$nama_snmb, ";
|
|
$nosn++;
|
|
}
|
|
}
|
|
$data[$no++] += ['SN' => $sn];
|
|
}
|
|
|
|
$this->output_json([
|
|
'total' => sizeof($data),
|
|
'data' => $data,
|
|
'kode_mb' => $datMb[0]['KODE_MB'],
|
|
]);
|
|
}
|
|
|
|
public function SB_Ambil_Sub2_A1_DataDaftarKonsi() {
|
|
$id_konsinyasi = $this->input->post('id_konsinyasi');
|
|
|
|
$datKonsinyasi = $this->Amod->getData_Konsinyasi_byID($id_konsinyasi);
|
|
$data = $this->Amod->getData_DaftarKonsi_byKONSINYASI($id_konsinyasi);
|
|
$no = 0;
|
|
foreach ($data as $key) {
|
|
$datSnk = $this->Amod->getData_SnKonsi_byDFK($key['ID_DFK']);
|
|
$sn = "";
|
|
$nosn = 1;
|
|
foreach ($datSnk as $dat) {
|
|
$nama_snk = $dat['NAMA_SNK'];
|
|
if ($nosn==count($datSnk)) {
|
|
$sn .= "$nama_snk";
|
|
} else {
|
|
$sn .= "$nama_snk, ";
|
|
$nosn++;
|
|
}
|
|
}
|
|
$data[$no++] += ['SN' => $sn];
|
|
}
|
|
|
|
$this->output_json([
|
|
'total' => sizeof($data),
|
|
'data' => $data,
|
|
'kode_konsinyasi' => $datKonsinyasi[0]['KODE_KONSINYASI'],
|
|
]);
|
|
}
|
|
|
|
public function SB_Ambil_Sub2_A1_DataDaftarPinjam() {
|
|
$id_peminjaman = $this->input->post('id_peminjaman');
|
|
|
|
$datPeminjaman = $this->Amod->getData_Peminjaman_byID($id_peminjaman);
|
|
$data = $this->Amod->getData_DaftarPinjam_byPEMINJAMAN($id_peminjaman);
|
|
$no = 0;
|
|
foreach ($data as $key) {
|
|
$datSnp = $this->Amod->getData_SnPinjam_byDFP($key['ID_DFP']);
|
|
$sn = "";
|
|
$nosn = 1;
|
|
foreach ($datSnp as $dat) {
|
|
$nama_snp = $dat['NAMA_SNP'];
|
|
if ($nosn==count($datSnp)) {
|
|
$sn .= "$nama_snp";
|
|
} else {
|
|
$sn .= "$nama_snp, ";
|
|
$nosn++;
|
|
}
|
|
}
|
|
$data[$no++] += ['SN' => $sn];
|
|
}
|
|
|
|
$this->output_json([
|
|
'total' => sizeof($data),
|
|
'data' => $data,
|
|
'kode_peminjaman' => $datPeminjaman[0]['KODE_PEMINJAMAN'],
|
|
]);
|
|
}
|
|
|
|
public function SB_Ambil_Sub2_A1_DataDaftarPenarikanKonsi() {
|
|
$id_pk = $this->input->post('id_pk');
|
|
|
|
$datPk = $this->Amod->getData_PenarikanKonsi_byID($id_pk);
|
|
$data = $this->Amod->getData_DaftarPenarikanKonsi_byPK($id_pk);
|
|
$no = 0;
|
|
foreach ($data as $key) {
|
|
$datSnk = $this->Amod->getData_SnKonsi_byPK_byBARANG_bySTATUS($id_pk, $key['BARANG_ID'], 1);
|
|
$sn = "";
|
|
$nosn = 1;
|
|
foreach ($datSnk as $dat) {
|
|
$nama_snk = $dat['NAMA_SNK'];
|
|
if ($nosn==count($datSnk)) {
|
|
$sn .= "$nama_snk";
|
|
} else {
|
|
$sn .= "$nama_snk, ";
|
|
$nosn++;
|
|
}
|
|
}
|
|
$data[$no++] += ['SN' => $sn];
|
|
}
|
|
|
|
$this->output_json([
|
|
'total' => sizeof($data),
|
|
'data' => $data,
|
|
'kode_pk' => $datPk[0]['KODE_PK'],
|
|
]);
|
|
}
|
|
|
|
public function SB_Sub2_CetakDokumen_2() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$now = date('Y-m-d');
|
|
$limit = date('Y-m-01');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "SB", "PUSAT DATA - Cetak Dokumen");
|
|
$id_menu = $datShm[0]['MENU_ID'];
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
if ($hak<=3) {
|
|
$limit = $this->Amod->generate_subMonth($limit, 3);
|
|
$timelimit = strtoupper("3 Bulan Kebelakang");
|
|
} else {
|
|
$limit = $this->Amod->generate_subMonth($limit, 6);
|
|
$timelimit = strtoupper("6 Bulan Kebelakang");
|
|
}
|
|
|
|
$datMb = $this->Amod->getData_CetakDokumen_byMB_byPERIODE_orderDESC($limit, $now);
|
|
$datKonsinyasi = $this->Amod->getData_CetakDokumen_byKONSINYASI_byPERIODE_orderDESC($limit, $now);
|
|
$datPeminjaman = $this->Amod->getData_CetakDokumen_byPEMINJAMAN_byPERIODE_orderDESC($limit, $now);
|
|
$datPk = $this->Amod->getData_CetakDokumen_byPK_byPERIODE_orderDESC($limit, $now);
|
|
|
|
$datStpos = $this->Amod->getData_SetTogglePosisi_byKARYAWAN_byMENU($id_karyawan, $id_menu);
|
|
if ($datStpos==FALSE) { $posisiToggle = 0; } else { $posisiToggle = $datStpos[0]['AKTIF_STPOS']; }
|
|
|
|
$data = array(
|
|
'sidebar' => "menu stokbarang",
|
|
'navChild' => "stokbarang cetak",
|
|
'tgl' => $now,
|
|
'mb' => $datMb,
|
|
'konsinyasi' => $datKonsinyasi,
|
|
'peminjaman' => $datPeminjaman,
|
|
'pk' => $datPk,
|
|
'countMb' => count($datMb),
|
|
'countKonsinyasi' => count($datKonsinyasi),
|
|
'countPeminjaman' => count($datPeminjaman),
|
|
'countPk' => count($datPk),
|
|
'posisiToggle' => $posisiToggle,
|
|
'id_menu' => $id_menu,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil,
|
|
'timelimit' => $timelimit,
|
|
);
|
|
$this->load->view('proses/SB_Sub2_CetakDokumen_2', $data);
|
|
}
|
|
|
|
//SUBMENU PUSAT DATA - INFORMASI
|
|
public function SB_Sub2_Informasi_1($id=null, $mode) {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "SB", "PUSAT DATA - Informasi");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
if ($id==null) {
|
|
$posisiToggle = 0;
|
|
} else {
|
|
$posisiToggle = $id;
|
|
}
|
|
|
|
$data = array(
|
|
'sidebar' => "menu stokbarang",
|
|
'navChild' => "stokbarang informasi",
|
|
'hak' => $hak,
|
|
'tampil' => $tampil,
|
|
'posisiToggle' => $posisiToggle,
|
|
'mode' => $mode,
|
|
);
|
|
$this->load->view('proses/SB_Sub2_Informasi_1', $data);
|
|
}
|
|
|
|
public function SB_Ambil_Sub2_DataInformasi() {
|
|
$versi = $this->input->post('versi');
|
|
$id_gudang = $this->input->post('id_gudang');
|
|
$id_kondisi = $this->input->post('id_kondisi');
|
|
$id_barang = $this->input->post('id_barang');
|
|
$id_snstock = $this->input->post('id_snstock');
|
|
$kode_bukti = $this->input->post('kode_bukti');
|
|
$id_konsinyasi = $this->input->post('id_konsinyasi');
|
|
$id_mb = $this->input->post('id_mb');
|
|
$id_pk = $this->input->post('id_pk');
|
|
$id_search = $this->input->post('id_search');
|
|
$limit = $this->input->post('limit');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$kodeBar = NULL;
|
|
if ($versi==11 OR $versi==12 OR $versi==13) {
|
|
$datBarang = $this->Amod->getData_Barang_byID($id_barang);
|
|
$kodeBar = $datBarang[0]['KODE_BARANG'];
|
|
}
|
|
|
|
$qtyLast = 0;
|
|
$avgLast = NULL;
|
|
if ($versi==11 OR $versi==13) {
|
|
$datHq = $this->Amod->getData_HistoriKuantiti_byBARANG_orderDESC_limit1($id_barang);
|
|
if ($datHq==FALSE) {
|
|
$qtyLast = 0;
|
|
} else {
|
|
$qtyLast = $datHq[0]['SISA_HQ'];
|
|
}
|
|
if ($versi==11) {
|
|
if ($datHq==FALSE) {
|
|
$avgLast = 0;
|
|
} else {
|
|
$avgLast = $datHq[0]['AVG_HQ'];
|
|
}
|
|
}
|
|
}
|
|
|
|
if ($versi==1) {
|
|
$datSnStock = $this->Amod->getData_SnStock_byID($id_snstock);
|
|
$datHsnAsc = $this->Amod->getData_HistoriSn_bySNSTOCK_orderASC($id_snstock);
|
|
$dataBarang = $this->Amod->getData_Barang_byID($datSnStock[0]['BARANG_ID']);
|
|
|
|
if ($datSnStock[0]['GUDANG_SNSTOCK']==1) {
|
|
$posisiGudang = "PC MASTER";
|
|
} else if ($datSnStock[0]['GUDANG_SNSTOCK']==2) {
|
|
$posisiGudang = "IT POINT";
|
|
} else if ($datSnStock[0]['GUDANG_SNSTOCK']==3) {
|
|
$posisiGudang = "GUDANG SERVICE";
|
|
}
|
|
|
|
$status_snstock = $datSnStock[0]['STATUS_SNSTOCK'];
|
|
if ($status_snstock==NULL) {
|
|
$statusSn = "Dalam Perbaikan";
|
|
} else {
|
|
if ($status_snstock==10) {
|
|
$datSnj = $this->Amod->getData_SnJual_byNAMA_orderDESC_limit1($datSnStock[0]['NAMA_SNSTOCK']);
|
|
$kodeSn = $datSnj[0]['KODE_SO'];
|
|
} else if ($status_snstock==11) {
|
|
$datSnrj = $this->Amod->getData_SnReturJual_byNAMA_orderDESC_limit1($datSnStock[0]['NAMA_SNSTOCK']);
|
|
$kodeSn = $datSnrj[0]['KODE_RJ'];
|
|
} else if ($status_snstock==12) {
|
|
$datSnrb = $this->Amod->getData_SnReturBeli_byNAMA_orderDESC_limit1($datSnStock[0]['NAMA_SNSTOCK']);
|
|
$kodeSn = $datSnrb[0]['KODE_RB'];
|
|
} else if ($status_snstock==13) {
|
|
$datSnio = $this->Amod->getData_SnIo_byNAMA_orderDESC_limit1($datSnStock[0]['NAMA_SNSTOCK']);
|
|
$kodeSn = $datSnio[0]['KODE_BUKTI'];
|
|
} else if ($status_snstock==15) {
|
|
$datSnp = $this->Amod->getData_SnPinjam_byNAMA_orderDESC_limit1($datSnStock[0]['NAMA_SNSTOCK']);
|
|
$kodeSn = $datSnp[0]['KODE_PEMINJAMAN'];
|
|
} else if ($status_snstock==16) {
|
|
$datSnk = $this->Amod->getData_SnKonsi_byNAMA_orderDESC_limit1($datSnStock[0]['NAMA_SNSTOCK']);
|
|
$kodeSn = $datSnk[0]['KODE_KONSINYASI'];
|
|
} else if ($status_snstock==17) {
|
|
$datSns = $this->Amod->getData_SnService_byNAMA_orderDESC_limit1($datSnStock[0]['NAMA_SNSTOCK']);
|
|
$kodeSn = $datSns[0]['KODE_SERVICE'];
|
|
} else if ($status_snstock==18) {
|
|
$datSnmb = $this->Amod->getData_SnMutasiBarang_byNAMA_orderDESC_limit1($datSnStock[0]['NAMA_SNSTOCK']);
|
|
$kodeSn = $datSnmb[0]['KODE_MB'];
|
|
} else if ($status_snstock==20) {
|
|
$datSnsw = $this->Amod->getData_SnSewa_byNAMA_orderDESC_limit1($datSnStock[0]['NAMA_SNSTOCK']);
|
|
$kodeSn = $datSnsw[0]['KODE_SEWA'];
|
|
}
|
|
|
|
$datSsn = $this->Amod->getData_StatusSn($status_snstock);
|
|
$statusSn = $datSsn[0]['NAMA_SSN'];
|
|
if ($status_snstock==10 OR $status_snstock==11 OR $status_snstock==12 OR $status_snstock==13 OR $status_snstock==14 OR $status_snstock==15 OR $status_snstock==16 OR $status_snstock==17 OR $status_snstock==18 OR $status_snstock==20) {
|
|
$statusSn = "$statusSn <b style='color:Olive'>[$kodeSn]</b>";
|
|
}
|
|
}
|
|
|
|
$limitHsn = 0;
|
|
foreach ($datHsnAsc as $key) {
|
|
if (strpos($key['KODE_BUKTI'],"SD")!==FALSE) {
|
|
$jenisTransaksiAsal = "STOK OPNAME";
|
|
$penyedia = "Sistem Program";
|
|
$kode_buktiAwal = $key['KODE_BUKTI'];
|
|
$tanggalAwal = $key['TANGGAL'];
|
|
break;
|
|
} else if (strpos($key['KODE_BUKTI'],"PB")!==FALSE) {
|
|
$dataSupplier = $this->Amod->getData_Supplier_byID($key['SUPPLIER_ID']);
|
|
$dataPembelian = $this->Amod->getData_Pembelian_byKODE($key['KODE_BUKTI']);
|
|
$inisial = $this->Amod->generate_inisialCorp($dataPembelian[0]['CORP_ID']);
|
|
$jenisTransaksiAsal = "PEMBELIAN [$inisial]";
|
|
$penyedia = $dataSupplier[0]['NAMA_SUPPLIER'];
|
|
$kode_buktiAwal = $key['KODE_BUKTI'];
|
|
$tanggalAwal = $key['TANGGAL'];
|
|
break;
|
|
} else if (strpos($key['KODE_BUKTI'],"SO")!==FALSE OR strpos($key['KODE_BUKTI'],"KM")!==FALSE OR strpos($key['KODE_BUKTI'],"PRO")!==FALSE OR strpos($key['KODE_BUKTI'],"MOD")!==FALSE) {
|
|
$jenisTransaksiAsal = "KELUAR MASUK";
|
|
$dataIo = $this->Amod->getData_TransaksiStock_byKODEBUKTI($key['KODE_BUKTI']);
|
|
$penyedia = $dataIo[0]['NAMA_PANGGILAN_KARYAWAN'];
|
|
$kode_buktiAwal = $key['KODE_BUKTI'];
|
|
$tanggalAwal = $key['TANGGAL'];
|
|
break;
|
|
}
|
|
$limitHsn++;
|
|
|
|
if ($limitHsn==count($datHsnAsc)) {
|
|
$jenisTransaksiAsal = "Dalam Perbaikan";
|
|
$penyedia = "Dalam Perbaikan";
|
|
$kode_buktiAwal = "Dalam Perbaikan";
|
|
$tanggalAwal = "Dalam Perbaikan";
|
|
}
|
|
}
|
|
|
|
if ($status_snstock==NULL OR $status_snstock==0 OR $status_snstock==10 OR $status_snstock==11 OR $status_snstock==12 OR $status_snstock==13 OR $status_snstock==14 OR $status_snstock==15 OR $status_snstock==16 OR $status_snstock==17 OR $status_snstock==18 OR $status_snstock==20) {
|
|
$bukaAkhir = 0;
|
|
$jenisTransaksiAkhir = "";
|
|
$kodeBuktiAkhir = "";
|
|
$tanggalBuktiAkhir = "";
|
|
$atasNama = "";
|
|
} else {
|
|
$bukaAkhir = 1;
|
|
if ($status_snstock>=1 AND $status_snstock<=4) {
|
|
$datHsnDesc = $this->Amod->getData_HistoriSn_bySNSTOCK_orderDESC_limit1($id_snstock);
|
|
if ($status_snstock==1) {
|
|
foreach ($datHsnDesc as $key) {
|
|
if (strpos($key['KODE_BUKTI'],"PJ")!==FALSE) {
|
|
$dataPelanggan = $this->Amod->getData_Pelanggan_byID($key['PELANGGAN_ID']);
|
|
$dataPenjualan = $this->Amod->getData_Penjualan_byKODE($key['KODE_BUKTI']);
|
|
$inisial = $this->Amod->generate_inisialCorp($dataPenjualan[0]['KOP_ID']);
|
|
$jenisTransaksiAkhir = "PENJUALAN [$inisial]";
|
|
$kodeKosong = $key['KODE_BUKTI'];
|
|
$soKosong = $dataPenjualan[0]['KODE_SO'];
|
|
$kodeBuktiAkhir = "$kodeKosong ($soKosong)";
|
|
$tanggalBuktiAkhir = $key['TANGGAL'];
|
|
$atasNama = $dataPelanggan[0]['NAMA_PELANGGAN'];
|
|
break;
|
|
}
|
|
}
|
|
} else if ($status_snstock==2) {
|
|
$dataSupplier = $this->Amod->getData_Supplier_byID($datHsnDesc[0]['SUPPLIER_ID']);
|
|
$dataRb = $this->Amod->getData_ReturPembelian_byKODE($datHsnDesc[0]['KODE_BUKTI']);
|
|
$inisial = $this->Amod->generate_inisialCorp($dataRb[0]['CORP_ID']);
|
|
$jenisTransaksiAkhir = "RETUR PEMBELIAN [$inisial]";
|
|
$kodeBuktiAkhir = $datHsnDesc[0]['KODE_BUKTI'];
|
|
$tanggalBuktiAkhir = $datHsnDesc[0]['TANGGAL'];
|
|
$atasNama = $dataSupplier[0]['NAMA_SUPPLIER'];
|
|
} else if ($status_snstock==3) {
|
|
$dataIo = $this->Amod->getData_TransaksiStock_byKODEBUKTI_byJENIS($datHsnDesc[0]['KODE_BUKTI'], 0);
|
|
$jenisTransaksiAkhir = "KELUAR STOK";
|
|
$kodeBuktiAkhir = $datHsnDesc[0]['KODE_BUKTI'];
|
|
$tanggalBuktiAkhir = $datHsnDesc[0]['TANGGAL'];
|
|
$atasNama = $dataIo[0]['NAMA_PANGGILAN_KARYAWAN'];
|
|
}
|
|
} else if ($status_snstock==5) {
|
|
$dataSnp = $this->Amod->getData_SnPinjam_bySNSTOCK_bySTATUS($id_snstock, 1);
|
|
$jenisTransaksiAkhir = "PEMINJAMAN";
|
|
$kodeBuktiAkhir = $dataSnp[0]['KODE_PEMINJAMAN'];
|
|
$tanggalBuktiAkhir = $dataSnp[0]['TANGGAL'];
|
|
if ($dataSnp[0]['PEMINJAM_ID']!=NULL AND $dataSnp[0]['PELANGGAN_ID']==0) {
|
|
$atasNama = $dataSnp[0]['NAMA_PANGGILAN_KARYAWAN'];
|
|
} else if ($dataSnp[0]['PELANGGAN_ID']!=NULL AND $dataSnp[0]['PEMINJAM_ID']==0) {
|
|
$atasNama = $dataSnp[0]['NAMA_PELANGGAN'];
|
|
}
|
|
} else if ($status_snstock==6) {
|
|
$dataSnk = $this->Amod->getData_SnKonsi_bySNSTOCK_statusNull($id_snstock);
|
|
$jenisTransaksiAkhir = "KONSINYASI";
|
|
$kodeBuktiAkhir = $dataSnk[0]['KODE_KONSINYASI'];
|
|
$tanggalBuktiAkhir = $dataSnk[0]['TANGGAL'];
|
|
$atasNama = $dataSnk[0]['NAMA_PELANGGAN'];
|
|
} else if ($status_snstock==7) {
|
|
$dataSns = $this->Amod->getData_SnService_bySNSTOCK_orderDESC_limit1($id_snstock);
|
|
$jenisTransaksiAkhir = "SERVICE";
|
|
$kodeBuktiAkhir = $dataSns[0]['KODE_SERVICE'];
|
|
$tanggalBuktiAkhir = $dataSns[0]['TANGGAL'];
|
|
$atasNama = $dataSns[0]['TERIMA_SERVICE'];
|
|
} else if ($status_snstock==8) {
|
|
$dataSnmb = $this->Amod->getData_SnMutasiBarang_bySNSTOCK_bySTATUS($id_snstock, 1);
|
|
$jenisTransaksiAkhir = "MUTASI";
|
|
$kodeBuktiAkhir = $dataSnmb[0]['KODE_MB'];
|
|
$tanggalBuktiAkhir = $dataSnmb[0]['TANGGAL'];
|
|
$atasNama = $dataSnmb[0]['NAMA_PANGGILAN_KARYAWAN'];
|
|
} else if ($status_snstock==9) {
|
|
$dataSnpr = $this->Amod->getData_SnProyek_bySNSTOCK_bySTATUS($id_snstock, $status_snstock);
|
|
$jenisTransaksiAkhir = "PROYEK";
|
|
$kodeBuktiAkhir = $dataSnpr[0]['KODE_PROYEK'];
|
|
$tanggalBuktiAkhir = $dataSnpr[0]['TANGGAL'];
|
|
$atasNama = $dataSnpr[0]['NAMA_PELANGGAN'];
|
|
} else if ($status_snstock==19) {
|
|
$dataSna = $this->Amod->getData_SnAntik_bySNSTOCK_bySTATUS($id_snstock, $status_snstock);
|
|
$jenisTransaksiAkhir = "ANTIK";
|
|
$kodeBuktiAkhir = $dataSna[0]['KODE_SA'];
|
|
$tanggalBuktiAkhir = $dataSna[0]['TANGGAL'];
|
|
$atasNama = "Gudang Antik";
|
|
}
|
|
}
|
|
|
|
$data = [
|
|
'kodeBarang' => $dataBarang[0]['KODE_BARANG'],
|
|
'namaBarang' => $dataBarang[0]['NAMA_BARANG'],
|
|
'posisiGudang' => $posisiGudang,
|
|
'statusSn' => $statusSn,
|
|
'jenisTransaksiAsal' => $jenisTransaksiAsal,
|
|
'kodeBuktiAsal' => $kode_buktiAwal,
|
|
'tanggalBuktiAsal' => $tanggalAwal,
|
|
'penyedia' => $penyedia,
|
|
'bukaAkhir' => $bukaAkhir,
|
|
'jenisTransaksiAkhir' => $jenisTransaksiAkhir,
|
|
'kodeBuktiAkhir' => $kodeBuktiAkhir,
|
|
'tanggalBuktiAkhir' => $tanggalBuktiAkhir,
|
|
'atasNama' => $atasNama,
|
|
];
|
|
} else if ($versi==2) {
|
|
$data = $this->Amod->getData_TransaksiStock_byKODEBUKTI($kode_bukti);
|
|
$no = 0;
|
|
$sn = "";
|
|
foreach ($data as $key) {
|
|
$datSnio = $this->Amod->getData_SnIo_byIO($key['ID_IO']);
|
|
foreach ($datSnio as $dat) {
|
|
$nama_snio = $dat['NAMA_SNIO'];
|
|
$sn .= "$nama_snio, ";
|
|
}
|
|
$data[$no++] += ['SN' => $sn];
|
|
$sn = "";
|
|
}
|
|
} else if ($versi==3) {
|
|
$data = $this->Amod->getData_DaftarKonsi_byKONSINYASI($id_konsinyasi);
|
|
$no = 0;
|
|
$sn = "";
|
|
foreach ($data as $key) {
|
|
$datSnk = $this->Amod->getData_SnKonsi_byDFK($key['ID_DFK']);
|
|
foreach ($datSnk as $dat) {
|
|
$nama_snk = $dat['NAMA_SNK'];
|
|
$sn .= "$nama_snk, ";
|
|
}
|
|
$data[$no++] += ['SN' => $sn];
|
|
$sn = "";
|
|
}
|
|
} else if ($versi==4) {
|
|
$data = $this->Amod->getData_DaftarMutasiBarang_byMB($id_mb);
|
|
$no = 0;
|
|
$sn = "";
|
|
foreach ($data as $key) {
|
|
$datSnmb = $this->Amod->getData_SnMutasiBarang_byDMB_byMB($key['ID_DMB'],$key['MB_ID']);
|
|
foreach ($datSnmb as $dat) {
|
|
$nama_snmb = $dat['NAMA_SNMB'];
|
|
$sn .= "$nama_snmb, ";
|
|
}
|
|
$data[$no++] += ['SN' => $sn];
|
|
$sn = "";
|
|
}
|
|
} else if ($versi==5) {
|
|
$data = $this->Amod->getData_DaftarPenarikanKonsi_byPK($id_pk);
|
|
$no = 0;
|
|
$sn = "";
|
|
foreach ($data as $key) {
|
|
$datSnk = $this->Amod->getData_SnKonsi_byBARANG_byPK($key['BARANG_ID'],$key['PK_ID']);
|
|
foreach ($datSnk as $dat) {
|
|
$nama_snk = $dat['NAMA_SNK'];
|
|
$sn .= "$nama_snk, ";
|
|
}
|
|
$data[$no++] += ['SN' => $sn];
|
|
$sn = "";
|
|
}
|
|
} else if ($versi==11) {
|
|
$data = $this->Amod->getData_HistoriKuantiti_byBARANG_bySTATUS_orderASC($id_barang, 1, $id_search);
|
|
$no = 0;
|
|
foreach ($data as $key) {
|
|
if (strpos($key['KODE_BUKTI'],"PB")!==FALSE) {
|
|
$dataPembelian = $this->Amod->getData_Pembelian_byKODE($key['KODE_BUKTI']);
|
|
$inisial = $this->Amod->generate_inisialCorp($dataPembelian[0]['CORP_ID']);
|
|
$sup = $dataPembelian[0]['NAMA_SUPPLIER'];
|
|
} else if (strpos($key['KODE_BUKTI'],"PJ")!==FALSE) {
|
|
$dataPenjualan = $this->Amod->getData_Penjualan_byKODE($key['KODE_BUKTI']);
|
|
$inisial = $this->Amod->generate_inisialCorp($dataPenjualan[0]['KOP_ID']);
|
|
$sup = $dataPenjualan[0]['NAMA_PELANGGAN'];
|
|
} else {
|
|
$inisial = "";
|
|
$sup = "";
|
|
}
|
|
$data[$no] += ['SUP' => $sup];
|
|
$data[$no++] += ['INISIAL' => $inisial];
|
|
}
|
|
} else if ($versi==12) {
|
|
$data = $this->Amod->getData_Kuantiti_byBARANG($id_barang);
|
|
} else if ($versi==13) {
|
|
$data = $this->Amod->getData_SnStock_byBARANG_groupSTATUS_forListSNReady($id_barang, $id_search);
|
|
$no = 0;
|
|
$snpcm = "";
|
|
$snitp = "";
|
|
$snsvc = "";
|
|
foreach ($data as $key) {
|
|
$datSn1 = $this->Amod->getData_SnStock_byBARANG_byGUDANG_bySTATUS($id_barang, 1, $key['STATUS_SNSTOCK']);
|
|
foreach ($datSn1 as $dat) {
|
|
$nama_snstock = $dat['NAMA_SNSTOCK'];
|
|
$snpcm .= "$nama_snstock, ";
|
|
}
|
|
|
|
$datSn2 = $this->Amod->getData_SnStock_byBARANG_byGUDANG_bySTATUS($id_barang, 2, $key['STATUS_SNSTOCK']);
|
|
foreach ($datSn2 as $dat) {
|
|
$nama_snstock = $dat['NAMA_SNSTOCK'];
|
|
$snitp .= "$nama_snstock, ";
|
|
}
|
|
|
|
$datSn3 = $this->Amod->getData_SnStock_byBARANG_byGUDANG_bySTATUS($id_barang, 3, $key['STATUS_SNSTOCK']);
|
|
foreach ($datSn3 as $dat) {
|
|
$nama_snstock = $dat['NAMA_SNSTOCK'];
|
|
$snsvc .= "$nama_snstock, ";
|
|
}
|
|
|
|
$data[$no] += ['SNPCM' => $snpcm];
|
|
$data[$no] += ['SNITP' => $snitp];
|
|
$data[$no++] += ['SNSVC' => $snsvc];
|
|
|
|
$snpcm = "";
|
|
$snitp = "";
|
|
$snsvc = "";
|
|
}
|
|
} else {
|
|
$data = null;
|
|
}
|
|
|
|
$this->output_json([
|
|
'data' => $data,
|
|
'kodeBar' => $kodeBar,
|
|
'qtyLast' => "$qtyLast Unit",
|
|
'avgLast' => number_format($avgLast,2),
|
|
'timestamp' => $timestamp,
|
|
]);
|
|
}
|
|
|
|
public function SB_Sub2_Informasi_2($id1, $id2) {
|
|
$datBarang = $this->Amod->getData_Barang_byID($id1);
|
|
$datKuantiti = $this->Amod->getData_Kuantiti_byID($id1);
|
|
|
|
if ($id2==0) {
|
|
$judul = "DATA STOK PENDING";
|
|
$qty = $datKuantiti[0]['PENDING_KUANTITI'];
|
|
$data = $this->Amod->getData_Pending_byBARANG_bySTATUS($id1, 0);
|
|
$no = 0;
|
|
foreach ($data as $key) {
|
|
$datPending = $this->Amod->getData_Pending_byID_bySTATUS($key['ID_PENDING'], 0);
|
|
$nama_pelanggan = $datPending[0]['NAMA_PELANGGAN'];
|
|
$nama_sales = $datPending[0]['NAMA_PANGGILAN_KARYAWAN'];
|
|
$penerima = "$nama_pelanggan<br><b class='text-danger'>Sales : [$nama_sales]<b>";
|
|
|
|
$data[$no] += ['QTY' => $datPending[0]['QTY_PENDING']];
|
|
$data[$no] += ['KODE' => $datPending[0]['KODE_PENDING']];
|
|
$data[$no] += ['TANGGAL' => $datPending[0]['TANGGAL']];
|
|
$data[$no++] += ['PENERIMA' => $penerima];
|
|
}
|
|
} else if ($id2==1) {
|
|
$judul = "DATA STOK PCM";
|
|
$qty = $datKuantiti[0]['PCM_KUANTITI'];
|
|
$data = $this->Amod->getData_SnStock_byBARANG_byGUDANG_bySTATUS($id1, 1, 0);
|
|
$no = 0;
|
|
foreach ($data as $key) {
|
|
$datHsn = $this->Amod->getData_HistoriSn_bySNSTOCK_orderDESC_limit1($key['ID_SNSTOCK']);
|
|
$data[$no] += ['TANGGAL' => $datHsn[0]['TANGGAL']];
|
|
$data[$no++] += ['KODE' => $datHsn[0]['KODE_BUKTI']];
|
|
}
|
|
} else if ($id2==2) {
|
|
$judul = "DATA STOK ITP";
|
|
$qty = $datKuantiti[0]['ITP_KUANTITI'];
|
|
$data = $this->Amod->getData_SnStock_byBARANG_byGUDANG_bySTATUS($id1, 2, 0);
|
|
$no = 0;
|
|
foreach ($data as $key) {
|
|
$datHsn = $this->Amod->getData_HistoriSn_bySNSTOCK_orderDESC_limit1($key['ID_SNSTOCK']);
|
|
$data[$no] += ['TANGGAL' => $datHsn[0]['TANGGAL']];
|
|
$data[$no++] += ['KODE' => $datHsn[0]['KODE_BUKTI']];
|
|
}
|
|
} else if ($id2==5) {
|
|
$judul = "DATA STOK PEMINJAMAN";
|
|
$qty = $datKuantiti[0]['PEMINJAMAN_KUANTITI'];
|
|
$data = $this->Amod->getData_DaftarPinjam_byBARANG_bySTATUS($id1, 1);
|
|
$no = 0;
|
|
$sn = "";
|
|
foreach ($data as $key) {
|
|
$datPeminjaman = $this->Amod->getData_Peminjaman_byID_bySTATUS($key['ID_PEMINJAMAN'], 1);
|
|
if ($datPeminjaman[0]['JENIS_PEMINJAMAN']==1) {
|
|
$penerima = $datPeminjaman[0]['NAMA_PANGGILAN_KARYAWAN'];
|
|
} else if ($datPeminjaman[0]['JENIS_PEMINJAMAN']==2) {
|
|
$penerima = $datPeminjaman[0]['NAMA_PELANGGAN'];
|
|
}
|
|
|
|
$datSnp = $this->Amod->getData_SnPinjam_byDFP($key['ID_DFP']);
|
|
foreach ($datSnp as $dat) {
|
|
$nama_snp = $dat['NAMA_SNP'];
|
|
$sn .= "$nama_snp, ";
|
|
}
|
|
|
|
$data[$no] += ['SN' => $sn];
|
|
$data[$no] += ['QTY' => $key['QTY_DFP']];
|
|
$data[$no] += ['KODE' => $key['KODE_PEMINJAMAN']];
|
|
$data[$no] += ['TANGGAL' => $key['TANGGAL']];
|
|
$data[$no++] += ['PENERIMA' => $penerima];
|
|
|
|
$sn = "";
|
|
}
|
|
} else if ($id2==6) {
|
|
$judul = "DATA STOK KONSINYASI";
|
|
$qty = $datKuantiti[0]['KONSINYASI_KUANTITI'];
|
|
$data = $this->Amod->getData_SnStock_byBARANG_bySTATUS($id1, $id2);
|
|
$no = 0;
|
|
foreach ($data as $key) {
|
|
$datSnk = $this->Amod->getData_SnKonsi_bySNSTOCK_pkNull_orderDESC_limit1($key['ID_SNSTOCK']);
|
|
$nama_pelanggan = $datSnk[0]['NAMA_PELANGGAN'];
|
|
$nama_sales = $datSnk[0]['NAMA_PANGGILAN_KARYAWAN'];
|
|
$penerima = "$nama_pelanggan<br><b class='text-danger'>Sales : [$nama_sales]<b>";
|
|
|
|
$data[$no] += ['PENERIMA' => $penerima];
|
|
$data[$no] += ['TANGGAL' => $datSnk[0]['TANGGAL']];
|
|
$data[$no++] += ['KODE' => $datSnk[0]['KODE_KONSINYASI']];
|
|
}
|
|
} else if ($id2==7) {
|
|
$judul = "DATA STOK SERVICE";
|
|
$qty = $datKuantiti[0]['SERVICE_KUANTITI'];
|
|
$data = $this->Amod->getData_SnStock_byBARANG_bySTATUS($id1, $id2);
|
|
$no = 0;
|
|
foreach ($data as $key) {
|
|
$datSns = $this->Amod->getData_SnService_bySNSTOCK_orderDESC_limit1($key['ID_SNSTOCK']);
|
|
$data[$no] += ['PENERIMA' => $datSns[0]['PENERIMA']];
|
|
$data[$no] += ['TANGGAL' => $datSns[0]['TANGGAL']];
|
|
$data[$no++] += ['KODE' => $datSns[0]['KODE_SERVICE']];
|
|
}
|
|
} else if ($id2==8) {
|
|
$judul = "DATA STOK MUTASI";
|
|
$qty = $datKuantiti[0]['MUTASI_KUANTITI'];
|
|
$data = $this->Amod->getData_SnStock_byBARANG_bySTATUS($id1, $id2);
|
|
$no = 0;
|
|
foreach ($data as $key) {
|
|
$datSnmb = $this->Amod->getData_SnMutasiBarang_bySNSTOCK_orderDESC_limit1($key['ID_SNSTOCK']);
|
|
|
|
$data[$no] += ['PENERIMA' => $datSnmb[0]['NAMA_PANGGILAN_KARYAWAN']];
|
|
$data[$no] += ['TANGGAL' => $datSnmb[0]['TANGGAL']];
|
|
$data[$no++] += ['KODE' => $datSnmb[0]['KODE_MB']];
|
|
}
|
|
} else if ($id2==9) {
|
|
$judul = "DATA STOK PROYEK";
|
|
$qty = $datKuantiti[0]['PROYEK_KUANTITI'];
|
|
$data = $this->Amod->getData_DaftarProyek_byBARANG_bySTATUS_groupPROYEK_groupBARANG($id1, 0);
|
|
$no = 0;
|
|
$sn = "";
|
|
foreach ($data as $key) {
|
|
$datProyek = $this->Amod->getData_Proyek_byID($key['PROYEK_ID']);
|
|
$nama_pelanggan = $datProyek[0]['NAMA_PELANGGAN'];
|
|
$nama_sales = $datProyek[0]['NAMA_PANGGILAN_KARYAWAN'];
|
|
$penerima = "$nama_pelanggan<br><b class='text-danger'>Sales : [$nama_sales]<b>";
|
|
|
|
$datSnpr = $this->Amod->getData_SnProyek_byBARANG_byPROYEK_status9_groupNAMASNPR($id1, $key['PROYEK_ID']);
|
|
foreach ($datSnpr as $dat) {
|
|
$nama_snpr = $dat['NAMA_SNPR'];
|
|
$sn .= "$nama_snpr, ";
|
|
}
|
|
|
|
$data[$no] += ['SN' => $sn];
|
|
$data[$no] += ['QTY' => $key['QTY']];
|
|
$data[$no] += ['KODE' => $key['KODE_PROYEK']];
|
|
$data[$no] += ['TANGGAL' => $key['TANGGAL']];
|
|
$data[$no++] += ['PENERIMA' => $penerima];
|
|
|
|
$sn = "";
|
|
}
|
|
} else if ($id2==10) {
|
|
$judul = "DATA STOK PROSES";
|
|
$qty = $datKuantiti[0]['PROSES_KUANTITI'];
|
|
$dat10 = $this->Amod->getData_SnStock_byBARANG_bySTATUS($id1, 10);
|
|
$dat11 = $this->Amod->getData_SnStock_byBARANG_bySTATUS($id1, 11);
|
|
$dat12 = $this->Amod->getData_SnStock_byBARANG_bySTATUS($id1, 12);
|
|
$dat13 = $this->Amod->getData_SnStock_byBARANG_bySTATUS($id1, 13);
|
|
$dat14 = $this->Amod->getData_SnStock_byBARANG_bySTATUS($id1, 14);
|
|
$dat15 = $this->Amod->getData_SnStock_byBARANG_bySTATUS($id1, 15);
|
|
$dat16 = $this->Amod->getData_SnStock_byBARANG_bySTATUS($id1, 16);
|
|
$dat17 = $this->Amod->getData_SnStock_byBARANG_bySTATUS($id1, 17);
|
|
$dat18 = $this->Amod->getData_SnStock_byBARANG_bySTATUS($id1, 18);
|
|
|
|
$data = [];
|
|
$no = 0;
|
|
foreach ($dat10 as $key) {
|
|
$data[$no++] = $key;
|
|
}
|
|
|
|
foreach ($dat11 as $key) {
|
|
$data[$no++] = $key;
|
|
}
|
|
|
|
foreach ($dat12 as $key) {
|
|
$data[$no++] = $key;
|
|
}
|
|
|
|
foreach ($dat13 as $key) {
|
|
$data[$no++] = $key;
|
|
}
|
|
|
|
foreach ($dat14 as $key) {
|
|
$data[$no++] = $key;
|
|
}
|
|
|
|
foreach ($dat15 as $key) {
|
|
$data[$no++] = $key;
|
|
}
|
|
|
|
foreach ($dat16 as $key) {
|
|
$data[$no++] = $key;
|
|
}
|
|
|
|
foreach ($dat17 as $key) {
|
|
$data[$no++] = $key;
|
|
}
|
|
|
|
foreach ($dat18 as $key) {
|
|
$data[$no++] = $key;
|
|
}
|
|
} else if ($id2==19) {
|
|
$judul = "DATA STOK ANTIK";
|
|
$qty = $datKuantiti[0]['ANTIK_KUANTITI'];
|
|
$data = $this->Amod->getData_SnStock_byBARANG_bySTATUS($id1, $id2);
|
|
$no = 0;
|
|
foreach ($data as $key) {
|
|
$datSna = $this->Amod->getData_SnAntik_bySNSTOCK_bySTATUS($key['ID_SNSTOCK'], $id2);
|
|
$data[$no] += ['PENERIMA' => $datSna[0]['NAMA_PANGGILAN_KARYAWAN']];
|
|
$data[$no] += ['TANGGAL' => $datSna[0]['TANGGAL']];
|
|
$data[$no++] += ['KODE' => $datSna[0]['KODE_SA']];
|
|
}
|
|
} else if ($id2==20) {
|
|
$judul = "DATA STOK SEWA";
|
|
$qty = $datKuantiti[0]['SEWA_KUANTITI'];
|
|
$data = $this->Amod->getData_SnStock_byBARANG_bySTATUS($id1, $id2);
|
|
$no = 0;
|
|
foreach ($data as $key) {
|
|
$datSna = $this->Amod->getData_SnSewa_bySNSTOCK_bySTATUS($key['ID_SNSTOCK'], $id2);
|
|
$data[$no] += ['PENERIMA' => $datSna[0]['NAMA_PELANGGAN']];
|
|
$data[$no] += ['TANGGAL' => $datSna[0]['TANGGAL']];
|
|
$data[$no++] += ['KODE' => $datSna[0]['KODE_SEWA']];
|
|
}
|
|
}
|
|
|
|
$data = array(
|
|
'sidebar' => "",
|
|
'navChild' => "",
|
|
'data' => $data,
|
|
'judul' => $judul,
|
|
'kodeBar' => $datBarang[0]['KODE_BARANG'],
|
|
'qty' => $qty,
|
|
'jenis' => $id2,
|
|
);
|
|
$this->load->view('proses/SB_Sub2_Informasi_2', $data);
|
|
}
|
|
|
|
//SUBMENU PUSAT DATA - LAPORAN
|
|
public function SB_Sub2_Laporan_1() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "SB", "PUSAT DATA - Laporan");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$data = array(
|
|
'sidebar' => "menu stokbarang",
|
|
'navChild' => "stokbarang laporan",
|
|
'hak' => $hak,
|
|
'tampil' => $tampil
|
|
);
|
|
$this->load->view('proses/SB_Sub2_Laporan_1', $data);
|
|
}
|
|
|
|
public function SB_Sub2_KeluarMasuk_2() {
|
|
$now = date('Y-m-d');
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "SB", "PUSAT DATA - Laporan");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$datBarang = $this->Amod->getData_Barang_bySTATUS_jenisNot2(1);
|
|
$datJio = $this->Amod->getData_JenisIo();
|
|
|
|
$data = array(
|
|
'sidebar' => "menu stokbarang",
|
|
'navChild' => "stokbarang laporan",
|
|
'tgl' => $now,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil,
|
|
'barang' => $datBarang,
|
|
'jio' => $datJio,
|
|
);
|
|
$this->load->view('proses/SB_Sub2_KeluarMasuk_2', $data);
|
|
}
|
|
|
|
public function SB_Sub2_KuantitiPricelist_2() {
|
|
$now = date('Y-m-d');
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "SB", "PUSAT DATA - Laporan");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$data = array(
|
|
'sidebar' => "menu stokbarang",
|
|
'navChild' => "stokbarang laporan",
|
|
'tgl' => $now,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil,
|
|
);
|
|
$this->load->view('proses/SB_Sub2_KuantitiPricelist_2', $data);
|
|
}
|
|
|
|
public function SB_Sub2_Persediaan_2() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "SB", "PUSAT DATA - Laporan");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$data = array(
|
|
'sidebar' => "menu stokbarang",
|
|
'navChild' => "stokbarang laporan",
|
|
'hak' => $hak,
|
|
'tampil' => $tampil,
|
|
);
|
|
$this->load->view('proses/SB_Sub2_Persediaan_2', $data);
|
|
}
|
|
|
|
public function SB_Sub2_PosisiStok_2() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "SB", "PUSAT DATA - Laporan");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$datJenis = $this->Amod->getData_Jenis_bySTATUS_typeNot2(1);
|
|
$datMerk = $this->Amod->getData_Merk_bySTATUS(1);
|
|
$datProduk = $this->Amod->getData_Produk_bySTATUS(1);
|
|
|
|
$data = array(
|
|
'sidebar' => "menu stokbarang",
|
|
'navChild' => "stokbarang laporan",
|
|
'hak' => $hak,
|
|
'tampil' => $tampil,
|
|
'jenis' => $datJenis,
|
|
'merk' => $datMerk,
|
|
'produk' => $datProduk,
|
|
);
|
|
$this->load->view('proses/SB_Sub2_PosisiStok_2', $data);
|
|
}
|
|
|
|
public function SB_Sub2_StokOpname_2() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "SB", "PUSAT DATA - Laporan");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$datJenis = $this->Amod->getData_Jenis_bySTATUS_typeNot2(1);
|
|
$datMerk = $this->Amod->getData_Merk_bySTATUS(1);
|
|
$datProduk = $this->Amod->getData_Produk_bySTATUS(1);
|
|
|
|
$data = array(
|
|
'sidebar' => "menu stokbarang",
|
|
'navChild' => "stokbarang laporan",
|
|
'hak' => $hak,
|
|
'tampil' => $tampil,
|
|
'jenis' => $datJenis,
|
|
'merk' => $datMerk,
|
|
'produk' => $datProduk,
|
|
);
|
|
$this->load->view('proses/SB_Sub2_StokOpname_2', $data);
|
|
}
|
|
|
|
public function SB_Sub2_StokSupplier_2() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "SB", "PUSAT DATA - Laporan");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$datSupplier = $this->Amod->getData_Supplier_bySTATUS(1);
|
|
$datMerk = $this->Amod->getData_Merk_bySTATUS(1);
|
|
$datProduk = $this->Amod->getData_Produk_bySTATUS(1);
|
|
|
|
$data = array(
|
|
'sidebar' => "menu stokbarang",
|
|
'navChild' => "stokbarang laporan",
|
|
'hak' => $hak,
|
|
'tampil' => $tampil,
|
|
'supplier' => $datSupplier,
|
|
'merk' => $datMerk,
|
|
'produk' => $datProduk,
|
|
);
|
|
$this->load->view('proses/SB_Sub2_StokSupplier_2', $data);
|
|
}
|
|
|
|
public function SB_Ambil_Sub2_DataPembukuanKeluarMasuk() {
|
|
$id_barang = $this->input->post('id_barang');
|
|
$id_jio = $this->input->post('id_jio');
|
|
$transaksi = $this->input->post('transaksi');
|
|
$awal = $this->input->post('awal');
|
|
$akhir = $this->input->post('akhir');
|
|
$search = $this->input->post('search');
|
|
|
|
if ($id_barang == "") {
|
|
$id_barang = NULL;
|
|
}
|
|
|
|
if ($id_jio == "") {
|
|
$id_jio = NULL;
|
|
}
|
|
|
|
if ($transaksi == "") {
|
|
$transaksi = NULL;
|
|
}
|
|
|
|
$data = $this->Amod->getData_TransaksiStock_byBARANG_byJIO_byJENIS_byPERIODE_status1($id_barang, $id_jio, $transaksi, $awal, $akhir, $search);
|
|
|
|
$this->output_json([
|
|
'data' => $data,
|
|
]);
|
|
}
|
|
|
|
public function SB_Ambil_Sub2_DataPembukuanPosisiStok() {
|
|
$id_jenis = $this->input->post('id_jenis');
|
|
$id_merk = $this->input->post('id_merk');
|
|
$id_produk = $this->input->post('id_produk');
|
|
$gudang = $this->input->post('gudang');
|
|
$awal = $this->input->post('awal');
|
|
$akhir = $this->input->post('akhir');
|
|
$kode_barang = $this->input->post('kode_barang');
|
|
|
|
if ($id_jenis == "") {
|
|
$id_jenis = NULL;
|
|
}
|
|
|
|
if ($id_merk == "") {
|
|
$id_merk = NULL;
|
|
}
|
|
|
|
if ($id_produk == "") {
|
|
$id_produk = NULL;
|
|
}
|
|
|
|
$data = $this->Amod->getData_Kuantiti_byGUDANG_byJENIS_byMERK_byPRODUK($gudang, $id_jenis, $id_merk, $id_produk, $kode_barang);
|
|
|
|
$this->output_json([
|
|
'data' => $data,
|
|
]);
|
|
}
|
|
|
|
public function SB_Ambil_Sub2_DataPembukuanStokSupplier() {
|
|
$id_supplier = $this->input->post('id_supplier');
|
|
$id_merk = $this->input->post('id_merk');
|
|
$id_produk = $this->input->post('id_produk');
|
|
$kode_barang = $this->input->post('kode_barang');
|
|
|
|
if ($id_supplier == "") {
|
|
$id_supplier = NULL;
|
|
}
|
|
|
|
if ($id_merk == "") {
|
|
$id_merk = NULL;
|
|
}
|
|
|
|
if ($id_produk == "") {
|
|
$id_produk = NULL;
|
|
}
|
|
|
|
$data = $this->Amod->getData_SnStock_bySUPPLIER_byMERK_byPRODUK_forStokSupplier($id_supplier, $id_merk, $id_produk, $kode_barang);
|
|
|
|
$this->output_json([
|
|
'data' => $data,
|
|
]);
|
|
}
|
|
|
|
public function SB_Excel_Sub2_DataPembukuanKeluarMasuk() {
|
|
$awal = $this->input->post('tgl_awalfill');
|
|
$akhir = $this->input->post('tgl_akhirfill');
|
|
$id_barang = $this->input->post('id_barangfill');
|
|
$id_jio = $this->input->post('id_jiofill');
|
|
$transaksi = $this->input->post('transaksifill');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
if ($id_barang == "") {
|
|
$id_barang = NULL;
|
|
}
|
|
|
|
if ($id_jio == "") {
|
|
$id_jio = NULL;
|
|
}
|
|
|
|
if ($transaksi == "") {
|
|
$transaksi = NULL;
|
|
}
|
|
|
|
$pilih_tabel = array('No', 'Tanggal', 'Transaksi', 'Kode Bukti', 'Alasan', 'Gudang', 'Kode Barang', 'Nama Barang', 'Kuantiti', 'Nilai DPP', 'Keterangan');
|
|
|
|
$data = $this->Amod->getData_TransaksiStock_byBARANG_byJIO_byJENIS_byPERIODE_status1($id_barang, $id_jio, $transaksi, $awal, $akhir);
|
|
|
|
$hasil[0] = $data;
|
|
|
|
$data = [
|
|
'awal_nota' => date_format(date_create($awal), "d/m/Y"),
|
|
'akhir_nota' => date_format(date_create($akhir), "d/m/Y"),
|
|
'jumlah_kolom' => count($pilih_tabel),
|
|
'nama_tabel' => $pilih_tabel,
|
|
'hasil' => $hasil,
|
|
'ts' => $timestamp
|
|
];
|
|
$this->load->view('cetak/SB_Excel_Sub2_DataPembukuanKeluarMasuk', $data);
|
|
}
|
|
|
|
public function SB_Excel_Sub2_DataPembukuanKuantitiPricelist() {
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$pilih_tabel = array('INDEX', 'KODE', 'NAMA', 'PCM', 'ITP', 'TOTAL', 'STATUS');
|
|
|
|
$data = $this->Amod->getData_Kuantiti_forPricelist();
|
|
|
|
$hasil[0] = $data;
|
|
|
|
$data = [
|
|
'jumlah_kolom' => count($pilih_tabel),
|
|
'nama_tabel' => $pilih_tabel,
|
|
'hasil' => $hasil,
|
|
'ts' => $timestamp
|
|
];
|
|
$this->load->view('cetak/SB_Excel_Sub2_DataPembukuanKuantitiPricelist', $data);
|
|
}
|
|
|
|
public function SB_Excel_Sub2_DataPembukuanPersediaan() {
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$pilih_tabel = array('No', 'JENIS', 'KODE', 'NAMA', 'KUANTITI', 'SATUAN', 'SUBTOTAL');
|
|
|
|
$data = [];
|
|
$no = 0;
|
|
$total = 0;
|
|
$datJenis = $this->Amod->getData_JenisKecuali();
|
|
foreach ($datJenis as $key) {
|
|
$datKuantiti = $this->Amod->getData_Kuantiti_byJENISID_more0($key['ID_JENIS']);
|
|
foreach ($datKuantiti as $dat) {
|
|
$datHq = $this->Amod->getData_HistoriKuantiti_byBARANG_orderDESC_limit1($dat['ID_KUANTITI']);
|
|
$satuan = round(1.11*$datHq[0]['AVG_HQ'], 2);
|
|
$subtotal = round(1.11*$datHq[0]['PERSEDIAAN_HQ'], 2);
|
|
$data[$no++] = [
|
|
'JENIS' => $key['NAMA_JENIS'],
|
|
'KODE' => $dat['KODE_BARANG'],
|
|
'NAMA' => $dat['NAMA_BARANG'],
|
|
'KUANTITI' => $dat['GLOBAL_KUANTITI'],
|
|
'SATUAN' => number_format($satuan, 2),
|
|
'SUBTOTAL' => number_format($subtotal, 2),
|
|
];
|
|
|
|
$total = $total+$subtotal;
|
|
}
|
|
}
|
|
|
|
$hasil[0] = $data;
|
|
|
|
$data = [
|
|
'jumlah_kolom' => count($pilih_tabel),
|
|
'nama_tabel' => $pilih_tabel,
|
|
'hasil' => $hasil,
|
|
'ts' => $timestamp,
|
|
'totalPersediaan' => number_format($total, 2),
|
|
];
|
|
$this->load->view('cetak/SB_Excel_Sub2_DataPembukuanPersediaan', $data);
|
|
}
|
|
|
|
public function SB_Excel_Sub2_DataPembukuanPosisiStok() {
|
|
$gudang = $this->input->post('gudangfill');
|
|
$id_jenis = $this->input->post('id_jenisfill');
|
|
$id_merk = $this->input->post('id_merkfill');
|
|
$id_produk = $this->input->post('id_produkfill');
|
|
$laporan = $this->input->post('laporanfill');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
if ($id_jenis == "") {
|
|
$id_jenis = NULL;
|
|
}
|
|
|
|
if ($id_merk == "") {
|
|
$id_merk = NULL;
|
|
}
|
|
|
|
if ($id_produk == "") {
|
|
$id_produk = NULL;
|
|
}
|
|
|
|
if ($gudang==1) {
|
|
$namaGudang = "ANTIK";
|
|
} else if ($gudang==2) {
|
|
$namaGudang = "GLOBAL";
|
|
} else if ($gudang==3) {
|
|
$namaGudang = "ITP";
|
|
} else if ($gudang==4) {
|
|
$namaGudang = "KONSINYASI";
|
|
} else if ($gudang==5) {
|
|
$namaGudang = "PCM";
|
|
} else if ($gudang==6) {
|
|
$namaGudang = "PEMINJAMAN";
|
|
} else if ($gudang==7) {
|
|
$namaGudang = "PENDING";
|
|
} else if ($gudang==8) {
|
|
$namaGudang = "PROYEK";
|
|
} else if ($gudang==9) {
|
|
$namaGudang = "SERVICE";
|
|
} else if ($gudang==10) {
|
|
$namaGudang = "SEWA";
|
|
}
|
|
|
|
if ($laporan==0) {
|
|
$judul = "Posisi Stok Non SN";
|
|
$pilih_tabel = array('No', 'Jenis', 'Kode Barang', 'Nama Barang', 'Kuantiti');
|
|
$data = $this->Amod->getData_Kuantiti_byGUDANG_byJENIS_byMERK_byPRODUK($gudang, $id_jenis, $id_merk, $id_produk);
|
|
} else if ($laporan==1) {
|
|
$judul = "Posisi Stok Dengan SN";
|
|
$pilih_tabel = array('No', 'Kode Barang', 'Nama Barang', 'Kuantiti', 'Serial Number');
|
|
$data = $this->Amod->getData_Kuantiti_byGUDANG_byJENIS_byMERK_byPRODUK($gudang, $id_jenis, $id_merk, $id_produk);
|
|
$dataSn = [];
|
|
|
|
$no = 0;
|
|
if ($gudang!=7) {
|
|
foreach ($data as $key) {
|
|
$datSnStock = $this->Amod->getData_StokKuantitiSn($key['ID_KUANTITI'], $gudang);
|
|
$countBarang = count($datSnStock);
|
|
foreach ($datSnStock as $dat) {
|
|
$dataSn[$no++] = [
|
|
'NAMA_SNSTOCK' => $dat['NAMA_SNSTOCK'],
|
|
'KODE_BARANG' => $dat['KODE_BARANG'],
|
|
'NAMA_BARANG' => $dat['NAMA_BARANG'],
|
|
'COUNT' => $countBarang
|
|
];
|
|
}
|
|
}
|
|
}
|
|
$data = $dataSn;
|
|
}
|
|
|
|
$hasil[0] = $data;
|
|
|
|
$data = [
|
|
'judul' => $judul,
|
|
'namaGudang' => $namaGudang,
|
|
'jumlah_kolom' => count($pilih_tabel),
|
|
'nama_tabel' => $pilih_tabel,
|
|
'hasil' => $hasil,
|
|
'ts' => $timestamp,
|
|
'laporan' => $laporan
|
|
];
|
|
$this->load->view('cetak/SB_Excel_Sub2_DataPembukuanPosisiStok', $data);
|
|
}
|
|
|
|
public function SB_Excel_Sub2_DataPembukuanStokOpname() {
|
|
$gudang = $this->input->post('gudangfill');
|
|
$id_jenis = $this->input->post('id_jenisfill');
|
|
$id_merk = $this->input->post('id_merkfill');
|
|
$id_produk = $this->input->post('id_produkfill');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
if ($id_jenis == "") {
|
|
$id_jenis = NULL;
|
|
}
|
|
|
|
if ($id_merk == "") {
|
|
$id_merk = NULL;
|
|
}
|
|
|
|
if ($id_produk == "") {
|
|
$id_produk = NULL;
|
|
}
|
|
|
|
if ($gudang==1) {
|
|
$namaGudang = "GLOBAL";
|
|
$jenisGudang = 2;
|
|
} else if ($gudang==2) {
|
|
$namaGudang = "ITP";
|
|
$jenisGudang = 3;
|
|
} else if ($gudang==3) {
|
|
$namaGudang = "PCM";
|
|
$jenisGudang = 5;
|
|
}
|
|
|
|
$pilih_tabel = array('No', 'Jenis', 'Kode Barang', 'Nama Barang', 'Kuantiti');
|
|
$data = $this->Amod->getData_Kuantiti_byGUDANG_byJENIS_byMERK_byPRODUK($jenisGudang, $id_jenis, $id_merk, $id_produk);
|
|
$judul = "Stok Opname";
|
|
$hasil[0] = $data;
|
|
|
|
$data = [
|
|
'judul' => $judul,
|
|
'namaGudang' => $namaGudang,
|
|
'jumlah_kolom' => count($pilih_tabel),
|
|
'nama_tabel' => $pilih_tabel,
|
|
'hasil' => $hasil,
|
|
'ts' => $timestamp,
|
|
];
|
|
$this->load->view('cetak/SB_Excel_Sub2_DataPembukuanStokOpname', $data);
|
|
}
|
|
|
|
public function SB_Excel_Sub2_DataPembukuanStokSupplier() {
|
|
$id_supplier = $this->input->post('id_supplierfill');
|
|
$id_merk = $this->input->post('id_merkfill');
|
|
$id_produk = $this->input->post('id_produkfill');
|
|
$laporan = $this->input->post('laporanfill');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$datSupplier = $this->Amod->getData_Supplier_byID($id_supplier);
|
|
|
|
if ($id_merk == "") {
|
|
$id_merk = NULL;
|
|
}
|
|
|
|
if ($id_produk == "") {
|
|
$id_produk = NULL;
|
|
}
|
|
|
|
if ($laporan==0) {
|
|
$judul = "Stok Supplier Non SN";
|
|
$pilih_tabel = array('No', 'Merk', 'Kode Barang', 'Nama Barang', 'Kuantiti');
|
|
$data = $this->Amod->getData_SnStock_bySUPPLIER_byMERK_byPRODUK_forStokSupplier($id_supplier, $id_merk, $id_produk);
|
|
} else if ($laporan==1) {
|
|
$judul = "Stok Supplier Dengan SN";
|
|
$pilih_tabel = array('No', 'Kode Barang', 'Nama Barang', 'Kuantiti', 'Serial Number');
|
|
$data = $this->Amod->getData_SnStock_bySUPPLIER_byMERK_byPRODUK_forStokSupplier($id_supplier, $id_merk, $id_produk);
|
|
$dataSn = [];
|
|
|
|
$no = 0;
|
|
foreach ($data as $key) {
|
|
$datSnStock = $this->Amod->getData_SnStock_byBARANG_bySUPPLIER_byMERK_byPRODUK_Not1_Not2_Not3_Not4($key['ID_BARANG'], $id_supplier, $id_merk, $id_produk);
|
|
$countBarang = count($datSnStock);
|
|
foreach ($datSnStock as $dat) {
|
|
$dataSn[$no++] = [
|
|
'NAMA_SNSTOCK' => $dat['NAMA_SNSTOCK'],
|
|
'KODE_BARANG' => $dat['KODE_BARANG'],
|
|
'NAMA_BARANG' => $dat['NAMA_BARANG'],
|
|
'COUNT' => $countBarang
|
|
];
|
|
}
|
|
}
|
|
$data = $dataSn;
|
|
}
|
|
|
|
$hasil[0] = $data;
|
|
|
|
$data = [
|
|
'judul' => $judul,
|
|
'jumlah_kolom' => count($pilih_tabel),
|
|
'nama_tabel' => $pilih_tabel,
|
|
'hasil' => $hasil,
|
|
'ts' => $timestamp,
|
|
'laporan' => $laporan,
|
|
'nama' => $datSupplier[0]['NAMA_SUPPLIER']
|
|
];
|
|
$this->load->view('cetak/SB_Excel_Sub2_DataPembukuanStokSupplier', $data);
|
|
}
|
|
|
|
// Daftar Menu IN [Informasi]
|
|
// SUBMENU - Informasi Penjualan
|
|
public function IN_Penjualan_Pricelist_1($id) {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "PJ", "PUSAT DATA - Informasi");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$datStti = $this->Amod->getData_SetTimitp_byKARYAWAN($id_karyawan);
|
|
if ($datStti==TRUE) {
|
|
$spesial = 1;
|
|
} else {
|
|
$spesial = 0;
|
|
}
|
|
|
|
$datStpl = $this->Amod->getData_SetPricelist_byKARYAWAN($id_karyawan);
|
|
$datPricelist = $this->Amod->getData_Pricelist_orderNAMA();
|
|
$dataPricelist = $this->Amod->getData_Pricelist_byID($id);
|
|
$aktif = [];
|
|
if ($dataPricelist==FALSE) {
|
|
$id = $datPricelist[0]['ID_PRICELIST'];
|
|
$datSmpl = $this->Amod->getData_SubmenuPricelist_byPRICELIST_orderURUTAN($id);
|
|
$dataPricelist = $this->Amod->getData_Pricelist_byID($id);
|
|
} else {
|
|
$datSmpl = $this->Amod->getData_SubmenuPricelist_byPRICELIST_orderURUTAN($id);
|
|
}
|
|
|
|
$listKolom = explode(',', $dataPricelist[0]['KOLOM_PRICELIST']);
|
|
for ($i=1; $i<=11; $i++) {
|
|
$j = 0;
|
|
foreach ($listKolom as $key) {
|
|
if ($key==$i) {
|
|
$j++;
|
|
break;
|
|
}
|
|
}
|
|
$aktif[$i] = $j;
|
|
}
|
|
|
|
$update = [
|
|
'TIMESTAMP' => $timestamp,
|
|
'PRICELIST_ID' => $id
|
|
];
|
|
$acton = $this->Amod->update('set_pricelist', $update, 'ID_STPL', $datStpl[0]['ID_STPL']);
|
|
|
|
$data = array(
|
|
'sidebar' => "dashboard",
|
|
'navChild' => "",
|
|
'smpl' => $datSmpl,
|
|
'countSmpl' => count($datSmpl),
|
|
'id_pricelist' => $id,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil,
|
|
'spesial' => $spesial,
|
|
'aktif' => $aktif,
|
|
'pricelist' => $datPricelist,
|
|
'nama_pricelist' => $dataPricelist[0]['NAMA_PRICELIST'],
|
|
'jejak_pricelist' => $dataPricelist[0]['JEJAK_PRICELIST'],
|
|
'submenu_pricelist' => $dataPricelist[0]['SUBMENU_PRICELIST'],
|
|
'terbaru_pricelist' => $dataPricelist[0]['TERBARU_PRICELIST'],
|
|
);
|
|
$this->load->view('proses/IN_Penjualan_Pricelist_1', $data);
|
|
}
|
|
|
|
public function IN_Ambil_KondisiPricelist() {
|
|
$id_pricelist = $this->input->post('id_pricelist');
|
|
$jejak_pricelist = $this->input->post('jejak_pricelist');
|
|
$submenu_pricelist = $this->input->post('submenu_pricelist');
|
|
|
|
$datPricelist = $this->Amod->getData_Pricelist_byID($id_pricelist);
|
|
if ($datPricelist==FALSE) {
|
|
$value = 3;
|
|
$dataPricelist = $this->Amod->getData_Pricelist_orderNAMA_limit1();
|
|
$id_pricelist = $dataPricelist[0]['ID_PRICELIST'];
|
|
|
|
if ($dataPricelist[0]['TERBARU_PRICELIST']==1) {
|
|
$jejak = $dataPricelist[0]['JEJAK_PRICELIST'];
|
|
} else if ($dataPricelist[0]['TERBARU_PRICELIST']==2) {
|
|
$jejak = $dataPricelist[0]['SUBMENU_PRICELIST'];
|
|
}
|
|
} else {
|
|
if ($jejak_pricelist!=$datPricelist[0]['JEJAK_PRICELIST']) {
|
|
$value = 2;
|
|
} else if ($submenu_pricelist!=$datPricelist[0]['SUBMENU_PRICELIST']) {
|
|
$value = 1;
|
|
} else {
|
|
$value = 0;
|
|
}
|
|
|
|
if ($datPricelist[0]['TERBARU_PRICELIST']==1) {
|
|
$jejak = $datPricelist[0]['JEJAK_PRICELIST'];
|
|
} else if ($datPricelist[0]['TERBARU_PRICELIST']==2) {
|
|
$jejak = $datPricelist[0]['SUBMENU_PRICELIST'];
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
'id_pricelist' => $id_pricelist,
|
|
'jejak' => $jejak,
|
|
]);
|
|
}
|
|
|
|
// SUBMENU - Informasi Keuangan
|
|
public function IN_Keuangan_BiayaForm_1() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "KU", "PUSAT DATA - Informasi");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
|
|
$datHhbfe = $this->Amod->getData_HasilHitungBfe_bySTATUS(0);
|
|
$datFk = $this->Amod->getData_FormKaryawan_bySTATUS_jenisLessEqual4_allACC(0);
|
|
$no = 0;
|
|
foreach ($datFk as $key) {
|
|
$datDffk = $this->Amod->getData_DaftarFormKaryawan_byFK($key['ID_FK']);
|
|
$ket_dffk = $datDffk[0]['KET_DFFK'];
|
|
|
|
$datFk[$no++] += ['KET' => $ket_dffk];
|
|
}
|
|
|
|
$data = array(
|
|
'sidebar' => "dashboard",
|
|
'navChild' => "",
|
|
'hak' => $hak,
|
|
'fee' => $datHhbfe,
|
|
'fk' => $datFk,
|
|
'countFee' => count($datHhbfe),
|
|
'countFk' => count($datFk),
|
|
);
|
|
$this->load->view('proses/IN_Keuangan_BiayaForm_1', $data);
|
|
}
|
|
|
|
public function IN_Keuangan_DpPembelian_1() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "KU", "PUSAT DATA - Informasi");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byPERKIRAAN_groupSUPPLIER_belumLunas(7);
|
|
|
|
$data = array(
|
|
'sidebar' => "dashboard",
|
|
'navChild' => "",
|
|
'hak' => $hak,
|
|
'dak' => $datDak,
|
|
'countDak' => count($datDak),
|
|
);
|
|
$this->load->view('proses/IN_Keuangan_DpPembelian_1', $data);
|
|
}
|
|
|
|
public function IN_Keuangan_DpPembelian_2($id) {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "KU", "PUSAT DATA - Informasi");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byMAINDPB($id);
|
|
$datAkuntansi = $this->Amod->getData_DaftarAkuntansi_byID($id);
|
|
|
|
$data = array(
|
|
'sidebar' => "dashboard",
|
|
'navChild' => "",
|
|
'hak' => $hak,
|
|
'dak' => $datDak,
|
|
'kode_akuntansi' => $datAkuntansi[0]['KODE_AKUNTANSI'],
|
|
);
|
|
$this->load->view('proses/IN_Keuangan_DpPembelian_2', $data);
|
|
}
|
|
|
|
public function IN_Keuangan_DpPenjualan_1() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "KU", "PUSAT DATA - Informasi");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byPERKIRAAN_groupPELANGGAN_belumLunas(19);
|
|
|
|
$data = array(
|
|
'sidebar' => "dashboard",
|
|
'navChild' => "",
|
|
'hak' => $hak,
|
|
'dak' => $datDak,
|
|
'countDak' => count($datDak),
|
|
);
|
|
$this->load->view('proses/IN_Keuangan_DpPenjualan_1', $data);
|
|
}
|
|
|
|
public function IN_Keuangan_DpPenjualan_2($id) {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "KU", "PUSAT DATA - Informasi");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byUM($id);
|
|
$datAkuntansi = $this->Amod->getData_DaftarAkuntansi_byID($id);
|
|
|
|
$data = array(
|
|
'sidebar' => "dashboard",
|
|
'navChild' => "",
|
|
'hak' => $hak,
|
|
'dak' => $datDak,
|
|
'kode_akuntansi' => $datAkuntansi[0]['KODE_AKUNTANSI'],
|
|
);
|
|
$this->load->view('proses/IN_Keuangan_DpPenjualan_2', $data);
|
|
}
|
|
|
|
public function IN_Keuangan_HutangDagang_1() {
|
|
$now = date('Y-m-d');
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "KU", "PUSAT DATA - Informasi");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
|
|
$datDak = $this->Amod->getData_HasilHitungHda_groupSUPPLIER_belumLunasOnly();
|
|
$no = 0;
|
|
foreach ($datDak as $key) {
|
|
$datHda = $this->Amod->getSum_HasilHitungHda_bySUPPLIER_byTEMPO_forHutangDagang($key['SID'], $now);
|
|
$datDak[$no++] += ['HDA' => $datHda];
|
|
}
|
|
|
|
$data = array(
|
|
'sidebar' => "dashboard",
|
|
'navChild' => "",
|
|
'dak' => $datDak,
|
|
'countDak' => count($datDak),
|
|
'hak' => $hak,
|
|
);
|
|
$this->load->view('proses/IN_Keuangan_HutangDagang_1', $data);
|
|
}
|
|
|
|
public function IN_Keuangan_HutangDagang_2($id) {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "KU", "PUSAT DATA - Informasi");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byPERKIRAAN_byPEMBELIAN(15, $id);
|
|
$datPembelian = $this->Amod->getData_Pembelian_byID($id);
|
|
|
|
$data = array(
|
|
'sidebar' => "dashboard",
|
|
'navChild' => "",
|
|
'hak' => $hak,
|
|
'dak' => $datDak,
|
|
'inv_pembelian' => $datPembelian[0]['INV_PEMBELIAN'],
|
|
);
|
|
$this->load->view('proses/IN_Keuangan_HutangDagang_2', $data);
|
|
}
|
|
|
|
public function IN_Keuangan_PiutangDagang_1() {
|
|
$id_kelompok = $this->input->post('id_kelompok');
|
|
$now = date('Y-m-d');
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "KU", "PUSAT DATA - Informasi");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$id_menu = $datShm[0]['MENU_ID'];
|
|
|
|
if ($id_kelompok=="") {
|
|
$title = "Tanpa Filter";
|
|
} else {
|
|
$dataKelompok = $this->Amod->getData_Kelompok_byID($id_kelompok);
|
|
$nama_kelompok = $dataKelompok[0]['NAMA_KELOMPOK'];
|
|
$title = "$nama_kelompok";
|
|
}
|
|
|
|
$datHhpda = $this->Amod->getData_HasilHitungPda_byKELOMPOK_groupPELANGGAN_belumLunasOnly($id_kelompok);
|
|
$no = 0;
|
|
foreach ($datHhpda as $key) {
|
|
$datPda = $this->Amod->getSum_HasilHitungPda_byPELANGGAN_byTEMPO_forPiutangDagang($key['PELANGGAN_ID'], $now);
|
|
$datHhpda[$no++] += ['PDA' => $datPda];
|
|
}
|
|
|
|
$datKelompok = $this->Amod->getData_Kelompok_bySTATUS(1);
|
|
|
|
$datStpos = $this->Amod->getData_SetTogglePosisi_byKARYAWAN_byMENU($id_karyawan, $id_menu);
|
|
if ($datStpos==FALSE) { $posisiToggle = 0; } else { $posisiToggle = $datStpos[0]['AKTIF_STPOS']; }
|
|
|
|
$data = array(
|
|
'sidebar' => "dashboard",
|
|
'navChild' => "",
|
|
'hak' => $hak,
|
|
'id_menu' => $id_menu,
|
|
'posisiToggle' => $posisiToggle,
|
|
'kelompok' => $datKelompok,
|
|
'id_kelompok' => $id_kelompok,
|
|
'title' => $title,
|
|
'dak' => $datHhpda,
|
|
'countDak' => count($datHhpda),
|
|
);
|
|
$this->load->view('proses/IN_Keuangan_PiutangDagang_1', $data);
|
|
}
|
|
|
|
public function IN_Keuangan_PiutangDagang_2($id) {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "KU", "PUSAT DATA - Informasi");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byPERKIRAAN_byPENJUALAN(3, $id);
|
|
$datPenjualan = $this->Amod->getData_Penjualan_byID($id);
|
|
|
|
$data = array(
|
|
'sidebar' => "dashboard",
|
|
'navChild' => "",
|
|
'hak' => $hak,
|
|
'dak' => $datDak,
|
|
'inv_penjualan' => $datPenjualan[0]['INV_PENJUALAN'],
|
|
);
|
|
$this->load->view('proses/IN_Keuangan_PiutangDagang_2', $data);
|
|
}
|
|
|
|
public function IN_Keuangan_PiutangKaryawan_1() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "KU", "PUSAT DATA - Informasi");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byPERKIRAAN_groupKARYAWAN_belumLunas(5);
|
|
|
|
$data = array(
|
|
'sidebar' => "dashboard",
|
|
'navChild' => "",
|
|
'hak' => $hak,
|
|
'dak' => $datDak,
|
|
'countDak' => count($datDak),
|
|
);
|
|
$this->load->view('proses/IN_Keuangan_PiutangKaryawan_1', $data);
|
|
}
|
|
|
|
public function IN_Keuangan_PiutangPihakke3_1() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "KU", "PUSAT DATA - Informasi");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
|
|
$datDak = $this->Amod->getData_DaftarAkuntansi_byPERKIRAAN_groupPIHAKKE3_belumLunas(6);
|
|
|
|
$data = array(
|
|
'sidebar' => "dashboard",
|
|
'navChild' => "",
|
|
'hak' => $hak,
|
|
'dak' => $datDak,
|
|
'countDak' => count($datDak),
|
|
);
|
|
$this->load->view('proses/IN_Keuangan_PiutangPihakke3_1', $data);
|
|
}
|
|
|
|
// SUBMENU - Informasi Stok Barang
|
|
public function IN_StokBarang_StokGudang_1() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "SB", "PUSAT DATA - Informasi");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$datSsg = $this->Amod->getData_SetStokGudang_byKARYAWAN($id_karyawan);
|
|
if ($datSsg==FALSE) {
|
|
$kondisi_ssg = 2;
|
|
$gudang_ssg = 0;
|
|
$cari_ssg = 2;
|
|
$jenis_ssg = NULL;
|
|
$merk_ssg = NULL;
|
|
$urutan_ssg = 1;
|
|
|
|
$input = [
|
|
'KARYAWAN_ID' => $id_karyawan,
|
|
'KONDISI_SSG' => $kondisi_ssg,
|
|
'GUDANG_SSG' => $gudang_ssg,
|
|
'CARI_SSG' => $cari_ssg,
|
|
'JENIS_SSG' => $jenis_ssg,
|
|
'MERK_SSG' => $merk_ssg,
|
|
'URUTAN_SSG' => $urutan_ssg,
|
|
'LAST_SSG' => $timestamp
|
|
];
|
|
$action = $this->Amod->create('set_stokgudang', $input);
|
|
} else {
|
|
$kondisi_ssg = $datSsg[0]['KONDISI_SSG'];
|
|
$gudang_ssg = $datSsg[0]['GUDANG_SSG'];
|
|
$cari_ssg = $datSsg[0]['CARI_SSG'];
|
|
$jenis_ssg = $datSsg[0]['JENIS_SSG'];
|
|
$merk_ssg = $datSsg[0]['MERK_SSG'];
|
|
$urutan_ssg = $datSsg[0]['URUTAN_SSG'];
|
|
}
|
|
|
|
$datJenis = $this->Amod->getData_Jenis_bySTATUS(1);
|
|
$datMerk = $this->Amod->getData_Merk_bySTATUS(1);
|
|
|
|
$data = array(
|
|
'sidebar' => "dashboard",
|
|
'navChild' => "",
|
|
'hak' => $hak,
|
|
'tampil' => $tampil,
|
|
'filter1' => $kondisi_ssg,
|
|
'filter2' => $gudang_ssg,
|
|
'filter3' => $cari_ssg,
|
|
'filter4' => $jenis_ssg,
|
|
'filter5' => $merk_ssg,
|
|
'filter6' => $urutan_ssg,
|
|
'ts' => $timestamp,
|
|
'jenis' => $datJenis,
|
|
'merk' => $datMerk,
|
|
);
|
|
$this->load->view('proses/IN_StokBarang_StokGudang_1', $data);
|
|
}
|
|
|
|
public function IN_StokBarang_StokGudang_2($barang, $gudang) {
|
|
$datDb = $this->Amod->getData_DaftarBeli_byBARANG_byGUDANG_bySTATUS($barang, $gudang, 1);
|
|
$datDmb = $this->Amod->getData_DaftarMutasiBarang_byBARANG_byGUDANG_statusMore1($barang, $gudang);
|
|
$datIo = $this->Amod->getData_TransaksiStock_byBARANG_byGUDANG_bySTATUS($barang, $gudang, 1);
|
|
$datDo = $this->Amod->getData_DaftarOrder_byBARANG_byGUDANG_bySTATUS($barang, $gudang, 1);
|
|
$datDfk = $this->Amod->getData_DaftarKonsi_byBARANG_byJENIS_statusMore1($barang, $gudang);
|
|
$datDfp = $this->Amod->getData_DaftarPinjam_byBARANG_byGUDANG_bySTATUS($barang, $gudang, 1);
|
|
|
|
$datBarang = $this->Amod->getData_Barang_byID($barang);
|
|
|
|
if ($gudang==1) {
|
|
$namaGudang = "PC MASTER";
|
|
} else if ($gudang==2) {
|
|
$namaGudang = "IT POINT";
|
|
} else if ($gudang==3) {
|
|
$namaGudang = "SERVICE";
|
|
}
|
|
|
|
$data = array(
|
|
'sidebar' => "dashboard",
|
|
'navChild' => "",
|
|
'kode_barang' => $datBarang[0]['KODE_BARANG'],
|
|
'namaGudang' => $namaGudang,
|
|
'db' => $datDb,
|
|
'dfk' => $datDfk,
|
|
'dfp' => $datDfp,
|
|
'dmb' => $datDmb,
|
|
'do' => $datDo,
|
|
'io' => $datIo,
|
|
'gudang' => $gudang,
|
|
);
|
|
$this->load->view('proses/IN_StokBarang_StokGudang_2', $data);
|
|
}
|
|
|
|
public function IN_Ambil_JumlahHistoriKuantiti() {
|
|
$countHq = $this->input->post('countHq');
|
|
|
|
$newHq = $this->Amod->getCount_HistoriKuantiti();
|
|
|
|
if ($countHq!=$newHq) {
|
|
$value = 1;
|
|
} else {
|
|
$value = 0;
|
|
}
|
|
|
|
$this->output_json(['value' => $value]);
|
|
}
|
|
|
|
public function IN_StokBarang_Konsinyasi_1() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "IN", "STOK BARANG - Konsinyasi");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
|
|
$datKonsinyasi1 = $this->Amod->getData_Konsinyasi_bySTATUS_byJENIS(1, 1);
|
|
$no = 0;
|
|
foreach ($datKonsinyasi1 as $key) {
|
|
$datDfk = $this->Amod->getData_DaftarKonsi_byKONSINYASI($key['ID_KONSINYASI']);
|
|
$noko = 0;
|
|
$sn = "";
|
|
foreach ($datDfk as $dat) {
|
|
$datSnk = $this->Amod->getData_SnKonsi_byDFK_statusNull($dat['ID_DFK']);
|
|
foreach ($datSnk as $dit) {
|
|
$nama_snk = $dit['NAMA_SNK'];
|
|
$sn .= "$nama_snk, ";
|
|
}
|
|
$datDfk[$noko++] += ['SN' => $sn];
|
|
$sn = "";
|
|
}
|
|
$datKonsinyasi1[$no++] += ['BARANG' => $datDfk];
|
|
}
|
|
|
|
$datKonsinyasi2 = $this->Amod->getData_Konsinyasi_bySTATUS_byJENIS(1, 2);
|
|
$no = 0;
|
|
foreach ($datKonsinyasi2 as $key) {
|
|
$datDfk = $this->Amod->getData_DaftarKonsi_byKONSINYASI($key['ID_KONSINYASI']);
|
|
$noko = 0;
|
|
$sn = "";
|
|
foreach ($datDfk as $dat) {
|
|
$datSnk = $this->Amod->getData_SnKonsi_byDFK_statusNull($dat['ID_DFK']);
|
|
foreach ($datSnk as $dit) {
|
|
$nama_snk = $dit['NAMA_SNK'];
|
|
$sn .= "$nama_snk, ";
|
|
}
|
|
$datDfk[$noko++] += ['SN' => $sn];
|
|
$sn = "";
|
|
}
|
|
$datKonsinyasi2[$no++] += ['BARANG' => $datDfk];
|
|
}
|
|
|
|
$data = array(
|
|
'sidebar' => "dashboard",
|
|
'navChild' => "",
|
|
'hak' => $hak,
|
|
'konsinyasi1' => $datKonsinyasi1,
|
|
'konsinyasi2' => $datKonsinyasi2,
|
|
'count1' => count($datKonsinyasi1),
|
|
'count2' => count($datKonsinyasi2),
|
|
);
|
|
$this->load->view('proses/IN_StokBarang_Konsinyasi_1', $data);
|
|
}
|
|
|
|
public function IN_StokBarang_Operasional_1() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "SB", "PUSAT DATA - Informasi");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
|
|
$datOperasional = $this->Amod->getData_TransaksiStock_byJIO_groupKODE(4);
|
|
$no = 0;
|
|
foreach ($datOperasional as $key) {
|
|
$datIo = $this->Amod->getData_TransaksiStock_byKODEBUKTI($key['KODE_BUKTI']);
|
|
$noio = 0;
|
|
foreach ($datIo as $dat) {
|
|
$datSnio = $this->Amod->getData_SnIo_byIO($dat['ID_IO']);
|
|
$sn = "";
|
|
foreach ($datSnio as $duar) {
|
|
$nama_snio = $duar['NAMA_SNIO'];
|
|
$sn .= "$nama_snio, ";
|
|
}
|
|
|
|
$datIo[$noio++] += ['SN' => $sn];
|
|
}
|
|
|
|
$datOperasional[$no++] += ['BARANG' => $datIo];
|
|
}
|
|
|
|
$data = array(
|
|
'sidebar' => "dashboard",
|
|
'navChild' => "",
|
|
'hak' => $hak,
|
|
'operasional' => $datOperasional,
|
|
'countOperasional' => count($datOperasional),
|
|
);
|
|
$this->load->view('proses/IN_StokBarang_Operasional_1', $data);
|
|
}
|
|
|
|
public function IN_StokBarang_Peminjaman_1() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "SB", "PUSAT DATA - Informasi");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
|
|
$datPeminjaman1 = $this->Amod->getData_Peminjaman_byJENIS_bySTATUS(1,1);
|
|
$no = 0;
|
|
foreach ($datPeminjaman1 as $key) {
|
|
$datDfp = $this->Amod->getData_DaftarPinjam_byPEMINJAMAN($key['ID_PEMINJAMAN']);
|
|
$nopin = 0;
|
|
$sn = "";
|
|
foreach ($datDfp as $dat) {
|
|
$datSnp = $this->Amod->getData_SnPinjam_byDFP($dat['ID_DFP']);
|
|
foreach ($datSnp as $dat) {
|
|
$nama_snp = $dat['NAMA_SNP'];
|
|
$sn .= "$nama_snp, ";
|
|
}
|
|
$datDfp[$nopin++] += ['SN' => $sn];
|
|
$sn = "";
|
|
}
|
|
$datPeminjaman1[$no++] += ['BARANG' => $datDfp];
|
|
}
|
|
|
|
$datPeminjaman2 = $this->Amod->getData_Peminjaman_byJENIS_bySTATUS(2,1);
|
|
$no = 0;
|
|
foreach ($datPeminjaman2 as $key) {
|
|
$datDfp = $this->Amod->getData_DaftarPinjam_byPEMINJAMAN($key['ID_PEMINJAMAN']);
|
|
$nopin = 0;
|
|
$sn = "";
|
|
foreach ($datDfp as $dat) {
|
|
$datSnp = $this->Amod->getData_SnPinjam_byDFP($dat['ID_DFP']);
|
|
foreach ($datSnp as $dat) {
|
|
$nama_snp = $dat['NAMA_SNP'];
|
|
$sn .= "$nama_snp, ";
|
|
}
|
|
$datDfp[$nopin++] += ['SN' => $sn];
|
|
$sn = "";
|
|
}
|
|
$datPeminjaman2[$no++] += ['BARANG' => $datDfp];
|
|
}
|
|
|
|
$data = array(
|
|
'sidebar' => "dashboard",
|
|
'navChild' => "",
|
|
'hak' => $hak,
|
|
'peminjaman1' => $datPeminjaman1,
|
|
'peminjaman2' => $datPeminjaman2,
|
|
'count1' => count($datPeminjaman1),
|
|
'count2' => count($datPeminjaman2),
|
|
);
|
|
$this->load->view('proses/IN_StokBarang_Peminjaman_1', $data);
|
|
}
|
|
|
|
public function IN_StokBarang_Pending_1() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "SB", "PUSAT DATA - Informasi");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
|
|
$datPending1 = $this->Amod->getData_Pending_byJENIS_bySTATUS(1,0);
|
|
$datPending2 = $this->Amod->getData_Pending_byJENIS_bySTATUS(2,0);
|
|
|
|
$data = array(
|
|
'sidebar' => "dashboard",
|
|
'navChild' => "",
|
|
'hak' => $hak,
|
|
'pending1' => $datPending1,
|
|
'pending2' => $datPending2,
|
|
'count1' => count($datPending1),
|
|
'count2' => count($datPending2),
|
|
);
|
|
$this->load->view('proses/IN_StokBarang_Pending_1', $data);
|
|
}
|
|
|
|
public function IN_StokBarang_Sewa_1() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "SB", "PUSAT DATA - Informasi");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
|
|
$datSewa = $this->Amod->getData_Sewa_bySTATUS(1);
|
|
$no = 0;
|
|
foreach ($datSewa as $key) {
|
|
$datDfsw = $this->Amod->getData_DaftarSewa_bySEWA($key['ID_SEWA']);
|
|
$nose = 0;
|
|
$sn = "";
|
|
foreach ($datDfsw as $dat) {
|
|
$datSnsw = $this->Amod->getData_SnSewa_byDFSW_statusNull($dat['ID_DFSW']);
|
|
foreach ($datSnsw as $dit) {
|
|
$nama_snsw = $dit['NAMA_SNSW'];
|
|
$sn .= "$nama_snsw, ";
|
|
}
|
|
$datDfsw[$nose++] += ['SN' => $sn];
|
|
$sn = "";
|
|
}
|
|
$datSewa[$no++] += ['BARANG' => $datDfsw];
|
|
}
|
|
|
|
$data = array(
|
|
'sidebar' => "dashboard",
|
|
'navChild' => "",
|
|
'hak' => $hak,
|
|
'sewa' => $datSewa,
|
|
'countSewa' => count($datSewa),
|
|
);
|
|
$this->load->view('proses/IN_StokBarang_Sewa_1', $data);
|
|
}
|
|
|
|
public function IN_StokBarang_StokAntik_1() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "SB", "PUSAT DATA - Informasi");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
|
|
$datSa = $this->Amod->getSum_StokAntik_byJENIS_bySTATUS_groupBARANG(1, 1);
|
|
$no = 0;
|
|
$countSa = 0;
|
|
foreach ($datSa as $key) {
|
|
$sn = "";
|
|
$potonganSa = $this->Amod->getSum_StokAntik_byBARANG_byJENIS_bySTATUS_groupBARANG($key['BARANG_ID'], 0, 1);
|
|
if ($potonganSa==FALSE OR $potonganSa[0]['TOTAL']==NULL) {
|
|
$pot = 0;
|
|
} else {
|
|
$pot = $potonganSa[0]['TOTAL'];
|
|
}
|
|
|
|
$sisa = $key['TOTAL']-$pot;
|
|
if ($sisa>0) {
|
|
$countSa++;
|
|
}
|
|
|
|
$datSnStock = $this->Amod->getData_SnStock_byBARANG_bySTATUS($key['BARANG_ID'], 19);
|
|
foreach ($datSnStock as $dat) {
|
|
$nama_snstock = $dat['NAMA_SNSTOCK'];
|
|
$sn .= "$nama_snstock, ";
|
|
}
|
|
$datSa[$no] += ['SN' => $sn];
|
|
$datSa[$no++] += ['SISA' => $sisa];
|
|
}
|
|
|
|
$data = array(
|
|
'sidebar' => "dashboard",
|
|
'navChild' => "",
|
|
'hak' => $hak,
|
|
'sa' => $datSa,
|
|
'countSa' => $countSa,
|
|
);
|
|
$this->load->view('proses/IN_StokBarang_StokAntik_1', $data);
|
|
}
|
|
|
|
//Menu KPI
|
|
//SUBMENU KONFIGURASI - TARGET SALES
|
|
public function KP_Konfigurasi_TargetSales_1() { // Validasi
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "KP", "KONFIGURASI - Target Sales");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$datSales = $this->Amod->getData_Karyawan_byDIVISI_teamLeaderOnly(1);
|
|
$datPum = $this->Amod->getData_PeriodeUmum_byJENIS_orderDESC(2);
|
|
$cekPum = $this->Amod->getData_PeriodeUmum_byJENIS_byTGL(2, date('Y-m-d'));
|
|
if ($cekPum==FALSE) {
|
|
$id_pum = 0;
|
|
} else {
|
|
$id_pum = $cekPum[0]['ID_PUM'];
|
|
}
|
|
|
|
$data = array(
|
|
'sidebar' => "menu kpi",
|
|
'navChild' => "kpi targetsales",
|
|
'hak' => $hak,
|
|
'tampil' => $tampil,
|
|
'sales' => $datSales,
|
|
'pum' => $datPum,
|
|
'id_karyawan' => $id_karyawan,
|
|
'id_pum' => $id_pum,
|
|
);
|
|
$this->load->view('proses/KP_Konfigurasi_TargetSales_1', $data);
|
|
}
|
|
|
|
public function KP_Hapus_DataDaftarKpi() { // Validasi
|
|
$id_dkpi = $this->input->post('id_dkpi');
|
|
$id_pum = $this->input->post('id_pum');
|
|
|
|
$value = 0;
|
|
$cekPum = $this->Amod->getData_PeriodeUmum_byJENIS_byTGL(2, date('Y-m-d'));
|
|
if ($cekPum==FALSE OR $cekPum[0]['ID_PUM']!=$id_pum) {
|
|
$value = 3;
|
|
} else {
|
|
$cekDkpi = $this->Amod->getData_DaftarKpi_byID($id_dkpi);
|
|
if ($cekDkpi==FALSE) {
|
|
$value = 2;
|
|
} else {
|
|
$action = $this->Amod->delete('daftar_kpi', $id_dkpi, 'ID_DKPI');
|
|
$value = 1;
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value
|
|
]);
|
|
}
|
|
|
|
public function KP_Tambah_DataDaftarKpi() { // Validasi
|
|
$id_kpi = $this->input->post('id_kpi');
|
|
$target_dkpi = $this->input->post('target_dkpi');
|
|
$bobot_dkpi = $this->input->post('bobot_dkpi');
|
|
$id_karyawan = $this->input->post('id_karyawan');
|
|
$id_pum = $this->input->post('id_pum');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$value = 0;
|
|
$cekDkpi = $this->Amod->getData_DaftarKpi_byKPI_byPUM_byKARYAWAN($id_kpi, $id_pum, $id_karyawan);
|
|
if ($cekDkpi==TRUE) {
|
|
$value = 3;
|
|
} else {
|
|
$sumDkpi = $this->Amod->getSum_DaftarKpi_byKARYAWAN_byPUM($id_karyawan, $id_pum);
|
|
if ($sumDkpi==FALSE OR $sumDkpi[0]['TOTAL']==NULL) {
|
|
$batas = $bobot_dkpi;
|
|
} else {
|
|
$batas = $sumDkpi[0]['TOTAL']+$bobot_dkpi;
|
|
}
|
|
if ($batas>100) {
|
|
$value = 2;
|
|
} else {
|
|
$maxDkpi = $this->Amod->getMax_Urutan_DaftarKpi_byKARYAWAN_byPUM($id_karyawan, $id_pum);
|
|
if ($maxDkpi[0]['URUTAN_DKPI']==NULL) {
|
|
$urutanDkpi = 1;
|
|
} else {
|
|
$urutanDkpi = $maxDkpi[0]['URUTAN_DKPI']+1;
|
|
}
|
|
if ($id_karyawan=="Tim ICT") {
|
|
$input = [
|
|
'KPI_ID' => $id_kpi,
|
|
'PUM_ID' => $id_pum,
|
|
'TIM_ID' => '1',
|
|
'TARGET_DKPI' => $target_dkpi,
|
|
'BOBOT_DKPI' => $bobot_dkpi,
|
|
'URUTAN_DKPI' => $urutanDkpi,
|
|
'CIPTA_DKPI' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->create('daftar_kpi', $input);
|
|
} else {
|
|
$input = [
|
|
'KPI_ID' => $id_kpi,
|
|
'PUM_ID' => $id_pum,
|
|
'KARYAWAN_ID' => $id_karyawan,
|
|
'TARGET_DKPI' => $target_dkpi,
|
|
'BOBOT_DKPI' => $bobot_dkpi,
|
|
'URUTAN_DKPI' => $urutanDkpi,
|
|
'CIPTA_DKPI' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->create('daftar_kpi', $input);
|
|
}
|
|
$value = 1;
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value
|
|
]);
|
|
}
|
|
|
|
public function KP_Ubah_DataDaftarKpi() { // Validasi
|
|
$id_dkpi = $this->input->post('id_dkpi');
|
|
$target_dkpi = $this->input->post('target_dkpi');
|
|
$bobot_dkpi = $this->input->post('bobot_dkpi');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$value = 0;
|
|
$cekDkpi = $this->Amod->getData_DaftarKpi_byID($id_dkpi);
|
|
if ($cekDkpi==FALSE) {
|
|
$value = 3;
|
|
} else {
|
|
$sumDkpi = $this->Amod->getSum_DaftarKpi_byKARYAWAN_byPUM($cekDkpi[0]['KARYAWAN_ID'], $cekDkpi[0]['PUM_ID'], $id_dkpi);
|
|
if ($sumDkpi==FALSE OR $sumDkpi[0]['TOTAL']==NULL) {
|
|
$batas = $bobot_dkpi;
|
|
} else {
|
|
$batas = $sumDkpi[0]['TOTAL']+$bobot_dkpi;
|
|
}
|
|
if ($batas>100) {
|
|
$value = 2;
|
|
} else {
|
|
$update = [
|
|
'TARGET_DKPI' => $target_dkpi,
|
|
'BOBOT_DKPI' => $bobot_dkpi,
|
|
'UBAH_DKPI' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('daftar_kpi', $update, 'ID_DKPI', $id_dkpi);
|
|
$value = 1;
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value
|
|
]);
|
|
}
|
|
|
|
//SUBMENU TRANSAKSI - KUNJUNGAN
|
|
public function KP_Transaksi_Kunjungan_1($id) { // Validasi
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "KP", "TRANSAKSI - Kunjungan");
|
|
$id_menu = $datShm[0]['MENU_ID'];
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$datPkpi = $this->Amod->getData_PeriodeKpi_orderDESC();
|
|
$datSales = $this->Amod->getData_Karyawan_allSalesKpi();
|
|
$datSkun = $this->Amod->getData_StatusKunjungan_not9();
|
|
$dataPkpi = $this->Amod->getData_PeriodeKpi_byID($id);
|
|
$datJkun = $this->Amod->getData_JejakKunjungan_byPKPI($id);
|
|
if ($datJkun==FALSE) {
|
|
$jejakTampil = "Kosong";
|
|
} else {
|
|
$jejakTampil = $datJkun[0]['TIMESTAMP'];
|
|
}
|
|
|
|
$data = array(
|
|
'sidebar' => "menu kpi",
|
|
'navChild' => "kpi kunjungan",
|
|
'id_menu' => $id_menu,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil,
|
|
'sales' => $datSales,
|
|
'skun' => $datSkun,
|
|
'pkpi' => $datPkpi,
|
|
'id_pkpi' => $id,
|
|
'jejakLama' => date('d/m/Y H:i:s'),
|
|
'jejakTampil' => $jejakTampil,
|
|
'nama_pkpi' => $dataPkpi[0]['NAMA_PKPI'],
|
|
);
|
|
$this->load->view('proses/KP_Transaksi_Kunjungan_1', $data);
|
|
}
|
|
|
|
public function KP_Transaksi_Kunjungan_2($id, $karyawan_id) { // Validasi
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "KP", "TRANSAKSI - Kunjungan");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$datPkpi = $this->Amod->getData_PeriodeKpi_orderDESC();
|
|
$datSales = $this->Amod->getData_Karyawan_allSalesKpi();
|
|
$datSkun = $this->Amod->getData_StatusKunjungan_not9();
|
|
$dataPkpi = $this->Amod->getData_PeriodeKpi_byID($id);
|
|
$datJkun = $this->Amod->getData_JejakKunjungan_byPKPI($id);
|
|
if ($datJkun==FALSE) {
|
|
$jejakTampil = "Kosong";
|
|
} else {
|
|
$jejakTampil = $datJkun[0]['TIMESTAMP'];
|
|
}
|
|
|
|
$data = array(
|
|
'sidebar' => "menu kpi",
|
|
'navChild' => "kpi kunjungan",
|
|
'hak' => $hak,
|
|
'tampil' => $tampil,
|
|
'sales' => $datSales,
|
|
'skun' => $datSkun,
|
|
'pkpi' => $datPkpi,
|
|
'id_pkpi' => $id,
|
|
'karyawan_id' => $karyawan_id,
|
|
'jejakLama' => date('d/m/Y H:i:s'),
|
|
'jejakTampil' => $jejakTampil,
|
|
'nama_pkpi' => $dataPkpi[0]['NAMA_PKPI'],
|
|
);
|
|
$this->load->view('proses/KP_Transaksi_Kunjungan_2', $data);
|
|
}
|
|
|
|
public function KP_Ambil_DataJejakTerbaru() { // Validasi
|
|
$id_pkpi = $this->input->post('id_pkpi');
|
|
|
|
$datJkun = $this->Amod->getData_JejakKunjungan_byPKPI($id_pkpi);
|
|
if ($datJkun==FALSE) {
|
|
$timestamp = "STOP";
|
|
} else {
|
|
$timestamp = $datJkun[0]['TIMESTAMP'];
|
|
}
|
|
|
|
$this->output_json([
|
|
'jejakBaru' => $timestamp,
|
|
]);
|
|
}
|
|
|
|
public function KP_Hapus_DataKunjungan() { // Validasi
|
|
$id_kunjungan = $this->input->post('id_kunjungan');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$value = 0;
|
|
$datKunjungan = $this->Amod->getData_Kunjungan_byID($id_kunjungan);
|
|
if ($datKunjungan==FALSE) {
|
|
$value = 2;
|
|
} else {
|
|
$update = [
|
|
'STATUS_KUNJUNGAN' => '9',
|
|
'HAPUS_KUNJUNGAN' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('kunjungan', $update, 'ID_KUNJUNGAN', $id_kunjungan);
|
|
|
|
$value = 1;
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value
|
|
]);
|
|
}
|
|
|
|
public function KP_Perbarui_DataJejakTerbaru() { // Validasi
|
|
$id_pkpi = $this->input->post('id_pkpi');
|
|
|
|
$datJkun = $this->Amod->getData_JejakKunjungan_byPKPI($id_pkpi);
|
|
if ($datJkun==FALSE) {
|
|
$input = [
|
|
'PKPI_ID' => $id_pkpi,
|
|
'TIMESTAMP' => date('d/m/Y H:i:s')
|
|
];
|
|
$action = $this->Amod->create('jejak_kunjungan', $input);
|
|
} else {
|
|
$update = [
|
|
'TIMESTAMP' => date('d/m/Y H:i:s')
|
|
];
|
|
$action = $this->Amod->update('jejak_kunjungan', $update, 'ID_JKUN', $datJkun[0]['ID_JKUN']);
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => 1,
|
|
]);
|
|
}
|
|
|
|
public function KP_Tambah_DataKunjungan() { // Validasi
|
|
$tgl_kunjungan = $this->input->post('tgl_kunjungan');
|
|
$pelanggan_kunjungan = $this->input->post('pelanggan_kunjungan');
|
|
$tujuan_kunjungan = $this->input->post('tujuan_kunjungan');
|
|
$sales_kunjungan = $this->input->post('sales_kunjungan');
|
|
$pelanggan_kunjungan = ltrim(rtrim(preg_replace('/\R+/', " " , $pelanggan_kunjungan)));
|
|
$tujuan_kunjungan = ltrim(rtrim(preg_replace('/\R+/', " " , $tujuan_kunjungan)));
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$value = 0;
|
|
|
|
$sales = "";
|
|
$total = 1;
|
|
foreach ($sales_kunjungan as $key) {
|
|
if (count($sales_kunjungan)==$total) {
|
|
$sales .= "$key";
|
|
} else {
|
|
$sales .= "$key,";
|
|
$total++;
|
|
}
|
|
}
|
|
|
|
$input = [
|
|
'CIPTA_KUNJUNGAN' => "Oleh $panggilan pada $timestamp",
|
|
'TGL_KUNJUNGAN' => $tgl_kunjungan,
|
|
'PELANGGAN_KUNJUNGAN' => $pelanggan_kunjungan,
|
|
'TUJUAN_KUNJUNGAN' => $tujuan_kunjungan,
|
|
'SALES_KUNJUNGAN' => $sales,
|
|
'LAPORAN_KUNJUNGAN' => "",
|
|
'STATUS_KUNJUNGAN' => '1',
|
|
];
|
|
$action = $this->Amod->create('kunjungan', $input);
|
|
|
|
if ($action) {
|
|
$value = 1;
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value
|
|
]);
|
|
}
|
|
|
|
public function KP_Ubah_DataKunjungan() { // Validasi
|
|
$id_kunjungan = $this->input->post('id_kunjungan');
|
|
$pelanggan_kunjungan = $this->input->post('pelanggan_kunjungan');
|
|
$tujuan_kunjungan = $this->input->post('tujuan_kunjungan');
|
|
$sales_kunjungan = $this->input->post('sales_kunjungan');
|
|
$laporan_kunjungan = $this->input->post('laporan_kunjungan');
|
|
$status_kunjungan = $this->input->post('status_kunjungan');
|
|
$pelanggan_kunjungan = ltrim(rtrim(preg_replace('/\R+/', " " , $pelanggan_kunjungan)));
|
|
$tujuan_kunjungan = ltrim(rtrim(preg_replace('/\R+/', " " , $tujuan_kunjungan)));
|
|
$laporan_kunjungan = ltrim(rtrim(preg_replace('/\R/', "<br>" , $laporan_kunjungan)));
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$value = 0;
|
|
|
|
$sales = "";
|
|
$total = 1;
|
|
foreach ($sales_kunjungan as $key) {
|
|
if (count($sales_kunjungan)==$total) {
|
|
$sales .= "$key";
|
|
} else {
|
|
$sales .= "$key,";
|
|
$total++;
|
|
}
|
|
}
|
|
|
|
$update = [
|
|
'UBAH_KUNJUNGAN' => "Oleh $panggilan pada $timestamp",
|
|
'PELANGGAN_KUNJUNGAN' => $pelanggan_kunjungan,
|
|
'TUJUAN_KUNJUNGAN' => $tujuan_kunjungan,
|
|
'SALES_KUNJUNGAN' => $sales,
|
|
'LAPORAN_KUNJUNGAN' => $laporan_kunjungan,
|
|
'STATUS_KUNJUNGAN' => $status_kunjungan,
|
|
];
|
|
$action = $this->Amod->update('kunjungan', $update, 'ID_KUNJUNGAN', $id_kunjungan);
|
|
|
|
if ($action) {
|
|
$value = 1;
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value
|
|
]);
|
|
}
|
|
|
|
//SUBMENU TRANSAKSI - PENAWARAN
|
|
public function KP_Transaksi_Penawaran_1() { // Validasi
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$now = date('Y-m-d');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "KP", "TRANSAKSI - Penawaran");
|
|
$id_menu = $datShm[0]['MENU_ID'];
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$cekPenawaran = $this->Amod->getData_Penawaran_byKARYAWAN_bySTATUS($id_karyawan, 0);
|
|
if ($cekPenawaran==TRUE) {
|
|
if ($cekPenawaran[0]['TGL_REVISI']!=NULL AND $cekPenawaran[0]['REVISI_PENAWARAN']!=NULL) {
|
|
if (strtotime($cekPenawaran[0]['TGL_REVISI'])<strtotime($now)) {
|
|
$update = [
|
|
'TGL_REVISI' => NULL,
|
|
'REVISI_PENAWARAN' => NULL,
|
|
'STATUS_PENAWARAN' => '1'
|
|
];
|
|
$action = $this->Amod->update('penawaran', $update, 'ID_PENAWARAN', $cekPenawaran[0]['ID_PENAWARAN']);
|
|
}
|
|
} else if ($cekPenawaran[0]['TGL_REVISI']!=NULL AND $cekPenawaran[0]['REVISI_PENAWARAN']==NULL) {
|
|
if (strtotime($cekPenawaran[0]['TGL_REVISI'])<strtotime($now)) {
|
|
$aktifBaru = $cekPenawaran[0]['AKTIF_PENAWARAN'];
|
|
$aktifLama = $aktifBaru-1;
|
|
|
|
$datDpne = $this->Amod->getData_DaftarPenawaran_byPENAWARAN_byVERSI($cekPenawaran[0]['ID_PENAWARAN'], $aktifBaru);
|
|
foreach ($datDpne as $key) {
|
|
$action = $this->Amod->delete('daftar_penawaran', $key['ID_DPNE'], 'ID_DPNE');
|
|
}
|
|
|
|
$update = [
|
|
'TGL_REVISI' => NULL,
|
|
'STATUS_PENAWARAN' => '1',
|
|
'AKTIF_PENAWARAN' => $aktifLama
|
|
];
|
|
$action = $this->Amod->update('penawaran', $update, 'ID_PENAWARAN', $cekPenawaran[0]['ID_PENAWARAN']);
|
|
}
|
|
} else if ($cekPenawaran[0]['TGL_REVISI']==NULL) {
|
|
if (strtotime($cekPenawaran[0]['TGL_PENAWARAN'])<strtotime($now)) {
|
|
$update = [
|
|
'STATUS_PENAWARAN' => '9',
|
|
'BATAL_PENAWARAN' => "Oleh Sistem pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('penawaran', $update, 'ID_PENAWARAN', $cekPenawaran[0]['ID_PENAWARAN']);
|
|
}
|
|
}
|
|
}
|
|
|
|
$datKop = $this->Amod->getData_Kop();
|
|
$datSales = $this->Amod->getData_Karyawan_allSalesKpi();
|
|
$datSatuan = $this->Amod->getData_Satuan_byJENIS_bySTATUS(1, 1);
|
|
|
|
$datStpos = $this->Amod->getData_SetTogglePosisi_byKARYAWAN_byMENU($id_karyawan, $id_menu);
|
|
if ($datStpos==FALSE) { $posisiToggle = 0; } else { $posisiToggle = $datStpos[0]['AKTIF_STPOS']; }
|
|
|
|
$data = array(
|
|
'sidebar' => "menu kpi",
|
|
'navChild' => "kpi penawaran",
|
|
'hak' => $hak,
|
|
'tampil' => $tampil,
|
|
'corp' => $datKop,
|
|
'sales' => $datSales,
|
|
'satuan' => $datSatuan,
|
|
'id_menu' => $id_menu,
|
|
'posisiToggle' => $posisiToggle,
|
|
);
|
|
$this->load->view('proses/KP_Transaksi_Penawaran_1', $data);
|
|
}
|
|
|
|
public function KP_Ambil_JumlahData() { // Validasi
|
|
$hak = $this->input->post('hak');
|
|
$verse = $this->input->post('verse');
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$now = date('Y-m-d');
|
|
|
|
$kode = "Kosong";
|
|
$cekPenawaran = $this->Amod->getData_Penawaran_byKARYAWAN_bySTATUS($id_karyawan, 0);
|
|
if ($cekPenawaran==TRUE) {
|
|
$kode = $cekPenawaran[0]['KODE_PENAWARAN'];
|
|
}
|
|
|
|
if ($verse==1) {
|
|
$limit = date('Y-m-01');
|
|
$limit = $this->Amod->generate_subMonth($limit, 3);
|
|
$datPenawaran = $this->Amod->getData_Penawaran_byLIMIT_allStatus_orderDESC($limit);
|
|
} else if ($verse==2) {
|
|
$datPenawaran = $this->Amod->getData_Penawaran_bySTATUS(1);
|
|
}
|
|
$berjalan = 0;
|
|
$doubleclaim = 0;
|
|
$tindakan = 0;
|
|
$menunggu = 0;
|
|
$budgeting = 0;
|
|
$nilaiBerjalan = 0;
|
|
$nilaiMenunggu = 0;
|
|
$nilaiBudgeting = 0;
|
|
$percentTindakan = 0;
|
|
$percentMenunggu = 0;
|
|
$percentBudgeting = 0;
|
|
$totalKuantiti = 0;
|
|
foreach ($datPenawaran as $key) {
|
|
$skip = 0;
|
|
$salesChannel = "";
|
|
$salesOther = "";
|
|
$sales_penawaran = $key['SALES_PENAWARAN'];
|
|
$listSales = explode(',', $sales_penawaran);
|
|
foreach ($listSales as $dat) {
|
|
$datKaryawan = $this->Amod->getData_Karyawan_byID($dat);
|
|
$nama = $datKaryawan[0]['NAMA_PANGGILAN_KARYAWAN'];
|
|
if ($nama=="Service" OR $panggilan=="Service") {
|
|
if ($verse==1) {
|
|
$salesOther .= "$nama, ";
|
|
} else if ($verse==2) {
|
|
$skip = 1;
|
|
break;
|
|
}
|
|
} else if (strpos($datKaryawan[0]['NAMA_JABATAN'],"CHANNEL")!==FALSE OR $nama=="Anton") {
|
|
$salesChannel .= "$nama, ";
|
|
} else {
|
|
$salesOther .= "$nama, ";
|
|
}
|
|
}
|
|
if ($salesChannel!="") {
|
|
$salesChannel = substr($salesChannel, 0, -2);
|
|
}
|
|
if ($salesOther!="") {
|
|
$salesOther = substr($salesOther, 0, -2);
|
|
}
|
|
|
|
if ($hak<=2) {
|
|
if ($skip==1) {
|
|
$show = 0;
|
|
} else if (strpos($salesChannel,$panggilan)!==FALSE OR strpos($salesOther,$panggilan)!==FALSE) {
|
|
$show = 1;
|
|
if (strpos($salesOther,$panggilan)!==FALSE) {
|
|
if (sizeof($listSales)>1) {
|
|
$doubleclaim++;
|
|
}
|
|
}
|
|
} else {
|
|
$show = 0;
|
|
}
|
|
} else {
|
|
if ($skip==1) {
|
|
$show = 0;
|
|
} else {
|
|
$show = 1;
|
|
if ($salesChannel!="") {
|
|
if ($salesOther!="") {
|
|
$doubleclaim++;
|
|
}
|
|
} else if ($salesChannel=="" AND $salesOther!="") {
|
|
if (substr_count($salesOther, ",")>0) {
|
|
$doubleclaim++;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
if ($show==1) {
|
|
$datHpne = $this->Amod->getData_HistoriPenawaran_byPENAWARAN_orderDESC_limit1($key['ID_PENAWARAN']);
|
|
if ($datHpne[0]['STATUS_HPNE']>=0 AND $datHpne[0]['STATUS_HPNE']<=5) {
|
|
if (strtotime($now)>=strtotime($datHpne[0]['FU_HPNE'])) {
|
|
$tindakan++;
|
|
} else {
|
|
if ($datHpne[0]['STATUS_HPNE']==3) {
|
|
$budgeting++;
|
|
$nilaiBudgeting = $nilaiBudgeting+round($key['NILAI_PENAWARAN'],2);
|
|
} else {
|
|
$menunggu++;
|
|
$nilaiMenunggu = $nilaiMenunggu+round($key['NILAI_PENAWARAN'],2);
|
|
}
|
|
}
|
|
$berjalan++;
|
|
$totalKuantiti++;
|
|
$nilaiBerjalan = $nilaiBerjalan+round($key['NILAI_PENAWARAN'],2);
|
|
}
|
|
}
|
|
}
|
|
|
|
if ($verse==2) {
|
|
$percentTindakan = round($tindakan/$totalKuantiti*100,2);
|
|
$percentMenunggu = round($menunggu/$totalKuantiti*100,2);
|
|
$percentBudgeting = round($budgeting/$totalKuantiti*100,2);
|
|
}
|
|
|
|
$this->output_json([
|
|
'kode' => $kode,
|
|
'berjalan' => $berjalan,
|
|
'doubleclaim' => $doubleclaim,
|
|
'tindakan' => $tindakan,
|
|
'menunggu' => $menunggu,
|
|
'budgeting' => $budgeting,
|
|
'nilaiTindakan' => number_format($nilaiBerjalan,2),
|
|
'nilaiMenunggu' => number_format($nilaiMenunggu,2),
|
|
'nilaiBudgeting' => number_format($nilaiBudgeting,2),
|
|
'percentTindakan' => number_format($percentTindakan,2),
|
|
'percentMenunggu' => number_format($percentMenunggu,2),
|
|
'percentBudgeting' => number_format($percentBudgeting,2),
|
|
]);
|
|
}
|
|
|
|
public function KP_Batal_DataPenawaran() { // Validasi
|
|
$id_penawaran = $this->input->post('id_penawaran');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$value = 0;
|
|
$datPenawaran = $this->Amod->getData_Penawaran_byID_bySTATUS($id_penawaran, 0);
|
|
if ($datPenawaran==FALSE) {
|
|
$value = 3;
|
|
} else {
|
|
$countHpne = $this->Amod->getCount_HistoriPenawaran_byPENAWARAN($id_penawaran);
|
|
if ($countHpne>2) {
|
|
$value = 2;
|
|
} else {
|
|
if ($datPenawaran[0]['AKTIF_PENAWARAN']>1) {
|
|
$value = 2;
|
|
} else {
|
|
$update = [
|
|
'BATAL_PENAWARAN' => "Oleh $panggilan pada $timestamp",
|
|
'STATUS_PENAWARAN' => '9'
|
|
];
|
|
$action = $this->Amod->update('penawaran', $update, 'ID_PENAWARAN', $id_penawaran);
|
|
|
|
$value = 1;
|
|
}
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value
|
|
]);
|
|
}
|
|
|
|
public function KP_Ganti_DataDaftarPenawaran() { // Validasi
|
|
$id_dpne = $this->input->post('id_dpne');
|
|
$id_sales = $this->input->post('id_sales');
|
|
|
|
$value = 0;
|
|
|
|
if ($id_sales=="") {
|
|
$id_sales = NULL;
|
|
}
|
|
|
|
$update = [
|
|
'SAL_ID' => $id_sales
|
|
];
|
|
$action = $this->Amod->update('daftar_penawaran', $update, 'ID_DPNE', $id_dpne);
|
|
|
|
$this->output_json([
|
|
'value' => $value
|
|
]);
|
|
}
|
|
|
|
public function KP_Hapus_DataDaftarPenawaran() { // Validasi
|
|
$id_dpne = $this->input->post('id_dpne');
|
|
|
|
$value = 0;
|
|
$datDpne = $this->Amod->getData_DaftarPenawaran_byID($id_dpne);
|
|
if ($datDpne==FALSE) {
|
|
$value = 3;
|
|
} else {
|
|
$datPenawaran = $this->Amod->getData_Penawaran_byID_bySTATUS($datDpne[0]['PENAWARAN_ID'], 0);
|
|
if ($datPenawaran==FALSE) {
|
|
$value = 2;
|
|
} else {
|
|
$action = $this->Amod->delete('daftar_penawaran', $id_dpne, 'ID_DPNE');
|
|
$value = 1;
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value
|
|
]);
|
|
}
|
|
|
|
public function KP_Kunci_DataPenawaran() { // Validasi
|
|
$id_penawaran = $this->input->post('id_penawaran');
|
|
$reminder = $this->input->post('reminder');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$now = date('Y-m-d');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
$future = $this->Amod->generate_addDay($now, $reminder);
|
|
|
|
$value = 0;
|
|
$datPenawaran = $this->Amod->getData_Penawaran_byID_bySTATUS($id_penawaran, 0);
|
|
if ($datPenawaran==FALSE) {
|
|
$value = 2;
|
|
} else {
|
|
$kode_penawaran = $datPenawaran[0]['KODE_PENAWARAN'];
|
|
if ($datPenawaran[0]['TGL_REVISI']==NULL) {
|
|
$input = [
|
|
'PENAWARAN_ID' => $id_penawaran,
|
|
'CIPTA_HPNE' => "Oleh $panggilan pada $timestamp",
|
|
'FU_HPNE' => $now,
|
|
'KET_HPNE' => "Penawaran $kode_penawaran Versi Pertama berhasil dibuat.",
|
|
'STATUS_HPNE' => '0'
|
|
];
|
|
$action = $this->Amod->create('histori_penawaran', $input);
|
|
|
|
$perihal_penawaran = $datPenawaran[0]['PERIHAL_PENAWARAN'];
|
|
$input = [
|
|
'PENAWARAN_ID' => $id_penawaran,
|
|
'CIPTA_HPNE' => "Oleh $panggilan pada $timestamp",
|
|
'FU_HPNE' => $future,
|
|
'KET_HPNE' => "Follow up Penawaran Perihal $perihal_penawaran",
|
|
'STATUS_HPNE' => '1'
|
|
];
|
|
$action = $this->Amod->create('histori_penawaran', $input);
|
|
|
|
$update = [
|
|
'STATUS_PENAWARAN' => '1'
|
|
];
|
|
$action = $this->Amod->update('penawaran', $update, 'ID_PENAWARAN', $id_penawaran);
|
|
} else {
|
|
$datHpne = $this->Amod->getData_HistoriPenawaran_byPENAWARAN_orderDESC_limit1($id_penawaran);
|
|
$urutan = $this->Amod->generate_textUrutan($datPenawaran[0]['AKTIF_PENAWARAN']);
|
|
$ket_hpne = "Penawaran $kode_penawaran Versi $urutan berhasil dibuat.";
|
|
$cekHpne = $this->Amod->getData_HistoriPenawaran_byPENAWARAN_byKET($id_penawaran, $ket_hpne);
|
|
if ($cekHpne==FALSE) {
|
|
$input = [
|
|
'PENAWARAN_ID' => $id_penawaran,
|
|
'CIPTA_HPNE' => "Oleh $panggilan pada $timestamp",
|
|
'FU_HPNE' => $future,
|
|
'KET_HPNE' => $ket_hpne,
|
|
'STATUS_HPNE' => $datHpne[0]['STATUS_HPNE']
|
|
];
|
|
$action = $this->Amod->create('histori_penawaran', $input);
|
|
} else {
|
|
$input = [
|
|
'PENAWARAN_ID' => $id_penawaran,
|
|
'CIPTA_HPNE' => "Oleh $panggilan pada $timestamp",
|
|
'FU_HPNE' => $future,
|
|
'KET_HPNE' => "Penawaran $kode_penawaran Versi $urutan berhasil diperbaruhi.",
|
|
'STATUS_HPNE' => $datHpne[0]['STATUS_HPNE']
|
|
];
|
|
$action = $this->Amod->create('histori_penawaran', $input);
|
|
}
|
|
|
|
$update = [
|
|
'STATUS_PENAWARAN' => '1',
|
|
'TGL_REVISI' => NULL,
|
|
'REVISI_PENAWARAN' => NULL,
|
|
];
|
|
$action = $this->Amod->update('penawaran', $update, 'ID_PENAWARAN', $id_penawaran);
|
|
}
|
|
|
|
if ($datPenawaran[0]['JENIS_PENAWARAN']==3) {
|
|
$datDpne = $this->Amod->getData_DaftarPenawaran_byPENAWARAN_byVERSI($id_penawaran, $datPenawaran[0]['AKTIF_PENAWARAN']);
|
|
if ($datDpne==FALSE) {
|
|
$harga_dpne = round($datPenawaran[0]['NILAI_PENAWARAN']/((100+$datPenawaran[0]['NILAI_PENAWARAN'])/100),2);
|
|
$input = [
|
|
'PENAWARAN_ID' => $id_penawaran,
|
|
'VERSI_DPNE' => $datPenawaran[0]['AKTIF_PENAWARAN'],
|
|
'NAMA_DPNE' => $datPenawaran[0]['PERIHAL_PENAWARAN'],
|
|
'QTY_DPNE' => '1',
|
|
'SATUAN_ID' => '1',
|
|
'HARGA_DPNE' => $harga_dpne
|
|
];
|
|
$action = $this->Amod->create('daftar_penawaran', $input);
|
|
}
|
|
} else {
|
|
$cekCd = $this->Amod->getData_CetakDokumen_byPENAWARAN_byVERSI($id_penawaran, $datPenawaran[0]['AKTIF_PENAWARAN']);
|
|
if ($cekCd==FALSE) {
|
|
$input = [
|
|
'SJ_INV' => $datPenawaran[0]['AKTIF_PENAWARAN'],
|
|
'KODE_BUKTI' => $kode_penawaran,
|
|
'TGL_CD' => $now,
|
|
'PENAWARAN_ID' => $id_penawaran,
|
|
'STATUS_CD' => $datPenawaran[0]['JENIS_PENAWARAN'],
|
|
];
|
|
$action = $this->Amod->create('cetak_dokumen', $input);
|
|
} else {
|
|
$update = [
|
|
'STATUS_CD' => $datPenawaran[0]['JENIS_PENAWARAN'],
|
|
];
|
|
$action = $this->Amod->update('cetak_dokumen', $update, 'ID_CD', $cekCd[0]['ID_CD']);
|
|
}
|
|
}
|
|
|
|
$value = 1;
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value
|
|
]);
|
|
}
|
|
|
|
public function KP_Revisi_DataPenawaran() { // Validasi
|
|
$id_penawaran = $this->input->post('id_penawaran');
|
|
$jenis = $this->input->post('jenis');
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
$now = date('Y-m-d');
|
|
|
|
$value = 0;
|
|
$datPenawaran = $this->Amod->getData_Penawaran_byID_bySTATUS($id_penawaran, 1);
|
|
if ($datPenawaran==FALSE) {
|
|
$value = 2;
|
|
} else {
|
|
$cekPenawaran = $this->Amod->getData_Penawaran_byKARYAWAN_bySTATUS($id_karyawan, 0);
|
|
if ($cekPenawaran==TRUE AND $cekPenawaran[0]['AKTIF_PENAWARAN']==1) {
|
|
$update = [
|
|
'STATUS_PENAWARAN' => '9',
|
|
'BATAL_PENAWARAN' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('penawaran', $update, 'ID_PENAWARAN', $cekPenawaran[0]['ID_PENAWARAN']);
|
|
} else if ($cekPenawaran==FALSE) {
|
|
|
|
} else {
|
|
$value = 2;
|
|
}
|
|
if ($value==0) {
|
|
if ($jenis==1) {
|
|
$update = [
|
|
'KARYAWAN_ID' => $id_karyawan,
|
|
'TGL_REVISI' => $now,
|
|
'STATUS_PENAWARAN' => '0',
|
|
'REVISI_PENAWARAN' => "Oleh $panggilan pada $timestamp"
|
|
];
|
|
$action = $this->Amod->update('penawaran', $update, 'ID_PENAWARAN', $id_penawaran);
|
|
} else if ($jenis==2) {
|
|
$aktifLama = $datPenawaran[0]['AKTIF_PENAWARAN'];
|
|
$aktifBaru = $aktifLama+1;
|
|
|
|
$datDpne = $this->Amod->getData_DaftarPenawaran_byPENAWARAN_byVERSI($id_penawaran, $aktifLama);
|
|
foreach ($datDpne as $key) {
|
|
$input = [
|
|
'PENAWARAN_ID' => $key['PENAWARAN_ID'],
|
|
'VERSI_DPNE' => $aktifBaru,
|
|
'NAMA_DPNE' => $key['NAMA_DPNE'],
|
|
'QTY_DPNE' => $key['QTY_DPNE'],
|
|
'HARGA_DPNE' => $key['HARGA_DPNE'],
|
|
'SATUAN_ID' => $key['SATUAN_ID'],
|
|
'SAL_ID' => $key['SAL_ID']
|
|
];
|
|
$action = $this->Amod->create('daftar_penawaran', $input);
|
|
}
|
|
|
|
$update = [
|
|
'KARYAWAN_ID' => $id_karyawan,
|
|
'TGL_REVISI' => $now,
|
|
'STATUS_PENAWARAN' => '0',
|
|
'AKTIF_PENAWARAN' => $aktifBaru,
|
|
];
|
|
$action = $this->Amod->update('penawaran', $update, 'ID_PENAWARAN', $id_penawaran);
|
|
}
|
|
$value = 1;
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value
|
|
]);
|
|
}
|
|
|
|
public function KP_Tambah_DataDaftarPenawaran() { // Validasi
|
|
$id_penawaran = $this->input->post('id_penawaran');
|
|
$nama_dpne = $this->input->post('nama_dpne');
|
|
$qty_dpne = $this->input->post('qty_dpne');
|
|
$harga_dpne = $this->input->post('harga_dpne');
|
|
$id_satuan = $this->input->post('id_satuan');
|
|
$nama_dpne = ltrim(rtrim(preg_replace('/\R/', "<br>" , $nama_dpne)));
|
|
|
|
$value = 0;
|
|
$datPenawaran = $this->Amod->getData_Penawaran_byID_bySTATUS($id_penawaran, 0);
|
|
if ($datPenawaran==FALSE) {
|
|
$value = 2;
|
|
} else {
|
|
$input = [
|
|
'PENAWARAN_ID' => $id_penawaran,
|
|
'VERSI_DPNE' => $datPenawaran[0]['AKTIF_PENAWARAN'],
|
|
'NAMA_DPNE' => $nama_dpne,
|
|
'QTY_DPNE' => $qty_dpne,
|
|
'HARGA_DPNE' => $harga_dpne,
|
|
'SATUAN_ID' => $id_satuan
|
|
];
|
|
$action = $this->Amod->create('daftar_penawaran', $input);
|
|
|
|
$value = 1;
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value
|
|
]);
|
|
}
|
|
|
|
public function KP_Tambah_DataPenawaran() { // Validasi
|
|
$verse = $this->input->post('verse');
|
|
$jenis_penawaran = $this->input->post('jenis_penawaran');
|
|
$nilai_penawaran = $this->input->post('nilai_penawaran');
|
|
$sales_penawaran = $this->input->post('sales_penawaran');
|
|
$id_corp = $this->input->post('id_corp');
|
|
$ppn_penawaran = $this->input->post('ppn_penawaran');
|
|
$lampiran_penawaran = $this->input->post('lampiran_penawaran');
|
|
$pelanggan_penawaran = $this->input->post('pelanggan_penawaran');
|
|
$up_penawaran = $this->input->post('up_penawaran');
|
|
$perihal_penawaran = $this->input->post('perihal_penawaran');
|
|
$pelanggan_penawaran = ltrim(rtrim(preg_replace('/\R+/', " " , $pelanggan_penawaran)));
|
|
$up_penawaran = ltrim(rtrim(preg_replace('/\R+/', " " , $up_penawaran)));
|
|
$perihal_penawaran = ltrim(rtrim(preg_replace('/\R+/', " " , $perihal_penawaran)));
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
$now = date('Y-m-d');
|
|
|
|
$value = 0;
|
|
$datPenawaran = $this->Amod->getData_Penawaran_byKARYAWAN_bySTATUS($id_karyawan, 0);
|
|
if ($datPenawaran==TRUE) {
|
|
$id_penawaran = $datPenawaran[0]['ID_PENAWARAN'];
|
|
$kode_penawaran = $datPenawaran[0]['KODE_PENAWARAN'];
|
|
$aktif_penawaran = $this->Amod->generate_textUrutan($datPenawaran[0]['AKTIF_PENAWARAN']);
|
|
} else {
|
|
$kode_penawaran = $this->Amod->generate_kodePenawaran();
|
|
$input = [
|
|
'CIPTA_PENAWARAN' => "Oleh $panggilan pada $timestamp",
|
|
'KODE_PENAWARAN' => $kode_penawaran,
|
|
'KARYAWAN_ID' => $id_karyawan,
|
|
'TGL_PENAWARAN' => $now,
|
|
'AKTIF_PENAWARAN' => '1',
|
|
'STATUS_PENAWARAN' => '0'
|
|
];
|
|
$action = $this->Amod->create('penawaran', $input);
|
|
|
|
$id_penawaran = $this->Amod->getMax_ID_Penawaran();
|
|
$id_penawaran = $id_penawaran[0]['ID_PENAWARAN'];
|
|
|
|
$aktif_penawaran = "Pertama";
|
|
}
|
|
|
|
if ($verse==1) {
|
|
$update = [
|
|
'JENIS_PENAWARAN'=> $jenis_penawaran
|
|
];
|
|
} else if ($verse==2) {
|
|
$update = [
|
|
'NILAI_PENAWARAN'=> $nilai_penawaran
|
|
];
|
|
} else if ($verse==3) {
|
|
$sales = "";
|
|
$total = 1;
|
|
foreach ($sales_penawaran as $key) {
|
|
if (count($sales_penawaran)==$total) {
|
|
$sales .= "$key";
|
|
} else {
|
|
$sales .= "$key,";
|
|
$total++;
|
|
}
|
|
}
|
|
if ($sales=="") {
|
|
$sales = NULL;
|
|
}
|
|
$update = [
|
|
'SALES_PENAWARAN'=> $sales
|
|
];
|
|
} else if ($verse==4) {
|
|
$update = [
|
|
'CORP_ID'=> $id_corp
|
|
];
|
|
} else if ($verse==5) {
|
|
$update = [
|
|
'PPN_PENAWARAN'=> $ppn_penawaran
|
|
];
|
|
} else if ($verse==6) {
|
|
$update = [
|
|
'LAMPIRAN_PENAWARAN'=> $lampiran_penawaran
|
|
];
|
|
} else if ($verse==7) {
|
|
$update = [
|
|
'PELANGGAN_PENAWARAN'=> $pelanggan_penawaran
|
|
];
|
|
} else if ($verse==8) {
|
|
$update = [
|
|
'UP_PENAWARAN'=> $up_penawaran
|
|
];
|
|
} else if ($verse==9) {
|
|
$update = [
|
|
'PERIHAL_PENAWARAN'=> $perihal_penawaran
|
|
];
|
|
}
|
|
$action = $this->Amod->update('penawaran', $update, 'ID_PENAWARAN', $id_penawaran);
|
|
|
|
if ($jenis_penawaran==3) {
|
|
$action = $this->Amod->delete('daftar_penawaran', $id_penawaran, 'PENAWARAN_ID');
|
|
}
|
|
if ($action) {
|
|
$value = 1;
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value,
|
|
'kode' => $kode_penawaran,
|
|
'id' => $id_penawaran,
|
|
'aktif' => $aktif_penawaran
|
|
]);
|
|
}
|
|
|
|
public function KP_Ubah_DataDaftarPenawaran() { // Validasi
|
|
$id_dpne = $this->input->post('id_dpne');
|
|
$nama_dpne = $this->input->post('nama_dpne');
|
|
$qty_dpne = $this->input->post('qty_dpne');
|
|
$harga_dpne = $this->input->post('harga_dpne');
|
|
$id_satuan = $this->input->post('id_satuan');
|
|
$nama_dpne = ltrim(rtrim(preg_replace('/\R/', "<br>" , $nama_dpne)));
|
|
|
|
$value = 0;
|
|
$datDpne = $this->Amod->getData_DaftarPenawaran_byID($id_dpne);
|
|
if ($datDpne==FALSE) {
|
|
$value = 3;
|
|
} else {
|
|
$datPenawaran = $this->Amod->getData_Penawaran_byID_bySTATUS($datDpne[0]['PENAWARAN_ID'], 0);
|
|
if ($datPenawaran==FALSE) {
|
|
$value = 2;
|
|
} else {
|
|
if ($nama_dpne==NULL) {
|
|
$nama_dpne = $datDpne[0]['NAMA_DPNE'];
|
|
}
|
|
if ($qty_dpne==NULL) {
|
|
$qty_dpne = $datDpne[0]['QTY_DPNE'];
|
|
}
|
|
if ($harga_dpne==NULL) {
|
|
$harga_dpne = $datDpne[0]['HARGA_DPNE'];
|
|
}
|
|
if ($id_satuan==NULL) {
|
|
$id_satuan = $datDpne[0]['SATUAN_ID'];
|
|
}
|
|
|
|
$update = [
|
|
'NAMA_DPNE' => $nama_dpne,
|
|
'QTY_DPNE' => $qty_dpne,
|
|
'HARGA_DPNE'=> $harga_dpne,
|
|
'SATUAN_ID' => $id_satuan,
|
|
];
|
|
$action = $this->Amod->update('daftar_penawaran', $update, 'ID_DPNE', $id_dpne);
|
|
|
|
$value = 1;
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value
|
|
]);
|
|
}
|
|
|
|
//SUBMENU TRANSAKSI - TINDAK LANJUT
|
|
public function KP_Transaksi_TindakLanjut_1($id_sales=null) { // Validasi
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "KP", "TRANSAKSI - Tindak Lanjut");
|
|
if ($datShm==TRUE) {
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
$id_menu = $datShm[0]['MENU_ID'];
|
|
} else {
|
|
$hak = 0;
|
|
$id_menu = 0;
|
|
$tampil = "TIDAK BERHAK";
|
|
}
|
|
|
|
$datSales = $this->Amod->getData_Karyawan_allSales();
|
|
$datSpe = $this->Amod->getData_StatusPenawaran_not09();
|
|
|
|
$datStpos = $this->Amod->getData_SetTogglePosisi_byKARYAWAN_byMENU($id_karyawan, $id_menu);
|
|
if ($datStpos==FALSE) { $posisiToggle = 0; } else { $posisiToggle = $datStpos[0]['AKTIF_STPOS']; }
|
|
|
|
$data = array(
|
|
'sidebar' => "menu kpi",
|
|
'navChild' => "kpi tindaklanjut",
|
|
'hak' => $hak,
|
|
'tampil' => $tampil,
|
|
'sales' => $datSales,
|
|
'spe' => $datSpe,
|
|
'id_sales' => $id_sales,
|
|
'id_menu' => $id_menu,
|
|
'posisiToggle' => $posisiToggle,
|
|
);
|
|
$this->load->view('proses/KP_Transaksi_TindakLanjut_1', $data);
|
|
}
|
|
|
|
public function KP_Hapus_DataHistoriPenawaran() { // Validasi
|
|
$id_hpne = $this->input->post('id_hpne');
|
|
$id_penawaran = $this->input->post('id_penawaran');
|
|
|
|
$value = 0;
|
|
$datPenawaran = $this->Amod->getData_Penawaran_byID($id_penawaran);
|
|
if ($datPenawaran==FALSE) {
|
|
$value = 3;
|
|
} else {
|
|
$datHpne = $this->Amod->getData_HistoriPenawaran_byID($id_hpne);
|
|
if ($datHpne==FALSE) {
|
|
$value = 2;
|
|
} else {
|
|
$action = $this->Amod->delete('histori_penawaran', $id_hpne, 'ID_HPNE');
|
|
|
|
$value = 1;
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value
|
|
]);
|
|
}
|
|
|
|
public function KP_Tambah_DataHistoriPenawaran() { // Validasi
|
|
$id_penawaran = $this->input->post('id_penawaran');
|
|
$status_hpne = $this->input->post('status_hpne');
|
|
$ket_hpne = $this->input->post('ket_hpne');
|
|
$fu_hpne = $this->input->post('fu_hpne');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
$ket_hpne = preg_replace('/\R+/', " " , $ket_hpne);
|
|
|
|
$value = 0;
|
|
$datPenawaran = $this->Amod->getData_Penawaran_byID($id_penawaran);
|
|
if ($datPenawaran==FALSE) {
|
|
$value = 2;
|
|
} else {
|
|
$input = [
|
|
'PENAWARAN_ID' => $id_penawaran,
|
|
'CIPTA_HPNE' => "Oleh $panggilan pada $timestamp",
|
|
'KET_HPNE' => $ket_hpne,
|
|
'FU_HPNE' => $fu_hpne,
|
|
'STATUS_HPNE' => $status_hpne,
|
|
];
|
|
$action = $this->Amod->create('histori_penawaran', $input);
|
|
|
|
$value = 1;
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value
|
|
]);
|
|
}
|
|
|
|
public function KP_Ubah_DataHistoriPenawaran() { // Validasi
|
|
$id_hpne = $this->input->post('id_hpne');
|
|
$id_penawaran = $this->input->post('id_penawaran');
|
|
$status_hpne = $this->input->post('status_hpne');
|
|
$ket_hpne = $this->input->post('ket_hpne');
|
|
$fu_hpne = $this->input->post('fu_hpne');
|
|
$panggilan = $this->session->userdata('nama_panggilan');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
$ket_hpne = preg_replace('/\R+/', " " , $ket_hpne);
|
|
|
|
$value = 0;
|
|
$datPenawaran = $this->Amod->getData_Penawaran_byID($id_penawaran);
|
|
if ($datPenawaran==FALSE) {
|
|
$value = 3;
|
|
} else {
|
|
$datHpne = $this->Amod->getData_HistoriPenawaran_byID($id_hpne);
|
|
if ($datHpne==FALSE) {
|
|
$value = 2;
|
|
} else {
|
|
$update = [
|
|
'CIPTA_HPNE' => "Oleh $panggilan pada $timestamp",
|
|
'KET_HPNE' => $ket_hpne,
|
|
'FU_HPNE' => $fu_hpne,
|
|
'STATUS_HPNE' => $status_hpne,
|
|
];
|
|
$action = $this->Amod->update('histori_penawaran', $update, 'ID_HPNE', $id_hpne);
|
|
|
|
$value = 1;
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'value' => $value
|
|
]);
|
|
}
|
|
|
|
//SUBMENU PUSAT DATA - CETAK DOKUMEN
|
|
public function KP_Sub2_CetakDokumen_1() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$now = date('Y-m-d');
|
|
$limit = date('Y-m-01');
|
|
$month = $this->Amod->generate_inisialMonth(date('m'));
|
|
$year = date('Y');
|
|
$timelimit = strtoupper("$month $year");
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "KP", "PUSAT DATA - Cetak Dokumen");
|
|
$id_menu = $datShm[0]['MENU_ID'];
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$datPenawaran = $this->Amod->getData_CetakDokumen_byPENAWARAN_byPERIODE_orderDESC($limit, $now);
|
|
$no = 0;
|
|
foreach ($datPenawaran as $key) {
|
|
$urutan = $this->Amod->generate_textUrutan($key['SJ_INV']);
|
|
|
|
$datPenawaran[$no++] += ['URUTAN' => $urutan];
|
|
}
|
|
|
|
$datStpos = $this->Amod->getData_SetTogglePosisi_byKARYAWAN_byMENU($id_karyawan, $id_menu);
|
|
if ($datStpos==FALSE) { $posisiToggle = 0; } else { $posisiToggle = $datStpos[0]['AKTIF_STPOS']; }
|
|
|
|
$data = array(
|
|
'sidebar' => "menu kpi",
|
|
'navChild' => "kpi cetak",
|
|
'tgl' => $now,
|
|
'penawaran' => $datPenawaran,
|
|
'countPenawaran' => count($datPenawaran),
|
|
'posisiToggle' => $posisiToggle,
|
|
'id_menu' => $id_menu,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil,
|
|
'timelimit' => $timelimit,
|
|
);
|
|
$this->load->view('proses/KP_Sub2_CetakDokumen_1', $data);
|
|
}
|
|
|
|
public function KP_Sub2_CetakDokumen_2() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$now = date('Y-m-d');
|
|
$limit = date('Y-m-01');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "KP", "PUSAT DATA - Cetak Dokumen");
|
|
$id_menu = $datShm[0]['MENU_ID'];
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
if ($hak<=3) {
|
|
$limit = $this->Amod->generate_subMonth($limit, 3);
|
|
$timelimit = strtoupper("3 Bulan Kebelakang");
|
|
} else {
|
|
$limit = $this->Amod->generate_subMonth($limit, 6);
|
|
$timelimit = strtoupper("6 Bulan Kebelakang");
|
|
}
|
|
|
|
$datPenawaran = $this->Amod->getData_CetakDokumen_byPENAWARAN_byPERIODE_orderDESC($limit, $now);
|
|
$no = 0;
|
|
foreach ($datPenawaran as $key) {
|
|
$urutan = $this->Amod->generate_textUrutan($key['SJ_INV']);
|
|
|
|
$datPenawaran[$no++] += ['URUTAN' => $urutan];
|
|
}
|
|
|
|
$datStpos = $this->Amod->getData_SetTogglePosisi_byKARYAWAN_byMENU($id_karyawan, $id_menu);
|
|
if ($datStpos==FALSE) { $posisiToggle = 0; } else { $posisiToggle = $datStpos[0]['AKTIF_STPOS']; }
|
|
|
|
$data = array(
|
|
'sidebar' => "menu kpi",
|
|
'navChild' => "kpi cetak",
|
|
'tgl' => $now,
|
|
'penawaran' => $datPenawaran,
|
|
'countPenawaran' => count($datPenawaran),
|
|
'posisiToggle' => $posisiToggle,
|
|
'id_menu' => $id_menu,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil,
|
|
'timelimit' => $timelimit,
|
|
);
|
|
$this->load->view('proses/KP_Sub2_CetakDokumen_2', $data);
|
|
}
|
|
|
|
//SUBMENU PUSAT DATA - INFORMASI
|
|
public function KP_Sub2_Informasi_1($id=null) {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "KP", "PUSAT DATA - Informasi");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
if ($id==null) {
|
|
$posisiToggle = 0;
|
|
} else {
|
|
$posisiToggle = $id;
|
|
}
|
|
|
|
$datPkpi = $this->Amod->getData_PeriodeKpi_orderDESC();
|
|
|
|
$data = array(
|
|
'sidebar' => "menu kpi",
|
|
'navChild' => "kpi informasi",
|
|
'hak' => $hak,
|
|
'tampil' => $tampil,
|
|
'posisiToggle' => $posisiToggle,
|
|
'pkpi' => $datPkpi,
|
|
);
|
|
$this->load->view('proses/KP_Sub2_Informasi_1', $data);
|
|
}
|
|
|
|
public function KP_Ambil_Sub2_DataInformasi() {
|
|
$versi = $this->input->post('versi');
|
|
$nama_panggilan = $this->input->post('nama_panggilan');
|
|
$id_pkpi = $this->input->post('id_pkpi');
|
|
$search = $this->input->post('search');
|
|
|
|
$datPkpi = $this->Amod->getData_PeriodeKpi_byID($id_pkpi);
|
|
$awal = $datPkpi[0]['AWAL_PKPI'];
|
|
$akhir = $datPkpi[0]['AKHIR_PKPI'];
|
|
$nama = $datPkpi[0]['NAMA_PKPI'];
|
|
|
|
if ($versi==1 OR $versi==11 OR $versi==12 OR $versi==13 OR $versi==14 OR $versi==15) {
|
|
$datKaryawan = $this->Amod->getData_Karyawan_byPANGGILAN($nama_panggilan);
|
|
$id_karyawan = $datKaryawan[0]['ID_KARYAWAN'];
|
|
}
|
|
|
|
if ($versi==1) {
|
|
$sumHhpda = $this->Amod->getSum_HasilHitungPda_byKARYAWAN_byAWAL_byAKHIR_status1($id_karyawan, $awal, $akhir);
|
|
if ($sumHhpda==FALSE OR $sumHhpda[0]['TOTAL']==NULL) {
|
|
$kpiOmzet = "0.00";
|
|
} else {
|
|
$kpiOmzet = number_format($sumHhpda[0]['TOTAL'], 2);
|
|
}
|
|
|
|
$datPenawaran = $this->Amod->getData_Penawaran_byPERIODE_statusAktif($awal, $akhir, $search);
|
|
$kpiPenawaran = 0;
|
|
foreach ($datPenawaran as $key) {
|
|
$listSales = explode(',', $key['SALES_PENAWARAN']);
|
|
foreach ($listSales as $dat) {
|
|
$datKaryawan = $this->Amod->getData_Karyawan_byID($dat);
|
|
if ($datKaryawan[0]['NAMA_PANGGILAN_KARYAWAN']==$nama_panggilan) {
|
|
if ($datKaryawan[0]['NAMA_JABATAN']=="SALES CHANNEL") {
|
|
$nilai_penawaran = $key['NILAI_PENAWARAN'];
|
|
} else if (sizeof($listSales)==1) {
|
|
$nilai_penawaran = $key['NILAI_PENAWARAN'];
|
|
} else {
|
|
$sumDpne = $this->Amod->getSum_DaftarPenawaran_byPENAWARAN_byVERSI_bySALES($key['ID_PENAWARAN'], $key['AKTIF_PENAWARAN'], $id_karyawan);
|
|
if ($sumDpne==FALSE OR $sumDpne[0]['TOTAL']==NULL) {
|
|
$nilai_penawaran = 0;
|
|
} else {
|
|
$nilai_penawaran = $sumDpne[0]['TOTAL'];
|
|
}
|
|
}
|
|
|
|
$kpiPenawaran = $kpiPenawaran+round($nilai_penawaran,2);
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
$kpiVisit = 0;
|
|
$datKunjungan = $this->Amod->getData_Kunjungan_byPERIODE_statusNot9($awal, $akhir, $search);
|
|
foreach ($datKunjungan as $key) {
|
|
$listSales = explode(',', $key['SALES_KUNJUNGAN']);
|
|
foreach ($listSales as $dat) {
|
|
if ($dat==$id_karyawan) {
|
|
$kpiVisit++;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
$datDpcNb = $this->Amod->getData_DaftarPromoClearance_bySALES_byAWAL_byAKHIR_byJENIS($id_karyawan, $awal, $akhir, 2);
|
|
$kpiNb = 0;
|
|
foreach ($datDpcNb as $key) {
|
|
$nilaiSo = round(($key['QTY_DO']*$key['HARGA_DO'])*(($key['PPN_SO']+100)/100),2);
|
|
$kpiNb = $kpiNb+$nilaiSo;
|
|
}
|
|
|
|
$datDpcAio = $this->Amod->getData_DaftarPromoClearance_bySALES_byAWAL_byAKHIR_byJENIS($id_karyawan, $awal, $akhir, 3);
|
|
$kpiAio = 0;
|
|
foreach ($datDpcAio as $key) {
|
|
$nilaiSo = round(($key['QTY_DO']*$key['HARGA_DO'])*(($key['PPN_SO']+100)/100),2);
|
|
$kpiAio = $kpiAio+$nilaiSo;
|
|
}
|
|
|
|
$data[0] = [
|
|
'TRANSAKSI' => "Omzet Keseluruhan <b style='color:DarkOrchid'>$nama</b>",
|
|
'NILAI' => $kpiOmzet,
|
|
];
|
|
|
|
$data[1] = [
|
|
'TRANSAKSI' => "Penawaran <b style='color:DarkOrchid'>$nama</b>",
|
|
'NILAI' => number_format($kpiPenawaran, 2),
|
|
];
|
|
|
|
$data[2] = [
|
|
'TRANSAKSI' => "Visit Pelanggan <b style='color:DarkOrchid'>$nama</b>",
|
|
'NILAI' => $kpiVisit,
|
|
];
|
|
|
|
$data[3] = [
|
|
'TRANSAKSI' => "Clearance AIO <b style='color:DarkOrchid'>$nama</b>",
|
|
'NILAI' => number_format($kpiAio, 2),
|
|
];
|
|
|
|
$data[4] = [
|
|
'TRANSAKSI' => "Clearance NB <b style='color:DarkOrchid'>$nama</b>",
|
|
'NILAI' => number_format($kpiNb, 2),
|
|
];
|
|
} else if ($versi==11) {
|
|
$data = $this->Amod->getData_HasilHitungPda_byKARYAWAN_byAWAL_byAKHIR_status1($datKaryawan[0]['ID_KARYAWAN'], $awal, $akhir, $search);
|
|
} else if ($versi==12) {
|
|
$datPenawaran = $this->Amod->getData_Penawaran_byPERIODE_statusAktif($awal, $akhir, $search);
|
|
$data = [];
|
|
$no = 0;
|
|
foreach ($datPenawaran as $key) {
|
|
$listSales = explode(',', $key['SALES_PENAWARAN']);
|
|
foreach ($listSales as $dat) {
|
|
$datKaryawan = $this->Amod->getData_Karyawan_byID($dat);
|
|
if ($datKaryawan[0]['NAMA_PANGGILAN_KARYAWAN']==$nama_panggilan) {
|
|
if ($datKaryawan[0]['NAMA_JABATAN']=="SALES CHANNEL") {
|
|
$nilai_penawaran = $key['NILAI'];
|
|
$buat = 1;
|
|
} else if (sizeof($listSales)==1) {
|
|
$nilai_penawaran = $key['NILAI'];
|
|
$buat = 1;
|
|
} else {
|
|
$sumDpne = $this->Amod->getSum_DaftarPenawaran_byPENAWARAN_byVERSI_bySALES($key['ID_PENAWARAN'], $key['AKTIF_PENAWARAN'], $id_karyawan);
|
|
if ($sumDpne==FALSE OR $sumDpne[0]['TOTAL']==NULL) {
|
|
$nilai_penawaran = "0.00";
|
|
$buat = 0;
|
|
} else {
|
|
$nilai_penawaran = $sumDpne[0]['TOTAL'];
|
|
$buat = 1;
|
|
}
|
|
}
|
|
|
|
if ($buat==1) {
|
|
$data[$no++] = [
|
|
'ID' => $key['ID_PENAWARAN'],
|
|
'KODE_SO' => $key['KODE_PENAWARAN'],
|
|
'NAMA_PELANGGAN' => $key['PELANGGAN_PENAWARAN'],
|
|
'PERIHAL' => $key['PERIHAL_PENAWARAN'],
|
|
'NILAI' => $nilai_penawaran
|
|
];
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
} else if ($versi==13) {
|
|
$datKunjungan = $this->Amod->getData_Kunjungan_byPERIODE_statusNot9($awal, $akhir, $search);
|
|
$data = [];
|
|
$no = 0;
|
|
foreach ($datKunjungan as $key) {
|
|
$listSales = explode(',', $key['SALES_KUNJUNGAN']);
|
|
foreach ($listSales as $dat) {
|
|
if ($dat==$id_karyawan) {
|
|
$data[$no++] = [
|
|
'ID' => $key['ID_KUNJUNGAN'],
|
|
'KODE_SO' => $key['TANGGAL'],
|
|
'NAMA_PELANGGAN' => $key['PELANGGAN_KUNJUNGAN'],
|
|
'PERIHAL' => $key['TUJUAN_KUNJUNGAN'],
|
|
'NILAI' => $key['NAMA_SKUN']
|
|
];
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
} else if ($versi==14 OR $versi==15) {
|
|
if ($versi==14) {
|
|
$jenis = 3;
|
|
} else if ($versi==15) {
|
|
$jenis = 2;
|
|
}
|
|
$data = $this->Amod->getData_DaftarPromoClearance_bySALES_byAWAL_byAKHIR_byJENIS($datKaryawan[0]['ID_KARYAWAN'], $awal, $akhir, $jenis, $search);
|
|
$no = 0;
|
|
foreach ($data as $key) {
|
|
$nilai = round(($key['QTY_DO']*$key['HARGA_DO'])*(($key['PPN_SO']+100)/100),2);
|
|
|
|
$data[$no++] += ['NILAI' => number_format($nilai, 2)];
|
|
}
|
|
}
|
|
|
|
$this->output_json([
|
|
'data' => $data,
|
|
'nama' => $nama,
|
|
]);
|
|
}
|
|
|
|
//Daftar Menu CD [Cetak Dokumen]
|
|
public function CD_ReturPembelian_1($ex) { // Validasi
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$now = date('Y-m-d');
|
|
$bulan = strtoupper($this->Amod->generate_inisialMonth(date('m')));
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "PB", "PUSAT DATA - Cetak Dokumen");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$data = array(
|
|
'sidebar' => "",
|
|
'navChild' => "",
|
|
'ex' => $ex,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil,
|
|
'tgl' => $now,
|
|
'bulan' => $bulan,
|
|
);
|
|
$this->load->view('proses/CD_ReturPembelian_1', $data);
|
|
}
|
|
|
|
public function CD_SjPenjualan_1($ex) { // Validasi
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$now = date('Y-m-d');
|
|
$bulan = strtoupper($this->Amod->generate_inisialMonth(date('m')));
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "PJ", "PUSAT DATA - Cetak Dokumen");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$data = array(
|
|
'sidebar' => "",
|
|
'navChild' => "",
|
|
'ex' => $ex,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil,
|
|
'tgl' => $now,
|
|
'bulan' => $bulan,
|
|
);
|
|
$this->load->view('proses/CD_SjPenjualan_1', $data);
|
|
}
|
|
|
|
//Daftar Menu IN [Informasi]
|
|
public function IN_CekFee_1($ex) { // Validasi
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "KU", "PUSAT DATA - Informasi");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$data = array(
|
|
'sidebar' => "",
|
|
'navChild' => "",
|
|
'ex' => $ex,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil,
|
|
);
|
|
$this->load->view('proses/IN_CekFee_1', $data);
|
|
}
|
|
|
|
public function IN_Pembelian_1($ex) { // Validasi
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "PB", "PUSAT DATA - Informasi");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$data = array(
|
|
'sidebar' => "",
|
|
'navChild' => "",
|
|
'ex' => $ex,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil,
|
|
);
|
|
$this->load->view('proses/IN_Pembelian_1', $data);
|
|
}
|
|
|
|
public function IN_ReturPembelian_1($ex) { // Validasi
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "PB", "PUSAT DATA - Informasi");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$data = array(
|
|
'sidebar' => "",
|
|
'navChild' => "",
|
|
'ex' => $ex,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil,
|
|
);
|
|
$this->load->view('proses/IN_ReturPembelian_1', $data);
|
|
}
|
|
|
|
public function IN_StokDatang_1($ex) { // Validasi
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "PB", "PUSAT DATA - Informasi");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$data = array(
|
|
'sidebar' => "",
|
|
'navChild' => "",
|
|
'ex' => $ex,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil,
|
|
);
|
|
$this->load->view('proses/IN_StokDatang_1', $data);
|
|
}
|
|
|
|
//Daftar Menu LA [Laporan]
|
|
//SUBMENU TAMPILAN
|
|
public function LA_Pembelian_1($ex) { // Validasi
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$now = date('Y-m-d');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "PB", "PUSAT DATA - Laporan");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$datCorp = $this->Amod->getData_Corp_bySTATUS(1);
|
|
$datSupplier = $this->Amod->getData_Supplier_bySTATUS(1);
|
|
|
|
$data = array(
|
|
'sidebar' => "",
|
|
'navChild' => "",
|
|
'ex' => $ex,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil,
|
|
'tgl' => $now,
|
|
'corp' => $datCorp,
|
|
'supplier' => $datSupplier,
|
|
);
|
|
$this->load->view('proses/LA_Pembelian_1', $data);
|
|
}
|
|
|
|
public function LA_RekapKpiSales_1($ex) { // Validasi
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "KP", "PUSAT DATA - Laporan");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$datKadiv = $this->Amod->getData_Karyawan_byJABATAN(4);
|
|
$datPum = $this->Amod->getData_PeriodeUmum_byJENIS_orderDESC(2);
|
|
$cekPum = $this->Amod->getData_PeriodeUmum_byJENIS_byTGL(2, date('Y-m-d'));
|
|
if ($cekPum==FALSE) {
|
|
$id_pum = 0;
|
|
} else {
|
|
$id_pum = $cekPum[0]['ID_PUM'];
|
|
}
|
|
|
|
$data = array(
|
|
'sidebar' => "",
|
|
'navChild' => "",
|
|
'ex' => $ex,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil,
|
|
'kadiv' => $datKadiv,
|
|
'pum' => $datPum,
|
|
'id_pum' => $id_pum,
|
|
'id_karyawan' => $id_karyawan,
|
|
);
|
|
$this->load->view('proses/LA_RekapKpiSales_1', $data);
|
|
}
|
|
|
|
public function LA_ReturPembelian_1($ex) { // Validasi
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$now = date('Y-m-d');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "PB", "PUSAT DATA - Laporan");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$datCorp = $this->Amod->getData_Corp_bySTATUS(1);
|
|
$datSupplier = $this->Amod->getData_Supplier_bySTATUS(1);
|
|
|
|
$data = array(
|
|
'sidebar' => "",
|
|
'navChild' => "",
|
|
'ex' => $ex,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil,
|
|
'tgl' => $now,
|
|
'corp' => $datCorp,
|
|
'supplier' => $datSupplier,
|
|
);
|
|
$this->load->view('proses/LA_ReturPembelian_1', $data);
|
|
}
|
|
|
|
public function LA_StokSupplierPembelian_1($ex) { // Validasi
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$now = date('Y-m-d');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "PB", "PUSAT DATA - Laporan");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$datCorp = $this->Amod->getData_Corp_bySTATUS(1);
|
|
$datSupplier = $this->Amod->getData_Supplier_bySTATUS(1);
|
|
|
|
$data = array(
|
|
'sidebar' => "",
|
|
'navChild' => "",
|
|
'ex' => $ex,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil,
|
|
'tgl' => $now,
|
|
'corp' => $datCorp,
|
|
'supplier' => $datSupplier,
|
|
);
|
|
$this->load->view('proses/LA_StokSupplierPembelian_1', $data);
|
|
}
|
|
|
|
public function LA_StokTerbeli_1($ex) { // Validasi
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$now = date('Y-m-d');
|
|
|
|
$datShm = $this->Amod->getData_SetHakMenu_byKARYAWAN_byKODE_byNAMA($id_karyawan, "PB", "PUSAT DATA - Laporan");
|
|
$hak = $datShm[0]['AKSES_ID'];
|
|
$tampil = $datShm[0]['NAMA_AKSES'];
|
|
|
|
$datCorp = $this->Amod->getData_Corp_bySTATUS(1);
|
|
$datJenis = $this->Amod->getData_Jenis_bySTATUS(1);
|
|
$datMerk = $this->Amod->getData_Merk_bySTATUS(1);
|
|
$datModel = $this->Amod->getData_Model_bySTATUS(1);
|
|
$datProduk = $this->Amod->getData_Produk_bySTATUS(1);
|
|
$datSupplier = $this->Amod->getData_Supplier_bySTATUS(1);
|
|
|
|
$data = array(
|
|
'sidebar' => "",
|
|
'navChild' => "",
|
|
'ex' => $ex,
|
|
'hak' => $hak,
|
|
'tampil' => $tampil,
|
|
'tgl' => $now,
|
|
'corp' => $datCorp,
|
|
'jenis' => $datJenis,
|
|
'merk' => $datMerk,
|
|
'model' => $datModel,
|
|
'produk' => $datProduk,
|
|
'supplier' => $datSupplier,
|
|
);
|
|
$this->load->view('proses/LA_StokTerbeli_1', $data);
|
|
}
|
|
|
|
//FUNGSI LAPORAN
|
|
public function LA_Ambil_DataPembelian() { // Validasi
|
|
$id_supplier = $this->input->post('id_supplier');
|
|
$id_corp = $this->input->post('id_corp');
|
|
$awal = $this->input->post('awal');
|
|
$akhir = $this->input->post('akhir');
|
|
|
|
if ($id_supplier=="") {
|
|
$id_supplier = NULL;
|
|
}
|
|
|
|
if ($id_corp=="") {
|
|
$id_corp = NULL;
|
|
}
|
|
|
|
$data = $this->Amod->getData_Pembelian_byCORP_bySUPPLIER_byPERIODE_bySTATUS($id_corp, $id_supplier, $awal, $akhir, 1);
|
|
$no = 0;
|
|
$totDpp = 0;
|
|
foreach ($data as $key) {
|
|
$sumDb = $this->Amod->getSum_DaftarBeli_byPEMBELIAN($key['ID_PEMBELIAN']);
|
|
$dppDb = round($sumDb[0]['TOTAL'],2);
|
|
|
|
$ppnDb = round((($key['PPN_PEMBELIAN']/100)*$dppDb),2);
|
|
$totDb = $dppDb+$ppnDb;
|
|
|
|
$totDpp = $totDpp+$dppDb;
|
|
|
|
$data[$no] += ['PPNRATE' => round($key['PPN_PEMBELIAN'])];
|
|
$data[$no] += ['DPP' => number_format($dppDb, 2)];
|
|
$data[$no] += ['PPN' => number_format($ppnDb, 2)];
|
|
$data[$no++] += ['TOT' => number_format($totDb, 2)];
|
|
}
|
|
|
|
$this->output_json([
|
|
'data' => $data,
|
|
'totDpp' => number_format($totDpp,2),
|
|
]);
|
|
}
|
|
|
|
public function LA_Ambil_DataReturPembelian() { // Validasi
|
|
$id_supplier = $this->input->post('id_supplier');
|
|
$id_corp = $this->input->post('id_corp');
|
|
$awal = $this->input->post('awal');
|
|
$akhir = $this->input->post('akhir');
|
|
|
|
if ($id_supplier=="") {
|
|
$id_supplier = NULL;
|
|
}
|
|
|
|
if ($id_corp=="") {
|
|
$id_corp = NULL;
|
|
}
|
|
|
|
$data = $this->Amod->getData_ReturPembelian_byCORP_bySUPPLIER_byPERIODE_bySTATUS($id_corp, $id_supplier, $awal, $akhir, 1);
|
|
$no = 0;
|
|
$totDpp = 0;
|
|
foreach ($data as $key) {
|
|
$sumDrb = $this->Amod->getSum_DaftarReturBeli_byRB($key['ID_RB']);
|
|
$dppDrb = round($sumDrb[0]['TOTAL'],2);
|
|
|
|
$ppnDrb = round((($key['PPN_PEMBELIAN']/100)*$dppDrb),2);
|
|
$totDrb = $dppDrb+$ppnDrb;
|
|
|
|
$totDpp = $totDpp+$dppDrb;
|
|
|
|
$data[$no] += ['PPNRATE' => round($key['PPN_PEMBELIAN'])];
|
|
$data[$no] += ['DPP' => number_format($dppDrb, 2)];
|
|
$data[$no] += ['PPN' => number_format($ppnDrb, 2)];
|
|
$data[$no++] += ['TOT' => number_format($totDrb, 2)];
|
|
}
|
|
|
|
$this->output_json([
|
|
'data' => $data,
|
|
'totDpp' => number_format($totDpp,2),
|
|
]);
|
|
}
|
|
|
|
public function LA_Ambil_DataStokSupplierPembelian() { // Validasi
|
|
$id_supplier = $this->input->post('id_supplier');
|
|
$id_corp = $this->input->post('id_corp');
|
|
$awal = $this->input->post('awal');
|
|
$akhir = $this->input->post('akhir');
|
|
$search = $this->input->post('search');
|
|
|
|
if ($id_supplier == "") {
|
|
$id_supplier = NULL;
|
|
}
|
|
|
|
if ($id_corp == "") {
|
|
$id_corp = NULL;
|
|
}
|
|
|
|
$data = $this->Amod->getData_Pembelian_byCORP_bySUPPLIER_byPERIODE_bySTATUS($id_corp, $id_supplier, $awal, $akhir, 1);
|
|
$no = 0;
|
|
foreach ($data as $key) {
|
|
$list = "";
|
|
$datDb = $this->Amod->getData_DaftarBeli_byPEMBELIAN($key['ID_PEMBELIAN']);
|
|
foreach ($datDb as $dat) {
|
|
$qty = $dat['QTY_DB'];
|
|
$kode = $dat['KODE_BARANG'];
|
|
$list .= "[$qty EA] <b style='color:Teal'>$kode</b> <br \>";
|
|
}
|
|
|
|
$data[$no++] += ['LIST' => $list];
|
|
}
|
|
|
|
$this->output_json([
|
|
'data' => $data,
|
|
]);
|
|
}
|
|
|
|
public function LA_Ambil_DataStokTerbeli() { // Validasi
|
|
$id_supplier = $this->input->post('id_supplier');
|
|
$id_corp = $this->input->post('id_corp');
|
|
$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');
|
|
$awal = $this->input->post('awal');
|
|
$akhir = $this->input->post('akhir');
|
|
|
|
if ($id_supplier=="") {
|
|
$id_supplier = NULL;
|
|
}
|
|
|
|
if ($id_corp=="") {
|
|
$id_corp = NULL;
|
|
}
|
|
|
|
if ($id_jenis=="") {
|
|
$id_jenis = NULL;
|
|
}
|
|
|
|
if ($id_merk=="") {
|
|
$id_merk = NULL;
|
|
}
|
|
|
|
if ($id_model=="") {
|
|
$id_model = NULL;
|
|
}
|
|
|
|
if ($id_produk=="") {
|
|
$id_produk = NULL;
|
|
}
|
|
|
|
$data = $this->Amod->getData_DaftarBeli_byCORP_bySUPPLIER_byJENIS_byMERK_byMODEL_byPRODUK_byPERIODE_groupBARANG_status1($id_corp, $id_supplier, $id_jenis, $id_merk, $id_model, $id_produk, $awal, $akhir);
|
|
$total = 0;
|
|
foreach ($data as $key) {
|
|
$total = $total+$key['TOTAL'];
|
|
}
|
|
|
|
$this->output_json([
|
|
'data' => $data,
|
|
'total' => $total,
|
|
]);
|
|
}
|
|
|
|
public function LA_Excel_DataPembelian() { // Validasi
|
|
$awal = $this->input->post('tgl_awalfill');
|
|
$akhir = $this->input->post('tgl_akhirfill');
|
|
$jenis = $this->input->post('jenis_fill');
|
|
$id_supplier = $this->input->post('id_supplierfill');
|
|
$id_corp = $this->input->post('id_corpfill');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$hasil = [];
|
|
$noAwal = 0;
|
|
$noAkhir = 0;
|
|
|
|
if ($jenis==1) { // Campur jadi satu Laporan
|
|
$hasil[$noAwal] = [
|
|
'IDSHEET' => '0',
|
|
'FASHEET' => "CAMPUR",
|
|
'NASHEET' => "Sesuai Filter"
|
|
];
|
|
if ($id_corp=="") {
|
|
if ($id_supplier=="") {
|
|
$datPembelian = $this->Amod->getData_Pembelian_byCORP_bySUPPLIER_byPERIODE_bySTATUS(NULL, NULL, $awal, $akhir, 1);
|
|
$no = 0;
|
|
$subDpp = 0;
|
|
$subPpn = 0;
|
|
$subTot = 0;
|
|
foreach ($datPembelian as $dat) {
|
|
$sumDb = $this->Amod->getSum_DaftarBeli_byPEMBELIAN($dat['ID_PEMBELIAN']);
|
|
if ($sumDb[0]['TOTAL']==NULL) {
|
|
$dpp = 0;
|
|
} else {
|
|
$dpp = round($sumDb[0]['TOTAL'],2);
|
|
}
|
|
|
|
$ppnPem = round($dpp*($dat['PPN_PEMBELIAN']/100),2);
|
|
$totPem = round(($dpp+$ppnPem),2);
|
|
|
|
$subDpp = $subDpp+$dpp;
|
|
$subPpn = $subPpn+$ppnPem;
|
|
$subTot = $subTot+$totPem;
|
|
|
|
$datPembelian[$no] += ['DPPPEM' => number_format($dpp, 2)];
|
|
$datPembelian[$no] += ['PPNPEM' => number_format($ppnPem, 2)];
|
|
$datPembelian[$no] += ['TOTPEM' => number_format($totPem, 2)];
|
|
$datPembelian[$no++] += ['PPN' => round($dat['PPN_PEMBELIAN'])];
|
|
}
|
|
$hasil[$noAkhir] += ['SUBDPP' => number_format($subDpp,2)];
|
|
$hasil[$noAkhir] += ['SUBPPN' => number_format($subPpn,2)];
|
|
$hasil[$noAkhir] += ['SUBTOT' => number_format($subTot,2)];
|
|
$hasil[$noAkhir] += ['ISI' => $datPembelian];
|
|
} else {
|
|
$listSupplier = explode(",", $id_supplier);
|
|
$subPem = [];
|
|
$noPem = 0;
|
|
$subDpp = 0;
|
|
$subPpn = 0;
|
|
$subTot = 0;
|
|
foreach ($listSupplier as $dat) {
|
|
$datPembelian = $this->Amod->getData_Pembelian_byCORP_bySUPPLIER_byPERIODE_bySTATUS(NULL, $dat, $awal, $akhir, 1);
|
|
$no = 0;
|
|
foreach ($datPembelian as $dut) {
|
|
$sumDb = $this->Amod->getSum_DaftarBeli_byPEMBELIAN($dut['ID_PEMBELIAN']);
|
|
if ($sumDb[0]['TOTAL']==NULL) {
|
|
$dpp = 0;
|
|
} else {
|
|
$dpp = round($sumDb[0]['TOTAL'],2);
|
|
}
|
|
|
|
$ppnPem = round($dpp*($dut['PPN_PEMBELIAN']/100),2);
|
|
$totPem = round(($dpp+$ppnPem),2);
|
|
|
|
$subDpp = $subDpp+$dpp;
|
|
$subPpn = $subPpn+$ppnPem;
|
|
$subTot = $subTot+$totPem;
|
|
|
|
$datPembelian[$no] += ['DPPPEM' => number_format($dpp, 2)];
|
|
$datPembelian[$no] += ['PPNPEM' => number_format($ppnPem, 2)];
|
|
$datPembelian[$no] += ['TOTPEM' => number_format($totPem, 2)];
|
|
$datPembelian[$no++] += ['PPN' => round($dut['PPN_PEMBELIAN'])];
|
|
}
|
|
foreach ($datPembelian as $det) {
|
|
$subPem[$noPem++] = $det;
|
|
}
|
|
}
|
|
$hasil[$noAkhir] += ['SUBDPP' => number_format($subDpp,2)];
|
|
$hasil[$noAkhir] += ['SUBPPN' => number_format($subPpn,2)];
|
|
$hasil[$noAkhir] += ['SUBTOT' => number_format($subTot,2)];
|
|
$hasil[$noAkhir] += ['ISI' => $subPem];
|
|
}
|
|
} else {
|
|
$listCorp = explode(",", $id_corp);
|
|
$subPem = [];
|
|
$noPem = 0;
|
|
$subDpp = 0;
|
|
$subPpn = 0;
|
|
$subTot = 0;
|
|
foreach ($listCorp as $keydat) {
|
|
if ($id_supplier=="") {
|
|
$datPembelian = $this->Amod->getData_Pembelian_byCORP_bySUPPLIER_byPERIODE_bySTATUS($keydat, NULL, $awal, $akhir, 1);
|
|
$no = 0;
|
|
foreach ($datPembelian as $dat) {
|
|
$sumDb = $this->Amod->getSum_DaftarBeli_byPEMBELIAN($dat['ID_PEMBELIAN']);
|
|
if ($sumDb[0]['TOTAL']==NULL) {
|
|
$dpp = 0;
|
|
} else {
|
|
$dpp = round($sumDb[0]['TOTAL'],2);
|
|
}
|
|
|
|
$ppnPem = round($dpp*($dat['PPN_PEMBELIAN']/100),2);
|
|
$totPem = round(($dpp+$ppnPem),2);
|
|
|
|
$subDpp = $subDpp+$dpp;
|
|
$subPpn = $subPpn+$ppnPem;
|
|
$subTot = $subTot+$totPem;
|
|
|
|
$datPembelian[$no] += ['DPPPEM' => number_format($dpp, 2)];
|
|
$datPembelian[$no] += ['PPNPEM' => number_format($ppnPem, 2)];
|
|
$datPembelian[$no] += ['TOTPEM' => number_format($totPem, 2)];
|
|
$datPembelian[$no++] += ['PPN' => round($dat['PPN_PEMBELIAN'])];
|
|
}
|
|
foreach ($datPembelian as $det) {
|
|
$subPem[$noPem++] = $det;
|
|
}
|
|
} else {
|
|
$listSupplier = explode(",", $id_supplier);
|
|
foreach ($listSupplier as $dot) {
|
|
$datPembelian = $this->Amod->getData_Pembelian_byCORP_bySUPPLIER_byPERIODE_bySTATUS($keydat, $dot, $awal, $akhir, 1);
|
|
$no = 0;
|
|
foreach ($datPembelian as $dut) {
|
|
$sumDb = $this->Amod->getSum_DaftarBeli_byPEMBELIAN($dut['ID_PEMBELIAN']);
|
|
if ($sumDb[0]['TOTAL']==NULL) {
|
|
$dpp = 0;
|
|
} else {
|
|
$dpp = round($sumDb[0]['TOTAL'],2);
|
|
}
|
|
|
|
$ppnPem = round($dpp*($dut['PPN_PEMBELIAN']/100),2);
|
|
$totPem = round(($dpp+$ppnPem),2);
|
|
|
|
$subDpp = $subDpp+$dpp;
|
|
$subPpn = $subPpn+$ppnPem;
|
|
$subTot = $subTot+$totPem;
|
|
|
|
$datPembelian[$no] += ['DPPPEM' => number_format($dpp, 2)];
|
|
$datPembelian[$no] += ['PPNPEM' => number_format($ppnPem, 2)];
|
|
$datPembelian[$no] += ['TOTPEM' => number_format($totPem, 2)];
|
|
$datPembelian[$no++] += ['PPN' => round($dut['PPN_PEMBELIAN'])];
|
|
}
|
|
foreach ($datPembelian as $det) {
|
|
$subPem[$noPem++] = $det;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
$hasil[$noAkhir] += ['SUBDPP' => number_format($subDpp,2)];
|
|
$hasil[$noAkhir] += ['SUBPPN' => number_format($subPpn,2)];
|
|
$hasil[$noAkhir] += ['SUBTOT' => number_format($subTot,2)];
|
|
$hasil[$noAkhir] += ['ISI' => $subPem];
|
|
}
|
|
} else if ($jenis==2) { // Dipisah Supplier
|
|
$salSup = explode(",", $id_supplier);
|
|
foreach ($salSup as $key) {
|
|
$datSupplier = $this->Amod->getData_Supplier_byID($key);
|
|
$nama_supplier = $datSupplier[0]['NAMA_SUPPLIER'];
|
|
if (strlen($nama_supplier)>20) {
|
|
$namaSup = substr($nama_supplier, 0, 20);
|
|
$namaSup = "$namaSup..";
|
|
} else {
|
|
$namaSup = $nama_supplier;
|
|
}
|
|
$hasil[$noAwal++] = [
|
|
'IDSHEET' => $key,
|
|
'FASHEET' => $nama_supplier,
|
|
'NASHEET' => $namaSup
|
|
];
|
|
}
|
|
|
|
if ($id_corp=="") {
|
|
foreach ($hasil as $key) {
|
|
$datPembelian = $this->Amod->getData_Pembelian_byCORP_bySUPPLIER_byPERIODE_bySTATUS(NULL, $key['IDSHEET'], $awal, $akhir, 1);
|
|
$no = 0;
|
|
$subDpp = 0;
|
|
$subPpn = 0;
|
|
$subTot = 0;
|
|
foreach ($datPembelian as $dat) {
|
|
$sumDb = $this->Amod->getSum_DaftarBeli_byPEMBELIAN($dat['ID_PEMBELIAN']);
|
|
if ($sumDb[0]['TOTAL']==NULL) {
|
|
$dpp = 0;
|
|
} else {
|
|
$dpp = round($sumDb[0]['TOTAL'],2);
|
|
}
|
|
|
|
$ppnPem = round($dpp*($dat['PPN_PEMBELIAN']/100),2);
|
|
$totPem = round(($dpp+$ppnPem),2);
|
|
|
|
$subDpp = $subDpp+$dpp;
|
|
$subPpn = $subPpn+$ppnPem;
|
|
$subTot = $subTot+$totPem;
|
|
|
|
$datPembelian[$no] += ['DPPPEM' => number_format($dpp, 2)];
|
|
$datPembelian[$no] += ['PPNPEM' => number_format($ppnPem, 2)];
|
|
$datPembelian[$no] += ['TOTPEM' => number_format($totPem, 2)];
|
|
$datPembelian[$no++] += ['PPN' => round($dat['PPN_PEMBELIAN'])];
|
|
}
|
|
$hasil[$noAkhir] += ['SUBDPP' => number_format($subDpp,2)];
|
|
$hasil[$noAkhir] += ['SUBPPN' => number_format($subPpn,2)];
|
|
$hasil[$noAkhir] += ['SUBTOT' => number_format($subTot,2)];
|
|
$hasil[$noAkhir++] += ['ISI' => $datPembelian];
|
|
}
|
|
} else {
|
|
$listKop = explode(",", $id_corp);
|
|
foreach ($hasil as $key) {
|
|
$subPem = [];
|
|
$noPem = 0;
|
|
$subDpp = 0;
|
|
$subPpn = 0;
|
|
$subTot = 0;
|
|
foreach ($listKop as $dat) {
|
|
$datPembelian = $this->Amod->getData_Pembelian_byCORP_bySUPPLIER_byPERIODE_bySTATUS($dat, $key['IDSHEET'], $awal, $akhir, 1);
|
|
$no = 0;
|
|
foreach ($datPembelian as $dut) {
|
|
$sumDb = $this->Amod->getSum_DaftarBeli_byPEMBELIAN($dut['ID_PEMBELIAN']);
|
|
if ($sumDb[0]['TOTAL']==NULL) {
|
|
$dpp = 0;
|
|
} else {
|
|
$dpp = round($sumDb[0]['TOTAL'],2);
|
|
}
|
|
|
|
$ppnPem = round($dpp*($dut['PPN_PEMBELIAN']/100),2);
|
|
$totPem = round(($dpp+$ppnPem),2);
|
|
|
|
$subDpp = $subDpp+$dpp;
|
|
$subPpn = $subPpn+$ppnPem;
|
|
$subTot = $subTot+$totPem;
|
|
|
|
$datPembelian[$no] += ['DPPPEM' => number_format($dpp, 2)];
|
|
$datPembelian[$no] += ['PPNPEM' => number_format($ppnPem, 2)];
|
|
$datPembelian[$no] += ['TOTPEM' => number_format($totPem, 2)];
|
|
$datPembelian[$no++] += ['PPN' => round($dut['PPN_PEMBELIAN'])];
|
|
}
|
|
foreach ($datPembelian as $det) {
|
|
$subPem[$noPem++] = $det;
|
|
}
|
|
}
|
|
$hasil[$noAkhir] += ['SUBDPP' => number_format($subDpp,2)];
|
|
$hasil[$noAkhir] += ['SUBPPN' => number_format($subPpn,2)];
|
|
$hasil[$noAkhir] += ['SUBTOT' => number_format($subTot,2)];
|
|
$hasil[$noAkhir++] += ['ISI' => $subPem];
|
|
}
|
|
}
|
|
} else if ($jenis==3) { // Dipisah Kop
|
|
if ($id_corp=="") {
|
|
$salKop = $this->Amod->getData_Corp_bySTATUS(1);
|
|
foreach ($salKop as $key) {
|
|
$kop = $this->Amod->generate_inisialCorp($key['ID_CORP']);
|
|
$hasil[$noAwal++] = [
|
|
'IDSHEET' => $key['ID_CORP'],
|
|
'FASHEET' => $kop,
|
|
'NASHEET' => $kop
|
|
];
|
|
}
|
|
} else {
|
|
$salKop = explode(",", $id_corp);
|
|
foreach ($salKop as $key) {
|
|
$kop = $this->Amod->generate_inisialCorp($key);
|
|
$hasil[$noAwal++] = [
|
|
'IDSHEET' => $key,
|
|
'FASHEET' => $kop,
|
|
'NASHEET' => $kop
|
|
];
|
|
}
|
|
}
|
|
|
|
if ($id_supplier=="") {
|
|
foreach ($hasil as $key) {
|
|
$datPembelian = $this->Amod->getData_Pembelian_byCORP_bySUPPLIER_byPERIODE_bySTATUS($key['IDSHEET'], NULL, $awal, $akhir, 1);
|
|
$no = 0;
|
|
$subDpp = 0;
|
|
$subPpn = 0;
|
|
$subTot = 0;
|
|
foreach ($datPembelian as $dat) {
|
|
$sumDb = $this->Amod->getSum_DaftarBeli_byPEMBELIAN($dat['ID_PEMBELIAN']);
|
|
if ($sumDb[0]['TOTAL']==NULL) {
|
|
$dpp = 0;
|
|
} else {
|
|
$dpp = round($sumDb[0]['TOTAL'],2);
|
|
}
|
|
|
|
$ppnPem = round($dpp*($dat['PPN_PEMBELIAN']/100),2);
|
|
$totPem = round(($dpp+$ppnPem),2);
|
|
|
|
$subDpp = $subDpp+$dpp;
|
|
$subPpn = $subPpn+$ppnPem;
|
|
$subTot = $subTot+$totPem;
|
|
|
|
$datPembelian[$no] += ['DPPPEM' => number_format($dpp, 2)];
|
|
$datPembelian[$no] += ['PPNPEM' => number_format($ppnPem, 2)];
|
|
$datPembelian[$no] += ['TOTPEM' => number_format($totPem, 2)];
|
|
$datPembelian[$no++] += ['PPN' => round($dat['PPN_PEMBELIAN'])];
|
|
}
|
|
$hasil[$noAkhir] += ['SUBDPP' => number_format($subDpp,2)];
|
|
$hasil[$noAkhir] += ['SUBPPN' => number_format($subPpn,2)];
|
|
$hasil[$noAkhir] += ['SUBTOT' => number_format($subTot,2)];
|
|
$hasil[$noAkhir++] += ['ISI' => $datPembelian];
|
|
}
|
|
} else {
|
|
$listSupplier = explode(",", $id_supplier);
|
|
foreach ($hasil as $key) {
|
|
$subPem = [];
|
|
$noPem = 0;
|
|
$subDpp = 0;
|
|
$subPpn = 0;
|
|
$subTot = 0;
|
|
foreach ($listSupplier as $dat) {
|
|
$datPembelian = $this->Amod->getData_Pembelian_byCORP_bySUPPLIER_byPERIODE_bySTATUS($key['IDSHEET'], $dat, $awal, $akhir, 1);
|
|
$no = 0;
|
|
foreach ($datPembelian as $dut) {
|
|
$sumDb = $this->Amod->getSum_DaftarBeli_byPEMBELIAN($dut['ID_PEMBELIAN']);
|
|
if ($sumDb[0]['TOTAL']==NULL) {
|
|
$dpp = 0;
|
|
} else {
|
|
$dpp = round($sumDb[0]['TOTAL'],2);
|
|
}
|
|
|
|
$ppnPem = round($dpp*($dut['PPN_PEMBELIAN']/100),2);
|
|
$totPem = round(($dpp+$ppnPem),2);
|
|
|
|
$subDpp = $subDpp+$dpp;
|
|
$subPpn = $subPpn+$ppnPem;
|
|
$subTot = $subTot+$totPem;
|
|
|
|
$datPembelian[$no] += ['DPPPEM' => number_format($dpp, 2)];
|
|
$datPembelian[$no] += ['PPNPEM' => number_format($ppnPem, 2)];
|
|
$datPembelian[$no] += ['TOTPEM' => number_format($totPem, 2)];
|
|
$datPembelian[$no++] += ['PPN' => round($dut['PPN_PEMBELIAN'])];
|
|
}
|
|
foreach ($datPembelian as $det) {
|
|
$subPem[$noPem++] = $det;
|
|
}
|
|
}
|
|
$hasil[$noAkhir] += ['SUBDPP' => number_format($subDpp,2)];
|
|
$hasil[$noAkhir] += ['SUBPPN' => number_format($subPpn,2)];
|
|
$hasil[$noAkhir] += ['SUBTOT' => number_format($subTot,2)];
|
|
$hasil[$noAkhir++] += ['ISI' => $subPem];
|
|
}
|
|
}
|
|
}
|
|
|
|
$pilih_tabel = array('No', 'Kode', 'Tanggal', 'Kop', 'Supplier', 'Nomor SJ', 'Tanggal SJ', 'Nomor Nota', 'Tanggal Nota', 'Nomor PO', 'Rate PPN', 'TOP', 'Tukar TT', 'Jatuh Tempo', 'Nilai DPP', 'Nilai PPN', 'Nilai SUBTOTAL', 'Keterangan');
|
|
|
|
$data = [
|
|
'awal_nota' => date_format(date_create($awal), "d/m/Y"),
|
|
'akhir_nota' => date_format(date_create($akhir), "d/m/Y"),
|
|
'jumlah_kolom' => count($pilih_tabel),
|
|
'nama_tabel' => $pilih_tabel,
|
|
'jenis' => $jenis,
|
|
'hasil' => $hasil,
|
|
'ts' => $timestamp,
|
|
];
|
|
$this->load->view('cetak/LA_Excel_DataPembelian', $data);
|
|
}
|
|
|
|
public function LA_Excel_DataRekapKpiSales() { // Validasi
|
|
$id_pum = $this->input->post('id_pumfill');
|
|
$id_sales = $this->input->post('id_salesfill');
|
|
$jenis = $this->input->post('jenis_fill');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
if ($jenis==0) {
|
|
$filter = "Semua Data";
|
|
} else {
|
|
$datKaryawan = $this->Amod->getData_Karyawan_byID($jenis);
|
|
$kadiv = $datKaryawan[0]['NAMA_PANGGILAN_KARYAWAN'];
|
|
$filter = "Kadiv - $kadiv";
|
|
}
|
|
|
|
$datPum = $this->Amod->getData_PeriodeUmum_byID($id_pum);
|
|
$pilih_tabel = array('No', 'Parameter', 'Satuan', 'Target', 'Pencapaian', 'Presentase', 'Bobot', 'Nilai KPI');
|
|
|
|
$gambaran = [];
|
|
$salesLain = [];
|
|
$noGambaran = 0;
|
|
$noLain = 0;
|
|
$totTarTahun = 0;
|
|
$totTarOmz = 0;
|
|
$totTarPen = 0;
|
|
$totTarVis = 0;
|
|
$totPenOmz = 0;
|
|
$totPenPen = 0;
|
|
$totPenVis = 0;
|
|
$totKekOmz = 0;
|
|
if ($id_sales==0) {
|
|
$tampilGambaran = 1;
|
|
// Ambil Data Sales Individu
|
|
$anggota = $this->Amod->getData_Karyawan_byDIVISI_byKADIV(1, $jenis);
|
|
foreach ($anggota as $key) {
|
|
$datDkpi = $this->Amod->getData_DaftarKpi_byDIVISI_byPUM_byKARYAWAN_orderURUTAN(1, $id_pum, $key['ID_KARYAWAN']);
|
|
if ($datDkpi==TRUE) {
|
|
$totalBobot = 0;
|
|
$totalNilai = 0;
|
|
$nodkpi = 0;
|
|
foreach ($datDkpi as $dat) {
|
|
$pencapaian = 0;
|
|
$kpi = 0;
|
|
$nilai = 0;
|
|
$kurang = 0;
|
|
|
|
if ($dat['KPI_ID']==1) {
|
|
$datKaryawan = $this->Amod->getData_Karyawan_byDIVISI_byKADIV(1, $key['ID_KARYAWAN']);
|
|
foreach ($datKaryawan as $keydat) {
|
|
$sumHhpda = $this->Amod->getSum_HasilHitungPda_byKARYAWAN_byAWAL_byAKHIR_status1($keydat['ID_KARYAWAN'], $dat['AWAL_PUM'], $dat['AKHIR_PUM']);
|
|
if ($sumHhpda==FALSE OR $sumHhpda[0]['TOTAL']==NULL) {
|
|
$omzet = 0;
|
|
} else {
|
|
$omzet = round($sumHhpda[0]['TOTAL'],2);
|
|
}
|
|
$sumDrj = $this->Amod->getSum_DaftarReturJual_byKARYAWAN_byAWAL_byAKHIR_status1($keydat['ID_KARYAWAN'], $dat['AWAL_PUM'], $dat['AKHIR_PUM']);
|
|
if ($sumDrj==FALSE OR $sumDrj[0]['TOTAL']==NULL) {
|
|
$retur = 0;
|
|
} else {
|
|
$retur = round($sumDrj[0]['TOTAL'],2);
|
|
}
|
|
$pencapaian = $pencapaian+$omzet-$retur;
|
|
}
|
|
$presentase = round(($pencapaian/$dat['TARGET_DKPI'])*100, 0);
|
|
$kpi = (($presentase/100)*$dat['BOBOT_DKPI']);
|
|
$totalNilai = $totalNilai+round($kpi,0);
|
|
$nilai = number_format($kpi, 0);
|
|
$pencapaian = number_format($pencapaian, 2);
|
|
} else if ($dat['KPI_ID']==2) {
|
|
$datKaryawan = $this->Amod->getData_Karyawan_byDIVISI_byKADIV(1, $key['ID_KARYAWAN']);
|
|
$score = 0;
|
|
$totalAnggota = 0;
|
|
foreach ($datKaryawan as $keydut) {
|
|
if ($keydut['ID_KARYAWAN']!=$keydut['ANGGOTA_KARYAWAN']) {
|
|
$dataDkpi = $this->Amod->getData_DaftarKpi_byDIVISI_byPUM_byKARYAWAN_orderURUTAN(1, $id_pum, $keydut['ID_KARYAWAN']);
|
|
if ($dataDkpi==TRUE) {
|
|
$totalAnggota++;
|
|
}
|
|
foreach ($dataDkpi as $keydat) {
|
|
if ($keydat['KPI_ID']==3) {
|
|
$sumHhpda = $this->Amod->getSum_HasilHitungPda_byKARYAWAN_byAWAL_byAKHIR_status1($keydut['ID_KARYAWAN'], $keydat['AWAL_PUM'], $keydat['AKHIR_PUM']);
|
|
if ($sumHhpda==FALSE OR $sumHhpda[0]['TOTAL']==NULL) {
|
|
$omzet = 0;
|
|
} else {
|
|
$omzet = round($sumHhpda[0]['TOTAL'],2);
|
|
}
|
|
$sumDrj = $this->Amod->getSum_DaftarReturJual_byKARYAWAN_byAWAL_byAKHIR_status1($keydut['ID_KARYAWAN'], $keydat['AWAL_PUM'], $keydat['AKHIR_PUM']);
|
|
if ($sumDrj==FALSE OR $sumDrj[0]['TOTAL']==NULL) {
|
|
$retur = 0;
|
|
} else {
|
|
$retur = round($sumDrj[0]['TOTAL'],2);
|
|
}
|
|
$score = $score+round((($omzet-$retur)/$keydat['TARGET_DKPI']*$keydat['BOBOT_DKPI']), 0);
|
|
} else if ($keydat['KPI_ID']==4) {
|
|
$datPenawaran = $this->Amod->getData_Penawaran_byPERIODE_statusAktif($keydat['AWAL_PUM'], $keydat['AKHIR_PUM'], NULL);
|
|
$penawaran = 0;
|
|
foreach ($datPenawaran as $datkey) {
|
|
$listSales = explode(',', $datkey['SALES_PENAWARAN']);
|
|
foreach ($listSales as $keydot) {
|
|
$dataKaryawan = $this->Amod->getData_Karyawan_byID($keydot);
|
|
if ($dataKaryawan[0]['NAMA_PANGGILAN_KARYAWAN']==$keydut['NAMA_PANGGILAN_KARYAWAN']) {
|
|
if ($dataKaryawan[0]['NAMA_JABATAN']=="SALES CHANNEL") {
|
|
$nilai_penawaran = $datkey['NILAI_PENAWARAN'];
|
|
} else if (sizeof($listSales)==1) {
|
|
$nilai_penawaran = $datkey['NILAI_PENAWARAN'];
|
|
} else {
|
|
$sumDpne = $this->Amod->getSum_DaftarPenawaran_byPENAWARAN_byVERSI_bySALES($datkey['ID_PENAWARAN'], $datkey['AKTIF_PENAWARAN'], $keydut['ID_KARYAWAN']);
|
|
if ($sumDpne==FALSE OR $sumDpne[0]['TOTAL']==NULL) {
|
|
$nilai_penawaran = 0;
|
|
} else {
|
|
$nilai_penawaran = $sumDpne[0]['TOTAL'];
|
|
}
|
|
}
|
|
|
|
$penawaran = $penawaran+round($nilai_penawaran,2);
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
$score = $score+round(($penawaran/$keydat['TARGET_DKPI']*$keydat['BOBOT_DKPI']), 0);
|
|
} else if ($keydat['KPI_ID']==5) {
|
|
$datKunjungan = $this->Amod->getData_Kunjungan_byPERIODE_statusNot9($keydat['AWAL_PUM'], $keydat['AKHIR_PUM'], NULL);
|
|
$visit = 0;
|
|
foreach ($datKunjungan as $datkey) {
|
|
$listSales = explode(',', $datkey['SALES_KUNJUNGAN']);
|
|
foreach ($listSales as $keydot) {
|
|
if ($keydot==$keydut['ID_KARYAWAN']) {
|
|
$visit++;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
$score = $score+round(($visit/$keydat['TARGET_DKPI']*$keydat['BOBOT_DKPI']), 0);
|
|
} else if ($keydat['KPI_ID']==6) {
|
|
$datDpc = $this->Amod->getData_DaftarPromoClearance_bySALES_byAWAL_byAKHIR_byJENIS($keydut['KARYAWAN_ID'], $keydat['AWAL_PUM'], $keydat['AKHIR_PUM'], 3);
|
|
$omzet = 0;
|
|
foreach ($datDpc as $datkey) {
|
|
$nilaiSo = round(($datkey['QTY_DO']*$datkey['HARGA_DO'])*(($datkey['PPN_SO']+100)/100),2);
|
|
$omzet = $omzet+$nilaiSo;
|
|
}
|
|
$score = $score+round(($omzet/$keydat['TARGET_DKPI']*$keydat['BOBOT_DKPI']), 0);
|
|
} else if ($keydat['KPI_ID']==7) {
|
|
$datDpc = $this->Amod->getData_DaftarPromoClearance_bySALES_byAWAL_byAKHIR_byJENIS($keydut['KARYAWAN_ID'], $keydat['AWAL_PUM'], $keydat['AKHIR_PUM'], 2);
|
|
$omzet = 0;
|
|
foreach ($datDpc as $datkey) {
|
|
$nilaiSo = round(($datkey['QTY_DO']*$datkey['HARGA_DO'])*(($datkey['PPN_SO']+100)/100),2);
|
|
$omzet = $omzet+$nilaiSo;
|
|
}
|
|
$score = $score+round(($omzet/$keydat['TARGET_DKPI']*$keydat['BOBOT_DKPI']), 0);
|
|
} else if ($keydat['KPI_ID']==8) {
|
|
$datProyek = $this->Amod->getSum_Proyek_bySALES_byPERIODE_status12($keydut['KARYAWAN_ID'], $keydat['AWAL_PUM'], $keydat['AKHIR_PUM']);
|
|
if ($datProyek==FALSE OR $datProyek[0]['GP']==NULL) {
|
|
$omzet = 0;
|
|
} else {
|
|
$omzet = $datProyek[0]['GP'];
|
|
}
|
|
$score = $score+round(($omzet/$keydat['TARGET_DKPI']*$keydat['BOBOT_DKPI']), 0);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if ($key['ID_KARYAWAN']==31) { // Ditambah Tim ICT
|
|
$dataDkpi = $this->Amod->getData_DaftarKpi_byDIVISI_byPUM_byTIM_orderURUTAN(1, $id_pum, 1);
|
|
$ict = $this->Amod->getData_Karyawan_byTIM(1);
|
|
foreach ($dataDkpi as $dadut) {
|
|
$hasil = 0;
|
|
foreach ($ict as $dadit) {
|
|
if ($dadut['KPI_ID']==3) {
|
|
$sumHhpda = $this->Amod->getSum_HasilHitungPda_byKARYAWAN_byAWAL_byAKHIR_status1($dadit['ID_KARYAWAN'], $dadut['AWAL_PUM'], $dadut['AKHIR_PUM']);
|
|
if ($sumHhpda==FALSE OR $sumHhpda[0]['TOTAL']==NULL) {
|
|
$omzet = 0;
|
|
} else {
|
|
$omzet = round($sumHhpda[0]['TOTAL'],2);
|
|
}
|
|
|
|
$sumDrj = $this->Amod->getSum_DaftarReturJual_byKARYAWAN_byAWAL_byAKHIR_status1($dadit['ID_KARYAWAN'], $dadut['AWAL_PUM'], $dadut['AKHIR_PUM']);
|
|
if ($sumDrj==FALSE OR $sumDrj[0]['TOTAL']==NULL) {
|
|
$retur = 0;
|
|
} else {
|
|
$retur = round($sumDrj[0]['TOTAL'],2);
|
|
}
|
|
|
|
$hasil = $hasil+$omzet-$retur;
|
|
} else if ($dadut['KPI_ID']==4) {
|
|
$datPenawaran = $this->Amod->getData_Penawaran_byPERIODE_statusAktif($dadut['AWAL_PUM'], $dadut['AKHIR_PUM'], NULL);
|
|
foreach ($datPenawaran as $keydut) {
|
|
$listSales = explode(',', $keydut['SALES_PENAWARAN']);
|
|
foreach ($listSales as $keydat) {
|
|
$datKaryawan = $this->Amod->getData_Karyawan_byID($keydat);
|
|
if ($datKaryawan[0]['NAMA_PANGGILAN_KARYAWAN']==$dadit['NAMA_PANGGILAN_KARYAWAN']) {
|
|
if ($datKaryawan[0]['NAMA_JABATAN']=="SALES CHANNEL") {
|
|
$nilai_penawaran = $keydut['NILAI_PENAWARAN'];
|
|
} else if (sizeof($listSales)==1) {
|
|
$nilai_penawaran = $keydut['NILAI_PENAWARAN'];
|
|
} else {
|
|
$sumDpne = $this->Amod->getSum_DaftarPenawaran_byPENAWARAN_byVERSI_bySALES($keydut['ID_PENAWARAN'], $keydut['AKTIF_PENAWARAN'], $dadit['ID_KARYAWAN']);
|
|
if ($sumDpne==FALSE OR $sumDpne[0]['TOTAL']==NULL) {
|
|
$nilai_penawaran = 0;
|
|
} else {
|
|
$nilai_penawaran = $sumDpne[0]['TOTAL'];
|
|
}
|
|
}
|
|
|
|
$hasil = $hasil+round($nilai_penawaran,2);
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
} else if ($dadut['KPI_ID']==5) {
|
|
$datKunjungan = $this->Amod->getData_Kunjungan_byPERIODE_statusNot9($dadut['AWAL_PUM'], $dadut['AKHIR_PUM'], NULL);
|
|
foreach ($datKunjungan as $keydut) {
|
|
$listSales = explode(',', $keydut['SALES_KUNJUNGAN']);
|
|
foreach ($listSales as $keydat) {
|
|
if ($keydat==$dadit['ID_KARYAWAN']) {
|
|
$hasil++;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
$score = $score+round(($hasil/$dadut['TARGET_DKPI']*$dadut['BOBOT_DKPI']), 0);
|
|
}
|
|
$totalAnggota++;
|
|
}
|
|
|
|
if ($score==0 OR $totalAnggota==0) {
|
|
$pencapaian = 0;
|
|
} else {
|
|
$pencapaian = round(($score/$totalAnggota), 0);
|
|
}
|
|
$presentase = round(($pencapaian/$dat['TARGET_DKPI'])*100, 0);
|
|
$kpi = (($presentase/100)*$dat['BOBOT_DKPI']);
|
|
$totalNilai = $totalNilai+round($kpi,0);
|
|
$nilai = number_format($kpi, 0);
|
|
} else if ($dat['KPI_ID']==3) {
|
|
$sumHhpda = $this->Amod->getSum_HasilHitungPda_byKARYAWAN_byAWAL_byAKHIR_status1($key['ID_KARYAWAN'], $dat['AWAL_PUM'], $dat['AKHIR_PUM']);
|
|
if ($sumHhpda==FALSE OR $sumHhpda[0]['TOTAL']==NULL) {
|
|
$omzet = 0;
|
|
} else {
|
|
$omzet = round($sumHhpda[0]['TOTAL'],2);
|
|
}
|
|
|
|
$sumDrj = $this->Amod->getSum_DaftarReturJual_byKARYAWAN_byAWAL_byAKHIR_status1($key['ID_KARYAWAN'], $dat['AWAL_PUM'], $dat['AKHIR_PUM']);
|
|
if ($sumDrj==FALSE OR $sumDrj[0]['TOTAL']==NULL) {
|
|
$retur = 0;
|
|
} else {
|
|
$retur = round($sumDrj[0]['TOTAL'],2);
|
|
}
|
|
|
|
$pencapaian = number_format(($omzet-$retur), 2);
|
|
$presentase = round((($omzet-$retur)/$dat['TARGET_DKPI'])*100, 0);
|
|
$kpi = (($presentase/100)*$dat['BOBOT_DKPI']);
|
|
$totalNilai = $totalNilai+round($kpi,0);
|
|
$nilai = number_format($kpi, 0);
|
|
$totTarOmz = $totTarOmz+$dat['TARGET_DKPI'];
|
|
$totPenOmz = $totPenOmz+$omzet-$retur;
|
|
$kurang = $dat['TARGET_DKPI']-$omzet+$retur;
|
|
$totKekOmz = $totKekOmz+$kurang;
|
|
} else if ($dat['KPI_ID']==4) {
|
|
$datPenawaran = $this->Amod->getData_Penawaran_byPERIODE_statusAktif($dat['AWAL_PUM'], $dat['AKHIR_PUM'], NULL);
|
|
foreach ($datPenawaran as $keydut) {
|
|
$listSales = explode(',', $keydut['SALES_PENAWARAN']);
|
|
foreach ($listSales as $keydat) {
|
|
$datKaryawan = $this->Amod->getData_Karyawan_byID($keydat);
|
|
if ($datKaryawan[0]['NAMA_PANGGILAN_KARYAWAN']==$key['NAMA_PANGGILAN_KARYAWAN']) {
|
|
if ($datKaryawan[0]['NAMA_JABATAN']=="SALES CHANNEL") {
|
|
$nilai_penawaran = $keydut['NILAI_PENAWARAN'];
|
|
} else if (sizeof($listSales)==1) {
|
|
$nilai_penawaran = $keydut['NILAI_PENAWARAN'];
|
|
} else {
|
|
$sumDpne = $this->Amod->getSum_DaftarPenawaran_byPENAWARAN_byVERSI_bySALES($keydut['ID_PENAWARAN'], $keydut['AKTIF_PENAWARAN'], $key['ID_KARYAWAN']);
|
|
if ($sumDpne==FALSE OR $sumDpne[0]['TOTAL']==NULL) {
|
|
$nilai_penawaran = 0;
|
|
} else {
|
|
$nilai_penawaran = $sumDpne[0]['TOTAL'];
|
|
}
|
|
}
|
|
|
|
$pencapaian = $pencapaian+round($nilai_penawaran,2);
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
$presentase = round(($pencapaian/$dat['TARGET_DKPI'])*100, 0);
|
|
$kpi = (($presentase/100)*$dat['BOBOT_DKPI']);
|
|
$totalNilai = $totalNilai+round($kpi,0);
|
|
$totPenPen = $totPenPen+$pencapaian;
|
|
$pencapaian = number_format($pencapaian, 2);
|
|
$nilai = number_format($kpi, 0);
|
|
$totTarPen = $totTarPen+$dat['TARGET_DKPI'];
|
|
} else if ($dat['KPI_ID']==5) {
|
|
$datKunjungan = $this->Amod->getData_Kunjungan_byPERIODE_statusNot9($dat['AWAL_PUM'], $dat['AKHIR_PUM'], NULL);
|
|
foreach ($datKunjungan as $keydut) {
|
|
$listSales = explode(',', $keydut['SALES_KUNJUNGAN']);
|
|
foreach ($listSales as $keydat) {
|
|
if ($keydat==$key['ID_KARYAWAN']) {
|
|
$pencapaian++;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
$presentase = round(($pencapaian/$dat['TARGET_DKPI'])*100, 0);
|
|
$kpi = (($presentase/100)*$dat['BOBOT_DKPI']);
|
|
$totalNilai = $totalNilai+round($kpi,0);
|
|
$nilai = number_format($kpi, 0);
|
|
$totTarVis = $totTarVis+$dat['TARGET_DKPI'];
|
|
$totPenVis = $totPenVis+$pencapaian;
|
|
} else if ($dat['KPI_ID']==6) {
|
|
$datDpcAio = $this->Amod->getData_DaftarPromoClearance_bySALES_byAWAL_byAKHIR_byJENIS($key['ID_KARYAWAN'], $dat['AWAL_PUM'], $dat['AKHIR_PUM'], 3);
|
|
foreach ($datDpcAio as $keydat) {
|
|
$nilaiSo = round(($keydat['QTY_DO']*$keydat['HARGA_DO'])*(($keydat['PPN_SO']+100)/100),2);
|
|
$pencapaian = $pencapaian+$nilaiSo;
|
|
}
|
|
$presentase = round(($pencapaian/$dat['TARGET_DKPI'])*100, 0);
|
|
$kpi = (($presentase/100)*$dat['BOBOT_DKPI']);
|
|
$totalNilai = $totalNilai+round($kpi,0);
|
|
$pencapaian = number_format($pencapaian, 2);
|
|
$nilai = number_format($kpi, 0);
|
|
} else if ($dat['KPI_ID']==7) {
|
|
$datDpcNb = $this->Amod->getData_DaftarPromoClearance_bySALES_byAWAL_byAKHIR_byJENIS($key['ID_KARYAWAN'], $dat['AWAL_PUM'], $dat['AKHIR_PUM'], 2);
|
|
foreach ($datDpcNb as $keydat) {
|
|
$nilaiSo = round(($keydat['QTY_DO']*$keydat['HARGA_DO'])*(($keydat['PPN_SO']+100)/100),2);
|
|
$pencapaian = $pencapaian+$nilaiSo;
|
|
}
|
|
$presentase = round(($pencapaian/$dat['TARGET_DKPI'])*100, 0);
|
|
$kpi = (($presentase/100)*$dat['BOBOT_DKPI']);
|
|
$totalNilai = $totalNilai+round($kpi,0);
|
|
$pencapaian = number_format($pencapaian, 2);
|
|
$nilai = number_format($kpi, 0);
|
|
} else if ($dat['KPI_ID']==8) {
|
|
$datProyek = $this->Amod->getSum_Proyek_bySALES_byPERIODE_status12($key['ID_KARYAWAN'], $dat['AWAL_PUM'], $dat['AKHIR_PUM']);
|
|
if ($datProyek==FALSE OR $datProyek[0]['GP']==NULL) {
|
|
$pencapaian = 0;
|
|
} else {
|
|
$pencapaian = $datProyek[0]['GP'];
|
|
}
|
|
$presentase = round(($pencapaian/$dat['TARGET_DKPI'])*100, 0);
|
|
$kpi = (($presentase/100)*$dat['BOBOT_DKPI']);
|
|
$totalNilai = $totalNilai+round($kpi,0);
|
|
$pencapaian = number_format($pencapaian, 2);
|
|
$nilai = number_format($kpi, 0);
|
|
}
|
|
|
|
$totalBobot = $totalBobot+$dat['BOBOT_DKPI'];
|
|
|
|
$datDkpi[$nodkpi] += ['KEKURANGAN' => number_format($kurang,2)];
|
|
$datDkpi[$nodkpi] += ['PENCAPAIAN' => $pencapaian];
|
|
$datDkpi[$nodkpi] += ['PRESENTASE' => $presentase];
|
|
$datDkpi[$nodkpi++] += ['NILAI' => $nilai];
|
|
}
|
|
$sumTarget = $this->Amod->getSum_DaftarKpi_byKARYAWAN_byKPI_byTAHUN($key['ID_KARYAWAN'], 3, $datPum[0]['TAHUN_PUM']);
|
|
if ($sumTarget[0]['TARGET']==NULL) {
|
|
$tarTahun = 0;
|
|
} else {
|
|
$tarTahun = $sumTarget[0]['TARGET'];
|
|
$totTarTahun = $totTarTahun+round($tarTahun,2);
|
|
}
|
|
$gambaran[$noGambaran++] = [
|
|
'NAMA_PANGGILAN_KARYAWAN' => $key['NAMA_PANGGILAN_KARYAWAN'],
|
|
'NAMA_JABATAN' => $key['NAMA_JABATAN'],
|
|
'TOTBOBOT' => $totalBobot,
|
|
'TOTNILAI' => $totalNilai,
|
|
'TARTAHUN' => number_format($tarTahun,2),
|
|
'ISI' => $datDkpi
|
|
];
|
|
} else {
|
|
if ($key['TIM_KARYAWAN']==NULL) {
|
|
$salesLain[$noLain++] = [
|
|
'ID_KARYAWAN' => $key['ID_KARYAWAN'],
|
|
'NAMA_PANGGILAN_KARYAWAN' => $key['NAMA_PANGGILAN_KARYAWAN'],
|
|
];
|
|
}
|
|
}
|
|
}
|
|
|
|
// Khusus Tim nya Mas Anton, Div ICT
|
|
if ($jenis==31) {
|
|
$datDkpi = $this->Amod->getData_DaftarKpi_byDIVISI_byPUM_byTIM_orderURUTAN(1, $id_pum, 1);
|
|
$ict = $this->Amod->getData_Karyawan_byTIM(1);
|
|
$totalBobot = 0;
|
|
$totalNilai = 0;
|
|
$nodkpi = 0;
|
|
$rounder = 2;
|
|
foreach ($datDkpi as $key) {
|
|
$pencapaian = 0;
|
|
$kpi = 0;
|
|
$nilai = 0;
|
|
$presentase = 0;
|
|
$kurang = 0;
|
|
foreach ($ict as $dat) {
|
|
if ($key['KPI_ID']==3) {
|
|
$sumHhpda = $this->Amod->getSum_HasilHitungPda_byKARYAWAN_byAWAL_byAKHIR_status1($dat['ID_KARYAWAN'], $key['AWAL_PUM'], $key['AKHIR_PUM']);
|
|
if ($sumHhpda==FALSE OR $sumHhpda[0]['TOTAL']==NULL) {
|
|
$omzet = 0;
|
|
} else {
|
|
$omzet = round($sumHhpda[0]['TOTAL'],2);
|
|
}
|
|
|
|
$sumDrj = $this->Amod->getSum_DaftarReturJual_byKARYAWAN_byAWAL_byAKHIR_status1($dat['ID_KARYAWAN'], $key['AWAL_PUM'], $key['AKHIR_PUM']);
|
|
if ($sumDrj==FALSE OR $sumDrj[0]['TOTAL']==NULL) {
|
|
$retur = 0;
|
|
} else {
|
|
$retur = round($sumDrj[0]['TOTAL'],2);
|
|
}
|
|
|
|
$pencapaian = $pencapaian+$omzet-$retur;
|
|
} else if ($key['KPI_ID']==4) {
|
|
$datPenawaran = $this->Amod->getData_Penawaran_byPERIODE_statusAktif($key['AWAL_PUM'], $key['AKHIR_PUM'], NULL);
|
|
foreach ($datPenawaran as $keydut) {
|
|
$listSales = explode(',', $keydut['SALES_PENAWARAN']);
|
|
foreach ($listSales as $keydat) {
|
|
$datKaryawan = $this->Amod->getData_Karyawan_byID($keydat);
|
|
if ($datKaryawan[0]['NAMA_PANGGILAN_KARYAWAN']==$dat['NAMA_PANGGILAN_KARYAWAN']) {
|
|
if ($datKaryawan[0]['NAMA_JABATAN']=="SALES CHANNEL") {
|
|
$nilai_penawaran = $keydut['NILAI_PENAWARAN'];
|
|
} else if (sizeof($listSales)==1) {
|
|
$nilai_penawaran = $keydut['NILAI_PENAWARAN'];
|
|
} else {
|
|
$sumDpne = $this->Amod->getSum_DaftarPenawaran_byPENAWARAN_byVERSI_bySALES($keydut['ID_PENAWARAN'], $keydut['AKTIF_PENAWARAN'], $dat['ID_KARYAWAN']);
|
|
if ($sumDpne==FALSE OR $sumDpne[0]['TOTAL']==NULL) {
|
|
$nilai_penawaran = 0;
|
|
} else {
|
|
$nilai_penawaran = $sumDpne[0]['TOTAL'];
|
|
}
|
|
}
|
|
|
|
$pencapaian = $pencapaian+round($nilai_penawaran,2);
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
} else if ($key['KPI_ID']==5) {
|
|
$datKunjungan = $this->Amod->getData_Kunjungan_byPERIODE_statusNot9($key['AWAL_PUM'], $key['AKHIR_PUM'], NULL);
|
|
foreach ($datKunjungan as $keydut) {
|
|
$listSales = explode(',', $keydut['SALES_KUNJUNGAN']);
|
|
foreach ($listSales as $keydat) {
|
|
if ($keydat==$dat['ID_KARYAWAN']) {
|
|
$pencapaian++;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
$rounder = 0;
|
|
}
|
|
}
|
|
|
|
$presentase = round((($pencapaian)/$key['TARGET_DKPI'])*100, 0);
|
|
$kpi = (($presentase/100)*$key['BOBOT_DKPI']);
|
|
$nilai = number_format($kpi, 0);
|
|
|
|
$totalBobot = $totalBobot+$key['BOBOT_DKPI'];
|
|
$totalNilai = $totalNilai+round($kpi,0);
|
|
|
|
if ($key['KPI_ID']==3) {
|
|
$totTarOmz = $totTarOmz+$key['TARGET_DKPI'];
|
|
$totPenOmz = $totPenOmz+$pencapaian;
|
|
$kurang = $key['TARGET_DKPI']-$pencapaian;
|
|
$totKekOmz = $totKekOmz+$kurang;
|
|
} else if ($key['KPI_ID']==4) {
|
|
$totTarPen = $totTarPen+$key['TARGET_DKPI'];
|
|
$totPenPen = $totPenPen+$pencapaian;
|
|
} else if ($key['KPI_ID']==5) {
|
|
$totTarVis = $totTarVis+$key['TARGET_DKPI'];
|
|
$totPenVis = $totPenVis+$pencapaian;
|
|
}
|
|
|
|
$datDkpi[$nodkpi] += ['KEKURANGAN' => number_format($kurang, 2)];
|
|
$datDkpi[$nodkpi] += ['PENCAPAIAN' => number_format($pencapaian, $rounder)];
|
|
$datDkpi[$nodkpi] += ['PRESENTASE' => $presentase];
|
|
$datDkpi[$nodkpi++] += ['NILAI' => $nilai];
|
|
}
|
|
$sumTarget = $this->Amod->getSum_DaftarKpi_byTIM_byKPI_byTAHUN(1, 3, $datPum[0]['TAHUN_PUM']);
|
|
if ($sumTarget[0]['TARGET']==NULL) {
|
|
$tarTahun = 0;
|
|
} else {
|
|
$tarTahun = $sumTarget[0]['TARGET'];
|
|
$totTarTahun = $totTarTahun+round($tarTahun,2);
|
|
}
|
|
$gambaran[$noGambaran++] = [
|
|
'NAMA_PANGGILAN_KARYAWAN' => "Tim ICT",
|
|
'NAMA_JABATAN' => "SALES ICT",
|
|
'TOTBOBOT' => $totalBobot,
|
|
'TOTNILAI' => $totalNilai,
|
|
'TARTAHUN' => number_format($tarTahun, 2),
|
|
'ISI' => $datDkpi
|
|
];
|
|
}
|
|
|
|
//Sales Tanpa Target KPI
|
|
$nosal = 0;
|
|
foreach ($salesLain as $key) {
|
|
$sumHhpda = $this->Amod->getSum_HasilHitungPda_byKARYAWAN_byAWAL_byAKHIR_status1($key['ID_KARYAWAN'], $datPum[0]['AWAL_PUM'], $datPum[0]['AKHIR_PUM']);
|
|
if ($sumHhpda==FALSE OR $sumHhpda[0]['TOTAL']==NULL) {
|
|
$omzet = 0;
|
|
} else {
|
|
$omzet = round($sumHhpda[0]['TOTAL'],2);
|
|
}
|
|
|
|
$sumDrj = $this->Amod->getSum_DaftarReturJual_byKARYAWAN_byAWAL_byAKHIR_status1($key['ID_KARYAWAN'], $datPum[0]['AWAL_PUM'], $datPum[0]['AKHIR_PUM']);
|
|
if ($sumDrj==FALSE OR $sumDrj[0]['TOTAL']==NULL) {
|
|
$retur = 0;
|
|
} else {
|
|
$retur = round($sumDrj[0]['TOTAL'],2);
|
|
}
|
|
|
|
$totPenOmz = $totPenOmz+$omzet-$retur;
|
|
$salesLain[$nosal++] += ['PENCAPAIAN' => number_format(($omzet-$retur), 2)];
|
|
}
|
|
} else {
|
|
$tampilGambaran = 0;
|
|
|
|
$dataKaryawan = $this->Amod->getData_Karyawan_byID($id_sales);
|
|
|
|
$datDkpi = $this->Amod->getData_DaftarKpi_byDIVISI_byPUM_byKARYAWAN_orderURUTAN(1, $id_pum, $id_sales);
|
|
if ($datDkpi==TRUE) {
|
|
$totalBobot = 0;
|
|
$totalNilai = 0;
|
|
$nodkpi = 0;
|
|
foreach ($datDkpi as $dat) {
|
|
$pencapaian = 0;
|
|
$kpi = 0;
|
|
$nilai = 0;
|
|
if ($dat['KPI_ID']==1) {
|
|
$datKaryawan = $this->Amod->getData_Karyawan_byDIVISI_byKADIV(1, $id_sales);
|
|
foreach ($datKaryawan as $keydat) {
|
|
$sumHhpda = $this->Amod->getSum_HasilHitungPda_byKARYAWAN_byAWAL_byAKHIR_status1($keydat['ID_KARYAWAN'], $dat['AWAL_PUM'], $dat['AKHIR_PUM']);
|
|
if ($sumHhpda==FALSE OR $sumHhpda[0]['TOTAL']==NULL) {
|
|
$omzet = 0;
|
|
} else {
|
|
$omzet = round($sumHhpda[0]['TOTAL'],2);
|
|
}
|
|
$sumDrj = $this->Amod->getSum_DaftarReturJual_byKARYAWAN_byAWAL_byAKHIR_status1($keydat['ID_KARYAWAN'], $dat['AWAL_PUM'], $dat['AKHIR_PUM']);
|
|
if ($sumDrj==FALSE OR $sumDrj[0]['TOTAL']==NULL) {
|
|
$retur = 0;
|
|
} else {
|
|
$retur = round($sumDrj[0]['TOTAL'],2);
|
|
}
|
|
$pencapaian = $pencapaian+$omzet-$retur;
|
|
}
|
|
$presentase = round(($pencapaian/$dat['TARGET_DKPI'])*100, 0);
|
|
$kpi = (($presentase/100)*$dat['BOBOT_DKPI']);
|
|
$totalNilai = $totalNilai+round($kpi,0);
|
|
$nilai = number_format($kpi, 0);
|
|
$pencapaian = number_format($pencapaian, 2);
|
|
} else if ($dat['KPI_ID']==2) {
|
|
$datKaryawan = $this->Amod->getData_Karyawan_byDIVISI_byKADIV(1, $id_sales);
|
|
$score = 0;
|
|
$totalAnggota = 0;
|
|
foreach ($datKaryawan as $keydut) {
|
|
if ($keydut['ID_KARYAWAN']!=$keydut['ANGGOTA_KARYAWAN']) {
|
|
$dataDkpi = $this->Amod->getData_DaftarKpi_byDIVISI_byPUM_byKARYAWAN_orderURUTAN(1, $id_pum, $keydut['ID_KARYAWAN']);
|
|
if ($dataDkpi==TRUE) {
|
|
$totalAnggota++;
|
|
}
|
|
foreach ($dataDkpi as $keydat) {
|
|
if ($keydat['KPI_ID']==3) {
|
|
$sumHhpda = $this->Amod->getSum_HasilHitungPda_byKARYAWAN_byAWAL_byAKHIR_status1($keydut['ID_KARYAWAN'], $keydat['AWAL_PUM'], $keydat['AKHIR_PUM']);
|
|
if ($sumHhpda==FALSE OR $sumHhpda[0]['TOTAL']==NULL) {
|
|
$omzet = 0;
|
|
} else {
|
|
$omzet = round($sumHhpda[0]['TOTAL'],2);
|
|
}
|
|
$sumDrj = $this->Amod->getSum_DaftarReturJual_byKARYAWAN_byAWAL_byAKHIR_status1($keydut['ID_KARYAWAN'], $keydat['AWAL_PUM'], $keydat['AKHIR_PUM']);
|
|
if ($sumDrj==FALSE OR $sumDrj[0]['TOTAL']==NULL) {
|
|
$retur = 0;
|
|
} else {
|
|
$retur = round($sumDrj[0]['TOTAL'],2);
|
|
}
|
|
$score = $score+round((($omzet-$retur)/$keydat['TARGET_DKPI']*$keydat['BOBOT_DKPI']), 0);
|
|
} else if ($keydat['KPI_ID']==4) {
|
|
$datPenawaran = $this->Amod->getData_Penawaran_byPERIODE_statusAktif($keydat['AWAL_PUM'], $keydat['AKHIR_PUM'], NULL);
|
|
$penawaran = 0;
|
|
foreach ($datPenawaran as $datkey) {
|
|
$listSales = explode(',', $datkey['SALES_PENAWARAN']);
|
|
foreach ($listSales as $keydot) {
|
|
$ambilKaryawan = $this->Amod->getData_Karyawan_byID($keydot);
|
|
if ($ambilKaryawan[0]['NAMA_PANGGILAN_KARYAWAN']==$keydut['NAMA_PANGGILAN_KARYAWAN']) {
|
|
if ($ambilKaryawan[0]['NAMA_JABATAN']=="SALES CHANNEL") {
|
|
$nilai_penawaran = $datkey['NILAI_PENAWARAN'];
|
|
} else if (sizeof($listSales)==1) {
|
|
$nilai_penawaran = $datkey['NILAI_PENAWARAN'];
|
|
} else {
|
|
$sumDpne = $this->Amod->getSum_DaftarPenawaran_byPENAWARAN_byVERSI_bySALES($datkey['ID_PENAWARAN'], $datkey['AKTIF_PENAWARAN'], $keydut['ID_KARYAWAN']);
|
|
if ($sumDpne==FALSE OR $sumDpne[0]['TOTAL']==NULL) {
|
|
$nilai_penawaran = 0;
|
|
} else {
|
|
$nilai_penawaran = $sumDpne[0]['TOTAL'];
|
|
}
|
|
}
|
|
|
|
$penawaran = $penawaran+round($nilai_penawaran,2);
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
$score = $score+round(($penawaran/$keydat['TARGET_DKPI']*$keydat['BOBOT_DKPI']), 0);
|
|
} else if ($keydat['KPI_ID']==5) {
|
|
$datKunjungan = $this->Amod->getData_Kunjungan_byPERIODE_statusNot9($keydat['AWAL_PUM'], $keydat['AKHIR_PUM'], NULL);
|
|
$visit = 0;
|
|
foreach ($datKunjungan as $datkey) {
|
|
$listSales = explode(',', $datkey['SALES_KUNJUNGAN']);
|
|
foreach ($listSales as $keydot) {
|
|
if ($keydot==$keydut['ID_KARYAWAN']) {
|
|
$visit++;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
$score = $score+round(($visit/$keydat['TARGET_DKPI']*$keydat['BOBOT_DKPI']), 0);
|
|
} else if ($keydat['KPI_ID']==6) {
|
|
$datDpc = $this->Amod->getData_DaftarPromoClearance_bySALES_byAWAL_byAKHIR_byJENIS($keydut['KARYAWAN_ID'], $keydat['AWAL_PUM'], $keydat['AKHIR_PUM'], 3);
|
|
$omzet = 0;
|
|
foreach ($datDpc as $datkey) {
|
|
$nilaiSo = round(($datkey['QTY_DO']*$datkey['HARGA_DO'])*(($datkey['PPN_SO']+100)/100),2);
|
|
$omzet = $omzet+$nilaiSo;
|
|
}
|
|
$score = $score+round(($omzet/$keydat['TARGET_DKPI']*$keydat['BOBOT_DKPI']), 0);
|
|
} else if ($keydat['KPI_ID']==7) {
|
|
$datDpc = $this->Amod->getData_DaftarPromoClearance_bySALES_byAWAL_byAKHIR_byJENIS($keydut['KARYAWAN_ID'], $keydat['AWAL_PUM'], $keydat['AKHIR_PUM'], 2);
|
|
$omzet = 0;
|
|
foreach ($datDpc as $datkey) {
|
|
$nilaiSo = round(($datkey['QTY_DO']*$datkey['HARGA_DO'])*(($datkey['PPN_SO']+100)/100),2);
|
|
$omzet = $omzet+$nilaiSo;
|
|
}
|
|
$score = $score+round(($omzet/$keydat['TARGET_DKPI']*$keydat['BOBOT_DKPI']), 0);
|
|
} else if ($keydat['KPI_ID']==8) {
|
|
$datProyek = $this->Amod->getSum_Proyek_bySALES_byPERIODE_status12($keydut['KARYAWAN_ID'], $keydat['AWAL_PUM'], $keydat['AKHIR_PUM']);
|
|
if ($datProyek==FALSE OR $datProyek[0]['GP']==NULL) {
|
|
$omzet = 0;
|
|
} else {
|
|
$omzet = $datProyek[0]['GP'];
|
|
}
|
|
$score = $score+round(($omzet/$keydat['TARGET_DKPI']*$keydat['BOBOT_DKPI']), 0);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if ($id_sales==31) { // Ditambah Tim ICT
|
|
$dataDkpi = $this->Amod->getData_DaftarKpi_byDIVISI_byPUM_byTIM_orderURUTAN(1, $id_pum, 1);
|
|
$ict = $this->Amod->getData_Karyawan_byTIM(1);
|
|
foreach ($dataDkpi as $dadut) {
|
|
$hasil = 0;
|
|
foreach ($ict as $dadit) {
|
|
if ($dadut['KPI_ID']==3) {
|
|
$sumHhpda = $this->Amod->getSum_HasilHitungPda_byKARYAWAN_byAWAL_byAKHIR_status1($dadit['ID_KARYAWAN'], $dadut['AWAL_PUM'], $dadut['AKHIR_PUM']);
|
|
if ($sumHhpda==FALSE OR $sumHhpda[0]['TOTAL']==NULL) {
|
|
$omzet = 0;
|
|
} else {
|
|
$omzet = round($sumHhpda[0]['TOTAL'],2);
|
|
}
|
|
|
|
$sumDrj = $this->Amod->getSum_DaftarReturJual_byKARYAWAN_byAWAL_byAKHIR_status1($dadit['ID_KARYAWAN'], $dadut['AWAL_PUM'], $dadut['AKHIR_PUM']);
|
|
if ($sumDrj==FALSE OR $sumDrj[0]['TOTAL']==NULL) {
|
|
$retur = 0;
|
|
} else {
|
|
$retur = round($sumDrj[0]['TOTAL'],2);
|
|
}
|
|
|
|
$hasil = $hasil+$omzet-$retur;
|
|
} else if ($dadut['KPI_ID']==4) {
|
|
$datPenawaran = $this->Amod->getData_Penawaran_byPERIODE_statusAktif($dadut['AWAL_PUM'], $dadut['AKHIR_PUM'], NULL);
|
|
foreach ($datPenawaran as $keydut) {
|
|
$listSales = explode(',', $keydut['SALES_PENAWARAN']);
|
|
foreach ($listSales as $keydat) {
|
|
$datKaryawan = $this->Amod->getData_Karyawan_byID($keydat);
|
|
if ($datKaryawan[0]['NAMA_PANGGILAN_KARYAWAN']==$dadit['NAMA_PANGGILAN_KARYAWAN']) {
|
|
if ($datKaryawan[0]['NAMA_JABATAN']=="SALES CHANNEL") {
|
|
$nilai_penawaran = $keydut['NILAI_PENAWARAN'];
|
|
} else if (sizeof($listSales)==1) {
|
|
$nilai_penawaran = $keydut['NILAI_PENAWARAN'];
|
|
} else {
|
|
$sumDpne = $this->Amod->getSum_DaftarPenawaran_byPENAWARAN_byVERSI_bySALES($keydut['ID_PENAWARAN'], $keydut['AKTIF_PENAWARAN'], $dadit['ID_KARYAWAN']);
|
|
if ($sumDpne==FALSE OR $sumDpne[0]['TOTAL']==NULL) {
|
|
$nilai_penawaran = 0;
|
|
} else {
|
|
$nilai_penawaran = $sumDpne[0]['TOTAL'];
|
|
}
|
|
}
|
|
|
|
$hasil = $hasil+round($nilai_penawaran,2);
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
} else if ($dadut['KPI_ID']==5) {
|
|
$datKunjungan = $this->Amod->getData_Kunjungan_byPERIODE_statusNot9($dadut['AWAL_PUM'], $dadut['AKHIR_PUM'], NULL);
|
|
foreach ($datKunjungan as $keydut) {
|
|
$listSales = explode(',', $keydut['SALES_KUNJUNGAN']);
|
|
foreach ($listSales as $keydat) {
|
|
if ($keydat==$dadit['ID_KARYAWAN']) {
|
|
$hasil++;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
$score = $score+round(($hasil/$dadut['TARGET_DKPI']*$dadut['BOBOT_DKPI']), 0);
|
|
}
|
|
$totalAnggota++;
|
|
}
|
|
|
|
if ($score==0 OR $totalAnggota==0) {
|
|
$pencapaian = 0;
|
|
} else {
|
|
$pencapaian = round(($score/$totalAnggota), 0);
|
|
}
|
|
$presentase = round(($pencapaian/$dat['TARGET_DKPI'])*100, 0);
|
|
$kpi = (($presentase/100)*$dat['BOBOT_DKPI']);
|
|
$totalNilai = $totalNilai+round($kpi,0);
|
|
$nilai = number_format($kpi, 0);
|
|
} else if ($dat['KPI_ID']==3) {
|
|
$sumHhpda = $this->Amod->getSum_HasilHitungPda_byKARYAWAN_byAWAL_byAKHIR_status1($id_sales, $dat['AWAL_PUM'], $dat['AKHIR_PUM']);
|
|
if ($sumHhpda==FALSE OR $sumHhpda[0]['TOTAL']==NULL) {
|
|
$omzet = 0;
|
|
} else {
|
|
$omzet = round($sumHhpda[0]['TOTAL'],2);
|
|
}
|
|
|
|
$sumDrj = $this->Amod->getSum_DaftarReturJual_byKARYAWAN_byAWAL_byAKHIR_status1($id_sales, $dat['AWAL_PUM'], $dat['AKHIR_PUM']);
|
|
if ($sumDrj==FALSE OR $sumDrj[0]['TOTAL']==NULL) {
|
|
$retur = 0;
|
|
} else {
|
|
$retur = round($sumDrj[0]['TOTAL'],2);
|
|
}
|
|
|
|
$pencapaian = number_format(($omzet-$retur), 2);
|
|
$presentase = round((($omzet-$retur)/$dat['TARGET_DKPI'])*100, 0);
|
|
$kpi = (($presentase/100)*$dat['BOBOT_DKPI']);
|
|
$totalNilai = $totalNilai+round($kpi,0);
|
|
$nilai = number_format($kpi, 0);
|
|
} else if ($dat['KPI_ID']==4) {
|
|
$datPenawaran = $this->Amod->getData_Penawaran_byPERIODE_statusAktif($dat['AWAL_PUM'], $dat['AKHIR_PUM'], NULL);
|
|
foreach ($datPenawaran as $keydut) {
|
|
$listSales = explode(',', $keydut['SALES_PENAWARAN']);
|
|
foreach ($listSales as $keydat) {
|
|
$datKaryawan = $this->Amod->getData_Karyawan_byID($keydat);
|
|
if ($datKaryawan[0]['NAMA_PANGGILAN_KARYAWAN']==$dataKaryawan[0]['NAMA_PANGGILAN_KARYAWAN']) {
|
|
if ($datKaryawan[0]['NAMA_JABATAN']=="SALES CHANNEL") {
|
|
$nilai_penawaran = $keydut['NILAI_PENAWARAN'];
|
|
} else if (sizeof($listSales)==1) {
|
|
$nilai_penawaran = $keydut['NILAI_PENAWARAN'];
|
|
} else {
|
|
$sumDpne = $this->Amod->getSum_DaftarPenawaran_byPENAWARAN_byVERSI_bySALES($keydut['ID_PENAWARAN'], $keydut['AKTIF_PENAWARAN'], $id_sales);
|
|
if ($sumDpne==FALSE OR $sumDpne[0]['TOTAL']==NULL) {
|
|
$nilai_penawaran = 0;
|
|
} else {
|
|
$nilai_penawaran = $sumDpne[0]['TOTAL'];
|
|
}
|
|
}
|
|
|
|
$pencapaian = $pencapaian+round($nilai_penawaran,2);
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
$presentase = round(($pencapaian/$dat['TARGET_DKPI'])*100, 0);
|
|
$kpi = (($presentase/100)*$dat['BOBOT_DKPI']);
|
|
$totalNilai = $totalNilai+round($kpi,0);
|
|
$totPenPen = $totPenPen+$pencapaian;
|
|
$pencapaian = number_format($pencapaian, 2);
|
|
$nilai = number_format($kpi, 0);
|
|
} else if ($dat['KPI_ID']==5) {
|
|
$datKunjungan = $this->Amod->getData_Kunjungan_byPERIODE_statusNot9($dat['AWAL_PUM'], $dat['AKHIR_PUM'], NULL);
|
|
foreach ($datKunjungan as $keydut) {
|
|
$listSales = explode(',', $keydut['SALES_KUNJUNGAN']);
|
|
foreach ($listSales as $keydat) {
|
|
if ($keydat==$id_sales) {
|
|
$pencapaian++;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
$presentase = round(($pencapaian/$dat['TARGET_DKPI'])*100, 0);
|
|
$kpi = (($presentase/100)*$dat['BOBOT_DKPI']);
|
|
$totalNilai = $totalNilai+round($kpi,0);
|
|
$nilai = number_format($kpi, 0);
|
|
} else if ($dat['KPI_ID']==6) {
|
|
$datDpcAio = $this->Amod->getData_DaftarPromoClearance_bySALES_byAWAL_byAKHIR_byJENIS($id_sales, $dat['AWAL_PUM'], $dat['AKHIR_PUM'], 3);
|
|
foreach ($datDpcAio as $keydat) {
|
|
$nilaiSo = round(($keydat['QTY_DO']*$keydat['HARGA_DO'])*(($keydat['PPN_SO']+100)/100),2);
|
|
$pencapaian = $pencapaian+$nilaiSo;
|
|
}
|
|
$presentase = round(($pencapaian/$dat['TARGET_DKPI'])*100, 0);
|
|
$kpi = (($presentase/100)*$dat['BOBOT_DKPI']);
|
|
$totalNilai = $totalNilai+round($kpi,0);
|
|
$pencapaian = number_format($pencapaian, 2);
|
|
$nilai = number_format($kpi, 0);
|
|
} else if ($dat['KPI_ID']==7) {
|
|
$datDpcNb = $this->Amod->getData_DaftarPromoClearance_bySALES_byAWAL_byAKHIR_byJENIS($id_sales, $dat['AWAL_PUM'], $dat['AKHIR_PUM'], 2);
|
|
foreach ($datDpcNb as $keydat) {
|
|
$nilaiSo = round(($keydat['QTY_DO']*$keydat['HARGA_DO'])*(($keydat['PPN_SO']+100)/100),2);
|
|
$pencapaian = $pencapaian+$nilaiSo;
|
|
}
|
|
$presentase = round(($pencapaian/$dat['TARGET_DKPI'])*100, 0);
|
|
$kpi = (($presentase/100)*$dat['BOBOT_DKPI']);
|
|
$totalNilai = $totalNilai+round($kpi,0);
|
|
$pencapaian = number_format($pencapaian, 2);
|
|
$nilai = number_format($kpi, 0);
|
|
} else if ($dat['KPI_ID']==8) {
|
|
$datProyek = $this->Amod->getSum_Proyek_bySALES_byPERIODE_status12($id_sales, $dat['AWAL_PUM'], $dat['AKHIR_PUM']);
|
|
if ($datProyek==FALSE OR $datProyek[0]['GP']==NULL) {
|
|
$pencapaian = 0;
|
|
} else {
|
|
$pencapaian = $datProyek[0]['GP'];
|
|
}
|
|
$presentase = round(($pencapaian/$dat['TARGET_DKPI'])*100, 0);
|
|
$kpi = (($presentase/100)*$dat['BOBOT_DKPI']);
|
|
$totalNilai = $totalNilai+round($kpi,0);
|
|
$pencapaian = number_format($pencapaian, 2);
|
|
$nilai = number_format($kpi, 0);
|
|
}
|
|
|
|
$totalBobot = $totalBobot+$dat['BOBOT_DKPI'];
|
|
|
|
$datDkpi[$nodkpi] += ['PENCAPAIAN' => $pencapaian];
|
|
$datDkpi[$nodkpi] += ['PRESENTASE' => $presentase];
|
|
$datDkpi[$nodkpi++] += ['NILAI' => $nilai];
|
|
}
|
|
$gambaran[$noGambaran++] = [
|
|
'NAMA_PANGGILAN_KARYAWAN' => $dataKaryawan[0]['NAMA_PANGGILAN_KARYAWAN'],
|
|
'NAMA_JABATAN' => $dataKaryawan[0]['NAMA_JABATAN'],
|
|
'TOTBOBOT' => $totalBobot,
|
|
'TOTNILAI' => $totalNilai,
|
|
'ISI' => $datDkpi
|
|
];
|
|
}
|
|
}
|
|
|
|
if ($totPenOmz==0 OR $totTarOmz==0) {
|
|
$totPreOmz = 0;
|
|
} else {
|
|
$totPreOmz = ($totPenOmz/$totTarOmz)*100;
|
|
}
|
|
|
|
if ($totPenPen==0 OR $totTarPen==0) {
|
|
$totPrePen = 0;
|
|
} else {
|
|
$totPrePen = ($totPenPen/$totTarPen)*100;
|
|
}
|
|
|
|
if ($totPenVis==0 OR $totTarVis==0) {
|
|
$totPreVis = 0;
|
|
} else {
|
|
$totPreVis = ($totPenVis/$totTarVis)*100;
|
|
}
|
|
|
|
$data = [
|
|
'jumlah_kolom' => count($pilih_tabel),
|
|
'nama_tabel' => $pilih_tabel,
|
|
'filter' => $filter,
|
|
'laporan' => $gambaran,
|
|
'tambahan' => $salesLain,
|
|
'ts' => $timestamp,
|
|
'tampilGambaran' => $tampilGambaran,
|
|
'totTarTahun' => number_format($totTarTahun, 2),
|
|
'totTarOmz' => number_format($totTarOmz, 2),
|
|
'totTarPen' => number_format($totTarPen, 2),
|
|
'totTarVis' => number_format($totTarVis, 2),
|
|
'totPenOmz' => number_format($totPenOmz, 2),
|
|
'totPenPen' => number_format($totPenPen, 2),
|
|
'totPenVis' => number_format($totPenVis, 0),
|
|
'totKekOmz' => number_format($totKekOmz, 2),
|
|
'totPreOmz' => number_format($totPreOmz, 0),
|
|
'totPrePen' => number_format($totPrePen, 0),
|
|
'totPreVis' => number_format($totPreVis, 0),
|
|
'nama_pum' => $datPum[0]['NAMA_PUM'],
|
|
'awal' => $datPum[0]['AWAL'],
|
|
'akhir' => $datPum[0]['AKHIR'],
|
|
];
|
|
$this->load->view('cetak/LA_Excel_DataRekapKpiSales', $data);
|
|
}
|
|
|
|
public function LA_Excel_DataReturPembelian() { // Validasi
|
|
$awal = $this->input->post('tgl_awalfill');
|
|
$akhir = $this->input->post('tgl_akhirfill');
|
|
$jenis = $this->input->post('jenis_fill');
|
|
$id_supplier = $this->input->post('id_supplierfill');
|
|
$id_corp = $this->input->post('id_corpfill');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$hasil = [];
|
|
$noAwal = 0;
|
|
$noAkhir = 0;
|
|
|
|
if ($jenis==1) { // Campur jadi satu Laporan
|
|
$hasil[$noAwal] = [
|
|
'IDSHEET' => '0',
|
|
'FASHEET' => "CAMPUR",
|
|
'NASHEET' => "Sesuai Filter"
|
|
];
|
|
if ($id_corp=="") {
|
|
if ($id_supplier=="") {
|
|
$datRb = $this->Amod->getData_ReturPembelian_byCORP_bySUPPLIER_byPERIODE_bySTATUS(NULL, NULL, $awal, $akhir, 1);
|
|
$no = 0;
|
|
$subDpp = 0;
|
|
$subPpn = 0;
|
|
$subTot = 0;
|
|
foreach ($datRb as $dat) {
|
|
$sumDrb = $this->Amod->getSum_DaftarReturBeli_byRB($dat['ID_RB']);
|
|
if ($sumDrb[0]['TOTAL']==NULL) {
|
|
$dpp = 0;
|
|
} else {
|
|
$dpp = round($sumDrb[0]['TOTAL'],2);
|
|
}
|
|
|
|
$ppnPem = round($dpp*($dat['PPN_PEMBELIAN']/100),2);
|
|
$totPem = round(($dpp+$ppnPem),2);
|
|
|
|
$subDpp = $subDpp+$dpp;
|
|
$subPpn = $subPpn+$ppnPem;
|
|
$subTot = $subTot+$totPem;
|
|
|
|
$datRb[$no] += ['DPPPEM' => number_format($dpp, 2)];
|
|
$datRb[$no] += ['PPNPEM' => number_format($ppnPem, 2)];
|
|
$datRb[$no] += ['TOTPEM' => number_format($totPem, 2)];
|
|
$datRb[$no++] += ['PPN' => round($dat['PPN_PEMBELIAN'])];
|
|
}
|
|
$hasil[$noAkhir] += ['SUBDPP' => number_format($subDpp,2)];
|
|
$hasil[$noAkhir] += ['SUBPPN' => number_format($subPpn,2)];
|
|
$hasil[$noAkhir] += ['SUBTOT' => number_format($subTot,2)];
|
|
$hasil[$noAkhir] += ['ISI' => $datRb];
|
|
} else {
|
|
$listSupplier = explode(",", $id_supplier);
|
|
$subPem = [];
|
|
$noPem = 0;
|
|
$subDpp = 0;
|
|
$subPpn = 0;
|
|
$subTot = 0;
|
|
foreach ($listSupplier as $dat) {
|
|
$datRb = $this->Amod->getData_ReturPembelian_byCORP_bySUPPLIER_byPERIODE_bySTATUS(NULL, $dat, $awal, $akhir, 1);
|
|
$no = 0;
|
|
foreach ($datRb as $dut) {
|
|
$sumDrb = $this->Amod->getSum_DaftarReturBeli_byRB($dut['ID_RB']);
|
|
if ($sumDrb[0]['TOTAL']==NULL) {
|
|
$dpp = 0;
|
|
} else {
|
|
$dpp = round($sumDrb[0]['TOTAL'],2);
|
|
}
|
|
|
|
$ppnPem = round($dpp*($dut['PPN_PEMBELIAN']/100),2);
|
|
$totPem = round(($dpp+$ppnPem),2);
|
|
|
|
$subDpp = $subDpp+$dpp;
|
|
$subPpn = $subPpn+$ppnPem;
|
|
$subTot = $subTot+$totPem;
|
|
|
|
$datRb[$no] += ['DPPPEM' => number_format($dpp, 2)];
|
|
$datRb[$no] += ['PPNPEM' => number_format($ppnPem, 2)];
|
|
$datRb[$no] += ['TOTPEM' => number_format($totPem, 2)];
|
|
$datRb[$no++] += ['PPN' => round($dut['PPN_PEMBELIAN'])];
|
|
}
|
|
foreach ($datRb as $det) {
|
|
$subPem[$noPem++] = $det;
|
|
}
|
|
}
|
|
$hasil[$noAkhir] += ['SUBDPP' => number_format($subDpp,2)];
|
|
$hasil[$noAkhir] += ['SUBPPN' => number_format($subPpn,2)];
|
|
$hasil[$noAkhir] += ['SUBTOT' => number_format($subTot,2)];
|
|
$hasil[$noAkhir] += ['ISI' => $subPem];
|
|
}
|
|
} else {
|
|
$listCorp = explode(",", $id_corp);
|
|
$subPem = [];
|
|
$noPem = 0;
|
|
$subDpp = 0;
|
|
$subPpn = 0;
|
|
$subTot = 0;
|
|
foreach ($listCorp as $keydat) {
|
|
if ($id_supplier=="") {
|
|
$datRb = $this->Amod->getData_ReturPembelian_byCORP_bySUPPLIER_byPERIODE_bySTATUS($keydat, NULL, $awal, $akhir, 1);
|
|
$no = 0;
|
|
foreach ($datRb as $dat) {
|
|
$sumDrb = $this->Amod->getSum_DaftarReturBeli_byRB($dat['ID_RB']);
|
|
if ($sumDrb[0]['TOTAL']==NULL) {
|
|
$dpp = 0;
|
|
} else {
|
|
$dpp = round($sumDrb[0]['TOTAL'],2);
|
|
}
|
|
|
|
$ppnPem = round($dpp*($dat['PPN_PEMBELIAN']/100),2);
|
|
$totPem = round(($dpp+$ppnPem),2);
|
|
|
|
$subDpp = $subDpp+$dpp;
|
|
$subPpn = $subPpn+$ppnPem;
|
|
$subTot = $subTot+$totPem;
|
|
|
|
$datRb[$no] += ['DPPPEM' => number_format($dpp, 2)];
|
|
$datRb[$no] += ['PPNPEM' => number_format($ppnPem, 2)];
|
|
$datRb[$no] += ['TOTPEM' => number_format($totPem, 2)];
|
|
$datRb[$no++] += ['PPN' => round($dat['PPN_PEMBELIAN'])];
|
|
}
|
|
foreach ($datRb as $det) {
|
|
$subPem[$noPem++] = $det;
|
|
}
|
|
} else {
|
|
$listSupplier = explode(",", $id_supplier);
|
|
foreach ($listSupplier as $dot) {
|
|
$datRb = $this->Amod->getData_ReturPembelian_byCORP_bySUPPLIER_byPERIODE_bySTATUS($keydat, $dot, $awal, $akhir, 1);
|
|
$no = 0;
|
|
foreach ($datRb as $dut) {
|
|
$sumDrb = $this->Amod->getSum_DaftarReturBeli_byRB($dut['ID_RB']);
|
|
if ($sumDrb[0]['TOTAL']==NULL) {
|
|
$dpp = 0;
|
|
} else {
|
|
$dpp = round($sumDrb[0]['TOTAL'],2);
|
|
}
|
|
|
|
$ppnPem = round($dpp*($dut['PPN_PEMBELIAN']/100),2);
|
|
$totPem = round(($dpp+$ppnPem),2);
|
|
|
|
$subDpp = $subDpp+$dpp;
|
|
$subPpn = $subPpn+$ppnPem;
|
|
$subTot = $subTot+$totPem;
|
|
|
|
$datRb[$no] += ['DPPPEM' => number_format($dpp, 2)];
|
|
$datRb[$no] += ['PPNPEM' => number_format($ppnPem, 2)];
|
|
$datRb[$no] += ['TOTPEM' => number_format($totPem, 2)];
|
|
$datRb[$no++] += ['PPN' => round($dut['PPN_PEMBELIAN'])];
|
|
}
|
|
foreach ($datRb as $det) {
|
|
$subPem[$noPem++] = $det;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
$hasil[$noAkhir] += ['SUBDPP' => number_format($subDpp,2)];
|
|
$hasil[$noAkhir] += ['SUBPPN' => number_format($subPpn,2)];
|
|
$hasil[$noAkhir] += ['SUBTOT' => number_format($subTot,2)];
|
|
$hasil[$noAkhir] += ['ISI' => $subPem];
|
|
}
|
|
} else if ($jenis==2) { // Dipisah Supplier
|
|
$salSup = explode(",", $id_supplier);
|
|
foreach ($salSup as $key) {
|
|
$datSupplier = $this->Amod->getData_Supplier_byID($key);
|
|
$nama_supplier = $datSupplier[0]['NAMA_SUPPLIER'];
|
|
if (strlen($nama_supplier)>20) {
|
|
$namaSup = substr($nama_supplier, 0, 20);
|
|
$namaSup = "$namaSup..";
|
|
} else {
|
|
$namaSup = $nama_supplier;
|
|
}
|
|
$hasil[$noAwal++] = [
|
|
'IDSHEET' => $key,
|
|
'FASHEET' => $nama_supplier,
|
|
'NASHEET' => $namaSup
|
|
];
|
|
}
|
|
|
|
if ($id_corp=="") {
|
|
foreach ($hasil as $key) {
|
|
$datRb = $this->Amod->getData_ReturPembelian_byCORP_bySUPPLIER_byPERIODE_bySTATUS(NULL, $key['IDSHEET'], $awal, $akhir, 1);
|
|
$no = 0;
|
|
$subDpp = 0;
|
|
$subPpn = 0;
|
|
$subTot = 0;
|
|
foreach ($datRb as $dat) {
|
|
$sumDrb = $this->Amod->getSum_DaftarReturBeli_byRB($dat['ID_RB']);
|
|
if ($sumDrb[0]['TOTAL']==NULL) {
|
|
$dpp = 0;
|
|
} else {
|
|
$dpp = round($sumDrb[0]['TOTAL'],2);
|
|
}
|
|
|
|
$ppnPem = round($dpp*($dat['PPN_PEMBELIAN']/100),2);
|
|
$totPem = round(($dpp+$ppnPem),2);
|
|
|
|
$subDpp = $subDpp+$dpp;
|
|
$subPpn = $subPpn+$ppnPem;
|
|
$subTot = $subTot+$totPem;
|
|
|
|
$datRb[$no] += ['DPPPEM' => number_format($dpp, 2)];
|
|
$datRb[$no] += ['PPNPEM' => number_format($ppnPem, 2)];
|
|
$datRb[$no] += ['TOTPEM' => number_format($totPem, 2)];
|
|
$datRb[$no++] += ['PPN' => round($dat['PPN_PEMBELIAN'])];
|
|
}
|
|
$hasil[$noAkhir] += ['SUBDPP' => number_format($subDpp,2)];
|
|
$hasil[$noAkhir] += ['SUBPPN' => number_format($subPpn,2)];
|
|
$hasil[$noAkhir] += ['SUBTOT' => number_format($subTot,2)];
|
|
$hasil[$noAkhir++] += ['ISI' => $datRb];
|
|
}
|
|
} else {
|
|
$listKop = explode(",", $id_corp);
|
|
foreach ($hasil as $key) {
|
|
$subPem = [];
|
|
$noPem = 0;
|
|
$subDpp = 0;
|
|
$subPpn = 0;
|
|
$subTot = 0;
|
|
foreach ($listKop as $dat) {
|
|
$datRb = $this->Amod->getData_ReturPembelian_byCORP_bySUPPLIER_byPERIODE_bySTATUS($dat, $key['IDSHEET'], $awal, $akhir, 1);
|
|
$no = 0;
|
|
foreach ($datRb as $dut) {
|
|
$sumDrb = $this->Amod->getSum_DaftarReturBeli_byRB($dut['ID_RB']);
|
|
if ($sumDrb[0]['TOTAL']==NULL) {
|
|
$dpp = 0;
|
|
} else {
|
|
$dpp = round($sumDrb[0]['TOTAL'],2);
|
|
}
|
|
|
|
$ppnPem = round($dpp*($dut['PPN_PEMBELIAN']/100),2);
|
|
$totPem = round(($dpp+$ppnPem),2);
|
|
|
|
$subDpp = $subDpp+$dpp;
|
|
$subPpn = $subPpn+$ppnPem;
|
|
$subTot = $subTot+$totPem;
|
|
|
|
$datRb[$no] += ['DPPPEM' => number_format($dpp, 2)];
|
|
$datRb[$no] += ['PPNPEM' => number_format($ppnPem, 2)];
|
|
$datRb[$no] += ['TOTPEM' => number_format($totPem, 2)];
|
|
$datRb[$no++] += ['PPN' => round($dut['PPN_PEMBELIAN'])];
|
|
}
|
|
foreach ($datRb as $det) {
|
|
$subPem[$noPem++] = $det;
|
|
}
|
|
}
|
|
$hasil[$noAkhir] += ['SUBDPP' => number_format($subDpp,2)];
|
|
$hasil[$noAkhir] += ['SUBPPN' => number_format($subPpn,2)];
|
|
$hasil[$noAkhir] += ['SUBTOT' => number_format($subTot,2)];
|
|
$hasil[$noAkhir++] += ['ISI' => $subPem];
|
|
}
|
|
}
|
|
} else if ($jenis==3) { // Dipisah Kop
|
|
if ($id_corp=="") {
|
|
$salKop = $this->Amod->getData_Corp_bySTATUS(1);
|
|
foreach ($salKop as $key) {
|
|
$kop = $this->Amod->generate_inisialCorp($key['ID_CORP']);
|
|
$hasil[$noAwal++] = [
|
|
'IDSHEET' => $key['ID_CORP'],
|
|
'FASHEET' => $kop,
|
|
'NASHEET' => $kop
|
|
];
|
|
}
|
|
} else {
|
|
$salKop = explode(",", $id_corp);
|
|
foreach ($salKop as $key) {
|
|
$kop = $this->Amod->generate_inisialCorp($key);
|
|
$hasil[$noAwal++] = [
|
|
'IDSHEET' => $key,
|
|
'FASHEET' => $kop,
|
|
'NASHEET' => $kop
|
|
];
|
|
}
|
|
}
|
|
|
|
if ($id_supplier=="") {
|
|
foreach ($hasil as $key) {
|
|
$datRb = $this->Amod->getData_ReturPembelian_byCORP_bySUPPLIER_byPERIODE_bySTATUS($key['IDSHEET'], NULL, $awal, $akhir, 1);
|
|
$no = 0;
|
|
$subDpp = 0;
|
|
$subPpn = 0;
|
|
$subTot = 0;
|
|
foreach ($datRb as $dat) {
|
|
$sumDrb = $this->Amod->getSum_DaftarReturBeli_byRB($dat['ID_RB']);
|
|
if ($sumDrb[0]['TOTAL']==NULL) {
|
|
$dpp = 0;
|
|
} else {
|
|
$dpp = round($sumDrb[0]['TOTAL'],2);
|
|
}
|
|
|
|
$ppnPem = round($dpp*($dat['PPN_PEMBELIAN']/100),2);
|
|
$totPem = round(($dpp+$ppnPem),2);
|
|
|
|
$subDpp = $subDpp+$dpp;
|
|
$subPpn = $subPpn+$ppnPem;
|
|
$subTot = $subTot+$totPem;
|
|
|
|
$datRb[$no] += ['DPPPEM' => number_format($dpp, 2)];
|
|
$datRb[$no] += ['PPNPEM' => number_format($ppnPem, 2)];
|
|
$datRb[$no] += ['TOTPEM' => number_format($totPem, 2)];
|
|
$datRb[$no++] += ['PPN' => round($dat['PPN_PEMBELIAN'])];
|
|
}
|
|
$hasil[$noAkhir] += ['SUBDPP' => number_format($subDpp,2)];
|
|
$hasil[$noAkhir] += ['SUBPPN' => number_format($subPpn,2)];
|
|
$hasil[$noAkhir] += ['SUBTOT' => number_format($subTot,2)];
|
|
$hasil[$noAkhir++] += ['ISI' => $datRb];
|
|
}
|
|
} else {
|
|
$listSupplier = explode(",", $id_supplier);
|
|
foreach ($hasil as $key) {
|
|
$subPem = [];
|
|
$noPem = 0;
|
|
$subDpp = 0;
|
|
$subPpn = 0;
|
|
$subTot = 0;
|
|
foreach ($listSupplier as $dat) {
|
|
$datRb = $this->Amod->getData_ReturPembelian_byCORP_bySUPPLIER_byPERIODE_bySTATUS($key['IDSHEET'], $dat, $awal, $akhir, 1);
|
|
$no = 0;
|
|
foreach ($datRb as $dut) {
|
|
$sumDrb = $this->Amod->getSum_DaftarReturBeli_byRB($dut['ID_RB']);
|
|
if ($sumDrb[0]['TOTAL']==NULL) {
|
|
$dpp = 0;
|
|
} else {
|
|
$dpp = round($sumDrb[0]['TOTAL'],2);
|
|
}
|
|
|
|
$ppnPem = round($dpp*($dut['PPN_PEMBELIAN']/100),2);
|
|
$totPem = round(($dpp+$ppnPem),2);
|
|
|
|
$subDpp = $subDpp+$dpp;
|
|
$subPpn = $subPpn+$ppnPem;
|
|
$subTot = $subTot+$totPem;
|
|
|
|
$datRb[$no] += ['DPPPEM' => number_format($dpp, 2)];
|
|
$datRb[$no] += ['PPNPEM' => number_format($ppnPem, 2)];
|
|
$datRb[$no] += ['TOTPEM' => number_format($totPem, 2)];
|
|
$datRb[$no++] += ['PPN' => round($dut['PPN_PEMBELIAN'])];
|
|
}
|
|
foreach ($datRb as $det) {
|
|
$subPem[$noPem++] = $det;
|
|
}
|
|
}
|
|
$hasil[$noAkhir] += ['SUBDPP' => number_format($subDpp,2)];
|
|
$hasil[$noAkhir] += ['SUBPPN' => number_format($subPpn,2)];
|
|
$hasil[$noAkhir] += ['SUBTOT' => number_format($subTot,2)];
|
|
$hasil[$noAkhir++] += ['ISI' => $subPem];
|
|
}
|
|
}
|
|
}
|
|
|
|
$pilih_tabel = array('No', 'Kode', 'Tanggal', 'Kop', 'Supplier', 'Nomor Retur', 'Nomor Nota', 'Keterangan', 'Rate PPN', 'Nilai DPP', 'Nilai PPN', 'Nilai SUBTOTAL');
|
|
|
|
$data = [
|
|
'awal_nota' => date_format(date_create($awal), "d/m/Y"),
|
|
'akhir_nota' => date_format(date_create($akhir), "d/m/Y"),
|
|
'jumlah_kolom' => count($pilih_tabel),
|
|
'nama_tabel' => $pilih_tabel,
|
|
'jenis' => $jenis,
|
|
'hasil' => $hasil,
|
|
'ts' => $timestamp,
|
|
];
|
|
$this->load->view('cetak/LA_Excel_DataReturPembelian', $data);
|
|
}
|
|
|
|
public function LA_Excel_DataStokSupplierPembelian() { // Validasi
|
|
$awal = $this->input->post('tgl_awalfill');
|
|
$akhir = $this->input->post('tgl_akhirfill');
|
|
$id_supplier = $this->input->post('id_supplierfill');
|
|
$id_corp = $this->input->post('id_corpfill');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
$data = $this->Amod->getData_Pembelian_byCORP_bySUPPLIER_byPERIODE_bySTATUS($id_corp, $id_supplier, $awal, $akhir, 1);
|
|
$no = 0;
|
|
foreach ($data as $key) {
|
|
$list = "";
|
|
$counter = 1;
|
|
$datDb = $this->Amod->getData_DaftarBeli_byPEMBELIAN($key['ID_PEMBELIAN']);
|
|
foreach ($datDb as $dat) {
|
|
$qty = $dat['QTY_DB'];
|
|
$kode = $dat['KODE_BARANG'];
|
|
if (count($datDb)==$counter) {
|
|
$list .= "[$qty EA] $kode";
|
|
} else {
|
|
$list .= "[$qty EA] $kode \n";
|
|
}
|
|
$counter++;
|
|
}
|
|
|
|
$data[$no++] += ['LIST' => $list];
|
|
}
|
|
|
|
$pilih_tabel = array('No', 'Kop', 'Kode', 'Tanggal', 'Nomor SJ', 'Nomor Nota', 'Supplier', 'List Barang');
|
|
|
|
$data = [
|
|
'awal_nota' => date_format(date_create($awal), "d/m/Y"),
|
|
'akhir_nota' => date_format(date_create($akhir), "d/m/Y"),
|
|
'jumlah_kolom' => count($pilih_tabel),
|
|
'nama_tabel' => $pilih_tabel,
|
|
'hasil' => $data,
|
|
'ts' => $timestamp,
|
|
];
|
|
$this->load->view('cetak/LA_Excel_DataStokSupplierPembelian', $data);
|
|
}
|
|
|
|
public function LA_Excel_DataStokTerbeli() { // Validasi
|
|
$awal = $this->input->post('tgl_awalfill');
|
|
$akhir = $this->input->post('tgl_akhirfill');
|
|
$id_supplier = $this->input->post('id_supplierfill');
|
|
$id_corp = $this->input->post('id_corpfill');
|
|
$id_jenis = $this->input->post('id_jenisfill');
|
|
$id_merk = $this->input->post('id_merkfill');
|
|
$id_model = $this->input->post('id_modelfill');
|
|
$id_produk = $this->input->post('id_produkfill');
|
|
$timestamp = date('d/m/Y H:i:s');
|
|
|
|
if ($id_supplier=="") {
|
|
$id_supplier = NULL;
|
|
}
|
|
|
|
if ($id_corp=="") {
|
|
$id_corp = NULL;
|
|
}
|
|
|
|
if ($id_jenis=="") {
|
|
$id_jenis = NULL;
|
|
}
|
|
|
|
if ($id_merk=="") {
|
|
$id_merk = NULL;
|
|
}
|
|
|
|
if ($id_model=="") {
|
|
$id_model = NULL;
|
|
}
|
|
|
|
if ($id_produk=="") {
|
|
$id_produk = NULL;
|
|
}
|
|
|
|
$data = $this->Amod->getData_DaftarBeli_byCORP_bySUPPLIER_byJENIS_byMERK_byMODEL_byPRODUK_byPERIODE_groupBARANG_status1($id_corp, $id_supplier, $id_jenis, $id_merk, $id_model, $id_produk, $awal, $akhir);
|
|
$total = 0;
|
|
foreach ($data as $key) {
|
|
$total = $total+$key['TOTAL'];
|
|
}
|
|
|
|
$pilih_tabel = array('No', 'Jenis', 'Merk', 'Model', 'Produk', 'Kode', 'Nama', 'Total');
|
|
|
|
$data = [
|
|
'awal_nota' => date_format(date_create($awal), "d/m/Y"),
|
|
'akhir_nota' => date_format(date_create($akhir), "d/m/Y"),
|
|
'jumlah_kolom' => count($pilih_tabel),
|
|
'nama_tabel' => $pilih_tabel,
|
|
'ts' => $timestamp,
|
|
'hasil' => $data,
|
|
'total' => $total,
|
|
];
|
|
$this->load->view('cetak/PB_Excel_Sub2_DataAnalisaStokTerbeli', $data);
|
|
}
|
|
|
|
}
|