/** * POST /item * */ public function s003() { $req = App::request(); if ($req->isPost()) { $post = $req->post(); if (!empty($post["item_kode"])) { $attributes = array("item_kode" => $post["item_kode"], "item_nama" => $post["item_nama"], "keterangan" => $post["keterangan"], "item_uom" => $post["item_uom"], "item_principal" => $post["item_principal"], "item_grup" => $post["item_grup"], "barcode" => $post["barcode"], "default_gudang" => $post["default_gudang"], "min_order_qty" => $post["min_order_qty"], "re_order_qty" => $post["re_order_qty"], "re_order_level" => $post["re_order_level"], "has_batch_no" => 0, "is_obat" => ZiUtil::check_bool_int($post["is_obat"]), "disabled" => ZiUtil::check_bool_int($post["disabled"])); $table = Item::table(); if (is_null($post["gen_id"]) || $post["gen_id"] == "") { $attributes["id"] = "ITEM-" . ZiUtil::GetNowID(); $table->insert($attributes); } else { $where = "id = '" . $post["gen_id"] . "'"; $table->update($attributes, $where); } App::flash('info', 'Data Tersimpan.'); App::redirect('item.index'); } } App::flash('error', 'Terjadi kesalahan pada inputan anda.'); App::redirect('item.a001'); }