added old hard code by database names if necessary...
This commit is contained in:
@@ -18,10 +18,30 @@ if(isset($_FILES['f_csv'])) {
|
|||||||
$spreadsheet = IOFactory::load($file, IReader::READ_DATA_ONLY);
|
$spreadsheet = IOFactory::load($file, IReader::READ_DATA_ONLY);
|
||||||
$worksheet = $spreadsheet->getActiveSheet();
|
$worksheet = $spreadsheet->getActiveSheet();
|
||||||
$arr_info = $worksheet->toArray();
|
$arr_info = $worksheet->toArray();
|
||||||
|
|
||||||
|
$productsRefNumber_excelName = '';
|
||||||
|
$reportsNumberLab_excelName = '';
|
||||||
|
$partsCode_excelName = '';
|
||||||
|
|
||||||
if(count($arr_info) > 1) { //check excel rows
|
if(count($arr_info) > 1) { //check excel rows
|
||||||
$arr_excel_columns = $arr_info[0];
|
$arr_excel_columns = $arr_info[0];
|
||||||
$arr_need_columns = array();
|
$arr_need_columns = array();
|
||||||
|
|
||||||
|
foreach ($arr_associate as $item){
|
||||||
|
if($item['column_name'] == 'products_refnumber'){
|
||||||
|
$productsRefNumber_excelName = $item['headerfile'];
|
||||||
|
}
|
||||||
|
if($item['column_name'] == 'reportsNumberLab'){
|
||||||
|
$reportsNumberLab_excelName = $item['headerfile'];
|
||||||
|
}
|
||||||
|
if($item['column_name'] == 'partsCode'){
|
||||||
|
$partsCode_excelName = $item['headerfile'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
array_push($arr_need_columns, $productsRefNumber_excelName);
|
||||||
|
array_push($arr_need_columns, $reportsNumberLab_excelName);
|
||||||
|
array_push($arr_need_columns, $partsCode_excelName);
|
||||||
|
|
||||||
$result_testNameHeaderFile = ""; //for analysisvocabulary
|
$result_testNameHeaderFile = ""; //for analysisvocabulary
|
||||||
$result_AnalytsNameHeaderFile = ""; //for compundsvocabulary
|
$result_AnalytsNameHeaderFile = ""; //for compundsvocabulary
|
||||||
|
|
||||||
|
|||||||
@@ -44,6 +44,10 @@ if (isset($_FILES['f_csv'])) {
|
|||||||
$arr_associate_data->execute();
|
$arr_associate_data->execute();
|
||||||
$arr_associate = $arr_associate_data->Results;
|
$arr_associate = $arr_associate_data->Results;
|
||||||
|
|
||||||
|
$productsRefNumber_excelName = '';
|
||||||
|
$reportsNumberLab_excelName = '';
|
||||||
|
$partsCode_excelName = '';
|
||||||
|
|
||||||
if (count($arr_associate) > 0) { //check define columns
|
if (count($arr_associate) > 0) { //check define columns
|
||||||
$spreadsheet = IOFactory::load($file);
|
$spreadsheet = IOFactory::load($file);
|
||||||
$worksheet = $spreadsheet->getActiveSheet();
|
$worksheet = $spreadsheet->getActiveSheet();
|
||||||
@@ -51,6 +55,20 @@ if (isset($_FILES['f_csv'])) {
|
|||||||
if (count($arr_info) > 1) { //check excel rows
|
if (count($arr_info) > 1) { //check excel rows
|
||||||
$arr_excel_columns = $arr_info[0];
|
$arr_excel_columns = $arr_info[0];
|
||||||
$arr_need_columns = array();
|
$arr_need_columns = array();
|
||||||
|
foreach ($arr_associate as $item){
|
||||||
|
if($item['column_name'] == 'products_refnumber'){
|
||||||
|
$productsRefNumber_excelName = $item['headerfile'];
|
||||||
|
}
|
||||||
|
if($item['column_name'] == 'reportsNumberLab'){
|
||||||
|
$reportsNumberLab_excelName = $item['headerfile'];
|
||||||
|
}
|
||||||
|
if($item['column_name'] == 'partsCode'){
|
||||||
|
$partsCode_excelName = $item['headerfile'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
array_push($arr_need_columns, $productsRefNumber_excelName);
|
||||||
|
array_push($arr_need_columns, $reportsNumberLab_excelName);
|
||||||
|
array_push($arr_need_columns, $partsCode_excelName);
|
||||||
|
|
||||||
// remove empty rows
|
// remove empty rows
|
||||||
$arr_info = array_filter($arr_info, function ($row) {
|
$arr_info = array_filter($arr_info, function ($row) {
|
||||||
@@ -88,21 +106,6 @@ if (isset($_FILES['f_csv'])) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$productsRefNumber_excelName = '';
|
|
||||||
$reportsNumberLab_excelName = '';
|
|
||||||
$partsCode_excelName = '';
|
|
||||||
foreach ($arr_associate as $item){
|
|
||||||
if($item['column_name'] == 'products_refnumber'){
|
|
||||||
$productsRefNumber_excelName = $item['headerfile'];
|
|
||||||
}
|
|
||||||
if($item['column_name'] == 'reportsNumberLab'){
|
|
||||||
$reportsNumberLab_excelName = $item['headerfile'];
|
|
||||||
}
|
|
||||||
if($item['column_name'] == 'partsCode'){
|
|
||||||
$partsCode_excelName = $item['headerfile'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($verify_flag) {
|
if ($verify_flag) {
|
||||||
//separate by products_refnumber - product
|
//separate by products_refnumber - product
|
||||||
$idx_sample_code_po = array_search($productsRefNumber_excelName, $arr_excel_columns);
|
$idx_sample_code_po = array_search($productsRefNumber_excelName, $arr_excel_columns);
|
||||||
@@ -128,6 +131,9 @@ if (isset($_FILES['f_csv'])) {
|
|||||||
array_push($arr_total_products, $tmp_arr_child_products);
|
array_push($arr_total_products, $tmp_arr_child_products);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var_dump($arr_need_columns);
|
||||||
|
die();
|
||||||
|
|
||||||
|
|
||||||
//define importcode (timestamp)
|
//define importcode (timestamp)
|
||||||
$importcode = time();
|
$importcode = time();
|
||||||
|
|||||||
Reference in New Issue
Block a user