Add JS files
This commit is contained in:
100
modules/EcmAgreements/javascript/EcmAgreements.js
Executable file
100
modules/EcmAgreements/javascript/EcmAgreements.js
Executable file
@@ -0,0 +1,100 @@
|
||||
//START:
|
||||
$(document).ready(
|
||||
|
||||
function() {
|
||||
var prev_val;
|
||||
// confirm exit
|
||||
window.onbeforeunload = confirmExit;
|
||||
// prevent submit by enter press
|
||||
lockEnter();
|
||||
// parent info
|
||||
$('#parent_id').on('inputchange',
|
||||
function() {
|
||||
$(".loading_panel").css("display", "block");
|
||||
setTimeout(function() {
|
||||
getParentInfo($("#parent_id").val(), 'Accounts');
|
||||
}, 1000);
|
||||
});
|
||||
// categories
|
||||
getCategoriesList();
|
||||
// its vat free change
|
||||
$("#no_tax").change(function() {
|
||||
// calculate totals
|
||||
var count = $('#' + itemsTable + '_T tr').length - 1; // -1 -
|
||||
// thead row
|
||||
for (var index = 0; index != count; index++)
|
||||
calculateRow(index);
|
||||
});
|
||||
|
||||
$("#currency_id").change(function() {
|
||||
getNBPCurrencyExchange($("#currency_id :selected").val());
|
||||
|
||||
});
|
||||
|
||||
// formatowanie liczb
|
||||
$("#amount").change(function(e){
|
||||
$(this).val(FormatNumber($(this).val()));
|
||||
});
|
||||
$("#interest_rate").change(function(e){
|
||||
$(this).val(FormatNumber($(this).val()));
|
||||
});
|
||||
$("#rate_of_commission").change(function(e){
|
||||
$(this).val(FormatNumber($(this).val()));
|
||||
});
|
||||
$("#number_of_installments").change(function(e){
|
||||
$(this).val(FormatNumber($(this).val()));
|
||||
});
|
||||
$('#principal_value').focus(function() {
|
||||
prev_val = $(this).val();
|
||||
});
|
||||
$("#principal_value").change(function(e){
|
||||
|
||||
|
||||
$(this).val(FormatNumber($(this).val()));
|
||||
if($("#a2_5").text().search('xxx')>0){
|
||||
$("#a2_5").text($("#a2_5").text().replace('xxx',$(this).val()+' zł'));
|
||||
} else {
|
||||
console.log(prev_val);
|
||||
$("#a2_5").text($("#a2_5").text().replace(prev_val+' zł',$(this).val()+' zł'));
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
DrawHeaders();
|
||||
///generateNumber();
|
||||
EcmDocumentNumberGenerator_getNumberTemplate('document_no', 'EcmInvoiceOuts');
|
||||
//$("#document_no").attr("readonly", false);
|
||||
$(".loading_panel").css("display", "none");
|
||||
// handle setItems
|
||||
DrawFormaWplatyTable();
|
||||
setITEMS = function() {
|
||||
var formname = 'EditView';
|
||||
if (check_form_(formname) == true) {
|
||||
SetTab('ITEMS');
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
});
|
||||
|
||||
// handle save
|
||||
var check_form_ = check_form;
|
||||
check_form = function(formname) {
|
||||
window.onbeforeunload = null;
|
||||
$(".loading_panel").css("display", "block");
|
||||
// calculate totals
|
||||
return true;
|
||||
};
|
||||
function confirmExit() {
|
||||
return "";
|
||||
}
|
||||
|
||||
function lockEnter() {
|
||||
// prevent default
|
||||
$(window).keydown(function(event) {
|
||||
if (event.keyCode == 13 && $(":focus").prop('tagName')!='TEXTAREA') {
|
||||
event.preventDefault();
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user