コンビニレジ

バーコード入力

$val) { $sql = "select * from sales where pid=" . $key; $cnt = php_query($sql); foreach ($cnt as $record) { $count++; } $sql = "select * from product where pid=" . $key; $row = php_query($sql); foreach ($row as $record => $res) { $stock = $res['pstock']; } $c_stock = $stock - $count - $val; if ($c_stock >= 0) { } else { echo "" . $res['pname'] . "は在庫が不足しているため購入できませんでした。
"; $_SESSION['sum']-= $res['pprice']; if (isset($_SESSION['fail'])) { array_push($_SESSION['fail'], $res['pid']); } else { $_SESSION['fail'][0] = $res['pid']; } } } echo "

合計金額は" . $_SESSION['sum'] . "円です。

"; echo "

精算が完了しました。

"; if (isset($_SESSION['fail'])) { foreach ($_SESSION['pid'] as $val) { if (in_array($val, $_SESSION['fail'])) { } else { $sql = "insert into sales values(" . $val . ",'" . 1 . "','" . $gen . "','" . $old . "','" . $time . "')"; echo $sql; //php_query($sql); } } } else { foreach ($_SESSION['pid'] as $val) { $sql = "insert into sales values(" . $val . ",'" . 1 . "','" . $gen . "','" . $old . "','" . $time . "')"; php_query($sql); } } $sql = "select * from product where pid='none'"; $_POST['flag'] = 0; unset($_SESSION['pid']); } } } if ($sid != "") { $sql = 'select * from product where pid=' . $_POST['sid']; } $result = php_query($sql); if ($ac_flag == 1) { echo ""; echo ""; foreach ($result as $record => $row) { if (isset($_SESSION['His'])) { if (array_key_exists($row['pid'], $_SESSION['arr'])) { ++$_SESSION['arr'][$row['pid']]; } else { $_SESSION['arr']+= array($row['pid'] => 1); } $_SESSION['sum']+= $row['pprice']; $num = $_SESSION['sum']; $_SESSION['His'].= ""; array_push($_SESSION['pid'], $row['pid']); } else { $_SESSION['arr'] = array($row['pid'] => 1); $_SESSION['sum'] = $row['pprice']; $num = $_SESSION['sum']; $_SESSION['His'] = ""; $_SESSION['pid'][0] = $row['pid']; } } $ac_flag = 1; } if (isset($_SESSION['His'])) { echo $_SESSION['His']; } echo "
商品名単価合計金額
" . $row['pname'] . "" . $row['pprice'] . "" . $num . "
" . $row['pname'] . "" . $row['pprice'] . "" . $num . "
"; ?>

客層入力(必須)
~12 ~12
13~19 13~19
20~29 20~29
30~49 30~49
50~ 50~