Esempio n. 1
0
 public function proses($idquotationsales = null)
 {
     $setting_model = new Setting_model();
     //        /$transaksi_model = new Transaksi_model();
     $this->orm->debug = true;
     $data = array();
     $data['idquotationsales'] = $idquotationsales == null ? $setting_model->_getMaxId('idquotationsales', 'quotationsales') : $idquotationsales;
     $data['nomor'] = $this->input->post('nomor', true);
     $data['dibuat_oleh'] = $this->input->post('dibuat_oleh', true);
     $data['tanggal'] = Tanggal::sqlDate($this->input->post('tanggal', true));
     $data['idpelanggan'] = $this->input->post('idpelanggan', true);
     $data['idrefjenispembayaran'] = $this->input->post('idrefjenispembayaran', true);
     $data['status'] = 'KIRIM';
     $data['insertby'] = $_SESSION['user']['email'];
     $data['idrefstore'] = $_SESSION['user']['idrefstore'];
     if ($idquotationsales == null) {
         $data['idrefstatus'] = 1;
         $idquotationsales = $data['idquotationsales'];
         $quotation = $this->orm->quotationsales();
         $ress = $quotation->insert($data);
         Message::_set(isset($ress['idquotationsales']) ? TRUE : FALSE, 'Proses Pemesanan Berhasil', 'Proses Pemesanan Barang Gagal');
         $redirect = 'quotation/quotation/index/true/' . $idquotationsales;
         $this->orm->quotationsalesdetail->where('idquotationsales', $idquotationsales)->delete();
         $idRefBarang = $this->input->post('idrefbarang');
         $jumlahBarang = $this->input->post('jumlahbarang');
         $keterangan = $this->input->post('keterangan');
         $hargasatuan = $this->input->post('hargasatuan');
         foreach ($idRefBarang as $key => $value) {
             $dataDetilBarang = array();
             $dataDetilBarang['idquotationsalesdetail'] = $setting_model->_getMaxId('idquotationsalesdetail', 'quotationsalesdetail');
             $dataDetilBarang['idquotationsales'] = $idquotationsales;
             $dataDetilBarang['idrefbarang'] = $idRefBarang[$key];
             $dataDetilBarang['jumlahbarang'] = $jumlahBarang[$key];
             $dataDetilBarang['keterangan'] = $keterangan[$key];
             $dataDetilBarang['hargasatuan'] = $hargasatuan[$key];
             $barang = $this->refbarang->findById($idRefBarang[$key]);
             $dataDetilBarang['namabarangtext'] = $barang[0]->namabarang . " - " . $barang[0]->alias . "Range Harga : {$barang[0]->harga_min} - {$barang[0]->harga_min}";
             if ($dataDetilBarang['idrefbarang'] != 0) {
                 $result = $this->orm->quotationsalesdetail->insert($dataDetilBarang);
             }
         }
     } else {
         //$data['idrefstatus'] = 2;
         //$quotation = $this->orm->quotationsales->where('idquotationsales', $idquotationsales);
         //$ress = $quotation->update($data);
         //$dataQuotation = $this->quotationsales->findById($idquotationsales);
         $dataUpdateQuotation = array('idrefstatus' => 2);
         $this->quotationsales->update($idquotationsales, $dataUpdateQuotation);
         Message::_set($idquotationsales != null ? TRUE : FALSE, 'Edit Data Quotation Berhasil', 'Edit Data Quotation Gagal');
         $redirect = 'quotation/quotation';
     }
     //$transaksi_model->batalBarangKeluar($idquotationsales);
     // proses barang keluar dipindah ke Purchase
     redirect($redirect);
 }
Esempio n. 2
0
 public function proses($idpengadaan = null)
 {
     Account::_valLogin();
     $setting_model = new Setting_model();
     $transaksi_model = new Transaksi_model();
     $this->orm->debug = true;
     $data = array();
     $data['idpengadaan'] = $idpengadaan == null ? $setting_model->_getMaxId('idpengadaan', 'pengadaan') : $idpengadaan;
     $data['nomorpengadaan'] = $this->input->post('nomorpengadaan', true);
     $data['tanggalpengadaan'] = Tanggal::sqlDate($this->input->post('tanggalpengadaan', true));
     $data['nomorreff'] = $this->input->post('nomorreff', true);
     $data['idsupplier'] = $this->input->post('idsupplier', true);
     $data['insertby'] = $_SESSION['user']['email'];
     $data['idrefstore'] = $_SESSION['user']['idrefstore'];
     $data['flag_app'] = "WEB";
     if ($idpengadaan == null) {
         $idpengadaan = $data['idpengadaan'];
         $pengadaan = $this->orm->pengadaan();
         $ress = $pengadaan->insert($data);
         Message::_set(isset($ress['idpengadaan']) ? TRUE : FALSE, 'Tambah Data Barang Berhasil', 'Tambah Data Barang Gagal');
         $redirect = 'transaksi/pengadaan';
     } else {
         $pengadaan = $this->orm->pengadaan->where('idpengadaan', $idpengadaan);
         $ress = $pengadaan->update($data);
         Message::_set($idpengadaan != null ? TRUE : FALSE, 'Edit Data Barang Berhasil', 'Edit Data Barang Gagal');
         $redirect = 'transaksi/pengadaan/edit/' . $idpengadaan;
     }
     $this->orm->pengadaandetail->where('idpengadaan', $idpengadaan)->delete();
     $this->orm->transaksibarang->where('idpengadaan', $idpengadaan)->delete();
     $idRefBarang = $this->input->post('idrefbarang');
     $idRefGudang = $this->input->post('idrefgudang');
     $jumlahBarang = $this->input->post('jumlahbarang');
     $keterangan = $this->input->post('keterangan');
     foreach ($idRefBarang as $key => $value) {
         $dataDetilBarang = array();
         $dataDetilBarang['idpengadaandetail'] = $setting_model->_getMaxId('idpengadaandetail', 'pengadaandetail');
         $dataDetilBarang['idpengadaan'] = $idpengadaan;
         $dataDetilBarang['idrefbarang'] = $idRefBarang[$key];
         $dataDetilBarang['idrefgudang'] = $idRefGudang[$key];
         $dataDetilBarang['jumlahbarang'] = $jumlahBarang[$key];
         $dataDetilBarang['keterangan'] = $keterangan[$key];
         if ($dataDetilBarang['idrefbarang'] != 0) {
             $result = $this->orm->pengadaandetail->insert($dataDetilBarang);
             $idPengadaanDetail = $result['idpengadaandetail'];
             $dataTransaksiBarang = array();
             $dataTransaksiBarang['idtransaksibarang'] = $setting_model->_getMaxId('idtransaksibarang', 'transaksibarang');
             $dataTransaksiBarang['transaksi'] = 'TERIMA';
             $dataTransaksiBarang['tanggaltransaksi'] = Tanggal::sqlDate($this->input->post('tanggalpengadaan'));
             $dataTransaksiBarang['idpengadaandetail'] = $idPengadaanDetail;
             $dataTransaksiBarang['iddeliveryorderdetail'] = 0;
             $dataTransaksiBarang['idpengadaan'] = $idpengadaan;
             $this->orm->transaksibarang->insert($dataTransaksiBarang);
         }
     }
     $transaksi_model->proccessBarangMasuk($idpengadaan);
     redirect($redirect);
 }
Esempio n. 3
0
 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>";
     }
 }
Esempio n. 4
0
 public function update()
 {
     Account::_valLogin();
     $setting_model = new Setting_model();
     //$this->orm->debug = true;
     $data = array();
     $data['iddeliveryorder'] = $this->input->post('iddeliveryorder', true);
     $data['nomordo'] = $this->input->post('nomordo', true);
     $data['tanggaldo'] = $this->input->post('tanggaldo', true);
     $data['disetujui'] = $this->input->post('disetujui', true);
     $data['idpelanggan'] = $this->input->post('idpelanggan', true);
     $data['status'] = 'PROSES';
     $data['insertby'] = $_SESSION['user']['email'];
     $data['idrefstore'] = $_SESSION['user']['idrefstore'];
     $data['flag_app'] = "WEB";
     $this->orm->deliveryorderdetail->where('iddeliveryorder', $data['iddeliveryorder'])->delete();
     $this->orm->deliveryorder->where('iddeliveryorder', $data['iddeliveryorder'])->delete();
     $iddeliveryorder = $data['iddeliveryorder'];
     $deliveryorder = $this->orm->deliveryorder();
     $ress = $deliveryorder->insert($data);
     $idRefBarang = $this->input->post('idrefbarang');
     $jumlahBarang = $this->input->post('jumlahbarang');
     $keterangan = $this->input->post('keterangan');
     $idpackaging = $this->input->post('idpackaging');
     $expired_date = $this->input->post('expired_date', true);
     //  if($idRefBarang){
     foreach ($idRefBarang as $key => $value) {
         $dataDetilBarang = array();
         $dataDetilBarang['iddeliveryorderdetail'] = $setting_model->_getMaxId('iddeliveryorderdetail', 'deliveryorderdetail');
         $dataDetilBarang['iddeliveryorder'] = $iddeliveryorder;
         $dataDetilBarang['idrefbarang'] = $idRefBarang[$key];
         $dataDetilBarang['idpackaging'] = $idpackaging[$key];
         @($dataDetilBarang['expired_date'] = $expired_date[$key]);
         $dataDetilBarang['jumlahbarang'] = $jumlahBarang[$key];
         $dataDetilBarang['keterangan'] = $keterangan[$key];
         // if ($dataDetilBarang['idrefbarang'] != 0) {
         $result = $this->orm->deliveryorderdetail->insert($dataDetilBarang);
         $iddeliveryorderdetail = $result['iddeliveryorderdetail'];
         $dataTransaksiBarang = array();
         $dataTransaksiBarang['idtransaksibarang'] = $setting_model->_getMaxId('idtransaksibarang', 'transaksibarang');
         $dataTransaksiBarang['transaksi'] = 'KIRIM';
         @($dataTransaksiBarang['tanggaltransaksi'] = $this->input->post('tanggaldo'));
         $dataTransaksiBarang['idpengadaanDetail'] = 0;
         $dataTransaksiBarang['iddeliveryorderdetail'] = $iddeliveryorderdetail;
         $dataTransaksiBarang['iddeliveryorder'] = $iddeliveryorder;
         $this->orm->transaksibarang->insert($dataTransaksiBarang);
         // }
         // }
     }
     $idPackage = $this->input->post('idpackage');
     foreach ($idPackage as $key => $row) {
         foreach ($this->orm->packagedetail->where('idpackage', $row) as $row_detail) {
             $refbarang = $this->orm->refbarang->where('idrefbarang', $row_detail['idrefbarang'])->fetch();
             $dataDetilBarang = array();
             $dataDetilBarang['iddeliveryorderdetail'] = $setting_model->_getMaxId('iddeliveryorderdetail', 'deliveryorderdetail');
             $dataDetilBarang['iddeliveryorder'] = $iddeliveryorder;
             $dataDetilBarang['idrefbarang'] = $refbarang['idrefbarang'];
             $dataDetilBarang['idpackaging'] = $refbarang['idpackaging'];
             $dataDetilBarang['jumlahbarang'] = $row_detail['jumlahbarang'];
             $dataDetilBarang['keterangan'] = $row_detail['keterangan'];
             if ($dataDetilBarang['idrefbarang'] != 0) {
                 $result = $this->orm->deliveryorderdetail->insert($dataDetilBarang);
                 $iddeliveryorderdetail = $result['iddeliveryorderdetail'];
                 $dataTransaksiBarang = array();
                 $dataTransaksiBarang['idtransaksibarang'] = $setting_model->_getMaxId('idtransaksibarang', 'transaksibarang');
                 $dataTransaksiBarang['transaksi'] = 'KIRIM';
                 @($dataTransaksiBarang['tanggaltransaksi'] = $this->input->post('tanggaldo'));
                 $dataTransaksiBarang['idpengadaanDetail'] = 0;
                 $dataTransaksiBarang['iddeliveryorderdetail'] = $iddeliveryorderdetail;
                 $dataTransaksiBarang['iddeliveryorder'] = $iddeliveryorder;
                 $this->orm->transaksibarang->insert($dataTransaksiBarang);
             }
         }
     }
     echo json_encode(array('response' => 'success', 'msg' => 'Update DO Berhasil'));
 }
Esempio n. 5
0
 public function pengadaan($sharingproduct)
 {
     $this->load->model('transaksi/transaksi_model');
     $transaksi_model = new Transaksi_model();
     $setting_model = new Setting_model();
     $data = array();
     $data['idpengadaan'] = $setting_model->_getMaxId('idpengadaan', 'pengadaan');
     $data['nomorpengadaan'] = 'SP' . $sharingproduct['idrefstore_pengirim'] . '-' . $sharingproduct['idsharingproduct'];
     $data['tanggalpengadaan'] = date('Y-m-d');
     $data['idsupplier'] = $this->checkSupplier($sharingproduct['idrefstore_pengirim']);
     // function check data store pengirim di supplier
     $data['insertby'] = $_SESSION['user']['email'];
     $data['idrefstore'] = $sharingproduct['idrefstore_pengirim'];
     $data['flag_app'] = "WEB";
     $idpengadaan = $data['idpengadaan'];
     $pengadaan = $this->orm->pengadaan();
     $ress = $pengadaan->insert($data);
     $this->orm->pengadaandetail->where('idpengadaan', $idpengadaan)->delete();
     $this->orm->transaksibarang->where('idpengadaan', $idpengadaan)->delete();
     $dataDetilBarang = array();
     $dataDetilBarang['idpengadaandetail'] = $setting_model->_getMaxId('idpengadaandetail', 'pengadaandetail');
     $dataDetilBarang['idpengadaan'] = $idpengadaan;
     $dataDetilBarang['idrefbarang'] = $sharingproduct['idrefbarang'];
     $dataDetilBarang['jumlahbarang'] = $sharingproduct['jumlah_barang'];
     if ($dataDetilBarang['idrefbarang'] != 0) {
         $result = $this->orm->pengadaandetail->insert($dataDetilBarang);
         $idPengadaanDetail = $result['idpengadaandetail'];
         $dataTransaksiBarang = array();
         $dataTransaksiBarang['idtransaksibarang'] = $setting_model->_getMaxId('idtransaksibarang', 'transaksibarang');
         $dataTransaksiBarang['transaksi'] = 'TERIMA';
         $dataTransaksiBarang['tanggaltransaksi'] = date('Y-m-d');
         $dataTransaksiBarang['idpengadaandetail'] = $idPengadaanDetail;
         $dataTransaksiBarang['iddeliveryorderdetail'] = 0;
         $dataTransaksiBarang['idpengadaan'] = $idpengadaan;
         $this->orm->transaksibarang->insert($dataTransaksiBarang);
     }
     $transaksi_model->proccessBarangMasuk($idpengadaan);
 }