|
@@ -169,9 +169,9 @@ class ReceiptController extends DooController {
|
|
|
}
|
|
|
function saeaBorad() {
|
|
|
Doo::loadModel ( 'receipt' );
|
|
|
+ $receipt = new receipt ();
|
|
|
Doo::loadModel ( 'verify' );
|
|
|
$verify = new verify ();
|
|
|
- $receipt = new receipt ();
|
|
|
Doo::loadModel ( 'L_category' );
|
|
|
$lCategory = new L_category ();
|
|
|
Doo::loadModel ( "role" );
|
|
@@ -251,28 +251,11 @@ class ReceiptController extends DooController {
|
|
|
$acItem = $accountItem->find ( array (
|
|
|
'asArray' => true
|
|
|
) );
|
|
|
- $veList = $verify->find ( array (
|
|
|
- 'asArray' => true
|
|
|
- ) );
|
|
|
|
|
|
- foreach ( $veList as $key => $value ) {
|
|
|
- $v = json_decode ( $value ['staff'] );
|
|
|
-
|
|
|
- $list = array ();
|
|
|
- foreach ( $v as $n => $m ) {
|
|
|
- if ($m ['1'] == 'ROLE') {
|
|
|
- $roleInfo = $role->getOne ( array (
|
|
|
- 'where' => 'rid=' . $m [0],
|
|
|
- 'asArray' => true
|
|
|
- ) );
|
|
|
- $v [$n] [1] = $roleInfo ['name'];
|
|
|
- array_push ( $list, $roleInfo ['name'] );
|
|
|
- } else {
|
|
|
- array_push ( $list, $v [$n] [1] );
|
|
|
- }
|
|
|
- }
|
|
|
- $veList [$key] ['staff'] = implode ( '>', $list );
|
|
|
- }
|
|
|
+ $veList = $verify->getVerifyBySubordinate('REMIT');
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
$data ['category'] = $lCategory->find ( array (
|
|
|
'asArray' => true
|
|
@@ -459,28 +442,9 @@ class ReceiptController extends DooController {
|
|
|
$acItem = $accountItem->find ( array (
|
|
|
'asArray' => true
|
|
|
) );
|
|
|
- $veList = $verify->find ( array (
|
|
|
- 'asArray' => true
|
|
|
- ) );
|
|
|
+ $veList = $verify->getVerifyBySubordinate('REMIT');
|
|
|
+
|
|
|
|
|
|
- foreach ( $veList as $key => $value ) {
|
|
|
- $v = json_decode ( $value ['staff'] );
|
|
|
-
|
|
|
- $list = array ();
|
|
|
- foreach ( $v as $n => $m ) {
|
|
|
- if ($m ['1'] == 'ROLE') {
|
|
|
- $roleInfo = $role->getOne ( array (
|
|
|
- 'where' => 'rid=' . $m [0],
|
|
|
- 'asArray' => true
|
|
|
- ) );
|
|
|
- $v [$n] [1] = $roleInfo ['name'];
|
|
|
- array_push ( $list, $roleInfo ['name'] );
|
|
|
- } else {
|
|
|
- array_push ( $list, $v [$n] [1] );
|
|
|
- }
|
|
|
- }
|
|
|
- $veList [$key] ['staff'] = implode ( '>', $list );
|
|
|
- }
|
|
|
|
|
|
// 配置编辑信息
|
|
|
$accountItemList = json_decode ( $receiptDetail ['accountItem'], true );
|
|
@@ -989,28 +953,9 @@ class ReceiptController extends DooController {
|
|
|
Doo::loadModel ( 'L_category' );
|
|
|
$lCategory = new L_category ();
|
|
|
|
|
|
- $veList = $verify->find ( array (
|
|
|
- 'asArray' => true
|
|
|
- ) );
|
|
|
+ $veList = $verify->getVerifyBySubordinate('LOAN');
|
|
|
+
|
|
|
|
|
|
- foreach ( $veList as $key => $value ) {
|
|
|
- $v = json_decode ( $value ['staff'] );
|
|
|
-
|
|
|
- $list = array ();
|
|
|
- foreach ( $v as $n => $m ) {
|
|
|
- if ($m ['1'] == 'ROLE') {
|
|
|
- $roleInfo = $role->getOne ( array (
|
|
|
- 'where' => 'rid=' . $m [0],
|
|
|
- 'asArray' => true
|
|
|
- ) );
|
|
|
- $v [$n] [1] = $roleInfo ['name'];
|
|
|
- array_push ( $list, $roleInfo ['name'] );
|
|
|
- } else {
|
|
|
- array_push ( $list, $v [$n] [1] );
|
|
|
- }
|
|
|
- }
|
|
|
- $veList [$key] ['staff'] = implode ( '>', $list );
|
|
|
- }
|
|
|
|
|
|
$data ['category'] = $lCategory->find ( array (
|
|
|
'asArray' => true
|
|
@@ -1171,6 +1116,7 @@ class ReceiptController extends DooController {
|
|
|
) );
|
|
|
|
|
|
$veList = $verify->find ( array (
|
|
|
+ 'where'=>'subordinate like "%LOAN%"',
|
|
|
'asArray' => true
|
|
|
) );
|
|
|
|
|
@@ -1549,28 +1495,9 @@ class ReceiptController extends DooController {
|
|
|
'asArray' => true
|
|
|
) );
|
|
|
|
|
|
- $veList = $verify->find ( array (
|
|
|
- 'asArray' => true
|
|
|
- ) );
|
|
|
+ $veList = $verify->getVerifyBySubordinate('RECEIPT','LOAN');
|
|
|
+
|
|
|
|
|
|
- foreach ( $veList as $key => $value ) {
|
|
|
- $v = json_decode ( $value ['staff'] );
|
|
|
-
|
|
|
- $list = array ();
|
|
|
- foreach ( $v as $n => $m ) {
|
|
|
- if ($m ['1'] == 'ROLE') {
|
|
|
- $roleInfo = $role->getOne ( array (
|
|
|
- 'where' => 'rid=' . $m [0],
|
|
|
- 'asArray' => true
|
|
|
- ) );
|
|
|
- $v [$n] [1] = $roleInfo ['name'];
|
|
|
- array_push ( $list, $roleInfo ['name'] );
|
|
|
- } else {
|
|
|
- array_push ( $list, $v [$n] [1] );
|
|
|
- }
|
|
|
- }
|
|
|
- $veList [$key] ['staff'] = implode ( '>', $list );
|
|
|
- }
|
|
|
|
|
|
$data ['rid'] = $rid;
|
|
|
|
|
@@ -2106,7 +2033,7 @@ class ReceiptController extends DooController {
|
|
|
// 审批组
|
|
|
Doo::loadModel ( 'verify' );
|
|
|
$verify = new verify ();
|
|
|
- $veList = $verify->getVerifyByAll ();
|
|
|
+ $veList = $verify->getVerifyBySubordinate('TRAIN');
|
|
|
// 办事处
|
|
|
Doo::loadModel ( 'L_category' );
|
|
|
$lCategory = new L_category ();
|
|
@@ -2234,6 +2161,20 @@ class ReceiptController extends DooController {
|
|
|
die ('illegal request--status');
|
|
|
}
|
|
|
|
|
|
+ //如有已入账已收款的发票,自动取消办事处已收款
|
|
|
+// Doo::loadModel ( 'RIExtend' );
|
|
|
+// $RIExtend = new RIExtend ();
|
|
|
+// $RIExtendList=$RIExtend->getRIExtendByRid($rid);
|
|
|
+// if (!empty($RIExtendList)){
|
|
|
+// foreach ($RIExtendList as $key=>$value){
|
|
|
+// $RIExtend = new RIExtend ();
|
|
|
+// $RIExtend->delete(array (
|
|
|
+// 'where' => 'iid=' . $value['iid'],
|
|
|
+// 'limit' => 1
|
|
|
+// ));
|
|
|
+// }
|
|
|
+// }
|
|
|
+
|
|
|
$receiptTrainingDetail = $receiptTraining->getReceiptTrainingByRtid ( $receiptDetail ['trainId'] );
|
|
|
|
|
|
// 汇总表合计
|
|
@@ -2279,17 +2220,21 @@ class ReceiptController extends DooController {
|
|
|
$companyProfit=$profit * 0.6;
|
|
|
$categoryProfit=$profit * 0.4;
|
|
|
|
|
|
- $data ['profit'] = number_format ( $profit, 2 );
|
|
|
- $data ['companyProfit'] = number_format ($companyProfit, 2, '.', '' );
|
|
|
- $data ['categoryProfit'] = number_format ( $categoryProfit, 2, '.', '' );
|
|
|
+ $data ['profit'] = sprintf("%.2f",$profit);
|
|
|
+ $data ['companyProfit'] = sprintf("%.2f",$companyProfit);
|
|
|
+ $data ['categoryProfit'] = sprintf("%.2f",$categoryProfit);
|
|
|
//发票利润
|
|
|
$data ['invoiceProfit'] = $invoiceTrainingDetail ['invoiceTotalAmount'] - $aiData ['total'];
|
|
|
- $data ['invoiceCompanyProfit'] = $data ['invoiceProfit'] * 0.6;//发票公司利润
|
|
|
- $data ['invoiceCategoryProfit'] = $data ['invoiceProfit'] * 0.4;
|
|
|
+ //发票公司利润
|
|
|
+ $invoiceCompanyProfit=$data ['invoiceProfit'] * 0.6;
|
|
|
+ $data ['invoiceCompanyProfit'] = sprintf("%.2f",$invoiceCompanyProfit);
|
|
|
+ //办事处利润
|
|
|
+ $invoiceCategoryProfit=$data ['invoiceProfit'] * 0.4;
|
|
|
+ $data ['invoiceCategoryProfit'] = sprintf("%.2f",$invoiceCategoryProfit);
|
|
|
|
|
|
// print_r($aiData['dataList']);
|
|
|
$categoryActualExpenditure= $aiData ['total'] - $aiData ['categoryActualExpenditure'];
|
|
|
- $data ['categoryActualExpenditure'] = number_format ( $categoryActualExpenditure, 2 );
|
|
|
+ $data ['categoryActualExpenditure'] = sprintf("%.2f",$categoryActualExpenditure);
|
|
|
// 备用金
|
|
|
$sum = 0;
|
|
|
$data ['receiptLoanDetail'] = array (
|
|
@@ -2301,46 +2246,46 @@ class ReceiptController extends DooController {
|
|
|
}
|
|
|
|
|
|
$payment=$sum + $RIAmount - $categoryActualExpenditure;
|
|
|
- $data ['payment'] = number_format ( $payment, 2 );
|
|
|
+ $data ['payment'] = sprintf("%.2f",$payment);
|
|
|
|
|
|
- $data ['total'] = number_format ( $aiData ['total'], 2 );
|
|
|
+ $data ['total'] = sprintf("%.2f",$aiData ['total']);
|
|
|
$data ['aiCount'] = count ( $aiData ['dataList'] ) + 5;
|
|
|
$data ['aiList'] = $aiData ['dataList'];
|
|
|
|
|
|
// 占比计算
|
|
|
if ($invoiceArriveAmount != 0) {
|
|
|
- $data ['totalProportion'] = number_format ( $aiData ['total'] / $invoiceArriveAmount, 2, '.', '' ) * 100;
|
|
|
- $data ['profitProportion'] = number_format ( $profit / $invoiceArriveAmount, 2, '.', '' ) * 100;
|
|
|
- $data ['sumProportion'] = number_format ( $sum / $invoiceArriveAmount, 2, '.', '' ) * 100;
|
|
|
- $data ['invoiceTotalAmountProportion'] = number_format ( $data ['invoiceTrainingDetail'] ['invoiceCompanyAmount'] / $invoiceArriveAmount, 2, '.', '' ) * 100;
|
|
|
- $data ['RIAmountProportion'] = number_format ( $data ['invoiceTrainingDetail'] ['RIAmount'] / $invoiceArriveAmount, 2, '.', '' ) * 100;
|
|
|
- $data ['companyProfitProportion'] = number_format ( $companyProfit / $invoiceArriveAmount, 2, '.', '' ) * 100;
|
|
|
- $data ['categoryProportion'] = number_format ( $categoryProfit / $invoiceArriveAmount, 2, '.', '' ) * 100;
|
|
|
- $data ['categoryActualExpenditureProportion'] = number_format ( $categoryActualExpenditure / $invoiceArriveAmount, 2, '.', '' ) * 100;
|
|
|
- $data ['paymentProportion'] = number_format ( $payment / $invoiceArriveAmount, 2, '.', '' ) * 100;
|
|
|
+ $data ['totalProportion'] = sprintf("%.2f",$aiData ['total'] / $invoiceArriveAmount* 100) ;
|
|
|
+ $data ['profitProportion'] = sprintf("%.2f",$profit / $invoiceArriveAmount*100) ; //number_format ( $profit / $invoiceArriveAmount, 2, '.', '' ) * 100;
|
|
|
+ $data ['sumProportion'] = sprintf("%.2f",$sum / $invoiceArriveAmount*100) ; //number_format ( $sum / $invoiceArriveAmount, 2, '.', '' ) * 100;
|
|
|
+ $data ['invoiceTotalAmountProportion'] = sprintf("%.2f",$data ['invoiceTrainingDetail'] ['invoiceCompanyAmount'] / $invoiceArriveAmount*100) ;
|
|
|
+ $data ['RIAmountProportion'] = sprintf("%.2f",$data ['invoiceTrainingDetail'] ['RIAmount'] / $invoiceArriveAmount*100) ;
|
|
|
+ $data ['companyProfitProportion'] = sprintf("%.2f",$companyProfit / $invoiceArriveAmount*100) ;
|
|
|
+ $data ['categoryProportion'] = sprintf("%.2f",$categoryProfit / $invoiceArriveAmount*100) ;
|
|
|
+ $data ['categoryActualExpenditureProportion'] = sprintf("%.2f",$categoryActualExpenditure / $invoiceArriveAmount*100) ;
|
|
|
+ $data ['paymentProportion'] = sprintf("%.2f",$payment / $invoiceArriveAmount*100) ;
|
|
|
} else {
|
|
|
$data ['totalProportion'] = $data ['profitProportion'] = $data ['sumProportion'] = $data ['invoiceTotalAmountProportion'] = $data ['RIAmountProportion'] = $data ['companyProfitProportion'] = $data ['categoryActualExpenditureProportion'] = $data ['paymentProportion'] = $data ['categoryProportion'] = 0;
|
|
|
}
|
|
|
//发票金额占比计算
|
|
|
if ($invoiceTrainingDetail ['invoiceTotalAmount'] != 0) {
|
|
|
//支出
|
|
|
- $data ['invoicetotalProportion'] = number_format ( $aiData ['total'] / $invoiceTrainingDetail ['invoiceTotalAmount'], 4, '.', '' ) * 100;
|
|
|
+ $data ['invoicetotalProportion'] = sprintf("%.2f",$aiData ['total'] / $invoiceTrainingDetail ['invoiceTotalAmount']* 100) ;
|
|
|
//利润
|
|
|
- $data ['invoiceprofitProportion'] = number_format ( $data ['invoiceProfit'] / $invoiceTrainingDetail ['invoiceTotalAmount'], 4, '.', '' ) * 100;
|
|
|
+ $data ['invoiceprofitProportion'] = sprintf("%.2f",$data ['invoiceProfit'] / $invoiceTrainingDetail ['invoiceTotalAmount']* 100) ;
|
|
|
//公司利润
|
|
|
- $data ['invoicecompanyProfitProportion'] = number_format ( $data ['invoiceCompanyProfit'] / $invoiceTrainingDetail ['invoiceTotalAmount'], 4, '.', '' ) * 100;
|
|
|
+ $data ['invoicecompanyProfitProportion'] = sprintf("%.2f", $invoiceCompanyProfit / $invoiceTrainingDetail ['invoiceTotalAmount']* 100) ;
|
|
|
//办事处利润
|
|
|
- $data ['invoicecategoryProportion'] = number_format ( $data ['invoiceCategoryProfit'] / $invoiceTrainingDetail ['invoiceTotalAmount'], 4, '.', '' ) * 100;
|
|
|
+ $data ['invoicecategoryProportion'] = sprintf("%.2f", $invoiceCategoryProfit / $invoiceTrainingDetail ['invoiceTotalAmount']* 100) ;
|
|
|
//公司收款
|
|
|
- $data ['invoiceTotalAmountProportionB'] = number_format ( $data ['invoiceTrainingDetail'] ['invoiceCompanyAmount'] / $invoiceTrainingDetail ['invoiceTotalAmount'], 2, '.', '' ) * 100;
|
|
|
+ $data ['invoiceTotalAmountProportionB'] = sprintf("%.2f", $data ['invoiceTrainingDetail'] ['invoiceCompanyAmount'] / $invoiceTrainingDetail ['invoiceTotalAmount']* 100) ;
|
|
|
//备用金
|
|
|
- $data ['invoicesumProportion'] = number_format ( $sum / $invoiceTrainingDetail ['invoiceTotalAmount'], 2, '.', '' ) * 100;
|
|
|
+ $data ['invoicesumProportion'] = sprintf("%.2f", $sum / $invoiceTrainingDetail ['invoiceTotalAmount']* 100) ;
|
|
|
//办事处收款
|
|
|
- $data ['invoiceRIAmountProportion'] = number_format ( $data ['invoiceTrainingDetail'] ['RIAmount'] / $invoiceTrainingDetail ['invoiceTotalAmount'], 2, '.', '' ) * 100;
|
|
|
+ $data ['invoiceRIAmountProportion'] = sprintf("%.2f", $data ['invoiceTrainingDetail'] ['RIAmount'] / $invoiceTrainingDetail ['invoiceTotalAmount']* 100) ;
|
|
|
//办事处实际支出
|
|
|
- $data ['ICAEP'] = number_format ( $categoryActualExpenditure / $invoiceTrainingDetail ['invoiceTotalAmount'], 2, '.', '' ) * 100;
|
|
|
+ $data ['ICAEP'] = sprintf("%.2f", $categoryActualExpenditure / $invoiceTrainingDetail ['invoiceTotalAmount']* 100) ;
|
|
|
//付总部款
|
|
|
- $data ['invoicepaymentProportion'] = number_format ( $payment / $invoiceTrainingDetail ['invoiceTotalAmount'], 2, '.', '' ) * 100;
|
|
|
+ $data ['invoicepaymentProportion'] = sprintf("%.2f", $payment / $invoiceTrainingDetail ['invoiceTotalAmount']* 100) ;
|
|
|
}else{
|
|
|
$data ['invoiceprofitProportion'] =$data ['invoiceRIAmountProportion'] =$data ['invoicetotalProportion'] =$data ['invoiceTotalAmountProportionB'] =$data ['invoicesumProportion'] =$data ['ICAEP'] =$data ['invoicepaymentProportion'] =$data ['invoicecompanyProfitProportion'] =$data ['invoicecategoryProportion'] =0;
|
|
|
}
|
|
@@ -2354,7 +2299,7 @@ class ReceiptController extends DooController {
|
|
|
// 审批组
|
|
|
Doo::loadModel ( 'verify' );
|
|
|
$verify = new verify ();
|
|
|
- $veList = $verify->getVerifyByAll ();
|
|
|
+ $veList = $verify->getVerifyBySubordinate('TRAIN');
|
|
|
|
|
|
// 办事处
|
|
|
Doo::loadModel ( 'L_category' );
|
|
@@ -2624,6 +2569,9 @@ class ReceiptController extends DooController {
|
|
|
Doo::loadModel ( 'invoiceTraining' );
|
|
|
$invoiceTraining = new invoiceTraining ();
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
$receiptDetail = $receipt->getReceiptByRid ( $rid );
|
|
|
if (! ($receiptDetail ['status'] == 5 || $receiptDetail ['status'] == 4))
|
|
|
die ();
|
|
@@ -2634,7 +2582,7 @@ class ReceiptController extends DooController {
|
|
|
$invoiceList = $invoice->getInvoicePrintedByItid ( $receiptDetail ['invoiceTrainId'] );
|
|
|
$invoiceTrainingDetail = $invoiceTraining->getInvoiceTrainingByItid ( $receiptDetail ['invoiceTrainId'] );
|
|
|
}
|
|
|
- // print_r($invoiceList);
|
|
|
+ //print_r($invoiceList);
|
|
|
$data ['invoiceList'] = $invoiceList;
|
|
|
$data ['invoiceTrainingDetail'] = $invoiceTrainingDetail;
|
|
|
$data ['receiptTrainingDetail'] = $receiptTrainingDetail;
|
|
@@ -2719,6 +2667,7 @@ class ReceiptController extends DooController {
|
|
|
if (! is_numeric ( $rid ) || ! is_numeric ( $iid ))
|
|
|
die ( 'illegal request-iid' );
|
|
|
|
|
|
+
|
|
|
Doo::loadModel ( 'RIExtend' );
|
|
|
$RIExtend = new RIExtend ();
|
|
|
|
|
@@ -2728,17 +2677,25 @@ class ReceiptController extends DooController {
|
|
|
$RIExtend->RIstatus = 1;
|
|
|
$RIExtend->insert ();
|
|
|
|
|
|
- $XDeode = new XDeode ( 7 );
|
|
|
- return '/receiptTrainInvoiceEdi/' . $XDeode->encode ( $rid ) . '.html';
|
|
|
+ echo json_encode ( array (
|
|
|
+ 'status' => 1,
|
|
|
+ ) );
|
|
|
+ die ( );
|
|
|
} elseif ($doType == 'CANCEL') {
|
|
|
$RIExtend->delete ( array (
|
|
|
'where' => 'rid=' . $rid . ' and iid=' . $iid,
|
|
|
'limit' => 1
|
|
|
) );
|
|
|
- $XDeode = new XDeode ( 7 );
|
|
|
- return '/receiptTrainInvoiceEdi/' . $XDeode->encode ( $rid ) . '.html';
|
|
|
+
|
|
|
+ echo json_encode ( array (
|
|
|
+ 'status' => 1,
|
|
|
+ ) );
|
|
|
+ die ( );
|
|
|
} else {
|
|
|
- die ( 'illegal request' );
|
|
|
+ echo json_encode ( array (
|
|
|
+ 'status' => 2,
|
|
|
+ ) );
|
|
|
+ die ( );
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -2791,7 +2748,9 @@ class ReceiptController extends DooController {
|
|
|
* 编辑培训班结算
|
|
|
*/
|
|
|
function receiptTrainItemEdi() {
|
|
|
+ //include Doo::conf()->BASE_PATH.'diagnostic/debug.php';
|
|
|
$ridKey = isset ( $this->params ['rid'] ) ? $this->params ['rid'] : '';
|
|
|
+ $name = $this->get_args ( 'name' ) ? $this->get_args ( 'name' ) : '';
|
|
|
|
|
|
Doo::loadClass ( 'XDeode' );
|
|
|
$XDeode = new XDeode ( 7 );
|
|
@@ -2814,15 +2773,16 @@ class ReceiptController extends DooController {
|
|
|
die ();
|
|
|
$receiptTrainingDetail = $receiptTraining->getReceiptTrainingByRtid ( $receiptDetail ['trainId'] );
|
|
|
|
|
|
- $RItemList = $RItem->getRItemByRid ( $rid );
|
|
|
- $aiList = $accountItem->getAccountBookByCategory ( '培训班费用' );
|
|
|
+ $RItemList = $RItem->getRItemByRid ( $rid,$name );
|
|
|
+ $aiList = $accountItem->getAccountBookByCategory ( '培训班费用' );//print_r($aiList);
|
|
|
// foreach ($aiList as $key=>$value){//不需要添加税款,在添加收入时自动添加
|
|
|
// if($value['name']=='税款'){
|
|
|
// unset($aiList[$key]);break;
|
|
|
// }
|
|
|
// }
|
|
|
|
|
|
- //print_r($aiList);
|
|
|
+ //print_r($RItemList);
|
|
|
+ $data ['name'] = $name;
|
|
|
$data ['RItemList'] = $RItemList;
|
|
|
$data ['aiList'] = $aiList;
|
|
|
|
|
@@ -2885,6 +2845,7 @@ class ReceiptController extends DooController {
|
|
|
$RItem->describe = $describe;
|
|
|
|
|
|
$RItem->creater=$this->staff['0']['username'];
|
|
|
+ $RItem->createrId=$this->staff['0']['sid'];
|
|
|
$RItem->creatDate=date ( "Y-m-d H:i:s" ) ;
|
|
|
|
|
|
$RItem->insert ();
|
|
@@ -5500,7 +5461,15 @@ class ReceiptController extends DooController {
|
|
|
$loanReceipt->status = 1;
|
|
|
$loanReceipt->pastDate = date ( "Y-m-d" );
|
|
|
|
|
|
- $loanReceipt->amount = $receiptDetail ['amount'];
|
|
|
+ //生成流水后 不更新汇款金额
|
|
|
+ Doo::loadModel ( 'wasteBook' );
|
|
|
+ $wasteBook = new wasteBook ();
|
|
|
+ $wbDetail = $wasteBook->getWateBookByAD ( 1, $rid );
|
|
|
+ if (empty($wbDetail)){
|
|
|
+ $loanReceipt->amount = $receiptDetail ['amount'];
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
$loanReceipt->update ( array (
|
|
|
'where' => ' rid = ' . $receiptDetail ['loanRid']
|
|
|
) );
|
|
@@ -6022,11 +5991,10 @@ class ReceiptController extends DooController {
|
|
|
if ($receiptList [0] ['Rtype'] == 0) {
|
|
|
$accountType = 3;
|
|
|
} elseif ($receiptList [0] ['Rtype'] == 1) {
|
|
|
- if ($receiptList [0] ['Rtype'] == 0) {
|
|
|
- $accountType = 1;
|
|
|
- } elseif ($receiptList [0] ['Rtype'] == 1) {
|
|
|
- $accountType = 2;
|
|
|
- }
|
|
|
+ if (!empty($receiptList [0]['accountItem']) )
|
|
|
+ $accountType = 2;
|
|
|
+ else
|
|
|
+ $accountType = 1;
|
|
|
} elseif ($receiptList [0] ['Rtype'] == 2) {
|
|
|
$accountType = 4;
|
|
|
} elseif ($receiptList [0] ['Rtype'] == 3) {
|
|
@@ -6037,6 +6005,12 @@ class ReceiptController extends DooController {
|
|
|
$wbDetail = $wasteBook->getWateBookByAD ( $accountType, $receiptList [0] ['rid'] );
|
|
|
$data ['wbDetail'] = $wbDetail;
|
|
|
|
|
|
+ $wbDetailLoan=array();
|
|
|
+ if ($accountType==2){
|
|
|
+ $wbDetailLoan = $wasteBook->getWateBookByAD ( 1, $receiptList [0] ['rid'] );
|
|
|
+ }
|
|
|
+ $data ['wbDetailLoan'] = $wbDetailLoan;
|
|
|
+
|
|
|
|
|
|
//print_r($receiptList);
|
|
|
|
|
@@ -6081,19 +6055,19 @@ class ReceiptController extends DooController {
|
|
|
|
|
|
$rinfo = $receipt->getReceiptByRid ( $rid );
|
|
|
|
|
|
- $accountType = '';
|
|
|
- if ($rinfo ['Rtype'] == 1) {
|
|
|
- if ($rinfo ['loanRid'] != 0)
|
|
|
- $accountType = 2;
|
|
|
- else
|
|
|
- $accountType = 1;
|
|
|
- } elseif ($rinfo ['Rtype'] == 2) {
|
|
|
- $accountType = 4;
|
|
|
- } elseif ($rinfo ['Rtype'] == 0)
|
|
|
- $accountType = 3;
|
|
|
+// $accountType = '';
|
|
|
+// if ($rinfo ['Rtype'] == 1) {
|
|
|
+// if ($rinfo ['loanRid'] != 0)//判断有问题
|
|
|
+// $accountType = 2;
|
|
|
+// else
|
|
|
+// $accountType = 1;
|
|
|
+// } elseif ($rinfo ['Rtype'] == 2) {
|
|
|
+// $accountType = 4;
|
|
|
+// } elseif ($rinfo ['Rtype'] == 0)
|
|
|
+// $accountType = 3;
|
|
|
|
|
|
- if (empty ( $accountType ))
|
|
|
- die ( 'illegal request' );
|
|
|
+// if (empty ( $accountType ))
|
|
|
+// die ( 'illegal request' );
|
|
|
|
|
|
$executeCopy = json_decode ( $rinfo ['executeCopy'], true );
|
|
|
$executeStaff = json_decode ( $rinfo ['executeStaff'], true );
|
|
@@ -6131,7 +6105,7 @@ class ReceiptController extends DooController {
|
|
|
} else {
|
|
|
$receipt->executeStaff = json_encode ( $executeStaff );
|
|
|
}
|
|
|
- $receipt->amount = $amount;
|
|
|
+ //$receipt->amount = $amount;
|
|
|
$receipt->update ( array (
|
|
|
'where' => 'rid=' . $rid
|
|
|
) );
|
|
@@ -7429,28 +7403,9 @@ class ReceiptController extends DooController {
|
|
|
$acItem = $accountItem->find ( array (
|
|
|
'asArray' => true
|
|
|
) );
|
|
|
- $veList = $verify->find ( array (
|
|
|
- 'asArray' => true
|
|
|
- ) );
|
|
|
+ $veList = $verify->getVerifyBySubordinate('RECEIPT');
|
|
|
+
|
|
|
|
|
|
- foreach ( $veList as $key => $value ) {
|
|
|
- $v = json_decode ( $value ['staff'] );
|
|
|
-
|
|
|
- $list = array ();
|
|
|
- foreach ( $v as $n => $m ) {
|
|
|
- if ($m ['1'] == 'ROLE') {
|
|
|
- $roleInfo = $role->getOne ( array (
|
|
|
- 'where' => 'rid=' . $m [0],
|
|
|
- 'asArray' => true
|
|
|
- ) );
|
|
|
- $v [$n] [1] = $roleInfo ['name'];
|
|
|
- array_push ( $list, $roleInfo ['name'] );
|
|
|
- } else {
|
|
|
- array_push ( $list, $v [$n] [1] );
|
|
|
- }
|
|
|
- }
|
|
|
- $veList [$key] ['staff'] = implode ( '>', $list );
|
|
|
- }
|
|
|
|
|
|
$data ['category'] = $lCategory->find ( array (
|
|
|
'asArray' => true
|
|
@@ -7768,28 +7723,9 @@ class ReceiptController extends DooController {
|
|
|
$acItem = $accountItem->find ( array (
|
|
|
'asArray' => true
|
|
|
) );
|
|
|
- $veList = $verify->find ( array (
|
|
|
- 'asArray' => true
|
|
|
- ) );
|
|
|
+ $veList = $verify->getVerifyBySubordinate('RECEIPT');
|
|
|
+
|
|
|
|
|
|
- foreach ( $veList as $key => $value ) {
|
|
|
- $v = json_decode ( $value ['staff'] );
|
|
|
-
|
|
|
- $list = array ();
|
|
|
- foreach ( $v as $n => $m ) {
|
|
|
- if ($m ['1'] == 'ROLE') {
|
|
|
- $roleInfo = $role->getOne ( array (
|
|
|
- 'where' => 'rid=' . $m [0],
|
|
|
- 'asArray' => true
|
|
|
- ) );
|
|
|
- $v [$n] [1] = $roleInfo ['name'];
|
|
|
- array_push ( $list, $roleInfo ['name'] );
|
|
|
- } else {
|
|
|
- array_push ( $list, $v [$n] [1] );
|
|
|
- }
|
|
|
- }
|
|
|
- $veList [$key] ['staff'] = implode ( '>', $list );
|
|
|
- }
|
|
|
|
|
|
// 配置编辑信息
|
|
|
$accountItemList = json_decode ( $receiptDetail ['accountItem'], true );
|
|
@@ -10144,7 +10080,21 @@ class ReceiptController extends DooController {
|
|
|
// 微信企业号通知
|
|
|
$this->setWXMsg ( $rid, 1 );
|
|
|
}
|
|
|
- $receipt->amount = $amount;
|
|
|
+ //是否有流水
|
|
|
+ Doo::loadModel ( 'wasteBook' );
|
|
|
+ $wasteBook = new wasteBook ();
|
|
|
+ $accountType=3;
|
|
|
+ if ($receiptDetail['Rtype']==1){
|
|
|
+ $accountType=2;
|
|
|
+ }elseif($receiptDetail['Rtype']==2){
|
|
|
+ $accountType=4;
|
|
|
+ }
|
|
|
+ $wbDetail = $wasteBook->getWateBookByAD ( $accountType, $rid );
|
|
|
+ if (empty($wbDetail)){
|
|
|
+ $receipt->amount = $amount;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
$receipt->update ( array (
|
|
|
'where' => ' rid = ' . $rid
|
|
|
) );
|
|
@@ -13298,6 +13248,7 @@ class ReceiptController extends DooController {
|
|
|
*/
|
|
|
function ajaxGetWasteReceipt() {
|
|
|
$serial = $this->get_args ( 'serial' ) ? $this->get_args ( 'serial' ) : "";
|
|
|
+ $accountTypeKey = $this->get_args ( 'accountTypeKey' ) ? $this->get_args ( 'accountTypeKey' ) : "";
|
|
|
|
|
|
Doo::loadModel ( 'receipt' );
|
|
|
$receipt = new receipt ();
|
|
@@ -13305,6 +13256,8 @@ class ReceiptController extends DooController {
|
|
|
$XDeode = new XDeode ( 5 );
|
|
|
|
|
|
$rid = $XDeode->decode ( $serial );
|
|
|
+ $accountType= $XDeode->decode ( $accountTypeKey );
|
|
|
+
|
|
|
|
|
|
// 获得个数据
|
|
|
$detail = $receipt->getReceiptByRid ( $rid );
|
|
@@ -13319,7 +13272,7 @@ class ReceiptController extends DooController {
|
|
|
$detail ['sumCN'] = $this->num_to_rmb ( $detail ['sum'] );
|
|
|
|
|
|
// 获得费用html
|
|
|
- $html = $this->getWasteReceiptHtml ( $detail );
|
|
|
+ $html = $this->getWasteReceiptHtml ( $detail ,$accountType);
|
|
|
// 获得费用审批人数据
|
|
|
$detail = $this->getReceiptApproverHtml ( $detail );
|
|
|
|
|
@@ -13347,14 +13300,30 @@ class ReceiptController extends DooController {
|
|
|
';
|
|
|
}
|
|
|
$html .= ' </tbody></table>';
|
|
|
-
|
|
|
+ if($accountType==1){
|
|
|
+ Doo::loadModel ( 'loanReceipt' );
|
|
|
+ $loanReceipt = new loanReceipt ();
|
|
|
+ $loanList = $loanReceipt->getOne ( array (
|
|
|
+ 'where' => 'rid=' . $detail ['loanRid'],
|
|
|
+ 'desc' => 'rid',
|
|
|
+ 'asArray' => true
|
|
|
+ ) );
|
|
|
+
|
|
|
+
|
|
|
+ $html .= '<table class="table table-bordered table-condensed">
|
|
|
+ <tr class="warning">
|
|
|
+ <td class="taR"><b>汇款金额</b></td>
|
|
|
+ <td width="140" class="taR"><b style="font-size: 24px">¥'.$loanList['amount'].'</b></td>
|
|
|
+ </tr>
|
|
|
+ </table>';
|
|
|
+ }else{
|
|
|
$html .= '<table class="table table-bordered table-condensed">
|
|
|
<tr class="warning">
|
|
|
<td class="taR"><b>汇款金额</b></td>
|
|
|
<td width="140" class="taR"><b style="font-size: 24px">¥' . $detail ['amount'] . '</b></td>
|
|
|
</tr>
|
|
|
</table>';
|
|
|
-
|
|
|
+ }
|
|
|
// print_r($detail['verifyList']);
|
|
|
// header ( 'Content-Type:text/html;charset=utf-8' );
|
|
|
// echo $html;
|
|
@@ -13545,7 +13514,7 @@ class ReceiptController extends DooController {
|
|
|
$detail ['verifyList'] = $verifyList;
|
|
|
return $detail;
|
|
|
}
|
|
|
- function getWasteReceiptHtml($detail = array()) {
|
|
|
+ function getWasteReceiptHtml($detail = array(),$accountType=1) {
|
|
|
if (empty ( $detail ))
|
|
|
return '';
|
|
|
|
|
@@ -13647,7 +13616,7 @@ class ReceiptController extends DooController {
|
|
|
</tr>
|
|
|
</tbody>
|
|
|
</table>';
|
|
|
- } elseif ($detail ['Rtype'] == 2) {
|
|
|
+ } elseif ($detail ['Rtype'] == 2) {//对公汇款
|
|
|
$html .= '
|
|
|
<table class="table table-bordered table-condensed">
|
|
|
<tbody>
|
|
@@ -13679,10 +13648,56 @@ class ReceiptController extends DooController {
|
|
|
</tr>
|
|
|
</tbody>
|
|
|
</table>';
|
|
|
- } elseif ($detail ['Rtype'] == 1) {
|
|
|
+ } elseif ($detail ['Rtype'] == 1) {//借款 或者借款报销
|
|
|
+
|
|
|
+
|
|
|
+ Doo::loadModel ( 'loanReceipt' );
|
|
|
+ $loanReceipt = new loanReceipt ();
|
|
|
+
|
|
|
+ $loanList = $loanReceipt->getOne ( array (
|
|
|
+ 'where' => 'rid=' . $detail ['loanRid'],
|
|
|
+ 'desc' => 'rid',
|
|
|
+ 'asArray' => true
|
|
|
+ ) );
|
|
|
+ // print_r($loanList);
|
|
|
+
|
|
|
+ $loanList ['sumCN']=$this->num_to_rmb($loanList ['sum']);
|
|
|
+
|
|
|
+ $html .= '<table class="table table-bordered table-condensed">
|
|
|
+ <tbody>
|
|
|
+ <tr>
|
|
|
+ <th colspan="2" class="taC">借款费用</th>
|
|
|
+ </tr>';
|
|
|
+ foreach ( $detail ['loanItem'] ['借款费用'] as $key => $value ) {
|
|
|
+ $html .= '<tr>
|
|
|
+ <th>' . $value ['name'] . '</th>
|
|
|
+ <td width="140" class="taR">¥' . $value ['price'] . '</td>
|
|
|
+ </tr>';
|
|
|
+ }
|
|
|
+ $html .= '<tr>
|
|
|
+ <th class="taC" colspan="2">产生费用所在办事处</th>
|
|
|
+ </tr>
|
|
|
+ <tr>
|
|
|
+ <th style="text-align: center" colspan="2">' . $detail ['category'] [0] ['title'] . '</th>
|
|
|
+ </tr>
|
|
|
+ <tr>
|
|
|
+ <th class="taC" colspan="2">费用说明</th>
|
|
|
+ </tr>
|
|
|
+ <tr>
|
|
|
+ <td colspan="2">' . $loanList ['explanation'] . '</td>
|
|
|
+ </tr>
|
|
|
+ <tr class="warning">
|
|
|
+ <td class="taR"><b>(' . $loanList ['receiptOrder'] . ')本次费用合计</b></td>
|
|
|
+ <td class="taR"><b style="font-size: 24px">¥' . $loanList ['sum'] . '</b><br>' . $loanList ['sumCN'] . '</td>
|
|
|
+ </tr>
|
|
|
+ </tbody>
|
|
|
+ </table>
|
|
|
+ ';
|
|
|
|
|
|
- if ($detail ['loanRid'] != 0 && ! empty ( $detail ['accountItem'] )) {
|
|
|
+ if ( $accountType==2) {
|
|
|
|
|
|
+ $balance=$detail ['sum']-$loanList ['sum'];
|
|
|
+ $balanceCN=$this->num_to_rmb($balance);
|
|
|
$html .= '<table class="table table-bordered table-condensed">
|
|
|
<tbody>
|
|
|
<tr>
|
|
@@ -13775,50 +13790,16 @@ class ReceiptController extends DooController {
|
|
|
<td class="taR"><b>(' . $detail ['receiptOrder'] . ')本次报销费用合计</b></td>
|
|
|
<td class="colGreed taR"><b style="font-size: 24px">¥' . $detail ['sum'] . '</b><br>' . $detail ['sumCN'] . '</td>
|
|
|
</tr>
|
|
|
+ <tr class="success">
|
|
|
+ <td class="taR"><b>借款结余</b></td>
|
|
|
+ <td class="taR"><b style="font-size:24px">¥'.$balance.'</b><br>'.$balanceCN.'</td>
|
|
|
+ </tr>
|
|
|
+
|
|
|
+
|
|
|
</tbody>
|
|
|
</table>';
|
|
|
}
|
|
|
|
|
|
- Doo::loadModel ( 'loanReceipt' );
|
|
|
- $loanReceipt = new loanReceipt ();
|
|
|
-
|
|
|
- $loanList = $loanReceipt->getOne ( array (
|
|
|
- 'where' => 'rid=' . $detail ['loanRid'],
|
|
|
- 'desc' => 'rid',
|
|
|
- 'asArray' => true
|
|
|
- ) );
|
|
|
- // print_r($loanList);
|
|
|
-
|
|
|
- $html .= '<table class="table table-bordered table-condensed">
|
|
|
- <tbody>
|
|
|
- <tr>
|
|
|
- <th colspan="2" class="taC">借款费用</th>
|
|
|
- </tr>';
|
|
|
- foreach ( $detail ['loanItem'] ['借款费用'] as $key => $value ) {
|
|
|
- $html .= '<tr>
|
|
|
- <th>' . $value ['name'] . '</th>
|
|
|
- <td width="140" class="taR">¥' . $value ['price'] . '</td>
|
|
|
- </tr>';
|
|
|
- }
|
|
|
- $html .= '<tr>
|
|
|
- <th class="taC" colspan="2">产生费用所在办事处</th>
|
|
|
- </tr>
|
|
|
- <tr>
|
|
|
- <th style="text-align: center" colspan="2">' . $detail ['category'] [0] ['title'] . '</th>
|
|
|
- </tr>
|
|
|
- <tr>
|
|
|
- <th class="taC" colspan="2">费用说明</th>
|
|
|
- </tr>
|
|
|
- <tr>
|
|
|
- <td colspan="2">' . $loanList ['explanation'] . '</td>
|
|
|
- </tr>
|
|
|
- <tr class="warning">
|
|
|
- <td class="taR"><b>(' . $loanList ['receiptOrder'] . ')本次费用合计</b></td>
|
|
|
- <td class="taR"><b style="font-size: 24px">¥' . $detail ['loanSum'] . '</b><br>' . $detail ['loanSumCN'] . '</td>
|
|
|
- </tr>
|
|
|
- </tbody>
|
|
|
- </table>
|
|
|
- ';
|
|
|
}
|
|
|
|
|
|
return $html;
|