dltxapply.inc.php 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <?php
  2. global $_GPC, $_W;
  3. $action = 'start';
  4. $GLOBALS['frames'] = $this->getNaveMenu($_COOKIE['cityname'], $action);
  5. $operation = !empty($_GPC['op']) ? $_GPC['op'] : 'display';
  6. //获取商家总金额
  7. // //订单销售金额
  8. // $sql5=" select sum(a.money) as ordermoney from (select a.id,a.money,FROM_UNIXTIME(a.time) as time from".tablename('zhtc_order'). " a" . " left join " . tablename("zhtc_store") . " b on a.store_id=b.id where a.uniacid={$_W['uniacid']} and a.state in (2,3,4,5,7) and b.cityname='{$_COOKIE['cityname']}') a ";
  9. // $ordermoney=pdo_fetch($sql5);
  10. // //商家入驻的钱
  11. // $sql6="select sum(a.money) as storemoney from".tablename('zhtc_storepaylog'). " a" . " left join " . tablename("zhtc_store") . " b on a.store_id=b.id where a.uniacid={$_W['uniacid']} and b.cityname='{$_COOKIE['cityname']}' ";
  12. // $storemoney=pdo_fetch($sql6);
  13. // //帖子入驻加置顶
  14. // $sql7=" select sum(a.money) as tzmoney from".tablename('zhtc_tzpaylog'). " a" . " left join " . tablename("zhtc_information") . " b on a.tz_id=b.id where a.uniacid={$_W['uniacid']} and b.cityname='{$_COOKIE['cityname']}' ";
  15. // $tzmoney=pdo_fetch($sql7);
  16. // //拼车发布的钱
  17. // $sql8=" select sum(a.money) as pcmoney from".tablename('zhtc_carpaylog'). " a" . " left join " . tablename("zhtc_car") . " b on a.car_id=b.id where a.uniacid={$_W['uniacid']} and b.cityname='{$_COOKIE['cityname']}'";
  18. // $pcmoney=pdo_fetch($sql8);
  19. // //114入驻的钱
  20. // $sql9=" select sum(a.money) as hymoney from".tablename('zhtc_yellowpaylog'). " a" . " left join " . tablename("zhtc_yellowstore") . " b on a.hy_id=b.id where a.uniacid={$_W['uniacid']} and b.cityname='{$_COOKIE['cityname']}' ";
  21. // $hymoney=pdo_fetch($sql9);
  22. // //总金额
  23. // $bytmoney=$ordermoney['ordermoney']+$storemoney['storemoney']+$tzmoney['tzmoney']+$pcmoney['pcmoney']+$hymoney['hymoney'];
  24. // //本月可获得佣金
  25. // $yjtype=pdo_get('zhtc_yjset',array('uniacid'=>$_W['uniacid']));
  26. // if($yjtype['type']==1){
  27. // $kdyj=$bytmoney*$yjtype['typer']/100;
  28. // }
  29. // if($yjtype['type']==2){
  30. // $kdyj=(($ordermoney['ordermoney']+$storemoney['storemoney'])*$yjtype['sjper']+$tzmoney['tzmoney']*$yjtype['tzper']+$pcmoney['pcmoney']*$yjtype['pcper']+$hymoney['hymoney']*$yjtype['pcper'])/100;
  31. // }
  32. // $kdyj=number_format($kdyj, 2);
  33. $account=pdo_get('zhtc_account',array('cityname'=>$_COOKIE['cityname']),'money');
  34. $kdyj=$account['money'];
  35. //商户已提现金额
  36. $ytxcost=pdo_get('zhtc_yjtx', array('account_id'=>$_COOKIE['account_id'],'status'=>2), array('sum(tx_cost) as ytxcost'));
  37. //商户申请提现金额
  38. $stxcost=pdo_get('zhtc_yjtx', array('account_id'=>$_COOKIE['account_id'],'status'=>1), array('sum(tx_cost) as stxcost'));
  39. //可提现金额
  40. $ktxcost= $kdyj-$ytxcost['ytxcost']-$stxcost['stxcost'];
  41. if(checksubmit('submit')){
  42. if(empty($_GPC['tx_cost'])){
  43. message('提现金额不能为空','','error');
  44. }
  45. if($_GPC['tx_cost']> $ktxcost){
  46. message('输入金额大于可提现金额','','error');
  47. }
  48. $data['tx_type']=$_GPC['tx_type'];
  49. $data['tx_cost']=$_GPC['tx_cost'];
  50. $data['sj_cost']=$_GPC['tx_cost']-($_GPC['tx_cost']* $tx_info['tx_sxf']);
  51. //$data['sx_cost']=($_GPC['tx_cost']* $tx_info['tx_sxf']);
  52. $data['account']=$_GPC['account'];
  53. $data['name']=$_GPC['name'];
  54. $data['status']=1;
  55. $data['cerated_time']=date('Y-m-d H:i:s');
  56. $data['uniacid']=$_W['uniacid'];
  57. $data['account_id']=$_COOKIE['account_id'];
  58. $res=pdo_insert('zhtc_yjtx',$data);
  59. if($res){
  60. message('添加成功',$this->createWebUrl2('dltxdetails',array()),'success');
  61. }else{
  62. message('添加失败','','error');
  63. }
  64. }
  65. include $this->template('web/dltxapply');