4614 lines
155 KiB
PHP
4614 lines
155 KiB
PHP
<?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 ManageLaporan extends CI_Controller
|
|
{
|
|
function __construct()
|
|
{
|
|
parent::__construct();
|
|
$this->load->model('ModelLaporan', 'Laporan');
|
|
//$this->load->model('ModelPenjualan', 'Penjualan');
|
|
$this->load->model('ModelDashboard', 'Dashboard');
|
|
$this->load->model('AllModels', 'Amod');
|
|
$this->load->library(['datatables', 'form_validation']);
|
|
$this->form_validation->set_error_delimiters('', '');
|
|
$this->Dashboard->ceklogin();
|
|
}
|
|
|
|
public function output_json($data, $encode = true)
|
|
{
|
|
if ($encode) $data = json_encode($data);
|
|
$this->output->set_content_type('application/json')->set_output($data);
|
|
}
|
|
|
|
//MENU PEMBELIAN
|
|
public function dataPembelian_Keuangan_A1() {
|
|
$kondisi = $this->input->post('kondisi');
|
|
$id_supplier = $this->input->post('id_supplier');
|
|
$id_corp = $this->input->post('id_corp');
|
|
$tgl = date('Y-m-d');
|
|
$datSupplier = $this->Laporan->getData_Supplier();
|
|
$datCorp = $this->Laporan->getData_Corp();
|
|
if ($kondisi==null){
|
|
$all = 0 ;
|
|
$id_corp = NULL;
|
|
$total_pembelian = NULL;
|
|
$id_supplier = NULL;
|
|
$tanggal_awal = date('Y-m-d');
|
|
$tanggal_akhir = date('Y-m-d');
|
|
$awal = date('d/m/Y');
|
|
$akhir = date('d/m/Y');
|
|
$title = "Belum Terpilih*";
|
|
} else if ($kondisi!=null AND $id_supplier=="") {
|
|
$all = 1;
|
|
$id_supplier = NULL;
|
|
$tanggal_awal = $this->input->post('tanggal_awal');
|
|
$tanggal_akhir = $this->input->post('tanggal_akhir');
|
|
$awal = date_format(date_create($tanggal_awal), "d/m/Y");
|
|
$akhir = date_format(date_create($tanggal_akhir), "d/m/Y");
|
|
$title = "Semua Supplier";
|
|
$sumHda = $this->Laporan->getSum_Pembelian_LaporanPembelian($tanggal_awal, $tanggal_akhir, $id_supplier, $id_corp);
|
|
$total_pembelian = $sumHda[0]['TOTAL'];
|
|
} else {
|
|
$all = 2;
|
|
$tanggal_awal = $this->input->post('tanggal_awal');
|
|
$tanggal_akhir = $this->input->post('tanggal_akhir');
|
|
$awal = date_format(date_create($tanggal_awal), "d/m/Y");
|
|
$akhir = date_format(date_create($tanggal_akhir), "d/m/Y");
|
|
$dataSupplier = $this->Laporan->getData_Supplier($id_supplier);
|
|
$nama_supplier = $dataSupplier[0]['NAMA_SUPPLIER'];
|
|
$nama_kota = $dataSupplier[0]['NAMA_KOTA'];
|
|
$title = "$nama_supplier ($nama_kota)";
|
|
$sumHda = $this->Laporan->getSum_Pembelian_LaporanPembelian($tanggal_awal, $tanggal_akhir, $id_supplier, $id_corp);
|
|
$total_pembelian = $sumHda[0]['TOTAL'];
|
|
}
|
|
$laporan = $this->Laporan->getData_Pembelian($tanggal_awal, $tanggal_akhir, $all, $id_supplier, $id_corp);
|
|
$data = [
|
|
'sidebar' => "menu laporan",
|
|
'navChild' => "laporan pembelian",
|
|
'laporan' => $laporan,
|
|
'tgl' => $tgl,
|
|
'corp' => $datCorp,
|
|
'supplier' => $datSupplier,
|
|
'sup' => $datSupplier,
|
|
'awal' => $awal,
|
|
'akhir' => $akhir,
|
|
'tanggal_awal' => $tanggal_awal,
|
|
'tanggal_akhir' => $tanggal_akhir,
|
|
'title' => $title,
|
|
'all' => $all,
|
|
'id_supplier' => $id_supplier,
|
|
'id_corp' => $id_corp,
|
|
'total_pembelian' => $total_pembelian
|
|
];
|
|
$this->load->view('proses/LaporanPembelian_Keuangan_A1', $data);
|
|
}
|
|
|
|
public function simpan_excel_pembelian() {
|
|
$start = $this->input->post('start');
|
|
$end = $this->input->post('end');
|
|
$all = $this->input->post('all');
|
|
$id_corp = $this->input->post('id_corp');
|
|
$id_supplier = $this->input->post('id_supplier');
|
|
|
|
if ($all==1) {
|
|
$pilih_tabel = array('No', 'Kode', 'Atas Nama', 'Supplier', 'Tanggal SJ', 'Nomor SJ', 'Tanggal Nota', 'Nomor Nota', 'PPN', 'TOP' , 'TT', 'Jatuh Tempo', 'Nilai DPP', 'Nilai PPN', 'Nilai TOTAL', 'Keterangan');
|
|
} else if ($all==2) {
|
|
$pilih_tabel = array('No', 'Kode', 'Atas Nama', 'Tanggal SJ', 'Nomor SJ', 'Tanggal Nota', 'Nomor Nota', 'PPN', 'TOP' , 'TT', 'Jatuh Tempo', 'Nilai DPP', 'Nilai PPN', 'Nilai TOTAL', 'Keterangan');
|
|
}
|
|
|
|
if ($all==2) {
|
|
$datSupplier = $this->Laporan->getData_Supplier($id_supplier);
|
|
$nama_supplier = $datSupplier[0]['NAMA_SUPPLIER'];
|
|
$nama_kota = $datSupplier[0]['NAMA_KOTA'];
|
|
$judul = "$nama_supplier ($nama_kota)";
|
|
} else {
|
|
$judul = "Semua Supplier";
|
|
}
|
|
|
|
$dataLaporan = $this->Laporan->getData_Pembelian($start, $end, $all, $id_supplier, $id_corp);
|
|
|
|
$data =
|
|
[
|
|
'title' => '',
|
|
'tanggal_awal' => date_format(date_create($start), "d/m/Y"),
|
|
'tanggal_akhir' => date_format(date_create($end), "d/m/Y"),
|
|
'jumlah_kolom' => count($pilih_tabel),
|
|
'nama_tabel' => $pilih_tabel,
|
|
'laporan' => $dataLaporan,
|
|
'judul' => $judul,
|
|
];
|
|
|
|
if ($all==1) {
|
|
$this->load->view('cetak/excel_pembelian_all', $data);
|
|
} else if ($all==2) {
|
|
$this->load->view('cetak/excel_pembelian_single', $data);
|
|
}
|
|
}
|
|
|
|
public function dataReturBeli_Keuangan_A1() {
|
|
$kondisi = $this->input->post('kondisi');
|
|
$id_supplier = $this->input->post('id_supplier');
|
|
$id_corp = $this->input->post('id_corp');
|
|
$tgl = date('Y-m-d');
|
|
$datSupplier = $this->Laporan->getData_Supplier();
|
|
$datCorp = $this->Laporan->getData_Corp();
|
|
|
|
if ($kondisi==null){
|
|
$id_corp = NULL;
|
|
$id_supplier = NULL;
|
|
$total_retur = NULL;
|
|
$all = 0 ;
|
|
$tanggal_awal = date('Y-m-d');
|
|
$tanggal_akhir = date('Y-m-d');
|
|
$awal = date('d/m/Y');
|
|
$akhir = date('d/m/Y');
|
|
$title = "Belum Terpilih*";
|
|
} else if ($kondisi!=null AND $id_supplier=="") {
|
|
$id_supplier = NULL;
|
|
$tanggal_awal = $this->input->post('tanggal_awal');
|
|
$tanggal_akhir = $this->input->post('tanggal_akhir');
|
|
$awal = date_format(date_create($tanggal_awal), "d/m/Y");
|
|
$akhir = date_format(date_create($tanggal_akhir), "d/m/Y");
|
|
$title = "Semua Supplier";
|
|
$all = 1;
|
|
$sumRetur = $this->Laporan->getSum_ReturBeli_LaporanPembelian($tanggal_awal, $tanggal_akhir, $id_supplier, $id_corp);
|
|
$total_retur = $sumRetur[0]['TOTAL'];
|
|
} else {
|
|
$all = 2;
|
|
$tanggal_awal = $this->input->post('tanggal_awal');
|
|
$tanggal_akhir = $this->input->post('tanggal_akhir');
|
|
$awal = date_format(date_create($tanggal_awal), "d/m/Y");
|
|
$akhir = date_format(date_create($tanggal_akhir), "d/m/Y");
|
|
$dataSupplier = $this->Laporan->getData_Supplier($id_supplier);
|
|
$nama_supplier = $dataSupplier[0]['NAMA_SUPPLIER'];
|
|
$nama_kota = $dataSupplier[0]['NAMA_KOTA'];
|
|
$title = "$nama_supplier ($nama_kota)";
|
|
$sumRetur = $this->Laporan->getSum_ReturBeli_LaporanPembelian($tanggal_awal, $tanggal_akhir, $id_supplier, $id_corp);
|
|
$total_retur = $sumRetur[0]['TOTAL'];
|
|
}
|
|
$laporan = $this->Laporan->getData_ReturBeli($tanggal_awal, $tanggal_akhir, $all, $id_supplier, $id_corp);
|
|
$data = [
|
|
'sidebar' => "menu laporan",
|
|
'navChild' => "laporan returbeli",
|
|
'laporan' => $laporan,
|
|
'tgl' => $tgl,
|
|
'corp' => $datCorp,
|
|
'supplier' => $datSupplier,
|
|
'sup' => $datSupplier,
|
|
'awal' => $awal,
|
|
'akhir' => $akhir,
|
|
'tanggal_awal' => $tanggal_awal,
|
|
'tanggal_akhir' => $tanggal_akhir,
|
|
'title' => $title,
|
|
'all' => $all,
|
|
'id_corp' => $id_corp,
|
|
'id_supplier' => $id_supplier,
|
|
'total_retur' => $total_retur
|
|
];
|
|
$this->load->view('proses/LaporanReturBeli_Keuangan_A1', $data);
|
|
}
|
|
|
|
public function simpan_excel_returbeli() {
|
|
$start = $this->input->post('start');
|
|
$end = $this->input->post('end');
|
|
$all = $this->input->post('all');
|
|
$id_corp = $this->input->post('id_corp');
|
|
$id_supplier = $this->input->post('id_supplier');
|
|
|
|
if ($all == 1) {
|
|
$pilih_tabel = array('No', 'Kode', 'Atas Nama', 'Supplier', 'Tanggal', 'Nota Pembelian', 'Nota Retur', 'PPN', 'Nilai DPP', 'Nilai PPN', 'Nilai TOTAL', 'Keterangan');
|
|
} else if ($all == 2) {
|
|
$pilih_tabel = array('No', 'Kode', 'Atas Nama', 'Tanggal', 'Nota Pembelian', 'Nota Retur', 'PPN', 'Nilai DPP', 'Nilai PPN', 'Nilai TOTAL', 'Keterangan');
|
|
}
|
|
|
|
if ($all==2) {
|
|
$datSupplier = $this->Laporan->getData_Supplier($id_supplier);
|
|
$nama_supplier = $datSupplier[0]['NAMA_SUPPLIER'];
|
|
$nama_kota = $datSupplier[0]['NAMA_KOTA'];
|
|
$judul = "$nama_supplier ($nama_kota)";
|
|
} else {
|
|
$judul = "Semua Supplier";
|
|
}
|
|
|
|
$dataLaporan = $this->Laporan->getData_ReturBeli($start, $end, $all, $id_supplier, $id_corp);
|
|
$data = [
|
|
'title' => '',
|
|
'tanggal_awal' => date_format(date_create($start), "d/m/Y"),
|
|
'tanggal_akhir' => date_format(date_create($end), "d/m/Y"),
|
|
'jumlah_kolom' => count($pilih_tabel),
|
|
'nama_tabel' => $pilih_tabel,
|
|
'laporan' => $dataLaporan,
|
|
'judul' => $judul,
|
|
];
|
|
|
|
if ($all == 1) {
|
|
$this->load->view('cetak/excel_returbeli_all', $data);
|
|
} else if ($all == 2) {
|
|
$this->load->view('cetak/excel_returbeli_single', $data);
|
|
}
|
|
}
|
|
|
|
public function dataPajakMasukan_Keuangan_A1() {
|
|
$kondisi = $this->input->post('kondisi');
|
|
$id_supplier = $this->input->post('id_supplier');
|
|
$id_corp = $this->input->post('id_corp');
|
|
$datSupplier = $this->Laporan->getData_Supplier();
|
|
$datCorp = $this->Laporan->getData_Corp();
|
|
|
|
if ($kondisi==null){
|
|
$all = 0;
|
|
$id_corp = NULL;
|
|
$total_pajak = NULL;
|
|
$id_supplier = NULL;
|
|
$tanggal_awal = date('Y-m-d');
|
|
$tanggal_akhir = date('Y-m-d');
|
|
$awal = date('d/m/Y');
|
|
$akhir = date('d/m/Y');
|
|
$title = "Belum Terpilih*";
|
|
} else if ($kondisi!=null AND $id_supplier=="") {
|
|
$all = 1;
|
|
$id_supplier = NULL;
|
|
$tanggal_awal = $this->input->post('tanggal_awal');
|
|
$tanggal_akhir = $this->input->post('tanggal_akhir');
|
|
$awal = date_format(date_create($tanggal_awal), "d/m/Y");
|
|
$akhir = date_format(date_create($tanggal_akhir), "d/m/Y");
|
|
$title = "Semua Supplier";
|
|
} else {
|
|
$all = 2;
|
|
$tanggal_awal = $this->input->post('tanggal_awal');
|
|
$tanggal_akhir = $this->input->post('tanggal_akhir');
|
|
$awal = date_format(date_create($tanggal_awal), "d/m/Y");
|
|
$akhir = date_format(date_create($tanggal_akhir), "d/m/Y");
|
|
$dataSupplier = $this->Laporan->getData_Supplier($id_supplier);
|
|
$nama_supplier = $dataSupplier[0]['NAMA_SUPPLIER'];
|
|
$nama_kota = $dataSupplier[0]['NAMA_KOTA'];
|
|
$title = "$nama_supplier ($nama_kota)";
|
|
}
|
|
|
|
$laporan = $this->Laporan->getData_PajakMasukan_Pembelian($tanggal_awal, $tanggal_akhir, $all, $id_supplier, $id_corp);
|
|
$lapretur = $this->Laporan->getData_PajakMasukan_ReturBeli($tanggal_awal, $tanggal_akhir, $all, $id_supplier, $id_corp);
|
|
foreach ($lapretur as $key) {
|
|
$laporan[count($laporan)] = $key;
|
|
}
|
|
asort($laporan);
|
|
|
|
$total_pajak = 0;
|
|
foreach ($laporan as $key) {
|
|
$subtotal = $key['TOTAL']-$key['TOTALDPP'];
|
|
if (strpos($key['KODEBUKTI'],"PB")!==FALSE) {
|
|
$total_pajak = $total_pajak+$subtotal;
|
|
} else if (strpos($key['KODEBUKTI'],"RB")!==FALSE) {
|
|
$total_pajak = $total_pajak-$subtotal;
|
|
}
|
|
}
|
|
|
|
$data = [
|
|
'sidebar' => "menu laporan",
|
|
'navChild' => "laporan pajakmasukan",
|
|
'laporan' => $laporan,
|
|
'corp' => $datCorp,
|
|
'supplier' => $datSupplier,
|
|
'awal' => $awal,
|
|
'akhir' => $akhir,
|
|
'tanggal_awal' => $tanggal_awal,
|
|
'tanggal_akhir' => $tanggal_akhir,
|
|
'title' => $title,
|
|
'all' => $all,
|
|
'id_supplier' => $id_supplier,
|
|
'id_corp' => $id_corp,
|
|
'total_pajak' => $total_pajak
|
|
];
|
|
$this->load->view('proses/LaporanPajakMasukan_Keuangan_A1', $data);
|
|
}
|
|
|
|
public function simpan_excel_pajakmasukan() {
|
|
$start = $this->input->post('start');
|
|
$end = $this->input->post('end');
|
|
$all = $this->input->post('all');
|
|
$id_corp = $this->input->post('id_corp');
|
|
$id_supplier = $this->input->post('id_supplier');
|
|
|
|
if ($all==1) {
|
|
$pilih_tabel = array('No', 'Kode', 'Tanggal', 'Atas Nama', 'Supplier', 'Nomor Nota', 'DEBET', 'KREDIT');
|
|
} else if ($all==2) {
|
|
$pilih_tabel = array('No', 'Kode', 'Tanggal', 'Atas Nama', 'Nomor Nota', 'DEBET', 'KREDIT');
|
|
}
|
|
|
|
if ($all==2) {
|
|
$datSupplier = $this->Laporan->getData_Supplier($id_supplier);
|
|
$nama_supplier = $datSupplier[0]['NAMA_SUPPLIER'];
|
|
$nama_kota = $datSupplier[0]['NAMA_KOTA'];
|
|
$judul = "$nama_supplier ($nama_kota)";
|
|
} else {
|
|
$judul = "Semua Supplier";
|
|
}
|
|
|
|
$dataLaporan = $this->Laporan->getData_PajakMasukan_Pembelian($start, $end, $all, $id_supplier, $id_corp);
|
|
$lapretur = $this->Laporan->getData_PajakMasukan_ReturBeli($start, $end, $all, $id_supplier, $id_corp);
|
|
foreach ($lapretur as $key) {
|
|
$dataLaporan[count($dataLaporan)] = $key;
|
|
}
|
|
asort($dataLaporan);
|
|
|
|
$data = [
|
|
'title' => '',
|
|
'tanggal_awal' => date_format(date_create($start), "d/m/Y"),
|
|
'tanggal_akhir' => date_format(date_create($end), "d/m/Y"),
|
|
'jumlah_kolom' => count($pilih_tabel),
|
|
'nama_tabel' => $pilih_tabel,
|
|
'laporan' => $dataLaporan,
|
|
'judul' => $judul,
|
|
];
|
|
|
|
if ($all==1) {
|
|
$this->load->view('cetak/excel_pajakmasukan_all', $data);
|
|
} else if ($all==2) {
|
|
$this->load->view('cetak/excel_pajakmasukan_single', $data);
|
|
}
|
|
}
|
|
|
|
public function dataPajakKeluaran_Keuangan_A1() {
|
|
$kondisi = $this->input->post('kondisi');
|
|
$id_pelanggan = $this->input->post('id_pelanggan');
|
|
$id_corp = $this->input->post('id_corp');
|
|
$datPelanggan = $this->Laporan->getData_Pelanggan();
|
|
$datCorp = $this->Laporan->getData_Corp();
|
|
|
|
if ($kondisi==null){
|
|
$all = 0;
|
|
$id_corp = NULL;
|
|
$total_pajak = NULL;
|
|
$id_pelanggan = NULL;
|
|
$tanggal_awal = date('Y-m-d');
|
|
$tanggal_akhir = date('Y-m-d');
|
|
$awal = date('d/m/Y');
|
|
$akhir = date('d/m/Y');
|
|
$title = "Belum Terpilih*";
|
|
} else if ($kondisi!=null AND $id_pelanggan=="") {
|
|
$all = 1;
|
|
$id_pelanggan = NULL;
|
|
$tanggal_awal = $this->input->post('tanggal_awal');
|
|
$tanggal_akhir = $this->input->post('tanggal_akhir');
|
|
$awal = date_format(date_create($tanggal_awal), "d/m/Y");
|
|
$akhir = date_format(date_create($tanggal_akhir), "d/m/Y");
|
|
$title = "Semua Pelanggan";
|
|
} else {
|
|
$all = 2;
|
|
$tanggal_awal = $this->input->post('tanggal_awal');
|
|
$tanggal_akhir = $this->input->post('tanggal_akhir');
|
|
$awal = date_format(date_create($tanggal_awal), "d/m/Y");
|
|
$akhir = date_format(date_create($tanggal_akhir), "d/m/Y");
|
|
$dataPelanggan = $this->Laporan->getData_Pelanggan($id_pelanggan);
|
|
$nama_pelanggan = $dataPelanggan[0]['NAMA_PELANGGAN'];
|
|
$nama_kota = $dataPelanggan[0]['NAMA_KOTA'];
|
|
$title = "$nama_pelanggan ($nama_kota)";
|
|
}
|
|
|
|
$laporan = $this->Laporan->getData_PajakKeluaran_Penjualan($tanggal_awal, $tanggal_akhir, $all, $id_pelanggan, $id_corp);
|
|
$lapretur = $this->Laporan->getData_PajakKeluaran_ReturJual($tanggal_awal, $tanggal_akhir, $all, $id_pelanggan, $id_corp);
|
|
foreach ($lapretur as $key) {
|
|
$laporan[count($laporan)] = $key;
|
|
}
|
|
asort($laporan);
|
|
|
|
$total_pajak = 0;
|
|
foreach ($laporan as $key) {
|
|
$subtotal = $key['TOTAL']-$key['TOTALDPP'];
|
|
if (strpos($key['KODEBUKTI'],"PJ")!==FALSE) {
|
|
$total_pajak = $total_pajak+$subtotal;
|
|
} else if (strpos($key['KODEBUKTI'],"RJ")!==FALSE) {
|
|
$total_pajak = $total_pajak-$subtotal;
|
|
}
|
|
}
|
|
|
|
$data = [
|
|
'sidebar' => "menu laporan",
|
|
'navChild' => "laporan pajakkeluaran",
|
|
'laporan' => $laporan,
|
|
'corp' => $datCorp,
|
|
'pelanggan' => $datPelanggan,
|
|
'awal' => $awal,
|
|
'akhir' => $akhir,
|
|
'tanggal_awal' => $tanggal_awal,
|
|
'tanggal_akhir' => $tanggal_akhir,
|
|
'title' => $title,
|
|
'all' => $all,
|
|
'id_pelanggan' => $id_pelanggan,
|
|
'id_corp' => $id_corp,
|
|
'total_pajak' => $total_pajak
|
|
];
|
|
$this->load->view('proses/LaporanPajakKeluaran_Keuangan_A1', $data);
|
|
}
|
|
|
|
public function simpan_excel_pajakkeluaran() {
|
|
$start = $this->input->post('start');
|
|
$end = $this->input->post('end');
|
|
$all = $this->input->post('all');
|
|
$id_corp = $this->input->post('id_corp');
|
|
$id_pelanggan = $this->input->post('id_pelanggan');
|
|
|
|
if ($all==1) {
|
|
$pilih_tabel = array('No', 'Kode', 'Tanggal', 'Atas Nama', 'Pelanggan', 'Nomor Nota', 'KREDIT', 'DEBET');
|
|
} else if ($all==2) {
|
|
$pilih_tabel = array('No', 'Kode', 'Tanggal', 'Atas Nama', 'Nomor Nota', 'KREDIT', 'DEBET');
|
|
}
|
|
|
|
if ($all==2) {
|
|
$datPelanggan = $this->Laporan->getData_Pelanggan($id_pelanggan);
|
|
$nama_pelanggan = $datPelanggan[0]['NAMA_PELANGGAN'];
|
|
$nama_kota = $datPelanggan[0]['NAMA_KOTA'];
|
|
$judul = "$nama_pelanggan ($nama_kota)";
|
|
} else {
|
|
$judul = "Semua Pelanggan";
|
|
}
|
|
|
|
$dataLaporan = $this->Laporan->getData_PajakKeluaran_Penjualan($start, $end, $all, $id_pelanggan, $id_corp);
|
|
$lapretur = $this->Laporan->getData_PajakKeluaran_ReturJual($start, $end, $all, $id_pelanggan, $id_corp);
|
|
foreach ($lapretur as $key) {
|
|
$dataLaporan[count($dataLaporan)] = $key;
|
|
}
|
|
asort($dataLaporan);
|
|
|
|
$data = [
|
|
'title' => '',
|
|
'tanggal_awal' => date_format(date_create($start), "d/m/Y"),
|
|
'tanggal_akhir' => date_format(date_create($end), "d/m/Y"),
|
|
'jumlah_kolom' => count($pilih_tabel),
|
|
'nama_tabel' => $pilih_tabel,
|
|
'laporan' => $dataLaporan,
|
|
'judul' => $judul,
|
|
];
|
|
|
|
if ($all==1) {
|
|
$this->load->view('cetak/excel_pajakkeluaran_all', $data);
|
|
} else if ($all==2) {
|
|
$this->load->view('cetak/excel_pajakkeluaran_single', $data);
|
|
}
|
|
}
|
|
|
|
public function dataAnalisaPembelian_Administrator_A1() {
|
|
$kondisi = $this->input->post('kondisi');
|
|
$id_supplier = $this->input->post('id_supplier');
|
|
$id_jenis = $this->input->post('id_jenis');
|
|
$id_merk = $this->input->post('id_merk');
|
|
$id_model = $this->input->post('id_model');
|
|
$tgl = date('Y-m-d');
|
|
$datSupplier = $this->Laporan->getData_Supplier();
|
|
$datJenis = $this->Laporan->getData_Jenis();
|
|
$datMerk = $this->Laporan->getData_Merk();
|
|
$datModel = $this->Laporan->getData_Model();
|
|
|
|
if ($kondisi==null){
|
|
$all = 0 ;
|
|
$id_supplier = NULL;
|
|
$id_jenis = NULL;
|
|
$id_merk = NULL;
|
|
$id_model = NULL;
|
|
$tanggal_awal = date('Y-m-d');
|
|
$tanggal_akhir = date('Y-m-d');
|
|
$awal = date('d/m/Y');
|
|
$akhir = date('d/m/Y');
|
|
$title = "Belum Terpilih*";
|
|
} else {
|
|
$all = 1;
|
|
$tanggal_awal = $this->input->post('tanggal_awal');
|
|
$tanggal_akhir = $this->input->post('tanggal_akhir');
|
|
$awal = date_format(date_create($tanggal_awal), "d/m/Y");
|
|
$akhir = date_format(date_create($tanggal_akhir), "d/m/Y");
|
|
if ($id_supplier == "") {
|
|
$id_supplier = NULL;
|
|
$nama_supplier = "Semua Supplier";
|
|
} else {
|
|
$dataSupplier = $this->Laporan->getData_Supplier($id_supplier);
|
|
$nama_supplier = $dataSupplier[0]['NAMA_SUPPLIER'];
|
|
}
|
|
if ($id_jenis == "") {
|
|
$id_jenis = NULL;
|
|
$nama_jenis = "Semua Jenis";
|
|
} else {
|
|
$dataJenis = $this->Laporan->getData_Jenis($id_jenis);
|
|
$nama_jenis = $dataJenis[0]['NAMA_JENIS'];
|
|
}
|
|
if ($id_merk == "") {
|
|
$id_merk = NULL;
|
|
$nama_merk = "Semua Merk";
|
|
} else {
|
|
$dataMerk = $this->Laporan->getData_Merk($id_merk);
|
|
$nama_merk = $dataMerk[0]['NAMA_MERK'];
|
|
}
|
|
if ($id_model == "") {
|
|
$id_model = NULL;
|
|
$nama_model = "Semua Model";
|
|
} else {
|
|
$dataModel = $this->Laporan->getData_Model($id_model);
|
|
$nama_model = $dataModel[0]['NAMA_MODEL'];
|
|
}
|
|
$title = "Supplier ($nama_supplier) | Jenis ($nama_jenis) | Merk ($nama_merk) | Model ($nama_model)";
|
|
}
|
|
$laporan = $this->Laporan->getData_DaftarBeli_forAnalisaPembelian($tanggal_awal, $tanggal_akhir, $all, $id_supplier, $id_jenis, $id_merk, $id_model);
|
|
$data = [
|
|
'sidebar' => "menu laporan",
|
|
'navChild' => "laporan analisa pembelian",
|
|
'laporan' => $laporan,
|
|
'tgl' => $tgl,
|
|
'supplier' => $datSupplier,
|
|
'jenis' => $datJenis,
|
|
'merk' => $datMerk,
|
|
'model' => $datModel,
|
|
'awal' => $awal,
|
|
'akhir' => $akhir,
|
|
'tanggal_awal' => $tanggal_awal,
|
|
'tanggal_akhir' => $tanggal_akhir,
|
|
'title' => $title,
|
|
'all' => $all,
|
|
'id_supplier' => $id_supplier,
|
|
'id_jenis' => $id_jenis,
|
|
'id_merk' => $id_merk,
|
|
'id_model' => $id_model
|
|
];
|
|
$this->load->view('proses/LaporanAnalisaPembelian_Administrator_A1', $data);
|
|
}
|
|
|
|
public function simpan_excel_analisapembelian() {
|
|
$start = $this->input->post('start');
|
|
$end = $this->input->post('end');
|
|
$all = $this->input->post('all');
|
|
$id_supplier = $this->input->post('id_supplier');
|
|
$id_jenis = $this->input->post('id_jenis');
|
|
$id_merk = $this->input->post('id_merk');
|
|
$id_model = $this->input->post('id_model');
|
|
|
|
$pilih_tabel = array('No', 'Jenis', 'Merk', 'Model', 'Kode Barang', 'Nama Barang', 'Total');
|
|
$dataLaporan = $this->Laporan->getData_DaftarBeli_forAnalisaPembelian($start, $end, $all, $id_supplier, $id_jenis, $id_merk, $id_model);
|
|
|
|
$data = [
|
|
'title' => '',
|
|
'tanggal_awal' => date_format(date_create($start), "d/m/Y"),
|
|
'tanggal_akhir' => date_format(date_create($end), "d/m/Y"),
|
|
'jumlah_kolom' => count($pilih_tabel),
|
|
'nama_tabel' => $pilih_tabel,
|
|
'laporan' => $dataLaporan,
|
|
];
|
|
$this->load->view('cetak/excel_analisapembelian', $data);
|
|
}
|
|
|
|
public function dataTargetPembelian_AdminSales_A1() {
|
|
$kondisi = $this->input->post('kondisi');
|
|
$id_supplier = $this->input->post('id_supplier');
|
|
$id_merk = $this->input->post('id_merk');
|
|
$id_barang = $this->input->post('id_barang');
|
|
$tgl = date('Y-m-d');
|
|
$datSupplier = $this->Laporan->getData_Supplier();
|
|
$datMerk = $this->Laporan->getData_Merk();
|
|
$datBarang = $this->Laporan->getData_Barang_forKeluarMasuk();
|
|
$total_pembelian = 0;
|
|
if ($kondisi==null){
|
|
$all = 0 ;
|
|
$id_barang = NULL;
|
|
$id_merk = NULL;
|
|
$id_supplier = NULL;
|
|
$tanggal_awal = date('Y-m-d');
|
|
$tanggal_akhir = date('Y-m-d');
|
|
$awal = date('d/m/Y');
|
|
$akhir = date('d/m/Y');
|
|
$title = "Belum Terpilih*";
|
|
} else if ($kondisi!=null) {
|
|
$all = 1;
|
|
$tanggal_awal = $this->input->post('tanggal_awal');
|
|
$tanggal_akhir = $this->input->post('tanggal_akhir');
|
|
$awal = date_format(date_create($tanggal_awal), "d/m/Y");
|
|
$akhir = date_format(date_create($tanggal_akhir), "d/m/Y");
|
|
if ($id_supplier=="") {
|
|
$judul_supplier = "Semua Supplier";
|
|
} else {
|
|
$dataSupplier = $this->Laporan->getData_Supplier($id_supplier);
|
|
$nama_supplier = $dataSupplier[0]['NAMA_SUPPLIER'];
|
|
$nama_kota = $dataSupplier[0]['NAMA_KOTA'];
|
|
$judul_supplier = "$nama_supplier ($nama_kota)";
|
|
}
|
|
|
|
if ($id_merk=="") {
|
|
$judul_merk = "Semua Merk";
|
|
} else {
|
|
$dataMerk = $this->Laporan->getData_Merk($id_merk);
|
|
$judul_merk = $dataMerk[0]['NAMA_MERK'];
|
|
}
|
|
|
|
if ($id_barang=="") {
|
|
$judul_barang = "Semua Barang";
|
|
} else {
|
|
$dataBarang = $this->Laporan->getData_Barang($id_barang);
|
|
$judul_barang = $dataBarang[0]['KODE_BARANG'];
|
|
}
|
|
|
|
$title = "Supplier ($judul_supplier) | Merk ($judul_merk) | Barang ($judul_barang)";
|
|
}
|
|
$laporan = $this->Laporan->getData_DaftarBeli_forTargetPembelian($tanggal_awal, $tanggal_akhir, $all, $id_supplier, $id_merk, $id_barang);
|
|
$no = 0;
|
|
foreach ($laporan as $key) {
|
|
$subtotal = $key['QTY_DB']*$key['HARGA_DB'];
|
|
$total_pembelian = $total_pembelian + $subtotal;
|
|
}
|
|
$data = [
|
|
'sidebar' => "menu laporan",
|
|
'navChild' => "laporan target pembelian",
|
|
'laporan' => $laporan,
|
|
'tgl' => $tgl,
|
|
'barang' => $datBarang,
|
|
'merk' => $datMerk,
|
|
'supplier' => $datSupplier,
|
|
'sup' => $datSupplier,
|
|
'awal' => $awal,
|
|
'akhir' => $akhir,
|
|
'tanggal_awal' => $tanggal_awal,
|
|
'tanggal_akhir' => $tanggal_akhir,
|
|
'title' => $title,
|
|
'all' => $all,
|
|
'id_barang' => $id_barang,
|
|
'id_supplier' => $id_supplier,
|
|
'id_merk' => $id_merk,
|
|
'total_pembelian' => $total_pembelian
|
|
];
|
|
$this->load->view('proses/LaporanTargetPembelian_AdminSales_A1', $data);
|
|
}
|
|
|
|
public function simpan_excel_targetpembelian() {
|
|
$start = $this->input->post('start');
|
|
$end = $this->input->post('end');
|
|
$all = $this->input->post('all');
|
|
$id_barang = $this->input->post('id_barang');
|
|
$id_merk = $this->input->post('id_merk');
|
|
$id_supplier = $this->input->post('id_supplier');
|
|
|
|
$pilih_tabel = array('No', 'Tanggal', 'Nota', 'Supplier', 'SKU', 'Kuantiti', 'Satuan', 'Subtotal');
|
|
|
|
if ($id_supplier=="") {
|
|
$judul_supplier = "Semua Supplier";
|
|
} else {
|
|
$dataSupplier = $this->Laporan->getData_Supplier($id_supplier);
|
|
$nama_supplier = $dataSupplier[0]['NAMA_SUPPLIER'];
|
|
$nama_kota = $dataSupplier[0]['NAMA_KOTA'];
|
|
$judul_supplier = "$nama_supplier ($nama_kota)";
|
|
}
|
|
|
|
if ($id_merk=="") {
|
|
$judul_merk = "Semua Merk";
|
|
} else {
|
|
$dataMerk = $this->Laporan->getData_Merk($id_merk);
|
|
$judul_merk = $dataMerk[0]['NAMA_MERK'];
|
|
}
|
|
|
|
if ($id_barang=="") {
|
|
$judul_barang = "Semua Barang";
|
|
} else {
|
|
$dataBarang = $this->Laporan->getData_Barang($id_barang);
|
|
$judul_barang = $dataBarang[0]['KODE_BARANG'];
|
|
}
|
|
|
|
$judul = "Supplier ($judul_supplier) | Merk ($judul_merk) | Barang ($judul_barang)";
|
|
$dataLaporan = $this->Laporan->getData_DaftarBeli_forTargetPembelian($start, $end, $all, $id_supplier, $id_merk, $id_barang);
|
|
|
|
$data = [
|
|
'title' => '',
|
|
'tanggal_awal' => date_format(date_create($start), "d/m/Y"),
|
|
'tanggal_akhir' => date_format(date_create($end), "d/m/Y"),
|
|
'jumlah_kolom' => count($pilih_tabel),
|
|
'nama_tabel' => $pilih_tabel,
|
|
'laporan' => $dataLaporan,
|
|
'judul' => $judul,
|
|
];
|
|
$this->load->view('cetak/excel_targetpembelian', $data);
|
|
}
|
|
|
|
//MENU PERSEDIAAN
|
|
public function dataDaftarBeli_Admin_A1() {
|
|
$kondisi = $this->input->post('kondisi');
|
|
$id_supplier = $this->input->post('id_supplier');
|
|
$tgl = date('Y-m-d');
|
|
$datSupplier = $this->Laporan->getData_Supplier();
|
|
|
|
if ($kondisi==null){
|
|
$id_supplier = NULL;
|
|
$all = 0 ;
|
|
$tanggal_awal = date('Y-m-d');
|
|
$tanggal_akhir = date('Y-m-d');
|
|
$awal = date('d/m/Y');
|
|
$akhir = date('d/m/Y');
|
|
$title = "Belum Terpilih*";
|
|
} else if ($kondisi!=null AND $id_supplier=="") {
|
|
$id_supplier = NULL;
|
|
$tanggal_awal = $this->input->post('tanggal_awal');
|
|
$tanggal_akhir = $this->input->post('tanggal_akhir');
|
|
$awal = date_format(date_create($tanggal_awal), "d/m/Y");
|
|
$akhir = date_format(date_create($tanggal_akhir), "d/m/Y");
|
|
$title = "Semua Supplier";
|
|
$all = 1;
|
|
} else {
|
|
$all = 2;
|
|
$tanggal_awal = $this->input->post('tanggal_awal');
|
|
$tanggal_akhir = $this->input->post('tanggal_akhir');
|
|
$awal = date_format(date_create($tanggal_awal), "d/m/Y");
|
|
$akhir = date_format(date_create($tanggal_akhir), "d/m/Y");
|
|
$datSupplier = $this->Laporan->getData_Supplier($id_supplier);
|
|
$nama_supplier = $datSupplier[0]['NAMA_SUPPLIER'];
|
|
$nama_kota = $datSupplier[0]['NAMA_KOTA'];
|
|
$title = "$nama_supplier ($nama_kota)";
|
|
}
|
|
$laporan = $this->Laporan->getData_DaftarBeli($tanggal_awal, $tanggal_akhir, $id_supplier, $all);
|
|
$data = [
|
|
'sidebar' => "menu laporan",
|
|
'navChild' => "laporan stokbeli",
|
|
'laporan' => $laporan,
|
|
'tgl' => $tgl,
|
|
'supplier' => $datSupplier,
|
|
'sup' => $datSupplier,
|
|
'awal' => $awal,
|
|
'akhir' => $akhir,
|
|
'tanggal_awal' => $tanggal_awal,
|
|
'tanggal_akhir' => $tanggal_akhir,
|
|
'title' => $title,
|
|
'all' => $all
|
|
];
|
|
$this->load->view('proses/LaporanDaftarBeli_Admin_A1', $data);
|
|
}
|
|
|
|
public function dataStokKuantiti_Admin_A1() {
|
|
$kondisi = $this->input->post('kondisi');
|
|
$jenis_gudang = $this->input->post('jenis_gudang');
|
|
$id_jenis = $this->input->post('id_jenis');
|
|
$id_merk = $this->input->post('id_merk');
|
|
$datJenis = $this->Laporan->getData_Jenis_Not2();
|
|
$datMerk = $this->Laporan->getData_Merk();
|
|
$tgl = date('d/m/Y');
|
|
|
|
if ($kondisi==null) {
|
|
$jenis_gudang = NULL;
|
|
$all = 0 ;
|
|
$title = "Belum Terpilih*";
|
|
} else if ($kondisi!=null AND $jenis_gudang=="") {
|
|
$jenis_gudang = NULL;
|
|
$title = "Semua Gudang";
|
|
$all = 1;
|
|
} else {
|
|
if ($jenis_gudang=="1") {
|
|
$title = "Gudang Global";
|
|
} else if ($jenis_gudang=="2") {
|
|
$title = "Gudang PCM";
|
|
} else if ($jenis_gudang=="3") {
|
|
$title = "Gudang Konsinyasi";
|
|
} else if ($jenis_gudang=="4") {
|
|
$title = "Gudang Peminjaman";
|
|
} else if ($jenis_gudang=="5") {
|
|
$title = "Gudang Pending";
|
|
} else if ($jenis_gudang=="6") {
|
|
$title = "Gudang Antik";
|
|
} else if ($jenis_gudang=="7") {
|
|
$title = "Gudang Proyek";
|
|
} else if ($jenis_gudang=="8") {
|
|
$title = "Gudang Service";
|
|
} else if ($jenis_gudang=="9") {
|
|
$title = "Gudang ITP";
|
|
}
|
|
$all = 2;
|
|
}
|
|
|
|
$laporan = $this->Laporan->getData_StokKuantiti($all, $jenis_gudang, $id_jenis, $id_merk);
|
|
|
|
$data = [
|
|
'sidebar' => "menu laporan",
|
|
'navChild' => "laporan stokkuantiti",
|
|
'laporan' => $laporan,
|
|
'jenis' => $datJenis,
|
|
'merk' => $datMerk,
|
|
'id_jenis' => $id_jenis,
|
|
'id_merk' => $id_merk,
|
|
'tgl' => $tgl,
|
|
'title' => $title,
|
|
'all' => $all,
|
|
'jenis_gudang' => $jenis_gudang
|
|
];
|
|
$this->load->view('proses/LaporanStokKuantiti_Admin_A1', $data);
|
|
}
|
|
|
|
public function simpan_excel_stokKuantiti() {
|
|
$jenis_gudang = $this->input->post('jenis_gudang');
|
|
$id_jenis = $this->input->post('id_jenis');
|
|
$id_merk = $this->input->post('id_merk');
|
|
$all = $this->input->post('all');
|
|
$type_cetak = $this->input->post('type_cetak');
|
|
$tgl = date('d/m/Y');
|
|
|
|
if ($type_cetak==1) {
|
|
if ($jenis_gudang==5 OR $jenis_gudang==7) {
|
|
$this->session->set_flashdata('not_sn', 'error');
|
|
redirect($_SERVER['HTTP_REFERER']);
|
|
}
|
|
}
|
|
|
|
if ($type_cetak==1) {
|
|
$pilih_tabel = array('No', 'Kode Barang', 'Nama Barang', 'Kuantiti', 'Serial Number');
|
|
$dataLaporan = $this->Laporan->getData_StokKuantitiSn_forBARANG($jenis_gudang, $id_jenis, $id_merk);
|
|
$dataSn = [];
|
|
|
|
$no = 0;
|
|
foreach ($dataLaporan as $key) {
|
|
$datSnStock = $this->Laporan->getData_StokKuantitiSn($key['ID_BARANG'], $jenis_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
|
|
];
|
|
}
|
|
}
|
|
|
|
$dataLaporan = $dataSn;
|
|
} else if ($type_cetak==0) {
|
|
$pilih_tabel = array('No', 'Jenis', 'Kode Barang', 'Nama Barang', 'Kuantiti');
|
|
$dataLaporan = $this->Laporan->getData_StokKuantiti($all, $jenis_gudang, $id_jenis, $id_merk);
|
|
}
|
|
|
|
if ($jenis_gudang=="1") {
|
|
$gudang = "Gudang Global";
|
|
} else if ($jenis_gudang=="2") {
|
|
$gudang = "Gudang PCM";
|
|
} else if ($jenis_gudang=="3") {
|
|
$gudang = "Gudang Konsinyasi";
|
|
} else if ($jenis_gudang=="4") {
|
|
$gudang = "Gudang Peminjaman";
|
|
} else if ($jenis_gudang=="5") {
|
|
$gudang = "Gudang Pending";
|
|
} else if ($jenis_gudang=="6") {
|
|
$gudang = "Gudang Antik";
|
|
} else if ($jenis_gudang=="7") {
|
|
$gudang = "Gudang Proyek";
|
|
} else if ($jenis_gudang=="8") {
|
|
$gudang = "Gudang Service";
|
|
} else if ($jenis_gudang=="9") {
|
|
$gudang = "Gudang ITP";
|
|
}
|
|
|
|
$data = [
|
|
'title' => '',
|
|
'jumlah_kolom' => count($pilih_tabel),
|
|
'nama_tabel' => $pilih_tabel,
|
|
'laporan' => $dataLaporan,
|
|
'tgl' => $tgl,
|
|
'gudang' => $gudang,
|
|
];
|
|
|
|
if ($type_cetak==1) {
|
|
$this->load->view('cetak/excel_stokKuantitiSn', $data);
|
|
} else if ($type_cetak==0) {
|
|
$this->load->view('cetak/excel_stokKuantiti', $data);
|
|
}
|
|
}
|
|
|
|
//Stok Supplier
|
|
public function dataStokSupplier_Admin_A1() {
|
|
$kondisi = $this->input->post('kondisi');
|
|
$datSupplier = $this->Laporan->getData_Supplier();
|
|
$datMerk = $this->Laporan->getData_Merk();
|
|
$tgl = date('d/m/Y');
|
|
|
|
if ($kondisi==null) {
|
|
$id_supplier = NULL;
|
|
$id_merk = NULL;
|
|
$all = 0 ;
|
|
$title = "Belum Terpilih*";
|
|
} else {
|
|
$id_supplier = $this->input->post('id_supplier');
|
|
$id_merk = $this->input->post('id_merk');
|
|
$all = 1;
|
|
$dataSupplier = $this->Laporan->getData_Supplier($id_supplier);
|
|
$nama_supplier = $dataSupplier[0]['NAMA_SUPPLIER'];
|
|
if ($id_merk=="") {
|
|
$nama_merk = "[Semua Merk]";
|
|
} else {
|
|
$dataMerk = $this->Laporan->getData_Merk($id_merk);
|
|
$nama_merk = $dataMerk[0]['NAMA_MERK'];
|
|
}
|
|
$title = "$nama_supplier [$nama_merk]";
|
|
}
|
|
|
|
$laporan = $this->Laporan->getData_StokSupplier($all, $id_supplier, $id_merk);
|
|
$no = 0;
|
|
foreach ($laporan as $key) {
|
|
$datSnStock = $this->Laporan->getData_SnStock_byBARANG_bySUPPLIER_Null_Not1_Not3_Not14_Not16($key['ID_BARANG'], $id_supplier);
|
|
$laporan[$no++] += ['SN' => $datSnStock];
|
|
}
|
|
|
|
$data = [
|
|
'sidebar' => "menu laporan",
|
|
'navChild' => "laporan stoksupplier",
|
|
'laporan' => $laporan,
|
|
'supplier' => $datSupplier,
|
|
'merk' => $datMerk,
|
|
'id_supplier' => $id_supplier,
|
|
'id_merk' => $id_merk,
|
|
'tgl' => $tgl,
|
|
'title' => $title,
|
|
'all' => $all,
|
|
];
|
|
$this->load->view('proses/LaporanStokSupplier_Admin_A1', $data);
|
|
}
|
|
|
|
public function simpan_excel_stokSupplier() {
|
|
$id_supplier = $this->input->post('id_supplier');
|
|
$id_merk = $this->input->post('id_merk');
|
|
$all = $this->input->post('all');
|
|
$type_cetak = $this->input->post('type_cetak');
|
|
$tgl = date('d/m/Y');
|
|
|
|
if ($type_cetak==1) {
|
|
$pilih_tabel = array('No', 'Merk', 'Kode Barang', 'Nama Barang', 'Kuantiti', 'Serial Number');
|
|
$dataLaporan = $this->Laporan->getData_StokSupplier($all, $id_supplier, $id_merk);
|
|
|
|
$no = 0;
|
|
foreach ($dataLaporan as $key) {
|
|
$datSnStock = $this->Laporan->getData_SnStock_byBARANG_bySUPPLIER_Null_Not1_Not3_Not14_Not16($key['ID_BARANG'], $id_supplier);
|
|
$datsn = "";
|
|
foreach ($datSnStock as $dat) {
|
|
$sb = $dat['NAMA_SNSTOCK'];
|
|
$datsn .= "$sb, " ;
|
|
}
|
|
$dataLaporan[$no++] += ['SN' => $datsn];
|
|
}
|
|
} else if ($type_cetak==0) {
|
|
$pilih_tabel = array('No', 'Merk', 'Kode Barang', 'Nama Barang', 'Kuantiti');
|
|
$dataLaporan = $this->Laporan->getData_StokSupplier($all, $id_supplier, $id_merk);
|
|
}
|
|
|
|
$datSupplier = $this->Laporan->getData_Supplier($id_supplier);
|
|
if ($id_merk=="") {
|
|
$nama_merk = "Semua Merk";
|
|
} else {
|
|
$datMerk = $this->Laporan->getData_Merk($id_merk);
|
|
$nama_merk = $datMerk[0]['NAMA_MERK'];
|
|
}
|
|
|
|
$data = [
|
|
'title' => '',
|
|
'jumlah_kolom' => count($pilih_tabel),
|
|
'nama_tabel' => $pilih_tabel,
|
|
'laporan' => $dataLaporan,
|
|
'tgl' => $tgl,
|
|
'nama_supplier' => $datSupplier[0]['NAMA_SUPPLIER'],
|
|
'nama_merk' => $nama_merk,
|
|
];
|
|
|
|
if ($type_cetak==1) {
|
|
$this->load->view('cetak/excel_stokSupplierSn', $data);
|
|
} else if ($type_cetak==0) {
|
|
$this->load->view('cetak/excel_stokSupplier', $data);
|
|
}
|
|
}
|
|
|
|
//MENU MARGIN PENJUALAN
|
|
public function dataMarginPenjualan_Keuangan_A1() {
|
|
$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');
|
|
$datCorp = $this->Laporan->getData_Corp();
|
|
$datPelanggan = $this->Laporan->getData_Pelanggan();
|
|
$datSales = $this->Laporan->getData_Sales();
|
|
|
|
if ($kondisi==null){
|
|
$id_corp = NULL;
|
|
$id_pelanggan = NULL;
|
|
$id_sales = NULL;
|
|
$tanggal_awal = date('Y-m-d');
|
|
$tanggal_akhir = date('Y-m-d');
|
|
$awal = date('d/m/Y');
|
|
$akhir = date('d/m/Y');
|
|
$title = "Belum Terpilih*";
|
|
$all = 0 ;
|
|
} else if ($kondisi!=null AND $id_pelanggan=="") {
|
|
$id_pelanggan = NULL;
|
|
$tanggal_awal = $this->input->post('tanggal_awal');
|
|
$tanggal_akhir = $this->input->post('tanggal_akhir');
|
|
$awal = date_format(date_create($tanggal_awal), "d/m/Y");
|
|
$akhir = date_format(date_create($tanggal_akhir), "d/m/Y");
|
|
$title = "Semua Pelanggan";
|
|
$all = 1;
|
|
} else {
|
|
$tanggal_awal = $this->input->post('tanggal_awal');
|
|
$tanggal_akhir = $this->input->post('tanggal_akhir');
|
|
$awal = date_format(date_create($tanggal_awal), "d/m/Y");
|
|
$akhir = date_format(date_create($tanggal_akhir), "d/m/Y");
|
|
$dataPelanggan = $this->Laporan->getData_Pelanggan($id_pelanggan);
|
|
$nama_pelanggan = $dataPelanggan[0]['NAMA_PELANGGAN'];
|
|
$nama_kota = $dataPelanggan[0]['NAMA_KOTA'];
|
|
$title = "$nama_pelanggan ($nama_kota)";
|
|
$all = 2;
|
|
}
|
|
|
|
$totalDpp = 0;
|
|
$totalHpp = 0;
|
|
$totalMar = 0;
|
|
if ($all==0) {
|
|
$laporan = NULL;
|
|
} else {
|
|
$laporan = $this->Laporan->getData_Penjualan_MarginPenjualan($tanggal_awal, $tanggal_akhir, $id_corp, $id_pelanggan, $id_sales);
|
|
$no = 0;
|
|
foreach ($laporan as $key) {
|
|
$sumDo = $this->Laporan->getSum_DaftarOrder_bySO($key['SO_ID']);
|
|
$dpp = $sumDo[0]['DPP'];
|
|
$totalDpp = $totalDpp+$dpp;
|
|
|
|
$datDo = $this->Laporan->getData_DaftarOrder_bySO_searchHPP($key['SO_ID']);
|
|
$total_hppbarang = 0;
|
|
foreach ($datDo as $dat) {
|
|
$datHq = $this->Laporan->getData_HistoriKuantiti_byBARANG_MasukLebih0($dat['BARANG_ID']);
|
|
$totkeluar = 0;
|
|
$totpersediaan = 0;
|
|
$hargaavglama = 0;
|
|
foreach ($datHq as $keydat) {
|
|
//Kuantiti Sebelumnya
|
|
$sumHq = $this->Laporan->getSum_HistoriKuantiti_byBARANG_byHQ($dat['BARANG_ID'], $keydat['ID_HQ']);
|
|
if ($totkeluar!=$sumHq[0]['KELUAR']) {
|
|
$totkeluar = $sumHq[0]['KELUAR'];
|
|
$datHqLimit = $this->Laporan->getData_HistoriKuantiti_limitHQ($dat['BARANG_ID'], $keydat['ID_HQ']);
|
|
$limit = $this->Laporan->getSum_HistoriKuantiti_byBARANG_byHQ1_byHQ2($dat['BARANG_ID'], $keydat['ID_HQ'], $datHqLimit[0]['ID_HQ']);
|
|
$keluar = $limit[0]['KELUAR'];
|
|
} else {
|
|
$keluar = 0;
|
|
$totkeluar = 0;
|
|
}
|
|
|
|
//Harga Per Item, DPP
|
|
$harga = $keydat['NILAI_HQ'] / $keydat['MASUK_HQ'];
|
|
//Nilai Total Persediaan Akhir
|
|
$nilaiPersediaanKeluar = $hargaavglama * $keluar;
|
|
$totpersediaan = $totpersediaan + ($harga * $keydat['MASUK_HQ']) - $nilaiPersediaanKeluar;
|
|
$hppakhir = round(($totpersediaan/$sumHq[0]['TOTAL']),2);
|
|
$hargaavglama = $hppakhir;
|
|
}
|
|
//Hasil HPP Akhir
|
|
if ($dat['TYPE_JENIS']!=2) {
|
|
$subtot = $hppakhir * $dat['QTY_DO'];
|
|
} else {
|
|
$subtot = 0;
|
|
}
|
|
$total_hppbarang = $total_hppbarang + $subtot;
|
|
}
|
|
|
|
$total_Margin = $dpp-$total_hppbarang;
|
|
|
|
$totalHpp = $totalHpp+$total_hppbarang;
|
|
$totalMar = $totalMar+$dpp-$total_hppbarang;
|
|
|
|
$laporan[$no] += ['DPP' => $dpp];
|
|
$laporan[$no] += ['HPP' => $total_hppbarang];
|
|
$laporan[$no++] += ['MARGIN' => $total_Margin];
|
|
}
|
|
}
|
|
|
|
$data = [
|
|
'sidebar' => "menu laporan",
|
|
'navChild' => "laporan marginpenjualan",
|
|
'laporan' => $laporan,
|
|
'id_corp' => $id_corp,
|
|
'id_pelanggan' => $id_pelanggan,
|
|
'id_sales' => $id_sales,
|
|
'corp' => $datCorp,
|
|
'sales' => $datSales,
|
|
'pelanggan' => $datPelanggan,
|
|
'awal' => $awal,
|
|
'akhir' => $akhir,
|
|
'tanggal_awal' => $tanggal_awal,
|
|
'tanggal_akhir' => $tanggal_akhir,
|
|
'title' => $title,
|
|
'all' => $all,
|
|
'totalDpp' => $totalDpp,
|
|
'totalHpp' => $totalHpp,
|
|
'totalMar' => $totalMar
|
|
];
|
|
$this->load->view('proses/LaporanMarginPenjualan_Keuangan_A1', $data);
|
|
}
|
|
|
|
public function simpan_excel_marginpenjualan() {
|
|
$start = $this->input->post('start');
|
|
$end = $this->input->post('end');
|
|
$id_corp = $this->input->post('id_corp');
|
|
$id_pelanggan = $this->input->post('id_pelanggan');
|
|
$id_sales = $this->input->post('id_sales');
|
|
|
|
$pilih_tabel = array('No', 'Kode', 'Atas Nama', 'Sales', 'Pelanggan', 'Nota Penjualan', 'Tanggal', 'Nomor SO' , 'DPP', 'HPP', 'MARGIN');
|
|
|
|
if ($id_pelanggan!=null) {
|
|
$datPelanggan = $this->Laporan->getData_Pelanggan($id_pelanggan);
|
|
$nama_pelanggan = $datPelanggan[0]['NAMA_PELANGGAN'];
|
|
$nama_kota = $datPelanggan[0]['NAMA_KOTA'];
|
|
$judul = "$nama_pelanggan ($nama_kota)";
|
|
} else {
|
|
$judul = "Semua Pelanggan";
|
|
}
|
|
|
|
$totalDpp = 0;
|
|
$totalHpp = 0;
|
|
$totalMar = 0;
|
|
$laporan = $this->Laporan->getData_Penjualan_MarginPenjualan($start, $end, $id_corp, $id_pelanggan, $id_sales);
|
|
$no = 0;
|
|
foreach ($laporan as $key) {
|
|
$sumDo = $this->Laporan->getSum_DaftarOrder_bySO($key['SO_ID']);
|
|
$dpp = $sumDo[0]['DPP'];
|
|
$totalDpp = $totalDpp+$dpp;
|
|
|
|
$datDo = $this->Laporan->getData_DaftarOrder_bySO_searchHPP($key['SO_ID']);
|
|
$total_hppbarang = 0;
|
|
foreach ($datDo as $dat) {
|
|
$datHq = $this->Laporan->getData_HistoriKuantiti_byBARANG_MasukLebih0($dat['BARANG_ID']);
|
|
$totkeluar = 0;
|
|
$totpersediaan = 0;
|
|
$hargaavglama = 0;
|
|
foreach ($datHq as $keydat) {
|
|
//Kuantiti Sebelumnya
|
|
$sumHq = $this->Laporan->getSum_HistoriKuantiti_byBARANG_byHQ($dat['BARANG_ID'], $keydat['ID_HQ']);
|
|
if ($totkeluar!=$sumHq[0]['KELUAR']) {
|
|
$totkeluar = $sumHq[0]['KELUAR'];
|
|
$datHqLimit = $this->Laporan->getData_HistoriKuantiti_limitHQ($dat['BARANG_ID'], $keydat['ID_HQ']);
|
|
$limit = $this->Laporan->getSum_HistoriKuantiti_byBARANG_byHQ1_byHQ2($dat['BARANG_ID'], $keydat['ID_HQ'], $datHqLimit[0]['ID_HQ']);
|
|
$keluar = $limit[0]['KELUAR'];
|
|
} else {
|
|
$keluar = 0;
|
|
$totkeluar = 0;
|
|
}
|
|
|
|
//Harga Per Item, DPP
|
|
$harga = $keydat['NILAI_HQ'] / $keydat['MASUK_HQ'];
|
|
//Nilai Total Persediaan Akhir
|
|
$nilaiPersediaanKeluar = $hargaavglama * $keluar;
|
|
$totpersediaan = $totpersediaan + ($harga * $keydat['MASUK_HQ']) - $nilaiPersediaanKeluar;
|
|
$hppakhir = round(($totpersediaan/$sumHq[0]['TOTAL']),2);
|
|
$hargaavglama = $hppakhir;
|
|
}
|
|
//Hasil HPP Akhir
|
|
if ($dat['TYPE_JENIS']!=2) {
|
|
$subtot = $hppakhir * $dat['QTY_DO'];
|
|
} else {
|
|
$subtot = 0;
|
|
}
|
|
$total_hppbarang = $total_hppbarang + $subtot;
|
|
}
|
|
|
|
$total_Margin = $dpp-$total_hppbarang;
|
|
|
|
$totalHpp = $totalHpp+$total_hppbarang;
|
|
$totalMar = $totalMar+$dpp-$total_hppbarang;
|
|
|
|
$laporan[$no] += ['DPP' => number_format($dpp,2)];
|
|
$laporan[$no] += ['HPP' => number_format($total_hppbarang,2)];
|
|
$laporan[$no++] += ['MARGIN' => number_format($total_Margin,2)];
|
|
}
|
|
|
|
$data = [
|
|
'title' => '',
|
|
'tanggal_awal' => date_format(date_create($start), "d/m/Y"),
|
|
'tanggal_akhir' => date_format(date_create($end), "d/m/Y"),
|
|
'jumlah_kolom' => count($pilih_tabel),
|
|
'nama_tabel' => $pilih_tabel,
|
|
'laporan' => $laporan,
|
|
'judul' => $judul,
|
|
'totalDpp' => number_format($totalDpp,2),
|
|
'totalHpp' => number_format($totalHpp,2),
|
|
'totalMar' => number_format($totalMar,2),
|
|
];
|
|
$this->load->view('cetak/excel_marginpenjualan', $data);
|
|
}
|
|
|
|
//MENU PENJUALAN
|
|
public function dataPenjualan_Keuangan_A1() {
|
|
$kondisi = $this->input->post('kondisi');
|
|
$id_corp = $this->input->post('id_corp');
|
|
$id_pelanggan = $this->input->post('id_pelanggan');
|
|
$id_sales = $this->input->post('id_sales');
|
|
$tgl = date('Y-m-d');
|
|
$datCorp = $this->Laporan->getData_Corp();
|
|
$datPelanggan = $this->Laporan->getData_Pelanggan();
|
|
$datSales = $this->Laporan->getData_Sales();
|
|
|
|
if ($kondisi==null){
|
|
$id_corp = NULL;
|
|
$id_pelanggan = NULL;
|
|
$id_sales = NULL;
|
|
$all = 0 ;
|
|
$total_penjualan = NULL;
|
|
$tanggal_awal = date('Y-m-d');
|
|
$tanggal_akhir = date('Y-m-d');
|
|
$awal = date('d/m/Y');
|
|
$akhir = date('d/m/Y');
|
|
$title = "Belum Terpilih*";
|
|
} else if ($kondisi!=null AND $id_pelanggan=="") {
|
|
$id_pelanggan = NULL;
|
|
$tanggal_awal = $this->input->post('tanggal_awal');
|
|
$tanggal_akhir = $this->input->post('tanggal_akhir');
|
|
$awal = date_format(date_create($tanggal_awal), "d/m/Y");
|
|
$akhir = date_format(date_create($tanggal_akhir), "d/m/Y");
|
|
$title = "Semua Pelanggan";
|
|
$sumPda = $this->Laporan->getSum_Penjualan_LaporanPenjualan($tanggal_awal, $tanggal_akhir, $id_pelanggan, $id_corp);
|
|
$total_penjualan = $sumPda[0]['TOTAL'];
|
|
$all = 1;
|
|
} else {
|
|
$all = 2;
|
|
$tanggal_awal = $this->input->post('tanggal_awal');
|
|
$tanggal_akhir = $this->input->post('tanggal_akhir');
|
|
$awal = date_format(date_create($tanggal_awal), "d/m/Y");
|
|
$akhir = date_format(date_create($tanggal_akhir), "d/m/Y");
|
|
$dataPelanggan = $this->Laporan->getData_Pelanggan($id_pelanggan);
|
|
$nama_pelanggan = $dataPelanggan[0]['NAMA_PELANGGAN'];
|
|
$nama_kota = $dataPelanggan[0]['NAMA_KOTA'];
|
|
$title = "$nama_pelanggan ($nama_kota)";
|
|
$sumPda = $this->Laporan->getSum_Penjualan_LaporanPenjualan($tanggal_awal, $tanggal_akhir, $id_pelanggan, $id_corp);
|
|
$total_penjualan = $sumPda[0]['TOTAL'];
|
|
}
|
|
$laporan = $this->Laporan->getData_Penjualan($tanggal_awal, $tanggal_akhir, $all, $id_pelanggan, $id_corp);
|
|
$data = [
|
|
'sidebar' => "menu laporan",
|
|
'navChild' => "laporan penjualan",
|
|
'laporan' => $laporan,
|
|
'tgl' => $tgl,
|
|
'id_corp' => $id_corp,
|
|
'id_pelanggan' => $id_pelanggan,
|
|
'id_sales' => $id_sales,
|
|
'corp' => $datCorp,
|
|
'sales' => $datSales,
|
|
'pelanggan' => $datPelanggan,
|
|
'pel' => $datPelanggan,
|
|
'awal' => $awal,
|
|
'akhir' => $akhir,
|
|
'tanggal_awal' => $tanggal_awal,
|
|
'tanggal_akhir' => $tanggal_akhir,
|
|
'title' => $title,
|
|
'all' => $all,
|
|
'total_penjualan' => $total_penjualan
|
|
];
|
|
$this->load->view('proses/LaporanPenjualan_Keuangan_A1', $data);
|
|
}
|
|
|
|
public function simpan_excel_penjualan() {
|
|
$start = $this->input->post('start');
|
|
$end = $this->input->post('end');
|
|
$all = $this->input->post('all');
|
|
$id_corp = $this->input->post('id_corp');
|
|
$id_pelanggan = $this->input->post('id_pelanggan');
|
|
if ($all==1) {
|
|
$pilih_tabel = array('No', 'Kode', 'Atas Nama', 'Sales', 'Pelanggan', 'Nomor PO', 'SJ Penjualan', 'Tanggal', 'Nota Penjualan', 'Faktur Pajak' , 'PPN', 'TOP', 'TT', 'Jatuh Tempo', 'Nilai DPP', 'Nilai PPN', 'Nilai TOTAL', 'Keterangan');
|
|
} else if ($all==2) {
|
|
$pilih_tabel = array('No', 'Kode', 'Atas Nama', 'Sales', 'Nomor PO', 'SJ Penjualan', 'Tanggal', 'Nota Penjualan', 'Faktur Pajak' , 'PPN', 'TOP', 'TT', 'Jatuh Tempo', 'Nilai DPP', 'Nilai PPN', 'Nilai TOTAL', 'Keterangan');
|
|
}
|
|
if ($all==2) {
|
|
$datPelanggan = $this->Laporan->getData_Pelanggan($id_pelanggan);
|
|
$nama_pelanggan = $datPelanggan[0]['NAMA_PELANGGAN'];
|
|
$nama_kota = $datPelanggan[0]['NAMA_KOTA'];
|
|
$judul = "$nama_pelanggan ($nama_kota)";
|
|
} else {
|
|
$judul = "Semua Pelanggan";
|
|
}
|
|
|
|
$dataLaporan = $this->Laporan->getData_Penjualan($start, $end, $all, $id_pelanggan, $id_corp);
|
|
|
|
$data = [
|
|
'title' => '',
|
|
'tanggal_awal' => date_format(date_create($start), "d/m/Y"),
|
|
'tanggal_akhir' => date_format(date_create($end), "d/m/Y"),
|
|
'jumlah_kolom' => count($pilih_tabel),
|
|
'nama_tabel' => $pilih_tabel,
|
|
'laporan' => $dataLaporan,
|
|
'judul' => $judul
|
|
];
|
|
|
|
if ($all==1) {
|
|
$this->load->view('cetak/excel_penjualan_all', $data);
|
|
} else if ($all==2) {
|
|
$this->load->view('cetak/excel_penjualan_single', $data);
|
|
}
|
|
}
|
|
|
|
public function dataReturJual_Keuangan_A1() {
|
|
$kondisi = $this->input->post('kondisi');
|
|
$id_corp = $this->input->post('id_corp');
|
|
$id_pelanggan = $this->input->post('id_pelanggan');
|
|
$datCorp = $this->Laporan->getData_Corp();
|
|
$datPelanggan = $this->Laporan->getData_Pelanggan();
|
|
$tgl = date('Y-m-d');
|
|
if ($kondisi==null){
|
|
$id_corp = NULL;
|
|
$id_pelanggan = NULL;
|
|
$total_retur = NULL;
|
|
$all = 0 ;
|
|
$tanggal_awal = date('Y-m-d');
|
|
$tanggal_akhir = date('Y-m-d');
|
|
$awal = date('d/m/Y');
|
|
$akhir = date('d/m/Y');
|
|
$title = "Belum Terpilih*";
|
|
} else if ($kondisi!=null AND $id_pelanggan=="") {
|
|
$id_pelanggan = NULL;
|
|
$tanggal_awal = $this->input->post('tanggal_awal');
|
|
$tanggal_akhir = $this->input->post('tanggal_akhir');
|
|
$awal = date_format(date_create($tanggal_awal), "d/m/Y");
|
|
$akhir = date_format(date_create($tanggal_akhir), "d/m/Y");
|
|
$title = "Semua Pelanggan";
|
|
$sumRetur = $this->Laporan->getSum_ReturJual_LaporanPenjualan($tanggal_awal, $tanggal_akhir, $id_pelanggan, $id_corp);
|
|
$total_retur = $sumRetur[0]['TOTAL'];
|
|
$all = 1;
|
|
} else {
|
|
$all = 2;
|
|
$tanggal_awal = $this->input->post('tanggal_awal');
|
|
$tanggal_akhir = $this->input->post('tanggal_akhir');
|
|
$awal = date_format(date_create($tanggal_awal), "d/m/Y");
|
|
$akhir = date_format(date_create($tanggal_akhir), "d/m/Y");
|
|
$dataPelanggan = $this->Laporan->getData_Pelanggan($id_pelanggan);
|
|
$nama_pelanggan = $dataPelanggan[0]['NAMA_PELANGGAN'];
|
|
$nama_kota = $dataPelanggan[0]['NAMA_KOTA'];
|
|
$title = "$nama_pelanggan ($nama_kota)";
|
|
$sumRetur = $this->Laporan->getSum_ReturJual_LaporanPenjualan($tanggal_awal, $tanggal_akhir, $id_pelanggan, $id_corp);
|
|
$total_retur = $sumRetur[0]['TOTAL'];
|
|
}
|
|
$laporan = $this->Laporan->getData_ReturJual($tanggal_awal, $tanggal_akhir, $all, $id_pelanggan, $id_corp);
|
|
$data = [
|
|
'sidebar' => "menu laporan",
|
|
'navChild' => "laporan returjual",
|
|
'laporan' => $laporan,
|
|
'id_corp' => $id_corp,
|
|
'id_pelanggan' => $id_pelanggan,
|
|
'tgl' => $tgl,
|
|
'corp' => $datCorp,
|
|
'pelanggan' => $datPelanggan,
|
|
'pel' => $datPelanggan,
|
|
'awal' => $awal,
|
|
'akhir' => $akhir,
|
|
'tanggal_awal' => $tanggal_awal,
|
|
'tanggal_akhir' => $tanggal_akhir,
|
|
'title' => $title,
|
|
'all' => $all,
|
|
'total_retur' => $total_retur
|
|
];
|
|
$this->load->view('proses/LaporanReturJual_Keuangan_A1', $data);
|
|
}
|
|
|
|
public function simpan_excel_returjual() {
|
|
$start = $this->input->post('start');
|
|
$end = $this->input->post('end');
|
|
$all = $this->input->post('all');
|
|
$id_corp = $this->input->post('id_corp');
|
|
$id_pelanggan = $this->input->post('id_pelanggan');
|
|
if ($all==1) {
|
|
$pilih_tabel = array('No', 'Kode', 'Atas Nama', 'Sales', 'Pelanggan', 'Tanggal', 'Nota Penjualan', 'Nota Retur', 'PPN', 'Nilai DPP', 'Nilai PPN', 'Nilai TOTAL', 'Keterangan');
|
|
} else if ($all==2) {
|
|
$pilih_tabel = array('No', 'Kode', 'Atas Nama', 'Sales', 'Tanggal', 'Nota Penjualan', 'Nota Retur', 'PPN', 'Nilai DPP', 'Nilai PPN', 'Nilai TOTAL', 'Keterangan');
|
|
}
|
|
|
|
$dataLaporan = $this->Laporan->getData_ReturJual($start, $end, $all, $id_pelanggan, $id_corp);
|
|
if ($all==2) {
|
|
$datPelanggan = $this->Laporan->getData_Pelanggan($id_pelanggan);
|
|
$nama_pelanggan = $datPelanggan[0]['NAMA_PELANGGAN'];
|
|
$nama_kota = $datPelanggan[0]['NAMA_KOTA'];
|
|
$judul = "$nama_pelanggan ($nama_kota)";
|
|
} else {
|
|
$judul = "Semua Pelanggan";
|
|
}
|
|
|
|
$data = [
|
|
'title' => '',
|
|
'tanggal_awal' => date_format(date_create($start), "d/m/Y"),
|
|
'tanggal_akhir' => date_format(date_create($end), "d/m/Y"),
|
|
'jumlah_kolom' => count($pilih_tabel),
|
|
'nama_tabel' => $pilih_tabel,
|
|
'laporan' => $dataLaporan,
|
|
'judul' => $judul,
|
|
];
|
|
|
|
if ($all==1) {
|
|
$this->load->view('cetak/excel_returjual_all', $data);
|
|
} else if ($all==2) {
|
|
$this->load->view('cetak/excel_returjual_single', $data);
|
|
}
|
|
}
|
|
|
|
public function dataAnalisaPenjualan_Administrator_A1() {
|
|
$kondisi = $this->input->post('kondisi');
|
|
$id_pelanggan = $this->input->post('id_pelanggan');
|
|
$id_jenis = $this->input->post('id_jenis');
|
|
$id_merk = $this->input->post('id_merk');
|
|
$id_model = $this->input->post('id_model');
|
|
$tgl = date('Y-m-d');
|
|
$datPelanggan = $this->Laporan->getData_Pelanggan();
|
|
$datJenis = $this->Laporan->getData_Jenis();
|
|
$datMerk = $this->Laporan->getData_Merk();
|
|
$datModel = $this->Laporan->getData_Model();
|
|
|
|
if ($kondisi==null){
|
|
$all = 0 ;
|
|
$id_pelanggan = NULL;
|
|
$id_jenis = NULL;
|
|
$id_merk = NULL;
|
|
$id_model = NULL;
|
|
$tanggal_awal = date('Y-m-d');
|
|
$tanggal_akhir = date('Y-m-d');
|
|
$awal = date('d/m/Y');
|
|
$akhir = date('d/m/Y');
|
|
$title = "Belum Terpilih*";
|
|
} else {
|
|
$all = 1;
|
|
$tanggal_awal = $this->input->post('tanggal_awal');
|
|
$tanggal_akhir = $this->input->post('tanggal_akhir');
|
|
$awal = date_format(date_create($tanggal_awal), "d/m/Y");
|
|
$akhir = date_format(date_create($tanggal_akhir), "d/m/Y");
|
|
if ($id_pelanggan == "") {
|
|
$id_pelanggan = NULL;
|
|
$nama_pelanggan = "Semua Pelanggan";
|
|
} else {
|
|
$dataPelanggan = $this->Laporan->getData_Pelanggan($id_pelanggan);
|
|
$nama_pelanggan = $dataPelanggan[0]['NAMA_PELANGGAN'];
|
|
}
|
|
if ($id_jenis == "") {
|
|
$id_jenis = NULL;
|
|
$nama_jenis = "Semua Jenis";
|
|
} else {
|
|
$dataJenis = $this->Laporan->getData_Jenis($id_jenis);
|
|
$nama_jenis = $dataJenis[0]['NAMA_JENIS'];
|
|
}
|
|
if ($id_merk == "") {
|
|
$id_merk = NULL;
|
|
$nama_merk = "Semua Merk";
|
|
} else {
|
|
$dataMerk = $this->Laporan->getData_Merk($id_merk);
|
|
$nama_merk = $dataMerk[0]['NAMA_MERK'];
|
|
}
|
|
if ($id_model == "") {
|
|
$id_model = NULL;
|
|
$nama_model = "Semua Model";
|
|
} else {
|
|
$dataModel = $this->Laporan->getData_Model($id_model);
|
|
$nama_model = $dataModel[0]['NAMA_MODEL'];
|
|
}
|
|
$title = "Pelanggan ($nama_pelanggan) | Jenis ($nama_jenis) | Merk ($nama_merk) | Model ($nama_model)";
|
|
}
|
|
$laporan = $this->Laporan->getData_DaftarOrder_forAnalisaPenjualan($tanggal_awal, $tanggal_akhir, $all, $id_pelanggan, $id_jenis, $id_merk, $id_model);
|
|
$data = [
|
|
'sidebar' => "menu laporan",
|
|
'navChild' => "laporan analisa penjualan",
|
|
'laporan' => $laporan,
|
|
'tgl' => $tgl,
|
|
'pelanggan' => $datPelanggan,
|
|
'jenis' => $datJenis,
|
|
'merk' => $datMerk,
|
|
'model' => $datModel,
|
|
'awal' => $awal,
|
|
'akhir' => $akhir,
|
|
'tanggal_awal' => $tanggal_awal,
|
|
'tanggal_akhir' => $tanggal_akhir,
|
|
'title' => $title,
|
|
'all' => $all,
|
|
'id_pelanggan' => $id_pelanggan,
|
|
'id_jenis' => $id_jenis,
|
|
'id_merk' => $id_merk,
|
|
'id_model' => $id_model
|
|
];
|
|
$this->load->view('proses/LaporanAnalisaPenjualan_Administrator_A1', $data);
|
|
}
|
|
|
|
public function simpan_excel_analisapenjualan() {
|
|
$start = $this->input->post('start');
|
|
$end = $this->input->post('end');
|
|
$all = $this->input->post('all');
|
|
$id_pelanggan = $this->input->post('id_pelanggan');
|
|
$id_jenis = $this->input->post('id_jenis');
|
|
$id_merk = $this->input->post('id_merk');
|
|
$id_model = $this->input->post('id_model');
|
|
|
|
$pilih_tabel = array('No', 'Jenis', 'Merk', 'Model', 'Kode Barang', 'Nama Barang', 'Total');
|
|
$dataLaporan = $this->Laporan->getData_DaftarOrder_forAnalisaPenjualan($start, $end, $all, $id_pelanggan, $id_jenis, $id_merk, $id_model);
|
|
|
|
$data = [
|
|
'title' => '',
|
|
'tanggal_awal' => date_format(date_create($start), "d/m/Y"),
|
|
'tanggal_akhir' => date_format(date_create($end), "d/m/Y"),
|
|
'jumlah_kolom' => count($pilih_tabel),
|
|
'nama_tabel' => $pilih_tabel,
|
|
'laporan' => $dataLaporan,
|
|
];
|
|
$this->load->view('cetak/excel_analisapenjualan', $data);
|
|
}
|
|
|
|
//MENU BATAL JUAL
|
|
public function dataBatalJual_Keuangan_A1() {
|
|
$kondisi = $this->input->post('kondisi');
|
|
$id_pelanggan = $this->input->post('id_pelanggan');
|
|
$tgl = date('Y-m-d');
|
|
$datPelanggan = $this->Laporan->getData_Pelanggan();
|
|
|
|
if ($kondisi==null){
|
|
$id_pelanggan = NULL;
|
|
$all = 0 ;
|
|
$tanggal_awal = date('Y-m-d');
|
|
$tanggal_akhir = date('Y-m-d');
|
|
$awal = date('d/m/Y');
|
|
$akhir = date('d/m/Y');
|
|
$title = "Belum Terpilih*";
|
|
} else if ($kondisi!=null AND $id_pelanggan=="") {
|
|
$id_pelanggan = NULL;
|
|
$tanggal_awal = $this->input->post('tanggal_awal');
|
|
$tanggal_akhir = $this->input->post('tanggal_akhir');
|
|
$awal = date_format(date_create($tanggal_awal), "d/m/Y");
|
|
$akhir = date_format(date_create($tanggal_akhir), "d/m/Y");
|
|
$title = "Semua Pelanggan";
|
|
$all = 1;
|
|
} else {
|
|
$all = 2;
|
|
$tanggal_awal = $this->input->post('tanggal_awal');
|
|
$tanggal_akhir = $this->input->post('tanggal_akhir');
|
|
$awal = date_format(date_create($tanggal_awal), "d/m/Y");
|
|
$akhir = date_format(date_create($tanggal_akhir), "d/m/Y");
|
|
$dataPelanggan = $this->Laporan->getData_Pelanggan($id_pelanggan);
|
|
$nama_pelanggan = $dataPelanggan[0]['NAMA_PELANGGAN'];
|
|
$nama_kota = $dataPelanggan[0]['NAMA_KOTA'];
|
|
$title = "$nama_pelanggan ($nama_kota)";
|
|
}
|
|
$laporan = $this->Laporan->getData_Penjualan_Batal($tanggal_awal, $tanggal_akhir, $all, $id_pelanggan);
|
|
$data = [
|
|
'sidebar' => "menu laporan",
|
|
'navChild' => "laporan bataljual",
|
|
'laporan' => $laporan,
|
|
'tgl' => $tgl,
|
|
'pelanggan' => $datPelanggan,
|
|
'pel' => $datPelanggan,
|
|
'awal' => $awal,
|
|
'akhir' => $akhir,
|
|
'tanggal_awal' => $tanggal_awal,
|
|
'tanggal_akhir' => $tanggal_akhir,
|
|
'title' => $title,
|
|
'all' => $all,
|
|
'id_pelanggan' => $id_pelanggan
|
|
];
|
|
$this->load->view('proses/LaporanBatalJual_Keuangan_A1', $data);
|
|
}
|
|
|
|
public function simpan_excel_bataljual() {
|
|
$start = $this->input->post('start');
|
|
$end = $this->input->post('end');
|
|
$all = $this->input->post('all');
|
|
$id_pelanggan = $this->input->post('id_pelanggan');
|
|
if ($all==2) {
|
|
$pilih_tabel = array('No', 'Nomor SO', 'Tanggal Nota', 'Nomor Nota' , 'Nilai Nota' , 'Tanggal Batal' , 'Keterangan');
|
|
} else if ($all==1) {
|
|
$pilih_tabel = array('No', 'Nomor SO', 'Pelanggan', 'Tanggal Nota', 'Nomor Nota' , 'Nilai Nota' , 'Tanggal Batal' , 'Keterangan');
|
|
}
|
|
$laporan = $this->Laporan->getData_Penjualan_Batal($start, $end, $all, $id_pelanggan);
|
|
if ($all==2) {
|
|
$datPelanggan = $this->Laporan->getData_Pelanggan($id_pelanggan);
|
|
$nama_pelanggan = $datPelanggan[0]['NAMA_PELANGGAN'];
|
|
$nama_kota = $datPelanggan[0]['NAMA_KOTA'];
|
|
$judul = "$nama_pelanggan ($nama_kota)";
|
|
} else {
|
|
$judul = "Semua Pelanggan";
|
|
}
|
|
$data =
|
|
[
|
|
'title' => '',
|
|
'tanggal_awal' => date_format(date_create($start), "d/m/Y"),
|
|
'tanggal_akhir' => date_format(date_create($end), "d/m/Y"),
|
|
'jumlah_kolom' => count($pilih_tabel),
|
|
'nama_tabel' => $pilih_tabel,
|
|
'laporan' => $laporan,
|
|
'judul' => $judul,
|
|
|
|
];
|
|
if ($all==2) {
|
|
$this->load->view('cetak/excel_bataljual_single', $data);
|
|
} else if ($all==1) {
|
|
$this->load->view('cetak/excel_bataljual_all', $data);
|
|
}
|
|
}
|
|
|
|
//MENU ANALISA MARKETING
|
|
public function dataAnalisaMarketing_Sales_A1() {
|
|
$kondisi = $this->input->post('kondisi');
|
|
$id_sales = $this->input->post('id_sales');
|
|
$jenis = $this->input->post('jenis');
|
|
$tgl = date('Y-m-d');
|
|
$datSales = $this->Laporan->getData_Sales();
|
|
|
|
if ($kondisi==null){
|
|
$id_sales = NULL;
|
|
$all = 0 ;
|
|
$tanggal_awal = date('Y-m-d');
|
|
$tanggal_akhir = date('Y-m-d');
|
|
$awal = date('d/m/Y');
|
|
$akhir = date('d/m/Y');
|
|
$title = "Belum Terpilih*";
|
|
} else if ($kondisi!=null AND $id_sales=="") {
|
|
$id_sales = NULL;
|
|
$tanggal_awal = $this->input->post('tanggal_awal');
|
|
$tanggal_akhir = $this->input->post('tanggal_akhir');
|
|
$awal = date_format(date_create($tanggal_awal), "d/m/Y");
|
|
$akhir = date_format(date_create($tanggal_akhir), "d/m/Y");
|
|
$title = "Semua Sales";
|
|
$all = 1;
|
|
} else {
|
|
$all = 2;
|
|
$tanggal_awal = $this->input->post('tanggal_awal');
|
|
$tanggal_akhir = $this->input->post('tanggal_akhir');
|
|
$awal = date_format(date_create($tanggal_awal), "d/m/Y");
|
|
$akhir = date_format(date_create($tanggal_akhir), "d/m/Y");
|
|
$dataSales = $this->Laporan->getData_Sales($id_sales);
|
|
$nama_sales = $dataSales[0]['NAMA_PANGGILAN_KARYAWAN'];
|
|
$title = "$nama_sales";
|
|
}
|
|
|
|
$laporan = $this->Laporan->getData_Penjualan_AnalisaMarketing($tanggal_awal, $tanggal_akhir, $all, $id_sales);
|
|
|
|
if ($all == 0) {
|
|
$totalOrder = 0;
|
|
$input = NULL;
|
|
} else if ($all == 1) {
|
|
$totalOrder = 0;
|
|
$no = 0;
|
|
$sales_id = NULL;
|
|
$input = NULL;
|
|
foreach ($laporan as $key) {
|
|
if ($sales_id!=$key['SALES_ID']) {
|
|
$sales_id = $key['SALES_ID'];
|
|
$sumDo = $this->Laporan->getSum_Penjualan_AnalisaMarketing($tanggal_awal, $tanggal_akhir, $sales_id, $jenis);
|
|
$datKaryawan = $this->Laporan->getData_Karyawan($sales_id);
|
|
$input[$no++] = [
|
|
'HARGA' => $sumDo[0]['HARGA'],
|
|
'SALES' => $datKaryawan[0]['NAMA_PANGGILAN_KARYAWAN']
|
|
];
|
|
}
|
|
}
|
|
} else if ($all == 2) {
|
|
$sumDo = $this->Laporan->getSum_Penjualan_AnalisaMarketing($tanggal_awal, $tanggal_akhir, $id_sales, $jenis);
|
|
//var_dump($sumDo);
|
|
//die();
|
|
if ($sumDo[0]['HARGA']==NULL) {
|
|
$totalOrder = NULL ;
|
|
} else {
|
|
$totalOrder = $sumDo[0]['HARGA'];
|
|
}
|
|
$input = NULL;
|
|
}
|
|
|
|
$data = [
|
|
'sidebar' => "menu laporan",
|
|
'navChild' => "laporan analisamarketing",
|
|
'laporan' => $laporan,
|
|
'tgl' => $tgl,
|
|
'sales' => $datSales,
|
|
'awal' => $awal,
|
|
'akhir' => $akhir,
|
|
'tanggal_awal' => $tanggal_awal,
|
|
'tanggal_akhir' => $tanggal_akhir,
|
|
'title' => $title,
|
|
'all' => $all,
|
|
'jenis' => $jenis,
|
|
'id_sales' => $id_sales,
|
|
'input' => $input,
|
|
'totalOrder' => $totalOrder
|
|
];
|
|
$this->load->view('proses/LaporanAnalisaMarketing_Sales_A1', $data);
|
|
}
|
|
|
|
//MENU KOMISI
|
|
public function dataKomisi_Keuangan_A1() {
|
|
$kondisi = $this->input->post('kondisi');
|
|
$id_sales = $this->input->post('id_sales');
|
|
$datSales = $this->Laporan->getData_Sales();
|
|
$tgl = date('Y-m-d');
|
|
|
|
if ($kondisi==null){
|
|
$tanggal_awal_nota = date('Y-m-d');
|
|
$tanggal_akhir_nota = date('Y-m-d');
|
|
$tanggal_awal_lunas = date('Y-m-d');
|
|
$tanggal_akhir_lunas = date('Y-m-d');
|
|
$awalnota = date('d/m/Y');
|
|
$akhirnota = date('d/m/Y');
|
|
$awallunas = date('d/m/Y');
|
|
$akhirlunas = date('d/m/Y');
|
|
$id_sales = NULL;
|
|
$all = 0;
|
|
$title = "Belum Terpilih*";
|
|
} else if ($kondisi!=null AND $id_sales=="") {
|
|
$tanggal_awal_nota = $this->input->post('tanggal_awal_nota');
|
|
$tanggal_akhir_nota = $this->input->post('tanggal_akhir_nota');
|
|
$tanggal_awal_lunas = $this->input->post('tanggal_awal_lunas');
|
|
$tanggal_akhir_lunas = $this->input->post('tanggal_akhir_lunas');
|
|
$awalnota = date_format(date_create($tanggal_awal_nota), "d/m/Y");
|
|
$akhirnota = date_format(date_create($tanggal_akhir_nota), "d/m/Y");
|
|
$awallunas = date_format(date_create($tanggal_awal_lunas), "d/m/Y");
|
|
$akhirlunas = date_format(date_create($tanggal_akhir_lunas), "d/m/Y");
|
|
$title = "Semua Sales";
|
|
$all = 1;
|
|
$id_sales = NULL;
|
|
} else {
|
|
$tanggal_awal_nota = $this->input->post('tanggal_awal_nota');
|
|
$tanggal_akhir_nota = $this->input->post('tanggal_akhir_nota');
|
|
$tanggal_awal_lunas = $this->input->post('tanggal_awal_lunas');
|
|
$tanggal_akhir_lunas = $this->input->post('tanggal_akhir_lunas');
|
|
$awalnota = date_format(date_create($tanggal_awal_nota), "d/m/Y");
|
|
$akhirnota = date_format(date_create($tanggal_akhir_nota), "d/m/Y");
|
|
$awallunas = date_format(date_create($tanggal_awal_lunas), "d/m/Y");
|
|
$akhirlunas = date_format(date_create($tanggal_akhir_lunas), "d/m/Y");
|
|
$dataSales = $this->Laporan->getData_Sales($id_sales);
|
|
$nama_sales = $dataSales[0]['NAMA_PANGGILAN_KARYAWAN'];
|
|
$title = "$nama_sales";
|
|
$all = 2;
|
|
}
|
|
|
|
$laporan = $this->Laporan->getData_Penjualan_Komisi($tanggal_awal_nota, $tanggal_akhir_nota, $all, $id_sales);
|
|
$no = 0;
|
|
$nosal = 0;
|
|
$input = NULL;
|
|
$sales_id = NULL;
|
|
$so_id = NULL;
|
|
$totalFee = 0;
|
|
$totalKomisi = 0;
|
|
$countLaporan = count($laporan);
|
|
foreach ($laporan as $key) {
|
|
if ($sales_id!=$key['SALES_ID']) {
|
|
if ($totalKomisi==0) {
|
|
$sales_id = $key['SALES_ID'];
|
|
} else {
|
|
$datKaryawan = $this->Laporan->getData_Karyawan($sales_id);
|
|
$forKomisi = number_format($totalKomisi,2);
|
|
$input[$nosal++] = [
|
|
'KOMISI' => $forKomisi,
|
|
'SALES' => $datKaryawan[0]['NAMA_PANGGILAN_KARYAWAN']
|
|
];
|
|
$sales_id = $key['SALES_ID'];
|
|
$totalKomisi = 0;
|
|
}
|
|
}
|
|
|
|
if ($so_id!=$key['SO_ID']) {
|
|
$so_id = $key['SO_ID'];
|
|
$totalFee = $key['FEE_SO'];
|
|
}
|
|
|
|
$totalDo = $key['QTY_DO']*$key['HARGA_DO'];
|
|
if ($totalFee>0) {
|
|
if ($totalFee>$totalDo) {
|
|
$totalFee = $totalFee-$totalDo;
|
|
$totalDo = 0;
|
|
} else if ($totalFee<=$totalDo) {
|
|
$totalDo = $totalDo-$totalFee;
|
|
$totalFee = 0;
|
|
}
|
|
}
|
|
$subtotalKomisi = $totalDo*($key['KOMISI_DO']/100);
|
|
$viewTotalKomisi = number_format($subtotalKomisi,2);
|
|
$laporan[$no] += ['KOMISI' => $viewTotalKomisi];
|
|
|
|
$datPda = $this->Laporan->getData_PiutangDagang_byPENJUALAN_forKomisi($key['PENJUALAN_ID']);
|
|
$id_dkb = $datPda[count($datPda)-1]['DKB_ID'];
|
|
$id_djm = $datPda[count($datPda)-1]['DJM_ID'];
|
|
$kode_bukti = $datPda[count($datPda)-1]['KODE_BUKTI'];
|
|
if ($id_dkb==NULL AND $id_djm!=NULL) {
|
|
$datJm = $this->Laporan->getData_JurnalMemo_byKODE($kode_bukti);
|
|
$tanggalLunas = $datJm[0]['TGL_JM'];
|
|
} else if ($id_djm==NULL AND $id_dkb!=NULL) {
|
|
$datKb = $this->Laporan->getData_Kasbank_byKODE($kode_bukti);
|
|
$tanggalLunas = $datKb[0]['TGL_INPUT'];
|
|
} else {
|
|
$tanggalLunas = $datPda[count($datPda)-1]['TGL_PDA'];
|
|
}
|
|
|
|
if ($tanggalLunas>=$tanggal_awal_lunas AND $tanggalLunas<=$tanggal_akhir_lunas) {
|
|
$show = 1;
|
|
} else {
|
|
$show = 0;
|
|
}
|
|
|
|
$add2month = $this->Laporan->addTempoMonth($key['INV_PENJUALAN'],2);
|
|
if ($add2month<=$tanggalLunas) {
|
|
$approve = 1;
|
|
} else {
|
|
$approve = 0;
|
|
}
|
|
|
|
$tglLunas = date_format(date_create($tanggalLunas), "d/m/Y");
|
|
$laporan[$no] += ['TGLLUNAS' => $tglLunas];
|
|
$laporan[$no] += ['KODEBUKTI' => $kode_bukti];
|
|
$laporan[$no] += ['SHOW' => $show];
|
|
$laporan[$no] += ['APPROVE' => $approve];
|
|
|
|
$qty = $key['QTY_DO'];
|
|
$kode_barang = $key['KODE_BARANG'];
|
|
$kode_barang = strtoupper($kode_barang);
|
|
$ket_komisi = "$qty EA $kode_barang";
|
|
$laporan[$no++] += ['KET' => $ket_komisi];
|
|
|
|
if ($approve==1 AND $show==1) {
|
|
$subtotalKomisi = round($subtotalKomisi,2);
|
|
$totalKomisi = $totalKomisi+$subtotalKomisi;
|
|
}
|
|
|
|
if ($no==$countLaporan) {
|
|
$datKaryawan = $this->Laporan->getData_Karyawan($sales_id);
|
|
$forKomisi = number_format($totalKomisi,2);
|
|
$input[$nosal++] = [
|
|
'KOMISI' => $forKomisi,
|
|
'SALES' => $datKaryawan[0]['NAMA_PANGGILAN_KARYAWAN']
|
|
];
|
|
}
|
|
}
|
|
|
|
$data = [
|
|
'sidebar' => "menu laporan",
|
|
'navChild' => "laporan komisi",
|
|
'laporan' => $laporan,
|
|
'tgl' => $tgl,
|
|
'sales' => $datSales,
|
|
'awalnota' => $awalnota,
|
|
'akhirnota' => $akhirnota,
|
|
'awallunas' => $awallunas,
|
|
'akhirlunas' => $akhirlunas,
|
|
'tanggal_awal_nota' => $tanggal_awal_nota,
|
|
'tanggal_akhir_nota' => $tanggal_akhir_nota,
|
|
'tanggal_awal_lunas' => $tanggal_awal_lunas,
|
|
'tanggal_akhir_lunas' => $tanggal_akhir_lunas,
|
|
'title' => $title,
|
|
'all' => $all,
|
|
'id_sales' => $id_sales,
|
|
'totalKomisi' => $totalKomisi,
|
|
'input' => $input
|
|
];
|
|
$this->load->view('proses/LaporanKomisi_Keuangan_A1', $data);
|
|
}
|
|
|
|
public function simpan_excel_komisi() {
|
|
$laporan = $this->input->post('laporan');
|
|
$id_sales = $this->input->post('id_sales');
|
|
$all = $this->input->post('all');
|
|
$tanggal_awal_nota = $this->input->post('tanggal_awal_nota');
|
|
$tanggal_akhir_nota = $this->input->post('tanggal_akhir_nota');
|
|
$tanggal_awal_lunas = $this->input->post('tanggal_awal_lunas');
|
|
$tanggal_akhir_lunas = $this->input->post('tanggal_akhir_lunas');
|
|
|
|
|
|
if ($all==2) {
|
|
$pilih_tabel = array('No', 'Tanggal Nota', 'Kode Bukti', 'Pelanggan' , 'Jenis' , 'Keterangan', 'Nilai Nota' , 'Kode Pelunasan' , 'Tanggal Lunas', 'Total Komisi', 'Status');
|
|
} else if ($all==1) {
|
|
$pilih_tabel = array('No', 'Tanggal Nota', 'Kode Bukti', 'Pelanggan' , 'Sales' , 'Jenis' , 'Keterangan', 'Nilai Nota' , 'Kode Pelunasan' , 'Tanggal Lunas', 'Total Komisi', 'Status');
|
|
}
|
|
|
|
if ($all==2) {
|
|
$datSales = $this->Laporan->getData_Karyawan($id_sales);
|
|
$nama_panggilan_karyawan = $datSales[0]['NAMA_PANGGILAN_KARYAWAN'];
|
|
$judul = "$nama_panggilan_karyawan";
|
|
} else {
|
|
$judul = "Semua Karyawan";
|
|
}
|
|
|
|
$laporan = $this->Laporan->getData_Penjualan_Komisi($tanggal_awal_nota, $tanggal_akhir_nota, $all, $id_sales);
|
|
$no = 0;
|
|
$nosal = 0;
|
|
$input = NULL;
|
|
$sales_id = NULL;
|
|
$so_id = NULL;
|
|
$totalFee = 0;
|
|
$totalKomisi = 0;
|
|
$countLaporan = count($laporan);
|
|
foreach ($laporan as $key) {
|
|
if ($sales_id!=$key['SALES_ID']) {
|
|
if ($totalKomisi==0) {
|
|
$sales_id = $key['SALES_ID'];
|
|
} else {
|
|
$datKaryawan = $this->Laporan->getData_Karyawan($sales_id);
|
|
$forKomisi = number_format($totalKomisi,2);
|
|
$input[$nosal++] = [
|
|
'KOMISI' => $forKomisi,
|
|
'SALES' => $datKaryawan[0]['NAMA_PANGGILAN_KARYAWAN']
|
|
];
|
|
$sales_id = $key['SALES_ID'];
|
|
$totalKomisi = 0;
|
|
}
|
|
}
|
|
|
|
if ($so_id!=$key['SO_ID']) {
|
|
$so_id = $key['SO_ID'];
|
|
$totalFee = $totalFee+$key['FEE_SO'];
|
|
}
|
|
|
|
$totalDo = $key['QTY_DO']*$key['HARGA_DO'];
|
|
if ($totalFee>0) {
|
|
if ($totalFee>$totalDo) {
|
|
$totalFee = $totalFee-$totalDo;
|
|
$totalDo = 0;
|
|
} else {
|
|
$totalDo = $totalDo-$totalFee;
|
|
$totalFee = 0;
|
|
}
|
|
}
|
|
$subtotalKomisi = $totalDo*($key['KOMISI_DO']/100);
|
|
$viewTotalKomisi = number_format($subtotalKomisi,2);
|
|
$laporan[$no] += ['KOMISI' => $viewTotalKomisi];
|
|
|
|
$datPda = $this->Laporan->getData_PiutangDagang_byPENJUALAN_forKomisi($key['PENJUALAN_ID']);
|
|
$id_dkb = $datPda[count($datPda)-1]['DKB_ID'];
|
|
$id_djm = $datPda[count($datPda)-1]['DJM_ID'];
|
|
$kode_bukti = $datPda[count($datPda)-1]['KODE_BUKTI'];
|
|
if ($id_dkb==NULL AND $id_djm!=NULL) {
|
|
$datJm = $this->Laporan->getData_JurnalMemo_byKODE($kode_bukti);
|
|
$tanggalLunas = $datJm[0]['TGL_JM'];
|
|
} else if ($id_djm==NULL AND $id_dkb!=NULL) {
|
|
$datKb = $this->Laporan->getData_Kasbank_byKODE($kode_bukti);
|
|
$tanggalLunas = $datKb[0]['TGL_INPUT'];
|
|
} else {
|
|
$tanggalLunas = $datPda[count($datPda)-1]['TGL_PDA'];
|
|
}
|
|
|
|
if ($tanggalLunas>=$tanggal_awal_lunas AND $tanggalLunas<=$tanggal_akhir_lunas) {
|
|
$show = 1;
|
|
} else {
|
|
$show = 0;
|
|
}
|
|
|
|
$add2month = $this->Laporan->addTempoMonth($key['INV_PENJUALAN'],2);
|
|
if ($add2month<=$tanggalLunas) {
|
|
$approve = 1;
|
|
} else {
|
|
$approve = 0;
|
|
}
|
|
|
|
$tglLunas = date_format(date_create($tanggalLunas), "d/m/Y");
|
|
$laporan[$no] += ['TGLLUNAS' => $tglLunas];
|
|
$laporan[$no] += ['KODEBUKTI' => $kode_bukti];
|
|
$laporan[$no] += ['SHOW' => $show];
|
|
$laporan[$no] += ['APPROVE' => $approve];
|
|
|
|
$qty = $key['QTY_DO'];
|
|
$kode_barang = $key['KODE_BARANG'];
|
|
$kode_barang = strtoupper($kode_barang);
|
|
$ket_komisi = "$qty EA $kode_barang";
|
|
$laporan[$no++] += ['KET' => $ket_komisi];
|
|
|
|
if ($approve==1 AND $show==1) {
|
|
$subtotalKomisi = round($subtotalKomisi,2);
|
|
$totalKomisi = $totalKomisi+$subtotalKomisi;
|
|
}
|
|
|
|
if ($no==$countLaporan) {
|
|
$datKaryawan = $this->Laporan->getData_Karyawan($sales_id);
|
|
$forKomisi = number_format($totalKomisi,2);
|
|
$input[$nosal++] = [
|
|
'KOMISI' => $forKomisi,
|
|
'SALES' => $datKaryawan[0]['NAMA_PANGGILAN_KARYAWAN']
|
|
];
|
|
}
|
|
}
|
|
|
|
$data = [
|
|
'title' => '',
|
|
'startnota' => date_format(date_create($tanggal_awal_nota), "d/m/Y"),
|
|
'endnota' => date_format(date_create($tanggal_akhir_nota), "d/m/Y"),
|
|
'startlunas' => date_format(date_create($tanggal_awal_lunas), "d/m/Y"),
|
|
'endlunas' => date_format(date_create($tanggal_akhir_lunas), "d/m/Y"),
|
|
'jumlah_kolom' => count($pilih_tabel),
|
|
'nama_tabel' => $pilih_tabel,
|
|
'laporan' => $laporan,
|
|
'judul' => $judul
|
|
];
|
|
if ($all==2) {
|
|
$this->load->view('cetak/excel_komisi_single', $data);
|
|
} else if ($all==1) {
|
|
$this->load->view('cetak/excel_komisi_all', $data);
|
|
}
|
|
}
|
|
|
|
//MENU GP KUARTAL
|
|
public function dataGpKuartal_Keuangan_A1() {
|
|
$kondisi = $this->input->post('kondisi');
|
|
$datRq = $this->Laporan->getData_RekapKuartal_status2();
|
|
$datRmq = $this->Laporan->getData_RumusKuartal_byID();
|
|
|
|
if ($kondisi==null){
|
|
$id_rq = NULL;
|
|
$id_rmq = NULL;
|
|
$status_transaksi = NULL;
|
|
$all = 0 ;
|
|
$tanggal = date('Y-m-d');
|
|
$sampai = date('d/m/Y');
|
|
$title = "Belum Terpilih*";
|
|
$rumus = "Belum Terpilih*";
|
|
} else {
|
|
$all = 1;
|
|
$id_rq = $this->input->post('id_rq');
|
|
$id_rmq = $this->input->post('id_rmq');
|
|
$status_transaksi = $this->input->post('status_transaksi');
|
|
$tanggal = $this->input->post('tanggal');
|
|
$sampai = date_format(date_create($tanggal), "d/m/Y");
|
|
$dataRq = $this->Laporan->getData_RekapKuartal_status2($id_rq);
|
|
$dataRmq = $this->Laporan->getData_RumusKuartal_byID($id_rmq);
|
|
$nama_kuartal = $dataRq[0]['NAMA_KUARTAL'];
|
|
$nama_sales = $dataRq[0]['NAMA_PANGGILAN_KARYAWAN'];
|
|
$title = "$nama_kuartal ($nama_sales)";
|
|
$nama_rumus = $dataRmq[0]['NAMA_RMQ'];
|
|
$rumus = "$nama_rumus";
|
|
}
|
|
|
|
$laporan = $this->Laporan->getData_Proyek_byRQ($id_rq);
|
|
|
|
$no = 0;
|
|
$totgp = 0;
|
|
foreach ($laporan as $key) {
|
|
//Nilai Proyek
|
|
$sumSpr = $this->Laporan->getSum_SoProyek_byPROYEK($key['ID_PROYEK']);
|
|
if ($sumSpr==FALSE) {
|
|
$sumSpr = 0;
|
|
} else {
|
|
$sumSpr = $sumSpr[0]['NILAI'];
|
|
}
|
|
|
|
$sumSprFee = $this->Laporan->getSum_SoProyek_byPROYEK_forFEE($key['ID_PROYEK']);
|
|
if ($sumSprFee==FALSE) {
|
|
$sumSprFee = 0;
|
|
} else {
|
|
$sumSprFee = $sumSprFee[0]['FEE'];
|
|
}
|
|
|
|
//Barang Proyek
|
|
$datProyek = $this->Laporan->getData_Proyek_byID($key['ID_PROYEK']);
|
|
if ($datProyek[0]['SO_ID']==NULL) {
|
|
//$sumDpr = $this->Laporan->getSum_DaftarProyek_byPROYEK($key['ID_PROYEK']);
|
|
//$barpro = $sumDpr[0]['TOTAL'];
|
|
$barpro = 0;
|
|
} else {
|
|
$barpro = 0;
|
|
}
|
|
|
|
//Barang SO
|
|
$datSpr = $this->Laporan->getData_SoProyek_byPROYEK($key['ID_PROYEK']);
|
|
$nokeydat = 0;
|
|
$datHppSo = [];
|
|
foreach ($datSpr as $keydat) {
|
|
$datDo = $this->Laporan->getData_DaftarOrder_bySO_jenisNot2($keydat['SID']);
|
|
$datIo0 = $this->Laporan->getData_TransaksiStock_bySO_jenis0($keydat['SID']);
|
|
$datIo1 = $this->Laporan->getData_TransaksiStock_bySO_jenis1($keydat['SID']);
|
|
|
|
foreach ($datDo as $dot) {
|
|
$datHppSo[$nokeydat++] = [
|
|
'BARANG_ID' => $dot['BARANG_ID'],
|
|
'QTY' => $dot['QTY_DO'],
|
|
'TGL' => $keydat['TGL_PENJUALAN'],
|
|
];
|
|
}
|
|
|
|
foreach ($datIo0 as $dot) {
|
|
$datHppSo[$nokeydat++] = [
|
|
'BARANG_ID' => $dot['BARANG_ID'],
|
|
'QTY' => $dot['QTY_IO'],
|
|
'TGL' => $keydat['TGL_PENJUALAN'],
|
|
];
|
|
}
|
|
}
|
|
|
|
$barso = 0;
|
|
foreach ($datHppSo as $dat) {
|
|
$datHq = $this->Laporan->getData_HistoriKuantiti_byBARANG_MasukLebih0_beforeTGL($dat['BARANG_ID'], $dat['TGL']);
|
|
$totkeluar = 0;
|
|
$totpersediaan = 0;
|
|
$hargaavglama = 0;
|
|
foreach ($datHq as $datkey) {
|
|
//Kuantiti Sebelumnya
|
|
$sumHq = $this->Laporan->getSum_HistoriKuantiti_byBARANG_byHQ($dat['BARANG_ID'], $datkey['ID_HQ']);
|
|
if ($totkeluar!=$sumHq[0]['KELUAR']) {
|
|
$totkeluar = $sumHq[0]['KELUAR'];
|
|
$datHqLimit = $this->Laporan->getData_HistoriKuantiti_limitHQ($dat['BARANG_ID'], $datkey['ID_HQ']);
|
|
$limit = $this->Laporan->getSum_HistoriKuantiti_byBARANG_byHQ1_byHQ2($dat['BARANG_ID'], $datkey['ID_HQ'], $datHqLimit[0]['ID_HQ']);
|
|
$keluar = $limit[0]['KELUAR'];
|
|
} else {
|
|
$keluar = 0;
|
|
$totkeluar = 0;
|
|
}
|
|
|
|
//Harga Per Item, DPP
|
|
$harga = $datkey['NILAI_HQ'] / $datkey['MASUK_HQ'];
|
|
//Nilai Total Persediaan Akhir
|
|
$nilaiPersediaanKeluar = $hargaavglama * $keluar;
|
|
$totpersediaan = $totpersediaan + ($harga * $datkey['MASUK_HQ']) - $nilaiPersediaanKeluar;
|
|
$hppakhir = $totpersediaan/$sumHq[0]['TOTAL'];
|
|
$hargaavglama = $hppakhir;
|
|
}
|
|
|
|
$hppakhir = round($hppakhir,2);
|
|
$subtot = $hppakhir * $dat['QTY'];
|
|
$barso = $barso + $subtot;
|
|
}
|
|
|
|
foreach ($datIo1 as $dot) {
|
|
$hargatotavg = $dot['QTY_IO']*$dot['HARGA_IO'];
|
|
$barso = $barso-$hargatotavg;
|
|
}
|
|
|
|
//Biaya Proyek
|
|
$sumHpr = $this->Laporan->getSum_HppProyek_byPROYEK($key['ID_PROYEK']);
|
|
|
|
//Biaya Lainnya
|
|
$sumBpry = $this->Laporan->getSum_BiayaProyek_byPROYEK($key['ID_PROYEK']);
|
|
|
|
//Sisa GP
|
|
$gp = $sumSpr-$sumSprFee-$barpro-$barso-$sumHpr[0]['TOTAL']-$sumBpry[0]['TOTAL'];
|
|
|
|
//Status Terbayar atau Belum
|
|
$maxSpr = count($datSpr);
|
|
$lunas = 0;
|
|
$retur = 0;
|
|
foreach ($datSpr as $keyspr) {
|
|
$sumPda = $this->Laporan->getSum_PiutangDagang_byPENJUALAN_TransaksiLunas($keyspr['ID_PENJUALAN'],$tanggal);
|
|
if ($sumPda[0]['TOTAL']==0 AND $sumPda[0]['TOTAL']!=NULL) {
|
|
$lunas++;
|
|
}
|
|
|
|
$datPda = $this->Laporan->getData_PiutangDagang_byPENJUALAN_status2($keyspr['ID_PENJUALAN'],$tanggal);
|
|
if ($datPda==TRUE) {
|
|
$retur++;
|
|
}
|
|
}
|
|
|
|
//Cek data Lunas atau Tidak
|
|
if ($lunas==$maxSpr AND $retur==0 AND $lunas>0) {
|
|
$lunasall = 1;
|
|
$laporan[$no] += ['STATUS' => "Lunas"];
|
|
} else {
|
|
$lunasall = 0;
|
|
$laporan[$no] += ['STATUS' => "Belum"];
|
|
}
|
|
|
|
//Set Data ditampilkan atau tidak
|
|
if ($status_transaksi==1) {
|
|
$laporan[$no] += ['SHOW' => 1];
|
|
} else if ($status_transaksi==2) {
|
|
if ($lunasall==1) {
|
|
$laporan[$no] += ['SHOW' => 1];
|
|
} else if ($lunasall==0) {
|
|
$laporan[$no] += ['SHOW' => 0];
|
|
}
|
|
} else if ($status_transaksi==3) {
|
|
if ($lunasall==0) {
|
|
$laporan[$no] += ['SHOW' => 1];
|
|
} else if ($lunasall==1) {
|
|
$laporan[$no] += ['SHOW' => 0];
|
|
}
|
|
}
|
|
|
|
//Isi Tambahan
|
|
$laporan[$no] += ['TOTALGP' => $gp];
|
|
$laporan[$no++] += ['TOTALGPAKHIR' => number_format($gp,2)];
|
|
|
|
//Tambah Total GP
|
|
$totgp = $totgp + $gp;
|
|
}
|
|
|
|
$no = 0;
|
|
$rate = 0;
|
|
foreach ($laporan as $key) {
|
|
//Set Angka untuk Rate Komisi berdasarkan Rumus yang dipilih
|
|
$datDrmq = $this->Laporan->getData_DaftarRumusKuartal_byRMQ($id_rmq);
|
|
foreach ($datDrmq as $keydrmq) {
|
|
if ($totgp>=$keydrmq['BAWAH_DRMQ'] AND $totgp<=$keydrmq['ATAS_DRMQ']) {
|
|
$rate = $keydrmq['RATE_DRMQ'];
|
|
break;
|
|
}
|
|
}
|
|
|
|
$komisiakhir = $rate*$key['TOTALGP'];
|
|
$rateakhir = $rate*100;
|
|
|
|
if ($key['STATUS']=="Lunas") {
|
|
$laporan[$no] += ['RATEAKHIR' => "$rateakhir%"];
|
|
$laporan[$no++] += ['TOTALKOMISIAKHIR' => number_format($komisiakhir,2)];
|
|
} else if ($key['STATUS']=="Belum") {
|
|
$laporan[$no] += ['RATEAKHIR' => NULL];
|
|
$laporan[$no++] += ['TOTALKOMISIAKHIR' => NULL];
|
|
}
|
|
}
|
|
|
|
if ($totgp==0) {
|
|
$gptotal = "0.00";
|
|
} else {
|
|
$gptotal = number_format($totgp,2);
|
|
}
|
|
|
|
$data = [
|
|
'sidebar' => "menu laporan",
|
|
'navChild' => "laporan gp kuartal",
|
|
'laporan' => $laporan,
|
|
'rq' => $datRq,
|
|
'rmq' => $datRmq,
|
|
'sampai' => $sampai,
|
|
'rumus' => $rumus,
|
|
'tanggal' => $tanggal,
|
|
'title' => $title,
|
|
'all' => $all,
|
|
'status_transaksi' => $status_transaksi,
|
|
'id_rq' => $id_rq,
|
|
'id_rmq' => $id_rmq,
|
|
'gptotal' => $gptotal
|
|
];
|
|
$this->load->view('proses/LaporanGpKuartal_Keuangan_A1', $data);
|
|
}
|
|
|
|
public function excelrekap_KA1() {
|
|
$id_rq = $this->input->post('id_rq');
|
|
$id_rmq = $this->input->post('id_rmq');
|
|
$tanggal = $this->input->post('tanggal');
|
|
$status_transaksi = $this->input->post('status_transaksi');
|
|
|
|
$laporan = $this->Laporan->getData_Proyek_byRQ($id_rq);
|
|
|
|
$no = 0;
|
|
$totgp = 0;
|
|
foreach ($laporan as $key) {
|
|
//Nilai Proyek
|
|
$sumSpr = $this->Laporan->getSum_SoProyek_byPROYEK($key['ID_PROYEK']);
|
|
if ($sumSpr==FALSE) {
|
|
$sumSpr = 0;
|
|
} else {
|
|
$sumSpr = $sumSpr[0]['NILAI'];
|
|
}
|
|
|
|
$sumSprFee = $this->Laporan->getSum_SoProyek_byPROYEK_forFEE($key['ID_PROYEK']);
|
|
if ($sumSprFee==FALSE) {
|
|
$sumSprFee = 0;
|
|
} else {
|
|
$sumSprFee = $sumSprFee[0]['FEE'];
|
|
}
|
|
|
|
//Barang Proyek
|
|
$datProyek = $this->Laporan->getData_Proyek_byID($key['ID_PROYEK']);
|
|
if ($datProyek[0]['SO_ID']==NULL) {
|
|
//$sumDpr = $this->Laporan->getSum_DaftarProyek_byPROYEK($key['ID_PROYEK']);
|
|
//$barpro = $sumDpr[0]['TOTAL'];
|
|
$barpro = 0;
|
|
} else {
|
|
$barpro = 0;
|
|
}
|
|
|
|
//Barang SO
|
|
$datSpr = $this->Laporan->getData_SoProyek_byPROYEK($key['ID_PROYEK']);
|
|
$nokeydat = 0;
|
|
$datHppSo = [];
|
|
foreach ($datSpr as $keydat) {
|
|
$datDo = $this->Laporan->getData_DaftarOrder_bySO_jenisNot2($keydat['SID']);
|
|
$datIo0 = $this->Laporan->getData_TransaksiStock_bySO_jenis0($keydat['SID']);
|
|
$datIo1 = $this->Laporan->getData_TransaksiStock_bySO_jenis1($keydat['SID']);
|
|
|
|
foreach ($datDo as $dot) {
|
|
$datHppSo[$nokeydat++] = [
|
|
'BARANG_ID' => $dot['BARANG_ID'],
|
|
'QTY' => $dot['QTY_DO'],
|
|
'TGL' => $keydat['TGL_PENJUALAN'],
|
|
];
|
|
}
|
|
|
|
foreach ($datIo0 as $dot) {
|
|
$datHppSo[$nokeydat++] = [
|
|
'BARANG_ID' => $dot['BARANG_ID'],
|
|
'QTY' => $dot['QTY_IO'],
|
|
'TGL' => $keydat['TGL_PENJUALAN'],
|
|
];
|
|
}
|
|
}
|
|
|
|
$barso = 0;
|
|
foreach ($datHppSo as $dat) {
|
|
$datHq = $this->Laporan->getData_HistoriKuantiti_byBARANG_MasukLebih0_beforeTGL($dat['BARANG_ID'], $dat['TGL']);
|
|
$totkeluar = 0;
|
|
$totpersediaan = 0;
|
|
$hargaavglama = 0;
|
|
foreach ($datHq as $datkey) {
|
|
//Kuantiti Sebelumnya
|
|
$sumHq = $this->Laporan->getSum_HistoriKuantiti_byBARANG_byHQ($dat['BARANG_ID'], $datkey['ID_HQ']);
|
|
if ($totkeluar!=$sumHq[0]['KELUAR']) {
|
|
$totkeluar = $sumHq[0]['KELUAR'];
|
|
$datHqLimit = $this->Laporan->getData_HistoriKuantiti_limitHQ($dat['BARANG_ID'], $datkey['ID_HQ']);
|
|
$limit = $this->Laporan->getSum_HistoriKuantiti_byBARANG_byHQ1_byHQ2($dat['BARANG_ID'], $datkey['ID_HQ'], $datHqLimit[0]['ID_HQ']);
|
|
$keluar = $limit[0]['KELUAR'];
|
|
} else {
|
|
$keluar = 0;
|
|
$totkeluar = 0;
|
|
}
|
|
|
|
//Harga Per Item, DPP
|
|
$harga = $datkey['NILAI_HQ'] / $datkey['MASUK_HQ'];
|
|
//Nilai Total Persediaan Akhir
|
|
$nilaiPersediaanKeluar = $hargaavglama * $keluar;
|
|
$totpersediaan = $totpersediaan + ($harga * $datkey['MASUK_HQ']) - $nilaiPersediaanKeluar;
|
|
$hppakhir = $totpersediaan/$sumHq[0]['TOTAL'];
|
|
$hargaavglama = $hppakhir;
|
|
}
|
|
|
|
$hppakhir = round($hppakhir,2);
|
|
$subtot = $hppakhir * $dat['QTY'];
|
|
$barso = $barso + $subtot;
|
|
}
|
|
|
|
foreach ($datIo1 as $dot) {
|
|
$hargatotavg = $dot['QTY_IO']*$dot['HARGA_IO'];
|
|
$barso = $barso-$hargatotavg;
|
|
}
|
|
|
|
//Biaya Proyek
|
|
$sumHpr = $this->Laporan->getSum_HppProyek_byPROYEK($key['ID_PROYEK']);
|
|
|
|
//Biaya Lainnya
|
|
$sumBpry = $this->Laporan->getSum_BiayaProyek_byPROYEK($key['ID_PROYEK']);
|
|
|
|
//Sisa GP
|
|
$gp = $sumSpr-$sumSprFee-$barpro-$barso-$sumHpr[0]['TOTAL']-$sumBpry[0]['TOTAL'];
|
|
|
|
//Status Terbayar atau Belum
|
|
$maxSpr = count($datSpr);
|
|
$lunas = 0;
|
|
$retur = 0;
|
|
foreach ($datSpr as $keyspr) {
|
|
$sumPda = $this->Laporan->getSum_PiutangDagang_byPENJUALAN_TransaksiLunas($keyspr['ID_PENJUALAN'],$tanggal);
|
|
if ($sumPda[0]['TOTAL']==0 AND $sumPda[0]['TOTAL']!=NULL) {
|
|
$lunas++;
|
|
}
|
|
|
|
$datPda = $this->Laporan->getData_PiutangDagang_byPENJUALAN_status2($keyspr['ID_PENJUALAN'],$tanggal);
|
|
if ($datPda==TRUE) {
|
|
$retur++;
|
|
}
|
|
}
|
|
|
|
//Cek data Lunas atau Tidak
|
|
if ($lunas==$maxSpr AND $retur==0 AND $lunas>0) {
|
|
$lunasall = 1;
|
|
$laporan[$no] += ['STATUS' => "Lunas"];
|
|
} else {
|
|
$lunasall = 0;
|
|
$laporan[$no] += ['STATUS' => "Belum"];
|
|
}
|
|
|
|
//Set Data ditampilkan atau tidak
|
|
if ($status_transaksi==1) {
|
|
$laporan[$no] += ['SHOW' => 1];
|
|
} else if ($status_transaksi==2) {
|
|
if ($lunasall==1) {
|
|
$laporan[$no] += ['SHOW' => 1];
|
|
} else if ($lunasall==0) {
|
|
$laporan[$no] += ['SHOW' => 0];
|
|
}
|
|
} else if ($status_transaksi==3) {
|
|
if ($lunasall==0) {
|
|
$laporan[$no] += ['SHOW' => 1];
|
|
} else if ($lunasall==1) {
|
|
$laporan[$no] += ['SHOW' => 0];
|
|
}
|
|
}
|
|
|
|
//Isi Tambahan
|
|
$laporan[$no] += ['TOTALGP' => $gp];
|
|
$laporan[$no++] += ['TOTALGPAKHIR' => number_format($gp,2)];
|
|
|
|
//Tambah Total GP
|
|
$totgp = $totgp + $gp;
|
|
}
|
|
|
|
$no = 0;
|
|
$rate = 0;
|
|
$subkom = 0;
|
|
foreach ($laporan as $key) {
|
|
//Set Angka untuk Rate Komisi berdasarkan Rumus yang dipilih
|
|
$datDrmq = $this->Laporan->getData_DaftarRumusKuartal_byRMQ($id_rmq);
|
|
foreach ($datDrmq as $keydrmq) {
|
|
if ($totgp>=$keydrmq['BAWAH_DRMQ'] AND $totgp<=$keydrmq['ATAS_DRMQ']) {
|
|
$rate = $keydrmq['RATE_DRMQ'];
|
|
break;
|
|
}
|
|
}
|
|
|
|
$komisiakhir = $rate*$key['TOTALGP'];
|
|
$rateakhir = $rate*100;
|
|
|
|
if ($key['STATUS']=="Lunas") {
|
|
$laporan[$no] += ['RATEAKHIR' => "$rateakhir%"];
|
|
$laporan[$no++] += ['TOTALKOMISIAKHIR' => number_format($komisiakhir,2)];
|
|
} else if ($key['STATUS']=="Belum") {
|
|
$laporan[$no] += ['RATEAKHIR' => NULL];
|
|
$laporan[$no++] += ['TOTALKOMISIAKHIR' => NULL];
|
|
}
|
|
|
|
if ($key['SHOW']==1 AND $key['STATUS']=="Lunas") {
|
|
$subkom = $subkom+$komisiakhir;
|
|
}
|
|
}
|
|
|
|
if ($totgp==0) {
|
|
$gptotal = "0.00";
|
|
} else {
|
|
$gptotal = number_format($totgp,2);
|
|
}
|
|
|
|
$dataRq = $this->Laporan->getData_RekapKuartal_status2($id_rq);
|
|
$dataRmq = $this->Laporan->getData_RumusKuartal_byID($id_rmq);
|
|
$nama_kuartal = $dataRq[0]['NAMA_KUARTAL'];
|
|
$nama_sales = $dataRq[0]['NAMA_PANGGILAN_KARYAWAN'];
|
|
$judul = "$nama_kuartal ($nama_sales)";
|
|
$nama_rumus = $dataRmq[0]['NAMA_RMQ'];
|
|
$rumus = "$nama_rumus";
|
|
$sampai = date_format(date_create($tanggal), "d/m/Y");
|
|
|
|
if ($status_transaksi==1) {
|
|
$filter = "CAMPUR";
|
|
} else if ($status_transaksi==2) {
|
|
$filter = "LUNAS";
|
|
} else if ($status_transaksi==3) {
|
|
$filter = "BELUM";
|
|
}
|
|
|
|
$data = [
|
|
'title' => '',
|
|
'laporan' => $laporan,
|
|
'judul' => $judul,
|
|
'sampai' => $sampai,
|
|
'rumus' => $rumus,
|
|
'filter' => $filter,
|
|
'gptotal' => $gptotal,
|
|
'totsubkom' => number_format($subkom,2),
|
|
];
|
|
$this->load->view('cetak/excel_rekapkuartalkeuangan', $data);
|
|
}
|
|
|
|
public function dataTransaksiPelanggan_Keuangan_A1() {
|
|
$kondisi = $this->input->post('kondisi');
|
|
$datCorp = $this->Laporan->getData_Corp();
|
|
$datPelanggan = $this->Laporan->getData_Pelanggan();
|
|
|
|
if ($kondisi==null){
|
|
$id_corp = NULL;
|
|
$id_pelanggan = NULL;
|
|
$laporan = NULL;
|
|
$all = 0;
|
|
$total_transaksi = 0;
|
|
$tanggal_awal = date('Y-m-d');
|
|
$tanggal_akhir = date('Y-m-d');
|
|
$awal = date('d/m/Y');
|
|
$akhir = date('d/m/Y');
|
|
$title = "Belum Terpilih*";
|
|
} else {
|
|
$all = 1;
|
|
$id_corp = $this->input->post('id_corp');
|
|
$id_pelanggan = $this->input->post('id_pelanggan');
|
|
$tanggal_awal = $this->input->post('tanggal_awal');
|
|
$tanggal_akhir = $this->input->post('tanggal_akhir');
|
|
$awal = date_format(date_create($tanggal_awal), "d/m/Y");
|
|
$akhir = date_format(date_create($tanggal_akhir), "d/m/Y");
|
|
if ($id_pelanggan!="") {
|
|
$dataPelanggan = $this->Laporan->getData_Pelanggan($id_pelanggan);
|
|
$nama_pelanggan = $dataPelanggan[0]['NAMA_PELANGGAN'];
|
|
$nama_kota = $dataPelanggan[0]['NAMA_KOTA'];
|
|
$title = "$nama_pelanggan ($nama_kota)";
|
|
} else {
|
|
$title = "Semua Pelanggan";
|
|
}
|
|
|
|
$sumTotal = $this->Laporan->getSum_Laporan_TransaksiPelanggan($tanggal_awal, $tanggal_akhir, $id_pelanggan, $id_corp);
|
|
$total_transaksi = number_format(round($sumTotal[0]['TOTAL']),2);
|
|
|
|
$laporan = $this->Laporan->getData_TransaksiPelanggan($tanggal_awal, $tanggal_akhir, $id_pelanggan, $id_corp);
|
|
|
|
$no = 0;
|
|
foreach ($laporan as $key) {
|
|
$datDo = $this->Laporan->getData_DaftarOrder_bySO_allStatus($key['SO_ID']);
|
|
$laporan[$no++] += ['BARANG' => $datDo];
|
|
}
|
|
}
|
|
|
|
$data = [
|
|
'sidebar' => "menu laporan",
|
|
'navChild' => "laporan transaksi pelanggan",
|
|
'laporan' => $laporan,
|
|
'id_corp' => $id_corp,
|
|
'id_pelanggan' => $id_pelanggan,
|
|
'corp' => $datCorp,
|
|
'pelanggan' => $datPelanggan,
|
|
'awal' => $awal,
|
|
'akhir' => $akhir,
|
|
'tanggal_awal' => $tanggal_awal,
|
|
'tanggal_akhir' => $tanggal_akhir,
|
|
'title' => $title,
|
|
'all' => $all,
|
|
'total_transaksi' => $total_transaksi
|
|
];
|
|
$this->load->view('proses/LaporanTransaksiPelanggan_Keuangan_A1', $data);
|
|
}
|
|
|
|
public function simpan_excel_transaksipelanggan() {
|
|
$start = $this->input->post('start');
|
|
$end = $this->input->post('end');
|
|
$id_corp = $this->input->post('id_corp');
|
|
$id_pelanggan = $this->input->post('id_pelanggan');
|
|
|
|
$datPelanggan = $this->Laporan->getData_Pelanggan($id_pelanggan);
|
|
$title = $datPelanggan[0]['NAMA_PELANGGAN'];
|
|
|
|
$dataLaporan = $this->Laporan->getExcel_TransaksiPelanggan($start, $end, $id_pelanggan, $id_corp);
|
|
|
|
$sumTotal = $this->Laporan->getSum_Laporan_TransaksiPelanggan($start, $end, $id_pelanggan, $id_corp);
|
|
$total_transaksi = number_format(round($sumTotal[0]['TOTAL']),2);
|
|
|
|
$data = [
|
|
'title' => $title,
|
|
'tanggal_awal' => date_format(date_create($start), "d/m/Y"),
|
|
'tanggal_akhir' => date_format(date_create($end), "d/m/Y"),
|
|
'laporan' => $dataLaporan,
|
|
'total_transaksi' => $total_transaksi,
|
|
];
|
|
$this->load->view('cetak/excel_transaksipelanggan', $data);
|
|
|
|
}
|
|
|
|
//MENU KELUAR MASUK KEUANGAN
|
|
public function dataKeluarMasuk_Keuangan_A1() {
|
|
$kondisi = $this->input->post('kondisi');
|
|
$id_barang = $this->input->post('id_barang');
|
|
$jenis_io = $this->input->post('jenis_io');
|
|
$tgl = date('Y-m-d');
|
|
$datBarang = $this->Laporan->getData_Barang_forKeluarMasuk();
|
|
|
|
if ($kondisi==null){
|
|
$id_barang = NULL;
|
|
$jenis_io = NULL;
|
|
$all = 0 ;
|
|
$tanggal_awal = date('Y-m-d');
|
|
$tanggal_akhir = date('Y-m-d');
|
|
$awal = date('d/m/Y');
|
|
$akhir = date('d/m/Y');
|
|
$title = "Belum Terpilih*";
|
|
} else if ($kondisi!=null AND $id_barang=="") {
|
|
$id_barang = NULL;
|
|
$tanggal_awal = $this->input->post('tanggal_awal');
|
|
$tanggal_akhir = $this->input->post('tanggal_akhir');
|
|
$awal = date_format(date_create($tanggal_awal), "d/m/Y");
|
|
$akhir = date_format(date_create($tanggal_akhir), "d/m/Y");
|
|
$title = "Semua Barang";
|
|
$all = 1;
|
|
} else {
|
|
$all = 2;
|
|
$tanggal_awal = $this->input->post('tanggal_awal');
|
|
$tanggal_akhir = $this->input->post('tanggal_akhir');
|
|
$awal = date_format(date_create($tanggal_awal), "d/m/Y");
|
|
$akhir = date_format(date_create($tanggal_akhir), "d/m/Y");
|
|
$dataBarang = $this->Laporan->getData_Barang_forKeluarMasuk($id_barang);
|
|
$kode_barang = $dataBarang[0]['KODE_BARANG'];
|
|
$title = "$kode_barang";
|
|
}
|
|
$laporan = $this->Laporan->getData_KeluarMasuk_forKeuangan($tanggal_awal, $tanggal_akhir, $all, $id_barang, $jenis_io);
|
|
$data = [
|
|
'sidebar' => "menu laporan",
|
|
'navChild' => "laporan keluarmasuk",
|
|
'laporan' => $laporan,
|
|
'tgl' => $tgl,
|
|
'barang' => $datBarang,
|
|
'awal' => $awal,
|
|
'akhir' => $akhir,
|
|
'tanggal_awal' => $tanggal_awal,
|
|
'tanggal_akhir' => $tanggal_akhir,
|
|
'title' => $title,
|
|
'all' => $all,
|
|
'id_barang' => $id_barang,
|
|
'jenis_io' => $jenis_io,
|
|
];
|
|
$this->load->view('proses/LaporanKeluarMasuk_Keuangan_A1', $data);
|
|
}
|
|
|
|
public function simpan_excel_keluarmasuk() {
|
|
$laporan = $this->input->post('laporan');
|
|
$id_barang = $this->input->post('id_barang');
|
|
$all = $this->input->post('all');
|
|
$tanggal_awal = $this->input->post('tanggal_awal');
|
|
$tanggal_akhir = $this->input->post('tanggal_akhir');
|
|
|
|
|
|
if ($all==2) {
|
|
$pilih_tabel = array('No', 'Tanggal', 'Transaksi', 'Kode Bukti', 'Gudang' , 'Kuantiti' , 'HPP', 'Keterangan');
|
|
} else if ($all==1) {
|
|
$pilih_tabel = array('No', 'Tanggal', 'Transaksi', 'Kode Bukti', 'Gudang' , 'Barang' , 'Kuantiti' , 'HPP', 'Keterangan');
|
|
}
|
|
|
|
if ($all==2) {
|
|
$datBarang = $this->Laporan->getData_Barang_forKeluarMasuk($id_barang);
|
|
$kode_barang = $datBarang[0]['KODE_BARANG'];
|
|
$judul = "$kode_barang";
|
|
} else {
|
|
$judul = "Semua Barang";
|
|
}
|
|
|
|
$laporan = $this->Laporan->getData_KeluarMasuk_forKeuangan($tanggal_awal, $tanggal_akhir, $all, $id_barang);
|
|
$data = [
|
|
'title' => '',
|
|
'start' => date_format(date_create($tanggal_awal), "d/m/Y"),
|
|
'end' => date_format(date_create($tanggal_akhir), "d/m/Y"),
|
|
'jumlah_kolom' => count($pilih_tabel),
|
|
'nama_tabel' => $pilih_tabel,
|
|
'laporan' => $laporan,
|
|
'judul' => $judul
|
|
];
|
|
if ($all==2) {
|
|
$this->load->view('cetak/excel_keluarmasuk_single', $data);
|
|
} else if ($all==1) {
|
|
$this->load->view('cetak/excel_keluarmasuk_all', $data);
|
|
}
|
|
}
|
|
|
|
//////////////////////////////////
|
|
public function dataDpPembelian_Keuangan_A1() {
|
|
$kondisi = $this->input->post('kondisi');
|
|
$id_supplier = $this->input->post('id_supplier');
|
|
$tgl = date('Y-m-d');
|
|
$datSupplier = $this->Laporan->getData_Supplier();
|
|
|
|
if ($kondisi==null){
|
|
$id_supplier = NULL;
|
|
$all = 0 ;
|
|
$tanggal_awal = date('Y-m-d');
|
|
$tanggal_akhir = date('Y-m-d');
|
|
$awal = date('d/m/Y');
|
|
$akhir = date('d/m/Y');
|
|
$title = "Belum Terpilih*";
|
|
$saldo_awal = 0;
|
|
$tgl_awal = NULL;
|
|
} else if ($kondisi!=null AND $id_supplier=="") {
|
|
$id_supplier = NULL;
|
|
$tanggal_awal = $this->input->post('tanggal_awal');
|
|
$tanggal_akhir = $this->input->post('tanggal_akhir');
|
|
$awal = date_format(date_create($tanggal_awal), "d/m/Y");
|
|
$akhir = date_format(date_create($tanggal_akhir), "d/m/Y");
|
|
$title = "Semua Supplier";
|
|
$all = 1;
|
|
$saldo_awal = 0;
|
|
$tgl_awal = NULL;
|
|
} else {
|
|
$all = 2;
|
|
$tanggal_awal = $this->input->post('tanggal_awal');
|
|
$tanggal_akhir = $this->input->post('tanggal_akhir');
|
|
$awal = date_format(date_create($tanggal_awal), "d/m/Y");
|
|
$akhir = date_format(date_create($tanggal_akhir), "d/m/Y");
|
|
$datSupplier = $this->Laporan->getData_Supplier($id_supplier);
|
|
$nama_supplier = $datSupplier[0]['NAMA_SUPPLIER'];
|
|
$nama_kota = $datSupplier[0]['NAMA_KOTA'];
|
|
$title = "$nama_supplier ($nama_kota)";
|
|
$saldo_awal = $this->Laporan->getSaldo_DpPembelian($tanggal_awal,$id_supplier);
|
|
$tgl_awal = $this->Laporan->getTanggal_DpPembelian($tanggal_awal,$id_supplier);
|
|
if ($saldo_awal[0]['SALDO']==NULL) {
|
|
$saldo_awal = 0;
|
|
} else {
|
|
$saldo_awal = $saldo_awal[0]['SALDO'];
|
|
}
|
|
if ($tgl_awal==FALSE) {
|
|
$tgl_awal = $awal;
|
|
} else {
|
|
$tgl_awal = $tgl_awal[0]['TANGGAL'];
|
|
}
|
|
}
|
|
$laporan = $this->Laporan->getData_DpPembelian($tanggal_awal, $tanggal_akhir, $id_supplier, $all);
|
|
$data = [
|
|
'sidebar' => "menu laporan",
|
|
'navChild' => "laporan dppembelian",
|
|
'laporan' => $laporan,
|
|
'tgl' => $tgl,
|
|
'supplier' => $datSupplier,
|
|
'id_supplier' => $id_supplier,
|
|
'awal' => $awal,
|
|
'akhir' => $akhir,
|
|
'tanggal_awal' => $tanggal_awal,
|
|
'saldo_awal' => $saldo_awal,
|
|
'tgl_awal' => $tgl_awal,
|
|
'tanggal_akhir' => $tanggal_akhir,
|
|
'title' => $title,
|
|
'all' => $all
|
|
];
|
|
$this->load->view('proses/LaporanDpPembelian_Keuangan_A1', $data);
|
|
}
|
|
|
|
public function simpan_excel_dppembelian() {
|
|
$start = $this->input->post('start');
|
|
$end = $this->input->post('end');
|
|
$pilih_tabel = array('No', 'SUPPLIER', 'DEBET', 'KREDIT', 'SALDO');
|
|
$dataLaporan = $this->Laporan->getExcel_DpPembelian_All($start, $end);
|
|
$data =
|
|
[
|
|
'title' => '',
|
|
'tanggal_awal' => date_format(date_create($start), "d/m/Y"),
|
|
'tanggal_akhir' => date_format(date_create($end), "d/m/Y"),
|
|
'jumlah_kolom' => count($pilih_tabel),
|
|
'nama_tabel' => $pilih_tabel,
|
|
'laporan' => $dataLaporan,
|
|
|
|
];
|
|
$this->load->view('cetak/excel_dppembelian_all', $data);
|
|
}
|
|
|
|
public function simpan_excel_dppembelian_sup() {
|
|
$start = $this->input->post('start_sup');
|
|
$end = $this->input->post('end_sup');
|
|
$id_supplier = $this->input->post('id_supplier');
|
|
$pilih_tabel = array('No', 'TANGGAL', 'KODE BUKTI', 'TRANSAKSI', 'DEBET', 'KREDIT', 'SALDO', 'Keterangan');
|
|
$laporan = $this->Laporan->getExcel_DpPembelian_All($start, $end, $id_supplier);
|
|
$saldo_awal = $this->Laporan->getSaldo_DpPembelian($start,$id_supplier);
|
|
$tgl_awal = $this->Laporan->getTanggal_DpPembelian($start,$id_supplier);
|
|
$datSupplier = $this->Laporan->getData_Supplier($id_supplier);
|
|
if ($saldo_awal[0]['SALDO']==NULL) {
|
|
$saldo_awal = 0;
|
|
} else {
|
|
$saldo_awal = $saldo_awal[0]['SALDO'];
|
|
}
|
|
if ($tgl_awal==FALSE) {
|
|
$tgl_awal = date_format(date_create($start), "d/m/Y");
|
|
} else {
|
|
$tgl_awal = $tgl_awal[0]['TANGGAL'];
|
|
}
|
|
$data =
|
|
[
|
|
'title' => '',
|
|
'tanggal_awal' => date_format(date_create($start), "d/m/Y"),
|
|
'tanggal_akhir' => date_format(date_create($end), "d/m/Y"),
|
|
'jumlah_kolom' => count($pilih_tabel),
|
|
'nama_tabel' => $pilih_tabel,
|
|
'saldo_awal' => $saldo_awal,
|
|
'tglawal' => $tgl_awal,
|
|
'nama_supplier' => $datSupplier[0]['NAMA_SUPPLIER'],
|
|
'laporan' => $laporan,
|
|
|
|
];
|
|
$this->load->view('cetak/excel_dppembelian_single', $data);
|
|
}
|
|
|
|
public function dataDpPenjualan_Keuangan_A1() {
|
|
$kondisi = $this->input->post('kondisi');
|
|
$id_pelanggan = $this->input->post('id_pelanggan');
|
|
$tgl = date('Y-m-d');
|
|
$datPelanggan = $this->Laporan->getData_Pelanggan();
|
|
|
|
if ($kondisi==null){
|
|
$id_pelanggan = NULL;
|
|
$all = 0 ;
|
|
$tanggal_awal = date('Y-m-d');
|
|
$tanggal_akhir = date('Y-m-d');
|
|
$awal = date('d/m/Y');
|
|
$akhir = date('d/m/Y');
|
|
$title = "Belum Terpilih*";
|
|
$saldo_awal = 0;
|
|
$tgl_awal = NULL;
|
|
} else if ($kondisi!=null AND $id_pelanggan=="") {
|
|
$id_pelanggan = NULL;
|
|
$tanggal_awal = $this->input->post('tanggal_awal');
|
|
$tanggal_akhir = $this->input->post('tanggal_akhir');
|
|
$awal = date_format(date_create($tanggal_awal), "d/m/Y");
|
|
$akhir = date_format(date_create($tanggal_akhir), "d/m/Y");
|
|
$title = "Semua Pelanggan";
|
|
$all = 1;
|
|
$saldo_awal = 0;
|
|
$tgl_awal = NULL;
|
|
} else {
|
|
$all = 2;
|
|
$tanggal_awal = $this->input->post('tanggal_awal');
|
|
$tanggal_akhir = $this->input->post('tanggal_akhir');
|
|
$awal = date_format(date_create($tanggal_awal), "d/m/Y");
|
|
$akhir = date_format(date_create($tanggal_akhir), "d/m/Y");
|
|
$datPelanggan = $this->Laporan->getData_Pelanggan($id_pelanggan);
|
|
$nama_pelanggan = $datPelanggan[0]['NAMA_PELANGGAN'];
|
|
$nama_kota = $datPelanggan[0]['NAMA_KOTA'];
|
|
$title = "$nama_pelanggan ($nama_kota)";
|
|
$saldo_awal = $this->Laporan->getSaldo_DpPenjualan($tanggal_awal,$id_pelanggan);
|
|
$tgl_awal = $this->Laporan->getTanggal_DpPenjualan($tanggal_awal,$id_pelanggan);
|
|
if ($saldo_awal[0]['SALDO']==NULL) {
|
|
$saldo_awal = 0;
|
|
} else {
|
|
$saldo_awal = $saldo_awal[0]['SALDO'];
|
|
}
|
|
if ($tgl_awal==FALSE) {
|
|
$tgl_awal = $awal;
|
|
} else {
|
|
$tgl_awal = $tgl_awal[0]['TANGGAL'];
|
|
}
|
|
}
|
|
$laporan = $this->Laporan->getData_DpPenjualan($tanggal_awal, $tanggal_akhir, $id_pelanggan, $all);
|
|
$data = [
|
|
'sidebar' => "menu laporan",
|
|
'navChild' => "laporan dppenjualan",
|
|
'laporan' => $laporan,
|
|
'tgl' => $tgl,
|
|
'pelanggan' => $datPelanggan,
|
|
'id_pelanggan' => $id_pelanggan,
|
|
'awal' => $awal,
|
|
'akhir' => $akhir,
|
|
'tanggal_awal' => $tanggal_awal,
|
|
'tanggal_akhir' => $tanggal_akhir,
|
|
'saldo_awal' => $saldo_awal,
|
|
'tgl_awal' => $tgl_awal,
|
|
'title' => $title,
|
|
'all' => $all
|
|
];
|
|
$this->load->view('proses/LaporanDpPenjualan_Keuangan_A1', $data);
|
|
}
|
|
|
|
public function simpan_excel_dppenjualan() {
|
|
$start = $this->input->post('start');
|
|
$end = $this->input->post('end');
|
|
$pilih_tabel = array('No', 'PELANGGAN', 'DEBET', 'KREDIT', 'SALDO');
|
|
$dataLaporan = $this->Laporan->getExcel_DpPenjualan_All($start, $end);
|
|
$data =
|
|
[
|
|
'title' => '',
|
|
'tanggal_awal' => date_format(date_create($start), "d/m/Y"),
|
|
'tanggal_akhir' => date_format(date_create($end), "d/m/Y"),
|
|
'jumlah_kolom' => count($pilih_tabel),
|
|
'nama_tabel' => $pilih_tabel,
|
|
'laporan' => $dataLaporan,
|
|
|
|
];
|
|
$this->load->view('cetak/excel_dppenjualan_all', $data);
|
|
}
|
|
|
|
public function simpan_excel_dppenjualan_pel() {
|
|
$start = $this->input->post('start_pel');
|
|
$end = $this->input->post('end_pel');
|
|
$id_pelanggan = $this->input->post('id_pelanggan');
|
|
$pilih_tabel = array('No', 'TANGGAL', 'KODE BUKTI', 'TRANSAKSI', 'DEBET', 'KREDIT', 'SALDO', 'Keterangan');
|
|
$laporan = $this->Laporan->getExcel_DpPenjualan_All($start, $end, $id_pelanggan);
|
|
$saldo_awal = $this->Laporan->getSaldo_DpPenjualan($start,$id_pelanggan);
|
|
$tgl_awal = $this->Laporan->getTanggal_DpPenjualan($start,$id_pelanggan);
|
|
$datPelanggan = $this->Laporan->getData_Pelanggan($id_pelanggan);
|
|
if ($saldo_awal[0]['SALDO']==NULL) {
|
|
$saldo_awal = 0;
|
|
} else {
|
|
$saldo_awal = $saldo_awal[0]['SALDO'];
|
|
}
|
|
if ($tgl_awal==FALSE) {
|
|
$tgl_awal = date_format(date_create($start), "d/m/Y");
|
|
} else {
|
|
$tgl_awal = $tgl_awal[0]['TANGGAL'];
|
|
}
|
|
$data =
|
|
[
|
|
'title' => '',
|
|
'tanggal_awal' => date_format(date_create($start), "d/m/Y"),
|
|
'tanggal_akhir' => date_format(date_create($end), "d/m/Y"),
|
|
'jumlah_kolom' => count($pilih_tabel),
|
|
'nama_tabel' => $pilih_tabel,
|
|
'saldo_awal' => $saldo_awal,
|
|
'tglawal' => $tgl_awal,
|
|
'nama_pelanggan' => $datPelanggan[0]['NAMA_PELANGGAN'],
|
|
'laporan' => $laporan,
|
|
|
|
];
|
|
$this->load->view('cetak/excel_dppenjualan_single', $data);
|
|
}
|
|
|
|
public function dataHutangDagang_Keuangan_A1() {
|
|
$kondisi = $this->input->post('kondisi');
|
|
$id_supplier = $this->input->post('id_supplier');
|
|
$tgl = date('Y-m-d');
|
|
$datSupplier = $this->Laporan->getData_Supplier();
|
|
|
|
if ($kondisi==null){
|
|
$id_supplier = NULL;
|
|
$all = 0 ;
|
|
$tanggal_awal = date('Y-m-d');
|
|
$tanggal_akhir = date('Y-m-d');
|
|
$awal = date('d/m/Y');
|
|
$akhir = date('d/m/Y');
|
|
$title = "Belum Terpilih*";
|
|
$saldo_awal = 0;
|
|
$tgl_awal = NULL;
|
|
} else if ($kondisi!=null AND $id_supplier=="") {
|
|
$id_supplier = NULL;
|
|
$tanggal_awal = $this->input->post('tanggal_awal');
|
|
$tanggal_akhir = $this->input->post('tanggal_akhir');
|
|
$awal = date_format(date_create($tanggal_awal), "d/m/Y");
|
|
$akhir = date_format(date_create($tanggal_akhir), "d/m/Y");
|
|
$title = "Semua Supplier";
|
|
$all = 1;
|
|
$saldo_awal = 0;
|
|
$tgl_awal = NULL;
|
|
} else {
|
|
$all = 2;
|
|
$tanggal_awal = $this->input->post('tanggal_awal');
|
|
$tanggal_akhir = $this->input->post('tanggal_akhir');
|
|
$awal = date_format(date_create($tanggal_awal), "d/m/Y");
|
|
$akhir = date_format(date_create($tanggal_akhir), "d/m/Y");
|
|
$datSupplier = $this->Laporan->getData_Supplier($id_supplier);
|
|
$nama_supplier = $datSupplier[0]['NAMA_SUPPLIER'];
|
|
$nama_kota = $datSupplier[0]['NAMA_KOTA'];
|
|
$title = "$nama_supplier ($nama_kota)";
|
|
$saldo_awal = $this->Laporan->getSaldo_HutangDagang($tanggal_awal,$id_supplier);
|
|
$tgl_awal = $this->Laporan->getTanggal_HutangDagang($tanggal_awal,$id_supplier);
|
|
if ($saldo_awal[0]['SALDO']==NULL) {
|
|
$saldo_awal = 0;
|
|
} else {
|
|
$saldo_awal = $saldo_awal[0]['SALDO'];
|
|
}
|
|
if ($tgl_awal==FALSE) {
|
|
$tgl_awal = $awal;
|
|
} else {
|
|
$tgl_awal = $tgl_awal[0]['TANGGAL'];
|
|
}
|
|
}
|
|
$laporan = $this->Laporan->getData_HutangDagang($tanggal_awal, $tanggal_akhir, $id_supplier, $all);
|
|
$data = [
|
|
'sidebar' => "menu laporan",
|
|
'navChild' => "laporan hutangdagang",
|
|
'laporan' => $laporan,
|
|
'tgl' => $tgl,
|
|
'supplier' => $datSupplier,
|
|
'id_supplier' => $id_supplier,
|
|
'awal' => $awal,
|
|
'akhir' => $akhir,
|
|
'tanggal_awal' => $tanggal_awal,
|
|
'saldo_awal' => $saldo_awal,
|
|
'tanggal_akhir' => $tanggal_akhir,
|
|
'tgl_awal' => $tgl_awal,
|
|
'title' => $title,
|
|
'all' => $all
|
|
];
|
|
$this->load->view('proses/LaporanHutangDagang_Keuangan_A1', $data);
|
|
}
|
|
|
|
public function simpan_excel_hutangdagang() {
|
|
$start = $this->input->post('start');
|
|
$end = $this->input->post('end');
|
|
$pilih_tabel = array('No', 'SUPPLIER', 'DEBET', 'KREDIT', 'SALDO');
|
|
$dataLaporan = $this->Laporan->getExcel_HutangDagang_All($start, $end);
|
|
$data =
|
|
[
|
|
'title' => '',
|
|
'tanggal_awal' => date_format(date_create($start), "d/m/Y"),
|
|
'tanggal_akhir' => date_format(date_create($end), "d/m/Y"),
|
|
'jumlah_kolom' => count($pilih_tabel),
|
|
'nama_tabel' => $pilih_tabel,
|
|
'laporan' => $dataLaporan,
|
|
|
|
];
|
|
$this->load->view('cetak/excel_hutangdagang_all', $data);
|
|
}
|
|
|
|
public function simpan_excel_hutangdagang_sup() {
|
|
$start = $this->input->post('start_sup');
|
|
$end = $this->input->post('end_sup');
|
|
$id_supplier = $this->input->post('id_supplier');
|
|
$pilih_tabel = array('No', 'TANGGAL', 'KODE BUKTI', 'TRANSAKSI', 'DEBET', 'KREDIT', 'SALDO', 'Keterangan');
|
|
$laporan = $this->Laporan->getExcel_HutangDagang_All($start, $end, $id_supplier);
|
|
$saldo_awal = $this->Laporan->getSaldo_HutangDagang($start,$id_supplier);
|
|
$tgl_awal = $this->Laporan->getTanggal_HutangDagang($start,$id_supplier);
|
|
$datSupplier = $this->Laporan->getData_Supplier($id_supplier);
|
|
if ($saldo_awal[0]['SALDO']==NULL) {
|
|
$saldo_awal = 0;
|
|
} else {
|
|
$saldo_awal = $saldo_awal[0]['SALDO'];
|
|
}
|
|
if ($tgl_awal==FALSE) {
|
|
$tgl_awal = date_format(date_create($start), "d/m/Y");
|
|
} else {
|
|
$tgl_awal = $tgl_awal[0]['TANGGAL'];
|
|
}
|
|
$data =
|
|
[
|
|
'title' => '',
|
|
'tanggal_awal' => date_format(date_create($start), "d/m/Y"),
|
|
'tanggal_akhir' => date_format(date_create($end), "d/m/Y"),
|
|
'jumlah_kolom' => count($pilih_tabel),
|
|
'nama_tabel' => $pilih_tabel,
|
|
'saldo_awal' => $saldo_awal,
|
|
'tglawal' => $tgl_awal,
|
|
'laporan' => $laporan,
|
|
'nama_supplier' => $datSupplier[0]['NAMA_SUPPLIER'],
|
|
|
|
];
|
|
$this->load->view('cetak/excel_hutangdagang_single', $data);
|
|
}
|
|
|
|
public function dataPerkiraan_Keuangan_A1() {
|
|
$kondisi = $this->input->post('kondisi');
|
|
$id_perkiraan = $this->input->post('id_perkiraan');
|
|
$datPerkiraan = $this->Laporan->getData_Perkiraan_Not3();
|
|
|
|
if ($kondisi==null){
|
|
$id_perkiraan = NULL;
|
|
$all = 0;
|
|
$debet_total = 0;
|
|
$kredit_total = 0;
|
|
$saldo_total = 0;
|
|
$tanggal_awal = date('Y-m-d');
|
|
$tanggal_akhir = date('Y-m-d');
|
|
$awal = date('d/m/Y');
|
|
$akhir = date('d/m/Y');
|
|
$title = "Belum Terpilih*";
|
|
} else if ($kondisi!=null AND $id_perkiraan=="") {
|
|
$id_perkiraan = NULL;
|
|
$all = 1;
|
|
$debet_total = 0;
|
|
$kredit_total = 0;
|
|
$saldo_total = 0;
|
|
$tanggal_awal = $this->input->post('tanggal_awal');
|
|
$tanggal_akhir = $this->input->post('tanggal_akhir');
|
|
$awal = date_format(date_create($tanggal_awal), "d/m/Y");
|
|
$akhir = date_format(date_create($tanggal_akhir), "d/m/Y");
|
|
$title = "Semua Perkiraan";
|
|
} else {
|
|
$all = 2;
|
|
$tanggal_awal = $this->input->post('tanggal_awal');
|
|
$tanggal_akhir = $this->input->post('tanggal_akhir');
|
|
$awal = date_format(date_create($tanggal_awal), "d/m/Y");
|
|
$akhir = date_format(date_create($tanggal_akhir), "d/m/Y");
|
|
$dataPerkiraan = $this->Laporan->getData_Perkiraan_Not3($id_perkiraan);
|
|
$nama_perkiraan = $dataPerkiraan[0]['NAMA_PERKIRAAN'];
|
|
$kode_perkiraan = $dataPerkiraan[0]['KODE_PERKIRAAN'];
|
|
$title = "$kode_perkiraan | $nama_perkiraan";
|
|
|
|
if ($id_perkiraan==3) {
|
|
$totalPda = $this->Laporan->getSum_PiutangDagang($tanggal_awal, $tanggal_akhir);
|
|
$debet_total = $totalPda[0]['DEBET'];
|
|
$kredit_total = $totalPda[0]['KREDIT'];
|
|
$saldo_total = $totalPda[0]['SALDO'];
|
|
} else if ($id_perkiraan==15) {
|
|
$totalHda = $this->Laporan->getSum_HutangDagang($tanggal_awal, $tanggal_akhir);
|
|
$debet_total = $totalHda[0]['DEBET'];
|
|
$kredit_total = $totalHda[0]['KREDIT'];
|
|
$saldo_total = $totalHda[0]['SALDO'];
|
|
} else {
|
|
$totalDkb = $this->Laporan->getSum_DaftarKasbank($tanggal_awal, $tanggal_akhir, $id_perkiraan);
|
|
if ($totalDkb[0]['DEBET']==NULL) { $debetDkb = 0; } else { $debetDkb = $totalDkb[0]['DEBET']; }
|
|
if ($totalDkb[0]['KREDIT']==NULL) { $kreditDkb = 0; } else { $kreditDkb = $totalDkb[0]['KREDIT']; }
|
|
if ($totalDkb[0]['SALDO']==NULL) { $saldoDkb = 0; } else { $saldoDkb = $totalDkb[0]['SALDO']; }
|
|
|
|
$totalDjm = $this->Laporan->getSum_DaftarJurnalMemo($tanggal_awal, $tanggal_akhir, $id_perkiraan);
|
|
if ($totalDjm[0]['DEBET']==NULL) { $debetDjm = 0; } else { $debetDjm = $totalDjm[0]['DEBET']; }
|
|
if ($totalDjm[0]['KREDIT']==NULL) { $kreditDjm = 0; } else { $kreditDjm = $totalDjm[0]['KREDIT']; }
|
|
if ($totalDjm[0]['SALDO']==NULL) { $saldoDjm = 0; } else { $saldoDjm = $totalDjm[0]['SALDO']; }
|
|
|
|
$debet_total = $debetDkb+$debetDjm;
|
|
$kredit_total = $kreditDkb+$kreditDjm;
|
|
$saldo_total = $saldoDkb+$saldoDjm;
|
|
}
|
|
|
|
}
|
|
|
|
if ($id_perkiraan==3) {
|
|
$laporan = $this->Laporan->getData_PiutangDagang_Perkiraan($tanggal_awal, $tanggal_akhir);
|
|
} else if ($id_perkiraan==15) {
|
|
$laporan = $this->Laporan->getData_HutangDagang_Perkiraan($tanggal_awal, $tanggal_akhir);
|
|
} else {
|
|
$laporan = $this->Laporan->getData_DaftarKasbank($tanggal_awal, $tanggal_akhir, $all, $id_perkiraan);
|
|
$datDjm = $this->Laporan->getData_DaftarJurnalMemo($tanggal_awal, $tanggal_akhir, $all, $id_perkiraan);
|
|
|
|
foreach ($datDjm as $key) {
|
|
$laporan[count($laporan)] = $key;
|
|
}
|
|
asort($laporan);
|
|
}
|
|
|
|
$data = [
|
|
'sidebar' => "menu laporan",
|
|
'navChild' => "laporan perkiraan",
|
|
'laporan' => $laporan,
|
|
'perkiraan' => $datPerkiraan,
|
|
'id_perkiraan' => $id_perkiraan,
|
|
'awal' => $awal,
|
|
'akhir' => $akhir,
|
|
'tanggal_awal' => $tanggal_awal,
|
|
'debet_total' => $debet_total,
|
|
'kredit_total' => $kredit_total,
|
|
'saldo_total' => $saldo_total,
|
|
'tanggal_akhir' => $tanggal_akhir,
|
|
'title' => $title,
|
|
'all' => $all
|
|
];
|
|
$this->load->view('proses/LaporanPerkiraan_Keuangan_A1', $data);
|
|
}
|
|
|
|
public function simpan_excel_perkiraan() {
|
|
$start = $this->input->post('start');
|
|
$end = $this->input->post('end');
|
|
$all = $this->input->post('all');
|
|
$id_perkiraan = $this->input->post('id_perkiraan');
|
|
|
|
if ($all==2) {
|
|
$pilih_tabel = array('No', 'TANGGAL', 'TRANSAKSI', 'KODE BUKTI', 'DEBET', 'KREDIT', 'Keterangan');
|
|
} else if ($all==1) {
|
|
$pilih_tabel = array('No', 'TANGGAL', 'Kode', 'Nama', 'KODE BUKTI', 'DEBET', 'KREDIT', 'Keterangan');
|
|
}
|
|
|
|
if ($id_perkiraan==3) {
|
|
$laporan = $this->Laporan->getData_PiutangDagang_Perkiraan($start, $end);
|
|
} else if ($id_perkiraan==15) {
|
|
$laporan = $this->Laporan->getData_HutangDagang_Perkiraan($start, $end);
|
|
} else {
|
|
$laporan = $this->Laporan->getData_DaftarKasbank($start, $end, $all, $id_perkiraan);
|
|
$datDjm = $this->Laporan->getData_DaftarJurnalMemo($start, $end, $all, $id_perkiraan);
|
|
foreach ($datDjm as $key) {
|
|
$laporan[count($laporan)] = $key;
|
|
}
|
|
asort($laporan);
|
|
}
|
|
|
|
if ($all==2) {
|
|
$datPerkiraan = $this->Laporan->getData_Perkiraan_Not3($id_perkiraan);
|
|
$nama_perkiraan = $datPerkiraan[0]['NAMA_PERKIRAAN'];
|
|
$kode_perkiraan = $datPerkiraan[0]['KODE_PERKIRAAN'];
|
|
$judul = "$kode_perkiraan ($nama_perkiraan)";
|
|
} else {
|
|
$judul = "Semua Perkiraan";
|
|
}
|
|
|
|
$data = [
|
|
'title' => '',
|
|
'tanggal_awal' => date_format(date_create($start), "d/m/Y"),
|
|
'tanggal_akhir' => date_format(date_create($end), "d/m/Y"),
|
|
'jumlah_kolom' => count($pilih_tabel),
|
|
'nama_tabel' => $pilih_tabel,
|
|
'laporan' => $laporan,
|
|
'judul' => $judul,
|
|
];
|
|
|
|
if ($all==2) {
|
|
$this->load->view('cetak/excel_perkiraan_single', $data);
|
|
} else if ($all==1) {
|
|
$this->load->view('cetak/excel_perkiraan_all', $data);
|
|
}
|
|
}
|
|
|
|
public function dataKartuPiutangDagang_Keuangan_A1() {
|
|
$kondisi = $this->input->post('kondisi');
|
|
$tgl = date('Y-m-d');
|
|
$datPelanggan = $this->Laporan->getData_Pelanggan();
|
|
|
|
if ($kondisi==null){
|
|
$id_pelanggan = NULL;
|
|
$tgl_awal = NULL;
|
|
$all = 0;
|
|
$saldo_awal = 0;
|
|
$title = "Belum Terpilih*";
|
|
$tanggal_awal = date('Y-m-d');
|
|
$tanggal_akhir = date('Y-m-d');
|
|
$awal = date('d/m/Y');
|
|
$akhir = date('d/m/Y');
|
|
} else {
|
|
$all = 2;
|
|
$id_pelanggan = $this->input->post('id_pelanggan');
|
|
$tanggal_awal = $this->input->post('tanggal_awal');
|
|
$tanggal_akhir = $this->input->post('tanggal_akhir');
|
|
$awal = date_format(date_create($tanggal_awal), "d/m/Y");
|
|
$akhir = date_format(date_create($tanggal_akhir), "d/m/Y");
|
|
$dataPelanggan = $this->Laporan->getData_Pelanggan($id_pelanggan);
|
|
$nama_pelanggan = $dataPelanggan[0]['NAMA_PELANGGAN'];
|
|
$nama_kota = $dataPelanggan[0]['NAMA_KOTA'];
|
|
$title = "$nama_pelanggan ($nama_kota)";
|
|
$saldo_awal = $this->Laporan->getSaldo_PiutangDagang($tanggal_awal,$id_pelanggan);
|
|
$tgl_awal = $this->Laporan->getTanggal_PiutangDagang($tanggal_awal,$id_pelanggan);
|
|
|
|
if ($saldo_awal[0]['SALDO']==NULL) {
|
|
$saldo_awal = 0;
|
|
} else {
|
|
$saldo_awal = $saldo_awal[0]['SALDO'];
|
|
}
|
|
|
|
if ($tgl_awal==FALSE) {
|
|
$tgl_awal = $awal;
|
|
} else {
|
|
$tgl_awal = $tgl_awal[0]['TANGGAL'];
|
|
}
|
|
}
|
|
|
|
$laporan = $this->Laporan->getData_KartuPiutangDagang($tanggal_awal, $tanggal_akhir, $id_pelanggan, $all);
|
|
$data = [
|
|
'sidebar' => "menu laporan",
|
|
'navChild' => "laporan kartu piutang",
|
|
'laporan' => $laporan,
|
|
'tgl' => $tgl,
|
|
'pelanggan' => $datPelanggan,
|
|
'id_pelanggan' => $id_pelanggan,
|
|
'awal' => $awal,
|
|
'akhir' => $akhir,
|
|
'tanggal_awal' => $tanggal_awal,
|
|
'tanggal_akhir' => $tanggal_akhir,
|
|
'saldo_awal' => $saldo_awal,
|
|
'tgl_awal' => $tgl_awal,
|
|
'title' => $title,
|
|
'all' => $all
|
|
];
|
|
$this->load->view('proses/LaporanKartuPiutangDagang_Keuangan_A1', $data);
|
|
}
|
|
|
|
public function simpan_excel_kartupiutangdagang() {
|
|
$start = $this->input->post('start');
|
|
$end = $this->input->post('end');
|
|
$all = $this->input->post('all');
|
|
$id_pelanggan = $this->input->post('id_pelanggan');
|
|
|
|
$pilih_tabel = array('No', 'TANGGAL', 'KODE BUKTI', 'TRANSAKSI', 'DEBET', 'KREDIT', 'SALDO', 'Keterangan');
|
|
$saldo_awal = $this->Laporan->getSaldo_PiutangDagang($start, $id_pelanggan);
|
|
$tgl_awal = $this->Laporan->getTanggal_PiutangDagang($start, $id_pelanggan);
|
|
$datPelanggan = $this->Laporan->getData_Pelanggan($id_pelanggan);
|
|
$dataLaporan = $this->Laporan->getExcel_PiutangDagang_All($start, $end, $id_pelanggan);
|
|
|
|
if ($saldo_awal[0]['SALDO']==NULL) {
|
|
$saldo_awal = 0;
|
|
} else {
|
|
$saldo_awal = $saldo_awal[0]['SALDO'];
|
|
}
|
|
|
|
if ($tgl_awal==FALSE) {
|
|
$tgl_awal = date_format(date_create($start), "d/m/Y");
|
|
} else {
|
|
$tgl_awal = $tgl_awal[0]['TANGGAL'];
|
|
}
|
|
|
|
$data = [
|
|
'title' => '',
|
|
'tanggal_awal' => date_format(date_create($start), "d/m/Y"),
|
|
'tanggal_akhir' => date_format(date_create($end), "d/m/Y"),
|
|
'jumlah_kolom' => count($pilih_tabel),
|
|
'nama_tabel' => $pilih_tabel,
|
|
'saldo_awal' => $saldo_awal,
|
|
'tglawal' => $tgl_awal,
|
|
'laporan' => $dataLaporan,
|
|
'nama_pelanggan' => $datPelanggan[0]['NAMA_PELANGGAN'],
|
|
];
|
|
$this->load->view('cetak/excel_kartupiutangdagang', $data);
|
|
}
|
|
|
|
public function dataRekapAbsensi_Admin_A1() {
|
|
$datRa = $this->Laporan->getData_RekapAbsensi();
|
|
|
|
$data = [
|
|
'sidebar' => "menu laporan",
|
|
'navChild' => "laporan rekap absensi",
|
|
'ra' => $datRa,
|
|
];
|
|
$this->load->view('proses/LaporanRekapAbsensi_Admin_A1', $data);
|
|
}
|
|
|
|
public function simpan_excel_rekapabsensi() {
|
|
$id_ra = $this->input->post('id_ra');
|
|
|
|
$datRa = $this->Laporan->getData_RekapAbsensi($id_ra);
|
|
$awal = $datRa[0]['AWAL_RA'];
|
|
$akhir = $datRa[0]['AKHIR_RA'];
|
|
|
|
$datKaryawan = $this->Laporan->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->Laporan->getData_SetHariLibur_byTGL($tgl_check);
|
|
|
|
if ($day_check=="Sunday") {
|
|
$tgl_check = $this->Laporan->addTempoDay($tgl_check, 1);
|
|
} else if (strtotime($tgl_check)>=strtotime($awal) AND strtotime($tgl_check)<=strtotime($akhir) AND $datShl==FALSE) {
|
|
$datAbsensi = $this->Laporan->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->Laporan->addTempoDay($tgl_check, 1);
|
|
$count8++;
|
|
} else {
|
|
$absensi[$noi++] = [
|
|
'TGL' => $tgl_check,
|
|
'TANGGAL' => date_format(date_create($tgl_check), "d-M"),
|
|
'LIBUR' => '0',
|
|
'TELAT' => $datAbsensi[0]['TELAT'],
|
|
];
|
|
$tgl_check = $this->Laporan->addTempoDay($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->Laporan->addTempoDay($tgl_check, 1);
|
|
}
|
|
}
|
|
|
|
$count2 = $this->Laporan->getCount_Absensi_byKARYAWAN_status2($key['ID_KARYAWAN'], $awal, $akhir);
|
|
$count3 = $this->Laporan->getCount_Absensi_byKARYAWAN_status3($key['ID_KARYAWAN'], $awal, $akhir);
|
|
$count4 = $this->Laporan->getCount_Absensi_byKARYAWAN_status4($key['ID_KARYAWAN'], $awal, $akhir);
|
|
|
|
$datLaporan[$no++] = [
|
|
'NAMAKAR' => $key['NAMA_PANGGILAN_KARYAWAN'],
|
|
'REKAPALL' => $absensi,
|
|
'COUNT2' => $count2,
|
|
'COUNT3' => $count3,
|
|
'COUNT4' => $count4,
|
|
'COUNT8' => $count8
|
|
];
|
|
}
|
|
|
|
$data = [
|
|
'title' => '',
|
|
'awal' => $datRa[0]['AWAL'],
|
|
'akhir' => $datRa[0]['AKHIR'],
|
|
'nama_ra' => $datRa[0]['NAMA_RA'],
|
|
'diff' => count($absensi),
|
|
'laporan' => $datLaporan,
|
|
'karyawan' => $datKaryawan,
|
|
];
|
|
$this->load->view('cetak/excel_rekapabsensi', $data);
|
|
}
|
|
|
|
public function dataRincianPiutangDagang_Keuangan_A1() {
|
|
$datPelanggan = $this->Laporan->getData_Pelanggan();
|
|
$datSales = $this->Laporan->getData_Sales();
|
|
$tgl = date('Y-m-d');
|
|
|
|
$data = [
|
|
'sidebar' => "menu laporan",
|
|
'navChild' => "laporan rincian piutang",
|
|
'tgl' => $tgl,
|
|
'pelanggan' => $datPelanggan,
|
|
'sales' => $datSales,
|
|
];
|
|
$this->load->view('proses/LaporanRincianPiutangDagang_Keuangan_A1', $data);
|
|
}
|
|
|
|
public function simpan_excel_rincianpiutangdagang() {
|
|
$id_pelanggan = $this->input->post('id_pelanggan');
|
|
$id_sales = $this->input->post('id_sales');
|
|
$jenis_transaksi = $this->input->post('jenis_transaksi');
|
|
$tgl_bayar = $this->input->post('tgl_bayar');
|
|
$tgl_tempo = $this->input->post('tgl_tempo');
|
|
|
|
$datLaporan = $this->Laporan->getData_PiutangDagang_byPELANGGAN_bySALES($id_pelanggan, $id_sales, $jenis_transaksi, $tgl_tempo);
|
|
$no = 0;
|
|
$saldo = 0;
|
|
foreach ($datLaporan as $key) {
|
|
$sumNota = $key['DEBET'];
|
|
$totalNota = number_format($sumNota,2);
|
|
$datLaporan[$no] += ['NOTAJUAL'=>$totalNota];
|
|
|
|
$sumBayar = $this->Laporan->getSum_PiutangDagang_byPENJUALAN_TransaksiPembayaran($key['PENJUALAN_ID']);
|
|
$sumBayar = $sumBayar[0]['BAYAR'];
|
|
$totalBayar = number_format($sumBayar,2);
|
|
$datLaporan[$no] += ['NOTABAYAR'=>$totalBayar];
|
|
|
|
$sumRetur = $this->Laporan->getSum_PiutangDagang_byPENJUALAN_TransaksiRetur($key['PENJUALAN_ID']);
|
|
$sumRetur = $sumRetur[0]['RETUR'];
|
|
$totalRetur = number_format($sumRetur,2);
|
|
$datLaporan[$no] += ['NOTARETUR'=>$totalRetur];
|
|
|
|
$saldo = $sumNota-$sumBayar-$sumRetur;
|
|
$totalSaldo = number_format($saldo,2);
|
|
$datLaporan[$no++] += ['NOTASALDO'=>$totalSaldo];
|
|
|
|
$saldo = 0;
|
|
}
|
|
|
|
if ($jenis_transaksi==1) {
|
|
$transaksi = "SUDAH LUNAS";
|
|
} else if ($jenis_transaksi==2) {
|
|
$transaksi = "BELUM LUNAS";
|
|
} else if ($jenis_transaksi==3) {
|
|
$transaksi = "CAMPUR";
|
|
}
|
|
|
|
if ($id_pelanggan=="") {
|
|
$titlepel = "Semua Pelanggan";
|
|
} else {
|
|
$datPelanggan = $this->Laporan->getData_Pelanggan($id_pelanggan);
|
|
$nama_pelanggan = $datPelanggan[0]['NAMA_PELANGGAN'];
|
|
$titlepel = "$nama_pelanggan";
|
|
}
|
|
|
|
if ($id_sales=="") {
|
|
$titlesal = "Semua Sales";
|
|
} else {
|
|
$datKaryawan = $this->Laporan->getData_Sales($id_sales);
|
|
$nama_sales = $datKaryawan[0]['NAMA_PANGGILAN_KARYAWAN'];
|
|
$titlesal = "$nama_sales";
|
|
}
|
|
|
|
$data = [
|
|
'title' => '',
|
|
'tanggal_bayar' => date_format(date_create($tgl_bayar), "d/m/Y"),
|
|
'tanggal_tempo' => date_format(date_create($tgl_tempo), "d/m/Y"),
|
|
'laporan' => $datLaporan,
|
|
'transaksi' => $transaksi,
|
|
'titlepel' => $titlepel,
|
|
'titlesal' => $titlesal,
|
|
];
|
|
$this->load->view('cetak/excel_rincianpiutangdagang', $data);
|
|
}
|
|
|
|
public function dataStokKlaim_Admin_A1() {
|
|
$datSupplier = $this->Laporan->getData_Supplier();
|
|
$datMerk = $this->Laporan->getData_Merk();
|
|
$tgl = date('Y-m-d');
|
|
|
|
$data = [
|
|
'sidebar' => "menu laporan",
|
|
'navChild' => "laporan stokreal",
|
|
'tgl' => $tgl,
|
|
'supplier' => $datSupplier,
|
|
'merk' => $datMerk,
|
|
];
|
|
$this->load->view('proses/LaporanStokKlaim_Admin_A1', $data);
|
|
}
|
|
|
|
public function simpan_excel_stokklaim() {
|
|
$id_supplier = $this->input->post('id_supplier');
|
|
$id_merk = $this->input->post('id_merk');
|
|
$id_produk = $this->input->post('id_produk');
|
|
$status_sknpr = $this->input->post('status_sknpr');
|
|
$jenis_laporan = $this->input->post('jenis_laporan');
|
|
$tgl = date('d/m/Y');
|
|
|
|
if ($jenis_laporan==1) {
|
|
$pilih_tabel = array('No', 'SKU', 'QTY');
|
|
|
|
$datLaporan = $this->Laporan->getData_SnKlaimProgram_bySUPPLIER_byMERK_byPRODUK_bySTATUS($id_supplier, $id_merk, $id_produk, $status_sknpr, $jenis_laporan);
|
|
$no = 0;
|
|
$total = 0;
|
|
foreach ($datLaporan as $key) {
|
|
$total = $total + $key['TOTAL'];
|
|
}
|
|
} else if ($jenis_laporan==2 OR $jenis_laporan==3) {
|
|
$pilih_tabel = NULL;
|
|
|
|
$datLaporan = $this->Laporan->getData_SnKlaimProgram_bySUPPLIER_byMERK_byPRODUK_bySTATUS($id_supplier, $id_merk, $id_produk, $status_sknpr, $jenis_laporan);
|
|
$no = 0;
|
|
$total = 0;
|
|
foreach ($datLaporan as $key) {
|
|
if ($jenis_laporan==3) {
|
|
$sumPkpr = $this->Laporan->getSum_LinkKlaimProgram_bySNKPR($key['ID_SNKPR']);
|
|
$hargabaru = $key['HARGA_DKPR']-$sumPkpr[0]['TOTAL'];
|
|
$datLaporan[$no] += ['HARGAAKHIR' => number_format($hargabaru,2)];
|
|
|
|
$potongan = number_format($sumPkpr[0]['TOTAL'],2);
|
|
$datLaporan[$no] += ['POTONGAN' => $potongan];
|
|
}
|
|
|
|
$countSnkpr = $this->Laporan->getCount_SnKlaimProgram_byBARANG_bySUPPLIER_byMERK_byPRODUK_bySTATUS($key['BARANG_ID'], $id_supplier, $id_merk, $id_produk, $status_sknpr);
|
|
$datLaporan[$no] += ['COUNT' => $countSnkpr];
|
|
|
|
if ($key['STATUS_SNKPR']==0) {
|
|
$statussn = "READY";
|
|
} else if ($key['STATUS_SNKPR']==1 OR $key['STATUS_SNKPR']==3) {
|
|
$statussn = "SALE-OUT";
|
|
} else if ($key['STATUS_SNKPR']==2) {
|
|
$statussn = "RETUR";
|
|
}
|
|
$datLaporan[$no++] += ['STATUSSN' => $statussn];
|
|
|
|
$total = $total + $key['TOTAL'];
|
|
}
|
|
}
|
|
|
|
if ($status_sknpr=="") {
|
|
$transaksi = "SEMUA SN";
|
|
} else if ($status_sknpr==1) {
|
|
$transaksi = "SALEOUT";
|
|
} else if ($status_sknpr==2) {
|
|
$transaksi = "RETUR";
|
|
} else if ($status_sknpr==9) {
|
|
$transaksi = "READY";
|
|
}
|
|
|
|
if ($id_supplier=="") {
|
|
$titlesup = "Semua Supplier";
|
|
} else {
|
|
$datSupplier = $this->Laporan->getData_Supplier($id_supplier);
|
|
$nama_supplier = $datSupplier[0]['NAMA_SUPPLIER'];
|
|
$titlesup = "$nama_supplier";
|
|
}
|
|
|
|
if ($id_merk=="") {
|
|
$titlemerk = "Semua Merk";
|
|
} else {
|
|
$datMerk = $this->Laporan->getData_Merk($id_merk);
|
|
$nama_merk = $datMerk[0]['NAMA_MERK'];
|
|
$titlemerk = "$nama_merk";
|
|
}
|
|
|
|
if ($id_produk=="") {
|
|
$titlepro = "Semua Produk";
|
|
} else {
|
|
$datProduk = $this->Laporan->getData_Produk($id_produk);
|
|
$nama_produk = $datProduk[0]['NAMA_PRODUK'];
|
|
$titlepro = "$nama_produk";
|
|
}
|
|
|
|
$data = [
|
|
'title' => '',
|
|
'tgl' => $tgl,
|
|
'nama_tabel' => $pilih_tabel,
|
|
'laporan' => $datLaporan,
|
|
'transaksi' => $transaksi,
|
|
'titlesup' => $titlesup,
|
|
'titlemerk' => $titlemerk,
|
|
'titlepro' => $titlepro,
|
|
'total' => $total,
|
|
];
|
|
|
|
if ($jenis_laporan==1) {
|
|
$this->load->view('cetak/excel_stokklaimnonsn', $data);
|
|
} else if ($jenis_laporan==2) {
|
|
$this->load->view('cetak/excel_stokklaimsnharganon', $data);
|
|
} else if ($jenis_laporan==3) {
|
|
$this->load->view('cetak/excel_stokklaimsnhargawith', $data);
|
|
}
|
|
}
|
|
|
|
public function dataKlaimProgram_Admin_A1() {
|
|
$datBarang = $this->Laporan->getData_BarangSKU();
|
|
$datProgram = $this->Laporan->getData_Program();
|
|
$tgl = date('Y-m-d');
|
|
|
|
$data = [
|
|
'sidebar' => "menu laporan",
|
|
'navChild' => "laporan klaimprogram",
|
|
'tgl' => $tgl,
|
|
'program' => $datProgram,
|
|
'barang' => $datBarang,
|
|
];
|
|
$this->load->view('proses/LaporanKlaimProgram_Admin_A1', $data);
|
|
}
|
|
|
|
public function simpan_excel_klaimProgram() {
|
|
$id_program = $this->input->post('id_program');
|
|
$nama_pkpr = $this->input->post('nama_pkpr');
|
|
$id_barang = $this->input->post('id_barang');
|
|
$tgl = date('d/m/Y');
|
|
|
|
if ($nama_pkpr=="") {
|
|
$laporan = [];
|
|
$no = 0;
|
|
$datLkpr = $this->Laporan->getData_LinkKlaimProgram_byPROGRAM_byPKPR_byBARANG($id_program, NULL, $id_barang);
|
|
foreach ($datLkpr as $dat) {
|
|
$laporan[$no++] = [
|
|
'NAMA' => $dat['NAMA_PKPR'],
|
|
'NABAR' => $dat['NAMA_BARANG'],
|
|
'NOMINAL' => number_format($dat['NILAI_PKPR'],2),
|
|
'SN' => $dat['NAMA_SNKPR'],
|
|
];
|
|
}
|
|
} else {
|
|
$datPkpr = $this->Laporan->getData_PotonganKlaimProgram_byNAMA($nama_pkpr);
|
|
$laporan = [];
|
|
$no = 0;
|
|
foreach ($datPkpr as $key) {
|
|
$datLkpr = $this->Laporan->getData_LinkKlaimProgram_byPROGRAM_byPKPR_byBARANG($id_program, $key['ID_PKPR'], $id_barang);
|
|
foreach ($datLkpr as $dat) {
|
|
$laporan[$no++] = [
|
|
'NAMA' => $dat['NAMA_PKPR'],
|
|
'NABAR' => $dat['NAMA_BARANG'],
|
|
'NOMINAL' => number_format($dat['NILAI_PKPR'],2),
|
|
'SN' => $dat['NAMA_SNKPR'],
|
|
];
|
|
}
|
|
}
|
|
}
|
|
|
|
$datProgram = $this->Laporan->getData_Program($id_program);
|
|
$kode_program = $datProgram[0]['KODE_PROGRAM'];
|
|
$titleprogram = "$kode_program";
|
|
|
|
if ($nama_pkpr=="") {
|
|
$titlenama = "Semua Nama";
|
|
} else {
|
|
$titlenama = $nama_pkpr;
|
|
}
|
|
|
|
if ($id_barang=="") {
|
|
$titlebarang = "Semua Barang";
|
|
} else {
|
|
$datBarang = $this->Laporan->getData_Barang($id_barang);
|
|
$nama_barang = $datBarang[0]['NAMA_BARANG'];
|
|
$titlebarang = "$nama_barang";
|
|
}
|
|
|
|
$data = [
|
|
'tgl' => $tgl,
|
|
'laporan' => $laporan,
|
|
'titleprogram' => $titleprogram,
|
|
'titlenama' => $titlenama,
|
|
'titlebarang' => $titlebarang,
|
|
];
|
|
$this->load->view('cetak/excel_klaimprogram', $data);
|
|
}
|
|
|
|
public function dataPiutangKaryawan_Keuangan_A1() {
|
|
$kondisi = $this->input->post('kondisi');
|
|
$id_karyawan = $this->input->post('id_karyawan');
|
|
$tgl = date('Y-m-d');
|
|
$datKaryawan = $this->Laporan->getData_Karyawan();
|
|
|
|
if ($kondisi==null){
|
|
$id_karyawan = NULL;
|
|
$all = 0 ;
|
|
$tanggal_awal = date('Y-m-d');
|
|
$tanggal_akhir = date('Y-m-d');
|
|
$awal = date('d/m/Y');
|
|
$akhir = date('d/m/Y');
|
|
$title = "Belum Terpilih*";
|
|
$saldo_awal = 0;
|
|
$tgl_awal = NULL;
|
|
} else if ($kondisi!=null AND $id_karyawan=="") {
|
|
$id_karyawan = NULL;
|
|
$tanggal_awal = $this->input->post('tanggal_awal');
|
|
$tanggal_akhir = $this->input->post('tanggal_akhir');
|
|
$awal = date_format(date_create($tanggal_awal), "d/m/Y");
|
|
$akhir = date_format(date_create($tanggal_akhir), "d/m/Y");
|
|
$title = "Semua Karyawan";
|
|
$saldo_awal = 0;
|
|
$tgl_awal = NULL;
|
|
$all = 1;
|
|
} else {
|
|
$all = 2;
|
|
$tanggal_awal = $this->input->post('tanggal_awal');
|
|
$tanggal_akhir = $this->input->post('tanggal_akhir');
|
|
$awal = date_format(date_create($tanggal_awal), "d/m/Y");
|
|
$akhir = date_format(date_create($tanggal_akhir), "d/m/Y");
|
|
$datKaryawan = $this->Laporan->getData_Karyawan($id_karyawan);
|
|
$saldo_awal = $this->Laporan->getSaldo_PiutangKaryawan($tanggal_awal,$id_karyawan);
|
|
$tgl_awal = $this->Laporan->getTanggal_PiutangKaryawan($tanggal_awal,$id_karyawan);
|
|
if ($saldo_awal[0]['SALDO']==NULL) {
|
|
$saldo_awal = 0;
|
|
} else {
|
|
$saldo_awal = $saldo_awal[0]['SALDO'];
|
|
}
|
|
if ($tgl_awal==FALSE) {
|
|
$tgl_awal = $awal;
|
|
} else {
|
|
$tgl_awal = $tgl_awal[0]['TANGGAL'];
|
|
}
|
|
$nama_panggilan_karyawan = $datKaryawan[0]['NAMA_PANGGILAN_KARYAWAN'];
|
|
$title = "$nama_panggilan_karyawan";
|
|
}
|
|
$laporan = $this->Laporan->getData_PiutangKaryawan($tanggal_awal, $tanggal_akhir, $id_karyawan, $all);
|
|
$data = [
|
|
'sidebar' => "menu laporan",
|
|
'navChild' => "laporan piutangkaryawan",
|
|
'laporan' => $laporan,
|
|
'tgl' => $tgl,
|
|
'karyawan' => $datKaryawan,
|
|
'id_karyawan' => $id_karyawan,
|
|
'awal' => $awal,
|
|
'akhir' => $akhir,
|
|
'tanggal_awal' => $tanggal_awal,
|
|
'tanggal_akhir' => $tanggal_akhir,
|
|
'saldo_awal' => $saldo_awal,
|
|
'tgl_awal' => $tgl_awal,
|
|
'title' => $title,
|
|
'all' => $all
|
|
];
|
|
$this->load->view('proses/LaporanPiutangKaryawan_Keuangan_A1', $data);
|
|
}
|
|
|
|
public function simpan_excel_piutangkaryawan() {
|
|
$start = $this->input->post('start');
|
|
$end = $this->input->post('end');
|
|
$pilih_tabel = array('No', 'KARYAWAN', 'DEBET', 'KREDIT', 'SALDO');
|
|
|
|
$dataLaporan = $this->Laporan->getExcel_PiutangKaryawan_All($start, $end);
|
|
$data =
|
|
[
|
|
'title' => '',
|
|
'tanggal_awal' => date_format(date_create($start), "d/m/Y"),
|
|
'tanggal_akhir' => date_format(date_create($end), "d/m/Y"),
|
|
'jumlah_kolom' => count($pilih_tabel),
|
|
'nama_tabel' => $pilih_tabel,
|
|
'laporan' => $dataLaporan,
|
|
|
|
];
|
|
$this->load->view('cetak/excel_piutangkaryawan_all', $data);
|
|
}
|
|
|
|
public function simpan_excel_piutangkaryawan_kar() {
|
|
$start = $this->input->post('start_kar');
|
|
$end = $this->input->post('end_kar');
|
|
$pilih_tabel = array('No', 'TANGGAL', 'KODE BUKTI', 'TRANSAKSI', 'DEBET', 'KREDIT', 'SALDO', 'Keterangan');
|
|
$id_karyawan = $this->input->post('id_karyawan');
|
|
$laporan = $this->Laporan->getExcel_PiutangKaryawan_All($start, $end,$id_karyawan);
|
|
$saldo_awal = $this->Laporan->getSaldo_PiutangKaryawan($start,$id_karyawan);
|
|
$tanggal_awal = $this->Laporan->getTanggal_PiutangKaryawan($start,$id_karyawan);
|
|
$datKaryawan = $this->Laporan->getData_Karyawan($id_karyawan);
|
|
if ($saldo_awal[0]['SALDO']==NULL) {
|
|
$saldo_awal = 0;
|
|
} else {
|
|
$saldo_awal = $saldo_awal[0]['SALDO'];
|
|
}
|
|
|
|
if ($tanggal_awal==FALSE) {
|
|
$tanggal_awal = $start;
|
|
$tanggal_awal = date_format(date_create($start), "d/m/Y");
|
|
} else {
|
|
$tanggal_awal = $tanggal_awal[0]['TANGGAL'];
|
|
}
|
|
$data =
|
|
[
|
|
'title' => '',
|
|
'tanggal_awal' => date_format(date_create($start), "d/m/Y"),
|
|
'tanggal_akhir' => date_format(date_create($end), "d/m/Y"),
|
|
'jumlah_kolom' => count($pilih_tabel),
|
|
'nama_tabel' => $pilih_tabel,
|
|
'laporan' => $laporan,
|
|
'saldo_awal' => $saldo_awal,
|
|
'tglawal' => $tanggal_awal,
|
|
'nama_panggilan_karyawan' => $datKaryawan[0]['NAMA_PANGGILAN_KARYAWAN'],
|
|
];
|
|
$this->load->view('cetak/excel_piutangkaryawan_single', $data);
|
|
}
|
|
|
|
public function dataPiutangPihakke3_Keuangan_A1() {
|
|
$kondisi = $this->input->post('kondisi');
|
|
$id_pihakke3 = $this->input->post('id_pihakke3');
|
|
$tgl = date('Y-m-d');
|
|
$datPihakke3 = $this->Laporan->getData_Pihakke3();
|
|
|
|
if ($kondisi==null){
|
|
$id_pihakke3 = NULL;
|
|
$all = 0 ;
|
|
$tanggal_awal = date('Y-m-d');
|
|
$tanggal_akhir = date('Y-m-d');
|
|
$awal = date('d/m/Y');
|
|
$akhir = date('d/m/Y');
|
|
$title = "Belum Terpilih*";
|
|
$saldo_awal = 0;
|
|
$tgl_awal = NULL;
|
|
} else if ($kondisi!=null AND $id_pihakke3=="") {
|
|
$id_pihakke3 = NULL;
|
|
$tanggal_awal = $this->input->post('tanggal_awal');
|
|
$tanggal_akhir = $this->input->post('tanggal_akhir');
|
|
$awal = date_format(date_create($tanggal_awal), "d/m/Y");
|
|
$akhir = date_format(date_create($tanggal_akhir), "d/m/Y");
|
|
$title = "Semua Pihakke3";
|
|
$all = 1;
|
|
$saldo_awal = 0;
|
|
$tgl_awal = NULL;
|
|
} else {
|
|
$all = 2;
|
|
$tanggal_awal = $this->input->post('tanggal_awal');
|
|
$tanggal_akhir = $this->input->post('tanggal_akhir');
|
|
$awal = date_format(date_create($tanggal_awal), "d/m/Y");
|
|
$akhir = date_format(date_create($tanggal_akhir), "d/m/Y");
|
|
$datPihakke3 = $this->Laporan->getData_Pihakke3($id_pihakke3);
|
|
$nama_pihakke3 = $datPihakke3[0]['NAMA_PIHAKKE3'];
|
|
$nama_kota = $datPihakke3[0]['NAMA_KOTA'];
|
|
$title = "$nama_pihakke3 ($nama_kota)";
|
|
$saldo_awal = $this->Laporan->getSaldo_PiutangPihakke3($tanggal_awal,$id_pihakke3);
|
|
$tgl_awal = $this->Laporan->getTanggal_PiutangPihakke3($tanggal_awal,$id_pihakke3);
|
|
if ($saldo_awal[0]['SALDO']==NULL) {
|
|
$saldo_awal = 0;
|
|
} else {
|
|
$saldo_awal = $saldo_awal[0]['SALDO'];
|
|
}
|
|
if ($tgl_awal==FALSE) {
|
|
$tgl_awal = $awal;
|
|
} else {
|
|
$tgl_awal = $tgl_awal[0]['TANGGAL'];
|
|
}
|
|
}
|
|
$laporan = $this->Laporan->getData_PiutangPihakke3($tanggal_awal, $tanggal_akhir, $id_pihakke3, $all);
|
|
$data = [
|
|
'sidebar' => "menu laporan",
|
|
'navChild' => "laporan piutangpihakke3",
|
|
'laporan' => $laporan,
|
|
'tgl' => $tgl,
|
|
'pihakke3' => $datPihakke3,
|
|
'id_pihakke3' => $id_pihakke3,
|
|
'ppk' => $datPihakke3,
|
|
'awal' => $awal,
|
|
'akhir' => $akhir,
|
|
'tanggal_awal' => $tanggal_awal,
|
|
'tanggal_akhir' => $tanggal_akhir,
|
|
'saldo_awal' => $saldo_awal,
|
|
'tgl_awal' => $tgl_awal,
|
|
'title' => $title,
|
|
'all' => $all
|
|
];
|
|
$this->load->view('proses/LaporanPiutangPihakke3_Keuangan_A1', $data);
|
|
}
|
|
|
|
public function simpan_excel_piutangpihakke3() {
|
|
$start = $this->input->post('start');
|
|
$end = $this->input->post('end');
|
|
$pilih_tabel = array('No', 'PIHAKKE3', 'DEBET', 'KREDIT', 'SALDO');
|
|
if ($this->input->post('pilih_tabel') != null) {
|
|
foreach ($this->input->post('pilih_tabel') as $key) {
|
|
array_push($pilih_tabel, $key);
|
|
}
|
|
}
|
|
|
|
$dataLaporan = $this->Laporan->getExcel_PiutangPihakke3_All($start, $end);
|
|
$data =
|
|
[
|
|
'title' => '',
|
|
'tanggal_awal' => date_format(date_create($start), "d/m/Y"),
|
|
'tanggal_akhir' => date_format(date_create($end), "d/m/Y"),
|
|
'jumlah_kolom' => count($pilih_tabel),
|
|
'nama_tabel' => $pilih_tabel,
|
|
'laporan' => $dataLaporan,
|
|
|
|
];
|
|
$this->load->view('cetak/excel_piutangpihakke3_all', $data);
|
|
}
|
|
|
|
public function simpan_excel_piutangpihakke3_ppk() {
|
|
$start = $this->input->post('start_ppk');
|
|
$end = $this->input->post('end_ppk');
|
|
$pilih_tabel = array('No', 'TANGGAL', 'KODE BUKTI', 'TRANSAKSI', 'DEBET', 'KREDIT', 'SALDO', 'Keterangan');
|
|
$id_pihakke3 = $this->input->post('id_pihakke3');
|
|
$laporan = $this->Laporan->getExcel_PiutangPihakke3_All($start, $end,$id_pihakke3);
|
|
$saldo_awal = $this->Laporan->getSaldo_PiutangPihakke3($start,$id_pihakke3);
|
|
$tanggal_awal = $this->Laporan->getTanggal_PiutangPihakke3($start,$id_pihakke3);
|
|
$datPihakke3 = $this->Laporan->getData_Pihakke3($id_pihakke3);
|
|
if ($saldo_awal[0]['SALDO']==NULL) {
|
|
$saldo_awal = 0;
|
|
} else {
|
|
$saldo_awal = $saldo_awal[0]['SALDO'];
|
|
}
|
|
|
|
if ($tanggal_awal==FALSE) {
|
|
$tanggal_awal = $start;
|
|
$tanggal_awal = date_format(date_create($start), "d/m/Y");
|
|
} else {
|
|
$tanggal_awal = $tanggal_awal[0]['TANGGAL'];
|
|
}
|
|
$data =
|
|
[
|
|
'title' => '',
|
|
'tanggal_awal' => date_format(date_create($start), "d/m/Y"),
|
|
'tanggal_akhir' => date_format(date_create($end), "d/m/Y"),
|
|
'jumlah_kolom' => count($pilih_tabel),
|
|
'nama_tabel' => $pilih_tabel,
|
|
'laporan' => $laporan,
|
|
'saldo_awal' => $saldo_awal,
|
|
'tglawal' => $tanggal_awal,
|
|
'nama_pihakke3' => $datPihakke3[0]['NAMA_PIHAKKE3'],
|
|
|
|
];
|
|
$this->load->view('cetak/excel_piutangpihakke3_single', $data);
|
|
}
|
|
|
|
public function dataSaldoBank_Keuangan_A1() {
|
|
$kondisi = $this->input->post('kondisi');
|
|
$id_bank = $this->input->post('id_bank');
|
|
$tgl = date('Y-m-d');
|
|
$datBank = $this->Laporan->getData_Bank();
|
|
|
|
if ($kondisi==null){
|
|
$id_bank = NULL;
|
|
$all = 0 ;
|
|
$tanggal_awal = date('Y-m-d');
|
|
$tanggal_akhir = date('Y-m-d');
|
|
$awal = date('d/m/Y');
|
|
$akhir = date('d/m/Y');
|
|
$title = "Belum Terpilih*";
|
|
$saldo_awal = 0;
|
|
$tgl_awal = NULL;
|
|
} else if ($kondisi!=null AND $id_bank=="") {
|
|
$id_bank = NULL;
|
|
$tanggal_awal = $this->input->post('tanggal_awal');
|
|
$tanggal_akhir = $this->input->post('tanggal_akhir');
|
|
$awal = date_format(date_create($tanggal_awal), "d/m/Y");
|
|
$akhir = date_format(date_create($tanggal_akhir), "d/m/Y");
|
|
$title = "Semua Bank";
|
|
$all = 1;
|
|
$saldo_awal = 0;
|
|
$tgl_awal = NULL;
|
|
} else {
|
|
$all = 2;
|
|
$tanggal_awal = $this->input->post('tanggal_awal');
|
|
$tanggal_akhir = $this->input->post('tanggal_akhir');
|
|
$awal = date_format(date_create($tanggal_awal), "d/m/Y");
|
|
$akhir = date_format(date_create($tanggal_akhir), "d/m/Y");
|
|
$dataBank = $this->Laporan->getData_Bank($id_bank);
|
|
$kode_bank = $dataBank[0]['KODE_BANK'];
|
|
$nama_bank = $dataBank[0]['NAMA_BANK'];
|
|
$title = "$kode_bank ($nama_bank)";
|
|
$saldo_awal = $this->Laporan->getSaldo_Bank($tanggal_awal,$id_bank);
|
|
$tgl_awal = $this->Laporan->getTanggal_SaldoBank($tanggal_awal,$id_bank);
|
|
if ($saldo_awal[0]['SALDO']==NULL) {
|
|
$saldo_awal = 0;
|
|
} else {
|
|
$saldo_awal = $saldo_awal[0]['SALDO'];
|
|
}
|
|
if ($tgl_awal==FALSE) {
|
|
$tgl_awal = $awal;
|
|
} else {
|
|
$tgl_awal = $tgl_awal[0]['TANGGAL'];
|
|
}
|
|
}
|
|
$laporan = $this->Laporan->getData_SaldoBank($tanggal_awal, $tanggal_akhir, $id_bank, $all);
|
|
$data = [
|
|
'sidebar' => "menu laporan",
|
|
'navChild' => "laporan saldobank",
|
|
'laporan' => $laporan,
|
|
'tgl' => $tgl,
|
|
'bank' => $datBank,
|
|
'id_bank' => $id_bank,
|
|
'awal' => $awal,
|
|
'akhir' => $akhir,
|
|
'tanggal_awal' => $tanggal_awal,
|
|
'saldo_awal' => $saldo_awal,
|
|
'tgl_awal' => $tgl_awal,
|
|
'tanggal_akhir' => $tanggal_akhir,
|
|
'title' => $title,
|
|
'all' => $all
|
|
];
|
|
$this->load->view('proses/LaporanSaldoBank_Keuangan_A1', $data);
|
|
}
|
|
|
|
public function simpan_excel_saldobank() {
|
|
$start = $this->input->post('start');
|
|
$end = $this->input->post('end');
|
|
$id_bank = $this->input->post('id_bank');
|
|
$all = $this->input->post('all');
|
|
$pilih_tabel = array('No', 'TANGGAL', 'KODE BUKTI', 'TRANSAKSI', 'DEBET', 'KREDIT', 'SALDO', 'Keterangan');
|
|
$laporan = $this->Laporan->getExcel_SaldoBank_All($start, $end, $id_bank);
|
|
$saldo_awal = $this->Laporan->getSaldo_Bank($start,$id_bank);
|
|
$tgl_awal = $this->Laporan->getTanggal_SaldoBank($start,$id_bank);
|
|
$datBank = $this->Laporan->getData_Bank($id_bank);
|
|
if ($saldo_awal[0]['SALDO']==NULL) {
|
|
$saldo_awal = 0;
|
|
} else {
|
|
$saldo_awal = $saldo_awal[0]['SALDO'];
|
|
}
|
|
if ($tgl_awal==FALSE) {
|
|
$tgl_awal = date_format(date_create($start), "d/m/Y");
|
|
} else {
|
|
$tgl_awal = $tgl_awal[0]['TANGGAL'];
|
|
}
|
|
$data =
|
|
[
|
|
'title' => '',
|
|
'tanggal_awal' => date_format(date_create($start), "d/m/Y"),
|
|
'tanggal_akhir' => date_format(date_create($end), "d/m/Y"),
|
|
'jumlah_kolom' => count($pilih_tabel),
|
|
'nama_tabel' => $pilih_tabel,
|
|
'saldo_awal' => $saldo_awal,
|
|
'tglawal' => $tgl_awal,
|
|
'kode_bank' => $datBank[0]['KODE_BANK'],
|
|
'laporan' => $laporan,
|
|
|
|
];
|
|
$this->load->view('cetak/excel_saldobank_single', $data);
|
|
}
|
|
|
|
public function dataSaldoKas_Keuangan_A1() {
|
|
$kondisi = $this->input->post('kondisi');
|
|
$id_kas = $this->input->post('id_kas');
|
|
$tgl = date('Y-m-d');
|
|
$datKas = $this->Laporan->getData_Kas();
|
|
|
|
if ($kondisi==null){
|
|
$id_kas = NULL;
|
|
$all = 0 ;
|
|
$tanggal_awal = date('Y-m-d');
|
|
$tanggal_akhir = date('Y-m-d');
|
|
$awal = date('d/m/Y');
|
|
$akhir = date('d/m/Y');
|
|
$title = "Belum Terpilih*";
|
|
$saldo_awal = 0;
|
|
$tgl_awal = NULL;
|
|
} else if ($kondisi!=null AND $id_kas=="") {
|
|
$id_kas = NULL;
|
|
$tanggal_awal = $this->input->post('tanggal_awal');
|
|
$tanggal_akhir = $this->input->post('tanggal_akhir');
|
|
$awal = date_format(date_create($tanggal_awal), "d/m/Y");
|
|
$akhir = date_format(date_create($tanggal_akhir), "d/m/Y");
|
|
$title = "Semua Kas";
|
|
$all = 1;
|
|
$saldo_awal = 0;
|
|
$tgl_awal = NULL;
|
|
} else {
|
|
$all = 2;
|
|
$tanggal_awal = $this->input->post('tanggal_awal');
|
|
$tanggal_akhir = $this->input->post('tanggal_akhir');
|
|
$awal = date_format(date_create($tanggal_awal), "d/m/Y");
|
|
$akhir = date_format(date_create($tanggal_akhir), "d/m/Y");
|
|
$dataKas = $this->Laporan->getData_Kas($id_kas);
|
|
$kode_kas = $dataKas[0]['KODE_KAS'];
|
|
$nama_kas = $dataKas[0]['NAMA_KAS'];
|
|
$title = "$kode_kas ($nama_kas)";
|
|
$saldo_awal = $this->Laporan->getSaldo_Kas($tanggal_awal,$id_kas);
|
|
$tgl_awal = $this->Laporan->getTanggal_SaldoKas($tanggal_awal,$id_kas);
|
|
if ($saldo_awal[0]['SALDO']==NULL) {
|
|
$saldo_awal = 0;
|
|
} else {
|
|
$saldo_awal = $saldo_awal[0]['SALDO'];
|
|
}
|
|
if ($tgl_awal==FALSE) {
|
|
$tgl_awal = $awal;
|
|
} else {
|
|
$tgl_awal = $tgl_awal[0]['TANGGAL'];
|
|
}
|
|
}
|
|
$laporan = $this->Laporan->getData_SaldoKas($tanggal_awal, $tanggal_akhir, $id_kas, $all);
|
|
$data = [
|
|
'sidebar' => "menu laporan",
|
|
'navChild' => "laporan saldokas",
|
|
'laporan' => $laporan,
|
|
'tgl' => $tgl,
|
|
'kas' => $datKas,
|
|
'id_kas' => $id_kas,
|
|
'awal' => $awal,
|
|
'akhir' => $akhir,
|
|
'tanggal_awal' => $tanggal_awal,
|
|
'saldo_awal' => $saldo_awal,
|
|
'tgl_awal' => $tgl_awal,
|
|
'tanggal_akhir' => $tanggal_akhir,
|
|
'title' => $title,
|
|
'all' => $all
|
|
];
|
|
$this->load->view('proses/LaporanSaldoKas_Keuangan_A1', $data);
|
|
}
|
|
|
|
public function simpan_excel_saldokas() {
|
|
$start = $this->input->post('start');
|
|
$end = $this->input->post('end');
|
|
$id_kas = $this->input->post('id_kas');
|
|
$all = $this->input->post('all');
|
|
$pilih_tabel = array('No', 'TANGGAL', 'KODE BUKTI', 'TRANSAKSI', 'DEBET', 'KREDIT', 'SALDO', 'Keterangan');
|
|
$laporan = $this->Laporan->getExcel_SaldoKas_All($start, $end, $id_kas);
|
|
$saldo_awal = $this->Laporan->getSaldo_Kas($start,$id_kas);
|
|
$tgl_awal = $this->Laporan->getTanggal_SaldoKas($start,$id_kas);
|
|
$datKas = $this->Laporan->getData_Kas($id_kas);
|
|
if ($saldo_awal[0]['SALDO']==NULL) {
|
|
$saldo_awal = 0;
|
|
} else {
|
|
$saldo_awal = $saldo_awal[0]['SALDO'];
|
|
}
|
|
if ($tgl_awal==FALSE) {
|
|
$tgl_awal = date_format(date_create($start), "d/m/Y");
|
|
} else {
|
|
$tgl_awal = $tgl_awal[0]['TANGGAL'];
|
|
}
|
|
$data =
|
|
[
|
|
'title' => '',
|
|
'tanggal_awal' => date_format(date_create($start), "d/m/Y"),
|
|
'tanggal_akhir' => date_format(date_create($end), "d/m/Y"),
|
|
'jumlah_kolom' => count($pilih_tabel),
|
|
'nama_tabel' => $pilih_tabel,
|
|
'saldo_awal' => $saldo_awal,
|
|
'tglawal' => $tgl_awal,
|
|
'kode_kas' => $datKas[0]['KODE_KAS'],
|
|
'laporan' => $laporan,
|
|
|
|
];
|
|
$this->load->view('cetak/excel_saldokas_single', $data);
|
|
}
|
|
|
|
public function dataKlaimService_Service_A1() {
|
|
$kondisi = $this->input->post('kondisi');
|
|
$tgl = date('Y-m-d');
|
|
|
|
if ($kondisi==null){
|
|
$all = 0 ;
|
|
$tanggal_awal = date('Y-m-d');
|
|
$tanggal_akhir = date('Y-m-d');
|
|
$awal = date('d/m/Y');
|
|
$akhir = date('d/m/Y');
|
|
} else if ($kondisi!=null) {
|
|
$tanggal_awal = $this->input->post('tanggal_awal');
|
|
$tanggal_akhir = $this->input->post('tanggal_akhir');
|
|
$awal = date_format(date_create($tanggal_awal), "d/m/Y");
|
|
$akhir = date_format(date_create($tanggal_akhir), "d/m/Y");
|
|
$all = 1;
|
|
}
|
|
$laporan = $this->Laporan->getData_KlaimService($tanggal_awal, $tanggal_akhir, $all);
|
|
$data = [
|
|
'sidebar' => "menu laporan",
|
|
'navChild' => "",
|
|
'laporan' => $laporan,
|
|
'tgl' => $tgl,
|
|
'awal' => $awal,
|
|
'akhir' => $akhir,
|
|
'tanggal_awal' => $tanggal_awal,
|
|
'tanggal_akhir' => $tanggal_akhir,
|
|
'all' => $all
|
|
];
|
|
$this->load->view('proses/LaporanKlaimService_Service_A1', $data);
|
|
}
|
|
|
|
public function simpan_excel_klaimservice() {
|
|
$start = $this->input->post('start');
|
|
$end = $this->input->post('end');
|
|
$pilih_tabel = array('No', 'Tanggal', 'Kode');
|
|
if ($this->input->post('pilih_tabel') != null) {
|
|
foreach ($this->input->post('pilih_tabel') as $key) {
|
|
array_push($pilih_tabel, $key);
|
|
}
|
|
}
|
|
|
|
$dataLaporan = $this->Laporan->getExcel_KlaimService_All($start, $end);
|
|
|
|
$data =
|
|
[
|
|
'title' => '',
|
|
'tanggal_awal' => date_format(date_create($start), "d/m/Y"),
|
|
'tanggal_akhir' => date_format(date_create($end), "d/m/Y"),
|
|
'jumlah_kolom' => count($pilih_tabel),
|
|
'nama_tabel' => $pilih_tabel,
|
|
'laporan' => $dataLaporan,
|
|
|
|
];
|
|
$this->load->view('cetak/excel_klaimservice', $data);
|
|
}
|
|
|
|
public function dataOrderService_Service_A1() {
|
|
$kondisi = $this->input->post('kondisi');
|
|
$tgl = date('Y-m-d');
|
|
|
|
if ($kondisi==null){
|
|
$all = 0 ;
|
|
$tanggal_awal = date('Y-m-d');
|
|
$tanggal_akhir = date('Y-m-d');
|
|
$awal = date('d/m/Y');
|
|
$akhir = date('d/m/Y');
|
|
} else if ($kondisi!=null) {
|
|
$tanggal_awal = $this->input->post('tanggal_awal');
|
|
$tanggal_akhir = $this->input->post('tanggal_akhir');
|
|
$awal = date_format(date_create($tanggal_awal), "d/m/Y");
|
|
$akhir = date_format(date_create($tanggal_akhir), "d/m/Y");
|
|
$all = 1;
|
|
}
|
|
$laporan = $this->Laporan->getData_OrderService($tanggal_awal, $tanggal_akhir, $all);
|
|
$data = [
|
|
'sidebar' => "menu laporan",
|
|
'navChild' => "",
|
|
'laporan' => $laporan,
|
|
'tgl' => $tgl,
|
|
'awal' => $awal,
|
|
'akhir' => $akhir,
|
|
'tanggal_awal' => $tanggal_awal,
|
|
'tanggal_akhir' => $tanggal_akhir,
|
|
'all' => $all
|
|
];
|
|
$this->load->view('proses/LaporanOrderService_Service_A1', $data);
|
|
}
|
|
|
|
public function simpan_excel_orderservice() {
|
|
$start = $this->input->post('start');
|
|
$end = $this->input->post('end');
|
|
$pilih_tabel = array('No', 'Supplier');
|
|
if ($this->input->post('pilih_tabel') != null) {
|
|
foreach ($this->input->post('pilih_tabel') as $key) {
|
|
array_push($pilih_tabel, $key);
|
|
}
|
|
}
|
|
|
|
$dataLaporan = $this->Laporan->getExcel_OrderService_All($start, $end);
|
|
|
|
$data =
|
|
[
|
|
'title' => '',
|
|
'tanggal_awal' => date_format(date_create($start), "d/m/Y"),
|
|
'tanggal_akhir' => date_format(date_create($end), "d/m/Y"),
|
|
'jumlah_kolom' => count($pilih_tabel),
|
|
'nama_tabel' => $pilih_tabel,
|
|
'laporan' => $dataLaporan,
|
|
|
|
];
|
|
$this->load->view('cetak/excel_orderservice', $data);
|
|
}
|
|
|
|
public function dataRekapHarian_AdminSales_A1() {
|
|
$kondisi = $this->input->post('kondisi');
|
|
$id_corp = $this->input->post('id_corp');
|
|
$listsales = $this->input->post('listsales');
|
|
$level = $this->session->userdata('level');
|
|
$username = $this->session->userdata('username');
|
|
$datCorp = $this->Laporan->getData_Corp();
|
|
$datSales = $this->Laporan->getData_SalesItp();
|
|
|
|
//Set Sales Risti dan Olla
|
|
if ($listsales=="" AND $level==1) {
|
|
$listsales = [28, 30];
|
|
} else if ($listsales=="" AND $username=="risti") {
|
|
$listsales = [28, 30];
|
|
} else if ($listsales=="" AND $level==0) {
|
|
$listsales = [];
|
|
}
|
|
|
|
//Auto Select di Pilihan Sales
|
|
$check = 0;
|
|
$no = 0;
|
|
foreach ($datSales as $key) {
|
|
foreach ($listsales as $dat) {
|
|
if ($key['ID_KARYAWAN']==$dat) {
|
|
$check++;
|
|
break;
|
|
}
|
|
}
|
|
|
|
if ($check>0) {
|
|
$status = "YES";
|
|
} else {
|
|
$status = "NO";
|
|
}
|
|
$datSales[$no++] += ['STATUS' => $status];
|
|
$check = 0;
|
|
}
|
|
|
|
if ($kondisi==null){
|
|
$all = 0;
|
|
$id_corp = NULL;
|
|
$total_penjualan = 0;
|
|
$tanggal_nota = date('Y-m-d');
|
|
$awal = date('d/m/Y');
|
|
$title = "Belum Terpilih*";
|
|
$laporan = NULL;
|
|
} else {
|
|
$all = 1;
|
|
$tanggal_nota = $this->input->post('tanggal_nota');
|
|
$awal = date_format(date_create($tanggal_nota), "d/m/Y");
|
|
$dataCorp = $this->Laporan->getData_Corp($id_corp);
|
|
$nama_corp = $dataCorp[0]['NAMA_CORP'];
|
|
$title = "$nama_corp";
|
|
|
|
$total_penjualan = 0;
|
|
$laporan = [];
|
|
foreach ($listsales as $key) {
|
|
$sal = explode("|", $key);
|
|
$sumPda = $this->Laporan->getSum_Penjualan_LaporanRekapHarian($tanggal_nota, $id_corp, $sal[0]);
|
|
$subtotal = $sumPda[0]['TOTAL'];
|
|
$total_penjualan = $total_penjualan+$subtotal;
|
|
|
|
$dataPenjualan = $this->Laporan->getData_Penjualan_forRekapHarian($tanggal_nota, $id_corp, $sal[0]);
|
|
|
|
foreach ($dataPenjualan as $ds) {
|
|
array_push($laporan, $ds);
|
|
}
|
|
}
|
|
asort($laporan);
|
|
}
|
|
|
|
$data = [
|
|
'sidebar' => "menu laporan",
|
|
'navChild' => "laporan rekap harian",
|
|
'laporan' => $laporan,
|
|
'id_corp' => $id_corp,
|
|
'listsales' => $listsales,
|
|
'corp' => $datCorp,
|
|
'sales' => $datSales,
|
|
'awal' => $awal,
|
|
'tanggal_nota' => $tanggal_nota,
|
|
'title' => $title,
|
|
'all' => $all,
|
|
'total_penjualan' => $total_penjualan
|
|
];
|
|
$this->load->view('proses/LaporanRekapHarian_AdminSales_A1', $data);
|
|
}
|
|
|
|
public function simpan_excel_rekapharian() {
|
|
$id_corp = $this->input->post('id_corp');
|
|
$listsales = $this->input->post('listsales');
|
|
$tanggal = $this->input->post('tanggal');
|
|
|
|
$pilih_tabel = array('No', 'Nota', 'Tanggal', 'Pelanggan', 'Barang', 'Jenis', 'Kuantiti', 'Satuan', 'Subtotal');
|
|
|
|
$datCorp = $this->Laporan->getData_Corp($id_corp);
|
|
$nama_corp = $datCorp[0]['NAMA_CORP'];
|
|
$judul = "$nama_corp";
|
|
|
|
$laporan = [];
|
|
foreach ($listsales as $key) {
|
|
$sal = explode("|", $key);
|
|
$dataPenjualan = $this->Laporan->getData_Penjualan_forRekapHarian($tanggal, $id_corp, $sal[0]);
|
|
|
|
foreach ($dataPenjualan as $ds) {
|
|
array_push($laporan, $ds);
|
|
}
|
|
}
|
|
asort($laporan);
|
|
|
|
$data = [
|
|
'title' => '',
|
|
'tanggal_nota' => date_format(date_create($tanggal), "d/m/Y"),
|
|
'jumlah_kolom' => count($pilih_tabel),
|
|
'nama_tabel' => $pilih_tabel,
|
|
'laporan' => $laporan,
|
|
'judul' => $judul
|
|
];
|
|
$this->load->view('cetak/excel_rekapharian_penjualan', $data);
|
|
|
|
}
|
|
|
|
public function dataRekapPajak_Keuangan_A1() {
|
|
$datCorp = $this->Laporan->getData_Corp_PKP();
|
|
$tgl = date('Y-m-d');
|
|
|
|
$data = [
|
|
'sidebar' => "menu laporan",
|
|
'navChild' => "laporan rekappajak",
|
|
'tgl' => $tgl,
|
|
'corp' => $datCorp
|
|
];
|
|
$this->load->view('proses/LaporanRekapPajak_Keuangan_A1', $data);
|
|
}
|
|
|
|
public function simpan_excel_rekappajak() {
|
|
$tanggal_awal = $this->input->post('tanggal_awal');
|
|
$tanggal_akhir = $this->input->post('tanggal_akhir');
|
|
$jenis_transaksi = $this->input->post('jenis_transaksi');
|
|
$jenis_status = $this->input->post('jenis_status');
|
|
$id_corp = $this->input->post('id_corp');
|
|
|
|
$laporan = [];
|
|
$no = 0;
|
|
if ($jenis_transaksi=="") {
|
|
if ($id_corp=="") {
|
|
$title = "PPH Ps22 - PT TMP";
|
|
$datDrpj = $this->Laporan->getData_DaftarRekapPajak_byCORP_jenis1(1, $tanggal_awal, $tanggal_akhir, $jenis_status);
|
|
|
|
$laporan[$no++] = [
|
|
'JENIS' => '1',
|
|
'TITLE' => $title,
|
|
'DRPJ' => $datDrpj,
|
|
];
|
|
|
|
$title = "PPH Ps22 - PT DMT";
|
|
$datDrpj = $this->Laporan->getData_DaftarRekapPajak_byCORP_jenis1(2, $tanggal_awal, $tanggal_akhir, $jenis_status);
|
|
|
|
$laporan[$no++] = [
|
|
'JENIS' => '1',
|
|
'TITLE' => $title,
|
|
'DRPJ' => $datDrpj,
|
|
];
|
|
|
|
$title = "PPH Ps22 - CV SFTR";
|
|
$datDrpj = $this->Laporan->getData_DaftarRekapPajak_byCORP_jenis1(4, $tanggal_awal, $tanggal_akhir, $jenis_status);
|
|
|
|
$laporan[$no++] = [
|
|
'JENIS' => '1',
|
|
'TITLE' => $title,
|
|
'DRPJ' => $datDrpj,
|
|
];
|
|
|
|
$title = "PPH Ps23 - PT TMP";
|
|
$datDrpj = $this->Laporan->getData_DaftarRekapPajak_byCORP_jenis2(1, $tanggal_awal, $tanggal_akhir, $jenis_status);
|
|
|
|
$laporan[$no++] = [
|
|
'JENIS' => '2',
|
|
'TITLE' => $title,
|
|
'DRPJ' => $datDrpj,
|
|
];
|
|
|
|
$title = "PPH Ps23 - PT DMT";
|
|
$datDrpj = $this->Laporan->getData_DaftarRekapPajak_byCORP_jenis2(2, $tanggal_awal, $tanggal_akhir, $jenis_status);
|
|
|
|
$laporan[$no++] = [
|
|
'JENIS' => '2',
|
|
'TITLE' => $title,
|
|
'DRPJ' => $datDrpj,
|
|
];
|
|
|
|
$title = "PPH Ps23 - CV SFTR";
|
|
$datDrpj = $this->Laporan->getData_DaftarRekapPajak_byCORP_jenis2(4, $tanggal_awal, $tanggal_akhir, $jenis_status);
|
|
|
|
$laporan[$no++] = [
|
|
'JENIS' => '2',
|
|
'TITLE' => $title,
|
|
'DRPJ' => $datDrpj,
|
|
];
|
|
|
|
$title = "PPN - PT TMP";
|
|
$datDrpj = $this->Laporan->getData_DaftarRekapPajak_byCORP_jenis3(1, $tanggal_awal, $tanggal_akhir, $jenis_status);
|
|
|
|
$laporan[$no++] = [
|
|
'JENIS' => '3',
|
|
'TITLE' => $title,
|
|
'DRPJ' => $datDrpj,
|
|
];
|
|
|
|
$title = "PPN - PT DMT";
|
|
$datDrpj = $this->Laporan->getData_DaftarRekapPajak_byCORP_jenis3(2, $tanggal_awal, $tanggal_akhir, $jenis_status);
|
|
|
|
$laporan[$no++] = [
|
|
'JENIS' => '3',
|
|
'TITLE' => $title,
|
|
'DRPJ' => $datDrpj,
|
|
];
|
|
|
|
$title = "PPN - CV SFTR";
|
|
$datDrpj = $this->Laporan->getData_DaftarRekapPajak_byCORP_jenis3(4, $tanggal_awal, $tanggal_akhir, $jenis_status);
|
|
|
|
$laporan[$no++] = [
|
|
'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->Laporan->getData_DaftarRekapPajak_byCORP_jenis1($id_corp, $tanggal_awal, $tanggal_akhir, $jenis_status);
|
|
|
|
$laporan[$no++] = [
|
|
'JENIS' => '1',
|
|
'TITLE' => $title,
|
|
'DRPJ' => $datDrpj,
|
|
];
|
|
|
|
$title = "PPH Ps23 - $corp";
|
|
$datDrpj = $this->Laporan->getData_DaftarRekapPajak_byCORP_jenis2($id_corp, $tanggal_awal, $tanggal_akhir, $jenis_status);
|
|
|
|
$laporan[$no++] = [
|
|
'JENIS' => '2',
|
|
'TITLE' => $title,
|
|
'DRPJ' => $datDrpj,
|
|
];
|
|
|
|
$title = "PPN - $corp";
|
|
$datDrpj = $this->Laporan->getData_DaftarRekapPajak_byCORP_jenis3($id_corp, $tanggal_awal, $tanggal_akhir, $jenis_status);
|
|
|
|
$laporan[$no++] = [
|
|
'JENIS' => '3',
|
|
'TITLE' => $title,
|
|
'DRPJ' => $datDrpj,
|
|
];
|
|
}
|
|
} else if ($jenis_transaksi==1) {
|
|
if ($id_corp=="") {
|
|
$title = "PPH Ps22 - PT TMP";
|
|
$datDrpj = $this->Laporan->getData_DaftarRekapPajak_byCORP_jenis1(1, $tanggal_awal, $tanggal_akhir, $jenis_status);
|
|
|
|
$laporan[$no++] = [
|
|
'JENIS' => $jenis_transaksi,
|
|
'TITLE' => $title,
|
|
'DRPJ' => $datDrpj,
|
|
];
|
|
|
|
$title = "PPH Ps22 - PT DMT";
|
|
$datDrpj = $this->Laporan->getData_DaftarRekapPajak_byCORP_jenis1(2, $tanggal_awal, $tanggal_akhir, $jenis_status);
|
|
|
|
$laporan[$no++] = [
|
|
'JENIS' => $jenis_transaksi,
|
|
'TITLE' => $title,
|
|
'DRPJ' => $datDrpj,
|
|
];
|
|
|
|
$title = "PPH Ps22 - CV SFTR";
|
|
$datDrpj = $this->Laporan->getData_DaftarRekapPajak_byCORP_jenis1(4, $tanggal_awal, $tanggal_akhir, $jenis_status);
|
|
|
|
$laporan[$no++] = [
|
|
'JENIS' => $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->Laporan->getData_DaftarRekapPajak_byCORP_jenis1($id_corp, $tanggal_awal, $tanggal_akhir, $jenis_status);
|
|
|
|
$laporan[$no] = [
|
|
'JENIS' => $jenis_transaksi,
|
|
'TITLE' => $title,
|
|
'DRPJ' => $datDrpj,
|
|
];
|
|
}
|
|
} else if ($jenis_transaksi==2) {
|
|
if ($id_corp=="") {
|
|
$title = "PPH Ps23 - PT TMP";
|
|
$datDrpj = $this->Laporan->getData_DaftarRekapPajak_byCORP_jenis2(1, $tanggal_awal, $tanggal_akhir, $jenis_status);
|
|
|
|
$laporan[$no++] = [
|
|
'JENIS' => $jenis_transaksi,
|
|
'TITLE' => $title,
|
|
'DRPJ' => $datDrpj,
|
|
];
|
|
|
|
$title = "PPH Ps23 - PT DMT";
|
|
$datDrpj = $this->Laporan->getData_DaftarRekapPajak_byCORP_jenis2(2, $tanggal_awal, $tanggal_akhir, $jenis_status);
|
|
|
|
$laporan[$no++] = [
|
|
'JENIS' => $jenis_transaksi,
|
|
'TITLE' => $title,
|
|
'DRPJ' => $datDrpj,
|
|
];
|
|
|
|
$title = "PPH Ps23 - CV SFTR";
|
|
$datDrpj = $this->Laporan->getData_DaftarRekapPajak_byCORP_jenis2(4, $tanggal_awal, $tanggal_akhir, $jenis_status);
|
|
|
|
$laporan[$no++] = [
|
|
'JENIS' => $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->Laporan->getData_DaftarRekapPajak_byCORP_jenis2($id_corp, $tanggal_awal, $tanggal_akhir, $jenis_status);
|
|
|
|
$laporan[$no] = [
|
|
'JENIS' => $jenis_transaksi,
|
|
'TITLE' => $title,
|
|
'DRPJ' => $datDrpj,
|
|
];
|
|
}
|
|
} else if ($jenis_transaksi==3) {
|
|
if ($id_corp=="") {
|
|
$title = "PPN - PT TMP";
|
|
$datDrpj = $this->Laporan->getData_DaftarRekapPajak_byCORP_jenis3(1, $tanggal_awal, $tanggal_akhir, $jenis_status);
|
|
|
|
$laporan[$no++] = [
|
|
'JENIS' => $jenis_transaksi,
|
|
'TITLE' => $title,
|
|
'DRPJ' => $datDrpj,
|
|
];
|
|
|
|
$title = "PPN - PT DMT";
|
|
$datDrpj = $this->Laporan->getData_DaftarRekapPajak_byCORP_jenis3(2, $tanggal_awal, $tanggal_akhir, $jenis_status);
|
|
|
|
$laporan[$no++] = [
|
|
'JENIS' => $jenis_transaksi,
|
|
'TITLE' => $title,
|
|
'DRPJ' => $datDrpj,
|
|
];
|
|
|
|
$title = "PPN - CV SFTR";
|
|
$datDrpj = $this->Laporan->getData_DaftarRekapPajak_byCORP_jenis3(4, $tanggal_awal, $tanggal_akhir, $jenis_status);
|
|
|
|
$laporan[$no++] = [
|
|
'JENIS' => $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->Laporan->getData_DaftarRekapPajak_byCORP_jenis3($id_corp, $tanggal_awal, $tanggal_akhir, $jenis_status);
|
|
|
|
$laporan[$no] = [
|
|
'JENIS' => $jenis_transaksi,
|
|
'TITLE' => $title,
|
|
'DRPJ' => $datDrpj,
|
|
];
|
|
}
|
|
}
|
|
|
|
if ($jenis_status==0) {
|
|
$subtitle = "Tidak Terbayar";
|
|
} else if ($jenis_status==1) {
|
|
$subtitle = "Terbayar";
|
|
} else if ($jenis_status==9) {
|
|
$subtitle = "Semua Status";
|
|
}
|
|
|
|
$data = [
|
|
'tanggal_awal' => date_format(date_create($tanggal_awal), "d/m/Y"),
|
|
'tanggal_akhir' => date_format(date_create($tanggal_akhir), "d/m/Y"),
|
|
'laporan' => $laporan,
|
|
'subtitle' => $subtitle,
|
|
];
|
|
$this->load->view('cetak/excel_rekappajak', $data);
|
|
|
|
}
|
|
|
|
|
|
}
|