v.2.34
Исправлен пересчет весовых товаров в онлайн реализации
This commit is contained in:
@@ -92,7 +92,6 @@ class GETDashboard extends HRCCommand implements HRCCommandInterface
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
|
||||
foreach ($order_items as $order_item) {
|
||||
$profit += $order_item['profit'];
|
||||
}
|
||||
|
||||
@@ -2416,13 +2416,22 @@ class GETDataReport extends HRCCommand implements HRCCommandInterface
|
||||
|
||||
if ($reportType == 'presales') {
|
||||
$code = Filesystem::GetCode($input['token']);
|
||||
$cache = Cache::get($code, 'shift', $input);
|
||||
if (isset($input['shift_id'])) {
|
||||
$plugin = 'shift';
|
||||
}
|
||||
if (isset($input['start_date']) && isset($input['end_date'])) {
|
||||
$plugin = 'report';
|
||||
}
|
||||
$cache = Cache::get($code, $plugin, $input);
|
||||
if ($cache) {
|
||||
return $cache;
|
||||
}
|
||||
if (isset($input['shift_id'])) {
|
||||
|
||||
|
||||
if (isset($input['shift_id'])) {
|
||||
$collection = new Collection();
|
||||
}
|
||||
|
||||
if (isset($input['start_date']) && isset($input['end_date'])) {
|
||||
$end_date = date('Y-m-d H:i:s', strtotime($input['end_date'] . ' 23:59:59'));
|
||||
$start_date = date('Y-m-d H:i:s', strtotime($input['start_date'] . ' 00:00:01'));
|
||||
@@ -2436,6 +2445,14 @@ class GETDataReport extends HRCCommand implements HRCCommandInterface
|
||||
}
|
||||
}
|
||||
|
||||
$return = array(
|
||||
'status' => 'success',
|
||||
'data' => $collection
|
||||
);
|
||||
if (!$cache) {
|
||||
$cache = Cache::store(strval($code), $plugin, $input, $return);
|
||||
}
|
||||
return $cache;
|
||||
}
|
||||
} else {
|
||||
return [
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class UpdateItemCountAndItemPriceInOrderItemsToFloatV2 extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('order_items', function (Blueprint $table) {
|
||||
$table->decimal('item_price', $precision = 16, $scale = 2)->nullable()->change();
|
||||
});
|
||||
Schema::table('order_items', function (Blueprint $table) {
|
||||
$table->decimal('item_count', $precision = 16, $scale = 3)->nullable()->change();
|
||||
});
|
||||
Schema::table('shift_online_items', function (Blueprint $table) {
|
||||
$table->decimal('count', $precision = 16, $scale = 3)->nullable()->change();
|
||||
});
|
||||
Schema::table('shift_online_deleted', function (Blueprint $table) {
|
||||
$table->decimal('count', $precision = 16, $scale = 3)->nullable()->change();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('order_items', function (Blueprint $table) {
|
||||
$table->integer('item_price')->nullable()->change();
|
||||
});
|
||||
Schema::table('order_items', function (Blueprint $table) {
|
||||
$table->integer('item_count')->nullable()->change();
|
||||
});
|
||||
Schema::table('shift_online_items', function (Blueprint $table) {
|
||||
$table->decimal('count', $precision = 16, $scale = 2)->nullable()->change();
|
||||
});
|
||||
Schema::table('shift_online_deleted', function (Blueprint $table) {
|
||||
$table->decimal('count', $precision = 16, $scale = 2)->nullable()->change();
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -29,7 +29,7 @@ class ExchangeOrders extends Model
|
||||
->first();
|
||||
$start_order_info[] = array(
|
||||
'code' => intval($start_order_item['more']),
|
||||
'count' => floatval($start_order_item['value']),
|
||||
'count' => Base::tofloat($start_order_item['value']),
|
||||
'sale_price' => $item['sale_price'],
|
||||
'special_price' => $item['special_price']
|
||||
);
|
||||
|
||||
@@ -26,7 +26,7 @@ class ShiftOnlineOrders extends Model
|
||||
->first();
|
||||
$start_order_info[] = array(
|
||||
'code' => intval($start_order_item['more']),
|
||||
'count' => floatval($start_order_item['value']),
|
||||
'count' => Base::tofloat($start_order_item['value']),
|
||||
'sale_price' => $item['sale_price'],
|
||||
'special_price' => $item['special_price']
|
||||
);
|
||||
@@ -71,7 +71,6 @@ class ShiftOnlineOrders extends Model
|
||||
} else {
|
||||
$end_order = $start_order_info;
|
||||
}
|
||||
|
||||
return $end_order;
|
||||
}
|
||||
|
||||
@@ -184,6 +183,7 @@ class ShiftOnlineOrders extends Model
|
||||
|
||||
if ($order_status == "Возвращен" || $order_status == "Возвращен частично") {
|
||||
$returned_items = self::getReturnedItems($order['code']);
|
||||
Log::debug($returned_items);
|
||||
foreach ($returned_items as $returned_item) {
|
||||
$returned_sum += round(abs($returned_item['sale_price']) * $returned_item['count'], 2);
|
||||
$returned_count += $returned_item['count'];
|
||||
@@ -216,6 +216,7 @@ class ShiftOnlineOrders extends Model
|
||||
foreach ($items as $key => $item) {
|
||||
$realPrice = $item['real_price'] * $item['count'] * $item['cof'];
|
||||
$salePrice = $item['sale_price'] * $item['count'];
|
||||
$specialPrice = $item['special_price'] * $item['count'];
|
||||
if ($realPrice > 0) {
|
||||
$discount = $salePrice / $realPrice;
|
||||
$discount = (1 - $discount) * 100;
|
||||
@@ -239,15 +240,13 @@ class ShiftOnlineOrders extends Model
|
||||
'amount' => round($item['sale_price'] * $item['count'], 2),
|
||||
'discount' => round($discount),
|
||||
'total_count' => floatval($item['count']),
|
||||
'profit' => floatval($item['count']) * round($item['sale_price'], 2) - floatval($item['count']) * round($item['special_price'], 2)
|
||||
'profit' => $salePrice - $specialPrice
|
||||
);
|
||||
|
||||
foreach ($deleted_items as $deleted_item) {
|
||||
if ($item['menu_code'] == $deleted_item['menu_code']) {
|
||||
$order_info[$key]['deleted_count'] = $deleted_item['count'];
|
||||
$order_info[$key]['total_count'] = $order_info[$key]['total_count'] - $deleted_item['count'];
|
||||
$order_info[$key]['deleted_sum'] = abs($deleted_item['sale_price']) * $deleted_item['count'];
|
||||
$order_info[$key]['profit'] = $order_info[$key]['total_count'] * round($item['sale_price'], 2) - $order_info[$key]['total_count'] * round($item['special_price'], 2);
|
||||
$deleted_count += $deleted_item['count'];
|
||||
$deleted_sum += abs($deleted_item['sale_price']) * $deleted_item['count'];
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@
|
||||
|
||||
var timer = $interval(function () {
|
||||
$scope.currentDate = new Date();
|
||||
}, 1000);
|
||||
}, 5000);
|
||||
|
||||
$scope.nextImage = function () {
|
||||
$('.carousel').carousel('next');
|
||||
@@ -83,7 +83,7 @@
|
||||
|
||||
//Автоматическое обновление данных
|
||||
$scope.timerEnabled = false;
|
||||
$scope.timeRemaining = new Date(0, 0, 0, 0, 1, 0);
|
||||
$scope.timeRemaining = new Date(0, 0, 0, 0, 5, 0);
|
||||
var updateTimer = null;
|
||||
|
||||
$scope.toggleTimer = function () {
|
||||
@@ -134,29 +134,6 @@
|
||||
paging: false,
|
||||
info: false,
|
||||
};
|
||||
|
||||
/* $scope.dtoptions = {
|
||||
/!*dom: "lfBrtip",*!/
|
||||
language: {
|
||||
url: "https://cdn.datatables.net/plug-ins/1.13.3/i18n/ru.json",
|
||||
},
|
||||
autoWidth: true,
|
||||
searching: true,
|
||||
paging: false,
|
||||
info: false,
|
||||
aoColumns: [
|
||||
{title: "#"},
|
||||
{title: "Гость", visible: false},
|
||||
{title: "Статус", className: "text-right"},
|
||||
{title: "Открыт", className: "text-right"},
|
||||
{title: "Закрыт", className: "text-right"},
|
||||
{title: "Сумма, BYN", className: "text-right"}
|
||||
]
|
||||
/!*buttons: [
|
||||
{text: 'Экспорт в PDF', className: 'md-btn md-raised m-b-sm blue', extend: 'pdf'},
|
||||
]*!/
|
||||
};*/
|
||||
|
||||
$scope.orders_closed = {
|
||||
percent: 0,
|
||||
total: 0,
|
||||
|
||||
Reference in New Issue
Block a user