123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447 |
- <?php
- class incomeExpenses_service {
- private $accountBook;
- private $XDeode;
- function __construct() {
- Doo::loadClass ( 'XDeode' );
- $this->XDeode = new XDeode ( 9 );
- $this->XDeode5 = new XDeode ( 5 );
-
- Doo::loadModel ( 'cld/accountBook_cld' );
- $this->accountBook = new accountBook_cld ();
- }
-
- // 日常支出汇总
- public function GetExpensesCollect($parameter = array()) {
-
- $data = $this->accountBook->GetExpensesType ( $parameter );
-
- $list = array ();
-
- // 初始化日
- if (! empty ( $parameter ['month'] )) {
-
- $days = cal_days_in_month(CAL_GREGORIAN, $parameter['month'], $parameter['year']);
-
- for($i = 1; $i <= $days; $i ++) {
- $item = array (
- "month" => str_pad ( $i, 2, "0", STR_PAD_LEFT ),
- "bankCharges" => 0,
- "telephoneRate" => 0,
- // 缴税
- "addedTax" => 0,
- "surcharges" => 0,
- "corporateIncomeTax" => 0,
- "socialSecurity" => 0,
- "unionFees" => 0,
- "personalIncomeTax" => 0,
- "stampDuty" => 0,
- "payTaxesSubtotal" => 0,
-
- "bond" => 0,
- "wenku" => 0,
- "other" => 0,
-
- "subtotal" => 0
- );
- array_push ( $list, $item );
- }
- } else {
- // 初始化月份
- for($i = 1; $i <= 12; $i ++) {
- $item = array (
- "month" => str_pad ( $i, 2, "0", STR_PAD_LEFT ),
- "bankCharges" => 0,
- "telephoneRate" => 0,
- // 缴税
- "addedTax" => 0,
- "surcharges" => 0,
- "corporateIncomeTax" => 0,
- "socialSecurity" => 0,
- "unionFees" => 0,
- "personalIncomeTax" => 0,
- "stampDuty" => 0,
- "payTaxesSubtotal" => 0,
-
- "bond" => 0,
- "wenku" => 0,
- "other" => 0,
-
- "subtotal" => 0
- );
- array_push ( $list, $item );
- }
- }
-
- foreach ( $list as $k => $v ) {
- foreach ( $data as $key => $value ) {
- if (! empty ( $parameter ['month'] )) {
- $month = date ( "d", strtotime ( $value ['expenditureDate'] ) );
- }else{
- $month = date ( "m", strtotime ( $value ['expenditureDate'] ) );
- }
- if ($v ["month"] == $month) {
-
- // 银行手续费
- if ($value ['expenditureType'] == 1) {
- $list [$k] ['bankCharges'] = bcadd ( $list [$k] ['bankCharges'], $value ['expenditurePrice'], 2 );
- }
-
- // 电话费
- if ($value ['expenditureType'] == 2) {
- $list [$k] ['telephoneRate'] = bcadd ( $list [$k] ['telephoneRate'], $value ['expenditurePrice'], 2 );
- }
- // 缴税
- if ($value ['expenditureType'] == 3) {
- if ($value ['expenditureMsg'] == '增值税') {
- $list [$k] ['addedTax'] = bcadd ( $list [$k] ['addedTax'], $value ['expenditurePrice'], 2 );
- } elseif ($value ['expenditureMsg'] == '税金附加') {
- $list [$k] ['surcharges'] = bcadd ( $list [$k] ['surcharges'], $value ['expenditurePrice'], 2 );
- } elseif ($value ['expenditureMsg'] == '企业所得税') {
- $list [$k] ['corporateIncomeTax'] = bcadd ( $list [$k] ['corporateIncomeTax'], $value ['expenditurePrice'], 2 );
- } elseif ($value ['expenditureMsg'] == '工会费') {
- $list [$k] ['socialSecurity'] = bcadd ( $list [$k] ['socialSecurity'], $value ['expenditurePrice'], 2 );
- }elseif ($value ['expenditureMsg'] == '社保') {
- $list [$k] ['unionFees'] = bcadd ( $list [$k] ['unionFees'], $value ['expenditurePrice'], 2 );
- }elseif ($value ['expenditureMsg'] == '个税') {
- $list [$k] ['personalIncomeTax'] = bcadd ( $list [$k] ['personalIncomeTax'], $value ['expenditurePrice'], 2 );
- }elseif ($value ['expenditureMsg'] == '印花税') {
- $list [$k] ['stampDuty'] = bcadd ( $list [$k] ['stampDuty'], $value ['expenditurePrice'], 2 );
- }
- }
-
- // 保证金
- if ($value ['expenditureType'] == 5) {
- $list [$k] ['bond'] = bcadd ( $list [$k] ['bond'], $value ['expenditurePrice'], 2 );
- }
- // 纵横文库提现
- if ($value ['expenditureType'] == 13) {
- $list [$k] ['wenku'] = bcadd ( $list [$k] ['wenku'], $value ['expenditurePrice'], 2 );
- }
- // 其他
- if ($value ['expenditureType'] == 14) {
- $list [$k] ['other'] = bcadd ( $list [$k] ['other'], $value ['expenditurePrice'], 2 );
- }
-
- }
- }
- $list [$k] ['payTaxesSubtotal'] = bcadd ( $list [$k] ['addedTax'] + $list [$k] ['surcharges'] + $list [$k] ['corporateIncomeTax']
- , $list [$k] ['socialSecurity']+$list [$k] ['unionFees']+$list [$k] ['personalIncomeTax']+$list [$k] ['stampDuty'], 2 );
-
- $list [$k] ['subtotal'] = bcadd ( $list [$k] ['payTaxesSubtotal'] + $list [$k] ['bankCharges'] + $list [$k] ['telephoneRate'], $list [$k] ['bond'] + $list [$k] ['wenku'] + $list [$k] ['other'] , 2 );
- }
-
- return $list;
- }
-
- // 日常收入汇总
- public function GetIncomeCollect($parameter = array()) {
-
- $data = $this->accountBook->GetExpensesType ( $parameter );
-
- $list = array ();
-
- // 初始化日
- if (! empty ( $parameter ['month'] )) {
-
- $days = cal_days_in_month(CAL_GREGORIAN, $parameter['month'], $parameter['year']);
-
- for($i = 1; $i <= $days; $i ++) {
- $item = array (
- "month" => str_pad ( $i, 2, "0", STR_PAD_LEFT ),
- // 利息收入
- "bankDepositPrice" => 0,
- "currentFinancPrice" => 0,
- "fixedFinancPrice" => 0,
- "personalLoanPrice" => 0,
- "interestSubtotalPrice" => 0,
- // 补贴收入
- "socialSecurity" => 0,
- "finance" => 0,
- "subsidySubtotal" => 0,
- // 纵横知道
- "zongheng" => 0,
- // 借款收回
- "reserveFund" => 0,
- "privateBorrow" => 0,
- "loanSubtotal" => 0,
- // 退汇
- "returnRemittance" => 0,
- "bond" => 0,
- "other" => 0,
-
- "subtotal" => 0
- );
- array_push ( $list, $item );
- }
- } else {
- // 初始化月份
- for($i = 1; $i <= 12; $i ++) {
- $item = array (
- "month" => str_pad ( $i, 2, "0", STR_PAD_LEFT ),
- // 利息收入
- "bankDepositPrice" => 0,
- "currentFinancPrice" => 0,
- "fixedFinancPrice" => 0,
- "personalLoanPrice" => 0,
- "interestSubtotalPrice" => 0,
- // 补贴收入
- "socialSecurity" => 0,
- "finance" => 0,
- "subsidySubtotal" => 0,
- // 纵横知道
- "zongheng" => 0,
- // 借款收回
- "reserveFund" => 0,
- "privateBorrow" => 0,
- "loanSubtotal" => 0,
- // 退汇
- "returnRemittance" => 0,
- "bond" => 0,
- "other" => 0,
-
- "subtotal" => 0
- );
- array_push ( $list, $item );
- }
- }
-
- foreach ( $list as $k => $v ) {
- foreach ( $data as $key => $value ) {
- if (! empty ( $parameter ['month'] )) {
- $month = date ( "d", strtotime ( $value ['receivedDate'] ) );
- }else{
- $month = date ( "m", strtotime ( $value ['receivedDate'] ) );
- }
- if ($v ["month"] == $month) {
- // 利息收入
- if ($value ['accountType'] == 1) {
- if ($value ['accountMsg'] == '银行存款') {
- $list [$k] ['bankDepositPrice'] = bcadd ( $list [$k] ['bankDepositPrice'], $value ['receivedPrice'], 2 );
- } elseif ($value ['accountMsg'] == '活期理财收益') {
- $list [$k] ['currentFinancPrice'] = bcadd ( $list [$k] ['currentFinancPrice'], $value ['receivedPrice'], 2 );
- } elseif ($value ['accountMsg'] == '固定理财收益') {
- $list [$k] ['fixedFinancPrice'] = bcadd ( $list [$k] ['fixedFinancPrice'], $value ['receivedPrice'], 2 );
- } elseif ($value ['accountMsg'] == '个人借款') {
- $list [$k] ['personalLoanPrice'] = bcadd ( $list [$k] ['personalLoanPrice'], $value ['receivedPrice'], 2 );
- }
- }
-
- // 补贴收入
- if ($value ['accountType'] == 2) {
- if ($value ['accountMsg'] == '社保') {
- $list [$k] ['socialSecurity'] = bcadd ( $list [$k] ['socialSecurity'], $value ['receivedPrice'], 2 );
- } elseif ($value ['accountMsg'] == '财政') {
- $list [$k] ['finance'] = bcadd ( $list [$k] ['finance'], $value ['receivedPrice'], 2 );
- }
- }
-
- // 纵横知道
- if ($value ['accountType'] == 3) {
- $list [$k] ['zongheng'] = bcadd ( $list [$k] ['zongheng'], $value ['receivedPrice'], 2 );
- }
-
- // 借款收回
- if ($value ['accountType'] == 4) {
- if ($value ['accountMsg'] == '备用金') {
- $list [$k] ['reserveFund'] = bcadd ( $list [$k] ['reserveFund'], $value ['receivedPrice'], 2 );
- } elseif ($value ['accountMsg'] == '私人借款') {
- $list [$k] ['privateBorrow'] = bcadd ( $list [$k] ['privateBorrowing'], $value ['receivedPrice'], 2 );
- }
- }
-
- // 退汇
- if ($value ['accountType'] == 5) {
- $list [$k] ['returnRemittance'] = bcadd ( $list [$k] ['returnRemittance'], $value ['receivedPrice'], 2 );
- }
-
- // 保证金
- if ($value ['accountType'] == 8) {
- $list [$k] ['bond'] = bcadd ( $list [$k] ['bond'], $value ['receivedPrice'], 2 );
- }
-
- // 其他
- if ($value ['accountType'] == 6) {
- $list [$k] ['other'] = bcadd ( $list [$k] ['other'], $value ['receivedPrice'], 2 );
- }
- }
- }
- $list [$k] ['interestSubtotalPrice'] = bcadd ( $list [$k] ['bankDepositPrice'] + $list [$k] ['currentFinancPrice'] + $list [$k] ['fixedFinancPrice'], $list [$k] ['personalLoanPrice'], 2 );
- $list [$k] ['subsidySubtotal'] = bcadd ( $list [$k] ['socialSecurity'], $list [$k] ['finance'], 2 );
- $list [$k] ['loanSubtotal'] = bcadd ( $list [$k] ['reserveFund'], $list [$k] ['privateBorrowing'], 2 );
-
- $list [$k] ['subtotal'] = bcadd ( $list [$k] ['interestSubtotalPrice'] + $list [$k] ['subsidySubtotal'] + $list [$k] ['loanSubtotal'], $list [$k] ['zongheng'] + $list [$k] ['returnRemittance'] + $list [$k] ['bond'] + $list [$k] ['other'], 2 );
- }
-
- return $list;
- }
-
- // 费用分页
- public function GetIncomeExpensesPage($data = array()) {
- // if (!empty($data['categoryId'])){
- // $data['categoryId']=$this->XDeode->decode($data['categoryId']);
- // }
- // if (!empty($data['staffId'])){
- // $data['staffId']=$this->XDeode->decode($data['staffId']);
- // }
- if (empty ( $data ['year'] )) {
- $data ['year'] = date ( "Y" );
- }
- if (! is_numeric ( $data ['pSize'] )) {
- $data ['pSize'] = 20;
- }
- if (! is_numeric ( $data ['cPage'] )) {
- $data ['cPage'] = 0;
- } else {
- $data ['cPage'] = ($data ['cPage'] - 1) * $data ['pSize'];
- }
-
- $data = $this->accountBook->GetPage ( $data );
-
- foreach ( $data ['list'] as $key => $value ) {
-
- if ($value ['receivedBank'] == '华润银行') {
- $data ['list'] [$key] ['receivedBank'] = '广发纵横知道';
- }
-
- if ($value ['expensesType'] == 1) {
- $data ['list'] [$key] ['expensesTypeShow'] = "收入";
-
- if ($value ['accountType'] == 1) {
- $data ['list'] [$key] ['typeShow'] = "利息收入";
- } elseif ($value ['accountType'] == 2) {
- $data ['list'] [$key] ['typeShow'] = "补贴收入";
- } elseif ($value ['accountType'] == 3) {
- $data ['list'] [$key] ['typeShow'] = "纵横知道";
- } elseif ($value ['accountType'] == 4) {
- $data ['list'] [$key] ['typeShow'] = "借款收回";
- } elseif ($value ['accountType'] == 5) {
- $data ['list'] [$key] ['typeShow'] = "退汇";
- } elseif ($value ['accountType'] == 6) {
- $data ['list'] [$key] ['typeShow'] = "其他";
- } elseif ($value ['accountType'] == 7) {
- $data ['list'] [$key] ['typeShow'] = "广发理财";
- } elseif ($value ['accountType'] == 8) {
- $data ['list'] [$key] ['typeShow'] = "工行理财";
- } elseif ($value ['accountType'] == 9) {
- $data ['list'] [$key] ['typeShow'] = "保证金";
- } elseif ($value ['accountType'] == 10) {
- $data ['list'] [$key] ['typeShow'] = "理财收入";
- } elseif ($value ['accountType'] == 11) {
- $data ['list'] [$key] ['typeShow'] = "广发存款";
- } elseif ($value ['accountType'] == 12) {
- $data ['list'] [$key] ['typeShow'] = "工行存款";
- } elseif ($value ['accountType'] == 13) {
- $data ['list'] [$key] ['typeShow'] = "理财";
- if ($value ['operatingBankType'] == 1) {
- $data ['list'] [$key] ['typeShow'] .= "(理财账号)";
- } elseif ($value ['operatingBankType'] == 2) {
- $data ['list'] [$key] ['typeShow'] .= "(公司账号)";
- }
- } elseif ($value ['accountType'] == 14) {
- $data ['list'] [$key] ['typeShow'] = "存款";
- }
-
- if (! empty ( $value ['accountMsg'] )) {
- $data ['list'] [$key] ['typeShow'] .= ' / '.$value ['accountMsg'];
- }
-
- $data ['list'] [$key] ['priceShow'] = $value ['receivedPrice'];
- $data ['list'] [$key] ['dateShow'] = $value ['receivedDate'];
- $data ['list'] [$key] ['bankShow'] = $value ['receivedBank'];
- if ($value ['operatingBankType'] == 1) {
- $data ['list'] [$key] ['bankShow'] .= $value ['depositMethod'];
- }
- } elseif ($value ['expensesType'] == 2) {
- $data ['list'] [$key] ['expensesTypeShow'] = "支出";
- $data ['list'] [$key] ['dateShow'] = $value ['expenditureDate'];
- $data ['list'] [$key] ['bankShow'] = $value ['expenditureBank'];
- if ($value ['operatingBankType'] == 1) {
- $data ['list'] [$key] ['bankShow'] .= ' / '.$value ['depositMethod'];
- }
-
- if ($value ['expensesType'] == 1) {
- $data ['list'] [$key] ['typeShow'] = "银行手续费";
- } elseif ($value ['expensesType'] == 2) {
- $data ['list'] [$key] ['typeShow'] = "总部电话费";
- } elseif ($value ['expensesType'] == 3) {
- $data ['list'] [$key] ['typeShow'] = "缴税";
- } elseif ($value ['expensesType'] == 4) {
- $data ['list'] [$key] ['typeShow'] = "广发理财";
- } elseif ($value ['expensesType'] == 5) {
- $data ['list'] [$key] ['typeShow'] = "保证金";
- } elseif ($value ['expensesType'] == 6) {
- $data ['list'] [$key] ['typeShow'] = "工行理财";
- } elseif ($value ['expensesType'] == 7) {
- $data ['list'] [$key] ['typeShow'] = "理财支出";
- } elseif ($value ['expensesType'] == 8) {
- $data ['list'] [$key] ['typeShow'] = "广发存款";
- } elseif ($value ['expensesType'] == 9) {
- $data ['list'] [$key] ['typeShow'] = "工行存款";
- } elseif ($value ['expensesType'] == 10) {
- $data ['list'] [$key] ['typeShow'] = "工资";
- } elseif ($value ['expensesType'] == 11) {
- $data ['list'] [$key] ['typeShow'] = "理财";
- if ($value ['operatingBankType'] == 1) {
- $data ['list'] [$key] ['typeShow'] .= "(理财账号)";
- } elseif ($value ['operatingBankType'] == 2) {
- $data ['list'] [$key] ['typeShow'] .= "(公司账号)";
- }
- } elseif ($value ['expensesType'] == 12) {
- $data ['list'] [$key] ['typeShow'] = "存款";
- } elseif ($value ['expensesType'] == 13) {
- $data ['list'] [$key] ['typeShow'] = "纵横文库提现";
- } elseif ($value ['expensesType'] == 14) {
- $data ['list'] [$key] ['typeShow'] = "其他";
- }
-
- if (! empty ( $value ['expenditureMsg'] )) {
- $data ['list'] [$key] ['typeShow'] .=' / '. $value ['expenditureMsg'];
- }
-
- $data ['list'] [$key] ['priceShow'] = $value ['expenditurePrice'];
- }
- }
-
- return $data;
- // // //获得办事处信息
- // // $office=$this->category->GetAll();
- // // //获得员工信息
- // // $staffList=$this->staff->find(array('asArray' => TRUE));
-
- // foreach ($data['list'] as $key=>$value){
- // $data['list'][$key]['ridOld']=$value['rid'];
- // $data['list'][$key]['rid']=$this->XDeode->encode($value['rid']);
- // $data['list'][$key]['cid']=$this->XDeode->encode($value['cid']);
- // $data['list'][$key]['staff']=$this->XDeode->encode($value['staff']);
- // $data['list'][$key]['categoryValue']="";
- // $data['list'][$key]['statusValue']=$this->feeStatusValue[$value['status']];
- // foreach ($office as $k=>$v){
- // if($v['cid']==$data['list'][$key]['cid']){
- // $data['list'][$key]['categoryValue']=$v['title'];
- // }
- // }
- // $data['list'][$key]['staffName']="";
- // foreach ($staffList as $k=>$v){
- // if($v['sid']==$value['staff']){
- // $data['list'][$key]['staffName']=$v['username'];
- // }
- // }
- // $data['list'][$key]['Rtype']=$this->feeTypeValue[$value['Rtype']];
- // if($this->getFeeLoanType($value)){
- // $data['list'][$key]['Rtype'].="报销单";
- // }
-
- // if($value['pastDate']=="0000-00-00"){
- // $data['list'][$key]['pastDate']="";
- // }
-
- // if($value['version']==1){
- // $data['list'][$key]['explanation']=$this->getReceiptVerson1Explanation($value);
- // }
- // }
-
- // return $data;
- }
- }
- ?>
|