function upd_lelang() { $data = array(); $datax = array(); $id = $_POST['no_spb']; $n = $_POST['ide']; $data['no_spb'] = $this->Admin_model->show_single_field("spb", "no_spb", "where no_spb='" . $id . "'"); $data['id_barang'] = $this->Admin_model->show_single_field("spb", "id_barang", "where no_spb='" . $id . "'"); $data['nilai_spb'] = $this->Admin_model->show_single_field("spb", "nilai_spb", "where no_spb='" . $id . "'"); $data['jw_spb'] = $this->Admin_model->show_single_field("spb", "jw_spb", "where no_spb='" . $id . "'"); $tgl_spb = $this->Admin_model->show_single_field("spb", "tgl_spb", "where no_spb='" . $id . "'"); $pp_ke = $this->Admin_model->show_single_field("perpanjang_spb", "pp_ke", "where pp_stat='Y' and no_spb='" . $id . "'"); $pp_ke == '' ? $pp_ke = 1 : ($pp_ke = $pp_ke); $data['jt_spb'] = getNextDays($tgl_spb, $pp_ke * 30); $_POST['stat'] == '' ? $sts = "" : ($sts = $_POST['stat']); $data['pp_stat'] = $_POST['stat']; $data["created_by"] = $this->session->userdata("userid"); if ($this->Admin_model->field_exists('lelang', "where no_spb='{$id}'", 'no_spb') == '') { $this->Admin_model->simpan_data('lelang', $data); } else { $this->Admin_model->upd_data('lelang', "set pp_stat='" . $sts . "'", "where no_spb='{$id}'"); } $_POST['stat'] == '' ? $this->Admin_model->upd_data('spb', "set stat_spb='Y',created_by='" . $this->session->userdata("userid") . "'", "where no_spb='" . $_POST['no_spb'] . "'") : $this->Admin_model->upd_data('spb', "set stat_spb='C',created_by='" . $this->session->userdata("userid") . "'", "where no_spb='" . $_POST['no_spb'] . "'"); //print_r ($data); $datax['gambar'] = base_url() . "asset/images/44.gif"; $datax['diklik'] = "upd_lelang('{$id}','');"; $datax['ttl'] = $this->Admin_model->total_data('lelang', 'D', "pp_stat"); echo json_encode($datax); }
function label_siap_print() { $data = array(); $id = $_POST['no_spb']; //$n=$_POST['ide']; $data['no_spb'] = $this->Admin_model->show_single_field("spb", "no_spb", "where no_spb='" . $id . "'"); $data['id_barang'] = $this->Admin_model->show_single_field("spb", "id_barang", "where no_spb='" . $id . "'"); $data['nilai_spb'] = $this->Admin_model->show_single_field("spb", "nilai_spb", "where no_spb='" . $id . "'"); $data['jw_spb'] = $this->Admin_model->show_single_field("spb", "jw_spb", "where no_spb='" . $id . "'"); $tgl_spb = $this->Admin_model->show_single_field("spb", "tgl_spb", "where no_spb='" . $id . "'"); $pp_ke = $this->Admin_model->show_single_field("perpanjang_spb", "pp_ke", "where pp_stat='Y' and no_spb='" . $id . "'"); $pp_ke == '' ? $pp_ke = 1 : ($pp_ke = $pp_ke); $data['jt_spb'] = getNextDays($tgl_spb, $pp_ke * 30); $_POST['stat'] == '' ? $sts = "" : ($sts = $_POST['stat']); $data['pp_stat'] = $_POST['stat']; $data["created_by"] = $this->session->userdata("userid"); if ($this->Admin_model->field_exists('labeling', "where no_spb='{$id}'", 'no_spb') == '') { $this->Admin_model->simpan_data('labeling', $data); } else { $this->Admin_model->upd_data('labeling', "set pp_stat='" . $sts . "'", "where no_spb='{$id}'"); } }
function perpanjang($no_spb, $pp_ke = 1, $showtgl = false, $bayar = false) { $jtspb = rdb('spb', 'tgl_spb', 'tgl_spb', "where no_spb='{$no_spb}'"); $nextjtspb = getNextDays($jtspb, $pp_ke * 30); $nextjtspb2 = getNextDays($jtspb, ($pp_ke + 1) * 30); $bataslelang = getNextDays($nextjtspb, 13); $today = date('Y-m-d'); $stat = rdb('perpanjang_spb', 'pp_ke', 'pp_ke', "where no_spb='" . $no_spb . "' and pp_ke='{$pp_ke}'"); $action = rdb('perpanjang_spb', 'pp_stat', 'pp_stat', "where no_spb='" . $no_spb . "' and pp_ke='{$pp_ke}'"); $bayare = $bayar == true && $pp_ke > 1 ? rdb('perpanjang_spb', 'pp_stat', 'pp_stat', "where no_spb='" . $no_spb . "' and pp_ke='" . ($pp_ke - 1) . "'") : ''; $bunga = rdb('spb', 'taksir_spb', 'taksir_spb', "where no_spb='{$no_spb}'"); $bunga = $bunga * 10 / 100; if ($stat == '') { if (compare_date($today, $bataslelang) == true && compare_date($today, $nextjtspb) == false) { return "<img class='aksi' src='" . base_url() . "/asset/images/icon-25.gif' width='20' height='20' title='Klik untuk process perpanjang' onclick=\"aksi_click('{$no_spb}','{$pp_ke}','{$bunga}')\";>"; } else { return compare_date($nextjtspb2, $today) == false ? $bayar == true && $bayare == 'Y' || $pp_ke == '1' ? "<img src='" . base_url() . "/asset/images/checkout.gif' title='Click untuk transaksi bayar' onclick=\"aksi_click('{$no_spb}','{$pp_ke}','{$bunga}')\">" : false : "<img src='" . base_url() . "/asset/images/8.png' title='Tidak di perpanjang lanjut untuk process lelang'>"; } } else { if ($action == 'Y') { return $showtgl == false ? "<img src='" . base_url() . "/asset/images/iconic.png' ondblclick=\"reset_upd('{$no_spb}','{$pp_ke}','');\" title='Telah di perpanjang " . $stat . " kali.\nTanggal Jatuh Tempo berikutnya :" . tglfromSql(getNextDays($jtspb, ($stat + 1) * 30)) . "'>" : ShortTgl($nextjtspb2); } else { if ($action == 'N') { return "<img src='" . base_url() . "/asset/images/8.png' ondblclick=\"reset_upd('{$no_spb}','{$pp_ke}','Y');\" title='Tidak di perpanjang lanjut untuk process lelang'>"; } else { if ($action == 'L') { return "<img src='" . base_url() . "/asset/images/bullet.png' title='Lunas'>"; } else { return false; } } } } }