public function actionMonthStorage() { $dates = explode('-', $_POST['dates']); $depId = $_POST['depId']; $number = cal_days_in_month(CAL_GREGORIAN, $dates[1], $dates[0]); $realized = array(); $expense = new Expense(); $expenses = array(); $startCount = array(); $endCount = array(); $depRealize = new DepFaktura(); $inexp = new Expense(); $balance = new Balance(); for ($i = 1; $i <= $number; $i++) { $tempDate = $dates[0] . "-" . $dates[1] . "-" . $i; $listDate[$i] = $tempDate; $realized[$tempDate] = $depRealize->getDepRealizesSumm($tempDate, $depId); $expenses[$tempDate] = $expense->getDepCost($depId, $tempDate); $tempBalance = $balance->getDepBalanceSumm($tempDate, $depId); $startCount[$tempDate] = $tempBalance[0]; $endCount[$tempDate] = $tempBalance[1]; $curEndCount[$tempDate] = $tempBalance[2]; } $this->renderPartial('monthStorage', array('tempDate' => $listDate, 'realized' => $realized, 'expenses' => $expenses, 'startCount' => $startCount, 'endCount' => $endCount, 'curEndCount' => $curEndCount, 'depId' => $depId)); }
<th>Остаток план</th> <th>Остаток Факт.</th> <th style="padding: 8px 16px!important;">Выручка</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 = $expense->getDepCost($val['department_id'], $dates); $realized = $depRealize->getDepRealizesSumm($dates, $val['department_id']); $inRealized = $depRealize->getDepInRealizesSumm($dates, $val['department_id']); $inexp = $depRealize->getDepInExp($dates, $val['department_id']); $price = $expense->getDepIncome($val['department_id'], $dates); $tempBalance = $balance->getDepBalanceSumm($dates, $val['department_id']); //$beforeTempBalance = $balance->getDepBalanceSumm($beforeDates,$val['department_id']); //$beforeCostPrice = $expense->getDepCost($val['department_id'],$beforeDates); //$beforePrice = $expense->getDepIncome($val['department_id'],$beforeDates); $sumCostPrice = $sumCostPrice + $costPrice; $sumPrice = $sumPrice + $price; $startCount = $startCount + $tempBalance[0]; $endCount = $endCount + $tempBalance[1]; $curEndCount = $curEndCount + $tempBalance[2]; $sumRealized = $sumRealized + $realized; $sumInRealized = $sumInRealized + $inRealized;