You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
73 lines
1.7 KiB
PHP
73 lines
1.7 KiB
PHP
<?
|
|
include_once("../php/include.php");
|
|
|
|
initDatabaseConnection();
|
|
?>
|
|
<table class="list-b">
|
|
<tr>
|
|
<th class="list-b">Import from</th>
|
|
<td class="list-b">
|
|
<select id="bank">
|
|
<option value="seb">SEB</option>
|
|
<option value="handelsbanken">Handelsbanken</option>
|
|
</select>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<th class="list-b">Data file</th>
|
|
<td class="list-b"><input type="file" id="data-file" /></td>
|
|
</tr>
|
|
<tr>
|
|
<th class="list-b">Into account</th>
|
|
<td class="list-b">
|
|
<select id="account-id">
|
|
<?
|
|
$rows = dbQuery("SELECT * FROM account_ext WHERE household_id = ?", getHouseHoldId());
|
|
foreach($rows as $row) {
|
|
?>
|
|
<option value="<?=$row['id']?>"><?=$row['name']?></option>
|
|
<?
|
|
}
|
|
?>
|
|
</select>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<th class="list-b"></th>
|
|
<td class="list-b"><button id="import-button" onclick="importData();">Import records</button></td>
|
|
</tr>
|
|
</table>
|
|
|
|
<?
|
|
closeDatabaseConnection();
|
|
?>
|
|
|
|
<br/>
|
|
<div id="result-div"> </div>
|
|
|
|
<script>
|
|
function importData() {
|
|
var fileData = $('#data-file').prop('files')[0];
|
|
var requestData = new FormData();
|
|
requestData.append("action", "import");
|
|
requestData.append("dataFile", fileData);
|
|
requestData.append("bank", $('#bank option:selected').val());
|
|
requestData.append("accountId", $('#account-id option:selected').val());
|
|
|
|
$('#result-div').html("<img src='graphics/loading.gif' /> Parsing data...");
|
|
sendRequestAdv(
|
|
"import",
|
|
requestData,
|
|
"import-button",
|
|
function(success, status, response) {
|
|
$('#result-div').html(success ? response : " ");
|
|
},
|
|
function(success, status, response) {
|
|
return (success ? "Completed" : response);
|
|
},
|
|
null,
|
|
true
|
|
);
|
|
}
|
|
</script>
|