first task done
This commit is contained in:
parent
588a1abfb2
commit
9fc2b95e49
@ -21,9 +21,6 @@ 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();
|
||||||
array_push($arr_need_columns, "Sample Code (PO#)");
|
|
||||||
array_push($arr_need_columns, "Report no.");
|
|
||||||
array_push($arr_need_columns, "Part No.");
|
|
||||||
|
|
||||||
$result_testNameHeaderFile = ""; //for analysisvocabulary
|
$result_testNameHeaderFile = ""; //for analysisvocabulary
|
||||||
$result_AnalytsNameHeaderFile = ""; //for compundsvocabulary
|
$result_AnalytsNameHeaderFile = ""; //for compundsvocabulary
|
||||||
|
|||||||
@ -51,9 +51,6 @@ 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();
|
||||||
array_push($arr_need_columns, "Sample Code (PO#)");
|
|
||||||
array_push($arr_need_columns, "Report no.");
|
|
||||||
array_push($arr_need_columns, "Part No.");
|
|
||||||
|
|
||||||
// remove empty rows
|
// remove empty rows
|
||||||
$arr_info = array_filter($arr_info, function ($row) {
|
$arr_info = array_filter($arr_info, function ($row) {
|
||||||
@ -91,10 +88,24 @@ if (isset($_FILES['f_csv'])) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($verify_flag) {
|
$productsRefNumber_excelName = '';
|
||||||
//separate by Sample Code (PO#) - product
|
$reportsNumberLab_excelName = '';
|
||||||
$idx_sample_code_po = array_search("Sample Code (PO#)", $arr_excel_columns);
|
$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) {
|
||||||
|
//separate by products_refnumber - product
|
||||||
|
$idx_sample_code_po = array_search($productsRefNumber_excelName, $arr_excel_columns);
|
||||||
|
|
||||||
$arr_total_products = array();
|
$arr_total_products = array();
|
||||||
$tmp_arr_child_products = array();
|
$tmp_arr_child_products = array();
|
||||||
@ -141,7 +152,10 @@ if (isset($_FILES['f_csv'])) {
|
|||||||
'arr_project' => json_encode($arr_total_products),
|
'arr_project' => json_encode($arr_total_products),
|
||||||
'arr_excel_columns' => json_encode($arr_excel_columns),
|
'arr_excel_columns' => json_encode($arr_excel_columns),
|
||||||
'arr_associate' => json_encode($arr_associate),
|
'arr_associate' => json_encode($arr_associate),
|
||||||
'importcode' => $importcode
|
'importcode' => $importcode,
|
||||||
|
'productsRefNumber_excelName' => $productsRefNumber_excelName,
|
||||||
|
'reportsNumberLab_excelName' => $reportsNumberLab_excelName,
|
||||||
|
'partsCode_excelName' => $partsCode_excelName
|
||||||
]);
|
]);
|
||||||
|
|
||||||
//insert to products table
|
//insert to products table
|
||||||
|
|||||||
@ -11,8 +11,13 @@ $arr_total_products = json_decode($_POST['arr_project']);
|
|||||||
$arr_excel_columns = json_decode($_POST['arr_excel_columns']);
|
$arr_excel_columns = json_decode($_POST['arr_excel_columns']);
|
||||||
$arr_associate = json_decode($_POST['arr_associate']);
|
$arr_associate = json_decode($_POST['arr_associate']);
|
||||||
$importcode = $_POST['importcode'];
|
$importcode = $_POST['importcode'];
|
||||||
|
$productsRefNumber_excelName = $_POST['productsRefNumber_excelName'];
|
||||||
|
$reportsNumberLab_excelName = $_POST['reportsNumberLab_excelName'];
|
||||||
|
$partsCode_excelName = $_POST['partsCode_excelName'];
|
||||||
|
|
||||||
$idx_sample_code_po = array_search("Sample Code (PO#)", $arr_excel_columns);
|
$sample_code_po_column_name = array_search("products_refnumber", $arr_associate);
|
||||||
|
|
||||||
|
$idx_sample_code_po = array_search($productsRefNumber_excelName, $arr_excel_columns);
|
||||||
|
|
||||||
//insert to products table
|
//insert to products table
|
||||||
$idx = 0;
|
$idx = 0;
|
||||||
@ -65,7 +70,7 @@ foreach ($arr_total_products as $product) {
|
|||||||
|
|
||||||
//----------- report table ------------------
|
//----------- report table ------------------
|
||||||
//separate reports table data
|
//separate reports table data
|
||||||
$idx_report_no_po = array_search("Report no.", $arr_excel_columns);
|
$idx_report_no_po = array_search($reportsNumberLab_excelName, $arr_excel_columns);
|
||||||
|
|
||||||
$arr_total_reports = array();
|
$arr_total_reports = array();
|
||||||
$tmp_arr_child_reports = array();
|
$tmp_arr_child_reports = array();
|
||||||
@ -136,7 +141,7 @@ foreach ($arr_total_products as $product) {
|
|||||||
|
|
||||||
//----------- parts table ------------------
|
//----------- parts table ------------------
|
||||||
//separate parts table data
|
//separate parts table data
|
||||||
$idx_part_no_po = array_search("Part No.", $arr_excel_columns);
|
$idx_part_no_po = array_search($partsCode_excelName, $arr_excel_columns);
|
||||||
|
|
||||||
$arr_total_parts = array();
|
$arr_total_parts = array();
|
||||||
$tmp_arr_child_parts = array();
|
$tmp_arr_child_parts = array();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user