diff --git a/wheeparam/application/controllers/Order.php b/wheeparam/application/controllers/Order.php new file mode 100644 index 0000000..6e0d79a --- /dev/null +++ b/wheeparam/application/controllers/Order.php @@ -0,0 +1,142 @@ +db->select('*'); + $this->db->from('order'); + $this->db->where('active','Y'); + $this->db->order_by('idx DESC'); + $result = $this->db->get()->result_array(); + + $this->data['list'] = $result; + // 레이아웃 & 뷰파일 설정 + $this->theme = $this->site->get_layout(); + $this->view = "/order/index"; + $this->active = "/order/index"; + + + } + + public function view($value) { + $this->db->select('*'); + $this->db->from('order'); + $this->db->where('idx',$value); + $this->db->where('active','Y'); + $this->db->order_by('idx DESC'); + $result = $this->db->get()->row_array(); + + $this->data['list'] = $result; + + if(! $result) { + alert("없는 페이지 입니다"); + exit; + } + // 레이아웃 & 뷰파일 설정 + $this->theme = $this->site->get_layout(); + $this->view = "/order/view"; + $this->active = "/order/view"; + + + } + public function form($value = "") + { //코드이그나이트에 들어있는것 + $this->load->library('form_validation'); + + // 필수 입력되어야 하는 필드 설정 //input name명 + $this->form_validation->set_rules('hu_name', '주문자이름', 'required|min_length[3]'); + $this->form_validation->set_rules('ord_name', '상품명', 'required'); + $this->form_validation->set_rules('pay', '가격', 'required'); + $this->form_validation->set_rules('ord_num', '주문번호', 'required'); + $this->form_validation->set_rules('ord_count', '개수', 'required|numeric'); + $this->form_validation->set_rules('pos_money', '택배비', 'required'); + + + if($this->form_validation->run() != FALSE ) + { + //DB실제컬럼명 <-값을 넣어줌 //input name명 + $od['order_hu_name'] = $this->input->post('hu_name', TRUE); + $od['order_name'] = $this->input->post('ord_name', TRUE); + $od['payment'] = $this->input->post('pay', TRUE); + $od['order_num'] = $this->input->post('ord_num', TRUE); + $od['count'] = $this->input->post('ord_count', TRUE); + $od['post_num'] = $this->input->post('pos_num', TRUE); + $od['post_money'] = $this->input->post('pos_money', TRUE); + $od['point'] = $this->input->post('point', TRUE); + + if( ! $od['order_hu_name']) alert('주문자 이름은 필수입력입니다.'); + + if(empty($value)) { + $od['time'] = date('Y-m-d H:i:s'); + + $this->db->insert('order', $od); + } + else { + + $this->db->where('idx', $value); + $this->db->update('order', $od); + } + + alert('등록되었습니다.', base_url('order/index')); + + } + else + { + $this->data['view'] = array(); + + // $value 가 비어있지 않을경우만 실행 + if( ! empty($value) ) + { + $this->db->select('*'); + $this->db->from('order'); + $this->db->where('idx',$value); + $this->db->where('active','Y'); + $this->db->order_by('idx DESC'); + $result = $this->db->get()->row_array(); + + $this->data['view'] = $result; + + if(! $this->data['view']) + { + + alert("없는 페이지 입니다"); + exit; + } + } + + // 레이아웃 & 뷰파일 설정 + $this->theme = $this->site->get_layout(); + $this->view = "/order/form"; + $this->active = "/order/form"; + + } + + } + + public function remove($value) + { + + $data['active'] = 'N'; + $this->db->where('idx', $value); + //$this->db->set('active','N'); + if( $this->db->update('order',$data)) { + alert('삭제되았습니다..', base_url('order/index')); + + } + else { + alert('삭제에 실패했스비다..', base_url('order/index')); + + } + + + } + + +} \ No newline at end of file diff --git a/wheeparam/application/controllers/order.php b/wheeparam/application/controllers/order.php deleted file mode 100644 index 27674a9..0000000 --- a/wheeparam/application/controllers/order.php +++ /dev/null @@ -1,46 +0,0 @@ -db->select('*'); - $this->db->from('order'); - $this->db->order_by('idx DESC'); - $result = $this->db->get()->result_array(); - - $this->data['list'] = $result; - // 레이아웃 & 뷰파일 설정 - $this->theme = $this->site->get_layout(); - $this->view = "/order/index"; - $this->active = "/order/index"; - - - } - - public function view($getValue="") { - $this->db->select('*'); - $this->db->from('order'); - $this->db->where('idx', $getValue); - $this->db->order_by('idx DESC'); - $result = $this->db->get()->row_array(); - - if(! $result) { - alert("없는 페이지 입니다"); - exit; - - } - // 레이아웃 & 뷰파일 설정 - $this->theme = $this->site->get_layout(); - $this->view = "/order/index"; - $this->active = "/order/index"; - - - } -} \ No newline at end of file diff --git a/wheeparam/views/themes/desktop/order/form.php b/wheeparam/views/themes/desktop/order/form.php new file mode 100644 index 0000000..c73a506 --- /dev/null +++ b/wheeparam/views/themes/desktop/order/form.php @@ -0,0 +1,31 @@ + + + +
주문자명
+
+ +
상품명
+ +
가격
+ +
주문번호
+ +
개수
+ +
운송장번호
+ +
택배비
+ +
포인트
+ + +
+ + + + + + \ No newline at end of file diff --git a/wheeparam/views/themes/desktop/order/index.php b/wheeparam/views/themes/desktop/order/index.php index 55f6975..f2b77a9 100644 --- a/wheeparam/views/themes/desktop/order/index.php +++ b/wheeparam/views/themes/desktop/order/index.php @@ -1,22 +1,31 @@ - +신규등록하기 - - - - - - + + + + + + + + + + + + + + + diff --git a/wheeparam/views/themes/desktop/order/view.php b/wheeparam/views/themes/desktop/order/view.php index b3d9bbc..1d48546 100644 --- a/wheeparam/views/themes/desktop/order/view.php +++ b/wheeparam/views/themes/desktop/order/view.php @@ -1 +1,30 @@ -">수정하기 +
배송확정일주문번호주문자명상품명수량배송
배송확정일주문번호주문자명상품명수량배송수정삭제
수정삭제
+ +

결제상세정보 확인

+ + + + + + + + + + + + + + + + + + + + + + + + + +
신용카드 결제금액  
카드 승인일시
주문 금액 할인
결제취소/환불액
배송비
추가 배송비