Compare commits
11 Commits
e2baf61f99
...
be27602ca3
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
be27602ca3 | ||
|
|
eab6fc87b1 | ||
|
|
f3c8adb3c8 | ||
|
|
113e00080a | ||
|
|
6fdc2f11b5 | ||
|
|
7ec831b114 | ||
|
|
bc6348486d | ||
|
|
d9a932acd9 | ||
|
|
f63dd0c7e2 | ||
|
|
4f8812117c | ||
|
|
7e33e40fcc |
@@ -360,7 +360,7 @@ GROUP BY
|
||||
ORDER BY i.register_date DESC;
|
||||
",
|
||||
'filename' => 'invoices_2024.csv',
|
||||
],
|
||||
], // invoices 2024
|
||||
[
|
||||
'sql' => "
|
||||
SELECT
|
||||
@@ -400,7 +400,101 @@ GROUP BY
|
||||
ORDER BY i.register_date DESC;
|
||||
",
|
||||
'filename' => 'invoices_2025.csv',
|
||||
],
|
||||
], // invoices 2025
|
||||
[
|
||||
'sql' => "
|
||||
SELECT
|
||||
i.document_no,
|
||||
i.register_date,
|
||||
oi.document_no AS FV,
|
||||
oi.register_date AS FV_date,
|
||||
i.parent_name,
|
||||
p.code,
|
||||
p.name,
|
||||
CASE p.group_ks
|
||||
WHEN 1 THEN 'Towar handlowy'
|
||||
WHEN 2 THEN 'Wyrób gotowy'
|
||||
WHEN 3 THEN 'Usługi'
|
||||
WHEN '530547ef-2dea-7622-843b-59d745b14c64' THEN 'Materiały'
|
||||
WHEN '8451dded-710f-51c2-7ed1-60a377eaa7b7' THEN 'Surowce'
|
||||
ELSE 'Nieznane'
|
||||
END AS group_ks,
|
||||
GROUP_CONCAT(c.name ORDER BY cb.position SEPARATOR ' | ') AS category,
|
||||
ii.quantity_corrected AS quantity_correced,
|
||||
ii.total_netto_corrected AS total_netto_corrected
|
||||
FROM ecminvoiceouts AS i
|
||||
INNER JOIN ecminvoiceoutitems AS ii ON i.id = ii.ecminvoiceout_id
|
||||
INNER JOIN ecmproducts AS p ON ii.ecmproduct_id = p.id
|
||||
INNER JOIN ecminvoiceouts AS oi ON oi.id = i.ecminvoiceout_id
|
||||
LEFT JOIN ecmproductcategories_bean AS cb ON cb.bean_id COLLATE utf8_general_ci = p.id COLLATE utf8_general_ci
|
||||
AND cb.bean_name = 'EcmProducts'
|
||||
AND cb.deleted = 0
|
||||
LEFT JOIN ecmproductcategories AS c ON c.id = cb.ecmproductcategory_id
|
||||
WHERE i.type = 'correct' AND YEAR(i.register_date) = 2024
|
||||
GROUP BY
|
||||
i.document_no,
|
||||
i.register_date,
|
||||
oi.document_no,
|
||||
oi.register_date,
|
||||
i.parent_name,
|
||||
p.code,
|
||||
p.name,
|
||||
p.group_ks,
|
||||
ii.quantity,
|
||||
ii.price_netto,
|
||||
ii.quantity_corrected,
|
||||
ii.total_netto_corrected
|
||||
ORDER BY i.register_date DESC;
|
||||
",
|
||||
'filename' => 'correct_invoices_2024.csv',
|
||||
], // correct invoices 2024
|
||||
[
|
||||
'sql' => "
|
||||
SELECT
|
||||
i.document_no,
|
||||
i.register_date,
|
||||
oi.document_no AS FV,
|
||||
oi.register_date AS FV_date,
|
||||
i.parent_name,
|
||||
p.code,
|
||||
p.name,
|
||||
CASE p.group_ks
|
||||
WHEN 1 THEN 'Towar handlowy'
|
||||
WHEN 2 THEN 'Wyrób gotowy'
|
||||
WHEN 3 THEN 'Usługi'
|
||||
WHEN '530547ef-2dea-7622-843b-59d745b14c64' THEN 'Materiały'
|
||||
WHEN '8451dded-710f-51c2-7ed1-60a377eaa7b7' THEN 'Surowce'
|
||||
ELSE 'Nieznane'
|
||||
END AS group_ks,
|
||||
GROUP_CONCAT(c.name ORDER BY cb.position SEPARATOR ' | ') AS category,
|
||||
ii.quantity_corrected AS quantity_correced,
|
||||
ii.total_netto_corrected AS total_netto_corrected
|
||||
FROM ecminvoiceouts AS i
|
||||
INNER JOIN ecminvoiceoutitems AS ii ON i.id = ii.ecminvoiceout_id
|
||||
INNER JOIN ecmproducts AS p ON ii.ecmproduct_id = p.id
|
||||
INNER JOIN ecminvoiceouts AS oi ON oi.id = i.ecminvoiceout_id
|
||||
LEFT JOIN ecmproductcategories_bean AS cb ON cb.bean_id COLLATE utf8_general_ci = p.id COLLATE utf8_general_ci
|
||||
AND cb.bean_name = 'EcmProducts'
|
||||
AND cb.deleted = 0
|
||||
LEFT JOIN ecmproductcategories AS c ON c.id = cb.ecmproductcategory_id
|
||||
WHERE i.type = 'correct' AND YEAR(i.register_date) = 2025
|
||||
GROUP BY
|
||||
i.document_no,
|
||||
i.register_date,
|
||||
oi.document_no,
|
||||
oi.register_date,
|
||||
i.parent_name,
|
||||
p.code,
|
||||
p.name,
|
||||
p.group_ks,
|
||||
ii.quantity,
|
||||
ii.price_netto,
|
||||
ii.quantity_corrected,
|
||||
ii.total_netto_corrected
|
||||
ORDER BY i.register_date DESC;
|
||||
",
|
||||
'filename' => 'correct_invoices_2025.csv',
|
||||
], // correct invoices 2025
|
||||
[
|
||||
'sql' => "
|
||||
SELECT
|
||||
@@ -440,7 +534,7 @@ GROUP BY
|
||||
ORDER BY i.register_date DESC;
|
||||
",
|
||||
'filename' => 'ecommerce_invoices_2024.csv',
|
||||
],
|
||||
], // ecommerce invoices 2024
|
||||
[
|
||||
'sql' => "
|
||||
SELECT
|
||||
@@ -480,7 +574,7 @@ GROUP BY
|
||||
ORDER BY i.register_date DESC;
|
||||
",
|
||||
'filename' => 'ecommerce_invoices_2025.csv',
|
||||
],
|
||||
], // ecommerce invoices 2025
|
||||
[
|
||||
'sql' => "
|
||||
SELECT
|
||||
@@ -492,7 +586,83 @@ ORDER BY i.register_date DESC;
|
||||
JOIN ecmstocks AS s ON ss.stock_id = s.id
|
||||
ORDER BY quantity + 0 DESC;",
|
||||
'filename' => 'stocks.csv',
|
||||
],
|
||||
], // stocks
|
||||
[
|
||||
'sql' => "
|
||||
SELECT
|
||||
i.document_no,
|
||||
i.register_date,
|
||||
p.code,
|
||||
p.name,
|
||||
CASE p.group_ks
|
||||
WHEN 1 THEN 'Towar handlowy'
|
||||
WHEN 2 THEN 'Wyrób gotowy'
|
||||
WHEN 3 THEN 'Surowiec'
|
||||
WHEN 4 THEN 'Usługa'
|
||||
ELSE 'Nieznane'
|
||||
END AS group_ks,
|
||||
GROUP_CONCAT(c.name ORDER BY cb.position SEPARATOR ' | ') AS category,
|
||||
s.name AS stock,
|
||||
ii.quantity
|
||||
FROM ecmstockdocinsideouts AS i
|
||||
INNER JOIN ecmstockdocinsideoutitems AS ii ON i.id = ii.ecmstockdocinsideout_id
|
||||
INNER JOIN ecmproducts AS p ON ii.ecmproduct_id = p.id
|
||||
INNER JOIN ecmstocks AS s ON i.stock_id = s.id
|
||||
LEFT JOIN ecmproductcategories_bean AS cb ON cb.bean_id COLLATE utf8_general_ci = p.id COLLATE utf8_general_ci
|
||||
AND cb.bean_name = 'EcmProducts'
|
||||
AND cb.deleted = 0
|
||||
LEFT JOIN ecmproductcategories AS c ON c.id = cb.ecmproductcategory_id
|
||||
WHERE YEAR(i.register_date) = 2025
|
||||
GROUP BY
|
||||
i.document_no,
|
||||
i.register_date,
|
||||
p.code,
|
||||
p.name,
|
||||
p.group_ks,
|
||||
s.name,
|
||||
ii.quantity
|
||||
ORDER BY i.register_date DESC;
|
||||
",
|
||||
'filename' => 'rw_2025.csv',
|
||||
], // rw 2025
|
||||
[
|
||||
'sql' => "
|
||||
SELECT
|
||||
i.document_no,
|
||||
i.register_date,
|
||||
p.code,
|
||||
p.name,
|
||||
CASE p.group_ks
|
||||
WHEN 1 THEN 'Towar handlowy'
|
||||
WHEN 2 THEN 'Wyrób gotowy'
|
||||
WHEN 3 THEN 'Surowiec'
|
||||
WHEN 4 THEN 'Usługa'
|
||||
ELSE 'Nieznane'
|
||||
END AS group_ks,
|
||||
GROUP_CONCAT(c.name ORDER BY cb.position SEPARATOR ' | ') AS category,
|
||||
s.name AS stock,
|
||||
ii.quantity
|
||||
FROM ecmstockdocinsideouts AS i
|
||||
INNER JOIN ecmstockdocinsideoutitems AS ii ON i.id = ii.ecmstockdocinsideout_id
|
||||
INNER JOIN ecmproducts AS p ON ii.ecmproduct_id = p.id
|
||||
INNER JOIN ecmstocks AS s ON i.stock_id = s.id
|
||||
LEFT JOIN ecmproductcategories_bean AS cb ON cb.bean_id COLLATE utf8_general_ci = p.id COLLATE utf8_general_ci
|
||||
AND cb.bean_name = 'EcmProducts'
|
||||
AND cb.deleted = 0
|
||||
LEFT JOIN ecmproductcategories AS c ON c.id = cb.ecmproductcategory_id
|
||||
WHERE YEAR(i.register_date) = 2024
|
||||
GROUP BY
|
||||
i.document_no,
|
||||
i.register_date,
|
||||
p.code,
|
||||
p.name,
|
||||
p.group_ks,
|
||||
s.name,
|
||||
ii.quantity
|
||||
ORDER BY i.register_date DESC;
|
||||
",
|
||||
'filename' => 'rw_2024.csv',
|
||||
], // rw 2024
|
||||
];
|
||||
|
||||
$report = [];
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -131,6 +131,21 @@ function importSale($file)
|
||||
|
||||
$sale->register_date = date("d.m.Y", strtotime($xml->{'Order-Header'}->OrderDate));
|
||||
$sale->delivery_date = date("d.m.Y", strtotime($xml->{'Order-Header'}->ExpectedDeliveryDate));
|
||||
|
||||
$delivery_timestamp = strtotime($xml->{'Order-Header'}->ExpectedDeliveryDate);
|
||||
$delivery_day_of_week = date('N', $delivery_timestamp); // 1 = Monday, 7 = Sunday
|
||||
if ($delivery_day_of_week == 1) { // Monday -> send on Friday
|
||||
$send_timestamp = strtotime('-3 days', $delivery_timestamp);
|
||||
} else { // send one day before
|
||||
$send_timestamp = strtotime('-1 day', $delivery_timestamp);
|
||||
}
|
||||
$sale->send_date = date("d.m.Y", $send_timestamp);
|
||||
|
||||
|
||||
$sale->document_no = $xml->{'Order-Header'}->OrderNumber;
|
||||
$sale->document_date = date("d.m.Y", strtotime($xml->{'Order-Header'}->OrderDate));
|
||||
$sale->document_due_date = date("d.m.Y", strtotime($xml->{'Order-Header'}->ExpectedDeliveryDate));
|
||||
$sale->document_currency = 'PLN';
|
||||
$date = new DateTime(date("d.m.Y", strtotime($xml->{'Order-Header'}->OrderDate)));
|
||||
if ($sale->payment_date_days != "") {
|
||||
$date->modify("+" . $sale->payment_date_days . " day");
|
||||
|
||||
@@ -1,216 +1,217 @@
|
||||
//START:
|
||||
$(document).ready(
|
||||
function() {
|
||||
//set sizes
|
||||
$("#parent_name").attr("size", "70");
|
||||
$("#parent_name_copy").attr("size", "70");
|
||||
$("#parent_shipping_address_name").attr("size", "70");
|
||||
$("#payment_date_days").css("width", "40");
|
||||
//$("#payment_method").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
|
||||
$("#delivery_date").on('inputchange',function() {
|
||||
calculateDate($("#delivery_date").val());
|
||||
});
|
||||
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);
|
||||
// categories
|
||||
function () {
|
||||
//set sizes
|
||||
$("#parent_name").attr("size", "70");
|
||||
$("#parent_name_copy").attr("size", "70");
|
||||
$("#parent_shipping_address_name").attr("size", "70");
|
||||
$("#payment_date_days").css("width", "40");
|
||||
//$("#payment_method").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();
|
||||
|
||||
$('#pdf_type').change(function () {
|
||||
manageOO();
|
||||
var count = $('#' + itemsTable + '_T tr').length - 1; // -1 -
|
||||
// thead row
|
||||
for (var index = 0; index != count; index++){
|
||||
calculateRow(index);
|
||||
$("#delivery_date").on('inputchange', function () {
|
||||
calculateDate($("#delivery_date").val());
|
||||
});
|
||||
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);
|
||||
// categories
|
||||
|
||||
}
|
||||
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);
|
||||
|
||||
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);
|
||||
});
|
||||
// language channge
|
||||
$("#ecmlanguage").change(function() {
|
||||
changeLanguage();
|
||||
});
|
||||
removeFromValidate('EditView', 'shipping_iln');
|
||||
DrawHeaders();
|
||||
// stock selector
|
||||
$("#stock").change(function() {
|
||||
$("#stock_id").val(($("#stock :selected").val()));
|
||||
|
||||
});
|
||||
if($("#type :selected").val()=='sales_order'){
|
||||
removeFromValidate('EditView', 'invoice_date');
|
||||
}
|
||||
$("#type").change(function() {
|
||||
if($("#type :selected").val()=='sales_order'){
|
||||
removeFromValidate('EditView', 'invoice_date');
|
||||
} else {
|
||||
addToValidate('EditView', 'invoice_date', 'id', 'true', '');
|
||||
}
|
||||
|
||||
});
|
||||
if (($("#new_number").val() == true)
|
||||
&& ($("#duplicate").val() != true) && ($("#ecmquote_id").val() =='')) {
|
||||
EcmDocumentNumberGenerator_getNumberTemplate('document_no', 'EcmSales');
|
||||
//sale from subpanel??
|
||||
var ecp = $("#ecommerce_products").val();
|
||||
if (ecp && ecp.length > 0) {
|
||||
loadECommerceProducts(ecp);
|
||||
} else if ($("#parent_id").val()!='') {
|
||||
$(".loading_panel").css("display", "block");
|
||||
setTimeout(function() {
|
||||
getParentInfo($("#parent_id").val(), $(
|
||||
"#parent_type :selected").val());
|
||||
}, 1000);
|
||||
}
|
||||
$(".loading_panel").css("display", "none");
|
||||
} else if (($("#new_number").val() == true)
|
||||
&& ($("#duplicate").val() == true)) {
|
||||
EcmDocumentNumberGenerator_getNumberTemplate('document_no', 'EcmSales');
|
||||
getParentInfo($("#parent_id").val(),
|
||||
$("#parent_type :selected").val());
|
||||
getItems();
|
||||
$(".loading_panel").css("display", "none");
|
||||
} else if (($("#new_number").val() == true)
|
||||
&& ($("#ecmquote_id").val() != '')) {
|
||||
|
||||
EcmDocumentNumberGenerator_getNumberTemplate('document_no', 'EcmSales');
|
||||
getParentInfo($("#parent_id").val(),
|
||||
'Accounts');
|
||||
getItemsFromSale();
|
||||
$(".loading_panel").css("display", "none");
|
||||
} else {
|
||||
getParentInfo($("#parent_id").val(),
|
||||
$("#parent_type :selected").val());
|
||||
getItems();
|
||||
$(".loading_panel").css("display", "none");
|
||||
}
|
||||
// handle setItems
|
||||
setITEMS = function() {
|
||||
var formname = 'EditView';
|
||||
if (check_form_(formname) == true) {
|
||||
SetTab('ITEMS');
|
||||
}
|
||||
};
|
||||
//payment date functions
|
||||
$('#payment_date_days').css('height', '18');
|
||||
$('#payment_date_days').val('0');
|
||||
$('#payment_date_days').change(function() {
|
||||
calculatePaymentDate();
|
||||
});
|
||||
// parent info
|
||||
var previousVal4;
|
||||
var pollInterval4 = setInterval(function() {
|
||||
var val = $('#payment_date').val();
|
||||
if (val !== previousVal4) {
|
||||
setTimeout(function() {
|
||||
calculateDateDiff();
|
||||
}, 1000);
|
||||
}
|
||||
previousVal4 = val;
|
||||
}, 1000);
|
||||
// wyszukiwanie start
|
||||
$('#searchProductsInput').keyup(function(e) {
|
||||
if (e.keyCode == 13) {
|
||||
// stronicowanie od 1 strony przy zmianie szukanego produktu
|
||||
$('#searchStart').val(0);
|
||||
searchProducts();
|
||||
}
|
||||
});
|
||||
AddSearchRecord();
|
||||
$(".loading_panel").css("display", "none");
|
||||
});
|
||||
}
|
||||
calculateTotal();
|
||||
});
|
||||
|
||||
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);
|
||||
});
|
||||
// language channge
|
||||
$("#ecmlanguage").change(function () {
|
||||
changeLanguage();
|
||||
});
|
||||
removeFromValidate('EditView', 'shipping_iln');
|
||||
DrawHeaders();
|
||||
// stock selector
|
||||
$("#stock").change(function () {
|
||||
$("#stock_id").val(($("#stock :selected").val()));
|
||||
|
||||
});
|
||||
if ($("#type :selected").val() == 'sales_order') {
|
||||
removeFromValidate('EditView', 'invoice_date');
|
||||
}
|
||||
$("#type").change(function () {
|
||||
if ($("#type :selected").val() == 'sales_order') {
|
||||
removeFromValidate('EditView', 'invoice_date');
|
||||
} else {
|
||||
addToValidate('EditView', 'invoice_date', 'id', 'true', '');
|
||||
}
|
||||
|
||||
});
|
||||
if (($("#new_number").val() == true)
|
||||
&& ($("#duplicate").val() != true) && ($("#ecmquote_id").val() == '')) {
|
||||
EcmDocumentNumberGenerator_getNumberTemplate('document_no', 'EcmSales');
|
||||
//sale from subpanel??
|
||||
var ecp = $("#ecommerce_products").val();
|
||||
if (ecp && ecp.length > 0) {
|
||||
loadECommerceProducts(ecp);
|
||||
} else if ($("#parent_id").val() != '') {
|
||||
$(".loading_panel").css("display", "block");
|
||||
setTimeout(function () {
|
||||
getParentInfo($("#parent_id").val(), $(
|
||||
"#parent_type :selected").val());
|
||||
}, 1000);
|
||||
}
|
||||
$(".loading_panel").css("display", "none");
|
||||
} else if (($("#new_number").val() == true)
|
||||
&& ($("#duplicate").val() == true)) {
|
||||
EcmDocumentNumberGenerator_getNumberTemplate('document_no', 'EcmSales');
|
||||
getParentInfo($("#parent_id").val(),
|
||||
$("#parent_type :selected").val());
|
||||
getItems();
|
||||
$(".loading_panel").css("display", "none");
|
||||
} else if (($("#new_number").val() == true)
|
||||
&& ($("#ecmquote_id").val() != '')) {
|
||||
|
||||
EcmDocumentNumberGenerator_getNumberTemplate('document_no', 'EcmSales');
|
||||
getParentInfo($("#parent_id").val(),
|
||||
'Accounts');
|
||||
getItemsFromSale();
|
||||
$(".loading_panel").css("display", "none");
|
||||
} else {
|
||||
getParentInfo($("#parent_id").val(),
|
||||
$("#parent_type :selected").val());
|
||||
getItems();
|
||||
$(".loading_panel").css("display", "none");
|
||||
}
|
||||
// handle setItems
|
||||
setITEMS = function () {
|
||||
var formname = 'EditView';
|
||||
if (check_form_(formname) == true) {
|
||||
SetTab('ITEMS');
|
||||
}
|
||||
};
|
||||
//payment date functions
|
||||
$('#payment_date_days').css('height', '18');
|
||||
$('#payment_date_days').val('0');
|
||||
$('#payment_date_days').change(function () {
|
||||
calculatePaymentDate();
|
||||
});
|
||||
// parent info
|
||||
var previousVal4;
|
||||
var pollInterval4 = setInterval(function () {
|
||||
var val = $('#payment_date').val();
|
||||
if (val !== previousVal4) {
|
||||
setTimeout(function () {
|
||||
calculateDateDiff();
|
||||
}, 1000);
|
||||
}
|
||||
previousVal4 = val;
|
||||
}, 1000);
|
||||
// wyszukiwanie start
|
||||
$('#searchProductsInput').keyup(function (e) {
|
||||
if (e.keyCode == 13) {
|
||||
// stronicowanie od 1 strony przy zmianie szukanego produktu
|
||||
$('#searchStart').val(0);
|
||||
searchProducts();
|
||||
}
|
||||
});
|
||||
AddSearchRecord();
|
||||
calculateDate($("#delivery_date").val());
|
||||
$(".loading_panel").css("display", "none");
|
||||
});
|
||||
// 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;
|
||||
}
|
||||
window.onbeforeunload = null;
|
||||
if (items.length == 0 || items[0].product_id=='') {
|
||||
alert("Brak produktów");
|
||||
return false;
|
||||
}
|
||||
// usuwa rekord pomocniczy
|
||||
clearEmpty();
|
||||
$(".loading_panel").css("display", "block");
|
||||
// calculate totals
|
||||
var count = $('#' + itemsTable + '_T tr').length - 1; // -1 - thead row
|
||||
for (var index = 0; index != count; index++) {
|
||||
calculateRow(index);
|
||||
if (validation.recipient_code == true)
|
||||
console.log('Sprawdzić kody trzeba');
|
||||
}
|
||||
$("#total_netto").val($("#t_netto").val());
|
||||
$("#total_brutto").val($("#t_brutto").val());
|
||||
$("#discount").val($("#disc").val());
|
||||
$("#position_list").val(JSON.stringifyNoSecurity(items));
|
||||
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;
|
||||
}
|
||||
window.onbeforeunload = null;
|
||||
if (items.length == 0 || items[0].product_id == '') {
|
||||
alert("Brak produktów");
|
||||
return false;
|
||||
}
|
||||
// usuwa rekord pomocniczy
|
||||
clearEmpty();
|
||||
$(".loading_panel").css("display", "block");
|
||||
// calculate totals
|
||||
var count = $('#' + itemsTable + '_T tr').length - 1; // -1 - thead row
|
||||
for (var index = 0; index != count; index++) {
|
||||
calculateRow(index);
|
||||
if (validation.recipient_code == true)
|
||||
console.log('Sprawdzić kody trzeba');
|
||||
}
|
||||
$("#total_netto").val($("#t_netto").val());
|
||||
$("#total_brutto").val($("#t_brutto").val());
|
||||
$("#discount").val($("#disc").val());
|
||||
$("#position_list").val(JSON.stringifyNoSecurity(items));
|
||||
|
||||
|
||||
|
||||
if (check_form_(formname) === true) {
|
||||
return true;
|
||||
} else {
|
||||
window.onbeforeunload = confirmExit;
|
||||
$(".loading_panel").css("display", "none");
|
||||
return false;
|
||||
}
|
||||
if (check_form_(formname) === true) {
|
||||
return true;
|
||||
} else {
|
||||
window.onbeforeunload = confirmExit;
|
||||
$(".loading_panel").css("display", "none");
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
function confirmExit() {
|
||||
return "";
|
||||
return "";
|
||||
}
|
||||
|
||||
function lockEnter() {
|
||||
// prevent default
|
||||
// prevent default
|
||||
|
||||
$(window).keydown(function(event) {
|
||||
$(window).keydown(function (event) {
|
||||
|
||||
if (event.keyCode == 13 && $(":focus").prop('tagName')!='input') {
|
||||
if (event.keyCode == 13 && $(":focus").prop('tagName') != 'input') {
|
||||
|
||||
event.preventDefault();
|
||||
return false;
|
||||
}
|
||||
});
|
||||
event.preventDefault();
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function loadECommerceProducts(ecp) {
|
||||
|
||||
@@ -24,6 +24,13 @@ function calculateDate($date){
|
||||
$date = new Datetime($date);
|
||||
$date->modify('-1 day');
|
||||
$tmp['date']=$date->format("d.m.Y");
|
||||
$tmp['date_day']=date('N', strtotime($tmp['date']));
|
||||
if($tmp['date_day']==7){
|
||||
$date->modify('-2 day');
|
||||
} else if($tmp['date_day']==6){
|
||||
$date->modify('-1 day');
|
||||
}
|
||||
$tmp['date']=$date->format("d.m.Y");
|
||||
echo json_encode($tmp);
|
||||
return '';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user