Add JS files
This commit is contained in:
265
modules/EcmInvoiceOuts/javascript/Consignments.js
Executable file
265
modules/EcmInvoiceOuts/javascript/Consignments.js
Executable file
@@ -0,0 +1,265 @@
|
||||
var checkProductIsConsignment = function() {
|
||||
var count = $('#' + itemsTable + '_T tr').length - 1; // -1 - thead row
|
||||
|
||||
for (var index = 0; index != count; index++) {
|
||||
if ($('#product_is_consignment_' + index).val() == '1') {
|
||||
if ($("#is_wz").val() != true) {
|
||||
var f = $('#quantity_' + index).attr('onchange');
|
||||
f += 'showConsignmentsOptions(\'' + index + '\');';
|
||||
$('#quantity_' + index).attr('onchange', f);
|
||||
var f2 = $('#quantity_' + index).attr('onchange');
|
||||
if (!items[index].product_consignment_id || items[index].product_consignment_id=='')
|
||||
getConsignmentsDiv(index);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
$('#quantity_' + (count - 2)).focus();
|
||||
$('#quantity_' + (count - 2)).select();
|
||||
//addRowClickHandler();
|
||||
}
|
||||
|
||||
function addRowClickHandler() {
|
||||
$('#itemsTable').find('tr').click(function() {
|
||||
var count = $('#' + itemsTable + '_T tr').length - 1;
|
||||
for (var index = 0; index != count; index++) {
|
||||
if ($('#product_is_consignment_' + index).val() != '1')
|
||||
continue;
|
||||
var qty = UnformatNumber($('#quantity_' + index).val());
|
||||
var div_size = $('#consignments_div_' + index).size();
|
||||
// if (index == $(this).index() && div_size>0) continue;
|
||||
if (index == $(this).index() && qty > 0 && div_size == 0) {
|
||||
getInsertConsignmentsDiv(index);
|
||||
} else if (index != $(this).index() && qty > 0)
|
||||
$('#consignments_div_' + index).hide('slow', function() {
|
||||
$(this).remove();
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
var showConsignmentsOptions = function(index) {
|
||||
checkConsignments(index);
|
||||
if (items[index].product_is_consignment == '1')
|
||||
if (!items[index].product_consignment_id || items[index].product_consignment_id=='')
|
||||
getConsignmentsDiv(index);
|
||||
}
|
||||
|
||||
var getInsertConsignmentsDiv = function(index) {
|
||||
$('#consignments_div_' + index).remove(); // panel exists
|
||||
var part = '';
|
||||
if (items[index].product_consignment_part && items[index].product_consignment_part.length > 0)
|
||||
part = items[index].product_consignment_part;
|
||||
var container = $('#itemsTable_T > tbody').find('#name_' + index).parent()
|
||||
.parent();
|
||||
var div = $('<div></div>');
|
||||
div.attr('id', 'consignments_div_' + index);
|
||||
div.attr('name', 'consignments_div_' + index);
|
||||
div.css('float', 'left');
|
||||
div.css('text-align', 'left');
|
||||
div.css('border', '1px solid rgb(204,204,204)');
|
||||
div.css('padding', '3px');
|
||||
div.css('display', 'none');
|
||||
div.css('width', '90%');
|
||||
input = $('<input></input>');
|
||||
input.attr('id', 'consignment_part_no');
|
||||
input.keyup(function(event) {
|
||||
var t = $(event.target);
|
||||
$('#product_consignment_part_' + index).val(t.val());
|
||||
items[index].product_consignment_part = t.val();
|
||||
});
|
||||
input.css('width', '90%');
|
||||
input.val(part);
|
||||
div.append('Nr parti: ');
|
||||
div.append(input);
|
||||
container.html(div);
|
||||
div.show('slow');
|
||||
input.focus();
|
||||
}
|
||||
|
||||
var checkConsignments = function(index) {
|
||||
var qty = UnformatNumber($('#quantity_' + index).val());
|
||||
if (qty<0 && Math.abs(qty)>items[index].product_consignment_qty) {
|
||||
items[index].product_consignment_part='';
|
||||
items[index].product_consignment_id='';
|
||||
items[index].product_consignment_qty='';
|
||||
$('#product_consignment_part'+index).val('');
|
||||
$('#product_consignment_id'+index).val('');
|
||||
}
|
||||
}
|
||||
|
||||
var getConsignmentsDiv = function(index) {
|
||||
$('#consignments_div_' + index).remove(); // panel exists
|
||||
var prod_id = $('#itemsTable_T > tbody').find('#product_id_' + index).val();
|
||||
if (!prod_id || prod_id == "")
|
||||
return; // empty row
|
||||
var gcd = '#product_consignment_part_' + index;
|
||||
var gci = '#product_consignment_id_' + index;
|
||||
var container = $('#itemsTable_T > tbody').find('#name_' + index).parent()
|
||||
.parent();
|
||||
// if (handler.prev().attr('name') != 'vsbr') handler.before('<br
|
||||
// name="vsbr">'); //VerySpecialBR - first with name :)
|
||||
var qty = UnformatNumber($('#itemsTable_T > tbody').find(
|
||||
'#quantity_' + index).val());
|
||||
var div = $('<div></div>');
|
||||
div.attr('id', 'consignments_div_' + index);
|
||||
div.attr('name', 'consignments_div_' + index);
|
||||
div.css('float', 'left');
|
||||
div.css('text-align', 'left');
|
||||
div.css('border', '1px solid rgb(204,204,204)');
|
||||
div.css('padding', '3px');
|
||||
div.css('display', 'none');
|
||||
div.css('width', '90%');
|
||||
var qty = UnformatNumber($('#itemsTable_T > tbody').find(
|
||||
'#quantity_' + index).val());
|
||||
var prod_id = $('#itemsTable_T > tbody').find('#product_id_' + index).val();
|
||||
div.append('<table></table>');
|
||||
container.append(div);
|
||||
if (items[index].product_is_consignment == '1')
|
||||
div.append(getConsignments(prod_id, qty, $("#stock_id").val(), index));
|
||||
else
|
||||
div.append(getDocuments(prod_id, qty, $("#stock_id").val(), index));
|
||||
}
|
||||
var getDocuments = function(prod_id, qty, stock_id, index) {
|
||||
// AJAX call
|
||||
var a = jQuery
|
||||
.ajax({
|
||||
type : 'POST',
|
||||
url : 'index.php?module=EcmStockDocCorrects&action=javahelper&to_pdf=1',
|
||||
data : {
|
||||
job : 'getConsignmentsDocs',
|
||||
prod_id : prod_id,
|
||||
stock_id : stock_id
|
||||
},
|
||||
dataType : 'json',
|
||||
async : false,
|
||||
});
|
||||
var consignments = $.parseJSON(a.responseText);
|
||||
var last = consignments.length - 1;
|
||||
var container = $('<table></table>');
|
||||
container.css('width', '100%');
|
||||
$.each(consignments, function(i, c) {
|
||||
var p = $('<p></p>');
|
||||
var tr = $('<tr></tr>');
|
||||
tr.css('width', '100%');
|
||||
var a = $('<a></a>');
|
||||
a.html(c.part_no);
|
||||
a.attr('index', index);
|
||||
if (c.availability >= Math.abs(qty)) {
|
||||
a.click(function(event) {
|
||||
var t = $(event.target);
|
||||
var index = t.attr('index');
|
||||
$('#product_consignment_id_' + index).val(c.operation_id)
|
||||
$('#product_consignment_part_' + index).val(c.part_no);
|
||||
$('#product_consignment_qty_' + index).val(c.availability);
|
||||
//$('#price_'+index).val(FormatNumber(c.price));
|
||||
//insert max qty
|
||||
$('#quantity_'+index).parent().append('<p style="text-align: right;" id="max_quantity_'+index+'">(Max: '+FormatNumber(c.availability,c.precision)+')</p>');
|
||||
$('#quantity_'+index).focus();
|
||||
items[index].product_consignment_id = c.operation_id;
|
||||
items[index].product_consignment_part = c.part_no;
|
||||
items[index].product_consignment_qty = c.availability;
|
||||
//calculateRow(index);
|
||||
var div = $('#consignments_div_' + index);
|
||||
div.hide('slow');
|
||||
});
|
||||
a.css('cursor', 'pointer');
|
||||
a.css('color', 'blue');
|
||||
} else
|
||||
a.css('color', 'red');
|
||||
var td = $('<td></td>');
|
||||
td.append(a);
|
||||
tr.append(td);
|
||||
var td = $('<td></td>');
|
||||
td.append(FormatNumber(c.availability,c.precision) + ' ' + c.unit);
|
||||
tr.append(td);
|
||||
var td = $('<td></td>');
|
||||
td.append(FormatNumber(c.price) + ' ' + c.currency + ' / ' + c.unit);
|
||||
tr.append(td);
|
||||
container.append(tr);
|
||||
});
|
||||
// show div
|
||||
$('#consignments_div_' + index).show('slow');
|
||||
return container;
|
||||
}
|
||||
|
||||
var getConsignments = function(prod_id, qty, stock_id, index) {
|
||||
// AJAX call
|
||||
var a = jQuery
|
||||
.ajax({
|
||||
type : 'POST',
|
||||
url : 'index.php?module=EcmStockDocCorrects&action=javahelper&to_pdf=1',
|
||||
data : {
|
||||
job : 'getConsignments',
|
||||
prod_id : prod_id,
|
||||
stock_id : stock_id
|
||||
},
|
||||
dataType : 'json',
|
||||
async : false,
|
||||
});
|
||||
var consignments = $.parseJSON(a.responseText);
|
||||
var last = consignments.length - 1;
|
||||
var container = $('<table></table>');
|
||||
container.css('width', '100%');
|
||||
$.each(consignments, function(i, c) {
|
||||
var p = $('<p></p>');
|
||||
var tr = $('<tr></tr>');
|
||||
tr.css('width', '100%');
|
||||
var a = $('<a></a>');
|
||||
a.html(c.document_no);
|
||||
a.attr('index', index);
|
||||
if (c.availability >= Math.abs(qty)) {
|
||||
a.click(function(event) {
|
||||
var t = $(event.target);
|
||||
var index = t.attr('index');
|
||||
$('#product_consignment_id_' + index).val(c.operation_id)
|
||||
$('#product_consignment_part_' + index).val(c.part_no);
|
||||
$('#product_consignment_qty_' + index).val(c.availability);
|
||||
$('#price_'+index).val(FormatNumber(c.price));
|
||||
//insert max qty
|
||||
$('#quantity_'+index).parent().append('<p style="text-align: right;" id="max_quantity_'+index+'">(Max: '+FormatNumber(c.availability,c.precision)+')</p>');
|
||||
$('#quantity_'+index).focus();
|
||||
items[index].product_consignment_id = c.operation_id;
|
||||
items[index].product_consignment_part = c.part_no;
|
||||
items[index].product_consignment_qty = c.availability;
|
||||
//calculateRow(index);
|
||||
var div = $('#consignments_div_' + index);
|
||||
div.hide('slow');
|
||||
});
|
||||
a.css('cursor', 'pointer');
|
||||
a.css('color', 'blue');
|
||||
} else
|
||||
a.css('color', 'red');
|
||||
var td = $('<td></td>');
|
||||
td.append(a);
|
||||
tr.append(td);
|
||||
var td = $('<td></td>');
|
||||
td.append(c.part_no);
|
||||
tr.append(td);
|
||||
var td = $('<td></td>');
|
||||
td.append(FormatNumber(c.availability,c.precision) + ' ' + c.unit);
|
||||
tr.append(td);
|
||||
var td = $('<td></td>');
|
||||
td.append(FormatNumber(c.price) + ' ' + c.currency + ' / ' + c.unit);
|
||||
tr.append(td);
|
||||
container.append(tr);
|
||||
});
|
||||
// show div
|
||||
$('#consignments_div_' + index).show('slow');
|
||||
return container;
|
||||
}
|
||||
|
||||
function checkConsignmentsValues() {
|
||||
var count = items.length;//$('#' + itemsTable + '_T tr').length - 1; // -1 - thead row
|
||||
var NO_ERROR = true;
|
||||
if ($("#is_wz").val() != true) {
|
||||
for (var index = 0; index < count; index++) {
|
||||
if (items[index].product_is_consignment && items[index].product_is_consignment == '1') {
|
||||
var tmp = items[index].product_consignment_part;
|
||||
if (!tmp) tmp = '';
|
||||
if (tmp.length==0) NO_ERROR = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return NO_ERROR;
|
||||
}
|
||||
327
modules/EcmInvoiceOuts/javascript/EcmInvoiceOuts4.js
Executable file
327
modules/EcmInvoiceOuts/javascript/EcmInvoiceOuts4.js
Executable file
@@ -0,0 +1,327 @@
|
||||
//START:
|
||||
$(document).ready(
|
||||
|
||||
function() {
|
||||
//set sizes
|
||||
addToValidate('EditView','bankaccount','bankaccount',true,'Proszę wybrać konto dla przelewu');
|
||||
$("#stock").on("change",stockChange);
|
||||
$("#parent_name").attr("size", "70");
|
||||
$("#parent_name_copy").attr("size", "70");
|
||||
$("#parent_shipping_address_name").attr("size", "70");
|
||||
$("#parent_payer_address_name").attr("size", "70");
|
||||
$("#payment_date_days").css("width", "40");
|
||||
$("#discount").css("width", "40");
|
||||
$("#discount").val("0");
|
||||
$("#payment_method").css("width", "100");
|
||||
$("#payment_method_paid").css("width", "100");
|
||||
//change parent select button
|
||||
$("#btn_clr_parent_name").children().attr("src","themes/default/images/id-ff-add.png" );
|
||||
$("#btn_clr_parent_name").attr("title","Dodaj" );
|
||||
$("#btn_clr_parent_name").click(createAccount);
|
||||
// confirm exit
|
||||
window.onbeforeunload = confirmExit;
|
||||
// prevent submit by enter press
|
||||
lockEnter();
|
||||
// parent info
|
||||
var previousVal;
|
||||
var pollInterval = setInterval(function() {
|
||||
var val = $('#parent_id').val();
|
||||
if (val !== previousVal) {
|
||||
if ($('#parent_id').val() == '') return;
|
||||
$(".loading_panel").css("display", "block");
|
||||
setTimeout(function() {
|
||||
getParentInfo($("#parent_id").val(), 'Accounts');
|
||||
}, 1000);
|
||||
}
|
||||
previousVal = val;
|
||||
}, 500);
|
||||
//newProduct
|
||||
var previousVal2;
|
||||
var prodInterval = setInterval(function() {
|
||||
var val = $('#newProductId').val();
|
||||
if (val !== previousVal2) {
|
||||
if ($('#newProductId').val() == '') return;
|
||||
$(".loading_panel").css("display", "block");
|
||||
setTimeout(function() {
|
||||
AddProduct(items.length-1, val);
|
||||
}, 500);
|
||||
}
|
||||
previousVal2 = val;
|
||||
}, 500);
|
||||
// parent info
|
||||
var previousVal3;
|
||||
var prodInterval = setInterval(function() {
|
||||
var val = $('#sell_date').val();
|
||||
if (val !== previousVal3) {
|
||||
if ($("#currency_id :selected").val() != 'PLN')
|
||||
getNBPCurrencyExchange($("#currency_id :selected").val());
|
||||
}
|
||||
previousVal3 = val;
|
||||
}, 500);
|
||||
// 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);
|
||||
});
|
||||
$("#stock").change(function() {
|
||||
$("#stock_id").val(($("#stock :selected").val()));
|
||||
if($("#is_correct").val() != true){
|
||||
// EcmDocumentNumberGenerator_getNormalNumber('document_no', 'EcmInvoiceOuts', $("#stock :selected").val());
|
||||
} else {
|
||||
// EcmDocumentNumberGenerator_getCorrectNumber('document_no', 'EcmInvoiceOuts', $("#stock :selected").val());
|
||||
}
|
||||
});
|
||||
$("#currency_id").change(function() {
|
||||
if ($('#currency_id').val() != 'PLN') {
|
||||
$('#curr_trigger').show();
|
||||
getNBPCurrencyExchange($("#currency_id :selected").val());
|
||||
} else {
|
||||
$('#curr_trigger').hide();
|
||||
$('#currency_value_nbp').val("");
|
||||
$('#currency_table_tmp').val("");
|
||||
$('#currency_table').val("");
|
||||
}
|
||||
});
|
||||
$('#paid_val').change(function() {
|
||||
calculateTotal();
|
||||
});
|
||||
$('#prepaid').blur(function() {
|
||||
$("#prepaid").val(FormatNumber($("#prepaid").val()));
|
||||
calculateTotal();
|
||||
});
|
||||
|
||||
$('#pdf_type').change(function () {
|
||||
manageOO();
|
||||
var count = $('#' + itemsTable + '_T tr').length - 1; // -1 -
|
||||
// thead row
|
||||
for (var index = 0; index != count; index++){
|
||||
calculateRow(index);
|
||||
|
||||
}
|
||||
|
||||
calculateTotal();
|
||||
});
|
||||
|
||||
$('#prepaid').click(function() {
|
||||
// remove 1000 sep
|
||||
var val = $('#prepaid').val();
|
||||
while (val.indexOf('.') != -1)
|
||||
val = val.replace('.', '');
|
||||
$('#prepaid').val(val);
|
||||
});
|
||||
$('#currency_value_nbp').blur(function() {
|
||||
$("#currency_value_nbp").val(FormatNumber($("#currency_value_nbp").val(),4));
|
||||
calculateTotal();
|
||||
});
|
||||
$('#currency_value_nbp').click(function() {
|
||||
// remove 1000 sep
|
||||
var val = $('#currency_value_nbp').val();
|
||||
while (val.indexOf('.') != -1)
|
||||
val = val.replace('.', '');
|
||||
$('#currency_value_nbp').val(val);
|
||||
});
|
||||
$("#discount").blur(function() {
|
||||
if (UnformatNumber($('#discount').val()) > 100) $('#discount').val('100');
|
||||
var count = $('#' + itemsTable + '_T tr').length - 1; // -1 - thead row
|
||||
for (var index = 0; index != count; index++)
|
||||
calculateRow(index);
|
||||
$('#discount_tmp').val(UnformatNumber($('#discount').val()));
|
||||
});
|
||||
//payment date functions
|
||||
$('#payment_date_days').css('height', '18');
|
||||
|
||||
$('#payment_date_days').change(function() {
|
||||
calculatePaymentDate();
|
||||
});
|
||||
$('#payment_date_days').change(function() {
|
||||
calculatePaymentDate();
|
||||
});
|
||||
var previousVal5;
|
||||
var pollInterval5 = setInterval(function() {
|
||||
var val = $('#register_date').val();
|
||||
if (val !== previousVal5) {
|
||||
setTimeout(function() {
|
||||
calculatePaymentDate();
|
||||
}, 1000);
|
||||
}
|
||||
previousVal5 = val;
|
||||
}, 1000);
|
||||
|
||||
|
||||
// parent info
|
||||
var previousVal4;
|
||||
var pollInterval4 = setInterval(function() {
|
||||
var val = $('#payment_date').val();
|
||||
if (val !== previousVal4) {
|
||||
setTimeout(function() {
|
||||
calculateDateDiff();
|
||||
}, 1000);
|
||||
}
|
||||
previousVal4 = val;
|
||||
}, 1000);
|
||||
|
||||
// searchProductInput change
|
||||
$('#searchProductsInput').keyup(function() {
|
||||
searchProducts();
|
||||
});
|
||||
DrawHeaders();
|
||||
|
||||
if (($("#new_number").val() == true)
|
||||
&& ($("#duplicate").val() != true) && ($("#is_correct").val() != true) && ($("#is_wz").val() != true) && ($("#is_sale").val() != true)) {
|
||||
|
||||
EcmDocumentNumberGenerator_getNumberTemplate('document_no', 'EcmInvoiceOuts');
|
||||
hideOperations();
|
||||
|
||||
} else if (($("#new_number").val() == true)
|
||||
&& ($("#duplicate").val() == true)) {
|
||||
|
||||
getParentInfo($("#parent_id").val(),
|
||||
'Accounts');
|
||||
getItems();
|
||||
hideOperations();
|
||||
} else if (($("#new_number").val() == true)
|
||||
&& ($("#is_correct").val() == true)) {
|
||||
EcmDocumentNumberGenerator_getNumberTemplate('document_no', 'EcmInvoiceOuts');
|
||||
getParentInfo($("#parent_id").val(),
|
||||
'Accounts');
|
||||
getItems();
|
||||
$("#type").val("correct");
|
||||
|
||||
$("#sell_date").attr("disabled", true);
|
||||
$('#sell_date_trigger').hide();
|
||||
}else if (($("#new_number").val() == true)
|
||||
&& ($("#is_wz").val() == true)) {
|
||||
EcmDocumentNumberGenerator_getNumberTemplate('document_no', 'EcmInvoiceOuts');
|
||||
|
||||
getItemsFromWZ();
|
||||
hideOperations();
|
||||
} else if (($("#new_number").val() == true)
|
||||
&& ($("#is_sale").val() == true)) {
|
||||
EcmDocumentNumberGenerator_getNumberTemplate('document_no', 'EcmInvoiceOuts');
|
||||
//getParentInfo($("#parent_id").val(),'Accounts');
|
||||
getItemsFromSale();
|
||||
hideOperations();
|
||||
if($("#ecmpaymentcondition_id").val()!='')calculatePaymentDate($("#ecmpaymentcondition_id").val());
|
||||
|
||||
} else {
|
||||
$('#document_no').attr('readonly',false);
|
||||
getParentInfo($("#parent_id").val(),
|
||||
'Accounts');
|
||||
getItems();
|
||||
|
||||
}
|
||||
$(".loading_panel").css("display", "none");
|
||||
// handle setItems
|
||||
setITEMS = function() {
|
||||
var formname = 'EditView';
|
||||
if (check_form_(formname) == true) {
|
||||
SetTab('ITEMS');
|
||||
$('#pdf_type').trigger('change');
|
||||
}
|
||||
};
|
||||
// wyszukiwanie start
|
||||
$('#searchProductsInput').keyup(function() {
|
||||
// stronicowanie od 1 strony przy zmianie szukanego produktu
|
||||
$('#searchStart').val(0);
|
||||
searchProducts();
|
||||
});
|
||||
if($('#type').val()=='normal'){
|
||||
AddSearchRecord();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
function stockChange(){
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "index.php?module=EcmInvoiceOuts&action=javahelper&to_pdf=1",
|
||||
dataType : "json",
|
||||
success: function(data) {
|
||||
if(data != false){
|
||||
$("#bankaccount").val(data);
|
||||
$('#bankaccounts').val(data);
|
||||
}
|
||||
},
|
||||
data: {
|
||||
job: 'getStockBankAccountId',
|
||||
stock_id: $(this).val(),
|
||||
parent_id: $("#parent_id").val(),
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// handle save
|
||||
var check_form_ = check_form;
|
||||
check_form = function(formname,event) {
|
||||
// zapobiega zapisywaniu dokumentu firefox bug, w przypadku nacisniecia enter w polu z autocomplete
|
||||
if(event.clientY==0 && event.clientX==0){
|
||||
return false;
|
||||
}
|
||||
|
||||
if (UnformatNumber($('#left').text())==0) {}
|
||||
else {
|
||||
if ($('#payment_date_days').val() == '0' || $('#payment_method :selected').val() == '') {
|
||||
alert('Nie wybrano warunków zapłaty.');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
var consigns = checkConsignmentsValues();
|
||||
if (consigns != true) {
|
||||
setITEMS('ITEMS');
|
||||
alert('Brak wymaganych informacji o partiach produktu.');
|
||||
return false;
|
||||
}
|
||||
window.onbeforeunload = null;
|
||||
if (items.length == 0 || items[0].product_id=='') {
|
||||
alert("Brak produktów");
|
||||
return false;
|
||||
}
|
||||
$(".loading_panel").css("display", "block");
|
||||
// calculate totals
|
||||
clearEmpty();
|
||||
var count = $('#' + itemsTable + '_T tr').length - 1; // -1 - thead row
|
||||
for (var index = 0; index != count; index++)
|
||||
calculateRow(index);
|
||||
|
||||
$("#total_netto").val($("#t_netto").val());
|
||||
//$("#total_brutto").val($("#left").text());
|
||||
//$("#discount").val($("#disc").val());
|
||||
$("#position_list").val(JSON.stringifyNoSecurity(items));
|
||||
if ($("#is_wz").val() != true) {
|
||||
if($('#is_correct').val()!='1'){
|
||||
if(checkProducts()==false){
|
||||
$(".loading_panel").css("display", "none");
|
||||
alert("Brak wystarczającej ilości magazynowej do wystawienia dokumentu!");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
$("#type").attr("disabled", false);
|
||||
$("#sell_date").attr("disabled", false);
|
||||
if (check_form_(formname) == false) {
|
||||
window.onbeforeunload = confirmExit;
|
||||
$(".loading_panel").css("display", "none");
|
||||
return false;
|
||||
} else {
|
||||
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;
|
||||
}
|
||||
});
|
||||
}
|
||||
6
modules/EcmInvoiceOuts/javascript/EcmInvoiceOutsDetail.js
Executable file
6
modules/EcmInvoiceOuts/javascript/EcmInvoiceOutsDetail.js
Executable file
@@ -0,0 +1,6 @@
|
||||
//START:
|
||||
$(document).ready(
|
||||
function() {
|
||||
DrawHeaders();
|
||||
getItems(false);
|
||||
});
|
||||
1684
modules/EcmInvoiceOuts/javascript/bimit_table8.js
Executable file
1684
modules/EcmInvoiceOuts/javascript/bimit_table8.js
Executable file
File diff suppressed because it is too large
Load Diff
118
modules/EcmInvoiceOuts/javascript/columndefs-detail.js
Executable file
118
modules/EcmInvoiceOuts/javascript/columndefs-detail.js
Executable file
@@ -0,0 +1,118 @@
|
||||
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' : 'product_',
|
||||
'label' : 'Indeks',
|
||||
'width' : 6,
|
||||
'content' : new Array(),
|
||||
};
|
||||
columns[1]['content'][0] = {'name' : 'code', 'type': 'hidden', 'readonly' : true};
|
||||
columns[1]['content'][1] = {'name' : 'id', 'type': 'hidden'};
|
||||
columns[1]['content'][2] = {'name' : 'link', 'type': 'text', 'readonly' : true};
|
||||
columns[1]['content'][3] = {'name' : 'category_id', 'type': 'hidden'};
|
||||
columns[1]['content'][4] = {'name' : 'record_id', 'type': 'hidden'};
|
||||
//end: code
|
||||
//begin: name
|
||||
columns[2] = {
|
||||
'name' : 'name',
|
||||
'label' : 'Nazwa',
|
||||
'width' : 20,
|
||||
'content' : new Array(),
|
||||
};
|
||||
columns[2]['content'][0] = {'name' : '', 'type': 'text'};
|
||||
//end: name
|
||||
//begin: quantity
|
||||
columns[3] = {
|
||||
'name' : 'quantity',
|
||||
'label' : 'Ilość',
|
||||
'width' : 5,
|
||||
'content' : new Array(),
|
||||
'align' : 'right',
|
||||
};
|
||||
columns[3]['content'][0] = {'name' : '', 'type': 'text', 'isNumber' : true, 'onChange' : 'calculateRow($(this).parent(\'td\').parent(\'tr\').index());'};
|
||||
//end: quantity
|
||||
//begin: unit
|
||||
columns[4] = {
|
||||
'name' : 'unit_',
|
||||
'label' : 'J.M.',
|
||||
'width' : 5,
|
||||
'content' : new Array(),
|
||||
'align' : 'center',
|
||||
};
|
||||
columns[4]['content'][0] = {'name' : 'name', 'type': 'text','readonly' : true};
|
||||
columns[4]['content'][1] = {'name' : 'id', 'type': 'hidden'};
|
||||
//end: unit
|
||||
//begin: price_start
|
||||
columns[5] = {
|
||||
'name' : 'price_start',
|
||||
'label' : 'Cena<br>początkowa',
|
||||
'width' : 5,
|
||||
'content' : new Array(),
|
||||
'align' : 'right',
|
||||
};
|
||||
columns[5]['content'][0] = {'name' : '', 'type': 'text', 'isNumber' : true, 'onChange' : 'calculateRow($(this).parent(\'td\').parent(\'tr\').index());'};
|
||||
columns[5]['content'][1] = {'name' : '_div', 'type': 'text'};
|
||||
//end: price_start
|
||||
//begin: discount
|
||||
columns[6] = {
|
||||
'name' : 'discount',
|
||||
'label' : 'Upust<br>(%)',
|
||||
'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
|
||||
columns[7] = {
|
||||
'name' : 'price_netto',
|
||||
'label' : 'Cena<br>po upuście',
|
||||
'width' : 5,
|
||||
'content' : new Array(),
|
||||
'align' : 'right',
|
||||
};
|
||||
columns[7]['content'][0] = {'name' : '', 'type': 'text', 'isNumber' : true, 'readonly' : true};
|
||||
//end: price_start
|
||||
//begin: ecmvat
|
||||
columns[8] = {
|
||||
'name' : 'ecmvat_',
|
||||
'label' : 'VAT<br>(%)',
|
||||
'width' : 5,
|
||||
'content' : new Array(),
|
||||
'align' : 'right',
|
||||
};
|
||||
columns[8]['content'][0] = {'name' : 'name', 'type': 'text'};
|
||||
columns[8]['content'][1] = {'name' : 'value', 'type': 'hidden'};
|
||||
columns[8]['content'][2] = {'name' : 'id', 'type': 'hidden'};
|
||||
//end: ecmvat
|
||||
//begin: total
|
||||
columns[9] = {
|
||||
'name' : 'total_',
|
||||
'label' : 'Wartość',
|
||||
'width' : 5,
|
||||
'content' : new Array(),
|
||||
'align' : 'right',
|
||||
};
|
||||
columns[9]['content'][0] = {'name' : 'netto', 'type': 'text', 'isNumber' : true, 'readonly' : true};
|
||||
//end: total
|
||||
|
||||
//begin: remarks
|
||||
columns[10] = {
|
||||
'name' : 'price_purchase',
|
||||
'label' : 'Koszt',
|
||||
'width' : 10,
|
||||
'content' : new Array(),
|
||||
'align' : 'right',
|
||||
};
|
||||
columns[10]['content'][0] = {'name' : '', 'type': 'text', 'isNumber' : true, 'readonly' : true};
|
||||
//end: remarks
|
||||
159
modules/EcmInvoiceOuts/javascript/columndefs.js
Executable file
159
modules/EcmInvoiceOuts/javascript/columndefs.js
Executable file
@@ -0,0 +1,159 @@
|
||||
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' : 'product_',
|
||||
'label' : 'Indeks',
|
||||
'width' : 6,
|
||||
'content' : new Array(),
|
||||
};
|
||||
columns[1]['content'][0] = {'name' : 'code', 'type': 'hidden', 'readonly' : true};
|
||||
columns[1]['content'][1] = {'name' : 'id', 'type': 'hidden'};
|
||||
columns[1]['content'][2] = {'name' : 'item_id', 'type': 'hidden'};
|
||||
columns[1]['content'][3] = {'name' : 'itemold_id', 'type': 'hidden'};
|
||||
columns[1]['content'][4] = {'name' : 'link', 'type': 'text', 'readonly' : true};
|
||||
columns[1]['content'][5] = {'name' : 'parent_doc_id', 'type': 'hidden'};
|
||||
columns[1]['content'][6] = {'name' : 'parent_doc_type', 'type': 'hidden'};
|
||||
columns[1]['content'][7] = {'name' : 'parent_doc_item_id', 'type': 'hidden'};
|
||||
columns[1]['content'][8] = {'name' : 'corrected', 'type': 'hidden'};
|
||||
columns[1]['content'][9] = {'name' : 'precision', 'type': 'hidden'};
|
||||
columns[1]['content'][10] = {'name' : 'ks_group', 'type': 'hidden'};
|
||||
columns[1]['content'][11] = {'name' : 'category_id', 'type': 'hidden'};
|
||||
columns[1]['content'][12] = {'name' : 'is_oo', 'type': 'hidden'};
|
||||
columns[1]['content'][13] = {
|
||||
'name' : 'is_consignment',
|
||||
'type' : 'hidden'
|
||||
};
|
||||
columns[1]['content'][14] = {
|
||||
'name' : 'consignment_part',
|
||||
'type' : 'text',
|
||||
};
|
||||
columns[1]['content'][15] = {
|
||||
'name' : 'consignment_id',
|
||||
'type' : 'hidden',
|
||||
};
|
||||
|
||||
columns[1]['content'][16] = {
|
||||
'name' : 'consignment_qty',
|
||||
'type' : 'hidden',
|
||||
};
|
||||
//end: code
|
||||
//begin: name
|
||||
columns[2] = {
|
||||
'name' : 'name',
|
||||
'label' : 'Nazwa',
|
||||
'width' : 20,
|
||||
'content' : new Array(),
|
||||
};
|
||||
columns[2]['content'][0] = {'name' : '', 'type': 'text'};
|
||||
//end: name
|
||||
//begin: quantity
|
||||
columns[3] = {
|
||||
'name' : 'quantity',
|
||||
'label' : 'Ilość',
|
||||
'width' : 5,
|
||||
'content' : new Array(),
|
||||
'align' : 'right',
|
||||
};
|
||||
columns[3]['content'][0] = {'name' : '', 'type': 'text', 'isNumber' : true, 'onChange' : 'calculateRow($(this).parent(\'td\').parent(\'tr\').index());'};
|
||||
//end: quantity
|
||||
//begin: unit
|
||||
columns[4] = {
|
||||
'name' : 'unit_',
|
||||
'label' : 'J.M.',
|
||||
'width' : 5,
|
||||
'content' : new Array(),
|
||||
'align' : 'center',
|
||||
};
|
||||
columns[4]['content'][0] = {'name' : 'name', 'type': 'text','readonly' : true};
|
||||
columns[4]['content'][1] = {'name' : 'id', 'type': 'hidden'};
|
||||
//end: unit
|
||||
//begin: price_start
|
||||
columns[5] = {
|
||||
'name' : 'price_start',
|
||||
'label' : 'Cena<br>początkowa',
|
||||
'width' : 5,
|
||||
'content' : new Array(),
|
||||
'align' : 'right',
|
||||
};
|
||||
columns[5]['content'][0] = {'name' : '', 'type': 'text', 'isNumber' : true, 'onChange' : 'calculateRow($(this).parent(\'td\').parent(\'tr\').index());'};
|
||||
columns[5]['content'][1] = {'name' : '_div', 'type': 'text'};
|
||||
//end: price_start
|
||||
//begin: discount
|
||||
columns[6] = {
|
||||
'name' : 'discount',
|
||||
'label' : 'Upust<br>(%)',
|
||||
'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
|
||||
columns[7] = {
|
||||
'name' : 'price_',
|
||||
'label' : 'Cena<br>po upuście',
|
||||
'width' : 5,
|
||||
'content' : new Array(),
|
||||
'align' : 'right',
|
||||
};
|
||||
columns[7]['content'][0] = {'name' : 'netto', 'type': 'text', 'isNumber' : true, 'readonly' : true};
|
||||
columns[7]['content'][1] = {'name' : 'brutto', 'type': 'hidden'};
|
||||
columns[7]['content'][1] = {'name' : 'purchase', 'type': 'hidden'};
|
||||
//end: price_start
|
||||
//begin: ecmvat
|
||||
columns[8] = {
|
||||
'name' : 'ecmvat_',
|
||||
'label' : 'VAT<br>(%)',
|
||||
'width' : 5,
|
||||
'content' : new Array(),
|
||||
'align' : 'right',
|
||||
};
|
||||
columns[8]['content'][0] = {'name' : 'name', 'type': 'text'};
|
||||
columns[8]['content'][1] = {'name' : 'value', 'type': 'hidden'};
|
||||
columns[8]['content'][2] = {'name' : 'id', 'type': 'hidden'};
|
||||
columns[8]['content'][3] = {'name' : 'alter_id', 'type': 'hidden'};
|
||||
columns[8]['content'][4] = {'name' : 'alter_value', 'type': 'hidden'};
|
||||
columns[8]['content'][5] = {'name' : 'alter_name', 'type': 'hidden'};
|
||||
columns[8]['content'][6] = {'name' : 'div', 'type': 'hidden'};
|
||||
//end: ecmvat
|
||||
//begin: total
|
||||
columns[9] = {
|
||||
'name' : 'total_',
|
||||
'label' : 'Wartość',
|
||||
'width' : 5,
|
||||
'content' : new Array(),
|
||||
'align' : 'right',
|
||||
};
|
||||
columns[9]['content'][0] = {'name' : 'netto', 'type': 'text', 'isNumber' : true, 'readonly' : true};
|
||||
columns[9]['content'][1] = {'name' : 'brutto', 'type': 'hidden'};
|
||||
columns[9]['content'][2] = {'name' : 'vat', 'type': 'hidden'};
|
||||
|
||||
//end: total
|
||||
|
||||
//begin: remarks
|
||||
columns[10] = {
|
||||
'name' : 'stock_state_',
|
||||
'label' : 'Stan Magazynowy',
|
||||
'width' : 5,
|
||||
'content' : new Array(),
|
||||
'align' : 'right',
|
||||
};
|
||||
columns[10]['content'][0] = {'name' : 'value', 'type': 'text','readonly' : true};
|
||||
//end: remarks
|
||||
//begin: options
|
||||
columns[11] = {
|
||||
'name' : 'options',
|
||||
'label' : 'Opcje',
|
||||
'width' : 3,
|
||||
'content' : new Array(),
|
||||
};
|
||||
4
modules/EcmInvoiceOuts/javascript/searchcolumndefs.js
Executable file
4
modules/EcmInvoiceOuts/javascript/searchcolumndefs.js
Executable file
@@ -0,0 +1,4 @@
|
||||
var extraproductinfo_show=true; // info o produkcie
|
||||
var unit_show=true; // jednostka produktu
|
||||
var number_show=false; // numeruje wiersze
|
||||
var module_function="EcmInvoiceOuts";
|
||||
Reference in New Issue
Block a user