accessAuth ( $resource, $action ); } function __construct() { $this->session (); $this->feeService = new fee_service (); $this->regionService = new region_service (); $this->officeService = new office_service (); } // 访问权限-费用管理 private function accessAuth($resource, $action) { Doo::loadClass ( 'XDeode' ); $XDeode = new XDeode ( 5 ); $sid = $XDeode->decode ( $_COOKIE ["staff"] ); // 1.单独判断公司汇总的访问权限 if ($action == 'companyCategoryCollect') { Doo::loadModel ( "receiptAuthorityManage" ); $invoiceCompanyManage = new receiptAuthorityManage (); $icm = $invoiceCompanyManage->getInvoiceCMByStaff ( $sid ); if (empty ( $icm )) die ( 'illegal request-无权访问该页面' ); } // 2.获得登陆用户信息 Doo::loadModel ( 'cld/staff_cld' ); $staff = new staff_cld (); $this->staff = $staff->Get ( $sid ); // 3.是否有权限访问 $accessModular = 'RECEIPTS'; if (empty ( $this->staff ['cldAccessArray'] )) { die ( 'illegal request-无权访问费用页面,向总部申请权限' ); } else { if (in_array ( $accessModular, $this->staff ['cldAccessArray'] )) { if (Doo::acl ()->isAllowed ( $accessModular, $resource, $action )) { $flag = true; } else { $flag = false; } } else { die ( 'illegal request-无权访问费用页面' ); } } if (! $flag) die ( 'illegal request-无权访问费用页面' ); } // 登陆判定 private function session() { if (isset ( $_COOKIE ["staff"] )) { if (! empty ( $_COOKIE ["staff"] )) { Doo::loadModel ( 'staff' ); Doo::loadModel ( 'verify' ); $verify = new verify (); $staff = new staff (); Doo::loadModel ( "execute" ); $execute = new execute (); $verifyList = $verify->find ( array ( 'select' => 'staff', 'asArray' => true ) ); $list = array (); // 判断角色的审批权限 foreach ( $verifyList as $key => $value ) { $ver = json_decode ( $value ['staff'] ); foreach ( $ver as $k => $v ) { if ($v [1] == 'ROLE') { $roleList = json_decode ( $v [3] ); foreach ( $roleList as $t => $g ) { $gList = explode ( "_", $g ); array_push ( $list, $gList [0] ); // print_r($list); } } else array_push ( $list, $v [0] ); } } // 判断执行人的审批权限 $executeList = $execute->find ( array ( 'where' => 'mold !="日常收支"', 'select' => 'staff', 'asArray' => true ) ); $list2 = array (); foreach ( $executeList as $key => $value ) { $ver = json_decode ( $value ['staff'] ); foreach ( $ver as $k => $v ) { array_push ( $list2, $v [0] ); } } $eidList = file_get_contents ( "protected/config/execute/execute.ini" ); $eidList = array_filter ( explode ( ",", $eidList ) ); $this->executeId = array_merge ( $list2, $eidList ); // print_r($this->executeId); $this->verifyId = $list; // $this->staff = $staff->getUserByIdList ( $_COOKIE ["staff"] ); return "/"; } } Doo::loadCore ( 'uri/DooUriRouter' ); $router = new DooUriRouter (); $routeRs = $router->execute ( Doo::app ()->route, Doo::conf ()->SUBFOLDER ); if ($routeRs ['1'] != "login") { header ( 'Content-Type:text/html;charset=utf-8' ); @header ( "Location: /login" ); } } // 构建申请报销单页面 public function GetViewReceiptCreate() { // 请求 $data ['action'] = "/receipt/create"; // 费用 项目细则 $accountItem = $this->feeService->GetAccountItem (); $data ['accountItem'] = json_encode ( $accountItem ); // 地区 $region = $this->regionService->GetRegionTwo (); $data ['region'] = json_encode ( $region ); // 审批 $data ['verify'] = json_encode ( $this->feeService->GetVerify () ); // 办事处 $data ['office'] = $this->officeService->GetAll (); // 默认办事处 $data ['officeId'] = $this->staff ['cid']; // 附件 $data ['enclosurList'] = array (); $data ['staff'] = $this->staff; $data ['verifyId'] = $this->verifyId; $data ['executeId'] = $this->executeId; $data ['receiptMemu'] = 'saeaBorad'; $data ['memu'] = "receipt"; $this->render ( "/fee/create/receipt", $data ); } // 编辑保险单 public function GetViewReceiptEdit() { $receiptId = isset ( $this->params ['receiptId'] ) ? $this->params ['receiptId'] : ''; if (empty ( $receiptId )) { die ( 'illegal request-请求参数错误,重新请求' ); } $receiptId = GetDecryptId ( $receiptId ); $detail = $this->feeService->GetReceipt ( $receiptId ); // 附件相关 Doo::loadModel ( 'enclosur' ); $enclosur = new enclosur (); $data ['enclosurList'] = $enclosur->getEnclosurByRid ( $detail ['rid'] ); // 费用 项目细则 $accountItem = $this->feeService->GetAccountItem (); $data ['accountItem'] = json_encode ( $accountItem ); // 报销单数据 $data ['data'] = json_encode ( $this->makeReceiptEdiData ( $detail, $accountItem, $this->feeService->GetVerify () ) ); // 请求 $data ['action'] = "/receipt/edit"; // 地区 $region = $this->regionService->GetRegionTwo (); $data ['region'] = json_encode ( $region ); // 审批 $data ['verify'] = "[]"; // 办事处 $data ['office'] = $this->officeService->GetAll (); // 默认办事处 $data ['officeId'] = $detail ['cid']; $data ['receiptId'] = $detail ['receiptId']; $data ['staff'] = $this->staff; $data ['verifyId'] = $this->verifyId; $data ['executeId'] = $this->executeId; $data ['receiptMemu'] = 'saeaBorad'; $data ['memu'] = "receipt"; $this->render ( "/fee/create/receipt", $data ); } // 创建报销单 public function PostReceiptCreate() { // 1.获得参数 $data = array ( "officeData" => get_args ( 'officeData' ), "traveData" => get_args ( 'traveData' ), "trainData" => get_args ( 'trainData' ), "enclosurFiles" => get_args ( 'enclosurFiles' ), "verifyId" => get_args ( 'verifyId' ), "officeId" => get_args ( 'officeId' ), "remittanceName" => get_args ( 'remittanceName' ), "remittanceBankType" => get_args ( 'remittanceBankType' ), "bankName" => get_args ( 'bankName' ), "bankNumber" => get_args ( 'bankNumber' ), "coupletNumber" => get_args ( 'coupletNumber' ) ); // 2.参数校验 $data = $this->feeService->ValidRuleReceiptCreate ( $data ); // 3.具体数据处理 $msg = $this->feeService->ReceiptCreate ( $data, $this->staff ); return "/saeaBorad"; } // 更新报销单 public function PostReceiptEdit() { // 1.获得参数 $data = array ( "receiptId" => get_args ( 'receiptId' ), "officeData" => get_args ( 'officeData' ), "traveData" => get_args ( 'traveData' ), "trainData" => get_args ( 'trainData' ), "enclosurFiles" => get_args ( 'enclosurFiles' ), "verifyId" => get_args ( 'verifyId' ), "officeId" => get_args ( 'officeId' ), "remittanceName" => get_args ( 'remittanceName' ), "remittanceBankType" => get_args ( 'remittanceBankType' ), "bankName" => get_args ( 'bankName' ), "bankNumber" => get_args ( 'bankNumber' ), "coupletNumber" => get_args ( 'coupletNumber' ) ); // 2.参数校验 $data = $this->feeService->ValidRuleReceiptCreate ( $data ); // 3.具体数据处理 $msg = $this->feeService->ReceiptEdi ( $data, $this->staff ); return "/saeaBorad"; } // 创建借款报销单 public function GetViewLoanReceiptCreate() { $receiptId = isset ( $this->params ['receiptId'] ) ? $this->params ['receiptId'] : ''; if (empty ( $receiptId )) { die ( 'illegal request-请求参数错误,重新请求' ); } $data ['receiptId'] = $receiptId; $receiptId = GetDecryptId ( $receiptId ); $detail = $this->feeService->GetReceipt ( $receiptId ); // 设置借款信息 $loan = $this->feeService->GetLoanReceipt ( $detail ['loanRid'] ); $data ['loan'] = $loan; // 费用 项目细则 $accountItem = $this->feeService->GetAccountItem (); $data ['accountItem'] = json_encode ( $accountItem ); // 报销单数据 if ($detail ['status'] != 7) { $detail ['verify'] = ''; } $data ['data'] = json_encode ( $this->makeReceiptEdiData ( $detail, $accountItem, $this->feeService->GetVerify () ) ); // 地区 $region = $this->regionService->GetRegionTwo (); $data ['region'] = json_encode ( $region ); // 审批 $data ['verify'] = json_encode ( $this->feeService->GetVerify () ); // 办事处 $data ['office'] = $this->officeService->GetAll (); // 默认办事处 $data ['officeId'] = $this->staff ['cid']; // 附件 $data ['enclosurList'] = array (); // 请求 $data ['action'] = "/loan/receipt/edit"; $data ['staff'] = $this->staff; $data ['verifyId'] = $this->verifyId; $data ['executeId'] = $this->executeId; $data ['receiptMemu'] = 'saeaBorad'; $data ['memu'] = "receipt"; $this->render ( "/fee/create/receipt", $data ); } // 保存借款报销单 public function PostLoanReceiptEdit() { // 1.获得参数 $data = array ( "receiptId" => get_args ( 'receiptId' ), "officeData" => get_args ( 'officeData' ), "traveData" => get_args ( 'traveData' ), "trainData" => get_args ( 'trainData' ), "enclosurFiles" => get_args ( 'enclosurFiles' ), "verifyId" => get_args ( 'verifyId' ), "officeId" => get_args ( 'officeId' ), "remittanceName" => get_args ( 'remittanceName' ), "remittanceBankType" => get_args ( 'remittanceBankType' ), "bankName" => get_args ( 'bankName' ), "bankNumber" => get_args ( 'bankNumber' ), "coupletNumber" => get_args ( 'coupletNumber' ) ); // 2.参数校验 $data = $this->feeService->ValidRuleReceiptCreate ( $data ); // 3.处理借款报销单数据 $msg = $this->feeService->LoanReceiptEdi ( $data ['receiptId'] ); // 4.具体数据处理 $msg = $this->feeService->ReceiptEdi ( $data, $this->staff ); return "/saeaBorad"; } // 审批页面 public function GetViewReceiptApproval() { $receiptId = isset ( $this->params ['receiptId'] ) ? $this->params ['receiptId'] : ''; if (empty ( $receiptId )) { die ( 'illegal request-请求参数错误,重新请求' ); } $receiptId = GetDecryptId ( $receiptId ); $detail = $this->feeService->GetReceipt ( $receiptId ); // 设置借款信息 if (!empty($detail ['loanRid'])){ $loan = $this->feeService->GetLoanReceipt ( $detail ['loanRid'] ); $data ['loan'] = $loan; } // $receiptList [$key] ['loanSumCN'] = $this->num_to_rmb ( $value ['loanSum'] ); // $receiptList [$key] ['sumCN'] = $this->num_to_rmb ( $value ['sum'] ); // $receiptList [$key] ['relustCN'] = $this->num_to_rmb ( abs ( $relust ) ); $data['receipt']=$detail; $data ['staff'] = $this->staff; $data ['verifyId'] = $this->verifyId; $data ['executeId'] = $this->executeId; $data ['receiptMemu'] = 'saeaBorad'; $data ['memu'] = "receipt"; $this->render ( "/fee/approval/receipt", $data ); } // 构造页面数据 private function makeReceiptEdiData($data, $accountItem, $verify) { $officeJson = array ( "id" => 0, "name" => "办事处相关费用", "show" => false, "anchor" => "officeAnchor", "active" => false, "daily" => $accountItem ['daily'], "other" => $accountItem ['other'], "officeExplain" => array ( 0 => array ( "officeExplain" => "" ) ) ); if (! empty ( $data ['officeJson'] )) { $officeJson = json_decode ( $data ['officeJson'], true ); } $traveJson = array ( "id" => 1, "name" => "差旅相关费用", "show" => false, "anchor" => "traveAnchor", "active" => false, "trave" => $accountItem ['trave'], "traveList" => array (), "traveExplain" => array ( 0 => array ( "traveExplain" => "" ) ) ); if (! empty ( $data ['traveJson'] )) { $traveJson = json_decode ( $data ['traveJson'], true ); } $trainJson = array ( "id" => 2, "name" => "内部培训费用", "show" => false, "anchor" => "trainAnchor", "active" => false, "train" => $accountItem ['train'], "trainExplain" => array ( 0 => array ( "trainExplain" => "" ) ) ); if (! empty ( $data ['trainJson'] )) { $trainJson = json_decode ( $data ['trainJson'], true ); } return array ( "receiptTypeMenu" => array ( 0 => $officeJson, 1 => $traveJson, 2 => $trainJson ), "verify" => $verify, "verifyId" => $data ['verify'], "remittanceBankType" => 0, "enclosurFiles" => array (), "aletMsg" => '', "displayStsates" => 'none' ); } } ?>