EcmActions: disable index change
This commit is contained in:
@@ -1,17 +1,11 @@
|
|||||||
var startCat;
|
|
||||||
var startIndex;
|
|
||||||
var cost_netto = 764;
|
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 () {
|
$(document).ready(function () {
|
||||||
initializeTime();
|
initializeTime();
|
||||||
if($('#cost_hour').val()==''){
|
if($('#cost_hour').val()==''){
|
||||||
$('#cost_hour').val("15,20");
|
$('#cost_hour').val("15,20");
|
||||||
}
|
}
|
||||||
//$('#cost_hour').attr('disabled','disabled');
|
|
||||||
startCat = $('#category').find(":selected").val();
|
|
||||||
startIndex = $('#indeks').val();
|
|
||||||
$("#cost_action").change(function () {
|
$("#cost_action").change(function () {
|
||||||
cost_actionChange();
|
cost_actionChange();
|
||||||
});
|
});
|
||||||
@@ -21,9 +15,6 @@ $(document).ready(function () {
|
|||||||
$('#cost_other').change(function () {
|
$('#cost_other').change(function () {
|
||||||
cost_otherChange();
|
cost_otherChange();
|
||||||
});
|
});
|
||||||
$("#EditView").submit(function (event) {
|
|
||||||
indeksChek();
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
function initializeTime() {
|
function initializeTime() {
|
||||||
@@ -43,7 +34,6 @@ function initializeTime() {
|
|||||||
$("#minutes").val(minutes);
|
$("#minutes").val(minutes);
|
||||||
$("#hours").val(hours);
|
$("#hours").val(hours);
|
||||||
}
|
}
|
||||||
|
|
||||||
function secondsChange() {
|
function secondsChange() {
|
||||||
var tmp = parseInt($("#seconds").val());
|
var tmp = parseInt($("#seconds").val());
|
||||||
if (isNaN(tmp)) {
|
if (isNaN(tmp)) {
|
||||||
@@ -58,7 +48,6 @@ function secondsChange() {
|
|||||||
$("#seconds").val(tmp);
|
$("#seconds").val(tmp);
|
||||||
updateTime();
|
updateTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
function minutesChange() {
|
function minutesChange() {
|
||||||
var tmp = parseInt($("#minutes").val());
|
var tmp = parseInt($("#minutes").val());
|
||||||
if (isNaN(tmp)) {
|
if (isNaN(tmp)) {
|
||||||
@@ -73,7 +62,6 @@ function minutesChange() {
|
|||||||
$("#minutes").val(tmp);
|
$("#minutes").val(tmp);
|
||||||
updateTime();
|
updateTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
function hoursChange() {
|
function hoursChange() {
|
||||||
var tmp = parseInt($("#hours").val());
|
var tmp = parseInt($("#hours").val());
|
||||||
if (isNaN(tmp)) {
|
if (isNaN(tmp)) {
|
||||||
@@ -85,7 +73,6 @@ function hoursChange() {
|
|||||||
$("#hours").val(tmp);
|
$("#hours").val(tmp);
|
||||||
updateTime();
|
updateTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
function cost_actionChange() {
|
function cost_actionChange() {
|
||||||
var tmp = parseFloat($("#cost_action").val().replace(",", "."));
|
var tmp = parseFloat($("#cost_action").val().replace(",", "."));
|
||||||
if (isNaN(tmp) || tmp == 'NaN,NaN') {
|
if (isNaN(tmp) || tmp == 'NaN,NaN') {
|
||||||
@@ -102,7 +89,6 @@ function cost_actionChange() {
|
|||||||
$('#time').val(time);
|
$('#time').val(time);
|
||||||
initializeTime();
|
initializeTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
function cost_hourChange() {
|
function cost_hourChange() {
|
||||||
var tmp = parseFloat($("#cost_hour").val().replace(",", "."));
|
var tmp = parseFloat($("#cost_hour").val().replace(",", "."));
|
||||||
if (isNaN(tmp) || tmp == 'NaN,NaN') {
|
if (isNaN(tmp) || tmp == 'NaN,NaN') {
|
||||||
@@ -110,7 +96,6 @@ function cost_hourChange() {
|
|||||||
}
|
}
|
||||||
$("#cost_hour").val(FormatNumber(tmp));
|
$("#cost_hour").val(FormatNumber(tmp));
|
||||||
}
|
}
|
||||||
|
|
||||||
function cost_otherChange() {
|
function cost_otherChange() {
|
||||||
var tmp = parseFloat($("#cost_other").val().replace(",", "."));
|
var tmp = parseFloat($("#cost_other").val().replace(",", "."));
|
||||||
if (isNaN(tmp) || tmp == 'NaN,NaN') {
|
if (isNaN(tmp) || tmp == 'NaN,NaN') {
|
||||||
@@ -126,100 +111,6 @@ function cost_otherChange() {
|
|||||||
var cost_action = (cost_hour*proporcja).toFixed(2);
|
var cost_action = (cost_hour*proporcja).toFixed(2);
|
||||||
$("#cost_action").val(FormatNumber(cost_action));
|
$("#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() {
|
function updateTime() {
|
||||||
var hours = parseInt($("#hours").val()) * 3600;
|
var hours = parseInt($("#hours").val()) * 3600;
|
||||||
var minutes = parseInt($("#minutes").val()) * 60;
|
var minutes = parseInt($("#minutes").val()) * 60;
|
||||||
@@ -242,7 +133,6 @@ function updateTime() {
|
|||||||
var tmp2 = (((cost_netto_s*time)/100)).toFixed(2);
|
var tmp2 = (((cost_netto_s*time)/100)).toFixed(2);
|
||||||
$("#cost_other").val(FormatNumber(tmp2));
|
$("#cost_other").val(FormatNumber(tmp2));
|
||||||
}
|
}
|
||||||
|
|
||||||
function setCost_Hour() {
|
function setCost_Hour() {
|
||||||
var tmp = $("#time").val();
|
var tmp = $("#time").val();
|
||||||
var cost_action = UnformatNumber($("#cost_action").val());
|
var cost_action = UnformatNumber($("#cost_action").val());
|
||||||
@@ -261,7 +151,6 @@ function setCost_Hour() {
|
|||||||
$("#cost_hour").val(FormatNumber(value));
|
$("#cost_hour").val(FormatNumber(value));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function setCost_Action() {
|
function setCost_Action() {
|
||||||
var time = $("#time").val();
|
var time = $("#time").val();
|
||||||
var cost_hour = UnformatNumber($("#cost_hour").val())*100;
|
var cost_hour = UnformatNumber($("#cost_hour").val())*100;
|
||||||
@@ -275,14 +164,12 @@ function setCost_Action() {
|
|||||||
var tmp = ((cost_hour_h*time)/100).toFixed(2);
|
var tmp = ((cost_hour_h*time)/100).toFixed(2);
|
||||||
$("#cost_action").val(FormatNumber(tmp));
|
$("#cost_action").val(FormatNumber(tmp));
|
||||||
}
|
}
|
||||||
|
|
||||||
function setCost_Other() {
|
function setCost_Other() {
|
||||||
var time = $("#time").val();
|
var time = $("#time").val();
|
||||||
var cost_other = UnformatNumber($("#cost_other").val())*100;
|
var cost_other = UnformatNumber($("#cost_other").val())*100;
|
||||||
var tmp2 = (((cost_netto_s*time)/100)).toFixed(2);
|
var tmp2 = (((cost_netto_s*time)/100)).toFixed(2);
|
||||||
$("#cost_other").val(FormatNumber(tmp2));
|
$("#cost_other").val(FormatNumber(tmp2));
|
||||||
}
|
}
|
||||||
|
|
||||||
function FormatNumber(number, precision) {
|
function FormatNumber(number, precision) {
|
||||||
var precision = precision || 2;
|
var precision = precision || 2;
|
||||||
// make string..
|
// make string..
|
||||||
@@ -305,7 +192,6 @@ function FormatNumber(number, precision) {
|
|||||||
|
|
||||||
return c + ',' + tmp[1];
|
return c + ',' + tmp[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
function UnformatNumber(number) {
|
function UnformatNumber(number) {
|
||||||
// make string..
|
// make string..
|
||||||
number = number + '';
|
number = number + '';
|
||||||
@@ -316,7 +202,6 @@ function UnformatNumber(number) {
|
|||||||
|
|
||||||
return parseFloat(number);
|
return parseFloat(number);
|
||||||
}
|
}
|
||||||
|
|
||||||
// round with precision
|
// round with precision
|
||||||
function toFixed(value, precision) {
|
function toFixed(value, precision) {
|
||||||
var precision = precision || 0,
|
var precision = precision || 0,
|
||||||
|
|||||||
@@ -101,5 +101,4 @@ $viewdefs [$module_name] = array(
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
);
|
||||||
?>
|
|
||||||
|
|||||||
Reference in New Issue
Block a user