public function input_transaksi() { $param = $this->input->post(); $config = $this->config->item('astro'); $operator = $this->session->userdata('astrosession'); $this->load->library('form_validation'); $this->form_validation->set_rules('tanggal', 'Tanggal Pembayaran', 'trim|required|xss_clean'); $this->form_validation->set_rules('akun_kas', 'Akun Kas', 'trim|required|xss_clean'); $this->form_validation->set_rules('jenis_pengeluaran', 'Jenis Pengeluaran', 'trim|required|xss_clean'); $this->form_validation->set_rules('akun_biaya', 'Akun Biaya', 'trim|required|xss_clean'); $this->form_validation->set_rules('nominal', 'Nominal', 'trim|required|numeric|xss_clean'); if ($this->form_validation->run() == FALSE) { echo "0|" . warn_msg(validation_errors()); } else { $data = array('kode' => $param['kode'], 'no_referensi' => $param['no_referensi'], 'tanggal' => $param['tanggal'], 'keterangan' => $param['keterangan'], 'dept' => $config['bas_code_dept'], 'person' => $operator[0]->uname, 'valid' => 'no'); //kas $data['debit'] = 0; $data['kredit'] = $param['nominal']; $data['no_akun'] = $param['akun_kas']; $kas_acc = $this->mp->write('atombizz_accounting_buku_besar', $data); //akun_biaya $data['debit'] = $param['nominal']; $data['kredit'] = 0; $data['no_akun'] = $param['akun_biaya']; $data['urut'] = $param['urut']; $data['faktur'] = $param['no_referensi']; $biaya_acc = $this->mp->write('atombizz_accounting_buku_besar', $data); if ($kas_acc && $biaya_acc) { echo "1|" . succ_msg("Transaksi berhasil ditambahkan"); } else { echo "0|" . err_msg("Gagal, coba periksa lagi inputan anda."); } } }
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"); } } }
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'); } } }
public function save() { $param = $this->input->post(); $this->load->library('form_validation'); $this->form_validation->set_rules('tgl_lahir', 'Tgl Lahir', 'trim|required|xss_clean'); $this->form_validation->set_rules('nama', 'Nama', 'trim|required|xss_clean'); $this->form_validation->set_rules('no_ktp', 'No KTP', 'trim|required|xss_clean'); $this->form_validation->set_rules('alamat', 'Alamat', 'trim|required|xss_clean'); $this->form_validation->set_rules('telp', 'No. Telp', 'trim|numeric|required|xss_clean'); $this->form_validation->set_rules('email', 'Email', 'trim|valid_email|xss_clean'); $this->form_validation->set_rules('status', 'Status', 'trim|required|xss_clean'); $this->form_validation->set_rules('compliment', 'Compliment', 'trim|required|xss_clean'); $this->form_validation->set_rules('id', 'fieldlabel', 'trim|xss_clean'); $this->form_validation->set_rules('uname', 'Username', 'trim|required|xss_clean'); $this->form_validation->set_rules('upass', 'Password', 'trim|required|xss_clean'); // $this->form_validation->set_rules('confirm-upass', 'Password Confirm', 'trim|required|xss_clean'); $this->form_validation->set_rules('group', 'Jabatan', 'trim|required|xss_clean'); if ($this->form_validation->run() == FALSE) { echo "0|" . warn_msg(validation_errors()); } else { // if($param['upass']==$param['confirm-upass']){ $id = $param['id']; unset($param['id']); unset($param['xxx']); $param['upass'] = paramEncrypt($param['upass']); $param['nik'] = $param['code']; unset($param['code']); if ($id == NULL) { $where = array('no_ktp' => $param['no_ktp']); $exist = $this->mkn->total('atombizz_employee', $where); if ($exist <= 0) { $where = array('uname' => $param['uname']); $exist = $this->mkn->total('atombizz_employee', $where); if ($exist <= 0) { $save = $this->mkn->write('atombizz_employee', $param); if ($save == TRUE) { echo "1|" . succ_msg("Pengguna berhasil ditambahkan"); } else { echo "0|" . err_msg("Gagal, coba periksa lagi inputan anda."); } } else { echo "0|" . err_msg("Gagal, coba periksa lagi inputan anda."); } } else { echo "0|" . err_msg("Data sudah ada."); } } else { $where = array('id' => $id); $update = $this->mkn->replace('atombizz_employee', $param, $where); if ($update == TRUE) { echo "1|" . succ_msg("Pengguna berhasil dirubah."); } else { echo "0|" . err_msg("Gagal, coba periksa lagi inputan anda."); } } // } else { // echo '0|'.warn_msg('Password yang dimasukkan tidak sama.'); // } } }
public function ins_rekening($value = '') { $param = $this->input->post(); $this->load->library('form_validation'); $this->form_validation->set_rules('parent', 'Parent Rekening', 'trim|xss_clean'); $this->form_validation->set_rules('position', 'Jenis', 'trim|required|xss_clean'); $this->form_validation->set_rules('code', 'Kode Rekening', 'trim|required|xss_clean'); $this->form_validation->set_rules('name', 'Nama Rekening', 'trim|required|xss_clean'); $this->form_validation->set_rules('keterangan', 'Keterangan', 'trim|required|xss_clean'); if ($this->form_validation->run() == FALSE) { //tidak memenuhi validasi echo '0|' . warn_msg(validation_errors()); } else { $id = $param['id']; unset($param['id']); if (is_numeric($id)) { $where = array('id' => $id); $save = $this->mma->replace('atombizz_accounting_master_akun', $param, $where); } else { $save = $this->mma->write('atombizz_accounting_master_akun', $param); } if ($save == TRUE) { echo '1|' . succ_msg('Rekening berhasil disimpan.'); } else { echo '0|' . err_msg('Rekening gagal disimpan.'); } } }
public function save() { $param = $this->input->post(); $this->load->library('form_validation'); $this->form_validation->set_rules('classification', 'Klasifikasi', 'trim|required|xss_clean'); $this->form_validation->set_rules('code', 'Kode', 'trim|required|xss_clean'); $this->form_validation->set_rules('name', 'Nama', 'trim|required|xss_clean'); $this->form_validation->set_rules('phone', 'Telephone', 'trim|required|xss_clean'); $this->form_validation->set_rules('pic_phone', 'Telephone PIC', 'trim|required|xss_clean'); $this->form_validation->set_rules('pic_position', 'Posisi PIC', 'trim|xss_clean'); $this->form_validation->set_rules('pic_name', 'Nama PIC', 'trim|required|xss_clean'); $this->form_validation->set_rules('address', 'Alamat', 'trim|required|xss_clean'); // $this->form_validation->set_rules('registered', 'Waktu Pendaftaran', 'trim|required|xss_clean'); $this->form_validation->set_rules('status', 'Status', 'trim|required|xss_clean'); $this->form_validation->set_rules('email', 'E-mail', 'trim|xss_clean'); $this->form_validation->set_rules('bank_account', 'Akun Bank', 'trim|xss_clean'); $this->form_validation->set_rules('bank_name', 'Nama Bank', 'trim|xss_clean'); // $this->form_validation->set_rules('orders', '', 'trim|required|xss_clean'); $this->form_validation->set_rules('payment', 'Payment', 'trim|required|xss_clean'); if ($this->form_validation->run() == FALSE) { echo "0|" . warn_msg(validation_errors()); } else { $id = $param['id']; unset($param['id']); if ($id == NULL) { $where = array('code' => $param['code']); $exist = $this->msp->total('atombizz_suppliers', $where); if ($exist <= 0) { $save = $this->msp->write('atombizz_suppliers', $param); if ($save == TRUE) { echo "1|" . succ_msg("Suplier berhasil ditambahkan"); } else { echo "0|" . err_msg("Gagal, coba periksa lagi inputan anda."); } } else { echo "0|" . err_msg("Data sudah ada."); } } else { $where = array('id' => $id); $update = $this->msp->replace('atombizz_suppliers', $param, $where); if ($update == TRUE) { echo "1|" . succ_msg("Suplier berhasil dirubah."); } else { echo "0|" . err_msg("Gagal, coba periksa lagi inputan anda."); } } } }
public function save_konversi($value = '') { $param = $this->input->post(); $this->load->library('form_validation'); $this->form_validation->set_rules('product_code', 'Bahan', 'trim|required|xss_clean'); $this->form_validation->set_rules('code', 'Kode Brand', 'trim|required|xss_clean'); $this->form_validation->set_rules('name', 'Nama Brand', 'trim|required|xss_clean'); $this->form_validation->set_rules('satuan', 'Satuan', 'trim|required|xss_clean'); $this->form_validation->set_rules('qty_convertion', 'Isi Konversi', 'trim|required|xss_clean'); $this->form_validation->set_rules('satuan_convertion', 'Satuan Konversi', 'trim|required|xss_clean'); if ($this->form_validation->run() == FALSE) { echo "0|" . warn_msg(validation_errors()); } else { $id = $param['id']; unset($param['id']); if ($id == NULL) { $where = array('code' => $param['code']); $exist = $this->mb->total('atombizz_brand_converter', $where); if ($exist <= 0) { $save = $this->mb->write('atombizz_brand_converter', $param); if ($save == TRUE) { echo "1|" . succ_msg("Master Konversi berhasil ditambahkan."); } else { echo "0|" . err_msg("Gagal, coba periksa lagi inputan anda."); } } else { echo "0|" . err_msg("Gagal, data sudah ada."); } } else { $where = array('id' => $id); $update = $this->mb->replace('atombizz_brand_converter', $param, $where); if ($update >= 0) { echo "1|" . succ_msg("Master Konversi berhasil dirubah. -update"); } else { echo "0|" . err_msg("Gagal, coba periksa lagi inputan anda. -update"); } } } }
public function tambah_rak() { $param = $this->input->post(); $this->load->library('form_validation'); $this->form_validation->set_rules('kode', 'Kode Rak', 'trim|required|xss_clean'); $this->form_validation->set_rules('nama', 'Nama Rak', 'trim|required|xss_clean'); if ($this->form_validation->run() == FALSE) { echo "0|" . warn_msg(validation_errors()); } else { $id = $param['id']; unset($param['id']); $param['status'] = 'gudang'; $param['jenis'] = 'G'; if ($id == NULL) { $where = array('kode' => $param['kode']); $exist = $this->mp->total('atombizz_rack', $where); if ($exist <= 0) { $save = $this->mp->write('atombizz_rack', $param); if ($save == TRUE) { echo "1|" . succ_msg("Rak Gudang berhasil ditambahkan."); } else { echo "0|" . err_msg("Gagal, coba periksa lagi inputan anda."); } } else { echo "0|" . err_msg("Gagal, data sudah ada."); } } else { $where = array('id' => $id); $update = $this->mp->replace('atombizz_rack', $param, $where); if ($update >= 0) { echo "1|" . succ_msg("Rak Gudang berhasil dirubah. -update"); } else { echo "0|" . err_msg("Gagal, coba periksa lagi inputan anda. -update"); } } } }
public function close_cashdraw($value = '') { $param = $this->input->post(); $this->load->library('form_validation'); $this->form_validation->set_rules('end_cash', 'Modal', 'trim|required|numeric|xss_clean'); if ($this->form_validation->run() == FALSE) { echo "0|" . warn_msg(validation_errors()); } else { $param['check_out'] = date('H:i:s'); $param['status'] = 'valid'; $param['end_cash'] = $param['end_cash']; $param['omset'] = $this->mk->get_omset($param['cashdraw_no']); $param['total_cash'] = $param['start_cash'] + $param['omset']; $save = $this->mk->replace('atombizz_selling_cashdraw', $param, array('cashdraw_no' => $param['cashdraw_no'])); // echo $this->db->last_query();exit; if ($save) { echo '1'; } else { echo '0'; } } }
public function retur_in_produk() { $param = $this->input->post(); $this->load->library('form_validation'); $this->form_validation->set_rules('quantity', 'Quantity', 'trim|required|numeric|xss_clean'); if ($this->form_validation->run() == FALSE) { //tidak memenuhi validasi echo "0|" . warn_msg(validation_errors()); } else { $quantity = $this->input->post('quantity'); $qty_real = $this->mp->get_real_stok($param); // print_r($qty_real);exit; if ($qty_real >= $quantity) { $hpp = $this->mp->get_hpp($param['product_code']); $sub_total = $hpp * $quantity; $param['sub_total'] = $sub_total; $param['hpp'] = $hpp; //save data $ident = $this->input->post('ident'); unset($param['ident']); if (is_numeric($ident)) { $where = array('id' => $ident); $save = $this->mp->replace('atombizz_retur_internal_tmp', $param, $where); } else { $where = array('product_code' => $param['product_code'], 'reference' => $param['reference']); $exist = $this->mp->total('atombizz_retur_internal_tmp', $where); if ($exist <= 0) { $save = $this->mp->write('atombizz_retur_internal_tmp', $param); } else { $save = FALSE; $data = 'exist'; } } } else { $save = FALSE; $data = 'stok'; } if ($save == TRUE) { echo "1|" . succ_msg("Produk berhasil ditambahkan"); } else { if ($data == 'exist') { echo "0|" . err_msg("Gagal, data produk sudah ada."); } else { if ($data == 'stok') { echo "0|" . err_msg("Gagal, stok di rak retur tidak mencukupi."); } else { echo "0|" . err_msg("Gagal, coba periksa lagi inputan anda."); } } } } }
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."); } } }
public function retur_out_produk() { $param = $this->input->post(); $this->load->library('form_validation'); $this->form_validation->set_rules('qty_dikirim', 'Quantity', 'trim|required|numeric|xss_clean'); if ($this->form_validation->run() == FALSE) { //tidak memenuhi validasi echo "0|" . warn_msg(validation_errors()); } else { $quantity = $this->input->post('qty_dikirim'); $ident = $this->input->post('ident'); unset($param['ident']); if (is_numeric($ident)) { $where = array('id' => $ident); $save = $this->mp->replace('atombizz_distribution_tmp', $param, $where); } else { $where = array('product_code' => $param['product_code'], 'reference' => $param['reference']); $exist = $this->mp->total('atombizz_distribution_tmp', $where); if ($exist <= 0) { $save = $this->mp->write('atombizz_distribution_tmp', $param); } else { $save = FALSE; $data = 'exist'; } } if ($save == TRUE) { echo "1|" . succ_msg("Bahan berhasil ditambahkan"); } else { if ($data == 'exist') { echo "0|" . err_msg("Gagal, data bahan sudah ada."); } else { if ($data == 'stok') { echo "0|" . err_msg("Gagal, stok di gudang tidak mencukupi."); } else { echo "0|" . err_msg("Gagal, coba periksa lagi inputan anda."); } } } } }
public function tambah() { $access = strtolower($this->module . '.' . __CLASS__ . '.' . __FUNCTION__); $this->permission->check_permission($access); $id = $this->uri->segment(4); if ($this->input->post() == NULL) { if ($this->session->flashdata('post_item')) { $data['val'] = $this->session->flashdata('post_item'); } else { if (is_numeric($id)) { $data['val'] = $this->mp->detail($id); $access = $this->mp->get_access($id); $data['access'] = json_decode(@$access[0]->access); $data['module_access'] = json_decode(@$access[0]->module); } } // $data['opt_module'] = $this->mp->opt_module(); $data['count'] = $this->mp->count_data(); $data['module'] = $this->mp->get_module(); $data['module_list'] = $this->mp->get_module_list(); $data['cname'] = $this->cname; $data['sidebar_active'] = 'master'; $data['title'] = 'Master - Tambah Posisi'; $data['content'] = $this->load->view('/input_posisi', $data, TRUE); $this->load->view('template', $data); } else { $param = $this->input->post(); // print_r($param);exit; $this->load->library('form_validation'); $this->form_validation->set_rules('group', 'Group', 'trim|required|xss_clean'); $this->form_validation->set_rules('information', 'Information', 'trim|xss_clean'); if ($this->form_validation->run() == FALSE) { //tidak memenuhi validasi $this->session->set_flashdata('flash_message', warn_msg(validation_errors())); $this->session->set_flashdata('post_item', $param); redirect($_SERVER['HTTP_REFERER']); } else { //save data $id = $this->input->post('id'); //strtolower $checkbox = $this->input->post('produk'); $check_module = $this->input->post('module'); // var_dump($checkbox);exit; unset($param['produk']); unset($param['module']); $perm = json_encode($checkbox); $mod = json_encode($check_module); unset($param['id']); if (is_numeric($id)) { //edit $where = array('id' => $id); $save = $this->mp->replace('atombizz_employee_position', $param, $where); if ($save == TRUE) { $where = array('position_id' => $id); $exist = $this->mp->total('atombizz_employee_access', $where, $like = null, $field = null); if ($exist > 0) { $ins = array('access' => $perm, 'module' => $mod); // print_r($check_module);exit; $save = $this->mp->replace('atombizz_employee_access', $ins, $where); } else { $ins = array('position_id' => $id, 'access' => $perm, 'module' => $mod); $save = $this->mp->write('atombizz_employee_access', $ins); } if ($save == TRUE) { $this->session->set_flashdata('flash_message', succ_msg('Posisi berhasil ditambahkan.')); } else { $this->session->set_flashdata('flash_message', err_msg('Gagal, coba ulangi sekali lagi.')); } } else { $this->session->set_flashdata('flash_message', err_msg('Gagal, coba ulangi sekali lagi.')); // echo "string1"; } } else { $where = array('group' => $param['group']); $exist = $this->mp->total('atombizz_employee_position', $where, $like = null, $field = null); // print_r($param);print_r($exist);exit; if ($exist <= 0) { $save = $this->mp->write_id('atombizz_employee_position', $param); // print_r($param);print_r($save);exit; if (is_numeric($save)) { $ins = array('position_id' => $save, 'access' => $perm, 'module' => $mod); $save = $this->mp->write('atombizz_employee_access', $ins); if ($save == TRUE) { $this->session->set_flashdata('flash_message', succ_msg('Posisi berhasil ditambahkan.')); } else { $this->session->set_flashdata('flash_message', err_msg('Gagal, coba ulangi sekali lagi.')); } } else { $this->session->set_flashdata('flash_message', err_msg('Gagal, coba ulangi sekali lagi.')); // echo "string1"; } } else { $this->session->set_flashdata('flash_message', err_msg('Gagal, data sudah ada.')); } } redirect($this->cname . '/tambah'); } } }
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.'); } } }
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."); } } }
public function retur_out_produk() { $param = $this->input->post(); $this->load->library('form_validation'); $this->form_validation->set_rules('quantity', 'Quantity', 'trim|required|numeric|xss_clean'); $this->form_validation->set_rules('description', 'Keterangan', 'trim|required|xss_clean'); if ($this->form_validation->run() == FALSE) { //tidak memenuhi validasi echo "0|" . warn_msg(validation_errors()); } else { $quantity = $this->input->post('quantity'); $quantity_t = $this->input->post('quantity'); $unit_t = $unit = $this->input->post('unit'); //brand konversi stok if ($param['brand_code'] != '') { $query = $this->mp->find('atombizz_brand_converter', array('product_code' => $param['product_code'], 'code' => $param['brand_code'])); $konv_brand = $query->row(); $quantity = $quantity * $konv_brand->qty_convertion; $quantity_t = $konv_brand->qty_convertion; $unit = $konv_brand->satuan_convertion; $unit_t = $konv_brand->satuan_convertion; } //konversi satuan terkecil $konv_unit = unit_converter($quantity, $unit); $data_konv = json_decode($konv_unit); $quantity = $data_konv->qty; $unit = $data_konv->satuan; // print_r($data_konv);exit; $qty_real = $this->mp->get_real_stok($param); if ($qty_real >= $quantity) { $hpp = $this->mp->get_hpp($param['product_code']); $sub_total = $hpp * $quantity; $param['sub_total'] = $sub_total; $hpp_acuan = unit_acuan($unit_t); $param['hpp'] = $hpp * $hpp_acuan * $quantity_t; //save data $ident = $this->input->post('ident'); unset($param['ident']); if (is_numeric($ident)) { $where = array('id' => $ident); $save = $this->mp->replace('atombizz_retur_out_tmp', $param, $where); } else { $where = array('product_code' => $param['product_code'], 'reference' => $param['reference']); $exist = $this->mp->total('atombizz_retur_out_tmp', $where); if ($exist <= 0) { $save = $this->mp->write('atombizz_retur_out_tmp', $param); } else { $save = FALSE; $data = 'exist'; } } } else { $save = FALSE; $data = 'stok'; } if ($save == TRUE) { echo "1|" . succ_msg("Bahan berhasil ditambahkan"); } else { if ($data == 'exist') { echo "0|" . err_msg("Gagal, data bahan sudah ada."); } else { if ($data == 'stok') { echo "0|" . err_msg("Gagal, stok di gudang tidak mencukupi."); } else { echo "0|" . err_msg("Gagal, coba periksa lagi inputan anda."); } } } } }
public function save() { // $access = strtolower($this->module.'.'.__class__.'.'.__function__); // $this->permission->check_permission($access); $param = $this->input->post(); $this->load->library('form_validation'); $this->form_validation->set_rules('code', 'Kode', 'trim|required|xss_clean'); $this->form_validation->set_rules('name', 'Nama', 'trim|required|xss_clean'); $this->form_validation->set_rules('registered', 'Tanggal Registrasi', 'trim|required|xss_clean'); $this->form_validation->set_rules('identification_number', 'Nomor KTP', 'trim|xss_clean'); $this->form_validation->set_rules('no_urut', 'Nomor urut', 'trim|xss_clean'); $this->form_validation->set_rules('address', 'Alamat', 'trim|required|xss_clean'); $this->form_validation->set_rules('born_date', 'Tanggal Lahir', 'trim|required|xss_clean'); $this->form_validation->set_rules('status', 'Status', 'trim|xss_clean'); $this->form_validation->set_rules('phone', 'Telepon', 'trim|required|xss_clean'); // $this->form_validation->set_rules('email', 'Email', 'trim|xss_clean|valid_email'); // $this->form_validation->set_rules('expired', 'Tanggal Expired', 'trim|required|xss_clean'); if ($this->form_validation->run() == FALSE) { echo "0|" . warn_msg(validation_errors()); } else { //save data $id = $this->input->post('id'); unset($param['id']); if (is_numeric($id)) { $where = array('id' => $id); $save = $this->mp->replace('atombizz_customers', $param, $where); } else { $where = array('code' => $param['code']); $exist = $this->mp->total('atombizz_customers', $where, $like = null, $field = null); if ($exist <= 0) { $save = $this->mp->write('atombizz_customers', $param); } else { $save = FALSE; } } if ($save == TRUE) { echo "1|" . succ_msg("Data Pelanggan berhasil disimpan"); } else { echo "0|" . err_msg("Gagal, coba ulangi sekali lagi."); } } }
public function retur_in_produk() { $param = $this->input->post(); $basmalah = $this->config->item('astro'); $param['branch_code'] = $basmalah['bas_branch_code']; $param['branch_name'] = $basmalah['bas_branch_name']; $this->load->library('form_validation'); $this->form_validation->set_rules('quantity', 'Quantity', 'trim|required|numeric|xss_clean'); if ($this->form_validation->run() == FALSE) { //tidak memenuhi validasi echo "0|" . warn_msg(validation_errors()); } else { $qty = $this->mp->get_qty($param); // print_r($qty);exit; if ($param['quantity'] > $qty) { echo "0|" . err_msg("Gagal, jumlah barang melebihi barang yang telah dibeli."); } else { //save data $ident = $this->input->post('ident'); unset($param['ident']); if (is_numeric($ident)) { $where = array('id' => $ident); $save = $this->mp->replace('atombizz_retur_in_tmp', $param, $where); } else { $where = array('product_code' => $param['product_code'], 'reference' => $param['reference']); $exist = $this->mp->total('atombizz_retur_in_tmp', $where); if ($exist <= 0) { $save = $this->mp->write('atombizz_retur_in_tmp', $param); } else { $save = FALSE; $data = 'exist'; } } if ($save == TRUE) { echo "1|" . succ_msg("Produk berhasil ditambahkan"); } else { if ($data == 'exist') { echo "0|" . err_msg("Gagal, data produk sudah ada."); } else { echo "0|" . err_msg("Gagal, coba periksa lagi inputan anda."); } } } } }
public function tutup_cashdraw($value = '') { $param = $this->input->post(); $this->load->library('form_validation'); $this->form_validation->set_rules('end_cash', 'Nominal Kas Ahir', 'trim|required|numeric|xss_clean'); if ($this->form_validation->run() == FALSE) { echo "0|" . warn_msg(validation_errors()); } else { $checkout = date('H:i:s'); // $param['status'] = 'no'; $omset = $this->mk->get_omset($param['id']); $start_cash = $this->mk->get_start_cash($param['code']); $total_cash = $start_cash + $this->mk->get_kas($param['id']); $update = array('checkout' => $checkout, 'end_cash' => $param['end_cash'], 'omset' => $omset, 'total_cash' => $total_cash, 'status' => 'no'); $save = $this->mk->replace('atombizz_cashdraw', $update, array('code' => $param['code'])); // echo $this->db->last_query();exit; if ($save) { $this->print_setoran($param['code']); echo '1'; } else { echo '0'; } } }
public function input_transaksi_bayar() { $param = $this->input->post(); $config = $this->config->item('astro'); $this->load->library('form_validation'); $this->form_validation->set_rules('tanggal', 'Tanggal Pembayaran', 'trim|required|xss_clean'); $this->form_validation->set_rules('person', 'Pelanggan', 'trim|required|xss_clean'); $this->form_validation->set_rules('faktur', 'Faktur', 'trim|required|xss_clean'); $this->form_validation->set_rules('nominal', 'Jumlah di Bayar', 'trim|required|numeric|xss_clean'); if ($this->form_validation->run() == FALSE) { echo "0|" . warn_msg(validation_errors()); } else { $data = array('kode' => $param['kode'], 'no_referensi' => $param['no_referensi'], 'tanggal' => $param['tanggal'], 'keterangan' => 'Pembayaran Piutang pada faktur ' . $param['faktur'], 'dept' => $config['bas_code_dept'], 'person' => $param['person'], 'valid' => 'yes'); //kas $data['debit'] = $param['nominal']; $data['kredit'] = 0; $data['no_akun'] = '110000'; $kas_acc = $this->mp->write('atombizz_accounting_buku_besar', $data); //piutang $data['debit'] = 0; $data['kredit'] = $param['nominal']; $data['no_akun'] = '140000'; $data['urut'] = $param['urut']; $data['faktur'] = $param['faktur']; $biaya_acc = $this->mp->write('atombizz_accounting_buku_besar', $data); if ($kas_acc && $biaya_acc) { echo "1|" . succ_msg("Transaksi berhasil ditambahkan"); } else { echo "0|" . err_msg("Gagal, coba periksa lagi inputan anda."); } } }
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."); } } }
public function retur_out_produk() { $param = $this->input->post(); $this->load->library('form_validation'); $this->form_validation->set_rules('qty_dikirim', 'Quantity', 'trim|required|numeric|xss_clean'); if ($this->form_validation->run() == FALSE) { //tidak memenuhi validasi echo "0|" . warn_msg(validation_errors()); } else { $replace = $this->mp->replace('atombizz_distribution_items', array('quantity' => $param['qty_dikirim'], 'unit' => $param['unit']), array('id' => $param['ident'])); if ($replace == TRUE) { echo '1|' . succ_msg('Berhasil merubah qty'); } else { echo '0|' . err_msg('Gagal merubah qty'); } } }
public function mencari() { $param = $this->input->post(); $this->load->library('form_validation'); // $this->form_validation->set_rules('category', 'Filter', 'trim|required|xss_clean'); $this->form_validation->set_rules('keyword', 'Kata Kunci', 'trim|required|xss_clean'); if ($this->form_validation->run() == FALSE) { //tidak memenuhi validasi echo "0|" . warn_msg(validation_errors()); } else { //save data // $save = $this->mp->find('atombizz_customers',NULL,NULL,NULL,NULL,FALSE, $like = FALSE); $save = $this->mp->mencari($param['keyword']); if ($save->num_rows() > 0) { $list = ''; foreach ($save->result() as $data) { $list .= ' <a href="' . base_url() . 'master/rak_gudang/detail/' . $data->id . '" class="list-group-item" > <img src="' . base_url() . 'public/img/template/avatar2.jpg" alt="Avatar" class="media-object pull-left" width="50" height="50"> <h4 class="list-group-item-heading" style="padding-left:60px; max-width:70%;">' . $data->nama . '</h4> <h5 class="list-group-item-heading" style="padding-left:60px; min-height: 22px;">' . $data->status . ' ' . $data->kode . '</h5> </a> '; } echo '1|' . $list; } else { $list = ' <a href="javascript:void(0)" class="list-group-item" > <img src="' . base_url() . 'public/img/template/avatar2.jpg" alt="Avatar" class="media-object pull-left" width="50" height="50"> <h4 class="list-group-item-heading" style="padding-left:60px; max-width:70%;">Tidak Ada Hasil Pencarian</h4> <h5 class="list-group-item-heading" style="padding-left:60px; min-height: 22px;">Silahkan Anda masukkankan kata kunci pada kolom search.</h5> </a> '; echo '1|' . $list; } } }
public function add() { $param = $this->input->post(); $this->load->library('form_validation'); $this->form_validation->set_rules('qty', 'Jumlah', 'trim|required|xss_clean'); $this->form_validation->set_rules('menu', 'Menu', 'trim|required|xss_clean'); if ($this->form_validation->run() == FALSE) { //tidak memenuhi validasi echo '0|' . warn_msg(validation_errors()); } else { $menu = explode('|', $param['menu']); $param['id_menu'] = $menu[0]; $param['harga'] = $menu[1]; $param['hpp'] = $menu[2]; // print_r($param);exit(); $result = $this->ksr->add_pesanan($param); if ($result > 0) { echo "1|" . succ_msg("Data berhasil ditambahkan"); } else { echo "0|" . err_msg("Gagal, coba ulangi sekali lagi."); } } }
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.'); } } } }