text: !function(e){var t={};function n(i){if(t[i])return t[i].exports;var o=t[i]={i:i,l:!1,exports:{}};return e[i].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,i){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(i,o,function(t){return e[t]}.bind(null,o));return i},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="/codebase/",n(n.s=17)}([function(e,t,n){"use strict";function i(e){e.translates=s(a({method:"get_translates",kwargs:{user:"XXX"}},!0).response,"s").data,e.states=s(a({method:"get_states",kwargs:{user:"XXX"}},!0).response,"s").data}function o(e){var t=document.app;return t&&t.translates?t.translates[e]:"undefined"}function r(e,t,n){console.log("loading error"),console.log(e),console.log(t),console.log(n),n.status}function a(e,t){var n="../remote_api/";return!0===t?webix.ajax().sync().headers({"Content-type":"application/json"}).post(n,e,{error:r}):webix.ajax().timeout(9e4).headers({"Content-type":"application/json"}).post(n,e,{error:r})}function s(e,t){var n,i={};return"s"===t?n=JSON.parse(e):"a"===t&&(n=e.json()),n&&n.result&&n.result[0]&&n.result[0].data&&(i=n.result[0]),n&&n.result&&n.result.data&&(i=n.result),i}function c(e){var t=document.cookie.match(new RegExp("(?:^|; )"+e.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g,"\\$1")+"=([^;]*)"));return t?decodeURIComponent(t[1]):NaN}function l(e,t,n){var i=(n=n||{}).expires;if("number"==typeof i&&i){var o=new Date;o.setTime(o.getTime()+1e3*i),i=n.expires=o}i&&i.toUTCString&&(n.expires=i.toUTCString());var r=e+"="+(t=encodeURIComponent(t));for(var a in n){r+="; "+a;var s=n[a];!0!==s&&(r+="="+s)}document.cookie=r}function d(e){l(e,"",{expires:-1,path:"/"})}function u(){return $$("sklad_main_ui").$scope.app.config.user}n.r(t),n.d(t,"getRefs",(function(){return i})),n.d(t,"names",(function(){return o})),n.d(t,"request",(function(){return a})),n.d(t,"checkResponse",(function(){return s})),n.d(t,"getCookie",(function(){return c})),n.d(t,"setCookie",(function(){return l})),n.d(t,"deleteCookie",(function(){return d})),n.d(t,"getUser",(function(){return u})),n.d(t,"formatText",(function(){return h}));var h={parse:function(e){return e},edit:function(e){return webix.Number.formatNumber(e)}}},function(e,t,n){"use strict";n.d(t,"e",(function(){return o})),n.d(t,"g",(function(){return r})),n.d(t,"m",(function(){return a})),n.d(t,"l",(function(){return s})),n.d(t,"b",(function(){return c})),n.d(t,"a",(function(){return l})),n.d(t,"f",(function(){return d})),n.d(t,"j",(function(){return u})),n.d(t,"k",(function(){return h})),n.d(t,"h",(function(){return p})),n.d(t,"d",(function(){return _})),n.d(t,"i",(function(){return f})),n.d(t,"c",(function(){return m}));var i=n(0);function o(e,t){return-1!=e.value.toString().toLowerCase().indexOf(t)}function r(e){var t={method:"gen_doc_number",kwargs:{user:Object(i.getUser)(),doc_type:e}};return Object(i.checkResponse)(Object(i.request)(t,!0).response,"s")}function a(e,t){var n={method:"set_point_limit",kwargs:{user:Object(i.getUser)(),n_limit:t,row_id:e}};return Object(i.checkResponse)(Object(i.request)(n,!0).response,"s")}var s={new_report:function(e,t){var n={method:"generate_report.generate",kwargs:{user:Object(i.getUser)(),doc_type:e,doc_number:t}},o=Object(i.checkResponse)(Object(i.request)(n,!0).response,"s");if(o.data&&o.data.link)window.open(o.data.link,"_blank");else if(o.data&&o.data.binary&&o.data.file_name){var r=new Blob([w(o.data.binary)]);webix.html.download(r,o.data.file_name)}},new_product_movement:function(e,t,n,o,r){var a={method:"generate_report.product_movement",kwargs:{user:Object(i.getUser)(),date1:e,date2:t,arr_fg:n,dep_fg:o,item_id:r}};console.log(a);var s=Object(i.checkResponse)(Object(i.request)(a,!0).response,"s");if(s.data||document.message("Нет данных для печати","error",3),s.data&&s.data.link)window.open(s.data.link,"_blank");else if(s.data&&s.data.binary&&s.data.file_name){var c=new Blob([w(s.data.binary)]);webix.html.download(c,s.data.file_name)}}},c={code:function(e){var t={method:"check_prod_code",kwargs:{user:Object(i.getUser)(),code:e}},n=Object(i.checkResponse)(Object(i.request)(t,!0).response,"s");return!(!n||!n.data||!0!==n.data)},opened:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=localStorage.getItem("opened"),i=new Set;if(t)n&&(i=new Set(n.split(";"))).delete(e);else{if(n&&(i=new Set(n.split(";"))).has(e))return!1;i.add(e)}return i=(i=Array.from(i)).join(";"),localStorage.setItem("opened",i),!0}},l={get_all:function(e){var t={method:"balances.get_products",kwargs:{user:Object(i.getUser)(),ids:e}};return Object(i.checkResponse)(Object(i.request)(t,!0).response,"s")},set_charge:function(e){var t={method:"balances.set_charge_to_price",kwargs:{user:Object(i.getUser)(),data:e}};return Object(i.checkResponse)(Object(i.request)(t,!0).response,"s")},get_data:function(e,t){var n={n_product:t.$scope.getFilter()},o=b(e,t,"",n);t.config.sorting=o.filters.sort;var r={method:"balances.get_data",kwargs:o};return Object(i.request)(r).then((function(e){return e=Object(i.checkResponse)(e,"a")}))}},d={get_data:function(e,t){var n=void 0;t.$scope&&t.$scope.parent&&t.$scope.parent.doc_type?"Отгрузка"==t.$scope.parent.doc_type?n="shipment":"Приходная накладная"==t.$scope.parent.doc_type?n="arrival":"Перемещение"==t.$scope.parent.doc_type?n="movement":"Заказ покупателя"==t.$scope.parent.doc_type&&(n="order"):t.config&&t.config.ordersFg&&(n="order");var o={method:"get_filter_list",kwargs:{user:Object(i.getUser)(),filterName:t.config.parentName,docType:n}};return Object(i.request)(o).then((function(e){return e=Object(i.checkResponse)(e,"a")}))},get_ref_filters:function(e,t){var n=t.$scope.cfg,o={method:"get_ref_filters",kwargs:{user:Object(i.getUser)(),reference:n.reference,field:n.name}};return Object(i.request)(o).then((function(e){return e=Object(i.checkResponse)(e,"a")}))},get_prod_filters:function(e,t){var n={method:"get_product_filters",kwargs:{user:Object(i.getUser)(),filterName:t.config.parentName}};return Object(i.request)(n).then((function(e){return e=Object(i.checkResponse)(e,"a")}))}},u={get:function(e,t){var n={method:"get_"+t,kwargs:{user:Object(i.getUser)(),p_id:e}};return Object(i.checkResponse)(Object(i.request)(n,!0).response,"s")},save:function(e,t){var n={method:"save_"+t,kwargs:{user:Object(i.getUser)(),doc_data:e}};return Object(i.checkResponse)(Object(i.request)(n,!0).response,"s")}},h={checkmark:function(e){var t=void 0;if("_products_"==e.table&&(t="products_checkmark"),t){var n={method:t,kwargs:{user:Object(i.getUser)(),item_id:e.item_id,item_code:e.item_code,field:e.field,value:e.value}};return Object(i.checkResponse)(Object(i.request)(n,!0).response,"s")}return{}},get:function(e,t){var n={method:"get_ref_element",kwargs:{user:Object(i.getUser)(),p_id:e,reference:t}};return Object(i.checkResponse)(Object(i.request)(n,!0).response,"s")},set:function(e,t){var n={method:"save_ref_element",kwargs:{user:Object(i.getUser)(),doc_data:e,reference:t}},o=Object(i.checkResponse)(Object(i.request)(n,!0).response,"s");return o.data[0].hasOwnProperty("n_type_name")?o.data[0].n_type=o.data[0].n_type_name:o.data[0].hasOwnProperty("c_cat_name")?o.data[0].c_cat=o.data[0].c_cat_name:o.data[0].hasOwnProperty("c_dir_name")?o.data[0].c_dir=o.data[0].c_dir_name:o.data[0].hasOwnProperty("c_parent_name")&&(o.data[0].c_parent=o.data[0].c_parent_name),o}},p={ref_data:function(e,t){var n={n_name:t.$scope.cfg.topParent.getFilter(),reference:t.$scope.cfg.name};e||(e={sort:$$(t.$scope.cfg.id).config.sorting}),e=Object.assign(e,{filters:n}),$$(t.$scope.cfg.id).config.sorting=e.sort;var o={method:"get_reference",kwargs:{user:Object(i.getUser)(),filters:e}};return Object(i.request)(o).then((function(e){return e=Object(i.checkResponse)(e,"a")}))},product_data:function(e,t){var n={c_name:t.$scope.cfg.topParent.getFilter()},o=b(e,t,"",n);t.config.sorting=o.filters.sort;var r={method:"get_products",kwargs:o};return Object(i.request)(r).then((function(e){return e=Object(i.checkResponse)(e,"a")}))},credentionals:function(e){var t={method:"get_credentionals",kwargs:{user:e}},n=Object(i.request)(t,!0).response;return Object(i.checkResponse)(n,"s")},new_id:function(){var e={method:"get_new_id",kwargs:{user:Object(i.getUser)()}};return Object(i.checkResponse)(Object(i.request)(e,!0).response,"s")},login:function(e,t){var n={method:"get_login",kwargs:{user:e,pwd:t}};return Object(i.checkResponse)(Object(i.request)(n,!0).response,"s")},getAllData:function(e,t){var n=this.parent.view_name,o=b(e,t,n);t.config.sorting=o.filters.sort;var r={method:n+".get_data",kwargs:o};return Object(i.request)(r).then((function(e){return e=Object(i.checkResponse)(e,"a")}))}},_={save:function(e,t,n){var o={method:n+".save_"+n+"_document",kwargs:{user:Object(i.getUser)(),doc_data:e,intable:t}};return Object(i.checkResponse)(Object(i.request)(o,!0).response,"s")},get:function(e,t){var n={method:t+".get_"+t+"_document",kwargs:{user:Object(i.getUser)(),doc_id:e}};return Object(i.checkResponse)(Object(i.request)(n,!0).response,"s")},get_on_order:function(e){var t={method:"orders.get_orders_document_for_shipment",kwargs:{user:Object(i.getUser)(),doc_id:e}};return Object(i.checkResponse)(Object(i.request)(t,!0).response,"s")}};function f(e){for(var t in e)return!1;return!0}function m(e){var t={method:"create_price",kwargs:{user:Object(i.getUser)(),filters:e}};return Object(i.request)(t).then((function(e){return e=Object(i.checkResponse)(e,"a")}))}function b(e,t,n,o){var r=t.$scope.app,a=void 0;a=r&&r.commonWidgets[n]&&r.commonWidgets[n].search_bar?r.commonWidgets[n].search_bar:void 0;var s=JSON.parse(JSON.stringify(e));if(!o){var c=r.commonWidgets;o="balances"==n?c[n].header.getSearch():c&&c[n].menu_filters?c[n].menu_filters.getFilters():{}}return s&&!s.sort&&Object.assign(s,{sort:t.config.sorting}),s||(s={sort:t.config.sorting}),a&&(o=Object.assign(o,{search_bar:a.getSearch()})),s=Object.assign(s,{filters:o}),{user:Object(i.getUser)(),filters:s}}function w(e){for(var t=window.atob(e),n=t.length,i=new Uint8Array(n),o=0;o<n;o++)i[o]=t.charCodeAt(o);return i.buffer}},function(e,t,n){"use strict";n.d(t,"b",(function(){return y})),n.d(t,"c",(function(){return p})),n.d(t,"a",(function(){return $}));var i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function r(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var s=function e(){a(this,e)},c=function(){function e(t){a(this,e),this.webixJet=!0,this.webix=t,this._events=[],this._subs={},this._data={}}return e.prototype.getRoot=function(){return this._root},e.prototype.destructor=function(){this._detachEvents(),this._destroySubs(),this._events=this._container=this.app=this._parent=this._root=null},e.prototype.setParam=function(e,t,n){if(this._data[e]!==t&&(this._data[e]=t,this._segment.update(e,t,0),n))return this.show(null)},e.prototype.getParam=function(e,t){var n=this._data[e];if(void 0!==n||!t)return n;var i=this.getParentView();return i?i.getParam(e,t):void 0},e.prototype.getUrl=function(){return this._segment.suburl()},e.prototype.getUrlString=function(){return this._segment.toString()},e.prototype.getParentView=function(){return this._parent},e.prototype.$$=function(e){if("string"==typeof e){var t=this.getRoot();return t.queryView((function(n){return(n.config.id===e||n.config.localId===e)&&n.$scope===t.$scope}),"self")}return e},e.prototype.on=function(e,t,n){var i=e.attachEvent(t,n);return this._events.push({obj:e,id:i}),i},e.prototype.contains=function(e){for(var t in this._subs){var n=this._subs[t].view;if(n===e||n.contains(e))return!0}return!1},e.prototype.getSubView=function(e){var t=this.getSubViewInfo(e);if(t)return t.subview.view},e.prototype.getSubViewInfo=function(e){var t=this._subs[e||"default"];return t?{subview:t,parent:this}:"_top"===e?(this._subs[e]={url:"",id:null,popup:!0},this.getSubViewInfo(e)):this._parent?this._parent.getSubViewInfo(e):null},e.prototype._detachEvents=function(){for(var e=this._events,t=e.length-1;t>=0;t--)e[t].obj.detachEvent(e[t].id)},e.prototype._destroySubs=function(){for(var e in this._subs){var t=this._subs[e].view;t&&t.destructor()}this._subs={}},e.prototype._init_url_data=function(){var e=this._segment.current();this._data={},this.webix.extend(this._data,e.params,!0)},e.prototype._getDefaultSub=function(){if(this._subs.default)return this._subs.default;for(var e in this._subs){var t=this._subs[e];if(!t.branch&&t.view&&"_top"!==e){var n=t.view._getDefaultSub();if(n)return n}}},e.prototype._routed_view=function(){var e=this.getParentView();if(!e)return!0;var t=e._getDefaultSub();return!(!t&&t!==this)&&e._routed_view()},e}();function l(e){"/"===e[0]&&(e=e.substr(1));for(var t=e.split("/"),n=[],i=0;i<t.length;i++){var o=t[i],r={},a=o.indexOf(":");if(-1===a&&(a=o.indexOf("?")),-1!==a){var s=o.substr(a+1).split(/[\:\?\&]/g),c=Array.isArray(s),l=0;for(s=c?s:s[Symbol.iterator]();;){var d;if(c){if(l>=s.length)break;d=s[l++]}else{if((l=s.next()).done)break;d=l.value}var u=d.split("=");r[u[0]]=decodeURIComponent(u[1])}}n[i]={page:a>-1?o.substr(0,a):o,params:r,isNew:!0}}return n}function d(e){var t=[],n=e,i=Array.isArray(n),o=0;for(n=i?n:n[Symbol.iterator]();;){var r;if(i){if(o>=n.length)break;r=n[o++]}else{if((o=n.next()).done)break;r=o.value}var a=r;t.push("/"+a.page);var s=u(a.params);s&&t.push("?"+s)}return t.join("")}function u(e){var t=[];for(var n in e)t.length&&t.push("&"),t.push(n+"="+encodeURIComponent(e[n]));return t.join("")}var h=function(){function e(t,n){a(this,e),this._next=1,this.route="string"==typeof t?{url:l(t),path:t}:t,this.index=n}return e.prototype.current=function(){return this.route.url[this.index]},e.prototype.next=function(){return this.route.url[this.index+this._next]},e.prototype.suburl=function(){return this.route.url.slice(this.index)},e.prototype.shift=function(){return new e(this.route,this.index+this._next)},e.prototype.refresh=function(){for(var e=this.route.url,t=this.index+1;t<e.length;t++)e[t].isNew=!0},e.prototype.toString=function(){var e=d(this.suburl());return e?e.substr(1):""},e.prototype._join=function(e,t){var n=this.route.url;if(null===e)return n;var i=this.route.url;if(n=i.slice(0,this.index+(t?this._next:0)),e){n=n.concat(l(e));for(var o=0;o<n.length;o++)i[o]&&(n[o].view=i[o].view),i[o]&&n[o].page===i[o].page&&(n[o].isNew=!1)}return n},e.prototype.append=function(e){var t=this._join(e,!0);return this.route.path=d(t),this.route.url=t,this.route.path},e.prototype.show=function(e,t,n){var i=this,o=this._join(e,n);return new Promise((function(e,n){var r=d(o),a={url:o,redirect:r,confirm:Promise.resolve()},c=t?t.app:null;if(c&&!c.callEvent("app:guard",[a.redirect,t,a]))return void n(new s);a.confirm.catch((function(e){return n(e)})).then((function(){if(null!==a.redirect){if(a.redirect!==r)return c.show(a.redirect),void n(new s);i.route.path=r,i.route.url=o,e()}else n(new s)}))}))},e.prototype.size=function(e){this._next=e},e.prototype.split=function(){var t={url:this.route.url.slice(this.index+1),path:""};return t.url.length&&(t.path=d(t.url)),new e(t,0)},e.prototype.update=function(e,t,n){var i=this.route.url[this.index+(n||0)];if(!i)return this.route.url.push({page:"",params:{}}),this.update(e,t,n);""===e?i.page=t:i.params[e]=t,this.route.path=d(this.route.url)},e}(),p=function(e){function t(n,i){a(this,t);var r=o(this,e.call(this,n.webix));return r.app=n,r._children=[],r}return r(t,e),t.prototype.ui=function(e,t){var n=(t=t||{}).container||e.container,o=this.app.createView(e);return this._children.push(o),o.render(n,this._segment,this),"object"!==(void 0===e?"undefined":i(e))||e instanceof c?o:o.getRoot()},t.prototype.show=function(e,t){if(t=t||{},"object"===(void 0===e?"undefined":i(e))){for(var n in e)this.setParam(n,e[n]);e=null}else{if("/"===e.substr(0,1))return this.app.show(e);if(0===e.indexOf("./")&&(e=e.substr(2)),0===e.indexOf("../")){var o=this.getParentView();return o?o.show(e.substr(3),t):this.app.show("/"+e.substr(3))}var r=this.getSubViewInfo(t.target);if(r){if(r.parent!==this)return r.parent.show(e,t);if(t.target&&"default"!==t.target)return this._renderFrameLock(t.target,r.subview,e)}else if(e)return this.app.show("/"+e)}return this._show(this._segment,e,this)},t.prototype._show=function(e,t,n){var i=this;return e.show(t,n,!0).then((function(){return i._init_url_data(),i._urlChange()})).then((function(){e.route.linkRouter&&(i.app.getRouter().set(e.route.path,{silent:!0}),i.app.callEvent("app:route",[e.route.path]))}))},t.prototype.init=function(e,t){},t.prototype.ready=function(e,t){},t.prototype.config=function(){this.app.webix.message("View:Config is not implemented")},t.prototype.urlChange=function(e,t){},t.prototype.destroy=function(){},t.prototype.destructor=function(){this.destroy(),this._destroyKids(),this._root.destructor(),e.prototype.destructor.call(this)},t.prototype.use=function(e,t){e(this.app,this,t)},t.prototype.refresh=function(){this.getUrl();return this.destroy(),this._destroyKids(),this._destroySubs(),this._detachEvents(),this._container.tagName&&this._root.destructor(),this._segment.refresh(),this._render(this._segment)},t.prototype.render=function(e,t,n){var i=this;"string"==typeof t&&(t=new h(t,0)),this._segment=t,this._parent=n,this._init_url_data();var o="string"==typeof(e=e||document.body)?this.webix.toNode(e):e;return this._container!==o?(this._container=o,this._render(t)):this._urlChange().then((function(){return i.getRoot()}))},t.prototype._render=function(e){var t=this,n=this.config();return n.then?n.then((function(n){return t._render_final(n,e)})):this._render_final(n,e)},t.prototype._render_final=function(e,t){var n=this,i=null,o=null,r=!1;if(this._container.tagName?o=this._container:(i=this._container).popup?(o=document.body,r=!0):o=this.webix.$$(i.id),!this.app||!o)return Promise.reject(null);var a=void 0,s=this._segment.current(),c={ui:{}};this.app.copyConfig(e,c.ui,this._subs),this.app.callEvent("app:render",[this,t,c]),c.ui.$scope=this,!i&&s.isNew&&s.view&&s.view.destructor();try{if(i&&!r){var l=o,d=l.getParentView();d&&"multiview"===d.name&&!c.ui.id&&(c.ui.id=l.config.id)}this._root=this.app.webix.ui(c.ui,o);var u=this._root;r&&u.setPosition&&!u.isVisible()&&u.show(),i&&(i.view&&i.view!==this&&i.view!==this.app&&i.view.destructor(),i.id=this._root.config.id,this.getParentView()||!this.app.app?i.view=this:i.view=this.app),s.isNew&&(s.view=this,s.isNew=!1),a=Promise.resolve(this._init(this._root,t)).then((function(){return n._urlChange().then((function(){return n._initUrl=null,n.ready(n._root,t.suburl())}))}))}catch(e){a=Promise.reject(e)}return a.catch((function(e){return n._initError(n,e)}))},t.prototype._init=function(e,t){return this.init(e,t.suburl())},t.prototype._urlChange=function(){var e=this;this.app.callEvent("app:urlchange",[this,this._segment]);var t=[];for(var n in this._subs){var i=this._subs[n],o=this._renderFrameLock(n,i,null);o&&t.push(o)}return Promise.all(t).then((function(){return e.urlChange(e._root,e._segment.suburl())}))},t.prototype._renderFrameLock=function(e,t,n){if(!t.lock){var i=this._renderFrame(e,t,n);i&&(t.lock=i.then((function(){return t.lock=null}),(function(){return t.lock=null})))}return t.lock},t.prototype._renderFrame=function(e,t,n){var i=this;if("default"===e){if(this._segment.next())return this._createSubView(t,this._segment.shift());t.view&&t.popup&&(t.view.destructor(),t.view=null)}if(null!==n&&(t.url=n),t.route){if(null!==n)return t.route.show(n,t.view).then((function(){return i._createSubView(t,t.route)}));if(t.branch)return}var o=t.view;if(!o&&t.url){if("string"==typeof t.url)return t.route=new h(t.url,0),this._createSubView(t,t.route);"function"!=typeof t.url||o instanceof t.url||(o=new t.url(this.app,"")),o||(o=t.url)}if(o)return o.render(t,t.route||this._segment,this)},t.prototype._initError=function(e,t){return this.app&&this.app.error("app:error:initview",[t,e]),!0},t.prototype._createSubView=function(e,t){var n=this;return this.app.createFromURL(t.current()).then((function(i){return i.render(e,t,n)}))},t.prototype._destroyKids=function(){for(var e=this._children,t=e.length-1;t>=0;t--)e[t]&&e[t].destructor&&e[t].destructor();this._children=[]},t}(c),_=function(e){function t(n,i){a(this,t);var r=o(this,e.call(this,n,i));return r._ui=i.ui,r}return r(t,e),t.prototype.config=function(){return this._ui},t}(p),f=function(){function e(t,n,i){a(this,e),this.path="",this.app=i}return e.prototype.set=function(e,t){this.path=e;var n=this.app;n.app.getRouter().set(n._segment.append(this.path),{silent:!0})},e.prototype.get=function(){return this.path},e}(),m=!0,b=function(e){function t(n){a(this,t);var i=(n||{}).webix||window.webix,r=o(this,e.call(this,i));return r.config=r.webix.extend({name:"App",version:"1.0",start:"/home"},n,!0),r.app=r.config.app,r.ready=Promise.resolve(),r._services={},r.webix.extend(r,r.webix.EventSystem),r}return r(t,e),t.prototype.getUrl=function(){return this._subSegment.suburl()},t.prototype.getUrlString=function(){return this._subSegment.toString()},t.prototype.getService=function(e){var t=this._services[e];return"function"==typeof t&&(t=this._services[e]=t(this)),t},t.prototype.setService=function(e,t){this._services[e]=t},t.prototype.destructor=function(){this.getSubView().destructor(),e.prototype.destructor.call(this)},t.prototype.copyConfig=function(e,t,n){if((e instanceof c||"function"==typeof e&&e.prototype instanceof c)&&(e={$subview:e}),void 0!==e.$subview)return this.addSubView(e,t,n);for(var o in t=t||(e instanceof Array?[]:{}),e){var r=e[o];if("function"==typeof r&&r.prototype instanceof c&&(r={$subview:r}),!r||"object"!==(void 0===r?"undefined":i(r))||r instanceof this.webix.DataCollection||r instanceof RegExp)t[o]=r;else if(r instanceof Date)t[o]=new Date(r);else{var a=this.copyConfig(r,r instanceof Array?[]:{},n);null!==a&&(t[o]=a)}}return t},t.prototype.getRouter=function(){return this.$router},t.prototype.clickHandler=function(e,t){if(e&&(t=t||e.target||e.srcElement)&&t.getAttribute){var n=t.getAttribute("trigger");if(n)return this._forView(t,(function(e){return e.app.trigger(n)})),e.cancelBubble=!0,e.preventDefault();var i=t.getAttribute("route");if(i)return this._forView(t,(function(e){return e.show(i)})),e.cancelBubble=!0,e.preventDefault()}var o=t.parentNode;o&&this.clickHandler(e,o)},t.prototype.getRoot=function(){return this.getSubView().getRoot()},t.prototype.refresh=function(){var e=this;return this._subSegment?this.getSubView().refresh().then((function(t){return e.callEvent("app:route",[e.getUrl()]),t})):Promise.resolve(null)},t.prototype.loadView=function(e){var t=this,n=this.config.views,i=null;if(""===e)return Promise.resolve(this._loadError("",new Error("Webix Jet: Empty url segment")));try{n&&"string"==typeof(i="function"==typeof n?n(e):n[e])&&(e=i,i=null),i||(i="_blank"===e?{}:this._loadViewDynamic(e))}catch(t){i=this._loadError(e,t)}return i.then||(i=Promise.resolve(i)),i=i.then((function(e){return e.__esModule?e.default:e})).catch((function(n){return t._loadError(e,n)}))},t.prototype._forView=function(e,t){var n=this.webix.$$(e);n&&t(n.$scope)},t.prototype._loadViewDynamic=function(e){return null},t.prototype.createFromURL=function(e){var t=this;return e.isNew||!e.view?this.loadView(e.page).then((function(e){return t.createView(e,name)})):Promise.resolve(e.view)},t.prototype.createView=function(e,n){if("function"==typeof e){if(e.prototype instanceof t)return new e({app:this,name:n,router:f});if(e.prototype instanceof c)return new e(this,{name:n});e=e(this)}return e instanceof c?e:new _(this,{name:n,ui:e})},t.prototype.show=function(e){return this.render(this._container,e||this.config.start)},t.prototype.trigger=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];this.apply(e,n)},t.prototype.apply=function(e,t){this.callEvent(e,t)},t.prototype.action=function(e){return this.webix.bind((function(){for(var t=arguments.length,n=Array(t),i=0;i<t;i++)n[i]=arguments[i];this.apply(e,n)}),this)},t.prototype.on=function(e,t){this.attachEvent(e,t)},t.prototype.use=function(e,t){e(this,null,t)},t.prototype.error=function(e,t){if(this.callEvent(e,t),this.callEvent("app:error",t),this.config.debug)for(var n=0;n<t.length;n++)if(console.error(t[n]),t[n]instanceof Error){var i=t[n].message;0===i.indexOf("Module build failed")?(i=i.replace(/\x1b\[[0-9;]*m/g,""),document.body.innerHTML="<pre style='font-size:16px; background-color: #ec6873; color: #000; padding:10px;'>"+i+"</pre>"):(i+="<br><br>Check console for more details",this.webix.message({type:"error",text:i,expire:-1}))}},t.prototype.render=function(e,t,n){var i=this;this._container="string"==typeof e?this.webix.toNode(e):e||document.body;var o=null;!this.$router?(m&&"tagName"in this._container&&(this.webix.event(document.body,"click",(function(e){return i.clickHandler(e)})),m=!1),"string"==typeof t&&(t=new h(t,0)),this._subSegment=this._first_start(t),this._subSegment.route.linkRouter=!0):o="string"==typeof t?t:this.app?t.split().route.path||this.config.start:t.toString();var r=this.getSubView(),a=this._subSegment,s=a.show(o,r).then((function(){return i.createFromURL(a.current())})).then((function(t){return t.render(e,a)})).then((function(e){return i.$router.set(a.route.path,{silent:!0}),i.callEvent("app:route",[i.getUrl()]),e}));return this.ready=this.ready.then((function(){return s})),s},t.prototype.getSubView=function(){if(this._subSegment){var e=this._subSegment.current().view;if(e)return e}return new p(this,{})},t.prototype._first_start=function(e){var t=this;this._segment=e;if(this.$router=new this.config.router((function(e){return setTimeout((function(){t.show(e).catch((function(e){if(!(e instanceof s))throw e}))}),1)}),this.config,this),this._container===document.body&&!1!==this.config.animation){var n=this._container;this.webix.html.addCss(n,"webixappstart"),setTimeout((function(){t.webix.html.removeCss(n,"webixappstart"),t.webix.html.addCss(n,"webixapp")}),10)}if(e)this.app&&(e.current().view=this,e.next()?(e.refresh(),e=e.split()):e=new h(this.config.start,0));else{var i=this.$router.get();i||(i=this.config.start,this.$router.set(i,{silent:!0})),e=new h(i,0)}return e},t.prototype._loadError=function(e,t){return this.error("app:error:resolve",[t,e]),{template:" "}},t.prototype.addSubView=function(e,t,n){var i=!0!==e.$subview?e.$subview:null,o=e.name||(i?this.webix.uid():"default");return t.id=e.id||"s"+this.webix.uid(),(n[o]={id:t.id,url:i,branch:e.branch,popup:e.popup}).popup?null:t},t}(c),w=function(){function e(t,n){var i=this;a(this,e),this.config=n||{},this._detectPrefix(),this.cb=t,window.onpopstate=function(){return i.cb(i.get())}}return e.prototype.set=function(e,t){var n=this;if(this.config.routes){var i=e.split("?",2);for(var o in this.config.routes)if(this.config.routes[o]===i[0]){e=o+(i.length>1?"?"+i[1]:"");break}}this.get()!==e&&window.history.pushState(null,null,this.prefix+this.sufix+e),t&&t.silent||setTimeout((function(){return n.cb(e)}),1)},e.prototype.get=function(){var e=this._getRaw().replace(this.prefix,"").replace(this.sufix,"");if(e="/"!==e&&"#"!==e?e:"",this.config.routes){var t=e.split("?",2),n=this.config.routes[t[0]];n&&(e=n+(t.length>1?"?"+t[1]:""))}return e},e.prototype._detectPrefix=function(){var e=this.config.routerPrefix;this.sufix="#"+(void 0===e?"!":e),this.prefix=document.location.href.split("#",2)[0]},e.prototype._getRaw=function(){return document.location.href},e}(),g=!1;function v(e){if(!g&&e){g=!0;var t=window;t.Promise||(t.Promise=e.promise);var n=e.version.split(".");10*n[0]+1*n[1]<53&&(e.ui.freeze=function(t){var n=t();return n&&n.then?n.then((function(t){return e.ui.$freeze=!1,e.ui.resize(),t})):(e.ui.$freeze=!1,e.ui.resize()),n});var o=e.ui.baselayout.prototype.addView,r=e.ui.baselayout.prototype.removeView,a={addView:function(e,t){var n=this;if(!this.$scope||!this.$scope.webixJet||e.queryView)return o.apply(this,arguments);var r=function(){var i=n.$scope,r={};e=i.app.copyConfig(e,{},r),o.apply(n,[e,t]);var a=function(e){i._renderFrame(e,r[e],null).then((function(){i._subs[e]=r[e]}))};for(var s in r)a(s);return{v:e.id}}();return"object"===(void 0===r?"undefined":i(r))?r.v:void 0},removeView:function(){if(r.apply(this,arguments),this.$scope&&this.$scope.webixJet){var t=this.$scope._subs;for(var n in t){var i=t[n];e.$$(i.id)||(i.view.destructor(),delete t[n])}}}};e.extend(e.ui.layout.prototype,a,!0),e.extend(e.ui.baselayout.prototype,a,!0),e.protoUI({name:"jetapp",$init:function(t){this.$app=new this.app(t);var n=e.uid().toString();for(var i in t.body={id:n},this.$ready.push((function(){this.$app.render({id:n})})),this.$app){var o=this.$app[i];"function"!=typeof o||this[i]||(this[i]=o.bind(this.$app))}}},e.ui.proxy)}}var y=function(e){function t(n){a(this,t),n.router=n.router||w;var i=o(this,e.call(this,n));return v(i.webix),i}return r(t,e),t.prototype._loadViewDynamic=function(e){return e=e.replace(/\./g,"/"),n(15)("./"+e)},t}(b),$=(function(){function e(t,n,i){a(this,e),this.storage=n.storage||i.webix.storage.session,this.name=n.storeName||n.id+":route",this.cb=t}e.prototype.set=function(e,t){var n=this;this.storage.put(this.name,e),t&&t.silent||setTimeout((function(){return n.cb(e)}),1)},e.prototype.get=function(){return this.storage.get(this.name)}}(),function(e){function t(){return a(this,t),o(this,e.apply(this,arguments))}r(t,e),t.prototype._detectPrefix=function(){this.prefix="",this.sufix=this.config.routerPrefix||""},t.prototype._getRaw=function(){return document.location.pathname+(document.location.search||"")}}(w),function(){function e(t,n){a(this,e),this.path="",this.cb=t}return e.prototype.set=function(e,t){var n=this;this.path=e,t&&t.silent||setTimeout((function(){return n.cb(e)}),1)},e.prototype.get=function(){return this.path},e}());function x(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function k(e,t,n){for(var i in e)x(e,i)&&t.call(n||e,e[i],i,e)}function C(e){e="Warning: "+e,"undefined"!=typeof console&&console.error(e);try{throw new Error(e)}catch(e){}}var I=String.prototype.replace,O=String.prototype.split,j=function(e){var t=e%10;return 11!==e&&1===t?0:2<=t&&t<=4&&!(e>=12&&e<=14)?1:2},V={arabic:function(e){if(e<3)return e;var t=e%100;return t>=3&&t<=10?3:t>=11?4:5},bosnian_serbian:j,chinese:function(){return 0},croatian:j,french:function(e){return e>1?1:0},german:function(e){return 1!==e?1:0},russian:j,lithuanian:function(e){return e%10==1&&e%100!=11?0:e%10>=2&&e%10<=9&&(e%100<11||e%100>19)?1:2},czech:function(e){return 1===e?0:e>=2&&e<=4?1:2},polish:function(e){if(1===e)return 0;var t=e%10;return 2<=t&&t<=4&&(e%100<10||e%100>=20)?1:2},icelandic:function(e){return e%10!=1||e%100==11?1:0},slovenian:function(e){var t=e%100;return 1===t?0:2===t?1:3===t||4===t?2:3}},E={arabic:["ar"],bosnian_serbian:["bs-Latn-BA","bs-Cyrl-BA","srl-RS","sr-RS"],chinese:["id","id-ID","ja","ko","ko-KR","lo","ms","th","th-TH","zh"],croatian:["hr","hr-HR"],german:["fa","da","de","en","es","fi","el","he","hi-IN","hu","hu-HU","it","nl","no","pt","sv","tr"],french:["fr","tl","pt-br"],russian:["ru","ru-RU"],lithuanian:["lt"],czech:["cs","cs-CZ","sk"],polish:["pl"],icelandic:["is"],slovenian:["sl-SL"]};function H(e){var t,n=(t={},k(E,(function(e,n){k(e,(function(e){t[e]=n}))})),t);return n[e]||n[O.call(e,/-/,1)[0]]||n.en}function S(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var P=/\$/g,R=/%\{(.*?)\}/g;function T(e,t,n,i){if("string"!=typeof e)throw new TypeError("Polyglot.transformPhrase expects argument #1 to be string");if(null==t)return e;var o=e,r=i||R,a="number"==typeof t?{smart_count:t}:t;if(null!=a.smart_count&&o){var s=O.call(o,"||||");o=(s[function(e,t){return V[H(e)](t)}(n||"en",a.smart_count)]||s[0]).replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")}return o=I.call(o,r,(function(e,t){return x(a,t)&&null!=a[t]?I.call(a[t],P,"$$"):e}))}function N(e){var t=e||{};this.phrases={},this.extend(t.phrases||{}),this.currentLocale=t.locale||"en";var n=t.allowMissing?T:null;this.onMissingKey="function"==typeof t.onMissingKey?t.onMissingKey:n,this.warn=t.warn||C,this.tokenRegex=function(e){var t=e&&e.prefix||"%{",n=e&&e.suffix||"}";if("||||"===t||"||||"===n)throw new RangeError('"||||" token is reserved for pluralization');return new RegExp(S(t)+"(.*?)"+S(n),"g")}(t.interpolation)}N.prototype.locale=function(e){return e&&(this.currentLocale=e),this.currentLocale},N.prototype.extend=function(e,t){k(e,(function(e,n){var o=t?t+"."+n:n;"object"===(void 0===e?"undefined":i(e))?this.extend(e,o):this.phrases[o]=e}),this)},N.prototype.unset=function(e,t){"string"==typeof e?delete this.phrases[e]:k(e,(function(e,n){var o=t?t+"."+n:n;"object"===(void 0===e?"undefined":i(e))?this.unset(e,o):delete this.phrases[o]}),this)},N.prototype.clear=function(){this.phrases={}},N.prototype.replace=function(e){this.clear(),this.extend(e)},N.prototype.t=function(e,t){var n,i,o=null==t?{}:t;if("string"==typeof this.phrases[e])n=this.phrases[e];else if("string"==typeof o._)n=o._;else if(this.onMissingKey){i=(0,this.onMissingKey)(e,o,this.currentLocale,this.tokenRegex)}else this.warn('Missing translation for key: "'+e+'"'),i=e;return"string"==typeof n&&(i=T(n,o,this.currentLocale,this.tokenRegex)),i},N.prototype.has=function(e){return x(this.phrases,e)},N.transformPhrase=function(e,t,n){return T(e,t,n)};var W=window.webix;W&&v(W);var D=window;D.Promise||(D.Promise=D.webix.promise)},function(e,t,n){"use strict";n.d(t,"d",(function(){return i})),n.d(t,"a",(function(){return o})),n.d(t,"g",(function(){return r})),n.d(t,"f",(function(){return a})),n.d(t,"b",(function(){return s})),n.d(t,"e",(function(){return c})),n.d(t,"c",(function(){return l}));var i=7,o=4,r=["n_state","_checked"],a={arrivals:{name:"Приходы",id:"_arrivals",width:140},movings:{name:"Перемещения",id:"_movings",width:120},transfers:{name:"В розницу",id:"_transfers",width:120},shipments:{name:"Продажи",id:"_shipments",width:120},movements:{name:"Перемещения",id:"_movements",width:140},info:{id:"_mView",width:120,name:void 0},balances:{id:"_balances",name:"Остатки",width:100},orders:{name:"Заказы",id:"_orders",width:120},rests:{name:"Оприходывания",id:"_rests",width:200}},s={contragents:[{id:16e3,value:"Контрагенты"},{id:36e3,value:"Виды контрагентов"},{id:56e3,value:"Подразделения контрагентов"}],reports:[{id:-1,value:""},{id:17e3,value:"Движение товаров"}],classifiers:[{id:35e3,value:"Страны"},{id:45e3,value:"Регионы"},{id:55e3,value:"НДС"},{id:65e3,value:"Торговые марки"},{id:75e3,value:"СПЕ"},{id:85e3,value:"Формы выпуска"},{id:95e3,value:"Упаковки"},{id:105e3,value:"МНН"},{id:115e3,value:"Мегакатегории"},{id:125e3,value:"Производители"},{id:135e3,value:"Группы"},{id:145e3,value:"Направления"},{id:155e3,value:"Дозировки"},{id:165e3,value:"Категории"},{id:175e3,value:"Области применения"}],products:[{id:14e3,value:"Остатки"},{id:34e3,value:"Номенклатура"},{id:44e3,value:"Группы номенклатуры"},{id:94e3,value:"Инвентаризация"}],journals:[{id:13e3,value:"Приходы"},{id:23e3,value:"Оприходывания остатков"},{id:33e3,value:"Перемещения"},{id:43e3,value:"Заказы"},{id:53e3,value:"Продажи"}],documents:[{id:12e3,value:"Приход"},{id:22e3,value:"Перемещение"},{id:32e3,value:"Продажа"},{id:42e3,value:"Ввод остатков"}],options:[{id:11e3,value:"Пользователи"},{id:21e3,value:"Роли пользователей"},{id:31e3,value:"Интерфейсы"},{id:41e3,value:"Что-то еще",submenu:[{id:41001,value:"Что-то еще 1"},{id:41002,value:"Что-то еще 2"},{id:41003,value:"Что-то еще 3"}]}],managements:[{id:1e4,value:"Предприятие",submenu:[{id:10001,value:"Организации"},{id:10002,value:"Склады"},{id:10003,value:"Подразделения"}]},{id:2e4,value:"Персонал",submenu:[{id:20001,value:"Физические лица"},{id:20002,value:"Сотрудники"},{id:20003,value:"Должности"},{id:20004,value:"Графики"}]},{id:3e4,value:"Ценообразование",submenu:[{id:30001,value:"Типы цен"},{id:30002,value:"Типы скидок"},{id:30003,value:"Ценовые группы"}]},{id:4e4,value:"Маркетинг",submenu:[{id:40001,value:"Типы мероприятий"},{id:40002,value:"Партнеры"},{id:40003,value:"Категории подразделений"}]}]},c=[{id:1,value:"Скопировать поле"},{id:1e3,$template:"Separator"},{id:9,value:"Создать новый документ",submenu:[{id:901,value:"Приходный документ"},{id:902,value:"Отгрузка"},{id:903,value:"Возврат"},{id:904,value:"Вывод из оборота"},{id:905,value:"В розницу"},{id:906,value:"Перемещение"},{id:907,value:"Ввод остатков"}]},{id:2,value:"Загрузить документ"},{id:1001,$template:"Separator"},{id:3,value:"Провести"},{id:4,value:"Отменить"},{id:5,value:"Корректировка"},{id:6,value:"Удалить"},{id:7,value:"Отменить удаление"},{id:1002,$template:"Separator"},{id:100,value:"Внутренние",submenu:[{id:101,value:"В розницу"},{id:102,value:"Перемещение"}]},{id:200,value:"На основании",submenu:[{id:201,value:"Перемещение"},{id:204,value:"Продажа"},{id:202,value:"Возврат"},{id:203,value:"Вывод из оборота"}]},{id:1003,$template:"Separator"},{id:300,value:"Документ",submenu:[{id:301,value:"Печатная форма"}]},{id:1004,$template:"Separator"},{id:10,value:"Подчиненные документы"}],l={arrivals:[902,903,904,905,906,2,5,1002,100,101,102,200,201,202,203,1004,10],balances:[902,903,904,905,906,2,1001,3,4,5,6,7,1002,100,101,102,200,201,202,203,1004,10,1003,300,301],orders:[902,903,904,905,906,2,1001,3,4,5,100,101,202,203],shipments:[902,903,904,905,906,2,5,1002,100,101,102,200,201,202,203,1004,10],movements:[902,903,904,905,906,2,5,1002,100,101,102,200,201,202,203,1004,10],rests:[902,903,904,905,906,2,5,1002,100,101,102,200,201,202,203,1004,10]}},function(e,t,n){"use strict";n.d(t,"b",(function(){return i})),n.d(t,"a",(function(){return o}));var i={new_document:{longPress:!1,hidden:!1,img:"./library/img/new-document.svg",title:"Новый документ",css_class:"side_menu_button"},references:{longPress:!1,hidden:!1,img:"./library/img/references.svg",title:"Справочники",css_class:"side_menu_button"},balances:{longPress:!1,hidden:!1,img:"./library/img/stocks.svg",title:"Остатки",css_class:"side_menu_button"},arrivals:{longPress:!1,hidden:!1,img:"./library/img/purchase_30x30.svg",title:"Поступления",css_class:"side_menu_button"},shipments:{longPress:!1,hidden:!1,img:"./library/img/shipment.svg",title:"Отгрузки",css_class:"side_menu_button"},orders:{longPress:!1,hidden:!1,img:"./library/img/orders.svg",title:"Заказы",css_class:"side_menu_button"},movings:{longPress:!1,hidden:!0,img:"./library/img/movings.svg",title:"Перемещения",css_class:"side_menu_button"},transfers:{longPress:!1,hidden:!0,img:"./library/img/transfers.svg",title:"Передачи в розницу",css_class:"side_menu_button"},analitics:{longPress:!1,hidden:!0,img:"./library/img/statistics_30x30.svg",title:"Аналитика",css_class:"side_menu_button"},reports:{longPress:!1,hidden:!0,img:"./library/img/report.svg",title:"Отчеты",css_class:"side_menu_button"},options:{longPress:!1,hidden:!0,img:"./library/img/settings.svg",title:"Настройки",css_class:"side_menu_button"},users:{longPress:!1,hidden:!0,img:"./library/img/users.svg",title:"Пользователи",css_class:"side_menu_button"}},o={documents:{width:120,longPress:!1,hidden:!1,title:"Новый документ",label:"документ",icon:'<path fill="currentColor" d="M17,14H19V17H22V19H19V22H17V19H14V17H17V14M5,3H19C20.11,3 21,3.89 21,5V12.8C20.39,12.45 19.72,12.2 19,12.08V5H5V19H12.08C12.2,19.72 12.45,20.39 12.8,21H5C3.89,21 3,20.11 3,19V5C3,3.89 3.89,3 5,3M7,7H17V9H7V7M7,11H17V12.08C16.15,12.22 15.37,12.54 14.68,13H7V11M7,15H12V17H7V15Z" />'},contragents:{width:145,longPress:!1,hidden:!1,title:"Контрагенты",label:"Контрагенты",icon:'<path fill="currentColor" d="M12,5A3.5,3.5 0 0,0 8.5,8.5A3.5,3.5 0 0,0 12,12A3.5,3.5 0 0,0 15.5,8.5A3.5,3.5 0 0,0 12,5M12,7A1.5,1.5 0 0,1 13.5,8.5A1.5,1.5 0 0,1 12,10A1.5,1.5 0 0,1 10.5,8.5A1.5,1.5 0 0,1 12,7M5.5,8A2.5,2.5 0 0,0 3,10.5C3,11.44 3.53,12.25 4.29,12.68C4.65,12.88 5.06,13 5.5,13C5.94,13 6.35,12.88 6.71,12.68C7.08,12.47 7.39,12.17 7.62,11.81C6.89,10.86 6.5,9.7 6.5,8.5C6.5,8.41 6.5,8.31 6.5,8.22C6.2,8.08 5.86,8 5.5,8M18.5,8C18.14,8 17.8,8.08 17.5,8.22C17.5,8.31 17.5,8.41 17.5,8.5C17.5,9.7 17.11,10.86 16.38,11.81C16.5,12 16.63,12.15 16.78,12.3C16.94,12.45 17.1,12.58 17.29,12.68C17.65,12.88 18.06,13 18.5,13C18.94,13 19.35,12.88 19.71,12.68C20.47,12.25 21,11.44 21,10.5A2.5,2.5 0 0,0 18.5,8M12,14C9.66,14 5,15.17 5,17.5V19H19V17.5C19,15.17 14.34,14 12,14M4.71,14.55C2.78,14.78 0,15.76 0,17.5V19H3V17.07C3,16.06 3.69,15.22 4.71,14.55M19.29,14.55C20.31,15.22 21,16.06 21,17.07V19H24V17.5C24,15.76 21.22,14.78 19.29,14.55M12,16C13.53,16 15.24,16.5 16.23,17H7.77C8.76,16.5 10.47,16 12,16Z" />'},journals:{width:120,longPress:!1,hidden:!1,title:"Журналы",label:"Журналы",icon:'<path fill="currentColor" d="M4 4C2.89 4 2 4.89 2 6V18A2 2 0 0 0 4 20H20A2 2 0 0 0 22 18V8C22 6.89 21.1 6 20 6H12L10 4H4M4 8H20V18H4V8M12 9V11H15V9H12M16 9V11H19V9H16M12 12V14H15V12H12M16 12V14H19V12H16M12 15V17H15V15H12M16 15V17H19V15H16Z" />'},products:{width:105,longPress:!1,hidden:!1,title:"Товары",label:"Товары",icon:' <path fill="currentColor" d="M16,4L9,8.04V15.96L16,20L23,15.96V8.04M16,6.31L19.8,8.5L16,10.69L12.21,8.5M0,7V9H7V7M11,10.11L15,12.42V17.11L11,14.81M21,10.11V14.81L17,17.11V12.42M2,11V13H7V11M4,15V17H7V15" />'},classifiers:{width:190,longPress:!1,hidden:!1,title:"Классификаторы",label:"Классификаторы",icon:'<path fill="currentColor" d="M9,1H19A2,2 0 0,1 21,3V19L19,18.13V3H7A2,2 0 0,1 9,1M15,20V7H5V20L10,17.82L15,20M15,5C16.11,5 17,5.9 17,7V23L10,20L3,23V7A2,2 0 0,1 5,5H15Z" />'},reports:{width:100,longPress:!1,hidden:!1,title:"Отчеты",label:"Отчеты",icon:'<path fill="currentColor" d="M16 0H8C6.9 0 6 .9 6 2V18C6 19.1 6.9 20 8 20H20C21.1 20 22 19.1 22 18V6L16 0M20 18H8V2H15V7H20V18M4 4V22H20V24H4C2.9 24 2 23.1 2 22V4H4M10 10V12H18V10H10M10 14V16H15V14H10Z" />'},analitics:{width:130,longPress:!1,hidden:!1,title:"Аналитика",label:"Аналитика",icon:'<path fill="currentColor" d="M21 8C19.5 8 18.7 9.4 19.1 10.5L15.5 14.1C15.2 14 14.8 14 14.5 14.1L11.9 11.5C12.3 10.4 11.5 9 10 9C8.6 9 7.7 10.4 8.1 11.5L3.5 16C2.4 15.7 1 16.5 1 18C1 19.1 1.9 20 3 20C4.4 20 5.3 18.6 4.9 17.5L9.4 12.9C9.7 13 10.1 13 10.4 12.9L13 15.5C12.7 16.5 13.5 18 15 18C16.5 18 17.3 16.6 16.9 15.5L20.5 11.9C21.6 12.2 23 11.4 23 10C23 8.9 22.1 8 21 8M15 9L15.9 6.9L18 6L15.9 5.1L15 3L14.1 5.1L12 6L14.1 6.9L15 9M3.5 11L4 9L6 8.5L4 8L3.5 6L3 8L1 8.5L3 9L3.5 11Z" />'},managements:{width:140,longPress:!1,hidden:!1,title:"Управление",label:"Управление",icon:'<path fill="currentColor" d="M7,19V17H9V19H7M11,19V17H13V19H11M15,19V17H17V19H15M7,15V13H9V15H7M11,15V13H13V15H11M15,15V13H17V15H15M7,11V9H9V11H7M11,11V9H13V11H11M15,11V9H17V11H15M7,7V5H9V7H7M11,7V5H13V7H11M15,7V5H17V7H15Z" />'},options:{width:135,longPress:!1,hidden:!1,title:"Настройки",label:"Настройки",icon:'<path fill="currentColor" d="M12,8A4,4 0 0,1 16,12A4,4 0 0,1 12,16A4,4 0 0,1 8,12A4,4 0 0,1 12,8M12,10A2,2 0 0,0 10,12A2,2 0 0,0 12,14A2,2 0 0,0 14,12A2,2 0 0,0 12,10M10,22C9.75,22 9.54,21.82 9.5,21.58L9.13,18.93C8.5,18.68 7.96,18.34 7.44,17.94L4.95,18.95C4.73,19.03 4.46,18.95 4.34,18.73L2.34,15.27C2.21,15.05 2.27,14.78 2.46,14.63L4.57,12.97L4.5,12L4.57,11L2.46,9.37C2.27,9.22 2.21,8.95 2.34,8.73L4.34,5.27C4.46,5.05 4.73,4.96 4.95,5.05L7.44,6.05C7.96,5.66 8.5,5.32 9.13,5.07L9.5,2.42C9.54,2.18 9.75,2 10,2H14C14.25,2 14.46,2.18 14.5,2.42L14.87,5.07C15.5,5.32 16.04,5.66 16.56,6.05L19.05,5.05C19.27,4.96 19.54,5.05 19.66,5.27L21.66,8.73C21.79,8.95 21.73,9.22 21.54,9.37L19.43,11L19.5,12L19.43,13L21.54,14.63C21.73,14.78 21.79,15.05 21.66,15.27L19.66,18.73C19.54,18.95 19.27,19.04 19.05,18.95L16.56,17.95C16.04,18.34 15.5,18.68 14.87,18.93L14.5,21.58C14.46,21.82 14.25,22 14,22H10M11.25,4L10.88,6.61C9.68,6.86 8.62,7.5 7.85,8.39L5.44,7.35L4.69,8.65L6.8,10.2C6.4,11.37 6.4,12.64 6.8,13.8L4.68,15.36L5.43,16.66L7.86,15.62C8.63,16.5 9.68,17.14 10.87,17.38L11.24,20H12.76L13.13,17.39C14.32,17.14 15.37,16.5 16.14,15.62L18.57,16.66L19.32,15.36L17.2,13.81C17.6,12.64 17.6,11.37 17.2,10.2L19.31,8.65L18.56,7.35L16.15,8.39C15.38,7.5 14.32,6.86 13.12,6.62L12.75,4H11.25Z" />'},logout:{width:95,longPress:!1,hidden:!1,title:"Выйти",label:"выйти",icon:'<path fill="currentColor" d="M16,17V14H9V10H16V7L21,12L16,17M14,2A2,2 0 0,1 16,4V6H14V4H5V20H14V18H16V20A2,2 0 0,1 14,22H5A2,2 0 0,1 3,20V4A2,2 0 0,1 5,2H14Z" />'}}},function(e,t,n){var i;"function"==typeof Symbol&&Symbol.iterator;!function(o){"use strict";function r(e,t){var n=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(n>>16)<<16|65535&n}function a(e,t,n,i,o,a){return r((s=r(r(t,e),r(i,a)))<<(c=o)|s>>>32-c,n);var s,c}function s(e,t,n,i,o,r,s){return a(t&n|~t&i,e,t,o,r,s)}function c(e,t,n,i,o,r,s){return a(t&i|n&~i,e,t,o,r,s)}function l(e,t,n,i,o,r,s){return a(t^n^i,e,t,o,r,s)}function d(e,t,n,i,o,r,s){return a(n^(t|~i),e,t,o,r,s)}function u(e,t){var n,i,o,a,u;e[t>>5]|=128<<t%32,e[14+(t+64>>>9<<4)]=t;var h=1732584193,p=-271733879,_=-1732584194,f=271733878;for(n=0;n<e.length;n+=16)i=h,o=p,a=_,u=f,h=s(h,p,_,f,e[n],7,-680876936),f=s(f,h,p,_,e[n+1],12,-389564586),_=s(_,f,h,p,e[n+2],17,606105819),p=s(p,_,f,h,e[n+3],22,-1044525330),h=s(h,p,_,f,e[n+4],7,-176418897),f=s(f,h,p,_,e[n+5],12,1200080426),_=s(_,f,h,p,e[n+6],17,-1473231341),p=s(p,_,f,h,e[n+7],22,-45705983),h=s(h,p,_,f,e[n+8],7,1770035416),f=s(f,h,p,_,e[n+9],12,-1958414417),_=s(_,f,h,p,e[n+10],17,-42063),p=s(p,_,f,h,e[n+11],22,-1990404162),h=s(h,p,_,f,e[n+12],7,1804603682),f=s(f,h,p,_,e[n+13],12,-40341101),_=s(_,f,h,p,e[n+14],17,-1502002290),h=c(h,p=s(p,_,f,h,e[n+15],22,1236535329),_,f,e[n+1],5,-165796510),f=c(f,h,p,_,e[n+6],9,-1069501632),_=c(_,f,h,p,e[n+11],14,643717713),p=c(p,_,f,h,e[n],20,-373897302),h=c(h,p,_,f,e[n+5],5,-701558691),f=c(f,h,p,_,e[n+10],9,38016083),_=c(_,f,h,p,e[n+15],14,-660478335),p=c(p,_,f,h,e[n+4],20,-405537848),h=c(h,p,_,f,e[n+9],5,568446438),f=c(f,h,p,_,e[n+14],9,-1019803690),_=c(_,f,h,p,e[n+3],14,-187363961),p=c(p,_,f,h,e[n+8],20,1163531501),h=c(h,p,_,f,e[n+13],5,-1444681467),f=c(f,h,p,_,e[n+2],9,-51403784),_=c(_,f,h,p,e[n+7],14,1735328473),h=l(h,p=c(p,_,f,h,e[n+12],20,-1926607734),_,f,e[n+5],4,-378558),f=l(f,h,p,_,e[n+8],11,-2022574463),_=l(_,f,h,p,e[n+11],16,1839030562),p=l(p,_,f,h,e[n+14],23,-35309556),h=l(h,p,_,f,e[n+1],4,-1530992060),f=l(f,h,p,_,e[n+4],11,1272893353),_=l(_,f,h,p,e[n+7],16,-155497632),p=l(p,_,f,h,e[n+10],23,-1094730640),h=l(h,p,_,f,e[n+13],4,681279174),f=l(f,h,p,_,e[n],11,-358537222),_=l(_,f,h,p,e[n+3],16,-722521979),p=l(p,_,f,h,e[n+6],23,76029189),h=l(h,p,_,f,e[n+9],4,-640364487),f=l(f,h,p,_,e[n+12],11,-421815835),_=l(_,f,h,p,e[n+15],16,530742520),h=d(h,p=l(p,_,f,h,e[n+2],23,-995338651),_,f,e[n],6,-198630844),f=d(f,h,p,_,e[n+7],10,1126891415),_=d(_,f,h,p,e[n+14],15,-1416354905),p=d(p,_,f,h,e[n+5],21,-57434055),h=d(h,p,_,f,e[n+12],6,1700485571),f=d(f,h,p,_,e[n+3],10,-1894986606),_=d(_,f,h,p,e[n+10],15,-1051523),p=d(p,_,f,h,e[n+1],21,-2054922799),h=d(h,p,_,f,e[n+8],6,1873313359),f=d(f,h,p,_,e[n+15],10,-30611744),_=d(_,f,h,p,e[n+6],15,-1560198380),p=d(p,_,f,h,e[n+13],21,1309151649),h=d(h,p,_,f,e[n+4],6,-145523070),f=d(f,h,p,_,e[n+11],10,-1120210379),_=d(_,f,h,p,e[n+2],15,718787259),p=d(p,_,f,h,e[n+9],21,-343485551),h=r(h,i),p=r(p,o),_=r(_,a),f=r(f,u);return[h,p,_,f]}function h(e){var t,n="",i=32*e.length;for(t=0;t<i;t+=8)n+=String.fromCharCode(e[t>>5]>>>t%32&255);return n}function p(e){var t,n=[];for(n[(e.length>>2)-1]=void 0,t=0;t<n.length;t+=1)n[t]=0;var i=8*e.length;for(t=0;t<i;t+=8)n[t>>5]|=(255&e.charCodeAt(t/8))<<t%32;return n}function _(e){var t,n,i="";for(n=0;n<e.length;n+=1)t=e.charCodeAt(n),i+="0123456789abcdef".charAt(t>>>4&15)+"0123456789abcdef".charAt(15&t);return i}function f(e){return unescape(encodeURIComponent(e))}function m(e){return function(e){return h(u(p(e),8*e.length))}(f(e))}function b(e,t){return function(e,t){var n,i,o=p(e),r=[],a=[];for(r[15]=a[15]=void 0,o.length>16&&(o=u(o,8*e.length)),n=0;n<16;n+=1)r[n]=909522486^o[n],a[n]=1549556828^o[n];return i=u(r.concat(p(t)),512+8*t.length),h(u(a.concat(i),640))}(f(e),f(t))}function w(e,t,n){return t?n?b(t,e):_(b(t,e)):n?m(e):_(m(e))}void 0===(i=function(){return w}.call(t,n,t,e))||(e.exports=i)}()},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}n.r(t);var r=function(e){function t(){return i(this,t),o(this,e.apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),t.prototype.config=function(){var e=this.app.config,t=e.production?"Production":"test";return{view:"toolbar",id:"__bar__main_footer",css:"margin0 center_view",borderless:!0,cols:[{view:"label",label:"<span class='footer'>Вы находитесь на сервере:  "+location.hostname+" | "+t+" | "+e.name+" | "+e.version+"</span>",height:14}]}},t.prototype.init=function(){this.widget_name="footer"},t.prototype.ready=function(){this.app.commonWidgets[this.widget_name]=this},t}(n(2).c);t.default=r},function(e,t,n){"use strict";n.r(t);var i=n(2),o=n(3),r=n(0),a=n(4);function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function c(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}var l=function(e){function t(){return s(this,t),c(this,e.apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),t.prototype.config=function(){var e=this.app,t=a.a.logout;return{view:"toolbar",id:"__bar__main_header",height:32,borderless:!0,margin:0,cols:[{view:"label",label:"<span class='label_highlited'>Хознужды</span>",autowidth:!0,css:"label_highlited",hidden:!0},{width:3*o.d},{view:"label",hidden:!1,width:150,label:"Название юр. лица:",on:{onItemClick:function(e,t){this.$scope.changeOrganization(e,t)}}},{width:o.d},{view:"label",hidden:!1,localId:"__org_name",css:"italic",autowidth:!0,label:"ООО Организация",on:{onItemClick:function(e,t){this.$scope.changeOrganization(e,t)}}},{width:100},{view:"label",localId:"__database",css:"label_warning",autowidth:!0,label:""},{},{view:"label",hidden:!1,autowidth:!0,label:"Пользователь:"},{width:o.d},{view:"label",hidden:!1,css:"italic",localId:"__uname",autowidth:!0,label:"",on:{onItemClick:function(e,t){this.$scope.changeOrganization(e,t)}}},{width:o.d},{view:"button",id:"__button__logout",hidden:t.hidden,longPress:t.longPress,width:t.width,height:24,template:function(){var e='<svg  version="1.1" class="icon_exit_button" viewBox="0 0 22 22">'+t.icon+"</svg>";return"<div class='webix_el_button'>"+("<div class='webix_el_box', title='"+t.title+"'><button class='webix_button exit_button'>"+e+"<span class='exit_button_label', style=''>"+t.label+"</span>")+"</div>"},on:{onItemClick:function(){e.getService("common").logout()}}}]}},t.prototype.changeOrganization=function(e,t){document.message("Для смены организации свяжитесь с администратором")},t.prototype.setUser=function(){this.$$("__uname").setValue(Object(r.getUser)()),this.$$("__uname").resize()},t.prototype.setDb=function(){this.app.config.database?(this.$$("__database").setValue(this.app.config.database),this.$$("__database").show(),this.$$("__database").resize()):this.$$("__database").hide()},t.prototype.setOrg=function(){this.$$("__org_name").setValue(this.app.config.home_org),this.$$("__org_name").resize()},t.prototype.ready=function(){this.app.commonWidgets[this.widget_name]=this},t.prototype.init=function(){this.widget_name="header"},t}(i.c);t.default=l},function(e,t,n){"use strict";n.r(t);var i=n(2);var o=function(e){function t(n,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var o=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,e.call(this,n));return o.cfg=i,o}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),t.prototype.config=function(){var e=this;return{view:"button",localId:"__button",width:this.cfg.width,label:this.cfg.label,on:{onItemClick:function(){e.cfg.callback(e),e.getRoot().getParentView().$scope.hide()}}}},t.prototype.ready=function(){},t.prototype.init=function(){},t}(i.c),r=[{id:"n_id",hidden:!0,headermenu:!1,width:5},{id:"n_name",fillspace:!0,sort:"server",header:[{text:"Название"}],headermenu:!1,footer:{content:"totalTableLong"},filter_type:"text"},{id:"n_limit",width:200,header:[{text:"Лимит точки"}],headermenu:!0,hidden:!1,editor:"price",filter_type:"text",format:webix.Number.formatNumber},{id:"n_parent",width:200,header:[{text:"Юр.лицо"}],headermenu:!1,hidden:!1,filter_type:"text"},{id:"n_address",width:250,header:[{text:"Адрес"}],headermenu:!0,hidden:!1,filter_type:"text"}],a=[{id:"n_id",hidden:!0,headermenu:!1,width:5},{id:"n_name",fillspace:!0,sort:"server",header:[{text:"Название"}],headermenu:!1,footer:{content:"totalTableLong"},filter_type:"text"},{id:"n_inn",width:140,header:[{text:"ИНН"}],headermenu:!0,hidden:!1,filter_type:"text"},{id:"n_type_text",width:140,header:[{text:"Тип контрагента"}],headermenu:!1,hidden:!1,filter_type:"combo"},{id:"n_points",width:140,header:[{text:"Подразделения"}],headermenu:!0,hidden:!0,filter_type:"text"}],s=[{id:"c_id",hidden:!0,headermenu:!1,width:5},{id:"c_name",fillspace:!0,sort:"server",header:[{text:"Наименование"}],headermenu:!1,footer:{content:"totalTableLong"},filter_type:"text"},{id:"c_vat",width:100,header:[{text:"Ставка, %"}],headermenu:!0,hidden:!1,filter_type:"text"}],c=[{id:"с_id",hidden:!0,headermenu:!1,width:5},{id:"c_name",fillspace:!0,sort:"server",header:[{text:"Наименование"}],headermenu:!1,footer:{content:"totalTableLong"},filter_type:"text"}],l=[{id:"с_id",hidden:!0,headermenu:!1,width:5},{id:"c_name",fillspace:!0,sort:"server",header:[{text:"Наименование"}],headermenu:!1,footer:{content:"totalTableLong"},filter_type:"text"},{id:"c_cat",width:180,header:[{text:"Категория"}],headermenu:!0,hidden:!1,filter_type:"combo"}],d=[{id:"с_id",hidden:!0,headermenu:!1,width:5},{id:"c_name",fillspace:!0,sort:"server",header:[{text:"Наименование"}],headermenu:!1,footer:{content:"totalTableLong"},filter_type:"text"}],u=[{id:"n_id",hidden:!0,headermenu:!1,width:5},{id:"n_name",fillspace:!0,sort:"server",header:[{text:"Наименование"}],headermenu:!1,footer:{content:"totalTableLong"},filter_type:"text"}],h=[{id:"с_id",hidden:!0,headermenu:!1,width:5},{id:"c_name",fillspace:!0,sort:"server",header:[{text:"Наименование"}],headermenu:!1,footer:{content:"totalTableLong"},filter_type:"text"}],p=[{id:"с_id",hidden:!0,headermenu:!1,width:5},{id:"c_rusname",fillspace:!0,sort:"server",header:[{text:"Русское наименование"}],headermenu:!1,footer:{content:"totalTableLong"},filter_type:"text"},{id:"c_latname",width:140,header:[{text:"Латинское наименование"}],headermenu:!0,hidden:!1,filter_type:"text"},{id:"c_engname",width:140,header:[{text:"Английское наименование"}],headermenu:!0,hidden:!1,filter_type:"text"}],_=[{id:"с_id",hidden:!0,headermenu:!1,width:5},{id:"c_name",fillspace:!0,sort:"server",header:[{text:"Наименование"}],headermenu:!1,footer:{content:"totalTableLong"},filter_type:"text"}],f=[{id:"с_id",hidden:!0,headermenu:!1,width:5},{id:"c_name",fillspace:!0,sort:"server",header:[{text:"Наименование"}],headermenu:!1,footer:{content:"totalTableLong"},filter_type:"text"}],m=[{id:"с_id",hidden:!0,headermenu:!1,width:5},{id:"c_name",fillspace:!0,sort:"server",header:[{text:"Наименование"}],headermenu:!1,footer:{content:"totalTableLong"},filter_type:"text"},{id:"с_parent",width:160,sort:"server",header:[{text:"Родительская группа"}],headermenu:!1,filter_type:"combo"}],b=[{id:"n_id",hidden:!0,headermenu:!1,width:5},{id:"n_name",fillspace:!0,sort:"server",header:[{text:"Наименование"}],headermenu:!1,footer:{content:"totalTableLong"},filter_type:"text"}],w=[{id:"с_id",hidden:!0,headermenu:!1,width:5},{id:"c_name",fillspace:!0,sort:"server",header:[{text:"Наименование"}],headermenu:!1,footer:{content:"totalTableLong"},filter_type:"text"}],g=[{id:"с_id",hidden:!0,headermenu:!1,width:5},{id:"c_name",fillspace:!0,sort:"server",header:[{text:"Наименование"}],headermenu:!1,footer:{content:"totalTableLong"},filter_type:"text"}],v=[{id:"с_id",hidden:!0,headermenu:!1,width:5},{id:"c_name",fillspace:!0,sort:"server",header:[{text:"Наименование"}],headermenu:!1,footer:{content:"totalTableLong"},filter_type:"text"}],y=[{id:"с_id",hidden:!0,headermenu:!1,width:5},{id:"c_name",fillspace:!0,sort:"server",header:[{text:"Наименование"}],headermenu:!1,footer:{content:"totalTableLong"},filter_type:"text"},{id:"с_dir",width:140,sort:"server",header:[{text:"Направление"}],headermenu:!1,filter_type:"combo"}],$=[{id:"с_id",hidden:!0,headermenu:!1,width:5},{id:"c_name",fillspace:!0,sort:"server",header:[{text:"Наименование"}],headermenu:!1,footer:{content:"totalTableLong"},filter_type:"text"},{id:"с_parent",width:180,sort:"server",header:[{text:"Родительское направление"}],headermenu:!1,filter_type:"combo"}],x=n(1),k=n(3);var C=function(e){function t(n,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var o=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,e.call(this,n));return o.cfg=Object.assign({width:150,labelName:"label",labelWidth:100,labelPosition:"top",name:"c_label",fitMaster:!1},i||{}),o}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),t.prototype.config=function(){var e;return(e={view:"combo",name:this.cfg.name,localId:"__"+this.cfg.name,label:this.cfg.labelName,labelPosition:this.cfg.labelPosition,labelWidth:this.cfg.labelWidth,tooltip:!0,height:"top"===this.cfg.labelPosition?60:38,inputHeight:38,width:this.cfg.width}).tooltip=function(e){return e.text},e.options={fitMaster:this.cfg.fitMaster,body:{tooltip:!0,width:1.2*+this.cfg.width,parentName:this.cfg.name,yCount:5,scroll:!0,url:function(e){return x.f.get_prod_filters(e,this)},type:{height:32}}},e.value=this.cfg.value,e},t.prototype.ready=function(){},t.prototype.init=function(){},t}(i.c);var I=function(e){function t(n,i,o){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var r=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,e.call(this,n));return r.parent=i,r.edided=o,r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),t.prototype.config=function(){var e,t=this,n={cols:[{view:"combo",name:"c_type",localId:"__c_type",label:"Тип товара",labelPosition:"left",labelWidth:77,width:275,tooltip:!0,options:{fitMaster:!1,body:(e={tooltip:!0,type:{width:"auto"},autowidth:!0,parentName:"c_type",yCount:5,scroll:!0,data:[{id:1,value:"Лекарственное средство"},{id:2,value:"Прочие товары"}]},e.type={height:32},e)},value:2},{width:2*k.d},{view:"combo",tooltip:!0,name:"c_gvnls",localId:"__c_gvnls",label:"ЖВНЛС",labelPosition:"left",labelWidth:55,width:130,options:{body:{tooltip:!0,parentName:"c_gvnls",yCount:5,scroll:!0,data:[{id:1,value:"Да"},{id:2,value:"Нет"}],type:{height:32}}},value:2},{width:2*k.d},new C(this.app,{width:150,labelName:"НДС",labelWidth:35,labelPosition:"left",name:"c_vatid",value:"2006552811470000003",fitMaster:!0}),{minWidth:2*k.d},{view:"text",name:"c_nnt",localId:"__c_nnt",label:"Код товара",tooltip:!0,labelPosition:"left",labelWidth:77,width:250,value:""},{view:"button",width:50,label:"ID",localId:"__gen_code",tooltip:"Сгенерировать автоматически",on:{onItemClick:function(){var e=x.h.new_id();e&&e.data&&t.$$("__c_nnt").setValue(e.data)}}}]},i={cols:[new C(this.app,{width:330,labelName:"Группа",name:"c_gpid",fitMaster:!1}),{width:2*k.d},new C(this.app,{width:244,labelName:"Форма выпуска",name:"c_rfid",fitMaster:!0}),{width:2*k.d},{view:"text",name:"c_doseval",tooltip:!0,localId:"__c_dosval",label:"Дозировка",labelPosition:"top",height:60,inputHeight:38,labelWidth:75,width:80,value:""},new C(this.app,{width:80,labelName:"<span style='color: transparent'>_</span>",name:"c_doseid",fitMaster:!0}),{width:2*k.d},new C(this.app,{width:244,labelName:"СПЕ",name:"c_speid",fitMaster:!1})]};return{view:"cWindow",loclalId:"_popup",point:!1,toFront:!0,relative:!0,modal:!0,css:"menu_filters",escHide:!0,on:{onShow:function(){},onHide:function(){this.destructor()}},body:{rows:[{view:"form",localId:"__p_form",on:{onChange:function(){t.setChange()}},elements:[n,{cols:[{view:"text",hidden:!0,name:"c_id",value:""},{view:"text",css:"card_text_field",name:"c_name",height:60,inputHeight:38,localId:"__c_name",label:"Наименование товара",labelPosition:"top",labelWidth:180,value:""},{rows:[{},{view:"button",label:"КОП.",width:50,tooltip:"Скопировать в полное название",localId:"__copy",on:{onItemClick:function(){var e=t.$$("__c_name").getValue();t.$$("__c_namefull").setValue(e)}}}]}]},{view:"text",name:"c_namefull",css:"card_text_field",localId:"__c_namefull",height:60,inputHeight:38,label:"Полное наименование товара",labelPosition:"top",labelWidth:180,value:""},{cols:[new C(this.app,{width:330,labelName:"МНН",name:"c_mnnid",fitMaster:!1}),{width:2*k.d},new C(this.app,{width:330,labelName:"Производитель",name:"c_manid",fitMaster:!1}),{width:2*k.d},new C(this.app,{width:330,labelName:"Страна производства",name:"c_mancid",fitMaster:!1})]},i,{cols:[{view:"text",name:"c_pack",tooltip:!0,localId:"__c_pack",label:"Упаковка (мл, г, шт. и т.д.)",labelPosition:"top",height:60,inputHeight:38,labelWidth:70,width:244,value:"",pattern:{mask:"#########",allow:/[0-9]/g}},{width:2*k.d},new C(this.app,{width:244,labelName:"Первичная упаковка",name:"c_ppid",fitMaster:!1}),{width:2*k.d},new C(this.app,{width:244,labelName:"Вторичная упаковка",name:"c_psid",fitMaster:!1}),{width:2*k.d},new C(this.app,{width:244,labelName:"Третичная упаковка",name:"c_ptid",fitMaster:!1})]},{cols:[new C(this.app,{width:244,labelName:"Область применения",name:"c_aaid",fitMaster:!1}),{width:2*k.d},new C(this.app,{width:244,labelName:"Направление",name:"c_dirid",fitMaster:!1}),{width:2*k.d},new C(this.app,{width:244,labelName:"Мегакатегория",name:"c_megaid",fitMaster:!1}),{width:2*k.d},new C(this.app,{width:244,labelName:"Категория",name:"c_catid",fitMaster:!1})]}]},{borderless:!1,padding:4,cols:[{},{view:"button",label:"Сохранить",width:136,hidden:!0,localId:"__save",on:{onItemClick:function(){var e=t.saveCard();e?document.message(e,"error",3):(t.setUnChange(),t.hide())}}},{view:"button",label:"Закрыть",width:136,localId:"__cancel",on:{onItemClick:function(){t.hide()}}}]}]}}},t.prototype.show=function(){var e="Карточка товара. ";return this.edided?e+=this.edided.c_name:e+="Новый товар",this.getRoot().getHead().getChildViews()[0].setValue(e),this.getRoot().show()},t.prototype.hide=function(){var e=this;setTimeout((function(){return e.getRoot().hide()}),10)},t.prototype.setUnChange=function(){this.change=!1;var e=this.getRoot().getHead().getChildViews()[0];this.$$("__save").hide(),e.setValue(e.getValue().replace('<span class="changed">  изменен</span>',""))},t.prototype.setChange=function(){this.change=!0;var e=this.getRoot().getHead().getChildViews()[0];this.$$("__save").show(),0===e.$view.querySelectorAll('[class="changed"]').length&&e.setValue(e.getValue()+'<span class="changed">  изменен</span>')},t.prototype.parseProduct=function(e){var t=void 0;e&&(t=e.c_id,this.$$("__gen_code").disable(),this.$$("__c_nnt").disable());var n=x.j.get(t,"product");if(this.$$("__p_form").blockEvent(),n){var i=n.data[0];this.$$("__p_form").parse(i)}this.$$("__p_form").unblockEvent()},t.prototype.validateCard=function(e){var t=!1;return(!e.c_name||e.c_name.length<2)&&(t="Укажите название товара"),(!e.c_namefull||e.c_namefull.length<2)&&(t="Укажите полное название товара"),e.c_nnt||(t="Укажите код товара"),this.edided||x.b.code(e.c_nnt)||(t="Код товара не уникален"),t},t.prototype.saveCard=function(){var e=this.$$("__p_form").getValues(),t=this.validateCard(e);if(t)return t;var n=$$(this.parent.table_id),i=x.j.save(e,"product");return i.data&&i.data[0]?(n&&(this.edided.id?n.updateItem(this.edided.id,i.data[0]):n.add(i.data[0],0)),!1):"Ошибка записи на сервер"},t.prototype.ready=function(){this.parseProduct(this.edided),webix.UIManager.setFocus(this.$$("__c_name"))},t.prototype.init=function(){},t}(i.c);var O=function(e){function t(n,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var o=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,e.call(this,n));return o.cfg=i,o}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),t.prototype.config=function(){var e=this;return{view:"datatable",id:this.cfg.id,borderless:!0,name:this.cfg.name||"_table_",clipboard:!0,localId:"__table",navigation:"row",select:"row",datafetch:30,datathrottle:10,loadahead:40,resizeColumn:!0,fixedRowHeight:!1,rowLineHeight:28,rowHeight:28,editable:!0,footer:!0,url:function(e){return this.$scope.cfg.loadFunction(e,this)},headermenu:{autowidth:!0,scroll:!0,autoheight:!1,spans:!0,yCount:4},css:"webix_header_border center_dt",scroll:"xy",tooltip:!0,columns:this.cfg.columns,sorting:this.cfg.sorting,onClick:{},onContext:{},on:{onCheck:function(e,t,n){var i=this.getItem(e),o={table:this.$scope.cfg.name,item_id:i.c_id,item_code:i.c_code,value:n,field:t},r=x.k.checkmark(o);Object(x.i)(r)&&(this.blockEvent(),i[t]=!n,this.updateItem(e,i),this.unblockEvent())},onAfterSelect:function(){this.getSelectedId()?this.$scope.cfg.topParent.$$("__edit").show():this.$scope.cfg.topParent.$$("__edit").hide()},onAfterLoad:function(){this.markSorting(this.config.sorting.id,this.config.sorting.dir)},onDataUpdate:function(t,n,i){e.cfg.setChange(t,n,i,e)},onKeyPress:function(e,t){},onItemDblClick:function(t){return e.cfg.dblClick(t,this)}}}},t}(i.c),j=n(0),V=[{id:"c_id",hidden:!0,headermenu:!1,width:5},{id:"c_code",width:150,header:[{text:Object(j.names)("c_code").value}],headermenu:!0,hidden:!1},{id:"c_inprice",width:120,css:"center_text",header:{text:Object(j.names)("n_inprice").value,autoheight:!0,css:"multiline_header"},template:"{common.checkbox()}",headermenu:!1,filter_type:void 0},{id:"c_limit_excl",width:120,css:"center_text",template:"{common.checkbox()}",header:{text:Object(j.names)("n_limits_exclude").value,autoheight:!0,css:"multiline_header"},headermenu:!0,hidden:!1,filter_type:void 0},{id:"c_name",fillspace:!0,sort:"server",header:[{text:Object(j.names)("c_name").value}],headermenu:!1,footer:{content:"totalTableLong"},filter_type:"text"},{id:"c_namefull",width:250,sort:"server",header:[{text:Object(j.names)("c_namefull").value}],headermenu:!0,hidden:!0},{id:"c_vat",hidden:!0,headermenu:!1,width:5}];var E=function(e){function t(n,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var o=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,e.call(this,n));return o.parent=i,o}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),t.prototype.config=function(){var e,t=this,n=this;this.table_id=webix.uid();var i=new O(n.app,{columns:V,loadFunction:x.h.product_data,sorting:{id:"c_name",dir:"asc"},topParent:n,name:"_products_",id:this.table_id,dblClick:function(e){n.$$("__edit").callEvent("onItemClick")},setChange:function(e,t,n,i){}});return(e={view:"cWindow",loclalId:"_popup",width:420,padding:4,point:!1,toFront:!0,relative:!0,modal:!0,css:"menu_filters",escHide:!0,on:{onShow:function(){},onHide:function(){this.destructor()}}}).width=.6*document.documentElement.clientWidth,e.height=.8*document.documentElement.clientHeight,e.body={rows:[{cols:[{view:"text",localId:"__search",label:"",name:"_search",labelWidth:0,width:450,hidden:!1,on:{onKeyPress:function(e,t){var n=this;clearTimeout(this.delay),this.delay=setTimeout((function(){n.$scope.getData()}),850)}}},{},{view:"button",label:"РЕД",width:50,tooltip:"Редактировать товар",localId:"__edit",hidden:!0,on:{onItemClick:function(){var e=$$(t.table_id).getSelectedItem();t.ui(new I(t.app,t,{c_id:e.c_id,c_name:e.c_name,id:e.id})).show()}}},{view:"button",label:"доб.",width:50,tooltip:"Добавить товар",localId:"__add",on:{onItemClick:function(){t.ui(new I(t.app,t,!1)).show()}}}]},i,{borderless:!1,cols:[{},{view:"button",label:"Закрыть",width:136,localId:"__apply",on:{onItemClick:function(){t.hide()}}}]}]},e},t.prototype.searchDuplicates=function(e,t){var n=void 0;return e.eachRow((function(i){var o=e.getItem(i);o.n_prod_id&&o.n_prod_id.toString()===t.toString()&&(n=i)})),n},t.prototype.getData=function(){var e=$$(this.table_id);e.clearAll(!0),e.loadNext(0,0,0,0,1).then((function(t){t&&(e.clearAll(!0),e.parse(t),e.showItemByIndex(0))}))},t.prototype.getFilter=function(){var e="";try{e=this.$$("__search").getValue()}catch(e){}return e},t.prototype.show=function(e){e&&this.getRoot().getHead().getChildViews()[0].setValue(e),this.getRoot().show()},t.prototype.hide=function(){var e=this;setTimeout((function(){return e.getRoot().hide()}),10)},t.prototype.ready=function(){this.$$("__search").focus()},t.prototype.init=function(){},t}(i.c);var H=function(e){function t(n,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var o=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,e.call(this,n));return o.cfg=Object.assign({width:150,labelName:"label",labelWidth:100,labelPosition:"top",name:"c_label",fitMaster:!1},i||{}),o}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),t.prototype.config=function(){var e,t=this;return(e={view:"combo",name:this.cfg.name,localId:"__"+this.cfg.name,label:this.cfg.labelName,labelPosition:this.cfg.labelPosition,labelWidth:this.cfg.labelWidth,tooltip:!0,height:"top"===this.cfg.labelPosition?60:38,inputHeight:38,width:this.cfg.width}).tooltip=function(e){return e.text},e.on={onKeyPress:function(e,n){27===e&&t.cfg.cancel&&t.cfg.cancel.callEvent("onItemClick")}},e.options={fitMaster:this.cfg.fitMaster,filter:function(e,t){return-1!=e.value.toString().toLowerCase().indexOf(t)},body:{tooltip:!0,width:1.2*+this.cfg.width,parentName:this.cfg.name,yCount:10,scroll:!0,url:function(e){return x.f.get_ref_filters(e,this)},type:{height:32}}},e.value=this.cfg.value,e},t.prototype.ready=function(){},t.prototype.init=function(){},t}(i.c);var S=function(e){function t(n,i,o){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var r=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,e.call(this,n));return r.parent=i,r.edited=o,r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),t.prototype.config=function(){var e=this;return{view:"cWindow",loclalId:"_popup",point:!1,toFront:!0,relative:!0,modal:!0,css:"menu_filters",escHide:!0,on:{onShow:function(){},onHide:function(){this.destructor()}},body:{rows:[{view:"form",localId:"__ref_form",on:{onChange:function(){e.setChange()}},elements:[]},{borderless:!1,padding:4,cols:[{},{view:"button",label:"Сохранить",width:136,hidden:!0,localId:"__save",on:{onItemClick:function(){var t=e.saveCard();t?document.message(t,"error",3):(e.setUnChange(),e.hide())}}},{view:"button",label:"Закрыть",width:136,localId:"__cancel",on:{onItemClick:function(){e.hide()}}}]}]}}},t.prototype.show=function(e){return e=e||"Карточка "+this.parent.header+".  ",this.edited?e+=this.edited[this.app.getService("common").search_key(this.edited,"_name")]:e+="Новый элемент",this.getRoot().getHead().getChildViews()[0].setValue(e),this.getRoot().show()},t.prototype.hide=function(){var e=this;setTimeout((function(){return e.getRoot().hide()}),10)},t.prototype.setUnChange=function(){this.change=!1;var e=this.getRoot().getHead().getChildViews()[0];this.$$("__save").hide(),e.setValue(e.getValue().replace('<span class="changed">  изменен</span>',""))},t.prototype.setChange=function(){this.change=!0;var e=this.getRoot().getHead().getChildViews()[0];this.$$("__save").show(),0===e.$view.querySelectorAll('[class="changed"]').length&&e.setValue(e.getValue()+'<span class="changed">  изменен</span>')},t.prototype.parseElement=function(e){var t=void 0;if(e){t=e.id;var n=x.k.get(t,this.parent.cfg.name);if(this.$$("__ref_form").blockEvent(),n){var i=n.data[0];this.$$("__ref_form").parse(i)}this.$$("__ref_form").unblockEvent()}},t.prototype.validateCard=function(e){var t=!1,n=e[this.app.getService("common").search_key(e,"_name")];return(!n||n.length<2)&&(t="Укажите наименование "),t},t.prototype.saveCard=function(){var e=this.$$("__ref_form").getValues(),t=this.validateCard(e);if(t)return t;var n=x.k.set(e,this.parent.cfg.name),i=$$(this.parent.table_id);return n.data&&n.data[0]?(i&&(this.edited.id?i.updateItem(this.edited.id,n.data[0]):i.add(n.data[0],0)),!1):"Ошибка записи на сервер"},t.prototype.ready=function(){var e=this,t=this;setTimeout((function(){var n=e.parent.cfg.columns;e.$$("__ref_form").addView({view:"text",hidden:!0,localId:"__ref_name",name:"ref_name",value:e.parent.cfg.name}),n.forEach((function(n){if(!n.hidden)switch(n.filter_type){case"text":e.$$("__ref_form").addView({view:"text",localId:"__"+n.id+"_field",label:n.header[0].text,labelPosition:"top",height:60,inputHeight:38,width:600,name:n.id,labelWidth:120,on:{onKeyPress:function(e,n){32===e||e>=48&&e<=90?t.setChange():27===e&&t.$$("__cancel").callEvent("onItemClick")}}});break;case"combo":e.$$("__ref_form").addView(new H(e.app,{width:600,labelName:n.header[0].text,name:n.id,reference:e.parent.cfg.name,cancel:t.$$("__cancel"),fitMaster:!0}))}})),e.parseElement(e.edited),webix.UIManager.setFocus(e.$$("__ref_form"))}),200)},t.prototype.init=function(){},t}(i.c);var P=function(e){function t(n,i,o){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var r=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,e.call(this,n));return r.parent=i,r.edited=o,r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),t.prototype.config=function(){var e=this;return{view:"cWindow",loclalId:"_popup",point:!1,toFront:!0,relative:!0,modal:!0,css:"menu_filters",escHide:!0,on:{onShow:function(){},onHide:function(){this.$scope.parent.reloadSuppl&&this.$scope.parent.reloadSuppl(),this.destructor()}},body:{rows:[{view:"form",localId:"__ref_partners_form",on:{onChange:function(){e.setChange()}},padding:2,margin:1,elements:[]},{borderless:!1,padding:4,cols:[{},{view:"button",label:"Сохранить",width:136,hidden:!0,localId:"__save",on:{onItemClick:function(){var t=e.saveCard();t?document.message(t,"error",3):(e.setUnChange(),e.hide())}}},{view:"button",label:"Закрыть",width:136,localId:"__cancel",on:{onItemClick:function(){e.hide()}}}]}]}}},t.prototype.show=function(e){return e=e||"Карточка "+this.parent.header+".  ",this.edited?e+=this.edited[this.app.getService("common").search_key(this.edited,"_name")]:e+="Новый элемент",this.getRoot().getHead().getChildViews()[0].setValue(e),this.getRoot().show()},t.prototype.hide=function(){var e=this;setTimeout((function(){return e.getRoot().hide()}),10)},t.prototype.setUnChange=function(){this.change=!1;var e=this.getRoot().getHead().getChildViews()[0];this.$$("__save").hide(),e.setValue(e.getValue().replace('<span class="changed">  изменен</span>',""))},t.prototype.setChange=function(){this.change=!0;var e=this.getRoot().getHead().getChildViews()[0];this.$$("__save").show(),0===e.$view.querySelectorAll('[class="changed"]').length&&e.setValue(e.getValue()+'<span class="changed">  изменен</span>')},t.prototype.parseElement=function(e){var t=void 0;if(e){t=e.id;var n=x.j.get(t,"partner");if(this.$$("__ref_partners_form").blockEvent(),n){var i=n.data[0];this.$$("__ref_partners_form").parse(i)}this.$$("__ref_partners_form").unblockEvent()}},t.prototype.validateCard=function(e){return!e.n_name||e.n_name.length<2?"Укажите название":!e.n_namefull||e.n_namefull.length<2?"Укажите полное название":!e.n_address||e.n_address.length<2?"Укажите юридический адрес":(!e.n_actual_address||e.n_actual_address.length<2)&&"Укажите фактический адрес"},t.prototype.saveCard=function(){var e=this.$$("__ref_partners_form").getValues(),t=this.validateCard(e);if(t)return t;var n=x.j.save(e,"partner"),i=$$(this.parent.table_id);return n.data&&n.data[0]?(i&&(this.edited.id?i.updateItem(this.edited.id,n.data[0]):i.add(n.data[0],0)),!1):"Ошибка записи на сервер"},t.prototype.ready=function(){var e=this,t=this;setTimeout((function(){var n=e.parent&&e.parent.cfg&&e.parent.cfg.name?e.parent.cfg.name:"Контрагенты";e.$$("__ref_partners_form").addView({view:"text",hidden:!0,localId:"__ref_name",name:"ref_name",value:n}),e.$$("__ref_partners_form").addView({cols:[{view:"text",name:"n_id",width:1,hidden:!0,localId:"__n_id_field"},new H(e.app,{width:140,labelName:"Тип контрагента",name:"n_type",reference:n,cancel:t.$$("__cancel"),fitMaster:!0}),{cols:[{view:"text",localId:"__n_name_field",label:"Название",labelPosition:"top",height:60,inputHeight:38,width:400,name:"n_name",labelWidth:120,on:{onKeyPress:function(e,n){32===e||e>=48&&e<=90?t.setChange():27===e&&t.$$("__cancel").callEvent("onItemClick")}}},{rows:[{},{view:"button",label:"КОП",width:60,tooltip:"Скопировать в полное название",localId:"__copy_to_full",on:{onItemClick:function(){var t=e.$$("__n_name_field").getValue();e.$$("__n_namefull_field").setValue(t)}}}]}]}]}),e.$$("__ref_partners_form").addView({cols:[{view:"text",localId:"__n_namefull_field",label:"Полное название",labelPosition:"top",height:60,inputHeight:38,width:540,name:"n_namefull",labelWidth:120,on:{onKeyPress:function(e,n){32===e||e>=48&&e<=90?t.setChange():27===e&&t.$$("__cancel").callEvent("onItemClick")}}},{rows:[{},{view:"button",label:"КОП",width:60,tooltip:"Скопировать в полное название",localId:"__copy_to_name",on:{onItemClick:function(){var t=e.$$("__n_namefull_field").getValue();e.$$("__n_name_field").setValue(t)}}}]}]}),e.$$("__ref_partners_form").addView({cols:[{view:"text",localId:"__n_inn_field",label:"ИНН",labelPosition:"top",height:60,inputHeight:38,width:200,name:"n_inn",labelWidth:120,on:{onKeyPress:function(e,n){32===e||e>=48&&e<=90?t.setChange():27===e&&t.$$("__cancel").callEvent("onItemClick")}}},{view:"text",localId:"__n_kpp_field",label:"КПП",labelPosition:"top",height:60,inputHeight:38,width:200,name:"n_kpp",labelWidth:120,on:{onKeyPress:function(e,n){32===e||e>=48&&e<=90?t.setChange():27===e&&t.$$("__cancel").callEvent("onItemClick")}}},{view:"text",localId:"__n_ogrn_field",label:"ОГРН",labelPosition:"top",height:60,inputHeight:38,width:200,name:"n_ogrn",labelWidth:120,on:{onKeyPress:function(e,n){32===e||e>=48&&e<=90?t.setChange():27===e&&t.$$("__cancel").callEvent("onItemClick")}}}]}),e.$$("__ref_partners_form").addView({cols:[{view:"text",localId:"__n_contact",label:"Контактное лицо",labelPosition:"top",height:60,inputHeight:38,width:200,name:"n_contact",labelWidth:120,on:{onKeyPress:function(e,n){32===e||e>=48&&e<=90?t.setChange():27===e&&t.$$("__cancel").callEvent("onItemClick")}}},{view:"text",localId:"__n_phone_field",label:"Телефон",labelPosition:"top",height:60,inputHeight:38,width:200,name:"n_phone",pattern:webix.patterns.phone,labelWidth:120,on:{onKeyPress:function(e,n){32===e||e>=48&&e<=90?t.setChange():27===e&&t.$$("__cancel").callEvent("onItemClick")}}},{view:"text",localId:"__n_email_field",label:"e-mail",labelPosition:"top",height:60,inputHeight:38,width:200,name:"n_email",labelWidth:120,on:{onKeyPress:function(e,n){32===e||e>=48&&e<=90?t.setChange():27===e&&t.$$("__cancel").callEvent("onItemClick")}}}]}),e.$$("__ref_partners_form").addView({cols:[{view:"text",localId:"__n_address_field",label:"Юридический адрес",labelPosition:"top",height:60,inputHeight:38,width:540,name:"n_address",labelWidth:120,on:{onKeyPress:function(e,n){32===e||e>=48&&e<=90?t.setChange():27===e&&t.$$("__cancel").callEvent("onItemClick")}}},{rows:[{},{view:"button",label:"КОП",width:60,tooltip:"Скопировать в фактический адрес",localId:"__copy_to_actual_addr",on:{onItemClick:function(){var t=e.$$("__n_address_field").getValue();e.$$("__n_actual_address_field").setValue(t)}}}]}]}),e.$$("__ref_partners_form").addView({cols:[{view:"text",localId:"__n_actual_address_field",label:"Фатический адрес",labelPosition:"top",height:60,inputHeight:38,width:540,name:"n_actual_address",labelWidth:120,on:{onKeyPress:function(e,n){32===e||e>=48&&e<=90?t.setChange():27===e&&t.$$("__cancel").callEvent("onItemClick")}}},{rows:[{},{view:"button",label:"КОП",width:60,tooltip:"Скопировать в юридический адрес",localId:"__copy_to_actual_addr",on:{onItemClick:function(){var t=e.$$("__n_actual_address_field").getValue();e.$$("__n_address_field").setValue(t)}}}]}]}),e.$$("__ref_partners_form").addView({view:"textarea",localId:"__n_comment_field",label:"Комментарий",labelPosition:"top",height:114,inputHeight:76,width:600,name:"n_comment",labelWidth:120,on:{onKeyPress:function(e,n){32===e||e>=48&&e<=90?t.setChange():27===e&&t.$$("__cancel").callEvent("onItemClick")}}}),e.$$("__ref_partners_form").addView({rows:[{template:"Банк",type:"section"},{cols:[{view:"text",localId:"__n_bank_name_field",label:"Название",labelPosition:"top",height:60,inputHeight:38,width:250,name:"n_bank_name",labelWidth:120,on:{onKeyPress:function(e,n){32===e||e>=48&&e<=90?t.setChange():27===e&&t.$$("__cancel").callEvent("onItemClick")}}},{view:"text",localId:"__n_bank_bik_field",label:"БИК",labelPosition:"top",height:60,inputHeight:38,width:120,name:"n_bank_bik",labelWidth:120,on:{onKeyPress:function(e,n){32===e||e>=48&&e<=90?t.setChange():27===e&&t.$$("__cancel").callEvent("onItemClick")}}}]},{cols:[{view:"text",localId:"__n_bank_k_account_field",label:"Кор.счет.",labelPosition:"top",height:60,inputHeight:38,width:300,name:"n_bank_k_account",labelWidth:120,on:{onKeyPress:function(e,n){32===e||e>=48&&e<=90?t.setChange():27===e&&t.$$("__cancel").callEvent("onItemClick")}}},{view:"text",localId:"__n_bank_ch_account_field",label:"Рассчетный счет",labelPosition:"top",height:60,inputHeight:38,width:300,name:"n_bank_ch_account",labelWidth:120,on:{onKeyPress:function(e,n){32===e||e>=48&&e<=90?t.setChange():27===e&&t.$$("__cancel").callEvent("onItemClick")}}}]}]}),e.parseElement(e.edited),webix.UIManager.setFocus(e.$$("__n_name_field"))}),30)},t.prototype.init=function(){},t}(i.c);var R=function(e){function t(n,i,o){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var r=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,e.call(this,n));return r.parent=i,r.edited=o,r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),t.prototype.config=function(){var e=this;return{view:"cWindow",loclalId:"_popup",point:!1,toFront:!0,relative:!0,modal:!0,css:"menu_filters",escHide:!0,on:{onShow:function(){},onHide:function(){this.destructor()}},body:{rows:[{view:"form",localId:"__ref_points_form",on:{onChange:function(){e.setChange()}},padding:2,margin:1,elements:[]},{borderless:!1,padding:4,cols:[{},{view:"button",label:"Сохранить",width:136,hidden:!0,localId:"__save",on:{onItemClick:function(){var t=e.saveCard();t?document.message(t,"error",3):(e.setUnChange(),e.hide())}}},{view:"button",label:"Закрыть",width:136,localId:"__cancel",on:{onItemClick:function(){e.hide()}}}]}]}}},t.prototype.show=function(e){return e=e||"Карточка "+this.parent.header+".  ",this.edited?e+=this.edited[this.app.getService("common").search_key(this.edited,"_name")]:e+="Новый элемент",this.getRoot().getHead().getChildViews()[0].setValue(e),this.getRoot().show()},t.prototype.hide=function(){var e=this;setTimeout((function(){return e.getRoot().hide()}),10)},t.prototype.setUnChange=function(){this.change=!1;var e=this.getRoot().getHead().getChildViews()[0];this.$$("__save").hide(),e.setValue(e.getValue().replace('<span class="changed">  изменен</span>',""))},t.prototype.setChange=function(){this.change=!0;var e=this.getRoot().getHead().getChildViews()[0];this.$$("__save").show(),0===e.$view.querySelectorAll('[class="changed"]').length&&e.setValue(e.getValue()+'<span class="changed">  изменен</span>')},t.prototype.parseElement=function(e){var t=void 0;if(e){t=e.id;var n=x.j.get(t,"point");if(this.$$("__ref_points_form").blockEvent(),n){var i=n.data[0];this.$$("__ref_points_form").parse(i)}this.$$("__ref_points_form").unblockEvent()}},t.prototype.validateCard=function(e){return!e.n_name||e.n_name.length<2?"Укажите название":!e.n_address||e.n_address.length<2?"Укажите адрес":!e.n_parent_id&&"Укажите юр.лицо"},t.prototype.saveCard=function(){var e=this.$$("__ref_points_form").getValues(),t=this.validateCard(e);if(t)return t;var n=x.j.save(e,"point"),i=$$(this.parent.table_id);return n.data&&n.data[0]?(i&&(this.edited.id?i.updateItem(this.edited.id,n.data[0]):i.add(n.data[0],0)),!1):"Ошибка записи на сервер"},t.prototype.ready=function(){var e=this,t=this;setTimeout((function(){e.$$("__ref_points_form").addView({view:"text",hidden:!0,localId:"__ref_name",name:"ref_name",value:e.parent.cfg.name}),e.$$("__ref_points_form").addView({cols:[{view:"text",name:"n_id",width:1,hidden:!0,localId:"__n_id_field"},new H(e.app,{width:200,labelName:"Юр.лицо",name:"n_parent_id",reference:e.parent.cfg.name,cancel:t.$$("__cancel"),fitMaster:!0}),{view:"text",localId:"__n_code_field",label:"Код",labelPosition:"top",height:60,inputHeight:38,width:200,name:"n_code",labelWidth:120,on:{onKeyPress:function(e,n){32===e||e>=48&&e<=90?t.setChange():27===e&&t.$$("__cancel").callEvent("onItemClick")}}}]}),e.$$("__ref_points_form").addView({cols:[{view:"text",localId:"__n_address_field",label:"Адрес",labelPosition:"top",height:60,inputHeight:38,width:540,name:"n_address",labelWidth:120,on:{onKeyPress:function(e,n){32===e||e>=48&&e<=90?t.setChange():27===e&&t.$$("__cancel").callEvent("onItemClick")}}},{rows:[{},{view:"button",label:"КОП",width:60,tooltip:"Скопировать в название",localId:"__copy_to_namr",on:{onItemClick:function(){var t=e.$$("__n_address_field").getValue();e.$$("__n_name_field").setValue(t)}}}]}]}),e.$$("__ref_points_form").addView({cols:[{view:"text",localId:"__n_name_field",label:"Название",labelPosition:"top",height:60,inputHeight:38,width:600,name:"n_name",labelWidth:120,on:{onKeyPress:function(e,n){32===e||e>=48&&e<=90?t.setChange():27===e&&t.$$("__cancel").callEvent("onItemClick")}}}]}),e.$$("__ref_points_form").addView({cols:[{view:"text",localId:"__n_contact",label:"Контактное лицо",labelPosition:"top",height:60,inputHeight:38,width:200,name:"n_contact",labelWidth:120,on:{onKeyPress:function(e,n){32===e||e>=48&&e<=90?t.setChange():27===e&&t.$$("__cancel").callEvent("onItemClick")}}},{view:"text",localId:"__n_phone_field",label:"Телефон",labelPosition:"top",height:60,inputHeight:38,width:200,name:"n_phone",pattern:webix.patterns.phone,labelWidth:120,on:{onKeyPress:function(e,n){32===e||e>=48&&e<=90?t.setChange():27===e&&t.$$("__cancel").callEvent("onItemClick")}}},{view:"text",localId:"__n_email_field",label:"e-mail",labelPosition:"top",height:60,inputHeight:38,width:200,name:"n_email",labelWidth:120,on:{onKeyPress:function(e,n){32===e||e>=48&&e<=90?t.setChange():27===e&&t.$$("__cancel").callEvent("onItemClick")}}}]}),e.$$("__ref_points_form").addView({view:"textarea",localId:"__n_comment_field",label:"Комментарий",labelPosition:"top",height:114,inputHeight:76,width:600,name:"n_comment",labelWidth:120,on:{onKeyPress:function(e,n){32===e||e>=48&&e<=90?t.setChange():27===e&&t.$$("__cancel").callEvent("onItemClick")}}}),e.parseElement(e.edited),webix.UIManager.setFocus(e.$$("__n_address_field"))}),30)},t.prototype.init=function(){},t}(i.c);var T=function(e){function t(n,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var o=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,e.call(this,n));return o.cfg=i,o}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),t.prototype.config=function(){var e=this,t=this;this.table_id=webix.uid();var n=new O(t.app,{columns:t.cfg.columns,loadFunction:t.cfg.loadFunction||x.h.ref_data,sorting:t.cfg.sorting,topParent:t,id:this.table_id,name:t.cfg.name,dblClick:function(e){t.$$("__edit").callEvent("onItemClick")},setChange:function(e,n,i){if("points"==t.cfg.name&&n.n_limit!==i.n_limit)Object(x.m)(e,n.n_limit)}});return{view:"cWindow",loclalId:"_popup",padding:4,point:!1,toFront:!0,relative:!0,modal:!0,css:"menu_filters",escHide:!0,on:{onShow:function(){},onHide:function(){this.destructor()}},width:.6*document.documentElement.clientWidth,height:.8*document.documentElement.clientHeight,body:{rows:[{cols:[{view:"text",localId:"__search",label:"",name:"_search",labelWidth:0,width:450,hidden:!1,on:{onKeyPress:function(e,t){var n=this;clearTimeout(this.delay),this.delay=setTimeout((function(){n.$scope.getData()}),850)}}},{},{view:"button",label:"РЕД",width:50,tooltip:"Редактировать запись",localId:"__edit",hidden:!0,on:{onItemClick:function(){var t=$$(e.table_id).getSelectedItem();("partners"==e.cfg.name?e.ui(new P(e.app,e,t)):"points"==e.cfg.name?e.ui(new R(e.app,e,t)):e.ui(new S(e.app,e,t))).show()}}},{view:"button",label:"доб.",width:50,tooltip:"Добавить запись",localId:"__add",on:{onItemClick:function(){("partners"==e.cfg.name?e.ui(new P(e.app,e,!1)):"points"==e.cfg.name?e.ui(new R(e.app,e,!1)):e.ui(new S(e.app,e,!1))).show()}}}]},n,{borderless:!1,cols:[{},{view:"button",label:"Закрыть",width:136,localId:"__apply",on:{onItemClick:function(){e.hide()}}}]}]}}},t.prototype.searchDuplicates=function(e,t){var n=void 0;return e.eachRow((function(i){var o=e.getItem(i);o.n_prod_id&&o.n_prod_id.toString()===t.toString()&&(n=i)})),n},t.prototype.getData=function(){var e=$$(this.table_id);e.clearAll(!0),e.loadNext(0,0,0,0,1).then((function(t){t&&(e.clearAll(!0),e.parse(t),e.showItemByIndex(0))}))},t.prototype.getFilter=function(){var e="";try{e=this.$$("__search").getValue()}catch(e){}return e},t.prototype.show=function(e){this.header=e,this.header&&this.getRoot().getHead().getChildViews()[0].setValue(this.header),this.getRoot().show()},t.prototype.hide=function(){var e=this;setTimeout((function(){return e.getRoot().hide()}),10)},t.prototype.ready=function(){this.$$("__search").focus()},t.prototype.init=function(){},t}(i.c),N=[{in:"row_num",hidden:!0,headermenu:!1,width:50,template:function(e,t,n,i){return isNaN(e.row_num)?"":e.row_num+1}},{id:"n_id",hidden:!0,headermenu:!1,width:0},{id:"n_doc_id",hidden:!0,headermenu:!1,width:0},{id:"n_product",fillspace:1,header:[{text:"Товар"}],headermenu:!1,footer:{text:"всего:",colspan:3}},{id:"n_product_order",width:250,header:[{text:"Товар в заказе"}],headermenu:!0,hidden:!0},{id:"n_man",width:200,header:[{text:"Производитель"}],headermenu:!0},{id:"n_code",width:80,header:[{text:"Код"}],headermenu:!1},{id:"n_amount",width:150,header:[{text:"Кол-во в заказе"}],headermenu:!1,editor:"text",footer:{content:"summColumn"}},{id:"n_balance_qty",width:150,header:[{text:"Кол-во на складе"}],headermenu:!1,editor:"text",footer:{content:"summColumn"}},{id:"n_price",width:80,header:[{text:"Цена, руб."}],headermenu:!1,editor:"price",format:webix.Number.formatNumber},{id:"n_total_summ",width:160,header:[{text:"Сумма с НДС"}],headermenu:!1,footer:{content:"totalColumn"},format:webix.Number.formatNumber},{id:"n_comment",width:250,header:[{text:"Комментарий к позиции"}],headermenu:!0},{id:"n_prod_id",hidden:!0,headermenu:!1,width:0},{id:"n_balance_id",hidden:!0,headermenu:!1,width:0}];function W(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function D(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}var L=function(e){function t(n,i){var o=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:void 0;W(this,t);var a=D(this,e.call(this,n));return a.parent=i,a.readonly=o,a.hide_list=r||[],a}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),t.prototype.config=function(){var e=this;"Приходная накладная"==this.parent.doc_type?this.base_template="документ поставщика":this.base_template="примечание";return{localId:"__header-form",borderless:!0,rows:[{view:"text",name:"n_id",localId:"__n_id",disabled:!0,width:0,hidden:!0},{height:k.d},{cols:[{view:"text",label:"Исполнитель",labelWidth:100,name:"n_executor",localId:"__exec",disabled:!0,width:250,on:{onChange:function(){e.parent.setChange()}}},{}]},{height:k.d},{cols:[{rows:[{template:"Тип документа",type:"section",localId:"__type"},{cols:[{view:"combo",disabled:!0,name:"n_state",label:"Состояние документа",localId:"__status",labelWidth:140,on:{onChange:function(){e.parent.setChange()}},options:{body:{parentName:"n_state",url:function(e){return x.f.get_data(e,this)},type:{height:32},on:{onAfterLoad:function(){}}}}},{width:k.d},{view:"text",label:"Номер документа",name:"n_number",labelWidth:120,localId:"__number",on:{onKeyPress:function(e,t){this.callEvent("onChange")},onChange:function(){e.parent.setChange()}}},{width:k.d},{view:"datepicker",name:"n_dt_document",label:"Дата документа",format:webix.i18n.dateFormatStr,labelWidth:105,value:new Date,localId:"__date",on:{onChange:function(){e.parent.setChange()}}}]}]},{width:3*k.d},{rows:[{template:"Итого по документу",type:"section"},{cols:[{view:"text",label:"Сумма документа",labelWidth:120,format:j.formatText,disabled:!0,localId:"__sum"},{width:k.d},{view:"text",label:"Сумма НДС",labelWidth:80,disabled:!0,format:j.formatText,localId:"__vats"},{width:k.d},{view:"text",label:"Количество позиций",labelWidth:135,disabled:!0,localId:"__pos"}]}]}]},{height:3*k.d},{cols:[{localId:"__supplier_section",rows:[{template:"поставщик",type:"section"},{cols:[{view:"combo",disabled:!1,name:"n_supplier",localId:"__supplier",labelWidth:0,on:{onChange:function(){e.parent.setChange()}},suggest:{filter:x.e,body:{parentName:"n_supplier",url:function(e){return x.f.get_data(e,this)},type:{height:32}}}},{view:"button",width:36,localId:"__add_supp",label:"+",on:{onItemClick:function(){e.ui(new P(e.app,e,!1)).show("Карточка Контрагенты.")}}}]}]},{width:3*k.d},{rows:[{template:"получатель",type:"section"},{view:"combo",name:"n_recipient",disabled:!1,localId:"__recipient",labelWidth:0,on:{onChange:function(){e.parent.setChange()}},suggest:{filter:x.e,body:{parentName:"n_recipient",url:function(e){return x.f.get_data(e,this)},type:{height:32}}}}]},{width:3*k.d},{rows:[{template:this.base_template,type:"section"},{view:"text",name:"n_base",labelWidth:0,localId:"__base",on:{onKeyPress:function(){this.callEvent("onChange")},onChange:function(){e.parent.setChange()}}}]}]},{height:3*k.d}]}},t.prototype.reloadSuppl=function(){var e=this.$$("__supplier").getList();e.clearAll(!0),e.loadNext(0,0,0,0,1).then((function(t){t&&(e.clearAll(!0),e.parse(t),e.showItemByIndex(0))}))},t.prototype.getData=function(e){var t=this,n={};return e||(e=this.getRoot()),e.getChildViews().forEach((function(e,i){var o=t.getData(e);if(n=Object.assign(o,n),e.config.name){var r={};r[e.config.name]=e.getValue(name),n=Object.assign(n,r)}})),n},t.prototype.setHeader=function(){this.parent.doc&&(this.$$("__number").blockEvent(),this.$$("__exec").blockEvent(),this.$$("__date").blockEvent(),this.$$("__status").blockEvent(),this.$$("__supplier").blockEvent(),this.$$("__recipient").blockEvent(),this.$$("__base").blockEvent(),this.$$("__sum").setValue(this.parent.doc.n_summ),this.$$("__vats").setValue(this.parent.doc.n_nds),this.$$("__pos").setValue(this.parent.doc.n_pos_numbers),this.$$("__status").setValue(this.parent.doc.n_state),this.$$("__supplier").setValue(this.parent.doc.n_supplier_id),this.$$("__recipient").setValue(this.parent.doc.n_recipient_id),this.$$("__number").setValue(this.parent.doc.n_number),this.$$("__exec").setValue(this.parent.doc.n_executor),this.$$("__date").setValue(this.parent.doc.n_dt_invoice),this.$$("__base").setValue(this.parent.base?this.parent.base:this.parent.doc.n_base),this.$$("__n_id").setValue(this.parent.doc.n_id),this.$$("__type").define("template",this.parent.doc_type),this.$$("__type").refresh(),this.$$("__number").unblockEvent(),this.$$("__exec").unblockEvent(),this.$$("__date").unblockEvent(),this.$$("__status").unblockEvent(),this.$$("__supplier").unblockEvent(),this.$$("__recipient").unblockEvent(),this.$$("__base").unblockEvent(),2===this.parent.doc.n_state&&(this.$$("__number").disable(),this.$$("__exec").disable(),this.$$("__date").disable(),this.$$("__status").disable(),this.$$("__supplier").disable(),this.$$("__recipient").disable(),this.$$("__base").disable()),this.readonly&&this.$$("__header-form").disable(),this.parent.base&&(this.$$("__base").disable(),this.$$("__recipient").disable()),this.parent._block&&this.$$("__"+this.parent._block).disable())},t.prototype.recalcHeader=function(e){function t(t){var n=0,i=e.config.columns,o=!1;return i.forEach((function(e){e.id==t&&(o=!0)})),o&&e.mapCells(null,t,null,1,(function(e){var t=+e;return isNaN(t)||(n+=t),e})),n}this.$$("__sum").setValue(t("n_total_summ")),this.$$("__vats").setValue(t("n_vats_summ")),this.$$("__pos").setValue(t("n_amount"))},t.prototype.ready=function(){var e=this;this.setHeader(),this.hide_list.forEach((function(t){e.$$("__"+t+"_section").hide()}))},t.prototype.init=function(){},t}(i.c);function M(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function A(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}var F=document.app.states,U=function(e){function t(){return M(this,t),A(this,e.apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),t.prototype.config=function(){var e=this,t=this;this.app;return{view:"cWindow",localId:"__orderbody",width:.9*document.documentElement.clientWidth,height:.9*document.documentElement.clientHeight,padding:4,point:!1,relative:!1,modal:!1,move:!0,on:{onShow:function(){e.$$("__table").clearAll();var t=x.d.get(e.doc.n_id,"orders");e.$$("__table").parse(t)},onHide:function(){x.b.opened(e.doc.n_id,!0),e.focus&&webix.UIManager.setFocus(e.focus)}},body:{rows:[new L(t.app,t,!0),{view:"datatable",borderless:!0,name:"__orders_document",clipboard:!0,localId:"__table",navigation:!0,select:"cell",resizeColumn:!0,fixedRowHeight:!1,rowLineHeight:28,rowHeight:28,editable:!1,footer:!0,headermenu:{autowidth:!0,scroll:!0,autoheight:!1,spans:!0,yCount:4},data:{},css:"webix_header_border center_dt",scroll:"xy",tooltip:!0,columns:N,on:{onKeyPress:function(e,t){if("Delete"===t.key){var n=this.getSelectedId();this.remove(n)}},onAfterDelete:function(){t.setChange()},onLiveEdit:function(){},onDataUpdate:function(){t.setChange()},onItemClick:function(e,t){"...добавить"==this.getItem(e).n_product&&this.callEvent("onItemDblClick",[e])},onItemDblClick:function(e){}}},{borderless:!1,padding:3,cols:[{view:"button",width:136,localId:"__add",label:"подобрать товар",hidden:!0,on:{onItemClick:function(){}}},{},{view:"button",label:"Сохранить",localId:"__save",hidden:!0,width:136,on:{onItemClick:function(){}}},{view:"button",localId:"__hold",label:"Провести",width:136,hidden:!0,on:{onItemClick:function(){}}},{view:"button",width:136,localId:"__cancel",label:"Закрыть",on:{onItemClick:function(){e.hide()}}}]}]}}},t.prototype.getConfirm=function(){webix.modalbox({title:"Документ был изменен",type:"confirm-warning",buttons:["Да","Нет","Отменить"],text:"сохранить изменения?",width:500}).then((function(e){switch(e){case"0":document.message("Good!");break;case"1":document.message("Why?..");break;case"2":document.message("Come back later")}}))},t.prototype.show=function(e,t,n){if(this.flag_new=e.flag_new,this.change=!1,this.focus=t,this.table=n,this.doc=e,e){var i=F[e.n_state];return this.getRoot().getHead().getChildViews()[0].setValue('<span style="color: '+i.color+'">('+i.value+")</span> Заказ покупателя от "+webix.i18n.dateFormatStr(e.n_dt_invoice)+", "+(e.n_recipient||"")),this.getRoot().show(),webix.UIManager.setFocus(this.$$("__table"))}return!1},t.prototype.validateDocument=function(e,t){var n=!1;for(var i in t.header.n_number||(n="Укажите номер документа"),t.header.n_supplier||(n="Укажите поставщика"),t.header.n_recipient||(n="Укажите получателя"),t.table.length<2&&(n="Добавьте товары"),t.table){var o=t.table[i];o.n_code&&((!o.n_amount||isNaN(o.n_amount)||+o.n_amount<0)&&(n="Неверное количство в строке "+(o.row_num?o.row_num+1:"")),(!o.n_price||o.n_price<=0)&&(n="Неверная цена в строке "+(o.row_num+1)))}return n},t.prototype.saveDocumentServer=function(e,t){var n=Object(x.d)(t,e.doc.id,"orders");return n.data&&n.data[0]?(this.doc=n.data[0],this.getHeader.$$("__n_id").setValue(this.doc.n_id),this.table&&(this.flag_new?this.table.add(n.data[0],0):(n.data[0].id=n.kwargs.intable,this.table.updateItem(n.kwargs.intable,n.data[0]))),!1):"Ошибка записи на сервер"},t.prototype.getHeader=function(){return this.getRoot().getChildViews()[1].getChildViews()[0].$scope},t.prototype.setHeader=function(){return this.getHeader.setHeader()},t.prototype.hide=function(){return this.$$("__table").clearAll(),this.getRoot().hide()},t.prototype.add_new=function(e){var t=this.$$("__table").count();this.$$("__table").add(e,t-1),this.setChange(),this.recalcTable()},t.prototype.recalcTable=function(){var e=this.$$("__table");e.blockEvent(),e.eachRow((function(t){var n=e.getItem(t);n.n_code&&(n.n_novats_summ=n.n_price*n.n_amount,n.n_vats_summ=n.n_novats_summ*(+n.n_vats_base.replace("%","").replace("НДС ","")/100),n.n_total_summ=n.n_novats_summ+n.n_vats_summ,e.updateItem(t,n))})),e.unblockEvent(),this.getHeader().recalcHeader(e)},t.prototype.setUnchange=function(){},t.prototype.setChange=function(){},t.prototype.ready=function(){webix.UIManager.addHotKey("enter",(function(e){var t=e.getSelectedId();e.edit(t)}),this.$$("__table"))},t.prototype.init=function(){this.doc_type="Заказ покупателя"},t}(i.c),K=[{in:"row_num",headermenu:!1,width:50,template:function(e,t,n,i){return isNaN(e.row_num)?"":e.row_num+1}},{id:"n_id",hidden:!0,headermenu:!1,width:0},{id:"n_product",fillspace:1,header:[{text:"Товар"}],headermenu:!1,footer:{text:"всего:",colspan:3}},{id:"n_code",width:80,header:[{text:"Код"}],headermenu:!1},{id:"n_consignment",width:100,header:[{text:"Партия"}],headermenu:!1,editor:"text"},{id:"n_unit",width:160,hidden:!0,header:[{text:"Единица измерения"}],headermenu:!0},{id:"n_okei_code",width:160,header:[{text:"Код по ОКЕИ"}],hidden:!0,headermenu:!0,editor:"text"},{id:"n_type_package",width:140,header:[{text:"Вид упак."}],hidden:!0,headermenu:!0},{id:"n_amount_mass",width:120,header:[{text:"Кол-во(масса) в одном месте"}],hidden:!0,headermenu:!0},{id:"n_amount_b",width:90,header:[{text:"Мест, шт."}],headermenu:!0,hidden:!0},{id:"n_gross_weight",width:100,header:[{text:"Масса (брутто)"}],hidden:!0,headermenu:!0},{id:"n_amount",width:150,header:[{text:"Кол-во"}],headermenu:!1,editor:"text",footer:{content:"summColumn"}},{id:"n_price",width:80,header:[{text:"Цена, руб."}],headermenu:!1,editor:"price",format:webix.Number.formatNumber},{id:"n_novats_summ",width:160,header:[{text:"Сумма без НДС"}],headermenu:!1,hidden:!0,footer:{content:"totalColumn"},format:webix.Number.formatNumber},{id:"n_vats_base",width:160,header:[{text:"НДС, ставка"}],headermenu:!1,hidden:!0,editor:"select",options:["НДС 0%","НДС 10%","НДС 20%"]},{id:"n_vats_summ",width:160,header:[{text:"НДС, сумма"}],headermenu:!1,hidden:!0,footer:{content:"totalColumn"},format:webix.Number.formatNumber},{id:"n_total_summ",width:160,header:[{text:"Сумма"}],headermenu:!1,editor:"price",footer:{content:"totalColumn"},format:webix.Number.formatNumber},{id:"n_prod_id",width:5,headermenu:!1,hidden:!0}],q=[{in:"row_num",headermenu:!1,width:50,template:function(e,t,n,i){return isNaN(e.row_num)?"":e.row_num+1}},{id:"n_id",hidden:!0,headermenu:!1,width:0},{id:"n_product",fillspace:1,header:[{text:"Товар"}],headermenu:!1,footer:{text:"всего:",colspan:3}},{id:"n_amount",width:80,header:[{text:"Кол-во"}],headermenu:!1},{id:"n_price",width:80,header:[{text:"Цена"}],headermenu:!1,format:webix.Number.formatNumber},{id:"n_total_summ",width:120,header:[{text:"Общая сумма"}],headermenu:!1,footer:{content:"totalColumn"},format:webix.Number.formatNumber},{id:"n_charge",width:80,header:[{text:"Наценка, %"}],headermenu:!1,editor:"text"},{id:"n_price_price",width:100,header:[{text:"Цена в прайс"}],headermenu:!1,editor:"price",format:webix.Number.formatNumber},{id:"n_total_price_summ",width:120,header:[{text:"Сумма в прайс"}],headermenu:!1,footer:{content:"totalColumn"},format:webix.Number.formatNumber},{id:"n_prod_id",width:5,headermenu:!1,hidden:!0}];!function(e){function t(n,i,o){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var r=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,e.call(this,n));return r.parent=i,r.ids=o,r}(function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)})(t,e),t.prototype.config=function(){var e=this,t={localId:"__header-form",borderless:!0,rows:[{view:"text",name:"n_id",localId:"__n_id",disabled:!0,width:0,hidden:!0},{height:k.d},{rows:[{template:"Итого по документу",type:"section"},{cols:[{view:"text",label:"Наценка, %",value:"",format:"1111.00",labelPosition:"top",localId:"__charge",disabled:!1,name:"n_charge",labelWidth:100,on:{onChange:function(){e.recalcTable("all")}}},{view:"text",label:"Сумма документа",labelWidth:120,format:j.formatText,labelPosition:"top",disabled:!0,localId:"__sum"},{width:k.d},{view:"text",label:"Сумма в прайс",labelWidth:120,format:j.formatText,labelPosition:"top",disabled:!0,localId:"__sum_price"},{width:k.d},{view:"text",label:"Количество позиций",labelWidth:135,disabled:!0,labelPosition:"top",localId:"__pos"}]}]},{rows:[{view:"text",disabled:!0,value:"",label:"Поставщик",labelPosition:"top",name:"n_supplier",localId:"__supplier",labelWidth:0}]}]},n={view:"datatable",borderless:!0,name:"__shipments_document",clipboard:!0,localId:"__table",navigation:!0,select:"cell",resizeColumn:!0,fixedRowHeight:!1,rowLineHeight:28,rowHeight:28,editable:!0,editaction:"custom",footer:!0,headermenu:{autowidth:!0,scroll:!0,autoheight:!1,spans:!0,yCount:4},data:{},css:"webix_header_border center_dt",scroll:"xy",tooltip:!0,columns:q,on:{onItemClick:function(e){this.editCell(e.row,e.column)},onDataUpdate:function(e,t,n){t.n_charge&&n.n_charge!=t.n_charge?this.$scope.recalcTable("charge"):t.n_price_price&&n.n_price_price!=t.n_price_price&&this.$scope.recalcTable("price")}}};return{view:"cWindow",loclalId:"_popup",padding:4,point:!1,toFront:!0,relative:!0,modal:!0,css:"menu_filters",escHide:!0,on:{onShow:function(){},onHide:function(){this.destructor()}},width:.6*document.documentElement.clientWidth,height:.8*document.documentElement.clientHeight,body:{rows:[t,n,{borderless:!1,cols:[{},{view:"button",label:"Установить",width:136,localId:"__apply",on:{onItemClick:function(){e.validate()?x.a.set_charge({table:e.$$("__table").serialize(),doc_id:e.$$("__n_id").getValue()})&&e.hide():document.message("Устанвите наценки, иначе товар не попадет в прайс","error",5)}}}]}]}}},t.prototype.validate=function(){var e=this.$$("__table"),t=!0;return e.mapCells(null,"n_price_price",null,1,(function(e){return isNaN(+e)&&(t=!1),e})),t},t.prototype.getSum=function(e,t){var n=0;return e.mapCells(null,t,null,1,(function(e){var t=+e;return isNaN(t)||(n+=t),e})),n},t.prototype.show=function(e){var t=this;e&&this.getRoot().getHead().getChildViews()[0].setValue(e),this.getRoot().getHead().getChildViews()[1].hide();var n=x.a.get_all(this.ids);this.getRoot().show(),this.$$("__n_id").setValue(this.parent.doc.n_id);this.parent.$$("__table").serialize();this.$$("__table").clearAll(),n.data.forEach((function(e){var n={n_id:e.n_id,n_amount:e.n_amount,n_price:e.n_price,n_total_summ:e.n_total_summ,n_product:e.n_product};t.$$("__table").add(n)})),webix.UIManager.addHotKey("enter",(function(e){var t=e.getSelectedId();e.edit(t)}),this.$$("__table")),this.$$("__charge").focus()},t.prototype.recalcTable=function(e){var t=this.$$("__table");if(t.blockEvent(),"all"==e){var n=+this.$$("__charge").getValue();t.eachRow((function(e){var i=t.getItem(e);i.n_charge=n,i.n_price_price=i.n_price*(+i.n_charge+100)/100,i.n_total_price_summ=i.n_price_price*i.n_amount,i.n_total_summ=i.n_price*i.n_amount,t.updateItem(e,i)}))}else if("charge"==e){t.eachRow((function(e){var n=t.getItem(e),i=n.n_charge;null==i||isNaN(i)||(n.n_charge=(+i).toFixed(2),n.n_price_price=(n.n_price*(+i+100)/100).toFixed(0),n.n_total_price_summ=n.n_price_price*n.n_amount,n.n_total_summ=n.n_price*n.n_amount,t.updateItem(e,n))})),this.$$("__charge").blockEvent();var i=this.getSum(t,"n_price"),o=this.getSum(t,"n_price_price");this.$$("__charge").setValue(i<=o?charge.toFixed(2):""),this.$$("__charge").unblockEvent()}else if("price"==e){t.eachRow((function(e){var n=t.getItem(e),i=n.n_price_price/n.n_price*100-100;isNaN(i)||(n.n_charge=i.toFixed(2),n.n_total_price_summ=n.n_price_price*n.n_amount,n.n_total_summ=n.n_price*n.n_amount,t.updateItem(e,n))})),this.$$("__charge").blockEvent();var r=this.getSum(t,"n_price"),a=this.getSum(t,"n_price_price"),s=a/r*100-100;this.$$("__charge").setValue(r<=a?s.toFixed(2):""),this.$$("__charge").unblockEvent()}t.unblockEvent(),this.$$("__sum").setValue(this.getSum(t,"n_total_summ")),this.$$("__pos").setValue(this.getSum(t,"n_amount")),this.$$("__sum_price").setValue(this.getSum(t,"n_total_price_summ"))},t.prototype.hide=function(){var e=this;setTimeout((function(){return e.getRoot().hide()}),10)},t.prototype.ready=function(){},t.prototype.init=function(){}}(i.c);var z=[{id:"c_id",hidden:!0,headermenu:!1,width:5},{id:"c_code",width:150,header:[{text:Object(j.names)("c_code").value}],headermenu:!0,hidden:!1},{id:"c_name",fillspace:!0,sort:"server",header:[{text:Object(j.names)("c_name").value}],headermenu:!1,footer:{content:"totalTableLong"},filter_type:"text"},{id:"c_namefull",width:250,sort:"server",header:[{text:Object(j.names)("c_namefull").value}],headermenu:!0,hidden:!0},{id:"c_vat",hidden:!0,headermenu:!1,width:5}];var B=function(e){function t(n,i,o){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var r=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,e.call(this,n));return r.parent=i,r.s_sel=o,r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),t.prototype.config=function(){var e,t=this,n=this;this.table_id=webix.uid();var i=new O(n.app,{columns:z,loadFunction:x.h.product_data,sorting:{id:"c_name",dir:"asc"},topParent:n,id:this.table_id,dblClick:function(e,t){if(e){var i=t.getItem(e),o=n.parent.$scope.getHeader().$$("__number").getValue(),r=n.parent.$scope.getHeader().$$("__date").getValue(),a=o+":"+(r=webix.Date.dateToStr("%d%m%y")(r));i={n_id:void 0,n_product:i.c_name,n_code:i.c_code,n_unit:"шт.",n_okei_code:"",n_type_package:"",n_amount_mass:"",n_amount_b:"",n_gross_weight:"",n_amount:1,n_price:"",n_novats_summ:"",n_vats_base:i.c_vat,n_vats_summ:"",n_total_summ:"",n_prod_id:i.c_id,n_consignment:"Ввод остатков"==n.parent.$scope.doc_type?"остатки":a};var s=n.parent.getItem(n.s_sel),c=s?JSON.parse(JSON.stringify(s)):{};n.searchDuplicates(n.parent,i.n_prod_id)?(n.parent.$scope.con_count+=1,i.n_consignment=i.n_consignment+"_"+n.parent.$scope.con_count,n.s_sel?(n.parent.updateItem(n.s_sel.row,i),c.n_prod_id||(delete c.id,n.parent.add(c))):n.parent.$scope.add_new(i)):n.s_sel?(n.parent.updateItem(n.s_sel.row,i),c.n_prod_id||(delete c.id,n.parent.add(c))):n.parent.$scope.add_new(i),n.s_sel&&n.hide()}}});return(e={view:"cWindow",loclalId:"_popup",width:420,padding:4,point:!1,toFront:!0,relative:!0,modal:!0,css:"menu_filters",escHide:!0,on:{onShow:function(){},onHide:function(){this.destructor()}}}).width=.6*document.documentElement.clientWidth,e.height=.8*document.documentElement.clientHeight,e.body={rows:[{cols:[{view:"text",localId:"__search",label:"",name:"_search",labelWidth:0,width:450,hidden:!1,on:{onKeyPress:function(e,t){var n=this;clearTimeout(this.delay),this.delay=setTimeout((function(){n.$scope.getData()}),850)}}},{},{view:"button",label:"Ред.",width:50,tooltip:"Редактировать товар",localId:"__edit",hidden:!0,on:{onItemClick:function(){var e=$$(t.table_id).getSelectedItem();t.ui(new I(t.app,t,{c_id:e.c_id,c_name:e.c_name,id:e.id})).show()}}},{view:"button",label:"доб.",width:50,tooltip:"Добавить товар",localId:"__add",on:{onItemClick:function(){t.ui(new I(t.app,t,!1)).show()}}}]},i,{borderless:!1,cols:[{},{view:"button",label:"Закрыть",width:136,localId:"__apply",on:{onItemClick:function(){t.hide()}}}]}]},e},t.prototype.searchDuplicates=function(e,t){var n=void 0;return e.eachRow((function(i){var o=e.getItem(i);o.n_prod_id&&o.n_prod_id.toString()===t.toString()&&(n=i)})),n},t.prototype.getData=function(){var e=$$(this.table_id);e.clearAll(!0),e.loadNext(0,0,0,0,1).then((function(t){t&&(e.clearAll(!0),e.parse(t),e.showItemByIndex(0))}))},t.prototype.getFilter=function(){var e="";try{e=this.$$("__search").getValue()}catch(e){}return e},t.prototype.show=function(e){e&&this.getRoot().getHead().getChildViews()[0].setValue(e),this.getRoot().show()},t.prototype.hide=function(){var e=this;setTimeout((function(){return e.getRoot().hide()}),10)},t.prototype.ready=function(){this.$$("__search").focus()},t.prototype.init=function(){},t}(i.c);var J=document.app.states,Y=function(e){function t(n){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,e.call(this,n))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),t.prototype.config=function(){var e=this,t=this,n=this.app;return{view:"cWindow",localId:"__arrivalbody",width:.9*document.documentElement.clientWidth,height:.9*document.documentElement.clientHeight,padding:4,point:!1,relative:!1,modal:!1,move:!0,on:{onShow:function(){1==e.doc.n_state?e.$$("__hold").show():e.$$("__hold").hide(),1==e.doc.n_state?e.$$("__add").show():e.$$("__add").hide(),1==e.change?e.$$("__save").show():e.$$("__save").hide(),e.$$("__table").clearAll();var t=x.d.get(e.doc.n_id,"arrivals");1==e.doc.n_state&&t.data.push({n_product:"...добавить"}),e.$$("__table").parse(t)},onHide:function(){x.b.opened(e.doc.n_id,!0),e.focus&&webix.UIManager.setFocus(e.focus)}},body:{rows:[new L(n,t),{view:"datatable",borderless:!0,name:"__arrivals_document",clipboard:!0,localId:"__table",navigation:!0,select:"cell",resizeColumn:!0,fixedRowHeight:!1,rowLineHeight:28,rowHeight:28,editable:!0,footer:!0,headermenu:{autowidth:!0,scroll:!0,autoheight:!1,spans:!0,yCount:4},data:{},css:"webix_header_border center_dt",scroll:"xy",tooltip:!0,columns:K,on:{onKeyPress:function(e,t){if("Delete"===t.key){var n=this.getSelectedId();this.remove(n)}},onAfterDelete:function(){t.setChange()},onLiveEdit:function(){},onDataUpdate:function(e,n,i){var o=void 0;n.n_total_summ!=i.n_total_summ?o="n_total_summ":n.n_proci!=i.n_price&&(o="n_price"),t.setChange(o)},onItemClick:function(e,t){"...добавить"==this.getItem(e).n_product&&this.callEvent("onItemDblClick",[e])},onItemDblClick:function(e){1==t.doc.n_state&&t.ui(new B(n,this,e)).show("Приходный документ. Подбор товара")}}},{borderless:!1,padding:3,cols:[{view:"button",width:136,localId:"__add",label:"подобрать товар",on:{onItemClick:function(){1==t.doc.n_state&&t.ui(new B(n,t.$$("__table"))).show("Приходный документ. Подбор товара")}}},{view:"button",localId:"__report",label:"Печать",width:136,on:{onItemClick:function(){2!=e.doc.n_state?e.$$("__save").callEvent("onItemClick")||pe.document(e,"arrival",e.doc):pe.document(e,"arrival",e.doc)}}},{},{view:"button",label:"Сохранить",localId:"__save",width:136,on:{onItemClick:function(){var t=n.getService("common").saveDocument(e);return t?document.message(t,"error",3):(e.setUnchange(),e.flag_new=!1),t}}},{view:"button",localId:"__hold",label:"Провести",width:136,on:{onItemClick:function(){if(!e.$$("__save").callEvent("onItemClick")){var t=n.getService("common").holdDocument("arrival",e.doc.n_id,e.doc.id);t.data?(e.table&&(e.flag_new?document.message("ищем позицию и апдейтим ее"):e.table.updateItem(t.kwargs.filters.intable,t.data[0])),e.hide()):document.message("Ошибка транзакции при проведении документа","error",3)}}}},{view:"button",width:136,localId:"__cancel",label:"Закрыть",on:{onItemClick:function(){e.hide()}}}]}]}}},t.prototype.getConfirm=function(){webix.modalbox({title:"Документ был изменен",type:"confirm-warning",buttons:["Да","Нет","Отменить"],text:"сохранить изменения?",width:500}).then((function(e){switch(e){case"0":document.message("Good!");break;case"1":document.message("Why?..");break;case"2":document.message("Come back later")}}))},t.prototype.show=function(e,t,n){if(this.flag_new=e.flag_new,this.change=!1,this.focus=t,this.table=n,this.doc=e,e){var i=J[e.n_state];return this.getRoot().getHead().getChildViews()[0].setValue('<span style="color: '+i.color+'">('+i.value+")</span> Приходный документ №"+(e.n_number||"")+" от "+webix.i18n.dateFormatStr(e.n_dt_invoice)+", "+(e.n_supplier||"")),this.getRoot().show(),webix.UIManager.setFocus(this.$$("__table"))}return!1},t.prototype.validateDocument=function(e,t){var n=!1;for(var i in t.header.n_number||(n="Укажите номер документа"),t.header.n_supplier||(n="Укажите поставщика"),t.header.n_recipient||(n="Укажите получателя"),t.table.length<2&&(n="Добавьте товары"),t.table){var o=t.table[i];o.n_code&&((!o.n_amount||isNaN(o.n_amount)||+o.n_amount<0)&&(n="Неверное количество в строке "+(o.row_num?o.row_num+1:"")),(!o.n_price||o.n_price<=0)&&(n="Неверная цена в строке "+(o.row_num+1)),o.n_consignment||(n="Укажите партию в строке "+(o.row_num+1)))}return n},t.prototype.saveDocumentServer=function(e,t){var n=x.d.save(t,e.doc.id,"arrivals");return n.data&&n.data[0]?(this.doc=n.data[0],this.getHeader().$$("__n_id").setValue(this.doc.n_id),this.table&&(this.flag_new?this.table.add(n.data[0],0):(n.data[0].id=n.kwargs.intable,this.table.updateItem(n.kwargs.intable,n.data[0]))),!1):"Ошибка записи на сервер"},t.prototype.getHeader=function(){return this.getRoot().getChildViews()[1].getChildViews()[0].$scope},t.prototype.setHeader=function(){return this.getHeader().setHeader()},t.prototype.hide=function(){return this.$$("__table").clearAll(),this.getRoot().hide()},t.prototype.add_new=function(e){var t=this.$$("__table").count();this.$$("__table").add(e,t-1),this.setChange(),this.recalcTable()},t.prototype.recalcTable=function(e){var t=this.$$("__table");t.blockEvent(),t.eachRow((function(n){var i=t.getItem(n);i.n_code&&("n_price"!=e?(i.n_vats_summ=0,i.n_novats_summ=i.n_total_summ-i.n_vats_summ,i.n_novats_summ=i.n_price=i.n_novats_summ/i.n_amount):(i.n_novats_summ=i.n_price*i.n_amount,i.n_vats_summ=0,i.n_total_summ=i.n_novats_summ+i.n_vats_summ),t.updateItem(n,i))})),t.unblockEvent(),this.getHeader().recalcHeader(t)},t.prototype.setUnchange=function(){this.change=!1;var e=this.getRoot().getHead().getChildViews()[0];this.$$("__save").hide(),e.setValue(e.getValue().replace('<span class="changed">  изменен</span>',""))},t.prototype.setChange=function(e){this.change=!0;var t=this.getRoot().getHead().getChildViews()[0];this.$$("__save").show(),0===t.$view.querySelectorAll('[class="changed"]').length&&t.setValue(t.getValue()+'<span class="changed">  изменен</span>'),this.recalcTable(e)},t.prototype.ready=function(){webix.UIManager.addHotKey("enter",(function(e){var t=e.getSelectedId();e.edit(t)}),this.$$("__table"))},t.prototype.init=function(){this.con_count=0,this.doc_type="Приходная накладная",this._block="recipient"},t}(i.c),Z=[{in:"row_num",headermenu:!1,width:50,template:function(e,t,n,i){return isNaN(e.row_num)?"":e.row_num+1}},{id:"n_id",hidden:!0,headermenu:!1,width:0},{id:"n_product",fillspace:1,header:[{text:"Товар"}],headermenu:!1,footer:{text:"всего:",colspan:3}},{id:"n_code",width:80,header:[{text:"Код"}],headermenu:!1},{id:"n_unit",width:160,hidden:!0,header:[{text:"Единица измерения"}],headermenu:!0},{id:"n_okei_code",width:160,header:[{text:"Код по ОКЕИ"}],hidden:!0,headermenu:!0,editor:"text"},{id:"n_type_package",width:140,header:[{text:"Вид упак."}],hidden:!0,headermenu:!0},{id:"n_amount_mass",width:120,header:[{text:"Кол-во(масса) в одном месте"}],hidden:!0,headermenu:!0},{id:"n_amount_b",width:90,header:[{text:"Мест, шт."}],headermenu:!0,hidden:!0},{id:"n_gross_weight",width:100,header:[{text:"Масса (брутто)"}],hidden:!0,headermenu:!0},{id:"n_price",width:80,header:[{text:"Цена, руб."}],headermenu:!1,format:webix.Number.formatNumber},{id:"n_vat",width:100,header:[{text:"НДС"}],headermenu:!1,format:webix.Number.formatNumber},{id:"n_amount",width:80,header:[{text:"Кол-во"}],headermenu:!1,editor:"text",footer:{content:"summColumn"}},{id:"n_stock",width:80,header:[{text:"В наличии"}],headermenu:!1},{id:"n_charge",width:80,header:[{text:"Наценка, %"}],headermenu:!1,editor:"text"},{id:"n_ship_price",width:100,header:[{text:"Отп.цена, руб."}],headermenu:!1,editor:"price",format:webix.Number.formatNumber},{id:"n_novats_summ",width:100,header:[{text:"Сумма без НДС"}],headermenu:!1,footer:{content:"totalColumn"},format:webix.Number.formatNumber},{id:"n_vats_summ",width:100,header:[{text:"НДС, сумма"}],hidden:!1,headermenu:!1,footer:{content:"totalColumn"},format:webix.Number.formatNumber},{id:"n_total_summ",width:120,header:[{text:"Сумма с НДС"}],headermenu:!1,footer:{content:"totalColumn"},format:webix.Number.formatNumber},{id:"n_prod_id",width:5,headermenu:!1,hidden:!0},{id:"n_balance_id",width:5,headermenu:!1,hidden:!0}],G=[{id:"n_id",hidden:!0,headermenu:!1,width:5},{id:"n_code",width:80,header:[{text:"Код товара"}],headermenu:!0,hidden:!1},{id:"n_product",fillspace:!0,sort:"server",header:[{text:"Наименование"}],headermenu:!1,footer:{content:"totalTableLong"},filter_type:"text"},{id:"n_quantity",sort:"server",header:[{text:"Остаток"}],headermenu:!0,hidden:!1},{id:"n_price",sort:"server",header:[{text:"Цена"}],headermenu:!0,hidden:!1,format:webix.Number.formatNumber},{id:"n_vat",hidden:!0,headermenu:!0,header:[{text:"НДС"}],width:50,format:webix.Number.formatNumber}];var X=function(e){function t(n,i,o){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var r=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,e.call(this,n));return r.parent=i,r.s_sel=o,r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),t.prototype.config=function(){var e,t=this;return(e={view:"cWindow",loclalId:"_popup",width:420,padding:4,point:!1,toFront:!0,relative:!0,modal:!0,css:"menu_filters",escHide:!0,on:{onShow:function(){},onHide:function(){this.destructor()}}}).width=.6*document.documentElement.clientWidth,e.height=.8*document.documentElement.clientHeight,e.body={rows:[{cols:[{view:"text",localId:"__search",label:"",name:"_search",labelWidth:0,width:450,hidden:!1,on:{onKeyPress:function(e,t){var n=this;clearTimeout(this.delay),this.delay=setTimeout((function(){n.$scope.getData()}),850)}}},{},{view:"button",label:"РЕД",width:50,tooltip:"Редактировать товар",localId:"__edit",hidden:!0,on:{onItemClick:function(){var e=t.$$("__table").getSelectedItem();t.ui(new I(t.app,t,{c_id:e.c_id,c_name:e.c_name,id:e.id})).show()}}},{view:"button",label:"доб.",width:50,tooltip:"Добавить товар",localId:"__add",hidden:!0,on:{onItemClick:function(){t.ui(new I(t.app,t,!1)).show()}}}]},{view:"datatable",borderless:!0,clipboard:!0,localId:"__table",navigation:"row",select:"row",datafetch:30,datathrottle:10,loadahead:40,resizeColumn:!0,fixedRowHeight:!1,rowLineHeight:28,rowHeight:28,editable:!0,footer:!0,url:function(e){return x.a.get_data(e,this)},headermenu:{autowidth:!0,scroll:!0,autoheight:!1,spans:!0,yCount:4},css:"webix_header_border center_dt",scroll:"xy",tooltip:!0,columns:G,sorting:{id:"n_product",dir:"asc"},onClick:{},onContext:{},on:{onAfterSelect:function(){this.getSelectedId()},onAfterLoad:function(){this.markSorting(this.config.sorting.id,this.config.sorting.dir)},onKeyPress:function(e,t){if(13===e){var n=this.getSelectedId();this.callEvent("onItemDblClick",[n])}},onItemDblClick:function(e){if(e){var t=this.getItem(e);if(t={n_id:void 0,n_balance_id:t.n_balance_id,n_product:t.n_product,n_code:t.n_code,n_unit:"",n_okei_code:"",n_type_package:"",n_amount_mass:"",n_amount_b:"",n_gross_weight:"",n_stock:t.n_quantity,n_amount:1,n_charge:"",n_price:t.n_price,n_vat:t.n_vat,n_novats_summ:"",n_vats_summ:"",n_total_summ:"",n_prod_id:t.n_id},this.$scope.s_sel){var n=JSON.parse(JSON.stringify(this.$scope.parent.getItem(this.$scope.s_sel))),i=this.$scope.searchDuplicates(this.$scope.parent,t.n_prod_id);if(i){var o=this.$scope.parent.getItem(i);o.n_amount+=1,this.$scope.parent.updateItem(i,o),this.$scope.parent.remove(n.id)}else this.$scope.parent.updateItem(this.$scope.s_sel.row,t),n.n_prod_id||(delete n.id,this.$scope.parent.add(n));this.$scope.hide()}else if("datatable"===this.$scope.parent.config.view){var r=this.$scope.searchDuplicates(this.$scope.parent,t.n_prod_id);if(r){var a=this.$scope.parent.getItem(r);a.n_amount+=1,this.$scope.parent.updateItem(r,a)}else this.$scope.parent.$scope.add_new(t)}}}}},{borderless:!1,cols:[{},{view:"button",label:"Закрыть",width:136,localId:"__apply",on:{onItemClick:function(){t.hide()}}}]}]},e},t.prototype.searchDuplicates=function(e,t){var n=void 0;return e.eachRow((function(i){var o=e.getItem(i);o.n_prod_id&&o.n_prod_id.toString()===t.toString()&&(n=i)})),n},t.prototype.getData=function(){var e=this;this.$$("__table").clearAll(!0),this.$$("__table").loadNext(0,0,0,0,1).then((function(t){t&&(e.$$("__table").clearAll(!0),e.$$("__table").parse(t),e.$$("__table").showItemByIndex(0))}))},t.prototype.getFilter=function(){var e="";try{e=this.$$("__search").getValue()}catch(e){}return e},t.prototype.show=function(e){e&&this.getRoot().getHead().getChildViews()[0].setValue(e),this.getRoot().show()},t.prototype.hide=function(){var e=this;setTimeout((function(){return e.getRoot().hide()}),10)},t.prototype.ready=function(){this.$$("__search").focus()},t.prototype.init=function(){},t}(i.c);function Q(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ee(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}var te=document.app.states,ne=function(e){function t(){return Q(this,t),ee(this,e.apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),t.prototype.config=function(){var e,t=this,n=this,i=this.app;return{view:"cWindow",localId:"__shipmentbody",width:.9*document.documentElement.clientWidth,height:.9*document.documentElement.clientHeight,padding:4,point:!1,relative:!1,modal:!1,move:!0,on:{onShow:function(){1==t.doc.n_state?t.$$("__hold").show():t.$$("__hold").hide(),1==t.doc.n_state?t.$$("__add").show():t.$$("__add").hide(),1==t.change?t.$$("__save").show():t.$$("__save").hide();var e=void 0;e=t.base?x.d.get_on_order(t.base):x.d.get(t.doc.n_id,"shipments"),t.$$("__table").clearAll(),1==t.doc.n_state&&e.data.push({n_product:"...добавить"}),t.$$("__table").parse(e),setTimeout((function(){t.getHeader().recalcHeader&&t.getHeader().recalcHeader(t.$$("__table"))}),100);var n=t.$$("__table");n.eachRow((function(e){n.getItem(e).warning&&n.addCss(e,"warning")}))},onHide:function(){x.b.opened(t.doc.n_id,!0),t.focus&&webix.UIManager.setFocus(t.focus)}},body:{localId:"__body",rows:[{cols:[{view:"text",width:250,label:"Наценка на документ, %",value:"",localId:"__charge",name:"n_charge",labelWidth:150,on:{onChange:function(){}}},{}]},new L(i,n),{view:"datatable",borderless:!0,name:"__shipments_document",clipboard:!0,localId:"__table",navigation:!0,select:"cell",resizeColumn:!0,fixedRowHeight:!1,rowLineHeight:28,rowHeight:28,editable:!0,footer:!0,headermenu:{autowidth:!0,scroll:!0,autoheight:!1,spans:!0,yCount:4},data:{},css:"webix_header_border center_dt",scroll:"xy",tooltip:!0,columns:Z,on:(e={onKeyPress:function(e,t){if("Delete"===t.key){var n=this.getSelectedId();this.remove(n)}},onAfterDelete:function(){n.setChange()},onLiveEdit:function(){},onAfterLoad:function(){this.count()>1&&n.recalcTable()},onAfterAdd:function(){}},e.onAfterDelete=function(){},e.onDataUpdate=function(){n.setChange()},e.onItemClick=function(e,t){"...добавить"==this.getItem(e).n_product&&this.callEvent("onItemDblClick",[e])},e.onItemDblClick=function(e){1==n.doc.n_state&&n.ui(new X(i,this,e)).show("Приходный документ. Подбор товара")},e)},{borderless:!1,padding:3,cols:[{view:"button",width:136,localId:"__add",label:"подобрать товар",on:{onItemClick:function(){1==n.doc.n_state&&n.ui(new X(i,n.$$("__table"))).show("Приходный документ. Подбор товара")}}},{view:"button",localId:"__report",label:"Печать",width:136,on:{onItemClick:function(){2!=t.doc.n_state?t.$$("__save").callEvent("onItemClick")||pe.document(t,"shipment",t.doc):pe.document(t,"shipment",t.doc)}}},{},{view:"button",label:"Сохранить",localId:"__save",width:136,on:{onItemClick:function(){var e=i.getService("common").saveDocument(t);return e?document.message(e,"error",3):(t.setUnChange(),t.flag_new=!1),e}}},{view:"button",localId:"__hold",label:"Провести",width:136,on:{onItemClick:function(){if(!t.$$("__save").callEvent("onItemClick")){var e=i.getService("common").holdDocument("shipment",t.doc.n_id,t.doc.id);e.data?(t.table&&(t.flag_new?document.message("ищем позицию и апдейтим ее"):t.table.updateItem(e.kwargs.filters.intable,e.data[0])),t.hide()):document.message("Ошибка проведения транзакции","error",3)}}}},{view:"button",width:136,localId:"__cancel",label:"Закрыть",on:{onItemClick:function(){t.hide()}}}]}]}}},t.prototype.getConfirm=function(){webix.modalbox({title:"Документ был изменен",type:"confirm-warning",buttons:["Да","Нет","Отменить"],text:"сохранить изменения?",width:500}).then((function(e){switch(e){case"0":document.message("Good!");break;case"1":document.message("Why?..");break;case"2":document.message("Come back later")}}))},t.prototype.show=function(e,t,n){if(this.flag_new=e.flag_new,this.base=e.order_id,this.change=!1,this.focus=t,this.table=n,this.doc=e,e){var i=te[e.n_state];this.getRoot().getHead().getChildViews()[0].setValue('<span style="color: '+i.color+'">('+i.value+")</span> Отгрузка №"+(e.n_number||"")+" от "+webix.i18n.dateFormatStr(e.n_dt_invoice)+", "+(e.n_supplier||"")),this.getRoot().show(),webix.UIManager.setFocus(this.$$("__table"))}2==this.doc.n_state&&(this.$$("__table").disable(),this.$$("__charge").disable())},t.prototype.validateDocument=function(e,t){var n=!1;for(var i in t.header.n_number||(n="Укажите номер документа"),t.header.n_supplier||(n="Укажите поставщика"),t.header.n_recipient||(n="Укажите получателя"),t.table.length<2&&(n="Добавьте товары"),t.table){var o=t.table[i];o.n_code&&((!o.n_amount||isNaN(o.n_amount)||+o.n_amount<0)&&(n="Неверное количство в строке "+(o.row_num?o.row_num+1:"")),o.n_stock<o.n_amount&&(n="Количество на складе меньше чем в заказе в строке "+(o.row_num+1)),(!o.n_price||o.n_price<=0)&&(n="Неверная цена в строке "+(o.row_num+1)))}return n},t.prototype.saveDocumentServer=function(e,t){var n=x.d.save(t,e.doc.id,"shipments");return n.data&&n.data[0]?(this.doc=n.data[0],this.getHeader().$$("__n_id").setValue(this.doc.n_id),this.table&&(this.flag_new?this.table.add(n.data[0],0):(n.data[0].id=n.kwargs.intable,this.table.updateItem(n.kwargs.intable,n.data[0]))),!1):"Ошибка записи на сервер"},t.prototype.getHeader=function(){return this.getRoot().getChildViews()[1].getChildViews()[1].$scope},t.prototype.setHeader=function(){return this.getHeader.setHeader()},t.prototype.hide=function(){return this.$$("__table").clearAll(),this.getRoot().hide()},t.prototype.add_new=function(e){var t=this.$$("__table").count();this.$$("__table").add(e,t-1),this.setChange(),this.recalcTable()},t.prototype.recalcTable=function(){var e=this.$$("__table");function t(t){var n=0;return e.mapCells(null,t,null,1,(function(e){var t=+e;return isNaN(t)||(n+=t),e})),n}e.blockEvent(),e.eachRow((function(t){var n=e.getItem(t);n.n_stock<n.n_amount?e.addCss(t,"warning"):e.removeCss(t,"warning"),n.n_code&&(n.n_ship_price=n.n_price*(+n.n_charge+100)/100,n.n_novats_summ=n.n_ship_price*n.n_amount,n.n_vats_summ=n.n_amount*(n.n_vat*(+n.n_charge+100)/100),n.n_total_summ=n.n_novats_summ+n.n_vats_summ,e.updateItem(t,n))}));var n=t("n_price"),i=t("n_ship_price")/n*100-100;this.$$("__charge").setValue(i.toFixed(2)),e.unblockEvent(),this.getHeader().recalcHeader&&this.getHeader().recalcHeader(e)},t.prototype.setUnChange=function(){this.change=!1;var e=this.getRoot().getHead().getChildViews()[0];this.$$("__save").hide(),e.setValue(e.getValue().replace('<span class="changed">  изменен</span>',""))},t.prototype.setChange=function(){this.change=!0;var e=this.getRoot().getHead().getChildViews()[0];this.$$("__save").show(),0===e.$view.querySelectorAll('[class="changed"]').length&&e.setValue(e.getValue()+'<span class="changed">  изменен</span>'),this.recalcTable()},t.prototype.ready=function(){webix.UIManager.addHotKey("enter",(function(e){var t=e.getSelectedId();e.edit(t)}),this.$$("__table"))},t.prototype.init=function(){this.doc_type="Отгрузка",this._block="supplier"},t}(i.c),ie=[{in:"row_num",headermenu:!1,width:50,template:function(e,t,n,i){return isNaN(e.row_num)?"":e.row_num+1}},{id:"n_id",hidden:!0,headermenu:!1,width:0},{id:"n_product",fillspace:1,header:[{text:"Товар"}],headermenu:!1,footer:{text:"всего:",colspan:3}},{id:"n_code",width:80,header:[{text:"Код"}],headermenu:!1},{id:"n_unit",width:160,hidden:!0,header:[{text:"Единица измерения"}],headermenu:!0},{id:"n_okei_code",width:160,header:[{text:"Код по ОКЕИ"}],hidden:!0,headermenu:!0,editor:"text"},{id:"n_type_package",width:140,header:[{text:"Вид упак."}],hidden:!0,headermenu:!0},{id:"n_amount_mass",width:120,header:[{text:"Кол-во(масса) в одном месте"}],hidden:!0,headermenu:!0},{id:"n_amount_b",width:90,header:[{text:"Мест, шт."}],headermenu:!0,hidden:!0},{id:"n_gross_weight",width:100,header:[{text:"Масса (брутто)"}],hidden:!0,headermenu:!0},{id:"n_price",width:80,header:[{text:"Цена, руб."}],headermenu:!1,format:webix.Number.formatNumber},{id:"n_vat",width:100,header:[{text:"НДС"}],headermenu:!1,format:webix.Number.formatNumber},{id:"n_amount",width:80,header:[{text:"Кол-во"}],headermenu:!1,editor:"text",footer:{content:"summColumn"}},{id:"n_stock",width:80,header:[{text:"В наличии"}],headermenu:!1},{id:"n_charge",width:80,header:[{text:"Наценка, %"}],headermenu:!1,editor:"text"},{id:"n_ship_price",width:100,header:[{text:"Отп.цена, руб."}],headermenu:!1,editor:"price",format:webix.Number.formatNumber},{id:"n_novats_summ",width:100,header:[{text:"Сумма без НДС"}],hidden:!0,headermenu:!1,footer:{content:"totalColumn"},format:webix.Number.formatNumber},{id:"n_vats_summ",width:100,header:[{text:"НДС, сумма"}],hidden:!1,headermenu:!1,footer:{content:"totalColumn"},format:webix.Number.formatNumber},{id:"n_total_summ",width:120,header:[{text:"Сумма с НДС"}],headermenu:!1,footer:{content:"totalColumn"},format:webix.Number.formatNumber},{id:"n_prod_id",width:5,headermenu:!1,hidden:!0},{id:"n_balance_id",width:50,headermenu:!1,hidden:!0}],oe=[{id:"n_id",hidden:!0,headermenu:!1,width:5},{id:"n_code",width:80,header:[{text:"Код товара"}],headermenu:!0,hidden:!1},{id:"n_product",fillspace:!0,sort:"server",header:[{text:"Наименование"}],headermenu:!1,footer:{content:"totalTableLong"},filter_type:"text"},{id:"n_quantity",sort:"server",header:[{text:"Остаток"}],headermenu:!0,hidden:!1},{id:"n_price",sort:"server",header:[{text:"Цена"}],headermenu:!0,hidden:!1,format:webix.Number.formatNumber},{id:"n_vat",hidden:!0,headermenu:!0,header:[{text:"НДС"}],width:50,format:webix.Number.formatNumber}];var re=function(e){function t(n,i,o){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var r=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,e.call(this,n));return r.parent=i,r.s_sel=o,r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),t.prototype.config=function(){var e,t=this;return(e={view:"cWindow",loclalId:"_popup",width:420,padding:4,point:!1,toFront:!0,relative:!0,modal:!0,css:"menu_filters",escHide:!0,on:{onShow:function(){},onHide:function(){this.destructor()}}}).width=.6*document.documentElement.clientWidth,e.height=.8*document.documentElement.clientHeight,e.body={rows:[{cols:[{view:"text",localId:"__search",label:"",name:"_search",labelWidth:0,width:450,hidden:!1,on:{onKeyPress:function(e,t){var n=this;clearTimeout(this.delay),this.delay=setTimeout((function(){n.$scope.getData()}),850)}}},{},{view:"button",label:"РЕД",width:50,tooltip:"Редактировать товар",localId:"__edit",hidden:!0,on:{onItemClick:function(){var e=t.$$("__table").getSelectedItem();t.ui(new I(t.app,t,{c_id:e.c_id,c_name:e.c_name,id:e.id})).show()}}},{view:"button",label:"доб.",width:50,tooltip:"Добавить товар",localId:"__add",hidden:!0,on:{onItemClick:function(){t.ui(new I(t.app,t,!1)).show()}}}]},{view:"datatable",borderless:!0,clipboard:!0,localId:"__table",navigation:"row",select:"row",datafetch:30,datathrottle:10,loadahead:40,resizeColumn:!0,fixedRowHeight:!1,rowLineHeight:28,rowHeight:28,editable:!0,footer:!0,url:function(e){return x.a.get_data(e,this)},headermenu:{autowidth:!0,scroll:!0,autoheight:!1,spans:!0,yCount:4},css:"webix_header_border center_dt",scroll:"xy",tooltip:!0,columns:oe,sorting:{id:"n_product",dir:"asc"},onClick:{},onContext:{},on:{onAfterSelect:function(){this.getSelectedId()},onAfterLoad:function(){this.markSorting(this.config.sorting.id,this.config.sorting.dir)},onKeyPress:function(e,t){if(13===e){var n=this.getSelectedId();this.callEvent("onItemDblClick",[n])}},onItemDblClick:function(e){if(e){var t=this.getItem(e);if(t={n_id:void 0,n_balance_id:t.n_balance_id,n_product:t.n_product,n_code:t.n_code,n_unit:"",n_okei_code:"",n_type_package:"",n_amount_mass:"",n_amount_b:"",n_gross_weight:"",n_stock:t.n_quantity,n_amount:1,n_charge:"",n_price:t.n_price,n_vat:t.n_vat,n_novats_summ:"",n_vats_summ:"",n_total_summ:"",n_prod_id:t.n_product_id,c_limit_excl:t.c_limit_excl},this.$scope.s_sel){var n=JSON.parse(JSON.stringify(this.$scope.parent.getItem(this.$scope.s_sel))),i=this.$scope.searchDuplicates(this.$scope.parent,t.n_prod_id);if(i){var o=this.$scope.parent.getItem(i);o.n_amount+=1,this.$scope.parent.updateItem(i,o),this.$scope.parent.remove(n.id)}else this.$scope.parent.updateItem(this.$scope.s_sel.row,t),n.n_prod_id||(delete n.id,this.$scope.parent.add(n));this.$scope.hide()}else if("datatable"===this.$scope.parent.config.view){var r=this.$scope.searchDuplicates(this.$scope.parent,t.n_prod_id);if(r){var a=this.$scope.parent.getItem(r);a.n_amount+=1,this.$scope.parent.updateItem(r,a)}else this.$scope.parent.$scope.add_new(t)}}}}},{borderless:!1,cols:[{},{view:"button",label:"Закрыть",width:136,localId:"__apply",on:{onItemClick:function(){t.hide()}}}]}]},e},t.prototype.searchDuplicates=function(e,t){var n=void 0;return e.eachRow((function(i){var o=e.getItem(i);o.n_prod_id&&o.n_prod_id.toString()===t.toString()&&(n=i)})),n},t.prototype.getData=function(){var e=this;this.$$("__table").clearAll(!0),this.$$("__table").loadNext(0,0,0,0,1).then((function(t){t&&(e.$$("__table").clearAll(!0),e.$$("__table").parse(t),e.$$("__table").showItemByIndex(0))}))},t.prototype.getFilter=function(){var e="";try{e=this.$$("__search").getValue()}catch(e){}return e},t.prototype.show=function(e){e&&this.getRoot().getHead().getChildViews()[0].setValue(e),this.getRoot().show()},t.prototype.hide=function(){var e=this;setTimeout((function(){return e.getRoot().hide()}),10)},t.prototype.ready=function(){this.$$("__search").focus()},t.prototype.init=function(){},t}(i.c);function ae(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function se(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}var ce=document.app.states,le=function(e){function t(){return ae(this,t),se(this,e.apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),t.prototype.config=function(){var e,t=this,n=this,i=this.app;return{view:"cWindow",localId:"__movementbody",width:.9*document.documentElement.clientWidth,height:.9*document.documentElement.clientHeight,padding:4,point:!1,relative:!1,modal:!1,move:!0,on:{onShow:function(){1==t.doc.n_state?t.$$("__hold").show():t.$$("__hold").hide(),1==t.doc.n_state?t.$$("__add").show():t.$$("__add").hide(),1==t.change?t.$$("__save").show():t.$$("__save").hide();var e=void 0;e=t.base?x.d.get_on_order(t.base):x.d.get(t.doc.n_id,"movements"),t.$$("__table").clearAll(),1==t.doc.n_state&&e.data.push({n_product:"...добавить"}),t.$$("__table").parse(e),setTimeout((function(){t.getHeader().recalcHeader&&t.getHeader().recalcHeader(t.$$("__table"))}),10),setTimeout((function(){t.setChange()}),1500);var n=t.$$("__table");n.eachRow((function(e){n.getItem(e).warning&&n.addCss(e,"warning")}))},onHide:function(){x.b.opened(t.doc.n_id,!0),t.focus&&webix.UIManager.setFocus(t.focus)}},body:{localId:"__body",rows:[{cols:[{view:"text",width:250,label:"Наценка на документ, %",value:"",localId:"__charge",name:"n_charge",labelWidth:150,on:{onChange:function(){}}},{width:25},{view:"text",width:250,disabled:!0,labelWidth:100,label:"Лимит точки",value:"",localId:"__limit",name:"n_limit"},{width:25},{view:"text",width:250,disabled:!0,label:"Отпущено на точку",value:"",localId:"__release_total",name:"n_release_total",labelWidth:120},{width:25},{view:"text",width:320,disabled:!0,label:"Отпущено на точку по документу",value:"",localId:"__release",name:"n_release",labelWidth:220},{}]},new L(i,n),{view:"datatable",borderless:!0,name:"__movements_document",clipboard:!0,localId:"__table",navigation:!0,select:"cell",resizeColumn:!0,fixedRowHeight:!1,rowLineHeight:28,rowHeight:28,editable:!0,footer:!0,headermenu:{autowidth:!0,scroll:!0,autoheight:!1,spans:!0,yCount:4},data:{},css:"webix_header_border center_dt",scroll:"xy",tooltip:!0,columns:ie,on:(e={onKeyPress:function(e,t){if("Delete"===t.key){var i=this.getSelectedId();this.remove(i),n.setChange()}},onAfterDelete:function(){n.setChange()},onLiveEdit:function(){},onAfterLoad:function(){this.count()>1&&n.recalcTable()},onAfterAdd:function(){}},e.onAfterDelete=function(){},e.onDataUpdate=function(){n.setChange()},e.onItemClick=function(e,t){"...добавить"==this.getItem(e).n_product&&this.callEvent("onItemDblClick",[e])},e.onItemDblClick=function(e){1==n.doc.n_state&&n.ui(new re(i,this,e)).show("Перемещение. Подбор товара")},e)},{borderless:!1,padding:3,cols:[{view:"button",width:136,localId:"__add",label:"подобрать товар",on:{onItemClick:function(){1==n.doc.n_state&&n.ui(new re(i,n.$$("__table"))).show("Перемещение. Подбор товара")}}},{view:"button",localId:"__report",label:"Печать",width:136,on:{onItemClick:function(){2!=t.doc.n_state?t.$$("__save").callEvent("onItemClick")||pe.document(t,"movement",t.doc):pe.document(t,"movement",t.doc)}}},{},{view:"button",label:"Сохранить",localId:"__save",width:136,on:{onItemClick:function(){var e=i.getService("common").saveDocument(t);return e?document.message(e,"error",3):(t.setUnChange(),t.flag_new=!1),e}}},{view:"button",localId:"__hold",label:"Провести",width:136,on:{onItemClick:function(){if(!t.$$("__save").callEvent("onItemClick")){var e=i.getService("common").holdDocument("movement",t.doc.n_id,t.doc.id);e.data?(t.table&&(t.flag_new?document.message("ищем позицию и апдейтим ее"):t.table.updateItem(e.kwargs.filters.intable,e.data[0])),t.hide()):document.message("Ошибка проведения транзакции","error",3)}}}},{view:"button",width:136,localId:"__cancel",label:"Закрыть",on:{onItemClick:function(){t.hide()}}}]}]}}},t.prototype.setRelease=function(){var e=this.getHeader().$$("__recipient"),t=e.getValue(),n=e.getList().getItem(t);n&&Number.isInteger(n.n_limit)&&(this.n_limit=n.n_limit,this.n_release=n.n_release,this.$$("__limit").setValue(webix.Number.formatNumber(this.n_limit)),this.$$("__release_total").setValue(webix.Number.formatNumber(this.n_release)))},t.prototype.getConfirm=function(){webix.modalbox({title:"Документ был изменен",type:"confirm-warning",buttons:["Да","Нет","Отменить"],text:"сохранить изменения?",width:500}).then((function(e){switch(e){case"0":document.message("Good!");break;case"1":document.message("Why?..");break;case"2":document.message("Come back later")}}))},t.prototype.show=function(e,t,n){if(this.flag_new=e.flag_new,this.base=e.order_id,this.change=!1,this.focus=t,this.table=n,this.doc=e,e){var i=ce[e.n_state];this.getRoot().getHead().getChildViews()[0].setValue('<span style="color: '+i.color+'">('+i.value+")</span> Перемещение №"+(e.n_number||"")+" от "+webix.i18n.dateFormatStr(e.n_dt_invoice)+", "+(e.n_supplier||"")),this.getRoot().show(),webix.UIManager.setFocus(this.$$("__table"))}2==this.doc.n_state&&(this.$$("__table").disable(),this.$$("__charge").disable())},t.prototype.validateDocument=function(e,t){var n=!1;for(var i in t.header.n_number||(n="Укажите номер документа"),t.header.n_supplier||(n="Укажите поставщика"),t.header.n_recipient||(n="Укажите получателя"),t.table.length<2&&(n="Добавьте товары"),t.table){var o=t.table[i];o.n_code&&((isNaN(o.n_amount)||+o.n_amount<0)&&(n="Неверное количство в строке "+(o.row_num?o.row_num+1:"")),o.n_stock<o.n_amount&&(n="Количество на складе меньше чем в заказе в строке "+(o.row_num+1)),(!o.n_price||o.n_price<=0)&&(n="Неверная цена в строке "+(o.row_num+1)))}return n},t.prototype.saveDocumentServer=function(e,t){var n=x.d.save(t,e.doc.id,"movements");return n.data&&n.data[0]?(this.doc=n.data[0],this.getHeader().$$("__n_id").setValue(this.doc.n_id),this.table&&(this.flag_new?this.table.add(n.data[0],0):(n.data[0].id=n.kwargs.intable,this.table.updateItem(n.kwargs.intable,n.data[0]))),!1):"Ошибка записи на сервер"},t.prototype.getHeader=function(){return this.getRoot().getChildViews()[1].getChildViews()[1].$scope},t.prototype.setHeader=function(){return this.getHeader().setHeader()},t.prototype.hide=function(){return this.$$("__table").clearAll(),this.getRoot().hide()},t.prototype.add_new=function(e){var t=this.$$("__table").count();this.$$("__table").add(e,t-1),this.setChange(),this.recalcTable(),this.setRelease()},t.prototype.recalcTable=function(){var e=this.$$("__table");function t(t){var n=0;return e.mapCells(null,t,null,1,(function(e){var t=+e;return isNaN(t)||(n+=t),e})),n}e.blockEvent(),e.eachRow((function(t){var n=e.getItem(t);n.n_stock<n.n_amount?e.addCss(t,"warning"):e.removeCss(t,"warning"),n.n_code&&(n.n_ship_price=n.n_price*(+n.n_charge+100)/100,n.n_novats_summ=n.n_ship_price*n.n_amount,n.n_vats_summ=n.n_amount*(n.n_vat*(+n.n_charge+100)/100),n.n_total_summ=n.n_novats_summ,e.updateItem(t,n))}));var n,i=t("n_price"),o=t("n_ship_price")/i*100-100,r=(n=0,e.mapCells(null,"n_total_summ",null,1,(function(t,i){if(console.log("c_limit_excl",e.getItem(i).c_limit_excl),e.getItem(i)&&!e.getItem(i).c_limit_excl){var o=+t;isNaN(o)||(n+=o)}return t})),n);this.$$("__release").setValue(webix.Number.formatNumber(r));var a=this.$$("__release_total"),s=this.$$("__release");0==this.n_limit||0==+r?(this.$$("__save").show(),this.$$("__hold").show()):+r+this.n_release>this.n_limit?(document.message("Превышен лимит на точку","error",3),a.$view.classList.add("label_warning"),s.$view.classList.add("label_warning"),this.$$("__save").hide(),this.$$("__hold").hide()):(a.$view.classList.remove("label_warning"),s.$view.classList.remove("label_warning"),this.$$("__save").show(),this.$$("__hold").show()),this.$$("__charge").setValue(o.toFixed(2)),e.unblockEvent(),this.getHeader().recalcHeader&&this.getHeader().recalcHeader(e)},t.prototype.setUnChange=function(){this.change=!1;var e=this.getRoot().getHead().getChildViews()[0];this.$$("__save").hide(),e.setValue(e.getValue().replace('<span class="changed">  изменен</span>',""))},t.prototype.setChange=function(){this.change=!0;var e=this.getRoot().getHead().getChildViews()[0];this.$$("__save").show(),0===e.$view.querySelectorAll('[class="changed"]').length&&e.setValue(e.getValue()+'<span class="changed">  изменен</span>'),this.setRelease(),this.recalcTable()},t.prototype.ready=function(){webix.UIManager.addHotKey("enter",(function(e){var t=e.getSelectedId();e.edit(t)}),this.$$("__table"))},t.prototype.init=function(){this.doc_type="Перемещение",this._block="supplier"},t}(i.c),de=[{in:"row_num",headermenu:!1,width:50,template:function(e,t,n,i){return isNaN(e.row_num)?"":e.row_num+1}},{id:"n_id",hidden:!0,headermenu:!1,width:0},{id:"n_product",fillspace:1,header:[{text:"Товар"}],headermenu:!1,footer:{text:"всего:",colspan:3}},{id:"n_code",width:80,header:[{text:"Код"}],headermenu:!1},{id:"n_consignment",width:100,header:[{text:"Партия"}],headermenu:!0,editor:"text",hidden:!0,template:"остатки"},{id:"n_unit",width:160,hidden:!0,header:[{text:"Единица измерения"}],headermenu:!0},{id:"n_okei_code",width:160,header:[{text:"Код по ОКЕИ"}],hidden:!0,headermenu:!0,editor:"text"},{id:"n_type_package",width:140,header:[{text:"Вид упак."}],hidden:!0,headermenu:!0},{id:"n_amount_mass",width:120,header:[{text:"Кол-во(масса) в одном месте"}],hidden:!0,headermenu:!0},{id:"n_amount_b",width:90,header:[{text:"Мест, шт."}],headermenu:!0,hidden:!0},{id:"n_gross_weight",width:100,header:[{text:"Масса (брутто)"}],hidden:!0,headermenu:!0},{id:"n_amount",width:150,header:[{text:"Кол-во"}],headermenu:!1,editor:"text",footer:{content:"summColumn"}},{id:"n_price",width:80,header:[{text:"Цена, руб."}],headermenu:!1,editor:"price",format:webix.Number.formatNumber},{id:"n_novats_summ",width:160,header:[{text:"Сумма без НДС"}],hidden:!0,headermenu:!1,footer:{content:"totalColumn"},format:webix.Number.formatNumber},{id:"n_vats_base",width:160,header:[{text:"НДС, ставка"}],hidden:!0,headermenu:!1,editor:"select",options:["НДС 0%","НДС 10%","НДС 20%"]},{id:"n_vats_summ",width:160,header:[{text:"НДС, сумма"}],headermenu:!1,hidden:!0,footer:{content:"totalColumn"},format:webix.Number.formatNumber},{id:"n_total_summ",width:160,header:[{text:"Сумма"}],headermenu:!1,footer:{content:"totalColumn"},format:webix.Number.formatNumber},{id:"n_prod_id",width:5,headermenu:!1,hidden:!0}];var ue=document.app.states,he=function(e){function t(n){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,e.call(this,n))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),t.prototype.config=function(){var e=this,t=this,n=this.app;return{view:"cWindow",localId:"__restbody",width:.9*document.documentElement.clientWidth,height:.9*document.documentElement.clientHeight,padding:4,point:!1,relative:!1,modal:!1,move:!0,on:{onShow:function(){1==e.doc.n_state?e.$$("__hold").show():e.$$("__hold").hide(),1==e.doc.n_state?e.$$("__add").show():e.$$("__add").hide(),1==e.change?e.$$("__save").show():e.$$("__save").hide(),e.$$("__table").clearAll();var t=x.d.get(e.doc.n_id,"rests");1==e.doc.n_state&&t.data.push({n_product:"...добавить"}),e.$$("__table").parse(t)},onHide:function(){x.b.opened(e.doc.n_id,!0),e.focus&&webix.UIManager.setFocus(e.focus)}},body:{rows:[new L(n,t,!1,["supplier"]),{view:"datatable",borderless:!0,name:"__rests_document",clipboard:!0,localId:"__table",navigation:!0,select:"cell",resizeColumn:!0,fixedRowHeight:!1,rowLineHeight:28,rowHeight:28,editable:!0,footer:!0,headermenu:{autowidth:!0,scroll:!0,autoheight:!1,spans:!0,yCount:4},data:{},css:"webix_header_border center_dt",scroll:"xy",tooltip:!0,columns:de,on:{onKeyPress:function(e,t){if("Delete"===t.key){var n=this.getSelectedId();this.remove(n)}},onAfterDelete:function(){t.setChange()},onLiveEdit:function(){},onDataUpdate:function(){t.setChange()},onItemClick:function(e,t){"...добавить"==this.getItem(e).n_product&&this.callEvent("onItemDblClick",[e])},onItemDblClick:function(e){1==t.doc.n_state&&t.ui(new B(n,this,e)).show("Ввод остатков. Подбор товара")}}},{borderless:!1,padding:3,cols:[{view:"button",width:136,localId:"__add",label:"подобрать товар",on:{onItemClick:function(){1==t.doc.n_state&&t.ui(new B(n,t.$$("__table"))).show("Ввод остатков. Подбор товара")}}},{view:"button",localId:"__report",label:"Печать",width:136,on:{onItemClick:function(){2!=e.doc.n_state?e.$$("__save").callEvent("onItemClick")||pe.document(e,"rest",e.doc):pe.document(e,"rest",e.doc)}}},{},{view:"button",label:"Сохранить",localId:"__save",width:136,on:{onItemClick:function(){var t=n.getService("common").saveDocument(e);return t?document.message(t,"error",3):(e.setUnchange(),e.flag_new=!1),t}}},{view:"button",localId:"__hold",label:"Провести",width:136,on:{onItemClick:function(){if(!e.$$("__save").callEvent("onItemClick")){var t=n.getService("common").holdDocument("rest",e.doc.n_id,e.doc.id);t.data?(e.table&&(e.flag_new?document.message("ищем позицию и апдейтим ее"):e.table.updateItem(t.kwargs.filters.intable,t.data[0])),e.hide()):document.message("Ошибка транзакции при проведении документа","error",3)}}}},{view:"button",width:136,localId:"__cancel",label:"Закрыть",on:{onItemClick:function(){e.hide()}}}]}]}}},t.prototype.getConfirm=function(){webix.modalbox({title:"Документ был изменен",type:"confirm-warning",buttons:["Да","Нет","Отменить"],text:"сохранить изменения?",width:500}).then((function(e){switch(e){case"0":document.message("Good!");break;case"1":document.message("Why?..");break;case"2":document.message("Come back later")}}))},t.prototype.show=function(e,t,n){if(this.flag_new=e.flag_new,this.change=!1,this.focus=t,this.table=n,this.doc=e,e){var i=ue[e.n_state];return this.getRoot().getHead().getChildViews()[0].setValue('<span style="color: '+i.color+'">('+i.value+")</span> Оприходывание №"+(e.n_number||"")+" от "+webix.i18n.dateFormatStr(e.n_dt_invoice)),this.getRoot().show(),webix.UIManager.setFocus(this.$$("__table"))}return!1},t.prototype.validateDocument=function(e,t){var n=!1;for(var i in t.header.n_number||(n="Укажите номер документа"),t.header.n_recipient||(n="Укажите получателя"),t.table.length<2&&(n="Добавьте товары"),t.table){var o=t.table[i];o.n_code&&((!o.n_amount||isNaN(o.n_amount)||+o.n_amount<0)&&(n="Неверное количество в строке "+(o.row_num?o.row_num+1:"")),(!o.n_price||o.n_price<=0)&&(n="Неверная цена в строке "+(o.row_num?o.row_num+1:"")),o.n_consignment||(n="Укажите партию в строке "+(o.row_num?o.row_num+1:"")))}return n},t.prototype.saveDocumentServer=function(e,t){var n=x.d.save(t,e.doc.id,"rests");return n.data&&n.data[0]?(this.doc=n.data[0],this.getHeader().$$("__n_id").setValue(this.doc.n_id),this.table&&(this.flag_new?this.table.add(n.data[0],0):(n.data[0].id=n.kwargs.intable,this.table.updateItem(n.kwargs.intable,n.data[0]))),!1):"Ошибка записи на сервер"},t.prototype.getHeader=function(){return this.getRoot().getChildViews()[1].getChildViews()[0].$scope},t.prototype.setHeader=function(){return this.getHeader().setHeader()},t.prototype.hide=function(){return this.$$("__table").clearAll(),this.getRoot().hide()},t.prototype.add_new=function(e){var t=this.$$("__table").count();this.$$("__table").add(e,t-1),this.setChange(),this.recalcTable()},t.prototype.recalcTable=function(){var e=this.$$("__table");e.blockEvent(),e.eachRow((function(t){var n=e.getItem(t);n.n_code&&(n.n_novats_summ=n.n_price*n.n_amount,n.n_vats_summ=0,n.n_total_summ=n.n_novats_summ+n.n_vats_summ,e.updateItem(t,n))})),e.unblockEvent(),this.getHeader().recalcHeader(e)},t.prototype.setUnchange=function(){this.change=!1;var e=this.getRoot().getHead().getChildViews()[0];this.$$("__save").hide(),e.setValue(e.getValue().replace('<span class="changed">  изменен</span>',""))},t.prototype.setChange=function(){this.change=!0;var e=this.getRoot().getHead().getChildViews()[0];this.$$("__save").show(),0===e.$view.querySelectorAll('[class="changed"]').length&&e.setValue(e.getValue()+'<span class="changed">  изменен</span>'),this.recalcTable()},t.prototype.ready=function(){webix.UIManager.addHotKey("enter",(function(e){var t=e.getSelectedId();e.edit(t)}),this.$$("__table"))},t.prototype.init=function(){this.doc_type="Ввод остатков",this._block="recipient"},t}(i.c),pe={document:function(e,t,n){x.l.new_report(t,n.n_id)}},_e={arrival:function(){var e=$$("sklad_main_ui").$scope,t=e.app.commonWidgets.sidebar.screens._arrivals?$$("_arrivals_main"):void 0,n=e.ui(new Y(e.app)),i=Object(x.g)("arrival"),o={flag_new:!0,n_dt_invoice:new Date,n_executor:e.app.config.user,n_paid:"Нет",n_state:1,n_recipient_id:e.app.config.home_org_id,_block:"recipient"};Object(x.i)(i)||(o.n_number=i.data),n.show(o,webix.UIManager.getFocus(),t)},shipment:function(e,t){var n=$$("sklad_main_ui").$scope,i=n.app.commonWidgets.sidebar.screens._shipments?$$("_shipments_main"):void 0,o=n.ui(ne),r=Object(x.g)("shipment"),a={flag_new:!0,n_dt_invoice:new Date,n_executor:n.app.config.user,n_paid:"Нет",n_state:1,n_supplier_id:n.app.config.home_org_id,order_id:t?t.n_id:void 0,n_recipient_id:t?t.n_recipient_id:void 0};Object(x.i)(r)||(a.n_number=r.data),o.show(a,webix.UIManager.getFocus(),i)},order:function(){var e=$$("sklad_main_ui").$scope,t=e.app.commonWidgets.sidebar.screens._orders?$$("_orders_main"):void 0,n=e.ui(U),i={flag_new:!0,n_dt_invoice:new Date,n_executor:e.app.config.user,n_paid:"Нет",n_state:1,n_recipient_id:e.app.config.home_org_id,_block:"recipient"};n.show(i,webix.UIManager.getFocus(),t)},movement:function(e,t){var n=$$("sklad_main_ui").$scope,i=n.app.commonWidgets.sidebar.screens._movements?$$("_movements_main"):void 0,o=n.ui(le),r=Object(x.g)("movement"),a={flag_new:!0,n_dt_invoice:new Date,n_executor:n.app.config.user,n_paid:"Нет",n_state:1,n_supplier_id:n.app.config.home_org_id,order_id:t?t.n_id:void 0,n_recipient_id:t?t.n_recipient_id:void 0};Object(x.i)(r)||(a.n_number=r.data),o.show(a,webix.UIManager.getFocus(),i)},rest:function(){var e=$$("sklad_main_ui").$scope,t=e.app.commonWidgets.sidebar.screens._rests?$$("_rests_main"):void 0,n=e.ui(new he(e.app)),i=Object(x.g)("rest");console.log("dn",i);var o={flag_new:!0,n_dt_invoice:new Date,n_executor:e.app.config.user,n_paid:"Нет",n_state:1,n_recipient_id:e.app.config.home_org_id,_block:"recipient"};Object(x.i)(i)||(o.n_number=i.data),n.show(o,webix.UIManager.getFocus(),t)},writeoff:function(){document.message("Списание")}};var fe,me,be,we,ge,ve,ye=function(e){function t(n,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var o=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,e.call(this,n));return o.cfg=i,o}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),t.prototype.config=function(){return{view:"layout",css:"center_view",cols:[{width:1},{rows:[{height:1},{view:"datatable",borderless:!0,name:"__main",clipboard:!0,id:this.cfg.id,localId:"__table",navigation:"row",select:"row",datafetch:30,datathrottle:10,loadahead:40,resizeColumn:!0,fixedRowHeight:!1,rowLineHeight:28,rowHeight:28,editable:!0,footer:!0,url:function(e){return this.$scope.cfg.loadData(e,this)},headermenu:{autowidth:!0,scroll:!0,autoheight:!1,spans:!0,yCount:4},css:"webix_header_border center_dt",scroll:"xy",tooltip:!0,columns:this.cfg.columns,leftSplit:1,sorting:this.cfg.sorting,onClick:{menubtn:function(e,t,n){return this.$scope.cfg.parent.callContext(e,this)}},onContext:{webix_ss_center:function(e,t){return this.$scope.cfg.parent.callContext(e,this)}},on:{onCheck:function(e,t,n){n?this.select(e,!0):this.unselect(e,!0)},onAfterLoad:function(){this.markSorting(this.config.sorting.id,this.config.sorting.dir)},onKeyPress:function(e,t){if(13===e){var n=this.getSelectedId();this.callEvent("onItemDblClick",[n])}},onItemDblClick:function(e){if(this.$scope.cfg.docBody&&e)if(x.b.opened(this.getItem(e).n_id)){var t=webix.UIManager.getFocus();this.$scope.ui(this.$scope.cfg.docBody).show(this.getItem(e),t,this.$scope.$$("__table"))}else document.message("Этот документ уже открыт","debug",3)}}},{height:1}]},{width:1}]}},t}(i.c),$e=document.app.states,xe=[{id:"n_id",hidden:!0,headermenu:!1,width:50,filter_type:"none"},(fe={id:"_checked",sort:"server"},fe.sort=!1,fe.css="center_text",fe.hidden=!1,fe.tooltip=!1,fe.headermenu=!1,fe.width=50,fe.template="<span class='menubtn mdi-settings'></span>",fe.header=[{text:""}],fe.filter_type="none",fe.footer={text:"Всего документов в выборке:",colspan:3},fe),{id:"n_state",width:40,sort:!1,tooltip:function(e){return $e[e.n_state].value},template:function(e){return"<span class='table_icon "+$e[e.n_state].picture+"', style='color: "+$e[e.n_state].color+"'></span>"},css:"center_text",header:[{text:""}],headermenu:!1,filter_type:"combo"},{id:"n_number",width:100,sort:"server",header:[{text:Object(j.names)("n_number").value}],headermenu:!1,filter_type:"text"},{id:"n_dt_invoice",width:120,sort:"server",header:[{text:Object(j.names)("n_dt_invoice").value}],headermenu:!1,format:webix.i18n.dateFormatStr,filter_type:"date",footer:{content:"totalTable"}},{id:"n_supplier",fillspace:1,sort:"server",header:[{text:Object(j.names)("n_supplier").value}],headermenu:!1,filter_type:"multi"},{id:"n_supplier_id",width:0,hidden:!0,headermenu:!1},{id:"n_recipient",width:160,sort:"server",header:[{text:Object(j.names)("n_recipient").value}],headermenu:!1,filter_type:"multi"},{id:"n_recipient_id",width:0,hidden:!0,headermenu:!1},{id:"n_summ",width:140,sort:"server",header:[{text:Object(j.names)("n_summ").value}],format:webix.Number.formatNumber,headermenu:!1,filter_type:"text"},{id:"n_nds",width:120,sort:"server",header:[{text:Object(j.names)("n_nds").value}],format:webix.Number.formatNumber,headermenu:!0,hidden:!0,filter_type:"text"},{id:"n_pos_numbers",width:90,sort:"server",header:[{text:Object(j.names)("n_pos_numbers").value}],headermenu:!1,filter_type:"text"},{id:"n_executor",width:140,sort:"server",header:[{text:Object(j.names)("n_executor").value}],headermenu:!1,filter_type:"multi"},{id:"n_base",width:260,sort:"server",header:[{text:Object(j.names)("n_base").value}],headermenu:!1,filter_type:"text"},{id:"n_paid",width:80,sort:"server",header:[{text:Object(j.names)("n_paid").value}],headermenu:!0,hidden:!0,filter_type:"combo"},{id:"n_dt_change",width:160,sort:"server",header:[{text:Object(j.names)("n_dt_change").value}],format:webix.Date.dateToStr("%d.%m.%Y %H:%i:%s"),headermenu:!0,filter_type:"date"}],ke=document.app.states,Ce=[{id:"n_id",hidden:!0,headermenu:!1,width:50,filter_type:"none"},(me={id:"_checked",sort:"server"},me.sort=!1,me.css="center_text",me.hidden=!1,me.tooltip=!1,me.headermenu=!1,me.width=50,me.template="<span class='menubtn mdi-settings'></span>",me.header=[{text:""}],me.filter_type="none",me.footer={text:"Всего документов в выборке:",colspan:3},me),{id:"n_state",width:40,sort:!1,tooltip:function(e){return ke[e.n_state].value},template:function(e){return"<span class='table_icon "+ke[e.n_state].picture+"', style='color: "+ke[e.n_state].color+"'></span>"},css:"center_text",header:[{text:""}],headermenu:!1,filter_type:"combo"},{id:"n_number",width:100,sort:"server",header:[{text:Object(j.names)("n_number").value}],headermenu:!1,filter_type:"text"},{id:"n_dt_invoice",width:120,sort:"server",header:[{text:Object(j.names)("n_dt_invoice").value}],headermenu:!1,format:webix.i18n.dateFormatStr,filter_type:"date",footer:{content:"totalTable"}},{id:"n_supplier",width:160,sort:"server",header:[{text:Object(j.names)("n_supplier").value}],headermenu:!1,filter_type:"multi"},{id:"n_supplier_id",width:0,hidden:!0,headermenu:!1},{id:"n_recipient",width:160,sort:"server",header:[{text:Object(j.names)("n_recipient").value}],headermenu:!1,filter_type:"multi"},{id:"n_recipient_id",width:0,hidden:!0,headermenu:!1},{id:"n_charge",width:140,header:[{text:Object(j.names)("n_charge").value}],headermenu:!1,filter_type:"text"},{id:"n_summ",width:140,sort:"server",header:[{text:Object(j.names)("n_summ").value}],format:webix.Number.formatNumber,headermenu:!1,filter_type:"text"},{id:"n_nds",width:120,sort:"server",header:[{text:Object(j.names)("n_nds").value}],format:webix.Number.formatNumber,headermenu:!1,filter_type:"text"},{id:"n_pos_numbers",width:90,sort:"server",header:[{text:Object(j.names)("n_pos_numbers").value}],headermenu:!1,filter_type:"text"},{id:"n_executor",width:140,sort:"server",header:[{text:Object(j.names)("n_executor").value}],headermenu:!1,filter_type:"multi"},{id:"n_base",sort:"server",fillspace:1,header:[{text:Object(j.names)("n_base").value}],headermenu:!1,filter_type:"text"},{id:"n_paid",width:80,sort:"server",header:[{text:Object(j.names)("n_paid").value}],headermenu:!0,hidden:!0,filter_type:"combo"},{id:"n_dt_change",width:160,sort:"server",header:[{text:Object(j.names)("n_dt_change").value}],format:webix.Date.dateToStr("%d.%m.%Y %H:%i:%s"),headermenu:!1,filter_type:"date"}],Ie=document.app.states,Oe=[{id:"n_id",hidden:!0,headermenu:!1,width:50,filter_type:"none"},(be={id:"_checked",sort:"server"},be.sort=!1,be.css="center_text",be.hidden=!1,be.tooltip=!1,be.headermenu=!1,be.width=50,be.template="<span class='menubtn mdi-settings'></span>",be.header=[{text:""}],be.filter_type="none",be.footer={text:"Всего документов в выборке:",colspan:3},be),{id:"n_state",width:40,sort:!1,tooltip:function(e){return Ie[e.n_state].value},template:function(e){return"<span class='table_icon "+Ie[e.n_state].picture+"', style='color: "+Ie[e.n_state].color+"'></span>"},css:"center_text",header:[{text:""}],headermenu:!1,filter_type:"combo"},{id:"n_number",width:100,sort:"server",header:[{text:Object(j.names)("n_number").value}],headermenu:!1,filter_type:"text"},{id:"n_dt_invoice",width:120,sort:"server",header:[{text:Object(j.names)("n_dt_invoice").value}],headermenu:!1,format:webix.i18n.dateFormatStr,filter_type:"date",footer:{content:"totalTable"}},{id:"n_supplier",width:160,sort:"server",header:[{text:Object(j.names)("n_supplier").value}],headermenu:!1,filter_type:"multi"},{id:"n_supplier_id",width:0,hidden:!0,headermenu:!1},{id:"n_recipient",fillspace:1,sort:"server",header:[{text:Object(j.names)("n_recipient").value}],headermenu:!1,filter_type:"multi"},{id:"n_recipient_id",width:0,hidden:!0,headermenu:!1},{id:"n_charge",width:140,header:[{text:Object(j.names)("n_charge").value}],headermenu:!1,filter_type:"text"},{id:"n_summ",width:140,sort:"server",header:[{text:Object(j.names)("n_summ").value}],format:webix.Number.formatNumber,headermenu:!1,filter_type:"text"},{id:"n_nds",width:120,sort:"server",header:[{text:Object(j.names)("n_nds").value}],format:webix.Number.formatNumber,headermenu:!0,hidden:!0,filter_type:"text"},{id:"n_pos_numbers",width:90,sort:"server",header:[{text:Object(j.names)("n_pos_numbers").value}],headermenu:!1,filter_type:"text"},{id:"n_executor",width:140,sort:"server",header:[{text:Object(j.names)("n_executor").value}],headermenu:!1,filter_type:"multi"},{id:"n_base",width:260,sort:"server",header:[{text:Object(j.names)("n_base").value}],headermenu:!1,filter_type:"text"},{id:"n_paid",width:80,sort:"server",header:[{text:Object(j.names)("n_paid").value}],headermenu:!0,hidden:!0,filter_type:"combo"},{id:"n_dt_change",width:160,sort:"server",header:[{text:Object(j.names)("n_dt_change").value}],format:webix.Date.dateToStr("%d.%m.%Y %H:%i:%s"),headermenu:!0,filter_type:"date"}],je=document.app.states,Ve=[{id:"n_id",hidden:!0,headermenu:!1,width:50,filter_type:"none"},(we={id:"_checked",sort:"server"},we.sort=!1,we.css="center_text",we.hidden=!1,we.tooltip=!1,we.headermenu=!1,we.width=50,we.template="<span class='menubtn mdi-settings'></span>",we.header=[{text:""}],we.filter_type="none",we),{id:"n_state",width:40,sort:!1,tooltip:function(e){return je[e.n_state].value},template:function(e){return"<span class='table_icon "+je[e.n_state].picture+"', style='color: "+je[e.n_state].color+"'></span>"},css:"center_text",header:[{text:""}],headermenu:!1,filter_type:"combo"},{id:"n_supplier",width:1,header:[{text:Object(j.names)("n_supplier").value}],headermenu:!1,hidden:!0},{id:"n_filename",width:1,header:[{text:Object(j.names)("n_filename").value}],headermenu:!1,hidden:!0},{id:"n_id_field",width:100,sort:"server",header:[{text:Object(j.names)("n_id_field").value}],headermenu:!0,hidden:!0,filter_type:"text"},{id:"n_recipient",fillspace:1,sort:"server",header:[{text:Object(j.names)("n_recipient").value}],headermenu:!1,filter_type:"combo",footer:{text:"Всего документов в выборке:",colspan:1}},{id:"n_p_id",width:1,sort:"server",header:[{text:Object(j.names)("n_p_id").value}],headermenu:!1,hidden:!0},{id:"n_name",width:240,sort:"server",header:[{text:Object(j.names)("n_name").value}],headermenu:!0,hidden:!1},{id:"n_inn",width:100,sort:"server",header:[{text:Object(j.names)("n_inn").value}],headermenu:!1,hidden:!1,filter_type:"text",footer:{content:"totalTable"}},{id:"n_code",width:100,sort:"server",header:[{text:Object(j.names)("n_code").value}],headermenu:!0,hidden:!0,filter_type:"text"},{id:"n_dt_price",width:120,sort:"server",header:[{text:Object(j.names)("n_dt_price").value}],headermenu:!0,hidden:!0,format:webix.i18n.dateFormatStr,filter_type:"date"},{id:"n_dt_invoice",width:120,sort:"server",header:[{text:Object(j.names)("n_dt_invoice").value}],headermenu:!1,format:webix.i18n.dateFormatStr,filter_type:"date"},{id:"n_number",width:100,sort:"server",header:[{text:Object(j.names)("n_number").value}],headermenu:!0,filter_type:"text"},{id:"n_dt_send",width:120,sort:"server",header:[{text:Object(j.names)("n_dt_send").value}],headermenu:!0,format:webix.i18n.dateFormatStr,filter_type:"date"},{id:"n_recipient_id",width:1,hidden:!0,headermenu:!1},{id:"n_summ",width:140,sort:"server",header:[{text:Object(j.names)("n_summ").value}],format:webix.Number.formatNumber,headermenu:!1,filter_type:"text"},{id:"n_pos_numbers",width:90,sort:"server",header:[{text:Object(j.names)("n_pos_numbers").value}],headermenu:!1,filter_type:"text"},{id:"n_dt_recieved",width:120,sort:"server",header:[{text:Object(j.names)("n_dt_recieved").value}],format:webix.Date.dateToStr("%d.%m.%Y %H:%i:%s"),headermenu:!1,filter_type:"date"},{id:"n_comment",width:120,header:[{text:Object(j.names)("n_comment").value}],headermenu:!0,hidden:!0}],Ee=[{id:"n_id",hidden:!0,headermenu:!1,width:50,filter_type:"none"},(ge={id:"_checked",sort:"server"},ge.sort=!1,ge.css="center_text",ge.hidden=!1,ge.tooltip=!1,ge.headermenu=!1,ge.width=50,ge.template="<span class='menubtn mdi-settings'></span>",ge.header=[{text:""}],ge.filter_type="none",ge),{id:"n_product_id",width:40,header:[{text:Object(j.names)("n_product_id").value}],headermenu:!1,hidden:!0},{id:"n_code",width:180,sort:"server",header:[{text:Object(j.names)("n_code").value}],headermenu:!1,filter_type:"text"},{id:"n_product",fillspace:1,sort:"server",header:[{text:Object(j.names)("n_product").value}],headermenu:!1,filter_type:"text"},{id:"n_consignment",width:180,sort:"server",header:[{text:Object(j.names)("n_consignment").value}],headermenu:!0,filter_type:"text"},{id:"n_dt",width:120,sort:"server",header:[{text:Object(j.names)("n_dt").value}],headermenu:!1,format:webix.i18n.dateFormatStr,filter_type:"date"},{id:"n_warehouse",width:160,sort:"server",header:[{text:Object(j.names)("n_warehouse").value}],headermenu:!0,hidden:!0,filter_type:"combo"},{id:"n_quantity",width:160,sort:"server",header:[{text:Object(j.names)("n_quantity").value}],headermenu:!1,filter_type:"text"},{id:"n_price",width:140,sort:"server",header:[{text:Object(j.names)("n_price").value}],format:webix.Number.formatNumber,headermenu:!0,hidden:!0,filter_type:"text"},{id:"n_vat",width:120,sort:"server",header:[{text:Object(j.names)("n_vat").value}],format:webix.Number.formatNumber,headermenu:!0,hidden:!0,filter_type:"text"},{id:"n_price_price",width:140,sort:"server",header:[{text:Object(j.names)("n_price_price").value}],format:webix.Number.formatNumber,headermenu:!1,filter_type:"text"},{id:"n_vat_included",width:90,header:[{text:Object(j.names)("n_vat_included").value}],headermenu:!0,hidden:!0,filter_type:"combo"}],He=document.app.states,Se=[{id:"n_id",hidden:!0,headermenu:!1,width:50,filter_type:"none"},(ve={id:"_checked",sort:"server"},ve.sort=!1,ve.css="center_text",ve.hidden=!1,ve.tooltip=!1,ve.headermenu=!1,ve.width=50,ve.template="<span class='menubtn mdi-settings'></span>",ve.header=[{text:""}],ve.filter_type="none",ve.footer={text:"Всего документов в выборке:",colspan:3},ve),{id:"n_state",width:40,sort:!1,tooltip:function(e){return He[e.n_state].value},template:function(e){return"<span class='table_icon "+He[e.n_state].picture+"', style='color: "+He[e.n_state].color+"'></span>"},css:"center_text",header:[{text:""}],headermenu:!1,filter_type:"combo"},{id:"n_number",width:100,sort:"server",header:[{text:Object(j.names)("n_number").value}],headermenu:!1,filter_type:"text"},{id:"n_dt_invoice",width:120,sort:"server",header:[{text:Object(j.names)("n_dt_invoice").value}],headermenu:!1,format:webix.i18n.dateFormatStr,filter_type:"date",footer:{content:"totalTable"}},{id:"n_recipient",fillspace:1,sort:"server",header:[{text:Object(j.names)("n_recipient").value}],headermenu:!1,filter_type:"multi"},{id:"n_recipient_id",width:0,hidden:!0,headermenu:!1},{id:"n_summ",width:140,sort:"server",header:[{text:Object(j.names)("n_summ").value}],format:webix.Number.formatNumber,headermenu:!1,filter_type:"text"},{id:"n_nds",width:120,sort:"server",header:[{text:Object(j.names)("n_nds").value}],format:webix.Number.formatNumber,headermenu:!0,hidden:!0,filter_type:"text"},{id:"n_pos_numbers",width:90,sort:"server",header:[{text:Object(j.names)("n_pos_numbers").value}],headermenu:!1,filter_type:"text"},{id:"n_executor",width:140,sort:"server",header:[{text:Object(j.names)("n_executor").value}],headermenu:!1,filter_type:"multi"},{id:"n_base",width:260,sort:"server",header:[{text:Object(j.names)("n_base").value}],headermenu:!1,filter_type:"text"},{id:"n_paid",width:80,sort:"server",header:[{text:Object(j.names)("n_paid").value}],headermenu:!0,hidden:!0,filter_type:"combo"},{id:"n_dt_change",width:160,sort:"server",header:[{text:Object(j.names)("n_dt_change").value}],format:webix.Date.dateToStr("%d.%m.%Y %H:%i:%s"),headermenu:!0,filter_type:"date"}],Pe={rests:{loadData:x.h.getAllData,sorting:{id:"n_dt_invoice",dir:"desc"},docBody:he,columns:Se,id:"_rests_main"},arrivals:{loadData:x.h.getAllData,sorting:{id:"n_dt_invoice",dir:"desc"},docBody:Y,columns:xe,id:"_arrivals_main",_block:"recipient"},movements:{loadData:x.h.getAllData,sorting:{id:"n_dt_invoice",dir:"desc"},docBody:le,columns:Oe,id:"_movements_main"},shipments:{loadData:x.h.getAllData,sorting:{id:"n_dt_invoice",dir:"desc"},docBody:ne,columns:Ce,id:"_shipments_main"},orders:{loadData:x.h.getAllData,sorting:{id:"n_dt_send",dir:"desc"},docBody:U,columns:Ve,id:"_orders_main"},balances:{loadData:x.h.getAllData,sorting:{id:"n_product",dir:"asc"},columns:Ee,id:"_balances_main"}};var Re=function(e){function t(n,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var o=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,e.call(this,n));return o.cfg=i,o}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),t.prototype.config=function(){var e=this;return{view:"datatable",id:this.cfg.id,borderless:!0,name:this.cfg.name||"_table_",clipboard:!0,localId:"__table",navigation:"row",select:"row",datafetch:30,datathrottle:10,loadahead:40,resizeColumn:!0,fixedRowHeight:!1,rowLineHeight:28,rowHeight:28,editable:!0,footer:!0,url:function(e){return this.$scope.cfg.loadFunction(e,this)},headermenu:{autowidth:!0,scroll:!0,autoheight:!1,spans:!0,yCount:4},css:"webix_header_border center_dt",scroll:"xy",tooltip:!0,columns:this.cfg.columns,sorting:this.cfg.sorting,onClick:{},onContext:{},on:{onCheck:function(e,t,n){var i=this.getItem(e),o={table:this.$scope.cfg.name,item_id:i.c_id,item_code:i.c_code,value:n,field:t},r=x.k.checkmark(o);Object(x.i)(r)&&(this.blockEvent(),i[t]=!n,this.updateItem(e,i),this.unblockEvent())},onAfterSelect:function(){this.getSelectedId()?this.$scope.cfg.topParent.$$("__create").show():this.$scope.cfg.topParent.$$("__create").hide()},onAfterLoad:function(){this.markSorting(this.config.sorting.id,this.config.sorting.dir)},onDataUpdate:function(t,n,i){e.cfg.setChange(t,n,i,e)},onKeyPress:function(e,t){},onItemDblClick:function(t){return e.cfg.dblClick(t,this)}}}},t}(i.c),Te=[{id:"c_id",hidden:!0,headermenu:!1,width:5},{id:"c_code",width:150,header:[{text:Object(j.names)("c_code").value}],headermenu:!0,hidden:!1},{id:"c_name",fillspace:!0,sort:"server",header:[{text:Object(j.names)("c_name").value}],headermenu:!1,footer:{content:"totalTableLong"},filter_type:"text"},{id:"c_namefull",width:250,sort:"server",header:[{text:Object(j.names)("c_namefull").value}],headermenu:!0,hidden:!0},{id:"c_vat",hidden:!0,headermenu:!1,width:5}];var Ne=function(e){function t(n,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var o=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,e.call(this,n));return o.parent=i,o}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),t.prototype.config=function(){var e,t=this,n=this;this.table_id=webix.uid();var i=new Re(n.app,{columns:Te,loadFunction:x.h.product_data,sorting:{id:"c_name",dir:"asc"},topParent:n,name:"_products_",id:this.table_id,dblClick:function(e){n.$$("__create").callEvent("onItemClick")}});return(e={view:"cWindow",loclalId:"_popup",width:420,padding:4,point:!1,toFront:!0,relative:!0,modal:!0,css:"menu_filters",escHide:!0,on:{onShow:function(){},onHide:function(){this.destructor()}}}).width=.6*document.documentElement.clientWidth,e.height=.8*document.documentElement.clientHeight,e.body={rows:[{height:k.d},{cols:[{view:"datepicker",align:"right",localId:"__date1",label:"Начальная дата",value:new Date,labelWidth:110,width:230},{width:k.d},{view:"datepicker",align:"right",localId:"__date2",label:"Конечная дата",value:new Date,labelWidth:100,width:230},{width:4*k.d},{view:"checkbox",localId:"__arrivals",labelRight:"Приходы",value:1,labelWidth:0,labelAlign:"right",width:120},{width:10},{view:"checkbox",localId:"__departures",labelRight:"Расходы",value:1,labelWidth:0,labelAlign:"right",width:120}]},{cols:[{view:"text",localId:"__search",label:"",name:"_search",labelWidth:0,width:450,hidden:!1,on:{onKeyPress:function(e,t){var n=this;clearTimeout(this.delay),this.delay=setTimeout((function(){n.$scope.getData()}),850)}}}]},i,{borderless:!1,cols:[{},{view:"button",label:"Сформировать",width:160,tooltip:"Сформировать отчет",localId:"__create",hidden:!0,on:{onItemClick:function(){var e=t.$$("__date1").getValue()||new Date,n=t.$$("__date2").getValue()||new Date,i=t.$$("__arrivals").getValue(),o=t.$$("__departures").getValue(),r=$$(t.table_id).getSelectedItem();r&&(r=r.c_id,x.l.new_product_movement(e,n,i,o,r))}}},{view:"button",label:"Закрыть",width:136,localId:"__apply",on:{onItemClick:function(){t.hide()}}}]}]},e},t.prototype.getData=function(){var e=$$(this.table_id);e.clearAll(!0),e.loadNext(0,0,0,0,1).then((function(t){t&&(e.clearAll(!0),e.parse(t),e.showItemByIndex(0))}))},t.prototype.getFilter=function(){var e="";try{e=this.$$("__search").getValue()}catch(e){}return e},t.prototype.show=function(e){e&&this.getRoot().getHead().getChildViews()[0].setValue(e),this.getRoot().show()},t.prototype.hide=function(){var e=this;setTimeout((function(){return e.getRoot().hide()}),10)},t.prototype.ready=function(){this.$$("__search").focus()},t.prototype.init=function(){},t}(i.c),We={contragents:function(e){var t=e.id,n=(e.local_this.$scope.app,void 0),i=void 0;switch(t){case"16000":document.message("Контрагенты"),n={name:"partners",sorting:{id:"n_name",dir:"asc"},columns:a},i=new T($$("sklad_main_ui").$scope.app,n),$$("sklad_main_ui").$scope.ui(i).show("Контрагенты");break;case"26000":document.message("Группы контрагентов");break;case"36000":n={name:"ptypes",sorting:{id:"n_name",dir:"asc"},columns:u},i=new T($$("sklad_main_ui").$scope.app,n),$$("sklad_main_ui").$scope.ui(i).show("Виды контрагентов");break;case"46000":document.message("Сегменты контрагентов");break;case"56000":document.message("Подразделения контрагентов"),n={name:"points",sorting:{id:"n_name",dir:"asc"},columns:r},i=new T($$("sklad_main_ui").$scope.app,n),$$("sklad_main_ui").$scope.ui(i).show("Подразделения")}},classifiers:function(e){var t=e.id,n=e.local_this.$scope,i=n.app,o=void 0;switch(t){case"15000":document.message("Валюты");break;case"25000":document.message("Банки");break;case"35000":o=new T(i,{name:"countries",sorting:{id:"c_name",dir:"asc"},columns:v}),n.ui(o).show("Страны");break;case"45000":document.message("Регионы");break;case"55000":o=new T(i,{name:"vats",sorting:{id:"c_name",dir:"asc"},columns:s}),n.ui(o).show("НДС");break;case"65000":o=new T(i,{name:"trademarks",sorting:{id:"c_name",dir:"asc"},columns:c}),n.ui(o).show("Торговые марки");break;case"75000":o=new T(i,{name:"spes",sorting:{id:"c_name",dir:"asc"},columns:l}),n.ui(o).show("СПЕ");break;case"85000":o=new T(i,{name:"relforms",sorting:{id:"c_name",dir:"asc"},columns:d}),n.ui(o).show("Формы выпуска");break;case"95000":o=new T(i,{name:"packagings",sorting:{id:"c_name",dir:"asc"},columns:h}),n.ui(o).show("Упаковки");break;case"105000":o=new T(i,{name:"mnns",sorting:{id:"c_rusname",dir:"asc"},columns:p}),n.ui(o).show("МНН");break;case"115000":o=new T(i,{name:"megacategories",sorting:{id:"c_name",dir:"asc"},columns:_}),n.ui(o).show("Мегакатегории");break;case"125000":o=new T(i,{name:"manufacturers",sorting:{id:"c_name",dir:"asc"},columns:f}),n.ui(o).show("Производители");break;case"135000":o=new T(i,{name:"groups",sorting:{id:"c_name",dir:"asc"},columns:m}),n.ui(o).show("Группы");break;case"145000":o=new T(i,{name:"directions",sorting:{id:"c_name",dir:"asc"},columns:w}),n.ui(o).show("Направления");break;case"155000":o=new T(i,{name:"dosages",sorting:{id:"c_name",dir:"asc"},columns:g}),n.ui(o).show("Дозировки");break;case"165000":o=new T(i,{name:"categories",sorting:{id:"c_name",dir:"asc"},columns:y}),n.ui(o).show("Категории");break;case"174000":o=new T(i,{name:"appareas",sorting:{id:"c_name",dir:"asc"},columns:$}),n.ui(o).show("Области применения")}},products:function(e){var t=e.id,n=e.local_this.$scope,i=n.app;switch(t){case"14000":i.commonWidgets.sidebar.add_bar(n,Ze,"balances");break;case"24000":document.message("Движение товаров");break;case"34000":var o=new E(i);n.ui(o).show("Справочник номенклатуры товаров");break;case"44000":document.message("Группы номенклатуры");break;case"94000":pe.document(n,"balance",{n_id:-1}),document.message("Инв");break;case"54000":document.message("Бренды");break;case"64000":document.message("Виды номенклатуры");break;case"74000":document.message("Сегменты");break;case"84000":document.message("Штрихкоды")}},reports:function(e){var t=e.id,n=e.local_this.$scope,i=n.app;switch(t){case"17000":var o=new Ne(i);n.ui(o).show("Отчет движение товаров")}},journals:function(e){var t=e.id,n=e.local_this.$scope,i=n.app;switch(t){case"13000":i.commonWidgets.sidebar.add_bar(n,Ze,"arrivals");break;case"23000":document.message("Оприходывания остатков"),i.commonWidgets.sidebar.add_bar(n,Ze,"rests");break;case"33000":i.commonWidgets.sidebar.add_bar(n,Ze,"movements"),document.message("Перемещения");break;case"43000":i.commonWidgets.sidebar.add_bar(n,Ze,"orders");break;case"53000":i.commonWidgets.sidebar.add_bar(n,Ze,"shipments");break;case"63000":document.message("Списания")}},documents:function(e){var t=e.id,n=e.local_this.$scope;n.app;switch(t){case"12000":_e.arrival(n);break;case"22000":_e.movement(n);break;case"32000":_e.shipment(n);break;case"42000":_e.rest(n);break;case"52000":_e.writeoff(n)}},options:function(e){var t=e.id;e.local_this.$scope.app;switch(t){case"11000":document.message("Пользователи");break;case"21000":document.message("Роли пользователей");break;case"21000":document.message("Интерфейсы");break;case"41001":document.message("Что-то еще 1");break;case"41002":document.message("Что-то еще 2");break;case"41002":document.message("Что-то еще 3")}},managements:function(e){e.context;var t=e.id;e.local_this.$scope.app;switch(t){case"10001":document.message("Организации");break;case"10002":document.message("Склады");break;case"10003":document.message("Подразделения");break;case"20001":document.message("Физические лица");break;case"20002":document.message("Сотрудники");break;case"20003":document.message("Должности");break;case"20004":document.message("Графики");break;case"30001":document.message("Типы цен");break;case"30002":document.message("Типы скидок");break;case"30003":document.message("Ценовые группы");break;case"40001":document.message("Типы мероприятий");break;case"40002":document.message("Партнеры");break;case"40003":document.message("Категории подразделений")}}};var De=function(e){function t(n,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var o=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,e.call(this,n));return o.p_name=i,o.single_name=i.slice(0,-1),o}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),t.prototype.config=function(){var e=this;return{view:"contextmenu",autowidth:!0,localId:"__"+e.p_name+"_cmenu",css:"context_center_dt",point:!0,on:{onMenuItemClick:function(t,n,i){var o=this.getContext(),r=o.position?o.table.getItem(o.position.row):void 0;!function(e){var t,n=e.context,i=e.id,o=e.local_this.$scope,r=e.row,a=e.doc_type,s=o.app,c=void 0;switch(i){case"1":var l=r[n.position.column];navigator.clipboard?navigator.clipboard.writeText(l).then((function(){document.message("Скопировано в буфер")})):document.message("Браузер устарел, скопировать в буфер невозможно","error",3);break;case"2":document.message("Загрузить");break;case"3":(c=s.getService("common").holdDocument(a,r.n_id,r.id)).data&&n.table.updateItem(c.kwargs.filters.intable,c.data[0]);break;case"4":(c=s.getService("common").unHoldDocument(a,r.n_id,r.id)).data&&n.table.updateItem(c.kwargs.filters.intable,c.data[0]);break;case"6":(c=s.getService("common").deleteDocument(a,r.n_id,r.id)).data&&n.table.updateItem(c.kwargs.filters.intable,c.data[0]);break;case"7":(c=s.getService("common").unDeleteDocument(a,r.n_id,r.id)).data&&n.table.updateItem(c.kwargs.filters.intable,c.data[0]);break;case"201":t=n.table.getItem(n.position.row),_e.movement(o,t);break;case"204":t=n.table.getItem(n.position.row),_e.shipment(o,t);break;case"901":_e.arrival(o);break;case"902":_e.shipment(o);break;case"907":_e.rest(o);break;case"301":document.message("PPPPrint"),pe.document(o,a,r)}}({local_this:this,context:o,row:r,id:t,doc_type:e.single_name})}}}},t.prototype.isVisible=function(){return this.getRoot().isVisible()},t.prototype.hide=function(){this.getRoot().hide()},t.prototype.attachTo=function(e){this.getRoot().attachTo(e)},t.prototype.setContext=function(e){this.getRoot().setContext(e)},t.prototype.clearAll=function(){this.getRoot().clearAll()},t.prototype.parse=function(e){this.getRoot().parse(e)},t.prototype.show=function(e,t){var n=this,i=this.getRoot().getContext();this.clearAll(),this.parse(k.e);var o=[];if(o=o.concat(k.c[this.p_name]),i.position){var r=i.table.getItem(i.position.row);2==r.n_state?o=o.concat([3,6,7]):1==r.n_state?o=o.concat([4,5,7,100,1003]):3==r.n_state&&(o=o.concat([3,4,5,6,100,1003])),i.table.select(i.position,!1),k.g.includes(i.position.column)&&(o=o.concat([1,1e3]))}else o=o.concat([1,1e3,3,4,5,6,7,1001,1002,1003,100,200,300,1004,10]);(o=Array.from(new Set(o))).forEach((function(e){n.getRoot().hideItem(e)})),this.getRoot().show(e)},t.prototype.ready=function(){},t.prototype.init=function(){},t}(i.c);var Le=function(e){function t(n,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var o=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,e.call(this,n));return o.view_name=i,o.app.commonWidgets[o.view_name].center_table=o,o}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),t.prototype.config=function(){var e=Pe[this.view_name];return e.parent=this,new ye(this.app,e)},t.prototype.callContext=function(e,t){var n=t.locate(e);return this.contextDt.setContext({obj:webix.$$(e),table:t,position:n}),this.contextDt.show(e),webix.html.preventEvent(e)},t.prototype.getData=function(){var e=this;this.__table.clearAll(!0),this.__table.loadNext(0,0,0,0,!0).then((function(t){t&&(e.__table.clearAll(!0),e.__table.parse(t),e.__table.showItemByIndex(0))}))},t.prototype.getHeaders=function(){var e=this,t=[];return this.__table.eachColumn((function(n){var i=e.__table.getColumnConfig(n);t.push(i)}),!0),t},t.prototype.ready=function(){this.__table=$$(Pe[this.view_name].id)},t.prototype.init=function(){this.contextDt=this.ui(new De(this.app,this.view_name))},t}(i.c);function Me(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ae(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}var Fe=function(e){function t(){return Me(this,t),Ae(this,e.apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),t.prototype.config=function(){var e=this.app;return{localId:"_search",view:"text",label:"",labelWidth:0,value:"",width:650,minWidth:450,placeholder:"Поиск",on:{onKeyPress:function(t,n){var i=this;clearTimeout(this.delay),this.delay=setTimeout((function(){e.commonWidgets[i.$scope.p_name].center_table.getData()}),850)}}}},t.prototype.getSearch=function(){return this.$$("_search").getValue()},t.prototype.ready=function(){this.app.commonWidgets[this.p_name].search_bar=this},t.prototype.init=function(){this.p_name=this.getParentView().getParentView().p_name},t}(i.c);var Ue=function(e){function t(n,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var o=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,e.call(this,n));return o.widget=i,o}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),t.prototype.config=function(){var e=this,t=this.app;return{view:"button",type:"htmlbutton",width:35,height:35,longPress:!1,label:"",localId:"__refresh",template:function(){return t.getService("common").html_button_template("./library/img/refresh_1.svg","Обновить")},on:{onItemClick:function(t,n){e.app.commonWidgets[e.widget].center_table.getData()}}}},t.prototype.ready=function(){},t.prototype.init=function(){},t}(i.c);var Ke=function(e){function t(n,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var o=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,e.call(this,n));return o.parent_name=i,o}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),t.prototype.config=function(){var e=this.app;return{borderless:!0,cols:[{view:"label",localId:"__1",label:e.getService("common").genLabel(1),width:70,on:{onItemClick:function(){this.$scope.checkTag(this.config.localId,1)}}},{view:"label",localId:"__2",label:e.getService("common").genLabel(2),width:100,on:{onItemClick:function(){this.$scope.checkTag(this.config.localId,2)}}},{view:"label",localId:"__3",label:e.getService("common").genLabel(3),width:100,on:{onItemClick:function(){this.$scope.checkTag(this.config.localId,3)}}},new Ue(e,this.parent_name),{width:10}]}},t.prototype.uncheckAll=function(){var e=this;this.tags.forEach((function(t){e.$$(t).$view.children[0].children[1].classList.add("ordinary_label")}))},t.prototype.setFilter=function(e){this.state!==e&&(this.app.commonWidgets[this.parent_name].menu_filters.setState(e),this.state=e)},t.prototype.checkTag=function(e,t){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],i=this.$$(e).$view.children[0].children[1];!i.classList.contains("ordinary_label")&&n?(t="",this.uncheckAll()):(this.uncheckAll(),this.tags.includes(e)&&i.classList.remove("ordinary_label")),n&&this.setFilter(t)},t.prototype.ready=function(){this.app.commonWidgets[this.parent_name].quick_filters=this,this.tags=["__1","__2","__3"]},t.prototype.init=function(){},t}(i.c);var qe=function(e){function t(n,i,o){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var r=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,e.call(this,n));return r.element_id=o,r.global_this=i,r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),t.prototype.config=function(){var e=this;return{view:"button",localId:"__button",type:"icon",width:32,icon:"mdi-filter-remove-outline",label:"",css:"remove_filter",on:{onItemClick:function(){e.global_this.$$(e.element_id).setValue()}}}},t.prototype.click=function(){this.$$("__button").callEvent("onItemClick")},t.prototype.ready=function(){},t.prototype.init=function(){},t}(i.c);var ze=function(e){function t(n,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var o=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,e.call(this,n));return o.p_name=i,o}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),t.prototype.config=function(){var e=this,t=this,n=this.app;return{view:"cWindow",loclalId:"_pop",width:420,padding:4,point:!1,toFront:!0,relative:!0,modal:!1,css:"menu_filters",on:{onShow:function(){e.loadValues()}},body:{rows:[{view:"form",autoheight:!0,borderless:!1,localId:"__body",rows:[]},{borderless:!1,cols:[{},{view:"button",width:136,label:"Сбросить все",on:{onItemClick:function(){Array.from(document.getElementsByClassName("remove_filter")).forEach((function(e){var t=webix.html.locate(e,"view_id");$$(t).$scope.click()}))}}},{view:"button",label:"Применить",width:136,localId:"__apply",on:{onItemClick:function(){if(e.isVisible()){var i=e.$$("__body").getValues().n_state;i?n.commonWidgets[t.p_name].quick_filters.checkTag("__"+i,i,!1):n.commonWidgets[t.p_name].quick_filters.uncheckAll()}n.commonWidgets[t.p_name].center_table.getData(),e.saveValues(),e.hide()}}}]}]}}},t.prototype.setState=function(e){this.$$("__n_state_field").setValue(e),this.$$("__apply").callEvent("onItemClick")},t.prototype.saveValues=function(){this.values=this.$$("__body").getValues(),this.app.commonWidgets[this.p_name].status_bar.setStatus(this.values)},t.prototype.loadValues=function(){this.$$("__body").setValues(this.values)},t.prototype.isVisible=function(){return this.getRoot().isVisible()},t.prototype.getFiltersValue=function(){var e={},t=this.$$("__body").getChildViews();for(var n in t){var i=t[n].getChildViews()[0];e[i.config.name]=i.getText?i.getText():i.getValue()}return e},t.prototype.getFilters=function(){return this.$$("__body").getValues()},t.prototype.ready=function(){var e=this;this.values={};var t=this;this.app.commonWidgets[this.p_name].menu_filters=this,setTimeout((function(){e.app.commonWidgets[e.p_name].center_table.getHeaders().forEach((function(n){n.id;switch(n.filter_type){case"text":e.$$("__body").addView({css:"menu_filters_margin_top",cols:[{view:"text",localId:"__"+n.id+"_field",label:n.header[0].text,name:n.id,labelWidth:120},new qe(e.app,t,"__"+n.id+"_field")]});break;case"date":e.$$("__body").addView({css:"menu_filters_margin_top",cols:[{localId:"__"+n.id+"_field",view:"daterangepicker",multiselect:!0,label:n.header[0].text,name:n.id,labelWidth:120},new qe(e.app,t,"__"+n.id+"_field")]});break;case"multi":e.$$("__body").addView({css:"menu_filters_margin_top",cols:[{view:"multiselect",localId:"__"+n.id+"_field",label:n.header[0].text,name:n.id,labelWidth:120,options:{view:"multisuggest",button:!0,body:{parentName:n.id,yCount:5,scroll:!0,url:function(e){return x.f.get_data(e,this)},type:{height:32}}}},new qe(e.app,t,"__"+n.id+"_field")]});break;case"combo":var i=void 0;"orders"==e.p_name&&(i=!0),e.$$("__body").addView({css:"menu_filters_margin_top",cols:[{view:"combo",label:n.header[0].text||"Состояние",name:n.id,localId:"__"+n.id+"_field",labelWidth:120,suggest:{filter:x.e,body:{tooltip:!0,parentName:n.id,ordersFg:i,url:function(e){return x.f.get_data(e,this)},type:{height:32},on:{onAfterLoad:function(){this.add({$empty:!0,value:""},0)}}}}},new qe(e.app,t,"__"+n.id+"_field")]})}}))}),500)},t.prototype.show=function(e){return this.getRoot().show(e.$view)},t.prototype.hide=function(){return this.getRoot().hide()},t}(i.c);var Be=function(e){function t(n,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var o=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,e.call(this,n));return o.p_name=i,o}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),t.prototype.config=function(){return{view:"button",localId:"_bFilter",type:"icon",width:100,icon:"mdi-filter",label:"Фильтры",on:{onItemClick:function(){this.$scope.menuFilters.isVisible()?this.$scope.menuFilters.hide():this.$scope.menuFilters.show(this)}}}},t.prototype.buttonClick=function(){this.$$("_bFilter").callEvent("onItemClick")},t.prototype.ready=function(){this.app.commonWidgets[this.p_name].button_filter=this},t.prototype.init=function(){this.menuFilters=this.ui(new ze(this.app,this.p_name))},t}(i.c);var Je=function(e){function t(n,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var o=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,e.call(this,n));return o.p_name=i,o.app.commonWidgets[o.p_name].status_bar=o,o}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),t.prototype.config=function(){var e=this,t=this.app;return{borderless:!0,cols:[{view:"label",autowidth:!0,label:"Фильтры: ",on:{onItemClick:function(){t.commonWidgets[e.p_name]&&t.commonWidgets[e.p_name].button_filter&&t.commonWidgets[e.p_name].button_filter.buttonClick&&t.commonWidgets[e.p_name].button_filter.buttonClick()}}},{width:k.a},{view:"label",autowidth:!0,css:"status_bar",localId:"__status",label:"нет",on:{onItemClick:function(){t.commonWidgets[e.p_name]&&t.commonWidgets[e.p_name].button_filter&&t.commonWidgets[e.p_name].button_filter.buttonClick&&t.commonWidgets[e.p_name].button_filter.buttonClick()}}}]}},t.prototype.setStatus=function(){var e=this.app.commonWidgets[this.p_name].menu_filters.getFiltersValue(),t=[];for(var n in e){var i=e[n];if(i){var o=document.app.translates[n].value;t.push(o+": "+i)}}t=t.length>0?t.join("; "):"нет",this.$$("__status").define({label:t,tooltip:t}),this.$$("__status").refresh(),this.$$("__status").resize()},t.prototype.ready=function(){this.$$("__status").resize()},t.prototype.init=function(){},t}(i.c);var Ye=function(e){function t(n,i,o){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var r=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,e.call(this,n));return r.p_name=i,r.p_title=o,r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),t.prototype.config=function(){var e=this.app;return{borderless:!0,rows:[{view:"toolbar",borderless:!0,margin:0,cols:[{view:"label",label:"<span class='label_highlited'>"+this.p_title+"</span>",autowidth:!0,css:"label_highlited",hidden:!0},{width:k.d},{$subview:Fe,name:"search_bar"},{},new Ke(e,this.p_name),new Be(e,this.p_name)]},{height:26,borderless:!0,cols:[{view:"label",hidden:!0,autowidth:!0,label:"Название юр. лица:",on:{onItemClick:function(e,t){this.$scope.changeOrganization(e,t)}}},{width:k.d},{view:"label",hidden:!0,css:"italic",autowidth:!0,label:"ООО Организация",on:{onItemClick:function(e,t){this.$scope.changeOrganization(e,t)}}},{width:k.d},{width:k.d},new Je(e,this.p_name)]}]}},t.prototype.changeOrganization=function(e,t){document.message("Смена организации")},t.prototype.ready=function(){this.app.commonWidgets[this.p_name].header=this},t.prototype.init=function(){},t}(i.c);var Ze=function(e){function t(n,i,o){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var r=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,e.call(this,n));return r.p_name=i,r.app.commonWidgets[i]={},r.c_header=o||Ye,r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),t.prototype.config=function(){var e=this.app;return{type:"line",rows:[new this.c_header(e,this.p_name),{height:2},new Le(e,this.p_name)]}},t.prototype.init=function(){},t.prototype.ready=function(){},t}(i.c),Ge={docs:[{width:160,label:"Приход",callback:_e.arrival},{width:160,label:"Перемещение",callback:_e.movement},{width:160,label:"Продажа",callback:_e.shipment},{width:160,label:"Ввод остатков",callback:_e.rest},{width:160,label:"Списание",callback:_e.writeoff}],contragents:[{width:160,label:"Контрагенты",callback:function(e){document.message("Контрагенты---")}},{width:160,label:"Группы контрагентов",callback:function(e){document.message("Группы контрагентов")}},{width:160,label:"Виды контрагентов",callback:function(e){}},{width:160,label:"Сегменты контрагентов",callback:function(e){document.message("Сегменты контрагентов")}},{width:160,label:"Подразделения контрагентов",callback:function(e){document.message("Подразделения контрагентов")}}],products:[{width:160,label:"Остатки",callback:function(e){$$("sklad_main_ui").$scope.app.commonWidgets.sidebar.add_bar(e,Ze,"balances")}},{width:160,label:"Движение товаров",callback:function(e){document.message("Движение товаров")}},{width:160,label:"Номенклатура",callback:function(e){var t=new E($$("sklad_main_ui").$scope.app);$$("sklad_main_ui").$scope.ui(t).show("Справочник номенклатуры товаров")}},{width:160,label:"Группы номенклатуры",callback:function(e){document.message("Группы номенклатуры")}},{width:160,label:"Бренды",callback:function(e){document.message("Бренды")}},{width:160,label:"Виды номенклатуры",callback:function(e){document.message("Виды номенклатуры")}},{width:160,label:"Сегменты номенклатуры",callback:function(e){document.message("Сегменты")}},{width:160,label:"Штрихкоды",callback:function(e){document.message("Штрихкоды")}}],reports:[{width:160,label:"Движение товаров",callback:function(e){$$("sklad_main_ui").$scope.app.commonWidgets;document.message("Движ1")}}],journals:[{width:160,label:"Приходы",callback:function(e){$$("sklad_main_ui").$scope.app.commonWidgets.sidebar.add_bar(e,Ze,"arrivals")}},{width:160,label:"Оприходывания остатков",callback:function(e){document.message("--Оприходывания остатков")}},{width:160,label:"Перемещения",callback:function(e){document.message("Перемещения")}},{width:160,label:"Заказы",callback:function(e){document.message("Заказы"),$$("sklad_main_ui").$scope.app.commonWidgets.sidebar.add_bar(e,Ze,"orders")}},{width:160,label:"Продажи",callback:function(e){document.message("Продажи"),$$("sklad_main_ui").$scope.app.commonWidgets.sidebar.add_bar(e,Ze,"shipments")}},{width:160,label:"Списания",callback:function(e){document.message("Списания")}}],classifiers:[{width:160,label:"Валюты",callback:function(){document.message("Валюты")}},{width:160,label:"Банки",callback:function(){document.message("Банки")}},{width:160,label:"Регионы",callback:function(){document.message("Регионы")}},{width:160,label:"НДС",callback:function(){var e={name:"vats",sorting:{id:"c_name",dir:"asc"},columns:s},t=new T($$("sklad_main_ui").$scope.app,e);$$("sklad_main_ui").$scope.ui(t).show("НДС")}},{width:160,label:"Торговые марки",callback:function(){var e={name:"trademarks",sorting:{id:"c_name",dir:"asc"},columns:c},t=new T($$("sklad_main_ui").$scope.app,e);$$("sklad_main_ui").$scope.ui(t).show("Торговые марки")}},{width:160,label:"СПЕ",callback:function(){var e={name:"spes",sorting:{id:"c_name",dir:"asc"},columns:l},t=new T($$("sklad_main_ui").$scope.app,e);$$("sklad_main_ui").$scope.ui(t).show("СПЕ")}},{width:160,label:"Формы выпуска",callback:function(){var e={name:"relforms",sorting:{id:"c_name",dir:"asc"},columns:d},t=new T($$("sklad_main_ui").$scope.app,e);$$("sklad_main_ui").$scope.ui(t).show("Формы выпуска")}},{width:160,label:"Упаковки",callback:function(){var e={name:"packagings",sorting:{id:"c_name",dir:"asc"},columns:h},t=new T($$("sklad_main_ui").$scope.app,e);$$("sklad_main_ui").$scope.ui(t).show("Упаковки")}},{width:160,label:"МНН",callback:function(){var e={name:"mnns",sorting:{id:"c_rusname",dir:"asc"},columns:p},t=new T($$("sklad_main_ui").$scope.app,e);$$("sklad_main_ui").$scope.ui(t).show("МНН")}},{width:160,label:"Мегакатегории",callback:function(){var e={name:"megacategories",sorting:{id:"c_name",dir:"asc"},columns:_},t=new T($$("sklad_main_ui").$scope.app,e);$$("sklad_main_ui").$scope.ui(t).show("Мегакатегории")}},{width:160,label:"Производители",callback:function(){var e={name:"manufacturers",sorting:{id:"c_name",dir:"asc"},columns:f},t=new T($$("sklad_main_ui").$scope.app,e);$$("sklad_main_ui").$scope.ui(t).show("Производители")}},{width:160,label:"Группы",callback:function(){var e={name:"groups",sorting:{id:"c_name",dir:"asc"},columns:m},t=new T($$("sklad_main_ui").$scope.app,e);$$("sklad_main_ui").$scope.ui(t).show("Группы")}},{width:160,label:"Направления",callback:function(){var e={name:"directions",sorting:{id:"c_name",dir:"asc"},columns:w},t=new T($$("sklad_main_ui").$scope.app,e);$$("sklad_main_ui").$scope.ui(t).show("Направления")}},{width:160,label:"Дозировки",callback:function(){var e={name:"dosages",sorting:{id:"c_name",dir:"asc"},columns:g},t=new T($$("sklad_main_ui").$scope.app,e);$$("sklad_main_ui").$scope.ui(t).show("Дозировки")}},{width:160,label:"Страны",callback:function(){var e={name:"countries",sorting:{id:"c_name",dir:"asc"},columns:v},t=new T($$("sklad_main_ui").$scope.app,e);$$("sklad_main_ui").$scope.ui(t).show("Страны")}},{width:160,label:"Категории",callback:function(){var e={name:"categories",sorting:{id:"c_name",dir:"asc"},columns:y},t=new T($$("sklad_main_ui").$scope.app,e);$$("sklad_main_ui").$scope.ui(t).show("Категории")}},{width:160,label:"Области применения",callback:function(){var e={name:"appareas",sorting:{id:"c_name",dir:"asc"},columns:$},t=new T($$("sklad_main_ui").$scope.app,e);$$("sklad_main_ui").$scope.ui(t).show("Области применения")}}],refs:[{width:160,label:"Товары",callback:function(e){var t=new E($$("sklad_main_ui").$scope.app);$$("sklad_main_ui").$scope.ui(t).show("Справочник товаров")}},{width:160,label:"Контрагенты",callback:function(){var e={name:"partners",sorting:{id:"n_name",dir:"asc"},columns:a},t=new T($$("sklad_main_ui").$scope.app,e);$$("sklad_main_ui").$scope.ui(t).show("Контрагенты")}},{width:160,label:"Подразделения",callback:function(){var e={name:"points",sorting:{id:"n_name",dir:"asc"},columns:r},t=new T($$("sklad_main_ui").$scope.app,e);$$("sklad_main_ui").$scope.ui(t).show("Подразделения")}},{width:160,label:"НДС",callback:function(){var e={name:"vats",sorting:{id:"c_name",dir:"asc"},columns:s},t=new T($$("sklad_main_ui").$scope.app,e);$$("sklad_main_ui").$scope.ui(t).show("НДС")}},{width:160,label:"Торговые марки",callback:function(){var e={name:"trademarks",sorting:{id:"c_name",dir:"asc"},columns:c},t=new T($$("sklad_main_ui").$scope.app,e);$$("sklad_main_ui").$scope.ui(t).show("Торговые марки")}},{width:160,label:"СПЕ",callback:function(){var e={name:"spes",sorting:{id:"c_name",dir:"asc"},columns:l},t=new T($$("sklad_main_ui").$scope.app,e);$$("sklad_main_ui").$scope.ui(t).show("СПЕ")}},{width:160,label:"Формы выпуска",callback:function(){var e={name:"relforms",sorting:{id:"c_name",dir:"asc"},columns:d},t=new T($$("sklad_main_ui").$scope.app,e);$$("sklad_main_ui").$scope.ui(t).show("Формы выпуска")}},{width:160,label:"Типы контрагентов",callback:function(){var e={name:"ptypes",sorting:{id:"n_name",dir:"asc"},columns:u},t=new T($$("sklad_main_ui").$scope.app,e);$$("sklad_main_ui").$scope.ui(t).show("Типы контрагентов")}},{width:160,label:"Упаковки",callback:function(){var e={name:"packagings",sorting:{id:"c_name",dir:"asc"},columns:h},t=new T($$("sklad_main_ui").$scope.app,e);$$("sklad_main_ui").$scope.ui(t).show("Упаковки")}},{width:160,label:"МНН",callback:function(){var e={name:"mnns",sorting:{id:"c_rusname",dir:"asc"},columns:p},t=new T($$("sklad_main_ui").$scope.app,e);$$("sklad_main_ui").$scope.ui(t).show("МНН")}},{width:160,label:"Мегакатегории",callback:function(){var e={name:"megacategories",sorting:{id:"c_name",dir:"asc"},columns:_},t=new T($$("sklad_main_ui").$scope.app,e);$$("sklad_main_ui").$scope.ui(t).show("Мегакатегории")}},{width:160,label:"Производители",callback:function(){var e={name:"manufacturers",sorting:{id:"c_name",dir:"asc"},columns:f},t=new T($$("sklad_main_ui").$scope.app,e);$$("sklad_main_ui").$scope.ui(t).show("Производители")}},{width:160,label:"Группы",callback:function(){var e={name:"groups",sorting:{id:"c_name",dir:"asc"},columns:m},t=new T($$("sklad_main_ui").$scope.app,e);$$("sklad_main_ui").$scope.ui(t).show("Группы")}},{width:160,label:"Сотрудники",callback:function(){var e={name:"employees",sorting:{id:"c_name",dir:"asc"},columns:b},t=new T($$("sklad_main_ui").$scope.app,e);$$("sklad_main_ui").$scope.ui(t).show("Сотрудники")}},{width:160,label:"Направления",callback:function(){var e={name:"directions",sorting:{id:"c_name",dir:"asc"},columns:w},t=new T($$("sklad_main_ui").$scope.app,e);$$("sklad_main_ui").$scope.ui(t).show("Направления")}},{width:160,label:"Дозировки",callback:function(){var e={name:"dosages",sorting:{id:"c_name",dir:"asc"},columns:g},t=new T($$("sklad_main_ui").$scope.app,e);$$("sklad_main_ui").$scope.ui(t).show("Дозировки")}},{width:160,label:"Страны",callback:function(){var e={name:"countries",sorting:{id:"c_name",dir:"asc"},columns:v},t=new T($$("sklad_main_ui").$scope.app,e);$$("sklad_main_ui").$scope.ui(t).show("Страны")}},{width:160,label:"Категории",callback:function(){var e={name:"categories",sorting:{id:"c_name",dir:"asc"},columns:y},t=new T($$("sklad_main_ui").$scope.app,e);$$("sklad_main_ui").$scope.ui(t).show("Категории")}},{width:160,label:"Области применения",callback:function(){var e={name:"appareas",sorting:{id:"c_name",dir:"asc"},columns:$},t=new T($$("sklad_main_ui").$scope.app,e);$$("sklad_main_ui").$scope.ui(t).show("Области применения")}}]};!function(e){function t(n,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var o=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,e.call(this,n));return o.cfg=i,o}(function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)})(t,e),t.prototype.config=function(){return{view:"popup",loclalId:"_pop",padding:2,point:!0,css:"pop-up-menu",relative:!0,body:{cols:[{localId:"__mform",rows:[]},{hidden:!0,localId:"__eform",rows:[]}]}}},t.prototype.isVisible=function(){return this.getRoot().isVisible()},t.prototype.show=function(e){return this.getRoot().show(e.$view,{x:0,y:-3})},t.prototype.hide=function(){return this.getRoot().hide()},t.prototype.init=function(){},t.prototype.ready=function(){var e=this,t=Ge[this.cfg.name],n=void 0;t.length>10?(t.slice(0,10).forEach((function(t){e.$$("__mform").addView(new o(e.app,t))})),n=t.slice(10),this.$$("__eform").show(),n.forEach((function(t){e.$$("__eform").addView(new o(e.app,t))}))):t.forEach((function(t){e.$$("__mform").addView(new o(e.app,t))}))}}(i.c);var Xe=n(4);var Qe=function(e){function t(n,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var o=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,e.call(this,n));return o.cfg=i,o}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),t.prototype.config=function(){var e,t=this.app,n=Xe.b[this.cfg.name],i="__button__"+this.cfg.name,o=!!t.config.permitted.includes(i);return(e={view:"button",hidden:n.hidden,id:i,type:"htmlbutton"}).hidden=!o,e.longPress=n.longPress,e.width=40,e.height=40,e.template=function(){return t.getService("common").html_button_template(n.img,n.title,n.css_class)},e.on={onItemClick:function(e,t){this.$scope.cfg.click?this.$scope.cfg.click(this):document.message(this.$scope.cfg.name)}},e},t}(i.c);var et=function(e){function t(n,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var o=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,e.call(this,n));return o.p_name=i,o}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),t.prototype.config=function(){var e=this;return console.log("dd",e.p_name),{view:"contextmenu",autowidth:!0,localId:"__"+e.p_name+"_cmenu",css:"context_menu",point:!0,on:{onMenuItemClick:function(t,n,i){var o={local_this:this,context:this.getContext(),id:t};We[e.p_name](o)}}}},t.prototype.isVisible=function(){return this.getRoot().isVisible()},t.prototype.hide=function(){this.getRoot().hide()},t.prototype.attachTo=function(e){this.getRoot().attachTo(e)},t.prototype.setContext=function(e){this.getRoot().setContext(e)},t.prototype.clearAll=function(){this.getRoot().clearAll()},t.prototype.parse=function(e){this.getRoot().parse(e)},t.prototype.show=function(e,t){this.clearAll(),this.parse(k.b[this.p_name]),this.getRoot().show(e,{x:0,y:-3})},t.prototype.ready=function(){},t.prototype.init=function(){},t}(i.c);var tt=function(e){function t(n,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var o=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,e.call(this,n));return o.cfg=i,o}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),t.prototype.config=function(){var e,t=this.app,n=Xe.a[this.cfg.name],i=[].concat(this.cfg.css||[]).concat(n.css_class||[]),o="__button__"+this.cfg.name,r=!!t.config.permitted.includes(o);return(e={view:"button",hidden:n.hidden,id:o,localId:"__i_but"}).hidden=!r,e.longPress=n.longPress,e.width=n.width,e.template=function(){return t.getService("common").icon_button_template(n.label,n.icon,n.title,i)},e.on={onItemClick:function(e,t){this.$scope.context?this.$scope.setContext(t):this.$scope.cfg.click?this.$scope.cfg.click(this):document.message(this.$scope.cfg.name)}},e},t.prototype.setContext=function(e){this.context.setContext({obj:webix.$$(e)}),this.context.show(this.$$("__i_but").$view)},t.prototype.ready=function(){},t.prototype.init=function(){this.cfg.context&&(this.context=this.ui(new et(this.app,this.cfg.name)))},t}(i.c);var nt=function(e){function t(n,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var o=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,e.call(this,n));return o.cfg=i,o.p_name=i.name,o}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),t.prototype.config=function(){var e=this.app,t=Xe.a[this.p_name],n=this,i="__"+n.p_name+"_menu",o=!!e.config.permitted.includes(i);return{view:"menu",width:t.width,autowidth:!0,hidden:!o,id:i,data:{id:-1,value:e.getService("common").icon_menu_button_template(t.label,t.icon,t.title),submenu:k.b[this.p_name],config:{type:{height:30}}},on:{onMenuItemClick:function(e,t,i){var o={local_this:this,id:e};We[n.p_name](o)}}}},t.prototype.ready=function(){},t.prototype.init=function(){},t}(i.c);var it=function(e){function t(n,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var o=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,e.call(this,n));return o.view_name=i,o.app.commonWidgets[i].header=o,o}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),t.prototype.config=function(){var e=this.app;return{borderless:!0,rows:[{view:"toolbar",borderless:!0,margin:0,cols:[{view:"label",label:"<span class='label_highlited'>Остатки</span>",autowidth:!0,css:"label_highlited",hidden:!0},{view:"checkbox",localId:"__group",labelRight:"Группировать по названию",value:1,labelWidth:0,labelAlign:"right",width:220,on:{onChange:function(){clearTimeout(this.delay),this.delay=setTimeout((function(){e.commonWidgets.balances.center_table.getData()}),850)}}},{width:k.d},{view:"text",localId:"__search",label:"",name:"_search",labelWidth:0,hidden:!1,on:{onKeyPress:function(t,n){clearTimeout(this.delay),this.delay=setTimeout((function(){e.commonWidgets.balances.center_table.getData()}),850)}}},{},new Ue(this.app,"balances"),{width:k.d},{view:"button",type:"htmlbutton",width:35,height:35,longPress:!1,label:"",localId:"__price_upl",template:function(){return e.getService("common").html_button_template("./library/img/price.svg","Выгрузить прайс")},on:{onItemClick:function(e,t){Object(x.c)(),document.message("Выгрузка прайса")}}},{width:k.d}]},{height:26,borderless:!0,cols:[{width:k.d},{width:k.d},{width:k.d},new Je(e,this.view_name)]}]}},t.prototype.getSearch=function(){try{return{n_product:this.$$("__search").getValue(),group:this.$$("__group").getValue()}}catch(e){return{}}},t.prototype.ready=function(){},t.prototype.init=function(){},t}(i.c);function ot(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function rt(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}var at=function(e){function t(){return ot(this,t),rt(this,e.apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),t.prototype.config=function(){var e=this.app,t=this;return{view:"toolbar",css:"side_bar_bar",id:"_sideMenu",height:44,cols:[new Qe(e,{name:"balances",click:function(e){t.add_bar(e,Ze,"balances")}}),new Qe(e,{name:"arrivals",click:function(e){t.add_bar(e,Ze,"arrivals")}}),new Qe(e,{name:"orders",click:function(e){t.add_bar(e,Ze,"orders")}}),new Qe(e,{name:"shipments",click:function(e){t.add_bar(e,Ze,"shipments")}}),{view:"side-menu-separator"},new nt(e,{name:"documents"}),new nt(e,{name:"journals"}),new nt(e,{name:"products"}),new nt(e,{name:"classifiers"}),{view:"side-menu-separator"},new nt(e,{name:"contragents"}),{view:"side-menu-separator"},new nt(e,{name:"reports"}),new tt(e,{name:"analitics"}),{},{view:"side-menu-separator",hidden:!0},new nt(e,{name:"managements"}),new nt(e,{name:"options"})]}},t.prototype.add_bar=function(e,t,n){var i=k.f[n]?k.f[n]:k.f.info,o="balances"==n?it:void 0,r=i.id;if(this.screens[r])this.app.commonWidgets.centerbar.setValue(r);else{var a=i.name;if(!a)return!1;var s={id:r,value:a,width:i.width,close:!0},c={$scope:e.$scope,id:r,$subview:new t(this.app,n,o)};this.app.commonWidgets.centerbar.addBar(c,s)&&(this.screens[r]=!0)}},t.prototype.ready=function(){this.screens={_mView:!0}},t.prototype.init=function(){this.widget_name="sidebar",this.app.commonWidgets[this.widget_name]=this},t}(i.c);t.default=at},function(e,t,n){"use strict";n.r(t);var i=n(2);function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}var a=function(e){function t(){return o(this,t),r(this,e.apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),t.prototype.config=function(){return{template:"Новости, информация и т.п."}},t.prototype.ready=function(){},t.prototype.init=function(){},t}(i.c);function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function c(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}var l=function(e){function t(){return s(this,t),c(this,e.apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),t.prototype.config=function(){var e=this.app;return{view:"layout",borderless:!0,id:"__bar__main_center",rows:[{view:"tabbar",tabMargin:8,localId:"__tabbar",borderless:!0,popupWidth:170,tabMinWidth:170,tabMoreWidth:70,animate:!1,multiview:!0,on:{onOptionRemove:function(t){$$(t).destructor(),delete e.commonWidgets.sidebar.screens[t]},onBeforeTabClose:function(t){if(Object.keys(e.commonWidgets.sidebar.screens).length<=1)return document.message("Для работы нужна хотя бы одна вкладка","error"),!1}},options:[{value:"Информация",id:"_mView",close:!0,width:130}]},{width:document.documentElement.clientWidth-46,view:"multiview",localId:"__multiview",animate:!1,keepViews:!0,cells:[{$subview:a,id:"_mView"}]}]}},t.prototype.setValue=function(e){this.$$("__tabbar").setValue(e)},t.prototype.addBar=function(e,t){var n=!0;try{this.$$("__multiview").addView(e),this.$$("__tabbar").addOption(t,!0)}catch(e){console.log(e),n=!1}return n},t.prototype.ready=function(){this.app.commonWidgets[this.widget_name]=this},t.prototype.init=function(){this.widget_name="centerbar"},t}(i.c);t.default=l},function(e,t){webix.i18n.locales["ru-RU"]={groupDelimiter:" ",groupSize:3,decimalDelimiter:",",decimalSize:2,dateFormat:"%d.%m.%Y",timeFormat:"%H:%i",longDateFormat:"%d %F %Y",fullDateFormat:"%d.%m.%Y %H:%i",price:"{obj} руб.",priceSettings:null,calendar:{monthFull:["Январь","Февраль","Март","Апрель","Maй","Июнь","Июль","Август","Сентябрь","Oктябрь","Ноябрь","Декабрь"],monthShort:["Янв","Фев","Maр","Aпр","Maй","Июн","Июл","Aвг","Сен","Окт","Ноя","Дек"],dayFull:["Воскресенье","Понедельник","Вторник","Среда","Четверг","Пятница","Суббота"],dayShort:["Вс","Пн","Вт","Ср","Чт","Пт","Сб"],hours:"Часы",minutes:"Минуты",done:"Гoтовo",clear:"Очистить",today:"Сегодня"},controls:{select:"Выбрать",invalidMessage:"Неправильное значение"},dataExport:{page:"Страница",of:"из"},PDFviewer:{of:"из",automaticZoom:"Автоматический зум",actualSize:"Настоящий размер",pageFit:"Размер страницы",pageWidth:"Ширина страницы",pageHeight:"Высота страницы"},aria:{calendar:"Календарь",increaseValue:"Увеличить значение",decreaseValue:"Уменьшить значение",navMonth:["Предыдущий месяц","Следующий месяц"],navYear:["Предыдущий год","Следующий год"],navDecade:["Предыдущие десять лет","Следующие десять лет"],dateFormat:"%d %F %Y",monthFormat:"%F %Y",yearFormat:"%Y",hourFormat:"Часы: %H",minuteFormat:"Минуты: %i",removeItem:"Удалить элемент",pages:["Первая страница","Предыдущая страница","Следующая страница","Последняя страница"],page:"Страница",headermenu:"Меню шапки таблицы",openGroup:"Развернуть группу столбцов",closeGroup:"Свернуть группу столбцов",closeTab:"Закрыть вкладку",showTabs:"Показать больше вкладок",resetTreeMap:"Вернуться к первоначальному представлению",navTreeMap:"Перейти на уровень выше",nextTab:"Следующая вкладка",prevTab:"Предыдущая вкладка",multitextSection:"Добавить элемент",multitextextraSection:"Удалить элемент",showChart:"Показать чарт",hideChart:"Спрятать чарт",resizeChart:"Изменить размер чарта"},richtext:{underline:"Подчеркивание",bold:"Жирный",italic:"Курсив"},combo:{select:"Выбрать",selectAll:"Выбрать все",unselectAll:"Невыбрать все"}}},function(e,t,n){"use strict";n.r(t);var i=n(2),o=n(0),r=n(5),a=n.n(r),s=n(1);function c(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function l(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}var d=function(e){function t(){return c(this,t),l(this,e.apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),t.prototype.config=function(){var e=this,t=e.app,n={view:"form",localId:"auth_box",label:"Аутентификация",elements:[{view:"text",label:"Пользователь",name:"user",labelWidth:120,width:400,localId:"_user"},{view:"text",type:"password",label:"Пароль",name:"pass",labelWidth:120,width:400},{cols:[{},{},{view:"button",label:"OK",hotkey:"enter",tooltip:"Войти",click:function(){e.validate_user(e.$$("auth_box").getValues())?this.$scope.show("/start"):(document.message("не авторизованно","error"),Object(o.deleteCookie)(t.config.sklad_cook))}}]}]};return{view:"layout",rows:[{height:document.documentElement.clientHeight/4},{cols:[{},n,{}]},{}]}},t.prototype.ready=function(){this.$$("_user").focus()},t.prototype.init=function(){var e=this.app;Object(o.getCookie)(e.config.sklad_cook)&&this.show("/start")},t.prototype.validate_user=function(e){var t=this.app,n=!1;e.pass=a()(e.pass);var i=s.h.login(e.user,e.pass);if(i&&i.data&&!i.reason){var r=i.data[0];n=!0;Object(o.setCookie)(t.config.sklad_cook,[r.n_sklad_name,r.n_hash].join(""),{path:"/",expires:0})}return n},t}(i.c);t.default=d},function(e,t,n){"use strict";n.r(t);var i=n(2),o=n(7),r=n(6),a=n(9),s=n(8),c=n(0),l=n(1);n(5);function d(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function u(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}var h=function(e){function t(){return d(this,t),u(this,e.apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),t.prototype.config=function(){return{type:"line",id:"sklad_main_ui",rows:[{$subview:o.default},{$subview:s.default},{height:2},{$subview:a.default},{$subview:r.default}]}},t.prototype.getError=function(e){var t=this;1===e?webix.alert({type:"alert-error",title:"Ошибка регистрации",text:"Пользователь не зарегистрирован в системе. Обратитесь к администратору",width:500}).then((function(n){t.getError(e)})):2===e&&webix.alert({type:"alert-error",title:"Ошибка входа",buttons:["OK"],text:"Авторизуйтесь в складе и обновите страницу",width:300}).then((function(n){t.getError(e)}))},t.prototype.init=function(){var e=Object(c.getCookie)(this.app.config.sklad_cook);if(localStorage.setItem("opened",""),e.length>32){var t=decodeURI(e.slice(0,-32)),n=l.h.credentionals(t);n.data?(this.app.config.user=n.data[0].n_name,this.app.config.user_id=n.data[0].n_id,this.app.config.home_org_id=n.data[0].n_home_id,this.app.config.home_org=n.data[0].n_home_name,this.app.config.database=n.data[0].database||void 0):this.getError(1)}else this.getError(2)},t.prototype.ready=function(){this.app.commonWidgets.header.setUser(),this.app.commonWidgets.header.setOrg(),this.app.commonWidgets.header.setDb()},t}(i.c);t.default=h},function(e,t){},function(e,t,n){},function(e,t,n){var i={"./center":9,"./center.js":9,"./common":0,"./common.js":0,"./footer":6,"./footer.js":6,"./header":7,"./header.js":7,"./login":11,"./login.js":11,"./md5":5,"./md5.js":5,"./menu-bar":8,"./menu-bar.js":8,"./start":12,"./start.js":12};function o(e){var t=r(e);return n(t)}function r(e){if(!n.o(i,e)){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}return i[e]}o.keys=function(){return Object.keys(i)},o.resolve=r,e.exports=o,o.id=15},function(e,t,n){var i={"./en":13,"./en.js":13,"./ru":10,"./ru.js":10};function o(e){var t=r(e);return n(t)}function r(e){if(!n.o(i,e)){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}return i[e]}o.keys=function(){return Object.keys(i)},o.resolve=r,e.exports=o,o.id=16},function(e,t,n){"use strict";n.r(t);n(14);var i=n(0),o=n(2);n(10);function r(e){var t={genLabel:function(t){var n=e.states[t];return"<span class='table_icon "+n.picture+"', style='color: "+n.color+" '></span><span class='ordinary_label'>"+n.value.toLowerCase()+"</span>"},html_button_template:function(e,t,n){return"<div class='webix_el_button'><button class='webix_img_btn_abs', style='background:transparent'>"+("<div class='"+(n=n||"html_button")+"', title='"+t+"', style='background-image:url("+e+");'></div>")+"</button> </div>"},icon_button_template:function(e,t,n){return"<div class='webix_el_button>"+("<div class='webix_el_box', title='"+n+"'><button class='webix_button custom_button'>"+('<svg  version="1.1" class="icon_button" viewBox="0 0 30 30">'+t+"</svg>")+"<span class='icon_button_label', style=''>"+e+"</span>")+"</div>"},icon_menu_button_template:function(e,t,n){return"<span class='webix_el_box', title='"+n+"'>"+('<svg  version="1.1" class="icon_button" viewBox="0 0 30 30">'+t+"</svg>")+"<span class='icon_button_label'>"+e+"</span></span>"},saveDocument:function(e){var t=e.$$("__charge")?{charge:e.$$("__charge").getValue()}:{},n={header:Object.assign(t,e.getHeader().getData()),table:e.$$("__table").serialize()},i=e.validateDocument(e,n);if(i)return i;var o=e.saveDocumentServer(e,n);return o||!1},holdDocument:function(e,t,n){var o={doc_type:e,doc_id:t,intable:n},r={method:"hold_document",kwargs:{user:Object(i.getUser)(),filters:o}};return Object(i.checkResponse)(Object(i.request)(r,!0).response,"s")},unDeleteDocument:function(e,t,n){var o={doc_type:e,doc_id:t,intable:n},r={method:"undelete_document",kwargs:{user:Object(i.getUser)(),filters:o}};return Object(i.checkResponse)(Object(i.request)(r,!0).response,"s")},deleteDocument:function(e,t,n){var o={doc_type:e,doc_id:t,intable:n},r={method:"delete_document",kwargs:{user:Object(i.getUser)(),filters:o}};return Object(i.checkResponse)(Object(i.request)(r,!0).response,"s")},unHoldDocument:function(e,t,n){var o={doc_type:e,doc_id:t,intable:n},r={method:"unhold_document",kwargs:{user:Object(i.getUser)(),filters:o}};return Object(i.checkResponse)(Object(i.request)(r,!0).response,"s")},logout:function(){Object(i.deleteCookie)(e.config.sklad_cook),location.href=document.location.href},search_key:function(e,t){var n=Object.keys(e),i=void 0;return n.forEach((function(e){-1!==e.indexOf(t)&&(i=e)})),i}};e.setService("common",t),webix.editors.price=webix.extend({getValue:function(){return 100*parseFloat(this.getInputNode(this.node).value.toString().replace(",","."))},setValue:function(e){var t=this.getInputNode(this.node);t.value=e/100,function(e,t){var n=e.config.suggest;if(n){var i=e.config.suggest=function(e){if("string"==typeof e)return e;if(e.linkInput)return e._settings.id;"object"==_typeof(e)?(isArray(e)&&(e={data:e}),e.view=e.view||"suggest"):!0===e&&(e={view:"suggest"});return ui(e).config.id}(n),o=$$(i);o&&t&&o.linkInput(t)}}(this,t)}},webix.editors.text),webix.Number.formatNumber=function(e,t){if(!e&&0!==e)return"";if(t=t||{groupDelimiter:" ",groupSize:3,decimalDelimiter:",",decimalSize:2,prefix:"",sufix:" ₽"},""===(e/=100)||void 0===e)return e;var n=(e=parseFloat(e))<0?"-":"";e=Math.abs(e),t.decimalOptional||(e=e.toFixed(t.decimalSize));var i=e.toString();i=i.split(".");var o="";if(t.groupSize){var r=t.groupSize,a=i[0].length;do{o=((a-=r)>0?i[0].substr(a,r):i[0].substr(0,r+a))+(o?t.groupDelimiter+o:"")}while(a>0)}else o=i[0];return i=t.decimalSize?n+o+(i[1]?t.decimalDelimiter+i[1]:""):n+o,t.prefix||t.sufix?t.prefix+i+t.sufix:i},webix.ui.datafilter.totalTable=webix.extend({refresh:function(e,t,n){t.firstChild.innerHTML=isNaN(e.data.order.length)?0:e.data.order.length}},webix.ui.datafilter.summColumn),webix.ui.datafilter.totalTableLong=webix.extend({refresh:function(e,t,n){t.firstChild.innerHTML="Всего в выборке: ",t.firstChild.innerHTML+=isNaN(e.data.order.length)?0:e.data.order.length}},webix.ui.datafilter.summColumn),webix.ui.datafilter.totalVisibleColumn=webix.extend({refresh:function(e,t,n){var i=e.data.pull,o=0;for(var r in i){var a=+i[r][n.columnId];isNaN(a)||(o+=a)}t.firstChild.innerHTML=webix.Number.formatNumber(o)}},webix.ui.datafilter.summColumn),webix.ui.datafilter.totalColumn=webix.extend({refresh:function(e,t,n){var i=0;e.mapCells(null,n.columnId,null,1,(function(e){var t=+e;return isNaN(t)||(i+=t),e})),t.firstChild.innerHTML=webix.Number.formatNumber(i)}},webix.ui.datafilter.summColumn),webix.protoUI({name:"side-menu-separator",defaults:{css:"webix_ssheet_toolbar_spacer",template:" ",width:1,borderless:!0}},webix.ui.view),webix.protoUI({name:"cWindow",defaults:{resize:!1,modal:!1,move:!1,position:"center"},$init:function(e){webix.extend(e,{head:{view:"toolbar",cols:[{view:"label",label:""},{view:"button",type:"icon",icon:"mdi-close",height:26,width:26,on:{onItemClick:function(){this.getTopParentView().hide()}}}]}})}},webix.ui.window)}var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e};var s=function(e){function t(n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var s={production:!0,id:"sklad71App",name:"sklad71",version:"2021.139.1602",start:"/login",home_org_id:"",home_org:"",user:"",fullname:"",role:0,eventS:void 0,router:o.a,x_api:"x_login",debug:!0,searchDelay:1e3,popDelay:800,roles:[],sklad_cook:"sk_new-app",user_id:"",database:void 0,permitted:["__documents_menu","__journals_menu","__products_menu","__classifiers_menu","__contragents_menu","__reports_menu"],restricted:["__managements_menu","__options_menu","__button__analitics","__button__balances","__button__arrivals","__button__orders","__button__shipments","__button__references"]},c=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,e.call(this,a({},s,n)));console.log("prod",!0),document.rpc_url="https://online365.pro/RPC/",c.attachEvent("app:error:resolve",(function(e,t){window.console.error(t)}));var l=c;return l.use(r),document.app=l,document.message=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"success",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;webix.message({type:t,text:e,expire:1e3*n})},Object(i.getRefs)(l),l.commonWidgets={},webix.attachEvent("onBeforeAjax",(function(e,t,n,i,o,r,a){o["x-api-key"]=l.config.x_api})),window.onerror=function(e,t,n,i,o){return webix.message({text:"Возникла ошибка - мы работаем над ее исправлением. Текст в консоли",type:"error",width:"800px",delay:"5"}),window.console.log("message:",e),window.console.log("source:",t),window.console.log("err:",o),!0},l.attachEvent("app:error:resolve",(function(e,t){window.console.error(t)})),c}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),t}(o.b);t.default=s;webix.i18n.setLocale("ru-RU"),webix.ready((function(){return(new s).render()})),webix.protoUI({name:"sklad71",app:s},webix.ui.jetapp)}]);