Example #1
0
        exit;
    }
}
if (!is_writable($import_dir)) {
    show_error_import($import_mod_strings['LBL_IMPORT_MODULE_NO_DIRECTORY'] . $import_dir . $import_mod_strings['LBL_IMPORT_MODULE_NO_DIRECTORY_END']);
    exit;
}
if (trim(substr(strrchr(basename($_FILES['userfile']['name']), '.'), 1, 10)) != "xls") {
    show_error_import("导入文件格式不正确");
    exit;
}
$tmp_file_name = $import_dir . "IMPORT_" . $current_user->id;
move_uploaded_file($_FILES['userfile']['tmp_name'], $tmp_file_name);
$focus = new ImportSalesOrder();
$focus->setAccountFile($tmp_file_name);
$focus->parseExcel();
$_SESSION['import_skipped_record_count'] = $focus->skip_record;
$totalrecord = $focus->total_reocrd;
$importrecord = $totalrecord - $focus->skip_record;
$_SESSION['import_message'] = "一共有 {$totalrecord} 条,共导入 {$importrecord} 条";
$_SESSION['import_skipped_rows'] = $focus->skip_rows;
unlink($tmp_file_name);
header("Location: index.php?action=ImportSteplast&module=SalesOrder&parenttab=Accounts");
function show_error_import($message)
{
    global $current_language;
    $import_mod_strings = return_module_language($current_language, "Import");
    global $theme;
    global $log;
    global $mod_strings;
    global $app_strings;