修改离线申请的pdf上传流程

This commit is contained in:
Li Jianxuan 2013-09-09 08:46:54 +00:00
parent 3ae66dd5fb
commit 0e4e1111f5
5 changed files with 88 additions and 54 deletions

View File

@ -1789,7 +1789,6 @@ class DataController extends Zend_Controller_Action
return true;
} elseif ($formData['submit']) {
//提交
//生成PDF
$order->setPdfData($rows);
$s = $order->SubmitOrder($formData);
@ -1816,12 +1815,11 @@ class DataController extends Zend_Controller_Action
if($ac == "commitapplicationform")
{
$this->_helper->viewRenderer->setNoRender();
$offlineappid = $this->_getParam('offlineappid');
if(!is_numeric($offlineappid) || $offlineappid < 1)
{
$this->jsonexit(array('error'=>'参数错误'));
view::Post($this,"参数错误",-1);
return true;
}
@ -1830,9 +1828,9 @@ class DataController extends Zend_Controller_Action
if( $status !== true)
{
$this->jsonexit(array("error"=>$status));
view::Post($this,$status,-1);
}else{
$this->jsonexit(array('success'=>1));
view::Post($this,"申请已提交,请等待管理员接收并通过数据所有者审核",'/data/order/ac/offline3');
}
return true;
@ -1904,6 +1902,9 @@ class DataController extends Zend_Controller_Action
break;
case 'offline2' :
if($v['status'] == 2) $showorders[] = $rows[$k];
$this->view->offlineappid = $v['offlineappid'];
$this->view->applicationform = $v['applicationform'];
$this->view->offlineappstatus = $v['status'];
break;
case 'offline3' :
if($v['status'] == 3 || $v['status'] == 4) $showorders[] = $rows[$k];

View File

@ -44,18 +44,18 @@
<?php if ($this->tabID=='order-offline1') {
echo '<a class="btn btn-primary" href="/data/order/apply/all">提交所有数据</a>一次最多5条';
} elseif ($this->tabID=='order-offline2') {
echo '<a class="btn btn-primary" href="/data/order/pdf/1">提交离线申请</a>';
if(count($this->paginator))
{
if(empty($this->applicationform))
echo '<a class="btn btn-primary" href="/data/order/pdf/1">生成PDF</a> <a class="btn btn-primary" href="javascript:void(0);" onclick="upload.showUploadForm('.$this->offlineappid.');">上传申请表</a>';
else
echo '<a class="btn btn-warning" href="javascript:void(0);" onclick="upload.showUploadForm('.$this->offlineappid.');">重新上传申请表</a>
<a class="btn btn-success" href="/data/order/ac/commitapplicationform/?offlineappid='.$this->offlineappid.'">确认申请</a>';
}
} elseif ($this->tabID=='order-offline3') {
if(count($this->paginator))
{
if(empty($this->applicationform))
echo '<a class="btn btn-primary" href="javascript:void(0);" onclick="upload.showUploadForm('.$this->offlineappid.');">上传申请表</a>';
else
if($this->offlineappstatus == 3)
{
echo '<a class="btn btn-warning" href="javascript:void(0);" onclick="upload.showUploadForm('.$this->offlineappid.');">重新上传申请表</a> ';
echo '<a class="btn btn-success" href="javascript:void(0);" onclick="commit('.$this->offlineappid.');">确认申请</a>';
}
echo "请等待审核";
}
} elseif ($this->tabID=='order-offline4') {
echo '通过时间';
@ -76,39 +76,38 @@ if ($this->tabID=='order-offline1') {
<a href="/data/order/cancel/'.$order['id'].'" class="btn">取消</a>';
} elseif ($this->tabID=='order-offline2') {
switch($order['status']) {
case 2:
echo "请生成PDF申请表";
echo ' <a class="btn" href="/data/order/cancel/'.$order['id'].'">取消</a>';
break;
case 3:
if(!empty($order['applicationform']))
echo '<span class="label label-success">申请表已上传</span>';
else
echo '<span class="label label-warning">请上传申请表</span>';
break;
default:
break;
}
case 2:
if(empty($order['applicationform']))
echo "请生成PDF申请表并上传".' <a class="btn" href="/data/order/cancel/'.$order['id'].'">取消</a>';
else
echo '<span class="label label-success">PDF已上传,请确认提交申请</span>';
break;
case 3:
echo '<span class="label label-success">申请表已上传</span>';
break;
default:
break;
}
} elseif ($this->tabID=='order-offline3') {
switch($order['status']) {
case 3:
if(!empty($order['applicationform']))
echo '<span class="label label-success">申请表已上传</span>';
else
echo '<span class="label label-warning">请上传申请表</span>';
break;
case 4:
if(!empty($order['applicationform']))
{ echo "已收到申请,请等待审批。日期:";echo date('Y-m-d',strtotime($order['ts_received']));}
else
echo '<span class="label label-warning">请上传申请表</span>';
break;
case 5:
echo "已通过申请,请查收邮件";
break;
default:
break;
}
case 3:
if(!empty($order['applicationform']))
echo '<span class="label label-success">申请表已上传</span>';
else
echo '<span class="label label-warning">请上传申请表</span>';
break;
case 4:
if(!empty($order['applicationform']))
{ echo "已收到申请,请等待审批。日期:";echo date('Y-m-d',strtotime($order['ts_received']));}
else
echo '<span class="label label-warning">请上传申请表</span>';
break;
case 5:
echo "已通过申请,请查收邮件";
break;
default:
break;
}
} elseif ($this->tabID=='order-offline4') {
echo date('Y-m-d',strtotime($order['ts_approved']));
}

View File

@ -120,7 +120,13 @@
<input type="submit" name="save" id="savebutton" value="预览PDF" class="btn">
<input type="submit" name="submit" id="submitbutton" value="提交申请到数据中心" class="btn btn-primary">
<input type="submit" name="submit" id="submitbutton" value="生成并下载PDF" class="btn btn-primary">
</div>
</div>
<div class="control-group">
<div class="controls">
<div class="alert alert-success">生成PDF并下载后<a href="/data/order/ac/offline2">在线上传PDF</a>通过Email或者邮寄方式提交的申请将被拒绝</div>
</div>
</div>
</form>

View File

@ -4,6 +4,7 @@ namespace Order;
use Helpers\View as view;
use Mail\Mail;
use Order\listener\OrderListener;
use Files\Output;
class Order
{
@ -242,7 +243,7 @@ class Order
}//SaveOrder
//正式提交
//生成并下载PDF
public function SubmitOrder($formData,$uid = 0)
{
if(empty($uid) || !is_numeric($uid))
@ -277,9 +278,20 @@ class Order
return $data;
}
$this->pushPdfDownload($pdf->pdflink);
return true;
}//SubmitOrder()
public function pushPdfDownload($fn)
{
$output = new Output();
$path = realpath($this->config->offline->savepath);
$content = file_get_contents($path.DIRECTORY_SEPARATOR.$fn);
$output->pushDownload($content,"申请表.pdf",'pdf');
exit();
}
//生成pdf
public function pdfPrint($formData,$userid = 0,$save = false,$returnpdf = false)
{
@ -324,8 +336,8 @@ class Order
//header("Content-Length: " . strlen($pdfstring));
echo $pdf->Output('westdc-data-apply.pdf','S');
}else{
$fn = $formData['realname'].date('YmdHis').".pdf";
//$fn = date('YmdHis').".pdf";
//$fn = $formData['realname'].date('YmdHis').".pdf";
$fn = date('YmdHis').".pdf";
$path = realpath($this->config->offline->savepath);
$pdf->pdflink = $fn;
@$pdf->Output($path.DIRECTORY_SEPARATOR.$fn, 'F');
@ -371,6 +383,20 @@ class Order
return false;
}
$uid = $user->id;
$sql="update dataorder set status=3 where status=2 and userid=$uid and offlineappid=$offlineappid";
if($this->db->exec($sql) < 0)
{
return "数据篮状态更新失败,请重试";
}
$sql = "UPDATE offlineapp SET status=3 WHERE id=$offlineappid ";
if($this->db->exec($sql) < 0)
{
return "数据篮状态更新有误,请联系管理员";
}
$data = array(
"user" => empty($user->realname) ? $user->username : $user->realname,
"link"=> view::getHostLink() . '/admin/down/offlineapps/ac/view/offlineappid/'.$offlineappid
@ -380,6 +406,8 @@ class Order
$mail->loadTemplate("offline-pdf-commited",$data);
$mail->setDefaultTo();
$mail->send();
return true;
}//确认申请
//service_type 选择

View File

@ -64,7 +64,7 @@ class PdfOperate implements \Order\listener\PdfEvents
}
} else {
$id = $dbh->insert($this->tbl_offlineapp,$formData,true);
$this->updateToUserTable($formData,$id);
$this->updateToUserTable($formData,$uid);
if(empty($returnid))
{
if($id > 0)
@ -115,13 +115,13 @@ class PdfOperate implements \Order\listener\PdfEvents
try{
$sql="update dataorder set status=3, offlineappid=$oid where status=2 and userid=$uid";
$sql="update dataorder set offlineappid=$oid where status=2 and userid=$uid";
if($this->db->exec($sql) < 0)
{
return "数据篮状态更新失败,请重试";
}
$sql = "UPDATE offlineapp SET pdflink='".$pdf->pdflink."' WHERE id=$oid ";
$sql = "UPDATE offlineapp SET pdflink='".$pdf->pdflink."',status=2 WHERE id=$oid ";
if($this->db->exec($sql) < 0)
{
return "数据篮状态更新有误,请联系管理员";
@ -143,7 +143,7 @@ class PdfOperate implements \Order\listener\PdfEvents
$data = array(
"user"=>$formData['realname'],
"datalist"=>str_replace(";","\n",$formData['datalist']),
"orderlink"=> view::getHostLink() . '/data/order/ac/offline3'
"orderlink"=> view::getHostLink() . '/data/order/ac/offline2'
);
$mail = new Mail();