(function webpackUniversalModuleDefinition(root, factory) {
	if(typeof exports === 'object' && typeof module === 'object')
		module.exports = factory();
	else if(typeof define === 'function' && define.amd)
		define([], factory);
	else {
		var a = factory();
		for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
	}
})(this, function() {
return /******/ (function(modules) { // webpackBootstrap
/******/ 	// The module cache
/******/ 	var installedModules = {};
/******/
/******/ 	// The require function
/******/ 	function __webpack_require__(moduleId) {
/******/
/******/ 		// Check if module is in cache
/******/ 		if(installedModules[moduleId])
/******/ 			return installedModules[moduleId].exports;
/******/
/******/ 		// Create a new module (and put it into the cache)
/******/ 		var module = installedModules[moduleId] = {
/******/ 			exports: {},
/******/ 			id: moduleId,
/******/ 			loaded: false
/******/ 		};
/******/
/******/ 		// Execute the module function
/******/ 		modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ 		// Flag the module as loaded
/******/ 		module.loaded = true;
/******/
/******/ 		// Return the exports of the module
/******/ 		return module.exports;
/******/ 	}
/******/
/******/
/******/ 	// expose the modules object (__webpack_modules__)
/******/ 	__webpack_require__.m = modules;
/******/
/******/ 	// expose the module cache
/******/ 	__webpack_require__.c = installedModules;
/******/
/******/ 	// __webpack_public_path__
/******/ 	__webpack_require__.p = "/";
/******/
/******/ 	// Load entry module and return exports
/******/ 	return __webpack_require__(0);
/******/ })
/************************************************************************/
/******/ ({

/***/ 0:
/***/ function(module, exports, __webpack_require__) {

	__webpack_require__(470);
	__webpack_require__(429);
	__webpack_require__(440);
	__webpack_require__(449);
	__webpack_require__(459);
	__webpack_require__(457);
	__webpack_require__(475);
	__webpack_require__(444);
	__webpack_require__(434);
	__webpack_require__(111);
	__webpack_require__(443);
	__webpack_require__(442);
	__webpack_require__(433);
	__webpack_require__(432);
	__webpack_require__(439);
	__webpack_require__(111);
	__webpack_require__(438);
	__webpack_require__(436);
	__webpack_require__(465);
	__webpack_require__(464);
	__webpack_require__(446);
	__webpack_require__(472);
	__webpack_require__(427);
	__webpack_require__(450);
	__webpack_require__(430);
	__webpack_require__(426);
	__webpack_require__(445);
	__webpack_require__(471);
	__webpack_require__(448);
	__webpack_require__(474);
	__webpack_require__(451);
	__webpack_require__(441);
	__webpack_require__(460);
	__webpack_require__(437);
	__webpack_require__(447);
	__webpack_require__(473);
	__webpack_require__(453);
	__webpack_require__(468);
	__webpack_require__(455);
	__webpack_require__(456);
	__webpack_require__(454);
	__webpack_require__(469);
	__webpack_require__(428);
	__webpack_require__(462);
	__webpack_require__(452);
	__webpack_require__(467);
	__webpack_require__(461);
	__webpack_require__(431);
	__webpack_require__(458);
	__webpack_require__(435);
	__webpack_require__(466);
	__webpack_require__(463);
	__webpack_require__(666);


/***/ },

/***/ 1:
/***/ function(module, exports) {

	/*
		MIT License http://www.opensource.org/licenses/mit-license.php
		Author Tobias Koppers @sokra
	*/
	// css base code, injected by the css-loader
	module.exports = function() {
		var list = [];
	
		// return the list of modules as css string
		list.toString = function toString() {
			var result = [];
			for(var i = 0; i < this.length; i++) {
				var item = this[i];
				if(item[2]) {
					result.push("@media " + item[2] + "{" + item[1] + "}");
				} else {
					result.push(item[1]);
				}
			}
			return result.join("");
		};
	
		// import a list of modules into the list
		list.i = function(modules, mediaQuery) {
			if(typeof modules === "string")
				modules = [[null, modules, ""]];
			var alreadyImportedModules = {};
			for(var i = 0; i < this.length; i++) {
				var id = this[i][0];
				if(typeof id === "number")
					alreadyImportedModules[id] = true;
			}
			for(i = 0; i < modules.length; i++) {
				var item = modules[i];
				// skip already imported module
				// this implementation is not 100% perfect for weird media query combinations
				//  when a module is imported multiple times with different media queries.
				//  I hope this will never occur (Hey this way we have smaller bundles)
				if(typeof item[0] !== "number" || !alreadyImportedModules[item[0]]) {
					if(mediaQuery && !item[2]) {
						item[2] = mediaQuery;
					} else if(mediaQuery) {
						item[2] = "(" + item[2] + ") and (" + mediaQuery + ")";
					}
					list.push(item);
				}
			}
		};
		return list;
	};


/***/ },

/***/ 2:
/***/ function(module, exports, __webpack_require__) {

	/*
		MIT License http://www.opensource.org/licenses/mit-license.php
		Author Tobias Koppers @sokra
	*/
	var stylesInDom = {},
		memoize = function(fn) {
			var memo;
			return function () {
				if (typeof memo === "undefined") memo = fn.apply(this, arguments);
				return memo;
			};
		},
		isOldIE = memoize(function() {
			return /msie [6-9]\b/.test(self.navigator.userAgent.toLowerCase());
		}),
		getHeadElement = memoize(function () {
			return document.head || document.getElementsByTagName("head")[0];
		}),
		singletonElement = null,
		singletonCounter = 0,
		styleElementsInsertedAtTop = [];
	
	module.exports = function(list, options) {
		if(false) {
			if(typeof document !== "object") throw new Error("The style-loader cannot be used in a non-browser environment");
		}
	
		options = options || {};
		// Force single-tag solution on IE6-9, which has a hard limit on the # of <style>
		// tags it will allow on a page
		if (typeof options.singleton === "undefined") options.singleton = isOldIE();
	
		// By default, add <style> tags to the bottom of <head>.
		if (typeof options.insertAt === "undefined") options.insertAt = "bottom";
	
		var styles = listToStyles(list);
		addStylesToDom(styles, options);
	
		return function update(newList) {
			var mayRemove = [];
			for(var i = 0; i < styles.length; i++) {
				var item = styles[i];
				var domStyle = stylesInDom[item.id];
				domStyle.refs--;
				mayRemove.push(domStyle);
			}
			if(newList) {
				var newStyles = listToStyles(newList);
				addStylesToDom(newStyles, options);
			}
			for(var i = 0; i < mayRemove.length; i++) {
				var domStyle = mayRemove[i];
				if(domStyle.refs === 0) {
					for(var j = 0; j < domStyle.parts.length; j++)
						domStyle.parts[j]();
					delete stylesInDom[domStyle.id];
				}
			}
		};
	}
	
	function addStylesToDom(styles, options) {
		for(var i = 0; i < styles.length; i++) {
			var item = styles[i];
			var domStyle = stylesInDom[item.id];
			if(domStyle) {
				domStyle.refs++;
				for(var j = 0; j < domStyle.parts.length; j++) {
					domStyle.parts[j](item.parts[j]);
				}
				for(; j < item.parts.length; j++) {
					domStyle.parts.push(addStyle(item.parts[j], options));
				}
			} else {
				var parts = [];
				for(var j = 0; j < item.parts.length; j++) {
					parts.push(addStyle(item.parts[j], options));
				}
				stylesInDom[item.id] = {id: item.id, refs: 1, parts: parts};
			}
		}
	}
	
	function listToStyles(list) {
		var styles = [];
		var newStyles = {};
		for(var i = 0; i < list.length; i++) {
			var item = list[i];
			var id = item[0];
			var css = item[1];
			var media = item[2];
			var sourceMap = item[3];
			var part = {css: css, media: media, sourceMap: sourceMap};
			if(!newStyles[id])
				styles.push(newStyles[id] = {id: id, parts: [part]});
			else
				newStyles[id].parts.push(part);
		}
		return styles;
	}
	
	function insertStyleElement(options, styleElement) {
		var head = getHeadElement();
		var lastStyleElementInsertedAtTop = styleElementsInsertedAtTop[styleElementsInsertedAtTop.length - 1];
		if (options.insertAt === "top") {
			if(!lastStyleElementInsertedAtTop) {
				head.insertBefore(styleElement, head.firstChild);
			} else if(lastStyleElementInsertedAtTop.nextSibling) {
				head.insertBefore(styleElement, lastStyleElementInsertedAtTop.nextSibling);
			} else {
				head.appendChild(styleElement);
			}
			styleElementsInsertedAtTop.push(styleElement);
		} else if (options.insertAt === "bottom") {
			head.appendChild(styleElement);
		} else {
			throw new Error("Invalid value for parameter 'insertAt'. Must be 'top' or 'bottom'.");
		}
	}
	
	function removeStyleElement(styleElement) {
		styleElement.parentNode.removeChild(styleElement);
		var idx = styleElementsInsertedAtTop.indexOf(styleElement);
		if(idx >= 0) {
			styleElementsInsertedAtTop.splice(idx, 1);
		}
	}
	
	function createStyleElement(options) {
		var styleElement = document.createElement("style");
		styleElement.type = "text/css";
		insertStyleElement(options, styleElement);
		return styleElement;
	}
	
	function createLinkElement(options) {
		var linkElement = document.createElement("link");
		linkElement.rel = "stylesheet";
		insertStyleElement(options, linkElement);
		return linkElement;
	}
	
	function addStyle(obj, options) {
		var styleElement, update, remove;
	
		if (options.singleton) {
			var styleIndex = singletonCounter++;
			styleElement = singletonElement || (singletonElement = createStyleElement(options));
			update = applyToSingletonTag.bind(null, styleElement, styleIndex, false);
			remove = applyToSingletonTag.bind(null, styleElement, styleIndex, true);
		} else if(obj.sourceMap &&
			typeof URL === "function" &&
			typeof URL.createObjectURL === "function" &&
			typeof URL.revokeObjectURL === "function" &&
			typeof Blob === "function" &&
			typeof btoa === "function") {
			styleElement = createLinkElement(options);
			update = updateLink.bind(null, styleElement);
			remove = function() {
				removeStyleElement(styleElement);
				if(styleElement.href)
					URL.revokeObjectURL(styleElement.href);
			};
		} else {
			styleElement = createStyleElement(options);
			update = applyToTag.bind(null, styleElement);
			remove = function() {
				removeStyleElement(styleElement);
			};
		}
	
		update(obj);
	
		return function updateStyle(newObj) {
			if(newObj) {
				if(newObj.css === obj.css && newObj.media === obj.media && newObj.sourceMap === obj.sourceMap)
					return;
				update(obj = newObj);
			} else {
				remove();
			}
		};
	}
	
	var replaceText = (function () {
		var textStore = [];
	
		return function (index, replacement) {
			textStore[index] = replacement;
			return textStore.filter(Boolean).join('\n');
		};
	})();
	
	function applyToSingletonTag(styleElement, index, remove, obj) {
		var css = remove ? "" : obj.css;
	
		if (styleElement.styleSheet) {
			styleElement.styleSheet.cssText = replaceText(index, css);
		} else {
			var cssNode = document.createTextNode(css);
			var childNodes = styleElement.childNodes;
			if (childNodes[index]) styleElement.removeChild(childNodes[index]);
			if (childNodes.length) {
				styleElement.insertBefore(cssNode, childNodes[index]);
			} else {
				styleElement.appendChild(cssNode);
			}
		}
	}
	
	function applyToTag(styleElement, obj) {
		var css = obj.css;
		var media = obj.media;
	
		if(media) {
			styleElement.setAttribute("media", media)
		}
	
		if(styleElement.styleSheet) {
			styleElement.styleSheet.cssText = css;
		} else {
			while(styleElement.firstChild) {
				styleElement.removeChild(styleElement.firstChild);
			}
			styleElement.appendChild(document.createTextNode(css));
		}
	}
	
	function updateLink(linkElement, obj) {
		var css = obj.css;
		var sourceMap = obj.sourceMap;
	
		if(sourceMap) {
			// http://stackoverflow.com/a/26603875
			css += "\n/*# sourceMappingURL=data:application/json;base64," + btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))) + " */";
		}
	
		var blob = new Blob([css], { type: "text/css" });
	
		var oldSrc = linkElement.href;
	
		linkElement.href = URL.createObjectURL(blob);
	
		if(oldSrc)
			URL.revokeObjectURL(oldSrc);
	}


/***/ },

/***/ 24:
/***/ function(module, exports) {

	module.exports = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQEAQAAADlauupAAAACXBIWXMAADdcAAA3XAHLx6S5AAAACXZwQWcAAAAQAAAAEABcxq3DAAAAAmJLR0T//xSrMc0AAAMkSURBVBgZ1cH9T5QFAAfw73NwB3fPnfd+z73x3D0Qd/EScrKDndLpKFvoIQpkuamx3Fpi+LJGBas1dDJWi1WTiFkMrIGhueUL07VqCgtq9IM2qmm5RdFQ8mCxc3dn8O1+6Y/o8wH+/7xHAD+gkwsAaZ+wLbyYtaN6fZYcvaNq3TIONEageUkLHFwLue0Qht/qhLF7CDh2C0LXLmT0Q8AIgE+gCHtwWDDiPxHVm2h2VgFKED8UfKoq3LYOeKRO9VTlSZysugaEj0MDZxpwBQRRHwZ0nXJ5tP/d1bq+0Wcea63t31wBPBERmgGcHk8Kxec6tF0kNuZPCb4nH4arJACABJpSwvWmJSC/7FKg7G3SN8F+uSKRba701xsuA9rzuZNFtvfi66eXGqJn3vnbPZ59waQA4U7sQUY9MkjAd+vGUdckaVtMjeWNkOauyG/eQUBpGEo/FCU9OenPHG1kYc+xHuUE4JdU88hQHr2LRGQWMA5NlVp3kN7alemCdjL3YlF7wemcXv/2BXVeC2ns/sciVZD5t2cn5EFdQpkHILUC1kJV3OwDRNdHv1qWSN8m0ts4Xw9oG72bfAnvQuoN8zhpnFqdlutIuSYed0esAx4RgF4WOnQH1WWaS4D6r6afLdWkZ5i0tZwNFe4H8s+Lz9qTPx3Vm0nr6w+mPVbSc2C43lYKOJdVRciYI+FUdllf0HDghulL0j5HOmdvBopbwq8iw7g1eFyvvbPbKpLu3mvflHRlTVZKgO6qqgbiSKDUlD5Lw/1EUJ8mHXNc69zNw+4N/NY3xva83O88DvvHkmE4edusJr0fLo2WaE58EAhtGKh+RbAg2z8TyjGS4uLqFdvvPOK5S+aNka4LjImDbDa9SDokpl1Pk/Io6a3jsvNzvma7Ser3jnwNYGFZHUqsW7N4f7P9x+RG9y/JGW881edYTr9s+CJ9zykm55SZZCqYWrleNLF6KphY2an8kdoptT04YLDf2w9hu9Kd01MsiL3lew1/Vj235mq03NDxeIOYrG3Sfh+7mKuPzesPxU6ZVmJf2ffVuqXna/qkM9V6+/uhcxaDNfkvFyNEYtfdliYAAAAielRYdFNvZnR3YXJlAAB42isvL9fLzMsuTk4sSNXLL0oHADbYBlgQU8pcAAAAAElFTkSuQmCC"

/***/ },

/***/ 40:
/***/ function(module, exports) {

	module.exports = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAA3NCSVQICAjb4U/gAAAACXBIWXMAAAG7AAABuwE67OPiAAAAGXRFWHRTb2Z0d2FyZQB3d3cuaW5rc2NhcGUub3Jnm+48GgAAAPZQTFRF////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAICAgCwsLNzc3JSUlUFBQXFxcX19fYmJiZGRkMjIyNTU1OTk5PDw8Pj4+QkJCSUlJSkpKT09PUFBQUVJSUlJSVVVVVlZWV1dXWFhYWVlZWlpaWltbW1tbXFxcXV1dXl5eYmJiaWlpampqbm5ub29vcHBwfHx8fn5+hISElJSUl5eXnKvCnZ2do7DCpqamrKysra2trq6urrnLs7OztbW1tra2t7e3u7u7v7+/wcHBwsLBx8fG0tfc3Nzb3Nzc39/e5O35+Pj3+fn5+vr5+/v6/Pz8/f39/v7+Basv9AAAABN0Uk5TAAQeHyA4VldYWVlebHa74u76+iNNcakAAAClSURBVBgZBcFBSsNQFADAyf8vqVW0EUEQXLnzKnreHkVdKqWFCgoBSdtFmudM1AI5AUS8wLoFZBTwCrAOBgD0NdAPPUOPgUgAIAO/w9vDqn7/TPdLAu3OtrvcjcZnAk2hHI9F/t2KTGOlPRXkLMzuNllvmquD6+WcYTYtpsUUTx8ecxbOw6F0+dUew+eqE7E914q8mDltumiyAPaZmecY3xsAZP4DEx9EQYc4WAAAAAAASUVORK5CYII="

/***/ },

/***/ 53:
/***/ function(module, exports) {

	module.exports = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAABuwAAAbsBOuzj4gAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAGaSURBVHjahVO7SgNBFL2zG7vgF4hgIxamSBpNDBKtfeULhKgfEIhgb5PKQmtBxA9QEO3EQBBEkSRYmFgoPtCoAQ3LxjXZXO9OdneGHcEDh73M3HPuYxmGiMAYCwNABHpg8D+QWCNtI+QeDNXrb0UE1AhAdEwFgeDGBP6dSqXSFO6HhCXy2/LtMzcQIsHo8IDbovh4BlzkYO/4sid0K3nIzMVB03XlXDFYnBnjscaY0kGFunMQHRlUDHzB7tGFqOLNL1VdXpgAXdNUA+YuLjM7zmMtUF2Y/D2CL9g5PFcSV9JJiFHbklA1oEteeWk+wWN3JzyWGYQYJtC2Azm+unnglM7wzxG2D86kJHWBnU4HWq0WGIbxLRv4m6ckMYJk0Gh8wPvLI1z/fMJJoVCpVqunyg5AdCCL+V7CmgXx6SRsbG7dr2azk4jIO/AeU8Q0zTJVZaXak7IHy7JAp8qFYvFuLZdLkOYVPDgGhFHDNNuUiO12m5NmRdu2sdvt4leziev5fIny+p18iX4HfXQZk/4KCzxdm1imXAsC+AUk36cMR6ScZQAAAABJRU5ErkJggg=="

/***/ },

/***/ 64:
/***/ function(module, exports) {

	module.exports = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAbsAAAG7AEedTg1AAAAB3RJTUUH2AEDDSAeej84LgAAAgBJREFUOMt1kkFLVFEUx3/n+pyyhcGA0iJzIZHLWliLKWptRdAqoq+RrSIKWkSLaO1HiDRIKMFFgYk0VCa6TByFwdFMwvF53733vdNinOeMTgcuF8655/f/n8MVOkS5XF5P0/RslmWo6nqpVDrHf0IAfk1zZzfhkgK7hcfXY0o3Qgg45wghEPkvnwd7Xn8ygLMsXLnPuzZAtnY5/PF9XfU9MCdvY07dalP5uzlFt39P8TScyLayjdWv0flRFMAAiC131ZMRzlyYoLf/Hs45rLX56e27yeDFCep+BLFlE0lDGCACIFVACd7TXShQLBapVCqINN7FcczOzg6bK1v8dsq1BwwDGbACgC6hq8tPNI5jtdbq4uKihhDUJokmSaLOOXXeq/deQwgaQtAsyxQYPnDQ8GKMwRiDiJCmKWkIiEieQwRVbdtPDpCI3LKI5I15c3PrB7Vm7hCg2lZsVW4Ft4LaAEcVOql1Ah064PgIeuDqKLixh1YHGR0VOgG991hr2bOJA3wDoCDKsfmO3vv7+1SrVUREJycnngKrOYD6DNUlA8DG2jZDQ6/amr331Go1oihievrj87GxRy+ANFJVWRgX5wtzBZgDhe0aMHockCSW2TcP3dsPy8+aq49ERFW1p/Vz3B0YKPZfnX9pjOlu5vas4+f3b3OzPwrjM/MV38z/AxWwCsD6PWYAAAAAAElFTkSuQmCC"

/***/ },

/***/ 66:
/***/ function(module, exports) {

	module.exports = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAABuwAAAbsBOuzj4gAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAM0SURBVDiNXZJNT2NlAIWf9963t/R7sFCgWD6cMsKYgZBROsEVgZXLiRu3szJRtyz5BZD4B1iYgIm6d9GYgFNDWiITAkHRgaFloBTolPaWft3L7esGyMSzPnkWzzlCKcX/I4SQQA8wHI1GH8/Ozj6bmJgYLRQK1uLi4pdbW1v1paWl7tXV1ZwANKDvtjw2Nzf3bHx8fDSRSMRjsVjY4/Hod+BarWaPjY19EYlEvu/r6+vK5XJvJPB0ZWVlZXp6+qFhGLpt2wghkFKi6zpC06g0FO+uHUZ6P3B1dnaOLCwsPIpGo67t7W2PBApDQ0MR21H6fu6aj6MeynUo1m4AhZSKcMBguLcDn9cgFos9np+fP3z+/Pno8vJyTgPO0+n0/rnpsJO3Obh0kNLFpx8FSTwKMRjx0nQ0Di5uMBuKycnJT4QQuN1uAKEppax0Or07EDYYDLsJ+lxc1hQ7eYu/8ha6dDE5HODJgB9N15mZmRl1u926pmlwK5BkMpmu30jMpiLsd/PZwyCDXT6kS+fsymbr6JrsZQuNNvF4vLu/v98dCAQUICSAaZqvO3Sn7Taktv22SU9V8WHYR7zHy1XN4bzcpFKzaDQtAn6/jMViHVdXV21AaLcLHV1eFCrj/V6ctkDXJQXT4rjYwmsong77mBz00B2UVOs2fr+/4+zszHkfcJFKpfZDAYOQR5KIB3kSCyB1OCg0yByYbGevadk3iLaNUspVLBadewdKKWtjY2NXSp3cuxabb6rkik0iQRcDYQNdA9tR5EstCuUWx8fHeqlUsqWu6eLuyqFQ6EXubX75150KQ10eFKBUmy6/Tm/IRdO64fiyRbXRwD55qSLerPjl5x/+lnc3NU3zdbNRb/d3urXBiAenrTgp1jkr25yWWngNjegDScSj+CmZtRvFtPFbpvr1PQA4Oj05Nm3XwIM/9sskRoKMD/iQGrTbbQCq1ar9595eIZ15lX25/vtIqVxLvQ84X1tb2/vm2+8+d5SGx9BUsVi0d3d3C6lUKpfJZP5JJpObSqlD4ADIK6XUPUApZU9NTWUqlYqzubn57/r6+ivLsg6BLHAK1O58CSG+AkaEED/+B980fqkR43MoAAAAAElFTkSuQmCC"

/***/ },

/***/ 111:
/***/ function(module, exports) {

	/*
	 * Tine 2.0
	 * 
	 * @package     Sales
	 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
	 * @author      Alexander Stintzing <a.stintzing@metaways.de>
	 * @copyright   Copyright (c) 2013-2014 Metaways Infosystems GmbH (http://www.metaways.de)
	 *
	 */
	 
	Ext.namespace('Tine.Sales');
	
	/**
	 * Division edit dialog
	 * 
	 * @namespace   Tine.Sales
	 * @class       Tine.Sales.DivisionEditDialog
	 * @extends     Tine.widgets.dialog.EditDialog
	 * 
	 * <p>Division Edit Dialog</p>
	 * <p><pre>
	 * </pre></p>
	 * 
	 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
	 * @author      Alexander Stintzing <a.stintzing@metaways.de>
	 * @copyright   Copyright (c) 2013-2014 Metaways Infosystems GmbH (http://www.metaways.de)
	 * 
	 * @param       {Object} config
	 * @constructor
	 * Create a new Tine.Sales.DivisionGridPanel
	 */
	Tine.Sales.DivisionEditDialog = Ext.extend(Tine.widgets.dialog.EditDialog, {
	    
	    windowWidth: 650,
	    windowHeight: 450,
	    
	    /**
	     * called on multiple edit
	     * @return {Boolean}
	     */
	    isMultipleValid: function() {
	        return true;
	    },
	    
	    /**
	     * @see: Tine.widgets.dialog.EditDialog.onRecordLoad
	     */
	    onRecordLoad: function() {
	        Tine.Sales.DivisionEditDialog.superclass.onRecordLoad.call(this);
	        
	        if (! this.copyRecord && ! this.record.id) {
	            this.window.setTitle(this.app.i18n._('Add New Division'));
	        }
	    },
	    
	    /**
	     * returns dialog
	     * 
	     * NOTE: when this method gets called, all initalisation is done.
	     */
	    getFormItems: function() {
	        return {
	            xtype: 'tabpanel',
	            border: false,
	            plain:true,
	            activeTab: 0,
	            border: false,
	            defaults: {
	                hideMode: 'offsets'
	            },
	            plugins: [{
	                ptype : 'ux.tabpanelkeyplugin'
	            }],
	            items:[
	                {
	                title: this.app.i18n.n_('Division', 'Divisions', 1),
	                autoScroll: true,
	                border: false,
	                frame: true,
	                layout: 'border',
	                items: [{
	                    region: 'center',
	                    xtype: 'columnform',
	                    labelAlign: 'top',
	                    formDefaults: {
	                        xtype:'textfield',
	                        anchor: '100%',
	                        labelSeparator: '',
	                        columnWidth: 1
	                    },
	                    items: [[{
	                        fieldLabel: this.app.i18n._('Title'),
	                        name: 'title',
	                        allowBlank: false
	                    }]
	                    ]
	                }]
	            }, new Tine.widgets.activities.ActivitiesTabPanel({
	                app: this.appName,
	                record_id: this.record.id,
	                record_model: 'Sales_Model_Division'
	            })]
	        };
	    }
	});


/***/ },

/***/ 137:
/***/ function(module, exports) {

	module.exports = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAABuwAAAbsBOuzj4gAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAMTSURBVDiNdZNNSGNnFIaf77s3P5ZMJvEmRu20EUaoFaGMhUqn7a7arorQzchssqjL2allpNBd7aIFFxKKtItS2oKLgF1ZulVw4UYlgwSNtdZMnDi56r3G/Nzc08WouOkLZ/fycM57zkFEuF1XUkAA6Mhms/0bGxuPi8Xid6Ojo3dFhPHx8c5oNPpHV1fXl6ZSKjQ/P39/ZGTkA8uy3j06OnorGAy+YZpmUikV8X1fAyilmJyc/Av403GcH6empkYXFxcNc319/Wk6nf5aKYWPoukJvidUTy+51xlGa4VSCoChoaGPE4nEnXq93r+/v78xNjb2jbm7u/usr6+PjX2XvmSY7lgYrTXVizY+YCiF1hqtNa7rPmy1Wu9HIpFmsVj8YW9vb03ncrm8aZqEggbCK7NSCkMrTmttqjUf0zTRWjM3N/cglUrdF5FnIvIrgM7lchWtdTsSMqheeCilOHFbBEyD7vhraMPANE2y2SyVSiXseV4xkUg8uU5bAw3Ate4EeH7WRClFd6yDehvyRy4dwSDb29ssLy/T09OjLMv6JZ/Pn10DTKDhed6pFQneLdlNtNb4KFpt8DFoNC6ZefoVgWCQ4eFhJiYmNLekgVatVnuhtabWbN8E9k46znv9nfyU/Z6zaoXXe3uZnp5mcHDwI3W9liuAb9v2PwDJaIh/7QahgIlhaC4vXD779CGffNjL7OwshmGQTCbfvur8FUBE5PDwsKCU4kFflMLzGuWrLH7/7WeKO2t88eRbBgYG8H2fSCRyD+i4mUFEmJmZefTipCpV+1QajYb4vi8iIo8ffS6l0qGIiDSbTVlYWJB6ve4Bb96cvoiQTqeHHceRtbU1KRQKcn5+LuVyWfL5vBwfH8vW1pacnLyUw6OS1JueZDKZsWuACXBwcFAFWpZlBRzHwbIsYrEYqVQKgGjMotkWCXT4ruu6lXg83nXzdSKCUsqybbsQDoc7A4GA1263bcdxyqVS6WBzc3NndXV1Z2lpqWDb9gnwEjgVkeZtQCiTyWTK5fLZysrK31cmG7gAGiLi8z/6DzjVja3IC6wJAAAAAElFTkSuQmCC"

/***/ },

/***/ 426:
/***/ function(module, exports) {

	/*
	 * Tine 2.0
	 * 
	 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
	 * @author      Alexander Stintzing <a.stintzing@metaways.de>
	 * @copyright   Copyright (c) 2013 Metaways Infosystems GmbH (http://www.metaways.de)
	 */
	Ext.ns('Tine.Sales');
	
	/**
	 * @namespace   Tine.Sales
	 * @class       Tine.Sales.AddressEditDialog
	 * @extends     Tine.widgets.dialog.EditDialog
	 * 
	 * <p>Address Compose Dialog</p>
	 * <p></p>
	 * 
	 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
	 * @author      Alexander Stintzing <a.stintzing@metaways.de>
	 * 
	 * @param       {Object} config
	 * @constructor
	 * Create a new Tine.Sales.AddressEditDialog
	 */
	Tine.Sales.AddressEditDialog = Ext.extend(Tine.widgets.dialog.EditDialog, {
	    
	    /**
	     * @private
	     */
	    tbarItems: null,
	    evalGrants: false,
	    
	    windowWidth: 700,
	    windowHeight: 400,
	
	    displayNotes: true,
	    
	    /**
	     * just update the contract grid panel, no persisten
	     * 
	     * @type String
	     */
	    mode: 'local',
	    loadRecord: false,
	    
	    initComponent: function() {
	        if (Ext.isString(this.additionalConfig)) {
	            Ext.apply(this, Ext.decode(this.additionalConfig));
	        }
	        
	        Tine.Sales.AddressEditDialog.superclass.initComponent.call(this);
	
	        // code expect fixedFields to be present
	        if (! this.fixedFields) {
	            this.fixedFields = new Ext.util.MixedCollection();
	        }
	    },
	
	    /**
	     * returns canonical path part
	     * @returns {string}
	     */
	    getCanonicalPathSegment: function () {
	        return [
	            this.supr().getCanonicalPathSegment.call(this),
	            Ext.util.Format.capitalize(this.addressType)
	        ].join(Tine.Tinebase.CanonicalPath.separator);
	    },
	
	    /**
	     * executed after record got updated from proxy
	     * 
	     * @private
	     */
	    onRecordLoad: function() {
	        // interrupt process flow until dialog is rendered
	        if (! this.rendered) {
	            this.onRecordLoad.defer(250, this);
	            return;
	        }
	        
	        if (Ext.isString(this.record)) {
	            this.record = this.recordProxy.recordReader({responseText: this.record});
	        }
	        
	        this.record.set('customer_id', this.fixedFields.get('customer_id'));
	        this.record.set('type',        String(this.fixedFields.get('type')).toLowerCase());
	        
	        Tine.Sales.AddressEditDialog.superclass.onRecordLoad.call(this);
	        
	        if (String(this.fixedFields.get('type')).toLowerCase() == 'billing') {
	            this.i18nRecordName = this.app.i18n._('Billing Address');
	            this.i18nRecordsName = this.app.i18n._('Billing Addresses');
	        } else {
	            this.i18nRecordName = this.app.i18n._('Delivery Address');
	            this.i18nRecordsName = this.app.i18n._('Delivery Addresses');
	        }
	        
	        if ((! this.copyRecord) && this.record.id) {
	            var c = this.record.get('customer_id');
	            var l = this.record.get('locality') ? ' (' + this.record.get('locality') + ')' : '';
	            this.window.setTitle(String.format(i18n._('Edit {0} "{1}"'), this.i18nRecordName, c.name + l));
	        } else if (! this.record.id) {
	            if (String(this.fixedFields.get('type')).toLowerCase() == 'billing') {
	                this.window.setTitle(this.app.i18n._('Add new Billing Address'));
	            } else {
	                this.window.setTitle(this.app.i18n._('Add new Delivery Address'));
	            }
	        }
	    },
	    
	    /**
	     * executed when record gets updated from form
	     * 
	     * @private
	     */
	    onRecordUpdate: function() {
	        Tine.Sales.AddressEditDialog.superclass.onRecordUpdate.call(this);
	        
	        this.record.set('type',        String(this.fixedFields.get('type')).toLowerCase());
	        this.record.set('customer_id', this.fixedFields.get('customer_id'));
	    },
	    
	    /**
	     * returns dialog
	     * 
	     * NOTE: when this method gets called, all initalisation is done.
	     * 
	     * @return {Object}
	     * @private
	     */
	    getFormItems: function() {
	        var formFieldDefaults = {
	            xtype:'textfield',
	            anchor: '100%',
	            labelSeparator: '',
	            columnWidth: 1/2
	        };
	        
	        
	        var items = [
	            [{
	               columnWidth: .045,
	               xtype:'button',
	               iconCls: 'applyContactData',
	               tooltip: Ext.util.Format.htmlEncode(this.app.i18n._('Apply postal address')),
	               fieldLabel: '&nbsp;',
	               lazyLoading: false,
	               listeners: {
	                    scope: this,
	                    click: function() {
	                        Ext.iterate(this.fixedFields.get('parentRecord'), function(property, value) {
	                            var split = property.split(/_/);
	                            if (split[0] == 'adr') {
	                                if (value) {
	                                    this.getForm().findField(split[1]).setValue(value);
	                                }
	                            }
	                        }, this);
	                    }
	               }
	            }, {
	                columnWidth: 0.455,
	                name: 'street',
	                fieldLabel: this.app.i18n._('Street')
	            }, {
	                name: 'pobox',
	                fieldLabel: this.app.i18n._('Postbox')
	            }], [{
	                name: 'postalcode',
	                fieldLabel: this.app.i18n._('Postalcode')
	            }, {
	                name: 'locality',
	                fieldLabel: this.app.i18n._('Locality')
	            }], [{
	                name: 'region',
	                fieldLabel: this.app.i18n._('Region')
	            }, {
	                xtype: 'widget-countrycombo',
	                name: 'countryname',
	                fieldLabel: this.app.i18n._('Country')
	            }], [{
	                name: 'prefix1',
	                fieldLabel: this.app.i18n._('Prefix')
	            }, {
	                name: 'prefix2',
	                fieldLabel: this.app.i18n._('Additional Prefix')
	            }]
	        ];
	        
	        if (this.addressType == 'billing') {
	            items.push([{
	                name: 'custom1',
	                fieldLabel: this.app.i18n._('Number Debit')
	            }]);
	        }
	        
	        return {
	            xtype: 'tabpanel',
	            defaults: {
	                hideMode: 'offsets'
	            },
	            border: false,
	            plain: true,
	            activeTab: 0,
	            items: [{
	                title: this.app.i18n._('Address'),
	                autoScroll: true,
	                border: false,
	                frame: true,
	                layout: 'border',
	                items: [{
	                    xtype: 'fieldset',
	                    layout: 'hfit',
	                    region: 'center',
	                    autoHeight: true,
	                    title: this.app.i18n._('Address'),
	                    items: [{
	                        xtype: 'columnform',
	                        labelAlign: 'top',
	                        formDefaults: formFieldDefaults,
	                        items: items
	                    }]
	                }]
	            }]
	        };
	    }
	});


/***/ },

/***/ 427:
/***/ function(module, exports) {

	/*
	 * Tine 2.0
	 * 
	 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
	 * @author      Alexander Stintzing <a.stintzing@metaways.de>
	 * @copyright   Copyright (c) 2013-2015 Metaways Infosystems GmbH (http://www.metaways.de)
	 */
	Ext.ns('Tine.Sales');
	
	/**
	 * Address grid panel
	 * 
	 * @namespace   Tine.Sales
	 * @class       Tine.Sales.AddressGridPanel
	 * @extends     Tine.widgets.grid.BbarGridPanel
	 * 
	 * <p>Address Grid Panel</p>
	 * <p><pre>
	 * </pre></p>
	 * 
	 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
	 * @author      Alexander Stintzing <a.stintzing@metaways.de>    
	 * 
	 * @param       {Object} config
	 * @constructor
	 * Create a new Tine.Sales.AddressGridPanel
	 */
	Tine.Sales.AddressGridPanel = Ext.extend(Tine.widgets.grid.BbarGridPanel, {
	    
	    /**
	     * holds the type of the address currently handled, autoset by editDialog
	     * 
	     * @type {String}
	     */
	    addressType: null,
	
	    defaultSortInfo: {field: 'countryname', direction: 'ASC'},
	    
	    /**
	     * inits this cmp
	     * 
	     * @private
	     */
	    initComponent: function() {
	        this.clipboardAction = new Ext.ux.grid.ActionColumnPlugin({
	            header: this.app.i18n._('Clipboard'),
	            keepSelection: false,
	            actions: [{
	                iconIndex: 'copy_clipboard',
	                iconCls: 'clipboard',
	                tooltip: this.app.i18n._('Copy address to the clipboard'),
	                callback: this.onCopyToClipboard,
	                name: 'clipboard'
	            }]
	        });
	        
	        this.plugins = Ext.isArray(this.plugins) ? this.plugins.push(this.clipboardAction) : [this.clipboardAction];
	        
	        Tine.Sales.AddressGridPanel.superclass.initComponent.call(this);
	    },
	
	    /**
	     * returns canonical path part
	     * @returns {string}
	     */
	    getCanonicalPathSegment: function () {
	        var pathSegment = '';
	        if (this.canonicalName) {
	            // simple segment e.g. when used in a dialog
	            pathSegment = this.canonicalName;
	        } else if (this.recordClass) {
	            // auto segment
	            pathSegment = [this.recordClass.getMeta('modelName'), Ext.util.Format.capitalize(this.addressType), 'Grid'].join(Tine.Tinebase.CanonicalPath.separator);
	        }
	
	        return pathSegment;
	    },
	
	    /**
	     * called from this.clipboardAction
	     * 
	     * @param {Number} rowIndex
	     */
	    onCopyToClipboard: function(rowIndex) {
	        var record = this.store.getAt(rowIndex);
	        var companyName = this.editDialog.record.get('name');
	        Tine.Sales.addToClipboard(record, companyName);
	    },
	
	    /**
	     * overwrites and calls superclass
	     * 
	     * @param {Object} button
	     * @param {Tine.Tinebase.data.Record} record
	     * @param {Array} plugins
	     */
	    onEditInNewWindow: function(button, record, plugins) {
	        // the name 'button' should be changed as this can be called in other ways also
	        button.fixedFields = {
	            'customer_id':  this.editDialog.record.data,
	            'type':         this.addressType,
	            'parentRecord': this.editDialog.record.data
	        };
	        
	        var additionalConfig = {addressType: this.addressType};
	        
	        Tine.Sales.AddressGridPanel.superclass.onEditInNewWindow.call(this, button, record, plugins, additionalConfig);
	    },
	    
	    
	    /**
	     * template method to allow adding custom columns
	     * 
	     * @return {Array}
	     */
	    getCustomColumns: function() {
	        return [ this.clipboardAction ];
	    }
	});


/***/ },

/***/ 428:
/***/ function(module, exports) {

	/*
	 * Tine 2.0
	 * Sales combo box and store
	 * 
	 * @package     Sales
	 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
	 * @author      Alexander Stintzing <a.stintzing@metaways.de>
	 * @copyright   Copyright (c) 2013 Metaways Infosystems GmbH (http://www.metaways.de)
	 *
	 */
	
	Ext.ns('Tine.Sales');
	
	/**
	 * Address selection combo box
	 * 
	 * @namespace   Tine.Sales
	 * @class       Tine.Sales.AddressSearchCombo
	 * @extends     Ext.form.ComboBox
	 * 
	 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
	 * @author      Alexander Stintzing <a.stintzing@metaways.de>
	 * @copyright   Copyright (c) 2013 Metaways Infosystems GmbH (http://www.metaways.de)
	 * 
	 * @param       {Object} config
	 * @constructor
	 * Create a new Tine.Sales.AddressSearchCombo
	 */
	Tine.Sales.AddressSearchCombo = Ext.extend(Tine.Tinebase.widgets.form.RecordPickerComboBox, {
	    
	    allowBlank: false,
	    itemSelector: 'div.search-item',
	    minListWidth: 200,
	    sortBy: 'locality',
	    
	    //private
	    initComponent: function(){
	        this.recordClass = Tine.Sales.Model.Address;
	        this.recordProxy = Tine.Sales.addressBackend;
	        this.initTemplate();
	        Tine.Sales.AddressSearchCombo.superclass.initComponent.call(this);
	    },
	    
	    /**
	     * init template
	     * @private
	     */
	    initTemplate: function() {
	        if (! this.tpl) {
	            this.tpl = new Ext.XTemplate(
	                '<tpl for="."><div class="search-item">',
	                    '<table cellspacing="0" cellpadding="2" border="0" style="font-size: 11px;" width="100%">',
	                        '<tr>',
	                            '<td style="height:16px">{[this.encode(values)]}</td>',
	                        '</tr>',
	                    '</table>',
	                '</div></tpl>',
	                {
	                    encode: function(values) { return Ext.util.Format.htmlEncode(values.fulltext) }
	                }
	            );
	        }
	    }
	});
	
	Tine.widgets.form.RecordPickerManager.register('Sales', 'Address', Tine.Sales.AddressSearchCombo);


/***/ },

/***/ 429:
/***/ function(module, exports) {

	/*
	 * Tine 2.0
	 * 
	 * @package     Sales
	 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
	 * @author      Alexander Stintzing <a.stintzing@metaways.de>
	 * @copyright   Copyright (c) 2009-2015 Metaways Infosystems GmbH (http://www.metaways.de)
	 *
	 */
	
	Ext.ns('Tine.Sales');
	
	/**
	 * @namespace   Tine.Sales
	 * @class       Tine.Sales.AdminPanel
	 * @extends     Ext.FormPanel
	 * @author      Alexander Stintzing <alex@stintzing.net>
	 */
	Tine.Sales.AdminPanel = Ext.extend(Ext.FormPanel, {
	    appName : 'Sales',
	
	    layout : 'fit',
	    border : false,
	    cls : 'tw-editdialog',
	
	    labelAlign : 'top',
	
	    anchor : '100% 100%',
	    deferredRender : false,
	    buttonAlign : null,
	    bufferResize : 500,
	
	    /**
	     * init component
	     */
	    initComponent: function() {
	
	        if (!this.app) {
	            this.app = Tine.Tinebase.appMgr.get(this.appName);
	        }
	
	        Tine.log.debug('initComponent: appName: ', this.appName);
	        Tine.log.debug('initComponent: app: ', this.app);
	
	        // init actions
	        this.initActions();
	        // init buttons and tbar
	        this.initButtons();
	
	        // get items for this dialog
	        this.items = this.getFormItems();
	        
	        Tine.Sales.AdminPanel.superclass.initComponent.call(this);
	    },
	
	    /**
	     * init actions
	     */
	    initActions: function() {
	        this.action_cancel = new Ext.Action({
	            text : this.app.i18n._('Cancel'),
	            minWidth : 70,
	            scope : this,
	            handler : this.onCancel,
	            iconCls : 'action_cancel'
	        });
	
	        this.action_update = new Ext.Action({
	            text : this.app.i18n._('OK'),
	            minWidth : 70,
	            scope : this,
	            handler : this.onUpdate,
	            iconCls : 'action_saveAndClose'
	        });
	    },
	
	    /**
	     * init buttons
	     */
	    initButtons : function() {
	        this.fbar = [ '->', this.action_cancel, this.action_update ];
	    },  
	
	    /**
	     * is called when the component is rendered
	     * @param {} ct
	     * @param {} position
	     */
	    onRender : function(ct, position) {
	        this.loadMask = new Ext.LoadMask(ct, {msg: i18n._('Loading...')});
	        Tine.Sales.AdminPanel.superclass.onRender.call(this, ct, position);
	
	        // generalized keybord map for edit dlgs
	        var map = new Ext.KeyMap(this.el, [ {
	            key : [ 10, 13 ], // ctrl + return
	            ctrl : true,
	            fn : this.onUpdate,
	            scope : this
	        } ]);
	
	    },
	    
	    /**
	     * closes the window
	     */
	    onCancel: function() {
	        this.fireEvent('cancel');
	        this.purgeListeners();
	        this.window.close();
	    },
	
	    /**
	     * save record and close window
	     */
	    onUpdate : function() {
	        Ext.Ajax.request({
	            url: 'index.php',
	            scope: this,
	            params: {
	                method: 'Sales.setConfig',
	                config: this.getForm().getFieldValues(),
	            },
	            success : function(_result, _request) {
	                this.loadMask.hide();
	                // reload mainscreen to make sure registry gets updated
	                window.location = window.location.href.replace(/#+.*/, '');
	            },
	            failure: function(result) {
	                Tine.Tinebase.ExceptionHandler.handleRequestException(result)
	            }
	        });
	    },
	
	    /**
	     * create and return form items
	     * @return Object
	     */
	    getFormItems: function() {
	        var config = Tine.Sales.registry.get('config');
	
	        var currency = [
	            ['EUR', this.app.i18n._('Euro (€)')]
	        ];
	
	        var currencyStore = new Ext.data.ArrayStore({
	            fields: [
	                'currency_id',
	                'currency'
	            ],
	            data: currency,
	            disabled: false
	        });
	
	
	        return {
	            border: false,
	            frame : false,
	            layout: 'border',
	
	            items: [{
	                region: 'center',
	                border: false,
	                frame : false,
	                
	                xtype       : 'columnform',
	                labelAlign  : 'top',
	                formDefaults: {
	                    xtype         :'textfield',
	                    anchor        : '100%',
	                    labelSeparator: '',
	                    columnWidth   : 1/3
	                },
	                items: [
	                    [
	                        {
	                            fieldLabel: this.app.i18n._(config.ownCurrency.definition.label),
	                            name      : 'ownCurrency',
	                            value     : config.ownCurrency.value ? config.ownCurrency.value : config.ownCurrency['default'],
	                            xtype     : 'combo',
	                            mode      : 'local',
	                            scope     : this,
	                            valueField: 'currency_id',
	                            displayField: 'currency',
	                            store     : currencyStore
	                        }
	                    ], [
	                        {
	                            fieldLabel: this.app.i18n._(config.contractNumberGeneration.definition.label),
	                            name      : 'contractNumberGeneration',
	                            value     : config.contractNumberGeneration.value ? config.contractNumberGeneration.value : config.contractNumberGeneration['default'],
	                            xtype     : 'combo',
	                            mode      : 'local',
	                            forceSelection: true,
	                            triggerAction: 'all',
	                            store     : config.contractNumberGeneration.definition.options
	                        }, {
	                            fieldLabel: this.app.i18n._(config.contractNumberValidation.definition.label),
	                            name      : 'contractNumberValidation',
	                            value     : config.contractNumberValidation.value ? config.contractNumberValidation.value : config.contractNumberValidation['default'],
	                            xtype     : 'combo',
	                            mode      : 'local',
	                            forceSelection: true,
	                            triggerAction: 'all',
	                            store     : config.contractNumberValidation.definition.options
	                        }
	                    ], [
	                        {
	                            fieldLabel: this.app.i18n._(config.productNumberGeneration.definition.label),
	                            name      : 'productNumberGeneration',
	                            value     : config.productNumberGeneration.value ? config.productNumberGeneration.value : config.productNumberGeneration['default'],
	                            xtype     : 'combo',
	                            mode      : 'local',
	                            forceSelection: true,
	                            triggerAction: 'all',
	                            store     : config.productNumberGeneration.definition.options
	                        }, {
	                            fieldLabel: this.app.i18n._(config.productNumberValidation.definition.label),
	                            name      : 'productNumberValidation',
	                            value     : config.productNumberValidation.value ? config.productNumberValidation.value : config.productNumberValidation['default'],
	                            xtype     : 'combo',
	                            mode      : 'local',
	                            forceSelection: true,
	                            triggerAction: 'all',
	                            store     : config.productNumberValidation.definition.options
	                        }
	                    ], [
	                        {
	                            fieldLabel: this.app.i18n._(config.productNumberPrefix.definition.label),
	                            name      : 'productNumberPrefix',
	                            value     : config.productNumberPrefix.value ? config.productNumberPrefix.value : config.productNumberPrefix['default'],
	                        }, {
	                            fieldLabel: this.app.i18n._(config.productNumberZeroFill.definition.label),
	                            name      : 'productNumberZeroFill',
	                            value     : config.productNumberZeroFill.value ? config.productNumberZeroFill.value : config.productNumberZeroFill['default'],
	                            xtype     : 'uxspinner',
	                            decimalPrecision: 0,
	                            strategy  : new Ext.ux.form.Spinner.NumberStrategy({
	                                incrementValue: 1,
	                                alternateIncrementValue: 10,
	                                minValue      : 0,
	                                maxValue      : 100,
	                                allowDecimals : 0
	                            })
	                        }
	                    ]
	                ]
	            }]
	        };
	    } 
	});
	
	Tine.Sales.AdminPanel.openWindow = function(config) {
	    var window = Tine.WindowFactory.getWindow({
	        modal  : true,
	        width  : 500,
	        height : 250,
	        contentPanelConstructor : 'Tine.Sales.AdminPanel',
	        contentPanelConstructorConfig : config
	    });
	    return window;
	};

/***/ },

/***/ 430:
/***/ function(module, exports) {

	/*
	 * Tine 2.0
	 * 
	 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
	 * @author      Alexander Stintzing <a.stintzing@metaways.de>
	 * @copyright   Copyright (c) 2013 Metaways Infosystems GmbH (http://www.metaways.de)
	 */
	Ext.ns('Tine.Sales');
	
	/**
	 * Address grid panel
	 * 
	 * @namespace   Tine.Sales
	 * @class       Tine.Sales.BillingAddressGridPanel
	 * @extends     Tine.Sales.AddressGridPanel
	 * 
	 * <p>Billing Address Grid Panel</p>
	 * <p><pre>
	 * </pre></p>
	 * 
	 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
	 * @author      Alexander Stintzing <a.stintzing@metaways.de>    
	 * 
	 * @param       {Object} config
	 * @constructor
	 * 
	 * Create a new Tine.Sales.BillingAddressGridPanel
	 */
	Tine.Sales.BillingAddressGridPanel = Ext.extend(Tine.Sales.AddressGridPanel, {
	    /**
	     * inits this cmp
	     * 
	     * @private
	     */
	    initComponent: function() {
	        this.addressType = 'billing';
	        
	        // TODO use singular/plural translations here
	        this.i18nRecordName  = this.app.i18n._('Billing Address');
	        this.i18nRecordsName = this.app.i18n._('Billing Addresses');
	        
	        Tine.Sales.BillingAddressGridPanel.superclass.initComponent.call(this);
	    }
	});


/***/ },

/***/ 431:
/***/ function(module, exports) {

	/*
	 * Tine 2.0
	 * 
	 * @package     Sales
	 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
	 * @author      Alexander Stintzing <a.stintzing@metaways.de>
	 * @copyright   Copyright (c) 2014 Metaways Infosystems GmbH (http://www.metaways.de)
	 *
	 */
	Ext.namespace('Tine.Sales');
	
	/**
	 * Billing Date Dialog
	 * 
	 * @namespace   Tine.Sales
	 * @class       Tine.Sales.BillingDateDialog
	 * @extends     Ext.FormPanel
	 * @author      Alexander Stintzing <a.stintzing@metaways.de>
	 * @constructor
	 * @param {Object} config The configuration options.
	 */
	
	Tine.Sales.BillingDateDialog = Ext.extend(Ext.FormPanel, {
	    
	    // private
	    layout : 'fit',
	    border : false,
	    cls : 'tw-editdialog',
	    labelAlign : 'top',
	    anchor : '100% 100%',
	    deferredRender : false,
	    buttonAlign : null,
	    bufferResize : 500,
	    
	    /**
	     * the calling application
	     * 
	     * @type Tine.Tinebase.Application
	     */
	    app: null,
	    
	    initComponent: function() {
	        
	        this.app = Tine.Tinebase.appMgr.get('Sales');
	        
	        this.initActions();
	        this.initButtons();
	        this.initFormItems();
	        
	        Tine.Sales.BillingDateDialog.superclass.initComponent.call(this);
	        
	        this.getForm().findField('billing_date').focus(true, 200);
	    },
	    
	    /**
	     * create the buttons
	     */
	    initButtons : function() {
	        this.fbar = [ '->', this.action_cancel, this.action_update];
	    },
	    
	    /**
	     * populates this.items with the form items
	     */
	    initFormItems: function() {
	        this.items = {
	            title: null,
	            border: false,
	            frame: true,
	            layout: 'border',
	            cls: 'x-window-dlg',
	            items: [{
	                title: null,
	                region: 'center',
	                xtype: 'columnform',
	                labelAlign: 'top',
	                items: [[{
	                    fieldLabel: this.panelDialog,
	                    xtype: 'datefield',
	                    name: 'billing_date',
	                    anchor: '100%',
	                    columnWidth: 1,
	                    allowBlank: false,
	                    value: new Date()
	                }]]
	            }]
	        };
	    },
	    
	    /**
	     * is called on render, creates keymap
	     * @param {} ct
	     * @param {} position
	     */
	    onRender : function(ct, position) {
	        Tine.Sales.BillingDateDialog.superclass.onRender.call(this, ct, position);
	
	        // generalized keybord map for edit dlgs
	        new Ext.KeyMap(ct, [ {
	            key : [ 10, 13 ], // ctrl + return
	            ctrl : true,
	            fn : this.onOk,
	            scope : this
	        }]);
	    },
	    
	    /**
	     * called on clicking the OK button
	     */
	    onOk: function() {
	        this.window.fireEvent('submit', this.getForm().findField('billing_date').getValue(), this.contractId);
	        this.window.close();
	    },
	    
	    /**
	     * close window
	     */
	    onCancel: function() {
	        this.window.close();
	    },
	    
	    /**
	     * initializes the actions
	     */
	    initActions: function() {
	        this.action_cancel = new Ext.Action({
	            text: i18n._('Cancel'),
	            minWidth: 70,
	            scope: this,
	            handler: this.onCancel,
	            iconCls: 'action_cancel'
	        });
	        
	        this.action_update = new Ext.Action({
	            text : i18n._('Ok'),
	            minWidth : 70,
	            scope : this,
	            handler: this.onOk,
	            iconCls : 'action_saveAndClose'
	        });
	    }
	});
	
	
	/**
	 * @param {Object}
	 * 
	 * @return {Ext.ux.Window}
	 */
	Tine.Sales.BillingDateDialog.openWindow = function(config) {
	    var window = Tine.WindowFactory.getExtWindow({
	        title: config.winTitle,
	        width : 350,
	        height : 150,
	        contentPanelConstructor : 'Tine.Sales.BillingDateDialog',
	        contentPanelConstructorConfig : config
	    });
	    
	    window.addEvents('submit');
	    
	    return window;
	};

/***/ },

/***/ 432:
/***/ function(module, exports) {

	/**
	 * Tine 2.0
	 * 
	 * @package     Sales
	 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
	 * @author      Alexander Stintzing <a.stintzing@metaways.de>
	 * @copyright   Copyright (c) 2014 Metaways Infosystems GmbH (http://www.metaways.de)
	 */
	 
	Ext.ns('Tine.Sales');
	
	/**
	 * @namespace   Tine.Sales
	 * @class       Tine.Sales.ContractContactExternalFilterModel
	 * @extends     Tine.widgets.grid.ForeignRecordFilter
	 * 
	 * @author      Alexander Stintzing <a.stintzing@metaways.de>
	 */
	Tine.Sales.ContractContactExternalFilterModel = Ext.extend(Tine.widgets.grid.ForeignRecordFilter, {
	    
	    // private
	    field: 'costcenter',
	    valueType: 'relation',
	    
	    /**
	     * @private
	     */
	    initComponent: function() {
	        this.app = Tine.Tinebase.appMgr.get('Sales');
	        this.label = this.app.i18n._('Contact Person (external)');
	        this.foreignRecordClass = Tine.Addressbook.Model.Contact;
	        this.pickerConfig = {emptyText: this.app.i18n._('without external contact person'), allowBlank: true};
	
	        Tine.Sales.ContractContactExternalFilterModel.superclass.initComponent.call(this);
	    }
	});
	
	Tine.widgets.grid.FilterToolbar.FILTERS['sales.contract-contact-external'] = Tine.Sales.ContractContactExternalFilterModel;


/***/ },

/***/ 433:
/***/ function(module, exports) {

	/**
	 * Tine 2.0
	 * 
	 * @package     Sales
	 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
	 * @author      Alexander Stintzing <a.stintzing@metaways.de>
	 * @copyright   Copyright (c) 2014 Metaways Infosystems GmbH (http://www.metaways.de)
	 */
	 
	Ext.ns('Tine.Sales');
	
	/**
	 * @namespace   Tine.Sales
	 * @class       Tine.Sales.ContractContactInternalFilterModel
	 * @extends     Tine.widgets.grid.ForeignRecordFilter
	 * 
	 * @author      Alexander Stintzing <a.stintzing@metaways.de>
	 */
	Tine.Sales.ContractContactInternalFilterModel = Ext.extend(Tine.widgets.grid.ForeignRecordFilter, {
	    
	    // private
	    field: 'costcenter',
	    valueType: 'relation',
	    
	    /**
	     * @private
	     */
	    initComponent: function() {
	        this.app = Tine.Tinebase.appMgr.get('Sales');
	        this.label = this.app.i18n._('Contact Person (internal)');
	        this.foreignRecordClass = Tine.Addressbook.Model.Contact;
	        this.pickerConfig = {emptyText: this.app.i18n._('without internal contact person'), allowBlank: true};
	
	        Tine.Sales.ContractContactInternalFilterModel.superclass.initComponent.call(this);
	    }
	});
	
	Tine.widgets.grid.FilterToolbar.FILTERS['sales.contract-contact-internal'] = Tine.Sales.ContractContactInternalFilterModel;


/***/ },

/***/ 434:
/***/ function(module, exports) {

	/**
	 * Tine 2.0
	 * 
	 * @package     Sales
	 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
	 * @author      Alexander Stintzing <a.stintzing@metaways.de>
	 * @copyright   Copyright (c) 2013 Metaways Infosystems GmbH (http://www.metaways.de)
	 */
	 
	Ext.ns('Tine.Sales');
	
	/**
	 * @namespace   Tine.Sales
	 * @class       Tine.Sales.ContractCostCenterFilterModel
	 * @extends     Tine.widgets.grid.ForeignRecordFilter
	 * 
	 * @author      Alexander Stintzing <a.stintzing@metaways.de>
	 */
	Tine.Sales.ContractCostCenterFilterModel = Ext.extend(Tine.widgets.grid.ForeignRecordFilter, {
	    
	    // private
	    field: 'costcenter',
	    valueType: 'relation',
	    
	    /**
	     * @private
	     */
	    initComponent: function() {
	        this.app = Tine.Tinebase.appMgr.get('Sales');
	        this.label = this.app.i18n.n_('Cost Center', 'Cost Centers', 1);
	        this.foreignRecordClass = Tine.Sales.Model.CostCenter;
	        this.pickerConfig = {emptyText: this.app.i18n._('without Cost Center'), allowBlank: true};
	
	        Tine.Sales.ContractCostCenterFilterModel.superclass.initComponent.call(this);
	    }
	});
	
	Tine.widgets.grid.FilterToolbar.FILTERS['sales.contractcostcenter'] = Tine.Sales.ContractCostCenterFilterModel;


/***/ },

/***/ 435:
/***/ function(module, exports) {

	/**
	 * Tine 2.0
	 * 
	 * @package     Sales
	 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
	 * @author      Alexander Stintzing <a.stintzing@metaways.de>
	 * @copyright   Copyright (c) 2013 Metaways Infosystems GmbH (http://www.metaways.de)
	 */
	 
	Ext.ns('Tine.Sales');
	
	/**
	 * @namespace   Tine.Sales
	 * @class       Tine.Sales.ContractCustomerFilterModel
	 * @extends     Tine.widgets.grid.ForeignRecordFilter
	 * 
	 * @author      Alexander Stintzing <a.stintzing@metaways.de>
	 */
	Tine.Sales.ContractCustomerFilterModel = Ext.extend(Tine.widgets.grid.ForeignRecordFilter, {
	    
	    // private
	    field: 'customer',
	    valueType: 'relation',
	    
	    /**
	     * @private
	     */
	    initComponent: function() {
	        this.app = Tine.Tinebase.appMgr.get('Sales');
	        this.label = this.app.i18n._('Customer');
	        this.foreignRecordClass = Tine.Sales.Model.Customer;
	        this.pickerConfig = {emptyText: this.app.i18n._('without customer'), allowBlank: true};
	
	        Tine.Sales.ContractCustomerFilterModel.superclass.initComponent.call(this);
	    }
	});
	
	Tine.widgets.grid.FilterToolbar.FILTERS['sales.contractcustomer'] = Tine.Sales.ContractCustomerFilterModel;


/***/ },

/***/ 436:
/***/ function(module, exports) {

	/*
	 * Tine 2.0
	 * 
	 * @package     Sales
	 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
	 * @author      Philipp Schuele <p.schuele@metaways.de>
	 * @copyright   Copyright (c) 2007-2010 Metaways Infosystems GmbH (http://www.metaways.de)
	 *
	 */
	 
	Ext.namespace('Tine.Sales');
	
	/**
	 * Contract edit dialog
	 * 
	 * @namespace   Tine.Sales
	 * @class       Tine.Sales.ContractEditDialog
	 * @extends     Tine.widgets.dialog.EditDialog
	 * 
	 * <p>Contract Edit Dialog</p>
	 * <p><pre>
	 * </pre></p>
	 * 
	 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
	 * @author      Philipp Schuele <p.schuele@metaways.de>
	 * @copyright   Copyright (c) 2007-2014 Metaways Infosystems GmbH (http://www.metaways.de)
	 * 
	 * @param       {Object} config
	 * @constructor
	 * Create a new Tine.Sales.ContractGridPanel
	 */
	Tine.Sales.ContractEditDialog = Ext.extend(Tine.widgets.dialog.EditDialog, {
	    windowWidth: 800,
	    windowHeight: 600,
	    displayNotes: true,
	
	    /**
	     * autoset
	     * 
	     * @type combo
	     */
	    customerPicker: null,
	    
	    /**
	     * autoset
	     * 
	     * @type combo
	     */
	    addressPicker: null,
	    
	    /**
	     * if true, number will be readOnly and will be generated automatically
	     * @type {Boolean} autoGenerateNumber
	     */
	    autoGenerateNumber: null,
	    
	    /**
	     * how should the number be validated text/integer possible
	     * @type {String} validateNumber
	     */
	    validateNumber: null,
	
	    displayNotes: true,
	    
	    initComponent: function() {
	        this.autoGenerateNumber = (Tine.Sales.registry.get('config').contractNumberGeneration.value == 'auto') ? true : false;
	        this.validateNumber = Tine.Sales.registry.get('config').contractNumberValidation.value;
	
	        Tine.Sales.ContractEditDialog.superclass.initComponent.call(this);
	    },
	    
	    /**
	     * called on multiple edit
	     *
	     * @return {Boolean}
	     */
	    isMultipleValid: function() {
	        return true;
	    },
	    
	    /**
	     * containerProperty (all contracts in one container) exists, so overwrite creating selector here
	     */
	    initContainerSelector: Ext.emptyFn,
	    
	    /**
	     * extra validation for the number field, calls parent
	     * @return {Boolean}
	     */
	    isValid: function() {
	        var valid = Tine.Sales.ContractEditDialog.superclass.isValid.call(this);
	        var isValid = this.autoGenerateNumber ? true : (this.validateNumber == 'integer') ? Ext.isNumber(Ext.num(this.getForm().findField('number').getValue())) : true;
	        if (!isValid) {
	            this.getForm().findField('number').markInvalid(this.app.i18n._('Please use a decimal number here!'));
	        }
	        return isValid && valid;
	    },
	    
	    /**
	     * executed after record got updated from proxy
	     * 
	     * @private
	     */
	    onRecordLoad: function() {
	        // interrupt process flow until dialog is rendered
	        if (! this.rendered) {
	            this.onRecordLoad.defer(250, this);
	            return;
	        }
	        
	        Tine.Sales.ContractEditDialog.superclass.onRecordLoad.call(this);
	        
	        if (this.record.id) {
	            var relations = this.record.get('relations'), foundCustomer = false;
	            
	            if (Ext.isArray(relations)) {
	                for (var index = 0; index < relations.length; index++) {
	                    if (relations[index].related_model == 'Sales_Model_Customer') {
	                        if (relations[index].type == 'CUSTOMER') {
	                            foundCustomer = relations[index].related_record;
	                        }
	                    }
	                }
	            }
	            
	            if (foundCustomer) {
	                this.addressPicker.enable();
	                var ba = this.record.get('billing_address_id');
	                
	                if (ba && ba.hasOwnProperty('locality')) {
	                    var record = new Tine.Sales.Model.Address(ba);
	                }
	             
	                this.setAddressPickerFilter();
	            }
	        }
	    },
	    
	    /**
	     * sets the filter used for the addresspicker by the selected customer
	     */
	    setAddressPickerFilter: function() {
	        this.addressPicker.additionalFilters = [
	            {field: 'type', operator: 'not', value: 'delivery'},
	            {field: 'customer_id', operator: 'AND', value: [
	                {field: ':id', operator: 'in', value: [this.customerPicker.getValue()] }
	            ]}
	        ];
	    },
	    
	    /**
	     * loads the full-featured record, if a contract gets selected
	     * 
	     * @param {Tine.widgets.relation.PickerCombo} combo
	     * @param {Tine.Sales.Model.Contract} record
	     * @param {Number} index
	     */
	    onCustomerLoad: function(combo, record, index) {
	        if (this.addressPicker.disabled) {
	            this.addressPicker.enable();
	        } else {
	            this.addressPicker.reset();
	        }
	        
	        this.addressPicker.lastQuery = null;
	        this.setAddressPickerFilter();
	        this.loadAddress(record);
	    },
	    
	    /**
	     * loads the first billing address or the postal 
	     * address into the addresspicker on loading a customer
	     * 
	     * @param {Tine.Sales.Model.Customer} record
	     */
	    loadAddress: function(record) {
	        var billingAddresses = record.get('billing');
	        if (Ext.isArray(billingAddresses) && billingAddresses.length > 0) {
	            var address = new Tine.Sales.Model.Address(billingAddresses[0]);
	        } else {
	            var address = new Tine.Sales.Model.Address(record.get('postal_id'));
	        }
	        
	        this.addressPicker.setValue(address.data);
	    },
	    
	    /**
	     * returns dialog
	     * 
	     * NOTE: when this method gets called, all initalisation is done.
	     */
	    getFormItems: function() {
	        
	        this.productGridPanel = new Tine.Sales.ProductAggregateGridPanel({
	            app: this.app,
	            editDialog: this,
	            title: this.app.i18n._('Products'),
	            editDialogRecordProperty: 'products'
	        });
	        
	        var items = [[{
	            columnWidth: .25,
	            fieldLabel: this.app.i18n._('Number'),
	            name: 'number',
	            multiEditable: false,
	            readOnly: this.autoGenerateNumber,
	            allowBlank: this.autoGenerateNumber
	        },{
	            columnWidth: .75,
	            fieldLabel: this.app.i18n._('Title'),
	            name: 'title',
	            allowBlank: false
	        }], [{
	            columnWidth: 1,
	            editDialog: this,
	            xtype: 'tinerelationpickercombo',
	            allowBlank: true,
	            app: 'Sales',
	            recordClass: Tine.Sales.Model.Customer,
	            relationType: 'CUSTOMER',
	            relationDegree: 'sibling',
	            modelUnique: true,
	            listeners: {
	                scope: this,
	                select: this.onCustomerLoad
	            },
	            ref: '../../../../../customerPicker',
	            fieldLabel: this.app.i18n._('Customer')
	        }], [ Tine.widgets.form.RecordPickerManager.get('Sales', 'Address', {
	                fieldLabel: this.app.i18n._('Billing Address'),
	                name: 'billing_address_id',
	                ref: '../../../../../addressPicker',
	                columnWidth: 1,
	                disabled: true,
	                allowBlank: true
	            })], [{
	                    xtype: 'extuxclearabledatefield',
	                    name: 'start_date',
	                    columnWidth: 1/2,
	                    fieldLabel: this.app.i18n._('Start Date'),
	                    allowBlank: false
	                }, {
	                    xtype: 'extuxclearabledatefield',
	                    name: 'end_date',
	                    fieldLabel: this.app.i18n._('End Date'),
	                    columnWidth: 1/2
	                }], [{
	                columnWidth: 1/3,
	                xtype: 'tinerelationpickercombo',
	                fieldLabel: this.app.i18n._('Contact Person (external)'),
	                editDialog: this,
	                allowBlank: true,
	                app: 'Addressbook',
	                recordClass: Tine.Addressbook.Model.Contact,
	                relationType: 'CUSTOMER',
	                relationDegree: 'sibling',
	                modelUnique: true
	            }, {
	                columnWidth: 1/3,
	                editDialog: this,
	                xtype: 'tinerelationpickercombo',
	                fieldLabel: this.app.i18n._('Contact Person (internal)'),
	                allowBlank: true,
	                app: 'Addressbook',
	                recordClass: Tine.Addressbook.Model.Contact,
	                relationType: 'RESPONSIBLE',
	                relationDegree: 'sibling',
	                modelUnique: true
	            }, {
	                columnWidth: 1/3,
	                editDialog: this,
	                xtype: 'tinerelationpickercombo',
	                fieldLabel: this.app.i18n._('Lead Cost Center'),
	                allowBlank: true,
	                app: 'Sales',
	                recordClass: Tine.Sales.Model.CostCenter,
	                relationType: 'LEAD_COST_CENTER',
	                relationDegree: 'sibling',
	                modelUnique: true
	            }]];
	            
	        items.push([{
	            columnWidth: 1,
	            fieldLabel: this.app.i18n._('Description'),
	            emptyText: this.app.i18n._('Enter description...'),
	            name: 'description',
	            xtype: 'textarea',
	            height: 200
	        }]);
	        
	        return {
	            xtype: 'tabpanel',
	            border: false,
	            plain:true,
	            activeTab: 0,
	            border: false,
	            defaults: {
	                hideMode: 'offsets'
	            },
	            plugins: [{
	                ptype : 'ux.tabpanelkeyplugin'
	            }],
	            items:[
	                {
	                title: this.app.i18n.n_('Contract', 'Contracts', 1),
	                autoScroll: true,
	                border: false,
	                frame: true,
	                layout: 'border',
	                items: [{
	                    region: 'center',
	                    xtype: 'columnform',
	                    labelAlign: 'top',
	                    formDefaults: {
	                        xtype:'textfield',
	                        anchor: '100%',
	                        labelSeparator: '',
	                        columnWidth: .333
	                    },
	                    items: items
	                }, {
	                    // activities and tags
	                    layout: 'accordion',
	                    animate: true,
	                    region: 'east',
	                    width: 210,
	                    split: true,
	                    collapsible: true,
	                    collapseMode: 'mini',
	                    header: false,
	                    margins: '0 5 0 5',
	                    border: true,
	                    items: [
	                        new Tine.widgets.tags.TagPanel({
	                            app: 'Sales',
	                            border: false,
	                            bodyStyle: 'border:1px solid #B5B8C8;'
	                        })
	                    ]
	                }]
	            }, this.productGridPanel,
	                new Tine.widgets.activities.ActivitiesTabPanel({
	                    app: this.appName,
	                    record_id: this.record.id,
	                    record_model: 'Sales_Model_Contract'
	                })
	            ]
	        };
	    }
	});


/***/ },

/***/ 437:
/***/ function(module, exports) {

	/**
	 * Tine 2.0
	 * 
	 * @package     Sales
	 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
	 * @author      Alexander Stintzing <a.stintzing@metaways.de>
	 * @copyright   Copyright (c) 2014 Metaways Infosystems GmbH (http://www.metaways.de)
	 */
	 
	Ext.ns('Tine.Sales');
	
	/**
	 * @namespace   Tine.Sales
	 * @class       Tine.Sales.ContractFilterModel
	 * @extends     Tine.widgets.grid.ForeignRecordFilter
	 * 
	 * @author      Alexander Stintzing <a.stintzing@metaways.de>
	 */
	Tine.Sales.ContractFilterModel = Ext.extend(Tine.widgets.grid.ForeignRecordFilter, {
	    
	    // private
	    field: 'contract',
	    valueType: 'relation',
	    
	    /**
	     * @private
	     */
	    initComponent: function() {
	        this.app = Tine.Tinebase.appMgr.get('Sales');
	        this.label = this.app.i18n._('Contract');
	        this.foreignRecordClass = Tine.Sales.Model.Contract;
	        this.pickerConfig = {emptyText: this.app.i18n._('without contract'), allowBlank: true};
	        Tine.Sales.ContractFilterModel.superclass.initComponent.call(this);
	    }
	});
	
	Tine.widgets.grid.FilterToolbar.FILTERS['sales.invoicecontract']  = Tine.Sales.ContractFilterModel;
	Tine.widgets.grid.FilterToolbar.FILTERS['sales.orderconfirmation-contract']  = Tine.Sales.ContractFilterModel;


/***/ },

/***/ 438:
/***/ function(module, exports) {

	/*
	 * Tine 2.0
	 * 
	 * @package     Sales
	 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
	 * @author      Philipp Schüle <p.schuele@metaways.de>
	 * @copyright   Copyright (c) 2007-2013 Metaways Infosystems GmbH (http://www.metaways.de)
	 *
	 */
	 
	Ext.namespace('Tine.Sales');
	
	/**
	 * Contract grid panel
	 * 
	 * @namespace   Tine.Sales
	 * @class       Tine.Sales.ContractGridPanel
	 * @extends     Tine.widgets.grid.GridPanel
	 * 
	 * <p>Contract Grid Panel</p>
	 * <p><pre>
	 * </pre></p>
	 * 
	 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
	 * @author      Philipp Schuele <p.schuele@metaways.de>
	 * @copyright   Copyright (c) 2007-2013 Metaways Infosystems GmbH (http://www.metaways.de)
	 * 
	 * @param       {Object} config
	 * @constructor
	 * Create a new Tine.Sales.ContractGridPanel
	 */
	Tine.Sales.ContractGridPanel = Ext.extend(Tine.widgets.grid.GridPanel, {
	    multipleEdit: true,
	    initComponent: function() {
	        Tine.Sales.ContractGridPanel.superclass.initComponent.call(this);
	        this.action_addInNewWindow.actionUpdater = function() {
	            var defaultContainer = this.app.getRegistry().get('defaultContainer');
	            this.action_addInNewWindow.setDisabled(! defaultContainer.account_grants[this.action_addInNewWindow.initialConfig.requiredGrant]);
	        }
	    },
	    
	    /**
	     * @todo: make this generally available (here its more general: Tine.HumanResources.EmployeeGridPanel)
	     * 
	     * returns additional toobar items
	     * 
	     * @return {Array} of Ext.Action
	     */
	    getActionToolbarItems: function() {
	        this.actions_bill = new Ext.Action({
	            text: this.app.i18n._('Bill Contract'),
	            iconCls: 'action_bill',
	            scope: this,
	            disabled: true,
	            allowMultiple: false,
	            handler: this.onBillContract,
	            actionUpdater: function(action, grants, records) {
	                if (records.length == 1) {
	                    action.enable();
	                } else {
	                    action.disable();
	                }
	            }
	        });
	
	        var billButton = Ext.apply(new Ext.Button(this.actions_bill), {
	            scale: 'medium',
	            rowspan: 2,
	            iconAlign: 'top'
	        });
	        
	        var additionalActions = [this.actions_bill];
	        this.actionUpdater.addActions(additionalActions);
	        
	        return [billButton];
	    },
	    
	    /**
	     * is called when the component is rendered
	     * @param {} ct
	     * @param {} position
	     */
	    onRender : function(ct, position) {
	        this.billMask = new Ext.LoadMask(ct, {msg: this.app.i18n._('Billing Contract...')});
	        Tine.Sales.ContractGridPanel.superclass.onRender.call(this, ct, position);
	    },
	    
	    /**
	     * 
	     */
	    onBillContract: function() {
	        var rows = this.getGrid().getSelectionModel().getSelections();
	        
	        if (rows.length != 1) {
	            return;
	        }
	        
	        var window = Tine.Sales.BillingDateDialog.openWindow({
	            winTitle: String.format(this.app.i18n._('Bill Contract "{0} - {1}"'), rows[0].data.number, rows[0].data.title),
	            panelDialog: this.app.i18n._('Select the date to generate the bill for'),
	            contractId: rows[0].id
	        });
	        
	        window.on('submit', this.doBillContract, this);
	    },
	    
	    /**
	     * 
	     * @param {} date
	     * @param {} contractId
	     */
	    doBillContract: function(date, contractId) {
	        var that = this;
	        
	        this.billMask.show();
	        
	        var req = Ext.Ajax.request({
	            url : 'index.php',
	            params : { 
	                method: 'Sales.billContract', 
	                id:     contractId,
	                date:   date
	            },
	            success : function(result, request) {
	                that.getGrid().store.reload();
	                that.billMask.hide();
	            },
	            failure : function(exception) {
	                that.billMask.hide();
	                Tine.Tinebase.ExceptionHandler.handleRequestException(exception);
	            },
	            scope: that
	        });
	    },
	    
	    /**
	     * add custom items to context menu
	     * 
	     * @return {Array}
	     */
	    getContextMenuItems: function() {
	        var items = [
	            '-',
	            this.actions_bill
	            ];
	        
	        return items;
	    }
	});


/***/ },

/***/ 439:
/***/ function(module, exports) {

	/**
	 * Tine 2.0
	 * 
	 * @package     Sales
	 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
	 * @author      Philipp Schüle <p.schuele@metaways.de>
	 * @copyright   Copyright (c) 2017 Metaways Infosystems GmbH (http://www.metaways.de)
	 */
	 
	Ext.ns('Tine.Sales');
	
	/**
	 * @namespace   Tine.Sales
	 * @class       Tine.Sales.ContractProductFilterModel
	 * @extends     Tine.widgets.grid.ForeignRecordFilter
	 * 
	 * @author      Philipp Schüle <p.schuele@metaways.de>
	 */
	Tine.Sales.ContractProductFilterModel = Ext.extend(Tine.widgets.grid.FilterModel, {
	    
	    // private
	    field: 'products',
	    operators: ['contains'],
	    
	    /**
	     * @private
	     */
	    initComponent: function() {
	        this.app = Tine.Tinebase.appMgr.get('Sales');
	        this.label = this.app.i18n._('Products');
	        //this.pickerConfig = {emptyText: this.app.i18n._('without customer'), allowBlank: true};
	
	        Tine.Sales.ContractProductFilterModel.superclass.initComponent.call(this);
	    }
	});
	
	Tine.widgets.grid.FilterToolbar.FILTERS['sales.contract-product'] = Tine.Sales.ContractProductFilterModel;


/***/ },

/***/ 440:
/***/ function(module, exports) {

	/*
	 * Tine 2.0
	 * Sales combo box and store
	 * 
	 * @package     Sales
	 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
	 * @author      Alexander Stintzing <a.stintzing@metaways.de>
	 * @copyright   Copyright (c) 2012 Metaways Infosystems GmbH (http://www.metaways.de)
	 *
	 */
	
	Ext.ns('Tine.Sales');
	
	/**
	 * Contract selection combo box
	 * 
	 * @namespace   Tine.Sales
	 * @class       Tine.Sales.ContractSearchCombo
	 * @extends     Ext.form.ComboBox
	 * 
	 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
	 * @author      Alexander Stintzing <a.stintzing@metaways.de>
	 * @copyright   Copyright (c) 2012 Metaways Infosystems GmbH (http://www.metaways.de)
	 * 
	 * @param       {Object} config
	 * @constructor
	 * Create a new Tine.Sales.ContractSearchCombo
	 */
	Tine.Sales.ContractSearchCombo = Ext.extend(Tine.Tinebase.widgets.form.RecordPickerComboBox, {
	    
	    allowBlank: false,
	    minListWidth: 200,
	    
	    //private
	    initComponent: function(){
	        this.recordClass = Tine.Sales.Model.Contract;
	        this.recordProxy = Tine.Sales.contractBackend;
	
	        Tine.Sales.ContractSearchCombo.superclass.initComponent.call(this);
	        
	        this.displayField = 'fulltext';
	        this.sortBy = 'number';
	    }
	});
	
	Tine.widgets.form.RecordPickerManager.register('Sales', 'Contract', Tine.Sales.ContractSearchCombo);


/***/ },

/***/ 441:
/***/ function(module, exports) {

	/*
	 * Tine 2.0
	 * 
	 * @package     Sales
	 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
	 * @author      Alexander Stintzing <a.stintzing@metaways.de>
	 * @copyright   Copyright (c) 2013 Metaways Infosystems GmbH (http://www.metaways.de)
	 *
	 */
	Ext.namespace('Tine.Sales');
	
	/**
	 * Copy Address Dialog
	 * 
	 * @namespace   Tine.Sales
	 * @class       Tine.Sales.CopyAddressDialog
	 * @extends     Ext.FormPanel
	 * @author      Alexander Stintzing <a.stintzing@metaways.de>
	 * @constructor
	 * @param {Object} config The configuration options.
	 */
	
	Tine.Sales.CopyAddressDialog = Ext.extend(Ext.FormPanel, {
	    
	    // private
	    layout : 'fit',
	    border : false,
	    cls : 'tw-editdialog',
	    labelAlign : 'top',
	    anchor : '100% 100%',
	    deferredRender : false,
	    buttonAlign : null,
	    bufferResize : 500,
	    
	    /**
	     * the calling application
	     * 
	     * @type Tine.Tinebase.Application
	     */
	    app: null,
	    
	    initComponent: function() {
	        this.initActions();
	        this.initButtons();
	        this.initFormItems();
	        
	        Tine.Sales.CopyAddressDialog.superclass.initComponent.call(this);
	        
	        this.getForm().findField('content').setValue(this.content);
	        this.getForm().findField('content').focus(true, 200);
	    },
	    
	    /**
	     * create the buttons
	     */
	    initButtons : function() {
	        this.fbar = [ '->', this.action_update];
	    },
	    
	    /**
	     * populates this.items with the form items
	     */
	    initFormItems: function() {
	        this.items = {
	            title: null,
	            border: false,
	            frame: true,
	            layout: 'border',
	            cls: 'x-window-dlg',
	            items: [{
	                title: null,
	                region: 'center',
	                xtype: 'columnform',
	                labelAlign: 'top',
	                items: [[{
	                    fieldLabel: this.app.i18n.n_('Address', 'Addresses', 1),
	                    xtype: 'textarea',
	                    name: 'content',
	                    anchor: '100%',
	                    height: 120,
	                    labelSeparator: '',
	                    columnWidth: 1,
	                    allowBlank: true
	                }]]
	            }]
	        };
	    },
	    
	    /**
	     * is called on render, creates keymap
	     * @param {} ct
	     * @param {} position
	     */
	    onRender : function(ct, position) {
	        Tine.Sales.CopyAddressDialog.superclass.onRender.call(this, ct, position);
	
	        // generalized keybord map for edit dlgs
	        new Ext.KeyMap(ct, [ {
	            key : [ 10, 13 ], // ctrl + return
	            ctrl : true,
	            fn : this.onOk,
	            scope : this
	        }]);
	        
	        this.window.setTitle(this.app.i18n._hidden(this.winTitle));
	    },
	    
	    /**
	     * called on clicking the OK button
	     */
	    onOk: function() {
	        this.window.close();
	        this.onClose();
	    },
	    
	    /**
	     * initializes the actions
	     */
	    initActions: function() {
	        this.action_update = new Ext.Action({
	            text : i18n._('Ok'),
	            minWidth : 70,
	            scope : this,
	            handler: this.onOk,
	            iconCls : 'action_saveAndClose'
	        });
	    }
	});
	
	
	/**
	 * @param {Object}
	 * 
	 * @return {Ext.ux.Window}
	 */
	Tine.Sales.CopyAddressDialog.openWindow = function(config) {
	    var window = Tine.WindowFactory.getExtWindow({
	        title: config.winTitle,
	        width : 290,
	        height : 225,
	        contentPanelConstructor : 'Tine.Sales.CopyAddressDialog',
	        contentPanelConstructorConfig : config
	    });
	    
	    return window;
	};

/***/ },

/***/ 442:
/***/ function(module, exports) {

	/*
	 * Tine 2.0
	 * 
	 * @package     Sales
	 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
	 * @author      Alexander Stintzing <a.stintzing@metaways.de>
	 * @copyright   Copyright (c) 2013-2014 Metaways Infosystems GmbH (http://www.metaways.de)
	 *
	 */
	 
	Ext.namespace('Tine.Sales');
	
	/**
	 * CostCenter edit dialog
	 * 
	 * @namespace   Tine.Sales
	 * @class       Tine.Sales.CostCenterEditDialog
	 * @extends     Tine.widgets.dialog.EditDialog
	 * 
	 * <p>CostCenter Edit Dialog</p>
	 * <p><pre>
	 * </pre></p>
	 * 
	 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
	 * @author      Alexander Stintzing <a.stintzing@metaways.de>
	 * @copyright   Copyright (c) 2013-2014 Metaways Infosystems GmbH (http://www.metaways.de)
	 * 
	 * @param       {Object} config
	 * @constructor
	 * Create a new Tine.Sales.CostCenterGridPanel
	 */
	Tine.Sales.CostCenterEditDialog = Ext.extend(Tine.widgets.dialog.EditDialog, {
	    
	    windowWidth: 650,
	    windowHeight: 450,
	    
	    /**
	     * @private
	     */
	    windowNamePrefix: 'CostCenterEditWindow_',
	    appName: 'Sales',
	
	    tbarItems: [],
	    
	    initComponent: function() {
	        
	        this.recordClass = Tine.Sales.Model.CostCenter;
	        this.recordProxy = Tine.Sales.costcenterBackend;
	        
	        Tine.Sales.CostCenterEditDialog.superclass.initComponent.call(this);
	    },
	    /**
	     * called on multiple edit
	     * @return {Boolean}
	     */
	    isMultipleValid: function() {
	        return true;
	    },
	    
	    /**
	     * @see: Tine.widgets.dialog.EditDialog.onRecordLoad
	     */
	    onRecordLoad: function() {
	        Tine.Sales.CostCenterEditDialog.superclass.onRecordLoad.call(this);
	        
	        if (! this.copyRecord && ! this.record.id) {
	            this.window.setTitle(this.app.i18n._('Add New Cost Center'));
	        }
	    },
	    
	    /**
	     * returns dialog
	     * 
	     * NOTE: when this method gets called, all initalisation is done.
	     */
	    getFormItems: function() {
	        return {
	            xtype: 'tabpanel',
	            border: false,
	            plain:true,
	            activeTab: 0,
	            border: false,
	            defaults: {
	                hideMode: 'offsets'
	            },
	            plugins: [{
	                ptype : 'ux.tabpanelkeyplugin'
	            }],
	            items:[
	                {
	                title: this.app.i18n.n_('Cost Center', 'Cost Centers', 1),
	                autoScroll: true,
	                border: false,
	                frame: true,
	                layout: 'border',
	                items: [{
	                    region: 'center',
	                    xtype: 'columnform',
	                    labelAlign: 'top',
	                    formDefaults: {
	                        xtype:'textfield',
	                        anchor: '100%',
	                        labelSeparator: '',
	                        columnWidth: .333
	                    },
	                    items: [[{
	                        columnWidth: .25,
	                        fieldLabel: this.app.i18n._('Number'),
	                        name: 'number',
	                        xtype:  'numberfield',
	                        multiEditable: false,
	                        allowBlank: false
	                    },{
	                        columnWidth: .75,
	                        fieldLabel: this.app.i18n._('Remark'),
	                        name: 'remark',
	                        allowBlank: false
	                    }]
	                    ]
	                }]
	            }]
	        };
	    }
	});
	
	/**
	 * Sales Edit Popup
	 */
	Tine.Sales.CostCenterEditDialog.openWindow = function (config) {
	    var id = (config.record && config.record.id) ? config.record.id : 0;
	    var window = Tine.WindowFactory.getWindow({
	        width: 650,
	        height: 450,
	        name: Tine.Sales.CostCenterEditDialog.prototype.windowNamePrefix + id,
	        contentPanelConstructor: 'Tine.Sales.CostCenterEditDialog',
	        contentPanelConstructorConfig: config
	    });
	    return window;
	};


/***/ },

/***/ 443:
/***/ function(module, exports) {

	/*
	 * Tine 2.0
	 * 
	 * @package     Sales
	 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
	 * @author      Alexander Stintzing <a.stintzing@metaways.de>
	 * @copyright   Copyright (c) 2013 Metaways Infosystems GmbH (http://www.metaways.de)
	 *
	 */
	 
	Ext.namespace('Tine.Sales');
	
	/**
	 * CostCenter grid panel
	 * 
	 * @namespace   Tine.Sales
	 * @class       Tine.Sales.CostCenterGridPanel
	 * @extends     Tine.widgets.grid.GridPanel
	 * 
	 * <p>CostCenter Grid Panel</p>
	 * <p><pre>
	 * </pre></p>
	 * 
	 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
	 * @author      Alexander Stinting <a.stintzing@metaways.de>
	 * @copyright   Copyright (c) 2013 Metaways Infosystems GmbH (http://www.metaways.de)
	 * 
	 * @param       {Object} config
	 * @constructor
	 * 
	 * Create a new Tine.Sales.CostCenterGridPanel
	 */
	Tine.Sales.CostCenterGridPanel = Ext.extend(Tine.widgets.grid.GridPanel, {
	    // grid specific
	    defaultSortInfo: {field: 'remark', dir: 'ASC'},
	    gridConfig: {
	        autoExpandColumn: 'remark'
	    },
	    
	    multipleEdit: true,
	    
	    initComponent: function() {
	        this.recordClass = Tine.Sales.Model.CostCenter;
	        this.recordProxy = Tine.Sales.costcenterBackend;
	        this.gridConfig.columns = this.getColumns();
	        Tine.Sales.CostCenterGridPanel.superclass.initComponent.call(this);
	    },
	    
	    /**
	     * returns cm
	     * @private
	     */
	    getColumns: function(){
	        return [{
	            id: 'number',
	            header: this.app.i18n._("Number"),
	            width: 100,
	            sortable: true,
	            dataIndex: 'number'
	        },{
	            id: 'remark',
	            header: this.app.i18n._("Remark"),
	            width: 200,
	            sortable: true,
	            dataIndex: 'remark'
	        }].concat(this.getModlogColumns())
	    }
	});


/***/ },

/***/ 444:
/***/ function(module, exports) {

	/*
	 * Tine 2.0
	 * Sales combo box and store
	 * 
	 * @package     Sales
	 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
	 * @author      Alexander Stintzing <a.stintzing@metaways.de>
	 * @copyright   Copyright (c) 2012 Metaways Infosystems GmbH (http://www.metaways.de)
	 *
	 */
	
	Ext.ns('Tine.Sales');
	
	/**
	 * CostCenter selection combo box
	 * 
	 * @namespace   Tine.Sales
	 * @class       Tine.Sales.CostCenterSearchCombo
	 * @extends     Ext.form.ComboBox
	 * 
	 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
	 * @author      Alexander Stintzing <a.stintzing@metaways.de>
	 * @copyright   Copyright (c) 2012 Metaways Infosystems GmbH (http://www.metaways.de)
	 * 
	 * @param       {Object} config
	 * @constructor
	 * Create a new Tine.Sales.CostCenterSearchCombo
	 */
	Tine.Sales.CostCenterSearchCombo = Ext.extend(Tine.Tinebase.widgets.form.RecordPickerComboBox, {
	    
	    allowBlank: false,
	    itemSelector: 'div.search-item',
	    minListWidth: 200,
	    sortBy: 'number',
	    
	    //private
	    initComponent: function(){
	        this.recordClass = Tine.Sales.Model.CostCenter;
	        this.recordProxy = Tine.Sales.costcenterBackend;
	        this.initTemplate();
	        
	        Tine.Sales.CostCenterSearchCombo.superclass.initComponent.call(this);
	    },
	    
	    /**
	     * init template
	     * @private
	     */
	    initTemplate: function() {
	        if (! this.tpl) {
	            this.tpl = new Ext.XTemplate(
	                '<tpl for="."><div class="search-item">',
	                    '<table cellspacing="0" cellpadding="2" border="0" style="font-size: 11px;" width="100%">',
	                        '<tr>',
	                            '<td style="height:16px">{[this.encode(values)]}</td>',
	                        '</tr>',
	                    '</table>',
	                '</div></tpl>',
	                {
	                    encode: function(values) {
	                        var ret = '';
	                        if(values.number) ret += '<b>' + Ext.util.Format.htmlEncode(values.number) + '</b> - ';
	                        ret += Ext.util.Format.htmlEncode(values.remark);
	                        return ret;
	                        
	                    }
	                }
	            );
	        }
	    }
	});
	
	Tine.widgets.form.RecordPickerManager.register('Sales', 'CostCenter', Tine.Sales.CostCenterSearchCombo);


/***/ },

/***/ 445:
/***/ function(module, exports) {

	/*
	 * Tine 2.0
	 * 
	 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
	 * @author      Alexander Stintzing <a.stintzing@metaways.de>
	 * @copyright   Copyright (c) 2013 Metaways Infosystems GmbH (http://www.metaways.de)
	 */
	Ext.ns('Tine.Sales');
	
	/**
	 * @namespace   Tine.Sales
	 * @class       Tine.Sales.CustomerDetailsPanel
	 * @extends     Tine.widgets.grid.DetailsPanel
	 * 
	 * <p>Customer details Panel</p>
	 * <p></p>
	 * 
	 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
	 * @author      Alexander Stintzing <a.stintzing@metaways.de>
	 * 
	 * @param       {Object} config
	 * @constructor
	 * Create a new Tine.Sales.CustomerDetailsPanel
	 */
	Tine.Sales.CustomerDetailsPanel = Ext.extend(Tine.widgets.grid.DetailsPanel, {
	    
	    /**
	     * init
	     */
	    initComponent: function() {
	
	        // init templates
	        this.initTemplate();
	        this.initDefaultTemplate();
	        
	        Tine.Sales.CustomerDetailsPanel.superclass.initComponent.call(this);
	    },
	
	    /**
	     * add on click event after render
	     */
	    afterRender: function() {
	        Tine.Sales.CustomerDetailsPanel.superclass.afterRender.apply(this, arguments);
	        
	        if (this.felamimail === true) {
	            this.body.on('click', this.onClick, this);
	        }
	    },
	    
	    /**
	     * init default template
	     * 
	     * @todo: generalize this
	     */
	    initDefaultTemplate: function() {
	        
	        this.defaultTpl = new Ext.XTemplate(
	            '<div class="preview-panel-timesheet-nobreak">',    
	                '<!-- Preview contacts -->',
	                '<div class="preview-panel preview-panel-timesheet-left">',
	                    '<div class="bordercorner_1"></div>',
	                    '<div class="bordercorner_2"></div>',
	                    '<div class="bordercorner_3"></div>',
	                    '<div class="bordercorner_4"></div>',
	                    '<div class="preview-panel-declaration">' + this.app.i18n.n_hidden('Customer', 'Customers', 3) + '</div>',
	                    '<div class="preview-panel-timesheet-leftside preview-panel-left">',
	                        '<span class="preview-panel-bold">',
	                            this.app.i18n._('Select customer') + '<br/>',
	                            '<br/>',
	                            '<br/>',
	                            '<br/>',
	                        '</span>',
	                    '</div>',
	                    '<div class="preview-panel-timesheet-rightside preview-panel-left">',
	                        '<span class="preview-panel-nonbold">',
	                            '<br/>',
	                            '<br/>',
	                            '<br/>',
	                            '<br/>',
	                        '</span>',
	                    '</div>',
	                '</div>',
	                '<!-- Preview xxx -->',
	                '<div class="preview-panel-timesheet-right">',
	                    '<div class="bordercorner_gray_1"></div>',
	                    '<div class="bordercorner_gray_2"></div>',
	                    '<div class="bordercorner_gray_3"></div>',
	                    '<div class="bordercorner_gray_4"></div>',
	                    '<div class="preview-panel-declaration"></div>',
	                    '<div class="preview-panel-timesheet-leftside preview-panel-left">',
	                        '<span class="preview-panel-bold">',
	                            '<br/>',
	                            '<br/>',
	                            '<br/>',
	                            '<br/>',
	                        '</span>',
	                    '</div>',
	                    '<div class="preview-panel-timesheet-rightside preview-panel-left">',
	                        '<span class="preview-panel-nonbold">',
	                            '<br/>',
	                            '<br/>',
	                            '<br/>',
	                            '<br/>',
	                        '</span>',
	                    '</div>',
	                '</div>',
	            '</div>'        
	        );
	    },
	    
	    /**
	     * init single contact template (this.tpl)
	     */
	    initTemplate: function() {
	        this.tpl = new Ext.XTemplate(
	            '<tpl for=".">',
	                '<!-- Preview core data -->',
	                '<div class="preview-panel preview-panel-left preview-panel-customer">',
	                    '<div class="bordercorner_1"></div>',
	                    '<div class="bordercorner_2"></div>',
	                    '<div class="bordercorner_3"></div>',
	                    '<div class="bordercorner_4"></div>',
	                    '<div class="preview-panel-declaration">' + this.app.i18n._('Core Data') + '</div>',
	                    '<div class="preview-panel-left">',
	                        '<span class="preview-panel-symbolcompare wide">' + this.app.i18n._('Customer Number') + '</span>{[this.encode(values.number)]}<br/>',
	                        '<span class="preview-panel-symbolcompare wide">' + this.app.i18n._('Name') + '</span>{[this.encode(values.name)]}<br/>',
	                        '<span class="preview-panel-symbolcompare wide">' + this.app.i18n._('Web') + '</span><a href="{[this.encode(values.url, "text")]}" target="_blank">{[this.encode(values.url, "text")]}</a><br/>',
	                        '<span class="preview-panel-symbolcompare wide">' + this.app.i18n._('Contact Person (external)') + '</span>{[this.encode(values.cpextern_id, "address")]}<br/>',
	                        '<span class="preview-panel-symbolcompare wide">' + this.app.i18n._('Contact Person (internal)') + '</span>{[this.encode(values.cpintern_id, "address")]}<br/>',
	                        
	                        
	                    '</div>',
	                '</div>',
	
	                '<!-- Preview accounting data -->',
	                '<div class="preview-panel preview-panel-left preview-panel-customer">',
	                    '<div class="bordercorner_1"></div>',
	                    '<div class="bordercorner_2"></div>',
	                    '<div class="bordercorner_3"></div>',
	                    '<div class="bordercorner_4"></div>',
	                    '<div class="preview-panel-declaration">' + this.app.i18n._('Accounting') + '</div>',
	                    '<div>',
	                        '<span class="preview-panel-symbolcompare wide">' + this.app.i18n._('IBAN') + '</span>{[this.encode(values.iban)]}<br/>',
	                        '<span class="preview-panel-symbolcompare wide">' + this.app.i18n._('BIC') + '</span>{[this.encode(values.bic)]}<br/>',
	                        '<span class="preview-panel-symbolcompare wide">' + this.app.i18n._('VAT No.') + '</span>{[this.encode(values.vatid)]}<br/>',
	                        '<span class="preview-panel-symbolcompare wide">' + this.app.i18n._('Currency') + '</span>{[this.encode(values.currency)]}<br/>',
	                        '<span class="preview-panel-symbolcompare wide">' + this.app.i18n._('Currency Translation Rate') + '</span>{[this.encode(values.currency_trans_rate)]}<br/>',
	                    '</div>',
	                '</div>',
	            
	                '<!-- Preview description -->',
	                '<div class="preview-panel-description preview-panel-left preview-panel-customer">',
	                    '<div class="bordercorner_gray_1"></div>',
	                    '<div class="bordercorner_gray_2"></div>',
	                    '<div class="bordercorner_gray_3"></div>',
	                    '<div class="bordercorner_gray_4"></div>',
	                    '<div class="preview-panel-declaration">' + i18n._('Description') + '</div>',
	                    '{[this.encode(values.description)]}',
	                '</div>',
	            '</tpl>',
	            {
	                /**
	                 * encode
	                 */
	                encode: function(value, type, prefix) {
	                    if (! value) {
	                        return '';
	                    }
	                    type = type ? type : 'text';
	                    switch (type) {
	                        case 'text':
	                            var ret = value;
	                            break;
	                        case 'address':
	                            var ret = value.n_fn
	                            break;
	                    }
	                    return Ext.util.Format.htmlEncode(ret);
	                }
	            }
	        );
	    }
	});

/***/ },

/***/ 446:
/***/ function(module, exports) {

	/*
	 * Tine 2.0
	 * 
	 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
	 * @author      Alexander Stintzing <a.stintzing@metaways.de>
	 * @copyright   Copyright (c) 2013 Metaways Infosystems GmbH (http://www.metaways.de)
	 */
	Ext.ns('Tine.Sales');
	
	/**
	 * @namespace   Tine.Sales
	 * @class       Tine.Sales.CustomerEditDialog
	 * @extends     Tine.widgets.dialog.EditDialog
	 * 
	 * <p>Customer Compose Dialog</p>
	 * <p></p>
	 * 
	 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
	 * @author      Alexander Stintzing <a.stintzing@metaways.de>
	 * 
	 * @param       {Object} config
	 * @constructor
	 * Create a new Tine.Sales.CustomerEditDialog
	 */
	Tine.Sales.CustomerEditDialog = Ext.extend(Tine.widgets.dialog.EditDialog, {
	    windowWidth: 900,
	    windowHeight: 800,
	    displayNotes: true,
	    
	    initComponent: function() {
	        Tine.Sales.CustomerEditDialog.superclass.initComponent.call(this);
	    },
	    
	    /**
	     * 
	     */
	    isValid: function() {
	        var isValid = true,
	            form = this.getForm();
	        
	        isValid = Tine.Sales.CustomerEditDialog.superclass.isValid.call(this)
	
	        if (Ext.isEmpty(form.findField('adr_street').getValue()) && Ext.isEmpty(form.findField('adr_pobox').getValue())) {
	            isValid = false;
	            var msg = this.app.i18n._('Either street or postbox is required!');
	            form.markInvalid( {'adr_street': msg, 'adr_pobox': msg});
	        }
	
	        var number = form.findField('number').getValue();
	        if (number.match(/[^0-9^]+/)) {
	            isValid = false;
	            form.markInvalid( {'number': this.app.i18n._('Only numbers are allowed!')});
	        }
	
	        return isValid;
	    },
	    
	    /**
	     * executed after record got updated from proxy
	     */
	    onRecordLoad: function() {
	        // interrupt process flow until dialog is rendered
	        if (! this.rendered) {
	            this.onRecordLoad.defer(250, this);
	            return;
	        }
	        
	        Tine.Sales.CustomerEditDialog.superclass.onRecordLoad.call(this);
	        
	        if (this.copyRecord) {
	            this.doCopyRecord();
	            this.window.setTitle(this.app.i18n._('Copy Customer'));
	        } else {
	            if (! this.record.id) {
	                this.window.setTitle(this.app.i18n._('Add New Customer'));
	            } else {
	                this.window.setTitle(String.format(this.app.i18n._('Edit Customer "{0}"'), this.record.getTitle()));
	                this.getForm().findField('number').disable();
	            }
	        }
	    },
	    
	    /**
	     * duplicate(s) found exception handler
	     * 
	     * @todo: make this globally, smoothly the virtual fields (modelconfig) don't fit anywhere
	     * 
	     * @param {Object} exception
	     */
	    onDuplicateException: function(exception) {
	        this.onRecordUpdate();
	        exception.clientRecord = this.record.data;
	        Tine.Sales.CustomerEditDialog.superclass.onDuplicateException.call(this, exception);
	    },
	    
	    /**
	     * Fill address with contact data, if not set already
	     * 
	     * @param {} combo
	     * @param {} record
	     * @param {} index
	     */
	    onSelectContactPerson: function(combo, record, index) {
	        var form = this.getForm();
	        if (record.get('adr_one_street') && ! form.findField('adr_street').getValue()) {
	            var ar = ['street', 'postalcode', 'region', 'locality', 'countryname'];
	            for (var index = 0; index < ar.length; index++) {
	                form.findField('adr_' + ar[index]).setValue(record.get('adr_one_' + ar[index]));
	            }
	        }
	    },
	    
	    /**
	     * returns dialog
	     * 
	     * NOTE: when this method gets called, all initalisation is done.
	     * 
	     * @return {Object}
	     * @private
	     */
	    getFormItems: function() {
	        var formFieldDefaults = {
	            xtype:'textfield',
	            anchor: '100%',
	            labelSeparator: '',
	            columnWidth: .5
	        };
	        
	        this.clipboardButton = new Ext.Button({
	           columnWidth: 5/100,
	           iconCls: 'clipboard',
	           tooltip: Ext.util.Format.htmlEncode(this.app.i18n._('Copy address to the clipboard')),
	           fieldLabel: '&nbsp;',
	           lazyLoading: false,
	           listeners: {
	                scope: this,
	                click: function() {
	                    this.onRecordUpdate();
	                    Tine.Sales.addToClipboard(this.record);
	                }
	           }
	        });
	        
	        var currency = Tine.Sales.registry.get('config').ownCurrency.value;
	        
	        this.billingAddressGridPanel = new Tine.Sales.BillingAddressGridPanel({
	            app: this.app,
	            editDialog: this,
	            frame: false,
	            border: true,
	            autoScroll: true,
	            layout: 'border',
	            editDialogRecordProperty: 'billing'
	        });
	        
	        this.deliveryAddressGridPanel = new Tine.Sales.DeliveryAddressGridPanel({
	            app: this.app,
	            editDialog: this,
	            frame: false,
	            border: true,
	            autoScroll: true,
	            layout: 'border',
	            editDialogRecordProperty: 'delivery'
	        });
	        
	        return {
	            xtype: 'tabpanel',
	            defaults: {
	                hideMode: 'offsets'
	            },
	            border: false,
	            plain: true,
	            activeTab: 0,
	            items: [{
	            title: this.app.i18n._('Customer'),
	            autoScroll: true,
	            border: false,
	            frame: true,
	            layout: 'border',
	            items: [{
	                region: 'center',
	                layout: 'hfit',
	                border: false,
	                items: [{
	                    xtype: 'fieldset',
	                    layout: 'hfit',
	                    autoHeight: true,
	                    title: this.app.i18n._('Core Data'),
	                    items: [{
	                        xtype: 'columnform',
	                        labelAlign: 'top',
	                        formDefaults: formFieldDefaults,
	                        items: [[{
	                                fieldLabel: this.app.i18n._('Customer Number'),
	                                name: 'number',
	                                allowBlank: true,
	                                columnWidth: .250,
	                                minValue: 1,
	                                maxValue: 4294967296,
	                                xtype: 'uxspinner',
	                                strategy: new Ext.ux.form.Spinner.NumberStrategy({
	                                    incrementValue : 1,
	                                    alternateIncrementValue: 1,
	                                    minValue: 1,
	                                    maxValue: 4294967296,
	                                    allowDecimals : false
	                                })
	                            }, {
	                                columnWidth: .750,
	                                allowBlank: false,
	                                fieldLabel: this.app.i18n._('Name'),
	                                name: 'name',
	                                xtype: 'tine.widget.field.AutoCompleteField',
	                                recordClass: this.recordClass
	                            }], [Tine.widgets.form.RecordPickerManager.get('Addressbook', 'Contact', {
	                                    columnWidth: 1/2,
	                                    blurOnSelect: true,
	                                    name: 'cpextern_id',
	                                    allowBlank: true,
	                                    fieldLabel: this.app.i18n._('Contact Person (external)'),
	                                    listeners: {
	                                        scope: this,
	                                        select: this.onSelectContactPerson
	                                    }
	                            }), Tine.widgets.form.RecordPickerManager.get('Addressbook', 'Contact', {
	                                    columnWidth: 1/2,
	                                    blurOnSelect: true,
	                                    name: 'cpintern_id',
	                                    allowBlank: true,
	                                    fieldLabel: this.app.i18n._('Contact Person (internal)')
	                                })
	                        ]]
	                    }]
	                }, {
	                    xtype: 'fieldset',
	                    layout: 'hfit',
	                    autoHeight: true,
	                    title: this.app.i18n._('Accounting'),
	                    items: [{
	                        xtype: 'columnform',
	                        labelAlign: 'top',
	                        formDefaults: formFieldDefaults,
	                        items: [
	                            [{
	                                name: 'vatid',
	                                fieldLabel: this.app.i18n._('VAT No.')
	                            }, {
	                                name: 'credit_term',
	                                fieldLabel: this.app.i18n._('Credit Term (days)'),
	                                xtype: 'uxspinner',
	                                strategy: new Ext.ux.form.Spinner.NumberStrategy({
	                                    incrementValue : 1,
	                                    alternateIncrementValue: 1,
	                                    minValue: 0,
	                                    maxValue: 1024,
	                                    allowDecimals : false
	                                })
	                            }], [{
	                                name: 'currency',
	                                fieldLabel: this.app.i18n._('Currency'),
	                                value: currency,
	                                allowBlank: false
	                            }, {
	                                name: 'currency_trans_rate',
	                                fieldLabel: this.app.i18n._('Currency Translation Rate'),
	                                xtype: 'uxspinner',
	                                strategy: new Ext.ux.form.Spinner.NumberStrategy({
	                                    incrementValue : 0.01,
	                                    alternateIncrementValue: 0.1,
	                                    minValue: 0.01,
	                                    allowDecimals : true
	                                }),
	                                decimalPrecision: 2,
	                                decimalSeparator: Tine.Tinebase.registry.get('decimalSeparator'),
	                                regex: /^[0-9]+\.?[0-9]*$/
	                            }], [{
	                                name: 'iban',
	                                fieldLabel: this.app.i18n._('IBAN')
	                            }, {
	                                name: 'bic',
	                                fieldLabel: this.app.i18n._('BIC')
	                            }], [{
	                                name: 'discount',
	                                fieldLabel: this.app.i18n._('Discount (%)'),
	                                xtype: 'uxspinner',
	                                strategy: new Ext.ux.form.Spinner.NumberStrategy({
	                                    incrementValue : 0.1,
	                                    alternateIncrementValue: 1,
	                                    minValue: 0,
	                                    maxValue: 100,
	                                    allowDecimals : true
	                                }),
	                                decimalPrecision: 1,
	                                decimalSeparator: Tine.Tinebase.registry.get('decimalSeparator')
	                            }
	                        ]]
	                    }]
	                }, {
	                    xtype: 'fieldset',
	                    layout: 'hfit',
	                    autoHeight: true,
	                    title: this.app.i18n._('Postal Address'),
	                    items: [{
	                        xtype: 'columnform',
	                        labelAlign: 'top',
	                        formDefaults: formFieldDefaults,
	                        items: [
	                            [{
	                                name: 'adr_street',
	                                fieldLabel: this.app.i18n._('Street'),
	                                columnWidth: 47/100
	                            }, {
	                                name: 'adr_pobox',
	                                fieldLabel: this.app.i18n._('Postbox'),
	                                columnWidth: 47/100
	                                
	                            }], [{
	                                name: 'adr_postalcode',
	                                allowBlank: false,
	                                fieldLabel: this.app.i18n._('Postalcode'),
	                                columnWidth: 47/100
	                            }, {
	                                name: 'adr_locality',
	                                allowBlank: false,
	                                fieldLabel: this.app.i18n._('Locality'),
	                                columnWidth: 47/100
	                            }], [{
	                                name: 'adr_region',
	                                fieldLabel: this.app.i18n._('Region'),
	                                columnWidth: 47/100
	                            }, {
	                                xtype: 'widget-countrycombo',
	                                name: 'adr_countryname',
	                                fieldLabel: this.app.i18n._('Country'),
	                                columnWidth: 47/100
	                            }
	                            ], [{
	                                name: 'adr_prefix1',
	                                fieldLabel: this.app.i18n._('Prefix'),
	                                columnWidth: 47/100
	                            }, {
	                                name: 'adr_prefix2',
	                                fieldLabel: this.app.i18n._('Additional Prefix'),
	                                columnWidth: 48/100
	                            }, this.clipboardButton]
	                        ]
	                    }]
	                }, {
	                    xtype: 'fieldset',
	                    layout: 'hfit',
	                    autoHeight: true,
	                    title: this.app.i18n._('Miscellaneous'),
	                    items: [{
	                        xtype: 'columnform',
	                        labelAlign: 'top',
	                        formDefaults: formFieldDefaults,
	                        items: [[
	                            {
	                                columnWidth: 1/3,
	                                fieldLabel: this.app.i18n._('Web'),
	                                xtype: 'mirrortextfield',
	                                name: 'url',
	                                maxLength: 128,
	                                listeners: {
	                                    scope: this,
	                                    focus: function (field) {
	                                        if (! field.getValue()) {
	                                            field.setValue('http://www.');
	                                            field.selectText.defer(100, field, [7, 11]);
	                                        }
	                                    },
	                                    blur: function (field) {
	                                        if (field.getValue() === 'http://www.') {
	                                            field.setValue(null);
	                                            field.validate();
	                                        }
	                                        if (field.getValue().indexOf('http://http://') == 0 || field.getValue().indexOf('http://https://') == 0) {
	                                            field.setValue(field.getValue().substr(7));
	                                            field.validate();
	                                        }
	                                        if (field.getValue().indexOf('http://www.http://') == 0 || field.getValue().indexOf('http://www.https://') == 0) {
	                                            field.setValue(field.getValue().substr(11));
	                                            field.validate();
	                                        }
	                                    }
	                                }
	                            }
	                        ]]
	                    }]
	                }]
	            }, {
	                // activities and tags
	                layout: 'accordion',
	                animate: true,
	                region: 'east',
	                width: 210,
	                split: true,
	                collapsible: true,
	                collapseMode: 'mini',
	                header: false,
	                margins: '0 5 0 5',
	                border: true,
	                items: [
	                    new Ext.Panel({
	                        title: this.app.i18n._('Description'),
	                        iconCls: 'descriptionIcon',
	                        layout: 'form',
	                        labelAlign: 'top',
	                        border: false,
	                        items: [{
	                            style: 'margin-top: -4px; border 0px;',
	                            labelSeparator: '',
	                            xtype: 'textarea',
	                            name: 'description',
	                            hideLabel: true,
	                            grow: false,
	                            preventScrollbars: false,
	                            anchor: '100% 100%',
	                            emptyText: this.app.i18n._('Enter description'),
	                            requiredGrant: 'editGrant'
	                        }]
	                    }),
	                    new Tine.widgets.tags.TagPanel({
	                        app: 'Sales',
	                        border: false,
	                        bodyStyle: 'border:1px solid #B5B8C8;'
	                    })
	                ]
	            }]
	        }, this.billingAddressGridPanel,
	           this.deliveryAddressGridPanel,
	           new Tine.widgets.activities.ActivitiesTabPanel({
	                app: this.appName,
	                record_id: this.record.id,
	                record_model: 'Sales_Model_Customer'
	            })
	        ]};
	    }
	});


/***/ },

/***/ 447:
/***/ function(module, exports) {

	/**
	 * Tine 2.0
	 * 
	 * @package     Sales
	 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
	 * @author      Alexander Stintzing <a.stintzing@metaways.de>
	 * @copyright   Copyright (c) 2014 Metaways Infosystems GmbH (http://www.metaways.de)
	 */
	 
	Ext.ns('Tine.Sales');
	
	/**
	 * @namespace   Tine.Sales
	 * @class       Tine.Sales.CustomerFilterModel
	 * @extends     Tine.widgets.grid.ForeignRecordFilter
	 * 
	 * @author      Alexander Stintzing <a.stintzing@metaways.de>
	 */
	Tine.Sales.CustomerFilterModel = Ext.extend(Tine.widgets.grid.ForeignRecordFilter, {
	    
	    // private
	    field: 'customer',
	    valueType: 'relation',
	    
	    /**
	     * @private
	     */
	    initComponent: function() {
	        this.app = Tine.Tinebase.appMgr.get('Sales');
	        this.label = this.app.i18n._('Customer');
	        this.foreignRecordClass = Tine.Sales.Model.Customer;
	        this.pickerConfig = {emptyText: this.app.i18n._('without customer'), allowBlank: true};
	        Tine.Sales.CustomerFilterModel.superclass.initComponent.call(this);
	    }
	});
	
	Tine.widgets.grid.FilterToolbar.FILTERS['sales.invoicecustomer']  = Tine.Sales.CustomerFilterModel;
	Tine.widgets.grid.FilterToolbar.FILTERS['sales.offer-customer']  = Tine.Sales.CustomerFilterModel;

/***/ },

/***/ 448:
/***/ function(module, exports) {

	/*
	 * Tine 2.0
	 * 
	 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
	 * @author      Alexander Stintzing <a.stintzing@metaways.de>
	 * @copyright   Copyright (c) 2013 Metaways Infosystems GmbH (http://www.metaways.de)
	 */
	Ext.ns('Tine.Sales');
	
	/**
	 * Customer grid panel
	 * 
	 * @namespace   Tine.Sales
	 * @class       Tine.Sales.CustomerGridPanel
	 * @extends     Tine.widgets.grid.GridPanel
	 * 
	 * <p>Customer Grid Panel</p>
	 * <p><pre>
	 * </pre></p>
	 * 
	 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
	 * @author      Alexander Stintzing <a.stintzing@metaways.de>    
	 * 
	 * @param       {Object} config
	 * @constructor
	 * Create a new Tine.Sales.CustomerGridPanel
	 */
	Tine.Sales.CustomerGridPanel = Ext.extend(Tine.widgets.grid.GridPanel, {
	    
	    initComponent: function() {
	        this.initDetailsPanel();
	        Tine.Sales.CustomerGridPanel.superclass.initComponent.call(this);
	    },
	
	    /**
	     * @private
	     */
	    initDetailsPanel: function() {
	        this.detailsPanel = new Tine.Sales.CustomerDetailsPanel({
	            grid: this,
	            app: this.app
	        });
	    }
	});


/***/ },

/***/ 449:
/***/ function(module, exports) {

	/*
	 * Tine 2.0
	 * Sales combo box and store
	 * 
	 * @package     Sales
	 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
	 * @author      Alexander Stintzing <a.stintzing@metaways.de>
	 * @copyright   Copyright (c) 2014 Metaways Infosystems GmbH (http://www.metaways.de)
	 *
	 */
	
	Ext.ns('Tine.Sales');
	
	/**
	 * Customer selection combo box
	 * 
	 * @namespace   Tine.Sales
	 * @class       Tine.Sales.CustomerSearchCombo
	 * @extends     Ext.form.ComboBox
	 * 
	 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
	 * @author      Alexander Stintzing <a.stintzing@metaways.de>
	 * @copyright   Copyright (c) 2014 Metaways Infosystems GmbH (http://www.metaways.de)
	 * 
	 * @param       {Object} config
	 * @constructor
	 * Create a new Tine.Sales.CustomerSearchCombo
	 */
	Tine.Sales.CustomerSearchCombo = Ext.extend(Tine.Tinebase.widgets.form.RecordPickerComboBox, {
	    
	    allowBlank: false,
	    minListWidth: 200,
	    
	    //private
	    initComponent: function(){
	        this.recordClass = Tine.Sales.Model.Customer;
	        this.recordProxy = Tine.Sales.customerBackend;
	
	        Tine.Sales.CustomerSearchCombo.superclass.initComponent.call(this);
	        
	        this.displayField = 'fulltext';
	        this.sortBy = 'number';
	    }
	});
	
	Tine.widgets.form.RecordPickerManager.register('Sales', 'Customer', Tine.Sales.CustomerSearchCombo);


/***/ },

/***/ 450:
/***/ function(module, exports) {

	/*
	 * Tine 2.0
	 * 
	 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
	 * @author      Alexander Stintzing <a.stintzing@metaways.de>
	 * @copyright   Copyright (c) 2013 Metaways Infosystems GmbH (http://www.metaways.de)
	 */
	Ext.ns('Tine.Sales');
	
	/**
	 * Address grid panel
	 * 
	 * @namespace   Tine.Sales
	 * @class       Tine.Sales.DeliveryAddressGridPanel
	 * @extends     Tine.Sales.AddressGridPanel
	 * 
	 * <p>Delivery Address Grid Panel</p>
	 * <p><pre>
	 * </pre></p>
	 * 
	 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
	 * @author      Alexander Stintzing <a.stintzing@metaways.de>    
	 * 
	 * @param       {Object} config
	 * @constructor
	 * 
	 * Create a new Tine.Sales.DeliveryAddressGridPanel
	 */
	Tine.Sales.DeliveryAddressGridPanel = Ext.extend(Tine.Sales.AddressGridPanel, {
	    /**
	     * inits this cmp
	     * 
	     * @private
	     */
	    initComponent: function() {
	        this.addressType = 'delivery';
	        
	        // TODO use singular/plural translations here
	        this.i18nRecordName  = this.app.i18n._('Delivery Address');
	        this.i18nRecordsName = this.app.i18n._('Delivery Addresses');
	        
	        this.modelConfig = Ext.decode(Ext.encode(this.modelConfig));
	        
	        this.modelConfig.fields.custom1.label = null;
	        
	        Tine.Sales.DeliveryAddressGridPanel.superclass.initComponent.call(this);
	    }
	});


/***/ },

/***/ 451:
/***/ function(module, exports) {

	/*
	 * Tine 2.0
	 * 
	 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
	 * @author      Alexander Stintzing <a.stintzing@metaways.de>
	 * @copyright   Copyright (c) 2013 Metaways Infosystems GmbH (http://www.metaways.de)
	 */
	Ext.ns('Tine.Sales');
	
	/**
	 * @namespace   Tine.Sales
	 * @class       Tine.Sales.ExceptionHandler
	 * 
	 * <p>Exception Handler for Sales</p>
	 * 
	 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
	 * @author      Alexander Stintzing <a.stintzing@metaways.de>
	 */
	
	Tine.Sales.handleRequestException = function(exception, callback, callbackScope) {
	    if (! exception.code && exception.responseText) {
	        // we need to decode the exception first
	        var response = Ext.util.JSON.decode(exception.responseText);
	        exception = response.data;
	    }
	    
	    var app = Tine.Tinebase.appMgr.get('Sales');
	    
	    var defaults = {
	        buttons: Ext.Msg.OK,
	        icon: Ext.MessageBox.ERROR,
	        fn: callback,
	        scope: callbackScope,
	        title: app.i18n._(exception.title),
	        msg: app.i18n._(exception.message)
	    };
	    
	    Tine.log.warn('Request exception :');
	    Tine.log.warn(exception);
	
	    switch(exception.code) {
	        case 910: // Sales_Exception_UnknownCurrencyCode
	        case 911: // Sales_Exception_DuplicateNumber
	        case 913: // Sales_Exception_InvoiceAlreadyClearedEdit
	        case 914: // Sales_Exception_InvoiceAlreadyClearedDelete
	        case 915: // Sales_Exception_AlterOCNumberForbidden
	        case 916: // Sales_Exception_DeletePreviousInvoice
	            Ext.MessageBox.show(defaults);
	            return true;
	            break;
	        case 917: // Sales_Exception_DeleteUsedBillingAddress
	            var app = Tine.Tinebase.appMgr.get('Sales');
	            var storeData = {
	                results: exception.contracts,
	                totalcount: exception.contracts.length
	            };
	                
	            var window = Tine.widgets.dialog.ExceptionHandlerDialog.openWindow({
	                height: 245,
	                messageHeight: 70,
	                exception: exception,
	                type: 'error',
	                
	                callback: function() {
	                    location.reload();
	                },
	                
	                fields: [[{
	                    xtype: 'grid',
	                    height: 110,
	                    autoExpandColumn: 'title',
	                    listeners: { 
	                        scope: this,
	                        rowdblclick: function(grid, index, event) {
	                            Tine.Sales.ContractEditDialog.openWindow({record: grid.store.getAt(index)});
	                        }
	                    },
	                    store: new Ext.data.Store({
	                        data: storeData,
	                        reader: new Ext.data.JsonReader({
	                            id: 'id',
	                            root: 'results',
	                            totalProperty: 'totalcount'
	                        }, Tine.Sales.Model.Contract)
	                    }),
	                    
	                    title: null,
	                    columns: [{
	                        id: 'number',
	                        dataIndex: 'number',
	                        header: app.i18n._('Number'),
	                        sortable: true
	                    }, {
	                        id: 'title',
	                        dataIndex: 'title',
	                        header: app.i18n._('Title'),
	                        sortable: true
	                    }]
	                }]]
	            });
	            
	            return true;
	            break;
	        // return false will the generic exceptionhandler handle the caught exception
	        default:
	            return false;
	    }
	    
	    return true;
	}
	
	Tine.Tinebase.ExceptionHandlerRegistry.register('Sales', Tine.Sales.handleRequestException);

/***/ },

/***/ 452:
/***/ function(module, exports) {

	/*
	 * Tine 2.0
	 * 
	 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
	 * @author      Alexander Stintzing <a.stintzing@metaways.de>
	 * @copyright   Copyright (c) 2014 Metaways Infosystems GmbH (http://www.metaways.de)
	 */
	Ext.ns('Tine.Sales');
	
	/**
	 * @namespace   Tine.Sales
	 * @class       Tine.Sales.InvoiceDetailsPanel
	 * @extends     Tine.widgets.grid.DetailsPanel
	 * 
	 * <p>Invoice details Panel</p>
	 * <p></p>
	 * 
	 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
	 * @author      Alexander Stintzing <a.stintzing@metaways.de>
	 * 
	 * @param       {Object} config
	 * @constructor
	 * Create a new Tine.Sales.InvoiceDetailsPanel
	 */
	Tine.Sales.InvoiceDetailsPanel = Ext.extend(Tine.widgets.grid.DetailsPanel, {
	    
	    defaultHeight: 145,
	    
	    /**
	     * init
	     */
	    initComponent: function() {
	
	        // init templates
	        this.initTemplate();
	        this.initDefaultTemplate();
	        
	        Tine.Sales.InvoiceDetailsPanel.superclass.initComponent.call(this);
	    },
	
	    /**
	     * add on click event after render
	     */
	    afterRender: function() {
	        Tine.Sales.InvoiceDetailsPanel.superclass.afterRender.apply(this, arguments);
	    },
	    
	    /**
	     * init default template
	     * 
	     * @todo: generalize this
	     */
	    initDefaultTemplate: function() {
	        
	        this.defaultTpl = new Ext.XTemplate(
	            '<div class="preview-panel-timesheet-nobreak">',    
	                '<!-- Preview contacts -->',
	                '<div class="preview-panel preview-panel-invoice-default">',
	                    '<div class="bordercorner_1"></div>',
	                    '<div class="bordercorner_2"></div>',
	                    '<div class="bordercorner_3"></div>',
	                    '<div class="bordercorner_4"></div>',
	                    '<div class="preview-panel-declaration">' + this.app.i18n.n_hidden('Invoice', 'Invoices', 3) + '</div>',
	                    '<div class="preview-panel-timesheet-leftside preview-panel-left">',
	                        '<span class="preview-panel-bold">',
	                            this.app.i18n._('Select invoice') + '<br/>',
	                            '<br/>',
	                            '<br/>',
	                            '<br/>',
	                        '</span>',
	                    '</div>',
	                    '<div class="preview-panel-timesheet-rightside preview-panel-left">',
	                        '<span class="preview-panel-nonbold">',
	                            '<br/>',
	                            '<br/>',
	                            '<br/>',
	                            '<br/>',
	                        '</span>',
	                    '</div>',
	                '</div>',
	            '</div>'
	        );
	    },
	    
	    /**
	     * init single contact template (this.tpl)
	     */
	    initTemplate: function() {
	        var that = this;
	        this.tpl = new Ext.XTemplate(
	            '<tpl for=".">',
	                '<!-- Preview core data -->',
	                '<div class="preview-panel preview-panel-invoice-left preview-panel-customer">',
	                    '<div class="bordercorner_1"></div>',
	                    '<div class="bordercorner_2"></div>',
	                    '<div class="bordercorner_3"></div>',
	                    '<div class="bordercorner_4"></div>',
	                    '<div class="preview-panel-declaration">' + this.app.i18n._('Invoice') + '</div>',
	                    '<div class="preview-panel-left">',
	                        '<span class="preview-panel-symbolcompare wide">' + this.app.i18n._('Invoice Number') + '</span>{[this.encode(values, "number")]}<br/>',
	                        '<span class="preview-panel-symbolcompare wide">' + this.app.i18n._('Date') + '</span>{[this.encode(values, "date")]}<br/>',
	                        '<span class="preview-panel-symbolcompare wide">' + this.app.i18n._('Type') + '</span>{[this.encode(values, "type")]}<br/>',
	                        '<span class="preview-panel-symbolcompare wide">' + this.app.i18n._('Description') + '</span>{[this.encode(values, "description")]}<br/>',
	                        '<span class="preview-panel-symbolcompare wide">' + this.app.i18n._('Customer') + '</span>{[this.encode(values, "customer")]}<br/>',
	                        '<span class="preview-panel-symbolcompare wide">' + this.app.i18n._('Contract') + '</span>{[this.encode(values, "contract")]}<br/>',
	                    '</div>',
	                '</div>',
	
	                '<!-- Preview accounting data -->',
	                '<div class="preview-panel preview-panel-invoice-left preview-panel-customer">',
	                    '<div class="bordercorner_1"></div>',
	                    '<div class="bordercorner_2"></div>',
	                    '<div class="bordercorner_3"></div>',
	                    '<div class="bordercorner_4"></div>',
	                    '<div class="preview-panel-declaration">' + this.app.i18n._('Billing Address') + '</div>',
	                    '<div>',
	                        '{[this.encode(values, "address")]}<br/>',
	                    '</div>',
	                '</div>',
	            
	                '<!-- Preview description -->',
	                '<div class="preview-panel preview-panel-invoice-left preview-panel-customer">',
	                    '<div class="bordercorner_1"></div>',
	                    '<div class="bordercorner_2"></div>',
	                    '<div class="bordercorner_3"></div>',
	                    '<div class="bordercorner_4"></div>',
	                    '<div class="preview-panel-declaration">' + this.app.i18n._('Miscellaneous') + '</div>',
	                    '<div class="preview-panel-left">',
	                        '<span class="preview-panel-symbolcompare wide">' + this.app.i18n._('Credit Term') + '</span>{[this.encode(values, "credit_term")]}<br/>',
	                        '<span class="preview-panel-symbolcompare wide">' + this.app.i18n.n_('Cost Center', 'Cost Centers', 1) + '</span>{[this.encode(values, "costcenter_id")]}<br/>',
	                        '<span class="preview-panel-symbolcompare wide">' + this.app.i18n._('Cleared') + '</span>{[this.encode(values, "cleared")]}<br/>',
	                        '<span class="preview-panel-symbolcompare wide">' + this.app.i18n._('Price Net') + '</span>{[this.encode(values, "price_net")]}<br/>',
	                        '<span class="preview-panel-symbolcompare wide">' + this.app.i18n._('Price Tax') + ' (' + '{[this.encode(values, "sales_tax")]}' + ')' + '</span>{[this.encode(values, "price_tax")]}<br/>',
	                        '<span class="preview-panel-symbolcompare wide">' + this.app.i18n._('Price Gross') + '</span>{[this.encode(values, "price_gross")]}<br/>',
	                    '</div>',
	                '</div>',
	            '</tpl>',
	            {
	                /**
	                 * encode
	                 */
	                encode: function(value, key) {
	                    switch (key) {
	                        case 'address':
	                            if (value.fixed_address) {
	                                return Ext.util.Format.nl2br(value.fixed_address);
	                            } else if (value.address_id) {
	                                var address = new Tine.Sales.Model.Address(value.address_id);
	                                return Ext.util.Format.nl2br(Tine.Sales.renderAddress(address));
	                            } else {
	                                return '';
	                            }
	                        case 'contract':
	                        case 'customer':
	                            var renderer = Tine.widgets.grid.RendererManager.get('Sales', 'Invoice', key);
	                            return renderer(that.record.get('relations'));
	                        case 'price_gross':
	                            return Ext.util.Format.money(value.price_gross);
	                        case 'price_net':
	                            return Ext.util.Format.money(value.price_net);
	                        case 'price_tax':
	                            return Ext.util.Format.money(value.price_tax);
	                    }
	
	                    var renderer = Tine.widgets.grid.RendererManager.get('Sales', 'Invoice', key);
	                    if (renderer) {
	                        return renderer(value[key], key, that.record);
	                    } else {
	                        return '';
	                    }
	                }
	            }
	        );
	    }
	});


/***/ },

/***/ 453:
/***/ function(module, exports) {

	/*
	 * Tine 2.0
	 * 
	 * @license http://www.gnu.org/licenses/agpl.html AGPL Version 3 @author
	 * Alexander Stintzing <a.stintzing@metaways.de> @copyright Copyright (c) 2013
	 * Metaways Infosystems GmbH (http://www.metaways.de)
	 */
	Ext.ns('Tine.Sales');
	
	/**
	 * @namespace Tine.Sales
	 * @class Tine.Sales.InvoiceEditDialog
	 * @extends Tine.widgets.dialog.EditDialog
	 * 
	 * <p>
	 * Invoice Compose Dialog
	 * </p>
	 * <p>
	 * </p>
	 * 
	 * @license http://www.gnu.org/licenses/agpl.html AGPL Version 3
	 * @author Alexander Stintzing <a.stintzing@metaways.de>
	 * 
	 * @param {Object}
	 *            config
	 * @constructor Create a new Tine.Sales.InvoiceEditDialog
	 */
	Tine.Sales.InvoiceEditDialog = Ext.extend(Tine.widgets.dialog.EditDialog, {
	    
	    /**
	     * @private
	     */
	    tbarItems: null,
	    evalGrants: false,
	    
	    /**
	     * autoset
	     * 
	     * @type combo
	     */
	    addressPicker: null,
	    
	    /**
	     * autoset
	     * 
	     * @type combo
	     */
	    customerPicker: null,
	    
	    /**
	     * autoset
	     * 
	     * @type combo
	     */
	    contractPicker: null,
	    
	    createReversal: false,
	    
	    windowWidth: 800,
	    windowHeight: 700,
	
	    displayNotes: true,
	    
	    initComponent: function() {
	        Tine.Sales.InvoiceEditDialog.superclass.initComponent.call(this);
	    },
	    
	    /**
	     * is form valid?
	     * 
	     * @return {Boolean}
	     */
	    isValid: function() {
	        var isValid = Tine.Sales.InvoiceEditDialog.superclass.isValid.call(this);
	        return isValid;
	    },
	    
	    /**
	     * executed after record got updated from proxy
	     * 
	     * @private
	     */
	    onRecordLoad: function() {
	        // interrupt process flow until dialog is rendered
	        if (! this.rendered) {
	            this.onRecordLoad.defer(250, this);
	            return;
	        }
	        
	        if (this.record.get('sales_tax') == null) {
	            this.record.set('sales_tax', 19);
	        }
	        
	        if (this.createReversal) {
	            var originalRecord = this.recordProxy.recordReader({responseText: Ext.encode(this.record.data)}); ;
	            
	            this.record.set('cleared', 'TO_CLEAR');
	            this.record.set('number', null);
	            this.record.set('date', null);
	            this.record.set('type', 'REVERSAL');
	            this.record.set('positions', []);
	
	            this.record.set('price_gross', this.record.get('price_gross') * -1);
	            this.record.set('price_net', this.record.get('price_net') * -1);
	
	            var relations = this.record.get('relations');
	            var newRelations = [];
	            var allowedRelations = ['Sales_Model_Customer', 'Sales_Model_CostCenter', 'Sales_Model_Contract'];
	            Ext.each(relations, function(relation, index) {
	                if (allowedRelations.indexOf(relation.related_model) > -1) {
	                    relation.id = null;
	                    newRelations.push(relation);
	                }
	            });
	            
	            newRelations.push({
	                related_degree:  'sibling',
	                own_backend:     'Sql',
	                related_id:      originalRecord.get('id'),
	                related_record:  originalRecord.data,
	                related_model:   'Sales_Model_Invoice',
	                related_backend: 'Sql',
	                own_model:       'Sales_Model_Invoice',
	                type:            'REVERSAL'
	            });
	            
	            this.record.set('relations', newRelations);
	        }
	        
	        // this will start preparing the gridpanels for the invoice positions
	        if (this.positionsPanel) {
	            this.positionsPanel.positions = this.record.get('positions');
	            this.positionsPanel.invoiceId = this.record.get('id');
	        }
	        
	        Tine.Sales.InvoiceEditDialog.superclass.onRecordLoad.call(this);
	
	        if (this.createReversal) {
	            this.window.setTitle(this.app.i18n._('Create Reversal Invoice'));
	            this.doCopyRecord();
	            
	        } else if (this.copyRecord) {
	            this.doCopyRecord();
	            this.window.setTitle(this.app.i18n._('Copy Invoice'));
	        } else {
	            if (! this.record.id) {
	                this.window.setTitle(this.app.i18n._('Add New Invoice'));
	            } else {
	                this.window.setTitle(String.format(this.app.i18n._('Edit Invoice "{0}"'), this.record.getTitle()));
	            }
	        }
	
	        if (this.record.id || this.createReversal) {
	            var form = this.getForm();
	            var ar = ['type', 'contract'];
	            for (var index = 0; index < ar.length; index++) {
	                form.findField(ar[index]).setReadOnly(1);
	            }
	        }
	        
	        if (this.record.get('cleared') == 'CLEARED') {
	            var ar = ['credit_term', 'costcenter_id', 'cleared', 'type'];
	            for (var index = 0; index < ar.length; index++) {
	                form.findField(ar[index]).setReadOnly(1);
	            }
	        }
	        
	        this.onAddressLoad();
	        if (this.positionsPanel) {
	            this.positionsPanel.setTitle(this.app.i18n._('Positions') + ' (' +  (Ext.isArray(this.record.data.positions) ? this.record.data.positions.length : 0) + ')');
	        }
	    },
	    
	    /**
	     * loads the address to the plaintext field
	     */
	    onAddressLoad: function(combo, record) {
	        if (Ext.isEmpty(this.record.get('number'))) {
	            var billingAddress = record;
	            if (! billingAddress && this.record.get('address_id')) {
	                billingAddress = new Tine.Sales.Model.Address(this.record.get('address_id'));
	            }
	            if (billingAddress) {
	                var companyName = this.record.get('customer') ? this.record.get('customer').name : null;
	                if (! companyName && this.record.get('customer_id') && this.record.get('customer_id').name) {
	                    companyName = this.record.get('customer_id').name;
	                }
	                if (! companyName && billingAddress.get('customer')) {
	                    companyName = billingAddress.get('customer') && billingAddress.get('customer').name
	                        ? billingAddress.get('customer').name
	                        : null;
	                }
	                this.form.findField('fixed_address').setValue(Tine.Sales.renderAddress(billingAddress, companyName));
	            }
	        }
	    },
	    
	    /**
	     * loads the full-featured record, if a contract gets selected
	     * 
	     * @param {Tine.widgets.relation.PickerCombo}
	     *            combo
	     * @param {Tine.Sales.Model.Contract}
	     *            record
	     * @param {Number}
	     *            index
	     */
	    onContractLoad: function(combo, record, index) {
	        // here we fetch the record again to have the related customer, where we
	        // can find the address for
	        var proxy = Tine.Sales.contractBackend;
	        
	        proxy.loadRecord(record, {
	            scope: this,
	            success: this.onAfterContractLoad,
	            failure: Tine.Tinebase.ExceptionHandler.handleRequestException
	        });
	    },
	    
	    /**
	     * 
	     * @param {Tine.Sales.Model.Contract}
	     *            record
	     */
	    onAfterContractLoad: function(record, customer) {
	        var record = record ? record : this.record;
	        var relations = record.get('relations'), foundCostCenter = false;
	        var foundCustomer = customer ? customer : null;
	        
	        if (Ext.isArray(relations)) {
	            for (var index = 0; index < relations.length; index++) {
	                if (foundCostCenter && foundCustomer) {
	                    break;
	                }
	                if (! foundCustomer && relations[index].related_model == 'Sales_Model_Customer' && relations[index].type == 'CUSTOMER') {
	                    foundCustomer = relations[index].related_record;
	                } else if (! foundCostCenter && relations[index].related_model == 'Sales_Model_CostCenter' && relations[index].type == 'LEAD_COST_CENTER') {
	                    foundCostCenter = relations[index].related_record;
	                }
	            }
	        }
	
	        // set description to contract title if empty
	        var descriptionField = this.getForm().findField('description');
	        if (descriptionField.getValue() == '') {
	            descriptionField.setValue(record.get('title'));
	        }
	
	        if (foundCustomer) {
	            this.customerPicker.setValue(foundCustomer);
	            this.customerPicker.combo.fireEvent('select');
	            
	            if (this.addressPicker.disabled) {
	                this.addressPicker.enable();
	                
	                if (record.get('billing_address_id')) {
	                    var billingAddress = record.get('billing_address_id');
	                    if (! billingAddress.data) {
	                        billingAddress = new Tine.Sales.Model.Address(billingAddress);
	                    }
	                    billingAddress.set('customer', foundCustomer);
	                    this.addressPicker.setValue(billingAddress);
	                    this.onAddressLoad(this.addressPicker, billingAddress);
	                }
	            } else {
	                this.addressPicker.reset();
	            }
	            this.addressPicker.lastQuery = null;
	            
	            this.addressPicker.additionalFilters = [
	                {field: 'type', operator: 'not', value: 'delivery'},
	                {field: 'customer_id', operator: 'AND', value: [
	                    {field: ':id', operator: 'in', value: [foundCustomer.id]}
	                ]}
	            ];
	            
	            this.getForm().findField('credit_term').setValue(foundCustomer.credit_term);
	
	        } else {
	            Ext.MessageBox.show({
	                buttons: Ext.Msg.OK,
	                icon: Ext.MessageBox.WARNING,
	                title: this.app.i18n._('No customer assigned'), 
	                msg: this.app.i18n._("The selected contract doesn't have a customer assigned, yet. Add a customer to the contract with the contract edit dialog.")
	            });
	        }
	        
	        if (foundCostCenter) {
	            this.getForm().findField('costcenter_id').setValue(foundCostCenter);
	        } else {
	            if (! this.record.get('costcenter_id')) {
	                Ext.MessageBox.show({
	                    buttons: Ext.Msg.OK,
	                    icon: Ext.MessageBox.WARNING,
	                    title: this.app.i18n._('No cost center assigned'), 
	                    msg: this.app.i18n._("The selected contract doesn't have a cost center assigned, yet. Add a cost center to the contract with the contract edit dialog.")
	                });
	            }
	        }
	    },
	    
	    /**
	     * calculates price gross by price net and tax
	     */
	    calcGross: function() {
	        var net = parseFloat(this.priceNetField.getValue());
	        var negative = false;
	        if (net < 0) {
	            net = Math.abs(net);
	            negative = true;
	        }
	        var tax = parseFloat(this.salesTaxField.getValue());
	        tax = Math.round(net * (tax / 100) * 100) / 100;
	        if (negative) {
	            tax = 0 - tax;
	            net = 0 - net;
	        }
	        var gross = net + tax;
	
	        this.priceTaxField.setValue(tax);
	        this.priceGrossField.setValue(gross);
	    },
	    
	    /**
	     * returns dialog
	     * 
	     * NOTE: when this method gets called, all initalisation is done.
	     * 
	     * @return {Object}
	     * @private
	     */
	    getFormItems: function() {
	        var formFieldDefaults = {
	            xtype: 'textfield',
	            anchor: '100%',
	            labelSeparator: '',
	            columnWidth: .5
	        };
	        
	        if (this.record.get('is_auto') == 1) {
	            this.positionsPanel = new Tine.Sales.InvoicePositionPanel({
	                app: this.app,
	                title: null
	            });
	        }
	        
	        this.priceNetField = new Ext.ux.form.NumberField({
	            name: 'price_net',
	            xtype: 'numberfield',
	            decimalSeparator: Tine.Tinebase.registry.get('decimalSeparator'),
	            decimalPrecision: 2,
	            suffix: ' €',
	            fieldLabel: this.app.i18n._('Price Net'),
	            columnWidth: 1/4,
	            listeners: {
	                scope: this,
	                blur: this.calcGross.createDelegate(this)
	            }
	        });
	
	        this.priceTaxField = new Ext.ux.form.NumberField({
	            decimalPrecision: 2,
	            name: 'price_tax',
	            disabled: true,
	            xtype: 'numberfield',
	            suffix: ' €',
	            decimalSeparator: Tine.Tinebase.registry.get('decimalSeparator'),
	            fieldLabel: this.app.i18n._('Price Tax'),
	            columnWidth: 1/4
	        });
	        
	        this.priceGrossField = new Ext.ux.form.NumberField({
	            decimalPrecision: 2,
	            name: 'price_gross',
	            xtype: 'numberfield',
	            suffix: ' €',
	            decimalSeparator: Tine.Tinebase.registry.get('decimalSeparator'),
	            fieldLabel: this.app.i18n._('Price Gross'),
	            columnWidth: 1/4
	        });
	        
	        this.salesTaxField = Ext.create({
	            xtype: 'uxspinner',
	            decimalPrecision: 2,
	            strategy: new Ext.ux.form.Spinner.NumberStrategy({
	                incrementValue : 0.1,
	                alternateIncrementValue: 1,
	                minValue: 0,
	                maxValue: 100,
	                allowDecimals: 2
	            }),
	            name: 'sales_tax',
	            decimalSeparator: Tine.Tinebase.registry.get('decimalSeparator'),
	            regex: /^[0-9]+\.?[0-9]*$/,
	            fieldLabel: this.app.i18n._('Sales Tax (percent)'),
	            columnWidth: 1/4,
	            listeners: {
	                scope: this,
	                spin: this.calcGross.createDelegate(this),
	                blur: this.calcGross.createDelegate(this)
	            }
	        });
	        
	        this.inventoryChange = new Ext.ux.form.NumberField({
	            name: 'inventory_change',
	            xtype: 'numberfield',
	            decimalSeparator: Tine.Tinebase.registry.get('decimalSeparator'),
	            decimalPrecision: 2,
	            suffix: ' €',
	            fieldLabel: this.app.i18n._('Inventory Change'),
	            columnWidth: 1/4,
	            listeners: {
	                scope: this,
	                blur: this.calcGross.createDelegate(this)
	            }
	        });
	        
	        var items = [{
	            title: this.app.i18n._('Invoice'),
	            autoScroll: true,
	            border: false,
	            frame: true,
	            layout: 'border',
	            items: [{
	                region: 'center',
	                layout: 'hfit',
	                border: false,
	                items: [{
	                    xtype: 'fieldset',
	                    layout: 'hfit',
	                    autoHeight: true,
	                    title: this.app.i18n._('Invoice'),
	                    items: [{
	                        xtype: 'columnform',
	                        labelAlign: 'top',
	                        formDefaults: formFieldDefaults,
	                        items: [[
	                        {
	                            name: 'number',
	                            fieldLabel: this.app.i18n._('Invoice Number'),
	                            columnWidth: 1/3,
	                            readOnly: ! Tine.Tinebase.common.hasRight('set_invoice_number', 'Sales'),
	                            emptyText: this.app.i18n._('automatically set...')
	                        }, {
	                            xtype: 'datefield',
	                            name: 'date',
	                            fieldLabel: this.app.i18n._('Date'),
	                            columnWidth: 1/3,
	                            emptyText: (this.record.get('is_auto') == 1) ? this.app.i18n._('automatically set...') : ''
	                        }, new Tine.Tinebase.widgets.keyfield.ComboBox({
	                            app: 'Sales',
	                            keyFieldName: 'invoiceType',
	                            fieldLabel: this.app.i18n._('Type'),
	                            name: 'type',
	                            columnWidth: 1/3
	                        })], [{
	                            name: 'description',
	                            fieldLabel: this.app.i18n._('Description'),
	                            columnWidth: 1,
	                            allowBlank: false
	                        }], [{
	                            fieldLabel: this.app.i18n._('Contract'),
	                            columnWidth: 1,
	                            listeners: {
	                                scope: this,
	                                select: this.onContractLoad
	                            },
	                            editDialog: this,
	                            xtype: 'tinerelationpickercombo',
	                            allowBlank: false,
	                            app: 'Sales',
	                            recordClass: Tine.Sales.Model.Contract,
	                            relationType: 'CONTRACT',
	                            relationDegree: 'sibling',
	                            modelUnique: true,
	                            ref: '../../../../../../../contractPicker',
	                            name: 'contract'
	                        }], [{
	                            fieldLabel: this.app.i18n._('Customer'),
	                            columnWidth: 1,
	                            editDialog: this,
	                            xtype: 'tinerelationpickercombo',
	                            allowBlank: false,
	                            app: 'Sales',
	                            recordClass: Tine.Sales.Model.Customer,
	                            relationType: 'CUSTOMER',
	                            relationDegree: 'sibling',
	                            modelUnique: true,
	                            ref: '../../../../../../../customerPicker',
	                            readOnly: true,
	                            name: 'customer'
	                        }],[
	                            Tine.widgets.form.RecordPickerManager.get('Sales', 'Address', {
	                                fieldLabel: this.app.i18n._('Billing Address'),
	                                name: 'address_id',
	                                ref: '../../../../../../../addressPicker',
	                                columnWidth: 1,
	                                disabled: true,
	                                allowBlank: false,
	                                listeners: {
	                                    scope: this,
	                                    select: this.onAddressLoad.createDelegate(this)
	                                }
	                            })
	                        ], [{
	                            columnWidth: 1,
	                            fieldLabel: '',
	                            name: 'fixed_address',
	                            xtype: 'textarea',
	                            height: 100,
	                            readOnly: true
	                        }
	                        ]]
	                    }]
	                }, {
	                    xtype: 'fieldset',
	                    layout: 'hfit',
	                    autoHeight: true,
	                    title: this.app.i18n._('Miscellaneous'),
	                    items: [{
	                        xtype: 'columnform',
	                        labelAlign: 'top',
	                        formDefaults: formFieldDefaults,
	                        items: [
	                            [{
	                                fieldLabel: this.app.i18n._('Credit Term'),
	                                name: 'credit_term',
	                                allowBlank: false,
	                                xtype: 'uxspinner',
	                                strategy: new Ext.ux.form.Spinner.NumberStrategy({
	                                    incrementValue : 1,
	                                    alternateIncrementValue: 10,
	                                    minValue: 0,
	                                    maxValue: 1024,
	                                    allowDecimals: false
	                                })
	                            }, Tine.widgets.form.RecordPickerManager.get('Sales', 'CostCenter', {
	                                    columnWidth: 1/2,
	                                    blurOnSelect: true,
	                                    allowBlank: false,
	                                    fieldLabel: this.app.i18n.n_('Cost Center', 'Cost Centers', 1),
	                                    name: 'costcenter_id'
	                            })], [
	                                new Tine.Tinebase.widgets.keyfield.ComboBox({
	                                    app: 'Sales',
	                                    keyFieldName: 'invoiceCleared',
	                                    fieldLabel: this.app.i18n._('Cleared'),
	                                    name: 'cleared',
	                                    allowBlank: false,
	                                    columnWidth: 1/3
	                                }), {
	                                    xtype: 'datefield',
	                                    name: 'start_date',
	                                    fieldLabel: this.app.i18n._('Interval Begins'),
	                                    columnWidth: 1/3
	                                }, {
	                                    xtype: 'datefield',
	                                    name: 'end_date',
	                                    fieldLabel: this.app.i18n._('Interval Ends'),
	                                    columnWidth: 1/3
	                                }
	                            ], [
	                                this.priceNetField,
	                                this.salesTaxField,
	                                this.priceTaxField,
	                                this.priceGrossField
	                            ],
	                            [
	                                this.inventoryChange
	                            ]
	                        ]
	                    }]
	                }]
	            }, {
	                // activities and tags
	                layout: 'accordion',
	                animate: true,
	                region: 'east',
	                width: 210,
	                split: true,
	                collapsible: true,
	                collapseMode: 'mini',
	                header: false,
	                margins: '0 5 0 5',
	                border: true,
	                items: [
	                    new Tine.widgets.tags.TagPanel({
	                        app: 'Sales',
	                        border: false,
	                        bodyStyle: 'border:1px solid #B5B8C8;'
	                    })
	                ]
	            }]
	        }];
	        
	        if (this.positionsPanel) {
	            items.push(this.positionsPanel);
	        }
	        
	        items.push(new Tine.widgets.activities.ActivitiesTabPanel({
	            app: this.appName,
	            record_id: this.record.id,
	            record_model: 'Sales_Model_Invoice'
	        }));
	        
	        return {
	            xtype: 'tabpanel',
	            defaults: {
	                hideMode: 'offsets'
	            },
	            border: false,
	            plain: true,
	            activeTab: 0,
	            items: items
	        };
	    }
	});


/***/ },

/***/ 454:
/***/ function(module, exports) {

	/*
	 * Tine 2.0
	 * 
	 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
	 * @author      Alexander Stintzing <a.stintzing@metaways.de>
	 * @copyright   Copyright (c) 2014 Metaways Infosystems GmbH (http://www.metaways.de)
	 */
	Ext.ns('Tine.Sales');
	
	/**
	 * Invoice grid panel
	 * 
	 * @namespace   Tine.Sales
	 * @class       Tine.Sales.InvoiceGridPanel
	 * @extends     Tine.widgets.grid.GridPanel
	 * 
	 * <p>Invoice Grid Panel</p>
	 * <p><pre>
	 * </pre></p>
	 * 
	 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
	 * @author      Alexander Stintzing <a.stintzing@metaways.de>    
	 * 
	 * @param       {Object} config
	 * @constructor
	 * Create a new Tine.Sales.InvoiceGridPanel
	 */
	Tine.Sales.InvoiceGridPanel = Ext.extend(Tine.widgets.grid.GridPanel, {
	    
	    initComponent: function() {
	        this.initDetailsPanel();
	        Tine.Sales.InvoiceGridPanel.superclass.initComponent.call(this);
	    },
	    
	    /**
	     * is called when the component is rendered
	     * @param {} ct
	     * @param {} position
	     */
	    onRender : function(ct, position) {
	        this.billMask = new Ext.LoadMask(ct, {msg: this.app.i18n._('Rebilling Invoice...')});
	        Tine.Sales.ContractGridPanel.superclass.onRender.call(this, ct, position);
	    },
	    
	    /**
	     * @todo: make this generally available (here its more general: Tine.HumanResources.EmployeeGridPanel)
	     * 
	     * returns additional toobar items
	     * 
	     * @return {Array} of Ext.Action
	     */
	    getActionToolbarItems: function() {
	        this.actions_reversal = new Ext.Action({
	            text: this.app.i18n._('Create Reversal Invoice'),
	            iconCls: 'action_reversal',
	            scope: this,
	            disabled: true,
	            allowMultiple: false,
	            handler: this.onReverseInvoice,
	            actionUpdater: function(action, grants, records) {
	                if (records.length == 1 && records[0].get('type') == 'INVOICE' && records[0].get('number')) {
	                    action.enable();
	                } else {
	                    action.disable();
	                }
	            }
	        });
	
	        var reversalButton = Ext.apply(new Ext.Button(this.actions_reversal), {
	            scale: 'medium',
	            rowspan: 2,
	            iconAlign: 'top'
	        });
	        
	        this.actions_rebill = new Ext.Action({
	            text: this.app.i18n._('Rebill Invoice'),
	            iconCls: 'action_rebill',
	            scope: this,
	            disabled: true,
	            allowMultiple: false,
	            handler: this.onRebillInvoice,
	            actionUpdater: function(action, grants, records) {
	                if (records.length == 1 && records[0].get('type') == 'INVOICE' && records[0].get('cleared') != 'CLEARED'  && records[0].get('is_auto')) {
	                    action.enable();
	                } else {
	                    action.disable();
	                }
	            }
	        });
	
	        var rebillButton = Ext.apply(new Ext.Button(this.actions_rebill), {
	            scale: 'medium',
	            rowspan: 2,
	            iconAlign: 'top'
	        });
	        
	        this.actions_merge = new Ext.Action({
	            text: this.app.i18n._('Merge Invoices'),
	            iconCls: 'action_merge',
	            scope: this,
	            disabled: true,
	            allowMultiple: false,
	            handler: this.onMergeInvoice,
	            actionUpdater: function(action, grants, records) {
	                if (records.length == 1 && records[0].get('type') == 'INVOICE' && records[0].get('cleared') != 'CLEARED') {
	                    action.enable();
	                } else {
	                    action.disable();
	                }
	            }
	        });
	
	        var mergeButton = Ext.apply(new Ext.Button(this.actions_merge), {
	            scale: 'medium',
	            rowspan: 2,
	            iconAlign: 'top'
	        });
	        
	        var additionalActions = [this.actions_reversal, this.actions_rebill, this.actions_merge];
	        this.actionUpdater.addActions(additionalActions);
	        return [reversalButton, rebillButton, mergeButton];
	    },
	    
	    /**
	     * is called on reversal invoice action
	     * 
	     * @param {Ext.Action} action
	     * @param {Object} event
	     */
	    onReverseInvoice: function(action, event) {
	        var rows = this.getGrid().getSelectionModel().getSelections();
	        if (rows.length == 1) {
	            var record = rows[0];
	            
	            var cfg = {
	                record: record,
	                createReversal: true
	            };
	            
	            Tine.Sales.InvoiceEditDialog.openWindow(cfg);
	        }
	    },
	    
	    /**
	     * 
	     */
	    onRebillInvoice: function() {
	        var rows = this.getGrid().getSelectionModel().getSelections();
	        
	        if (rows.length != 1) {
	            return;
	        }
	        
	        this.billMask.show();
	        
	        var that = this;
	        
	        var req = Ext.Ajax.request({
	            url : 'index.php',
	            params : { 
	                method: 'Sales.rebillInvoice', 
	                id:     rows[0].id 
	            },
	            success : function(result, request) {
	                that.billMask.hide();
	                that.getGrid().store.reload();
	            },
	            failure : function(exception) {
	                that.billMask.hide();
	                Tine.Tinebase.ExceptionHandler.handleRequestException(exception);
	            },
	            scope: that
	        });
	    },
	    
	    onMergeInvoice: function(action, event) {
	        var rows = this.getGrid().getSelectionModel().getSelections();
	        
	        if (rows.length != 1) {
	            return;
	        }
	        
	        this.billMask.show();
	        
	        var that = this;
	        
	        var req = Ext.Ajax.request({
	            url : 'index.php',
	            params : { 
	                method: 'Sales.mergeInvoice', 
	                id:     rows[0].id 
	            },
	            success : function(result, request) {
	                that.billMask.hide();
	                that.getGrid().store.reload();
	            },
	            failure : function(exception) {
	                that.billMask.hide();
	                Tine.Tinebase.ExceptionHandler.handleRequestException(exception);
	            },
	            scope: that
	        });
	    },
	    
	    /**
	     * add custom items to context menu
	     * 
	     * @return {Array}
	     */
	    getContextMenuItems: function() {
	        var items = [
	            '-',
	            this.actions_reversal,
	            this.actions_rebill,
	            this.actions_merge
	            ];
	        
	        return items;
	    },
	    
	    /**
	     * @private
	     */
	    initDetailsPanel: function() {
	        this.detailsPanel = new Tine.Sales.InvoiceDetailsPanel({
	            grid: this,
	            app: this.app
	        });
	    }
	});


/***/ },

/***/ 455:
/***/ function(module, exports) {

	/*
	 * Tine 2.0
	 * 
	 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
	 * @author      Alexander Stintzing <a.stintzing@metaways.de>
	 * @copyright   Copyright (c) 2014 Metaways Infosystems GmbH (http://www.metaways.de)
	 */
	Ext.ns('Tine.Sales');
	
	/**
	 * InvoicePosition grid panel
	 * 
	 * @namespace   Tine.Sales
	 * @class       Tine.Sales.InvoicePositionGridPanel
	 * @extends     Tine.widgets.grid.GridPanel
	 * 
	 * <p>InvoicePosition Grid Panel</p>
	 * <p><pre>
	 * </pre></p>
	 * 
	 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
	 * @author      Alexander Stintzing <a.stintzing@metaways.de>    
	 * 
	 * @param       {Object} config
	 * @constructor
	 * Create a new Tine.Sales.InvoicePositionGridPanel
	 */
	Tine.Sales.InvoicePositionGridPanel = Ext.extend(Tine.widgets.grid.GridPanel, {
	    storeRemoteSort: false,
	    defaultSortInfo: {field: 'month', direction: 'ASC'},
	    usePagingToolbar: false,
	    frame: false,
	    layout: 'fit',
	    border: true,
	    anchor: '100% 100%',
	    editDialogRecordProperty: 'positions',
	    
	    /**
	     * holds the php model name of the accountable
	     * 
	     * @type string
	     */
	    accountable: null,
	    
	    accountableApplication: null,
	    
	    groupField: null,
	    
	    invoiceId: null,
	    
	    i18nModelsName: null,
	    i18nUnitName: null,
	    unitName: null,
	    renderedSum: null,
	    renderedSumsPerMonth: null,
	    
	    initComponent: function() {
	        this.bbar = [];
	        
	        Tine.Sales.InvoicePositionGridPanel.superclass.initComponent.call(this);
	        
	        this.fillBottomToolbar();
	        
	        this.grid.renderedSumsPerMonth = this.renderedSumsPerMonth;
	        this.grid.view.renderedSumsPerMonth = this.renderedSumsPerMonth;
	        
	        if (this.groupField) {
	            this.doGroup();
	        }
	    },
	    
	    /**
	     * creates the view
	     * 
	     * @return {Object}
	     */
	    createView: function() {
	        var view = Tine.Sales.InvoicePositionGridPanel.superclass.createView.call(this);
	        view.renderedSumsPerMonth = this.renderedSumsPerMonth;
	        return view;
	    },
	    
	    doGroup: function() {
	        if (! this.rendered) {
	            this.doGroup.defer(200, this);
	            return false;
	        }
	        
	        this.store.sort(this.defaultSortInfo);
	        this.store.groupBy(this.groupField);
	    },
	    
	    /**
	     * the export handler
	     */
	    onExport: function() {
	        var downloader = new Ext.ux.file.Download({
	            params: {
	                method: 'Sales.exportInvoicePositions',
	                requestType: 'HTTP',
	                invoiceId: this.invoiceId,
	                accountable: this.accountable
	            }
	        }).start();
	    },
	    
	    initActions: function() {
	        this.action_export = new Ext.Action({
	            requiredGrant: 'addGrant',
	            actionType: 'export',
	            text: String.format(i18n._('Export Records from these Positions') + ' ({0})', this.i18nModelsName),
	            handler: this.onExport.createDelegate(this),
	            iconCls: 'action_export',
	            scope: this
	        });
	    },
	    
	    /**
	     * will be called in Edit Dialog Mode
	     */
	    fillBottomToolbar: function() {
	        var bbar = this.getBottomToolbar();
	        bbar.addButton(new Ext.Button(this.action_export));
	        bbar.addItem('->');
	        bbar.addItem({xtype: 'tbtext', text: this.i18nModelsName + ' (' + this.i18nUnitName + '): ' + '<b>' + this.renderedSum + '</b>'});
	        bbar.addItem({xtype: 'tbspacer', width: 20});
	    }
	});


/***/ },

/***/ 456:
/***/ function(module, exports) {

	/*
	 * Tine 2.0
	 * 
	 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
	 * @author      Alexander Stintzing <a.stintzing@metaways.de>
	 * @copyright   Copyright (c) 2014 Metaways Infosystems GmbH (http://www.metaways.de)
	 */
	Ext.ns('Tine.Sales');
	
	/**
	 * InvoicePosition panel
	 * 
	 * @namespace   Tine.Sales
	 * @class       Tine.Sales.InvoicePositionPanel
	 * @extends     Ext.Panel
	 * 
	 * <p>InvoicePosition Grid Panel</p>
	 * <p><pre>
	 * </pre></p>
	 * 
	 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
	 * @author      Alexander Stintzing <a.stintzing@metaways.de>
	 * 
	 * @param       {Object} config
	 * @constructor
	 * Create a new Tine.Sales.InvoiceGridPanel
	 */
	Tine.Sales.InvoicePositionPanel = Ext.extend(Ext.Panel, {
	    /**
	     * holds positions from the edit dialog records positions property
	     * 
	     * @type array
	     */
	    positions: null,
	    
	    /**
	     * holds the id of the invoice
	     * 
	     * @type string
	     */
	    invoiceId: null,
	    
	    positionsPerAccountable: null,
	    
	    app: null,
	    
	    autoScroll: true,
	    
	    /**
	     * holds all accountables needed
	     * 
	     * @type {Array}
	     */
	    accountables: null,
	    /**
	     * 
	     * @type {Array}
	     */
	    modelsOfAccountable: null,
	    sumsPerAccountable: null,
	    
	    initComponent: function(deferred) {
	        
	        // defer this, otherwise renderers won't have been registered, yet.
	        if (! deferred) {
	            this.initComponent.defer(150, this, [true]);
	            return false;
	        }
	
	        this.accountables = [];
	        this.positionsPerAccountable = {};
	        this.sumsPerAccountable = {};
	        this.modelsOfAccountable = [];
	        
	        Tine.Sales.InvoicePositionPanel.superclass.initComponent.call(this);
	        
	        this.initStoreAndPanels();
	    },
	    
	    /**
	     * creates a store containing all positions
	     */
	    initStoreAndPanels: function() {
	        // interrupt process flow until we got the positions from the editdialog set
	        if (! this.positions) {
	            this.initStoreAndPanels.defer(50, this);
	            return;
	        }
	        
	        if (! Ext.isArray(this.positions)) {
	            Tine.log.error('No Invoice Positions given:');
	            Tine.log.error(this.positions);
	            return;
	        }
	        
	        for (var index = 0; index < this.positions.length; index++) {
	            var key = this.positions[index].model + this.positions[index].unit;
	            var key = key.replace(/\s/g, "");
	            if (this.accountables.indexOf(key) == -1) {
	                this.accountables.push(key);
	                this.modelsOfAccountable[key] = this.positions[index].model;
	                this.positionsPerAccountable[key] = [];
	                this.sumsPerAccountable[key] = 0.0;
	            }
	            
	            this.positionsPerAccountable[key].push(this.positions[index]);
	            this.sumsPerAccountable[key] += parseFloat(this.positions[index].quantity);
	        }
	        
	        // prepeare rendered sums registry
	        Tine.Sales.renderedSumsPerMonth[this.invoiceId] = {};
	        
	        // not needed anymore
	        this.positions = null;
	        
	        for (var index = 0; index < this.accountables.length; index++) {
	            
	            var mypositions = this.positionsPerAccountable[this.accountables[index]];
	            
	            var pseudoRecord     = new Tine.Sales.Model.Invoice({
	                positions: mypositions,
	                id: this.invoiceId
	            });
	            
	            // find out months of the accountable type to decide if grouping is required
	            var mymonths = [];
	            var mysumspermonth = {};
	            for (var index2 = 0; index2 < mypositions.length; index2++) {
	                if (! mysumspermonth['month-' + mypositions[index2].month]) {
	                    mysumspermonth['month-' + mypositions[index2].month] = 0.0;
	                }
	                
	                mysumspermonth['month-' + mypositions[index2].month] += parseFloat(mypositions[index2].quantity);
	                
	                if (mymonths.indexOf(mypositions[index2].month) == -1) {
	                    mymonths.push(mypositions[index2].month);
	                }
	            }
	            var pseudoRecord2 = {data: {unit: mypositions[0]['unit'], model: this.modelsOfAccountable[this.accountables[index]]}};
	            var renderedSumsPerMonth = {};
	            
	            Ext.iterate(mysumspermonth, function(month, sum) {
	                renderedSumsPerMonth[month] = Tine.Sales.renderInvoicePositionQuantity(mysumspermonth[month], null, pseudoRecord2);
	            });
	            
	            Tine.Sales.renderedSumsPerMonth[this.invoiceId][this.accountables[index]] = renderedSumsPerMonth;
	            
	            var pseudoEditDialog = {record: pseudoRecord, app: this.app};
	            
	            var split = this.modelsOfAccountable[this.accountables[index]].split('_Model_');
	            if (Tine[split[0]]) {
	                var model = Tine[split[0]].Model[split[1]];
	                var accountableApplication = Tine.Tinebase.appMgr.get(split[0]);
	                var renderedSum = Tine.Sales.renderInvoicePositionQuantity(this.sumsPerAccountable[this.accountables[index]], null, pseudoRecord2);
	                var grid = new Tine.Sales.InvoicePositionGridPanel({
	                    collapsible: true,
	                    collapsed: true,
	                    editDialog: pseudoEditDialog,
	                    height: (mymonths.length > 1) ? 350 : 250, // if grid will be grouped, make it bigger
	                    title: accountableApplication.i18n._(model.getRecordsName()) +
	                    ' (' + mypositions.length + ')' + ' - ' +
	                    accountableApplication.i18n._(mypositions[0]['unit']) + ': ' + renderedSum,
	                    app: this.app,
	                    i18nModelsName: accountableApplication.i18n._(model.getRecordsName()),
	                    i18nUnitName: accountableApplication.i18n._(mypositions[0]['unit']),
	                    accountable: this.modelsOfAccountable[this.accountables[index]],
	                    accountableApplication: accountableApplication,
	                    invoiceId: this.invoiceId,
	                    renderedSum: renderedSum,
	                    renderedSumsPerMonth: renderedSumsPerMonth,
	                    unitName: mypositions[0]['unit'],
	                    groupField: (mymonths.length > 1) ? 'month' : null
	                });
	
	                this.add(grid);
	            } else {
	                Tine.log.warn('Application for accountable ' + this.accountables[index] + ' not found!');
	            }
	        }
	    }
	});


/***/ },

/***/ 457:
/***/ function(module, exports) {

	/*
	 * Tine 2.0
	 * Sales combo box and store
	 * 
	 * @package     Sales
	 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
	 * @author      Michael Spahn <kontakt@michaelspahn.de>
	 * @copyright   Copyright (c) 2015 Metaways Infosystems GmbH (http://www.metaways.de)
	 *
	 */
	
	Ext.ns('Tine.Sales');
	
	/**
	 * Contract selection combo box
	 * 
	 * @namespace   Tine.Sales
	 * @class       Tine.Sales.InvoiceSearchCombo
	 * @extends     Ext.form.ComboBox
	 * 
	 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
	 * @author      Michael Spahn <kontakt@michaelspahn.de>
	 * @copyright   Copyright (c) 2015 Metaways Infosystems GmbH (http://www.metaways.de)
	 * 
	 * @param       {Object} config
	 * @constructor
	 * Create a new Tine.Sales.InvoiceSearchCombo
	 */
	Tine.Sales.InvoiceSearchCombo = Ext.extend(Tine.Tinebase.widgets.form.RecordPickerComboBox, {
	    
	    allowBlank: false,
	    minListWidth: 200,
	    
	    initComponent: function(){
	        this.recordClass = Tine.Sales.Model.Invoice;
	        this.recordProxy = Tine.Sales.invoiceBackend;
	
	        Tine.Sales.InvoiceSearchCombo.superclass.initComponent.call(this);
	
	        this.displayField = 'fulltext';
	        this.sortBy = 'number';
	    }
	});
	
	Tine.widgets.form.RecordPickerManager.register('Sales', 'Invoice', Tine.Sales.InvoiceSearchCombo);


/***/ },

/***/ 458:
/***/ function(module, exports) {

	/*
	 * Tine 2.0
	 * 
	 * @package     Sales
	 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
	 * @author      Alexander Stintzing <a.stintzing@metaways.de>
	 * @copyright   Copyright (c) 2014 Metaways Infosystems GmbH (http://www.metaways.de)
	 *
	 */
	 
	Ext.namespace('Tine.Sales');
	
	/**
	 * Offer edit dialog
	 * 
	 * @namespace   Tine.Sales
	 * @class       Tine.Sales.OfferEditDialog
	 * @extends     Tine.widgets.dialog.EditDialog
	 * 
	 * <p>Offer Edit Dialog</p>
	 * <p><pre>
	 * </pre></p>
	 * 
	 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
	 * @author      Alexander Stintzing <a.stintzing@metaways.de>
	 * @copyright   Copyright (c) 2013-2014 Metaways Infosystems GmbH (http://www.metaways.de)
	 * 
	 * @param       {Object} config
	 * @constructor
	 * Create a new Tine.Sales.OfferGridPanel
	 */
	Tine.Sales.OfferEditDialog = Ext.extend(Tine.widgets.dialog.EditDialog, {
	    
	    windowWidth: 650,
	    windowHeight: 350,
	
	    displayNotes: true,
	    
	    
	    /**
	     * init component
	     */
	    initComponent: function () {
	        Tine.Sales.OfferEditDialog.superclass.initComponent.call(this);
	    },
	    
	    /**
	     * @see: Tine.widgets.dialog.EditDialog.onRecordLoad
	     */
	    onRecordLoad: function() {
	        Tine.Sales.OfferEditDialog.superclass.onRecordLoad.call(this);
	        
	        if (! this.copyRecord && ! this.record.id) {
	            this.window.setTitle(this.app.i18n._('Add New Offer'));
	        }
	    },
	    
	    /**
	     * called on multiple edit
	     * @return {Boolean}
	     */
	    isMultipleValid: function() {
	        return true;
	    },
	    
	    /**
	     * returns dialog
	     * 
	     * NOTE: when this method gets called, all initalisation is done.
	     */
	    getFormItems: function() {
	        return {
	            xtype: 'tabpanel',
	            border: false,
	            plain:true,
	            activeTab: 0,
	            border: false,
	            defaults: {
	                hideMode: 'offsets'
	            },
	            plugins: [{
	                ptype : 'ux.tabpanelkeyplugin'
	            }],
	            items:[
	                {
	                title: this.app.i18n.n_('Offer', 'Offers', 1),
	                autoScroll: true,
	                border: false,
	                frame: true,
	                layout: 'border',
	                items: [{
	                    region: 'center',
	                    xtype: 'columnform',
	                    labelAlign: 'top',
	                    formDefaults: {
	                        xtype:'textfield',
	                        anchor: '100%',
	                        labelSeparator: '',
	                        columnWidth: 1/2
	                    },
	                    items: [[{
	                        fieldLabel: this.app.i18n._('Number'),
	                        name: 'number',
	                        disabled: false,
	                        allowBlank: true // autoset if empty
	                    },{
	                        fieldLabel: this.app.i18n._('Title'),
	                        name: 'title',
	                        allowBlank: false
	                    }], [{
	                            xtype: 'tinerelationpickercombo',
	                            fieldLabel: this.app.i18n._('Customer'),
	                            editDialog: this,
	                            allowBlank: false,
	                            app: 'Sales',
	                            recordClass: Tine.Sales.Model.Customer,
	                            relationType: 'OFFER',
	                            relationDegree: 'sibling',
	                            modelUnique: true,
	                            columnWidth: 1
	                        }]
	                    ]
	                }, {
	                    // activities and tags
	                    layout: 'accordion',
	                    animate: true,
	                    region: 'east',
	                    width: 210,
	                    split: true,
	                    collapsible: true,
	                    collapseMode: 'mini',
	                    header: false,
	                    margins: '0 5 0 5',
	                    border: true,
	                    items: [
	                        new Ext.Panel({
	                            title: this.app.i18n._('Description'),
	                            iconCls: 'descriptionIcon',
	                            layout: 'form',
	                            labelAlign: 'top',
	                            border: false,
	                            items: [{
	                                style: 'margin-top: -4px; border 0px;',
	                                labelSeparator: '',
	                                xtype: 'textarea',
	                                name: 'description',
	                                hideLabel: true,
	                                grow: false,
	                                preventScrollbars: false,
	                                anchor: '100% 100%',
	                                emptyText: this.app.i18n._('Enter description'),
	                                requiredGrant: 'editGrant'
	                            }]
	                        }),
	                        new Tine.widgets.tags.TagPanel({
	                            app: 'Sales',
	                            border: false,
	                            bodyStyle: 'border:1px solid #B5B8C8;'
	                        })
	                    ]
	                }]
	            }, new Tine.widgets.activities.ActivitiesTabPanel({
	                app: this.appName,
	                record_id: this.record.id,
	                record_model: 'Sales_Model_Offer'
	            })]
	        };
	    }
	});


/***/ },

/***/ 459:
/***/ function(module, exports) {

	/*
	 * Tine 2.0
	 * Sales combo box and store
	 * 
	 * @package     Sales
	 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
	 * @author      Michael Spahn <kontakt@michaelspahn.de>
	 * @copyright   Copyright (c) 2015 Metaways Infosystems GmbH (http://www.metaways.de)
	 *
	 */
	
	Ext.ns('Tine.Sales');
	
	/**
	 * Contract selection combo box
	 * 
	 * @namespace   Tine.Sales
	 * @class       Tine.Sales.OfferSearchCombo
	 * @extends     Ext.form.ComboBox
	 * 
	 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
	 * @author      Michael Spahn <kontakt@michaelspahn.de>
	 * @copyright   Copyright (c) 2915 Metaways Infosystems GmbH (http://www.metaways.de)
	 * 
	 * @param       {Object} config
	 * @constructor
	 * Create a new Tine.Sales.OfferSearchCombo
	 */
	Tine.Sales.OfferSearchCombo = Ext.extend(Tine.Tinebase.widgets.form.RecordPickerComboBox, {
	    
	    allowBlank: false,
	    minListWidth: 200,
	    
	    initComponent: function(){
	        this.recordClass = Tine.Sales.Model.Offer;
	        this.recordProxy = Tine.Sales.offerBackend;
	
	        Tine.Sales.OfferSearchCombo.superclass.initComponent.call(this);
	        
	        this.displayField = 'fulltext';
	        this.sortBy = 'number';
	    }
	});
	
	Tine.widgets.form.RecordPickerManager.register('Sales', 'Offer', Tine.Sales.OfferSearchCombo);


/***/ },

/***/ 460:
/***/ function(module, exports) {

	/*
	 * Tine 2.0
	 * 
	 * @package     Sales
	 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
	 * @author      Alexander Stintzing <a.stintzing@metaways.de>
	 * @copyright   Copyright (c) 2014 Metaways Infosystems GmbH (http://www.metaways.de)
	 *
	 */
	 
	Ext.namespace('Tine.Sales');
	
	/**
	 * OrderConfirmation edit dialog
	 * 
	 * @namespace   Tine.Sales
	 * @class       Tine.Sales.OrderConfirmationEditDialog
	 * @extends     Tine.widgets.dialog.EditDialog
	 * 
	 * <p>OrderConfirmation Edit Dialog</p>
	 * <p><pre>
	 * </pre></p>
	 * 
	 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
	 * @author      Alexander Stintzing <a.stintzing@metaways.de>
	 * @copyright   Copyright (c) 2013-2014 Metaways Infosystems GmbH (http://www.metaways.de)
	 * 
	 * @param       {Object} config
	 * @constructor
	 * Create a new Tine.Sales.OrderConfirmationGridPanel
	 */
	Tine.Sales.OrderConfirmationEditDialog = Ext.extend(Tine.widgets.dialog.EditDialog, {
	    
	    windowWidth: 650,
	    windowHeight: 350,
	
	    displayNotes: true,
	    
	    
	    /**
	     * init component
	     */
	    initComponent: function () {
	        Tine.Sales.OrderConfirmationEditDialog.superclass.initComponent.call(this);
	    },
	
	    /**
	     * called on multiple edit
	     * @return {Boolean}
	     */
	    isMultipleValid: function() {
	        return true;
	    },
	    
	    /**
	     * @see: Tine.widgets.dialog.EditDialog.onRecordLoad
	     */
	    onRecordLoad: function() {
	        Tine.Sales.OrderConfirmationEditDialog.superclass.onRecordLoad.call(this);
	        
	        if (! this.copyRecord && ! this.record.id) {
	            this.window.setTitle(this.app.i18n._('Add New Order Confirmation'));
	        }
	    },
	    
	    /**
	     * returns dialog
	     * 
	     * NOTE: when this method gets called, all initalisation is done.
	     */
	    getFormItems: function() {
	        return {
	            xtype: 'tabpanel',
	            border: false,
	            plain:true,
	            activeTab: 0,
	            border: false,
	            defaults: {
	                hideMode: 'offsets'
	            },
	            plugins: [{
	                ptype : 'ux.tabpanelkeyplugin'
	            }],
	            items:[
	                {
	                title: this.app.i18n.n_('Order Confirmation', 'Order Confirmations', 1),
	                autoScroll: true,
	                border: false,
	                frame: true,
	                layout: 'border',
	                items: [{
	                    region: 'center',
	                    xtype: 'columnform',
	                    labelAlign: 'top',
	                    formDefaults: {
	                        xtype:'textfield',
	                        anchor: '100%',
	                        labelSeparator: '',
	                        columnWidth: 1/2
	                    },
	                    items: [[{
	                        fieldLabel: this.app.i18n._('Number'),
	                        name: 'number',
	                        disabled: (! Tine.Tinebase.common.hasRight('change', 'Sales', 'oc_number') && this.record.id),
	                        allowBlank: true // autoset if empty
	                    },{
	                        fieldLabel: this.app.i18n._('Title'),
	                        name: 'title',
	                        allowBlank: false
	                    }], [{
	                            xtype: 'tinerelationpickercombo',
	                            fieldLabel: this.app.i18n._('Contract'),
	                            editDialog: this,
	                            allowBlank: false,
	                            app: 'Sales',
	                            recordClass: Tine.Sales.Model.Contract,
	                            relationType: 'CONTRACT',
	                            relationDegree: 'sibling',
	                            modelUnique: true,
	                            columnWidth: 1
	                        }], [{
	                            xtype: 'tinerelationpickercombo',
	                            fieldLabel: this.app.i18n._('Offer'),
	                            editDialog: this,
	                            allowBlank: true,
	                            app: 'Sales',
	                            recordClass: Tine.Sales.Model.Offer,
	                            relationType: 'OFFER',
	                            relationDegree: 'sibling',
	                            modelUnique: true,
	                            columnWidth: 1
	                        }]
	                    ]
	                }, {
	                    // activities and tags
	                    layout: 'accordion',
	                    animate: true,
	                    region: 'east',
	                    width: 210,
	                    split: true,
	                    collapsible: true,
	                    collapseMode: 'mini',
	                    header: false,
	                    margins: '0 5 0 5',
	                    border: true,
	                    items: [
	                        new Ext.Panel({
	                            title: this.app.i18n._('Description'),
	                            iconCls: 'descriptionIcon',
	                            layout: 'form',
	                            labelAlign: 'top',
	                            border: false,
	                            items: [{
	                                style: 'margin-top: -4px; border 0px;',
	                                labelSeparator: '',
	                                xtype: 'textarea',
	                                name: 'description',
	                                hideLabel: true,
	                                grow: false,
	                                preventScrollbars: false,
	                                anchor: '100% 100%',
	                                emptyText: this.app.i18n._('Enter description'),
	                                requiredGrant: 'editGrant'
	                            }]
	                        }),
	                        new Tine.widgets.tags.TagPanel({
	                            app: 'Sales',
	                            border: false,
	                            bodyStyle: 'border:1px solid #B5B8C8;'
	                        })
	                    ]
	                }]
	            }, new Tine.widgets.activities.ActivitiesTabPanel({
	                app: this.appName,
	                record_id: this.record.id,
	                record_model: 'Sales_Model_OrderConfirmation'
	            })]
	        };
	    }
	});


/***/ },

/***/ 461:
/***/ function(module, exports) {

	/**
	 * Tine 2.0
	 * 
	 * @package     Sales
	 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
	 * @author      Alexander Stintzing <a.stintzing@metaways.de>
	 * @copyright   Copyright (c) 2014 Metaways Infosystems GmbH (http://www.metaways.de)
	 */
	 
	Ext.ns('Tine.Sales');
	
	/**
	 * @namespace   Tine.Sales
	 * @class       Tine.Sales.OrderConfirmationFilterModel
	 * @extends     Tine.widgets.grid.ForeignRecordFilter
	 * 
	 * @author      Alexander Stintzing <a.stintzing@metaways.de>
	 */
	Tine.Sales.OrderConfirmationFilterModel = Ext.extend(Tine.widgets.grid.ForeignRecordFilter, {
	    
	    // private
	    field: 'order_confirmation',
	    valueType: 'relation',
	    
	    /**
	     * @private
	     */
	    initComponent: function() {
	        this.app = Tine.Tinebase.appMgr.get('Sales');
	        this.label = this.app.i18n._('Order Confirmation');
	        this.foreignRecordClass = Tine.Sales.Model.OrderConfirmation;
	        this.pickerConfig = {emptyText: this.app.i18n._('without order confirmation'), allowBlank: true};
	        Tine.Sales.CustomerFilterModel.superclass.initComponent.call(this);
	    }
	});
	
	Tine.widgets.grid.FilterToolbar.FILTERS['sales.offer-order_confirmation']  = Tine.Sales.OrderConfirmationFilterModel;

/***/ },

/***/ 462:
/***/ function(module, exports) {

	/*
	 * Tine 2.0
	 * Sales combo box and store
	 * 
	 * @package     Sales
	 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
	 * @author      Michael Spahn <kontakt@michaelspahn.de>
	 * @copyright   Copyright (c) 2015 Metaways Infosystems GmbH (http://www.metaways.de)
	 *
	 */
	
	Ext.ns('Tine.Sales');
	
	/**
	 * OrderConfirmation selection combo box
	 * 
	 * @namespace   Tine.Sales
	 * @class       Tine.Sales.OrderConfirmationSearchCombo
	 * @extends     Ext.form.ComboBox
	 * 
	 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
	 * @author      Michael Spahn <kontakt@michaelspahn.de>
	 * @copyright   Copyright (c) 2015 Metaways Infosystems GmbH (http://www.metaways.de)
	 * 
	 * @param       {Object} config
	 * @constructor
	 * Create a new Tine.Sales.OrderConfirmationSearchCombo
	 */
	Tine.Sales.OrderConfirmationSearchCombo = Ext.extend(Tine.Tinebase.widgets.form.RecordPickerComboBox, {
	    
	    allowBlank: false,
	    minListWidth: 200,
	    
	    //private
	    initComponent: function(){
	        this.recordClass = Tine.Sales.Model.OrderConfirmation;
	        this.recordProxy = Tine.Sales.orderconfirmationBackend;
	
	        Tine.Sales.OrderConfirmationSearchCombo.superclass.initComponent.call(this);
	
	        this.displayField = 'fulltext';
	        this.sortBy = 'number';
	    }
	});
	
	Tine.widgets.form.RecordPickerManager.register('Sales', 'OrderConfirmation', Tine.Sales.OrderConfirmationSearchCombo);


/***/ },

/***/ 463:
/***/ function(module, exports) {

	/*
	 * Tine 2.0
	 * 
	 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
	 * @author      Alexander Stintzing <a.stintzing@metaways.de>
	 * @copyright   Copyright (c) 2014-2017 Metaways Infosystems GmbH (http://www.metaways.de)
	 */
	Ext.ns('Tine.Sales');
	
	/**
	 * @namespace   Tine.Sales
	 * @class       Tine.Sales.ProductAggregateGridPanel
	 * @extends     Tine.widgets.grid.PickerGridPanel
	 * 
	 * <p>Product aggregate grid panel</p>
	 * <p></p>
	 * 
	 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
	 * @author      Alexander Stintzing <a.stintzing@metaways.de>
	 * 
	 * @param       {Object} config
	 * @constructor
	 * Create a new Tine.Sales.ProductAggregateGridPanel
	 */
	Tine.Sales.ProductAggregateGridPanel = Ext.extend(Tine.widgets.grid.QuickaddGridPanel, {
	    /*
	     * config
	     */
	    frame: true,
	    border: true,
	    autoScroll: true,
	    layout: 'fit',
	    defaultSortInfo: {field: 'product_id', direction: 'DESC'},
	    quickaddMandatory: 'product_id',
	    clicksToEdit: 1,
	    enableColumnHide:false,
	    enableColumnMove:false,
	    enableHdMenu: false,
	    recordClass: 'Sales.ProductAggregate',
	    validate: true,
	
	    /*
	     * public
	     */
	    app: null,
	    
	    /**
	     * the calling editDialog
	     * Tine.Sales.ContractEditDialog
	     */
	    editDialog: null,
	    
	    /**
	     * initializes the component
	     */
	    initComponent: function() {
	        this.title = this.i18nTitle = this.app.i18n.ngettext('Product', 'Products', 2),
	        
	        Tine.Sales.ProductAggregateGridPanel.superclass.initComponent.call(this);
	        this.store.sortInfo = this.defaultSortInfo;
	        
	        
	        
	        this.on('afteredit', this.onAfterEdit, this);
	        this.editDialog.on('load', this.loadRecord, this);
	        
	        // custom sort for product_id
	        this.store.sortData = (function(f, direction) {
	            if (f !== 'product_id') {
	                Ext.data.Store.prototype.sortData.call(this.store, f, direction);
	            } else {
	                direction = direction || 'ASC';
	                var fn = function(r1, r2) {
	                    var v1 = r1.data.product_id.description,
	                        v2 = r2.data.product_id.description;
	                    
	                    return v1 > v2 ? 1 : (v1 < v2 ? -1 : 0);
	                };
	                
	                this.store.data.sort(direction, fn);
	            }
	        }).createDelegate(this);
	        
	        this.store.sort();
	        
	        this.on('beforeedit', this.onBeforeRowEdit, this);
	        
	        // sync record on these events
	        this.store.on('update', this.syncStoreToRecord.createDelegate(this));
	        this.store.on('add', this.syncStoreToRecord.createDelegate(this));
	        this.store.on('remove', this.syncStoreToRecord.createDelegate(this));
	    },
	    
	    /**
	     * 
	     * @param {} store
	     * @param {} record
	     * @param {} operation
	     */
	    syncStoreToRecord: function(store, record, operation) {
	        if (this.editDialog.record) {
	            var items = [];
	            store.each(function(item) {
	                if (! item.data.last_autobill) {
	                    item.data.last_autobill = null;
	                }
	                items.push(item.data);
	            });
	            this.editDialog.record.set('products', items);
	            
	            this.updateTitle(items.length);
	        }
	    },
	    
	    /**
	     * updates the title of the tab by adding the number of containing records in braces
	     * 
	     * @param {Number} count
	     */
	    updateTitle: function(count) {
	        count = Ext.isNumber(count) ? count : this.store.getCount();
	        this.setTitle(this.i18nTitle + ' (' + count + ')');
	    },
	    
	    /**
	     * loads the existing ProductAggregates into the store
	     */
	    loadRecord: function() {
	        var c = this.editDialog.record.get('products');
	        if (Ext.isArray(c)) {
	            Ext.each(c, function(ar) {
	                this.store.addSorted(new this.recordClass(ar));
	            }, this);
	        }
	    },
	    
	    /**
	     * new entry event -> add new record to store
	     * @see Tine.widgets.grid.QuickaddGridPanel
	     * @param {Object} recordData
	     * @return {Boolean}
	     */
	    onNewentry: function(recordData) {
	        recordData.contract_id = this.editDialog.record.get('id');
	        var relatedRecord = this.productQuickadd.store.getById(this.productQuickadd.getValue());
	        recordData.product_id = relatedRecord.data;
	        Tine.Sales.ProductAggregateGridPanel.superclass.onNewentry.call(this, recordData);  
	    },
	    
	    /**
	     * returns column model
	     * 
	     * @return Ext.grid.ColumnModel
	     * @private
	     */
	    getColumnModel: function() {
	        this.productEditor = Tine.widgets.form.RecordPickerManager.get('Sales', 'Product', { allowBlank: true});
	        
	        this.quantityEditor = new Ext.ux.form.Spinner({
	            fieldLabel: this.app.i18n._('Quantity'),
	            name: 'quantity',
	            allowBlank: true,
	            strategy: new Ext.ux.form.Spinner.NumberStrategy({
	                incrementValue : 1,
	                minValue: 1,
	                maxValue: 9999999,
	                allowDecimals: false
	            })
	        });
	
	        
	        this.intervalEditor = new Ext.ux.form.Spinner({
	            fieldLabel: this.app.i18n._('Interval'),
	            name: 'interval',
	            allowBlank: false,
	            strategy: new Ext.ux.form.Spinner.NumberStrategy({
	                incrementValue : 1,
	                minValue: 1,
	                maxValue: 36,
	                allowDecimals: false
	            })
	        });
	        
	        this.productQuickadd = Tine.widgets.form.RecordPickerManager.get('Sales', 'Product', {allowBlank: true});
	        this.quantityQuickadd = new Ext.ux.form.Spinner({
	            fieldLabel: this.app.i18n._('Quantity'),
	            name: 'quantity',
	            allowBlank: true,
	            value: null,
	            strategy: new Ext.ux.form.Spinner.NumberStrategy({
	                incrementValue : 1,
	                minValue: 1,
	                maxValue: 9999,
	                allowDecimals: false
	            })
	        });
	        this.intervalQuickadd = new Ext.ux.form.Spinner({
	            fieldLabel: this.app.i18n._('Interval'),
	            name: 'interval',
	            allowBlank: false,
	            value: 1,
	            strategy: new Ext.ux.form.Spinner.NumberStrategy({
	                incrementValue : 1,
	                minValue: 1,
	                maxValue: 36,
	                allowDecimals: false
	            })
	        });
	        
	        var cmp = {
	            name: 'billing_point',
	            fieldLabel: this.app.i18n._('Billing Point'),
	            xtype: 'combo',
	            value: 'begin',
	            store: [
	                ['begin', this.app.i18n._('begin') ],
	                [  'end', this.app.i18n._('end') ]
	            ]
	        };
	        
	        this.billingPointEditor = new Ext.form.ComboBox(cmp);
	        this.billingPointQuickadd = new Ext.form.ComboBox(cmp);
	        
	        var columns = [
	            {id: 'product_id', dataIndex: 'product_id', type: Tine.Sales.Model.ProductAggregate, header: this.app.i18n._('Product'),
	                 quickaddField: this.productQuickadd, renderer: this.renderProductAggregate,
	                 editor: this.productEditor, scope: this, width: 270
	            },
	            {id: 'quantity', editor: this.quantityEditor, renderer: this.renderQuantity, quickaddField: this.quantityQuickadd, dataIndex: 'quantity', header: this.app.i18n._('Quantity'),  scope: this, width: 54},
	            {id: 'interval', editor: this.intervalEditor, quickaddField: this.intervalQuickadd, dataIndex: 'interval', header: this.app.i18n._('Interval'),  scope: this, width: 60},
	            {id: 'billing_point', renderer: this.renderBillingPoint , editor: this.billingPointEditor, quickaddField: this.billingPointQuickadd, dataIndex: 'billing_point', header: this.app.i18n._('Billing Point'),  scope: this, width: 140},
	            {id: 'start_date', renderer: Tine.Tinebase.common.dateRenderer, editor: new Ext.ux.form.ClearableDateField(), quickaddField: new Ext.ux.form.ClearableDateField(), dataIndex: 'start_date', header: this.app.i18n._('Start Date'),  scope: this, width: 110},
	            {id: 'end_date', renderer: Tine.Tinebase.common.dateRenderer, editor: new Ext.ux.form.ClearableDateField(), quickaddField: new Ext.ux.form.ClearableDateField(), dataIndex: 'end_date', header: this.app.i18n._('End Date'),  scope: this, width: 110},
	            {id: 'last_autobill', renderer: Tine.Tinebase.common.dateRenderer, editor: new Ext.ux.form.ClearableDateField(), hidden: true, dataIndex: 'last_autobill', header: this.app.i18n._('Last Autobill'),  scope: this, width: 110},
	            {id: 'creation_time',      header: i18n._('Creation Time'),         dataIndex: 'creation_time',         renderer: Tine.Tinebase.common.dateRenderer,        hidden: true, sortable: true },
	            {id: 'created_by',         header: i18n._('Created By'),            dataIndex: 'created_by',            renderer: Tine.Tinebase.common.usernameRenderer,    hidden: true, sortable: true },
	            {id: 'last_modified_time', header: i18n._('Last Modified Time'),    dataIndex: 'last_modified_time',    renderer: Tine.Tinebase.common.dateRenderer,        hidden: true, sortable: true },
	            {id: 'last_modified_by',   header: i18n._('Last Modified By'),      dataIndex: 'last_modified_by',      renderer: Tine.Tinebase.common.usernameRenderer,    hidden: true, sortable: true }
	        ];
	
	        return new Ext.grid.ColumnModel({
	            defaults: {
	                sortable: true,
	                width: 160,
	                editable: true
	            }, 
	            columns: columns
	       });
	    },
	    
	    /**
	     * renders the billing point
	     * 
	     * @param {String} value
	     * @return {String}
	     */
	    renderBillingPoint: function(value) {
	        if (value == 'end') {
	            return this.app.i18n._('end');
	        } else {
	            return this.app.i18n._('begin');
	        }
	    },
	    
	    renderQuantity: function(value, cell, record) {
	        // product does not bill an accountable -> return qty
	        var ac = record.get('product_id').accountable;
	        if (! ac || ac == 'Sales_Model_ProductAggregate' || ac == 'Sales_Model_Product') {
	            return value;
	        }
	        
	        return '';
	    },
	    
	    /**
	     * is called on after edit to set related records
	     * @param {} o
	     */
	    onAfterEdit: function(o) {  
	        switch (o.field) {
	            case 'quantity':
	                o.record.set('quantity', o.value);
	                break;
	            case 'product_id':
	                var relatedRecord = this.productEditor.store.getById(o.value);
	                o.record.set('product_id', relatedRecord.data);
	                break;
	            case 'interval':
	                o.record.set('interval', o.value);
	                break;
	            case 'billing_point':
	                var val = o.value;
	                if (Ext.isEmpty(val)) {
	                    val = 'begin';
	                }
	                o.record.set('billing_point', val);
	                break;
	            default: // do nothing
	        }
	    },
	    
	    /**
	     * creates the special editors
	     * @param {} o
	     */
	    onBeforeRowEdit: function(o) {
	        if (o.field == 'quantity') {
	            // product does not bill an accountable -> return qty
	            var ac = o.record.get('product_id').accountable;
	
	            if (!(! ac || ac == 'Sales_Model_ProductAggregate' || ac == 'Sales_Model_Product')) {
	                return false; 
	            } else {
	                return true;
	            }
	        }
	        
	        return;
	    },
	    
	    /**
	     * renders the cost center
	     * @param {Object} value
	     * @param {Object} row
	     * @param {Tine.Tinebase.data.Record} record
	     * 
	     * return {String}
	     */
	    renderProductAggregate: function(value, row, record) {
	        return '<span class="tine-recordclass-gridicon SalesProduct">&nbsp;</span>' + (record ? record.getTitle() : '');
	    },
	
	    /**
	     * @private
	     */
	    initActions: function() {
	        Tine.Sales.ProductAggregateGridPanel.superclass.initActions.call(this);
	
	        // TODO prevent multiselect and change of records without defined attributes
	        this.editAttributesAction = new Ext.Action({
	            text: this.app.i18n._('Edit Attributes'),
	            iconCls: 'actionEdit',
	            handler : this.onEditAttributes,
	            scope: this
	        });
	    },
	
	    /**
	     * edit attributes: open modal window with key/value grid
	     */
	    onEditAttributes: function() {
	        var selectedRows = this.getSelectionModel().getSelections(),
	            selectedRecord = selectedRows[0],
	            attributeKeys = this.getAttributeKeysFromAccountable(selectedRecord);
	
	        if (attributeKeys.length == 0) {
	            // no attribute keys -> return
	            return;
	        }
	
	        this.initAttributesCombos(attributeKeys);
	        var cols = [
	            {
	                id: 'id',
	                // TODO pass this.app.i18n
	                header: i18n._('Attribute'),
	                dataIndex: 'id',
	                hideable: false,
	                sortable: false,
	                editor: this.attributeEditor,
	                quickaddField: this.attributesQuickadd
	            }, {
	                id: 'value',
	                header: i18n._('Value'),
	                dataIndex: 'value',
	                hideable: false,
	                sortable: false,
	                editor: new Ext.form.TextField({}),
	                quickaddField: new Ext.form.TextField({
	                    emptyText: i18n._('Add a New Value...')
	                })
	            }
	        ];
	
	        this.attributesGrid = new Tine.Tinebase.widgets.keyfield.ConfigGrid({
	            hasDefaultCheck: false,
	            cols: cols
	        });
	        this.loadAttributesFromRecord(selectedRecord, attributeKeys);
	
	        this.attributesWindow = Tine.WindowFactory.getWindow({
	            modal: true,
	            width: 500,
	            height: 320,
	            border: false,
	            // maybe we should create a common ancestor for ConfigGrid and json attributes grid
	            items: this.attributesGrid,
	            fbar: ['->', {
	                text: i18n._('Cancel'),
	                minWidth: 70,
	                scope: this,
	                handler: this.onAttributesWindowClose,
	                iconCls: 'action_cancel'
	            }, {
	                text: i18n._('OK'),
	                minWidth: 70,
	                scope: this,
	                handler: this.onAttributesWindowOK,
	                iconCls: 'action_applyChanges'
	            }]
	        });
	    },
	
	    initAttributesCombos: function(attributeKeys) {
	        var storeData = [];
	        Ext.each(attributeKeys, function(key) {
	            // TODO add translation?
	            storeData.push([key, key]);
	        });
	        var cmp = {
	            name: 'attributes',
	            fieldLabel: this.app.i18n._('Attribute'),
	            xtype: 'combo',
	            value: 'vcpus',
	            store: storeData
	        };
	
	        this.attributeEditor = new Ext.form.ComboBox(cmp);
	        this.attributesQuickadd = new Ext.form.ComboBox(cmp);
	    },
	
	    getAttributeKeysFromAccountable: function(record) {
	        var accountable = record.get('product_id').accountable;
	
	        if (accountable == 'WebAccounting_Model_ProxmoxVM') {
	            // TODO get accountable keys from modelconfig / registry (Tine.WebAccounting.registry.get('models')[MODEL])
	            return ['vcpus', 'memory', 'storage'];
	        } else {
	            return [];
	        }
	    },
	
	    /**
	     * load data from prod agg record into grid store
	     */
	    loadAttributesFromRecord: function(record, attributeKeys)
	    {
	        var attributes = record.get('json_attributes'),
	            value = {'records': []};
	
	        Ext.each(attributeKeys, function(key) {
	            if (attributes && attributes[key]) {
	                value.records.push({
	                    id: key,
	                    value: attributes[key]
	                });
	            }
	        });
	        this.attributesGrid.setValue(value);
	    },
	
	    /**
	     * put data from grid into prod agg record
	     */
	    onAttributesWindowOK: function () {
	        var selectedRows = this.getSelectionModel().getSelections(),
	            selectedRecord = selectedRows[0],
	            records = this.attributesGrid.getValue().records,
	            attributes = {};
	
	        Ext.each(records, function(attribute) {
	            attributes[attribute.id] = attribute.value;
	        }, this);
	
	        selectedRecord.set('json_attributes', attributes);
	        selectedRecord.commit();
	
	        this.onAttributesWindowClose();
	    },
	
	    /**
	     * Close store Window
	     */
	    onAttributesWindowClose: function () {
	        this.attributesWindow.purgeListeners();
	        this.attributesWindow.close();
	    },
	
	    getContextMenuItems: function() {
	        return [this.editAttributesAction];
	    }
	});


/***/ },

/***/ 464:
/***/ function(module, exports) {

	/*
	 * Tine 2.0
	 * 
	 * @package     Sales
	 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
	 * @author      Philipp Schuele <p.schuele@metaways.de>
	 * @copyright   Copyright (c) 2009 Metaways Infosystems GmbH (http://www.metaways.de)
	 *
	 */
	 
	Ext.namespace('Tine.Sales');
	
	/**
	 * Product edit dialog
	 * 
	 * @namespace   Tine.Sales
	 * @class       Tine.Sales.ProductEditDialog
	 * @extends     Tine.widgets.dialog.EditDialog
	 * 
	 * <p>Product Edit Dialog</p>
	 * <p><pre>
	 * TODO         make category a combobox + get data from settings
	 * </pre></p>
	 * 
	 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
	 * @author      Philipp Schuele <p.schuele@metaways.de>
	 * @copyright   Copyright (c) 2009 Metaways Infosystems GmbH (http://www.metaways.de)
	 * 
	 * @param       {Object} config
	 * @constructor
	 * Create a new Tine.Sales.ProductGridPanel
	 */
	Tine.Sales.ProductEditDialog = Ext.extend(Tine.widgets.dialog.EditDialog, {
	    windowWidth: 800,
	    windowHeight: 600,
	    displayNotes: true,
	    
	    onRecordLoad: function() {
	        Tine.Sales.ProductEditDialog.superclass.onRecordLoad.call(this);
	        
	        if (! this.copyRecord && ! this.record.id) {
	            this.window.setTitle(this.app.i18n._('Add New Product'));
	        }
	    },
	    /**
	     * returns dialog
	     * 
	     * NOTE: when this method gets called, all initalisation is done.
	     */
	    getFormItems: function() {
	        return {
	            xtype: 'tabpanel',
	            border: false,
	            plain:true,
	            activeTab: 0,
	            border: false,
	            plugins: [{
	                ptype : 'ux.tabpanelkeyplugin'
	            }],
	            items:[
	                {
	                title: this.app.i18n.n_('Product', 'Products', 1),
	                autoScroll: true,
	                border: false,
	                frame: true,
	                layout: 'border',
	                items: [{
	                    region: 'center',
	                    xtype: 'columnform',
	                    labelAlign: 'top',
	                    formDefaults: {
	                        xtype:'textfield',
	                        anchor: '100%',
	                        labelSeparator: '',
	                        columnWidth: 1/3
	                    },
	                    items: [[{
	                        name: 'number',
	                        fieldLabel: this.app.i18n._('Product Number'),
	                        columnWidth: 1/3
	                    }, {
	                        name: 'gtin',
	                        fieldLabel: this.app.i18n._('GTIN'),
	                        columnWidth: 1/3
	                    }, new Tine.Tinebase.widgets.keyfield.ComboBox({
	                        app: 'Sales',
	                        keyFieldName: 'productCategory',
	                        fieldLabel: this.app.i18n._('Category'),
	                        name: 'category',
	                        columnWidth: 1/3
	                    })], [{
	                        columnWidth: 1,
	                        fieldLabel: this.app.i18n._('Name'),
	                        name: 'name',
	                        allowBlank: false
	                    }], [{
	                        columnWidth: 1,
	                        fieldLabel: this.app.i18n._('Manufacturer'),
	                        name: 'manufacturer'
	                    }], [{
	                        xtype: 'extuxmoneyfield',
	                        fieldLabel: this.app.i18n._('Purchaseprice'),
	                        name: 'purchaseprice',
	                        allowNegative: false,
	                        allowBlank: true
	                    }, {
	                        xtype: 'extuxmoneyfield',
	                        fieldLabel: this.app.i18n._('Salesprice'),
	                        name: 'salesprice',
	                        allowNegative: false,
	                        allowBlank: true
	                    }, this.getAccountableCombo()],
	                    [{
	                        columnWidth: 0.5,
	                        name: 'lifespan_start',
	                        xtype: 'datefield',
	                        fieldLabel: this.app.i18n._('Lifespan start')
	                    }, {
	                        columnWidth: 0.5,
	                        xtype: 'datefield',
	                        name: 'lifespan_end',
	                        fieldLabel: this.app.i18n._('Lifespan end')
	                    }], [{
	                        columnWidth: 1,
	                        fieldLabel: this.app.i18n._('Description'),
	                        emptyText: this.app.i18n._('Enter description...'),
	                        name: 'description',
	                        xtype: 'textarea',
	                        height: 150
	                    }]]
	                }, {
	                    // activities and tags
	                    layout: 'accordion',
	                    animate: true,
	                    region: 'east',
	                    width: 210,
	                    split: true,
	                    collapsible: true,
	                    collapseMode: 'mini',
	                    header: false,
	                    margins: '0 5 0 5',
	                    border: true,
	                    items: [
	                        new Tine.widgets.tags.TagPanel({
	                            app: 'Sales',
	                            border: false,
	                            bodyStyle: 'border:1px solid #B5B8C8;'
	                        })
	                    ]
	                }]
	            },
	            new Tine.widgets.activities.ActivitiesTabPanel({
	                app: this.appName,
	                record_id: this.record.id,
	                record_model: this.appName + '_Model_' + this.recordClass.getMeta('modelName')
	            })
	            ]
	        };
	    },
	    
	    /**
	     * creates the accountable combo box
	     * 
	     * @return {Ext.form.ComboBox}
	     */
	    getAccountableCombo: function() {
	        if (! this.accountableCombo) {
	            var data = [];
	            var id = 0;
	
	            Ext.each(Tine.Sales.AccountableRegistry.getArray(), function(rel) {
	                
	                var app = Tine.Tinebase.appMgr.get(rel.appName);
	                var tr = app.i18n._(rel.appName + rel.modelName);
	                
	                data.push([rel.appName + '_Model_' + rel.modelName, tr]);
	                id++;
	            });
	
	            this.accountableCombo = new Ext.ux.form.ClearableComboBox({
	                store: new Ext.data.ArrayStore({
	                    fields: ['key', 'modelName'],
	                    data: data
	                }),
	                fieldLabel: this.app.i18n._('Accountable'),
	                allowBlank: false,
	                forceSelection: true,
	                value: 'Sales_Model_Product',
	                displayField: 'modelName',
	                valueField: 'key',
	                name: 'accountable',
	                columnWidth: 1/3,
	                mode: 'local'
	            });
	
	        }
	        return this.accountableCombo;
	    }
	});


/***/ },

/***/ 465:
/***/ function(module, exports) {

	/*
	 * Tine 2.0
	 * 
	 * @package     Sales
	 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
	 * @author      Philipp Schüle <p.schuele@metaways.de>
	 * @copyright   Copyright (c) 2009-2014 Metaways Infosystems GmbH (http://www.metaways.de)
	 *
	 */
	 
	Ext.namespace('Tine.Sales');
	
	/**
	 * Product grid panel
	 * 
	 * @namespace   Tine.Sales
	 * @class       Tine.Sales.ProductGridPanel
	 * @extends     Tine.widgets.grid.GridPanel
	 * 
	 * <p>Product Grid Panel</p>
	 * <p><pre>
	 * </pre></p>
	 * 
	 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
	 * 
	 * @param       {Object} config
	 * @constructor
	 * Create a new Tine.Sales.ProductGridPanel
	 */
	Tine.Sales.ProductGridPanel = Ext.extend(Tine.widgets.grid.GridPanel, {
	    /**
	     * inits this cmp
	     * @private
	     */
	    initComponent: function() {
	        Tine.Sales.ProductGridPanel.superclass.initComponent.call(this);
	        
	        // actions depend on manage_products right
	        this.selectionModel.on('selectionchange', function(sm) {
	            var hasManageRight = Tine.Tinebase.common.hasRight('manage', 'Sales', 'products');
	
	            if (hasManageRight) {
	                Tine.widgets.actionUpdater(sm, this.actions, this.recordClass.getMeta('containerProperty'), !this.evalGrants);
	                if (this.updateOnSelectionChange && this.detailsPanel) {
	                    this.detailsPanel.onDetailsUpdate(sm);
	                }
	            } else {
	                this.action_editInNewWindow.setDisabled(true);
	                this.action_deleteRecord.setDisabled(true);
	                this.action_tagsMassAttach.setDisabled(true);
	            }
	        }, this);
	
	        this.action_addInNewWindow.setDisabled(! Tine.Tinebase.common.hasRight('manage', 'Sales', 'products'));
	    }
	});


/***/ },

/***/ 466:
/***/ function(module, exports) {

	/**
	 * Tine 2.0
	 * 
	 * @package     Sales
	 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
	 * @author      Alexander Stintzing <a.stintzing@metaways.de>
	 * @copyright   Copyright (c) 2014 Metaways Infosystems GmbH (http://www.metaways.de)
	 */
	 
	Ext.ns('Tine.Sales');
	
	/**
	 * @namespace   Tine.Sales
	 * @class       Tine.Sales.ContractContactInternalFilterModel
	 * @extends     Tine.widgets.grid.ForeignRecordFilter
	 * 
	 * @author      Alexander Stintzing <a.stintzing@metaways.de>
	 */
	Tine.Sales.PurchaseInvoiceApproverFilterModel = Ext.extend(Tine.widgets.grid.ForeignRecordFilter, {
	    
	    // private
	    field: 'approver',
	    valueType: 'relation',
	    
	    /**
	     * @private
	     */
	    initComponent: function() {
	        this.app = Tine.Tinebase.appMgr.get('Sales');
	        this.label = this.app.i18n._('Approver');
	        this.foreignRecordClass = Tine.Addressbook.Model.Contact;
	        this.pickerConfig = {emptyText: this.app.i18n._('without approver'), allowBlank: true};
	
	        Tine.Sales.PurchaseInvoiceApproverFilterModel.superclass.initComponent.call(this);
	    }
	});
	
	Tine.widgets.grid.FilterToolbar.FILTERS['sales.purchaseinvoice_approver'] = Tine.Sales.PurchaseInvoiceApproverFilterModel;


/***/ },

/***/ 467:
/***/ function(module, exports) {

	/*
	 * Tine 2.0
	 * 
	 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
	 * @author      Alexander Stintzing <a.stintzing@metaways.de>
	 * @copyright   Copyright (c) 2014 Metaways Infosystems GmbH (http://www.metaways.de)
	 */
	Ext.ns('Tine.Sales');
	
	/**
	 * @namespace   Tine.Sales
	 * @class       Tine.Sales.PurchaseInvoiceDetailsPanel
	 * @extends     Tine.widgets.grid.DetailsPanel
	 * 
	 * <p>Invoice details Panel</p>
	 * <p></p>
	 * 
	 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
	 * @author      Alexander Stintzing <a.stintzing@metaways.de>
	 * 
	 * @param       {Object} config
	 * @constructor
	 * Create a new Tine.Sales.PurchaseInvoiceDetailsPanel
	 */
	Tine.Sales.PurchaseInvoiceDetailsPanel = Ext.extend(Tine.widgets.grid.DetailsPanel, {
	    
	    defaultHeight: 145,
	    
	    /**
	     * init
	     */
	    initComponent: function() {
	
	        // init templates
	        this.initTemplate();
	        this.initDefaultTemplate();
	        
	        Tine.Sales.PurchaseInvoiceDetailsPanel.superclass.initComponent.call(this);
	    },
	
	    /**
	     * add on click event after render
	     */
	    afterRender: function() {
	        Tine.Sales.PurchaseInvoiceDetailsPanel.superclass.afterRender.apply(this, arguments);
	    },
	    
	    /**
	     * init default template
	     * 
	     * @todo: generalize this
	     */
	    initDefaultTemplate: function() {
	        
	        this.defaultTpl = new Ext.XTemplate(
	            '<div class="preview-panel-timesheet-nobreak">',    
	                '<!-- Preview contacts -->',
	                '<div class="preview-panel preview-panel-invoice-default">',
	                    '<div class="bordercorner_1"></div>',
	                    '<div class="bordercorner_2"></div>',
	                    '<div class="bordercorner_3"></div>',
	                    '<div class="bordercorner_4"></div>',
	                    '<div class="preview-panel-declaration">' + this.app.i18n.n_hidden('Invoice', 'Invoices', 3) + '</div>',
	                    '<div class="preview-panel-timesheet-leftside preview-panel-left">',
	                        '<span class="preview-panel-bold">',
	                            this.app.i18n._('Select invoice') + '<br/>',
	                            '<br/>',
	                            '<br/>',
	                            '<br/>',
	                        '</span>',
	                    '</div>',
	                    '<div class="preview-panel-timesheet-rightside preview-panel-left">',
	                        '<span class="preview-panel-nonbold">',
	                            '<br/>',
	                            '<br/>',
	                            '<br/>',
	                            '<br/>',
	                        '</span>',
	                    '</div>',
	                '</div>',
	            '</div>'
	        );
	    },
	    
	    /**
	     * init single contact template (this.tpl)
	     */
	    initTemplate: function() {
	        var that = this;
	        this.tpl = new Ext.XTemplate(
	            '<tpl for=".">',
	                '<!-- Preview core data -->',
	                '<div class="preview-panel preview-panel-invoice-left preview-panel-customer">',
	                    '<div class="bordercorner_1"></div>',
	                    '<div class="bordercorner_2"></div>',
	                    '<div class="bordercorner_3"></div>',
	                    '<div class="bordercorner_4"></div>',
	                    '<div class="preview-panel-declaration">' + this.app.i18n._('Invoice') + '</div>',
	                    '<div class="preview-panel-left">',
	                        '<span class="preview-panel-symbolcompare wide">' + this.app.i18n._('Invoice Number') + '</span>{[this.encode(values, "number")]}<br/>',
	                        '<span class="preview-panel-symbolcompare wide">' + this.app.i18n._('Date') + '</span>{[this.encode(values, "date")]}<br/>',
	                        '<span class="preview-panel-symbolcompare wide">' + this.app.i18n._('Type') + '</span>{[this.encode(values, "type")]}<br/>',
	                        '<span class="preview-panel-symbolcompare wide">' + this.app.i18n._('Description') + '</span>{[this.encode(values, "description")]}<br/>',
	                        '<span class="preview-panel-symbolcompare wide">' + this.app.i18n._('Customer') + '</span>{[this.encode(values, "customer")]}<br/>',
	                        '<span class="preview-panel-symbolcompare wide">' + this.app.i18n._('Contract') + '</span>{[this.encode(values, "contract")]}<br/>',
	                    '</div>',
	                '</div>',
	
	                '<!-- Preview accounting data -->',
	                '<div class="preview-panel preview-panel-invoice-left preview-panel-customer">',
	                    '<div class="bordercorner_1"></div>',
	                    '<div class="bordercorner_2"></div>',
	                    '<div class="bordercorner_3"></div>',
	                    '<div class="bordercorner_4"></div>',
	                    '<div class="preview-panel-declaration">' + this.app.i18n._('Billing Address') + '</div>',
	                    '<div>',
	                        '{[this.encode(values, "address")]}<br/>',
	                    '</div>',
	                '</div>',
	            
	                '<!-- Preview description -->',
	                '<div class="preview-panel preview-panel-invoice-left preview-panel-customer">',
	                    '<div class="bordercorner_1"></div>',
	                    '<div class="bordercorner_2"></div>',
	                    '<div class="bordercorner_3"></div>',
	                    '<div class="bordercorner_4"></div>',
	                    '<div class="preview-panel-declaration">' + this.app.i18n._('Miscellaneous') + '</div>',
	                    '<div class="preview-panel-left">',
	                        '<span class="preview-panel-symbolcompare wide">' + this.app.i18n._('Credit Term') + '</span>{[this.encode(values, "credit_term")]}<br/>',
	                        '<span class="preview-panel-symbolcompare wide">' + this.app.i18n.n_('Cost Center', 'Cost Centers', 1) + '</span>{[this.encode(values, "costcenter_id")]}<br/>',
	                        '<span class="preview-panel-symbolcompare wide">' + this.app.i18n._('Cleared') + '</span>{[this.encode(values, "cleared")]}<br/>',
	                        '<span class="preview-panel-symbolcompare wide">' + this.app.i18n._('Price Net') + '</span>{[this.encode(values, "price_net")]}<br/>',
	                        '<span class="preview-panel-symbolcompare wide">' + this.app.i18n._('Price Tax') + ' (' + '{[this.encode(values, "sales_tax")]}' + ')' + '</span>{[this.encode(values, "price_tax")]}<br/>',
	                        '<span class="preview-panel-symbolcompare wide">' + this.app.i18n._('Total Price') + '</span>{[this.encode(values, "price_total")]}<br/>',
	                    '</div>',
	                '</div>',
	            '</tpl>',
	            {
	                /**
	                 * encode
	                 */
	                encode: function(value, key) {
	                    switch (key) {
	                        case 'address':
	                            if (value.fixed_address) {
	                                return Ext.util.Format.nl2br(value.fixed_address);
	                            } else if (value.address_id) {
	                                var address = new Tine.Sales.Model.Address(value.address_id);
	                                return Ext.util.Format.nl2br(Tine.Sales.renderAddress(address));
	                            } else {
	                                return '';
	                            }
	                        case 'contract':
	                        case 'customer':
	                            var renderer = Tine.widgets.grid.RendererManager.get('Sales', 'Invoice', key);
	                            return renderer(that.record.get('relations'));
	                        case 'price_total':
	                            return Ext.util.Format.money(value.price_total);
	                        case 'price_net':
	                            return Ext.util.Format.money(value.price_net);
	                        case 'price_tax':
	                            return Ext.util.Format.money(value.price_tax);
	                    }
	
	                    var renderer = Tine.widgets.grid.RendererManager.get('Sales', 'Invoice', key);
	                    if (renderer) {
	                        return renderer(value[key], key, that.record);
	                    } else {
	                        return '';
	                    }
	                }
	            }
	        );
	    }
	});


/***/ },

/***/ 468:
/***/ function(module, exports) {

	/*
	 * Tine 2.0
	 * 
	 * @license http://www.gnu.org/licenses/agpl.html AGPL Version 3 @author
	 * Alexander Stintzing <a.stintzing@metaways.de> @copyright Copyright (c) 2013
	 * Metaways Infosystems GmbH (http://www.metaways.de)
	 */
	Ext.ns('Tine.Sales');
	
	/**
	 * @namespace Tine.Sales
	 * @class Tine.Sales.PurchaseInvoiceEditDialog
	 * @extends Tine.widgets.dialog.EditDialog
	 * 
	 * <p>
	 * Invoice Compose Dialog
	 * </p>
	 * <p>
	 * </p>
	 * 
	 * @license http://www.gnu.org/licenses/agpl.html AGPL Version 3
	 * @author Alexander Stintzing <a.stintzing@metaways.de>
	 * 
	 * @param {Object}
	 *            config
	 * @constructor Create a new Tine.Sales.PurchaseInvoiceEditDialog
	 */
	Tine.Sales.PurchaseInvoiceEditDialog = Ext.extend(Tine.widgets.dialog.EditDialog, {
	    
	    /**
	     * @private
	     */
	    evalGrants: false,
	    
	    windowWidth: 900,
	    windowHeight: 700,
	    displayNotes: true,
	    
	    /**
	     * is form valid?
	     * 
	     * @return {Boolean}
	     */
	    isValid: function() {
	        return Tine.Sales.PurchaseInvoiceEditDialog.superclass.isValid.call(this);
	    },
	    
	    /**
	     * executed after record got updated from proxy
	     * 
	     * @private
	     */
	    onRecordLoad: function() {
	        // interrupt process flow until dialog is rendered
	        if (! this.rendered) {
	            this.onRecordLoad.defer(250, this);
	            return;
	        }
	        
	        Tine.Sales.PurchaseInvoiceEditDialog.superclass.onRecordLoad.call(this);
	
	        if (this.copyRecord) {
	            this.doCopyRecord();
	            this.window.setTitle(this.app.i18n._('Copy Purchase Invoice'));
	        } else {
	            if (! this.record.id) {
	                this.window.setTitle(this.app.i18n._('Add New Purchase Invoice'));
	            } else {
	                this.window.setTitle(String.format(this.app.i18n._('Edit Purchase Invoice "{0}"'), this.record.getTitle()));
	            }
	        }
	        
	        // mark some fields as read only
	        /*if (this.record.id) {
	            var form = this.getForm();
	            var ar = ['type', 'contract'];
	            for (var index = 0; index < ar.length; index++) {
	                form.findField(ar[index]).setReadOnly(1);
	            }
	        }*/
	        
	        // mark some more fields as read only
	        /*if (this.record.get('cleared') == 'CLEARED') {
	            var ar = ['credit_term', 'costcenter_id', 'cleared', 'type'];
	            for (var index = 0; index < ar.length; index++) {
	                form.findField(ar[index]).setReadOnly(1);
	            }
	        }*/
	    },
	    
	    onUpdatePriceNet: function() {
	        this.calcTax();
	        this.calcGross();
	        this.calcTotal();
	    },
	    
	    onUpdateSalesTax: function() {
	        this.calcTax();
	        this.calcGross();
	        this.calcTotal();
	    },
	    
	    onUpdatePriceTax: function() {
	        this.calcTaxPercent();
	        this.calcGross();
	        this.calcTotal();
	    },
	    
	    onUpdateDateOfInvoice: function() {
	        var dateOfInvoice = this.dateOfInvoiceField.getValue();
	        var dueInDays     = parseInt(this.dueInDaysField.getValue());
	        
	        var dueDate =  dateOfInvoice.clone().add(Date.DAY, dueInDays);
	        
	        this.dueAtField.setValue(dueDate);
	    },
	    
	    onUpdateInDays: function() {
	        this.onUpdateDateOfInvoice();
	    },
	    
	    onUpdateDueAt: function() {
	        var dateOfInvoice = this.dateOfInvoiceField.getValue();
	        var dueAt         = this.dueAtField.getValue();
	        
	        // @todo needs improvement 
	        // result is incorrect when dueAt is before dateOfInvoice
	        // Math.round is used mitigate timeshift changes
	        var timeDiff = Math.abs(dueAt.getTime() - dateOfInvoice.getTime());
	        var diffDays = Math.round(timeDiff / (1000 * 3600 * 24));
	        
	        this.dueInDaysField.setValue(diffDays);
	    },
	
	    /**
	     * calculates total prices by price gross, additional price gross, discount
	     */
	    calcTotal: function() {
	        var priceGross      = parseFloat(this.priceGrossField.getValue());
	        var priceGross2     = parseFloat(this.priceGross2Field.getValue());
	        var discount        = parseFloat(this.discountField.getValue());
	
	        var total = (priceGross + priceGross2) * (1 - discount/100) * 100;
	        var negative = false;
	        if (total < 0) {
	            negative = true;
	            total = Math.abs(total);
	        }
	        total = Math.round( total ) / 100;
	        if ( negative ) {
	            total = 0 - total;
	        }
	
	        this.priceTotalField.setValue( total );
	    },
	
	    /**
	     * calculates price gross by price net and tax
	     */
	    calcGross: function() {
	        var netPrice = parseFloat(this.priceNetField.getValue());
	        var tax      = parseFloat(this.priceTaxField.getValue());
	        
	        this.priceGrossField.setValue(netPrice + tax);
	    },
	    
	    /**
	     * calculates price gross by price net and tax
	     */
	    calcTax: function() {
	        var netPrice   = parseFloat(this.priceNetField.getValue());
	        var taxPercent = parseFloat(this.salesTaxField.getValue());
	        
	        var tax        = netPrice * (taxPercent / 100);
	        var negative = false;
	        if (tax < 0) {
	            tax = Math.abs(tax);
	            negative = true;
	        }
	        var roundedTax = Math.round(tax * 100) / 100;
	        if ( negative ) {
	            roundedTax = 0 - roundedTax;
	        }
	        
	        this.priceTaxField.setValue(roundedTax);
	    },
	    
	    /**
	     * calculates price gross by price net and tax
	     */
	    calcTaxPercent: function() {
	        var netPrice = parseFloat(this.priceNetField.getValue());
	        var tax      = parseFloat(this.priceTaxField.getValue());
	        
	        var taxPercent = tax / netPrice * 100;
	
	        var roundedPercent = Math.round(Math.abs(taxPercent) * 100) / 100;
	
	        this.salesTaxField.setValue(roundedPercent);
	    },
	    
	    /**
	     * returns dialog
	     * 
	     * NOTE: when this method gets called, all initalisation is done.
	     * 
	     * @return {Object}
	     * @private
	     */
	    getFormItems: function() {
	        var formFieldDefaults = {
	            xtype: 'textfield',
	            anchor: '100%',
	            labelSeparator: '',
	            columnWidth: .5
	        };
	        
	        this.dateOfInvoiceField = Ext.create({
	            xtype: 'datefield',
	            name: 'date',
	            fieldLabel: this.app.i18n._('Date of invoice'),
	            columnWidth: 1/4,
	            allowBlank: false,
	            listeners: {
	                scope: this,
	                blur: this.onUpdateDateOfInvoice.createDelegate(this)
	            }
	        });
	        
	        this.dueInDaysField = Ext.create({
	            fieldLabel: this.app.i18n._('Due in'),
	            columnWidth: 1/4,
	            name: 'due_in',
	            allowBlank: false,
	            xtype: 'uxspinner',
	            strategy: new Ext.ux.form.Spinner.NumberStrategy({
	                incrementValue : 1,
	                alternateIncrementValue: 10,
	                minValue: 0,
	                maxValue: 1024,
	                allowDecimals: false
	            }),
	            listeners: {
	                scope: this,
	                blur: this.onUpdateInDays.createDelegate(this)
	            }
	        });
	        
	        this.dueAtField = Ext.create({
	            xtype: 'datefield',
	            name: 'due_at',
	            allowBlank: false,
	            fieldLabel: this.app.i18n._('Due date'),
	            columnWidth: 1/4,
	            listeners: {
	                scope: this,
	                blur: this.onUpdateDueAt.createDelegate(this)
	            }
	        });
	        
	        this.priceNetField = new Ext.ux.form.NumberField({
	            name: 'price_net',
	            xtype: 'numberfield',
	            decimalSeparator: Tine.Tinebase.registry.get('decimalSeparator'),
	            decimalPrecision: 2,
	            suffix: ' €',
	            fieldLabel: this.app.i18n._('Price Net'),
	            columnWidth: 1/4,
	            listeners: {
	                scope: this,
	                blur: this.onUpdatePriceNet.createDelegate(this)
	            }
	        });
	        
	        this.priceGrossField = new Ext.ux.form.NumberField({
	            decimalPrecision: 2,
	            name: 'price_gross',
	            xtype: 'numberfield',
	            suffix: ' €',
	            decimalSeparator: Tine.Tinebase.registry.get('decimalSeparator'),
	            fieldLabel: this.app.i18n._('Price Gross'),
	            columnWidth: 1/4,
	            listeners: {
	                scope: this,
	                blur: this.calcGross.createDelegate(this)
	            }
	        });
	
	        this.priceGross2Field = new Ext.ux.form.NumberField({
	            decimalPrecision: 2,
	            name: 'price_gross2',
	            xtype: 'numberfield',
	            suffix: ' €',
	            decimalSeparator: Tine.Tinebase.registry.get('decimalSeparator'),
	            fieldLabel: this.app.i18n._('Additional Price Gross'),
	            columnWidth: 1/4,
	            listeners: {
	                scope: this,
	                blur: this.calcTotal.createDelegate(this)
	            }
	        });
	
	        this.priceTotalField = new Ext.ux.form.NumberField({
	            decimalPrecision: 2,
	            name: 'price_total',
	            xtype: 'numberfield',
	            suffix: ' €',
	            decimalSeparator: Tine.Tinebase.registry.get('decimalSeparator'),
	            fieldLabel: this.app.i18n._('Total Price'),
	            columnWidth: 1/4,
	            listeners: {
	                scope: this,
	                blur: this.calcTotal.createDelegate(this)
	            }
	        });
	        
	        this.priceTaxField = new Ext.ux.form.NumberField({
	            decimalPrecision: 2,
	            name: 'price_tax',
	            xtype: 'numberfield',
	            suffix: ' €',
	            decimalSeparator: Tine.Tinebase.registry.get('decimalSeparator'),
	            fieldLabel: this.app.i18n._('Price Tax'),
	            columnWidth: 1/4,
	            listeners: {
	                scope: this,
	                blur: this.onUpdatePriceTax.createDelegate(this)
	            }
	        });
	        
	        this.salesTaxField = Ext.create({
	            xtype: 'uxspinner',
	            decimalPrecision: 2,
	            strategy: new Ext.ux.form.Spinner.NumberStrategy({
	                incrementValue : 1,
	                alternateIncrementValue: 0.1,
	                minValue: 0,
	                maxValue: 100,
	                allowDecimals: 2
	            }),
	            name: 'sales_tax',
	            decimalSeparator: Tine.Tinebase.registry.get('decimalSeparator'),
	            fieldLabel: this.app.i18n._('Sales Tax (percent)'),
	            columnWidth: 1/4,
	            regex: /^[0-9]+\.?[0-9]*$/,
	            listeners: {
	                scope: this,
	                spin: this.onUpdateSalesTax.createDelegate(this),
	                blur: this.onUpdateSalesTax.createDelegate(this)
	            }
	        });
	        
	        this.discountField = Ext.create({
	            xtype: 'uxspinner',
	            decimalPrecision: 2,
	            strategy: new Ext.ux.form.Spinner.NumberStrategy({
	                incrementValue : 1,
	                minValue: 0,
	                maxValue: 100,
	                allowDecimals: 0
	            }),
	            name: 'discount',
	            decimalSeparator: Tine.Tinebase.registry.get('decimalSeparator'),
	            fieldLabel: this.app.i18n._('Discount (%)'),
	            columnWidth: 1/4,
	            value: 0,
	            regex: /^[0-9]+\.?[0-9]*$/,
	            listeners: {
	                scope: this,
	                spin: this.calcTotal.createDelegate(this),
	                blur: this.calcTotal.createDelegate(this)
	            }
	        });
	        
	        var items = [{
	            title: this.app.i18n._('Purchase Invoice'),
	            autoScroll: true,
	            border: false,
	            frame: true,
	            layout: 'border',
	            items: [{
	                region: 'center',
	                layout: 'hfit',
	                border: false,
	                items: [{
	                    xtype: 'fieldset',
	                    layout: 'hfit',
	                    autoHeight: true,
	                    title: this.app.i18n._('Invoice'),
	                    items: [{
	                        xtype: 'columnform',
	                        labelAlign: 'top',
	                        formDefaults: formFieldDefaults,
	                        items: [
	                            [{
	                                name: 'number',
	                                fieldLabel: this.app.i18n._('Invoice Number'),
	                                columnWidth: 1/4,
	                                allowBlank: false
	                                //readOnly: ! Tine.Tinebase.common.hasRight('set_invoice_number', 'Sales'),
	                                //emptyText: this.app.i18n._('automatically set...')
	                            }, {
	                                fieldLabel: this.app.i18n._('Supplier'),
	                                columnWidth: 3/4,
	                                editDialog: this,
	                                xtype: 'tinerelationpickercombo',
	                                allowBlank: false,
	                                app: 'Sales',
	                                recordClass: Tine.Sales.Model.Supplier,
	                                relationType: 'SUPPLIER',
	                                relationDegree: 'sibling',
	                                modelUnique: true,
	                                ref: '../../../../../../../supplierPicker',
	                                //readOnly: true,
	                                name: 'supplier'
	                            }], [
	                                this.dateOfInvoiceField,
	                                this.dueInDaysField,
	                                this.dueAtField
	                                /*{
	                                    xtype: 'extuxclearabledatefield',
	                                    name: 'overdue_at',
	                                    fieldLabel: this.app.i18n._('Overdue date'),
	                                    columnWidth: 1/4
	                                    //emptyText: (this.record.get('is_auto') == 1) ? this.app.i18n._('automatically set...') : ''
	                            }*/], [
	                                this.priceNetField,
	                                this.salesTaxField,
	                                this.priceTaxField,
	                                this.priceGrossField
	                            ], [
	                                this.priceGross2Field,
	                                this.discountField,
	                                {
	                                    xtype: 'extuxclearabledatefield',
	                                    name: 'discount_until',
	                                    //allowBlank: false,
	                                    fieldLabel: this.app.i18n._('Discount until'),
	                                    columnWidth: 1/4
	                                    //emptyText: (this.record.get('is_auto') == 1) ? this.app.i18n._('automatically set...') : ''
	                                }
	                            ], [
	                                this.priceTotalField
	                            ]
	                        ]
	                    }]
	                }, {
	                    xtype: 'fieldset',
	                    layout: 'hfit',
	                    autoHeight: true,
	                    title: this.app.i18n._('Miscellaneous'),
	                    items: [{
	                        xtype: 'columnform',
	                        labelAlign: 'top',
	                        formDefaults: formFieldDefaults,
	                        items: [
	                            [
	                                {
	                                    xtype: 'extuxclearabledatefield',
	                                    name: 'dunned_at',
	                                    fieldLabel: this.app.i18n._('Dun date'),
	                                    columnWidth: 1/4
	                                }, {
	                                    xtype: 'extuxclearabledatefield',
	                                    name: 'payed_at',
	                                    //allowBlank: false,
	                                    fieldLabel: this.app.i18n._('Payed at'),
	                                    columnWidth: 1/4
	                                    //emptyText: (this.record.get('is_auto') == 1) ? this.app.i18n._('automatically set...') : ''
	                                },
	                                // is_payed
	                                new Tine.Tinebase.widgets.keyfield.ComboBox({
	                                    app: 'Sales',
	                                    keyFieldName: 'paymentMethods',
	                                    fieldLabel: this.app.i18n._('Method of payment'),
	                                    name: 'payment_method',
	                                    columnWidth: 1/4
	                                })
	                            ], [
	                                {
	                                    columnWidth: 2/4,
	                                    editDialog: this,
	                                    xtype: 'tinerelationpickercombo',
	                                    fieldLabel: this.app.i18n._('Approver'),
	                                    allowBlank: true,
	                                    app: 'Addressbook',
	                                    recordClass: Tine.Addressbook.Model.Contact,
	                                    relationType: 'APPROVER',
	                                    relationDegree: 'sibling',
	                                    modelUnique: true
	                                }, {
	                                    columnWidth: 1/4,
	                                    editDialog: this,
	                                    xtype: 'tinerelationpickercombo',
	                                    fieldLabel: this.app.i18n._('Lead Cost Center'),
	                                    allowBlank: true,
	                                    app: 'Sales',
	                                    recordClass: Tine.Sales.Model.CostCenter,
	                                    relationType: 'COST_CENTER',
	                                    relationDegree: 'sibling',
	                                    modelUnique: true
	                                }
	                                /*new Tine.Tinebase.widgets.keyfield.ComboBox({
	                                    app: 'Sales',
	                                    keyFieldName: 'invoiceCleared',
	                                    fieldLabel: this.app.i18n._('Cleared'),
	                                    name: 'cleared',
	                                    allowBlank: false,
	                                    columnWidth: 1/3
	                                })*/
	                            ]
	                        ]
	                    }]
	                }]
	            }, {
	                // activities and tags
	                layout: 'accordion',
	                animate: true,
	                region: 'east',
	                width: 210,
	                split: true,
	                collapsible: true,
	                collapseMode: 'mini',
	                header: false,
	                margins: '0 5 0 5',
	                border: true,
	                items: [
	                    new Ext.Panel({
	                        title: this.app.i18n._('Description'),
	                        iconCls: 'descriptionIcon',
	                        layout: 'form',
	                        labelAlign: 'top',
	                        border: false,
	                        items: [{
	                            style: 'margin-top: -4px; border 0px;',
	                            labelSeparator: '',
	                            xtype: 'textarea',
	                            name: 'description',
	                            hideLabel: true,
	                            grow: false,
	                            preventScrollbars: false,
	                            anchor: '100% 100%',
	                            emptyText: this.app.i18n._('Enter description'),
	                            requiredGrant: 'editGrant'
	                        }]
	                    }),
	                    new Tine.widgets.tags.TagPanel({
	                        app: 'Sales',
	                        border: false,
	                        bodyStyle: 'border:1px solid #B5B8C8;'
	                    })
	                ]
	            }]
	        }];
	        
	        items.push(new Tine.widgets.activities.ActivitiesTabPanel({
	            app:           this.appName,
	            record_id:     this.record.id,
	            record_model: 'Sales_Model_PurchaseInvoice'
	        }));
	        
	        return {
	            xtype:     'tabpanel',
	            defaults: {
	                hideMode: 'offsets'
	            },
	            border:    false,
	            plain:     true,
	            activeTab: 0,
	            items:     items
	        };
	    }
	});


/***/ },

/***/ 469:
/***/ function(module, exports) {

	/*
	 * Tine 2.0
	 * 
	 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
	 * @author      Alexander Stintzing <a.stintzing@metaways.de>
	 * @copyright   Copyright (c) 2014 Metaways Infosystems GmbH (http://www.metaways.de)
	 */
	Ext.ns('Tine.Sales');
	
	/**
	 * Invoice grid panel
	 * 
	 * @namespace   Tine.Sales
	 * @class       Tine.Sales.PurchaseInvoiceGridPanel
	 * @extends     Tine.widgets.grid.GridPanel
	 * 
	 * <p>Invoice Grid Panel</p>
	 * <p><pre>
	 * </pre></p>
	 * 
	 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
	 * @author      Alexander Stintzing <a.stintzing@metaways.de>    
	 * 
	 * @param       {Object} config
	 * @constructor
	 * Create a new Tine.Sales.PurchaseInvoiceGridPanel
	 */
	Tine.Sales.PurchaseInvoiceGridPanel = Ext.extend(Tine.widgets.grid.GridPanel, {
	    
	    initComponent: function() {
	        this.initDetailsPanel();
	        Tine.Sales.PurchaseInvoiceGridPanel.superclass.initComponent.call(this);
	    },
	
	    /**
	     * @private
	     */
	    initDetailsPanel: function() {
	        this.detailsPanel = new Tine.Sales.PurchaseInvoiceDetailsPanel({
	            grid: this,
	            app:  this.app
	        });
	    }
	});


/***/ },

/***/ 470:
/***/ function(module, exports) {

	/*
	 * Tine 2.0
	 * 
	 * @package     Sales
	 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
	 * @author      Philipp Schuele <p.schuele@metaways.de>
	 * @copyright   Copyright (c) 2007-2014 Metaways Infosystems GmbH (http://www.metaways.de)
	 *
	 */
	 
	Ext.namespace('Tine.Sales');
	
	/**
	 * address renderer, not a default renderer
	 * 
	 * @author      Philipp Schuele <p.schuele@metaways.de>
	 * 
	 * @constructor
	 * Constructs mainscreen of the Sales application
	 */
	Tine.Sales.MainScreen = Ext.extend(Tine.widgets.MainScreen, {
	    appName: 'Sales',
	    activeContentType: 'Product',
	    contentTypes: [
	        {modelName: 'Product', requiredRight: 'manage_products', singularContainerMode: true},
	        {modelName: 'Contract', requiredRight: 'manage_contracts', singularContainerMode: true, genericCtxActions: ['grants']},
	        {modelName: 'Customer', requiredRight: 'manage_customers', singularContainerMode: true},
	        {modelName: 'Supplier', requiredRight: 'manage_suppliers', singularContainerMode: true},
	        {modelName: 'Invoice', requiredRight: 'manage_invoices', singularContainerMode: true},
	        {modelName: 'PurchaseInvoice', requiredRight: 'manage_purchase_invoices', singularContainerMode: true},
	        {modelName: 'CostCenter', requiredRight: 'manage_costcenters', singularContainerMode: true},
	        {modelName: 'Division', requiredRight: 'manage_divisions', singularContainerMode: true},
	        {modelName: 'Offer', requiredRight: 'manage_offers', singularContainerMode: true},
	        {modelName: 'OrderConfirmation', requiredRight: 'manage_orderconfirmations', singularContainerMode: true}
	    ]
	});
	
	// rendered sums registry for the invoiceposition grid panel
	Tine.Sales.renderedSumsPerMonth = {};
	
	Tine.Sales.addToClipboard = function(record, companyName) {
	    // this is called either from the edit dialog or from the grid, so we have different record types
	    var fieldPrefix = record.data.hasOwnProperty('bic') ? 'adr_' : '';
	    
	    companyName = companyName ? companyName : (record.get('name') ? record.get('name') : '');
	
	    var lines = companyName + "\n";
	    
	        lines += (record.get((fieldPrefix + 'prefix1')) ? record.get((fieldPrefix + 'prefix1')) + "\n" : '');
	        lines += (record.get((fieldPrefix + 'prefix2')) ? record.get((fieldPrefix + 'prefix2')) + "\n" : '');
	        lines += (record.get(fieldPrefix + 'pobox') ? record.get(fieldPrefix + 'pobox') + "\n" : (record.get(fieldPrefix + 'street') ? record.get(fieldPrefix + 'street') + "\n" : ''));
	        lines += (record.get((fieldPrefix + 'postalcode')) ? (record.get((fieldPrefix + 'postalcode')) + ' ') : '') + (record.get((fieldPrefix + 'locality')) ? record.get((fieldPrefix + 'locality')) : '');
	        
	        if (record.get('countryname')) {
	            lines += "\n" + record.get('countryname');
	        }
	    
	    var app = Tine.Tinebase.appMgr.get('Sales');
	    
	    Tine.Sales.CopyAddressDialog.openWindow({winTitle: app.i18n._('Copy address to the clipboard'), app: app, content: lines});
	};
	
	/** @param {Tine.Tinebase.data.Record} record
	 * @param {String} companyName
	 * 
	 * @return {String}
	 */
	Tine.Sales.renderAddress = function(record, companyName) {
	    // this is called either from the edit dialog or from the grid, so we have different record types
	    var fieldPrefix = record.data.hasOwnProperty('bic') ? 'adr_' : '';
	    
	    companyName = companyName ? companyName : (record.get('name') ? record.get('name') : '');
	
	    var lines = companyName + "\n";
	    
	    lines += (record.get((fieldPrefix + 'prefix1')) ? record.get((fieldPrefix + 'prefix1')) + "\n" : '');
	    lines += (record.get((fieldPrefix + 'prefix2')) ? record.get((fieldPrefix + 'prefix2')) + "\n" : '');
	    lines += (record.get((fieldPrefix + 'pobox')) ? (record.get(fieldPrefix + 'pobox') + "\n") : ((record.get(fieldPrefix + 'street') ? record.get(fieldPrefix + 'street') + "\n" : '')));
	    lines += (record.get((fieldPrefix + 'postalcode')) ? (record.get((fieldPrefix + 'postalcode')) + ' ') : '') + (record.get((fieldPrefix + 'locality')) ? record.get((fieldPrefix + 'locality')) : '');
	    
	    if (record.get('countryname')) {
	        lines += "\n" + record.get('countryname');
	    }
	    
	    return lines;
	};
	
	/**
	 * opens the Copy Address Dialog and adds the rendered address
	 * 
	 * @param {Tine.Tinebase.data.Record} record
	 * @param {String} companyName
	 */
	Tine.Sales.addToClipboard = function(record, companyName) {
	    var app = Tine.Tinebase.appMgr.get('Sales');
	    
	    Tine.Sales.CopyAddressDialog.openWindow({
	        winTitle: 'Copy address to the clipboard', 
	        app: app, 
	        content: Tine.Sales.renderAddress(record, companyName)
	    });
	};
	
	Tine.Sales.renderAddressAsLine = function(values) {
	    var ret = '';
	    var app = Tine.Tinebase.appMgr.get('Sales');
	    if (values.customer_id && values.customer_id.hasOwnProperty('name')) {
	        ret += '<b>' + Ext.util.Format.htmlEncode(values.customer_id.name) + '</b> - ';
	    }
	    
	    ret += Ext.util.Format.htmlEncode((values.postbox ? values.postbox : values.street));
	    ret += ', ';
	    ret += Ext.util.Format.htmlEncode(values.postalcode);
	    ret += ' ';
	    ret += Ext.util.Format.htmlEncode(values.locality);
	    ret += ' (';
	    ret += app.i18n._(values.type)
	    
	    if (values.type == 'billing') {
	        ret += ' - ' + Ext.util.Format.htmlEncode(values.custom1);
	    }
	    
	    ret += ')';
	    
	    return ret;
	};
	
	/**
	 * register special renderer for invoice address_id
	 */
	Tine.widgets.grid.RendererManager.register('Sales', 'Invoice', 'address_id', Tine.Sales.renderAddressAsLine);
	
	/**
	 * renders the model of the invoice position
	 * 
	 * @param {String} value
	 * @param {Object} row
	 * @param {Tine.Tinebase.data.Record} rec
	 * @return {String}
	 */
	Tine.Sales.renderInvoicePositionModel = function(value, row, rec) {
	    if (! value) {
	        return '';
	    }
	    var split = value.split('_Model_');
	    var model = Tine[split[0]].Model[split[1]];
	    
	    return '<span class="tine-recordclass-gridicon ' + model.getMeta('appName') + model.getMeta('modelName') + '">&nbsp;</span>' + model.getRecordName() + ' (' + model.getAppName() + ')';
	};
	
	/**
	 * register special renderer for the invoice position
	 */
	Tine.widgets.grid.RendererManager.register('Sales', 'InvoicePosition', 'model', Tine.Sales.renderInvoicePositionModel);
	
	/**
	 * renders the quantity of the invoice position
	 */
	Tine.Sales.InvoicePositionQuantityRendererRegistry = function() {
	    var renderers = {};
	    
	    return {
	        /**
	         * return renderer
	         * 
	         * @param {String} phpModelName
	         * @return {Function}
	         */
	        get: function(phpModelName, unit) {
	            var unit = unit.replace(/\s/, '');
	            if (renderers.hasOwnProperty(phpModelName+unit)) {
	                return renderers[phpModelName+unit];
	            } else {
	                // default function
	                return function(value, row, rec) {
	                    return value;
	                }
	            }
	        },
	        
	        /**
	         * register renderer
	         * 
	         * @param {String} phpModelName
	         * @param {Function} func
	         */
	        register: function(phpModelName, unit, func) {
	            var unit = unit.replace(/\s/, '');
	            renderers[phpModelName+unit] = func;
	        },
	        
	        /**
	         * check if a renderer is explicitly registered
	         * 
	         * @param {String} phpModelName
	         * @return {Boolean}
	         */
	        has: function(phpModelName, unit) {
	            var unit = unit.replace(/\s/, '');
	            return renderers.hasOwnProperty(phpModelName+unit);
	        }
	    }
	}();
	
	/**
	 * renders the unit of the invoice position
	 * 
	 * @param {String} value
	 * @param {Object} row
	 * @param {Tine.Tinebase.data.Record} rec
	 * @return {String}
	 */
	Tine.Sales.renderInvoicePositionUnit = function(value, row, rec) {
	    
	    if (! value) {
	        return '';
	    }
	    
	    var model = rec.get('model');
	    var split = model.split('_Model_');
	    
	    var app = Tine.Tinebase.appMgr.get(split[0]);
	    
	    return app.i18n._(value);
	};
	/**
	 * renders the unit of the invoice position
	 * @param {} value
	 * @param {} row
	 * @param {} rec
	 * @return {}
	 */
	Tine.Sales.renderInvoicePositionQuantity = function(value, row, rec) {
	    var model = rec.data.model;
	    if (Tine.Sales.InvoicePositionQuantityRendererRegistry.has(model, rec.data.unit)) {
	        var renderer = Tine.Sales.InvoicePositionQuantityRendererRegistry.get(model, rec.data.unit);
	        return renderer(value, row, rec);
	    } else {
	        return value;
	    }
	};
	
	/**
	 * register special renderer for the invoice position
	 */
	Tine.widgets.grid.RendererManager.register('Sales', 'InvoicePosition', 'unit', Tine.Sales.renderInvoicePositionUnit);
	Tine.widgets.grid.RendererManager.register('Sales', 'InvoicePosition', 'quantity', Tine.Sales.renderInvoicePositionQuantity);
	
	
	Tine.Sales.renderBillingPoint = function(v) {
	    var app = Tine.Tinebase.appMgr.get('Sales');
	    return v ? app.i18n._hidden(v) : '';
	}
	
	Tine.widgets.grid.RendererManager.register('Sales', 'Contract', 'billing_point', Tine.Sales.renderBillingPoint);
	
	Tine.Sales.renderCostCenter = function(value, row, rec) {
	    if (Ext.isObject(value)) {
	        return value.number + ' - ' + value.remark;
	    }
	    
	    return '';
	};
	
	Tine.widgets.grid.RendererManager.register('Sales', 'Invoice', 'costcenter_id', Tine.Sales.renderCostCenter);
	
	/**
	 * allows all accountables to register (needed for accountable combo box)
	 */
	Tine.Sales.AccountableRegistry = function() {
	    var accountables = {};
	    
	    return {
	        /**
	         * return all accountables as array
	         * 
	         * @return {Array}
	         */
	        getArray: function() {
	            var ar = [];
	            Ext.iterate(accountables, function(key, value) {
	                ar.push(value);
	            });
	            
	            return ar;
	        },
	        
	        /**
	         * register accountable
	         * 
	         * @param {String} appName
	         * @param {String} modelName
	         */
	        register: function(appName, modelName) {
	            var key = appName + modelName;
	            if (! accountables.hasOwnProperty(key)) {
	                accountables[key] = {appName: appName, modelName: modelName};
	            }
	        },
	        
	        /**
	         * check if a renderer is explicitly registered
	         * 
	         * @param {String} appName
	         * @param {String} modelName
	         * @return {Boolean}
	         */
	        has: function(appName, modelName) {
	            var key = appName + modelName;
	            return accountables.hasOwnProperty(key);
	        }
	    }
	}();
	
	Tine.Sales.AccountableRegistry.register('Sales', 'Product');
	
	
	Tine.Sales.renderAccountable = function(values) {
	    if (Ext.isEmpty(values)) {
	        return '';
	    }
	    var split = values.split('_Model_');
	    var ret = '';
	    var app = Tine.Tinebase.appMgr.get(split[0]);
	    
	    return app ? app.i18n._(split[0] + split[1]) : null;
	};
	
	/**
	 * register special renderer for invoice address_id
	 */
	Tine.widgets.grid.RendererManager.register('Sales', 'Product', 'accountable', Tine.Sales.renderAccountable);


/***/ },

/***/ 471:
/***/ function(module, exports) {

	/*
	 * Tine 2.0
	 * 
	 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
	 * @author      Alexander Stintzing <a.stintzing@metaways.de>
	 * @copyright   Copyright (c) 2013 Metaways Infosystems GmbH (http://www.metaways.de)
	 */
	Ext.ns('Tine.Sales');
	
	/**
	 * @namespace   Tine.Sales
	 * @class       Tine.Sales.SupplierDetailsPanel
	 * @extends     Tine.widgets.grid.DetailsPanel
	 * 
	 * <p>Supplier details Panel</p>
	 * <p></p>
	 * 
	 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
	 * @author      Alexander Stintzing <a.stintzing@metaways.de>
	 * 
	 * @param       {Object} config
	 * @constructor
	 * Create a new Tine.Sales.SupplierDetailsPanel
	 */
	Tine.Sales.SupplierDetailsPanel = Ext.extend(Tine.widgets.grid.DetailsPanel, {
	    
	    /**
	     * init
	     */
	    initComponent: function() {
	
	        // init templates
	        this.initTemplate();
	        this.initDefaultTemplate();
	        
	        Tine.Sales.SupplierDetailsPanel.superclass.initComponent.call(this);
	    },
	
	    /**
	     * add on click event after render
	     */
	    afterRender: function() {
	        Tine.Sales.SupplierDetailsPanel.superclass.afterRender.apply(this, arguments);
	        
	        if (this.felamimail === true) {
	            this.body.on('click', this.onClick, this);
	        }
	    },
	    
	    /**
	     * init default template
	     * 
	     * @todo: generalize this
	     */
	    initDefaultTemplate: function() {
	        
	        this.defaultTpl = new Ext.XTemplate(
	            '<div class="preview-panel-timesheet-nobreak">',    
	                '<!-- Preview contacts -->',
	                '<div class="preview-panel preview-panel-timesheet-left">',
	                    '<div class="bordercorner_1"></div>',
	                    '<div class="bordercorner_2"></div>',
	                    '<div class="bordercorner_3"></div>',
	                    '<div class="bordercorner_4"></div>',
	                    '<div class="preview-panel-declaration">' + this.app.i18n.n_hidden('Supplier', 'Suppliers', 3) + '</div>',
	                    '<div class="preview-panel-timesheet-leftside preview-panel-left">',
	                        '<span class="preview-panel-bold">',
	                            this.app.i18n._('Select supplier') + '<br/>',
	                            '<br/>',
	                            '<br/>',
	                            '<br/>',
	                        '</span>',
	                    '</div>',
	                    '<div class="preview-panel-timesheet-rightside preview-panel-left">',
	                        '<span class="preview-panel-nonbold">',
	                            '<br/>',
	                            '<br/>',
	                            '<br/>',
	                            '<br/>',
	                        '</span>',
	                    '</div>',
	                '</div>',
	                '<!-- Preview xxx -->',
	                '<div class="preview-panel-timesheet-right">',
	                    '<div class="bordercorner_gray_1"></div>',
	                    '<div class="bordercorner_gray_2"></div>',
	                    '<div class="bordercorner_gray_3"></div>',
	                    '<div class="bordercorner_gray_4"></div>',
	                    '<div class="preview-panel-declaration"></div>',
	                    '<div class="preview-panel-timesheet-leftside preview-panel-left">',
	                        '<span class="preview-panel-bold">',
	                            '<br/>',
	                            '<br/>',
	                            '<br/>',
	                            '<br/>',
	                        '</span>',
	                    '</div>',
	                    '<div class="preview-panel-timesheet-rightside preview-panel-left">',
	                        '<span class="preview-panel-nonbold">',
	                            '<br/>',
	                            '<br/>',
	                            '<br/>',
	                            '<br/>',
	                        '</span>',
	                    '</div>',
	                '</div>',
	            '</div>'        
	        );
	    },
	    
	    /**
	     * init single contact template (this.tpl)
	     */
	    initTemplate: function() {
	        this.tpl = new Ext.XTemplate(
	            '<tpl for=".">',
	                '<!-- Preview core data -->',
	                '<div class="preview-panel preview-panel-left preview-panel-supplier">',
	                    '<div class="bordercorner_1"></div>',
	                    '<div class="bordercorner_2"></div>',
	                    '<div class="bordercorner_3"></div>',
	                    '<div class="bordercorner_4"></div>',
	                    '<div class="preview-panel-declaration">' + this.app.i18n._('Core Data') + '</div>',
	                    '<div class="preview-panel-left">',
	                        '<span class="preview-panel-symbolcompare wide">' + this.app.i18n._('Supplier Number') + '</span>{[this.encode(values.number)]}<br/>',
	                        '<span class="preview-panel-symbolcompare wide">' + this.app.i18n._('Name') + '</span>{[this.encode(values.name)]}<br/>',
	                        '<span class="preview-panel-symbolcompare wide">' + this.app.i18n._('Web') + '</span><a href="{[this.encode(values.url, "text")]}" target="_blank">{[this.encode(values.url, "text")]}</a><br/>',
	                        '<span class="preview-panel-symbolcompare wide">' + this.app.i18n._('Contact Person (external)') + '</span>{[this.encode(values.cpextern_id, "address")]}<br/>',
	                        '<span class="preview-panel-symbolcompare wide">' + this.app.i18n._('Contact Person (internal)') + '</span>{[this.encode(values.cpintern_id, "address")]}<br/>',
	                        
	                        
	                    '</div>',
	                '</div>',
	
	                '<!-- Preview accounting data -->',
	                '<div class="preview-panel preview-panel-left preview-panel-supplier">',
	                    '<div class="bordercorner_1"></div>',
	                    '<div class="bordercorner_2"></div>',
	                    '<div class="bordercorner_3"></div>',
	                    '<div class="bordercorner_4"></div>',
	                    '<div class="preview-panel-declaration">' + this.app.i18n._('Accounting') + '</div>',
	                    '<div>',
	                        '<span class="preview-panel-symbolcompare wide">' + this.app.i18n._('IBAN') + '</span>{[this.encode(values.iban)]}<br/>',
	                        '<span class="preview-panel-symbolcompare wide">' + this.app.i18n._('BIC') + '</span>{[this.encode(values.bic)]}<br/>',
	                        '<span class="preview-panel-symbolcompare wide">' + this.app.i18n._('VAT No.') + '</span>{[this.encode(values.vatid)]}<br/>',
	                        '<span class="preview-panel-symbolcompare wide">' + this.app.i18n._('Currency') + '</span>{[this.encode(values.currency)]}<br/>',
	                        '<span class="preview-panel-symbolcompare wide">' + this.app.i18n._('Currency Translation Rate') + '</span>{[this.encode(values.currency_trans_rate)]}<br/>',
	                    '</div>',
	                '</div>',
	            
	                '<!-- Preview description -->',
	                '<div class="preview-panel-description preview-panel-left preview-panel-supplier">',
	                    '<div class="bordercorner_gray_1"></div>',
	                    '<div class="bordercorner_gray_2"></div>',
	                    '<div class="bordercorner_gray_3"></div>',
	                    '<div class="bordercorner_gray_4"></div>',
	                    '<div class="preview-panel-declaration">' + i18n._('Description') + '</div>',
	                    '{[this.encode(values.description)]}',
	                '</div>',
	            '</tpl>',
	            {
	                /**
	                 * encode
	                 */
	                encode: function(value, type, prefix) {
	                    if (! value) {
	                        return '';
	                    }
	                    type = type ? type : 'text';
	                    switch (type) {
	                        case 'text':
	                            var ret = value;
	                            break;
	                        case 'address':
	                            var ret = value.n_fn
	                            break;
	                    }
	                    return Ext.util.Format.htmlEncode(ret);
	                }
	            }
	        );
	    }
	});

/***/ },

/***/ 472:
/***/ function(module, exports) {

	/*
	 * Tine 2.0
	 * 
	 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
	 * @author      Alexander Stintzing <a.stintzing@metaways.de>
	 * @copyright   Copyright (c) 2013 Metaways Infosystems GmbH (http://www.metaways.de)
	 */
	Ext.ns('Tine.Sales');
	
	/**
	 * @namespace   Tine.Sales
	 * @class       Tine.Sales.SupplierEditDialog
	 * @extends     Tine.widgets.dialog.EditDialog
	 * 
	 * <p>Supplier Compose Dialog</p>
	 * <p></p>
	 * 
	 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
	 * @author      Alexander Stintzing <a.stintzing@metaways.de>
	 * 
	 * @param       {Object} config
	 * @constructor
	 * Create a new Tine.Sales.SupplierEditDialog
	 */
	Tine.Sales.SupplierEditDialog = Ext.extend(Tine.widgets.dialog.EditDialog, {
	    windowWidth: 900,
	    windowHeight: 800,
	    displayNotes: true,
	    
	    /**
	     * 
	     */
	    isValid: function() {
	        var isValid = true,
	            form = this.getForm();
	        
	        isValid = Tine.Sales.SupplierEditDialog.superclass.isValid.call(this)
	            
	        if (Ext.isEmpty(form.findField('adr_postalcode').getValue()) && Ext.isEmpty(form.findField('adr_pobox').getValue())) {
	            isValid = false;
	            var msg = this.app.i18n._('Either postalcode or postbox is required!');
	            form.markInvalid( {'adr_postalcode': msg, 'adr_pobox': msg});
	        }
	
	        return isValid;
	    },
	    
	    /**
	     * executed after record got updated from proxy
	     */
	    onRecordLoad: function() {
	        // interrupt process flow until dialog is rendered
	        if (! this.rendered) {
	            this.onRecordLoad.defer(250, this);
	            return;
	        }
	        
	        Tine.Sales.SupplierEditDialog.superclass.onRecordLoad.call(this);
	        
	        if (this.copyRecord) {
	            this.doCopyRecord();
	            this.window.setTitle(this.app.i18n._('Copy Supplier'));
	        } else {
	            if (! this.record.id) {
	                this.window.setTitle(this.app.i18n._('Add New Supplier'));
	            } else {
	                this.window.setTitle(String.format(this.app.i18n._('Edit Supplier "{0}"'), this.record.getTitle()));
	                //this.getForm().findField('number').disable();
	            }
	        }
	    },
	    
	    /**
	     * duplicate(s) found exception handler
	     * 
	     * @todo: make this globally, smoothly the virtual fields (modelconfig) don't fit anywhere
	     * 
	     * @param {Object} exception
	     */
	    onDuplicateException: function(exception) {
	        this.onRecordUpdate();
	        exception.clientRecord = this.record.data;
	        Tine.Sales.SupplierEditDialog.superclass.onDuplicateException.call(this, exception);
	    },
	    
	    /**
	     * Fill address with contact data, if not set already
	     * 
	     * @param {} combo
	     * @param {} record
	     * @param {} index
	     */
	    onSelectContactPerson: function(combo, record, index) {
	        var form = this.getForm();
	        if (record.get('adr_one_street') && ! form.findField('adr_street').getValue()) {
	            var ar = ['street', 'postalcode', 'region', 'locality', 'countryname'];
	            for (var index = 0; index < ar.length; index++) {
	                form.findField('adr_' + ar[index]).setValue(record.get('adr_one_' + ar[index]));
	            }
	        }
	    },
	    
	    /**
	     * returns dialog
	     * 
	     * NOTE: when this method gets called, all initalisation is done.
	     * 
	     * @return {Object}
	     * @private
	     */
	    getFormItems: function() {
	        var formFieldDefaults = {
	            xtype:'textfield',
	            anchor: '100%',
	            labelSeparator: '',
	            columnWidth: .5
	        };
	        
	        this.clipboardButton = new Ext.Button({
	           columnWidth: 5/100,
	           iconCls: 'clipboard',
	           tooltip: Ext.util.Format.htmlEncode(this.app.i18n._('Copy address to the clipboard')),
	           fieldLabel: '&nbsp;',
	           lazyLoading: false,
	           listeners: {
	                scope: this,
	                click: function() {
	                    this.onRecordUpdate();
	                    Tine.Sales.addToClipboard(this.record);
	                }
	           }
	        });
	        
	        var currency = Tine.Sales.registry.get('config').ownCurrency.value;
	        
	        return {
	            xtype: 'tabpanel',
	            defaults: {
	                hideMode: 'offsets'
	            },
	            border: false,
	            plain: true,
	            activeTab: 0,
	            items: [{
	            title: this.app.i18n._('Supplier'),
	            autoScroll: true,
	            border: false,
	            frame: true,
	            layout: 'border',
	            items: [{
	                region: 'center',
	                layout: 'hfit',
	                border: false,
	                items: [{
	                    xtype: 'fieldset',
	                    layout: 'hfit',
	                    autoHeight: true,
	                    title: this.app.i18n._('Core Data'),
	                    items: [{
	                        xtype: 'columnform',
	                        labelAlign: 'top',
	                        formDefaults: formFieldDefaults,
	                        items: [[{
	                                fieldLabel: this.app.i18n._('Supplier Number'),
	                                name: 'number',
	                                allowBlank: true,
	                                columnWidth: .250,
	                                minValue: 1,
	                                maxValue: 4294967296,
	                                xtype: 'uxspinner',
	                                strategy: new Ext.ux.form.Spinner.NumberStrategy({
	                                    incrementValue : 1,
	                                    alternateIncrementValue: 1,
	                                    minValue: 1,
	                                    maxValue: 4294967296,
	                                    allowDecimals : false
	                                })
	                            }, {
	                                columnWidth: .750,
	                                allowBlank: false,
	                                fieldLabel: this.app.i18n._('Name'),
	                                name: 'name',
	                                xtype: 'tine.widget.field.AutoCompleteField',
	                                recordClass: this.recordClass
	                            }], [Tine.widgets.form.RecordPickerManager.get('Addressbook', 'Contact', {
	                                    columnWidth: 1/2,
	                                    blurOnSelect: true,
	                                    name: 'cpextern_id',
	                                    allowBlank: true,
	                                    fieldLabel: this.app.i18n._('Contact Person (external)'),
	                                    listeners: {
	                                        scope: this,
	                                        select: this.onSelectContactPerson
	                                    }
	                            }), Tine.widgets.form.RecordPickerManager.get('Addressbook', 'Contact', {
	                                    columnWidth: 1/2,
	                                    blurOnSelect: true,
	                                    name: 'cpintern_id',
	                                    allowBlank: true,
	                                    fieldLabel: this.app.i18n._('Contact Person (internal)')
	                                })
	                        ]]
	                    }]
	                }, {
	                    xtype: 'fieldset',
	                    layout: 'hfit',
	                    autoHeight: true,
	                    title: this.app.i18n._('Accounting'),
	                    items: [{
	                        xtype: 'columnform',
	                        labelAlign: 'top',
	                        formDefaults: formFieldDefaults,
	                        items: [
	                            [{
	                                name: 'vatid',
	                                fieldLabel: this.app.i18n._('VAT No.')
	                            }, {
	                                name: 'credit_term',
	                                fieldLabel: this.app.i18n._('Credit Term (days)'),
	                                xtype: 'uxspinner',
	                                strategy: new Ext.ux.form.Spinner.NumberStrategy({
	                                    incrementValue : 1,
	                                    alternateIncrementValue: 1,
	                                    minValue: 0,
	                                    maxValue: 1024,
	                                    allowDecimals : false
	                                })
	                            }], [{
	                                name: 'currency',
	                                fieldLabel: this.app.i18n._('Currency'),
	                                value: currency,
	                                allowBlank: false
	                            }, {
	                                name: 'currency_trans_rate',
	                                fieldLabel: this.app.i18n._('Currency Translation Rate'),
	                                xtype: 'uxspinner',
	                                strategy: new Ext.ux.form.Spinner.NumberStrategy({
	                                    incrementValue : 0.01,
	                                    alternateIncrementValue: 0.1,
	                                    minValue: 0.01,
	                                    allowDecimals : true
	                                }),
	                                decimalPrecision: 2,
	                                decimalSeparator: Tine.Tinebase.registry.get('decimalSeparator'),
	                                regex: /^[0-9]+\.?[0-9]*$/
	                            }], [{
	                                name: 'iban',
	                                fieldLabel: this.app.i18n._('IBAN')
	                            }, {
	                                name: 'bic',
	                                fieldLabel: this.app.i18n._('BIC')
	                            }]]
	                    }]
	                }, {
	                    xtype: 'fieldset',
	                    layout: 'hfit',
	                    autoHeight: true,
	                    title: this.app.i18n._('Postal Address'),
	                    items: [{
	                        xtype: 'columnform',
	                        labelAlign: 'top',
	                        formDefaults: formFieldDefaults,
	                        items: [
	                            [{
	                                name: 'adr_street',
	                                fieldLabel: this.app.i18n._('Street'),
	                                columnWidth: 47/100
	                            }, {
	                                name: 'adr_pobox',
	                                fieldLabel: this.app.i18n._('Postbox'),
	                                columnWidth: 47/100
	                                
	                            }], [{
	                                name: 'adr_postalcode',
	                                allowBlank: false,
	                                fieldLabel: this.app.i18n._('Postalcode'),
	                                columnWidth: 47/100
	                            }, {
	                                name: 'adr_locality',
	                                allowBlank: true,
	                                fieldLabel: this.app.i18n._('Locality'),
	                                columnWidth: 47/100
	                            }], [{
	                                name: 'adr_region',
	                                fieldLabel: this.app.i18n._('Region'),
	                                columnWidth: 47/100
	                            }, {
	                                xtype: 'widget-countrycombo',
	                                name: 'adr_countryname',
	                                fieldLabel: this.app.i18n._('Country'),
	                                columnWidth: 47/100
	                            }
	                            ], [{
	                                name: 'adr_prefix1',
	                                fieldLabel: this.app.i18n._('Prefix'),
	                                columnWidth: 47/100
	                            }, {
	                                name: 'adr_prefix2',
	                                fieldLabel: this.app.i18n._('Additional Prefix'),
	                                columnWidth: 48/100
	                            }, this.clipboardButton]
	                        ]
	                    }]
	                }, {
	                    xtype: 'fieldset',
	                    layout: 'hfit',
	                    autoHeight: true,
	                    title: this.app.i18n._('Miscellaneous'),
	                    items: [{
	                        xtype: 'columnform',
	                        labelAlign: 'top',
	                        formDefaults: formFieldDefaults,
	                        items: [[
	                            {
	                                columnWidth: 1/3,
	                                fieldLabel: this.app.i18n._('Web'),
	                                xtype: 'mirrortextfield',
	                                name: 'url',
	                                maxLength: 128,
	                                listeners: {
	                                    scope: this,
	                                    focus: function (field) {
	                                        if (! field.getValue()) {
	                                            field.setValue('http://www.');
	                                            field.selectText.defer(100, field, [7, 11]);
	                                        }
	                                    },
	                                    blur: function (field) {
	                                        if (field.getValue() === 'http://www.') {
	                                            field.setValue(null);
	                                            field.validate();
	                                        }
	                                        if (field.getValue().indexOf('http://http://') == 0 || field.getValue().indexOf('http://https://') == 0) {
	                                            field.setValue(field.getValue().substr(7));
	                                            field.validate();
	                                        }
	                                        if (field.getValue().indexOf('http://www.http://') == 0 || field.getValue().indexOf('http://www.https://') == 0) {
	                                            field.setValue(field.getValue().substr(11));
	                                            field.validate();
	                                        }
	                                    }
	                                }
	                            }
	                        ]]
	                    }]
	                }]
	            }, {
	                // activities and tags
	                layout: 'accordion',
	                animate: true,
	                region: 'east',
	                width: 210,
	                split: true,
	                collapsible: true,
	                collapseMode: 'mini',
	                header: false,
	                margins: '0 5 0 5',
	                border: true,
	                items: [
	                    new Ext.Panel({
	                        title: this.app.i18n._('Description'),
	                        iconCls: 'descriptionIcon',
	                        layout: 'form',
	                        labelAlign: 'top',
	                        border: false,
	                        items: [{
	                            style: 'margin-top: -4px; border 0px;',
	                            labelSeparator: '',
	                            xtype: 'textarea',
	                            name: 'description',
	                            hideLabel: true,
	                            grow: false,
	                            preventScrollbars: false,
	                            anchor: '100% 100%',
	                            emptyText: this.app.i18n._('Enter description'),
	                            requiredGrant: 'editGrant'
	                        }]
	                    }),
	                    new Tine.widgets.tags.TagPanel({
	                        app: 'Sales',
	                        border: false,
	                        bodyStyle: 'border:1px solid #B5B8C8;'
	                    })
	                ]
	            }]
	        },
	           new Tine.widgets.activities.ActivitiesTabPanel({
	                app: this.appName,
	                record_id: this.record.id,
	                record_model: 'Sales_Model_Supplier'
	            })
	        ]};
	    }
	});


/***/ },

/***/ 473:
/***/ function(module, exports) {

	/**
	 * Tine 2.0
	 * 
	 * @package     Sales
	 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
	 * @author      Alexander Stintzing <a.stintzing@metaways.de>
	 * @copyright   Copyright (c) 2014 Metaways Infosystems GmbH (http://www.metaways.de)
	 */
	 
	Ext.ns('Tine.Sales');
	
	/**
	 * @namespace   Tine.Sales
	 * @class       Tine.Sales.SupplierFilterModel
	 * @extends     Tine.widgets.grid.ForeignRecordFilter
	 * 
	 * @author      Alexander Stintzing <a.stintzing@metaways.de>
	 */
	Tine.Sales.SupplierFilterModel = Ext.extend(Tine.widgets.grid.ForeignRecordFilter, {
	    
	    // private
	    field: 'supplier',
	    valueType: 'relation',
	    
	    /**
	     * @private
	     */
	    initComponent: function() {
	        this.app = Tine.Tinebase.appMgr.get('Sales');
	        this.label = this.app.i18n._('Supplier');
	        this.foreignRecordClass = Tine.Sales.Model.Supplier;
	        this.pickerConfig = {emptyText: this.app.i18n._('without supplier'), allowBlank: true};
	        Tine.Sales.SupplierFilterModel.superclass.initComponent.call(this);
	    }
	});
	
	Tine.widgets.grid.FilterToolbar.FILTERS['sales.supplier']  = Tine.Sales.SupplierFilterModel;


/***/ },

/***/ 474:
/***/ function(module, exports) {

	/*
	 * Tine 2.0
	 * 
	 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
	 * @author      Alexander Stintzing <a.stintzing@metaways.de>
	 * @copyright   Copyright (c) 2013 Metaways Infosystems GmbH (http://www.metaways.de)
	 */
	Ext.ns('Tine.Sales');
	
	/**
	 * Supplier grid panel
	 * 
	 * @namespace   Tine.Sales
	 * @class       Tine.Sales.SupplierGridPanel
	 * @extends     Tine.widgets.grid.GridPanel
	 * 
	 * <p>Supplier Grid Panel</p>
	 * <p><pre>
	 * </pre></p>
	 * 
	 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
	 * @author      Alexander Stintzing <a.stintzing@metaways.de>    
	 * 
	 * @param       {Object} config
	 * @constructor
	 * Create a new Tine.Sales.SupplierGridPanel
	 */
	Tine.Sales.SupplierGridPanel = Ext.extend(Tine.widgets.grid.GridPanel, {
	    
	    initComponent: function() {
	        this.initDetailsPanel();
	        Tine.Sales.SupplierGridPanel.superclass.initComponent.call(this);
	    },
	
	    /**
	     * @private
	     */
	    initDetailsPanel: function() {
	        this.detailsPanel = new Tine.Sales.SupplierDetailsPanel({
	            grid: this,
	            app: this.app
	        });
	    }
	});


/***/ },

/***/ 475:
/***/ function(module, exports) {

	/*
	 * Tine 2.0
	 * Sales combo box and store
	 * 
	 * @package     Sales
	 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
	 * @author      Alexander Stintzing <a.stintzing@metaways.de>
	 * @copyright   Copyright (c) 2014-2015 Metaways Infosystems GmbH (http://www.metaways.de)
	 *
	 */
	
	Ext.ns('Tine.Sales');
	
	/**
	 * Supplier selection combo box
	 * 
	 * @namespace   Tine.Sales
	 * @class       Tine.Sales.SupplierSearchCombo
	 * @extends     Ext.form.ComboBox
	 * 
	 * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
	 * @author      Alexander Stintzing <a.stintzing@metaways.de>
	 * @copyright   Copyright (c) 2014-2015 Metaways Infosystems GmbH (http://www.metaways.de)
	 * 
	 * @param       {Object} config
	 * @constructor
	 * Create a new Tine.Sales.SupplierSearchCombo
	 */
	Tine.Sales.SupplierSearchCombo = Ext.extend(Tine.Tinebase.widgets.form.RecordPickerComboBox, {
	    
	    allowBlank: false,
	    minListWidth: 200,
	    
	    //private
	    initComponent: function(){
	        this.recordClass = Tine.Sales.Model.Supplier;
	        this.recordProxy = Tine.Sales.supplierBackend;
	
	        Tine.Sales.SupplierSearchCombo.superclass.initComponent.call(this);
	        
	        this.displayField = 'fulltext';
	        this.sortBy = 'number';
	    }
	});
	
	Tine.widgets.form.RecordPickerManager.register('Sales', 'Supplier', Tine.Sales.SupplierSearchCombo);


/***/ },

/***/ 579:
/***/ function(module, exports, __webpack_require__) {

	exports = module.exports = __webpack_require__(1)();
	// imports
	
	
	// module
	exports.push([module.id, ".SalesContract,.SalesIconCls,.x-tree-node-icon.SalesContract{background-image:url(" + __webpack_require__(827) + ")!important}.x-btn-medium .SalesIconCls{background-image:url(" + __webpack_require__(1192) + ")!important}.x-btn-large .SalesIconCls{background-image:url(" + __webpack_require__(1553) + ")!important}.SalesProduct,.SalesProductAggregate,.x-tree-node-icon.SalesProduct,.x-tree-node-icon.SalesProductAggregate{background-image:url(" + __webpack_require__(823) + ")!important}.SalesCostCenter{background-image:url(" + __webpack_require__(832) + ")!important}.SalesCustomer{background-image:url(" + __webpack_require__(24) + ")!important}.SalesAddress{background-image:url(" + __webpack_require__(137) + ")!important}.SalesInvoice{background-image:url(" + __webpack_require__(53) + ")!important}.SalesDivision{background-image:url(" + __webpack_require__(40) + ")!important}.x-btn-medium .action_reversal{background-image:url(" + __webpack_require__(1142) + ")!important}.x-btn-medium .action_rebill{background-image:url(" + __webpack_require__(1147) + ")!important}.x-btn-medium .action_merge{background-image:url(" + __webpack_require__(1156) + ")!important}.x-btn-medium .action_bill{background-image:url(" + __webpack_require__(1201) + ")!important}.action_reversal{background-image:url(" + __webpack_require__(768) + ")!important}.action_rebill{background-image:url(" + __webpack_require__(776) + ")!important}.action_merge{background-image:url(" + __webpack_require__(789) + ")!important}.action_bill{background-image:url(" + __webpack_require__(836) + ")!important}.preview-panel-symbolcompare.wide{width:160px}.preview-panel-customer{margin:5px 2px 5px 5px;width:32%;min-width:200px}.preview-panel-description.preview-panel-customer{width:22%;min-width:200px}.clipboard{background-image:url(" + __webpack_require__(64) + ")!important}.preview-panel-invoice-default{display:block;height:122px;padding:5px;margin:5px;font-family:verdana}.preview-panel-invoice-left{float:left;position:relative;width:32%;height:122px;padding:5px;margin:5px 2px 5px 5px;font-family:verdana;font-size:10px;color:#404040}.SalesOrderConfirmation{background-image:url(" + __webpack_require__(66) + ")!important}.SalesOffer{background-image:url(" + __webpack_require__(137) + ")!important}", ""]);
	
	// exports


/***/ },

/***/ 666:
/***/ function(module, exports, __webpack_require__) {

	// style-loader: Adds some css to the DOM by adding a <style> tag
	
	// load the styles
	var content = __webpack_require__(579);
	if(typeof content === 'string') content = [[module.id, content, '']];
	// add the styles to the DOM
	var update = __webpack_require__(2)(content, {});
	if(content.locals) module.exports = content.locals;
	// Hot Module Replacement
	if(false) {
		// When the styles change, update the <style> tags
		if(!content.locals) {
			module.hot.accept("!!../../Tinebase/js/node_modules/css-loader/index.js!./Sales.css", function() {
				var newContent = require("!!../../Tinebase/js/node_modules/css-loader/index.js!./Sales.css");
				if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];
				update(newContent);
			});
		}
		// When the module is disposed, remove the <style> tags
		module.hot.dispose(function() { update(); });
	}

/***/ },

/***/ 768:
/***/ function(module, exports) {

	module.exports = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAABuwAAAbsBOuzj4gAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAKXSURBVHjahZNLSJRhFIaf/5t/GkfHGJ1GwwsoNV4pDLuZRLSqbW4qghYFEkER1CrdZRZFq5BoUYsWERGFEQ502bhIuxiWXUxcKKjJmKNj4+jMfznJb5NjQb1wvsPh+96HFz6OJiIAaJrmB6pheeT/EuCLzoqqI5HIS1sEpZRTS9BVBaS7c5/r8+3KBGi28E85oNURtUwALpdKP/ydQP2ZwoGsJNHPN5UE2h+OTadjjX55xeCbJ4wO9vIjOkVeQTGbGw9QtXUfwZKKlQRKLffLJ7Z9iEXH73T2zA4fa6p/FCqzqWsox1+Yi9efw2Iszsy3GIP9k0zMFHPozE1cuttJ4Ha7G7UbZ2vNUEVQ9fROyMEj9aq0Jg+w+FuKiaEZOh985fiFp2T7/MuAjjOV5tGTe12WpeFy2wDYCyZGNIoRG0fP9eMJlqDWuACYjcxz//4Yp669cAC6bQvmooEosG1ITA4yN/KJkVGb6SjkZZmEijT8tbvxrCvE53WzudKiJ3wLACW2YKSSWGaK+PfPzM0OEH7tRVW1srM5TDJ0mvDwRsbfdpOcimDGF9hUXcTTu20AoptLZiMxjcrx4vJl4fX4KS2dp6i8lrLq7ZTX7GAhfo7w9cMEJsfIWr8BsVMUFwaAMVOfiaW+37vTV+Bao6N73JqmQERn6vEVyqq2k7M236lA5X6mEr0kU43kFoSIB7s/wvt+AK25ud7ty9L3xGajEv8Rk1QqJYZhiGmaYlmW2LYtL7tuS3dnhzNfvdQyDGQ7e7R0OAU0JBLzkpifk2QyuQqwuBCXge678q7nubS3tQwB+WmfYkUOTikNTQORX19qmSRiEYKFAel69qLvfOvFuiVjNG3KXGcPsAUy9yUTjgn0i4hBhn4Cdg86oqKzQ2YAAAAASUVORK5CYII="

/***/ },

/***/ 776:
/***/ function(module, exports) {

	module.exports = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAABuwAAAbsBOuzj4gAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAKqSURBVHjapZPNS1RRGId/7zn33nH0zmiYDmVfVA40haaFURotCoqoiNoEbdq0LrJ1QcugfyBcFQThpk1IbcoghKAvJBojtU8zM52Ze+/cuXPPPW/T1cpF4aIH3sU5532f81ucQ8yMpdA1aiei05Yh9xJElyApTCleuoF/P9L6Bvfzx8W+NgA6FixuCCK6KKW43LEuW59tXY+OTBYMIP/tHfLT43jxIV+BxrlQR9NCiFsEfIkFtWGTiIZbG5u6T/ceTaTqkvgbM8UiBp8MqYLn6FO7Dlu3Ru56Bha41NzQ2H18z8GEE/lwvQrmQwef/WkIIbGxfgMsAsggnNhz0IAW+JXcqN2+Q5C4sDPXmZjyvsWRXzvjmC3NgOaZ68w65FeMEQwT29LtSBl2PChZLggAnMnYK5MF4QIB8M7/hPJbR7uuH4AwVESlgabRl2lpTD5Wz0SHvQWmNGGxBMcJQH2JlMlzQbFa0YFbLZWLjudnmDjL/TxVS3hMEPXpNIuUtFEIXUglQNALCRici9L6TUGVvnvKmxOz0SoQP+IL8XAOwEDP9g1WwMyGNgBFHOkqWGkFZmWgRiksjrkUzGrWxXptWviD/FkjzyfNeKURQKGEqFYKBUQYMACMijl2o0w0DsCxM9ZEOR+epyvUwpd4FEAzahwY3GxMNZXIj0I1eWiesYiBAm6ypiwyeA+g7NQFXpudvvplzDlJZ2kUCk/3H9kchClNJQqkT6HCEgxM4WboqGPNm+yvXrLiNkirYubE+309m2bKbjWQISKkgOHeiTD3IBNJCCxl4SVeJ3TZa9o/tMxFDWRV00aiastEKSlMZQqh7+1+o/EPfv+F1LWE6Ni6OqXsiLVm1WgkgppE39n1Km5YThBDDwk95lpRrProbFrNt7texofLCv6HH4ASR6eUw8F0AAAAAElFTkSuQmCC"

/***/ },

/***/ 789:
/***/ function(module, exports) {

	module.exports = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAbsAAAG7AEedTg1AAAAB3RJTUUH1wwdDgI3JHkO8wAAAfxJREFUeNqlkE9rE0EYh3+7s2l2N9nVmLQbKaIW1IMX9SRYvPgNpHgpIoJepULxWM9+AaGHYrEB8VIF6bF4EJFKwX+gWIpNU5OSNrGJu+5mu7szvq6LhBzaqA/zMjMvzDO/GfwvEnoYuTwtUXsdgueEEKAZIq6osf5s4jh6UNADD30SiCM3x05DkqS4QNwvLekg9hVEuy5IgE6n8/swlRT3PfQnCDyAorfbdncC6rt9CnwHwC+BgzhAkoDvlWDowu1J8Oiu4IEU+XacwLZdMCbHAkF7SiDnzl6zITiN+GMftD88uqUgtrsNHu1mR45aMIwMNF2HxAbAlBQkWQbnES6OnoPjONmt+jbWvpRBPAchJ++bpehPN6s1eD7dhjS4pEOwLEJo+OEr2N4JUPnawkalCh54M/an+Sd/BDtv56jp3mg1atVm8xsJVMgpEyn1INTMIehGHmZuEAMpho69tUJpJ5AgI8FeWWiS+erm6jJX1TTyhTwsq4CiNYihQgEZXUPl8+tA8GjcW1t0kMDQRfh9oyyYprvt+uiZ85foIN1sZMEFx+L8NJr1ypRfW3qMLmT0IjBVW32z/P7lAoIwRBRFeEfr8sdXL8DDe+gHZgyfTJtFe2zyobhypyTSptVSjOFj+BuYlr9+4PApYVonhKzlxvEvsEyxRDWLPfgJexzv6YgfhCAAAAAASUVORK5CYII="

/***/ },

/***/ 823:
/***/ function(module, exports) {

	module.exports = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAABuwAAAbsBOuzj4gAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAJzSURBVDiNdZO9b1RXEMV/976372PXu/YuwpYj0qRBokRIpiJFUJrkL0gHiShoaOgSIaVwESlp6UApUtFAkyoIKBBVpEhWohAlIoqwkHcxa9a73n1zP96kwGvzYY40mlvMOTN37j1GVTkKT+6unwQ+BVLgIfDbR+e/Dm/XmbnAk7vrx7xzn6nq52kj/djaZHleNJ0JVSVVHd3vUs0eee9+UeX+J5du7pmfr391tbe0eHX5eHcZMHOSDxEfIqiSWEVEcOJeZSeISD0aDa+kzWZ5flfMCi/G+BDpLbUAyNKEMm8gIgfhRBDniFGx2YINftCzTkI6nMBuldBtZ2is2Xo+oq7rQ9J+zjurlIsfMN0bM9p+hvfepkUjxpXkJYPxAmViWGrnnFjp0GikbG7tsFDA0oenedn/l+ebf+2P73AiOO9Ivfe2rmtaZpdZc42d4SYhOBZLJW2vYsyYp388eO0K86kc3gdrfQiJiJDZQGexy0Qsq80p3WJGGYdMdgaHe3Dyxk5iCKTB+0SkQlXpb/2HUUcMnmANeV4wdP6I7kIIAcCmIqIigqry7O8NmplFkoRX/8PgnHtHYJ+MAdIQvJkLNFNLpoKIRbUGOOz6FtkmKXWMqdVa76iqigizSg6e7zCqg3MIAWsTGnlJ5eOfMynWjaryw8W1E+3l1q/bs8ZKd6Gg16xpZBl5XtAfDNgbj4gxAhCUyXTPf3ntx41bb3gB4PvLZ0+2WtmjVln0siwjywv6/T5STfEhRvH1rW9ubHxxpJlex/ql02e67fJep9Nub7/YYTKZ/jM2fu27G4+H73XjUbh24dQ54+tj3/70+Pb7av4HRO/LbZzu8lUAAAAASUVORK5CYII="

/***/ },

/***/ 827:
/***/ function(module, exports) {

	module.exports = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAABuwAAAbsBOuzj4gAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAI4SURBVDiNfZK/S1tRHMU/9737XqAOhRQkSwTHTh2aTXxLcZOQhEdCiEogi3+BRTqVzsWtigguXRxaKC4i1L+gmMW6ZNC4NcUM6Xsvmpd3v11Mmvijd7r3fr/33HPO9ygRAUAplVpaWvqQy+Ve2bZtGWOUiEiSJNwtUUrJ+fl58/Dw8J2IJABqAqB4enr69eDggHg4wLJtlAIRCII/tNtttKXZ2HjL4uLiGxE5AdD8W88dx6HX61Fp5EmMwVIWQb9H5/cvXpuX/Dj5Oe4dbSYBiOOYq6srPr7/RBiFBEFAHMcAzDybQSk1Pj8KkE6n2dzcRGuNMWaqWSmF4zhks1kANS6ICHc+1C8uLsTzPPE8T7rdrnieJwsLC3J5eTm+73Q6ApRG7yZNrLdarf10Oo3jONze3jIcDscf2baN67rc3NyQyWR8EfkCYE1KGA6HFItFlpeXieOYcrmM7/sEQYDv++TzeSbGyv0x1s/OzvZnZ2fRWhOG4UgaAK7rorWm3++TzWYfZ5AkCb7vUygUSJKEWq1GtVoliiLK5TKlUgljzNMMms3mfiaTYTAYTFFVSuG6LrZt0+/3mZ+ff5pBpVJhdXWVJEmo1+usra0RRRErKytUq9UHHkzlwBjD3t4ecRxjjGF7extjDKlUijAMsSzrgYQHAI1GA4Dd3V3W19cREXZ2dsah+p8HtaOjo893SZvSP8oAwPX1NblcriAi3+4zON7a2mrPzc29eAxAa61EhFar1QW+j+p/Aaw8NvYsDfd6AAAAAElFTkSuQmCC"

/***/ },

/***/ 832:
/***/ function(module, exports) {

	module.exports = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAABuvAAAbrwFeGpEcAAAAB3RJTUUH1wobCy0tZ+encwAAAtBJREFUeNplk0tvVGUYgJ/vcs7MaZne7DiltGKxIVUTEiV4qZoYgxLFiC4IIJO4MGCCf8SFWxJMNGyMVm1IZQG6caOy6ELUaA0ahNJW5kzb6fTM5cy5fZ8TSYx1nuRZvs+7eV8Bvcy9gVA5VGZxAZQgJiU7Po/lf+wIfHYM8cDjlPY/Jt7Jjz76qi7MTCFdkbZuLUcbv1y9+WPjwh+LrL65gO0JzJ1EPHlYvFJ6sPChO3Z6TA4cBTVCElswW+j2FeL1T2vV5fq5a1/aL04tYAAUwCevw6HnxUvj+8Yv5SffG5bOAZLQsLGyTVirk1MxjjOO8p7yPPnrscGRYGnW47f5JZAAA0WGikX3A7f4ridSC7FP2q6Q1itk2z6u8iHzESbEHS47o/f3ny/uoQSgLrwMs0+Lt4Ymny07hYdANrs2iFptQn8brUIKu+sgGkATQYSwbn8uu705m+d7fd8AMic5ogt7Qfqgsq6GLBbYVkRuRIEbQ5aBTAGDHizhCo6Q432NQJGwV/ZZUBVwTNcMk0hEN9D5S3G3ArtfDMHmQXaQNkFkehKRaI3Fmo5NbbyIcJugXJCabMvFrsdQNew6JEE2IN4Ak2BtkSzszoDVRmLiNjeysPGEHFoDAUjo3+fRN+HQvBjgPeyBDsHyj1kzT9xMf5eWVAarmHrApfC2BiW7Ahq86RB3vIM3tQs90QEFyHuGNzVBg4WoTSbPfAs3qny9eX3lu2h9mv9iO5A7qMDYf7cnW9PUFld/Wqowf/ryvSZRi3B5y5z1P1+7E63MQKohAhs7OI9YiIBYEt+dwZ+r+nc2k7ezFsGOU/74BGJMs3/SFedHDky90H9QCWdsECEDkqqg9UNK7fqta2uRObcW8HP5MrbnmS4ehr5R8nsEzw0XvNdypeFp4WoRr9f/rG02rqym9pskoF2+uuMbe/noGRicQKK6AtZgojqm/BU9/A1IVjhqdLRpoQAAAABJRU5ErkJggg=="

/***/ },

/***/ 836:
/***/ function(module, exports) {

	module.exports = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAABuwAAAbsBOuzj4gAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAJwSURBVHjaxZNPaxNRFMXPzHvTJJNMmj+mSUyttkmKNURtsbViqQraDxB3XbgVN36BbgpipXblSsFNNy7cdCkV7EaoLqwiShdFi63YopImk2Qy05nJe89xxI0LQbrwBxcuh8vhXC5XEkLgIMg4IPR3M3d/sVcm7PoXl69nUyklEgrSgKLQLkr90i3D2v62ZwxF1bOPX67eebqw8N03mJ+fl8rl8uBO7euDjbVXFyW7jXeOC+nPqLLs13auD8m+/hKAKV8vFovTtbo+12hbQ4pC9gXjIptN80wiIY4dyYlSsSCOpNM8mYhxNRjgjmPtd8lyeebW7Rt+gkql8uj89LXC5OUrlfGJCWihIFaWlqS4XsXA0QGooRDWNzYk+3AehdFz6DAWdDos8+bF6iA8/CvMPFx8XujvL0XVIElGNdJsW7xhWjAdWwhIkjfEGf+Fy5j4qeiG+Wl2+uq4b3DvyTPxYWsL9b0qmNv5+9koRSQaxehgHoZpxUhuZDSfjMVuxru7IXY3QQwdqaCEZBcQpwI9IQK5qUN128gfiiECB2PDI8ikelCrVl/LrsOmOATerq3BsW1EIhEolMJqmWjWdXCHQQur0LQo2kYLjWoVK8vLaFoWCCETVFBpct92oRIOJRBAOBgCoQRhTUPI6/VaHZCBbDoDwzKgxRL42DBh2g5kopyiQpaPW44DBQKkK4B4MgFJgp8i5u3a25sDYwyu04EkE3ze3YGqamh7BhIlfdRutczuZAAnhsc80fYGbTDBYXMBy5WBDofLAMEp5EgcuVIa0XAYQgjs1Vu6dObCpcniydN3CSEU/wDz2Fx/P/v/v/EHC/AP48rk370AAAAASUVORK5CYII="

/***/ },

/***/ 1142:
/***/ function(module, exports) {

	module.exports = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABYAAAAWCAYAAADEtGw7AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAADdgAAA3YBfdWCzAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAPLSURBVHjatZVbbBRVHMa/M7Mzu9vtLhbolW1cKG0jreEWKW1SESMhAmpNjCYqiS8+0BB98EI0vvTB+GDUqC9KjCaSwIMJQROCxktFoFWopC0XKbhAS7vdurDuZmEue+ac49lppmS61AeMX/LNNfP7f/P/z4UIIfB/KOBtEELiABrx33RNBp30wJ7ihmEOUEpBiFsJpGRIzV/fTnM7oapC1/VOAGVgYtk2TNOEohBpxQX7XV7Ik6QC8Or6wR7wrsDyXFmPfSdVVQEgkJsZx+XzPyB1cRA3czMIVcRQl1iNVRufwdJlzW5hD0zuBP787Wffn/rz+AEPnL4ygu/2vYb16xvRuKwSax6vRnRpAlbBRDY9ifRwH378cgr3P7QLqx98Dh5OmQcm+/q6RDDMxeBv44c2bNrxpFP4A9t62lFZgwXl2Dp+/XYMFy872PnGQWh6yL0DTdO6hBCDbmJOTTz6fAeJhCI91fV5tD22DkSxwAwsKAILnVuWI5HM49PXu9D73kmoatDfCsYYBGXo3trkToRRCyUJzlCcSaGYSYFZFtRwCHpVA4L1cRAIABw19RE8vPle7H93J1546ys/WAIkjM8OQnHjgBo55C8Nws7ncD1DcCNLEAk4qIuexaLqJYje141ANOoCEs21ODM6grHT3/vBnHM4lEooAVEJqJVF/tovKBgC/UMx1LRsRX1HG6bHL+DE6FGsy06jrfA17lm7HWq4woVs3tSETz7YPQ/MOBi1QQLETW0UzkGNCSTPBBBvfwJP7frI95we2rsHyYm9aL1wDJHWbhAQBAEsjik+sGKbN2HeSMqkOTBuoqK2HeHaVmzYrsBIHUR64pzvBel58R0U6p6GVrUK3CQQTAe3GeLVYX/i6zl+5cjhq8vVwDgCIR1aUJfpORQlBDVk4Pypz9CQ+HAutRLQ0NC0BpQJaBoB0SWQ3EI8zgGMiDlw3/7Uipe2NQe/6L/akc5kj9KiKQEKApoG7lCEI4vKXlk1vBjTmSrojgpYlVCDlbCXIA8c/guehBCupTot2xaGYQjTuCWKxaKglArHcVwzxgTn3PU3Bz72tt3jwyf77ZaVKx4ocTz7Ok5cC2kG5tA7fmD+zkwiFovNhTo7MuT0vvzKI2OXkqd8w0OZShU5FFX1qs8VpbaBopmFHorMQkdP01f3vLnjxMDvx8r/IGUqDSjk9nk2KAdnTIKY3GcIh4NyqDGMDg9Zvbt7twwMDB2HT+U93ih7Ob+v0qU1FcyxhUMNYRSmxc8/HUm1NK9c6167gIlc3M0/b0peN4F/0T8nxOVjAWiwcgAAAABJRU5ErkJggg=="

/***/ },

/***/ 1147:
/***/ function(module, exports) {

	module.exports = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABYAAAAWCAYAAADEtGw7AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAADdgAAA3YBfdWCzAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAARaSURBVHjatZTLa1xVHMe/v/uYuXcmk8xMJpNHm87k2bza1ARaaEUrVupCslDRhejOjbrwXxBUcCGKr7pw4aZQlShSEIqtllJFrLWpNpgmaWiamabJzCSZzOveufec47nDkNA2FLro5/DlcA+cz/lxHpeEENiJ8c8HGgEclRnzPuvxmJK5Uu/PXX5zZu2eeYoc4554J+nzpNCJ5s7meDjchIHYMLrCSYS0ENbK65jOXMXNzALSi3dy3BVvSdEpOacNwMl6Ie/VxVvCGIBPA2Hz5f0HHqPdoRgiegCmrqEiivAwqQEuU5F18lgurWF66opYyxYmAQwne3cNTgy+hE9Of1Sqi7ekl9v7O/YMdg0h6vPBhY0HoZOBquvDbPoaiAidbQmUWBkXf/5NaNjmRGt3x56+RB9ctok7FX6XRCMfOBi4YEAdQh4KVOxpS8pxgbK7Abeu1OrVvqKbvhd6El3IVVYgZPNQSEHaymCxfBupyjIc4SCiN2GXGcdIsAem5gcEUEDR62rzdL0RHjT22d4YgNmRsbFI2dhExSnDwwXH1cIMbFZB0uxG3BeDBh05N4OMnQKYi75QL2K+aE3OIMBlwmYMl369VKv7mD8UCDtGVR7GKjxIUTBTnBOtRgz7tCO0OHtDZO2U5Qn8ht94fOgJWhL/4U75FnQoMBQTTAgZqTY5PBSZsVBjE2XsDDbdEpdxlsq3LY3IGsEAzV6bXrMt61UhRFhADFqWlS1u5uXhhhFWDTisCJc5srdR5baUu1vi8Xg0isViulRgpWWZ+ZVqZmpI63dvzi0IAG/Ie3pSpgrgq9bOeKypXYBbBbT4WhGkBgjuoMIKyDkrcLi9dXhjQmXYYPkbgrAuBIo2t0uG6zu4YTue7Htss//A3m7KOTnEwwmACAJUuynNaAFAKK26kMx7Ym5XLeTdzTQnkYOovQTpdiChWrZ558zZP94H0AgJEWGHlztNAq974r/dYvVYkPvZulZIASiDULZdK6Vqaidz2GveFkAit+MLAF7w4i/PUMvuoLZa2WBBNSgCMPDlyKRAHU/8V3Yj/3Rfc3vgT1FYBmB58ixyk7HGlrfzucLH8p5D8o0UF1An2dHoP7V0ThQci+Wfte4ru1ZxpWKjqdqQhI5VT+wn1bplrJyOWqFIg+EftouV54iJQ4c/7P22fTRxNtnWRterC0wTpAZUH0XOmLR+vCLuFZ9F1b2ulMzAkK+zbzaYPu9XdNtU9OqtWPqDJI9F/RZFVFCVGF9lTVyZt//lqWLWlVKmcBc7UfsJyUpGSaGJeEeELviv/aQGlIKc5ASkXC5QMhTN0hXVVYk4AH7u8Pxd1Q2cb6WZoyviPrHHU+8mIoF9iWDPSIh+WLjIpNity21T1R2/onGNFP7joWmBB3Cf2INkm7hwPBhJpNSVDPhaeZMF5QJBVWeGoovvDv4jIHlI8TZP/n6Exls7tbn1NO8PmyJXWhdfj14SkDyU+FGg4BHxP/SDI/tbSk1HAAAAAElFTkSuQmCC"

/***/ },

/***/ 1156:
/***/ function(module, exports) {

	module.exports = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABYAAAAWCAYAAADEtGw7AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAmEAAAJhAGq4mN5AAAAB3RJTUUH1wwdDgYRkhhOCgAAAwlJREFUeNrVkuuLDWEcx7/P3M5t7Mpl16LIRqFEat1yS8kLorB5s62wRUpJyj+Ad4rihbQvdiVCpKyVWyJiV9kUx2Et61zWnvueOTNn5pl5xrOnplintbt54zP96jfP1KfvfGfw30EwCqfbXre13Xu/06IMv1KtKmjctODuiaaGxgmJ17S00/17lkqCIGAkFy93I5HW5b7bh2xUQMIoxAbSsEwLlcSJZBauC4/xiZljQdOKFcXMLoG5ZGJixzZRKFQWO5bBxe7ExC4X60Wdi0UQQrxTXoHLxfrYqmg8evFMdshoeReJwYNRS7IsB6JEPHFZylwGRo3hPVez8jBABCysn4V9u9a1Nu9YfeQ3ce+3hFVXU6VuXDUXoihBVmRIkgyHEbgO4AXmXjAGbN+6mldlhyi1YFOK6oAPdx93r/gjcX988GQ08WN3w7L6eVXVVQBELpN4OgHgw69hOxczPig/13hNA4kkvn6LYSifY4Ikn/B8orfo0S7LN33Rm3wu2zyjbqZAeGqXiHAhweFiiwJ6yUZBoxhMFRCNZzCYzCGXL6KQS4JS41S250rrb2IPY6Dnu61M8+dy+loKFUbJhWEBpkW4mIA6BDYj5d/M+6D6UAqpWOQlEeRmMxVmf4g9JLXuWTEb21o7e37d5Km1CIVUBIJB+P1++BQfFFmByLsnggDbNPCxqyPv2HSz1vsgg18QMAK9/7nlmFrTp647JZ/PhyCXhvhMCoWgqnwPDd8HyueR7g6Yev6g/v1FH0YgogKOnkxShiJhdEv94gYEA374A8OJFciSxNMShLseIvL2aauVCp9CBQSgMryzsx9edz5IRj8gwKVqMFhOHORpC5k43jy5HgYRjoAzLjHNfnEhynsf3Tifdh2z/Poqr0EUXHRePVeyGdtD05HiuMQedr4/XtC0lo5rFyArEvy88/s3LyGd+nHMzvb2YBRE/AVmZMIZzZ5VPa12+UC0H5232m8SUTnuaAmMhoQxQETf0U+Dnze8f/JM5vsBM/4K/4wpS7bNDcxZPw9j5CeD6GqFeTIGdAAAAABJRU5ErkJggg=="

/***/ },

/***/ 1192:
/***/ function(module, exports) {

	module.exports = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABYAAAAWCAYAAADEtGw7AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAACYQAAAmEBwTBV+gAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAPzSURBVDiNtdTNS1tZGIDx59zc5l6NKXGsE5s2FLVI8KPFGFQsXUgrLoqLtAylCzultNDdgH/A7GdRDLiy7mTagtD6VcrsOotuZjUURYugqR9B20BiMvFqcs+5Z1bTYWpn4mbO8l38eHg5vEJrzf/xzC8Hb9++/UkI8YNhGIbneUIpxdHREQcHB/rw8FD4fD7t9/sxTRO/309NTY12XffXa9euDf8nrJRKLCwsWE75DwKn69Ba41YqOIcO5XIFtKbiVlBKYQiDgP80Dx486K5a7Pf7VTqd5rvvRzjzbQPCMDAQHFXKlN1D9gt5ioUiDQ1n0FIw9/MvmKbpVoVd1xWGYSCVS9l10ID2PDQa0zRo+KaBU75TnPL5cFHYtk2lUhFVYSmliMfjLP+2Tn19PeVymUwmw97eHq77d5hlWTQ1NRGLxVBKVYeVUty9e5dKpUIoFEJKSaFQIBQKUSwW0VoTCoVwXRfHcaitrWVlZeVL5uurmJyc5PXr11y/fp10Os36+jpjY2OkUim01rx48YKJiQnevHnDjRs3uHLlSnVYKUUymaSjo4PLly+Ty+VIp9MMDAxg2zae52FZFqOjoyQSCdrb28lkMtVhz/PEwsICHz58YHl5mWw2y8ePHzEMg9nZWUqlEolEgmfPnvHu3Tv6+/tJJBLVYSklQ0NDrK6uEo/HyWazpNNpuru7cV0XKSWWZZFMJrl48SKXLl1ib2/vRKsQwWCQlpYW6urqkFIipcQ0Tc6dO4dSCq01wWCQ5uZmAoHAyX6F53k8f/6cpaUl2tra2NzcpLGxkb6+PmZmZjBNk/HxcaamptjZ2aGtrY14PH6y4jt37jA4OEgkEqFUKpHNZonFYkSjUZRSWJbFw4cP2dnZIRKJ8P79++qw1pqnT5+Sy+WwbZvt7W1qa2sZHBxkfn4egMePH/PkyROWlpbo7e2lu/vYqTgOA9y+fZutrS2i0SilUolPnz7R1dVFJBJBa01NTQ2PHj1ie3ubcDjM6urqsdv71eK/dtza2komk0FKycjICNPT0wSDQVKpFHNzcywuLnLz5k3Onj17suJbt27R09NDNBrl4OCAXC5HZ2cnjY2NeJ6HbdsUCgXq6+spFotEIpHqsJSSly9fsrGxQVNT0+cDdO/ePWZmZvD5fLS3t5PP59nY2KClpQWlVHXYcRxjeHiYra0tLly4gOM47O7u0tPTQyAQQGuNZVncv3+fq1evcv78edbW1qr/4/39fcO2bXp7ez/PmpubAYjH4wgh8DyPcDhMOBxmd3eXfD6vhBCG1tr7V/jVq1c/bm5uJgEDEFrrzzVCCIQQ+Hw+YRiGIYTQruuqlZWV34F/VP8JrFXXl1tvduAAAAAASUVORK5CYII="

/***/ },

/***/ 1201:
/***/ function(module, exports) {

	module.exports = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABYAAAAWCAMAAADzapwJAAAAA3NCSVQICAjb4U/gAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAAGXRFWHRTb2Z0d2FyZQB3d3cuaW5rc2NhcGUub3Jnm+48GgAAAX1QTFRF////AAAAAAAAXIyUXIyUXIyUXIyUXIyUXIyUXIyUKDxEAAAAXIyUXIyUAAAAAAAAXIyUW4uTXIyUXIyUV4WNVoOLXIyUXIyUJzpCVYKJVYGJT3mAT3mAXIyUXIyUV4SMV4SMWomRWomRJztCLjQ2NU9XQ2ZtRGduRWdwRmhxR2lySGlzSWp0SW54S2t1TWx0TWx1TnV+U3qFVHV/VICIVYKKV4CJW4WPXIyUXomSX32FYI+XYY2VZJKaZYqQZZKaaZWdaZadbpmgcI2UcY2Uc52kdJ6ld5+meqGof6asgJyjgKasgZyjhquxh6mxiauzjKmvjKuyjK+0jK+1jamvjauyja+0ja+1jbC2jrC2j7G3kLK4kbK4krO5lLS6lLW6lbW6l7e8mbe9mre+mri+m7i+m7m+nLm/oLzCoL3DpcDFp8HHqcLHqcPIq8XJrMXKtcnLt8rNvc7Qvc/RvdHVvdHWvs/Rv8/Rv9DSw9bZxNbZxNba3efq4ggA9vn6YrfIDQAAACN0Uk5TAA4QEBQuMDM0NUBIUVRWV3F1goqanqChwMDDy83V3+Dh9/ihqRhOAAAA6klEQVQY02NgIBWIWaAAcYgou1MuDOTkZGck2nOCRLnU/LOUkUCMuzoXUFjCJClTuQ4OlKN8TSWAwqwO6ampKckqKrW1KipRkZER4bYgU4Q8EuLjYmOio8BCwUDgJgwUli2sqCgvKysrLoKBAjkGBmZrOwxgzcLA5hiooWtoZGZuaWNjaW5mZKirEerIwcDjGqBZo4oMNUNceRkEPL20UERrtHy8BRlEgpy1UVVru4SJMkimWemgqtaxSpdikM/T1zP2q4EDP2M9g3wFBsWSyioUUF1dXarEIG2BBcgwMHLz8aMBPm4mBmoAAPqfYXWasLqcAAAAAElFTkSuQmCC"

/***/ },

/***/ 1553:
/***/ function(module, exports) {

	module.exports = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAADdgAAA3YBfdWCzAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAWpSURBVFiFxZfNaxRPGsc/Vd0zcWby0tHETIwgiLAqLHEXVKIXPXjYg0vUi0FDQBTNwbh428Pi1cN6CsTEvKAkHvMX7F5lL+sGVwmKy4KK8XXc+XWmZ6p7uqr2kHT7y89MNNnDFhRDddXzMs/3eb71lLDW8v8cbqONxcXFolLqj67r9lhrXWutY60VxhhhjMEYY5MJIIRASmkApJRWSmlc15VCCBWG4Z+PHDnyeFMOvH//fqK9vf33q4oRQmCMIY5jjDHU63XCMKRer7NqFMdxcF03/U2+5XK53wHephyQUvYopRgbGyOfz9PS0oKUkjiOCcOQIAjwfZ8wDDHGrJEVQuA4DoVCgTNnzrB///62RnYaOuA4jllYWODTp0/84U9XEWIlCo50sJava0dSU1W+lEtUVYVy+Se25ZoQRvK3vy7w6NEjDhw40MhMYwe01kgpsdYihABrsFagscQ6Rsd16iYm1hFaGyqVZaSUFDuLuE6WUCmy2Qyu634ToR9yII7jr8aFJrYGsAgD2hqQlozjsq0pi7GWluYWVE3x0398nGZJrOtYa5FSbtkB0dHRged5PPrL33EzGQCMMYRhSK1WI4qidZVnMhlyuRzb21bktdabd8Bay9GjR9PE8zwPIQRRFOH7PqVSiSAI1k3AQqFAR0cHuVyOvr4+Xr9+vXkHtNbCWsvJkyfT0koc01qjtW4YWsdx0vO1Wm3rOaC1ZmBggEqlQnNzM/Pz85w7dy5dz87OcvHiRYIgoFAoMDc3hxCC8+fPp2fu37+fcsV6QzbaMMZgrUUpleIOEIYhWmuUUlhr03UYhiS0nnBD8m0juheNNufn5x/39vb+tq2tjWw2i5QrvmqtqdfrDRNLSplCZq0lCAJevnzJiRMnxHrnN+QBgJs3b+I4DpVKhZmZGW7cuEGtVqNcLvPgwQNGRkbIZrP4vs/k5CQAAwMDFAoFqtUqU1NTW6uCOI6FtZYvX75gjElJqVarpXeDtZbl5WWamprWQKCUIggCXNfdOgQPHz78x+HDh3/jeV4KgTGGKIpSkvpG2eodkFxExhiCIODFixecOnVq8xAk3ifze+UnxIqN9eQaje/ywODgID09PSwtLTE7O8vQ0BB79uzh1atXTE1NcfnyZXp6enj79i0zMzNIKblw4QItLS34vs/ExMSGPPDdMgzDkDiOUUql5bZ3794Uc6UUu3fvTss0+dba2pqe2ciBhjkwPT29cOzYsUOe55HJZFL8E2i+UbTauCQlKIRAa00QBCwuLnL69OnN5UCC39DQEB0dHXz+/JnJyUmuXLnCzp07+fjxIxMTE1y9ejXdn56exlq7hh3HxsY2rIINIQCo1+vs27ePer2OMQalFMViMWVCpRQHDx5EKZXKhmFId3f3/8aE9+7dWzh+/PihtrY2hBAbsh987QmTKYQgjuMUgv7+/q1BcOnSJXbs2EGpVGJsbIzh4WG6u7t59+4dd+/eZXh4mM7OzhQiay3Dw8OUy2U8z+P27dtbgwBIQ97Z2bnm8unq6krDG4Yhu3btWgPB0tIS1WqVpaWltJoajYYQjI+PL/T19R1qbm5m9R3QWMlqBSTh7+/vp7e3lydPnjA3N8fz5885e/bs5iAwxqC15tq1a3R1dfHhwwdGR0e5fv061WqVfD7P6OgoIyMjtLa24vs+4+PjwEoT8uzZs7QZ2RIRxXEsEuIpFotrQp7P59N1FEVIKYmiCFjJne3bt2OMob29/fvRawTBnTt3/tnX1/drz1v3QbNWyeol9POXUeLc8vIyT58+ZXBw8MchEELIW7duOeVyOW1EEkMb3YIJEyYyURRRLpcplUpaCLHNWqt+KdsoB/Jv3rx53NTU9CvP85zEcKMe/+dJCKS9gzEG3/ft4uLiC2AX8O9vZBv8IwcoAj1ABlg3fD8w7OqsAP+y1lZ/eeC/8G7PTU3b9tkAAAAASUVORK5CYII="

/***/ }

/******/ })
});
;