var ajax_url = "index.php?module=EcmInvoiceOuts&action=javahelper&to_pdf=1"; var itemsTable = 'itemsTable'; var items = new Array(); var displayArray = new Array(); var searchedProducts = new Array(); function FillTable(data, allReadOnly) { html = ''; var pozycja = 1; var color; // loop throw data rows $ .each( data, function (row_index, row) { html += '
';
html += ' ';
// move down
html += '
';
html += '
';
html += '
';
html += '';
} else {
if (cell.label
&& cell.label != '')
html += '' + cell.label + '
'; html += ''; } }); html += '
');
setTimeout(function () {
var params = {
job: 'searchProducts',
searchKey: searchKey,
searchCategory: $("#productSearchCategory :selected").val(),
searchStock: $("#productSearchStock :selected").val(),
searchSort: $("#productSearchSort :selected").val(),
};
$.ajax({
type: "POST",
url: ajax_url,
dataType: "json",
success: function (data) {
if (data != '-1')
if (data.length == 0)
$('#searchResultDiv').html(
'MOD.LBL_SEARCH_NO_RESULT');
else
createSearchResult(data);
},
data: params
});
}, 1000);
}
// draw table
function DrawHeaders() {
var html = '';
html += '| ' + column.label + ' | '; }); html += '
| '; html += ' '; html += ' | '; html += '';
html += ' '; html += ' | ';
html += ''; html += ' |
');
setTimeout(function () {
if (searchKey == $('#searchProductsInput').val()) {
var params = {
job: 'searchProducts',
searchKey: searchKey,
searchCategory: $("#productSearchCategory :selected").val(),
searchStock: $("#productSearchStock :selected").val(),
searchSort: $("#productSearchSort :selected").val(),
};
$.ajax({
type: "POST",
url: ajax_url,
dataType: "json",
success: function (data) {
if (data != '-1')
if (data.length == 0)
$('#searchResultDiv').html(
'MOD.LBL_SEARCH_NO_RESULT');
else
createSearchResult(data);
},
data: params
});
}
}, 1000);
}
function createSearchResult(data) {
var html = '|   | '; html += 'Kod | '; html += 'Nazwa | '; if ($("#productSearchStock :selected").val() != '1') html += 'Stan | '; html += '  | '; html += '
|---|---|---|---|---|
| '; html += ' | ' + value.code + ' | '; html += '' + value.name + ' | '; if ($("#productSearchStock :selected").val() != '1') html += '' + value.stock_state + ' | '; html += '';
html += ' ';
html += '';
html += ' | ';
html += '
');
var params = {
job: 'getPricesInfo',
product_id: $("#product_id_" + index).val(),
pricebook_id: $("#pricebook_id :selected").val(),
account_id: $("#parent_id").val(),
};
$
.ajax({
type: "POST",
url: ajax_url,
dataType: "json",
async: false,
success: function (data) {
html = '
|
| ';
var show_purchase_prices = false;
if (show_purchase_prices) {
html += '
| ';
}
html += '