mode_finfybxAction.php 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  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. public function getzhangAjax()
  45. {
  46. return m('fina')->zhangtaoselect();
  47. }
  48. //生成账套20260122
  49. public function createjizhangAjax()
  50. {
  51. $accountid = (int)$this->post('accountid','0');
  52. $id = (int)$this->post('id','0');
  53. $sm = $this->post('sm');
  54. $mknum = $this->post('mknum');
  55. $acrs = m('finount')->getone($accountid);
  56. $rs = m('fininfom')->getone($id);
  57. $urs = m('admin')->getone($rs['uid']);
  58. $type = (int)$rs['type'];
  59. $money = floatval($rs['money']);
  60. $typea = array('费用报销','出差报销','借款单','还款单');
  61. $jtype = $typea[$type];
  62. if($type<=2){
  63. $money = 0-$money;
  64. }
  65. $paydt = $rs['paydt'];
  66. if(isempt($paydt))$paydt = $this->date;
  67. $uarr['comid'] = $rs['comid'];
  68. $uarr['type'] = 1;//0收入,1支出
  69. $uarr['money'] = $money;
  70. $uarr['mknum'] = $mknum.'|'.$id;
  71. //$uarr['custid'] = $rs['custid'];
  72. $uarr['custname'] = $rs['fullname'];
  73. $uarr['applydt'] = $paydt;
  74. $uarr['optid'] = $this->adminid;
  75. $uarr['optname'] = $this->adminname;
  76. $uarr['optdt'] = $this->rock->now;
  77. $uarr['uid'] = $this->adminid;
  78. $uarr['xguid'] = $rs['uid'];
  79. $uarr['xgname'] = arrvalue($urs,'name');
  80. $uarr['xgdeptid'] = arrvalue($urs,'deptid');
  81. $uarr['xgdeptname'] = arrvalue($urs,'deptname');
  82. $uarr['explain'] = $sm;
  83. $uarr['accountid'] = $accountid;
  84. $uarr['zhangid'] = $acrs['zhangid'];
  85. $uarr['jtype'] = '差旅费';
  86. $newid = m('finjibook')->insert($uarr);
  87. m('fininfom')->update('jzid='.$newid.'', $id);
  88. return returnsuccess();
  89. }
  90. }
粤ICP备19079148号