예제 #1
0
 public function tambah_stok()
 {
     $param = $this->input->post();
     $user = $this->session->userdata('astrosession');
     $this->load->library('form_validation');
     $this->form_validation->set_rules('product_code', 'Produk', 'trim|required|xss_clean');
     $this->form_validation->set_rules('in', 'Qty', 'trim|required|xss_clean');
     if ($this->form_validation->run() == FALSE) {
         echo "0|" . warn_msg(validation_errors());
     } else {
         $produk = $this->mp->get_detail_product($param['product_code']);
         $param['date'] = date('Y-m-d');
         $param['status'] = 'input';
         $param['reference'] = '';
         $param['out'] = 0;
         $param['description'] = 'Penambahan Stok' . $produk['name'];
         $param['userlog'] = date('Y-m-d H:i:s');
         $param['operator'] = $user[0]->uname;
         $param['rak_code'] = $produk['gudang_code'];
         $save = $this->mp->write('atombizz_warehouses_stok', $param);
         if ($save == TRUE) {
             echo "1|" . succ_msg("Stok Produk berhasil ditambahkan.");
         } else {
             echo "0|" . err_msg("Gagal menambahkan stok produk, periksa kembali masukan Anda");
         }
     }
 }
예제 #2
0
 public function proses_claim()
 {
     $param = $this->input->post();
     $config = $this->config->item('astro');
     $operator = $this->session->userdata('astrosession');
     $this->load->library('form_validation');
     $this->form_validation->set_rules('tgl_awal', 'Tgl Awal', 'trim|required|xss_clean');
     $this->form_validation->set_rules('tgl_akhir', 'Tgl Akhir', 'trim|required|xss_clean');
     if ($this->form_validation->run() == FALSE) {
         echo "0|" . warn_msg(validation_errors());
     } else {
         if ($param['bank'] != 'all' && $param['bank'] != '') {
             $where2 = 'AND note =' . $this->mr->protect($param['bank']);
         } else {
             $where2 = '';
         }
         $where = "date BETWEEN " . $this->mr->protect($param['tgl_awal']) . " AND " . $this->mr->protect($param['tgl_akhir']);
         $replace = $this->mr->replace('penjualan', array('debet-claimed' => 'yes'), $where);
         if ($replace) {
             echo '1|' . succ_msg('Berhasil merubah status pembayaran debet');
         } else {
             echo '1|' . err_msg('Gagal, melakukan perubahan');
         }
     }
 }
예제 #3
0
 public function delete($value = '')
 {
     $param = $this->input->post();
     $delete = $this->mb->delete('atombizz_inventaris', array('id' => $param['id']));
     if ($delete) {
         echo '1|' . succ_msg('Berhasil menghapus data.');
     } else {
         echo '0|' . err_msg('Gagal menghapus data.');
     }
 }
예제 #4
0
 public function kirim_barang()
 {
     $param = $this->input->post();
     $replace = $this->mp->replace('atombizz_selling', array('status_pengiriman' => '1'), array('id' => $param['id']));
     if ($replace) {
         echo '1|' . succ_msg('Berhasil merubah status pengiriman barang.');
     } else {
         echo '0|' . err_msg('Gagal merubah data.');
     }
 }
예제 #5
0
 public function delete()
 {
     $id = $this->input->post('id');
     $where = array('id' => $id);
     $delete = $this->mb->delete('atombizz_brand_converter', $where);
     if ($delete) {
         echo "1|" . succ_msg("Master Konversi berhasil dihapus.");
     } else {
         echo "0|" . err_msg("Gagal, coba periksa lagi inputan anda.");
     }
 }
예제 #6
0
 public function checkin_guest()
 {
     $param = $this->input->post();
     $data = array('room_number' => $param['cek_room'], 'status' => 'checkin');
     $where = array('id' => $param['cek_id']);
     $update = $this->mr->replace('atombizz_tmp_use_facilities', $data, $where);
     if ($update) {
         echo succ_msg('Pelanggan berhasil cek in.');
     } else {
         echo err_msg('Pelanggan tidak dapat cek in.');
     }
 }
예제 #7
0
 public function save()
 {
     $user = $this->session->userdata('astrosession');
     $config = $this->config->item('astro');
     $param = $this->input->post();
     $masuk = $keluar = 0;
     if ($param['status'] == 'in') {
         $masuk = $param['qty'];
     } else {
         $keluar = $param['qty'];
     }
     $stok = array('date' => date('Y-m-d'), 'status' => $param['status'], 'in' => $masuk, 'out' => $keluar, 'description' => $param['keterangan'], 'userlog' => date('Y-m-d H:i:s'), 'operator' => $user[0]->uname, 'product_code' => $param['product_code'], 'dept' => $config['bas_code_dept']);
     $save = $this->mi->write('atombizz_inventaris_stok', $stok);
     if ($save) {
         echo '1|' . succ_msg('Berhasil menyimpan pencatatan stok barang.');
     } else {
         echo '0|' . err_msg('Gagal menyimpan pencatatan stok barang.');
     }
 }
예제 #8
0
 public function delete()
 {
     $id = $this->input->post('id');
     $where = array('id' => $id);
     $delete = $this->msp->delete('atombizz_suppliers', $where);
     if ($delete == TRUE) {
         echo "1|" . succ_msg("Suplier berhasil dihapus.");
     } else {
         echo "0|" . err_msg("Gagal, coba periksa lagi inputan anda.");
     }
 }
예제 #9
0
 public function proses_retur_in()
 {
     $basmalah = $this->config->item('astro');
     $userlog = date('Y-m-d H:i:s');
     $param = $this->input->post();
     $reference = $this->input->post('reference');
     $where = array('reference' => $reference);
     $keterangan = 'Retur Masuk dengan referensi no ' . $reference;
     $data = $this->mp->find('atombizz_retur_internal_tmp', $where);
     $nominal_retur_in = 0;
     foreach ($data->result_array() as $das) {
         $arr_detail[] = array('reference' => $reference, 'product_id' => $das['product_id'], 'product_code' => $das['product_code'], 'product_name' => $das['product_name'], 'quantity' => $das['quantity'], 'hpp' => $das['hpp']);
         $nominal_retur_in += $das['sub_total'];
         $arr_stok[] = array('date' => $param['date'], 'status' => 'retur in', 'reference' => $reference, 'in' => $das['quantity'], 'out' => 0, 'description' => $keterangan, 'userlog' => $userlog, 'operator' => $param['operator'], 'rak_code' => 'retur', 'product_code' => $das['product_code'], 'dept' => $basmalah['bas_code_dept']);
     }
     $arr_retur_in = array('reference' => $reference, 'date' => $param['date'], 'operator' => $param['operator'], 'total' => $param['total_akhir'], 'urut' => $param['urut'], 'dept' => $basmalah['bas_code_dept'], 'userlog' => $userlog);
     $save_items = $this->mp->write_batch('atombizz_retur_internal_detail', $arr_detail);
     if ($save_items == TRUE) {
         $save_stok = $this->mp->write_batch('atombizz_warehouses_stok', $arr_stok);
         if ($save_stok == TRUE) {
             $save_beli = $this->mp->write('atombizz_retur_internal', $arr_retur_in);
             // echo $this->db->last_query();exit;
             if ($save_beli == TRUE) {
                 $where = array('reference' => $reference);
                 $delete = $this->mp->delete('atombizz_retur_internal_tmp', $where);
                 if ($delete > 0) {
                     echo "1|" . succ_msg("Berhasil menambahkan data retur internal.");
                 }
             } else {
                 echo "0|" . err_msg("Gagal menambahkan data retur internal.");
             }
         } else {
             echo "0|" . err_msg("Gagal mengurangi data stok produk.");
         }
     } else {
         echo "0|" . err_msg("Gagal menambahkan data retur internal detail.");
     }
 }
예제 #10
0
 public function proses_pembelian()
 {
     $param = $this->input->post();
     $this->load->library('form_validation');
     if ($param['cara'] == 'credit') {
         $this->form_validation->set_rules('jatuh_tempo', 'Jatuh Tempo', 'trim|required|xss_clean');
     } else {
         $this->form_validation->set_rules('jatuh_tempo', 'Jatuh Tempo', 'trim|xss_clean');
     }
     if ($this->form_validation->run() == FALSE) {
         //tidak memenuhi validasi
         echo "0|" . warn_msg(validation_errors());
     } else {
         $basmalah = $this->config->item('astro');
         $userlog = date('Y-m-d H:i:s');
         $reference = $param['reference_no'];
         $where = array('reference_no' => $reference);
         $keterangan = 'Pembelian dengan referensi no ' . $reference;
         $data = $this->mp->find('atombizz_tmp_detail_purchases', $where);
         foreach ($data->result_array() as $das) {
             $total = $das['sub_total'] - $das['sub_total'] * $param['disc_reg_1'] / 100;
             $arr_detail[] = array('reference_no' => $reference, 'product_id' => $das['product_id'], 'product_code' => $das['product_code'], 'product_name' => $das['product_name'], 'quantity' => $das['quantity'], 'unit_price' => $das['unit_price'], 'gross_total' => $total, 'disc_reg' => $param['disc_reg_1'], 'unit' => $das['unit'], 'brand_code' => $das['brand_code']);
             $qty = $das['quantity'];
             $unit = $das['unit'];
             //brand konversi stok
             if ($das['brand_code'] != '') {
                 $query = $this->mp->find('atombizz_brand_converter', array('product_code' => $das['product_code'], 'code' => $das['brand_code']));
                 $konv_brand = $query->row();
                 $qty = $das['quantity'] * $konv_brand->qty_convertion;
                 $unit = $konv_brand->satuan_convertion;
             }
             //konversi satuan terkecil
             $konv_unit = unit_converter($qty, $unit);
             $data_konv = json_decode($konv_unit);
             $qty = $data_konv->qty;
             $unit = $data_konv->satuan;
             $hpp = $das['sub_total'] / $qty;
             $arr_stok[] = array('date' => $param['date'], 'status' => 'pembelian', 'reference' => $reference, 'in' => $qty, 'out' => 0, 'description' => $keterangan, 'userlog' => $userlog, 'operator' => $param['operator'], 'rak_code' => $das['warehouse_id'], 'product_code' => $das['product_code'], 'dept' => $basmalah['bas_code_dept']);
             $arr_hpp[] = array('code' => $das['product_code'], 'cost' => $hpp);
         }
         // print_r($arr_hpp);exit;
         if ($param['cara'] == 'cash') {
             $arr_kas = array('kode' => 'PB', 'no_referensi' => $reference, 'tanggal' => $param['date'], 'keterangan' => $keterangan, 'person' => $param['supplier_code'], 'dept' => $basmalah['bas_code_dept'], 'valid' => 'yes');
             //kas
             $arr_kas['debit'] = 0;
             $arr_kas['kredit'] = $param['total'];
             $arr_kas['no_akun'] = '110000';
             $kas_acc = $this->mp->write('atombizz_accounting_buku_besar', $arr_kas);
             //potongan
             $arr_kas['debit'] = 0;
             $arr_kas['kredit'] = $param['nom_reg_1'];
             $arr_kas['no_akun'] = '340000';
             $potongan_acc = $this->mp->write('atombizz_accounting_buku_besar', $arr_kas);
             //pembelian
             $arr_kas['debit'] = $param['subtotal'];
             $arr_kas['kredit'] = 0;
             $arr_kas['no_akun'] = '130000';
             $save_acc = $this->mp->write('atombizz_accounting_buku_besar', $arr_kas);
         } else {
             if ($param['cara'] == 'credit') {
                 $htg = array('code' => $reference, 'jatuh_tempo' => $param['jatuh_tempo'], 'status' => 0);
                 $save_htg = $this->mp->write('atombizz_hutang', $htg);
                 if ($save_htg == TRUE) {
                     $arr_htg = array('kode' => 'PB', 'no_referensi' => $reference, 'tanggal' => $param['date'], 'keterangan' => $keterangan, 'person' => $param['supplier_code'], 'dept' => $basmalah['bas_code_dept'], 'valid' => 'yes');
                     //kas
                     $arr_htg['debit'] = 0;
                     $arr_htg['kredit'] = $param['dp'];
                     $arr_htg['no_akun'] = '110000';
                     $kas_acc = $this->mp->write('atombizz_accounting_buku_besar', $arr_htg);
                     //potongan
                     $arr_htg['debit'] = 0;
                     $arr_htg['kredit'] = $param['nom_reg_1'];
                     $arr_htg['no_akun'] = '340000';
                     $potongan_acc = $this->mp->write('atombizz_accounting_buku_besar', $arr_htg);
                     //pembelian
                     $arr_htg['debit'] = $param['subtotal'];
                     $arr_htg['kredit'] = 0;
                     $arr_htg['no_akun'] = '130000';
                     $pembelian_acc = $this->mp->write('atombizz_accounting_buku_besar', $arr_htg);
                     //hutang
                     $arr_htg['debit'] = 0;
                     $arr_htg['kredit'] = $param['total'] - $param['dp'];
                     $arr_htg['no_akun'] = '510000';
                     $arr_htg['faktur'] = $reference;
                     $arr_htg['kode'] = 'HTG';
                     $save_acc = $this->mp->write('atombizz_accounting_buku_besar', $arr_htg);
                 } else {
                     echo "0|" . err_msg("Error, hubungi teknisi.");
                 }
             }
         }
         if ($save_acc) {
             $save_items = $this->mp->write_batch('atombizz_purchase_items', $arr_detail);
             if ($save_items == TRUE) {
                 $save_stok = $this->mp->write_batch('atombizz_warehouses_stok', $arr_stok);
                 if ($save_stok == TRUE) {
                     $save_hpp = $this->mp->replace_batch('atombizz_product', $arr_hpp, 'code');
                     // echo $this->db->last_query();exit;
                     if ($save_hpp == TRUE) {
                         unset($param['jatuh_tempo']);
                         unset($param['cara']);
                         unset($param['dp']);
                         $param['dept'] = $basmalah['bas_code_dept'];
                         $save_beli = $this->mp->write('atombizz_purchases', $param);
                         if ($save_beli == TRUE) {
                             $where = array('reference_no' => $reference);
                             $delete = $this->mp->delete('atombizz_tmp_detail_purchases', $where);
                             if ($delete > 0) {
                                 $where = array('code' => $param['supplier_code']);
                                 $sql_ins['last_active'] = $param['date'];
                                 $sql_ins['last_num'] = $this->mp->get_last_num($param['supplier_code']);
                                 $insert = $this->mp->replace('atombizz_suppliers', $sql_ins, $where);
                                 if ($insert == TRUE) {
                                     echo "1|" . succ_msg("Berhasil, menambahkan data pembelian.");
                                 } else {
                                     echo "0|" . err_msg("Error, hubungi teknisi.");
                                 }
                             } else {
                                 echo "0|" . err_msg("Error, hubungi teknisi.");
                             }
                         } else {
                             echo "0|" . err_msg("Error, hubungi teknisi.");
                         }
                     } else {
                         echo "0|" . err_msg("Error, hubungi teknisi. -hpp");
                     }
                 } else {
                     echo "0|" . err_msg("Error, hubungi teknisi.");
                 }
             } else {
                 echo "0|" . err_msg("Error, hubungi teknisi.");
             }
         } else {
             echo "0|" . err_msg("Error, hubungi teknisi.");
         }
     }
 }
예제 #11
0
파일: member.php 프로젝트: ahmadsm/iwakkoi
 public function delete()
 {
     $id = $this->input->post('id');
     $nik = $this->mm->get_code($id);
     $where = array('id' => $id);
     $delete = $this->mm->delete('member', $where);
     if ($delete) {
         echo "1|" . succ_msg("Member berhasil dihapus.");
     } else {
         echo "0|" . err_msg("Gagal, coba periksa lagi inputan anda.");
     }
 }
예제 #12
0
 public function opname_adjust()
 {
     $param = $this->input->post();
     $basmalah = $this->config->item('astro');
     $this->load->library('form_validation');
     $this->form_validation->set_rules('description', 'Keterangan', 'trim|required|xss_clean');
     $this->form_validation->set_rules('approved_by', 'Supervisor', 'trim|required|xss_clean');
     if ($this->form_validation->run() == FALSE) {
         //tidak memenuhi validasi
         echo '0|' . warn_msg(validation_errors());
     } else {
         //save data
         $reference = $param['reference'];
         unset($param['reference']);
         $where = array('reference' => $reference);
         $param['rule'] = 'confirmed';
         $update = $this->mak->replace('atombizz_stock_opname', $param, $where);
         $date = date('Y-m-d H:i:s');
         if ($update == TRUE) {
             $data = $this->mak->find('view_stock_opname', $where);
             foreach ($data->result_array() as $das) {
                 if ($das['status'] == 'kurang') {
                     $keluar = $das['difference'];
                     $masuk = 0;
                 } elseif ($das['status'] == 'lebih') {
                     $keluar = 0;
                     $masuk = $das['difference'];
                 } elseif ($das['status'] == 'cocok') {
                     $keluar = $masuk = 0;
                 }
                 $arr_stok[] = array('status' => 'opname', 'userlog' => $date, 'reference' => $das['reference'], 'date' => date('Y-m-d'), 'in' => $masuk, 'out' => $keluar, 'description' => 'Opname confirmation : ' . $param['description'], 'operator' => $param['approved_by'], 'rak_code' => $das['rak_code'], 'product_code' => $das['product_code']);
             }
             $save = $this->mak->write_batch('atombizz_warehouses_stok', $arr_stok);
             if ($save == TRUE) {
                 echo "1|" . succ_msg("Berhasil, menyesuaikan stok opname.");
             } else {
                 echo '0|' . err_msg('Gagal, menyesuaikan stok opname.');
             }
         } else {
             echo '0|' . err_msg('Gagal, update data approve.');
         }
     }
 }
예제 #13
0
 public function hapus_data()
 {
     $param = $this->input->post();
     $delete = $this->mp->delete('atombizz_employee_position', array('id' => $param['id']));
     if ($delete) {
         $delete_acc = $this->mp->delete('atombizz_employee_access', array('position_id' => $param['id']));
         if ($delete_acc) {
             echo '1|' . succ_msg('Berhasil menghapus Posisi.');
         } else {
             echo '0|' . err_msg('Gagal menghapus Posisi.');
         }
     } else {
         echo '0|' . err_msg('Gagal menghapus Posisi.');
     }
 }
예제 #14
0
 public function delete()
 {
     $id = $this->input->post('id');
     $where = array('id' => $id);
     $delete = $this->mp->delete('atombizz_customers', $where);
     if ($delete) {
         echo "1|" . succ_msg("Pelanggan berhasil dihapus.");
     } else {
         echo "0|" . err_msg("Gagal, coba periksa lagi inputan anda.");
     }
 }
예제 #15
0
 public function proses_retur_out()
 {
     $basmalah = $this->config->item('astro');
     $userlog = date('Y-m-d H:i:s');
     $param = $this->input->post();
     $reference = $this->input->post('reference');
     $where = array('reference' => $reference);
     $keterangan = 'Retur Keluar dengan referensi no ' . $reference;
     $data = $this->mp->find('view_tmp_retur_out', $where);
     $nominal_retur_out = 0;
     foreach ($data->result_array() as $das) {
         $arr_detail[] = array('reference' => $reference, 'product_id' => $das['product_id'], 'product_code' => $das['product_code'], 'product_name' => $das['product_name'], 'quantity' => $das['quantity'], 'hpp' => $das['hpp'], 'description' => $das['description'], 'brand_code' => $das['brand_code'], 'unit' => $das['unit']);
         $nominal_retur_out += $das['sub_total'];
         $qty = $das['quantity'];
         $unit = $das['unit'];
         //brand konversi stok
         if ($das['brand_code'] != '') {
             $query = $this->mp->find('atombizz_brand_converter', array('product_code' => $das['product_code'], 'code' => $das['brand_code']));
             $konv_brand = $query->row();
             $qty = $das['quantity'] * $konv_brand->qty_convertion;
             $unit = $konv_brand->satuan_convertion;
         }
         //konversi satuan terkecil
         $konv_unit = unit_converter($qty, $unit);
         $data_konv = json_decode($konv_unit);
         $qty = $data_konv->qty;
         $unit = $data_konv->satuan;
         $arr_stok[] = array('date' => $param['date'], 'status' => 'retur out', 'reference' => $reference, 'in' => 0, 'out' => $qty, 'description' => $keterangan, 'userlog' => $userlog, 'operator' => $param['operator'], 'rak_code' => $das['gudang_code'], 'product_code' => $das['product_code'], 'dept' => $basmalah['bas_code_dept']);
     }
     // print_r($arr_stok);exit;
     $arr_retur_out = array('reference' => $reference, 'supplier_code' => $param['supplier_code'], 'supplier_name' => $param['supplier_name'], 'date' => $param['date'], 'operator' => $param['operator'], 'total' => $param['total_akhir'], 'urut' => $param['urut'], 'dept' => $basmalah['bas_code_dept'], 'userlog' => $userlog);
     $save_items = $this->mp->write_batch('atombizz_retur_out_detail', $arr_detail);
     if ($save_items == TRUE) {
         $save_stok = $this->mp->write_batch('atombizz_warehouses_stok', $arr_stok);
         if ($save_stok == TRUE) {
             $save_beli = $this->mp->write('atombizz_retur_out', $arr_retur_out);
             // echo $this->db->last_query();exit;
             if ($save_beli == TRUE) {
                 $where = array('reference' => $reference);
                 $delete = $this->mp->delete('atombizz_retur_out_tmp', $where);
                 if ($delete > 0) {
                     $kode = 'FRO';
                     $data = array('kode' => $kode, 'no_referensi' => $reference, 'tanggal' => $param['date'], 'keterangan' => $keterangan, 'dept' => $basmalah['bas_code_dept'], 'person' => $param['supplier_code'], 'valid' => 'yes');
                     //retur
                     $data['debit'] = 0;
                     $data['kredit'] = $param['total_akhir'];
                     $data['no_akun'] = '330000';
                     $kas_acc = $this->mp->write('atombizz_accounting_buku_besar', $data);
                     //hutang
                     $data['kredit'] = 0;
                     $data['debit'] = $param['total_akhir'];
                     $data['no_akun'] = '510000';
                     $data['faktur'] = $reference;
                     $data['kode'] = 'HTG';
                     $save_acc = $this->mp->write('atombizz_accounting_buku_besar', $data);
                     if ($save_acc == TRUE) {
                         echo "1|" . succ_msg("Berhasil, menambahkan data retur keluar.");
                     } else {
                         echo "0|" . err_msg("Gagal, menambahkan data accounting persediaan.");
                     }
                 }
             } else {
                 echo "0|" . err_msg("Gagal, menambahkan data retur keluar.");
             }
         } else {
             echo "0|" . err_msg("Gagal, mengurangi data stok bahan.");
         }
     } else {
         echo "0|" . err_msg("Gagal, menambahkan data retur keluar detail.");
     }
 }
예제 #16
0
 public function proses_spoil()
 {
     $user = $this->session->userdata('astrosession');
     $basmalah = $this->config->item('astro');
     $userlog = date('Y-m-d H:i:s');
     $param = $this->input->post();
     $reference = $this->input->post('reference');
     echo $reference;
     $where = array('reference' => $reference);
     $keterangan = 'Spoil dengan referensi no ' . $reference;
     $data = $this->mp->find('view_tmp_spoil', $where);
     $nominal_retur_out = 0;
     foreach ($data->result_array() as $das) {
         $arr_detail[] = array('reference' => $reference, 'kode' => $das['kode'], 'nama' => $das['nama'], 'qty' => $das['qty'], 'hpp' => $das['hpp'], 'total' => $das['total'], 'tgl' => $das['tgl'], 'status' => 'produk', 'keterangan' => $das['keterangan']);
         $nominal_retur_out += $das['total'];
         $arr_stok[] = array('date' => $param['tgl'], 'status' => 'spoil', 'reference' => $reference, 'in' => 0, 'out' => $das['qty'], 'description' => $keterangan, 'userlog' => $userlog, 'operator' => $user[0]->uname, 'rak_code' => $das['gudang_code'], 'product_code' => $das['kode'], 'dept' => $basmalah['bas_code_dept']);
         $arr_stok[] = array('date' => $param['tgl'], 'status' => 'spoil', 'reference' => $reference, 'in' => $das['qty'], 'out' => 0, 'description' => $keterangan, 'userlog' => $userlog, 'operator' => $user[0]->uname, 'rak_code' => 'spoil', 'product_code' => $das['kode'], 'dept' => $basmalah['bas_code_dept']);
     }
     $arr_retur_out = array('reference' => $reference, 'tgl' => $param['tgl'], 'total' => $nominal_retur_out, 'urut' => $param['urut']);
     $save_items = $this->mp->write_batch('atombizz_spoil_detail', $arr_detail);
     if ($save_items == TRUE) {
         $save_stok = $this->mp->write_batch('atombizz_warehouses_stok', $arr_stok);
         if ($save_stok == TRUE) {
             $save_beli = $this->mp->write('atombizz_spoil', $arr_retur_out);
             if ($save_beli == TRUE) {
                 $where = array('reference' => $reference);
                 $delete = $this->mp->delete('atombizz_spoil_tmp', $where);
                 if ($delete > 0) {
                     //persediaan
                     $jurnal = array('kode' => 'spoil', 'no_referensi' => $reference, 'tanggal' => $param['tgl'], 'keterangan' => 'Spoil stok stok_produk dengan referensi ' . $reference, 'no_akun' => '130000', 'debit' => 0, 'kredit' => $nominal_retur_out, 'person' => $user[0]->uname, 'valid' => 'yes');
                     $save_acc = $this->mp->write('atombizz_accounting_buku_besar', $jurnal);
                     if ($save_acc) {
                         echo "1|" . succ_msg("Berhasil, menambahkan data spoil.");
                     } else {
                         echo "0|" . err_msg("Gagal, menambahkan data spoil.");
                     }
                 }
             } else {
                 echo "0|" . err_msg("Gagal, menambahkan data spoil.");
             }
         } else {
             echo "0|" . err_msg("Gagal, mengurangi data stok bahan.");
         }
     } else {
         echo "0|" . err_msg("Gagal, menambahkan data spoil detail.");
     }
 }
예제 #17
0
 public function delete_rekening()
 {
     // $access = strtolower($this->module.'.'.__class__.'.'.__function__);
     // $this->permission->check_permission($access);
     $param = $this->input->post();
     $delete = $this->mma->delete('atombizz_accounting_master_akun', $param);
     if ($delete > 0) {
         echo "1|" . succ_msg("Data rekekning berhasil dihapus. -delete");
     } else {
         echo "0|" . err_msg("Gagal, data rekekning belum dihapus. -delete");
     }
 }
예제 #18
0
 public function proses()
 {
     $param = $this->input->post();
     $basmalah = $this->config->item('astro');
     // print_r($param);exit;
     $dept = $basmalah['bas_code_dept'];
     $userlog = date('Y-m-d H:i:s');
     $reference = $param['reference'];
     $where = array('reference' => $reference);
     $total = 0;
     $data = $this->mp->find('atombizz_retur_in_tmp', $where);
     foreach ($data->result_array() as $das) {
         $arr_detail[] = array('reference' => $das['reference'], 'product_code' => $das['product_code'], 'product_name' => $das['product_name'], 'quantity' => $das['quantity'], 'hpp' => $das['hpp']);
         $arr_stok[] = array('date' => $das['date'], 'status' => 'retur_in', 'reference' => $das['reference'], 'in' => $das['quantity'], 'out' => 0, 'description' => 'Retur masuk dengan nota ' . $das['nota'], 'userlog' => $userlog, 'operator' => $das['operator'], 'rak_code' => 'retur', 'product_code' => $das['product_code'], 'dept' => $dept);
         $arr_stok_out[] = array('date' => $das['date'], 'status' => 'retur_in', 'reference' => $das['reference'], 'in' => 0, 'out' => $das['quantity'], 'description' => 'Retur masuk dengan nota ' . $das['nota'], 'userlog' => $userlog, 'operator' => $das['operator'], 'rak_code' => $this->mp->get_gudang_code($das['product_code']), 'product_code' => $das['product_code'], 'dept' => $dept);
         $total += $das['quantity'] * $das['hpp'];
     }
     $arr_retur_in = array('reference' => $param['reference'], 'nota' => $param['nota'], 'date' => $param['date'], 'total' => $total, 'userlog' => $userlog, 'operator' => $param['operator'], 'branch_code' => $basmalah['bas_branch_code'], 'branch_name' => $basmalah['bas_branch_name'], 'dept' => $dept, 'urut' => $param['urut'], 'updated_by' => $param['operator']);
     $ins_stok_retur = $this->mp->write_batch('atombizz_warehouses_stok', $arr_stok);
     if ($ins_stok_retur) {
         $ins_stok_retur = $this->mp->write_batch('atombizz_warehouses_stok', $arr_stok_out);
         if ($ins_stok_retur) {
             $ins_retur = $this->mp->write('atombizz_retur_in', $arr_retur_in);
             if ($ins_retur) {
                 $ins_detail = $this->mp->write_batch('atombizz_retur_in_detail', $arr_detail);
                 if ($ins_detail) {
                     $del_tmp = $this->mp->delete('atombizz_retur_in_tmp', $where);
                     if ($del_tmp) {
                         echo succ_msg('Proses retur in berhasil.');
                     } else {
                         echo err_msg('Gagal menghapus produk di temporary.');
                     }
                 } else {
                     echo err_msg('Gagal menyimpan data detail.');
                 }
             } else {
                 echo err_msg('Gagal menyimpan data retur.');
             }
         } else {
             echo err_msg('Gagal menyimpan data retur.');
         }
     } else {
         echo err_msg('Gagal menyimpan data stok.');
     }
 }
예제 #19
0
 public function hapus_data()
 {
     $param = $this->input->post();
     $kasbon = $this->mp->delete('atombizz_kasbon', array('id' => $param['id']));
     if ($kasbon) {
         $kasbon = $this->mp->delete('atombizz_accounting_journal', array('id' => $param['id']));
     }
     if ($delete) {
         echo "1|" . succ_msg("Kasbon berhasil dihapus.");
     } else {
         echo "0|" . err_msg("Gagal menghapus Transaksi.");
     }
 }
예제 #20
0
 public function hapus_data()
 {
     $param = $this->input->post();
     $data = $this->mp->ambil_data($param);
     $delete_spec = $this->mp->delete('atombizz_product_specification', array('code' => $data->code));
     if ($delete_spec) {
         $delete = $this->mp->delete('atombizz_product', array('id' => $param['id']));
         if ($delete) {
             echo "1|" . succ_msg("Produk/Layanan berhasil dihapus.");
         } else {
             echo "0|" . err_msg("Gagal menghapus produk/layanan.");
         }
     } else {
         echo "0|" . err_msg("Gagal menghapus spesifikasi produk.");
     }
 }
예제 #21
0
 public function del_mix_bahan()
 {
     $param = $this->input->post();
     $delete = $this->mm->delete('atombizz_mix_product', array('id' => $param['id']));
     if ($delete) {
         echo '1|' . succ_msg('Berhasil menghapus data mix komposisi.');
     } else {
         echo '0|' . err_msg('Gagal menghapus data mix komposisi.');
     }
 }
예제 #22
0
 public function input_harga()
 {
     $param = $this->input->post();
     $operator = $this->session->userdata('astrosession');
     $this->load->library('form_validation');
     $this->form_validation->set_rules('code', 'Bahan', 'trim|required|xss_clean');
     $this->form_validation->set_rules('price1', 'Harga Satuan', 'trim|required|xss_clean');
     if ($this->form_validation->run() == FALSE) {
         echo "0|" . warn_msg(validation_errors());
     } else {
         $id = $param['id'];
         unset($param['id']);
         $price = $param['price'];
         unset($param['price']);
         $arr = array('date' => date('Y-m-d'), 'price' => $price);
         $where = array('code' => $param['code']);
         $exist = $this->mp->total('atombizz_product_price', $where);
         if ($exist <= 0) {
             $save_price = $this->mp->write('atombizz_product_price', $arr);
         } else {
             $save_price = $this->mp->replace('atombizz_product_price', $arr, $where);
         }
         if ($save_price) {
             $save = $this->mp->replace('atombizz_product_specification', $param, $where);
             if ($save == TRUE) {
                 echo "1|" . succ_msg("Bahan berhasil ditambahkan");
             } else {
                 echo "0|" . err_msg("Gagal, coba periksa lagi inputan anda.");
             }
         } else {
             echo "0|" . err_msg("Gagal menyimpan hpp.");
         }
     }
 }
예제 #23
0
 public function hapus_data()
 {
     $param = $this->input->post();
     $delete = $this->mp->delete('atombizz_accounting_buku_besar', array('id' => $param['id']));
     if ($delete) {
         echo "1|" . succ_msg("Transaksi berhasil dihapus.");
     } else {
         echo "0|" . err_msg("Gagal menghapus Transaksi.");
     }
 }
예제 #24
0
 public function add_penggajian()
 {
     $param = $this->input->post();
     $this->load->library('form_validation');
     $this->form_validation->set_rules('id_karyawan', 'Nama Karyawan', 'trim|required|xss_clean');
     $this->form_validation->set_rules('gaji', 'Gaji', 'trim|required|xss_clean');
     $this->form_validation->set_rules('bonus', 'Bonus', 'trim|required|xss_clean');
     $this->form_validation->set_rules('casbon', 'Cashbon', 'trim|xss_clean');
     $this->form_validation->set_rules('total', 'Total', 'trim|xss_clean');
     if ($this->form_validation->run() == FALSE) {
         echo "0|" . warn_msg(validation_errors());
     } else {
         $exist = $this->mp->total('atombizz_penggajian', array('id_karyawan' => $param['id_karyawan'], 'MONTH(tanggal)' => date('n')));
         if ($exist <= 0) {
             $no = $this->mp->total('atombizz_penggajian');
             $param['no_slip'] = 'NS-' . date('ymd') . '-' . $no;
             $param['tanggal'] = date('Y-m-d');
             $save = $this->mp->write('atombizz_penggajian', $param);
             if ($save == TRUE) {
                 $jurnal = array('no_referensi' => $param['no_slip'], 'tanggal' => $param['tanggal'], 'person' => $param['id_karyawan'], 'valid' => 'yes');
                 //kas
                 $jurnal['keterangan'] = "Pembayaran gaji pada karyawan " . $param['id_karyawan'];
                 $jurnal['kode'] = 'GAJI';
                 $jurnal['no_akun'] = '110000';
                 $debit = 0;
                 $kredit = $param['total'];
                 $faktur = '';
                 $kas = $this->mp->insert_acc($jurnal, $debit, $kredit, $faktur);
                 //penggajian
                 $jurnal['keterangan'] = "Pembayaran gaji pada karyawan " . $param['id_karyawan'];
                 $jurnal['kode'] = 'GAJI';
                 $jurnal['no_akun'] = '615000';
                 $debit = $param['total'];
                 $kredit = 0;
                 $faktur = '';
                 $penggajian = $this->mp->insert_acc($jurnal, $debit, $kredit, $faktur);
                 //kasbon
                 if (is_numeric($param['casbon']) && $param['casbon'] > 0) {
                     $jurnal['keterangan'] = "Pembayaran kasbon untuk karyawan " . $param['id_karyawan'];
                     $jurnal['kode'] = 'KASBON';
                     $jurnal['no_akun'] = '180000';
                     $debit = 0;
                     $kredit = $param['casbon'];
                     $faktur = $param['no_slip'];
                     $kasbon = $this->mp->insert_acc($jurnal, $debit, $kredit, $faktur);
                 }
                 if ($kas && $penggajian) {
                     echo "1|" . succ_msg("Data penggajian berhasil disimpan") . "|";
                     $this->print_slip($param);
                 } else {
                     echo "0|" . err_msg("Gagal, coba ulangi sekali lagi.");
                 }
             } else {
                 echo "0|" . err_msg("Gagal, coba ulangi sekali lagi.");
             }
         } else {
             echo "0|" . err_msg("Gaji sudah dibayarkan.");
         }
     }
 }
예제 #25
0
 public function proses_retur_out()
 {
     $basmalah = $this->config->item('astro');
     $userlog = date('Y-m-d H:i:s');
     $param = $this->input->post();
     $reference = $this->input->post('reference');
     $where = array('reference' => $reference);
     $keterangan = 'Distribusi dengan referensi no ' . $reference;
     $data = $this->mp->find('atombizz_distribution_tmp', $where);
     $nominal_retur_out = 0;
     foreach ($data->result_array() as $das) {
         $arr_detail[] = array('reference_no' => $reference, 'product_id' => $das['product_id'], 'product_code' => $das['product_code'], 'product_name' => $das['product_name'], 'quantity' => $das['qty_dikirim'], 'unit' => $das['unit']);
         $arr_stok[] = array('date' => $param['date'], 'status' => 'distribusi', 'reference' => $reference, 'in' => 0, 'out' => $das['qty_dikirim'], 'description' => $keterangan, 'userlog' => $userlog, 'operator' => $param['operator'], 'rak_code' => 'G-001', 'product_code' => $das['product_code'], 'dept' => $basmalah['bas_code_dept']);
     }
     $arr_retur_out = array('reference_no' => $reference, 'penerima' => $param['penerima'], 'date' => $param['date'], 'operator' => $param['operator'], 'urut' => $param['urut'], 'dept' => $basmalah['bas_code_dept'], 'status' => 'pengajuan');
     $save_items = $this->mp->write_batch('atombizz_distribution_items', $arr_detail);
     if ($save_items == TRUE) {
         $save_stok = $this->mp->write_batch('atombizz_warehouses_stok', $arr_stok);
         if ($save_stok == TRUE) {
             $save_beli = $this->mp->write('atombizz_distribution', $arr_retur_out);
             // echo $this->db->last_query();exit;
             if ($save_beli == TRUE) {
                 $where = array('reference' => $reference);
                 $delete = $this->mp->delete('atombizz_distribution_tmp', $where);
                 if ($delete > 0) {
                     echo "1|" . succ_msg("Berhasil, menambahkan data retur keluar.");
                     // $kode = 'FRO';
                     // $data = array(
                     //     'kode'=>$kode,
                     //     'no_referensi'=>$reference,
                     //     'tanggal'=>$param['date'],
                     //     'keterangan'=>$keterangan,
                     //     'dept'=>$basmalah['bas_code_dept'],
                     //     'person'=>$param['supplier_code'],
                     //     'valid'=>'yes'
                     // );
                     // //retur
                     // $data['debit'] = 0;
                     // $data['kredit'] = $param['total_akhir'];
                     // $data['no_akun'] = '330000';
                     // $kas_acc = $this->mp->write('atombizz_accounting_buku_besar',$data);
                     // //hutang
                     // $data['kredit'] = 0;
                     // $data['debit'] = $param['total_akhir'];
                     // $data['no_akun'] = '510000';
                     // $data['faktur'] = $reference;
                     // $data['kode'] = 'HTG';
                     // $save_acc = $this->mp->write('atombizz_accounting_buku_besar',$data);
                     // if ($save_acc==TRUE) {
                     //     echo "1|".succ_msg("Berhasil, menambahkan data retur keluar.");
                     // } else {
                     //     echo "0|".err_msg("Gagal, menambahkan data accounting persediaan.");
                     // }
                 }
             } else {
                 echo "0|" . err_msg("Gagal, menambahkan data distribusi.");
             }
         } else {
             echo "0|" . err_msg("Gagal, mengurangi data stok bahan.");
         }
     } else {
         echo "0|" . err_msg("Gagal, menambahkan data distribusi detail.");
     }
 }
예제 #26
0
 public function delete_rak()
 {
     $param = $this->input->post();
     $delete = $this->mp->delete('atombizz_rack', $param);
     if ($delete > 0) {
         echo "1|" . succ_msg("Data rak berhasil dihapus. -delete");
     } else {
         echo "0|" . err_msg("Gagal, data rak belum dihapus. -delete");
     }
 }
예제 #27
0
 public function delete()
 {
     $id = $this->input->post('id');
     $where = array('id' => $id);
     $delete = $this->ksr->delete('detil-penjualan', $where);
     if ($delete) {
         echo "1|" . succ_msg("Pesanan berhasil dihapus.");
     } else {
         echo "0|" . err_msg("Gagal, coba periksa lagi inputan anda.");
     }
 }
예제 #28
0
 public function input_gaji()
 {
     $param = $this->input->post();
     $config = $this->config->item('astro');
     $operator = $this->session->userdata('astrosession');
     // print_r($operator);exit;
     $this->load->library('form_validation');
     $this->form_validation->set_rules('employee_code', 'Karyawan', 'trim|required|xss_clean');
     $this->form_validation->set_rules('gaji_pokok', 'fieldlabel', 'trim|required|numeric|xss_clean');
     $this->form_validation->set_rules('bonus', 'fieldlabel', 'trim|numeric|xss_clean');
     $this->form_validation->set_rules('tunjangan_lain', 'fieldlabel', 'trim|numeric|xss_clean');
     $this->form_validation->set_rules('hutang', 'fieldlabel', 'trim|numeric|xss_clean');
     $this->form_validation->set_rules('potongan_lain', 'fieldlabel', 'trim|numeric|xss_clean');
     if ($this->form_validation->run() == FALSE) {
         echo "0|" . warn_msg(validation_errors());
     } else {
         $id = $param['id'];
         unset($param['id'], $param['date_show']);
         $total_gaji = $param['gaji_pokok'] + $param['bonus'] + $param['tunjangan_lain'] - $param['potongan_lain'];
         if (empty($id)) {
             $where = array('code' => $param['code']);
             $exist = $this->mp->total('atombizz_salary', $where);
             if ($exist > 0) {
                 $save = false;
                 $data = 'exist';
             } else {
                 $write = $this->mp->write('atombizz_salary', $param);
                 if ($write) {
                     $jurnal['kode'] = 'GAJI';
                     $jurnal['no_referensi'] = $param['code'];
                     $jurnal['tanggal'] = $param['date'];
                     $jurnal['keterangan'] = 'Penggajian Kepada Karyawan dengan id ' . $param['employee_code'];
                     $jurnal['debit'] = 0;
                     $jurnal['kredit'] = $total_gaji;
                     $jurnal['dept'] = '';
                     $jurnal['person'] = $param['employee_code'];
                     $jurnal['valid'] = 'yes';
                     // $jurnal['operator'] = $operator[0]->no_ktp;
                     $save = $this->mp->write('atombizz_accounting_buku_besar', $jurnal);
                     $jurnal_piutang['kode'] = 'KASBON';
                     $jurnal_piutang['no_referensi'] = $param['code'];
                     $jurnal_piutang['tanggal'] = $param['date'];
                     $jurnal_piutang['keterangan'] = 'Pembayaran kasbon karyawan dengan id ' . $param['employee_code'];
                     $jurnal_piutang['debit'] = $param['hutang'];
                     $jurnal_piutang['kredit'] = 0;
                     $jurnal_piutang['dept'] = '';
                     $jurnal_piutang['person'] = $param['employee_code'];
                     $jurnal_piutang['valid'] = 'yes';
                     // $jurnal_piutang['operator'] = $operator[0]->no_ktp;
                     $save = $this->mp->write('atombizz_accounting_buku_besar', $jurnal_piutang);
                 } else {
                     $save = false;
                 }
             }
         } else {
             $where = array('id' => $id);
             $replace = $this->mp->replace('atombizz_salary', $param, $where);
             if ($replace) {
                 $jurnal['debit'] = 0;
                 $jurnal['credit'] = $total_gaji;
                 $where = array('reference_no' => $param['code'], 'code' => 'GAJI');
                 $save = $this->mp->replace('atombizz_accounting_buku_besar', $jurnal, $where);
                 $jurnal_piutang['debit'] = $param['hutang'];
                 $jurnal_piutang['credit'] = 0;
                 $where2 = array('reference_no' => $param['code'], 'code' => 'KASBON');
                 $save = $this->mp->replace('atombizz_accounting_buku_besar', $jurnal_piutang, $where2);
             } else {
                 $save = false;
             }
         }
         // echo $this->db->last_query();exit;
         if ($save) {
             echo "1|" . succ_msg('Penggajian berhasil dicatat.');
         } else {
             if ($data == 'exist') {
                 echo "0|" . err_msg('Data sudah ada. Gunakan fitur edit untuk merubah data.');
             } else {
                 echo "0|" . err_msg('Penggajian gagal dicatat. Silahkan cek inputan anda.');
             }
         }
     }
 }