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

📄 mana_accs.php

📁 自己实现一个实用的商店应用系统
💻 PHP
📖 第 1 页 / 共 3 页
字号:
<?php
////////////////////////////////////////////////////////
// Author by Shuweich
// Date : 2007.07.27
// 2007.11.16 完成了前端界面的开发
// 2007.12.12 完善了前端界面并做了BUG修补
// 建站支持: http://www.shuweich.net
// 作者: Shuweich
// QQ: 1502384
// ICQ: 190492112
// MSN: shuweich@hotmail.com
// E-mail: root@shuweich.net
// E-mail: shuweich@163.com
////////////////////////////////////////////////////////
// For 营业界面
// 2008.02.22 最后的小模式数组简版
// 2008.02.23 启用Ajax异步读取单品资料
// 涉及文件:
// mana_accs.php(主运行模块),
// inc_prod_arr.php(生成数组),
// inc_get_prod_arr.php(Url for Ajax)
////////////////////////////////////////////////////////
// 考虑增面HTML头尾结构
// 为跨店积分增加s_id1 发卡专卖店
$title='日常营业';
$_MOD_No=-1;
include_once '../../mainfile.php';
include_once 'head_acc.php';
include_once 'head_inc.php';

// include_once '../../header.php';
if ( $_REQUEST['tag_ins_up'] == '1' ) {
	 /*
	echo "这里是调试窗口之数据资料窗:<hr /><br />\n";
  echo "<pre>";
  print_r($_REQUEST);
  echo "</pre>";
  echo "<hr /><br />\n";
	 */
  		## 取本店最大流水 + 1(代码待改进)  !!!!!
  $que = "select sdbh ";
  $que.= " from ".$xoopsDB->prefix("market_mdseri");
  $que.= " where store_id='".$_REQUEST['s_id0']."' order by sdbh desc limit 0,1";
  $res = $xoopsDB->query($que);
  $row = $xoopsDB->fetchrow($res);
  $sdbh0 = $row[0] + 1;
  ## echo "<hr />$que<hr />\n";
  		## 取本店最大流水 + 1  !!!!!
  $ins_for = $_REQUEST['sum_sl0'] + 0;
  $ins = "insert into ".$xoopsDB->prefix("market_mdseri");
  $ins .=" (bh,store_id,sdbh,bdxh,date_q,date_h,user_card,user_disc,sp_barcode,sp_code,xssl,sj,spzkj,zkl,zke,mle,tach,rz_user_id,shbz,zy) values ";
  $mle0 = 0;
  $Squ = "select bybz from ".$xoopsDB->prefix("market_store")." where store_id='".$_REQUEST['s_id0']."' limit 0,1";
  $ssp0 = $xoopsDB->fetchrow( $xoopsDB->query($Squ) );
  $S_ID = substr($ssp0[0],23,1)=='7'?'696':$_REQUEST['s_id0'];
  for ( $i = 1; $i <= $ins_for; $i++ ) {
    $is_real_prod =  "select sp_code from ".$xoopsDB->prefix("market_spinfo");
    $is_real_prod .= " where sp_code='".$_REQUEST['sp_code0_'.$i]."' and store_id='$S_ID'";
    $is_real = $xoopsDB->getRowsNum( $xoopsDB->query($is_real_prod) );
    if ( $is_real == 0 ) continue;
    $qcb = "select sp_cb from ".$xoopsDB->prefix("market_spinfo");
    $qcb.= " where store_id='".$S_ID."' and sp_code='".$_REQUEST['sp_code0_'.$i]."' limit 0,1";
    $sp_cb = $xoopsDB->fetchrow( $xoopsDB->query($qcb) );
    $mle0 = $_REQUEST['spzkj0_'.$i] - $sp_cb[0] * $_REQUEST['xssl0_'.$i];
    $ins .= "(0,";
    $ins .= "'".$_REQUEST['s_id0']."',";
    $ins .= $sdbh0.",";
    $ins .= $i.",";
    $ins .= "'".$_REQUEST['curr_time0']."',";
    $ins .= "now(),";
    $ins .= "'".$_REQUEST['user_card0']."',";
    $ins .= "'".$_REQUEST['user_dis0_'.$i]."',";
    $ins .= "'".$_REQUEST['spbm0_'.$i]."',";
    $ins .= "'".$_REQUEST['sp_code0_'.$i]."',";
    $ins .= "'".$_REQUEST['xssl0_'.$i]."',";
    $ins .= "'".$_REQUEST['spsj0_'.$i]."',";
    $ins .= "'".$_REQUEST['spzkj0_'.$i]."',";
    $ins .= "'".$_REQUEST['user_hdis0_'.$i]."',";
    $ins .= "'".$_REQUEST['jezk0_'.$i]."',";
    $ins .= "'".$mle0."',";
    $ins .= "'".$_REQUEST['user_tach0']."',";
    $ins .= "'".$_REQUEST['u_id0']."',";
    $ins .= "'0',";
    $ins .= "'".$_REQUEST['q_zy0']."'";		## 前台摘要/交易代码
    $ins .= "),";
  }
  $ins = substr($ins,0,-1);
  $ins00 = $xoopsDB->queryF($ins);
  unset($ins);
  ## 积分&来访次数
  $upd  = "update ".$xoopsDB->prefix("market_member");
  if ( $_REQUEST['q_zy0'] == 'mdhg' ) {
    $que  = "select jfxs,hgxs from ".$xoopsDB->prefix("market_store")." where store_id='".$_REQUEST['s_id0']."'";
    $xs = $xoopsDB->fetchArray( $xoopsDB->query($que) );
    $kjjf = floor($_REQUEST['user_tach0'] / $xs['jfxs'] * $xs['hgxs']);		## 扣减积分
    $upd .= " set user_tach=user_tach+".$_REQUEST['user_tach0'].",user_ctach=user_ctach-".$kjjf.",user_count=user_count+1";
  } elseif ( $_REQUEST['q_zy0'] == 'mdxs' ) {
    $upd .= " set user_tach=user_tach+".$_REQUEST['user_tach0'].",user_ctach=user_ctach+".$_REQUEST['user_tach0'].",user_count=user_count+1";
  }
  $upd .= " where store_id='".$_REQUEST['s_id1']."' and user_card='".$_REQUEST['user_card0']."'";
  $upd00 = $xoopsDB->queryF($upd);
  ## echo "<hr />$ins<hr />\n";
?>
  <script language='javascript'>
  <!--
	  window.location.href='<?php echo $_SERVER['PHP_SELF']; ?>';
  // -->
  </script>
<?php
}		## 数据提交到数据库 End

## 根据`bybz`字段值定义具体语句    [2]       [3]         [4]    [5]    [6]    [7]    [8]  ## To Debug ##
$que = "select a.store_id,b.s_name,a.user_id,a.user_name,b.bybz,a.auth,b.jfxs,b.hgzk,b.hgfs ";
$que .=" from ".$xoopsDB->prefix("market_member")." a,".$xoopsDB->prefix("market_store")." b";
$que .=" where a.user_id='".$xoopsUser->getVar("uid")."' and a.store_id=b.store_id ";
$que .=" order by b.store_id";
## echo $que;
$res = $xoopsDB->query($que);
if ( $xoopsDB->getRowsNum($res) > 1 ) {
  while ( $row = $xoopsDB->fetchrow($res) ) { echo "多店管理人员"; } ## 一人管多店,提示选择具体门店登录
} elseif ( $xoopsDB->getRowsNum($res) == 1 ) {
  $row = $xoopsDB->fetchrow($res); $s_id = $row[0]; $s_nm = $row[1]; $u_id = $row[2]; $u_nm = $row[3];
} elseif ( $xoopsDB->getRowsNum($res) == 0 ) {
  $s_id = '696'; $s_nm = '未定义的机构或公共操作空间'; $u_id = $xoopsUser->getVar('uid'); $u_nm = $xoopsUser->getVar('name');
} else {
  echo "数据选择错误,请联系管理员。";
}
## 分析标志位,定义界面方案 row[4] ## 登录人员权限 row[5]
/******************************************************************************************
 * 0  _OLK: 前台批量领卡级别	* 1  _OLR: 前台录入商品级别
 * 2  _OCX: 前台查询级别	* 3  _OCZ: 前台冲正级别
 * 4  _OTJ: 前台统计级别	* 5  _OGZ: 前台轧帐级别
 * 6  _ODZ: 前台打折级别	* 7  _OSJ: 前台调售价级别
 * 8  _OFK: 前台发卡级别	* 9  _STH: 前台发卡允许挑号
 * 10 _SZK: 会员卡执行折扣	* 11 _SJF: 会员卡执行积分
 * 12 _SKD: 会员卡跨店积分	* 13 _SFS: 会员卡积分方式
 * 14 _OTH: 前台退货级别	* 15 _ORJ: 前台入金级别
 * 16 _OCJ: 前台出金级别	* 17 _OPF: 前台批发级别
 * 18 _OTG: 前台团购级别	* 19 _OSH: 前台收货级别
 * 20 _OKC: 前台库存调整	* 21 _OPD: 录入盘点数据
 * 22 _OGC: 打印盘点差异	* 23 _SSP: 读取商品信息
 * 24 _OCL: 查看商品库存	* 25 _OFX: 历史数据查询
 * 26 _OHG: 前台积分换购	* 27 _MTB: 同期销售对比
 * 28 _MMD: 门店业绩查询	* 29 _MDP: 单品销量分析
 * 30 _MLS: 历史数据分析	* 31 _MSJ: 商品售价变更
 * 32 _MCX: 商品促销变价	* 33 _MCB: 商品成本调整
 * 34 _MSC: 上传商品信息	* 35 _MXZ: 下载商品信息
 * 36 _MMX: 单品库存明细	* 37 _MMX: 销售毛利分析
 * 38 _MMX: 现金日记总帐	* 39
 ******************************************************************************************/
define("_OLK", $row[5]<substr($row[4], 0,1)?'disabled':''); define("_OLR", $row[5]<substr($row[4], 1,1)?'disabled':'');
define("_OCX", $row[5]<substr($row[4], 2,1)?'disabled':''); define("_OCZ", $row[5]<substr($row[4], 3,1)?'disabled':'');
define("_OTJ", $row[5]<substr($row[4], 4,1)?'disabled':''); define("_OGZ", $row[5]<substr($row[4], 5,1)?'disabled':'');
define("_ODZ", $row[5]<substr($row[4], 6,1)?'readonly':''); define("_OSJ", $row[5]<substr($row[4], 7,1)?'readonly':'');
define("_OFK", $row[5]<substr($row[4], 8,1)?'disabled':''); define("_STH", substr($row[4], 9,1));
define("_SZK", substr($row[4],10,1)); define("_SJF", substr($row[4],11,1));
define("_SKD", substr($row[4],12,1)); define("_SFS", substr($row[4],13,1));
define("_OTH", $row[5]<substr($row[4],14,1)?'disabled':''); define("_ORJ", $row[5]<substr($row[4],15,1)?'disabled':'');
define("_OCJ", $row[5]<substr($row[4],16,1)?'disabled':''); define("_OPF", $row[5]<substr($row[4],17,1)?'disabled':'');
define("_OTG", $row[5]<substr($row[4],18,1)?'disabled':''); define("_OSH", $row[5]<substr($row[4],19,1)?'disabled':'');
define("_OKC", $row[5]<substr($row[4],20,1)?'disabled':''); define("_OPD", $row[5]<substr($row[4],21,1)?'disabled':'');
define("_OGC", $row[5]<substr($row[4],22,1)?'disabled':''); define("_SSP", substr($row[4],23,1));
define("_OCL", $row[5]<substr($row[4],24,1)?'disabled':''); define("_OFX", $row[5]<substr($row[4],25,1)?'disabled':'');
define("_OHG", $row[5]<substr($row[4],26,1)?'disabled':''); define("_MTB", $row[5]<substr($row[4],27,1)?'disabled':'');
define("_MMD", $row[5]<substr($row[4],28,1)?'disabled':''); define("_MDP", $row[5]<substr($row[4],29,1)?'disabled':'');
define("_MLS", $row[5]<substr($row[4],30,1)?'disabled':''); define("_MSJ", $row[5]<substr($row[4],31,1)?'disabled':'');
define("_MCX", $row[5]<substr($row[4],32,1)?'disabled':''); define("_MCB", $row[5]<substr($row[4],33,1)?'disabled':'');
define("_MSC", $row[5]<substr($row[4],34,1)?'disabled':''); define("_MXZ", $row[5]<substr($row[4],35,1)?'disabled':'');
define("_MMX", $row[5]<substr($row[4],36,1)?'disabled':''); define("_MML", $row[5]<substr($row[4],37,1)?'disabled':''); 
define("_MXJ", $row[5]<substr($row[4],38,1)?'disabled':''); 

define("_AUTH", $row[5]);
if ( _AUTH == 0 ) define("_CAUTH", "非正式人员");
if ( _AUTH == 1 ) define("_CAUTH", "操作员");
if ( _AUTH == 2 ) define("_CAUTH", "领班");
if ( _AUTH == 3 ) define("_CAUTH", "管理员");
if ( _AUTH == 4 ) define("_CAUTH", "维护员");
if ( _AUTH == 9 ) define("_CAUTH", "超级用户");
define("_JFXS", $row[6]);
define("_HGZK", $row[7]);
define("_HGFS", $row[8]);
?>
<div style="position:absolute;color:#00ff00;background-color:#0f0f0f;height:601px;width:993px;font-size:14px;"><nobr>
<div name='seri_direct' id='seri_direct' style='position:absolute;top:63px;left:9px;height:20px;width:20px;display:block;'>
<input type='button' value='↑'   title='水单总在最上' id='BA01' name='BA01' onclick='javascript:to_up();blur();' />
<input type='button' value='↓√' title='水单依次向下' id='BA02' name='BA02' onclick='javascript:to_down();blur();' disabled />
</div>
<span style='position:absolute;left:8px;'>
<?php
echo "
<input type='button' value='入' title='钱箱入金操作' id='bst' name='BA03' onclick='javascript:qxrjcz(\"r\");blur();' "._ORJ." />
<input type='button' value='出' title='钱箱出金操作' id='bst' name='BA04' onclick='javascript:qxcjcz(\"c\");blur();' "._OCJ." />
<input type='button' value='查' title='查询当日流水' id='bst' name='BA05' onclick='javascript:cxdrls();blur();' "._OCX." />
<input type='button' value='冲' title='当日错帐冲正' id='bst' name='BA06' onclick='javascript:drczcz();blur();' "._OCZ." />
<input type='button' value='统' title='统计销售情况' id='bst' name='BA07' onclick='javascript:tjxsqk();blur();' "._OTJ." />
<input type='button' value='轧' title='轧差本日帐务' id='bst' name='BA08' onclick='javascript:gcbrzw();blur();' "._OGZ." />
<input type='button' value='卡' title='办理新会员卡' id='bst' name='BA09' onclick='javascript:blxhyk();blur();' "._OFK." />
<input type='button' value='录' title='录入商品资料' id='bst' name='BA10' onclick='javascript:lrspzl();blur();' "._OLR." />
<input type='button' value='品' title='显示商品信息' id='bst' name='BA11' onclick='javascript:xsspxx();blur();' "._SSP." />
<input type='button' value='备' title='备忘录/日程提醒' id='bst' name='BA12' onclick='javascript:alert(\"等我啊,还没做呢:)\");return;bwl();blur();' />
<input type='button' value='算' title='表达式计算器' id='bst' name='BA13' onclick='javascript:bdsjsq();blur();' />
</span>
<span style='position:absolute;top:92px;left:8px;'>
<input type='button' value='领' title='前台批量领卡' id='bst' name='BA14' onclick='javascript:qtpllk();blur();' "._OLK." />
<input type='button' value='退' title='顾客退、换货' id='bst' name='BA15' onclick='javascript:alert(\"等我啊,还没做呢:)\");blur();' "._OTH." />
<input type='button' value='收' title='前台收货入库' id='bst' name='BA16' onclick='javascript:qtshrk();blur();' "._OSH." />
<input type='button' value='批' title='隶属门店批发' id='bst' name='BA17' onclick='javascript:lsmdpf();this.blur();' "._OPF." />
<input type='button' value='团' title='单位团体购买' id='bst' name='BA18' onclick='javascript:dwttgm();blur();' "._OTG." />
<input type='button' value='分' title='会员积分换购' id='bst' name='BA19' onclick='javascript:hyjfhg();blur();' "._OHG." />
<input type='button' value='库' title='商品库存变更' id='bst' name='BA20' onclick='javascript:spkcbg();blur();' "._OKC." />
<input type='button' value='盘' title='录入盘点数据' id='bst' name='BA21' onclick='javascript:lrpdsj();blur();' "._OPD." />
<input type='button' value='点' title='打印盘点差异' id='bst' name='BA22' onclick='javascript:dypdcy();blur();' "._OGC." />
<input type='button' value='存' title='查看商品库存' id='bst' name='BA23' onclick='javascript:ckspkc();blur();' "._OCL." />
<input type='button' value='历' title='历史数据查询' id='bst' name='BA24' onclick='javascript:fxlssj();blur();' "._OFX." />
</span>
";
echo "<form method='post' action='".$_SERVER['PHP_SELF']."' name='seri_prc' id='seri_prc'>\n";

if ( !$ins00 && isset($ins00) ) {
  echo "<span style='position:absolute;top:199px;left:346px;width:240px;height:80px;color:#f00;background-color:#000;border:1px solid #008000;'><br />&nbsp;数据添加出错!";
  echo "<br />&nbsp;请速与管理员联系!<hr /><center><input type='button' value='退回上页' onclick='javascript:window.history.go(-1);' />&nbsp;&nbsp;<input type='button' value='重新记帐!' onclick='javascript:window.location.reload();' /></center><br /></span>\n";
}
$d_s = $s_nm.";"._CAUTH.":".$u_nm;
echo "<span style='position:absolute;top:38px;left:9px;'>";
echo "<input style='border:none;color:#0f0;background-color:#0f0f0f;font-size:16px;' name='md0' id='md0' type='text' ";
echo " size='".strlen($d_s)."' value='".$d_s."' readonly /><br />\n";
echo "<input type='hidden' id='s_id0' name='s_id0' value='".$s_id."' />";		## 门店编号
echo "<input type='hidden' id='u_id0' name='u_id0' value='".$u_id."' />";		## 用户系统编号
echo "<input type='hidden' id='s_id1' name='s_id1' value='' />";			## 会员发卡门店号
echo "<input type='hidden' id='q_zy0' name='q_zy0' value='mdxs' />";			## 前台摘要/交易代码
echo "</span>";
?>
<span style='position:absolute;top:6px;left:773px;overflow:hidden;border:1px solid #008000;height:103px;'><pre>
 专卖店销售管理模块(Ver 0.01)
 Author : shuweich
 E-mail : shuweich@163.com,
          root@shuweich.net
 Date   : 2007.11.05 &copy;
CopyLeft(2007-2009:OpenSource)
</pre></span>

<div name='q_pf' id='q_pf' style='position:absolute;top:6px;left:773px;border:1px solid #008000;height:103px;width:210px;font-size:32px;background-color:#aaa;color:#f00;display:none;'>
<br /><center>批&nbsp;&nbsp;发</center></div>
<div name='q_tg' id='q_tg' style='position:absolute;top:6px;left:773px;border:1px solid #008000;height:103px;width:210px;font-size:32px;background-color:#aaa;color:#f00;display:none;'>
<br /><center>团&nbsp;&nbsp;购</center></div>
<div name='q_hg' id='q_hg' style='position:absolute;top:6px;left:773px;border:1px solid #008000;height:103px;width:210px;font-size:22px;background-color:#aaa;color:#f00;display:none;'>
<br /><br /><center>会&nbsp;员&nbsp;积&nbsp;分&nbsp;换&nbsp;购</center></div>

<div name='show_meminfo' id='show_meminfo' style='position:absolute;left:772px;top:6px;width:215px;height:108px;overflow:hidden;background-color:#8a8a8a;color:#003300;font-size:12px;border : 3px outset #109010;display:none;'>
</div>
<center>
<span style='font-size:20px;'>日 常 业 务 窗 口<br />
=======================</span>

⌨️ 快捷键说明

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