<?php
class flow_account_detailClassModel extends flowModel
{
	
	
  public function flowrsreplace($rs)
    {
         foreach ($rs as $k => &$v) {
  

            switch ($k) {
                case 'opt_type':
                    if($v == 1) {
                        $v = '收入';
                      
                    } else if($v == 2) {
                        $v = '支出';
                    } else {
                        $v = '';
                    }
                    break;
                case 'trans_numb':
                   
                    $arr=$this->getnums($v);
                    if($arr){
                      $num=$arr['num'];
                      $id=$arr['id'];
                      $name=$arr['name'];
                      $v= "<a href='javascript:;' onclick=openxiangs('$name','$num',$id)>$v</a>";
                    }else{
                      $v=$v;
                    }
                    
                
                    break;
               }  
        }
        return $rs;
    }

	 public function getnums($num){

        if(strpos($num, 'OA-FK') !==false){
              $ids = m('c_fininfom_oafk')->getone('docnum = "'.$num.'"','id');
              $ids['num']='oafk';
              $ids['name']='付款申请单';
              // $ids['id']=$ids['id'];
        }
        if(strpos($num, 'OA-YFK') !==false){
              $ids = m('c_fininfom_oayfk')->getone('docnum = "'.$num.'"','id');
              $ids['num']='oayfk';
              $ids['name']='预付款申请单';
        }
        if(strpos($num, 'OA-BX') !==false){
              $ids = m('fininfom')->getone('docnum = "'.$num.'"','id'); 
              $ids['num']='finfybx';
              $ids['name']='费用报销';
        }
        if(strpos($num, 'FT') !==false){
              $ids = m('c_fund_detail')->getone('trans_numb = "'.$num.'"','id'); 
              $ids['num']='fund_transfer';
              $ids['name']='资金划拨';
        }
        if(strpos($num, 'FS') !==false){
              $ids = m('c_fund_detail')->getone('trans_numb = "'.$num.'"','id'); 
              $ids['num']='fund_deposit';
              $ids['name']='资金入账';
        }
        return $ids;
    }
}

