|
@@ -2197,15 +2197,19 @@ function bizbase_statisticsEntityHandle($subSystem, $handleMode, $baseUser, $biz
|
|
|
}
|
|
|
|
|
|
if ($handleMode == "fetchallByPlater") {
|
|
|
+ $whereparam = [
|
|
|
+ ":qstartDate" => $qstartDate,
|
|
|
+ ":qendDate" => $qendDate,
|
|
|
+ ];
|
|
|
$outSql = " select sum(ifnull(money,0)) as total";
|
|
|
$outSql .= " from biz_trader_account ";
|
|
|
- $outSql .= " where biz_roletype = 0 and type = 1 and deleted = 0 and status= 1 and biz_catalog=8";
|
|
|
- $shopOutlist = pdo_fetchall($outSql, array()); //冻结工单费用
|
|
|
+ $outSql .= " where biz_roletype = 0 and type = 1 and deleted = 0 and status= 1 and biz_catalog=8 and createtime>=:qstartDate and createtime<=:qendDate";
|
|
|
+ $shopOutlist = pdo_fetchall($outSql, $whereparam); //冻结工单费用
|
|
|
|
|
|
$frozenSql = " select sum(ifnull(money,0)) as total ";
|
|
|
$frozenSql .= " from biz_trader_account ";
|
|
|
- $frozenSql .= " where biz_roletype = 0 and type = 0 and deleted=0 and status=1 and biz_catalog = 6";
|
|
|
- $shopFrozenIn = pdo_fetchall($frozenSql, array()); //工单费用解冻
|
|
|
+ $frozenSql .= " where biz_roletype = 0 and type = 0 and deleted=0 and status=1 and biz_catalog = 6 and createtime>=:qstartDate and createtime<=:qendDate";
|
|
|
+ $shopFrozenIn = pdo_fetchall($frozenSql, $whereparam); //工单费用解冻
|
|
|
$shopFrozenBalance = round(floatval($shopOutlist[0]["total"]), 2) - round(floatval($shopFrozenIn[0]["total"]), 2); //商户冻结余额,即当前实际冻结的金额
|
|
|
|
|
|
/*
|
|
@@ -2225,20 +2229,27 @@ function bizbase_statisticsEntityHandle($subSystem, $handleMode, $baseUser, $biz
|
|
|
//type=0 收入
|
|
|
$userFrozenSql = " select sum(ifnull(money,0)) as total ";
|
|
|
$userFrozenSql .= " from biz_worker_account ";
|
|
|
- $userFrozenSql .= " where deleted=0 and `status`=1 and type=0 and biz_catalog in (7,5)";
|
|
|
- $userFrozenIn = pdo_fetchall($userFrozenSql, array());
|
|
|
+ $userFrozenSql .= " where deleted=0 and `status`=1 and type=0 and biz_catalog in (7,5) and createtime>=:qstartDate and createtime<=:qendDate";
|
|
|
+ $userFrozenIn = pdo_fetchall($userFrozenSql, $whereparam);
|
|
|
|
|
|
//type=1 支出
|
|
|
$userOut = " select sum(ifnull(money,0)) as total ";
|
|
|
$userOut .= " from biz_worker_account ";
|
|
|
- $userOut .= " where deleted=0 and `status`=1 and type=1 and biz_catalog=2";
|
|
|
- $userOutList = pdo_fetchall($userOut, array());
|
|
|
+ $userOut .= " where deleted=0 and `status`=1 and type=1 and biz_catalog=2 and createtime>=:qstartDate and createtime<=:qendDate";
|
|
|
+ $userOutList = pdo_fetchall($userOut, $whereparam);
|
|
|
|
|
|
$userFrozenBalance = round(floatval($userOutList[0]["total"]), 2) - round(floatval($userFrozenIn[0]["total"]), 2); //用户冻结余额,即当前实际冻结的金额
|
|
|
// 商户总共支付会员---总金额
|
|
|
- $sumSql = "select sum(ifnull(money,0)) as total from biz_trader_account where (deleted=9 or deleted=0) and `status`=1 and type=1 and biz_catalog = 3";
|
|
|
- $sumPay = pdo_fetchall($sumSql, array());
|
|
|
- $sumPay = round(floatval($sumPay[0]["total"]), 2);
|
|
|
+ //$sumSql1 = "select sum(ifnull(money,0)) as total from biz_trader_account where (deleted=9 or deleted=0) and `status`=1 and type=1 and biz_catalog = 3";
|
|
|
+ $sumSql1 = "select sum(ifnull(money,0)) as total from biz_trader_account where deleted=9 and `status`=1 and type=1 and biz_catalog = 3 and createtime>=:qstartDate and createtime<=:qendDate";
|
|
|
+ $sumSql2 = "select sum(ifnull(money,0)) as total from biz_trader_account where deleted=0 and `status`=1 and type=1 and biz_catalog=1 and createtime>=:qstartDate and createtime<=:qendDate";
|
|
|
+ $sumSql3 = "select sum(ifnull(money,0)) as total from biz_trader_account where deleted=0 and `status`=1 and type=1 and biz_catalog=9 and createtime>=:qstartDate and createtime<=:qendDate";
|
|
|
+ $sumPay1 = pdo_fetchall($sumSql1, $whereparam);
|
|
|
+ $sumPay2 = pdo_fetchall($sumSql2, $whereparam);
|
|
|
+ $sumPay3 = pdo_fetchall($sumSql3, $whereparam);
|
|
|
+ //$sumPay = round(floatval($sumPay1[0]["total"]), 2);
|
|
|
+ $sumPay = bcadd($sumPay1[0]["total"], $sumPay2[0]["total"], 2);
|
|
|
+ $sumPay = bcadd($sumPay, $sumPay3[0]["total"], 2);
|
|
|
|
|
|
// 平台收益
|
|
|
/*
|
|
@@ -2256,9 +2267,9 @@ function bizbase_statisticsEntityHandle($subSystem, $handleMode, $baseUser, $biz
|
|
|
$adminSum1 = 0;
|
|
|
$adminSql = " select sum(ifnull(money,0)) as total ";
|
|
|
$adminSql .= " from biz_trader_account ";
|
|
|
- $adminSql .= " where (deleted=9 ) and `status`=1 and type=1 and biz_catalog = 1";
|
|
|
+ $adminSql .= " where (deleted=9 ) and `status`=1 and type=1 and biz_catalog = 1 and createtime>=:qstartDate and createtime<=:qendDate";
|
|
|
//$adminSql .= " where (deleted=9 or deleted=0) and `status`=1 and type=1 and biz_catalog = 1";
|
|
|
- $adminSql = pdo_fetchall($adminSql, array());
|
|
|
+ $adminSql = pdo_fetchall($adminSql, $whereparam);
|
|
|
$adminSum2 = round(floatval($adminSql[0]["total"]), 2);
|
|
|
|
|
|
// 未提现金额:所有会员&商家的账户余额(即待提现金额)的总和
|
|
@@ -2281,12 +2292,12 @@ function bizbase_statisticsEntityHandle($subSystem, $handleMode, $baseUser, $biz
|
|
|
}
|
|
|
$shopBalance = round(floatval($income - $outgoing), 2);*/
|
|
|
$shop_sum_in_sql = "select sum(ifnull(money,0)) as total from biz_trader_account
|
|
|
- where biz_roletype=0 and type=0 and `deleted`=0 and `status`=1 and biz_catalog in (0,1,2,3,6,7)";
|
|
|
- $shopsumin = pdo_fetchall($shop_sum_in_sql, array());
|
|
|
+ where biz_roletype=0 and type=0 and `deleted`=0 and `status`=1 and biz_catalog in (0,1,2,3,6,7) and createtime>=:qstartDate and createtime<=:qendDate";
|
|
|
+ $shopsumin = pdo_fetchall($shop_sum_in_sql, $whereparam);
|
|
|
|
|
|
$shop_sum_out_sql = "select sum(ifnull(money,0)) as total from biz_trader_account
|
|
|
- where biz_roletype=0 and type=1 and `deleted`=0 and `status`=1 and biz_catalog in (0,1,2,3,4,5,6,7,8)";
|
|
|
- $shopsumout = pdo_fetchall($shop_sum_out_sql, array());
|
|
|
+ where biz_roletype=0 and type=1 and `deleted`=0 and `status`=1 and biz_catalog in (0,1,2,3,4,5,6,7,8) and createtime>=:qstartDate and createtime<=:qendDate";
|
|
|
+ $shopsumout = pdo_fetchall($shop_sum_out_sql, $whereparam);
|
|
|
$shopBalance = bcsub(floatval($shopsumin[0]['total']), floatval($shopsumout[0]['total']), 2);
|
|
|
//用户
|
|
|
/*$user_sum_sql = " select type,money as total ";
|
|
@@ -2308,11 +2319,11 @@ function bizbase_statisticsEntityHandle($subSystem, $handleMode, $baseUser, $biz
|
|
|
$userBalance = round($user_income - $user_outgoing, 2);
|
|
|
*/
|
|
|
$user_sum_in_sql = "select sum(ifnull(money,0)) as total from biz_worker_account
|
|
|
- where deleted=0 and `status`=1 and type=0 and biz_catalog in (0,1,2,3,4,5,7)";
|
|
|
- $usersumin = pdo_fetchall($user_sum_in_sql, array());
|
|
|
+ where deleted=0 and `status`=1 and type=0 and biz_catalog in (0,1,2,3,4,5,7) and createtime>=:qstartDate and createtime<=:qendDate";
|
|
|
+ $usersumin = pdo_fetchall($user_sum_in_sql, $whereparam);
|
|
|
$user_sum_out_sql = "select sum(ifnull(money,0)) as total from biz_worker_account
|
|
|
- where deleted=0 and `status`=1 and type=1 and biz_catalog in (0,1,2,10)";
|
|
|
- $usersumout = pdo_fetchall($user_sum_out_sql, array());
|
|
|
+ where deleted=0 and `status`=1 and type=1 and biz_catalog in (0,1,2,10) and createtime>=:qstartDate and createtime<=:qendDate";
|
|
|
+ $usersumout = pdo_fetchall($user_sum_out_sql, $whereparam);
|
|
|
$userBalance = bcsub(floatval($usersumin[0]['total']), floatval($usersumout[0]['total']), 2);
|
|
|
$sum = bcadd($shopBalance, $userBalance, 2);
|
|
|
|