📄 acc_fxlssj.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';
if ( isset($_REQUEST['hist_data']) && $_REQUEST['hist_data'] == '1' ) { ## 销售情况显示 Begin
$que = "select count(*) from ".$xoopsDB->prefix("market_mdseri_history")." where store_id='".$_REQUEST['s_id0']."' and shbz!='2' and zy in (".$_TKjy.") and substring(date_h,1,16)='".$_REQUEST['sj_date']."' group by sdbh";
$res = $xoopsDB->query($que);
$kll = $xoopsDB->getRowsNum($res);
echo "<form action='".$_SERVER['PHP_SELF']."' method='post' name='zxlsls'>\n";
echo "<input type='hidden' name='s_id0' id='s_id0' value='".$_REQUEST['s_id0']."' />\n";
echo "<input type='hidden' name='hist_d' id='hist_d' value='".$_REQUEST['sj_date']."' />\n";
echo "<input type='hidden' name='hist_lsz' id='hist_lsz' value='1' />\n";
echo "</form>\n";
echo "<br /><center>".$_REQUEST['sj_date']."日商品出货统计[<font style='font-size:18px;color:#F00;'>";
echo "<input type='button' name='B01' value='查看历史流水帐' ";
echo "onclick='javascript:document.getElementById(\"zxlsls\").submit();' />";
echo "</font>]\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_history")." 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.") and substring(date_h,1,16)='".$_REQUEST['sj_date']."' 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_history");
$que.= " where store_id='".$_REQUEST['s_id0']."' and shbz!='2' and zy in (".$_TKjy.") and substring(date_h,1,16)='".$_REQUEST['sj_date']."'";
$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_history")." where store_id='".$_REQUEST['s_id0']."' and shbz!='2' and zy in (".$_TRjy.") and substring(date_h,1,16)='".$_REQUEST['sj_date']."'";
$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_history")." where store_id='".$_REQUEST['s_id0']."' and shbz!='2' and zy in (".$_TPjy.") and substring(date_h,1,16)='".$_REQUEST['sj_date']."' 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_history")." where store_id='".$_REQUEST['s_id0']."' and shbz!='2' and zy in (".$_TTjy.") and substring(date_h,1,16)='".$_REQUEST['sj_date']."' 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_history")." where store_id='".$_REQUEST['s_id0']."' and shbz!='2' and zy in (".$_THjy.") and substring(date_h,1,16)='".$_REQUEST['sj_date']."' 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'>本 店 会 员 消 费 信 息</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_history");
$que.= " where store_id='".$_REQUEST['s_id0']."' and tach>0 and shbz!='2' and substring(date_h,1,16)='".$_REQUEST['sj_date']."' 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'>钱 箱 信 息</td></tr>\n";
echo "<tr><th>入金</th><th>出金</th><th>余款</th></tr>\n";
$que = "select sum(spzkj) rj from ";
$que .= $xoopsDB->prefix("market_mdseri_history")." where store_id='".$_REQUEST['s_id0']."' and shbz!='2' and zy='mdrj' and substring(date_h,1,16)='".$_REQUEST['sj_date']."'";
$rje = $xoopsDB->fetchrow( $xoopsDB->query($que) );
$que = "select sum(spzkj) cj from ";
$que .= $xoopsDB->prefix("market_mdseri_history")." where store_id='".$_REQUEST['s_id0']."' and shbz!='2' and zy='mdcj' and substring(date_h,1,16)='".$_REQUEST['sj_date']."'";
$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";
} ## 销售情况显示 End
if ( isset($_REQUEST['hist_lsz']) && $_REQUEST['hist_lsz'] == '1' ) { ## 流水帐显示 Begin
$que = "select sdbh,date_q,user_disc,user_card,sum(spzkj) jexj,rz_user_id,store_id,zy,shbz ";
$que.= " from ".$xoopsDB->prefix("market_mdseri_history");
$que.= " where store_id='".$_REQUEST['s_id0']."' and substring(date_h,1,16)='".$_REQUEST['hist_d']."' group by sdbh order by sdbh";
$res = $xoopsDB->query($que);
echo "<br /><center>[".$_REQUEST['hist_d']."]流水帐\n";
## 显示主流水
echo "<table border='1'>\n";
echo "<tr class='v'><th>№</th><th>时间</th><th>会员折</th><th>卡号/店号</th><th>金额</th><th>操作员</th></tr>\n";
$kll = $xoopsDB->getRowsNum($res);
$rec_End=0;
while ( $row = $xoopsDB->fetchrow($res) ) {
if ( $row[8] == '2' ) { $d_r=" style='color:#f00;' "; $d_w="已冲"; }
else { $d_r=''; $d_w=""; }
$rec_End=$row[0];
$_Nf = $_ZY[$row[7]];
if ( $row[7] == 'mdxs' ) { $_Nf = $row[2]."%"; }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -