|
@@ -2230,6 +2230,55 @@ class ReceiptController extends DooController {
|
|
|
|
|
|
$receiptTrainingDetail = $receiptTraining->getReceiptTrainingByRtid ( $receiptDetail ['trainId'] );
|
|
|
|
|
|
+ // 汇总表合计
|
|
|
+ // 收入合计
|
|
|
+ Doo::loadModel ( 'invoiceTraining' );
|
|
|
+ $invoiceTraining = new invoiceTraining ();
|
|
|
+ $invoiceTrainingDetail = $invoiceTraining->getInvoiceTrainingByItid ( $receiptDetail ['invoiceTrainId'] );
|
|
|
+ // print_r($invoiceTrainingDetail);
|
|
|
+ $data ['invoiceTrainingDetail'] = $invoiceTrainingDetail;
|
|
|
+
|
|
|
+ // 支出项目
|
|
|
+ Doo::loadModel ( 'accountItem' );
|
|
|
+ $accountItem = new accountItem ();
|
|
|
+
|
|
|
+ // 项目金额合计
|
|
|
+ Doo::loadModel ( 'RItem' );
|
|
|
+ $RItem = new RItem ();
|
|
|
+ // 讲师获得
|
|
|
+ Doo::loadModel ( 'RILecturer' );
|
|
|
+ $RILecturer = new RILecturer ();
|
|
|
+ $RItemList = $RItem->getRItemByRid ( $rid );
|
|
|
+ $RILecturerList = $RILecturer->getRILecturerByRid ( $rid );
|
|
|
+ // 支出项金额详情
|
|
|
+ $aiData = $accountItem->getTrainingDetail ( $RItemList, $RILecturerList, $invoiceTrainingDetail ['invoiceArriveAmount'] );
|
|
|
+ //print_r($aiData);
|
|
|
+
|
|
|
+ // 利润
|
|
|
+ $data ['profit'] = $invoiceTrainingDetail ['invoiceArriveAmount'] - $aiData ['total'];
|
|
|
+ $data ['companyProfit'] = $data ['profit'] * 0.6;
|
|
|
+ $data ['categoryProfit'] = $data ['profit'] * 0.4;
|
|
|
+ // print_r($aiData['dataList']);
|
|
|
+ $data ['categoryActualExpenditure'] = $aiData ['total'] - $aiData ['categoryActualExpenditure'];
|
|
|
+ // 备用金
|
|
|
+ $data ['receiptLoanDetail'] = $receipt->getReceiptByRid ( $receiptDetail ['trainLoanRid'] );
|
|
|
+ $data ['payment'] = $data ['receiptLoanDetail'] ['sum'] + $invoiceTrainingDetail ['RIAmount'] - $data ['categoryActualExpenditure'];
|
|
|
+
|
|
|
+ $data ['total'] = $aiData ['total'];
|
|
|
+ $data ['aiCount'] = count ( $aiData ['dataList'] ) + 5;
|
|
|
+ $data ['aiList'] = $aiData ['dataList'];
|
|
|
+
|
|
|
+ // 占比计算
|
|
|
+ $data ['totalProportion'] = number_format ( $aiData ['total'] / $invoiceTrainingDetail ['invoiceArriveAmount'], 2, '.', '' ) * 100;
|
|
|
+ $data ['profitProportion'] = number_format ( $data ['profit'] / $invoiceTrainingDetail ['invoiceArriveAmount'], 2, '.', '' ) * 100;
|
|
|
+ $data ['sumProportion'] = number_format ( $data ['receiptLoanDetail'] ['sum'] / $invoiceTrainingDetail ['invoiceArriveAmount'], 2, '.', '' ) * 100;
|
|
|
+ $data ['invoiceTotalAmountProportion'] = number_format ( $data ['invoiceTrainingDetail'] ['invoiceTotalAmount'] / $invoiceTrainingDetail ['invoiceArriveAmount'], 2, '.', '' ) * 100;
|
|
|
+ $data ['RIAmountProportion'] = number_format ( $data ['invoiceTrainingDetail'] ['RIAmount'] / $invoiceTrainingDetail ['invoiceArriveAmount'], 2, '.', '' ) * 100;
|
|
|
+ $data ['companyProfitProportion'] = number_format ( $data ['companyProfit'] / $invoiceTrainingDetail ['invoiceArriveAmount'], 2, '.', '' ) * 100;
|
|
|
+ $data ['categoryProportion'] = number_format ( $data ['categoryProfit'] / $invoiceTrainingDetail ['invoiceArriveAmount'], 2, '.', '' ) * 100;
|
|
|
+ $data ['categoryActualExpenditureProportion'] = number_format ( $data ['categoryActualExpenditure'] / $invoiceTrainingDetail ['invoiceArriveAmount'], 2, '.', '' ) * 100;
|
|
|
+ $data ['paymentProportion'] = number_format ( $data ['payment'] / $invoiceTrainingDetail ['invoiceArriveAmount'], 2, '.', '' ) * 100;
|
|
|
+
|
|
|
// 审批组
|
|
|
Doo::loadModel ( 'verify' );
|
|
|
$verify = new verify ();
|
|
@@ -2281,15 +2330,17 @@ class ReceiptController extends DooController {
|
|
|
die ();
|
|
|
|
|
|
$receiptTrainingDetail = $receiptTraining->getReceiptTrainingByRtid ( $receiptDetail ['trainId'] );
|
|
|
-
|
|
|
- //借款详情HTML
|
|
|
- //获得借款信息
|
|
|
- $receiptLoanDetail = $receipt->getReceiptByRid ( $receiptDetail['trainLoanRid'] );
|
|
|
- //获得某费用单审批信息
|
|
|
- $verifylist=$verify->getVerifyByRid($receiptDetail['trainLoanRid']);
|
|
|
- Doo::loadClass ( 'receipt.func' );
|
|
|
- $extendHtml='<p><a class="button" href="javascript:if(window.confirm(\'确认移除?\'))window.location=\'/receiptTrainLoanRemoveDo/' . $receiptDetail ['ridKey'] . '/' . $receiptDetail['trainLoanRidKey'] . '.html\'" data-toggle="modal">移除借款</a></p>';
|
|
|
- $receiptLoanHtml=_getReceiptLoanHtml($receiptLoanDetail,$verifylist,$extendHtml);
|
|
|
+ // 借款详情HTML
|
|
|
+ // 获得借款信息
|
|
|
+ $receiptLoanHtml = '';
|
|
|
+ if (! empty ( $receiptDetail ['trainLoanRid'] )) {
|
|
|
+ $receiptLoanDetail = $receipt->getReceiptByRid ( $receiptDetail ['trainLoanRid'] );
|
|
|
+ // 获得某费用单审批信息
|
|
|
+ $verifylist = $verify->getVerifyByRid ( $receiptDetail ['trainLoanRid'] );
|
|
|
+ Doo::loadClass ( 'receipt.func' );
|
|
|
+ $extendHtml = '<p><a class="button" href="javascript:if(window.confirm(\'确认移除?\'))window.location=\'/receiptTrainLoanRemoveDo/' . $receiptDetail ['ridKey'] . '/' . $receiptDetail ['trainLoanRidKey'] . '.html\'" data-toggle="modal">移除借款</a></p>';
|
|
|
+ $receiptLoanHtml = _getReceiptLoanHtml ( $receiptLoanDetail, $verifylist, $extendHtml );
|
|
|
+ }
|
|
|
|
|
|
$data ['receiptLoanHtml'] = $receiptLoanHtml;
|
|
|
$data ['receiptTrainingDetail'] = $receiptTrainingDetail;
|
|
@@ -2383,76 +2434,106 @@ class ReceiptController extends DooController {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 编辑培训班结算借款
|
|
|
+ * 编辑培训班结算---更新借款
|
|
|
*/
|
|
|
function receiptTrainLoanEdiDo() {
|
|
|
$ridKey = $this->get_args ( 'ridKey' ) ? $this->get_args ( 'ridKey' ) : "";
|
|
|
$ridLoanKey = $this->get_args ( 'ridLoanKey' ) ? $this->get_args ( 'ridLoanKey' ) : "";
|
|
|
- if(!empty($ridKey)&&!empty($ridLoanKey)){
|
|
|
+ if (! empty ( $ridKey ) && ! empty ( $ridLoanKey )) {
|
|
|
Doo::loadModel ( 'receipt' );
|
|
|
$receipt = new receipt ();
|
|
|
Doo::loadClass ( 'XDeode' );
|
|
|
$XDeode = new XDeode ( 5 );
|
|
|
|
|
|
- $rid=$XDeode->decode ( $ridKey );
|
|
|
- $ridLoan=$XDeode->decode ( $ridLoanKey );
|
|
|
- if (!is_numeric($rid)||!is_numeric($ridLoan))
|
|
|
+ $rid = $XDeode->decode ( $ridKey );
|
|
|
+ $ridLoan = $XDeode->decode ( $ridLoanKey );
|
|
|
+ if (! is_numeric ( $rid ) || ! is_numeric ( $ridLoan ))
|
|
|
die ( 'illegal request-ridError' );
|
|
|
|
|
|
- $receiptDetail=$receipt->getReceiptByRid($rid);
|
|
|
- $receiptLoanDetail=$receipt->getReceiptByRid($ridLoan);
|
|
|
- //不合法的数据
|
|
|
- if ($receiptDetail['status']!=3&&$receiptDetail['Rtype']!=3){
|
|
|
+ $receiptDetail = $receipt->getReceiptByRid ( $rid );
|
|
|
+ $receiptLoanDetail = $receipt->getReceiptByRid ( $ridLoan );
|
|
|
+ // 不合法的数据
|
|
|
+ if ($receiptDetail ['status'] != 5 || $receiptDetail ['Rtype'] != 3) {
|
|
|
die ( 'illegal request-receiptError' );
|
|
|
}
|
|
|
- if ($receiptLoanDetail['status']!=8&&$receiptLoanDetail['Rtype']!=1){
|
|
|
+ if ($receiptLoanDetail ['status'] != 8 || $receiptLoanDetail ['Rtype'] != 1) {
|
|
|
die ( 'illegal request-receipLoantError' );
|
|
|
}
|
|
|
- //培训班结算挂钩借款
|
|
|
+ // 培训班结算挂钩借款
|
|
|
$receipt = new receipt ();
|
|
|
- $item=array(
|
|
|
- 'rid'=>$rid,
|
|
|
- 'trainLoanRid'=>$ridLoan,
|
|
|
+ $item = array (
|
|
|
+ 'rid' => $rid,
|
|
|
+ 'trainLoanRid' => $ridLoan
|
|
|
);
|
|
|
- $receipt->setReceiptByCondition($item);
|
|
|
- //更新借款状态变成已挂钩
|
|
|
+ $receipt->setReceiptByCondition ( $item );
|
|
|
+ // 更新借款状态变成已挂钩
|
|
|
$receipt = new receipt ();
|
|
|
- $item=array(
|
|
|
- 'rid'=>$ridLoan,
|
|
|
- 'status'=>10,
|
|
|
- 'statusTrain'=>1
|
|
|
+ $item = array (
|
|
|
+ 'rid' => $ridLoan,
|
|
|
+ 'status' => 10,
|
|
|
+ 'statusTrain' => 1
|
|
|
);
|
|
|
- $receipt->setReceiptByCondition($item);
|
|
|
+ $receipt->setReceiptByCondition ( $item );
|
|
|
|
|
|
$XDeode = new XDeode ( 7 );
|
|
|
return "/receiptTrainLoanEdi/" . $XDeode->encode ( $rid ) . ".html";
|
|
|
- }else
|
|
|
+ } else
|
|
|
die ( 'illegal request' );
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 移除挂钩的费用借款
|
|
|
+ * 编辑培训班结算--移除借款
|
|
|
*/
|
|
|
- function receiptTrainLoanRemoveDo(){
|
|
|
+ function receiptTrainLoanRemoveDo() {
|
|
|
$ridKey = isset ( $this->params ['ridKey'] ) ? $this->params ['ridKey'] : 0;
|
|
|
$ridLoanKey = isset ( $this->params ['ridLoanKey'] ) ? $this->params ['ridLoanKey'] : 0;
|
|
|
|
|
|
- if (!empty($ridKey)||!empty($ridLoanKey)){
|
|
|
+ if (! empty ( $ridKey ) || ! empty ( $ridLoanKey )) {
|
|
|
+ Doo::loadModel ( 'receipt' );
|
|
|
+ $receipt = new receipt ();
|
|
|
Doo::loadClass ( 'XDeode' );
|
|
|
$XDeode = new XDeode ( 5 );
|
|
|
|
|
|
- $rid=$XDeode->decode ( $ridKey );
|
|
|
- $ridLoan=$XDeode->decode ( $ridLoanKey );
|
|
|
- echo $rid;
|
|
|
- echo $ridLoan;
|
|
|
- }
|
|
|
-
|
|
|
+ $rid = $XDeode->decode ( $ridKey );
|
|
|
+ $ridLoan = $XDeode->decode ( $ridLoanKey );
|
|
|
+
|
|
|
+ if (! is_numeric ( $rid ) || ! is_numeric ( $ridLoan ))
|
|
|
+ die ( 'illegal request-ridError' );
|
|
|
+
|
|
|
+ $receiptDetail = $receipt->getReceiptByRid ( $rid );
|
|
|
+ $receiptLoanDetail = $receipt->getReceiptByRid ( $ridLoan );
|
|
|
+ // 不合法的数据
|
|
|
+ if ($receiptDetail ['status'] != 5 || $receiptDetail ['Rtype'] != 3) {
|
|
|
+ die ( 'illegal request-receiptError' );
|
|
|
+ }
|
|
|
+ if ($receiptLoanDetail ['status'] != 10 || $receiptLoanDetail ['Rtype'] != 1) {
|
|
|
+ die ( 'illegal request-receipLoantError' );
|
|
|
+ }
|
|
|
+ // 培训班结算挂钩借款
|
|
|
+ $receipt = new receipt ();
|
|
|
+ $item = array (
|
|
|
+ 'rid' => $rid,
|
|
|
+ 'trainLoanRid' => 0
|
|
|
+ );
|
|
|
+ $receipt->setReceiptByCondition ( $item );
|
|
|
+ // 更新借款状态变成已挂钩
|
|
|
+ $receipt = new receipt ();
|
|
|
+ $item = array (
|
|
|
+ 'rid' => $ridLoan,
|
|
|
+ 'status' => 8,
|
|
|
+ 'statusTrain' => 0
|
|
|
+ );
|
|
|
+ $receipt->setReceiptByCondition ( $item );
|
|
|
+ $XDeode = new XDeode ( 7 );
|
|
|
+ return "/receiptTrainLoanEdi/" . $XDeode->encode ( $rid ) . ".html";
|
|
|
+ } else
|
|
|
+ die ( 'illegal request' );
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 培训班结算挂钩发票
|
|
|
+ * 编辑培训班结算 ---开票
|
|
|
*/
|
|
|
- function receiptTrainInvoiceEdi(){
|
|
|
+ function receiptTrainInvoiceEdi() {
|
|
|
$ridKey = isset ( $this->params ['rid'] ) ? $this->params ['rid'] : '';
|
|
|
|
|
|
Doo::loadClass ( 'XDeode' );
|
|
@@ -2462,20 +2543,195 @@ class ReceiptController extends DooController {
|
|
|
if (! is_numeric ( $rid ))
|
|
|
die ( 'illegal request' );
|
|
|
|
|
|
+ Doo::loadModel ( 'receipt' );
|
|
|
+ $receipt = new receipt ();
|
|
|
+ Doo::loadModel ( 'receiptTraining' );
|
|
|
+ $receiptTraining = new receiptTraining ();
|
|
|
+ Doo::loadModel ( 'invoice' );
|
|
|
+ $invoice = new invoice ();
|
|
|
+ Doo::loadModel ( 'invoiceTraining' );
|
|
|
+ $invoiceTraining = new invoiceTraining ();
|
|
|
+
|
|
|
+ $receiptDetail = $receipt->getReceiptByRid ( $rid );
|
|
|
+ if ($receiptDetail ['status'] != 5)
|
|
|
+ die ();
|
|
|
+ $receiptTrainingDetail = $receiptTraining->getReceiptTrainingByRtid ( $receiptDetail ['trainId'] );
|
|
|
+
|
|
|
+ $invoiceList = $invoiceTrainingDetail = array ();
|
|
|
+ if ($receiptDetail ['invoiceTrainId'] != 0) {
|
|
|
+ $invoiceList = $invoice->getInvoicePrintedByItid ( $receiptDetail ['invoiceTrainId'] );
|
|
|
+ $invoiceTrainingDetail = $invoiceTraining->getInvoiceTrainingByItid ( $receiptDetail ['invoiceTrainId'] );
|
|
|
+ }
|
|
|
+ // print_r($invoiceList);
|
|
|
+ $data ['invoiceList'] = $invoiceList;
|
|
|
+ $data ['invoiceTrainingDetail'] = $invoiceTrainingDetail;
|
|
|
+ $data ['receiptTrainingDetail'] = $receiptTrainingDetail;
|
|
|
+ $data ['receiptDetail'] = $receiptDetail;
|
|
|
+ $data ['trainEdiType'] = "INVOICE";
|
|
|
+ $data ['ridKey'] = $ridKey;
|
|
|
+ $data ['memu'] = "receipt";
|
|
|
+ $data ['staff'] = $this->staff;
|
|
|
+
|
|
|
+ $data ['receiptMemu'] = 'saeaBorad';
|
|
|
+ $data ['verifyId'] = $this->verifyId;
|
|
|
+ $data ['executeId'] = $this->executeId;
|
|
|
+
|
|
|
+ $this->render ( "/receipt/receiptTrainInvoiceEdi", $data );
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 编辑培训班结算---更新开票
|
|
|
+ */
|
|
|
+ function receiptTrainInvoiceEdiDo() {
|
|
|
+ $ridKey = $this->get_args ( 'ridKey' ) ? $this->get_args ( 'ridKey' ) : "";
|
|
|
+ $itidKey = $this->get_args ( 'itidKey' ) ? $this->get_args ( 'itidKey' ) : "";
|
|
|
+ if (! empty ( $ridKey ) && ! empty ( $itidKey )) {
|
|
|
Doo::loadModel ( 'receipt' );
|
|
|
$receipt = new receipt ();
|
|
|
- Doo::loadModel ( 'receiptTraining' );
|
|
|
- $receiptTraining = new receiptTraining ();
|
|
|
+ Doo::loadModel ( 'invoiceTraining' );
|
|
|
+ $invoiceTraining = new invoiceTraining ();
|
|
|
+
|
|
|
+ Doo::loadClass ( 'XDeode' );
|
|
|
+ $XDeode = new XDeode ( 5 );
|
|
|
+
|
|
|
+ $rid = $XDeode->decode ( $ridKey );
|
|
|
+ $itid = $XDeode->decode ( $itidKey );
|
|
|
+ if (! is_numeric ( $rid ) || ! is_numeric ( $itid ))
|
|
|
+ die ( 'illegal request-idError' );
|
|
|
+
|
|
|
+ $receiptDetail = $receipt->getReceiptByRid ( $rid );
|
|
|
+ $invoiceTrainDetail = $invoiceTraining->getInvoiceTrainingByItid ( $itid );
|
|
|
+ // 不合法的数据
|
|
|
+ if ($receiptDetail ['status'] != 5 || $receiptDetail ['Rtype'] != 3) {
|
|
|
+ die ( 'illegal request-receiptError' );
|
|
|
+ }
|
|
|
+ if (empty ( $invoiceTrainDetail )) {
|
|
|
+ die ( 'illegal request-receipLoantError' );
|
|
|
+ }
|
|
|
+ // 培训班结算挂钩借款
|
|
|
+ $receipt = new receipt ();
|
|
|
+ $item = array (
|
|
|
+ 'rid' => $rid,
|
|
|
+ 'invoiceTrainId' => $itid
|
|
|
+ );
|
|
|
+ $receipt->setReceiptByCondition ( $item );
|
|
|
+
|
|
|
+ $XDeode = new XDeode ( 7 );
|
|
|
+ return "/receiptTrainInvoiceEdi/" . $XDeode->encode ( $rid ) . ".html";
|
|
|
+ } else
|
|
|
+ die ( 'illegal request' );
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 更新培训班结算 收款和取消收款
|
|
|
+ */
|
|
|
+ function receiptTrainReceivables() {
|
|
|
+ $doType = isset ( $this->params ['doType'] ) ? $this->params ['doType'] : '';
|
|
|
+ $ridKey = $this->get_args ( 'ridKey' ) ? $this->get_args ( 'ridKey' ) : "";
|
|
|
+ $iidKey = $this->get_args ( 'iidKey' ) ? $this->get_args ( 'iidKey' ) : "";
|
|
|
+ Doo::loadClass ( 'XDeode' );
|
|
|
+ $XDeode = new XDeode ( 5 );
|
|
|
+ $rid = $XDeode->decode ( $ridKey );
|
|
|
+ $iid = $XDeode->decode ( $iidKey );
|
|
|
+ if (! is_numeric ( $rid ) || ! is_numeric ( $iid ))
|
|
|
+ die ( 'illegal request-iid' );
|
|
|
+
|
|
|
+ Doo::loadModel ( 'RIExtend' );
|
|
|
+ $RIExtend = new RIExtend ();
|
|
|
+
|
|
|
+ if ($doType == 'CONFIRM') {
|
|
|
+ $RIExtend->rid = $rid;
|
|
|
+ $RIExtend->iid = $iid;
|
|
|
+ $RIExtend->RIstatus = 1;
|
|
|
+ $RIExtend->insert ();
|
|
|
|
|
|
+ $XDeode = new XDeode ( 7 );
|
|
|
+ return '/receiptTrainInvoiceEdi/' . $XDeode->encode ( $rid ) . '.html';
|
|
|
+ } elseif ($doType == 'CANCEL') {
|
|
|
+ $RIExtend->delete ( array (
|
|
|
+ 'where' => 'rid=' . $rid . ' and iid=' . $iid,
|
|
|
+ 'limit' => 1
|
|
|
+ ) );
|
|
|
+ $XDeode = new XDeode ( 7 );
|
|
|
+ return '/receiptTrainInvoiceEdi/' . $XDeode->encode ( $rid ) . '.html';
|
|
|
+ } else {
|
|
|
+ die ( 'illegal request' );
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 移除挂钩的培训班发票
|
|
|
+ */
|
|
|
+ function receiptTrainReceivablesDelDo() {
|
|
|
+ $ridKey = $this->get_args ( 'ridKey' ) ? $this->get_args ( 'ridKey' ) : ""; // 费用 培训班结算
|
|
|
+ $itidKey = $this->get_args ( 'itidKey' ) ? $this->get_args ( 'itidKey' ) : ""; // 发票培训班
|
|
|
|
|
|
+ Doo::loadModel ( 'receipt' );
|
|
|
+ $receipt = new receipt ();
|
|
|
+ Doo::loadModel ( 'RIExtend' );
|
|
|
+ $RIExtend = new RIExtend ();
|
|
|
+ Doo::loadClass ( 'XDeode' );
|
|
|
+ $XDeode = new XDeode ( 5 );
|
|
|
+
|
|
|
+ $rid = $XDeode->decode ( $ridKey );
|
|
|
+ $itid = $XDeode->decode ( $itidKey );
|
|
|
+
|
|
|
+ if (is_numeric ( $rid ) && is_numeric ( $itid )) {
|
|
|
$receiptDetail = $receipt->getReceiptByRid ( $rid );
|
|
|
if ($receiptDetail ['status'] != 5)
|
|
|
- die ();
|
|
|
+ die ( 'illegal request-status' );
|
|
|
+
|
|
|
+ $receipt = new receipt ();
|
|
|
+ $receipt->rid = $rid;
|
|
|
+ $receipt->invoiceTrainId = 0;
|
|
|
+ $receipt->update ();
|
|
|
+
|
|
|
+ $RIExtend->delete ( array (
|
|
|
+ 'where' => 'rid=' . $rid
|
|
|
+ ) );
|
|
|
+ $XDeode = new XDeode ( 7 );
|
|
|
+ return '/receiptTrainInvoiceEdi/' . $XDeode->encode ( $rid ) . '.html';
|
|
|
+ } else
|
|
|
+ die ( 'illegal request-iid' );
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 编辑培训班结算
|
|
|
+ */
|
|
|
+ function receiptTrainItemEdi() {
|
|
|
+ $ridKey = isset ( $this->params ['rid'] ) ? $this->params ['rid'] : '';
|
|
|
+
|
|
|
+ Doo::loadClass ( 'XDeode' );
|
|
|
+ $XDeode = new XDeode ( 7 );
|
|
|
+ $rid = $XDeode->decode ( $ridKey );
|
|
|
|
|
|
- $receiptTrainingDetail = $receiptTraining->getReceiptTrainingByRtid ( $receiptDetail ['trainId'] );
|
|
|
+ if (! is_numeric ( $rid ))
|
|
|
+ die ( 'illegal request' );
|
|
|
|
|
|
+ Doo::loadModel ( 'receipt' );
|
|
|
+ $receipt = new receipt ();
|
|
|
+ Doo::loadModel ( 'receiptTraining' );
|
|
|
+ $receiptTraining = new receiptTraining ();
|
|
|
+ Doo::loadModel ( 'RItem' );
|
|
|
+ $RItem = new RItem ();
|
|
|
+ Doo::loadModel ( 'accountItem' );
|
|
|
+ $accountItem = new accountItem ();
|
|
|
+
|
|
|
+ $receiptDetail = $receipt->getReceiptByRid ( $rid );
|
|
|
+ if ($receiptDetail ['status'] != 5)
|
|
|
+ die ();
|
|
|
+ $receiptTrainingDetail = $receiptTraining->getReceiptTrainingByRtid ( $receiptDetail ['trainId'] );
|
|
|
+
|
|
|
+ $RItemList = $RItem->getRItemByRid ( $rid );
|
|
|
+ $aiList = $accountItem->getAccountBookByCategory ( '培训班费用' );
|
|
|
+
|
|
|
+ // print_r($RItemList);
|
|
|
+ $data ['RItemList'] = $RItemList;
|
|
|
+ $data ['aiList'] = $aiList;
|
|
|
+
|
|
|
+ $data ['receiptTrainingDetail'] = $receiptTrainingDetail;
|
|
|
$data ['receiptDetail'] = $receiptDetail;
|
|
|
- $data ['trainEdiType'] = "INVOICE";
|
|
|
+ $data ['trainEdiType'] = "ITEM";
|
|
|
$data ['ridKey'] = $ridKey;
|
|
|
$data ['memu'] = "receipt";
|
|
|
$data ['staff'] = $this->staff;
|
|
@@ -2484,9 +2740,435 @@ class ReceiptController extends DooController {
|
|
|
$data ['verifyId'] = $this->verifyId;
|
|
|
$data ['executeId'] = $this->executeId;
|
|
|
|
|
|
- $this->render ( "/receipt/receiptTrainInvoiceEdi", $data );
|
|
|
+ $this->render ( "/receipt/receiptTrainItemEdi", $data );
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 添加支出项
|
|
|
+ */
|
|
|
+ function receiptTrainItemAddDo() {
|
|
|
+ $ridKey = $this->get_args ( 'ridKey' ) ? $this->get_args ( 'ridKey' ) : "";
|
|
|
+
|
|
|
+ // 支出项信息
|
|
|
+ $item = $this->get_args ( 'item' ) ? $this->get_args ( 'item' ) : "";
|
|
|
+ $price = $this->get_args ( 'price' ) ? $this->get_args ( 'price' ) : "";
|
|
|
+ $date = $this->get_args ( 'date' ) ? $this->get_args ( 'date' ) : "";
|
|
|
+ $inputer = $this->get_args ( 'inputer' ) ? $this->get_args ( 'inputer' ) : "";
|
|
|
+ $describe = $this->get_args ( 'describe' ) ? $this->get_args ( 'describe' ) : "";
|
|
|
+
|
|
|
+ if (! empty ( $ridKey ) && ! empty ( $item ) && ! empty ( $price ) && ! empty ( $date ) && ! empty ( $inputer )) {
|
|
|
+ Doo::loadClass ( 'XDeode' );
|
|
|
+ $XDeode = new XDeode ( 5 );
|
|
|
+ Doo::loadModel ( 'RItem' );
|
|
|
+ $RItem = new RItem ();
|
|
|
+
|
|
|
+ $rid = $XDeode->decode ( $ridKey );
|
|
|
+ if (! is_numeric ( $rid ))
|
|
|
+ die ( 'illegal request' );
|
|
|
+
|
|
|
+ $RItem->rid = $rid;
|
|
|
+ $RItem->item = $item;
|
|
|
+
|
|
|
+ $RItem->price = $price;
|
|
|
+ $RItem->date = $date;
|
|
|
+ $RItem->inputer = $inputer;
|
|
|
+ $RItem->describe = $describe;
|
|
|
+
|
|
|
+ $RItem->insert ();
|
|
|
+
|
|
|
+ // 添加公司汇总
|
|
|
+ // 报销详情
|
|
|
+ Doo::loadModel ( 'receiptDetail' );
|
|
|
+ $receiptDetail = new receiptDetail ();
|
|
|
+ Doo::loadModel ( 'receipt' );
|
|
|
+ $receipt = new receipt ();
|
|
|
+
|
|
|
+ $rInfo = $receipt->getReceiptByRid ( $rid );
|
|
|
+ $rdInfo = $receiptDetail->getReceiptDetailByRIC ( $rid, $item, '培训班费用' );
|
|
|
+ if (empty ( $rdInfo )) {
|
|
|
+ $receiptDetail = new receiptDetail ();
|
|
|
+ $receiptDetail->staff = $this->staff [0] ['sid'];
|
|
|
+ $receiptDetail->item = $item;
|
|
|
+ $receiptDetail->itemCategory = '培训班费用';
|
|
|
+ $receiptDetail->price = number_format ( $price, 2, '.', '' );
|
|
|
+ $receiptDetail->date = date ( "Y-m-d" );
|
|
|
+ $receiptDetail->cid = $rInfo ['cid'];
|
|
|
+ $receiptDetail->rid = $rid;
|
|
|
+ $receiptDetail->status = 4;
|
|
|
+ $receiptDetail->insert ();
|
|
|
+ } else {
|
|
|
+ $receiptDetail = new receiptDetail ();
|
|
|
+ $rdInfo ['price'] += number_format ( $price, 2, '.', '' );
|
|
|
+ $receiptDetail->price = $rdInfo ['price'];
|
|
|
+ $receiptDetail->update ( array (
|
|
|
+ 'where' => 'rid=' . $rid . ' and item like "' . $item . '" and itemCategory like "培训班费用"'
|
|
|
+ ) );
|
|
|
+ }
|
|
|
+
|
|
|
+ $XDeode = new XDeode ( 7 );
|
|
|
+ return '/receiptTrainItemEdi/' . $XDeode->encode ( $rid ) . '.html';
|
|
|
+ } else
|
|
|
+ die ( 'illegal request' );
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 培训班结算-讲师
|
|
|
+ */
|
|
|
+ function receiptTrainLecturerEdi() {
|
|
|
+ $ridKey = isset ( $this->params ['rid'] ) ? $this->params ['rid'] : '';
|
|
|
+
|
|
|
+ Doo::loadClass ( 'XDeode' );
|
|
|
+ $XDeode = new XDeode ( 7 );
|
|
|
+ $rid = $XDeode->decode ( $ridKey );
|
|
|
+
|
|
|
+ if (! is_numeric ( $rid ))
|
|
|
+ die ( 'illegal request' );
|
|
|
+
|
|
|
+ Doo::loadModel ( 'receipt' );
|
|
|
+ $receipt = new receipt ();
|
|
|
+ Doo::loadModel ( 'receiptTraining' );
|
|
|
+ $receiptTraining = new receiptTraining ();
|
|
|
+ Doo::loadModel ( 'RILecturer' );
|
|
|
+ $RILecturer = new RILecturer ();
|
|
|
+
|
|
|
+ Doo::loadModel ( 'lecturer' );
|
|
|
+ $lecturer = new lecturer ();
|
|
|
+
|
|
|
+ $receiptDetail = $receipt->getReceiptByRid ( $rid );
|
|
|
+ if ($receiptDetail ['status'] != 5)
|
|
|
+ die ();
|
|
|
+ $receiptTrainingDetail = $receiptTraining->getReceiptTrainingByRtid ( $receiptDetail ['trainId'] );
|
|
|
+
|
|
|
+ $RILecturerList = $RILecturer->getRILecturerByRid ( $rid );
|
|
|
+
|
|
|
+ $lecturerList = $lecturer->getLecturerAll ();
|
|
|
+ $INSIDEhtml = $OUTSIDEhtml = '';
|
|
|
+ foreach ( $lecturerList as $key => $value ) {
|
|
|
+ if ($value ['ltype'] == 'INSIDE') {
|
|
|
+ $INSIDEhtml .= '<option value="' . $value ['category'] . '-' . $value ['staff'] . '">' . $value ['category'] . '-' . $value ['staff'] . '</option>';
|
|
|
+ } elseif ($value ['ltype'] == 'OUTSIDE') {
|
|
|
+ $OUTSIDEhtml .= '<option value="' . $value ['staff'] . '">' . $value ['staff'] . '</option>';
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $data ['INSIDEhtml'] = $INSIDEhtml;
|
|
|
+ $data ['OUTSIDEhtml'] = $OUTSIDEhtml;
|
|
|
+ // print_r($RItemList);
|
|
|
+ $data ['RILecturerList'] = $RILecturerList;
|
|
|
+
|
|
|
+ $data ['receiptTrainingDetail'] = $receiptTrainingDetail;
|
|
|
+ $data ['receiptDetail'] = $receiptDetail;
|
|
|
+ $data ['trainEdiType'] = "LECTURER";
|
|
|
+ $data ['ridKey'] = $ridKey;
|
|
|
+ $data ['memu'] = "receipt";
|
|
|
+ $data ['staff'] = $this->staff;
|
|
|
+
|
|
|
+ $data ['receiptMemu'] = 'saeaBorad';
|
|
|
+ $data ['verifyId'] = $this->verifyId;
|
|
|
+ $data ['executeId'] = $this->executeId;
|
|
|
+
|
|
|
+ $this->render ( "/receipt/receiptTrainLecturerEdi", $data );
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 添加讲师
|
|
|
+ */
|
|
|
+ function receiptTrainLecturerAddDo() {
|
|
|
+ $ridKey = $this->get_args ( 'ridKey' ) ? $this->get_args ( 'ridKey' ) : "";
|
|
|
+
|
|
|
+ // 支出项信息
|
|
|
+ $ltype = $this->get_args ( 'ltype' ) ? $this->get_args ( 'ltype' ) : "";
|
|
|
+ $lecturerName = $this->get_args ( 'lecturerName' ) ? $this->get_args ( 'lecturerName' ) : "";
|
|
|
+ $schoolDay = $this->get_args ( 'schoolDay' ) ? $this->get_args ( 'schoolDay' ) : "";
|
|
|
+ $price = $this->get_args ( 'price' ) ? $this->get_args ( 'price' ) : "";
|
|
|
+ $taxation = $this->get_args ( 'taxation' ) ? $this->get_args ( 'taxation' ) : "";
|
|
|
+
|
|
|
+ if (! empty ( $ridKey ) && ! empty ( $ltype ) && ! empty ( $lecturerName ) && ! empty ( $schoolDay ) && ! empty ( $price )) {
|
|
|
+ Doo::loadClass ( 'XDeode' );
|
|
|
+ $XDeode = new XDeode ( 5 );
|
|
|
+ Doo::loadModel ( 'RILecturer' );
|
|
|
+ $RILecturer = new RILecturer ();
|
|
|
+
|
|
|
+ $rid = $XDeode->decode ( $ridKey );
|
|
|
+ if (! is_numeric ( $rid ))
|
|
|
+ die ( 'illegal request' );
|
|
|
+
|
|
|
+ if ($ltype == 'OUTSIDE' && empty ( $taxation ))
|
|
|
+ die ( 'illegal request-taxationError' );
|
|
|
+
|
|
|
+ $RILecturer->rid = $rid;
|
|
|
+ $RILecturer->ltype = $ltype;
|
|
|
+ if ($ltype == 'OUTSIDE') {
|
|
|
+ if ($taxation == 'TAXATION') {
|
|
|
+ $RILecturer->taxation = 1;
|
|
|
+ } elseif ($taxation == 'NOTAXATION') {
|
|
|
+ $RILecturer->taxation = 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $RILecturer->lecturerName = $lecturerName;
|
|
|
+ $RILecturer->schoolDay = $schoolDay;
|
|
|
+ $RILecturer->price = $price;
|
|
|
+ $RILecturer->insert ();
|
|
|
+
|
|
|
+ // 添加公司汇总
|
|
|
+ // 报销详情
|
|
|
+ Doo::loadModel ( 'receiptDetail' );
|
|
|
+ $receiptDetail = new receiptDetail ();
|
|
|
+ Doo::loadModel ( 'receipt' );
|
|
|
+ $receipt = new receipt ();
|
|
|
+
|
|
|
+ // 金额总计
|
|
|
+ $price = $price * $schoolDay;
|
|
|
+
|
|
|
+ $rInfo = $receipt->getReceiptByRid ( $rid );
|
|
|
+ $rdInfo = $receiptDetail->getReceiptDetailByRIC ( $rid, '讲课费', '培训班费用' );
|
|
|
+ if (empty ( $rdInfo )) {
|
|
|
+ $receiptDetail = new receiptDetail ();
|
|
|
+ $receiptDetail->staff = $this->staff [0] ['sid'];
|
|
|
+ $receiptDetail->item = '讲课费';
|
|
|
+ $receiptDetail->itemCategory = '培训班费用';
|
|
|
+ $receiptDetail->price = number_format ( $price, 2, '.', '' );
|
|
|
+ $receiptDetail->date = date ( "Y-m-d" );
|
|
|
+ $receiptDetail->cid = $rInfo ['cid'];
|
|
|
+ $receiptDetail->rid = $rid;
|
|
|
+ $receiptDetail->status = 4;
|
|
|
+ $receiptDetail->insert ();
|
|
|
+ } else {
|
|
|
+ $receiptDetail = new receiptDetail ();
|
|
|
+ $rdInfo ['price'] += number_format ( $price, 2, '.', '' );
|
|
|
+ $receiptDetail->price = $rdInfo ['price'];
|
|
|
+ $receiptDetail->update ( array (
|
|
|
+ 'where' => 'rid=' . $rid . ' and item like "' . '讲课费' . '" and itemCategory like "培训班费用"'
|
|
|
+ ) );
|
|
|
+ }
|
|
|
+
|
|
|
+ $XDeode = new XDeode ( 7 );
|
|
|
+ return '/receiptTrainLecturerEdi/' . $XDeode->encode ( $rid ) . '.html';
|
|
|
+ } else
|
|
|
+ die ( 'illegal request' );
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 移除讲师
|
|
|
+ */
|
|
|
+ function receiptTrainLecturerDelDo() {
|
|
|
+ $ridKey = $this->get_args ( 'ridKey' ) ? $this->get_args ( 'ridKey' ) : ""; // 费用 培训班结算
|
|
|
+ $rlidKey = $this->get_args ( 'rlidKey' ) ? $this->get_args ( 'rlidKey' ) : ""; // 发票培训班
|
|
|
+
|
|
|
+ Doo::loadModel ( 'receipt' );
|
|
|
+ $receipt = new receipt ();
|
|
|
+ Doo::loadModel ( 'RILecturer' );
|
|
|
+ $RILecturer = new RILecturer ();
|
|
|
+ Doo::loadClass ( 'XDeode' );
|
|
|
+ $XDeode = new XDeode ( 5 );
|
|
|
+
|
|
|
+ $rid = $XDeode->decode ( $ridKey );
|
|
|
+ $rlid = $XDeode->decode ( $rlidKey );
|
|
|
+
|
|
|
+ if (is_numeric ( $rid ) && is_numeric ( $rlid )) {
|
|
|
+ $receiptDetail = $receipt->getReceiptByRid ( $rid );
|
|
|
+ if ($receiptDetail ['status'] != 5)
|
|
|
+ die ( 'illegal request-status' );
|
|
|
+
|
|
|
+ $RILecturer->delete ( array (
|
|
|
+ 'where' => 'rid=' . $rid . ' and rlid=' . $rlid
|
|
|
+ ) );
|
|
|
+ $XDeode = new XDeode ( 7 );
|
|
|
+ return '/receiptTrainLecturerEdi/' . $XDeode->encode ( $rid ) . '.html';
|
|
|
+ } else
|
|
|
+ die ( 'illegal request-iid' );
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 培训班提交审批
|
|
|
+ */
|
|
|
+ function receiptTrainApprovalDo() {
|
|
|
+ $ridKey = $this->get_args ( 'ridKey' ) ? $this->get_args ( 'ridKey' ) : "";;
|
|
|
+
|
|
|
+ Doo::loadClass ( 'XDeode' );
|
|
|
+ $XDeode = new XDeode ( 7 );
|
|
|
+ $rid = $XDeode->decode ( $ridKey );
|
|
|
+
|
|
|
+ Doo::loadModel ( 'receipt' );
|
|
|
+ $receipt = new receipt ();
|
|
|
+ Doo::loadModel ( 'receiptDetail' );
|
|
|
+ $receiptDetail = new receiptDetail ();
|
|
|
+ Doo::loadModel ( 'statistics' );
|
|
|
+ $statistics = new statistics ();
|
|
|
+
|
|
|
+
|
|
|
+ Doo::loadModel ( "verify" );
|
|
|
+ $verify = new verify ();
|
|
|
+
|
|
|
+ // 审批状态的判定
|
|
|
+ $receiptDetailList = $receipt->getOne ( array (
|
|
|
+ 'where' => 'staff=' . $this->staff [0] ['sid'] . ' and rid=' . $rid . ' and (status=4 or status=5 or status=7)',
|
|
|
+ 'asArray' => true
|
|
|
+ ) );
|
|
|
+ if (empty ( $receiptDetailList ))
|
|
|
+ return "/saeaBorad";
|
|
|
+
|
|
|
+ $verifyDetail = $verify->getOne ( array (
|
|
|
+ 'where' => ' vid =' . $receiptDetailList ['verify'],
|
|
|
+ 'asArray' => true
|
|
|
+ ) );
|
|
|
+ $verifyDetail = json_decode ( $verifyDetail ['staff'], true );
|
|
|
+
|
|
|
+ if (empty ( $receiptDetailList ['nowStaff'] )) {
|
|
|
+
|
|
|
+ $nowStaff = "";
|
|
|
+ $nowStaffList = array ();
|
|
|
+ if ($verifyDetail [0] [1] == 'ROLE') {
|
|
|
+ $vStaffString = json_decode ( $verifyDetail [0] [3] );
|
|
|
+ foreach ( $vStaffString as $key => $value ) {
|
|
|
+ $staffK = explode ( "_", $value );
|
|
|
+ array_push ( $nowStaffList, $staffK [0] );
|
|
|
+ }
|
|
|
+ $nowStaff = implode ( ',', $nowStaffList );
|
|
|
+ } else {
|
|
|
+ $nowStaff = $verifyDetail [0] [0];
|
|
|
+ }
|
|
|
+ $receipt->nowStaff = $nowStaff;
|
|
|
+ }
|
|
|
+ // echo $nowStaff;
|
|
|
+ // print_r($verifyDetail);die;
|
|
|
+
|
|
|
+ $receipt->rid = $receiptDetailList ['rid'];
|
|
|
+ $receipt->date = date ( "Y-m-d" );
|
|
|
+ $receipt->status = 2;
|
|
|
+ $receipt->update ();
|
|
|
+
|
|
|
+ $receiptDetail->status = 2;
|
|
|
+ $receiptDetail->update ( array (
|
|
|
+ 'where' => 'rid=' . $receiptDetailList ['rid']
|
|
|
+ ) );
|
|
|
+
|
|
|
+ Doo::loadModel ( "receiptLog" );
|
|
|
+ $receiptLog = new receiptLog ();
|
|
|
+ Doo::loadModel ( "verify" );
|
|
|
+ $verify = new verify ();
|
|
|
+
|
|
|
+ $vr = $verify->getOne ( array (
|
|
|
+ 'where' => 'vid=' . $receiptDetailList ['verify'],
|
|
|
+ 'asArray' => true
|
|
|
+ ) );
|
|
|
+
|
|
|
+ $jd = json_decode ( $vr ['staff'] );
|
|
|
+ $roleId = 0;
|
|
|
+
|
|
|
+ foreach ( $jd as $key => $value ) {
|
|
|
+ if ($value [1] == 'ROLE') {
|
|
|
+ $pos = strpos ( $value [3], $this->staff [0] ['sid'] );
|
|
|
+ if ($pos !== false) {
|
|
|
+ $roleId = $value [0];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 审批日志
|
|
|
+ // echo $roleId;die;
|
|
|
+
|
|
|
+ if (! empty ( $roleId )) {
|
|
|
+ Doo::loadModel ( "role" );
|
|
|
+ $role = new role ();
|
|
|
+ $roleInfo = $role->getOne ( array (
|
|
|
+ 'where' => 'rid=' . $roleId,
|
|
|
+ 'asArray' => true
|
|
|
+ ) );
|
|
|
+
|
|
|
+ // $receiptLog->rolename = $roleInfo ['name'];
|
|
|
+ }
|
|
|
+
|
|
|
+ $receiptLog->username = $this->staff [0] ['username'];
|
|
|
+ $receiptLog->uid = $this->staff [0] ['sid'];
|
|
|
+ $receiptLog->date = date ( "Y-m-d" );
|
|
|
+ $receiptLog->opinion = '提交审批';
|
|
|
+ $receiptLog->img = $this->staff [0] ['avatar'];
|
|
|
+ $receiptLog->status = 2;
|
|
|
+ $receiptLog->rid = $rid;
|
|
|
+ $receiptLog->insert ();
|
|
|
+
|
|
|
+ //写入列表项
|
|
|
+ Doo::loadModel ( 'accountItem' );
|
|
|
+ $accountItem = new accountItem ();
|
|
|
+ $aItem = $accountItem->getAccountBookByCategory ( '培训班费用' );
|
|
|
+
|
|
|
+ // 项目金额合计
|
|
|
+ Doo::loadModel ( 'RItem' );
|
|
|
+ $RItem = new RItem ();
|
|
|
+ // 讲师获得
|
|
|
+ Doo::loadModel ( 'RILecturer' );
|
|
|
+ $RILecturer = new RILecturer ();
|
|
|
+ $RItemList = $RItem->getRItemByRid ( $rid );
|
|
|
+ $RILecturerList = $RILecturer->getRILecturerByRid ( $rid );
|
|
|
+ // 支出项金额详情
|
|
|
+ $aiData = $accountItem->getTrainingDetail ( $RItemList, $RILecturerList, 0 );
|
|
|
+ //print_r($aItem);
|
|
|
+ //print_r($aiData);
|
|
|
+
|
|
|
+ $accountJson [$this->AGENCY] = $accountJson [$this->TRAVEL] = $accountJson [$this->TRAIN] = $accountJson [$this->OTHER] = array ();
|
|
|
+ $ag = $tr = $ta = $ot = 0;
|
|
|
+ $sum = $agencySum = $travelSum = $trainSum = $otherSum = 0;
|
|
|
+
|
|
|
+ foreach ( $aItem as $key => $value ) {
|
|
|
+ if ($value ['category'] == $this->TRAIN) {
|
|
|
+
|
|
|
+ foreach ($aiData['dataList'] as $k=>$v){
|
|
|
+ if ($value ['name'] == $v['name']) {
|
|
|
+ array_push ( $accountJson [$this->TRAIN], array (
|
|
|
+ 'aid' => $value ['aid'],
|
|
|
+ 'name' => $value ['name'],
|
|
|
+ 'price' => number_format ( $v['price'], 2, '.', '' )
|
|
|
+ ) );
|
|
|
+ $sum += $v['price'];
|
|
|
+ $trainSum += $v['price'];
|
|
|
+ unset($aiData['dataList'][$k]);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $accountJson ['cSum'] = array (
|
|
|
+ 'agencySum' => number_format ( $agencySum, 2, '.', '' ),
|
|
|
+ 'travelSum' => number_format ( $travelSum, 2, '.', '' ),
|
|
|
+ 'trainSum' => number_format ( $trainSum, 2, '.', '' ),
|
|
|
+ 'otherSum' => number_format ( $otherSum, 2, '.', '' )
|
|
|
+ );
|
|
|
+
|
|
|
+ // 报销单
|
|
|
+ $receipt = new receipt ();
|
|
|
+ $receipt->accountItem = json_encode ( $accountJson );
|
|
|
+ $receipt->sum = number_format ( $sum, 2, '.', '' );
|
|
|
+ $receipt->update ( array (
|
|
|
+ 'where' => 'rid=' . $rid
|
|
|
+ ) );
|
|
|
+ //print_r($accountJson);
|
|
|
+ // statistics item 统计写入
|
|
|
+ $dateArray = explode ( "-", $receiptDetailList ['date'] );
|
|
|
+ $dateCondition = " and Year(date) =" . $dateArray [0] . " and Month(date) = " . $dateArray [1];
|
|
|
+
|
|
|
+ $accountItem = $accountJson ;
|
|
|
+
|
|
|
+ $stat = $statistics->getOne ( array (
|
|
|
+ 'where' => 'staff=' . $this->staff [0] ['sid'] . $dateCondition,
|
|
|
+ 'asArray' => true
|
|
|
+ ) );
|
|
|
+ if (empty ( $stat )) {
|
|
|
+ $statistics->date = date ( "Y-m-d" );
|
|
|
+ $statistics->cid = $this->staff [0] ['cid'];
|
|
|
+ $statistics->staff = $this->staff [0] ['sid'];
|
|
|
+ $statistics->agPrice = 0;
|
|
|
+ $statistics->rePrice = $accountItem ['cSum'] ['agencySum'] + $accountItem ['cSum'] ['travelSum'] + $accountItem ['cSum'] ['trainSum'] + $accountItem ['cSum'] ['otherSum'];
|
|
|
+ $statistics->insert ();
|
|
|
+ } else {
|
|
|
+ $statistics->rePrice = $stat ['rePrice'] + $accountItem ['cSum'] ['agencySum'] + $accountItem ['cSum'] ['travelSum'] + $accountItem ['cSum'] ['trainSum'] + $accountItem ['cSum'] ['otherSum'];
|
|
|
+ $statistics->update ( array (
|
|
|
+ 'where' => 'sid=' . $stat ['sid']
|
|
|
+ ) );
|
|
|
+ }
|
|
|
+
|
|
|
+ return "/saeaBorad";
|
|
|
+ }
|
|
|
function confirmation() {
|
|
|
$rid = isset ( $this->params ['rid'] ) ? $this->params ['rid'] : 0;
|
|
|
|
|
@@ -15087,6 +15769,59 @@ class ReceiptController extends DooController {
|
|
|
$mail->CharSet = "UTF-8";
|
|
|
return $mail->Send ();
|
|
|
}
|
|
|
+ function h5Upload() {
|
|
|
+ $POST_MAX_SIZE = ini_get ( 'post_max_size' );
|
|
|
+ $unit = strtoupper ( substr ( $POST_MAX_SIZE, - 1 ) );
|
|
|
+ $multiplier = ($unit == 'M' ? 1048576 : ($unit == 'K' ? 1024 : ($unit == 'G' ? 1073741824 : 1)));
|
|
|
+
|
|
|
+ if (( int ) $_SERVER ['CONTENT_LENGTH'] > $multiplier * ( int ) $POST_MAX_SIZE && $POST_MAX_SIZE) {
|
|
|
+ header ( "HTTP/1.1 500 Internal Server Error" );
|
|
|
+ echo "POST exceeded maximum allowed size.";
|
|
|
+ exit ( 0 );
|
|
|
+ }
|
|
|
+
|
|
|
+ // Settings
|
|
|
+ $save_path = DOO::conf ()->SITE_PATH . "upload/swfupload/"; // The path were we will save the file (getcwd() may not be reliable and should be tested in your environment)
|
|
|
+ $upload_name = "Filedata";
|
|
|
+ $max_file_size_in_bytes = 2147483647; // 2GB in bytes
|
|
|
+ $extension_whitelist = array (
|
|
|
+ "doc",
|
|
|
+ "txt",
|
|
|
+ "jpg",
|
|
|
+ "gif",
|
|
|
+ "png"
|
|
|
+ ); // Allowed file extensions
|
|
|
+ $valid_chars_regex = '.A-Z0-9_ !@#$%^&()+={}\[\]\',~`-'; // Characters allowed in the file name (in a Regular Expression format)
|
|
|
+
|
|
|
+ // Other variables
|
|
|
+ $MAX_FILENAME_LENGTH = 260;
|
|
|
+ $file_name = "";
|
|
|
+ $file_extension = "";
|
|
|
+ $uploadErrors = array (
|
|
|
+ 0 => "文件上传成功",
|
|
|
+ 1 => "上传的文件超过了 php.ini 文件中的 upload_max_filesize directive 里的设置",
|
|
|
+ 2 => "上传的文件超过了 HTML form 文件中的 MAX_FILE_SIZE directive 里的设置",
|
|
|
+ 3 => "上传的文件仅为部分文件",
|
|
|
+ 4 => "没有文件上传",
|
|
|
+ 6 => "缺少临时文件夹"
|
|
|
+ );
|
|
|
+
|
|
|
+ $nk = time ();
|
|
|
+ $file_name = $nk . '.' . $this->_GetFileEXT ( $_FILES [$upload_name] ['name'] ); // preg_replace('/[^'.$valid_chars_regex.']|\.+$/i', "", basename($_FILES[$upload_name]['name']));
|
|
|
+
|
|
|
+ if (! @move_uploaded_file ( $_FILES [$upload_name] ["tmp_name"], $save_path . $file_name )) {
|
|
|
+ echo "文件无法保存.";
|
|
|
+ exit ( 0 );
|
|
|
+ }
|
|
|
+
|
|
|
+ // Return output to the browser (only supported by SWFUpload for Flash Player 9)
|
|
|
+
|
|
|
+ echo json_encode ( array (
|
|
|
+ 'filename' => $file_name,
|
|
|
+ 'id' => $nk
|
|
|
+ ) );
|
|
|
+ exit ( 0 );
|
|
|
+ }
|
|
|
function swfupload() {
|
|
|
$POST_MAX_SIZE = ini_get ( 'post_max_size' );
|
|
|
$unit = strtoupper ( substr ( $POST_MAX_SIZE, - 1 ) );
|