diff --git a/modules/EcmActions/js/EditViewDocumentReady.js b/modules/EcmActions/js/EditViewDocumentReady.js index 36170a89..a060a68e 100644 --- a/modules/EcmActions/js/EditViewDocumentReady.js +++ b/modules/EcmActions/js/EditViewDocumentReady.js @@ -1,17 +1,11 @@ -var startCat; -var startIndex; var cost_netto = 764; -var cost_netto_s = cost_netto/3600; // koszt netto / 1h = koszt na sekunde - +var cost_netto_s = cost_netto/3600; $(document).ready(function () { initializeTime(); if($('#cost_hour').val()==''){ $('#cost_hour').val("15,20"); } - //$('#cost_hour').attr('disabled','disabled'); - startCat = $('#category').find(":selected").val(); - startIndex = $('#indeks').val(); $("#cost_action").change(function () { cost_actionChange(); }); @@ -21,9 +15,6 @@ $(document).ready(function () { $('#cost_other').change(function () { cost_otherChange(); }); - $("#EditView").submit(function (event) { - indeksChek(); - }); }); function initializeTime() { @@ -43,7 +34,6 @@ function initializeTime() { $("#minutes").val(minutes); $("#hours").val(hours); } - function secondsChange() { var tmp = parseInt($("#seconds").val()); if (isNaN(tmp)) { @@ -58,7 +48,6 @@ function secondsChange() { $("#seconds").val(tmp); updateTime(); } - function minutesChange() { var tmp = parseInt($("#minutes").val()); if (isNaN(tmp)) { @@ -73,7 +62,6 @@ function minutesChange() { $("#minutes").val(tmp); updateTime(); } - function hoursChange() { var tmp = parseInt($("#hours").val()); if (isNaN(tmp)) { @@ -85,7 +73,6 @@ function hoursChange() { $("#hours").val(tmp); updateTime(); } - function cost_actionChange() { var tmp = parseFloat($("#cost_action").val().replace(",", ".")); if (isNaN(tmp) || tmp == 'NaN,NaN') { @@ -102,7 +89,6 @@ function cost_actionChange() { $('#time').val(time); initializeTime(); } - function cost_hourChange() { var tmp = parseFloat($("#cost_hour").val().replace(",", ".")); if (isNaN(tmp) || tmp == 'NaN,NaN') { @@ -110,7 +96,6 @@ function cost_hourChange() { } $("#cost_hour").val(FormatNumber(tmp)); } - function cost_otherChange() { var tmp = parseFloat($("#cost_other").val().replace(",", ".")); if (isNaN(tmp) || tmp == 'NaN,NaN') { @@ -126,100 +111,6 @@ function cost_otherChange() { var cost_action = (cost_hour*proporcja).toFixed(2); $("#cost_action").val(FormatNumber(cost_action)); } - -function categoryChange() { - var category = $('#category').find(":selected").val(); - console.log(category); - if (startIndex == '') { - var sufix; - $.ajax({ - type: "POST", - url: "index.php?module=EcmActions&action=indeksIncrement&to_pdf=1", - dataType: "json", - async: false, - data: { - job: "getIndeks", - category: category, - }, - success: function (data) { - sufix = data; - } - }); - var text = $('#category').find(":selected").text(); - var prefix = ''; - if (text.indexOf(' ') === -1) { - prefix = text.substring(0, 5).toUpperCase(); - } else { - prefix = text.substring(0, 2).toUpperCase(); - prefix = prefix - + text.substring(text.indexOf(' ') + 1, text.indexOf(' ') + 4) - .toUpperCase(); - } - var indeks = prefix + sufix; - $("#indeks").val(indeks); - }else{ - if(category==startCat){ - $("#indeks").val(startIndex); - }else{ - var sufix; - $.ajax({ - type: "POST", - url: "index.php?module=EcmActions&action=indeksIncrement&to_pdf=1", - dataType: "json", - async: false, - data: { - job: "getIndeks", - category: category, - }, - success: function (data) { - sufix = data; - } - }); - var text = $('#category').find(":selected").text(); - var prefix = ''; - if (text.indexOf(' ') === -1) { - prefix = text.substring(0, 5).toUpperCase(); - } else { - prefix = text.substring(0, 2).toUpperCase(); - prefix = prefix - + text.substring(text.indexOf(' ') + 1, text.indexOf(' ') + 4) - .toUpperCase(); - } - var indeks = prefix + sufix; - $("#indeks").val(indeks); - } - } -} - - -function indeksChek(){ - var checkindeks = $.trim($("#indeks").val()).toUpperCase(); - if (checkindeks.length > 0) { - $("#indeks").val(checkindeks); - var condition = false; - var category = $('#category').find(":selected").val(); - $.ajax({ - type: "POST", - url: "index.php?module=EcmActions&action=indeksIncrement&to_pdf=1", - dataType: "json", - async: false, - data: { - job: "checkIndeks", - indeks: checkindeks, - category: category, - }, - success: function (data) { - condition = data; - } - }); - if (condition) { - categoryChange(); - } - } else { - alert("Indeks nie może być pusty"); - } -} - function updateTime() { var hours = parseInt($("#hours").val()) * 3600; var minutes = parseInt($("#minutes").val()) * 60; @@ -242,7 +133,6 @@ function updateTime() { var tmp2 = (((cost_netto_s*time)/100)).toFixed(2); $("#cost_other").val(FormatNumber(tmp2)); } - function setCost_Hour() { var tmp = $("#time").val(); var cost_action = UnformatNumber($("#cost_action").val()); @@ -261,7 +151,6 @@ function setCost_Hour() { $("#cost_hour").val(FormatNumber(value)); } } - function setCost_Action() { var time = $("#time").val(); var cost_hour = UnformatNumber($("#cost_hour").val())*100; @@ -275,14 +164,12 @@ function setCost_Action() { var tmp = ((cost_hour_h*time)/100).toFixed(2); $("#cost_action").val(FormatNumber(tmp)); } - function setCost_Other() { var time = $("#time").val(); var cost_other = UnformatNumber($("#cost_other").val())*100; var tmp2 = (((cost_netto_s*time)/100)).toFixed(2); $("#cost_other").val(FormatNumber(tmp2)); } - function FormatNumber(number, precision) { var precision = precision || 2; // make string.. @@ -305,7 +192,6 @@ function FormatNumber(number, precision) { return c + ',' + tmp[1]; } - function UnformatNumber(number) { // make string.. number = number + ''; @@ -316,7 +202,6 @@ function UnformatNumber(number) { return parseFloat(number); } - // round with precision function toFixed(value, precision) { var precision = precision || 0, diff --git a/modules/EcmActions/metadata/editviewdefs.php b/modules/EcmActions/metadata/editviewdefs.php index d91a8e9d..ce13f2b6 100644 --- a/modules/EcmActions/metadata/editviewdefs.php +++ b/modules/EcmActions/metadata/editviewdefs.php @@ -101,5 +101,4 @@ $viewdefs [$module_name] = array( ) ) ) -) -?> +);