v.2.22
Редактор карты зала Электронные заказы Отчет по удалениям
This commit is contained in:
@@ -78,35 +78,6 @@ class GETOrderHistory extends HRCCommand implements HRCCommandInterface {
|
||||
return true;
|
||||
}
|
||||
|
||||
function dishName($data) {
|
||||
$dish_name = Dishes::where('code', $data)->where('is_history', 0)->first();
|
||||
if ($dish_name) {
|
||||
$dish_name = $dish_name['name'];
|
||||
} else {
|
||||
$dish_name = Dishes::where('code', $data)->where('is_history', 1)->first();
|
||||
if ($dish_name) {
|
||||
$dish_name = $dish_name['name'];
|
||||
} else {
|
||||
$dish_name = 'Связанный товар удален';
|
||||
}
|
||||
}
|
||||
return $dish_name;
|
||||
}
|
||||
|
||||
function staffName($data) {
|
||||
$staff_name = Staff::where('code', $data)->where('is_history', 0)->first();
|
||||
if ($staff_name) {
|
||||
$staff_name = $staff_name['name'];
|
||||
} else {
|
||||
$staff_name = Staff::where('code', $data)->where('is_history', 1)->first();
|
||||
if ($staff_name) {
|
||||
$staff_name = $staff_name['name'];
|
||||
} else {
|
||||
$staff_name = 'Связанный персонал не найден';
|
||||
}
|
||||
}
|
||||
return $staff_name;
|
||||
}
|
||||
|
||||
function data_decode($data) {
|
||||
$alph = [
|
||||
@@ -166,7 +137,7 @@ class GETOrderHistory extends HRCCommand implements HRCCommandInterface {
|
||||
foreach ($order as $key => $item) {
|
||||
$action_type = ActionTypes::where('type_id', $item['type_action'])->first();
|
||||
$action_name = $action_type['name'];
|
||||
$staff_name = staffName($item['who']);
|
||||
$staff_name = Staff::getName($item['who']);
|
||||
|
||||
if ($item['type_action'] == 1) {
|
||||
$action_name = 'Заказ создан';
|
||||
@@ -181,7 +152,7 @@ class GETOrderHistory extends HRCCommand implements HRCCommandInterface {
|
||||
} else {
|
||||
$unit_name = 'шт';
|
||||
}
|
||||
$dish = dishName($item['more']);
|
||||
$dish = Dishes::getName($item['more']);
|
||||
$action_name = $action_name . ': ' . $dish . ' в количестве ' . $item['value'] . ' ' . $unit_name;
|
||||
}
|
||||
|
||||
@@ -195,7 +166,7 @@ class GETOrderHistory extends HRCCommand implements HRCCommandInterface {
|
||||
$unit_name = 'шт';
|
||||
}
|
||||
|
||||
$dish = dishName($shiftOnlineDeletedItem['dishes_code']);
|
||||
$dish = Dishes::getName($shiftOnlineDeletedItem['dishes_code']);
|
||||
$action_name = $action_name . ': ' . $dish . ' в количестве ' . $item['value'] . ' ' . $unit_name;
|
||||
}
|
||||
|
||||
@@ -220,7 +191,7 @@ class GETOrderHistory extends HRCCommand implements HRCCommandInterface {
|
||||
}
|
||||
|
||||
if ($item['type_action'] == 22) {
|
||||
$dish = dishName($item['order_position']);
|
||||
$dish = Dishes::getName($item['order_position']);
|
||||
$action_name = 'Отменена позиции: ' . $dish . ' в количестве ' . $item['value'];
|
||||
}
|
||||
|
||||
@@ -263,13 +234,12 @@ class GETOrderHistory extends HRCCommand implements HRCCommandInterface {
|
||||
} else {
|
||||
$slice_order_items = json_decode(utf8_encode(base64_decode($item['more'], TRUE)), true, JSON_INVALID_UTF8_SUBSTITUTE);
|
||||
}
|
||||
//$slice_order_items = json_decode(utf8_encode($item['more']), true, JSON_INVALID_UTF8_SUBSTITUTE);
|
||||
$slice_order_items = $slice_order_items['items'];
|
||||
$slice_order = $item['value'];
|
||||
foreach ($slice_order_items as $key => $slice_order_item) {
|
||||
$slice_items[] = array('id' => $key + 1, 'name' => $slice_order_item['name'], 'count' => $slice_order_item['count']);
|
||||
}
|
||||
$staff_name = staffName($item['who']);
|
||||
$staff_name = Staff::getName($item['who']);
|
||||
$sliced_order_items[] = array('order' => $slice_order, 'time' => date('d.m.Y H:i:s', strtotime($item['time'])), 'staff' => $staff_name, 'items' => $slice_items);
|
||||
$slice_trigger = 1;
|
||||
}
|
||||
@@ -282,16 +252,18 @@ class GETOrderHistory extends HRCCommand implements HRCCommandInterface {
|
||||
->where('type_action', 32)
|
||||
->get();
|
||||
foreach ($item_actions as $key => $item_action) {
|
||||
if ($item_action['more']) {
|
||||
if ($item_action['more'] != '') {
|
||||
$merge_items_before = $merge_items_after = $merge_items = $merge_order_item_before = $merge_order_item_after = $merged_items = [];
|
||||
if (json_validate($item['more'])) {
|
||||
if (json_validate($item_action['more'])) {
|
||||
$merge_order_items = json_decode(utf8_encode($item_action['more']), true, JSON_INVALID_UTF8_SUBSTITUTE);
|
||||
} else {
|
||||
$merge_order_items = json_decode(utf8_encode(base64_decode($item_action['more'])), true, JSON_INVALID_UTF8_SUBSTITUTE);
|
||||
$merge_order_items = json_decode(base64_decode($item_action['more']), true);
|
||||
}
|
||||
|
||||
//$merge_order_items = json_decode(utf8_encode($item_action['more']), true, JSON_INVALID_UTF8_SUBSTITUTE);
|
||||
$merge_order_items_before = $merge_order_items['before']['items'];
|
||||
$merge_order_items_after = $merge_order_items['after']['items'];
|
||||
|
||||
foreach ($merge_order_items_before as $key => $merge_order_item_before) {
|
||||
$merge_items_before[] = array('id' => $key + 1,
|
||||
'code' => $merge_order_item_before['id'],
|
||||
@@ -320,7 +292,7 @@ class GETOrderHistory extends HRCCommand implements HRCCommandInterface {
|
||||
'name' => $merged_item['name'],
|
||||
'count' => $merged_item['count']);
|
||||
}
|
||||
$staff_name = staffName($item['who']);
|
||||
$staff_name = Staff::getName($item['who']);
|
||||
$merged_order_items[] = array('order' => $merge_order, 'time' => date('d.m.Y H:i:s', strtotime($item['time'])), 'staff' => $staff_name, 'items' => $merge_items);
|
||||
$merge_trigger = 1;
|
||||
}
|
||||
@@ -332,7 +304,7 @@ class GETOrderHistory extends HRCCommand implements HRCCommandInterface {
|
||||
->where('type_action', 39)
|
||||
->get();
|
||||
foreach ($order_data as $key => $data) {
|
||||
$staff_name = staffName($data['who']);
|
||||
$staff_name = Staff::getName($data['who']);
|
||||
$moved_order_data[] = array('staff_name' => $staff_name, 'time' => date('d.m.Y H:i:s', strtotime($data['time'])), 'data' => data_decode($data['value']));
|
||||
$move_trigger = 1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user