⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 acc_tjxsqk.php

📁 自己实现一个实用的商店应用系统
💻 PHP
字号:
<?php
////////////////////////////////////////////////////////
// Author by Shuweich
// Date : 2007.11.13
// 建站支持: http://www.shuweich.net
// 作者: Shuweich
// QQ: 1502384
// ICQ: 190492112
// MSN: shuweich@hotmail.com
// E-mail: root@shuweich.net
// E-mail: shuweich@163.com
////////////////////////////////////////////////////////
// 模块管理 by txdyz
// For 统计销售情况
////////////////////////////////////////////////////////
include_once '../../mainfile.php';
include_once 'head_win.php';
include_once 'head_inc.php';

$que = "select count(*) from ".$xoopsDB->prefix("market_mdseri")." where store_id='".$_REQUEST['s_id0']."' and shbz!='2' and zy in (".$_TKjy.") group by sdbh";
$res = $xoopsDB->query($que);
$kll = $xoopsDB->getRowsNum($res);

echo "<br /><center>本日商品出货统计\n";
echo "<table border='1'>\n";
while ( list($jylx,$jym)=each($_TSjy) ) {
  $que = "select a.store_id,count(*) bs,sum(a.xssl) xj,sum(a.spzkj) xsje,b.sp_name ";
  $que.= " from ".$xoopsDB->prefix("market_mdseri")." a left join ".$xoopsDB->prefix("market_spinfo")." b using (store_id,sp_code) ";
  $que.= " where a.store_id='".$_REQUEST['s_id0']."'  and a.shbz!='2' and a.zy in (".$jym.") group by a.sp_code order by a.sp_code";
  $res = $xoopsDB->query($que);
  $reno = $xoopsDB->getRowsNum($res);
  if ( $reno == 0 ) continue;
  $jylx_name = explode(":",$jylx);
  echo "<tr><th colspan='4'>".$jylx_name[0]."</th></tr>\n";
  $th = explode(",",$jylx_name[1]);
  echo "<tr><th>$th[0]</th><th>$th[1]</th><th>$th[2]</th><th>$th[3]</th></tr>\n";
  $jehj = 0;
  while ( $rxs = $xoopsDB->fetchrow($res) ) {
    $jehj += $rxs[3];
    echo "<tr><td align='left'>$rxs[4]</td><td align='right'>$rxs[2]</td><td align='right'>$rxs[3]</td><td align='right'>$rxs[1]</td></tr>\n";
  }
  echo "<tr><th colspan='2'>金额小计:</th><th align='right'>".number_format($jehj,2,'.','')."</th><th> </th></tr>\n";
}

echo "</table>\n";
$que = "select sum(spzkj) xsje ";
$que.= " from ".$xoopsDB->prefix("market_mdseri");
$que.= " where store_id='".$_REQUEST['s_id0']."' and shbz!='2' and zy in (".$_TKjy.")";
$res = $xoopsDB->query($que);
$row = $xoopsDB->fetchrow($res);
echo "<hr />\n";
## 加入其它交易,如出、入金等的统计
echo "<table border='1'>\n";
echo "<tr><th>本日客流</th><th>平均客单价</th><th>销售小计</th></tr>\n";
echo "<tr><td align='right'>".$kll."</td><td align='right'>";
echo number_format(round($row[0] / $kll,2),2,'.','');
echo "</td><td align='right'>".number_format($row[0],2,'.','')."</td></tr>\n";

echo "<tr><th>原售价</th><th>让利额度</th><th>其中金额折</th></tr>\n";
$que =  "select sum(sj) ysj,sum(sj)-sum(spzkj) rl,sum(zke) from ";
$que .= $xoopsDB->prefix("market_mdseri")." where store_id='".$_REQUEST['s_id0']."' and shbz!='2' and zy in (".$_TRjy.")";
$mle = $xoopsDB->fetchrow( $xoopsDB->query($que) );
echo "<tr align='right'><td>".$mle[0]."</td><td>".$mle[1]."</td><td>".$mle[2]."</td></tr>\n";

echo "<tr><th>批发量</th><th colspan='2'>批发金额</th></tr>\n";
$que =  "select count(*) sl,sum(spzkj) je from ";
$que .= $xoopsDB->prefix("market_mdseri")." where store_id='".$_REQUEST['s_id0']."' and shbz!='2' and zy in (".$_TPjy.") group by sdbh";
$res = $xoopsDB->query($que);
$sl = 0;	$je = 0;
while ($ro = $xoopsDB->fetchrow( $res ) ) {
  $sl += $ro[0];	$je += $ro[1];
}
echo "<tr align='right'><td>".$sl."</td><td colspan='2'>".number_format($je,2,'.','')."</td></tr>\n";

echo "<tr><th>团购量</th><th colspan='2'>团购金额</th></tr>\n";
$que =  "select count(*) sl,sum(spzkj) je from ";
$que .= $xoopsDB->prefix("market_mdseri")." where store_id='".$_REQUEST['s_id0']."' and shbz!='2' and zy in (".$_TTjy.") group by sdbh";
$res = $xoopsDB->query($que);
$sl = 0;	$je = 0;
while ($ro = $xoopsDB->fetchrow( $res ) ) {
  $sl += $ro[0];	$je += $ro[1];
}
echo "<tr align='right'><td>".$sl."</td><td colspan='2'>".number_format($je,2,'.','')."</td></tr>\n";

echo "<tr><th>会员换购</th><th colspan='2'>换购金额</th></tr>\n";
$que =  "select count(*) sl,sum(spzkj) je from ";
$que .= $xoopsDB->prefix("market_mdseri")." where store_id='".$_REQUEST['s_id0']."' and shbz!='2' and zy in (".$_THjy.") group by sdbh";
$res = $xoopsDB->query($que);
$sl = 0;	$je = 0;
while ($ro = $xoopsDB->fetchrow( $res ) ) {
  $sl += $ro[0];	$je += $ro[1];
}
echo "<tr align='right'><td>".$sl."</td><td colspan='2'>".number_format($je,2,'.','')."</td></tr>\n";

echo "<tr><td colspan='3' align='center'>会&nbsp;员&nbsp;消&nbsp;费&nbsp;信&nbsp;息</td></tr>\n";
echo "<tr><th>购买次数</th><th>购买金额</th><th>赠送积分</th></tr>\n";
$que = "select sum(spzkj) gmje,tach from ";
$que.= $xoopsDB->prefix("market_mdseri");
$que.= " where store_id='".$_REQUEST['s_id0']."' and tach>0 and shbz!='2' group by sdbh";
$res = $xoopsDB->query($que);
$mrs = $xoopsDB->getRowsNum($res);
$gmje = 0;	$hyjf = 0;
while ( $mem = $xoopsDB->fetchrow($res) ){
  $gmje += $mem[0];
  $hyjf += $mem[1];
}
echo "<tr align='right'><td>$mrs</td><td>".number_format($gmje,2,'.','')."</td><td>".number_format($hyjf,2,'.','')."</td></tr>\n";

echo "<tr><td colspan='3' align='center'>钱&nbsp;&nbsp;&nbsp;箱&nbsp;&nbsp;&nbsp;信&nbsp;&nbsp;&nbsp;息</td></tr>\n";
echo "<tr><th>入金</th><th>出金</th><th>余款</th></tr>\n";
$que =  "select sum(spzkj) rj from ";
$que .= $xoopsDB->prefix("market_mdseri")." where store_id='".$_REQUEST['s_id0']."' and shbz!='2' and zy='mdrj'";
$rje = $xoopsDB->fetchrow( $xoopsDB->query($que) );
$que =  "select sum(spzkj) cj from ";
$que .= $xoopsDB->prefix("market_mdseri")." where store_id='".$_REQUEST['s_id0']."' and shbz!='2' and zy='mdcj'";
$cje = $xoopsDB->fetchrow( $xoopsDB->query($que) );
echo "<tr align='right'><td>".number_format($rje[0],2,'.','')."</td><td>".number_format($cje[0],2,'.','')."</td><td>";
echo number_format($row[0]+$rje[0]-$cje[0],2,'.','');
echo "</td></tr>\n";

echo "</table>\n";
echo "<hr /><input type='button' value='关闭窗口' onclick='returnValue=1;window.close();' />\n";

include_once '../../footer.php';
?>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -