本文整理汇总了PHP中Products::getName方法的典型用法代码示例。如果您正苦于以下问题:PHP Products::getName方法的具体用法?PHP Products::getName怎么用?PHP Products::getName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Products
的用法示例。
在下文中一共展示了Products::getName方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionAjaxDetail
public function actionAjaxDetail($depId, $key, $dates)
{
$model = array();
$model2 = array();
$model3 = array();
$expense = new Expense();
$prod = new Products();
$stuff = new Halfstaff();
$measure = new Measurement();
if ($key == 'begin') {
$model = Yii::app()->db->createCommand()->select('db.startCount as count,db.prod_id,p.name as name,m.name as Mname')->from('dep_balance db')->join('products p', 'p.product_id = db.prod_id')->join('measurement m', 'm.measure_id = p.measure_id')->where('db.b_date = :dates AND db.department_id = :depId AND db.type = :types', array(':dates' => $dates, ':depId' => $depId, ':types' => 1))->queryAll();
$model2 = Yii::app()->db->createCommand()->select('db.startCount as count,db.prod_id,h.name as name, m.name as Mname')->from('dep_balance db')->join('halfstaff h', 'h.halfstuff_id = db.prod_id')->join('measurement m', 'm.measure_id = h.stuff_type')->where('db.b_date = :dates AND db.department_id = :depId AND db.type = :types', array(':dates' => $dates, ':depId' => $depId, ':types' => 2))->queryAll();
}
if ($key == 'end') {
$model = Yii::app()->db->createCommand()->select('db.endCount as count,db.prod_id,p.name as name,m.name as Mname')->from('dep_balance db')->join('products p', 'p.product_id = db.prod_id')->join('measurement m', 'm.measure_id = p.measure_id')->where('db.b_date = :dates AND db.department_id = :depId AND db.type = :types', array(':dates' => $dates, ':depId' => $depId, ':types' => 1))->queryAll();
$model2 = Yii::app()->db->createCommand()->select('db.endCount as count,db.prod_id,h.name as name, m.name as Mname')->from('dep_balance db')->join('halfstaff h', 'h.halfstuff_id = db.prod_id')->join('measurement m', 'm.measure_id = h.stuff_type')->where('db.b_date = :dates AND db.department_id = :depId AND db.type = :types', array(':dates' => $dates, ':depId' => $depId, ':types' => 2))->queryAll();
}
if ($key == 'curEnd') {
$model = Yii::app()->db->createCommand()->select('db.CurEndCount as count,db.prod_id,p.name as name,m.name as Mname')->from('dep_balance db')->join('products p', 'p.product_id = db.prod_id')->join('measurement m', 'm.measure_id = p.measure_id')->where('db.b_date = :dates AND db.department_id = :depId AND db.type = :types', array(':dates' => $dates, ':depId' => $depId, ':types' => 1))->queryAll();
$model2 = Yii::app()->db->createCommand()->select('db.CurEndCount as count,db.prod_id,h.name as name, m.name as Mname')->from('dep_balance db')->join('halfstaff h', 'h.halfstuff_id = db.prod_id')->join('measurement m', 'm.measure_id = h.stuff_type')->where('db.b_date = :dates AND db.department_id = :depId AND db.type = :types', array(':dates' => $dates, ':depId' => $depId, ':types' => 2))->queryAll();
}
if ($key == 'realize') {
$model = Yii::app()->db->createCommand()->select('dr.count as count,dr.prod_id,p.name as name,m.name as Mname')->from('dep_faktura df')->join('dep_realize dr', 'dr.dep_faktura_id = df.dep_faktura_id')->join('products p', 'p.product_id = dr.prod_id')->join('measurement m', 'm.measure_id = p.measure_id')->where('date(df.real_date) = :dates AND df.department_id = :depId AND df.fromDepId = :fromDepId ', array(':dates' => $dates, ':depId' => $depId, ':fromDepId' => 0))->queryAll();
}
if ($key == 'price') {
$model = Yii::app()->db->createCommand()->select('sum(ord.count) as count,ord.just_id as prod_id,p.name as name,ex.mType,ord.type')->from('expense ex')->join('orders ord', 'ord.expense_id = ex.expense_id')->join('products p', 'p.product_id = ord.just_id')->where('date(ex.order_date) = :dates AND p.department_id = :DepId AND ord.type = :type', array(':dates' => $dates, ':DepId' => $depId, ':type' => 3))->group('ord.just_id')->queryAll();
$model2 = Yii::app()->db->createCommand()->select('sum(ord.count) as count,ord.just_id as prod_id,h.name as name,ex.mType,ord.type')->from('expense ex')->join('orders ord', 'ord.expense_id = ex.expense_id')->join('halfstaff h', 'h.halfstuff_id = ord.just_id')->where('date(ex.order_date) = :dates AND h.department_id = :DepId AND ord.type = :type', array(':dates' => $dates, ':DepId' => $depId, ':type' => 2))->group('ord.just_id')->queryAll();
$model3 = Yii::app()->db->createCommand()->select('sum(ord.count) as count,ord.just_id as prod_id,d.name as name,ex.mType,ord.type')->from('expense ex')->join('orders ord', 'ord.expense_id = ex.expense_id')->join('dishes d', 'd.dish_id = ord.just_id')->where('date(ex.order_date) = :dates AND d.department_id = :DepId AND ord.type = :type', array(':dates' => $dates, ':DepId' => $depId, ':type' => 1))->group('ord.just_id')->queryAll();
}
if ($key == 'other') {
$model = Yii::app()->db->createCommand()->select('sum(ord.count) as count,ord.just_id as prod_id,p.name as name')->from('expense ex')->join('orders ord', 'ord.expense_id = ex.expense_id')->join('products p', 'p.product_id = ord.just_id')->where('date(ex.order_date) = :dates AND ex.kind = :kind AND ord.type = :type', array(':dates' => $dates, ':kind' => 1, ':type' => 3))->group('ord.just_id')->queryAll();
}
if ($key == 'costPrice') {
$temp = $expense->getDishProd($depId, $dates);
$count = 0;
foreach ($temp as $key => $val) {
$model[$count]['count'] = $val;
$model[$count]['prod_id'] = $key;
$model[$count]['name'] = $prod->getName($key);
$model[$count]['Mname'] = $measure->getMeasure($key, 'prod');
$count++;
}
$temp2 = $expense->getDishStuff($depId, $dates);
$count = 0;
foreach ($temp2 as $key => $val) {
$model2[$count]['count'] = $val;
$model2[$count]['prod_id'] = $key;
$model2[$count]['name'] = $stuff->getName($key);
$model2[$count]['Mname'] = $measure->getMeasure($key, 'stuff');
$count++;
}
/*$model = Yii::app()->db->createCommand()
->select('sum(ord.count) as count,ord.just_id as prod_id,p.name as name,ex.mType,ord.type')
->from('expense ex')
->join('orders ord','ord.expense_id = ex.expense_id')
->join('products p','p.product_id = ord.just_id')
->where('date(ex.order_date) = :dates AND p.department_id = :DepId AND ord.type = :type',
array(':dates'=>$dates,':DepId'=>$depId,':type'=>3))
->group('ord.just_id')
->queryAll();
$model2 = Yii::app()->db->createCommand()
->select('sum(ord.count) as count,ord.just_id as prod_id,h.name as name,ex.mType,ord.type')
->from('expense ex')
->join('orders ord','ord.expense_id = ex.expense_id')
->join('halfstaff h','h.halfstuff_id = ord.just_id')
->where('date(ex.order_date) = :dates AND h.department_id = :DepId AND ord.type = :type',
array(':dates'=>$dates,':DepId'=>$depId,':type'=>2))
->group('ord.just_id')
->queryAll();
$model3 = Yii::app()->db->createCommand()
->select('sum(ord.count) as count,ord.just_id as prod_id,d.name as name,ex.mType,ord.type')
->from('expense ex')
->join('orders ord','ord.expense_id = ex.expense_id')
->join('dishes d','d.dish_id = ord.just_id')
->where('date(ex.order_date) = :dates AND d.department_id = :DepId AND ord.type = :type',
array(':dates'=>$dates,':DepId'=>$depId,':type'=>1))
->group('ord.just_id')
->queryAll();*/
}
if ($key == 'inRealize') {
$model = Yii::app()->db->createCommand()->select('dr.count as count,dr.prod_id,p.name as name,m.name as Mname')->from('dep_faktura df')->join('dep_realize dr', 'dr.dep_faktura_id = df.dep_faktura_id')->join('products p', 'p.product_id = dr.prod_id')->join('measurement m', 'm.measure_id = p.measure_id')->where('date(df.real_date) = :dates AND df.department_id = :depId AND df.fromDepId != :fromDepId', array(':dates' => $dates, ':depId' => $depId, ':fromDepId' => 0))->queryAll();
$model2 = Yii::app()->db->createCommand()->select('inord.count as count,inord.stuff_id as prod_id,h.name as name,m.name as Mname')->from('inexpense inexp')->join('inorder inord', 'inord.inexpense_id = inexp.inexpense_id')->join('halfstaff h', 'h.halfstuff_id = inord.stuff_id')->join('measurement m', 'm.measure_id = h.stuff_type')->where('date(inexp.inexp_date) = :dates AND inexp.department_id = :depId AND inexp.fromDepId != :fromDepId', array(':dates' => $dates, ':depId' => $depId, ':fromDepId' => 0))->queryAll();
}
if ($key == 'inExp') {
$model = Yii::app()->db->createCommand()->select('dr.count as count,dr.prod_id,p.name as name,m.name as Mname')->from('dep_faktura df')->join('dep_realize dr', 'dr.dep_faktura_id = df.dep_faktura_id')->join('products p', 'p.product_id = dr.prod_id')->join('measurement m', 'm.measure_id = p.measure_id')->where('date(df.real_date) = :dates AND df.department_id != :depId AND df.fromDepId = :fromDepId', array(':dates' => $dates, ':depId' => $depId, ':fromDepId' => $depId))->queryAll();
$model2 = Yii::app()->db->createCommand()->select('inord.count as count,inord.stuff_id as prod_id,h.name as name,m.name as Mname')->from('inexpense inexp')->join('inorder inord', 'inord.inexpense_id = inexp.inexpense_id')->join('halfstaff h', 'h.halfstuff_id = inord.stuff_id')->join('measurement m', 'm.measure_id = h.stuff_type')->where('date(inexp.inexp_date) = :dates AND inexp.department_id != :depId AND inexp.fromDepId = :fromDepId', array(':dates' => $dates, ':depId' => $depId, ':fromDepId' => $depId))->queryAll();
}
$this->renderPartial('ajaxDetail', array('dates' => $dates, 'model' => $model, 'model2' => $model2, 'model3' => $model3, 'key' => $key));
}
示例2: foreach
<th>Наименование</th>
<th>Кол-во</th>
<th>цена</th>
</tr>
</thead>
<tbody>
<?php
foreach ($dishes->getProd($val['dish_id']) as $key => $value) {
?>
<tr>
<td><?php
echo $cnt;
?>
</td>
<td><?php
echo $prod->getName($key);
?>
</td>
<td><?php
echo number_format($value, 2, ',', ' ');
?>
<?php
echo $measure->getMeasure($key, 'prod');
?>
</td>
<td>
<?php
$summ = $summ + $prod->getCostPrice($key, $dates) * $value;
?>
<?php
echo number_format($prod->getCostPrice($key, $dates) * $value, 0, ',', ' ');
示例3:
<th>Количество</th>
<th>Цена</th>
<th>Сумма</th>
</tr>
</thead>
<tbody>
<?php
foreach ($outProduct as $key => $val) {
?>
<tr>
<td><?php
echo $count;
?>
</td>
<td><?php
echo $products->getName($key);
?>
</td>
<td><?php
echo $val;
?>
</td>
<td><?php
echo number_format($realize->getRealized($key, $dates), 0, '.', ',');
?>
</td>
<td><?php
echo number_format($sum = $val * $realize->getRealized($key, $dates), 0, '.', ',');
$summ = $summ + $sum;
?>
</td>