Compare commits

...

51 Commits

Author SHA1 Message Date
300aa5381a allow ZS edit for everyone 2025-12-05 09:12:10 +00:00
292748248b Stock Addresses on Stock report 2025-11-30 16:08:08 +00:00
2424bb76a3 Delivery contact on ZS realization list 2025-11-30 15:46:59 +00:00
7312918962 last fix 2025-11-27 21:00:07 +01:00
f2c24967df csv fix 2025-11-27 20:57:49 +01:00
469e254d9c csv fix 2025-11-27 20:45:31 +01:00
a7339e01f4 CSV exports fix 2025-11-27 20:07:59 +01:00
fbc3c112a2 Product.production_description fix 2025-11-27 19:05:26 +00:00
4e4a556e59 Create IO from ProductsSummary 2025-11-20 17:13:40 +01:00
0a4745366b InsideOrder: remove item fix 2025-11-20 16:49:02 +01:00
0caa2351d8 update csv queries 2025-11-10 07:47:51 +00:00
Michał Zieliński
a3bd40889a sort sale products list by stock_address 2025-11-08 12:54:24 +01:00
Michał Zieliński
a39ebfd84c export stock addresses 2025-11-08 12:23:19 +01:00
Michał Zieliński
ef6b3e0f7c currency in csv reports 2025-11-07 10:21:54 +01:00
ec0ada2f7f dropdowns 2025-11-07 09:20:26 +00:00
Michał Zieliński
d5c4261b23 production: filter data fix 2025-10-13 13:34:52 +02:00
Michał Zieliński
07100c8f12 production: update sorting 2025-10-09 15:16:52 +02:00
c02009ad63 cleanup 2025-10-08 06:35:11 +00:00
Michał Zieliński
e52fb4e039 production: filter by date fix 2025-10-08 08:26:37 +02:00
Michał Zieliński
7e0d56c670 production: production_description in product 2025-10-08 07:49:19 +02:00
2fac64346e dropdowns 2025-10-07 15:56:45 +00:00
Michał Zieliński
4374f2cd65 production: time in production date 2025-10-07 17:54:59 +02:00
Michał Zieliński
0e8227fc82 production: time in production date 2025-10-06 20:13:50 +02:00
Michał Zieliński
aae6334793 production: excel export fix 2025-10-02 12:07:33 +02:00
fc4268def0 dropdowns 2025-10-02 08:59:59 +00:00
55f0a2e88d dropdowns 2025-09-24 17:28:26 +00:00
Michał Zieliński
76dd05d591 AI CSV 2025-09-24 19:27:41 +02:00
Michał Zieliński
d5d1d1ac28 AI CSV FIX 2025-09-23 14:08:33 +02:00
Michał Zieliński
5ae9391a70 AI CSV FIX 2025-09-23 14:00:31 +02:00
Michał Zieliński
204edb231f productionScheduler - action time fix 2025-09-22 09:22:07 +02:00
Michał Zieliński
34113a5619 productionScheduler - action time fix 2025-09-22 09:16:59 +02:00
Michał Zieliński
f6e5959027 productionScheduler - action time fix 2025-09-22 09:12:01 +02:00
Michał Zieliński
c447558d2a productionScheduler - action time 2025-09-19 12:53:21 +02:00
21bd1807f3 dropdowns 2025-09-19 10:51:37 +00:00
e759b6eb46 Update google password 2025-09-17 10:11:11 +00:00
Michał Zieliński
52f306cef9 Merge remote-tracking branch 'origin/master' 2025-09-15 20:00:06 +02:00
Michał Zieliński
980180adb1 productionScheduler + ecmactions field name 2025-09-15 20:00:00 +02:00
4fc4fa05be dropdowns 2025-09-15 17:44:04 +00:00
Michał Zieliński
91e6a206cb Update ai exports 2025-09-15 19:40:04 +02:00
Michał Zieliński
f9b7c2462b raw materials fix 2025-09-08 14:57:40 +02:00
Michał Zieliński
64a63d5748 raw materials fix 2025-09-08 10:59:33 +02:00
Michał Zieliński
cbf5645912 production - restore old version 2025-09-08 09:48:14 +02:00
Michał Zieliński
c70ab619e6 Merge remote-tracking branch 'origin/master' 2025-09-08 09:06:40 +02:00
Michał Zieliński
b8b076ebe7 production - restore old version 2025-09-08 09:04:46 +02:00
ea46083637 dropdowns 2025-09-08 06:54:07 +00:00
66e000879d dropdowns 2025-09-08 06:54:07 +00:00
Michał Zieliński
7a3f58a551 production - restore old version 2025-09-08 08:50:32 +02:00
Michał Zieliński
e76b3fb61c Merge remote-tracking branch 'origin/master' 2025-08-30 13:21:03 +02:00
Michał Zieliński
fb866fb386 delivery date in sale fix 2025-08-30 13:20:14 +02:00
Michał Zieliński
75dc09ca26 Merge pull request #9 from bimbej/#4-formting-links
formating links
2025-08-30 12:17:44 +02:00
zzdrojewskipaw
29fa933cb8 formating links 2025-08-30 12:16:01 +02:00
36 changed files with 2993 additions and 1946 deletions

View File

@@ -1,5 +1,6 @@
<?php <?php
function sendInvoice($record) { function sendInvoice($record)
{
require_once('modules/EcmInvoiceOuts/EcmInvoiceOut.php'); require_once('modules/EcmInvoiceOuts/EcmInvoiceOut.php');
$inv = new EcmInvoiceOut(); $inv = new EcmInvoiceOut();
$inv->retrieve($record); $inv->retrieve($record);
@@ -17,7 +18,8 @@ function sendInvoice($record) {
); );
echo json_encode($response); echo json_encode($response);
} }
function sendProduct($record) { function sendProduct($record)
{
require_once('modules/EcmProducts/EcmProduct.php'); require_once('modules/EcmProducts/EcmProduct.php');
$prod = new EcmProduct(); $prod = new EcmProduct();
$prod->retrieve($record); $prod->retrieve($record);
@@ -32,7 +34,8 @@ function sendProduct($record) {
); );
echo json_encode($response); echo json_encode($response);
} }
function copySaleFromTwinpol($record) { function copySaleFromTwinpol($record)
{
$db = $GLOBALS['db']; $db = $GLOBALS['db'];
// check if sale exists // check if sale exists
@@ -50,7 +53,10 @@ function copySaleFromTwinpol($record) {
$gotAllProducts = true; // hope :) $gotAllProducts = true; // hope :)
$newPositionList = array(); $newPositionList = array();
$total_netto = 0; $total_brutto = 0; $total_discount = 0; $vats = array(); $total_netto = 0;
$total_brutto = 0;
$total_discount = 0;
$vats = array();
foreach ($sale->position_list as $product) { foreach ($sale->position_list as $product) {
echo 'Produkt: ' . $product->product_code; echo 'Produkt: ' . $product->product_code;
$p = getProduct(trim($product->product_code)); $p = getProduct(trim($product->product_code));
@@ -110,7 +116,7 @@ function copySaleFromTwinpol($record) {
$prod['ecmvat_id'] = $vat_id; $prod['ecmvat_id'] = $vat_id;
$prod['ecmvat_value'] = $vat_value; $prod['ecmvat_value'] = $vat_value;
$prod['ecmvat_name'] = $vat_name; $prod['ecmvat_name'] = $vat_name;
$prod['price_brutto'] = round($prod['price_netto']+($prod['price_netto']*($prod['ecmvat_value']/100)),2); $prod['price_netto'] = round((float)$price_start - ((float)$price_start * ((float)$product->discount / 100)), 2);
$prod['total_netto'] = round($prod['price_netto'] * $prod['quantity'], 2); $prod['total_netto'] = round($prod['price_netto'] * $prod['quantity'], 2);
$prod['total_brutto'] = round($prod['total_netto'] + ($prod['total_netto'] * ($prod['ecmvat_value'] / 100)), 2); $prod['total_brutto'] = round($prod['total_netto'] + ($prod['total_netto'] * ($prod['ecmvat_value'] / 100)), 2);
@@ -207,9 +213,9 @@ ILN: ".$sale->shipping_iln;
echo '<a target="new" href="https://crm.e5.pl/index.php?module=EcmSales&action=DetailView&record=' . $newId . '">Utworzono ZS.</a>'; echo '<a target="new" href="https://crm.e5.pl/index.php?module=EcmSales&action=DetailView&record=' . $newId . '">Utworzono ZS.</a>';
die(); die();
} }
// local helpers // local helpers
function getProduct($code) { function getProduct($code)
{
$db = $GLOBALS['db']; $db = $GLOBALS['db'];
$res = $db->fetchByAssoc($db->query("SELECT * FROM ecmproducts WHERE code='$code' AND deleted=0")); $res = $db->fetchByAssoc($db->query("SELECT * FROM ecmproducts WHERE code='$code' AND deleted=0"));
if (!$res) { if (!$res) {
@@ -221,8 +227,8 @@ function getProduct($code) {
return $prod; return $prod;
} }
} }
function makeCUrlRequest($url)
function makeCUrlRequest($url) { {
$curl = curl_init(); $curl = curl_init();
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'GET'); curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'GET');
curl_setopt($curl, CURLOPT_VERBOSE, 1); curl_setopt($curl, CURLOPT_VERBOSE, 1);
@@ -232,16 +238,16 @@ function makeCUrlRequest($url) {
curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_URL, $url);
return curl_exec($curl); return curl_exec($curl);
} }
function brecho($msg)
function brecho($msg) { {
echo '<br><br>'; echo '<br><br>';
var_dump($msg); var_dump($msg);
echo '<br><br>'; echo '<br><br>';
} }
function createCSVReports() function createCSVReports()
{ {
{ // generateProductComponentsCSV();
$db = $GLOBALS['db']; $db = $GLOBALS['db'];
$exportDir = __DIR__ . "/export"; $exportDir = __DIR__ . "/export";
@@ -255,32 +261,39 @@ function createCSVReports()
p.code, p.code,
p.name, p.name,
CASE p.group_ks CASE p.group_ks
WHEN 1 THEN 'Towar handlowy' WHEN '1' THEN 'Towar handlowy'
WHEN 2 THEN 'Wyrób gotowy' WHEN '2' THEN 'Wyrób gotowy'
WHEN 3 THEN 'Surowiec' WHEN '3' THEN 'Surowiec'
WHEN 4 THEN 'Usługa' WHEN '4' THEN 'Usługa'
ELSE 'Nieznane' ELSE 'Nieznane'
END AS group_ks, END AS group_ks_name,
GROUP_CONCAT(c.name ORDER BY cb.position SEPARATOR ' | ') AS category, GROUP_CONCAT(DISTINCT c.name ORDER BY cb.position SEPARATOR ' | ') AS category,
ii.quantity, ii.quantity,
ii.price_netto ii.price_netto,
cur.name AS currency_name
FROM ecminvoiceouts AS i FROM ecminvoiceouts AS i
INNER JOIN ecminvoiceoutitems AS ii ON i.id = ii.ecminvoiceout_id INNER JOIN ecminvoiceoutitems AS ii
INNER JOIN ecmproducts AS p ON ii.ecmproduct_id = p.id ON i.id = ii.ecminvoiceout_id
LEFT JOIN ecmproductcategories_bean AS cb ON cb.bean_id COLLATE utf8_general_ci = p.id COLLATE utf8_general_ci AND ii.deleted = 0
INNER JOIN ecmproducts AS p
ON ii.ecmproduct_id = p.id
AND p.deleted = 0
LEFT JOIN currencies AS cur
ON cur.id = i.currency_id
AND cur.deleted = 0
LEFT JOIN ecmproductcategories_bean AS cb
ON cb.bean_id = p.id
AND cb.bean_name = 'EcmProducts' AND cb.bean_name = 'EcmProducts'
AND cb.deleted = 0 AND cb.deleted = 0
LEFT JOIN ecmproductcategories AS c ON c.id = cb.ecmproductcategory_id LEFT JOIN ecmproductcategories AS c
WHERE i.type = 'normal' AND YEAR(i.register_date) = 2024 ON c.id = cb.ecmproductcategory_id
AND c.deleted = 0
WHERE i.type = 'normal'
AND i.register_date BETWEEN '2024-01-01' AND '2024-12-31'
AND i.deleted = 0
GROUP BY GROUP BY
i.document_no, i.id,
i.register_date, ii.id
i.parent_name,
p.code,
p.name,
p.group_ks,
ii.quantity,
ii.price_netto
ORDER BY i.register_date DESC; ORDER BY i.register_date DESC;
", ",
'filename' => 'invoices_2024.csv', 'filename' => 'invoices_2024.csv',
@@ -294,32 +307,39 @@ ORDER BY i.register_date DESC;
p.code, p.code,
p.name, p.name,
CASE p.group_ks CASE p.group_ks
WHEN 1 THEN 'Towar handlowy' WHEN '1' THEN 'Towar handlowy'
WHEN 2 THEN 'Wyrób gotowy' WHEN '2' THEN 'Wyrób gotowy'
WHEN 3 THEN 'Surowiec' WHEN '3' THEN 'Surowiec'
WHEN 4 THEN 'Usługa' WHEN '4' THEN 'Usługa'
ELSE 'Nieznane' ELSE 'Nieznane'
END AS group_ks, END AS group_ks_name,
GROUP_CONCAT(c.name ORDER BY cb.position SEPARATOR ' | ') AS category, GROUP_CONCAT(DISTINCT c.name ORDER BY cb.position SEPARATOR ' | ') AS category,
ii.quantity, ii.quantity,
ii.price_netto ii.price_netto,
cur.name AS currency_name
FROM ecminvoiceouts AS i FROM ecminvoiceouts AS i
INNER JOIN ecminvoiceoutitems AS ii ON i.id = ii.ecminvoiceout_id INNER JOIN ecminvoiceoutitems AS ii
INNER JOIN ecmproducts AS p ON ii.ecmproduct_id = p.id ON i.id = ii.ecminvoiceout_id
LEFT JOIN ecmproductcategories_bean AS cb ON cb.bean_id COLLATE utf8_general_ci = p.id COLLATE utf8_general_ci AND ii.deleted = 0
INNER JOIN ecmproducts AS p
ON ii.ecmproduct_id = p.id
AND p.deleted = 0
LEFT JOIN currencies AS cur
ON cur.id = i.currency_id
AND cur.deleted = 0
LEFT JOIN ecmproductcategories_bean AS cb
ON cb.bean_id = p.id
AND cb.bean_name = 'EcmProducts' AND cb.bean_name = 'EcmProducts'
AND cb.deleted = 0 AND cb.deleted = 0
LEFT JOIN ecmproductcategories AS c ON c.id = cb.ecmproductcategory_id LEFT JOIN ecmproductcategories AS c
WHERE i.type = 'normal' AND YEAR(i.register_date) = 2025 ON c.id = cb.ecmproductcategory_id
AND c.deleted = 0
WHERE i.type = 'normal'
AND i.register_date BETWEEN '2025-01-01' AND '2025-12-31'
AND i.deleted = 0
GROUP BY GROUP BY
i.document_no, i.id,
i.register_date, ii.id
i.parent_name,
p.code,
p.name,
p.group_ks,
ii.quantity,
ii.price_netto
ORDER BY i.register_date DESC; ORDER BY i.register_date DESC;
", ",
'filename' => 'invoices_2025.csv', 'filename' => 'invoices_2025.csv',
@@ -335,37 +355,43 @@ SELECT
p.code, p.code,
p.name, p.name,
CASE p.group_ks CASE p.group_ks
WHEN 1 THEN 'Towar handlowy' WHEN '1' THEN 'Towar handlowy'
WHEN 2 THEN 'Wyrób gotowy' WHEN '2' THEN 'Wyrób gotowy'
WHEN 3 THEN 'Surowiec' WHEN '3' THEN 'Surowiec'
WHEN 4 THEN 'Usługa' WHEN '4' THEN 'Usługa'
ELSE 'Nieznane' ELSE 'Nieznane'
END AS group_ks, END AS group_ks_name,
GROUP_CONCAT(c.name ORDER BY cb.position SEPARATOR ' | ') AS category, GROUP_CONCAT(DISTINCT c.name ORDER BY cb.position SEPARATOR ' | ') AS category,
ii.quantity_corrected AS quantity_correced, ii.quantity_corrected AS quantity_corrected,
ii.total_netto_corrected AS total_netto_corrected ii.total_netto_corrected AS total_netto_corrected,
cur.name AS currency_name
FROM ecminvoiceouts AS i FROM ecminvoiceouts AS i
INNER JOIN ecminvoiceoutitems AS ii ON i.id = ii.ecminvoiceout_id INNER JOIN ecminvoiceoutitems AS ii
INNER JOIN ecmproducts AS p ON ii.ecmproduct_id = p.id ON i.id = ii.ecminvoiceout_id
INNER JOIN ecminvoiceouts AS oi ON oi.id = i.ecminvoiceout_id AND ii.deleted = 0
LEFT JOIN ecmproductcategories_bean AS cb ON cb.bean_id COLLATE utf8_general_ci = p.id COLLATE utf8_general_ci INNER JOIN ecmproducts AS p
ON ii.ecmproduct_id = p.id
AND p.deleted = 0
LEFT JOIN ecminvoiceouts AS oi
ON oi.id = i.ecminvoiceout_id
AND oi.deleted = 0
LEFT JOIN currencies AS cur
ON cur.id = i.currency_id
AND cur.deleted = 0
LEFT JOIN ecmproductcategories_bean AS cb
ON cb.bean_id = p.id
AND cb.bean_name = 'EcmProducts' AND cb.bean_name = 'EcmProducts'
AND cb.deleted = 0 AND cb.deleted = 0
LEFT JOIN ecmproductcategories AS c ON c.id = cb.ecmproductcategory_id LEFT JOIN ecmproductcategories AS c
WHERE i.type = 'correct' AND YEAR(i.register_date) = 2024 ON c.id = cb.ecmproductcategory_id
AND c.deleted = 0
WHERE i.type = 'correct'
AND i.register_date BETWEEN '2024-01-01' AND '2024-12-31'
AND i.deleted = 0
GROUP BY GROUP BY
i.document_no, i.id,
i.register_date, ii.id,
oi.document_no, oi.id
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; ORDER BY i.register_date DESC;
", ",
'filename' => 'correct_invoices_2024.csv', 'filename' => 'correct_invoices_2024.csv',
@@ -381,37 +407,43 @@ SELECT
p.code, p.code,
p.name, p.name,
CASE p.group_ks CASE p.group_ks
WHEN 1 THEN 'Towar handlowy' WHEN '1' THEN 'Towar handlowy'
WHEN 2 THEN 'Wyrób gotowy' WHEN '2' THEN 'Wyrób gotowy'
WHEN 3 THEN 'Surowiec' WHEN '3' THEN 'Surowiec'
WHEN 4 THEN 'Usługa' WHEN '4' THEN 'Usługa'
ELSE 'Nieznane' ELSE 'Nieznane'
END AS group_ks, END AS group_ks_name,
GROUP_CONCAT(c.name ORDER BY cb.position SEPARATOR ' | ') AS category, GROUP_CONCAT(DISTINCT c.name ORDER BY cb.position SEPARATOR ' | ') AS category,
ii.quantity_corrected AS quantity_correced, ii.quantity_corrected AS quantity_corrected,
ii.total_netto_corrected AS total_netto_corrected ii.total_netto_corrected AS total_netto_corrected,
cur.name AS currency_name
FROM ecminvoiceouts AS i FROM ecminvoiceouts AS i
INNER JOIN ecminvoiceoutitems AS ii ON i.id = ii.ecminvoiceout_id INNER JOIN ecminvoiceoutitems AS ii
INNER JOIN ecmproducts AS p ON ii.ecmproduct_id = p.id ON i.id = ii.ecminvoiceout_id
INNER JOIN ecminvoiceouts AS oi ON oi.id = i.ecminvoiceout_id AND ii.deleted = 0
LEFT JOIN ecmproductcategories_bean AS cb ON cb.bean_id COLLATE utf8_general_ci = p.id COLLATE utf8_general_ci INNER JOIN ecmproducts AS p
ON ii.ecmproduct_id = p.id
AND p.deleted = 0
LEFT JOIN ecminvoiceouts AS oi
ON oi.id = i.ecminvoiceout_id
AND oi.deleted = 0
LEFT JOIN currencies AS cur
ON cur.id = i.currency_id
AND cur.deleted = 0
LEFT JOIN ecmproductcategories_bean AS cb
ON cb.bean_id = p.id
AND cb.bean_name = 'EcmProducts' AND cb.bean_name = 'EcmProducts'
AND cb.deleted = 0 AND cb.deleted = 0
LEFT JOIN ecmproductcategories AS c ON c.id = cb.ecmproductcategory_id LEFT JOIN ecmproductcategories AS c
WHERE i.type = 'correct' AND YEAR(i.register_date) = 2025 ON c.id = cb.ecmproductcategory_id
AND c.deleted = 0
WHERE i.type = 'correct'
AND i.register_date BETWEEN '2025-01-01' AND '2025-12-31'
AND i.deleted = 0
GROUP BY GROUP BY
i.document_no, i.id,
i.register_date, ii.id,
oi.document_no, oi.id
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; ORDER BY i.register_date DESC;
", ",
'filename' => 'correct_invoices_2025.csv', 'filename' => 'correct_invoices_2025.csv',
@@ -424,32 +456,40 @@ SELECT
p.code, p.code,
p.name, p.name,
CASE p.group_ks CASE p.group_ks
WHEN 1 THEN 'Towar handlowy' WHEN '1' THEN 'Towar handlowy'
WHEN 2 THEN 'Wyrób gotowy' WHEN '2' THEN 'Wyrób gotowy'
WHEN 3 THEN 'Surowiec' WHEN '3' THEN 'Surowiec'
WHEN 4 THEN 'Usługa' WHEN '4' THEN 'Usługa'
ELSE 'Nieznane' ELSE 'Nieznane'
END AS group_ks, END AS group_ks_name,
GROUP_CONCAT(c.name ORDER BY cb.position SEPARATOR ' | ') AS category, pc.category,
s.name AS stock, s.name AS stock,
ii.quantity ii.quantity
FROM ecmstockdocinsideouts AS i FROM ecmstockdocinsideouts AS i
INNER JOIN ecmstockdocinsideoutitems AS ii ON i.id = ii.ecmstockdocinsideout_id INNER JOIN ecmstockdocinsideoutitems AS ii
INNER JOIN ecmproducts AS p ON ii.ecmproduct_id = p.id ON i.id = ii.ecmstockdocinsideout_id
INNER JOIN ecmstocks AS s ON i.stock_id = s.id AND ii.deleted = 0
LEFT JOIN ecmproductcategories_bean AS cb ON cb.bean_id COLLATE utf8_general_ci = p.id COLLATE utf8_general_ci INNER JOIN ecmproducts AS p
AND cb.bean_name = 'EcmProducts' ON ii.ecmproduct_id = p.id
AND p.deleted = 0
INNER JOIN ecmstocks AS s
ON i.stock_id = s.id
AND s.deleted = 0
LEFT JOIN (
SELECT
cb.bean_id AS product_id,
GROUP_CONCAT(DISTINCT c.name ORDER BY cb.position SEPARATOR ' | ') AS category
FROM ecmproductcategories_bean AS cb
INNER JOIN ecmproductcategories AS c
ON c.id = cb.ecmproductcategory_id
AND c.deleted = 0
WHERE cb.bean_name = 'EcmProducts'
AND cb.deleted = 0 AND cb.deleted = 0
LEFT JOIN ecmproductcategories AS c ON c.id = cb.ecmproductcategory_id GROUP BY cb.bean_id
WHERE YEAR(i.register_date) = 2025 ) AS pc
GROUP BY ON pc.product_id = p.id
i.document_no, WHERE i.deleted = 0
i.register_date, AND i.register_date BETWEEN '2025-01-01' AND '2025-12-31'
p.code,
p.name,
p.group_ks,
s.name,
ii.quantity
ORDER BY i.register_date DESC; ORDER BY i.register_date DESC;
", ",
'filename' => 'rw_2025.csv', 'filename' => 'rw_2025.csv',
@@ -462,32 +502,40 @@ SELECT
p.code, p.code,
p.name, p.name,
CASE p.group_ks CASE p.group_ks
WHEN 1 THEN 'Towar handlowy' WHEN '1' THEN 'Towar handlowy'
WHEN 2 THEN 'Wyrób gotowy' WHEN '2' THEN 'Wyrób gotowy'
WHEN 3 THEN 'Surowiec' WHEN '3' THEN 'Surowiec'
WHEN 4 THEN 'Usługa' WHEN '4' THEN 'Usługa'
ELSE 'Nieznane' ELSE 'Nieznane'
END AS group_ks, END AS group_ks_name,
GROUP_CONCAT(c.name ORDER BY cb.position SEPARATOR ' | ') AS category, pc.category,
s.name AS stock, s.name AS stock,
ii.quantity ii.quantity
FROM ecmstockdocinsideouts AS i FROM ecmstockdocinsideouts AS i
INNER JOIN ecmstockdocinsideoutitems AS ii ON i.id = ii.ecmstockdocinsideout_id INNER JOIN ecmstockdocinsideoutitems AS ii
INNER JOIN ecmproducts AS p ON ii.ecmproduct_id = p.id ON i.id = ii.ecmstockdocinsideout_id
INNER JOIN ecmstocks AS s ON i.stock_id = s.id AND ii.deleted = 0
LEFT JOIN ecmproductcategories_bean AS cb ON cb.bean_id COLLATE utf8_general_ci = p.id COLLATE utf8_general_ci INNER JOIN ecmproducts AS p
AND cb.bean_name = 'EcmProducts' ON ii.ecmproduct_id = p.id
AND p.deleted = 0
INNER JOIN ecmstocks AS s
ON i.stock_id = s.id
AND s.deleted = 0
LEFT JOIN (
SELECT
cb.bean_id AS product_id,
GROUP_CONCAT(DISTINCT c.name ORDER BY cb.position SEPARATOR ' | ') AS category
FROM ecmproductcategories_bean AS cb
INNER JOIN ecmproductcategories AS c
ON c.id = cb.ecmproductcategory_id
AND c.deleted = 0
WHERE cb.bean_name = 'EcmProducts'
AND cb.deleted = 0 AND cb.deleted = 0
LEFT JOIN ecmproductcategories AS c ON c.id = cb.ecmproductcategory_id GROUP BY cb.bean_id
WHERE YEAR(i.register_date) = 2024 ) AS pc
GROUP BY ON pc.product_id = p.id
i.document_no, WHERE i.deleted = 0
i.register_date, AND i.register_date BETWEEN '2024-01-01' AND '2024-12-31'
p.code,
p.name,
p.group_ks,
s.name,
ii.quantity
ORDER BY i.register_date DESC; ORDER BY i.register_date DESC;
", ",
'filename' => 'rw_2024.csv', 'filename' => 'rw_2024.csv',
@@ -497,13 +545,105 @@ ORDER BY i.register_date DESC;
SELECT SELECT
ss.product_code, ss.product_code,
ss.product_name, ss.product_name,
ss.product_id,
COALESCE(NULLIF(ss.quantity, ''), 0) AS quantity, COALESCE(NULLIF(ss.quantity, ''), 0) AS quantity,
s.name s.name,
CASE
WHEN s.id = 'c7afd71a-4c3a-bde4-138d-4acaee1644e4' THEN COALESCE(si.ordered_quantity, 0)
WHEN s.id = '368479db-22c5-0220-3a14-4bc426b1c709' THEN COALESCE(poi.ordered_quantity, 0)
ELSE 0
END AS ordered_quantity
FROM ecmstockstates AS ss FROM ecmstockstates AS ss
JOIN ecmstocks AS s ON ss.stock_id = s.id JOIN ecmstocks AS s
ORDER BY quantity + 0 DESC;", ON ss.stock_id = s.id
LEFT JOIN (
SELECT
i.ecmproduct_id,
SUM(i.quantity) AS ordered_quantity
FROM ecmsaleitems AS i
JOIN ecmsales AS es
ON es.id = i.ecmsale_id
WHERE es.status IN ('s20', 's30')
AND es.deleted = 0
AND i.deleted = 0
AND es.register_date >= '2025-06-01'
GROUP BY i.ecmproduct_id
) AS si
ON si.ecmproduct_id = ss.product_id
LEFT JOIN (
SELECT
poi.ecmproduct_id,
SUM(poi.quantity) AS ordered_quantity
FROM ecmpurchaseorderitems AS poi
JOIN ecmpurchaseorders AS po
ON po.id = poi.ecmpurchaseorder_id
WHERE po.status IN ('accepted', 'registered')
AND po.deleted = 0
AND poi.deleted = 0
AND po.register_date >= '2025-06-01'
GROUP BY poi.ecmproduct_id
) AS poi
ON poi.ecmproduct_id = ss.product_id
WHERE ss.stock_id IN ('c7afd71a-4c3a-bde4-138d-4acaee1644e4', '368479db-22c5-0220-3a14-4bc426b1c709')
ORDER BY quantity + 0 DESC;
",
'filename' => 'stocks.csv', 'filename' => 'stocks.csv',
],// stocks ],// stocks
[
'sql' => "
SELECT
i.code AS product_code,
i.name AS product_name,
i.quantity,
i.price_netto,
es.document_no,
es.parent_name,
CASE es.status
WHEN 's20' THEN 'Oczekujący'
WHEN 's30' THEN 'Zaakceptowany'
ELSE 'Nieznane'
END AS status,
es.register_date,
es.delivery_date,
es.send_date
FROM ecmsaleitems AS i
INNER JOIN ecmsales AS es
ON es.id = i.ecmsale_id
WHERE es.status IN ('s20','s30')
AND es.deleted = 0
AND i.deleted = 0
AND es.register_date >= '2025-06-01'
ORDER BY es.register_date DESC, es.document_no DESC, i.position;
",
'filename' => 'zs.csv',
], //sales
[
'sql' => "
SELECT
i.code AS product_code,
i.name AS product_name,
i.quantity,
i.price_start,
es.document_no,
es.parent_name,
CASE es.status
WHEN 'accepted' THEN 'Zaakceptowany'
WHEN 'registered' THEN 'Zarejestrowany'
ELSE 'Nieznane'
END AS status,
es.register_date,
es.delivery_date
FROM ecmpurchaseorderitems AS i
JOIN ecmpurchaseorders AS es
ON es.id = i.ecmpurchaseorder_id
WHERE es.status IN ('accepted','registered')
AND es.deleted = 0
AND i.deleted = 0
AND es.register_date >= '2025-06-01'
ORDER BY es.register_date DESC, es.document_no DESC, i.position;
",
'filename' => 'zz.csv',
], //orders
]; ];
$report = []; $report = [];
@@ -520,14 +660,13 @@ ORDER BY i.register_date DESC;
if ($result['ok']) { if ($result['ok']) {
$report[] = "OK → {$result['path']} (wiersze: {$result['rows']})" . PHP_EOL; $report[] = "OK → {$result['path']} (wiersze: {$result['rows']})" . PHP_EOL;
} else { } else {
$report[] = "ERR → {$result['path']} ({$result['error']})".PHP_EOL;; $report[] = "ERR → {$result['path']} ({$result['error']})" . PHP_EOL;
} }
} }
echo implode("\n", $report); echo implode("\n", $report);
exit; exit;
} }
}
function exportToCSVFile($res, $fullpath, array $headers = null, $delimiter = ';', $withBom = true) function exportToCSVFile($res, $fullpath, array $headers = null, $delimiter = ';', $withBom = true)
{ {
$db = $GLOBALS['db']; $db = $GLOBALS['db'];
@@ -574,14 +713,18 @@ function exportToCSVFile($res, $fullpath, array $headers = null, $delimiter = ';
// zapisz pierwszy wiersz w kolejności nagłówków // zapisz pierwszy wiersz w kolejności nagłówków
$line = []; $line = [];
foreach ($headers as $h) { $line[] = isset($first[$h]) ? $first[$h] : ''; } foreach ($headers as $h) {
$line[] = isset($first[$h]) ? $first[$h] : '';
}
fputcsv($fp, $line, $delimiter); fputcsv($fp, $line, $delimiter);
$count = 1; $count = 1;
// pozostałe wiersze // pozostałe wiersze
while ($row = $db->fetchByAssoc($res)) { while ($row = $db->fetchByAssoc($res)) {
$line = []; $line = [];
foreach ($headers as $h) { $line[] = isset($row[$h]) ? $row[$h] : ''; } foreach ($headers as $h) {
$line[] = isset($row[$h]) ? $row[$h] : '';
}
fputcsv($fp, $line, $delimiter); fputcsv($fp, $line, $delimiter);
$count++; $count++;
} }
@@ -590,3 +733,159 @@ function exportToCSVFile($res, $fullpath, array $headers = null, $delimiter = ';
$chmod_ok = @chmod($fullpath, 0664); $chmod_ok = @chmod($fullpath, 0664);
return ['ok' => true, 'path' => $fullpath, 'rows' => $count, 'chmod' => $chmod_ok, 'error' => null]; return ['ok' => true, 'path' => $fullpath, 'rows' => $count, 'chmod' => $chmod_ok, 'error' => null];
} }
function generateProductComponentsCSV()
{
$db = $GLOBALS['db'];
$exportDir = __DIR__ . "/export";
$filename = 'product_components.csv';
$fullpath = rtrim($exportDir, "/") . "/" . $filename;
if (!is_dir($exportDir)) {
if (!@mkdir($exportDir, 0775, true)) {
echo "Błąd: Nie mogę utworzyć katalogu: $exportDir";
return;
}
}
$productsWithComponents = $db->query("
SELECT DISTINCT p.id, p.code, p.name
FROM ecmproducts p
INNER JOIN ecmproductcomponents c ON p.id = c.ecmproduct_id
WHERE p.deleted = '0' AND c.deleted = '0' AND p.active = '1'
ORDER BY p.code
");
$fp = @fopen($fullpath, 'w');
if ($fp === false) {
echo "Błąd: Nie mogę otworzyć pliku do zapisu: $fullpath";
return;
}
fwrite($fp, "\xEF\xBB\xBF");
$headers = [
'Poziom_1_Kod', 'Poziom_1_Nazwa', 'Poziom_1_Ilosc',
'Poziom_2_Kod', 'Poziom_2_Nazwa', 'Poziom_2_Ilosc',
'Poziom_3_Kod', 'Poziom_3_Nazwa', 'Poziom_3_Ilosc',
'Poziom_4_Kod', 'Poziom_4_Nazwa', 'Poziom_4_Ilosc',
'Poziom_5_Kod', 'Poziom_5_Nazwa', 'Poziom_5_Ilosc',
'Poziom_6_Kod', 'Poziom_6_Nazwa', 'Poziom_6_Ilosc',
'Poziom_7_Kod', 'Poziom_7_Nazwa', 'Poziom_7_Ilosc',
'Poziom_8_Kod', 'Poziom_8_Nazwa', 'Poziom_8_Ilosc',
'Poziom_9_Kod', 'Poziom_9_Nazwa', 'Poziom_9_Ilosc',
'Poziom_10_Kod', 'Poziom_10_Nazwa', 'Poziom_10_Ilosc'
];
fputcsv($fp, $headers, ';');
$totalRows = 0;
while ($product = $db->fetchByAssoc($productsWithComponents)) {
$rows = generateComponentRows($product['id'], $product['code'], $product['name'], 1.0, [], $db);
foreach ($rows as $row) {
fputcsv($fp, $row, ';');
$totalRows++;
}
}
fclose($fp);
echo "Wygenerowano plik CSV: $fullpath (wiersze: $totalRows)";
}
function generateComponentRows($productId, $productCode, $productName, $quantity, $path, $db, $level = 1)
{
if (in_array($productId, array_column($path, 'id'))) {
return [];
}
if ($level > 10) {
return [];
}
$rows = [];
$currentPath = $path;
$currentPath[] = [
'id' => $productId,
'code' => $productCode,
'name' => $productName,
'quantity' => $quantity
];
$componentsQuery = $db->query("
SELECT
c.ecmcomponent_id,
c.quantity,
p.code,
p.name
FROM ecmproductcomponents c
INNER JOIN ecmproducts p ON c.ecmcomponent_id = p.id
WHERE c.ecmproduct_id = '$productId'
AND c.deleted = '0'
AND p.deleted = '0'
ORDER BY c.position, p.code
");
$hasComponents = false;
while ($component = $db->fetchByAssoc($componentsQuery)) {
$hasComponents = true;
// Oblicz rzeczywistą ilość komponentu (ilość z hierarchii wyżej * ilość komponentu)
$totalQuantity = bcmul($quantity, $component['quantity'], 6);
// Sprawdź czy komponent ma swoje komponenty (rekurencja)
$subRows = generateComponentRows(
$component['ecmcomponent_id'],
$component['code'],
$component['name'],
$totalQuantity,
$currentPath,
$db,
$level + 1
);
if (empty($subRows)) {
// Komponent nie ma pod-komponentów, dodaj wiersz z kompletną ścieżką
$row = createCSVRow($currentPath, $component['ecmcomponent_id'], $component['code'], $component['name'], $totalQuantity);
$rows[] = $row;
} else {
// Komponent ma pod-komponenty, dodaj wszystkie zwrócone wiersze
$rows = array_merge($rows, $subRows);
}
}
// Jeśli produkt nie ma komponentów i jesteśmy na poziomie > 1, zwróć pusty array
// (główny produkt zawsze musi być pokazany)
if (!$hasComponents && $level > 1) {
$row = createCSVRow($currentPath);
$rows[] = $row;
}
return $rows;
}
function createCSVRow($path, $lastComponentId = null, $lastComponentCode = null, $lastComponentName = null, $lastQuantity = null)
{
// Utwórz tablicę z 30 elementami (10 poziomów * 3 kolumny: kod, nazwa, ilość)
$row = array_fill(0, 30, '');
// Wypełnij ścieżkę
foreach ($path as $index => $item) {
if ($index < 10) { // Maksymalnie 10 poziomów
$row[$index * 3] = $item['code']; // Kod
$row[$index * 3 + 1] = $item['name']; // Nazwa
$row[$index * 3 + 2] = $item['quantity']; // Ilość
}
}
// Dodaj ostatni komponent jeśli został przekazany
if ($lastComponentId !== null && count($path) < 10) {
$lastIndex = count($path);
$row[$lastIndex * 3] = $lastComponentCode;
$row[$lastIndex * 3 + 1] = $lastComponentName;
$row[$lastIndex * 3 + 2] = $lastQuantity;
}
return $row;
}

View File

@@ -656,7 +656,8 @@ $viewdefs['EcmProducts']['DetailView'] = array(
'allCols' => true, 'allCols' => true,
'hideLabel' => true, 'hideLabel' => true,
'customCode' => '{$MOD.LBL_COMPONENTS}<br><div id="componentsTable"></div><br><br>{$MOD.LBL_ACTIONS}<div id="actionsTable"></div> 'customCode' => '{$MOD.LBL_COMPONENTS}<br><div id="componentsTable"></div><br><br>{$MOD.LBL_ACTIONS}<div id="actionsTable"></div>
<br><br><div id="summaryTable" style="width: 50%; padding-right: 0px;">Podsumowanie</div>' <br><br><div id="summaryTable" style="width: 50%; padding-right: 0px;">Podsumowanie</div>
<br><b>Receptura:</b> {$PRODUCTION_DESCRIPTION}'
) )
) )
), ),

View File

@@ -59,28 +59,29 @@ var EcmDropdownEditor_save = function(dom, container) {
return false; return false;
} }
var doms = EcmDropdownEditor_parseArrays(dom); var doms = EcmDropdownEditor_parseArrays(dom);
var params = new Array; var params = [];
params[0] = dom; //name of list params[0] = dom; //name of list
params[1] = doms;//list of values params[1] = doms;//list of values
// AJAX call // AJAX call
jQuery.ajax({ jQuery.ajax({
type : 'POST', type : "POST",
url : 'index.php?entryPoint=HandleEcmAjax', url : "index.php?entryPoint=HandleEcmAjax",
data : { data : {
ecmclass : 'EcmDropdownEditor', ecmclass : "EcmDropdownEditor",
job : 'saveDom', job : "saveDom",
params : utf8_to_b64(JSON.stringifyNoSecurity(params)), params : utf8_to_b64(JSON.stringifyNoSecurity(params)),
}, },
dataType : 'json', dataType : "json",
async : false, async : false,
success : function(response) { success : function() {
var div = $('[name='+container+']'); setTimeout(function() {
div.hide();
EcmDropdownEditor_refreshField(container); EcmDropdownEditor_refreshField(container);
return; var div = $("[name="+container+"]");
div.hide();
}, 3000);
}, },
error : function(xhr, ajaxOptions, thrownError) { error : function(xhr, ajaxOptions, thrownError) {
console.log(thrownError); window.console.log(thrownError);
} }
}); });
} }
@@ -94,16 +95,17 @@ var EcmDropdownEditor_refreshField = function(container) {
params[1] = container;//list of values params[1] = container;//list of values
// AJAX call // AJAX call
jQuery.ajax({ jQuery.ajax({
type : 'POST', type : "POST",
url : 'index.php?entryPoint=HandleEcmAjax', url : "index.php?entryPoint=HandleEcmAjax",
data : { data : {
ecmclass : 'EcmDropdownEditor', ecmclass : "EcmDropdownEditor",
job : 'refreshField', job : "refreshField",
params : utf8_to_b64(JSON.stringifyNoSecurity(params)), params : utf8_to_b64(JSON.stringifyNoSecurity(params)),
}, },
dataType : 'json', dataType : "json",
async : false, async : false,
success : function(response) { success : function(response) {
console.log('EditedDropdown', response);
var tmp = container.split("___"); var tmp = container.split("___");
$('form[name=EditView]').find('select[name='+tmp[0]+']').html(response[0]); $('form[name=EditView]').find('select[name='+tmp[0]+']').html(response[0]);
return; return;

125
include/language/en_us.EcmDropdownEditor.php Normal file → Executable file
View File

@@ -1,5 +1,5 @@
<?php <?php
// created: 2025-08-13 12:56:45 // created: 2025-11-06 11:08:29
$customDoms = array ( $customDoms = array (
'ecmproducts_attribute_dom' => 'ecmproducts_attribute_dom' =>
array ( array (
@@ -10,9 +10,8 @@ $customDoms = array (
'ecmproducts_shape_dom' => 'ecmproducts_shape_dom' =>
array ( array (
'8bc92e86-d956-0df2-e34c-656e0bc9da04' => 'None', '8bc92e86-d956-0df2-e34c-656e0bc9da04' => 'None',
'6db335cc-96d5-5185-6118-65761ec65583' => 'Liquid', '8112d0d3-baca-cd8a-3b00-6576321030cb' => 'Butelka IT_100 B1_100 ml',
'8112d0d3-baca-cd8a-3b00-6576321030cb' => 'Bottle B1_100ml', '1441313f-245d-dfe7-92dd-6576255579fb' => 'Butelka IT_250 B1_250 ml',
'1441313f-245d-dfe7-92dd-6576255579fb' => 'Bottle B1_250ml',
'c2beb683-dd0a-c76f-fd2f-6576252c68de' => 'Bottle B1_500ml', 'c2beb683-dd0a-c76f-fd2f-6576252c68de' => 'Bottle B1_500ml',
'8a4c1e7b-fb17-681d-a9dd-65762566ca64' => 'Bottle B1_1000ml', '8a4c1e7b-fb17-681d-a9dd-65762566ca64' => 'Bottle B1_1000ml',
'4d063e6a-9cf1-28f4-2e98-6576251a3e7f' => 'Tube standard', '4d063e6a-9cf1-28f4-2e98-6576251a3e7f' => 'Tube standard',
@@ -29,27 +28,29 @@ $customDoms = array (
'5048d070-7da8-a160-d0bd-659c6af595b4' => 'Kit 3in1', '5048d070-7da8-a160-d0bd-659c6af595b4' => 'Kit 3in1',
'a1d41637-21c8-60e7-dfeb-65973bb8bc04' => 'Kit 4in1', 'a1d41637-21c8-60e7-dfeb-65973bb8bc04' => 'Kit 4in1',
'e47359f6-5f25-4d4b-c472-65b77152ae8a' => 'Kit 5in1', 'e47359f6-5f25-4d4b-c472-65b77152ae8a' => 'Kit 5in1',
'cd43ef35-031a-ce97-3d1c-65f41563046f' => 'Bottle D11_50ml (RPET)', '58664d9d-0295-3539-4662-659f18dc4b80' => 'Butelka OD_1000 D21_1000 ml',
'b78c2842-b4f8-ad77-e7ea-65f41571c57e' => 'Bottle D11_250ml (RPET)', '9b883933-6bb0-cc85-29b0-659f03d60a98' => 'Butelka OD 500 ml',
'901babfa-3d95-3a98-8dbf-659f00f4f91e' => 'Bottle D21_250ml', '901babfa-3d95-3a98-8dbf-659f00f4f91e' => 'Butelka OD 250 ml',
'62ea70ee-d2cc-e68b-d51b-661670a10c98' => 'Bottle D21_250ml ', '62ea70ee-d2cc-e68b-d51b-661670a10c98' => 'Butelka OD 250 ml NW',
'c10933f2-62ce-cfb2-52b1-659f1f2b9e4a' => 'B D22_250ml (szyjka)', '855e5265-8d2d-4682-8e4c-659f1d1ead09' => 'Butelka ZMW_250 ml (zmywarka)',
'855e5265-8d2d-4682-8e4c-659f1d1ead09' => 'Bottle D23_250ml', '90053c7e-98fb-873e-b414-659f1bc748cc' => 'Butelka DYW_500 ml',
'e3a77ebf-9ba1-3776-3d80-67a9e325c268' => 'Bottle D24 250 ml (Ula)', '307f61db-5fd9-3aa6-e701-65a04f4bba88' => 'Butelka NAB 500 ml (nabłyszczacz)',
'359d7556-f107-92de-4121-659f1eafeb90' => 'B D11_500ml (RPET)', 'cd43ef35-031a-ce97-3d1c-65f41563046f' => 'Butelka Boston 50 ml ',
'90053c7e-98fb-873e-b414-659f1bc748cc' => 'Bottle D12_500ml', 'b78c2842-b4f8-ad77-e7ea-65f41571c57e' => 'Butelka Boston 250ml ',
'9b883933-6bb0-cc85-29b0-659f03d60a98' => 'Bottle D21_500ml', '359d7556-f107-92de-4121-659f1eafeb90' => 'Butelka Boston 500ml ',
'8f4fdd3c-44f9-103b-3f40-659f1c128319' => 'Bottle D22_500ml', 'd7c10cb9-7459-1174-6315-661cdae38a39' => 'Butelka Boston 1000 ml',
'307f61db-5fd9-3aa6-e701-65a04f4bba88' => 'B D23_500ml (nabłyszczacz)', 'c10933f2-62ce-cfb2-52b1-659f1f2b9e4a' => 'Butelka DET 250 ml',
'5df47246-d0cd-4151-9bdd-65eede53aba5' => 'B D24_500ml (systemy mleczne)', '8f4fdd3c-44f9-103b-3f40-659f1c128319' => 'Butelka DET_500 (szyjka) ',
'ab74cd2c-7720-5875-7ca5-66bb55a3e075' => 'Bottle D25_500ml (Ula)', '92a7ee9b-d953-fd7e-5c88-65c9bf1e144d' => 'Butelka DET 1000 ml (szyjka)',
'd7c10cb9-7459-1174-6315-661cdae38a39' => 'D11_1000ml', '5df47246-d0cd-4151-9bdd-65eede53aba5' => 'Butelka SML_500 ml (systemy mleczne)',
'58664d9d-0295-3539-4662-659f18dc4b80' => 'Bottle', '87a2b609-9b67-de82-8f41-65eedd4613c9' => 'Butelka SML_1000 ml (systemy mleczne)',
'92a7ee9b-d953-fd7e-5c88-65c9bf1e144d' => 'B D22_1000ml (szyjka)', '75980ea5-d89e-3923-2662-66bb55202244' => 'Butelka ULA 1000 ml',
'87a2b609-9b67-de82-8f41-65eedd4613c9' => 'D23_1000ml (systemy mleczne)', 'ab74cd2c-7720-5875-7ca5-66bb55a3e075' => 'Butelka ULA 500 ml',
'75980ea5-d89e-3923-2662-66bb55202244' => 'D24_1000ml (Ula)', 'e3a77ebf-9ba1-3776-3d80-67a9e325c268' => 'Butelka ULA 250 ml ',
'ba4f06a8-f6fb-4969-d4b9-6683e6b6b372' => 'D11_2000ml ', '881d099d-36ee-3b45-b1ab-68dd2becfe84' => 'Butelka Irys 150 ml',
'cb8f5e45-43e1-b62d-05d7-669646b4eb10' => 'Bottle D12_5000ml (kanister)', 'ba4f06a8-f6fb-4969-d4b9-6683e6b6b372' => 'Butelka PDP_2000 ml ',
'a2ba9b76-8e2e-32c4-e9c8-689c6ac2dbb9' => 'Bottle 30 ml N-34B plastan',
'cb8f5e45-43e1-b62d-05d7-669646b4eb10' => 'Kanister 5000 ml',
'820341fa-0db5-9d74-7544-659f17560658' => 'Kit ', '820341fa-0db5-9d74-7544-659f17560658' => 'Kit ',
'567da064-cd31-0416-2ad3-6581cc870e96' => 'Doypack 110x180mm', '567da064-cd31-0416-2ad3-6581cc870e96' => 'Doypack 110x180mm',
'edf38614-90c3-50a7-56e8-65dda2d891c2' => 'Doypack 130x220mm', 'edf38614-90c3-50a7-56e8-65dda2d891c2' => 'Doypack 130x220mm',
@@ -57,32 +58,33 @@ $customDoms = array (
'2e060602-334b-d053-6bd4-65a9a3d7a99b' => 'Doypack 180x290mm', '2e060602-334b-d053-6bd4-65a9a3d7a99b' => 'Doypack 180x290mm',
'eb0cb757-d39b-9677-b422-65eec426d4fe' => 'Blister tablets 6pcs 2,5g', 'eb0cb757-d39b-9677-b422-65eec426d4fe' => 'Blister tablets 6pcs 2,5g',
'64716544-e41f-3dfc-d021-657630c2bafe' => 'Blister tablets 10pcs 3g', '64716544-e41f-3dfc-d021-657630c2bafe' => 'Blister tablets 10pcs 3g',
'32d6dac9-321d-a935-6e1b-659f012eabd1' => 'Blister tablets 10pcs 1,3g', '32d6dac9-321d-a935-6e1b-659f012eabd1' => 'Blister tablets 16 mm 10pcs 1,3g',
'225115e4-1ce2-9a98-b7a0-672930e3318c' => 'Blister tabletki 10szt. 2 g',
'c1477582-33b9-529d-bdd2-685250fc18d4' => 'Blister tablets 6pcs 25 mm 6,5g',
'ce7793b9-3f5a-3f5f-13dc-66013c397db1' => 'Blister microfiber 20x20cm', 'ce7793b9-3f5a-3f5f-13dc-66013c397db1' => 'Blister microfiber 20x20cm',
'48369f61-18bd-53e6-070a-659f026773ac' => 'Box',
'37dbeaa1-f183-3b3e-1b54-65aa78a662a2' => 'Jar 500 ml',
'f13d7541-494d-75c7-2a35-65aa784b42a5' => 'Jar 1000 ml',
'e703a7f9-d27d-b445-d946-66727a3940d9' => 'Jar 1500 ml',
'da8d7be4-58dc-4f75-f547-65c310cd97dd' => 'Jar 65 ml', 'da8d7be4-58dc-4f75-f547-65c310cd97dd' => 'Jar 65 ml',
'e1a16dbf-7216-d184-b9ed-65c310aff4d4' => 'Jar 150 ml', 'e1a16dbf-7216-d184-b9ed-65c310aff4d4' => 'Jar 150 ml',
'2a9454a6-b2a1-150f-c307-65c31102cb28' => 'Jar 250 ml', '2a9454a6-b2a1-150f-c307-65c31102cb28' => 'Jar 250 ml',
'3acd80de-8dcc-ced9-c2fa-65eee6ae9949' => 'Spray 100 ml',
'6014bd30-9be6-4348-5b3a-6603f015f392' => 'Bucket 2,75l',
'786f48d6-16e7-a0a4-4aec-6628a16a0f89' => 'Foam 100ml',
'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',
'e6900d92-6fde-90e6-b872-67d1938745e6' => 'Słoik 400 ml', 'e6900d92-6fde-90e6-b872-67d1938745e6' => 'Słoik 400 ml',
'e3e0c9da-6d08-e1e0-b9ba-67eaa437cb84' => 'Bottle B1_30ml', 'e3e0c9da-6d08-e1e0-b9ba-67eaa437cb84' => 'Bottle B1_30ml',
'37dbeaa1-f183-3b3e-1b54-65aa78a662a2' => 'Jar 500 ml',
'f13d7541-494d-75c7-2a35-65aa784b42a5' => 'Słoik 1000 ml',
'e703a7f9-d27d-b445-d946-66727a3940d9' => 'Słoik 1500 ml',
'3acd80de-8dcc-ced9-c2fa-65eee6ae9949' => 'Spray 100 ml',
'786f48d6-16e7-a0a4-4aec-6628a16a0f89' => 'Foam 100ml',
'75f4bd2a-51a8-0767-635e-66dde15af79e' => 'Foam 200ml',
'349b50d1-0a7b-b3bd-e72e-662b42ca98ae' => 'Foam 400ml',
'cb66a685-53e1-5f87-0a25-66967c7cb63b' => 'Doypack 210x285mm',
'6014bd30-9be6-4348-5b3a-6603f015f392' => 'Bucket 2,75l',
'48369f61-18bd-53e6-070a-659f026773ac' => 'Box',
'8bcf43bf-7b49-5dbf-6b86-67f6c12b82d7' => 'Softpack', '8bcf43bf-7b49-5dbf-6b86-67f6c12b82d7' => 'Softpack',
'6db335cc-96d5-5185-6118-65761ec65583' => 'Liquid',
'd40c7d30-77bd-1f65-be9c-681142c7daf5' => 'LCD Liquid', 'd40c7d30-77bd-1f65-be9c-681142c7daf5' => 'LCD Liquid',
'1b7d6313-d7d4-4529-73d4-684a6d5ddde3' => 'Cellophane Bag',
'47fbe61c-20f4-5d48-118c-6851105ddc97' => 'Tablet',
'c1477582-33b9-529d-bdd2-685250fc18d4' => 'Blister tablets 6pcs 6,5g',
'31bf91c9-6176-a27a-9a4e-686f6b2597ee' => 'Liquid', '31bf91c9-6176-a27a-9a4e-686f6b2597ee' => 'Liquid',
'47fbe61c-20f4-5d48-118c-6851105ddc97' => 'Tablet',
'27c00505-f6cf-3ef1-3c1d-6880847a5893' => 'Powder', '27c00505-f6cf-3ef1-3c1d-6880847a5893' => 'Powder',
'a2ba9b76-8e2e-32c4-e9c8-689c6ac2dbb9' => 'Bottle 30 ml N-34B plastan', '1b7d6313-d7d4-4529-73d4-684a6d5ddde3' => 'Cellophane Bag',
'40eb0d63-517e-345c-532d-68d37d215372' => 'Sachet',
), ),
'ecmproducts_brand_dom' => 'ecmproducts_brand_dom' =>
array ( array (
@@ -177,6 +179,12 @@ $customDoms = array (
'11095313-0dd0-aa9b-df3a-682739877d33' => 'Coffix', '11095313-0dd0-aa9b-df3a-682739877d33' => 'Coffix',
'd97b870b-86a1-1970-9cea-68527ecc5ad9' => 'Zenevo', 'd97b870b-86a1-1970-9cea-68527ecc5ad9' => 'Zenevo',
'c709e4cf-9ca7-c946-f5e3-688202ec4c24' => 'Aspico', 'c709e4cf-9ca7-c946-f5e3-688202ec4c24' => 'Aspico',
'8bf5f833-51a9-3913-aa0a-68b6d539a1b5' => 'MediaShop',
'973ff617-4696-1a21-1ba3-68c2c008e079' => 'Severno',
'd6f1a2c9-58ea-707f-112f-68cba0dcf990' => 'Safelt',
'2f1cc2a6-7fe7-4848-b7e9-68cd307ec67f' => 'CleanFix',
'261451a0-d1fb-546b-28e4-68e3bb7fdde9' => 'Alarsa',
'd3f20145-cd52-0c92-bb81-690c81cba13e' => 'Hisense',
), ),
'ecmproducts_category_dom' => 'ecmproducts_category_dom' =>
array ( array (
@@ -228,13 +236,33 @@ $customDoms = array (
), ),
'ecmactions_category_dom' => 'ecmactions_category_dom' =>
array ( array (
'dd4ddbad-c949-0ee5-fb73-54cb9b6c86ef' => 'Filling Capping Labeling', 'dd4ddbad-c949-0ee5-fb73-54cb9b6c86ef' => 'None',
'8519dfc8-5eec-0233-7f84-54d1fe00e9fc' => 'Sets', '5d843f39-893f-51f8-3df5-68c86f1d41c3' => 'HP1',
'55020d96-73d5-7b29-3bab-654f4818e0cd' => 'Liquid Mixing', '31174829-986e-4d7f-4262-68b2e73742e9' => 'HP2',
'9bc2bafc-0608-7bc7-468b-686a94772424' => 'Bisters', '8519dfc8-5eec-0233-7f84-54d1fe00e9fc' => 'Pakowalnia 1 Hala 1',
'be37016b-0aa4-678c-9c4a-689c3673af3e' => 'Packing Blisters Into Packaging', '2bdf9315-5c31-778d-4922-68c86f4af827' => 'Pakowalnia 2 Hala 1',
'e3e16e03-8e62-624e-f954-689c37059997' => 'Packing Tablets Into Jars', '55020d96-73d5-7b29-3bab-654f4818e0cd' => 'Mieszalnia Hala 1',
'416a2b50-4979-bc35-c83c-689c8a6640ae' => 'Packing into tubes', 'de2448f8-45ac-6b2a-f2b1-68b2e7e40a6f' => 'Mieszalnik1 Hala 2',
'9bc2bafc-0608-7bc7-468b-686a94772424' => 'BL1',
'347509e3-fff6-4db9-761e-68b2e36436c6' => 'LNE1',
'26c3b7fa-e1ac-66d9-517b-68b2e4c6cae8' => 'LNE2',
'5664a1b1-42dc-2bb8-ad24-68b2e52df143' => 'LNE3',
'307b8935-5235-628f-aac1-68b2e56d3f4d' => 'LNE4',
'8d68df07-0779-5a23-aaf3-68b2e5d72a46' => 'LNE5',
'53d9cae1-1ec5-71e4-5a3c-68b2e77b6d92' => 'MDC5',
'3fea0360-a9d8-93fc-1984-68b2e89e4ec8' => 'FPH9',
'6159a89b-219c-bb4e-1505-68b2e9da1b7c' => 'LNEZ7',
'9bc005d7-5222-3d65-b754-68b2e9854af7' => 'LE10',
'b1176c04-4fe3-d347-9e3a-68b2e945b5c3' => 'FPH1',
'bc4422dc-8f80-4f54-26a6-68b2ea0cd2c0' => 'LNEZ8',
'd8208a7e-b810-91e5-ccfa-68b2eaa73abb' => 'LNAS1',
'a87e1b10-771d-2f24-e795-68d385f0cd35' => 'LNAS2',
'f2364990-b244-064d-b5d1-68b2ebcd0ded' => 'MDC6',
'cc4905b6-a791-5c57-4721-68b2eb29e0fe' => 'TAB1',
'40e8149a-40ec-aeb0-4cdd-68b2eb52634b' => 'TAB2',
'b64ca8db-ff88-082c-887c-68b2ec98c15d' => 'TAB3',
'dab10a8b-295a-8eeb-be7c-68c67ec66ff7' => 'TAB4',
'640aea22-b0c0-fd36-1ed4-68cac4262fe8' => 'LT1',
), ),
'payment_method_dom' => 'payment_method_dom' =>
array ( array (
@@ -321,6 +349,7 @@ $customDoms = array (
'end_of_line' => 'Non Active', 'end_of_line' => 'Non Active',
'active' => 'Active', 'active' => 'Active',
'new' => 'New', 'new' => 'New',
'e8d1191e-2c7b-c24d-88e2-68b2bd076498' => 'test',
), ),
'ecmsales_status_dom' => 'ecmsales_status_dom' =>
array ( array (

153
include/language/pl_pl.EcmDropdownEditor.php Normal file → Executable file
View File

@@ -1,5 +1,5 @@
<?php <?php
// created: 2025-08-13 12:56:45 // created: 2025-11-06 11:08:29
$customDoms = array ( $customDoms = array (
'ecmproducts_attribute_dom' => 'ecmproducts_attribute_dom' =>
array ( array (
@@ -10,79 +10,81 @@ $customDoms = array (
'ecmproducts_shape_dom' => 'ecmproducts_shape_dom' =>
array ( array (
'8bc92e86-d956-0df2-e34c-656e0bc9da04' => 'None', '8bc92e86-d956-0df2-e34c-656e0bc9da04' => 'None',
'6db335cc-96d5-5185-6118-65761ec65583' => 'Płyn', '8112d0d3-baca-cd8a-3b00-6576321030cb' => 'BT_IT_100',
'8112d0d3-baca-cd8a-3b00-6576321030cb' => 'Butelka B1_100ml', '1441313f-245d-dfe7-92dd-6576255579fb' => 'BT_IT_250',
'1441313f-245d-dfe7-92dd-6576255579fb' => 'Butelka B1_250ml', 'c2beb683-dd0a-c76f-fd2f-6576252c68de' => 'BT_IT_500',
'c2beb683-dd0a-c76f-fd2f-6576252c68de' => 'Butelka B1_500ml', '8a4c1e7b-fb17-681d-a9dd-65762566ca64' => 'BT_IT_1000',
'8a4c1e7b-fb17-681d-a9dd-65762566ca64' => 'Butelka B1_1000ml', '4d063e6a-9cf1-28f4-2e98-6576251a3e7f' => 'TUBA_STD',
'4d063e6a-9cf1-28f4-2e98-6576251a3e7f' => 'Tuba standardowa', 'be48f1f6-5b67-2c78-cbdf-657625fe8bb1' => 'TUBA_MALA',
'be48f1f6-5b67-2c78-cbdf-657625fe8bb1' => 'Tuba mała', 'dfc6637e-c6d5-a435-1d41-657625555443' => 'TUBA_MEGA',
'dfc6637e-c6d5-a435-1d41-657625555443' => 'Tuba mega', '770e7d85-03ee-0052-6098-6576258cbe49' => 'TUBA_WYS',
'770e7d85-03ee-0052-6098-6576258cbe49' => 'Tuba wysoka',
'81dcdf2f-a598-a18c-0a3c-65a8b1cd5a9f' => 'Gaz 200 ml', '81dcdf2f-a598-a18c-0a3c-65a8b1cd5a9f' => 'Gaz 200 ml',
'796e726e-3e33-3481-5b09-6576331c5014' => 'Gaz 400ml', '796e726e-3e33-3481-5b09-6576331c5014' => 'Gaz 400ml',
'64e3dd7a-306d-a31d-c060-658532cbb2b4' => 'Gaz 600ml', '64e3dd7a-306d-a31d-c060-658532cbb2b4' => 'Gaz 600ml',
'905ceee4-8ef5-aa39-2a8b-659f0dcffa8b' => 'Zestaw 2w1 B1_100ml + m20x20 ', '905ceee4-8ef5-aa39-2a8b-659f0dcffa8b' => 'Zestaw 2w1 B1_100ml + m20x20 ',
'6dd408f0-129f-96de-b745-659f1009426c' => 'Zestaw 2w1 B1_250ml+m20x20 ', '6dd408f0-129f-96de-b745-659f1009426c' => 'Zestaw 2w1 B1_250ml+m20x20 ',
'be0f875a-3f01-f042-0eba-6576337e17bd' => 'Zestaw 2w1 B1_500ml+m30x30', 'be0f875a-3f01-f042-0eba-6576337e17bd' => 'Zestaw 2w1 B1_500ml+m30x30',
'5f76c0b4-261f-8883-4b88-662238c487e0' => 'Zestaw 2w1', '5f76c0b4-261f-8883-4b88-662238c487e0' => 'ZES_2_1',
'5048d070-7da8-a160-d0bd-659c6af595b4' => 'Zestaw 3w1', '5048d070-7da8-a160-d0bd-659c6af595b4' => 'ZES_3_1',
'a1d41637-21c8-60e7-dfeb-65973bb8bc04' => 'Zestaw 4w1', 'a1d41637-21c8-60e7-dfeb-65973bb8bc04' => 'ZES_4_1',
'e47359f6-5f25-4d4b-c472-65b77152ae8a' => 'Zestaw 5w1', 'e47359f6-5f25-4d4b-c472-65b77152ae8a' => 'ZES_5_1',
'cd43ef35-031a-ce97-3d1c-65f41563046f' => 'Butelka D11_50ml (RPET)', '58664d9d-0295-3539-4662-659f18dc4b80' => 'BT_OD_1000 (Odkamieniacz)',
'b78c2842-b4f8-ad77-e7ea-65f41571c57e' => 'Butelka D11_250ml (RPET)', '9b883933-6bb0-cc85-29b0-659f03d60a98' => 'BT_OD_500 (Odkamieniacz)',
'901babfa-3d95-3a98-8dbf-659f00f4f91e' => 'Butelka D21_250ml (Odkamieniacz)', '901babfa-3d95-3a98-8dbf-659f00f4f91e' => 'BT_OD_250 (Odkamieniacz)',
'62ea70ee-d2cc-e68b-d51b-661670a10c98' => 'Butelka D21_250ml_new (Odkamieniacz)', '62ea70ee-d2cc-e68b-d51b-661670a10c98' => 'BT_OD_250_NW (Odkamieniacz)',
'c10933f2-62ce-cfb2-52b1-659f1f2b9e4a' => 'Butelka D22_250ml (szyjka)', '855e5265-8d2d-4682-8e4c-659f1d1ead09' => 'BT_ZMW_250 (zmywarka)',
'855e5265-8d2d-4682-8e4c-659f1d1ead09' => 'Butelka D23_250ml (Zmywarka)', '90053c7e-98fb-873e-b414-659f1bc748cc' => 'BT_DYW_500 (Dywan)',
'e3a77ebf-9ba1-3776-3d80-67a9e325c268' => 'Butelka D24 250 ml (Ula)', '307f61db-5fd9-3aa6-e701-65a04f4bba88' => 'BT_NAB_500 (nabłyszczacz)',
'359d7556-f107-92de-4121-659f1eafeb90' => 'Butelka D11_500ml (RPET)', 'cd43ef35-031a-ce97-3d1c-65f41563046f' => 'BT_BOS_050',
'90053c7e-98fb-873e-b414-659f1bc748cc' => 'Butelka D12_500ml (Dywan)', 'b78c2842-b4f8-ad77-e7ea-65f41571c57e' => 'BT_BOS_250',
'9b883933-6bb0-cc85-29b0-659f03d60a98' => 'Butelka D21_500ml (Odkamieniacz)', '359d7556-f107-92de-4121-659f1eafeb90' => 'BT_BOS_500 ',
'8f4fdd3c-44f9-103b-3f40-659f1c128319' => 'Butelka D22_500ml (szyjka)', 'd7c10cb9-7459-1174-6315-661cdae38a39' => 'BT_BOS_1000 ',
'307f61db-5fd9-3aa6-e701-65a04f4bba88' => 'Butelka D23_500ml (nabłyszczacz)', 'c10933f2-62ce-cfb2-52b1-659f1f2b9e4a' => 'BT_DET_250 (szyjka)',
'5df47246-d0cd-4151-9bdd-65eede53aba5' => 'Butelka D24_500ml (systemy mleczne)', '8f4fdd3c-44f9-103b-3f40-659f1c128319' => 'BT_DET_500 (szyjka)',
'ab74cd2c-7720-5875-7ca5-66bb55a3e075' => 'Butelka D25_500ml (Ula)', '92a7ee9b-d953-fd7e-5c88-65c9bf1e144d' => 'BT_DET_1000 (szyjka)',
'd7c10cb9-7459-1174-6315-661cdae38a39' => 'Butelka D11_1000ml (RPET)', '5df47246-d0cd-4151-9bdd-65eede53aba5' => 'BT_SML_500 (sys. mleczne)',
'58664d9d-0295-3539-4662-659f18dc4b80' => 'Butelka D21_1000ml (Odkamieniacz)', '87a2b609-9b67-de82-8f41-65eedd4613c9' => 'BT_SML_1000 (sys. mleczne)',
'92a7ee9b-d953-fd7e-5c88-65c9bf1e144d' => 'Butelka D22_1000ml (szyjka)', '75980ea5-d89e-3923-2662-66bb55202244' => 'BT_ULA_1000',
'87a2b609-9b67-de82-8f41-65eedd4613c9' => 'Butelka D23_1000ml (systemy mleczne)', 'ab74cd2c-7720-5875-7ca5-66bb55a3e075' => 'BT_ULA_500',
'75980ea5-d89e-3923-2662-66bb55202244' => 'Butelka D24_1000ml (Ula)', 'e3a77ebf-9ba1-3776-3d80-67a9e325c268' => 'BT_ULA_250',
'ba4f06a8-f6fb-4969-d4b9-6683e6b6b372' => 'Butelka D11_2000ml (płyn do prania)', '881d099d-36ee-3b45-b1ab-68dd2becfe84' => 'BT_IRYS_150',
'cb8f5e45-43e1-b62d-05d7-669646b4eb10' => 'Butelka D12_5000ml (kanister)', 'ba4f06a8-f6fb-4969-d4b9-6683e6b6b372' => 'BT_PDP_2000ml (płyn do prania)',
'a2ba9b76-8e2e-32c4-e9c8-689c6ac2dbb9' => 'Butelka 30 ml N-34B plastan',
'cb8f5e45-43e1-b62d-05d7-669646b4eb10' => 'KAN_5000 (kanister)',
'820341fa-0db5-9d74-7544-659f17560658' => 'Zestaw D1_500ml+zapas', '820341fa-0db5-9d74-7544-659f17560658' => 'Zestaw D1_500ml+zapas',
'567da064-cd31-0416-2ad3-6581cc870e96' => 'Doypack 110x180mm', '567da064-cd31-0416-2ad3-6581cc870e96' => 'Doypack 110x180mm',
'edf38614-90c3-50a7-56e8-65dda2d891c2' => 'Doypack 130x220mm', 'edf38614-90c3-50a7-56e8-65dda2d891c2' => 'Doypack 130x220mm',
'1ba1af85-97c7-a0a9-82e4-65a9a265358a' => 'Doypack 160x270mm', '1ba1af85-97c7-a0a9-82e4-65a9a265358a' => 'Doypack 160x270mm',
'2e060602-334b-d053-6bd4-65a9a3d7a99b' => 'Doypack 180x290mm', '2e060602-334b-d053-6bd4-65a9a3d7a99b' => 'Doypack 180x290mm',
'eb0cb757-d39b-9677-b422-65eec426d4fe' => 'Blister, tabletki 6szt. 2,5g', 'eb0cb757-d39b-9677-b422-65eec426d4fe' => 'BLIS_6 (2,5g)',
'64716544-e41f-3dfc-d021-657630c2bafe' => 'Blister tabletki 10szt. 3g', '64716544-e41f-3dfc-d021-657630c2bafe' => 'BLIS_10 (3g)',
'32d6dac9-321d-a935-6e1b-659f012eabd1' => 'Blister tabletki 10szt. 1,3g', '32d6dac9-321d-a935-6e1b-659f012eabd1' => 'BLIS_10 (1,3g)',
'ce7793b9-3f5a-3f5f-13dc-66013c397db1' => 'Blister mikrofibra 20x20cm', '225115e4-1ce2-9a98-b7a0-672930e3318c' => 'BLIS_10 (2g)',
'48369f61-18bd-53e6-070a-659f026773ac' => 'Kartonik ', 'c1477582-33b9-529d-bdd2-685250fc18d4' => 'BLIS_6 (6,5g)',
'37dbeaa1-f183-3b3e-1b54-65aa78a662a2' => 'Słoik 500 ml', 'ce7793b9-3f5a-3f5f-13dc-66013c397db1' => 'BLIS_mikrofibra (20x20cm)',
'f13d7541-494d-75c7-2a35-65aa784b42a5' => 'Słoik 1000 ml', 'da8d7be4-58dc-4f75-f547-65c310cd97dd' => 'SLO_65',
'e703a7f9-d27d-b445-d946-66727a3940d9' => 'Słoik 1500 ml', 'e1a16dbf-7216-d184-b9ed-65c310aff4d4' => 'SLO_150',
'da8d7be4-58dc-4f75-f547-65c310cd97dd' => 'Słoik 65 ml', '2a9454a6-b2a1-150f-c307-65c31102cb28' => 'SLO_250',
'e1a16dbf-7216-d184-b9ed-65c310aff4d4' => 'Słoik 150 ml', 'e6900d92-6fde-90e6-b872-67d1938745e6' => 'SLO_400',
'2a9454a6-b2a1-150f-c307-65c31102cb28' => 'Słoik 250 ml', 'e3e0c9da-6d08-e1e0-b9ba-67eaa437cb84' => 'BT_IT_30',
'37dbeaa1-f183-3b3e-1b54-65aa78a662a2' => 'SLO_500',
'f13d7541-494d-75c7-2a35-65aa784b42a5' => 'SLO_1000 ml ',
'e703a7f9-d27d-b445-d946-66727a3940d9' => 'SLO_1500',
'3acd80de-8dcc-ced9-c2fa-65eee6ae9949' => 'Spray 100 ml', '3acd80de-8dcc-ced9-c2fa-65eee6ae9949' => 'Spray 100 ml',
'6014bd30-9be6-4348-5b3a-6603f015f392' => 'Wiadro 2,75l',
'786f48d6-16e7-a0a4-4aec-6628a16a0f89' => 'Pianka 100ml', '786f48d6-16e7-a0a4-4aec-6628a16a0f89' => 'Pianka 100ml',
'75f4bd2a-51a8-0767-635e-66dde15af79e' => 'Pianka 200ml',
'349b50d1-0a7b-b3bd-e72e-662b42ca98ae' => 'Pianka 400ml', '349b50d1-0a7b-b3bd-e72e-662b42ca98ae' => 'Pianka 400ml',
'cb66a685-53e1-5f87-0a25-66967c7cb63b' => 'Doypack 210x285mm', 'cb66a685-53e1-5f87-0a25-66967c7cb63b' => 'Doypack 210x285mm',
'75f4bd2a-51a8-0767-635e-66dde15af79e' => 'Pianka 200ml', '6014bd30-9be6-4348-5b3a-6603f015f392' => 'Wiadro 2,75l',
'225115e4-1ce2-9a98-b7a0-672930e3318c' => 'Blister tabletki 10szt. 2 g', '48369f61-18bd-53e6-070a-659f026773ac' => 'Kartonik ',
'e6900d92-6fde-90e6-b872-67d1938745e6' => 'Słoik 400 ml',
'e3e0c9da-6d08-e1e0-b9ba-67eaa437cb84' => 'Butelka B1_30ml',
'8bcf43bf-7b49-5dbf-6b86-67f6c12b82d7' => 'Softpack', '8bcf43bf-7b49-5dbf-6b86-67f6c12b82d7' => 'Softpack',
'6db335cc-96d5-5185-6118-65761ec65583' => 'Płyn',
'd40c7d30-77bd-1f65-be9c-681142c7daf5' => 'Płyn LCD', 'd40c7d30-77bd-1f65-be9c-681142c7daf5' => 'Płyn LCD',
'1b7d6313-d7d4-4529-73d4-684a6d5ddde3' => 'Woreczek celofanowy',
'47fbe61c-20f4-5d48-118c-6851105ddc97' => 'Tabletka',
'c1477582-33b9-529d-bdd2-685250fc18d4' => 'Blister, tabletki 6szt. 6,5g',
'31bf91c9-6176-a27a-9a4e-686f6b2597ee' => 'Płyn_WOD', '31bf91c9-6176-a27a-9a4e-686f6b2597ee' => 'Płyn_WOD',
'47fbe61c-20f4-5d48-118c-6851105ddc97' => 'Tabletka',
'27c00505-f6cf-3ef1-3c1d-6880847a5893' => 'Proszek', '27c00505-f6cf-3ef1-3c1d-6880847a5893' => 'Proszek',
'a2ba9b76-8e2e-32c4-e9c8-689c6ac2dbb9' => 'Butelka 30 ml N-34B plastan', '1b7d6313-d7d4-4529-73d4-684a6d5ddde3' => 'Woreczek celofanowy',
'40eb0d63-517e-345c-532d-68d37d215372' => 'Sachet',
), ),
'ecmproducts_brand_dom' => 'ecmproducts_brand_dom' =>
array ( array (
@@ -177,6 +179,12 @@ $customDoms = array (
'11095313-0dd0-aa9b-df3a-682739877d33' => 'Coffix', '11095313-0dd0-aa9b-df3a-682739877d33' => 'Coffix',
'd97b870b-86a1-1970-9cea-68527ecc5ad9' => 'Zenevo', 'd97b870b-86a1-1970-9cea-68527ecc5ad9' => 'Zenevo',
'c709e4cf-9ca7-c946-f5e3-688202ec4c24' => 'Aspico', 'c709e4cf-9ca7-c946-f5e3-688202ec4c24' => 'Aspico',
'8bf5f833-51a9-3913-aa0a-68b6d539a1b5' => 'MediaShop',
'973ff617-4696-1a21-1ba3-68c2c008e079' => 'Severno',
'd6f1a2c9-58ea-707f-112f-68cba0dcf990' => 'Safelt',
'2f1cc2a6-7fe7-4848-b7e9-68cd307ec67f' => 'CleanFix',
'261451a0-d1fb-546b-28e4-68e3bb7fdde9' => 'Alarsa',
'd3f20145-cd52-0c92-bb81-690c81cba13e' => 'Hisense',
), ),
'ecmproducts_category_dom' => 'ecmproducts_category_dom' =>
array ( array (
@@ -228,13 +236,33 @@ $customDoms = array (
), ),
'ecmactions_category_dom' => 'ecmactions_category_dom' =>
array ( array (
'dd4ddbad-c949-0ee5-fb73-54cb9b6c86ef' => 'NZE', 'dd4ddbad-c949-0ee5-fb73-54cb9b6c86ef' => 'None',
'8519dfc8-5eec-0233-7f84-54d1fe00e9fc' => 'Zestawy', '5d843f39-893f-51f8-3df5-68c86f1d41c3' => 'HP1',
'55020d96-73d5-7b29-3bab-654f4818e0cd' => 'Mieszanie', '31174829-986e-4d7f-4262-68b2e73742e9' => 'HP2',
'9bc2bafc-0608-7bc7-468b-686a94772424' => 'Blistrowanie', '8519dfc8-5eec-0233-7f84-54d1fe00e9fc' => 'PAK1',
'be37016b-0aa4-678c-9c4a-689c3673af3e' => 'PBDO', '2bdf9315-5c31-778d-4922-68c86f4af827' => 'PAK2',
'e3e16e03-8e62-624e-f954-689c37059997' => 'PTDS', '55020d96-73d5-7b29-3bab-654f4818e0cd' => 'MIE_HP1',
'416a2b50-4979-bc35-c83c-689c8a6640ae' => 'PWT', 'de2448f8-45ac-6b2a-f2b1-68b2e7e40a6f' => 'M1_HP2',
'9bc2bafc-0608-7bc7-468b-686a94772424' => 'BL1',
'347509e3-fff6-4db9-761e-68b2e36436c6' => 'LNE1',
'26c3b7fa-e1ac-66d9-517b-68b2e4c6cae8' => 'LNE2',
'5664a1b1-42dc-2bb8-ad24-68b2e52df143' => 'LNE3',
'307b8935-5235-628f-aac1-68b2e56d3f4d' => 'LNE4',
'8d68df07-0779-5a23-aaf3-68b2e5d72a46' => 'LNE5',
'53d9cae1-1ec5-71e4-5a3c-68b2e77b6d92' => 'MDC5',
'3fea0360-a9d8-93fc-1984-68b2e89e4ec8' => 'FPH9',
'6159a89b-219c-bb4e-1505-68b2e9da1b7c' => 'LNEZ7',
'9bc005d7-5222-3d65-b754-68b2e9854af7' => 'LE10',
'b1176c04-4fe3-d347-9e3a-68b2e945b5c3' => 'FPH1',
'bc4422dc-8f80-4f54-26a6-68b2ea0cd2c0' => 'LNEZ8',
'd8208a7e-b810-91e5-ccfa-68b2eaa73abb' => 'LNAS1',
'a87e1b10-771d-2f24-e795-68d385f0cd35' => 'LNAS2',
'f2364990-b244-064d-b5d1-68b2ebcd0ded' => 'MDC6',
'cc4905b6-a791-5c57-4721-68b2eb29e0fe' => 'TAB1',
'40e8149a-40ec-aeb0-4cdd-68b2eb52634b' => 'TAB2',
'b64ca8db-ff88-082c-887c-68b2ec98c15d' => 'TAB3',
'dab10a8b-295a-8eeb-be7c-68c67ec66ff7' => 'TAB4',
'640aea22-b0c0-fd36-1ed4-68cac4262fe8' => 'LT1',
), ),
'payment_method_dom' => 'payment_method_dom' =>
array ( array (
@@ -322,6 +350,7 @@ $customDoms = array (
'end_of_line' => 'Nieaktywny', 'end_of_line' => 'Nieaktywny',
'active' => 'Aktywny', 'active' => 'Aktywny',
'new' => 'Nowość', 'new' => 'Nowość',
'e8d1191e-2c7b-c24d-88e2-68b2bd076498' => 'test',
), ),
'ecmsales_status_dom' => 'ecmsales_status_dom' =>
array ( array (

View File

@@ -57,7 +57,7 @@ $viewdefs [$module_name] = array (
1 => array ( 1 => array (
0 => array ( 0 => array (
'name' => 'category', 'name' => 'category',
'label' => 'LBL_CATEGORY' 'label' => 'Linia'
), ),
1 => array ( 1 => array (
'name' => 'shape', 'name' => 'shape',

View File

@@ -59,7 +59,7 @@ $viewdefs [$module_name] = array(
1 => array( 1 => array(
0 => array( 0 => array(
'name' => 'category', 'name' => 'category',
'label' => 'LBL_CATEGORY', 'label' => 'Linia',
'tabIndex' => '101', 'tabIndex' => '101',
), ),
1 => array( 1 => array(

View File

@@ -19,7 +19,7 @@ $listViewDefs [$module_name] = array (
), ),
'CATEGORY' => array ( 'CATEGORY' => array (
'type' => 'varchar', 'type' => 'varchar',
'label' => 'LBL_CATEGORY', 'label' => 'Linia',
'width' => '10%', 'width' => '10%',
'default' => true, 'default' => true,
'align' => 'left', 'align' => 'left',

View File

@@ -16,7 +16,7 @@ $searchdefs ['EcmActions'] = array (
), ),
'category' => array( 'category' => array(
'type' => 'enum', 'type' => 'enum',
'label' => 'LBL_CATEGORY', 'label' => 'Linia',
'width' => '10%', 'width' => '10%',
'default' => true, 'default' => true,
'name' => 'category' 'name' => 'category'
@@ -37,7 +37,7 @@ $searchdefs ['EcmActions'] = array (
), ),
'category' => array( 'category' => array(
'type' => 'enum', 'type' => 'enum',
'label' => 'LBL_CATEGORY', 'label' => 'Linia',
'width' => '10%', 'width' => '10%',
'default' => true, 'default' => true,
'name' => 'category' 'name' => 'category'

View File

@@ -81,7 +81,7 @@ $dictionary ['EcmAction'] = array (
'category' => array ( 'category' => array (
'required' => true, 'required' => true,
'name' => 'category', 'name' => 'category',
'vname' => 'LBL_CATEGORY', 'vname' => 'Linia',
'options' => 'ecmactions_category_dom', 'options' => 'ecmactions_category_dom',
'type' => 'enum', 'type' => 'enum',
'len' => '255', 'len' => '255',

View File

@@ -73,7 +73,7 @@ else if ($_REQUEST['isDuplicate']=="true") {
$row = []; $row = [];
$row['id'] = create_guid(); $row['id'] = create_guid();
$row['product_component'] = 1; $row['product_component'] = 1;
$tmp = explode('|',$p); $row['product_product_id'] = $tmp[0];
$row['product_id'] = $c['ecmcomponent_id']; $row['product_id'] = $c['ecmcomponent_id'];
$row['position'] = $position; $row['position'] = $position;
$position++; $position++;

View File

@@ -196,7 +196,7 @@ function deleteRow(index) {
var error = false; // hope :) var error = false; // hope :)
var id = $("#product_id_" + index).val(); var id = $("#product_id_" + index).val();
var howmany = 1; var howmany = 1;
for (var row = 0; row != count; row++) { for (var row = index+1; row != count; row++) {
comp_id = $("#product_product_id_" + row).val(); comp_id = $("#product_product_id_" + row).val();
if (comp_id == id) howmany++; if (comp_id == id) howmany++;
} }

View File

@@ -20,6 +20,21 @@ if(isset($_REQUEST['record'])){
$focus->retrieve($_REQUEST['record']); $focus->retrieve($_REQUEST['record']);
//if(isset($focus->id) && $focus->id != '')$focus->format_all_fields(); //if(isset($focus->id) && $focus->id != '')$focus->format_all_fields();
} }
if(isset($focus->url5)){
$focus->url5 = '<a target="new" href="' .$focus->url5 . '">' . $focus->url5. '</a>';
}
if(isset($focus->url6)){
$focus->url6 = '<a target="new" href="' .$focus->url6 . '">' . $focus->url6. '</a>';
}
if(isset($focus->url7)){
$focus->url7 = '<a target="new" href="' .$focus->url7 . '">' . $focus->url7. '</a>';
}
if(isset($focus->url8)){
$focus->url8 = '<a target="new" href="' .$focus->url8 . '">' . $focus->url8. '</a>';
}
if(isset($focus->url9)){
$focus->url9 = '<a target="new" href="' .$focus->url9 . '">' . $focus->url9. '</a>';
}
$json = getJSONobj(); $json = getJSONobj();
@@ -43,6 +58,8 @@ $detail->preDisplay();
} }
$detail->ss->assign("USAGE_UNIT_ID",$uunit); $detail->ss->assign("USAGE_UNIT_ID",$uunit);
$detail->ss->assign("PRODUCTION_DESCRIPTION",$focus->production_description);
$tax=''; $tax='';
$result = $db->query("select id,name from ecmvats where deleted='0' order by name asc"); $result = $db->query("select id,name from ecmvats where deleted='0' order by name asc");
while(($row=$db->fetchByAssoc($result))!=null) while(($row=$db->fetchByAssoc($result))!=null)

View File

@@ -175,6 +175,7 @@ class EcmProduct extends SugarBean
var $url8; var $url8;
var $url9; var $url9;
var $ean; var $ean;
var $production_description;
// RELATED FIELDS // RELATED FIELDS
var $created_by; var $created_by;

View File

@@ -134,6 +134,23 @@ function isProductValid(id) {
return false; return false;
} }
} }
function exportFile() {
$("#loader").show();
$.ajax({
url: "index.php?module=EcmProducts&action=&action=stockAddress&ajax=export&to_pdf=1",
}).done(function (data) {
$("#loader").hide();
if (data.status === 'Error') {
alert('Błąd: ' + data.msg);
} else {
console.log(data);
downloadFile(data.fileContent, data.fileName, 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
}
}).fail(() => {
$("#loader").hide();
alert('Błąd serwera.');
});
}
$(document).ready(function () { $(document).ready(function () {
$("#address").mask("AB.CD.E.F", { $("#address").mask("AB.CD.E.F", {
placeholder: "__.__._._", placeholder: "__.__._._",
@@ -189,12 +206,49 @@ $(document).ready(function () {
$("#searchByIndexForm").submit(); $("#searchByIndexForm").submit();
} }
}); });
$("#exportTrigger").click(() => {
exportFile();
});
$('[name^="showAddress').click((event) => { $('[name^="showAddress').click((event) => {
$("#address").val(event.target.name.split('-')[1]); $("#address").val(event.target.name.split('-')[1]);
if (isAddressValid()) { if (isAddressValid()) {
$("#searchByAddressForm").submit(); $("#searchByAddressForm").submit();
} }
}); });
//bind buttons //bind buttons
}); });
function downloadFile(base64Data, fileName, mimeType) {
// Stwórz blob z danych base64
const byteCharacters = atob(base64Data);
const byteArrays = [];
for (let offset = 0; offset < byteCharacters.length; offset += 512) {
const slice = byteCharacters.slice(offset, offset + 512);
const byteNumbers = new Array(slice.length);
for (let i = 0; i < slice.length; i++) {
byteNumbers[i] = slice.charCodeAt(i);
}
const byteArray = new Uint8Array(byteNumbers);
byteArrays.push(byteArray);
}
const blob = new Blob(byteArrays, {type: mimeType});
// Stwórz link do pobrania
const link = document.createElement('a');
link.href = window.URL.createObjectURL(blob);
link.download = fileName;
// Dodaj link do dokumentu i kliknij go
document.body.appendChild(link);
link.click();
// Usuń link z dokumentu
setTimeout(function () {
document.body.removeChild(link);
window.URL.revokeObjectURL(link.href);
}, 100);
}

View File

@@ -531,8 +531,6 @@ $viewdefs['EcmProducts']['DetailView'] = array(
) )
) )
), ),
'LBL_PANEL_CATEGORIES' => array( 'LBL_PANEL_CATEGORIES' => array(
0 => array( 0 => array(
0 => array( 0 => array(
@@ -569,7 +567,8 @@ $viewdefs['EcmProducts']['DetailView'] = array(
'allCols' => true, 'allCols' => true,
'hideLabel' => true, 'hideLabel' => true,
'customCode' => '{$MOD.LBL_COMPONENTS}<br><div id="componentsTable"></div><br><br>{$MOD.LBL_ACTIONS}<div id="actionsTable"></div> 'customCode' => '{$MOD.LBL_COMPONENTS}<br><div id="componentsTable"></div><br><br>{$MOD.LBL_ACTIONS}<div id="actionsTable"></div>
<br><br><div id="summaryTable" style="width: 50%; padding-right: 0px;">Podsumowanie</div>' <br><br><div id="summaryTable" style="width: 50%; padding-right: 0px;">Podsumowanie</div>
<br>Receptura: {$PRODUCTION_DESCRIPTION}'
) )
) )
), ),

View File

@@ -566,7 +566,8 @@ $viewdefs['EcmProducts']['EditView'] = array(
'allCols' => true, 'allCols' => true,
'hideLabel' => true, 'hideLabel' => true,
'customCode' => '{$MOD.LBL_COMPONENTS}<br><div id="componentsTable"></div><br><br>{$MOD.LBL_ACTIONS}<div id="actionsTable"></div> 'customCode' => '{$MOD.LBL_COMPONENTS}<br><div id="componentsTable"></div><br><br>{$MOD.LBL_ACTIONS}<div id="actionsTable"></div>
<br><br><div style="width: 17%;" id="copyProduct"></div><div style="width: 17%" id="copyButtons"></div>' <br><br><div style="width: 17%;" id="copyProduct"></div><div style="width: 17%" id="copyButtons"></div><br>
Receptura:<br><textarea name="production_description" id="production_description" cols="80" rows="10">{$fields.production_description.value}</textarea>'
) )
) )
), ),

View File

@@ -33,6 +33,9 @@
$db->query("UPDATE ecmproducts_stock_addresses SET is_not_full=$isNotFull WHERE stock_address='$address'"); $db->query("UPDATE ecmproducts_stock_addresses SET is_not_full=$isNotFull WHERE stock_address='$address'");
echo json_encode(array('status' => 'Success', 'msg' => 'setIsNotFull')); echo json_encode(array('status' => 'Success', 'msg' => 'setIsNotFull'));
break; break;
case 'export':
exportExcel();
break;
} }
} else { } else {
$pRes = $db->query("SELECT DISTINCT id, code FROM ecmproducts WHERE deleted=0;"); $pRes = $db->query("SELECT DISTINCT id, code FROM ecmproducts WHERE deleted=0;");
@@ -44,21 +47,35 @@
$smarty = new Sugar_Smarty(); $smarty = new Sugar_Smarty();
if (strlen($_GET['searchType']) > 0 && $_GET['searchType'] == 'address') if (strlen($_GET['searchType']) > 0 && $_GET['searchType'] == 'address') {
{
$address = $_GET['address']; $address = $_GET['address'];
$product = $db->fetchByAssoc($db->query(" $product = $db->fetchByAssoc($db->query("
SELECT a.ecmproduct_id, p.name, p.code, p.ems_qty_in_stock AS stock_state, a.is_not_full FROM ecmproducts_stock_addresses AS a SELECT a.ecmproduct_id, p.name, p.code, p.ems_qty_in_stock AS stock_state, a.is_not_full FROM ecmproducts_stock_addresses AS a
INNER JOIN ecmproducts as p ON p.id=a.ecmproduct_id INNER JOIN ecmproducts as p ON p.id=a.ecmproduct_id
WHERE stock_address='$address';")); WHERE stock_address='$address';"));
if ($product) {
$state = $db->fetchByAssoc($db->query("SELECT SUM(quantity) as qty FROM ecmstockstates WHERE product_id='" . $product['ecmproduct_id'] . "'")); $state = $db->fetchByAssoc($db->query("SELECT SUM(quantity) as qty FROM ecmstockstates WHERE product_id='" . $product['ecmproduct_id'] . "'"));
$product['stock_state'] = $state['qty']; $product['stock_state'] = $state['qty'];
}
$smarty->assign("PROCESS", "ADDRESS"); $smarty->assign("PROCESS", "ADDRESS");
$smarty->assign("PRODUCT", $product); $smarty->assign("PRODUCT", $product);
} }
if (strlen($_GET['searchType']) > 0 && $_GET['searchType'] == 'index') if (strlen($_GET['searchType']) > 0 && $_GET['searchType'] == 'address') {
{ $address = $_GET['address'];
$product = $db->fetchByAssoc($db->query("
SELECT a.ecmproduct_id, p.name, p.code, p.ems_qty_in_stock AS stock_state, a.is_not_full FROM ecmproducts_stock_addresses AS a
INNER JOIN ecmproducts as p ON p.id=a.ecmproduct_id
WHERE stock_address='$address';"));
if ($product) {
$state = $db->fetchByAssoc($db->query("SELECT SUM(quantity) as qty FROM ecmstockstates WHERE product_id='" . $product['ecmproduct_id'] . "'"));
$product['stock_state'] = $state['qty'];
}
$smarty->assign("PROCESS", "ADDRESS");
$smarty->assign("PRODUCT", $product);
}
if (strlen($_GET['searchType']) > 0 && $_GET['searchType'] == 'index') {
$id = $_GET['productId']; $id = $_GET['productId'];
$res = $db->query(" $res = $db->query("
SELECT a.ecmproduct_id, a.stock_address, a.is_not_full, p.name, p.code FROM ecmproducts_stock_addresses AS a SELECT a.ecmproduct_id, a.stock_address, a.is_not_full, p.name, p.code FROM ecmproducts_stock_addresses AS a
@@ -76,8 +93,7 @@
$smarty->assign("ADDRESSES", $addresses); $smarty->assign("ADDRESSES", $addresses);
} }
if (strlen($_GET['searchType']) > 0 && $_GET['searchType'] == 'allAddresses') if (strlen($_GET['searchType']) > 0 && $_GET['searchType'] == 'allAddresses') {
{
if ($_GET['onlyFull'] == "on") { if ($_GET['onlyFull'] == "on") {
$allAddresses = getAllAddresses(true); $allAddresses = getAllAddresses(true);
} else { } else {
@@ -130,7 +146,8 @@
echo $smarty->display('modules/EcmProducts/tpls/stockAddress.tpl'); echo $smarty->display('modules/EcmProducts/tpls/stockAddress.tpl');
} }
function getAllAddresses($onlyFull) { function getAllAddresses($onlyFull)
{
$addresses = array(); $addresses = array();
for ($i = 1; $i <= 17; $i++) { for ($i = 1; $i <= 17; $i++) {
$s1 = (strlen($i) == 1) ? '0' . $i : $i; $s1 = (strlen($i) == 1) ? '0' . $i : $i;
@@ -149,3 +166,38 @@
} }
return $addresses; return $addresses;
} }
function exportExcel()
{
$db = $GLOBALS['db'];
$address = $_GET['address'];
$res = $db->query("SELECT p.code, s.stock_address
FROM ecmproducts_stock_addresses AS s
INNER JOIN ecmproducts AS p
ON p.id = s.ecmproduct_id
ORDER BY s.stock_address;");
$result = array();
while ($row = $db->fetchByAssoc($res)) {
array_push($result, $row);
}
$headers = [
'Indeks',
'Adres'
];
$sheetData = array_merge([$headers], $result);
require_once 'modules/EcmReports/BimIT-Reports/lib/xlsxGenerator.php';
$xlsx = Shuchkin\SimpleXLSXGen::fromArray($sheetData);
$xlsx_content = (string)$xlsx;
header('Content-Type: application/json');
echo json_encode([
'success' => true,
'fileContent' => base64_encode($xlsx_content),
'fileName' => 'adresy_magazynowe.xlsx'
]);
}

View File

@@ -64,6 +64,16 @@
</td> </td>
</tr> </tr>
</form> </form>
<tr>
<td scope="row" nowrap="nowrap" width="1%">
<input type="hidden" name="module" value="EcmProducts"/>
<input type="hidden" name="action" value="stockAddress"/>
<input type="hidden" name="searchType" value="export"/>
<input type="button" id="exportTrigger" value="Eksport Excel" class="button"/>
</td>
<td nowrap="nowrap" width="1%">&nbsp;</td>
<td>&nbsp;</td>
</tr>
</table> </table>
</div> </div>
{if $PROCESS && $PROCESS=='ADDRESS'} {if $PROCESS && $PROCESS=='ADDRESS'}
@@ -95,7 +105,8 @@
onclick="openProductCard('{$PRODUCT.ecmproduct_id}');"/>&nbsp;&nbsp; onclick="openProductCard('{$PRODUCT.ecmproduct_id}');"/>&nbsp;&nbsp;
<input type="button" value="Wyszukaj wszystkie adresy" class="button" <input type="button" value="Wyszukaj wszystkie adresy" class="button"
onclick="searchByIndex('{$PRODUCT.code}')"/>&nbsp;&nbsp; onclick="searchByIndex('{$PRODUCT.code}')"/>&nbsp;&nbsp;
<input type="button" value="Usuń produkt z adresu" class="button" onclick="removeProductFromAddress()" /> <input type="button" value="Usuń produkt z adresu" class="button"
onclick="removeProductFromAddress()"/>
</td> </td>
</tr> </tr>
</table> </table>
@@ -126,7 +137,10 @@
{/if} {/if}
{if $PROCESS && $PROCESS=='PRODUCT'} {if $PROCESS && $PROCESS=='PRODUCT'}
<h2>{$PRODUCT.code} {$PRODUCT.name} ( Stan: {$PRODUCT.ems_qty_in_stock} )&nbsp;<input type="button" <h2>{$PRODUCT.code} {$PRODUCT.name} ( Stan: {$PRODUCT.ems_qty_in_stock} )&nbsp;<input type="button"
value="Karta produktu" class="button" onclick="openProductCard('{$PRODUCT.id}');" /></h2> value="Karta produktu"
class="button"
onclick="openProductCard('{$PRODUCT.id}');"/>
</h2>
<table cellpadding="0" cellspacing="0" class="list view"> <table cellpadding="0" cellspacing="0" class="list view">
<tr class="oddListRowS1"> <tr class="oddListRowS1">
<th style="width: 15%;"><b>Adres</b></td> <th style="width: 15%;"><b>Adres</b></td>
@@ -236,7 +250,8 @@
background-color: rgba(16, 16, 16, 0.5); background-color: rgba(16, 16, 16, 0.5);
} }
.loader>img {} .loader > img {
}
{/literal} {/literal}
</style> </style>

View File

@@ -1459,6 +1459,11 @@ $dictionary['EcmProduct'] = array(
'vname' => 'LBL_DESCRIPTION', 'vname' => 'LBL_DESCRIPTION',
'type' => 'text' 'type' => 'text'
), ),
'production_description' => array(
'name' => 'description',
'vname' => 'LBL_DESCRIPTION',
'type' => 'text'
),
'models' => array( 'models' => array(
'name' => 'models', 'name' => 'models',
'vname' => 'LBL_MODELS', 'vname' => 'LBL_MODELS',

View File

@@ -8,7 +8,10 @@ $(document).ready(function () {
return false; return false;
}, },
format: function (s, table, cell) { format: function (s, table, cell) {
return $(cell).find("input[id^=production-date]").val() || "2222-01-01"; if ($(cell).find("input[id^=production-date]").val() === '') {
return "2222-01-01";
}
return $(cell).find("input[id^=production-date]").val() + " " + $(cell).find("input[id^=production-time]").val();
}, },
parsed: false, parsed: false,
type: "text" type: "text"
@@ -67,12 +70,15 @@ $(document).ready(function () {
$("#selectAll").attr('checked', false); $("#selectAll").attr('checked', false);
$(".allCheck").prop('checked', false); $(".allCheck").prop('checked', false);
localStorage.setItem("productionSchedule_filter", $.tablesorter.getFilters($("#allTable"))); localStorage.setItem("productionSchedule_filter", $.tablesorter.getFilters($("#allTable")));
updateTimeSummary();
}); });
$("#allTable").bind("sortEnd", function () { $("#allTable").bind("sortEnd", function () {
try { try {
localStorage.setItem('productionSchedule_sort', localStorage.setItem('productionSchedule_sort',
$("#allTable")[0].config.sortList[0][0] + "|" + $("#allTable")[0].config.sortList[0][1]); $("#allTable")[0].config.sortList[0][0] + "|" + $("#allTable")[0].config.sortList[0][1]);
} catch (e) {} } catch (e) {
}
updateTimeSummary();
}); });
setTimeout(() => { setTimeout(() => {
const filters = localStorage.getItem("productionSchedule_filter"); const filters = localStorage.getItem("productionSchedule_filter");
@@ -85,7 +91,8 @@ $(document).ready(function () {
var tmp = sort.split("|"); var tmp = sort.split("|");
$("#allTable")[0].config.sortList = [[parseInt(tmp[0]), parseInt(tmp[1])]]; $("#allTable")[0].config.sortList = [[parseInt(tmp[0]), parseInt(tmp[1])]];
$.tablesorter.sortOn($("#allTable")[0].config, [[parseInt(tmp[0]), parseInt(tmp[1])]]); $.tablesorter.sortOn($("#allTable")[0].config, [[parseInt(tmp[0]), parseInt(tmp[1])]]);
} catch (e) { } } catch (e) {
}
} }
}, 500); }, 500);
$("#selectAll").click(function () { $("#selectAll").click(function () {
@@ -98,17 +105,38 @@ $(document).ready(function () {
} else { } else {
$(".allCheck").prop("checked", false); $(".allCheck").prop("checked", false);
} }
updateTimeSummary();
}); });
$("#duplicateBtn").click(() => duplicatePositions()); $("#duplicateBtn").click(() => duplicatePositions());
$("#deleteBtn").click(() => { removePositions(); }); $("#deleteBtn").click(() => {
$("#excelBtn").click(() => { exportExcel(); }); removePositions();
$("#pdfBtn").click(() => { exportPDF(); }); });
$("#productionBtn").click(() => { window.alert("In progress."); }); $("#excelBtn").click(() => {
exportExcel();
});
$("#pdfBtn").click(() => {
exportPDF();
});
$("#changeDateBtn").click(() => {
changeDate();
});
$("#rawMaterialsExcelBtn").click(() => {
exportRawMaterialsExcel();
});
$("#productionBtn").click(() => {
window.alert("In progress.");
});
$("#createInsideOrder").click(createInsideOrder); $("#createInsideOrder").click(createInsideOrder);
$(document).on('change', '.allCheck', function () {
updateTimeSummary();
});
}); });
function SetTab(tab_name) { function SetTab(tab_name) {
if (TabsMainBlock) { return; } if (TabsMainBlock) {
return;
}
var TabMenu = document.getElementById("groupTabsPanels"); var TabMenu = document.getElementById("groupTabsPanels");
var tabs = TabMenu.getElementsByTagName("li"); var tabs = TabMenu.getElementsByTagName("li");
for (var i = 0; i < tabs.length; i++) { for (var i = 0; i < tabs.length; i++) {
@@ -134,6 +162,7 @@ function SetTab(tab_name) {
if (SelectedTab === "1") { if (SelectedTab === "1") {
} }
} }
function getRawMaterials() { function getRawMaterials() {
var ids = []; var ids = [];
$("input.allCheck:checkbox:checked").each(function () { $("input.allCheck:checkbox:checked").each(function () {
@@ -169,8 +198,10 @@ function getRawMaterials() {
} }
}); });
} }
function drawRawMaterials(data) { function drawRawMaterials(data) {
$("#rawMaterialsTableContainer").html(rawMaterialsTablePrototype()); $("#rawMaterialsTableContainer").html(rawMaterialsTablePrototype());
// TODO: tutraj czasami się wiesza
data.forEach((el, index) => { data.forEach((el, index) => {
var tr = $("<tr></tr>"); var tr = $("<tr></tr>");
tr.append("<td><input type=\"checkbox\" value=" + el.id + " class=\"rawMaterialCheck\" /></td>"); tr.append("<td><input type=\"checkbox\" value=" + el.id + " class=\"rawMaterialCheck\" /></td>");
@@ -220,9 +251,11 @@ function drawRawMaterials(data) {
}); });
updateRawMaterialsPositions(); updateRawMaterialsPositions();
} }
function rawMaterialsTablePrototype() { 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>Adres magazynowy</th></tr></thead><tbody aria-live="polite" aria-relevant="all"></tbody></table>'; 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>Adres magazynowy</th></tr></thead><tbody aria-live="polite" aria-relevant="all"></tbody></table>';
} }
function updateRawMaterialsPositions() { function updateRawMaterialsPositions() {
var i = 0; var i = 0;
$("#rawMaterialsTable").find("tr").each(function (index) { $("#rawMaterialsTable").find("tr").each(function (index) {
@@ -232,6 +265,7 @@ function updateRawMaterialsPositions() {
} }
}); });
} }
function editQty(id) { function editQty(id) {
$("#edit-" + id).css("display", "none"); $("#edit-" + id).css("display", "none");
$("#qty-" + id).css("display", "none"); $("#qty-" + id).css("display", "none");
@@ -239,6 +273,7 @@ function editQty(id) {
$("#qtyInput-" + id).select(); $("#qtyInput-" + id).select();
$("#save-" + id).css("display", "inline-block"); $("#save-" + id).css("display", "inline-block");
} }
function saveQty(id) { function saveQty(id) {
showLoader("Trwa aktualizacja..."); showLoader("Trwa aktualizacja...");
$("#edit-" + id).css("display", "inline-block"); $("#edit-" + id).css("display", "inline-block");
@@ -254,6 +289,7 @@ function saveQty(id) {
}, },
}); });
} }
function duplicatePositions() { function duplicatePositions() {
var ids = []; var ids = [];
$("input.allCheck:checkbox:checked").each(function () { $("input.allCheck:checkbox:checked").each(function () {
@@ -264,7 +300,9 @@ function duplicatePositions() {
return; return;
} }
var userResponse = window.confirm("Zduplikować pozycje?"); var userResponse = window.confirm("Zduplikować pozycje?");
if (!userResponse) { return; } if (!userResponse) {
return;
}
showLoader("Duplikowanie..."); showLoader("Duplikowanie...");
$.ajax({ $.ajax({
method: "get", method: "get",
@@ -274,6 +312,7 @@ function duplicatePositions() {
}, },
}); });
} }
function removePositions() { function removePositions() {
var ids = []; var ids = [];
$("input.allCheck:checkbox:checked").each(function () { $("input.allCheck:checkbox:checked").each(function () {
@@ -284,23 +323,68 @@ function removePositions() {
return; return;
} }
var userResponse = window.confirm("Usunąć pozycje?"); var userResponse = window.confirm("Usunąć pozycje?");
if (!userResponse) { return; } if (!userResponse) {
return;
}
showLoader("Usuwanie..."); showLoader("Usuwanie...");
$.ajax({ $.ajax({
method: "get", method: "get",
url: $(location).attr("href") + "&to_pdf=1&ajaxAction=removePositions&ids=" + ids.join("|"), url: $(location).attr("href") + "&to_pdf=1&ajaxAction=removePositions&ids=" + ids.join("|"),
success: function () success: function () {
{
window.location.reload(); window.location.reload();
}, },
}); });
} }
function saveProductionDate(id) { function saveProductionDate(id) {
let date = $("#production-date-" + id).val();
let time = $("#production-time-" + id).val();
if (date.length !== 10) {
$("#production-date-" + id).val('');
$("#production-time-" + id).val('');
date = '';
time = '';
} else {
if (time.length === 5) {
const timeRegex = /^([0-5]?[0-9]|1[0-3]):[0-5][0-9]$|^14:[0-2][0-9]$|^14:30$/;
if (!timeRegex.test(time)) {
time = "06:00";
} else {
const timeParts = time.split(':');
const hours = parseInt(timeParts[0], 10);
const minutes = parseInt(timeParts[1], 10);
if (hours < 6 || (hours === 14 && minutes > 30) || hours > 14) {
time = "06:00";
}
}
} else if (time.length === 4) {
time = time.substring(0, 2) + ":" + time.substring(2);
const timeRegex = /^([0-5]?[0-9]|1[0-3]):[0-5][0-9]$|^14:[0-2][0-9]$|^14:30$/;
if (!timeRegex.test(time)) {
time = "06:00";
} else {
const timeParts = time.split(':');
const hours = parseInt(timeParts[0], 10);
const minutes = parseInt(timeParts[1], 10);
if (hours < 6 || (hours === 14 && minutes > 30) || hours > 14) {
time = "06:00";
}
}
} else {
time = "06:00";
}
}
$("#production-time-" + id).val(time);
$.ajax({ $.ajax({
method: "get", method: "get",
url: $(location).attr("href") + "&to_pdf=1&ajaxAction=saveProductionDate&id=" + id + "&date=" + $("#production-date-" + id).val(), url: $(location).attr("href") + "&to_pdf=1&ajaxAction=saveProductionDate&id=" + id + "&date=" + encodeURIComponent(date) + "&time=" + encodeURIComponent(time),
}); });
} }
function editDescription(id) { function editDescription(id) {
$("#edit-description-" + id).css("display", "none"); $("#edit-description-" + id).css("display", "none");
$("#description-" + id).css("display", "none"); $("#description-" + id).css("display", "none");
@@ -308,6 +392,7 @@ function editDescription(id) {
$("#descriptionInput-" + id).select(); $("#descriptionInput-" + id).select();
$("#save-description-" + id).css("display", "inline-block"); $("#save-description-" + id).css("display", "inline-block");
} }
function saveDescription(id) { function saveDescription(id) {
$("#edit-description-" + id).css("display", "inline-block"); $("#edit-description-" + id).css("display", "inline-block");
$("#description-" + id).css("display", "inline"); $("#description-" + id).css("display", "inline");
@@ -321,6 +406,7 @@ function saveDescription(id) {
}, },
}); });
} }
function showLoader(msg = "Pobieranie danych") { function showLoader(msg = "Pobieranie danych") {
$.blockUI({ $.blockUI({
css: { css: {
@@ -337,30 +423,83 @@ function showLoader(msg = "Pobieranie danych") {
message: msg message: msg
}); });
} }
function hideLoader() { function hideLoader() {
$.unblockUI(); $.unblockUI();
} }
function exportExcel() { function exportExcel() {
var ids = []; // Check if any rows are selected
$("input.allCheck:checkbox:checked").each(function () { var checkedRows = $("input.allCheck:checkbox:checked").closest('tr:visible');
ids.push($(this).val()); if (checkedRows.length === 0) {
}); window.alert("Wybierz pozycje do eksportu");
if (ids.length === 0) { return;
$("input.allCheck:checkbox").each(function () {
ids.push($(this).val());
});
} }
// Get table data from selected rows only
var tableData = [];
// Get headers (skip first checkbox column)
var headers = [];
$("#allTable thead tr th").each(function (index) {
if (index > 0) {
headers.push($(this).text().trim());
}
});
tableData.push(headers);
// Get data from checked and visible rows
checkedRows.each(function () {
var rowData = [];
var $row = $(this);
$row.find('td').each(function (index) {
if (index > 0) { // Skip first checkbox column
var $cell = $(this);
var cellValue = '';
// Check for input fields (like production date)
var $input = $cell.find('input[type="text"], input[type="number"]');
if ($input.length > 0) {
cellValue = $input.val() || '';
} else {
// Check for editable divs (like qty, description)
var $editableDiv = $cell.find('div[id^="qty-"], div[id^="description-"]');
if ($editableDiv.length > 0) {
cellValue = $editableDiv.text().trim();
} else {
// Regular cell text
cellValue = $cell.text().trim();
}
}
rowData.push(cellValue);
}
});
if (rowData.length > 0) {
tableData.push(rowData);
}
});
showLoader("Generowanie pliku..."); showLoader("Generowanie pliku...");
$.ajax({ $.ajax({
method: "get", method: "post",
url: $(location).attr("href") + "&to_pdf=1&ajaxAction=exportExcel&ids=" + ids.join("|"), url: $(location).attr("href") + "&to_pdf=1&ajaxAction=exportExcelWYSIWYG",
success: function (response) data: {
{ tableData: JSON.stringify(tableData)
downloadFile(response.fileContent, response.fileName, 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'); },
success: function (result) {
downloadFile(result.fileContent, result.fileName, 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
hideLoader(); hideLoader();
}, },
error: function () {
window.alert("Błąd podczas generowania pliku");
hideLoader();
}
}); });
} }
function exportPDF() { function exportPDF() {
var ids = []; var ids = [];
$("input.allCheck:checkbox:checked").each(function () { $("input.allCheck:checkbox:checked").each(function () {
@@ -375,13 +514,89 @@ function exportPDF() {
$.ajax({ $.ajax({
method: "get", method: "get",
url: $(location).attr("href") + "&to_pdf=1&ajaxAction=exportPDF&ids=" + ids.join("|"), url: $(location).attr("href") + "&to_pdf=1&ajaxAction=exportPDF&ids=" + ids.join("|"),
success: function (response) success: function (response) {
{
downloadFile(response.fileContent, response.fileName, 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'); downloadFile(response.fileContent, response.fileName, 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
hideLoader(); hideLoader();
}, },
}); });
} }
function exportRawMaterialsExcel() {
// Check if raw materials table exists
if ($("#rawMaterialsTable").length === 0) {
window.alert("Brak tabeli surowców do eksportu");
return;
}
// Check if any rows are selected
var checkedRows = $("input.rawMaterialCheck:checkbox:checked").closest('tr:visible');
if (checkedRows.length === 0) {
// If no rows selected, export all visible rows
checkedRows = $("#rawMaterialsTable tbody tr:visible");
if (checkedRows.length === 0) {
window.alert("Brak danych do eksportu");
return;
}
}
// Get table data from selected rows
var tableData = [];
// Get headers (skip first checkbox column)
var headers = [];
$("#rawMaterialsTable thead tr th").each(function (index) {
if (index > 0) {
headers.push($(this).text().trim());
}
});
tableData.push(headers);
// Get data from selected/visible rows
checkedRows.each(function () {
var rowData = [];
var $row = $(this);
$row.find('td').each(function (index) {
if (index > 0) { // Skip first checkbox column
var $cell = $(this);
var cellValue = '';
// Check for links (product codes)
var $link = $cell.find('a');
if ($link.length > 0) {
cellValue = $link.text().trim();
} else {
// Regular cell text
cellValue = $cell.text().trim();
}
rowData.push(cellValue);
}
});
if (rowData.length > 0) {
tableData.push(rowData);
}
});
showLoader("Generowanie pliku...");
$.ajax({
method: "post",
url: $(location).attr("href") + "&to_pdf=1&ajaxAction=exportExcelWYSIWYG",
data: {
tableData: JSON.stringify(tableData)
},
success: function (result) {
downloadFile(result.fileContent, result.fileName, 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
hideLoader();
},
error: function () {
window.alert("Błąd podczas generowania pliku");
hideLoader();
}
});
}
function createInsideOrder() { function createInsideOrder() {
var ids = []; var ids = [];
$('input.allCheck:checkbox:checked').each(function () { $('input.allCheck:checkbox:checked').each(function () {
@@ -435,3 +650,79 @@ function downloadFile(base64Data, fileName, mimeType) {
window.URL.revokeObjectURL(link.href); window.URL.revokeObjectURL(link.href);
}, 100); }, 100);
} }
function updateTimeSummary() {
var totalMinutes = 0;
var rows;
var checkedBoxes = $('.allCheck:checked');
if (checkedBoxes.length > 0) {
rows = checkedBoxes.closest('tr');
} else {
rows = $('#allTable tbody tr:visible');
}
rows.each(function () {
var actionTimeCell = $(this).find('td').eq(17);
var timeText = actionTimeCell.text().trim();
if (timeText && timeText.includes(':')) {
var timeParts = timeText.split(':');
if (timeParts.length === 2) {
var hours = parseInt(timeParts[0], 10) || 0;
var minutes = parseInt(timeParts[1], 10) || 0;
totalMinutes += (hours * 60) + minutes;
}
}
});
var totalHours = Math.floor(totalMinutes / 60);
var remainingMinutes = totalMinutes % 60;
var formattedTime = String(totalHours).padStart(2, '0') + ':' +
String(remainingMinutes).padStart(2, '0');
$('#timeSummary').html(formattedTime);
return formattedTime;
}
function changeDate() {
var ids = [];
$('input.allCheck:checkbox:checked').each(function () {
ids.push($(this).val());
});
if (ids.length === 0) {
alert('Wybierz pozycje.');
return;
}
let hours = prompt("Podaj ilość godzin:");
if (hours === null) {
return null; // no response
}
hours = parseFloat(hours);
if (hours === "") {
window.alert("Niepoprawna wartość (-100 : 100)");
return null;
}
const hoursNum = parseFloat(hours);
if (isNaN(hoursNum)) {
window.alert("Niepoprawna wartość (-100 : 100)");
return null;
}
if (hoursNum < -100 || hoursNum > 100) {
window.alert("Niepoprawna wartość (-100 : 100)");
return null;
}
$.ajax({
method: "get",
url: $(location).attr("href") + "&to_pdf=1&ajaxAction=updateProductionDate&ids=" + ids.join("|") + "&hours=" + hoursNum,
success: function () {
window.location.reload();
},
error: function () {
window.alert("Aktualizacja nie powiodła się.");
window.location.reload();
}
});
}

View File

@@ -1,7 +1,7 @@
<?php <?php
ini_set('display_errors', 1); //ini_set('display_errors', 1);
ini_set('display_startup_errors', 1); //ini_set('display_startup_errors', 1);
error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED); //error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED);
if (!isset($_GET['ajaxAction'])) { if (!isset($_GET['ajaxAction'])) {
@@ -36,7 +36,7 @@ if (!isset($_GET['ajaxAction'])) {
removePositions($_GET['ids']); removePositions($_GET['ids']);
break; break;
case 'saveProductionDate': case 'saveProductionDate':
saveProductionDate($_GET['id'], $_GET['date']); saveProductionDate($_GET['id'], $_GET['date'], $_GET['time']);
break; break;
case 'saveProductDescription': case 'saveProductDescription':
saveProductDescription($_GET['id'], $_GET['description']); saveProductDescription($_GET['id'], $_GET['description']);
@@ -44,12 +44,18 @@ if (!isset($_GET['ajaxAction'])) {
case 'exportExcel': case 'exportExcel':
exportExcel($_GET['ids']); exportExcel($_GET['ids']);
break; break;
case 'exportExcelWYSIWYG':
exportExcelWYSIWYG($_POST['tableData']);
break;
case 'exportPDF': case 'exportPDF':
exportPDF($_GET['ids']); exportPDF($_GET['ids']);
break; break;
case 'getRawMaterials': case 'getRawMaterials':
getRawMaterials($_POST['ids']); getRawMaterials($_POST['ids']);
break; break;
case 'updateProductionDate':
updateProductionDate($_GET['ids'], $_GET['hours']);
break;
} }
} }
function loadSchedulers($dateFrom = null, $dateTo = null, $ids = null) function loadSchedulers($dateFrom = null, $dateTo = null, $ids = null)
@@ -67,7 +73,9 @@ SELECT s.id as orderId, s.document_no, s.status, s.parent_name, s.parent_id, s.s
ps_main.ecmproduct_id as main_product_id, ps_main.ecmproduct_id as main_product_id,
p_main.code as main_product_code, p_main.code as main_product_code,
a.id AS action_id, a.id AS action_id,
a.indeks AS action_index a.indeks AS action_index,
a.category AS action_category,
a.performance AS action_performance
FROM productionScheduler AS ps FROM productionScheduler AS ps
LEFT JOIN ecmsaleitems AS si LEFT JOIN ecmsaleitems AS si
ON ps.ecmsaleitem_id = si.id ON ps.ecmsaleitem_id = si.id
@@ -97,8 +105,8 @@ WHERE ps.deleted = 0 ";
if ($dateFrom != null && $dateTo != null) { if ($dateFrom != null && $dateTo != null) {
$query .= " AND ( $query .= " AND (
(ps.production_date >= '$dateFrom' AND ps.production_date <= '$dateTo') (DATE(ps.production_date) >= '$dateFrom' AND DATE(ps.production_date) <= '$dateTo')
OR ps.production_date IS NULL OR ps.production_date = '0000-00-00')"; OR ps.production_date IS NULL OR DATE(ps.production_date) = '0000-00-00 00:00:00')";
} }
if ($ids != null) { if ($ids != null) {
@@ -106,7 +114,6 @@ WHERE ps.deleted = 0 ";
} }
$query .= "GROUP BY ps.id, s.id, si.id, p.id, ps_main.id, p_main.id "; $query .= "GROUP BY ps.id, s.id, si.id, p.id, ps_main.id, p_main.id ";
$query .= "ORDER BY s.delivery_date, s.register_date, s.document_no;";
$rows = $db->query($query); $rows = $db->query($query);
$data = array(); $data = array();
@@ -138,13 +145,26 @@ WHERE ps.deleted = 0 ";
$row['description'] = strlen($r['description']) > 0 ? substr($r['description'], 0, 30) : ''; $row['description'] = strlen($r['description']) > 0 ? substr($r['description'], 0, 30) : '';
$row['fullDescription'] = $r['description']; $row['fullDescription'] = $r['description'];
$row['shippingTo'] = ($r['shipping_address_name'] == 'Adres korespondencyjny' ? '' : $r['shipping_address_name']); $row['shippingTo'] = ($r['shipping_address_name'] == 'Adres korespondencyjny' ? '' : $r['shipping_address_name']);
$row['productionDate'] = $r['production_date'] == '0000-00-00' ? '' : $r['production_date']; $row['productionDate'] = $r['production_date'] == '0000-00-00 00:00:00' ? '' : substr($r['production_date'], 0, 10);
$row['productionTime'] = $r['production_date'] == '0000-00-00 00:00:00' ? '' : substr($r['production_date'], 11, 5);
$row['productStockState'] = $r['stockState'] | 0; $row['productStockState'] = $r['stockState'] | 0;
$row['mainProductId'] = $r['main_product_id']; $row['mainProductId'] = $r['main_product_id'];
$row['mainProductCode'] = strlen($r['main_product_code']) > 20 ? substr($r['main_product_code'], 0, 20) . "..." : $r['main_product_code']; $row['mainProductCode'] = strlen($r['main_product_code']) > 20 ? substr($r['main_product_code'], 0, 20) . "..." : $r['main_product_code'];
$row['mainProductFullCode'] = $r['main_product_code']; $row['mainProductFullCode'] = $r['main_product_code'];
$row['action_id'] = $r['action_id']; $row['action_id'] = $r['action_id'];
$row['action_index'] = $r['action_index']; $row['action_index'] = $r['action_index'];
$row['action_category'] = $app_list_strings['ecmactions_category_dom'][$r['action_category']];
// check if action_performance is number and is not 0
if (is_numeric($r['action_performance']) && $r['action_performance'] != 0) {
$timeInHours = $r['scheduledQuantity'] / $r['action_performance'];
$hours = floor($timeInHours);
$minutes = round(($timeInHours - $hours) * 60);
$row['action_time'] = sprintf('%02d:%02d', $hours, $minutes);
} else {
$row['action_time'] = '---';
}
$data[] = $row; $data[] = $row;
} }
return $data; return $data;
@@ -251,8 +271,8 @@ function duplicatePositions($ids)
$ids = explode("|", $ids); $ids = explode("|", $ids);
foreach ($ids as $id) { foreach ($ids as $id) {
$res = $db->fetchByAssoc($db->query("SELECT * FROM productionScheduler WHERE id ='$id'")); $res = $db->fetchByAssoc($db->query("SELECT * FROM productionScheduler WHERE id ='$id'"));
$query = sprintf("INSERT INTO productionScheduler VALUES ('%s', null, '%s', '%s', '%d', NOW(), NOW(), '%s', '%s', 0, '%s', '%d', '%s', '%s');", $query = sprintf("INSERT INTO productionScheduler VALUES ('%s', '%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'], generateUuidV4(), $res['main_id'], $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']); $res['is_component'], $res['production_date'], $res['description']);
$db->query($query); $db->query($query);
} }
@@ -268,14 +288,15 @@ function removePositions($ids)
$db->query($query); $db->query($query);
} }
function saveProductionDate($id, $date) function saveProductionDate($id, $date, $time)
{ {
$db = $GLOBALS['db']; $db = $GLOBALS['db'];
$date = date("Y-m-d", strtotime($date)); $parsedDate = date("Y-m-d", strtotime($date));
if ($date == '1970-01-01') { if ($parsedDate == '1970-01-01') {
$db->query("UPDATE productionScheduler SET production_date=NULL WHERE id='$id'"); $db->query("UPDATE productionScheduler SET production_date=NULL WHERE id='$id'");
} else { } else {
$db->query("UPDATE productionScheduler SET production_date='$date' WHERE id='$id'"); $parsetDateTime = date("Y-m-d H:i", strtotime($date . ' ' . $time));
$db->query("UPDATE productionScheduler SET production_date='$parsetDateTime' WHERE id='$id'");
} }
} }
@@ -453,3 +474,150 @@ function generateUuidV4()
$data[8] = chr(ord($data[8]) & 0x3f | 0x80); $data[8] = chr(ord($data[8]) & 0x3f | 0x80);
return vsprintf('%s%s-%s-%s-%s-%s%s%s', str_split(bin2hex($data), 4)); return vsprintf('%s%s-%s-%s-%s-%s%s%s', str_split(bin2hex($data), 4));
} }
function exportExcelWYSIWYG($tableDataJson)
{
if (function_exists('from_html')) {
$tableDataJson = from_html($tableDataJson);
}
$json = getJSONobj();
$rawData = $json->decode($tableDataJson);
if (isset($rawData['jsonObject']) && is_array($rawData['jsonObject'])) {
$tableData = $rawData['jsonObject'];
} else {
$tableData = $rawData;
}
if (empty($tableData) || !is_array($tableData)) {
header('Content-Type: application/json');
echo json_encode(array(
'success' => false,
'error' => 'Failed to decode table data. Type: ' . gettype($tableData)
));
return;
}
require_once 'modules/EcmReports/BimIT-Reports/lib/xlsxGenerator.php';
$xlsx = Shuchkin\SimpleXLSXGen::fromArray($tableData);
$xlsx_content = (string)$xlsx;
header('Content-Type: application/json');
echo json_encode(array(
'success' => true,
'fileContent' => base64_encode($xlsx_content),
'fileName' => 'harmonogram_produkcji.xlsx'
));
}
function updateProductionDate($ids, $hours) {
$db = $GLOBALS['db'];
$ids = explode("|", $ids);
foreach ($ids as $id) {
$res = $db->fetchByAssoc($db->query("SELECT production_date FROM productionScheduler WHERE id ='$id'"));
if ($res['production_date'] && $res['production_date'] != '0000-00-00 00:00:00') {
$newDate = calculateProductionDate($res['production_date'], $hours);
$db->query("UPDATE productionScheduler SET production_date='$newDate:00' WHERE id='$id'");
}
}
}
function calculateProductionDate($currentDateTime, $hoursToAdd) {
$WORK_START = 6 * 60;
$WORK_END = 14 * 60 + 30;
$date = new DateTime($currentDateTime);
$totalMinutesToAdd = $hoursToAdd * 60;
if ($totalMinutesToAdd > 0) {
while ($totalMinutesToAdd > 0) {
$dayOfWeek = $date->format('w');
if ($dayOfWeek == 0 || $dayOfWeek == 6) {
$date = getNextWorkDay($date);
continue;
}
$currentMinutes = $date->format('H') * 60 + $date->format('i');
if ($currentMinutes < $WORK_START) {
$date->setTime(6, 0, 0);
continue;
}
if ($currentMinutes >= $WORK_END) {
$date = getNextWorkDay($date);
continue;
}
$remainingMinutesToday = $WORK_END - $currentMinutes;
if ($totalMinutesToAdd <= $remainingMinutesToday) {
$date->modify('+' . $totalMinutesToAdd . ' minutes');
$totalMinutesToAdd = 0;
} else {
$totalMinutesToAdd -= $remainingMinutesToday;
$date = getNextWorkDay($date);
}
}
}
else if ($totalMinutesToAdd < 0) {
$totalMinutesToAdd = abs($totalMinutesToAdd);
while ($totalMinutesToAdd > 0) {
$dayOfWeek = $date->format('w');
if ($dayOfWeek == 0 || $dayOfWeek == 6) {
$date = getPreviousWorkDay($date);
continue;
}
$currentMinutes = $date->format('H') * 60 + $date->format('i');
if ($currentMinutes > $WORK_END) {
$date->setTime(14, 30, 0);
continue;
}
if ($currentMinutes <= $WORK_START) {
$date = getPreviousWorkDay($date);
continue;
}
$minutesFromStart = $currentMinutes - $WORK_START;
if ($totalMinutesToAdd <= $minutesFromStart) {
$date->modify('-' . $totalMinutesToAdd . ' minutes');
$totalMinutesToAdd = 0;
} else {
$totalMinutesToAdd -= $minutesFromStart;
$date = getPreviousWorkDay($date);
}
}
}
return $date->format('Y-m-d H:i');
}
function getNextWorkDay($date) {
$nextDay = clone $date;
$nextDay->modify('+1 day');
$nextDay->setTime(6, 0, 0);
while ($nextDay->format('w') == 0 || $nextDay->format('w') == 6) {
$nextDay->modify('+1 day');
}
return $nextDay;
}
function getPreviousWorkDay($date) {
$prevDay = clone $date;
$prevDay->modify('-1 day');
$prevDay->setTime(14, 30, 0);
while ($prevDay->format('w') == 0 || $prevDay->format('w') == 6) {
$prevDay->modify('-1 day');
}
return $prevDay;
}

View File

@@ -133,6 +133,7 @@
<input class="button" id="excelBtn" value="Excel" type="button"> <input class="button" id="excelBtn" value="Excel" type="button">
<input class="button" id="pdfBtn" value="PDF" type="button"> <input class="button" id="pdfBtn" value="PDF" type="button">
<input class="button" value="Utwórz przyjęcie produkcyjne" type="button" id="createInsideOrder"/> <input class="button" value="Utwórz przyjęcie produkcyjne" type="button" id="createInsideOrder"/>
<input class="button" id="changeDateBtn" value="Aktualizuj datę produkcji" type="button">
<table id="allTable"> <table id="allTable">
<thead> <thead>
<tr> <tr>
@@ -152,6 +153,8 @@
<th>Marka</th> <th>Marka</th>
<th>Data wysyłki</th> <th>Data wysyłki</th>
<th>Czynność</th> <th>Czynność</th>
<th>Linia</th>
<th>Czas</th>
<th>Uwagi</th> <th>Uwagi</th>
</tr> </tr>
</thead> </thead>
@@ -177,6 +180,7 @@
{$ROW.productName} {$ROW.productName}
</td> </td>
<td> <td>
<div style="white-space: nowrap">
<input id="production-date-{$ROW.id}" name="production-date-{$ROW.id}" type="text" <input id="production-date-{$ROW.id}" name="production-date-{$ROW.id}" type="text"
maxlength="10" size="11" tabindex="" title="" value="{$ROW.productionDate}" maxlength="10" size="11" tabindex="" title="" value="{$ROW.productionDate}"
autocomplete="off" autocomplete="off"
@@ -194,6 +198,10 @@
{rdelim} {rdelim}
); );
</script> </script>
</div>
<input type="text"
maxlength="10" size="11" tabindex="" title="" id="production-time-{$ROW.id}" name="production-time-{$ROW.id}"
autocomplete="off" value="{$ROW.productionTime}" onchange="saveProductionDate('{$ROW.id}')">
</td> </td>
<td style="white-space: nowrap;"> <td style="white-space: nowrap;">
<div id="edit-{$ROW.id}" class="ui-icon ui-icon-pencil" <div id="edit-{$ROW.id}" class="ui-icon ui-icon-pencil"
@@ -245,6 +253,12 @@
{$ROW.action_index} {$ROW.action_index}
</a> </a>
</td> </td>
<td>
{$ROW.action_category}
</td>
<td>
{$ROW.action_time}
</td>
<td> <td>
<div id="edit-description-{$ROW.id}" class="ui-icon ui-icon-pencil" <div id="edit-description-{$ROW.id}" class="ui-icon ui-icon-pencil"
onclick="editDescription('{$ROW.id}')" style="display: inline-block;"></div> onclick="editDescription('{$ROW.id}')" style="display: inline-block;"></div>
@@ -258,10 +272,19 @@
</tr> </tr>
{/foreach} {/foreach}
</tbody> </tbody>
<tfoot>
<tr>
<td colspan="17" style="text-align: right;"></td>
<td id="timeSummary"></td>
<td></td>
</tr>
</tfoot>
</table> </table>
</div> </div>
<div id="2" style="display: none"> <div id="2" style="display: none">
<br>
<input class="button" id="rawMaterialsExcelBtn" value="Excel" type="button">
<div id="rawMaterialsTableContainer"> <div id="rawMaterialsTableContainer">
</div> </div>
</div> </div>

View File

@@ -52,7 +52,8 @@ $(document).ready(function () {
try { try {
localStorage.setItem('productBySales_sort', localStorage.setItem('productBySales_sort',
$("#allTable")[0].config.sortList[0][0] + '|' + $("#allTable")[0].config.sortList[0][1]); $("#allTable")[0].config.sortList[0][0] + '|' + $("#allTable")[0].config.sortList[0][1]);
} catch { } } catch {
}
}); });
setTimeout(() => { setTimeout(() => {
@@ -66,7 +67,8 @@ $(document).ready(function () {
var tmp = sort.split('|'); var tmp = sort.split('|');
$("#allTable")[0].config.sortList = [[parseInt(tmp[0]), parseInt(tmp[1])]]; $("#allTable")[0].config.sortList = [[parseInt(tmp[0]), parseInt(tmp[1])]];
$.tablesorter.sortOn($("#allTable")[0].config, [[parseInt(tmp[0]), parseInt(tmp[1])]]); $.tablesorter.sortOn($("#allTable")[0].config, [[parseInt(tmp[0]), parseInt(tmp[1])]]);
} catch { } } catch {
}
} }
}, 500); }, 500);
@@ -119,6 +121,7 @@ var TabsMainBlock = false;
var Components; var Components;
var RawMaterials; var RawMaterials;
var OrderTypes var OrderTypes
function SetTab(tab_name) { function SetTab(tab_name) {
if (TabsMainBlock) return; if (TabsMainBlock) return;
var TabMenu = document.getElementById('groupTabsPanels'); var TabMenu = document.getElementById('groupTabsPanels');
@@ -157,6 +160,7 @@ function SetTab(tab_name) {
$("#hideReadyProducts").val() === "false" ? $("#toogleReadyProducts").val("Ukryj gotowe") : $("#toogleReadyProducts").val("Pokaz gotowe"); $("#hideReadyProducts").val() === "false" ? $("#toogleReadyProducts").val("Ukryj gotowe") : $("#toogleReadyProducts").val("Pokaz gotowe");
} }
} }
function getComnponents() { function getComnponents() {
var ids = []; var ids = [];
$('input.allCheck:checkbox:checked').each(function () { $('input.allCheck:checkbox:checked').each(function () {
@@ -191,6 +195,7 @@ function getComnponents() {
} }
}); });
} }
function drawComponents(data) { function drawComponents(data) {
$("#componentsTableContainer").html(componentsTablePrototype()); $("#componentsTableContainer").html(componentsTablePrototype());
data.forEach((el, index) => { data.forEach((el, index) => {
@@ -211,7 +216,7 @@ function drawComponents(data) {
tr.append("<td><a target=\"_blank\" href=\"index.php?module=EcmSales&action=DetailView&record=" + el.orderId + "\">" + el.orderNo + "</a></td>"); tr.append("<td><a target=\"_blank\" href=\"index.php?module=EcmSales&action=DetailView&record=" + el.orderId + "\">" + el.orderNo + "</a></td>");
tr.append("<td>" + el.orderType + "</td>"); tr.append("<td>" + el.orderType + "</td>");
tr.append("<td>" + el.orderStatus + "</td>"); tr.append("<td>" + el.orderStatus + "</td>");
tr.append("<td><a target=\"_blank\" href=\"index.php?module=EcmProducts&action=DetailView&record=" + el.mainProductId + "\">" + el.mainProductCode + "</a></td>"); tr.append("<td><a target=\"_blank\" href=\"index.php?module=EcmProducts&action=DetailView&record=" + el.mainProductId + "\">" + el.mainProductCode + "</a><input type=\"hidden\" value=" + el.mainProductId + " id=\"mainProductId-" + el.productId + "\"/></td>");
tr.append("<td>" + el.orderParent + "</td>"); tr.append("<td>" + el.orderParent + "</td>");
tr.append("<td>" + el.productShape + "</td>"); tr.append("<td>" + el.productShape + "</td>");
tr.append("<td>" + el.productBrand + "</td>"); tr.append("<td>" + el.productBrand + "</td>");
@@ -248,6 +253,7 @@ function drawComponents(data) {
} }
}); });
} }
function filterComponents() { function filterComponents() {
let filtered = Components; let filtered = Components;
if (!showReadyProducts) { if (!showReadyProducts) {
@@ -259,6 +265,7 @@ function filterComponents() {
drawComponents(filtered); drawComponents(filtered);
updateComponentsPositions(); updateComponentsPositions();
} }
function getRawMaterials(previousTab) { function getRawMaterials(previousTab) {
var ids = []; var ids = [];
if (previousTab === '1') { if (previousTab === '1') {
@@ -273,10 +280,13 @@ function getRawMaterials(previousTab) {
var tmp = []; var tmp = [];
ids.forEach(el => { ids.forEach(el => {
var qty = parseFloat($("#qty-" + el).html().trim()); var qty = parseFloat($("#qty-" + el).html().trim());
var mainId = $("#mainProductId-" + el).val();
var prod = {}; var prod = {};
prod.ecmproduct_id = el; prod.ecmproduct_id = el;
prod.quantity = qty; prod.quantity = qty;
if (el === mainId) {
tmp.push(prod); tmp.push(prod);
}
}); });
ids = tmp; ids = tmp;
} }
@@ -309,6 +319,7 @@ function getRawMaterials(previousTab) {
} }
}); });
} }
function drawRawMaterials(data) { function drawRawMaterials(data) {
$("#rawMaterialsTableContainer").html(rawMaterialsTablePrototype()); $("#rawMaterialsTableContainer").html(rawMaterialsTablePrototype());
data.forEach((el, index) => { data.forEach((el, index) => {
@@ -364,6 +375,7 @@ function drawRawMaterials(data) {
} }
}); });
} }
function filterRawMaterials() { function filterRawMaterials() {
let filtered = RawMaterials; let filtered = RawMaterials;
if (!showReadyProducts) { if (!showReadyProducts) {
@@ -375,6 +387,7 @@ function filterRawMaterials() {
drawRawMaterials(filtered); drawRawMaterials(filtered);
updateRawMaterialsPositions(); updateRawMaterialsPositions();
} }
function orderComponents() { function orderComponents() {
var ids = []; var ids = [];
$('input.componentCheck:checkbox:checked').each(function () { $('input.componentCheck:checkbox:checked').each(function () {
@@ -395,6 +408,7 @@ function orderComponents() {
$("#orderComponentsForm").submit(); $("#orderComponentsForm").submit();
} }
} }
function createInsideOrder() { function createInsideOrder() {
var ids = []; var ids = [];
$('input.allCheck:checkbox:checked').each(function () { $('input.allCheck:checkbox:checked').each(function () {
@@ -413,6 +427,7 @@ function createInsideOrder() {
$("#insideOrderProducts").val(products.join('*')); $("#insideOrderProducts").val(products.join('*'));
$("#createInsideOrderForm").submit(); $("#createInsideOrderForm").submit();
} }
function orderRawMaterials() { function orderRawMaterials() {
var ids = []; var ids = [];
$('input.rawMaterialCheck:checkbox:checked').each(function () { $('input.rawMaterialCheck:checkbox:checked').each(function () {
@@ -433,6 +448,7 @@ function orderRawMaterials() {
$("#orderRawMaterialsForm").submit(); $("#orderRawMaterialsForm").submit();
} }
} }
function showLoader(msg = "Pobieranie danych") { function showLoader(msg = "Pobieranie danych") {
$.blockUI({ $.blockUI({
@@ -450,9 +466,11 @@ function showLoader(msg = "Pobieranie danych") {
message: msg message: msg
}); });
} }
function hideLoader() { function hideLoader() {
$.unblockUI(); $.unblockUI();
} }
function updateAllPositions() { function updateAllPositions() {
var i = 0; var i = 0;
var sum = 0; var sum = 0;
@@ -465,6 +483,7 @@ function updateAllPositions() {
}); });
$("#allTableSum").html(sum); $("#allTableSum").html(sum);
} }
function updateComponentsPositions() { function updateComponentsPositions() {
var i = 0; var i = 0;
var sum = 0; var sum = 0;
@@ -477,6 +496,7 @@ function updateComponentsPositions() {
}); });
$("#componentsTableSum").html(Math.ceil(sum)); $("#componentsTableSum").html(Math.ceil(sum));
} }
function updateRawMaterialsPositions() { function updateRawMaterialsPositions() {
var i = 0; var i = 0;
var sum = 0; var sum = 0;
@@ -489,32 +509,34 @@ function updateRawMaterialsPositions() {
}); });
$("#rawMaterialsTableSum").html(Math.ceil(sum)); $("#rawMaterialsTableSum").html(Math.ceil(sum));
} }
function componentsTablePrototype() { function componentsTablePrototype() {
return '<table id="componentsTable"><thead><tr><th class="filter-false"><input type="checkbox" id="selectAllComponents" /></th><th>Pozycja</th><th>Indeks</th><th>Nazwa</th><th>Ilość</th><th>Stan</th><th>ZS E5</th><th>Typ</th><th>Status</th><th>Produkt główny</th><th>Odbiorca</th><th>Forma</th><th>Marka</th><th>Data wysyłki</th></tr></thead><tbody aria-live="polite" aria-relevant="all"></tbody><tfoot><tr><td colspan=4></td><td id="componentsTableSum">0</td><td colspan="9"></td></tr></tfoot></table>' return '<table id="componentsTable"><thead><tr><th class="filter-false"><input type="checkbox" id="selectAllComponents" /></th><th>Pozycja</th><th>Indeks</th><th>Nazwa</th><th>Ilość</th><th>Stan</th><th>ZS E5</th><th>Typ</th><th>Status</th><th>Produkt główny</th><th>Odbiorca</th><th>Forma</th><th>Marka</th><th>Data wysyłki</th></tr></thead><tbody aria-live="polite" aria-relevant="all"></tbody><tfoot><tr><td colspan=4></td><td id="componentsTableSum">0</td><td colspan="9"></td></tr></tfoot></table>'
} }
function rawMaterialsTablePrototype() { 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><th>Adres magazynowy</th></tr></thead><tbody aria-live="polite" aria-relevant="all"></tbody><tfoot><tr><td colspan=4></td><td id="rawMaterialsTableSum">0</td><td colspan="6"></td></tr></tfoot></table>' 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><th>Adres magazynowy</th></tr></thead><tbody aria-live="polite" aria-relevant="all"></tbody><tfoot><tr><td colspan=4></td><td id="rawMaterialsTableSum">0</td><td colspan="6"></td></tr></tfoot></table>'
} }
function addToProductionScheduler(orderItemId) { function addToProductionScheduler(orderItemId) {
showLoader("Trwa dodawanie elementu do harmonogramu produkcji..."); showLoader("Trwa dodawanie elementu do harmonogramu produkcji...");
$.ajax({ $.ajax({
method: "get", method: "get",
url: $(location).attr("href") + "&to_pdf=1&ajaxAction=addToProductionScheduler&itemId=" + orderItemId, url: $(location).attr("href") + "&to_pdf=1&ajaxAction=addToProductionScheduler&itemId=" + orderItemId,
success: function () success: function () {
{
hideLoader(); hideLoader();
$("#productScheduled-" + orderItemId).css('visibility', 'visible'); $("#productScheduled-" + orderItemId).css('visibility', 'visible');
window.alert("Dodano do harmonogramu produkcji."); window.alert("Dodano do harmonogramu produkcji.");
}, },
}); });
} }
function addComponentToProductionScheduler(productId, qty) { function addComponentToProductionScheduler(productId, qty) {
showLoader("Trwa dodawanie elementu do harmonogramu produkcji..."); showLoader("Trwa dodawanie elementu do harmonogramu produkcji...");
$.ajax({ $.ajax({
method: "get", method: "get",
url: $(location).attr("href") + "&to_pdf=1&ajaxAction=addComponentToProductionScheduler&productId=" + productId + "&qty=" + qty, url: $(location).attr("href") + "&to_pdf=1&ajaxAction=addComponentToProductionScheduler&productId=" + productId + "&qty=" + qty,
success: function () success: function () {
{
hideLoader(); hideLoader();
window.alert("Dodano do harmonogramu produkcji."); window.alert("Dodano do harmonogramu produkcji.");
}, },

View File

@@ -1,7 +1,7 @@
<?php <?php
ini_set('display_errors', 1); ini_set('display_errors', 0);
ini_set('display_startup_errors', 1); ini_set('display_startup_errors', 0);
error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED); //error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED);
$db = $GLOBALS['db']; $db = $GLOBALS['db'];
global $app_list_strings; global $app_list_strings;
@@ -135,10 +135,10 @@ if (!isset($_GET['ajaxAction'])) {
} else { } else {
switch ($_GET['ajaxAction']) { switch ($_GET['ajaxAction']) {
case 'getComponents': case 'getComponents':
echo getComponents2($_POST['ids']); getComponents3($_POST['ids']);
break; break;
case 'getRawMaterials': case 'getRawMaterials':
echo getRawMaterials2($_POST['ids'], $_POST['type']);; getRawMaterials2($_POST['ids'], $_POST['type']);;
break; break;
case 'saveProductDescription': case 'saveProductDescription':
saveProductDescription($_GET['itemId'], $_GET['description']); saveProductDescription($_GET['itemId'], $_GET['description']);
@@ -162,6 +162,7 @@ function findProduct($array, $value)
} }
return -1; return -1;
} }
function getComponents($ids, $dateFrom, $dateTo) function getComponents($ids, $dateFrom, $dateTo)
{ {
$db = $GLOBALS['db']; $db = $GLOBALS['db'];
@@ -236,6 +237,59 @@ function getComponents($ids, $dateFrom, $dateTo)
} }
echo json_encode($componentsData); echo json_encode($componentsData);
} }
function getComponents3($ids)
{
$db = $GLOBALS['db'];
global $app_list_strings;
$componentsData = array();
foreach ($ids as $id) {
$saleInfo = $db->fetchByAssoc($db->query("SELECT quantity, ecmproduct_id, description, ecmsale_id FROM ecmsaleitems WHERE id ='$id'"));
$saleQuery = "SELECT s.document_no, s.id, s.type, s.status, s.send_date, s.shipping_address_name
FROM ecmsales AS s
WHERE s.id = '" . $saleInfo['ecmsale_id'] . "'";
$saleData = $db->fetchByAssoc($db->query($saleQuery));
$products = array();
$products = array_merge(getProductComponents($saleInfo['ecmproduct_id'], $saleInfo['quantity']), $products);
$mainProduct = $db->fetchByAssoc($db->query(sprintf("SELECT code FROM ecmproducts WHERE id = '%s'", $saleInfo['ecmproduct_id'])));
foreach ($products as $product) {
$prodQuery = sprintf("SELECT p.id, p.code, p.name, p.shape, p.brand, p.ems_qty_in_stock,
p.vendor_part_no as kind, p.part_no as size
FROM ecmproducts AS p WHERE p.id = '%s' AND p.deleted = 0", $product['ecmproduct_id']);
$p = $db->fetchByAssoc($db->query($prodQuery));
$row = array();
$row['mainProductId'] = $saleInfo['ecmproduct_id'];
$row['mainProductCode'] = $mainProduct['code'];
$row['productId'] = $p['id'];
$row['productName'] = strlen($p['name']) > 55 ? substr($p['name'], 0, 55) . "..." : $p['name'];
$row['productFullName'] = $p['name'];
$row['productCode'] = strlen($p['code']) > 20 ? substr($p['code'], 0, 20) . "..." : $p['code'];
$row['productFullCode'] = $p['code'];
$row['productKind'] = $p['kind'] != null ? $p['kind'] : "";
$row['productSize'] = $p['size'];
$row['productShape'] = $app_list_strings['ecmproducts_shape_dom'][$p['shape']];
$row['productBrand'] = $app_list_strings['ecmproducts_brand_dom'][$p['brand']];
$row['productQty'] = $product['quantity'];
$row['productStockState'] = $p['ems_qty_in_stock'] | 0;
$row['orderNo'] = $saleData['document_no'];
$row['orderId'] = $saleData['id'];
$row['orderStatus'] = $app_list_strings['ecmsales_status_dom'][$saleData['status']];
$row['orderType'] = $app_list_strings['ecmsales_type_dom'][$saleData['type']];
$row['orderParent'] = (isset($saleData['shipping_address_name']) && $saleData['shipping_address_name'] != 'Adres korespondencyjny' ? $saleData['shipping_address_name'] : '');
$row['orderSendDate'] = $saleData['send_date'];
$componentsData[] = $row;
}
}
echo json_encode($componentsData);
}
function getRawMaterials2($ids, $type) function getRawMaterials2($ids, $type)
{ {
global $app_list_strings; global $app_list_strings;
@@ -246,7 +300,8 @@ function getRawMaterials2($ids, $type)
if ($type == 'sales') { if ($type == 'sales') {
$productsQuery = "SELECT si.ecmproduct_id, SUM(si.quantity) as quantity $productsQuery = "SELECT si.ecmproduct_id, SUM(si.quantity) as quantity
FROM ecmsaleitems AS si FROM ecmsaleitems AS si
WHERE si.id IN ('" . $idsString . "')"; WHERE si.id IN ('" . $idsString . "')
GROUP BY si.id";
$prows = $db->query($productsQuery); $prows = $db->query($productsQuery);
while ($p = $db->fetchByAssoc($prows)) { while ($p = $db->fetchByAssoc($prows)) {
$prod = array(); $prod = array();
@@ -258,18 +313,9 @@ function getRawMaterials2($ids, $type)
$products = $ids; $products = $ids;
} }
$grouppedProducts = array_reduce($products, function ($carry, $item) {
if (isset($carry[$item['ecmproduct_id']])) {
$carry[$item['ecmproduct_id']]['productQty'] += $item['quantity'];
} else {
$carry[$item['ecmproduct_id']] = $item;
}
return $carry;
});
$rawMaterialsData = array(); $rawMaterialsData = array();
foreach ($grouppedProducts as $product) { foreach ($products as $product) {
$rawMaterialsData = array_merge( $rawMaterialsData = array_merge(
$rawMaterialsData, $rawMaterialsData,
getProductRawMaterials($product['ecmproduct_id'], $product['quantity']) getProductRawMaterials($product['ecmproduct_id'], $product['quantity'])
@@ -278,7 +324,7 @@ function getRawMaterials2($ids, $type)
$grouppedRawMaterials = array_reduce($rawMaterialsData, function ($carry, $item) { $grouppedRawMaterials = array_reduce($rawMaterialsData, function ($carry, $item) {
if (isset($carry[$item['ecmproduct_id']])) { if (isset($carry[$item['ecmproduct_id']])) {
$carry[$item['ecmproduct_id']]['productQty'] += $item['quantity']; $carry[$item['ecmproduct_id']]['quantity'] += $item['quantity'];
} else { } else {
$carry[$item['ecmproduct_id']] = $item; $carry[$item['ecmproduct_id']] = $item;
} }
@@ -335,8 +381,9 @@ function getRawMaterials2($ids, $type)
$row['stockAddress'] = (!empty($product['stock_addresses'])) ? $product['stock_addresses'] : ""; $row['stockAddress'] = (!empty($product['stock_addresses'])) ? $product['stock_addresses'] : "";
$response[] = $row; $response[] = $row;
} }
return json_encode($response); echo json_encode($response);
} }
function getRawMaterials($ids, $cids) function getRawMaterials($ids, $cids)
{ {
$db = $GLOBALS['db']; $db = $GLOBALS['db'];
@@ -422,6 +469,7 @@ function getRawMaterials($ids, $cids)
echo json_encode($rawMaterialsData); echo json_encode($rawMaterialsData);
} }
function getProductRawMaterials($productId, $quantity) function getProductRawMaterials($productId, $quantity)
{ {
$db = $GLOBALS['db']; $db = $GLOBALS['db'];
@@ -456,6 +504,7 @@ WHERE
} }
return $response; return $response;
} }
function addToProductionScheduler($orderItemId) function addToProductionScheduler($orderItemId)
{ {
$db = $GLOBALS['db']; $db = $GLOBALS['db'];
@@ -484,6 +533,7 @@ function addToProductionScheduler($orderItemId)
$db->query($query); $db->query($query);
} }
} }
function addComponentToProductionScheduler($productId, $qty) function addComponentToProductionScheduler($productId, $qty)
{ {
$db = $GLOBALS['db']; $db = $GLOBALS['db'];
@@ -492,6 +542,7 @@ function addComponentToProductionScheduler($productId, $qty)
generateUuidV4(), $qty, $current_user->id, $current_user->id, $productId); generateUuidV4(), $qty, $current_user->id, $current_user->id, $productId);
$db->query($query); $db->query($query);
} }
function getComponents2($ids) function getComponents2($ids)
{ {
$db = $GLOBALS['db']; $db = $GLOBALS['db'];
@@ -538,41 +589,9 @@ function getComponents2($ids)
$componentsData[] = $row; $componentsData[] = $row;
} }
} }
return json_encode($componentsData); return json_encode($componentsData);
/*
* $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['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'];
$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;
$row['mainProductId'] = $r['main_product_id'];
$row['mainProductCode'] = $r['main_product_code'];
*
*/
} }
function getProductComponents($productId, $quantity) function getProductComponents($productId, $quantity)
{ {
$db = $GLOBALS['db']; $db = $GLOBALS['db'];
@@ -612,6 +631,7 @@ HAVING
return $response; return $response;
} }
} }
function generateUuidV4() function generateUuidV4()
{ {
$data = openssl_random_pseudo_bytes(16); $data = openssl_random_pseudo_bytes(16);

View File

@@ -117,6 +117,14 @@ while ( $r = $db->fetchByAssoc ( $rows ) ) {
$row["quantity"] = $r["quantity"]; $row["quantity"] = $r["quantity"];
$row["price"] = $r["price"]; $row["price"] = $r["price"];
// stock addresses
$a = $db->query("SELECT stock_address FROM ecmproducts_stock_addresses WHERE ecmproduct_id='" . $r['id'] . "' ORDER BY stock_address");
$addresses = array();
while ($addr = $db->fetchByAssoc($a)) {
$addresses[] = $addr['stock_address'];
}
$row['stock_address'] = implode(", ", $addresses);
$querySubCategory = "SELECT category.name as 'podkategoria' $querySubCategory = "SELECT category.name as 'podkategoria'
FROM FROM
ecmproductcategories_bean bean ecmproductcategories_bean bean
@@ -153,7 +161,8 @@ while ( $r = $db->fetchByAssoc ( $rows ) ) {
foreach ($data as $key => &$element) { foreach ($data as $key => &$element) {
$categoryArray1[$element["kategoria"] == "" ? "Inne" : $element["kategoria"]][$element["podkategoria"] == "" ? "Reszta" : $element["podkategoria"]][$key] = $element; $categoryArray1[$element["kategoria"] == "" ? "Inne" : $element["kategoria"]][$element["podkategoria"] == "" ? "Reszta" : $element["podkategoria"]][$key] = $element;
} }
function cmp($a, $b) { function cmp($a, $b)
{
if ($a["name"] == $b["name"]) { if ($a["name"] == $b["name"]) {
return 0; return 0;
} }
@@ -180,6 +189,7 @@ foreach ( $categoryArray1 as $key1 => &$element1 ) {
$tmp2[$key1][$key2][$i]["id"] = $element3["id"]; $tmp2[$key1][$key2][$i]["id"] = $element3["id"];
$tmp2[$key1][$key2][$i]["name"] = $element3["name"]; $tmp2[$key1][$key2][$i]["name"] = $element3["name"];
$tmp2[$key1][$key2][$i]["code"] = $element3["code"]; $tmp2[$key1][$key2][$i]["code"] = $element3["code"];
$tmp2[$key1][$key2][$i]["stock_address"] = $element3["stock_address"];
$tmp2[$key1][$key2][$i]["quantity"] = $element3["quantity"]; $tmp2[$key1][$key2][$i]["quantity"] = $element3["quantity"];
$tmp2[$key1][$key2][$i]["price"] = $element3["price"]; $tmp2[$key1][$key2][$i]["price"] = $element3["price"];
} }
@@ -286,5 +296,3 @@ $smarty->assign ('selectKS',$_GET['productKS']);
$smarty->assign("selectProductActive", $selectProductActive); $smarty->assign("selectProductActive", $selectProductActive);
$smarty->assign("selectProductEol", $selectProductEol); $smarty->assign("selectProductEol", $selectProductEol);
echo $smarty->display('modules/EcmReports/tpls/ReportStocks.tpl'); echo $smarty->display('modules/EcmReports/tpls/ReportStocks.tpl');
?>

View File

@@ -48,6 +48,7 @@
background: #EFEFF1; background: #EFEFF1;
color: #343432; color: #343432;
} }
table.tablesorter tbody tr.alt-row td { table.tablesorter tbody tr.alt-row td {
background: #FFF; background: #FFF;
color: #343432; color: #343432;
@@ -58,21 +59,25 @@
background: #E8E8E8; background: #E8E8E8;
color: #343432; color: #343432;
} }
table.tablesorter tbody tr.alt-row:hover td { table.tablesorter tbody tr.alt-row:hover td {
background: #E8E8E8; background: #E8E8E8;
color: #343432; color: #343432;
} }
table.tablesorter tbody tr.sumAll td { table.tablesorter tbody tr.sumAll td {
background: #EBEBED; background: #EBEBED;
color: black; color: black;
} }
table.tablesorter tbody tr.sumAll:hover td { table.tablesorter tbody tr.sumAll:hover td {
background: #E0E0E2; background: #E0E0E2;
color: black; color: black;
font-weight: bold; font-weight: bold;
} }
table.tablesorter .sumRow, .oddListRowS1 { table.tablesorter .sumRow,
.oddListRowS1 {
text-align: right; text-align: right;
} }
@@ -102,7 +107,8 @@
<tbody> <tbody>
<tr> <tr>
<td> <td>
<img src="themes/Sugar/images/EcmProducts.gif" style="margin-top: 3px; margin-right: 3px;" alt="EcmProducts" width="16" border="0" height="16"> <img src="themes/Sugar/images/EcmProducts.gif" style="margin-top: 3px; margin-right: 3px;"
alt="EcmProducts" width="16" border="0" height="16">
</td> </td>
<td> <td>
<h2>{$MOD.LBL_REPORT_STOCKS} </h2> <h2>{$MOD.LBL_REPORT_STOCKS} </h2>
@@ -120,7 +126,8 @@
<form action="index.php" method="get" name="searchReportStocks"> <form action="index.php" method="get" name="searchReportStocks">
<input type="hidden" name="module" value="EcmReports" /> <input type="hidden" name="module" value="EcmReports" />
<input type="hidden" name="action" value="ReportStocks" /> <input type="hidden" name="action" value="ReportStocks" />
<table style="border-top: 0px none; margin-bottom: 4px;width:100%" class="tabForm" border="0" cellpadding="0" cellspacing="0"> <table style="border-top: 0px none; margin-bottom: 4px;width:100%" class="tabForm" border="0" cellpadding="0"
cellspacing="0">
<tr> <tr>
<td class="dataLabel" width="5%" nowrap="nowrap">{$MOD.LBL_STOCK}</td> <td class="dataLabel" width="5%" nowrap="nowrap">{$MOD.LBL_STOCK}</td>
@@ -128,7 +135,8 @@
<select id="stock" name="selectStock"> <select id="stock" name="selectStock">
<option value="" { if $selectStock=="" } selected="true" {/if}>{$MOD.LBL_ALL_STOCKS}</option> <option value="" { if $selectStock=="" } selected="true" {/if}>{$MOD.LBL_ALL_STOCKS}</option>
{foreach from=$STOCKS item=STOCK key=count name=loop} {foreach from=$STOCKS item=STOCK key=count name=loop}
<option value="{$STOCK.id}" { if $selectStock==$STOCK.id} selected="true" {/if} >{$STOCK.name}</option> <option value="{$STOCK.id}" { if $selectStock==$STOCK.id} selected="true" {/if}>{$STOCK.name}
</option>
{/foreach} {/foreach}
</select> </select>
</td> </td>
@@ -137,7 +145,8 @@
<td class="dataLabel" width="5%" nowrap="nowrap">{$MOD.LBL_PRODUCT_ACTIVE}</td> <td class="dataLabel" width="5%" nowrap="nowrap">{$MOD.LBL_PRODUCT_ACTIVE}</td>
<td class="dataField" width="10%" nowrap="nowrap"> <td class="dataField" width="10%" nowrap="nowrap">
<select id="productActive" name="selectProductActive"> <select id="productActive" name="selectProductActive">
<option value="" { if $selectProductActive==""} selected="true" {/if} >{$MOD.LBL_YES}/{$MOD.LBL_NO}</option> <option value="" { if $selectProductActive=="" } selected="true" {/if}>{$MOD.LBL_YES}/{$MOD.LBL_NO}
</option>
<option value="1" { if $selectProductActive=="1" } selected="true" {/if}>{$MOD.LBL_YES}</option> <option value="1" { if $selectProductActive=="1" } selected="true" {/if}>{$MOD.LBL_YES}</option>
<option value="0" { if $selectProductActive=="0" } selected="true" {/if}>{$MOD.LBL_NO}</option> <option value="0" { if $selectProductActive=="0" } selected="true" {/if}>{$MOD.LBL_NO}</option>
</select> </select>
@@ -146,7 +155,8 @@
<td class="dataLabel" width="5%" nowrap="nowrap">End of line</td> <td class="dataLabel" width="5%" nowrap="nowrap">End of line</td>
<td class="dataField" width="10%" nowrap="nowrap"> <td class="dataField" width="10%" nowrap="nowrap">
<select id="productEol" name="selectProductEol"> <select id="productEol" name="selectProductEol">
<option value="" { if $selectProductEol==""} selected="true" {/if} >{$MOD.LBL_YES}/{$MOD.LBL_NO}</option> <option value="" { if $selectProductEol=="" } selected="true" {/if}>{$MOD.LBL_YES}/{$MOD.LBL_NO}
</option>
<option value="1" { if $selectProductEol=="1" } selected="true" {/if}>{$MOD.LBL_YES}</option> <option value="1" { if $selectProductEol=="1" } selected="true" {/if}>{$MOD.LBL_YES}</option>
<option value="0" { if $selectProductEol=="0" } selected="true" {/if}>{$MOD.LBL_NO}</option> <option value="0" { if $selectProductEol=="0" } selected="true" {/if}>{$MOD.LBL_NO}</option>
</select> </select>
@@ -179,7 +189,8 @@
</table> </table>
<input class="button" name="submit" value="{$MOD.LBL_EXECUTE}" type="submit"> <input class="button" name="submit" value="{$MOD.LBL_EXECUTE}" type="submit">
<input class="button" name="clear" value="{$MOD.LBL_CLEAR}" type="button" onclick="location.href='index.php?module=EcmReports&action=ReportSales';"> <input class="button" name="clear" value="{$MOD.LBL_CLEAR}" type="button"
onclick="location.href='index.php?module=EcmReports&action=ReportSales';">
<input id="excelEksport" class="button" name="importToExcel" value="{$MOD.BTN_EXCEL_EXPORT}" type="button"> <input id="excelEksport" class="button" name="importToExcel" value="{$MOD.BTN_EXCEL_EXPORT}" type="button">
@@ -190,11 +201,30 @@
<thead> <thead>
<tr class="tablesorter-headerRow" role="row"> <tr class="tablesorter-headerRow" role="row">
<th width="30%" class="sorter-text tablesorter-header tablesorter-headerUnSorted" data-column="0" tabindex="0" scope="col" role="columnheader" aria-disabled="false" unselectable="on" style="-moz-user-select: none;" aria-sort="none" aria-label="Name: No sort applied, activate to apply an ascending sort">{$MOD.LBL_PRODUCTS}</th> <th width="30%" class="sorter-text tablesorter-header tablesorter-headerUnSorted" data-column="0"
<th width="10%" class="sorter-text tablesorter-header tablesorter-headerUnSorted" data-column="1" tabindex="0" scope="col" role="columnheader" aria-disabled="false" unselectable="on" style="-moz-user-select: none;" aria-sort="none" aria-label="Name: No sort applied, activate to apply an ascending sort">{$MOD.LBL_INDEX}</th> tabindex="0" scope="col" role="columnheader" aria-disabled="false" unselectable="on"
<th width="8%" class="sorter-saas tablesorter-header tablesorter-headerUnSorted" data-column="5" tabindex="0" scope="col" role="columnheader" aria-disabled="false" unselectable="on" style="-moz-user-select: none;" aria-sort="none" aria-label="Name: No sort applied, activate to apply an ascending sort">{$MOD.LBL_QUANTITY}</th> style="-moz-user-select: none;" aria-sort="none"
<th width="8%" class="sorter-saas tablesorter-header tablesorter-headerUnSorted" data-column="6" tabindex="0" scope="col" role="columnheader" aria-disabled="false" unselectable="on" style="-moz-user-select: none;" aria-sort="none" aria-label="Name: No sort applied, activate to apply an ascending sort">{$MOD.LBL_VALUE}</th> aria-label="Name: No sort applied, activate to apply an ascending sort">{$MOD.LBL_PRODUCTS}</th>
<th width="8%" class="sorter-saas tablesorter-header tablesorter-headerUnSorted" data-column="6" tabindex="0" scope="col" role="columnheader" aria-disabled="false" unselectable="on" style="-moz-user-select: none;" aria-sort="none" aria-label="Name: No sort applied, activate to apply an ascending sort">Średnia Cena</th> <th width="4%" class="sorter-text tablesorter-header tablesorter-headerUnSorted" data-column="1"
tabindex="0" scope="col" role="columnheader" aria-disabled="false" unselectable="on"
style="-moz-user-select: none;" aria-sort="none"
aria-label="Name: No sort applied, activate to apply an ascending sort">{$MOD.LBL_INDEX}</th>
<th width="6%" class="sorter-text tablesorter-header tablesorter-headerUnSorted" data-column="1"
tabindex="0" scope="col" role="columnheader" aria-disabled="false" unselectable="on"
style="-moz-user-select: none;" aria-sort="none"
aria-label="Name: No sort applied, activate to apply an ascending sort">Adres magazynowy</th>
<th width="8%" class="sorter-saas tablesorter-header tablesorter-headerUnSorted" data-column="5"
tabindex="0" scope="col" role="columnheader" aria-disabled="false" unselectable="on"
style="-moz-user-select: none;" aria-sort="none"
aria-label="Name: No sort applied, activate to apply an ascending sort">{$MOD.LBL_QUANTITY}</th>
<th width="8%" class="sorter-saas tablesorter-header tablesorter-headerUnSorted" data-column="6"
tabindex="0" scope="col" role="columnheader" aria-disabled="false" unselectable="on"
style="-moz-user-select: none;" aria-sort="none"
aria-label="Name: No sort applied, activate to apply an ascending sort">{$MOD.LBL_VALUE}</th>
<th width="8%" class="sorter-saas tablesorter-header tablesorter-headerUnSorted" data-column="6"
tabindex="0" scope="col" role="columnheader" aria-disabled="false" unselectable="on"
style="-moz-user-select: none;" aria-sort="none"
aria-label="Name: No sort applied, activate to apply an ascending sort">Średnia Cena</th>
</tr> </tr>
</thead> </thead>
{foreach from=$DATA item=CAT key=CATNAME name=loop} {foreach from=$DATA item=CAT key=CATNAME name=loop}
@@ -205,20 +235,26 @@
<td class="oddListRowS1 alignLeft"><a class="plusStyle showTables">[+]</a><b> {$CATNAME}</b></td> <td class="oddListRowS1 alignLeft"><a class="plusStyle showTables">[+]</a><b> {$CATNAME}</b></td>
{/if} {/if}
<td class="oddListRowS1"></td> <td class="oddListRowS1"></td>
<td class="oddListRowS1"></td>
<td class="oddListRowS1 sumRow"><b>{$DATA.$CATNAME.QuantitySum|number_format:4:",":"." }</b></td> <td class="oddListRowS1 sumRow"><b>{$DATA.$CATNAME.QuantitySum|number_format:4:",":"." }</b></td>
<td class="oddListRowS1 sumRow"><b>{$DATA.$CATNAME.PriceSum|number_format:2:",":"." }</b></td> <td class="oddListRowS1 sumRow"><b>{$DATA.$CATNAME.PriceSum|number_format:2:",":"." }</b></td>
<td class="oddListRowS1 sumRow" ><b>{$DATA.$CATNAME.PriceSum/$DATA.$CATNAME.QuantitySum|number_format:2:",":"." }</b></td> <td class="oddListRowS1 sumRow">
<b>{$DATA.$CATNAME.PriceSum/$DATA.$CATNAME.QuantitySum|number_format:2:",":"." }</b></td>
</tr> </tr>
</tbody> </tbody>
{foreach from=$CAT item=CAT2 key=CAT2NAME name=loop} {foreach from=$CAT item=CAT2 key=CAT2NAME name=loop}
{if $CAT2NAME!="QuantitySum" && $CAT2NAME!="PriceSum"} {if $CAT2NAME!="QuantitySum" && $CAT2NAME!="PriceSum"}
<tbody id="functions-core" class="tablesorter-infoOnly tablesShowHide"> <tbody id="functions-core" class="tablesorter-infoOnly tablesShowHide">
<tr class="subcategory"> <tr class="subcategory">
<td class="oddListRowS1 alignLeft"><a class="showRows" style="color: cadetblue; text-decoration: none; cursor: pointer;">[+]</a><b> {$CAT2NAME}</b></td> <td class="oddListRowS1 alignLeft"><a class="showRows"
style="color: cadetblue; text-decoration: none; cursor: pointer;">[+]</a><b> {$CAT2NAME}</b>
</td>
<td class="oddListRowS1"></td>
<td class="oddListRowS1"></td> <td class="oddListRowS1"></td>
<td class="oddListRowS1 sumRow"><b>{$CAT.$CAT2NAME.QuantitySum2|number_format:4:",":"." }</b></td> <td class="oddListRowS1 sumRow"><b>{$CAT.$CAT2NAME.QuantitySum2|number_format:4:",":"." }</b></td>
<td class="oddListRowS1 sumRow"><b>{$CAT.$CAT2NAME.PriceSum2|number_format:2:",":"." }</b></td> <td class="oddListRowS1 sumRow"><b>{$CAT.$CAT2NAME.PriceSum2|number_format:2:",":"." }</b></td>
<td class="oddListRowS1 sumRow" ><b>{$CAT.$CAT2NAME.PriceSum2/$CAT.$CAT2NAME.QuantitySum2|number_format:2:",":"." }</b></td> <td class="oddListRowS1 sumRow">
<b>{$CAT.$CAT2NAME.PriceSum2/$CAT.$CAT2NAME.QuantitySum2|number_format:2:",":"." }</b></td>
</tr> </tr>
</tbody> </tbody>
@@ -232,11 +268,13 @@
{/if} {/if}
<td class="oddListRowS1 alignLeft" style="text-align:left;"> <td class="oddListRowS1 alignLeft" style="text-align:left;">
<a target="new" href="index.php?module=EcmProducts&action=index&return_module=EcmProducts&action=DetailView&record={$ROW.id}"> <a target="new"
href="index.php?module=EcmProducts&action=index&return_module=EcmProducts&action=DetailView&record={$ROW.id}">
{$ROW.name} {$ROW.name}
</a> </a>
</td> </td>
<td class="oddListRowS1 alignLeft">{$ROW.code}</td> <td class="oddListRowS1 alignLeft">{$ROW.code}</td>
<td class="oddListRowS1">{$ROW.stock_address}</td>
<td class="oddListRowS1">{$ROW.quantity|number_format:4:",":"."}</td> <td class="oddListRowS1">{$ROW.quantity|number_format:4:",":"."}</td>
<td class="oddListRowS1">{$ROW.price|number_format:2:",":"."}</td> <td class="oddListRowS1">{$ROW.price|number_format:2:",":"."}</td>
<td class="oddListRowS1">{$ROW.price/$ROW.quantity|number_format:2:",":"."}</td> <td class="oddListRowS1">{$ROW.price/$ROW.quantity|number_format:2:",":"."}</td>
@@ -253,9 +291,11 @@
<tr class="static category sumAll"> <tr class="static category sumAll">
<td class="oddListRowS1 alignLeft"><b>{$MOD.LBL_SUM}:</b></td> <td class="oddListRowS1 alignLeft"><b>{$MOD.LBL_SUM}:</b></td>
<td class="oddListRowS1"></td> <td class="oddListRowS1"></td>
<td class="oddListRowS1"></td>
<td class="oddListRowS1 sumRow"><b>{$SUM.QuantitySumSum|number_format:4:",":"." }</b></td> <td class="oddListRowS1 sumRow"><b>{$SUM.QuantitySumSum|number_format:4:",":"." }</b></td>
<td class="oddListRowS1 sumRow"><b>{$SUM.PriceSumSum|number_format:2:",":"." }</b></td> <td class="oddListRowS1 sumRow"><b>{$SUM.PriceSumSum|number_format:2:",":"." }</b></td>
<td class="oddListRowS1 sumRow" ><b>{$SUM.PriceSumSum/$SUM.QuantitySumSum|number_format:2:",":"." }</b></td> <td class="oddListRowS1 sumRow"><b>{$SUM.PriceSumSum/$SUM.QuantitySumSum|number_format:2:",":"." }</b>
</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>

View File

@@ -76,7 +76,7 @@ if (
$r = $db->fetchByAssoc ( $rows ); $r = $db->fetchByAssoc ( $rows );
if($r['id']!='')$can_edit=false; if($r['id']!='')$can_edit=false;
$edit->ss->assign("CAN_EDIT", $can_edit); $edit->ss->assign("CAN_EDIT", true);
$edit->ss->assign("CREATED_BY_NAME", $focus->created_by_name); $edit->ss->assign("CREATED_BY_NAME", $focus->created_by_name);
$edit->ss->assign("MODIFIED_BY_NAME", $focus->modified_by_name); $edit->ss->assign("MODIFIED_BY_NAME", $focus->modified_by_name);

View File

@@ -864,7 +864,7 @@ class EcmSale extends SugarBean
$where = " and " . implode(" and ", $field_array); $where = " and " . implode(" and ", $field_array);
else else
$where = ""; $where = "";
$z = "select * from ecmsales where deleted='0' and status!='s10' " . $where . " ORDER BY send_date DESC"; $z = "select * from ecmsales where deleted='0' and status!='s10' " . $where . " ORDER BY send_date";
return $z; return $z;
} }
@@ -1059,6 +1059,16 @@ class EcmSale extends SugarBean
$result_array[$i]['total_invoice'] = $total_invoice; $result_array[$i]['total_invoice'] = $total_invoice;
$result_array[$i]['percent'] = $percent; $result_array[$i]['percent'] = $percent;
$result_array[$i]['currency'] = $r['currency_id']; $result_array[$i]['currency'] = $r['currency_id'];
$result_array[$i]['delivery_name'] = null;
if (strlen($r['shipping_address_name']) > 0) {
$result_array[$i]['delivery_name'] = $r['shipping_address_name'];
$d = $db->fetchByAssoc($db->query(sprintf("SELECT id, TRIM(name) FROM accounts WHERE name LIKE '%s' AND deleted=0", strtolower(trim($r['shipping_address_name'])))));
if ($d && $d['id']) {
$result_array[$i]['delivery_id'] = $d['id'];
}
}
$i++; $i++;
$sum_total_qty += $total_qty; $sum_total_qty += $total_qty;

View File

@@ -2,8 +2,6 @@
if (!defined('sugarEntry') || !sugarEntry) if (!defined('sugarEntry') || !sugarEntry)
die ('Not A Valid Entry Point'); die ('Not A Valid Entry Point');
// require_once('modules/EcmGroupSales/HeaderMenu.php');
global $sugar_version, $sugar_config, $current_user, $app_strings, $mod_strings; global $sugar_version, $sugar_config, $current_user, $app_strings, $mod_strings;
require_once('modules/EcmInsideOrders/EcmInsideOrder.php'); require_once('modules/EcmInsideOrders/EcmInsideOrder.php');
@@ -12,95 +10,120 @@ require_once ('include/json_config.php');
// add jquery // add jquery
echo '<link rel="stylesheet" type="text/css" href="modules/EcmSales/css/style.css"/>'; echo '<link rel="stylesheet" type="text/css" href="modules/EcmSales/css/style.css"/>';
echo '<script type="text/javascript" echo '<script type="text/javascript" src="include/jQuery/jquery-lastes.js"></script>';
src="include/jQuery/jquery-lastes.js"></script>'; echo '<script type="text/javascript" src="include/jQuery/jquery.tablesorter.pager.js"></script>';
echo '<script type="text/javascript" echo '<script type="text/javascript" src="modules/EcmSales/javascript/ProductSummary.js"></script>';
src="include/jQuery/jquery.tablesorter.pager.js"></script>';
echo '<script type="text/javascript"
src="modules/EcmSales/javascript/ProductSummary.js"></script>';
$json_config = new json_config (); $json_config = new json_config ();
$focus = new EcmSale (); $focus = new EcmSale ();
$db = $GLOBALS['db']; $db = $GLOBALS['db'];
$data = array();
$categoryArray=array();
$id_array= explode(",", $_GET['ids']) ;
//var_dump($id_array); $positions = array();
$total = 0;
$stock = 0;
$id_array = isset($_GET['ids']) ? explode(",", $_GET['ids']) : array();
$where = "and doc.id IN ('" . implode("','", $id_array) . "')"; $where = "and doc.id IN ('" . implode("','", $id_array) . "')";
if($_GET['product_group']=='1')$where.=" and pr.group_ks=1"; if (isset($_GET['product_group']) && $_GET['product_group'] == '1') $where .= " and pr.group_ks=1";
if($_GET['product_group']=='2')$where.=" and pr.group_ks=2"; if (isset($_GET['product_group']) && $_GET['product_group'] == '2') $where .= " and pr.group_ks=2";
if($_GET['product_group']=='3')$where.=" and pr.group_ks=3"; if (isset($_GET['product_group']) && $_GET['product_group'] == '3') $where .= " and pr.group_ks=3";
$query = "SELECT $query = "SELECT
pr.id, pr.id,
item.code, item.code,
item.name, item.name,
ROUND(sum(item.quantity),0) AS quantity, ROUND(SUM(item.quantity),0) AS quantity,
ROUND(ifnull(x.stock, 0),0) AS stock, ROUND(IFNULL(x.stock, 0),0) AS stock,
pr.group_ks, pr.group_ks,
pr.product_category_name, pr.product_category_name,
pr.product_category_id pr.product_category_id
FROM FROM ecmsaleitems AS item
ecmsaleitems as item INNER JOIN ecmsales AS doc ON doc.id=item.ecmsale_id
INNER JOIN INNER JOIN ecmproducts AS pr ON pr.id=item.ecmproduct_id
ecmsales as doc ON doc.id=item.ecmsale_id LEFT JOIN (
INNER JOIN SELECT SUM(quantity) AS stock, product_id
ecmproducts as pr ON pr.id=item.ecmproduct_id FROM ecmstockstates
LEFT JOIN GROUP BY product_id
(SELECT sum(quantity) as stock ,product_id ) x ON x.product_id=item.ecmproduct_id
FROM WHERE doc.deleted='0' AND doc.status!='s10' " . $where . "
ecmstockstates AND NOT EXISTS (
GROUP BY product_id) x ON x.product_id=item.ecmproduct_id
WHERE doc.deleted='0' and doc.status!='s10' " . $where;
$query.=" AND NOT EXISTS
(
SELECT NULL SELECT NULL
FROM ecmstockdocouts t1 FROM ecmstockdocouts t1
WHERE t1.ecmsale_id = doc.id WHERE t1.ecmsale_id = doc.id
) GROUP by item.ecmproduct_id )
GROUP BY item.ecmproduct_id
ORDER BY pr.group_ks DESC"; ORDER BY pr.group_ks DESC";
$rows = $db->query($query); $rows = $db->query($query);
while($r = $db->fetchByAssoc ( $rows )) while ($r = $db->fetchByAssoc($rows)) {
{
$row = array(); $row = array();
$row["id"] = $r["id"]; $row['id'] = $r['id'];
$row["code"] = $r["code"]; $row['code'] = $r['code'];
$row["name"] = $r["name"]; $row['name'] = $r['name'];
$row["quantity"] = $r["quantity"]; $row['quantity'] = $r['quantity'];
$row["stock"] = $r["stock"]; $row['stock'] = $r['stock'];
$row["product_category_name"]=$r["product_category_name"]; $row['product_category_name'] = $r['product_category_name'];
$row["group_ks"] = $r["group_ks"]; $row['group_ks'] = $r['group_ks'];
if($r["group_ks"]=='1')$daj='TH';
if($r["group_ks"]=='2')$daj='WG';
if($r["group_ks"]=='3')$daj='S';
$row["group_ks_name"] = $daj;
$daj = '';
if ($r['group_ks'] == '1') $daj = 'TH';
if ($r['group_ks'] == '2') $daj = 'WG';
if ($r['group_ks'] == '3') $daj = 'S';
$row['group_ks_name'] = $daj;
// get stock addresses $result = $db->query("SELECT stock_address, is_not_full FROM ecmproducts_stock_addresses WHERE ecmproduct_id='" . $r['id'] . "' ORDER BY stock_address");
$result = $db->query("SELECT stock_address, is_not_full FROM ecmproducts_stock_addresses WHERE ecmproduct_id='".$r['id']."';"); $addresses_raw = array();
$stock_addresses = "";
while ($addr = $db->fetchByAssoc($result)) { while ($addr = $db->fetchByAssoc($result)) {
if ($addr['is_not_full'] == '1') { $addresses_raw[] = array(
$stock_addresses .= " <span style='color: red;'>".$addr['stock_address']."</span>"; 'addr' => trim($addr['stock_address']),
} else { 'not_full' => ($addr['is_not_full'] == '1')
$stock_addresses .= " ".$addr['stock_address']; );
} }
}
$row['stock_addresses'] = $stock_addresses;
array_push($row, $r); if (!empty($addresses_raw)) {
$data [] = $row; usort($addresses_raw, function ($a, $b) {
$total+=$r['quantity']; return strcmp($a['addr'], $b['addr']);
$stock+=$r['stock']; });
} }
$only_addrs = array();
$has_not_full = 0;
foreach ($addresses_raw as $ar) {
$only_addrs[] = $ar['addr'];
if ($ar['not_full']) $has_not_full = 1;
}
$row['stock_addresses_sort_key'] = implode(' ', $only_addrs);
$row['has_not_full'] = $has_not_full;
$stock_addresses_html = '';
foreach ($addresses_raw as $ar) {
if ($ar['not_full']) {
$stock_addresses_html .= " <span style='color: red;'>" . $ar['addr'] . "</span>";
} else {
$stock_addresses_html .= " " . $ar['addr'];
}
}
$row['stock_addresses'] = $stock_addresses_html;
$positions[] = $row;
$total += (float)$r['quantity'];
$stock += (float)$r['stock'];
}
usort($positions, function ($a, $b) {
$ka = isset($a['stock_addresses_sort_key']) ? $a['stock_addresses_sort_key'] : '';
$kb = isset($b['stock_addresses_sort_key']) ? $b['stock_addresses_sort_key'] : '';
return strcmp($ka, $kb);
});
$data = $positions;
$data['quantity'] = $total; $data['quantity'] = $total;
$data['stock'] = $stock; $data['stock'] = $stock;
if (!isset($_REQUEST['to_pdf'])) {
$edit->ss = new Sugar_Smarty(); $edit->ss = new Sugar_Smarty();
$edit->module = 'EcmSales'; $edit->module = 'EcmSales';
@@ -108,13 +131,20 @@ $edit->ss->assign ( "CREATED_BY_NAME", $focus->created_by_name );
$edit->ss->assign("MODIFIED_BY_NAME", $focus->modified_by_name); $edit->ss->assign("MODIFIED_BY_NAME", $focus->modified_by_name);
$edit->ss->assign('FOCUS', $focus); $edit->ss->assign('FOCUS', $focus);
$edit->ss->assign('POST', $_POST); $edit->ss->assign('POST', $_POST);
$edit->ss->assign ( 'LINK', $link); $edit->ss->assign('LINK', isset($link) ? $link : '');
$edit->ss->assign ( 'IDS', $_GET['ids']); $edit->ss->assign('IDS', isset($_GET['ids']) ? $_GET['ids'] : '');
$edit->ss->assign('POSITION_LIST', $data); $edit->ss->assign('POSITION_LIST', $data);
$edit->ss->assign('MOD', $mod_strings); $edit->ss->assign('MOD', $mod_strings);
$edit->ss-> display('modules/EcmSales/tpls/ProductSummary.tpl'); //4 $edit->ss->display('modules/EcmSales/tpls/ProductSummary.tpl');
} else {
$t = '<table style="border: 1px solid black; border-collapse: collapse;"><tr><td><b>Kod</b></td><td><b>Nazwa</b></td><td><b>Ilość</b></td><td><b>Adres magazynowy</b></td></tr>';
foreach ($data as $r) {
if (isset($r['code'])) {
$t .= '<tr><td style="border: 1px solid black;">' . $r['code'] . '</td><td style="border: 1px solid black;">' . $r['name'] . '</td><td style="border: 1px solid black;">' . $r['quantity'] . '</td><td style="border: 1px solid black;">' . $r['stock_addresses'] . '</td></tr>';
}
}
$t .= '</table>';
// loading view echo $t;
//echo '<link rel="stylesheet" type="text/css" href="modules/EcmInsideOrders/javascript/helper.css" media="screen" /><div class="loading_panel"></div>'; }
?>

View File

@@ -109,7 +109,7 @@ $(document).ready(
SetTab('ITEMS'); SetTab('ITEMS');
} }
}; };
calculateDate($("#delivery_date").val());
}); });
// handle save // handle save
var check_form_ = check_form; var check_form_ = check_form;

View File

@@ -48,7 +48,7 @@ function getList() {
} }
function getList2() { function getList2() {
if($('#idss').val()!=""){ if($('#idss').val()!=""){
window.open('index.php?module=EcmSales&action=productsSummaryList&to_pdf=1&ids='+$('#idss').val()); window.open('index.php?module=EcmSales&action=ProductSummary&to_pdf=1&ids='+$('#idss').val());
} else { } else {
alert("Proszę zaznaczyć chociaż jedną pozycje!"); alert("Proszę zaznaczyć chociaż jedną pozycje!");
} }

View File

@@ -15,100 +15,15 @@ function getList() {
$(document).ready(function() $(document).ready(function()
{ {
$("#createInsideOrder").click(createInsideOrder);
// by document no
$.tablesorter.addParser({
// set a unique id
id: 'rangesort',
is: function (s) {
// return false so this parser is not auto detected
return false;
},
format: function (s, table, cell, cellIndex) {
// get data attributes from $(cell).attr('data-something');
// check specific column using cellIndex
return $(cell).attr('data-price');
},
// set type, either numeric or text
type: 'numeric'
});
// by total netto
$.tablesorter.addParser({
// set a unique id
id: 'rangesorttota',
is: function (s) {
// return false so this parser is not auto detected
return false;
},
format: function (s, table, cell, cellIndex) {
// get data attributes from $(cell).attr('data-something');
// check specific column using cellIndex
return $(cell).attr('data-total');
},
// set type, either numeric or text
type: 'numeric'
});
// by vat
$.tablesorter.addParser({
// set a unique id
id: 'rangesorttotav',
is: function (s) {
// return false so this parser is not auto detected
return false;
},
format: function (s, table, cell, cellIndex) {
// get data attributes from $(cell).attr('data-something');
// check specific column using cellIndex
return $(cell).attr('data-total');
},
// set type, either numeric or text
type: 'numeric'
});
// by total brutto
$.tablesorter.addParser({
// set a unique id
id: 'rangesorttotan',
is: function (s) {
// return false so this parser is not auto detected
return false;
},
format: function (s, table, cell, cellIndex) {
// get data attributes from $(cell).attr('data-something');
// check specific column using cellIndex
return $(cell).attr('data-total');
},
// set type, either numeric or text
type: 'numeric'
});
// by total invoice
$.tablesorter.addParser({
// set a unique id
id: 'rangesorttotai',
is: function (s) {
// return false so this parser is not auto detected
return false;
},
format: function (s, table, cell, cellIndex) {
// get data attributes from $(cell).attr('data-something');
// check specific column using cellIndex
return $(cell).attr('data-total');
},
// set type, either numeric or text
type: 'numeric'
});
$('#selectall').click(function(event) { //on click $('#selectall').click(function(event) { //on click
if(this.checked) { // check select status if(this.checked) { // check select status
$('.make_pdf').each(function() { //loop through each checkbox $('.allCheck').each(function() { //loop through each checkbox
this.checked = true; //select all checkboxes with class "checkbox1" this.checked = true; //select all checkboxes with class "checkbox1"
}); });
}else{ }else{
$('.make_pdf').each(function() { //loop through each checkbox $('.allCheck').each(function() { //loop through each checkbox
this.checked = false; //deselect all checkboxes with class "checkbox1" this.checked = false; //deselect all checkboxes with class "checkbox1"
}); });
} }
@@ -140,32 +55,24 @@ $(document).ready(function()
$('#myTable tr').removeClass('highlighted'); $('#myTable tr').removeClass('highlighted');
$(this).addClass('highlighted'); $(this).addClass('highlighted');
}); });
$("#myTable").tablesorter({ });
headers: {
0: {
// disable it by setting the property sorter to false
sorter: false
},
function createInsideOrder() {
console.log('createInsideOrder');
var ids = [];
$('input.allCheck:checkbox:checked').each(function () {
ids.push($(this).val());
});
if (ids.length === 0) {
alert('Wybierz pozycje.');
return;
} }
var products = [];
ids.forEach(el => {
const qty = parseFloat($("#qtyInput-" + el).val().trim());
console.log(qty);
products.push(el + "|" + qty);
}); });
$("#insideOrderProducts").val(products.join('*'));
$("#myTable2").tablesorter({ $("#createInsideOrderForm").submit();
headers: {
0: {
// disable it by setting the property sorter to false
sorter: false
},
} }
});
$("#myTable3").tablesorter({
headers: {
0: {
// disable it by setting the property sorter to false
sorter: false
},
}
});
});

View File

@@ -23,6 +23,13 @@ function calculateDate($date){
$date = new Datetime($date); $date = new Datetime($date);
$date->modify('-1 day'); $date->modify('-1 day');
$tmp['date']=$date->format("d.m.Y"); $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); echo json_encode($tmp);
return ''; return '';
} }

View File

@@ -1,13 +1,12 @@
<script type="text/javascript" <script type="text/javascript" src="include/ECM/EcmMultiPdf/EcmMultiPdf.js"></script>
src="include/ECM/EcmMultiPdf/EcmMultiPdf.js"></script> <script type="text/javascript" src="include/jQuery/jquery.blockUI.js"></script>
<script type="text/javascript"
src="include/jQuery/jquery.blockUI.js"></script>
<table cellspacing="0" cellpadding="0" border="0"> <table cellspacing="0" cellpadding="0" border="0">
<tr> <tr>
<td><img src="themes/Sugar/images/EcmProducts.gif" <td><img src="themes/Sugar/images/EcmProducts.gif" style="margin-top: 3px; margin-right: 3px;" alt="EcmProducts"
style="margin-top: 3px; margin-right: 3px;" alt="EcmProducts"
width="16" border="0" height="16"></td> width="16" border="0" height="16"></td>
<td><h2>{$MOD.LBL_LISTNEWSALES_NAME}</h2></td> <td>
<h2>{$MOD.LBL_LISTNEWSALES_NAME}</h2>
</td>
</tr> </tr>
</table> </table>
<br /> <br />
@@ -27,8 +26,8 @@
</td> </td>
<td nowrap=""> <td nowrap="">
<input type="text" maxlength="10" size="11" tabindex="" title="" <input type="text" maxlength="10" size="11" tabindex="" title=""
value="{if $POST.date_send_from!=''}{$POST.date_send_from}{else}{$smarty.now|date_format:"%d.%m.%Y"}{/if}" id="date_send_from" value="{if $POST.date_send_from!=''}{$POST.date_send_from}{else}{$smarty.now|date_format:"%d.%m.%Y"}{/if}"
name="date_send_from" autocomplete="off"> id="date_send_from" name="date_send_from" autocomplete="off">
<img align="absmiddle" border="0" id="date_send_from_trigger" name="date_send_from_trigger" <img align="absmiddle" border="0" id="date_send_from_trigger" name="date_send_from_trigger"
alt="Enter Date" src="themes/default/images/jscalendar.gif"> alt="Enter Date" src="themes/default/images/jscalendar.gif">
<script type="text/javascript"> <script type="text/javascript">
@@ -42,16 +41,15 @@
dateStr: "", dateStr: "",
step: 1, step: 1,
weekNumbers: false weekNumbers: false
} });
);
{/literal} {/literal}
</script> </script>
{$MOD.LBL_LISTNEWSALES_DATE_END}: {$MOD.LBL_LISTNEWSALES_DATE_END}:
<input type="text" maxlength="10" size="11" tabindex="" title="" <input type="text" maxlength="10" size="11" tabindex="" title=""
value="{if $POST.date_send_to!=''}{$POST.date_send_to}{else}{$smarty.now|date_format:"%d.%m.%Y"}{/if}" id="date_send_to" value="{if $POST.date_send_to!=''}{$POST.date_send_to}{else}{$smarty.now|date_format:"%d.%m.%Y"}{/if}"
name="date_send_to" autocomplete="off"> id="date_send_to" name="date_send_to" autocomplete="off">
<img align="absmiddle" border="0" id="date_send_to_trigger" name="date_send_to_trigger" alt="Enter Date" <img align="absmiddle" border="0" id="date_send_to_trigger" name="date_send_to_trigger" alt="Enter Date"
src="themes/default/images/jscalendar.gif"> src="themes/default/images/jscalendar.gif">
<script type="text/javascript"> <script type="text/javascript">
@@ -65,8 +63,7 @@
dateStr: "", dateStr: "",
step: 1, step: 1,
weekNumbers: false weekNumbers: false
} });
);
{/literal} {/literal}
</script> </script>
</td> </td>
@@ -74,7 +71,8 @@
<td rowspan="2"> <td rowspan="2">
<select id="sale_type" name="sale_type[]" multiple="true"> <select id="sale_type" name="sale_type[]" multiple="true">
{foreach from=$SALE_TYPES key="key" item="value" name="sale_types"} {foreach from=$SALE_TYPES key="key" item="value" name="sale_types"}
<option {if in_array($key, $SELECTED_TYPES)}selected="selected" {/if} value="{$key}">{$value}</option> <option {if in_array($key, $SELECTED_TYPES)}selected="selected" {/if} value="{$key}">{$value}
</option>
{/foreach} {/foreach}
</select> </select>
</td> </td>
@@ -82,7 +80,8 @@
<td rowspan="2"> <td rowspan="2">
<select id="sale_status" name="sale_status[]" multiple="true"> <select id="sale_status" name="sale_status[]" multiple="true">
{foreach from=$SALE_STATUSES key="key" item="value" name="sale_statuses"} {foreach from=$SALE_STATUSES key="key" item="value" name="sale_statuses"}
<option {if in_array($key, $SELECTED_STATUSES)}selected="selected" {/if} value="{$key}">{$value}</option> <option {if in_array($key, $SELECTED_STATUSES)}selected="selected" {/if} value="{$key}">{$value}
</option>
{/foreach} {/foreach}
</select> </select>
</td> </td>
@@ -118,8 +117,8 @@
</td> </td>
<td nowrap=""> <td nowrap="">
<input type="text" maxlength="10" size="11" tabindex="" title="" <input type="text" maxlength="10" size="11" tabindex="" title=""
value="{if $POST.date_from!=''}{$POST.date_from}{/if}" value="{if $POST.date_from!=''}{$POST.date_from}{/if}" id="date_from" name="date_from"
id="date_from" name="date_from" autocomplete="off"> autocomplete="off">
<img align="absmiddle" border="0" id="date_from_trigger" name="date_from_trigger" alt="Enter Date" <img align="absmiddle" border="0" id="date_from_trigger" name="date_from_trigger" alt="Enter Date"
src="themes/default/images/jscalendar.gif"> src="themes/default/images/jscalendar.gif">
<script type="text/javascript"> <script type="text/javascript">
@@ -133,14 +132,12 @@
dateStr: "", dateStr: "",
step: 1, step: 1,
weekNumbers: false weekNumbers: false
} });
);
{/literal} {/literal}
</script> </script>
do: do:
<input type="text" maxlength="10" size="11" tabindex="" title="" <input type="text" maxlength="10" size="11" tabindex="" title=""
value="{if $POST.date_to!=''}{$POST.date_to}{/if}" value="{if $POST.date_to!=''}{$POST.date_to}{/if}" id="date_to" name="date_to" autocomplete="off">
id="date_to" name="date_to" autocomplete="off">
<img align="absmiddle" border="0" id="date_to_trigger" name="date_to_trigger" alt="Enter Date" <img align="absmiddle" border="0" id="date_to_trigger" name="date_to_trigger" alt="Enter Date"
src="themes/default/images/jscalendar.gif"> src="themes/default/images/jscalendar.gif">
<script type="text/javascript"> <script type="text/javascript">
@@ -154,8 +151,7 @@
dateStr: "", dateStr: "",
step: 1, step: 1,
weekNumbers: false weekNumbers: false
} });
);
{/literal} {/literal}
</script> </script>
</td> </td>
@@ -170,7 +166,8 @@
</table> </table>
<h3 style="color:red">{if $POST.date_send_from!='' && $POST.date_from!=''}Proszę wybrać date dostawy lub datę wysyłki{/if}</h3> <h3 style="color:red">{if $POST.date_send_from!='' && $POST.date_from!=''}Proszę wybrać date dostawy lub datę
wysyłki{/if}</h3>
<input type="hidden" id="idss" value=""> <input type="hidden" id="idss" value="">
<input type="submit" value="{$MOD.LBL_LISTNEWSALES_POST}" name="submit" class="button"> <input type="submit" value="{$MOD.LBL_LISTNEWSALES_POST}" name="submit" class="button">
<input type="button" onclick="location.href='index.php?module=EcmSales&amp;action=ListNewSales';" <input type="button" onclick="location.href='index.php?module=EcmSales&amp;action=ListNewSales';"
@@ -219,21 +216,30 @@
</td> </td>
<td></td> <td></td>
<td> <td>
<a href="index.php?module=Accounts&action=DetailView&record={$item.parent_id}">{$item.parent_name}</a> <a
href="index.php?module=Accounts&action=DetailView&record={$item.parent_id}">{$item.parent_name}</a>
{if $item.delivery_name}
{if $item.delivery_id}
&nbsp;(<a
href="index.php?module=Accounts&action=DetailView&record={$item.delivery_id}">{$item.delivery_name}</a>)
{else}
&nbsp;({$item.delivery_name})
{/if}
{/if}
</td> </td>
<td>{$item.delivery_date}</td> <td>{$item.delivery_date}</td>
<td><input type="checkbox" {if $item.send_accepted==true}checked="checked" {/if} <td><input type="checkbox" {if $item.send_accepted==true}checked="checked" {/if} disabled="disabled">
disabled="disabled"></td> </td>
<td>{$item.send_date} </td> <td>{$item.send_date} </td>
<td style="text-align: right">{$item.quantity}</td> <td style="text-align: right">{$item.quantity}</td>
<td data-total="{$item.total_netto}" <td data-total="{$item.total_netto}" style="text-align: right">
style="text-align: right">{$item.total_netto|number_format:2:".":","}</td> {$item.total_netto|number_format:2:".":","}</td>
<td data-total="{$item.total_vat}" <td data-total="{$item.total_vat}" style="text-align: right">{$item.total_vat|number_format:2:".":","}
style="text-align: right">{$item.total_vat|number_format:2:".":","}</td> </td>
<td data-total="{$item.total_brutto}" <td data-total="{$item.total_brutto}" style="text-align: right">
style="text-align: right">{$item.total_brutto|number_format:2:".":","}</td> {$item.total_brutto|number_format:2:".":","}</td>
<td data-total="{$item.total_invoice}" <td data-total="{$item.total_invoice}" style="text-align: right">
style="text-align: right">{$item.total_invoice|number_format:2:".":","}</td> {$item.total_invoice|number_format:2:".":","}</td>
<td style="text-align: right">{$item.percent}<a style="cursor:pointer;" <td style="text-align: right">{$item.percent}<a style="cursor:pointer;"
onclick="{literal}if(document.getElementById('div{/literal}{$item.id}{literal}').style.display=='none'){document.getElementById('div{/literal}{$item.id}{literal}').style.display='block';}else{document.getElementById('{/literal}div{$item.id}{literal}').style.display='none';}{/literal} "><img onclick="{literal}if(document.getElementById('div{/literal}{$item.id}{literal}').style.display=='none'){document.getElementById('div{/literal}{$item.id}{literal}').style.display='block';}else{document.getElementById('{/literal}div{$item.id}{literal}').style.display='none';}{/literal} "><img
border="0" src="modules/EcmQuotes/images/search.gif"></a> border="0" src="modules/EcmQuotes/images/search.gif"></a>
@@ -274,14 +280,16 @@
<td></td> <td></td>
<td></td> <td></td>
<td> <td>
<span style="color:red;font-weight:bold">{$item.products.minus|number_format:2:".":","}</span> <span
style="color:red;font-weight:bold">{$item.products.minus|number_format:2:".":","}</span>
</td> </td>
</tr> </tr>
<tr> <tr>
<td></td> <td></td>
<td></td> <td></td>
<td> <td>
<span style="color:green;font-weight:bold">{$item.products.plus|number_format:2:".":","}</span> <span
style="color:green;font-weight:bold">{$item.products.plus|number_format:2:".":","}</span>
</td> </td>
</tr> </tr>
</tbody> </tbody>
@@ -293,12 +301,11 @@
<td> <td>
{if $item.type!='gratis'} {if $item.type!='gratis'}
{if $item.fv_switch=='yes'}<img border="0" id="convert_to_invoice_{$item.id}" {if $item.fv_switch=='yes'}<img border="0" id="convert_to_invoice_{$item.id}"
src="modules/EcmSales/images/convert_disabled.gif" src="modules/EcmSales/images/convert_disabled.gif" title="{$item.fv_name}"
title="{$item.fv_name}" style="cursor:pointer;" style="cursor:pointer;"
onClick="{literal}javascript:window.open('index.php?module=EcmInvoiceOuts&action=DetailView&record={/literal}{$item.fv_id}{literal}','_newtab');{/literal} " />'{/if} onClick="{literal}javascript:window.open('index.php?module=EcmInvoiceOuts&action=DetailView&record={/literal}{$item.fv_id}{literal}','_newtab');{/literal} " />'{/if}
{if $item.fv_switch=='no'}<img border="0" id="convert_to_invoice_{$item.id}" {if $item.fv_switch=='no'}<img border="0" id="convert_to_invoice_{$item.id}"
src="modules/EcmSales/images/convert_enabled.gif" src="modules/EcmSales/images/convert_enabled.gif" title="Create Invoice"
title="Create Invoice"
onClick="{literal}javascript:window.open('index.php?module=EcmInvoiceOuts&action=EditView&isWZ=true&wz_record={/literal}{$item.fv_id}{literal}','_newtab');{/literal}" onClick="{literal}javascript:window.open('index.php?module=EcmInvoiceOuts&action=EditView&isWZ=true&wz_record={/literal}{$item.fv_id}{literal}','_newtab');{/literal}"
style="cursor:pointer;" />{/if} style="cursor:pointer;" />{/if}
{if $item.wz_switch=='disabled'}<img src="modules/EcmSales/images/create_wz_disabled.gif" {if $item.wz_switch=='disabled'}<img src="modules/EcmSales/images/create_wz_disabled.gif"
@@ -381,14 +388,16 @@
<td></td> <td></td>
<td></td> <td></td>
<td> <td>
<span style="color:red;font-weight:bold">{$POSITION_LIST.total_product.minus|number_format:2:".":","}</span> <span
style="color:red;font-weight:bold">{$POSITION_LIST.total_product.minus|number_format:2:".":","}</span>
</td> </td>
</tr> </tr>
<tr> <tr>
<td></td> <td></td>
<td></td> <td></td>
<td> <td>
<span style="color:green;font-weight:bold">{$POSITION_LIST.total_product.plus|number_format:2:".":","}</span> <span
style="color:green;font-weight:bold">{$POSITION_LIST.total_product.plus|number_format:2:".":","}</span>
</td> </td>
</tr> </tr>
</tbody> </tbody>

View File

@@ -8,6 +8,7 @@
</tr> </tr>
</table> </table>
<br /> <br />
<form style="display:none;" action="index.php?module=EcmSales&action=ProductSummary" method="post" <form style="display:none;" action="index.php?module=EcmSales&action=ProductSummary" method="post"
name="SearchFormListNewSales"> name="SearchFormListNewSales">
<ul class="tablist" style="width:100%;"> <ul class="tablist" style="width:100%;">
@@ -166,7 +167,11 @@
<input type="hidden" value="{$IDS}" name='ids' id='ids'> <input type="hidden" value="{$IDS}" name='ids' id='ids'>
</form> </form>
<form action="index.php?module=EcmInsideOrders&action=EditView&fromProductionScheduler=true" method="post"
target="_blank" id="createInsideOrderForm">
<input id="insideOrderProducts" name="insideOrderProducts" type="hidden" value=""/>
</form>
<input class="button" value="Utwórz przyjęcie produkcyjne" type="button" id="createInsideOrder"/>
<table cellspacing="0" cellpadding="0" style="width:100%;" id="myTable" class="tablesorter"> <table cellspacing="0" cellpadding="0" style="width:100%;" id="myTable" class="tablesorter">
<thead> <thead>
<tr> <tr>
@@ -184,8 +189,11 @@
{foreach from=$POSITION_LIST key="key" item="item" name="components"} {foreach from=$POSITION_LIST key="key" item="item" name="components"}
{if $item.id!=''} {if $item.id!=''}
<tr style="vertical-align:top;"> <tr style="vertical-align:top;">
<td style="text-align:center;"><input type="checkbox" value="{$item.id}" class="make_pdf" <td style="text-align:center;"><input type="checkbox" value="{$item.id}"
id="make_pdf_{$item.position}" name="selectedid[]"></td> id="make_pdf_{$item.position}" name="selectedid[]" class="allCheck">
<input id="qtyInput-{$item.id}" value="{$item.quantity-$item.stock}" style="width: 50px; display: none;"
type="number"/>
</td>
<td>{$item.code}</td> <td>{$item.code}</td>
<td>{$item.name}</td> <td>{$item.name}</td>
<td>{$item.product_category_name}</td> <td>{$item.product_category_name}</td>