示例#1
0
            <th></th>
            <th>Наименование блюд</th>
            <th>Себестоимость</th>
            <th>Установленная цена</th>
            <th>Установленная наценка</th>
            <th>Текущая наценка</th>
            <th></th>
        </tr>
    </thead>
    <tbody>
        <?php 
foreach ($model as $value) {
    ?>
            <?php 
    $costPrice = $dish->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 
        echo $value->getRelated('dish')->name;
示例#2
0
 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));
 }
示例#3
0
            <th></th>
            <th>Наимен. блюда</th>
            <th>Себестоимость (сум)</th>
            <th>Цена реализации (сум)</th>
            <th>наценка план (%)</th>
            <th>наценка факт (%)</th>
            <th>отклон (+,-)</th>
            <th>тренд ср.стат.</th>
        </tr>
    </thead>
    <tbody>
        <?php 
foreach ($model as $val) {
    $beforeDates = date('Y-m-d', strtotime($dates) - 86400);
    $costPrice = $dish->getCostPrice($val['just_id'], $dates);
    $price = $prices->getPrice($val['just_id'], $val['mType'], $val['type'], $dates);
    $beforeCostPrice = $dish->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 {
        $beforeMargin = $beorePrice * 100 / $beforeCostPrice - 100;
示例#4
0
 public function getExpenseSum($id, $dates)
 {
     $summ = 0;
     $prices = new Prices();
     $model = Expense::model()->with('order.dish')->findByPk($id);
     $model2 = Expense::model()->with('order.halfstuff')->findByPk($id);
     $model3 = Expense::model()->with('order.products')->findByPk($id);
     if (!empty($model)) {
         foreach ($model->getRelated('order') as $val) {
             $summ = $summ + $prices->getPrice($val->just_id, 1, 1, $dates) * $val->count;
         }
     }
     if (!empty($model2)) {
         foreach ($model2->getRelated('order') as $val) {
             $summ = $summ + $prices->getPrice($val->just_id, 1, 2, $dates) * $val->count;
         }
     }
     if (!empty($model3)) {
         foreach ($model3->getRelated('order') as $val) {
             $summ = $summ + $prices->getPrice($val->just_id, 1, 3, $dates) * $val->count;
         }
     }
     return $summ;
 }
示例#5
0
 public function getMenuList()
 {
     $menuList = array();
     $price = new Prices();
     $dates = date('Y-m-d');
     $dishModel = Menu::model()->with('dish')->findAll();
     $stuffModel = Menu::model()->with('halfstuff')->findAll();
     $prodModel = Menu::model()->with('products')->findAll();
     foreach ($dishModel as $val) {
         $menuList['dish_' . $val->just_id] = $val->getRelated('dish')->name . "_" . $price->getPrice($val->just_id, $val->mType, $val->type, $dates);
     }
     foreach ($stuffModel as $val) {
         $menuList['stuff_' . $val->just_id] = $val->getRelated('halfstuff')->name . "_" . $price->getPrice($val->just_id, $val->mType, $val->type, $dates);
     }
     foreach ($prodModel as $val) {
         $menuList['product_' . $val->just_id] = $val->getRelated('products')->name . "_" . $price->getPrice($val->just_id, $val->mType, $val->type, $dates);
     }
     return $menuList;
 }
示例#6
0
    echo $value->menu_id;
    ?>
' />
                            <input type='text' style='display: none;' name='dish[type][]' value='<?php 
    echo $id;
    ?>
' />
                            <input type='text' style='display: none;' name='dish[id][]' value='<?php 
    echo $value->getRelated('dish')->dish_id;
    ?>
' /><?php 
    echo $value->getRelated('dish')->name;
    ?>
</td>
                        <td style='text-align:center;'><input type="text" class='span2' value="<?php 
    echo $prices->getPrice($value->getRelated('dish')->dish_id, $mType, 1, date('Y-m-d'));
    ?>
" name="dish[price][]"/></td>
                        <td style='text-align:center;'>
                            <select name="dish[dep][]" class="span2">
                            <?php 
    foreach ($listDep as $key => $dep) {
        ?>
                                <?php 
        if ($key == $value->getRelated('dish')->department_id) {
            ?>
                                <option value="<?php 
            echo $key;
            ?>
" selected="selected"><?php 
            echo $dep;
示例#7
0
        <thead>
            <tr>
                <th></th>
                <th>Название</th>
                <th>Количество</th>
                <th>Цена</th>
                <th>Сумма</th>                
            </tr>
        </thead>
        <tbody>
            <?php 
foreach ($dishModel as $value) {
    ?>
                <?php 
    foreach ($value->getRelated('order') as $key => $val) {
        $price = $prices->getPrice($val->just_id, $value->mType, $val->type, $value->order_date);
        ?>
                <tr>                
                    <td><?php 
        echo $count;
        ?>
</td>            
                    <td><?php 
        echo $val->getRelated('dish')->name;
        ?>
</td>
                    <td><?php 
        echo $val->count;
        ?>
</td>
                    <td><?php 
示例#8
0
                    <td><?php 
            echo $val['name'];
            ?>
</td>
                    <td><?php 
            echo number_format($val['count'], 2, ',', '');
            ?>
 <?php 
            echo $val['Mname'];
            ?>
</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'];
                ?>