Example #1
0
 public function view_excelOutPut()
 {
     require_once WEB_PATH . "lib/php-export-data.class.php";
     //$fileName = "pic".$startTimeDate.'_'.$endTimeDate.".xls";
     $starttime = $_GET['startdate'] ? $_GET['startdate'] : '';
     $endtime = $_GET['enddate'] ? $_GET['enddate'] : "";
     $scanuser = $_GET['scanuser'] ? $_GET['scanuser'] : "";
     $pictype = $_GET['pic_type'];
     $pic_status = $_GET['pic_status'];
     //$auditUser		=	$_GET['userName']?$_GET['userName']:"";
     if (empty($starttime)) {
         $status = "开始时间不能为空";
     }
     if (empty($endtime)) {
         $status = "结束时间不能为空";
     }
     if ($endtime < $starttime) {
         $status = "结束时间不能大于开始时间";
     }
     if (!empty($starttime)) {
         $starttime = strtotime($starttime);
     }
     if (!empty($endtime)) {
         $endtime = strtotime($endtime);
     }
     $pictureAct = new PictureAuditAct();
     $picdata = $pictureAct->act_excelouput($starttime, $endtime, $scanuser, $pictype, $pic_status);
     //var_dump($picdata);exit;
     if ($picdata) {
         $fileName = "picdata_" . date("Y-m-d H:i", time()) . ".xls";
         $excel = new ExportDataExcel('browser', $fileName);
         //$excel = new ExportDataExcel('file', $fileName);
         $excel->initialize();
         $tableHeader = array('订单号', '拍照人', '拍照类型', '状态', '审核人', '拍照时间');
         $excel->addRow($tableHeader);
         //添加表头
         $totalRows = array();
         foreach ($picdata as $row) {
             if ($row['audit_status'] == 0) {
                 $row['audit_status'] = '不合格';
             }
             if ($row['audit_status'] == 1) {
                 $row['audit_status'] = '合格';
             }
             if ($row['picture_type'] == 'fh') {
                 $row['picture_type'] = '复核';
             }
             if ($row['picture_type'] == 'cz') {
                 $row['picture_type'] = '称重';
             }
             $row['scantime'] = date("Y/m/d H:i", "{$row['scantime']}");
             $excel->addRow($row);
         }
         $excel->finalize();
         exit;
         $status = "导出成功";
     } else {
         echo "出错了!";
     }
 }
Example #2
0
 public function act_updatePictureAudit()
 {
     //'status':flag,'ordersn':ordersn,'audituser':audituser,'scanuser':scanuser
     $status = $_POST['status'];
     $ordersn = $_POST['ordersn'];
     $audituser = $_POST['audituser'];
     $scanuser = $_POST['scanuser'];
     $time = strtotime(date('Y-m-d H:i:s', time()));
     $scantime = $_POST['scantime'];
     $stype = $_POST['stype'];
     //echo $audituser."-".$ordersn."-".$scanuser."-".$status;exit;
     if (PictureAuditModel::isaudit($ordersn, $stype) == 2) {
         $returnmsg = PictureAuditModel::insertAudit($ordersn, $status, $audituser, $scanuser, $time, $scantime, $stype);
     } else {
         $returnmsg = PictureAuditModel::updateAudit($ordersn, $status, $audituser, $scanuser, $time);
     }
     if ($returnmsg == false) {
         self::$errCode = PictureAuditModel::$errCode;
         self::$errMsg = PictureAuditModel::$errMsg;
     } else {
         self::$errCode = 200;
     }
     return $returnmsg;
 }