Example #1
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);
 }
Example #2
0
 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'));
     }
 }
Example #3
0
 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());
     }
 }