| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113 |
- <?php
- /**
- * 此文件是流程模块【finfybx.费用报销】对应接口文件。
- * 可在页面上创建更多方法如:public funciton testactAjax(),用js.getajaxurl('testact','mode_finfybx|input','flow')调用到对应方法
- */
- class mode_finfybxClassAction extends inputAction{
-
- protected function savebefore($table, $arr, $id, $addbo){
-
- }
-
-
- protected function saveafter($table, $arr, $id, $addbo){
-
- }
-
- public function getlastAjax()
- {
- $rs = m('fininfom')->getone("`uid`='$this->adminid' and `type`<3 order by `optdt` desc",'paytype,cardid,openbank,fullname');
- if(!$rs)$rs='';
- $this->returnjson($rs);
- }
-
- //根据报销项目统计
- public function itemtotalAjax()
- {
- $rows = array();
- $where = m('flow')->initflow('finfybx')->gethighwhere();
- $where1 = str_replace('{asqom}','b.', $where);
- $where = m('admin')->getcompanywhere(1,'b.');
- $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` ');
- $money = 0;
- foreach($rosa as $k=>$rs)$money+=floatval($rs['money']);
- if($money>0){
- foreach($rosa as $k=>$rs){
- $rows[] = array(
- 'value' => $rs['money'],
- 'name' => $rs['name'],
- 'bili' => $this->rock->number( floatval($rs['money']) * 100 / $money).'%',
- );
- }
- }else{
- $rows[] = array(
- 'value' => 0,
- 'name' => '暂无数据',
- 'bili' => '',
- );
- }
-
- return array('rows'=>$rows);
- }
-
- public function getzhangAjax()
- {
- return m('fina')->zhangtaoselect();
- }
-
-
-
-
- //生成账套20260122
- public function createjizhangAjax()
- {
- $accountid = (int)$this->post('accountid','0');
- $id = (int)$this->post('id','0');
- $sm = $this->post('sm');
- $mknum = $this->post('mknum');
- $acrs = m('finount')->getone($accountid);
-
-
- $rs = m('fininfom')->getone($id);
- $urs = m('admin')->getone($rs['uid']);
- $type = (int)$rs['type'];
- $money = floatval($rs['money']);
-
- $typea = array('费用报销','出差报销','借款单','还款单');
- $jtype = $typea[$type];
-
- if($type<=2){
- $money = 0-$money;
- }
-
- $paydt = $rs['paydt'];
- if(isempt($paydt))$paydt = $this->date;
-
- $uarr['comid'] = $rs['comid'];
- $uarr['type'] = 1;//0收入,1支出
- $uarr['money'] = $money;
- $uarr['mknum'] = $mknum.'|'.$id;
- //$uarr['custid'] = $rs['custid'];
- $uarr['custname'] = $rs['fullname'];
- $uarr['applydt'] = $paydt;
- $uarr['optid'] = $this->adminid;
- $uarr['optname'] = $this->adminname;
- $uarr['optdt'] = $this->rock->now;
- $uarr['uid'] = $this->adminid;
- $uarr['xguid'] = $rs['uid'];
- $uarr['xgname'] = arrvalue($urs,'name');
- $uarr['xgdeptid'] = arrvalue($urs,'deptid');
- $uarr['xgdeptname'] = arrvalue($urs,'deptname');
- $uarr['explain'] = $sm;
- $uarr['accountid'] = $accountid;
- $uarr['zhangid'] = $acrs['zhangid'];
- $uarr['jtype'] = '差旅费';
-
- $newid = m('finjibook')->insert($uarr);
- m('fininfom')->update('jzid='.$newid.'', $id);
-
- return returnsuccess();
- }
- }
-
|