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

📄 acc_lrspzl.php

📁 自己实现一个实用的商店应用系统
💻 PHP
字号:
<?php
////////////////////////////////////////////////////////
// Author by Shuweich
// Date : 2007.07.27
// 2007.11.16 完成了前端界面的开发
// 建站支持: http://www.shuweich.net
// 作者: Shuweich
// QQ: 1502384
// ICQ: 190492112
// MSN: shuweich@hotmail.com
// E-mail: root@shuweich.net
// E-mail: shuweich@163.com
////////////////////////////////////////////////////////
// 模块管理 by lssppxb
// For 录入新商品资料
////////////////////////////////////////////////////////
// 考虑增面HTML头尾结构
// 为跨店积分增加s_id1 发卡专卖店
$title='录入新商品资料';
include_once '../../mainfile.php';
include_once 'head_acc.php';
include_once 'head_inc.php';

$CODE_LEN = 12 - strlen($_Hcod);
if ( $_REQUEST['spzl_ins_up'] == '1' ) {
	 /*
	echo "这里是调试窗口之数据资料窗:<hr /><br />\n";
  echo "<pre>";
  print_r($_REQUEST);
  echo "</pre>";
  echo "<hr /><br />\n";
	 */
  $ins_for = $_REQUEST['sum_sl0'] + 0;
  $ins = "insert into ".$xoopsDB->prefix("market_spinfo");
  $ins .=" (sp_id,store_id,sp_date,sp_code,sp_name,sp_barcode,";
  $ins .="sp_cb,sp_fjcb,sp_sj,sp_bz,sp_jz,sp_bzdw,sp_sh,lr_user_id) values ";

  ## 使一并处理(添加)单品库存及单品库存明细二数据表 Modify by Shuweich (2008-02-12)
  $ins_kc = "insert into ".$xoopsDB->prefix("market_spkc");
  $ins_kc .=" (sp_id,store_id,sp_code,sp_barcode,sp_date,sp_kc,rz_user_id) values ";
  $ins_kcmx = "insert into ".$xoopsDB->prefix("market_spkcmx");
  $ins_kcmx .=" (sp_id,store_id,sp_code,sp_barcode,sp_date,jf,df,sp_kc,rz_user_id) values ";
  $S_ID = $_REQUEST['s_id0'];
  for ( $i = 1; $i <= $ins_for; $i++ ) {
    $que  = "select sp_code from ".$xoopsDB->prefix("market_spinfo");
    $que .= " where store_id='".$S_ID."' and sp_code='".$_REQUEST['sp_code0_'.$i]."'";
    $codeNums = $xoopsDB->getRowsNum( $xoopsDB->query($que) );
    if ( $codeNums >= 1 ) continue;
    $ins .= "(0,";
    $ins .= "'".$_REQUEST['s_id0']."',";
    $ins .= "'".$_REQUEST['curr_time0']."',";
    $ins .= "'".$_REQUEST['sp_code0_'.$i]."',";
    $ins .= "'".$_REQUEST['sp_name0_'.$i]."',";
    $ins .= "'".$_REQUEST['sp_barcode0_'.$i]."',";
    $ins .= "'".$_REQUEST['sp_jhj0_'.$i]."',";
    $ins .= "'".$_REQUEST['sp_fjf0_'.$i]."',";
    $ins .= "'".$_REQUEST['sp_lsj0_'.$i]."',";
    $ins .= "'".$_REQUEST['sp_oth0_'.$i]."',";
    $ins .= "'".$_REQUEST['sp_jz0_'.$i]."',";
    $ins .= "'".$_REQUEST['sp_bzdw0_'.$i]."',";
    $ins .= "'1',";
    $ins .= "'".$_REQUEST['u_id0']."'";
    $ins .= "),";
    $ins_kc .= "(0,'".$_REQUEST['s_id0']."','".$_REQUEST['sp_code0_'.$i]."','".$_REQUEST['sp_barcode0_'.$i]."',";
    $ins_kc .= "'".$_REQUEST['curr_time0']."',0,'".$_REQUEST['u_id0']."'),";
    $ins_kcmx .= "(0,'".$_REQUEST['s_id0']."','".$_REQUEST['sp_code0_'.$i]."','".$_REQUEST['sp_barcode0_'.$i]."',";
    $ins_kcmx .= "'".$_REQUEST['curr_time0']."',0,0,0,'".$_REQUEST['u_id0']."'),";
  }
  $ins = substr($ins,0,-1);
  $ins_kc = substr($ins_kc,0,-1);
  $ins_kcmx = substr($ins_kcmx,0,-1);
  $ins00 = $xoopsDB->queryF($ins);
  $ins_kc00 = $xoopsDB->queryF($ins_kc);
  $ins_kcmx00 = $xoopsDB->queryF($ins_kcmx);
  unset($ins);
  unset($ins_kc);
  unset($ins_kcmx);
?>
  <script language='javascript'>
  <!--
	  // window.location.href='<?php echo $_SERVER['PHP_SELF'].'?s_id0='.$_REQUEST['s_id0']; ?>';
  // -->
  </script>
<?php
}		## 数据提交到数据库 End

## 根据`bybz`字段值定义具体语句    [2]       [3]         [4]    [5]    [6] ## To Debug ##
$que = "select a.store_id,b.s_name,a.user_id,a.user_name,b.bybz,a.auth,b.jfxs ";
$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";
$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 "数据选择错误,请联系管理员。";
}
?>
<div style="position:absolute;color:#00ff00;background-color:#0f0f0f;height:638px;width:839px;font-size:14px;"><nobr>
<span style='position:absolute;left:8px;'>
<?php
echo "
<input type='button' value='↑'   title='水单总在最上' name='BA01' onclick='javascript:to_up();blur();' />
<input type='button' value='↓√' title='水单依次向下' name='BA02' onclick='javascript:to_down();blur();' disabled />
</span>
";
echo "<form method='post' action='".$_SERVER['PHP_SELF']."?s_id0=".$_REQUEST['s_id0']."' name='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.":".$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 "</span>";
?>

<center><span style='font-size:20px;'>新 商 品 资 料 录 入 窗 口<br />
===================================<br />
<input style='border:none;color:#0f0;background-color:#0f0f0f;' type='text' value='' name='curr_time0' id='curr_time0' size='19' readonly /></span></center>
<span style='position:absolute;top:76px;left:0px;font-size:16px;'>
<input style='font-size:16px;border:none;color:#0f0;background-color:#0f0f0f;' type='text' size='5' value='序号↓' name='spxh' id='spxh' />
唯一店内码&nbsp;&nbsp;&nbsp;
商品名称&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
商品条码&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
进货价&nbsp;&nbsp;&nbsp;附加费&nbsp;&nbsp;零售价&nbsp;&nbsp;&nbsp;净含量g&nbsp;包装&nbsp;&nbsp;&nbsp;
备注
</span><br /><br />
      <input type='hidden' size='1' value='1' id='spzl_ins_up' name='spzl_ins_up' />
      <?php
      $i=1;
      $bzdw_opt = '';
      for ( $bi = 0;$bi < count($_BZDW); $bi++ ) {
        $bzdw_opt .= "<option value='".$_BZDW[$bi]."'>".$_BZDW[$bi]."</option>";
      }
      echo "\n<input style='border:1px 2px 0px;color:#0f0;background-color:#0f0f0f;' type='text' value='№ $i' size='6' id='xh_$i' name='xh_1' readonly />\n";

      echo "<input class='inst' type='text' value='' id='sp_code0_$i' name='sp_code0_$i' size='13' maxlength='5' autocomplete='off' onkeyup='javascript:if ( this.value.length == ".$CODE_LEN." ) { chk_inc($i,this.value); }' />\n";

      echo " &nbsp;<input class='inst' type='text' value='' id='sp_name0_$i' name='sp_name0_$i' size='19' maxlength='37' />\n";

      echo " &nbsp;<input class='inst' type='text' value='6907305' id='sp_barcode0_$i' name='sp_barcode0_$i' size='13' maxlength='13' autocomplete='off' onkeyup='javascript:if ( this.value.length == 13 ) { chk_code($i,this.value); }' />\n";

      echo " &nbsp;<input class='inst' type='text' value='' id='sp_jhj0_$i' name='sp_jhj0_$i' size='7' maxlength='7' />\n";

      echo " &nbsp;<input class='inst' type='text' value='' id='sp_fjf0_$i' name='sp_fjf0_$i' size='7' maxlength='7' />\n";

      echo " &nbsp;<input class='inst' type='text' value='' id='sp_lsj0_$i' name='sp_lsj0_$i' size='7' maxlength='7' />\n";

      echo " &nbsp;<input class='inst' type='text' value='' id='sp_jz0_$i' name='sp_jz0_$i' size='5' maxlength='5' />\n";

      echo " &nbsp;<select class='depo' name='sp_bzdw0_$i' id='sp_bzdw0_$i' size='1'>\n";
      echo $bzdw_opt;
      echo "</select>\n";

      echo " &nbsp;<input class='inst' type='text' value='' id='sp_oth0_$i' name='sp_oth0_$i' size='19' maxlength='29' />\n";
      echo "<br />\n";
      ?>
    <input type='hidden' size='1' value='1' id='spzl_ins_down' name='spzl_ins_down' />
    <hr width='939' align='left' />

    &nbsp;&nbsp;&nbsp;
    <input type='button' value='取消' onclick='javascript:window.location.href="<?php echo $_SERVER['PHP_SELF'].'?s_id0='.$_REQUEST['s_id0']; ?>";' />&nbsp;&nbsp;
    <input type='submit' value='确认录入' />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
小提示:唯一店内码须输入后<?php echo $CODE_LEN; ?>位&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;∑&nbsp;<input style='border:none;color:#0f0;background-color:#0f0f0f;' type='text' value='0' size='3' name='sum_sl0' id='sum_sl0' />条商品记录
    <input value='<?php echo _SKD; ?>' type='hidden' name='user_kdjf0' id='user_kdjf0' />
  </form>
</nobr></div>
<script language='javascript'>
<!--

  document.bgColor = '0f0f0f';
  function rclick() {
    if (event.button==2) {
      alert('技术支持电话:15827003355');
    }
  }
  document.onmousedown=rclick;


  var s_obj=null;
  var jv_c_len = '<?php echo $CODE_LEN; ?>';
  jv_c_len = Number(jv_c_len);
  var hs=1;
  var ins_line='';
  var add_obj='spzl_ins_down';
  var loc_obj='beforeBegin';
  function to_up() {
    add_obj='spzl_ins_up';
    loc_obj='afterEnd';
    document.getElementById('BA01').value='↑√';
    document.getElementById('BA02').value='↓';
    document.getElementById('BA01').blur();
    document.getElementById('spxh').value='序号 ↑';
    document.getElementById('BA01').disabled=true;
    document.getElementById('BA02').disabled=false;
  }

  function to_down() {
    add_obj='spzl_ins_down';
    loc_obj='beforeBegin';
    document.getElementById('BA01').value='↑';
    document.getElementById('BA02').value='↓√';
    document.getElementById('BA02').blur();
    document.getElementById('spxh').value='序号 ↓';
    document.getElementById('BA01').disabled=false;
    document.getElementById('BA02').disabled=true;
  }

  function add_line(fx,hhs) {
    var obj=document.getElementById(add_obj);
    hs0=hs-1;
    if ( hs == hhs ) {
      document.getElementById('sum_sl0').value=hs;
      hs++;
      ins_line  = "<input style='border:none;color:#0f0;background-color:#0f0f0f;' type='text' size='6' id='xh_"+hs+"' name='xh_"+hs+"' value='№ "+hs+"' readonly /> ";

      ins_line += "<input class='inst' type='text' value='' id='sp_code0_"+hs+"' name='sp_code0_"+hs+"' size='13' maxlength='5' autocomplete='off' onkeyup='javascript:if ( this.value.length == "+jv_c_len+" ) { chk_inc("+hs+",this.value); }' />\n";

      ins_line += " &nbsp;<input class='inst' type='text' value='' id='sp_name0_"+hs+"' name='sp_name0_"+hs+"' size='19' maxlength='37' />\n";

      ins_line += " &nbsp;<input class='inst' type='text' value='6907305' id='sp_barcode0_"+hs+"' name='sp_barcode0_"+hs+"' size='13' maxlength='13' autocomplete='off' onkeyup='javascript:if ( this.value.length == 13 ) { chk_code("+hs+",this.value); }' />\n";

      ins_line += " &nbsp;<input class='inst' type='text' value='' id='sp_jhj0_"+hs+"' name='sp_jhj0_"+hs+"' size='7' maxlength='7' />\n";

      ins_line += " &nbsp;<input class='inst' type='text' value='' id='sp_fjf0_"+hs+"' name='sp_fjf0_"+hs+"' size='7' maxlength='7' />\n";

      ins_line += " &nbsp;<input class='inst' type='text' value='' id='sp_lsj0_"+hs+"' name='sp_lsj0_"+hs+"' size='7' maxlength='7' />\n";

      ins_line += " &nbsp;<input class='inst' type='text' value='' id='sp_jz0_"+hs+"' name='sp_jz0_"+hs+"' size='5' maxlength='5' />\n";

      ins_line += " &nbsp;<select class='depo' name='sp_bzdw0_"+hs+"' id='sp_bzdw0_"+hs+"' size='1'>\n";
      ins_line += "<?php echo $bzdw_opt; ?>";
      ins_line += "</select>\n";

      ins_line += " &nbsp;<input class='inst' type='text' value='' id='sp_oth0_"+hs+"' name='sp_oth0_"+hs+"' size='19' maxlength='29' />\n";

      ins_line+="<br />\n";
      obj.insertAdjacentHTML(loc_obj,ins_line);
    }
  }

  var clocktext;
  function scroll() {
    today = new Date();
    yy = today.getYear(); mm = today.getMonth() + 1; dd = today.getDate();
    hh = today.getHours(); mi = today.getMinutes(); ss = today.getSeconds();
    if (mm <= 9) mm = "0" + mm; if (dd <= 9) dd = "0" + dd;
    if (hh <= 9) hh = "0" + hh; if (mi <= 9) mi = "0" + mi; if (ss <= 9) ss = "0" + ss;
    var clocktext = yy + "-" + mm + "-" + dd + " " + hh + ":" + mi + ":" + ss;
    clocktimer = setTimeout("scroll()",1000);
    document.getElementById("curr_time0").value = clocktext;
  }
  // if (document.all) scroll();
  scroll();

  // 左上角按钮处理

  var jv_s_id0 = document.getElementById('s_id0').value;
  var jv_curr_time0 = document.getElementById('curr_time0').value;

  function chk_inc(the_line,sp_code) {
    var a=1; var lbc=0; var rbc=0;
    document.getElementById('sp_code0_'+the_line).value='<?php echo $_Hcod; ?>'+sp_code;
    add_line('down',the_line);
    document.getElementById('sp_name0_'+the_line).select();
    document.getElementById('sp_name0_'+the_line).focus();
  }

  function chk_code(the_line,sp_barcode) {
    var a=1; var lbc=0; var rbc=0;
    for ( var i=0; i<12; i++ ) {
      if ( i % 2 == 0 ) { rbc += Number(String(sp_barcode).substring(i,i+1)); } 
      else { lbc += Number(String(sp_barcode).substring(i,i+1)); }
    }
    var sbc = lbc * 3 + rbc;
    var bc13 = 10 - (sbc % 10)==10?0:10 - (sbc % 10);
    if ( String(sp_barcode).substring(12,13) != String(bc13) ) {
      alert("小提示:\n请检查此商品条码是否正确("+bc13+")。");return false;
      document.getElementById('sp_barcode0_'+the_line).value='6907305';
      document.getElementById('sp_barcode0_'+the_line).select();
      document.getElementById('sp_barcode0_'+the_line).focus();
    } else {
      document.getElementById('sp_jhj0_'+the_line).select();
      document.getElementById('sp_jhj0_'+the_line).focus();
    }
  }

//-->
</script>
<?php
include_once '../../footer.php';
?>

⌨️ 快捷键说明

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