Example #1
0
 /**
  * POST /batch
  *
  */
 public function s003()
 {
     $req = App::request();
     if ($req->isPost()) {
         $post = $req->post();
         if (!empty($post["item_kode"]) && !empty($post["batch_kode"])) {
             $attributes = array("item_kode" => $post["item_kode"], "item" => $post["item"], "keterangan" => $post["keterangan"], "expiry_date" => $post["expiry_date"]);
             $table = Batch::table();
             if (is_null($post["gen_id"]) || $post["gen_id"] == "") {
                 $attributes["id"] = $post["batch_kode"];
                 $table->insert($attributes);
             } else {
                 $where = "id = '" . $post["gen_id"] . "'";
                 $table->update($attributes, $where);
             }
             App::flash('info', 'Data Tersimpan.');
             App::redirect('batch.index');
         }
     }
     App::flash('error', 'Terjadi kesalahan pada inputan anda.');
     App::redirect('batch.a001');
 }