public static function getNotDeleted($code)
 {
     switch ($code) {
         case 'commodity':
             $rows = Commodity::model()->findAllByAttributes(array('is_deleted' => 0));
             break;
         case 'consumable':
             $commodity = Commodity::model()->findByPk($_GET['commodityId']);
             $rows = $commodity['name']::model()->findAllByAttributes(array('is_deleted' => 0));
             break;
         case 'category':
             $rows = Category::model()->findAllByAttributes(array('is_deleted' => 0));
             break;
     }
     $items = [];
     foreach ($rows as $r) {
         $items[] = $r['id'];
     }
     return $items;
 }
Example #2
0
echo CHtml::link('<i class="icon-trash"></i>', '#', array('class' => 'btn-warning btn buttonDesign', 'title' => 'Delete', 'submit' => array('delete', 'id' => $model->id), 'confirm' => 'Are you sure you want to delete this item?'));
echo "<br/>";
?>
</h1>

<?php 
$this->widget('ext.DetailView4Col', array('htmlOptions' => array('class' => 'table table-striped table-condensed table-hover'), 'data' => $model, 'attributes' => array('id', 'name', 'category_id', array('name' => 'location.name', 'label' => 'Location'), array('name' => 'user.name', 'label' => 'Technical Incharge'), array('name' => 'status.status', 'label' => 'Status'), array('name' => 'manufacturer.name', 'label' => 'Manufacturer'), array('name' => 'printertype.name', 'label' => 'Printer Type'), array('name' => 'managementtype.name', 'label' => 'Management Type'), 'memory', 'initial_page_counter', 'current_counter_of_pages', 'serial_number', 'documentFileName', 'imageFileName', 'enable_financial', 'available_on_loan', 'link_to')));
?>

<?php 
$link = Link::model()->findByAttributes(array('commodity2_id' => $model->commodity_id));
echo "<table class='table table-bordered'>";
if (count($link) == 0) {
    echo "<tr style='background:#F7819F;color:white'><td>No Commodity Linked to {$model->name}</td></tr>";
} else {
    $commodity = Commodity::model()->findByAttributes(array('id' => $link['commodity1_id']));
    $commodityItems = $commodity['name']::model()->findAllByAttributes(array('link_to' => $model->id));
    if (count($commodityItems) != 0) {
        echo "<tr style='background:#F5A9A9;'><th colspan='4' style='text-align:center'>Linked " . $commodity['name'] . " Allocate History</th></tr>";
        foreach ($commodityItems as $c) {
            $cartridgeName = $c['name'];
            $fullallocates = Allocate::model()->findAll("commodity_id =:commodity_id AND cons_id=:cons_id", array('commodity_id' => 12, 'cons_id' => $c['id']));
            $allocates = Allocate::model()->findAll("commodity_id =:commodity_id AND cons_id=:cons_id AND given_by IS NOT NULL", array('commodity_id' => 12, 'cons_id' => $c['id']));
            $total = count($fullallocates);
            $allocated = count($allocates);
            echo "<tr style='background:#F6E3CE'><th colspan='4'>{$cartridgeName} <code>{$allocated} / {$total} allocated</code></th></tr>";
            if (count($allocates) != 0) {
                echo "<tr><th>Date Out</th><th>Allocated By</th><th>Allocated To</th></tr>";
                foreach ($allocates as $a) {
                    echo "<tr>";
                    $date_out = $a['date_out'];
Example #3
0
$beau_model = Beautician::model();
$query = "select * from tbl_beautician";
$beau_info = $beau_model->findAllBySql($query);
//构建dropDownList的option用的数组
$beau_options = array();
foreach ($beau_info as $_beau_v) {
    if ($_beau_v->beau_valid != 1) {
        continue;
    }
    $beau_options["{$_beau_v->pk_beau_id}"] = "{$_beau_v->beau_realname}";
}
//商品名称及时间数据准备
$ord_item_model = Order_Item::model();
$ord_item_info = $ord_item_model->findByPk($aptm_info->aptm_ord_item_id);
if (isset($ord_item_info)) {
    $comm_model = Commodity::model();
    $comm_info = $comm_model->findByPk($ord_item_info->ord_item_comm_id);
    $comm_serv_model = Commodity_Service::model();
    $comm_serv_info = $comm_serv_model->findByPk($ord_item_info->ord_item_comm_id);
}
?>
	<?php 
$form = $this->beginWidget('CActiveForm');
?>
	<table border="1" width="100%" class="table_a">
		<tr bgcolor="#add8e6">
			<td>
				<?php 
echo $form->label($aptm_info, 'pk_aptm_id');
?>
			</td>
Example #4
0
		<div class="container">
		<button type="button" class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
			<span class="icon-bar"></span>
			<span class="icon-bar"></span>
			<span class="icon-bar"></span>
		</button>
		<a class="brand" href="<?php 
echo Yii::app()->homeUrl;
?>
">
                    <?php 
echo "AM " . Yii::app()->user->getState("org_name");
?>
		</a>
                <?php 
$allCommodities = Commodity::model()->findAllByAttributes(array('is_deleted' => 0));
foreach ($allCommodities as $commodity) {
    $commodityName = lcfirst($commodity['name']);
    $notDeletedCategories = MyUtility::getNotDeleted('category');
    $categories = CommodityCategory::model()->findAllByAttributes(array('commodity_id' => $commodity['id'], 'category_id' => $notDeletedCategories));
    foreach ($categories as $cat) {
        //$categoryRow = Category::model()->findByAttributes(array('id'=>$cat['category_id']));
        $categoryList[] = array('label' => '<i class="icon-info-sign"></i> ' . $cat['path'], 'url' => array("/{$commodityName}/admin", 'category_id' => $cat['path']));
    }
    $categoryList[] = array('label' => '<i class="icon-info-sign"></i> Show All', 'url' => array('/' . $commodity['name'] . '/admin'));
    $items[] = array('url' => array('/' . $commodity['name'] . '/admin'), 'label' => ' <i class="icon-info-sign"></i> ' . $commodity['name'], 'items' => $categoryList);
    $categoryList = array();
}
$items[] = array('label' => '<i class="icon-info-sign"></i> files', 'url' => array("/fm/entry/index/form/16", 'category_id' => $cat['path']));
?>
    
Example #5
0
		<div class="container">
		<button type="button" class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
			<span class="icon-bar"></span>
			<span class="icon-bar"></span>
			<span class="icon-bar"></span>
		</button>
		<a class="brand" href="<?php 
echo Yii::app()->homeUrl;
?>
">
                    <?php 
echo CHtml::encode(Yii::app()->name . ' ' . Yii::app()->user->getState("org_name"));
?>
		</a>
                <?php 
$allCommodities = Commodity::model()->findAll();
foreach ($allCommodities as $commodity) {
    $items[] = array('label' => '<i class="icon-info-sign"></i> ' . $commodity['name'], 'url' => array('/' . $commodity['name'] . '/admin'));
}
?>
    
		<div class="nav-collapse collapse">
		<?php 
$this->widget('zii.widgets.CMenu', array('items' => array(array('label' => '<i class="icon-home"></i> Home', 'url' => array('/site/index')), array('label' => '<i class="icon-info-sign"></i> About', 'url' => array('/site/page', 'view' => 'about')), array('label' => '<i class="icon-envelope"></i> Contact', 'url' => array('/site/contact')), array('label' => '<b class="icon-inbox"></b> Commodities <b class="caret"></b>', 'url' => '#', 'linkOptions' => array('class' => 'dropdown-toggle', 'data-toggle' => 'dropdown'), 'itemOptions' => array('class' => 'dropdown'), 'items' => $items), array('label' => '<b class="icon-inbox"></b> Administration <b class="caret"></b>', 'url' => '#', 'linkOptions' => array('class' => 'dropdown-toggle', 'data-toggle' => 'dropdown'), 'itemOptions' => array('class' => 'dropdown'), 'items' => array(array('label' => '<i class="icon-map-marker"></i> Location', 'url' => array('/location/tree')), array('label' => '<i class="icon-user"></i> Suppliers', 'url' => array('/supplier/admin')), array('label' => '<i class="icon-user"></i> Manufacturers', 'url' => array('/manufacturer/admin')), array('label' => '<i class="icon-folder-close"></i> Consumables', 'url' => array('/consumable/admin')), array('label' => '<i class="icon-folder-close"></i> Commodities', 'url' => array('/commodity/admin')), array('label' => '<i class="icon-folder-close"></i> Categories', 'url' => array('/category/admin')))), array('label' => '<i class="icon-folder-close"></i> Manage <b class="caret"></b>', 'url' => '#', 'linkOptions' => array('class' => 'dropdown-toggle', 'data-toggle' => 'dropdown'), 'itemOptions' => array('class' => 'dropdown'), 'items' => array(array('label' => '<i class="icon-user"></i> Users', 'url' => array('/user/admin')), array('label' => '<i class="icon-user"></i> Groups', 'url' => array('/group/admin')), array('label' => '<i class="icon-user"></i> Usergroups', 'url' => array('/usergroup/admin')), array('label' => '<i class="icon-tasks"></i> Blocked Items', 'url' => array('/blockeditem/admin')), array('label' => '<i class="icon-tasks"></i> Statuses', 'url' => array('/status/admin')), array('label' => '<i class="icon-tasks"></i> Currencies', 'url' => array('/currency/admin')), array('label' => '<i class="icon-folder-close"></i> Consumable Types', 'url' => array('/consumabletype/admin')), array('label' => '<i class="icon-folder-close"></i> Supplier Types', 'url' => array('/suppliertype/admin')), array('label' => '<i class="icon-folder-close"></i> Management Types', 'url' => array('/managementtype/admin')))), array('label' => '<i class="icon-user"></i> Login', 'url' => array('/site/login'), 'visible' => Yii::app()->user->isGuest), array('label' => '<i class="icon-user"></i> Logout (' . Yii::app()->user->name . ')', 'url' => array('/site/logout'), 'visible' => !Yii::app()->user->isGuest)), 'encodeLabel' => false, 'htmlOptions' => array('class' => 'nav pull-left'), 'submenuHtmlOptions' => array('class' => 'dropdown-menu')));
?>
		</div>
		</div>
		</div>
	</div><!-- mainmenu -->

	<div class="container">
Example #6
0
<html>
    <style>
        .buttonDesign{
            margin-left : 2px;
            margin-right : 2px;
        }
    </style>
</html>
<?php 
/* @var $this BlockeditemController */
/* @var $model Blockeditem */
$commodity = Commodity::model()->findByPk($_GET['commodityId']);
$commodityName = $commodity['name'];
$this->breadcrumbs = array(ucfirst($commodityName) => array("{$commodityName}/admin"), 'Manage' => array("{$commodityName}/admin"), 'Blocked Items');
Yii::app()->clientScript->registerScript('search', "\n\$('.search-button').click(function(){\n\t\$('.search-form').toggle();\n\treturn false;\n});\n\$('.search-form form').submit(function(){\n\t\$('#blockeditem-grid').yiiGridView('update', {\n\t\tdata: \$(this).serialize()\n\t});\n\treturn false;\n});\n");
?>

<h1>Manage <span style="color:#B40431">Blockeditems</span></h1>

 <?php 
$this->widget('application.extensions.print.printWidget', array('cssFile' => 'print.css', 'printedElement' => '#blockeditem-grid', 'htmlOptions' => array()));
?>
 <?php 
echo CHtml::link('<i class="icon-file"></i> <b>PDF</b>', 'generatePdf', array('class' => 'btn btn-danger buttonDesign', 'style' => 'height:16px;', 'title' => 'Save as PDF'));
echo CHtml::link('<i class="icon-file"></i> <b>CSV</b>', '#csv', array('class' => 'btn-success btn buttonDesign', 'style' => 'height:16px;', 'title' => 'Save as CSV'));
?>
   
<?php 
$gridWidget = $this->widget('bootstrap.widgets.TbGridView', array('id' => 'blockeditem-grid', 'dataProvider' => $model->search(), 'filter' => $model, 'columns' => array('item_name', array('name' => 'userby.name', 'header' => 'Blocked By'), array('name' => 'blocked_on', 'header' => 'Blocked On', 'value' => 'Yii::app()->dateFormatter->format(Yii::app()->locale->getDateFormat("long"),
                                        CDateTimeParser::parse($data->blocked_on, "yyyy-mm-dd"))'), array('name' => 'blocked_from', 'header' => 'Blocked From', 'value' => 'Yii::app()->dateFormatter->format(Yii::app()->locale->getDateFormat("long"),
                                        CDateTimeParser::parse($data->blocked_from, "yyyy-mm-dd"))'), array('name' => 'blocked_to', 'header' => 'Blocked To', 'value' => 'Yii::app()->dateFormatter->format(Yii::app()->locale->getDateFormat("long"),
 /**
  * 订单商品添加
  */
 public function actionAddOrderItem($ord_id, $item_id)
 {
     $comm_model = Commodity::model();
     if ($item_id != 0) {
         //已经选择了item
         $ord_item_model = new Order_Item();
         //为了这个奇葩的id(要用ord_id来算,还要从0开始计数)
         $ord_item_model->pk_ord_itm_id = ($ord_id - 80000000) * 1000;
         $query = 'select * from tbl_order_item where pk_ord_itm_ord_id = ' . $ord_id;
         $ord_item_info = $ord_item_model->findAllBySql($query);
         $ord_item_model->pk_ord_itm_id += count($ord_item_info);
         $ord_item_model->pk_ord_itm_ord_id = $ord_id;
         $ord_item_model->ord_item_comm_id = $item_id;
         $ord_item_model->ord_item_num = 1;
         $comm_info = $comm_model->findByPk($item_id);
         if ($comm_info) {
             $ord_item_model->ord_item_price = $comm_info->comm_price;
         }
         if ($ord_item_model->save()) {
             $this->redirect("./index.php?r=order/detail&id={$ord_id}");
         } else {
             //var_dump($user_info->getErrors());
             //var_dump($customer_info->getErrors());
             echo "<script>alert('出错啦003!');</script>";
         }
     }
     $comm_info = $comm_model->findAll();
     $this->renderPartial('addOrderItem', array('ord_id' => $ord_id, 'comm_info' => $comm_info));
 }
Example #8
0
            margin-left : 2px;
            margin-right : 2px;
        }
    </style>
</html>

<?php 
/* @var $this MonitorController */
/* @var $model Monitor */
$this->breadcrumbs = array('Printers' => array('admin'), 'Manage');
Yii::app()->clientScript->registerScript('search', "\n\$('.search-button').click(function(){\n\t\$('.search-form').toggle();\n\treturn false;\n});\n\$('.search-form form').submit(function(){\n\t\$('#monitor-grid').yiiGridView('update', {\n\t\tdata: \$(this).serialize()\n\t});\n\treturn false;\n});\n");
?>

<h1>Manage <span style="color:#B40431">Printers</span></h1>
<?php 
$commodityId = Commodity::model()->find('name =:name', array('name' => $this->id));
echo CHtml::link('<i class="icon-ban-circle"></i>', Yii::app()->homeUrl . '/blockeditem/admin?commodityId=' . $commodityId['id'], array('class' => 'btn-danger btn buttonDesign', 'title' => 'View Blocked ' . ucfirst($this->id)));
echo CHtml::link('<i class="icon-plus"></i>', array('create', 'commodity_id' => $commodityId['id']), array('class' => 'btn-warning btn buttonDesign', 'title' => 'Add ' . ucfirst($this->id)));
echo CHtml::link('<i class="icon-barcode"></i>', Yii::app()->homeUrl . '/printers/admin2', array('class' => 'btn-warning btn buttonDesign', 'title' => 'Get Barcode'));
$this->widget('application.extensions.print.printWidget', array('cssFile' => 'print.css', 'printedElement' => '#printers-grid', 'htmlOptions' => array()));
echo CHtml::link('<i class="icon-file"></i> <b>PDF</b>', 'generatePdf', array('class' => 'btn btn-danger buttonDesign', 'style' => 'height:16px;', 'title' => 'Save as PDF'));
echo CHtml::link('<i class="icon-file"></i> <b>CSV</b>', '#csv', array('class' => 'btn-success btn buttonDesign', 'style' => 'height:16px;', 'title' => 'Save as CSV'));
?>

<?php 
echo "<br/><br/>";
/** Flash Messages with allocated ID's**/
foreach (Yii::app()->user->getFlashes() as $key => $message) {
    echo '<div height:15px><span class="flash-' . $key . ' myFlash">' . $message . "</span></div>";
}
Yii::app()->clientScript->registerScript('myHideEffect', '$(".flash-success").animate({opacity: 1.0}, 4000).fadeOut("fast");', CClientScript::POS_READY);
 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new Blockeditem();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Blockeditem'])) {
         $model->commodity_id = $_POST['Blockeditem']['commodity_id'];
         $model->item_id = $_POST['Blockeditem']['item_id'];
         $model->blocked_by = $_POST['Blockeditem']['blocked_by'];
         $model->blocked_on = $_POST['Blockeditem']['blocked_on'];
         $model->blocked_from = $_POST['Blockeditem']['blocked_from'];
         $model->blocked_to = $_POST['Blockeditem']['blocked_to'];
         $commo = Commodity::model()->findByPk($model->commodity_id);
         $item = $commo['name']::model()->findByPk($model->item_id);
         $model->item_name = $item['name'];
         //$model->attributes=$_POST['Blockeditem'];
         if ($model->validate()) {
             /** Single Line **/
             if (isset($_POST['Blockeditem']['block_group'])) {
                 $grps = $_POST['Blockeditem']['block_group'];
                 $model->flag = 'G';
                 foreach ($grps as $grp) {
                     $singlemodel = new Blockeditem();
                     $singlemodel->attributes = $model->attributes;
                     $singlemodel->blocked_for = $grp;
                     $commo = Commodity::model()->findByPk($model->commodity_id);
                     $item = $commo['name']::model()->findByPk($model->item_id);
                     $singlemodel->item_name = $item['name'];
                     $singlemodel->save();
                 }
             }
             if (isset($_POST['Blockeditem']['block_user'])) {
                 //echo "<script>djsahdja</script>";die;
                 $users = $_POST['Blockeditem']['block_user'];
                 $model->flag = 'U';
                 foreach ($users as $user) {
                     $singlemodel = new Blockeditem();
                     $singlemodel->attributes = $model->attributes;
                     $singlemodel->blocked_for = $user;
                     $commo = Commodity::model()->findByPk($model->commodity_id);
                     $item = $commo['name']::model()->findByPk($model->item_id);
                     $singlemodel->item_name = $item['name'];
                     $singlemodel->save();
                 }
             }
             if (!isset($_POST['Blockeditem']['block_group']) && !isset($_POST['Blockeditem']['block_user'])) {
                 $model->flag = 'A';
                 $model->save();
             }
             $commo = Commodity::model()->findByPk($model->commodity_id);
             $commodityName = $commo['name'];
             $cons = $commodityName::model()->findByPk($model->item_id);
             $cons->status_id = 4;
             $cons->update();
             Yii::app()->request->redirect("http://localhost/asset_management/index.php/{$commodityName}/admin");
         }
     }
     $this->render('create', array('model' => $model));
 }
Example #10
0
	<b><?php 
echo CHtml::encode($data->getAttributeLabel('END_DATE'));
?>
:</b>
	<?php 
echo CHtml::encode($data->END_DATE);
?>
	<br />

	<b><?php 
echo CHtml::encode($data->getAttributeLabel('TYPE_ID'));
?>
:</b>
	<?php 
if ($data->TYPE_ID) {
    echo CHtml::encode(Commodity::model()->FindByPk($data->TYPE_ID)->name);
}
?>
	<br />

	<b><?php 
echo CHtml::encode($data->getAttributeLabel('CREATED_BY'));
?>
:</b>
	<?php 
echo CHtml::encode($data->CREATED_BY);
?>
	<br />

	<b><?php 
echo CHtml::encode($data->getAttributeLabel('LAST_MODIFIED_BY'));
 /**
  * 销售一览
  * @throws CException
  */
 public function actionShowSale()
 {
     //通过模型来实现数据表信息查询
     //产生模型对象
     $commodity_model = Commodity::model();
     $query = 'select * from tbl_commodity';
     //判断Filter是否被用户选择了
     if (isset($_POST["comm_kind"])) {
         if ($_POST['comm_kind'] != 9999) {
             $query = $query . " where comm_kind=" . $_POST["comm_kind"];
         }
     }
     $commodity_info = $commodity_model->findAllBySql($query);
     //传递到视图
     $this->renderPartial('showSale', array('commodity_info' => $commodity_info));
 }
Example #12
0
function aptm_infomation($appointment)
{
    $order_item_model = Order_Item::model();
    $comm_service_model = Commodity_Service::model();
    $order_model = Order::model();
    $commodity_model = Commodity::model();
    $view_order_count_model = View_Order_Count::model();
    $aptm_infomation = array();
    //开始时间
    $start_time = date("H:i", strtotime($appointment->aptm_time));
    $aptm_infomation[0] = $start_time;
    //终了时间
    $query = 'select * from tbl_order_item where pk_ord_itm_id=' . $appointment->aptm_ord_item_id;
    $order_item_info = $order_item_model->findBySql($query);
    $duration = 30;
    if (isset($order_item_info)) {
        $query = 'select * from tbl_commodity_service where pk_serv_id=' . $order_item_info->ord_item_comm_id;
        $comm_service_info = $comm_service_model->findBySql($query);
        if (isset($comm_service_info)) {
            $duration += $comm_service_info->serv_duration;
        }
    }
    $end_time = date("H:i", strtotime("{$start_time} + {$duration} minute"));
    $aptm_infomation[1] = $end_time;
    //预约单号
    //		$aptm_infomation[2] = $appointment->pk_aptm_id;
    //订单号
    if (isset($order_item_info)) {
        $aptm_infomation[2] = $order_item_info->pk_ord_itm_ord_id;
    }
    //客户姓名
    $aptm_infomation[3] = $appointment->aptm_cust_name;
    //客户编号
    $cust_id = 0;
    if (isset($order_item_info)) {
        $query = 'select * from tbl_order where pk_ord_id=' . $order_item_info->pk_ord_itm_ord_id;
        $order_info = $order_model->findBySql($query);
        if (isset($order_info)) {
            $cust_id = $order_info->ord_cust_id;
        }
    }
    $aptm_infomation[4] = $cust_id;
    //预约项目
    $aptm_name = '未知';
    if (isset($comm_service_info)) {
        $query = 'select * from tbl_commodity where pk_comm_id=' . $comm_service_info->pk_serv_id;
        $commodity_info = $commodity_model->findBySql($query);
        if (isset($commodity_info)) {
            $aptm_name = $commodity_info->comm_name;
        }
    }
    $aptm_infomation[5] = $aptm_name;
    //地址
    $aptm_infomation[6] = $appointment->aptm_cust_addr;
    //联系方式
    $aptm_infomation[7] = $appointment->aptm_cust_tel;
    //刷卡金额
    $price = 0;
    if (isset($order_info)) {
        $query = 'select * from view_order_count where pk_ord_id = ' . $order_info->pk_ord_id;
        $view_order_count_info = $view_order_count_model->findBySql($query);
        //			echo '<pre>';
        //			print_r($view_order_count_info);
        //			echo '</pre>';
        if (isset($view_order_count_info)) {
            $price = $view_order_count_info->total;
        }
        $price -= $order_info->ord_paid_money;
    }
    $aptm_infomation[8] = $price;
    return $aptm_infomation;
}
Example #13
0
 /**
  * 按照选定的日期和美疗师来显示预约(包括普通预约和1元预约),用以计算金额
  * @throws CException
  */
 public function actionSelectAptmByDay()
 {
     define('APTM_ID', 0);
     define('COMM_NAME', 1);
     define('CUST_NAME', 2);
     define('PRICE', 3);
     if (isset($_POST['beau_id']) && $_POST['beau_id'] != 0 && isset($_POST['from_date_year']) && isset($_POST['from_date_month']) && isset($_POST['from_date_day']) && isset($_POST['to_date_year']) && isset($_POST['to_date_month']) && isset($_POST['to_date_day'])) {
         //整理日期
         $from_date = $_POST['from_date_year'] . '-' . $_POST['from_date_month'] . '-' . $_POST['from_date_day'];
         $to_date = $_POST['to_date_year'] . '-' . $_POST['to_date_month'] . '-' . $_POST['to_date_day'];
         $from_date = date("Y-m-d H:i:s", strtotime("{$from_date}"));
         $to_date = date('Y-m-d H:i:s', strtotime("{$to_date} +1 day"));
         if ($from_date > $to_date) {
             echo "<script>alert('起始日期应该早于或等于终了日期!');</script>";
         }
         //TODO:金额信息较复杂,应该需要再建一张表来计算,需要讨论
         //传递形式:
         /*
         xxxx-xx-xx
         ------------------------------------------
         |aptmid|aaaa                             |
         |项目名 |aaaa                             |
         |客户名 |bbbb                             |
         |金额: |111                              |
         ------------------------------------------
         xxxx-xx-xx
         ------------------------------------------
         |aptmid|aaaa                             |
         |项目名 |aaaa                             |
         |客户名 |bbbb                             |
         |金额: |111                              |
         ------------------------------------------
         |aptmid|aaaa                             |
         |项目名 |aaaa                             |
         |客户名 |bbbb                             |
         |金额: |111                              |
         ------------------------------------------
         */
         //定义数组
         $day_count = $this->countDays($from_date, $to_date);
         $aptm_info_by_day = array($day_count);
         //查询普通预约
         //(从tbl_appointment的预约日期入手,包括关联的tbl_order_item,tbl_commodity以获取客户名,项目名等信息)
         $aptm_model = Aptm::model();
         $query = 'select * from tbl_appointment where aptm_beau_id = ' . $_POST['beau_id'] . ' and aptm_time >= "' . $from_date . '"' . ' and aptm_time < "' . $to_date . '"';
         $aptm_info = $aptm_model->findAllBySql($query);
         if (isset($aptm_info)) {
             for ($cnt_day = 0; $cnt_day < $day_count; $cnt_day++) {
                 $counter_by_day = 0;
                 foreach ($aptm_info as $_v_aptm_info) {
                     $day_selected = date('Y-m-d', strtotime("{$from_date}" . ' +' . $cnt_day . ' day'));
                     $day_compare = date('Y-m-d', strtotime($_v_aptm_info->aptm_time));
                     if ($day_selected == $day_compare) {
                         //                            $info_by_day[APTM_ID] = $_v_aptm_info->pk_aptm_id;
                         //                            $info_by_day[CUST_NAME] = $_v_aptm_info->aptm_cust_name;
                         //                            $info_by_day[COMM_NAME] = '未取得';
                         //                            $info_by_day[PRICE] = 0;
                         $info_by_day = new InfoByDay();
                         $info_by_day->aptm_id = $_v_aptm_info->pk_aptm_id;
                         $info_by_day->cust_name = $_v_aptm_info->aptm_cust_name;
                         //查询tbl_order_item表以取得commodity_id
                         $order_item_model = Order_Item::model();
                         $order_item_info = $order_item_model->findByPk($_v_aptm_info->aptm_ord_item_id);
                         if (isset($order_item_info)) {
                             $comm_model = Commodity::model();
                             $comm_info = $comm_model->findByPk($order_item_info->ord_item_comm_id);
                             if (isset($comm_info)) {
                                 //                                    $info_by_day[COMM_NAME] = $comm_info->comm_name;
                                 $info_by_day->comm_name = $comm_info->comm_name;
                             }
                             //TODO:此处为暂定处理,在修改金额的时候需要修改!
                             //                                $info_by_day[PRICE] = $order_item_info->ord_item_price;
                             $info_by_day->price = $order_item_info->ord_item_price;
                         }
                         $aptm_info_by_day[$cnt_day][$counter_by_day] = $info_by_day;
                         $counter_by_day++;
                     }
                 }
             }
         }
         //查询1元特殊预约
         $contact_model = Contact::model();
         $query = 'select * from tbl_contact where con_beau_id = ' . $_POST['beau_id'] . ' and con_time >="' . $from_date . '"' . ' and con_time <"' . $to_date . '"';
         $contact_info = $contact_model->findAllBySql($query);
         $contact_info_by_day = array($day_count);
         if (isset($contact_info)) {
             for ($cnt_day = 0; $cnt_day < $day_count; $cnt_day++) {
                 $counter_by_day = 0;
                 foreach ($contact_info as $_v_contact_info) {
                     //                        $info_by_day[APTM_ID] = $_v_contact_info->pk_contact_id;
                     //                        $info_by_day[CUST_NAME] = $_v_contact_info->con_name;
                     //                        $info_by_day[COMM_NAME] = '未取得';
                     //                        //TODO:此处为暂定处理,在修改金额的时候需要修改!
                     //                        $info_by_day[PRICE] = 0;
                     $info_by_day = new InfoByDay();
                     $info_by_day->aptm_id = $_v_contact_info->pk_contact_id;
                     $info_by_day->cust_name = $_v_contact_info->con_name;
                     //查询tbl_code表以获取COMM_NAME
                     $code_model = Code::model();
                     $query = 'select * from tbl_code where code_tbl_name="tbl_contact" and code_name="con_prefer" and code_value=' . $_v_contact_info->con_prefer;
                     $code_info = $code_model->findBySql($query);
                     if (isset($code_info)) {
                         //                            $info_by_day[COMM_NAME] = $code_info->code_meaning;
                         $info_by_day->comm_name = $code_info->code_meaning;
                     }
                     $contact_info_by_day[$cnt_day][$counter_by_day] = $info_by_day;
                     //TODO:此处的三维数组改为自定义类试试看
                     $counter_by_day++;
                 }
             }
         }
         //获取美疗师姓名
         $beau_model = Beautician::model();
         $beau_info = $beau_model->findByPk($_POST['beau_id']);
         $beau_name = '没名字';
         if (isset($beau_info)) {
             $beau_name = $beau_info->beau_realname;
         }
         //            //转向列表显示页面
         //            $this->redirect('./index.php?r=aptm/showAptmByDay&beau_name='.$beau_name.
         //                            'from_date='.$from_date.
         //                            'to_date='.$to_date.
         //                            'day_count='.$day_count.
         //                            'aptm_info_by_day='.$aptm_info_by_day.
         //                            'contact_info_by_day='.$contact_info_by_day);
         $this->actionShowAptmByDay($beau_name, $from_date, $to_date, $day_count, $aptm_info_by_day, $contact_info_by_day);
         return;
     }
     //有东西没有选择的话,依旧描绘当前的选择视图
     //TODO:需要将已经选择的内容回传给视图以便修改
     $this->renderPartial('selectAptmByDay');
 }
 public function getInfo()
 {
     /* Items allocated*/
     $commodity['consumable'] = Consumable::model()->findAll();
     $commodity['monitor'] = Monitor::model()->findAll();
     $commodity['printers'] = Printers::model()->findAll();
     $commodity['devices'] = Devices::model()->findAll();
     $dup = $commodity;
     /* Items available on Loan*/
     $availableOnLoan = 0;
     $thresholdItems = 0;
     $content = '';
     foreach ($commodity as $key => $commo) {
         foreach ($commo as $item) {
             if ($item['available_on_loan'] == 1 || $item['available_on_loan'] == 'Yes') {
                 ++$availableOnLoan;
             }
             if ($key == 'consumable') {
                 $commodity = Commodity::model()->findByAttributes(array('name' => $key));
                 $allocates = Allocate::model()->findAllByAttributes(array('commodity_id' => $commodity['id'], 'cons_id' => $item['id']));
                 if (count($allocates) < $item['threshold']) {
                     ++$thresholdItems;
                 }
             }
         }
     }
     /** Allocated and unallocated **/
     $countAllocated = 0;
     $countUnAllocated = 0;
     $commodity = $dup;
     $unAllocated = Allocate::model()->findAllByAttributes(array('date_out' => NULL));
     $allocated = Allocate::model()->findAll('date_out IS NOT NULL');
     $countAllocated += count($allocated);
     $countUnAllocated += count($unAllocated);
     $content .= '<b style="color:red">' . $availableOnLoan . '</b> item available on loan<br/>';
     $content .= '<b style="color:red">' . $thresholdItems . '</b> item below threshold<br/>';
     $content .= '<b style="color:red">' . $countAllocated . '</b> item allocated<br/>';
     $content .= '<b style="color:red">' . $countUnAllocated . '</b> item unallocated<br/>';
     /* Items below threshold*/
     return $content;
 }
Example #15
0
    <?php 
$form = $this->beginWidget('bootstrap.widgets.TbActiveForm', array('id' => 'transfer-cons-form', 'enableAjaxValidation' => false, 'htmlOptions' => array('enctype' => 'multipart/form-data')));
?>
    
    <?php 
$commodity = Commodity::model()->findByAttributes(array('id' => $_GET['commodity_id']));
$consumable = $commodity['name']::model()->findByAttributes(array('id' => $_GET['itemId']));
?>
    <h3 style="color: #B40431"> <?php 
echo $consumable['name'];
?>
 </h3> 
    
	<?php 
$temp = $_GET['commodity_id'];
$tempname = Commodity::model()->findByAttributes(array('id' => $temp));
//echo $tempname['name'];
?>
	
	<?php 
/*$consumable = $tempname['name']::model()->findByAttributes(array('id'=>$_GET['itemId']));?>
  <h3 style="color: #B40431"> <?php echo $consumable['name']; */
?>
 </h3>
    

    <p class="help-block">Fields with <span class="required">*</span> are required.</p>

    <?php 
echo $form->errorSummary($model);
?>
Example #16
0
echo $form->textField($model, 'FORM_NAME', array('size' => 60, 'maxlength' => 128, 'placeHolder' => 'Form Name'));
?>
</div>
                    
                </div>
            </div>
        </tr>
        <tr>
            <div class="row">
                <div class="col-md-3 col-sm-6">
                    <div class="span2"><?php 
echo $form->labelEx($model, 'TYPE_ID');
?>
</div>
                    <div class="span3"><?php 
echo $form->dropDownList($model, 'TYPE_ID', CHtml::listData(Commodity::model()->findAll(), 'id', 'name'), array('empty' => '--- Select Commodity ---'));
?>
</div>
                    <code>Link it to a commodity.</code>
                </div>
            </div>
        </tr>
        </table>

	<div class="row">
		<?php 
//echo $form->labelEx($model,'BEGIN_DATE');
?>
		<?php 
/*$this->widget('zii.widgets.jui.CJuiDatePicker', array(
		'model' => $model,
 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer $id the ID of the model to be loaded
  * @return Commodity the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = Commodity::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
Example #18
0
	            <div class="span3"><?php 
echo $form->textField($model, 'name', array('span' => 3, 'maxlength' => 50));
?>
</div>
                </div>
            </div>
        </tr>
        <tr>
            <div class="row">
                <div class="col-md-3 col-sm-6">
                    <div class="span2"><?php 
echo $form->labelEx($model, 'commodity_id', array('class' => 'inline-labels'));
?>
</div>
                    <div class="span3"><?php 
echo $form->dropDownList($model, 'commodity_id', CHtml::listData(Commodity::model()->findAll(), 'id', 'name'), array('span' => 2, 'prompt' => '---'));
?>
</div>
                </div>
            </div>
        </tr>					
        </table>

        <div style="text-align: center;">
        <?php 
echo '<br/>';
?>
        <?php 
echo TbHtml::submitButton($model->isNewRecord ? 'Submit' : 'Update', array('color' => TbHtml::BUTTON_COLOR_SUCCESS, 'size' => TbHtml::BUTTON_SIZE_DEFAULT));
?>
		<?php 
Example #19
0
<html>
    <style>
        .buttonDesign{
            margin-left : 2px;
            margin-right : 2px;
        }
    </style>
</html>
<?php 
/* @var $this AllocateController */
/* @var $model Allocate */
?>

<?php 
$commodity = Commodity::model()->findByAttributes(array('id' => $_GET['commodity_id']));
$commodityName = $commodity['name'];
$row = $commodityName::model()->findByAttributes(array('id' => $model->cons_id));
$this->breadcrumbs = array(ucfirst($commodityName) => array("{$commodityName}/admin"), 'Manage' => array("{$commodityName}/admin"), 'Allocate');
?>


<h1>Allocate <span style="color:#B40431"><?php 
echo $row['name'];
?>
</span></h1>
<?php 
//echo CHtml::link('List All','http://localhost/asset_management/index.php/allocate/index',array('class'=>'btn-danger btn buttonDesign'));
//echo CHtml::link('View '.$model->name,array('view', 'id'=>$model->id),array('class'=>'btn-danger btn buttonDesign'));
//echo CHtml::link('Manage All','http://localhost/asset_management/index.php/allocate/admin',array('class'=>'btn-inverse btn buttonDesign'));
//echo "<br/><br/>";
?>
Example #20
0
<?php

/* @var $this BlockeditemController */
/* @var $model Blockeditem */
?>

<?php 
$commodity = Commodity::model()->findByPk($model->commodity_id);
$commodityName = $commodity['name'];
$this->breadcrumbs = array(ucfirst($commodityName) => array("{$commodityName}/admin"), 'Manage' => array("{$commodityName}/admin"), 'Blocked Items' => Yii::app()->request->urlReferrer, 'Update');
?>

    <h1>Update Blockeditem</h1>

<?php 
$this->renderPartial('_customUpdate', array('model' => $model));