txapply.inc.php 4.1 KB

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