function dateReverse($date = '') { //d-m-Y $tgl = $date; if (empty($tgl)) { $tgl = tglSekarang(); } $arr = explode('-', $tgl); return $arr[2] . '-' . $arr[1] . '-' . $arr[0]; }
public function tambahData() { $data['judul_page'] = 'Tambah Ekpedisi'; $data['des_page'] = ''; $data['page'] = 'ekspedisi-tambahdata'; if ($this->input->post("simpan")) { $this->form_validation->set_rules("nama_ekspedisi", "Nama Ekspedisi", "required|max_length[100]"); $this->form_validation->set_rules("des_ekspedisi", "Deskripsi Ekspedisi", "required"); if ($this->form_validation->run()) { $tanggal = tglSekarang(); $waktu = wktSekarang(); $data = array("NAMA_EKSPEDISI" => $this->input->post("nama_ekspedisi"), "DES_EKSPEDISI" => $this->input->post("des_ekspedisi"), "TGL_TERDAFTAR" => $tanggal, "WKT_TERDAFTAR" => $waktu); $this->ekspedisimodel->tambahData($data, "mp_ekspedisi"); $this->session->set_flashdata('notif', "Ekspedisi Berhasil Di Tambah !"); $this->session->set_flashdata('clr', 'success'); redirect('admin_ekspedisi/tambahData'); } else { $this->session->set_flashdata('notif', validation_errors()); $this->session->set_flashdata('clr', 'danger'); redirect('admin_ekspedisi/tambahData'); } } $this->load->view($this->template, $data); }
<td><input type="text" name="noRm" id="noRm" value="" class="noRm" readonly/></td> </tr> <tr> <td class="labelField">Nama Pasien</td> <td><input type="text" name="namaPasien" id="namaPasien" value="" class="namaPasien" required /></td> </tr> <tr> <td class="labelField">Tempat Lahir</td> <td><input type="text" name="tempatLahir" id="tempatLahir" value="" class="tempatLahir" required /></td> </tr> <tr> <td class="labelField">Tanggal Lahir</td> <td> <div id="datePickerTanggal" class="input-append date"> <input class="input input-small tanggal" data-format="dd-MM-yyyy" type="text" name="tanggalLahir" id="tanggalLahir" value="<?php echo tglSekarang(); ?> "required="true" > <span class="add-on"> <i data-time-icon="icon-time" data-date-icon="icon-calendar"></i> </span> </div> </td> </tr> <tr> <td class="labelField">Jenis Kelamin</td> <td><?php dropDownJeniskelamin('name="jenisKelamin" id="jenisKelamin" class="jenisKelamin" required'); ?> </td> </tr>
function tambahPenanggungJwbSubmit() { $this->form_validation->set_rules('nama', 'Nama', 'required'); $this->form_validation->set_rules('alamat', 'Alamat', 'required'); $this->form_validation->set_rules('telp', 'Telepon', 'required'); $this->form_validation->set_rules('email', 'Email', 'valid_email'); $this->form_validation->set_rules('id_provinsi', 'Provinsi', 'required'); $this->form_validation->set_rules('id_kota', 'Kota', 'required'); $this->form_validation->set_rules('id_kecamatan', 'Kecamatan', 'required'); if ($this->form_validation->run() == FALSE) { $this->session->set_flashdata('notif', validation_errors()); $this->session->set_flashdata('clr', 'danger'); redirect('admin_penanggung_jwb/tambahPenanggungJwb'); } $nama = $this->input->post('nama'); $alamat = $this->input->post('alamat'); $telp = $this->input->post('telp'); $email = $this->input->post('email'); $s_bbm = $this->input->post('s_bbm'); $id_provinsi = $this->input->post('id_provinsi'); $id_kota = $this->input->post('id_kota'); $id_kecamatan = $this->input->post('id_kecamatan'); $kelurahan = $this->input->post('kelurahan'); $tgl_terdaftar = ubahFormatTgl(tglSekarang(), 'Y-m-d'); if (!empty($_FILES['foto_profil']["tmp_name"])) { // Jika upload $config['file_name'] = date("Ymdhis"); $config['upload_path'] = './assets-admin/img/penanggung_jwb/'; $config['allowed_types'] = 'gif|jpg|png'; $config['max_size'] = 1048; $config['max_width'] = 1024; $config['max_height'] = 768; $config['detect_mime'] = TRUE; $this->load->library("upload", $config); $filename = "foto_profil"; if (!$this->upload->do_upload($filename)) { $this->session->set_flashdata('notif', $this->upload->display_errors()); $this->session->set_flashdata('clr', 'danger'); redirect('admin_penanggung_jwb/tambahPenanggungJwb', 'location'); exit; } $nm_img = $this->upload->data("file_name"); } else { $nm_img = NULL; } $data = array('NAMA' => $nama, 'ALAMAT' => $alamat, 'TELP' => $telp, 'EMAIL' => $email, 'S_BBM' => $s_bbm, 'KELURAHAN' => $kelurahan, 'ID_PROVINSI' => $id_provinsi, 'ID_KOTA' => $id_kota, 'ID_KECAMATAN' => $id_kecamatan, 'TGL_TERDAFTAR' => $tgl_terdaftar, 'FT_PROFIL' => $nm_img, 'STATUS_HAPUS' => 0); $this->penanggung_jwb->tambahData($data, 'mp_penanggung_jwb'); $this->session->set_flashdata('notif', 'Tambah UKM Berhasil'); $this->session->set_flashdata('clr', 'success'); redirect('admin_penanggung_jwb/tambahPenanggungJwb', 'location'); }
public function ubahProduksubmit() { $this->form_validation->set_rules('NM_PRODUK', 'NM_PRODUK', 'required'); $this->form_validation->set_rules('ID_KATEGORI', 'ID_KATEGORI', 'required'); $this->form_validation->set_rules('ID_SUB_KATEGORI', 'ID_SUB_KATEGORI', 'required'); $this->form_validation->set_rules('HARGA', 'HARGA', 'required'); $this->form_validation->set_rules('BERAT_PRODUK', 'BERAT_PRODUK', 'required'); $this->form_validation->set_rules('MIN_PESAN', 'MIN_PESAN', 'required'); $this->form_validation->set_rules('DES_PRODUK', 'DES_PRODUK', 'required'); // $this->form_validation->set_rules('grosir[]', 'grosir', 'required'); if ($this->input->post('HARGA') == 0) { $grosir = $this->input->post('grosir'); $banyak = count($this->input->post('grosir')); $all = ""; for ($i = 0; $i < $banyak; $i++) { $all .= $grosir[$i] . "-"; $i = $i + 1; $all .= $grosir[$i] . "-"; $i = $i + 1; $all .= $grosir[$i] . "|"; } $harga = $all; $sts = '1'; } else { $harga = $this->input->post('HARGA'); $sts = '0'; } if ($this->form_validation->run() == FALSE) { $this->session->set_flashdata('notif', validation_errors()); $this->session->set_flashdata('a', $harga); $this->session->set_flashdata('clr', 'danger'); redirect('ukm_produk/ubahProduk/' . $this->input->post('ID_PRODUK')); } $data = array('NM_PRODUK' => $this->input->post('NM_PRODUK'), 'ID_KATEGORI' => $this->input->post('ID_KATEGORI'), 'ID_SUB_KATEGORI' => $this->input->post('ID_SUB_KATEGORI'), 'HARGA' => $harga, 'BERAT_PRODUK' => $this->input->post('BERAT_PRODUK'), 'MIN_PESAN' => $this->input->post('MIN_PESAN'), 'DES_PRODUK' => $this->input->post('DES_PRODUK'), 'TGL_POS' => ubahFormatTgl(tglSekarang(), 'Y-m-d'), 'WKT_POS' => wktSekarang(), 'DES_META' => $this->input->post('DES_META'), 'KEY_META' => $this->input->post('KEY_META'), 'STS_GROSIR' => $sts); $where = array('ID_PRODUK' => $this->input->post('ID_PRODUK')); $update = $this->proukm->editData($data, 'mp_produk', $where); if ($update) { $this->session->set_flashdata('notif', 'Produk berhasil diubah'); $this->session->set_flashdata('clr', 'success'); redirect('ukm_produk/ubahProduk/' . $this->input->post('ID_PRODUK')); } else { $this->session->set_flashdata('notif', 'maaf data tidak bisa diubah ulangi lagi'); $this->session->set_flashdata('clr', 'warning'); redirect('ukm_produk/ubahProduk/' . $this->input->post('ID_PRODUK')); } }
public function checkout_cart() { $akun = $this->session->userdata("id_akun_user"); $tmp_cart = $this->producthomemodel->tampilData('mp_temp_cart', '*, HARGA@ as HARGA_SATUAN', array('ID_AKUN' => $akun), FALSE, NULL, NULL, 'ID_ONGKIR'); $last_ong = 0; $new_ong = 0; foreach ($tmp_cart as $cart) { if ($cart->ID_ONGKIR != $last_ong) { $tmp_ong = $this->producthomemodel->tampilData('mp_temp_ongkir', NULL, array('ID_ONGKIR' => $cart->ID_ONGKIR), TRUE); $data_ong = array('NAMA_KURIR' => $tmp_ong->NAMA_KURIR, 'PAKET_YANG_DIAMBIL' => $tmp_ong->PAKET_YANG_DIAMBIL, 'TOTAL' => $tmp_ong->TOTAL, 'TOTAL_REALISASI' => $tmp_ong->TOTAL); $this->producthomemodel->tambahData($data_ong, 'mp_ongkir'); $new_ong = $this->db->insert_id(); } $data_cart = array('ID_TRANS' => $cart->ID_TRANS, 'ID_PRODUK' => $cart->ID_PRODUK, 'QTY' => $cart->QTY, 'QTY_TERSEDIA' => $cart->QTY, 'ID_ONGKIR' => $new_ong, 'ID_ALAMAT' => $cart->ID_ALAMAT, 'ID_AKUN' => $cart->ID_AKUN, 'HARGA@' => $cart->HARGA_SATUAN, 'STATUS_TERSEDIA' => $cart->STS_SEDIA, 'NAMA_PRODUK' => $cart->NAMA_PRODUK, 'BERAT_PRODUK' => $cart->BERAT_PRODUK, 'NAMA_TOKO' => $cart->NAMA_TOKO, 'ID_PJ' => $cart->ID_PJ, 'NAMA_PJ' => $cart->NAMA_PJ, 'KEUNTUNGAN_PJ' => $cart->KEUNTUNGAN_PJ, 'KEUNTUNGAN_INDOBABA' => $cart->KEUNTUNGAN_INDOBABA); $this->producthomemodel->tambahData($data_cart, 'mp_cart'); // $laris = $this->producthomemodel->tampilData('mp_cart', 'SUM(QTY) as LARIS', array('ID_PRODUK' => $cart->ID_PRODUK), TRUE); // $add_laris = array('IN_CART' => $laris->LARIS); // $this->producthomemodel->editData($add_laris, 'mp_produk', array('ID_PRODUK' => $cart->ID_PRODUK)); $last_ong = $cart->ID_ONGKIR; } foreach ($tmp_cart as $ct) { $this->producthomemodel->hapusData('mp_temp_cart', array('ID_CART' => $ct->ID_CART)); $this->producthomemodel->hapusData('mp_temp_ongkir', array('ID_ONGKIR' => $ct->ID_ONGKIR)); } $data_trans = array('ID_TRANS' => $cart->ID_TRANS, 'ID_STATUS' => 1, 'ID_AKUN' => $this->session->userdata("id_akun_user"), 'TGL_TRANS' => ubahFormatTgl(tglSekarang(), 'Y-m-d'), 'WKT_TRANS' => wktSekarang(), 'JTH_TEMPO' => date('Y-m-d', strtotime("+3 day", strtotime(tglSekarang()))), 'KODE_UNIK' => $this->session->userdata("kode_unik")); $insert = $this->producthomemodel->tambahData($data_trans, 'mp_transaksi'); if ($insert) { $this->session->set_userdata('waktu', ''); $this->session->set_userdata('kode_unik', ''); redirect('user_checkout/detailcheckout/' . $this->db->insert_id()); } }