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

📄 acc_cxdrls.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_inc.php';

include_once 'head_win.php';
## 使可以显示已冲正流水帐(2008-02-12) Modify by Shuweich
## $que = "select sdbh,date_q,user_disc,user_card,sum(spzkj) jexj,rz_user_id,store_id,zy ";
$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");
## $que.= " where store_id='".$_REQUEST['s_id0']."' and shbz!='2' group by sdbh order by sdbh";
$que.= " where store_id='".$_REQUEST['s_id0']."' group by sdbh order by sdbh";
$res = $xoopsDB->query($que);
echo "<br /><center>本日流水帐\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]."%"; }
  echo "<tr style='background-color:#ccf;' onclick='javascript:document.getElementById(\"mx_".$row[0]."\").style.display==\"block\"?document.getElementById(\"mx_".$row[0]."\").style.display=\"none\":document.getElementById(\"mx_".$row[0]."\").style.display=\"block\";'>";
  echo "<td class='e'".$d_r.">$row[0]</td><td class='e'".$d_r.">".substr($row[1],11)."</td>";
  echo "<td class='e'".$d_r." align='right'>$_Nf</td><td class='e'".$d_r.">$row[3]</td>";
  echo "<td class='e'".$d_r." align='right'>$row[4]</td><td class='e'".$d_r.">$row[5]".$d_w."</td></tr>\n";
  echo "<tr><td class='v' colspan='6'><table style='display:none' id='mx_".$row[0]."'>\n";
  ## 提取明细帐
  ## ******************************** DEBUG **********************************
  ## left join using (sp_code) unique left table 使之忽略右表中的重复记录
  if ( $row[7] === 'mdrj' || $row[7] === 'mdcj' ) {
    $que = "select bdxh,spzkj,oth_read ";
    $que.= " from ".$xoopsDB->prefix("market_mdseri");
    $que.= " where store_id='".$_REQUEST['s_id0']."' and sdbh=".$row[0]." order by bdxh";

    $cnt = $xoopsDB->query($que);
    echo "<tr><td class='v'>#</td><td class='v'>交易</td><td class='v'>发生额</td><td class='v'>备注/说明</td></tr>\n";
    while ( $mxz = $xoopsDB->fetchrow($cnt) ) {
      echo "<tr style='background-color:#cfd;'><td class='v'".$d_r.">$mxz[0]</td><td class='v'>$_Nf</td>";
      echo "<td class='v'".$d_r.">$mxz[1]</td><td class='v'".$d_r." align='left'>$mxz[2]</td></tr>\n";
    }
  } elseif ( $row[7] === 'kczj' || $row[7] === 'kcjs' || $row[7] === 'mdjh' ) {
    $que = "select a.bdxh,a.xssl,a.oth_read,b.sp_name,a.sj ";
    $que.= " from ".$xoopsDB->prefix("market_mdseri")." a left join ".$xoopsDB->prefix("market_spinfo")." b ";
    $que.= " using (sp_code,store_id) where a.store_id='".$_REQUEST['s_id0']."' and a.sdbh=".$row[0]." order by a.bdxh";

    $cnt = $xoopsDB->query($que);
    echo "<tr><td class='v'>#</td><td class='v'>交易</td><td class='v'>商品名称</td><td class='v'>数量</td>";
    if ( $row[7] == 'mdjh' ) echo "<td class='v'>金额</td>";
    echo "<td class='v'>备注/说明</td></tr>\n";
    while ( $mxz = $xoopsDB->fetchrow($cnt) ) {
      echo "<tr style='background-color:#cfd;'><td class='v'".$d_r.">$mxz[0]</td><td class='v'>$_Nf</td>";
      echo "<td class='v'>$mxz[3]</td><td class='v'".$d_r.">$mxz[1]</td>";
      if ( $row[7] == 'mdjh' ) echo "<td class='v'".$d_r." align='right'>$mxz[4]</td>";
      echo "<td class='v'".$d_r." align='left'>$mxz[2]</td></tr>\n";
    }
  } elseif ( $row[7] === 'mdpy' || $row[7] === 'mdpk' ) {
    $que = "select a.bdxh,a.xssl,a.oth_read,b.sp_name ";
    $que.= " from ".$xoopsDB->prefix("market_mdseri")." a left join ".$xoopsDB->prefix("market_spinfo")." b ";
    $que.= " using (sp_code,store_id) where a.store_id='".$_REQUEST['s_id0']."' and a.sdbh=".$row[0]." order by a.bdxh";

    $cnt = $xoopsDB->query($que);
    echo "<tr><td class='v'>#</td><td class='v'>交易</td><td class='v'>商品名称</td><td class='v'>发生额</td><td class='v'>备注/说明</td></tr>\n";
    while ( $mxz = $xoopsDB->fetchrow($cnt) ) {
      echo "<tr style='background-color:#cfd;'><td class='v'".$d_r.">$mxz[0]</td><td class='v'>$_Nf</td>";
      echo "<td class='v'>$mxz[3]</td><td class='v'".$d_r.">$mxz[1]</td><td class='v'".$d_r." align='left'>$mxz[2]</td></tr>\n";
    }
  } elseif ( $row[7] === 'mdtg' ) {
    $que = "select a.bdxh,b.sp_name,a.xssl,a.spzkj,a.zke,a.user_disc ";
    $que.= " from ".$xoopsDB->prefix("market_mdseri")." a left join ".$xoopsDB->prefix("market_spinfo")." b ";
    $que.= " using (sp_code,store_id) where a.store_id='".$_REQUEST['s_id0']."' and a.sdbh=".$row[0]." order by a.bdxh";
    $cnt = $xoopsDB->query($que);
    echo "<tr><td class='v'>#</td><td class='v'>品名</td><td class='v'>折扣%</td><td class='v'>数量</td><td>售价</td><td>折扣额</td></tr>\n";
    while ( $mxz = $xoopsDB->fetchrow($cnt) ) {
      echo "<tr style='background-color:#cfd;'><td class='v'".$d_r.">$mxz[0]</td><td class='v'>$mxz[1]</td>";
      echo "<td class='v'>$mxz[5]</td><td class='v' align='left'>$mxz[2]</td><td class='v'".$d_r." align='right'>$mxz[3]</td>";
      echo "<td class='v'".$d_r." align='right'>$mxz[4]</td></tr>\n";
    }
  } elseif ( $row[7] === 'mdpf' ) {
    $que = "select a.bdxh,b.sp_name,a.xssl,a.spzkj ";
    $que.= " from ".$xoopsDB->prefix("market_mdseri")." a left join ".$xoopsDB->prefix("market_spinfo")." b ";
    $que.= " using (sp_code,store_id) where a.store_id='".$_REQUEST['s_id0']."' and a.sdbh=".$row[0]." order by a.bdxh";
    $cnt = $xoopsDB->query($que);
    echo "<tr><td class='v'>#</td><td class='v'>品名</td><td class='v'>数量</td><td>合计金额</td></tr>\n";
    while ( $mxz = $xoopsDB->fetchrow($cnt) ) {
      echo "<tr style='background-color:#cfd;'><td class='v'".$d_r.">$mxz[0]</td><td class='v'>$mxz[1]</td>";
      echo "<td class='v'".$d_r." align='left'>$mxz[2]</td><td class='v'".$d_r." align='right'>$mxz[3]</td></tr>\n";
    }


  } elseif ( $row[7] === 'mdhg' ) {
    $que = "select a.bdxh,b.sp_name,a.xssl,a.spzkj,a.user_disc ";
    $que.= " from ".$xoopsDB->prefix("market_mdseri")." a left join ".$xoopsDB->prefix("market_spinfo")." b ";
    $que.= " using (sp_code,store_id) where a.store_id='".$_REQUEST['s_id0']."' and a.sdbh=".$row[0]." order by a.bdxh";
    $cnt = $xoopsDB->query($que);
    echo "<tr><td class='v'>#</td><td class='v'>品名</td><td class='v'>数量</td><td>合计金额</td><td>折上折</td></tr>\n";
    while ( $mxz = $xoopsDB->fetchrow($cnt) ) {
      echo "<tr style='background-color:#cfd;'><td class='v'".$d_r.">$mxz[0]</td><td class='v'>$mxz[1]</td>";
      echo "<td class='v'".$d_r." align='left'>$mxz[2]</td><td class='v'".$d_r." align='right'>$mxz[3]</td><td>$mxz[4]</td></tr>\n";
    }


  } elseif ( $row[7] === 'mdxs' ) {
    $que = "select a.bdxh,b.sp_name,a.xssl,a.spzkj,a.zke,a.zkl ";
    $que.= " from ".$xoopsDB->prefix("market_mdseri")." a left join ".$xoopsDB->prefix("market_spinfo")." b ";
    $que.= " using (sp_code,store_id) where a.store_id='".$_REQUEST['s_id0']."' and a.sdbh=".$row[0]." order by a.bdxh";
    $cnt = $xoopsDB->query($que);
    echo "<tr><td class='v'>#</td><td class='v'>品名</td><td class='v'>手工折</td><td class='v'>数量</td><td>售价</td><td>折扣额</td></tr>\n";
    while ( $mxz = $xoopsDB->fetchrow($cnt) ) {
      echo "<tr style='background-color:#cfd;'><td class='v'".$d_r.">$mxz[0]</td><td class='v'>$mxz[1]</td>";
      echo "<td class='v'>$mxz[5]</td><td class='v'".$d_r." align='left'>$mxz[2]</td><td class='v'".$d_r." align='right'>$mxz[3]</td>";
      echo "<td class='v' align='right'>$mxz[4]</td></tr>\n";
    }
  }
  echo "</table></tr>\n";
}
echo "</table>\n";
echo '
<script language="javascript">
<!--
function all_st(sta) {
  if ( sta == 0 ) var aact="none";
  if ( sta == 1 ) var aact="block";
  var rec_End = "'.$rec_End.'";
  rec_End = Number(rec_End);
  for ( var i = 0; i<=rec_End; i++ ) {
    if ( document.getElementById("mx_"+i) != null ) {
     document.getElementById("mx_"+i).style.display=aact;
     }
  }
}
// -->
</script>
';
echo "<input type='button' value='全部展开' onclick='javascript:all_st(1);this.blur();' />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\n";
echo "&nbsp;&nbsp;<input type='button' value='全部收起' onclick='javascript:all_st(0);this.blur();' />\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 + -