|
@@ -543,8 +543,8 @@ class InvoiceController extends DooController {
|
|
|
'recipients' => $recipients,
|
|
|
'recipientsPhone' => $recipientsPhone,
|
|
|
'recipientsAddress' => $recipientsAddress,
|
|
|
- 'mailItems' => $mailString ,
|
|
|
- 'mailItemsJson'=>json_encode($mailList)
|
|
|
+ 'mailItems' => $mailString,
|
|
|
+ 'mailItemsJson' => json_encode ( $mailList )
|
|
|
);
|
|
|
}
|
|
|
$invoice->setInvoiceByCondition ( $item );
|
|
@@ -599,7 +599,7 @@ class InvoiceController extends DooController {
|
|
|
return "/invoice";
|
|
|
}
|
|
|
/**
|
|
|
- * 申请退票
|
|
|
+ * 申请退票 --需求变更 废弃
|
|
|
*/
|
|
|
function invoiceUntreadDo() {
|
|
|
$untreadIidKey = $this->get_args ( 'untreadIidKey' ) ? $this->get_args ( 'untreadIidKey' ) : '';
|
|
@@ -1147,19 +1147,45 @@ class InvoiceController extends DooController {
|
|
|
return "/invoiceUntread";
|
|
|
}
|
|
|
function invoiceReceivables() {
|
|
|
+ $invoiceTC = $this->get_args ( 'invoiceTC' ) ? $this->get_args ( 'invoiceTC' ) : '';
|
|
|
+
|
|
|
Doo::loadModel ( 'L_category' );
|
|
|
$lCategory = new L_category ();
|
|
|
Doo::loadModel ( 'staff' );
|
|
|
$staff = new staff ();
|
|
|
Doo::loadModel ( 'invoiceReceivables' );
|
|
|
$invoiceReceivables = new invoiceReceivables ();
|
|
|
+ Doo::loadModel ( 'invoice' );
|
|
|
+ $invoice = new invoice ();
|
|
|
+ Doo::loadClass ( 'XDeode' );
|
|
|
+ $XDeode = new XDeode ( 5 );
|
|
|
|
|
|
$category = $lCategory->getCategory ();
|
|
|
$staffList = $staff->getStaffByCid ( $this->staff [0] ['cid'] );
|
|
|
|
|
|
$receivablesList = $invoiceReceivables->getInvoiceReceivablesByNew ();
|
|
|
- // print_r($receivablesList);
|
|
|
+ // 获取未入账发票
|
|
|
+ $invoiceUnAccount = $invoice->getInvoiceByUnAccount ( $invoiceTC );
|
|
|
+
|
|
|
+ foreach ( $invoiceUnAccount as $key => $value ) {
|
|
|
+ $invoiceUnAccount [$key] ['iidKey'] = $XDeode->encode ( $value ['iid'] );
|
|
|
+
|
|
|
+ $lastApprover = json_decode ( $value ['processApprovals'], true );
|
|
|
+ if (! empty ( $lastApprover )) {
|
|
|
+ $lastApproverKey = array_keys ( $lastApprover );
|
|
|
+ $lastApprover = end ( $lastApprover );
|
|
|
+
|
|
|
+ $staffDetail = $staff->getOne ( array (
|
|
|
+ 'where' => 'sid=' . end ( $lastApproverKey ),
|
|
|
+ 'asArray' => true
|
|
|
+ ) );
|
|
|
+ $lastApprover ['username'] = $staffDetail ['username'];
|
|
|
+ }
|
|
|
+ $invoiceUnAccount [$key] ['lastApprover'] = $lastApprover;
|
|
|
+ }
|
|
|
|
|
|
+ $this->data ['year'] = date ( 'Y' );
|
|
|
+ $this->data ['invoiceUnAccount'] = $invoiceUnAccount;
|
|
|
$this->data ['receivablesList'] = $receivablesList;
|
|
|
$this->data ['staffList'] = $staffList;
|
|
|
$this->data ['category'] = $category;
|
|
@@ -1171,6 +1197,119 @@ class InvoiceController extends DooController {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * 新添加收款直接入账发票
|
|
|
+ */
|
|
|
+ function invoiceCompareClaimPrice() {
|
|
|
+ // 收款录入
|
|
|
+ $iidKey = $this->get_args ( 'iidKey' ) ? $this->get_args ( 'iidKey' ) : "";
|
|
|
+
|
|
|
+ $receivablesPrice = $this->get_args ( 'receivablesPrice' ) ? $this->get_args ( 'receivablesPrice' ) : "";
|
|
|
+ $receivablesMessage = $this->get_args ( 'receivablesMessage' ) ? $this->get_args ( 'receivablesMessage' ) : "";
|
|
|
+ $receivablesBank = $this->get_args ( 'receivablesBank' ) ? $this->get_args ( 'receivablesBank' ) : "";
|
|
|
+ $receivablesDate = $this->get_args ( 'receivablesDate' ) ? $this->get_args ( 'receivablesDate' ) : "";
|
|
|
+
|
|
|
+ if (! empty ( $receivablesPrice ) && ! empty ( $receivablesMessage ) && ! empty ( $receivablesBank ) && ! empty ( $receivablesDate ) && ! empty ( $iidKey )) {
|
|
|
+ Doo::loadModel ( 'invoiceReceivables' );
|
|
|
+ $invoiceReceivables = new invoiceReceivables ();
|
|
|
+ Doo::loadModel ( 'invoiceROLog' );
|
|
|
+ $invoiceROLog = new invoiceROLog ();
|
|
|
+ Doo::loadModel ( 'invoiceStatistics' );
|
|
|
+ $invoiceStatistics = new invoiceStatistics ();
|
|
|
+ Doo::loadModel ( 'invoice' );
|
|
|
+ $invoice = new invoice ();
|
|
|
+ Doo::loadClass ( 'XDeode' );
|
|
|
+ $XDeode = new XDeode ( 5 );
|
|
|
+ Doo::loadModel ( 'invoiceOperationLog' );
|
|
|
+ $invoiceOperationLog = new invoiceOperationLog ();
|
|
|
+
|
|
|
+ $iidKey = $XDeode->decode ( $iidKey );
|
|
|
+
|
|
|
+ $invoiceDetail = $invoice->getInvoiceByIid ( $iidKey );
|
|
|
+ $receivablesSerial="#SK" . date ( "Ymd" ) . mt_rand ( 1000, 9999 );
|
|
|
+
|
|
|
+ // 收款录入
|
|
|
+ $item = array (
|
|
|
+ 'receivablesPrice' => $receivablesPrice,
|
|
|
+ 'receivablesMessage' => $receivablesMessage,
|
|
|
+ 'receivablesSerial' => $receivablesSerial,
|
|
|
+ 'receivablesBank' => $receivablesBank,
|
|
|
+ 'receivablesDate' => $receivablesDate,
|
|
|
+ 'inputStaff' => $this->staff [0] ['username'],
|
|
|
+ 'date' => date ( "Y-m-d" ),
|
|
|
+ 'receivablesCategory' => $invoiceDetail ['cid'] . ':' . $invoiceDetail ['categoryName'],
|
|
|
+ 'receivablesStaff' => $invoiceDetail ['sid'] . '-' . $invoiceDetail ['userName'],
|
|
|
+ 'confirmTime' => date ( "Y-m-d H:i:s" )
|
|
|
+ );
|
|
|
+
|
|
|
+ $irid = $invoiceReceivables->addInvoiceReceivables ( $item );
|
|
|
+
|
|
|
+ $item = array ();
|
|
|
+ // 收款操作日志
|
|
|
+ $item = array (
|
|
|
+ 'operation' => $this->staff [0] ['username'] . " 转入 " . $invoiceDetail ['userName']
|
|
|
+ );
|
|
|
+ $item += array (
|
|
|
+ 'date' => date ( "Y-m-d" ),
|
|
|
+ 'status' => 1,
|
|
|
+ 'img' => $this->staff [0] ['avatar'],
|
|
|
+ 'username' => $this->staff [0] ['username'],
|
|
|
+ 'uid' => $this->staff [0] ['sid'],
|
|
|
+ 'category' => $this->staff [0] ['category'],
|
|
|
+ 'irid' => $irid
|
|
|
+ );
|
|
|
+ $invoiceROLog->setInvoiceROLog ( $item );
|
|
|
+ // 收款统计
|
|
|
+ $item = array (
|
|
|
+ 'date' => date ( "Y-m-d H:i:s" ),
|
|
|
+ 'priceClass' => 2,
|
|
|
+ 'irid' => $irid,
|
|
|
+ 'cid' => $invoiceDetail ['cid'],
|
|
|
+ 'staff' => $invoiceDetail ['sid'],
|
|
|
+ 'receivablesPrice' => $receivablesPrice
|
|
|
+ );
|
|
|
+ $invoiceStatistics->setInvoiceStatisticsByCondition ( $item );
|
|
|
+
|
|
|
+ // 收款 入 发票
|
|
|
+ $detail = $invoiceDetail;
|
|
|
+
|
|
|
+ $iridString = "";
|
|
|
+ if (empty ( $detail ['irid'] ))
|
|
|
+ $iridString = $irid;
|
|
|
+ else
|
|
|
+ $iridString = $detail ['irid'] . ',' . $irid;
|
|
|
+
|
|
|
+ $item = array (
|
|
|
+ 'irid' => $iridString,
|
|
|
+ 'bindTime' => date ( "Y-m-d H:i:s" ),
|
|
|
+ 'updateTime' => date ( "Y-m-d H:i:s" ),
|
|
|
+ 'iid' => $detail ['iid']
|
|
|
+ );
|
|
|
+ $invoice->setInvoiceByCondition ( $item );
|
|
|
+
|
|
|
+ // 操作日志
|
|
|
+ $item = array (
|
|
|
+ 'date' => date ( "Y-m-d H:i:s" ),
|
|
|
+ 'operation' => "收款入账" . $receivablesSerial . "到发票" . $detail ['invoiceSerial'],
|
|
|
+ 'status' => 8,
|
|
|
+ 'img' => $this->staff [0] ['avatar'],
|
|
|
+ 'username' => $this->staff [0] ['username'],
|
|
|
+ 'uid' => $this->staff [0] ['sid'],
|
|
|
+ 'category' => $this->staff [0] ['category'],
|
|
|
+ 'iid' => $detail ['iid']
|
|
|
+ );
|
|
|
+ $invoiceOperationLog->setInvoiceOperationLog ( $item );
|
|
|
+ }
|
|
|
+
|
|
|
+ return '/invoiceReceivables';
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 检索未入账发票数据
|
|
|
+ */
|
|
|
+ function sir() {
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
* 录入收款数据
|
|
|
* @return string
|
|
|
*/
|
|
@@ -1527,7 +1666,7 @@ class InvoiceController extends DooController {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 发票收款完成
|
|
|
+ * 发票收款完成--需求更变 废弃
|
|
|
*/
|
|
|
function invoiceEnterReceivables() {
|
|
|
$invoiceKey = $this->get_args ( 'key' ) ? $this->get_args ( 'key' ) : "";
|
|
@@ -2009,7 +2148,7 @@ class InvoiceController extends DooController {
|
|
|
Doo::loadModel ( 'invoiceReceivables' );
|
|
|
$invoiceReceivables = new invoiceReceivables ();
|
|
|
|
|
|
- $MebSea = isset ( $this->params ['MebSea'] ) ? urldecode ( $this->params ['MebSea'] ) : '';
|
|
|
+ $MebSea = isset ( $this->params ['MebSea'] ) ? addslashes ( urldecode ( $this->params ['MebSea'] ) ) : '';
|
|
|
|
|
|
$page_size = 12;
|
|
|
$page = isset ( $this->params ['page'] ) && is_numeric ( $this->params ['page'] ) ? $this->params ['page'] : 1;
|
|
@@ -2364,6 +2503,10 @@ class InvoiceController extends DooController {
|
|
|
'invoiceDetail' => $invoiceDetail
|
|
|
) );
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * --需求变更 废弃
|
|
|
+ */
|
|
|
function ajaxCompareClaimPrice() {
|
|
|
$irid = $this->get_args ( 'irid' ) ? $this->get_args ( 'irid' ) : "";
|
|
|
$invoiceKey = $this->get_args ( 'invoiceKey' ) ? $this->get_args ( 'invoiceKey' ) : "";
|
|
@@ -2495,7 +2638,7 @@ class InvoiceController extends DooController {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 从发票中移除已经入账的收款
|
|
|
+ * 从发票中移除已经入账的收款 --需求变更 废弃
|
|
|
*/
|
|
|
function ajaxReceivablesRemove() {
|
|
|
$iridKey = $this->get_args ( 'key' ) ? $this->get_args ( 'key' ) : "";
|
|
@@ -2660,7 +2803,7 @@ class InvoiceController extends DooController {
|
|
|
}
|
|
|
|
|
|
/*
|
|
|
- * 获得与我有关收款数据
|
|
|
+ * 获得与我有关收款数据 --需求变更 废弃
|
|
|
*/
|
|
|
function ajaxGetReceivalblesByStaff() {
|
|
|
$iid = $this->get_args ( 'key' ) ? $this->get_args ( 'key' ) : "";
|
|
@@ -2942,6 +3085,91 @@ class InvoiceController extends DooController {
|
|
|
'html' => $html
|
|
|
) );
|
|
|
die ();
|
|
|
+ } elseif ($type == 'IRTC') {
|
|
|
+
|
|
|
+ Doo::loadModel ( 'invoice' );
|
|
|
+ $invoice = new invoice ();
|
|
|
+ Doo::loadModel ( 'invoiceOperationLog' );
|
|
|
+ $invoiceOperationLog = new invoiceOperationLog ();
|
|
|
+
|
|
|
+ $detail = $invoice->getInvoiceByIsid ( $serial, $this->staff [0] ['sid'] );
|
|
|
+ $invoiceOperationLogList = $invoiceOperationLog->getInvoiceOperationLogByIid ( $detail ['iid'] );
|
|
|
+
|
|
|
+ if (empty ( $detail ))
|
|
|
+ $html = '';
|
|
|
+ else {
|
|
|
+ $html = '
|
|
|
+ <table class="table table-bordered table-condensed"><tbody>
|
|
|
+ <tr>
|
|
|
+ <th class="taC" width="150">开票流水号</th><td>' . $detail ['invoiceSerial'] . '</td>
|
|
|
+ <th class="taC" width="150">提交时间</th><td>' . $detail ['date'] . '</td>
|
|
|
+ </tr>
|
|
|
+ <tr>
|
|
|
+ <th class="taC" width="150">所在办事处</th><td>' . $detail ['categoryName'] . '(' . $detail ['userName'] . ')</td>
|
|
|
+ <th class="taC" width="150">备注</th><td>' . $detail ['remark'] . '</td>
|
|
|
+ </tr>
|
|
|
+ <tr>
|
|
|
+ <th class="taC">开票金额</th><td><b class="colOrange" style="font-size:18px">¥' . $detail ['invoicePrice'] . '</b></td>
|
|
|
+ <th class="taC">开票内容</th><td>' . $detail ['invoiceElement'] . '</td>
|
|
|
+ </tr></tbody></table>';
|
|
|
+
|
|
|
+ if ($detail ['invoiceType'] == 0)
|
|
|
+ $html .= '<table class="table table-bordered table-condensed"><tbody>
|
|
|
+ <tr><th colspan="4" class="taC">增值税普通发票</th></tr><tr>
|
|
|
+ <th class="taC" width="150">发票抬头</th><td >' . $detail ['invoiceTitle'] . '</td>
|
|
|
+ <th class="taC" width="150">纳税人识别码</th><td>' . $detail ['TIN'] . '</td>
|
|
|
+ </tr>';
|
|
|
+ else
|
|
|
+ $html .= '<table class="table table-bordered table-condensed"><tbody>
|
|
|
+ <tr><th colspan="4" class="taC">增值税专用发票</th></tr><tr>
|
|
|
+ <th class="taC" width="150">单位名称</th><td>' . $detail ['invoiceCompany'] . '</td>
|
|
|
+ <th class="taC" width="150">纳税人识别码</th><td>' . $detail ['TIN'] . '</td></tr>
|
|
|
+
|
|
|
+ ';
|
|
|
+
|
|
|
+ $html .= '<tr>
|
|
|
+ <th class="taC">注册地址</th><td>' . $detail ['address'] . '</td>
|
|
|
+ <th class="taC">注册电话</th><td>' . $detail ['phone'] . '</td>
|
|
|
+ </tr>
|
|
|
+ <tr>
|
|
|
+ <th class="taC">开户银行</th><td>' . $detail ['bankAccount'] . '</td>
|
|
|
+ <th class="taC">银行账户</th><td>' . $detail ['bank'] . '</td>
|
|
|
+ </tr></tbody></table>';
|
|
|
+
|
|
|
+ if ($detail ['doPost'] == 1)
|
|
|
+ $html .= '<table class="table table-bordered table-condensed"><tbody><tr><th colspan="4" class="taC">邮寄信息</th></tr><tr>
|
|
|
+ <th class="taC" width="150">收件人</th><td>' . $detail ['recipients'] . '</td>
|
|
|
+ <th class="taC" width="150">收件人手机/电话</th><td>' . $detail ['recipientsPhone'] . '</td>
|
|
|
+ </tr><tr>
|
|
|
+ <th class="taC" width="150">收件地址</th><td colspan="3">' . $detail ['recipientsAddress'] . '</td>
|
|
|
+ </tr><tr>
|
|
|
+ <th class="taC" width="150">邮寄物品</th><td colspan="3">' . $detail ['mailItems'] . '</td>
|
|
|
+ </tr></tbody></table>';
|
|
|
+ if (! empty ( $invoiceOperationLogList )) {
|
|
|
+ $html .= '<table class="table table-bordered table-condensed"><tbody><tr><th width="60%" class="taC">审批流程</th></tr><tr><td>';
|
|
|
+ foreach ( $invoiceOperationLogList as $key => $value ) {
|
|
|
+ if ($value ['status'] == 1 || $value ['status'] == 2 || $value ['status'] == 3 || $value ['status'] == 4) {
|
|
|
+ $html .= '<blockquote><p><span class="colGray">' . $value ['date'] . '</span>
|
|
|
+ ' . $value ['category'] . '-' . $value ['username'] . ' ';
|
|
|
+ if ($value ['status'] == 2) {
|
|
|
+ $html .= '<span class="colGreen">同意</span>';
|
|
|
+ } elseif ($value ['status'] == 3) {
|
|
|
+ $html .= '<span class="colOrange">退回</span>';
|
|
|
+ } elseif ($value ['status'] == 5) {
|
|
|
+ $html .= '<span class="colGreen">打印</span>';
|
|
|
+ }
|
|
|
+ $html .= $value ['operation'] . '</p></blockquote>';
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $html .= '</td></tr></tbody></table>';
|
|
|
+ }
|
|
|
+ }
|
|
|
+ echo json_encode ( array (
|
|
|
+ 'status' => 1,
|
|
|
+ 'html' => $html,
|
|
|
+ 'iidKey' => $serial
|
|
|
+ ) );
|
|
|
+ die ();
|
|
|
}
|
|
|
}
|
|
|
function ajaxGetInvoiceReceivablesByStaff() {
|
|
@@ -3043,6 +3271,102 @@ class InvoiceController extends DooController {
|
|
|
} else
|
|
|
return false;
|
|
|
}
|
|
|
+ function SafeFilter(&$arr) {
|
|
|
+ $ra = Array (
|
|
|
+ '/([\x00-\x08,\x0b-\x0c,\x0e-\x19])/',
|
|
|
+ '/script/',
|
|
|
+ '/javascript/',
|
|
|
+ '/vbscript/',
|
|
|
+ '/expression/',
|
|
|
+ '/applet/',
|
|
|
+ '/meta/',
|
|
|
+ '/xml/',
|
|
|
+ '/blink/',
|
|
|
+ '/link/',
|
|
|
+ '/style/',
|
|
|
+ '/embed/',
|
|
|
+ '/object/',
|
|
|
+ '/frame/',
|
|
|
+ '/layer/',
|
|
|
+ '/title/',
|
|
|
+ '/bgsound/',
|
|
|
+ '/base/',
|
|
|
+ '/onload/',
|
|
|
+ '/onunload/',
|
|
|
+ '/onchange/',
|
|
|
+ '/onsubmit/',
|
|
|
+ '/onreset/',
|
|
|
+ '/onselect/',
|
|
|
+ '/onblur/',
|
|
|
+ '/onfocus/',
|
|
|
+ '/onabort/',
|
|
|
+ '/onkeydown/',
|
|
|
+ '/onkeypress/',
|
|
|
+ '/onkeyup/',
|
|
|
+ '/onclick/',
|
|
|
+ '/ondblclick/',
|
|
|
+ '/onmousedown/',
|
|
|
+ '/onmousemove/',
|
|
|
+ '/onmouseout/',
|
|
|
+ '/onmouseover/',
|
|
|
+ '/onmouseup/',
|
|
|
+ '/onunload/'
|
|
|
+ );
|
|
|
+
|
|
|
+ if (is_array ( $arr )) {
|
|
|
+ foreach ( $arr as $key => $value ) {
|
|
|
+ if (! is_array ( $value )) {
|
|
|
+ if (! get_magic_quotes_gpc ()) // 不对magic_quotes_gpc转义过的字符使用addslashes(),避免双重转义。
|
|
|
+{
|
|
|
+ $value = addslashes ( $value ); // 给单引号(')、双引号(")、反斜线(\)与 NUL(NULL 字符)加上反斜线转义
|
|
|
+ }
|
|
|
+ $value = preg_replace ( $ra, '', $value ); // 删除非打印字符,粗暴式过滤xss可疑字符串
|
|
|
+ $arr [$key] = htmlentities ( strip_tags ( $value ) ); // 去除 HTML 和 PHP 标记并转换为 HTML 实体
|
|
|
+ } else {
|
|
|
+ SafeFilter ( $arr [$key] );
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Escape String
|
|
|
+ *
|
|
|
+ * @access public
|
|
|
+ * @param string
|
|
|
+ * @param bool whether or not the string will be used in a LIKE condition
|
|
|
+ * @return string
|
|
|
+ */
|
|
|
+ function escape_str($str, $like = FALSE) {
|
|
|
+ if (is_array ( $str )) {
|
|
|
+ foreach ( $str as $key => $val ) {
|
|
|
+ $str [$key] = $this->escape_str ( $val, $like );
|
|
|
+ }
|
|
|
+ return $str;
|
|
|
+ }
|
|
|
+
|
|
|
+ var_dump ( Doo::db ()->getDbObject () );
|
|
|
+ die ();
|
|
|
+
|
|
|
+ if (function_exists ( 'mysql_real_escape_string' ) and is_resource ( Doo::db ()->getDbObject () )) { // Doo::db ()->getDbObject()
|
|
|
+ $str = mysql_real_escape_string ( $str, Doo::db ()->getDbObject () );
|
|
|
+ } elseif (function_exists ( 'mysql_escape_string' )) {
|
|
|
+ $str = mysql_escape_string ( $str );
|
|
|
+ } else {
|
|
|
+ $str = addslashes ( $str );
|
|
|
+ }
|
|
|
+ // escape LIKE condition wildcards
|
|
|
+ if ($like === TRUE) {
|
|
|
+ $str = str_replace ( array (
|
|
|
+ '%',
|
|
|
+ '_'
|
|
|
+ ), array (
|
|
|
+ '\\%',
|
|
|
+ '\\_'
|
|
|
+ ), $str );
|
|
|
+ }
|
|
|
+ return $str;
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* 获得分页数据
|