Fix: Product, Product Category, Product Permutation, Supplier, Supplier Purchase Order, and Manufacturing Purchase Order architecture update for getting and saving data.

This commit is contained in:
2024-11-02 15:49:40 +00:00
parent db5ee79db0
commit 8c4efc73da
90 changed files with 3247 additions and 1472 deletions

104
app.log.1 Normal file
View File

@@ -0,0 +1,104 @@
Server Error: (MySQLdb.OperationalError) (1054, "Unknown column 'cost_local' in 'field list'")
[SQL: CALL p_shop_get_many_product(%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)]
[parameters: (1, True, False, '', True, False, '', True, False, '', False, False, '', False, 0)]
(Background on this error at: https://sqlalche.me/e/20/e3q8)
Request: 127.0.0.1 GET http /store/permutations? Host: 127.0.0.1:5000
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:131.0) Gecko/20100101 Firefox/131.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/png,image/svg+xml,*/*;q=0.8
Accept-Language: en-GB,en;q=0.5
Accept-Encoding: gzip, deflate, br, zstd
Referer: http://127.0.0.1:5000/store/permutations
Dnt: 1
Connection: keep-alive
Cookie: session=.eJytVlnzokgS_yoTRsw8tTY3-I_omPUCRUFB5HohCgqkuOUQcba_-xba090PM3tErKFYVZlk_rLy_GMCujYua9SE8NKE9eTjj0kACg_AHBVe05Z1OPlo6y789NNx92J8n4Y5QNnkYxLCHtRwliMIs7AtiyZHbfyP60idBWU--TSJUN20BcixwIkRQjjgMwS9oKvrsAgGD4YR6LJ28lF0WfYi1eEVlcVfEN4AyO9rbzSCwHJf___kWIHy52wgzFlIzAFP-IAkojAaFTbeC7F3D2sUoRBOPiKQNeGLgoog62AIPXNh_ND6thOTm67Cqn42vunqbwYpf9o9PY-GT77i-2rqyGvLNCwwXRB4GvoszUOf8Sma4aM5iCDPBYAGfsBAjgwYBkQjxO6bG0AQhE3zXUI4yLEvBeiI5BTYO3RYyZmfK-N-qSQXSidUdYd6BGz1uUtKBLY6EWwV7jDMU9d2Wr-AMXjuejVxMzdxy6OUMT5iyWBgY2jrpbJiE58i7ruCmM2yYR07BymE20hQltPHzAY9BQ5hOOzkRxAuTpDfXPcBf1k5WqwkR7Pzbmia7hQa3oZpxisnehCEqiwqLNObAzdvJG9nZ-fl9rjyjuyFcKfF5tjXTqG5BwJJ0cUs_eXtcSMYLQMFeZUOmmYe2cUmhsxG7rWkCfa5LW7OMbewDZgF5Wmf7kuFAVAMH1YfXwGFhFt89_VrMqUV0hC0Y5prvM3Ep6FYnWMPLabZahk3tkPvXdJJ85vqhY7DlGtIOf0wn9bLpa4_uav0kM3W8LeOH9JFGCy1WFRvuju9IQSyA9_4oi2ea49doPVD3YBeXhUaH2e6mapphD8VEDtVX9erjXNMTnpJ80fBuSnlNmF4Mr1uzQXTi8fDvCr4mamrZsoB1ScEw7rtnXK7aOMrDoPwUaE6bDyAQ5DkaYKlBZ4hfpwjHBQCxxDEKwv-IkrOl-eOVNGu2RU6G6x23C6tbHOF93lbueO-MO-h7V70lGH8RL672ytppuJBEWNSH-T5DAvrgKXWfi627hm_kJsppMTBXbEtsPTUl0zCp9inb2UEeAlmY9-6jMozdwvjINc6TEtd6ZFBad4FFFlBKV64FBkDq-8cat6OIRtIWQK35vDWERNwu3wekXDHoVkEuUg5th4H6B2eju3GUBKHw_PydNdqriQaoaxhqhrYWMphVMkZVEqNlXXAqE8duWuHONHKXF1fe7nYzQMpyN01WcKt3gfD5amdL4OO8C9XU5wOP6dCpqRYVy4Sji0_ZUOWXEvrAoktRszQXqYYV-aK8xiOl5nseoylVYxNq6zFi7JOOcXYcUqy6NRkR1ijI3KzdaysGdPTtXQay00POVm5kt64tn73C7UFWL8mwRffIVfv_vnHezbtZkGe5cAy011S5Y71eLrn_0PKY3sce5SJcRHwFtr6w0hJW6NiA9jxw3jim8pEzkxjW7PE7JxW3CVPxxJUObaGjsmGVp4LAvvgqa43I15mDDjFCJ7KWmOOa4VQMM6ANtGoA-siwHopqMmFUfIdq1oKczTMVFlnsfpcIsfY9G5u5q_YoLIXLjiQB42a67CQGWDLJyeraJcUKD3TCTNnVZDN-3Mi5gYOfoyrw3GZvOIpc4twuzyqWUUGhTzArfwEKXwopk6PpY5Y0ftSbp4N78ie3YpSRjuNtKF2REzu-ao-S_paR5vBH7RtqnJSdMYu4pfirlxCkzUXIHxKp1ogqelq6kVRcjuTlFzsiUQPs3XkWNJpfbBbfi8AckvkLmE0XlFFmtXpzVEn6bO5BzVdbC3y0TgU0THzm8F14uZeMqIBVHqeeO5GmhtHK6UYQyCHRcI30y6trekuue0HizkfdG5FMEkxZzyRmMY6cuim5S7DihrurFwXSb8ZiL1U-CIuyYfFpRZYjznQvtCtuRNvIunsOewRy3oKnV4fUL9cZXsqOxfafNke79Hl_mgAjFJyoWngXq7tYR-ZnPpQROoiOMF0X516m1tSJojP7F0HvGSO9asJymrsjPhZIPhLVZcRysJf3vPCp8mrYHnt8OJZhqDGTe_d-1ARla_-1-HmPLlKydDeVMVaxWf0uB15Stee5tbCFy_LOL8n_8sI8jetH5fUd41lBIFmxrHiz6LLsNT7oGmwgrhtq-bj82cY3qdFD1KK4Lgw4mIBPYpZ18xe08eo6jPW9W0w-M-gChSk_455ZCmLYKSb10elci6emOq2bhLpRho9JlcoaLtxUPuOsJlda3AHLahfcN7LzywN6YhiGIKHLMXykcBEFB8AgsedxYcc83vzhRGI3-ov1fU3-OUl61d68Ssl4m8Aix_24f1bZINXIZxVxcvjaHRYP92vSu1eP1B99N3-6nGi0ZqFkniVTEaHF2Pn_zezWldB0OJpbHTGhCIoZkqSU4I0iPkHSX1QxIyjGHfy9evXfwErYp4O.ZySbdA.IOzQ4B0k8HNh-01pbYKqF3sN8jI
Upgrade-Insecure-Requests: 1
Sec-Fetch-Dest: document
Sec-Fetch-Mode: navigate
Sec-Fetch-Site: same-origin
Sec-Fetch-User: ?1
Sec-Gpc: 1
Priority: u=0, i
Request data: b''
Traceback: Traceback (most recent call last):
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\engine\base.py", line 1967, in _exec_single_context
self.dialect.do_execute(
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\engine\default.py", line 924, in do_execute
cursor.execute(statement, parameters)
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\MySQLdb\cursors.py", line 179, in execute
res = self._query(mogrified_query)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\MySQLdb\cursors.py", line 330, in _query
db.query(q)
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\MySQLdb\connections.py", line 261, in query
_mysql.connection.query(self, query)
MySQLdb.OperationalError: (1054, "Unknown column 'cost_local' in 'field list'")
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask\app.py", line 880, in full_dispatch_request
rv = self.dispatch_request()
^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask\app.py", line 865, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args) # type: ignore[no-any-return]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\controllers\store\product_permutation.py", line 98, in permutations
model = Model_View_Store_Product_Permutation(form_filters)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\models\model_view_store_product_permutation.py", line 53, in __init__
self.category_list, errors = datastore_store.get_many_product(filters_product)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\datastores\datastore_store_base.py", line 76, in get_many_product
result = cls.db_procedure_execute('p_shop_get_many_product', argument_dict)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\datastores\datastore_base.py", line 96, in db_procedure_execute
result = db.session.execute(proc_string, argument_dict_list)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\orm\scoping.py", line 778, in execute
return self._proxied.execute(
^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\orm\session.py", line 2351, in execute
return self._execute_internal(
^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\orm\session.py", line 2245, in _execute_internal
result = conn.execute(
^^^^^^^^^^^^^
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\engine\base.py", line 1418, in execute
return meth(
^^^^^
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\sql\elements.py", line 515, in _execute_on_connection
return connection._execute_clauseelement(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\engine\base.py", line 1640, in _execute_clauseelement
ret = self._execute_context(
^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\engine\base.py", line 1846, in _execute_context
return self._exec_single_context(
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\engine\base.py", line 1986, in _exec_single_context
self._handle_dbapi_exception(
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\engine\base.py", line 2353, in _handle_dbapi_exception
raise sqlalchemy_exception.with_traceback(exc_info[2]) from e
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\engine\base.py", line 1967, in _exec_single_context
self.dialect.do_execute(
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\engine\default.py", line 924, in do_execute
cursor.execute(statement, parameters)

155
app.log.2 Normal file
View File

@@ -0,0 +1,155 @@
config_env: production
config_env: production
config_env: production
config_env: production
config_env: development
config_env: development
config_env: development
config_env: development
config_env: production
config_env: production
Server Error: (MySQLdb.OperationalError) (1054, "Unknown column 'MPO.id_currency_cost' in 'on clause'")
[SQL: CALL p_shop_get_many_manufacturing_purchase_order(%s, %s, %s, %s, %s, %s, %s, %s)]
[parameters: (1, True, True, '', '', None, None, 0)]
(Background on this error at: https://sqlalche.me/e/20/e3q8)
Request: 127.0.0.1 GET http /store/manufacturing_purchase_orders? Host: 127.0.0.1:5000
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:131.0) Gecko/20100101 Firefox/131.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/png,image/svg+xml,*/*;q=0.8
Accept-Language: en-GB,en;q=0.5
Accept-Encoding: gzip, deflate, br, zstd
Dnt: 1
Connection: keep-alive
Referer: http://127.0.0.1:5000/store/manufacturing_purchase_orders
Cookie: session=.eJytVlmzosgS_isTRsw8tTar6InomKsii0dQkP2FgCqQYhNZRJjb__0Wnp7ufpi5S8Q1RKsqi8wvK7_KzD9mQdcmtxo1ETSbqJ69_TEDQekHsECl37S3Opq9tXUXffppuXtt_FiNigDls7dZBPughosCQZhH7a1sCtQm_7hO0gW4FbNPsxjVTVsGBVY4MyIIB7yGoA-6uo5KMPgwioMub2dvZZfnL1EdXdGt_AvBBwDy-9ifnCCw3tf_P5fsigrXLFitWUisA44IA5KIo3gy2PgvxP4jqlGMIjh7i4O8iV4SVIK8gxH0rY3xw-qHn1jcdBU29bPzTVd_c0j50-_5ZXJ89hWfV1PHfnvLohLLaQgYADhI0gwIlxyAkI5JdhUBFkBiSdFhwC3DAJAYYvctDAEAUdN81xANhyQUATqhQxY4MjruDnlYKNN8q6QmpROqKqMeBY46yukNBZJOAElZHod15jluG5YwCUa5V1Mv91LvdhJzJkQsCQY2gY5-U3ZsGlLEQy6JxUJ9VvvHSerASU7KOBEX96wvIg6U1umUpOlpdVK79-ecKk_vbQ7huA0dwPq2_ORFR7sYq4YmkuMm2xM2s2Ri65CJG-UugQ7dbJ3qUqY4lLG_7ynNSXib70Y6We_E-rwlaupUDaUIaSUzem57eq-9OaEfC7sTev0drBP9YUSmaLUWJDh10x_YMNV6OtQyxbz7l8C78QfRua_JwQf0bkkaV4y_YC0aXMUoK1Qi0z15n-RnDjM17zmpMHcXcptlISsTg-AasSmKNk_dOUiIjiu1xN0m6T2f2rEGiHp_JE-qz3Kspjz9HEdGWVeseTbO7xdHj7Z5P6eS-1kNNnuOvdjclWODqlAftanwY9MyiWU9-oK9ibJ1IVJ1b1MLj48GWsto2G8EJj85jOZJ9x7TIHpWqI4aP8AUJDmaoInVckn-WEeYFKslQxCvW_AXLLmYo0yqSG7kUmfBTl7KWeVYOzwv2sqb5qX1iBzP1DOGCdPDw5OupJUJR0VISH04rBdYWRfYah0WQutd8AuFlUFKGLwd2wa2noWiRYQUO4Z2TgQvxWwS2uZkPPckmIBC67As88RnDsV1ByiygmKy8SgyCey-c6l1O1EWiHkKJWv4sJEQUNqOJ7R6YGqWoBAo19ETgD7o6TpeAkVhOI7m6PFqoaQaofAwUw3sLOUyqugOKqUmCg8YddSRx7vEmVbWKn_tD6W8BiIoPJ68QUnvwWCO2sUcdISfQs3wdfj5KuRKhm0VAuE6h_FgHETP1jogsuWEGTrbDOPKPWGdwOkwU7nHWFrF2LRKmpuKAZbTo_JKh9ee9hSIwmpdO2-m6-nZOo31ZseCrDxRbzxHf4Sl2gbYvibC174jpk54-fGeQ3s5KPIisK1MTqvCtZ-jd_k_XHnsj-tMOjEuAt4jR38aGeloVGIETvI0RnxSubC0ssTRbCG_ZNXSLLIpBVWuo6FTuqeVcTMoqTyoqTLhZSbCYf9HhZfJEy9TyoDjTFtosoFtEQG_XampySiFzKq2wpwMK1P4PFHHLXKNfe8VVvHiBpW_cGmIvFliT-upR6vmIQNm65hUZV9yC11MsrtIlWaXSW4L7oSrw7xMX3zKdcYscsGUAOPSnmTtoeBZ1hnmSTmlOnaUvWMabHhSYTrTIx6m8hhD350fmLq8r6E31-_0eBZj2erqHSrXPH8nWaFCg_1Y7QuqZTUhfmpw5w0mOwc-a60EdDZ5fhXpz0cWjdzqfjk_3rnQVWnhcBdcldRipga2fyr3yupd4g3NlBK36EjG6N4FgScG05uf7VTVyKIXom7HuJK2LZ7EOnH8S3xGrbZeVvFduad1bLpDEt6HXZtRYTunC3J_3L_7ZXkMDet4r8eaPK1vfiyfQ1y8pfe9ilFpEaFQZ7G2Cn1XrQ2p7dX5ZguHExqrNg2u0PGXqSbYa6k195LXa6W6vYg7DegujflHioq-SqzO5mWPD9n-cO8iJFDwHsRFNCeCg3rF-asBt2qqjPi3RPCXqr7FKI9--egXPs1eCctvh9eebRTUuOh91D5UxrdX_etwcZ5dxXRo76pi75ILet5PHKVroyXZmyA6HPD9nv0vLcjflH6cUj9yLIUbhyWNE-qfSZfCn9dC02ADSdtWzdvnzzB6zMs-yChiuYziZbJCz3LRNYtX9zGZ-oxtfWsM_jOoEoHs322ettxK8Gqbnjran_sVeIiGuI_M08OZjrpCoO2mRu07wmZxrYNH0Ab1C87H8DNL466DYhiCgyzFcvGKiSkOBAS34pgQLpnfmy_Mivit_lJdf4NfXrp-pTe_UgL-Alj-8A_PP1Q2eBTBRVW-Io6mgG3niZFzwrJnt_D-bl9S62CGslJK49l7Ro41bezC_6ZX6yoYtLgbm4IxowiKmZPEnFobJIdj88bQC5IgvdnXr1__BS2JoCE.ZyEYtg._bov1p8fFpH43ZXX3SGhLOxkpGQ
Upgrade-Insecure-Requests: 1
Sec-Fetch-Dest: document
Sec-Fetch-Mode: navigate
Sec-Fetch-Site: same-origin
Sec-Fetch-User: ?1
Sec-Gpc: 1
Priority: u=0, i
Request data: b''
Traceback: Traceback (most recent call last):
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\engine\base.py", line 1967, in _exec_single_context
self.dialect.do_execute(
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\engine\default.py", line 924, in do_execute
cursor.execute(statement, parameters)
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\MySQLdb\cursors.py", line 179, in execute
res = self._query(mogrified_query)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\MySQLdb\cursors.py", line 330, in _query
db.query(q)
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\MySQLdb\connections.py", line 261, in query
_mysql.connection.query(self, query)
MySQLdb.OperationalError: (1054, "Unknown column 'MPO.id_currency_cost' in 'on clause'")
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask\app.py", line 880, in full_dispatch_request
rv = self.dispatch_request()
^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask\app.py", line 865, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args) # type: ignore[no-any-return]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\controllers\store\manufacturing_purchase_order.py", line 40, in manufacturing_purchase_orders
model = Model_View_Store_Manufacturing_Purchase_Order(form_filters)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\models\model_view_store_manufacturing_purchase_order.py", line 50, in __init__
self.manufacturing_purchase_orders, errors = datastore_manufacturing_purchase_order.get_many_manufacturing_purchase_order(parameters_manufacturing_purchase_order)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\datastores\datastore_store_manufacturing_purchase_order.py", line 51, in get_many_manufacturing_purchase_order
result = self.db_procedure_execute('p_shop_get_many_manufacturing_purchase_order', argument_dict)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\datastores\datastore_base.py", line 96, in db_procedure_execute
result = db.session.execute(proc_string, argument_dict_list)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\orm\scoping.py", line 778, in execute
return self._proxied.execute(
^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\orm\session.py", line 2351, in execute
return self._execute_internal(
^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\orm\session.py", line 2245, in _execute_internal
result = conn.execute(
^^^^^^^^^^^^^
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\engine\base.py", line 1418, in execute
return meth(
^^^^^
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\sql\elements.py", line 515, in _execute_on_connection
return connection._execute_clauseelement(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\engine\base.py", line 1640, in _execute_clauseelement
ret = self._execute_context(
^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\engine\base.py", line 1846, in _execute_context
return self._exec_single_context(
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\engine\base.py", line 1986, in _exec_single_context
self._handle_dbapi_exception(
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\engine\base.py", line 2353, in _handle_dbapi_exception
raise sqlalchemy_exception.with_traceback(exc_info[2]) from e
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\engine\base.py", line 1967, in _exec_single_context
self.dialect.do_execute(
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\engine\default.py", line 924, in do_execute
cursor.execute(statement, parameters)
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\MySQLdb\cursors.py", line 179, in execute
res = self._query(mogrified_query)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\MySQLdb\cursors.py", line 330, in _query
db.query(q)
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\MySQLdb\connections.py", line 261, in query
_mysql.connection.query(self, query)
sqlalchemy.exc.OperationalError: (MySQLdb.OperationalError) (1054, "Unknown column 'MPO.id_currency_cost' in 'on clause'")
[SQL: CALL p_shop_get_many_manufacturing_purchase_order(%s, %s, %s, %s, %s, %s, %s, %s)]
[parameters: (1, True, True, '', '', None, None, 0)]
(Background on this error at: https://sqlalche.me/e/20/e3q8)
config_env: production
config_env: production
config_env: production
config_env: production
config_env: production
config_env: production
config_env: production
config_env: production
config_env: production
config_env: production
config_env: production
config_env: production
config_env: production
config_env: production
config_env: production
config_env: production
config_env: production
config_env: production
config_env: production
config_env: production
config_env: production
config_env: production
config_env: production
config_env: production
config_env: production
config_env: production
config_env: production
config_env: production
config_env: production

97
app.log.3 Normal file
View File

@@ -0,0 +1,97 @@
Traceback: Traceback (most recent call last):
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask\app.py", line 1473, in wsgi_app
response = self.full_dispatch_request()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask\app.py", line 882, in full_dispatch_request
rv = self.handle_user_exception(e)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask_cors\extension.py", line 178, in wrapped_function
return cors_after_request(app.make_response(f(*args, **kwargs)))
^^^^^^^^^^^^^^^^^^
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask\app.py", line 880, in full_dispatch_request
rv = self.dispatch_request()
^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask\app.py", line 865, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args) # type: ignore[no-any-return]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\controllers\store\supplier_purchase_order.py", line 43, in supplier_purchase_orders
return render_template('pages/store/_supplier_purchase_orders.html', model = model, datetime = datetime)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask\templating.py", line 150, in render_template
return _render(app, template, context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask\templating.py", line 131, in _render
rv = template.render(context)
^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\jinja2\environment.py", line 1304, in render
self.environment.handle_exception()
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\jinja2\environment.py", line 939, in handle_exception
raise rewrite_traceback_stack(source=source)
File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\templates\pages\store\_supplier_purchase_orders.html", line 1, in top-level template code
{% extends 'layouts/layout.html' %}
^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\templates\layouts\layout.html", line 329, in top-level template code
{% block page_body %}{% endblock %}
^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\templates\pages\store\_supplier_purchase_orders.html", line 55, in block 'page_body'
{% include 'components/store/_row_supplier_purchase_order.html' %}
^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\templates\components\store\_row_supplier_purchase_order.html", line 62, in top-level template code
{% include 'components/store/_preview_order_items.html' %}
^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\templates\components\store\_preview_order_items.html", line 4, in top-level template code
{% set str_items = model.convert_list_objects_to_preview_str(order_items) %}
^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\models\model_view_base.py", line 366, in convert_list_objects_to_preview_str
preview_str += obj_json[obj_json[Base.FLAG_NAME_ATTR_OPTION_TEXT]]
TypeError: can only concatenate str (not "NoneType") to str
Exception on /store/supplier_purchase_orders [GET]
Traceback (most recent call last):
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask\app.py", line 1473, in wsgi_app
response = self.full_dispatch_request()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask\app.py", line 882, in full_dispatch_request
rv = self.handle_user_exception(e)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask_cors\extension.py", line 178, in wrapped_function
return cors_after_request(app.make_response(f(*args, **kwargs)))
^^^^^^^^^^^^^^^^^^
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask\app.py", line 880, in full_dispatch_request
rv = self.dispatch_request()
^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask\app.py", line 865, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args) # type: ignore[no-any-return]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\controllers\store\supplier_purchase_order.py", line 43, in supplier_purchase_orders
return render_template('pages/store/_supplier_purchase_orders.html', model = model, datetime = datetime)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask\templating.py", line 150, in render_template
return _render(app, template, context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask\templating.py", line 131, in _render
rv = template.render(context)
^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\jinja2\environment.py", line 1304, in render
self.environment.handle_exception()
File "C:\Users\edwar\AppData\Local\Programs\Python\Python312\Lib\site-packages\jinja2\environment.py", line 939, in handle_exception
raise rewrite_traceback_stack(source=source)
File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\templates\pages\store\_supplier_purchase_orders.html", line 1, in top-level template code
{% extends 'layouts/layout.html' %}
^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\templates\layouts\layout.html", line 329, in top-level template code
{% block page_body %}{% endblock %}
^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\templates\pages\store\_supplier_purchase_orders.html", line 55, in block 'page_body'
{% include 'components/store/_row_supplier_purchase_order.html' %}
^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\templates\components\store\_row_supplier_purchase_order.html", line 62, in top-level template code
{% include 'components/store/_preview_order_items.html' %}
^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\templates\components\store\_preview_order_items.html", line 4, in top-level template code
{% set str_items = model.convert_list_objects_to_preview_str(order_items) %}
^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\edwar\OneDrive\Documents\Programming\Visual Studio 2022\PARTS_Web\app\models\model_view_base.py", line 367, in convert_list_objects_to_preview_str
preview_str += obj_json[obj_json[Base.FLAG_NAME_ATTR_OPTION_TEXT]]
TypeError: can only concatenate str (not "NoneType") to str
Server Error: 500 Internal Server Error: The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.

View File

@@ -69,9 +69,9 @@ class Currency(db.Model, Store_Base):
@classmethod
def from_DB_get_many_product_catalogue_product_permutation(cls, query_row):
currency = cls()
currency.id_currency = query_row[5]
currency.code = query_row[6]
currency.symbol = query_row[7]
currency.id_currency = query_row[6]
currency.code = query_row[7]
currency.symbol = query_row[8]
return currency
@classmethod
def from_DB_get_many_product_price_and_discount_and_delivery_region(cls, query_row):

View File

@@ -94,13 +94,13 @@ class Manufacturing_Purchase_Order(db.Model, Store_Base):
manufacturing_purchase_order = cls()
manufacturing_purchase_order.id_order = json[cls.ATTR_ID_MANUFACTURING_PURCHASE_ORDER]
manufacturing_purchase_order.id_currency = json[cls.ATTR_ID_CURRENCY]
manufacturing_purchase_order.cost_total_local_VAT_excl = json[cls.FLAG_COST_TOTAL_LOCAL_VAT_EXCL]
manufacturing_purchase_order.cost_total_local_VAT_incl = json[cls.FLAG_COST_TOTAL_LOCAL_VAT_INCL]
manufacturing_purchase_order.price_total_local_VAT_excl = json[cls.FLAG_PRICE_TOTAL_LOCAL_VAT_EXCL]
manufacturing_purchase_order.price_total_local_VAT_incl = json[cls.FLAG_PRICE_TOTAL_LOCAL_VAT_INCL]
manufacturing_purchase_order.cost_total_local_VAT_excl = json.get(cls.FLAG_COST_TOTAL_LOCAL_VAT_EXCL, None)
manufacturing_purchase_order.cost_total_local_VAT_incl = json.get(cls.FLAG_COST_TOTAL_LOCAL_VAT_INCL, None)
manufacturing_purchase_order.price_total_local_VAT_excl = json.get(cls.FLAG_PRICE_TOTAL_LOCAL_VAT_EXCL, None)
manufacturing_purchase_order.price_total_local_VAT_incl = json.get(cls.FLAG_PRICE_TOTAL_LOCAL_VAT_INCL, None)
manufacturing_purchase_order.active = json[cls.FLAG_ACTIVE]
manufacturing_purchase_order.created_on = json[cls.FLAG_CREATED_ON]
manufacturing_purchase_order.name = json[cls.FLAG_NAME]
manufacturing_purchase_order.created_on = json.get(cls.FLAG_CREATED_ON, None)
manufacturing_purchase_order.name = json.get(cls.FLAG_NAME, None)
return manufacturing_purchase_order
def get_items_preview_str(self):
preview = ''
@@ -281,10 +281,12 @@ class Manufacturing_Purchase_Order_Product_Link_Temp(db.Model, Store_Base):
id_unit_latency_manufacture = db.Column(db.Integer)
latency_manufacture: int = db.Column(db.Integer)
display_order: int = db.Column(db.Integer)
"""
cost_unit_local_VAT_excl: float = db.Column(db.Float)
cost_unit_local_VAT_incl: float = db.Column(db.Float)
price_unit_local_VAT_excl: float = db.Column(db.Float)
price_unit_local_VAT_incl: float = db.Column(db.Float)
"""
active: bool = db.Column(db.Boolean)
guid: str = db.Column(db.String(36))
@classmethod
@@ -299,10 +301,12 @@ class Manufacturing_Purchase_Order_Product_Link_Temp(db.Model, Store_Base):
row.id_unit_latency_manufacture = manufacturing_purchase_order_product_link.id_unit_latency_manufacture
row.latency_manufacture = manufacturing_purchase_order_product_link.latency_manufacture
row.display_order = manufacturing_purchase_order_product_link.display_order
"""
row.cost_unit_local_VAT_excl = manufacturing_purchase_order_product_link.cost_unit_local_VAT_excl
row.cost_unit_local_VAT_incl = manufacturing_purchase_order_product_link.cost_unit_local_VAT_incl
row.price_unit_local_VAT_excl = manufacturing_purchase_order_product_link.price_unit_local_VAT_excl
row.price_unit_local_VAT_incl = manufacturing_purchase_order_product_link.price_unit_local_VAT_incl
"""
row.active = 1 if manufacturing_purchase_order_product_link.active else 0
return row
def __repr__(self):
@@ -316,10 +320,6 @@ quantity_produced: {self.quantity_produced}
{self.ATTR_ID_UNIT_MEASUREMENT_LATENCY_MANUFACTURE}: {self.id_unit_latency_manufacture}
latency_manufacture: {self.latency_manufacture}
display_order: {self.display_order}
cost_unit_local_VAT_excl: {self.cost_unit_local_VAT_excl}
cost_unit_local_VAT_incl: {self.cost_unit_local_VAT_incl}
price_unit_local_VAT_excl: {self.price_unit_local_VAT_excl}
price_unit_local_VAT_incl: {self.price_unit_local_VAT_incl}
active: {self.active}
guid: {self.guid}
'''

View File

@@ -201,7 +201,7 @@ class Product(SQLAlchemy_ABC, Store_Base):
product.name = json[cls.FLAG_NAME]
product.has_variations = av.input_bool(json.get(cls.FLAG_HAS_VARIATIONS, None), cls.FLAG_HAS_VARIATIONS, f'{cls.__name__}.from_json')
product.id_access_level_required = json.get(cls.ATTR_ID_ACCESS_LEVEL, None)
product.active = av.input_bool(json.get(cls.FLAG_ACTIVE, None), cls.FLAG_ACTIVE, f'{cls.__name__}.from_json')
product.active = 1 if av.input_bool(json[cls.FLAG_ACTIVE], cls.FLAG_ACTIVE, f'{cls.__name__}.from_json') else 0
product.can_view = json.get(cls.FLAG_CAN_VIEW, None)
product.can_edit = json.get(cls.FLAG_CAN_EDIT, None)
product.can_admin = json.get(cls.FLAG_CAN_ADMIN, None)
@@ -894,3 +894,14 @@ class Product_Temp(db.Model, Store_Base):
'created_on': self.created_on,
'created_by': self.created_by
"""
def __repr__(self):
return f'''Product_Temp
id_product: {self.id_product}
id_category: {self.id_category}
name: {self.name}
has_variations: {self.has_variations}
id_access_level_required: {self.id_access_level_required}
active: {self.active}
display_order: {self.display_order}
guid: {self.guid}
'''

View File

@@ -32,7 +32,7 @@ class Product_Category(SQLAlchemy_ABC, Store_Base):
NAME_ATTR_OPTION_VALUE: ClassVar[str] = Store_Base.ATTR_ID_PRODUCT_CATEGORY
NAME_ATTR_OPTION_TEXT: ClassVar[str] = Store_Base.FLAG_NAME
__tablename__ = 'Shop_Product_Category_Temp'
__tablename__ = 'Shop_Product_Category'
id_category = db.Column(db.Integer, primary_key=True)
code = db.Column(db.String(50))
name = db.Column(db.String(255))
@@ -214,7 +214,7 @@ class Product_Category(SQLAlchemy_ABC, Store_Base):
category.id_access_level_required = json[cls.ATTR_ID_ACCESS_LEVEL]
category.name_access_level_required = json.get(cls.FLAG_ACCESS_LEVEL_REQUIRED, '')
category.display_order = json[cls.FLAG_DISPLAY_ORDER]
category.active = json[cls.FLAG_ACTIVE]
category.active = 1 if av.input_bool(json[cls.FLAG_ACTIVE], cls.FLAG_ACTIVE, f'{cls.__name__}.from_json') else 0
category.can_view = json.get(cls.FLAG_CAN_VIEW, False)
category.can_edit = json.get(cls.FLAG_CAN_EDIT, False)
category.can_admin = json.get(cls.FLAG_CAN_ADMIN, False)
@@ -471,7 +471,7 @@ class Product_Category_Temp(db.Model, Store_Base):
id_access_level_required: int = db.Column(db.Integer)
active: bool = db.Column(db.Boolean)
display_order: int = db.Column(db.Integer)
guid: str = db.Column(db.BINARY(36))
guid: str = db.Column(db.String(36))
# created_on: datetime = db.Column(db.DateTime)
# created_by: int = db.Column(db.Integer)

View File

@@ -38,7 +38,6 @@ class Product_Permutation(db.Model, Store_Base):
FLAG_CURRENCY_COST = f'{Currency.ATTR_ID_CURRENCY}_cost'
FLAG_CODE_CURRENCY_COST = f'{Currency.FLAG_CODE}_cost'
FLAG_SYMBOL_CURRENCY_COST = f'{Currency.FLAG_SYMBOL}_cost'
FLAG_COST_LOCAL = 'cost_local'
FLAG_PROFIT_LOCAL_MIN = 'profit_local_min'
FLAG_HAS_VARIATIONS = 'has_variations'
FLAG_LATENCY_MANUFACTURE = 'latency_manufacture'
@@ -78,7 +77,8 @@ class Product_Permutation(db.Model, Store_Base):
symbol_currency_cost = db.Column(db.String(3))
"""
# currency_cost: Currency
cost_local = db.Column(db.Float)
cost_local_VAT_excl = db.Column(db.Float)
cost_local_VAT_incl = db.Column(db.Float)
profit_local_min = db.Column(db.Float)
has_variations = db.Column(db.Boolean)
latency_manufacture = db.Column(db.Integer)
@@ -149,40 +149,41 @@ class Product_Permutation(db.Model, Store_Base):
permutation.id_product = query_row[1]
permutation.id_category = query_row[2]
permutation.description = query_row[3]
permutation.cost_local = query_row[4]
permutation.cost_local_VAT_excl = query_row[4]
permutation.cost_local_VAT_incl = query_row[5]
permutation.currency_cost = Currency.from_DB_get_many_product_catalogue_product_permutation(query_row)
permutation.profit_local_min = query_row[8]
permutation.latency_manufacture = query_row[9]
permutation.id_unit_measurement_quantity = query_row[10]
permutation.symbol_unit_measurement_quantity = query_row[11]
permutation.symbol_is_suffix_not_prefix_unit_measurement_quantity = av.input_bool(query_row[12], cls.FLAG_SYMBOL_IS_SUFFIX_NOT_PREFIX_UNIT_MEASUREMENT_QUANTITY, _m, v_arg_type=v_arg_type)
permutation.name_singular_unit_measurement_quantity = query_row[13]
permutation.name_plural_unit_measurement_quantity = query_row[14]
permutation.count_unit_measurement_per_quantity_step = query_row[15]
permutation.quantity_min = query_row[16]
permutation.quantity_max = query_row[17]
permutation.quantity_stock = query_row[18]
permutation.is_subscription = av.input_bool(query_row[19], "is_subscription", _m, v_arg_type=v_arg_type)
permutation.id_unit_measurement_interval_recurrence = query_row[20]
permutation.symbol_unit_measurement_interval_recurrence = query_row[21]
permutation.symbol_is_suffix_not_prefix_unit_measurement_interval_recurrence = av.input_bool(query_row[22], cls.FLAG_SYMBOL_IS_SUFFIX_NOT_PREFIX_UNIT_MEASUREMENT_INTERVAL_RECURRENCE, _m, v_arg_type=v_arg_type)
permutation.name_singular_unit_measurement_interval_recurrence = query_row[23]
permutation.name_plural_unit_measurement_interval_recurrence = query_row[24]
permutation.count_interval_recurrence = query_row[25]
permutation.id_stripe_product = query_row[26]
permutation.does_expire_faster_once_unsealed = av.input_bool(query_row[27], "does_expire_faster_once_unsealed", _m, v_arg_type=v_arg_type)
permutation.id_unit_measurement_interval_expiration_unsealed = query_row[28]
permutation.symbol_unit_measurement_interval_expiration_unsealed = query_row[29]
permutation.symbol_is_suffix_not_prefix_unit_measurement_interval_expiration_unsealed = av.input_bool(query_row[30], cls.FLAG_SYMBOL_IS_SUFFIX_NOT_PREFIX_UNIT_MEASUREMENT_INTERVAL_EXPIRATION_UNSEALED, _m, v_arg_type=v_arg_type)
permutation.name_singular_unit_measurement_interval_expiration_unsealed = query_row[31]
permutation.name_plural_unit_measurement_interval_expiration_unsealed = query_row[32]
permutation.count_interval_expiration_unsealed = query_row[33]
permutation.has_variations = av.input_bool(query_row[34], cls.FLAG_HAS_VARIATIONS, _m, v_arg_type=v_arg_type)
permutation.active = av.input_bool(query_row[35], cls.FLAG_ACTIVE, _m, v_arg_type=v_arg_type)
permutation.profit_local_min = query_row[9]
permutation.latency_manufacture = query_row[10]
permutation.id_unit_measurement_quantity = query_row[11]
permutation.symbol_unit_measurement_quantity = query_row[12]
permutation.symbol_is_suffix_not_prefix_unit_measurement_quantity = av.input_bool(query_row[13], cls.FLAG_SYMBOL_IS_SUFFIX_NOT_PREFIX_UNIT_MEASUREMENT_QUANTITY, _m, v_arg_type=v_arg_type)
permutation.name_singular_unit_measurement_quantity = query_row[14]
permutation.name_plural_unit_measurement_quantity = query_row[15]
permutation.count_unit_measurement_per_quantity_step = query_row[16]
permutation.quantity_min = query_row[17]
permutation.quantity_max = query_row[18]
permutation.quantity_stock = query_row[19]
permutation.is_subscription = av.input_bool(query_row[20], "is_subscription", _m, v_arg_type=v_arg_type)
permutation.id_unit_measurement_interval_recurrence = query_row[21]
permutation.symbol_unit_measurement_interval_recurrence = query_row[22]
permutation.symbol_is_suffix_not_prefix_unit_measurement_interval_recurrence = av.input_bool(query_row[23], cls.FLAG_SYMBOL_IS_SUFFIX_NOT_PREFIX_UNIT_MEASUREMENT_INTERVAL_RECURRENCE, _m, v_arg_type=v_arg_type)
permutation.name_singular_unit_measurement_interval_recurrence = query_row[24]
permutation.name_plural_unit_measurement_interval_recurrence = query_row[25]
permutation.count_interval_recurrence = query_row[26]
permutation.id_stripe_product = query_row[27]
permutation.does_expire_faster_once_unsealed = av.input_bool(query_row[28], "does_expire_faster_once_unsealed", _m, v_arg_type=v_arg_type)
permutation.id_unit_measurement_interval_expiration_unsealed = query_row[29]
permutation.symbol_unit_measurement_interval_expiration_unsealed = query_row[30]
permutation.symbol_is_suffix_not_prefix_unit_measurement_interval_expiration_unsealed = av.input_bool(query_row[31], cls.FLAG_SYMBOL_IS_SUFFIX_NOT_PREFIX_UNIT_MEASUREMENT_INTERVAL_EXPIRATION_UNSEALED, _m, v_arg_type=v_arg_type)
permutation.name_singular_unit_measurement_interval_expiration_unsealed = query_row[32]
permutation.name_plural_unit_measurement_interval_expiration_unsealed = query_row[33]
permutation.count_interval_expiration_unsealed = query_row[34]
permutation.has_variations = av.input_bool(query_row[35], cls.FLAG_HAS_VARIATIONS, _m, v_arg_type=v_arg_type)
permutation.active = av.input_bool(query_row[36], cls.FLAG_ACTIVE, _m, v_arg_type=v_arg_type)
# permutation.display_order = query_row[27]
permutation.can_view = av.input_bool(query_row[36], "can_view", _m, v_arg_type=v_arg_type)
permutation.can_edit = av.input_bool(query_row[37], "can_edit", _m, v_arg_type=v_arg_type)
permutation.can_admin = av.input_bool(query_row[38], "can_admin", _m, v_arg_type=v_arg_type)
permutation.can_view = av.input_bool(query_row[37], "can_view", _m, v_arg_type=v_arg_type)
permutation.can_edit = av.input_bool(query_row[38], "can_edit", _m, v_arg_type=v_arg_type)
permutation.can_admin = av.input_bool(query_row[39], "can_admin", _m, v_arg_type=v_arg_type)
return permutation
def from_DB_Stripe_product(query_row):
@@ -222,7 +223,8 @@ class Product_Permutation(db.Model, Store_Base):
permutation.id_product = json[cls.ATTR_ID_PRODUCT]
permutation.id_category = json[cls.ATTR_ID_PRODUCT_CATEGORY]
permutation.description = json[cls.FLAG_DESCRIPTION]
permutation.cost_local = json[cls.FLAG_COST_LOCAL]
permutation.cost_local_VAT_excl = json[cls.FLAG_COST_UNIT_LOCAL_VAT_EXCL]
permutation.cost_local_VAT_incl = json.get(cls.FLAG_COST_UNIT_LOCAL_VAT_INCL, None)
permutation.currency_cost = Currency.from_json(json, '_cost')
permutation.profit_local_min = json[cls.FLAG_PROFIT_LOCAL_MIN]
permutation.latency_manufacture = json[cls.FLAG_LATENCY_MANUFACTURE]
@@ -267,7 +269,8 @@ class Product_Permutation(db.Model, Store_Base):
self.ATTR_ID_PRODUCT: self.id_product,
self.ATTR_ID_PRODUCT_CATEGORY: self.id_category,
self.FLAG_DESCRIPTION: self.description,
self.FLAG_COST_LOCAL: self.cost_local,
self.FLAG_COST_UNIT_LOCAL_VAT_EXCL: self.cost_local_VAT_excl,
self.FLAG_COST_UNIT_LOCAL_VAT_INCL: self.cost_local_VAT_incl,
self.FLAG_CURRENCY_COST: self.currency_cost.to_json(),
self.FLAG_PROFIT_LOCAL_MIN: self.profit_local_min,
self.FLAG_LATENCY_MANUFACTURE: self.latency_manufacture,
@@ -352,7 +355,8 @@ class Product_Permutation(db.Model, Store_Base):
id_product: {self.id_product}
id_category: {self.id_category}
description: {self.description}
cost_local: {self.cost_local}
cost_local_VAT_excl: {self.cost_local_VAT_excl}
cost_local_VAT_incl: {self.cost_local_VAT_incl}
currency_cost: {self.currency_cost}
latency_manufacture: {self.latency_manufacture}
id_unit_measurement_quantity: {self.id_unit_measurement_quantity}
@@ -468,7 +472,7 @@ class Product_Permutation(db.Model, Store_Base):
Product_Permutation.FLAG_QUANTITY_STOCK: self.quantity_stock,
Product_Permutation.FLAG_QUANTITY_MIN: self.quantity_min,
Product_Permutation.FLAG_QUANTITY_MAX: self.quantity_max,
Product_Permutation.FLAG_COST_LOCAL: f"<strong>{self.symbol_currency_cost}</strong>{self.cost_local}"
Product_Permutation.FLAG_COST_UNIT_LOCAL_VAT_EXCL: f"<strong>{self.symbol_currency_cost}</strong>{self.cost_local_VAT_excl}"
}
Helper_App.console_log('permutation row: ', a)
return a
@@ -498,7 +502,8 @@ class Product_Permutation_Temp(db.Model, Store_Base):
id_permutation: int = db.Column(db.Integer, primary_key=True)
id_product: int = db.Column(db.Integer)
description: str = db.Column(db.String(4000))
cost_local: float = db.Column(db.Float)
cost_local_VAT_excl: float = db.Column(db.Float)
cost_local_VAT_incl: float = db.Column(db.Float)
id_currency_cost: int = db.Column(db.Integer)
profit_local_min: float = db.Column(db.Float)
latency_manufacture: int = db.Column(db.Integer)
@@ -519,13 +524,15 @@ class Product_Permutation_Temp(db.Model, Store_Base):
@classmethod
def from_product_permutation(cls, product_permutation):
Helper_App.console_log(f'Product_Permutation_Temp.from_product_permutation: {product_permutation}\ntype(cost local): {str(type(product_permutation.cost_local_VAT_excl))}')
row = cls()
row.id_permutation = product_permutation.id_permutation
row.id_product = product_permutation.id_product
row.description = product_permutation.description
row.cost_local = product_permutation.cost_local
row.cost_local_VAT_excl = product_permutation.cost_local_VAT_excl if product_permutation.cost_local_VAT_excl != 'None' else None
row.cost_local_VAT_incl = product_permutation.cost_local_VAT_incl if product_permutation.cost_local_VAT_incl != 'None' else None
row.id_currency_cost = product_permutation.currency_cost.id_currency
row.profit_local_min = product_permutation.profit_local_min
row.profit_local_min = product_permutation.profit_local_min if product_permutation.profit_local_min != 'None' else None
row.latency_manufacture = product_permutation.latency_manufacture
row.id_unit_measurement_quantity = product_permutation.id_unit_measurement_quantity
row.count_unit_measurement_per_quantity_step = product_permutation.count_unit_measurement_per_quantity_step
@@ -546,7 +553,8 @@ class Product_Permutation_Temp(db.Model, Store_Base):
id_permutation: {self.id_permutation}
id_product: {self.id_product}
description: {self.description}
cost_local: {self.cost_local}
cost_local_VAT_excl: {self.cost_local_VAT_excl}
cost_local_VAT_incl: {self.cost_local_VAT_incl}
id_currency_cost: {self.id_currency_cost}
profit_local_min: {self.profit_local_min}
latency_manufacture: {self.latency_manufacture}

View File

@@ -93,6 +93,7 @@ class DataStore_Store_Product_Category(DataStore_Store_Base):
'a_comment': comment,
'a_guid': guid,
'a_id_user': user.id_user,
'a_debug': 0,
}
save_result = cls.db_procedure_execute('p_shop_save_product_category', argument_dict_list)
save_result.close()

View File

@@ -99,6 +99,7 @@ class DataStore_Store_Product_Permutation(DataStore_Store_Base):
'a_comment': comment,
'a_guid': guid,
'a_id_user': user.id_user,
'a_debug': 0,
}
cls.db_procedure_execute('p_shop_save_product_permutation', argument_dict_list)
Helper_App.console_log('saved product permutations')

182
pay_stripe.py Normal file
View File

@@ -0,0 +1,182 @@
"""
Project: PARTS Website
Author: Edward Middleton-Smith
Precision And Research Technology Systems Limited
Technology: App General
Feature: App
Description:
Initializes the Flask application, sets the configuration based on the environment, and defines two routes (/ and /about) that render templates with the specified titles.
"""
# IMPORTS
# VARIABLE INSTANTIATION
# METHODS
# IMPORTS
import os
import stripe
import json
from flask import Flask, render_template, render_template_string, jsonify, request, send_from_directory, redirect
from dotenv import load_dotenv, find_dotenv
from config import app_config
# VARIABLE INSTANTIATION
key_secret = os.environ.get("KEY_SECRET_STRIPE")
key_public = os.environ.get("KEY_PUBLIC_STRIPE") # 'pk_test_51OGrxlL7BuLKjoMpfpfw7bSmZZK1MhqMoQ5VhW2jUj7YtoEejO4vqnxKPiqTHHuh9U4qqkywbPCSI9TpFKtr4SYH007KHMWs68'
# METHODS
def create_product_price():
print(f'stripe.api_key = {stripe.api_key}')
starter_subscription = stripe.Product.create(
name="Starter Subscription",
description="$12/Month subscription",
)
starter_subscription_price = stripe.Price.create(
unit_amount=1200,
currency="usd",
recurring={"interval": "month"},
product=starter_subscription['id'],
)
# Save these identifiers
print(f"Success! Here is your starter subscription product id: {starter_subscription.id}")
print(f"Success! Here is your starter subscription price id: {starter_subscription_price.id}")
return starter_subscription_price.id
def get_file_str(f_address):
f = open(f_address)
return f.read()
# Ensure environment variables are set.
price = os.getenv('PRICE')
if price is None or price == 'price_12345' or price == '':
print('You must set a Price ID in .env. Please see the README.')
exit(0)
# For sample support and debugging, not required for production:
stripe.set_app_info(
'stripe-samples/checkout-one-time-payments',
version='0.0.1',
url='https://github.com/stripe-samples/checkout-one-time-payments')
# stripe.api_version = '2020-08-27'
stripe.api_key = key_secret # os.getenv('KEY_SECRET_STRIPE')
# app_dir = str(os.path.abspath(os.path.join(
# __file__, "..", "..")))
# static_dir = str(os.path.abspath(os.path.join(
# app_dir, os.getenv("STATIC_DIR"))))
# template_dir = str(os.path.abspath(os.path.join(
# app_dir, os.getenv("TEMPLATE_DIR"))))
app = Flask(__name__) # , static_folder=static_dir,
# static_url_path="", template_folder=template_dir)
app.config.from_object(app_config)
@app.route('/', methods=['GET'])
def home():
# return render_template(f'{app_dir}\\templates\\_home.html') # f'{app_dir}\\templates\\layout.html')
# return render_template_string(get_file_str(f'{app_dir}\\templates\\_home.html')) # f'{app_dir}\\templates\\layout.html')
return render_template('_home.html', title='Home')
@app.route('/store', methods=['GET'])
def store_home():
return render_template('_store_home.html', title='Store Home')
@app.route('/contact')
def contact():
return render_template('_contact.html', title='Contact Us')
@app.route('/config', methods=['GET'])
def get_publishable_key():
price = stripe.Price.retrieve(os.getenv('PRICE'))
return jsonify({
'publicKey': key_public, # os.getenv('KEY_PUBLIC_STRIPE'),
'unitAmount': price['unit_amount'],
'currency': price['currency']
})
# Fetch the Checkout Session to display the JSON result on the success page
@app.route('/checkout-session', methods=['GET'])
def get_checkout_session():
id = request.args.get('sessionId')
print(f'checkout session id: {id}')
checkout_session = stripe.checkout.Session.retrieve(id)
return jsonify(checkout_session)
@app.route('/create-checkout-session', methods=['POST'])
def create_checkout_session():
quantity = request.form.get('quantity', 1)
domain_url = os.getenv('DOMAIN')
try:
# Create new Checkout Session for the order
# Other optional params include:
# [billing_address_collection] - to display billing address details on the page
# [customer] - if you have an existing Stripe Customer ID
# [payment_intent_data] - lets capture the payment later
# [customer_email] - lets you prefill the email input in the form
# [automatic_tax] - to automatically calculate sales tax, VAT and GST in the checkout page
# For full details see https://stripe.com/docs/api/checkout/sessions/create
# ?session_id={CHECKOUT_SESSION_ID} means the redirect will have the session ID set as a query param
checkout_session = stripe.checkout.Session.create(
success_url=domain_url + '/success.html?session_id={CHECKOUT_SESSION_ID}',
cancel_url=domain_url + '/canceled.html',
mode='subscription', # 'payment',
# automatic_tax={'enabled': True},
line_items=[{
'price': os.getenv('PRICE'),
'quantity': quantity,
}]
)
return redirect(checkout_session.url, code=303)
except Exception as e:
return jsonify(error=str(e)), 403
@app.route('/webhook', methods=['POST'])
def webhook_received():
# You can use webhooks to receive information about asynchronous payment events.
# For more about our webhook events check out https://stripe.com/docs/webhooks.
webhook_secret = os.getenv('STRIPE_WEBHOOK_SECRET')
request_data = json.loads(request.data)
if webhook_secret:
# Retrieve the event by verifying the signature using the raw body and secret if webhook signing is configured.
signature = request.headers.get('stripe-signature')
try:
event = stripe.Webhook.construct_event(
payload=request.data, sig_header=signature, secret=webhook_secret)
data = event['data']
except Exception as e:
return e
# Get the type of webhook event sent - used to check the status of PaymentIntents.
event_type = event['type']
else:
data = request_data['data']
event_type = request_data['type']
data_object = data['object']
print('event ' + event_type)
if event_type == 'checkout.session.completed':
print('🔔 Payment succeeded!')
return jsonify({Model_View_Base.FLAG_STATUS: Model_View_Base.FLAG_SUCCESS})
if __name__ == '__main__':
# stripe.api_key = key_secret
# create_product_price()
# Setup Stripe python client library.
load_dotenv(find_dotenv())
app.run(port=4242, debug=True)

54
routes.py Normal file
View File

@@ -0,0 +1,54 @@
"""
Project: PARTS Website
Author: Edward Middleton-Smith
Precision And Research Technology Systems Limited
Technology: Backend
Feature: Controller - Webpage routing
Description:
Defines the routes and view functions for each page.
Manages the interaction between the frontend and backend.
"""
from flask import render_template, url_for, Blueprint
from app import app
from app.forms import Form_Contact
# from forms import MyForm
# from app import MyForm
from model_view_contact import Model_View_Contact
"""
@app.route('/', methods=['GET'])
def home():
return render_template('_home.html', title='Home')
@app.route('/store', methods=['GET'])
def store_home():
return render_template('_store_home.html', title='Store Home')
@app.route('/contact', methods=['GET', 'POST'])
def contact():
form = Form_Contact()
if form.validate_on_submit():
# Handle form submission
email = form.sender_email.data
CC = form.sender_CC.data
name = form.sender_name.data
msg = form.sender_message.data
# return render_template('contact.html', form=form)
# return render_template('_contact.html', title='Contact Us')
return render_template('contact.html', model=Model_View_Contact(form))
@app.route('/about')
def about():
return render_template('about.html')
@app.route('/contact', methods=['GET', 'POST'])
def contact():
form = MyForm()
if form.validate_on_submit():
# Handle form submission
pass
return render_template('contact.html', form=form)
"""

File diff suppressed because it is too large Load Diff

View File

@@ -282,6 +282,7 @@ DROP PROCEDURE IF EXISTS p_shop_get_many_storage_location;
DROP PROCEDURE IF EXISTS p_shop_get_many_currency;
DROP PROCEDURE IF EXISTS p_shop_save_category;
DROP PROCEDURE IF EXISTS p_shop_save_category_test;
DROP PROCEDURE IF EXISTS p_shop_save_product_category;
DROP PROCEDURE IF EXISTS p_shop_save_product_category_test;
DROP PROCEDURE IF EXISTS p_shop_save_product;
@@ -292,6 +293,7 @@ DROP PROCEDURE IF EXISTS p_shop_get_many_product;
DROP PROCEDURE IF EXISTS p_shop_get_many_stripe_product_new;
DROP PROCEDURE IF EXISTS p_shop_save_permutation;
DROP PROCEDURE IF EXISTS p_shop_save_product_permutation;
DROP PROCEDURE IF EXISTS p_shop_save_product_permutation_test;
DROP PROCEDURE IF EXISTS p_shop_get_many_product_variation;
DROP FUNCTION IF EXISTS fn_shop_get_id_product_permutation_from_variation_csv_list;
DROP PROCEDURE IF EXISTS p_shop_save_stock_item;
@@ -313,6 +315,7 @@ DROP PROCEDURE IF EXISTS p_shop_save_supplier_purchase_order;
DROP PROCEDURE IF EXISTS p_shop_save_supplier_purchase_order_test;
DROP PROCEDURE IF EXISTS p_shop_get_many_supplier_purchase_order;
DROP PROCEDURE IF EXISTS p_shop_save_manufacturing_purchase_order;
DROP PROCEDURE IF EXISTS p_shop_save_manufacturing_purchase_order_test;
DROP PROCEDURE IF EXISTS p_shop_get_many_manufacturing_purchase_order;
DROP PROCEDURE IF EXISTS p_shop_save_customer;
DROP PROCEDURE IF EXISTS p_shop_get_many_customer;

View File

@@ -12,9 +12,9 @@ CREATE TABLE IF NOT EXISTS Shop_Product_Category_Temp (
, description VARCHAR(4000) NULL
, id_access_level_required INT NOT NULL DEFAULT 1
, display_order INT NOT NULL
, active BIT NOT NULL
, can_view BIT NULL DEFAULT NULL
, can_edit BIT NULL DEFAULT NULL
, can_admin BIT NULL DEFAULT NULL
, active BIT NULL
, can_view BIT NULL
, can_edit BIT NULL
, can_admin BIT NULL
, guid BINARY(36) NOT NULL
);

View File

@@ -1,7 +1,7 @@
# Product Permutation
-- DROP TABLE partsltd_prod.Shop_Product_Permutation;
SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'Shop_Product_Permutation';
@@ -14,9 +14,10 @@ CREATE TABLE IF NOT EXISTS Shop_Product_Permutation (
ON UPDATE RESTRICT,
-- name VARCHAR(255) NOT NULL,
description VARCHAR(4000) NOT NULL,
cost_local FLOAT NOT NULL,
cost_local_VAT_excl FLOAT NULL,
cost_local_VAT_incl FLOAT NULL,
id_currency_cost INT NOT NULL,
profit_local_min FLOAT NOT NULL,
profit_local_min FLOAT NULL,
-- id_currency_profit_min INT NOT NULL,
latency_manufacture INT NOT NULL,
id_unit_measurement_quantity INT NOT NULL,
@@ -24,8 +25,8 @@ CREATE TABLE IF NOT EXISTS Shop_Product_Permutation (
FOREIGN KEY (id_unit_measurement_quantity)
REFERENCES Shop_Unit_Measurement(id_unit_measurement),
count_unit_measurement_per_quantity_step FLOAT NOT NULL,
quantity_min FLOAT NOT NULL,
quantity_max FLOAT NOT NULL,
quantity_min FLOAT NULL,
quantity_max FLOAT NULL,
quantity_stock FLOAT NOT NULL,
is_subscription BIT NOT NULL,
id_unit_measurement_interval_recurrence INT,
@@ -49,7 +50,7 @@ CREATE TABLE IF NOT EXISTS Shop_Product_Permutation (
*/
count_interval_expiration_unsealed INT,
active BIT NOT NULL DEFAULT 1,
display_order INT NOT NULL,
-- display_order INT NOT NULL,
created_on DATETIME,
created_by INT,
id_change_set INT,

View File

@@ -9,9 +9,10 @@ CREATE TABLE IF NOT EXISTS Shop_Product_Permutation_Temp (
id_permutation INT NOT NULL
, id_product INT NOT NULL
, description VARCHAR(4000) NOT NULL
, cost_local FLOAT NOT NULL
, cost_local_VAT_excl FLOAT NULL
, cost_local_VAT_incl FLOAT NULL
, id_currency_cost INT NOT NULL
, profit_local_min FLOAT NOT NULL
, profit_local_min FLOAT NULL
, latency_manufacture INT NOT NULL
, id_unit_measurement_quantity INT NOT NULL
, count_unit_measurement_per_quantity_step FLOAT NOT NULL

View File

@@ -28,6 +28,6 @@ CREATE TABLE IF NOT EXISTS Shop_Supplier (
, id_change_set INT
, CONSTRAINT FK_Shop_Supplier_id_change_set
FOREIGN KEY (id_change_set)
REFERENCES Shop_Sales_And_Purchasing_Change_Set(id_change_set)
REFERENCES Shop_User_Change_Set(id_change_set)
, id_supplier_temp INT NOT NULL
);

View File

@@ -25,5 +25,5 @@ CREATE TABLE Shop_Supplier_Address (
, id_change_set INT
, CONSTRAINT FK_Shop_Supplier_Address_id_change_set
FOREIGN KEY (id_change_set)
REFERENCES partsltd_prod.Shop_Sales_And_Purchasing_Change_Set(id_change_set)
REFERENCES partsltd_prod.Shop_User_Change_Set(id_change_set)
);

View File

@@ -14,10 +14,10 @@ CREATE TABLE IF NOT EXISTS Shop_Manufacturing_Purchase_Order (
CONSTRAINT FK_Manufacturing_Purchase_Order_id_currency
FOREIGN KEY (id_currency)
REFERENCES Shop_Currency(id_currency),
cost_total_local_VAT_excl FLOAT NOT NULL,
cost_total_local_VAT_incl FLOAT NOT NULL,
price_total_local_VAT_excl FLOAT NOT NULL,
price_total_local_VAT_incl FLOAT NOT NULL,
cost_total_local_VAT_excl FLOAT NULL,
cost_total_local_VAT_incl FLOAT NULL,
price_total_local_VAT_excl FLOAT NULL,
price_total_local_VAT_incl FLOAT NULL,
/*
latency_delivery INT NOT NULL,
quantity_ordered FLOAT NOT NULL,

View File

@@ -1,6 +1,8 @@
# Manufacturing Purchase Order Temp
-- DROP TABLE Shop_Manufacturing_Purchase_Order_Temp
SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'Shop_Manufacturing_Purchase_Order_Temp';
CREATE TABLE IF NOT EXISTS Shop_Manufacturing_Purchase_Order_Temp (
@@ -8,11 +10,11 @@ CREATE TABLE IF NOT EXISTS Shop_Manufacturing_Purchase_Order_Temp (
/*
cost_total_local FLOAT NOT NULL,
*/
id_currency_cost INT NOT NULL,
cost_total_local_VAT_excl FLOAT NOT NULL,
cost_total_local_VAT_incl FLOAT NOT NULL,
price_total_local_VAT_excl FLOAT NOT NULL,
price_total_local_VAT_incl FLOAT NOT NULL,
id_currency INT NOT NULL,
cost_total_local_VAT_excl FLOAT NULL,
cost_total_local_VAT_incl FLOAT NULL,
price_total_local_VAT_excl FLOAT NULL,
price_total_local_VAT_incl FLOAT NULL,
/*
latency_delivery INT NOT NULL,
quantity_ordered FLOAT NOT NULL,

View File

@@ -1,6 +1,8 @@
# Manufacturing Purchase Order Product Link
-- DROP TABLE partsltd_prod.Shop_Manufacturing_Purchase_Order_Product_Link_Audit
-- DROP TABLE partsltd_prod.Shop_Manufacturing_Purchase_Order_Product_Link
SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'Shop_Manufacturing_Purchase_Order_Product_Link';
@@ -9,11 +11,11 @@ CREATE TABLE IF NOT EXISTS Shop_Manufacturing_Purchase_Order_Product_Link (
, id_order INT NOT NULL
, CONSTRAINT FK_Manufacturing_Purchase_Order_Product_Link_id_order
FOREIGN KEY (id_order)
REFERENCES Shop_Manufacturing_Purchase_Order(id_order)
REFERENCES partsltd_prod.Shop_Manufacturing_Purchase_Order(id_order)
, id_permutation INT NOT NULL
, CONSTRAINT FK_Manufacturing_Purchase_Order_Product_Link_id_permutation
FOREIGN KEY (id_permutation)
REFERENCES Shop_Product_Permutation(id_permutation)
REFERENCES partsltd_prod.Shop_Product_Permutation(id_permutation)
, cost_unit_local_VAT_excl FLOAT NULL
, cost_unit_local_VAT_incl FLOAT NULL
, price_unit_local_VAT_excl FLOAT NULL
@@ -21,13 +23,13 @@ CREATE TABLE IF NOT EXISTS Shop_Manufacturing_Purchase_Order_Product_Link (
, id_unit_quantity INT NOT NULL
, CONSTRAINT FK_Manufacturing_Purchase_Order_id_unit_quantity
FOREIGN KEY (id_unit_quantity)
REFERENCES Shop_Unit_Measurement(id_unit_measurement)
REFERENCES partsltd_prod.Shop_Unit_Measurement(id_unit_measurement)
, quantity_used FLOAT NULL
, quantity_produced FLOAT NULL
, id_unit_latency_manufacture INT NULL
, CONSTRAINT FK_MPO_id_unit_latency_manufacture
FOREIGN KEY (id_unit_latency_manufacture)
REFERENCES Shop_Unit_Measurement(id_unit_measurement)
REFERENCES partsltd_prod.Shop_Unit_Measurement(id_unit_measurement)
, latency_manufacture INT NULL
, display_order INT NOT NULL
, active BIT NOT NULL
@@ -38,5 +40,5 @@ CREATE TABLE IF NOT EXISTS Shop_Manufacturing_Purchase_Order_Product_Link (
, id_change_set INT NULL
, CONSTRAINT FK_Manufacturing_Purchase_Order_id_change_set
FOREIGN KEY (id_change_set)
REFERENCES Shop_Sales_And_Purchasing_Change_Set(id_change_set)
REFERENCES partsltd_prod.Shop_Sales_And_Purchasing_Change_Set(id_change_set)
);

View File

@@ -9,7 +9,9 @@ SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning
CREATE TABLE IF NOT EXISTS Shop_Manufacturing_Purchase_Order_Product_Link_Temp (
id_link INT NOT NULL PRIMARY KEY,
id_order INT NOT NULL,
id_permutation INT NOT NULL,
id_product INT NULL,
id_permutation INT NULL,
csv_list_variations VARCHAR(4000) NULL,
id_unit_quantity INT NOT NULL,
quantity_used FLOAT NULL,
quantity_produced FLOAT NULL,

View File

@@ -69,9 +69,13 @@ BEGIN
SELECT NEW.id_permutation, 'description', OLD.description, NEW.description, NEW.id_change_set
WHERE NOT (OLD.description <=> NEW.description)
UNION
# Changed cost_local
SELECT NEW.id_permutation, 'cost_local', CONVERT(OLD.cost_local, CHAR), CONVERT(NEW.cost_local, CHAR), NEW.id_change_set
WHERE NOT (OLD.cost_local <=> NEW.cost_local)
# Changed cost_local_VAT_excl
SELECT NEW.id_permutation, 'cost_local_VAT_excl', CONVERT(OLD.cost_local_VAT_excl, CHAR), CONVERT(NEW.cost_local_VAT_excl, CHAR), NEW.id_change_set
WHERE NOT (OLD.cost_local_VAT_excl <=> NEW.cost_local_VAT_excl)
UNION
# Changed cost_local_VAT_incl
SELECT NEW.id_permutation, 'cost_local_VAT_incl', CONVERT(OLD.cost_local_VAT_incl, CHAR), CONVERT(NEW.cost_local_VAT_incl, CHAR), NEW.id_change_set
WHERE NOT (OLD.cost_local_VAT_incl <=> NEW.cost_local_VAT_incl)
UNION
# Changed id_currency_cost
SELECT NEW.id_permutation, 'id_currency_cost', CONVERT(OLD.id_currency_cost, CHAR), CONVERT(NEW.id_currency_cost, CHAR), NEW.id_change_set

View File

@@ -14,7 +14,7 @@ FOR EACH ROW
BEGIN
SET NEW.created_on := IFNULL(NEW.created_on, NOW());
-- SET NEW.created_by := IFNULL(NEW.created_by, IFNULL((SELECT id_user FROM Shop_User WHERE firstname = CURRENT_USER()), -1));
IF NOT EXISTS (SELECT * FROM partsltd_prod.Shop_User U WHERE U.id_user = NEW.created_on LIMIT 1) THEN
IF NOT EXISTS (SELECT * FROM partsltd_prod.Shop_User U WHERE U.id_user = NEW.created_by LIMIT 1) THEN
SIGNAL SQLSTATE '45000'
SET MESSAGE_TEXT = 'Valid created by User ID must be provided.';
END IF;
@@ -31,10 +31,6 @@ BEGIN
SIGNAL SQLSTATE '45000'
SET MESSAGE_TEXT = 'New change Set ID must be provided.';
END IF;
IF NOT EXISTS (SELECT * FROM partsltd_prod.Shop_User U WHERE U.id_user = NEW.created_on LIMIT 1) THEN
SIGNAL SQLSTATE '45000'
SET MESSAGE_TEXT = 'Valid created by User ID must be provided.';
END IF;
INSERT INTO Shop_Manufacturing_Purchase_Order_Audit (
id_order,

View File

@@ -10,7 +10,8 @@ DELIMITER //
CREATE PROCEDURE p_shop_save_product_category (
IN a_comment VARCHAR(500),
IN a_guid BINARY(36),
IN a_id_user INT
IN a_id_user INT,
IN a_debug BIT
)
BEGIN
DECLARE v_code_type_error_bad_data VARCHAR(100);
@@ -19,7 +20,7 @@ BEGIN
DECLARE v_ids_product_permission LONGTEXT;
DECLARE v_id_change_set INT;
DECLARE v_id_access_level_edit INT;
DECLARE v_now DATETIME;
DECLARE v_time_start TIMESTAMP(6);
DECLARE exit handler for SQLEXCEPTION
BEGIN
@@ -38,33 +39,33 @@ BEGIN
CREATE TEMPORARY TABLE IF NOT EXISTS tmp_Msg_Error (
display_order INT NOT NULL PRIMARY KEY AUTO_INCREMENT
, guid BINARY(36) NOT NULL
, id_type INT NULL
, code VARCHAR(50) NOT NULL
, msg VARCHAR(4000) NOT NULL
);
INSERT INTO tmp_Msg_Error (
guid
, id_type
id_type
, code
, msg
)
SELECT
a_guid
, NULL
MET.id_type
, @errno
, @text
FROM partsltd_prod.Shop_Msg_Error_Type MET
WHERE MET.code = 'MYSQL_ERROR'
;
SELECT *
FROM tmp_Msg_Error;
DROP TABLE IF EXISTS tmp_Msg_Error;
END;
SET v_time_start := CURRENT_TIMESTAMP(6);
SET v_code_type_error_bad_data := 'BAD_DATA';
SET v_id_type_error_bad_data := (SELECT id_type FROM Shop_Msg_Error_Type WHERE code = v_code_type_error_bad_data LIMIT 1);
SET v_id_access_level_edit := (SELECT id_access_level FROM Shop_Access_Level WHERE code = 'EDIT' LIMIT 1);
SET a_guid := IFNULL(a_guid, UUID());
CALL p_validate_guid ( a_guid );
DROP TABLE IF EXISTS tmp_Category;
@@ -85,7 +86,6 @@ BEGIN
CREATE TEMPORARY TABLE IF NOT EXISTS tmp_Msg_Error (
display_order INT NOT NULL PRIMARY KEY AUTO_INCREMENT
, guid BINARY(36) NOT NULL
, id_type INT NULL
, code VARCHAR(50) NOT NULL
, msg VARCHAR(4000) NOT NULL
@@ -110,7 +110,7 @@ BEGIN
, IFNULL(PC_T.name, PC.code) AS name
, IFNULL(PC_T.description, PC.description) AS description
, IFNULL(PC_T.id_access_level_required, PC.id_access_level_required) AS id_access_level_required
, IFNULL(PC_T.active, PC.active) AS active
, IFNULL(IFNULL(PC_T.active, PC.active), 1) AS active
, IFNULL(PC_T.display_order, PC.display_order) AS display_order
, IFNULL(PC_T.name, IFNULL(PC.name, IFNULL(PC_T.code, IFNULL(PC.code, IFNULL(PC_T.id_category, '(No Product Category)'))))) AS name_error
, CASE WHEN IFNULL(PC_T.id_category, 0) < 1 THEN 1 ELSE 0 END AS is_new
@@ -124,14 +124,12 @@ BEGIN
-- code
IF EXISTS (SELECT * FROM tmp_Category t_C WHERE ISNULL(t_C.code) LIMIT 1) THEN
INSERT INTO tmp_Msg_Error (
guid
, id_type
id_type
, code
, msg
)
SELECT
a_guid AS GUID
, v_id_type_error_bad_data
v_id_type_error_bad_data
, v_code_type_error_bad_data
, CONCAT('The following category(s) do not have a code: ', GROUP_CONCAT(IFNULL(t_C.name_error, 'NULL') SEPARATOR ', ')) AS msg
FROM tmp_Category t_C
@@ -141,14 +139,12 @@ BEGIN
-- name
IF EXISTS (SELECT * FROM tmp_Category t_C WHERE ISNULL(t_C.name) LIMIT 1) THEN
INSERT INTO tmp_Msg_Error (
guid
, id_type
id_type
, code
, msg
)
SELECT
a_guid AS GUID
, v_id_type_error_bad_data
v_id_type_error_bad_data
, v_code_type_error_bad_data
, CONCAT('The following category(s) do not have a name: ', GROUP_CONCAT(IFNULL(t_C.name_error, 'NULL') SEPARATOR ', ')) AS msg
FROM tmp_Category t_C
@@ -158,14 +154,12 @@ BEGIN
-- display_order
IF EXISTS (SELECT * FROM tmp_Category t_C WHERE ISNULL(t_C.display_order) LIMIT 1) THEN
INSERT INTO tmp_Msg_Error (
guid
, id_type
id_type
, code
, msg
)
SELECT
a_guid AS GUID
, v_id_type_error_bad_data
v_id_type_error_bad_data
, v_code_type_error_bad_data
, CONCAT('The following category(s) do not have a display order: ', GROUP_CONCAT(IFNULL(t_C.name_error, 'NULL') SEPARATOR ', ')) AS msg
FROM tmp_Category t_C
@@ -202,8 +196,6 @@ BEGIN
END IF;
END IF;
SET v_now := CURRENT_DATETIME();
IF NOT EXISTS (SELECT * FROM tmp_Msg_Error LIMIT 1) THEN
START TRANSACTION;
@@ -247,7 +239,7 @@ BEGIN
, t_C.active AS active
, t_C.display_order AS display_order
, a_id_user AS created_by
, v_now AS created_on
, v_time_start AS created_on
FROM tmp_Category t_C
WHERE is_new = 1
AND active = 1
@@ -259,10 +251,22 @@ BEGIN
COMMIT;
END IF;
SELECT * FROM tmp_Msg_Error;
# Errors
SELECT *
FROM tmp_Msg_Error t_ME
INNER JOIN partsltd_prod.Shop_Msg_Error_Type MET ON t_ME.id_type = MET.id_type
;
DROP TEMPORARY TABLE IF EXISTS tmp_Catgory;
DROP TEMPORARY TABLE IF EXISTS tmp_Msg_Error;
IF a_debug = 1 THEN
SELECT * from tmp_Catgory;
END IF;
DROP TEMPORARY TABLE tmp_Catgory;
DROP TEMPORARY TABLE tmp_Msg_Error;
IF a_debug = 1 THEN
CALL partsltd_prod.p_debug_timing_reporting ( v_time_start );
END IF;
END //
DELIMITER ;;

View File

@@ -1,274 +1,75 @@
-- Clear previous proc
DROP PROCEDURE IF EXISTS p_shop_save_product_category_test;
DROP PROCEDURE IF EXISTS partsltd_prod.p_shop_save_product_category_test;
DELIMITER //
CREATE PROCEDURE p_shop_save_product_category_test (
IN a_id_user INT,
IN a_guid BINARY(36),
IN a_comment VARCHAR(500)
)
CREATE PROCEDURE p_shop_save_product_category_test ()
BEGIN
DECLARE v_code_type_error_bad_data VARCHAR(100);
DECLARE v_id_type_error_bad_data INT;
DECLARE v_id_permission_product INT;
DECLARE v_ids_product_permission LONGTEXT;
DECLARE v_id_change_set INT;
DECLARE v_guid BINARY(36);
DECLARE v_time_start TIMESTAMP(6);
DECLARE exit handler for SQLEXCEPTION
BEGIN
-- Get diagnostic information
GET DIAGNOSTICS CONDITION 1
@sqlstate = RETURNED_SQLSTATE
, @errno = MYSQL_ERRNO
, @text = MESSAGE_TEXT
;
-- Rollback the transaction
ROLLBACK;
-- Select the error information
-- SELECT 'Error' AS status, @errno AS error_code, @sqlstate AS sql_state, @text AS message;
CREATE TEMPORARY TABLE IF NOT EXISTS tmp_Msg_Error (
display_order INT NOT NULL PRIMARY KEY AUTO_INCREMENT
, guid BINARY(36) NOT NULL
, id_type INT NULL
, code VARCHAR(50) NOT NULL
, msg VARCHAR(4000) NOT NULL
);
INSERT INTO tmp_Msg_Error (
guid
, id_type
SET v_time_start := CURRENT_TIMESTAMP(6);
SET v_guid := 'nips';
SELECT *
FROM partsltd_prod.Shop_Product_Category
;
SELECT *
FROM partsltd_prod.Shop_Product_Category_Temp
;
START TRANSACTION;
INSERT INTO partsltd_prod.Shop_Product_Category_Temp (
id_category
, name
, code
, msg
, description
, id_access_level_required
, display_order
, guid
)
SELECT
a_guid
, NULL
, @errno
, @text
;
SELECT * FROM tmp_Msg_Error;
DROP TABLE IF EXISTS tmp_Msg_Error;
END;
VALUES (
-5 -- id_category
, 'Nips' -- name
, 'Lips' -- code
, 'Chips' -- description
, 2 -- id_access_level_required
, 25 -- display_order
, v_guid
);
COMMIT;
select 'p_shop_save_product_category_test';
SELECT *
FROM partsltd_prod.Shop_Product_Category_Temp
WHERE GUID = v_guid
;
SET v_code_type_error_bad_data := 'BAD_DATA';
SET v_id_type_error_bad_data := (SELECT id_type FROM Shop_Msg_Error_Type WHERE code = v_code_type_error_bad_data LIMIT 1);
SET a_guid := IFNULL(a_guid, UUID());
DROP TABLE IF EXISTS tmp_Category;
CREATE TEMPORARY TABLE tmp_Category (
id_category INT NOT NULL
, code VARCHAR(50) NOT NULL
, name VARCHAR(255) NOT NULL
, description VARCHAR(4000) NULL
, active BIT NOT NULL
, display_order INT NOT NULL
, can_view BIT NULL
, can_edit BIT NULL
, can_admin BIT NULL
, name_error VARCHAR(255) NOT NULL
, is_new BIT NOT NULL
CALL partsltd_prod.p_shop_save_product_category (
'Test save product category' -- comment
, v_guid -- guid
, 1 -- id_user
, 1 -- debug
);
CREATE TEMPORARY TABLE IF NOT EXISTS tmp_Msg_Error (
display_order INT NOT NULL PRIMARY KEY AUTO_INCREMENT
, guid BINARY(36) NOT NULL
, id_type INT NULL
/*
CONSTRAINT FK_tmp_Msg_Error_id_type
FOREIGN KEY (id_type)
REFERENCES Shop_Msg_Error_Type (id_type),
*/
, code VARCHAR(50) NOT NULL
, msg VARCHAR(4000) NOT NULL
);
SELECT *
FROM partsltd_prod.Shop_Product_Category
;
SELECT *
FROM partsltd_prod.Shop_Product_Category_Temp
;
-- Get data from Temp table
INSERT INTO tmp_Category (
id_category
, code
, name
, description
, active
, display_order
, name_error
, is_new
)
SELECT
IFNULL(PC_T.id_category, PC.id_category) AS id_category
, IFNULL(PC_T.code, PC.code) AS code
, IFNULL(PC_T.name, PC.code) AS name
, IFNULL(PC_T.description, PC.description) AS description
, IFNULL(PC_T.active, PC.active) AS active
, IFNULL(PC_T.display_order, PC.display_order) AS display_order
, IFNULL(PC_T.name, IFNULL(PC.name, IFNULL(PC_T.code, IFNULL(PC.code, IFNULL(PC_T.id_category, '(No Product Category)'))))) AS name_error
, CASE WHEN IFNULL(PC_T.id_category, 0) < 1 THEN 1 ELSE 0 END AS is_new
FROM Shop_Product_Category_Temp PC_T
LEFT JOIN Shop_Product_Category PC ON PC_T.id_category = PC.id_category
WHERE PC_T.guid = a_guid
;
-- Validation
-- Missing mandatory fields
-- code
INSERT INTO tmp_Msg_Error (
guid
, id_type
, code
, msg
)
SELECT
a_guid AS GUID
, v_id_type_error_bad_data
, v_code_type_error_bad_data
, CONCAT('The following category(s) do not have a code: ', GROUP_CONCAT(t_C.name_error SEPARATOR ', ')) AS msg
FROM tmp_Category t_C
;
-- name
INSERT INTO tmp_Msg_Error (
guid
, id_type
, code
, msg
)
SELECT
a_guid AS GUID
, v_id_type_error_bad_data
, v_code_type_error_bad_data
, CONCAT('The following category(s) do not have a name: ', GROUP_CONCAT(t_C.name_error SEPARATOR ', ')) AS msg
FROM tmp_Category t_C
;
-- display_order
INSERT INTO tmp_Msg_Error (
guid
, id_type
, code
, msg
)
SELECT
a_guid AS GUID
, v_id_type_error_bad_data
, v_code_type_error_bad_data
, CONCAT('The following category(s) do not have a display order: ', GROUP_CONCAT(t_C.name_error SEPARATOR ', ')) AS msg
FROM tmp_Category t_C
;
SELECT * FROM tmp_Category;
-- Permissions
IF NOT EXISTS (SELECT * FROM tmp_Msg_Error LIMIT 1) THEN -- (SELECT * FROM tmp_Product WHERE is_new = 0 LIMIT 1) THEN
SET v_ids_product_permission := (
SELECT GROUP_CONCAT(P.id_product SEPARATOR ',')
FROM Shop_Product P
INNER JOIN Shop_Product_Category PC
ON P.id_category = PC.id_category
AND PC.is_new = 0
);
IF NOT ISNULL(v_ids_product_permission) THEN
SET v_id_permission_product = (SELECT id_permission FROM Shop_Permission WHERE code = 'STORE_PRODUCT' LIMIT 1);
CALL p_shop_calc_user(a_guid, a_id_user, v_id_permission_product, v_ids_product_permission);
UPDATE tmp_Category t_C
INNER JOIN Shop_Product P ON t_C.id_category = P.id_product
INNER JOIN Shop_Calc_User_Temp UE_T
ON P.id_product = UE_T.id_product
AND UE_T.GUID = a_guid
SET
t_C.can_view = UE_T.can_view
, t_C.can_edit = UE_T.can_edit
, t_C.can_admin = UE_T.can_admin
;
CALL p_shop_clear_calc_user(a_guid);
END IF;
END IF;
SELECT * FROM tmp_Category;
IF NOT EXISTS (SELECT * FROM tmp_Msg_Error LIMIT 1) THEN
START TRANSACTION;
IF NOT ISNULL(v_ids_product_permission) THEN
INSERT INTO Shop_Product_Change_Set ( comment )
VALUES ( a_comment )
;
SET v_id_change_set := LAST_INSERT_ID();
UPDATE Shop_Product_Category PC
INNER JOIN tmp_Category t_C ON PC.id_category = t_C.id_category
SET
PC.id_category = t_C.id_category
, PC.code = t_C.code
, PC.name = t_P.name
, PC.description = t_C.description
, PC.display_order = t_C.display_order
, PC.active = t_C.active
, P.id_change_set = v_id_change_set
;
END IF;
INSERT INTO Shop_Product_Category (
id_category
, code
, name
, description
, display_order
, active
, created_by
, created_on
)
SELECT
t_C.id_category AS id_category
, t_C.code AS code
, t_C.name AS name
, t_C.description AS description
, t_C.active AS active
, t_P.display_order AS display_order
, a_id_user AS created_by
, v_now AS created_on
FROM tmp_Category t_C
WHERE is_new = 1
AND active = 1
;
ROLLBACK;
END IF;
SELECT * FROM tmp_Msg_Error;
SELECT * FROM tmp_Category;
DROP TEMPORARY TABLE IF EXISTS tmp_Catgory;
DROP TEMPORARY TABLE IF EXISTS tmp_Msg_Error;
CALL partsltd_prod.p_debug_timing_reporting ( v_time_start );
END //
DELIMITER ;;
/*
CALL partsltd_prod.p_shop_save_product_category_test ();
select *
from shop_product_category;
select *
from shop_product_category_temp;
SELECT 'nips' as guid;
CALL p_shop_save_product_category_TEST (1, 'nips', 'y');
select *
from shop_product_category;
select *
from shop_product_category_temp;
DELETE FROM partsltd_prod.Shop_Product_Category_Temp;
DROP TABLE IF EXISTS tmp_Msg_Error;
*/

View File

@@ -64,7 +64,7 @@ BEGIN
SET v_id_type_error_bad_data := (SELECT id_type FROM Shop_Msg_Error_Type WHERE code = v_code_type_error_bad_data LIMIT 1);
SET v_id_access_level_edit := (SELECT id_access_level FROM Shop_Access_Level WHERE code = 'EDIT' LIMIT 1);
SET a_guid := IFNULL(a_guid, UUID());
CALL p_validate_guid ( a_guid );
SET a_debug := IFNULL(a_debug, 0);
IF a_debug = 1 THEN

View File

@@ -33,7 +33,9 @@ BEGIN
, active
, guid
)
VALUES (
VALUES
/* Test 1 - Update
(
4 -- id_product
, 1 -- id_category
, 'Laptops' -- name
@@ -42,7 +44,20 @@ BEGIN
, 2 -- display_order
, 1 -- active
, v_guid
);
)
*/
/* Test 2 - Insert */
(
-14 -- id_product
, 5 -- id_category
, 'Clip' -- name
, 0 -- has_variations
, 1 -- id_access_level_required
, 1 -- display_order
, 1 -- active
, v_guid
)
;
COMMIT;

View File

@@ -52,7 +52,7 @@ BEGIN
WHERE MET.code = 'BAD_DATA'
;
SET a_id_user := TRIM(IFNULL(a_id_user, 0));
SET a_id_user := IFNULL(a_id_user, 0);
SET a_get_all_product_category := IFNULL(a_get_all_product_category, 0);
SET a_get_inactive_product_category := IFNULL(a_get_inactive_product_category, 0);
SET a_ids_product_category := TRIM(IFNULL(a_ids_product_category, ''));
@@ -473,6 +473,9 @@ BEGIN
DELETE FROM tmp_Product_calc;
DELETE FROM tmp_Permutation_calc;
ELSE
SELECT * FROM Shop_Product_Category_Temp;
SELECT * FROM Shop_Product_Temp;
SELECT * FROM Shop_Product_Permutation_Temp;
*/
START TRANSACTION;
@@ -546,7 +549,8 @@ BEGIN
id_permutation
, id_product
, description
, cost_local
, cost_local_VAT_excl
, cost_local_VAT_incl
, id_currency_cost
, profit_local_min
, latency_manufacture
@@ -572,7 +576,8 @@ BEGIN
t_PP.id_permutation
, PP.id_product
, PP.description
, PP.cost_local
, PP.cost_local_VAT_excl
, PP.cost_local_VAT_incl
, PP.id_currency_cost
, PP.profit_local_min
, PP.latency_manufacture

View File

@@ -8,7 +8,8 @@ DELIMITER //
CREATE PROCEDURE p_shop_save_product_permutation (
IN a_comment VARCHAR(500),
IN a_guid BINARY(36),
IN a_id_user INT
IN a_id_user INT,
IN a_debug BIT
)
BEGIN
@@ -18,7 +19,7 @@ BEGIN
DECLARE v_ids_product_permission LONGTEXT;
DECLARE v_id_change_set INT;
DECLARE v_id_access_level_edit INT;
DECLARE v_now DATETIME;
DECLARE v_time_start TIMESTAMP(6);
DECLARE exit handler for SQLEXCEPTION
BEGIN
@@ -37,33 +38,34 @@ BEGIN
CREATE TEMPORARY TABLE IF NOT EXISTS tmp_Msg_Error (
display_order INT NOT NULL PRIMARY KEY AUTO_INCREMENT
, guid BINARY(36) NOT NULL
, id_type INT NULL
, code VARCHAR(50) NOT NULL
, msg VARCHAR(4000) NOT NULL
);
INSERT INTO tmp_Msg_Error (
guid
, id_type
id_type
, code
, msg
)
SELECT
a_guid
, NULL
MET.id_type
, @errno
, @text
FROM partsltd_prod.Shop_Msg_Error_Type MET
WHERE MET.code = 'MYSQL_ERROR'
LIMIT 1
;
SELECT *
FROM tmp_Msg_Error;
DROP TABLE IF EXISTS tmp_Msg_Error;
END;
SET v_time_start := CURRENT_TIMESTAMP(6);
SET v_code_type_error_bad_data := 'BAD_DATA';
SET v_id_type_error_bad_data := (SELECT id_type FROM Shop_Msg_Error_Type WHERE code = v_code_type_error_bad_data LIMIT 1);
SET v_id_access_level_edit := (SELECT id_access_level FROM Shop_Access_Level WHERE code = 'EDIT' LIMIT 1);
SET a_guid := IFNULL(a_guid, UUID());
CALL p_validate_guid ( a_guid );
DROP TABLE IF EXISTS tmp_Permutation;
@@ -71,14 +73,15 @@ BEGIN
id_permutation INT NOT NULL
, id_product INT NOT NULL
, description VARCHAR(4000) NOT NULL
, cost_local FLOAT NOT NULL
, cost_local_VAT_excl FLOAT NULL
, cost_local_VAT_incl FLOAT NULL
, id_currency_cost INT NOT NULL
, profit_local_min FLOAT NOT NULL
, profit_local_min FLOAT NULL
, latency_manufacture INT NOT NULL
, id_unit_measurement_quantity INT NOT NULL
, count_unit_measurement_per_quantity_step FLOAT NOT NULL
, quantity_min FLOAT NOT NULL
, quantity_max FLOAT NOT NULL
, quantity_min FLOAT NULL
, quantity_max FLOAT NULL
, quantity_stock FLOAT NOT NULL
, is_subscription BIT NOT NULL
, id_unit_measurement_interval_recurrence INT
@@ -97,7 +100,6 @@ BEGIN
CREATE TEMPORARY TABLE IF NOT EXISTS tmp_Msg_Error (
display_order INT NOT NULL PRIMARY KEY AUTO_INCREMENT
, guid BINARY(36) NOT NULL
, id_type INT NULL
, code VARCHAR(50) NOT NULL
, msg VARCHAR(4000) NOT NULL
@@ -109,7 +111,8 @@ BEGIN
id_permutation
, id_product
, description
, cost_local
, cost_local_VAT_excl
, cost_local_VAT_incl
, id_currency_cost
, profit_local_min
, latency_manufacture
@@ -133,7 +136,8 @@ BEGIN
PP_T.id_permutation
, IFNULL(PP_T.id_product, PP.id_product) AS id_product
, IFNULL(PP_T.description, PP.description) AS description
, IFNULL(PP_T.cost_local, PP.cost_local) AS cost_local
, IFNULL(PP_T.cost_local_VAT_excl, PP.cost_local_VAT_excl) AS cost_local_VAT_excl
, IFNULL(PP_T.cost_local_VAT_incl, PP.cost_local_VAT_incl) AS cost_local_VAT_incl
, IFNULL(PP_T.id_currency_cost, PP.id_currency_cost) AS a_id_currency_cost
, IFNULL(PP_T.profit_local_min, PP.profit_local_min) AS profit_local_min
, IFNULL(PP_T.latency_manufacture, PP.latency_manufacture) AS latency_manufacture
@@ -150,7 +154,7 @@ BEGIN
, IFNULL(PP_T.id_unit_measurement_interval_expiration_unsealed, PP.id_unit_measurement_interval_expiration_unsealed) AS id_unit_measurement_interval_expiration_unsealed
, IFNULL(PP_T.count_interval_expiration_unsealed, PP.count_interval_expiration_unsealed) AS count_interval_expiration_unsealed
, IFNULL(PP_T.active, PP.active) AS active
, fn_shop_get_product_permutation_name(PP_T.id_permutation)
, IFNULL(fn_shop_get_product_permutation_name(PP_T.id_permutation), '(No Permutation)') AS name_error
, CASE WHEN IFNULL(PP_T.id_permutation, 0) < 1 THEN 1 ELSE 0 END AS is_new
FROM Shop_Product_Permutation_Temp PP_T
LEFT JOIN Shop_Product_Permutation PP ON PP_T.id_permutation = PP.id_permutation
@@ -162,67 +166,77 @@ BEGIN
-- id_product
IF EXISTS (SELECT * FROM tmp_Permutation t_P WHERE ISNULL(t_P.id_product) LIMIT 1) THEN
INSERT INTO tmp_Msg_Error (
guid
, id_type
, id_product
id_type
, code
, msg
)
SELECT
a_guid AS GUID
, v_id_type_error_bad_data
v_id_type_error_bad_data
, v_code_type_error_bad_data
, CONCAT('The following product permutation(s) do not have a product: ', GROUP_CONCAT(IFNULL(t_P.name_error, 'NULL') SEPARATOR ', ')) AS msg
, CONCAT('The following product permutation(s) do not have a product: ', GROUP_CONCAT(t_P.name_error SEPARATOR ', ')) AS msg
FROM tmp_Permutation t_P
WHERE ISNULL(t_P.id_product)
;
END IF;
-- cost_local
IF EXISTS (SELECT * FROM tmp_Permutation t_P WHERE ISNULL(t_P.cost_local) LIMIT 1) THEN
-- cost_local_VAT_excl
IF EXISTS (SELECT * FROM tmp_Permutation t_P WHERE NOT ISNULL(t_P.cost_local_VAT_excl) AND t_P.cost_local_VAT_excl < 0 LIMIT 1) THEN
INSERT INTO tmp_Msg_Error (
guid
, id_type
, cost_local
id_type
, code
, msg
)
SELECT
a_guid AS GUID
, v_id_type_error_bad_data
v_id_type_error_bad_data
, v_code_type_error_bad_data
, CONCAT('The following product permutation(s) do not have a local cost: ', GROUP_CONCAT(IFNULL(t_P.name_error, 'NULL') SEPARATOR ', ')) AS msg
, CONCAT('The following product permutation(s) do not have a valid local cost excluding VAT: ', GROUP_CONCAT(t_P.name_error SEPARATOR ', ')) AS msg
FROM tmp_Permutation t_P
WHERE ISNULL(t_P.cost_local)
WHERE NOT ISNULL(t_P.cost_local_VAT_excl) AND t_P.cost_local_VAT_excl < 0
;
END IF;
-- cost_local_VAT_incl
IF EXISTS (SELECT * FROM tmp_Permutation t_P WHERE NOT ISNULL(t_P.cost_local_VAT_incl) AND t_P.cost_local_VAT_incl < 0 LIMIT 1) THEN
INSERT INTO tmp_Msg_Error (
id_type
, code
, msg
)
SELECT
v_id_type_error_bad_data
, v_code_type_error_bad_data
, CONCAT('The following product permutation(s) do not have a valid local cost including VAT: ', GROUP_CONCAT(t_P.name_error SEPARATOR ', ')) AS msg
FROM tmp_Permutation t_P
WHERE NOT ISNULL(t_P.cost_local_VAT_incl) AND t_P.cost_local_VAT_incl < 0
;
END IF;
-- profit_local_min
IF EXISTS (SELECT * FROM tmp_Permutation t_P WHERE ISNULL(t_P.profit_local_min) LIMIT 1) THEN
IF EXISTS (SELECT * FROM tmp_Permutation t_P WHERE NOT ISNULL(t_P.profit_local_min) AND t_P.profit_local_min < 0 LIMIT 1) THEN
INSERT INTO tmp_Msg_Error (
guid
, id_type
, profit_local_min
id_type
, code
, msg
)
SELECT
a_guid AS GUID
, v_id_type_error_bad_data
v_id_type_error_bad_data
, v_code_type_error_bad_data
, CONCAT('The following product permutation(s) do not have a local minimum profit: ', GROUP_CONCAT(IFNULL(t_P.name_error, 'NULL') SEPARATOR ', ')) AS msg
, CONCAT('The following product permutation(s) do not have a local minimum profit: ', GROUP_CONCAT(t_P.name_error SEPARATOR ', ')) AS msg
FROM tmp_Permutation t_P
WHERE ISNULL(t_P.profit_local_min)
WHERE NOT ISNULL(t_P.profit_local_min) AND t_P.profit_local_min < 0
;
END IF;
SELECT 'NIPS';
-- latency_manufacture
IF EXISTS (SELECT * FROM tmp_Permutation t_P WHERE ISNULL(t_P.latency_manufacture) LIMIT 1) THEN
INSERT INTO tmp_Msg_Error (
guid
, id_type
, latency_manufacture
id_type
, code
, msg
)
SELECT
a_guid AS GUID
, v_id_type_error_bad_data
v_id_type_error_bad_data
, v_code_type_error_bad_data
, CONCAT('The following product permutation(s) do not have a manufacturing latency: ', GROUP_CONCAT(IFNULL(t_P.name_error, 'NULL') SEPARATOR ', ')) AS msg
, CONCAT('The following product permutation(s) do not have a manufacturing latency: ', GROUP_CONCAT(t_P.name_error SEPARATOR ', ')) AS msg
FROM tmp_Permutation t_P
WHERE ISNULL(t_P.latency_manufacture)
;
@@ -230,16 +244,14 @@ BEGIN
-- id_unit_measurement_quantity
IF EXISTS (SELECT * FROM tmp_Permutation t_P WHERE ISNULL(t_P.id_unit_measurement_quantity) LIMIT 1) THEN
INSERT INTO tmp_Msg_Error (
guid
, id_type
, id_unit_measurement_quantity
id_type
, code
, msg
)
SELECT
a_guid AS GUID
, v_id_type_error_bad_data
v_id_type_error_bad_data
, v_code_type_error_bad_data
, CONCAT('The following product permutation(s) do not have a unit measurement for stock quantities: ', GROUP_CONCAT(IFNULL(t_P.name_error, 'NULL') SEPARATOR ', ')) AS msg
, CONCAT('The following product permutation(s) do not have a unit measurement for stock quantities: ', GROUP_CONCAT(t_P.name_error SEPARATOR ', ')) AS msg
FROM tmp_Permutation t_P
WHERE ISNULL(t_P.id_unit_measurement_quantity)
;
@@ -247,16 +259,14 @@ BEGIN
-- count_unit_measurement_per_quantity_step
IF EXISTS (SELECT * FROM tmp_Permutation t_P WHERE ISNULL(t_P.count_unit_measurement_per_quantity_step) LIMIT 1) THEN
INSERT INTO tmp_Msg_Error (
guid
, id_type
, count_unit_measurement_per_quantity_step
id_type
, code
, msg
)
SELECT
a_guid AS GUID
, v_id_type_error_bad_data
v_id_type_error_bad_data
, v_code_type_error_bad_data
, CONCAT('The following product permutation(s) do not have a count unit measurement per quantity step: ', GROUP_CONCAT(IFNULL(t_P.name_error, 'NULL') SEPARATOR ', ')) AS msg
, CONCAT('The following product permutation(s) do not have a count unit measurement per quantity step: ', GROUP_CONCAT(t_P.name_error SEPARATOR ', ')) AS msg
FROM tmp_Permutation t_P
WHERE ISNULL(t_P.count_unit_measurement_per_quantity_step)
;
@@ -264,16 +274,14 @@ BEGIN
-- quantity_min
IF EXISTS (SELECT * FROM tmp_Permutation t_P WHERE ISNULL(t_P.quantity_min) LIMIT 1) THEN
INSERT INTO tmp_Msg_Error (
guid
, id_type
, quantity_min
id_type
, code
, msg
)
SELECT
a_guid AS GUID
, v_id_type_error_bad_data
v_id_type_error_bad_data
, v_code_type_error_bad_data
, CONCAT('The following product permutation(s) do not have a minimum quantity: ', GROUP_CONCAT(IFNULL(t_P.name_error, 'NULL') SEPARATOR ', ')) AS msg
, CONCAT('The following product permutation(s) do not have a minimum quantity: ', GROUP_CONCAT(t_P.name_error SEPARATOR ', ')) AS msg
FROM tmp_Permutation t_P
WHERE ISNULL(t_P.quantity_min)
;
@@ -281,16 +289,14 @@ BEGIN
-- quantity_max
IF EXISTS (SELECT * FROM tmp_Permutation t_P WHERE ISNULL(t_P.quantity_max) LIMIT 1) THEN
INSERT INTO tmp_Msg_Error (
guid
, id_type
, quantity_max
id_type
, code
, msg
)
SELECT
a_guid AS GUID
, v_id_type_error_bad_data
v_id_type_error_bad_data
, v_code_type_error_bad_data
, CONCAT('The following product permutation(s) do not have a maximum quantity: ', GROUP_CONCAT(IFNULL(t_P.name_error, 'NULL') SEPARATOR ', ')) AS msg
, CONCAT('The following product permutation(s) do not have a maximum quantity: ', GROUP_CONCAT(t_P.name_error SEPARATOR ', ')) AS msg
FROM tmp_Permutation t_P
WHERE ISNULL(t_P.quantity_max)
;
@@ -298,16 +304,14 @@ BEGIN
-- is_subscription
IF EXISTS (SELECT * FROM tmp_Permutation t_P WHERE ISNULL(t_P.is_subscription) LIMIT 1) THEN
INSERT INTO tmp_Msg_Error (
guid
, id_type
, is_subscription
id_type
, code
, msg
)
SELECT
a_guid AS GUID
, v_id_type_error_bad_data
v_id_type_error_bad_data
, v_code_type_error_bad_data
, CONCAT('The following product permutation(s) do not have an is subscription?: ', GROUP_CONCAT(IFNULL(t_P.name_error, 'NULL') SEPARATOR ', ')) AS msg
, CONCAT('The following product permutation(s) do not have an is subscription?: ', GROUP_CONCAT(t_P.name_error SEPARATOR ', ')) AS msg
FROM tmp_Permutation t_P
WHERE ISNULL(t_P.is_subscription)
;
@@ -315,68 +319,82 @@ BEGIN
-- does_expire_faster_once_unsealed
IF EXISTS (SELECT * FROM tmp_Permutation t_P WHERE ISNULL(t_P.does_expire_faster_once_unsealed) LIMIT 1) THEN
INSERT INTO tmp_Msg_Error (
guid
, id_type
, does_expire_faster_once_unsealed
id_type
, code
, msg
)
SELECT
a_guid AS GUID
, v_id_type_error_bad_data
v_id_type_error_bad_data
, v_code_type_error_bad_data
, CONCAT('The following product permutation(s) do not have a does expire faster once unsealed: ', GROUP_CONCAT(IFNULL(t_P.name_error, 'NULL') SEPARATOR ', ')) AS msg
, CONCAT('The following product permutation(s) do not have a does expire faster once unsealed: ', GROUP_CONCAT(t_P.name_error SEPARATOR ', ')) AS msg
FROM tmp_Permutation t_P
WHERE ISNULL(t_P.does_expire_faster_once_unsealed)
;
END IF;
-- Permissions
IF NOT EXISTS (SELECT * FROM tmp_Msg_Error LIMIT 1) THEN -- (SELECT * FROM tmp_Product WHERE is_new = 0 LIMIT 1) THEN
SET v_ids_product_permission := (
SELECT GROUP_CONCAT(P.id_product SEPARATOR ',')
FROM Shop_Product P
INNER JOIN tmp_Permutation t_P
ON P.id_product = t_P.id_product
-- AND t_P.is_new = 0
);
IF NOT ISNULL(v_ids_product_permission) THEN
SET v_id_permission_product = (SELECT id_permission FROM Shop_Permission WHERE code = 'STORE_PRODUCT' LIMIT 1);
CALL p_shop_calc_user(a_guid, a_id_user, FALSE, v_id_permission_product, v_id_access_level_edit, v_ids_product_permission);
UPDATE tmp_Permutation t_P
INNER JOIN Shop_Product P ON t_P.id_product = P.id_product
INNER JOIN Shop_Calc_User_Temp UE_T
ON P.id_product = UE_T.id_product
AND UE_T.GUID = a_guid
SET
t_P.can_view = UE_T.can_view
, t_P.can_edit = UE_T.can_edit
, t_P.can_admin = UE_T.can_admin
;
CALL p_shop_clear_calc_user(a_guid);
IF EXISTS (SELECT * FROM tmp_Permutation t_P WHERE ISNULL(t_P.can_edit) LIMIT 1) THEN
INSERT INTO tmp_Msg_Error (
guid
, id_type
, code
, msg
)
SELECT
a_guid AS GUID
, v_id_type_error_bad_data
, v_code_type_error_bad_data
, CONCAT('The following product permutation(s) do not have product edit permission: ', GROUP_CONCAT(IFNULL(t_P.name_error, 'NULL') SEPARATOR ', ')) AS msg
FROM tmp_Permutation t_P
WHERE ISNULL(t_P.can_edit)
;
END IF;
END IF;
SET v_ids_product_permission := (
SELECT GROUP_CONCAT(P.id_product SEPARATOR ',')
FROM Shop_Product P
INNER JOIN tmp_Permutation t_P
ON P.id_product = t_P.id_product
-- AND t_P.is_new = 0
);
SET v_id_permission_product = (SELECT id_permission FROM Shop_Permission WHERE code = 'STORE_PRODUCT' LIMIT 1);
IF a_debug = 1 THEN
SELECT
a_guid
, a_id_user
, FALSE AS a_get_inactive_user
, v_id_permission_product
, v_id_access_level_edit
, v_ids_product_permission
, 0 AS a_debug
;
END IF;
SET v_now := CURRENT_DATETIME();
CALL p_shop_calc_user(
a_guid
, a_id_user
, FALSE -- a_get_inactive_user
, v_id_permission_product
, v_id_access_level_edit
, v_ids_product_permission
, 0 -- a_debug
);
UPDATE tmp_Permutation t_P
INNER JOIN Shop_Product P ON t_P.id_product = P.id_product
INNER JOIN Shop_Calc_User_Temp UE_T
ON P.id_product = UE_T.id_product
AND UE_T.GUID = a_guid
SET
t_P.can_view = UE_T.can_view
, t_P.can_edit = UE_T.can_edit
, t_P.can_admin = UE_T.can_admin
;
CALL p_shop_clear_calc_user(
a_guid
, 0 -- a_debug
);
IF EXISTS (SELECT * FROM tmp_Permutation t_P WHERE ISNULL(t_P.can_edit) LIMIT 1) THEN
INSERT INTO tmp_Msg_Error (
id_type
, code
, msg
)
SELECT
v_id_type_error_bad_data
, v_code_type_error_bad_data
, CONCAT('The following product permutation(s) do not have product edit permission: ', GROUP_CONCAT(t_P.name_error SEPARATOR ', ')) AS msg
FROM tmp_Permutation t_P
WHERE ISNULL(t_P.can_edit)
;
END IF;
IF NOT EXISTS (SELECT * FROM tmp_Msg_Error LIMIT 1) THEN
START TRANSACTION;
@@ -393,7 +411,8 @@ BEGIN
SET
PP.id_product = t_P.id_product
, PP.description = t_P.description
, PP.cost_local = t_P.cost_local
, PP.cost_local_VAT_excl = t_P.cost_local_VAT_excl
, PP.cost_local_VAT_incl = t_P.cost_local_VAT_incl
, PP.id_currency_cost = t_P.id_currency_cost
, PP.profit_local_min = t_P.profit_local_min
, PP.latency_manufacture = t_P.latency_manufacture
@@ -417,7 +436,8 @@ BEGIN
INSERT INTO Shop_Product_Permutation (
id_product
, description
, cost_local
, cost_local_VAT_excl
, cost_local_VAT_incl
, id_currency_cost
, profit_local_min
, latency_manufacture
@@ -440,7 +460,8 @@ BEGIN
SELECT
t_P.id_product AS id_product
, t_P.description AS description
, t_P.cost_local AS cost_local
, t_P.cost_local_VAT_excl AS cost_local_VAT_excl
, t_P.cost_local_VAT_incl AS cost_local_VAT_incl
, t_P.id_currency_cost AS id_currency_cost
, t_P.profit_local_min AS profit_local_min
, t_P.latency_manufacture AS latency_manufacture
@@ -458,7 +479,7 @@ BEGIN
, t_P.count_interval_expiration_unsealed AS count_interval_expiration_unsealed
, t_P.active AS active
, a_id_user AS created_by
, v_now AS created_on
, v_time_start AS created_on
FROM tmp_Permutation t_P
WHERE
is_new = 1
@@ -471,10 +492,22 @@ BEGIN
COMMIT;
END IF;
SELECT * FROM tmp_Msg_Error;
# Errors
SELECT *
FROM tmp_Msg_Error t_ME
INNER JOIN partsltd_prod.Shop_Msg_Error_Type MET ON t_ME.id_type = MET.id_type
;
DROP TEMPORARY TABLE IF EXISTS tmp_Permutation;
DROP TEMPORARY TABLE IF EXISTS tmp_Msg_Error;
IF a_debug = 1 THEN
SELECT * from tmp_Permutation;
END IF;
DROP TEMPORARY TABLE tmp_Permutation;
DROP TEMPORARY TABLE tmp_Msg_Error;
IF a_debug = 1 THEN
CALL partsltd_prod.p_debug_timing_reporting ( v_time_start );
END IF;
END //
DELIMITER ;;

View File

@@ -0,0 +1,124 @@
-- Clear previous proc
DROP PROCEDURE IF EXISTS partsltd_prod.p_shop_save_product_permutation_test;
DELIMITER //
CREATE PROCEDURE p_shop_save_product_permutation_test ()
BEGIN
DECLARE v_guid BINARY(36);
DECLARE v_time_start TIMESTAMP(6);
SET v_time_start := CURRENT_TIMESTAMP(6);
SET v_guid := 'nips';
SELECT *
FROM partsltd_prod.Shop_Product_Permutation
;
SELECT *
FROM partsltd_prod.Shop_Product_Permutation_Temp
;
START TRANSACTION;
INSERT INTO partsltd_prod.Shop_Product_Permutation_Temp (
id_permutation
, id_product
, description
, cost_local_VAT_excl
, cost_local_VAT_incl
, id_currency_cost
, profit_local_min
, latency_manufacture
, id_unit_measurement_quantity
, count_unit_measurement_per_quantity_step
, quantity_min
, quantity_max
, quantity_stock
, is_subscription
, id_unit_measurement_interval_recurrence
, count_interval_recurrence
, id_stripe_product
, does_expire_faster_once_unsealed
, id_unit_measurement_interval_expiration_unsealed
, count_interval_expiration_unsealed
, active
, guid
)
VALUES
/* Test 1 - Insert */
(
-1 -- id_permutation
, 8 -- id_product
, 'Hair clip' -- description
, NULL -- cost_local_VAT_excl
, NULL -- cost_local_VAT_incl
, 1 -- id_currency_cost
, NULL -- profit_local_min
, 1 -- latency_manufacture
, 3 -- id_unit_measurement_quantity
, 1 -- count_unit_measurement_per_quantity_step
, 0 -- quantity_min
, 0 -- quantity_max
, 2 -- quantity_stock
, FALSE -- is_subscription
, NULL -- id_unit_measurement_interval_recurrence
, NULL -- count_interval_recurrence
, NULL -- id_stripe_product
, FALSE -- does_expire_faster_once_unsealed
, NULL -- id_unit_measurement_interval_expiration_unsealed
, NULL -- count_interval_expiration_unsealed
, 1 -- active
, v_guid
)
/* Test 2 - Update
(
4 -- id_product
, 1 -- id_category
, 'Laptops' -- name
, 0 -- has_variations
, 2 -- id_access_level_required
, 2 -- display_order
, 1 -- active
, v_guid
)
*/
;
COMMIT;
SELECT *
FROM partsltd_prod.Shop_Product_Permutation_Temp
WHERE GUID = v_guid
;
CALL partsltd_prod.p_shop_save_product_permutation (
'Test save product' -- comment
, v_guid -- guid
, 1 -- id_user
, 1 -- debug
);
SELECT *
FROM partsltd_prod.Shop_Product_Permutation
;
SELECT *
FROM partsltd_prod.Shop_Product_Permutation_Temp
;
CALL partsltd_prod.p_debug_timing_reporting ( v_time_start );
END //
DELIMITER ;;
/*
CALL partsltd_prod.p_shop_save_product_permutation_test ();
DELETE FROM partsltd_prod.Shop_Product_Permutation_Temp;
DROP TABLE IF EXISTS tmp_Msg_Error;
SELECT * FROM partsltd_prod.Shop_Product
*/

View File

@@ -429,7 +429,7 @@ BEGIN
-- Transaction
IF NOT EXISTS (SELECT * FROM tmp_Msg_Error) THEN
START TRANSACTION;
INSERT INTO partsltd_prod.Shop_Sales_And_Purchasing_Change_Set (
INSERT INTO partsltd_prod.Shop_User_Change_Set (
comment
, updated_last_by
, updated_last_on

View File

@@ -42,6 +42,7 @@ BEGIN
, active
, guid
)
/* Test 1 - Insert
VALUES (
-3
, 1
@@ -54,8 +55,26 @@ BEGIN
, 'test url'
, 1 -- active
, v_guid
);
)
*/
/* Test 2 - Update */
SELECT
id_supplier
, id_currency
, name_company
, 'Nat' AS name_contact
, 'Butchery' AS department_contact
, phone_number
, fax
, email
, website
, active
, v_guid
FROM partsltd_prod.Shop_Supplier S
WHERE S.id_supplier = 2
;
/*
INSERT INTO partsltd_prod.Shop_Supplier_Address_Temp (
id_address
, id_supplier
@@ -68,6 +87,7 @@ BEGIN
, active
, GUID
)
/ Test 1 - Insert
VALUES (
-4
, -3
@@ -80,7 +100,23 @@ BEGIN
, 1
, v_guid
)
/
/ Test 2 - Update /
SELECT
id_address
, id_supplier
, id_region
, postcode
, address_line_1
, address_line_2
, city
, county
, active
, v_guid
FROM partsltd_prod.Shop_Supplier_Address SA
WHERE SA.id_supplier = 2
;
*/
COMMIT;
@@ -118,14 +154,14 @@ BEGIN
END //
DELIMITER ;;
/*
CALL partsltd_prod.p_shop_save_supplier_test ();
DELETE FROM partsltd_prod.Shop_Supplier_Temp;
DELETE FROM partsltd_prod.Shop_Supplier_Address_Temp;
DROP TABLE IF EXISTS tmp_Msg_Error;
/*
Cannot add or update a child row: a foreign key constraint fails (`partsltd_prod`.`shop_supplier_address`, CONSTRAINT `FK_Shop_Supplier_Address_id_supplier` FOREIGN KEY (`id_supplier`) REFERENCES `shop_supplier` (`id_supplier`) ON UPDATE RESTRICT)
Cannot add or update a child row: a foreign key constraint fails (`partsltd_prod`.`shop_supplier`, CONSTRAINT `FK_Shop_Supplier_id_change_set` FOREIGN KEY (`id_change_set`) REFERENCES `shop_sales_and_purchasing_change_set` (`id_change_set`))
*/

View File

@@ -285,7 +285,7 @@ BEGIN
'A valid ID is required for the following Supplier Purchase Order(s): '
, GROUP_CONCAT(CONCAT(IFNULL(t_SPO.id_stock, '(No Supplier Purchase Order)')) SEPARATOR ', ')
) AS msg
FROM tmp_Stock_Item t_SPO
FROM tmp_Supplier_Purchase_Order t_SPO
LEFT JOIN partsltd_prod.Shop_Supplier_Purchase_Order SPO ON t_SPO.id_order = SPO.id_order
WHERE 1=1
AND t_SPO.id_stock > 0
@@ -316,7 +316,7 @@ BEGIN
'A valid supplier is required for the following Supplier Purchase Order(s): '
, GROUP_CONCAT(CONCAT(IFNULL(t_SPO.id_stock, '(No Supplier Purchase Order)'), ' - ', t_SPO.id_supplier_ordered) SEPARATOR ', ')
) AS msg
FROM tmp_Stock_Item t_SPO
FROM tmp_Supplier_Purchase_Order t_SPO
LEFT JOIN partsltd_prod.Shop_Supplier S ON t_SPO.id_supplier_ordered = S.id_supplier
WHERE 1=1
AND (
@@ -349,7 +349,7 @@ BEGIN
'A valid currency is required for the following Supplier Purchase Order(s): '
, GROUP_CONCAT(CONCAT(IFNULL(t_SPO.id_stock, '(No Supplier Purchase Order)'), ' - ', t_SPO.id_currency_cost) SEPARATOR ', ')
) AS msg
FROM tmp_Stock_Item t_SPO
FROM tmp_Supplier_Purchase_Order t_SPO
LEFT JOIN partsltd_prod.Shop_Currency C ON t_SPO.id_currency_cost = C.id_currency
WHERE 1=1
AND (
@@ -559,7 +559,7 @@ BEGIN
SELECT * from partsltd_prod.Shop_Calc_User_Temp WHERE GUID = a_guid;
END IF;
IF NOT EXISTS (SELECT can_view FROM partsltd_prod.Shop_Calc_User_Temp UE_T WHERE UE_T.GUID = a_guid) THEN
IF EXISTS (SELECT * FROM partsltd_prod.Shop_Calc_User_Temp UE_T WHERE UE_T.GUID = a_guid AND IFNULL(UE_T.can_view, 0) = 0) THEN
DELETE FROM tmp_Msg_Error;
INSERT INTO tmp_Msg_Error (
@@ -567,11 +567,18 @@ BEGIN
, code
, msg
)
VALUES (
SELECT
v_id_type_error_no_permission
, v_code_type_error_no_permission
, CONCAT('You do not have view permissions for ', (SELECT name FROM partsltd_prod.Shop_Permission WHERE id_permission = v_id_permission_supplier LIMIT 1))
)
, CONCAT(
'You do not have view permissions for '
, GROUP_CONCAT(name SEPARATOR ', ')
) AS msg
FROM partsltd_prod.Shop_Permission PERM
INNER JOIN partsltd_prod.Shop_Calc_User_Temp UE_T
ON PERM.id_permission = UE_T.id_permission
AND UE_T.GUID = a_guid
AND IFNULL(UE_T.can_view, 0) = 0
;
END IF;

View File

@@ -39,7 +39,7 @@ BEGIN
, active
, GUID
)
/* Test 1 - Insert
/* Test 1 - Insert */
VALUES (
-1
, 1
@@ -47,7 +47,7 @@ BEGIN
, 1
, v_guid
)
*/
/* Test 2 - Update
SELECT
id_order
, id_supplier_ordered
@@ -56,6 +56,7 @@ BEGIN
, v_guid
FROM partsltd_prod.Shop_Supplier_Purchase_Order
WHERE id_order = 6
*/
;
INSERT INTO partsltd_prod.Shop_Supplier_Purchase_Order_Product_Link_Temp (
@@ -72,7 +73,7 @@ BEGIN
, cost_total_local_VAT_incl
, GUID
)
/* Test 1 - Insert
/* Test 1 - Insert */
VALUES (
-1
, -1
@@ -87,7 +88,7 @@ BEGIN
, 6
, v_guid
)
*/
/* Test 2 - Update
SELECT
id_link
, id_order
@@ -103,6 +104,7 @@ BEGIN
, v_guid
FROM partsltd_prod.Shop_Supplier_Purchase_Order_Product_Link
WHERE id_order = 6
*/
;
COMMIT;
@@ -149,6 +151,7 @@ DELETE FROM partsltd_prod.Shop_Supplier_Purchase_Order_Product_Link_Temp;
DROP TABLE IF EXISTS tmp_Msg_Error;
/*
Cannot add or update a child row: a foreign key constraint fails (`partsltd_prod`.`shop_supplier_address`, CONSTRAINT `FK_Shop_Supplier_Address_id_supplier` FOREIGN KEY (`id_supplier`) REFERENCES `shop_supplier` (`id_supplier`) ON UPDATE RESTRICT)
*/

View File

@@ -0,0 +1,149 @@
-- Clear previous proc
DROP PROCEDURE IF EXISTS partsltd_prod.p_shop_save_Manufacturing_purchase_order_test;
DELIMITER //
CREATE PROCEDURE p_shop_save_Manufacturing_purchase_order_test ()
BEGIN
DECLARE v_guid BINARY(36);
DECLARE v_time_start TIMESTAMP(6);
SET v_time_start := CURRENT_TIMESTAMP(6);
SET v_guid := 'nips';
SELECT *
FROM partsltd_prod.Shop_Manufacturing_Purchase_Order
;
SELECT *
FROM partsltd_prod.Shop_Manufacturing_Purchase_Order_Temp
;
SELECT *
FROM partsltd_prod.Shop_Manufacturing_Purchase_Order_Product_Link
;
SELECT *
FROM partsltd_prod.Shop_Manufacturing_Purchase_Order_Product_Link_Temp
;
START TRANSACTION;
DELETE FROM partsltd_prod.Shop_Manufacturing_Purchase_Order_Temp;
DELETE FROM partsltd_prod.Shop_Manufacturing_Purchase_Order_Product_Link_Temp;
INSERT INTO partsltd_prod.Shop_Manufacturing_Purchase_Order_Temp (
id_order
, id_currency
, active
, GUID
)
/* Test 1 - Insert */
VALUES (
-1
, 1
, 1
, v_guid
)
/* Test 2: Alter
SELECT
id_order
, id_currency
, active
, v_guid
FROM partsltd_prod.Shop_Manufacturing_Purchase_Order
WHERE id_order = 6
*/
;-- SELECT * FROM partsltd_prod.Shop_Unit_Measurement;
INSERT INTO partsltd_prod.Shop_Manufacturing_Purchase_Order_Product_Link_Temp (
id_link
, id_order
, id_permutation
, id_unit_quantity
, quantity_used
, quantity_produced
, id_unit_latency_manufacture
, latency_manufacture
, display_order
, active
, GUID
)
/* Test 1 - Insert */
VALUES (
-1 -- id_link
, -1 -- id_order
, 3 -- id_permutation
, 3 -- id_unit_quantity
, 3 -- quantity_used
, 0 -- quantity_produced
, 4 -- id_unit_latency_manufacture
, 4 -- latency_manufacture
, 1 -- display_order
, 1 -- active
, v_guid --
)
/* Test 2: Alter
SELECT
id_link
, id_order
, id_permutation
, id_unit_quantity
, quantity_used
, quantity_produced
, id_unit_latency_manufacture
, latency_manufacture
, display_order
, active
, v_guid
FROM partsltd_prod.Shop_Manufacturing_Purchase_Order_Product_Link
WHERE id_order = 6
*/
;
COMMIT;
SELECT *
FROM partsltd_prod.Shop_Manufacturing_Purchase_Order_Temp
WHERE GUID = v_guid
;
SELECT *
FROM partsltd_prod.Shop_Manufacturing_Purchase_Order_Product_Link_Temp
WHERE GUID = v_guid
;
CALL partsltd_prod.p_shop_save_Manufacturing_purchase_order (
'Test save Manufacturing Purchase Order' -- comment
, v_guid -- guid
, 1 -- id_user
, 1 -- debug
);
SELECT *
FROM partsltd_prod.Shop_Manufacturing_Purchase_Order_Temp
;
SELECT *
FROM partsltd_prod.Shop_Manufacturing_Purchase_Order_Product_Link_Temp
;
SELECT *
FROM partsltd_prod.Shop_Manufacturing_Purchase_Order
;
SELECT *
FROM partsltd_prod.Shop_Manufacturing_Purchase_Order_Product_Link
;
CALL partsltd_prod.p_debug_timing_reporting ( v_time_start );
END //
DELIMITER ;;
/*
CALL partsltd_prod.p_shop_save_Manufacturing_purchase_order_test ();
DELETE FROM partsltd_prod.Shop_Manufacturing_Purchase_Order_Temp;
DELETE FROM partsltd_prod.Shop_Manufacturing_Purchase_Order_Product_Link_Temp;
DROP TABLE IF EXISTS tmp_Msg_Error;
select * from partsltd_prod.Shop_User;
*/

View File

@@ -18,11 +18,13 @@ CREATE PROCEDURE p_shop_save_manufacturing_purchase_order (
BEGIN
DECLARE v_code_type_error_bad_data VARCHAR(50);
DECLARE v_code_type_error_no_permission VARCHAR(50);
DECLARE v_code_type_error_warning VARCHAR(50);
DECLARE v_id_access_level_edit INT;
DECLARE v_id_change_set INT;
DECLARE v_ids_permission_manufacturing_purchase_order VARCHAR(100);
DECLARE v_id_type_error_bad_data INT;
DECLARE v_id_type_error_no_permission INT;
DECLARE v_id_type_error_warning INT;
DECLARE v_ids_product_permission TEXT;
DECLARE v_time_start TIMESTAMP(6);
@@ -64,6 +66,8 @@ BEGIN
SET v_id_type_error_bad_data := (SELECT id_type FROM partsltd_prod.Shop_Msg_Error_Type WHERE code = v_code_type_error_bad_data LIMIT 1);
SET v_code_type_error_no_permission := (SELECT code FROM partsltd_prod.Shop_Msg_Error_Type WHERE code = 'NO_PERMISSION' LIMIT 1);
SET v_id_type_error_no_permission := (SELECT id_type FROM partsltd_prod.Shop_Msg_Error_Type WHERE code = v_code_type_error_no_permission LIMIT 1);
SET v_code_type_error_warning := (SELECT code FROM partsltd_prod.Shop_Msg_Error_Type WHERE code = 'WARNING' LIMIT 1);
SET v_id_type_error_warning := (SELECT id_type FROM partsltd_prod.Shop_Msg_Error_Type WHERE code = v_code_type_error_warning LIMIT 1);
SET v_ids_permission_manufacturing_purchase_order := (SELECT GROUP_CONCAT(id_permission SEPARATOR ',') FROM partsltd_prod.Shop_Permission WHERE code IN ('STORE_MANUFACTURING_PURCHASE_ORDER', 'STORE_PRODUCT'));
SET v_id_access_level_edit := (SELECT id_access_level FROM partsltd_prod.Shop_Access_Level WHERE code = 'EDIT' LIMIT 1);
@@ -77,28 +81,38 @@ BEGIN
-- Temporary tables
CREATE TEMPORARY TABLE tmp_Manufacturing_Purchase_Order (
id_order INT NOT NULL PRIMARY KEY
, id_currency_cost INT NOT NULL
, id_order_temp INT NOT NULL
, id_currency INT NOT NULL
, active BIT NOT NULL
, is_new BIT NOT NULL
, name_error VARCHAR(1000) NOT NULL
, cost_total_local_VAT_excl FLOAT NULL
, cost_total_local_VAT_incl FLOAT NULL
, price_total_local_VAT_excl FLOAT NULL
, price_total_local_VAT_incl FLOAT NULL
);
CREATE TEMPORARY TABLE tmp_Manufacturing_Purchase_Order_Product_Link (
id_link INT NOT NULL PRIMARY KEY
, id_order INT NOT NULL
, id_permutation INT NOT NULL
, id_currency_cost INT NOT NULL
, quantity_used FLOAT NOT NULL
, id_product INT NULL
, id_permutation INT NULL
, id_currency INT NOT NULL
, id_unit_quantity INT NOT NULL
, quantity_used FLOAT NOT NULL
, quantity_produced FLOAT NULL
, id_unit_latency_manufacture INT NULL
, latency_manufacture INT NULL
, display_order INT NOT NULL
, active BIT NOT NULL
, name_error VARCHAR(200) NOT NULL
, cost_total_local_VAT_excl FLOAT NOT NULL
, cost_total_local_VAT_incl FLOAT NOT NULL
, cost_unit_local_VAT_excl FLOAT NOT NULL
, cost_unit_local_VAT_incl FLOAT NOT NULL
, cost_unit_local_VAT_excl FLOAT NULL
, cost_unit_local_VAT_incl FLOAT NULL
, cost_total_local_VAT_excl FLOAT NULL
, cost_total_local_VAT_incl FLOAT NULL
, price_unit_local_VAT_excl FLOAT NULL
, price_unit_local_VAT_incl FLOAT NULL
, price_total_local_VAT_excl FLOAT NULL
, price_total_local_VAT_incl FLOAT NULL
, has_order BIT NULL
, is_new BIT NOT NULL
, name_error VARCHAR(1000) NOT NULL
@@ -113,21 +127,37 @@ BEGIN
INSERT INTO tmp_Manufacturing_Purchase_Order (
id_order
, id_currency_cost
, id_order_temp
, id_currency
, active
, is_new
, name_error
)
SELECT
SPO_T.id_order
, IFNULL(IFNULL(SPO_T.id_currency_cost, MPO.id_currency_cost), 0) AS id_currency_cost
FROM partsltd_prod.Shop_Manufacturing_Purchase_Order_Temp SPO_T
LEFT JOIN partsltd_prod.Shop_Manufacturing_Purchase_Order MPO ON SPO_T.id_order = MPO.id_order
WHERE SPO_T.GUID = a_guid
MPO_T.id_order
, MPO_T.id_order
, IFNULL(IFNULL(MPO_T.id_currency, MPO.id_currency), 0) AS id_currency
, IFNULL(IFNULL(MPO_T.active, MPO.active), 1) AS active
, IFNULL(MPO_T.id_order, 0) < 1 AS is_new
, CASE WHEN IFNULL(MPO_T.id_order, -1) < 0 THEN
CONCAT('New Manufacturing Purchase Order ', MPO_T.id_order)
ELSE
CONCAT(
IFNULL(IFNULL(MPO_T.id_order, MPO.id_order), '(No Manufacturing Purchase Order)')
, ' - '
, IFNULL(IFNULL(MPO_T.id_currency, MPO.id_currency), '(No Currency)')
)
END AS name_error
FROM partsltd_prod.Shop_Manufacturing_Purchase_Order_Temp MPO_T
LEFT JOIN partsltd_prod.Shop_Manufacturing_Purchase_Order MPO ON MPO_T.id_order = MPO.id_order
WHERE MPO_T.GUID = a_guid
;
INSERT INTO tmp_Manufacturing_Purchase_Order_Product_Link (
id_link
, id_order
, id_product
, id_permutation
, id_currency_cost
, id_unit_quantity
, quantity_used
, quantity_produced
@@ -135,55 +165,126 @@ BEGIN
, latency_manufacture
, display_order
, active
, name_error
, is_new
, cost_total_local_VAT_excl
, cost_total_local_VAT_incl
, cost_unit_local_VAT_excl
, cost_unit_local_VAT_incl
, price_unit_local_VAT_excl
, price_unit_local_VAT_incl
, has_order
, is_new
)
SELECT
IFNULL(SPOPL_T.id_link, 0) AS id_link
, IFNULL(IFNULL(SPOPL_T.id_order, MPOPL.id_order), 0) AS id_order
, IFNULL(IFNULL(SPOPL_T.id_permutation, MPOPL.id_permutation), 0) AS id_permutation
, IFNULL(IFNULL(SPOPL_T.id_currency_cost, MPOPL.id_currency_cost), 0) AS id_currency_cost
, IFNULL(IFNULL(SPOPL_T.id_unit_quantity, MPOPL.id_unit_quantity), 0) AS id_unit_quantity
, SPOPL_T.quantity_used AS quantity_used
, SPOPL_T.quantity_produced AS quantity_produced
, SPOPL_T.id_unit_latency_manufacture AS id_unit_latency_manufacture
, SPOPL_T.latency_manufacture AS latency_manufacture
, IFNULL(SPOPL_T.display_order, RANK() OVER (PARTITION BY IFNULL(IFNULL(SPOPL_T.id_order, MPOPL.id_order), 0) ORDER BY IFNULL(IFNULL(SPOPL_T.display_order, MPOPL.display_order), 0))) AS display_order
, IFNULL(IFNULL(SPOPL_T.active, MPOPL.active), 1) AS active
, CONCAT(
fn_shop_get_product_permutation_name(SPOPL_T.id_permutation)
, ' - x'
, IFNULL(SPOPL_T.quantity_used, '(No Quantity)')
) AS name_error
, IFNULL(SPOPL_T.id_link, 0) < 1 AS is_new
, SPOPL_T.cost_total_local_VAT_excl AS cost_total_local_VAT_excl
, SPOPL_T.cost_total_local_VAT_incl AS cost_total_local_VAT_incl
, SPOPL_T.cost_total_local_VAT_excl / SPOPL_T.quantity_used AS cost_unit_local_VAT_excl
, SPOPL_T.cost_total_local_VAT_incl / SPOPL_T.quantity_used AS cost_unit_local_VAT_incl
IFNULL(MPOPL_T.id_link, 0) AS id_link
, IFNULL(IFNULL(MPOPL_T.id_order, MPOPL.id_order), 0) AS id_order
, IFNULL(MPOPL_T.id_product, PP.id_product) AS id_product
, IFNULL(
IFNULL(
IFNULL(
MPOPL_T.id_permutation
, CASE WHEN NOT ISNULL(MPOPL_T.id_product) AND NOT ISNULL(MPOPL_T.csv_list_variations) THEN
partsltd_prod.fn_shop_get_id_product_permutation_from_variation_csv_list(MPOPL_T.id_product, MPOPL_T.csv_list_variations)
ELSE NULL END
)
, MPOPL.id_permutation
)
, 0
) AS id_permutation
, IFNULL(IFNULL(MPOPL_T.id_unit_quantity, MPOPL.id_unit_quantity), 0) AS id_unit_quantity
, MPOPL_T.quantity_used AS quantity_used
, MPOPL_T.quantity_produced AS quantity_produced
, MPOPL_T.id_unit_latency_manufacture AS id_unit_latency_manufacture
, MPOPL_T.latency_manufacture AS latency_manufacture
, IFNULL(MPOPL_T.display_order, RANK() OVER (PARTITION BY IFNULL(IFNULL(MPOPL_T.id_order, MPOPL.id_order), 0) ORDER BY IFNULL(IFNULL(MPOPL_T.display_order, MPOPL.display_order), 0))) AS display_order
, IFNULL(IFNULL(MPOPL_T.active, MPOPL.active), 1) AS active
-- , MPOPL_T.cost_total_local_VAT_excl / MPOPL_T.quantity_used AS cost_unit_local_VAT_excl
-- , MPOPL_T.cost_total_local_VAT_incl / MPOPL_T.quantity_used AS cost_unit_local_VAT_incl
, IFNULL(MPOPL_T.cost_unit_local_VAT_excl, MPOPL.cost_unit_local_VAT_excl) AS cost_unit_local_VAT_excl
, IFNULL(MPOPL_T.cost_unit_local_VAT_incl, MPOPL.cost_unit_local_VAT_incl) AS cost_unit_local_VAT_incl
, IFNULL(MPOPL_T.price_unit_local_VAT_excl, MPOPL.price_unit_local_VAT_excl) AS price_unit_local_VAT_excl
, IFNULL(MPOPL_T.price_unit_local_VAT_incl, MPOPL.price_unit_local_VAT_incl) AS price_unit_local_VAT_incl
, NOT ISNULL(t_MPO.id_order) AS has_order
FROM partsltd_prod.Shop_Manufacturing_Purchase_Order_Product_Link_Temp SPOPL_T
LEFT JOIN partsltd_prod.Shop_Manufacturing_Purchase_Order_Product_Link MPOPL ON SPOPL_T.id_link = MPOPL.id_link
LEFT JOIN tmp_Manufacturing_Purchase_Order t_MPO ON SPOPL_T.id_order = t_MPO.id_order
WHERE SPOPL_T.GUID = a_guid
, IFNULL(MPOPL_T.id_link, 0) < 1 AS is_new
FROM partsltd_prod.Shop_Manufacturing_Purchase_Order_Product_Link_Temp MPOPL_T
LEFT JOIN partsltd_prod.Shop_Manufacturing_Purchase_Order_Product_Link MPOPL ON MPOPL_T.id_link = MPOPL.id_link
LEFT JOIN tmp_Manufacturing_Purchase_Order t_MPO ON MPOPL_T.id_order = t_MPO.id_order
LEFT JOIN partsltd_prod.Shop_Product_Permutation PP ON MPOPL.id_permutation = PP.id_permutation
WHERE MPOPL_T.GUID = a_guid
;
UPDATE tmp_Manufacturing_Purchase_Order_Product_Link t_MPOPL
-- INNER JOIN partsltd_prod.Shop_Manufacturing_Purchase_Order_Product_Link_Temp MPOPL_T ON t_MPOPL.id_order = MPOPL_T.id_order
LEFT JOIN partsltd_prod.Shop_Product_Permutation PP ON t_MPOPL.id_permutation = PP.id_permutation
LEFT JOIN partsltd_prod.Shop_Product P ON PP.id_product = P.id_product
LEFT JOIN partsltd_prod.Shop_Product_Category PC ON P.id_category = PC.id_category
SET
name_error = CONCAT(
CASE WHEN ISNULL(t_MPOPL.id_permutation) THEN
CASE WHEN ISNULL(PP.id_product) THEN
'(No Product Permutation)'
ELSE
CONCAT(
PC.name
, ' - '
, P.name
)
END
ELSE
fn_shop_get_product_permutation_name(PP.id_permutation)
END
, ' - x'
, IFNULL(t_MPOPL.quantity_used, '(No Quantity)')
, ' Used - x'
, IFNULL(t_MPOPL.quantity_produced, '(No Quantity)')
, ' Produced'
)
, cost_total_local_VAT_excl = t_MPOPL.quantity_used * t_MPOPL.cost_unit_local_VAT_excl
, cost_total_local_VAT_incl = t_MPOPL.quantity_used * t_MPOPL.cost_unit_local_VAT_incl
, price_total_local_VAT_excl = t_MPOPL.quantity_produced * t_MPOPL.price_unit_local_VAT_excl
, price_total_local_VAT_incl = t_MPOPL.quantity_produced * t_MPOPL.price_unit_local_VAT_incl
;
-- Insert missing order records
INSERT INTO tmp_Manufacturing_Purchase_Order (
id_order
, id_currency_cost
, id_order_temp
, id_currency
, active
, is_new
, name_error
)
SELECT
SPO_T.id_order
, IFNULL(IFNULL(SPO_T.id_currency_cost, MPO.id_currency_cost), 0) AS id_currency_cost
MPO.id_order
, MPO.id_order_temp
, MPO.id_currency
, MPO.active
, FALSE AS is_new
, CONCAT(
IFNULL(MPO.id_order, '(No Manufacturing Purchase Order)')
, ' - '
, IFNULL(MPO.id_currency, '(No Currency)')
) AS name_error
FROM partsltd_prod.Shop_Manufacturing_Purchase_Order MPO
INNER JOIN tmp_Manufacturing_Purchase_Order_Product_Link t_MPOPL
ON MPO.id_order = t_MPOPL.id_order
AND t_MPOPL.has_order = 0
;
UPDATE tmp_Manufacturing_Purchase_Order t_MPO
INNER JOIN (
SELECT
t_MPOPL.id_order
, SUM(t_MPOPL.cost_total_local_VAT_excl) AS cost_total_local_VAT_excl
, SUM(t_MPOPL.cost_total_local_VAT_incl) AS cost_total_local_VAT_incl
, SUM(t_MPOPL.price_total_local_VAT_excl) AS price_total_local_VAT_excl
, SUM(t_MPOPL.price_total_local_VAT_incl) AS price_total_local_VAT_incl
FROM tmp_Manufacturing_Purchase_Order_Product_Link t_MPOPL
GROUP BY t_MPOPL.id_order
) SUM_t_MPOPL ON t_MPO.id_order = SUM_t_MPOPL.id_order
SET
t_MPO.cost_total_local_VAT_excl = SUM_t_MPOPL.cost_total_local_VAT_excl
, t_MPO.cost_total_local_VAT_incl = SUM_t_MPOPL.cost_total_local_VAT_incl
, t_MPO.price_total_local_VAT_excl = SUM_t_MPOPL.price_total_local_VAT_excl
, t_MPO.price_total_local_VAT_incl = SUM_t_MPOPL.price_total_local_VAT_incl
;
-- Validation
-- Manufacturing Purchase Order
@@ -207,20 +308,20 @@ BEGIN
, v_code_type_error_bad_data
, CONCAT(
'A valid ID is required for the following Manufacturing Purchase Order(s): '
, GROUP_CONCAT(CONCAT(IFNULL(t_MPO.id_stock, '(No Manufacturing Purchase Order)')) SEPARATOR ', ')
, GROUP_CONCAT(t_MPO.name_error SEPARATOR ', ')
) AS msg
FROM tmp_Stock_Item t_SPO
FROM tmp_Manufacturing_Purchase_Order t_MPO
LEFT JOIN partsltd_prod.Shop_Manufacturing_Purchase_Order MPO ON t_MPO.id_order = MPO.id_order
WHERE 1=1
AND t_MPO.id_stock > 0
AND ISNULL(MPO.id_stock)
AND t_MPO.id_order > 0
AND ISNULL(MPO.id_order)
;
END IF;
# id_currency_cost
# id_currency
IF EXISTS (
SELECT *
FROM tmp_Manufacturing_Purchase_Order t_MPO
LEFT JOIN partsltd_prod.Shop_Currency C ON t_MPO.id_currency_cost = C.id_currency
LEFT JOIN partsltd_prod.Shop_Currency C ON t_MPO.id_currency = C.id_currency
WHERE 1=1
AND (
ISNULL(C.id_currency)
@@ -238,10 +339,10 @@ BEGIN
, v_code_type_error_bad_data
, CONCAT(
'A valid currency is required for the following Manufacturing Purchase Order(s): '
, GROUP_CONCAT(CONCAT(IFNULL(t_MPO.id_stock, '(No Manufacturing Purchase Order)'), ' - ', t_MPO.id_currency_cost) SEPARATOR ', ')
, GROUP_CONCAT(CONCAT(t_MPO.name_error, ' - ', t_MPO.id_currency) SEPARATOR ', ')
) AS msg
FROM tmp_Stock_Item t_SPO
LEFT JOIN partsltd_prod.Shop_Currency C ON t_MPO.id_currency_cost = C.id_currency
FROM tmp_Manufacturing_Purchase_Order t_MPO
LEFT JOIN partsltd_prod.Shop_Currency C ON t_MPO.id_currency = C.id_currency
WHERE 1=1
AND (
ISNULL(C.id_currency)
@@ -252,8 +353,8 @@ BEGIN
# id_unit_quantity
IF EXISTS (
SELECT *
FROM tmp_Manufacturing_Purchase_Order t_MPO
LEFT JOIN partsltd_prod.Shop_Unit_Measurement UM ON t_MPO.id_unit_quantity = UM.id_unit_measurement
FROM tmp_Manufacturing_Purchase_Order_Product_Link t_MPOPL
LEFT JOIN partsltd_prod.Shop_Unit_Measurement UM ON t_MPOPL.id_unit_quantity = UM.id_unit_measurement
WHERE 1=1
AND (
ISNULL(UM.id_unit_measurement)
@@ -271,10 +372,10 @@ BEGIN
, v_code_type_error_bad_data
, CONCAT(
'A valid unit measurement of quantity is required for the following Manufacturing Purchase Order(s): '
, GROUP_CONCAT(CONCAT(IFNULL(t_MPO.id_stock, '(No Manufacturing Purchase Order)'), ' - ', t_MPO.id_currency_cost) SEPARATOR ', ')
, GROUP_CONCAT(CONCAT(t_MPOPL.name_error, ' - ', t_MPO.id_unit_quantity) SEPARATOR ', ')
) AS msg
FROM tmp_Stock_Item t_SPO
LEFT JOIN partsltd_prod.Shop_Unit_Measurement UM ON t_MPO.id_unit_quantity = UM.id_unit_measurement
FROM tmp_Manufacturing_Purchase_Order_Product_Link t_MPOPL
LEFT JOIN partsltd_prod.Shop_Unit_Measurement UM ON t_MPOPL.id_unit_quantity = UM.id_unit_measurement
WHERE 1=1
AND (
ISNULL(UM.id_unit_measurement)
@@ -282,10 +383,10 @@ BEGIN
)
;
END IF;
# Invalid quantity ordered
# Invalid quantity used
IF EXISTS (
SELECT *
FROM tmp_Manufacturing_Purchase_Order_Product_Link
FROM tmp_Manufacturing_Purchase_Order_Product_Link t_MPOPL
WHERE
ISNULL(t_MPOPL.quantity_used)
OR t_MPOPL.quantity_used <= 0
@@ -297,20 +398,22 @@ BEGIN
v_id_error_type_bad_data,
v_code_error_type_bad_data,
CONCAT(
'A valid quantity ordered is required for the following Manufacturing Purchase Order Item(s): '
, GROUP_CONCAT(t_MPOPL.name_error SEPARATOR ', ')
'A valid quantity used is required for the following Manufacturing Purchase Order Item(s): '
, GROUP_CONCAT(CONCAT(t_MPOPL.name_error, ' - ', t_MPOPL.quantity_used) SEPARATOR ', ')
)
FROM tmp_Manufacturing_Purchase_Order_Product_Link t_MPOPL
WHERE
ISNULL(t_MPOPL.quantity_used)
OR t_MPOPL.quantity_used <= 0
NOT ISNULL(t_MPOPL.quantity_used)
AND t_MPOPL.quantity_used <= 0
;
END IF;
# Invalid quantity received
# Invalid quantity produced
IF EXISTS (
SELECT *
FROM tmp_Manufacturing_Purchase_Order_Product_Link
WHERE t_MPOPL.quantity_produced < 0
FROM tmp_Manufacturing_Purchase_Order_Product_Link t_MPOPL
WHERE
NOT ISNULL(t_MPOPL.quantity_produced)
AND t_MPOPL.quantity_produced < 0
) THEN
INSERT INTO tmp_Msg_Error (
id_type, code, msg
@@ -319,24 +422,24 @@ BEGIN
v_id_error_type_bad_data,
v_code_error_type_bad_data,
CONCAT(
'A valid quantity received is required for the following Manufacturing Purchase Order Item(s): '
, GROUP_CONCAT(t_MPOPL.name_error, ' - ', t_MPOPL.quantity_produced SEPARATOR ', ')
'A valid quantity produced is required for the following Manufacturing Purchase Order Item(s): '
, GROUP_CONCAT(CONCAT(t_MPOPL.name_error, ' - ', t_MPOPL.quantity_produced) SEPARATOR ', ')
)
FROM tmp_Manufacturing_Purchase_Order_Product_Link t_MPOPL
WHERE t_MPOPL.quantity_produced < 0
WHERE
NOT ISNULL(t_MPOPL.quantity_produced)
AND t_MPOPL.quantity_produced < 0
;
END IF;
# id_unit_latency_manufacture
IF EXISTS (
SELECT *
FROM tmp_Manufacturing_Purchase_Order t_MPO
LEFT JOIN partsltd_prod.Shop_Unit_Measurement UM ON t_MPO.id_unit_latency_manufacture = UM.id_unit_measurement
WHERE 1=1
AND (
NOT ISNULL(t_MPO.id_unit_latency_manufacture)
OR ISNULL(UM.id_unit_measurement)
OR UM.active = 0
)
FROM tmp_Manufacturing_Purchase_Order_Product_Link t_MPOPL
LEFT JOIN partsltd_prod.Shop_Unit_Measurement UM ON t_MPOPL.id_unit_latency_manufacture = UM.id_unit_measurement
WHERE
ISNULL(t_MPOPL.id_unit_latency_manufacture)
OR ISNULL(UM.id_unit_measurement)
OR UM.active = 0
LIMIT 1
) THEN
INSERT INTO tmp_Msg_Error (
@@ -349,22 +452,20 @@ BEGIN
, v_code_type_error_bad_data
, CONCAT(
'A valid unit measurement of manufacture latency is required for the following Manufacturing Purchase Order(s): '
, GROUP_CONCAT(CONCAT(IFNULL(t_MPO.id_stock, '(No Manufacturing Purchase Order)'), ' - ', t_MPO.id_unit_latency_manufacture) SEPARATOR ', ')
, GROUP_CONCAT(CONCAT(t_MPOPL.name_error, ' - ', t_MPOPL.id_unit_latency_manufacture) SEPARATOR ', ')
) AS msg
FROM tmp_Stock_Item t_SPO
LEFT JOIN partsltd_prod.Shop_Unit_Measurement UM ON t_MPO.id_unit_latency_manufacture = UM.id_unit_measurement
WHERE 1=1
AND (
NOT ISNULL(t_MPO.id_unit_latency_manufacture)
OR ISNULL(UM.id_unit_measurement)
OR UM.active = 0
)
FROM tmp_Manufacturing_Purchase_Order_Product_Link t_MPOPL
LEFT JOIN partsltd_prod.Shop_Unit_Measurement UM ON t_MPOPL.id_unit_latency_manufacture = UM.id_unit_measurement
WHERE
ISNULL(t_MPOPL.id_unit_latency_manufacture)
OR ISNULL(UM.id_unit_measurement)
OR UM.active = 0
;
END IF;
# Invalid manufacture latency
IF EXISTS (
SELECT *
FROM tmp_Manufacturing_Purchase_Order_Product_Link
FROM tmp_Manufacturing_Purchase_Order_Product_Link t_MPOPL
WHERE t_MPOPL.latency_manufacture < 0
) THEN
INSERT INTO tmp_Msg_Error (
@@ -375,13 +476,111 @@ BEGIN
v_code_error_type_bad_data,
CONCAT(
'A valid manufacture latency is required for the following Manufacturing Purchase Order Item(s): '
, GROUP_CONCAT(t_MPOPL.name_error, ' - ', t_MPOPL.latency_manufacture SEPARATOR ', ')
, GROUP_CONCAT(CONCAT(t_MPOPL.name_error, ' - ', t_MPOPL.latency_manufacture) SEPARATOR ', ')
)
FROM tmp_Manufacturing_Purchase_Order_Product_Link t_MPOPL
WHERE t_MPOPL.latency_manufacture < 0
;
END IF;
# Invalid costs excl VAT
IF EXISTS (
SELECT *
FROM tmp_Manufacturing_Purchase_Order_Product_Link t_MPOPL
WHERE
NOT ISNULL(t_MPOPL.cost_unit_local_VAT_excl)
AND t_MPOPL.cost_unit_local_VAT_excl < 0
) THEN
INSERT INTO tmp_Msg_Error (
id_type, code, msg
)
SELECT
v_id_error_type_bad_data,
v_code_error_type_bad_data,
CONCAT(
'A valid cost excluding VAT is required for the following Manufacturing Purchase Order Item(s): '
, GROUP_CONCAT(CONCAT(t_MPOPL.name_error, ' - ', t_MPOPL.cost_unit_local_VAT_excl) SEPARATOR ', ')
)
FROM tmp_Manufacturing_Purchase_Order_Product_Link t_MPOPL
WHERE
NOT ISNULL(t_MPOPL.cost_unit_local_VAT_excl)
AND t_MPOPL.cost_unit_local_VAT_excl < 0
;
END IF;
# Invalid costs incl VAT
IF EXISTS (
SELECT *
FROM tmp_Manufacturing_Purchase_Order_Product_Link t_MPOPL
WHERE
NOT ISNULL(t_MPOPL.cost_unit_local_VAT_incl)
AND t_MPOPL.cost_unit_local_VAT_incl < 0
) THEN
INSERT INTO tmp_Msg_Error (
id_type, code, msg
)
SELECT
v_id_error_type_bad_data,
v_code_error_type_bad_data,
CONCAT(
'A valid cost including VAT is required for the following Manufacturing Purchase Order Item(s): '
, GROUP_CONCAT(CONCAT(t_MPOPL.name_error, ' - ', t_MPOPL.cost_unit_local_VAT_incl) SEPARATOR ', ')
)
FROM tmp_Manufacturing_Purchase_Order_Product_Link t_MPOPL
WHERE
NOT ISNULL(t_MPOPL.cost_unit_local_VAT_incl)
AND t_MPOPL.cost_unit_local_VAT_incl < 0
;
END IF;
# Invalid prices excl VAT
IF EXISTS (
SELECT *
FROM tmp_Manufacturing_Purchase_Order_Product_Link t_MPOPL
WHERE
NOT ISNULL(t_MPOPL.price_unit_local_VAT_excl)
AND t_MPOPL.price_unit_local_VAT_excl < 0
) THEN
INSERT INTO tmp_Msg_Error (
id_type, code, msg
)
SELECT
v_id_error_type_bad_data,
v_code_error_type_bad_data,
CONCAT(
'A valid price excluding VAT is required for the following Manufacturing Purchase Order Item(s): '
, GROUP_CONCAT(CONCAT(t_MPOPL.name_error, ' - ', t_MPOPL.price_unit_local_VAT_excl) SEPARATOR ', ')
)
FROM tmp_Manufacturing_Purchase_Order_Product_Link t_MPOPL
WHERE
NOT ISNULL(t_MPOPL.price_unit_local_VAT_excl)
AND t_MPOPL.price_unit_local_VAT_excl < 0
;
END IF;
# Invalid prices incl VAT
IF EXISTS (
SELECT *
FROM tmp_Manufacturing_Purchase_Order_Product_Link t_MPOPL
WHERE
NOT ISNULL(t_MPOPL.price_unit_local_VAT_incl)
AND t_MPOPL.price_unit_local_VAT_incl < 0
) THEN
INSERT INTO tmp_Msg_Error (
id_type, code, msg
)
SELECT
v_id_error_type_bad_data,
v_code_error_type_bad_data,
CONCAT(
'A valid price including VAT is required for the following Manufacturing Purchase Order Item(s): '
, GROUP_CONCAT(CONCAT(t_MPOPL.name_error, ' - ', t_MPOPL.price_unit_local_VAT_incl) SEPARATOR ', ')
)
FROM tmp_Manufacturing_Purchase_Order_Product_Link t_MPOPL
WHERE
NOT ISNULL(t_MPOPL.price_unit_local_VAT_incl)
AND t_MPOPL.price_unit_local_VAT_incl < 0
;
END IF;
-- Duplicates
IF EXISTS (
SELECT
@@ -398,7 +597,7 @@ BEGIN
SELECT
v_id_error_type_bad_data,
v_code_error_type_bad_data,
CONCAT('Duplicate records: ', GROUP_CONCAT(t_SPOPLC.name_error SEPARATOR ', '))
CONCAT('Duplicate records: ', GROUP_CONCAT(t_MPOPLC.name_error SEPARATOR ', '))
FROM (
SELECT
id_permutation
@@ -407,7 +606,7 @@ BEGIN
FROM tmp_Manufacturing_Purchase_Order_Product_Link t_MPOPL
GROUP BY id_permutation
HAVING COUNT(*) > 1
) t_SPOPLC
) t_MPOPLC
;
END IF;
-- Empty Manufacturing Purchase Order
@@ -468,7 +667,10 @@ BEGIN
, v_ids_product_permission -- ids_product
, 0 -- a_debug
;
SELECT * from partsltd_prod.Shop_Calc_User_Temp;
SELECT *
FROM partsltd_prod.Shop_Calc_User_Temp
WHERE GUID = a_guid
;
END IF;
CALL p_shop_calc_user(
@@ -485,7 +687,7 @@ BEGIN
SELECT * from partsltd_prod.Shop_Calc_User_Temp WHERE GUID = a_guid;
END IF;
IF NOT EXISTS (SELECT can_view FROM partsltd_prod.Shop_Calc_User_Temp UE_T WHERE UE_T.GUID = a_guid) THEN
IF EXISTS (SELECT * FROM partsltd_prod.Shop_Calc_User_Temp UE_T WHERE UE_T.GUID = a_guid AND IFNULL(UE_T.can_view, 0) = 0) THEN
DELETE FROM tmp_Msg_Error;
INSERT INTO tmp_Msg_Error (
@@ -493,18 +695,94 @@ BEGIN
, code
, msg
)
VALUES (
SELECT
v_id_type_error_no_permission
, v_code_type_error_no_permission
, CONCAT('You do not have view permissions for ', (SELECT name FROM partsltd_prod.Shop_Permission WHERE id_permission = v_id_permission_manufacturing LIMIT 1))
)
, CONCAT(
'You do not have view permissions for '
, GROUP_CONCAT(name SEPARATOR ', ')
)
FROM partsltd_prod.Shop_Permission PERM
INNER JOIN partsltd_prod.Shop_Calc_User_Temp UE_T
ON PERM.id_permission = UE_T.id_permission
AND UE_T.GUID = a_guid
AND IFNULL(UE_T.can_view, 0) = 0
;
END IF;
CALL partsltd_prod.p_shop_clear_calc_user( a_guid );
CALL partsltd_prod.p_shop_clear_calc_user(
a_guid
, 0 -- a_debug
);
-- Changed quantity used
IF EXISTS (
SELECT *
FROM tmp_Manufacturing_Purchase_Order_Product_Link t_MPOPL
INNER JOIN partsltd_prod.Shop_Manufacturing_Purchase_Order_Product_Link MPOPL ON t_MPOPL.id_link = MPOPL.id_link
INNER JOIN partsltd_prod.Shop_Stock_Item SI ON MPOPL.id_permutation = SI.id_permutation
WHERE
t_MPOPL.is_new = 0
AND t_MPOPL.quantity_used <> MPOPL.quantity_used
) THEN
INSERT INTO tmp_Msg_Error (
id_type
, code
, msg
)
SELECT
v_id_type_error_warning
, v_code_type_error_warning
, CONCAT(
'The quantity used has changed on the following orders. Please update the stock items appropriately.'
, GROUP_CONCAT(
CONCAT(
t_MPOPL.name_error
, ' - from '
, MPOPL.quantity_used
, ' to '
, t_MPOPL.quantity_used
) SEPARATOR ', '
)
) AS msg
;
END IF;
-- Changed quantity produced
IF EXISTS (
SELECT *
FROM tmp_Manufacturing_Purchase_Order_Product_Link t_MPOPL
INNER JOIN partsltd_prod.Shop_Manufacturing_Purchase_Order_Product_Link MPOPL ON t_MPOPL.id_link = MPOPL.id_link
INNER JOIN partsltd_prod.Shop_Stock_Item SI ON MPOPL.id_permutation = SI.id_permutation
WHERE
t_MPOPL.is_new = 0
AND t_MPOPL.quantity_produced <> MPOPL.quantity_produced
) THEN
INSERT INTO tmp_Msg_Error (
id_type
, code
, msg
)
SELECT
v_id_type_error_warning
, v_code_type_error_warning
, CONCAT(
'The quantity produced has changed on the following orders. Please update the stock items appropriately.'
, GROUP_CONCAT(
CONCAT(
t_MPOPL.name_error
, ' - from '
, MPOPL.quantity_produced
, ' to '
, t_MPOPL.quantity_produced
) SEPARATOR ', '
)
) AS msg
;
END IF;
IF EXISTS ( SELECT * FROM tmp_Msg_Error LIMIT 1 ) THEN
DELETE FROM tmp_Manufacturing;
IF EXISTS ( SELECT * FROM tmp_Msg_Error WHERE id_type <> v_id_type_error_warning LIMIT 1 ) THEN
DELETE FROM tmp_Manufacturing_Purchase_Order_Product_Link;
DELETE FROM tmp_Manufacturing_Purchase_Order;
END IF;
-- Transaction
@@ -524,31 +802,50 @@ BEGIN
SET v_id_change_set := LAST_INSERT_ID();
INSERT INTO partsltd_prod.Shop_Manufacturing_Purchase_Order (
id_currency_cost
id_order_temp
, id_currency
, cost_total_local_VAT_excl
, cost_total_local_VAT_incl
, price_total_local_VAT_excl
, price_total_local_VAT_incl
, active
, created_by
, created_on
, id_change_set
, active
)
SELECT
t_MPO.id_currency_cost
, SUM(t_MPOPL.cost_total_local_VAT_excl)
, SUM(t_MPOPL.cost_total_local_VAT_incl)
t_MPO.id_order_temp
, t_MPO.id_currency
, t_MPO.cost_total_local_VAT_excl
, t_MPO.cost_total_local_VAT_incl
, t_MPO.price_total_local_VAT_excl
, t_MPO.price_total_local_VAT_incl
, t_MPO.active
, a_id_user
, v_time_start
, v_id_change_set
FROM tmp_Manufacturing_Purchase_Order t_MPO
INNER JOIN tmp_Manufacturing_Purchase_Order_Product_Link t_MPOPL ON t_MPO.id_order = t_MPOPL.id_order
WHERE t_MPOPL.is_new = 1
WHERE t_MPO.is_new = 1
;
UPDATE tmp_Manufacturing_Purchase_Order t_MPO
INNER JOIN partsltd_prod.Shop_Manufacturing_Purchase_Order MPO ON t_MPO.id_order_temp = MPO.id_order_temp
SET
t_MPO.id_order = MPO.id_order
WHERE t_MPO.is_new = 1
;
UPDATE tmp_Manufacturing_Purchase_Order_Product_Link t_MPOPL
INNER JOIN tmp_Manufacturing_Purchase_Order t_MPO ON t_MPOPL.id_order = t_MPO.id_order_temp
SET
t_MPOPL.id_order = t_MPO.id_order
WHERE t_MPO.is_new = 1
;
INSERT INTO Shop_Manufacturing_Purchase_Order_Product_Link (
id_order
, id_permutation
, id_currency_cost
, id_unit_quantity
, quantity_used
, quantity_produced
@@ -556,15 +853,17 @@ BEGIN
, latency_manufacture
, display_order
, active
, cost_total_local_VAT_excl
, cost_total_local_VAT_incl
, cost_unit_local_VAT_excl
, cost_unit_local_VAT_incl
, price_unit_local_VAT_excl
, price_unit_local_VAT_incl
, created_by
, created_on
, id_change_set
)
SELECT
t_MPOPL.id_order
, t_MPOPL.id_permutation
, t_MPOPL.id_currency_cost
, t_MPOPL.id_unit_quantity
, t_MPOPL.quantity_used
, t_MPOPL.quantity_produced
@@ -572,9 +871,12 @@ BEGIN
, t_MPOPL.latency_manufacture
, t_MPOPL.display_order
, t_MPOPL.active
, t_MPOPL.cost_total_local_VAT_excl
, t_MPOPL.cost_total_local_VAT_incl
, t_MPOPL.cost_unit_local_VAT_excl
, t_MPOPL.cost_unit_local_VAT_incl
, t_MPOPL.price_unit_local_VAT_excl
, t_MPOPL.price_unit_local_VAT_incl
, a_id_user
, v_time_start
, v_id_change_set
FROM tmp_Manufacturing_Purchase_Order_Product_Link t_MPOPL
WHERE t_MPOPL.is_new = 1
@@ -586,10 +888,12 @@ BEGIN
AND t_MPO.is_new = 0
INNER JOIN tmp_Manufacturing_Purchase_Order_Product_Link t_MPOPL ON t_MPO.id_order = t_MPOPL.id_order
SET
MPO.id_currency_cost = id_currency_cost
, MPO.cost_total_local_VAT_excl = SUM(t_MPOPL.cost_total_local_VAT_excl)
, MPO.cost_total_local_VAT_incl = SUM(t_MPOPL.cost_total_local_VAT_incl)
, MPO.active = a_active
MPO.id_currency = t_MPO.id_currency
, MPO.cost_total_local_VAT_excl = t_MPO.cost_total_local_VAT_excl
, MPO.cost_total_local_VAT_incl = t_MPO.cost_total_local_VAT_incl
, MPO.price_total_local_VAT_excl = t_MPO.price_total_local_VAT_excl
, MPO.price_total_local_VAT_incl = t_MPO.price_total_local_VAT_incl
, MPO.active = t_MPO.active
, MPO.id_change_set = v_id_change_set
;
@@ -600,7 +904,6 @@ BEGIN
SET
MPOPL.id_order = t_MPOPL.id_order
, MPOPL.id_permutation = t_MPOPL.id_permutation
, MPOPL.id_currency_cost = t_MPOPL.id_currency_cost
, MPOPL.id_unit_quantity = t_MPOPL.id_unit_quantity
, MPOPL.quantity_used = t_MPOPL.quantity_used
, MPOPL.quantity_produced = t_MPOPL.quantity_produced
@@ -608,18 +911,20 @@ BEGIN
, MPOPL.latency_manufacture = t_MPOPL.latency_manufacture
, MPOPL.display_order = t_MPOPL.display_order
, MPOPL.active = t_MPOPL.active
, MPOPL.cost_total_local_VAT_excl = t_MPOPL.cost_total_local_VAT_excl
, MPOPL.cost_total_local_VAT_incl = t_MPOPL.cost_total_local_VAT_incl
, MPOPL.cost_unit_local_VAT_excl = t_MPOPL.cost_unit_local_VAT_excl
, MPOPL.cost_unit_local_VAT_incl = t_MPOPL.cost_unit_local_VAT_incl
, MPOPL.price_unit_local_VAT_excl = t_MPOPL.price_unit_local_VAT_excl
, MPOPL.price_unit_local_VAT_incl = t_MPOPL.price_unit_local_VAT_incl
, MPOPL.id_change_set = v_id_change_set
;
DELETE SPO_T
FROM Shop_Manufacturing_Purchase_Order_Temp SPO_T
WHERE SPO_T.GUID = a_guid
DELETE MPO_T
FROM partsltd_prod.Shop_Manufacturing_Purchase_Order_Temp MPO_T
WHERE MPO_T.GUID = a_guid
;
DELETE SPOPL_T
FROM Shop_Manufacturing_Purchase_Order_Product_Link_Temp SPOPL_T
WHERE SPOPL_T.GUID = a_guid
DELETE MPOPL_T
FROM partsltd_prod.Shop_Manufacturing_Purchase_Order_Product_Link_Temp MPOPL_T
WHERE MPOPL_T.GUID = a_guid
;
COMMIT;
@@ -661,7 +966,7 @@ INSERT INTO Shop_Manufacturing_Purchase_Order_Product_Link_Temp (
id_order,
id_permutation,
cost_total_local,
id_currency_cost,
id_currency,
quantity_used,
id_unit_quantity,
quantity_produced,
@@ -676,7 +981,7 @@ VALUES
-1, # id_order,
1, # id_permutation,
100, # cost_total_local,
1, # id_currency_cost,
1, # id_currency,
1, # quantity_used,
1, # id_unit_quantity,
1, # quantity_produced,

View File

@@ -332,7 +332,7 @@ BEGIN
) AS name
FROM tmp_Manufacturing_Purchase_Order t_MPO
INNER JOIN partsltd_prod.Shop_Manufacturing_Purchase_Order MPO ON MPO.id_order = t_MPO.id_order
LEFT JOIN partsltd_prod.Shop_Currency C ON MPO.id_currency_cost = C.id_currency
LEFT JOIN partsltd_prod.Shop_Currency C ON MPO.id_currency = C.id_currency
;
# Manufacturing Purchase Order Product Link
@@ -380,7 +380,6 @@ END //
DELIMITER ;;
/*
CALL p_shop_get_many_manufacturing_purchase_order (
1 # a_id_user
@@ -393,4 +392,5 @@ CALL p_shop_get_many_manufacturing_purchase_order (
, 0 # a_debug
);
/*
*/

View File

@@ -251,10 +251,11 @@ VALUES
# Product Permutations
INSERT INTO Shop_Product_Permutation (
display_order,
-- display_order,
id_product,
description,
cost_local,
cost_local_VAT_excl,
cost_local_VAT_incl,
id_currency_cost,
profit_local_min,
# id_currency_profit_min,
@@ -275,10 +276,11 @@ INSERT INTO Shop_Product_Permutation (
)
VALUES
(
1,
-- 1,
1,
'Good Red',
5,
6,
1,
3,
# 1,
@@ -298,10 +300,11 @@ VALUES
, NULL
),
(
2,
-- 2,
1,
'Good Blue',
6,
7.2,
1,
4,
# 1,
@@ -321,10 +324,11 @@ VALUES
, NULL
),
(
3,
-- 3,
2,
'Test product describes good',
10,
12,
1,
5,
# 1,
@@ -344,10 +348,11 @@ VALUES
, NULL
),
(
4,
-- 4,
3,
'Phone describes good',
10,
12,
1,
5,
# 1,
@@ -367,10 +372,11 @@ VALUES
, NULL
),
(
5,
-- 5,
4,
'Laptop describes good',
10,
12,
1,
5,
# 1,
@@ -390,10 +396,11 @@ VALUES
, NULL
),
(
6,
-- 6,
5,
'Smart watch describes good',
10,
12,
1,
5,
# 1,
@@ -742,6 +749,18 @@ VALUES
, 'https://www.maltkilnfarmshop.co.uk/'
, 1
)
, (
-3
, 'Asda'
, NULL
, NULL
-- , 1
, ''
, NULL
, ''
, ''
, 1
)
;
# Supplier Addresses

View File

@@ -187,6 +187,7 @@
7204_p_shop_get_many_product.sql
7205_p_shop_get_many_stripe_product_new.sql
7206_p_shop_save_product_permutation.sql
7206_p_shop_save_product_permutation_test.sql
7210_p_shop_get_many_product_variation.sql
7219_p_shop_get_many_stock_item.sql
7220_p_shop_save_stock_item.sql
@@ -203,6 +204,7 @@
7403_p_shop_save_supplier_purchase_order_test.sql
7404_p_shop_get_many_supplier_purchase_order.sql
7415_p_shop_save_manufacturing_purchase_order.sql
7415_p_shop_save_Manufacturing_purchase_order_test.sql
7416_p_shop_get_many_manufacturing_purchase_order.sql
7421_p_shop_save_customer.sql
7422_p_shop_get_many_customer.sql

View File

@@ -39,7 +39,6 @@ tr {
min-height: 1px;
border-bottom: 1px solid var(--c_purple_dark);
border-top: 1px solid var(--c_purple_dark);
padding-bottom: 1vh;
background-color: transparent;
}

View File

@@ -12,4 +12,8 @@ form.filter button.save, form.filter button.button-cancel {
form.filter button.save, form.filter button.button-cancel {
margin-top: 0;
margin-bottom: 0;
}
#formFilters .container-input.filter.active {
width: 8vh;
}

View File

@@ -1,7 +1,8 @@
#tableMain {
overflow-x: auto;
padding: 1vh 2vh;
max-width: min(calc(1vh * 80), calc(1vw * 90));
max-width: 95vw; /* min(calc(1vh * 80), calc(1vw * 90)); */
width: fit-content;
margin: 1vh 2vh;
align-items: normal;
@@ -12,4 +13,12 @@
width: 20vh;
min-width: 20vh;
padding: 0 0.5vh;
}
#tableMain thead tr th.active, #tableMain tbody tr td.active {
width: 6vh;
min-width: 6vh;
}
#tableMain tbody tr td.display_order, #tableMain thead tr th.display_order {
width: 5vh;
min-width: 5vh;
}

View File

@@ -1,6 +1,6 @@
#formFilters {
width: 50vh;
width: 100vh;
}
#formFilters .container-input.filter.active {
@@ -11,6 +11,71 @@
width: 8vh;
}
#tableMain tbody tr td.cost_total_local_vat_excl, #tableMain thead tr th.cost_total_local_vat_excl,
#tableMain tbody tr td.cost_total_local_vat_incl, #tableMain thead tr th.cost_total_local_vat_incl {
width: 10vh;
min-width: 10vh;
}
#tableMain thead tr th.order_items.collapsed,
#tableMain tbody tr td.order_items.collapsed {
width: 15vh;
min-width: 15vh;
}
#tableMain:has(tbody tr td.order_items table thead tr th.product_variations.collapsed) thead tr th.order_items,
#tableMain:has(tbody tr td.order_items table thead tr th.product_variations.collapsed) tbody tr td.order_items {
width: 100vh; /* 95vh */
min-width: 100vh;
}
#tableMain thead tr th.order_items,
#tableMain tbody tr td.order_items {
width: 110vh;
min-width: 110vh;
}
#tableMain tbody tr td.order_items table thead tr th, #tableMain tbody tr td.order_items table tbody tr td {
width: 12vh;
min-width: 12vh;
}
#tableMain tbody tr td.order_items table thead tr th.display_order, #tableMain tbody tr td.order_items table tbody tr td.display_order {
width: 5vh;
min-width: 5vh;
}
#tableMain tbody tr td.order_items table thead tr th.id_unit_measurement_quantity, #tableMain tbody tr td.order_items table tbody tr td.id_unit_measurement_quantity,
#tableMain tbody tr td.order_items table thead tr th.unit_measurement_latency_manufacture, #tableMain tbody tr td.order_items table tbody tr td.unit_measurement_latency_manufacture {
width: 6vh;
min-width: 6vh;
}
#tableMain tbody tr td.order_items table thead tr th.product_variations.collapsed, #tableMain tbody tr td.order_items table tbody tr td.product_variations.collapsed {
width: 10vh;
min-width: 10vh;
}
#tableMain tbody tr td.order_items table thead tr th.product_variations, #tableMain tbody tr td.order_items table tbody tr td.product_variations {
width: 20vh;
min-width: 20vh;
}
#tableMain tbody tr td.order_items table tbody tr td.product_variations table thead tr th, #tableMain tbody tr td.order_items table tbody tr td.product_variations table tbody tr td {
width: 8vh;
min-width: 8vh;
}
#tableMain tbody tr td.order_items table tbody tr td.product_variations table thead tr th:last-of-type, #tableMain tbody tr td.order_items table tbody tr td.product_variations table tbody tr td:last-of-type {
width: 4vh;
min-width: 4vh;
}
#tableMain tbody tr td.order_items table thead tr th.quantity_used, #tableMain tbody tr td.order_items table tbody tr td.quantity_used,
#tableMain tbody tr td.order_items table thead tr th.quantity_produced, #tableMain tbody tr td.order_items table tbody tr td.quantity_produced,
#tableMain tbody tr td.order_items table thead tr th.latency_manufacture, #tableMain tbody tr td.order_items table tbody tr td.latency_manufacture {
width: 8vh;
min-width: 8vh;
}
#tableMain tbody tr td.order_items table thead tr th.active, #tableMain tbody tr td.order_items table tbody tr td.active,
#tableMain tbody tr td.order_items table thead tr th.add, #tableMain tbody tr td.order_items table tbody tr td.delete {
width: 4vh;
min-width: 4vh;
}
#tableMain thead tr th.currency.collapsed, #tableMain tbody tr td.currency.collapsed {
width: 9vh;
min-width: 9vh;
@@ -26,13 +91,4 @@
#tableMain tbody tr td.price_total_local_vat_incl, #tableMain thead tr th.price_total_local_vat_incl {
width: 5vh;
min-width: 5vh;
}
#tableMain tbody tr td.items, #tableMain thead tr th.items {
width: 40vh;
min-width: 40vh;
}
#tableMain tbody tr td.active, #tableMain thead tr th.active {
width: 5vh;
min-width: 5vh;
}
}

View File

@@ -41,22 +41,22 @@
}
#tableMain:has(tbody tr td.order_items table thead tr th.product_variations.collapsed) thead tr th.order_items,
#tableMain:has(tbody tr td.order_items table thead tr th.product_variations.collapsed) tbody tr td.order_items {
width: 91vh;
min-width: 91vh;
width: 126vh;
min-width: 126vh;
}
#tableMain thead tr th.order_items,
#tableMain tbody tr td.order_items {
width: 101vh;
min-width: 101vh;
width: 136vh;
min-width: 136vh;
}
#tableMain tbody tr td.order_items table thead tr th, #tableMain tbody tr td.order_items table tbody tr td {
width: 12vh;
min-width: 12vh;
}
#tableMain tbody tr td.order_items table thead tr th.display_order, #tableMain tbody tr td.order_items table tbody tr td.display_order,
#tableMain tbody tr td.order_items table thead tr th.id_unit_measurement_quantity, #tableMain tbody tr td.order_items table tbody tr td.id_unit_measurement_quantity {
width: 6vh;
min-width: 6vh;
#tableMain tbody tr td.order_items table thead tr th.add, #tableMain tbody tr td.order_items table tbody tr td.delete {
width: 5vh;
min-width: 5vh;
}
#tableMain tbody tr td.order_items table thead tr th.product_variations.collapsed, #tableMain tbody tr td.order_items table tbody tr td.product_variations.collapsed {
@@ -76,8 +76,16 @@
min-width: 4vh;
}
#tableMain tbody tr td.order_items table thead tr th.id_unit_measurement_quantity, #tableMain tbody tr td.order_items table tbody tr td.id_unit_measurement_quantity {
width: 6vh;
min-width: 6vh;
}
#tableMain tbody tr td.order_items table thead tr th.quantity_ordered, #tableMain tbody tr td.order_items table tbody tr td.quantity_ordered,
#tableMain tbody tr td.order_items table thead tr th.quantity_received, #tableMain tbody tr td.order_items table tbody tr td.quantity_received,
#tableMain tbody tr td.order_items table thead tr th.cost_total_local_vat_excl, #tableMain tbody tr td.order_items table tbody tr td.cost_total_local_vat_excl,
#tableMain tbody tr td.order_items table thead tr th.cost_total_local_vat_incl, #tableMain tbody tr td.order_items table tbody tr td.cost_total_local_vat_incl,
#tableMain tbody tr td.order_items table thead tr th.cost_unit_local_vat_excl, #tableMain tbody tr td.order_items table tbody tr td.cost_unit_local_vat_excl,
#tableMain tbody tr td.order_items table thead tr th.cost_unit_local_vat_incl, #tableMain tbody tr td.order_items table tbody tr td.cost_unit_local_vat_incl,
#tableMain tbody tr td.order_items table thead tr th.latency_delivery_days, #tableMain tbody tr td.order_items table tbody tr td.latency_delivery_days {
width: 8vh;
min-width: 8vh;

View File

@@ -50,4 +50,7 @@
/* Right column */
.rightcolumn {
min-width: fit-content;
}
}
/* Main Table */

View File

@@ -645,7 +645,6 @@ tr {
min-height: 1px;
border-bottom: 1px solid var(--c_purple_dark);
border-top: 1px solid var(--c_purple_dark);
padding-bottom: 1vh;
background-color: transparent;
}
@@ -691,10 +690,15 @@ form.filter button.save, form.filter button.button-cancel {
margin-bottom: 0;
}
#formFilters .container-input.filter.active {
width: 8vh;
}
#tableMain {
overflow-x: auto;
padding: 1vh 2vh;
max-width: min(calc(1vh * 80), calc(1vw * 90));
max-width: 95vw; /* min(calc(1vh * 80), calc(1vw * 90)); */
width: fit-content;
margin: 1vh 2vh;
align-items: normal;
@@ -706,6 +710,14 @@ form.filter button.save, form.filter button.button-cancel {
min-width: 20vh;
padding: 0 0.5vh;
}
#tableMain thead tr th.active, #tableMain tbody tr td.active {
width: 6vh;
min-width: 6vh;
}
#tableMain tbody tr td.display_order, #tableMain thead tr th.display_order {
width: 5vh;
min-width: 5vh;
}

View File

@@ -52,3 +52,7 @@
min-width: fit-content;
}
/* Main Table */

View File

@@ -52,6 +52,10 @@
min-width: fit-content;
}
/* Main Table */
#formFilters {
width: 50vh;
}

View File

@@ -52,6 +52,10 @@
min-width: fit-content;
}
/* Main Table */
#formFilters {
width: 50vh;
}

View File

@@ -52,6 +52,10 @@
min-width: fit-content;
}
/* Main Table */
th, td {
min-width: fit-content;
}

File diff suppressed because one or more lines are too long

View File

@@ -22,8 +22,6 @@ export default class API {
options.body = JSON.stringify(data);
}
console.log('API request:', method, url, data);
try {
const response = await fetch(url, options);
if (!response.ok) {
@@ -38,10 +36,7 @@ export default class API {
static getUrlFromHash(hash, params = null) {
if (hash == null) hash = hashPageHome;
console.log("getUrlFromHash:");
console.log("base url: " + _pathHost + "\nhash: " + hash + '\nparams: ' + params);
let url = API.parameteriseUrl(_pathHost + hash, params);
console.log("url: " + url);
return url;
}
static parameteriseUrl(url, params) {

View File

@@ -48,7 +48,6 @@ class App {
handleGlobalClick(event) {
// Handle global click events
console.log('Global click:', event.target);
}
start() {

View File

@@ -3,14 +3,12 @@
function handleSelectCollapse(elementSelect) {
let optionSelected = document.querySelectorAll(elementSelect).querySelector('option:selected');
optionSelected.text(optionSelected.getAttribute(attrTextCollapsed));
console.log('collapsed: ', optionSelected.text());
optionSelected.classList.remove(flagExpanded);
optionSelected.classList.add(flagCollapsed);
}
function handleSelectExpand(elementSelect) {
let optionSelected = document.querySelectorAll(elementSelect).querySelector('option:selected');
optionSelected.text(optionSelected.getAttribute(attrTextExpanded));
console.log('expanded: ', optionSelected.text());
optionSelected.classList.remove(flagCollapsed);
optionSelected.classList.add(flagExpanded);
}

View File

@@ -54,11 +54,9 @@ export default class DOM {
static convertForm2JSON(elementForm) {
let dataForm = {};
if (Validation.isEmpty(elementForm)) {
console.log("empty form element");
return dataForm;
}
let containersFilter = elementForm.querySelectorAll('.' + flagContainerInput + '.' + flagFilter);
console.log("containersFilter: " + containersFilter);
let containerFilter, labelFilter, keyFilter, filter;
for (let indexFilter = 0; indexFilter < containersFilter.length; indexFilter++) {
containerFilter = containersFilter[indexFilter];

View File

@@ -11,7 +11,7 @@ export default class BusinessObjects {
static getOptionJsonFromObjectJson(objectJson, valueSelected = null) {
let keyText = objectJson[flagNameAttrOptionText];
let keyValue = objectJson[flagNameAttrOptionValue];
console.log({objectJson, keyText, keyValue});
if (_verbose) { console.log({objectJson, keyText, keyValue}); };
return BusinessObjects.getOptionJsonFromObjectJsonAndKeys(objectJson, keyText, keyValue, valueSelected);
}
/*

View File

@@ -3,4 +3,3 @@ const _dataLoadingFlag = 'data-loading'
var _domParser = null;
// var hashPageCurrent; // moved to layout
const keyPublicStripe = 'pk_test_51OGrxlL7BuLKjoMpfpfw7bSmZZK1MhqMoQ5VhW2jUj7YtoEejO4vqnxKPiqTHHuh9U4qqkywbPCSI9TpFKtr4SYH007KHMWs68';
var _verbose = true;

View File

@@ -14,7 +14,7 @@ export default class BasePage {
throw new Error("Router is required");
}
else {
console.log("initialising with router: ", router);
if (_verbose) { console.log("initialising with router: ", router); }
}
this.router = router;
this.title = titlePageCurrent;
@@ -38,7 +38,7 @@ export default class BasePage {
}
logInitialisation() {
console.log('Initializing ' + this.title + ' page');
if (_verbose) { console.log('Initializing ' + this.title + ' page'); }
}
hookupCommonElements() {
@@ -189,7 +189,7 @@ export default class BasePage {
Events.initialiseEventHandler('form.' + flagFilter + ' button.' + flagSave, flagInitialised, (button) => {
button.addEventListener("click", (event) => {
event.stopPropagation();
console.log('saving page: ', this.title);
if (_verbose) { console.log('saving page: ', this.title); }
OverlayConfirm.show();
});
// button.classList.add(flagCollapsed);
@@ -204,7 +204,7 @@ export default class BasePage {
}
leave() {
console.log('Leaving ' + this.title + ' page');
if (_verbose) { console.log('Leaving ' + this.title + ' page'); }
if (this.constructor === BasePage) {
throw new Error("Must implement leave() method.");
}
@@ -222,11 +222,11 @@ export default class BasePage {
if (show) {
buttonCancel.classList.remove(flagCollapsed);
buttonSave.classList.remove(flagCollapsed);
console.log('showing buttons');
if (_verbose) { console.log('showing buttons'); }
} else {
buttonCancel.classList.add(flagCollapsed);
buttonSave.classList.add(flagCollapsed);
console.log('hiding buttons');
if (_verbose) { console.log('hiding buttons'); }
}
}

View File

@@ -134,7 +134,7 @@ export default class TableBasePage extends BasePage {
let filtersJson = DOM.convertForm2JSON(formFilters);
this.callFilterTableContent(filtersJson)
.then(data => {
console.log('Table data received:', data);
if (_verbose) { console.log('Table data received:', data); }
this.callbackLoadTableContent(data);
})
.catch(error => console.error('Error:', error));
@@ -156,12 +156,14 @@ export default class TableBasePage extends BasePage {
this.callSaveTableContent(records, formElement, comment)
.then(data => {
if (data[flagStatus] == flagSuccess) {
console.log('Records saved!');
console.log('Data received:', data);
if (_verbose) {
console.log('Records saved!');
console.log('Data received:', data);
}
this.getAndLoadFilteredTableContent();
}
else {
console.log("error: ", data[flagMessage]);
if (_verbose) { console.log("error: ", data[flagMessage]); }
OverlayError.show(data[flagMessage]);
}
})
@@ -192,12 +194,14 @@ export default class TableBasePage extends BasePage {
this.callSaveTableContent(records, formElement, comment)
.then(data => {
if (data[flagStatus] == flagSuccess) {
console.log('Records saved!');
console.log('Data received:', data);
if (_verbose) {
console.log('Records saved!');
console.log('Data received:', data);
}
this.callbackLoadTableContent(data);
}
else {
console.log("error: ", data[flagMessage]);
if (_verbose) { console.log("error: ", data[flagMessage]); }
OverlayError.show(data[flagMessage]);
}
})
@@ -207,7 +211,7 @@ export default class TableBasePage extends BasePage {
Events.initialiseEventHandler(idFormFilters + ' button.' + flagCancel, flagInitialised, function(button) {
button.addEventListener("click", function(event) {
event.stopPropagation();
getAndLoadFilteredTableContent();
this.getAndLoadFilteredTableContent();
});
button.classList.add(flagCollapsed);
});
@@ -255,7 +259,7 @@ export default class TableBasePage extends BasePage {
cacheRowBlank() {
let selectorRowNew = idTableMain + ' tbody tr.' + flagRowNew;
let rowBlankTemp = document.querySelector(selectorRowNew);
console.log("row blank temp: ", rowBlankTemp);
if (_verbose) { console.log("row blank temp: ", rowBlankTemp); }
_rowBlank = rowBlankTemp.cloneNode(true);
document.querySelectorAll(selectorRowNew).forEach(function(row) {
row.remove();
@@ -368,10 +372,10 @@ export default class TableBasePage extends BasePage {
let wasDirtyParentRows = this.getAllIsDirtyRowsInParentTree(element);
let wasDirtyElement = element.classList.contains(flagDirty);
let isDirtyElement = DOM.updateAndCheckIsElementDirty(element);
console.log({isDirtyElement, wasDirtyElement, wasDirtyParentRows});
if (_verbose) { console.log({isDirtyElement, wasDirtyElement, wasDirtyParentRows}); }
if (isDirtyElement != wasDirtyElement) {
let td = DOM.getCellFromElement(element);
DOM.setElementAttributeValueCurrent(td, DOM.getElementValueCurrent(element));
DOM.setElementAttributeValueCurrent(td, DOM.getElementAttributeValueCurrent(element));
this.toggleShowButtonsSaveCancel(isDirtyElement);
this.cascadeChangedIsDirtyNestedElementCellTable(element, isDirtyElement, wasDirtyParentRows);
}
@@ -397,7 +401,7 @@ export default class TableBasePage extends BasePage {
let tr = DOM.getRowFromElement(td);
let isDirtyRow = isDirtyTd || DOM.hasDirtyChildrenNotDeletedContainer(tr);
let wasDirtyRow = wasDirtyParentRows.pop();
console.log({isDirtyRow, wasDirtyRow});
if (_verbose) { console.log({isDirtyRow, wasDirtyRow}); }
if (isDirtyRow != wasDirtyRow) {
DOM.handleDirtyElement(tr, isDirtyRow);
this.toggleShowButtonsSaveCancel(isDirtyRow);
@@ -517,10 +521,9 @@ export default class TableBasePage extends BasePage {
cellSelector
, optionList
, ddlHookup = (cellSelector) => { this.hookupTableCellDdls(cellSelector); }
, changeHandler = (event, element) => { this.handleChangeTableCellDdl(event, element); }
, changeHandler = (event, element) => { this.handleChangeNestedElementCellTable(event, element); }
) {
this.hookupEventHandler("click", cellSelector, (event, td) => {
// if (td.querySelector('select')) return;
this.handleClickTableCellDdlPreview(
event
, td
@@ -532,14 +535,14 @@ export default class TableBasePage extends BasePage {
); }
);
});
ddlHookup(cellSelector + ' select');
}
hookupTableCellDdls(ddlSelector, changeHandler = (event, element) => { this.handleChangeTableCellDdl(event, element); }) {
hookupTableCellDdls(ddlSelector, changeHandler = (event, element) => { this.handleChangeNestedElementCellTable(event, element); }) {
this.hookupEventHandler("change", ddlSelector, (event, element) => { changeHandler(event, element); });
}
handleClickTableCellDdlPreview(event, td, optionObjectList, cellSelector, ddlHookup = (cellSelector) => { this.hookupTableCellDdls(cellSelector); }) {
if (td.querySelector('select')) return;
// td.removeEventListener("click", ddlHookup);
console.log("click table cell ddl preview");
let tdNew = td.cloneNode(true);
td.parentNode.replaceChild(tdNew, td);
let idSelected = DOM.getElementAttributeValueCurrent(tdNew);
@@ -547,7 +550,10 @@ export default class TableBasePage extends BasePage {
let ddl = document.createElement('select');
DOM.setElementValuesCurrentAndPrevious(ddl, idSelected);
let optionJson, option;
console.log({optionObjectList, cellSelector});
if (_verbose) {
console.log("click table cell ddl preview");
console.log({optionObjectList, cellSelector});
}
option = DOM.createOption(null);
ddl.appendChild(option);
optionObjectList.forEach((optionObjectJson) => {
@@ -557,8 +563,10 @@ export default class TableBasePage extends BasePage {
});
tdNew.appendChild(ddl);
let ddlSelector = cellSelector + ' select';
debugger;
ddlHookup(ddlSelector);
}
/*
handleChangeTableCellDdl(event, ddl) {
let row = DOM.getRowFromElement(ddl);
let td = DOM.getCellFromElement(ddl);
@@ -585,6 +593,7 @@ export default class TableBasePage extends BasePage {
}
}
}
*/
hookupTableCellDDlPreviewsWhenNotCollapsed(cellSelector, optionList, ddlHookup = (event, element) => { this.hookupTableCellDdls(event, element); }) {
this.hookupEventHandler("click", cellSelector, (event, td) => {
let div = td.querySelector('div');
@@ -596,7 +605,7 @@ export default class TableBasePage extends BasePage {
this.hookupChangeHandlerTableCells(ddlSelector, (event, element) => { this.handleChangeProductCategoryDdl(event, element); });
}
handleChangeProductCategoryDdl(event, ddlCategory) {
this.handleChangeTableCellDdl(event, ddlCategory);
this.handleChangeNestedElementCellTable(event, ddlCategory);
let idProductCategorySelected = DOM.getElementValueCurrent(ddlCategory);
let row = DOM.getRowFromElement(ddlCategory);
let tdProduct = row.querySelector('td.' + flagProduct);
@@ -611,7 +620,7 @@ export default class TableBasePage extends BasePage {
option = DOM.createOption(optionJson);
ddlProduct.appendChild(option);
});
this.handleChangeTableCellDdl(event, ddlProduct);
this.handleChangeNestedElementCellTable(event, ddlProduct);
}
hookupFieldsProductPermutationVariation() {
this.hookupPreviewsProductPermutationVariation();
@@ -625,7 +634,6 @@ export default class TableBasePage extends BasePage {
handleClickProductPermutationVariationsPreview(event, element) {
let tblVariations = element.querySelector('table.' + flagProductVariations);
if (!Validation.isEmpty(tblVariations)) return;
console.log("click product permutation variations preview");
this.toggleColumnCollapsed(flagProductVariations, false);
let permutationVariations = this.getElementProductVariations(element);
tblVariations = document.createElement("table");
@@ -650,18 +658,21 @@ export default class TableBasePage extends BasePage {
thead.appendChild(tr);
tblVariations.appendChild(thead);
let tbody = document.createElement("tbody");
console.log('variations:', permutationVariations);
if (!Validation.isEmpty(permutationVariations)) {
permutationVariations.forEach((permutationVariation, index) => {
this.addProductPermutationVariationRow(tbody, permutationVariation);
});
}
tblVariations.appendChild(tbody);
if (_verbose) {
console.log("click product permutation variations preview");
console.log('variations:', permutationVariations);
console.log("tblVariations: ", tblVariations);
}
let cellParent = element.closest(idTableMain + ' tbody tr td.' + flagProductVariations);
cellParent.innerHTML = '';
cellParent.appendChild(tblVariations);
console.log("tblVariations: ", tblVariations);
this.hookupFieldsProductPermutationVariation();
}
@@ -680,7 +691,7 @@ export default class TableBasePage extends BasePage {
permutationVariations.forEach((variation) => {
parts = variation.split(':');
if (parts.length == 2) {
console.log("parts: ", parts);
if (_verbose) { console.log("parts: ", parts); }
new_variation_type = productVariationTypes[parts[0].trim()];
new_variation = productVariations[parts[1].trim()];
objVariations.push({
@@ -689,7 +700,7 @@ export default class TableBasePage extends BasePage {
});
}
else {
console.log("error: invalid variation: ", variation);
if (_verbose) { console.log("error: invalid variation: ", variation); }
}
});
}
@@ -712,6 +723,7 @@ export default class TableBasePage extends BasePage {
};
}
addProductPermutationVariationRow(tbody, permutationVariation) {
if (_verbose) { console.log("permutationVariation: ", permutationVariation); }
let productVariationType, optionProductVariationTypeJson, optionProductVariationType, productVariation, optionProductVariationJson, optionProductVariation;
/*
if (Validation.isEmpty(variations)) {
@@ -734,7 +746,7 @@ export default class TableBasePage extends BasePage {
if (doFilterProductVariationKeys) {
productVariationKeys = productVariationKeys.filter(variationKey => !productVariationTypeKeysSelected.has(productVariations[variationKey][attrIdProductVariationType]));
}
console.log("permutationVariation: ", permutationVariation);
let permutationVariationJson = permutationVariation[flagProductVariation];
let permutationVariationTypeJson = permutationVariation[flagProductVariationType];
@@ -747,7 +759,7 @@ export default class TableBasePage extends BasePage {
DOM.setElementAttributesValuesCurrentAndPrevious(ddlVariationType, permutationVariationTypeJson[attrIdProductVariationType]);
optionProductVariationType = DOM.createOption(null);
console.log("optionProductVariationType: ", optionProductVariationType);
if (_verbose) { console.log("optionProductVariationType: ", optionProductVariationType); }
ddlVariationType.appendChild(optionProductVariationType);
productVariationTypeKeys.forEach((productVariationTypeKey) => {
@@ -759,7 +771,7 @@ export default class TableBasePage extends BasePage {
productVariationType = productVariationTypes[productVariationTypeKey];
optionProductVariationTypeJson = BusinessObjects.getOptionJsonFromObjectJson(productVariationType, permutationVariationTypeJson[attrIdProductVariationType]);
optionProductVariationType = DOM.createOption(optionProductVariationTypeJson);
console.log("optionProductVariationType: ", optionProductVariationType);
if (_verbose) { console.log("optionProductVariationType: ", optionProductVariationType); }
ddlVariationType.appendChild(optionProductVariationType);
});
@@ -772,14 +784,14 @@ export default class TableBasePage extends BasePage {
DOM.setElementAttributesValuesCurrentAndPrevious(ddlVariation, permutationVariationJson[attrIdProductVariation]);
optionProductVariation = DOM.createOption(null);
console.log("optionProductVariation: ", optionProductVariation);
if (_verbose) { console.log("optionProductVariation: ", optionProductVariation); }
ddlVariation.appendChild(optionProductVariation);
productVariationKeys.forEach((productVariationKey) => {
productVariation = productVariations[productVariationKey];
optionProductVariationJson = BusinessObjects.getOptionJsonFromObjectJson(productVariation, permutationVariationJson[attrIdProductVariation]);
optionProductVariation = DOM.createOption(optionProductVariationJson);
console.log("optionProductVariation: ", optionProductVariation);
if (_verbose) { console.log("optionProductVariation: ", optionProductVariation); }
ddlVariation.appendChild(optionProductVariation);
});

View File

@@ -21,12 +21,12 @@ export default class PageStoreBasket extends BasePage {
hookupStoreCardsInfo() {
document.querySelectorAll(idContainerInfoDelivery).addEventListener("click", function(event) {
console.log("delivery modal display method");
if (_verbose) { console.log("delivery modal display method"); }
document.querySelectorAll(idOverlayInfoDelivery).css('display', 'block');
});
document.querySelectorAll(idContainerInfoBilling).addEventListener("click", function(event) {
console.log("billing modal display method");
if (_verbose) { console.log("billing modal display method"); }
document.querySelectorAll(idOverlayInfoBilling).css('display', 'block');
});
}
@@ -44,7 +44,7 @@ export default class PageStoreBasket extends BasePage {
elForm.submit(function(event) {
elForm = document.querySelectorAll(elForm);
event.preventDefault();
console.log("delivery submit method");
if (_verbose) { console.log("delivery submit method"); }
ajaxData = {};
ajaxData[keyInfoType] = keyInfoDelivery;
@@ -63,7 +63,7 @@ export default class PageStoreBasket extends BasePage {
Events.initialiseEventHandler(elForm, flagInitialised, function() {
elForm.submit(function(event) {
event.preventDefault();
console.log("billing submit method");
if (_verbose) { console.log("billing submit method"); }
ajaxData = {};
ajaxData[keyInfoType] = keyInfoBilling;
@@ -81,7 +81,7 @@ export default class PageStoreBasket extends BasePage {
loadInfoAddress(response) {
console.log('ajax:'); console.log(response.data);
if (_verbose) { console.log('response:'); console.log(response.data); }
let infoType = response.data[keyInfoType];
let infoAddress = response.data[infoType];
LocalStorage.setLocalStorage(infoType, infoAddress);
@@ -119,11 +119,13 @@ export default class PageStoreBasket extends BasePage {
elOverlay = document.querySelectorAll(idOverlayInfoDelivery);
elForm = elOverlay.querySelector('form');
console.log('converting billing form to json\nform ID: ' + elForm.id);
ajaxData[flagForm] = convertForm2JSON(elForm); // formData; // form.serialize();
let keys = [keyNameFull, keyPhoneNumber, keyPostcode, keyAddress1, keyAddress2, keyCity, keyCounty];
console.log('ajaxData:');
console.log(ajaxData);
if (_verbose) {
console.log('converting billing form to json\nform ID: ' + elForm.id);
console.log('ajaxData:');
console.log(ajaxData);
}
ajaxData[flagForm][keyInfoIdentical] = getElementValueCurrent(elForm.querySelector('#' + keyInfoIdentical));
for (var k in keys) {
if (idOverlayInfo == idOverlayInfoBilling && ajaxData[flagForm][keyInfoIdentical]) {
@@ -132,8 +134,10 @@ export default class PageStoreBasket extends BasePage {
ajaxData[flagForm][keys[k]] = getElementValueCurrent(elForm.querySelector('#' + keys[k]));
}
}
console.log('ajaxData:');
console.log(ajaxData);
if (_verbose) {
console.log('ajaxData:');
console.log(ajaxData);
}
return ajaxData;
}

View File

@@ -37,7 +37,7 @@ export default class PageStoreManufacturingPurchaseOrders extends TableBasePage
let inputCostTotalLocalVatIncl = row.querySelector('td.' + flagCostTotalLocalVatIncl + ' input');
let inputPriceTotalLocalVatExcl = row.querySelector('td.' + flagPriceTotalLocalVatExcl + ' input');
let inputPriceTotalLocalVatIncl = row.querySelector('td.' + flagPriceTotalLocalVatIncl + ' input');
let tdItems = row.querySelector('td.' + flagOrderItems);
let trsPurchaseOrderItem = row.querySelectorAll('tr.' + flagOrderItems);
let checkboxActive = row.querySelector('td.' + flagActive + ' textarea');
let jsonRow = {};
@@ -47,11 +47,12 @@ export default class PageStoreManufacturingPurchaseOrders extends TableBasePage
jsonRow[flagCostTotalLocalVatIncl] = DOM.getElementAttributeValueCurrent(inputCostTotalLocalVatIncl);
jsonRow[flagPriceTotalLocalVatExcl] = DOM.getElementAttributeValueCurrent(inputPriceTotalLocalVatExcl);
jsonRow[flagPriceTotalLocalVatIncl] = DOM.getElementAttributeValueCurrent(inputPriceTotalLocalVatIncl);
// jsonRow[flagOrderItems] = DOM.getElementAttributeValueCurrent(tdItems);
let orderItems = [];
trsPurchaseOrderItem.forEach((tr) => {
orderItems.push(this.getJsonRowOrderItem(tr));
});
if (trsPurchaseOrderItem != null) {
trsPurchaseOrderItem.forEach((tr) => {
orderItems.push(this.getJsonRowOrderItem(tr));
});
}
jsonRow[flagOrderItems] = orderItems;
jsonRow[flagActive] = DOM.getElementAttributeValueCurrent(checkboxActive);
return jsonRow;
@@ -77,8 +78,6 @@ export default class PageStoreManufacturingPurchaseOrders extends TableBasePage
jsonRow[attrIdUnitMeasurementQuantity] = DOM.getElementAttributeValueCurrent(tdUnitQuantity);
jsonRow[flagQuantityUsed] = DOM.getElementAttributeValueCurrent(inputQuantityUsed);
jsonRow[flagQuantityProduced] = DOM.getElementAttributeValueCurrent(inputQuantityProduced);
jsonRow[flagCostTotalLocalVatExcl] = DOM.getElementAttributeValueCurrent(inputCostTotalLocalVatExcl);
jsonRow[flagCostTotalLocalVatIncl] = DOM.getElementAttributeValueCurrent(inputCostTotalLocalVatIncl);
jsonRow[flagLatencyManufacture] = DOM.getElementAttributeValueCurrent(inputLatencyManufacture);
jsonRow[flagActive] = DOM.getElementAttributeValueCurrent(checkboxActive);
@@ -91,11 +90,11 @@ export default class PageStoreManufacturingPurchaseOrders extends TableBasePage
hookupTableMain() {
super.hookupTableMain();
this.hookupCurrencyFields();
this.hookupCostInputs();
this.hookupCostAndPriceInputs();
this.hookupOrderItemsFields();
this.hookupInputsActiveTable();
}
hookupCostInputs() {
hookupCostAndPriceInputs() {
this.hookupChangeHandlerTableCells(idTableMain + ' td.' + flagCostTotalLocalVatExcl + ' input');
this.hookupChangeHandlerTableCells(idTableMain + ' td.' + flagCostTotalLocalVatIncl + ' input');
this.hookupChangeHandlerTableCells(idTableMain + ' td.' + flagPriceTotalLocalVatExcl + ' input');
@@ -110,8 +109,7 @@ export default class PageStoreManufacturingPurchaseOrders extends TableBasePage
this.hookupFieldsOrderItemUnitQuantity();
this.hookupFieldsOrderItemQuantityUsed();
this.hookupFieldsOrderItemQuantityProduced();
this.hookupFieldsOrderItemCostTotalLocalVatExcl();
this.hookupFieldsOrderItemCostTotalLocalVatIncl();
this.hookupFieldsOrderItemUnitMeasurementLatencyManufacture();
this.hookupFieldsOrderItemLatencyManufacture();
this.hookupFieldsOrderItemActive();
this.hookupFieldsOrderItemAddDelete();
@@ -124,7 +122,7 @@ export default class PageStoreManufacturingPurchaseOrders extends TableBasePage
});
}
handleClickOrderItemsPreview(event, element) {
console.log("click order items preview");
if (_verbose) { console.log("click order items preview"); }
this.toggleColumnHeaderCollapsed(flagOrderItems, false);
element.classList.remove(flagCollapsed);
@@ -154,10 +152,11 @@ export default class PageStoreManufacturingPurchaseOrders extends TableBasePage
thUnitQuantity.textContent = 'Unit Quantity';
let thQuantityUsed = document.createElement("th");
thQuantityUsed.classList.add(flagQuantityUsed);
thQuantityUsed.textContent = 'Quantity Ordered';
thQuantityUsed.textContent = 'Quantity Used';
let thQuantityProduced = document.createElement("th");
thQuantityProduced.classList.add(flagQuantityProduced);
thQuantityProduced.textContent = 'Quantity Received';
thQuantityProduced.textContent = 'Quantity Produced';
/*
let thCostTotalLocalVatExcl = document.createElement("th");
thCostTotalLocalVatExcl.classList.add(flagCostTotalLocalVatExcl);
thCostTotalLocalVatExcl.textContent = 'Cost Total Local VAT Excl';
@@ -170,9 +169,13 @@ export default class PageStoreManufacturingPurchaseOrders extends TableBasePage
let thCostUnitLocalVatIncl = document.createElement("th");
thCostUnitLocalVatIncl.classList.add(flagCostUnitLocalVatIncl);
thCostUnitLocalVatIncl.textContent = 'Cost Unit Local VAT Incl';
*/
let thUnitMeasurementLatencyManufacture = document.createElement("th");
thUnitMeasurementLatencyManufacture.classList.add(flagUnitMeasurementLatencyManufacture);
thUnitMeasurementLatencyManufacture.textContent = 'Unit Measurement Latency Manufacture';
let thLatencyManufacture = document.createElement("th");
thLatencyManufacture.classList.add(flagLatencyManufacture);
thLatencyManufacture.textContent = 'Latency Delivery (Days)';
thLatencyManufacture.textContent = 'Latency Manufacture';
let thActive = document.createElement("th");
thActive.classList.add(flagActive);
thActive.textContent = 'Active';
@@ -190,10 +193,13 @@ export default class PageStoreManufacturingPurchaseOrders extends TableBasePage
tr.appendChild(thUnitQuantity);
tr.appendChild(thQuantityUsed);
tr.appendChild(thQuantityProduced);
/*
tr.appendChild(thCostTotalLocalVatExcl);
tr.appendChild(thCostTotalLocalVatIncl);
tr.appendChild(thCostUnitLocalVatExcl);
tr.appendChild(thCostUnitLocalVatIncl);
*/
tr.appendChild(thUnitMeasurementLatencyManufacture);
tr.appendChild(thLatencyManufacture);
tr.appendChild(thActive);
tr.appendChild(thAddDelete);
@@ -210,11 +216,11 @@ export default class PageStoreManufacturingPurchaseOrders extends TableBasePage
let cellNew = cell.cloneNode(false);
cellNew.appendChild(tblOrderItems);
row.replaceChild(cellNew, cell);
console.log("tblOrderItems: ", tblOrderItems);
if (_verbose) { console.log("tblOrderItems: ", tblOrderItems); }
this.hookupOrderItemsFields();
}
addRowManufacturingPurchaseOrderItem(tbody, orderItem) { // productVariationTypeOptions, productVariationOptions, productCategoryOptions, productOptions, unitMeasurementOptions,
console.log("addRowManufacturingPurchaseOrderItem: ", orderItem);
if (_verbose) { console.log("addRowManufacturingPurchaseOrderItem: ", orderItem); }
let tdDisplayOrder = document.createElement("td");
tdDisplayOrder.classList.add(flagDisplayOrder);
@@ -245,6 +251,7 @@ export default class PageStoreManufacturingPurchaseOrders extends TableBasePage
let tdVariations = document.createElement("td");
tdVariations.classList.add(flagProductVariations);
tdVariations.classList.add(flagCollapsed);
DOM.setElementAttributesValuesCurrentAndPrevious(tdVariations, orderItem[attrIdProductCategory]);
let divVariations = document.createElement("div");
divVariations.classList.add(flagProductVariations);
@@ -276,6 +283,7 @@ export default class PageStoreManufacturingPurchaseOrders extends TableBasePage
DOM.setElementAttributesValuesCurrentAndPrevious(inputQuantityProduced, orderItem[flagQuantityProduced]);
tdQuantityProduced.appendChild(inputQuantityProduced);
/*
let tdCostTotalLocalVatExcl = document.createElement("td");
tdCostTotalLocalVatExcl.classList.add(flagCostTotalLocalVatExcl);
let inputCostTotalLocalVatExcl = document.createElement("input");
@@ -307,7 +315,16 @@ export default class PageStoreManufacturingPurchaseOrders extends TableBasePage
divCostUnitLocalVatIncl.classList.add(flagCostUnitLocalVatIncl);
DOM.setElementValuesCurrentAndPrevious(divCostUnitLocalVatIncl, orderItem[flagCostUnitLocalVatIncl]);
tdCostUnitLocalVatIncl.appendChild(divCostUnitLocalVatIncl);
*/
let tdUnitMeasurementLatencyManufacture = document.createElement("td");
tdUnitMeasurementLatencyManufacture.classList.add(flagUnitMeasurementLatencyManufacture);
DOM.setElementAttributesValuesCurrentAndPrevious(tdUnitMeasurementLatencyManufacture, orderItem[attrIdUnitMeasurementLatencyManufacture]);
let divUnitMeasurementLatencyManufacture = document.createElement("div");
divUnitMeasurementLatencyManufacture.classList.add(flagUnitMeasurementLatencyManufacture);
// DOM.setElementValuesCurrentAndPrevious(divUnitMeasurementLatencyManufacture, orderItem[flagUnitMeasurementLatencyManufacture]);
tdUnitMeasurementLatencyManufacture.appendChild(divUnitMeasurementLatencyManufacture);
let tdLatencyManufacture = document.createElement("td");
tdLatencyManufacture.classList.add(flagLatencyManufacture);
let inputLatencyManufacture = document.createElement("input");
@@ -343,10 +360,13 @@ export default class PageStoreManufacturingPurchaseOrders extends TableBasePage
tr.appendChild(tdUnitQuantity);
tr.appendChild(tdQuantityUsed);
tr.appendChild(tdQuantityProduced);
/*
tr.appendChild(tdCostTotalLocalVatExcl);
tr.appendChild(tdCostTotalLocalVatIncl);
tr.appendChild(tdCostUnitLocalVatExcl);
tr.appendChild(tdCostUnitLocalVatIncl);
*/
tr.appendChild(tdUnitMeasurementLatencyManufacture);
tr.appendChild(tdLatencyManufacture);
tr.appendChild(tdActive);
tr.appendChild(tdDelete);
@@ -368,9 +388,6 @@ export default class PageStoreManufacturingPurchaseOrders extends TableBasePage
hookupFieldsOrderItemProductVariations() {
this.hookupEventHandler("click", idTableMain + ' td.' + flagOrderItems + ' td.' + flagProductVariations, (event, element) => this.handleClickProductPermutationVariationsPreview(event, element));
}
handleChangeElementProductVariationsSubtableCell(event, element) {
this.handleChangeNestedElementCellTable(event, element); // , flagProductVariations);
}
hookupFieldsOrderItemUnitQuantity() {
this.hookupTableCellDdlPreviews(idTableMain + ' td.' + flagOrderItems + ' td.' + flagUnitMeasurementQuantity, Utils.getListFromDict(unitMeasurements));
}
@@ -380,6 +397,7 @@ export default class PageStoreManufacturingPurchaseOrders extends TableBasePage
hookupFieldsOrderItemQuantityProduced() {
this.hookupChangeHandlerTableCells(idTableMain + ' td.' + flagOrderItems + ' td.' + flagQuantityProduced + ' input');
}
/*
hookupFieldsOrderItemPriceTotalLocalVatExcl() {
this.hookupChangeHandlerTableCells(
idTableMain + ' td.' + flagOrderItems + ' td.' + flagPriceTotalLocalVatExcl + ' input'
@@ -438,6 +456,7 @@ export default class PageStoreManufacturingPurchaseOrders extends TableBasePage
hookupFieldsOrderItemPriceUnitLocalVatIncl() {
this.hookupChangeHandlerTableCells(idTableMain + ' td.' + flagOrderItems + ' td.' + flagPriceUnitLocalVatIncl + ' input');
}
*/
hookupFieldsOrderItemUnitMeasurementLatencyManufacture() {
this.hookupTableCellDdlPreviews(idTableMain + ' td.' + flagOrderItems + ' td.' + flagUnitMeasurementLatencyManufacture, Utils.getListFromDict(unitMeasurementsTime));
}
@@ -459,11 +478,11 @@ export default class PageStoreManufacturingPurchaseOrders extends TableBasePage
this.hookupEventHandler("click", idTableMain + ' td.' + flagOrderItems + ' th button.' + flagAdd, (event, element) => {
let row = element.closest(idTableMain + ' > tbody > tr');
let idManufacturingPurchaseOrder = row.getAttribute(attrIdManufacturingPurchaseOrder);
let hasActiveOrderItem = row.querySelectorAll('td.' + flagOrderItems + ' input.' + flagActive + ':checked').length > 0;
let countManufacturingOrderItemes = row.querySelectorAll('td.' + flagOrderItems + ' td.' + flagManufacturingPurchaseOrder).length;
// let hasActiveOrderItem = row.querySelectorAll('td.' + flagOrderItems + ' input.' + flagActive + ':checked').length > 0;
let countManufacturingOrderItems = row.querySelectorAll('td.' + flagOrderItems + ' td.' + flagManufacturingPurchaseOrder).length;
let manufacturingPurchaseOrderItem = {
[attrIdManufacturingPurchaseOrder]: idManufacturingPurchaseOrder,
[attrIdManufacturingPurchaseOrderProductLink]: -1 - countManufacturingOrderItemes,
[attrIdManufacturingPurchaseOrderProductLink]: -1 - countManufacturingOrderItems,
[attrIdProductCategory]: 0,
[attrIdProduct]: 0,
[flagProductVariations]: '',
@@ -473,10 +492,10 @@ export default class PageStoreManufacturingPurchaseOrders extends TableBasePage
[attrIdUnitMeasurementLatencyManufacture]: 0,
[flagLatencyManufacture]: '',
[flagDisplayOrder]: countManufacturingOrderItems + 1,
[flagActive]: !hasActiveOrderItem,
[flagActive]: true, // !hasActiveOrderItem,
};
let tbody = row.querySelector('td.' + flagOrderItems + ' table tbody');
this.addRowManufacturingOrderItem(tbody, manufacturingPurchaseOrderItem);
this.addRowManufacturingPurchaseOrderItem(tbody, manufacturingPurchaseOrderItem);
/*
if (!hasActiveOrderItem) {
let tdOrderItem = row.querySelector('td.' + flagOrderItems);

View File

@@ -65,7 +65,7 @@ export default class StoreMixinPage {
});
dropdownCurrency.addEventListener("change", function() {
let selectedCurrency = dropdownCurrency.val();
console.log("selected currency: ", selectedCurrency);
if (_verbose) { console.log("selected currency: ", selectedCurrency); }
let basket = LocalStorage.getLocalStorage(keyBasket);
basket[keyIdCurrency] = selectedCurrency;
// LocalStorage.setLocalStorage(keyIdCurrency, selectedCurrency);
@@ -109,17 +109,17 @@ export default class StoreMixinPage {
Events.initialiseEventHandler(dropdownRegion, flagInitialised, function() {
dropdownRegion = document.querySelectorAll(dropdownRegion);
dropdownRegion.addEventListener("focus", function() {
console.log("dropdown region focused");
if (_verbose) { console.log("dropdown region focused"); }
handleSelectExpand(dropdownRegion);
});
dropdownRegion.addEventListener("blur", function() {
console.log("dropdown region blurred");
if (_verbose) { console.log("dropdown region blurred"); }
handleSelectCollapse(dropdownRegion);
});
dropdownRegion.addEventListener("change", function() {
handleSelectCollapse(dropdownRegion);
let selectedRegion = dropdownRegion.val();
console.log("selected region: ", selectedRegion);
if (_verbose) { console.log("selected region: ", selectedRegion); }
let basket = LocalStorage.getLocalStorage(keyBasket);
basket[keyIdRegionDelivery] = selectedRegion;
// LocalStorage.setLocalStorage(keyIdRegionDelivery, selectedRegion);
@@ -138,10 +138,13 @@ export default class StoreMixinPage {
elSelector.addEventListener("change", function(event) {
ajaxData = {};
ajaxData[flagForm] = convertForm2JSON(elForm);
console.log('sending data to include VAT controller: '); console.log(ajaxData);
if (_verbose) {
console.log('sending data to include VAT controller: ');
console.log(ajaxData);
}
ajaxJSONData('set include VAT', mapHashToController(hashStoreSetIsIncludedVAT), ajaxData, function() { window.location.reload() }, false);
});
console.log("form is included VAT initialised")
if (_verbose) { console.log("form is included VAT initialised"); }
});
}
hookupLocalStorage() {
@@ -153,7 +156,7 @@ export default class StoreMixinPage {
// console.log('d:'); console.log(d);
let basketLocalStorage = LocalStorage.getLocalStorage(keyBasket);
if (!StoreMixinPage.validateBasket(basketLocalStorage)) {
console.log('locally-stored basket not valid');
if (_verbose) { console.log('locally-stored basket not valid'); }
basketLocalStorage = StoreMixinPage.makeNewBasket();
}
let basketServer = StoreMixinPage.validateBasket(userBasket) ? userBasket : basketLocalStorage;
@@ -216,7 +219,7 @@ export default class StoreMixinPage {
this.hookupDeleteBasketItemButtons();
}
toggleShowButtonCheckout() {
console.log("toggling checkout button");
if (_verbose) { console.log("toggling checkout button"); }
const buttonCheckout = document.querySelectorAll(idButtonCheckout);
const labelBasketEmpty = document.querySelectorAll(idLabelBasketEmpty);
if (userBasket['items'].length == 0) {
@@ -228,7 +231,7 @@ export default class StoreMixinPage {
}
}
hookupButtonCheckout() {
console.log("hooking up checkout button");
if (_verbose) { console.log("hooking up checkout button"); }
const buttonCheckout = document.querySelectorAll(idButtonCheckout);
// let lsPage = getPageLocalStorage(hashPageCurrent);
Events.initialiseEventHandler(buttonCheckout, flagInitialised, function() {
@@ -383,7 +386,7 @@ export default class StoreMixinPage {
getCurrencySelected() {
let elementSelectorCurrency = document.querySelectorAll(idSelectorCurrency);
let selectedCurrency = elementSelectorCurrency.val();
console.log("selected currency: ", selectedCurrency);
if (_verbose) { console.log("selected currency: ", selectedCurrency); }
return selectedCurrency;
}
@@ -392,13 +395,15 @@ export default class StoreMixinPage {
let d; // , lsShared;
let selectorCardProduct = '.card.subcard';
Events.initialiseEventHandler(selectorCardProduct, flagInitialised, function(cardProduct) {
console.log("initialising product card: ", cardProduct);
if (_verbose) { console.log("initialising product card: ", cardProduct); }
cardProduct.addEventListener("click", function(event) {
// d = { keyIdProduct: product.getAttribute(attrIdProduct) }
var elemClicked = event.target;
if (elemClicked.id != 'submit') { // disable for submit buttons
console.log("product click: " + cardProduct.getAttribute(attrIdProduct));
console.log("permutation click: " + cardProduct.getAttribute(attrIdPermutation));
if (_verbose) {
console.log("product click: " + cardProduct.getAttribute(attrIdProduct));
console.log("permutation click: " + cardProduct.getAttribute(attrIdPermutation));
}
var d = {}
d[keyIdProduct] = cardProduct.getAttribute(attrIdProduct)
d[keyIdPermutation] = cardProduct.getAttribute(attrIdPermutation)
@@ -406,7 +411,7 @@ export default class StoreMixinPage {
goToPage(hashPageStoreProduct, d);
}
});
console.log("click method added for product ID: " + cardProduct.getAttribute(attrIdProduct) + ', permutation ID: ', cardProduct.getAttribute(attrIdPermutation));
if (_verbose) { console.log("click method added for product ID: " + cardProduct.getAttribute(attrIdProduct) + ', permutation ID: ', cardProduct.getAttribute(attrIdPermutation)); }
});
}

View File

@@ -33,13 +33,13 @@ export default class PageStoreProductCategories extends TableBasePage {
loadRowTable(rowJson) {
if (rowJson == null) return;
if (_verbose) { console.log("applying data row: ", rowJson); }
let row = _rowBlank.cloneNode(true);
row.classList.remove(flagRowNew);
row.classList.remove(flagInitialised);
row.querySelectorAll('.' + flagInitialised).forEach(function(element) {
element.classList.remove(flagInitialised);
});
console.log("applying data row: ", rowJson);
let sliderDisplayOrder = row.querySelector('td.' + flagDisplayOrder + ' .' + flagSlider);
let textareaCode = row.querySelector('td.' + flagCode + ' textarea');
let textareaName = row.querySelector('td.' + flagName + ' textarea');
@@ -75,13 +75,13 @@ export default class PageStoreProductCategories extends TableBasePage {
let jsonCategory = {};
jsonCategory[attrIdProductCategory] = row.getAttribute(attrIdProductCategory);
jsonCategory[flagCode] = DOM.getElementValueCurrent(textareaCode);
jsonCategory[flagName] = DOM.getElementValueCurrent(textareaName);
jsonCategory[flagDescription] = DOM.getElementValueCurrent(textareaDescription);
jsonCategory[flagCode] = DOM.getElementAttributeValueCurrent(textareaCode);
jsonCategory[flagName] = DOM.getElementAttributeValueCurrent(textareaName);
jsonCategory[flagDescription] = DOM.getElementAttributeValueCurrent(textareaDescription);
// jsonCategory[flagAccessLevelRequired] = tdAccessLevel.getAttribute(flagAccessLevelRequired);
jsonCategory[attrIdAccessLevel] = DOM.getElementValueCurrent(tdAccessLevel);
jsonCategory[flagActive] = DOM.getElementValueCurrent(inputActive);
jsonCategory[flagDisplayOrder] = sliderDisplayOrder.getAttribute(attrValueCurrent);
jsonCategory[attrIdAccessLevel] = DOM.getElementAttributeValueCurrent(tdAccessLevel);
jsonCategory[flagActive] = DOM.getElementAttributeValueCurrent(inputActive);
jsonCategory[flagDisplayOrder] = DOM.getElementAttributeValueCurrent(sliderDisplayOrder);
return jsonCategory;
}
initialiseRowNew(row) {

View File

@@ -67,12 +67,12 @@ export default class PageStoreProductPermutations extends TableBasePage {
}
loadRowTable(rowJson) {
/*
if (rowJson == null) return;
if (_verbose) { console.log("applying data row: ", rowJson); }
/*
let tableMain = TableBasePage.getTableMain();
let row = _rowBlank.cloneNode(true);
row.classList.remove(flagRowNew);
console.log("applying data row: ", rowJson);
let dllCategory = row.querySelector('td.' + flagProductCategory + ' select');
dllCategory.value = rowJson[attrIdProductCategory];
let ddlProduct = row.querySelector('td.' + flagProduct + ' select');
@@ -130,7 +130,8 @@ export default class PageStoreProductPermutations extends TableBasePage {
let tdProduct = row.querySelector('td.' + flagProduct);
let tdProductVariations = row.querySelector('td.' + flagProductVariations);
let inputDescription = row.querySelector('td.' + flagDescription + ' textarea');
let inputCostLocal = row.querySelector('td.' + flagCostLocal + ' input');
let inputCostLocalVatExcl = row.querySelector('td.' + flagCostUnitLocalVatExcl + ' input');
let inputCostLocalVatIncl = row.querySelector('td.' + flagCostUnitLocalVatIncl + ' input');
let tdCurrencyCost = row.querySelector('td.' + flagCurrencyCost);
let inputProfitLocalMin = row.querySelector('td.' + flagProfitLocalMin + ' input');
let inputLatencyManufactureDays = row.querySelector('td.' + flagLatencyManufacture + ' input');
@@ -155,7 +156,8 @@ export default class PageStoreProductPermutations extends TableBasePage {
jsonRow[flagProductVariations] = tdProductVariations.getAttribute(attrValueCurrent);
jsonRow[flagHasVariations] = jsonRow[flagProductVariations] != '';
jsonRow[flagDescription] = inputDescription.getAttribute(attrValueCurrent);
jsonRow[flagCostLocal] = inputCostLocal.getAttribute(attrValueCurrent);
jsonRow[flagCostUnitLocalVatExcl] = inputCostLocalVatExcl.getAttribute(attrValueCurrent);
jsonRow[flagCostUnitLocalVatIncl] = inputCostLocalVatIncl.getAttribute(attrValueCurrent);
jsonRow[flagCurrencyCost] = tdCurrencyCost.getAttribute(attrValueCurrent);
jsonRow[flagProfitLocalMin] = inputProfitLocalMin.getAttribute(attrValueCurrent);
jsonRow[flagLatencyManufacture] = inputLatencyManufactureDays.getAttribute(attrValueCurrent);
@@ -181,8 +183,10 @@ export default class PageStoreProductPermutations extends TableBasePage {
let ddlProductFilter = document.querySelector(idFormFilters + ' #' + attrIdProduct);
let idProductFilter = DOM.getElementValueCurrent(ddlProductFilter);
let hasProductFilter = !(Validation.isEmpty(idProductFilter) || idProductFilter == '0');
console.log("initialiseRowNew: ", row);
console.log({ddlCategoryFilter, idProductCategoryFilter, hasCategoryFilter, ddlProductFilter, idProductFilter, hasProductFilter});
if (_verbose) {
console.log("initialiseRowNew: ", row);
console.log({ddlCategoryFilter, idProductCategoryFilter, hasCategoryFilter, ddlProductFilter, idProductFilter, hasProductFilter});
}
if (!hasCategoryFilter && !hasProductFilter) return;
if (hasCategoryFilter) {
let ddlCategory = row.querySelector('td.' + flagProductCategory + ' select');
@@ -231,7 +235,10 @@ export default class PageStoreProductPermutations extends TableBasePage {
this.hookupTableCellDdlPreviews(idTableMain + ' td.' + flagCurrencyCost, Utils.getListFromDict(currencies));
}
hookupCostInputs(){
this.hookupChangeHandlerTableCells(idTableMain + ' td.' + flagCostLocal + ' input');
/*
this.hookupChangeHandlerTableCells(idTableMain + ' td.' + flagCostUnitLocalVatExcl + ' input');
this.hookupChangeHandlerTableCells(idTableMain + ' td.' + flagCostUnitLocalVatIncl + ' input');
*/
}
hookupProfitFields(){
// this.hookupCurrencyProfitFields();
@@ -268,7 +275,6 @@ export default class PageStoreProductPermutations extends TableBasePage {
this.hookupChangeHandlerTableCells(idTableMain + ' td.' + flagCountUnitMeasurementPerQuantityStep + ' input');
}
hookupUnitMeasurementQuantityFields() {
console.log("hooking up unit measurement quantity fields");
this.hookupTableCellDdlPreviews(idTableMain + ' td.' + flagUnitMeasurementQuantity, Utils.getListFromDict(unitMeasurements));
}
hookupSubscriptionFields() {

View File

@@ -40,7 +40,6 @@ export default class PageStoreProducts extends TableBasePage {
row.querySelectorAll('.' + flagInitialised).forEach(function(element) {
element.classList.remove(flagInitialised);
});
console.log("applying data row: ", rowJson);
let sliderDisplayOrder = row.querySelector('td.' + flagDisplayOrder + ' .' + flagSlider);
let tdProductCategory = row.querySelector('td.' + flagProductCategory);
let divProductCategory = tdProductCategory.querySelector('div.' + flagProductCategory);

View File

@@ -115,8 +115,10 @@ export default class PageStoreStockItems extends TableBasePage {
let ddlProductFilter = document.querySelector(idFormFilters + ' #' + attrIdProduct);
let idProductFilter = DOM.getElementValueCurrent(ddlProductFilter);
let hasProductFilter = !(Validation.isEmpty(idProductFilter) || idProductFilter == '0');
console.log("initialiseRowNew: ", row);
console.log({ddlCategoryFilter, idProductCategoryFilter, hasCategoryFilter, ddlProductFilter, idProductFilter, hasProductFilter});
if (_verbose) {
console.log("initialiseRowNew: ", row);
console.log({ddlCategoryFilter, idProductCategoryFilter, hasCategoryFilter, ddlProductFilter, idProductFilter, hasProductFilter});
}
if (!hasCategoryFilter && !hasProductFilter) return;
if (hasCategoryFilter) {
let ddlCategory = row.querySelector('td.' + flagProductCategory + ' select');
@@ -222,7 +224,7 @@ export default class PageStoreStockItems extends TableBasePage {
DOM.setElementAttributesValuesCurrentAndPrevious(ddlPlant, plantJson[attrIdPlant]);
optionPlant = DOM.createOption(null);
console.log("optionPlant: ", optionPlant);
if (_verbose) { console.log("optionPlant: ", optionPlant); }
ddlPlant.appendChild(optionPlant);
plantKeys.forEach((plantKey) => {
@@ -232,7 +234,7 @@ export default class PageStoreStockItems extends TableBasePage {
valueSelected = plantJson[attrIdPlant]
);
optionPlant = DOM.createOption(optionPlantJson);
console.log("optionPlant: ", optionPlant);
if (_verbose) { console.log("optionPlant: ", optionPlant); }
ddlPlant.appendChild(optionPlant);
});
@@ -245,7 +247,7 @@ export default class PageStoreStockItems extends TableBasePage {
DOM.setElementAttributesValuesCurrentAndPrevious(ddlStorageLocation, storageLocationJson[attrIdStorageLocation]);
optionStorageLocation = DOM.createOption(null);
console.log("optionStorageLocation: ", optionStorageLocation);
if (_verbose) { console.log("optionStorageLocation: ", optionStorageLocation); }
ddlStorageLocation.appendChild(optionStorageLocation);
StorageLocationKeys.forEach((StorageLocationKey) => {
@@ -255,7 +257,7 @@ export default class PageStoreStockItems extends TableBasePage {
valueSelected = storageLocationJson[attrIdStorageLocation]
);
optionStorageLocation = DOM.createOption(optionStorageLocationJson);
console.log("optionStorageLocation: ", optionStorageLocation);
if (_verbose) { console.log("optionStorageLocation: ", optionStorageLocation); }
ddlStorageLocation.appendChild(optionStorageLocation);
});
@@ -270,12 +272,12 @@ export default class PageStoreStockItems extends TableBasePage {
let parent = element.parentElement;
parent.innerHTML = '';
parent.appendChild(tblStorageLocation);
console.log("tblStorageLocation: ", tblStorageLocation);
if (_verbose) { console.log("tblStorageLocation: ", tblStorageLocation); }
this.hookupChangeHandlerTableCells(idTableMain + ' td.' + flagPlant + ' select', (event, element) => { this.handleChangeStoragePlantDdl(event, element); });
this.hookupChangeHandlerTableCells(idTableMain + ' td.' + flagStorageLocation + ' select', (event, element) => { this.handleChangeStorageLocationDdl(event, element); });
}
handleChangeStoragePlantDdl(event, ddlPlant) {
this.handleChangeTableCellDdl(event, ddlPlant);
this.handleChangeNestedElementCellTable(event, ddlPlant);
let row = DOM.getRowFromElement(ddlPlant);
let ddlStorageLocation = row.querySelector('td.' + flagStorageLocation + ' select');
ddlStorageLocation.innerHTML = '';
@@ -288,10 +290,10 @@ export default class PageStoreStockItems extends TableBasePage {
option = DOM.createOption(optionJson);
ddlStorageLocation.appendChild(option);
});
this.handleChangeTableCellDdl(event, ddlStorageLocation);
this.handleChangeNestedElementCellTable(event, ddlStorageLocation);
}
handleChangeStorageLocationDdl(event, ddlStorageLocation) {
this.handleChangeTableCellDdl(event, ddlStorageLocation);
this.handleChangeNestedElementCellTable(event, ddlStorageLocation);
}
hookupSealingInputs() {

View File

@@ -129,7 +129,7 @@ export default class PageStoreSupplierPurchaseOrders extends TableBasePage {
});
}
handleClickOrderItemsPreview(event, element) {
console.log("click order items preview");
if (_verbose) { console.log("click order items preview"); }
this.toggleColumnHeaderCollapsed(flagOrderItems, false);
element.classList.remove(flagCollapsed);
@@ -216,11 +216,11 @@ export default class PageStoreSupplierPurchaseOrders extends TableBasePage {
let cellNew = cell.cloneNode(false);
cellNew.appendChild(tblOrderItems);
row.replaceChild(cellNew, cell);
console.log("tblOrderItems: ", tblOrderItems);
if (_verbose) { console.log("tblOrderItems: ", tblOrderItems); }
this.hookupOrderItemsFields();
}
addRowSupplierPurchaseOrderItem(tbody, orderItem) { // productVariationTypeOptions, productVariationOptions, productCategoryOptions, productOptions, unitMeasurementOptions,
console.log("addRowSupplierPurchaseOrderItem: ", orderItem);
if (_verbose) { console.log("addRowSupplierPurchaseOrderItem: ", orderItem); }
let tdDisplayOrder = document.createElement("td");
tdDisplayOrder.classList.add(flagDisplayOrder);
@@ -255,6 +255,7 @@ export default class PageStoreSupplierPurchaseOrders extends TableBasePage {
let tdVariations = document.createElement("td");
tdVariations.classList.add(flagProductVariations);
tdVariations.classList.add(flagCollapsed);
DOM.setElementAttributesValuesCurrentAndPrevious(tdVariations, orderItem[attrIdProductVariation]);
let divVariations = document.createElement("div");
divVariations.classList.add(flagProductVariations);
@@ -312,14 +313,14 @@ export default class PageStoreSupplierPurchaseOrders extends TableBasePage {
tdCostUnitLocalVatExcl.classList.add(flagCostUnitLocalVatExcl);
let divCostUnitLocalVatExcl = document.createElement("div");
divCostUnitLocalVatExcl.classList.add(flagCostUnitLocalVatExcl);
DOM.setElementValuesCurrentAndPrevious(divCostUnitLocalVatExcl, orderItem[flagCostUnitLocalVatExcl]);
DOM.setElementValuesCurrentAndPrevious(divCostUnitLocalVatExcl, orderItem[flagCostUnitLocalVatExcl].toFixed(3));
tdCostUnitLocalVatExcl.appendChild(divCostUnitLocalVatExcl);
let tdCostUnitLocalVatIncl = document.createElement("td");
tdCostUnitLocalVatIncl.classList.add(flagCostUnitLocalVatIncl);
let divCostUnitLocalVatIncl = document.createElement("div");
divCostUnitLocalVatIncl.classList.add(flagCostUnitLocalVatIncl);
DOM.setElementValuesCurrentAndPrevious(divCostUnitLocalVatIncl, orderItem[flagCostUnitLocalVatIncl]);
DOM.setElementValuesCurrentAndPrevious(divCostUnitLocalVatIncl, orderItem[flagCostUnitLocalVatIncl].toFixed(3));
tdCostUnitLocalVatIncl.appendChild(divCostUnitLocalVatIncl);
let tdLatencyDeliveryDays = document.createElement("td");
@@ -384,20 +385,11 @@ export default class PageStoreSupplierPurchaseOrders extends TableBasePage {
this.hookupEventHandler("click", idTableMain + ' td.' + flagOrderItems + ' td.' + flagProductVariations, (event, element) => this.handleClickProductPermutationVariationsPreview(event, element));
}
*/
handleChangeElementProductVariationsSubtableCell(event, element) {
this.handleChangeNestedElementCellTable(event, element); // flagProductVariations);
}
hookupDdlsProductPermutationVariation() {
this.hookupTableCellDdls(
idTableMain + ' td.' + flagProductVariations + ' td.' + flagProductVariation
, (event, element) => { this.handleChangeElementProductVariationsSubtableCell(event, element); }
);
this.hookupTableCellDdls(idTableMain + ' td.' + flagProductVariations + ' td.' + flagProductVariation);
}
hookupDdlsProductPermutationVariationType() {
this.hookupTableCellDdls(
idTableMain + ' td.' + flagProductVariations + ' td.' + flagProductVariationType
, (event, element) => { this.handleChangeElementProductVariationsSubtableCell(event, element); }
);
this.hookupTableCellDdls(idTableMain + ' td.' + flagProductVariations + ' td.' + flagProductVariationType);
}
hookupFieldsOrderItemUnitQuantity() {
this.hookupTableCellDdlPreviews(
@@ -442,7 +434,7 @@ export default class PageStoreSupplierPurchaseOrders extends TableBasePage {
let divCostUnitLocalVatExcl = row.querySelector('td.' + flagCostUnitLocalVatExcl + ' div');
let costUnitLocalVatExcl = quantityOrdered == 0 ? 0 : costTotalLocalVatExcl / quantityOrdered;
DOM.setElementValuesCurrentAndPrevious(divCostUnitLocalVatExcl, costUnitLocalVatExcl);
DOM.setElementValuesCurrentAndPrevious(divCostUnitLocalVatExcl, costUnitLocalVatExcl.toFixed(3));
let rowSupplierPurchaseOrder = row.closest(idTableMain + ' > tbody > tr');
let divCostGrandTotalLocalVatExcl = rowSupplierPurchaseOrder.querySelector('td.' + flagCostTotalLocalVatExcl + ' div');
@@ -459,7 +451,7 @@ export default class PageStoreSupplierPurchaseOrders extends TableBasePage {
let divCostUnitLocalVatIncl = row.querySelector('td.' + flagCostUnitLocalVatIncl + ' div');
let costUnitLocalVatIncl = quantityOrdered == 0 ? 0 : costTotalLocalVatIncl / quantityOrdered;
DOM.setElementValuesCurrentAndPrevious(divCostUnitLocalVatIncl, costUnitLocalVatIncl);
DOM.setElementValuesCurrentAndPrevious(divCostUnitLocalVatIncl, costUnitLocalVatIncl.toFixed(3));
let rowSupplierPurchaseOrder = row.closest(idTableMain + ' > tbody > tr');
let divCostGrandTotalLocalVatIncl = rowSupplierPurchaseOrder.querySelector('td.' + flagCostTotalLocalVatIncl + ' div');
@@ -485,7 +477,7 @@ export default class PageStoreSupplierPurchaseOrders extends TableBasePage {
this.hookupEventHandler("click", idTableMain + ' td.' + flagOrderItems + ' th button.' + flagAdd, (event, element) => {
let row = element.closest(idTableMain + ' > tbody > tr');
let idSupplierPurchaseOrder = row.getAttribute(attrIdSupplierPurchaseOrder);
let hasActiveOrderItem = row.querySelectorAll('td.' + flagOrderItems + ' input.' + flagActive + ':checked').length > 0;
// let hasActiveOrderItem = row.querySelectorAll('td.' + flagOrderItems + ' input.' + flagActive + ':checked').length > 0;
let countSupplierOrderItems = row.querySelectorAll('td.' + flagOrderItems + ' td.' + flagSupplierPurchaseOrder).length;
let supplierOrderItem = {
[attrIdSupplierPurchaseOrder]: idSupplierPurchaseOrder,
@@ -502,7 +494,7 @@ export default class PageStoreSupplierPurchaseOrders extends TableBasePage {
[flagCostUnitLocalVatIncl]: '',
[flagLatencyDeliveryDays]: '',
[flagDisplayOrder]: countSupplierOrderItems + 1,
[flagActive]: !hasActiveOrderItem,
[flagActive]: true, // !hasActiveOrderItem,
};
let tbody = row.querySelector('td.' + flagOrderItems + ' table tbody');
this.addRowSupplierPurchaseOrderItem(tbody, supplierOrderItem);

View File

@@ -132,7 +132,7 @@ export default class PageStoreSuppliers extends TableBasePage {
});
}
handleClickAddressPreview(event, element) {
console.log("click address preview");
if (_verbose) { console.log("click address preview"); }
this.toggleColumnHeaderCollapsed(flagAddress, false);
element.classList.remove(flagCollapsed);
let row = DOM.getRowFromElement(element);
@@ -192,11 +192,11 @@ export default class PageStoreSuppliers extends TableBasePage {
let cellNew = cell.cloneNode(false);
cellNew.appendChild(tblAddresses);
row.replaceChild(cellNew, cell);
console.log("tblAddresses: ", tblAddresses);
if (_verbose) { console.log("tblAddresses: ", tblAddresses); }
this.hookupAddressFields();
}
addRowSupplierAddress(tbody, supplierAddress, regionOptions) {
console.log("addRowSupplierAddress: ", supplierAddress);
if (_verbose) { console.log("addRowSupplierAddress: ", supplierAddress); }
let tdPostcode = document.createElement("td");
tdPostcode.classList.add(flagPostcode);
let textareaPostcode = document.createElement("textarea");
@@ -279,28 +279,25 @@ export default class PageStoreSuppliers extends TableBasePage {
tbody.appendChild(tr);
}
hookupAddressPostcodeInputs() {
this.handleChangeElementAddressSubtableCells(idTableMain + ' td.' + flagAddress + ' textarea.' + flagPostcode);
}
handleChangeElementAddressSubtableCells(event, element) {
this.handleChangeNestedElementCellTable(event, element); // flagAddress);
this.hookupChangeHandlerTableCells(idTableMain + ' td.' + flagAddress + ' textarea.' + flagPostcode);
}
hookupAddressLine1Inputs() {
this.handleChangeElementAddressSubtableCells(idTableMain + ' td.' + flagAddress + ' textarea.' + flagAddressLine1);
this.hookupChangeHandlerTableCells(idTableMain + ' td.' + flagAddress + ' textarea.' + flagAddressLine1);
}
hookupAddressLine2Inputs() {
this.handleChangeElementAddressSubtableCells(idTableMain + ' td.' + flagAddress + ' textarea.' + flagAddressLine2);
this.hookupChangeHandlerTableCells(idTableMain + ' td.' + flagAddress + ' textarea.' + flagAddressLine2);
}
hookupAddressCityInputs() {
this.handleChangeElementAddressSubtableCells(idTableMain + ' td.' + flagAddress + ' textarea.' + flagCity);
this.hookupChangeHandlerTableCells(idTableMain + ' td.' + flagAddress + ' textarea.' + flagCity);
}
hookupAddressCountyInputs() {
this.handleChangeElementAddressSubtableCells(idTableMain + ' td.' + flagAddress + ' textarea.' + flagCounty);
this.hookupChangeHandlerTableCells(idTableMain + ' td.' + flagAddress + ' textarea.' + flagCounty);
}
hookupAddressRegionDdls() {
this.handleChangeElementAddressSubtableCells(idTableMain + ' td.' + flagAddress + ' select.' + flagRegion);
this.hookupChangeHandlerTableCells(idTableMain + ' td.' + flagAddress + ' select.' + flagRegion);
}
hookupAddressActiveCheckboxes() {
this.handleChangeElementAddressSubtableCells(idTableMain + ' td.' + flagAddress + ' input.' + flagActive, (event, element) => {
this.hookupChangeHandlerTableCells(idTableMain + ' td.' + flagAddress + ' input.' + flagActive, (event, element) => {
let rowSupplierAddress = element.closest('tr');
let idAddress = rowSupplierAddress.getAttribute(attrIdSupplierAddress);
DOM.setElementAttributeValueCurrent(rowSupplierAddress, idAddress);

View File

@@ -143,7 +143,7 @@ export default class Router {
return module; // [pageJson.name];
}
catch (error) {
console.log("this.pages: ", this.pages);
if (_verbose) { console.log("this.pages: ", this.pages); };
console.error('Page not found:', hashPage);
throw error;
}
@@ -169,7 +169,6 @@ export default class Router {
// this.beforeLeave();
/*
if (this.routes[hash]) {
console.log("navigating to hash: " + hash);
this.routes[hash](isPopState);
} else {
console.error(`Hash ${hash} not found`);
@@ -323,7 +322,6 @@ export default class Router {
*/
static loadPageBodyFromResponse(response) {
console.log(response.data);
DOM.loadPageBody(response.data);
}
}

View File

@@ -27,11 +27,7 @@
<script src="{{ url_for('static', filename='js/store/home.js') }}"></script>
<script>
var hashPageCurrent = "{{ model.HASH_PAGE_STORE_HOME }}";
$(document).ready(function() {
console.log('Hooking up home page...');
hookupStorePageHome();
// hookupStore(); // in _shared_store.html
});
{#
var hashPageCurrent = "{{ model.HASH_PAGE_STORE_HOME }}";
#}
</script>

View File

@@ -30,6 +30,13 @@
{{ product.form_delivery_option() }}
</div>
{% endif %}
<script>console.log('creating basket item for:');console.log('product id: {{ product.id_product }}');console.log('permutation id: {{ product.get_id_permutation() }}');console.log('quantity: {{ basket_item.quantity }}');</script>
<script>
if (_verbose) {
console.log('creating basket item for:');
console.log('product id: {{ product.id_product }}');
console.log('permutation id: {{ product.get_id_permutation() }}');
console.log('quantity: {{ basket_item.quantity }}');
}
</script>
</form>
</div>

View File

@@ -1,6 +1,9 @@
{% if is_blank_row %}
<tr class="{{ model.FLAG_ROW_NEW }} {{ model.FLAG_MANUFACTURING_PURCHASE_ORDER }}" {{ model.ATTR_ID_MANUFACTURING_PURCHASE_ORDER }}>
<td class="{{ model.FLAG_ORDER_ITEMS }} {{ model.FLAG_COLLAPSED }}" {{ model.ATTR_VALUE_CURRENT }}="" {{ model.ATTR_VALUE_PREVIOUS }}="">
{% include 'components/store/_preview_order_items.html' %}
</td>
<td class="{{ model.FLAG_CURRENCY }}" {{ model.ATTR_VALUE_CURRENT }}="" {{ model.ATTR_VALUE_PREVIOUS }}="">
{% include 'components/store/_preview_DDL_currency.html' %}
</td>
@@ -30,15 +33,20 @@
{{ model.ATTR_VALUE_CURRENT }}="" {{ model.ATTR_VALUE_PREVIOUS }}=""
></div>
</td>
<td class="{{ model.FLAG_ORDER_ITEMS }} {{ model.FLAG_COLLAPSED }}" {{ model.ATTR_VALUE_CURRENT }}="" {{ model.ATTR_VALUE_PREVIOUS }}="">
{% include 'components/store/_preview_order_items.html' %}
</td>
<td class="{{ model.FLAG_ACTIVE }}">
<input class="{{ model.FLAG_ACTIVE }}" type="checkbox" checked {{ model.ATTR_VALUE_CURRENT }}="{{ model.FLAG_BOOL_TRUE }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ model.FLAG_BOOL_TRUE }}">
</td>
</tr>
{% else %}
<tr class="{{ model.FLAG_MANUFACTURING_PURCHASE_ORDER }}" {{ model.ATTR_ID_MANUFACTURING_PURCHASE_ORDER }}="{{ order.id_order }}">
{% set order_items = order.items %}
{% set json_str_items = model.jsonify(model.convert_list_objects_to_list_options(order_items)) %}
<td class="{{ model.FLAG_ORDER_ITEMS }} {{ model.FLAG_COLLAPSED }}" {{ model.ATTR_VALUE_CURRENT }}="{{ json_str_items }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ json_str_items }}">
{#
{% include 'components/store/_preview_manufacturing_purchase_order_items.html' %}
#}
{% include 'components/store/_preview_order_items.html' %}
</td>
{% set currency = order.currency %}
<td class="{{ model.FLAG_CURRENCY }}" {{ model.ATTR_VALUE_CURRENT }}="{{ currency.id_currency }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ currency.id_currency }}">
{% include 'components/store/_preview_DDL_currency.html' %}
@@ -71,14 +79,6 @@
{{ model.ATTR_VALUE_PREVIOUS }}="{{ order.price_total_local_VAT_incl }}"
></div>
</td>
{% set order_items = order.items %}
{% set json_str_items = model.jsonify(model.convert_list_objects_to_list_options(order_items)) %}
<td class="{{ model.FLAG_ORDER_ITEMS }} {{ model.FLAG_COLLAPSED }}" {{ model.ATTR_VALUE_CURRENT }}="{{ json_str_items }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ json_str_items }}">
{#
{% include 'components/store/_preview_manufacturing_purchase_order_items.html' %}
#}
{% include 'components/store/_preview_order_items.html' %}
</td>
<td class="{{ model.FLAG_ACTIVE }}">
<input class="{{ model.FLAG_ACTIVE }}" type="checkbox" {% if order.active %}checked{% endif %} {{ model.ATTR_VALUE_CURRENT }}="{{ order.active | lower }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ order.active | lower }}">
</td>

View File

@@ -17,7 +17,10 @@
<td class="{{ model.FLAG_HAS_VARIATIONS }}">
<input class="{{ model.FLAG_HAS_VARIATIONS }}" type="checkbox" {{ model.ATTR_VALUE_CURRENT }}="{{ model.FLAG_BOOL_FALSE }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ model.FLAG_BOOL_FALSE }}">
</td>
<td class="{{ model.FLAG_ACCESS_LEVEL }}" {{ model.ATTR_ID_ACCESS_LEVEL }}="1" {{ model.FLAG_ACCESS_LEVEL_REQUIRED }}="View">
<td class="{{ model.FLAG_ACCESS_LEVEL }}"
{{ model.ATTR_ID_ACCESS_LEVEL }}="1" {{ model.FLAG_ACCESS_LEVEL_REQUIRED }}="View"
{{ model.ATTR_VALUE_CURRENT }}="1" {{ model.ATTR_VALUE_PREVIOUS }}="1"
>
<div class="{{ model.FLAG_ACCESS_LEVEL}}" {{ model.ATTR_ID_ACCESS_LEVEL }}="1">View</div>
</td>
<td class="{{ model.FLAG_ACTIVE }}">
@@ -46,7 +49,10 @@
<input class="{{ model.FLAG_HAS_VARIATIONS }}" type="checkbox" {% if product.has_variations %}checked{% endif %}
{{ model.ATTR_VALUE_CURRENT }}="{{ product.has_variations | lower }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ product.has_variations | lower }}">
</td>
<td class="{{ model.FLAG_ACCESS_LEVEL }}" {{ model.ATTR_ID_ACCESS_LEVEL }}="1" {{ model.FLAG_ACCESS_LEVEL_REQUIRED }}="{{ product.name_access_level_required }}">
<td class="{{ model.FLAG_ACCESS_LEVEL }}"
{{ model.ATTR_ID_ACCESS_LEVEL }}="{{ product.id_access_level_required }}" {{ model.FLAG_ACCESS_LEVEL_REQUIRED }}="{{ product.name_access_level_required }}"
{{ model.ATTR_VALUE_CURRENT }}="{{ product.id_access_level_required }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ product.id_access_level_required }}"
>
<div class="{{ model.FLAG_ACCESS_LEVEL}}" {{ model.ATTR_ID_ACCESS_LEVEL }}="{{ product.id_access_level_required }}" {{ model.ATTR_VALUE_CURRENT }}="{{ product.id_access_level_required }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ product.id_access_level_required }}">{{ product.name_access_level_required }}</div>
</td>
<td class="{{ model.FLAG_ACTIVE }}">

View File

@@ -52,9 +52,18 @@
<td class="{{ model.FLAG_UNIT_MEASUREMENT_INTERVAL_EXPIRATION_UNSEALED }}" {{ model.ATTR_VALUE_CURRENT }} {{ model.ATTR_VALUE_PREVIOUS }}>
{% include 'components/store/_preview_DDL_product_permutation_interval_expiration_unsealed.html' %}
</td>
<td class="{{ model.FLAG_COST_LOCAL }}">
<td class="{{ model.FLAG_COST_UNIT_LOCAL_VAT_EXCL }}">
<!--
<input class="{{ model.FLAG_COST_LOCAL }}" type="number" min="0" step="0.01"
value="0" {{ model.ATTR_VALUE_CURRENT }}="0" {{ model.ATTR_VALUE_PREVIOUS }}>
-->
<div {{ model.ATTR_VALUE_CURRENT }}="0" {{ model.ATTR_VALUE_PREVIOUS }}>
0
</div>
</td>
<td class="{{ model.FLAG_COST_UNIT_LOCAL_VAT_INCL }}">
<div {{ model.ATTR_VALUE_CURRENT }}="0" {{ model.ATTR_VALUE_PREVIOUS }}>
0
</div>
</td>
<td class="{{ model.FLAG_CURRENCY_COST }}" {{ model.ATTR_VALUE_CURRENT }} {{ model.ATTR_VALUE_PREVIOUS }}>
{% include 'components/store/_preview_DDL_currency.html' %}
@@ -140,8 +149,11 @@
<td class="{{ model.FLAG_UNIT_MEASUREMENT_INTERVAL_EXPIRATION_UNSEALED }}" {{ model.ATTR_VALUE_CURRENT }}="{{ value }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ value }}">
{% include 'components/store/_preview_DDL_product_permutation_interval_expiration_unsealed.html' %}
</td>
<td class="{{ model.FLAG_COST_LOCAL }}">
<input class="{{ model.FLAG_COST_LOCAL }}" type="number" min="0" value="{{ permutation.cost_local }}" {{ model.ATTR_VALUE_CURRENT }}="{{ permutation.cost_local }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ permutation.cost_local }}">
<td class="{{ model.FLAG_COST_UNIT_LOCAL_VAT_EXCL }}">
<input class="{{ model.FLAG_COST_UNIT_LOCAL_VAT_EXCL }}" type="number" min="0" value="{{ permutation.cost_local_VAT_excl }}" {{ model.ATTR_VALUE_CURRENT }}="{{ permutation.cost_local_VAT_excl }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ permutation.cost_local_VAT_excl }}">
</td>
<td class="{{ model.FLAG_COST_UNIT_LOCAL_VAT_INCL }}">
<input class="{{ model.FLAG_COST_UNIT_LOCAL_VAT_INCL }}" type="number" min="0" value="{{ permutation.cost_local_VAT_incl }}" {{ model.ATTR_VALUE_CURRENT }}="{{ permutation.cost_local_VAT_incl }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ permutation.cost_local_VAT_incl }}">
</td>
{% set currency = permutation.currency_cost %}

View File

@@ -4,6 +4,9 @@
<td class="{{ model.FLAG_SUPPLIER }}" {{ model.ATTR_VALUE_CURRENT }}="" {{ model.ATTR_VALUE_PREVIOUS }}="">
{% include 'components/store/_preview_DDL_supplier.html' %}
</td>
<td class="{{ model.FLAG_ORDER_ITEMS }} {{ model.FLAG_COLLAPSED }}" {{ model.ATTR_VALUE_CURRENT }}="" {{ model.ATTR_VALUE_PREVIOUS }}="">
{% include 'components/store/_preview_order_items.html' %}
</td>
<td class="{{ model.FLAG_CURRENCY }}" {{ model.ATTR_VALUE_CURRENT }}="" {{ model.ATTR_VALUE_PREVIOUS }}="">
{% include 'components/store/_preview_DDL_currency.html' %}
</td>
@@ -19,9 +22,6 @@
{{ model.ATTR_VALUE_CURRENT }}="" {{ model.ATTR_VALUE_PREVIOUS }}=""
></div>
</td>
<td class="{{ model.FLAG_ORDER_ITEMS }} {{ model.FLAG_COLLAPSED }}" {{ model.ATTR_VALUE_CURRENT }}="" {{ model.ATTR_VALUE_PREVIOUS }}="">
{% include 'components/store/_preview_order_items.html' %}
</td>
<td class="{{ model.FLAG_ACTIVE }}">
<input class="{{ model.FLAG_ACTIVE }}" type="checkbox" checked {{ model.ATTR_VALUE_CURRENT }}="{{ model.FLAG_BOOL_TRUE }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ model.FLAG_BOOL_TRUE }}">
</td>
@@ -32,6 +32,11 @@
<td class="{{ model.FLAG_SUPPLIER }}" {{ model.ATTR_VALUE_CURRENT }}="{{ supplier.id_supplier }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ supplier.id_supplier }}">
{% include 'components/store/_preview_DDL_supplier.html' %}
</td>
{% set order_items = order.items %}
{% set json_str_items = model.jsonify(model.convert_list_objects_to_list_options(order_items)) %}
<td class="{{ model.FLAG_ORDER_ITEMS }} {{ model.FLAG_COLLAPSED }}" {{ model.ATTR_VALUE_CURRENT }}="{{ json_str_items }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ json_str_items }}">
{% include 'components/store/_preview_order_items.html' %}
</td>
{% set currency = order.currency %}
<td class="{{ model.FLAG_CURRENCY }}" {{ model.ATTR_VALUE_CURRENT }}="{{ currency.id_currency }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ currency.id_currency }}">
{% include 'components/store/_preview_DDL_currency.html' %}
@@ -56,11 +61,6 @@
{{ model.ATTR_VALUE_PREVIOUS }}="{{ order.cost_total_local_VAT_incl }}"
></div>
</td>
{% set order_items = order.items %}
{% set json_str_items = model.jsonify(model.convert_list_objects_to_list_options(order_items)) %}
<td class="{{ model.FLAG_ORDER_ITEMS }} {{ model.FLAG_COLLAPSED }}" {{ model.ATTR_VALUE_CURRENT }}="{{ json_str_items }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ json_str_items }}">
{% include 'components/store/_preview_order_items.html' %}
</td>
<td class="{{ model.FLAG_ACTIVE }}">
<input class="{{ model.FLAG_ACTIVE }}" type="checkbox" checked {{ model.ATTR_VALUE_CURRENT }}="{{ order.active | lower }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ order.active | lower }}">
</td>

View File

@@ -235,13 +235,17 @@
var _pathHost = "{{ model.get_url_host() }}";
var _rowBlank = null;
var titlePageCurrent = "{{ model.title }}";
var _verbose = ("{{ model.app.app_config.DEBUG }}" == "True");
</script>
<!-- Stylesheets
<link href="{{ url_for('static', filename='css/main.css') }}" rel="stylesheet" type="text/css"/>
<link rel="stylesheet" loading="eager" href="{{ url_for('static', filename='dist/css/main.bundle.css') }}">
-->
<link rel="stylesheet" href="{{ url_for('static', filename='dist/css/main.bundle.css') }}">
<link rel="preload" as="style" href="{{ url_for('static', filename='dist/css/main.bundle.css') }}" onload="this.onload=null;this.rel='stylesheet'">
<noscript><link rel="stylesheet" href="{{ url_for('static', filename='dist/css/main.bundle.css') }}"></noscript>
{% block page_head %}{% endblock %}
</head>
<body data-page="{{ model.hash_page_current }}">
<div class="topnav">

View File

@@ -1,14 +1,12 @@
{% extends 'layouts/layout.html' %}
{% block title %}{{ model.title }}{% endblock %}
{% block page_head %}
<link rel="preload" as="style" href="{{ url_for('static', filename='dist/css/store_basket.bundle.css') }}" onload="this.onload=null;this.rel='stylesheet'">
<noscript><link rel="stylesheet" href="{{ url_for('static', filename='dist/css/store_basket.bundle.css') }}"></noscript>
{% endblock %}
{% block page_body %}
<!-- Include Stylesheets
<link rel="stylesheet" href="{{ url_for('static', filename='css/sections/store.css') }}">
<link rel="stylesheet" href="{{ url_for('static', filename='css/store/basket.css') }}">
-->
<link rel="stylesheet" href="{{ url_for('static', filename='dist/css/store_basket.bundle.css') }}">
<!-- HTML content -->
<div class="{{ model.FLAG_CARD }}">
<div class="{{ model.FLAG_CONTAINER }} {{ model.FLAG_COLUMN }}">

View File

@@ -1,6 +1,10 @@
{% extends 'layouts/layout.html' %}
{% block title %}{{ model.title }}{% endblock %}
{% block page_head %}
<link rel="preload" as="style" href="{{ url_for('static', filename='dist/css/store_home.bundle.css') }}" onload="this.onload=null;this.rel='stylesheet'">
<noscript><link rel="stylesheet" href="{{ url_for('static', filename='dist/css/store_home.bundle.css') }}"></noscript>
{% endblock %}
{% block page_body %}
{% include 'components/store/_home_body.html' %}

View File

@@ -1,8 +1,11 @@
{% extends 'layouts/layout.html' %}
{% block page_head %}
<link rel="preload" as="style" href="{{ url_for('static', filename='dist/css/store_manufacturing_purchase_orders.bundle.css') }}" onload="this.onload=null;this.rel='stylesheet'">
<noscript><link rel="stylesheet" href="{{ url_for('static', filename='dist/css/store_manufacturing_purchase_orders.bundle.css') }}"></noscript>
{% endblock %}
{% block page_body %}
<link rel="stylesheet" href="{{ url_for('static', filename='dist/css/store_manufacturing_purchase_orders.bundle.css') }}">
<form id="{{ model.ID_FORM_FILTERS }}" class="{{ model.FLAG_FILTER }} {{ model.FLAG_ROW }} {{ model.FLAG_CARD }}" action="{{ url_for('routes_store_manufacturing_purchase_order.filter_manufacturing_purchase_order') }}" method="POST"> <!-- {{ model.FLAG_CONTAINER }} -->
{{ model.form_filters.hidden_tag() }}
<div class="{{ model.FLAG_CONTAINER }} {{ model.FLAG_COLUMN }}">
@@ -41,12 +44,12 @@
<table id="{{ model.ID_TABLE_MAIN }}" class="{{ model.FLAG_ROW }} {{ model.FLAG_CARD }}">
<thead>
<tr class="{{ model.FLAG_MANUFACTURING_PURCHASE_ORDER }}">
<th class="{{ model.FLAG_ORDER_ITEMS }} {{ model.FLAG_COLLAPSED }}">Items</th>
<th class="{{ model.FLAG_CURRENCY }}">Currency</th>
<th class="{{ model.FLAG_COST_TOTAL_LOCAL_VAT_EXCL }}">Cost Total VAT Excl.</th>
<th class="{{ model.FLAG_COST_TOTAL_LOCAL_VAT_INCL }}">Cost Total VAT Incl.</th>
<th class="{{ model.FLAG_PRICE_TOTAL_LOCAL_VAT_EXCL }}">Price Total VAT Excl.</th>
<th class="{{ model.FLAG_PRICE_TOTAL_LOCAL_VAT_INCL }}">Price Total VAT Incl.</th>
<th class="{{ model.FLAG_ORDER_ITEMS }} {{ model.FLAG_COLLAPSED }}">Items</th>
<th class="{{ model.FLAG_ACTIVE}}">Active</th>
</tr>
</thead>

View File

@@ -112,7 +112,8 @@
<th class="{{ model.FLAG_DOES_EXPIRE_FASTER_ONCE_UNSEALED }}">Expires Faster Once Unsealed?</th>
<th class="{{ model.FLAG_COUNT_UNIT_MEASUREMENT_INTERVAL_EXPIRATION_UNSEALED }}">Count Interval Expiration Unsealed</th>
<th class="{{ model.FLAG_UNIT_MEASUREMENT_INTERVAL_EXPIRATION_UNSEALED }}">Interval Expiration Unsealed</th>
<th class="{{ model.FLAG_COST_LOCAL }}">Cost</th>
<th class="{{ model.FLAG_COST_LOCAL_VAT_EXCL }}">Cost Local VAT Excl.</th>
<th class="{{ model.FLAG_COST_LOCAL_VAT_INCL }}">Cost Local VAT Incl.</th>
<th class="{{ model.FLAG_CURRENCY_COST }}">Cost Currency</th>
<th class="{{ model.FLAG_PROFIT_LOCAL_MIN }}">Profit Local Min</th>
<th class="{{ model.FLAG_LATENCY_MANUFACTURE }}">Manufacturing Latency</th>

View File

@@ -42,10 +42,10 @@
<thead>
<tr class="{{ model.FLAG_SUPPLIER_PURCHASE_ORDER }}">
<th class="{{ model.FLAG_SUPPLIER }}">Supplier</th>
<th class="{{ model.FLAG_ORDER_ITEMS }} {{ model.FLAG_COLLAPSED }}">Items</th>
<th class="{{ model.FLAG_CURRENCY }}">Currency</th>
<th class="{{ model.FLAG_COST_TOTAL_LOCAL_VAT_EXCL }}">Cost Total VAT Excl.</th>
<th class="{{ model.FLAG_COST_TOTAL_LOCAL_VAT_INCL }}">Cost Total VAT Incl.</th>
<th class="{{ model.FLAG_ORDER_ITEMS }} {{ model.FLAG_COLLAPSED }}">Items</th>
<th class="{{ model.FLAG_ACTIVE}}">Active</th>
</tr>
</thead>