21,893
社区成员
发帖
与我相关
我的任务
分享
<?php
/**
*2015-08-06
*点餐系统
*/
FLEA::loadClass('TMIS_Controller');
class Controller_Renwu_diancai extends TMIS_Controller
{
////定义全局变量 $_modelExample
//var $_modelExample;
function Controller_Renwu_diancai()
{
$this->_modelExample1=& FLEA::getSingleton('Model_Renwu_caidanguanli');
$this->_modelExample2=& FLEA::getSingleton('Model_Renwu_baoxiangguanli');
}
function actiondiancai()
{
$this->authCheck('9-3');
$this->_edit($row);
}
function _edit($arr)
{
$title='菜品点选';
/* 执行数据库操作 */
/* 数据库查询语句 */
$sql="select * from renwu_caidanguanli where shoumaizhuangtai='出售'";
$class_info1=$this->_modelExample1->findBySql($sql);
$temp= $this->_modelExample1->execute($sql);
/* 显示数据 */
$smarty = & $this->_getView();
/* 后加的一句 作用不详 */
$smarty->assign('class_info1',$class_info1);
/* 显示该网页模板 */
//$smarty->display("Renwu/caidanguanli.tpl");
$title='包厢点选';
/* 执行数据库操作 */
/* 数据库查询语句 */
$sql="select * from renwu_baoxiangguanli where baoxiangzhuangtai='空闲中'";
$class_info2=$this->_modelExample2->findBySql($sql);
$temp= $this->_modelExample2->execute($sql);
/* 显示数据 */
$smarty = & $this->_getView();
/* 后加的一句 作用不详 */
$smarty->assign('class_info2',$class_info2);
/* 显示该网页模板 */
$smarty->display("Renwu/diancai.tpl");
}
function actionChange(){
//根据选择菜品
$b=0;
$sql="select caipindanjia from renwu_caidanguanli where id='{$_POST['isOver1']}'";
// dump($sql);
//$this->_modelExample->execute($sql);
$temp= $this->_modelExample1->findBySql($sql);
// dump($temp);exit;
$a=$temp[0]['caipindanjia'];
$b=$b+$a;
dump($b);exit;
//临时菜品价格表
//$sql="update renwu_baoxiangguanli set jiesuan='$a' where id='{$_POST['isOver1']}'";
//$temp= $this->_modelExample1->execute($sql);
$sql="update renwu_baoxiangguanli set baoxiangzhuangtai='使用中' where id='{$_POST['isOver2']}'";
//$this->_modelExample->execute($sql);
$temp= $this->_modelExample2->execute($sql);
//$sql="delete from renwu_caidanguanli where id='{$_POST['isDel']}'";
//$this->_modelExample->execute($sql);
//$temp= $this->_modelExample->execute($sql);
if($temp){
js_alert(null,"window.parent.showMsg('保存成功!')",$this->_url('diancai'));
}//else die('保存失败!');
}
}
?>
<html>
<head>
<tr></tr>
<form action="{url controller=$smarty.get.controller action='Change'}" method="post">
</head>
<body>
<table cellspacing=0 bordercolordark=#FFFFFF width="90%" bordercolorlight=#000000 border=1 align="center" cellpadding="2">
<tr bgcolor="#6b8ba8" style="color:FFFFFF">
<td width="10%" align="center" valign="bottom" id="id" name="id" height="19">ID</td>
<td width="20%" align="center" valign="bottom">菜品名称</td>
<td width="10%" align="center" valign="bottom">菜品编号</td>
<td width="10%" align="center" valign="bottom">菜品分类</td>
<td width="10%" align="center" valign="bottom">菜品单价</td>
<td width="10%" align="center" valign="bottom">售卖状态</td>
<td width="20%" align="center" valign="bottom">选择菜品</td>
</tr>
{foreach from=$class_info1 item='caidanguanli'}
<tr>
<td align="center" height="19">{$caidanguanli.id}</td>
<td align="center">{$caidanguanli.caipinmingcheng}</td>
<td align="center">{$caidanguanli.caipinbianhao}</td>
<td align="center">{$caidanguanli.caipinzhonglei}</td>
<td align="center">{$caidanguanli.caipindanjia}</td>
<td align="center">{$caidanguanli.shoumaizhuangtai}</td>
<td>
<input name="isOver1" type="checkbox" id="isOver1" value="{$caidanguanli.id}">点此菜品
</td>
</tr>
{/foreach}
</table>
<p>菜品一次订购,概不退换</p>
<table cellspacing=0 bordercolordark=#FFFFFF width="90%" bordercolorlight=#000000 border=1 align="center" cellpadding="2">
<tr bgcolor="#6b8ba8" style="color:FFFFFF">
<td width="10%" align="center" valign="bottom" height="19">ID</td>
<td width="20%" align="center" valign="bottom">包厢类型</td>
<td width="10%" align="center" valign="bottom">包厢大小</td>
<td width="10%" align="center" valign="bottom">包厢状态</td>
<td width="20%" align="center" valign="bottom">包厢选择</td>
</tr>
{foreach from=$class_info2 item='baoxiangguanli'}
<tr>
<td align="center" height="19">{$baoxiangguanli.id}</td>
<td align="center">{$baoxiangguanli.baoxiangleixing}</td>
<td align="center">{$baoxiangguanli.baoxiangdaxiao}</td>
<td align="center">{$baoxiangguanli.baoxiangzhuangtai}</td>
<td>
<input name="isOver2" type="checkbox" id="isOver2" value="{$baoxiangguanli.id}">订此包厢
</td>
</tr>
{/foreach}
</table>
<input type="submit" id="submit" name="submit" align="center" value='提交订单'>
<br />
</form>
</body>
</html>