Esempio n. 1
0
 function edit($id = '')
 {
     if ($id == '') {
         $id = get_user_id();
     }
     $this->data['page_title'] = 'Edit Profile';
     if ($_POST) {
         if (!is_super_admin()) {
             $_POST['branch_id'] = get_branch_id();
         }
         if ($this->process_form($id)) {
             $message = array('msg_type' => 'success', 'msg_text' => lang('global_accounts_edit_success_msg'));
             $this->session->set_flashdata("message", $message);
             redirect('/accounts');
         }
     } else {
         unset($this->form_validation);
         $_POST = $this->users->get_user_by_id($id);
         if (!is_super_admin() && $_POST['branch_id'] != get_branch_id()) {
             redirect('accounts/');
         }
     }
     $this->template->write_view('content', 'accounts/create', $this->data, FALSE);
     $this->template->render();
 }
Esempio n. 2
0
 function get_all()
 {
     $db = $this->db->from('users u')->join('branches b', 'b.id=u.branch_id', 'left')->select('u.*,b.name as branch');
     if (!is_super_admin()) {
         $db->where('branch_id', get_branch_id());
         $db->where('user_type', 2);
     }
     $query = $db->get();
     return $query->result();
 }
Esempio n. 3
0
 function get_count()
 {
     $db = $this->db->from($this->get_model_name() . " b")->select('count(*) as count');
     if (!is_super_admin()) {
         $db->where('b.branch_id', get_branch_id());
     }
     $query = $db->get();
     $result = $query->result();
     return $result[0]->count;
 }
Esempio n. 4
0
 function create()
 {
     $this->data['page_title'] = $this->titles['create'];
     if ($_POST) {
         $_POST['created_by'] = get_user_id();
         $_POST['modified_by'] = get_user_id();
         $_POST['created_at'] = date('ymdHis');
         $_POST['modified_at'] = date('ymdHis');
         if (!is_super_admin()) {
             $_POST['branch_id'] = get_branch_id();
         }
         if ($this->{$this->model}->process_form()) {
             $message = array('msg_type' => 'success', 'msg_text' => 'Template has been added successfully.');
             $this->session->set_flashdata("message", $message);
             redirect("/{$this->controller}");
         }
     }
     $this->template->write_view('side_menu', "{$this->view}/side_menu");
     $this->template->write_view('content', "{$this->view}/create", $this->data, FALSE);
     $this->template->render();
 }
Esempio n. 5
0
 case 'save_payment':
     $i_payment = $_POST['i_payment'];
     $i_change = $_POST['i_change'];
     $i_discount = $_POST['i_discount'];
     $i_discount_persen = $_POST['i_discount_persen'];
     $i_grand_total = $_POST['i_grand_total'];
     $i_payment_method = $_POST['i_payment_method'];
     $i_bank_id = "";
     $i_bank_account = "";
     if ($i_payment_method == 2 || $i_payment_method == 3) {
         $i_bank_id = $_POST['i_bank_id'];
         $i_bank_account = $_POST['i_bank_account'];
     }
     $table_id = $_GET['table_id'];
     $building_id = $_GET['building_id'];
     $branch_id = get_branch_id($building_id);
     $data_total = get_data_total($table_id);
     $total_discount = get_total_discount($table_id);
     //echo $total_discount;
     update_table_status($table_id);
     if ($i_payment < $i_grand_total) {
         header("location: payment.php?table_id={$table_id}&building_id={$building_id}&err=1");
     } else {
         $query = mysql_query("select * \n\t\t\t\t\t\t\t\tfrom transactions_tmp a\n\t\t\t\t\t\t\t\twhere a.table_id = '{$table_id}'\n\t\t\t\t\t\t\t\t");
         // simpan transaksi
         while ($row = mysql_fetch_array($query)) {
             // create settlement
             $get_discount_type = get_discount_type($row['member_id']);
             if ($total_discount > 0 && $get_discount_type == 2) {
                 update_settlement($total_discount, $row['member_id']);
             }