Обновлены округления
Добавлены миграции
This commit is contained in:
miroman-afk
2023-08-15 12:19:34 +03:00
parent a7c1679d12
commit 229ab8667e
3 changed files with 37 additions and 11 deletions

View File

@@ -614,7 +614,7 @@ class GETDataReport extends HRCCommand implements HRCCommandInterface
foreach ($actionsResult as $actionResult) { foreach ($actionsResult as $actionResult) {
foreach ($actionResult->deletedActions as $item) { foreach ($actionResult->deletedActions as $item) {
$count = round(Base::toFloat($item['value']), 2); $count = round(Base::toFloat($item['value']), 3);
$who = Staff::getName(intval($item['who'])); $who = Staff::getName(intval($item['who']));
$time = $item['time']; $time = $item['time'];
$reason = Reasons::getName(intval($item['reason'])); $reason = Reasons::getName(intval($item['reason']));
@@ -713,7 +713,7 @@ class GETDataReport extends HRCCommand implements HRCCommandInterface
$orders = []; $orders = [];
foreach ($actionsResult as $actionResult) { foreach ($actionsResult as $actionResult) {
foreach ($actionResult->deletedActions as $item) { foreach ($actionResult->deletedActions as $item) {
$count = round(Base::toFloat($item['value']), 2); $count = round(Base::toFloat($item['value']), 3);
$who = Staff::getName(intval($item['who'])); $who = Staff::getName(intval($item['who']));
$time = $item['time']; $time = $item['time'];
$reason = Reasons::getName(intval($item['reason'])); $reason = Reasons::getName(intval($item['reason']));
@@ -1059,7 +1059,7 @@ class GETDataReport extends HRCCommand implements HRCCommandInterface
'message' => 'Отчет по реализации', 'message' => 'Отчет по реализации',
'printers' => $result, 'printers' => $result,
'ret_prints' => $ret_result, 'ret_prints' => $ret_result,
'total_count' => round($total_count, 2), 'total_count' => round($total_count, 3),
'total_sum' => round($total_sum, 2) 'total_sum' => round($total_sum, 2)
); );
} }
@@ -1199,7 +1199,7 @@ class GETDataReport extends HRCCommand implements HRCCommandInterface
'message' => 'Отчет по реализации', 'message' => 'Отчет по реализации',
'printers' => $result, 'printers' => $result,
'ret_prints' => $ret_result, 'ret_prints' => $ret_result,
'total_count' => round($total_count, 2), 'total_count' => round($total_count, 3),
'total_sum' => round($total_sum, 2) 'total_sum' => round($total_sum, 2)
); );
} }
@@ -2174,10 +2174,9 @@ class GETDataReport extends HRCCommand implements HRCCommandInterface
->where('order_position', $item['code']) ->where('order_position', $item['code'])
->get(); ->get();
$create_count = 0; $create_count = 0;
foreach ($create_actions as $create_action) { foreach ($create_actions as $create_action) {
$create_count += Base::toFloat($create_action['value']); $create_count += Base::toFloat($create_action['value']);
if ($create_count <= $item['count']) { if ($create_count <= $item['count'] || count($create_actions) == 1) {
$realPrice = $item['real_price'] * $item['count'] * $item['cof']; $realPrice = $item['real_price'] * $item['count'] * $item['cof'];
$salePrice = $item['sale_price'] * $item['count']; $salePrice = $item['sale_price'] * $item['count'];
if ($realPrice > 0) { if ($realPrice > 0) {
@@ -2190,7 +2189,11 @@ class GETDataReport extends HRCCommand implements HRCCommandInterface
$item_dishes_code = $item['dishes_code']; $item_dishes_code = $item['dishes_code'];
$item_order_code = $item['order_code']; $item_order_code = $item['order_code'];
$item_units_id = $item['units_id']; $item_units_id = $item['units_id'];
$item_count = Base::toFloat($create_action['value']); if (count($create_actions) == 1) {
$item_count = $item['count'];
} else {
$item_count = Base::toFloat($create_action['value']);
}
$item_cof = $item['cof']; $item_cof = $item['cof'];
$item_real_price = $item['real_price']; $item_real_price = $item['real_price'];
$item_sale_price = $item['sale_price']; $item_sale_price = $item['sale_price'];
@@ -2221,9 +2224,9 @@ class GETDataReport extends HRCCommand implements HRCCommandInterface
'item_units_name' => Units::getName($item_units_id), 'item_units_name' => Units::getName($item_units_id),
'item_cof' => floatval($item_cof), 'item_cof' => floatval($item_cof),
'item_count' => $item_count, 'item_count' => $item_count,
'item_real_price' => floatval($item_real_price), 'item_real_price' => floatval($item_count * $item_real_price),
'item_sale_price' => floatval($item_sale_price), 'item_sale_price' => floatval($item_count * $item_sale_price),
'item_special_price' => floatval($item_special_price), 'item_special_price' => floatval($item_count * $item_special_price),
'item_cash' => $item_cash, 'item_cash' => $item_cash,
'item_credit' => $item_credit, 'item_credit' => $item_credit,
'item_presale' => $item_presale, 'item_presale' => $item_presale,

View File

@@ -25,6 +25,18 @@ class UpdateItemCountAndItemPriceInOrderItemsToFloatV2 extends Migration
Schema::table('shift_online_deleted', function (Blueprint $table) { Schema::table('shift_online_deleted', function (Blueprint $table) {
$table->decimal('count', $precision = 16, $scale = 3)->nullable()->change(); $table->decimal('count', $precision = 16, $scale = 3)->nullable()->change();
}); });
Schema::table('exchange_items', function (Blueprint $table) {
$table->decimal('count', $precision = 16, $scale = 3)->nullable()->change();
});
Schema::table('exchange_items', function (Blueprint $table) {
$table->decimal('count_return', $precision = 16, $scale = 3)->nullable()->change();
});
Schema::table('exchange_items', function (Blueprint $table) {
$table->decimal('count_real', $precision = 16, $scale = 3)->nullable()->change();
});
Schema::table('exchange_deleted', function (Blueprint $table) {
$table->decimal('count', $precision = 16, $scale = 3)->nullable()->change();
});
} }
/** /**
@@ -46,5 +58,17 @@ class UpdateItemCountAndItemPriceInOrderItemsToFloatV2 extends Migration
Schema::table('shift_online_deleted', function (Blueprint $table) { Schema::table('shift_online_deleted', function (Blueprint $table) {
$table->decimal('count', $precision = 16, $scale = 2)->nullable()->change(); $table->decimal('count', $precision = 16, $scale = 2)->nullable()->change();
}); });
Schema::table('exchange_items', function (Blueprint $table) {
$table->decimal('count', $precision = 16, $scale = 2)->nullable()->change();
});
Schema::table('exchange_items', function (Blueprint $table) {
$table->decimal('count_return', $precision = 16, $scale = 2)->nullable()->change();
});
Schema::table('exchange_items', function (Blueprint $table) {
$table->decimal('count_real', $precision = 16, $scale = 2)->nullable()->change();
});
Schema::table('exchange_deleted', function (Blueprint $table) {
$table->decimal('count', $precision = 16, $scale = 2)->nullable()->change();
});
} }
} }

View File

@@ -183,7 +183,6 @@ class ShiftOnlineOrders extends Model
if ($order_status == "Возвращен" || $order_status == "Возвращен частично") { if ($order_status == "Возвращен" || $order_status == "Возвращен частично") {
$returned_items = self::getReturnedItems($order['code']); $returned_items = self::getReturnedItems($order['code']);
Log::debug($returned_items);
foreach ($returned_items as $returned_item) { foreach ($returned_items as $returned_item) {
$returned_sum += round(abs($returned_item['sale_price']) * $returned_item['count'], 2); $returned_sum += round(abs($returned_item['sale_price']) * $returned_item['count'], 2);
$returned_count += $returned_item['count']; $returned_count += $returned_item['count'];