芝麻web文件管理V1.00
编辑当前文件:/home/qrafawbu/www/breadwinnerv2/application/controllers/Supplier.php
load->model('supplier_model', 'supplier'); $this->load->library("Aauth"); if (!$this->aauth->is_loggedin()) { redirect('/user/', 'refresh'); } if ($this->aauth->get_user()->roleid < 4) { exit('
Sorry! You have insufficient permissions to access this section
'); } } public function index() { $head['usernm'] = $this->aauth->get_user()->username; $head['title'] = 'Supplier'; $this->load->view('fixed/header', $head); $this->load->view('supplier/clist'); $this->load->view('fixed/footer'); } public function create() { $data['customergrouplist'] = $this->supplier->group_list(); $head['usernm'] = $this->aauth->get_user()->username; $head['title'] = 'Create Supplier'; $this->load->view('fixed/header', $head); $this->load->view('supplier/create', $data); $this->load->view('fixed/footer'); } public function view() { $custid = $this->input->get('id'); $data['details'] = $this->supplier->details($custid); $data['customergroup'] = $this->supplier->group_info($data['details']['gid']); $data['money'] = $this->supplier->money_details($custid); $head['usernm'] = $this->aauth->get_user()->username; $head['title'] = 'View Supplier'; $this->load->view('fixed/header', $head); $this->load->view('supplier/view', $data); $this->load->view('fixed/footer'); } public function load_list() { $list = $this->supplier->get_datatables(); $data = array(); $no = $this->input->post('start'); foreach ($list as $customers) { $no++; $row = array(); $row[] = $no; $row[] = '
' . $customers->name . '
'; $row[] = $customers->address . ',' . $customers->city . ',' . $customers->country; $row[] = $customers->email; $row[] = $customers->phone; $row[] = '
' . $this->lang->line('View') . '
' . $this->lang->line('Edit') . '
'; $data[] = $row; } $output = array( "draw" => $_POST['draw'], "recordsTotal" => $this->supplier->count_all(), "recordsFiltered" => $this->supplier->count_filtered(), "data" => $data, ); //output to json format echo json_encode($output); } //edit section public function edit() { $pid = $this->input->get('id'); $data['customer'] = $this->supplier->details($pid); $data['customergroup'] = $this->supplier->group_info($pid); $data['customergrouplist'] = $this->supplier->group_list(); $head['usernm'] = $this->aauth->get_user()->username; $head['title'] = 'Edit Supplier'; $this->load->view('fixed/header', $head); $this->load->view('supplier/edit', $data); $this->load->view('fixed/footer'); } public function addsupplier() { $name = $this->input->post('name',true); $company = $this->input->post('company',true); $phone = $this->input->post('phone',true); $email = $this->input->post('email',true); $address = $this->input->post('address',true); $city = $this->input->post('city',true); $region = $this->input->post('region',true); $country = $this->input->post('country',true); $postbox = $this->input->post('postbox',true); $taxid = $this->input->post('taxid',true); $this->supplier->add($name, $company, $phone, $email, $address, $city, $region, $country, $postbox,$taxid); } public function editsupplier() { $id = $this->input->post('id'); $name = $this->input->post('name',true); $company = $this->input->post('company',true); $phone = $this->input->post('phone',true); $email = $this->input->post('email',true); $address = $this->input->post('address',true); $city = $this->input->post('city',true); $region = $this->input->post('region',true); $country = $this->input->post('country',true); $postbox = $this->input->post('postbox',true); $taxid = $this->input->post('taxid',true); if ($id) { $this->supplier->edit($id, $name, $company, $phone, $email, $address, $city, $region, $country, $postbox,$taxid); } } public function delete_i() { $id = $this->input->post('deleteid'); if ($this->supplier->delete($id)) { echo json_encode(array('status' => 'Success', 'message' => $this->lang->line('DELETED'))); } else { echo json_encode(array('status' => 'Error', 'message' => $this->lang->line('ERROR'))); } } public function displaypic() { $id = $this->input->get('id'); $this->load->library("uploadhandler", array( 'accept_file_types' => '/\.(gif|jpe?g|png)$/i', 'upload_dir' => FCPATH . 'userfiles/customers/' )); $img = (string)$this->uploadhandler->filenaam(); if ($img != '') { $this->supplier->editpicture($id, $img); } } public function translist() { $cid = $this->input->post('cid'); $list = $this->supplier->trans_table($cid); $data = array(); // $no = $_POST['start']; $no = $this->input->post('start'); foreach ($list as $prd) { $no++; $row = array(); $pid = $prd->id; $row[] = $prd->date; $row[] = amountFormat($prd->debit); $row[] = amountFormat($prd->credit); $row[] = $prd->account; $row[] = $prd->payer; $row[] = $this->lang->line($prd->method); $row[] = '
' . $this->lang->line('View') . '
' . $this->lang->line('Delete') . '
'; $data[] = $row; } $output = array( "draw" => $_POST['draw'], "recordsTotal" => $this->supplier->trans_count_all($cid), "recordsFiltered" => $this->supplier->trans_count_filtered($cid), "data" => $data, ); //output to json format echo json_encode($output); } public function inv_list() { $cid = $this->input->post('cid'); $list = $this->supplier->inv_datatables($cid); $data = array(); $no = $this->input->post('start'); foreach ($list as $invoices) { $no++; $row = array(); $row[] = $no; $row[] = $invoices->tid; $row[] = $invoices->name; $row[] = $invoices->invoicedate; $row[] = amountFormat($invoices->total); $row[] = '
' . $this->lang->line(ucwords($invoices->status)) . '
'; $row[] = '
tid") . '" class="btn btn-success btn-xs">
' . $this->lang->line('View') . '
tid") . '&d=1" class="btn btn-info btn-xs" title="Download">
'; $data[] = $row; } $output = array( "draw" => $_POST['draw'], "recordsTotal" => $this->supplier->inv_count_all($cid), "recordsFiltered" => $this->supplier->inv_count_filtered($cid), "data" => $data, ); //output to json format echo json_encode($output); } public function transactions() { $custid = $this->input->get('id'); $data['details'] = $this->supplier->details($custid); $data['money'] = $this->supplier->money_details($custid); $head['usernm'] = $this->aauth->get_user()->username; $head['title'] = 'View Supplier'; $this->load->view('fixed/header', $head); $this->load->view('supplier/transactions', $data); $this->load->view('fixed/footer'); } public function invoices() { $custid = $this->input->get('id'); $data['details'] = $this->supplier->details($custid); $data['money'] = $this->supplier->money_details($custid); $head['usernm'] = $this->aauth->get_user()->username; $head['title'] = 'View Supplier Invoices'; $this->load->view('fixed/header', $head); $this->load->view('supplier/invoices', $data); $this->load->view('fixed/footer'); } }