mode_finfybxAction.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. /**
  3. * 此文件是流程模块【finfybx.费用报销】对应接口文件。
  4. * 可在页面上创建更多方法如:public funciton testactAjax(),用js.getajaxurl('testact','mode_finfybx|input','flow')调用到对应方法
  5. */
  6. class mode_finfybxClassAction extends inputAction{
  7. protected function savebefore($table, $arr, $id, $addbo){
  8. }
  9. protected function saveafter($table, $arr, $id, $addbo){
  10. }
  11. public function getlastAjax()
  12. {
  13. $rs = m('fininfom')->getone("`uid`='$this->adminid' and `type`<3 order by `optdt` desc",'paytype,cardid,openbank,fullname');
  14. if(!$rs)$rs='';
  15. $this->returnjson($rs);
  16. }
  17. //根据报销项目统计
  18. public function itemtotalAjax()
  19. {
  20. $rows = array();
  21. $where = m('flow')->initflow('finfybx')->gethighwhere();
  22. $where1 = str_replace('{asqom}','b.', $where);
  23. $where = m('admin')->getcompanywhere(1,'b.');
  24. $rosa = $this->db->getall('SELECT a.`name`,sum(a.`money`)as money FROM `[Q]fininfos` a left join `[Q]fininfom` b on a.mid=b.id where b.`status` in(1) and b.`type`=0 '.$where.' '.$where1.' group by a.`name` ');
  25. $money = 0;
  26. foreach($rosa as $k=>$rs)$money+=floatval($rs['money']);
  27. if($money>0){
  28. foreach($rosa as $k=>$rs){
  29. $rows[] = array(
  30. 'value' => $rs['money'],
  31. 'name' => $rs['name'],
  32. 'bili' => $this->rock->number( floatval($rs['money']) * 100 / $money).'%',
  33. );
  34. }
  35. }else{
  36. $rows[] = array(
  37. 'value' => 0,
  38. 'name' => '暂无数据',
  39. 'bili' => '',
  40. );
  41. }
  42. return array('rows'=>$rows);
  43. }
  44. }
粤ICP备19079148号