Example #1
0
 /**
  * Create
  */
 public function action_create($id = null)
 {
     if (Input::method() == 'POST') {
         $docmk = Model_DocMK::forge(array('mk_no' => Input::post('mk_no'), 'mk_date' => Input::post('mk_date'), 'client_id' => Input::post('client_id'), 'client_po' => Input::post('client_po'), 'deliver_date' => Input::post('deliver_date'), 'deliver_to' => Input::post('deliver_to'), 'is_delivered' => Input::post('is_delivered'), 'product_type' => Input::post('product_type'), 'belt_type' => Input::post('belt_type'), 'belt_color' => Input::post('belt_color'), 'belt_width' => Input::post('belt_width'), 'belt_width_unit' => Input::post('belt_width_unit'), 'belt_ply' => Input::post('belt_ply'), 'belt_ep' => Input::post('belt_ep'), 'belt_grade' => Input::post('belt_grade'), 'belt_top_grade' => Input::post('belt_top_grade'), 'belt_bot_grade' => Input::post('belt_bot_grade'), 'belt_thick' => Input::post('belt_thick'), 'belt_top_thick' => Input::post('belt_top_thick'), 'belt_bot_thick' => Input::post('belt_bot_thick'), 'belt_length' => Input::post('belt_length'), 'belt_length_unit' => Input::post('belt_length_unit'), 'belt_end' => Input::post('belt_end'), 'belt_qty' => Input::post('belt_qty'), 'belt_price' => Input::post('belt_price'), 'belt_disc1' => Input::post('belt_disc1'), 'belt_disc2' => Input::post('belt_disc2'), 'belt_disc3' => Input::post('belt_disc3'), 'belt_price_net' => Input::post('belt_price_net'), 'belt_amount' => Input::post('belt_amount'), 'remark' => Input::post('remark'), 'creator_id' => Input::post('creator_id'), 'creator_name' => Input::post('creator_name'), 'status' => Input::post('status')));
         if ($docmk and $docmk->save()) {
             Session::set_flash('notice', 'Added docmk #' . $docmk->id . '.');
             Response::redirect('docmk');
         } else {
             Session::set_flash('notice', 'Could not save docmk.');
         }
     }
     $this->template->page_title = "New Doc MK";
     $this->template->content = View::forge('docmk/create');
 }
Example #2
0
 protected function get_post_data($docmk = null)
 {
     $is_new = false;
     if (!isset($docmk)) {
         $docmk = array();
         $is_new = true;
     }
     $user = Auth::instance()->get_user_id();
     $screen_name = Auth::instance()->get_screen_name();
     $docmk['mk_no'] = Input::post('mk_no');
     $docmk['last_docno'] = Input::post('last_docno');
     $docmk['mk_date'] = Petro::to_db_date(Input::post('mk_date'));
     $docmk['client_id'] = Input::post('client_id');
     $docmk['client_po'] = Input::post('client_po');
     $docmk['delivery_date'] = Petro::to_db_date(Input::post('delivery_date'));
     $docmk['deliver_to'] = Input::post('deliver_to');
     $docmk['product_type'] = Input::post('product_type');
     $docmk['belt_type'] = Input::post('belt_type');
     $docmk['belt_color'] = Input::post('belt_color');
     $docmk['belt_color'] == 3 and $docmk['belt_color_other'] = Input::post('belt_color_other');
     $docmk['belt_width'] = Input::post('belt_width');
     $docmk['belt_width_unit'] = Input::post('belt_width_unit');
     $docmk['belt_ply'] = Input::post('belt_ply');
     $docmk['belt_ep'] = Input::post('belt_ep');
     $docmk['belt_grade'] = Input::post('belt_grade');
     $docmk['belt_top_grade'] = Input::post('belt_top_grade');
     $docmk['belt_bot_grade'] = Input::post('belt_bot_grade');
     $docmk['belt_thick'] = Input::post('belt_thick');
     $docmk['belt_top_thick'] = Input::post('belt_top_thick');
     $docmk['belt_bot_thick'] = Input::post('belt_bot_thick');
     $docmk['belt_length'] = Input::post('belt_length');
     $docmk['belt_length_unit'] = Input::post('belt_length_unit');
     $docmk['belt_end'] = Input::post('belt_end');
     $docmk['belt_qty'] = Input::post('belt_qty');
     $docmk['belt_price'] = Input::post('belt_price');
     $docmk['belt_disc1'] = Input::post('belt_disc1');
     $docmk['belt_disc2'] = Input::post('belt_disc2');
     $docmk['belt_disc3'] = Input::post('belt_disc3');
     $docmk['belt_price_net'] = Input::post('belt_price_net');
     $docmk['belt_amount'] = Input::post('belt_amount');
     $docmk['remark'] = Input::post('remark');
     $docmk['creator_id'] = $user[1];
     $docmk['creator_name'] = $screen_name;
     $docmk['status'] = Input::post('status');
     return $is_new ? Model_DocMK::forge($docmk) : $docmk;
 }