Compare commits

...

12 Commits

Author SHA1 Message Date
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
9 changed files with 690 additions and 589 deletions

View File

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

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

@@ -1,5 +1,5 @@
<?php
// created: 2025-08-13 12:56:45
// created: 2025-09-04 18:29:22
$customDoms = array (
'ecmproducts_attribute_dom' =>
array (
@@ -11,8 +11,8 @@ $customDoms = array (
array (
'8bc92e86-d956-0df2-e34c-656e0bc9da04' => 'None',
'6db335cc-96d5-5185-6118-65761ec65583' => 'Liquid',
'8112d0d3-baca-cd8a-3b00-6576321030cb' => 'Bottle B1_100ml',
'1441313f-245d-dfe7-92dd-6576255579fb' => 'Bottle B1_250ml',
'8112d0d3-baca-cd8a-3b00-6576321030cb' => 'Butelka IT_100 B1_100 ml',
'1441313f-245d-dfe7-92dd-6576255579fb' => 'Butelka IT_250 B1_250 ml',
'c2beb683-dd0a-c76f-fd2f-6576252c68de' => 'Bottle B1_500ml',
'8a4c1e7b-fb17-681d-a9dd-65762566ca64' => 'Bottle B1_1000ml',
'4d063e6a-9cf1-28f4-2e98-6576251a3e7f' => 'Tube standard',
@@ -29,24 +29,24 @@ $customDoms = array (
'5048d070-7da8-a160-d0bd-659c6af595b4' => 'Kit 3in1',
'a1d41637-21c8-60e7-dfeb-65973bb8bc04' => 'Kit 4in1',
'e47359f6-5f25-4d4b-c472-65b77152ae8a' => 'Kit 5in1',
'cd43ef35-031a-ce97-3d1c-65f41563046f' => 'Bottle D11_50ml (RPET)',
'cd43ef35-031a-ce97-3d1c-65f41563046f' => 'Butelka okrągła D11_50 ml (RPET)',
'b78c2842-b4f8-ad77-e7ea-65f41571c57e' => 'Bottle D11_250ml (RPET)',
'901babfa-3d95-3a98-8dbf-659f00f4f91e' => 'Bottle D21_250ml',
'901babfa-3d95-3a98-8dbf-659f00f4f91e' => 'Butelka OD_0250 D21_250ml',
'62ea70ee-d2cc-e68b-d51b-661670a10c98' => 'Bottle D21_250ml ',
'c10933f2-62ce-cfb2-52b1-659f1f2b9e4a' => 'B D22_250ml (szyjka)',
'855e5265-8d2d-4682-8e4c-659f1d1ead09' => 'Bottle D23_250ml',
'c10933f2-62ce-cfb2-52b1-659f1f2b9e4a' => 'Butelka DT_0250 D22_250ml (szyjka)',
'855e5265-8d2d-4682-8e4c-659f1d1ead09' => 'Butelka D27Z_250ml (zmywarka)',
'e3a77ebf-9ba1-3776-3d80-67a9e325c268' => 'Bottle D24 250 ml (Ula)',
'359d7556-f107-92de-4121-659f1eafeb90' => 'B D11_500ml (RPET)',
'90053c7e-98fb-873e-b414-659f1bc748cc' => 'Bottle D12_500ml',
'9b883933-6bb0-cc85-29b0-659f03d60a98' => 'Bottle D21_500ml',
'8f4fdd3c-44f9-103b-3f40-659f1c128319' => 'Bottle D22_500ml',
'307f61db-5fd9-3aa6-e701-65a04f4bba88' => 'B D23_500ml (nabłyszczacz)',
'5df47246-d0cd-4151-9bdd-65eede53aba5' => 'B D24_500ml (systemy mleczne)',
'8f4fdd3c-44f9-103b-3f40-659f1c128319' => 'Butelka DT_0500 D22_500ml (szyjka)',
'307f61db-5fd9-3aa6-e701-65a04f4bba88' => 'Butelka NB_500 ml (nabłyszczacz)',
'5df47246-d0cd-4151-9bdd-65eede53aba5' => 'Butelka SM_500 ml (systemy mleczne)',
'87a2b609-9b67-de82-8f41-65eedd4613c9' => 'Butelka SM_1000 ml (systemy mleczne)',
'ab74cd2c-7720-5875-7ca5-66bb55a3e075' => 'Bottle D25_500ml (Ula)',
'd7c10cb9-7459-1174-6315-661cdae38a39' => 'D11_1000ml',
'58664d9d-0295-3539-4662-659f18dc4b80' => 'Bottle',
'58664d9d-0295-3539-4662-659f18dc4b80' => 'Butelka OD_1000 D21_1000 ml',
'92a7ee9b-d953-fd7e-5c88-65c9bf1e144d' => 'B D22_1000ml (szyjka)',
'87a2b609-9b67-de82-8f41-65eedd4613c9' => 'D23_1000ml (systemy mleczne)',
'75980ea5-d89e-3923-2662-66bb55202244' => 'D24_1000ml (Ula)',
'ba4f06a8-f6fb-4969-d4b9-6683e6b6b372' => 'D11_2000ml ',
'cb8f5e45-43e1-b62d-05d7-669646b4eb10' => 'Bottle D12_5000ml (kanister)',
@@ -62,7 +62,7 @@ $customDoms = array (
'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',
'e703a7f9-d27d-b445-d946-66727a3940d9' => 'Słoik 1500 ml',
'da8d7be4-58dc-4f75-f547-65c310cd97dd' => 'Jar 65 ml',
'e1a16dbf-7216-d184-b9ed-65c310aff4d4' => 'Jar 150 ml',
'2a9454a6-b2a1-150f-c307-65c31102cb28' => 'Jar 250 ml',
@@ -177,6 +177,7 @@ $customDoms = array (
'11095313-0dd0-aa9b-df3a-682739877d33' => 'Coffix',
'd97b870b-86a1-1970-9cea-68527ecc5ad9' => 'Zenevo',
'c709e4cf-9ca7-c946-f5e3-688202ec4c24' => 'Aspico',
'8bf5f833-51a9-3913-aa0a-68b6d539a1b5' => 'MediaShop',
),
'ecmproducts_category_dom' =>
array (
@@ -228,13 +229,28 @@ $customDoms = array (
),
'ecmactions_category_dom' =>
array (
'dd4ddbad-c949-0ee5-fb73-54cb9b6c86ef' => 'Filling Capping Labeling',
'8519dfc8-5eec-0233-7f84-54d1fe00e9fc' => 'Sets',
'55020d96-73d5-7b29-3bab-654f4818e0cd' => 'Liquid Mixing',
'9bc2bafc-0608-7bc7-468b-686a94772424' => 'Bisters',
'be37016b-0aa4-678c-9c4a-689c3673af3e' => 'Packing Blisters Into Packaging',
'e3e16e03-8e62-624e-f954-689c37059997' => 'Packing Tablets Into Jars',
'416a2b50-4979-bc35-c83c-689c8a6640ae' => 'Packing into tubes',
'dd4ddbad-c949-0ee5-fb73-54cb9b6c86ef' => 'None',
'8519dfc8-5eec-0233-7f84-54d1fe00e9fc' => 'PK1',
'55020d96-73d5-7b29-3bab-654f4818e0cd' => 'HP1',
'9bc2bafc-0608-7bc7-468b-686a94772424' => 'BL1',
'347509e3-fff6-4db9-761e-68b2e36436c6' => 'Opis',
'26c3b7fa-e1ac-66d9-517b-68b2e4c6cae8' => 'LNE2',
'5664a1b1-42dc-2bb8-ad24-68b2e52df143' => 'LNE3',
'307b8935-5235-628f-aac1-68b2e56d3f4d' => 'LNE4',
'8d68df07-0779-5a23-aaf3-68b2e5d72a46' => 'LNE5',
'31174829-986e-4d7f-4262-68b2e73742e9' => 'Mieszalnik 100L',
'53d9cae1-1ec5-71e4-5a3c-68b2e77b6d92' => 'MDC5',
'de2448f8-45ac-6b2a-f2b1-68b2e7e40a6f' => 'HP2',
'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',
'f2364990-b244-064d-b5d1-68b2ebcd0ded' => 'MDC6',
'cc4905b6-a791-5c57-4721-68b2eb29e0fe' => 'TAB1',
'40e8149a-40ec-aeb0-4cdd-68b2eb52634b' => 'TAB2',
'b64ca8db-ff88-082c-887c-68b2ec98c15d' => 'TAB3',
),
'payment_method_dom' =>
array (
@@ -321,6 +337,7 @@ $customDoms = array (
'end_of_line' => 'Non Active',
'active' => 'Active',
'new' => 'New',
'e8d1191e-2c7b-c24d-88e2-68b2bd076498' => 'test',
),
'ecmsales_status_dom' =>
array (

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

@@ -1,5 +1,5 @@
<?php
// created: 2025-08-13 12:56:45
// created: 2025-09-04 18:29:22
$customDoms = array (
'ecmproducts_attribute_dom' =>
array (
@@ -11,8 +11,8 @@ $customDoms = array (
array (
'8bc92e86-d956-0df2-e34c-656e0bc9da04' => 'None',
'6db335cc-96d5-5185-6118-65761ec65583' => 'Płyn',
'8112d0d3-baca-cd8a-3b00-6576321030cb' => 'Butelka B1_100ml',
'1441313f-245d-dfe7-92dd-6576255579fb' => 'Butelka B1_250ml',
'8112d0d3-baca-cd8a-3b00-6576321030cb' => 'BT_IT_100',
'1441313f-245d-dfe7-92dd-6576255579fb' => 'BT_IT_250',
'c2beb683-dd0a-c76f-fd2f-6576252c68de' => 'Butelka B1_500ml',
'8a4c1e7b-fb17-681d-a9dd-65762566ca64' => 'Butelka B1_1000ml',
'4d063e6a-9cf1-28f4-2e98-6576251a3e7f' => 'Tuba standardowa',
@@ -29,24 +29,24 @@ $customDoms = array (
'5048d070-7da8-a160-d0bd-659c6af595b4' => 'Zestaw 3w1',
'a1d41637-21c8-60e7-dfeb-65973bb8bc04' => 'Zestaw 4w1',
'e47359f6-5f25-4d4b-c472-65b77152ae8a' => 'Zestaw 5w1',
'cd43ef35-031a-ce97-3d1c-65f41563046f' => 'Butelka D11_50ml (RPET)',
'cd43ef35-031a-ce97-3d1c-65f41563046f' => 'BT_OK_0050 D11 (RPET)',
'b78c2842-b4f8-ad77-e7ea-65f41571c57e' => 'Butelka D11_250ml (RPET)',
'901babfa-3d95-3a98-8dbf-659f00f4f91e' => 'Butelka D21_250ml (Odkamieniacz)',
'901babfa-3d95-3a98-8dbf-659f00f4f91e' => 'BT_OD_0250 (Odkamieniacz)',
'62ea70ee-d2cc-e68b-d51b-661670a10c98' => 'Butelka D21_250ml_new (Odkamieniacz)',
'c10933f2-62ce-cfb2-52b1-659f1f2b9e4a' => 'Butelka D22_250ml (szyjka)',
'855e5265-8d2d-4682-8e4c-659f1d1ead09' => 'Butelka D23_250ml (Zmywarka)',
'c10933f2-62ce-cfb2-52b1-659f1f2b9e4a' => 'BT_DT_0250 (szyjka)',
'855e5265-8d2d-4682-8e4c-659f1d1ead09' => 'BT_PL_0250 D27Z (zmywarka)',
'e3a77ebf-9ba1-3776-3d80-67a9e325c268' => 'Butelka D24 250 ml (Ula)',
'359d7556-f107-92de-4121-659f1eafeb90' => 'Butelka D11_500ml (RPET)',
'90053c7e-98fb-873e-b414-659f1bc748cc' => 'Butelka D12_500ml (Dywan)',
'9b883933-6bb0-cc85-29b0-659f03d60a98' => 'Butelka D21_500ml (Odkamieniacz)',
'8f4fdd3c-44f9-103b-3f40-659f1c128319' => 'Butelka D22_500ml (szyjka)',
'307f61db-5fd9-3aa6-e701-65a04f4bba88' => 'Butelka D23_500ml (nabłyszczacz)',
'5df47246-d0cd-4151-9bdd-65eede53aba5' => 'Butelka D24_500ml (systemy mleczne)',
'8f4fdd3c-44f9-103b-3f40-659f1c128319' => 'BT_DT_0500 (szyjka)',
'307f61db-5fd9-3aa6-e701-65a04f4bba88' => 'BT_NB_500 (nabłyszczacz)',
'5df47246-d0cd-4151-9bdd-65eede53aba5' => 'BT_SM_0500 (sys. mleczne)',
'87a2b609-9b67-de82-8f41-65eedd4613c9' => 'BT_SM_1000 (sys. mleczne)',
'ab74cd2c-7720-5875-7ca5-66bb55a3e075' => 'Butelka D25_500ml (Ula)',
'd7c10cb9-7459-1174-6315-661cdae38a39' => 'Butelka D11_1000ml (RPET)',
'58664d9d-0295-3539-4662-659f18dc4b80' => 'Butelka D21_1000ml (Odkamieniacz)',
'58664d9d-0295-3539-4662-659f18dc4b80' => 'BT_OD_1000 (Odkamieniacz)',
'92a7ee9b-d953-fd7e-5c88-65c9bf1e144d' => 'Butelka D22_1000ml (szyjka)',
'87a2b609-9b67-de82-8f41-65eedd4613c9' => 'Butelka D23_1000ml (systemy mleczne)',
'75980ea5-d89e-3923-2662-66bb55202244' => 'Butelka D24_1000ml (Ula)',
'ba4f06a8-f6fb-4969-d4b9-6683e6b6b372' => 'Butelka D11_2000ml (płyn do prania)',
'cb8f5e45-43e1-b62d-05d7-669646b4eb10' => 'Butelka D12_5000ml (kanister)',
@@ -62,7 +62,7 @@ $customDoms = array (
'48369f61-18bd-53e6-070a-659f026773ac' => 'Kartonik ',
'37dbeaa1-f183-3b3e-1b54-65aa78a662a2' => 'Słoik 500 ml',
'f13d7541-494d-75c7-2a35-65aa784b42a5' => 'Słoik 1000 ml',
'e703a7f9-d27d-b445-d946-66727a3940d9' => 'Słoik 1500 ml',
'e703a7f9-d27d-b445-d946-66727a3940d9' => 'SL_1500',
'da8d7be4-58dc-4f75-f547-65c310cd97dd' => 'Słoik 65 ml',
'e1a16dbf-7216-d184-b9ed-65c310aff4d4' => 'Słoik 150 ml',
'2a9454a6-b2a1-150f-c307-65c31102cb28' => 'Słoik 250 ml',
@@ -177,6 +177,7 @@ $customDoms = array (
'11095313-0dd0-aa9b-df3a-682739877d33' => 'Coffix',
'd97b870b-86a1-1970-9cea-68527ecc5ad9' => 'Zenevo',
'c709e4cf-9ca7-c946-f5e3-688202ec4c24' => 'Aspico',
'8bf5f833-51a9-3913-aa0a-68b6d539a1b5' => 'MediaShop',
),
'ecmproducts_category_dom' =>
array (
@@ -228,13 +229,28 @@ $customDoms = array (
),
'ecmactions_category_dom' =>
array (
'dd4ddbad-c949-0ee5-fb73-54cb9b6c86ef' => 'NZE',
'8519dfc8-5eec-0233-7f84-54d1fe00e9fc' => 'Zestawy',
'55020d96-73d5-7b29-3bab-654f4818e0cd' => 'Mieszanie',
'9bc2bafc-0608-7bc7-468b-686a94772424' => 'Blistrowanie',
'be37016b-0aa4-678c-9c4a-689c3673af3e' => 'PBDO',
'e3e16e03-8e62-624e-f954-689c37059997' => 'PTDS',
'416a2b50-4979-bc35-c83c-689c8a6640ae' => 'PWT',
'dd4ddbad-c949-0ee5-fb73-54cb9b6c86ef' => 'None',
'8519dfc8-5eec-0233-7f84-54d1fe00e9fc' => 'PK1',
'55020d96-73d5-7b29-3bab-654f4818e0cd' => 'HP1',
'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',
'31174829-986e-4d7f-4262-68b2e73742e9' => 'M1',
'53d9cae1-1ec5-71e4-5a3c-68b2e77b6d92' => 'MDC5',
'de2448f8-45ac-6b2a-f2b1-68b2e7e40a6f' => 'HP2',
'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',
'f2364990-b244-064d-b5d1-68b2ebcd0ded' => 'MDC6',
'cc4905b6-a791-5c57-4721-68b2eb29e0fe' => 'TAB1',
'40e8149a-40ec-aeb0-4cdd-68b2eb52634b' => 'TAB2',
'b64ca8db-ff88-082c-887c-68b2ec98c15d' => 'TAB3',
),
'payment_method_dom' =>
array (
@@ -322,6 +338,7 @@ $customDoms = array (
'end_of_line' => 'Nieaktywny',
'active' => 'Aktywny',
'new' => 'Nowość',
'e8d1191e-2c7b-c24d-88e2-68b2bd076498' => 'test',
),
'ecmsales_status_dom' =>
array (

View File

@@ -20,6 +20,21 @@ if(isset($_REQUEST['record'])){
$focus->retrieve($_REQUEST['record']);
//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();

View File

@@ -171,6 +171,7 @@ function getRawMaterials() {
}
function drawRawMaterials(data) {
$("#rawMaterialsTableContainer").html(rawMaterialsTablePrototype());
// TODO: tutraj czasami się wiesza
data.forEach((el, index) => {
var tr = $("<tr></tr>");
tr.append("<td><input type=\"checkbox\" value=" + el.id + " class=\"rawMaterialCheck\" /></td>");

View File

@@ -1,7 +1,7 @@
<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED);
ini_set('display_errors', 0);
ini_set('display_startup_errors', 0);
//error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED);
$db = $GLOBALS['db'];
global $app_list_strings;
@@ -135,10 +135,10 @@ if (!isset($_GET['ajaxAction'])) {
} else {
switch ($_GET['ajaxAction']) {
case 'getComponents':
echo getComponents2($_POST['ids']);
getComponents3($_POST['ids']);
break;
case 'getRawMaterials':
echo getRawMaterials2($_POST['ids'], $_POST['type']);;
getRawMaterials2($_POST['ids'], $_POST['type']);;
break;
case 'saveProductDescription':
saveProductDescription($_GET['itemId'], $_GET['description']);
@@ -162,6 +162,7 @@ function findProduct($array, $value)
}
return -1;
}
function getComponents($ids, $dateFrom, $dateTo)
{
$db = $GLOBALS['db'];
@@ -236,6 +237,59 @@ function getComponents($ids, $dateFrom, $dateTo)
}
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)
{
global $app_list_strings;
@@ -246,7 +300,8 @@ function getRawMaterials2($ids, $type)
if ($type == 'sales') {
$productsQuery = "SELECT si.ecmproduct_id, SUM(si.quantity) as quantity
FROM ecmsaleitems AS si
WHERE si.id IN ('" . $idsString . "')";
WHERE si.id IN ('" . $idsString . "')
GROUP BY si.id";
$prows = $db->query($productsQuery);
while ($p = $db->fetchByAssoc($prows)) {
$prod = array();
@@ -258,18 +313,9 @@ function getRawMaterials2($ids, $type)
$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();
foreach ($grouppedProducts as $product) {
foreach ($products as $product) {
$rawMaterialsData = array_merge(
$rawMaterialsData,
getProductRawMaterials($product['ecmproduct_id'], $product['quantity'])
@@ -278,7 +324,7 @@ function getRawMaterials2($ids, $type)
$grouppedRawMaterials = array_reduce($rawMaterialsData, function ($carry, $item) {
if (isset($carry[$item['ecmproduct_id']])) {
$carry[$item['ecmproduct_id']]['productQty'] += $item['quantity'];
$carry[$item['ecmproduct_id']]['quantity'] += $item['quantity'];
} else {
$carry[$item['ecmproduct_id']] = $item;
}
@@ -335,8 +381,9 @@ function getRawMaterials2($ids, $type)
$row['stockAddress'] = (!empty($product['stock_addresses'])) ? $product['stock_addresses'] : "";
$response[] = $row;
}
return json_encode($response);
echo json_encode($response);
}
function getRawMaterials($ids, $cids)
{
$db = $GLOBALS['db'];
@@ -422,6 +469,7 @@ function getRawMaterials($ids, $cids)
echo json_encode($rawMaterialsData);
}
function getProductRawMaterials($productId, $quantity)
{
$db = $GLOBALS['db'];
@@ -456,6 +504,7 @@ WHERE
}
return $response;
}
function addToProductionScheduler($orderItemId)
{
$db = $GLOBALS['db'];
@@ -484,6 +533,7 @@ function addToProductionScheduler($orderItemId)
$db->query($query);
}
}
function addComponentToProductionScheduler($productId, $qty)
{
$db = $GLOBALS['db'];
@@ -492,6 +542,7 @@ function addComponentToProductionScheduler($productId, $qty)
generateUuidV4(), $qty, $current_user->id, $current_user->id, $productId);
$db->query($query);
}
function getComponents2($ids)
{
$db = $GLOBALS['db'];
@@ -538,41 +589,9 @@ function getComponents2($ids)
$componentsData[] = $row;
}
}
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)
{
$db = $GLOBALS['db'];
@@ -612,6 +631,7 @@ HAVING
return $response;
}
}
function generateUuidV4()
{
$data = openssl_random_pseudo_bytes(16);

View File

@@ -27,7 +27,7 @@ $(document).ready(
});
$("#delivery_date").on('inputchange', function() {
calculateDate($("#delivery_date").val());
calculateDate($("#delivery_date").val());
});
if ($("#type").val() == 'interval_order') {
addToValidate('EditView', 'sale_date_interval', 'id', 'true',
@@ -109,7 +109,7 @@ $(document).ready(
SetTab('ITEMS');
}
};
calculateDate($("#delivery_date").val());
});
// handle save
var check_form_ = check_form;

View File

@@ -20,11 +20,18 @@ switch ($_POST['job']) {
}
function calculateDate($date){
$date = new Datetime($date);
$date->modify('-1 day');
$tmp['date']=$date->format("d.m.Y");
echo json_encode($tmp);
return '';
$date = new Datetime($date);
$date->modify('-1 day');
$tmp['date']=$date->format("d.m.Y");
$tmp['date_day']=date('N', strtotime($tmp['date']));
if($tmp['date_day']==7){
$date->modify('-2 day');
} else if($tmp['date_day']==6){
$date->modify('-1 day');
}
$tmp['date']=$date->format("d.m.Y");
echo json_encode($tmp);
return '';
}
function validateDate($date,$date2){
$date = new Datetime($date);