/** * POST /pricelist * */ public function s003() { $req = App::request(); if ($req->isPost()) { $post = $req->post(); if (!empty($post["price_list_nama"])) { $attributes = array("price_list_nama" => $post["price_list_nama"], "kode_invoice" => $post["kode_invoice"], "currency" => "IDR", "aktif" => isset($post["aktif"]) ? 1 : 0, "pembelian" => isset($post["pembelian"]) ? 1 : 0, "penjualan" => isset($post["penjualan"]) ? 1 : 0); $table = PriceList::table(); if (is_null($post["gen_id"]) || $post["gen_id"] == "") { $table->insert($attributes); } else { $where = "price_list_nama = '" . $post["gen_id"] . "'"; $table->update($attributes, $where); } App::flash('info', 'Data Tersimpan.'); App::redirect('pricelist.index'); } } App::flash('error', 'Terjadi kesalahan pada inputan anda.'); App::redirect('pricelist.a001'); }