Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

6.12.1 #850

Merged
merged 15 commits into from
Dec 15, 2024
22 changes: 13 additions & 9 deletions db/db.sql
Original file line number Diff line number Diff line change
Expand Up @@ -1576,15 +1576,19 @@ INSERT INTO saltypes (st_id, salcode, salname, salshortname, disabled) VALUES(7,
INSERT INTO saltypes (st_id, salcode, salname, salshortname, disabled) VALUES(8, 300, 'ЕСВ', 'ЕСВ', 0);


INSERT INTO options (optname, optvalue) VALUES('api', 'YTozOntzOjM6ImV4cCI7czowOiIiO3M6Mzoia2V5IjtzOjQ6InRlc3QiO3M6NToiYXR5cGUiO3M6MToiMSI7fQ==');
INSERT INTO options (optname, optvalue) VALUES('common', 'YTozOTp7czo5OiJxdHlkaWdpdHMiO3M6MToiMCI7czo4OiJhbWRpZ2l0cyI7czoxOiIwIjtzOjEwOiJkYXRlZm9ybWF0IjtzOjU6ImQubS5ZIjtzOjExOiJwYXJ0aW9udHlwZSI7czoxOiIxIjtzOjY6InBob25lbCI7czoyOiIxMCI7czo2OiJwcmljZTEiO3M6MTg6ItCg0L7Qt9C00YDRltCx0L3QsCI7czo2OiJwcmljZTIiO3M6MTI6ItCe0L/RgtC+0LLQsCI7czo2OiJwcmljZTMiO3M6MDoiIjtzOjY6InByaWNlNCI7czowOiIiO3M6NjoicHJpY2U1IjtzOjA6IiI7czo4OiJkZWZwcmljZSI7czowOiIiO3M6ODoic2hvcG5hbWUiO3M6MDoiIjtzOjg6InRzX2JyZWFrIjtzOjI6IjYwIjtzOjg6InRzX3N0YXJ0IjtzOjU6IjA5OjAwIjtzOjY6InRzX2VuZCI7czo1OiIxODowMCI7czoxMToiY2hlY2tzbG9nYW4iO3M6MDoiIjtzOjExOiJhdXRvYXJ0aWNsZSI7aToxO3M6MTA6InVzZXNudW1iZXIiO3M6MToiMCI7czoxMDoidXNlc2Nhbm5lciI7aTowO3M6MTY6InVzZW1vYmlsZXNjYW5uZXIiO2k6MDtzOjk6InVzZWltYWdlcyI7aTowO3M6MTQ6InByaW50b3V0cXJjb2RlIjtpOjA7czoxNDoibm9jaGVja2FydGljbGUiO2k6MDtzOjE1OiJzaG93YWN0aXZldXNlcnMiO2k6MDtzOjg6InNob3djaGF0IjtpOjA7czoxMDoidXNlY2F0dHJlZSI7aTowO3M6OToidXNlYnJhbmNoIjtpOjA7czoxMDoibm9hbGxvd2ZpeiI7aTowO3M6MTA6ImFsbG93bWludXMiO2k6MDtzOjY6InVzZXZhbCI7aTowO3M6NjoiY2FwY2hhIjtpOjA7czo5OiJudW1iZXJ0dG4iO2k6MDtzOjk6InBheXR5cGVpbiI7czoxOiIwIjtzOjEwOiJwYXl0eXBlb3V0IjtzOjE6IjAiO3M6MTI6ImFsbG93bWludXNtZiI7aTowO3M6NzoiY2FzaGllciI7czowOiIiO3M6MTA6ImFjdHVhbGRhdGUiO2k6MTcwNDA2MDAwMDtzOjE0OiJzcHJlYWRkZWxpdmVyeSI7aTowO3M6MTE6ImJheWRlbGl2ZXJ5IjtpOjA7fQ==');
INSERT INTO options (optname, optvalue) VALUES('discount', 'YToxODp7czo4OiJmaXJzdGJheSI7czoyOiIxMSI7czo2OiJib251czEiO3M6MzoiMS4xIjtzOjY6ImxldmVsMiI7czowOiIiO3M6NjoiYm9udXMyIjtzOjM6IjEuNCI7czo2OiJzdW1tYTEiO3M6MzoiMTAwIjtzOjY6InN1bW1hMiI7czo0OiIxMDAwIjtzOjY6ImJvbnVzMyI7czoxOiIzIjtzOjY6InN1bW1hMyI7czo0OiIzMDAwIjtzOjY6ImJvbnVzNCI7czoxOiI0IjtzOjY6InN1bW1hNCI7czo0OiI0MDAwIjtzOjU6ImRpc2MxIjtzOjE6IjEiO3M6MTA6ImRpc2NzdW1tYTEiO3M6MToiMCI7czo1OiJkaXNjMiI7czoxOiIzIjtzOjEwOiJkaXNjc3VtbWEyIjtzOjE6IjAiO3M6NToiZGlzYzMiO3M6MToiNyI7czoxMDoiZGlzY3N1bW1hMyI7czoxOiIwIjtzOjU6ImRpc2M0IjtzOjA6IiI7czoxMDoiZGlzY3N1bW1hNCI7czowOiIiO30=');
INSERT INTO options (optname, optvalue) VALUES('food', 'YToxNTp7czo4OiJ3b3JrdHlwZSI7czoxOiIyIjtzOjk6InByaWNldHlwZSI7czo2OiJwcmljZTEiO3M6ODoiZGVsaXZlcnkiO2k6MTtzOjY6InRhYmxlcyI7aToxO3M6NDoicGFjayI7aToxO3M6NDoibWVudSI7aToxO3M6NDoibmFtZSI7czo2OiJkZGRkZGQiO3M6NToicGhvbmUiO3M6ODoiNTU1NTU1NTUiO3M6NjoidGltZXBuIjtzOjI6IjExIjtzOjY6InRpbWVzYSI7czowOiIiO3M6NjoidGltZXN1IjtzOjA6IiI7czoxMjoiZm9vZGJhc2VtZW51IjtzOjE6IjAiO3M6MTY6ImZvb2RiYXNlbWVudW5hbWUiO3M6MDoiIjtzOjk6ImZvb2RtZW51MiI7czoxOiIwIjtzOjEyOiJmb29kbWVudW5hbWUiO3M6MDoiIjt9');
INSERT INTO options (optname, optvalue) VALUES('printer', 'YTo3OntzOjg6InBtYXhuYW1lIjtzOjE6IjciO3M6OToicHJpY2V0eXBlIjtzOjY6InByaWNlMSI7czoxMToiYmFyY29kZXR5cGUiO3M6NDoiQzEyOCI7czo2OiJwcHJpY2UiO2k6MTtzOjU6InBjb2RlIjtpOjE7czo4OiJwYmFyY29kZSI7aToxO3M6NzoicHFyY29kZSI7aTowO30=');
INSERT INTO options (optname, optvalue) VALUES('salary', 'YTo1OntzOjEzOiJjb2RlYmFzZWluY29tIjtzOjM6IjEwNSI7czoxMDoiY29kZXJlc3VsdCI7czozOiI5MDAiO3M6NDoiY2FsYyI7czoyMTk6InYyMDAgPSB2MTA1DQovL9C');
INSERT INTO options (optname, optvalue) VALUES('shop', 'YToyMDp7czo3OiJkZWZjdXN0IjtzOjE6IjEiO3M6MTE6ImRlZmN1c3RuYW1lIjtzOjI5OiLQm9C10L7QvdC40LQg0JzQsNGA0YLRi9C90Y7QuiI7czo5OiJkZWZicmFuY2giO047czo5OiJvcmRlcnR5cGUiO3M6MToiMCI7czoxMjoiZGVmcHJpY2V0eXBlIjtzOjY6InByaWNlMSI7czo1OiJlbWFpbCI7czowOiIiO3M6ODoic2hvcG5hbWUiO3M6MTc6ItCd0LDRiCDQvNCw0LPQsNC3IjtzOjEyOiJjdXJyZW5jeW5hbWUiO3M6Njoi0YDRg9CxIjtzOjg6InVzZWxvZ2luIjtpOjA7czo5OiJ1c2VmaWx0ZXIiO2k6MDtzOjEzOiJjcmVhdGVuZXdjdXN0IjtpOjA7czoxMToidXNlZmVlZGJhY2siO2k6MDtzOjExOiJ1c2VtYWlucGFnZSI7aTowO3M6NzoiYWJvdXR1cyI7czoxNjoiUEhBK1BHSnlQand2Y0Q0PSI7czo3OiJjb250YWN0IjtzOjA6IiI7czo4OiJkZWxpdmVyeSI7czowOiIiO3M6NDoibmV3cyI7czowOiIiO3M6NToicGFnZXMiO2E6Mjp7czo0OiJuZXdzIjtPOjEyOiJBcHBcRGF0YUl0ZW0iOjI6e3M6MjoiaWQiO047czo5OiIAKgBmaWVsZHMiO2E6NDp7czo0OiJsaW5rIjtzOjQ6Im5ld3MiO3M6NToidGl0bGUiO3M6MTE6Imtra3JycnJycnJyIjtzOjU6Im9yZGVyIjtzOjE6IjIiO3M6NDoidGV4dCI7czoyNDoiUEhBK1pXVmxaV1ZsWldWbFBDOXdQZz09Ijt9fXM6ODoiYWJvdXRfdXMiO086MTI6IkFwcFxEYXRhSXRlbSI6Mjp7czoyOiJpZCI7TjtzOjk6IgAqAGZpZWxkcyI7YTo0OntzOjQ6ImxpbmsiO3M6ODoiYWJvdXRfdXMiO3M6NToidGl0bGUiO3M6OToi0J4g0L3QsNGBIjtzOjU6Im9yZGVyIjtzOjE6IjMiO3M6NDoidGV4dCI7czozMjoiUEhBK1BHSSswSjRnMEwzUXNOR0JQQzlpUGp3dmNEND0iO319fXM6NToicGhvbmUiO3M6MDoiIjtzOjEwOiJzYWxlc291cmNlIjtzOjE6IjAiO30=');
INSERT INTO options (optname, optvalue) VALUES('val', 'YToyOntzOjc6InZhbGxpc3QiO2E6MTp7aToxNjQyNjc1OTU1O086MTI6IkFwcFxEYXRhSXRlbSI6Mjp7czoyOiJpZCI7aToxNjQyNjc1OTU1O3M6OToiACoAZmllbGRzIjthOjM6e3M6NDoiY29kZSI7czozOiJVU0QiO3M6NDoibmFtZSI7czoxMDoi0JTQvtC70LDRgCI7czo0OiJyYXRlIjtzOjI6IjYwIjt9fX1zOjg6InZhbHByaWNlIjtpOjE7fQ==');
INSERT INTO options (optname, optvalue) VALUES('version', '6.12.0');
INSERT INTO `options` (`optname`, `optvalue`) VALUES('api', 'YTozOntzOjM6ImV4cCI7czowOiIiO3M6Mzoia2V5IjtzOjQ6InRlc3QiO3M6NToiYXR5cGUiO3M6MToiMSI7fQ==');
INSERT INTO `options` (`optname`, `optvalue`) VALUES('common', 'YTo0Mjp7czo5OiJxdHlkaWdpdHMiO3M6MToiMCI7czo4OiJhbWRpZ2l0cyI7czoxOiIwIjtzOjEwOiJkYXRlZm9ybWF0IjtzOjU6ImQubS5ZIjtzOjExOiJwYXJ0aW9udHlwZSI7czoxOiIxIjtzOjY6InBob25lbCI7czoyOiIxMCI7czo2OiJwcmljZTEiO3M6MTg6ItCg0L7Qt9C00YDRltCx0L3QsCI7czo2OiJwcmljZTIiO3M6MTI6ItCe0L/RgtC+0LLQsCI7czo2OiJwcmljZTMiO3M6MDoiIjtzOjY6InByaWNlNCI7czowOiIiO3M6NjoicHJpY2U1IjtzOjA6IiI7czo4OiJkZWZwcmljZSI7czowOiIiO3M6ODoic2hvcG5hbWUiO3M6MDoiIjtzOjg6InRzX2JyZWFrIjtzOjI6IjYwIjtzOjg6InRzX3N0YXJ0IjtzOjU6IjA5OjAwIjtzOjY6InRzX2VuZCI7czo1OiIxODowMCI7czoxMToiY2hlY2tzbG9nYW4iO3M6MDoiIjtzOjExOiJhdXRvYXJ0aWNsZSI7aToxO3M6MTA6InVzZXNudW1iZXIiO3M6MToiMCI7czoxMDoidXNlc2Nhbm5lciI7aTowO3M6MTY6InVzZW1vYmlsZXNjYW5uZXIiO2k6MDtzOjk6InVzZWltYWdlcyI7aTowO3M6MTQ6InByaW50b3V0cXJjb2RlIjtpOjA7czoxNDoibm9jaGVja2FydGljbGUiO2k6MDtzOjE1OiJzaG93YWN0aXZldXNlcnMiO2k6MDtzOjg6InNob3djaGF0IjtpOjA7czoxMDoidXNlY2F0dHJlZSI7aTowO3M6OToidXNlYnJhbmNoIjtpOjA7czoxMDoibm9hbGxvd2ZpeiI7aTowO3M6MTA6ImFsbG93bWludXMiO2k6MDtzOjY6InVzZXZhbCI7aTowO3M6NjoiY2FwY2hhIjtpOjA7czo5OiJudW1iZXJ0dG4iO2k6MDtzOjk6InBheXR5cGVpbiI7czoxOiIwIjtzOjEwOiJwYXl0eXBlb3V0IjtzOjE6IjAiO3M6MTI6ImFsbG93bWludXNtZiI7aTowO3M6NzoiY2FzaGllciI7czowOiIiO3M6MTA6ImFjdHVhbGRhdGUiO2k6MTcwNDA2MDAwMDtzOjE0OiJzcHJlYWRkZWxpdmVyeSI7aTowO3M6MTE6ImJheWRlbGl2ZXJ5IjtpOjA7czo4OiJub3VwZGF0ZSI7aTowO3M6NzoiY2hlY2tpcCI7aTowO3M6NjoiaXBsaXN0IjtzOjA6IiI7fQ==');
INSERT INTO `options` (`optname`, `optvalue`) VALUES('discount', 'YToxODp7czo4OiJmaXJzdGJheSI7czoyOiIxMSI7czo2OiJib251czEiO3M6MzoiMS4xIjtzOjY6ImxldmVsMiI7czowOiIiO3M6NjoiYm9udXMyIjtzOjM6IjEuNCI7czo2OiJzdW1tYTEiO3M6MzoiMTAwIjtzOjY6InN1bW1hMiI7czo0OiIxMDAwIjtzOjY6ImJvbnVzMyI7czoxOiIzIjtzOjY6InN1bW1hMyI7czo0OiIzMDAwIjtzOjY6ImJvbnVzNCI7czoxOiI0IjtzOjY6InN1bW1hNCI7czo0OiI0MDAwIjtzOjU6ImRpc2MxIjtzOjE6IjEiO3M6MTA6ImRpc2NzdW1tYTEiO3M6MToiMCI7czo1OiJkaXNjMiI7czoxOiIzIjtzOjEwOiJkaXNjc3VtbWEyIjtzOjE6IjAiO3M6NToiZGlzYzMiO3M6MToiNyI7czoxMDoiZGlzY3N1bW1hMyI7czoxOiIwIjtzOjU6ImRpc2M0IjtzOjA6IiI7czoxMDoiZGlzY3N1bW1hNCI7czowOiIiO30=');
INSERT INTO `options` (`optname`, `optvalue`) VALUES('food', 'YToxNTp7czo4OiJ3b3JrdHlwZSI7czoxOiIyIjtzOjk6InByaWNldHlwZSI7czo2OiJwcmljZTEiO3M6ODoiZGVsaXZlcnkiO2k6MTtzOjY6InRhYmxlcyI7aToxO3M6NDoicGFjayI7aToxO3M6NDoibWVudSI7aToxO3M6NDoibmFtZSI7czo2OiJkZGRkZGQiO3M6NToicGhvbmUiO3M6ODoiNTU1NTU1NTUiO3M6NjoidGltZXBuIjtzOjI6IjExIjtzOjY6InRpbWVzYSI7czowOiIiO3M6NjoidGltZXN1IjtzOjA6IiI7czoxMjoiZm9vZGJhc2VtZW51IjtzOjE6IjAiO3M6MTY6ImZvb2RiYXNlbWVudW5hbWUiO3M6MDoiIjtzOjk6ImZvb2RtZW51MiI7czoxOiIwIjtzOjEyOiJmb29kbWVudW5hbWUiO3M6MDoiIjt9');
INSERT INTO `options` (`optname`, `optvalue`) VALUES('modules', 'YToxMjp7czo3OiJvY3N0b3JlIjtpOjA7czo0OiJzaG9wIjtpOjA7czoxMDoid29vY29tZXJjZSI7aTowO3M6MjoibnAiO2k6MDtzOjY6InByb211YSI7aTowO3M6ODoiaG9yb3Nob3AiO2k6MDtzOjQ6InZkb2MiO2k6MDtzOjU6Imlzc3VlIjtpOjA7czo0OiJub3RlIjtpOjA7czozOiJwcG8iO2k6MDtzOjg6ImNoZWNrYm94IjtpOjA7czo2OiJ2a2Fzc2EiO2k6MDt9');
INSERT INTO `options` (`optname`, `optvalue`) VALUES('printer', 'YTo3OntzOjg6InBtYXhuYW1lIjtzOjE6IjciO3M6OToicHJpY2V0eXBlIjtzOjY6InByaWNlMSI7czoxMToiYmFyY29kZXR5cGUiO3M6NDoiQzEyOCI7czo2OiJwcHJpY2UiO2k6MTtzOjU6InBjb2RlIjtpOjE7czo4OiJwYmFyY29kZSI7aToxO3M6NzoicHFyY29kZSI7aTowO30=');
INSERT INTO `options` (`optname`, `optvalue`) VALUES('salary', 'YTo1OntzOjEzOiJjb2RlYmFzZWluY29tIjtzOjM6IjEwNSI7czoxMDoiY29kZXJlc3VsdCI7czozOiI5MDAiO3M6NDoiY2FsYyI7czoyMTk6InYyMDAgPSB2MTA1DQovL9C');
INSERT INTO `options` (`optname`, `optvalue`) VALUES('shop', 'YToyMDp7czo3OiJkZWZjdXN0IjtzOjE6IjEiO3M6MTE6ImRlZmN1c3RuYW1lIjtzOjI5OiLQm9C10L7QvdC40LQg0JzQsNGA0YLRi9C90Y7QuiI7czo5OiJkZWZicmFuY2giO047czo5OiJvcmRlcnR5cGUiO3M6MToiMCI7czoxMjoiZGVmcHJpY2V0eXBlIjtzOjY6InByaWNlMSI7czo1OiJlbWFpbCI7czowOiIiO3M6ODoic2hvcG5hbWUiO3M6MTc6ItCd0LDRiCDQvNCw0LPQsNC3IjtzOjEyOiJjdXJyZW5jeW5hbWUiO3M6Njoi0YDRg9CxIjtzOjg6InVzZWxvZ2luIjtpOjA7czo5OiJ1c2VmaWx0ZXIiO2k6MDtzOjEzOiJjcmVhdGVuZXdjdXN0IjtpOjA7czoxMToidXNlZmVlZGJhY2siO2k6MDtzOjExOiJ1c2VtYWlucGFnZSI7aTowO3M6NzoiYWJvdXR1cyI7czoxNjoiUEhBK1BHSnlQand2Y0Q0PSI7czo3OiJjb250YWN0IjtzOjA6IiI7czo4OiJkZWxpdmVyeSI7czowOiIiO3M6NDoibmV3cyI7czowOiIiO3M6NToicGFnZXMiO2E6Mjp7czo0OiJuZXdzIjtPOjEyOiJBcHBcRGF0YUl0ZW0iOjI6e3M6MjoiaWQiO047czo5OiIAKgBmaWVsZHMiO2E6NDp7czo0OiJsaW5rIjtzOjQ6Im5ld3MiO3M6NToidGl0bGUiO3M6MTE6Imtra3JycnJycnJyIjtzOjU6Im9yZGVyIjtzOjE6IjIiO3M6NDoidGV4dCI7czoyNDoiUEhBK1pXVmxaV1ZsWldWbFBDOXdQZz09Ijt9fXM6ODoiYWJvdXRfdXMiO086MTI6IkFwcFxEYXRhSXRlbSI6Mjp7czoyOiJpZCI7TjtzOjk6IgAqAGZpZWxkcyI7YTo0OntzOjQ6ImxpbmsiO3M6ODoiYWJvdXRfdXMiO3M6NToidGl0bGUiO3M6OToi0J4g0L3QsNGBIjtzOjU6Im9yZGVyIjtzOjE6IjMiO3M6NDoidGV4dCI7czozMjoiUEhBK1BHSSswSjRnMEwzUXNOR0JQQzlpUGp3dmNEND0iO319fXM6NToicGhvbmUiO3M6MDoiIjtzOjEwOiJzYWxlc291cmNlIjtzOjE6IjAiO30=');
INSERT INTO `options` (`optname`, `optvalue`) VALUES('sms', 'YToxMTp7czoxMjoic21zY2x1YnRva2VuIjtzOjA6IiI7czoxMjoic21zY2x1YmxvZ2luIjtzOjA6IiI7czoxMToic21zY2x1YnBhc3MiO3M6MDoiIjtzOjk6InNtc2NsdWJhbiI7czowOiIiO3M6MTA6InNtc2NsdWJ2YW4iO3M6MDoiIjtzOjEyOiJzbXNzZW15dG9rZW4iO3M6MDoiIjtzOjEyOiJzbXNzZW15ZGV2aWQiO3M6MDoiIjtzOjExOiJmbHlzbXNsb2dpbiI7czowOiIiO3M6MTA6ImZseXNtc3Bhc3MiO3M6MDoiIjtzOjg6ImZseXNtc2FuIjtzOjA6IiI7czo3OiJzbXN0eXBlIjtzOjE6IjAiO30=');
INSERT INTO `options` (`optname`, `optvalue`) VALUES('val', 'YToyOntzOjc6InZhbGxpc3QiO2E6MTp7aToxNjQyNjc1OTU1O086MTI6IkFwcFxEYXRhSXRlbSI6Mjp7czoyOiJpZCI7aToxNjQyNjc1OTU1O3M6OToiACoAZmllbGRzIjthOjM6e3M6NDoiY29kZSI7czozOiJVU0QiO3M6NDoibmFtZSI7czoxMDoi0JTQvtC70LDRgCI7czo0OiJyYXRlIjtzOjI6IjYwIjt9fX1zOjg6InZhbHByaWNlIjtpOjE7fQ==');
INSERT INTO `options` (`optname`, `optvalue`) VALUES('version', '6.12.0');





Expand Down
2 changes: 1 addition & 1 deletion www/app/entity/category.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ protected function init() {

protected function afterLoad() {

\App\Helper::log($this->detail);

$xml = @simplexml_load_string($this->detail);

$this->price1 = (string)($xml->price1[0]);
Expand Down
32 changes: 30 additions & 2 deletions www/app/entity/doc/order.php
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,6 @@ public function reserve() {

}
}

}
//отмена резерва
public function unreserve() {
Expand Down Expand Up @@ -301,5 +300,34 @@ public function DoBalans() {
}

}

/**
* список неотправленных позиций
*
*/
public function getNotSendedItem() {
$notsendqty=[];
$sendqty=[];
$notsend=0;
$docs= Document::find("state >=5 and meta_name in ('GoodsIssue','TTN') and parent_id=". $this->document_id);
foreach($docs as $d) {
foreach($d->unpackDetails('detaildata') as $item){
if(!isset($sendqty[$item->item_id]) ) $sendqty[$item->item_id]=0;

$sendqty[$item->item_id] += $item->quantity;
}
}
foreach($this->unpackDetails('detaildata') as $item){
if(($sendqty[$item->item_id] ?? 0) ==0) {
$notsend=$item->quantity;
} else {
$notsend=$item->quantity - $sendqty[$item->item_id];
}
if($notsend > 0) {
$notsendqty[$item->item_id] = $notsend;
}

}

return $notsendqty;
}
}
31 changes: 31 additions & 0 deletions www/app/entity/doc/ordercust.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,35 @@ public function getRelationBased() {
return $list;
}


/**
* список неоприходованых позиций
*
*/
public function getNotReceivedItems() :array{
$notrecqty=[];
$recqty=[];
$notrec=0;
$docs= Document::find("state >=5 and meta_name in ('GoodsReceipt') and parent_id=". $this->document_id);
foreach($docs as $d) {
foreach($d->unpackDetails('detaildata') as $item){
if(!isset($recqty[$item->item_id]) ) $recqty[$item->item_id]=0;

$recqty[$item->item_id] += $item->quantity;
}
}
foreach($this->unpackDetails('detaildata') as $item){
if(($recqty[$item->item_id] ?? 0) ==0) {
$notrec=$item->quantity;
} else {
$notrec=$item->quantity - $recqty[$item->item_id];
}
if($notrec > 0) {
$notrecqty[$item->item_id]= $notrec;
}

}

return $notrecqty;
}
}
20 changes: 1 addition & 19 deletions www/app/entity/doc/ttn.php
Original file line number Diff line number Diff line change
Expand Up @@ -275,25 +275,7 @@ public function onState($state, $oldstate) {

}
}
$common = \App\System::getOptions("common");

if ($this->parent_id > 0) {
$order = Document::load($this->parent_id);

$list = $order->getChildren('TTN');

if (count($list) == 1 && $common['numberttn'] <> 1) { //только эта ТТН
if ($state == Document::STATE_DELIVERED && ($order->state == Document::STATE_INSHIPMENT || $order->state == Document::STATE_READYTOSHIP || $order->state == Document::STATE_INPROCESS)) {
$order->updateStatus(Document::STATE_DELIVERED);
}
if ($state == Document::STATE_INSHIPMENT && ($order->state == Document::STATE_INPROCESS || $order->state == Document::STATE_READYTOSHIP)) {
$order->updateStatus(Document::STATE_INSHIPMENT);
}
if ($state == Document::STATE_READYTOSHIP && $order->state == Document::STATE_INPROCESS) {
$order->updateStatus(Document::STATE_READYTOSHIP);
}
}
}

}

public function getRelationBased() {
Expand Down
4 changes: 2 additions & 2 deletions www/app/entity/entry.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public static function getQuantity($date = 0, $stock = 0, $customer = 0, $emp =
$conn = \ZDB\DB::getConnect();
$where = " 1=1";
if ($date > 0) {
$where = $where . " date(document_date) <= " . $conn->DBDate($date);
$where = $where . " document_date <= " . $conn->DBDate($date);
}

if ($emp > 0) {
Expand Down Expand Up @@ -109,7 +109,7 @@ public static function getAmount($date = 0, $stock = 0, $customer = 0, $emp = 0)
$conn = \ZDB\DB::getConnect();
$where = " 1=1";
if ($date > 0) {
$where = $where . " and date(document_date) <= " . $conn->DBDate($date);
$where = $where . " and document_date <= " . $conn->DBDate($date);
}

if ($emp > 0) {
Expand Down
2 changes: 1 addition & 1 deletion www/app/entity/stock.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public static function getQuantity($stock_id, $date = null) {
$stock = Stock::load($stock_id);
if ($date > 0) {
$conn = \ZDB\DB::getConnect();
$where = " stock_id = {$stock_id} and date(document_date) <= " . $conn->DBDate($date);
$where = " stock_id = {$stock_id} and document_date <= " . $conn->DBDate($date);
$sql = " select coalesce(sum(quantity),0) AS quantity from entrylist_view where " . $where;
return $conn->GetOne($sql);
} else {
Expand Down
2 changes: 1 addition & 1 deletion www/app/entity/subscribe.php
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ private function sendmsg($text, $options=[]){
$ret = self::sendSMS($options['phone'], $text);
}
if (strlen($options['email']) > 0 && $this->msg_type == self::MSG_EMAIL) {

// отправляем в очередь если включен планировщик
if(System::useCron()) {
$task = new \App\Entity\CronTask();
$task->tasktype=\App\Entity\CronTask::TYPE_SUBSEMAIL;
Expand Down
35 changes: 24 additions & 11 deletions www/app/modules/note/entity/topic.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,27 +17,40 @@ protected function init() {

protected function beforeSave() {
parent::beforeSave();
//упаковываем данные в detail

/*
$this->content = "<content>";
$this->detail = base64_encode($this->detail) ;
$this->content .= "<detail>{$this->detail}</detail>";
$this->content .= "<isbasa64>1</isbasa64>";
$this->content .= "<updatedon>{$this->updatedon}</updatedon>";
$this->content .= "</content>";

return true;
*/

$content=[] ;
$content['detail'] =$this->detail ;
$content['updatedon'] =$this->updatedon ;
$this->content = serialize($content) ;

}

protected function afterLoad() {
//распаковываем данные из detail
$xml = @simplexml_load_string($this->content);

$this->detail = (string)($xml->detail[0]);
$this->isbasa64 = (int)($xml->isbasa64[0]);
if($this->isbasa64==1) {
$this->detail = base64_decode($this->detail) ;

if(strpos($this->content,'<content>') ===0 ) {
$xml = @simplexml_load_string($this->content);

$this->detail = (string)($xml->detail[0]);
$this->isbasa64 = (int)($xml->isbasa64[0]);
if($this->isbasa64==1) {
$this->detail = base64_decode($this->detail) ;
}
$this->updatedon = (int)($xml->updatedon[0]);
} else {
$content = unserialize($this->content) ;
$this->updatedon = $content['updatedon'] ;
$this->detail = $content['detail'] ;
}
$this->updatedon = (int)($xml->updatedon[0]);


parent::afterLoad();
}
Expand Down
2 changes: 1 addition & 1 deletion www/app/modules/ocstore/orders.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public function filterOnSubmit($sender) {
foreach ($data['orders'] as $ocorder) {


$cnt = $conn->getOne("select count(*) from documents_view where (meta_name='Order' or meta_name='TTN') and content like '%<ocorder>{$ocorder['order_id']}</ocorder>%'") ;
$cnt = $conn->getOne("select count(*) from documents_view where (meta_name='Order' or meta_name='TTN') and content like '%<ocorder>{$ocorder['order_id']}</ocorder>%' and (CURRENT_DATE - INTERVAL 1 MONTH) < document_date ") ;

if (intval($cnt) > 0) { //уже импортирован
continue;
Expand Down
6 changes: 3 additions & 3 deletions www/app/modules/shop/pages/admin/dashboard.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ public function updateGraph() {
$this->_tvars['ord'] = json_encode($ord);

$sql = " content LIKE '%<shoporder>1</shoporder>%' " ;
$sql .= " and date(document_date) <= " . $conn->DBDAte(time());
$sql .= " and date(document_date) > " . $conn->DBDAte(strtotime("- 30 day", time()));
$sql .= " and (document_date) <= " . $conn->DBDAte(time());
$sql .= " and (document_date) > " . $conn->DBDAte(strtotime("- 30 day", time()));

$items = array();
$cats = array();
Expand Down Expand Up @@ -151,7 +151,7 @@ public function updateGraph() {

$sql = " state in (9,10,20) and
content LIKE '%<shoporder>1</shoporder>%'
and date(document_date) <= {$to} and date(document_date) > {$from} " ;
and (document_date) <= {$to} and (document_date) > {$from} " ;

$docs = \App\Entity\Doc\Document::find($sql);

Expand Down
4 changes: 1 addition & 3 deletions www/app/modules/wc/items.php
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,7 @@ public function onUpdateQty($sender) {
return;
}
$c = count($data);

\App\Helper::log($page*$c);


if ($c == 0) {
break;
}
Expand Down
Loading