public function proses() { $idpelanggan = $this->input->post('idpelanggan'); $setting_model = new Setting_model(); $data = array(); $data['idpelanggan'] = $idpelanggan == null ? $setting_model->_getId('pelanggan') : $idpelanggan; $data['namapelanggan'] = $this->input->post('namapelanggan', true); //Post datanya lengkapin $data['nomorhppelanggan'] = $this->input->post('nomorhppelanggan', true); $data['emailpelanggan'] = $this->input->post('emailpelanggan', true); $data['alamatpelanggan'] = $this->input->post('alamatpelanggan', true); $data['kotapelanggan'] = $this->input->post('kotapelanggan', true); $data['jenispelanggan'] = $this->input->post('jenispelanggan', true); $data['keterangan'] = $this->input->post('keterangan', true); if ($idpelanggan == null) { $pelanggan = $this->orm->pelanggan(); $ress = $pelanggan->insert($data); $result = $ress == TRUE ? array('response' => 'success', 'msg' => 'Tambah Data Pelanggan Berhasil') : array('response' => 'error', 'msg' => 'Maav Tambah Data Pelanggan Gagal'); echo json_encode($result); } else { $pelanggan = $this->orm->pelanggan->where('idpelanggan', $idpelanggan); $ress = $pelanggan->update($data); $result = $ress == TRUE ? array('response' => 'success', 'msg' => 'Edit Data Pelanggan Berhasil') : array('response' => 'error', 'msg' => 'Maav Edit Data Pelanggan Gagal'); echo json_encode($result); } }
public function proses() { $setting_model = new Setting_model(); $idrefgudang = $this->input->post('idrefgudang', true); $data = array(); $data['idrefgudang'] = $idrefgudang == null ? $setting_model->_getId('refgudang') : $idrefgudang; $data['nomorgudang'] = $this->input->post('nomorgudang', true); $data['namagudang'] = $this->input->post('namagudang', true); $data['kapasitas'] = $this->input->post('kapasitas', true); if ($idrefgudang == null) { $refgudang = $this->orm->refgudang(); $ress = $refgudang->insert($data); if ($ress) { echo json_encode(array('response' => 'success', 'msg' => 'Tambah Data Gudang Berhasil')); } else { echo json_encode(array('response' => 'error', 'msg' => 'Tambah Data Gudang Gagal')); } } else { $refgudang = $this->orm->refgudang->where('idrefgudang', $idrefgudang); $ress = $refgudang->update($data); if ($ress) { echo json_encode(array('response' => 'success', 'msg' => 'Edit Data Gudang Berhasil')); } else { echo json_encode(array('response' => 'error', 'msg' => 'Tambah Data Gudang Gagal')); } } }
public function proses() { $idsupplier = $this->input->post('idsupplier'); $setting_model = new Setting_model(); $data = array(); $data['idsupplier'] = $idsupplier == null ? $setting_model->_getId('supplier') : $idsupplier; $data['namasupplier'] = $this->input->post('namasupplier', true); $data['nomorhpsupplier'] = $this->input->post('nomorhpsupplier', true); $data['emailsupplier'] = $this->input->post('emailsupplier', true); $data['alamatsupplier'] = $this->input->post('alamatsupplier', true); $data['kotasupplier'] = $this->input->post('kotasupplier', true); $data['jenissupplier'] = $this->input->post('jenissupplier', true); $data['keterangan'] = $this->input->post('keterangan', true); if ($idsupplier == null) { $supplier = $this->orm->supplier(); $ress = $supplier->insert($data); $result = $ress == TRUE ? array('response' => 'success', 'msg' => 'Tambah Data Supplier Berhasil') : array('response' => 'error', 'msg' => 'Maav Tambah Data Supplier Gagal'); echo json_encode($result); } else { $supplier = $this->orm->supplier->where('idsupplier', $idsupplier); $ress = $supplier->update($data); $result = $ress == TRUE ? array('response' => 'success', 'msg' => 'Edit Data Supplier Berhasil') : array('response' => 'error', 'msg' => 'Maav Edit Data Supplier Gagal'); echo json_encode($result); } }
public function proses() { $setting_model = new Setting_model(); $idrefjenisbarang = $this->input->post('idrefjenisbarang', true); if ($idrefjenisbarang == '' or $idrefjenisbarang == null) { $idrefjenisbarang = null; } $data['idrefjenisbarang'] = $idrefjenisbarang == null ? $setting_model->_getId('refjenisbarang') : $idrefjenisbarang; $data['jenisbarang'] = $this->input->post('jenisbarang', true); $parent = $this->input->post('parent', true); $data['parent'] = $parent == '' ? null : $parent; if ($idrefjenisbarang) { $refjenisbarang = $this->orm->refjenisbarang->where('idrefjenisbarang', $idrefjenisbarang); $ress = $refjenisbarang->update($data); if ($ress) { echo json_encode(array('response' => 'success', 'msg' => 'Update Jenis barang Berhasil')); } else { echo json_encode(array('response' => 'failed', 'msg' => 'Update Jenis barang Gagal')); } } else { $refjenisbarang = $this->orm->refjenisbarang(); $ress = $refjenisbarang->insert($data); if ($ress) { echo json_encode(array('response' => 'success', 'msg' => 'Tambah Jenis Barang Berhasil')); } else { echo json_encode(array('response' => 'failed', 'msg' => 'Tambah Jenis Barang Gagal')); } } }
public function proses() { $setting_model = new Setting_model(); $idrefsatuan = $this->input->post('idrefsatuan', true); $data = array(); $data['idrefsatuan'] = $idrefsatuan == null ? $setting_model->_getId('refsatuan') : $idrefsatuan; $data['namasatuan'] = $this->input->post('namasatuan', true); $data['child'] = $this->input->post('child', true); $data['jumlah_perchild'] = $this->input->post('jumlah_perchild', true); if ($idrefsatuan == null) { $refsatuan = $this->orm->refsatuan(); $ress = $refsatuan->insert($data); if ($ress) { echo json_encode(array('response' => 'success', 'msg' => 'Tambah Data Satuan Berhasil')); } else { echo json_encode(array('response' => 'error', 'msg' => 'Tambah Data Satuan Gagal')); } } else { $refsatuan = $this->orm->refsatuan->where('idrefsatuan', $idrefsatuan); $ress = $refsatuan->update($data); if ($ress) { echo json_encode(array('response' => 'success', 'msg' => 'Edit Data Satuan Berhasil')); } else { echo json_encode(array('response' => 'error', 'msg' => 'Tambah Data Satuan Gagal')); } } }
public function proses() { $setting_model = new Setting_model(); $idrefbarang = $this->input->post('idrefbarang', true); $data = array(); $data['idrefbarang'] = $idrefbarang == null ? $setting_model->_getId('refbarang') : $idrefbarang; $data['idrefjenisbarang'] = $this->input->post('idrefjenisbarang', true); $data['idrefsatuan'] = $this->input->post('idrefsatuan', true); $data['kodebarang'] = $this->input->post('kodebarang', true); $data['namabarang'] = $this->input->post('namabarang', true); $data['harga_min'] = $this->input->post('harga_min'); $data['harga_max'] = $this->input->post('harga_max'); $data['idrefstore'] = $_SESSION['user']['idrefstore']; $config['upload_path'] = './' . PATH_IMAGES_ITEMS; $config['allowed_types'] = 'gif|jpg|jpeg|png'; $config['encrypt_name'] = TRUE; $config['remove_spaces'] = TRUE; $this->load->library('upload', $config); //print_r($_FILES); exit; $data_upload = $_FILES["image_file"]['name']; $tipe_file = $_FILES["image_file"]['type']; if (empty($data_upload)) { } else { if ($tipe_file == "image/gif" or $tipe_file == "image/jpeg" or $tipe_file == "image/pjpeg" or $tipe_file == "image/png") { if (!$this->upload->do_upload('image_file')) { $error = array('error' => $this->upload->display_errors()); $data['image_file'] = ''; } else { $upload_data = $this->upload->data(); //print_r($upload_data); exit; $data['image_file'] = $upload_data['file_name']; } } else { $data['image_file'] = ''; } } if ($idrefbarang == null) { $refbarang = $this->orm->refbarang(); $ress = $refbarang->insert($data); $result = $ress == TRUE ? array('response' => 'success', 'msg' => 'Tambah Data Barang Berhasil') : array('response' => 'error', 'msg' => 'Maav Tambah Data Barang Gagal'); // echo json_encode($result); Message::_set(TRUE, 'Tambah Data Master Barang Berhasil', 'Tambah Data Master Barang Gagal'); redirect('masterdata/masterbarang'); } else { $refbarang = $this->orm->refbarang->where('idrefbarang', $idrefbarang); $ress = $refbarang->update($data); $result = $ress == TRUE ? array('response' => 'success', 'msg' => 'Edit Data Barang Berhasil') : array('response' => 'error', 'msg' => 'Maav Edit Data Barang Gagal'); // echo json_encode($result); Message::_set(TRUE, 'Edit Data Master Barang Berhasil', 'Edit Data Master Barang Gagal'); redirect('masterdata/masterbarang'); } }
public function proses() { $setting_model = new Setting_model(); $data = array(); $data['idsharingproduct'] = $setting_model->_getId('sharingproduct'); $data['idrefbarang'] = $this->input->post('idrefbarang'); $data['jumlah_barang'] = $this->input->post('jumlah_barang'); $data['idrefstore_pengirim'] = $_SESSION['user']['idrefstore']; $data['idrefstore_penerima'] = $this->input->post('idrefstore_penerima'); $data['status_konfirmasi'] = 'N'; $data['tanggal_kirim'] = Tanggal::sqlDate($this->input->post('tanggal_kirim')); $sharingproduct = $this->orm->sharingproduct(); $ress = $sharingproduct->insert($data); Message::_set(isset($ress['idsharingproduct']) ? TRUE : FALSE, 'Berhasil', 'Gagal'); redirect('sharing/sharing'); }
public function proses() { $setting_model = new Setting_model(); $idpackaging = $this->input->post('idpackaging', TRUE); $data = array(); $data['idpackaging'] = $idpackaging == null ? $setting_model->_getId('packaging') : $idpackaging; $data['nama'] = $this->input->post('nama', true); if ($idpackaging == null) { $packaging = $this->orm->packaging(); $ress = $packaging->insert($data); $result = $ress == TRUE ? array('response' => 'success', 'msg' => 'Tambah Data Pengemasan Berhasil') : array('response' => 'error', 'msg' => 'Maav Tambah Data Pengemasan Gagal'); echo json_encode($result); } else { $packaging = $this->orm->packaging->where('idpackaging', $idpackaging); $ress = $packaging->update($data); $result = $ress == TRUE ? array('response' => 'success', 'msg' => 'Edit Data Pengemasan Berhasil') : array('response' => 'error', 'msg' => 'Maav Edit Data Pengemasan Gagal'); echo json_encode($result); } }
public function proses() { $setting_model = new Setting_model(); $idrefgudang = $this->input->post('idrefgudang', true); $data = array(); $data['idrefgudang'] = $idrefgudang == null ? $setting_model->_getId('refgudang') : $idrefgudang; $data['nomorgudang'] = $this->input->post('nomorgudang', true); $data['namagudang'] = $this->input->post('namagudang', true); $data['kapasitas'] = $this->input->post('kapasitas', true); if ($idrefgudang == null) { $refgudang = $this->orm->refgudang(); $ress = $refgudang->insert($data); Message::_set($ress, 'Hapus Data Pelanggan Berhasil', 'Hapus Data Master Pelanggan Gagal'); redirect('masterdata/mastergudang'); } else { $refgudang = $this->orm->refgudang->where('idrefgudang', $idrefgudang); $ress = $refgudang->update($data); Message::_set($ress, 'Hapus Data Pelanggan Berhasil', 'Hapus Data Master Pelanggan Gagal'); redirect('masterdata/mastergudang'); } }
public function proses($idpackage = null) { $setting_model = new Setting_model(); $data = array(); $data['idpackage'] = $idpackage == null ? $setting_model->_getId('package') : $idpackage; $data['namapackage'] = $this->input->post('namapackage', true); $data['keterangan'] = $this->input->post('keterangan', true); $data['idrefstore'] = $_SESSION['user']['idrefstore']; if ($idpackage == null) { $package = $this->orm->package(); $ress = $package->insert($data); $idpackage = $ress['idpackage']; Message::_set(isset($ress['idpackage']) ? TRUE : FALSE, 'Tambah Data Package Berhasil', 'Tambah Data Barang Gagal'); } else { $package = $this->orm->package->where('idpackage', $idpackage); $ress = $package->update($data); Message::_set($idpackage != null ? TRUE : FALSE, 'Edit Data Barang Berhasil', 'Edit Data Barang Gagal'); } $this->orm->packagedetail->where('idpackage', $idpackage)->delete(); $idRefBarang = $this->input->post('idrefbarang'); $jumlahBarang = $this->input->post('jumlahbarang'); $keterangan = $this->input->post('keterangan_barang'); foreach ($idRefBarang as $key => $value) { $dataDetilBarang = array(); $dataDetilBarang['idpackagedetail'] = $setting_model->_getMaxId('idpackagedetail', 'packagedetail'); $dataDetilBarang['idpackage'] = $idpackage; $dataDetilBarang['idrefbarang'] = $idRefBarang[$key]; $dataDetilBarang['jumlahbarang'] = $jumlahBarang[$key]; $dataDetilBarang['keterangan'] = $keterangan[$key]; if ($dataDetilBarang['idrefbarang'] != 0) { $result = $this->orm->packagedetail->insert($dataDetilBarang); } } if ($idpackage == null) { redirect('package/master_package'); } else { echo '<script src=' . base_url() . 'front_assets/library/gb/greybox.js"></script>' . "<script>parent.GB_hide();</script>"; } }
public function checkSupplier($idrefstore) { $setting_model = new Setting_model(); $refstore = $this->orm->refstore->where('idrefstore', $idrefstore)->fetch(); $supplier = $this->orm->supplier->where('emailsupplier', $refstore['email']); if (COUNT($supplier) == 0) { $data = array(); $data['idsupplier'] = $setting_model->_getId('supplier'); $data['namasupplier'] = $refstore['nama']; $data['nomorhpsupplier'] = $refstore['tlp']; $data['emailsupplier'] = $refstore['email']; $data['alamatsupplier'] = $refstore['lokasi']; $data['jenissupplier'] = 'Bizon Partner'; $data['keterangan'] = 'Partner Sharing Product'; $new_supplier = $this->orm->supplier->insert($data); } else { $new_supplier = $supplier->fetch(); } return $new_supplier['idsupplier']; }