本文整理汇总了PHP中Products::getCostPrice方法的典型用法代码示例。如果您正苦于以下问题:PHP Products::getCostPrice方法的具体用法?PHP Products::getCostPrice怎么用?PHP Products::getCostPrice使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Products
的用法示例。
在下文中一共展示了Products::getCostPrice方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Products
$cnt = 1;
$prod = new Products();
$form = $this->beginWidget('bootstrap.widgets.TbActiveForm', array('id' => 'employee-form', 'enableAjaxValidation' => false, 'type' => 'horizontal'));
?>
<table class="table table-bordered">
<thead>
<tr>
<th></th>
<th>Наименование</th>
<th>цена</th>
</tr>
</thead>
<tbody>
<?php
foreach ($model as $val) {
if ($prod->getCostPrice($val['product_id'], $dates) == 0) {
?>
<tr class="error">
<?php
} else {
?>
<tr>
<?php
}
?>
<td><?php
echo $cnt;
?>
</td>
<td><?php
echo $val['name'];
示例2: Products
<?php
$product = new Products();
$price = $product->getCostPrice($model['product_id'], $dates);
?>
<tr>
<td><?php
echo $cnt + 1;
?>
</td>
<td><a href='javascript:;' class = 'deleteRow'><i class='fa fa-times '></i></a> <?php
echo $model['Pname'];
?>
(<?php
echo $model['Mname'];
?>
)</td>
<td><input class='span1' type='text' name='price[<?php
echo $model['product_id'];
?>
]' value="<?php
echo $price;
?>
" /></td>
<?php
foreach ($depId as $val) {
?>
<td><input class='span1' type='text' name='request[<?php
echo $val['department_id'];
?>
][<?php
示例3: foreach
?>
</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, ',', ' ');
?>
</td>
</tr>
<?php
$cnt++;
}
?>
<?php
foreach ($dishes->getStuff($val['dish_id']) as $key => $value) {
?>
<tr>
<td><?php
示例4: getExpBalance
public function getExpBalance($dates)
{
$summ = 0;
$prod = new Products();
$model = Yii::app()->db->createCommand()->select('ord.just_id,ord.count')->from('expense ex')->join('orders ord', 'ord.expense_id = ex.expense_id')->where('date(ex.order_date) = :dates AND ex.kind = :kind', array(':dates' => $dates, ':kind' => 1))->queryAll();
foreach ($model as $val) {
$summ = $summ + $val['count'] * $prod->getCostPrice($val['just_id'], $dates);
}
return $summ;
}
示例5: array
echo CHtml::link('<i class="icon-eye-open"></i>', array('/halfstaff/view?id=' . $value->just_id), array('target' => '_blank', 'class' => 'btn btn-success edit'));
?>
</td>
</tr>
<?php
}
?>
<?php
$cnt++;
}
?>
<?php
foreach ($model3 as $value) {
?>
<?php
$costPrice = $prod->getCostPrice($value->just_id, $dates);
$price = $prices->getPrice($value->just_id, $value->mType, $value->type, $dates);
if ($costPrice == 0) {
$costPrice = 1;
}
$percent = $price * 100 / $costPrice - 100;
?>
<?php
if ($percent < 50) {
?>
<tr class="error">
<td><?php
echo $cnt;
?>
</td>
<td><?php
示例6: actionAjaxDishIncome
public function actionAjaxDishIncome()
{
$prices = new Prices();
$dishCnt = array();
$dCount = array();
$prodCnt = array();
$pCount = array();
$stuffCnt = array();
$sCount = array();
$dish = new Dishes();
$stuff = new Halfstaff();
$prod = new Products();
$model = Expense::model()->with('order.dish')->findAll('date(t.order_date) BETWEEN :from AND :to', array(':from' => $_POST['from'], ':to' => $_POST['to']));
if (!empty($model)) {
foreach ($model as $value) {
foreach ($value->getRelated('order') as $val) {
$dishes[$val->just_id] = $val->getRelated('dish')->name;
$dishCnt[$val->just_id] = $dishCnt[$val->just_id] + $val->count * $prices->getPrice($val->just_id, $value->mType, $val->type, $value->order_date) - $dish->getCostPrice($val->just_id, $value->order_date);
$dCount[$val->just_id] = $dCount[$val->just_id] + $val->count;
}
}
}
$model2 = Expense::model()->with('order.halfstuff')->findAll('date(t.order_date) BETWEEN :from AND :to', array(':from' => $_POST['from'], ':to' => $_POST['to']));
if (!empty($model2)) {
foreach ($model2 as $value) {
foreach ($value->getRelated('order') as $val) {
$halfstuff[$val->just_id] = $val->getRelated('halfstuff')->name;
$stuffCnt[$val->just_id] = $stuffCnt[$val->just_id] + $val->count * $prices->getPrice($val->just_id, $value->mType, $val->type, $value->order_date) - $stuff->getCostPrice($val->just_id, $value->order_date);
$sCount[$val->just_id] = $sCount[$val->just_id] + $val->count;
}
}
}
$model3 = Expense::model()->with('order.products')->findAll('date(t.order_date) BETWEEN :from AND :to', array(':from' => $_POST['from'], ':to' => $_POST['to']));
if (!empty($model3)) {
foreach ($model3 as $value) {
foreach ($value->getRelated('order') as $val) {
$products[$val->just_id] = $val->getRelated('products')->name;
$prodCnt[$val->just_id] = $prodCnt[$val->just_id] + $val->count * $prices->getPrice($val->just_id, $value->mType, $val->type, $value->order_date) - $prod->getCostPrice($val->just_id, $value->order_date);
$pCount[$val->just_id] = $pCount[$val->just_id] + $val->count;
}
}
}
$this->renderPartial('ajaxDishIncome', array('dishes' => $dishes, 'dishCnt' => $dishCnt, 'halfstuff' => $halfstuff, 'stuffCnt' => $stuffCnt, 'products' => $products, 'prodCnt' => $prodCnt, 'dCount' => $dCount, 'sCount' => $sCount, 'pCount' => $pCount));
}
示例7: elseif
} elseif (number_format($margin - 50, 0, ',', ' ') < number_format($beforeMargin - 50, 0, ',', ' ')) {
?>
<span class="red"><i class="fa fa-caret-down"></i></span>
<?php
}
?>
</th>
</tr>
<?php
$cnt++;
}
?>
<?php
foreach ($model3 as $val) {
$beforeDates = date('Y-m-d', strtotime($dates) - 86400);
$costPrice = $prod->getCostPrice($val['just_id'], $dates);
$price = $prices->getPrice($val['just_id'], $val['mType'], $val['type'], $dates);
$beforeCostPrice = $prod->getCostPrice($val['just_id'], $beforeDates);
$beorePrice = $prices->getPrice($val['just_id'], $val['mType'], $val['type'], $beforeDates);
if ($costPrice == 0) {
$margin = $price * 100 / 1 - 100;
} elseif ($price == 0) {
$margin = 1 * 100 / $costPrice - 100;
} else {
$margin = $price * 100 / $costPrice - 100;
}
if ($beforeCostPrice == 0) {
$beforeMargin = $beorePrice * 100 / 1 - 100;
} elseif ($beorePrice == 0) {
$beforeMargin = 1 * 100 / $beforeCostPrice - 100;
} else {
示例8:
?>
<th><?php
echo $val;
?>
</th>
<?php
}
?>
<th>Прочие</th>
</tr>
</thead>
<tbody>
<?php
foreach ($model as $val) {
$countSum = $faktura->getReqSumCount($val['prod_id'], $id);
$price = $product->getCostPrice($val['prod_id'], $dates);
$summ = $summ + $countSum * $price;
?>
<tr>
<td><?php
echo $cnt;
?>
</td>
<td><?php
echo $val['Pname'];
?>
(<?php
echo $val['Mname'];
?>
)</td>
<td><?php
示例9: getCostPrice
public function getCostPrice($id, $order_date)
{
$log = new Logs();
$stuffSum = 0;
$prodSum = 0;
$model = $log->getStructure($order_date, $id, $this->tableName());
$products = new Products();
$costPrice = array();
if (!empty($model['prod']) && !empty($model['stuff']) && !empty($model['count'])) {
if ($model['count'] == 0) {
$stuff = Yii::app()->db->createCommand()->select('count')->from('halfstaff')->where('halfstuff_id = :id', array(':id' => $id))->queryRow();
$model['count'] = $stuff['count'];
}
} else {
$model = $this->getStruct($id);
}
if (!empty($model)) {
if (!empty($model['prod'])) {
foreach ($model['prod'] as $key => $value) {
$costPrice['prod'][$key] = $products->getCostPrice($key, $order_date) * $value / $model['count'];
}
}
if (!empty($model['stuff'])) {
foreach ($model['stuff'] as $key => $value) {
$costPrice['stuff'][$key] = $this->getCostPrice($key, $order_date) * $value / $model['count'];
}
}
}
if (!empty($costPrice['prod'])) {
$prodSum = array_sum($costPrice['prod']);
} elseif (!empty($costPrice['stuff'])) {
$stuffSum = array_sum($costPrice['stuff']);
}
return $prodSum + $stuffSum;
}
示例10: getDepCost
public function getDepCost($depId, $dates)
{
$summ = 0;
$dish = new Dishes();
$stuff = new Halfstaff();
$prod = new Products();
$model = Yii::app()->db->createCommand()->select('ord.just_id,sum(ord.count) as count')->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 ord.type = :types AND ex.status = :status AND d.department_id = :depId', array(':dates' => $dates, ':types' => 1, ':status' => 0, ':depId' => $depId))->group('ord.just_id')->queryAll();
foreach ($model as $val) {
$summ = $summ + $dish->getCostPrice($val['just_id'], $dates) * $val['count'];
}
$model2 = Yii::app()->db->createCommand()->select('ord.just_id,sum(ord.count) as count')->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 ord.type = :types AND ex.status = :status AND h.department_id = :depId', array(':dates' => $dates, ':types' => 2, ':status' => 0, ':depId' => $depId))->group('ord.just_id')->queryAll();
foreach ($model2 as $val) {
$summ = $summ + $stuff->getCostPrice($val['just_id'], $dates) * $val['count'];
}
$model3 = Yii::app()->db->createCommand()->select('ord.just_id,sum(ord.count) as count')->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 ord.type = :types AND ex.status = :status AND p.department_id = :depId', array(':dates' => $dates, ':types' => 3, ':status' => 0, ':depId' => $depId))->group('ord.just_id')->queryAll();
foreach ($model3 as $val) {
$summ = $summ + $prod->getCostPrice($val['just_id'], $dates) * $val['count'];
}
return $summ;
}
示例11: Products
<label>Продукты</label>
<table class="table table-bordered">
<thead>
<th>название</th>
<th>кол</th>
<th>ед.изм</th>
<th>цена</th>
</thead>
<tbody>
<?php
$sum_prod = 0;
$prodPrice = new Products();
$dates = date('Y-m-d');
foreach ($this->dish_product->getRelated('products') as $key => $val) {
foreach ($this->dish_product->getRelated('dishStruct') as $value) {
$price = $prodPrice->getCostPrice($val->product_id, $dates);
if ($val->product_id == $value->prod_id) {
$amount = $value->amount;
}
}
?>
<tr>
<td><?php
echo $val->name;
?>
</td>
<td><?php
echo $amount;
?>
</td>
<td><?php
示例12: getDepInExp
public function getDepInExp($dates, $depId)
{
$prod = new Products();
$stuff = new Halfstaff();
$summ = 0;
$model = Yii::app()->db->createCommand()->select()->from('dep_faktura df')->join('dep_realize dr', 'dr.dep_faktura_id = df.dep_faktura_id')->where('date(df.real_date) = :dates AND df.department_id != :depId AND df.fromDepId = :fromDepId', array(':dates' => $dates, ':depId' => $depId, ':fromDepId' => $depId))->queryAll();
foreach ($model as $val) {
$summ = $summ + $val['count'] * $prod->getCostPrice($val['prod_id'], $dates);
}
$model2 = Yii::app()->db->createCommand()->select()->from('inexpense inexp')->join('inorder inord', 'inord.inexpense_id = inexp.inexpense_id')->where('date(inexp.inexp_date) = :dates AND inexp.department_id != :depId AND inexp.fromDepId = :fromDepId', array(':dates' => $dates, ':depId' => $depId, ':fromDepId' => $depId))->queryAll();
foreach ($model2 as $val) {
$summ = $summ + $val['count'] * $stuff->getCostPrice($val['stuff_id'], $dates);
}
return $summ;
}
示例13:
</td>
<?php
if ($key == 'price') {
?>
<td><?php
echo number_format($price->getPrice($val['prod_id'], $val['mType'], $val['type'], $dates) * $val['count'], 0, ',', ' ');
?>
</td>
<?php
$sum = $sum + $price->getPrice($val['prod_id'], $val['mType'], $val['type'], $dates) * $val['count'];
?>
<?php
} else {
?>
<td><?php
echo number_format($prod->getCostPrice($val['prod_id'], $dates) * $val['count'], 0, ',', ' ');
?>
</td>
<?php
$sum = $sum + $prod->getCostPrice($val['prod_id'], $dates) * $val['count'];
?>
<?php
}
?>
</tr>
<?php
$cnt++;
}
}
}
if (!empty($model2)) {