Some fixes :)

This commit is contained in:
2025-01-16 10:16:01 +00:00
parent 87010acdcc
commit a4a65d5b4f
9 changed files with 160 additions and 12 deletions

View File

@@ -7,7 +7,7 @@ $(document).ready(function () {
return false;
},
format: function (s, table, cell) {
return $(cell).find("input[id^=production-date]").val() || "1970-01-01";
return $(cell).find("input[id^=production-date]").val() || "2222-01-01";
},
parsed: false,
type: "text"
@@ -62,6 +62,29 @@ $(document).ready(function () {
3: { sorter: "production_date" },
},
});
$("#allTable").bind('filterEnd', function () {
localStorage.setItem("productionSchedule_filter", $.tablesorter.getFilters($("#allTable")));
});
$("#allTable").bind("sortEnd", function () {
try {
localStorage.setItem('productionSchedule_sort',
$("#allTable")[0].config.sortList[0][0] + "|" + $("#allTable")[0].config.sortList[0][1]);
} catch (e) {}
});
setTimeout(() => {
const filters = localStorage.getItem("productionSchedule_filter");
if (filters) {
$.tablesorter.setFilters($('#allTable'), filters.split(','), true);
}
const sort = localStorage.getItem("productionSchedule_sort");
if (sort) {
try {
var tmp = sort.split("|");
$("#allTable")[0].config.sortList = [[parseInt(tmp[0]), parseInt(tmp[1])]];
$.tablesorter.sortOn($("#allTable")[0].config, [[parseInt(tmp[0]), parseInt(tmp[1])]]);
} catch (e) { }
}
}, 500);
$("#duplicateBtn").click(() => duplicatePositions());
$("#deleteBtn").click(() => { removePositions(); });
$("#excelBtn").click(() => { exportExcel(); });
@@ -153,7 +176,7 @@ function saveDescription(id) {
$.ajax({
method: "get",
url: $(location).attr("href") + "&to_pdf=1&ajaxAction=saveProductDescription&id=" + id + "&description=" + $("#descriptionInput-" + id).val(),
success: function (data) {
success: function () {
$("#description-" + id).html($("#descriptionInput-" + id).val());
},
});

View File

@@ -20,7 +20,7 @@ if (!isset($_GET['ajaxAction'])) {
$dateTo = date("Y-m-d", strtotime("+ 1 month"));
}
$query = "SELECT s.id, s.document_no, s.status, s.parent_name, s.parent_id, s.send_date, s.type,
$query = "SELECT s.id as orderId, s.document_no, s.status, s.parent_name, s.parent_id, s.send_date, s.type,
p.code, p.name, ps.ecmproduct_id, ps.description,
si.quantity, p.vendor_part_no as kind, p.brand, p.part_no as size, p.shape,
ss.quantity as stockState, si.id as item_id, s.shipping_address_name, ps.production_date,
@@ -34,9 +34,14 @@ if (!isset($_GET['ajaxAction'])) {
ON ps.ecmproduct_id = p.id
LEFT JOIN ecmstockstates AS ss
ON ss.product_id = ps.ecmproduct_id AND ss.stock_id = 'c7afd71a-4c3a-bde4-138d-4acaee1644e4'
WHERE ps.deleted = 0 AND ps.production_date >= '$dateFrom' AND ps.production_date <= '$dateTo'
WHERE ps.deleted = 0 AND
(
(ps.production_date >= '$dateFrom' AND ps.production_date <= '$dateTo')
OR ps.production_date IS NULL OR ps.production_date = '0000-00-00')
ORDER BY s.delivery_date, s.register_date, s.document_no";
//echo $query;
$rows = $db->query($query);
$data = array();
$i = 0;
@@ -57,7 +62,7 @@ if (!isset($_GET['ajaxAction'])) {
$row['productShape'] = $app_list_strings['ecmproducts_shape_dom'][$r['shape']];
$row['productBrand'] = $app_list_strings['ecmproducts_brand_dom'][$r['brand']];
$row['orderNo'] = $r['document_no'];
$row['orderId'] = $r['id'];
$row['orderId'] = $r['orderId'];
$row['orderStatus'] = $app_list_strings['ecmsales_status_dom'][$r['status']];
$row['orderType'] = $app_list_strings['ecmsales_type_dom'][$r['type']];
$row['orderParent'] = $r['parent_name'];