128 lines
5.2 KiB
Smarty
Executable File
128 lines
5.2 KiB
Smarty
Executable File
<style>
|
|
{literal}
|
|
.text-left {
|
|
text-align: left;
|
|
}
|
|
.text-right {
|
|
text-align: right !important;
|
|
}
|
|
.account_name {
|
|
background:rgba(0,0,0,0);
|
|
border:none;
|
|
text-color: black;
|
|
}
|
|
{/literal}
|
|
</style>
|
|
<h3>Nazwa wyciągu: {$STATEMENT_NAME}</h3>
|
|
<form name="transactions">
|
|
<table class="list view" width="100%" cellspacing="0" cellpadding="0" border="0" id="transactions_table">
|
|
<thead>
|
|
<tr row-number="no-data">
|
|
<th class="text-left" style="width: 15%;">Konto z</th>
|
|
<th class="text-left" style="width: 40%;">Kontrahent</th>
|
|
<th class="text-right">Kwota</th>
|
|
<th class="text-center">Opis</th>
|
|
<th class="text-right">Data</th>
|
|
<th class="text-right">Opcje</th>
|
|
</tr>
|
|
<thead>
|
|
<tbody>
|
|
{foreach from=$DATA item=row key=k}
|
|
{if $row.sum!="1"}
|
|
<tr class="evenListRowS1" row-number="{$row.uniqID}"
|
|
{if $row.transaction_exists=="1"}
|
|
style="background: red;"
|
|
{/if}>
|
|
<td class="text-left">{$row.account}
|
|
{if $row.transaction_exists == "1"}
|
|
<br>
|
|
{foreach from=$row.transactions item=t key=k}
|
|
<a href="index.php?module=EcmTransactions&action=DetailView&record={$t.id}" target="_blank">{$t.desc}</a><br>
|
|
{/foreach}
|
|
{/if}
|
|
</td>
|
|
<td class="text-left">
|
|
{if $row.account_found == "1"}
|
|
<a href="index.php?module=Accounts&action=DetailView&record={$row.account_id}">{$row.account_name}</a>
|
|
{else}
|
|
<button id="btn_parent_name" class="button firstChild" onclick="{literal}open_popup( 'Accounts', 800, 500, '', true, false, {'call_back_function':'set_return','form_name':'transactions','field_to_name_array':{'id':'account_id_{/literal}{$row.uniqID}{literal}','name':'account_name_{/literal}{$row.uniqID}{literal}'}}, 'single', true );{/literal}" value="Wybierz" tabindex="103" name="btn_parent_name" type="button">
|
|
<img src="themes/default/images/id-ff-select.png?s=bed8cd35065048ceebdc639ebe305e2c&c=1">
|
|
</button>
|
|
<input style="width: 90%" id="account_name_{$row.uniqID}" name="account_name_{$row.uniqID}" class="account_name" value="Wybierz kontrahenta" disabled/>
|
|
<br>
|
|
{/if}
|
|
<input type="hidden" value="{$row.account_id}" name="account_id_{$row.uniqID}" id="account_id_{$row.uniqID}"/>
|
|
</td>
|
|
<td class="text-right">{$row.value}</td>
|
|
<td class="text-left">{$row.payer}<br>{$row.desc}</td>
|
|
<td class="text-right">{$row.date}</td>
|
|
<td class="text-right">
|
|
<a target="_blank" onclick="{literal}if (confirm('Usunąć wiersz?')) {var whichtr =$(this).closest('tr'); whichtr.remove(); calculateSum();}{/literal}">
|
|
<img src="modules/EcmSales/images/deleterow.gif" style="cursor:pointer;">
|
|
</a>
|
|
<input type="hidden" id="value_{$row.uniqID}" value="{$row.value}"/>
|
|
<input type="hidden" id="account_{$row.uniqID}" value="{$row.account}"/>
|
|
<input type="hidden" id="date_{$row.uniqID}" value="{$row.date}"/>
|
|
<input type="hidden" id="desc_{$row.uniqID}" value="{$row.desc}"/>
|
|
<input type="hidden" id="transaction_exists_{$row.uniqID}" value="{$row.transaction_exists}"/>
|
|
</td>
|
|
</tr>
|
|
{else}
|
|
<tr row-number="no-data">
|
|
<td class="text-right" colspan="2">Suma: </td>
|
|
<td class="text-right" id="sumCell">{$row.sum_val}</td>
|
|
<td colspan="3"> </td>
|
|
</tr>
|
|
{/if}
|
|
{/foreach}
|
|
</tbody>
|
|
</table>
|
|
</form>
|
|
<script>
|
|
{literal}
|
|
var saveTransactions = function() {
|
|
items = new Object();
|
|
$('#transactions_table tr').each(function() {
|
|
rowNumber = $(this).attr('row-number');
|
|
if (rowNumber != 'no-data') {
|
|
if($("#transaction_exists_"+rowNumber).val()!='1'){
|
|
items[rowNumber] = new Object();
|
|
items[rowNumber]["account"] = $("#account_"+rowNumber).val();
|
|
items[rowNumber]["account_id"] = $("#account_id_"+rowNumber).val();
|
|
items[rowNumber]["value"] = $("#value_"+rowNumber).val();
|
|
items[rowNumber]["date"] = $("#date_"+rowNumber).val();
|
|
items[rowNumber]["desc"] = $("#desc_"+rowNumber).val();
|
|
}
|
|
|
|
}
|
|
});
|
|
$("#transactions_data").val(utf8_to_b64(JSON.stringifyNoSecurity(items)));
|
|
$("#save_transactions").submit();
|
|
}
|
|
|
|
function utf8_to_b64( str ) {
|
|
return window.btoa(unescape(encodeURIComponent( str )));
|
|
}
|
|
var calculateSum = function() {
|
|
var sum = 0;
|
|
$('#transactions_table tr').each(function() {
|
|
rowNumber = $(this).attr('row-number');
|
|
if (rowNumber != 'no-data')
|
|
sum+= UnformatNumber($("#value_"+rowNumber).val());
|
|
});
|
|
console.log(FormatNumber(sum));
|
|
$('#sumCell').html(FormatNumber(sum));
|
|
}
|
|
{/literal}
|
|
</script>
|
|
<form id="save_transactions" method="post" action="index.php">
|
|
<input type="hidden" id="module" name="module" value="EcmTransactions"/>
|
|
<input type="hidden" id="action" name="action" value="mz_importBankStatement"/>
|
|
<input type="hidden" id="process" name="process" value="2"/>
|
|
<input type="hidden" id="to_pdf" name="to_pdf" value="0"/>
|
|
<input type="hidden" id="statement_name" name="statement_name" value="{$STATEMENT_NAME}"/>
|
|
<input type="hidden" id="statement_date" name="statement_date" value="{$STATEMENT_DATE}"/>
|
|
<input type="hidden" id="transactions_data" name="transactions_data" value=""/>
|
|
<input type="button" class="button" value="Zapisz transakcje" onClick="saveTransactions();"/>
|
|
</form>
|
|
{$red} |