Add JS files
This commit is contained in:
138
modules/EcmNewKpkws/javascript/EcmNewKpkws2.js
Executable file
138
modules/EcmNewKpkws/javascript/EcmNewKpkws2.js
Executable file
@@ -0,0 +1,138 @@
|
||||
//START:
|
||||
$(document).ready(
|
||||
function() {
|
||||
var checkgen;
|
||||
|
||||
// confirm exit
|
||||
|
||||
|
||||
$("#type").prop("disabled", true);
|
||||
window.onbeforeunload = confirmExit;
|
||||
// prevent submit by enter press
|
||||
lockEnter();
|
||||
//initialize table
|
||||
InitializeTable();
|
||||
$('#parent_id').on('inputchange',
|
||||
function() {
|
||||
$(".loading_panel").css("display", "block");
|
||||
setTimeout(function() {
|
||||
getParentInfo($("#parent_id").val(), 'Accounts');
|
||||
}, 1000);
|
||||
});
|
||||
// kasy
|
||||
$("#cash").change(function() {
|
||||
$("#cash_id").val(($("#cash :selected").val()));
|
||||
getCashCurrency($("#cash :selected").val());
|
||||
$("#cash").prop("disabled", true);
|
||||
});
|
||||
// typ dokumenty
|
||||
$("#type").change(function() {
|
||||
$("#type_id").val(($("#type :selected").val()));
|
||||
|
||||
});
|
||||
// kurs NBP
|
||||
$("#currency").change(function() {
|
||||
$("#currency_id").val(($("#currency :selected").val()));
|
||||
getNBPCurrencyExchange($("#currency_id").val());
|
||||
//$("#currency").prop("disabled", true);
|
||||
|
||||
});
|
||||
|
||||
|
||||
//$("#register_date").prop("disabled", true);
|
||||
$("#assigned_user_name").prop("disabled", true);
|
||||
//$("#register_date_trigger").hide();
|
||||
$("#btn_assigned_user_name").hide();
|
||||
$("#btn_clr_assigned_user_name").hide();
|
||||
$(".loading_panel").css("display", "none");
|
||||
|
||||
if (($("#new_number").val() == true)
|
||||
&& ($("#duplicate").val() != true)&& ($("#ecmsale").val() != true)) {
|
||||
checkgen=1;
|
||||
} else if (($("#new_number").val() == true)
|
||||
&& ($("#duplicate").val() == true)) {
|
||||
checkgen=1;
|
||||
|
||||
} else if (($("#new_number").val() == true)
|
||||
&& ($("#ecmsale").val() == true)) {
|
||||
checkgen=1;
|
||||
|
||||
if($("#cash_id").val()!=""){
|
||||
generateDocNumber();
|
||||
|
||||
}
|
||||
var tmp = new Object();
|
||||
var tmp2 = [$('#trans_id').val()];
|
||||
tmp.selection_list=tmp2;
|
||||
LoadTransaction(tmp);
|
||||
|
||||
} else {
|
||||
checkgen=0;
|
||||
}
|
||||
$('#document_no').attr('readonly',false);
|
||||
if(checkgen==1){
|
||||
$("#cash").change(function() {
|
||||
$("#cash_id").val(($("#cash :selected").val()));
|
||||
generateDocNumber();
|
||||
});
|
||||
|
||||
}
|
||||
$("#amount").change(function(e){
|
||||
$(this).val(FormatNumber($(this).val()));
|
||||
});
|
||||
});
|
||||
// handle save
|
||||
|
||||
check_form_custom = function(formname,only_check) {
|
||||
|
||||
window.onbeforeunload = null;
|
||||
|
||||
$(".loading_panel").css("display", "block");
|
||||
$("#register_date").prop("disabled", false);
|
||||
$("#assigned_user_name").prop("disabled", false);
|
||||
$("#type").prop("disabled", false);
|
||||
|
||||
$(".loading_panel").css("display", "none");
|
||||
|
||||
if(only_check==1) removeFromValidate('EditView', 'amount');
|
||||
if(only_check!=1) addToValidate('EditView', 'amount', 'id', 'true', 'Kwota jest wymagana!');
|
||||
if (check_form(formname) == false) {
|
||||
$("#register_date").prop("disabled", true);
|
||||
$("#assigned_user_name").prop("disabled", true);
|
||||
|
||||
window.onbeforeunload = confirmExit;
|
||||
$(".loading_panel").css("display", "none");
|
||||
$("#type").prop("disabled", true);
|
||||
return false;
|
||||
} else {
|
||||
if(only_check!=1){
|
||||
$("#cash").prop("disabled", false);
|
||||
$("#type").prop("disabled", false);
|
||||
$("#currency").prop("disabled", false);
|
||||
$("#total_transactions").val(UnformatNumber($("#total_transactions").val()));
|
||||
PrepareTabletoSave();
|
||||
$('#amount').val(UnformatNumber($('#amount').val()));
|
||||
} else {
|
||||
$("#type").prop("disabled", true);
|
||||
}
|
||||
|
||||
|
||||
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