Merge remote-tracking branch 'origin/staging' into origin/production
This commit is contained in:
@@ -142,8 +142,8 @@ class DrugController extends Controller
|
||||
public function downloadTemplate()
|
||||
{
|
||||
return Helper::responseJson([
|
||||
'file_name' => "Template - Drugs.xlsx",
|
||||
"file_url" => url('files/Template - Drugs.xlsx')
|
||||
'file_name' => "Template1.xlsx",
|
||||
"file_url" => url('files/Template1.xlsx')
|
||||
]);
|
||||
}
|
||||
public function import(Request $request)
|
||||
@@ -156,36 +156,37 @@ class DrugController extends Controller
|
||||
$importedRows = 0;
|
||||
$failedRows = [];
|
||||
|
||||
|
||||
foreach ($processedData as $row) {
|
||||
try {
|
||||
Drug::updateOrCreate([
|
||||
'code' => $row['code'],
|
||||
],
|
||||
[
|
||||
'name' => $row['name'],
|
||||
'code' => $row['code'],
|
||||
'id_setara' => $row['id_setara'],
|
||||
'code_setara' => $row['code_setara'],
|
||||
'nama_setara' => $row['nama_setara'],
|
||||
'multiply_jual' => $row['multiply_jual'],
|
||||
'generic_name' => $row['generic_name'],
|
||||
'description' => $row['description'],
|
||||
'mims_class' => $row['mims_class'],
|
||||
'indications' => $row['indications'],
|
||||
'atc_code' => $row['atc_code'],
|
||||
'segmentation' => $row['segmentation'],
|
||||
'type' => $row['type'],
|
||||
'dosage' => $row['dosage'],
|
||||
'remark' => $row['remark'],
|
||||
// 'price' => $row['price'],
|
||||
// 'unit' => $row['unit'],
|
||||
]
|
||||
);
|
||||
$importedRows++;
|
||||
} catch (\Exception $e) {
|
||||
dd($e);
|
||||
$failedRows[] = $row;
|
||||
if ($processedData){
|
||||
foreach ($processedData as $row) {
|
||||
try {
|
||||
Drug::updateOrCreate([
|
||||
'code' => $row['code'],
|
||||
],
|
||||
[
|
||||
'name' => $row['name'],
|
||||
'code' => $row['code'],
|
||||
'id_setara' => $row['id_setara'],
|
||||
'code_setara' => $row['code_setara'],
|
||||
'nama_setara' => $row['nama_setara'],
|
||||
'multiply_jual' => $row['multiply_jual'],
|
||||
'generic_name' => $row['generic_name'],
|
||||
'description' => $row['description'],
|
||||
'mims_class' => $row['mims_class'],
|
||||
'indications' => $row['indications'],
|
||||
'atc_code' => $row['atc_code'],
|
||||
'segmentation' => $row['segmentation'],
|
||||
'type' => $row['type'],
|
||||
'dosage' => $row['dosage'],
|
||||
'remark' => $row['remark'],
|
||||
// 'price' => $row['price'],
|
||||
'unit' => $row['unit'],
|
||||
]
|
||||
);
|
||||
$importedRows++;
|
||||
} catch (\Exception $e) {
|
||||
dd($e);
|
||||
$failedRows[] = $row;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user