Add JS files
This commit is contained in:
454
modules/EcmAgreements/javascript/AgreementTemplates.js
Executable file
454
modules/EcmAgreements/javascript/AgreementTemplates.js
Executable file
@@ -0,0 +1,454 @@
|
||||
$(document).ready(function () {
|
||||
|
||||
CKEDITOR.replace('template');
|
||||
getListCodeTemplate();
|
||||
$("#pdf_template_selected").val($('#templates').val());
|
||||
|
||||
$('#templates').change(function () {
|
||||
$("#pdf_template_selected").val($('#templates').val());
|
||||
getCodeTemplate();
|
||||
});
|
||||
$("#save").on('click',saveCodeTemplate);
|
||||
$("#add").on('click',addCodeTemplate);
|
||||
$("#edit").on('click',editLabel);
|
||||
$("#remove").on("click",removeCodeTemplate);
|
||||
$("#edit_save").on("click", editLabelCodeTemplate);
|
||||
$("#add_save").on('click',addSaveCodeTemplate);
|
||||
$("#preview_pdf").on('click',getPDFpreview);
|
||||
$(".margin").on("change", marginChange);
|
||||
});
|
||||
|
||||
function getPDFpreview(){
|
||||
var id_template = $("#templates").val();
|
||||
var html_template = CKEDITOR.instances['template'].getData();
|
||||
margin_top = $("#margin_top").val();
|
||||
margin_bottom = $("#margin_bottom").val();
|
||||
margin_left = $("#margin_left").val();
|
||||
margin_right = $("#margin_right").val();
|
||||
zapisane_pozycje = [];
|
||||
$.each($("#parseFieldsTable").find("input"),function (key,value){
|
||||
zapisane_pozycje.push($(value).val());
|
||||
});
|
||||
aditional_fields = [];
|
||||
$.each($('#pdf_template_aditional_fields').appendGrid('getAllValue'), function (key, row){
|
||||
if(row.value0!=''){
|
||||
row.value0 = trim(row.value0);
|
||||
if(row.value0!=''){
|
||||
var re = new RegExp(' ', 'g');
|
||||
row.value0 = row.value0.replace(re, '_');
|
||||
sprawdz_czy_juz_zapisana = false;
|
||||
$.each(aditional_fields, function (k,v){
|
||||
if(row.value0==v.value0){
|
||||
sprawdz_czy_juz_zapisana = true;
|
||||
}
|
||||
});
|
||||
if(!sprawdz_czy_juz_zapisana){
|
||||
aditional_fields.push(row);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
$('#pdf_template_aditional_fields').appendGrid('load',aditional_fields);
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "index.php?module=EcmAgreements&action=dbpost&to_pdf=1",
|
||||
dataType: "html",
|
||||
async: false,
|
||||
data: {
|
||||
job: "saveCodeTemplate",
|
||||
id_template: id_template,
|
||||
html_template: html_template,
|
||||
margin_top: margin_top,
|
||||
margin_bottom: margin_bottom,
|
||||
margin_left: margin_left,
|
||||
margin_right: margin_right,
|
||||
aditional_fields: aditional_fields,
|
||||
},
|
||||
success: function (data) {
|
||||
refreshPraseList();
|
||||
getCodeTemplate();
|
||||
},
|
||||
error: function (){
|
||||
alert("Coś poszło nie tak... Nie udało się wygenerować podglądu");
|
||||
return;
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
|
||||
var id_template = $('#pdf_template_selected').val();
|
||||
console.log(id_template);
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "index.php?module=EcmAgreements&action=createPDF&to_pdf=1",
|
||||
dataType: "html",
|
||||
data: {
|
||||
generateFromTeplateExample: id_template,
|
||||
record: 1,
|
||||
},
|
||||
success: function (data) {
|
||||
window.open("pdfexample.pdf");
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function refreshPraseList(){
|
||||
var id_template= $("#templates").val();
|
||||
console.log(id_template);
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "index.php?module=EcmAgreements&action=dbpost&to_pdf=1",
|
||||
dataType: "json",
|
||||
data: {
|
||||
job: "getParseFields",
|
||||
id_template : id_template,
|
||||
},
|
||||
success: function(data) {
|
||||
$("#parseFieldsTable").find('tr').remove();
|
||||
$.each(data, function(key, value) {
|
||||
$("#parseFieldsTable").append('<tr><td style="border-bottom:1pt solid black;"><b>' + value + '</b></td><td style="border-bottom:1pt solid black;" ><input type="text" onClick="this.select();" value="$' + key + '$"/></td></tr>');
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function InitializeAdidionalFields(initData) {
|
||||
// Initialize appendGrid
|
||||
|
||||
$('#pdf_template_aditional_fields').appendGrid({
|
||||
hideRowNumColumn: false,
|
||||
initRows: 1,
|
||||
initData:initData,
|
||||
columns: [
|
||||
{
|
||||
name: 'value0',
|
||||
display: SUGAR.language.get("EcmAgreements", "LBL_NAME"),
|
||||
type: 'text',
|
||||
displayCss: {
|
||||
'vertical-align': 'middle'
|
||||
},
|
||||
ctrlCss: {
|
||||
'text-align': 'left'
|
||||
},
|
||||
ctrlClass: 'inputs',
|
||||
onChange: function (evt, rowIndex) {
|
||||
var linia = $('#pdf_template_aditional_fields').appendGrid('getRowValue', rowIndex);
|
||||
var nazwa = '$' +linia.value0+ '$';
|
||||
$.each($("#parseFieldsTable").find("input"),function (key,value){
|
||||
if( nazwa ==$(value).val()){
|
||||
alert("Podana nazwa jest już używana, proszę wybrać inną.");
|
||||
}
|
||||
});
|
||||
}
|
||||
},{
|
||||
name: 'value3',
|
||||
display: SUGAR.language.get("EcmAgreements", "LBL_DEFAULT_VALUE"),
|
||||
type: 'text',
|
||||
displayCss: {
|
||||
'vertical-align': 'middle'
|
||||
},
|
||||
ctrlCss: {
|
||||
'text-align': 'left'
|
||||
},
|
||||
ctrlClass: 'inputs',
|
||||
},{
|
||||
name: 'value2',
|
||||
display: 'relatedTemplate',
|
||||
type: 'hidden',
|
||||
value: $("#templates").val(),
|
||||
}, {
|
||||
name: 'id',
|
||||
display: 'id',
|
||||
type: 'hidden',
|
||||
}, {
|
||||
name: 'name',
|
||||
display: 'name',
|
||||
type: 'hidden',
|
||||
value : 'AgreementTemplatesAditionalFields',
|
||||
}, {
|
||||
name: 'module_name',
|
||||
display: 'module_name',
|
||||
type: 'hidden',
|
||||
value : 'EcmAgreements',
|
||||
},
|
||||
|
||||
],
|
||||
i18n: {
|
||||
append: SUGAR.language.get("app_strings", "LBL_APPENDGRID_I18_APPEND"),
|
||||
remove: SUGAR.language.get("app_strings", "LBL_APPENDGRID_I18_REMOVE"),
|
||||
insert: SUGAR.language.get("app_strings", "LBL_APPENDGRID_I18_INSERT"),
|
||||
moveUp: SUGAR.language.get("app_strings", "LBL_APPENDGRID_I18_MOVEUP"),
|
||||
moveDown: SUGAR.language.get("app_strings", "LBL_APPENDGRID_I18_MOVEDOWN"),
|
||||
removeLast: SUGAR.language.get("app_strings", "LBL_APPENDGRID_I18_REMOVELAST"),
|
||||
rowEmpty: SUGAR.language.get("app_strings", "LBL_APPENDGRID_I18_ROWEMPTY"),
|
||||
rowDrag: SUGAR.language.get("app_strings", "LBL_APPENDGRID_I18_ROWDRAG"),
|
||||
},
|
||||
customGridButtons: {
|
||||
insert: function () {
|
||||
var button = document.createElement('img');
|
||||
button.src = 'modules/EcmQuotes/images/add_position.gif';
|
||||
return button;
|
||||
},
|
||||
remove: function () {
|
||||
var button = document.createElement('img');
|
||||
button.src = 'modules/EcmQuotes/images/deleterow.gif';
|
||||
return button;
|
||||
},
|
||||
moveUp: function () {
|
||||
var button = document.createElement('img');
|
||||
button.src = 'modules/EcmQuotes/images/moverowup.gif';
|
||||
return button;
|
||||
},
|
||||
moveDown: function () {
|
||||
var button = document.createElement('img');
|
||||
button.src = 'modules/EcmQuotes/images/moverowdown.gif';
|
||||
return button;
|
||||
},
|
||||
},
|
||||
afterRowRemoved: function (caller, rowIndex) {
|
||||
var quantity = $('#pdf_template_aditional_fields').appendGrid(
|
||||
'getRowCount');
|
||||
if (quantity == 0) {
|
||||
$('#pdf_template_aditional_fields').appendGrid('appendRow', 1);
|
||||
}
|
||||
},
|
||||
hideButtons: {
|
||||
removeLast: true,
|
||||
append: true,
|
||||
moveUp: true,
|
||||
moveDown: true
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function hide(){
|
||||
$("#edit_div").hide();
|
||||
$("#add_div").hide();
|
||||
}
|
||||
|
||||
function marginChange(){
|
||||
var value = $(this).val();
|
||||
if(value==''){
|
||||
$(this).val(0);
|
||||
return;
|
||||
}
|
||||
if(value<0){
|
||||
$(this).val(0);
|
||||
return;
|
||||
}
|
||||
if(value>100){
|
||||
$(this).val(100);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
function getListCodeTemplate() {
|
||||
var selected = $("#pdf_template_selected").val();
|
||||
$('#templates').find('option').remove();
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "index.php?module=EcmAgreements&action=dbpost&to_pdf=1",
|
||||
dataType: "json",
|
||||
data: {
|
||||
job: "getListCodeTemplate",
|
||||
},
|
||||
success: function(data) {
|
||||
console.log(selected);
|
||||
$.each(data, function(key, value) {
|
||||
$("#templates").append('<option value="' + key + '">' + value + '</option>');
|
||||
});
|
||||
if(selected!=''){
|
||||
$("#templates").val(selected);
|
||||
}else{
|
||||
$("#templates").val($("#templates option:first").val());
|
||||
$('#pdf_template_selected').val($("#templates").val());
|
||||
}
|
||||
getCodeTemplate();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function getCodeTemplate() {
|
||||
var id = $('#templates').val();
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "index.php?module=EcmAgreements&action=dbpost&to_pdf=1",
|
||||
dataType: "json",
|
||||
async: false,
|
||||
data: {
|
||||
job: "getCodeTemplate",
|
||||
id: id,
|
||||
},
|
||||
success: function (data) {
|
||||
CKEDITOR.instances['template'].setData(data.pdf_template);
|
||||
$("#margin_top").val(data.margin_top);
|
||||
$("#margin_bottom").val(data.margin_bottom);
|
||||
$("#margin_left").val(data.margin_left);
|
||||
$("#margin_right").val(data.margin_right);
|
||||
refreshPraseList();
|
||||
InitializeAdidionalFields(data.aditional_fields);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function saveCodeTemplate() {
|
||||
var id_template = $("#templates").val();
|
||||
var html_template = CKEDITOR.instances['template'].getData();
|
||||
margin_top = $("#margin_top").val();
|
||||
margin_bottom = $("#margin_bottom").val();
|
||||
margin_left = $("#margin_left").val();
|
||||
margin_right = $("#margin_right").val();
|
||||
zapisane_pozycje = [];
|
||||
$.each($("#parseFieldsTable").find("input"),function (key,value){
|
||||
zapisane_pozycje.push($(value).val());
|
||||
});
|
||||
aditional_fields = [];
|
||||
$.each($('#pdf_template_aditional_fields').appendGrid('getAllValue'), function (key, row){
|
||||
if(row.value0!=''){
|
||||
row.value0 = trim(row.value0);
|
||||
if(row.value0!=''){
|
||||
var re = new RegExp(' ', 'g');
|
||||
row.value0 = row.value0.replace(re, '_');
|
||||
sprawdz_czy_juz_zapisana = false;
|
||||
$.each(aditional_fields, function (k,v){
|
||||
if(row.value0==v.value0){
|
||||
sprawdz_czy_juz_zapisana = true;
|
||||
}
|
||||
});
|
||||
if(!sprawdz_czy_juz_zapisana){
|
||||
aditional_fields.push(row);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
$('#pdf_template_aditional_fields').appendGrid('load',aditional_fields);
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "index.php?module=EcmAgreements&action=dbpost&to_pdf=1",
|
||||
dataType: "html",
|
||||
async: false,
|
||||
data: {
|
||||
job: "saveCodeTemplate",
|
||||
id_template: id_template,
|
||||
html_template: html_template,
|
||||
margin_top: margin_top,
|
||||
margin_bottom: margin_bottom,
|
||||
margin_left: margin_left,
|
||||
margin_right: margin_right,
|
||||
aditional_fields: aditional_fields,
|
||||
},
|
||||
success: function (data) {
|
||||
refreshPraseList();
|
||||
getCodeTemplate();
|
||||
alert("Zapisano pomyślnie");
|
||||
},
|
||||
error: function (){
|
||||
alert("Coś poszło nie tak... Zmiany nie zostały zapisane");
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function addCodeTemplate(){
|
||||
$("#add_div").show();
|
||||
}
|
||||
|
||||
function addSaveCodeTemplate(){
|
||||
var label = trim($("#add_label").val());
|
||||
if(label == ''){
|
||||
alert("Nie podano nazwy szablonu");
|
||||
return false;
|
||||
}
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "index.php?module=EcmAgreements&action=dbpost&to_pdf=1",
|
||||
dataType: "html",
|
||||
async: false,
|
||||
data: {
|
||||
job: "addSaveCodeTemplate",
|
||||
label: label,
|
||||
},
|
||||
success: function (data) {
|
||||
if(data=='0'){
|
||||
alert('Coś poszło nie tak. Nie zapisano żadnych zmian.');
|
||||
return;
|
||||
}
|
||||
if(data=='1'){
|
||||
alert('Podana nazwa już istnieje,wybierz inną');
|
||||
return;
|
||||
}
|
||||
$("#pdf_template_selected").val(data);
|
||||
alert('Pomyślnie dodano szablon.');
|
||||
getListCodeTemplate();
|
||||
},
|
||||
error: function (){
|
||||
alert("Coś poszło nie tak..<br>Zmiany nie zostały zapisane");
|
||||
},
|
||||
});
|
||||
$("#add_label").val('');
|
||||
$("#add_div").hide();
|
||||
}
|
||||
|
||||
function editLabel(){
|
||||
$("#edit_label").val($("#templates option:selected").html());
|
||||
$("#edit_div").show();
|
||||
}
|
||||
|
||||
function editLabelCodeTemplate(){
|
||||
var id_template = $("#templates").val();
|
||||
var label = trim($("#edit_label").val());
|
||||
if(label == ''){
|
||||
alert("Nie podano nazwy szablonu");
|
||||
return false;
|
||||
}
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "index.php?module=EcmAgreements&action=dbpost&to_pdf=1",
|
||||
dataType: "html",
|
||||
async: false,
|
||||
data: {
|
||||
job: "editLabelCodeTemplate",
|
||||
label: label,
|
||||
id_template: id_template,
|
||||
},
|
||||
success: function (data) {
|
||||
alert(data);
|
||||
if(data=="Pomyślnie zmieniono nazwę szablonu."){
|
||||
getListCodeTemplate();
|
||||
}
|
||||
},
|
||||
error: function (){
|
||||
alert("Coś poszło nie tak..<br>Zmiany nie zostały zapisane");
|
||||
},
|
||||
});
|
||||
$("#edit_div").val('');
|
||||
$("#edit_div").hide();
|
||||
}
|
||||
|
||||
function removeCodeTemplate(){
|
||||
var zgoda = confirm("Czy na pewno usunąć szablon?\nNie będzie można tego cofnąć bez kontaktu z administratorem.");
|
||||
if(!zgoda){
|
||||
return;
|
||||
}
|
||||
var id_template = $("#templates").val();
|
||||
$("#pdf_template_selected").val('');
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "index.php?module=EcmAgreements&action=dbpost&to_pdf=1",
|
||||
dataType: "html",
|
||||
async: false,
|
||||
data: {
|
||||
job: "removeCodeTemplate",
|
||||
id_template: id_template,
|
||||
},
|
||||
success: function (data) {
|
||||
getListCodeTemplate();
|
||||
alert(data);
|
||||
},
|
||||
error: function (){
|
||||
alert("Coś poszło nie tak..<br>Zmiany nie zostały zapisane");
|
||||
},
|
||||
});
|
||||
}
|
||||
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;
|
||||
}
|
||||
});
|
||||
}
|
||||
8
modules/EcmAgreements/javascript/EcmAgreementsDetail.js
Executable file
8
modules/EcmAgreements/javascript/EcmAgreementsDetail.js
Executable file
@@ -0,0 +1,8 @@
|
||||
//START:
|
||||
$(document).ready(
|
||||
function() {
|
||||
DrawHeaders();
|
||||
getItems(false);
|
||||
});
|
||||
|
||||
|
||||
105
modules/EcmAgreements/javascript/EditViewPDFTemplate.js
Executable file
105
modules/EcmAgreements/javascript/EditViewPDFTemplate.js
Executable file
@@ -0,0 +1,105 @@
|
||||
$(document).ready(function () {
|
||||
getListCodeTemplate();
|
||||
CKEDITOR.replace('pdf_text');
|
||||
$('#pdf_template_selected').val($('#pdf_template').val());
|
||||
$('#pdf_template').on('change',function () {
|
||||
if( $('#pdf_template_selected').val()!=''){
|
||||
var zgoda = confirm("Czy na pewno chcesz zmienić szablon pdf? Zmiany w aktualnym szablonie będą utracone.");
|
||||
if(!zgoda){
|
||||
return;
|
||||
}
|
||||
}
|
||||
$('#pdf_template_selected').val($('#pdf_template').val());
|
||||
getFilledCodeTemplate();
|
||||
getAditionalFieldsTemplate();
|
||||
});
|
||||
$("#refresh").on('click',pdfRefresh);
|
||||
$("#preview_pdf").on('click',getPDFpreview);
|
||||
});
|
||||
|
||||
function getPDFpreview(){
|
||||
window.open("Agreement.pdf");
|
||||
}
|
||||
|
||||
function getAditionalFieldsTemplate() {
|
||||
var id = $('#pdf_template').val();
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "index.php?module=EcmAgreements&action=dbpost&to_pdf=1",
|
||||
dataType: "json",
|
||||
async: false,
|
||||
data: {
|
||||
job: "getCodeTemplate",
|
||||
id: id,
|
||||
},
|
||||
success: function (data) {
|
||||
$("#aditionalFields").find('tr').remove();
|
||||
$.each(data.aditional_fields, function (key,value){
|
||||
$("#aditionalFields").append("<tr><td width='12.5%' >"+ value.value0+ ":</td><td><input type='text' id='" + value.value0 + "' name='" + value.value0 + "' value='" + value.value3 + "'></td></tr>");
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function pdfRefresh(){
|
||||
var zgoda = confirm("Czy na pewno chcesz odświeżyć treść pdf? Nie będzie można tego cofnąć.");
|
||||
if(!zgoda){
|
||||
return;
|
||||
}
|
||||
getFilledCodeTemplate();
|
||||
}
|
||||
|
||||
function getFilledCodeTemplate() {
|
||||
|
||||
var id_template = $('#pdf_template').val();
|
||||
var inputs = $('input, textarea, select').not(':input[type=button], :input[type=submit], :input[type=reset]');
|
||||
var fill_data = {};
|
||||
$.each(inputs, function (indeks,value){
|
||||
var jqval = $(value);
|
||||
if(jqval.val()!=''){
|
||||
fill_data[jqval.attr('name')] = jqval.val();
|
||||
}
|
||||
});
|
||||
|
||||
var tmp = null;
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "index.php?module=EcmAgreements&action=dbpost&to_pdf=1",
|
||||
dataType: "html",
|
||||
data: {
|
||||
job: "getFilledCodeTemplate",
|
||||
id: id_template,
|
||||
data: fill_data,
|
||||
},
|
||||
success: function (data) {
|
||||
CKEDITOR.instances['pdf_text'].setData(data);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function getListCodeTemplate() {
|
||||
var selected = $("#pdf_template_selected").val();
|
||||
$('#pdf_template').find('option').remove();
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "index.php?module=EcmAgreements&action=dbpost&to_pdf=1",
|
||||
dataType: "json",
|
||||
data: {
|
||||
job: "getListCodeTemplate",
|
||||
},
|
||||
success: function(data) {
|
||||
$("#pdf_template").append('<option value=""></option>');
|
||||
$.each(data, function(key, value) {
|
||||
console.debug("key " + key);
|
||||
console.debug("selected " + selected);
|
||||
if (key == selected) {
|
||||
$("#pdf_template").append('<option value="' + key + '">' + value + '</option>');
|
||||
} else {
|
||||
$("#pdf_template").append('<option value="' + key + '">' + value + '</option>');
|
||||
}
|
||||
$("#pdf_template").val(selected);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
1761
modules/EcmAgreements/javascript/bimit_table.js
Executable file
1761
modules/EcmAgreements/javascript/bimit_table.js
Executable file
File diff suppressed because it is too large
Load Diff
71
modules/EcmAgreements/javascript/columndefs-detail.js
Executable file
71
modules/EcmAgreements/javascript/columndefs-detail.js
Executable file
@@ -0,0 +1,71 @@
|
||||
columns = new Array();
|
||||
//define columns
|
||||
//begin: number
|
||||
columns[0] = {
|
||||
'name' : 'number',
|
||||
'label' : 'Lp.',
|
||||
'width' : 4,
|
||||
'content' : new Array(),
|
||||
};
|
||||
columns[0]['content'][0] = {'name' : '', 'type': 'text', 'readonly' : true};
|
||||
//end: number
|
||||
//begin: code
|
||||
columns[1] = {
|
||||
'name' : 'payment_',
|
||||
'label' : 'Termin płatności odsetek i raty kapitałowej',
|
||||
'width' : 20,
|
||||
'content' : new Array(),
|
||||
};
|
||||
columns[1]['content'][0] = {'name' : 'date', 'type': 'text', 'readonly' : true};
|
||||
//end: code
|
||||
//begin: name
|
||||
columns[2] = {
|
||||
'name' : 'total',
|
||||
'label' : 'Suma raty i odsetek',
|
||||
'width' : 6,
|
||||
'align' : 'right',
|
||||
'content' : new Array(),
|
||||
};
|
||||
columns[2]['content'][0] = {'name' : '', 'type': 'text', 'readonly' : true, 'isNumber' : true};
|
||||
//end: name
|
||||
//begin: quantity
|
||||
columns[3] = {
|
||||
'name' : 'interest_',
|
||||
'label' : 'Odsetki',
|
||||
'width' : 5,
|
||||
'content' : new Array(),
|
||||
'align' : 'right',
|
||||
};
|
||||
columns[3]['content'][0] = {'name' : 'rate', 'type': 'text', 'readonly' : true, 'isNumber' : true};
|
||||
//end: quantity
|
||||
//begin: unit
|
||||
columns[4] = {
|
||||
'name' : 'rate_of_',
|
||||
'label' : 'Prowizja',
|
||||
'width' : 5,
|
||||
'content' : new Array(),
|
||||
'align' : 'right',
|
||||
};
|
||||
columns[4]['content'][0] = {'name' : 'commission', 'type': 'text', 'readonly' : true, 'isNumber' : true};
|
||||
//end: unit
|
||||
//begin: price_start
|
||||
columns[5] = {
|
||||
'name' : 'principal_',
|
||||
'label' : 'Rata kapitałowa',
|
||||
'width' : 5,
|
||||
'content' : new Array(),
|
||||
'align' : 'right',
|
||||
};
|
||||
columns[5]['content'][0] = {'name' : 'value', 'type': 'text', 'readonly' : true, 'isNumber' : true};
|
||||
//end: price_start
|
||||
//begin: discount
|
||||
columns[6] = {
|
||||
'name' : 'saldo',
|
||||
'label' : 'Saldo',
|
||||
'width' : 5,
|
||||
'content' : new Array(),
|
||||
'align' : 'right',
|
||||
};
|
||||
columns[6]['content'][0] = {'name' : '', 'type': 'text', 'readonly' : true, 'isNumber' : true};
|
||||
//end: discount
|
||||
//begin: price_netto
|
||||
71
modules/EcmAgreements/javascript/columndefs.js
Executable file
71
modules/EcmAgreements/javascript/columndefs.js
Executable file
@@ -0,0 +1,71 @@
|
||||
columns = new Array();
|
||||
//define columns
|
||||
//begin: number
|
||||
columns[0] = {
|
||||
'name' : 'number',
|
||||
'label' : 'Lp.',
|
||||
'width' : 4,
|
||||
'content' : new Array(),
|
||||
};
|
||||
columns[0]['content'][0] = {'name' : '', 'type': 'text', 'readonly' : true};
|
||||
//end: number
|
||||
//begin: code
|
||||
columns[1] = {
|
||||
'name' : 'payment_',
|
||||
'label' : 'Termin płatności odsetek i raty kapitałowej',
|
||||
'width' : 20,
|
||||
'content' : new Array(),
|
||||
};
|
||||
columns[1]['content'][0] = {'name' : 'date', 'type': 'text', 'readonly' : true};
|
||||
//end: code
|
||||
//begin: name
|
||||
columns[2] = {
|
||||
'name' : 'total',
|
||||
'label' : 'Suma raty i odsetek',
|
||||
'width' : 6,
|
||||
'align' : 'right',
|
||||
'content' : new Array(),
|
||||
};
|
||||
columns[2]['content'][0] = {'name' : '', 'type': 'text','isNumber' : true};
|
||||
//end: name
|
||||
//begin: quantity
|
||||
columns[3] = {
|
||||
'name' : 'interest_',
|
||||
'label' : 'Odsetki',
|
||||
'width' : 5,
|
||||
'content' : new Array(),
|
||||
'align' : 'right',
|
||||
};
|
||||
columns[3]['content'][0] = {'name' : 'rate', 'type': 'text', 'isNumber' : true, 'onChange' : 'calculateRow($(this).parent(\'td\').parent(\'tr\').index());'};
|
||||
//end: quantity
|
||||
//begin: unit
|
||||
columns[4] = {
|
||||
'name' : 'rate_of_',
|
||||
'label' : 'Prowizja',
|
||||
'width' : 5,
|
||||
'content' : new Array(),
|
||||
'align' : 'right',
|
||||
};
|
||||
columns[4]['content'][0] = {'name' : 'commission', 'type': 'text','isNumber' : true, 'onChange' : 'calculateRow($(this).parent(\'td\').parent(\'tr\').index());'};
|
||||
//end: unit
|
||||
//begin: price_start
|
||||
columns[5] = {
|
||||
'name' : 'principal_',
|
||||
'label' : 'Rata kapitałowa',
|
||||
'width' : 5,
|
||||
'content' : new Array(),
|
||||
'align' : 'right',
|
||||
};
|
||||
columns[5]['content'][0] = {'name' : 'value', 'type': 'text', 'isNumber' : true, 'onChange' : 'ObliczPozycje($(this).parent(\'td\').parent(\'tr\').index());'};
|
||||
//end: price_start
|
||||
//begin: discount
|
||||
columns[6] = {
|
||||
'name' : 'saldo',
|
||||
'label' : 'Saldo',
|
||||
'width' : 5,
|
||||
'content' : new Array(),
|
||||
'align' : 'right',
|
||||
};
|
||||
columns[6]['content'][0] = {'name' : '', 'type': 'text', 'isNumber' : true, 'onChange' : 'calculateRow($(this).parent(\'td\').parent(\'tr\').index());'};
|
||||
//end: discount
|
||||
//begin: price_netto
|
||||
Reference in New Issue
Block a user