foreach ($items as $item) {
$itemCount = abs($item->fact_and_1c_diff);
$er = EqualizationRemains::find()
- ->andWhere(['shift_transfer_id' => $shiftTransfer->id])
- ->andWhere(['product_id' => $item->product_guid])
- ->select('SUM(product_replacement_count) as sum')
- ->scalar();
-
- $count = $itemCount;
+ ->andWhere(['shift_transfer_id' => $shiftTransfer->id])
+ ->andWhere(['product_id' => $item->product_guid])
+ ->select('SUM(product_replacement_count) as sum')
+ ->scalar();
if ($er) {
if ($er == $itemCount) {
continue;
}
-
if ($itemCount > $er) {
$count = $itemCount - $er;
+ if ($count == 0) {
+ continue;
+ }
}
+ } else {
+ $count = $itemCount;
}
$model = new self();
return $this->hasOne(WaybillWriteOffs::class, ['id' => 'waybill_write_offs_id']);
}
- public function getProduct() {
+ public function getProduct()
+ {
return $this->hasOne(Products1c::class, ['id' => 'product_id']);
}
}
'label' => 'Количество товара',
'format' => 'raw',
'pageSummary' => true,
- 'footer' => Html::tag('b', $totalBalance < 0 ? 'Недостача: ' : 'Избыток: ')
+ 'footer' => Html::tag('b',
+ $totalBalance < 0 ? 'Недостача: ' : ($totalBalance == 0 ? '' : 'Избыток: '))
+
],
[
'attribute' => 'balance',