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

File diff suppressed because it is too large Load Diff

View File

@@ -655,8 +655,9 @@ $viewdefs['EcmProducts']['DetailView'] = array(
'name' => 'production_panel',
'allCols' => true,
'hideLabel' => true,
'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>'
'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><b>Receptura:</b> {$PRODUCTION_DESCRIPTION}'
)
)
),

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;

125
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-11-06 11:08:29
$customDoms = array (
'ecmproducts_attribute_dom' =>
array (
@@ -10,9 +10,8 @@ $customDoms = array (
'ecmproducts_shape_dom' =>
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,27 +28,29 @@ $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)',
'b78c2842-b4f8-ad77-e7ea-65f41571c57e' => 'Bottle D11_250ml (RPET)',
'901babfa-3d95-3a98-8dbf-659f00f4f91e' => 'Bottle 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',
'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)',
'ab74cd2c-7720-5875-7ca5-66bb55a3e075' => 'Bottle D25_500ml (Ula)',
'd7c10cb9-7459-1174-6315-661cdae38a39' => 'D11_1000ml',
'58664d9d-0295-3539-4662-659f18dc4b80' => 'Bottle',
'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)',
'58664d9d-0295-3539-4662-659f18dc4b80' => 'Butelka OD_1000 D21_1000 ml',
'9b883933-6bb0-cc85-29b0-659f03d60a98' => 'Butelka OD 500 ml',
'901babfa-3d95-3a98-8dbf-659f00f4f91e' => 'Butelka OD 250 ml',
'62ea70ee-d2cc-e68b-d51b-661670a10c98' => 'Butelka OD 250 ml NW',
'855e5265-8d2d-4682-8e4c-659f1d1ead09' => 'Butelka ZMW_250 ml (zmywarka)',
'90053c7e-98fb-873e-b414-659f1bc748cc' => 'Butelka DYW_500 ml',
'307f61db-5fd9-3aa6-e701-65a04f4bba88' => 'Butelka NAB 500 ml (nabłyszczacz)',
'cd43ef35-031a-ce97-3d1c-65f41563046f' => 'Butelka Boston 50 ml ',
'b78c2842-b4f8-ad77-e7ea-65f41571c57e' => 'Butelka Boston 250ml ',
'359d7556-f107-92de-4121-659f1eafeb90' => 'Butelka Boston 500ml ',
'd7c10cb9-7459-1174-6315-661cdae38a39' => 'Butelka Boston 1000 ml',
'c10933f2-62ce-cfb2-52b1-659f1f2b9e4a' => 'Butelka DET 250 ml',
'8f4fdd3c-44f9-103b-3f40-659f1c128319' => 'Butelka DET_500 (szyjka) ',
'92a7ee9b-d953-fd7e-5c88-65c9bf1e144d' => 'Butelka DET 1000 ml (szyjka)',
'5df47246-d0cd-4151-9bdd-65eede53aba5' => 'Butelka SML_500 ml (systemy mleczne)',
'87a2b609-9b67-de82-8f41-65eedd4613c9' => 'Butelka SML_1000 ml (systemy mleczne)',
'75980ea5-d89e-3923-2662-66bb55202244' => 'Butelka ULA 1000 ml',
'ab74cd2c-7720-5875-7ca5-66bb55a3e075' => 'Butelka ULA 500 ml',
'e3a77ebf-9ba1-3776-3d80-67a9e325c268' => 'Butelka ULA 250 ml ',
'881d099d-36ee-3b45-b1ab-68dd2becfe84' => 'Butelka Irys 150 ml',
'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 ',
'567da064-cd31-0416-2ad3-6581cc870e96' => 'Doypack 110x180mm',
'edf38614-90c3-50a7-56e8-65dda2d891c2' => 'Doypack 130x220mm',
@@ -57,32 +58,33 @@ $customDoms = array (
'2e060602-334b-d053-6bd4-65a9a3d7a99b' => 'Doypack 180x290mm',
'eb0cb757-d39b-9677-b422-65eec426d4fe' => 'Blister tablets 6pcs 2,5g',
'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',
'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',
'e1a16dbf-7216-d184-b9ed-65c310aff4d4' => 'Jar 150 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',
'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',
'6db335cc-96d5-5185-6118-65761ec65583' => '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',
'47fbe61c-20f4-5d48-118c-6851105ddc97' => 'Tablet',
'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' =>
array (
@@ -177,6 +179,12 @@ $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',
'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' =>
array (
@@ -228,13 +236,33 @@ $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',
'5d843f39-893f-51f8-3df5-68c86f1d41c3' => 'HP1',
'31174829-986e-4d7f-4262-68b2e73742e9' => 'HP2',
'8519dfc8-5eec-0233-7f84-54d1fe00e9fc' => 'Pakowalnia 1 Hala 1',
'2bdf9315-5c31-778d-4922-68c86f4af827' => 'Pakowalnia 2 Hala 1',
'55020d96-73d5-7b29-3bab-654f4818e0cd' => 'Mieszalnia Hala 1',
'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' =>
array (
@@ -321,6 +349,7 @@ $customDoms = array (
'end_of_line' => 'Non Active',
'active' => 'Active',
'new' => 'New',
'e8d1191e-2c7b-c24d-88e2-68b2bd076498' => 'test',
),
'ecmsales_status_dom' =>
array (

153
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-11-06 11:08:29
$customDoms = array (
'ecmproducts_attribute_dom' =>
array (
@@ -10,79 +10,81 @@ $customDoms = array (
'ecmproducts_shape_dom' =>
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',
'c2beb683-dd0a-c76f-fd2f-6576252c68de' => 'Butelka B1_500ml',
'8a4c1e7b-fb17-681d-a9dd-65762566ca64' => 'Butelka B1_1000ml',
'4d063e6a-9cf1-28f4-2e98-6576251a3e7f' => 'Tuba standardowa',
'be48f1f6-5b67-2c78-cbdf-657625fe8bb1' => 'Tuba mała',
'dfc6637e-c6d5-a435-1d41-657625555443' => 'Tuba mega',
'770e7d85-03ee-0052-6098-6576258cbe49' => 'Tuba wysoka',
'8112d0d3-baca-cd8a-3b00-6576321030cb' => 'BT_IT_100',
'1441313f-245d-dfe7-92dd-6576255579fb' => 'BT_IT_250',
'c2beb683-dd0a-c76f-fd2f-6576252c68de' => 'BT_IT_500',
'8a4c1e7b-fb17-681d-a9dd-65762566ca64' => 'BT_IT_1000',
'4d063e6a-9cf1-28f4-2e98-6576251a3e7f' => 'TUBA_STD',
'be48f1f6-5b67-2c78-cbdf-657625fe8bb1' => 'TUBA_MALA',
'dfc6637e-c6d5-a435-1d41-657625555443' => 'TUBA_MEGA',
'770e7d85-03ee-0052-6098-6576258cbe49' => 'TUBA_WYS',
'81dcdf2f-a598-a18c-0a3c-65a8b1cd5a9f' => 'Gaz 200 ml',
'796e726e-3e33-3481-5b09-6576331c5014' => 'Gaz 400ml',
'64e3dd7a-306d-a31d-c060-658532cbb2b4' => 'Gaz 600ml',
'905ceee4-8ef5-aa39-2a8b-659f0dcffa8b' => 'Zestaw 2w1 B1_100ml + m20x20 ',
'6dd408f0-129f-96de-b745-659f1009426c' => 'Zestaw 2w1 B1_250ml+m20x20 ',
'be0f875a-3f01-f042-0eba-6576337e17bd' => 'Zestaw 2w1 B1_500ml+m30x30',
'5f76c0b4-261f-8883-4b88-662238c487e0' => 'Zestaw 2w1',
'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)',
'b78c2842-b4f8-ad77-e7ea-65f41571c57e' => 'Butelka D11_250ml (RPET)',
'901babfa-3d95-3a98-8dbf-659f00f4f91e' => 'Butelka D21_250ml (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)',
'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)',
'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)',
'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)',
'5f76c0b4-261f-8883-4b88-662238c487e0' => 'ZES_2_1',
'5048d070-7da8-a160-d0bd-659c6af595b4' => 'ZES_3_1',
'a1d41637-21c8-60e7-dfeb-65973bb8bc04' => 'ZES_4_1',
'e47359f6-5f25-4d4b-c472-65b77152ae8a' => 'ZES_5_1',
'58664d9d-0295-3539-4662-659f18dc4b80' => 'BT_OD_1000 (Odkamieniacz)',
'9b883933-6bb0-cc85-29b0-659f03d60a98' => 'BT_OD_500 (Odkamieniacz)',
'901babfa-3d95-3a98-8dbf-659f00f4f91e' => 'BT_OD_250 (Odkamieniacz)',
'62ea70ee-d2cc-e68b-d51b-661670a10c98' => 'BT_OD_250_NW (Odkamieniacz)',
'855e5265-8d2d-4682-8e4c-659f1d1ead09' => 'BT_ZMW_250 (zmywarka)',
'90053c7e-98fb-873e-b414-659f1bc748cc' => 'BT_DYW_500 (Dywan)',
'307f61db-5fd9-3aa6-e701-65a04f4bba88' => 'BT_NAB_500 (nabłyszczacz)',
'cd43ef35-031a-ce97-3d1c-65f41563046f' => 'BT_BOS_050',
'b78c2842-b4f8-ad77-e7ea-65f41571c57e' => 'BT_BOS_250',
'359d7556-f107-92de-4121-659f1eafeb90' => 'BT_BOS_500 ',
'd7c10cb9-7459-1174-6315-661cdae38a39' => 'BT_BOS_1000 ',
'c10933f2-62ce-cfb2-52b1-659f1f2b9e4a' => 'BT_DET_250 (szyjka)',
'8f4fdd3c-44f9-103b-3f40-659f1c128319' => 'BT_DET_500 (szyjka)',
'92a7ee9b-d953-fd7e-5c88-65c9bf1e144d' => 'BT_DET_1000 (szyjka)',
'5df47246-d0cd-4151-9bdd-65eede53aba5' => 'BT_SML_500 (sys. mleczne)',
'87a2b609-9b67-de82-8f41-65eedd4613c9' => 'BT_SML_1000 (sys. mleczne)',
'75980ea5-d89e-3923-2662-66bb55202244' => 'BT_ULA_1000',
'ab74cd2c-7720-5875-7ca5-66bb55a3e075' => 'BT_ULA_500',
'e3a77ebf-9ba1-3776-3d80-67a9e325c268' => 'BT_ULA_250',
'881d099d-36ee-3b45-b1ab-68dd2becfe84' => 'BT_IRYS_150',
'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',
'567da064-cd31-0416-2ad3-6581cc870e96' => 'Doypack 110x180mm',
'edf38614-90c3-50a7-56e8-65dda2d891c2' => 'Doypack 130x220mm',
'1ba1af85-97c7-a0a9-82e4-65a9a265358a' => 'Doypack 160x270mm',
'2e060602-334b-d053-6bd4-65a9a3d7a99b' => 'Doypack 180x290mm',
'eb0cb757-d39b-9677-b422-65eec426d4fe' => 'Blister, tabletki 6szt. 2,5g',
'64716544-e41f-3dfc-d021-657630c2bafe' => 'Blister tabletki 10szt. 3g',
'32d6dac9-321d-a935-6e1b-659f012eabd1' => 'Blister tabletki 10szt. 1,3g',
'ce7793b9-3f5a-3f5f-13dc-66013c397db1' => 'Blister mikrofibra 20x20cm',
'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',
'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',
'eb0cb757-d39b-9677-b422-65eec426d4fe' => 'BLIS_6 (2,5g)',
'64716544-e41f-3dfc-d021-657630c2bafe' => 'BLIS_10 (3g)',
'32d6dac9-321d-a935-6e1b-659f012eabd1' => 'BLIS_10 (1,3g)',
'225115e4-1ce2-9a98-b7a0-672930e3318c' => 'BLIS_10 (2g)',
'c1477582-33b9-529d-bdd2-685250fc18d4' => 'BLIS_6 (6,5g)',
'ce7793b9-3f5a-3f5f-13dc-66013c397db1' => 'BLIS_mikrofibra (20x20cm)',
'da8d7be4-58dc-4f75-f547-65c310cd97dd' => 'SLO_65',
'e1a16dbf-7216-d184-b9ed-65c310aff4d4' => 'SLO_150',
'2a9454a6-b2a1-150f-c307-65c31102cb28' => 'SLO_250',
'e6900d92-6fde-90e6-b872-67d1938745e6' => 'SLO_400',
'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',
'6014bd30-9be6-4348-5b3a-6603f015f392' => 'Wiadro 2,75l',
'786f48d6-16e7-a0a4-4aec-6628a16a0f89' => 'Pianka 100ml',
'75f4bd2a-51a8-0767-635e-66dde15af79e' => 'Pianka 200ml',
'349b50d1-0a7b-b3bd-e72e-662b42ca98ae' => 'Pianka 400ml',
'cb66a685-53e1-5f87-0a25-66967c7cb63b' => 'Doypack 210x285mm',
'75f4bd2a-51a8-0767-635e-66dde15af79e' => 'Pianka 200ml',
'225115e4-1ce2-9a98-b7a0-672930e3318c' => 'Blister tabletki 10szt. 2 g',
'e6900d92-6fde-90e6-b872-67d1938745e6' => 'Słoik 400 ml',
'e3e0c9da-6d08-e1e0-b9ba-67eaa437cb84' => 'Butelka B1_30ml',
'6014bd30-9be6-4348-5b3a-6603f015f392' => 'Wiadro 2,75l',
'48369f61-18bd-53e6-070a-659f026773ac' => 'Kartonik ',
'8bcf43bf-7b49-5dbf-6b86-67f6c12b82d7' => 'Softpack',
'6db335cc-96d5-5185-6118-65761ec65583' => 'Płyn',
'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',
'47fbe61c-20f4-5d48-118c-6851105ddc97' => 'Tabletka',
'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' =>
array (
@@ -177,6 +179,12 @@ $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',
'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' =>
array (
@@ -228,13 +236,33 @@ $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',
'5d843f39-893f-51f8-3df5-68c86f1d41c3' => 'HP1',
'31174829-986e-4d7f-4262-68b2e73742e9' => 'HP2',
'8519dfc8-5eec-0233-7f84-54d1fe00e9fc' => 'PAK1',
'2bdf9315-5c31-778d-4922-68c86f4af827' => 'PAK2',
'55020d96-73d5-7b29-3bab-654f4818e0cd' => 'MIE_HP1',
'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' =>
array (
@@ -322,6 +350,7 @@ $customDoms = array (
'end_of_line' => 'Nieaktywny',
'active' => 'Aktywny',
'new' => 'Nowość',
'e8d1191e-2c7b-c24d-88e2-68b2bd076498' => 'test',
),
'ecmsales_status_dom' =>
array (

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -196,7 +196,7 @@ function deleteRow(index) {
var error = false; // hope :)
var id = $("#product_id_" + index).val();
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();
if (comp_id == id) howmany++;
}

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();
@@ -41,7 +56,9 @@ $detail->preDisplay();
$uunit.='>'.$row['name'].'</option>';
$uunit_array[$row['id']] = $row['name'];
}
$detail->ss->assign("USAGE_UNIT_ID",$uunit);
$detail->ss->assign("USAGE_UNIT_ID",$uunit);
$detail->ss->assign("PRODUCTION_DESCRIPTION",$focus->production_description);
$tax='';
$result = $db->query("select id,name from ecmvats where deleted='0' order by name asc");

View File

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

View File

@@ -134,6 +134,23 @@ function isProductValid(id) {
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 () {
$("#address").mask("AB.CD.E.F", {
placeholder: "__.__._._",
@@ -189,12 +206,49 @@ $(document).ready(function () {
$("#searchByIndexForm").submit();
}
});
$("#exportTrigger").click(() => {
exportFile();
});
$('[name^="showAddress').click((event) => {
$("#address").val(event.target.name.split('-')[1]);
if (isAddressValid()) {
$("#searchByAddressForm").submit();
}
});
//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(
0 => array(
0 => array(
@@ -569,7 +567,8 @@ $viewdefs['EcmProducts']['DetailView'] = array(
'allCols' => true,
'hideLabel' => true,
'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,
'hideLabel' => true,
'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

@@ -1,151 +1,203 @@
<?php
//error_reporting(E_ALL);
//ini_set('display_errors', 1);
$db = $GLOBALS['db'];
if ($_GET['ajax']) {
switch ($_GET['ajax']) {
case 'addAddress':
$productId = $_GET['productId'];
$address = $_GET['address'];
$isNotFull = $_GET['isNotFull'];
// check if product exists
$productId = $db->fetchByAssoc($db->query("SELECT id FROM ecmproducts WHERE id = '$productId'"))['id'];
if ($productId == null) {
echo json_encode(array('status' => 'Error', 'msg' => 'Nie znalaziono produktu w bazie: '.$index ));
}
// check if location is empty
$location = $db->fetchByAssoc($db->query("SELECT stock_address FROM ecmproducts_stock_addresses WHERE stock_address = '$address'"));
if ($location != null) {
echo json_encode(array('status' => 'Error', 'msg' => 'Wskazana lokalizacja jest zajęta: '.$address ));
return;
}
$db->query("INSERT INTO ecmproducts_stock_addresses (ecmproduct_id, stock_address, is_not_full) VALUES ('$productId','$address', $isNotFull)");
echo json_encode(array('status' => 'Success', 'msg' => 'addAddress' ));
break;
case 'removeAddress':
$address = $_GET['address'];
$db->query("DELETE FROM ecmproducts_stock_addresses WHERE stock_address='$address'");
echo json_encode(array('status' => 'Success', 'msg' => 'removeAddress' ));
break;
case 'setIsNotFull':
$address = $_GET['address'];
$isNotFull = $_GET['isNotFull'] == 'true' ? 1 : 0;
$db->query("UPDATE ecmproducts_stock_addresses SET is_not_full=$isNotFull WHERE stock_address='$address'");
echo json_encode(array('status' => 'Success', 'msg' => 'setIsNotFull'));
break;
}
} else {
$pRes = $db->query("SELECT DISTINCT id, code FROM ecmproducts WHERE deleted=0;");
$codes = array();
while ($p = $db -> fetchByAssoc($pRes)) {
$index = str_replace("&#039;", "'", $p['code']);
array_push($codes, ['id' => $p['id'], 'code' => $index]);
}
$smarty = new Sugar_Smarty ();
if (strlen($_GET['searchType']) > 0 && $_GET['searchType'] == 'address')
{
//error_reporting(E_ALL);
//ini_set('display_errors', 1);
$db = $GLOBALS['db'];
if ($_GET['ajax']) {
switch ($_GET['ajax']) {
case 'addAddress':
$productId = $_GET['productId'];
$address = $_GET['address'];
$product = $db->fetchByAssoc($db->query("
$isNotFull = $_GET['isNotFull'];
// check if product exists
$productId = $db->fetchByAssoc($db->query("SELECT id FROM ecmproducts WHERE id = '$productId'"))['id'];
if ($productId == null) {
echo json_encode(array('status' => 'Error', 'msg' => 'Nie znalaziono produktu w bazie: ' . $index));
}
// check if location is empty
$location = $db->fetchByAssoc($db->query("SELECT stock_address FROM ecmproducts_stock_addresses WHERE stock_address = '$address'"));
if ($location != null) {
echo json_encode(array('status' => 'Error', 'msg' => 'Wskazana lokalizacja jest zajęta: ' . $address));
return;
}
$db->query("INSERT INTO ecmproducts_stock_addresses (ecmproduct_id, stock_address, is_not_full) VALUES ('$productId','$address', $isNotFull)");
echo json_encode(array('status' => 'Success', 'msg' => 'addAddress'));
break;
case 'removeAddress':
$address = $_GET['address'];
$db->query("DELETE FROM ecmproducts_stock_addresses WHERE stock_address='$address'");
echo json_encode(array('status' => 'Success', 'msg' => 'removeAddress'));
break;
case 'setIsNotFull':
$address = $_GET['address'];
$isNotFull = $_GET['isNotFull'] == 'true' ? 1 : 0;
$db->query("UPDATE ecmproducts_stock_addresses SET is_not_full=$isNotFull WHERE stock_address='$address'");
echo json_encode(array('status' => 'Success', 'msg' => 'setIsNotFull'));
break;
case 'export':
exportExcel();
break;
}
} else {
$pRes = $db->query("SELECT DISTINCT id, code FROM ecmproducts WHERE deleted=0;");
$codes = array();
while ($p = $db->fetchByAssoc($pRes)) {
$index = str_replace("&#039;", "'", $p['code']);
array_push($codes, ['id' => $p['id'], 'code' => $index]);
}
$smarty = new Sugar_Smarty();
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';"));
$state = $db->fetchByAssoc($db->query("SELECT SUM(quantity) as qty FROM ecmstockstates WHERE product_id='".$product['ecmproduct_id']."'"));
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'];
$res = $db->query("
$smarty->assign("PROCESS", "ADDRESS");
$smarty->assign("PRODUCT", $product);
}
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'];
$res = $db->query("
SELECT a.ecmproduct_id, a.stock_address, a.is_not_full, p.name, p.code FROM ecmproducts_stock_addresses AS a
INNER JOIN ecmproducts as p ON p.id=a.ecmproduct_id
WHERE p.id='$id' AND p.deleted=0;");
$addresses = array();
while ($r = $db -> fetchByAssoc($res)) {
array_push($addresses, $r);
}
$product = $db->fetchByAssoc($db->query("SELECT id, name, code, ems_qty_in_stock FROM ecmproducts WHERE id = '$id';"));
$state = $db->fetchByAssoc($db->query("SELECT SUM(quantity) as qty FROM ecmstockstates WHERE product_id='$id'"));
$product['ems_qty_in_stock'] = $state['qty'];
$smarty->assign("PROCESS", "PRODUCT");
$smarty->assign("PRODUCT", $product);
$smarty->assign("ADDRESSES", $addresses);
$addresses = array();
while ($r = $db->fetchByAssoc($res)) {
array_push($addresses, $r);
}
if (strlen($_GET['searchType']) > 0 && $_GET['searchType'] == 'allAddresses')
{
if ($_GET['onlyFull'] == "on") {
$allAddresses = getAllAddresses(true);
} else {
$allAddresses = getAllAddresses(false);
}
$res = $db->query("
SELECT a.ecmproduct_id, a.stock_address, a.is_not_full, p.name, p.code, p.ems_qty_in_stock FROM ecmproducts_stock_addresses AS a
INNER JOIN ecmproducts as p ON p.id=a.ecmproduct_id");
$used = array();
while ($r = $db -> fetchByAssoc($res)) {
array_push($used, $r);
}
$addresses = array();
$sum = 0;
foreach ($allAddresses as $a ) {
$i = array_search($a, array_column($used, 'stock_address'));
$element = ($i !== false ? $used[$i] : null);
$row = array();
$row['stock_address'] = $a;
$row['is_not_full'] = $element['is_not_full'];
if ($element) {
$row['name'] = $element['name'];
$row['code'] = $element['code'];
$row['ecmproduct_id'] = $element['ecmproduct_id'];
$state = $db->fetchByAssoc($db->query("SELECT SUM(quantity) as qty FROM ecmstockstates WHERE product_id='".$element['ecmproduct_id']."'"));
$row['stock_state'] = $state['qty'];
}
if ($_GET['allType'] == 'used' && $element) {
array_push($addresses, $row);
$sum++;
} else if ($_GET['allType'] == 'empty' && !$element) {
array_push($addresses, $row);
$sum++;
} else if ($_GET['allType'] == 'all') {
array_push($addresses, $row);
$sum++;
}
}
$smarty->assign("SUM", $sum);
$smarty->assign("ALL_TYPE", $_GET['allType']);
$smarty->assign("ONLY_FULL", $_GET['onlyFull']);
$smarty->assign("PROCESS", "ALL_ADDRESSES");
$smarty->assign("ADDRESSES", $addresses);
}
$smarty->assign("CODES", json_encode($codes));
$smarty->assign("CURRENT_ADDRESS", $_GET['address']);
$smarty->assign("CURRENT_INDEX", $_GET['index']);
echo $smarty->display ( 'modules/EcmProducts/tpls/stockAddress.tpl' );
$product = $db->fetchByAssoc($db->query("SELECT id, name, code, ems_qty_in_stock FROM ecmproducts WHERE id = '$id';"));
$state = $db->fetchByAssoc($db->query("SELECT SUM(quantity) as qty FROM ecmstockstates WHERE product_id='$id'"));
$product['ems_qty_in_stock'] = $state['qty'];
$smarty->assign("PROCESS", "PRODUCT");
$smarty->assign("PRODUCT", $product);
$smarty->assign("ADDRESSES", $addresses);
}
function getAllAddresses($onlyFull) {
if (strlen($_GET['searchType']) > 0 && $_GET['searchType'] == 'allAddresses') {
if ($_GET['onlyFull'] == "on") {
$allAddresses = getAllAddresses(true);
} else {
$allAddresses = getAllAddresses(false);
}
$res = $db->query("
SELECT a.ecmproduct_id, a.stock_address, a.is_not_full, p.name, p.code, p.ems_qty_in_stock FROM ecmproducts_stock_addresses AS a
INNER JOIN ecmproducts as p ON p.id=a.ecmproduct_id");
$used = array();
while ($r = $db->fetchByAssoc($res)) {
array_push($used, $r);
}
$addresses = array();
for ($i = 1; $i <= 17; $i++) {
$s1 = (strlen($i) == 1) ? '0'.$i : $i;
for ($j = 1; $j <= 15; $j++) {
$s2 = (strlen($j) == 1) ? '0'.$j : $j;
for ($k = 1; $k <=3; $k++) {
if ($onlyFull) {
array_push($addresses, $s1.'.'.$s2.'.'.$k.'.0');
} else {
for ($l = 0; $l <=2; $l++) {
array_push($addresses, $s1.'.'.$s2.'.'.$k.'.'.$l);
}
}
$sum = 0;
foreach ($allAddresses as $a) {
$i = array_search($a, array_column($used, 'stock_address'));
$element = ($i !== false ? $used[$i] : null);
$row = array();
$row['stock_address'] = $a;
$row['is_not_full'] = $element['is_not_full'];
if ($element) {
$row['name'] = $element['name'];
$row['code'] = $element['code'];
$row['ecmproduct_id'] = $element['ecmproduct_id'];
$state = $db->fetchByAssoc($db->query("SELECT SUM(quantity) as qty FROM ecmstockstates WHERE product_id='" . $element['ecmproduct_id'] . "'"));
$row['stock_state'] = $state['qty'];
}
if ($_GET['allType'] == 'used' && $element) {
array_push($addresses, $row);
$sum++;
} else if ($_GET['allType'] == 'empty' && !$element) {
array_push($addresses, $row);
$sum++;
} else if ($_GET['allType'] == 'all') {
array_push($addresses, $row);
$sum++;
}
}
$smarty->assign("SUM", $sum);
$smarty->assign("ALL_TYPE", $_GET['allType']);
$smarty->assign("ONLY_FULL", $_GET['onlyFull']);
$smarty->assign("PROCESS", "ALL_ADDRESSES");
$smarty->assign("ADDRESSES", $addresses);
}
$smarty->assign("CODES", json_encode($codes));
$smarty->assign("CURRENT_ADDRESS", $_GET['address']);
$smarty->assign("CURRENT_INDEX", $_GET['index']);
echo $smarty->display('modules/EcmProducts/tpls/stockAddress.tpl');
}
function getAllAddresses($onlyFull)
{
$addresses = array();
for ($i = 1; $i <= 17; $i++) {
$s1 = (strlen($i) == 1) ? '0' . $i : $i;
for ($j = 1; $j <= 15; $j++) {
$s2 = (strlen($j) == 1) ? '0' . $j : $j;
for ($k = 1; $k <= 3; $k++) {
if ($onlyFull) {
array_push($addresses, $s1 . '.' . $s2 . '.' . $k . '.0');
} else {
for ($l = 0; $l <= 2; $l++) {
array_push($addresses, $s1 . '.' . $s2 . '.' . $k . '.' . $l);
}
}
}
}
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

@@ -1,5 +1,5 @@
<div class="loader" id="loader">
<img src="themes/default/images/loading.gif" />
<img src="themes/default/images/loading.gif"/>
</div>
<script>
var CODES = {$CODES};
@@ -17,10 +17,10 @@
<input type="text" name="address" id="address" size="30" value="{$CURRENT_ADDRESS}">
</td>
<td>
<input type="hidden" name="module" value="EcmProducts" />
<input type="hidden" name="action" value="stockAddress" />
<input type="hidden" name="searchType" value="address" />
<input type="button" id="searchByAddressTrigger" value="Szukaj adresu&nbsp;" class="button" />
<input type="hidden" name="module" value="EcmProducts"/>
<input type="hidden" name="action" value="stockAddress"/>
<input type="hidden" name="searchType" value="address"/>
<input type="button" id="searchByAddressTrigger" value="Szukaj adresu&nbsp;" class="button"/>
<span style="color: red;" id="addressError"></span>
</td>
</tr>
@@ -34,11 +34,11 @@
<input type='text' name="index" id="index" size="30" value="{$CURRENT_INDEX}">
</td>
<td>
<input type="hidden" name="module" value="EcmProducts" />
<input type="hidden" name="action" value="stockAddress" />
<input type="hidden" name="searchType" value="index" />
<input type="hidden" name="productId" id="productId" value="" />
<input type="button" id="searchByIndexTrigger" value="Szukaj indeksu" class="button" />
<input type="hidden" name="module" value="EcmProducts"/>
<input type="hidden" name="action" value="stockAddress"/>
<input type="hidden" name="searchType" value="index"/>
<input type="hidden" name="productId" id="productId" value=""/>
<input type="button" id="searchByIndexTrigger" value="Szukaj indeksu" class="button"/>
<span style="color: red;" id="indexError"></span>
</td>
</tr>
@@ -57,13 +57,23 @@
</select>
</td>
<td>
<input type="hidden" name="module" value="EcmProducts" />
<input type="hidden" name="action" value="stockAddress" />
<input type="hidden" name="searchType" value="allAddresses" />
<input type="submit" id="searchByIndexTrigger" value="Pokaż adresy" class="button" />
<input type="hidden" name="module" value="EcmProducts"/>
<input type="hidden" name="action" value="stockAddress"/>
<input type="hidden" name="searchType" value="allAddresses"/>
<input type="submit" id="searchByIndexTrigger" value="Pokaż adresy" class="button"/>
</td>
</tr>
</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>
</div>
{if $PROCESS && $PROCESS=='ADDRESS'}
@@ -92,10 +102,11 @@
<td valign="top" class="oddListRowS1"
style="padding:5px !important;border-bottom:1px solid #cccccc;vertical-align:top;">
<input type="button" value="Karta produktu" class="button"
onclick="openProductCard('{$PRODUCT.ecmproduct_id}');" />&nbsp;&nbsp;
onclick="openProductCard('{$PRODUCT.ecmproduct_id}');"/>&nbsp;&nbsp;
<input type="button" value="Wyszukaj wszystkie adresy" class="button"
onclick="searchByIndex('{$PRODUCT.code}')" />&nbsp;&nbsp;
<input type="button" value="Usuń produkt z adresu" class="button" onclick="removeProductFromAddress()" />
onclick="searchByIndex('{$PRODUCT.code}')"/>&nbsp;&nbsp;
<input type="button" value="Usuń produkt z adresu" class="button"
onclick="removeProductFromAddress()"/>
</td>
</tr>
</table>
@@ -118,7 +129,7 @@
</td>
<td valign="top" class="oddListRowS1"
style="padding:5px !important;border-bottom:1px solid #cccccc;vertical-align:top;">
<input type="button" value="Dodaj produkt" class="button" onclick="addProductToAddress()" />
<input type="button" value="Dodaj produkt" class="button" onclick="addProductToAddress()"/>
</td>
</tr>
</table>
@@ -126,7 +137,10 @@
{/if}
{if $PROCESS && $PROCESS=='PRODUCT'}
<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">
<tr class="oddListRowS1">
<th style="width: 15%;"><b>Adres</b></td>
@@ -141,29 +155,29 @@
</td>
<td valign="top" class="oddListRowS1"
style="padding:5px !important;border-bottom:1px solid #cccccc;vertical-align:top;">
<input type="checkbox" {if $item.is_not_full}checked{/if}
onclick="setAddressIsNotFull('{$item.stock_address}', this)" />
<input type="checkbox" {if $item.is_not_full}checked{/if}
onclick="setAddressIsNotFull('{$item.stock_address}', this)"/>
</td>
<td valign="top" class="oddListRowS1"
style="padding:5px !important;border-bottom:1px solid #cccccc;vertical-align:top;">
<input type="button" value="Usuń lokalizację" class="button"
onclick="removeAddressFromProduct('{$item.stock_address}')" />
onclick="removeAddressFromProduct('{$item.stock_address}')"/>
</td>
</tr>
{/foreach}
<tr class="oddListRowS1">
<td valign="top" class="oddListRowS1"
style="padding:5px !important;border-bottom:1px solid #cccccc;vertical-align:top;">
<input type="text" size="10" id="newAddress" />
<input type="text" size="10" id="newAddress"/>
<span style="color: red;" id="newAddressError"></span>
</td>
<td valign="top" class="oddListRowS1"
style="padding:5px !important;border-bottom:1px solid #cccccc;vertical-align:top;">
<input type="checkbox" id="isNotFull" />
<input type="checkbox" id="isNotFull"/>
</td>
<td valign="top" class="oddListRowS1"
style="padding:5px !important;border-bottom:1px solid #cccccc;vertical-align:top;">
<input type="button" value="Dodaj lokalizację" class="button" onclick="addAddressToProduct();" />
<input type="button" value="Dodaj lokalizację" class="button" onclick="addAddressToProduct();"/>
</td>
</tr>
</table>
@@ -186,11 +200,11 @@
</td>
<td valign="top" class="oddListRowS1"
style="padding:5px !important;border-bottom:1px solid #cccccc;vertical-align:top;">
<input type="checkbox" {if $item.is_not_full}checked{/if} disabled />
<input type="checkbox" {if $item.is_not_full}checked{/if} disabled/>
</td>
<td valign="top" class="oddListRowS1"
style="padding:5px !important;border-bottom:1px solid #cccccc;vertical-align:top;">
<input type="button" value="Pokaż adres" class="button" name="showAddress-{$item.stock_address}" />
<input type="button" value="Pokaż adres" class="button" name="showAddress-{$item.stock_address}"/>
</td>
<td valign="top" class="oddListRowS1"
style="padding:5px !important;border-bottom:1px solid #cccccc;vertical-align:top;">
@@ -212,31 +226,32 @@
{/if}
<style>
{literal}
.ui-autocomplete {
max-height: 200px;
overflow-y: auto;
overflow-x: hidden;
padding-right: 20px;
border-radius: 0;
}
.ui-autocomplete {
max-height: 200px;
overflow-y: auto;
overflow-x: hidden;
padding-right: 20px;
border-radius: 0;
}
.ui-corner-all {
border-radius: 0;
}
.ui-corner-all {
border-radius: 0;
}
.loader {
display: none;
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
padding-top: 50vh;
text-align: center;
background-color: rgba(16, 16, 16, 0.5);
}
.loader {
display: none;
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
padding-top: 50vh;
text-align: center;
background-color: rgba(16, 16, 16, 0.5);
}
.loader>img {}
.loader > img {
}
{/literal}
</style>

View File

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

View File

@@ -8,7 +8,10 @@ $(document).ready(function () {
return false;
},
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,
type: "text"
@@ -60,19 +63,22 @@ $(document).ready(function () {
}
},
headers: {
3: { sorter: "production_date" },
3: {sorter: "production_date"},
},
});
$("#allTable").bind('filterEnd', function () {
$("#selectAll").attr('checked', false);
$(".allCheck").prop('checked', false);
localStorage.setItem("productionSchedule_filter", $.tablesorter.getFilters($("#allTable")));
updateTimeSummary();
});
$("#allTable").bind("sortEnd", function () {
try {
localStorage.setItem('productionSchedule_sort',
$("#allTable")[0].config.sortList[0][0] + "|" + $("#allTable")[0].config.sortList[0][1]);
} catch (e) {}
} catch (e) {
}
updateTimeSummary();
});
setTimeout(() => {
const filters = localStorage.getItem("productionSchedule_filter");
@@ -85,12 +91,13 @@ $(document).ready(function () {
var tmp = sort.split("|");
$("#allTable")[0].config.sortList = [[parseInt(tmp[0]), parseInt(tmp[1])]];
$.tablesorter.sortOn($("#allTable")[0].config, [[parseInt(tmp[0]), parseInt(tmp[1])]]);
} catch (e) { }
} catch (e) {
}
}
}, 500);
$("#selectAll").click(function () {
if (this.checked) {
$(".allCheck").each(function() {
$(".allCheck").each(function () {
if ($(this).closest('tr').is(':visible')) {
$(this).prop('checked', true);
}
@@ -98,17 +105,38 @@ $(document).ready(function () {
} else {
$(".allCheck").prop("checked", false);
}
updateTimeSummary();
});
$("#duplicateBtn").click(() => duplicatePositions());
$("#deleteBtn").click(() => { removePositions(); });
$("#excelBtn").click(() => { exportExcel(); });
$("#pdfBtn").click(() => { exportPDF(); });
$("#productionBtn").click(() => { window.alert("In progress."); });
$("#deleteBtn").click(() => {
removePositions();
});
$("#excelBtn").click(() => {
exportExcel();
});
$("#pdfBtn").click(() => {
exportPDF();
});
$("#changeDateBtn").click(() => {
changeDate();
});
$("#rawMaterialsExcelBtn").click(() => {
exportRawMaterialsExcel();
});
$("#productionBtn").click(() => {
window.alert("In progress.");
});
$("#createInsideOrder").click(createInsideOrder);
$(document).on('change', '.allCheck', function () {
updateTimeSummary();
});
});
function SetTab(tab_name) {
if (TabsMainBlock) { return; }
if (TabsMainBlock) {
return;
}
var TabMenu = document.getElementById("groupTabsPanels");
var tabs = TabMenu.getElementsByTagName("li");
for (var i = 0; i < tabs.length; i++) {
@@ -134,6 +162,7 @@ function SetTab(tab_name) {
if (SelectedTab === "1") {
}
}
function getRawMaterials() {
var ids = [];
$("input.allCheck:checkbox:checked").each(function () {
@@ -169,8 +198,10 @@ 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>");
@@ -181,7 +212,7 @@ function drawRawMaterials(data) {
}
code += "><a target=\"_blank\" href=\"index.php?module=EcmProducts&action=DetailView&record=" + el.id + "\">" + el.code + "</a></td>";
tr.append(code);
tr.append("<td title=\""+ el.fullName +"\">" + el.name + "</td>");
tr.append("<td title=\"" + el.fullName + "\">" + el.name + "</td>");
tr.append("<td id=\"qty-" + el.id + "\">" + el.quantity + "</td>");
tr.append("<td>" + el.unit + "</td>");
tr.append("<td id=\"state-" + el.id + "\">" + el.stockState + "</td>");
@@ -209,7 +240,7 @@ function drawRawMaterials(data) {
$("#selectAllRawMaterials").attr('checked', false);
$("#selectAllRawMaterials").click(function () {
if (this.checked) {
$(".rawMaterialCheck").each(function() {
$(".rawMaterialCheck").each(function () {
if ($(this).closest('tr').is(':visible')) {
$(this).prop('checked', true);
}
@@ -220,9 +251,11 @@ function drawRawMaterials(data) {
});
updateRawMaterialsPositions();
}
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>';
}
function updateRawMaterialsPositions() {
var i = 0;
$("#rawMaterialsTable").find("tr").each(function (index) {
@@ -232,6 +265,7 @@ function updateRawMaterialsPositions() {
}
});
}
function editQty(id) {
$("#edit-" + id).css("display", "none");
$("#qty-" + id).css("display", "none");
@@ -239,6 +273,7 @@ function editQty(id) {
$("#qtyInput-" + id).select();
$("#save-" + id).css("display", "inline-block");
}
function saveQty(id) {
showLoader("Trwa aktualizacja...");
$("#edit-" + id).css("display", "inline-block");
@@ -254,6 +289,7 @@ function saveQty(id) {
},
});
}
function duplicatePositions() {
var ids = [];
$("input.allCheck:checkbox:checked").each(function () {
@@ -264,7 +300,9 @@ function duplicatePositions() {
return;
}
var userResponse = window.confirm("Zduplikować pozycje?");
if (!userResponse) { return; }
if (!userResponse) {
return;
}
showLoader("Duplikowanie...");
$.ajax({
method: "get",
@@ -274,6 +312,7 @@ function duplicatePositions() {
},
});
}
function removePositions() {
var ids = [];
$("input.allCheck:checkbox:checked").each(function () {
@@ -284,23 +323,68 @@ function removePositions() {
return;
}
var userResponse = window.confirm("Usunąć pozycje?");
if (!userResponse) { return; }
if (!userResponse) {
return;
}
showLoader("Usuwanie...");
$.ajax({
method: "get",
url: $(location).attr("href") + "&to_pdf=1&ajaxAction=removePositions&ids=" + ids.join("|"),
success: function ()
{
success: function () {
window.location.reload();
},
});
}
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({
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) {
$("#edit-description-" + id).css("display", "none");
$("#description-" + id).css("display", "none");
@@ -308,6 +392,7 @@ function editDescription(id) {
$("#descriptionInput-" + id).select();
$("#save-description-" + id).css("display", "inline-block");
}
function saveDescription(id) {
$("#edit-description-" + id).css("display", "inline-block");
$("#description-" + id).css("display", "inline");
@@ -321,6 +406,7 @@ function saveDescription(id) {
},
});
}
function showLoader(msg = "Pobieranie danych") {
$.blockUI({
css: {
@@ -337,30 +423,83 @@ function showLoader(msg = "Pobieranie danych") {
message: msg
});
}
function hideLoader() {
$.unblockUI();
}
function exportExcel() {
var ids = [];
$("input.allCheck:checkbox:checked").each(function () {
ids.push($(this).val());
});
if (ids.length === 0) {
$("input.allCheck:checkbox").each(function () {
ids.push($(this).val());
});
// Check if any rows are selected
var checkedRows = $("input.allCheck:checkbox:checked").closest('tr:visible');
if (checkedRows.length === 0) {
window.alert("Wybierz pozycje do eksportu");
return;
}
// 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...");
$.ajax({
method: "get",
url: $(location).attr("href") + "&to_pdf=1&ajaxAction=exportExcel&ids=" + ids.join("|"),
success: function (response)
{
downloadFile(response.fileContent, response.fileName, 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
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 exportPDF() {
var ids = [];
$("input.allCheck:checkbox:checked").each(function () {
@@ -375,31 +514,107 @@ function exportPDF() {
$.ajax({
method: "get",
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');
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() {
var ids = [];
$('input.allCheck:checkbox:checked').each(function () {
ids.push($(this).val());
ids.push($(this).val());
});
if (ids.length === 0) {
alert('Wybierz pozycje.');
return;
alert('Wybierz pozycje.');
return;
}
var products = [];
ids.forEach(el => {
const qty = parseFloat($("#qtyInput-" + el).val().trim());
const id = $("#productId-" + el).val();
products.push(id + "|" + qty);
const qty = parseFloat($("#qtyInput-" + el).val().trim());
const id = $("#productId-" + el).val();
products.push(id + "|" + qty);
});
$("#insideOrderProducts").val(products.join('*'));
$("#createInsideOrderForm").submit();
}
}
function downloadFile(base64Data, fileName, mimeType) {
// Stwórz blob z danych base64
@@ -430,8 +645,84 @@ function downloadFile(base64Data, fileName, mimeType) {
link.click();
// Usuń link z dokumentu
setTimeout(function() {
setTimeout(function () {
document.body.removeChild(link);
window.URL.revokeObjectURL(link.href);
}, 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
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', 1);
//ini_set('display_startup_errors', 1);
//error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED);
if (!isset($_GET['ajaxAction'])) {
@@ -36,7 +36,7 @@ if (!isset($_GET['ajaxAction'])) {
removePositions($_GET['ids']);
break;
case 'saveProductionDate':
saveProductionDate($_GET['id'], $_GET['date']);
saveProductionDate($_GET['id'], $_GET['date'], $_GET['time']);
break;
case 'saveProductDescription':
saveProductDescription($_GET['id'], $_GET['description']);
@@ -44,12 +44,18 @@ if (!isset($_GET['ajaxAction'])) {
case 'exportExcel':
exportExcel($_GET['ids']);
break;
case 'exportExcelWYSIWYG':
exportExcelWYSIWYG($_POST['tableData']);
break;
case 'exportPDF':
exportPDF($_GET['ids']);
break;
case 'getRawMaterials':
getRawMaterials($_POST['ids']);
break;
case 'updateProductionDate':
updateProductionDate($_GET['ids'], $_GET['hours']);
break;
}
}
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,
p_main.code as main_product_code,
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
LEFT JOIN ecmsaleitems AS si
ON ps.ecmsaleitem_id = si.id
@@ -97,8 +105,8 @@ WHERE ps.deleted = 0 ";
if ($dateFrom != null && $dateTo != null) {
$query .= " AND (
(ps.production_date >= '$dateFrom' AND ps.production_date <= '$dateTo')
OR ps.production_date IS NULL OR ps.production_date = '0000-00-00')";
(DATE(ps.production_date) >= '$dateFrom' AND DATE(ps.production_date) <= '$dateTo')
OR ps.production_date IS NULL OR DATE(ps.production_date) = '0000-00-00 00:00:00')";
}
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 .= "ORDER BY s.delivery_date, s.register_date, s.document_no;";
$rows = $db->query($query);
$data = array();
@@ -138,13 +145,26 @@ WHERE ps.deleted = 0 ";
$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['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['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['mainProductFullCode'] = $r['main_product_code'];
$row['action_id'] = $r['action_id'];
$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;
}
return $data;
@@ -251,8 +271,8 @@ function duplicatePositions($ids)
$ids = explode("|", $ids);
foreach ($ids as $id) {
$res = $db->fetchByAssoc($db->query("SELECT * FROM productionScheduler WHERE id ='$id'"));
$query = sprintf("INSERT INTO productionScheduler VALUES ('%s', null, '%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'],
$query = sprintf("INSERT INTO productionScheduler VALUES ('%s', '%s', '%s', '%s', '%d', NOW(), NOW(), '%s', '%s', 0, '%s', '%d', '%s', '%s');",
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']);
$db->query($query);
}
@@ -268,14 +288,15 @@ function removePositions($ids)
$db->query($query);
}
function saveProductionDate($id, $date)
function saveProductionDate($id, $date, $time)
{
$db = $GLOBALS['db'];
$date = date("Y-m-d", strtotime($date));
if ($date == '1970-01-01') {
$parsedDate = date("Y-m-d", strtotime($date));
if ($parsedDate == '1970-01-01') {
$db->query("UPDATE productionScheduler SET production_date=NULL WHERE id='$id'");
} else {
$db->query("UPDATE productionScheduler SET production_date='$date' WHERE id='$id'");
$parsetDateTime = date("Y-m-d H:i", strtotime($date . ' ' . $time));
$db->query("UPDATE productionScheduler SET production_date='$parsetDateTime' WHERE id='$id'");
}
}
@@ -452,4 +473,151 @@ function generateUuidV4()
$data[6] = chr(ord($data[6]) & 0x0f | 0x40);
$data[8] = chr(ord($data[8]) & 0x3f | 0x80);
return vsprintf('%s%s-%s-%s-%s-%s%s%s', str_split(bin2hex($data), 4));
}
}
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="pdfBtn" value="PDF" type="button">
<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">
<thead>
<tr>
@@ -152,6 +153,8 @@
<th>Marka</th>
<th>Data wysyłki</th>
<th>Czynność</th>
<th>Linia</th>
<th>Czas</th>
<th>Uwagi</th>
</tr>
</thead>
@@ -177,23 +180,28 @@
{$ROW.productName}
</td>
<td>
<input id="production-date-{$ROW.id}" name="production-date-{$ROW.id}" type="text"
maxlength="10" size="11" tabindex="" title="" value="{$ROW.productionDate}"
autocomplete="off"
id="production-date-{$ROW.id}" onchange="saveProductionDate('{$ROW.id}')">
<img id="production-date-trigger-{$ROW.id}" src="themes/default/images/jscalendar.gif"
style="width: 13px;">
<script language="JavaScript" type="text/javascript">
Calendar.setup({ldelim}
inputField: "production-date-{$ROW.id}",
daFormat: "%Y-%m-%d",
button: "production-date-trigger-{$ROW.id}",
singleClick: true,
dateStr: "",
step: 1
{rdelim}
);
</script>
<div style="white-space: nowrap">
<input id="production-date-{$ROW.id}" name="production-date-{$ROW.id}" type="text"
maxlength="10" size="11" tabindex="" title="" value="{$ROW.productionDate}"
autocomplete="off"
id="production-date-{$ROW.id}" onchange="saveProductionDate('{$ROW.id}')">
<img id="production-date-trigger-{$ROW.id}" src="themes/default/images/jscalendar.gif"
style="width: 13px;">
<script language="JavaScript" type="text/javascript">
Calendar.setup({ldelim}
inputField: "production-date-{$ROW.id}",
daFormat: "%Y-%m-%d",
button: "production-date-trigger-{$ROW.id}",
singleClick: true,
dateStr: "",
step: 1
{rdelim}
);
</script>
</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 style="white-space: nowrap;">
<div id="edit-{$ROW.id}" class="ui-icon ui-icon-pencil"
@@ -245,6 +253,12 @@
{$ROW.action_index}
</a>
</td>
<td>
{$ROW.action_category}
</td>
<td>
{$ROW.action_time}
</td>
<td>
<div id="edit-description-{$ROW.id}" class="ui-icon ui-icon-pencil"
onclick="editDescription('{$ROW.id}')" style="display: inline-block;"></div>
@@ -258,10 +272,19 @@
</tr>
{/foreach}
</tbody>
<tfoot>
<tr>
<td colspan="17" style="text-align: right;"></td>
<td id="timeSummary"></td>
<td></td>
</tr>
</tfoot>
</table>
</div>
<div id="2" style="display: none">
<br>
<input class="button" id="rawMaterialsExcelBtn" value="Excel" type="button">
<div id="rawMaterialsTableContainer">
</div>
</div>

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

@@ -1,6 +1,6 @@
<?php
if (! defined ( 'sugarEntry' ) || ! sugarEntry)
die ( 'Not A Valid Entry Point' );
if (! defined('sugarEntry') || ! sugarEntry)
die('Not A Valid Entry Point');
/**
* **************************************************
@@ -11,64 +11,64 @@ if (! defined ( 'sugarEntry' ) || ! sugarEntry)
/**
* **************************************************
*/
$db = $GLOBALS ['db'];
$db = $GLOBALS['db'];
$data = array ();
$categoryArray = array ();
$data = array();
$categoryArray = array();
$sum = array ();
$sumSub = array ();
$sumSub2 = array ();
$sum = array();
$sumSub = array();
$sumSub2 = array();
$KSGROUPS=array();
$KSGROUPS = array();
$group['id']='1';
$group['name']='Towar handlowy';
$KSGROUPS[]=$group;
$group['id'] = '1';
$group['name'] = 'Towar handlowy';
$KSGROUPS[] = $group;
$group['id']='2';
$group['name']='Wyrób gotowy';
$KSGROUPS[]=$group;
$group['id'] = '2';
$group['name'] = 'Wyrób gotowy';
$KSGROUPS[] = $group;
$group['id']='3';
$group['name']='Surowiec';
$KSGROUPS[]=$group;
$group['id'] = '3';
$group['name'] = 'Surowiec';
$KSGROUPS[] = $group;
$group['id']='4';
$group['name']='Transport';
$KSGROUPS[]=$group;
$group['id'] = '4';
$group['name'] = 'Transport';
$KSGROUPS[] = $group;
if ($_GET ['selectProductActive'] != "") {
$selectProductActive = $_GET ['selectProductActive'];
if ($_GET['selectProductActive'] != "") {
$selectProductActive = $_GET['selectProductActive'];
} else {
$selectProductActive = "";
}
if ($_GET ['selectProductEol'] != "") {
$selectProductEol = $_GET ['selectProductEol'];
if ($_GET['selectProductEol'] != "") {
$selectProductEol = $_GET['selectProductEol'];
} else {
$selectProductEol = "";
}
if ($_GET ['selectStock'] != "") {
$selectStock = $_GET ['selectStock'];
if ($_GET['selectStock'] != "") {
$selectStock = $_GET['selectStock'];
} else {
$selectStock = "";
}
$datastocks = array ();
$users = array ();
$datastocks = array();
$users = array();
$queryStocks = "SELECT
name,
id
FROM ecmstocks
where deleted= 0";
$rowsStocks = $db->query ( $queryStocks );
$rowsStocks = $db->query($queryStocks);
while ( $rowStocks = $db->fetchByAssoc ( $rowsStocks ) ) {
$stocks ["name"] = $rowStocks ["name"];
$stocks ["id"] = $rowStocks ["id"];
$datastocks [] = $stocks;
while ($rowStocks = $db->fetchByAssoc($rowsStocks)) {
$stocks["name"] = $rowStocks["name"];
$stocks["id"] = $rowStocks["id"];
$datastocks[] = $stocks;
}
$query = "SELECT
@@ -80,20 +80,20 @@ ON ss.product_id = p.id
WHERE
p.deleted = '0' AND ss.quantity IS NOT NULL";
if ($_GET ['selectStock'] != "")
$query .= " AND ss.stock_id = '" . $_GET ["selectStock"] . "' ";
if ($_GET['selectStock'] != "")
$query .= " AND ss.stock_id = '" . $_GET["selectStock"] . "' ";
if ($_GET ['selectProductActive'] != "")
$query .= " AND p.product_active = '" . $_GET ["selectProductActive"] . "' ";
if ($_GET['selectProductActive'] != "")
$query .= " AND p.product_active = '" . $_GET["selectProductActive"] . "' ";
if ($_GET ['selectProductEol'] != "") {
if ($_GET ['selectProductEol'] == "1")
$query .= " AND p.status='end_of_line' ";
if ($_GET ['selectProductEol'] == "0")
if ($_GET['selectProductEol'] != "") {
if ($_GET['selectProductEol'] == "1")
$query .= " AND p.status='end_of_line' ";
if ($_GET['selectProductEol'] == "0")
$query .= " AND p.status!='end_of_line' ";
}
if($_GET['productKS']!=''){
$query .= " AND p.group_ks = '" . $_GET ["productKS"] . "' ";
if ($_GET['productKS'] != '') {
$query .= " AND p.group_ks = '" . $_GET["productKS"] . "' ";
}
$query .= " GROUP BY p.id";
@@ -106,86 +106,96 @@ $query .= " GROUP BY p.id";
/**
* **************************************************
*/
$rows = $db->query ( $query );
$rows = $db->query($query);
// prepare data for Smarty
while ( $r = $db->fetchByAssoc ( $rows ) ) {
$row = array ();
$row ["id"] = $r ["id"];
$row ["name"] = $r ["name"];
$row ["code"] = $r ["code"];
$row ["quantity"] = $r ["quantity"];
$row ["price"] = $r ["price"] ;
while ($r = $db->fetchByAssoc($rows)) {
$row = array();
$row["id"] = $r["id"];
$row["name"] = $r["name"];
$row["code"] = $r["code"];
$row["quantity"] = $r["quantity"];
$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'
FROM
ecmproductcategories_bean bean
JOIN
ecmproductcategories category ON bean.ecmproductcategory_id = category.id
WHERE bean.bean_id='" . $row ["id"] . "'
WHERE bean.bean_id='" . $row["id"] . "'
and bean.position = '1'
and bean.deleted = '0'
and category.deleted = '0';";
$rowsSubCategory = $db->query ( $querySubCategory );
$row["podkategoria"] ="";
while ( $rowSubCategory = $db->fetchByAssoc ( $rowsSubCategory ) ) {
$row ["podkategoria"] = $rowSubCategory ["podkategoria"];
$rowsSubCategory = $db->query($querySubCategory);
$row["podkategoria"] = "";
while ($rowSubCategory = $db->fetchByAssoc($rowsSubCategory)) {
$row["podkategoria"] = $rowSubCategory["podkategoria"];
}
$queryCategory = "SELECT category.name as 'kategoria'
FROM
ecmproductcategories_bean bean
JOIN
ecmproductcategories category ON bean.ecmproductcategory_id = category.id
WHERE bean.bean_id='" . $row ["id"] . "'
WHERE bean.bean_id='" . $row["id"] . "'
and bean.position = '0'
and bean.deleted = '0'
and category.deleted = '0';";
$rowscategory = $db->query ( $queryCategory );
$rowscategory = $db->query($queryCategory);
$row["kategoria"] = "";
while ( $rowcategory = $db->fetchByAssoc ( $rowscategory ) ) {
$row ["kategoria"] = $rowcategory ["kategoria"];
while ($rowcategory = $db->fetchByAssoc($rowscategory)) {
$row["kategoria"] = $rowcategory["kategoria"];
}
$data [] = $row;
$data[] = $row;
}
// //////////////// SUM /////////////////////////////////
foreach ( $data as $key => &$element ) {
$categoryArray1 [$element ["kategoria"] == "" ? "Inne" : $element ["kategoria"]] [$element ["podkategoria"] == "" ? "Reszta" : $element ["podkategoria"]] [$key] = $element;
foreach ($data as $key => &$element) {
$categoryArray1[$element["kategoria"] == "" ? "Inne" : $element["kategoria"]][$element["podkategoria"] == "" ? "Reszta" : $element["podkategoria"]][$key] = $element;
}
function cmp($a, $b) {
if ($a ["name"] == $b ["name"]) {
function cmp($a, $b)
{
if ($a["name"] == $b["name"]) {
return 0;
}
return ($a ["name"] < $b ["name"]) ? - 1 : 1;
return ($a["name"] < $b["name"]) ? -1 : 1;
}
// grupowanie po kategoriach
foreach ( $categoryArray1 as $key1 => &$element1 ) {
foreach ( $element1 as $key2 => &$element2 ) {
usort ( $element2, "cmp" );
foreach ($categoryArray1 as $key1 => &$element1) {
foreach ($element1 as $key2 => &$element2) {
usort($element2, "cmp");
$i = 0;
$tmp2 [$key1] [$key2] [0] = array (
'name' => null
$tmp2[$key1][$key2][0] = array(
'name' => null
);
$counter = 0;
foreach ( $element2 as $count => &$element3 ) {
if ($element3 ["id"] != $tmp2 [$key1] [$key2] [$i] ["id"]) {
if ($tmp2 [$key1] [$key2] [$i] ["id"] != null) {
$i ++;
foreach ($element2 as $count => &$element3) {
if ($element3["id"] != $tmp2[$key1][$key2][$i]["id"]) {
if ($tmp2[$key1][$key2][$i]["id"] != null) {
$i++;
}
$tmp2 [$key1] [$key2] [$i] ["id"] = $element3 ["id"];
$tmp2 [$key1] [$key2] [$i] ["name"] = $element3 ["name"];
$tmp2 [$key1] [$key2] [$i] ["code"] = $element3 ["code"];
$tmp2 [$key1] [$key2] [$i] ["quantity"] = $element3 ["quantity"];
$tmp2 [$key1] [$key2] [$i] ["price"] = $element3 ["price"];
$tmp2[$key1][$key2][$i]["id"] = $element3["id"];
$tmp2[$key1][$key2][$i]["name"] = $element3["name"];
$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]["price"] = $element3["price"];
}
$counter += 1;
/*
if ($element2 [$count] ["name"] != $element2 [$count + 1] ["name"]) {
$tmp2 [$key1] [$key2] [$i] ["marza"] = $tmp2 [$key1] [$key2] [$i] ["marza"] / $counter;
@@ -197,67 +207,67 @@ foreach ( $categoryArray1 as $key1 => &$element1 ) {
$categoryArray = $tmp2;
}
}
foreach ( $categoryArray as $key => &$element ) {
foreach ($categoryArray as $key => &$element) {
$count = 0;
foreach ( $element as $keyy => &$elementt ) {
foreach ( $elementt as $keyyy => &$elementtt ) {
$sumSub ["QuantitySum"] [$key] += $elementtt ["quantity"];
$sumSub ["PriceSum"] [$key] += $elementtt ["price"];
$sumSub2 ["QuantitySum"] [$key] [$keyy] += $elementtt ["quantity"];
$sumSub2 ["PriceSum"] [$key] [$keyy] += $elementtt ["price"];
foreach ($element as $keyy => &$elementt) {
foreach ($elementt as $keyyy => &$elementtt) {
$sumSub["QuantitySum"][$key] += $elementtt["quantity"];
$sumSub["PriceSum"][$key] += $elementtt["price"];
$sumSub2["QuantitySum"][$key][$keyy] += $elementtt["quantity"];
$sumSub2["PriceSum"][$key][$keyy] += $elementtt["price"];
}
$count += sizeof ( $elementt );
$categoryArray [$key] [$keyy] ["QuantitySum2"] = $sumSub2 ["QuantitySum"] [$key] [$keyy];
$categoryArray [$key] [$keyy] ["PriceSum2"] = $sumSub2 ["PriceSum"] [$key] [$keyy];
$count += sizeof($elementt);
$categoryArray[$key][$keyy]["QuantitySum2"] = $sumSub2["QuantitySum"][$key][$keyy];
$categoryArray[$key][$keyy]["PriceSum2"] = $sumSub2["PriceSum"][$key][$keyy];
}
$categoryArray [$key] ["QuantitySum"] = $sumSub ["QuantitySum"] [$key];
$categoryArray [$key] ["PriceSum"] = $sumSub ["PriceSum"] [$key];
$categoryArray[$key]["QuantitySum"] = $sumSub["QuantitySum"][$key];
$categoryArray[$key]["PriceSum"] = $sumSub["PriceSum"][$key];
}
foreach ( $categoryArray as $key => &$element ) {
$sum ["QuantitySumSum"] += $sumSub ["QuantitySum"] [$key];
$sum ["PriceSumSum"] += $sumSub ["PriceSum"] [$key];
foreach ($categoryArray as $key => &$element) {
$sum["QuantitySumSum"] += $sumSub["QuantitySum"][$key];
$sum["PriceSumSum"] += $sumSub["PriceSum"][$key];
}
foreach ( $categoryArray as $key1 => &$element ) {
foreach ( $element as $key2 => &$elements ) {
foreach ( $element as $key3 => &$element2 ) {
if ($sumSub2 ["PriceSum"] [$key1] [$key2] > $sumSub2 ["PriceSum"] [$key1] [$key3]) {
$tmp = $sumSub2 ["PriceSum"] [$key1] [$key2];
$sumSub2 ["PriceSum"] [$key1] [$key2] = $sumSub2 ["PriceSum"] [$key1] [$key3];
$sumSub2 ["PriceSum"] [$key1] [$key3] = $tmp;
foreach ($categoryArray as $key1 => &$element) {
foreach ($element as $key2 => &$elements) {
foreach ($element as $key3 => &$element2) {
if ($sumSub2["PriceSum"][$key1][$key2] > $sumSub2["PriceSum"][$key1][$key3]) {
$tmp = $sumSub2["PriceSum"][$key1][$key2];
$sumSub2["PriceSum"][$key1][$key2] = $sumSub2["PriceSum"][$key1][$key3];
$sumSub2["PriceSum"][$key1][$key3] = $tmp;
}
}
}
}
foreach ( $sumSub ["PriceSum"] as $key1 => &$element ) {
foreach ( $sumSub ["PriceSum"] as $key2 => &$element2 ) {
if ($sumSub ["PriceSum"] [$key1] > $sumSub ["PriceSum"] [$key2]) {
$tmp = $sumSub ["PriceSum"] [$key1];
$sumSub ["PriceSum"] [$key1] = $sumSub ["PriceSum"] [$key2];
$sumSub ["PriceSum"] [$key2] = $tmp;
foreach ($sumSub["PriceSum"] as $key1 => &$element) {
foreach ($sumSub["PriceSum"] as $key2 => &$element2) {
if ($sumSub["PriceSum"][$key1] > $sumSub["PriceSum"][$key2]) {
$tmp = $sumSub["PriceSum"][$key1];
$sumSub["PriceSum"][$key1] = $sumSub["PriceSum"][$key2];
$sumSub["PriceSum"][$key2] = $tmp;
}
}
}
// //////////////// SORT array /////////////////////////////////
$newArray2;
foreach ( $sumSub ["PriceSum"] as $key1 => &$element1 ) {
foreach ( $categoryArray as $key2 => &$element2 ) {
if ($sumSub ["PriceSum"] [$key1] == $categoryArray [$key2] ["PriceSum"]) {
$newArray2 [$key2] = $categoryArray [$key2];
foreach ($sumSub["PriceSum"] as $key1 => &$element1) {
foreach ($categoryArray as $key2 => &$element2) {
if ($sumSub["PriceSum"][$key1] == $categoryArray[$key2]["PriceSum"]) {
$newArray2[$key2] = $categoryArray[$key2];
}
}
}
$newArray1;
foreach ( $newArray2 as $key1 => &$element1 ) {
foreach ( $element1 as $key2 => &$element2 ) {
foreach ( $element1 as $key3 => &$element3 ) {
if ($sumSub2 ["PriceSum"] [$key1] [$key2] == $newArray2 [$key1] [$key3] ["PriceSum2"]) {
$newArray1 [$key1] [$key3] = $newArray2 [$key1] [$key3];
foreach ($newArray2 as $key1 => &$element1) {
foreach ($element1 as $key2 => &$element2) {
foreach ($element1 as $key3 => &$element3) {
if ($sumSub2["PriceSum"][$key1][$key2] == $newArray2[$key1][$key3]["PriceSum2"]) {
$newArray1[$key1][$key3] = $newArray2[$key1][$key3];
}
}
}
@@ -274,17 +284,15 @@ foreach ( $newArray2 as $key1 => &$element1 ) {
* **************************************************
*/
// create & execute smarty
$smarty = new Sugar_Smarty ();
$smarty = new Sugar_Smarty();
global $mod_strings;
$smarty->assign ( "MOD", $mod_strings );
$smarty->assign ( "DATA", $newArray1 );
$smarty->assign ( "SUM", $sum );
$smarty->assign ('KSGROUPS',$KSGROUPS);
$smarty->assign ( "STOCKS", $datastocks );
$smarty->assign ( "selectStock", $selectStock );
$smarty->assign ('selectKS',$_GET['productKS']);
$smarty->assign ( "selectProductActive", $selectProductActive );
$smarty->assign ( "selectProductEol", $selectProductEol );
echo $smarty->display ( 'modules/EcmReports/tpls/ReportStocks.tpl' );
?>
$smarty->assign("MOD", $mod_strings);
$smarty->assign("DATA", $newArray1);
$smarty->assign("SUM", $sum);
$smarty->assign('KSGROUPS', $KSGROUPS);
$smarty->assign("STOCKS", $datastocks);
$smarty->assign("selectStock", $selectStock);
$smarty->assign('selectKS', $_GET['productKS']);
$smarty->assign("selectProductActive", $selectProductActive);
$smarty->assign("selectProductEol", $selectProductEol);
echo $smarty->display('modules/EcmReports/tpls/ReportStocks.tpl');

View File

@@ -1,7 +1,7 @@
<link rel="stylesheet" type="text/css" href="include/jQuery/jquery-table/jquery.appendGrid-1.3.1.css"/>
<link rel="stylesheet" type="text/css" href="include/jQuery/jquery-ui/themes/base/jquery-ui.css"/>
<link rel="stylesheet" type="text/css" href="modules/EcmReports/TableSorter/css/theme.blue.css"/>
<link rel="stylesheet" type="text/css" href="modules/EcmReports/TableSorter/css/theme.blue2.css"/>
<link rel="stylesheet" type="text/css" href="include/jQuery/jquery-table/jquery.appendGrid-1.3.1.css" />
<link rel="stylesheet" type="text/css" href="include/jQuery/jquery-ui/themes/base/jquery-ui.css" />
<link rel="stylesheet" type="text/css" href="modules/EcmReports/TableSorter/css/theme.blue.css" />
<link rel="stylesheet" type="text/css" href="modules/EcmReports/TableSorter/css/theme.blue2.css" />
<!-- Tablesorter -->
<script type="text/javascript" src="modules/EcmReports/TableSorter/js/jquery.min.js"></script>
<script type="text/javascript" src="modules/EcmReports/TableSorter/js/jquery.tablesorter.min.js"></script>
@@ -14,7 +14,7 @@
<style type="text/css">
{literal}
{literal}
thead, tfoot {font-weight: bold;}
@@ -34,45 +34,50 @@
background-color: #BDC7B5;
}
.sumAll td{
background-color: #BDC7B5;
}
.sumAll td {
background-color: #BDC7B5;
}
table.tablesorter tbody tr:hover td {
background: #E8E8E8;
color: #343432;
background: #E8E8E8;
color: #343432;
}
/* Extra selectors needed to override the default styling */
table.tablesorter tbody tr.normal-row td {
background: #EFEFF1;
color: #343432;
background: #EFEFF1;
color: #343432;
}
table.tablesorter tbody tr.alt-row td {
background: #FFF;
color: #343432;
background: #FFF;
color: #343432;
}
/* Extra selectors needed to override the default styling */
table.tablesorter tbody tr.normal-row:hover td {
background: #E8E8E8;
color: #343432;
}
table.tablesorter tbody tr.alt-row:hover td {
background: #E8E8E8;
color: #343432;
}
table.tablesorter tbody tr.sumAll td {
background: #EBEBED;
color: black;
}
table.tablesorter tbody tr.sumAll:hover td {
background: #E0E0E2;
color: black;
font-weight: bold;
background: #E8E8E8;
color: #343432;
}
table.tablesorter .sumRow, .oddListRowS1 {
table.tablesorter tbody tr.alt-row:hover td {
background: #E8E8E8;
color: #343432;
}
table.tablesorter tbody tr.sumAll td {
background: #EBEBED;
color: black;
}
table.tablesorter tbody tr.sumAll:hover td {
background: #E0E0E2;
color: black;
font-weight: bold;
}
table.tablesorter .sumRow,
.oddListRowS1 {
text-align: right;
}
@@ -99,15 +104,16 @@
<table id="tableMenu" cellspacing="0" cellpadding="0" border="0">
<tbody>
<tr>
<td>
<img src="themes/Sugar/images/EcmProducts.gif" style="margin-top: 3px; margin-right: 3px;" alt="EcmProducts" width="16" border="0" height="16">
</td>
<td>
<h2>{$MOD.LBL_REPORT_STOCKS} </h2>
</td>
</tr>
<tbody>
<tr>
<td>
<img src="themes/Sugar/images/EcmProducts.gif" style="margin-top: 3px; margin-right: 3px;"
alt="EcmProducts" width="16" border="0" height="16">
</td>
<td>
<h2>{$MOD.LBL_REPORT_STOCKS} </h2>
</td>
</tr>
</table>
<br />
@@ -120,143 +126,177 @@
<form action="index.php" method="get" name="searchReportStocks">
<input type="hidden" name="module" value="EcmReports" />
<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>
<td class="dataLabel" width="5%" nowrap="nowrap">{$MOD.LBL_STOCK}</td>
<td class="dataField" width="10%" nowrap="nowrap">
<select id="stock" name="selectStock">
<option value="" { if $selectStock==""} selected="true" {/if} >{$MOD.LBL_ALL_STOCKS}</option>
{foreach from=$STOCKS item=STOCK key=count name=loop}
<option value="{$STOCK.id}" { if $selectStock==$STOCK.id} selected="true" {/if} >{$STOCK.name}</option>
{/foreach}
</select>
</td>
<td class="dataLabel" width="25%" nowrap="nowrap"></td>
<tr>
<td class="dataLabel" width="5%" nowrap="nowrap">{$MOD.LBL_STOCK}</td>
<td class="dataField" width="10%" nowrap="nowrap">
<select id="stock" name="selectStock">
<option value="" { if $selectStock=="" } selected="true" {/if}>{$MOD.LBL_ALL_STOCKS}</option>
{foreach from=$STOCKS item=STOCK key=count name=loop}
<option value="{$STOCK.id}" { if $selectStock==$STOCK.id} selected="true" {/if}>{$STOCK.name}
</option>
{/foreach}
</select>
</td>
<td class="dataLabel" width="25%" nowrap="nowrap"></td>
<td class="dataLabel" width="5%" nowrap="nowrap">{$MOD.LBL_PRODUCT_ACTIVE}</td>
<td class="dataField" width="10%" nowrap="nowrap">
<select id="productActive" name="selectProductActive">
<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="0" { if $selectProductActive=="0"} selected="true" {/if} >{$MOD.LBL_NO}</option>
</select>
</td>
<td class="dataLabel" width="25%" nowrap="nowrap"></td>
<td class="dataLabel" width="5%" nowrap="nowrap">End of line</td>
<td class="dataField" width="10%" nowrap="nowrap">
<select id="productEol" name="selectProductEol">
<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="0" { if $selectProductEol=="0"} selected="true" {/if} >{$MOD.LBL_NO}</option>
</select>
</td>
<td class="dataLabel" width="25%" nowrap="nowrap"></td>
<td class="dataLabel" width="5%" nowrap="nowrap">Grupa księgowa</td>
<td class="dataField" width="10%" nowrap="nowrap">
<select id="productKS" name="productKS">
<option value="" { if $selectKS==""} selected="true" {/if} >Wszystkie</option>
{foreach from=$KSGROUPS item=GROUP key=count name=loop}
<option value="{$GROUP.id}" { if $selectKS==$GROUP.id} selected="true" {/if} >{$GROUP.name}</option>
{/foreach}
</select>
</td>
<td class="dataLabel" width="25%" nowrap="nowrap"></td>
<td class="dataLabel" width="5%" nowrap="nowrap">{$MOD.LBL_PRODUCT_ACTIVE}</td>
<td class="dataField" width="10%" nowrap="nowrap">
<select id="productActive" name="selectProductActive">
<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="0" { if $selectProductActive=="0" } selected="true" {/if}>{$MOD.LBL_NO}</option>
</select>
</td>
<td class="dataLabel" width="25%" nowrap="nowrap"></td>
<td class="dataLabel" width="5%" nowrap="nowrap">End of line</td>
<td class="dataField" width="10%" nowrap="nowrap">
<select id="productEol" name="selectProductEol">
<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="0" { if $selectProductEol=="0" } selected="true" {/if}>{$MOD.LBL_NO}</option>
</select>
</td>
<td class="dataLabel" width="25%" nowrap="nowrap"></td>
<td class="dataLabel" width="5%" nowrap="nowrap">Grupa księgowa</td>
<td class="dataField" width="10%" nowrap="nowrap">
<select id="productKS" name="productKS">
<option value="" { if $selectKS=="" } selected="true" {/if}>Wszystkie</option>
{foreach from=$KSGROUPS item=GROUP key=count name=loop}
<option value="{$GROUP.id}" { if $selectKS==$GROUP.id} selected="true" {/if}>{$GROUP.name}</option>
{/foreach}
</select>
</td>
<td class="dataLabel" width="25%" nowrap="nowrap"></td>
<td class="dataLabel" width="5%" nowrap="nowrap"></td>
<td class="dataField" width="10%" nowrap="nowrap">
</td>
<td class="dataLabel" width="25%" nowrap="nowrap"></td>
<td class="dataLabel" width="5%" nowrap="nowrap"></td>
<td class="dataField" width="10%" nowrap="nowrap">
</td>
<td class="dataLabel" width="25%" nowrap="nowrap"></td>
</tr>
</tbody>
</table>
<td class="dataLabel" width="5%" nowrap="nowrap"></td>
<td class="dataField" width="10%" nowrap="nowrap">
<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 id="excelEksport" class="button" name="importToExcel" value="{$MOD.BTN_EXCEL_EXPORT}" type="button">
</td>
<td class="dataLabel" width="25%" nowrap="nowrap"></td>
<td class="dataLabel" width="5%" nowrap="nowrap"></td>
<td class="dataField" width="10%" nowrap="nowrap">
</td>
<td class="dataLabel" width="25%" nowrap="nowrap"></td>
</tr>
</tbody>
</table>
<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 id="excelEksport" class="button" name="importToExcel" value="{$MOD.BTN_EXCEL_EXPORT}" type="button">
<br>
<br>
<br>
<br>
<table id="myTable" class="tablesorter tablesorter-blue" role="grid">
<thead>
<tr class="tablesorter-headerRow" role="row">
<table id="myTable" class="tablesorter tablesorter-blue" role="grid">
<thead>
<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="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>
<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>
<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="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>
</thead>
{foreach from=$DATA item=CAT key=CATNAME name=loop}
{* Table headers *}
<tbody id="functions-core" class="tablesorter-infoOnly">
<tr class="static category">
{if $CATNAME != ""}
<td class="oddListRowS1 alignLeft"><a class="plusStyle showTables">[+]</a><b> {$CATNAME}</b></td>
{/if}
<td class="oddListRowS1" ></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/$DATA.$CATNAME.QuantitySum|number_format:2:",":"." }</b></td>
</tr>
</tbody>
{foreach from=$CAT item=CAT2 key=CAT2NAME name=loop}
{if $CAT2NAME!="QuantitySum" && $CAT2NAME!="PriceSum"}
<tbody id="functions-core" class="tablesorter-infoOnly tablesShowHide">
<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" ></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/$CAT.$CAT2NAME.QuantitySum2|number_format:2:",":"." }</b></td>
</tr>
</tbody>
</thead>
{foreach from=$DATA item=CAT key=CATNAME name=loop}
{* Table headers *}
<tbody id="functions-core" class="tablesorter-infoOnly">
<tr class="static category">
{if $CATNAME != ""}
<td class="oddListRowS1 alignLeft"><a class="plusStyle showTables">[+]</a><b> {$CATNAME}</b></td>
{/if}
<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.PriceSum|number_format:2:",":"." }</b></td>
<td class="oddListRowS1 sumRow">
<b>{$DATA.$CATNAME.PriceSum/$DATA.$CATNAME.QuantitySum|number_format:2:",":"." }</b></td>
</tr>
</tbody>
{foreach from=$CAT item=CAT2 key=CAT2NAME name=loop}
{if $CAT2NAME!="QuantitySum" && $CAT2NAME!="PriceSum"}
<tbody id="functions-core" class="tablesorter-infoOnly tablesShowHide">
<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"></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.PriceSum2|number_format:2:",":"." }</b></td>
<td class="oddListRowS1 sumRow">
<b>{$CAT.$CAT2NAME.PriceSum2/$CAT.$CAT2NAME.QuantitySum2|number_format:2:",":"." }</b></td>
</tr>
</tbody>
<tbody aria-live="polite" aria-relevant="all" class="rowShowHide">
{foreach from=$CAT2 item=ROW name=loop}
{if $CAT2NAME!="AvgPriceSum" && $CAT2NAME!="QuantitySum" && $ROW.name!=""}
{if $smarty.foreach.loop.index % 2 == 1}
<tr role="row" class="contractor">
{else}
<tr class="contractor" role="row">
{/if}
<tbody aria-live="polite" aria-relevant="all" class="rowShowHide">
{foreach from=$CAT2 item=ROW name=loop}
{if $CAT2NAME!="AvgPriceSum" && $CAT2NAME!="QuantitySum" && $ROW.name!=""}
{if $smarty.foreach.loop.index % 2 == 1}
<tr role="row" class="contractor">
{else}
<tr class="contractor" role="row">
{/if}
<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}">
{$ROW.name}
</a>
</td>
<td class="oddListRowS1 alignLeft" >{$ROW.code}</td>
<td class="oddListRowS1" >{$ROW.quantity|number_format:4:",":"."}</td>
<td class="oddListRowS1" >{$ROW.price|number_format:2:",":"."}</td>
<td class="oddListRowS1" >{$ROW.price/$ROW.quantity|number_format:2:",":"."}</td>
</tr>
{/if}
{/foreach}
</tbody>
<tbody id="stopRows"></tbody>
{/if}
{/foreach}
<tbody id="stopTables"></tbody>
{/foreach}
<tbody id="functions-core" class="tablesorter-infoOnly">
<tr class="static category sumAll">
<td class="oddListRowS1 alignLeft"><b>{$MOD.LBL_SUM}:</b></td>
<td class="oddListRowS1" ></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/$SUM.QuantitySumSum|number_format:2:",":"." }</b></td>
</tr>
</tbody>
</table>
<br/>
<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}">
{$ROW.name}
</a>
</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.price|number_format:2:",":"."}</td>
<td class="oddListRowS1">{$ROW.price/$ROW.quantity|number_format:2:",":"."}</td>
</tr>
{/if}
{/foreach}
</tbody>
<tbody id="stopRows"></tbody>
{/if}
{/foreach}
<tbody id="stopTables"></tbody>
{/foreach}
<tbody id="functions-core" class="tablesorter-infoOnly">
<tr class="static category sumAll">
<td class="oddListRowS1 alignLeft"><b>{$MOD.LBL_SUM}:</b></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.PriceSumSum|number_format:2:",":"." }</b></td>
<td class="oddListRowS1 sumRow"><b>{$SUM.PriceSumSum/$SUM.QuantitySumSum|number_format:2:",":"." }</b>
</td>
</tr>
</tbody>
</table>
<br />

View File

@@ -76,7 +76,7 @@ if (
$r = $db->fetchByAssoc ( $rows );
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("MODIFIED_BY_NAME", $focus->modified_by_name);

View File

@@ -864,7 +864,7 @@ class EcmSale extends SugarBean
$where = " and " . implode(" and ", $field_array);
else
$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;
}
@@ -1059,6 +1059,16 @@ class EcmSale extends SugarBean
$result_array[$i]['total_invoice'] = $total_invoice;
$result_array[$i]['percent'] = $percent;
$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++;
$sum_total_qty += $total_qty;

View File

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

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

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

View File

@@ -15,100 +15,15 @@ function getList() {
$(document).ready(function()
{
// 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
$("#createInsideOrder").click(createInsideOrder);
$.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
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"
});
}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"
});
}
@@ -140,32 +55,24 @@ $(document).ready(function()
$('#myTable tr').removeClass('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());
});
$("#myTable2").tablesorter({
headers: {
0: {
// disable it by setting the property sorter to false
sorter: false
},
}
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);
});
$("#myTable3").tablesorter({
headers: {
0: {
// disable it by setting the property sorter to false
sorter: false
},
}
});
});
$("#insideOrderProducts").val(products.join('*'));
$("#createInsideOrderForm").submit();
}

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);

View File

@@ -1,16 +1,15 @@
<script type="text/javascript"
src="include/ECM/EcmMultiPdf/EcmMultiPdf.js"></script>
<script type="text/javascript"
src="include/jQuery/jquery.blockUI.js"></script>
<script type="text/javascript" src="include/ECM/EcmMultiPdf/EcmMultiPdf.js"></script>
<script type="text/javascript" src="include/jQuery/jquery.blockUI.js"></script>
<table cellspacing="0" cellpadding="0" border="0">
<tr>
<td><img src="themes/Sugar/images/EcmProducts.gif"
style="margin-top: 3px; margin-right: 3px;" alt="EcmProducts"
width="16" border="0" height="16"></td>
<td><h2>{$MOD.LBL_LISTNEWSALES_NAME}</h2></td>
<td><img src="themes/Sugar/images/EcmProducts.gif" style="margin-top: 3px; margin-right: 3px;" alt="EcmProducts"
width="16" border="0" height="16"></td>
<td>
<h2>{$MOD.LBL_LISTNEWSALES_NAME}</h2>
</td>
</tr>
</table>
<br/>
<br />
<form action="index.php?module=EcmSales&action=ListNewSales" method="get" name="SearchFormListNewSales">
<ul class="tablist" style="width:100%;">
<input type="hidden" name="module" value="EcmSales">
@@ -20,21 +19,21 @@
</li>
</ul>
<table style="border-top: 0px none; margin-bottom: 4px;width:100%" class="tabForm" border="0" cellpadding="0"
cellspacing="0">
cellspacing="0">
<tr>
<td nowrap="">
Data wysyłki od
</td>
<td nowrap="">
<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"
name="date_send_from" autocomplete="off">
value="{if $POST.date_send_from!=''}{$POST.date_send_from}{else}{$smarty.now|date_format:"%d.%m.%Y"}{/if}"
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"
alt="Enter Date" src="themes/default/images/jscalendar.gif">
alt="Enter Date" src="themes/default/images/jscalendar.gif">
<script type="text/javascript">
{literal}
// musi być tu w pliku js nie chce działać
Calendar.setup({
// musi być tu w pliku js nie chce działać
Calendar.setup({
inputField: "date_send_from",
daFormat: "%d.%m.%Y",
button: "date_send_from_trigger",
@@ -42,22 +41,21 @@
dateStr: "",
step: 1,
weekNumbers: false
}
);
});
{/literal}
</script>
{$MOD.LBL_LISTNEWSALES_DATE_END}:
<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"
name="date_send_to" autocomplete="off">
value="{if $POST.date_send_to!=''}{$POST.date_send_to}{else}{$smarty.now|date_format:"%d.%m.%Y"}{/if}"
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"
src="themes/default/images/jscalendar.gif">
src="themes/default/images/jscalendar.gif">
<script type="text/javascript">
{literal}
// musi być tu w pliku js nie chce działać
Calendar.setup({
// musi być tu w pliku js nie chce działać
Calendar.setup({
inputField: "date_send_to",
daFormat: "%d.%m.%Y",
button: "date_send_to_trigger",
@@ -65,8 +63,7 @@
dateStr: "",
step: 1,
weekNumbers: false
}
);
});
{/literal}
</script>
</td>
@@ -74,7 +71,8 @@
<td rowspan="2">
<select id="sale_type" name="sale_type[]" multiple="true">
{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}
</select>
</td>
@@ -82,7 +80,8 @@
<td rowspan="2">
<select id="sale_status" name="sale_status[]" multiple="true">
{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}
</select>
</td>
@@ -91,17 +90,17 @@
</td>
<td nowrap="">
<input type="text" title="" value="{if $POST.account_name!=''}{$POST.account_name}{/if}" size=""
id="account_name" tabindex="" name="account_name">
id="account_name" tabindex="" name="account_name">
<input type="hidden" value="{if $POST.account_id!=''}{$POST.account_id}{/if}" id="account_id"
name="account_id">
name="account_id">
<input type="button"
onclick="{literal}open_popup(&quot;Accounts&quot;, 600, 400, &quot;&quot;, true, false, {&quot;call_back_function&quot;:&quot;set_return&quot;,&quot;form_name&quot;:&quot;SearchFormListNewSales&quot;,&quot;field_to_name_array&quot;:{&quot;id&quot;:&quot;account_id&quot;,&quot;name&quot;:&quot;account_name&quot;}}, &quot;single&quot;, true);{/literal}"
value="Wybierz" class="button" accesskey="T" title="Select [Alt+T]" tabindex=""
name="btn_account_name">
onclick="{literal}open_popup(&quot;Accounts&quot;, 600, 400, &quot;&quot;, true, false, {&quot;call_back_function&quot;:&quot;set_return&quot;,&quot;form_name&quot;:&quot;SearchFormListNewSales&quot;,&quot;field_to_name_array&quot;:{&quot;id&quot;:&quot;account_id&quot;,&quot;name&quot;:&quot;account_name&quot;}}, &quot;single&quot;, true);{/literal}"
value="Wybierz" class="button" accesskey="T" title="Select [Alt+T]" tabindex=""
name="btn_account_name">
<button value="Wyczyść" onclick="this.form.account_name.value = ''; this.form.account_id.value = '';"
class="button lastChild" accesskey="C" title="Wyczyść[Alt+C]" tabindex=""
name="btn_clr_parent_name_basic" type="button"><img
src="themes/default/images/id-ff-clear.png?s=bed8cd35065048ceebdc639ebe305e2c&amp;c=1">
class="button lastChild" accesskey="C" title="Wyczyść[Alt+C]" tabindex=""
name="btn_clr_parent_name_basic" type="button"><img
src="themes/default/images/id-ff-clear.png?s=bed8cd35065048ceebdc639ebe305e2c&amp;c=1">
</button>
</td>
@@ -118,14 +117,14 @@
</td>
<td nowrap="">
<input type="text" maxlength="10" size="11" tabindex="" title=""
value="{if $POST.date_from!=''}{$POST.date_from}{/if}"
id="date_from" name="date_from" autocomplete="off">
value="{if $POST.date_from!=''}{$POST.date_from}{/if}" id="date_from" name="date_from"
autocomplete="off">
<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">
{literal}
// musi być tu w pliku js nie chce działać
Calendar.setup({
// musi być tu w pliku js nie chce działać
Calendar.setup({
inputField: "date_from",
daFormat: "%d.%m.%Y",
button: "date_from_trigger",
@@ -133,20 +132,18 @@
dateStr: "",
step: 1,
weekNumbers: false
}
);
});
{/literal}
</script>
do:
<input type="text" maxlength="10" size="11" tabindex="" title=""
value="{if $POST.date_to!=''}{$POST.date_to}{/if}"
id="date_to" name="date_to" autocomplete="off">
value="{if $POST.date_to!=''}{$POST.date_to}{/if}" id="date_to" name="date_to" autocomplete="off">
<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">
{literal}
// musi być tu w pliku js nie chce działać
Calendar.setup({
// musi być tu w pliku js nie chce działać
Calendar.setup({
inputField: "date_to",
daFormat: "%d.%m.%Y",
button: "date_to_trigger",
@@ -154,8 +151,7 @@
dateStr: "",
step: 1,
weekNumbers: false
}
);
});
{/literal}
</script>
</td>
@@ -164,169 +160,180 @@
</td>
<td nowrap="">
<input type="text" value="{if $POST.parent_order_no!=''}{$POST.parent_order_no}{/if}"
name="parent_order_no">
name="parent_order_no">
</td>
</tr>
</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="submit" value="{$MOD.LBL_LISTNEWSALES_POST}" name="submit" class="button">
<input type="button" onclick="location.href='index.php?module=EcmSales&amp;action=ListNewSales';"
value="{$MOD.LBL_LISTNEWSALES_CLEAR}" name="clear" class="button">
value="{$MOD.LBL_LISTNEWSALES_CLEAR}" name="clear" class="button">
<input type="button" id="gets" class="button" name="gets" value="{$MOD.LBL_LISTNEWSALES_CREATE_PDFS}"
onclick="createMultiPdf()">
onclick="createMultiPdf()">
<input type="button" id="products_list" class="button" name="products_list"
value="{$MOD.LBL_LISTNEWSALES_PRODUCT_SUMMARY}" onclick="getSelected(); getList();">
value="{$MOD.LBL_LISTNEWSALES_PRODUCT_SUMMARY}" onclick="getSelected(); getList();">
<input type="button" id="products_list" class="button" name="products_list"
value="{$MOD.LBL_LISTNEWSALES_PRODUCT_SUMMARY} 2" onclick="getSelected(); getList2();">
value="{$MOD.LBL_LISTNEWSALES_PRODUCT_SUMMARY} 2" onclick="getSelected(); getList2();">
<input type="button" id="products_list" class="button" name="products_list" value="Lista komponentów"
onclick="getSelected(); getList3();">
onclick="getSelected(); getList3();">
<br>{if $LINK!=''}<a href="https://95.50.148.50/crm/pdftmp/{$LINK}">{$LINK}</a>{/if}
<table cellspacing="0" cellpadding="0" border="0" style="width:100%;" id="myTable" class="tablesorter">
<thead>
<tr>
<th><input type="checkbox" name="selectall" id="selectall"></th>
<th>{$MOD.LBL_LISTNEWSALES_POS}</th>
<th>{$MOD.LBL_LISTNEWSALES_NUMBER}</th>
<th>{$MOD.LBL_LISTNEWSALES_DESCRIPTION}</th>
<th>{$MOD.LBL_LISTNEWSALES_PARENT_NAME}</th>
<th>{$MOD.LBL_LISTNEWSALES_DELIVERY_DATE}</th>
<th></th>
<th>Termin wysyłki</th>
<th>{$MOD.LBL_LISTNEWSALES_QUANTITY}</th>
<th>{$MOD.LBL_LISTNEWSALES_TOTAL_NETTO}</th>
<th>{$MOD.LBL_LISTNEWSALES_TOTAL_VAT}</th>
<th>{$MOD.LBL_LISTNEWSALES_TOTAL_BRUTTO}</th>
<th>{$MOD.LBL_LISTNEWSALES_TOTAL_INVOICE}</th>
<th>{$MOD.LBL_LISTNEWSALES_PERCENT}</th>
<th>{$MOD.LBL_LISTNEWSALES_CURRENCY}</th>
<th>{$MOD.LBL_LISTNEWSALES_PRINTED}</th>
<td>&nbsp;</td>
</tr>
<tr>
<th><input type="checkbox" name="selectall" id="selectall"></th>
<th>{$MOD.LBL_LISTNEWSALES_POS}</th>
<th>{$MOD.LBL_LISTNEWSALES_NUMBER}</th>
<th>{$MOD.LBL_LISTNEWSALES_DESCRIPTION}</th>
<th>{$MOD.LBL_LISTNEWSALES_PARENT_NAME}</th>
<th>{$MOD.LBL_LISTNEWSALES_DELIVERY_DATE}</th>
<th></th>
<th>Termin wysyłki</th>
<th>{$MOD.LBL_LISTNEWSALES_QUANTITY}</th>
<th>{$MOD.LBL_LISTNEWSALES_TOTAL_NETTO}</th>
<th>{$MOD.LBL_LISTNEWSALES_TOTAL_VAT}</th>
<th>{$MOD.LBL_LISTNEWSALES_TOTAL_BRUTTO}</th>
<th>{$MOD.LBL_LISTNEWSALES_TOTAL_INVOICE}</th>
<th>{$MOD.LBL_LISTNEWSALES_PERCENT}</th>
<th>{$MOD.LBL_LISTNEWSALES_CURRENCY}</th>
<th>{$MOD.LBL_LISTNEWSALES_PRINTED}</th>
<td>&nbsp;</td>
</tr>
</thead>
<tbody>
{foreach from=$POSITION_LIST key="key" item="item" name="components"}
{if $item.id!=''}
<tr style="vertical-align:top;">
<td><input type="checkbox" value="{$item.id}" class="make_pdf" id="make_pdf_{$item.position}"
name="selectedid[]"></td>
<td>{$item.position}</td>
<td data-price="{$item.number}"><a
{foreach from=$POSITION_LIST key="key" item="item" name="components"}
{if $item.id!=''}
<tr style="vertical-align:top;">
<td><input type="checkbox" value="{$item.id}" class="make_pdf" id="make_pdf_{$item.position}"
name="selectedid[]"></td>
<td>{$item.position}</td>
<td data-price="{$item.number}"><a
href="index.php?module=EcmSales&action=DetailView&record={$item.id}">{$item.document_no}</a>
</td>
<td></td>
<td>
<a href="index.php?module=Accounts&action=DetailView&record={$item.parent_id}">{$item.parent_name}</a>
</td>
<td>{$item.delivery_date}</td>
<td><input type="checkbox" {if $item.send_accepted==true}checked="checked" {/if}
disabled="disabled"></td>
<td>{$item.send_date} </td>
<td style="text-align: right">{$item.quantity}</td>
<td data-total="{$item.total_netto}"
style="text-align: right">{$item.total_netto|number_format:2:".":","}</td>
<td data-total="{$item.total_vat}"
style="text-align: right">{$item.total_vat|number_format:2:".":","}</td>
<td data-total="{$item.total_brutto}"
style="text-align: right">{$item.total_brutto|number_format:2:".":","}</td>
<td data-total="{$item.total_invoice}"
style="text-align: right">{$item.total_invoice|number_format:2:".":","}</td>
<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
</td>
<td></td>
<td>
<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>{$item.delivery_date}</td>
<td><input type="checkbox" {if $item.send_accepted==true}checked="checked" {/if} disabled="disabled">
</td>
<td>{$item.send_date} </td>
<td style="text-align: right">{$item.quantity}</td>
<td data-total="{$item.total_netto}" style="text-align: right">
{$item.total_netto|number_format:2:".":","}</td>
<td data-total="{$item.total_vat}" style="text-align: right">{$item.total_vat|number_format:2:".":","}
</td>
<td data-total="{$item.total_brutto}" style="text-align: right">
{$item.total_brutto|number_format:2:".":","}</td>
<td data-total="{$item.total_invoice}" style="text-align: right">
{$item.total_invoice|number_format:2:".":","}</td>
<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
border="0" src="modules/EcmQuotes/images/search.gif"></a>
<div style="display:none; border: 1px solid #cccccc;background-color:#e6e6e6;padding:3px;"
id="div{$item.id}">
<table cellspacing="0" cellpadding="3" border="0">
<tbody>
<tr>
<td width="40%"><strong>Index</strong></td>
<td><strong>Order</strong></td>
<td><strong>WZ</strong></td>
<td><strong>ETA</strong></td>
</tr>
{foreach from=$item.products key="ki" item="va" name="products"}
{if $va.code!=''}
<tr style="color:black;">
<td style="color:black;"><a
href="index.php?module=EcmProducts&amp;action=DetailView&amp;record={$va.id}">{$va.code}</a>
</td>
{if $va.order>$va.wz}
<td style="color:red;">{$va.order|number_format:2:".":","}</td>
<td style="color:red;">{$va.wz|number_format:2:".":","}</td>
{else}
<td style="color:black;">{$va.order|number_format:2:".":","}</td>
<td style="color:black;">{$va.wz|number_format:2:".":","}</td>
{/if}
<td style="color:black;"></td>
<div style="display:none; border: 1px solid #cccccc;background-color:#e6e6e6;padding:3px;"
id="div{$item.id}">
<table cellspacing="0" cellpadding="3" border="0">
<tbody>
<tr>
<td width="40%"><strong>Index</strong></td>
<td><strong>Order</strong></td>
<td><strong>WZ</strong></td>
<td><strong>ETA</strong></td>
</tr>
{/if}
{/foreach}
{foreach from=$item.products key="ki" item="va" name="products"}
{if $va.code!=''}
<tr style="color:black;">
<td style="color:black;"><a
href="index.php?module=EcmProducts&amp;action=DetailView&amp;record={$va.id}">{$va.code}</a>
</td>
{if $va.order>$va.wz}
<td style="color:red;">{$va.order|number_format:2:".":","}</td>
<td style="color:red;">{$va.wz|number_format:2:".":","}</td>
{else}
<td style="color:black;">{$va.order|number_format:2:".":","}</td>
<td style="color:black;">{$va.wz|number_format:2:".":","}</td>
{/if}
<td style="color:black;"></td>
</tr>
{/if}
{/foreach}
<tr style="color:black;font-weight:bold">
<td>Total</td>
<td>{$item.products.order_total|number_format:2:".":","}</td>
<td>{$item.products.wz_total|number_format:2:".":","}</td>
</tr>
<tr>
<td></td>
<td></td>
<td>
<span style="color:red;font-weight:bold">{$item.products.minus|number_format:2:".":","}</span>
</td>
</tr>
<tr>
<td></td>
<td></td>
<td>
<span style="color:green;font-weight:bold">{$item.products.plus|number_format:2:".":","}</span>
</td>
</tr>
</tbody>
</table>
</div>
</td>
<td style="text-align: right">{$CURRENCIES[$item.currency]}</td>
<td></td>
<td>
{if $item.type!='gratis'}
{if $item.fv_switch=='yes'}<img border="0" id="convert_to_invoice_{$item.id}"
src="modules/EcmSales/images/convert_disabled.gif"
title="{$item.fv_name}" style="cursor:pointer;"
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}"
src="modules/EcmSales/images/convert_enabled.gif"
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}"
style="cursor:pointer;" />{/if}
{if $item.wz_switch=='disabled'}<img src="modules/EcmSales/images/create_wz_disabled.gif"
title="{$item.wz_name}"
onclick="{literal}window.open('index.php?module=EcmStockDocOuts&action=DetailView&record={/literal}{$item.wz_id}{literal}','_newtab');{/literal}"
style="cursor: pointer;" border="0">&nbsp;{/if}
{if $item.wz_switch=='enabled'}<img src="modules/EcmSales/images/create_wz_enabled.gif"
title="{$MOD.LBL_LISTNEWSALES_CREATEWZ}"
onclick="{literal}javascript:window.open('index.php?module=EcmStockDocOuts&amp;action=EditView&parent_doc_type=EcmSales&parent_doc_id={/literal}{$item.id}{literal}','_newtab');{/literal}"
style="cursor: pointer;" border="0">{/if}
{else}
{if $item.rw_switch=='disabled'}<img src="modules/EcmSales/images/create_wz_disabled.gif"
title="{$item.rw_name}"
onclick="{literal}window.open('index.php?module=EcmStockDocInsideOuts&action=DetailView&record={/literal}{$item.rw_id}{literal}','_newtab');{/literal}"
style="cursor: pointer;" border="0">&nbsp;{/if}
{if $item.rw_switch=='enabled'}<img src="modules/EcmSales/images/create_wz_enabled.gif"
title="{$MOD.LBL_LISTNEWSALES_CREATERW}"
onclick="{literal}javascript:window.open('index.php?module=EcmStockDocInsideOuts&amp;action=EditView&parent_doc_type=EcmSales&parent_doc_id={/literal}{$item.id}{literal}','_newtab');{/literal}"
style="cursor: pointer;" border="0">{/if}
{/if}
<img src="modules/EcmSales/images/pdf.gif" title="Preview Sale"
onclick="{literal}EcmPreviewPDF('index.php?module=EcmSales&action=previewPDF&method=I&record={$item.id}&to_pdf=1',{zoom:75,toolbar:1});{/literal}"
style="cursor: pointer;" border="0">
</td>
</tr>
<tr style="color:black;font-weight:bold">
<td>Total</td>
<td>{$item.products.order_total|number_format:2:".":","}</td>
<td>{$item.products.wz_total|number_format:2:".":","}</td>
</tr>
<tr>
<td></td>
<td></td>
<td>
<span
style="color:red;font-weight:bold">{$item.products.minus|number_format:2:".":","}</span>
</td>
</tr>
<tr>
<td></td>
<td></td>
<td>
<span
style="color:green;font-weight:bold">{$item.products.plus|number_format:2:".":","}</span>
</td>
</tr>
</tbody>
</table>
</div>
</td>
<td style="text-align: right">{$CURRENCIES[$item.currency]}</td>
<td></td>
<td>
{if $item.type!='gratis'}
{if $item.fv_switch=='yes'}<img border="0" id="convert_to_invoice_{$item.id}"
src="modules/EcmSales/images/convert_disabled.gif" title="{$item.fv_name}"
style="cursor:pointer;"
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}"
src="modules/EcmSales/images/convert_enabled.gif" 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}"
style="cursor:pointer;" />{/if}
{if $item.wz_switch=='disabled'}<img src="modules/EcmSales/images/create_wz_disabled.gif"
title="{$item.wz_name}"
onclick="{literal}window.open('index.php?module=EcmStockDocOuts&action=DetailView&record={/literal}{$item.wz_id}{literal}','_newtab');{/literal}"
style="cursor: pointer;" border="0">&nbsp;{/if}
{if $item.wz_switch=='enabled'}<img src="modules/EcmSales/images/create_wz_enabled.gif"
title="{$MOD.LBL_LISTNEWSALES_CREATEWZ}"
onclick="{literal}javascript:window.open('index.php?module=EcmStockDocOuts&amp;action=EditView&parent_doc_type=EcmSales&parent_doc_id={/literal}{$item.id}{literal}','_newtab');{/literal}"
style="cursor: pointer;" border="0">{/if}
{else}
{if $item.rw_switch=='disabled'}<img src="modules/EcmSales/images/create_wz_disabled.gif"
title="{$item.rw_name}"
onclick="{literal}window.open('index.php?module=EcmStockDocInsideOuts&action=DetailView&record={/literal}{$item.rw_id}{literal}','_newtab');{/literal}"
style="cursor: pointer;" border="0">&nbsp;{/if}
{if $item.rw_switch=='enabled'}<img src="modules/EcmSales/images/create_wz_enabled.gif"
title="{$MOD.LBL_LISTNEWSALES_CREATERW}"
onclick="{literal}javascript:window.open('index.php?module=EcmStockDocInsideOuts&amp;action=EditView&parent_doc_type=EcmSales&parent_doc_id={/literal}{$item.id}{literal}','_newtab');{/literal}"
style="cursor: pointer;" border="0">{/if}
{/if}
<img src="modules/EcmSales/images/pdf.gif" title="Preview Sale"
onclick="{literal}EcmPreviewPDF('index.php?module=EcmSales&action=previewPDF&method=I&record={$item.id}&to_pdf=1',{zoom:75,toolbar:1});{/literal}"
style="cursor: pointer;" border="0">
</td>
</tr>
{/if}
{/foreach}
{/foreach}
</tbody>
<tr style="vertical-align:top;">
<td></td>
@@ -343,56 +350,58 @@
<td style="text-align: right">{$POSITION_LIST.total_brutto|number_format:2:".":","}</td>
<td style="text-align: right">{$POSITION_LIST.total_invoice|number_format:2:".":","}</td>
<td style="text-align: right">{$POSITION_LIST.total_percent|string_format:"%.2f"}%<a style="cursor:pointer;"
onclick="{literal}if(document.getElementById('div_all').style.display=='none'){document.getElementById('div_all').style.display='block';}else{document.getElementById('div_all').style.display='none';}{/literal}"><img
border="0" src="modules/EcmQuotes/images/search.gif"></a>
onclick="{literal}if(document.getElementById('div_all').style.display=='none'){document.getElementById('div_all').style.display='block';}else{document.getElementById('div_all').style.display='none';}{/literal}"><img
border="0" src="modules/EcmQuotes/images/search.gif"></a>
<div style="display:none; border: 1px solid #cccccc;background-color:#e6e6e6;padding:3px;" id="div_all">
<table cellspacing="0" cellpadding="3" border="0">
<tbody>
<tr>
<td width="40%"><strong>Index</strong></td>
<td><strong>Order</strong></td>
<td><strong>WZ</strong></td>
<td><strong>ETA</strong></td>
{foreach from=$POSITION_LIST.total_product key="ki" item="va" name="products"}
{if $va.code!=''}
<tr>
<td width="40%"><strong>Index</strong></td>
<td><strong>Order</strong></td>
<td><strong>WZ</strong></td>
<td><strong>ETA</strong></td>
{foreach from=$POSITION_LIST.total_product key="ki" item="va" name="products"}
{if $va.code!=''}
<tr style="color:black;">
<td style="color:black;"><a
href="index.php?module=EcmProducts&amp;action=DetailView&amp;record={$va.id}">{$va.code}</a>
</td>
{if $va.order>$va.wz}
<td style="color:red;">{$va.order|number_format:2:".":","}</td>
<td style="color:red;">{$va.wz|number_format:2:".":","}</td>
{else}
<td style="color:black;">{$va.order|number_format:2:".":","}</td>
<td style="color:black;">{$va.wz|number_format:2:".":","}</td>
{/if}
<td style="color:black;"></td>
</tr>
{/if}
{/foreach}
<tr style="color:black;font-weight:bold">
<td>Total</td>
<td>{$POSITION_LIST.total_product.order_total|number_format:2:".":","}</td>
<td>{$POSITION_LIST.total_product.wz_total|number_format:2:".":","}</td>
</tr>
<tr>
<td></td>
<td></td>
<td>
<span style="color:red;font-weight:bold">{$POSITION_LIST.total_product.minus|number_format:2:".":","}</span>
</td>
</tr>
<tr>
<td></td>
<td></td>
<td>
<span style="color:green;font-weight:bold">{$POSITION_LIST.total_product.plus|number_format:2:".":","}</span>
</td>
</tr>
</tbody>
</table>
</div>
<tr style="color:black;">
<td style="color:black;"><a
href="index.php?module=EcmProducts&amp;action=DetailView&amp;record={$va.id}">{$va.code}</a>
</td>
{if $va.order>$va.wz}
<td style="color:red;">{$va.order|number_format:2:".":","}</td>
<td style="color:red;">{$va.wz|number_format:2:".":","}</td>
{else}
<td style="color:black;">{$va.order|number_format:2:".":","}</td>
<td style="color:black;">{$va.wz|number_format:2:".":","}</td>
{/if}
<td style="color:black;"></td>
</tr>
{/if}
{/foreach}
<tr style="color:black;font-weight:bold">
<td>Total</td>
<td>{$POSITION_LIST.total_product.order_total|number_format:2:".":","}</td>
<td>{$POSITION_LIST.total_product.wz_total|number_format:2:".":","}</td>
</tr>
<tr>
<td></td>
<td></td>
<td>
<span
style="color:red;font-weight:bold">{$POSITION_LIST.total_product.minus|number_format:2:".":","}</span>
</td>
</tr>
<tr>
<td></td>
<td></td>
<td>
<span
style="color:green;font-weight:bold">{$POSITION_LIST.total_product.plus|number_format:2:".":","}</span>
</td>
</tr>
</tbody>
</table>
</div>
</table>
</table>

View File

@@ -8,6 +8,7 @@
</tr>
</table>
<br />
<form style="display:none;" action="index.php?module=EcmSales&action=ProductSummary" method="post"
name="SearchFormListNewSales">
<ul class="tablist" style="width:100%;">
@@ -166,7 +167,11 @@
<input type="hidden" value="{$IDS}" name='ids' id='ids'>
</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">
<thead>
<tr>
@@ -184,8 +189,11 @@
{foreach from=$POSITION_LIST key="key" item="item" name="components"}
{if $item.id!=''}
<tr style="vertical-align:top;">
<td style="text-align:center;"><input type="checkbox" value="{$item.id}" class="make_pdf"
id="make_pdf_{$item.position}" name="selectedid[]"></td>
<td style="text-align:center;"><input type="checkbox" value="{$item.id}"
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.name}</td>
<td>{$item.product_category_name}</td>