���� JFIF �� � ( %"1"%)+...383,7(-.-
![]() Server : Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/7.4.20 System : Linux st2.domain.com 3.10.0-1127.10.1.el7.x86_64 #1 SMP Wed Jun 3 14:28:03 UTC 2020 x86_64 User : apache ( 48) PHP Version : 7.4.20 Disable Function : NONE Directory : /var/www/html/thietkeweb2/code/management/customer/ |
<?php //begin 8-11-2021 $CORE->page_title='Quản lý khách hàng'; $type='list'; if(isset($CORE->input['type']) && $CORE->input['type']!=''){ $type=$CORE->input['type']; } switch ($type){ default: $txt_all = ''; $where = " WHERE customer_id>0 "; $s = array('customer_fullname'=>'','customer_company'=>'','customer_mobile'=>'','customer_email'=>'','customer_status'=>''); $param_search = ''; if(isset($CORE->input['s'])){ $s = $CORE->input['s']; foreach ($s as $key=>$val){ if($val!=''){ $where .= " AND ".$key." LIKE '%".$val."%' "; } } $txt_all = '<a href="index.php?act=management&code=company" class="badge badge-warning">All</a>'; $param_search = http_build_query($s); } $pageNum = isset($_GET['pageNum']) ? intval($_GET['pageNum']) : 1; $pageSize = 50; $from = (($pageNum * $pageSize) - $pageSize); $t = $DB->fetch_row($DB->query("SELECT count(*) as total FROM tb_customer ".$where)); $total = $t['total']; $totalPage = ceil($total / $pageSize); $q_customer = $DB->query("SELECT * FROM tb_customer ".$where." ORDER BY time_update DESC LIMIT $from,$pageSize "); $txt_list=''; while ($r_customer = $DB->fetch_row($q_customer)){ $txt_service = ''; $q_service = $DB->query("SELECT * FROM tb_service WHERE customer_id='".$r_customer['customer_id']."' "); while ($r_service = $DB->fetch_row($q_service)){ $txt_service .= '<a href="?act=management&code=service&s[service_cat]='.$r_service['service_cat'].'">'.$arr_service[$r_service['service_cat']].'</a>,'; } $txt_list .= '<tr><td>'.$r_customer['customer_id'].'</td><td><a href="?act=management&code=customer&type=post&id='.$r_customer['customer_id'].'">'.$r_customer['customer_fullname'].'</a></td><td>'.$r_customer['customer_company'].'</td><td>'.$r_customer['customer_mobile'].'</td><td>'.$r_customer['customer_email'].'</td><td>'.$txt_service.'</td><td><span class="badge badge bg-success"><a href="?act=management&code=service&type=list&s[customer_id]='.$r_customer['customer_id'].'">Dịch vụ</a></span> <span class="badge bg-warning"><a href="?act=management&code=customer&type=post&id='.$r_customer['customer_id'].'">Sửa</a></span> <span class="badge bg-danger"><a href="?act=management&code=customer&type=delete&id='.$r_customer['customer_id'].'" onclick="return confirm(\'Bạn có chắc muốn xóa?\')">Xóa</a></span></td></tr>'; } $nav = $print->Pagination($totalPage,$pageNum,'menu','index.php?act=management&code=customer&'.$param_search); break; case 'post': $v_customer_id = 0; if(isset($CORE->input['id']) && $CORE->input['id']>0){ $v_customer_id = $CORE->input['id']; } if($v_customer_id==0) { $row_check = $DB->get_colum_tb('tb_customer'); $row_check['customer_cmnd_ngaycap'] = date('d-m-Y'); $row_check['customer_ngaysinhnguoilienhe'] = date('d-m-Y'); $row_check['customer_ngaykyniemcongty'] = date('d-m-Y'); }else{ $row_check = $DB->fetch_row($DB->query("SELECT * FROM tb_customer WHERE customer_id='$v_customer_id' ")); $row_check['customer_cmnd_ngaycap'] = date('d-m-Y',strtotime($row_check['customer_cmnd_ngaycap'])); $row_check['customer_ngaysinhnguoilienhe'] = date('d-m-Y',strtotime($row_check['customer_ngaysinhnguoilienhe'])); $row_check['customer_ngaykyniemcongty'] = date('d-m-Y',strtotime($row_check['customer_ngaykyniemcongty'])); } if(isset($CORE->input['submitbt'])){ $f = $CORE->input['f']; $fullname = trim($f['customer_fullname']); $v_name_order = $func->generate_pupil_order($fullname); $cmnd_ngaycap= date('Y-m-d',strtotime($f['customer_cmnd_ngaycap'])); $f['customer_ngaysinhnguoilienhe'] = date('Y-m-d',strtotime($f['customer_ngaysinhnguoilienhe'])); $f['customer_ngaykyniemcongty'] = date('Y-m-d',strtotime($f['customer_ngaykyniemcongty'])); if($f['customer_id']>0){ $DB->query("UPDATE tb_customer SET customer_fullname='".$f['customer_fullname']."',customer_lastname='".$f['customer_lastname']."',customer_gender='".$f['customer_gender']."',customer_company='".$f['customer_company']."',customer_chucvu='".$f['customer_chucvu']."',customer_address='".$f['customer_address']."',customer_email='".$f['customer_email']."',customer_mobile='".$f['customer_mobile']."',customer_sotaikhoan='".$f['customer_sotaikhoan']."',customer_nganhang='".$f['customer_nganhang']."',customer_masothue='".$f['customer_masothue']."',customer_status='".$f['customer_status']."',customer_order='".$f['customer_order']."',city_id='".$f['city_id']."',time_update=NOW(),user_update='".$ob_user->user_name."',customer_cmnd='".$f['customer_cmnd']."',customer_cmnd_ngaycap='".$cmnd_ngaycap."',customer_cmnd_noicap='".$f['customer_cmnd_noicap']."', customer_sodt2='".$f['customer_sodt2']."',customer_nguoilienhe='".$f['customer_nguoilienhe']."',customer_chucvunguoilienhe='".$f['customer_chucvunguoilienhe']."',customer_ngaysinhnguoilienhe='".$f['customer_ngaysinhnguoilienhe']."',customer_ngaykyniemcongty='".$f['customer_ngaykyniemcongty']."',customer_ngaykyniemcongtynote='".$f['customer_ngaykyniemcongtynote']."',customer_ghichucongty='".$f['customer_ghichucongty']."' WHERE customer_id='".$f['customer_id']."' "); $v_customer_id = $f['customer_id']; }else{ $arr_insert = array('customer_fullname'=>$f['customer_fullname'],'customer_lastname'=>$f['customer_lastname'],'customer_gender'=>$f['customer_gender'],'customer_company'=>$f['customer_company'],'customer_chucvu'=>$f['customer_chucvu'],'customer_address'=>$f['customer_address'],'customer_email'=>$f['customer_email'],'customer_mobile'=>$f['customer_mobile'],'customer_sotaikhoan'=>$f['customer_sotaikhoan'],'customer_nganhang'=>$f['customer_nganhang'],'customer_masothue'=>$f['customer_masothue'],'customer_status'=>$f['customer_status'],'customer_order'=>$v_name_order,'city_id'=>$f['city_id'],'time_post'=>date('Y-m-d h:i:s'),'user_post'=>$ob_user->user_name,'time_update'=>date('Y-m-d h:i:s'),'user_update'=>$ob_user->user_name,'customer_cmnd'=>$f['customer_cmnd'],'customer_cmnd_ngaycap'=>$cmnd_ngaycap,'customer_cmnd_noicap'=>$f['customer_cmnd_noicap'],'customer_sodt2'=>$f['customer_sodt2'],'customer_nguoilienhe'=>$f['customer_nguoilienhe'],'customer_chucvunguoilienhe'=>$f['customer_chucvunguoilienhe'],'customer_ngaysinhnguoilienhe'=>$f['customer_ngaysinhnguoilienhe'],'customer_ngaykyniemcongty'=>$f['customer_ngaykyniemcongty'],'customer_ngaykyniemcongtynote'=>$f['customer_ngaykyniemcongtynote'],'customer_ghichucongty'=>$f['customer_ghichucongty']); $v_customer_id=$DB->do_insert('tb_customer',$arr_insert); } $print->refresh('?act=management&code=customer&type=post&id='.$v_customer_id); } break; case 'delete': $v_customer_id = 0; if(isset($CORE->input['id']) && $CORE->input['id']>0){ $v_customer_id = $CORE->input['id']; $row_check = $DB->fetch_row($DB->query("SELECT * FROM tb_service WHERE customer_id='$v_customer_id'")); if($row_check){ $print->refresh('?act=management&code=customer','Khách có quá trình sử dụng dịch vụ, không thể xóa!',5); } $DB->query("DELETE FROM tb_customer WHERE customer_id='$v_customer_id' "); } $print->refresh('?act=management&code=customer','Đã xóa'); break; case 'list_search_customer': $txt_where = ''; $keyword= ''; if(isset($CORE->input['search']) && $CORE->input['search']!=''){ $keyword= trim($CORE->input['search']); } $v_where_clause = " AND customer_id>0 "; if($keyword!=''){ $v_where_clause .= " AND (customer_fullname LIKE '%".$keyword."%' OR customer_company LIKE '%".$keyword."%' OR customer_mobile LIKE '%".$keyword."%' OR customer_email LIKE '%".$keyword."%' OR customer_cmnd LIKE '%".$keyword."%') "; } $pageNum = (isset($_GET['pageNum'])) ? intval($_GET['pageNum']) : 1; $pageSize = 20 ; $from = (($pageNum * $pageSize) - $pageSize); $row_total = $DB->fetch_row($DB->query("SELECT count(*) as total FROM tb_customer WHERE 1 ".$v_where_clause." ")); $total = $row_total['total']; $totalPage = ceil($total/$pageSize); $q_customer = $DB->query("SELECT * FROM tb_customer WHERE 1 ".$v_where_clause." ORDER BY time_update DESC LIMIT $from,$pageSize "); while ($r_customer = $DB->fetch_row($q_customer)) { $list_customer['id'] = $r_customer['customer_id']; if($r_customer['customer_company']!='') { $list_customer['text'] = $r_customer['customer_fullname'] . ' - ' . $r_customer['customer_company']; }else{ $list_customer['text'] = $r_customer['customer_fullname'] . ' - ' . $r_customer['customer_cmnd']; } $list['results'][] = $list_customer; } if(!empty($list['results'])) { $list['pagination']['more'] = true; }else{ $list['pagination']['more'] = false; } echo json_encode($list); exit(); break; } include ROOT_PATH . 'include/block/header.php'; ?> <div class="content-wrapper"> <!-- Content Header (Page header) --> <section class="content-header"> <div class="container-fluid"> <div class="row"> <div class="col-sm-12"> <ol class="breadcrumb float-sm-right"> <li class="breadcrumb-item"><a href="?">Home</a></li> <li class="breadcrumb-item active"><a href="?act=management&code=customer&type=list">Khách hàng</a></li> </ol> </div> </div> </div><!-- /.container-fluid --> </section> <!-- Main content --> <section class="content"> <div class="container-fluid"> <div class="row"> <div class="col-md-12"> <!--<ul class="nav nav-tabs"> <li class="nav-item"> <a class="nav-link active" href="?act=management&code=customer&type=list">Khách hàng</a> </li> <li class="nav-item"> <a class="nav-link" href="?act=management&code=customer&type=service">Dịch vụ khách hàng</a> </li> </ul>--> <?php if($type=='list'){ ?> <div class="card"> <div class="card-header"> <h3 class="card-title">Khách hàng</h3> <div class="card-tools"><a href="?act=management&code=customer&type=post" class="btn btn-info"><i class="fas fa-user-plus"></i> Thêm mới khách hàng</a></div> </div> <!-- /.card-header --> <div class="card-body"> <form action="?" method="get"> <input type="hidden" name="act" value="management"> <input type="hidden" name="code" value="customer"> <div class="row"> <div class="col-md-12"> <div class="row"> <div class="col-2"> <div class="form-group"> <label>Tên khách hàng:</label> <input type="text" name="s[customer_fullname]" class="form-control" value=""> </div> </div> <div class="col-2"> <div class="form-group"> <label>Công ty:</label> <input type="text" name="s[customer_company]" class="form-control" value=""> </div> </div> <div class="col-2"> <div class="form-group"> <label>Điện thoại:</label> <input type="text" name="s[customer_mobile]" class="form-control" value=""> </div> </div> <div class="col-2"> <div class="form-group"> <label>Email:</label> <input type="text" name="s[customer_email]" class="form-control" value=""> </div> </div> <div class="col-2"> <div class="form-group"> <label>Tình trạng:</label> <select class="form-control" name="s[customer_status]"> <option value="1">Kích hoạt</option> <option value="2">Hủy kích hoạt</option> </select> </div> </div> <div class="col-1"> <div class="input-group-append"> <button type="submit" class="btn btn-small btn-success pull-right mt-4"> <i class="fa fa-search"></i> </button> </div> </div> </div> </div> </div> </form> <table class="table table-bordered"> <thead> <tr> <th style="width: 10px">#</th> <th>Tên khách hàng</th> <th>Công ty</th> <th>Điện thoại</th> <th>Email</th> <th>Dịch vụ sử dụng</th> <th>Tác vụ</th> </tr> </thead> <tbody> <?php echo $txt_list;?> </tbody> </table> </div> <!-- /.card-body --> <div class="card-footer clearfix"> <ul class="pagination pagination-sm m-0 float-right"> <?php echo $nav;?> </ul> </div> </div> <?php } ?> <?php if($type=='post'){ ?> <div class="card card-warning"> <div class="card-header"> <h3 class="card-title">Thông tin khách hàng</h3> </div> <!-- /.card-header --> <div class="card-body"> <form action="?act=management&code=customer&type=post" method="post"> <input type="hidden" name="f[customer_id]" value="<?php echo $row_check['customer_id'];?>"> <div class="row"> <div class="col-sm-6"> <!-- text input --> <div class="form-group"> <label>Họ tên</label> <input type="text" class="form-control" name="f[customer_fullname]" value="<?php echo $row_check['customer_fullname'];?>" required> </div> </div> <div class="col-sm-6"> <div class="form-group"> <label>Tên</label> <input type="text" class="form-control" name="f[customer_lastname]" value="<?php echo $row_check['customer_lastname'];?>" required> </div> </div> </div> <div class="row"> <div class="col-sm-6"> <!-- textarea --> <div class="form-group"> <label>Ông/Bà</label> <select class="form-control" name="f[customer_gender]"> <option value="1" <?php if($row_check['customer_gender']==1){ echo 'selected';};?>>Ông</option> <option value="2" <?php if($row_check['customer_gender']==2){ echo 'selected';};?>>Bà</option> </select> </div> </div> <div class="col-sm-6"> <div class="form-group"> <label>Công ty</label> <textarea class="form-control" rows="1" placeholder="" name="f[customer_company]"><?php echo $row_check['customer_company'];?></textarea> </div> </div> </div> <div class="row"> <div class="col-sm-6"> <!-- text input --> <div class="form-group"> <label>Chức vụ</label> <input type="text" class="form-control" name="f[customer_chucvu]" value="<?php echo $row_check['customer_chucvu'];?>"> </div> </div> <div class="col-sm-6"> <div class="form-group"> <label>Địa chỉ</label> <textarea class="form-control" rows="1" placeholder="" name="f[customer_address]" required><?php echo $row_check['customer_address'];?></textarea> </div> </div> </div> <div class="row"> <div class="col-sm-6"> <div class="form-group"> <label>Email</label> <input type="email" class="form-control" name="f[customer_email]" value="<?php echo $row_check['customer_email'];?>"> </div> </div> <div class="col-sm-6"> <div class="form-group"> <label>Mobile</label> <input type="text" class="form-control" name="f[customer_mobile]" value="<?php echo $row_check['customer_mobile'];?>"> </div> </div> </div> <div class="row"> <div class="col-sm-4"> <div class="form-group"> <label>CMND</label> <input type="text" class="form-control" name="f[customer_cmnd]" value="<?php echo $row_check['customer_cmnd'];?>"> </div> </div> <div class="col-sm-4"> <div class="form-group"> <label>Ngày cấp</label> <input type="text" class="form-control" name="f[customer_cmnd_ngaycap]" value="<?php echo $row_check['customer_cmnd_ngaycap'];?>"> </div> </div> <div class="col-sm-4"> <div class="form-group"> <label>Nơi cấp</label> <input type="text" class="form-control" name="f[customer_cmnd_noicap]" value="<?php echo $row_check['customer_cmnd_noicap'];?>"> </div> </div> </div> <div class="row"> <div class="col-sm-6"> <div class="form-group"> <label>Số tài khoản</label> <input type="text" class="form-control" name="f[customer_sotaikhoan]" value="<?php echo $row_check['customer_sotaikhoan'];?>"> </div> </div> <div class="col-sm-6"> <div class="form-group"> <label>Ngân hàng</label> <input type="text" class="form-control" name="f[customer_nganhang]" value="<?php echo $row_check['customer_nganhang'];?>"> </div> </div> </div> <div class="row"> <div class="col-sm-4"> <div class="form-group"> <label>Mã số thuế</label> <input type="text" class="form-control" name="f[customer_masothue]" value="<?php echo $row_check['customer_masothue'];?>"> </div> </div> <div class="col-sm-4"> <div class="form-group"> <label>Tỉnh/thành</label> <select class="form-control" name="f[city_id]"> <?php echo op_city($row_check['city_id']);?> </select> </div> </div> <div class="col-sm-4"> <div class="form-group"> <label>Status</label> <select class="form-control" name="f[customer_status]"> <option value="1" <?php if($row_check['customer_status']==1){ echo 'selected';};?>>Kích hoạt</option> <option value="2" <?php if($row_check['customer_status']==2){ echo 'selected';};?>>Hủy kích hoạt</option> </select> </div> </div> </div> <div class="row"> <div class="col-sm-4"> <div class="form-group"> <label>Số điện thoại 2</label> <input type="text" class="form-control" name="f[customer_sodt2]" value="<?php echo $row_check['customer_sodt2'];?>"> </div> </div> <div class="col-sm-4"> <div class="form-group"> <label>Người liên hệ</label> <input type="text" class="form-control" name="f[customer_nguoilienhe]" value="<?php echo $row_check['customer_nguoilienhe'];?>"> </div> </div> <div class="col-sm-4"> <div class="form-group"> <label>Chức vụ người liên hệ</label> <input type="text" class="form-control" name="f[customer_chucvunguoilienhe]" value="<?php echo $row_check['customer_chucvunguoilienhe'];?>"> </div> </div> </div> <div class="row"> <div class="col-sm-4"> <div class="form-group"> <label>Ngày sinh người liên hệ</label> <input type="text" class="form-control mydatepicker" name="f[customer_ngaysinhnguoilienhe]" value="<?php echo $row_check['customer_ngaysinhnguoilienhe'];?>"> </div> </div> <div class="col-sm-4"> <div class="form-group"> <label>Ngày kỷ niệm công ty</label> <input type="text" class="form-control mydatepicker" name="f[customer_ngaykyniemcongty]" value="<?php echo $row_check['customer_ngaykyniemcongty'];?>"> </div> </div> <div class="col-sm-4"> <div class="form-group"> <label>Ghi chú ngày kỷ niệm công ty</label> <textarea class="form-control" rows="2" placeholder="" name="f[customer_ngaykyniemcongtynote]"><?php echo $row_check['customer_ngaykyniemcongtynote'];?></textarea> </div> </div> </div> <div class="row"> <div class="col-sm-12"> <div class="form-group"> <label>Ghi chú công ty</label> <textarea id="show_ckeditor" name="f[customer_ghichucongty]"><?php echo $row_check['customer_ghichucongty'];?></textarea> </div> </div> </div> <button type="submit" class="btn btn-primary" name="submitbt">Submit</button> </form> </div> <!-- /.card-body --> </div> <?php } ?> </div> </div> </div><!-- /.container-fluid --> </section> <!-- /.content --> </div> <?php include ROOT_PATH . 'include/block/footer.php'; ?>