Mass_update - improved logfunction

This commit is contained in:
“VeLiTi”
2024-03-28 19:10:47 +01:00
parent bf1dd72a39
commit 23a4472f12
2 changed files with 20 additions and 7 deletions

View File

@@ -84,7 +84,7 @@ if(isset($get_content) && $get_content!=''){
//------------------------------------------ //------------------------------------------
switch ($action) { switch ($action) {
case 'get_rowID': case 'get_rowID':
$sql = 'SELECT e.rowID from equipment e '.$whereclause.''; $sql = 'SELECT e.rowID, p.productcode, p.productname from equipment e LEFT JOIN products p ON e.productrowid = p.rowID '.$whereclause.'';
break; break;

View File

@@ -40,13 +40,23 @@ if ($update_allowed === 1){
$total_rowID = 0; $total_rowID = 0;
$total_not_found = 0; $total_not_found = 0;
$output_excel_display .= '<table class="sortable">
<thead>
<tr>
<th>'.$equipment_label2.'</th>
<th>'.$product_code.'</th>
<th>'.$product_name.'</th>
<th>'.$product_status.'</th>
</tr>
</thead>
<tbody>';
foreach ($excel_data_1 as $key => $val){ foreach ($excel_data_1 as $key => $val){
//GET ROW ID //GET ROW ID
$api_url = '/v1/application/serialnumber='.$val.'/get_rowID'; $api_url = '/v1/application/serialnumber='.$val.'/get_rowID';
$responses = ioServer($api_url,''); $responses = ioServer($api_url,'');
//Decode Payload //Decode Payload
if (!empty($responses)){$responses = decode_payload($responses);}else{$responses = null;} if (!empty($responses)){$responses = decode_payload($responses);}else{$responses = null;}
@@ -54,6 +64,8 @@ if ($update_allowed === 1){
if (isset ($responses->rowID)){ if (isset ($responses->rowID)){
$output_excel[$val]['rowID'] = $responses->rowID; $output_excel[$val]['rowID'] = $responses->rowID;
$output_excel[$val]['serialnumber'] = $val; $output_excel[$val]['serialnumber'] = $val;
$output_excel[$val]['productcode'] = $responses->productcode;
$output_excel[$val]['productname'] = $responses->productname;
$output_excel[$val]['order_ref'] = $_POST['order_ref']; $output_excel[$val]['order_ref'] = $_POST['order_ref'];
$output_excel[$val]['status'] = $_POST['status']; $output_excel[$val]['status'] = $_POST['status'];
$output_excel[$val]['salesid'] = $_POST['salesid']; $output_excel[$val]['salesid'] = $_POST['salesid'];
@@ -67,7 +79,7 @@ if ($update_allowed === 1){
} }
else else
{ {
$output_excel_display .= $equipment_label2.' '.$val.' - '.$mass_update_not_found.'<br>'; $output_excel_display .= '<tr><td>'.$val.'</td><td></td><td></td><td>'.$mass_update_not_found.'</td></tr>';
//Count total_not_found //Count total_not_found
$total_not_found++; $total_not_found++;
} }
@@ -86,13 +98,14 @@ if ($update_allowed === 1){
} }
else { else {
$output_excel_display .= $equipment_label2.' '.$data_to_update['serialnumber'].' - '.$mass_update_correct.'<br>'; $output_excel_display .= '<tr><td>'.$data_to_update['serialnumber'].'</td><td>'.$data_to_update['productcode'].'</td><td>'.$data_to_update['productname'].'</td><td>'.$mass_update_correct.'</td></tr>';
} }
} }
//Totals //Totals
$total_input = $total_rowID + $total_not_found; $total_input = $total_rowID + $total_not_found;
$total_summary = '('.$total_rowID.$general_page_of.$total_input.')<br>'; $total_summary = '('.$total_rowID.$general_page_of.$total_input.')<br>';
$output_excel_display .= '</tbody></table>';
} }
} }
@@ -209,9 +222,9 @@ if ($update_allowed === 1){
<div class="block-header"> <div class="block-header">
<i class="fa-solid fa-bars fa-sm"></i>'.$tab3.' '.$total_summary.' <i class="fa-solid fa-bars fa-sm"></i>'.$tab3.' '.$total_summary.'
</div> </div>
<div id="excel_table"> <div class="table order-table" id="excel_table">
'.$output_excel_display.' '.$output_excel_display.'
<table> </div>
</div> </div>
'; ';
} }