本文整理汇总了PHP中warn_msg函数的典型用法代码示例。如果您正苦于以下问题:PHP warn_msg函数的具体用法?PHP warn_msg怎么用?PHP warn_msg使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了warn_msg函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: input_transaksi
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.");
}
}
}
示例2: tambah_stok
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");
}
}
}
示例3: proses_claim
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');
}
}
}
示例4: save
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.');
// }
}
}
示例5: ins_rekening
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.');
}
}
}
示例6: save
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.");
}
}
}
}
示例7: save_konversi
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");
}
}
}
}
示例8: tambah_rak
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");
}
}
}
}
示例9: close_cashdraw
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';
}
}
}
示例10: retur_in_produk
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.");
}
}
}
}
}
示例11: proses_pembelian
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']);
//.........这里部分代码省略.........
示例12: retur_out_produk
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.");
}
}
}
}
}
示例13: tambah
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');
}
}
}
示例14: opname_adjust
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.');
}
}
}
示例15: input_harga
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.");
}
}
}