Commit old changes
This commit is contained in:
@@ -49,10 +49,10 @@
|
||||
$newPositionList = array();
|
||||
$total_netto = 0; $total_brutto = 0; $total_discount = 0; $vats = array();
|
||||
foreach ( $sale->position_list as $product ) {
|
||||
echo 'Produkt: '.$product->product_code.'';
|
||||
$p = getProduct($product->product_code);
|
||||
echo 'Produkt: '.$product->product_code;
|
||||
$p = getProduct(trim($product->product_code));
|
||||
if (!$p) {
|
||||
echo ' Produkt nie istnieje w bazie E5<br>';
|
||||
echo ' (produkt nie istnieje w bazie E5)<br>';
|
||||
$gotAllProducts = false;
|
||||
continue;
|
||||
} else {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
// created: 2024-09-12 06:58:07
|
||||
// created: 2024-11-14 14:11:52
|
||||
$customDoms = array (
|
||||
'ecmproducts_attribute_dom' =>
|
||||
array (
|
||||
@@ -71,6 +71,7 @@ $customDoms = array (
|
||||
'349b50d1-0a7b-b3bd-e72e-662b42ca98ae' => 'Foam 400ml',
|
||||
'cb66a685-53e1-5f87-0a25-66967c7cb63b' => 'Doypack 210x285mm',
|
||||
'75f4bd2a-51a8-0767-635e-66dde15af79e' => 'Foam 200ml',
|
||||
'225115e4-1ce2-9a98-b7a0-672930e3318c' => 'Blister tabletki 10szt. 2 g',
|
||||
),
|
||||
'ecmproducts_brand_dom' =>
|
||||
array (
|
||||
@@ -149,6 +150,8 @@ $customDoms = array (
|
||||
'd5f819ff-297b-c0d8-cfcd-66d0d0103806' => 'EcoExpert',
|
||||
'4144e574-4870-fa26-25a0-66d85b094f7b' => 'Office Discount',
|
||||
'e00b0e4a-ba66-796d-3bcb-66d89240c2cd' => 'Printus',
|
||||
'661bc56d-f77f-6d98-98be-672a06cf59ee' => 'AVCedukacja',
|
||||
'8d09cc5f-2348-6d22-80dc-6736057e390d' => 'Seltino',
|
||||
),
|
||||
'ecmproducts_category_dom' =>
|
||||
array (
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
// created: 2024-09-12 06:58:07
|
||||
// created: 2024-11-14 14:11:52
|
||||
$customDoms = array (
|
||||
'ecmproducts_attribute_dom' =>
|
||||
array (
|
||||
@@ -71,6 +71,7 @@ $customDoms = array (
|
||||
'349b50d1-0a7b-b3bd-e72e-662b42ca98ae' => 'Pianka 400ml',
|
||||
'cb66a685-53e1-5f87-0a25-66967c7cb63b' => 'Doypack 210x285mm',
|
||||
'75f4bd2a-51a8-0767-635e-66dde15af79e' => 'Pianka 200ml',
|
||||
'225115e4-1ce2-9a98-b7a0-672930e3318c' => 'Blister tabletki 10szt. 2 g',
|
||||
),
|
||||
'ecmproducts_brand_dom' =>
|
||||
array (
|
||||
@@ -149,6 +150,8 @@ $customDoms = array (
|
||||
'd5f819ff-297b-c0d8-cfcd-66d0d0103806' => 'EcoExpert',
|
||||
'4144e574-4870-fa26-25a0-66d85b094f7b' => 'Office Discount',
|
||||
'e00b0e4a-ba66-796d-3bcb-66d89240c2cd' => 'Printus',
|
||||
'661bc56d-f77f-6d98-98be-672a06cf59ee' => 'AVCedukacja',
|
||||
'8d09cc5f-2348-6d22-80dc-6736057e390d' => 'Seltino',
|
||||
),
|
||||
'ecmproducts_category_dom' =>
|
||||
array (
|
||||
|
||||
@@ -58,6 +58,10 @@ $viewdefs [$module_name] = array (
|
||||
0 => array (
|
||||
'name' => 'category',
|
||||
'label' => 'LBL_CATEGORY'
|
||||
),
|
||||
1 => array (
|
||||
'name' => 'shape',
|
||||
'label' => 'Forma'
|
||||
)
|
||||
),
|
||||
2 => array (
|
||||
@@ -65,6 +69,10 @@ $viewdefs [$module_name] = array (
|
||||
'name' => 'time',
|
||||
'customCode' => '<span id="mojtime">{$fields.time.value}</span>',
|
||||
'label' => 'LBL_TIME'
|
||||
),
|
||||
1 => array (
|
||||
'name' => 'performance',
|
||||
'label' => 'Wydajność'
|
||||
)
|
||||
),
|
||||
3 => array (
|
||||
|
||||
@@ -61,6 +61,11 @@ $viewdefs [$module_name] = array (
|
||||
'name' => 'category',
|
||||
'label' => 'LBL_CATEGORY',
|
||||
'tabIndex' => '101',
|
||||
),
|
||||
1 => array(
|
||||
'name' => 'shape',
|
||||
'label' => 'Forma',
|
||||
'tabIndex' => '101',
|
||||
)
|
||||
),
|
||||
2 => array(
|
||||
@@ -69,6 +74,11 @@ $viewdefs [$module_name] = array (
|
||||
'customCode' => "{include file='modules/EcmActions/tpl/EditViewTime.tpl'}",
|
||||
'label' => 'LBL_TIME',
|
||||
'tabIndex' => '105',
|
||||
),
|
||||
1 => array (
|
||||
'name' => 'performance',
|
||||
'label' => 'Wydajność',
|
||||
'tabIndex' => '101',
|
||||
)
|
||||
),
|
||||
3 => array(
|
||||
@@ -91,5 +101,5 @@ $viewdefs [$module_name] = array (
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
)
|
||||
?>
|
||||
|
||||
@@ -129,7 +129,20 @@ $dictionary ['EcmAction'] = array (
|
||||
'size' => '20',
|
||||
'enable_range_search' => false,
|
||||
'precision' => '2'
|
||||
)
|
||||
),
|
||||
'shape' => array(
|
||||
'name' => 'shape',
|
||||
'options' => 'ecmproducts_shape_dom',
|
||||
'vname' => 'Forma',
|
||||
'len' => 36,
|
||||
'type' => 'enum'
|
||||
),
|
||||
'performance' => array(
|
||||
'name' => 'performance',
|
||||
'vname' => 'Wydajność',
|
||||
'type' => 'decimal',
|
||||
'len' => '15,2',
|
||||
),
|
||||
),
|
||||
'relationships' => array (),
|
||||
'optimistic_locking' => true,
|
||||
|
||||
@@ -114,12 +114,12 @@ function isAddressValid(id) {
|
||||
return false;
|
||||
}
|
||||
const segments = $(id).val().split(".");
|
||||
if (parseInt(segments[0]) > 17) {
|
||||
$(id + "Error").html("Błąd pierwszego segmentu [zakres 01-20]");
|
||||
if (parseInt(segments[0]) > 99) {
|
||||
$(id + "Error").html("Błąd pierwszego segmentu [zakres 01-99]");
|
||||
return false;
|
||||
}
|
||||
if (parseInt(segments[1]) > 15) {
|
||||
$(id + "Error").html("Błąd drugiego segmentu [zakres 01-15]");
|
||||
if (parseInt(segments[1]) > 99) {
|
||||
$(id + "Error").html("Błąd drugiego segmentu [zakres 01-99]");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -138,24 +138,24 @@ $(document).ready(function () {
|
||||
$("#address").mask("AB.CD.E.F", {
|
||||
placeholder: "__.__._._",
|
||||
translation: {
|
||||
A: { pattern: /[0-2]/ },
|
||||
A: { pattern: /[0-9]/ },
|
||||
B: { pattern: /[0-9]/ },
|
||||
C: { pattern: /[0-1]/ },
|
||||
C: { pattern: /[0-9]/ },
|
||||
D: { pattern: /[0-9]/ },
|
||||
E: { pattern: /[1-5]/ },
|
||||
F: { pattern: /[0-5]/ },
|
||||
E: { pattern: /[1-9]/ },
|
||||
F: { pattern: /[0-9]/ },
|
||||
}
|
||||
});
|
||||
if ($("#newAddress")) {
|
||||
$("#newAddress").mask("AB.CD.E.F", {
|
||||
placeholder: "__.__._._",
|
||||
translation: {
|
||||
A: { pattern: /[0-2]/ },
|
||||
A: { pattern: /[0-9]/ },
|
||||
B: { pattern: /[0-9]/ },
|
||||
C: { pattern: /[0-1]/ },
|
||||
C: { pattern: /[0-9]/ },
|
||||
D: { pattern: /[0-9]/ },
|
||||
E: { pattern: /[1-5]/ },
|
||||
F: { pattern: /[0-5]/ },
|
||||
E: { pattern: /[1-9]/ },
|
||||
F: { pattern: /[0-9]/ },
|
||||
}
|
||||
});
|
||||
$("#newAddress").focus(() => $("#newAddressError").html(""));
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
$pRes = $db->query("SELECT DISTINCT id, code FROM ecmproducts WHERE deleted=0 AND active=1");
|
||||
$pRes = $db->query("SELECT DISTINCT id, code FROM ecmproducts WHERE deleted=0 AND status != 'end_of_life';");
|
||||
$codes = array();
|
||||
while ($p = $db -> fetchByAssoc($pRes)) {
|
||||
$index = str_replace("'", "'", $p['code']);
|
||||
|
||||
1200
modules/EcmReports/BimIT-Reports/lib/xlsxGenerator.php
Normal file
1200
modules/EcmReports/BimIT-Reports/lib/xlsxGenerator.php
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,190 @@
|
||||
/*jshint esversion: 6 */
|
||||
|
||||
$(document).ready(function () {
|
||||
$.tablesorter.addParser({
|
||||
id: "production_date",
|
||||
is: function () {
|
||||
return false;
|
||||
},
|
||||
format: function (s, table, cell) {
|
||||
return $(cell).find("input[id^=production-date]").val() || "1970-01-01";
|
||||
},
|
||||
parsed: false,
|
||||
type: "text"
|
||||
});
|
||||
$("#allTable").tablesorter({
|
||||
sortList: [[3, 1]],
|
||||
theme: "blue",
|
||||
widthFixed: true,
|
||||
widgets: ["filter", "zebra", "stickyHeaders"],
|
||||
fixedWidth: true,
|
||||
widgetOptions: {
|
||||
resizable: false,
|
||||
filter_formatter: {
|
||||
7: function (cell, index) {
|
||||
return $.tablesorter.filterFormatter.select2(cell, index, {
|
||||
match: true
|
||||
});
|
||||
},
|
||||
8: function (cell, index) {
|
||||
return $.tablesorter.filterFormatter.select2(cell, index, {
|
||||
match: true
|
||||
});
|
||||
},
|
||||
9: function (cell, index) {
|
||||
return $.tablesorter.filterFormatter.select2(cell, index, {
|
||||
match: true
|
||||
});
|
||||
},
|
||||
10: function (cell, index) {
|
||||
return $.tablesorter.filterFormatter.select2(cell, index, {
|
||||
match: true
|
||||
});
|
||||
},
|
||||
12: function (cell, index) {
|
||||
return $.tablesorter.filterFormatter.select2(cell, index, {
|
||||
match: true
|
||||
});
|
||||
},
|
||||
13: function (cell, index) {
|
||||
return $.tablesorter.filterFormatter.select2(cell, index, {
|
||||
match: true
|
||||
});
|
||||
},
|
||||
},
|
||||
filter_functions: {
|
||||
3: function (e, f, i) {
|
||||
return f.includes(i);
|
||||
}
|
||||
}
|
||||
},
|
||||
headers: {
|
||||
3: { sorter: "production_date" },
|
||||
},
|
||||
});
|
||||
$("#duplicateBtn").click(() => duplicatePositions());
|
||||
$("#deleteBtn").click(() => { removePositions(); });
|
||||
$("#excelBtn").click(() => { exportExcel(); });
|
||||
$("#pdfBtn").click(() => { window.alert("In progress."); });
|
||||
$("#productionBtn").click(() => { window.alert("In progress."); });
|
||||
});
|
||||
|
||||
function editQty(id) {
|
||||
$("#edit-" + id).css("display", "none");
|
||||
$("#qty-" + id).css("display", "none");
|
||||
$("#qtyInput-" + id).css("display", "inline");
|
||||
$("#qtyInput-" + id).select();
|
||||
$("#save-" + id).css("display", "inline-block");
|
||||
}
|
||||
function saveQty(id) {
|
||||
showLoader("Trwa aktualizacja...");
|
||||
$("#edit-" + id).css("display", "inline-block");
|
||||
$("#qty-" + id).css("display", "inline");
|
||||
$("#qtyInput-" + id).css("display", "none");
|
||||
$("#save-" + id).css("display", "none");
|
||||
$.ajax({
|
||||
method: "get",
|
||||
url: $(location).attr("href") + "&to_pdf=1&ajaxAction=saveQty&id=" + id + "&qty=" + $("#qtyInput-" + id).val(),
|
||||
success: function () {
|
||||
$("#qty-" + id).html($("#qtyInput-" + id).val());
|
||||
hideLoader();
|
||||
},
|
||||
});
|
||||
}
|
||||
function duplicatePositions() {
|
||||
var ids = [];
|
||||
$("input.allCheck:checkbox:checked").each(function () {
|
||||
ids.push($(this).val());
|
||||
});
|
||||
if (ids.length === 0) {
|
||||
window.alert("Wybierz pozycje zamówień");
|
||||
return;
|
||||
}
|
||||
var userResponse = window.confirm("Zduplikować pozycje?");
|
||||
if (!userResponse) { return; }
|
||||
showLoader("Duplikowanie...");
|
||||
$.ajax({
|
||||
method: "get",
|
||||
url: $(location).attr("href") + "&to_pdf=1&ajaxAction=duplicatePositions&ids=" + ids.join("|"),
|
||||
success: function () {
|
||||
window.location.reload();
|
||||
},
|
||||
});
|
||||
}
|
||||
function removePositions() {
|
||||
var ids = [];
|
||||
$("input.allCheck:checkbox:checked").each(function () {
|
||||
ids.push($(this).val());
|
||||
});
|
||||
if (ids.length === 0) {
|
||||
window.alert("Wybierz pozycje zamówień");
|
||||
return;
|
||||
}
|
||||
var userResponse = window.confirm("Usunąć pozycje?");
|
||||
if (!userResponse) { return; }
|
||||
showLoader("Usuwanie...");
|
||||
$.ajax({
|
||||
method: "get",
|
||||
url: $(location).attr("href") + "&to_pdf=1&ajaxAction=removePositions&ids=" + ids.join("|"),
|
||||
success: function ()
|
||||
{
|
||||
window.location.reload();
|
||||
},
|
||||
});
|
||||
}
|
||||
function saveProductionDate(id) {
|
||||
$.ajax({
|
||||
method: "get",
|
||||
url: $(location).attr("href") + "&to_pdf=1&ajaxAction=saveProductionDate&id=" + id + "&date=" + $("#production-date-" + id).val(),
|
||||
});
|
||||
}
|
||||
function editDescription(id) {
|
||||
$("#edit-description-" + id).css("display", "none");
|
||||
$("#description-" + id).css("display", "none");
|
||||
$("#descriptionInput-" + id).css("display", "inline");
|
||||
$("#descriptionInput-" + id).select();
|
||||
$("#save-description-" + id).css("display", "inline-block");
|
||||
}
|
||||
function saveDescription(id) {
|
||||
$("#edit-description-" + id).css("display", "inline-block");
|
||||
$("#description-" + id).css("display", "inline");
|
||||
$("#descriptionInput-" + id).css("display", "none");
|
||||
$("#save-description-" + id).css("display", "none");
|
||||
$.ajax({
|
||||
method: "get",
|
||||
url: $(location).attr("href") + "&to_pdf=1&ajaxAction=saveProductDescription&id=" + id + "&description=" + $("#descriptionInput-" + id).val(),
|
||||
success: function (data) {
|
||||
$("#description-" + id).html($("#descriptionInput-" + id).val());
|
||||
},
|
||||
});
|
||||
}
|
||||
function showLoader(msg = "Pobieranie danych") {
|
||||
$.blockUI({
|
||||
css: {
|
||||
border: "none",
|
||||
padding: "15px",
|
||||
backgroundColor: "#000",
|
||||
"-webkit-border-radius": "10px",
|
||||
"-moz-border-radius": "10px",
|
||||
opacity: 0.5,
|
||||
"font-weight": "bold",
|
||||
"font-size": "16px",
|
||||
color: "#fff",
|
||||
},
|
||||
message: msg
|
||||
});
|
||||
}
|
||||
function hideLoader() {
|
||||
$.unblockUI();
|
||||
}
|
||||
function exportExcel() {
|
||||
showLoader("Generowanie pliku...");
|
||||
$.ajax({
|
||||
method: "get",
|
||||
url: $(location).attr("href") + "&to_pdf=1&ajaxAction=exportExcel",
|
||||
success: function (data)
|
||||
{
|
||||
window.console.log(data);
|
||||
},
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,172 @@
|
||||
<?php
|
||||
ini_set('display_errors', 1);
|
||||
ini_set('display_startup_errors', 1);
|
||||
error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED);
|
||||
|
||||
$db = $GLOBALS['db'];
|
||||
global $app_list_strings;
|
||||
|
||||
if (!isset($_GET['ajaxAction'])) {
|
||||
|
||||
if (isset($_GET['date_from'])) {
|
||||
$dateFrom = date("Y-m-d", strtotime($_GET['date_from']));
|
||||
} else {
|
||||
$dateFrom = date("Y-m-d");
|
||||
}
|
||||
|
||||
if (isset($_GET['date_to'])) {
|
||||
$dateTo = date("Y-m-d", strtotime($_GET['date_to']));
|
||||
} else {
|
||||
$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,
|
||||
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,
|
||||
ps.quantity as scheduledQuantity, ps.id as id
|
||||
FROM productionScheduler AS ps
|
||||
LEFT JOIN ecmsaleitems AS si
|
||||
ON ps.ecmsaleitem_id = si.id
|
||||
LEFT JOIN ecmsales AS s
|
||||
ON ps.ecmsale_id = s.id
|
||||
INNER JOIN ecmproducts AS p
|
||||
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'
|
||||
ORDER BY s.delivery_date, s.register_date, s.document_no";
|
||||
|
||||
$rows = $db->query($query);
|
||||
$data = array();
|
||||
$i = 0;
|
||||
while ($r = $db->fetchByAssoc($rows)) {
|
||||
$row = array();
|
||||
$i++;
|
||||
$row['position'] = $i;
|
||||
$row['id'] = $r['id'];
|
||||
$row['productName'] = strlen($r['name']) > 55 ? substr($r['name'], 0, 55) . "..." : $r['name'];
|
||||
$row['productFullName'] = $r['name'];
|
||||
$row['productCode'] = strlen($r['code']) > 20 ? substr($r['code'], 0, 20) . "..." : $r['code'];
|
||||
$row['productFullCode'] = $r['code'];
|
||||
$row['productId'] = $r['ecmproduct_id'];
|
||||
$row['productQty'] = $r['quantity'];
|
||||
$row['qty'] = $r['scheduledQuantity'];
|
||||
$row['productKind'] = $r['kind'];
|
||||
$row['productSize'] = $r['size'];
|
||||
$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['orderStatus'] = $app_list_strings['ecmsales_status_dom'][$r['status']];
|
||||
$row['orderType'] = $app_list_strings['ecmsales_type_dom'][$r['type']];
|
||||
$row['orderParent'] = $r['parent_name'];
|
||||
$row['orderParentId'] = $r['parent_id'];
|
||||
$row['orderSendDate'] = $r['send_date'];
|
||||
$row['orderItemId'] = $r['item_id'];
|
||||
$row['description'] = strlen($r['description']) > 0 ? substr($r['description'], 0, 30) : '';
|
||||
$row['fullDescription'] = $r['description'];
|
||||
$row['shippingTo'] = ($r['shipping_address_name'] == 'Adres korespondencyjny' ? '' : $r['shipping_address_name']);
|
||||
$row['productionDate'] = $r['production_date'] == '0000-00-00' ? '' : $r['production_date'];
|
||||
$row['productStockState'] = $r['stockState'] | 0;
|
||||
|
||||
$data[] = $row;
|
||||
}
|
||||
|
||||
$smarty = new Sugar_Smarty();
|
||||
$smarty->assign("data", $data);
|
||||
$smarty->assign("dateFrom", $GLOBALS['timedate']->to_display_date($dateFrom));
|
||||
$smarty->assign("dateTo", $GLOBALS['timedate']->to_display_date($dateTo));
|
||||
echo $smarty->display('modules/EcmReports/BimIT-Reports/productionSchedule/productionSchedule.tpl');
|
||||
} else {
|
||||
switch ($_GET['ajaxAction']) {
|
||||
case 'saveQty':
|
||||
saveQty($_GET['id'], $_GET['qty']);
|
||||
break;
|
||||
case 'duplicatePositions':
|
||||
duplicatePositions($_GET['ids']);
|
||||
break;
|
||||
case 'removePositions':
|
||||
removePositions($_GET['ids']);
|
||||
break;
|
||||
case 'saveProductionDate':
|
||||
saveProductionDate($_GET['id'], $_GET['date']);
|
||||
break;
|
||||
case 'saveProductDescription':
|
||||
saveProductDescription($_GET['id'], $_GET['description']);
|
||||
break;
|
||||
case 'exportExcel':
|
||||
exportExcel();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
function saveQty($id, $qty)
|
||||
{
|
||||
$db = $GLOBALS['db'];
|
||||
$query = sprintf("UPDATE productionScheduler SET quantity='%d' WHERE id='%s'", $qty, $id);
|
||||
$db->query($query);
|
||||
}
|
||||
|
||||
function duplicatePositions($ids)
|
||||
{
|
||||
$db = $GLOBALS['db'];
|
||||
global $current_user;
|
||||
$ids = explode("|", $ids);
|
||||
foreach ($ids as $id) {
|
||||
$res = $db->fetchByAssoc($db->query("SELECT * FROM productionScheduler WHERE id ='$id'"));
|
||||
$query = sprintf("INSERT INTO productionScheduler VALUES ('%s', '%s', '%s', '%d', NOW(), NOW(), '%s', '%s', 0, '%s', '%d', '%s', '%s');",
|
||||
generateUuidV4(), $res['ecmsaleitem_id'], $res['ecmsale_id'], $res['quantity'], $current_user->id, $current_user->id, $res['ecmproduct_id'],
|
||||
$res['is_component'], $res['production_date'], $res['description']);
|
||||
$db->query($query);
|
||||
}
|
||||
}
|
||||
|
||||
function removePositions($ids)
|
||||
{
|
||||
$db = $GLOBALS['db'];
|
||||
global $current_user;
|
||||
$ids = explode("|", $ids);
|
||||
$query = sprintf("UPDATE productionScheduler SET deleted=1, modified_user_id='%s', date_modified=NOW() WHERE id IN ('%s')",
|
||||
$current_user->id, join("','", $ids));
|
||||
$db->query($query);
|
||||
}
|
||||
function saveProductionDate($id, $date)
|
||||
{
|
||||
$db = $GLOBALS['db'];
|
||||
$date = date("Y-m-d", strtotime($date));
|
||||
if ($date == '1970-01-01') {
|
||||
$db->query("UPDATE productionScheduler SET production_date=NULL WHERE id='$id'");
|
||||
} else {
|
||||
$db->query("UPDATE productionScheduler SET production_date='$date' WHERE id='$id'");
|
||||
}
|
||||
}
|
||||
function saveProductDescription($id, $description)
|
||||
{
|
||||
$db = $GLOBALS['db'];
|
||||
$description = mysql_escape_string($description);
|
||||
$db->query("UPDATE productionScheduler SET description='$description' WHERE id='$id'");
|
||||
echo "UPDATE productionScheduler SET description='$description' WHERE id='$id'";
|
||||
}
|
||||
function exportExcel() {
|
||||
echo 'bhhh';
|
||||
require_once 'modules/EcmReports/BimIT-Reports/lib/xlsxGenerator.php';
|
||||
echo 'qqqqqq';
|
||||
$books = [
|
||||
['ISBN', 'title', 'author', 'publisher', 'ctry' ],
|
||||
[618260307, 'The Hobbit', 'J. R. R. Tolkien', 'Houghton Mifflin', 'USA'],
|
||||
[908606664, 'Slinky Malinki', 'Lynley Dodd', 'Mallinson Rendel', 'NZ']
|
||||
];
|
||||
echo 'a';
|
||||
$xlsx = Shuchkin\SimpleXLSXGen::fromArray( $books );
|
||||
echo json_encode($xlsx);
|
||||
$xlsx->saveAs('books.xlsx');
|
||||
echo 'done';
|
||||
}
|
||||
function generateUuidV4()
|
||||
{
|
||||
$data = openssl_random_pseudo_bytes(16);
|
||||
$data[6] = chr(ord($data[6]) & 0x0f | 0x40);
|
||||
$data[8] = chr(ord($data[8]) & 0x3f | 0x80);
|
||||
return vsprintf('%s%s-%s-%s-%s-%s%s%s', str_split(bin2hex($data), 4));
|
||||
}
|
||||
@@ -0,0 +1,202 @@
|
||||
<script type="text/javascript" src="modules/EcmReports/javascript/jquery.js"></script>
|
||||
<link rel="stylesheet" href="modules/EcmReports/BimIT-Reports/lib/tablesorter-2.31.3/dist/css/theme.blue.min.css">
|
||||
<script type="text/javascript"
|
||||
src="modules/EcmReports/BimIT-Reports/lib/tablesorter-2.31.3/dist/js/jquery.tablesorter.js"></script>
|
||||
<script type="text/javascript"
|
||||
src="modules/EcmReports/BimIT-Reports/lib/tablesorter-2.31.3/dist/js/jquery.tablesorter.widgets.js">
|
||||
</script>
|
||||
<link href="https://cdnjs.cloudflare.com/ajax/libs/select2/3.4.6/select2.min.css" rel="stylesheet">
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/select2/3.4.6/select2.min.js"></script>
|
||||
<script type="text/javascript"
|
||||
src="modules/EcmReports/BimIT-Reports/lib/tablesorter-2.31.3/dist/js/widgets/widget-filter-formatter-select2.min.js">
|
||||
</script>
|
||||
<script type="text/javascript" src="modules/EcmReports/javascript/jquery.blockUI.js"></script>
|
||||
<script type="text/javascript" src="modules/EcmReports/BimIT-Reports/productionSchedule/productionSchedule.js"></script>
|
||||
|
||||
<!-- HEADER -->
|
||||
<table id="tableMenu" cellspacing="0" cellpadding="0">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<img src="themes/Sugar5/images/CaseReports.gif" style="margin-top: 3px; margin-right: 3px;" width="16"
|
||||
height="16">
|
||||
</td>
|
||||
<td>
|
||||
<h2>Harmonogram Produkcji</h2>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<br>
|
||||
|
||||
<!-- SEARCH -->
|
||||
<form action="index.php" method="get" name="searchProductBySales">
|
||||
<input type="hidden" name="module" value="EcmReports"/>
|
||||
<input type="hidden" name="action" value="index"/>
|
||||
<input type="hidden" name="reportName" value="productionSchedule"/>
|
||||
<table style="border-top: 0px none; margin-bottom: 4px;width:100%" class="tabForm" border="0" cellpadding="0"
|
||||
cellspacing="0">
|
||||
<tr>
|
||||
<td class="dataLabel" width="5%" nowrap="nowrap">
|
||||
Data produkcji: od
|
||||
|
||||
<input id="date_from" name="date_from" type="text" maxlength="10" size="11" tabindex="" title=""
|
||||
value="{$dateFrom}" autocomplete="off">
|
||||
<img id="date_from_trigger" src="themes/default/images/jscalendar.gif">
|
||||
<script language="JavaScript" type="text/javascript">
|
||||
Calendar.setup({ldelim}
|
||||
inputField: "date_from",
|
||||
daFormat: "%d.%m.%Y",
|
||||
button: "date_from_trigger",
|
||||
singleClick: true,
|
||||
dateStr: "",
|
||||
step: 1
|
||||
{rdelim}
|
||||
);
|
||||
</script>
|
||||
|
||||
do
|
||||
|
||||
<input autocomplete="off" name="date_to" id="date_to" value="{$dateTo}" title="" tabindex="" size="11"
|
||||
maxlength="10" type="text">
|
||||
<img src="themes/default/images/jscalendar.gif" alt="Enter Date" id="date_to_trigger">
|
||||
<script language="JavaScript" type="text/javascript">
|
||||
Calendar.setup({ldelim}
|
||||
inputField: "date_to",
|
||||
daFormat: "%d.%m.%Y",
|
||||
button: "date_to_trigger",
|
||||
singleClick: true,
|
||||
dateStr: "",
|
||||
step: 1
|
||||
{rdelim}
|
||||
);
|
||||
</script>
|
||||
<input class="button" id="submitForm" name="submit" value="Filtruj" type="submit">
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
|
||||
<input class="button" id="duplicateBtn" value="Duplikuj" type="button">
|
||||
<input class="button" id="deleteBtn" value="Usuń" type="button">
|
||||
<input class="button" id="excelBtn" value="Excel" type="button">
|
||||
<input class="button" id="pdfBtn" value="PDF" type="button">
|
||||
<input class="button" id="productionBtn" value="RW/PW" type="button">
|
||||
|
||||
<div id="1">
|
||||
<table id="allTable">
|
||||
<thead>
|
||||
<tr>
|
||||
<th> </th>
|
||||
<th>Indeks</th>
|
||||
<th>Nazwa</th>
|
||||
<th>Data produkcji</th>
|
||||
<th>Ilość</th>
|
||||
<th>Ilość ZS</th>
|
||||
<th>Stan</th>
|
||||
<th>ZS E5</th>
|
||||
<th>Typ</th>
|
||||
<th>Status</th>
|
||||
<th>Zamawiający</th>
|
||||
<th>Odbiorca</th>
|
||||
<th>Forma</th>
|
||||
<th>Marka</th>
|
||||
<th>Data wysyłki</th>
|
||||
<th>Uwagi</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody aria-live="polite" aria-relevant="all">
|
||||
{foreach from=$data item=ROW name=loop}
|
||||
<tr>
|
||||
<td>
|
||||
<input type="checkbox" value="{$ROW.id}" class="allCheck"/>
|
||||
<!--
|
||||
<img src="modules/EcmQuotes/images/add_position.gif" style="margin-top: 3px; margin-right: 3px; cursor: pointer" width="12" alt="Duplikuj" onclick="duplicatePosition('{$ROW.id}')">
|
||||
<img src="modules/EcmQuotes/images/deleterow.gif" style="margin-top: 3px; margin-right: 3px; cursor: pointer" width="12" alt="Usuń" onclick="removePosition('{$ROW.id}')">
|
||||
-->
|
||||
</td>
|
||||
<td>
|
||||
<a title="{$ROW.productFullCode}" target="_blank"
|
||||
href="index.php?module=EcmProducts&action=DetailView&record={$ROW.productId}">
|
||||
{$ROW.productCode}
|
||||
</a>
|
||||
</td>
|
||||
<td title="{$ROW.productFullName}">
|
||||
{$ROW.productName}
|
||||
</td>
|
||||
<td>
|
||||
<input id="production-date-{$ROW.id}" name="production-date-{$ROW.id}" type="text"
|
||||
maxlength="10" size="11" tabindex="" title="" value="{$ROW.productionDate}" autocomplete="off"
|
||||
id="production-date-{$ROW.id}" onchange="saveProductionDate('{$ROW.id}')">
|
||||
<img id="production-date-trigger-{$ROW.id}" src="themes/default/images/jscalendar.gif"
|
||||
style="width: 13px;">
|
||||
<script language="JavaScript" type="text/javascript">
|
||||
Calendar.setup({ldelim}
|
||||
inputField: "production-date-{$ROW.id}",
|
||||
daFormat: "%Y-%m-%d",
|
||||
button: "production-date-trigger-{$ROW.id}",
|
||||
singleClick: true,
|
||||
dateStr: "",
|
||||
step: 1
|
||||
{rdelim}
|
||||
);
|
||||
</script>
|
||||
</td>
|
||||
<td style="white-space: nowrap;">
|
||||
<div id="edit-{$ROW.id}" class="ui-icon ui-icon-pencil"
|
||||
onclick="editQty('{$ROW.id}')" style="display: inline-block;"></div>
|
||||
<div id="save-{$ROW.id}" class="ui-icon ui-icon-check"
|
||||
onclick="saveQty('{$ROW.id}')" style="display: none;"></div>
|
||||
<div id="qty-{$ROW.id}" style="display: inline; width: 300px;">{$ROW.qty}
|
||||
</div>
|
||||
<input id="qtyInput-{$ROW.id}" value="{$ROW.qty}" style="width: 50px; display: none;" type="number"/>
|
||||
</td>
|
||||
<td>
|
||||
{$ROW.productQty}
|
||||
</td>
|
||||
<td>
|
||||
{$ROW.productStockState}
|
||||
</td>
|
||||
<td>
|
||||
<a target="_blank" href="index.php?module=EcmSales&action=DetailView&record={$ROW.orderId}">
|
||||
{$ROW.orderNo}
|
||||
</a>
|
||||
</td>
|
||||
<td>
|
||||
{$ROW.orderType}
|
||||
</td>
|
||||
<td>
|
||||
{$ROW.orderStatus}
|
||||
</td>
|
||||
<td>
|
||||
<a target="_blank" href="index.php?module=Accounts&action=DetailView&record={$ROW.orderParentId}">
|
||||
{$ROW.orderParent}
|
||||
</a>
|
||||
</td>
|
||||
<td>
|
||||
{$ROW.shippingTo}
|
||||
</td>
|
||||
<td>
|
||||
{$ROW.productShape}
|
||||
</td>
|
||||
<td>
|
||||
{$ROW.productBrand}
|
||||
</td>
|
||||
<td>
|
||||
{$ROW.orderSendDate}
|
||||
</td>
|
||||
<td>
|
||||
<div id="edit-description-{$ROW.id}" class="ui-icon ui-icon-pencil"
|
||||
onclick="editDescription('{$ROW.id}')" style="display: inline-block;"></div>
|
||||
<div id="save-description-{$ROW.id}" class="ui-icon ui-icon-check"
|
||||
onclick="saveDescription('{$ROW.id}')" style="display: none;"></div>
|
||||
<div id="description-{$ROW.id}" style="display: inline; width: 300px;">{$ROW.description}
|
||||
</div>
|
||||
<textarea id="descriptionInput-{$ROW.id}"
|
||||
style="display: none;">{$ROW.fullDescription}</textarea>
|
||||
</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
@@ -1,15 +1,4 @@
|
||||
$(document).ready(function () {
|
||||
$.tablesorter.addParser({
|
||||
id: 'production_date',
|
||||
is: function (s, table, cell, $cell) {
|
||||
return false;
|
||||
},
|
||||
format: function (s, table, cell, cellIndex) {
|
||||
return $(cell).find("input[id^=production-date]").val() || "1970-01-01";
|
||||
},
|
||||
parsed: false,
|
||||
type: 'text'
|
||||
});
|
||||
$("#allTable").tablesorter({
|
||||
sortList: [[13, 1]],
|
||||
theme: 'blue',
|
||||
@@ -51,9 +40,6 @@ $(document).ready(function () {
|
||||
},
|
||||
},
|
||||
},
|
||||
headers: {
|
||||
16: { sorter: 'production_date'},
|
||||
},
|
||||
});
|
||||
$("#allTable").bind('filterEnd', function (event, config) {
|
||||
updateAllPositions();
|
||||
@@ -202,7 +188,14 @@ function drawComponents(data) {
|
||||
$("#componentsTableContainer").html(componentsTablePrototype());
|
||||
data.forEach((el, index) => {
|
||||
var tr = $("<tr></tr>");
|
||||
tr.append("<td><input type=\"checkbox\" value=" + el.productId + " class=\"componentCheck\" /></td>");
|
||||
var position = "<td><input type=\"checkbox\" value=" + el.productId + " class=\"componentCheck\" />";
|
||||
if (el.scheduled > 0) {
|
||||
position += '<div style="background-color: green; width: 8px; height: 8px; border-radius: 50%; margin-top: 2px; margin-left: 2px;"></div>'
|
||||
} else {
|
||||
position += '<br>';
|
||||
}
|
||||
position += "<img src=\"modules/EcmQuotes/images/add_position.gif\" style=\"margin-top: 3px; margin-right: 3px; cursor: pointer\" width=\"12\" alt=\"\" onclick=\"addComponentToProductionScheduler('"+el.productId+"','"+el.productQty+"')\">";
|
||||
tr.append(position);
|
||||
tr.append("<td>" + (index + 1) + "</td>");
|
||||
tr.append("<td><a target=\"_blank\" href=\"index.php?module=EcmProducts&action=DetailView&record=" + el.productId + "\">" + el.productCode + "</a></td>");
|
||||
tr.append("<td title=\"" + el.productFullName +"\">" + el.productName + "</td>");
|
||||
@@ -286,7 +279,6 @@ function getRawMaterials() {
|
||||
cids
|
||||
},
|
||||
success: function (data) {
|
||||
console.log(data);
|
||||
var result = JSON.parse(data);
|
||||
RawMaterials = result;
|
||||
drawRawMaterials(result);
|
||||
@@ -416,46 +408,21 @@ function orderRawMaterials() {
|
||||
$("#orderRawMaterialsForm").submit();
|
||||
}
|
||||
}
|
||||
function saveProductionDate(id) {
|
||||
$.ajax({
|
||||
method: 'get',
|
||||
url: $(location).attr('href') + "&to_pdf=1&ajaxAction=saveProductionDate&itemId=" + id + "&date=" + $("#production-date-" + id).val(),
|
||||
});
|
||||
}
|
||||
function editComment(positionId) {
|
||||
$("#edit-" + positionId).css("display", "none");
|
||||
$("#description-" + positionId).css("display", "none");
|
||||
$("#descriptionInput-" + positionId).css("display", "inline");
|
||||
$("#descriptionInput-" + positionId).select();
|
||||
$("#save-" + positionId).css("display", "inline-block");
|
||||
}
|
||||
function saveComment(id) {
|
||||
$("#edit-" + id).css("display", "inline-block");
|
||||
$("#description-" + id).css("display", "inline");
|
||||
$("#descriptionInput-" + id).css("display", "none");
|
||||
$("#save-" + id).css("display", "none");
|
||||
$.ajax({
|
||||
method: 'get',
|
||||
url: $(location).attr('href') + "&to_pdf=1&ajaxAction=saveProductDescription&itemId=" + id + "&description=" + $("#descriptionInput-" + id).val(),
|
||||
success: function (data) {
|
||||
$("#description-" + id).html($("#descriptionInput-" + id).val());
|
||||
},
|
||||
});
|
||||
}
|
||||
function showLoader() {
|
||||
function showLoader(msg = "Pobieranie danych") {
|
||||
|
||||
$.blockUI({
|
||||
css: {
|
||||
border: 'none',
|
||||
padding: '15px',
|
||||
backgroundColor: '#000',
|
||||
'-webkit-border-radius': '10px',
|
||||
'-moz-border-radius': '10px',
|
||||
opacity: .5,
|
||||
'font-weight': 'bold',
|
||||
'font-size': '16px',
|
||||
color: '#fff',
|
||||
border: "none",
|
||||
padding: "15px",
|
||||
backgroundColor: "#000",
|
||||
"-webkit-border-radius": "10px",
|
||||
"-moz-border-radius": "10px",
|
||||
opacity: 0.5,
|
||||
"font-weight": "bold",
|
||||
"font-size": "16px",
|
||||
color: "#fff",
|
||||
},
|
||||
message: "Pobieranie danych..."
|
||||
message: msg
|
||||
});
|
||||
}
|
||||
function hideLoader() {
|
||||
@@ -503,3 +470,27 @@ function componentsTablePrototype() {
|
||||
function rawMaterialsTablePrototype() {
|
||||
return '<table id="rawMaterialsTable"><thead><tr><th class="filter-false"><input type="checkbox" id="selectAllRawMaterials" /></th><th>Pozycja</th><th>Indeks</th><th>Nazwa</th><th>Ilość</th><th>JM.</th><th>Stan</th><th>Zamówiono</th><th>Dostawca</th><th>Zamówienie</th></tr></thead><tbody aria-live="polite" aria-relevant="all"></tbody><tfoot><tr><td colspan=4></td><td id="rawMaterialsTableSum">0</td><td colspan="5"></td></tr></tfoot></table>'
|
||||
}
|
||||
function addToProductionScheduler(orderItemId) {
|
||||
showLoader("Trwa dodawanie elementu do harmonogramu produkcji...");
|
||||
$.ajax({
|
||||
method: "get",
|
||||
url: $(location).attr("href") + "&to_pdf=1&ajaxAction=addToProductionScheduler&itemId=" + orderItemId,
|
||||
success: function ()
|
||||
{
|
||||
hideLoader();
|
||||
window.alert("Dodano do harmonogramu produkcji.");
|
||||
},
|
||||
});
|
||||
}
|
||||
function addComponentToProductionScheduler(productId, qty) {
|
||||
showLoader("Trwa dodawanie elementu do harmonogramu produkcji...");
|
||||
$.ajax({
|
||||
method: "get",
|
||||
url: $(location).attr("href") + "&to_pdf=1&ajaxAction=addComponentToProductionScheduler&productId=" + productId + "&qty=" + qty,
|
||||
success: function ()
|
||||
{
|
||||
hideLoader();
|
||||
window.alert("Dodano do harmonogramu produkcji.");
|
||||
},
|
||||
});
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
<?
|
||||
<?php
|
||||
ini_set('display_errors', 1);
|
||||
ini_set('display_startup_errors', 1);
|
||||
error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED);
|
||||
@@ -29,7 +29,8 @@ if (!isset($_GET['ajaxAction'])) {
|
||||
$allQuery = "SELECT s.id, s.document_no, s.status, s.parent_name, s.parent_id, s.send_date, s.type,
|
||||
s.register_date, s.delivery_date, si.code, si.name, si.ecmproduct_id, si.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, si.production_date
|
||||
ss.quantity as stockState, si.id as item_id, s.shipping_address_name, si.production_date,
|
||||
COUNT(ps.id) AS scheduled
|
||||
FROM ecmsaleitems AS si
|
||||
INNER JOIN ecmsales AS s
|
||||
ON s.id = si.ecmsale_id
|
||||
@@ -37,6 +38,8 @@ if (!isset($_GET['ajaxAction'])) {
|
||||
ON si.ecmproduct_id = p.id
|
||||
LEFT JOIN ecmstockstates AS ss
|
||||
ON ss.product_id = si.ecmproduct_id AND ss.stock_id = 'c7afd71a-4c3a-bde4-138d-4acaee1644e4'
|
||||
LEFT JOIN productionScheduler AS ps
|
||||
ON si.id = ps.ecmsaleitem_id AND ps.deleted=0
|
||||
WHERE s.delivery_date > '$dateFrom'";
|
||||
if (is_array($_GET['exclude']) && count($_GET['exclude']) > 0) {
|
||||
foreach ($_GET['exclude'] as $name) {
|
||||
@@ -66,7 +69,7 @@ if (!isset($_GET['ajaxAction'])) {
|
||||
$allQuery .= " OR s.delivery_date IS NULL";
|
||||
$typesWhere = " OR s.delivery_date IS NULL";
|
||||
}
|
||||
$allQuery .= " ORDER BY s.delivery_date ASC, s.register_date ASC, s.document_no ASC";
|
||||
$allQuery .= "GROUP BY si.id ORDER BY s.delivery_date, s.register_date, s.document_no";
|
||||
|
||||
$rows = $db->query($allQuery);
|
||||
$allData = array();
|
||||
@@ -100,6 +103,7 @@ if (!isset($_GET['ajaxAction'])) {
|
||||
$row['shippingTo'] = ($r['shipping_address_name'] == 'Adres korespondencyjny' ? '' : $r['shipping_address_name']);
|
||||
$row['productionDate'] = $r['production_date'];
|
||||
$row['productStockState'] = $r['stockState'] | 0;
|
||||
$row['scheduled'] = $r['scheduled'];
|
||||
|
||||
if ($_GET['hideReadyProducts'] == "false" || $row['productQty'] > $row['productStockState']) {
|
||||
$allData[] = $row;
|
||||
@@ -135,12 +139,16 @@ if (!isset($_GET['ajaxAction'])) {
|
||||
break;
|
||||
case 'getRawMaterials':
|
||||
echo getRawMaterials($_POST['ids'], $_POST['cids']);
|
||||
case 'saveProductionDate':
|
||||
saveProductionDate($_GET['itemId'], $_GET['date']);
|
||||
break;
|
||||
case 'saveProductDescription':
|
||||
saveProductDescription($_GET['itemId'], $_GET['description']);
|
||||
break;
|
||||
case 'addToProductionScheduler':
|
||||
addToProductionScheduler($_GET['itemId']);
|
||||
break;
|
||||
case 'addComponentToProductionScheduler':
|
||||
addComponentToProductionScheduler($_GET['productId'], $_GET['qty']);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -169,13 +177,16 @@ function getComponents($ids, $dateFrom, $dateTo)
|
||||
$rows = $db->query($productsQuery);
|
||||
$componentsData = array();
|
||||
while ($r = $db->fetchByAssoc($rows)) {
|
||||
$componentsQuery = "SELECT p.code, p.name, c.quantity, p.unit_id, c.ecmcomponent_id, ss.quantity as stockState, p.group_ks
|
||||
$componentsQuery = "SELECT p.code, p.name, c.quantity, p.unit_id, c.ecmcomponent_id, ss.quantity as stockState,
|
||||
p.group_ks, COUNT(ps.id) AS scheduled
|
||||
FROM ecmproductcomponents as c
|
||||
INNER JOIN ecmproducts AS p
|
||||
ON p.id = c.ecmcomponent_id
|
||||
LEFT JOIN ecmstockstates AS ss
|
||||
ON ss.product_id = p.id AND ss.stock_id = '368479db-22c5-0220-3a14-4bc426b1c709'
|
||||
WHERE c.ecmproduct_id = '" . $r['ecmproduct_id'] . "'";
|
||||
LEFT JOIN productionScheduler AS ps
|
||||
ON p.id = ps.ecmproduct_id AND ps.is_component = 1 AND ps.deleted=0
|
||||
WHERE c.ecmproduct_id = '" . $r['ecmproduct_id'] . "' GROUP BY p.id";
|
||||
$crows = $db->query($componentsQuery);
|
||||
while ($cr = $db->fetchByAssoc($crows)) {
|
||||
$exists = findProduct($componentsData, $cr['ecmcomponent_id']);
|
||||
@@ -221,6 +232,7 @@ function getComponents($ids, $dateFrom, $dateTo)
|
||||
$row['productGroupKS'] = $cr['group_ks'];
|
||||
$row['orders'] = $orders;
|
||||
$row['productStockState'] = (!empty($cr['stockState'])) ? $cr['stockState'] : 0;
|
||||
$row['scheduled'] = $cr['scheduled'];
|
||||
$componentsData[] = $row;
|
||||
}
|
||||
}
|
||||
@@ -315,25 +327,6 @@ function getRawMaterials($ids, $cids)
|
||||
|
||||
echo json_encode($rawMaterialsData);
|
||||
}
|
||||
|
||||
function saveProductionDate($itemId, $date)
|
||||
{
|
||||
$db = $GLOBALS['db'];
|
||||
$date = date("Y-m-d", strtotime($date));
|
||||
if ($date == '1970-01-01') {
|
||||
$db->query("UPDATE ecmsaleitems SET production_date=NULL WHERE id='$itemId'");
|
||||
} else {
|
||||
$db->query("UPDATE ecmsaleitems SET production_date='$date' WHERE id='$itemId'");
|
||||
}
|
||||
}
|
||||
|
||||
function saveProductDescription($itemId, $description)
|
||||
{
|
||||
$db = $GLOBALS['db'];
|
||||
$description = mysql_escape_string($description);
|
||||
$db->query("UPDATE ecmsaleitems SET description='$description' WHERE id='$itemId'");
|
||||
}
|
||||
|
||||
function getProductRawMaterials($productId, $quantity)
|
||||
{
|
||||
$db = $GLOBALS['db'];
|
||||
@@ -356,3 +349,27 @@ function getProductRawMaterials($productId, $quantity)
|
||||
return $response;
|
||||
}
|
||||
}
|
||||
|
||||
function addToProductionScheduler($orderItemId) {
|
||||
$db = $GLOBALS['db'];
|
||||
global $current_user;
|
||||
$res = $db->fetchByAssoc($db->query("SELECT quantity, ecmproduct_id, production_date, description, ecmsale_id FROM ecmsaleitems WHERE id ='$orderItemId'"));
|
||||
$query = sprintf("INSERT INTO productionScheduler VALUES ('%s', '%s', '%s', '%d', NOW(), NOW(), '%s', '%s', 0, '%s', 0, '%s', '%s');",
|
||||
generateUuidV4(), $orderItemId, $res['ecmsale_id'], $res['quantity'], $current_user->id, $current_user->id, $res['ecmproduct_id'], $res['production_date'], $res['description']);
|
||||
$db->query($query);
|
||||
}
|
||||
|
||||
function addComponentToProductionScheduler($productId, $qty) {
|
||||
$db = $GLOBALS['db'];
|
||||
global $current_user;
|
||||
$query = sprintf("INSERT INTO productionScheduler VALUES ('%s', null, null, '%d', NOW(), NOW(), '%s', '%s', 0, '%s', 1, null, null);",
|
||||
generateUuidV4(), $qty, $current_user->id, $current_user->id, $productId);
|
||||
$db->query($query);
|
||||
}
|
||||
|
||||
function generateUuidV4() {
|
||||
$data = openssl_random_pseudo_bytes(16);
|
||||
$data[6] = chr(ord($data[6]) & 0x0f | 0x40);
|
||||
$data[8] = chr(ord($data[8]) & 0x3f | 0x80);
|
||||
return vsprintf('%s%s-%s-%s-%s-%s%s%s', str_split(bin2hex($data), 4));
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@
|
||||
</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
<input class="button" id="submitForm" name="submit" value="Wykonaj" type="submit">
|
||||
<input class="button" id="submitForm" name="submit" value="Filtruj" type="submit">
|
||||
<input class="button" id="toogleReadyProducts" value="Ukryj gotowe" type="button">
|
||||
<input class="button" id="toogleServices" value="Ukryj usługi" type="button" style="display: none">
|
||||
</td>
|
||||
@@ -164,8 +164,6 @@
|
||||
<th>Data rejestracji</th>
|
||||
<th>Data wysyłki</th>
|
||||
<th>Data dostawy</th>
|
||||
<th>Data produkcji</th>
|
||||
<th>Uwagi</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
@@ -179,6 +177,10 @@
|
||||
{/if}
|
||||
<td>
|
||||
<input type="checkbox" value="{$ROW.orderItemId}" class="allCheck"/>
|
||||
<br><img src="modules/EcmQuotes/images/add_position.gif" style="margin-top: 3px; margin-right: 3px; cursor: pointer" width="12" alt="" onclick="addToProductionScheduler('{$ROW.orderItemId}')">
|
||||
{if $ROW.scheduled > 0}
|
||||
<div style="background-color: green; width: 8px; height: 8px; border-radius: 50%; margin-top: 2px; margin-left: 2px;"></div>
|
||||
{/if}
|
||||
<input type="hidden" id="productId-{$ROW.orderItemId}" value="{$ROW.productId}"/>
|
||||
</td>
|
||||
<td>
|
||||
@@ -233,34 +235,6 @@
|
||||
<td>
|
||||
{$ROW.orderDeliveryDate}
|
||||
</td>
|
||||
<td>
|
||||
<input id="production-date-{$ROW.orderItemId}" name="production-date-{$ROW.orderItemId}" type="text"
|
||||
maxlength="10" size="11" tabindex="" title="" value="{$ROW.productionDate}" autocomplete="off"
|
||||
id="production-date-{$ROW.orderItemId}" onchange="saveProductionDate('{$ROW.orderItemId}')">
|
||||
<img id="production-date-trigger-{$ROW.orderItemId}" src="themes/default/images/jscalendar.gif"
|
||||
style="width: 13px;">
|
||||
<script language="JavaScript" type="text/javascript">
|
||||
Calendar.setup({ldelim}
|
||||
inputField: "production-date-{$ROW.orderItemId}",
|
||||
daFormat: "%Y-%m-%d",
|
||||
button: "production-date-trigger-{$ROW.orderItemId}",
|
||||
singleClick: true,
|
||||
dateStr: "",
|
||||
step: 1
|
||||
{rdelim}
|
||||
);
|
||||
</script>
|
||||
</td>
|
||||
<td title="{$ROW.fullDescription}">
|
||||
<div id="edit-{$ROW.orderItemId}" class="ui-icon ui-icon-pencil"
|
||||
onclick="editComment('{$ROW.orderItemId}')" style="display: inline-block;"></div>
|
||||
<div id="save-{$ROW.orderItemId}" class="ui-icon ui-icon-check"
|
||||
onclick="saveComment('{$ROW.orderItemId}')" style="display: none;"></div>
|
||||
<div id="description-{$ROW.orderItemId}" style="display: inline; width: 300px;">{$ROW.description}
|
||||
</div>
|
||||
<input id="descriptionInput-{$ROW.orderItemId}" type="text" value="{$ROW.fullDescription}"
|
||||
style="width: 300px; display: none;"/>
|
||||
</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
</tbody>
|
||||
@@ -268,7 +242,7 @@
|
||||
<tr>
|
||||
<td colspan=4></td>
|
||||
<td id="allTableSum">0</td>
|
||||
<td colspan="13"></td>
|
||||
<td colspan="11"></td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
<?php
|
||||
if (isset($_GET['reportName']) && $_GET['reportName']=='productsBySales') {
|
||||
include_once("modules/EcmReports/BimIT-Reports/productsBySales/productsBySales.php");
|
||||
} else if (isset($_GET['reportName']) && $_GET['reportName']=='productionSchedule') {
|
||||
include_once("modules/EcmReports/BimIT-Reports/productionSchedule/productionSchedule.php");
|
||||
} else {
|
||||
include_once("modules/EcmReports/ReportSales.php");
|
||||
}
|
||||
?>
|
||||
@@ -53,7 +53,9 @@ if (! defined ( 'sugarEntry' ) || ! sugarEntry)
|
||||
*/
|
||||
require_once('data/SugarBean.php');
|
||||
require_once('include/utils.php');
|
||||
class EcmSale extends SugarBean {
|
||||
|
||||
class EcmSale extends SugarBean
|
||||
{
|
||||
var $field_name_map = array();
|
||||
// STANDARD FIELDS
|
||||
var $id;
|
||||
@@ -129,31 +131,43 @@ class EcmSale extends SugarBean {
|
||||
var $object_name = "EcmSale";
|
||||
// RELATED TABLE NAMES
|
||||
// USED TO RETRIEVE RELATED FIELDS FROM FORM POSTS.
|
||||
var $additional_column_fields = Array (
|
||||
var $additional_column_fields = array(
|
||||
'assigned_user_name',
|
||||
'assigned_user_id',
|
||||
'modified_user_id',
|
||||
'created_by'
|
||||
);
|
||||
// RELATIONSHIP FIELDS
|
||||
var $relationship_fields = Array (
|
||||
var $relationship_fields = array(
|
||||
'note_id' => 'notes',
|
||||
'email_id' => 'emails'
|
||||
// 'account_id' => 'account',
|
||||
// 'contact_id' => 'contact',
|
||||
);
|
||||
function EcmSale() {
|
||||
var $new_schema = true;
|
||||
|
||||
function EcmSale()
|
||||
{
|
||||
parent::SugarBean();
|
||||
$this->setupCustomFields('EcmSales');
|
||||
foreach ($this->field_defs as $field) {
|
||||
$this->field_name_map [$field ['name']] = $field;
|
||||
}
|
||||
}
|
||||
var $new_schema = true;
|
||||
function get_summary_text() {
|
||||
|
||||
static function CreateImgStatus($id, $status)
|
||||
{
|
||||
global $app_list_strings;
|
||||
return '<span id="statusListEcmSale_' . $id . '" style="display:inline;"><img src="modules/EcmSales/images/' . $status . '.gif" title="' . $app_list_strings ['ecmsales_status_dom'] [$status] . '" /></span>';
|
||||
}
|
||||
|
||||
function get_summary_text()
|
||||
{
|
||||
return "$this->name";
|
||||
}
|
||||
function create_list_query($order_by, $where, $show_deleted = 0) {
|
||||
|
||||
function create_list_query($order_by, $where, $show_deleted = 0)
|
||||
{
|
||||
// Fill in the assigned_user_name
|
||||
$custom_join = $this->custom_fields->getJOIN();
|
||||
$query = "SELECT ";
|
||||
@@ -191,7 +205,9 @@ class EcmSale extends SugarBean {
|
||||
$query .= " ORDER BY ecmsales.date_entered";
|
||||
return $query;
|
||||
}
|
||||
function create_export_query($order_by, $where) {
|
||||
|
||||
function create_export_query($order_by, $where)
|
||||
{
|
||||
$custom_join = $this->custom_fields->getJOIN();
|
||||
$query = "SELECT
|
||||
ecmsales.*,
|
||||
@@ -218,31 +234,13 @@ class EcmSale extends SugarBean {
|
||||
$query .= " ORDER BY ecmsales.name";
|
||||
return $query;
|
||||
}
|
||||
function fill_in_additional_list_fields() {
|
||||
|
||||
function fill_in_additional_list_fields()
|
||||
{
|
||||
}
|
||||
function fill_in_additional_detail_fields() {
|
||||
// FILL IN THE ASSIGNED_USER_NAME
|
||||
$this->assigned_user_name = get_assigned_user_name ( $this->assigned_user_id );
|
||||
$this->created_by_name = get_assigned_user_name ( $this->created_by );
|
||||
$this->modified_by_name = get_assigned_user_name ( $this->modified_user_id );
|
||||
/*
|
||||
$result = $this->db->query ( "SELECT status, parent_id, contact_id, template_id, assigned_user_id FROM ecmsales WHERE id='$this->id'" );
|
||||
if (is_resource ( $result )) {
|
||||
$row = $this->db->fetchByAssoc ( $result );
|
||||
if ($row) {
|
||||
$this->status = $row ['status'];
|
||||
$this->parent_id = $row ['parent_id'];
|
||||
$this->contact_id = $row ['contact_id'];
|
||||
$this->template_id = $row ['template_id'];
|
||||
$this->assigned_user_id = $row ['assigned_user_id'];
|
||||
}
|
||||
}
|
||||
*/
|
||||
/*
|
||||
* $query = "select `number`, `template_id` from `ecmsales` where `id`='$this->id' limit 1"; $r = $this->db->query($query); if($r) { $r = $this->db->fetchByAssoc($r); $this->template_id = $r['template_id']; $this->number = $r['number']; $this->setTemplate(); $this->document_no = $this->formatNumber(); }
|
||||
*/
|
||||
}
|
||||
function get_list_view_data() {
|
||||
|
||||
function get_list_view_data()
|
||||
{
|
||||
global $current_language;
|
||||
$this->fill_in_additional_detail_fields();
|
||||
$app_list_strings = return_app_list_strings_language($current_language);
|
||||
@@ -284,12 +282,54 @@ class EcmSale extends SugarBean {
|
||||
|
||||
return $the_array;
|
||||
}
|
||||
function getPriceFromDocument($product){
|
||||
|
||||
function fill_in_additional_detail_fields()
|
||||
{
|
||||
// FILL IN THE ASSIGNED_USER_NAME
|
||||
$this->assigned_user_name = get_assigned_user_name($this->assigned_user_id);
|
||||
$this->created_by_name = get_assigned_user_name($this->created_by);
|
||||
$this->modified_by_name = get_assigned_user_name($this->modified_user_id);
|
||||
/*
|
||||
$result = $this->db->query ( "SELECT status, parent_id, contact_id, template_id, assigned_user_id FROM ecmsales WHERE id='$this->id'" );
|
||||
if (is_resource ( $result )) {
|
||||
$row = $this->db->fetchByAssoc ( $result );
|
||||
if ($row) {
|
||||
$this->status = $row ['status'];
|
||||
$this->parent_id = $row ['parent_id'];
|
||||
$this->contact_id = $row ['contact_id'];
|
||||
$this->template_id = $row ['template_id'];
|
||||
$this->assigned_user_id = $row ['assigned_user_id'];
|
||||
}
|
||||
}
|
||||
*/
|
||||
/*
|
||||
* $query = "select `number`, `template_id` from `ecmsales` where `id`='$this->id' limit 1"; $r = $this->db->query($query); if($r) { $r = $this->db->fetchByAssoc($r); $this->template_id = $r['template_id']; $this->number = $r['number']; $this->setTemplate(); $this->document_no = $this->formatNumber(); }
|
||||
*/
|
||||
}
|
||||
|
||||
function getPriceFromDocument($product)
|
||||
{
|
||||
$zap = $this->db->query("select quantity,price_netto,total_netto from ecmsaleitems where id='" . $product . "'");
|
||||
$dane = $this->db->fetchByAssoc($zap);
|
||||
return $dane;
|
||||
}
|
||||
function getStatusMenuInfo($inJSON = true) {
|
||||
|
||||
function create_new_list_query($order_by, $where, $filter = array(), $params = array(), $show_deleted = 0, $join_type = '', $return_array = false, $parentbean, $singleSelect = false)
|
||||
{
|
||||
echo '<script type="text/javascript" src="include/ECM/EcmPreviewPDF/EcmPreviewPDF.js"></script>';
|
||||
echo '<script type="text/javascript" src="modules/EcmSales/ListView.js"></script>';
|
||||
echo '<link rel="stylesheet" type="text/css" href="modules/EcmSales/ListView.css" />';
|
||||
echo '<script language="javascript"> var EcmSalesStatusMenu = ' . $this->getStatusMenuInfo() . '; </script>';
|
||||
if ($_GET['show_empty_wz']) $where .= 'ecmsales.wz_name is null';
|
||||
|
||||
$ret = parent::create_new_list_query($order_by, $where, $filter, $params, $show_deleted, $join_type, $return_array, $parentbean, $singleSelect);
|
||||
//$ret['from'].=" left outer join ecmstockdocouts as wz on wz.ecmsale_id=ecmsales.id";
|
||||
//echo print_r($ret,true);
|
||||
return $ret;
|
||||
}
|
||||
|
||||
function getStatusMenuInfo($inJSON = true)
|
||||
{
|
||||
global $app_list_strings;
|
||||
$arr = array();
|
||||
foreach ($app_list_strings ['ecmsales_status_dom'] as $key => $value) {
|
||||
@@ -304,29 +344,14 @@ class EcmSale extends SugarBean {
|
||||
else
|
||||
return $arr;
|
||||
}
|
||||
function create_new_list_query($order_by, $where, $filter = array(), $params = array(), $show_deleted = 0, $join_type = '', $return_array = false, $parentbean, $singleSelect = false) {
|
||||
echo '<script type="text/javascript" src="include/ECM/EcmPreviewPDF/EcmPreviewPDF.js"></script>';
|
||||
echo '<script type="text/javascript" src="modules/EcmSales/ListView.js"></script>';
|
||||
echo '<link rel="stylesheet" type="text/css" href="modules/EcmSales/ListView.css" />';
|
||||
echo '<script language="javascript"> var EcmSalesStatusMenu = ' . $this->getStatusMenuInfo () . '; </script>';
|
||||
if($_GET['show_empty_wz'])$where.='ecmsales.wz_name is null';
|
||||
|
||||
$ret=parent::create_new_list_query ( $order_by, $where, $filter, $params, $show_deleted, $join_type, $return_array, $parentbean, $singleSelect );
|
||||
//$ret['from'].=" left outer join ecmstockdocouts as wz on wz.ecmsale_id=ecmsales.id";
|
||||
//echo print_r($ret,true);
|
||||
return $ret;
|
||||
}
|
||||
static function CreateImgStatus($id, $status) {
|
||||
global $app_list_strings;
|
||||
return '<span id="statusListEcmSale_' . $id . '" style="display:inline;"><img src="modules/EcmSales/images/' . $status . '.gif" title="' . $app_list_strings ['ecmsales_status_dom'] [$status] . '" /></span>';
|
||||
}
|
||||
|
||||
/**
|
||||
* BUILDS A GENERIC SEARCH BASED ON THE QUERY STRING USING OR.
|
||||
* DO NOT INCLUDE ANY $THIS-> BECAUSE THIS IS CALLED ON WITHOUT HAVING THE CLASS INSTANTIATED.
|
||||
*/
|
||||
function build_generic_where_clause($the_query_string) {
|
||||
$where_clauses = Array ();
|
||||
function build_generic_where_clause($the_query_string)
|
||||
{
|
||||
$where_clauses = array();
|
||||
$the_query_string = PearDatabase::quote(from_html($the_query_string));
|
||||
array_push($where_clauses, "ecmsales.name like '$the_query_string%'");
|
||||
$the_where = "";
|
||||
@@ -337,20 +362,17 @@ class EcmSale extends SugarBean {
|
||||
}
|
||||
return $the_where;
|
||||
}
|
||||
function set_notification_body($xtpl, $simplemodule) {
|
||||
|
||||
function set_notification_body($xtpl, $simplemodule)
|
||||
{
|
||||
global $mod_strings, $app_list_strings;
|
||||
$xtpl->assign("NAME", $simplemodule->name);
|
||||
$xtpl->assign("DESCRIPTION", $simplemodule->description);
|
||||
return $xtpl;
|
||||
}
|
||||
function bean_implements($interface) {
|
||||
switch ($interface) {
|
||||
case 'ACL' :
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function save($check_notify = FALSE) {
|
||||
|
||||
function save($check_notify = FALSE)
|
||||
{
|
||||
global $current_user;
|
||||
if (!$this->id || $this->id == '') {
|
||||
// generate number
|
||||
@@ -362,29 +384,43 @@ class EcmSale extends SugarBean {
|
||||
$this->savePositions($return_id);
|
||||
return $return_id;
|
||||
}
|
||||
// ***************************Start Managing Positions*************************//
|
||||
function constructInsertQuery($data, $table = '') {
|
||||
if ($table == '' && isset ( $this->object_name ) && $this->object_name != '') {
|
||||
$table = strtolower ( $this->object_name ) . "items";
|
||||
} else
|
||||
return "";
|
||||
$keys = array ();
|
||||
$values = array ();
|
||||
foreach ( $data as $key => $value ) {
|
||||
$keys [] = $key;
|
||||
if (is_array ( $value ))
|
||||
$values [] = $value [1] . str_replace ( "'", "\'", $value [0] ) . $value [1];
|
||||
|
||||
function generateNumber()
|
||||
{
|
||||
$db = $GLOBALS['db'];
|
||||
$r = $db->fetchByAssoc($db->query("SELECT count(id) as c FROM ecmsales WHERE YEAR(register_date)='" . date('Y') . "'"));
|
||||
|
||||
if (!$r || !$r['c'] || $r['c'] == '')
|
||||
$count = 0;
|
||||
else
|
||||
$values [] = "'" . str_replace ( "'", "\'", $value ) . "'";
|
||||
$count = intval($r['c']);
|
||||
|
||||
$count++;
|
||||
|
||||
//has 5 digits?
|
||||
$tmp = strval($count);
|
||||
while (strlen($tmp) < 5)
|
||||
$tmp = '0' . $tmp;
|
||||
|
||||
return date("Ymd") . $tmp;
|
||||
}
|
||||
$q = "insert into `$table` (`";
|
||||
$q .= implode ( '`, `', $keys );
|
||||
$q .= "`) values (";
|
||||
$q .= implode ( ", ", $values );
|
||||
$q .= ");";
|
||||
return $q;
|
||||
|
||||
// ***************************Start Managing Positions*************************//
|
||||
|
||||
function formatNumber($number)
|
||||
{
|
||||
$n = intval(substr($number, 8, 5));
|
||||
$y = substr($number, 0, 4);
|
||||
|
||||
//has 3 digits?
|
||||
while (strlen($n) < 3)
|
||||
$n = '0' . $n;
|
||||
|
||||
return 'ZS ' . $n . '/' . $y;
|
||||
}
|
||||
function savePositions($id = null, $position_list = null) {
|
||||
|
||||
function savePositions($id = null, $position_list = null)
|
||||
{
|
||||
global $current_user, $timedate;
|
||||
if ($position_list == null)
|
||||
$position_list = $this->position_list;
|
||||
@@ -404,8 +440,9 @@ class EcmSale extends SugarBean {
|
||||
$pr->retrieve($p ['id']);
|
||||
$p ['category_id'] = $pr->product_category_id;
|
||||
}
|
||||
$itemId = create_guid();
|
||||
$arr = array(
|
||||
'id' => create_guid (),
|
||||
'id' => $itemId,
|
||||
'date_entered' => array(
|
||||
'NOW()',
|
||||
''
|
||||
@@ -444,16 +481,69 @@ class EcmSale extends SugarBean {
|
||||
if (isset($p['product_production_date']) && strlen($p['product_production_date']) > 5) {
|
||||
$arr['production_date'] = $p['product_production_date'];
|
||||
}
|
||||
// else {
|
||||
// $arr['production_date'] = null;
|
||||
//}
|
||||
$this->db->query ( $this->constructInsertQuery ( $arr ) );
|
||||
|
||||
$this->db->query("INSERT INTO log VALUES ('".mysql_escape_string($this->constructInsertQuery ( $arr ))."')");
|
||||
$this->db->query($this->constructInsertQuery($arr));
|
||||
$position++;
|
||||
|
||||
// update production scheduler
|
||||
$this->db->query(sprintf("UPDATE productionScheduler SET ecmsaleitem_id = '%s' WHERE ecmsale_id='%s' AND ecmproduct_id='%s';",
|
||||
$itemId, $id, $p['product_id']));
|
||||
}
|
||||
}
|
||||
function getPosition($position) {
|
||||
|
||||
function deleteAssignedPositions()
|
||||
{
|
||||
if (isset ($this->id) && $this->id != '') {
|
||||
$query = "DELETE FROM `" . strtolower($this->object_name) . "items` WHERE `" . strtolower($this->object_name) . "_id`='" . $this->id . "'";
|
||||
$r = $this->db->query($query);
|
||||
if ($r)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function constructInsertQuery($data, $table = '')
|
||||
{
|
||||
if ($table == '' && isset ($this->object_name) && $this->object_name != '') {
|
||||
$table = strtolower($this->object_name) . "items";
|
||||
} else
|
||||
return "";
|
||||
$keys = array();
|
||||
$values = array();
|
||||
foreach ($data as $key => $value) {
|
||||
$keys [] = $key;
|
||||
if (is_array($value))
|
||||
$values [] = $value [1] . str_replace("'", "\'", $value [0]) . $value [1];
|
||||
else
|
||||
$values [] = "'" . str_replace("'", "\'", $value) . "'";
|
||||
}
|
||||
$q = "insert into `$table` (`";
|
||||
$q .= implode('`, `', $keys);
|
||||
$q .= "`) values (";
|
||||
$q .= implode(", ", $values);
|
||||
$q .= ");";
|
||||
return $q;
|
||||
}
|
||||
|
||||
function getPositionList($array = false)
|
||||
{
|
||||
if (isset ($this->id) && $this->id != '') {
|
||||
$query = "SELECT * FROM `" . strtolower($this->object_name) . "items` WHERE `" . strtolower($this->object_name) . "_id`='" . $this->id . "' order by position asc";
|
||||
$r = $this->db->query($query);
|
||||
$return_array = array();
|
||||
if ($r) {
|
||||
while ($w = $this->db->fetchByAssoc($r)) {
|
||||
$return_array [] = $this->getPosition($w);
|
||||
}
|
||||
$json = getJSONobj();
|
||||
return $array ? $return_array : $json->encode($return_array);
|
||||
}
|
||||
}
|
||||
return $array ? false : '[]';
|
||||
}
|
||||
|
||||
function getPosition($position)
|
||||
{
|
||||
if (!is_array($position))
|
||||
return '';
|
||||
global $timedate;
|
||||
@@ -489,31 +579,9 @@ class EcmSale extends SugarBean {
|
||||
|
||||
return $return_array;
|
||||
}
|
||||
function getPositionList($array = false) {
|
||||
if (isset ( $this->id ) && $this->id != '') {
|
||||
$query = "SELECT * FROM `" . strtolower ( $this->object_name ) . "items` WHERE `" . strtolower ( $this->object_name ) . "_id`='" . $this->id . "' order by position asc";
|
||||
$r = $this->db->query ( $query );
|
||||
$return_array = array ();
|
||||
if ($r) {
|
||||
while ( $w = $this->db->fetchByAssoc ( $r ) ) {
|
||||
$return_array [] = $this->getPosition ( $w );
|
||||
}
|
||||
$json = getJSONobj ();
|
||||
return $array ? $return_array : $json->encode ( $return_array );
|
||||
}
|
||||
}
|
||||
return $array ? false : '[]';
|
||||
}
|
||||
function deleteAssignedPositions() {
|
||||
if (isset ( $this->id ) && $this->id != '') {
|
||||
$query = "DELETE FROM `" . strtolower ( $this->object_name ) . "items` WHERE `" . strtolower ( $this->object_name ) . "_id`='" . $this->id . "'";
|
||||
$r = $this->db->query ( $query );
|
||||
if ($r)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function formatPositions($position_list) {
|
||||
|
||||
function formatPositions($position_list)
|
||||
{
|
||||
return;
|
||||
if (!is_array($position_list) || count($position_list) == 0)
|
||||
return false;
|
||||
@@ -538,7 +606,10 @@ class EcmSale extends SugarBean {
|
||||
return $position_list;
|
||||
}
|
||||
|
||||
function sendSoap($id){
|
||||
// ***************************End Managing Positions*************************//
|
||||
|
||||
function sendSoap($id)
|
||||
{
|
||||
ini_set("soap.wsdl_cache_enabled", "0");
|
||||
require_once("nusoap/nusoap.php");
|
||||
|
||||
@@ -593,16 +664,18 @@ class EcmSale extends SugarBean {
|
||||
|
||||
// Record attributes
|
||||
"name_value_list" => $sdi_fields
|
||||
)
|
||||
;
|
||||
);
|
||||
|
||||
$set_entry_result = $client->call("set_entry", $set_entry_parameters);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
// ***************************End Managing Positions*************************//
|
||||
function ACLAccess($view, $is_owner = 'not_set') {
|
||||
|
||||
//mz generate number
|
||||
|
||||
function ACLAccess($view, $is_owner = 'not_set')
|
||||
{
|
||||
global $current_user;
|
||||
$file = 'modules/EcmGroupSales/EcmGroupSale.php';
|
||||
if (file_exists($file)) {
|
||||
@@ -741,38 +814,17 @@ class EcmSale extends SugarBean {
|
||||
return true;
|
||||
}
|
||||
|
||||
//mz generate number
|
||||
function generateNumber() {
|
||||
$db = $GLOBALS['db'];
|
||||
$r = $db->fetchByAssoc($db->query("SELECT count(id) as c FROM ecmsales WHERE YEAR(register_date)='".date('Y')."'"));
|
||||
|
||||
if (!$r || !$r['c'] || $r['c']=='')
|
||||
$count = 0;
|
||||
else
|
||||
$count = intval($r['c']);
|
||||
|
||||
$count++;
|
||||
|
||||
//has 5 digits?
|
||||
$tmp = strval($count);
|
||||
while (strlen($tmp) < 5)
|
||||
$tmp = '0'.$tmp;
|
||||
|
||||
return date("Ymd").$tmp;
|
||||
function bean_implements($interface)
|
||||
{
|
||||
switch ($interface) {
|
||||
case 'ACL' :
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function formatNumber($number) {
|
||||
$n = intval(substr($number, 8,5));
|
||||
$y = substr($number,0,4);
|
||||
|
||||
//has 3 digits?
|
||||
while (strlen($n) < 3)
|
||||
$n = '0'.$n;
|
||||
|
||||
return 'ZS '.$n.'/'.$y;
|
||||
}
|
||||
|
||||
function CreateQueryFromPost($array){
|
||||
function CreateQueryFromPost($array)
|
||||
{
|
||||
$field_array = array();
|
||||
if ($array['date_from'] != '') $field_array[] = "delivery_date>='" . date("Y-m-d", strtotime($array['date_from'])) . "'";
|
||||
if ($array['date_to'] != '') $field_array[] = "delivery_date<='" . date("Y-m-d", strtotime($array['date_to'])) . "'";
|
||||
@@ -805,7 +857,8 @@ class EcmSale extends SugarBean {
|
||||
return $z;
|
||||
}
|
||||
|
||||
function GetArrayResultFromQuery($query){
|
||||
function GetArrayResultFromQuery($query)
|
||||
{
|
||||
$db = $GLOBALS ['db'];
|
||||
$w = $db->query($query);
|
||||
echo mysql_error();
|
||||
@@ -1055,34 +1108,9 @@ class EcmSale extends SugarBean {
|
||||
|
||||
return $result_array;
|
||||
}
|
||||
function createPdfFileName($format=true) {
|
||||
global $mod_strings;
|
||||
|
||||
$arr1 = Array('\\', '/', ':', '*', '?' , '"', '<', '>', '|', ' ');
|
||||
|
||||
$arr2 = Array('', '', '', '', '', '\'', '[', ']', '', '_');
|
||||
|
||||
$tmp = $this->document_no;
|
||||
|
||||
if($format)
|
||||
|
||||
$tmp = str_replace($arr1, $arr2, $mod_strings['LBL_PDF_FILENAME'].$tmp.'.pdf');
|
||||
|
||||
else
|
||||
|
||||
$tmp = $mod_strings['LBL_PDF_FILENAME'].$tmp.'.pdf';
|
||||
|
||||
//$mod = return_module_language($current_language, 'EcmInvoiceOuts');
|
||||
|
||||
//return urlencode(
|
||||
|
||||
// return $mod['LBL_PDF_INVOICE_FILE_NAME'].$tmp.'.pdf';//);
|
||||
|
||||
return $tmp; //);
|
||||
|
||||
}
|
||||
|
||||
function UploadXML(){
|
||||
function UploadXML()
|
||||
{
|
||||
$allowedExts = array("xml");
|
||||
$temp = explode(".", $_FILES["file"]["name"]);
|
||||
$extension = end($temp);
|
||||
@@ -1101,7 +1129,8 @@ class EcmSale extends SugarBean {
|
||||
}
|
||||
}
|
||||
|
||||
function CreateMultiPDF($post){
|
||||
function CreateMultiPDF($post)
|
||||
{
|
||||
ini_set('max_execution_time', 9999999999);
|
||||
$filename = array();
|
||||
global $current_user;
|
||||
@@ -1167,5 +1196,34 @@ class EcmSale extends SugarBean {
|
||||
return $file . '.pdf';
|
||||
}
|
||||
|
||||
function createPdfFileName($format = true)
|
||||
{
|
||||
global $mod_strings;
|
||||
|
||||
$arr1 = array('\\', '/', ':', '*', '?', '"', '<', '>', '|', ' ');
|
||||
|
||||
$arr2 = array('', '', '', '', '', '\'', '[', ']', '', '_');
|
||||
|
||||
$tmp = $this->document_no;
|
||||
|
||||
if ($format)
|
||||
|
||||
$tmp = str_replace($arr1, $arr2, $mod_strings['LBL_PDF_FILENAME'] . $tmp . '.pdf');
|
||||
|
||||
else
|
||||
|
||||
$tmp = $mod_strings['LBL_PDF_FILENAME'] . $tmp . '.pdf';
|
||||
|
||||
//$mod = return_module_language($current_language, 'EcmInvoiceOuts');
|
||||
|
||||
//return urlencode(
|
||||
|
||||
// return $mod['LBL_PDF_INVOICE_FILE_NAME'].$tmp.'.pdf';//);
|
||||
|
||||
return $tmp; //);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -9,7 +9,7 @@ set_time_limit(1000000);
|
||||
$sarr=array();
|
||||
$parr=array();
|
||||
|
||||
// https://crm.e5.pl/index.php?module=EcmStockStates&action=rebuildStates&ids=2096adf3-d888-a84f-c7ec-59f810381701,75d70d0d-8f48-bf2c-3cd7-63a426511e9e,8f0d5583-468a-9c14-83b2-50a25be72052,cbead744-99e9-7d1c-0d7e-58622d8e6d8b,e95ac585-b616-b83f-e5e4-4ae5952dae8f
|
||||
// https://crm.e5.pl/index.php?module=EcmStockStates&action=rebuildStates&ids=20e88740-56f6-7306-1008-647450c5e4fd,d783e0de-2ea0-f783-d29b-5bffea73981c
|
||||
|
||||
if (isset($_GET['ids'])) {
|
||||
$ids = explode(',', $_GET['ids']);
|
||||
|
||||
@@ -157,6 +157,11 @@
|
||||
<a href="index.php?module=EcmReports&action=index&reportName=productsBySales&parentTab=Produkcja">Planowanie produkcji</a>
|
||||
</li>
|
||||
{/if}
|
||||
{if $group=='Produkcja'}
|
||||
<li>
|
||||
<a href="index.php?module=EcmReports&action=index&reportName=productionSchedule&parentTab=Produkcja">Harmonogram produkcji</a>
|
||||
</li>
|
||||
{/if}
|
||||
</ul>
|
||||
</span>
|
||||
{/foreach}
|
||||
|
||||
Reference in New Issue
Block a user