|
@@ -37,10 +37,14 @@ class InvoiceController extends DooController {
|
|
|
function invoice() {
|
|
|
Doo::loadModel ( 'invoice' );
|
|
|
$invoice = new invoice ();
|
|
|
+ Doo::loadModel ( 'express' );
|
|
|
+ $express = new express ();
|
|
|
|
|
|
- $pendingInvoice = $invoice->getPendingByInvoice ();
|
|
|
+ $expressList = $express->getExpressByAll ();
|
|
|
+ $invoiceList = $invoice->getMyInvoice ( $_COOKIE ["staff"] );
|
|
|
|
|
|
- $data ['pendingInvoice'] = $pendingInvoice;
|
|
|
+ $data ['expressList'] = $expressList;
|
|
|
+ $data ['invoiceList'] = $invoiceList;
|
|
|
|
|
|
$data ['memu'] = "invoice";
|
|
|
$data ['staff'] = $this->staff;
|
|
@@ -131,6 +135,8 @@ class InvoiceController extends DooController {
|
|
|
$moldManage [$value ['mold']] = $value ['staffList'];
|
|
|
elseif ($value ['mold'] == '发票邮寄')
|
|
|
$moldManage [$value ['mold']] = $value ['staffList'];
|
|
|
+ elseif ($value ['mold'] == '发票退票')
|
|
|
+ $moldManage [$value ['mold']] = $value ['staffList'];
|
|
|
}
|
|
|
|
|
|
$item = array (
|
|
@@ -202,6 +208,256 @@ class InvoiceController extends DooController {
|
|
|
|
|
|
return "/invoice";
|
|
|
}
|
|
|
+ function invoiceEdit() {
|
|
|
+ Doo::loadClass ( 'XDeode' );
|
|
|
+ $XDeode = new XDeode ( 5 );
|
|
|
+
|
|
|
+ $iid = isset ( $this->params ['iid'] ) ? $this->params ['iid'] : "";
|
|
|
+ $iid = $XDeode->decode ( $iid );
|
|
|
+ if (! is_numeric ( $iid ))
|
|
|
+ die ( 'illegal request' );
|
|
|
+
|
|
|
+ Doo::loadModel ( 'invoice' );
|
|
|
+ $invoice = new invoice ();
|
|
|
+ Doo::loadModel ( 'invoiceOperationLog' );
|
|
|
+ $invoiceOperationLog = new invoiceOperationLog ();
|
|
|
+
|
|
|
+ $invoiceDetail = $invoice->getInvoiceByIid ( $iid );
|
|
|
+ $operation = $invoiceOperationLog->getInvoiceOperationByDropped ( $iid );
|
|
|
+
|
|
|
+ $data ['operation'] = $operation;
|
|
|
+ $data ['invoiceDetail'] = $invoiceDetail;
|
|
|
+ $data ['memu'] = "invoice";
|
|
|
+ $data ['staff'] = $this->staff;
|
|
|
+ $data ['receiptMemu'] = 'invoiceApproval';
|
|
|
+ $this->render ( "/admin/invoiceEdit", $data );
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 重新编辑退回的发票
|
|
|
+ * @return string
|
|
|
+ */
|
|
|
+ function invoiceEditDo() {
|
|
|
+ $iidKey = $this->get_args ( 'iidKey' ) ? $this->get_args ( 'iidKey' ) : '';
|
|
|
+ Doo::loadModel ( 'invoice' );
|
|
|
+ $invoice = new invoice ();
|
|
|
+ $iid = $invoice->authcode ( $iidKey );
|
|
|
+ if (! empty ( $iid ) && ! is_numeric ( $iid ))
|
|
|
+ die ( 'illegal request' );
|
|
|
+
|
|
|
+ $cid = $this->get_args ( 'cid' ) ? $this->get_args ( 'cid' ) : 0;
|
|
|
+ $invoiceType = $this->get_args ( 'invoiceType' ) && is_numeric ( $this->get_args ( 'invoiceType' ) ) ? $this->get_args ( 'invoiceType' ) : 0;
|
|
|
+ $doPost = $this->get_args ( 'doPost' ) && is_numeric ( $this->get_args ( 'doPost' ) ) ? $this->get_args ( 'doPost' ) : 0;
|
|
|
+ $invoicePrice = $this->get_args ( 'invoicePrice' ) ? $this->get_args ( 'invoicePrice' ) : "";
|
|
|
+ $invoiceElement = $this->get_args ( 'invoiceElement' ) ? $this->get_args ( 'invoiceElement' ) : "";
|
|
|
+ $invoiceTitle = $this->get_args ( 'invoiceTitle' ) ? $this->get_args ( 'invoiceTitle' ) : "";
|
|
|
+ $invoiceCompany = $this->get_args ( 'invoiceCompany' ) ? $this->get_args ( 'invoiceCompany' ) : "";
|
|
|
+ $TIN = $this->get_args ( 'TIN' ) ? $this->get_args ( 'TIN' ) : "";
|
|
|
+ $address = $this->get_args ( 'address' ) ? $this->get_args ( 'address' ) : "";
|
|
|
+ $phone = $this->get_args ( 'phone' ) ? $this->get_args ( 'phone' ) : "";
|
|
|
+ $bank = $this->get_args ( 'bank' ) ? $this->get_args ( 'bank' ) : "";
|
|
|
+ $bankAccount = $this->get_args ( 'bankAccount' ) ? $this->get_args ( 'bankAccount' ) : "";
|
|
|
+ $recipients = $this->get_args ( 'recipients' ) ? $this->get_args ( 'recipients' ) : "";
|
|
|
+ $recipientsPhone = $this->get_args ( 'recipientsPhone' ) ? $this->get_args ( 'recipientsPhone' ) : "";
|
|
|
+ $recipientsAddress = $this->get_args ( 'recipientsAddress' ) ? $this->get_args ( 'recipientsAddress' ) : "";
|
|
|
+
|
|
|
+ $mailItems = $this->get_args ( 'mailItems' ) ? $this->get_args ( 'mailItems' ) : "";
|
|
|
+ $remark = $this->get_args ( 'remark' ) ? $this->get_args ( 'remark' ) : "";
|
|
|
+
|
|
|
+ if (! empty ( $cid ) && ! empty ( $invoicePrice ) && ! empty ( $invoiceElement ) && ! empty ( $iid )) {
|
|
|
+
|
|
|
+ Doo::loadModel ( 'invoiceManage' );
|
|
|
+ $invoiceManage = new invoiceManage ();
|
|
|
+ Doo::loadModel ( 'invoiceOperationLog' );
|
|
|
+ $invoiceOperationLog = new invoiceOperationLog ();
|
|
|
+
|
|
|
+ $cid = explode ( ':', $cid );
|
|
|
+
|
|
|
+ $invoiceManageList = $invoiceManage->getInvoiceByAll ();
|
|
|
+ $invoiceManageDetail = $invoiceManage->getInvoiceByMold ( "发票审批" );
|
|
|
+
|
|
|
+ $moldManage = array ();
|
|
|
+ foreach ( $invoiceManageList as $key => $value ) {
|
|
|
+ if ($value ['mold'] == '发票打印')
|
|
|
+ $moldManage [$value ['mold']] = $value ['staffList'];
|
|
|
+ elseif ($value ['mold'] == '发票邮寄')
|
|
|
+ $moldManage [$value ['mold']] = $value ['staffList'];
|
|
|
+ elseif ($value ['mold'] == '发票打印')
|
|
|
+ $moldManage [$value ['mold']] = $value ['staffList'];
|
|
|
+ }
|
|
|
+
|
|
|
+ $item = array (
|
|
|
+ 'iid' => $iid,
|
|
|
+ 'cid' => $cid [0],
|
|
|
+ 'categoryName' => $cid [1],
|
|
|
+ 'invoiceElement' => $invoiceElement,
|
|
|
+ 'invoicePrice' => $invoicePrice,
|
|
|
+ 'invoiceType' => $invoiceType,
|
|
|
+ 'doPost' => $doPost,
|
|
|
+ 'status' => 1,
|
|
|
+ 'updateTime' => date ( "Y-m-d H:i:s" ),
|
|
|
+ 'remark' => $remark
|
|
|
+ );
|
|
|
+ if ($invoiceType == 0)
|
|
|
+ $item += array (
|
|
|
+ 'invoiceTitle' => $invoiceTitle
|
|
|
+ );
|
|
|
+ else {
|
|
|
+ $item += array (
|
|
|
+ 'invoiceCompany' => $invoiceCompany,
|
|
|
+ 'TIN' => $TIN,
|
|
|
+ 'address' => $address,
|
|
|
+ 'phone' => $phone,
|
|
|
+ 'bank' => $bank,
|
|
|
+ 'bankAccount' => $bankAccount
|
|
|
+ );
|
|
|
+ }
|
|
|
+ if ($doPost == 1) {
|
|
|
+ $item += array (
|
|
|
+ 'recipients' => $recipients,
|
|
|
+ 'recipientsPhone' => $recipientsPhone,
|
|
|
+ 'recipientsAddress' => $recipientsAddress,
|
|
|
+ 'mailItems' => $mailItems
|
|
|
+ );
|
|
|
+ }
|
|
|
+ $invoice->setInvoiceByCondition ( $item );
|
|
|
+
|
|
|
+ $item = array (
|
|
|
+ 'date' => date ( "Y-m-d H:i:s" ),
|
|
|
+ 'operation' => "重新提交审批",
|
|
|
+ 'status' => 1,
|
|
|
+ 'img' => $this->staff [0] ['avatar'],
|
|
|
+ 'username' => $this->staff [0] ['username'],
|
|
|
+ 'uid' => $this->staff [0] ['sid'],
|
|
|
+ 'category' => $this->staff [0] ['category'],
|
|
|
+ 'iid' => $iid
|
|
|
+ );
|
|
|
+ $invoiceOperationLog->setInvoiceOperationLog ( $item );
|
|
|
+ }
|
|
|
+
|
|
|
+ return "/invoice";
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 终止开票
|
|
|
+ */
|
|
|
+ function invoiceDroppedDo() {
|
|
|
+ $droppedIidKey = $this->get_args ( 'droppedIidKey' ) ? $this->get_args ( 'droppedIidKey' ) : '';
|
|
|
+ Doo::loadModel ( 'invoice' );
|
|
|
+ $invoice = new invoice ();
|
|
|
+ Doo::loadModel ( 'invoiceOperationLog' );
|
|
|
+ $invoiceOperationLog = new invoiceOperationLog ();
|
|
|
+
|
|
|
+ $iid = $invoice->authcode ( $droppedIidKey );
|
|
|
+ if (! empty ( $iid ) && ! is_numeric ( $iid ))
|
|
|
+ die ( 'illegal request' );
|
|
|
+
|
|
|
+ $item = array (
|
|
|
+ 'iid' => $iid,
|
|
|
+ 'status' => 4,
|
|
|
+ 'updateTime' => date ( "Y-m-d H:i:s" )
|
|
|
+ );
|
|
|
+ $invoice->setInvoiceByCondition ( $item );
|
|
|
+ $item = array (
|
|
|
+ 'date' => date ( "Y-m-d H:i:s" ),
|
|
|
+ 'operation' => '终止了开票',
|
|
|
+ 'status' => 4,
|
|
|
+ 'img' => $this->staff [0] ['avatar'],
|
|
|
+ 'username' => $this->staff [0] ['username'],
|
|
|
+ 'uid' => $this->staff [0] ['sid'],
|
|
|
+ 'category' => $this->staff [0] ['category'],
|
|
|
+ 'iid' => $iid
|
|
|
+ );
|
|
|
+ $invoiceOperationLog->setInvoiceOperationLog ( $item );
|
|
|
+ return "/invoice";
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 申请退票
|
|
|
+ */
|
|
|
+ function invoiceUntreadDo(){
|
|
|
+ $untreadIidKey = $this->get_args ( 'untreadIidKey' ) ? $this->get_args ( 'untreadIidKey' ) : '';
|
|
|
+ $untreadReason = $this->get_args ( 'untreadReason' ) ? $this->get_args ( 'untreadReason' ) : "";
|
|
|
+ $untreadPost = $this->get_args ( 'untreadPost' ) ? $this->get_args ( 'untreadPost' ) : "";
|
|
|
+ $untreadCompany = $this->get_args ( 'untreadCompany' ) ? $this->get_args ( 'untreadCompany' ) : "";
|
|
|
+ $untreadNumber = $this->get_args ( 'untreadNumber' ) ? $this->get_args ( 'untreadNumber' ) : "";
|
|
|
+ $untreadItems = $this->get_args ( 'untreadItems' ) ? $this->get_args ( 'untreadItems' ) : "";
|
|
|
+
|
|
|
+ Doo::loadModel ( 'invoice' );
|
|
|
+ $invoice = new invoice ();
|
|
|
+ Doo::loadModel ( 'invoiceOperationLog' );
|
|
|
+ $invoiceOperationLog = new invoiceOperationLog ();
|
|
|
+
|
|
|
+ $iid = $invoice->authcode ( $untreadIidKey );
|
|
|
+ if (! empty ( $iid ) && ! is_numeric ( $iid ))
|
|
|
+ die ( 'illegal request' );
|
|
|
+
|
|
|
+ $item = array (
|
|
|
+ 'iid' => $iid,
|
|
|
+ 'untreadStatus' => 1,
|
|
|
+ 'untreadReason' => $untreadReason,
|
|
|
+ 'untreadPost' => $untreadPost,
|
|
|
+ 'updateTime' => date ( "Y-m-d H:i:s" )
|
|
|
+ );
|
|
|
+ if($untreadPost==1){
|
|
|
+ $item += array (
|
|
|
+ 'untreadCompany' => $untreadCompany,
|
|
|
+ 'untreadNumber' => $untreadNumber,
|
|
|
+ 'untreadItems' => $untreadItems
|
|
|
+ );
|
|
|
+ }
|
|
|
+ $invoice->setInvoiceByCondition ( $item );
|
|
|
+ $item = array (
|
|
|
+ 'date' => date ( "Y-m-d H:i:s" ),
|
|
|
+ 'operation' => '申请退票',
|
|
|
+ 'status' => 7,
|
|
|
+ 'img' => $this->staff [0] ['avatar'],
|
|
|
+ 'username' => $this->staff [0] ['username'],
|
|
|
+ 'uid' => $this->staff [0] ['sid'],
|
|
|
+ 'category' => $this->staff [0] ['category'],
|
|
|
+ 'iid' => $iid
|
|
|
+ );
|
|
|
+ $invoiceOperationLog->setInvoiceOperationLog ( $item );
|
|
|
+
|
|
|
+ return "/invoice";
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 删除已终止的开票
|
|
|
+ */
|
|
|
+ function invoiceDelDo() {
|
|
|
+ Doo::loadClass ( 'XDeode' );
|
|
|
+ $XDeode = new XDeode ( 5 );
|
|
|
+ Doo::loadModel ( 'invoice' );
|
|
|
+ $invoice = new invoice ();
|
|
|
+ Doo::loadModel ( 'invoiceOperationLog' );
|
|
|
+ $invoiceOperationLog = new invoiceOperationLog ();
|
|
|
+
|
|
|
+ $iid = isset ( $this->params ['iid'] ) ? $this->params ['iid'] : "";
|
|
|
+ $iid = $XDeode->decode ( $iid );
|
|
|
+
|
|
|
+ if (! is_numeric ( $iid ))
|
|
|
+ die ( 'illegal request' );
|
|
|
+ $invoiceDetail = $invoice->getMyInvoice ( $_COOKIE ["staff"], $iid );
|
|
|
+ if (empty ( $invoiceDetail ))
|
|
|
+ die ( 'illegal request' );
|
|
|
+ $item = array (
|
|
|
+ 'iid' => $iid,
|
|
|
+ 'isDelete' => 1,
|
|
|
+ 'updateTime' => date ( "Y-m-d H:i:s" )
|
|
|
+ );
|
|
|
+ $invoice->setInvoiceByCondition ( $item );
|
|
|
+ $item = array (
|
|
|
+ 'date' => date ( "Y-m-d H:i:s" ),
|
|
|
+ 'operation' => '删除了已终止的发票',
|
|
|
+ 'status' => 4,
|
|
|
+ 'img' => $this->staff [0] ['avatar'],
|
|
|
+ 'username' => $this->staff [0] ['username'],
|
|
|
+ 'uid' => $this->staff [0] ['sid'],
|
|
|
+ 'category' => $this->staff [0] ['category'],
|
|
|
+ 'iid' => $iid
|
|
|
+ );
|
|
|
+ $invoiceOperationLog->setInvoiceOperationLog ( $item );
|
|
|
+ return "/invoice";
|
|
|
+ }
|
|
|
function invoiceApproval() {
|
|
|
Doo::loadModel ( 'invoice' );
|
|
|
$invoice = new invoice ();
|
|
@@ -261,7 +517,7 @@ class InvoiceController extends DooController {
|
|
|
|
|
|
$data ['invoiceDetail'] = $invoiceDetail;
|
|
|
$data ['invoiceOperationLogList'] = $invoiceOperationLogList;
|
|
|
- $data ['INVOICEKEY'] = $this->authcode ( $invoiceDetail ['iid'], '' );
|
|
|
+ $data ['INVOICEKEY'] = $invoice->authcode ( $invoiceDetail ['iid'], '' );
|
|
|
$data ['memu'] = "invoice";
|
|
|
$data ['staff'] = $this->staff;
|
|
|
$data ['receiptMemu'] = 'invoiceApproval';
|
|
@@ -278,18 +534,20 @@ class InvoiceController extends DooController {
|
|
|
* @return string 如操作成功返回审批首页
|
|
|
*/
|
|
|
function invoiceApprovalDo() {
|
|
|
+ Doo::loadModel ( 'invoice' );
|
|
|
+ $invoice = new invoice ();
|
|
|
+
|
|
|
$iid = $this->get_args ( 'invoiceKey' ) ? $this->get_args ( 'invoiceKey' ) : "";
|
|
|
$status = $this->get_args ( 'status' ) && is_numeric ( $this->get_args ( 'status' ) ) ? $this->get_args ( 'status' ) : 0;
|
|
|
$opinion = $this->get_args ( 'opinion' ) ? $this->get_args ( 'opinion' ) : "";
|
|
|
- $iid = $this->authcode ( $iid );
|
|
|
+ $iid = $invoice->authcode ( $iid );
|
|
|
if (! is_numeric ( $iid ))
|
|
|
die ( 'illegal request' );
|
|
|
|
|
|
if (! empty ( $iid ) && ! empty ( $status ) && ! empty ( $opinion )) {
|
|
|
if (! ($status == 2 || $status == 3 || $status == 4))
|
|
|
die ( 'illegal request' );
|
|
|
- Doo::loadModel ( 'invoice' );
|
|
|
- $invoice = new invoice ();
|
|
|
+
|
|
|
Doo::loadModel ( 'invoiceOperationLog' );
|
|
|
$invoiceOperationLog = new invoiceOperationLog ();
|
|
|
|
|
@@ -306,7 +564,7 @@ class InvoiceController extends DooController {
|
|
|
if ($status == 3) {
|
|
|
$invoice->status = $status;
|
|
|
$item = array (
|
|
|
- 'operation' => "退回"
|
|
|
+ 'operation' => $opinion
|
|
|
);
|
|
|
} else {
|
|
|
if (empty ( $processApprovals )) {
|
|
@@ -342,7 +600,7 @@ class InvoiceController extends DooController {
|
|
|
}
|
|
|
|
|
|
$item = array (
|
|
|
- 'operation' => "同意"
|
|
|
+ 'operation' => $opinion
|
|
|
);
|
|
|
if (count ( $processApprovals ) == count ( $invoiceManage ) && $status != 4) {
|
|
|
$invoice->status = $status;
|
|
@@ -350,7 +608,7 @@ class InvoiceController extends DooController {
|
|
|
} elseif ($status == 4) {
|
|
|
$invoice->status = $status;
|
|
|
$item = array (
|
|
|
- 'operation' => "终止"
|
|
|
+ 'operation' => $opinion
|
|
|
);
|
|
|
}
|
|
|
}
|
|
@@ -460,7 +718,7 @@ class InvoiceController extends DooController {
|
|
|
|
|
|
$data ['invoiceDetail'] = $invoiceDetail;
|
|
|
$data ['invoiceOperationLogList'] = $invoiceOperationLogList;
|
|
|
- $data ['INVOICEKEY'] = $this->authcode ( $invoiceDetail ['iid'], '' );
|
|
|
+ $data ['INVOICEKEY'] = $invoice->authcode ( $invoiceDetail ['iid'], '' );
|
|
|
$data ['memu'] = "invoice";
|
|
|
$data ['staff'] = $this->staff;
|
|
|
$data ['receiptMemu'] = 'invoicePrint';
|
|
@@ -471,15 +729,17 @@ class InvoiceController extends DooController {
|
|
|
* @since 1.0.0
|
|
|
*/
|
|
|
function invoicePrintDo() {
|
|
|
+ Doo::loadModel ( 'invoice' );
|
|
|
+ $invoice = new invoice ();
|
|
|
$iid = $this->get_args ( 'invoiceKey' ) ? $this->get_args ( 'invoiceKey' ) : "";
|
|
|
$invoiceNo = $this->get_args ( 'invoiceNo' ) ? $this->get_args ( 'invoiceNo' ) : "";
|
|
|
- $iid = $this->authcode ( $iid );
|
|
|
+
|
|
|
+ $iid = $invoice->authcode ( $iid );
|
|
|
if (! is_numeric ( $iid ))
|
|
|
die ( 'illegal request' );
|
|
|
if (! empty ( $iid ) && ! empty ( $invoiceNo )) {
|
|
|
|
|
|
- Doo::loadModel ( 'invoice' );
|
|
|
- $invoice = new invoice ();
|
|
|
+
|
|
|
Doo::loadModel ( 'invoiceOperationLog' );
|
|
|
$invoiceOperationLog = new invoiceOperationLog ();
|
|
|
|
|
@@ -493,7 +753,7 @@ class InvoiceController extends DooController {
|
|
|
'printTime' => date ( "Y-m-d H:i:s" ),
|
|
|
'invoiceNo' => $invoiceNo
|
|
|
);
|
|
|
- $invoice->setPrintByInvoice ( $item );
|
|
|
+ $invoice->setInvoiceByCondition ( $item );
|
|
|
$item = array (
|
|
|
'date' => date ( "Y-m-d H:i:s" ),
|
|
|
'operation' => $invoiceNo,
|
|
@@ -515,16 +775,14 @@ class InvoiceController extends DooController {
|
|
|
function invoicePost() {
|
|
|
Doo::loadModel ( 'invoice' );
|
|
|
$invoice = new invoice ();
|
|
|
- Doo::loadClass ( 'XDeode' );
|
|
|
- $XDeode = new XDeode ( 5 );
|
|
|
+ Doo::loadModel ( 'express' );
|
|
|
+ $express = new express ();
|
|
|
|
|
|
$invoicePost = $invoice->getPostByInvoice ();
|
|
|
- $invoicePosted = $invoice->getPostedByInvoice ();
|
|
|
-
|
|
|
- foreach ( $invoicePost as $key => $value ) {
|
|
|
- $invoicePost [$key] ['iidKey'] = $XDeode->encode ( $value ['iid'] );
|
|
|
- }
|
|
|
+ $invoicePosted = $invoice->getPostByInvoice ( 1 );
|
|
|
+ $expressList = $express->getExpressByAll ();
|
|
|
|
|
|
+ $data ['expressList'] = $expressList;
|
|
|
$data ['invoicePost'] = $invoicePost;
|
|
|
$data ['invoicePosted'] = $invoicePosted;
|
|
|
$data ['memu'] = "invoice";
|
|
@@ -532,17 +790,109 @@ class InvoiceController extends DooController {
|
|
|
$data ['receiptMemu'] = 'invoicePost';
|
|
|
$this->render ( "/admin/invoicePost", $data );
|
|
|
}
|
|
|
+ /**
|
|
|
+ * 添加发票邮寄信息
|
|
|
+ */
|
|
|
function invoiceExpressAddDo() {
|
|
|
+ Doo::loadModel ( 'invoice' );
|
|
|
+ $invoice = new invoice ();
|
|
|
+
|
|
|
+ $iid = $this->get_args ( 'iidKey' ) ? $this->get_args ( 'iidKey' ) : "";
|
|
|
+ $expressCompany = $this->get_args ( 'express' ) ? $this->get_args ( 'express' ) : "";
|
|
|
+ $expressNumber = $this->get_args ( 'nu' ) ? $this->get_args ( 'nu' ) : "";
|
|
|
+ $actualItems = $this->get_args ( 'actualItems' ) ? $this->get_args ( 'actualItems' ) : "";
|
|
|
+ $iid = $iid = $invoice->authcode ( $iid );
|
|
|
+ if (! is_numeric ( $iid ) && empty ( $expressCompany ) && empty ( $expressNumber ) && empty ( $actualItems ))
|
|
|
+ die ( 'illegal request' );
|
|
|
+
|
|
|
+ $item = array (
|
|
|
+ 'iid' => $iid,
|
|
|
+ 'postStatus' => 1,
|
|
|
+ 'updateTime' => date ( "Y-m-d H:i:s" ),
|
|
|
+ 'postTime' => date ( "Y-m-d H:i:s" ),
|
|
|
+ 'expressCompany' => $expressCompany,
|
|
|
+ 'expressNumber' => $expressNumber,
|
|
|
+ 'actualItems' => $actualItems,
|
|
|
+ 'poster' => $staff [0] ['username']
|
|
|
+ );
|
|
|
+ $invoice->setInvoiceByCondition ( $item );
|
|
|
+ return '/invoicePost';
|
|
|
}
|
|
|
/**
|
|
|
+ * 退票处理页面
|
|
|
+ */
|
|
|
+ function invoiceUntread(){
|
|
|
+ Doo::loadModel ( 'invoice' );
|
|
|
+ $invoice = new invoice ();
|
|
|
+
|
|
|
+ $untreadInvoice=$invoice->getInvoiceByUntreadStatus(1);
|
|
|
+ $establishedInvoice=$invoice->getInvoiceByUntreadStatus(2);
|
|
|
+
|
|
|
+ $data ['untreadInvoice'] = $untreadInvoice;
|
|
|
+ $data ['establishedInvoice'] = $establishedInvoice;
|
|
|
+
|
|
|
+ $data ['memu'] = "invoice";
|
|
|
+ $data ['staff'] = $this->staff;
|
|
|
+ $data ['receiptMemu'] = 'invoiceUntread';
|
|
|
+ $this->render ( "/admin/invoiceUntread", $data );
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 确认收到退回的发票,开票状态为退回
|
|
|
+ */
|
|
|
+ function invoiceUntreadEstablishedDo(){
|
|
|
+
|
|
|
+ $untreadIidKey = $this->get_args ( 'untreadIidKey' ) ? $this->get_args ( 'untreadIidKey' ) : '';
|
|
|
+
|
|
|
+ Doo::loadModel ( 'invoice' );
|
|
|
+ $invoice = new invoice ();
|
|
|
+ Doo::loadModel ( 'invoiceOperationLog' );
|
|
|
+ $invoiceOperationLog = new invoiceOperationLog ();
|
|
|
+
|
|
|
+ $iid = $invoice->authcode ( $untreadIidKey );
|
|
|
+ if (! empty ( $iid ) && ! is_numeric ( $iid ))
|
|
|
+ die ( 'illegal request' );
|
|
|
+
|
|
|
+ $item = array (
|
|
|
+ 'iid' => $iid,
|
|
|
+ 'untreadStatus' => 2,
|
|
|
+ 'updateTime' => date ( "Y-m-d H:i:s" )
|
|
|
+ );
|
|
|
+
|
|
|
+ $invoice->setInvoiceByCondition ( $item );
|
|
|
+ $item = array (
|
|
|
+ 'date' => date ( "Y-m-d H:i:s" ),
|
|
|
+ 'operation' => '已确认退票',
|
|
|
+ 'status' => 6,
|
|
|
+ 'img' => $this->staff [0] ['avatar'],
|
|
|
+ 'username' => $this->staff [0] ['username'],
|
|
|
+ 'uid' => $this->staff [0] ['sid'],
|
|
|
+ 'category' => $this->staff [0] ['category'],
|
|
|
+ 'iid' => $iid
|
|
|
+ );
|
|
|
+ $invoiceOperationLog->setInvoiceOperationLog ( $item );
|
|
|
+
|
|
|
+ return "/invoiceUntread";
|
|
|
+ }
|
|
|
+
|
|
|
+ function invoiceReceivables(){
|
|
|
+
|
|
|
+ $data ['memu'] = "invoice";
|
|
|
+ $data ['staff'] = $this->staff;
|
|
|
+ $data ['receiptMemu'] = 'invoiceReceivables';
|
|
|
+ $this->render ( "/admin/invoiceReceivables", $data );
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
* 异步获取一条发票的邮寄信息
|
|
|
*/
|
|
|
function ajaxGetInvoicePostDetail() {
|
|
|
- Doo::loadClass ( 'XDeode' );
|
|
|
- $XDeode = new XDeode ( 5 );
|
|
|
-
|
|
|
$iid = $this->get_args ( 'iidKey' ) ? $this->get_args ( 'iidKey' ) : "";
|
|
|
- $iid = $XDeode->decode ( $iid );
|
|
|
+ Doo::loadModel ( 'invoice' );
|
|
|
+ $invoice = new invoice ();
|
|
|
+ $iid = $invoice->authcode ( $iid );
|
|
|
+
|
|
|
if (! is_numeric ( $iid )) {
|
|
|
echo json_encode ( array (
|
|
|
'status' => 0,
|
|
@@ -551,15 +901,12 @@ class InvoiceController extends DooController {
|
|
|
die ();
|
|
|
}
|
|
|
|
|
|
- Doo::loadModel ( 'invoice' );
|
|
|
- $invoice = new invoice ();
|
|
|
- $select="recipients,recipientsPhone,recipientsAddress,mailItems";
|
|
|
- $invoiceDetail=$invoice->getInvoiceByIid($iid,$select);
|
|
|
+ $select = "iid,recipients,recipientsPhone,recipientsAddress,mailItems,expressCompany,expressNumber,actualItems";
|
|
|
+ $invoiceDetail = $invoice->getInvoiceByIid ( $iid, $select );
|
|
|
echo json_encode ( array (
|
|
|
'status' => 1,
|
|
|
- 'invoiceDetail' => $invoiceDetail
|
|
|
+ 'invoiceDetail' => $invoiceDetail
|
|
|
) );
|
|
|
-
|
|
|
}
|
|
|
function _GetFileEXT($filename) {
|
|
|
$pics = explode ( '.', $filename );
|
|
@@ -587,66 +934,6 @@ class InvoiceController extends DooController {
|
|
|
} else
|
|
|
return false;
|
|
|
}
|
|
|
-
|
|
|
- /**
|
|
|
- * 加密或解密指定字符串
|
|
|
- *
|
|
|
- * @param string $string 要加密或解密的字符串
|
|
|
- * @param string $operation 当取值为'DECODE'时表示解密,否则为加密
|
|
|
- * @param string $key 加解密的key
|
|
|
- * @param $expiry 超时值
|
|
|
- *
|
|
|
- */
|
|
|
- function authcode($string, $operation = 'DECODE', $key = '', $expiry = 0) {
|
|
|
- $ckey_length = 4;
|
|
|
- if (! $key) {
|
|
|
- $key = $this->INVOICEKEY;
|
|
|
- }
|
|
|
- $key = md5 ( $key );
|
|
|
- $keya = md5 ( substr ( $key, 0, 16 ) );
|
|
|
- $keyb = md5 ( substr ( $key, 16, 16 ) );
|
|
|
- $keyc = $ckey_length ? ($operation == 'DECODE' ? substr ( $string, 0, $ckey_length ) : substr ( md5 ( microtime () ), - $ckey_length )) : '';
|
|
|
-
|
|
|
- $cryptkey = $keya . md5 ( $keya . $keyc );
|
|
|
- $key_length = strlen ( $cryptkey );
|
|
|
-
|
|
|
- $string = $operation == 'DECODE' ? base64_decode ( substr ( $string, $ckey_length ) ) : sprintf ( '%010d', $expiry ? $expiry + time () : 0 ) . substr ( md5 ( $string . $keyb ), 0, 16 ) . $string;
|
|
|
- $string_length = strlen ( $string );
|
|
|
-
|
|
|
- $result = '';
|
|
|
- $box = range ( 0, 255 );
|
|
|
-
|
|
|
- $rndkey = array ();
|
|
|
- for($i = 0; $i <= 255; $i ++) {
|
|
|
- $rndkey [$i] = ord ( $cryptkey [$i % $key_length] );
|
|
|
- }
|
|
|
-
|
|
|
- for($j = $i = 0; $i < 256; $i ++) {
|
|
|
- $j = ($j + $box [$i] + $rndkey [$i]) % 256;
|
|
|
- $tmp = $box [$i];
|
|
|
- $box [$i] = $box [$j];
|
|
|
- $box [$j] = $tmp;
|
|
|
- }
|
|
|
-
|
|
|
- for($a = $j = $i = 0; $i < $string_length; $i ++) {
|
|
|
- $a = ($a + 1) % 256;
|
|
|
- $j = ($j + $box [$a]) % 256;
|
|
|
- $tmp = $box [$a];
|
|
|
- $box [$a] = $box [$j];
|
|
|
- $box [$j] = $tmp;
|
|
|
- $result .= chr ( ord ( $string [$i] ) ^ ($box [($box [$a] + $box [$j]) % 256]) );
|
|
|
- }
|
|
|
-
|
|
|
- if ($operation == 'DECODE') {
|
|
|
- if ((substr ( $result, 0, 10 ) == 0 || substr ( $result, 0, 10 ) - time () > 0) && substr ( $result, 10, 16 ) == substr ( md5 ( substr ( $result, 26 ) . $keyb ), 0, 16 )) {
|
|
|
- return substr ( $result, 26 );
|
|
|
- } else {
|
|
|
- return '';
|
|
|
- }
|
|
|
- } else {
|
|
|
- return $keyc . str_replace ( '=', '', base64_encode ( $result ) );
|
|
|
- }
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
?>
|